cola Report for GDS4109

Date: 2019-12-25 21:10:42 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 21168 rows and 79 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] 21168    79

Density distribution

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

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

plot of chunk density-heatmap

Suggest the best k

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

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

suggest_best_k(res_list)
The best k 1-PAC Mean silhouette Concordance Optional k
ATC:skmeans 3 1.000 0.947 0.979 ** 2
ATC:NMF 2 0.999 0.957 0.982 **
CV:kmeans 2 0.998 0.955 0.981 **
CV:NMF 2 0.948 0.954 0.979 *
SD:skmeans 2 0.947 0.953 0.980 *
ATC:pam 2 0.947 0.926 0.970 *
CV:skmeans 2 0.943 0.939 0.974 *
ATC:kmeans 4 0.921 0.905 0.939 * 2
MAD:kmeans 2 0.919 0.923 0.953 *
ATC:mclust 4 0.898 0.924 0.968
SD:kmeans 2 0.893 0.939 0.956
MAD:skmeans 2 0.870 0.933 0.970
SD:NMF 2 0.845 0.931 0.968
MAD:NMF 2 0.841 0.916 0.962
CV:mclust 4 0.758 0.850 0.914
SD:mclust 4 0.682 0.785 0.879
MAD:mclust 4 0.620 0.776 0.853
SD:pam 3 0.599 0.755 0.881
MAD:pam 3 0.524 0.699 0.860
ATC:hclust 3 0.524 0.714 0.833
CV:pam 2 0.368 0.725 0.872
CV:hclust 4 0.320 0.630 0.821
MAD:hclust 5 0.302 0.513 0.685
SD:hclust 3 0.256 0.645 0.825

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

CDF of consensus matrices

Cumulative distribution function curves of consensus matrix for all methods.

collect_plots(res_list, fun = plot_ecdf)

plot of chunk collect-plots

Consensus heatmap

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

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

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

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

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

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

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

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

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

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

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

Membership heatmap

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

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

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

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

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

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

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

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

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

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

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

Signature heatmap

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

Note in following heatmaps, rows are scaled.

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

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

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

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

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

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

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

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

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

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

Statistics table

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

get_stats(res_list, k = 2)
#>             k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> SD:NMF      2 0.845           0.931       0.968          0.498 0.503   0.503
#> CV:NMF      2 0.948           0.954       0.979          0.501 0.498   0.498
#> MAD:NMF     2 0.841           0.916       0.962          0.500 0.503   0.503
#> ATC:NMF     2 0.999           0.957       0.982          0.462 0.529   0.529
#> SD:skmeans  2 0.947           0.953       0.980          0.503 0.496   0.496
#> CV:skmeans  2 0.943           0.939       0.974          0.503 0.498   0.498
#> MAD:skmeans 2 0.870           0.933       0.970          0.503 0.496   0.496
#> ATC:skmeans 2 1.000           0.993       0.997          0.500 0.500   0.500
#> SD:mclust   2 0.842           0.927       0.952          0.233 0.796   0.796
#> CV:mclust   2 0.733           0.870       0.944          0.345 0.658   0.658
#> MAD:mclust  2 0.526           0.748       0.879          0.282 0.705   0.705
#> ATC:mclust  2 0.150           0.000       0.656          0.369 1.000   1.000
#> SD:kmeans   2 0.893           0.939       0.956          0.486 0.512   0.512
#> CV:kmeans   2 0.998           0.955       0.981          0.490 0.512   0.512
#> MAD:kmeans  2 0.919           0.923       0.953          0.489 0.517   0.517
#> ATC:kmeans  2 1.000           0.979       0.991          0.494 0.503   0.503
#> SD:pam      2 0.271           0.639       0.830          0.493 0.494   0.494
#> CV:pam      2 0.368           0.725       0.872          0.499 0.496   0.496
#> MAD:pam     2 0.270           0.654       0.813          0.489 0.507   0.507
#> ATC:pam     2 0.947           0.926       0.970          0.499 0.500   0.500
#> SD:hclust   2 0.173           0.600       0.829          0.273 0.903   0.903
#> CV:hclust   2 0.233           0.703       0.832          0.226 0.926   0.926
#> MAD:hclust  2 0.172           0.644       0.823          0.330 0.705   0.705
#> ATC:hclust  2 0.436           0.731       0.884          0.324 0.739   0.739
get_stats(res_list, k = 3)
#>             k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> SD:NMF      3 0.497           0.674       0.835          0.347 0.755   0.545
#> CV:NMF      3 0.531           0.750       0.859          0.333 0.749   0.534
#> MAD:NMF     3 0.491           0.656       0.830          0.338 0.748   0.535
#> ATC:NMF     3 0.645           0.723       0.887          0.390 0.759   0.569
#> SD:skmeans  3 0.609           0.780       0.891          0.335 0.738   0.518
#> CV:skmeans  3 0.470           0.691       0.839          0.331 0.751   0.538
#> MAD:skmeans 3 0.561           0.775       0.886          0.336 0.744   0.527
#> ATC:skmeans 3 1.000           0.947       0.979          0.307 0.803   0.621
#> SD:mclust   3 0.342           0.519       0.739          1.123 0.753   0.691
#> CV:mclust   3 0.382           0.597       0.761          0.678 0.611   0.455
#> MAD:mclust  3 0.289           0.573       0.737          1.044 0.529   0.394
#> ATC:mclust  3 0.559           0.838       0.868          0.638 0.361   0.361
#> SD:kmeans   3 0.561           0.788       0.813          0.308 0.799   0.617
#> CV:kmeans   3 0.538           0.539       0.773          0.281 0.829   0.679
#> MAD:kmeans  3 0.619           0.859       0.873          0.334 0.790   0.603
#> ATC:kmeans  3 0.523           0.703       0.794          0.261 0.883   0.775
#> SD:pam      3 0.599           0.755       0.881          0.322 0.757   0.555
#> CV:pam      3 0.530           0.662       0.844          0.311 0.799   0.614
#> MAD:pam     3 0.524           0.699       0.860          0.327 0.784   0.597
#> ATC:pam     3 0.613           0.744       0.857          0.307 0.813   0.640
#> SD:hclust   3 0.256           0.645       0.825          0.585 0.772   0.747
#> CV:hclust   3 0.193           0.642       0.807          0.709 0.786   0.769
#> MAD:hclust  3 0.231           0.499       0.773          0.664 0.747   0.650
#> ATC:hclust  3 0.524           0.714       0.833          0.794 0.631   0.520
get_stats(res_list, k = 4)
#>             k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> SD:NMF      4 0.423           0.539       0.712         0.1151 0.835   0.554
#> CV:NMF      4 0.465           0.564       0.742         0.1231 0.850   0.586
#> MAD:NMF     4 0.404           0.456       0.673         0.1185 0.850   0.587
#> ATC:NMF     4 0.515           0.570       0.781         0.1448 0.798   0.500
#> SD:skmeans  4 0.459           0.516       0.733         0.1160 0.924   0.779
#> CV:skmeans  4 0.398           0.490       0.700         0.1157 0.934   0.808
#> MAD:skmeans 4 0.439           0.516       0.730         0.1157 0.922   0.770
#> ATC:skmeans 4 0.881           0.827       0.929         0.1135 0.875   0.660
#> SD:mclust   4 0.682           0.785       0.879         0.4442 0.624   0.380
#> CV:mclust   4 0.758           0.850       0.914         0.2637 0.789   0.506
#> MAD:mclust  4 0.620           0.776       0.853         0.2631 0.819   0.566
#> ATC:mclust  4 0.898           0.924       0.968         0.1803 0.853   0.630
#> SD:kmeans   4 0.695           0.834       0.876         0.1484 0.910   0.742
#> CV:kmeans   4 0.609           0.793       0.857         0.1606 0.766   0.465
#> MAD:kmeans  4 0.698           0.774       0.837         0.1257 0.932   0.797
#> ATC:kmeans  4 0.921           0.905       0.939         0.1541 0.817   0.581
#> SD:pam      4 0.591           0.690       0.855         0.0508 0.954   0.875
#> CV:pam      4 0.507           0.608       0.819         0.0393 0.975   0.929
#> MAD:pam     4 0.549           0.674       0.855         0.0401 0.973   0.922
#> ATC:pam     4 0.665           0.776       0.877         0.0823 0.934   0.818
#> SD:hclust   4 0.266           0.522       0.766         0.2338 0.922   0.884
#> CV:hclust   4 0.320           0.630       0.821         0.2472 0.895   0.853
#> MAD:hclust  4 0.273           0.383       0.698         0.1320 0.923   0.843
#> ATC:hclust  4 0.498           0.528       0.745         0.1802 0.823   0.608
get_stats(res_list, k = 5)
#>             k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> SD:NMF      5 0.499           0.431       0.674         0.0633 0.869   0.559
#> CV:NMF      5 0.515           0.466       0.684         0.0663 0.908   0.665
#> MAD:NMF     5 0.498           0.465       0.689         0.0652 0.890   0.607
#> ATC:NMF     5 0.554           0.565       0.739         0.0703 0.779   0.354
#> SD:skmeans  5 0.463           0.400       0.651         0.0648 0.875   0.586
#> CV:skmeans  5 0.407           0.351       0.613         0.0630 0.932   0.773
#> MAD:skmeans 5 0.436           0.391       0.650         0.0648 0.884   0.606
#> ATC:skmeans 5 0.717           0.589       0.791         0.0635 0.958   0.852
#> SD:mclust   5 0.584           0.556       0.771         0.0635 0.966   0.880
#> CV:mclust   5 0.661           0.766       0.834         0.0462 1.000   1.000
#> MAD:mclust  5 0.599           0.541       0.768         0.0765 0.946   0.804
#> ATC:mclust  5 0.661           0.724       0.812         0.0595 1.000   1.000
#> SD:kmeans   5 0.713           0.682       0.804         0.0647 0.985   0.945
#> CV:kmeans   5 0.668           0.644       0.803         0.0628 0.969   0.886
#> MAD:kmeans  5 0.726           0.637       0.811         0.0667 0.920   0.715
#> ATC:kmeans  5 0.745           0.655       0.802         0.0828 0.918   0.732
#> SD:pam      5 0.602           0.668       0.838         0.0262 0.970   0.912
#> CV:pam      5 0.509           0.553       0.795         0.0212 0.981   0.944
#> MAD:pam     5 0.570           0.560       0.827         0.0380 0.976   0.928
#> ATC:pam     5 0.768           0.845       0.910         0.0915 0.886   0.650
#> SD:hclust   5 0.302           0.380       0.717         0.1105 0.956   0.927
#> CV:hclust   5 0.291           0.506       0.754         0.1545 0.841   0.749
#> MAD:hclust  5 0.302           0.513       0.685         0.0944 0.785   0.526
#> ATC:hclust  5 0.562           0.524       0.741         0.0986 0.822   0.487
get_stats(res_list, k = 6)
#>             k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> SD:NMF      6 0.577           0.472       0.695         0.0374 0.933   0.713
#> CV:NMF      6 0.556           0.412       0.658         0.0379 0.932   0.706
#> MAD:NMF     6 0.590           0.456       0.690         0.0402 0.926   0.675
#> ATC:NMF     6 0.545           0.478       0.679         0.0334 0.969   0.854
#> SD:skmeans  6 0.506           0.317       0.595         0.0392 0.944   0.756
#> CV:skmeans  6 0.459           0.277       0.540         0.0425 0.924   0.706
#> MAD:skmeans 6 0.481           0.342       0.585         0.0400 0.934   0.706
#> ATC:skmeans 6 0.691           0.603       0.753         0.0430 0.896   0.624
#> SD:mclust   6 0.613           0.492       0.721         0.0446 0.945   0.802
#> CV:mclust   6 0.624           0.571       0.744         0.0378 0.925   0.728
#> MAD:mclust  6 0.610           0.444       0.687         0.0320 0.937   0.737
#> ATC:mclust  6 0.709           0.672       0.803         0.0619 0.852   0.520
#> SD:kmeans   6 0.716           0.495       0.763         0.0450 0.923   0.712
#> CV:kmeans   6 0.679           0.544       0.743         0.0433 0.941   0.779
#> MAD:kmeans  6 0.709           0.553       0.765         0.0411 0.978   0.898
#> ATC:kmeans  6 0.728           0.618       0.760         0.0496 0.883   0.565
#> SD:pam      6 0.626           0.601       0.832         0.0152 0.986   0.955
#> CV:pam      6 0.512           0.528       0.789         0.0150 0.968   0.902
#> MAD:pam     6 0.568           0.581       0.822         0.0132 0.969   0.906
#> ATC:pam     6 0.749           0.561       0.756         0.0636 0.856   0.489
#> SD:hclust   6 0.304           0.465       0.710         0.0871 0.793   0.634
#> CV:hclust   6 0.295           0.612       0.768         0.1206 0.847   0.706
#> MAD:hclust  6 0.370           0.487       0.678         0.0685 0.953   0.833
#> ATC:hclust  6 0.580           0.497       0.739         0.0282 0.982   0.919

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) k
#> SD:NMF      77          0.01538 2
#> CV:NMF      78          0.03818 2
#> MAD:NMF     77          0.01538 2
#> ATC:NMF     78          0.31199 2
#> SD:skmeans  78          0.04094 2
#> CV:skmeans  77          0.08416 2
#> MAD:skmeans 77          0.02890 2
#> ATC:skmeans 79          0.08695 2
#> SD:mclust   78          0.70899 2
#> CV:mclust   75          0.52534 2
#> MAD:mclust  72          0.13652 2
#> ATC:mclust   0               NA 2
#> SD:kmeans   79          0.13064 2
#> CV:kmeans   77          0.12783 2
#> MAD:kmeans  77          0.07747 2
#> ATC:kmeans  78          0.06673 2
#> SD:pam      71          0.00565 2
#> CV:pam      73          0.00713 2
#> MAD:pam     73          0.77542 2
#> ATC:pam     77          0.20434 2
#> SD:hclust   57          0.09550 2
#> CV:hclust   77          0.43959 2
#> MAD:hclust  69          0.01221 2
#> ATC:hclust  68          1.00000 2
test_to_known_factors(res_list, k = 3)
#>              n disease.state(p) k
#> SD:NMF      67         0.004348 3
#> CV:NMF      71         0.000930 3
#> MAD:NMF     63         0.003669 3
#> ATC:NMF     66         0.604365 3
#> SD:skmeans  72         0.004020 3
#> CV:skmeans  67         0.013503 3
#> MAD:skmeans 72         0.004214 3
#> ATC:skmeans 75         0.198140 3
#> SD:mclust   57         0.217554 3
#> CV:mclust   64         0.004142 3
#> MAD:mclust  65         0.012202 3
#> ATC:mclust  78         0.191695 3
#> SD:kmeans   76         0.003389 3
#> CV:kmeans   54         0.827712 3
#> MAD:kmeans  77         0.003737 3
#> ATC:kmeans  65         0.164039 3
#> SD:pam      70         0.001008 3
#> CV:pam      65         0.000231 3
#> MAD:pam     67         0.000665 3
#> ATC:pam     75         0.215821 3
#> SD:hclust   63         0.078236 3
#> CV:hclust   64         0.221035 3
#> MAD:hclust  54         0.004346 3
#> ATC:hclust  64         0.079102 3
test_to_known_factors(res_list, k = 4)
#>              n disease.state(p) k
#> SD:NMF      55         0.003728 4
#> CV:NMF      58         0.010181 4
#> MAD:NMF     37         0.073093 4
#> ATC:NMF     54         0.891771 4
#> SD:skmeans  54         0.012158 4
#> CV:skmeans  48         0.052392 4
#> MAD:skmeans 54         0.006391 4
#> ATC:skmeans 72         0.282472 4
#> SD:mclust   74         0.016786 4
#> CV:mclust   77         0.031371 4
#> MAD:mclust  74         0.005580 4
#> ATC:mclust  78         0.323696 4
#> SD:kmeans   76         0.009565 4
#> CV:kmeans   73         0.005367 4
#> MAD:kmeans  73         0.010510 4
#> ATC:kmeans  76         0.320126 4
#> SD:pam      67         0.000946 4
#> CV:pam      64         0.000175 4
#> MAD:pam     68         0.002427 4
#> ATC:pam     74         0.400867 4
#> SD:hclust   50         0.317075 4
#> CV:hclust   59         0.775445 4
#> MAD:hclust  49         0.012861 4
#> ATC:hclust  55         0.234594 4
test_to_known_factors(res_list, k = 5)
#>              n disease.state(p) k
#> SD:NMF      39         0.024769 5
#> CV:NMF      38         0.005763 5
#> MAD:NMF     41         0.072088 5
#> ATC:NMF     56         0.213102 5
#> SD:skmeans  35         0.058151 5
#> CV:skmeans  29         0.035361 5
#> MAD:skmeans 35         0.104015 5
#> ATC:skmeans 55         0.198855 5
#> SD:mclust   59         0.105064 5
#> CV:mclust   75         0.018065 5
#> MAD:mclust  51         0.012708 5
#> ATC:mclust  70         0.313767 5
#> SD:kmeans   62         0.047107 5
#> CV:kmeans   63         0.013902 5
#> MAD:kmeans  57         0.015478 5
#> ATC:kmeans  71         0.351009 5
#> SD:pam      66         0.001101 5
#> CV:pam      56         0.000526 5
#> MAD:pam     56         0.023961 5
#> ATC:pam     76         0.245526 5
#> SD:hclust   40         0.540890 5
#> CV:hclust   60         0.107880 5
#> MAD:hclust  52         0.144130 5
#> ATC:hclust  58         0.042991 5
test_to_known_factors(res_list, k = 6)
#>              n disease.state(p) k
#> SD:NMF      45          0.02113 6
#> CV:NMF      35          0.00437 6
#> MAD:NMF     43          0.02427 6
#> ATC:NMF     40          0.04979 6
#> SD:skmeans  28          0.20788 6
#> CV:skmeans  11          0.24030 6
#> MAD:skmeans 27          0.09979 6
#> ATC:skmeans 62          0.33922 6
#> SD:mclust   52          0.02316 6
#> CV:mclust   56          0.18827 6
#> MAD:mclust  42          0.15494 6
#> ATC:mclust  66          0.18297 6
#> SD:kmeans   43          0.09348 6
#> CV:kmeans   50          0.22323 6
#> MAD:kmeans  53          0.15886 6
#> ATC:kmeans  59          0.16496 6
#> SD:pam      61          0.00122 6
#> CV:pam      54          0.00278 6
#> MAD:pam     58          0.01847 6
#> ATC:pam     50          0.25029 6
#> SD:hclust   48          0.51590 6
#> CV:hclust   62          0.41699 6
#> MAD:hclust  50          0.52577 6
#> ATC:hclust  47          0.01878 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 21168 rows and 79 columns.
#>   Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'SD' method.
#>   Subgroups are detected by 'hclust' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 3.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

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

collect_plots(res)

plot of chunk SD-hclust-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.173           0.600       0.829         0.2732 0.903   0.903
#> 3 3 0.256           0.645       0.825         0.5848 0.772   0.747
#> 4 4 0.266           0.522       0.766         0.2338 0.922   0.884
#> 5 5 0.302           0.380       0.717         0.1105 0.956   0.927
#> 6 6 0.304           0.465       0.710         0.0871 0.793   0.634

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

suggest_best_k(res)
#> [1] 3

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

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

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>           class entropy silhouette    p1    p2
#> GSM617581     1  0.3584     0.7409 0.932 0.068
#> GSM617582     1  0.5629     0.6658 0.868 0.132
#> GSM617588     1  0.9933     0.1752 0.548 0.452
#> GSM617590     1  0.9732     0.2704 0.596 0.404
#> GSM617592     1  0.9686     0.2855 0.604 0.396
#> GSM617607     1  0.1633     0.7428 0.976 0.024
#> GSM617608     1  0.3431     0.7284 0.936 0.064
#> GSM617609     1  0.8207     0.4624 0.744 0.256
#> GSM617612     1  0.1414     0.7440 0.980 0.020
#> GSM617615     1  0.8661     0.4990 0.712 0.288
#> GSM617616     1  0.3431     0.7286 0.936 0.064
#> GSM617617     1  0.4690     0.7171 0.900 0.100
#> GSM617618     1  0.3733     0.7252 0.928 0.072
#> GSM617619     1  0.8081     0.5122 0.752 0.248
#> GSM617620     1  0.9661     0.2943 0.608 0.392
#> GSM617622     1  0.6531     0.6718 0.832 0.168
#> GSM617623     1  0.2236     0.7442 0.964 0.036
#> GSM617624     1  0.4690     0.7279 0.900 0.100
#> GSM617625     1  0.8081     0.4864 0.752 0.248
#> GSM617626     1  0.1633     0.7425 0.976 0.024
#> GSM617627     1  0.4431     0.7302 0.908 0.092
#> GSM617628     1  0.8081     0.4864 0.752 0.248
#> GSM617632     1  0.2043     0.7388 0.968 0.032
#> GSM617634     1  0.6048     0.6707 0.852 0.148
#> GSM617635     1  0.1184     0.7424 0.984 0.016
#> GSM617636     1  0.2778     0.7339 0.952 0.048
#> GSM617637     1  0.0938     0.7414 0.988 0.012
#> GSM617638     1  0.4161     0.7314 0.916 0.084
#> GSM617639     1  0.0938     0.7409 0.988 0.012
#> GSM617640     1  0.4939     0.7112 0.892 0.108
#> GSM617641     1  0.9754     0.2613 0.592 0.408
#> GSM617643     1  0.5294     0.7030 0.880 0.120
#> GSM617644     1  0.9850     0.2205 0.572 0.428
#> GSM617647     1  0.4690     0.7166 0.900 0.100
#> GSM617648     1  0.5842     0.6891 0.860 0.140
#> GSM617649     1  0.4939     0.7159 0.892 0.108
#> GSM617650     1  0.1184     0.7415 0.984 0.016
#> GSM617651     1  0.1184     0.7422 0.984 0.016
#> GSM617653     1  0.1633     0.7438 0.976 0.024
#> GSM617654     1  0.4690     0.7163 0.900 0.100
#> GSM617583     1  0.7219     0.5798 0.800 0.200
#> GSM617584     1  0.7528     0.6054 0.784 0.216
#> GSM617585     2  0.9754     0.6949 0.408 0.592
#> GSM617586     1  0.7950     0.4971 0.760 0.240
#> GSM617587     1  0.7219     0.5639 0.800 0.200
#> GSM617589     1  0.9977     0.1068 0.528 0.472
#> GSM617591     1  0.8608     0.4615 0.716 0.284
#> GSM617593     1  0.1414     0.7406 0.980 0.020
#> GSM617594     1  0.4690     0.7159 0.900 0.100
#> GSM617595     1  0.1184     0.7421 0.984 0.016
#> GSM617596     1  0.2043     0.7408 0.968 0.032
#> GSM617597     1  0.6531     0.6096 0.832 0.168
#> GSM617598     1  0.1184     0.7427 0.984 0.016
#> GSM617599     1  0.4690     0.7199 0.900 0.100
#> GSM617600     1  0.8909     0.2782 0.692 0.308
#> GSM617601     1  0.5737     0.6909 0.864 0.136
#> GSM617602     1  0.8763     0.2494 0.704 0.296
#> GSM617603     1  0.9996     0.0703 0.512 0.488
#> GSM617604     1  0.2778     0.7390 0.952 0.048
#> GSM617605     1  0.9732     0.2704 0.596 0.404
#> GSM617606     1  0.8661     0.4700 0.712 0.288
#> GSM617610     1  0.0938     0.7409 0.988 0.012
#> GSM617611     1  0.2236     0.7441 0.964 0.036
#> GSM617613     2  0.9795     0.7569 0.416 0.584
#> GSM617614     1  0.5737     0.6579 0.864 0.136
#> GSM617621     1  0.1414     0.7417 0.980 0.020
#> GSM617629     2  1.0000     0.6435 0.496 0.504
#> GSM617630     1  0.5408     0.7113 0.876 0.124
#> GSM617631     1  0.8763     0.2570 0.704 0.296
#> GSM617633     1  0.4815     0.6988 0.896 0.104
#> GSM617642     1  0.6887     0.6092 0.816 0.184
#> GSM617645     1  0.4690     0.7163 0.900 0.100
#> GSM617646     1  0.0938     0.7436 0.988 0.012
#> GSM617652     1  0.2236     0.7412 0.964 0.036
#> GSM617655     1  0.8144     0.4668 0.748 0.252
#> GSM617656     1  0.9209     0.1961 0.664 0.336
#> GSM617657     2  0.8499     0.7082 0.276 0.724
#> GSM617658     1  0.8763     0.2570 0.704 0.296
#> GSM617659     1  0.1633     0.7413 0.976 0.024

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>           class entropy silhouette    p1    p2    p3
#> GSM617581     1  0.3499     0.7655 0.900 0.072 0.028
#> GSM617582     1  0.4873     0.7057 0.824 0.024 0.152
#> GSM617588     2  0.3148     0.7722 0.048 0.916 0.036
#> GSM617590     2  0.2066     0.7927 0.060 0.940 0.000
#> GSM617592     2  0.2356     0.7895 0.072 0.928 0.000
#> GSM617607     1  0.1399     0.7760 0.968 0.004 0.028
#> GSM617608     1  0.2261     0.7691 0.932 0.000 0.068
#> GSM617609     1  0.5835     0.4519 0.660 0.000 0.340
#> GSM617612     1  0.1182     0.7753 0.976 0.012 0.012
#> GSM617615     2  0.7251     0.2734 0.348 0.612 0.040
#> GSM617616     1  0.3234     0.7605 0.908 0.020 0.072
#> GSM617617     1  0.5357     0.6949 0.820 0.116 0.064
#> GSM617618     1  0.3637     0.7523 0.892 0.024 0.084
#> GSM617619     1  0.6852     0.4913 0.664 0.036 0.300
#> GSM617620     2  0.3375     0.7685 0.100 0.892 0.008
#> GSM617622     1  0.6834     0.5302 0.692 0.260 0.048
#> GSM617623     1  0.2050     0.7756 0.952 0.028 0.020
#> GSM617624     1  0.5831     0.6902 0.796 0.128 0.076
#> GSM617625     1  0.7032     0.4938 0.676 0.052 0.272
#> GSM617626     1  0.1315     0.7753 0.972 0.008 0.020
#> GSM617627     1  0.5631     0.6933 0.804 0.132 0.064
#> GSM617628     1  0.7032     0.4938 0.676 0.052 0.272
#> GSM617632     1  0.1289     0.7745 0.968 0.000 0.032
#> GSM617634     1  0.6034     0.6741 0.780 0.068 0.152
#> GSM617635     1  0.0747     0.7724 0.984 0.000 0.016
#> GSM617636     1  0.1964     0.7722 0.944 0.000 0.056
#> GSM617637     1  0.0424     0.7705 0.992 0.000 0.008
#> GSM617638     1  0.3933     0.7430 0.880 0.028 0.092
#> GSM617639     1  0.0592     0.7720 0.988 0.000 0.012
#> GSM617640     1  0.5253     0.6938 0.828 0.096 0.076
#> GSM617641     2  0.2301     0.7925 0.060 0.936 0.004
#> GSM617643     1  0.6000     0.6169 0.760 0.200 0.040
#> GSM617644     2  0.6964     0.4492 0.264 0.684 0.052
#> GSM617647     1  0.5330     0.6846 0.812 0.144 0.044
#> GSM617648     1  0.6348     0.5997 0.740 0.212 0.048
#> GSM617649     1  0.5734     0.6648 0.788 0.164 0.048
#> GSM617650     1  0.0747     0.7737 0.984 0.000 0.016
#> GSM617651     1  0.0848     0.7729 0.984 0.008 0.008
#> GSM617653     1  0.1170     0.7742 0.976 0.016 0.008
#> GSM617654     1  0.4921     0.6978 0.844 0.072 0.084
#> GSM617583     1  0.6481     0.5834 0.728 0.048 0.224
#> GSM617584     2  0.6510     0.3347 0.364 0.624 0.012
#> GSM617585     3  0.9472     0.5934 0.288 0.220 0.492
#> GSM617586     1  0.5706     0.4892 0.680 0.000 0.320
#> GSM617587     1  0.5291     0.5804 0.732 0.000 0.268
#> GSM617589     2  0.2743     0.7389 0.020 0.928 0.052
#> GSM617591     1  0.8321     0.3910 0.620 0.140 0.240
#> GSM617593     1  0.1031     0.7741 0.976 0.000 0.024
#> GSM617594     1  0.5454     0.6760 0.804 0.152 0.044
#> GSM617595     1  0.0661     0.7711 0.988 0.004 0.008
#> GSM617596     1  0.1647     0.7731 0.960 0.004 0.036
#> GSM617597     1  0.5158     0.6234 0.764 0.004 0.232
#> GSM617598     1  0.0747     0.7735 0.984 0.000 0.016
#> GSM617599     1  0.5307     0.6971 0.816 0.136 0.048
#> GSM617600     1  0.6386     0.1965 0.584 0.004 0.412
#> GSM617601     1  0.6201     0.6085 0.748 0.208 0.044
#> GSM617602     1  0.6111     0.2379 0.604 0.000 0.396
#> GSM617603     2  0.2486     0.7292 0.008 0.932 0.060
#> GSM617604     1  0.2749     0.7715 0.924 0.012 0.064
#> GSM617605     2  0.2066     0.7927 0.060 0.940 0.000
#> GSM617606     1  0.8689     0.3102 0.596 0.200 0.204
#> GSM617610     1  0.0829     0.7735 0.984 0.004 0.012
#> GSM617611     1  0.1774     0.7754 0.960 0.016 0.024
#> GSM617613     3  0.5785     0.7132 0.300 0.004 0.696
#> GSM617614     1  0.4629     0.6831 0.808 0.004 0.188
#> GSM617621     1  0.0983     0.7729 0.980 0.004 0.016
#> GSM617629     3  0.6483     0.5954 0.392 0.008 0.600
#> GSM617630     1  0.4731     0.7199 0.840 0.032 0.128
#> GSM617631     1  0.6111     0.2328 0.604 0.000 0.396
#> GSM617633     1  0.4291     0.7167 0.840 0.008 0.152
#> GSM617642     1  0.5138     0.6131 0.748 0.000 0.252
#> GSM617645     1  0.4921     0.6978 0.844 0.072 0.084
#> GSM617646     1  0.1620     0.7734 0.964 0.024 0.012
#> GSM617652     1  0.1647     0.7762 0.960 0.004 0.036
#> GSM617655     1  0.5810     0.4589 0.664 0.000 0.336
#> GSM617656     1  0.6260     0.0783 0.552 0.000 0.448
#> GSM617657     3  0.3349     0.5256 0.108 0.004 0.888
#> GSM617658     1  0.6111     0.2328 0.604 0.000 0.396
#> GSM617659     1  0.1289     0.7749 0.968 0.000 0.032

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM617581     1  0.4414     0.6438 0.824 0.120 0.020 0.036
#> GSM617582     1  0.4530     0.6437 0.804 0.028 0.152 0.016
#> GSM617588     4  0.2799     0.7578 0.008 0.108 0.000 0.884
#> GSM617590     4  0.2530     0.7831 0.000 0.112 0.000 0.888
#> GSM617592     4  0.2589     0.7797 0.000 0.116 0.000 0.884
#> GSM617607     1  0.1936     0.7054 0.940 0.028 0.032 0.000
#> GSM617608     1  0.2124     0.7038 0.924 0.008 0.068 0.000
#> GSM617609     1  0.5110     0.4349 0.636 0.012 0.352 0.000
#> GSM617612     1  0.1139     0.7005 0.972 0.008 0.008 0.012
#> GSM617615     4  0.7109     0.1884 0.272 0.104 0.024 0.600
#> GSM617616     1  0.3330     0.6908 0.884 0.032 0.072 0.012
#> GSM617617     1  0.6161    -0.2028 0.512 0.444 0.004 0.040
#> GSM617618     1  0.3659     0.6847 0.868 0.032 0.084 0.016
#> GSM617619     1  0.7302     0.3566 0.564 0.116 0.300 0.020
#> GSM617620     4  0.3257     0.7613 0.004 0.152 0.000 0.844
#> GSM617622     1  0.7703     0.0964 0.524 0.300 0.020 0.156
#> GSM617623     1  0.2803     0.6876 0.900 0.080 0.012 0.008
#> GSM617624     1  0.7144     0.3102 0.596 0.292 0.060 0.052
#> GSM617625     1  0.6103     0.4683 0.648 0.008 0.284 0.060
#> GSM617626     1  0.1584     0.6997 0.952 0.036 0.012 0.000
#> GSM617627     1  0.6907     0.2778 0.592 0.316 0.044 0.048
#> GSM617628     1  0.6103     0.4683 0.648 0.008 0.284 0.060
#> GSM617632     1  0.1151     0.7024 0.968 0.008 0.024 0.000
#> GSM617634     1  0.6378     0.5731 0.708 0.100 0.156 0.036
#> GSM617635     1  0.0927     0.6981 0.976 0.016 0.008 0.000
#> GSM617636     1  0.1975     0.7048 0.936 0.016 0.048 0.000
#> GSM617637     1  0.0469     0.6957 0.988 0.012 0.000 0.000
#> GSM617638     1  0.6452    -0.4290 0.472 0.460 0.068 0.000
#> GSM617639     1  0.0672     0.6978 0.984 0.008 0.008 0.000
#> GSM617640     2  0.5630     0.6463 0.360 0.608 0.000 0.032
#> GSM617641     4  0.2345     0.7819 0.000 0.100 0.000 0.900
#> GSM617643     1  0.6760     0.0884 0.552 0.352 0.004 0.092
#> GSM617644     4  0.6875     0.2848 0.220 0.184 0.000 0.596
#> GSM617647     1  0.6313     0.3213 0.628 0.300 0.012 0.060
#> GSM617648     1  0.7001     0.1917 0.580 0.300 0.012 0.108
#> GSM617649     1  0.6932     0.2332 0.588 0.312 0.024 0.076
#> GSM617650     1  0.0804     0.7005 0.980 0.012 0.008 0.000
#> GSM617651     1  0.0804     0.6975 0.980 0.012 0.000 0.008
#> GSM617653     1  0.1174     0.6962 0.968 0.020 0.000 0.012
#> GSM617654     2  0.4499     0.7732 0.228 0.756 0.004 0.012
#> GSM617583     1  0.5702     0.5420 0.700 0.008 0.236 0.056
#> GSM617584     4  0.7093     0.2937 0.216 0.216 0.000 0.568
#> GSM617585     3  0.7996     0.5093 0.252 0.024 0.512 0.212
#> GSM617586     1  0.5018     0.4670 0.656 0.012 0.332 0.000
#> GSM617587     1  0.5131     0.5343 0.692 0.028 0.280 0.000
#> GSM617589     4  0.1256     0.7465 0.008 0.028 0.000 0.964
#> GSM617591     1  0.8252     0.3029 0.552 0.088 0.232 0.128
#> GSM617593     1  0.0779     0.7017 0.980 0.004 0.016 0.000
#> GSM617594     1  0.6367     0.2851 0.616 0.308 0.008 0.068
#> GSM617595     1  0.0817     0.6975 0.976 0.024 0.000 0.000
#> GSM617596     1  0.1724     0.7046 0.948 0.020 0.032 0.000
#> GSM617597     1  0.4252     0.5751 0.744 0.004 0.252 0.000
#> GSM617598     1  0.0937     0.6994 0.976 0.012 0.012 0.000
#> GSM617599     1  0.6300     0.3982 0.664 0.252 0.020 0.064
#> GSM617600     1  0.5901     0.2065 0.532 0.036 0.432 0.000
#> GSM617601     1  0.7473     0.0888 0.536 0.320 0.020 0.124
#> GSM617602     1  0.5060     0.2672 0.584 0.004 0.412 0.000
#> GSM617603     4  0.2216     0.7328 0.000 0.092 0.000 0.908
#> GSM617604     1  0.3088     0.7022 0.888 0.052 0.060 0.000
#> GSM617605     4  0.2530     0.7831 0.000 0.112 0.000 0.888
#> GSM617606     1  0.8409     0.2311 0.540 0.080 0.196 0.184
#> GSM617610     1  0.1114     0.7000 0.972 0.016 0.008 0.004
#> GSM617611     1  0.1762     0.7022 0.952 0.012 0.020 0.016
#> GSM617613     3  0.4222     0.6021 0.272 0.000 0.728 0.000
#> GSM617614     1  0.4335     0.6326 0.792 0.016 0.184 0.008
#> GSM617621     1  0.1256     0.6981 0.964 0.028 0.008 0.000
#> GSM617629     3  0.5237     0.5417 0.356 0.016 0.628 0.000
#> GSM617630     2  0.6425     0.6323 0.300 0.604 0.096 0.000
#> GSM617631     1  0.4898     0.2636 0.584 0.000 0.416 0.000
#> GSM617633     1  0.3813     0.6617 0.828 0.024 0.148 0.000
#> GSM617642     1  0.4482     0.5773 0.728 0.008 0.264 0.000
#> GSM617645     2  0.4600     0.7847 0.240 0.744 0.004 0.012
#> GSM617646     1  0.2480     0.6725 0.904 0.088 0.008 0.000
#> GSM617652     1  0.1584     0.7067 0.952 0.012 0.036 0.000
#> GSM617655     1  0.5093     0.4434 0.640 0.012 0.348 0.000
#> GSM617656     1  0.5285     0.1477 0.524 0.008 0.468 0.000
#> GSM617657     3  0.1902     0.3339 0.004 0.064 0.932 0.000
#> GSM617658     1  0.4898     0.2636 0.584 0.000 0.416 0.000
#> GSM617659     1  0.1256     0.7042 0.964 0.008 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
#> GSM617581     1  0.5103     0.5673 0.772 0.028 0.036 0.108 0.056
#> GSM617582     1  0.5014     0.5362 0.748 0.020 0.168 0.016 0.048
#> GSM617588     4  0.3809     0.4313 0.008 0.000 0.000 0.736 0.256
#> GSM617590     4  0.0865     0.6327 0.000 0.004 0.000 0.972 0.024
#> GSM617592     4  0.0794     0.6276 0.000 0.000 0.000 0.972 0.028
#> GSM617607     1  0.2138     0.6361 0.924 0.024 0.044 0.004 0.004
#> GSM617608     1  0.1830     0.6270 0.924 0.008 0.068 0.000 0.000
#> GSM617609     1  0.4705     0.2341 0.580 0.004 0.404 0.000 0.012
#> GSM617612     1  0.1016     0.6333 0.972 0.012 0.008 0.004 0.004
#> GSM617615     4  0.8268    -0.3646 0.180 0.052 0.068 0.480 0.220
#> GSM617616     1  0.3834     0.6019 0.840 0.016 0.088 0.012 0.044
#> GSM617617     1  0.8147    -0.3244 0.384 0.328 0.012 0.084 0.192
#> GSM617618     1  0.4098     0.5919 0.824 0.016 0.100 0.016 0.044
#> GSM617619     1  0.7339     0.1012 0.472 0.064 0.344 0.008 0.112
#> GSM617620     4  0.1809     0.5926 0.000 0.012 0.000 0.928 0.060
#> GSM617622     1  0.8437    -0.1468 0.380 0.076 0.044 0.156 0.344
#> GSM617623     1  0.3838     0.6106 0.852 0.028 0.028 0.036 0.056
#> GSM617624     1  0.8287     0.1595 0.456 0.160 0.080 0.040 0.264
#> GSM617625     1  0.5494     0.2898 0.604 0.008 0.324 0.000 0.064
#> GSM617626     1  0.2194     0.6347 0.928 0.016 0.024 0.008 0.024
#> GSM617627     1  0.8262     0.1329 0.452 0.168 0.072 0.040 0.268
#> GSM617628     1  0.5478     0.2935 0.608 0.008 0.320 0.000 0.064
#> GSM617632     1  0.1372     0.6317 0.956 0.004 0.024 0.000 0.016
#> GSM617634     1  0.7004     0.3755 0.596 0.052 0.176 0.016 0.160
#> GSM617635     1  0.1405     0.6344 0.956 0.016 0.008 0.000 0.020
#> GSM617636     1  0.2452     0.6306 0.908 0.012 0.052 0.000 0.028
#> GSM617637     1  0.0579     0.6311 0.984 0.008 0.000 0.000 0.008
#> GSM617638     2  0.7827     0.3787 0.320 0.464 0.104 0.024 0.088
#> GSM617639     1  0.0740     0.6327 0.980 0.008 0.008 0.000 0.004
#> GSM617640     2  0.6772     0.4645 0.228 0.600 0.008 0.068 0.096
#> GSM617641     4  0.0290     0.6299 0.000 0.000 0.000 0.992 0.008
#> GSM617643     1  0.7781    -0.0802 0.408 0.148 0.012 0.068 0.364
#> GSM617644     5  0.6649     0.0000 0.132 0.020 0.000 0.388 0.460
#> GSM617647     1  0.7934     0.1569 0.480 0.168 0.036 0.052 0.264
#> GSM617648     1  0.7677    -0.0120 0.436 0.092 0.020 0.084 0.368
#> GSM617649     1  0.8023     0.0357 0.428 0.144 0.040 0.052 0.336
#> GSM617650     1  0.0613     0.6307 0.984 0.004 0.008 0.000 0.004
#> GSM617651     1  0.0566     0.6296 0.984 0.012 0.000 0.000 0.004
#> GSM617653     1  0.1173     0.6288 0.964 0.012 0.004 0.000 0.020
#> GSM617654     2  0.2952     0.5547 0.088 0.872 0.000 0.036 0.004
#> GSM617583     1  0.5284     0.3934 0.660 0.008 0.272 0.004 0.056
#> GSM617584     4  0.6485    -0.0986 0.156 0.048 0.016 0.652 0.128
#> GSM617585     3  0.7124     0.3773 0.204 0.004 0.548 0.192 0.052
#> GSM617586     1  0.4655     0.2786 0.600 0.004 0.384 0.000 0.012
#> GSM617587     1  0.5024     0.3694 0.636 0.024 0.324 0.000 0.016
#> GSM617589     4  0.3597     0.5176 0.008 0.012 0.000 0.800 0.180
#> GSM617591     1  0.8215     0.0233 0.444 0.052 0.280 0.048 0.176
#> GSM617593     1  0.0960     0.6330 0.972 0.004 0.016 0.000 0.008
#> GSM617594     1  0.7810     0.1310 0.472 0.164 0.032 0.044 0.288
#> GSM617595     1  0.0693     0.6317 0.980 0.012 0.000 0.000 0.008
#> GSM617596     1  0.2251     0.6293 0.916 0.008 0.052 0.000 0.024
#> GSM617597     1  0.4059     0.4432 0.700 0.000 0.292 0.004 0.004
#> GSM617598     1  0.0727     0.6314 0.980 0.004 0.012 0.000 0.004
#> GSM617599     1  0.7586     0.2300 0.508 0.104 0.056 0.036 0.296
#> GSM617600     1  0.5418    -0.0467 0.480 0.028 0.476 0.000 0.016
#> GSM617601     1  0.8594    -0.0154 0.408 0.164 0.044 0.096 0.288
#> GSM617602     1  0.4792     0.0765 0.536 0.008 0.448 0.000 0.008
#> GSM617603     4  0.5173     0.1555 0.000 0.040 0.000 0.500 0.460
#> GSM617604     1  0.3849     0.6161 0.840 0.016 0.084 0.012 0.048
#> GSM617605     4  0.0865     0.6327 0.000 0.004 0.000 0.972 0.024
#> GSM617606     1  0.8707    -0.0465 0.428 0.072 0.244 0.076 0.180
#> GSM617610     1  0.0867     0.6308 0.976 0.008 0.008 0.000 0.008
#> GSM617611     1  0.1393     0.6318 0.956 0.008 0.024 0.000 0.012
#> GSM617613     3  0.3707     0.5346 0.220 0.004 0.768 0.000 0.008
#> GSM617614     1  0.3907     0.5309 0.768 0.004 0.212 0.004 0.012
#> GSM617621     1  0.1898     0.6331 0.940 0.012 0.016 0.008 0.024
#> GSM617629     3  0.5735     0.4827 0.312 0.016 0.608 0.004 0.060
#> GSM617630     2  0.5573     0.5534 0.156 0.696 0.128 0.012 0.008
#> GSM617631     1  0.4688     0.0674 0.532 0.004 0.456 0.000 0.008
#> GSM617633     1  0.3925     0.5750 0.804 0.016 0.156 0.004 0.020
#> GSM617642     1  0.4127     0.4365 0.680 0.000 0.312 0.000 0.008
#> GSM617645     2  0.3273     0.5901 0.112 0.848 0.000 0.036 0.004
#> GSM617646     1  0.3053     0.6201 0.880 0.076 0.020 0.016 0.008
#> GSM617652     1  0.1730     0.6344 0.940 0.008 0.044 0.004 0.004
#> GSM617655     1  0.4696     0.2459 0.584 0.004 0.400 0.000 0.012
#> GSM617656     3  0.4555    -0.0925 0.472 0.000 0.520 0.000 0.008
#> GSM617657     3  0.3759     0.0598 0.000 0.056 0.808 0.000 0.136
#> GSM617658     1  0.4688     0.0674 0.532 0.004 0.456 0.000 0.008
#> GSM617659     1  0.0880     0.6328 0.968 0.000 0.032 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
#> GSM617581     1  0.4603     0.5867 0.748 0.136 0.020 0.088 0.004 0.004
#> GSM617582     1  0.5304     0.5346 0.688 0.084 0.180 0.000 0.016 0.032
#> GSM617588     4  0.4807     0.2290 0.008 0.076 0.000 0.656 0.000 0.260
#> GSM617590     4  0.1720     0.6552 0.000 0.040 0.000 0.928 0.000 0.032
#> GSM617592     4  0.1204     0.6580 0.000 0.056 0.000 0.944 0.000 0.000
#> GSM617607     1  0.2308     0.6979 0.892 0.068 0.040 0.000 0.000 0.000
#> GSM617608     1  0.1728     0.6965 0.924 0.008 0.064 0.000 0.000 0.004
#> GSM617609     1  0.4517     0.1429 0.524 0.032 0.444 0.000 0.000 0.000
#> GSM617612     1  0.0881     0.7004 0.972 0.012 0.008 0.008 0.000 0.000
#> GSM617615     4  0.8054     0.0871 0.108 0.224 0.080 0.476 0.032 0.080
#> GSM617616     1  0.4324     0.6353 0.780 0.084 0.100 0.000 0.012 0.024
#> GSM617617     2  0.6845     0.3110 0.268 0.424 0.004 0.044 0.260 0.000
#> GSM617618     1  0.4532     0.6216 0.764 0.084 0.112 0.000 0.012 0.028
#> GSM617619     3  0.6802     0.1738 0.340 0.268 0.360 0.000 0.020 0.012
#> GSM617620     4  0.2320     0.6412 0.000 0.080 0.000 0.892 0.004 0.024
#> GSM617622     2  0.6984     0.5335 0.240 0.536 0.032 0.108 0.004 0.080
#> GSM617623     1  0.3502     0.6499 0.820 0.132 0.012 0.028 0.004 0.004
#> GSM617624     2  0.5736     0.6682 0.320 0.572 0.068 0.008 0.028 0.004
#> GSM617625     1  0.5548     0.2406 0.556 0.032 0.356 0.004 0.004 0.048
#> GSM617626     1  0.2213     0.6972 0.912 0.048 0.024 0.008 0.000 0.008
#> GSM617627     2  0.5529     0.6793 0.308 0.592 0.060 0.008 0.032 0.000
#> GSM617628     1  0.5538     0.2505 0.560 0.032 0.352 0.004 0.004 0.048
#> GSM617632     1  0.1852     0.6994 0.928 0.040 0.024 0.000 0.004 0.004
#> GSM617634     1  0.6785     0.0824 0.484 0.252 0.212 0.000 0.020 0.032
#> GSM617635     1  0.1410     0.6987 0.944 0.044 0.008 0.000 0.000 0.004
#> GSM617636     1  0.2945     0.6936 0.868 0.064 0.052 0.000 0.004 0.012
#> GSM617637     1  0.0547     0.6954 0.980 0.020 0.000 0.000 0.000 0.000
#> GSM617638     5  0.7448     0.1584 0.236 0.232 0.112 0.004 0.412 0.004
#> GSM617639     1  0.0508     0.6994 0.984 0.012 0.004 0.000 0.000 0.000
#> GSM617640     5  0.6086     0.4221 0.148 0.276 0.000 0.036 0.540 0.000
#> GSM617641     4  0.0692     0.6491 0.000 0.020 0.000 0.976 0.000 0.004
#> GSM617643     2  0.4643     0.6381 0.248 0.692 0.000 0.028 0.020 0.012
#> GSM617644     2  0.7117    -0.4397 0.060 0.360 0.000 0.276 0.004 0.300
#> GSM617647     2  0.5271     0.6812 0.348 0.580 0.016 0.016 0.040 0.000
#> GSM617648     2  0.5343     0.6545 0.276 0.640 0.012 0.032 0.012 0.028
#> GSM617649     2  0.4600     0.6811 0.244 0.700 0.028 0.008 0.012 0.008
#> GSM617650     1  0.0622     0.6985 0.980 0.012 0.008 0.000 0.000 0.000
#> GSM617651     1  0.0653     0.6955 0.980 0.012 0.000 0.004 0.004 0.000
#> GSM617653     1  0.1180     0.6965 0.960 0.024 0.000 0.004 0.008 0.004
#> GSM617654     5  0.2722     0.5323 0.032 0.088 0.000 0.004 0.872 0.004
#> GSM617583     1  0.5370     0.3657 0.612 0.032 0.304 0.008 0.004 0.040
#> GSM617584     4  0.5512     0.3294 0.116 0.244 0.004 0.620 0.012 0.004
#> GSM617585     3  0.7040     0.3535 0.160 0.044 0.564 0.160 0.008 0.064
#> GSM617586     1  0.4488     0.2157 0.548 0.032 0.420 0.000 0.000 0.000
#> GSM617587     1  0.4931     0.3201 0.576 0.064 0.356 0.000 0.004 0.000
#> GSM617589     4  0.3494     0.4040 0.004 0.016 0.000 0.788 0.008 0.184
#> GSM617591     1  0.8049    -0.3420 0.316 0.252 0.316 0.036 0.020 0.060
#> GSM617593     1  0.0767     0.7011 0.976 0.008 0.012 0.000 0.000 0.004
#> GSM617594     2  0.4984     0.7020 0.320 0.620 0.024 0.012 0.024 0.000
#> GSM617595     1  0.0632     0.6959 0.976 0.024 0.000 0.000 0.000 0.000
#> GSM617596     1  0.2965     0.6912 0.864 0.068 0.056 0.000 0.004 0.008
#> GSM617597     1  0.4182     0.4549 0.660 0.024 0.312 0.000 0.000 0.004
#> GSM617598     1  0.0912     0.7017 0.972 0.008 0.012 0.000 0.004 0.004
#> GSM617599     2  0.5692     0.6742 0.348 0.552 0.060 0.016 0.024 0.000
#> GSM617600     3  0.5483     0.1864 0.388 0.112 0.496 0.000 0.000 0.004
#> GSM617601     2  0.5969     0.6769 0.244 0.628 0.036 0.048 0.024 0.020
#> GSM617602     1  0.5233     0.0622 0.496 0.032 0.444 0.000 0.012 0.016
#> GSM617603     6  0.3641     0.0000 0.000 0.020 0.000 0.248 0.000 0.732
#> GSM617604     1  0.3917     0.6613 0.804 0.096 0.080 0.008 0.004 0.008
#> GSM617605     4  0.1720     0.6552 0.000 0.040 0.000 0.928 0.000 0.032
#> GSM617606     1  0.8595    -0.3332 0.328 0.208 0.280 0.048 0.032 0.104
#> GSM617610     1  0.0603     0.6975 0.980 0.016 0.004 0.000 0.000 0.000
#> GSM617611     1  0.1294     0.7001 0.956 0.008 0.024 0.004 0.000 0.008
#> GSM617613     3  0.3972     0.4834 0.184 0.020 0.768 0.000 0.012 0.016
#> GSM617614     1  0.4357     0.5660 0.716 0.036 0.232 0.004 0.004 0.008
#> GSM617621     1  0.2077     0.6932 0.916 0.056 0.012 0.008 0.000 0.008
#> GSM617629     3  0.6827     0.3839 0.244 0.076 0.540 0.000 0.032 0.108
#> GSM617630     5  0.5491     0.5447 0.088 0.072 0.144 0.004 0.688 0.004
#> GSM617631     1  0.5150     0.0500 0.492 0.032 0.452 0.000 0.008 0.016
#> GSM617633     1  0.4119     0.6348 0.776 0.052 0.148 0.000 0.016 0.008
#> GSM617642     1  0.4167     0.4221 0.632 0.024 0.344 0.000 0.000 0.000
#> GSM617645     5  0.3148     0.5899 0.064 0.092 0.000 0.004 0.840 0.000
#> GSM617646     1  0.2996     0.6532 0.832 0.144 0.016 0.000 0.008 0.000
#> GSM617652     1  0.1788     0.7038 0.928 0.028 0.040 0.000 0.000 0.004
#> GSM617655     1  0.4509     0.1734 0.532 0.032 0.436 0.000 0.000 0.000
#> GSM617656     3  0.4348     0.1116 0.416 0.024 0.560 0.000 0.000 0.000
#> GSM617657     3  0.5906    -0.2980 0.000 0.148 0.628 0.000 0.084 0.140
#> GSM617658     1  0.5150     0.0500 0.492 0.032 0.452 0.000 0.008 0.016
#> GSM617659     1  0.0858     0.7038 0.968 0.000 0.028 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-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) k
#> SD:hclust 57           0.0955 2
#> SD:hclust 63           0.0782 3
#> SD:hclust 50           0.3171 4
#> SD:hclust 40           0.5409 5
#> SD:hclust 48           0.5159 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 21168 rows and 79 columns.
#>   Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'SD' method.
#>   Subgroups are detected by 'kmeans' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 2.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

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

collect_plots(res)

plot of chunk SD-kmeans-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.893           0.939       0.956         0.4863 0.512   0.512
#> 3 3 0.561           0.788       0.813         0.3082 0.799   0.617
#> 4 4 0.695           0.834       0.876         0.1484 0.910   0.742
#> 5 5 0.713           0.682       0.804         0.0647 0.985   0.945
#> 6 6 0.716           0.495       0.763         0.0450 0.923   0.712

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
#> GSM617581     1  0.7453      0.778 0.788 0.212
#> GSM617582     1  0.5519      0.889 0.872 0.128
#> GSM617588     2  0.1184      0.960 0.016 0.984
#> GSM617590     2  0.1184      0.951 0.016 0.984
#> GSM617592     2  0.1184      0.960 0.016 0.984
#> GSM617607     1  0.1184      0.964 0.984 0.016
#> GSM617608     1  0.1184      0.964 0.984 0.016
#> GSM617609     1  0.1633      0.958 0.976 0.024
#> GSM617612     1  0.1184      0.964 0.984 0.016
#> GSM617615     2  0.1414      0.959 0.020 0.980
#> GSM617616     1  0.1633      0.962 0.976 0.024
#> GSM617617     2  0.1843      0.959 0.028 0.972
#> GSM617618     1  0.2236      0.958 0.964 0.036
#> GSM617619     2  0.6247      0.837 0.156 0.844
#> GSM617620     2  0.1184      0.960 0.016 0.984
#> GSM617622     2  0.1184      0.958 0.016 0.984
#> GSM617623     1  0.7745      0.754 0.772 0.228
#> GSM617624     2  0.4022      0.933 0.080 0.920
#> GSM617625     1  0.1633      0.959 0.976 0.024
#> GSM617626     1  0.6887      0.807 0.816 0.184
#> GSM617627     2  0.1843      0.960 0.028 0.972
#> GSM617628     1  0.1633      0.959 0.976 0.024
#> GSM617632     1  0.1633      0.962 0.976 0.024
#> GSM617634     2  0.3879      0.924 0.076 0.924
#> GSM617635     1  0.1184      0.964 0.984 0.016
#> GSM617636     1  0.1414      0.963 0.980 0.020
#> GSM617637     1  0.1184      0.964 0.984 0.016
#> GSM617638     2  0.6531      0.830 0.168 0.832
#> GSM617639     1  0.1184      0.964 0.984 0.016
#> GSM617640     2  0.2043      0.958 0.032 0.968
#> GSM617641     2  0.0376      0.959 0.004 0.996
#> GSM617643     2  0.1843      0.960 0.028 0.972
#> GSM617644     2  0.1184      0.960 0.016 0.984
#> GSM617647     2  0.2043      0.958 0.032 0.968
#> GSM617648     2  0.1414      0.960 0.020 0.980
#> GSM617649     2  0.1843      0.959 0.028 0.972
#> GSM617650     1  0.1184      0.964 0.984 0.016
#> GSM617651     1  0.1184      0.964 0.984 0.016
#> GSM617653     1  0.1184      0.964 0.984 0.016
#> GSM617654     2  0.2043      0.958 0.032 0.968
#> GSM617583     1  0.1633      0.959 0.976 0.024
#> GSM617584     2  0.1414      0.960 0.020 0.980
#> GSM617585     2  0.1184      0.951 0.016 0.984
#> GSM617586     1  0.1414      0.958 0.980 0.020
#> GSM617587     1  0.1414      0.959 0.980 0.020
#> GSM617589     2  0.0672      0.960 0.008 0.992
#> GSM617591     2  0.2778      0.948 0.048 0.952
#> GSM617593     1  0.1184      0.964 0.984 0.016
#> GSM617594     2  0.3274      0.946 0.060 0.940
#> GSM617595     1  0.1184      0.964 0.984 0.016
#> GSM617596     1  0.1633      0.962 0.976 0.024
#> GSM617597     1  0.0672      0.960 0.992 0.008
#> GSM617598     1  0.1184      0.964 0.984 0.016
#> GSM617599     2  0.2603      0.955 0.044 0.956
#> GSM617600     1  0.2236      0.954 0.964 0.036
#> GSM617601     2  0.1414      0.961 0.020 0.980
#> GSM617602     1  0.2778      0.950 0.952 0.048
#> GSM617603     2  0.0938      0.952 0.012 0.988
#> GSM617604     1  0.2423      0.956 0.960 0.040
#> GSM617605     2  0.1184      0.951 0.016 0.984
#> GSM617606     2  0.2423      0.950 0.040 0.960
#> GSM617610     1  0.1184      0.964 0.984 0.016
#> GSM617611     1  0.1184      0.964 0.984 0.016
#> GSM617613     1  0.2423      0.953 0.960 0.040
#> GSM617614     1  0.1633      0.956 0.976 0.024
#> GSM617621     1  0.1633      0.962 0.976 0.024
#> GSM617629     1  0.3431      0.941 0.936 0.064
#> GSM617630     1  0.7299      0.775 0.796 0.204
#> GSM617631     1  0.2778      0.950 0.952 0.048
#> GSM617633     1  0.1184      0.964 0.984 0.016
#> GSM617642     1  0.1184      0.959 0.984 0.016
#> GSM617645     2  0.2043      0.958 0.032 0.968
#> GSM617646     1  0.1184      0.964 0.984 0.016
#> GSM617652     1  0.0672      0.963 0.992 0.008
#> GSM617655     1  0.1843      0.956 0.972 0.028
#> GSM617656     1  0.1843      0.956 0.972 0.028
#> GSM617657     2  0.9286      0.501 0.344 0.656
#> GSM617658     1  0.2603      0.952 0.956 0.044
#> GSM617659     1  0.1184      0.964 0.984 0.016

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>           class entropy silhouette    p1    p2    p3
#> GSM617581     1  0.6000      0.658 0.760 0.200 0.040
#> GSM617582     1  0.7297      0.535 0.708 0.120 0.172
#> GSM617588     2  0.5810      0.750 0.000 0.664 0.336
#> GSM617590     2  0.5760      0.752 0.000 0.672 0.328
#> GSM617592     2  0.5760      0.752 0.000 0.672 0.328
#> GSM617607     1  0.0829      0.906 0.984 0.012 0.004
#> GSM617608     1  0.0424      0.902 0.992 0.000 0.008
#> GSM617609     3  0.6988      0.833 0.320 0.036 0.644
#> GSM617612     1  0.0000      0.906 1.000 0.000 0.000
#> GSM617615     2  0.2269      0.824 0.016 0.944 0.040
#> GSM617616     1  0.1774      0.894 0.960 0.016 0.024
#> GSM617617     2  0.2384      0.819 0.056 0.936 0.008
#> GSM617618     1  0.1919      0.891 0.956 0.020 0.024
#> GSM617619     3  0.6235      0.216 0.000 0.436 0.564
#> GSM617620     2  0.5760      0.752 0.000 0.672 0.328
#> GSM617622     2  0.3377      0.819 0.012 0.896 0.092
#> GSM617623     1  0.6096      0.647 0.752 0.208 0.040
#> GSM617624     2  0.6348      0.667 0.060 0.752 0.188
#> GSM617625     3  0.6111      0.792 0.396 0.000 0.604
#> GSM617626     1  0.2773      0.862 0.928 0.048 0.024
#> GSM617627     2  0.2773      0.818 0.048 0.928 0.024
#> GSM617628     3  0.6095      0.797 0.392 0.000 0.608
#> GSM617632     1  0.1337      0.900 0.972 0.012 0.016
#> GSM617634     2  0.6595      0.673 0.076 0.744 0.180
#> GSM617635     1  0.0237      0.907 0.996 0.004 0.000
#> GSM617636     1  0.1751      0.897 0.960 0.012 0.028
#> GSM617637     1  0.0424      0.907 0.992 0.008 0.000
#> GSM617638     2  0.6578      0.627 0.052 0.724 0.224
#> GSM617639     1  0.0237      0.907 0.996 0.004 0.000
#> GSM617640     2  0.1950      0.823 0.040 0.952 0.008
#> GSM617641     2  0.5760      0.752 0.000 0.672 0.328
#> GSM617643     2  0.1525      0.824 0.032 0.964 0.004
#> GSM617644     2  0.4346      0.800 0.000 0.816 0.184
#> GSM617647     2  0.2680      0.814 0.068 0.924 0.008
#> GSM617648     2  0.2116      0.824 0.040 0.948 0.012
#> GSM617649     2  0.2806      0.815 0.032 0.928 0.040
#> GSM617650     1  0.0747      0.895 0.984 0.000 0.016
#> GSM617651     1  0.0000      0.906 1.000 0.000 0.000
#> GSM617653     1  0.0475      0.907 0.992 0.004 0.004
#> GSM617654     2  0.2550      0.819 0.056 0.932 0.012
#> GSM617583     3  0.6079      0.801 0.388 0.000 0.612
#> GSM617584     2  0.5619      0.782 0.012 0.744 0.244
#> GSM617585     2  0.6008      0.678 0.000 0.628 0.372
#> GSM617586     3  0.6843      0.834 0.332 0.028 0.640
#> GSM617587     3  0.7013      0.834 0.324 0.036 0.640
#> GSM617589     2  0.5810      0.750 0.000 0.664 0.336
#> GSM617591     2  0.4755      0.726 0.008 0.808 0.184
#> GSM617593     1  0.0000      0.906 1.000 0.000 0.000
#> GSM617594     2  0.4045      0.789 0.104 0.872 0.024
#> GSM617595     1  0.0424      0.907 0.992 0.008 0.000
#> GSM617596     1  0.1015      0.904 0.980 0.008 0.012
#> GSM617597     3  0.6260      0.701 0.448 0.000 0.552
#> GSM617598     1  0.0000      0.906 1.000 0.000 0.000
#> GSM617599     2  0.3805      0.799 0.092 0.884 0.024
#> GSM617600     3  0.7189      0.824 0.292 0.052 0.656
#> GSM617601     2  0.3083      0.826 0.024 0.916 0.060
#> GSM617602     3  0.6422      0.827 0.324 0.016 0.660
#> GSM617603     2  0.5810      0.750 0.000 0.664 0.336
#> GSM617604     1  0.4912      0.645 0.796 0.008 0.196
#> GSM617605     2  0.5760      0.752 0.000 0.672 0.328
#> GSM617606     2  0.4033      0.771 0.008 0.856 0.136
#> GSM617610     1  0.0424      0.907 0.992 0.008 0.000
#> GSM617611     1  0.0237      0.904 0.996 0.000 0.004
#> GSM617613     3  0.7308      0.818 0.284 0.060 0.656
#> GSM617614     3  0.6111      0.789 0.396 0.000 0.604
#> GSM617621     1  0.1337      0.902 0.972 0.012 0.016
#> GSM617629     3  0.7821      0.758 0.224 0.116 0.660
#> GSM617630     3  0.5905      0.404 0.000 0.352 0.648
#> GSM617631     3  0.6553      0.830 0.324 0.020 0.656
#> GSM617633     1  0.5580      0.443 0.736 0.008 0.256
#> GSM617642     3  0.6095      0.796 0.392 0.000 0.608
#> GSM617645     2  0.2173      0.822 0.048 0.944 0.008
#> GSM617646     1  0.1647      0.889 0.960 0.036 0.004
#> GSM617652     1  0.4465      0.640 0.820 0.004 0.176
#> GSM617655     3  0.6819      0.835 0.328 0.028 0.644
#> GSM617656     3  0.6627      0.833 0.336 0.020 0.644
#> GSM617657     3  0.6984      0.502 0.040 0.304 0.656
#> GSM617658     3  0.6470      0.805 0.356 0.012 0.632
#> GSM617659     1  0.1643      0.863 0.956 0.000 0.044

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM617581     1  0.5419      0.765 0.764 0.084 0.016 0.136
#> GSM617582     1  0.7532      0.618 0.632 0.084 0.176 0.108
#> GSM617588     4  0.2831      0.916 0.000 0.120 0.004 0.876
#> GSM617590     4  0.3032      0.916 0.000 0.124 0.008 0.868
#> GSM617592     4  0.2704      0.917 0.000 0.124 0.000 0.876
#> GSM617607     1  0.2019      0.904 0.940 0.032 0.024 0.004
#> GSM617608     1  0.1209      0.906 0.964 0.004 0.032 0.000
#> GSM617609     3  0.2002      0.927 0.044 0.020 0.936 0.000
#> GSM617612     1  0.1398      0.905 0.956 0.004 0.040 0.000
#> GSM617615     2  0.2907      0.818 0.004 0.900 0.032 0.064
#> GSM617616     1  0.3240      0.878 0.892 0.036 0.016 0.056
#> GSM617617     2  0.1745      0.834 0.008 0.952 0.020 0.020
#> GSM617618     1  0.3904      0.862 0.860 0.044 0.020 0.076
#> GSM617619     2  0.5999      0.316 0.000 0.552 0.404 0.044
#> GSM617620     4  0.2704      0.917 0.000 0.124 0.000 0.876
#> GSM617622     2  0.5663      0.522 0.024 0.700 0.028 0.248
#> GSM617623     1  0.5354      0.768 0.768 0.080 0.016 0.136
#> GSM617624     2  0.2825      0.816 0.008 0.908 0.036 0.048
#> GSM617625     3  0.2520      0.916 0.088 0.004 0.904 0.004
#> GSM617626     1  0.2291      0.891 0.932 0.036 0.016 0.016
#> GSM617627     2  0.2165      0.838 0.008 0.936 0.024 0.032
#> GSM617628     3  0.2452      0.919 0.084 0.004 0.908 0.004
#> GSM617632     1  0.2422      0.890 0.928 0.028 0.016 0.028
#> GSM617634     2  0.4109      0.772 0.028 0.848 0.032 0.092
#> GSM617635     1  0.1697      0.907 0.952 0.016 0.028 0.004
#> GSM617636     1  0.3818      0.867 0.868 0.044 0.028 0.060
#> GSM617637     1  0.1284      0.908 0.964 0.012 0.024 0.000
#> GSM617638     2  0.3016      0.810 0.004 0.896 0.040 0.060
#> GSM617639     1  0.1406      0.907 0.960 0.016 0.024 0.000
#> GSM617640     2  0.1878      0.832 0.008 0.944 0.008 0.040
#> GSM617641     4  0.2704      0.917 0.000 0.124 0.000 0.876
#> GSM617643     2  0.1786      0.832 0.008 0.948 0.008 0.036
#> GSM617644     2  0.5038      0.416 0.000 0.652 0.012 0.336
#> GSM617647     2  0.1509      0.835 0.008 0.960 0.012 0.020
#> GSM617648     2  0.2499      0.821 0.012 0.924 0.032 0.032
#> GSM617649     2  0.1733      0.838 0.000 0.948 0.024 0.028
#> GSM617650     1  0.1743      0.900 0.940 0.004 0.056 0.000
#> GSM617651     1  0.1004      0.907 0.972 0.004 0.024 0.000
#> GSM617653     1  0.0895      0.903 0.976 0.000 0.004 0.020
#> GSM617654     2  0.1721      0.837 0.008 0.952 0.012 0.028
#> GSM617583     3  0.2053      0.925 0.072 0.004 0.924 0.000
#> GSM617584     4  0.5928      0.671 0.052 0.260 0.012 0.676
#> GSM617585     4  0.5935      0.531 0.000 0.080 0.256 0.664
#> GSM617586     3  0.1807      0.928 0.052 0.008 0.940 0.000
#> GSM617587     3  0.2089      0.927 0.048 0.020 0.932 0.000
#> GSM617589     4  0.2530      0.905 0.000 0.112 0.000 0.888
#> GSM617591     2  0.4817      0.716 0.004 0.768 0.188 0.040
#> GSM617593     1  0.1151      0.907 0.968 0.008 0.024 0.000
#> GSM617594     2  0.2291      0.834 0.036 0.932 0.016 0.016
#> GSM617595     1  0.1284      0.908 0.964 0.012 0.024 0.000
#> GSM617596     1  0.2733      0.887 0.916 0.032 0.020 0.032
#> GSM617597     3  0.3024      0.858 0.148 0.000 0.852 0.000
#> GSM617598     1  0.1004      0.908 0.972 0.004 0.024 0.000
#> GSM617599     2  0.2329      0.823 0.024 0.932 0.024 0.020
#> GSM617600     3  0.3015      0.912 0.020 0.036 0.904 0.040
#> GSM617601     2  0.2164      0.820 0.004 0.924 0.004 0.068
#> GSM617602     3  0.4157      0.876 0.060 0.020 0.848 0.072
#> GSM617603     4  0.3219      0.900 0.000 0.112 0.020 0.868
#> GSM617604     1  0.5319      0.771 0.764 0.024 0.164 0.048
#> GSM617605     4  0.3032      0.916 0.000 0.124 0.008 0.868
#> GSM617606     2  0.5117      0.720 0.004 0.760 0.172 0.064
#> GSM617610     1  0.1284      0.908 0.964 0.012 0.024 0.000
#> GSM617611     1  0.1661      0.901 0.944 0.004 0.052 0.000
#> GSM617613     3  0.2465      0.911 0.012 0.020 0.924 0.044
#> GSM617614     3  0.2125      0.924 0.076 0.000 0.920 0.004
#> GSM617621     1  0.2197      0.893 0.936 0.024 0.012 0.028
#> GSM617629     3  0.5401      0.822 0.052 0.060 0.784 0.104
#> GSM617630     2  0.6161      0.240 0.004 0.512 0.444 0.040
#> GSM617631     3  0.2825      0.911 0.036 0.008 0.908 0.048
#> GSM617633     1  0.6381      0.623 0.664 0.036 0.252 0.048
#> GSM617642     3  0.1940      0.924 0.076 0.000 0.924 0.000
#> GSM617645     2  0.1917      0.833 0.008 0.944 0.012 0.036
#> GSM617646     1  0.2909      0.875 0.888 0.092 0.020 0.000
#> GSM617652     1  0.4004      0.807 0.812 0.024 0.164 0.000
#> GSM617655     3  0.1677      0.928 0.040 0.012 0.948 0.000
#> GSM617656     3  0.2049      0.927 0.036 0.012 0.940 0.012
#> GSM617657     3  0.3170      0.882 0.008 0.056 0.892 0.044
#> GSM617658     3  0.4582      0.862 0.072 0.020 0.824 0.084
#> GSM617659     1  0.1867      0.893 0.928 0.000 0.072 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
#> GSM617581     1  0.6204      0.471 0.600 0.028 0.000 0.108 0.264
#> GSM617582     5  0.6038      0.193 0.308 0.032 0.052 0.008 0.600
#> GSM617588     4  0.1399      0.860 0.000 0.020 0.000 0.952 0.028
#> GSM617590     4  0.1493      0.862 0.000 0.028 0.000 0.948 0.024
#> GSM617592     4  0.0865      0.864 0.000 0.024 0.000 0.972 0.004
#> GSM617607     1  0.2165      0.772 0.924 0.036 0.024 0.000 0.016
#> GSM617608     1  0.1124      0.773 0.960 0.000 0.036 0.000 0.004
#> GSM617609     3  0.1059      0.848 0.020 0.008 0.968 0.000 0.004
#> GSM617612     1  0.1365      0.773 0.952 0.004 0.040 0.000 0.004
#> GSM617615     2  0.3862      0.754 0.004 0.840 0.044 0.036 0.076
#> GSM617616     1  0.4691      0.493 0.636 0.020 0.004 0.000 0.340
#> GSM617617     2  0.2166      0.772 0.004 0.912 0.000 0.012 0.072
#> GSM617618     1  0.5109      0.372 0.580 0.020 0.008 0.004 0.388
#> GSM617619     2  0.6307      0.428 0.000 0.540 0.284 0.004 0.172
#> GSM617620     4  0.0771      0.864 0.000 0.020 0.000 0.976 0.004
#> GSM617622     2  0.5725      0.537 0.000 0.624 0.000 0.172 0.204
#> GSM617623     1  0.6225      0.475 0.604 0.028 0.000 0.116 0.252
#> GSM617624     2  0.2780      0.768 0.004 0.872 0.008 0.004 0.112
#> GSM617625     3  0.2270      0.831 0.072 0.004 0.908 0.000 0.016
#> GSM617626     1  0.3993      0.669 0.756 0.028 0.000 0.000 0.216
#> GSM617627     2  0.2636      0.771 0.004 0.888 0.008 0.008 0.092
#> GSM617628     3  0.2206      0.835 0.068 0.004 0.912 0.000 0.016
#> GSM617632     1  0.4309      0.569 0.676 0.016 0.000 0.000 0.308
#> GSM617634     2  0.5254      0.362 0.008 0.512 0.012 0.012 0.456
#> GSM617635     1  0.1588      0.778 0.948 0.008 0.028 0.000 0.016
#> GSM617636     1  0.4696      0.489 0.616 0.024 0.000 0.000 0.360
#> GSM617637     1  0.0867      0.782 0.976 0.008 0.008 0.000 0.008
#> GSM617638     2  0.4324      0.701 0.004 0.708 0.012 0.004 0.272
#> GSM617639     1  0.0867      0.782 0.976 0.008 0.008 0.000 0.008
#> GSM617640     2  0.4123      0.735 0.004 0.764 0.004 0.024 0.204
#> GSM617641     4  0.0865      0.864 0.000 0.024 0.000 0.972 0.004
#> GSM617643     2  0.1828      0.772 0.004 0.936 0.000 0.028 0.032
#> GSM617644     2  0.6120      0.418 0.000 0.560 0.000 0.256 0.184
#> GSM617647     2  0.1200      0.773 0.008 0.964 0.000 0.016 0.012
#> GSM617648     2  0.3516      0.714 0.000 0.812 0.004 0.020 0.164
#> GSM617649     2  0.1812      0.772 0.004 0.940 0.012 0.008 0.036
#> GSM617650     1  0.1502      0.762 0.940 0.000 0.056 0.000 0.004
#> GSM617651     1  0.0290      0.781 0.992 0.000 0.008 0.000 0.000
#> GSM617653     1  0.2674      0.730 0.856 0.000 0.000 0.004 0.140
#> GSM617654     2  0.4308      0.721 0.004 0.732 0.004 0.020 0.240
#> GSM617583     3  0.2005      0.841 0.056 0.004 0.924 0.000 0.016
#> GSM617584     4  0.6695      0.431 0.056 0.144 0.000 0.592 0.208
#> GSM617585     4  0.6867      0.313 0.000 0.048 0.108 0.484 0.360
#> GSM617586     3  0.1329      0.849 0.032 0.008 0.956 0.000 0.004
#> GSM617587     3  0.1329      0.849 0.032 0.008 0.956 0.000 0.004
#> GSM617589     4  0.2270      0.837 0.000 0.016 0.004 0.908 0.072
#> GSM617591     2  0.5620      0.650 0.004 0.684 0.196 0.020 0.096
#> GSM617593     1  0.0613      0.782 0.984 0.004 0.008 0.000 0.004
#> GSM617594     2  0.1659      0.771 0.024 0.948 0.004 0.008 0.016
#> GSM617595     1  0.0451      0.782 0.988 0.004 0.008 0.000 0.000
#> GSM617596     1  0.4244      0.627 0.712 0.016 0.000 0.004 0.268
#> GSM617597     3  0.2488      0.780 0.124 0.004 0.872 0.000 0.000
#> GSM617598     1  0.0613      0.782 0.984 0.004 0.004 0.000 0.008
#> GSM617599     2  0.3168      0.739 0.008 0.856 0.004 0.016 0.116
#> GSM617600     3  0.2851      0.805 0.004 0.016 0.880 0.008 0.092
#> GSM617601     2  0.2103      0.773 0.004 0.920 0.000 0.056 0.020
#> GSM617602     3  0.4453      0.399 0.004 0.004 0.644 0.004 0.344
#> GSM617603     4  0.3351      0.799 0.000 0.020 0.004 0.828 0.148
#> GSM617604     1  0.5688      0.469 0.608 0.000 0.088 0.008 0.296
#> GSM617605     4  0.1403      0.863 0.000 0.024 0.000 0.952 0.024
#> GSM617606     2  0.7111      0.523 0.004 0.484 0.152 0.036 0.324
#> GSM617610     1  0.0613      0.782 0.984 0.004 0.008 0.000 0.004
#> GSM617611     1  0.1043      0.772 0.960 0.000 0.040 0.000 0.000
#> GSM617613     3  0.2968      0.786 0.000 0.012 0.864 0.012 0.112
#> GSM617614     3  0.2238      0.842 0.064 0.000 0.912 0.004 0.020
#> GSM617621     1  0.4067      0.660 0.748 0.020 0.000 0.004 0.228
#> GSM617629     5  0.5079      0.155 0.004 0.032 0.340 0.004 0.620
#> GSM617630     2  0.6769      0.430 0.004 0.448 0.252 0.000 0.296
#> GSM617631     3  0.3134      0.779 0.004 0.004 0.848 0.012 0.132
#> GSM617633     1  0.6409      0.291 0.592 0.024 0.172 0.000 0.212
#> GSM617642     3  0.1628      0.844 0.056 0.008 0.936 0.000 0.000
#> GSM617645     2  0.4156      0.734 0.004 0.764 0.008 0.020 0.204
#> GSM617646     1  0.3043      0.727 0.864 0.104 0.024 0.000 0.008
#> GSM617652     1  0.4001      0.570 0.764 0.024 0.208 0.000 0.004
#> GSM617655     3  0.0693      0.848 0.012 0.008 0.980 0.000 0.000
#> GSM617656     3  0.1770      0.840 0.012 0.008 0.944 0.008 0.028
#> GSM617657     3  0.3667      0.747 0.000 0.020 0.812 0.012 0.156
#> GSM617658     3  0.4836      0.154 0.012 0.000 0.568 0.008 0.412
#> GSM617659     1  0.1768      0.752 0.924 0.000 0.072 0.000 0.004

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>           class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM617581     5  0.6902     0.1700 0.376 0.004 0.000 0.112 0.404 0.104
#> GSM617582     5  0.4635     0.4975 0.136 0.000 0.020 0.000 0.728 0.116
#> GSM617588     4  0.2001     0.7862 0.000 0.004 0.000 0.900 0.004 0.092
#> GSM617590     4  0.1176     0.8035 0.000 0.000 0.000 0.956 0.024 0.020
#> GSM617592     4  0.0260     0.8043 0.000 0.000 0.000 0.992 0.008 0.000
#> GSM617607     1  0.1729     0.7444 0.940 0.012 0.016 0.000 0.016 0.016
#> GSM617608     1  0.1151     0.7501 0.956 0.000 0.032 0.000 0.012 0.000
#> GSM617609     3  0.1346     0.8391 0.016 0.008 0.952 0.000 0.000 0.024
#> GSM617612     1  0.1049     0.7489 0.960 0.000 0.032 0.000 0.000 0.008
#> GSM617615     2  0.5052     0.2639 0.000 0.712 0.076 0.020 0.024 0.168
#> GSM617616     5  0.4627     0.4107 0.396 0.000 0.000 0.000 0.560 0.044
#> GSM617617     2  0.2930     0.4945 0.000 0.840 0.000 0.000 0.036 0.124
#> GSM617618     5  0.4902     0.4436 0.364 0.000 0.004 0.000 0.572 0.060
#> GSM617619     2  0.6781    -0.4204 0.000 0.476 0.228 0.000 0.072 0.224
#> GSM617620     4  0.0520     0.8046 0.000 0.000 0.000 0.984 0.008 0.008
#> GSM617622     2  0.6461     0.2089 0.000 0.568 0.000 0.148 0.132 0.152
#> GSM617623     1  0.6987    -0.2587 0.384 0.004 0.000 0.120 0.384 0.108
#> GSM617624     2  0.3459     0.3923 0.000 0.792 0.004 0.000 0.032 0.172
#> GSM617625     3  0.2673     0.8222 0.064 0.000 0.880 0.000 0.012 0.044
#> GSM617626     1  0.4769     0.0397 0.576 0.000 0.000 0.000 0.364 0.060
#> GSM617627     2  0.3194     0.4077 0.000 0.808 0.004 0.004 0.012 0.172
#> GSM617628     3  0.2673     0.8222 0.064 0.000 0.880 0.000 0.012 0.044
#> GSM617632     5  0.4224     0.3263 0.432 0.000 0.000 0.000 0.552 0.016
#> GSM617634     5  0.6072    -0.1700 0.004 0.328 0.004 0.000 0.464 0.200
#> GSM617635     1  0.1257     0.7481 0.952 0.000 0.020 0.000 0.028 0.000
#> GSM617636     5  0.3996     0.4459 0.352 0.000 0.004 0.000 0.636 0.008
#> GSM617637     1  0.0405     0.7559 0.988 0.000 0.000 0.000 0.008 0.004
#> GSM617638     2  0.5144    -0.1280 0.000 0.548 0.004 0.000 0.080 0.368
#> GSM617639     1  0.0146     0.7562 0.996 0.000 0.000 0.000 0.004 0.000
#> GSM617640     2  0.3878     0.1757 0.000 0.644 0.000 0.004 0.004 0.348
#> GSM617641     4  0.0260     0.8043 0.000 0.000 0.000 0.992 0.008 0.000
#> GSM617643     2  0.1657     0.5277 0.000 0.928 0.000 0.000 0.016 0.056
#> GSM617644     2  0.6339     0.1803 0.000 0.532 0.000 0.156 0.056 0.256
#> GSM617647     2  0.0862     0.5312 0.004 0.972 0.000 0.000 0.008 0.016
#> GSM617648     2  0.4387     0.3953 0.000 0.720 0.000 0.000 0.128 0.152
#> GSM617649     2  0.1657     0.5273 0.000 0.928 0.000 0.000 0.016 0.056
#> GSM617650     1  0.1152     0.7438 0.952 0.000 0.044 0.000 0.004 0.000
#> GSM617651     1  0.0405     0.7558 0.988 0.000 0.000 0.000 0.004 0.008
#> GSM617653     1  0.4738     0.2871 0.640 0.000 0.000 0.000 0.276 0.084
#> GSM617654     2  0.3942     0.1133 0.000 0.624 0.000 0.004 0.004 0.368
#> GSM617583     3  0.2422     0.8300 0.052 0.000 0.896 0.000 0.012 0.040
#> GSM617584     4  0.7066     0.1446 0.052 0.048 0.000 0.464 0.324 0.112
#> GSM617585     4  0.7285     0.2383 0.000 0.024 0.044 0.380 0.276 0.276
#> GSM617586     3  0.1334     0.8409 0.020 0.000 0.948 0.000 0.000 0.032
#> GSM617587     3  0.1346     0.8391 0.016 0.008 0.952 0.000 0.000 0.024
#> GSM617589     4  0.2572     0.7645 0.000 0.000 0.000 0.852 0.012 0.136
#> GSM617591     2  0.6343    -0.2960 0.000 0.524 0.232 0.004 0.032 0.208
#> GSM617593     1  0.0000     0.7563 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM617594     2  0.1010     0.5281 0.000 0.960 0.000 0.000 0.004 0.036
#> GSM617595     1  0.0291     0.7562 0.992 0.000 0.000 0.000 0.004 0.004
#> GSM617596     1  0.5324    -0.1575 0.468 0.000 0.000 0.000 0.428 0.104
#> GSM617597     3  0.2257     0.7960 0.116 0.000 0.876 0.000 0.000 0.008
#> GSM617598     1  0.0291     0.7562 0.992 0.000 0.000 0.000 0.004 0.004
#> GSM617599     2  0.3479     0.4651 0.008 0.820 0.000 0.000 0.088 0.084
#> GSM617600     3  0.2856     0.7926 0.000 0.000 0.856 0.000 0.068 0.076
#> GSM617601     2  0.2114     0.4987 0.000 0.904 0.000 0.008 0.012 0.076
#> GSM617602     3  0.4984     0.2650 0.000 0.000 0.492 0.000 0.440 0.068
#> GSM617603     4  0.4746     0.6666 0.000 0.008 0.000 0.676 0.084 0.232
#> GSM617604     5  0.6444     0.2066 0.384 0.000 0.056 0.000 0.432 0.128
#> GSM617605     4  0.1176     0.8035 0.000 0.000 0.000 0.956 0.024 0.020
#> GSM617606     6  0.7666     0.4898 0.000 0.312 0.136 0.028 0.136 0.388
#> GSM617610     1  0.0291     0.7562 0.992 0.000 0.000 0.000 0.004 0.004
#> GSM617611     1  0.1007     0.7456 0.956 0.000 0.044 0.000 0.000 0.000
#> GSM617613     3  0.3520     0.7734 0.000 0.000 0.804 0.000 0.100 0.096
#> GSM617614     3  0.2933     0.8310 0.068 0.000 0.868 0.000 0.028 0.036
#> GSM617621     1  0.5198    -0.0252 0.524 0.000 0.000 0.000 0.380 0.096
#> GSM617629     5  0.4304     0.2823 0.000 0.004 0.128 0.000 0.740 0.128
#> GSM617630     6  0.6970     0.4582 0.004 0.356 0.148 0.004 0.072 0.416
#> GSM617631     3  0.3481     0.7643 0.000 0.000 0.804 0.000 0.124 0.072
#> GSM617633     1  0.5609    -0.1506 0.488 0.004 0.088 0.000 0.408 0.012
#> GSM617642     3  0.1434     0.8391 0.048 0.000 0.940 0.000 0.000 0.012
#> GSM617645     2  0.3864     0.1700 0.000 0.648 0.000 0.004 0.004 0.344
#> GSM617646     1  0.2570     0.6926 0.888 0.076 0.012 0.000 0.012 0.012
#> GSM617652     1  0.3728     0.5400 0.768 0.008 0.200 0.000 0.008 0.016
#> GSM617655     3  0.0603     0.8403 0.004 0.000 0.980 0.000 0.000 0.016
#> GSM617656     3  0.1826     0.8298 0.004 0.000 0.924 0.000 0.020 0.052
#> GSM617657     3  0.4946     0.6171 0.000 0.000 0.652 0.000 0.188 0.160
#> GSM617658     5  0.4786     0.0340 0.000 0.000 0.352 0.000 0.584 0.064
#> GSM617659     1  0.1411     0.7319 0.936 0.000 0.060 0.000 0.004 0.000

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

consensus_heatmap(res, k = 2)

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

consensus_heatmap(res, k = 3)

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

consensus_heatmap(res, k = 4)

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

consensus_heatmap(res, k = 5)

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

consensus_heatmap(res, k = 6)

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

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

membership_heatmap(res, k = 2)

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

membership_heatmap(res, k = 3)

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

membership_heatmap(res, k = 4)

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

membership_heatmap(res, k = 5)

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

membership_heatmap(res, k = 6)

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

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

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

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

get_signatures(res, k = 3)

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

get_signatures(res, k = 4)

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

get_signatures(res, k = 5)

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

get_signatures(res, k = 6)

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

Signature heatmaps where rows are not scaled:

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

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

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

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

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

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

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

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

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

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

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk SD-kmeans-signature_compare

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

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

An example of the output of tb is:

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

The columns in tb are:

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

UMAP plot which shows how samples are separated.

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

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

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

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

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

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

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

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

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

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

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk SD-kmeans-collect-classes

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

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

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

collect_plots(res)

plot of chunk SD-skmeans-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.947           0.953       0.980         0.5029 0.496   0.496
#> 3 3 0.609           0.780       0.891         0.3348 0.738   0.518
#> 4 4 0.459           0.516       0.733         0.1160 0.924   0.779
#> 5 5 0.463           0.400       0.651         0.0648 0.875   0.586
#> 6 6 0.506           0.317       0.595         0.0392 0.944   0.756

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
#> GSM617581     2  0.7453      0.743 0.212 0.788
#> GSM617582     2  0.9954      0.168 0.460 0.540
#> GSM617588     2  0.0000      0.966 0.000 1.000
#> GSM617590     2  0.0000      0.966 0.000 1.000
#> GSM617592     2  0.0000      0.966 0.000 1.000
#> GSM617607     1  0.0000      0.989 1.000 0.000
#> GSM617608     1  0.0000      0.989 1.000 0.000
#> GSM617609     1  0.0000      0.989 1.000 0.000
#> GSM617612     1  0.0000      0.989 1.000 0.000
#> GSM617615     2  0.0000      0.966 0.000 1.000
#> GSM617616     1  0.1843      0.965 0.972 0.028
#> GSM617617     2  0.0000      0.966 0.000 1.000
#> GSM617618     1  0.2778      0.945 0.952 0.048
#> GSM617619     2  0.0000      0.966 0.000 1.000
#> GSM617620     2  0.0000      0.966 0.000 1.000
#> GSM617622     2  0.0000      0.966 0.000 1.000
#> GSM617623     2  0.2948      0.927 0.052 0.948
#> GSM617624     2  0.0000      0.966 0.000 1.000
#> GSM617625     1  0.0000      0.989 1.000 0.000
#> GSM617626     2  0.7139      0.767 0.196 0.804
#> GSM617627     2  0.0000      0.966 0.000 1.000
#> GSM617628     1  0.0000      0.989 1.000 0.000
#> GSM617632     1  0.0000      0.989 1.000 0.000
#> GSM617634     2  0.0000      0.966 0.000 1.000
#> GSM617635     1  0.0000      0.989 1.000 0.000
#> GSM617636     1  0.0000      0.989 1.000 0.000
#> GSM617637     1  0.0000      0.989 1.000 0.000
#> GSM617638     2  0.0000      0.966 0.000 1.000
#> GSM617639     1  0.0000      0.989 1.000 0.000
#> GSM617640     2  0.0000      0.966 0.000 1.000
#> GSM617641     2  0.0000      0.966 0.000 1.000
#> GSM617643     2  0.0000      0.966 0.000 1.000
#> GSM617644     2  0.0000      0.966 0.000 1.000
#> GSM617647     2  0.0000      0.966 0.000 1.000
#> GSM617648     2  0.0000      0.966 0.000 1.000
#> GSM617649     2  0.0000      0.966 0.000 1.000
#> GSM617650     1  0.0000      0.989 1.000 0.000
#> GSM617651     1  0.0000      0.989 1.000 0.000
#> GSM617653     1  0.0000      0.989 1.000 0.000
#> GSM617654     2  0.0000      0.966 0.000 1.000
#> GSM617583     1  0.0000      0.989 1.000 0.000
#> GSM617584     2  0.0000      0.966 0.000 1.000
#> GSM617585     2  0.0000      0.966 0.000 1.000
#> GSM617586     1  0.0000      0.989 1.000 0.000
#> GSM617587     1  0.2423      0.953 0.960 0.040
#> GSM617589     2  0.0000      0.966 0.000 1.000
#> GSM617591     2  0.1184      0.955 0.016 0.984
#> GSM617593     1  0.0000      0.989 1.000 0.000
#> GSM617594     2  0.0672      0.961 0.008 0.992
#> GSM617595     1  0.0000      0.989 1.000 0.000
#> GSM617596     1  0.0376      0.986 0.996 0.004
#> GSM617597     1  0.0000      0.989 1.000 0.000
#> GSM617598     1  0.0000      0.989 1.000 0.000
#> GSM617599     2  0.0000      0.966 0.000 1.000
#> GSM617600     1  0.0672      0.984 0.992 0.008
#> GSM617601     2  0.0000      0.966 0.000 1.000
#> GSM617602     1  0.0376      0.987 0.996 0.004
#> GSM617603     2  0.0000      0.966 0.000 1.000
#> GSM617604     1  0.0000      0.989 1.000 0.000
#> GSM617605     2  0.0000      0.966 0.000 1.000
#> GSM617606     2  0.0000      0.966 0.000 1.000
#> GSM617610     1  0.0000      0.989 1.000 0.000
#> GSM617611     1  0.0000      0.989 1.000 0.000
#> GSM617613     1  0.0938      0.980 0.988 0.012
#> GSM617614     1  0.0000      0.989 1.000 0.000
#> GSM617621     1  0.0000      0.989 1.000 0.000
#> GSM617629     1  0.8499      0.610 0.724 0.276
#> GSM617630     2  0.5519      0.853 0.128 0.872
#> GSM617631     1  0.0000      0.989 1.000 0.000
#> GSM617633     1  0.0000      0.989 1.000 0.000
#> GSM617642     1  0.0000      0.989 1.000 0.000
#> GSM617645     2  0.0000      0.966 0.000 1.000
#> GSM617646     1  0.0000      0.989 1.000 0.000
#> GSM617652     1  0.0000      0.989 1.000 0.000
#> GSM617655     1  0.0000      0.989 1.000 0.000
#> GSM617656     1  0.0000      0.989 1.000 0.000
#> GSM617657     2  0.5178      0.865 0.116 0.884
#> GSM617658     1  0.0000      0.989 1.000 0.000
#> GSM617659     1  0.0000      0.989 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
#> GSM617581     1  0.7905   0.334955 0.560 0.376 0.064
#> GSM617582     1  0.9811  -0.051487 0.380 0.240 0.380
#> GSM617588     2  0.0000   0.910215 0.000 1.000 0.000
#> GSM617590     2  0.0000   0.910215 0.000 1.000 0.000
#> GSM617592     2  0.0000   0.910215 0.000 1.000 0.000
#> GSM617607     1  0.3482   0.810171 0.872 0.000 0.128
#> GSM617608     1  0.4178   0.760151 0.828 0.000 0.172
#> GSM617609     3  0.0424   0.861258 0.008 0.000 0.992
#> GSM617612     1  0.2537   0.837076 0.920 0.000 0.080
#> GSM617615     2  0.0892   0.904807 0.000 0.980 0.020
#> GSM617616     1  0.2096   0.849314 0.944 0.004 0.052
#> GSM617617     2  0.1163   0.901006 0.028 0.972 0.000
#> GSM617618     1  0.3618   0.818372 0.884 0.012 0.104
#> GSM617619     3  0.5443   0.580672 0.004 0.260 0.736
#> GSM617620     2  0.0000   0.910215 0.000 1.000 0.000
#> GSM617622     2  0.0475   0.909060 0.004 0.992 0.004
#> GSM617623     1  0.6497   0.479938 0.648 0.336 0.016
#> GSM617624     2  0.5414   0.748957 0.016 0.772 0.212
#> GSM617625     3  0.3192   0.835079 0.112 0.000 0.888
#> GSM617626     1  0.3192   0.788664 0.888 0.112 0.000
#> GSM617627     2  0.1765   0.896767 0.004 0.956 0.040
#> GSM617628     3  0.2711   0.848446 0.088 0.000 0.912
#> GSM617632     1  0.1643   0.850215 0.956 0.000 0.044
#> GSM617634     2  0.7564   0.622555 0.096 0.672 0.232
#> GSM617635     1  0.2711   0.836107 0.912 0.000 0.088
#> GSM617636     1  0.4654   0.725310 0.792 0.000 0.208
#> GSM617637     1  0.0424   0.854838 0.992 0.000 0.008
#> GSM617638     2  0.6487   0.648298 0.032 0.700 0.268
#> GSM617639     1  0.0424   0.854838 0.992 0.000 0.008
#> GSM617640     2  0.0237   0.909574 0.004 0.996 0.000
#> GSM617641     2  0.0000   0.910215 0.000 1.000 0.000
#> GSM617643     2  0.0000   0.910215 0.000 1.000 0.000
#> GSM617644     2  0.0000   0.910215 0.000 1.000 0.000
#> GSM617647     2  0.3192   0.843644 0.112 0.888 0.000
#> GSM617648     2  0.0237   0.909689 0.000 0.996 0.004
#> GSM617649     2  0.2066   0.884344 0.000 0.940 0.060
#> GSM617650     1  0.3619   0.796914 0.864 0.000 0.136
#> GSM617651     1  0.0424   0.854838 0.992 0.000 0.008
#> GSM617653     1  0.0237   0.853389 0.996 0.004 0.000
#> GSM617654     2  0.0592   0.908295 0.012 0.988 0.000
#> GSM617583     3  0.2711   0.848534 0.088 0.000 0.912
#> GSM617584     2  0.2625   0.863738 0.084 0.916 0.000
#> GSM617585     2  0.5178   0.693636 0.000 0.744 0.256
#> GSM617586     3  0.1411   0.860218 0.036 0.000 0.964
#> GSM617587     3  0.3583   0.844675 0.056 0.044 0.900
#> GSM617589     2  0.0000   0.910215 0.000 1.000 0.000
#> GSM617591     2  0.6297   0.480212 0.008 0.640 0.352
#> GSM617593     1  0.0424   0.854838 0.992 0.000 0.008
#> GSM617594     2  0.5741   0.734194 0.188 0.776 0.036
#> GSM617595     1  0.0424   0.854838 0.992 0.000 0.008
#> GSM617596     1  0.1620   0.852215 0.964 0.012 0.024
#> GSM617597     3  0.4654   0.727675 0.208 0.000 0.792
#> GSM617598     1  0.0424   0.854838 0.992 0.000 0.008
#> GSM617599     2  0.4473   0.785278 0.164 0.828 0.008
#> GSM617600     3  0.0000   0.860321 0.000 0.000 1.000
#> GSM617601     2  0.0475   0.909342 0.004 0.992 0.004
#> GSM617602     3  0.1411   0.858370 0.036 0.000 0.964
#> GSM617603     2  0.0000   0.910215 0.000 1.000 0.000
#> GSM617604     3  0.6309  -0.000793 0.500 0.000 0.500
#> GSM617605     2  0.0000   0.910215 0.000 1.000 0.000
#> GSM617606     2  0.5216   0.681300 0.000 0.740 0.260
#> GSM617610     1  0.0424   0.854838 0.992 0.000 0.008
#> GSM617611     1  0.2165   0.845262 0.936 0.000 0.064
#> GSM617613     3  0.0237   0.859855 0.004 0.000 0.996
#> GSM617614     3  0.3116   0.838342 0.108 0.000 0.892
#> GSM617621     1  0.0747   0.854067 0.984 0.000 0.016
#> GSM617629     3  0.5519   0.767623 0.120 0.068 0.812
#> GSM617630     3  0.5412   0.729737 0.032 0.172 0.796
#> GSM617631     3  0.0424   0.858829 0.008 0.000 0.992
#> GSM617633     3  0.6295   0.040410 0.472 0.000 0.528
#> GSM617642     3  0.3412   0.825847 0.124 0.000 0.876
#> GSM617645     2  0.0237   0.909574 0.004 0.996 0.000
#> GSM617646     1  0.1163   0.855994 0.972 0.000 0.028
#> GSM617652     1  0.6274   0.142256 0.544 0.000 0.456
#> GSM617655     3  0.0424   0.861258 0.008 0.000 0.992
#> GSM617656     3  0.0592   0.861320 0.012 0.000 0.988
#> GSM617657     3  0.0424   0.858829 0.008 0.000 0.992
#> GSM617658     3  0.2356   0.848497 0.072 0.000 0.928
#> GSM617659     1  0.4887   0.684224 0.772 0.000 0.228

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM617581     4  0.8962    0.20558 0.280 0.324 0.052 0.344
#> GSM617582     4  0.8813    0.41402 0.132 0.200 0.156 0.512
#> GSM617588     2  0.0921    0.69469 0.000 0.972 0.000 0.028
#> GSM617590     2  0.0707    0.69681 0.000 0.980 0.000 0.020
#> GSM617592     2  0.0921    0.69312 0.000 0.972 0.000 0.028
#> GSM617607     1  0.5964    0.58829 0.684 0.000 0.108 0.208
#> GSM617608     1  0.4994    0.61592 0.744 0.000 0.208 0.048
#> GSM617609     3  0.2402    0.72624 0.012 0.000 0.912 0.076
#> GSM617612     1  0.3928    0.69976 0.852 0.008 0.084 0.056
#> GSM617615     2  0.4506    0.67597 0.008 0.812 0.052 0.128
#> GSM617616     1  0.6758    0.48539 0.612 0.028 0.064 0.296
#> GSM617617     2  0.5582    0.51221 0.024 0.576 0.000 0.400
#> GSM617618     1  0.7338    0.21739 0.476 0.032 0.072 0.420
#> GSM617619     3  0.7341   -0.00898 0.000 0.164 0.476 0.360
#> GSM617620     2  0.0707    0.69416 0.000 0.980 0.000 0.020
#> GSM617622     2  0.3881    0.64843 0.000 0.812 0.016 0.172
#> GSM617623     1  0.7965   -0.08841 0.416 0.304 0.004 0.276
#> GSM617624     4  0.7265   -0.05392 0.008 0.340 0.128 0.524
#> GSM617625     3  0.4224    0.69828 0.144 0.000 0.812 0.044
#> GSM617626     1  0.6756    0.40110 0.600 0.148 0.000 0.252
#> GSM617627     2  0.6384    0.43297 0.000 0.532 0.068 0.400
#> GSM617628     3  0.3818    0.71812 0.108 0.000 0.844 0.048
#> GSM617632     1  0.5206    0.56531 0.668 0.000 0.024 0.308
#> GSM617634     4  0.7795    0.17921 0.048 0.344 0.096 0.512
#> GSM617635     1  0.5119    0.65733 0.768 0.004 0.080 0.148
#> GSM617636     4  0.7568   -0.22869 0.404 0.000 0.192 0.404
#> GSM617637     1  0.1716    0.71064 0.936 0.000 0.000 0.064
#> GSM617638     4  0.7172    0.11119 0.012 0.288 0.128 0.572
#> GSM617639     1  0.1792    0.71051 0.932 0.000 0.000 0.068
#> GSM617640     2  0.4277    0.63791 0.000 0.720 0.000 0.280
#> GSM617641     2  0.0592    0.69321 0.000 0.984 0.000 0.016
#> GSM617643     2  0.4008    0.66264 0.000 0.756 0.000 0.244
#> GSM617644     2  0.2814    0.69506 0.000 0.868 0.000 0.132
#> GSM617647     2  0.6578    0.49012 0.108 0.592 0.000 0.300
#> GSM617648     2  0.4535    0.63390 0.000 0.704 0.004 0.292
#> GSM617649     2  0.6568    0.53131 0.008 0.600 0.080 0.312
#> GSM617650     1  0.3948    0.67163 0.828 0.000 0.136 0.036
#> GSM617651     1  0.0921    0.71225 0.972 0.000 0.000 0.028
#> GSM617653     1  0.2999    0.69249 0.864 0.000 0.004 0.132
#> GSM617654     2  0.5805    0.49048 0.036 0.576 0.000 0.388
#> GSM617583     3  0.3606    0.71031 0.140 0.000 0.840 0.020
#> GSM617584     2  0.5962    0.43646 0.100 0.696 0.004 0.200
#> GSM617585     2  0.6560    0.30105 0.000 0.620 0.132 0.248
#> GSM617586     3  0.1733    0.73260 0.028 0.000 0.948 0.024
#> GSM617587     3  0.5629    0.64315 0.084 0.024 0.756 0.136
#> GSM617589     2  0.1576    0.69060 0.000 0.948 0.004 0.048
#> GSM617591     2  0.6790    0.27831 0.000 0.576 0.296 0.128
#> GSM617593     1  0.0895    0.71147 0.976 0.000 0.004 0.020
#> GSM617594     2  0.8891    0.23721 0.124 0.456 0.120 0.300
#> GSM617595     1  0.0921    0.71148 0.972 0.000 0.000 0.028
#> GSM617596     1  0.5356    0.62496 0.728 0.016 0.032 0.224
#> GSM617597     3  0.5404    0.56290 0.248 0.000 0.700 0.052
#> GSM617598     1  0.1109    0.71282 0.968 0.000 0.004 0.028
#> GSM617599     2  0.8245    0.12719 0.148 0.420 0.040 0.392
#> GSM617600     3  0.1867    0.72509 0.000 0.000 0.928 0.072
#> GSM617601     2  0.3569    0.67833 0.000 0.804 0.000 0.196
#> GSM617602     3  0.4910    0.56893 0.020 0.000 0.704 0.276
#> GSM617603     2  0.1940    0.69143 0.000 0.924 0.000 0.076
#> GSM617604     3  0.8487    0.01593 0.300 0.024 0.388 0.288
#> GSM617605     2  0.1118    0.69417 0.000 0.964 0.000 0.036
#> GSM617606     2  0.6327    0.50153 0.008 0.676 0.120 0.196
#> GSM617610     1  0.1302    0.70812 0.956 0.000 0.000 0.044
#> GSM617611     1  0.3497    0.68553 0.852 0.000 0.124 0.024
#> GSM617613     3  0.2011    0.72220 0.000 0.000 0.920 0.080
#> GSM617614     3  0.5077    0.66698 0.160 0.000 0.760 0.080
#> GSM617621     1  0.4391    0.62312 0.740 0.000 0.008 0.252
#> GSM617629     4  0.8010    0.03365 0.060 0.092 0.376 0.472
#> GSM617630     3  0.8540   -0.05169 0.056 0.160 0.436 0.348
#> GSM617631     3  0.2408    0.71605 0.000 0.000 0.896 0.104
#> GSM617633     1  0.7921   -0.06225 0.348 0.000 0.324 0.328
#> GSM617642     3  0.3706    0.71448 0.112 0.000 0.848 0.040
#> GSM617645     2  0.4761    0.59950 0.000 0.664 0.004 0.332
#> GSM617646     1  0.5325    0.62628 0.748 0.012 0.052 0.188
#> GSM617652     1  0.7417   -0.01468 0.428 0.004 0.424 0.144
#> GSM617655     3  0.0707    0.73090 0.000 0.000 0.980 0.020
#> GSM617656     3  0.0524    0.73114 0.004 0.000 0.988 0.008
#> GSM617657     3  0.3384    0.69340 0.000 0.024 0.860 0.116
#> GSM617658     3  0.6522    0.45754 0.112 0.000 0.608 0.280
#> GSM617659     1  0.5143    0.56465 0.708 0.000 0.256 0.036

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1    p2    p3    p4    p5
#> GSM617581     5   0.839     0.3046 0.228 0.120 0.016 0.212 0.424
#> GSM617582     5   0.774     0.3364 0.080 0.116 0.068 0.160 0.576
#> GSM617588     4   0.104     0.6148 0.000 0.032 0.000 0.964 0.004
#> GSM617590     4   0.204     0.6112 0.000 0.056 0.000 0.920 0.024
#> GSM617592     4   0.139     0.6079 0.000 0.032 0.000 0.952 0.016
#> GSM617607     1   0.742     0.3374 0.524 0.148 0.108 0.000 0.220
#> GSM617608     1   0.662     0.4460 0.588 0.040 0.196 0.000 0.176
#> GSM617609     3   0.306     0.6912 0.004 0.108 0.860 0.000 0.028
#> GSM617612     1   0.412     0.6212 0.828 0.048 0.080 0.008 0.036
#> GSM617615     4   0.499     0.4894 0.004 0.140 0.080 0.752 0.024
#> GSM617616     5   0.740     0.0612 0.404 0.088 0.032 0.044 0.432
#> GSM617617     2   0.647     0.2699 0.024 0.460 0.000 0.416 0.100
#> GSM617618     5   0.696     0.3087 0.268 0.120 0.020 0.032 0.560
#> GSM617619     3   0.798    -0.0482 0.000 0.332 0.388 0.136 0.144
#> GSM617620     4   0.157     0.6115 0.000 0.060 0.000 0.936 0.004
#> GSM617622     4   0.590     0.3399 0.004 0.220 0.008 0.636 0.132
#> GSM617623     5   0.842     0.2090 0.300 0.160 0.000 0.228 0.312
#> GSM617624     2   0.738     0.4611 0.008 0.564 0.112 0.176 0.140
#> GSM617625     3   0.539     0.6227 0.156 0.028 0.720 0.004 0.092
#> GSM617626     1   0.753     0.0399 0.488 0.100 0.000 0.144 0.268
#> GSM617627     2   0.641     0.4280 0.004 0.572 0.072 0.308 0.044
#> GSM617628     3   0.521     0.6402 0.160 0.040 0.736 0.004 0.060
#> GSM617632     1   0.643     0.0395 0.460 0.088 0.020 0.004 0.428
#> GSM617634     5   0.826    -0.2376 0.040 0.284 0.036 0.276 0.364
#> GSM617635     1   0.564     0.5696 0.708 0.124 0.052 0.000 0.116
#> GSM617636     5   0.662     0.3611 0.220 0.076 0.088 0.004 0.612
#> GSM617637     1   0.259     0.6403 0.892 0.060 0.000 0.000 0.048
#> GSM617638     2   0.724     0.3859 0.016 0.576 0.096 0.096 0.216
#> GSM617639     1   0.273     0.6436 0.884 0.052 0.000 0.000 0.064
#> GSM617640     4   0.504    -0.1080 0.000 0.456 0.000 0.512 0.032
#> GSM617641     4   0.104     0.6141 0.000 0.032 0.000 0.964 0.004
#> GSM617643     4   0.504    -0.0271 0.000 0.456 0.000 0.512 0.032
#> GSM617644     4   0.439     0.5216 0.000 0.156 0.000 0.760 0.084
#> GSM617647     2   0.754     0.3817 0.092 0.468 0.012 0.336 0.092
#> GSM617648     4   0.672    -0.0124 0.004 0.336 0.008 0.480 0.172
#> GSM617649     2   0.722     0.3935 0.008 0.504 0.112 0.316 0.060
#> GSM617650     1   0.494     0.5909 0.756 0.032 0.124 0.000 0.088
#> GSM617651     1   0.191     0.6512 0.928 0.008 0.008 0.000 0.056
#> GSM617653     1   0.435     0.5199 0.744 0.032 0.000 0.008 0.216
#> GSM617654     2   0.637     0.3540 0.052 0.532 0.000 0.356 0.060
#> GSM617583     3   0.485     0.6585 0.140 0.020 0.760 0.004 0.076
#> GSM617584     4   0.746     0.1095 0.104 0.132 0.004 0.528 0.232
#> GSM617585     4   0.705     0.2477 0.000 0.108 0.140 0.580 0.172
#> GSM617586     3   0.275     0.6989 0.048 0.036 0.896 0.000 0.020
#> GSM617587     3   0.673     0.5587 0.080 0.168 0.648 0.032 0.072
#> GSM617589     4   0.175     0.6112 0.000 0.028 0.000 0.936 0.036
#> GSM617591     4   0.715     0.0744 0.008 0.152 0.300 0.504 0.036
#> GSM617593     1   0.230     0.6467 0.900 0.004 0.008 0.000 0.088
#> GSM617594     2   0.839     0.3911 0.128 0.440 0.068 0.296 0.068
#> GSM617595     1   0.203     0.6502 0.924 0.020 0.004 0.000 0.052
#> GSM617596     5   0.734     0.0399 0.400 0.088 0.036 0.036 0.440
#> GSM617597     3   0.604     0.4569 0.248 0.036 0.628 0.000 0.088
#> GSM617598     1   0.177     0.6461 0.936 0.008 0.008 0.000 0.048
#> GSM617599     2   0.864     0.2818 0.120 0.360 0.020 0.276 0.224
#> GSM617600     3   0.370     0.6830 0.000 0.064 0.816 0.000 0.120
#> GSM617601     4   0.462     0.3387 0.000 0.288 0.000 0.676 0.036
#> GSM617602     3   0.576     0.1753 0.020 0.044 0.476 0.000 0.460
#> GSM617603     4   0.275     0.6075 0.000 0.080 0.000 0.880 0.040
#> GSM617604     5   0.847     0.2865 0.240 0.072 0.248 0.036 0.404
#> GSM617605     4   0.152     0.6159 0.000 0.044 0.000 0.944 0.012
#> GSM617606     4   0.761     0.2164 0.008 0.168 0.140 0.540 0.144
#> GSM617610     1   0.186     0.6447 0.932 0.016 0.000 0.004 0.048
#> GSM617611     1   0.360     0.6255 0.840 0.020 0.104 0.000 0.036
#> GSM617613     3   0.275     0.6959 0.000 0.040 0.880 0.000 0.080
#> GSM617614     3   0.628     0.5322 0.156 0.036 0.628 0.000 0.180
#> GSM617621     1   0.619     0.1247 0.500 0.076 0.016 0.004 0.404
#> GSM617629     5   0.728     0.2501 0.028 0.160 0.232 0.032 0.548
#> GSM617630     2   0.871     0.0326 0.044 0.348 0.336 0.096 0.176
#> GSM617631     3   0.382     0.6307 0.004 0.016 0.772 0.000 0.208
#> GSM617633     5   0.801     0.2520 0.268 0.120 0.192 0.000 0.420
#> GSM617642     3   0.491     0.6327 0.148 0.032 0.752 0.000 0.068
#> GSM617645     2   0.512     0.3154 0.008 0.588 0.008 0.380 0.016
#> GSM617646     1   0.720     0.3175 0.532 0.264 0.052 0.008 0.144
#> GSM617652     1   0.836    -0.0628 0.328 0.212 0.328 0.004 0.128
#> GSM617655     3   0.191     0.7052 0.000 0.044 0.928 0.000 0.028
#> GSM617656     3   0.160     0.7054 0.008 0.024 0.948 0.000 0.020
#> GSM617657     3   0.578     0.5728 0.000 0.140 0.680 0.032 0.148
#> GSM617658     5   0.632    -0.0938 0.052 0.040 0.404 0.004 0.500
#> GSM617659     1   0.582     0.4722 0.644 0.016 0.220 0.000 0.120

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>           class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM617581     4   0.880   -0.40376 0.160 0.044 0.028 0.276 0.244 0.248
#> GSM617582     5   0.659    0.19392 0.048 0.036 0.068 0.084 0.652 0.112
#> GSM617588     4   0.218    0.52497 0.000 0.052 0.000 0.908 0.008 0.032
#> GSM617590     4   0.301    0.51826 0.000 0.080 0.008 0.864 0.012 0.036
#> GSM617592     4   0.191    0.52788 0.000 0.020 0.000 0.924 0.012 0.044
#> GSM617607     1   0.796    0.22021 0.452 0.108 0.100 0.000 0.140 0.200
#> GSM617608     1   0.655    0.42632 0.596 0.032 0.128 0.000 0.072 0.172
#> GSM617609     3   0.499    0.55686 0.012 0.100 0.732 0.000 0.044 0.112
#> GSM617612     1   0.505    0.50296 0.724 0.020 0.080 0.008 0.016 0.152
#> GSM617615     4   0.695    0.30413 0.020 0.148 0.068 0.588 0.032 0.144
#> GSM617616     5   0.766    0.07607 0.316 0.080 0.028 0.016 0.420 0.140
#> GSM617617     2   0.731    0.41737 0.040 0.492 0.000 0.244 0.128 0.096
#> GSM617618     5   0.653    0.19183 0.200 0.060 0.032 0.012 0.608 0.088
#> GSM617619     3   0.823   -0.01288 0.000 0.300 0.340 0.076 0.120 0.164
#> GSM617620     4   0.153    0.52264 0.000 0.048 0.000 0.936 0.000 0.016
#> GSM617622     4   0.613    0.30281 0.000 0.160 0.004 0.616 0.124 0.096
#> GSM617623     4   0.847   -0.36033 0.204 0.056 0.004 0.292 0.160 0.284
#> GSM617624     2   0.784    0.39649 0.008 0.492 0.068 0.120 0.160 0.152
#> GSM617625     3   0.560    0.51211 0.156 0.008 0.656 0.000 0.036 0.144
#> GSM617626     1   0.784    0.00794 0.456 0.088 0.000 0.104 0.224 0.128
#> GSM617627     2   0.644    0.49111 0.008 0.608 0.044 0.208 0.040 0.092
#> GSM617628     3   0.624    0.51445 0.120 0.016 0.620 0.000 0.084 0.160
#> GSM617632     1   0.709   -0.02983 0.400 0.028 0.020 0.008 0.348 0.196
#> GSM617634     5   0.786    0.03503 0.032 0.216 0.028 0.160 0.472 0.092
#> GSM617635     1   0.738    0.37800 0.520 0.080 0.052 0.004 0.160 0.184
#> GSM617636     5   0.693   -0.08659 0.200 0.032 0.056 0.000 0.528 0.184
#> GSM617637     1   0.372    0.54066 0.820 0.068 0.000 0.000 0.044 0.068
#> GSM617638     2   0.747    0.42314 0.012 0.548 0.072 0.136 0.140 0.092
#> GSM617639     1   0.447    0.53003 0.760 0.072 0.012 0.000 0.020 0.136
#> GSM617640     2   0.477    0.41844 0.000 0.612 0.000 0.336 0.020 0.032
#> GSM617641     4   0.193    0.53040 0.000 0.044 0.000 0.920 0.004 0.032
#> GSM617643     2   0.607    0.20761 0.004 0.448 0.004 0.432 0.044 0.068
#> GSM617644     4   0.573    0.30682 0.000 0.208 0.000 0.628 0.068 0.096
#> GSM617647     2   0.751    0.36165 0.096 0.456 0.004 0.292 0.048 0.104
#> GSM617648     4   0.725   -0.13369 0.008 0.320 0.000 0.412 0.136 0.124
#> GSM617649     2   0.833    0.36389 0.020 0.408 0.092 0.264 0.088 0.128
#> GSM617650     1   0.494    0.49056 0.696 0.000 0.148 0.000 0.020 0.136
#> GSM617651     1   0.362    0.55855 0.820 0.012 0.024 0.000 0.024 0.120
#> GSM617653     1   0.565    0.34556 0.652 0.020 0.000 0.036 0.084 0.208
#> GSM617654     2   0.635    0.50106 0.036 0.612 0.004 0.200 0.044 0.104
#> GSM617583     3   0.512    0.57677 0.088 0.004 0.712 0.000 0.060 0.136
#> GSM617584     4   0.672    0.28139 0.076 0.044 0.004 0.588 0.088 0.200
#> GSM617585     4   0.703    0.22552 0.000 0.068 0.072 0.528 0.252 0.080
#> GSM617586     3   0.245    0.62216 0.016 0.004 0.884 0.000 0.004 0.092
#> GSM617587     3   0.634    0.50250 0.084 0.080 0.656 0.012 0.044 0.124
#> GSM617589     4   0.304    0.52203 0.000 0.040 0.004 0.868 0.032 0.056
#> GSM617591     4   0.723    0.10711 0.000 0.132 0.244 0.484 0.020 0.120
#> GSM617593     1   0.231    0.55606 0.904 0.020 0.004 0.000 0.012 0.060
#> GSM617594     2   0.891    0.34237 0.112 0.376 0.072 0.232 0.064 0.144
#> GSM617595     1   0.294    0.56091 0.860 0.020 0.004 0.000 0.016 0.100
#> GSM617596     1   0.843   -0.44173 0.344 0.056 0.068 0.032 0.216 0.284
#> GSM617597     3   0.605    0.34008 0.200 0.012 0.580 0.000 0.020 0.188
#> GSM617598     1   0.250    0.55041 0.880 0.004 0.000 0.000 0.028 0.088
#> GSM617599     2   0.928    0.24364 0.084 0.268 0.044 0.216 0.172 0.216
#> GSM617600     3   0.551    0.51745 0.000 0.088 0.664 0.000 0.168 0.080
#> GSM617601     4   0.502    0.26346 0.000 0.280 0.004 0.640 0.016 0.060
#> GSM617602     5   0.570    0.02427 0.016 0.012 0.396 0.000 0.504 0.072
#> GSM617603     4   0.426    0.48525 0.000 0.112 0.000 0.776 0.048 0.064
#> GSM617604     6   0.884    0.00000 0.216 0.028 0.156 0.052 0.264 0.284
#> GSM617605     4   0.232    0.52967 0.000 0.052 0.000 0.900 0.008 0.040
#> GSM617606     4   0.855    0.05464 0.016 0.176 0.136 0.404 0.088 0.180
#> GSM617610     1   0.197    0.55441 0.916 0.004 0.000 0.000 0.024 0.056
#> GSM617611     1   0.457    0.51426 0.736 0.012 0.124 0.000 0.004 0.124
#> GSM617613     3   0.434    0.55230 0.000 0.020 0.744 0.000 0.172 0.064
#> GSM617614     3   0.683    0.37377 0.136 0.008 0.540 0.000 0.144 0.172
#> GSM617621     1   0.717   -0.06056 0.476 0.048 0.016 0.012 0.192 0.256
#> GSM617629     5   0.637    0.25474 0.008 0.092 0.172 0.020 0.624 0.084
#> GSM617630     2   0.846    0.18136 0.032 0.424 0.212 0.072 0.100 0.160
#> GSM617631     3   0.490    0.44894 0.000 0.012 0.652 0.000 0.260 0.076
#> GSM617633     5   0.804    0.05140 0.216 0.040 0.196 0.000 0.388 0.160
#> GSM617642     3   0.481    0.54565 0.104 0.000 0.732 0.000 0.052 0.112
#> GSM617645     2   0.514    0.48062 0.012 0.644 0.004 0.276 0.012 0.052
#> GSM617646     1   0.771    0.22280 0.456 0.240 0.048 0.004 0.092 0.160
#> GSM617652     1   0.810   -0.01097 0.392 0.096 0.248 0.000 0.080 0.184
#> GSM617655     3   0.296    0.62653 0.000 0.028 0.868 0.000 0.056 0.048
#> GSM617656     3   0.184    0.62353 0.000 0.016 0.928 0.000 0.040 0.016
#> GSM617657     3   0.672    0.39560 0.000 0.068 0.584 0.060 0.196 0.092
#> GSM617658     5   0.694   -0.08283 0.068 0.008 0.292 0.004 0.476 0.152
#> GSM617659     1   0.602    0.30125 0.552 0.004 0.252 0.000 0.020 0.172

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

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

collect_plots(res)

plot of chunk SD-pam-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.271           0.639       0.830         0.4931 0.494   0.494
#> 3 3 0.599           0.755       0.881         0.3222 0.757   0.555
#> 4 4 0.591           0.690       0.855         0.0508 0.954   0.875
#> 5 5 0.602           0.668       0.838         0.0262 0.970   0.912
#> 6 6 0.626           0.601       0.832         0.0152 0.986   0.955

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

suggest_best_k(res)
#> [1] 3

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

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

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>           class entropy silhouette    p1    p2
#> GSM617581     2  0.0376     0.6473 0.004 0.996
#> GSM617582     2  0.4815     0.5587 0.104 0.896
#> GSM617588     2  0.8144     0.7554 0.252 0.748
#> GSM617590     2  0.8813     0.7317 0.300 0.700
#> GSM617592     2  0.8144     0.7554 0.252 0.748
#> GSM617607     1  0.8861     0.7634 0.696 0.304
#> GSM617608     1  0.9866     0.7126 0.568 0.432
#> GSM617609     1  0.8144     0.7621 0.748 0.252
#> GSM617612     1  0.9460     0.7476 0.636 0.364
#> GSM617615     2  0.9129     0.7137 0.328 0.672
#> GSM617616     2  0.7376     0.2874 0.208 0.792
#> GSM617617     2  0.0000     0.6503 0.000 1.000
#> GSM617618     2  0.0938     0.6405 0.012 0.988
#> GSM617619     2  0.8813     0.7397 0.300 0.700
#> GSM617620     2  0.8144     0.7554 0.252 0.748
#> GSM617622     2  0.8144     0.7554 0.252 0.748
#> GSM617623     2  0.7815     0.2115 0.232 0.768
#> GSM617624     2  0.8555     0.7193 0.280 0.720
#> GSM617625     1  0.0376     0.6002 0.996 0.004
#> GSM617626     2  0.0000     0.6503 0.000 1.000
#> GSM617627     2  0.8499     0.7488 0.276 0.724
#> GSM617628     1  0.0000     0.6012 1.000 0.000
#> GSM617632     2  0.8267     0.1122 0.260 0.740
#> GSM617634     2  0.8144     0.7554 0.252 0.748
#> GSM617635     1  0.9833     0.7186 0.576 0.424
#> GSM617636     1  0.9970     0.6805 0.532 0.468
#> GSM617637     1  0.9977     0.6755 0.528 0.472
#> GSM617638     1  0.8443     0.7631 0.728 0.272
#> GSM617639     1  0.9970     0.6780 0.532 0.468
#> GSM617640     2  0.0000     0.6503 0.000 1.000
#> GSM617641     2  0.8144     0.7554 0.252 0.748
#> GSM617643     2  0.8144     0.7554 0.252 0.748
#> GSM617644     2  0.8144     0.7554 0.252 0.748
#> GSM617647     2  0.5737     0.4710 0.136 0.864
#> GSM617648     2  0.8144     0.7554 0.252 0.748
#> GSM617649     2  0.5519     0.5748 0.128 0.872
#> GSM617650     1  0.9795     0.7241 0.584 0.416
#> GSM617651     1  0.9909     0.7025 0.556 0.444
#> GSM617653     1  0.9795     0.7250 0.584 0.416
#> GSM617654     2  0.0000     0.6503 0.000 1.000
#> GSM617583     1  0.0376     0.6002 0.996 0.004
#> GSM617584     2  0.4431     0.7059 0.092 0.908
#> GSM617585     2  0.8555     0.7453 0.280 0.720
#> GSM617586     1  0.0000     0.6012 1.000 0.000
#> GSM617587     1  0.1633     0.5945 0.976 0.024
#> GSM617589     2  0.8144     0.7554 0.252 0.748
#> GSM617591     2  0.9963     0.5659 0.464 0.536
#> GSM617593     1  0.9970     0.6805 0.532 0.468
#> GSM617594     2  0.9896     0.1685 0.440 0.560
#> GSM617595     1  0.9977     0.6755 0.528 0.472
#> GSM617596     1  0.8608     0.7650 0.716 0.284
#> GSM617597     1  0.8144     0.7621 0.748 0.252
#> GSM617598     1  0.9970     0.6780 0.532 0.468
#> GSM617599     2  0.0376     0.6496 0.004 0.996
#> GSM617600     1  0.0000     0.6012 1.000 0.000
#> GSM617601     2  0.8207     0.7544 0.256 0.744
#> GSM617602     1  0.7745     0.7593 0.772 0.228
#> GSM617603     2  0.9522     0.6705 0.372 0.628
#> GSM617604     1  0.8144     0.7621 0.748 0.252
#> GSM617605     2  0.8207     0.7544 0.256 0.744
#> GSM617606     2  0.9977     0.5560 0.472 0.528
#> GSM617610     1  0.9977     0.6755 0.528 0.472
#> GSM617611     1  0.9710     0.7336 0.600 0.400
#> GSM617613     1  0.0938     0.5880 0.988 0.012
#> GSM617614     1  0.7745     0.7589 0.772 0.228
#> GSM617621     1  0.9977     0.6755 0.528 0.472
#> GSM617629     2  0.9996    -0.1285 0.488 0.512
#> GSM617630     1  0.8144     0.7621 0.748 0.252
#> GSM617631     1  0.0000     0.6012 1.000 0.000
#> GSM617633     1  0.8909     0.7633 0.692 0.308
#> GSM617642     1  0.7815     0.7602 0.768 0.232
#> GSM617645     2  0.8499     0.0563 0.276 0.724
#> GSM617646     1  0.9944     0.6913 0.544 0.456
#> GSM617652     1  0.8207     0.7631 0.744 0.256
#> GSM617655     1  0.9000    -0.1898 0.684 0.316
#> GSM617656     1  0.0000     0.6012 1.000 0.000
#> GSM617657     1  0.0000     0.6012 1.000 0.000
#> GSM617658     1  0.8207     0.7622 0.744 0.256
#> GSM617659     1  0.8144     0.7621 0.748 0.252

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>           class entropy silhouette    p1    p2    p3
#> GSM617581     2  0.0424    0.85206 0.008 0.992 0.000
#> GSM617582     2  0.3941    0.75334 0.156 0.844 0.000
#> GSM617588     2  0.0000    0.85402 0.000 1.000 0.000
#> GSM617590     2  0.4842    0.70398 0.000 0.776 0.224
#> GSM617592     2  0.0000    0.85402 0.000 1.000 0.000
#> GSM617607     1  0.0000    0.84404 1.000 0.000 0.000
#> GSM617608     1  0.0000    0.84404 1.000 0.000 0.000
#> GSM617609     1  0.5138    0.72071 0.748 0.000 0.252
#> GSM617612     1  0.3481    0.82401 0.904 0.044 0.052
#> GSM617615     3  0.4228    0.78154 0.008 0.148 0.844
#> GSM617616     2  0.6192    0.23735 0.420 0.580 0.000
#> GSM617617     2  0.0000    0.85402 0.000 1.000 0.000
#> GSM617618     2  0.3619    0.77411 0.136 0.864 0.000
#> GSM617619     2  0.6905    0.29076 0.016 0.544 0.440
#> GSM617620     2  0.0000    0.85402 0.000 1.000 0.000
#> GSM617622     2  0.0000    0.85402 0.000 1.000 0.000
#> GSM617623     2  0.6299    0.04468 0.476 0.524 0.000
#> GSM617624     2  0.7979    0.58614 0.112 0.640 0.248
#> GSM617625     3  0.0237    0.95943 0.004 0.000 0.996
#> GSM617626     2  0.0000    0.85402 0.000 1.000 0.000
#> GSM617627     2  0.2584    0.83216 0.008 0.928 0.064
#> GSM617628     3  0.0000    0.95971 0.000 0.000 1.000
#> GSM617632     1  0.6309   -0.00561 0.500 0.500 0.000
#> GSM617634     2  0.2261    0.82974 0.000 0.932 0.068
#> GSM617635     1  0.0000    0.84404 1.000 0.000 0.000
#> GSM617636     1  0.0747    0.84284 0.984 0.016 0.000
#> GSM617637     1  0.0424    0.84401 0.992 0.008 0.000
#> GSM617638     1  0.4663    0.78760 0.828 0.016 0.156
#> GSM617639     1  0.0000    0.84404 1.000 0.000 0.000
#> GSM617640     2  0.0000    0.85402 0.000 1.000 0.000
#> GSM617641     2  0.0000    0.85402 0.000 1.000 0.000
#> GSM617643     2  0.0000    0.85402 0.000 1.000 0.000
#> GSM617644     2  0.0000    0.85402 0.000 1.000 0.000
#> GSM617647     2  0.5810    0.46871 0.336 0.664 0.000
#> GSM617648     2  0.0000    0.85402 0.000 1.000 0.000
#> GSM617649     2  0.3826    0.76738 0.008 0.868 0.124
#> GSM617650     1  0.0000    0.84404 1.000 0.000 0.000
#> GSM617651     1  0.0000    0.84404 1.000 0.000 0.000
#> GSM617653     1  0.4609    0.77555 0.844 0.128 0.028
#> GSM617654     2  0.0237    0.85331 0.004 0.996 0.000
#> GSM617583     3  0.0237    0.95943 0.004 0.000 0.996
#> GSM617584     2  0.0000    0.85402 0.000 1.000 0.000
#> GSM617585     3  0.4654    0.68224 0.000 0.208 0.792
#> GSM617586     3  0.0237    0.95943 0.004 0.000 0.996
#> GSM617587     3  0.2269    0.92747 0.040 0.016 0.944
#> GSM617589     2  0.3116    0.80719 0.000 0.892 0.108
#> GSM617591     3  0.0661    0.95529 0.004 0.008 0.988
#> GSM617593     1  0.0424    0.84401 0.992 0.008 0.000
#> GSM617594     1  0.9995   -0.07979 0.348 0.332 0.320
#> GSM617595     1  0.0747    0.84298 0.984 0.016 0.000
#> GSM617596     1  0.4749    0.77959 0.816 0.012 0.172
#> GSM617597     1  0.3340    0.80761 0.880 0.000 0.120
#> GSM617598     1  0.0237    0.84430 0.996 0.004 0.000
#> GSM617599     2  0.0237    0.85274 0.004 0.996 0.000
#> GSM617600     3  0.0747    0.95242 0.016 0.000 0.984
#> GSM617601     2  0.6148    0.50499 0.004 0.640 0.356
#> GSM617602     1  0.6608    0.43616 0.560 0.008 0.432
#> GSM617603     2  0.3752    0.75786 0.000 0.856 0.144
#> GSM617604     1  0.4842    0.74690 0.776 0.000 0.224
#> GSM617605     2  0.6008    0.54402 0.004 0.664 0.332
#> GSM617606     3  0.0000    0.95971 0.000 0.000 1.000
#> GSM617610     1  0.1860    0.82959 0.948 0.052 0.000
#> GSM617611     1  0.0237    0.84391 0.996 0.004 0.000
#> GSM617613     3  0.0000    0.95971 0.000 0.000 1.000
#> GSM617614     1  0.5650    0.65573 0.688 0.000 0.312
#> GSM617621     1  0.0424    0.84401 0.992 0.008 0.000
#> GSM617629     1  0.9931    0.17065 0.388 0.324 0.288
#> GSM617630     1  0.4931    0.74030 0.768 0.000 0.232
#> GSM617631     3  0.0000    0.95971 0.000 0.000 1.000
#> GSM617633     1  0.0424    0.84364 0.992 0.000 0.008
#> GSM617642     1  0.5678    0.65103 0.684 0.000 0.316
#> GSM617645     1  0.6295    0.08641 0.528 0.472 0.000
#> GSM617646     1  0.0237    0.84430 0.996 0.004 0.000
#> GSM617652     1  0.0237    0.84403 0.996 0.000 0.004
#> GSM617655     3  0.0424    0.95783 0.008 0.000 0.992
#> GSM617656     3  0.0000    0.95971 0.000 0.000 1.000
#> GSM617657     3  0.0000    0.95971 0.000 0.000 1.000
#> GSM617658     1  0.5158    0.73919 0.764 0.004 0.232
#> GSM617659     1  0.0237    0.84386 0.996 0.000 0.004

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM617581     2  0.0336    0.72437 0.008 0.992 0.000 0.000
#> GSM617582     2  0.3123    0.60991 0.156 0.844 0.000 0.000
#> GSM617588     2  0.2530    0.65354 0.000 0.888 0.000 0.112
#> GSM617590     4  0.5334    0.86004 0.000 0.172 0.088 0.740
#> GSM617592     2  0.2921    0.62367 0.000 0.860 0.000 0.140
#> GSM617607     1  0.0188    0.84075 0.996 0.000 0.000 0.004
#> GSM617608     1  0.0188    0.84090 0.996 0.000 0.000 0.004
#> GSM617609     1  0.5483    0.72563 0.736 0.000 0.128 0.136
#> GSM617612     1  0.3280    0.81492 0.892 0.048 0.040 0.020
#> GSM617615     3  0.4583    0.74700 0.004 0.112 0.808 0.076
#> GSM617616     2  0.4907    0.24917 0.420 0.580 0.000 0.000
#> GSM617617     2  0.0000    0.72457 0.000 1.000 0.000 0.000
#> GSM617618     2  0.2868    0.63385 0.136 0.864 0.000 0.000
#> GSM617619     2  0.7200   -0.00642 0.012 0.452 0.440 0.096
#> GSM617620     2  0.2081    0.67788 0.000 0.916 0.000 0.084
#> GSM617622     2  0.0000    0.72457 0.000 1.000 0.000 0.000
#> GSM617623     2  0.4992    0.06389 0.476 0.524 0.000 0.000
#> GSM617624     2  0.8363    0.21074 0.096 0.532 0.256 0.116
#> GSM617625     3  0.0376    0.90275 0.004 0.000 0.992 0.004
#> GSM617626     2  0.0000    0.72457 0.000 1.000 0.000 0.000
#> GSM617627     2  0.3851    0.64708 0.004 0.852 0.056 0.088
#> GSM617628     3  0.0000    0.90105 0.000 0.000 1.000 0.000
#> GSM617632     2  0.5000   -0.03202 0.500 0.500 0.000 0.000
#> GSM617634     2  0.1792    0.69688 0.000 0.932 0.068 0.000
#> GSM617635     1  0.0000    0.84066 1.000 0.000 0.000 0.000
#> GSM617636     1  0.0469    0.83938 0.988 0.012 0.000 0.000
#> GSM617637     1  0.0188    0.84082 0.996 0.004 0.000 0.000
#> GSM617638     1  0.5282    0.75945 0.772 0.012 0.096 0.120
#> GSM617639     1  0.0000    0.84066 1.000 0.000 0.000 0.000
#> GSM617640     2  0.0000    0.72457 0.000 1.000 0.000 0.000
#> GSM617641     2  0.4040    0.44328 0.000 0.752 0.000 0.248
#> GSM617643     2  0.0000    0.72457 0.000 1.000 0.000 0.000
#> GSM617644     2  0.0000    0.72457 0.000 1.000 0.000 0.000
#> GSM617647     2  0.5233    0.37391 0.332 0.648 0.000 0.020
#> GSM617648     2  0.0000    0.72457 0.000 1.000 0.000 0.000
#> GSM617649     2  0.4287    0.59206 0.004 0.828 0.088 0.080
#> GSM617650     1  0.0000    0.84066 1.000 0.000 0.000 0.000
#> GSM617651     1  0.0000    0.84066 1.000 0.000 0.000 0.000
#> GSM617653     1  0.3749    0.76297 0.840 0.128 0.032 0.000
#> GSM617654     2  0.0524    0.72445 0.004 0.988 0.000 0.008
#> GSM617583     3  0.0524    0.90035 0.004 0.000 0.988 0.008
#> GSM617584     2  0.1118    0.71121 0.000 0.964 0.000 0.036
#> GSM617585     3  0.4136    0.63852 0.000 0.196 0.788 0.016
#> GSM617586     3  0.2999    0.85465 0.004 0.000 0.864 0.132
#> GSM617587     3  0.3943    0.83145 0.028 0.004 0.832 0.136
#> GSM617589     2  0.2799    0.66244 0.000 0.884 0.108 0.008
#> GSM617591     3  0.1909    0.89912 0.004 0.008 0.940 0.048
#> GSM617593     1  0.0188    0.84082 0.996 0.004 0.000 0.000
#> GSM617594     1  0.9037   -0.19563 0.320 0.308 0.316 0.056
#> GSM617595     1  0.0469    0.83955 0.988 0.012 0.000 0.000
#> GSM617596     1  0.3881    0.77609 0.812 0.016 0.172 0.000
#> GSM617597     1  0.3667    0.80426 0.856 0.000 0.088 0.056
#> GSM617598     1  0.0188    0.84082 0.996 0.004 0.000 0.000
#> GSM617599     2  0.1118    0.71420 0.000 0.964 0.000 0.036
#> GSM617600     3  0.2542    0.88637 0.012 0.000 0.904 0.084
#> GSM617601     2  0.5929    0.24212 0.000 0.596 0.356 0.048
#> GSM617602     1  0.5714    0.45045 0.552 0.004 0.424 0.020
#> GSM617603     4  0.5517    0.80691 0.000 0.184 0.092 0.724
#> GSM617604     1  0.4086    0.75130 0.776 0.008 0.216 0.000
#> GSM617605     4  0.5143    0.84835 0.000 0.172 0.076 0.752
#> GSM617606     3  0.0336    0.90069 0.000 0.008 0.992 0.000
#> GSM617610     1  0.1389    0.82457 0.952 0.048 0.000 0.000
#> GSM617611     1  0.0000    0.84066 1.000 0.000 0.000 0.000
#> GSM617613     3  0.0592    0.89770 0.000 0.000 0.984 0.016
#> GSM617614     1  0.4792    0.65765 0.680 0.000 0.312 0.008
#> GSM617621     1  0.0188    0.84082 0.996 0.004 0.000 0.000
#> GSM617629     1  0.8413    0.07181 0.384 0.316 0.280 0.020
#> GSM617630     1  0.4655    0.74330 0.760 0.000 0.208 0.032
#> GSM617631     3  0.0592    0.89770 0.000 0.000 0.984 0.016
#> GSM617633     1  0.0188    0.84052 0.996 0.000 0.004 0.000
#> GSM617642     1  0.5297    0.65900 0.676 0.000 0.292 0.032
#> GSM617645     1  0.6347    0.15783 0.524 0.412 0.000 0.064
#> GSM617646     1  0.0188    0.84082 0.996 0.004 0.000 0.000
#> GSM617652     1  0.1824    0.82650 0.936 0.000 0.004 0.060
#> GSM617655     3  0.2466    0.88213 0.004 0.000 0.900 0.096
#> GSM617656     3  0.1792    0.89482 0.000 0.000 0.932 0.068
#> GSM617657     3  0.0592    0.89770 0.000 0.000 0.984 0.016
#> GSM617658     1  0.4579    0.73584 0.756 0.004 0.224 0.016
#> GSM617659     1  0.0000    0.84066 1.000 0.000 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1    p2    p3    p4    p5
#> GSM617581     2  0.0290     0.7562 0.008 0.992 0.000 0.000 0.000
#> GSM617582     2  0.2690     0.6629 0.156 0.844 0.000 0.000 0.000
#> GSM617588     2  0.2891     0.6546 0.000 0.824 0.000 0.176 0.000
#> GSM617590     4  0.0671     0.9300 0.000 0.016 0.004 0.980 0.000
#> GSM617592     2  0.3210     0.6142 0.000 0.788 0.000 0.212 0.000
#> GSM617607     1  0.0000     0.8529 1.000 0.000 0.000 0.000 0.000
#> GSM617608     1  0.0162     0.8524 0.996 0.000 0.000 0.000 0.004
#> GSM617609     1  0.4927     0.6373 0.652 0.000 0.052 0.000 0.296
#> GSM617612     1  0.2827     0.8262 0.892 0.044 0.044 0.000 0.020
#> GSM617615     3  0.3918     0.7056 0.000 0.096 0.804 0.000 0.100
#> GSM617616     2  0.4227     0.2495 0.420 0.580 0.000 0.000 0.000
#> GSM617617     2  0.0000     0.7564 0.000 1.000 0.000 0.000 0.000
#> GSM617618     2  0.2471     0.6811 0.136 0.864 0.000 0.000 0.000
#> GSM617619     3  0.7074     0.2461 0.012 0.352 0.416 0.004 0.216
#> GSM617620     2  0.1965     0.7151 0.000 0.904 0.000 0.096 0.000
#> GSM617622     2  0.0000     0.7564 0.000 1.000 0.000 0.000 0.000
#> GSM617623     2  0.4300     0.0622 0.476 0.524 0.000 0.000 0.000
#> GSM617624     2  0.7968     0.1347 0.092 0.436 0.248 0.004 0.220
#> GSM617625     3  0.0290     0.7704 0.000 0.000 0.992 0.000 0.008
#> GSM617626     2  0.0000     0.7564 0.000 1.000 0.000 0.000 0.000
#> GSM617627     2  0.3804     0.6613 0.000 0.812 0.052 0.004 0.132
#> GSM617628     3  0.0000     0.7688 0.000 0.000 1.000 0.000 0.000
#> GSM617632     2  0.4307    -0.0355 0.500 0.500 0.000 0.000 0.000
#> GSM617634     2  0.1544     0.7328 0.000 0.932 0.068 0.000 0.000
#> GSM617635     1  0.0000     0.8529 1.000 0.000 0.000 0.000 0.000
#> GSM617636     1  0.0404     0.8503 0.988 0.012 0.000 0.000 0.000
#> GSM617637     1  0.0000     0.8529 1.000 0.000 0.000 0.000 0.000
#> GSM617638     1  0.4729     0.6993 0.708 0.008 0.032 0.004 0.248
#> GSM617639     1  0.0000     0.8529 1.000 0.000 0.000 0.000 0.000
#> GSM617640     2  0.0000     0.7564 0.000 1.000 0.000 0.000 0.000
#> GSM617641     2  0.4294     0.1107 0.000 0.532 0.000 0.468 0.000
#> GSM617643     2  0.0000     0.7564 0.000 1.000 0.000 0.000 0.000
#> GSM617644     2  0.0000     0.7564 0.000 1.000 0.000 0.000 0.000
#> GSM617647     2  0.4592     0.4495 0.332 0.644 0.000 0.000 0.024
#> GSM617648     2  0.0000     0.7564 0.000 1.000 0.000 0.000 0.000
#> GSM617649     2  0.4421     0.5676 0.000 0.748 0.068 0.000 0.184
#> GSM617650     1  0.0000     0.8529 1.000 0.000 0.000 0.000 0.000
#> GSM617651     1  0.0000     0.8529 1.000 0.000 0.000 0.000 0.000
#> GSM617653     1  0.3229     0.7753 0.840 0.128 0.032 0.000 0.000
#> GSM617654     2  0.0324     0.7567 0.004 0.992 0.000 0.000 0.004
#> GSM617583     3  0.0000     0.7688 0.000 0.000 1.000 0.000 0.000
#> GSM617584     2  0.1043     0.7455 0.000 0.960 0.000 0.040 0.000
#> GSM617585     3  0.3948     0.6210 0.000 0.196 0.776 0.016 0.012
#> GSM617586     3  0.3561     0.7070 0.000 0.000 0.740 0.000 0.260
#> GSM617587     3  0.3766     0.6981 0.004 0.000 0.728 0.000 0.268
#> GSM617589     2  0.2411     0.7060 0.000 0.884 0.108 0.008 0.000
#> GSM617591     3  0.2011     0.7677 0.000 0.004 0.908 0.000 0.088
#> GSM617593     1  0.0000     0.8529 1.000 0.000 0.000 0.000 0.000
#> GSM617594     3  0.7866     0.0227 0.316 0.304 0.316 0.000 0.064
#> GSM617595     1  0.0510     0.8491 0.984 0.016 0.000 0.000 0.000
#> GSM617596     1  0.3559     0.7786 0.804 0.012 0.176 0.000 0.008
#> GSM617597     1  0.3593     0.8005 0.828 0.000 0.084 0.000 0.088
#> GSM617598     1  0.0000     0.8529 1.000 0.000 0.000 0.000 0.000
#> GSM617599     2  0.0963     0.7477 0.000 0.964 0.000 0.000 0.036
#> GSM617600     3  0.3684     0.7380 0.004 0.000 0.788 0.016 0.192
#> GSM617601     2  0.5376     0.2786 0.000 0.584 0.356 0.004 0.056
#> GSM617602     1  0.5558     0.4583 0.548 0.004 0.400 0.016 0.032
#> GSM617603     5  0.5841     0.0000 0.000 0.044 0.032 0.364 0.560
#> GSM617604     1  0.3582     0.7505 0.768 0.000 0.224 0.000 0.008
#> GSM617605     4  0.1299     0.9298 0.000 0.020 0.008 0.960 0.012
#> GSM617606     3  0.0000     0.7688 0.000 0.000 1.000 0.000 0.000
#> GSM617610     1  0.1197     0.8357 0.952 0.048 0.000 0.000 0.000
#> GSM617611     1  0.0000     0.8529 1.000 0.000 0.000 0.000 0.000
#> GSM617613     3  0.0566     0.7686 0.000 0.000 0.984 0.012 0.004
#> GSM617614     1  0.4127     0.6673 0.680 0.000 0.312 0.000 0.008
#> GSM617621     1  0.0000     0.8529 1.000 0.000 0.000 0.000 0.000
#> GSM617629     1  0.8143     0.1012 0.360 0.288 0.276 0.012 0.064
#> GSM617630     1  0.4886     0.7196 0.712 0.000 0.188 0.000 0.100
#> GSM617631     3  0.1018     0.7614 0.000 0.000 0.968 0.016 0.016
#> GSM617633     1  0.0000     0.8529 1.000 0.000 0.000 0.000 0.000
#> GSM617642     1  0.4948     0.6722 0.676 0.000 0.256 0.000 0.068
#> GSM617645     1  0.5820     0.2110 0.524 0.376 0.000 0.000 0.100
#> GSM617646     1  0.0000     0.8529 1.000 0.000 0.000 0.000 0.000
#> GSM617652     1  0.1544     0.8338 0.932 0.000 0.000 0.000 0.068
#> GSM617655     3  0.2966     0.7451 0.000 0.000 0.816 0.000 0.184
#> GSM617656     3  0.3010     0.7528 0.000 0.000 0.824 0.004 0.172
#> GSM617657     3  0.3847     0.6461 0.000 0.000 0.784 0.036 0.180
#> GSM617658     1  0.4271     0.7348 0.744 0.000 0.224 0.016 0.016
#> GSM617659     1  0.0000     0.8529 1.000 0.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
#> GSM617581     2  0.0260    0.71798 0.008 0.992 0.000 0.000 0.000 0.000
#> GSM617582     2  0.2416    0.61865 0.156 0.844 0.000 0.000 0.000 0.000
#> GSM617588     2  0.2941    0.50731 0.000 0.780 0.000 0.220 0.000 0.000
#> GSM617590     4  0.0000    0.36496 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM617592     2  0.3309    0.39184 0.000 0.720 0.000 0.280 0.000 0.000
#> GSM617607     1  0.0000    0.84653 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM617608     1  0.0146    0.84643 0.996 0.000 0.000 0.000 0.000 0.004
#> GSM617609     1  0.4399    0.56559 0.616 0.000 0.028 0.000 0.004 0.352
#> GSM617612     1  0.2453    0.82039 0.896 0.044 0.044 0.000 0.000 0.016
#> GSM617615     3  0.3325    0.64222 0.000 0.084 0.820 0.000 0.000 0.096
#> GSM617616     2  0.3797    0.24009 0.420 0.580 0.000 0.000 0.000 0.000
#> GSM617617     2  0.0000    0.71818 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM617618     2  0.2219    0.63872 0.136 0.864 0.000 0.000 0.000 0.000
#> GSM617619     3  0.6797    0.18545 0.012 0.312 0.404 0.000 0.024 0.248
#> GSM617620     2  0.2135    0.62729 0.000 0.872 0.000 0.128 0.000 0.000
#> GSM617622     2  0.0000    0.71818 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM617623     2  0.3862    0.04724 0.476 0.524 0.000 0.000 0.000 0.000
#> GSM617624     2  0.8140   -0.02976 0.092 0.368 0.244 0.008 0.048 0.240
#> GSM617625     3  0.0260    0.68210 0.000 0.000 0.992 0.000 0.000 0.008
#> GSM617626     2  0.0000    0.71818 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM617627     2  0.4376    0.56961 0.000 0.772 0.052 0.008 0.040 0.128
#> GSM617628     3  0.0000    0.67918 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM617632     2  0.3869   -0.05173 0.500 0.500 0.000 0.000 0.000 0.000
#> GSM617634     2  0.1387    0.69216 0.000 0.932 0.068 0.000 0.000 0.000
#> GSM617635     1  0.0260    0.84640 0.992 0.000 0.008 0.000 0.000 0.000
#> GSM617636     1  0.0363    0.84486 0.988 0.012 0.000 0.000 0.000 0.000
#> GSM617637     1  0.0000    0.84653 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM617638     1  0.4827    0.64817 0.676 0.008 0.012 0.008 0.036 0.260
#> GSM617639     1  0.0000    0.84653 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM617640     2  0.0000    0.71818 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM617641     4  0.3966    0.17309 0.000 0.444 0.000 0.552 0.000 0.004
#> GSM617643     2  0.0000    0.71818 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM617644     2  0.0000    0.71818 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM617647     2  0.4196    0.40963 0.332 0.640 0.000 0.000 0.000 0.028
#> GSM617648     2  0.0000    0.71818 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM617649     2  0.4233    0.47218 0.000 0.724 0.064 0.000 0.004 0.208
#> GSM617650     1  0.0000    0.84653 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM617651     1  0.0260    0.84640 0.992 0.000 0.008 0.000 0.000 0.000
#> GSM617653     1  0.2972    0.76693 0.836 0.128 0.036 0.000 0.000 0.000
#> GSM617654     2  0.0405    0.71829 0.004 0.988 0.000 0.000 0.000 0.008
#> GSM617583     3  0.0000    0.67918 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM617584     2  0.1219    0.69458 0.000 0.948 0.000 0.048 0.000 0.004
#> GSM617585     3  0.4361    0.52366 0.000 0.184 0.748 0.012 0.024 0.032
#> GSM617586     3  0.3508    0.62002 0.000 0.000 0.704 0.000 0.004 0.292
#> GSM617587     3  0.3684    0.61044 0.004 0.000 0.692 0.000 0.004 0.300
#> GSM617589     2  0.2165    0.66107 0.000 0.884 0.108 0.008 0.000 0.000
#> GSM617591     3  0.1674    0.68842 0.000 0.004 0.924 0.000 0.004 0.068
#> GSM617593     1  0.0000    0.84653 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM617594     3  0.7100   -0.00952 0.308 0.304 0.320 0.000 0.000 0.068
#> GSM617595     1  0.0508    0.84485 0.984 0.012 0.004 0.000 0.000 0.000
#> GSM617596     1  0.3246    0.76816 0.812 0.016 0.160 0.000 0.000 0.012
#> GSM617597     1  0.3448    0.78245 0.816 0.000 0.072 0.000 0.004 0.108
#> GSM617598     1  0.0000    0.84653 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM617599     2  0.0937    0.70680 0.000 0.960 0.000 0.000 0.000 0.040
#> GSM617600     3  0.4199    0.60196 0.000 0.000 0.704 0.004 0.044 0.248
#> GSM617601     2  0.5639    0.20435 0.000 0.548 0.356 0.008 0.040 0.048
#> GSM617602     1  0.5941    0.39663 0.540 0.004 0.344 0.012 0.028 0.072
#> GSM617603     5  0.1610    0.00000 0.000 0.000 0.000 0.084 0.916 0.000
#> GSM617604     1  0.3539    0.73360 0.768 0.008 0.208 0.000 0.000 0.016
#> GSM617605     4  0.0603    0.39091 0.000 0.016 0.000 0.980 0.000 0.004
#> GSM617606     3  0.0000    0.67918 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM617610     1  0.1219    0.83007 0.948 0.048 0.004 0.000 0.000 0.000
#> GSM617611     1  0.0260    0.84640 0.992 0.000 0.008 0.000 0.000 0.000
#> GSM617613     3  0.1230    0.67385 0.000 0.000 0.956 0.008 0.028 0.008
#> GSM617614     1  0.4183    0.62861 0.668 0.000 0.296 0.000 0.000 0.036
#> GSM617621     1  0.0000    0.84653 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM617629     1  0.7882   -0.06035 0.348 0.268 0.260 0.008 0.020 0.096
#> GSM617630     1  0.4432    0.69650 0.708 0.000 0.188 0.000 0.000 0.104
#> GSM617631     3  0.2058    0.63375 0.000 0.000 0.916 0.012 0.024 0.048
#> GSM617633     1  0.0000    0.84653 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM617642     1  0.4836    0.63602 0.664 0.000 0.228 0.000 0.004 0.104
#> GSM617645     1  0.5414    0.22408 0.524 0.372 0.000 0.000 0.008 0.096
#> GSM617646     1  0.0000    0.84653 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM617652     1  0.1387    0.82726 0.932 0.000 0.000 0.000 0.000 0.068
#> GSM617655     3  0.3052    0.65862 0.000 0.000 0.780 0.000 0.004 0.216
#> GSM617656     3  0.3348    0.64612 0.000 0.000 0.768 0.000 0.016 0.216
#> GSM617657     6  0.4338    0.00000 0.000 0.000 0.248 0.012 0.040 0.700
#> GSM617658     1  0.4672    0.68669 0.716 0.000 0.208 0.012 0.024 0.040
#> GSM617659     1  0.0260    0.84640 0.992 0.000 0.008 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-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) k
#> SD:pam 71         0.005653 2
#> SD:pam 70         0.001008 3
#> SD:pam 67         0.000946 4
#> SD:pam 66         0.001101 5
#> SD:pam 61         0.001218 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 21168 rows and 79 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 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-mclust-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.842           0.927       0.952         0.2330 0.796   0.796
#> 3 3 0.342           0.519       0.739         1.1228 0.753   0.691
#> 4 4 0.682           0.785       0.879         0.4442 0.624   0.380
#> 5 5 0.584           0.556       0.771         0.0635 0.966   0.880
#> 6 6 0.613           0.492       0.721         0.0446 0.945   0.802

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

suggest_best_k(res)
#> [1] 4

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

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

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>           class entropy silhouette    p1    p2
#> GSM617581     1  0.1843      0.953 0.972 0.028
#> GSM617582     1  0.1843      0.953 0.972 0.028
#> GSM617588     2  0.3733      0.956 0.072 0.928
#> GSM617590     2  0.3584      0.952 0.068 0.932
#> GSM617592     2  0.3733      0.956 0.072 0.928
#> GSM617607     1  0.0376      0.956 0.996 0.004
#> GSM617608     1  0.1633      0.951 0.976 0.024
#> GSM617609     1  0.0000      0.956 1.000 0.000
#> GSM617612     1  0.0672      0.956 0.992 0.008
#> GSM617615     1  0.5294      0.866 0.880 0.120
#> GSM617616     1  0.0938      0.956 0.988 0.012
#> GSM617617     1  0.4815      0.891 0.896 0.104
#> GSM617618     1  0.1184      0.955 0.984 0.016
#> GSM617619     1  0.0672      0.956 0.992 0.008
#> GSM617620     2  0.3733      0.956 0.072 0.928
#> GSM617622     1  0.6801      0.801 0.820 0.180
#> GSM617623     1  0.1843      0.953 0.972 0.028
#> GSM617624     1  0.1184      0.955 0.984 0.016
#> GSM617625     1  0.0672      0.956 0.992 0.008
#> GSM617626     1  0.1633      0.954 0.976 0.024
#> GSM617627     1  0.1633      0.952 0.976 0.024
#> GSM617628     1  0.0672      0.956 0.992 0.008
#> GSM617632     1  0.1414      0.956 0.980 0.020
#> GSM617634     1  0.1843      0.953 0.972 0.028
#> GSM617635     1  0.1184      0.954 0.984 0.016
#> GSM617636     1  0.1184      0.955 0.984 0.016
#> GSM617637     1  0.1843      0.949 0.972 0.028
#> GSM617638     1  0.1184      0.955 0.984 0.016
#> GSM617639     1  0.1843      0.949 0.972 0.028
#> GSM617640     1  0.6623      0.801 0.828 0.172
#> GSM617641     2  0.3733      0.956 0.072 0.928
#> GSM617643     1  0.6623      0.800 0.828 0.172
#> GSM617644     2  0.9460      0.488 0.364 0.636
#> GSM617647     1  0.1184      0.955 0.984 0.016
#> GSM617648     1  0.6623      0.812 0.828 0.172
#> GSM617649     1  0.1414      0.953 0.980 0.020
#> GSM617650     1  0.1414      0.952 0.980 0.020
#> GSM617651     1  0.2236      0.943 0.964 0.036
#> GSM617653     1  0.1414      0.956 0.980 0.020
#> GSM617654     1  0.3114      0.930 0.944 0.056
#> GSM617583     1  0.0672      0.956 0.992 0.008
#> GSM617584     1  0.3584      0.927 0.932 0.068
#> GSM617585     1  0.8608      0.619 0.716 0.284
#> GSM617586     1  0.0672      0.956 0.992 0.008
#> GSM617587     1  0.0000      0.956 1.000 0.000
#> GSM617589     2  0.3879      0.953 0.076 0.924
#> GSM617591     1  0.1184      0.955 0.984 0.016
#> GSM617593     1  0.1184      0.954 0.984 0.016
#> GSM617594     1  0.1184      0.955 0.984 0.016
#> GSM617595     1  0.2236      0.943 0.964 0.036
#> GSM617596     1  0.1414      0.955 0.980 0.020
#> GSM617597     1  0.0938      0.956 0.988 0.012
#> GSM617598     1  0.1843      0.954 0.972 0.028
#> GSM617599     1  0.1414      0.954 0.980 0.020
#> GSM617600     1  0.2423      0.940 0.960 0.040
#> GSM617601     1  0.8555      0.611 0.720 0.280
#> GSM617602     1  0.1843      0.954 0.972 0.028
#> GSM617603     2  0.3733      0.956 0.072 0.928
#> GSM617604     1  0.1184      0.955 0.984 0.016
#> GSM617605     2  0.3733      0.956 0.072 0.928
#> GSM617606     1  0.1184      0.955 0.984 0.016
#> GSM617610     1  0.2043      0.946 0.968 0.032
#> GSM617611     1  0.1633      0.951 0.976 0.024
#> GSM617613     1  0.2423      0.940 0.960 0.040
#> GSM617614     1  0.0376      0.956 0.996 0.004
#> GSM617621     1  0.1633      0.955 0.976 0.024
#> GSM617629     1  0.1414      0.955 0.980 0.020
#> GSM617630     1  0.0000      0.956 1.000 0.000
#> GSM617631     1  0.2948      0.939 0.948 0.052
#> GSM617633     1  0.0000      0.956 1.000 0.000
#> GSM617642     1  0.0376      0.956 0.996 0.004
#> GSM617645     1  0.5737      0.847 0.864 0.136
#> GSM617646     1  0.0000      0.956 1.000 0.000
#> GSM617652     1  0.0376      0.956 0.996 0.004
#> GSM617655     1  0.1414      0.953 0.980 0.020
#> GSM617656     1  0.2236      0.942 0.964 0.036
#> GSM617657     1  0.2603      0.941 0.956 0.044
#> GSM617658     1  0.1633      0.955 0.976 0.024
#> GSM617659     1  0.1184      0.955 0.984 0.016

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>           class entropy silhouette    p1    p2    p3
#> GSM617581     1  0.3375     0.6579 0.892 0.100 0.008
#> GSM617582     1  0.3009     0.6936 0.920 0.052 0.028
#> GSM617588     3  0.5690     0.9973 0.004 0.288 0.708
#> GSM617590     3  0.5690     0.9973 0.004 0.288 0.708
#> GSM617592     3  0.5690     0.9973 0.004 0.288 0.708
#> GSM617607     1  0.1267     0.7091 0.972 0.024 0.004
#> GSM617608     1  0.0237     0.7163 0.996 0.000 0.004
#> GSM617609     1  0.5115     0.5660 0.768 0.004 0.228
#> GSM617612     1  0.0237     0.7163 0.996 0.000 0.004
#> GSM617615     2  0.8701     0.6091 0.400 0.492 0.108
#> GSM617616     1  0.0592     0.7157 0.988 0.012 0.000
#> GSM617617     2  0.5873     0.7085 0.312 0.684 0.004
#> GSM617618     1  0.1289     0.7110 0.968 0.032 0.000
#> GSM617619     1  0.9367    -0.1455 0.504 0.292 0.204
#> GSM617620     3  0.5690     0.9973 0.004 0.288 0.708
#> GSM617622     2  0.7922     0.6071 0.408 0.532 0.060
#> GSM617623     1  0.4164     0.6008 0.848 0.144 0.008
#> GSM617624     1  0.7295    -0.4789 0.488 0.484 0.028
#> GSM617625     1  0.3589     0.6782 0.900 0.048 0.052
#> GSM617626     1  0.2280     0.6934 0.940 0.052 0.008
#> GSM617627     2  0.7004     0.5907 0.428 0.552 0.020
#> GSM617628     1  0.7398     0.5004 0.700 0.120 0.180
#> GSM617632     1  0.1129     0.7144 0.976 0.020 0.004
#> GSM617634     1  0.6758     0.0231 0.620 0.360 0.020
#> GSM617635     1  0.1163     0.7061 0.972 0.028 0.000
#> GSM617636     1  0.1765     0.7082 0.956 0.040 0.004
#> GSM617637     1  0.0475     0.7165 0.992 0.004 0.004
#> GSM617638     1  0.7735    -0.3816 0.512 0.440 0.048
#> GSM617639     1  0.0475     0.7165 0.992 0.004 0.004
#> GSM617640     2  0.5754     0.7014 0.296 0.700 0.004
#> GSM617641     3  0.5690     0.9973 0.004 0.288 0.708
#> GSM617643     2  0.5754     0.7014 0.296 0.700 0.004
#> GSM617644     2  0.8488    -0.3007 0.096 0.520 0.384
#> GSM617647     1  0.7054    -0.3804 0.524 0.456 0.020
#> GSM617648     2  0.6113     0.7047 0.300 0.688 0.012
#> GSM617649     2  0.7013     0.5840 0.432 0.548 0.020
#> GSM617650     1  0.0000     0.7161 1.000 0.000 0.000
#> GSM617651     1  0.0475     0.7165 0.992 0.004 0.004
#> GSM617653     1  0.1129     0.7134 0.976 0.020 0.004
#> GSM617654     2  0.5706     0.7079 0.320 0.680 0.000
#> GSM617583     1  0.4357     0.6605 0.868 0.052 0.080
#> GSM617584     1  0.8618    -0.3895 0.508 0.388 0.104
#> GSM617585     2  0.9372     0.0934 0.200 0.500 0.300
#> GSM617586     1  0.8517     0.3579 0.584 0.128 0.288
#> GSM617587     1  0.2682     0.6909 0.920 0.004 0.076
#> GSM617589     3  0.6051     0.9806 0.012 0.292 0.696
#> GSM617591     1  0.7883    -0.4144 0.516 0.428 0.056
#> GSM617593     1  0.0475     0.7165 0.992 0.004 0.004
#> GSM617594     1  0.6924    -0.1929 0.580 0.400 0.020
#> GSM617595     1  0.0661     0.7158 0.988 0.008 0.004
#> GSM617596     1  0.0983     0.7140 0.980 0.016 0.004
#> GSM617597     1  0.0592     0.7163 0.988 0.000 0.012
#> GSM617598     1  0.0592     0.7157 0.988 0.012 0.000
#> GSM617599     1  0.6195     0.2715 0.704 0.276 0.020
#> GSM617600     1  0.9871     0.1459 0.412 0.280 0.308
#> GSM617601     2  0.9351     0.5062 0.256 0.516 0.228
#> GSM617602     1  0.9401     0.2727 0.504 0.216 0.280
#> GSM617603     3  0.5690     0.9973 0.004 0.288 0.708
#> GSM617604     1  0.1636     0.7142 0.964 0.016 0.020
#> GSM617605     3  0.5690     0.9973 0.004 0.288 0.708
#> GSM617606     1  0.7555    -0.4002 0.520 0.440 0.040
#> GSM617610     1  0.0475     0.7167 0.992 0.004 0.004
#> GSM617611     1  0.0000     0.7161 1.000 0.000 0.000
#> GSM617613     1  0.9871     0.1459 0.412 0.280 0.308
#> GSM617614     1  0.4887     0.6384 0.844 0.096 0.060
#> GSM617621     1  0.0983     0.7140 0.980 0.016 0.004
#> GSM617629     1  0.6728     0.5496 0.736 0.080 0.184
#> GSM617630     1  0.6865     0.4743 0.736 0.160 0.104
#> GSM617631     1  0.9907     0.1422 0.400 0.288 0.312
#> GSM617633     1  0.1411     0.7026 0.964 0.036 0.000
#> GSM617642     1  0.2297     0.7047 0.944 0.020 0.036
#> GSM617645     2  0.5560     0.7051 0.300 0.700 0.000
#> GSM617646     1  0.1411     0.7014 0.964 0.036 0.000
#> GSM617652     1  0.0000     0.7161 1.000 0.000 0.000
#> GSM617655     1  0.9092     0.2915 0.528 0.168 0.304
#> GSM617656     1  0.9857     0.1473 0.416 0.276 0.308
#> GSM617657     2  0.9947    -0.0251 0.316 0.384 0.300
#> GSM617658     1  0.7572     0.4911 0.688 0.184 0.128
#> GSM617659     1  0.0000     0.7161 1.000 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM617581     1  0.6609      0.658 0.668 0.224 0.068 0.040
#> GSM617582     1  0.7312      0.558 0.608 0.200 0.168 0.024
#> GSM617588     4  0.1022      0.872 0.000 0.032 0.000 0.968
#> GSM617590     4  0.1022      0.872 0.000 0.032 0.000 0.968
#> GSM617592     4  0.1022      0.872 0.000 0.032 0.000 0.968
#> GSM617607     1  0.1411      0.888 0.960 0.020 0.020 0.000
#> GSM617608     1  0.0592      0.888 0.984 0.000 0.016 0.000
#> GSM617609     3  0.3009      0.798 0.056 0.052 0.892 0.000
#> GSM617612     1  0.0188      0.891 0.996 0.004 0.000 0.000
#> GSM617615     2  0.3982      0.712 0.000 0.776 0.004 0.220
#> GSM617616     1  0.2207      0.879 0.928 0.004 0.056 0.012
#> GSM617617     2  0.0657      0.875 0.000 0.984 0.004 0.012
#> GSM617618     1  0.3144      0.874 0.892 0.020 0.072 0.016
#> GSM617619     2  0.4522      0.519 0.000 0.680 0.320 0.000
#> GSM617620     4  0.1022      0.872 0.000 0.032 0.000 0.968
#> GSM617622     2  0.3842      0.792 0.004 0.836 0.024 0.136
#> GSM617623     1  0.6674      0.656 0.668 0.220 0.060 0.052
#> GSM617624     2  0.0779      0.877 0.004 0.980 0.016 0.000
#> GSM617625     3  0.4898      0.487 0.416 0.000 0.584 0.000
#> GSM617626     1  0.5430      0.709 0.732 0.204 0.056 0.008
#> GSM617627     2  0.0779      0.877 0.000 0.980 0.016 0.004
#> GSM617628     3  0.4844      0.683 0.300 0.012 0.688 0.000
#> GSM617632     1  0.3130      0.873 0.892 0.012 0.072 0.024
#> GSM617634     2  0.4198      0.759 0.116 0.828 0.052 0.004
#> GSM617635     1  0.0672      0.891 0.984 0.008 0.008 0.000
#> GSM617636     1  0.3877      0.866 0.860 0.032 0.084 0.024
#> GSM617637     1  0.0188      0.891 0.996 0.004 0.000 0.000
#> GSM617638     2  0.1492      0.868 0.004 0.956 0.036 0.004
#> GSM617639     1  0.0779      0.891 0.980 0.016 0.004 0.000
#> GSM617640     2  0.0469      0.875 0.000 0.988 0.000 0.012
#> GSM617641     4  0.1022      0.872 0.000 0.032 0.000 0.968
#> GSM617643     2  0.0469      0.875 0.000 0.988 0.000 0.012
#> GSM617644     2  0.4898      0.295 0.000 0.584 0.000 0.416
#> GSM617647     2  0.1182      0.876 0.016 0.968 0.016 0.000
#> GSM617648     2  0.2300      0.850 0.000 0.920 0.016 0.064
#> GSM617649     2  0.0524      0.877 0.000 0.988 0.008 0.004
#> GSM617650     1  0.0000      0.890 1.000 0.000 0.000 0.000
#> GSM617651     1  0.0000      0.890 1.000 0.000 0.000 0.000
#> GSM617653     1  0.2222      0.877 0.924 0.000 0.060 0.016
#> GSM617654     2  0.0188      0.875 0.000 0.996 0.000 0.004
#> GSM617583     3  0.4855      0.598 0.352 0.004 0.644 0.000
#> GSM617584     4  0.8691      0.127 0.280 0.300 0.036 0.384
#> GSM617585     4  0.6851      0.177 0.000 0.104 0.400 0.496
#> GSM617586     3  0.2443      0.805 0.060 0.024 0.916 0.000
#> GSM617587     3  0.7033      0.399 0.364 0.128 0.508 0.000
#> GSM617589     4  0.1716      0.848 0.000 0.064 0.000 0.936
#> GSM617591     2  0.4688      0.768 0.000 0.792 0.080 0.128
#> GSM617593     1  0.0188      0.890 0.996 0.000 0.004 0.000
#> GSM617594     2  0.0779      0.877 0.004 0.980 0.016 0.000
#> GSM617595     1  0.0188      0.890 0.996 0.000 0.004 0.000
#> GSM617596     1  0.4387      0.839 0.840 0.068 0.060 0.032
#> GSM617597     1  0.2469      0.820 0.892 0.000 0.108 0.000
#> GSM617598     1  0.1474      0.883 0.948 0.000 0.052 0.000
#> GSM617599     2  0.3037      0.814 0.100 0.880 0.020 0.000
#> GSM617600     3  0.1929      0.804 0.036 0.024 0.940 0.000
#> GSM617601     2  0.3123      0.789 0.000 0.844 0.000 0.156
#> GSM617602     3  0.0376      0.783 0.004 0.000 0.992 0.004
#> GSM617603     4  0.1022      0.872 0.000 0.032 0.000 0.968
#> GSM617604     1  0.5622      0.693 0.696 0.020 0.256 0.028
#> GSM617605     4  0.1022      0.872 0.000 0.032 0.000 0.968
#> GSM617606     2  0.2708      0.863 0.028 0.916 0.040 0.016
#> GSM617610     1  0.0000      0.890 1.000 0.000 0.000 0.000
#> GSM617611     1  0.0188      0.890 0.996 0.000 0.004 0.000
#> GSM617613     3  0.1936      0.802 0.032 0.028 0.940 0.000
#> GSM617614     3  0.4072      0.701 0.252 0.000 0.748 0.000
#> GSM617621     1  0.3448      0.869 0.884 0.028 0.060 0.028
#> GSM617629     3  0.4809      0.590 0.012 0.220 0.752 0.016
#> GSM617630     2  0.3937      0.738 0.012 0.800 0.188 0.000
#> GSM617631     3  0.0000      0.783 0.000 0.000 1.000 0.000
#> GSM617633     1  0.1771      0.881 0.948 0.012 0.036 0.004
#> GSM617642     1  0.4560      0.546 0.700 0.004 0.296 0.000
#> GSM617645     2  0.0469      0.875 0.000 0.988 0.000 0.012
#> GSM617646     1  0.1474      0.880 0.948 0.052 0.000 0.000
#> GSM617652     1  0.1837      0.883 0.944 0.028 0.028 0.000
#> GSM617655     3  0.1929      0.804 0.036 0.024 0.940 0.000
#> GSM617656     3  0.1929      0.804 0.036 0.024 0.940 0.000
#> GSM617657     3  0.1833      0.799 0.024 0.032 0.944 0.000
#> GSM617658     3  0.2629      0.769 0.060 0.004 0.912 0.024
#> GSM617659     1  0.0817      0.891 0.976 0.000 0.024 0.000

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1    p2    p3    p4    p5
#> GSM617581     1  0.7621   -0.19676 0.456 0.212 0.048 0.008 0.276
#> GSM617582     5  0.8512    0.00000 0.228 0.188 0.284 0.000 0.300
#> GSM617588     4  0.0162    0.83752 0.000 0.004 0.000 0.996 0.000
#> GSM617590     4  0.0162    0.83752 0.000 0.004 0.000 0.996 0.000
#> GSM617592     4  0.0162    0.83752 0.000 0.004 0.000 0.996 0.000
#> GSM617607     1  0.3634    0.66182 0.844 0.020 0.080 0.000 0.056
#> GSM617608     1  0.1907    0.68996 0.928 0.000 0.028 0.000 0.044
#> GSM617609     3  0.3100    0.57351 0.040 0.064 0.876 0.000 0.020
#> GSM617612     1  0.2775    0.67865 0.876 0.004 0.100 0.000 0.020
#> GSM617615     2  0.5369    0.63096 0.004 0.672 0.016 0.252 0.056
#> GSM617616     1  0.4943    0.56596 0.716 0.008 0.076 0.000 0.200
#> GSM617617     2  0.2452    0.77505 0.000 0.896 0.004 0.016 0.084
#> GSM617618     1  0.6277    0.40524 0.604 0.028 0.128 0.000 0.240
#> GSM617619     2  0.4762    0.69563 0.008 0.748 0.140 0.000 0.104
#> GSM617620     4  0.0162    0.83752 0.000 0.004 0.000 0.996 0.000
#> GSM617622     2  0.4986    0.63948 0.008 0.704 0.008 0.236 0.044
#> GSM617623     1  0.7531   -0.15006 0.468 0.208 0.044 0.008 0.272
#> GSM617624     2  0.3161    0.77949 0.008 0.860 0.032 0.000 0.100
#> GSM617625     3  0.4884    0.38442 0.232 0.008 0.704 0.000 0.056
#> GSM617626     1  0.6901    0.05459 0.532 0.160 0.040 0.000 0.268
#> GSM617627     2  0.3070    0.78521 0.008 0.872 0.028 0.004 0.088
#> GSM617628     3  0.4332    0.52015 0.132 0.016 0.788 0.000 0.064
#> GSM617632     1  0.4928    0.57986 0.724 0.012 0.072 0.000 0.192
#> GSM617634     2  0.5212    0.63458 0.016 0.692 0.068 0.000 0.224
#> GSM617635     1  0.2464    0.68670 0.904 0.004 0.048 0.000 0.044
#> GSM617636     1  0.5993    0.47338 0.628 0.016 0.140 0.000 0.216
#> GSM617637     1  0.0404    0.69639 0.988 0.000 0.000 0.000 0.012
#> GSM617638     2  0.3376    0.77905 0.012 0.848 0.032 0.000 0.108
#> GSM617639     1  0.0566    0.69685 0.984 0.004 0.000 0.000 0.012
#> GSM617640     2  0.2069    0.77902 0.000 0.912 0.000 0.012 0.076
#> GSM617641     4  0.0162    0.83752 0.000 0.004 0.000 0.996 0.000
#> GSM617643     2  0.2069    0.77902 0.000 0.912 0.000 0.012 0.076
#> GSM617644     4  0.5891   -0.00136 0.000 0.432 0.000 0.468 0.100
#> GSM617647     2  0.4018    0.74885 0.092 0.824 0.012 0.008 0.064
#> GSM617648     2  0.3906    0.73615 0.000 0.812 0.004 0.080 0.104
#> GSM617649     2  0.2237    0.79461 0.008 0.904 0.004 0.000 0.084
#> GSM617650     1  0.1502    0.68350 0.940 0.000 0.004 0.000 0.056
#> GSM617651     1  0.0510    0.69448 0.984 0.000 0.000 0.000 0.016
#> GSM617653     1  0.4354    0.52750 0.712 0.000 0.032 0.000 0.256
#> GSM617654     2  0.1956    0.77938 0.000 0.916 0.000 0.008 0.076
#> GSM617583     3  0.4686    0.44643 0.192 0.012 0.740 0.000 0.056
#> GSM617584     4  0.8241   -0.00849 0.100 0.264 0.008 0.396 0.232
#> GSM617585     4  0.6650    0.52912 0.004 0.124 0.136 0.636 0.100
#> GSM617586     3  0.1815    0.60319 0.016 0.020 0.940 0.000 0.024
#> GSM617587     3  0.6311    0.01787 0.204 0.148 0.616 0.000 0.032
#> GSM617589     4  0.1907    0.80523 0.000 0.044 0.000 0.928 0.028
#> GSM617591     2  0.5934    0.67494 0.004 0.692 0.092 0.148 0.064
#> GSM617593     1  0.1430    0.68390 0.944 0.000 0.004 0.000 0.052
#> GSM617594     2  0.2813    0.74790 0.084 0.880 0.032 0.000 0.004
#> GSM617595     1  0.0510    0.69578 0.984 0.000 0.000 0.000 0.016
#> GSM617596     1  0.5886    0.45651 0.636 0.032 0.080 0.000 0.252
#> GSM617597     1  0.5235   -0.08211 0.524 0.012 0.440 0.000 0.024
#> GSM617598     1  0.2179    0.66316 0.888 0.000 0.000 0.000 0.112
#> GSM617599     2  0.3809    0.72163 0.100 0.832 0.032 0.000 0.036
#> GSM617600     3  0.4199    0.55059 0.004 0.008 0.692 0.000 0.296
#> GSM617601     2  0.4254    0.69011 0.000 0.740 0.000 0.220 0.040
#> GSM617602     3  0.3209    0.54780 0.000 0.008 0.812 0.000 0.180
#> GSM617603     4  0.0290    0.83272 0.000 0.000 0.000 0.992 0.008
#> GSM617604     1  0.6922   -0.31082 0.408 0.008 0.344 0.000 0.240
#> GSM617605     4  0.0162    0.83752 0.000 0.004 0.000 0.996 0.000
#> GSM617606     2  0.5808    0.70032 0.008 0.716 0.104 0.092 0.080
#> GSM617610     1  0.0671    0.69664 0.980 0.000 0.004 0.000 0.016
#> GSM617611     1  0.0451    0.69531 0.988 0.000 0.004 0.000 0.008
#> GSM617613     3  0.4046    0.54875 0.000 0.008 0.696 0.000 0.296
#> GSM617614     3  0.4686    0.46894 0.112 0.008 0.756 0.000 0.124
#> GSM617621     1  0.4930    0.60265 0.740 0.020 0.076 0.000 0.164
#> GSM617629     3  0.6834   -0.06723 0.008 0.256 0.460 0.000 0.276
#> GSM617630     2  0.5232    0.65406 0.020 0.716 0.168 0.000 0.096
#> GSM617631     3  0.4225    0.51964 0.000 0.004 0.632 0.000 0.364
#> GSM617633     1  0.5521    0.44835 0.692 0.028 0.188 0.000 0.092
#> GSM617642     3  0.5555    0.05608 0.328 0.012 0.600 0.000 0.060
#> GSM617645     2  0.2069    0.77902 0.000 0.912 0.000 0.012 0.076
#> GSM617646     1  0.3393    0.67160 0.860 0.044 0.072 0.000 0.024
#> GSM617652     1  0.5309    0.42915 0.684 0.028 0.236 0.000 0.052
#> GSM617655     3  0.2103    0.60602 0.004 0.020 0.920 0.000 0.056
#> GSM617656     3  0.4064    0.56024 0.004 0.008 0.716 0.000 0.272
#> GSM617657     3  0.4401    0.52372 0.000 0.016 0.656 0.000 0.328
#> GSM617658     3  0.4033    0.49806 0.024 0.004 0.760 0.000 0.212
#> GSM617659     1  0.1670    0.68536 0.936 0.000 0.012 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
#> GSM617581     1  0.6980    -0.3344 0.376 0.208 0.016 0.004 0.368 0.028
#> GSM617582     5  0.8304     0.0000 0.208 0.228 0.196 0.008 0.332 0.028
#> GSM617588     4  0.0146     0.8371 0.000 0.000 0.000 0.996 0.004 0.000
#> GSM617590     4  0.0508     0.8376 0.000 0.004 0.000 0.984 0.000 0.012
#> GSM617592     4  0.0146     0.8389 0.000 0.004 0.000 0.996 0.000 0.000
#> GSM617607     1  0.3925     0.6474 0.812 0.012 0.072 0.000 0.080 0.024
#> GSM617608     1  0.1370     0.6946 0.948 0.004 0.012 0.000 0.036 0.000
#> GSM617609     3  0.7084     0.0664 0.040 0.216 0.496 0.000 0.044 0.204
#> GSM617612     1  0.2663     0.6884 0.884 0.004 0.068 0.000 0.032 0.012
#> GSM617615     2  0.5381     0.5095 0.000 0.616 0.004 0.260 0.108 0.012
#> GSM617616     1  0.4723     0.5053 0.684 0.012 0.060 0.004 0.240 0.000
#> GSM617617     2  0.4009     0.6048 0.000 0.632 0.000 0.008 0.356 0.004
#> GSM617618     1  0.5994     0.3256 0.576 0.072 0.072 0.004 0.276 0.000
#> GSM617619     2  0.3835     0.5291 0.000 0.812 0.072 0.000 0.048 0.068
#> GSM617620     4  0.0146     0.8389 0.000 0.004 0.000 0.996 0.000 0.000
#> GSM617622     2  0.5540     0.4906 0.000 0.588 0.000 0.232 0.172 0.008
#> GSM617623     1  0.6934    -0.2784 0.396 0.196 0.016 0.004 0.360 0.028
#> GSM617624     2  0.1464     0.6161 0.004 0.944 0.000 0.000 0.016 0.036
#> GSM617625     3  0.2584     0.5079 0.144 0.000 0.848 0.004 0.004 0.000
#> GSM617626     1  0.6512    -0.1170 0.464 0.140 0.020 0.000 0.352 0.024
#> GSM617627     2  0.1321     0.6348 0.004 0.952 0.000 0.000 0.024 0.020
#> GSM617628     3  0.2568     0.4921 0.088 0.000 0.880 0.004 0.004 0.024
#> GSM617632     1  0.4634     0.5572 0.704 0.008 0.076 0.000 0.208 0.004
#> GSM617634     2  0.4754     0.4147 0.004 0.708 0.020 0.008 0.216 0.044
#> GSM617635     1  0.2726     0.6785 0.880 0.008 0.052 0.000 0.056 0.004
#> GSM617636     1  0.7233     0.2601 0.520 0.056 0.156 0.000 0.200 0.068
#> GSM617637     1  0.1129     0.6994 0.964 0.004 0.012 0.000 0.008 0.012
#> GSM617638     2  0.2256     0.6023 0.004 0.908 0.008 0.000 0.032 0.048
#> GSM617639     1  0.0976     0.6991 0.968 0.000 0.016 0.000 0.008 0.008
#> GSM617640     2  0.3756     0.6081 0.000 0.644 0.000 0.000 0.352 0.004
#> GSM617641     4  0.0146     0.8389 0.000 0.004 0.000 0.996 0.000 0.000
#> GSM617643     2  0.3892     0.6087 0.004 0.640 0.000 0.000 0.352 0.004
#> GSM617644     4  0.5856     0.2364 0.000 0.264 0.000 0.528 0.200 0.008
#> GSM617647     2  0.4137     0.5745 0.108 0.756 0.000 0.000 0.132 0.004
#> GSM617648     2  0.5171     0.5490 0.000 0.524 0.000 0.068 0.400 0.008
#> GSM617649     2  0.2051     0.6485 0.000 0.896 0.000 0.004 0.096 0.004
#> GSM617650     1  0.2535     0.6731 0.892 0.004 0.004 0.004 0.064 0.032
#> GSM617651     1  0.1605     0.6897 0.936 0.000 0.004 0.000 0.044 0.016
#> GSM617653     1  0.5053     0.3875 0.628 0.000 0.052 0.000 0.292 0.028
#> GSM617654     2  0.3769     0.6074 0.000 0.640 0.000 0.000 0.356 0.004
#> GSM617583     3  0.2308     0.5136 0.108 0.000 0.880 0.004 0.000 0.008
#> GSM617584     4  0.7428    -0.1020 0.040 0.224 0.004 0.356 0.344 0.032
#> GSM617585     4  0.5526     0.6037 0.000 0.152 0.024 0.688 0.092 0.044
#> GSM617586     3  0.3902     0.1551 0.008 0.004 0.720 0.000 0.012 0.256
#> GSM617587     3  0.7440    -0.0532 0.164 0.268 0.448 0.000 0.032 0.088
#> GSM617589     4  0.2146     0.8013 0.000 0.044 0.000 0.908 0.044 0.004
#> GSM617591     2  0.5928     0.4913 0.000 0.620 0.028 0.216 0.112 0.024
#> GSM617593     1  0.2007     0.6811 0.916 0.004 0.000 0.000 0.044 0.036
#> GSM617594     2  0.3174     0.5763 0.104 0.836 0.004 0.000 0.056 0.000
#> GSM617595     1  0.1464     0.6930 0.944 0.000 0.004 0.000 0.036 0.016
#> GSM617596     1  0.5665     0.4274 0.620 0.032 0.084 0.000 0.252 0.012
#> GSM617597     3  0.4519     0.0791 0.468 0.004 0.508 0.000 0.016 0.004
#> GSM617598     1  0.2969     0.6663 0.860 0.000 0.032 0.000 0.088 0.020
#> GSM617599     2  0.4154     0.4964 0.112 0.744 0.000 0.000 0.144 0.000
#> GSM617600     6  0.3428     0.7949 0.000 0.000 0.304 0.000 0.000 0.696
#> GSM617601     2  0.4905     0.5374 0.004 0.648 0.000 0.272 0.068 0.008
#> GSM617602     3  0.3695     0.2756 0.000 0.004 0.776 0.000 0.044 0.176
#> GSM617603     4  0.0806     0.8326 0.000 0.000 0.000 0.972 0.020 0.008
#> GSM617604     3  0.6654    -0.3030 0.400 0.008 0.404 0.000 0.140 0.048
#> GSM617605     4  0.0508     0.8376 0.000 0.004 0.000 0.984 0.000 0.012
#> GSM617606     2  0.6060     0.4830 0.000 0.632 0.044 0.156 0.144 0.024
#> GSM617610     1  0.1577     0.6933 0.940 0.000 0.008 0.000 0.036 0.016
#> GSM617611     1  0.0291     0.6971 0.992 0.000 0.000 0.000 0.004 0.004
#> GSM617613     6  0.3175     0.8005 0.000 0.000 0.256 0.000 0.000 0.744
#> GSM617614     3  0.2463     0.5013 0.068 0.000 0.892 0.000 0.020 0.020
#> GSM617621     1  0.4706     0.5936 0.732 0.008 0.084 0.000 0.156 0.020
#> GSM617629     2  0.7355    -0.2891 0.004 0.388 0.312 0.000 0.140 0.156
#> GSM617630     2  0.4388     0.4571 0.000 0.760 0.136 0.000 0.044 0.060
#> GSM617631     6  0.4456     0.5297 0.000 0.000 0.448 0.000 0.028 0.524
#> GSM617633     1  0.6993     0.2052 0.564 0.108 0.180 0.000 0.092 0.056
#> GSM617642     3  0.3159     0.5016 0.168 0.004 0.812 0.000 0.012 0.004
#> GSM617645     2  0.3892     0.6087 0.004 0.640 0.000 0.000 0.352 0.004
#> GSM617646     1  0.3714     0.6573 0.828 0.036 0.072 0.000 0.056 0.008
#> GSM617652     1  0.4420     0.5597 0.744 0.016 0.176 0.000 0.056 0.008
#> GSM617655     3  0.4033     0.0849 0.004 0.004 0.692 0.000 0.016 0.284
#> GSM617656     6  0.3717     0.7264 0.000 0.000 0.384 0.000 0.000 0.616
#> GSM617657     6  0.3203     0.7317 0.000 0.024 0.160 0.000 0.004 0.812
#> GSM617658     3  0.3419     0.3525 0.008 0.000 0.820 0.000 0.056 0.116
#> GSM617659     1  0.2842     0.6715 0.884 0.004 0.028 0.004 0.048 0.032

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

consensus_heatmap(res, k = 2)

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

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

collect_plots(res)

plot of chunk SD-NMF-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.845           0.931       0.968         0.4975 0.503   0.503
#> 3 3 0.497           0.674       0.835         0.3474 0.755   0.545
#> 4 4 0.423           0.539       0.712         0.1151 0.835   0.554
#> 5 5 0.499           0.431       0.674         0.0633 0.869   0.559
#> 6 6 0.577           0.472       0.695         0.0374 0.933   0.713

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
#> GSM617581     2  0.6712      0.792 0.176 0.824
#> GSM617582     1  0.9881      0.261 0.564 0.436
#> GSM617588     2  0.0000      0.973 0.000 1.000
#> GSM617590     2  0.0000      0.973 0.000 1.000
#> GSM617592     2  0.0000      0.973 0.000 1.000
#> GSM617607     1  0.0000      0.962 1.000 0.000
#> GSM617608     1  0.0000      0.962 1.000 0.000
#> GSM617609     1  0.0000      0.962 1.000 0.000
#> GSM617612     1  0.0000      0.962 1.000 0.000
#> GSM617615     2  0.0000      0.973 0.000 1.000
#> GSM617616     1  0.7745      0.721 0.772 0.228
#> GSM617617     2  0.0000      0.973 0.000 1.000
#> GSM617618     1  0.6801      0.788 0.820 0.180
#> GSM617619     2  0.7745      0.724 0.228 0.772
#> GSM617620     2  0.0000      0.973 0.000 1.000
#> GSM617622     2  0.0000      0.973 0.000 1.000
#> GSM617623     2  0.2423      0.945 0.040 0.960
#> GSM617624     2  0.5842      0.847 0.140 0.860
#> GSM617625     1  0.0000      0.962 1.000 0.000
#> GSM617626     2  0.1414      0.961 0.020 0.980
#> GSM617627     2  0.0000      0.973 0.000 1.000
#> GSM617628     1  0.0000      0.962 1.000 0.000
#> GSM617632     1  0.2043      0.941 0.968 0.032
#> GSM617634     2  0.0672      0.969 0.008 0.992
#> GSM617635     1  0.0000      0.962 1.000 0.000
#> GSM617636     1  0.0000      0.962 1.000 0.000
#> GSM617637     1  0.0672      0.957 0.992 0.008
#> GSM617638     2  0.5737      0.850 0.136 0.864
#> GSM617639     1  0.0000      0.962 1.000 0.000
#> GSM617640     2  0.0000      0.973 0.000 1.000
#> GSM617641     2  0.0000      0.973 0.000 1.000
#> GSM617643     2  0.0000      0.973 0.000 1.000
#> GSM617644     2  0.0000      0.973 0.000 1.000
#> GSM617647     2  0.0000      0.973 0.000 1.000
#> GSM617648     2  0.0000      0.973 0.000 1.000
#> GSM617649     2  0.0000      0.973 0.000 1.000
#> GSM617650     1  0.0000      0.962 1.000 0.000
#> GSM617651     1  0.0000      0.962 1.000 0.000
#> GSM617653     1  0.0938      0.955 0.988 0.012
#> GSM617654     2  0.0000      0.973 0.000 1.000
#> GSM617583     1  0.0000      0.962 1.000 0.000
#> GSM617584     2  0.0000      0.973 0.000 1.000
#> GSM617585     2  0.0000      0.973 0.000 1.000
#> GSM617586     1  0.0000      0.962 1.000 0.000
#> GSM617587     1  0.0672      0.957 0.992 0.008
#> GSM617589     2  0.0000      0.973 0.000 1.000
#> GSM617591     2  0.3879      0.914 0.076 0.924
#> GSM617593     1  0.0000      0.962 1.000 0.000
#> GSM617594     2  0.1184      0.964 0.016 0.984
#> GSM617595     1  0.0000      0.962 1.000 0.000
#> GSM617596     1  0.3274      0.917 0.940 0.060
#> GSM617597     1  0.0000      0.962 1.000 0.000
#> GSM617598     1  0.0000      0.962 1.000 0.000
#> GSM617599     2  0.0938      0.967 0.012 0.988
#> GSM617600     1  0.0000      0.962 1.000 0.000
#> GSM617601     2  0.0000      0.973 0.000 1.000
#> GSM617602     1  0.0376      0.959 0.996 0.004
#> GSM617603     2  0.0000      0.973 0.000 1.000
#> GSM617604     1  0.0376      0.959 0.996 0.004
#> GSM617605     2  0.0000      0.973 0.000 1.000
#> GSM617606     2  0.0938      0.967 0.012 0.988
#> GSM617610     1  0.2603      0.931 0.956 0.044
#> GSM617611     1  0.0000      0.962 1.000 0.000
#> GSM617613     1  0.0000      0.962 1.000 0.000
#> GSM617614     1  0.0000      0.962 1.000 0.000
#> GSM617621     1  0.0000      0.962 1.000 0.000
#> GSM617629     1  0.5294      0.860 0.880 0.120
#> GSM617630     1  0.5294      0.854 0.880 0.120
#> GSM617631     1  0.0000      0.962 1.000 0.000
#> GSM617633     1  0.0000      0.962 1.000 0.000
#> GSM617642     1  0.0000      0.962 1.000 0.000
#> GSM617645     2  0.0000      0.973 0.000 1.000
#> GSM617646     1  0.0000      0.962 1.000 0.000
#> GSM617652     1  0.0000      0.962 1.000 0.000
#> GSM617655     1  0.0000      0.962 1.000 0.000
#> GSM617656     1  0.0000      0.962 1.000 0.000
#> GSM617657     1  0.9608      0.371 0.616 0.384
#> GSM617658     1  0.0000      0.962 1.000 0.000
#> GSM617659     1  0.0000      0.962 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
#> GSM617581     1  0.5760     0.3680 0.672 0.328 0.000
#> GSM617582     1  0.9190     0.4054 0.524 0.184 0.292
#> GSM617588     2  0.2537     0.7859 0.080 0.920 0.000
#> GSM617590     2  0.2625     0.7706 0.000 0.916 0.084
#> GSM617592     2  0.2165     0.7910 0.064 0.936 0.000
#> GSM617607     1  0.6026     0.3704 0.624 0.000 0.376
#> GSM617608     1  0.6308    -0.0226 0.508 0.000 0.492
#> GSM617609     3  0.0661     0.8352 0.004 0.008 0.988
#> GSM617612     1  0.2165     0.7867 0.936 0.000 0.064
#> GSM617615     2  0.1170     0.7924 0.008 0.976 0.016
#> GSM617616     1  0.1636     0.7820 0.964 0.016 0.020
#> GSM617617     2  0.6008     0.5142 0.372 0.628 0.000
#> GSM617618     1  0.4413     0.7615 0.852 0.024 0.124
#> GSM617619     3  0.5988     0.3729 0.000 0.368 0.632
#> GSM617620     2  0.1529     0.7952 0.040 0.960 0.000
#> GSM617622     2  0.1950     0.7963 0.040 0.952 0.008
#> GSM617623     1  0.5733     0.3616 0.676 0.324 0.000
#> GSM617624     2  0.8362     0.4629 0.112 0.588 0.300
#> GSM617625     3  0.3038     0.8105 0.104 0.000 0.896
#> GSM617626     1  0.4504     0.5762 0.804 0.196 0.000
#> GSM617627     2  0.4139     0.7541 0.016 0.860 0.124
#> GSM617628     3  0.1411     0.8370 0.036 0.000 0.964
#> GSM617632     1  0.2356     0.7839 0.928 0.000 0.072
#> GSM617634     2  0.4370     0.7872 0.076 0.868 0.056
#> GSM617635     1  0.3619     0.7503 0.864 0.000 0.136
#> GSM617636     3  0.5706     0.5245 0.320 0.000 0.680
#> GSM617637     1  0.1529     0.7555 0.960 0.040 0.000
#> GSM617638     2  0.7102     0.2391 0.024 0.556 0.420
#> GSM617639     1  0.0747     0.7843 0.984 0.000 0.016
#> GSM617640     2  0.5529     0.6327 0.296 0.704 0.000
#> GSM617641     2  0.1289     0.7953 0.032 0.968 0.000
#> GSM617643     2  0.4605     0.7211 0.204 0.796 0.000
#> GSM617644     2  0.2165     0.7910 0.064 0.936 0.000
#> GSM617647     1  0.6307    -0.2423 0.512 0.488 0.000
#> GSM617648     2  0.4062     0.7460 0.164 0.836 0.000
#> GSM617649     2  0.2564     0.7971 0.036 0.936 0.028
#> GSM617650     3  0.6274     0.1547 0.456 0.000 0.544
#> GSM617651     1  0.0592     0.7831 0.988 0.000 0.012
#> GSM617653     1  0.0892     0.7689 0.980 0.020 0.000
#> GSM617654     2  0.6280     0.3407 0.460 0.540 0.000
#> GSM617583     3  0.2066     0.8309 0.060 0.000 0.940
#> GSM617584     2  0.5882     0.5510 0.348 0.652 0.000
#> GSM617585     2  0.4887     0.6444 0.000 0.772 0.228
#> GSM617586     3  0.0829     0.8344 0.004 0.012 0.984
#> GSM617587     3  0.0892     0.8381 0.020 0.000 0.980
#> GSM617589     2  0.2066     0.7942 0.060 0.940 0.000
#> GSM617591     2  0.5254     0.6075 0.000 0.736 0.264
#> GSM617593     1  0.5397     0.5661 0.720 0.000 0.280
#> GSM617594     2  0.5948     0.5509 0.360 0.640 0.000
#> GSM617595     1  0.0747     0.7709 0.984 0.016 0.000
#> GSM617596     1  0.3425     0.7684 0.884 0.004 0.112
#> GSM617597     3  0.3340     0.8005 0.120 0.000 0.880
#> GSM617598     1  0.2878     0.7742 0.904 0.000 0.096
#> GSM617599     2  0.6235     0.3945 0.436 0.564 0.000
#> GSM617600     3  0.0424     0.8337 0.000 0.008 0.992
#> GSM617601     2  0.1765     0.7866 0.004 0.956 0.040
#> GSM617602     3  0.0661     0.8368 0.008 0.004 0.988
#> GSM617603     2  0.1753     0.7835 0.000 0.952 0.048
#> GSM617604     3  0.4883     0.7047 0.208 0.004 0.788
#> GSM617605     2  0.2537     0.7725 0.000 0.920 0.080
#> GSM617606     2  0.3846     0.7635 0.016 0.876 0.108
#> GSM617610     1  0.1529     0.7555 0.960 0.040 0.000
#> GSM617611     1  0.5327     0.5826 0.728 0.000 0.272
#> GSM617613     3  0.3116     0.7856 0.000 0.108 0.892
#> GSM617614     3  0.2356     0.8255 0.072 0.000 0.928
#> GSM617621     1  0.3192     0.7666 0.888 0.000 0.112
#> GSM617629     3  0.3816     0.7594 0.000 0.148 0.852
#> GSM617630     3  0.3116     0.7870 0.000 0.108 0.892
#> GSM617631     3  0.2537     0.8037 0.000 0.080 0.920
#> GSM617633     3  0.4399     0.7326 0.188 0.000 0.812
#> GSM617642     3  0.2448     0.8237 0.076 0.000 0.924
#> GSM617645     2  0.5529     0.6381 0.296 0.704 0.000
#> GSM617646     1  0.2261     0.7865 0.932 0.000 0.068
#> GSM617652     3  0.3816     0.7780 0.148 0.000 0.852
#> GSM617655     3  0.2625     0.8006 0.000 0.084 0.916
#> GSM617656     3  0.0424     0.8368 0.008 0.000 0.992
#> GSM617657     3  0.5178     0.6014 0.000 0.256 0.744
#> GSM617658     3  0.1989     0.8342 0.048 0.004 0.948
#> GSM617659     3  0.5785     0.5001 0.332 0.000 0.668

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM617581     1  0.6701     0.4230 0.592 0.104 0.004 0.300
#> GSM617582     1  0.9497     0.3135 0.404 0.248 0.200 0.148
#> GSM617588     4  0.2635     0.7088 0.020 0.076 0.000 0.904
#> GSM617590     4  0.2376     0.7130 0.000 0.068 0.016 0.916
#> GSM617592     4  0.2586     0.7078 0.048 0.040 0.000 0.912
#> GSM617607     2  0.7540    -0.0915 0.364 0.444 0.192 0.000
#> GSM617608     3  0.7139     0.1148 0.360 0.140 0.500 0.000
#> GSM617609     3  0.2593     0.7456 0.000 0.080 0.904 0.016
#> GSM617612     1  0.7028     0.5870 0.652 0.192 0.116 0.040
#> GSM617615     4  0.6166     0.5305 0.048 0.292 0.016 0.644
#> GSM617616     1  0.5125     0.6138 0.720 0.248 0.024 0.008
#> GSM617617     2  0.6238     0.5887 0.112 0.652 0.000 0.236
#> GSM617618     1  0.7120     0.5423 0.552 0.328 0.108 0.012
#> GSM617619     3  0.6508     0.4725 0.000 0.192 0.640 0.168
#> GSM617620     4  0.2909     0.7016 0.020 0.092 0.000 0.888
#> GSM617622     4  0.5170     0.5735 0.048 0.228 0.000 0.724
#> GSM617623     1  0.6352     0.4493 0.632 0.108 0.000 0.260
#> GSM617624     2  0.7759     0.5170 0.056 0.596 0.152 0.196
#> GSM617625     3  0.5271     0.6506 0.180 0.068 0.748 0.004
#> GSM617626     1  0.5226     0.5815 0.756 0.128 0.000 0.116
#> GSM617627     2  0.6949     0.4343 0.000 0.528 0.124 0.348
#> GSM617628     3  0.5464     0.6980 0.112 0.076 0.776 0.036
#> GSM617632     1  0.5210     0.6417 0.748 0.188 0.060 0.004
#> GSM617634     2  0.6558     0.2309 0.024 0.564 0.040 0.372
#> GSM617635     2  0.6473     0.2803 0.280 0.612 0.108 0.000
#> GSM617636     1  0.8001     0.2320 0.408 0.228 0.356 0.008
#> GSM617637     1  0.5105     0.2474 0.564 0.432 0.000 0.004
#> GSM617638     2  0.6816     0.5179 0.020 0.648 0.124 0.208
#> GSM617639     1  0.5442     0.4317 0.636 0.336 0.028 0.000
#> GSM617640     2  0.5407     0.5854 0.036 0.668 0.000 0.296
#> GSM617641     4  0.2089     0.7190 0.020 0.048 0.000 0.932
#> GSM617643     2  0.4999     0.5425 0.012 0.660 0.000 0.328
#> GSM617644     4  0.5349     0.3820 0.024 0.336 0.000 0.640
#> GSM617647     2  0.6475     0.5884 0.184 0.644 0.000 0.172
#> GSM617648     2  0.5388     0.2138 0.012 0.532 0.000 0.456
#> GSM617649     2  0.6263     0.5210 0.004 0.604 0.064 0.328
#> GSM617650     1  0.6214     0.0527 0.476 0.052 0.472 0.000
#> GSM617651     1  0.3577     0.6357 0.832 0.156 0.012 0.000
#> GSM617653     1  0.2287     0.6576 0.924 0.060 0.004 0.012
#> GSM617654     2  0.5416     0.6214 0.112 0.740 0.000 0.148
#> GSM617583     3  0.4627     0.7250 0.104 0.024 0.820 0.052
#> GSM617584     4  0.6052     0.4069 0.284 0.076 0.000 0.640
#> GSM617585     4  0.4998     0.6024 0.004 0.088 0.128 0.780
#> GSM617586     3  0.1878     0.7588 0.008 0.008 0.944 0.040
#> GSM617587     3  0.2483     0.7533 0.012 0.056 0.920 0.012
#> GSM617589     4  0.5672     0.6018 0.100 0.188 0.000 0.712
#> GSM617591     4  0.7017     0.4113 0.020 0.112 0.256 0.612
#> GSM617593     1  0.5096     0.6481 0.760 0.084 0.156 0.000
#> GSM617594     2  0.6619     0.5787 0.068 0.652 0.032 0.248
#> GSM617595     1  0.4053     0.5810 0.768 0.228 0.004 0.000
#> GSM617596     1  0.4866     0.6493 0.784 0.160 0.044 0.012
#> GSM617597     3  0.2714     0.7271 0.112 0.004 0.884 0.000
#> GSM617598     1  0.3870     0.6664 0.852 0.064 0.080 0.004
#> GSM617599     2  0.6568     0.4223 0.096 0.572 0.000 0.332
#> GSM617600     3  0.1284     0.7562 0.000 0.024 0.964 0.012
#> GSM617601     4  0.4720     0.4729 0.000 0.264 0.016 0.720
#> GSM617602     3  0.4626     0.7169 0.064 0.072 0.828 0.036
#> GSM617603     4  0.2593     0.7141 0.004 0.104 0.000 0.892
#> GSM617604     1  0.7713     0.0372 0.444 0.084 0.428 0.044
#> GSM617605     4  0.2353     0.7189 0.012 0.056 0.008 0.924
#> GSM617606     4  0.6054     0.6377 0.048 0.192 0.044 0.716
#> GSM617610     1  0.4012     0.6112 0.800 0.184 0.000 0.016
#> GSM617611     1  0.7351     0.4249 0.544 0.156 0.292 0.008
#> GSM617613     3  0.2589     0.7507 0.000 0.044 0.912 0.044
#> GSM617614     3  0.2924     0.7311 0.100 0.016 0.884 0.000
#> GSM617621     1  0.4342     0.6564 0.820 0.128 0.044 0.008
#> GSM617629     3  0.7511     0.5344 0.040 0.212 0.604 0.144
#> GSM617630     3  0.6564     0.1924 0.000 0.380 0.536 0.084
#> GSM617631     3  0.3744     0.7426 0.028 0.048 0.872 0.052
#> GSM617633     3  0.6346     0.5327 0.116 0.244 0.640 0.000
#> GSM617642     3  0.3694     0.7195 0.124 0.000 0.844 0.032
#> GSM617645     2  0.5393     0.6047 0.044 0.688 0.000 0.268
#> GSM617646     2  0.5920     0.2679 0.336 0.612 0.052 0.000
#> GSM617652     3  0.4332     0.6903 0.112 0.072 0.816 0.000
#> GSM617655     3  0.1854     0.7557 0.000 0.012 0.940 0.048
#> GSM617656     3  0.0564     0.7549 0.004 0.004 0.988 0.004
#> GSM617657     3  0.6100     0.5825 0.004 0.100 0.680 0.216
#> GSM617658     3  0.6120     0.6218 0.168 0.080 0.720 0.032
#> GSM617659     3  0.5126     0.1319 0.444 0.004 0.552 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
#> GSM617581     1  0.5689    0.18893 0.556 0.008 0.000 0.368 0.068
#> GSM617582     5  0.7246    0.18948 0.300 0.008 0.040 0.156 0.496
#> GSM617588     4  0.3830    0.62100 0.016 0.124 0.000 0.820 0.040
#> GSM617590     4  0.2900    0.61291 0.000 0.040 0.012 0.884 0.064
#> GSM617592     4  0.3914    0.59968 0.076 0.056 0.000 0.832 0.036
#> GSM617607     2  0.6755    0.37577 0.272 0.564 0.080 0.000 0.084
#> GSM617608     3  0.7473    0.31833 0.220 0.052 0.484 0.004 0.240
#> GSM617609     3  0.3166    0.67018 0.000 0.112 0.856 0.012 0.020
#> GSM617612     1  0.8652    0.26771 0.456 0.136 0.176 0.048 0.184
#> GSM617615     4  0.8293    0.18137 0.008 0.256 0.092 0.348 0.296
#> GSM617616     1  0.5828    0.25655 0.552 0.064 0.000 0.016 0.368
#> GSM617617     2  0.4750    0.66639 0.060 0.776 0.000 0.112 0.052
#> GSM617618     5  0.5820    0.04470 0.312 0.036 0.012 0.028 0.612
#> GSM617619     3  0.5979    0.52124 0.000 0.168 0.676 0.080 0.076
#> GSM617620     4  0.3257    0.62922 0.024 0.112 0.000 0.852 0.012
#> GSM617622     4  0.5917    0.46409 0.056 0.104 0.000 0.680 0.160
#> GSM617623     1  0.5848    0.20549 0.560 0.012 0.000 0.352 0.076
#> GSM617624     2  0.5199    0.65440 0.004 0.748 0.060 0.056 0.132
#> GSM617625     3  0.5135    0.55003 0.064 0.000 0.660 0.004 0.272
#> GSM617626     1  0.4522    0.48049 0.788 0.056 0.000 0.116 0.040
#> GSM617627     2  0.5060    0.62004 0.000 0.744 0.104 0.124 0.028
#> GSM617628     3  0.4565    0.60699 0.016 0.000 0.720 0.024 0.240
#> GSM617632     1  0.5473    0.27543 0.620 0.016 0.012 0.028 0.324
#> GSM617634     5  0.7554    0.01211 0.024 0.240 0.016 0.280 0.440
#> GSM617635     2  0.4915    0.63811 0.132 0.756 0.080 0.000 0.032
#> GSM617636     1  0.6781   -0.00879 0.472 0.020 0.068 0.032 0.408
#> GSM617637     2  0.5299    0.14196 0.436 0.520 0.004 0.000 0.040
#> GSM617638     2  0.5502    0.63616 0.016 0.716 0.032 0.056 0.180
#> GSM617639     1  0.5098    0.15942 0.564 0.404 0.020 0.000 0.012
#> GSM617640     2  0.2859    0.69329 0.016 0.876 0.000 0.096 0.012
#> GSM617641     4  0.2784    0.62916 0.028 0.072 0.000 0.888 0.012
#> GSM617643     2  0.3464    0.67447 0.008 0.848 0.008 0.108 0.028
#> GSM617644     4  0.6901    0.30227 0.008 0.320 0.000 0.428 0.244
#> GSM617647     2  0.3130    0.69491 0.096 0.856 0.000 0.048 0.000
#> GSM617648     4  0.7362    0.08202 0.032 0.364 0.000 0.372 0.232
#> GSM617649     2  0.3623    0.68861 0.000 0.848 0.052 0.072 0.028
#> GSM617650     3  0.5899    0.15847 0.404 0.052 0.520 0.000 0.024
#> GSM617651     1  0.5362    0.45556 0.672 0.080 0.012 0.000 0.236
#> GSM617653     1  0.2388    0.52245 0.904 0.004 0.004 0.012 0.076
#> GSM617654     2  0.2438    0.70996 0.040 0.908 0.000 0.008 0.044
#> GSM617583     3  0.4465    0.64770 0.052 0.004 0.780 0.016 0.148
#> GSM617584     4  0.5816    0.32739 0.304 0.056 0.000 0.608 0.032
#> GSM617585     4  0.5502    0.44532 0.008 0.024 0.104 0.716 0.148
#> GSM617586     3  0.1893    0.69019 0.000 0.028 0.936 0.012 0.024
#> GSM617587     3  0.2532    0.68038 0.000 0.088 0.892 0.012 0.008
#> GSM617589     5  0.5914   -0.35483 0.036 0.036 0.000 0.456 0.472
#> GSM617591     3  0.7434    0.27471 0.000 0.128 0.496 0.276 0.100
#> GSM617593     1  0.4180    0.51089 0.804 0.076 0.104 0.000 0.016
#> GSM617594     2  0.4031    0.68808 0.008 0.836 0.048 0.060 0.048
#> GSM617595     1  0.6382    0.41929 0.608 0.228 0.040 0.000 0.124
#> GSM617596     1  0.5323    0.36137 0.688 0.012 0.008 0.060 0.232
#> GSM617597     3  0.2568    0.67563 0.092 0.016 0.888 0.000 0.004
#> GSM617598     1  0.4019    0.50812 0.820 0.004 0.072 0.012 0.092
#> GSM617599     2  0.6862    0.49893 0.116 0.604 0.000 0.148 0.132
#> GSM617600     3  0.1934    0.68156 0.000 0.020 0.932 0.008 0.040
#> GSM617601     2  0.6890   -0.00799 0.000 0.456 0.064 0.396 0.084
#> GSM617602     3  0.6785    0.06413 0.056 0.000 0.508 0.092 0.344
#> GSM617603     4  0.3798    0.58503 0.000 0.064 0.000 0.808 0.128
#> GSM617604     1  0.6846    0.22212 0.576 0.000 0.060 0.152 0.212
#> GSM617605     4  0.2404    0.61180 0.016 0.024 0.004 0.916 0.040
#> GSM617606     4  0.6850    0.34481 0.008 0.064 0.068 0.524 0.336
#> GSM617610     1  0.5486    0.47372 0.696 0.104 0.024 0.000 0.176
#> GSM617611     3  0.8447   -0.02354 0.304 0.168 0.344 0.004 0.180
#> GSM617613     3  0.2492    0.67535 0.000 0.020 0.908 0.024 0.048
#> GSM617614     3  0.3413    0.64929 0.100 0.000 0.844 0.004 0.052
#> GSM617621     1  0.4448    0.49168 0.808 0.044 0.008 0.052 0.088
#> GSM617629     5  0.8119    0.32540 0.048 0.040 0.224 0.232 0.456
#> GSM617630     2  0.6880    0.26636 0.004 0.512 0.336 0.048 0.100
#> GSM617631     3  0.4286    0.57997 0.024 0.000 0.784 0.036 0.156
#> GSM617633     3  0.8131   -0.14080 0.164 0.144 0.368 0.000 0.324
#> GSM617642     3  0.2907    0.67000 0.096 0.004 0.876 0.008 0.016
#> GSM617645     2  0.2187    0.70671 0.004 0.920 0.008 0.056 0.012
#> GSM617646     2  0.4293    0.64046 0.156 0.784 0.032 0.000 0.028
#> GSM617652     3  0.3496    0.65888 0.040 0.124 0.832 0.000 0.004
#> GSM617655     3  0.2006    0.68599 0.000 0.020 0.932 0.024 0.024
#> GSM617656     3  0.0609    0.68522 0.000 0.000 0.980 0.000 0.020
#> GSM617657     3  0.6217    0.40409 0.000 0.028 0.620 0.140 0.212
#> GSM617658     5  0.8133    0.17078 0.272 0.000 0.284 0.100 0.344
#> GSM617659     1  0.5096    0.04996 0.520 0.000 0.444 0.000 0.036

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>           class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM617581     1  0.4961     0.2043 0.560 0.008 0.000 0.388 0.036 0.008
#> GSM617582     5  0.3573     0.5993 0.036 0.000 0.004 0.044 0.832 0.084
#> GSM617588     4  0.4046     0.5260 0.012 0.048 0.000 0.808 0.048 0.084
#> GSM617590     4  0.3410     0.5389 0.000 0.024 0.012 0.848 0.068 0.048
#> GSM617592     4  0.2044     0.5757 0.068 0.008 0.000 0.912 0.008 0.004
#> GSM617607     2  0.5827     0.5146 0.216 0.632 0.092 0.000 0.044 0.016
#> GSM617608     3  0.6379     0.3534 0.156 0.004 0.472 0.000 0.032 0.336
#> GSM617609     3  0.2266     0.6855 0.000 0.108 0.880 0.012 0.000 0.000
#> GSM617612     1  0.6692     0.1902 0.496 0.048 0.324 0.032 0.000 0.100
#> GSM617615     6  0.7188     0.3497 0.000 0.140 0.164 0.268 0.000 0.428
#> GSM617616     5  0.6650     0.3937 0.152 0.060 0.000 0.004 0.480 0.304
#> GSM617617     2  0.3650     0.6356 0.020 0.820 0.000 0.012 0.116 0.032
#> GSM617618     5  0.4248     0.6097 0.048 0.044 0.000 0.000 0.768 0.140
#> GSM617619     3  0.6445     0.3804 0.000 0.204 0.596 0.084 0.088 0.028
#> GSM617620     4  0.3005     0.5682 0.036 0.088 0.000 0.860 0.004 0.012
#> GSM617622     4  0.5979     0.4381 0.036 0.068 0.000 0.624 0.228 0.044
#> GSM617623     1  0.4900     0.2952 0.604 0.012 0.000 0.344 0.028 0.012
#> GSM617624     2  0.4642     0.6327 0.008 0.756 0.048 0.028 0.148 0.012
#> GSM617625     3  0.4428     0.6067 0.052 0.000 0.676 0.000 0.004 0.268
#> GSM617626     1  0.5844     0.5020 0.684 0.100 0.000 0.104 0.064 0.048
#> GSM617627     2  0.5155     0.5337 0.000 0.680 0.184 0.112 0.008 0.016
#> GSM617628     3  0.4520     0.5729 0.020 0.000 0.664 0.020 0.004 0.292
#> GSM617632     5  0.4963     0.3829 0.352 0.036 0.000 0.008 0.592 0.012
#> GSM617634     5  0.4650     0.5148 0.004 0.112 0.000 0.016 0.732 0.136
#> GSM617635     2  0.4432     0.6562 0.072 0.780 0.096 0.000 0.016 0.036
#> GSM617636     5  0.4318     0.6043 0.180 0.028 0.020 0.004 0.756 0.012
#> GSM617637     2  0.5853     0.2447 0.364 0.504 0.000 0.000 0.028 0.104
#> GSM617638     2  0.5204     0.5806 0.016 0.696 0.020 0.036 0.208 0.024
#> GSM617639     1  0.4747     0.1063 0.564 0.400 0.020 0.004 0.004 0.008
#> GSM617640     2  0.1750     0.6815 0.000 0.928 0.004 0.056 0.008 0.004
#> GSM617641     4  0.2082     0.5836 0.040 0.036 0.000 0.916 0.004 0.004
#> GSM617643     2  0.3648     0.6524 0.000 0.832 0.008 0.040 0.044 0.076
#> GSM617644     6  0.7255     0.2043 0.004 0.220 0.000 0.128 0.200 0.448
#> GSM617647     2  0.4085     0.6612 0.112 0.792 0.000 0.068 0.012 0.016
#> GSM617648     5  0.6717     0.1154 0.004 0.324 0.000 0.044 0.436 0.192
#> GSM617649     2  0.4467     0.6451 0.000 0.788 0.064 0.068 0.028 0.052
#> GSM617650     3  0.5548     0.4264 0.296 0.020 0.604 0.000 0.024 0.056
#> GSM617651     1  0.5122     0.3640 0.516 0.044 0.012 0.000 0.004 0.424
#> GSM617653     1  0.2521     0.5731 0.896 0.000 0.012 0.056 0.008 0.028
#> GSM617654     2  0.2195     0.6883 0.024 0.920 0.008 0.016 0.028 0.004
#> GSM617583     3  0.3641     0.6936 0.052 0.000 0.812 0.012 0.004 0.120
#> GSM617584     4  0.4105     0.3110 0.348 0.020 0.000 0.632 0.000 0.000
#> GSM617585     4  0.6004     0.1523 0.000 0.016 0.024 0.484 0.396 0.080
#> GSM617586     3  0.1699     0.7102 0.000 0.032 0.936 0.016 0.000 0.016
#> GSM617587     3  0.2597     0.6922 0.004 0.088 0.880 0.020 0.000 0.008
#> GSM617589     6  0.4000     0.3750 0.028 0.000 0.004 0.220 0.008 0.740
#> GSM617591     3  0.6013     0.2502 0.000 0.080 0.556 0.292 0.000 0.072
#> GSM617593     1  0.3832     0.5583 0.824 0.056 0.072 0.000 0.032 0.016
#> GSM617594     2  0.5227     0.6228 0.004 0.728 0.108 0.060 0.016 0.084
#> GSM617595     1  0.6745     0.2497 0.420 0.244 0.028 0.000 0.008 0.300
#> GSM617596     1  0.5124     0.4035 0.660 0.004 0.008 0.080 0.240 0.008
#> GSM617597     3  0.2609     0.7093 0.112 0.008 0.868 0.000 0.008 0.004
#> GSM617598     1  0.5159     0.4905 0.624 0.000 0.032 0.000 0.056 0.288
#> GSM617599     2  0.6942     0.0405 0.020 0.420 0.000 0.028 0.236 0.296
#> GSM617600     3  0.2429     0.7029 0.000 0.008 0.888 0.008 0.088 0.008
#> GSM617601     4  0.6845    -0.1318 0.000 0.352 0.088 0.440 0.008 0.112
#> GSM617602     5  0.4009     0.5046 0.032 0.000 0.196 0.008 0.756 0.008
#> GSM617603     4  0.6549     0.1141 0.004 0.048 0.000 0.480 0.312 0.156
#> GSM617604     1  0.5867     0.4259 0.584 0.000 0.020 0.216 0.176 0.004
#> GSM617605     4  0.2025     0.5805 0.004 0.004 0.004 0.920 0.052 0.016
#> GSM617606     6  0.7698     0.2757 0.004 0.048 0.080 0.340 0.140 0.388
#> GSM617610     1  0.4866     0.4872 0.664 0.064 0.012 0.000 0.004 0.256
#> GSM617611     3  0.6471     0.4255 0.224 0.068 0.548 0.004 0.000 0.156
#> GSM617613     3  0.3019     0.6752 0.000 0.012 0.840 0.020 0.128 0.000
#> GSM617614     3  0.4090     0.6743 0.120 0.000 0.784 0.008 0.076 0.012
#> GSM617621     1  0.3310     0.5531 0.824 0.016 0.000 0.132 0.028 0.000
#> GSM617629     5  0.1854     0.6140 0.004 0.020 0.020 0.008 0.936 0.012
#> GSM617630     2  0.6935     0.1691 0.008 0.444 0.380 0.068 0.068 0.032
#> GSM617631     3  0.4667     0.3567 0.016 0.000 0.584 0.016 0.380 0.004
#> GSM617633     5  0.5168     0.5936 0.040 0.132 0.044 0.000 0.728 0.056
#> GSM617642     3  0.2891     0.7082 0.096 0.000 0.864 0.024 0.008 0.008
#> GSM617645     2  0.3832     0.6361 0.020 0.808 0.044 0.120 0.004 0.004
#> GSM617646     2  0.4300     0.6715 0.104 0.788 0.036 0.000 0.016 0.056
#> GSM617652     3  0.2393     0.7006 0.020 0.092 0.884 0.004 0.000 0.000
#> GSM617655     3  0.1629     0.7131 0.000 0.012 0.944 0.020 0.012 0.012
#> GSM617656     3  0.0858     0.7149 0.000 0.004 0.968 0.000 0.028 0.000
#> GSM617657     3  0.6121     0.1053 0.000 0.012 0.448 0.108 0.412 0.020
#> GSM617658     5  0.5721     0.4971 0.140 0.000 0.148 0.044 0.656 0.012
#> GSM617659     1  0.5422    -0.0920 0.464 0.000 0.456 0.000 0.044 0.036

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

consensus_heatmap(res, k = 2)

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

consensus_heatmap(res, k = 3)

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

consensus_heatmap(res, k = 4)

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

consensus_heatmap(res, k = 5)

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

consensus_heatmap(res, k = 6)

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

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

membership_heatmap(res, k = 2)

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

membership_heatmap(res, k = 3)

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

membership_heatmap(res, k = 4)

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

membership_heatmap(res, k = 5)

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

membership_heatmap(res, k = 6)

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

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

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

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

get_signatures(res, k = 3)

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

get_signatures(res, k = 4)

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

get_signatures(res, k = 5)

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

get_signatures(res, k = 6)

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

Signature heatmaps where rows are not scaled:

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

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

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

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

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

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

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

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

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

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

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk SD-NMF-signature_compare

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

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

An example of the output of tb is:

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

The columns in tb are:

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

UMAP plot which shows how samples are separated.

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

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

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

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

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

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

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

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

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

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

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk SD-NMF-collect-classes

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

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

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

collect_plots(res)

plot of chunk CV-hclust-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.233           0.703       0.832          0.226 0.926   0.926
#> 3 3 0.193           0.642       0.807          0.709 0.786   0.769
#> 4 4 0.320           0.630       0.821          0.247 0.895   0.853
#> 5 5 0.291           0.506       0.754          0.155 0.841   0.749
#> 6 6 0.295           0.612       0.768          0.121 0.847   0.706

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

suggest_best_k(res)
#> [1] 4

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

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

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>           class entropy silhouette    p1    p2
#> GSM617581     1  0.2603      0.799 0.956 0.044
#> GSM617582     1  0.2603      0.790 0.956 0.044
#> GSM617588     1  0.8267      0.621 0.740 0.260
#> GSM617590     1  0.8267      0.621 0.740 0.260
#> GSM617592     1  0.8207      0.628 0.744 0.256
#> GSM617607     1  0.0938      0.797 0.988 0.012
#> GSM617608     1  0.2236      0.789 0.964 0.036
#> GSM617609     1  0.7056      0.598 0.808 0.192
#> GSM617612     1  0.1184      0.794 0.984 0.016
#> GSM617615     1  0.6531      0.739 0.832 0.168
#> GSM617616     1  0.1184      0.796 0.984 0.016
#> GSM617617     1  0.6623      0.736 0.828 0.172
#> GSM617618     1  0.1184      0.796 0.984 0.016
#> GSM617619     1  0.7299      0.652 0.796 0.204
#> GSM617620     1  0.8016      0.650 0.756 0.244
#> GSM617622     1  0.6247      0.743 0.844 0.156
#> GSM617623     1  0.1414      0.795 0.980 0.020
#> GSM617624     1  0.5946      0.765 0.856 0.144
#> GSM617625     1  0.5737      0.704 0.864 0.136
#> GSM617626     1  0.2236      0.799 0.964 0.036
#> GSM617627     1  0.6438      0.744 0.836 0.164
#> GSM617628     1  0.5842      0.700 0.860 0.140
#> GSM617632     1  0.0672      0.795 0.992 0.008
#> GSM617634     1  0.7376      0.645 0.792 0.208
#> GSM617635     1  0.1843      0.797 0.972 0.028
#> GSM617636     1  0.0672      0.794 0.992 0.008
#> GSM617637     1  0.1414      0.798 0.980 0.020
#> GSM617638     1  0.7376      0.675 0.792 0.208
#> GSM617639     1  0.1414      0.793 0.980 0.020
#> GSM617640     1  0.7056      0.710 0.808 0.192
#> GSM617641     1  0.8327      0.618 0.736 0.264
#> GSM617643     1  0.6623      0.726 0.828 0.172
#> GSM617644     1  0.8144      0.634 0.748 0.252
#> GSM617647     1  0.5629      0.762 0.868 0.132
#> GSM617648     1  0.6438      0.740 0.836 0.164
#> GSM617649     1  0.6438      0.741 0.836 0.164
#> GSM617650     1  0.1843      0.794 0.972 0.028
#> GSM617651     1  0.0672      0.796 0.992 0.008
#> GSM617653     1  0.0672      0.796 0.992 0.008
#> GSM617654     1  0.8861      0.517 0.696 0.304
#> GSM617583     1  0.3274      0.780 0.940 0.060
#> GSM617584     1  0.6973      0.710 0.812 0.188
#> GSM617585     2  0.9993      0.496 0.484 0.516
#> GSM617586     1  0.7376      0.557 0.792 0.208
#> GSM617587     1  0.7219      0.577 0.800 0.200
#> GSM617589     1  0.8267      0.621 0.740 0.260
#> GSM617591     1  0.7453      0.656 0.788 0.212
#> GSM617593     1  0.2236      0.789 0.964 0.036
#> GSM617594     1  0.5629      0.762 0.868 0.132
#> GSM617595     1  0.0938      0.797 0.988 0.012
#> GSM617596     1  0.0672      0.796 0.992 0.008
#> GSM617597     1  0.4815      0.737 0.896 0.104
#> GSM617598     1  0.0938      0.794 0.988 0.012
#> GSM617599     1  0.5408      0.768 0.876 0.124
#> GSM617600     1  0.7056      0.605 0.808 0.192
#> GSM617601     1  0.7299      0.704 0.796 0.204
#> GSM617602     1  0.5178      0.730 0.884 0.116
#> GSM617603     1  0.8267      0.622 0.740 0.260
#> GSM617604     1  0.2948      0.795 0.948 0.052
#> GSM617605     1  0.8327      0.615 0.736 0.264
#> GSM617606     1  0.6623      0.748 0.828 0.172
#> GSM617610     1  0.1184      0.794 0.984 0.016
#> GSM617611     1  0.2603      0.788 0.956 0.044
#> GSM617613     1  0.9963     -0.558 0.536 0.464
#> GSM617614     1  0.4161      0.766 0.916 0.084
#> GSM617621     1  0.2043      0.799 0.968 0.032
#> GSM617629     2  0.9393      0.808 0.356 0.644
#> GSM617630     1  0.8443      0.573 0.728 0.272
#> GSM617631     1  0.5519      0.719 0.872 0.128
#> GSM617633     1  0.3274      0.785 0.940 0.060
#> GSM617642     1  0.6148      0.679 0.848 0.152
#> GSM617645     1  0.8861      0.512 0.696 0.304
#> GSM617646     1  0.1633      0.798 0.976 0.024
#> GSM617652     1  0.1843      0.792 0.972 0.028
#> GSM617655     1  0.7453      0.549 0.788 0.212
#> GSM617656     1  0.7139      0.597 0.804 0.196
#> GSM617657     2  0.9248      0.805 0.340 0.660
#> GSM617658     1  0.4939      0.738 0.892 0.108
#> GSM617659     1  0.3274      0.776 0.940 0.060

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>           class entropy silhouette    p1    p2    p3
#> GSM617581     1  0.2599      0.779 0.932 0.052 0.016
#> GSM617582     1  0.1999      0.781 0.952 0.012 0.036
#> GSM617588     2  0.4121      0.807 0.168 0.832 0.000
#> GSM617590     2  0.4409      0.809 0.172 0.824 0.004
#> GSM617592     2  0.4629      0.803 0.188 0.808 0.004
#> GSM617607     1  0.1182      0.781 0.976 0.012 0.012
#> GSM617608     1  0.1832      0.781 0.956 0.008 0.036
#> GSM617609     1  0.5253      0.663 0.792 0.020 0.188
#> GSM617612     1  0.1170      0.780 0.976 0.008 0.016
#> GSM617615     1  0.7074     -0.216 0.500 0.480 0.020
#> GSM617616     1  0.1636      0.782 0.964 0.020 0.016
#> GSM617617     1  0.7031      0.580 0.716 0.196 0.088
#> GSM617618     1  0.1636      0.782 0.964 0.020 0.016
#> GSM617619     1  0.6920      0.622 0.732 0.104 0.164
#> GSM617620     2  0.6587      0.568 0.352 0.632 0.016
#> GSM617622     1  0.6908      0.424 0.656 0.308 0.036
#> GSM617623     1  0.2301      0.775 0.936 0.060 0.004
#> GSM617624     1  0.6481      0.600 0.728 0.224 0.048
#> GSM617625     1  0.4059      0.739 0.860 0.012 0.128
#> GSM617626     1  0.2031      0.784 0.952 0.032 0.016
#> GSM617627     1  0.6872      0.487 0.680 0.276 0.044
#> GSM617628     1  0.3784      0.733 0.864 0.004 0.132
#> GSM617632     1  0.1315      0.780 0.972 0.020 0.008
#> GSM617634     1  0.6875      0.621 0.724 0.080 0.196
#> GSM617635     1  0.1129      0.783 0.976 0.004 0.020
#> GSM617636     1  0.0475      0.780 0.992 0.004 0.004
#> GSM617637     1  0.1905      0.783 0.956 0.028 0.016
#> GSM617638     1  0.6886      0.609 0.728 0.088 0.184
#> GSM617639     1  0.0983      0.780 0.980 0.004 0.016
#> GSM617640     1  0.7844      0.438 0.652 0.240 0.108
#> GSM617641     2  0.4645      0.806 0.176 0.816 0.008
#> GSM617643     1  0.6702      0.381 0.648 0.328 0.024
#> GSM617644     2  0.6404      0.595 0.344 0.644 0.012
#> GSM617647     1  0.6099      0.595 0.740 0.228 0.032
#> GSM617648     1  0.6387      0.456 0.680 0.300 0.020
#> GSM617649     1  0.6420      0.479 0.688 0.288 0.024
#> GSM617650     1  0.0892      0.782 0.980 0.000 0.020
#> GSM617651     1  0.1315      0.780 0.972 0.020 0.008
#> GSM617653     1  0.1453      0.780 0.968 0.024 0.008
#> GSM617654     1  0.8868      0.123 0.576 0.196 0.228
#> GSM617583     1  0.2280      0.780 0.940 0.008 0.052
#> GSM617584     2  0.6521      0.276 0.492 0.504 0.004
#> GSM617585     3  0.9738      0.306 0.344 0.232 0.424
#> GSM617586     1  0.5171      0.641 0.784 0.012 0.204
#> GSM617587     1  0.5253      0.657 0.792 0.020 0.188
#> GSM617589     2  0.4121      0.806 0.168 0.832 0.000
#> GSM617591     1  0.7670      0.561 0.684 0.152 0.164
#> GSM617593     1  0.1525      0.779 0.964 0.004 0.032
#> GSM617594     1  0.5982      0.588 0.744 0.228 0.028
#> GSM617595     1  0.1129      0.782 0.976 0.020 0.004
#> GSM617596     1  0.1170      0.781 0.976 0.016 0.008
#> GSM617597     1  0.3532      0.754 0.884 0.008 0.108
#> GSM617598     1  0.1182      0.781 0.976 0.012 0.012
#> GSM617599     1  0.6067      0.594 0.736 0.236 0.028
#> GSM617600     1  0.4808      0.673 0.804 0.008 0.188
#> GSM617601     1  0.7310      0.254 0.600 0.360 0.040
#> GSM617602     1  0.3573      0.743 0.876 0.004 0.120
#> GSM617603     2  0.4589      0.805 0.172 0.820 0.008
#> GSM617604     1  0.2550      0.783 0.936 0.024 0.040
#> GSM617605     2  0.4531      0.804 0.168 0.824 0.008
#> GSM617606     1  0.8286      0.313 0.588 0.308 0.104
#> GSM617610     1  0.1170      0.780 0.976 0.008 0.016
#> GSM617611     1  0.1832      0.783 0.956 0.008 0.036
#> GSM617613     1  0.6816     -0.247 0.516 0.012 0.472
#> GSM617614     1  0.2682      0.768 0.920 0.004 0.076
#> GSM617621     1  0.1877      0.783 0.956 0.032 0.012
#> GSM617629     3  0.5098      0.730 0.248 0.000 0.752
#> GSM617630     1  0.8557      0.207 0.608 0.180 0.212
#> GSM617631     1  0.3965      0.734 0.860 0.008 0.132
#> GSM617633     1  0.2301      0.775 0.936 0.004 0.060
#> GSM617642     1  0.4411      0.716 0.844 0.016 0.140
#> GSM617645     1  0.8940      0.113 0.568 0.200 0.232
#> GSM617646     1  0.1774      0.784 0.960 0.024 0.016
#> GSM617652     1  0.1751      0.782 0.960 0.012 0.028
#> GSM617655     1  0.5503      0.633 0.772 0.020 0.208
#> GSM617656     1  0.4861      0.668 0.800 0.008 0.192
#> GSM617657     3  0.5986      0.734 0.240 0.024 0.736
#> GSM617658     1  0.3607      0.751 0.880 0.008 0.112
#> GSM617659     1  0.1860      0.775 0.948 0.000 0.052

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM617581     1  0.3303     0.7859 0.892 0.028 0.048 0.032
#> GSM617582     1  0.2140     0.7950 0.932 0.008 0.052 0.008
#> GSM617588     4  0.0469     0.6934 0.012 0.000 0.000 0.988
#> GSM617590     4  0.0524     0.6876 0.004 0.000 0.008 0.988
#> GSM617592     4  0.1042     0.6909 0.020 0.000 0.008 0.972
#> GSM617607     1  0.1182     0.7912 0.968 0.016 0.016 0.000
#> GSM617608     1  0.1356     0.7923 0.960 0.008 0.032 0.000
#> GSM617609     1  0.4612     0.6645 0.764 0.008 0.212 0.016
#> GSM617612     1  0.0804     0.7907 0.980 0.008 0.012 0.000
#> GSM617615     4  0.7289     0.0373 0.432 0.080 0.024 0.464
#> GSM617616     1  0.1871     0.7932 0.948 0.016 0.024 0.012
#> GSM617617     1  0.7072     0.3947 0.596 0.284 0.024 0.096
#> GSM617618     1  0.1993     0.7935 0.944 0.016 0.024 0.016
#> GSM617619     1  0.7323     0.4961 0.640 0.080 0.196 0.084
#> GSM617620     4  0.5628     0.4311 0.236 0.052 0.008 0.704
#> GSM617622     1  0.7296     0.4267 0.600 0.072 0.056 0.272
#> GSM617623     1  0.3027     0.7809 0.904 0.024 0.032 0.040
#> GSM617624     1  0.6764     0.5831 0.688 0.108 0.052 0.152
#> GSM617625     1  0.3196     0.7517 0.856 0.000 0.136 0.008
#> GSM617626     1  0.2495     0.7937 0.924 0.028 0.036 0.012
#> GSM617627     1  0.7196     0.4566 0.612 0.120 0.028 0.240
#> GSM617628     1  0.3052     0.7490 0.860 0.000 0.136 0.004
#> GSM617632     1  0.1593     0.7903 0.956 0.016 0.024 0.004
#> GSM617634     1  0.6494     0.5688 0.680 0.072 0.212 0.036
#> GSM617635     1  0.1724     0.7960 0.948 0.020 0.032 0.000
#> GSM617636     1  0.1388     0.7931 0.960 0.012 0.028 0.000
#> GSM617637     1  0.1911     0.7935 0.944 0.032 0.020 0.004
#> GSM617638     1  0.6964     0.4998 0.656 0.144 0.168 0.032
#> GSM617639     1  0.1284     0.7915 0.964 0.012 0.024 0.000
#> GSM617640     1  0.8235    -0.2111 0.416 0.364 0.024 0.196
#> GSM617641     4  0.1007     0.6888 0.008 0.008 0.008 0.976
#> GSM617643     1  0.7008     0.3847 0.580 0.080 0.024 0.316
#> GSM617644     4  0.5843     0.4616 0.200 0.068 0.016 0.716
#> GSM617647     1  0.6474     0.5858 0.696 0.104 0.032 0.168
#> GSM617648     1  0.6680     0.4857 0.640 0.080 0.024 0.256
#> GSM617649     1  0.6831     0.4894 0.640 0.076 0.036 0.248
#> GSM617650     1  0.1109     0.7930 0.968 0.004 0.028 0.000
#> GSM617651     1  0.1707     0.7881 0.952 0.020 0.024 0.004
#> GSM617653     1  0.1920     0.7876 0.944 0.028 0.024 0.004
#> GSM617654     2  0.2466     0.7495 0.096 0.900 0.000 0.004
#> GSM617583     1  0.1930     0.7920 0.936 0.004 0.056 0.004
#> GSM617584     4  0.6580     0.1066 0.424 0.040 0.020 0.516
#> GSM617585     3  0.7843     0.3056 0.220 0.008 0.472 0.300
#> GSM617586     1  0.4479     0.6481 0.760 0.008 0.224 0.008
#> GSM617587     1  0.4574     0.6640 0.768 0.008 0.208 0.016
#> GSM617589     4  0.1114     0.6866 0.016 0.004 0.008 0.972
#> GSM617591     1  0.8233     0.3362 0.568 0.092 0.188 0.152
#> GSM617593     1  0.1545     0.7922 0.952 0.008 0.040 0.000
#> GSM617594     1  0.6511     0.5714 0.692 0.092 0.036 0.180
#> GSM617595     1  0.1271     0.7931 0.968 0.012 0.008 0.012
#> GSM617596     1  0.1509     0.7920 0.960 0.020 0.012 0.008
#> GSM617597     1  0.2805     0.7697 0.888 0.012 0.100 0.000
#> GSM617598     1  0.0937     0.7906 0.976 0.012 0.012 0.000
#> GSM617599     1  0.6432     0.5802 0.700 0.092 0.036 0.172
#> GSM617600     1  0.4230     0.6795 0.776 0.004 0.212 0.008
#> GSM617601     1  0.7486     0.2764 0.532 0.104 0.028 0.336
#> GSM617602     1  0.2814     0.7576 0.868 0.000 0.132 0.000
#> GSM617603     4  0.0844     0.6827 0.004 0.004 0.012 0.980
#> GSM617604     1  0.2957     0.7913 0.900 0.016 0.068 0.016
#> GSM617605     4  0.0804     0.6902 0.008 0.000 0.012 0.980
#> GSM617606     1  0.8651    -0.0490 0.464 0.124 0.092 0.320
#> GSM617610     1  0.0804     0.7907 0.980 0.008 0.012 0.000
#> GSM617611     1  0.1585     0.7939 0.952 0.004 0.040 0.004
#> GSM617613     3  0.5562     0.0530 0.460 0.004 0.524 0.012
#> GSM617614     1  0.2011     0.7829 0.920 0.000 0.080 0.000
#> GSM617621     1  0.2499     0.7919 0.924 0.032 0.032 0.012
#> GSM617629     3  0.3335     0.3163 0.120 0.020 0.860 0.000
#> GSM617630     2  0.4034     0.8203 0.180 0.804 0.012 0.004
#> GSM617631     1  0.3157     0.7487 0.852 0.000 0.144 0.004
#> GSM617633     1  0.2053     0.7896 0.924 0.004 0.072 0.000
#> GSM617642     1  0.3712     0.7312 0.832 0.004 0.152 0.012
#> GSM617645     2  0.4662     0.7736 0.204 0.768 0.016 0.012
#> GSM617646     1  0.2096     0.7950 0.940 0.028 0.016 0.016
#> GSM617652     1  0.1471     0.7951 0.960 0.012 0.024 0.004
#> GSM617655     1  0.4707     0.6377 0.744 0.008 0.236 0.012
#> GSM617656     1  0.4163     0.6772 0.772 0.004 0.220 0.004
#> GSM617657     3  0.2363     0.2748 0.056 0.000 0.920 0.024
#> GSM617658     1  0.2760     0.7640 0.872 0.000 0.128 0.000
#> GSM617659     1  0.1557     0.7872 0.944 0.000 0.056 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
#> GSM617581     1  0.3374     0.6893 0.852 0.100 0.032 0.016 0.000
#> GSM617582     1  0.2054     0.7422 0.920 0.052 0.028 0.000 0.000
#> GSM617588     4  0.0510     0.6929 0.000 0.016 0.000 0.984 0.000
#> GSM617590     4  0.0771     0.6950 0.000 0.020 0.000 0.976 0.004
#> GSM617592     4  0.1365     0.6920 0.000 0.040 0.004 0.952 0.004
#> GSM617607     1  0.1618     0.7312 0.944 0.040 0.008 0.000 0.008
#> GSM617608     1  0.1630     0.7428 0.944 0.036 0.016 0.000 0.004
#> GSM617609     1  0.4960     0.5780 0.728 0.160 0.104 0.008 0.000
#> GSM617612     1  0.1124     0.7363 0.960 0.036 0.000 0.000 0.004
#> GSM617615     4  0.7314    -0.4084 0.256 0.308 0.004 0.412 0.020
#> GSM617616     1  0.1990     0.7339 0.928 0.052 0.004 0.012 0.004
#> GSM617617     2  0.7363     0.5831 0.352 0.396 0.000 0.036 0.216
#> GSM617618     1  0.2197     0.7301 0.916 0.064 0.004 0.012 0.004
#> GSM617619     1  0.7336     0.0901 0.568 0.236 0.104 0.044 0.048
#> GSM617620     4  0.6077     0.3868 0.124 0.216 0.004 0.636 0.020
#> GSM617622     2  0.7267     0.7692 0.372 0.416 0.024 0.180 0.008
#> GSM617623     1  0.3940     0.6449 0.812 0.140 0.020 0.024 0.004
#> GSM617624     1  0.6327    -0.5327 0.492 0.412 0.008 0.064 0.024
#> GSM617625     1  0.3384     0.6989 0.848 0.088 0.060 0.004 0.000
#> GSM617626     1  0.2452     0.7226 0.896 0.084 0.016 0.000 0.004
#> GSM617627     2  0.7094     0.7840 0.376 0.436 0.004 0.156 0.028
#> GSM617628     1  0.3169     0.6992 0.856 0.084 0.060 0.000 0.000
#> GSM617632     1  0.1990     0.7256 0.920 0.068 0.008 0.000 0.004
#> GSM617634     1  0.6837    -0.1298 0.524 0.328 0.108 0.016 0.024
#> GSM617635     1  0.1717     0.7415 0.936 0.052 0.004 0.000 0.008
#> GSM617636     1  0.1862     0.7357 0.932 0.048 0.016 0.000 0.004
#> GSM617637     1  0.2166     0.7308 0.912 0.072 0.004 0.000 0.012
#> GSM617638     1  0.7646    -0.3242 0.472 0.316 0.088 0.012 0.112
#> GSM617639     1  0.1412     0.7369 0.952 0.036 0.008 0.000 0.004
#> GSM617640     5  0.8422    -0.2437 0.272 0.224 0.000 0.168 0.336
#> GSM617641     4  0.0880     0.6931 0.000 0.032 0.000 0.968 0.000
#> GSM617643     2  0.6819     0.7690 0.316 0.476 0.004 0.196 0.008
#> GSM617644     4  0.5650     0.4318 0.076 0.288 0.004 0.624 0.008
#> GSM617647     1  0.6472    -0.4461 0.536 0.344 0.004 0.084 0.032
#> GSM617648     2  0.6582     0.8063 0.380 0.476 0.004 0.128 0.012
#> GSM617649     2  0.6796     0.7957 0.388 0.460 0.012 0.128 0.012
#> GSM617650     1  0.0992     0.7407 0.968 0.024 0.008 0.000 0.000
#> GSM617651     1  0.2102     0.7189 0.916 0.068 0.012 0.000 0.004
#> GSM617653     1  0.2332     0.7143 0.904 0.076 0.016 0.000 0.004
#> GSM617654     5  0.1173     0.3531 0.012 0.020 0.004 0.000 0.964
#> GSM617583     1  0.2005     0.7389 0.924 0.056 0.016 0.004 0.000
#> GSM617584     4  0.7168    -0.3003 0.292 0.220 0.016 0.464 0.008
#> GSM617585     3  0.8417     0.2965 0.148 0.272 0.296 0.284 0.000
#> GSM617586     1  0.4911     0.5746 0.728 0.148 0.120 0.004 0.000
#> GSM617587     1  0.4970     0.5785 0.728 0.156 0.108 0.008 0.000
#> GSM617589     4  0.0981     0.6826 0.012 0.008 0.000 0.972 0.008
#> GSM617591     1  0.8369    -0.3171 0.460 0.276 0.100 0.104 0.060
#> GSM617593     1  0.1605     0.7411 0.944 0.040 0.012 0.000 0.004
#> GSM617594     1  0.6146    -0.6175 0.484 0.412 0.000 0.092 0.012
#> GSM617595     1  0.1730     0.7338 0.940 0.044 0.004 0.008 0.004
#> GSM617596     1  0.1996     0.7301 0.932 0.040 0.016 0.008 0.004
#> GSM617597     1  0.2928     0.7199 0.872 0.092 0.032 0.000 0.004
#> GSM617598     1  0.1124     0.7333 0.960 0.036 0.000 0.000 0.004
#> GSM617599     1  0.6312    -0.5673 0.500 0.392 0.004 0.088 0.016
#> GSM617600     1  0.4565     0.6115 0.760 0.124 0.112 0.004 0.000
#> GSM617601     2  0.7023     0.7373 0.300 0.444 0.000 0.240 0.016
#> GSM617602     1  0.3051     0.7045 0.864 0.060 0.076 0.000 0.000
#> GSM617603     4  0.1285     0.6821 0.000 0.036 0.004 0.956 0.004
#> GSM617604     1  0.3340     0.7186 0.860 0.076 0.048 0.016 0.000
#> GSM617605     4  0.0865     0.6929 0.000 0.024 0.000 0.972 0.004
#> GSM617606     1  0.8538    -0.4451 0.388 0.192 0.032 0.296 0.092
#> GSM617610     1  0.1124     0.7363 0.960 0.036 0.000 0.000 0.004
#> GSM617611     1  0.1443     0.7409 0.948 0.044 0.004 0.004 0.000
#> GSM617613     1  0.6930    -0.2094 0.376 0.324 0.296 0.004 0.000
#> GSM617614     1  0.2236     0.7334 0.908 0.068 0.024 0.000 0.000
#> GSM617621     1  0.2664     0.7134 0.884 0.092 0.020 0.000 0.004
#> GSM617629     3  0.3117     0.4090 0.100 0.036 0.860 0.000 0.004
#> GSM617630     5  0.3608     0.5021 0.148 0.040 0.000 0.000 0.812
#> GSM617631     1  0.3239     0.6975 0.852 0.068 0.080 0.000 0.000
#> GSM617633     1  0.2110     0.7375 0.912 0.072 0.016 0.000 0.000
#> GSM617642     1  0.3937     0.6643 0.804 0.132 0.060 0.004 0.000
#> GSM617645     5  0.4787     0.5236 0.152 0.088 0.000 0.012 0.748
#> GSM617646     1  0.2630     0.7173 0.892 0.080 0.000 0.012 0.016
#> GSM617652     1  0.1766     0.7412 0.940 0.040 0.012 0.004 0.004
#> GSM617655     1  0.5135     0.5421 0.704 0.172 0.120 0.004 0.000
#> GSM617656     1  0.4503     0.6125 0.756 0.120 0.124 0.000 0.000
#> GSM617657     3  0.5374     0.4681 0.024 0.376 0.580 0.012 0.008
#> GSM617658     1  0.2922     0.7120 0.872 0.056 0.072 0.000 0.000
#> GSM617659     1  0.1364     0.7384 0.952 0.036 0.012 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
#> GSM617581     1  0.3564     0.7544 0.812 0.140 0.024 0.008 0.000 0.016
#> GSM617582     1  0.2307     0.8348 0.904 0.048 0.032 0.000 0.000 0.016
#> GSM617588     4  0.0777     0.7714 0.000 0.024 0.000 0.972 0.000 0.004
#> GSM617590     4  0.0858     0.7754 0.000 0.028 0.004 0.968 0.000 0.000
#> GSM617592     4  0.1440     0.7719 0.000 0.044 0.004 0.944 0.004 0.004
#> GSM617607     1  0.1995     0.8228 0.924 0.036 0.012 0.000 0.004 0.024
#> GSM617608     1  0.1719     0.8361 0.932 0.032 0.032 0.000 0.000 0.004
#> GSM617609     1  0.4676     0.6250 0.684 0.096 0.216 0.004 0.000 0.000
#> GSM617612     1  0.1483     0.8292 0.944 0.036 0.012 0.000 0.000 0.008
#> GSM617615     2  0.6931     0.1464 0.140 0.412 0.016 0.388 0.020 0.024
#> GSM617616     1  0.2299     0.8225 0.904 0.064 0.008 0.012 0.000 0.012
#> GSM617617     2  0.6393     0.4305 0.172 0.568 0.004 0.012 0.208 0.036
#> GSM617618     1  0.2392     0.8185 0.900 0.064 0.008 0.012 0.000 0.016
#> GSM617619     1  0.7038    -0.0565 0.484 0.252 0.184 0.024 0.056 0.000
#> GSM617620     4  0.4864     0.4260 0.016 0.352 0.000 0.600 0.020 0.012
#> GSM617622     2  0.6132     0.5303 0.192 0.620 0.028 0.128 0.004 0.028
#> GSM617623     1  0.4013     0.6964 0.764 0.184 0.008 0.012 0.000 0.032
#> GSM617624     2  0.5215     0.5219 0.328 0.600 0.036 0.012 0.024 0.000
#> GSM617625     1  0.3406     0.7796 0.816 0.040 0.136 0.004 0.000 0.004
#> GSM617626     1  0.2415     0.8171 0.888 0.084 0.012 0.000 0.000 0.016
#> GSM617627     2  0.5289     0.5627 0.180 0.688 0.020 0.088 0.024 0.000
#> GSM617628     1  0.3149     0.7811 0.824 0.044 0.132 0.000 0.000 0.000
#> GSM617632     1  0.2322     0.8080 0.896 0.064 0.004 0.000 0.000 0.036
#> GSM617634     2  0.7536     0.2443 0.344 0.400 0.148 0.020 0.016 0.072
#> GSM617635     1  0.1906     0.8356 0.928 0.040 0.016 0.000 0.008 0.008
#> GSM617636     1  0.1716     0.8295 0.932 0.036 0.004 0.000 0.000 0.028
#> GSM617637     1  0.2414     0.8248 0.896 0.072 0.012 0.000 0.008 0.012
#> GSM617638     2  0.8103     0.2671 0.312 0.388 0.116 0.012 0.104 0.068
#> GSM617639     1  0.1750     0.8290 0.932 0.040 0.012 0.000 0.000 0.016
#> GSM617640     2  0.7167    -0.0105 0.116 0.408 0.000 0.128 0.340 0.008
#> GSM617641     4  0.0937     0.7746 0.000 0.040 0.000 0.960 0.000 0.000
#> GSM617643     2  0.5061     0.4697 0.096 0.736 0.012 0.104 0.004 0.048
#> GSM617644     4  0.5295     0.4189 0.008 0.348 0.008 0.568 0.000 0.068
#> GSM617647     2  0.5392     0.5199 0.348 0.576 0.008 0.032 0.032 0.004
#> GSM617648     2  0.4847     0.5281 0.144 0.744 0.016 0.036 0.004 0.056
#> GSM617649     2  0.4864     0.5351 0.148 0.744 0.024 0.036 0.004 0.044
#> GSM617650     1  0.1552     0.8334 0.940 0.020 0.036 0.000 0.000 0.004
#> GSM617651     1  0.2704     0.7930 0.876 0.076 0.012 0.000 0.000 0.036
#> GSM617653     1  0.2833     0.7829 0.864 0.088 0.008 0.000 0.000 0.040
#> GSM617654     5  0.2536     0.5060 0.000 0.020 0.000 0.000 0.864 0.116
#> GSM617583     1  0.2352     0.8288 0.900 0.040 0.052 0.004 0.000 0.004
#> GSM617584     4  0.6712    -0.1372 0.192 0.344 0.008 0.428 0.008 0.020
#> GSM617585     3  0.7398     0.1808 0.100 0.128 0.460 0.276 0.000 0.036
#> GSM617586     1  0.4663     0.6139 0.672 0.080 0.244 0.000 0.000 0.004
#> GSM617587     1  0.4853     0.6069 0.664 0.108 0.224 0.000 0.000 0.004
#> GSM617589     4  0.0982     0.7596 0.004 0.020 0.004 0.968 0.004 0.000
#> GSM617591     2  0.7878     0.1759 0.324 0.352 0.188 0.076 0.060 0.000
#> GSM617593     1  0.1794     0.8341 0.932 0.024 0.028 0.000 0.000 0.016
#> GSM617594     2  0.4842     0.5702 0.284 0.656 0.012 0.036 0.008 0.004
#> GSM617595     1  0.1698     0.8305 0.936 0.044 0.008 0.004 0.004 0.004
#> GSM617596     1  0.1965     0.8250 0.924 0.040 0.008 0.004 0.000 0.024
#> GSM617597     1  0.3124     0.8096 0.844 0.032 0.108 0.000 0.000 0.016
#> GSM617598     1  0.1555     0.8261 0.940 0.040 0.012 0.000 0.000 0.008
#> GSM617599     2  0.5350     0.5440 0.332 0.592 0.020 0.040 0.012 0.004
#> GSM617600     1  0.4223     0.6747 0.720 0.076 0.204 0.000 0.000 0.000
#> GSM617601     2  0.4851     0.4830 0.100 0.708 0.008 0.172 0.012 0.000
#> GSM617602     1  0.2784     0.7954 0.848 0.028 0.124 0.000 0.000 0.000
#> GSM617603     4  0.1806     0.7543 0.000 0.044 0.008 0.928 0.000 0.020
#> GSM617604     1  0.3469     0.7880 0.828 0.112 0.036 0.004 0.000 0.020
#> GSM617605     4  0.0972     0.7722 0.000 0.028 0.008 0.964 0.000 0.000
#> GSM617606     1  0.8769    -0.5384 0.284 0.240 0.088 0.272 0.096 0.020
#> GSM617610     1  0.1483     0.8292 0.944 0.036 0.012 0.000 0.000 0.008
#> GSM617611     1  0.1860     0.8322 0.928 0.028 0.036 0.004 0.000 0.004
#> GSM617613     3  0.6427     0.1118 0.284 0.176 0.500 0.004 0.000 0.036
#> GSM617614     1  0.2294     0.8237 0.892 0.036 0.072 0.000 0.000 0.000
#> GSM617621     1  0.2615     0.8081 0.876 0.088 0.008 0.000 0.000 0.028
#> GSM617629     6  0.4062     0.0000 0.060 0.004 0.192 0.000 0.000 0.744
#> GSM617630     5  0.3281     0.6573 0.120 0.036 0.008 0.000 0.832 0.004
#> GSM617631     1  0.3054     0.7846 0.828 0.036 0.136 0.000 0.000 0.000
#> GSM617633     1  0.2138     0.8300 0.908 0.036 0.052 0.000 0.000 0.004
#> GSM617642     1  0.3991     0.7190 0.756 0.088 0.156 0.000 0.000 0.000
#> GSM617645     5  0.4341     0.6437 0.104 0.132 0.004 0.008 0.752 0.000
#> GSM617646     1  0.2850     0.8007 0.864 0.104 0.008 0.004 0.016 0.004
#> GSM617652     1  0.1852     0.8349 0.928 0.040 0.024 0.004 0.000 0.004
#> GSM617655     1  0.4791     0.5733 0.652 0.104 0.244 0.000 0.000 0.000
#> GSM617656     1  0.4340     0.6803 0.720 0.064 0.208 0.000 0.000 0.008
#> GSM617657     3  0.1680    -0.3056 0.016 0.004 0.936 0.004 0.000 0.040
#> GSM617658     1  0.2696     0.8077 0.856 0.028 0.116 0.000 0.000 0.000
#> GSM617659     1  0.1707     0.8294 0.928 0.012 0.056 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-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) k
#> CV:hclust 77            0.440 2
#> CV:hclust 64            0.221 3
#> CV:hclust 59            0.775 4
#> CV:hclust 60            0.108 5
#> CV:hclust 62            0.417 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 21168 rows and 79 columns.
#>   Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'CV' method.
#>   Subgroups are detected by 'kmeans' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 2.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

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

collect_plots(res)

plot of chunk CV-kmeans-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.998           0.955       0.981         0.4898 0.512   0.512
#> 3 3 0.538           0.539       0.773         0.2811 0.829   0.679
#> 4 4 0.609           0.793       0.857         0.1606 0.766   0.465
#> 5 5 0.668           0.644       0.803         0.0628 0.969   0.886
#> 6 6 0.679           0.544       0.743         0.0433 0.941   0.779

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
#> GSM617581     1  0.4815      0.875 0.896 0.104
#> GSM617582     1  0.0000      0.979 1.000 0.000
#> GSM617588     2  0.0000      0.983 0.000 1.000
#> GSM617590     2  0.0000      0.983 0.000 1.000
#> GSM617592     2  0.0000      0.983 0.000 1.000
#> GSM617607     1  0.0000      0.979 1.000 0.000
#> GSM617608     1  0.0000      0.979 1.000 0.000
#> GSM617609     1  0.0000      0.979 1.000 0.000
#> GSM617612     1  0.0000      0.979 1.000 0.000
#> GSM617615     2  0.0000      0.983 0.000 1.000
#> GSM617616     1  0.0000      0.979 1.000 0.000
#> GSM617617     2  0.0000      0.983 0.000 1.000
#> GSM617618     1  0.0000      0.979 1.000 0.000
#> GSM617619     2  0.2948      0.941 0.052 0.948
#> GSM617620     2  0.0000      0.983 0.000 1.000
#> GSM617622     2  0.0000      0.983 0.000 1.000
#> GSM617623     1  0.9608      0.383 0.616 0.384
#> GSM617624     2  0.0000      0.983 0.000 1.000
#> GSM617625     1  0.0000      0.979 1.000 0.000
#> GSM617626     1  0.4298      0.893 0.912 0.088
#> GSM617627     2  0.0000      0.983 0.000 1.000
#> GSM617628     1  0.0000      0.979 1.000 0.000
#> GSM617632     1  0.0000      0.979 1.000 0.000
#> GSM617634     2  0.2778      0.944 0.048 0.952
#> GSM617635     1  0.0000      0.979 1.000 0.000
#> GSM617636     1  0.0000      0.979 1.000 0.000
#> GSM617637     1  0.0000      0.979 1.000 0.000
#> GSM617638     2  0.3114      0.936 0.056 0.944
#> GSM617639     1  0.0000      0.979 1.000 0.000
#> GSM617640     2  0.0000      0.983 0.000 1.000
#> GSM617641     2  0.0000      0.983 0.000 1.000
#> GSM617643     2  0.0000      0.983 0.000 1.000
#> GSM617644     2  0.0000      0.983 0.000 1.000
#> GSM617647     2  0.0000      0.983 0.000 1.000
#> GSM617648     2  0.0000      0.983 0.000 1.000
#> GSM617649     2  0.0000      0.983 0.000 1.000
#> GSM617650     1  0.0000      0.979 1.000 0.000
#> GSM617651     1  0.0000      0.979 1.000 0.000
#> GSM617653     1  0.0000      0.979 1.000 0.000
#> GSM617654     2  0.0000      0.983 0.000 1.000
#> GSM617583     1  0.0000      0.979 1.000 0.000
#> GSM617584     2  0.1633      0.965 0.024 0.976
#> GSM617585     2  0.0000      0.983 0.000 1.000
#> GSM617586     1  0.0000      0.979 1.000 0.000
#> GSM617587     1  0.0000      0.979 1.000 0.000
#> GSM617589     2  0.0000      0.983 0.000 1.000
#> GSM617591     2  0.0000      0.983 0.000 1.000
#> GSM617593     1  0.0000      0.979 1.000 0.000
#> GSM617594     2  0.0672      0.977 0.008 0.992
#> GSM617595     1  0.0000      0.979 1.000 0.000
#> GSM617596     1  0.0000      0.979 1.000 0.000
#> GSM617597     1  0.0000      0.979 1.000 0.000
#> GSM617598     1  0.0000      0.979 1.000 0.000
#> GSM617599     2  0.1414      0.969 0.020 0.980
#> GSM617600     1  0.0000      0.979 1.000 0.000
#> GSM617601     2  0.0000      0.983 0.000 1.000
#> GSM617602     1  0.0000      0.979 1.000 0.000
#> GSM617603     2  0.0000      0.983 0.000 1.000
#> GSM617604     1  0.0000      0.979 1.000 0.000
#> GSM617605     2  0.0000      0.983 0.000 1.000
#> GSM617606     2  0.0000      0.983 0.000 1.000
#> GSM617610     1  0.0000      0.979 1.000 0.000
#> GSM617611     1  0.0000      0.979 1.000 0.000
#> GSM617613     1  0.0000      0.979 1.000 0.000
#> GSM617614     1  0.0000      0.979 1.000 0.000
#> GSM617621     1  0.0000      0.979 1.000 0.000
#> GSM617629     1  0.0672      0.972 0.992 0.008
#> GSM617630     1  0.9552      0.402 0.624 0.376
#> GSM617631     1  0.0000      0.979 1.000 0.000
#> GSM617633     1  0.0000      0.979 1.000 0.000
#> GSM617642     1  0.0000      0.979 1.000 0.000
#> GSM617645     2  0.0000      0.983 0.000 1.000
#> GSM617646     1  0.0000      0.979 1.000 0.000
#> GSM617652     1  0.0000      0.979 1.000 0.000
#> GSM617655     1  0.0000      0.979 1.000 0.000
#> GSM617656     1  0.0000      0.979 1.000 0.000
#> GSM617657     2  0.9044      0.527 0.320 0.680
#> GSM617658     1  0.0000      0.979 1.000 0.000
#> GSM617659     1  0.0000      0.979 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
#> GSM617581     1  0.4449     0.7750 0.860 0.040 0.100
#> GSM617582     1  0.4002     0.7805 0.840 0.000 0.160
#> GSM617588     2  0.0000     0.7139 0.000 1.000 0.000
#> GSM617590     2  0.0000     0.7139 0.000 1.000 0.000
#> GSM617592     2  0.0000     0.7139 0.000 1.000 0.000
#> GSM617607     1  0.1643     0.8220 0.956 0.000 0.044
#> GSM617608     1  0.1163     0.8215 0.972 0.000 0.028
#> GSM617609     3  0.6252    -0.3143 0.444 0.000 0.556
#> GSM617612     1  0.0000     0.8196 1.000 0.000 0.000
#> GSM617615     2  0.4974     0.6672 0.000 0.764 0.236
#> GSM617616     1  0.0892     0.8165 0.980 0.000 0.020
#> GSM617617     2  0.6521     0.4144 0.004 0.504 0.492
#> GSM617618     1  0.1163     0.8159 0.972 0.000 0.028
#> GSM617619     3  0.3183     0.3771 0.016 0.076 0.908
#> GSM617620     2  0.0237     0.7148 0.000 0.996 0.004
#> GSM617622     2  0.5905     0.5638 0.000 0.648 0.352
#> GSM617623     1  0.7133     0.5574 0.712 0.096 0.192
#> GSM617624     3  0.6275    -0.0521 0.008 0.348 0.644
#> GSM617625     1  0.5363     0.6886 0.724 0.000 0.276
#> GSM617626     1  0.2414     0.7972 0.940 0.020 0.040
#> GSM617627     3  0.6398    -0.2228 0.004 0.416 0.580
#> GSM617628     1  0.5760     0.6339 0.672 0.000 0.328
#> GSM617632     1  0.1289     0.8134 0.968 0.000 0.032
#> GSM617634     3  0.5848     0.1441 0.012 0.268 0.720
#> GSM617635     1  0.0892     0.8197 0.980 0.000 0.020
#> GSM617636     1  0.3192     0.8030 0.888 0.000 0.112
#> GSM617637     1  0.0747     0.8169 0.984 0.000 0.016
#> GSM617638     3  0.5156     0.1990 0.008 0.216 0.776
#> GSM617639     1  0.0237     0.8193 0.996 0.000 0.004
#> GSM617640     2  0.6180     0.5355 0.000 0.584 0.416
#> GSM617641     2  0.0000     0.7139 0.000 1.000 0.000
#> GSM617643     2  0.5905     0.5857 0.000 0.648 0.352
#> GSM617644     2  0.2165     0.7176 0.000 0.936 0.064
#> GSM617647     2  0.6468     0.4570 0.004 0.552 0.444
#> GSM617648     2  0.6460     0.4788 0.004 0.556 0.440
#> GSM617649     3  0.6516    -0.3717 0.004 0.480 0.516
#> GSM617650     1  0.1411     0.8199 0.964 0.000 0.036
#> GSM617651     1  0.0424     0.8185 0.992 0.000 0.008
#> GSM617653     1  0.0747     0.8165 0.984 0.000 0.016
#> GSM617654     3  0.6813    -0.4149 0.012 0.468 0.520
#> GSM617583     1  0.5497     0.6766 0.708 0.000 0.292
#> GSM617584     2  0.5659     0.6258 0.052 0.796 0.152
#> GSM617585     2  0.5216     0.5895 0.000 0.740 0.260
#> GSM617586     1  0.6308     0.4099 0.508 0.000 0.492
#> GSM617587     3  0.6274    -0.3472 0.456 0.000 0.544
#> GSM617589     2  0.0424     0.7078 0.008 0.992 0.000
#> GSM617591     2  0.5810     0.6007 0.000 0.664 0.336
#> GSM617593     1  0.0000     0.8196 1.000 0.000 0.000
#> GSM617594     3  0.7395    -0.3874 0.032 0.476 0.492
#> GSM617595     1  0.0237     0.8193 0.996 0.000 0.004
#> GSM617596     1  0.2448     0.8121 0.924 0.000 0.076
#> GSM617597     1  0.5529     0.6915 0.704 0.000 0.296
#> GSM617598     1  0.0592     0.8180 0.988 0.000 0.012
#> GSM617599     3  0.7581    -0.2356 0.044 0.408 0.548
#> GSM617600     3  0.6295    -0.3953 0.472 0.000 0.528
#> GSM617601     2  0.3340     0.7097 0.000 0.880 0.120
#> GSM617602     1  0.6260     0.5151 0.552 0.000 0.448
#> GSM617603     2  0.0424     0.7132 0.000 0.992 0.008
#> GSM617604     1  0.3619     0.7994 0.864 0.000 0.136
#> GSM617605     2  0.0237     0.7141 0.000 0.996 0.004
#> GSM617606     2  0.6299     0.3969 0.000 0.524 0.476
#> GSM617610     1  0.0424     0.8185 0.992 0.000 0.008
#> GSM617611     1  0.0592     0.8204 0.988 0.000 0.012
#> GSM617613     3  0.5905    -0.0622 0.352 0.000 0.648
#> GSM617614     1  0.5760     0.6642 0.672 0.000 0.328
#> GSM617621     1  0.2448     0.8124 0.924 0.000 0.076
#> GSM617629     3  0.3340     0.4107 0.120 0.000 0.880
#> GSM617630     3  0.1453     0.3861 0.008 0.024 0.968
#> GSM617631     1  0.6291     0.4750 0.532 0.000 0.468
#> GSM617633     1  0.5621     0.6688 0.692 0.000 0.308
#> GSM617642     1  0.5760     0.6648 0.672 0.000 0.328
#> GSM617645     2  0.6308     0.4174 0.000 0.508 0.492
#> GSM617646     1  0.3412     0.7945 0.876 0.000 0.124
#> GSM617652     1  0.4452     0.7636 0.808 0.000 0.192
#> GSM617655     1  0.6309     0.4033 0.504 0.000 0.496
#> GSM617656     1  0.6286     0.4735 0.536 0.000 0.464
#> GSM617657     3  0.3234     0.3855 0.020 0.072 0.908
#> GSM617658     1  0.5968     0.6368 0.636 0.000 0.364
#> GSM617659     1  0.1411     0.8199 0.964 0.000 0.036

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM617581     1  0.4628     0.8314 0.828 0.080 0.048 0.044
#> GSM617582     1  0.5800     0.7686 0.748 0.092 0.132 0.028
#> GSM617588     4  0.1211     0.8626 0.000 0.040 0.000 0.960
#> GSM617590     4  0.1302     0.8632 0.000 0.044 0.000 0.956
#> GSM617592     4  0.1302     0.8632 0.000 0.044 0.000 0.956
#> GSM617607     1  0.2984     0.8861 0.888 0.028 0.084 0.000
#> GSM617608     1  0.1940     0.8835 0.924 0.000 0.076 0.000
#> GSM617609     3  0.3215     0.8872 0.092 0.032 0.876 0.000
#> GSM617612     1  0.0921     0.8984 0.972 0.000 0.028 0.000
#> GSM617615     2  0.5345     0.2802 0.000 0.560 0.012 0.428
#> GSM617616     1  0.2089     0.8932 0.940 0.028 0.020 0.012
#> GSM617617     2  0.2441     0.8317 0.004 0.916 0.012 0.068
#> GSM617618     1  0.2996     0.8844 0.904 0.048 0.028 0.020
#> GSM617619     2  0.4360     0.6773 0.000 0.744 0.248 0.008
#> GSM617620     4  0.1302     0.8632 0.000 0.044 0.000 0.956
#> GSM617622     2  0.6801     0.3785 0.020 0.568 0.064 0.348
#> GSM617623     1  0.4778     0.8186 0.816 0.100 0.040 0.044
#> GSM617624     2  0.2565     0.8299 0.000 0.912 0.056 0.032
#> GSM617625     3  0.4252     0.7965 0.252 0.000 0.744 0.004
#> GSM617626     1  0.2099     0.8832 0.936 0.040 0.004 0.020
#> GSM617627     2  0.2830     0.8331 0.000 0.900 0.040 0.060
#> GSM617628     3  0.4188     0.8048 0.244 0.000 0.752 0.004
#> GSM617632     1  0.2170     0.8882 0.936 0.036 0.012 0.016
#> GSM617634     2  0.3790     0.7996 0.008 0.856 0.096 0.040
#> GSM617635     1  0.1798     0.8978 0.944 0.016 0.040 0.000
#> GSM617636     1  0.4488     0.8363 0.820 0.076 0.096 0.008
#> GSM617637     1  0.1004     0.8993 0.972 0.004 0.024 0.000
#> GSM617638     2  0.2654     0.7923 0.000 0.888 0.108 0.004
#> GSM617639     1  0.0817     0.8986 0.976 0.000 0.024 0.000
#> GSM617640     2  0.3158     0.8236 0.004 0.880 0.020 0.096
#> GSM617641     4  0.1211     0.8630 0.000 0.040 0.000 0.960
#> GSM617643     2  0.3443     0.8083 0.000 0.848 0.016 0.136
#> GSM617644     4  0.4635     0.5737 0.000 0.268 0.012 0.720
#> GSM617647     2  0.3190     0.8289 0.016 0.880 0.008 0.096
#> GSM617648     2  0.4036     0.8214 0.012 0.840 0.032 0.116
#> GSM617649     2  0.3421     0.8295 0.000 0.868 0.044 0.088
#> GSM617650     1  0.2530     0.8551 0.888 0.000 0.112 0.000
#> GSM617651     1  0.1022     0.8980 0.968 0.000 0.032 0.000
#> GSM617653     1  0.0779     0.8951 0.980 0.004 0.000 0.016
#> GSM617654     2  0.3001     0.8208 0.004 0.896 0.064 0.036
#> GSM617583     3  0.3908     0.8355 0.212 0.000 0.784 0.004
#> GSM617584     4  0.7065     0.5359 0.120 0.200 0.036 0.644
#> GSM617585     4  0.4203     0.7601 0.000 0.108 0.068 0.824
#> GSM617586     3  0.2737     0.8903 0.104 0.008 0.888 0.000
#> GSM617587     3  0.3015     0.8884 0.092 0.024 0.884 0.000
#> GSM617589     4  0.0921     0.8551 0.000 0.028 0.000 0.972
#> GSM617591     2  0.5565     0.4811 0.000 0.624 0.032 0.344
#> GSM617593     1  0.0921     0.8984 0.972 0.000 0.028 0.000
#> GSM617594     2  0.3902     0.8144 0.060 0.864 0.028 0.048
#> GSM617595     1  0.1022     0.8979 0.968 0.000 0.032 0.000
#> GSM617596     1  0.3487     0.8667 0.880 0.040 0.064 0.016
#> GSM617597     3  0.3528     0.8468 0.192 0.000 0.808 0.000
#> GSM617598     1  0.0817     0.8990 0.976 0.000 0.024 0.000
#> GSM617599     2  0.3370     0.8254 0.028 0.888 0.028 0.056
#> GSM617600     3  0.2489     0.8764 0.068 0.020 0.912 0.000
#> GSM617601     4  0.5168    -0.0795 0.000 0.492 0.004 0.504
#> GSM617602     3  0.3109     0.8875 0.100 0.016 0.880 0.004
#> GSM617603     4  0.1109     0.8555 0.000 0.028 0.004 0.968
#> GSM617604     1  0.5025     0.7499 0.752 0.024 0.208 0.016
#> GSM617605     4  0.1211     0.8630 0.000 0.040 0.000 0.960
#> GSM617606     2  0.5061     0.7601 0.004 0.752 0.048 0.196
#> GSM617610     1  0.0817     0.8986 0.976 0.000 0.024 0.000
#> GSM617611     1  0.1716     0.8887 0.936 0.000 0.064 0.000
#> GSM617613     3  0.1920     0.8388 0.028 0.024 0.944 0.004
#> GSM617614     3  0.3052     0.8795 0.136 0.004 0.860 0.000
#> GSM617621     1  0.3225     0.8688 0.892 0.032 0.060 0.016
#> GSM617629     3  0.6229     0.1781 0.032 0.380 0.572 0.016
#> GSM617630     2  0.3208     0.7626 0.004 0.848 0.148 0.000
#> GSM617631     3  0.2530     0.8890 0.100 0.004 0.896 0.000
#> GSM617633     3  0.5110     0.6240 0.328 0.016 0.656 0.000
#> GSM617642     3  0.3157     0.8767 0.144 0.004 0.852 0.000
#> GSM617645     2  0.3027     0.8265 0.004 0.888 0.020 0.088
#> GSM617646     1  0.4022     0.8418 0.836 0.096 0.068 0.000
#> GSM617652     1  0.5548     0.2638 0.588 0.024 0.388 0.000
#> GSM617655     3  0.2805     0.8902 0.100 0.012 0.888 0.000
#> GSM617656     3  0.2805     0.8902 0.100 0.012 0.888 0.000
#> GSM617657     3  0.2408     0.7809 0.016 0.060 0.920 0.004
#> GSM617658     3  0.4264     0.8611 0.140 0.028 0.820 0.012
#> GSM617659     1  0.2589     0.8516 0.884 0.000 0.116 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
#> GSM617581     1  0.5856     0.6848 0.660 0.028 0.020 0.048 0.244
#> GSM617582     1  0.6064     0.5340 0.520 0.020 0.060 0.004 0.396
#> GSM617588     4  0.1012     0.8841 0.000 0.012 0.000 0.968 0.020
#> GSM617590     4  0.0740     0.8867 0.000 0.008 0.008 0.980 0.004
#> GSM617592     4  0.0451     0.8863 0.000 0.008 0.000 0.988 0.004
#> GSM617607     1  0.2512     0.8225 0.904 0.004 0.060 0.004 0.028
#> GSM617608     1  0.1697     0.8200 0.932 0.000 0.060 0.000 0.008
#> GSM617609     3  0.1106     0.8557 0.024 0.012 0.964 0.000 0.000
#> GSM617612     1  0.1300     0.8296 0.956 0.000 0.028 0.000 0.016
#> GSM617615     2  0.3759     0.5316 0.000 0.764 0.000 0.220 0.016
#> GSM617616     1  0.3777     0.7840 0.784 0.004 0.020 0.000 0.192
#> GSM617617     2  0.3496     0.4891 0.000 0.788 0.000 0.012 0.200
#> GSM617618     1  0.4382     0.7592 0.736 0.012 0.024 0.000 0.228
#> GSM617619     2  0.6115    -0.0463 0.000 0.520 0.356 0.004 0.120
#> GSM617620     4  0.0794     0.8839 0.000 0.028 0.000 0.972 0.000
#> GSM617622     2  0.6639     0.3206 0.004 0.568 0.024 0.248 0.156
#> GSM617623     1  0.6012     0.6677 0.644 0.036 0.020 0.044 0.256
#> GSM617624     2  0.2802     0.5650 0.000 0.876 0.016 0.008 0.100
#> GSM617625     3  0.3652     0.7382 0.200 0.004 0.784 0.000 0.012
#> GSM617626     1  0.3732     0.7802 0.796 0.016 0.004 0.004 0.180
#> GSM617627     2  0.2733     0.5730 0.000 0.888 0.016 0.016 0.080
#> GSM617628     3  0.3575     0.7617 0.180 0.004 0.800 0.000 0.016
#> GSM617632     1  0.3908     0.7766 0.776 0.016 0.004 0.004 0.200
#> GSM617634     2  0.4989     0.2278 0.000 0.572 0.020 0.008 0.400
#> GSM617635     1  0.2913     0.8129 0.876 0.000 0.040 0.004 0.080
#> GSM617636     1  0.5356     0.7029 0.652 0.016 0.044 0.004 0.284
#> GSM617637     1  0.1334     0.8288 0.960 0.004 0.020 0.004 0.012
#> GSM617638     2  0.4680     0.0194 0.000 0.540 0.008 0.004 0.448
#> GSM617639     1  0.1356     0.8292 0.956 0.000 0.028 0.004 0.012
#> GSM617640     2  0.4747     0.2768 0.000 0.620 0.000 0.028 0.352
#> GSM617641     4  0.0451     0.8863 0.000 0.008 0.000 0.988 0.004
#> GSM617643     2  0.3336     0.5817 0.000 0.844 0.000 0.060 0.096
#> GSM617644     2  0.5932     0.0406 0.000 0.456 0.000 0.440 0.104
#> GSM617647     2  0.2256     0.5898 0.016 0.920 0.000 0.032 0.032
#> GSM617648     2  0.3370     0.5543 0.000 0.824 0.000 0.028 0.148
#> GSM617649     2  0.2956     0.5740 0.000 0.872 0.012 0.020 0.096
#> GSM617650     1  0.2249     0.8034 0.896 0.000 0.096 0.000 0.008
#> GSM617651     1  0.0703     0.8282 0.976 0.000 0.024 0.000 0.000
#> GSM617653     1  0.3013     0.7932 0.832 0.000 0.000 0.008 0.160
#> GSM617654     2  0.4560    -0.0761 0.000 0.508 0.000 0.008 0.484
#> GSM617583     3  0.2783     0.8189 0.116 0.004 0.868 0.000 0.012
#> GSM617584     4  0.8091     0.2107 0.084 0.240 0.016 0.452 0.208
#> GSM617585     4  0.5440     0.6755 0.000 0.100 0.044 0.720 0.136
#> GSM617586     3  0.0992     0.8569 0.024 0.008 0.968 0.000 0.000
#> GSM617587     3  0.0992     0.8569 0.024 0.008 0.968 0.000 0.000
#> GSM617589     4  0.1493     0.8768 0.000 0.028 0.000 0.948 0.024
#> GSM617591     2  0.4518     0.5508 0.000 0.772 0.044 0.156 0.028
#> GSM617593     1  0.0703     0.8282 0.976 0.000 0.024 0.000 0.000
#> GSM617594     2  0.2756     0.5769 0.036 0.900 0.008 0.012 0.044
#> GSM617595     1  0.0880     0.8268 0.968 0.000 0.032 0.000 0.000
#> GSM617596     1  0.4603     0.7501 0.732 0.008 0.028 0.008 0.224
#> GSM617597     3  0.3368     0.7733 0.164 0.004 0.820 0.004 0.008
#> GSM617598     1  0.0703     0.8282 0.976 0.000 0.024 0.000 0.000
#> GSM617599     2  0.2589     0.5750 0.020 0.896 0.004 0.004 0.076
#> GSM617600     3  0.1560     0.8488 0.020 0.004 0.948 0.000 0.028
#> GSM617601     2  0.3949     0.4849 0.000 0.696 0.000 0.300 0.004
#> GSM617602     3  0.2951     0.8013 0.028 0.000 0.860 0.000 0.112
#> GSM617603     4  0.2819     0.8467 0.000 0.076 0.008 0.884 0.032
#> GSM617604     1  0.5890     0.6438 0.612 0.000 0.152 0.004 0.232
#> GSM617605     4  0.0740     0.8867 0.000 0.008 0.008 0.980 0.004
#> GSM617606     2  0.6649     0.2570 0.000 0.508 0.016 0.164 0.312
#> GSM617610     1  0.0992     0.8288 0.968 0.000 0.024 0.000 0.008
#> GSM617611     1  0.1704     0.8166 0.928 0.000 0.068 0.000 0.004
#> GSM617613     3  0.1808     0.8212 0.008 0.012 0.936 0.000 0.044
#> GSM617614     3  0.2362     0.8453 0.076 0.000 0.900 0.000 0.024
#> GSM617621     1  0.4491     0.7450 0.732 0.008 0.020 0.008 0.232
#> GSM617629     5  0.6156     0.1253 0.008 0.128 0.308 0.000 0.556
#> GSM617630     5  0.4961    -0.3349 0.000 0.448 0.028 0.000 0.524
#> GSM617631     3  0.1568     0.8484 0.020 0.000 0.944 0.000 0.036
#> GSM617633     3  0.6169     0.3513 0.364 0.004 0.508 0.000 0.124
#> GSM617642     3  0.1443     0.8553 0.044 0.004 0.948 0.000 0.004
#> GSM617645     2  0.4651     0.2359 0.000 0.608 0.000 0.020 0.372
#> GSM617646     1  0.4493     0.7691 0.800 0.096 0.060 0.004 0.040
#> GSM617652     1  0.5291     0.2756 0.572 0.024 0.388 0.004 0.012
#> GSM617655     3  0.0992     0.8569 0.024 0.008 0.968 0.000 0.000
#> GSM617656     3  0.0703     0.8572 0.024 0.000 0.976 0.000 0.000
#> GSM617657     3  0.2464     0.7588 0.000 0.016 0.888 0.000 0.096
#> GSM617658     3  0.5030     0.6051 0.072 0.000 0.688 0.004 0.236
#> GSM617659     1  0.2513     0.7888 0.876 0.000 0.116 0.000 0.008

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>           class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM617581     1  0.6183     0.1178 0.476 0.052 0.012 0.040 0.012 0.408
#> GSM617582     6  0.6733     0.2284 0.296 0.032 0.044 0.000 0.120 0.508
#> GSM617588     4  0.1334     0.8967 0.000 0.000 0.000 0.948 0.032 0.020
#> GSM617590     4  0.0508     0.9057 0.000 0.004 0.000 0.984 0.000 0.012
#> GSM617592     4  0.0405     0.9033 0.000 0.004 0.000 0.988 0.008 0.000
#> GSM617607     1  0.3699     0.5948 0.824 0.024 0.020 0.000 0.028 0.104
#> GSM617608     1  0.2586     0.6130 0.880 0.000 0.080 0.000 0.008 0.032
#> GSM617609     3  0.1579     0.8527 0.024 0.020 0.944 0.000 0.008 0.004
#> GSM617612     1  0.0622     0.6488 0.980 0.000 0.012 0.000 0.000 0.008
#> GSM617615     2  0.4254     0.5277 0.000 0.768 0.004 0.144 0.060 0.024
#> GSM617616     1  0.4742     0.3054 0.612 0.004 0.000 0.000 0.056 0.328
#> GSM617617     2  0.4229     0.0628 0.000 0.668 0.000 0.000 0.292 0.040
#> GSM617618     1  0.5419     0.1794 0.556 0.004 0.012 0.000 0.080 0.348
#> GSM617619     2  0.5928     0.1612 0.000 0.512 0.360 0.000 0.068 0.060
#> GSM617620     4  0.1860     0.8905 0.000 0.036 0.004 0.928 0.028 0.004
#> GSM617622     2  0.6100     0.4234 0.000 0.592 0.016 0.096 0.048 0.248
#> GSM617623     1  0.6204     0.0954 0.468 0.048 0.008 0.040 0.020 0.416
#> GSM617624     2  0.2703     0.4925 0.000 0.876 0.016 0.000 0.080 0.028
#> GSM617625     3  0.3865     0.7368 0.216 0.000 0.748 0.000 0.016 0.020
#> GSM617626     1  0.4602     0.3677 0.636 0.036 0.000 0.000 0.012 0.316
#> GSM617627     2  0.2560     0.4830 0.000 0.880 0.016 0.000 0.088 0.016
#> GSM617628     3  0.3720     0.7584 0.196 0.000 0.768 0.000 0.016 0.020
#> GSM617632     1  0.4836     0.1762 0.536 0.008 0.000 0.000 0.040 0.416
#> GSM617634     2  0.6718     0.0546 0.000 0.380 0.028 0.004 0.252 0.336
#> GSM617635     1  0.3622     0.5388 0.792 0.012 0.004 0.000 0.024 0.168
#> GSM617636     6  0.5783    -0.1454 0.428 0.012 0.024 0.000 0.064 0.472
#> GSM617637     1  0.1003     0.6462 0.964 0.004 0.004 0.000 0.000 0.028
#> GSM617638     5  0.5137     0.6498 0.000 0.328 0.008 0.000 0.584 0.080
#> GSM617639     1  0.0922     0.6466 0.968 0.000 0.004 0.000 0.004 0.024
#> GSM617640     5  0.4487     0.6893 0.000 0.420 0.000 0.004 0.552 0.024
#> GSM617641     4  0.0291     0.9043 0.000 0.004 0.000 0.992 0.004 0.000
#> GSM617643     2  0.5123     0.4649 0.000 0.688 0.000 0.032 0.140 0.140
#> GSM617644     2  0.7016     0.2999 0.000 0.428 0.004 0.316 0.084 0.168
#> GSM617647     2  0.2044     0.5341 0.008 0.924 0.000 0.016 0.032 0.020
#> GSM617648     2  0.4997     0.4756 0.000 0.688 0.004 0.012 0.128 0.168
#> GSM617649     2  0.4450     0.4932 0.000 0.752 0.004 0.016 0.108 0.120
#> GSM617650     1  0.2290     0.6153 0.892 0.000 0.084 0.000 0.004 0.020
#> GSM617651     1  0.0951     0.6464 0.968 0.000 0.004 0.000 0.008 0.020
#> GSM617653     1  0.3912     0.3864 0.648 0.000 0.000 0.000 0.012 0.340
#> GSM617654     5  0.3489     0.7756 0.000 0.288 0.000 0.000 0.708 0.004
#> GSM617583     3  0.3016     0.8168 0.136 0.000 0.836 0.000 0.012 0.016
#> GSM617584     6  0.7286     0.0158 0.052 0.208 0.008 0.332 0.012 0.388
#> GSM617585     4  0.6645     0.5771 0.000 0.104 0.040 0.604 0.128 0.124
#> GSM617586     3  0.1225     0.8565 0.032 0.004 0.956 0.000 0.004 0.004
#> GSM617587     3  0.1457     0.8556 0.028 0.016 0.948 0.000 0.004 0.004
#> GSM617589     4  0.1824     0.8931 0.004 0.004 0.004 0.932 0.040 0.016
#> GSM617591     2  0.5094     0.4860 0.000 0.736 0.108 0.076 0.056 0.024
#> GSM617593     1  0.0405     0.6478 0.988 0.000 0.000 0.000 0.004 0.008
#> GSM617594     2  0.2649     0.5454 0.028 0.896 0.008 0.008 0.012 0.048
#> GSM617595     1  0.0653     0.6481 0.980 0.000 0.012 0.000 0.004 0.004
#> GSM617596     1  0.4481     0.2909 0.568 0.008 0.008 0.000 0.008 0.408
#> GSM617597     3  0.3905     0.7309 0.200 0.000 0.756 0.000 0.016 0.028
#> GSM617598     1  0.0291     0.6481 0.992 0.000 0.004 0.000 0.000 0.004
#> GSM617599     2  0.3140     0.5500 0.012 0.864 0.008 0.004 0.060 0.052
#> GSM617600     3  0.1957     0.8393 0.012 0.008 0.928 0.000 0.028 0.024
#> GSM617601     2  0.3770     0.5123 0.000 0.776 0.004 0.176 0.040 0.004
#> GSM617602     3  0.3889     0.7358 0.012 0.000 0.776 0.000 0.052 0.160
#> GSM617603     4  0.4358     0.8048 0.000 0.036 0.004 0.772 0.072 0.116
#> GSM617604     1  0.5946     0.0898 0.456 0.008 0.116 0.000 0.012 0.408
#> GSM617605     4  0.0622     0.9058 0.000 0.008 0.000 0.980 0.000 0.012
#> GSM617606     2  0.7198    -0.0787 0.000 0.396 0.004 0.168 0.328 0.104
#> GSM617610     1  0.0291     0.6481 0.992 0.000 0.004 0.000 0.000 0.004
#> GSM617611     1  0.1732     0.6254 0.920 0.000 0.072 0.000 0.004 0.004
#> GSM617613     3  0.2221     0.8301 0.004 0.004 0.908 0.000 0.040 0.044
#> GSM617614     3  0.2747     0.8392 0.096 0.000 0.868 0.000 0.020 0.016
#> GSM617621     1  0.4702     0.2801 0.568 0.016 0.016 0.000 0.004 0.396
#> GSM617629     6  0.6311     0.0600 0.000 0.060 0.120 0.000 0.312 0.508
#> GSM617630     5  0.3536     0.7627 0.000 0.252 0.008 0.000 0.736 0.004
#> GSM617631     3  0.2100     0.8393 0.016 0.000 0.916 0.000 0.032 0.036
#> GSM617633     1  0.7050    -0.0608 0.380 0.004 0.336 0.000 0.064 0.216
#> GSM617642     3  0.1615     0.8519 0.064 0.000 0.928 0.000 0.004 0.004
#> GSM617645     5  0.4276     0.7140 0.000 0.416 0.000 0.000 0.564 0.020
#> GSM617646     1  0.4703     0.5418 0.764 0.088 0.024 0.000 0.036 0.088
#> GSM617652     1  0.5450     0.2059 0.544 0.040 0.376 0.000 0.008 0.032
#> GSM617655     3  0.1003     0.8566 0.028 0.004 0.964 0.000 0.000 0.004
#> GSM617656     3  0.0858     0.8568 0.028 0.000 0.968 0.000 0.004 0.000
#> GSM617657     3  0.3820     0.7082 0.000 0.008 0.784 0.000 0.064 0.144
#> GSM617658     3  0.5391     0.3405 0.036 0.000 0.540 0.000 0.048 0.376
#> GSM617659     1  0.2871     0.5835 0.852 0.000 0.116 0.000 0.008 0.024

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

consensus_heatmap(res, k = 2)

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

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

collect_plots(res)

plot of chunk CV-skmeans-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.943           0.939       0.974         0.5027 0.498   0.498
#> 3 3 0.470           0.691       0.839         0.3312 0.751   0.538
#> 4 4 0.398           0.490       0.700         0.1157 0.934   0.808
#> 5 5 0.407           0.351       0.613         0.0630 0.932   0.773
#> 6 6 0.459           0.277       0.540         0.0425 0.924   0.706

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
#> GSM617581     2  0.9000      0.545 0.316 0.684
#> GSM617582     1  0.9000      0.536 0.684 0.316
#> GSM617588     2  0.0000      0.971 0.000 1.000
#> GSM617590     2  0.0000      0.971 0.000 1.000
#> GSM617592     2  0.0000      0.971 0.000 1.000
#> GSM617607     1  0.0000      0.973 1.000 0.000
#> GSM617608     1  0.0000      0.973 1.000 0.000
#> GSM617609     1  0.2603      0.940 0.956 0.044
#> GSM617612     1  0.0000      0.973 1.000 0.000
#> GSM617615     2  0.0000      0.971 0.000 1.000
#> GSM617616     1  0.0672      0.969 0.992 0.008
#> GSM617617     2  0.0000      0.971 0.000 1.000
#> GSM617618     1  0.1633      0.957 0.976 0.024
#> GSM617619     2  0.0000      0.971 0.000 1.000
#> GSM617620     2  0.0000      0.971 0.000 1.000
#> GSM617622     2  0.0000      0.971 0.000 1.000
#> GSM617623     2  0.5294      0.857 0.120 0.880
#> GSM617624     2  0.0000      0.971 0.000 1.000
#> GSM617625     1  0.0000      0.973 1.000 0.000
#> GSM617626     2  0.9552      0.402 0.376 0.624
#> GSM617627     2  0.0000      0.971 0.000 1.000
#> GSM617628     1  0.0000      0.973 1.000 0.000
#> GSM617632     1  0.0672      0.969 0.992 0.008
#> GSM617634     2  0.0376      0.969 0.004 0.996
#> GSM617635     1  0.0376      0.971 0.996 0.004
#> GSM617636     1  0.0000      0.973 1.000 0.000
#> GSM617637     1  0.1184      0.963 0.984 0.016
#> GSM617638     2  0.0376      0.969 0.004 0.996
#> GSM617639     1  0.0000      0.973 1.000 0.000
#> GSM617640     2  0.0000      0.971 0.000 1.000
#> GSM617641     2  0.0000      0.971 0.000 1.000
#> GSM617643     2  0.0000      0.971 0.000 1.000
#> GSM617644     2  0.0000      0.971 0.000 1.000
#> GSM617647     2  0.0000      0.971 0.000 1.000
#> GSM617648     2  0.0000      0.971 0.000 1.000
#> GSM617649     2  0.0000      0.971 0.000 1.000
#> GSM617650     1  0.0000      0.973 1.000 0.000
#> GSM617651     1  0.0000      0.973 1.000 0.000
#> GSM617653     1  0.0000      0.973 1.000 0.000
#> GSM617654     2  0.0000      0.971 0.000 1.000
#> GSM617583     1  0.0000      0.973 1.000 0.000
#> GSM617584     2  0.0938      0.963 0.012 0.988
#> GSM617585     2  0.0000      0.971 0.000 1.000
#> GSM617586     1  0.0376      0.971 0.996 0.004
#> GSM617587     1  0.6887      0.774 0.816 0.184
#> GSM617589     2  0.0000      0.971 0.000 1.000
#> GSM617591     2  0.0000      0.971 0.000 1.000
#> GSM617593     1  0.0000      0.973 1.000 0.000
#> GSM617594     2  0.0000      0.971 0.000 1.000
#> GSM617595     1  0.0000      0.973 1.000 0.000
#> GSM617596     1  0.0000      0.973 1.000 0.000
#> GSM617597     1  0.0000      0.973 1.000 0.000
#> GSM617598     1  0.0000      0.973 1.000 0.000
#> GSM617599     2  0.0376      0.969 0.004 0.996
#> GSM617600     1  0.0000      0.973 1.000 0.000
#> GSM617601     2  0.0000      0.971 0.000 1.000
#> GSM617602     1  0.0000      0.973 1.000 0.000
#> GSM617603     2  0.0000      0.971 0.000 1.000
#> GSM617604     1  0.0376      0.971 0.996 0.004
#> GSM617605     2  0.0000      0.971 0.000 1.000
#> GSM617606     2  0.0000      0.971 0.000 1.000
#> GSM617610     1  0.0000      0.973 1.000 0.000
#> GSM617611     1  0.0000      0.973 1.000 0.000
#> GSM617613     1  0.2043      0.951 0.968 0.032
#> GSM617614     1  0.0000      0.973 1.000 0.000
#> GSM617621     1  0.0000      0.973 1.000 0.000
#> GSM617629     1  0.9393      0.449 0.644 0.356
#> GSM617630     2  0.3431      0.917 0.064 0.936
#> GSM617631     1  0.0000      0.973 1.000 0.000
#> GSM617633     1  0.0000      0.973 1.000 0.000
#> GSM617642     1  0.0000      0.973 1.000 0.000
#> GSM617645     2  0.0000      0.971 0.000 1.000
#> GSM617646     1  0.3879      0.908 0.924 0.076
#> GSM617652     1  0.0376      0.971 0.996 0.004
#> GSM617655     1  0.1633      0.958 0.976 0.024
#> GSM617656     1  0.0000      0.973 1.000 0.000
#> GSM617657     2  0.4022      0.900 0.080 0.920
#> GSM617658     1  0.0000      0.973 1.000 0.000
#> GSM617659     1  0.0000      0.973 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
#> GSM617581     1  0.9070      0.366 0.536 0.292 0.172
#> GSM617582     1  0.9434     -0.020 0.416 0.176 0.408
#> GSM617588     2  0.0000      0.898 0.000 1.000 0.000
#> GSM617590     2  0.0000      0.898 0.000 1.000 0.000
#> GSM617592     2  0.0000      0.898 0.000 1.000 0.000
#> GSM617607     1  0.4887      0.692 0.772 0.000 0.228
#> GSM617608     1  0.5760      0.519 0.672 0.000 0.328
#> GSM617609     3  0.2063      0.756 0.044 0.008 0.948
#> GSM617612     1  0.3879      0.732 0.848 0.000 0.152
#> GSM617615     2  0.0237      0.898 0.000 0.996 0.004
#> GSM617616     1  0.4349      0.738 0.852 0.020 0.128
#> GSM617617     2  0.1647      0.889 0.036 0.960 0.004
#> GSM617618     1  0.5435      0.698 0.784 0.024 0.192
#> GSM617619     3  0.6410      0.159 0.004 0.420 0.576
#> GSM617620     2  0.0000      0.898 0.000 1.000 0.000
#> GSM617622     2  0.2955      0.873 0.008 0.912 0.080
#> GSM617623     1  0.7507      0.474 0.644 0.288 0.068
#> GSM617624     2  0.5826      0.740 0.032 0.764 0.204
#> GSM617625     3  0.5363      0.592 0.276 0.000 0.724
#> GSM617626     1  0.4861      0.643 0.808 0.180 0.012
#> GSM617627     2  0.3686      0.829 0.000 0.860 0.140
#> GSM617628     3  0.4504      0.686 0.196 0.000 0.804
#> GSM617632     1  0.2486      0.755 0.932 0.008 0.060
#> GSM617634     2  0.8771      0.326 0.132 0.544 0.324
#> GSM617635     1  0.4834      0.712 0.792 0.004 0.204
#> GSM617636     1  0.5363      0.631 0.724 0.000 0.276
#> GSM617637     1  0.1015      0.758 0.980 0.008 0.012
#> GSM617638     2  0.8238      0.458 0.104 0.596 0.300
#> GSM617639     1  0.0892      0.759 0.980 0.000 0.020
#> GSM617640     2  0.0000      0.898 0.000 1.000 0.000
#> GSM617641     2  0.0000      0.898 0.000 1.000 0.000
#> GSM617643     2  0.0475      0.898 0.004 0.992 0.004
#> GSM617644     2  0.0475      0.898 0.004 0.992 0.004
#> GSM617647     2  0.3193      0.848 0.100 0.896 0.004
#> GSM617648     2  0.1170      0.897 0.016 0.976 0.008
#> GSM617649     2  0.3091      0.873 0.016 0.912 0.072
#> GSM617650     1  0.5254      0.619 0.736 0.000 0.264
#> GSM617651     1  0.1031      0.760 0.976 0.000 0.024
#> GSM617653     1  0.0892      0.760 0.980 0.000 0.020
#> GSM617654     2  0.1525      0.892 0.032 0.964 0.004
#> GSM617583     3  0.4654      0.681 0.208 0.000 0.792
#> GSM617584     2  0.5138      0.802 0.120 0.828 0.052
#> GSM617585     2  0.4351      0.798 0.004 0.828 0.168
#> GSM617586     3  0.2165      0.752 0.064 0.000 0.936
#> GSM617587     3  0.5426      0.708 0.092 0.088 0.820
#> GSM617589     2  0.0829      0.897 0.012 0.984 0.004
#> GSM617591     2  0.4291      0.782 0.000 0.820 0.180
#> GSM617593     1  0.1031      0.759 0.976 0.000 0.024
#> GSM617594     2  0.7447      0.655 0.184 0.696 0.120
#> GSM617595     1  0.1529      0.761 0.960 0.000 0.040
#> GSM617596     1  0.3116      0.755 0.892 0.000 0.108
#> GSM617597     3  0.5926      0.422 0.356 0.000 0.644
#> GSM617598     1  0.1031      0.759 0.976 0.000 0.024
#> GSM617599     2  0.7944      0.559 0.244 0.644 0.112
#> GSM617600     3  0.0592      0.750 0.012 0.000 0.988
#> GSM617601     2  0.0237      0.898 0.000 0.996 0.004
#> GSM617602     3  0.2165      0.747 0.064 0.000 0.936
#> GSM617603     2  0.0237      0.898 0.000 0.996 0.004
#> GSM617604     1  0.6295      0.189 0.528 0.000 0.472
#> GSM617605     2  0.0000      0.898 0.000 1.000 0.000
#> GSM617606     2  0.2173      0.886 0.008 0.944 0.048
#> GSM617610     1  0.0983      0.759 0.980 0.004 0.016
#> GSM617611     1  0.4750      0.676 0.784 0.000 0.216
#> GSM617613     3  0.1129      0.751 0.020 0.004 0.976
#> GSM617614     3  0.5016      0.639 0.240 0.000 0.760
#> GSM617621     1  0.2711      0.757 0.912 0.000 0.088
#> GSM617629     3  0.8641      0.426 0.248 0.160 0.592
#> GSM617630     3  0.9030      0.199 0.136 0.388 0.476
#> GSM617631     3  0.0747      0.752 0.016 0.000 0.984
#> GSM617633     3  0.6244      0.175 0.440 0.000 0.560
#> GSM617642     3  0.4555      0.680 0.200 0.000 0.800
#> GSM617645     2  0.0237      0.898 0.000 0.996 0.004
#> GSM617646     1  0.6758      0.662 0.728 0.072 0.200
#> GSM617652     1  0.6682      0.042 0.504 0.008 0.488
#> GSM617655     3  0.1129      0.754 0.020 0.004 0.976
#> GSM617656     3  0.0892      0.753 0.020 0.000 0.980
#> GSM617657     3  0.3459      0.702 0.012 0.096 0.892
#> GSM617658     3  0.5254      0.588 0.264 0.000 0.736
#> GSM617659     1  0.5760      0.509 0.672 0.000 0.328

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM617581     1  0.9554   -0.05478 0.340 0.260 0.116 0.284
#> GSM617582     4  0.9728    0.25233 0.228 0.164 0.252 0.356
#> GSM617588     2  0.0817    0.70592 0.000 0.976 0.000 0.024
#> GSM617590     2  0.1474    0.70940 0.000 0.948 0.000 0.052
#> GSM617592     2  0.1022    0.70531 0.000 0.968 0.000 0.032
#> GSM617607     1  0.7062    0.51144 0.564 0.000 0.176 0.260
#> GSM617608     1  0.6323    0.46697 0.628 0.000 0.272 0.100
#> GSM617609     3  0.5130    0.52497 0.044 0.004 0.740 0.212
#> GSM617612     1  0.4844    0.65759 0.784 0.000 0.108 0.108
#> GSM617615     2  0.3789    0.69540 0.004 0.836 0.020 0.140
#> GSM617616     1  0.8038    0.47948 0.560 0.072 0.120 0.248
#> GSM617617     2  0.5712    0.54351 0.048 0.644 0.000 0.308
#> GSM617618     1  0.8234    0.34834 0.476 0.032 0.192 0.300
#> GSM617619     3  0.7947   -0.34062 0.008 0.224 0.436 0.332
#> GSM617620     2  0.1211    0.70860 0.000 0.960 0.000 0.040
#> GSM617622     2  0.5915    0.57500 0.016 0.708 0.068 0.208
#> GSM617623     1  0.8269    0.06268 0.436 0.248 0.020 0.296
#> GSM617624     4  0.7699    0.27209 0.024 0.336 0.132 0.508
#> GSM617625     3  0.5810    0.53204 0.276 0.000 0.660 0.064
#> GSM617626     1  0.7407    0.36228 0.548 0.176 0.008 0.268
#> GSM617627     2  0.7102    0.26058 0.000 0.540 0.156 0.304
#> GSM617628     3  0.5142    0.59887 0.192 0.000 0.744 0.064
#> GSM617632     1  0.5707    0.60785 0.680 0.008 0.044 0.268
#> GSM617634     4  0.8445    0.44675 0.056 0.308 0.160 0.476
#> GSM617635     1  0.6854    0.55941 0.600 0.004 0.136 0.260
#> GSM617636     1  0.7366    0.41388 0.484 0.000 0.172 0.344
#> GSM617637     1  0.3988    0.66239 0.820 0.004 0.020 0.156
#> GSM617638     4  0.7870    0.47662 0.044 0.236 0.156 0.564
#> GSM617639     1  0.3243    0.68700 0.876 0.000 0.036 0.088
#> GSM617640     2  0.3569    0.67851 0.000 0.804 0.000 0.196
#> GSM617641     2  0.0921    0.70708 0.000 0.972 0.000 0.028
#> GSM617643     2  0.3074    0.69217 0.000 0.848 0.000 0.152
#> GSM617644     2  0.2081    0.70872 0.000 0.916 0.000 0.084
#> GSM617647     2  0.6483    0.42193 0.092 0.584 0.000 0.324
#> GSM617648     2  0.5093    0.59337 0.008 0.704 0.016 0.272
#> GSM617649     2  0.6626    0.38733 0.012 0.580 0.068 0.340
#> GSM617650     1  0.5404    0.55978 0.700 0.000 0.248 0.052
#> GSM617651     1  0.2399    0.68168 0.920 0.000 0.032 0.048
#> GSM617653     1  0.3048    0.68066 0.876 0.000 0.016 0.108
#> GSM617654     2  0.6563    0.19408 0.056 0.488 0.008 0.448
#> GSM617583     3  0.5203    0.59273 0.232 0.000 0.720 0.048
#> GSM617584     2  0.6334    0.47443 0.120 0.692 0.016 0.172
#> GSM617585     2  0.6080    0.47315 0.000 0.684 0.156 0.160
#> GSM617586     3  0.3241    0.61944 0.040 0.004 0.884 0.072
#> GSM617587     3  0.7802    0.36566 0.108 0.084 0.600 0.208
#> GSM617589     2  0.1771    0.70423 0.012 0.948 0.004 0.036
#> GSM617591     2  0.6206    0.49840 0.008 0.692 0.168 0.132
#> GSM617593     1  0.2002    0.68001 0.936 0.000 0.044 0.020
#> GSM617594     2  0.8825    0.11720 0.156 0.492 0.108 0.244
#> GSM617595     1  0.2996    0.68124 0.892 0.000 0.044 0.064
#> GSM617596     1  0.6011    0.62049 0.688 0.000 0.132 0.180
#> GSM617597     3  0.6941    0.26329 0.360 0.000 0.520 0.120
#> GSM617598     1  0.2256    0.68115 0.924 0.000 0.020 0.056
#> GSM617599     2  0.8799   -0.22372 0.112 0.400 0.108 0.380
#> GSM617600     3  0.2676    0.60760 0.012 0.000 0.896 0.092
#> GSM617601     2  0.2530    0.70684 0.000 0.896 0.004 0.100
#> GSM617602     3  0.4841    0.58170 0.080 0.000 0.780 0.140
#> GSM617603     2  0.1792    0.70757 0.000 0.932 0.000 0.068
#> GSM617604     3  0.7760   -0.01644 0.400 0.008 0.416 0.176
#> GSM617605     2  0.1211    0.70662 0.000 0.960 0.000 0.040
#> GSM617606     2  0.6843    0.37496 0.016 0.604 0.092 0.288
#> GSM617610     1  0.2587    0.68156 0.908 0.004 0.012 0.076
#> GSM617611     1  0.4370    0.63970 0.800 0.000 0.156 0.044
#> GSM617613     3  0.2408    0.59456 0.000 0.000 0.896 0.104
#> GSM617614     3  0.6055    0.54322 0.240 0.000 0.664 0.096
#> GSM617621     1  0.5556    0.64627 0.720 0.000 0.092 0.188
#> GSM617629     4  0.8279    0.27812 0.080 0.096 0.348 0.476
#> GSM617630     4  0.8842    0.50092 0.092 0.188 0.236 0.484
#> GSM617631     3  0.1798    0.61368 0.016 0.000 0.944 0.040
#> GSM617633     3  0.7581   -0.00897 0.380 0.000 0.424 0.196
#> GSM617642     3  0.5292    0.59522 0.208 0.000 0.728 0.064
#> GSM617645     2  0.4720    0.56629 0.000 0.672 0.004 0.324
#> GSM617646     1  0.8527    0.40318 0.500 0.072 0.160 0.268
#> GSM617652     1  0.7481    0.11111 0.476 0.012 0.384 0.128
#> GSM617655     3  0.3255    0.59762 0.016 0.012 0.880 0.092
#> GSM617656     3  0.1724    0.61883 0.020 0.000 0.948 0.032
#> GSM617657     3  0.5850    0.37566 0.004 0.100 0.708 0.188
#> GSM617658     3  0.6834    0.46918 0.240 0.000 0.596 0.164
#> GSM617659     1  0.5420    0.50814 0.684 0.000 0.272 0.044

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1    p2    p3    p4    p5
#> GSM617581     5   0.921    0.30957 0.236 0.088 0.108 0.196 0.372
#> GSM617582     5   0.926    0.26917 0.140 0.148 0.192 0.116 0.404
#> GSM617588     4   0.117    0.62059 0.000 0.032 0.000 0.960 0.008
#> GSM617590     4   0.111    0.61785 0.000 0.024 0.000 0.964 0.012
#> GSM617592     4   0.128    0.61803 0.004 0.020 0.000 0.960 0.016
#> GSM617607     1   0.758    0.32161 0.516 0.152 0.140 0.000 0.192
#> GSM617608     1   0.720    0.38971 0.544 0.084 0.220 0.000 0.152
#> GSM617609     3   0.701    0.44060 0.060 0.188 0.604 0.020 0.128
#> GSM617612     1   0.571    0.50110 0.716 0.040 0.104 0.012 0.128
#> GSM617615     4   0.518    0.53930 0.004 0.156 0.044 0.740 0.056
#> GSM617616     1   0.850    0.08621 0.416 0.188 0.076 0.044 0.276
#> GSM617617     4   0.645    0.19307 0.012 0.336 0.000 0.512 0.140
#> GSM617618     1   0.855   -0.00908 0.368 0.172 0.108 0.028 0.324
#> GSM617619     3   0.806   -0.19257 0.000 0.324 0.380 0.164 0.132
#> GSM617620     4   0.248    0.62246 0.000 0.084 0.000 0.892 0.024
#> GSM617622     4   0.644    0.44426 0.012 0.216 0.064 0.636 0.072
#> GSM617623     5   0.900    0.25155 0.264 0.180 0.032 0.184 0.340
#> GSM617624     2   0.780    0.40427 0.016 0.512 0.104 0.232 0.136
#> GSM617625     3   0.687    0.38071 0.284 0.036 0.524 0.000 0.156
#> GSM617626     1   0.799   -0.01063 0.464 0.140 0.008 0.132 0.256
#> GSM617627     2   0.752    0.21491 0.012 0.424 0.136 0.376 0.052
#> GSM617628     3   0.636    0.50935 0.188 0.048 0.628 0.000 0.136
#> GSM617632     1   0.718    0.17430 0.476 0.100 0.044 0.016 0.364
#> GSM617634     2   0.885    0.19697 0.060 0.412 0.100 0.208 0.220
#> GSM617635     1   0.712    0.37830 0.576 0.188 0.068 0.008 0.160
#> GSM617636     5   0.808    0.08807 0.292 0.168 0.120 0.004 0.416
#> GSM617637     1   0.535    0.47028 0.708 0.164 0.012 0.004 0.112
#> GSM617638     2   0.848    0.33026 0.060 0.488 0.108 0.168 0.176
#> GSM617639     1   0.380    0.52830 0.820 0.044 0.012 0.000 0.124
#> GSM617640     4   0.458    0.50816 0.000 0.268 0.000 0.692 0.040
#> GSM617641     4   0.214    0.62267 0.000 0.088 0.000 0.904 0.008
#> GSM617643     4   0.456    0.52931 0.004 0.252 0.004 0.712 0.028
#> GSM617644     4   0.373    0.59633 0.000 0.160 0.000 0.800 0.040
#> GSM617647     4   0.796    0.02046 0.100 0.328 0.024 0.444 0.104
#> GSM617648     4   0.651    0.25874 0.032 0.340 0.004 0.536 0.088
#> GSM617649     2   0.779    0.16055 0.016 0.408 0.092 0.380 0.104
#> GSM617650     1   0.605    0.47013 0.644 0.028 0.188 0.000 0.140
#> GSM617651     1   0.360    0.53850 0.832 0.024 0.020 0.000 0.124
#> GSM617653     1   0.451    0.46289 0.728 0.016 0.024 0.000 0.232
#> GSM617654     4   0.778   -0.17606 0.072 0.376 0.012 0.400 0.140
#> GSM617583     3   0.594    0.52884 0.176 0.040 0.676 0.004 0.104
#> GSM617584     4   0.778    0.20552 0.080 0.160 0.032 0.540 0.188
#> GSM617585     4   0.691    0.25061 0.000 0.128 0.144 0.600 0.128
#> GSM617586     3   0.502    0.57477 0.108 0.064 0.760 0.000 0.068
#> GSM617587     3   0.845    0.35735 0.120 0.164 0.500 0.064 0.152
#> GSM617589     4   0.171    0.61770 0.012 0.024 0.000 0.944 0.020
#> GSM617591     4   0.674    0.31233 0.000 0.160 0.152 0.608 0.080
#> GSM617593     1   0.325    0.53829 0.864 0.016 0.040 0.000 0.080
#> GSM617594     4   0.886   -0.23097 0.112 0.332 0.060 0.352 0.144
#> GSM617595     1   0.328    0.53939 0.856 0.044 0.008 0.000 0.092
#> GSM617596     1   0.751    0.14090 0.444 0.084 0.092 0.012 0.368
#> GSM617597     3   0.762    0.07975 0.348 0.064 0.396 0.000 0.192
#> GSM617598     1   0.360    0.54299 0.848 0.028 0.044 0.000 0.080
#> GSM617599     2   0.926    0.23689 0.164 0.332 0.060 0.268 0.176
#> GSM617600     3   0.360    0.57026 0.004 0.060 0.832 0.000 0.104
#> GSM617601     4   0.417    0.58622 0.008 0.156 0.008 0.792 0.036
#> GSM617602     3   0.587    0.48165 0.064 0.068 0.672 0.000 0.196
#> GSM617603     4   0.297    0.61249 0.000 0.128 0.000 0.852 0.020
#> GSM617604     3   0.822   -0.06509 0.192 0.056 0.384 0.032 0.336
#> GSM617605     4   0.198    0.61986 0.000 0.044 0.004 0.928 0.024
#> GSM617606     4   0.752    0.25254 0.028 0.240 0.068 0.544 0.120
#> GSM617610     1   0.282    0.53430 0.888 0.040 0.004 0.004 0.064
#> GSM617611     1   0.498    0.50917 0.748 0.032 0.144 0.000 0.076
#> GSM617613     3   0.379    0.56058 0.000 0.072 0.820 0.004 0.104
#> GSM617614     3   0.604    0.45324 0.216 0.012 0.616 0.000 0.156
#> GSM617621     1   0.679    0.22614 0.512 0.056 0.068 0.008 0.356
#> GSM617629     5   0.897    0.02685 0.080 0.316 0.200 0.072 0.332
#> GSM617630     2   0.872    0.14935 0.068 0.456 0.192 0.108 0.176
#> GSM617631     3   0.322    0.57366 0.012 0.016 0.848 0.000 0.124
#> GSM617633     1   0.848   -0.06314 0.292 0.164 0.268 0.000 0.276
#> GSM617642     3   0.648    0.49838 0.180 0.048 0.616 0.000 0.156
#> GSM617645     4   0.644    0.27124 0.032 0.320 0.004 0.556 0.088
#> GSM617646     1   0.844    0.17579 0.468 0.216 0.104 0.044 0.168
#> GSM617652     1   0.815    0.18015 0.416 0.120 0.268 0.004 0.192
#> GSM617655     3   0.461    0.57287 0.028 0.072 0.800 0.016 0.084
#> GSM617656     3   0.128    0.58513 0.004 0.020 0.960 0.000 0.016
#> GSM617657     3   0.716    0.36188 0.008 0.172 0.588 0.108 0.124
#> GSM617658     3   0.698    0.27087 0.156 0.040 0.508 0.000 0.296
#> GSM617659     1   0.620    0.42215 0.580 0.008 0.244 0.000 0.168

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>           class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM617581     6   0.829     0.1384 0.124 0.072 0.056 0.248 0.060 0.440
#> GSM617582     5   0.943     0.1415 0.112 0.112 0.112 0.112 0.300 0.252
#> GSM617588     4   0.271     0.5612 0.000 0.080 0.000 0.876 0.020 0.024
#> GSM617590     4   0.246     0.5637 0.000 0.064 0.000 0.888 0.044 0.004
#> GSM617592     4   0.154     0.5617 0.000 0.016 0.000 0.944 0.016 0.024
#> GSM617607     1   0.837     0.1125 0.392 0.116 0.128 0.000 0.172 0.192
#> GSM617608     1   0.764     0.2776 0.484 0.056 0.180 0.000 0.120 0.160
#> GSM617609     3   0.750     0.3747 0.076 0.160 0.524 0.004 0.152 0.084
#> GSM617612     1   0.620     0.3873 0.668 0.052 0.104 0.020 0.036 0.120
#> GSM617615     4   0.651     0.4183 0.012 0.196 0.044 0.616 0.076 0.056
#> GSM617616     1   0.901    -0.0641 0.344 0.112 0.072 0.056 0.232 0.184
#> GSM617617     2   0.669     0.1389 0.028 0.456 0.000 0.368 0.104 0.044
#> GSM617618     5   0.854     0.1359 0.300 0.060 0.060 0.044 0.324 0.212
#> GSM617619     3   0.889    -0.0881 0.008 0.204 0.292 0.144 0.236 0.116
#> GSM617620     4   0.306     0.5595 0.000 0.072 0.000 0.860 0.032 0.036
#> GSM617622     4   0.735     0.2945 0.008 0.192 0.060 0.540 0.088 0.112
#> GSM617623     6   0.836     0.1497 0.188 0.084 0.020 0.204 0.084 0.420
#> GSM617624     2   0.840     0.2402 0.016 0.356 0.096 0.156 0.300 0.076
#> GSM617625     3   0.706     0.3277 0.276 0.028 0.492 0.000 0.080 0.124
#> GSM617626     1   0.889    -0.1099 0.312 0.132 0.016 0.164 0.116 0.260
#> GSM617627     2   0.825     0.2833 0.016 0.384 0.100 0.272 0.176 0.052
#> GSM617628     3   0.691     0.4235 0.212 0.040 0.552 0.000 0.112 0.084
#> GSM617632     1   0.795     0.0314 0.384 0.052 0.048 0.016 0.268 0.232
#> GSM617634     5   0.840    -0.0566 0.052 0.224 0.056 0.156 0.432 0.080
#> GSM617635     1   0.785     0.1332 0.408 0.156 0.056 0.004 0.292 0.084
#> GSM617636     5   0.802     0.1389 0.188 0.064 0.096 0.000 0.380 0.272
#> GSM617637     1   0.599     0.3975 0.664 0.100 0.012 0.008 0.116 0.100
#> GSM617638     2   0.816     0.1517 0.040 0.404 0.060 0.112 0.312 0.072
#> GSM617639     1   0.588     0.3724 0.632 0.112 0.000 0.000 0.096 0.160
#> GSM617640     4   0.471     0.2392 0.004 0.368 0.000 0.588 0.036 0.004
#> GSM617641     4   0.168     0.5633 0.000 0.036 0.000 0.936 0.012 0.016
#> GSM617643     4   0.593     0.2898 0.004 0.340 0.004 0.540 0.072 0.040
#> GSM617644     4   0.500     0.4792 0.000 0.240 0.004 0.672 0.052 0.032
#> GSM617647     4   0.795    -0.0506 0.056 0.316 0.012 0.396 0.136 0.084
#> GSM617648     4   0.740     0.0271 0.008 0.368 0.016 0.380 0.148 0.080
#> GSM617649     2   0.817     0.2405 0.028 0.404 0.064 0.288 0.152 0.064
#> GSM617650     1   0.625     0.3746 0.600 0.012 0.204 0.000 0.076 0.108
#> GSM617651     1   0.407     0.4444 0.800 0.016 0.020 0.000 0.064 0.100
#> GSM617653     1   0.616     0.2095 0.560 0.032 0.024 0.012 0.056 0.316
#> GSM617654     2   0.701     0.2708 0.036 0.484 0.008 0.316 0.112 0.044
#> GSM617583     3   0.610     0.4351 0.248 0.008 0.600 0.008 0.056 0.080
#> GSM617584     4   0.684     0.1863 0.060 0.108 0.004 0.508 0.024 0.296
#> GSM617585     4   0.677     0.3826 0.004 0.116 0.084 0.612 0.116 0.068
#> GSM617586     3   0.585     0.5242 0.072 0.024 0.680 0.004 0.116 0.104
#> GSM617587     3   0.858     0.3303 0.092 0.124 0.456 0.056 0.156 0.116
#> GSM617589     4   0.425     0.5475 0.028 0.068 0.000 0.800 0.072 0.032
#> GSM617591     4   0.777     0.2021 0.004 0.180 0.156 0.488 0.088 0.084
#> GSM617593     1   0.379     0.4209 0.800 0.008 0.044 0.000 0.012 0.136
#> GSM617594     4   0.911    -0.2074 0.128 0.288 0.044 0.292 0.148 0.100
#> GSM617595     1   0.547     0.4405 0.716 0.064 0.048 0.000 0.072 0.100
#> GSM617596     6   0.763     0.1178 0.340 0.044 0.096 0.012 0.092 0.416
#> GSM617597     3   0.753     0.1313 0.280 0.028 0.412 0.000 0.084 0.196
#> GSM617598     1   0.435     0.4439 0.784 0.028 0.036 0.000 0.036 0.116
#> GSM617599     2   0.926     0.2191 0.124 0.332 0.056 0.216 0.148 0.124
#> GSM617600     3   0.544     0.4899 0.020 0.048 0.692 0.000 0.160 0.080
#> GSM617601     4   0.561     0.4631 0.008 0.204 0.012 0.664 0.072 0.040
#> GSM617602     3   0.691     0.1775 0.044 0.028 0.504 0.000 0.232 0.192
#> GSM617603     4   0.447     0.5401 0.000 0.132 0.004 0.760 0.068 0.036
#> GSM617604     6   0.769     0.2096 0.156 0.020 0.300 0.032 0.064 0.428
#> GSM617605     4   0.276     0.5617 0.000 0.052 0.004 0.884 0.032 0.028
#> GSM617606     4   0.793     0.1188 0.032 0.240 0.020 0.444 0.160 0.104
#> GSM617610     1   0.391     0.4399 0.816 0.036 0.008 0.004 0.040 0.096
#> GSM617611     1   0.499     0.4320 0.736 0.020 0.128 0.000 0.044 0.072
#> GSM617613     3   0.497     0.4779 0.004 0.044 0.724 0.008 0.164 0.056
#> GSM617614     3   0.617     0.3425 0.156 0.012 0.576 0.000 0.032 0.224
#> GSM617621     6   0.706     0.0687 0.384 0.032 0.068 0.016 0.064 0.436
#> GSM617629     5   0.775     0.2934 0.048 0.124 0.168 0.032 0.524 0.104
#> GSM617630     2   0.878     0.1072 0.060 0.416 0.152 0.080 0.184 0.108
#> GSM617631     3   0.422     0.4958 0.016 0.004 0.772 0.000 0.088 0.120
#> GSM617633     5   0.823     0.1590 0.224 0.056 0.232 0.000 0.352 0.136
#> GSM617642     3   0.576     0.4557 0.144 0.012 0.652 0.000 0.044 0.148
#> GSM617645     2   0.626     0.1613 0.028 0.492 0.004 0.384 0.052 0.040
#> GSM617646     1   0.900    -0.0027 0.296 0.200 0.096 0.016 0.188 0.204
#> GSM617652     1   0.869     0.0534 0.336 0.088 0.284 0.020 0.120 0.152
#> GSM617655     3   0.471     0.5256 0.012 0.040 0.780 0.024 0.064 0.080
#> GSM617656     3   0.248     0.5461 0.008 0.012 0.900 0.000 0.040 0.040
#> GSM617657     3   0.715     0.3011 0.000 0.092 0.540 0.092 0.208 0.068
#> GSM617658     6   0.750     0.0116 0.132 0.028 0.352 0.000 0.108 0.380
#> GSM617659     1   0.657     0.2076 0.500 0.004 0.236 0.000 0.044 0.216

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

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

collect_plots(res)

plot of chunk CV-pam-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.368           0.725       0.872         0.4987 0.496   0.496
#> 3 3 0.530           0.662       0.844         0.3111 0.799   0.614
#> 4 4 0.507           0.608       0.819         0.0393 0.975   0.929
#> 5 5 0.509           0.553       0.795         0.0212 0.981   0.944
#> 6 6 0.512           0.528       0.789         0.0150 0.968   0.902

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
#> GSM617581     2  0.4022     0.8125 0.080 0.920
#> GSM617582     2  0.7674     0.7135 0.224 0.776
#> GSM617588     2  0.0000     0.8405 0.000 1.000
#> GSM617590     2  0.0376     0.8408 0.004 0.996
#> GSM617592     2  0.0000     0.8405 0.000 1.000
#> GSM617607     1  0.0672     0.8410 0.992 0.008
#> GSM617608     1  0.1184     0.8409 0.984 0.016
#> GSM617609     1  0.0672     0.8410 0.992 0.008
#> GSM617612     1  0.6048     0.7842 0.852 0.148
#> GSM617615     2  0.0672     0.8404 0.008 0.992
#> GSM617616     2  0.9993    -0.0354 0.484 0.516
#> GSM617617     2  0.3274     0.8233 0.060 0.940
#> GSM617618     2  0.9000     0.5270 0.316 0.684
#> GSM617619     2  0.1633     0.8399 0.024 0.976
#> GSM617620     2  0.0000     0.8405 0.000 1.000
#> GSM617622     2  0.0376     0.8410 0.004 0.996
#> GSM617623     1  0.9970     0.1863 0.532 0.468
#> GSM617624     2  0.8386     0.6218 0.268 0.732
#> GSM617625     1  0.4298     0.8149 0.912 0.088
#> GSM617626     2  0.4022     0.8125 0.080 0.920
#> GSM617627     2  0.6801     0.7207 0.180 0.820
#> GSM617628     1  0.4815     0.8059 0.896 0.104
#> GSM617632     2  0.9970     0.0359 0.468 0.532
#> GSM617634     2  0.1633     0.8380 0.024 0.976
#> GSM617635     1  0.2603     0.8345 0.956 0.044
#> GSM617636     1  0.9358     0.5208 0.648 0.352
#> GSM617637     1  0.8555     0.6414 0.720 0.280
#> GSM617638     1  0.9000     0.4299 0.684 0.316
#> GSM617639     1  0.7299     0.7301 0.796 0.204
#> GSM617640     2  0.2778     0.8288 0.048 0.952
#> GSM617641     2  0.0938     0.8400 0.012 0.988
#> GSM617643     2  0.0000     0.8405 0.000 1.000
#> GSM617644     2  0.0000     0.8405 0.000 1.000
#> GSM617647     2  0.8499     0.6200 0.276 0.724
#> GSM617648     2  0.0000     0.8405 0.000 1.000
#> GSM617649     2  0.5842     0.8006 0.140 0.860
#> GSM617650     1  0.0000     0.8397 1.000 0.000
#> GSM617651     1  0.5946     0.7838 0.856 0.144
#> GSM617653     1  0.1633     0.8396 0.976 0.024
#> GSM617654     2  0.4161     0.8113 0.084 0.916
#> GSM617583     1  0.4815     0.8062 0.896 0.104
#> GSM617584     2  0.0672     0.8413 0.008 0.992
#> GSM617585     2  0.7453     0.6862 0.212 0.788
#> GSM617586     1  0.4690     0.8063 0.900 0.100
#> GSM617587     1  0.9358     0.5105 0.648 0.352
#> GSM617589     2  0.0000     0.8405 0.000 1.000
#> GSM617591     2  0.5294     0.7776 0.120 0.880
#> GSM617593     1  0.7453     0.7230 0.788 0.212
#> GSM617594     2  0.9896     0.1366 0.440 0.560
#> GSM617595     1  0.7528     0.7174 0.784 0.216
#> GSM617596     1  0.0672     0.8405 0.992 0.008
#> GSM617597     1  0.0376     0.8398 0.996 0.004
#> GSM617598     1  0.7674     0.7087 0.776 0.224
#> GSM617599     2  0.4431     0.8146 0.092 0.908
#> GSM617600     1  0.3733     0.8160 0.928 0.072
#> GSM617601     2  0.0376     0.8399 0.004 0.996
#> GSM617602     1  0.0000     0.8397 1.000 0.000
#> GSM617603     2  0.7299     0.6944 0.204 0.796
#> GSM617604     1  0.0672     0.8406 0.992 0.008
#> GSM617605     2  0.0672     0.8408 0.008 0.992
#> GSM617606     2  0.7745     0.6670 0.228 0.772
#> GSM617610     1  0.8081     0.6826 0.752 0.248
#> GSM617611     1  0.1184     0.8409 0.984 0.016
#> GSM617613     1  0.7528     0.6981 0.784 0.216
#> GSM617614     1  0.0376     0.8398 0.996 0.004
#> GSM617621     1  0.7299     0.7299 0.796 0.204
#> GSM617629     1  0.9998    -0.2066 0.508 0.492
#> GSM617630     1  0.6712     0.7326 0.824 0.176
#> GSM617631     1  0.4022     0.8120 0.920 0.080
#> GSM617633     1  0.0000     0.8397 1.000 0.000
#> GSM617642     1  0.0672     0.8397 0.992 0.008
#> GSM617645     2  0.9129     0.5098 0.328 0.672
#> GSM617646     1  0.7299     0.7393 0.796 0.204
#> GSM617652     1  0.0000     0.8397 1.000 0.000
#> GSM617655     2  0.9044     0.5513 0.320 0.680
#> GSM617656     1  0.4022     0.8120 0.920 0.080
#> GSM617657     1  0.4562     0.8090 0.904 0.096
#> GSM617658     1  0.0376     0.8398 0.996 0.004
#> GSM617659     1  0.0000     0.8397 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
#> GSM617581     2  0.0237     0.8185 0.000 0.996 0.004
#> GSM617582     2  0.5551     0.6656 0.212 0.768 0.020
#> GSM617588     2  0.0000     0.8188 0.000 1.000 0.000
#> GSM617590     2  0.0237     0.8186 0.000 0.996 0.004
#> GSM617592     2  0.0000     0.8188 0.000 1.000 0.000
#> GSM617607     1  0.0000     0.8136 1.000 0.000 0.000
#> GSM617608     1  0.0000     0.8136 1.000 0.000 0.000
#> GSM617609     1  0.5785     0.6316 0.696 0.004 0.300
#> GSM617612     1  0.1267     0.8089 0.972 0.024 0.004
#> GSM617615     2  0.6204     0.2587 0.000 0.576 0.424
#> GSM617616     2  0.7178     0.0545 0.464 0.512 0.024
#> GSM617617     2  0.0000     0.8188 0.000 1.000 0.000
#> GSM617618     2  0.5678     0.5086 0.316 0.684 0.000
#> GSM617619     2  0.4634     0.7107 0.012 0.824 0.164
#> GSM617620     2  0.0000     0.8188 0.000 1.000 0.000
#> GSM617622     2  0.0424     0.8182 0.000 0.992 0.008
#> GSM617623     1  0.7647     0.1438 0.516 0.440 0.044
#> GSM617624     3  0.8604     0.3510 0.124 0.312 0.564
#> GSM617625     3  0.1950     0.7718 0.040 0.008 0.952
#> GSM617626     2  0.0000     0.8188 0.000 1.000 0.000
#> GSM617627     2  0.6095     0.2757 0.000 0.608 0.392
#> GSM617628     3  0.0237     0.7826 0.004 0.000 0.996
#> GSM617632     2  0.6286     0.0918 0.464 0.536 0.000
#> GSM617634     2  0.1860     0.8015 0.000 0.948 0.052
#> GSM617635     1  0.2866     0.7963 0.916 0.008 0.076
#> GSM617636     1  0.5529     0.5545 0.704 0.296 0.000
#> GSM617637     1  0.3686     0.7357 0.860 0.140 0.000
#> GSM617638     3  0.9811    -0.1018 0.376 0.240 0.384
#> GSM617639     1  0.0000     0.8136 1.000 0.000 0.000
#> GSM617640     2  0.0000     0.8188 0.000 1.000 0.000
#> GSM617641     2  0.0892     0.8152 0.000 0.980 0.020
#> GSM617643     2  0.0000     0.8188 0.000 1.000 0.000
#> GSM617644     2  0.0000     0.8188 0.000 1.000 0.000
#> GSM617647     2  0.6482     0.5669 0.296 0.680 0.024
#> GSM617648     2  0.0000     0.8188 0.000 1.000 0.000
#> GSM617649     2  0.3340     0.7419 0.000 0.880 0.120
#> GSM617650     1  0.0000     0.8136 1.000 0.000 0.000
#> GSM617651     1  0.0000     0.8136 1.000 0.000 0.000
#> GSM617653     1  0.1860     0.8059 0.948 0.000 0.052
#> GSM617654     2  0.0424     0.8178 0.008 0.992 0.000
#> GSM617583     3  0.0000     0.7838 0.000 0.000 1.000
#> GSM617584     2  0.0747     0.8161 0.000 0.984 0.016
#> GSM617585     3  0.4555     0.6544 0.000 0.200 0.800
#> GSM617586     3  0.0000     0.7838 0.000 0.000 1.000
#> GSM617587     3  0.4371     0.7286 0.032 0.108 0.860
#> GSM617589     2  0.4796     0.6531 0.000 0.780 0.220
#> GSM617591     3  0.4796     0.6016 0.000 0.220 0.780
#> GSM617593     1  0.0000     0.8136 1.000 0.000 0.000
#> GSM617594     3  0.9925     0.2225 0.336 0.280 0.384
#> GSM617595     1  0.0000     0.8136 1.000 0.000 0.000
#> GSM617596     1  0.5948     0.5692 0.640 0.000 0.360
#> GSM617597     1  0.3192     0.7775 0.888 0.000 0.112
#> GSM617598     1  0.0000     0.8136 1.000 0.000 0.000
#> GSM617599     2  0.1529     0.8042 0.040 0.960 0.000
#> GSM617600     3  0.5706     0.5069 0.320 0.000 0.680
#> GSM617601     2  0.4796     0.6537 0.000 0.780 0.220
#> GSM617602     1  0.6008     0.5569 0.628 0.000 0.372
#> GSM617603     2  0.6026     0.2849 0.000 0.624 0.376
#> GSM617604     1  0.6008     0.5537 0.628 0.000 0.372
#> GSM617605     2  0.2261     0.7945 0.000 0.932 0.068
#> GSM617606     3  0.0592     0.7830 0.000 0.012 0.988
#> GSM617610     1  0.2066     0.7910 0.940 0.060 0.000
#> GSM617611     1  0.1163     0.8116 0.972 0.000 0.028
#> GSM617613     3  0.0000     0.7838 0.000 0.000 1.000
#> GSM617614     1  0.6235     0.4559 0.564 0.000 0.436
#> GSM617621     1  0.0000     0.8136 1.000 0.000 0.000
#> GSM617629     3  0.9734     0.1056 0.224 0.376 0.400
#> GSM617630     1  0.7143     0.4913 0.576 0.028 0.396
#> GSM617631     3  0.0000     0.7838 0.000 0.000 1.000
#> GSM617633     1  0.0000     0.8136 1.000 0.000 0.000
#> GSM617642     1  0.6302     0.3557 0.520 0.000 0.480
#> GSM617645     2  0.6148     0.4581 0.356 0.640 0.004
#> GSM617646     1  0.4865     0.7209 0.832 0.136 0.032
#> GSM617652     1  0.1860     0.8056 0.948 0.000 0.052
#> GSM617655     3  0.0000     0.7838 0.000 0.000 1.000
#> GSM617656     3  0.3412     0.7172 0.124 0.000 0.876
#> GSM617657     3  0.0000     0.7838 0.000 0.000 1.000
#> GSM617658     1  0.6026     0.5485 0.624 0.000 0.376
#> GSM617659     1  0.0000     0.8136 1.000 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM617581     2  0.0188     0.7619 0.000 0.996 0.000 0.004
#> GSM617582     2  0.4399     0.6273 0.212 0.768 0.020 0.000
#> GSM617588     2  0.0469     0.7604 0.000 0.988 0.000 0.012
#> GSM617590     2  0.4509     0.5129 0.000 0.708 0.004 0.288
#> GSM617592     2  0.2868     0.6950 0.000 0.864 0.000 0.136
#> GSM617607     1  0.0000     0.7919 1.000 0.000 0.000 0.000
#> GSM617608     1  0.0000     0.7919 1.000 0.000 0.000 0.000
#> GSM617609     1  0.6313     0.6187 0.652 0.000 0.220 0.128
#> GSM617612     1  0.1004     0.7882 0.972 0.024 0.004 0.000
#> GSM617615     2  0.6871     0.0274 0.000 0.480 0.416 0.104
#> GSM617616     2  0.5688     0.0156 0.464 0.512 0.024 0.000
#> GSM617617     2  0.0000     0.7615 0.000 1.000 0.000 0.000
#> GSM617618     2  0.4500     0.4841 0.316 0.684 0.000 0.000
#> GSM617619     2  0.4781     0.6561 0.012 0.788 0.160 0.040
#> GSM617620     2  0.0000     0.7615 0.000 1.000 0.000 0.000
#> GSM617622     2  0.0336     0.7621 0.000 0.992 0.008 0.000
#> GSM617623     1  0.7276     0.2630 0.516 0.380 0.032 0.072
#> GSM617624     3  0.7862     0.2969 0.096 0.292 0.548 0.064
#> GSM617625     3  0.2597     0.6832 0.040 0.004 0.916 0.040
#> GSM617626     2  0.0000     0.7615 0.000 1.000 0.000 0.000
#> GSM617627     2  0.5957     0.2968 0.000 0.588 0.364 0.048
#> GSM617628     3  0.0524     0.6807 0.004 0.000 0.988 0.008
#> GSM617632     2  0.4981     0.0504 0.464 0.536 0.000 0.000
#> GSM617634     2  0.1661     0.7512 0.000 0.944 0.052 0.004
#> GSM617635     1  0.2271     0.7791 0.916 0.008 0.076 0.000
#> GSM617636     1  0.4382     0.5672 0.704 0.296 0.000 0.000
#> GSM617637     1  0.2921     0.7214 0.860 0.140 0.000 0.000
#> GSM617638     1  0.9104     0.1398 0.376 0.236 0.316 0.072
#> GSM617639     1  0.0000     0.7919 1.000 0.000 0.000 0.000
#> GSM617640     2  0.0188     0.7619 0.000 0.996 0.000 0.004
#> GSM617641     2  0.4228     0.6086 0.000 0.760 0.008 0.232
#> GSM617643     2  0.0000     0.7615 0.000 1.000 0.000 0.000
#> GSM617644     2  0.0707     0.7602 0.000 0.980 0.000 0.020
#> GSM617647     2  0.5963     0.5150 0.284 0.660 0.016 0.040
#> GSM617648     2  0.0000     0.7615 0.000 1.000 0.000 0.000
#> GSM617649     2  0.4549     0.6540 0.000 0.804 0.096 0.100
#> GSM617650     1  0.0000     0.7919 1.000 0.000 0.000 0.000
#> GSM617651     1  0.0000     0.7919 1.000 0.000 0.000 0.000
#> GSM617653     1  0.1474     0.7868 0.948 0.000 0.052 0.000
#> GSM617654     2  0.0524     0.7619 0.008 0.988 0.000 0.004
#> GSM617583     3  0.0376     0.6855 0.004 0.000 0.992 0.004
#> GSM617584     2  0.1890     0.7462 0.000 0.936 0.008 0.056
#> GSM617585     3  0.3569     0.5240 0.000 0.196 0.804 0.000
#> GSM617586     3  0.2345     0.6743 0.000 0.000 0.900 0.100
#> GSM617587     3  0.5477     0.6113 0.020 0.084 0.764 0.132
#> GSM617589     2  0.3945     0.6258 0.000 0.780 0.216 0.004
#> GSM617591     3  0.5325     0.5567 0.000 0.160 0.744 0.096
#> GSM617593     1  0.0000     0.7919 1.000 0.000 0.000 0.000
#> GSM617594     3  0.8698     0.1271 0.304 0.280 0.380 0.036
#> GSM617595     1  0.0000     0.7919 1.000 0.000 0.000 0.000
#> GSM617596     1  0.4905     0.5914 0.632 0.000 0.364 0.004
#> GSM617597     1  0.3691     0.7482 0.856 0.000 0.076 0.068
#> GSM617598     1  0.0000     0.7919 1.000 0.000 0.000 0.000
#> GSM617599     2  0.2319     0.7423 0.040 0.924 0.000 0.036
#> GSM617600     3  0.4980     0.4181 0.304 0.000 0.680 0.016
#> GSM617601     2  0.4364     0.6136 0.000 0.764 0.220 0.016
#> GSM617602     1  0.5253     0.5873 0.624 0.000 0.360 0.016
#> GSM617603     4  0.4244     0.0000 0.000 0.032 0.168 0.800
#> GSM617604     1  0.4950     0.5784 0.620 0.000 0.376 0.004
#> GSM617605     2  0.5827     0.4386 0.000 0.632 0.052 0.316
#> GSM617606     3  0.1452     0.6907 0.000 0.008 0.956 0.036
#> GSM617610     1  0.1637     0.7722 0.940 0.060 0.000 0.000
#> GSM617611     1  0.1022     0.7905 0.968 0.000 0.032 0.000
#> GSM617613     3  0.0188     0.6823 0.000 0.000 0.996 0.004
#> GSM617614     1  0.5105     0.5022 0.564 0.000 0.432 0.004
#> GSM617621     1  0.0000     0.7919 1.000 0.000 0.000 0.000
#> GSM617629     3  0.8285    -0.0446 0.224 0.368 0.388 0.020
#> GSM617630     1  0.6016     0.5381 0.576 0.032 0.384 0.008
#> GSM617631     3  0.0188     0.6823 0.000 0.000 0.996 0.004
#> GSM617633     1  0.0000     0.7919 1.000 0.000 0.000 0.000
#> GSM617642     1  0.6686     0.4139 0.520 0.000 0.388 0.092
#> GSM617645     2  0.5478     0.4445 0.344 0.628 0.000 0.028
#> GSM617646     1  0.4441     0.7009 0.816 0.136 0.028 0.020
#> GSM617652     1  0.2227     0.7823 0.928 0.000 0.036 0.036
#> GSM617655     3  0.2589     0.6712 0.000 0.000 0.884 0.116
#> GSM617656     3  0.4827     0.5856 0.124 0.000 0.784 0.092
#> GSM617657     3  0.0921     0.6824 0.000 0.000 0.972 0.028
#> GSM617658     1  0.4964     0.5736 0.616 0.000 0.380 0.004
#> GSM617659     1  0.0000     0.7919 1.000 0.000 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1    p2    p3    p4 p5
#> GSM617581     2  0.0162     0.6277 0.000 0.996 0.000 0.000 NA
#> GSM617582     2  0.3789     0.4782 0.212 0.768 0.020 0.000 NA
#> GSM617588     2  0.1908     0.5706 0.000 0.908 0.000 0.092 NA
#> GSM617590     4  0.4307     0.3535 0.000 0.496 0.000 0.504 NA
#> GSM617592     2  0.3876     0.1049 0.000 0.684 0.000 0.316 NA
#> GSM617607     1  0.0000     0.8073 1.000 0.000 0.000 0.000 NA
#> GSM617608     1  0.0000     0.8073 1.000 0.000 0.000 0.000 NA
#> GSM617609     1  0.5602     0.6143 0.640 0.000 0.196 0.000 NA
#> GSM617612     1  0.0865     0.8045 0.972 0.024 0.004 0.000 NA
#> GSM617615     2  0.6188    -0.0434 0.000 0.448 0.416 0.000 NA
#> GSM617616     2  0.4900     0.0178 0.464 0.512 0.024 0.000 NA
#> GSM617617     2  0.0000     0.6273 0.000 1.000 0.000 0.000 NA
#> GSM617618     2  0.3876     0.3729 0.316 0.684 0.000 0.000 NA
#> GSM617619     2  0.4351     0.5040 0.012 0.784 0.160 0.012 NA
#> GSM617620     2  0.0290     0.6257 0.000 0.992 0.000 0.008 NA
#> GSM617622     2  0.0290     0.6276 0.000 0.992 0.008 0.000 NA
#> GSM617623     1  0.6292     0.2594 0.516 0.372 0.024 0.000 NA
#> GSM617624     3  0.7178     0.3229 0.092 0.292 0.536 0.016 NA
#> GSM617625     3  0.2308     0.7327 0.036 0.004 0.912 0.000 NA
#> GSM617626     2  0.0000     0.6273 0.000 1.000 0.000 0.000 NA
#> GSM617627     2  0.5478     0.0968 0.000 0.584 0.352 0.008 NA
#> GSM617628     3  0.0290     0.7260 0.000 0.000 0.992 0.000 NA
#> GSM617632     2  0.4291     0.0515 0.464 0.536 0.000 0.000 NA
#> GSM617634     2  0.1644     0.6125 0.000 0.940 0.048 0.008 NA
#> GSM617635     1  0.1956     0.7927 0.916 0.008 0.076 0.000 NA
#> GSM617636     1  0.3774     0.5702 0.704 0.296 0.000 0.000 NA
#> GSM617637     1  0.2516     0.7453 0.860 0.140 0.000 0.000 NA
#> GSM617638     1  0.8087     0.1373 0.368 0.236 0.308 0.004 NA
#> GSM617639     1  0.0000     0.8073 1.000 0.000 0.000 0.000 NA
#> GSM617640     2  0.0162     0.6275 0.000 0.996 0.000 0.000 NA
#> GSM617641     2  0.4621    -0.3207 0.000 0.576 0.004 0.412 NA
#> GSM617643     2  0.0000     0.6273 0.000 1.000 0.000 0.000 NA
#> GSM617644     2  0.0912     0.6199 0.000 0.972 0.000 0.016 NA
#> GSM617647     2  0.5162     0.3914 0.276 0.664 0.016 0.000 NA
#> GSM617648     2  0.0000     0.6273 0.000 1.000 0.000 0.000 NA
#> GSM617649     2  0.4342     0.4496 0.000 0.788 0.084 0.012 NA
#> GSM617650     1  0.0000     0.8073 1.000 0.000 0.000 0.000 NA
#> GSM617651     1  0.0000     0.8073 1.000 0.000 0.000 0.000 NA
#> GSM617653     1  0.1341     0.8007 0.944 0.000 0.056 0.000 NA
#> GSM617654     2  0.4196     0.2076 0.000 0.640 0.000 0.004 NA
#> GSM617583     3  0.0162     0.7285 0.000 0.000 0.996 0.000 NA
#> GSM617584     2  0.1764     0.5996 0.000 0.928 0.008 0.000 NA
#> GSM617585     3  0.3352     0.5897 0.000 0.192 0.800 0.004 NA
#> GSM617586     3  0.2516     0.7179 0.000 0.000 0.860 0.000 NA
#> GSM617587     3  0.5023     0.6581 0.020 0.080 0.732 0.000 NA
#> GSM617589     2  0.3821     0.4663 0.000 0.764 0.216 0.020 NA
#> GSM617591     3  0.4723     0.6308 0.000 0.136 0.736 0.000 NA
#> GSM617593     1  0.0000     0.8073 1.000 0.000 0.000 0.000 NA
#> GSM617594     3  0.7492     0.1694 0.304 0.280 0.380 0.000 NA
#> GSM617595     1  0.0000     0.8073 1.000 0.000 0.000 0.000 NA
#> GSM617596     1  0.4444     0.5883 0.624 0.000 0.364 0.000 NA
#> GSM617597     1  0.3234     0.7618 0.852 0.000 0.064 0.000 NA
#> GSM617598     1  0.0000     0.8073 1.000 0.000 0.000 0.000 NA
#> GSM617599     2  0.2077     0.5968 0.040 0.920 0.000 0.000 NA
#> GSM617600     3  0.4604     0.5450 0.292 0.000 0.680 0.012 NA
#> GSM617601     2  0.3707     0.4713 0.000 0.768 0.220 0.004 NA
#> GSM617602     1  0.4804     0.5920 0.624 0.000 0.348 0.004 NA
#> GSM617603     4  0.5830     0.1232 0.000 0.016 0.144 0.652 NA
#> GSM617604     1  0.4482     0.5743 0.612 0.000 0.376 0.000 NA
#> GSM617605     4  0.4883     0.3912 0.000 0.464 0.016 0.516 NA
#> GSM617606     3  0.1329     0.7340 0.000 0.008 0.956 0.004 NA
#> GSM617610     1  0.1410     0.7894 0.940 0.060 0.000 0.000 NA
#> GSM617611     1  0.0880     0.8055 0.968 0.000 0.032 0.000 NA
#> GSM617613     3  0.0162     0.7263 0.000 0.000 0.996 0.000 NA
#> GSM617614     1  0.4597     0.5076 0.564 0.000 0.424 0.000 NA
#> GSM617621     1  0.0000     0.8073 1.000 0.000 0.000 0.000 NA
#> GSM617629     3  0.8422    -0.0856 0.204 0.336 0.336 0.012 NA
#> GSM617630     1  0.5225     0.5406 0.576 0.024 0.384 0.000 NA
#> GSM617631     3  0.0404     0.7240 0.000 0.000 0.988 0.000 NA
#> GSM617633     1  0.0000     0.8073 1.000 0.000 0.000 0.000 NA
#> GSM617642     1  0.6031     0.4192 0.520 0.000 0.352 0.000 NA
#> GSM617645     2  0.4929     0.3470 0.340 0.624 0.000 0.004 NA
#> GSM617646     1  0.3825     0.7209 0.816 0.136 0.028 0.000 NA
#> GSM617652     1  0.2077     0.7965 0.920 0.000 0.040 0.000 NA
#> GSM617655     3  0.2719     0.7143 0.000 0.000 0.852 0.004 NA
#> GSM617656     3  0.4458     0.6611 0.120 0.000 0.760 0.000 NA
#> GSM617657     3  0.3333     0.6267 0.000 0.000 0.788 0.004 NA
#> GSM617658     1  0.4494     0.5695 0.608 0.000 0.380 0.000 NA
#> GSM617659     1  0.0000     0.8073 1.000 0.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
#> GSM617581     2  0.0146    0.54579 0.000 0.996 0.000 0.000 0.000 0.004
#> GSM617582     2  0.3403    0.38580 0.212 0.768 0.020 0.000 0.000 0.000
#> GSM617588     2  0.2135    0.40260 0.000 0.872 0.000 0.128 0.000 0.000
#> GSM617590     4  0.3756    0.86028 0.000 0.400 0.000 0.600 0.000 0.000
#> GSM617592     2  0.3706   -0.47033 0.000 0.620 0.000 0.380 0.000 0.000
#> GSM617607     1  0.0000    0.79717 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM617608     1  0.0000    0.79717 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM617609     1  0.5817    0.62553 0.640 0.000 0.184 0.008 0.056 0.112
#> GSM617612     1  0.0777    0.79420 0.972 0.024 0.004 0.000 0.000 0.000
#> GSM617615     2  0.6155   -0.06739 0.000 0.440 0.424 0.004 0.052 0.080
#> GSM617616     2  0.4401    0.02551 0.464 0.512 0.024 0.000 0.000 0.000
#> GSM617617     2  0.0000    0.54554 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM617618     2  0.3482    0.30924 0.316 0.684 0.000 0.000 0.000 0.000
#> GSM617619     2  0.4085    0.40605 0.012 0.780 0.160 0.008 0.012 0.028
#> GSM617620     2  0.0260    0.54221 0.000 0.992 0.000 0.008 0.000 0.000
#> GSM617622     2  0.0260    0.54555 0.000 0.992 0.008 0.000 0.000 0.000
#> GSM617623     1  0.5974    0.25044 0.516 0.372 0.024 0.000 0.032 0.056
#> GSM617624     3  0.6702    0.27074 0.084 0.288 0.540 0.012 0.040 0.036
#> GSM617625     3  0.2194    0.72139 0.036 0.004 0.912 0.000 0.008 0.040
#> GSM617626     2  0.0000    0.54554 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM617627     2  0.5393   -0.00704 0.000 0.584 0.332 0.008 0.032 0.044
#> GSM617628     3  0.0291    0.71137 0.000 0.000 0.992 0.000 0.004 0.004
#> GSM617632     2  0.3854    0.05717 0.464 0.536 0.000 0.000 0.000 0.000
#> GSM617634     2  0.1621    0.52478 0.000 0.936 0.048 0.004 0.004 0.008
#> GSM617635     1  0.1931    0.78627 0.916 0.008 0.068 0.004 0.000 0.004
#> GSM617636     1  0.3390    0.55441 0.704 0.296 0.000 0.000 0.000 0.000
#> GSM617637     1  0.2260    0.72882 0.860 0.140 0.000 0.000 0.000 0.000
#> GSM617638     1  0.7814    0.15385 0.368 0.236 0.292 0.012 0.032 0.060
#> GSM617639     1  0.0000    0.79717 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM617640     2  0.0260    0.54400 0.000 0.992 0.000 0.000 0.000 0.008
#> GSM617641     4  0.3996    0.76797 0.000 0.484 0.000 0.512 0.000 0.004
#> GSM617643     2  0.0000    0.54554 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM617644     2  0.0976    0.53157 0.000 0.968 0.000 0.016 0.008 0.008
#> GSM617647     2  0.5018    0.31006 0.276 0.656 0.016 0.004 0.024 0.024
#> GSM617648     2  0.0000    0.54554 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM617649     2  0.4382    0.31617 0.000 0.784 0.084 0.012 0.044 0.076
#> GSM617650     1  0.0000    0.79717 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM617651     1  0.0000    0.79717 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM617653     1  0.1204    0.79194 0.944 0.000 0.056 0.000 0.000 0.000
#> GSM617654     5  0.3531    0.00000 0.000 0.328 0.000 0.000 0.672 0.000
#> GSM617583     3  0.0146    0.71504 0.000 0.000 0.996 0.000 0.000 0.004
#> GSM617584     2  0.1820    0.50474 0.000 0.924 0.008 0.000 0.012 0.056
#> GSM617585     3  0.3230    0.57446 0.000 0.192 0.792 0.008 0.000 0.008
#> GSM617586     3  0.3002    0.70688 0.000 0.000 0.848 0.004 0.048 0.100
#> GSM617587     3  0.5103    0.65727 0.020 0.072 0.740 0.004 0.056 0.108
#> GSM617589     2  0.3511    0.36591 0.000 0.760 0.216 0.024 0.000 0.000
#> GSM617591     3  0.4655    0.63975 0.000 0.120 0.744 0.000 0.048 0.088
#> GSM617593     1  0.0000    0.79717 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM617594     3  0.7038    0.05713 0.296 0.276 0.384 0.004 0.024 0.016
#> GSM617595     1  0.0000    0.79717 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM617596     1  0.4064    0.59978 0.624 0.000 0.360 0.000 0.000 0.016
#> GSM617597     1  0.3263    0.75175 0.848 0.000 0.064 0.000 0.028 0.060
#> GSM617598     1  0.0000    0.79717 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM617599     2  0.2247    0.49828 0.040 0.912 0.000 0.004 0.024 0.020
#> GSM617600     3  0.4381    0.49499 0.276 0.000 0.684 0.008 0.012 0.020
#> GSM617601     2  0.3469    0.37863 0.000 0.764 0.220 0.004 0.008 0.004
#> GSM617602     1  0.4528    0.60407 0.624 0.000 0.340 0.008 0.004 0.024
#> GSM617603     6  0.4270    0.00000 0.000 0.004 0.100 0.156 0.000 0.740
#> GSM617604     1  0.4223    0.58727 0.612 0.000 0.368 0.004 0.000 0.016
#> GSM617605     4  0.4026    0.83918 0.000 0.376 0.012 0.612 0.000 0.000
#> GSM617606     3  0.1396    0.72412 0.000 0.008 0.952 0.004 0.012 0.024
#> GSM617610     1  0.1267    0.77939 0.940 0.060 0.000 0.000 0.000 0.000
#> GSM617611     1  0.0790    0.79612 0.968 0.000 0.032 0.000 0.000 0.000
#> GSM617613     3  0.0146    0.71185 0.000 0.000 0.996 0.000 0.000 0.004
#> GSM617614     1  0.4332    0.52171 0.564 0.000 0.416 0.004 0.000 0.016
#> GSM617621     1  0.0000    0.79717 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM617629     2  0.9619   -0.32039 0.152 0.252 0.208 0.096 0.204 0.088
#> GSM617630     1  0.4886    0.55479 0.576 0.024 0.376 0.004 0.000 0.020
#> GSM617631     3  0.0603    0.70455 0.000 0.000 0.980 0.004 0.000 0.016
#> GSM617633     1  0.0000    0.79717 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM617642     1  0.6042    0.43342 0.520 0.000 0.340 0.004 0.040 0.096
#> GSM617645     2  0.5123    0.28329 0.320 0.612 0.000 0.024 0.032 0.012
#> GSM617646     1  0.3602    0.70413 0.812 0.136 0.028 0.000 0.016 0.008
#> GSM617652     1  0.2176    0.78518 0.916 0.000 0.036 0.004 0.024 0.020
#> GSM617655     3  0.3128    0.70203 0.000 0.000 0.844 0.008 0.052 0.096
#> GSM617656     3  0.4360    0.64214 0.112 0.000 0.768 0.000 0.044 0.076
#> GSM617657     3  0.5418    0.28193 0.000 0.000 0.616 0.272 0.040 0.072
#> GSM617658     1  0.4234    0.58245 0.608 0.000 0.372 0.004 0.000 0.016
#> GSM617659     1  0.0000    0.79717 1.000 0.000 0.000 0.000 0.000 0.000

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

consensus_heatmap(res, k = 2)

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

consensus_heatmap(res, k = 3)

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

consensus_heatmap(res, k = 4)

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

consensus_heatmap(res, k = 5)

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

consensus_heatmap(res, k = 6)

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

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

membership_heatmap(res, k = 2)

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

membership_heatmap(res, k = 3)

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

membership_heatmap(res, k = 4)

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

membership_heatmap(res, k = 5)

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

membership_heatmap(res, k = 6)

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

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

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

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

get_signatures(res, k = 3)

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

get_signatures(res, k = 4)

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

get_signatures(res, k = 5)

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

get_signatures(res, k = 6)

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

Signature heatmaps where rows are not scaled:

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

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

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

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

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

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

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

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

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

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

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk CV-pam-signature_compare

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

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

An example of the output of tb is:

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

The columns in tb are:

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

UMAP plot which shows how samples are separated.

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

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

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

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

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

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

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

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

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

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

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk CV-pam-collect-classes

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

test_to_known_factors(res)
#>         n disease.state(p) k
#> CV:pam 73         0.007135 2
#> CV:pam 65         0.000231 3
#> CV:pam 64         0.000175 4
#> CV:pam 56         0.000526 5
#> CV:pam 54         0.002776 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 21168 rows and 79 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 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-mclust-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.733           0.870       0.944         0.3447 0.658   0.658
#> 3 3 0.382           0.597       0.761         0.6781 0.611   0.455
#> 4 4 0.758           0.850       0.914         0.2637 0.789   0.506
#> 5 5 0.661           0.766       0.834         0.0462 1.000   1.000
#> 6 6 0.624           0.571       0.744         0.0378 0.925   0.728

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

suggest_best_k(res)
#> [1] 4

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

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

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>           class entropy silhouette    p1    p2
#> GSM617581     1  0.0000     0.9522 1.000 0.000
#> GSM617582     1  0.0000     0.9522 1.000 0.000
#> GSM617588     2  0.0938     0.8846 0.012 0.988
#> GSM617590     2  0.0938     0.8846 0.012 0.988
#> GSM617592     2  0.0938     0.8846 0.012 0.988
#> GSM617607     1  0.0000     0.9522 1.000 0.000
#> GSM617608     1  0.0000     0.9522 1.000 0.000
#> GSM617609     1  0.0376     0.9503 0.996 0.004
#> GSM617612     1  0.0000     0.9522 1.000 0.000
#> GSM617615     2  0.4939     0.8566 0.108 0.892
#> GSM617616     1  0.0000     0.9522 1.000 0.000
#> GSM617617     1  0.9944     0.0305 0.544 0.456
#> GSM617618     1  0.0000     0.9522 1.000 0.000
#> GSM617619     1  0.0000     0.9522 1.000 0.000
#> GSM617620     2  0.0938     0.8846 0.012 0.988
#> GSM617622     2  0.9815     0.3796 0.420 0.580
#> GSM617623     1  0.0376     0.9501 0.996 0.004
#> GSM617624     1  0.3733     0.8886 0.928 0.072
#> GSM617625     1  0.0000     0.9522 1.000 0.000
#> GSM617626     1  0.0000     0.9522 1.000 0.000
#> GSM617627     1  0.7299     0.7147 0.796 0.204
#> GSM617628     1  0.0000     0.9522 1.000 0.000
#> GSM617632     1  0.0000     0.9522 1.000 0.000
#> GSM617634     1  0.1633     0.9353 0.976 0.024
#> GSM617635     1  0.0000     0.9522 1.000 0.000
#> GSM617636     1  0.0000     0.9522 1.000 0.000
#> GSM617637     1  0.0000     0.9522 1.000 0.000
#> GSM617638     1  0.1843     0.9319 0.972 0.028
#> GSM617639     1  0.0000     0.9522 1.000 0.000
#> GSM617640     2  0.5178     0.8516 0.116 0.884
#> GSM617641     2  0.0938     0.8846 0.012 0.988
#> GSM617643     2  0.5059     0.8543 0.112 0.888
#> GSM617644     2  0.2236     0.8830 0.036 0.964
#> GSM617647     1  0.7950     0.6529 0.760 0.240
#> GSM617648     2  0.9552     0.4977 0.376 0.624
#> GSM617649     1  0.8555     0.5741 0.720 0.280
#> GSM617650     1  0.0000     0.9522 1.000 0.000
#> GSM617651     1  0.0000     0.9522 1.000 0.000
#> GSM617653     1  0.0672     0.9470 0.992 0.008
#> GSM617654     1  0.8861     0.5195 0.696 0.304
#> GSM617583     1  0.0000     0.9522 1.000 0.000
#> GSM617584     1  1.0000    -0.1634 0.504 0.496
#> GSM617585     2  0.9044     0.6123 0.320 0.680
#> GSM617586     1  0.0376     0.9503 0.996 0.004
#> GSM617587     1  0.0000     0.9522 1.000 0.000
#> GSM617589     2  0.0938     0.8846 0.012 0.988
#> GSM617591     1  0.5519     0.8248 0.872 0.128
#> GSM617593     1  0.0000     0.9522 1.000 0.000
#> GSM617594     1  0.2043     0.9280 0.968 0.032
#> GSM617595     1  0.0672     0.9470 0.992 0.008
#> GSM617596     1  0.0000     0.9522 1.000 0.000
#> GSM617597     1  0.0000     0.9522 1.000 0.000
#> GSM617598     1  0.0000     0.9522 1.000 0.000
#> GSM617599     1  0.0000     0.9522 1.000 0.000
#> GSM617600     1  0.0376     0.9503 0.996 0.004
#> GSM617601     2  0.2236     0.8830 0.036 0.964
#> GSM617602     1  0.0376     0.9503 0.996 0.004
#> GSM617603     2  0.0938     0.8846 0.012 0.988
#> GSM617604     1  0.0000     0.9522 1.000 0.000
#> GSM617605     2  0.1184     0.8844 0.016 0.984
#> GSM617606     1  0.6531     0.7709 0.832 0.168
#> GSM617610     1  0.0672     0.9470 0.992 0.008
#> GSM617611     1  0.0000     0.9522 1.000 0.000
#> GSM617613     1  0.0000     0.9522 1.000 0.000
#> GSM617614     1  0.0376     0.9503 0.996 0.004
#> GSM617621     1  0.0000     0.9522 1.000 0.000
#> GSM617629     1  0.1184     0.9441 0.984 0.016
#> GSM617630     1  0.0938     0.9444 0.988 0.012
#> GSM617631     1  0.0376     0.9503 0.996 0.004
#> GSM617633     1  0.0000     0.9522 1.000 0.000
#> GSM617642     1  0.0376     0.9503 0.996 0.004
#> GSM617645     2  0.8267     0.7040 0.260 0.740
#> GSM617646     1  0.0000     0.9522 1.000 0.000
#> GSM617652     1  0.0000     0.9522 1.000 0.000
#> GSM617655     1  0.0376     0.9503 0.996 0.004
#> GSM617656     1  0.0000     0.9522 1.000 0.000
#> GSM617657     1  0.0376     0.9501 0.996 0.004
#> GSM617658     1  0.0376     0.9503 0.996 0.004
#> GSM617659     1  0.0000     0.9522 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
#> GSM617581     1  0.5235     0.5990 0.812 0.152 0.036
#> GSM617582     1  0.4249     0.6774 0.864 0.108 0.028
#> GSM617588     2  0.0000     0.7028 0.000 1.000 0.000
#> GSM617590     2  0.0237     0.7012 0.000 0.996 0.004
#> GSM617592     2  0.0424     0.6997 0.000 0.992 0.008
#> GSM617607     1  0.0892     0.8144 0.980 0.000 0.020
#> GSM617608     1  0.0000     0.8186 1.000 0.000 0.000
#> GSM617609     3  0.7757     0.4280 0.464 0.048 0.488
#> GSM617612     1  0.0237     0.8185 0.996 0.000 0.004
#> GSM617615     2  0.3764     0.7174 0.040 0.892 0.068
#> GSM617616     1  0.0237     0.8172 0.996 0.000 0.004
#> GSM617617     2  0.7519     0.6940 0.044 0.568 0.388
#> GSM617618     1  0.0424     0.8169 0.992 0.000 0.008
#> GSM617619     3  0.9063     0.1820 0.200 0.248 0.552
#> GSM617620     2  0.0000     0.7028 0.000 1.000 0.000
#> GSM617622     2  0.8233     0.6721 0.120 0.616 0.264
#> GSM617623     1  0.4931     0.6238 0.828 0.140 0.032
#> GSM617624     2  0.8957     0.5471 0.128 0.472 0.400
#> GSM617625     1  0.4452     0.6153 0.808 0.000 0.192
#> GSM617626     1  0.0237     0.8183 0.996 0.004 0.000
#> GSM617627     2  0.8720     0.6309 0.124 0.540 0.336
#> GSM617628     1  0.6079     0.0267 0.612 0.000 0.388
#> GSM617632     1  0.0424     0.8159 0.992 0.000 0.008
#> GSM617634     2  0.9651     0.3670 0.208 0.400 0.392
#> GSM617635     1  0.0592     0.8173 0.988 0.000 0.012
#> GSM617636     1  0.2200     0.7923 0.940 0.004 0.056
#> GSM617637     1  0.0000     0.8186 1.000 0.000 0.000
#> GSM617638     3  0.9332    -0.4666 0.164 0.404 0.432
#> GSM617639     1  0.0237     0.8185 0.996 0.000 0.004
#> GSM617640     2  0.6617     0.7001 0.012 0.600 0.388
#> GSM617641     2  0.0000     0.7028 0.000 1.000 0.000
#> GSM617643     2  0.6952     0.7041 0.024 0.600 0.376
#> GSM617644     2  0.4452     0.7235 0.000 0.808 0.192
#> GSM617647     2  0.9386     0.5550 0.204 0.500 0.296
#> GSM617648     2  0.7442     0.7014 0.044 0.588 0.368
#> GSM617649     2  0.8703     0.6393 0.124 0.544 0.332
#> GSM617650     1  0.0000     0.8186 1.000 0.000 0.000
#> GSM617651     1  0.0000     0.8186 1.000 0.000 0.000
#> GSM617653     1  0.0237     0.8170 0.996 0.000 0.004
#> GSM617654     2  0.8097     0.6757 0.072 0.540 0.388
#> GSM617583     1  0.5016     0.5322 0.760 0.000 0.240
#> GSM617584     2  0.6441     0.4165 0.276 0.696 0.028
#> GSM617585     2  0.7365     0.6899 0.112 0.700 0.188
#> GSM617586     3  0.6192     0.5155 0.420 0.000 0.580
#> GSM617587     1  0.6676    -0.3220 0.516 0.008 0.476
#> GSM617589     2  0.0475     0.7024 0.004 0.992 0.004
#> GSM617591     2  0.7065     0.3787 0.288 0.664 0.048
#> GSM617593     1  0.0000     0.8186 1.000 0.000 0.000
#> GSM617594     1  0.8577    -0.2111 0.468 0.436 0.096
#> GSM617595     1  0.0000     0.8186 1.000 0.000 0.000
#> GSM617596     1  0.1031     0.8134 0.976 0.000 0.024
#> GSM617597     1  0.2711     0.7690 0.912 0.000 0.088
#> GSM617598     1  0.0000     0.8186 1.000 0.000 0.000
#> GSM617599     1  0.7493     0.2666 0.676 0.232 0.092
#> GSM617600     3  0.6330     0.5487 0.396 0.004 0.600
#> GSM617601     2  0.1525     0.7100 0.004 0.964 0.032
#> GSM617602     3  0.6168     0.5316 0.412 0.000 0.588
#> GSM617603     2  0.1163     0.7088 0.000 0.972 0.028
#> GSM617604     1  0.4796     0.5851 0.780 0.000 0.220
#> GSM617605     2  0.0424     0.6997 0.000 0.992 0.008
#> GSM617606     2  0.8911     0.5950 0.176 0.564 0.260
#> GSM617610     1  0.0000     0.8186 1.000 0.000 0.000
#> GSM617611     1  0.0000     0.8186 1.000 0.000 0.000
#> GSM617613     3  0.7969     0.5405 0.396 0.064 0.540
#> GSM617614     1  0.5948     0.2197 0.640 0.000 0.360
#> GSM617621     1  0.1163     0.8112 0.972 0.000 0.028
#> GSM617629     3  0.7944     0.3082 0.196 0.144 0.660
#> GSM617630     3  0.9330     0.0471 0.244 0.236 0.520
#> GSM617631     3  0.6111     0.5473 0.396 0.000 0.604
#> GSM617633     1  0.3669     0.7494 0.896 0.040 0.064
#> GSM617642     1  0.5254     0.5055 0.736 0.000 0.264
#> GSM617645     2  0.6798     0.6977 0.016 0.584 0.400
#> GSM617646     1  0.1411     0.8081 0.964 0.000 0.036
#> GSM617652     1  0.1753     0.8003 0.952 0.000 0.048
#> GSM617655     3  0.6386     0.5326 0.412 0.004 0.584
#> GSM617656     3  0.6140     0.5392 0.404 0.000 0.596
#> GSM617657     3  0.8001     0.4544 0.212 0.136 0.652
#> GSM617658     1  0.6267    -0.1832 0.548 0.000 0.452
#> GSM617659     1  0.0000     0.8186 1.000 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM617581     1  0.3985      0.865 0.832 0.136 0.008 0.024
#> GSM617582     1  0.3769      0.858 0.864 0.072 0.052 0.012
#> GSM617588     4  0.0817      0.866 0.000 0.024 0.000 0.976
#> GSM617590     4  0.0817      0.866 0.000 0.024 0.000 0.976
#> GSM617592     4  0.0817      0.866 0.000 0.024 0.000 0.976
#> GSM617607     1  0.1743      0.929 0.940 0.056 0.004 0.000
#> GSM617608     1  0.0188      0.938 0.996 0.000 0.004 0.000
#> GSM617609     3  0.2125      0.873 0.004 0.076 0.920 0.000
#> GSM617612     1  0.0188      0.938 0.996 0.000 0.004 0.000
#> GSM617615     4  0.3873      0.740 0.000 0.228 0.000 0.772
#> GSM617616     1  0.0188      0.938 0.996 0.000 0.004 0.000
#> GSM617617     2  0.0707      0.872 0.000 0.980 0.000 0.020
#> GSM617618     1  0.0188      0.938 0.996 0.000 0.004 0.000
#> GSM617619     2  0.4941      0.294 0.000 0.564 0.436 0.000
#> GSM617620     4  0.0817      0.866 0.000 0.024 0.000 0.976
#> GSM617622     2  0.4690      0.630 0.000 0.724 0.016 0.260
#> GSM617623     1  0.4085      0.863 0.828 0.136 0.008 0.028
#> GSM617624     2  0.0657      0.874 0.000 0.984 0.004 0.012
#> GSM617625     3  0.4193      0.704 0.268 0.000 0.732 0.000
#> GSM617626     1  0.2156      0.927 0.928 0.060 0.004 0.008
#> GSM617627     2  0.0804      0.874 0.000 0.980 0.008 0.012
#> GSM617628     3  0.3610      0.784 0.200 0.000 0.800 0.000
#> GSM617632     1  0.0967      0.937 0.976 0.004 0.004 0.016
#> GSM617634     2  0.2074      0.868 0.016 0.940 0.012 0.032
#> GSM617635     1  0.1489      0.932 0.952 0.044 0.004 0.000
#> GSM617636     1  0.3723      0.886 0.856 0.108 0.024 0.012
#> GSM617637     1  0.1022      0.936 0.968 0.032 0.000 0.000
#> GSM617638     2  0.0817      0.865 0.000 0.976 0.024 0.000
#> GSM617639     1  0.1474      0.931 0.948 0.052 0.000 0.000
#> GSM617640     2  0.1022      0.868 0.000 0.968 0.000 0.032
#> GSM617641     4  0.0817      0.866 0.000 0.024 0.000 0.976
#> GSM617643     2  0.2216      0.828 0.000 0.908 0.000 0.092
#> GSM617644     4  0.4855      0.320 0.000 0.400 0.000 0.600
#> GSM617647     2  0.0376      0.872 0.000 0.992 0.004 0.004
#> GSM617648     2  0.2704      0.809 0.000 0.876 0.000 0.124
#> GSM617649     2  0.1109      0.871 0.000 0.968 0.004 0.028
#> GSM617650     1  0.0188      0.938 0.996 0.000 0.004 0.000
#> GSM617651     1  0.0000      0.937 1.000 0.000 0.000 0.000
#> GSM617653     1  0.0592      0.936 0.984 0.000 0.000 0.016
#> GSM617654     2  0.0336      0.873 0.000 0.992 0.000 0.008
#> GSM617583     3  0.3649      0.781 0.204 0.000 0.796 0.000
#> GSM617584     4  0.5869      0.642 0.112 0.160 0.008 0.720
#> GSM617585     4  0.4780      0.754 0.000 0.096 0.116 0.788
#> GSM617586     3  0.0000      0.922 0.000 0.000 1.000 0.000
#> GSM617587     3  0.1004      0.912 0.004 0.024 0.972 0.000
#> GSM617589     4  0.0817      0.866 0.000 0.024 0.000 0.976
#> GSM617591     4  0.4883      0.662 0.000 0.288 0.016 0.696
#> GSM617593     1  0.0188      0.938 0.996 0.000 0.004 0.000
#> GSM617594     2  0.2197      0.812 0.080 0.916 0.004 0.000
#> GSM617595     1  0.0000      0.937 1.000 0.000 0.000 0.000
#> GSM617596     1  0.2605      0.926 0.920 0.040 0.016 0.024
#> GSM617597     1  0.1902      0.918 0.932 0.004 0.064 0.000
#> GSM617598     1  0.0188      0.938 0.996 0.000 0.004 0.000
#> GSM617599     2  0.4318      0.662 0.208 0.776 0.004 0.012
#> GSM617600     3  0.0000      0.922 0.000 0.000 1.000 0.000
#> GSM617601     4  0.3873      0.747 0.000 0.228 0.000 0.772
#> GSM617602     3  0.0000      0.922 0.000 0.000 1.000 0.000
#> GSM617603     4  0.1637      0.852 0.000 0.060 0.000 0.940
#> GSM617604     1  0.5248      0.693 0.716 0.012 0.248 0.024
#> GSM617605     4  0.0817      0.866 0.000 0.024 0.000 0.976
#> GSM617606     2  0.4381      0.720 0.008 0.780 0.012 0.200
#> GSM617610     1  0.0000      0.937 1.000 0.000 0.000 0.000
#> GSM617611     1  0.0188      0.938 0.996 0.000 0.004 0.000
#> GSM617613     3  0.0000      0.922 0.000 0.000 1.000 0.000
#> GSM617614     3  0.0921      0.914 0.028 0.000 0.972 0.000
#> GSM617621     1  0.3264      0.898 0.876 0.096 0.004 0.024
#> GSM617629     2  0.4250      0.656 0.000 0.724 0.276 0.000
#> GSM617630     2  0.1118      0.860 0.000 0.964 0.036 0.000
#> GSM617631     3  0.0000      0.922 0.000 0.000 1.000 0.000
#> GSM617633     1  0.1716      0.906 0.936 0.000 0.064 0.000
#> GSM617642     3  0.2814      0.829 0.132 0.000 0.868 0.000
#> GSM617645     2  0.0469      0.873 0.000 0.988 0.000 0.012
#> GSM617646     1  0.4049      0.790 0.780 0.212 0.008 0.000
#> GSM617652     1  0.3047      0.890 0.872 0.116 0.012 0.000
#> GSM617655     3  0.0000      0.922 0.000 0.000 1.000 0.000
#> GSM617656     3  0.0000      0.922 0.000 0.000 1.000 0.000
#> GSM617657     3  0.0000      0.922 0.000 0.000 1.000 0.000
#> GSM617658     3  0.1182      0.914 0.016 0.000 0.968 0.016
#> GSM617659     1  0.0188      0.938 0.996 0.000 0.004 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
#> GSM617581     1  0.4901     0.7987 0.752 0.124 0.012 0.004 NA
#> GSM617582     1  0.6579     0.6282 0.632 0.144 0.120 0.000 NA
#> GSM617588     4  0.1117     0.8327 0.000 0.016 0.000 0.964 NA
#> GSM617590     4  0.0510     0.8311 0.000 0.016 0.000 0.984 NA
#> GSM617592     4  0.1117     0.8327 0.000 0.016 0.000 0.964 NA
#> GSM617607     1  0.4593     0.8184 0.756 0.076 0.008 0.000 NA
#> GSM617608     1  0.2077     0.8534 0.908 0.000 0.008 0.000 NA
#> GSM617609     3  0.3692     0.7860 0.008 0.152 0.812 0.000 NA
#> GSM617612     1  0.0898     0.8628 0.972 0.000 0.008 0.000 NA
#> GSM617615     4  0.3905     0.6959 0.000 0.232 0.004 0.752 NA
#> GSM617616     1  0.1608     0.8628 0.928 0.000 0.000 0.000 NA
#> GSM617617     2  0.2505     0.8052 0.000 0.888 0.000 0.020 NA
#> GSM617618     1  0.2818     0.8453 0.860 0.004 0.008 0.000 NA
#> GSM617619     2  0.5044     0.2242 0.000 0.556 0.408 0.000 NA
#> GSM617620     4  0.1117     0.8327 0.000 0.016 0.000 0.964 NA
#> GSM617622     2  0.4449     0.5554 0.000 0.688 0.004 0.288 NA
#> GSM617623     1  0.4967     0.7969 0.752 0.128 0.012 0.008 NA
#> GSM617624     2  0.0960     0.8106 0.000 0.972 0.008 0.004 NA
#> GSM617625     3  0.4547     0.7544 0.192 0.000 0.736 0.000 NA
#> GSM617626     1  0.3466     0.8477 0.844 0.048 0.008 0.000 NA
#> GSM617627     2  0.1565     0.8107 0.004 0.952 0.008 0.020 NA
#> GSM617628     3  0.4349     0.7698 0.176 0.000 0.756 0.000 NA
#> GSM617632     1  0.1892     0.8626 0.916 0.004 0.000 0.000 NA
#> GSM617634     2  0.2791     0.8058 0.000 0.892 0.016 0.036 NA
#> GSM617635     1  0.3570     0.8465 0.828 0.044 0.004 0.000 NA
#> GSM617636     1  0.6569     0.5749 0.496 0.092 0.028 0.004 NA
#> GSM617637     1  0.1954     0.8629 0.932 0.028 0.008 0.000 NA
#> GSM617638     2  0.3852     0.7045 0.000 0.760 0.020 0.000 NA
#> GSM617639     1  0.2464     0.8560 0.904 0.048 0.004 0.000 NA
#> GSM617640     2  0.2984     0.7966 0.000 0.860 0.000 0.032 NA
#> GSM617641     4  0.1117     0.8327 0.000 0.016 0.000 0.964 NA
#> GSM617643     2  0.3569     0.7695 0.000 0.828 0.000 0.104 NA
#> GSM617644     4  0.4821     0.0145 0.000 0.464 0.000 0.516 NA
#> GSM617647     2  0.2556     0.8119 0.024 0.900 0.004 0.004 NA
#> GSM617648     2  0.2921     0.7702 0.000 0.856 0.000 0.124 NA
#> GSM617649     2  0.1560     0.8111 0.000 0.948 0.004 0.028 NA
#> GSM617650     1  0.1502     0.8602 0.940 0.000 0.004 0.000 NA
#> GSM617651     1  0.0404     0.8613 0.988 0.000 0.000 0.000 NA
#> GSM617653     1  0.1851     0.8496 0.912 0.000 0.000 0.000 NA
#> GSM617654     2  0.2179     0.8050 0.000 0.896 0.000 0.004 NA
#> GSM617583     3  0.4395     0.7635 0.188 0.000 0.748 0.000 NA
#> GSM617584     4  0.6709     0.6003 0.100 0.148 0.008 0.636 NA
#> GSM617585     4  0.4898     0.7048 0.000 0.144 0.088 0.748 NA
#> GSM617586     3  0.1106     0.8674 0.000 0.012 0.964 0.000 NA
#> GSM617587     3  0.2756     0.8319 0.012 0.096 0.880 0.000 NA
#> GSM617589     4  0.1893     0.8233 0.000 0.024 0.000 0.928 NA
#> GSM617591     4  0.4800     0.6090 0.000 0.296 0.012 0.668 NA
#> GSM617593     1  0.1205     0.8640 0.956 0.000 0.004 0.000 NA
#> GSM617594     2  0.2869     0.7810 0.052 0.892 0.008 0.008 NA
#> GSM617595     1  0.0404     0.8615 0.988 0.000 0.000 0.000 NA
#> GSM617596     1  0.3714     0.8539 0.836 0.044 0.012 0.004 NA
#> GSM617597     1  0.5590     0.5676 0.620 0.016 0.300 0.000 NA
#> GSM617598     1  0.0510     0.8611 0.984 0.000 0.000 0.000 NA
#> GSM617599     2  0.3864     0.7385 0.112 0.828 0.012 0.008 NA
#> GSM617600     3  0.3010     0.8210 0.000 0.004 0.824 0.000 NA
#> GSM617601     4  0.3863     0.7328 0.000 0.200 0.000 0.772 NA
#> GSM617602     3  0.0794     0.8655 0.000 0.000 0.972 0.000 NA
#> GSM617603     4  0.2519     0.7899 0.000 0.100 0.000 0.884 NA
#> GSM617604     1  0.6155     0.2669 0.484 0.008 0.416 0.004 NA
#> GSM617605     4  0.0510     0.8311 0.000 0.016 0.000 0.984 NA
#> GSM617606     2  0.4084     0.7088 0.004 0.784 0.008 0.176 NA
#> GSM617610     1  0.0609     0.8609 0.980 0.000 0.000 0.000 NA
#> GSM617611     1  0.0771     0.8617 0.976 0.000 0.004 0.000 NA
#> GSM617613     3  0.3715     0.7705 0.000 0.004 0.736 0.000 NA
#> GSM617614     3  0.1862     0.8627 0.016 0.004 0.932 0.000 NA
#> GSM617621     1  0.3681     0.8411 0.840 0.072 0.008 0.004 NA
#> GSM617629     2  0.6517     0.4273 0.000 0.480 0.228 0.000 NA
#> GSM617630     2  0.4054     0.7113 0.000 0.760 0.036 0.000 NA
#> GSM617631     3  0.1478     0.8640 0.000 0.000 0.936 0.000 NA
#> GSM617633     1  0.5609     0.5700 0.564 0.016 0.048 0.000 NA
#> GSM617642     3  0.3175     0.8505 0.044 0.020 0.872 0.000 NA
#> GSM617645     2  0.2625     0.8017 0.000 0.876 0.000 0.016 NA
#> GSM617646     1  0.5311     0.7555 0.692 0.184 0.008 0.000 NA
#> GSM617652     1  0.5079     0.8135 0.756 0.092 0.056 0.000 NA
#> GSM617655     3  0.1997     0.8633 0.000 0.036 0.924 0.000 NA
#> GSM617656     3  0.1671     0.8574 0.000 0.000 0.924 0.000 NA
#> GSM617657     3  0.3741     0.7679 0.000 0.004 0.732 0.000 NA
#> GSM617658     3  0.2006     0.8588 0.012 0.000 0.916 0.000 NA
#> GSM617659     1  0.1124     0.8616 0.960 0.000 0.004 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
#> GSM617581     1  0.5268    0.68705 0.688 0.052 0.004 0.000 0.172 0.084
#> GSM617582     1  0.8164    0.07668 0.416 0.128 0.224 0.000 0.120 0.112
#> GSM617588     4  0.1793    0.77779 0.000 0.012 0.000 0.928 0.012 0.048
#> GSM617590     4  0.1296    0.77722 0.000 0.012 0.000 0.952 0.032 0.004
#> GSM617592     4  0.1952    0.77815 0.000 0.016 0.000 0.920 0.012 0.052
#> GSM617607     1  0.5330    0.62046 0.628 0.016 0.012 0.000 0.272 0.072
#> GSM617608     1  0.2812    0.79646 0.860 0.000 0.008 0.000 0.104 0.028
#> GSM617609     3  0.4799    0.32778 0.012 0.020 0.688 0.000 0.240 0.040
#> GSM617612     1  0.1599    0.82510 0.940 0.000 0.008 0.000 0.028 0.024
#> GSM617615     4  0.5575    0.57407 0.000 0.140 0.000 0.644 0.172 0.044
#> GSM617616     1  0.2345    0.82232 0.900 0.004 0.004 0.000 0.056 0.036
#> GSM617617     2  0.1176    0.64373 0.000 0.956 0.000 0.024 0.020 0.000
#> GSM617618     1  0.3907    0.74125 0.756 0.000 0.000 0.000 0.176 0.068
#> GSM617619     5  0.7302   -0.12365 0.000 0.332 0.184 0.000 0.356 0.128
#> GSM617620     4  0.1820    0.78008 0.000 0.016 0.000 0.928 0.012 0.044
#> GSM617622     2  0.6839    0.39166 0.000 0.444 0.004 0.316 0.172 0.064
#> GSM617623     1  0.5393    0.68600 0.692 0.056 0.004 0.004 0.152 0.092
#> GSM617624     2  0.4467    0.53490 0.000 0.624 0.008 0.004 0.344 0.020
#> GSM617625     3  0.4976    0.50252 0.156 0.000 0.680 0.000 0.012 0.152
#> GSM617626     1  0.3844    0.78917 0.812 0.028 0.004 0.000 0.084 0.072
#> GSM617627     2  0.5715    0.57133 0.000 0.588 0.004 0.056 0.292 0.060
#> GSM617628     3  0.4874    0.50535 0.148 0.000 0.692 0.000 0.012 0.148
#> GSM617632     1  0.2879    0.81731 0.864 0.008 0.000 0.000 0.072 0.056
#> GSM617634     2  0.5283    0.43844 0.008 0.532 0.008 0.020 0.408 0.024
#> GSM617635     1  0.4197    0.75040 0.752 0.016 0.000 0.000 0.172 0.060
#> GSM617636     5  0.5522    0.08862 0.316 0.020 0.016 0.000 0.588 0.060
#> GSM617637     1  0.2171    0.82367 0.912 0.016 0.000 0.000 0.040 0.032
#> GSM617638     5  0.4039    0.09796 0.000 0.352 0.016 0.000 0.632 0.000
#> GSM617639     1  0.2719    0.81071 0.876 0.012 0.000 0.000 0.072 0.040
#> GSM617640     2  0.0790    0.63050 0.000 0.968 0.000 0.032 0.000 0.000
#> GSM617641     4  0.1820    0.78008 0.000 0.016 0.000 0.928 0.012 0.044
#> GSM617643     2  0.2560    0.64475 0.000 0.872 0.000 0.092 0.036 0.000
#> GSM617644     4  0.5072   -0.06783 0.000 0.464 0.000 0.480 0.028 0.028
#> GSM617647     2  0.4312    0.60783 0.084 0.772 0.004 0.004 0.120 0.016
#> GSM617648     2  0.4097    0.64491 0.000 0.760 0.000 0.128 0.108 0.004
#> GSM617649     2  0.4392    0.60598 0.000 0.676 0.004 0.024 0.284 0.012
#> GSM617650     1  0.2884    0.80195 0.864 0.000 0.008 0.000 0.064 0.064
#> GSM617651     1  0.0508    0.82279 0.984 0.000 0.000 0.000 0.004 0.012
#> GSM617653     1  0.2649    0.80018 0.876 0.004 0.000 0.000 0.052 0.068
#> GSM617654     2  0.0717    0.63497 0.000 0.976 0.000 0.008 0.016 0.000
#> GSM617583     3  0.4927    0.51483 0.144 0.000 0.692 0.000 0.016 0.148
#> GSM617584     4  0.7024    0.53019 0.064 0.076 0.000 0.564 0.164 0.132
#> GSM617585     4  0.5228    0.64662 0.000 0.132 0.008 0.708 0.096 0.056
#> GSM617586     3  0.1934    0.46742 0.000 0.000 0.916 0.000 0.040 0.044
#> GSM617587     3  0.4063    0.45518 0.036 0.004 0.760 0.000 0.184 0.016
#> GSM617589     4  0.2964    0.76323 0.000 0.024 0.000 0.856 0.020 0.100
#> GSM617591     4  0.6367    0.47660 0.000 0.136 0.008 0.564 0.232 0.060
#> GSM617593     1  0.2796    0.81589 0.872 0.004 0.004 0.000 0.056 0.064
#> GSM617594     2  0.6775    0.50405 0.084 0.548 0.008 0.032 0.264 0.064
#> GSM617595     1  0.0717    0.82253 0.976 0.000 0.000 0.000 0.016 0.008
#> GSM617596     1  0.3731    0.80749 0.808 0.012 0.004 0.000 0.112 0.064
#> GSM617597     3  0.5839    0.10331 0.408 0.004 0.484 0.000 0.048 0.056
#> GSM617598     1  0.1405    0.82134 0.948 0.004 0.000 0.000 0.024 0.024
#> GSM617599     2  0.6594    0.44547 0.132 0.548 0.016 0.000 0.240 0.064
#> GSM617600     3  0.3668   -0.52091 0.000 0.000 0.668 0.000 0.004 0.328
#> GSM617601     4  0.4750    0.67503 0.000 0.132 0.000 0.724 0.116 0.028
#> GSM617602     3  0.1075    0.44851 0.000 0.000 0.952 0.000 0.000 0.048
#> GSM617603     4  0.3436    0.74225 0.000 0.080 0.000 0.836 0.032 0.052
#> GSM617604     3  0.5570    0.30488 0.244 0.004 0.608 0.000 0.016 0.128
#> GSM617605     4  0.1296    0.77722 0.000 0.012 0.000 0.952 0.032 0.004
#> GSM617606     2  0.6550    0.53845 0.000 0.520 0.000 0.212 0.200 0.068
#> GSM617610     1  0.1092    0.82059 0.960 0.000 0.000 0.000 0.020 0.020
#> GSM617611     1  0.1257    0.82118 0.952 0.000 0.000 0.000 0.020 0.028
#> GSM617613     6  0.4097    0.96128 0.000 0.000 0.488 0.000 0.008 0.504
#> GSM617614     3  0.3178    0.56018 0.028 0.000 0.832 0.000 0.012 0.128
#> GSM617621     1  0.3876    0.78444 0.796 0.020 0.000 0.000 0.112 0.072
#> GSM617629     5  0.5729    0.31403 0.000 0.156 0.184 0.000 0.620 0.040
#> GSM617630     5  0.4269    0.15451 0.000 0.316 0.036 0.000 0.648 0.000
#> GSM617631     3  0.2048    0.33663 0.000 0.000 0.880 0.000 0.000 0.120
#> GSM617633     5  0.5410    0.00994 0.404 0.004 0.020 0.000 0.516 0.056
#> GSM617642     3  0.3538    0.56221 0.024 0.000 0.816 0.000 0.036 0.124
#> GSM617645     2  0.0458    0.63186 0.000 0.984 0.000 0.016 0.000 0.000
#> GSM617646     1  0.5460    0.63393 0.632 0.044 0.020 0.000 0.268 0.036
#> GSM617652     1  0.6374    0.47847 0.560 0.016 0.224 0.000 0.164 0.036
#> GSM617655     3  0.2488    0.46287 0.000 0.000 0.880 0.000 0.076 0.044
#> GSM617656     3  0.2234    0.31891 0.000 0.000 0.872 0.000 0.004 0.124
#> GSM617657     6  0.4405    0.96204 0.000 0.000 0.472 0.000 0.024 0.504
#> GSM617658     3  0.2600    0.54505 0.008 0.000 0.860 0.000 0.008 0.124
#> GSM617659     1  0.2614    0.80581 0.888 0.000 0.036 0.000 0.024 0.052

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

consensus_heatmap(res, k = 2)

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

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

collect_plots(res)

plot of chunk CV-NMF-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.948           0.954       0.979         0.5011 0.498   0.498
#> 3 3 0.531           0.750       0.859         0.3330 0.749   0.534
#> 4 4 0.465           0.564       0.742         0.1231 0.850   0.586
#> 5 5 0.515           0.466       0.684         0.0663 0.908   0.665
#> 6 6 0.556           0.412       0.658         0.0379 0.932   0.706

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
#> GSM617581     2  0.7453      0.736 0.212 0.788
#> GSM617582     1  0.8386      0.635 0.732 0.268
#> GSM617588     2  0.0000      0.974 0.000 1.000
#> GSM617590     2  0.0000      0.974 0.000 1.000
#> GSM617592     2  0.0000      0.974 0.000 1.000
#> GSM617607     1  0.0000      0.981 1.000 0.000
#> GSM617608     1  0.0000      0.981 1.000 0.000
#> GSM617609     1  0.0938      0.974 0.988 0.012
#> GSM617612     1  0.0000      0.981 1.000 0.000
#> GSM617615     2  0.0000      0.974 0.000 1.000
#> GSM617616     1  0.1414      0.968 0.980 0.020
#> GSM617617     2  0.0000      0.974 0.000 1.000
#> GSM617618     1  0.0672      0.976 0.992 0.008
#> GSM617619     2  0.1633      0.958 0.024 0.976
#> GSM617620     2  0.0000      0.974 0.000 1.000
#> GSM617622     2  0.0000      0.974 0.000 1.000
#> GSM617623     2  0.3114      0.931 0.056 0.944
#> GSM617624     2  0.0000      0.974 0.000 1.000
#> GSM617625     1  0.0000      0.981 1.000 0.000
#> GSM617626     2  0.5059      0.872 0.112 0.888
#> GSM617627     2  0.0000      0.974 0.000 1.000
#> GSM617628     1  0.0000      0.981 1.000 0.000
#> GSM617632     1  0.1414      0.968 0.980 0.020
#> GSM617634     2  0.0000      0.974 0.000 1.000
#> GSM617635     1  0.0000      0.981 1.000 0.000
#> GSM617636     1  0.0000      0.981 1.000 0.000
#> GSM617637     1  0.1414      0.968 0.980 0.020
#> GSM617638     2  0.0938      0.966 0.012 0.988
#> GSM617639     1  0.0000      0.981 1.000 0.000
#> GSM617640     2  0.0000      0.974 0.000 1.000
#> GSM617641     2  0.0000      0.974 0.000 1.000
#> GSM617643     2  0.0000      0.974 0.000 1.000
#> GSM617644     2  0.0000      0.974 0.000 1.000
#> GSM617647     2  0.0000      0.974 0.000 1.000
#> GSM617648     2  0.0000      0.974 0.000 1.000
#> GSM617649     2  0.0000      0.974 0.000 1.000
#> GSM617650     1  0.0000      0.981 1.000 0.000
#> GSM617651     1  0.0000      0.981 1.000 0.000
#> GSM617653     1  0.0000      0.981 1.000 0.000
#> GSM617654     2  0.0000      0.974 0.000 1.000
#> GSM617583     1  0.0000      0.981 1.000 0.000
#> GSM617584     2  0.0000      0.974 0.000 1.000
#> GSM617585     2  0.0000      0.974 0.000 1.000
#> GSM617586     1  0.0000      0.981 1.000 0.000
#> GSM617587     1  0.4690      0.888 0.900 0.100
#> GSM617589     2  0.0000      0.974 0.000 1.000
#> GSM617591     2  0.0000      0.974 0.000 1.000
#> GSM617593     1  0.0000      0.981 1.000 0.000
#> GSM617594     2  0.0672      0.969 0.008 0.992
#> GSM617595     1  0.0000      0.981 1.000 0.000
#> GSM617596     1  0.0000      0.981 1.000 0.000
#> GSM617597     1  0.0000      0.981 1.000 0.000
#> GSM617598     1  0.0000      0.981 1.000 0.000
#> GSM617599     2  0.1633      0.958 0.024 0.976
#> GSM617600     1  0.0000      0.981 1.000 0.000
#> GSM617601     2  0.0000      0.974 0.000 1.000
#> GSM617602     1  0.0000      0.981 1.000 0.000
#> GSM617603     2  0.0000      0.974 0.000 1.000
#> GSM617604     1  0.0000      0.981 1.000 0.000
#> GSM617605     2  0.0000      0.974 0.000 1.000
#> GSM617606     2  0.0000      0.974 0.000 1.000
#> GSM617610     1  0.0000      0.981 1.000 0.000
#> GSM617611     1  0.0000      0.981 1.000 0.000
#> GSM617613     1  0.1184      0.971 0.984 0.016
#> GSM617614     1  0.0000      0.981 1.000 0.000
#> GSM617621     1  0.0000      0.981 1.000 0.000
#> GSM617629     1  0.7745      0.709 0.772 0.228
#> GSM617630     2  0.9522      0.413 0.372 0.628
#> GSM617631     1  0.0000      0.981 1.000 0.000
#> GSM617633     1  0.0000      0.981 1.000 0.000
#> GSM617642     1  0.0000      0.981 1.000 0.000
#> GSM617645     2  0.0000      0.974 0.000 1.000
#> GSM617646     1  0.0672      0.976 0.992 0.008
#> GSM617652     1  0.0000      0.981 1.000 0.000
#> GSM617655     1  0.3879      0.914 0.924 0.076
#> GSM617656     1  0.0000      0.981 1.000 0.000
#> GSM617657     2  0.3733      0.916 0.072 0.928
#> GSM617658     1  0.0000      0.981 1.000 0.000
#> GSM617659     1  0.0000      0.981 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
#> GSM617581     1  0.5882     0.4203 0.652 0.348 0.000
#> GSM617582     1  0.9387     0.3851 0.508 0.220 0.272
#> GSM617588     2  0.1529     0.8837 0.040 0.960 0.000
#> GSM617590     2  0.2486     0.8795 0.008 0.932 0.060
#> GSM617592     2  0.1399     0.8852 0.028 0.968 0.004
#> GSM617607     1  0.5098     0.6581 0.752 0.000 0.248
#> GSM617608     3  0.6126     0.3744 0.400 0.000 0.600
#> GSM617609     3  0.1711     0.8081 0.008 0.032 0.960
#> GSM617612     1  0.2448     0.8125 0.924 0.000 0.076
#> GSM617615     2  0.1919     0.8870 0.020 0.956 0.024
#> GSM617616     1  0.2414     0.8185 0.940 0.040 0.020
#> GSM617617     2  0.4861     0.7761 0.192 0.800 0.008
#> GSM617618     1  0.4575     0.7592 0.828 0.012 0.160
#> GSM617619     3  0.6451     0.1259 0.004 0.436 0.560
#> GSM617620     2  0.1163     0.8852 0.028 0.972 0.000
#> GSM617622     2  0.1964     0.8811 0.000 0.944 0.056
#> GSM617623     1  0.5926     0.4070 0.644 0.356 0.000
#> GSM617624     2  0.4645     0.7971 0.008 0.816 0.176
#> GSM617625     3  0.3941     0.7621 0.156 0.000 0.844
#> GSM617626     1  0.5178     0.5963 0.744 0.256 0.000
#> GSM617627     2  0.4555     0.7762 0.000 0.800 0.200
#> GSM617628     3  0.1964     0.8118 0.056 0.000 0.944
#> GSM617632     1  0.2443     0.8225 0.940 0.032 0.028
#> GSM617634     2  0.3610     0.8634 0.016 0.888 0.096
#> GSM617635     1  0.4164     0.7747 0.848 0.008 0.144
#> GSM617636     3  0.6305     0.0849 0.484 0.000 0.516
#> GSM617637     1  0.2651     0.8061 0.928 0.060 0.012
#> GSM617638     2  0.5881     0.6840 0.016 0.728 0.256
#> GSM617639     1  0.1399     0.8216 0.968 0.004 0.028
#> GSM617640     2  0.3031     0.8725 0.076 0.912 0.012
#> GSM617641     2  0.1031     0.8853 0.024 0.976 0.000
#> GSM617643     2  0.2063     0.8828 0.044 0.948 0.008
#> GSM617644     2  0.1289     0.8845 0.032 0.968 0.000
#> GSM617647     2  0.5848     0.6714 0.268 0.720 0.012
#> GSM617648     2  0.2866     0.8759 0.076 0.916 0.008
#> GSM617649     2  0.3377     0.8663 0.012 0.896 0.092
#> GSM617650     3  0.6215     0.2667 0.428 0.000 0.572
#> GSM617651     1  0.0892     0.8201 0.980 0.000 0.020
#> GSM617653     1  0.2152     0.8174 0.948 0.036 0.016
#> GSM617654     2  0.5072     0.7722 0.196 0.792 0.012
#> GSM617583     3  0.3349     0.8002 0.108 0.004 0.888
#> GSM617584     2  0.5178     0.6964 0.256 0.744 0.000
#> GSM617585     2  0.4883     0.7609 0.004 0.788 0.208
#> GSM617586     3  0.1525     0.8067 0.004 0.032 0.964
#> GSM617587     3  0.2066     0.7940 0.000 0.060 0.940
#> GSM617589     2  0.3213     0.8659 0.092 0.900 0.008
#> GSM617591     2  0.3532     0.8592 0.008 0.884 0.108
#> GSM617593     1  0.5138     0.6349 0.748 0.000 0.252
#> GSM617594     2  0.2774     0.8755 0.072 0.920 0.008
#> GSM617595     1  0.1491     0.8206 0.968 0.016 0.016
#> GSM617596     1  0.2711     0.8039 0.912 0.000 0.088
#> GSM617597     3  0.3879     0.7615 0.152 0.000 0.848
#> GSM617598     1  0.2537     0.8069 0.920 0.000 0.080
#> GSM617599     2  0.5450     0.7397 0.228 0.760 0.012
#> GSM617600     3  0.0983     0.8103 0.004 0.016 0.980
#> GSM617601     2  0.1711     0.8851 0.008 0.960 0.032
#> GSM617602     3  0.1170     0.8126 0.016 0.008 0.976
#> GSM617603     2  0.1529     0.8833 0.000 0.960 0.040
#> GSM617604     3  0.3816     0.7650 0.148 0.000 0.852
#> GSM617605     2  0.2384     0.8807 0.008 0.936 0.056
#> GSM617606     2  0.2173     0.8835 0.008 0.944 0.048
#> GSM617610     1  0.2063     0.8118 0.948 0.044 0.008
#> GSM617611     1  0.5178     0.6327 0.744 0.000 0.256
#> GSM617613     3  0.2356     0.7873 0.000 0.072 0.928
#> GSM617614     3  0.2261     0.8083 0.068 0.000 0.932
#> GSM617621     1  0.2356     0.8123 0.928 0.000 0.072
#> GSM617629     3  0.3695     0.7600 0.012 0.108 0.880
#> GSM617630     3  0.6407     0.5530 0.028 0.272 0.700
#> GSM617631     3  0.1170     0.8110 0.008 0.016 0.976
#> GSM617633     3  0.3267     0.7932 0.116 0.000 0.884
#> GSM617642     3  0.2356     0.8076 0.072 0.000 0.928
#> GSM617645     2  0.3293     0.8662 0.088 0.900 0.012
#> GSM617646     1  0.6066     0.6600 0.728 0.024 0.248
#> GSM617652     3  0.3267     0.7892 0.116 0.000 0.884
#> GSM617655     3  0.2356     0.7874 0.000 0.072 0.928
#> GSM617656     3  0.1129     0.8128 0.020 0.004 0.976
#> GSM617657     3  0.5115     0.6350 0.004 0.228 0.768
#> GSM617658     3  0.2356     0.8085 0.072 0.000 0.928
#> GSM617659     3  0.5859     0.4812 0.344 0.000 0.656

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM617581     4  0.6294   -0.03160 0.436 0.048 0.004 0.512
#> GSM617582     1  0.9825    0.27001 0.348 0.208 0.216 0.228
#> GSM617588     4  0.1890    0.75451 0.008 0.056 0.000 0.936
#> GSM617590     4  0.3149    0.75199 0.000 0.088 0.032 0.880
#> GSM617592     4  0.1520    0.73105 0.020 0.024 0.000 0.956
#> GSM617607     2  0.6242   -0.05650 0.424 0.520 0.056 0.000
#> GSM617608     3  0.6780    0.16914 0.416 0.096 0.488 0.000
#> GSM617609     3  0.3257    0.70319 0.004 0.152 0.844 0.000
#> GSM617612     1  0.5791    0.65086 0.752 0.032 0.124 0.092
#> GSM617615     4  0.3711    0.72816 0.000 0.140 0.024 0.836
#> GSM617616     1  0.4846    0.70526 0.776 0.180 0.016 0.028
#> GSM617617     2  0.5180    0.59644 0.064 0.740 0.000 0.196
#> GSM617618     1  0.7418    0.53297 0.564 0.308 0.088 0.040
#> GSM617619     3  0.7026    0.27834 0.000 0.248 0.572 0.180
#> GSM617620     4  0.2480    0.75448 0.008 0.088 0.000 0.904
#> GSM617622     4  0.4244    0.72837 0.000 0.168 0.032 0.800
#> GSM617623     1  0.6584    0.38065 0.568 0.096 0.000 0.336
#> GSM617624     2  0.5351    0.58313 0.000 0.744 0.104 0.152
#> GSM617625     3  0.5509    0.67931 0.180 0.060 0.744 0.016
#> GSM617626     1  0.5614    0.42788 0.628 0.036 0.000 0.336
#> GSM617627     2  0.7524   -0.00522 0.000 0.408 0.184 0.408
#> GSM617628     3  0.3992    0.74823 0.080 0.040 0.856 0.024
#> GSM617632     1  0.5337    0.60785 0.704 0.260 0.012 0.024
#> GSM617634     2  0.5013    0.56365 0.004 0.764 0.056 0.176
#> GSM617635     2  0.5698    0.19726 0.356 0.608 0.036 0.000
#> GSM617636     2  0.7174    0.20998 0.272 0.580 0.136 0.012
#> GSM617637     1  0.4957    0.50310 0.668 0.320 0.000 0.012
#> GSM617638     2  0.3875    0.62850 0.004 0.852 0.068 0.076
#> GSM617639     1  0.4600    0.63449 0.744 0.240 0.012 0.004
#> GSM617640     2  0.5113    0.51404 0.024 0.684 0.000 0.292
#> GSM617641     4  0.2530    0.75309 0.000 0.100 0.004 0.896
#> GSM617643     2  0.4857    0.46871 0.008 0.668 0.000 0.324
#> GSM617644     4  0.4422    0.66265 0.008 0.256 0.000 0.736
#> GSM617647     2  0.6422    0.46760 0.104 0.616 0.000 0.280
#> GSM617648     2  0.4857    0.49896 0.016 0.700 0.000 0.284
#> GSM617649     2  0.5165    0.59270 0.000 0.752 0.080 0.168
#> GSM617650     3  0.6277    0.03877 0.468 0.056 0.476 0.000
#> GSM617651     1  0.2647    0.72967 0.880 0.120 0.000 0.000
#> GSM617653     1  0.2546    0.72914 0.912 0.060 0.000 0.028
#> GSM617654     2  0.4015    0.62586 0.052 0.832 0.000 0.116
#> GSM617583     3  0.6430    0.65370 0.148 0.028 0.700 0.124
#> GSM617584     4  0.4669    0.61338 0.168 0.052 0.000 0.780
#> GSM617585     4  0.6420    0.49573 0.000 0.132 0.228 0.640
#> GSM617586     3  0.2261    0.75867 0.008 0.024 0.932 0.036
#> GSM617587     3  0.2830    0.75024 0.004 0.060 0.904 0.032
#> GSM617589     4  0.4318    0.65185 0.116 0.068 0.000 0.816
#> GSM617591     4  0.4599    0.68254 0.000 0.088 0.112 0.800
#> GSM617593     1  0.4904    0.60616 0.744 0.040 0.216 0.000
#> GSM617594     4  0.5271    0.47632 0.020 0.340 0.000 0.640
#> GSM617595     1  0.2413    0.73413 0.916 0.064 0.020 0.000
#> GSM617596     1  0.5530    0.71118 0.760 0.144 0.072 0.024
#> GSM617597     3  0.4008    0.71669 0.148 0.032 0.820 0.000
#> GSM617598     1  0.3533    0.70912 0.872 0.020 0.088 0.020
#> GSM617599     4  0.7282   -0.02125 0.148 0.416 0.000 0.436
#> GSM617600     3  0.1661    0.75531 0.004 0.052 0.944 0.000
#> GSM617601     4  0.3351    0.73069 0.000 0.148 0.008 0.844
#> GSM617602     3  0.1388    0.75946 0.012 0.028 0.960 0.000
#> GSM617603     4  0.4303    0.71856 0.004 0.184 0.020 0.792
#> GSM617604     3  0.7085    0.50802 0.284 0.044 0.604 0.068
#> GSM617605     4  0.2101    0.75537 0.000 0.060 0.012 0.928
#> GSM617606     4  0.4988    0.65920 0.000 0.236 0.036 0.728
#> GSM617610     1  0.3069    0.73008 0.896 0.060 0.008 0.036
#> GSM617611     1  0.5812    0.57487 0.712 0.060 0.212 0.016
#> GSM617613     3  0.2949    0.72387 0.000 0.088 0.888 0.024
#> GSM617614     3  0.2981    0.74575 0.092 0.016 0.888 0.004
#> GSM617621     1  0.4542    0.73072 0.824 0.076 0.084 0.016
#> GSM617629     2  0.5318    0.32590 0.004 0.624 0.360 0.012
#> GSM617630     2  0.5072    0.56973 0.000 0.740 0.208 0.052
#> GSM617631     3  0.1811    0.75901 0.004 0.028 0.948 0.020
#> GSM617633     3  0.6407    0.29837 0.072 0.384 0.544 0.000
#> GSM617642     3  0.4360    0.71790 0.140 0.012 0.816 0.032
#> GSM617645     2  0.4290    0.59259 0.016 0.772 0.000 0.212
#> GSM617646     2  0.6276    0.09996 0.380 0.556 0.064 0.000
#> GSM617652     3  0.5229    0.66512 0.168 0.084 0.748 0.000
#> GSM617655     3  0.2670    0.74586 0.000 0.040 0.908 0.052
#> GSM617656     3  0.0657    0.75960 0.004 0.012 0.984 0.000
#> GSM617657     3  0.5883    0.54682 0.000 0.172 0.700 0.128
#> GSM617658     3  0.3556    0.74757 0.096 0.036 0.864 0.004
#> GSM617659     3  0.5244    0.28067 0.436 0.008 0.556 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
#> GSM617581     1  0.6768     0.1440 0.444 0.012 0.004 0.388 0.152
#> GSM617582     5  0.6459     0.3379 0.136 0.032 0.048 0.112 0.672
#> GSM617588     4  0.2535     0.7073 0.000 0.076 0.000 0.892 0.032
#> GSM617590     4  0.2393     0.7072 0.000 0.080 0.004 0.900 0.016
#> GSM617592     4  0.2607     0.6831 0.032 0.032 0.004 0.908 0.024
#> GSM617607     2  0.6603     0.2547 0.296 0.556 0.048 0.000 0.100
#> GSM617608     3  0.7081     0.2116 0.304 0.032 0.476 0.000 0.188
#> GSM617609     3  0.2866     0.6873 0.000 0.100 0.872 0.004 0.024
#> GSM617612     1  0.6399     0.4687 0.660 0.020 0.156 0.040 0.124
#> GSM617615     4  0.6807     0.4070 0.000 0.268 0.040 0.544 0.148
#> GSM617616     1  0.6290     0.3002 0.480 0.092 0.004 0.012 0.412
#> GSM617617     2  0.3673     0.6597 0.052 0.848 0.000 0.060 0.040
#> GSM617618     5  0.5182     0.3345 0.148 0.092 0.012 0.012 0.736
#> GSM617619     3  0.6672     0.3885 0.000 0.140 0.624 0.116 0.120
#> GSM617620     4  0.2824     0.6982 0.000 0.116 0.000 0.864 0.020
#> GSM617622     4  0.6049     0.5816 0.020 0.108 0.016 0.664 0.192
#> GSM617623     1  0.7016     0.1825 0.464 0.020 0.000 0.292 0.224
#> GSM617624     2  0.4550     0.6124 0.000 0.792 0.084 0.044 0.080
#> GSM617625     3  0.5670     0.5643 0.100 0.008 0.664 0.008 0.220
#> GSM617626     1  0.5186     0.4438 0.704 0.020 0.000 0.208 0.068
#> GSM617627     2  0.6472     0.3760 0.000 0.548 0.180 0.260 0.012
#> GSM617628     3  0.5082     0.6603 0.060 0.004 0.752 0.044 0.140
#> GSM617632     1  0.5427     0.3077 0.636 0.072 0.000 0.008 0.284
#> GSM617634     5  0.6204    -0.0679 0.000 0.436 0.020 0.080 0.464
#> GSM617635     2  0.4959     0.5322 0.144 0.752 0.040 0.000 0.064
#> GSM617636     5  0.7481     0.3276 0.260 0.200 0.040 0.012 0.488
#> GSM617637     1  0.5719     0.2561 0.564 0.348 0.004 0.000 0.084
#> GSM617638     2  0.4680     0.5750 0.004 0.760 0.028 0.036 0.172
#> GSM617639     1  0.4673     0.3954 0.680 0.288 0.012 0.000 0.020
#> GSM617640     2  0.3423     0.6661 0.012 0.840 0.004 0.128 0.016
#> GSM617641     4  0.2972     0.7004 0.004 0.108 0.000 0.864 0.024
#> GSM617643     2  0.4077     0.6319 0.000 0.780 0.004 0.172 0.044
#> GSM617644     4  0.6545     0.3605 0.000 0.284 0.000 0.476 0.240
#> GSM617647     2  0.4071     0.6478 0.072 0.808 0.000 0.108 0.012
#> GSM617648     2  0.6173     0.3426 0.012 0.568 0.000 0.124 0.296
#> GSM617649     2  0.4236     0.6466 0.000 0.812 0.056 0.088 0.044
#> GSM617650     3  0.5837     0.0810 0.444 0.028 0.488 0.000 0.040
#> GSM617651     1  0.5097     0.4896 0.712 0.076 0.004 0.008 0.200
#> GSM617653     1  0.2887     0.5105 0.884 0.016 0.000 0.028 0.072
#> GSM617654     2  0.3245     0.6496 0.020 0.872 0.004 0.036 0.068
#> GSM617583     3  0.6061     0.6278 0.092 0.012 0.700 0.084 0.112
#> GSM617584     4  0.5656     0.4274 0.244 0.028 0.000 0.656 0.072
#> GSM617585     4  0.5598     0.5510 0.000 0.048 0.060 0.684 0.208
#> GSM617586     3  0.2459     0.7124 0.012 0.024 0.916 0.036 0.012
#> GSM617587     3  0.2333     0.7123 0.008 0.040 0.920 0.020 0.012
#> GSM617589     4  0.5278     0.4832 0.024 0.024 0.004 0.640 0.308
#> GSM617591     4  0.6644     0.5094 0.000 0.108 0.204 0.608 0.080
#> GSM617593     1  0.3646     0.5162 0.844 0.036 0.088 0.000 0.032
#> GSM617594     2  0.7845     0.2148 0.080 0.480 0.056 0.316 0.068
#> GSM617595     1  0.6335     0.4737 0.640 0.100 0.072 0.000 0.188
#> GSM617596     1  0.5255     0.1458 0.556 0.012 0.000 0.028 0.404
#> GSM617597     3  0.3553     0.6884 0.128 0.024 0.832 0.000 0.016
#> GSM617598     1  0.4166     0.5176 0.788 0.008 0.040 0.004 0.160
#> GSM617599     2  0.7625     0.3727 0.068 0.512 0.012 0.208 0.200
#> GSM617600     3  0.1740     0.6991 0.000 0.012 0.932 0.000 0.056
#> GSM617601     4  0.5667     0.4346 0.000 0.296 0.040 0.624 0.040
#> GSM617602     3  0.4672     0.4596 0.016 0.004 0.676 0.008 0.296
#> GSM617603     4  0.5149     0.5962 0.000 0.104 0.000 0.680 0.216
#> GSM617604     1  0.7902     0.0610 0.412 0.000 0.116 0.160 0.312
#> GSM617605     4  0.3087     0.6889 0.004 0.044 0.004 0.872 0.076
#> GSM617606     4  0.6621     0.4233 0.000 0.120 0.028 0.508 0.344
#> GSM617610     1  0.5867     0.4685 0.640 0.056 0.016 0.020 0.268
#> GSM617611     1  0.7242     0.2063 0.436 0.032 0.320 0.000 0.212
#> GSM617613     3  0.2838     0.6795 0.000 0.036 0.884 0.008 0.072
#> GSM617614     3  0.4558     0.6618 0.100 0.000 0.776 0.016 0.108
#> GSM617621     1  0.3872     0.4945 0.828 0.024 0.004 0.032 0.112
#> GSM617629     5  0.6877     0.3737 0.004 0.264 0.204 0.016 0.512
#> GSM617630     2  0.6374     0.4105 0.004 0.624 0.128 0.036 0.208
#> GSM617631     3  0.4275     0.6541 0.024 0.000 0.796 0.052 0.128
#> GSM617633     3  0.7399     0.0433 0.052 0.280 0.464 0.000 0.204
#> GSM617642     3  0.4334     0.6863 0.116 0.004 0.800 0.060 0.020
#> GSM617645     2  0.2889     0.6714 0.016 0.880 0.000 0.084 0.020
#> GSM617646     2  0.5377     0.4791 0.204 0.700 0.048 0.000 0.048
#> GSM617652     3  0.4732     0.6556 0.096 0.112 0.772 0.008 0.012
#> GSM617655     3  0.1442     0.7115 0.000 0.012 0.952 0.032 0.004
#> GSM617656     3  0.0865     0.7089 0.000 0.000 0.972 0.004 0.024
#> GSM617657     3  0.6693     0.2245 0.000 0.052 0.544 0.100 0.304
#> GSM617658     5  0.7420    -0.0179 0.180 0.004 0.384 0.040 0.392
#> GSM617659     1  0.5381    -0.1055 0.484 0.004 0.468 0.000 0.044

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>           class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM617581     1   0.518     0.1530 0.544 0.004 0.004 0.396 0.036 0.016
#> GSM617582     5   0.571     0.1409 0.044 0.000 0.008 0.048 0.536 0.364
#> GSM617588     4   0.338     0.5736 0.008 0.060 0.000 0.844 0.016 0.072
#> GSM617590     4   0.277     0.5822 0.000 0.044 0.024 0.888 0.012 0.032
#> GSM617592     4   0.226     0.5813 0.048 0.012 0.004 0.912 0.004 0.020
#> GSM617607     2   0.592     0.4661 0.204 0.640 0.040 0.000 0.080 0.036
#> GSM617608     3   0.679     0.3008 0.180 0.032 0.424 0.000 0.016 0.348
#> GSM617609     3   0.390     0.5824 0.000 0.200 0.756 0.000 0.028 0.016
#> GSM617612     1   0.674     0.3339 0.524 0.064 0.224 0.012 0.000 0.176
#> GSM617615     4   0.734    -0.0152 0.000 0.204 0.072 0.364 0.016 0.344
#> GSM617616     6   0.551     0.1218 0.112 0.024 0.000 0.004 0.232 0.628
#> GSM617617     2   0.468     0.6501 0.016 0.748 0.000 0.064 0.144 0.028
#> GSM617618     5   0.535    -0.0178 0.052 0.000 0.008 0.012 0.472 0.456
#> GSM617619     3   0.709     0.2804 0.000 0.112 0.528 0.180 0.156 0.024
#> GSM617620     4   0.258     0.5899 0.012 0.064 0.000 0.892 0.012 0.020
#> GSM617622     4   0.613     0.4458 0.080 0.032 0.008 0.648 0.176 0.056
#> GSM617623     1   0.562     0.2992 0.596 0.016 0.000 0.296 0.068 0.024
#> GSM617624     2   0.500     0.6475 0.000 0.724 0.048 0.032 0.164 0.032
#> GSM617625     3   0.462     0.5477 0.048 0.004 0.624 0.000 0.000 0.324
#> GSM617626     1   0.417     0.4964 0.768 0.004 0.000 0.156 0.020 0.052
#> GSM617627     2   0.654     0.4374 0.000 0.564 0.156 0.212 0.036 0.032
#> GSM617628     3   0.484     0.4740 0.024 0.000 0.568 0.016 0.004 0.388
#> GSM617632     1   0.547     0.1296 0.492 0.012 0.000 0.008 0.424 0.064
#> GSM617634     5   0.486     0.2544 0.000 0.108 0.004 0.008 0.692 0.188
#> GSM617635     2   0.475     0.6092 0.064 0.772 0.052 0.000 0.060 0.052
#> GSM617636     5   0.426     0.3926 0.116 0.048 0.016 0.008 0.792 0.020
#> GSM617637     1   0.621     0.1398 0.448 0.396 0.008 0.000 0.024 0.124
#> GSM617638     2   0.485     0.6111 0.000 0.688 0.024 0.024 0.240 0.024
#> GSM617639     1   0.483     0.1823 0.532 0.424 0.016 0.000 0.000 0.028
#> GSM617640     2   0.327     0.6842 0.000 0.844 0.004 0.100 0.028 0.024
#> GSM617641     4   0.247     0.5931 0.024 0.056 0.004 0.900 0.012 0.004
#> GSM617643     2   0.524     0.5996 0.000 0.708 0.004 0.080 0.108 0.100
#> GSM617644     6   0.722     0.3059 0.000 0.148 0.000 0.188 0.224 0.440
#> GSM617647     2   0.369     0.6679 0.032 0.820 0.000 0.108 0.008 0.032
#> GSM617648     5   0.598     0.0253 0.004 0.228 0.000 0.024 0.572 0.172
#> GSM617649     2   0.557     0.6299 0.000 0.700 0.040 0.064 0.132 0.064
#> GSM617650     3   0.627     0.3353 0.320 0.036 0.532 0.000 0.024 0.088
#> GSM617651     1   0.551     0.3452 0.500 0.068 0.012 0.000 0.008 0.412
#> GSM617653     1   0.240     0.5428 0.908 0.020 0.000 0.032 0.012 0.028
#> GSM617654     2   0.363     0.6806 0.000 0.824 0.000 0.052 0.084 0.040
#> GSM617583     3   0.465     0.6363 0.044 0.000 0.740 0.036 0.012 0.168
#> GSM617584     4   0.491     0.3331 0.324 0.020 0.004 0.624 0.016 0.012
#> GSM617585     4   0.666     0.2919 0.004 0.012 0.068 0.520 0.292 0.104
#> GSM617586     3   0.222     0.6675 0.004 0.036 0.912 0.012 0.000 0.036
#> GSM617587     3   0.326     0.6488 0.000 0.072 0.852 0.048 0.004 0.024
#> GSM617589     6   0.432     0.1482 0.008 0.004 0.000 0.324 0.016 0.648
#> GSM617591     4   0.684     0.2569 0.000 0.132 0.232 0.512 0.004 0.120
#> GSM617593     1   0.410     0.5271 0.800 0.044 0.092 0.000 0.008 0.056
#> GSM617594     2   0.851     0.1440 0.088 0.400 0.096 0.260 0.032 0.124
#> GSM617595     1   0.676     0.3705 0.484 0.124 0.092 0.000 0.004 0.296
#> GSM617596     1   0.485     0.3702 0.664 0.000 0.008 0.052 0.264 0.012
#> GSM617597     3   0.365     0.6669 0.100 0.028 0.828 0.000 0.024 0.020
#> GSM617598     1   0.502     0.4377 0.592 0.008 0.056 0.000 0.004 0.340
#> GSM617599     6   0.767     0.0615 0.020 0.352 0.008 0.096 0.164 0.360
#> GSM617600     3   0.235     0.6358 0.000 0.008 0.876 0.000 0.112 0.004
#> GSM617601     4   0.622     0.2954 0.000 0.280 0.092 0.544 0.000 0.084
#> GSM617602     3   0.486     0.2204 0.028 0.000 0.548 0.012 0.408 0.004
#> GSM617603     4   0.642     0.2331 0.004 0.032 0.004 0.504 0.300 0.156
#> GSM617604     1   0.647     0.3727 0.580 0.000 0.064 0.188 0.152 0.016
#> GSM617605     4   0.211     0.5849 0.024 0.004 0.000 0.920 0.024 0.028
#> GSM617606     4   0.732    -0.0561 0.004 0.052 0.012 0.344 0.260 0.328
#> GSM617610     1   0.540     0.4037 0.544 0.072 0.020 0.000 0.000 0.364
#> GSM617611     3   0.729     0.0782 0.288 0.116 0.380 0.000 0.000 0.216
#> GSM617613     3   0.382     0.5890 0.000 0.016 0.780 0.012 0.176 0.016
#> GSM617614     3   0.413     0.6370 0.072 0.000 0.792 0.020 0.104 0.012
#> GSM617621     1   0.327     0.5346 0.864 0.028 0.016 0.064 0.020 0.008
#> GSM617629     5   0.264     0.4171 0.000 0.044 0.040 0.008 0.892 0.016
#> GSM617630     2   0.589     0.5241 0.004 0.640 0.088 0.020 0.208 0.040
#> GSM617631     3   0.377     0.5726 0.004 0.000 0.772 0.036 0.184 0.004
#> GSM617633     5   0.683     0.3043 0.016 0.164 0.232 0.000 0.520 0.068
#> GSM617642     3   0.348     0.6646 0.096 0.000 0.836 0.032 0.008 0.028
#> GSM617645     2   0.279     0.6874 0.000 0.876 0.012 0.080 0.008 0.024
#> GSM617646     2   0.482     0.5941 0.092 0.768 0.044 0.004 0.036 0.056
#> GSM617652     3   0.423     0.6208 0.068 0.144 0.764 0.000 0.000 0.024
#> GSM617655     3   0.207     0.6617 0.000 0.020 0.924 0.028 0.012 0.016
#> GSM617656     3   0.154     0.6588 0.008 0.004 0.936 0.000 0.052 0.000
#> GSM617657     5   0.594     0.0549 0.000 0.012 0.408 0.068 0.480 0.032
#> GSM617658     5   0.707     0.1021 0.184 0.000 0.324 0.044 0.424 0.024
#> GSM617659     3   0.564     0.1581 0.440 0.000 0.460 0.000 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-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) k
#> CV:NMF 78          0.03818 2
#> CV:NMF 71          0.00093 3
#> CV:NMF 58          0.01018 4
#> CV:NMF 38          0.00576 5
#> CV:NMF 35          0.00437 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 21168 rows and 79 columns.
#>   Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'MAD' method.
#>   Subgroups are detected by 'hclust' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 5.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

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

collect_plots(res)

plot of chunk MAD-hclust-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.172           0.644       0.823         0.3296 0.705   0.705
#> 3 3 0.231           0.499       0.773         0.6640 0.747   0.650
#> 4 4 0.273           0.383       0.698         0.1320 0.923   0.843
#> 5 5 0.302           0.513       0.685         0.0944 0.785   0.526
#> 6 6 0.370           0.487       0.678         0.0685 0.953   0.833

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

suggest_best_k(res)
#> [1] 5

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

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

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>           class entropy silhouette    p1    p2
#> GSM617581     2  0.5294     0.7982 0.120 0.880
#> GSM617582     2  0.7139     0.6535 0.196 0.804
#> GSM617588     2  0.6887     0.7367 0.184 0.816
#> GSM617590     2  0.7139     0.7324 0.196 0.804
#> GSM617592     2  0.6531     0.7524 0.168 0.832
#> GSM617607     2  0.3733     0.7985 0.072 0.928
#> GSM617608     2  0.9393     0.0311 0.356 0.644
#> GSM617609     1  0.9988     0.5230 0.520 0.480
#> GSM617612     2  0.2043     0.8040 0.032 0.968
#> GSM617615     2  0.5946     0.7743 0.144 0.856
#> GSM617616     2  0.6531     0.6956 0.168 0.832
#> GSM617617     2  0.3274     0.7998 0.060 0.940
#> GSM617618     2  0.6148     0.7192 0.152 0.848
#> GSM617619     2  0.9754     0.0386 0.408 0.592
#> GSM617620     2  0.6438     0.7553 0.164 0.836
#> GSM617622     2  0.5178     0.7889 0.116 0.884
#> GSM617623     2  0.3584     0.8071 0.068 0.932
#> GSM617624     2  0.5294     0.7947 0.120 0.880
#> GSM617625     1  0.9998     0.5067 0.508 0.492
#> GSM617626     2  0.3114     0.7959 0.056 0.944
#> GSM617627     2  0.4690     0.7981 0.100 0.900
#> GSM617628     1  1.0000     0.4912 0.500 0.500
#> GSM617632     2  0.3274     0.7905 0.060 0.940
#> GSM617634     2  0.7376     0.6761 0.208 0.792
#> GSM617635     2  0.1414     0.8013 0.020 0.980
#> GSM617636     2  0.4298     0.7851 0.088 0.912
#> GSM617637     2  0.0672     0.7984 0.008 0.992
#> GSM617638     2  0.5946     0.7728 0.144 0.856
#> GSM617639     2  0.1843     0.7993 0.028 0.972
#> GSM617640     2  0.2948     0.8002 0.052 0.948
#> GSM617641     2  0.6973     0.7352 0.188 0.812
#> GSM617643     2  0.4161     0.7968 0.084 0.916
#> GSM617644     2  0.6531     0.7530 0.168 0.832
#> GSM617647     2  0.3114     0.7997 0.056 0.944
#> GSM617648     2  0.4022     0.7991 0.080 0.920
#> GSM617649     2  0.4161     0.7969 0.084 0.916
#> GSM617650     2  0.3114     0.7951 0.056 0.944
#> GSM617651     2  0.1843     0.8016 0.028 0.972
#> GSM617653     2  0.2043     0.8033 0.032 0.968
#> GSM617654     2  0.1843     0.7963 0.028 0.972
#> GSM617583     2  0.9795    -0.2097 0.416 0.584
#> GSM617584     2  0.4939     0.7906 0.108 0.892
#> GSM617585     1  0.9881     0.4829 0.564 0.436
#> GSM617586     1  0.9963     0.5431 0.536 0.464
#> GSM617587     2  0.9977    -0.3732 0.472 0.528
#> GSM617589     2  0.6887     0.7354 0.184 0.816
#> GSM617591     2  0.9460     0.2125 0.364 0.636
#> GSM617593     2  0.4815     0.7631 0.104 0.896
#> GSM617594     2  0.4022     0.7988 0.080 0.920
#> GSM617595     2  0.0376     0.7976 0.004 0.996
#> GSM617596     2  0.3879     0.7931 0.076 0.924
#> GSM617597     2  0.9933    -0.3910 0.452 0.548
#> GSM617598     2  0.1184     0.8001 0.016 0.984
#> GSM617599     2  0.3584     0.8038 0.068 0.932
#> GSM617600     1  0.9248     0.6975 0.660 0.340
#> GSM617601     2  0.4562     0.7966 0.096 0.904
#> GSM617602     1  0.9209     0.6901 0.664 0.336
#> GSM617603     2  0.7056     0.7298 0.192 0.808
#> GSM617604     2  0.6801     0.7280 0.180 0.820
#> GSM617605     2  0.7139     0.7324 0.196 0.804
#> GSM617606     2  0.7299     0.6952 0.204 0.796
#> GSM617610     2  0.0938     0.7987 0.012 0.988
#> GSM617611     2  0.2778     0.8010 0.048 0.952
#> GSM617613     1  0.3879     0.6153 0.924 0.076
#> GSM617614     2  0.9850    -0.2565 0.428 0.572
#> GSM617621     2  0.2948     0.8009 0.052 0.948
#> GSM617629     1  0.6247     0.6464 0.844 0.156
#> GSM617630     2  0.7528     0.6409 0.216 0.784
#> GSM617631     1  0.8207     0.7114 0.744 0.256
#> GSM617633     2  0.6048     0.7331 0.148 0.852
#> GSM617642     2  0.9998    -0.4537 0.492 0.508
#> GSM617645     2  0.2236     0.7956 0.036 0.964
#> GSM617646     2  0.0672     0.7991 0.008 0.992
#> GSM617652     2  0.7528     0.6007 0.216 0.784
#> GSM617655     1  0.9933     0.5691 0.548 0.452
#> GSM617656     1  0.9087     0.7056 0.676 0.324
#> GSM617657     1  0.1843     0.5823 0.972 0.028
#> GSM617658     1  0.8207     0.7114 0.744 0.256
#> GSM617659     2  0.5408     0.7403 0.124 0.876

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>           class entropy silhouette    p1    p2    p3
#> GSM617581     1  0.6388     0.5963 0.752 0.184 0.064
#> GSM617582     1  0.5956     0.5721 0.768 0.044 0.188
#> GSM617588     2  0.1751     0.7999 0.028 0.960 0.012
#> GSM617590     2  0.1015     0.7964 0.008 0.980 0.012
#> GSM617592     2  0.2651     0.8025 0.060 0.928 0.012
#> GSM617607     1  0.2400     0.6794 0.932 0.004 0.064
#> GSM617608     1  0.6427     0.1341 0.640 0.012 0.348
#> GSM617609     3  0.6941     0.4500 0.464 0.016 0.520
#> GSM617612     1  0.1585     0.6864 0.964 0.008 0.028
#> GSM617615     2  0.4563     0.7785 0.112 0.852 0.036
#> GSM617616     1  0.5119     0.6150 0.812 0.028 0.160
#> GSM617617     1  0.4645     0.6233 0.816 0.176 0.008
#> GSM617618     1  0.4810     0.6320 0.832 0.028 0.140
#> GSM617619     1  0.9409    -0.0342 0.460 0.180 0.360
#> GSM617620     2  0.4045     0.7917 0.104 0.872 0.024
#> GSM617622     2  0.6859     0.4183 0.356 0.620 0.024
#> GSM617623     1  0.3649     0.6804 0.896 0.068 0.036
#> GSM617624     1  0.7749     0.4563 0.624 0.300 0.076
#> GSM617625     3  0.7585     0.3804 0.476 0.040 0.484
#> GSM617626     1  0.3369     0.6834 0.908 0.040 0.052
#> GSM617627     1  0.7624     0.3070 0.580 0.368 0.052
#> GSM617628     1  0.7674    -0.4176 0.480 0.044 0.476
#> GSM617632     1  0.2066     0.6789 0.940 0.000 0.060
#> GSM617634     1  0.8263     0.4477 0.636 0.188 0.176
#> GSM617635     1  0.1031     0.6856 0.976 0.000 0.024
#> GSM617636     1  0.2625     0.6712 0.916 0.000 0.084
#> GSM617637     1  0.1170     0.6866 0.976 0.008 0.016
#> GSM617638     1  0.5656     0.6385 0.804 0.068 0.128
#> GSM617639     1  0.1163     0.6839 0.972 0.000 0.028
#> GSM617640     1  0.4099     0.6448 0.852 0.140 0.008
#> GSM617641     2  0.1491     0.7976 0.016 0.968 0.016
#> GSM617643     1  0.6669     0.0412 0.524 0.468 0.008
#> GSM617644     2  0.4475     0.7596 0.144 0.840 0.016
#> GSM617647     1  0.6262     0.4983 0.696 0.284 0.020
#> GSM617648     2  0.6520     0.0184 0.488 0.508 0.004
#> GSM617649     1  0.6509     0.0360 0.524 0.472 0.004
#> GSM617650     1  0.1860     0.6793 0.948 0.000 0.052
#> GSM617651     1  0.1315     0.6850 0.972 0.008 0.020
#> GSM617653     1  0.1482     0.6860 0.968 0.012 0.020
#> GSM617654     1  0.3325     0.6645 0.904 0.076 0.020
#> GSM617583     1  0.7339    -0.1070 0.572 0.036 0.392
#> GSM617584     2  0.5486     0.7188 0.196 0.780 0.024
#> GSM617585     3  0.8337     0.1372 0.088 0.376 0.536
#> GSM617586     3  0.6793     0.4759 0.452 0.012 0.536
#> GSM617587     1  0.7069    -0.3485 0.508 0.020 0.472
#> GSM617589     2  0.1919     0.7922 0.020 0.956 0.024
#> GSM617591     1  0.9805    -0.1856 0.424 0.256 0.320
#> GSM617593     1  0.2959     0.6537 0.900 0.000 0.100
#> GSM617594     1  0.6950     0.2314 0.572 0.408 0.020
#> GSM617595     1  0.0424     0.6826 0.992 0.000 0.008
#> GSM617596     1  0.2590     0.6750 0.924 0.004 0.072
#> GSM617597     1  0.6483    -0.2862 0.544 0.004 0.452
#> GSM617598     1  0.0747     0.6844 0.984 0.000 0.016
#> GSM617599     1  0.6608     0.3845 0.628 0.356 0.016
#> GSM617600     3  0.6497     0.6487 0.336 0.016 0.648
#> GSM617601     1  0.7169     0.0804 0.520 0.456 0.024
#> GSM617602     3  0.5760     0.6445 0.328 0.000 0.672
#> GSM617603     2  0.1919     0.7950 0.020 0.956 0.024
#> GSM617604     1  0.5696     0.6068 0.796 0.056 0.148
#> GSM617605     2  0.1015     0.7964 0.008 0.980 0.012
#> GSM617606     2  0.8520     0.3845 0.280 0.588 0.132
#> GSM617610     1  0.0829     0.6849 0.984 0.004 0.012
#> GSM617611     1  0.2229     0.6856 0.944 0.012 0.044
#> GSM617613     3  0.2651     0.5953 0.060 0.012 0.928
#> GSM617614     1  0.6859    -0.1411 0.564 0.016 0.420
#> GSM617621     1  0.2200     0.6846 0.940 0.004 0.056
#> GSM617629     3  0.4291     0.6501 0.152 0.008 0.840
#> GSM617630     1  0.6585     0.5512 0.736 0.064 0.200
#> GSM617631     3  0.5325     0.6915 0.248 0.004 0.748
#> GSM617633     1  0.3983     0.6340 0.852 0.004 0.144
#> GSM617642     1  0.6683    -0.3993 0.500 0.008 0.492
#> GSM617645     1  0.3765     0.6587 0.888 0.084 0.028
#> GSM617646     1  0.0848     0.6854 0.984 0.008 0.008
#> GSM617652     1  0.6354     0.5140 0.744 0.052 0.204
#> GSM617655     3  0.6771     0.5066 0.440 0.012 0.548
#> GSM617656     3  0.5929     0.6636 0.320 0.004 0.676
#> GSM617657     3  0.1182     0.5304 0.012 0.012 0.976
#> GSM617658     3  0.5325     0.6915 0.248 0.004 0.748
#> GSM617659     1  0.3340     0.6375 0.880 0.000 0.120

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM617581     1  0.6616     0.3862 0.700 0.132 0.048 0.120
#> GSM617582     1  0.5430     0.5012 0.752 0.036 0.180 0.032
#> GSM617588     4  0.3052     0.7572 0.004 0.136 0.000 0.860
#> GSM617590     4  0.2654     0.7695 0.000 0.108 0.004 0.888
#> GSM617592     4  0.3105     0.7510 0.004 0.140 0.000 0.856
#> GSM617607     1  0.2797     0.6149 0.900 0.032 0.068 0.000
#> GSM617608     1  0.5847     0.0279 0.612 0.024 0.352 0.012
#> GSM617609     3  0.6194     0.4758 0.428 0.036 0.528 0.008
#> GSM617612     1  0.1707     0.6164 0.952 0.024 0.020 0.004
#> GSM617615     4  0.4774     0.7017 0.072 0.096 0.020 0.812
#> GSM617616     1  0.4687     0.5469 0.796 0.040 0.152 0.012
#> GSM617617     1  0.6256    -0.0950 0.580 0.360 0.004 0.056
#> GSM617618     1  0.4400     0.5615 0.816 0.036 0.136 0.012
#> GSM617619     1  0.8964    -0.1436 0.372 0.204 0.356 0.068
#> GSM617620     4  0.3999     0.7325 0.036 0.140 0.000 0.824
#> GSM617622     2  0.7955     0.5099 0.240 0.448 0.008 0.304
#> GSM617623     1  0.3460     0.5755 0.884 0.056 0.024 0.036
#> GSM617624     1  0.7991    -0.4912 0.464 0.384 0.052 0.100
#> GSM617625     3  0.6443     0.4215 0.460 0.016 0.488 0.036
#> GSM617626     1  0.3030     0.6101 0.904 0.036 0.036 0.024
#> GSM617627     1  0.7873    -0.6767 0.424 0.420 0.028 0.128
#> GSM617628     3  0.6517     0.4094 0.464 0.016 0.480 0.040
#> GSM617632     1  0.1888     0.6184 0.940 0.016 0.044 0.000
#> GSM617634     1  0.8075     0.1117 0.568 0.196 0.172 0.064
#> GSM617635     1  0.1297     0.6100 0.964 0.020 0.016 0.000
#> GSM617636     1  0.2473     0.6183 0.908 0.012 0.080 0.000
#> GSM617637     1  0.1639     0.6037 0.952 0.036 0.008 0.004
#> GSM617638     1  0.6759     0.1052 0.548 0.344 0.108 0.000
#> GSM617639     1  0.1520     0.6116 0.956 0.024 0.020 0.000
#> GSM617640     1  0.6095    -0.0385 0.552 0.404 0.004 0.040
#> GSM617641     4  0.1389     0.7604 0.000 0.048 0.000 0.952
#> GSM617643     2  0.7349     0.8287 0.384 0.456 0.000 0.160
#> GSM617644     4  0.6532     0.3481 0.092 0.336 0.000 0.572
#> GSM617647     1  0.6532    -0.3895 0.548 0.368 0.000 0.084
#> GSM617648     2  0.7489     0.8278 0.364 0.452 0.000 0.184
#> GSM617649     2  0.7292     0.8288 0.388 0.460 0.000 0.152
#> GSM617650     1  0.1576     0.6194 0.948 0.004 0.048 0.000
#> GSM617651     1  0.1151     0.6124 0.968 0.024 0.008 0.000
#> GSM617653     1  0.1229     0.6134 0.968 0.020 0.008 0.004
#> GSM617654     1  0.5168    -0.0248 0.504 0.492 0.004 0.000
#> GSM617583     1  0.6252    -0.1870 0.564 0.016 0.388 0.032
#> GSM617584     4  0.5954     0.5714 0.112 0.168 0.008 0.712
#> GSM617585     3  0.8027     0.1079 0.080 0.092 0.540 0.288
#> GSM617586     3  0.5552     0.4795 0.440 0.008 0.544 0.008
#> GSM617587     1  0.6305    -0.3888 0.480 0.040 0.472 0.008
#> GSM617589     4  0.1022     0.7503 0.000 0.032 0.000 0.968
#> GSM617591     1  0.9474    -0.2428 0.376 0.152 0.308 0.164
#> GSM617593     1  0.2334     0.6074 0.908 0.004 0.088 0.000
#> GSM617594     1  0.7352    -0.7358 0.436 0.424 0.004 0.136
#> GSM617595     1  0.0779     0.6043 0.980 0.016 0.004 0.000
#> GSM617596     1  0.2198     0.6197 0.920 0.008 0.072 0.000
#> GSM617597     1  0.4981    -0.3181 0.536 0.000 0.464 0.000
#> GSM617598     1  0.1042     0.6092 0.972 0.020 0.008 0.000
#> GSM617599     1  0.7382    -0.5231 0.520 0.348 0.016 0.116
#> GSM617600     3  0.5173     0.6277 0.320 0.020 0.660 0.000
#> GSM617601     2  0.7747     0.7835 0.380 0.436 0.008 0.176
#> GSM617602     3  0.4978     0.6156 0.324 0.012 0.664 0.000
#> GSM617603     4  0.4088     0.6789 0.000 0.232 0.004 0.764
#> GSM617604     1  0.4968     0.5566 0.788 0.040 0.148 0.024
#> GSM617605     4  0.2654     0.7695 0.000 0.108 0.004 0.888
#> GSM617606     4  0.9432    -0.0422 0.232 0.252 0.120 0.396
#> GSM617610     1  0.1082     0.6076 0.972 0.020 0.004 0.004
#> GSM617611     1  0.2039     0.6180 0.940 0.016 0.036 0.008
#> GSM617613     3  0.3168     0.5296 0.056 0.060 0.884 0.000
#> GSM617614     1  0.5838    -0.1779 0.560 0.012 0.412 0.016
#> GSM617621     1  0.2313     0.6162 0.924 0.032 0.044 0.000
#> GSM617629     3  0.4387     0.6003 0.144 0.052 0.804 0.000
#> GSM617630     1  0.7476     0.0940 0.412 0.412 0.176 0.000
#> GSM617631     3  0.4420     0.6556 0.240 0.012 0.748 0.000
#> GSM617633     1  0.3495     0.5746 0.844 0.016 0.140 0.000
#> GSM617642     1  0.5336    -0.4024 0.496 0.004 0.496 0.004
#> GSM617645     1  0.5167    -0.0222 0.508 0.488 0.004 0.000
#> GSM617646     1  0.1722     0.5997 0.944 0.048 0.008 0.000
#> GSM617652     1  0.6425     0.4348 0.688 0.088 0.196 0.028
#> GSM617655     3  0.5532     0.5058 0.428 0.008 0.556 0.008
#> GSM617656     3  0.4655     0.6372 0.312 0.004 0.684 0.000
#> GSM617657     3  0.2589     0.3911 0.000 0.116 0.884 0.000
#> GSM617658     3  0.4420     0.6556 0.240 0.012 0.748 0.000
#> GSM617659     1  0.2714     0.5890 0.884 0.004 0.112 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
#> GSM617581     1  0.6475    0.46205 0.664 0.172 0.048 0.080 0.036
#> GSM617582     1  0.5700    0.56516 0.712 0.060 0.168 0.020 0.040
#> GSM617588     4  0.3988    0.72961 0.000 0.252 0.000 0.732 0.016
#> GSM617590     4  0.3993    0.75957 0.000 0.216 0.000 0.756 0.028
#> GSM617592     4  0.3565    0.75981 0.000 0.176 0.000 0.800 0.024
#> GSM617607     1  0.3343    0.72368 0.860 0.028 0.084 0.000 0.028
#> GSM617608     1  0.5766   -0.00512 0.568 0.028 0.368 0.008 0.028
#> GSM617609     3  0.5602    0.51894 0.380 0.036 0.560 0.000 0.024
#> GSM617612     1  0.1498    0.74616 0.952 0.016 0.024 0.000 0.008
#> GSM617615     4  0.5094    0.70893 0.056 0.108 0.024 0.772 0.040
#> GSM617616     1  0.5018    0.62044 0.756 0.056 0.140 0.004 0.044
#> GSM617617     1  0.7588   -0.59674 0.344 0.328 0.008 0.024 0.296
#> GSM617618     1  0.4838    0.63588 0.768 0.052 0.136 0.004 0.040
#> GSM617619     3  0.8283    0.17462 0.272 0.268 0.376 0.024 0.060
#> GSM617620     4  0.4226    0.74168 0.012 0.188 0.000 0.768 0.032
#> GSM617622     2  0.6536    0.44514 0.160 0.616 0.008 0.184 0.032
#> GSM617623     1  0.3581    0.70254 0.848 0.100 0.028 0.012 0.012
#> GSM617624     2  0.7389    0.39488 0.316 0.496 0.056 0.016 0.116
#> GSM617625     3  0.5997    0.43932 0.428 0.028 0.504 0.020 0.020
#> GSM617626     1  0.2963    0.73939 0.888 0.048 0.044 0.016 0.004
#> GSM617627     2  0.6892    0.50686 0.260 0.572 0.024 0.028 0.116
#> GSM617628     3  0.6078    0.42639 0.432 0.028 0.496 0.024 0.020
#> GSM617632     1  0.1978    0.74333 0.928 0.024 0.044 0.000 0.004
#> GSM617634     1  0.7688   -0.04825 0.456 0.304 0.172 0.012 0.056
#> GSM617635     1  0.1560    0.74743 0.948 0.028 0.020 0.000 0.004
#> GSM617636     1  0.2712    0.73209 0.880 0.032 0.088 0.000 0.000
#> GSM617637     1  0.1618    0.74115 0.944 0.040 0.008 0.000 0.008
#> GSM617638     5  0.8123    0.39432 0.312 0.216 0.112 0.000 0.360
#> GSM617639     1  0.1377    0.74565 0.956 0.020 0.020 0.000 0.004
#> GSM617640     5  0.7116    0.50247 0.288 0.252 0.000 0.020 0.440
#> GSM617641     4  0.2172    0.77483 0.000 0.076 0.000 0.908 0.016
#> GSM617643     2  0.5185    0.59345 0.236 0.692 0.000 0.032 0.040
#> GSM617644     2  0.5724   -0.21759 0.044 0.552 0.004 0.384 0.016
#> GSM617647     2  0.6501    0.34154 0.396 0.472 0.004 0.012 0.116
#> GSM617648     2  0.5041    0.59345 0.236 0.700 0.004 0.048 0.012
#> GSM617649     2  0.4703    0.60156 0.240 0.716 0.004 0.028 0.012
#> GSM617650     1  0.1270    0.74299 0.948 0.000 0.052 0.000 0.000
#> GSM617651     1  0.1087    0.74578 0.968 0.016 0.008 0.000 0.008
#> GSM617653     1  0.1362    0.74687 0.960 0.016 0.012 0.004 0.008
#> GSM617654     5  0.5357    0.64352 0.224 0.104 0.000 0.004 0.668
#> GSM617583     1  0.5733   -0.21721 0.536 0.020 0.408 0.020 0.016
#> GSM617584     4  0.5900    0.60561 0.076 0.220 0.008 0.664 0.032
#> GSM617585     3  0.7723    0.13794 0.052 0.168 0.540 0.196 0.044
#> GSM617586     3  0.4980    0.51010 0.396 0.020 0.576 0.000 0.008
#> GSM617587     3  0.5633    0.41023 0.440 0.048 0.500 0.000 0.012
#> GSM617589     4  0.1822    0.74887 0.004 0.036 0.000 0.936 0.024
#> GSM617591     3  0.9118    0.30141 0.304 0.184 0.332 0.112 0.068
#> GSM617593     1  0.2629    0.71197 0.880 0.004 0.104 0.000 0.012
#> GSM617594     2  0.5468    0.56945 0.312 0.628 0.008 0.016 0.036
#> GSM617595     1  0.1059    0.74175 0.968 0.020 0.008 0.000 0.004
#> GSM617596     1  0.2707    0.73378 0.888 0.024 0.080 0.000 0.008
#> GSM617597     1  0.4560   -0.33416 0.508 0.000 0.484 0.000 0.008
#> GSM617598     1  0.0854    0.74382 0.976 0.012 0.008 0.000 0.004
#> GSM617599     2  0.6404    0.48397 0.372 0.532 0.028 0.024 0.044
#> GSM617600     3  0.4605    0.61475 0.272 0.032 0.692 0.000 0.004
#> GSM617601     2  0.5898    0.59179 0.240 0.656 0.008 0.048 0.048
#> GSM617602     3  0.4769    0.58275 0.288 0.020 0.676 0.000 0.016
#> GSM617603     4  0.5322    0.48819 0.000 0.408 0.004 0.544 0.044
#> GSM617604     1  0.4759    0.62801 0.756 0.072 0.156 0.004 0.012
#> GSM617605     4  0.3993    0.75957 0.000 0.216 0.000 0.756 0.028
#> GSM617606     2  0.9401    0.00821 0.168 0.348 0.140 0.248 0.096
#> GSM617610     1  0.0960    0.74433 0.972 0.016 0.008 0.000 0.004
#> GSM617611     1  0.1843    0.74477 0.936 0.012 0.044 0.004 0.004
#> GSM617613     3  0.3756    0.36357 0.032 0.036 0.836 0.000 0.096
#> GSM617614     1  0.5671   -0.22808 0.516 0.016 0.432 0.012 0.024
#> GSM617621     1  0.2627    0.74431 0.900 0.044 0.044 0.000 0.012
#> GSM617629     3  0.4918    0.44792 0.108 0.044 0.764 0.000 0.084
#> GSM617630     5  0.7141    0.48809 0.192 0.076 0.180 0.000 0.552
#> GSM617631     3  0.4301    0.60330 0.204 0.020 0.756 0.000 0.020
#> GSM617633     1  0.3824    0.67505 0.820 0.024 0.128 0.000 0.028
#> GSM617642     3  0.4895    0.40516 0.452 0.012 0.528 0.000 0.008
#> GSM617645     5  0.5847    0.65564 0.236 0.132 0.000 0.008 0.624
#> GSM617646     1  0.2825    0.70885 0.888 0.076 0.012 0.004 0.020
#> GSM617652     1  0.6203    0.40335 0.644 0.084 0.216 0.004 0.052
#> GSM617655     3  0.4950    0.52936 0.384 0.020 0.588 0.000 0.008
#> GSM617656     3  0.3838    0.61021 0.280 0.004 0.716 0.000 0.000
#> GSM617657     3  0.4701    0.15941 0.000 0.076 0.720 0.000 0.204
#> GSM617658     3  0.4301    0.60330 0.204 0.020 0.756 0.000 0.020
#> GSM617659     1  0.2929    0.68853 0.856 0.004 0.128 0.000 0.012

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>           class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM617581     1  0.6622     0.5042 0.632 0.148 0.064 0.092 0.024 0.040
#> GSM617582     1  0.6169     0.5166 0.624 0.072 0.196 0.016 0.004 0.088
#> GSM617588     4  0.4794     0.5573 0.000 0.228 0.004 0.668 0.000 0.100
#> GSM617590     4  0.4602     0.6050 0.000 0.148 0.004 0.708 0.000 0.140
#> GSM617592     4  0.3897     0.6575 0.000 0.164 0.004 0.780 0.016 0.036
#> GSM617607     1  0.3432     0.7509 0.840 0.032 0.092 0.000 0.028 0.008
#> GSM617608     1  0.5513    -0.0126 0.536 0.036 0.388 0.004 0.020 0.016
#> GSM617609     3  0.5185     0.5453 0.324 0.048 0.600 0.000 0.024 0.004
#> GSM617612     1  0.1642     0.7774 0.936 0.028 0.032 0.000 0.000 0.004
#> GSM617615     4  0.5212     0.5598 0.032 0.112 0.024 0.744 0.028 0.060
#> GSM617616     1  0.5639     0.5900 0.676 0.076 0.160 0.004 0.008 0.076
#> GSM617617     2  0.6515    -0.1788 0.132 0.420 0.008 0.012 0.408 0.020
#> GSM617618     1  0.5734     0.5833 0.668 0.084 0.160 0.004 0.008 0.076
#> GSM617619     3  0.7963    -0.0301 0.200 0.292 0.384 0.020 0.072 0.032
#> GSM617620     4  0.4680     0.6378 0.008 0.180 0.008 0.736 0.024 0.044
#> GSM617622     2  0.6294     0.3842 0.088 0.652 0.016 0.136 0.024 0.084
#> GSM617623     1  0.3752     0.7359 0.832 0.080 0.040 0.016 0.004 0.028
#> GSM617624     2  0.6961     0.4891 0.176 0.560 0.064 0.016 0.164 0.020
#> GSM617625     3  0.5448     0.4567 0.392 0.024 0.536 0.012 0.004 0.032
#> GSM617626     1  0.3464     0.7642 0.848 0.048 0.060 0.016 0.000 0.028
#> GSM617627     2  0.5979     0.5498 0.120 0.652 0.032 0.020 0.164 0.012
#> GSM617628     3  0.5577     0.4413 0.392 0.028 0.528 0.012 0.004 0.036
#> GSM617632     1  0.2842     0.7709 0.880 0.040 0.048 0.004 0.000 0.028
#> GSM617634     2  0.7716     0.0211 0.304 0.388 0.184 0.004 0.028 0.092
#> GSM617635     1  0.1780     0.7798 0.932 0.028 0.028 0.000 0.012 0.000
#> GSM617636     1  0.3532     0.7547 0.828 0.044 0.092 0.000 0.000 0.036
#> GSM617637     1  0.1882     0.7678 0.920 0.060 0.008 0.000 0.012 0.000
#> GSM617638     5  0.7392     0.3120 0.112 0.268 0.116 0.004 0.472 0.028
#> GSM617639     1  0.1749     0.7770 0.932 0.036 0.024 0.000 0.008 0.000
#> GSM617640     5  0.5144     0.4833 0.100 0.268 0.000 0.004 0.624 0.004
#> GSM617641     4  0.2213     0.6647 0.000 0.068 0.004 0.904 0.004 0.020
#> GSM617643     2  0.3955     0.6011 0.124 0.800 0.000 0.012 0.040 0.024
#> GSM617644     2  0.5720    -0.0725 0.012 0.552 0.000 0.284 0.000 0.152
#> GSM617647     2  0.6146     0.4711 0.264 0.548 0.004 0.008 0.160 0.016
#> GSM617648     2  0.3923     0.5735 0.124 0.800 0.000 0.024 0.008 0.044
#> GSM617649     2  0.3409     0.6039 0.136 0.824 0.004 0.008 0.012 0.016
#> GSM617650     1  0.1204     0.7720 0.944 0.000 0.056 0.000 0.000 0.000
#> GSM617651     1  0.1476     0.7745 0.948 0.008 0.012 0.004 0.000 0.028
#> GSM617653     1  0.1684     0.7759 0.940 0.008 0.016 0.008 0.000 0.028
#> GSM617654     5  0.2122     0.5950 0.040 0.040 0.000 0.000 0.912 0.008
#> GSM617583     1  0.5399    -0.2225 0.504 0.024 0.432 0.012 0.008 0.020
#> GSM617584     4  0.5929     0.5059 0.064 0.212 0.016 0.648 0.028 0.032
#> GSM617585     3  0.6876    -0.3292 0.016 0.084 0.520 0.140 0.000 0.240
#> GSM617586     3  0.4506     0.5396 0.344 0.036 0.616 0.000 0.004 0.000
#> GSM617587     3  0.5146     0.4670 0.388 0.060 0.540 0.000 0.012 0.000
#> GSM617589     4  0.2520     0.6088 0.004 0.024 0.000 0.888 0.008 0.076
#> GSM617591     3  0.8860    -0.1121 0.244 0.192 0.352 0.084 0.056 0.072
#> GSM617593     1  0.2451     0.7431 0.876 0.004 0.108 0.000 0.008 0.004
#> GSM617594     2  0.4427     0.6082 0.196 0.732 0.012 0.008 0.052 0.000
#> GSM617595     1  0.0951     0.7717 0.968 0.020 0.008 0.000 0.004 0.000
#> GSM617596     1  0.2948     0.7622 0.860 0.024 0.092 0.000 0.000 0.024
#> GSM617597     3  0.4222     0.3108 0.472 0.008 0.516 0.000 0.004 0.000
#> GSM617598     1  0.0912     0.7731 0.972 0.012 0.008 0.000 0.004 0.004
#> GSM617599     2  0.5516     0.5641 0.228 0.656 0.028 0.012 0.068 0.008
#> GSM617600     3  0.4314     0.5638 0.232 0.036 0.716 0.000 0.004 0.012
#> GSM617601     2  0.4928     0.6053 0.124 0.752 0.016 0.024 0.064 0.020
#> GSM617602     3  0.4703     0.4952 0.236 0.016 0.684 0.000 0.000 0.064
#> GSM617603     4  0.6105     0.0258 0.000 0.228 0.000 0.396 0.004 0.372
#> GSM617604     1  0.5063     0.6305 0.712 0.056 0.176 0.008 0.004 0.044
#> GSM617605     4  0.4602     0.6050 0.000 0.148 0.004 0.708 0.000 0.140
#> GSM617606     6  0.9541     0.0000 0.128 0.216 0.156 0.152 0.068 0.280
#> GSM617610     1  0.1053     0.7752 0.964 0.020 0.012 0.000 0.004 0.000
#> GSM617611     1  0.1621     0.7757 0.936 0.008 0.048 0.000 0.004 0.004
#> GSM617613     3  0.3769     0.1517 0.012 0.000 0.776 0.000 0.036 0.176
#> GSM617614     1  0.5230    -0.2528 0.476 0.024 0.468 0.004 0.008 0.020
#> GSM617621     1  0.3376     0.7720 0.856 0.048 0.056 0.004 0.012 0.024
#> GSM617629     3  0.4593     0.1662 0.032 0.024 0.716 0.000 0.012 0.216
#> GSM617630     5  0.5366     0.3007 0.080 0.036 0.192 0.004 0.680 0.008
#> GSM617631     3  0.3948     0.4921 0.160 0.012 0.772 0.000 0.000 0.056
#> GSM617633     1  0.4256     0.6865 0.776 0.048 0.136 0.000 0.008 0.032
#> GSM617642     3  0.4256     0.4219 0.420 0.012 0.564 0.000 0.004 0.000
#> GSM617645     5  0.3079     0.6298 0.052 0.092 0.000 0.008 0.848 0.000
#> GSM617646     1  0.2753     0.7440 0.872 0.092 0.016 0.004 0.016 0.000
#> GSM617652     1  0.6054     0.4012 0.612 0.092 0.224 0.008 0.060 0.004
#> GSM617655     3  0.4465     0.5538 0.332 0.036 0.628 0.000 0.004 0.000
#> GSM617656     3  0.3488     0.5755 0.244 0.004 0.744 0.000 0.000 0.008
#> GSM617657     3  0.4690    -0.1409 0.000 0.000 0.552 0.000 0.048 0.400
#> GSM617658     3  0.3948     0.4921 0.160 0.012 0.772 0.000 0.000 0.056
#> GSM617659     1  0.2716     0.7196 0.852 0.004 0.132 0.000 0.008 0.004

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

consensus_heatmap(res, k = 2)

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

consensus_heatmap(res, k = 3)

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

consensus_heatmap(res, k = 4)

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

consensus_heatmap(res, k = 5)

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

consensus_heatmap(res, k = 6)

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

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

membership_heatmap(res, k = 2)

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

membership_heatmap(res, k = 3)

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

membership_heatmap(res, k = 4)

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

membership_heatmap(res, k = 5)

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

membership_heatmap(res, k = 6)

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

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

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

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

get_signatures(res, k = 3)

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

get_signatures(res, k = 4)

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

get_signatures(res, k = 5)

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

get_signatures(res, k = 6)

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

Signature heatmaps where rows are not scaled:

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

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

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

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

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

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

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

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

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

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

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk MAD-hclust-signature_compare

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

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

An example of the output of tb is:

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

The columns in tb are:

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

UMAP plot which shows how samples are separated.

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

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

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

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

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

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

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

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

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

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

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk MAD-hclust-collect-classes

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

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

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

collect_plots(res)

plot of chunk MAD-kmeans-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.919           0.923       0.953         0.4895 0.517   0.517
#> 3 3 0.619           0.859       0.873         0.3341 0.790   0.603
#> 4 4 0.698           0.774       0.837         0.1257 0.932   0.797
#> 5 5 0.726           0.637       0.811         0.0667 0.920   0.715
#> 6 6 0.709           0.553       0.765         0.0411 0.978   0.898

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
#> GSM617581     1  0.7528      0.746 0.784 0.216
#> GSM617582     1  0.3733      0.914 0.928 0.072
#> GSM617588     2  0.1843      0.970 0.028 0.972
#> GSM617590     2  0.1633      0.959 0.024 0.976
#> GSM617592     2  0.1843      0.970 0.028 0.972
#> GSM617607     1  0.1184      0.945 0.984 0.016
#> GSM617608     1  0.0672      0.945 0.992 0.008
#> GSM617609     1  0.1843      0.940 0.972 0.028
#> GSM617612     1  0.1633      0.944 0.976 0.024
#> GSM617615     2  0.1184      0.965 0.016 0.984
#> GSM617616     1  0.1633      0.944 0.976 0.024
#> GSM617617     2  0.1843      0.970 0.028 0.972
#> GSM617618     1  0.2236      0.939 0.964 0.036
#> GSM617619     2  0.5294      0.878 0.120 0.880
#> GSM617620     2  0.1633      0.971 0.024 0.976
#> GSM617622     2  0.1843      0.970 0.028 0.972
#> GSM617623     1  0.8207      0.685 0.744 0.256
#> GSM617624     2  0.2043      0.960 0.032 0.968
#> GSM617625     1  0.1843      0.941 0.972 0.028
#> GSM617626     1  0.9850      0.290 0.572 0.428
#> GSM617627     2  0.2043      0.963 0.032 0.968
#> GSM617628     1  0.1843      0.941 0.972 0.028
#> GSM617632     1  0.1414      0.945 0.980 0.020
#> GSM617634     2  0.4690      0.920 0.100 0.900
#> GSM617635     1  0.1633      0.944 0.976 0.024
#> GSM617636     1  0.0938      0.945 0.988 0.012
#> GSM617637     1  0.1633      0.944 0.976 0.024
#> GSM617638     2  0.5629      0.863 0.132 0.868
#> GSM617639     1  0.1633      0.944 0.976 0.024
#> GSM617640     2  0.1843      0.970 0.028 0.972
#> GSM617641     2  0.1633      0.970 0.024 0.976
#> GSM617643     2  0.1843      0.970 0.028 0.972
#> GSM617644     2  0.1843      0.970 0.028 0.972
#> GSM617647     2  0.1843      0.970 0.028 0.972
#> GSM617648     2  0.1843      0.970 0.028 0.972
#> GSM617649     2  0.1843      0.970 0.028 0.972
#> GSM617650     1  0.1633      0.944 0.976 0.024
#> GSM617651     1  0.1633      0.944 0.976 0.024
#> GSM617653     1  0.1633      0.944 0.976 0.024
#> GSM617654     2  0.1843      0.970 0.028 0.972
#> GSM617583     1  0.1843      0.941 0.972 0.028
#> GSM617584     2  0.1843      0.970 0.028 0.972
#> GSM617585     2  0.1633      0.959 0.024 0.976
#> GSM617586     1  0.1843      0.940 0.972 0.028
#> GSM617587     1  0.1633      0.941 0.976 0.024
#> GSM617589     2  0.1184      0.967 0.016 0.984
#> GSM617591     2  0.1633      0.962 0.024 0.976
#> GSM617593     1  0.1633      0.944 0.976 0.024
#> GSM617594     2  0.1843      0.970 0.028 0.972
#> GSM617595     1  0.1633      0.944 0.976 0.024
#> GSM617596     1  0.1633      0.944 0.976 0.024
#> GSM617597     1  0.1843      0.940 0.972 0.028
#> GSM617598     1  0.1633      0.944 0.976 0.024
#> GSM617599     2  0.1843      0.970 0.028 0.972
#> GSM617600     1  0.1843      0.940 0.972 0.028
#> GSM617601     2  0.1633      0.962 0.024 0.976
#> GSM617602     1  0.1843      0.940 0.972 0.028
#> GSM617603     2  0.1414      0.961 0.020 0.980
#> GSM617604     1  0.1633      0.944 0.976 0.024
#> GSM617605     2  0.1633      0.959 0.024 0.976
#> GSM617606     2  0.1633      0.962 0.024 0.976
#> GSM617610     1  0.1633      0.944 0.976 0.024
#> GSM617611     1  0.1633      0.944 0.976 0.024
#> GSM617613     1  0.1843      0.940 0.972 0.028
#> GSM617614     1  0.1843      0.940 0.972 0.028
#> GSM617621     1  0.1414      0.944 0.980 0.020
#> GSM617629     1  0.2043      0.939 0.968 0.032
#> GSM617630     1  0.8144      0.699 0.748 0.252
#> GSM617631     1  0.1843      0.940 0.972 0.028
#> GSM617633     1  0.1184      0.945 0.984 0.016
#> GSM617642     1  0.1843      0.940 0.972 0.028
#> GSM617645     2  0.2043      0.970 0.032 0.968
#> GSM617646     1  0.1633      0.944 0.976 0.024
#> GSM617652     1  0.1184      0.943 0.984 0.016
#> GSM617655     1  0.1843      0.940 0.972 0.028
#> GSM617656     1  0.1843      0.940 0.972 0.028
#> GSM617657     1  0.9833      0.290 0.576 0.424
#> GSM617658     1  0.1843      0.940 0.972 0.028
#> GSM617659     1  0.0376      0.945 0.996 0.004

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>           class entropy silhouette    p1    p2    p3
#> GSM617581     1  0.5357      0.795 0.820 0.064 0.116
#> GSM617582     1  0.5551      0.632 0.760 0.016 0.224
#> GSM617588     2  0.4291      0.874 0.000 0.820 0.180
#> GSM617590     2  0.4346      0.873 0.000 0.816 0.184
#> GSM617592     2  0.4291      0.874 0.000 0.820 0.180
#> GSM617607     1  0.0424      0.916 0.992 0.000 0.008
#> GSM617608     1  0.0424      0.916 0.992 0.000 0.008
#> GSM617609     3  0.5269      0.904 0.200 0.016 0.784
#> GSM617612     1  0.0829      0.917 0.984 0.012 0.004
#> GSM617615     2  0.3340      0.893 0.000 0.880 0.120
#> GSM617616     1  0.2031      0.909 0.952 0.032 0.016
#> GSM617617     2  0.1620      0.892 0.012 0.964 0.024
#> GSM617618     1  0.1315      0.915 0.972 0.008 0.020
#> GSM617619     3  0.5678      0.728 0.032 0.192 0.776
#> GSM617620     2  0.4291      0.874 0.000 0.820 0.180
#> GSM617622     2  0.2496      0.895 0.004 0.928 0.068
#> GSM617623     1  0.4469      0.834 0.864 0.076 0.060
#> GSM617624     2  0.5315      0.705 0.012 0.772 0.216
#> GSM617625     3  0.5621      0.825 0.308 0.000 0.692
#> GSM617626     1  0.3500      0.837 0.880 0.116 0.004
#> GSM617627     2  0.1267      0.894 0.004 0.972 0.024
#> GSM617628     3  0.5678      0.814 0.316 0.000 0.684
#> GSM617632     1  0.0829      0.916 0.984 0.004 0.012
#> GSM617634     2  0.5295      0.770 0.036 0.808 0.156
#> GSM617635     1  0.2063      0.905 0.948 0.044 0.008
#> GSM617636     1  0.1765      0.907 0.956 0.004 0.040
#> GSM617637     1  0.2200      0.897 0.940 0.056 0.004
#> GSM617638     2  0.6161      0.590 0.016 0.696 0.288
#> GSM617639     1  0.1647      0.909 0.960 0.036 0.004
#> GSM617640     2  0.1267      0.895 0.004 0.972 0.024
#> GSM617641     2  0.4291      0.874 0.000 0.820 0.180
#> GSM617643     2  0.0829      0.896 0.004 0.984 0.012
#> GSM617644     2  0.2066      0.897 0.000 0.940 0.060
#> GSM617647     2  0.1620      0.892 0.012 0.964 0.024
#> GSM617648     2  0.0983      0.896 0.004 0.980 0.016
#> GSM617649     2  0.1129      0.895 0.004 0.976 0.020
#> GSM617650     1  0.0424      0.916 0.992 0.000 0.008
#> GSM617651     1  0.0237      0.917 0.996 0.000 0.004
#> GSM617653     1  0.0237      0.917 0.996 0.000 0.004
#> GSM617654     2  0.1751      0.892 0.012 0.960 0.028
#> GSM617583     3  0.5178      0.885 0.256 0.000 0.744
#> GSM617584     2  0.4465      0.876 0.004 0.820 0.176
#> GSM617585     3  0.5327      0.282 0.000 0.272 0.728
#> GSM617586     3  0.4750      0.905 0.216 0.000 0.784
#> GSM617587     3  0.5269      0.904 0.200 0.016 0.784
#> GSM617589     2  0.4346      0.873 0.000 0.816 0.184
#> GSM617591     2  0.3941      0.884 0.000 0.844 0.156
#> GSM617593     1  0.0237      0.917 0.996 0.000 0.004
#> GSM617594     2  0.2636      0.875 0.048 0.932 0.020
#> GSM617595     1  0.1878      0.905 0.952 0.044 0.004
#> GSM617596     1  0.1163      0.912 0.972 0.000 0.028
#> GSM617597     3  0.5016      0.895 0.240 0.000 0.760
#> GSM617598     1  0.0000      0.917 1.000 0.000 0.000
#> GSM617599     2  0.1636      0.892 0.016 0.964 0.020
#> GSM617600     3  0.4808      0.904 0.188 0.008 0.804
#> GSM617601     2  0.2261      0.898 0.000 0.932 0.068
#> GSM617602     3  0.4750      0.900 0.216 0.000 0.784
#> GSM617603     2  0.4291      0.875 0.000 0.820 0.180
#> GSM617604     1  0.4062      0.772 0.836 0.000 0.164
#> GSM617605     2  0.4346      0.873 0.000 0.816 0.184
#> GSM617606     2  0.5553      0.784 0.004 0.724 0.272
#> GSM617610     1  0.1878      0.905 0.952 0.044 0.004
#> GSM617611     1  0.0237      0.917 0.996 0.000 0.004
#> GSM617613     3  0.5036      0.897 0.172 0.020 0.808
#> GSM617614     3  0.5138      0.886 0.252 0.000 0.748
#> GSM617621     1  0.1031      0.914 0.976 0.000 0.024
#> GSM617629     3  0.5092      0.897 0.176 0.020 0.804
#> GSM617630     3  0.6309      0.811 0.100 0.128 0.772
#> GSM617631     3  0.4654      0.903 0.208 0.000 0.792
#> GSM617633     1  0.4834      0.667 0.792 0.004 0.204
#> GSM617642     3  0.4974      0.897 0.236 0.000 0.764
#> GSM617645     2  0.1399      0.894 0.004 0.968 0.028
#> GSM617646     1  0.2486      0.892 0.932 0.060 0.008
#> GSM617652     1  0.5363      0.493 0.724 0.000 0.276
#> GSM617655     3  0.4912      0.906 0.196 0.008 0.796
#> GSM617656     3  0.4702      0.906 0.212 0.000 0.788
#> GSM617657     3  0.4994      0.852 0.112 0.052 0.836
#> GSM617658     3  0.4750      0.900 0.216 0.000 0.784
#> GSM617659     1  0.0747      0.912 0.984 0.000 0.016

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM617581     1  0.6358    0.73988 0.684 0.060 0.036 0.220
#> GSM617582     1  0.7989    0.58466 0.556 0.048 0.164 0.232
#> GSM617588     4  0.4462    0.88238 0.004 0.256 0.004 0.736
#> GSM617590     4  0.4122    0.88079 0.000 0.236 0.004 0.760
#> GSM617592     4  0.4283    0.88191 0.004 0.256 0.000 0.740
#> GSM617607     1  0.2301    0.87495 0.932 0.012 0.028 0.028
#> GSM617608     1  0.1296    0.87786 0.964 0.004 0.028 0.004
#> GSM617609     3  0.1724    0.89072 0.032 0.020 0.948 0.000
#> GSM617612     1  0.1151    0.87747 0.968 0.008 0.024 0.000
#> GSM617615     2  0.4690    0.44106 0.000 0.712 0.012 0.276
#> GSM617616     1  0.5429    0.81087 0.748 0.048 0.020 0.184
#> GSM617617     2  0.1082    0.77977 0.004 0.972 0.004 0.020
#> GSM617618     1  0.5665    0.79866 0.732 0.044 0.028 0.196
#> GSM617619     3  0.5574    0.67263 0.008 0.204 0.724 0.064
#> GSM617620     4  0.4313    0.88212 0.004 0.260 0.000 0.736
#> GSM617622     2  0.4875    0.36409 0.004 0.692 0.008 0.296
#> GSM617623     1  0.5745    0.77582 0.728 0.048 0.028 0.196
#> GSM617624     2  0.3509    0.70399 0.004 0.860 0.024 0.112
#> GSM617625     3  0.3128    0.84672 0.128 0.004 0.864 0.004
#> GSM617626     1  0.4208    0.84793 0.840 0.048 0.016 0.096
#> GSM617627     2  0.1229    0.78219 0.004 0.968 0.008 0.020
#> GSM617628     3  0.3391    0.82905 0.148 0.004 0.844 0.004
#> GSM617632     1  0.4789    0.82442 0.776 0.024 0.016 0.184
#> GSM617634     2  0.5497    0.57849 0.020 0.720 0.032 0.228
#> GSM617635     1  0.2107    0.87719 0.940 0.020 0.016 0.024
#> GSM617636     1  0.6040    0.78818 0.712 0.028 0.064 0.196
#> GSM617637     1  0.1042    0.87748 0.972 0.020 0.008 0.000
#> GSM617638     2  0.4557    0.63482 0.004 0.784 0.032 0.180
#> GSM617639     1  0.1059    0.87917 0.972 0.012 0.016 0.000
#> GSM617640     2  0.1585    0.77574 0.004 0.952 0.004 0.040
#> GSM617641     4  0.4313    0.88215 0.004 0.260 0.000 0.736
#> GSM617643     2  0.1824    0.76754 0.004 0.936 0.000 0.060
#> GSM617644     2  0.4353    0.55769 0.000 0.756 0.012 0.232
#> GSM617647     2  0.0927    0.78205 0.008 0.976 0.000 0.016
#> GSM617648     2  0.2099    0.77761 0.004 0.936 0.020 0.040
#> GSM617649     2  0.1639    0.77728 0.004 0.952 0.008 0.036
#> GSM617650     1  0.1022    0.87711 0.968 0.000 0.032 0.000
#> GSM617651     1  0.0592    0.87935 0.984 0.000 0.016 0.000
#> GSM617653     1  0.1762    0.87496 0.944 0.004 0.004 0.048
#> GSM617654     2  0.1492    0.77147 0.004 0.956 0.004 0.036
#> GSM617583     3  0.2334    0.87552 0.088 0.000 0.908 0.004
#> GSM617584     4  0.4969    0.79399 0.008 0.312 0.004 0.676
#> GSM617585     4  0.6421    0.21340 0.000 0.076 0.368 0.556
#> GSM617586     3  0.1576    0.89023 0.048 0.004 0.948 0.000
#> GSM617587     3  0.1584    0.89012 0.036 0.012 0.952 0.000
#> GSM617589     4  0.4453    0.87441 0.000 0.244 0.012 0.744
#> GSM617591     2  0.7869    0.00551 0.004 0.408 0.364 0.224
#> GSM617593     1  0.0817    0.87831 0.976 0.000 0.024 0.000
#> GSM617594     2  0.2066    0.77971 0.024 0.940 0.008 0.028
#> GSM617595     1  0.1059    0.87830 0.972 0.012 0.016 0.000
#> GSM617596     1  0.4529    0.84223 0.820 0.016 0.052 0.112
#> GSM617597     3  0.1824    0.88767 0.060 0.004 0.936 0.000
#> GSM617598     1  0.0707    0.87895 0.980 0.000 0.020 0.000
#> GSM617599     2  0.1721    0.77897 0.008 0.952 0.012 0.028
#> GSM617600     3  0.1707    0.88791 0.024 0.004 0.952 0.020
#> GSM617601     2  0.3351    0.70039 0.000 0.844 0.008 0.148
#> GSM617602     3  0.4745    0.77270 0.036 0.000 0.756 0.208
#> GSM617603     4  0.4567    0.86286 0.000 0.244 0.016 0.740
#> GSM617604     1  0.5954    0.75228 0.712 0.008 0.168 0.112
#> GSM617605     4  0.4122    0.88079 0.000 0.236 0.004 0.760
#> GSM617606     2  0.7899    0.00432 0.008 0.448 0.216 0.328
#> GSM617610     1  0.1059    0.87816 0.972 0.016 0.012 0.000
#> GSM617611     1  0.1209    0.87610 0.964 0.004 0.032 0.000
#> GSM617613     3  0.1911    0.88406 0.020 0.004 0.944 0.032
#> GSM617614     3  0.1867    0.88487 0.072 0.000 0.928 0.000
#> GSM617621     1  0.4274    0.84652 0.832 0.028 0.024 0.116
#> GSM617629     3  0.5935    0.71522 0.032 0.036 0.696 0.236
#> GSM617630     3  0.6272    0.46837 0.004 0.316 0.612 0.068
#> GSM617631     3  0.1833    0.88498 0.024 0.000 0.944 0.032
#> GSM617633     1  0.5977    0.79455 0.732 0.024 0.104 0.140
#> GSM617642     3  0.1474    0.88971 0.052 0.000 0.948 0.000
#> GSM617645     2  0.1396    0.77909 0.004 0.960 0.004 0.032
#> GSM617646     1  0.2142    0.86685 0.928 0.056 0.016 0.000
#> GSM617652     1  0.5262    0.54961 0.672 0.020 0.304 0.004
#> GSM617655     3  0.1256    0.89115 0.028 0.008 0.964 0.000
#> GSM617656     3  0.1109    0.89130 0.028 0.004 0.968 0.000
#> GSM617657     3  0.1985    0.86962 0.004 0.016 0.940 0.040
#> GSM617658     3  0.4781    0.76930 0.036 0.000 0.752 0.212
#> GSM617659     1  0.1398    0.87488 0.956 0.004 0.040 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
#> GSM617581     1  0.5973    0.24008 0.528 0.008 0.004 0.076 0.384
#> GSM617582     5  0.5075    0.43938 0.212 0.004 0.068 0.008 0.708
#> GSM617588     4  0.1285    0.89444 0.000 0.036 0.004 0.956 0.004
#> GSM617590     4  0.1469    0.89454 0.000 0.036 0.000 0.948 0.016
#> GSM617592     4  0.1469    0.89332 0.000 0.036 0.000 0.948 0.016
#> GSM617607     1  0.1626    0.75504 0.940 0.000 0.016 0.000 0.044
#> GSM617608     1  0.1216    0.75850 0.960 0.000 0.020 0.000 0.020
#> GSM617609     3  0.1644    0.82690 0.048 0.004 0.940 0.000 0.008
#> GSM617612     1  0.0324    0.76993 0.992 0.004 0.004 0.000 0.000
#> GSM617615     2  0.4946    0.55711 0.000 0.680 0.004 0.260 0.056
#> GSM617616     5  0.5018    0.18262 0.424 0.008 0.008 0.008 0.552
#> GSM617617     2  0.1270    0.84101 0.000 0.948 0.000 0.000 0.052
#> GSM617618     5  0.4908    0.27497 0.380 0.004 0.012 0.008 0.596
#> GSM617619     3  0.5923    0.46264 0.000 0.216 0.612 0.004 0.168
#> GSM617620     4  0.1469    0.89332 0.000 0.036 0.000 0.948 0.016
#> GSM617622     2  0.4840    0.58089 0.000 0.688 0.000 0.248 0.064
#> GSM617623     1  0.5570    0.31111 0.564 0.004 0.004 0.056 0.372
#> GSM617624     2  0.2462    0.82221 0.000 0.880 0.008 0.000 0.112
#> GSM617625     3  0.2674    0.79150 0.120 0.000 0.868 0.000 0.012
#> GSM617626     1  0.4954    0.37397 0.616 0.012 0.000 0.020 0.352
#> GSM617627     2  0.1704    0.83180 0.000 0.928 0.004 0.000 0.068
#> GSM617628     3  0.3039    0.75930 0.152 0.000 0.836 0.000 0.012
#> GSM617632     5  0.4735    0.00982 0.472 0.004 0.004 0.004 0.516
#> GSM617634     2  0.4967    0.40570 0.000 0.540 0.008 0.016 0.436
#> GSM617635     1  0.1588    0.75658 0.948 0.008 0.016 0.000 0.028
#> GSM617636     5  0.4854    0.19959 0.404 0.004 0.012 0.004 0.576
#> GSM617637     1  0.0992    0.76695 0.968 0.008 0.000 0.000 0.024
#> GSM617638     2  0.4507    0.66256 0.000 0.644 0.012 0.004 0.340
#> GSM617639     1  0.0451    0.77139 0.988 0.004 0.000 0.000 0.008
#> GSM617640     2  0.3360    0.79476 0.000 0.816 0.012 0.004 0.168
#> GSM617641     4  0.1469    0.89332 0.000 0.036 0.000 0.948 0.016
#> GSM617643     2  0.0566    0.83967 0.000 0.984 0.000 0.012 0.004
#> GSM617644     2  0.4872    0.67000 0.000 0.724 0.004 0.180 0.092
#> GSM617647     2  0.0566    0.83998 0.000 0.984 0.000 0.004 0.012
#> GSM617648     2  0.2331    0.82061 0.000 0.900 0.000 0.020 0.080
#> GSM617649     2  0.0807    0.83893 0.000 0.976 0.000 0.012 0.012
#> GSM617650     1  0.0609    0.76480 0.980 0.000 0.020 0.000 0.000
#> GSM617651     1  0.0510    0.77003 0.984 0.000 0.000 0.000 0.016
#> GSM617653     1  0.4040    0.54026 0.724 0.000 0.000 0.016 0.260
#> GSM617654     2  0.3381    0.78899 0.000 0.808 0.016 0.000 0.176
#> GSM617583     3  0.2361    0.80945 0.096 0.000 0.892 0.000 0.012
#> GSM617584     4  0.4112    0.76101 0.016 0.056 0.000 0.804 0.124
#> GSM617585     4  0.6988    0.33951 0.000 0.020 0.232 0.476 0.272
#> GSM617586     3  0.1502    0.82609 0.056 0.000 0.940 0.000 0.004
#> GSM617587     3  0.1717    0.82634 0.052 0.008 0.936 0.000 0.004
#> GSM617589     4  0.2075    0.87954 0.000 0.032 0.004 0.924 0.040
#> GSM617591     3  0.7423    0.18149 0.000 0.336 0.452 0.132 0.080
#> GSM617593     1  0.0290    0.77152 0.992 0.000 0.000 0.000 0.008
#> GSM617594     2  0.1299    0.83881 0.008 0.960 0.000 0.012 0.020
#> GSM617595     1  0.0451    0.77018 0.988 0.008 0.004 0.000 0.000
#> GSM617596     1  0.4675    0.38386 0.620 0.000 0.004 0.016 0.360
#> GSM617597     3  0.1697    0.82506 0.060 0.000 0.932 0.000 0.008
#> GSM617598     1  0.0609    0.76866 0.980 0.000 0.000 0.000 0.020
#> GSM617599     2  0.1981    0.82699 0.000 0.920 0.000 0.016 0.064
#> GSM617600     3  0.1830    0.79853 0.012 0.000 0.932 0.004 0.052
#> GSM617601     2  0.1670    0.83087 0.000 0.936 0.000 0.052 0.012
#> GSM617602     5  0.4804    0.11164 0.008 0.000 0.460 0.008 0.524
#> GSM617603     4  0.4017    0.80696 0.000 0.068 0.004 0.800 0.128
#> GSM617604     1  0.5976    0.29303 0.568 0.000 0.076 0.020 0.336
#> GSM617605     4  0.1469    0.89454 0.000 0.036 0.000 0.948 0.016
#> GSM617606     5  0.8381   -0.27406 0.000 0.276 0.152 0.236 0.336
#> GSM617610     1  0.0898    0.76749 0.972 0.008 0.000 0.000 0.020
#> GSM617611     1  0.0671    0.76599 0.980 0.004 0.016 0.000 0.000
#> GSM617613     3  0.2645    0.77888 0.012 0.000 0.884 0.008 0.096
#> GSM617614     3  0.2681    0.80043 0.108 0.000 0.876 0.004 0.012
#> GSM617621     1  0.4633    0.40779 0.632 0.000 0.004 0.016 0.348
#> GSM617629     5  0.4654    0.30914 0.008 0.004 0.312 0.012 0.664
#> GSM617630     3  0.6775   -0.01604 0.000 0.336 0.384 0.000 0.280
#> GSM617631     3  0.2295    0.77542 0.004 0.000 0.900 0.008 0.088
#> GSM617633     1  0.5263    0.22410 0.616 0.004 0.056 0.000 0.324
#> GSM617642     3  0.1557    0.82604 0.052 0.000 0.940 0.000 0.008
#> GSM617645     2  0.3461    0.79329 0.000 0.812 0.016 0.004 0.168
#> GSM617646     1  0.0740    0.77009 0.980 0.008 0.008 0.000 0.004
#> GSM617652     1  0.4365    0.33201 0.676 0.004 0.308 0.000 0.012
#> GSM617655     3  0.1082    0.82234 0.028 0.000 0.964 0.000 0.008
#> GSM617656     3  0.1116    0.82167 0.028 0.000 0.964 0.004 0.004
#> GSM617657     3  0.2920    0.74326 0.000 0.000 0.852 0.016 0.132
#> GSM617658     5  0.4792    0.14118 0.008 0.000 0.448 0.008 0.536
#> GSM617659     1  0.1557    0.73836 0.940 0.000 0.052 0.000 0.008

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>           class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM617581     1  0.7139     0.0488 0.388 0.004 0.000 0.128 0.124 0.356
#> GSM617582     6  0.4397     0.6230 0.124 0.008 0.032 0.004 0.056 0.776
#> GSM617588     4  0.2084     0.7986 0.000 0.016 0.000 0.916 0.044 0.024
#> GSM617590     4  0.2220     0.8039 0.000 0.020 0.000 0.908 0.052 0.020
#> GSM617592     4  0.0692     0.8025 0.000 0.020 0.000 0.976 0.004 0.000
#> GSM617607     1  0.2287     0.6980 0.904 0.000 0.036 0.000 0.012 0.048
#> GSM617608     1  0.1700     0.7099 0.928 0.000 0.048 0.000 0.000 0.024
#> GSM617609     3  0.1515     0.8277 0.020 0.000 0.944 0.000 0.028 0.008
#> GSM617612     1  0.1149     0.7257 0.960 0.000 0.024 0.000 0.008 0.008
#> GSM617615     2  0.5643     0.3875 0.000 0.660 0.004 0.104 0.164 0.068
#> GSM617616     6  0.4440     0.5206 0.292 0.016 0.004 0.000 0.020 0.668
#> GSM617617     2  0.1528     0.6532 0.000 0.936 0.000 0.000 0.048 0.016
#> GSM617618     6  0.4478     0.5557 0.260 0.012 0.004 0.004 0.028 0.692
#> GSM617619     3  0.6696     0.2357 0.000 0.128 0.508 0.000 0.252 0.112
#> GSM617620     4  0.0806     0.8037 0.000 0.020 0.000 0.972 0.008 0.000
#> GSM617622     2  0.5436     0.3855 0.000 0.648 0.000 0.216 0.084 0.052
#> GSM617623     1  0.6992     0.1168 0.420 0.004 0.000 0.108 0.124 0.344
#> GSM617624     2  0.4002     0.4058 0.000 0.704 0.000 0.000 0.260 0.036
#> GSM617625     3  0.2537     0.8067 0.068 0.000 0.888 0.000 0.028 0.016
#> GSM617626     1  0.5349     0.2853 0.560 0.012 0.000 0.000 0.088 0.340
#> GSM617627     2  0.3483     0.4723 0.000 0.748 0.000 0.000 0.236 0.016
#> GSM617628     3  0.3140     0.7649 0.116 0.000 0.840 0.000 0.028 0.016
#> GSM617632     6  0.4371     0.3926 0.344 0.000 0.000 0.000 0.036 0.620
#> GSM617634     6  0.5414    -0.1345 0.000 0.440 0.000 0.008 0.088 0.464
#> GSM617635     1  0.2240     0.6966 0.904 0.000 0.032 0.000 0.008 0.056
#> GSM617636     6  0.4087     0.5161 0.276 0.000 0.004 0.000 0.028 0.692
#> GSM617637     1  0.0837     0.7249 0.972 0.004 0.000 0.000 0.004 0.020
#> GSM617638     5  0.5261     0.0762 0.000 0.444 0.000 0.000 0.460 0.096
#> GSM617639     1  0.0291     0.7295 0.992 0.000 0.004 0.000 0.000 0.004
#> GSM617640     2  0.3915     0.0620 0.000 0.584 0.000 0.004 0.412 0.000
#> GSM617641     4  0.0806     0.8038 0.000 0.020 0.000 0.972 0.000 0.008
#> GSM617643     2  0.1649     0.6645 0.000 0.936 0.000 0.016 0.040 0.008
#> GSM617644     2  0.5250     0.4496 0.000 0.688 0.000 0.120 0.140 0.052
#> GSM617647     2  0.1219     0.6522 0.004 0.948 0.000 0.000 0.048 0.000
#> GSM617648     2  0.2865     0.6273 0.000 0.868 0.000 0.012 0.056 0.064
#> GSM617649     2  0.1409     0.6623 0.000 0.948 0.000 0.008 0.032 0.012
#> GSM617650     1  0.1007     0.7207 0.956 0.000 0.044 0.000 0.000 0.000
#> GSM617651     1  0.0717     0.7265 0.976 0.000 0.000 0.000 0.008 0.016
#> GSM617653     1  0.4989     0.4397 0.640 0.000 0.000 0.004 0.108 0.248
#> GSM617654     2  0.4103    -0.0675 0.000 0.544 0.000 0.004 0.448 0.004
#> GSM617583     3  0.1930     0.8241 0.036 0.000 0.924 0.000 0.028 0.012
#> GSM617584     4  0.4991     0.5668 0.016 0.020 0.000 0.720 0.120 0.124
#> GSM617585     4  0.7649     0.1353 0.000 0.012 0.112 0.320 0.312 0.244
#> GSM617586     3  0.0922     0.8308 0.024 0.000 0.968 0.000 0.004 0.004
#> GSM617587     3  0.2006     0.8186 0.024 0.008 0.924 0.000 0.036 0.008
#> GSM617589     4  0.3865     0.7368 0.000 0.016 0.000 0.792 0.124 0.068
#> GSM617591     3  0.7274     0.0868 0.000 0.204 0.488 0.040 0.204 0.064
#> GSM617593     1  0.0146     0.7292 0.996 0.000 0.004 0.000 0.000 0.000
#> GSM617594     2  0.1801     0.6596 0.012 0.932 0.000 0.012 0.040 0.004
#> GSM617595     1  0.0551     0.7292 0.984 0.004 0.008 0.000 0.000 0.004
#> GSM617596     1  0.5455     0.1912 0.496 0.000 0.000 0.004 0.108 0.392
#> GSM617597     3  0.0713     0.8308 0.028 0.000 0.972 0.000 0.000 0.000
#> GSM617598     1  0.0692     0.7261 0.976 0.000 0.000 0.000 0.004 0.020
#> GSM617599     2  0.1991     0.6587 0.000 0.920 0.000 0.012 0.044 0.024
#> GSM617600     3  0.2740     0.7873 0.000 0.000 0.864 0.000 0.076 0.060
#> GSM617601     2  0.2790     0.6285 0.000 0.872 0.000 0.028 0.080 0.020
#> GSM617602     6  0.4592     0.4912 0.004 0.000 0.240 0.000 0.076 0.680
#> GSM617603     4  0.5818     0.5802 0.000 0.052 0.000 0.604 0.232 0.112
#> GSM617604     1  0.6596     0.0684 0.428 0.000 0.052 0.008 0.124 0.388
#> GSM617605     4  0.2156     0.8042 0.000 0.020 0.000 0.912 0.048 0.020
#> GSM617606     5  0.7321     0.3325 0.000 0.144 0.068 0.116 0.540 0.132
#> GSM617610     1  0.0837     0.7249 0.972 0.004 0.000 0.000 0.004 0.020
#> GSM617611     1  0.1219     0.7184 0.948 0.000 0.048 0.000 0.004 0.000
#> GSM617613     3  0.3930     0.7395 0.000 0.000 0.776 0.004 0.104 0.116
#> GSM617614     3  0.2478     0.8075 0.076 0.000 0.888 0.000 0.024 0.012
#> GSM617621     1  0.5601     0.2484 0.512 0.000 0.000 0.008 0.120 0.360
#> GSM617629     6  0.4340     0.5028 0.004 0.004 0.176 0.000 0.080 0.736
#> GSM617630     5  0.6048     0.4315 0.000 0.236 0.212 0.000 0.532 0.020
#> GSM617631     3  0.3552     0.7531 0.000 0.000 0.800 0.000 0.084 0.116
#> GSM617633     1  0.4850    -0.0813 0.512 0.004 0.020 0.000 0.016 0.448
#> GSM617642     3  0.0632     0.8312 0.024 0.000 0.976 0.000 0.000 0.000
#> GSM617645     2  0.3961    -0.0112 0.000 0.556 0.000 0.004 0.440 0.000
#> GSM617646     1  0.0912     0.7286 0.972 0.012 0.008 0.000 0.004 0.004
#> GSM617652     1  0.4602     0.3696 0.644 0.016 0.312 0.000 0.024 0.004
#> GSM617655     3  0.1148     0.8247 0.004 0.000 0.960 0.000 0.016 0.020
#> GSM617656     3  0.1257     0.8202 0.000 0.000 0.952 0.000 0.028 0.020
#> GSM617657     3  0.4763     0.6539 0.000 0.000 0.688 0.004 0.172 0.136
#> GSM617658     6  0.4676     0.5065 0.004 0.000 0.216 0.000 0.096 0.684
#> GSM617659     1  0.1610     0.6980 0.916 0.000 0.084 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-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) k
#> MAD:kmeans 77          0.07747 2
#> MAD:kmeans 77          0.00374 3
#> MAD:kmeans 73          0.01051 4
#> MAD:kmeans 57          0.01548 5
#> MAD:kmeans 53          0.15886 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 21168 rows and 79 columns.
#>   Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'MAD' method.
#>   Subgroups are detected by 'skmeans' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 2.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

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

collect_plots(res)

plot of chunk MAD-skmeans-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.870           0.933       0.970         0.5029 0.496   0.496
#> 3 3 0.561           0.775       0.886         0.3356 0.744   0.527
#> 4 4 0.439           0.516       0.730         0.1157 0.922   0.770
#> 5 5 0.436           0.391       0.650         0.0648 0.884   0.606
#> 6 6 0.481           0.342       0.585         0.0400 0.934   0.706

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
#> GSM617581     2  0.7139      0.762 0.196 0.804
#> GSM617582     2  0.9795      0.322 0.416 0.584
#> GSM617588     2  0.0000      0.955 0.000 1.000
#> GSM617590     2  0.0000      0.955 0.000 1.000
#> GSM617592     2  0.0000      0.955 0.000 1.000
#> GSM617607     1  0.0000      0.979 1.000 0.000
#> GSM617608     1  0.0000      0.979 1.000 0.000
#> GSM617609     1  0.0938      0.972 0.988 0.012
#> GSM617612     1  0.0672      0.976 0.992 0.008
#> GSM617615     2  0.0000      0.955 0.000 1.000
#> GSM617616     1  0.3733      0.916 0.928 0.072
#> GSM617617     2  0.0000      0.955 0.000 1.000
#> GSM617618     1  0.5946      0.830 0.856 0.144
#> GSM617619     2  0.0672      0.952 0.008 0.992
#> GSM617620     2  0.0000      0.955 0.000 1.000
#> GSM617622     2  0.0000      0.955 0.000 1.000
#> GSM617623     2  0.5059      0.863 0.112 0.888
#> GSM617624     2  0.0376      0.953 0.004 0.996
#> GSM617625     1  0.0000      0.979 1.000 0.000
#> GSM617626     2  0.4815      0.870 0.104 0.896
#> GSM617627     2  0.0000      0.955 0.000 1.000
#> GSM617628     1  0.0000      0.979 1.000 0.000
#> GSM617632     1  0.0376      0.978 0.996 0.004
#> GSM617634     2  0.0672      0.952 0.008 0.992
#> GSM617635     1  0.0000      0.979 1.000 0.000
#> GSM617636     1  0.0000      0.979 1.000 0.000
#> GSM617637     1  0.0672      0.976 0.992 0.008
#> GSM617638     2  0.1843      0.938 0.028 0.972
#> GSM617639     1  0.0376      0.978 0.996 0.004
#> GSM617640     2  0.0000      0.955 0.000 1.000
#> GSM617641     2  0.0000      0.955 0.000 1.000
#> GSM617643     2  0.0000      0.955 0.000 1.000
#> GSM617644     2  0.0000      0.955 0.000 1.000
#> GSM617647     2  0.0000      0.955 0.000 1.000
#> GSM617648     2  0.0000      0.955 0.000 1.000
#> GSM617649     2  0.0000      0.955 0.000 1.000
#> GSM617650     1  0.0000      0.979 1.000 0.000
#> GSM617651     1  0.0000      0.979 1.000 0.000
#> GSM617653     1  0.0376      0.978 0.996 0.004
#> GSM617654     2  0.0000      0.955 0.000 1.000
#> GSM617583     1  0.0000      0.979 1.000 0.000
#> GSM617584     2  0.0000      0.955 0.000 1.000
#> GSM617585     2  0.0376      0.953 0.004 0.996
#> GSM617586     1  0.0000      0.979 1.000 0.000
#> GSM617587     1  0.7139      0.753 0.804 0.196
#> GSM617589     2  0.0000      0.955 0.000 1.000
#> GSM617591     2  0.0000      0.955 0.000 1.000
#> GSM617593     1  0.0000      0.979 1.000 0.000
#> GSM617594     2  0.1843      0.937 0.028 0.972
#> GSM617595     1  0.0672      0.976 0.992 0.008
#> GSM617596     1  0.0376      0.978 0.996 0.004
#> GSM617597     1  0.0000      0.979 1.000 0.000
#> GSM617598     1  0.0000      0.979 1.000 0.000
#> GSM617599     2  0.0000      0.955 0.000 1.000
#> GSM617600     1  0.0000      0.979 1.000 0.000
#> GSM617601     2  0.0000      0.955 0.000 1.000
#> GSM617602     1  0.0000      0.979 1.000 0.000
#> GSM617603     2  0.0000      0.955 0.000 1.000
#> GSM617604     1  0.0000      0.979 1.000 0.000
#> GSM617605     2  0.0000      0.955 0.000 1.000
#> GSM617606     2  0.0376      0.953 0.004 0.996
#> GSM617610     1  0.1843      0.961 0.972 0.028
#> GSM617611     1  0.0000      0.979 1.000 0.000
#> GSM617613     1  0.1184      0.969 0.984 0.016
#> GSM617614     1  0.0000      0.979 1.000 0.000
#> GSM617621     1  0.0376      0.978 0.996 0.004
#> GSM617629     1  0.8327      0.635 0.736 0.264
#> GSM617630     2  0.9522      0.437 0.372 0.628
#> GSM617631     1  0.0000      0.979 1.000 0.000
#> GSM617633     1  0.0000      0.979 1.000 0.000
#> GSM617642     1  0.0000      0.979 1.000 0.000
#> GSM617645     2  0.0000      0.955 0.000 1.000
#> GSM617646     1  0.1843      0.961 0.972 0.028
#> GSM617652     1  0.0000      0.979 1.000 0.000
#> GSM617655     1  0.0376      0.978 0.996 0.004
#> GSM617656     1  0.0000      0.979 1.000 0.000
#> GSM617657     2  0.8661      0.619 0.288 0.712
#> GSM617658     1  0.0000      0.979 1.000 0.000
#> GSM617659     1  0.0000      0.979 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
#> GSM617581     1  0.8926     0.4738 0.568 0.240 0.192
#> GSM617582     3  0.9434    -0.0546 0.412 0.176 0.412
#> GSM617588     2  0.0000     0.8986 0.000 1.000 0.000
#> GSM617590     2  0.0000     0.8986 0.000 1.000 0.000
#> GSM617592     2  0.0000     0.8986 0.000 1.000 0.000
#> GSM617607     1  0.4178     0.7730 0.828 0.000 0.172
#> GSM617608     1  0.4702     0.7324 0.788 0.000 0.212
#> GSM617609     3  0.1031     0.8719 0.024 0.000 0.976
#> GSM617612     1  0.2496     0.8397 0.928 0.004 0.068
#> GSM617615     2  0.0747     0.8951 0.000 0.984 0.016
#> GSM617616     1  0.5815     0.7630 0.800 0.096 0.104
#> GSM617617     2  0.1163     0.8919 0.028 0.972 0.000
#> GSM617618     1  0.4930     0.8003 0.836 0.044 0.120
#> GSM617619     3  0.5443     0.6090 0.004 0.260 0.736
#> GSM617620     2  0.0000     0.8986 0.000 1.000 0.000
#> GSM617622     2  0.0237     0.8982 0.000 0.996 0.004
#> GSM617623     1  0.5987     0.6867 0.756 0.208 0.036
#> GSM617624     2  0.4963     0.7419 0.008 0.792 0.200
#> GSM617625     3  0.3879     0.8111 0.152 0.000 0.848
#> GSM617626     1  0.4233     0.7506 0.836 0.160 0.004
#> GSM617627     2  0.2096     0.8788 0.004 0.944 0.052
#> GSM617628     3  0.3482     0.8275 0.128 0.000 0.872
#> GSM617632     1  0.1411     0.8474 0.964 0.000 0.036
#> GSM617634     2  0.8016     0.5827 0.188 0.656 0.156
#> GSM617635     1  0.2200     0.8433 0.940 0.004 0.056
#> GSM617636     1  0.5098     0.7063 0.752 0.000 0.248
#> GSM617637     1  0.0000     0.8457 1.000 0.000 0.000
#> GSM617638     2  0.7578     0.0991 0.040 0.500 0.460
#> GSM617639     1  0.0237     0.8464 0.996 0.000 0.004
#> GSM617640     2  0.0237     0.8983 0.004 0.996 0.000
#> GSM617641     2  0.0000     0.8986 0.000 1.000 0.000
#> GSM617643     2  0.0237     0.8983 0.004 0.996 0.000
#> GSM617644     2  0.0237     0.8983 0.004 0.996 0.000
#> GSM617647     2  0.3116     0.8433 0.108 0.892 0.000
#> GSM617648     2  0.0237     0.8983 0.004 0.996 0.000
#> GSM617649     2  0.1989     0.8815 0.004 0.948 0.048
#> GSM617650     1  0.1753     0.8458 0.952 0.000 0.048
#> GSM617651     1  0.0237     0.8460 0.996 0.000 0.004
#> GSM617653     1  0.0424     0.8459 0.992 0.000 0.008
#> GSM617654     2  0.2711     0.8591 0.088 0.912 0.000
#> GSM617583     3  0.3116     0.8444 0.108 0.000 0.892
#> GSM617584     2  0.3272     0.8403 0.104 0.892 0.004
#> GSM617585     2  0.6307     0.0928 0.000 0.512 0.488
#> GSM617586     3  0.0747     0.8725 0.016 0.000 0.984
#> GSM617587     3  0.6157     0.7485 0.092 0.128 0.780
#> GSM617589     2  0.0000     0.8986 0.000 1.000 0.000
#> GSM617591     2  0.5098     0.6749 0.000 0.752 0.248
#> GSM617593     1  0.0237     0.8460 0.996 0.000 0.004
#> GSM617594     2  0.3921     0.8323 0.112 0.872 0.016
#> GSM617595     1  0.0000     0.8457 1.000 0.000 0.000
#> GSM617596     1  0.3192     0.8233 0.888 0.000 0.112
#> GSM617597     3  0.3686     0.8180 0.140 0.000 0.860
#> GSM617598     1  0.0424     0.8459 0.992 0.000 0.008
#> GSM617599     2  0.3573     0.8322 0.120 0.876 0.004
#> GSM617600     3  0.0237     0.8731 0.004 0.000 0.996
#> GSM617601     2  0.0237     0.8981 0.000 0.996 0.004
#> GSM617602     3  0.0237     0.8736 0.004 0.000 0.996
#> GSM617603     2  0.0000     0.8986 0.000 1.000 0.000
#> GSM617604     1  0.6168     0.3956 0.588 0.000 0.412
#> GSM617605     2  0.0000     0.8986 0.000 1.000 0.000
#> GSM617606     2  0.5848     0.6294 0.012 0.720 0.268
#> GSM617610     1  0.0000     0.8457 1.000 0.000 0.000
#> GSM617611     1  0.1289     0.8473 0.968 0.000 0.032
#> GSM617613     3  0.0000     0.8729 0.000 0.000 1.000
#> GSM617614     3  0.3941     0.7993 0.156 0.000 0.844
#> GSM617621     1  0.1643     0.8455 0.956 0.000 0.044
#> GSM617629     3  0.3461     0.8439 0.076 0.024 0.900
#> GSM617630     3  0.6049     0.7044 0.040 0.204 0.756
#> GSM617631     3  0.0000     0.8729 0.000 0.000 1.000
#> GSM617633     1  0.6291     0.1983 0.532 0.000 0.468
#> GSM617642     3  0.2711     0.8513 0.088 0.000 0.912
#> GSM617645     2  0.0237     0.8983 0.004 0.996 0.000
#> GSM617646     1  0.2446     0.8438 0.936 0.012 0.052
#> GSM617652     1  0.6302     0.1260 0.520 0.000 0.480
#> GSM617655     3  0.0000     0.8729 0.000 0.000 1.000
#> GSM617656     3  0.0237     0.8731 0.004 0.000 0.996
#> GSM617657     3  0.0237     0.8725 0.000 0.004 0.996
#> GSM617658     3  0.2448     0.8541 0.076 0.000 0.924
#> GSM617659     1  0.4605     0.7379 0.796 0.000 0.204

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM617581     4  0.9439     0.2268 0.292 0.292 0.096 0.320
#> GSM617582     4  0.9093     0.4484 0.156 0.200 0.164 0.480
#> GSM617588     2  0.1211     0.7162 0.000 0.960 0.000 0.040
#> GSM617590     2  0.1584     0.7121 0.000 0.952 0.012 0.036
#> GSM617592     2  0.1474     0.7136 0.000 0.948 0.000 0.052
#> GSM617607     1  0.6578     0.4770 0.620 0.000 0.136 0.244
#> GSM617608     1  0.6011     0.5084 0.688 0.000 0.180 0.132
#> GSM617609     3  0.3215     0.7380 0.032 0.000 0.876 0.092
#> GSM617612     1  0.2924     0.6834 0.900 0.004 0.060 0.036
#> GSM617615     2  0.5506     0.6395 0.004 0.744 0.116 0.136
#> GSM617616     4  0.7840     0.0536 0.404 0.056 0.080 0.460
#> GSM617617     2  0.6042     0.5381 0.048 0.560 0.000 0.392
#> GSM617618     4  0.7434     0.0753 0.400 0.052 0.056 0.492
#> GSM617619     3  0.6946     0.2949 0.000 0.200 0.588 0.212
#> GSM617620     2  0.1118     0.7161 0.000 0.964 0.000 0.036
#> GSM617622     2  0.3727     0.7092 0.004 0.824 0.008 0.164
#> GSM617623     1  0.7962     0.0215 0.476 0.248 0.012 0.264
#> GSM617624     4  0.7463    -0.1726 0.008 0.400 0.136 0.456
#> GSM617625     3  0.4713     0.6809 0.172 0.000 0.776 0.052
#> GSM617626     1  0.7439     0.1207 0.516 0.176 0.004 0.304
#> GSM617627     2  0.6483     0.5445 0.000 0.584 0.092 0.324
#> GSM617628     3  0.4893     0.6739 0.168 0.000 0.768 0.064
#> GSM617632     1  0.5713     0.4230 0.620 0.000 0.040 0.340
#> GSM617634     4  0.7493     0.2651 0.056 0.240 0.100 0.604
#> GSM617635     1  0.5363     0.5770 0.728 0.004 0.056 0.212
#> GSM617636     4  0.7120     0.0469 0.368 0.000 0.136 0.496
#> GSM617637     1  0.2053     0.6823 0.924 0.000 0.004 0.072
#> GSM617638     4  0.7593     0.2679 0.012 0.196 0.252 0.540
#> GSM617639     1  0.1792     0.6871 0.932 0.000 0.000 0.068
#> GSM617640     2  0.4103     0.6830 0.000 0.744 0.000 0.256
#> GSM617641     2  0.0921     0.7143 0.000 0.972 0.000 0.028
#> GSM617643     2  0.4040     0.6912 0.000 0.752 0.000 0.248
#> GSM617644     2  0.3123     0.7159 0.000 0.844 0.000 0.156
#> GSM617647     2  0.6897     0.5108 0.144 0.572 0.000 0.284
#> GSM617648     2  0.4792     0.6450 0.008 0.680 0.000 0.312
#> GSM617649     2  0.7502     0.5439 0.028 0.552 0.116 0.304
#> GSM617650     1  0.2996     0.6808 0.892 0.000 0.044 0.064
#> GSM617651     1  0.1356     0.6899 0.960 0.000 0.008 0.032
#> GSM617653     1  0.3171     0.6701 0.876 0.004 0.016 0.104
#> GSM617654     2  0.6495     0.4421 0.072 0.492 0.000 0.436
#> GSM617583     3  0.4017     0.7236 0.128 0.000 0.828 0.044
#> GSM617584     2  0.5815     0.5496 0.112 0.716 0.004 0.168
#> GSM617585     2  0.7529     0.0116 0.000 0.472 0.324 0.204
#> GSM617586     3  0.1833     0.7549 0.024 0.000 0.944 0.032
#> GSM617587     3  0.7451     0.4905 0.096 0.092 0.640 0.172
#> GSM617589     2  0.2010     0.7094 0.012 0.940 0.008 0.040
#> GSM617591     2  0.6646     0.3692 0.000 0.584 0.304 0.112
#> GSM617593     1  0.1042     0.6895 0.972 0.000 0.008 0.020
#> GSM617594     2  0.8306     0.4193 0.140 0.512 0.064 0.284
#> GSM617595     1  0.1109     0.6913 0.968 0.000 0.004 0.028
#> GSM617596     1  0.5664     0.5613 0.696 0.000 0.076 0.228
#> GSM617597     3  0.4959     0.6387 0.196 0.000 0.752 0.052
#> GSM617598     1  0.0779     0.6903 0.980 0.000 0.004 0.016
#> GSM617599     2  0.7579     0.4203 0.120 0.540 0.028 0.312
#> GSM617600     3  0.1661     0.7526 0.004 0.000 0.944 0.052
#> GSM617601     2  0.2408     0.7187 0.000 0.896 0.000 0.104
#> GSM617602     3  0.4883     0.5500 0.016 0.000 0.696 0.288
#> GSM617603     2  0.2469     0.7143 0.000 0.892 0.000 0.108
#> GSM617604     1  0.8299     0.0638 0.440 0.024 0.308 0.228
#> GSM617605     2  0.2048     0.7135 0.000 0.928 0.008 0.064
#> GSM617606     2  0.8111     0.2390 0.036 0.524 0.216 0.224
#> GSM617610     1  0.0469     0.6881 0.988 0.000 0.000 0.012
#> GSM617611     1  0.2131     0.6904 0.932 0.000 0.036 0.032
#> GSM617613     3  0.1661     0.7504 0.000 0.004 0.944 0.052
#> GSM617614     3  0.5522     0.5998 0.204 0.000 0.716 0.080
#> GSM617621     1  0.5401     0.5426 0.700 0.008 0.032 0.260
#> GSM617629     4  0.6608    -0.1242 0.020 0.040 0.452 0.488
#> GSM617630     3  0.8352     0.1183 0.048 0.168 0.484 0.300
#> GSM617631     3  0.2011     0.7423 0.000 0.000 0.920 0.080
#> GSM617633     1  0.8022    -0.1347 0.384 0.004 0.280 0.332
#> GSM617642     3  0.3239     0.7492 0.068 0.000 0.880 0.052
#> GSM617645     2  0.5227     0.6473 0.012 0.668 0.008 0.312
#> GSM617646     1  0.5238     0.5935 0.752 0.016 0.040 0.192
#> GSM617652     1  0.7727     0.0918 0.452 0.008 0.364 0.176
#> GSM617655     3  0.0859     0.7565 0.008 0.004 0.980 0.008
#> GSM617656     3  0.0524     0.7561 0.008 0.000 0.988 0.004
#> GSM617657     3  0.2882     0.7328 0.000 0.024 0.892 0.084
#> GSM617658     3  0.5941     0.5107 0.072 0.000 0.652 0.276
#> GSM617659     1  0.5343     0.5048 0.708 0.000 0.240 0.052

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1    p2    p3    p4    p5
#> GSM617581     5   0.860   0.160368 0.176 0.100 0.040 0.272 0.412
#> GSM617582     5   0.809   0.251941 0.068 0.160 0.068 0.176 0.528
#> GSM617588     4   0.163   0.558685 0.000 0.044 0.000 0.940 0.016
#> GSM617590     4   0.269   0.554399 0.000 0.044 0.028 0.900 0.028
#> GSM617592     4   0.191   0.557400 0.000 0.028 0.000 0.928 0.044
#> GSM617607     1   0.735   0.403376 0.540 0.132 0.124 0.000 0.204
#> GSM617608     1   0.603   0.532423 0.676 0.064 0.140 0.000 0.120
#> GSM617609     3   0.443   0.682368 0.020 0.104 0.796 0.004 0.076
#> GSM617612     1   0.412   0.653624 0.832 0.068 0.048 0.012 0.040
#> GSM617615     4   0.606   0.381259 0.012 0.204 0.068 0.668 0.048
#> GSM617616     5   0.837   0.230007 0.316 0.180 0.052 0.052 0.400
#> GSM617617     2   0.687   0.333527 0.024 0.476 0.000 0.336 0.164
#> GSM617618     5   0.784   0.347607 0.244 0.156 0.044 0.048 0.508
#> GSM617619     3   0.774   0.249467 0.004 0.240 0.492 0.116 0.148
#> GSM617620     4   0.207   0.554225 0.000 0.092 0.000 0.904 0.004
#> GSM617622     4   0.529   0.428762 0.012 0.204 0.004 0.700 0.080
#> GSM617623     5   0.829   0.077350 0.336 0.100 0.008 0.220 0.336
#> GSM617624     2   0.807   0.358122 0.008 0.452 0.108 0.200 0.232
#> GSM617625     3   0.571   0.549904 0.240 0.040 0.664 0.004 0.052
#> GSM617626     1   0.781   0.092995 0.460 0.132 0.000 0.148 0.260
#> GSM617627     2   0.715   0.219457 0.004 0.436 0.064 0.400 0.096
#> GSM617628     3   0.556   0.616890 0.176 0.056 0.708 0.004 0.056
#> GSM617632     5   0.677  -0.000866 0.384 0.108 0.024 0.008 0.476
#> GSM617634     5   0.842  -0.063137 0.048 0.316 0.068 0.164 0.404
#> GSM617635     1   0.693   0.451156 0.580 0.212 0.060 0.004 0.144
#> GSM617636     5   0.648   0.338218 0.208 0.072 0.100 0.000 0.620
#> GSM617637     1   0.370   0.650120 0.820 0.088 0.000 0.000 0.092
#> GSM617638     2   0.814   0.281878 0.016 0.452 0.132 0.128 0.272
#> GSM617639     1   0.370   0.657449 0.832 0.084 0.008 0.000 0.076
#> GSM617640     4   0.517  -0.098563 0.004 0.444 0.000 0.520 0.032
#> GSM617641     4   0.149   0.558786 0.000 0.024 0.000 0.948 0.028
#> GSM617643     4   0.527   0.173308 0.008 0.364 0.000 0.588 0.040
#> GSM617644     4   0.447   0.435529 0.000 0.240 0.000 0.716 0.044
#> GSM617647     2   0.726   0.329146 0.128 0.476 0.008 0.340 0.048
#> GSM617648     4   0.693  -0.099193 0.036 0.392 0.000 0.440 0.132
#> GSM617649     2   0.729   0.249122 0.016 0.476 0.072 0.360 0.076
#> GSM617650     1   0.420   0.638910 0.812 0.032 0.084 0.000 0.072
#> GSM617651     1   0.228   0.671027 0.908 0.032 0.000 0.000 0.060
#> GSM617653     1   0.537   0.547115 0.688 0.068 0.004 0.016 0.224
#> GSM617654     2   0.692   0.323753 0.080 0.496 0.000 0.348 0.076
#> GSM617583     3   0.504   0.670881 0.144 0.036 0.760 0.016 0.044
#> GSM617584     4   0.684   0.235690 0.080 0.160 0.000 0.596 0.164
#> GSM617585     4   0.767   0.053355 0.000 0.096 0.240 0.476 0.188
#> GSM617586     3   0.259   0.726645 0.020 0.032 0.904 0.000 0.044
#> GSM617587     3   0.755   0.448233 0.056 0.140 0.596 0.116 0.092
#> GSM617589     4   0.270   0.552549 0.012 0.052 0.004 0.900 0.032
#> GSM617591     4   0.752   0.097328 0.008 0.156 0.256 0.508 0.072
#> GSM617593     1   0.216   0.670186 0.916 0.012 0.008 0.000 0.064
#> GSM617594     2   0.834   0.308108 0.140 0.448 0.044 0.280 0.088
#> GSM617595     1   0.223   0.671300 0.920 0.040 0.012 0.000 0.028
#> GSM617596     1   0.695   0.232166 0.488 0.084 0.052 0.008 0.368
#> GSM617597     3   0.552   0.557242 0.176 0.028 0.696 0.000 0.100
#> GSM617598     1   0.230   0.665212 0.904 0.024 0.000 0.000 0.072
#> GSM617599     4   0.830  -0.235179 0.124 0.360 0.016 0.360 0.140
#> GSM617600     3   0.267   0.713375 0.000 0.020 0.876 0.000 0.104
#> GSM617601     4   0.444   0.409387 0.000 0.240 0.008 0.724 0.028
#> GSM617602     5   0.564  -0.129027 0.012 0.048 0.464 0.000 0.476
#> GSM617603     4   0.353   0.532379 0.000 0.116 0.000 0.828 0.056
#> GSM617604     5   0.815   0.232208 0.272 0.072 0.228 0.016 0.412
#> GSM617605     4   0.247   0.558398 0.000 0.036 0.012 0.908 0.044
#> GSM617606     4   0.832   0.005671 0.036 0.244 0.096 0.464 0.160
#> GSM617610     1   0.198   0.671319 0.928 0.024 0.004 0.000 0.044
#> GSM617611     1   0.261   0.666750 0.900 0.020 0.060 0.000 0.020
#> GSM617613     3   0.313   0.694224 0.000 0.032 0.848 0.000 0.120
#> GSM617614     3   0.585   0.585818 0.164 0.044 0.680 0.000 0.112
#> GSM617621     1   0.648   0.213097 0.488 0.088 0.024 0.004 0.396
#> GSM617629     5   0.709   0.257765 0.012 0.124 0.300 0.040 0.524
#> GSM617630     2   0.882   0.080492 0.048 0.376 0.300 0.124 0.152
#> GSM617631     3   0.297   0.691593 0.000 0.016 0.848 0.000 0.136
#> GSM617633     5   0.837   0.272602 0.272 0.180 0.192 0.000 0.356
#> GSM617642     3   0.389   0.701861 0.076 0.020 0.828 0.000 0.076
#> GSM617645     2   0.609   0.303873 0.036 0.536 0.008 0.384 0.036
#> GSM617646     1   0.680   0.470253 0.608 0.224 0.044 0.024 0.100
#> GSM617652     1   0.841  -0.007137 0.360 0.192 0.308 0.008 0.132
#> GSM617655     3   0.118   0.727882 0.000 0.016 0.964 0.004 0.016
#> GSM617656     3   0.051   0.725853 0.000 0.000 0.984 0.000 0.016
#> GSM617657     3   0.479   0.618748 0.000 0.056 0.748 0.024 0.172
#> GSM617658     5   0.619  -0.096810 0.072 0.024 0.440 0.000 0.464
#> GSM617659     1   0.591   0.516758 0.672 0.044 0.176 0.000 0.108

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>           class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM617581     6   0.792     0.3294 0.096 0.048 0.032 0.244 0.108 0.472
#> GSM617582     5   0.850     0.2432 0.072 0.096 0.076 0.116 0.464 0.176
#> GSM617588     4   0.300     0.5435 0.000 0.104 0.000 0.852 0.028 0.016
#> GSM617590     4   0.249     0.5646 0.000 0.048 0.008 0.900 0.020 0.024
#> GSM617592     4   0.233     0.5436 0.000 0.056 0.000 0.892 0.000 0.052
#> GSM617607     1   0.749     0.2777 0.500 0.072 0.060 0.004 0.152 0.212
#> GSM617608     1   0.724     0.3165 0.528 0.036 0.136 0.000 0.140 0.160
#> GSM617609     3   0.566     0.5579 0.032 0.088 0.696 0.000 0.084 0.100
#> GSM617612     1   0.513     0.5156 0.740 0.044 0.064 0.004 0.032 0.116
#> GSM617615     4   0.719     0.2744 0.012 0.240 0.068 0.536 0.056 0.088
#> GSM617616     5   0.837     0.2013 0.232 0.152 0.028 0.044 0.408 0.136
#> GSM617617     2   0.725     0.3631 0.032 0.492 0.000 0.248 0.128 0.100
#> GSM617618     5   0.722     0.3190 0.192 0.072 0.032 0.036 0.564 0.104
#> GSM617619     3   0.831     0.0366 0.000 0.224 0.376 0.144 0.176 0.080
#> GSM617620     4   0.280     0.5484 0.000 0.108 0.000 0.860 0.012 0.020
#> GSM617622     4   0.624     0.3752 0.008 0.208 0.012 0.612 0.060 0.100
#> GSM617623     6   0.765     0.4056 0.184 0.068 0.004 0.216 0.060 0.468
#> GSM617624     2   0.846     0.2819 0.008 0.396 0.104 0.172 0.208 0.112
#> GSM617625     3   0.624     0.5132 0.180 0.032 0.624 0.000 0.060 0.104
#> GSM617626     1   0.872    -0.2394 0.320 0.128 0.000 0.180 0.176 0.196
#> GSM617627     2   0.814     0.3266 0.008 0.416 0.076 0.260 0.124 0.116
#> GSM617628     3   0.672     0.4648 0.188 0.028 0.588 0.008 0.116 0.072
#> GSM617632     1   0.771    -0.2245 0.360 0.032 0.040 0.016 0.300 0.252
#> GSM617634     5   0.809     0.0465 0.044 0.276 0.052 0.108 0.440 0.080
#> GSM617635     1   0.662     0.4274 0.596 0.096 0.036 0.000 0.172 0.100
#> GSM617636     5   0.704     0.0689 0.156 0.028 0.044 0.008 0.504 0.260
#> GSM617637     1   0.468     0.5193 0.756 0.092 0.000 0.004 0.072 0.076
#> GSM617638     2   0.863     0.1995 0.016 0.384 0.140 0.100 0.224 0.136
#> GSM617639     1   0.420     0.5295 0.776 0.076 0.004 0.000 0.020 0.124
#> GSM617640     2   0.564     0.2145 0.008 0.520 0.000 0.388 0.052 0.032
#> GSM617641     4   0.251     0.5580 0.000 0.060 0.000 0.888 0.008 0.044
#> GSM617643     2   0.535    -0.0673 0.000 0.480 0.000 0.444 0.048 0.028
#> GSM617644     4   0.573     0.3073 0.000 0.328 0.000 0.544 0.100 0.028
#> GSM617647     2   0.727     0.3723 0.080 0.508 0.008 0.260 0.044 0.100
#> GSM617648     4   0.705    -0.0897 0.012 0.372 0.004 0.392 0.168 0.052
#> GSM617649     2   0.765     0.3182 0.024 0.512 0.068 0.224 0.096 0.076
#> GSM617650     1   0.386     0.5501 0.816 0.004 0.044 0.000 0.064 0.072
#> GSM617651     1   0.247     0.5580 0.880 0.000 0.000 0.000 0.040 0.080
#> GSM617653     1   0.595     0.1198 0.556 0.012 0.004 0.032 0.072 0.324
#> GSM617654     2   0.755     0.4052 0.052 0.504 0.004 0.196 0.132 0.112
#> GSM617583     3   0.601     0.5563 0.116 0.028 0.680 0.016 0.060 0.100
#> GSM617584     4   0.677     0.1460 0.064 0.092 0.008 0.536 0.024 0.276
#> GSM617585     4   0.781     0.1185 0.000 0.084 0.200 0.448 0.196 0.072
#> GSM617586     3   0.348     0.6139 0.024 0.024 0.844 0.000 0.028 0.080
#> GSM617587     3   0.809     0.3427 0.124 0.100 0.512 0.048 0.076 0.140
#> GSM617589     4   0.372     0.5491 0.008 0.072 0.000 0.828 0.040 0.052
#> GSM617591     4   0.804     0.0747 0.012 0.164 0.256 0.420 0.052 0.096
#> GSM617593     1   0.262     0.5567 0.876 0.000 0.008 0.000 0.028 0.088
#> GSM617594     2   0.850     0.3141 0.120 0.432 0.032 0.204 0.084 0.128
#> GSM617595     1   0.298     0.5689 0.876 0.024 0.012 0.000 0.048 0.040
#> GSM617596     6   0.775     0.2605 0.336 0.028 0.052 0.020 0.200 0.364
#> GSM617597     3   0.647     0.4271 0.192 0.032 0.592 0.000 0.052 0.132
#> GSM617598     1   0.302     0.5320 0.840 0.012 0.000 0.000 0.020 0.128
#> GSM617599     2   0.875     0.2640 0.152 0.344 0.008 0.224 0.156 0.116
#> GSM617600     3   0.427     0.5793 0.004 0.028 0.772 0.000 0.132 0.064
#> GSM617601     4   0.502     0.4143 0.000 0.244 0.004 0.668 0.032 0.052
#> GSM617602     5   0.653    -0.0469 0.016 0.012 0.380 0.008 0.436 0.148
#> GSM617603     4   0.486     0.4977 0.000 0.168 0.008 0.720 0.076 0.028
#> GSM617604     6   0.861     0.2144 0.196 0.044 0.188 0.044 0.132 0.396
#> GSM617605     4   0.234     0.5585 0.000 0.028 0.004 0.908 0.028 0.032
#> GSM617606     4   0.887     0.0594 0.048 0.220 0.084 0.380 0.156 0.112
#> GSM617610     1   0.298     0.5510 0.868 0.028 0.000 0.004 0.028 0.072
#> GSM617611     1   0.311     0.5664 0.868 0.012 0.056 0.000 0.028 0.036
#> GSM617613     3   0.441     0.5647 0.004 0.012 0.752 0.016 0.176 0.040
#> GSM617614     3   0.709     0.3759 0.172 0.020 0.520 0.000 0.108 0.180
#> GSM617621     6   0.670     0.2101 0.392 0.040 0.012 0.020 0.088 0.448
#> GSM617629     5   0.675     0.3837 0.012 0.076 0.184 0.032 0.596 0.100
#> GSM617630     2   0.894     0.0190 0.032 0.316 0.248 0.068 0.160 0.176
#> GSM617631     3   0.426     0.5485 0.000 0.004 0.756 0.008 0.148 0.084
#> GSM617633     5   0.776     0.2715 0.252 0.080 0.148 0.008 0.456 0.056
#> GSM617642     3   0.496     0.5822 0.076 0.024 0.736 0.000 0.032 0.132
#> GSM617645     2   0.669     0.3771 0.024 0.548 0.012 0.276 0.060 0.080
#> GSM617646     1   0.779     0.2684 0.496 0.196 0.044 0.020 0.120 0.124
#> GSM617652     1   0.851     0.0589 0.344 0.088 0.248 0.008 0.100 0.212
#> GSM617655     3   0.226     0.6193 0.004 0.008 0.912 0.004 0.032 0.040
#> GSM617656     3   0.146     0.6167 0.000 0.000 0.940 0.000 0.044 0.016
#> GSM617657     3   0.588     0.4983 0.000 0.048 0.668 0.056 0.160 0.068
#> GSM617658     3   0.716    -0.0153 0.040 0.004 0.384 0.012 0.304 0.256
#> GSM617659     1   0.603     0.3253 0.592 0.008 0.220 0.000 0.036 0.144

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

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

collect_plots(res)

plot of chunk MAD-pam-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.270           0.654       0.813         0.4888 0.507   0.507
#> 3 3 0.524           0.699       0.860         0.3267 0.784   0.597
#> 4 4 0.549           0.674       0.855         0.0401 0.973   0.922
#> 5 5 0.570           0.560       0.827         0.0380 0.976   0.928
#> 6 6 0.568           0.581       0.822         0.0132 0.969   0.906

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

suggest_best_k(res)
#> [1] 3

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

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

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>           class entropy silhouette    p1    p2
#> GSM617581     1  0.0000      0.615 1.000 0.000
#> GSM617582     1  0.4022      0.695 0.920 0.080
#> GSM617588     2  0.9686      0.700 0.396 0.604
#> GSM617590     2  0.9170      0.717 0.332 0.668
#> GSM617592     2  0.9686      0.700 0.396 0.604
#> GSM617607     1  0.9686      0.754 0.604 0.396
#> GSM617608     1  0.9686      0.754 0.604 0.396
#> GSM617609     1  0.9686      0.754 0.604 0.396
#> GSM617612     1  0.9686      0.754 0.604 0.396
#> GSM617615     2  0.8499      0.714 0.276 0.724
#> GSM617616     1  0.6801      0.761 0.820 0.180
#> GSM617617     1  0.0376      0.611 0.996 0.004
#> GSM617618     1  0.0000      0.615 1.000 0.000
#> GSM617619     2  0.9954      0.638 0.460 0.540
#> GSM617620     2  0.9686      0.700 0.396 0.604
#> GSM617622     1  0.8713     -0.162 0.708 0.292
#> GSM617623     1  0.5408      0.717 0.876 0.124
#> GSM617624     2  0.9963      0.374 0.464 0.536
#> GSM617625     2  0.0000      0.642 0.000 1.000
#> GSM617626     1  0.0000      0.615 1.000 0.000
#> GSM617627     2  0.9881      0.540 0.436 0.564
#> GSM617628     2  0.0000      0.642 0.000 1.000
#> GSM617632     1  0.3879      0.697 0.924 0.076
#> GSM617634     2  0.9732      0.699 0.404 0.596
#> GSM617635     1  0.8144      0.786 0.748 0.252
#> GSM617636     1  0.7815      0.783 0.768 0.232
#> GSM617637     1  0.7815      0.783 0.768 0.232
#> GSM617638     1  0.9686      0.754 0.604 0.396
#> GSM617639     1  0.7815      0.783 0.768 0.232
#> GSM617640     1  0.0000      0.615 1.000 0.000
#> GSM617641     2  0.9686      0.700 0.396 0.604
#> GSM617643     2  0.9896      0.675 0.440 0.560
#> GSM617644     2  0.9686      0.700 0.396 0.604
#> GSM617647     1  0.5737      0.743 0.864 0.136
#> GSM617648     2  0.9909      0.672 0.444 0.556
#> GSM617649     1  0.3431      0.643 0.936 0.064
#> GSM617650     1  0.9686      0.754 0.604 0.396
#> GSM617651     1  0.8016      0.786 0.756 0.244
#> GSM617653     1  0.9686      0.754 0.604 0.396
#> GSM617654     1  0.4815      0.720 0.896 0.104
#> GSM617583     2  0.0000      0.642 0.000 1.000
#> GSM617584     1  0.6048      0.344 0.852 0.148
#> GSM617585     2  0.9286      0.715 0.344 0.656
#> GSM617586     2  0.0000      0.642 0.000 1.000
#> GSM617587     2  0.4939      0.495 0.108 0.892
#> GSM617589     2  0.9686      0.700 0.396 0.604
#> GSM617591     2  0.9000      0.718 0.316 0.684
#> GSM617593     1  0.8144      0.786 0.748 0.252
#> GSM617594     1  0.7745      0.669 0.772 0.228
#> GSM617595     1  0.8327      0.785 0.736 0.264
#> GSM617596     1  0.9686      0.754 0.604 0.396
#> GSM617597     1  0.9686      0.754 0.604 0.396
#> GSM617598     1  0.7815      0.783 0.768 0.232
#> GSM617599     1  0.0672      0.624 0.992 0.008
#> GSM617600     2  0.0000      0.642 0.000 1.000
#> GSM617601     2  0.9686      0.700 0.396 0.604
#> GSM617602     2  0.9881     -0.525 0.436 0.564
#> GSM617603     2  0.7815      0.702 0.232 0.768
#> GSM617604     1  0.9661      0.754 0.608 0.392
#> GSM617605     2  0.8763      0.717 0.296 0.704
#> GSM617606     2  0.2423      0.662 0.040 0.960
#> GSM617610     1  0.7602      0.781 0.780 0.220
#> GSM617611     1  0.9686      0.754 0.604 0.396
#> GSM617613     2  0.0376      0.644 0.004 0.996
#> GSM617614     1  0.9954      0.688 0.540 0.460
#> GSM617621     1  0.7883      0.784 0.764 0.236
#> GSM617629     1  0.9209      0.644 0.664 0.336
#> GSM617630     1  0.9686      0.754 0.604 0.396
#> GSM617631     2  0.0000      0.642 0.000 1.000
#> GSM617633     1  0.9686      0.754 0.604 0.396
#> GSM617642     2  0.9866     -0.515 0.432 0.568
#> GSM617645     1  0.6887      0.768 0.816 0.184
#> GSM617646     1  0.8207      0.786 0.744 0.256
#> GSM617652     1  0.9686      0.754 0.604 0.396
#> GSM617655     2  0.2043      0.659 0.032 0.968
#> GSM617656     2  0.0000      0.642 0.000 1.000
#> GSM617657     2  0.0000      0.642 0.000 1.000
#> GSM617658     1  0.9661      0.754 0.608 0.392
#> GSM617659     1  0.9686      0.754 0.604 0.396

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>           class entropy silhouette    p1    p2    p3
#> GSM617581     2  0.1163    0.87881 0.028 0.972 0.000
#> GSM617582     2  0.6495    0.00496 0.460 0.536 0.004
#> GSM617588     2  0.0000    0.87905 0.000 1.000 0.000
#> GSM617590     3  0.4291    0.69859 0.000 0.180 0.820
#> GSM617592     2  0.0000    0.87905 0.000 1.000 0.000
#> GSM617607     1  0.0000    0.85209 1.000 0.000 0.000
#> GSM617608     1  0.0000    0.85209 1.000 0.000 0.000
#> GSM617609     1  0.4555    0.74725 0.800 0.000 0.200
#> GSM617612     1  0.1031    0.84783 0.976 0.000 0.024
#> GSM617615     3  0.4605    0.66873 0.000 0.204 0.796
#> GSM617616     1  0.6033    0.52984 0.660 0.336 0.004
#> GSM617617     2  0.0892    0.88321 0.020 0.980 0.000
#> GSM617618     2  0.4399    0.70770 0.188 0.812 0.000
#> GSM617619     3  0.8487    0.35390 0.100 0.364 0.536
#> GSM617620     2  0.0000    0.87905 0.000 1.000 0.000
#> GSM617622     2  0.1015    0.88309 0.012 0.980 0.008
#> GSM617623     1  0.7164    0.63813 0.680 0.256 0.064
#> GSM617624     3  0.9702    0.25100 0.364 0.220 0.416
#> GSM617625     3  0.0237    0.77273 0.004 0.000 0.996
#> GSM617626     2  0.0892    0.88321 0.020 0.980 0.000
#> GSM617627     2  0.8592    0.18868 0.108 0.532 0.360
#> GSM617628     3  0.0000    0.77216 0.000 0.000 1.000
#> GSM617632     1  0.5835    0.54289 0.660 0.340 0.000
#> GSM617634     2  0.3267    0.78733 0.000 0.884 0.116
#> GSM617635     1  0.0000    0.85209 1.000 0.000 0.000
#> GSM617636     1  0.0000    0.85209 1.000 0.000 0.000
#> GSM617637     1  0.0000    0.85209 1.000 0.000 0.000
#> GSM617638     1  0.5138    0.70188 0.748 0.000 0.252
#> GSM617639     1  0.0000    0.85209 1.000 0.000 0.000
#> GSM617640     2  0.0892    0.88321 0.020 0.980 0.000
#> GSM617641     2  0.0000    0.87905 0.000 1.000 0.000
#> GSM617643     2  0.0892    0.87631 0.000 0.980 0.020
#> GSM617644     2  0.0892    0.87631 0.000 0.980 0.020
#> GSM617647     1  0.5465    0.62839 0.712 0.288 0.000
#> GSM617648     2  0.1015    0.88179 0.008 0.980 0.012
#> GSM617649     2  0.6562    0.63854 0.072 0.744 0.184
#> GSM617650     1  0.0000    0.85209 1.000 0.000 0.000
#> GSM617651     1  0.0000    0.85209 1.000 0.000 0.000
#> GSM617653     1  0.4654    0.74672 0.792 0.000 0.208
#> GSM617654     1  0.6302    0.05822 0.520 0.480 0.000
#> GSM617583     3  0.1031    0.76994 0.024 0.000 0.976
#> GSM617584     2  0.0892    0.88321 0.020 0.980 0.000
#> GSM617585     3  0.5327    0.60087 0.000 0.272 0.728
#> GSM617586     3  0.0237    0.77273 0.004 0.000 0.996
#> GSM617587     3  0.4293    0.67793 0.164 0.004 0.832
#> GSM617589     3  0.5988    0.44055 0.000 0.368 0.632
#> GSM617591     3  0.3116    0.73303 0.000 0.108 0.892
#> GSM617593     1  0.0000    0.85209 1.000 0.000 0.000
#> GSM617594     1  0.6546    0.70006 0.756 0.148 0.096
#> GSM617595     1  0.0000    0.85209 1.000 0.000 0.000
#> GSM617596     1  0.4121    0.77703 0.832 0.000 0.168
#> GSM617597     1  0.0000    0.85209 1.000 0.000 0.000
#> GSM617598     1  0.0000    0.85209 1.000 0.000 0.000
#> GSM617599     2  0.2448    0.84549 0.076 0.924 0.000
#> GSM617600     3  0.1163    0.76756 0.028 0.000 0.972
#> GSM617601     3  0.6045    0.42085 0.000 0.380 0.620
#> GSM617602     3  0.6299   -0.16261 0.476 0.000 0.524
#> GSM617603     3  0.6215    0.23753 0.000 0.428 0.572
#> GSM617604     1  0.5016    0.71580 0.760 0.000 0.240
#> GSM617605     3  0.5291    0.61739 0.000 0.268 0.732
#> GSM617606     3  0.0237    0.77273 0.004 0.000 0.996
#> GSM617610     1  0.1643    0.83997 0.956 0.044 0.000
#> GSM617611     1  0.1529    0.84275 0.960 0.000 0.040
#> GSM617613     3  0.0000    0.77216 0.000 0.000 1.000
#> GSM617614     1  0.6111    0.47964 0.604 0.000 0.396
#> GSM617621     1  0.0000    0.85209 1.000 0.000 0.000
#> GSM617629     1  0.8533    0.40138 0.536 0.104 0.360
#> GSM617630     1  0.4504    0.75743 0.804 0.000 0.196
#> GSM617631     3  0.0592    0.77171 0.012 0.000 0.988
#> GSM617633     1  0.0237    0.85163 0.996 0.000 0.004
#> GSM617642     3  0.6309   -0.22539 0.496 0.000 0.504
#> GSM617645     1  0.4452    0.74299 0.808 0.192 0.000
#> GSM617646     1  0.1647    0.84357 0.960 0.036 0.004
#> GSM617652     1  0.0592    0.85056 0.988 0.000 0.012
#> GSM617655     3  0.0000    0.77216 0.000 0.000 1.000
#> GSM617656     3  0.0424    0.77292 0.008 0.000 0.992
#> GSM617657     3  0.0000    0.77216 0.000 0.000 1.000
#> GSM617658     1  0.5785    0.59766 0.668 0.000 0.332
#> GSM617659     1  0.0000    0.85209 1.000 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM617581     2  0.0817    0.83931 0.024 0.976 0.000 0.000
#> GSM617582     2  0.5147   -0.00644 0.460 0.536 0.004 0.000
#> GSM617588     2  0.0921    0.82086 0.000 0.972 0.000 0.028
#> GSM617590     4  0.3711    0.80581 0.000 0.024 0.140 0.836
#> GSM617592     2  0.3444    0.63747 0.000 0.816 0.000 0.184
#> GSM617607     1  0.0000    0.84726 1.000 0.000 0.000 0.000
#> GSM617608     1  0.0000    0.84726 1.000 0.000 0.000 0.000
#> GSM617609     1  0.4880    0.71863 0.760 0.000 0.188 0.052
#> GSM617612     1  0.0817    0.84396 0.976 0.000 0.024 0.000
#> GSM617615     3  0.3893    0.57472 0.000 0.196 0.796 0.008
#> GSM617616     1  0.4781    0.52914 0.660 0.336 0.004 0.000
#> GSM617617     2  0.0592    0.84315 0.016 0.984 0.000 0.000
#> GSM617618     2  0.3486    0.65050 0.188 0.812 0.000 0.000
#> GSM617619     3  0.7773    0.32564 0.100 0.344 0.512 0.044
#> GSM617620     2  0.0000    0.83393 0.000 1.000 0.000 0.000
#> GSM617622     2  0.0657    0.84260 0.012 0.984 0.004 0.000
#> GSM617623     1  0.5677    0.64111 0.680 0.256 0.064 0.000
#> GSM617624     3  0.8728    0.17194 0.352 0.200 0.396 0.052
#> GSM617625     3  0.0000    0.70124 0.000 0.000 1.000 0.000
#> GSM617626     2  0.0592    0.84315 0.016 0.984 0.000 0.000
#> GSM617627     2  0.7097    0.20998 0.108 0.528 0.356 0.008
#> GSM617628     3  0.0000    0.70124 0.000 0.000 1.000 0.000
#> GSM617632     1  0.4624    0.54805 0.660 0.340 0.000 0.000
#> GSM617634     2  0.2530    0.75074 0.000 0.888 0.112 0.000
#> GSM617635     1  0.0000    0.84726 1.000 0.000 0.000 0.000
#> GSM617636     1  0.0000    0.84726 1.000 0.000 0.000 0.000
#> GSM617637     1  0.0000    0.84726 1.000 0.000 0.000 0.000
#> GSM617638     1  0.4420    0.70371 0.748 0.000 0.240 0.012
#> GSM617639     1  0.0000    0.84726 1.000 0.000 0.000 0.000
#> GSM617640     2  0.0592    0.84315 0.016 0.984 0.000 0.000
#> GSM617641     4  0.3975    0.63729 0.000 0.240 0.000 0.760
#> GSM617643     2  0.0592    0.83482 0.000 0.984 0.016 0.000
#> GSM617644     2  0.0592    0.83482 0.000 0.984 0.016 0.000
#> GSM617647     1  0.4331    0.63128 0.712 0.288 0.000 0.000
#> GSM617648     2  0.0672    0.84088 0.008 0.984 0.008 0.000
#> GSM617649     2  0.5964    0.57346 0.068 0.728 0.172 0.032
#> GSM617650     1  0.0000    0.84726 1.000 0.000 0.000 0.000
#> GSM617651     1  0.0000    0.84726 1.000 0.000 0.000 0.000
#> GSM617653     1  0.3688    0.74338 0.792 0.000 0.208 0.000
#> GSM617654     1  0.4994    0.05156 0.520 0.480 0.000 0.000
#> GSM617583     3  0.0707    0.69837 0.020 0.000 0.980 0.000
#> GSM617584     2  0.0592    0.84315 0.016 0.984 0.000 0.000
#> GSM617585     3  0.4222    0.51111 0.000 0.272 0.728 0.000
#> GSM617586     3  0.0000    0.70124 0.000 0.000 1.000 0.000
#> GSM617587     3  0.3855    0.57071 0.164 0.004 0.820 0.012
#> GSM617589     3  0.4889    0.39053 0.000 0.360 0.636 0.004
#> GSM617591     3  0.2469    0.64934 0.000 0.108 0.892 0.000
#> GSM617593     1  0.0000    0.84726 1.000 0.000 0.000 0.000
#> GSM617594     1  0.5508    0.69560 0.748 0.148 0.096 0.008
#> GSM617595     1  0.0000    0.84726 1.000 0.000 0.000 0.000
#> GSM617596     1  0.3266    0.77405 0.832 0.000 0.168 0.000
#> GSM617597     1  0.0000    0.84726 1.000 0.000 0.000 0.000
#> GSM617598     1  0.0000    0.84726 1.000 0.000 0.000 0.000
#> GSM617599     2  0.1978    0.80546 0.068 0.928 0.000 0.004
#> GSM617600     3  0.2111    0.68613 0.024 0.000 0.932 0.044
#> GSM617601     3  0.5174    0.38384 0.000 0.368 0.620 0.012
#> GSM617602     3  0.5600   -0.14314 0.468 0.000 0.512 0.020
#> GSM617603     4  0.4464    0.68188 0.000 0.024 0.208 0.768
#> GSM617604     1  0.3975    0.71241 0.760 0.000 0.240 0.000
#> GSM617605     4  0.3300    0.80133 0.000 0.008 0.144 0.848
#> GSM617606     3  0.0000    0.70124 0.000 0.000 1.000 0.000
#> GSM617610     1  0.1302    0.83563 0.956 0.044 0.000 0.000
#> GSM617611     1  0.1211    0.83975 0.960 0.000 0.040 0.000
#> GSM617613     3  0.1211    0.69472 0.000 0.000 0.960 0.040
#> GSM617614     1  0.4843    0.47401 0.604 0.000 0.396 0.000
#> GSM617621     1  0.0000    0.84726 1.000 0.000 0.000 0.000
#> GSM617629     1  0.7627    0.38938 0.528 0.096 0.336 0.040
#> GSM617630     1  0.4182    0.75546 0.796 0.000 0.180 0.024
#> GSM617631     3  0.0657    0.70067 0.012 0.000 0.984 0.004
#> GSM617633     1  0.0188    0.84690 0.996 0.000 0.004 0.000
#> GSM617642     3  0.5000   -0.21914 0.496 0.000 0.504 0.000
#> GSM617645     1  0.3768    0.74891 0.808 0.184 0.000 0.008
#> GSM617646     1  0.1305    0.83928 0.960 0.036 0.004 0.000
#> GSM617652     1  0.0804    0.84539 0.980 0.000 0.012 0.008
#> GSM617655     3  0.0188    0.70098 0.000 0.000 0.996 0.004
#> GSM617656     3  0.1635    0.69479 0.008 0.000 0.948 0.044
#> GSM617657     3  0.1940    0.67298 0.000 0.000 0.924 0.076
#> GSM617658     1  0.4585    0.59256 0.668 0.000 0.332 0.000
#> GSM617659     1  0.0000    0.84726 1.000 0.000 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1    p2    p3    p4    p5
#> GSM617581     2  0.0703     0.8422 0.024 0.976 0.000 0.000 0.000
#> GSM617582     2  0.4434    -0.0248 0.460 0.536 0.004 0.000 0.000
#> GSM617588     2  0.0794     0.8269 0.000 0.972 0.000 0.028 0.000
#> GSM617590     4  0.1012     0.8293 0.000 0.012 0.020 0.968 0.000
#> GSM617592     2  0.3003     0.6620 0.000 0.812 0.000 0.188 0.000
#> GSM617607     1  0.0000     0.8012 1.000 0.000 0.000 0.000 0.000
#> GSM617608     1  0.0000     0.8012 1.000 0.000 0.000 0.000 0.000
#> GSM617609     1  0.5289     0.0579 0.500 0.000 0.048 0.000 0.452
#> GSM617612     1  0.0703     0.7976 0.976 0.000 0.024 0.000 0.000
#> GSM617615     3  0.4502     0.3528 0.000 0.180 0.744 0.000 0.076
#> GSM617616     1  0.4118     0.4857 0.660 0.336 0.004 0.000 0.000
#> GSM617617     2  0.0510     0.8458 0.016 0.984 0.000 0.000 0.000
#> GSM617618     2  0.3003     0.6343 0.188 0.812 0.000 0.000 0.000
#> GSM617619     3  0.7290    -0.4534 0.056 0.144 0.408 0.000 0.392
#> GSM617620     2  0.0162     0.8374 0.000 0.996 0.000 0.000 0.004
#> GSM617622     2  0.0566     0.8454 0.012 0.984 0.004 0.000 0.000
#> GSM617623     1  0.5076     0.5741 0.680 0.252 0.060 0.000 0.008
#> GSM617624     5  0.7371     0.0000 0.184 0.048 0.336 0.000 0.432
#> GSM617625     3  0.0000     0.5325 0.000 0.000 1.000 0.000 0.000
#> GSM617626     2  0.0510     0.8458 0.016 0.984 0.000 0.000 0.000
#> GSM617627     2  0.7657    -0.0594 0.108 0.460 0.292 0.000 0.140
#> GSM617628     3  0.0000     0.5325 0.000 0.000 1.000 0.000 0.000
#> GSM617632     1  0.3983     0.5067 0.660 0.340 0.000 0.000 0.000
#> GSM617634     2  0.2179     0.7527 0.000 0.888 0.112 0.000 0.000
#> GSM617635     1  0.0000     0.8012 1.000 0.000 0.000 0.000 0.000
#> GSM617636     1  0.0000     0.8012 1.000 0.000 0.000 0.000 0.000
#> GSM617637     1  0.0000     0.8012 1.000 0.000 0.000 0.000 0.000
#> GSM617638     1  0.4696     0.6590 0.736 0.000 0.156 0.000 0.108
#> GSM617639     1  0.0000     0.8012 1.000 0.000 0.000 0.000 0.000
#> GSM617640     2  0.0510     0.8458 0.016 0.984 0.000 0.000 0.000
#> GSM617641     4  0.1544     0.8011 0.000 0.068 0.000 0.932 0.000
#> GSM617643     2  0.0671     0.8376 0.000 0.980 0.016 0.000 0.004
#> GSM617644     2  0.0798     0.8374 0.000 0.976 0.016 0.000 0.008
#> GSM617647     1  0.4404     0.5858 0.704 0.264 0.000 0.000 0.032
#> GSM617648     2  0.0579     0.8437 0.008 0.984 0.008 0.000 0.000
#> GSM617649     2  0.6400     0.4571 0.068 0.640 0.140 0.000 0.152
#> GSM617650     1  0.0000     0.8012 1.000 0.000 0.000 0.000 0.000
#> GSM617651     1  0.0000     0.8012 1.000 0.000 0.000 0.000 0.000
#> GSM617653     1  0.3109     0.6956 0.800 0.000 0.200 0.000 0.000
#> GSM617654     1  0.4555     0.0597 0.520 0.472 0.000 0.000 0.008
#> GSM617583     3  0.0609     0.5222 0.020 0.000 0.980 0.000 0.000
#> GSM617584     2  0.0510     0.8458 0.016 0.984 0.000 0.000 0.000
#> GSM617585     3  0.3790     0.3106 0.000 0.272 0.724 0.000 0.004
#> GSM617586     3  0.1270     0.5241 0.000 0.000 0.948 0.000 0.052
#> GSM617587     3  0.4779     0.1470 0.144 0.004 0.740 0.000 0.112
#> GSM617589     3  0.4182     0.1927 0.000 0.352 0.644 0.004 0.000
#> GSM617591     3  0.2358     0.4771 0.000 0.104 0.888 0.000 0.008
#> GSM617593     1  0.0000     0.8012 1.000 0.000 0.000 0.000 0.000
#> GSM617594     1  0.5827     0.5675 0.700 0.116 0.100 0.000 0.084
#> GSM617595     1  0.0000     0.8012 1.000 0.000 0.000 0.000 0.000
#> GSM617596     1  0.2813     0.7228 0.832 0.000 0.168 0.000 0.000
#> GSM617597     1  0.0510     0.7991 0.984 0.000 0.000 0.000 0.016
#> GSM617598     1  0.0000     0.8012 1.000 0.000 0.000 0.000 0.000
#> GSM617599     2  0.2036     0.8108 0.056 0.920 0.000 0.000 0.024
#> GSM617600     3  0.4649    -0.0580 0.016 0.000 0.580 0.000 0.404
#> GSM617601     3  0.5200     0.1909 0.000 0.304 0.628 0.000 0.068
#> GSM617602     3  0.6000    -0.2744 0.428 0.000 0.460 0.000 0.112
#> GSM617603     4  0.6455     0.4800 0.000 0.000 0.200 0.480 0.320
#> GSM617604     1  0.3424     0.6587 0.760 0.000 0.240 0.000 0.000
#> GSM617605     4  0.0992     0.8287 0.000 0.008 0.024 0.968 0.000
#> GSM617606     3  0.0162     0.5327 0.000 0.000 0.996 0.000 0.004
#> GSM617610     1  0.1121     0.7895 0.956 0.044 0.000 0.000 0.000
#> GSM617611     1  0.1043     0.7931 0.960 0.000 0.040 0.000 0.000
#> GSM617613     3  0.4030     0.0938 0.000 0.000 0.648 0.000 0.352
#> GSM617614     1  0.4126     0.4461 0.620 0.000 0.380 0.000 0.000
#> GSM617621     1  0.0000     0.8012 1.000 0.000 0.000 0.000 0.000
#> GSM617629     1  0.7427     0.0279 0.464 0.052 0.260 0.000 0.224
#> GSM617630     1  0.4637     0.6673 0.740 0.000 0.100 0.000 0.160
#> GSM617631     3  0.0579     0.5275 0.008 0.000 0.984 0.000 0.008
#> GSM617633     1  0.0162     0.8008 0.996 0.000 0.004 0.000 0.000
#> GSM617642     1  0.4827     0.1175 0.504 0.000 0.476 0.000 0.020
#> GSM617645     1  0.3868     0.7062 0.800 0.140 0.000 0.000 0.060
#> GSM617646     1  0.1124     0.7929 0.960 0.036 0.004 0.000 0.000
#> GSM617652     1  0.1697     0.7823 0.932 0.000 0.008 0.000 0.060
#> GSM617655     3  0.1410     0.5207 0.000 0.000 0.940 0.000 0.060
#> GSM617656     3  0.4210    -0.0151 0.000 0.000 0.588 0.000 0.412
#> GSM617657     3  0.4088     0.1020 0.000 0.000 0.632 0.000 0.368
#> GSM617658     1  0.4029     0.5570 0.680 0.000 0.316 0.000 0.004
#> GSM617659     1  0.0000     0.8012 1.000 0.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
#> GSM617581     2  0.0632    0.83675 0.024 0.976 0.000 0.000 0.000 0.000
#> GSM617582     2  0.3982   -0.02384 0.460 0.536 0.004 0.000 0.000 0.000
#> GSM617588     2  0.1007    0.81942 0.000 0.956 0.000 0.044 0.000 0.000
#> GSM617590     4  0.0291    0.96229 0.000 0.004 0.004 0.992 0.000 0.000
#> GSM617592     2  0.2793    0.66543 0.000 0.800 0.000 0.200 0.000 0.000
#> GSM617607     1  0.0000    0.81723 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM617608     1  0.0000    0.81723 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM617609     6  0.5249   -0.17487 0.464 0.000 0.040 0.000 0.028 0.468
#> GSM617612     1  0.0632    0.81371 0.976 0.000 0.024 0.000 0.000 0.000
#> GSM617615     3  0.4401    0.47182 0.000 0.164 0.748 0.000 0.044 0.044
#> GSM617616     1  0.3699    0.51754 0.660 0.336 0.004 0.000 0.000 0.000
#> GSM617617     2  0.0458    0.83997 0.016 0.984 0.000 0.000 0.000 0.000
#> GSM617618     2  0.2697    0.64691 0.188 0.812 0.000 0.000 0.000 0.000
#> GSM617619     6  0.6287    0.14635 0.052 0.096 0.396 0.000 0.004 0.452
#> GSM617620     2  0.0622    0.83107 0.000 0.980 0.000 0.012 0.008 0.000
#> GSM617622     2  0.0508    0.83976 0.012 0.984 0.004 0.000 0.000 0.000
#> GSM617623     1  0.4632    0.59981 0.680 0.248 0.060 0.000 0.000 0.012
#> GSM617624     6  0.7582    0.24580 0.148 0.040 0.332 0.000 0.088 0.392
#> GSM617625     3  0.0146    0.59263 0.000 0.000 0.996 0.000 0.004 0.000
#> GSM617626     2  0.0458    0.83997 0.016 0.984 0.000 0.000 0.000 0.000
#> GSM617627     2  0.7771    0.08644 0.108 0.448 0.256 0.000 0.084 0.104
#> GSM617628     3  0.0000    0.59155 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM617632     1  0.3578    0.53714 0.660 0.340 0.000 0.000 0.000 0.000
#> GSM617634     2  0.1957    0.75295 0.000 0.888 0.112 0.000 0.000 0.000
#> GSM617635     1  0.0000    0.81723 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM617636     1  0.0000    0.81723 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM617637     1  0.0000    0.81723 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM617638     1  0.4842    0.67553 0.732 0.000 0.120 0.000 0.080 0.068
#> GSM617639     1  0.0000    0.81723 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM617640     2  0.0748    0.83951 0.016 0.976 0.000 0.000 0.004 0.004
#> GSM617641     4  0.0935    0.93457 0.000 0.032 0.000 0.964 0.004 0.000
#> GSM617643     2  0.0405    0.83339 0.000 0.988 0.008 0.000 0.004 0.000
#> GSM617644     2  0.0964    0.83058 0.000 0.968 0.016 0.000 0.012 0.004
#> GSM617647     1  0.3926    0.61113 0.708 0.268 0.000 0.000 0.012 0.012
#> GSM617648     2  0.0520    0.83813 0.008 0.984 0.008 0.000 0.000 0.000
#> GSM617649     2  0.6123    0.43222 0.064 0.620 0.140 0.000 0.012 0.164
#> GSM617650     1  0.0000    0.81723 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM617651     1  0.0000    0.81723 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM617653     1  0.2762    0.71672 0.804 0.000 0.196 0.000 0.000 0.000
#> GSM617654     1  0.5161   -0.00209 0.472 0.452 0.000 0.000 0.072 0.004
#> GSM617583     3  0.0547    0.58672 0.020 0.000 0.980 0.000 0.000 0.000
#> GSM617584     2  0.0458    0.83997 0.016 0.984 0.000 0.000 0.000 0.000
#> GSM617585     3  0.3521    0.41694 0.000 0.268 0.724 0.000 0.004 0.004
#> GSM617586     3  0.1802    0.57517 0.000 0.000 0.916 0.000 0.012 0.072
#> GSM617587     3  0.4886    0.33453 0.144 0.004 0.728 0.000 0.052 0.072
#> GSM617589     3  0.3864    0.31666 0.000 0.344 0.648 0.004 0.004 0.000
#> GSM617591     3  0.2213    0.55997 0.000 0.100 0.888 0.000 0.004 0.008
#> GSM617593     1  0.0000    0.81723 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM617594     1  0.5494    0.60067 0.704 0.116 0.100 0.000 0.036 0.044
#> GSM617595     1  0.0000    0.81723 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM617596     1  0.2527    0.73988 0.832 0.000 0.168 0.000 0.000 0.000
#> GSM617597     1  0.0717    0.81354 0.976 0.000 0.000 0.000 0.008 0.016
#> GSM617598     1  0.0000    0.81723 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM617599     2  0.1921    0.80642 0.056 0.920 0.000 0.000 0.012 0.012
#> GSM617600     3  0.4097   -0.21250 0.008 0.000 0.500 0.000 0.000 0.492
#> GSM617601     3  0.5193    0.33149 0.000 0.276 0.628 0.000 0.068 0.028
#> GSM617602     3  0.5519   -0.19685 0.432 0.000 0.452 0.000 0.004 0.112
#> GSM617603     5  0.4552    0.00000 0.000 0.000 0.172 0.128 0.700 0.000
#> GSM617604     1  0.3076    0.67807 0.760 0.000 0.240 0.000 0.000 0.000
#> GSM617605     4  0.0260    0.96108 0.000 0.000 0.008 0.992 0.000 0.000
#> GSM617606     3  0.0146    0.59257 0.000 0.000 0.996 0.000 0.004 0.000
#> GSM617610     1  0.1007    0.80599 0.956 0.044 0.000 0.000 0.000 0.000
#> GSM617611     1  0.0937    0.80930 0.960 0.000 0.040 0.000 0.000 0.000
#> GSM617613     3  0.3782   -0.07288 0.000 0.000 0.588 0.000 0.000 0.412
#> GSM617614     1  0.3695    0.48467 0.624 0.000 0.376 0.000 0.000 0.000
#> GSM617621     1  0.0000    0.81723 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM617629     1  0.8265   -0.13247 0.376 0.048 0.232 0.008 0.128 0.208
#> GSM617630     1  0.4821    0.68411 0.736 0.000 0.076 0.000 0.080 0.108
#> GSM617631     3  0.0665    0.58644 0.008 0.000 0.980 0.000 0.004 0.008
#> GSM617633     1  0.0146    0.81687 0.996 0.000 0.004 0.000 0.000 0.000
#> GSM617642     1  0.4719    0.18728 0.500 0.000 0.464 0.000 0.012 0.024
#> GSM617645     1  0.4040    0.72943 0.784 0.092 0.000 0.000 0.104 0.020
#> GSM617646     1  0.1010    0.80875 0.960 0.036 0.000 0.000 0.000 0.004
#> GSM617652     1  0.1666    0.80058 0.936 0.000 0.008 0.000 0.036 0.020
#> GSM617655     3  0.2019    0.56949 0.000 0.000 0.900 0.000 0.012 0.088
#> GSM617656     6  0.3869   -0.04728 0.000 0.000 0.500 0.000 0.000 0.500
#> GSM617657     6  0.4218   -0.25538 0.000 0.000 0.360 0.000 0.024 0.616
#> GSM617658     1  0.3738    0.57955 0.680 0.000 0.312 0.000 0.004 0.004
#> GSM617659     1  0.0000    0.81723 1.000 0.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-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) k
#> MAD:pam 73         0.775415 2
#> MAD:pam 67         0.000665 3
#> MAD:pam 68         0.002427 4
#> MAD:pam 56         0.023961 5
#> MAD:pam 58         0.018469 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 21168 rows and 79 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 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-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.526           0.748       0.879         0.2819 0.705   0.705
#> 3 3 0.289           0.573       0.737         1.0438 0.529   0.394
#> 4 4 0.620           0.776       0.853         0.2631 0.819   0.566
#> 5 5 0.599           0.541       0.768         0.0765 0.946   0.804
#> 6 6 0.610           0.444       0.687         0.0320 0.937   0.737

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

suggest_best_k(res)
#> [1] 4

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

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

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>           class entropy silhouette    p1    p2
#> GSM617581     1  0.1414      0.883 0.980 0.020
#> GSM617582     1  0.1184      0.884 0.984 0.016
#> GSM617588     2  0.9491      0.803 0.368 0.632
#> GSM617590     2  0.9460      0.800 0.364 0.636
#> GSM617592     2  0.9460      0.803 0.364 0.636
#> GSM617607     1  0.1843      0.875 0.972 0.028
#> GSM617608     1  0.0000      0.886 1.000 0.000
#> GSM617609     1  0.0000      0.886 1.000 0.000
#> GSM617612     1  0.0000      0.886 1.000 0.000
#> GSM617615     1  0.9635     -0.237 0.612 0.388
#> GSM617616     1  0.1414      0.885 0.980 0.020
#> GSM617617     2  0.9358      0.650 0.352 0.648
#> GSM617618     1  0.2948      0.867 0.948 0.052
#> GSM617619     1  0.2236      0.871 0.964 0.036
#> GSM617620     2  0.9460      0.803 0.364 0.636
#> GSM617622     1  1.0000     -0.521 0.504 0.496
#> GSM617623     1  0.1414      0.883 0.980 0.020
#> GSM617624     1  0.4562      0.809 0.904 0.096
#> GSM617625     1  0.0000      0.886 1.000 0.000
#> GSM617626     1  0.1184      0.884 0.984 0.016
#> GSM617627     1  0.7376      0.598 0.792 0.208
#> GSM617628     1  0.0000      0.886 1.000 0.000
#> GSM617632     1  0.0938      0.884 0.988 0.012
#> GSM617634     1  0.3274      0.852 0.940 0.060
#> GSM617635     1  0.2043      0.872 0.968 0.032
#> GSM617636     1  0.2043      0.880 0.968 0.032
#> GSM617637     1  0.0000      0.886 1.000 0.000
#> GSM617638     1  0.3114      0.856 0.944 0.056
#> GSM617639     1  0.0000      0.886 1.000 0.000
#> GSM617640     2  0.8327      0.714 0.264 0.736
#> GSM617641     2  0.9460      0.803 0.364 0.636
#> GSM617643     2  0.8207      0.715 0.256 0.744
#> GSM617644     2  0.8608      0.763 0.284 0.716
#> GSM617647     1  0.5408      0.774 0.876 0.124
#> GSM617648     2  0.8861      0.696 0.304 0.696
#> GSM617649     1  0.9286      0.226 0.656 0.344
#> GSM617650     1  0.0000      0.886 1.000 0.000
#> GSM617651     1  0.0376      0.886 0.996 0.004
#> GSM617653     1  0.0938      0.884 0.988 0.012
#> GSM617654     1  0.9954     -0.214 0.540 0.460
#> GSM617583     1  0.0000      0.886 1.000 0.000
#> GSM617584     1  0.9732     -0.285 0.596 0.404
#> GSM617585     1  0.9087      0.127 0.676 0.324
#> GSM617586     1  0.2948      0.851 0.948 0.052
#> GSM617587     1  0.0000      0.886 1.000 0.000
#> GSM617589     2  0.9491      0.803 0.368 0.632
#> GSM617591     1  0.1414      0.878 0.980 0.020
#> GSM617593     1  0.0000      0.886 1.000 0.000
#> GSM617594     1  0.6148      0.719 0.848 0.152
#> GSM617595     1  0.0376      0.886 0.996 0.004
#> GSM617596     1  0.0938      0.884 0.988 0.012
#> GSM617597     1  0.0000      0.886 1.000 0.000
#> GSM617598     1  0.0672      0.886 0.992 0.008
#> GSM617599     1  0.3114      0.856 0.944 0.056
#> GSM617600     1  0.3274      0.843 0.940 0.060
#> GSM617601     1  1.0000     -0.595 0.500 0.500
#> GSM617602     1  0.3431      0.845 0.936 0.064
#> GSM617603     2  0.9522      0.801 0.372 0.628
#> GSM617604     1  0.1414      0.882 0.980 0.020
#> GSM617605     2  0.9460      0.800 0.364 0.636
#> GSM617606     1  0.1414      0.877 0.980 0.020
#> GSM617610     1  0.0376      0.886 0.996 0.004
#> GSM617611     1  0.0000      0.886 1.000 0.000
#> GSM617613     1  0.3274      0.843 0.940 0.060
#> GSM617614     1  0.0376      0.886 0.996 0.004
#> GSM617621     1  0.0938      0.884 0.988 0.012
#> GSM617629     1  0.2778      0.873 0.952 0.048
#> GSM617630     1  0.0938      0.885 0.988 0.012
#> GSM617631     1  0.3584      0.839 0.932 0.068
#> GSM617633     1  0.2043      0.872 0.968 0.032
#> GSM617642     1  0.1184      0.881 0.984 0.016
#> GSM617645     2  0.9754      0.554 0.408 0.592
#> GSM617646     1  0.2043      0.872 0.968 0.032
#> GSM617652     1  0.0000      0.886 1.000 0.000
#> GSM617655     1  0.3274      0.843 0.940 0.060
#> GSM617656     1  0.3274      0.843 0.940 0.060
#> GSM617657     1  0.3114      0.847 0.944 0.056
#> GSM617658     1  0.3584      0.840 0.932 0.068
#> GSM617659     1  0.0000      0.886 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
#> GSM617581     1  0.6587     0.3225 0.632 0.352 0.016
#> GSM617582     1  0.6108     0.5042 0.732 0.240 0.028
#> GSM617588     2  0.0424     0.6783 0.008 0.992 0.000
#> GSM617590     2  0.0424     0.6783 0.008 0.992 0.000
#> GSM617592     2  0.0424     0.6783 0.008 0.992 0.000
#> GSM617607     1  0.3434     0.7181 0.904 0.064 0.032
#> GSM617608     1  0.2301     0.7283 0.936 0.060 0.004
#> GSM617609     3  0.9715     0.6648 0.380 0.220 0.400
#> GSM617612     1  0.1267     0.7359 0.972 0.024 0.004
#> GSM617615     2  0.5815     0.6624 0.104 0.800 0.096
#> GSM617616     1  0.3213     0.7278 0.912 0.060 0.028
#> GSM617617     2  0.7974     0.6445 0.060 0.504 0.436
#> GSM617618     1  0.4865     0.6644 0.832 0.136 0.032
#> GSM617619     3  0.9612     0.5326 0.204 0.372 0.424
#> GSM617620     2  0.0424     0.6783 0.008 0.992 0.000
#> GSM617622     2  0.7400     0.7060 0.072 0.664 0.264
#> GSM617623     1  0.5268     0.5896 0.776 0.212 0.012
#> GSM617624     2  0.7828     0.6303 0.160 0.672 0.168
#> GSM617625     1  0.9283    -0.2451 0.524 0.216 0.260
#> GSM617626     1  0.1999     0.7267 0.952 0.036 0.012
#> GSM617627     2  0.7064     0.6937 0.076 0.704 0.220
#> GSM617628     1  0.9678    -0.6055 0.420 0.216 0.364
#> GSM617632     1  0.1585     0.7347 0.964 0.028 0.008
#> GSM617634     2  0.8887     0.2239 0.388 0.488 0.124
#> GSM617635     1  0.3369     0.7218 0.908 0.052 0.040
#> GSM617636     1  0.4995     0.6539 0.824 0.144 0.032
#> GSM617637     1  0.0661     0.7339 0.988 0.004 0.008
#> GSM617638     2  0.9174     0.3285 0.276 0.532 0.192
#> GSM617639     1  0.0424     0.7304 0.992 0.000 0.008
#> GSM617640     2  0.7021     0.6452 0.020 0.544 0.436
#> GSM617641     2  0.0424     0.6783 0.008 0.992 0.000
#> GSM617643     2  0.7021     0.6470 0.020 0.544 0.436
#> GSM617644     2  0.6228     0.6907 0.012 0.672 0.316
#> GSM617647     2  0.8918     0.6509 0.160 0.552 0.288
#> GSM617648     2  0.7627     0.6511 0.044 0.528 0.428
#> GSM617649     2  0.8037     0.6833 0.076 0.572 0.352
#> GSM617650     1  0.0747     0.7365 0.984 0.016 0.000
#> GSM617651     1  0.0661     0.7295 0.988 0.004 0.008
#> GSM617653     1  0.1015     0.7309 0.980 0.012 0.008
#> GSM617654     2  0.8326     0.6404 0.080 0.488 0.432
#> GSM617583     1  0.8876    -0.0179 0.576 0.220 0.204
#> GSM617584     2  0.4068     0.6357 0.120 0.864 0.016
#> GSM617585     2  0.6880     0.3971 0.156 0.736 0.108
#> GSM617586     3  0.9178     0.9014 0.240 0.220 0.540
#> GSM617587     1  0.9439    -0.3273 0.500 0.224 0.276
#> GSM617589     2  0.0829     0.6798 0.012 0.984 0.004
#> GSM617591     2  0.5728     0.5375 0.196 0.772 0.032
#> GSM617593     1  0.0424     0.7345 0.992 0.008 0.000
#> GSM617594     2  0.9405     0.5985 0.204 0.496 0.300
#> GSM617595     1  0.0424     0.7304 0.992 0.000 0.008
#> GSM617596     1  0.1015     0.7266 0.980 0.008 0.012
#> GSM617597     1  0.8977    -0.0777 0.564 0.204 0.232
#> GSM617598     1  0.0848     0.7323 0.984 0.008 0.008
#> GSM617599     2  0.8625     0.4057 0.316 0.560 0.124
#> GSM617600     3  0.9086     0.8965 0.228 0.220 0.552
#> GSM617601     2  0.6044     0.6924 0.056 0.772 0.172
#> GSM617602     3  0.9298     0.8839 0.248 0.228 0.524
#> GSM617603     2  0.0661     0.6797 0.008 0.988 0.004
#> GSM617604     1  0.4569     0.6858 0.860 0.068 0.072
#> GSM617605     2  0.0424     0.6783 0.008 0.992 0.000
#> GSM617606     2  0.5986     0.4921 0.240 0.736 0.024
#> GSM617610     1  0.0475     0.7324 0.992 0.004 0.004
#> GSM617611     1  0.0475     0.7322 0.992 0.004 0.004
#> GSM617613     3  0.9148     0.9023 0.236 0.220 0.544
#> GSM617614     1  0.9587    -0.4312 0.468 0.224 0.308
#> GSM617621     1  0.1015     0.7266 0.980 0.008 0.012
#> GSM617629     3  0.9379     0.7987 0.288 0.208 0.504
#> GSM617630     1  0.9963    -0.6037 0.360 0.292 0.348
#> GSM617631     3  0.9151     0.8975 0.228 0.228 0.544
#> GSM617633     1  0.5891     0.5536 0.764 0.200 0.036
#> GSM617642     1  0.9717    -0.6653 0.392 0.220 0.388
#> GSM617645     2  0.7729     0.6502 0.048 0.516 0.436
#> GSM617646     1  0.2116     0.7277 0.948 0.012 0.040
#> GSM617652     1  0.4682     0.5909 0.804 0.192 0.004
#> GSM617655     3  0.9148     0.9023 0.236 0.220 0.544
#> GSM617656     3  0.9148     0.9023 0.236 0.220 0.544
#> GSM617657     3  0.9118     0.9000 0.232 0.220 0.548
#> GSM617658     3  0.9528     0.8349 0.288 0.228 0.484
#> GSM617659     1  0.2356     0.7264 0.928 0.072 0.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM617581     1  0.6907      0.721 0.632 0.180 0.012 0.176
#> GSM617582     1  0.9210      0.243 0.420 0.124 0.296 0.160
#> GSM617588     4  0.3266      0.941 0.000 0.168 0.000 0.832
#> GSM617590     4  0.3266      0.941 0.000 0.168 0.000 0.832
#> GSM617592     4  0.3266      0.941 0.000 0.168 0.000 0.832
#> GSM617607     1  0.1733      0.858 0.948 0.024 0.028 0.000
#> GSM617608     1  0.0921      0.856 0.972 0.000 0.028 0.000
#> GSM617609     3  0.1909      0.837 0.008 0.048 0.940 0.004
#> GSM617612     1  0.0336      0.861 0.992 0.000 0.008 0.000
#> GSM617615     2  0.4781      0.340 0.000 0.660 0.004 0.336
#> GSM617616     1  0.3775      0.848 0.864 0.040 0.016 0.080
#> GSM617617     2  0.0336      0.831 0.000 0.992 0.000 0.008
#> GSM617618     1  0.5745      0.807 0.756 0.096 0.032 0.116
#> GSM617619     3  0.4500      0.559 0.000 0.316 0.684 0.000
#> GSM617620     4  0.3266      0.941 0.000 0.168 0.000 0.832
#> GSM617622     2  0.3355      0.696 0.000 0.836 0.004 0.160
#> GSM617623     1  0.6635      0.738 0.652 0.176 0.008 0.164
#> GSM617624     2  0.1732      0.814 0.004 0.948 0.040 0.008
#> GSM617625     3  0.3942      0.728 0.236 0.000 0.764 0.000
#> GSM617626     1  0.5577      0.798 0.744 0.144 0.008 0.104
#> GSM617627     2  0.0707      0.829 0.000 0.980 0.020 0.000
#> GSM617628     3  0.3610      0.766 0.200 0.000 0.800 0.000
#> GSM617632     1  0.5309      0.810 0.756 0.072 0.008 0.164
#> GSM617634     2  0.3225      0.768 0.060 0.892 0.032 0.016
#> GSM617635     1  0.1174      0.862 0.968 0.020 0.012 0.000
#> GSM617636     1  0.7177      0.742 0.640 0.160 0.036 0.164
#> GSM617637     1  0.0188      0.861 0.996 0.000 0.004 0.000
#> GSM617638     2  0.4071      0.721 0.016 0.844 0.104 0.036
#> GSM617639     1  0.1356      0.860 0.960 0.032 0.008 0.000
#> GSM617640     2  0.0188      0.832 0.000 0.996 0.000 0.004
#> GSM617641     4  0.3266      0.941 0.000 0.168 0.000 0.832
#> GSM617643     2  0.1716      0.798 0.000 0.936 0.000 0.064
#> GSM617644     2  0.4103      0.536 0.000 0.744 0.000 0.256
#> GSM617647     2  0.0188      0.832 0.000 0.996 0.004 0.000
#> GSM617648     2  0.1637      0.808 0.000 0.940 0.000 0.060
#> GSM617649     2  0.0376      0.833 0.000 0.992 0.004 0.004
#> GSM617650     1  0.0336      0.861 0.992 0.000 0.008 0.000
#> GSM617651     1  0.0188      0.861 0.996 0.000 0.004 0.000
#> GSM617653     1  0.2859      0.843 0.880 0.000 0.008 0.112
#> GSM617654     2  0.0000      0.832 0.000 1.000 0.000 0.000
#> GSM617583     3  0.3837      0.737 0.224 0.000 0.776 0.000
#> GSM617584     4  0.5186      0.610 0.016 0.344 0.000 0.640
#> GSM617585     3  0.7096      0.157 0.000 0.140 0.516 0.344
#> GSM617586     3  0.0712      0.844 0.004 0.008 0.984 0.004
#> GSM617587     3  0.5201      0.716 0.180 0.064 0.752 0.004
#> GSM617589     4  0.3610      0.915 0.000 0.200 0.000 0.800
#> GSM617591     2  0.7497      0.269 0.012 0.528 0.308 0.152
#> GSM617593     1  0.0188      0.861 0.996 0.000 0.004 0.000
#> GSM617594     2  0.0844      0.833 0.004 0.980 0.012 0.004
#> GSM617595     1  0.0188      0.861 0.996 0.000 0.004 0.000
#> GSM617596     1  0.5170      0.813 0.764 0.064 0.008 0.164
#> GSM617597     3  0.3074      0.803 0.152 0.000 0.848 0.000
#> GSM617598     1  0.0188      0.862 0.996 0.000 0.004 0.000
#> GSM617599     2  0.1007      0.831 0.008 0.976 0.008 0.008
#> GSM617600     3  0.0564      0.845 0.004 0.004 0.988 0.004
#> GSM617601     2  0.3208      0.716 0.000 0.848 0.004 0.148
#> GSM617602     3  0.2561      0.825 0.016 0.004 0.912 0.068
#> GSM617603     4  0.4008      0.862 0.000 0.244 0.000 0.756
#> GSM617604     1  0.7332      0.710 0.636 0.048 0.152 0.164
#> GSM617605     4  0.3266      0.941 0.000 0.168 0.000 0.832
#> GSM617606     2  0.7718      0.268 0.036 0.512 0.344 0.108
#> GSM617610     1  0.0188      0.861 0.996 0.000 0.004 0.000
#> GSM617611     1  0.0336      0.861 0.992 0.000 0.008 0.000
#> GSM617613     3  0.0564      0.845 0.004 0.004 0.988 0.004
#> GSM617614     3  0.1743      0.843 0.056 0.000 0.940 0.004
#> GSM617621     1  0.6436      0.756 0.672 0.160 0.008 0.160
#> GSM617629     3  0.4362      0.782 0.008 0.088 0.828 0.076
#> GSM617630     3  0.5496      0.504 0.008 0.344 0.632 0.016
#> GSM617631     3  0.0188      0.843 0.004 0.000 0.996 0.000
#> GSM617633     1  0.5189      0.766 0.784 0.120 0.076 0.020
#> GSM617642     3  0.1302      0.845 0.044 0.000 0.956 0.000
#> GSM617645     2  0.0188      0.832 0.000 0.996 0.000 0.004
#> GSM617646     1  0.2918      0.835 0.876 0.116 0.008 0.000
#> GSM617652     1  0.4998      0.795 0.780 0.128 0.088 0.004
#> GSM617655     3  0.0564      0.845 0.004 0.004 0.988 0.004
#> GSM617656     3  0.0564      0.845 0.004 0.004 0.988 0.004
#> GSM617657     3  0.0524      0.844 0.000 0.008 0.988 0.004
#> GSM617658     3  0.4378      0.762 0.036 0.004 0.804 0.156
#> GSM617659     1  0.0707      0.859 0.980 0.000 0.020 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
#> GSM617581     5  0.6550     0.4389 0.388 0.172 0.004 0.000 0.436
#> GSM617582     5  0.6388     0.4599 0.200 0.060 0.112 0.000 0.628
#> GSM617588     4  0.0703     0.8663 0.000 0.024 0.000 0.976 0.000
#> GSM617590     4  0.0451     0.8636 0.000 0.008 0.000 0.988 0.004
#> GSM617592     4  0.0703     0.8666 0.000 0.024 0.000 0.976 0.000
#> GSM617607     1  0.4335     0.3619 0.664 0.004 0.008 0.000 0.324
#> GSM617608     1  0.3123     0.4944 0.828 0.000 0.012 0.000 0.160
#> GSM617609     3  0.4048     0.6306 0.016 0.012 0.764 0.000 0.208
#> GSM617612     1  0.1043     0.6049 0.960 0.000 0.000 0.000 0.040
#> GSM617615     2  0.5128     0.4031 0.000 0.580 0.004 0.380 0.036
#> GSM617616     1  0.4481    -0.0599 0.576 0.008 0.000 0.000 0.416
#> GSM617617     2  0.0404     0.7827 0.000 0.988 0.000 0.012 0.000
#> GSM617618     5  0.5128     0.2895 0.420 0.012 0.020 0.000 0.548
#> GSM617619     3  0.6789     0.2432 0.004 0.252 0.440 0.000 0.304
#> GSM617620     4  0.0609     0.8671 0.000 0.020 0.000 0.980 0.000
#> GSM617622     2  0.4220     0.4857 0.000 0.688 0.004 0.300 0.008
#> GSM617623     5  0.6620     0.4169 0.404 0.184 0.004 0.000 0.408
#> GSM617624     2  0.4465     0.6426 0.000 0.672 0.024 0.000 0.304
#> GSM617625     3  0.5191     0.5860 0.252 0.000 0.660 0.000 0.088
#> GSM617626     1  0.6309    -0.4038 0.492 0.168 0.000 0.000 0.340
#> GSM617627     2  0.3061     0.7590 0.000 0.844 0.020 0.000 0.136
#> GSM617628     3  0.4901     0.6422 0.184 0.000 0.712 0.000 0.104
#> GSM617632     1  0.4825    -0.1896 0.568 0.024 0.000 0.000 0.408
#> GSM617634     2  0.4905     0.6358 0.008 0.656 0.024 0.004 0.308
#> GSM617635     1  0.3534     0.4406 0.744 0.000 0.000 0.000 0.256
#> GSM617636     5  0.5180     0.3663 0.304 0.020 0.032 0.000 0.644
#> GSM617637     1  0.0963     0.6169 0.964 0.000 0.000 0.000 0.036
#> GSM617638     2  0.5595     0.5203 0.000 0.560 0.084 0.000 0.356
#> GSM617639     1  0.2074     0.5874 0.896 0.000 0.000 0.000 0.104
#> GSM617640     2  0.0162     0.7834 0.000 0.996 0.000 0.004 0.000
#> GSM617641     4  0.0771     0.8672 0.000 0.020 0.000 0.976 0.004
#> GSM617643     2  0.1197     0.7706 0.000 0.952 0.000 0.048 0.000
#> GSM617644     2  0.3684     0.5672 0.000 0.720 0.000 0.280 0.000
#> GSM617647     2  0.0451     0.7851 0.004 0.988 0.000 0.000 0.008
#> GSM617648     2  0.1043     0.7762 0.000 0.960 0.000 0.040 0.000
#> GSM617649     2  0.1662     0.7835 0.000 0.936 0.004 0.004 0.056
#> GSM617650     1  0.1197     0.6148 0.952 0.000 0.000 0.000 0.048
#> GSM617651     1  0.0404     0.6183 0.988 0.000 0.000 0.000 0.012
#> GSM617653     1  0.4088    -0.0575 0.632 0.000 0.000 0.000 0.368
#> GSM617654     2  0.0290     0.7845 0.000 0.992 0.000 0.000 0.008
#> GSM617583     3  0.4789     0.6704 0.156 0.000 0.728 0.000 0.116
#> GSM617584     4  0.6087     0.4107 0.000 0.244 0.000 0.568 0.188
#> GSM617585     4  0.5657     0.3144 0.000 0.044 0.352 0.580 0.024
#> GSM617586     3  0.0703     0.7334 0.000 0.000 0.976 0.000 0.024
#> GSM617587     3  0.6100     0.4711 0.092 0.032 0.612 0.000 0.264
#> GSM617589     4  0.3081     0.7243 0.000 0.156 0.000 0.832 0.012
#> GSM617591     2  0.7792     0.3378 0.000 0.456 0.160 0.268 0.116
#> GSM617593     1  0.2074     0.5985 0.896 0.000 0.000 0.000 0.104
#> GSM617594     2  0.1179     0.7844 0.016 0.964 0.004 0.000 0.016
#> GSM617595     1  0.0404     0.6181 0.988 0.000 0.000 0.000 0.012
#> GSM617596     1  0.4855    -0.1910 0.544 0.016 0.004 0.000 0.436
#> GSM617597     3  0.5211     0.5738 0.232 0.000 0.668 0.000 0.100
#> GSM617598     1  0.2561     0.4784 0.856 0.000 0.000 0.000 0.144
#> GSM617599     2  0.3149     0.7380 0.080 0.872 0.004 0.012 0.032
#> GSM617600     3  0.0609     0.7316 0.000 0.000 0.980 0.000 0.020
#> GSM617601     2  0.4003     0.6414 0.000 0.740 0.008 0.244 0.008
#> GSM617602     3  0.3838     0.6180 0.004 0.000 0.716 0.000 0.280
#> GSM617603     4  0.1408     0.8475 0.000 0.044 0.000 0.948 0.008
#> GSM617604     5  0.6560     0.3447 0.416 0.012 0.140 0.000 0.432
#> GSM617605     4  0.0451     0.8636 0.000 0.008 0.000 0.988 0.004
#> GSM617606     2  0.8282     0.3737 0.008 0.436 0.164 0.172 0.220
#> GSM617610     1  0.0609     0.6154 0.980 0.000 0.000 0.000 0.020
#> GSM617611     1  0.0162     0.6191 0.996 0.000 0.000 0.000 0.004
#> GSM617613     3  0.0898     0.7307 0.000 0.000 0.972 0.008 0.020
#> GSM617614     3  0.4548     0.6878 0.096 0.000 0.748 0.000 0.156
#> GSM617621     1  0.4957    -0.2027 0.528 0.028 0.000 0.000 0.444
#> GSM617629     3  0.4651     0.4274 0.008 0.004 0.560 0.000 0.428
#> GSM617630     3  0.6810     0.2297 0.004 0.264 0.436 0.000 0.296
#> GSM617631     3  0.3282     0.6765 0.000 0.000 0.804 0.008 0.188
#> GSM617633     1  0.5099     0.2223 0.608 0.004 0.040 0.000 0.348
#> GSM617642     3  0.4035     0.7064 0.060 0.000 0.784 0.000 0.156
#> GSM617645     2  0.0324     0.7838 0.000 0.992 0.000 0.004 0.004
#> GSM617646     1  0.3016     0.5679 0.848 0.020 0.000 0.000 0.132
#> GSM617652     1  0.6256     0.1797 0.552 0.020 0.104 0.000 0.324
#> GSM617655     3  0.0510     0.7332 0.000 0.000 0.984 0.000 0.016
#> GSM617656     3  0.0671     0.7314 0.000 0.000 0.980 0.004 0.016
#> GSM617657     3  0.1106     0.7306 0.000 0.000 0.964 0.012 0.024
#> GSM617658     3  0.4367     0.5090 0.008 0.000 0.620 0.000 0.372
#> GSM617659     1  0.1282     0.6153 0.952 0.000 0.004 0.000 0.044

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>           class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM617581     5  0.6664   -0.03265 0.348 0.148 0.004 0.000 0.444 0.056
#> GSM617582     5  0.6354    0.33504 0.132 0.036 0.068 0.004 0.636 0.124
#> GSM617588     4  0.0692    0.81969 0.000 0.020 0.000 0.976 0.004 0.000
#> GSM617590     4  0.1265    0.81709 0.000 0.000 0.000 0.948 0.008 0.044
#> GSM617592     4  0.1116    0.81800 0.000 0.028 0.000 0.960 0.008 0.004
#> GSM617607     1  0.4315    0.36440 0.596 0.004 0.004 0.000 0.384 0.012
#> GSM617608     1  0.3492    0.51886 0.788 0.000 0.004 0.000 0.176 0.032
#> GSM617609     3  0.6023    0.11709 0.016 0.008 0.516 0.000 0.328 0.132
#> GSM617612     1  0.1434    0.64844 0.940 0.000 0.000 0.000 0.048 0.012
#> GSM617615     2  0.5988    0.09891 0.008 0.452 0.000 0.428 0.032 0.080
#> GSM617616     1  0.4566    0.24337 0.520 0.012 0.000 0.000 0.452 0.016
#> GSM617617     2  0.0820    0.69764 0.000 0.972 0.000 0.012 0.000 0.016
#> GSM617618     5  0.4744    0.03964 0.344 0.008 0.004 0.000 0.608 0.036
#> GSM617619     5  0.7636   -0.04079 0.004 0.172 0.316 0.004 0.348 0.156
#> GSM617620     4  0.0837    0.82003 0.000 0.020 0.000 0.972 0.004 0.004
#> GSM617622     2  0.4452    0.40848 0.000 0.644 0.000 0.312 0.040 0.004
#> GSM617623     5  0.6400   -0.05994 0.356 0.148 0.000 0.000 0.452 0.044
#> GSM617624     2  0.5569    0.46571 0.000 0.560 0.020 0.000 0.320 0.100
#> GSM617625     6  0.5361    0.59401 0.156 0.000 0.268 0.000 0.000 0.576
#> GSM617626     1  0.6079    0.09765 0.452 0.128 0.000 0.004 0.396 0.020
#> GSM617627     2  0.4710    0.57421 0.000 0.660 0.008 0.004 0.276 0.052
#> GSM617628     6  0.5240    0.59871 0.132 0.000 0.284 0.000 0.000 0.584
#> GSM617632     1  0.4901    0.27027 0.528 0.024 0.004 0.000 0.428 0.016
#> GSM617634     2  0.6176    0.40979 0.016 0.496 0.012 0.004 0.356 0.116
#> GSM617635     1  0.3620    0.37616 0.648 0.000 0.000 0.000 0.352 0.000
#> GSM617636     5  0.5393    0.22468 0.196 0.004 0.016 0.000 0.644 0.140
#> GSM617637     1  0.1444    0.64832 0.928 0.000 0.000 0.000 0.072 0.000
#> GSM617638     2  0.6171    0.34625 0.000 0.484 0.032 0.004 0.360 0.120
#> GSM617639     1  0.2146    0.62837 0.880 0.000 0.000 0.000 0.116 0.004
#> GSM617640     2  0.0777    0.69806 0.000 0.972 0.000 0.004 0.000 0.024
#> GSM617641     4  0.0976    0.82043 0.000 0.016 0.000 0.968 0.008 0.008
#> GSM617643     2  0.1951    0.68541 0.000 0.916 0.000 0.060 0.004 0.020
#> GSM617644     2  0.4106    0.43811 0.004 0.664 0.000 0.312 0.000 0.020
#> GSM617647     2  0.1592    0.69684 0.024 0.944 0.000 0.004 0.016 0.012
#> GSM617648     2  0.1974    0.69248 0.000 0.920 0.000 0.048 0.012 0.020
#> GSM617649     2  0.2933    0.69170 0.000 0.856 0.000 0.008 0.096 0.040
#> GSM617650     1  0.1092    0.64791 0.960 0.000 0.000 0.000 0.020 0.020
#> GSM617651     1  0.0937    0.64662 0.960 0.000 0.000 0.000 0.040 0.000
#> GSM617653     1  0.4184    0.31287 0.576 0.000 0.000 0.000 0.408 0.016
#> GSM617654     2  0.0653    0.69876 0.000 0.980 0.000 0.004 0.004 0.012
#> GSM617583     6  0.5052    0.62811 0.084 0.000 0.320 0.000 0.004 0.592
#> GSM617584     4  0.6538    0.25301 0.004 0.232 0.000 0.444 0.296 0.024
#> GSM617585     4  0.3799    0.72872 0.004 0.004 0.072 0.812 0.012 0.096
#> GSM617586     3  0.4290   -0.07661 0.004 0.000 0.612 0.000 0.020 0.364
#> GSM617587     3  0.7598   -0.01996 0.048 0.052 0.364 0.000 0.324 0.212
#> GSM617589     4  0.3584    0.70096 0.000 0.128 0.000 0.808 0.012 0.052
#> GSM617591     4  0.7629   -0.17433 0.004 0.340 0.028 0.340 0.064 0.224
#> GSM617593     1  0.2199    0.63456 0.892 0.000 0.000 0.000 0.088 0.020
#> GSM617594     2  0.3432    0.67673 0.016 0.832 0.004 0.012 0.120 0.016
#> GSM617595     1  0.0865    0.64711 0.964 0.000 0.000 0.000 0.036 0.000
#> GSM617596     1  0.4978    0.27145 0.496 0.008 0.000 0.000 0.448 0.048
#> GSM617597     6  0.7342    0.40813 0.204 0.000 0.280 0.000 0.132 0.384
#> GSM617598     1  0.2442    0.59804 0.852 0.000 0.000 0.000 0.144 0.004
#> GSM617599     2  0.5232    0.57716 0.052 0.676 0.000 0.016 0.220 0.036
#> GSM617600     3  0.0692    0.54274 0.000 0.000 0.976 0.000 0.004 0.020
#> GSM617601     2  0.5320    0.31095 0.000 0.552 0.004 0.372 0.024 0.048
#> GSM617602     6  0.5578    0.37538 0.000 0.000 0.360 0.000 0.148 0.492
#> GSM617603     4  0.1265    0.81543 0.000 0.000 0.000 0.948 0.008 0.044
#> GSM617604     1  0.7215    0.00528 0.380 0.004 0.096 0.000 0.336 0.184
#> GSM617605     4  0.1265    0.81709 0.000 0.000 0.000 0.948 0.008 0.044
#> GSM617606     2  0.8410    0.26803 0.004 0.336 0.048 0.196 0.208 0.208
#> GSM617610     1  0.1141    0.64429 0.948 0.000 0.000 0.000 0.052 0.000
#> GSM617611     1  0.0291    0.64895 0.992 0.000 0.000 0.000 0.004 0.004
#> GSM617613     3  0.0146    0.54848 0.004 0.000 0.996 0.000 0.000 0.000
#> GSM617614     6  0.5100    0.63455 0.068 0.000 0.288 0.000 0.020 0.624
#> GSM617621     1  0.4444    0.29993 0.496 0.012 0.004 0.000 0.484 0.004
#> GSM617629     5  0.6374   -0.20312 0.004 0.008 0.332 0.000 0.400 0.256
#> GSM617630     5  0.7453    0.04132 0.000 0.236 0.264 0.000 0.360 0.140
#> GSM617631     3  0.3744    0.28304 0.000 0.000 0.756 0.000 0.044 0.200
#> GSM617633     1  0.5661    0.08287 0.488 0.000 0.020 0.000 0.400 0.092
#> GSM617642     6  0.4784    0.61808 0.048 0.000 0.316 0.000 0.012 0.624
#> GSM617645     2  0.0458    0.69778 0.000 0.984 0.000 0.000 0.000 0.016
#> GSM617646     1  0.3373    0.60054 0.808 0.020 0.004 0.000 0.160 0.008
#> GSM617652     1  0.6711    0.00129 0.420 0.004 0.084 0.000 0.384 0.108
#> GSM617655     3  0.3489    0.16291 0.000 0.000 0.708 0.000 0.004 0.288
#> GSM617656     3  0.0146    0.54919 0.000 0.000 0.996 0.000 0.004 0.000
#> GSM617657     3  0.0837    0.53831 0.000 0.000 0.972 0.004 0.004 0.020
#> GSM617658     6  0.5514    0.45313 0.000 0.000 0.272 0.000 0.176 0.552
#> GSM617659     1  0.1434    0.64694 0.940 0.000 0.000 0.000 0.012 0.048

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

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

collect_plots(res)

plot of chunk MAD-NMF-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.841           0.916       0.962         0.5000 0.503   0.503
#> 3 3 0.491           0.656       0.830         0.3382 0.748   0.535
#> 4 4 0.404           0.456       0.673         0.1185 0.850   0.587
#> 5 5 0.498           0.465       0.689         0.0652 0.890   0.607
#> 6 6 0.590           0.456       0.690         0.0402 0.926   0.675

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
#> GSM617581     2  0.4022     0.9033 0.080 0.920
#> GSM617582     1  0.9996     0.0813 0.512 0.488
#> GSM617588     2  0.0000     0.9796 0.000 1.000
#> GSM617590     2  0.0000     0.9796 0.000 1.000
#> GSM617592     2  0.0000     0.9796 0.000 1.000
#> GSM617607     1  0.0000     0.9452 1.000 0.000
#> GSM617608     1  0.0000     0.9452 1.000 0.000
#> GSM617609     1  0.0000     0.9452 1.000 0.000
#> GSM617612     1  0.2043     0.9298 0.968 0.032
#> GSM617615     2  0.0000     0.9796 0.000 1.000
#> GSM617616     1  0.5842     0.8453 0.860 0.140
#> GSM617617     2  0.0000     0.9796 0.000 1.000
#> GSM617618     1  0.6048     0.8296 0.852 0.148
#> GSM617619     2  0.8555     0.6056 0.280 0.720
#> GSM617620     2  0.0000     0.9796 0.000 1.000
#> GSM617622     2  0.0000     0.9796 0.000 1.000
#> GSM617623     2  0.1414     0.9648 0.020 0.980
#> GSM617624     2  0.2423     0.9468 0.040 0.960
#> GSM617625     1  0.0000     0.9452 1.000 0.000
#> GSM617626     2  0.0376     0.9773 0.004 0.996
#> GSM617627     2  0.0000     0.9796 0.000 1.000
#> GSM617628     1  0.0000     0.9452 1.000 0.000
#> GSM617632     1  0.2043     0.9296 0.968 0.032
#> GSM617634     2  0.1414     0.9651 0.020 0.980
#> GSM617635     1  0.0000     0.9452 1.000 0.000
#> GSM617636     1  0.0000     0.9452 1.000 0.000
#> GSM617637     1  0.6438     0.8154 0.836 0.164
#> GSM617638     2  0.6712     0.7826 0.176 0.824
#> GSM617639     1  0.1184     0.9384 0.984 0.016
#> GSM617640     2  0.0000     0.9796 0.000 1.000
#> GSM617641     2  0.0000     0.9796 0.000 1.000
#> GSM617643     2  0.0000     0.9796 0.000 1.000
#> GSM617644     2  0.0000     0.9796 0.000 1.000
#> GSM617647     2  0.0000     0.9796 0.000 1.000
#> GSM617648     2  0.0000     0.9796 0.000 1.000
#> GSM617649     2  0.0000     0.9796 0.000 1.000
#> GSM617650     1  0.0000     0.9452 1.000 0.000
#> GSM617651     1  0.0000     0.9452 1.000 0.000
#> GSM617653     1  0.4161     0.8933 0.916 0.084
#> GSM617654     2  0.0000     0.9796 0.000 1.000
#> GSM617583     1  0.0000     0.9452 1.000 0.000
#> GSM617584     2  0.0000     0.9796 0.000 1.000
#> GSM617585     2  0.0376     0.9773 0.004 0.996
#> GSM617586     1  0.0000     0.9452 1.000 0.000
#> GSM617587     1  0.2948     0.9181 0.948 0.052
#> GSM617589     2  0.0000     0.9796 0.000 1.000
#> GSM617591     2  0.0000     0.9796 0.000 1.000
#> GSM617593     1  0.0000     0.9452 1.000 0.000
#> GSM617594     2  0.0000     0.9796 0.000 1.000
#> GSM617595     1  0.4298     0.8900 0.912 0.088
#> GSM617596     1  0.0376     0.9438 0.996 0.004
#> GSM617597     1  0.0000     0.9452 1.000 0.000
#> GSM617598     1  0.0000     0.9452 1.000 0.000
#> GSM617599     2  0.0376     0.9773 0.004 0.996
#> GSM617600     1  0.0000     0.9452 1.000 0.000
#> GSM617601     2  0.0000     0.9796 0.000 1.000
#> GSM617602     1  0.0000     0.9452 1.000 0.000
#> GSM617603     2  0.0000     0.9796 0.000 1.000
#> GSM617604     1  0.0000     0.9452 1.000 0.000
#> GSM617605     2  0.0000     0.9796 0.000 1.000
#> GSM617606     2  0.0376     0.9772 0.004 0.996
#> GSM617610     1  0.7602     0.7427 0.780 0.220
#> GSM617611     1  0.0000     0.9452 1.000 0.000
#> GSM617613     1  0.0376     0.9437 0.996 0.004
#> GSM617614     1  0.0000     0.9452 1.000 0.000
#> GSM617621     1  0.0376     0.9438 0.996 0.004
#> GSM617629     1  0.5629     0.8446 0.868 0.132
#> GSM617630     1  0.6973     0.7750 0.812 0.188
#> GSM617631     1  0.0000     0.9452 1.000 0.000
#> GSM617633     1  0.0000     0.9452 1.000 0.000
#> GSM617642     1  0.0000     0.9452 1.000 0.000
#> GSM617645     2  0.0000     0.9796 0.000 1.000
#> GSM617646     1  0.3114     0.9150 0.944 0.056
#> GSM617652     1  0.0000     0.9452 1.000 0.000
#> GSM617655     1  0.0376     0.9438 0.996 0.004
#> GSM617656     1  0.0000     0.9452 1.000 0.000
#> GSM617657     1  0.9996     0.0588 0.512 0.488
#> GSM617658     1  0.0000     0.9452 1.000 0.000
#> GSM617659     1  0.0000     0.9452 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
#> GSM617581     1  0.6252     0.0138 0.556 0.444 0.000
#> GSM617582     1  0.9956     0.1318 0.380 0.312 0.308
#> GSM617588     2  0.3412     0.7833 0.124 0.876 0.000
#> GSM617590     2  0.1964     0.7730 0.000 0.944 0.056
#> GSM617592     2  0.3192     0.7884 0.112 0.888 0.000
#> GSM617607     3  0.6180     0.3036 0.416 0.000 0.584
#> GSM617608     3  0.5621     0.5499 0.308 0.000 0.692
#> GSM617609     3  0.1289     0.8180 0.000 0.032 0.968
#> GSM617612     1  0.1751     0.7561 0.960 0.012 0.028
#> GSM617615     2  0.0829     0.7921 0.012 0.984 0.004
#> GSM617616     1  0.1877     0.7482 0.956 0.032 0.012
#> GSM617617     2  0.6079     0.4675 0.388 0.612 0.000
#> GSM617618     1  0.5486     0.6553 0.780 0.024 0.196
#> GSM617619     3  0.6295     0.1851 0.000 0.472 0.528
#> GSM617620     2  0.2796     0.7948 0.092 0.908 0.000
#> GSM617622     2  0.2537     0.7979 0.080 0.920 0.000
#> GSM617623     1  0.5216     0.4761 0.740 0.260 0.000
#> GSM617624     2  0.5115     0.6695 0.016 0.796 0.188
#> GSM617625     3  0.2448     0.8009 0.076 0.000 0.924
#> GSM617626     1  0.4346     0.5954 0.816 0.184 0.000
#> GSM617627     2  0.1860     0.7752 0.000 0.948 0.052
#> GSM617628     3  0.1832     0.8184 0.036 0.008 0.956
#> GSM617632     1  0.3896     0.7119 0.864 0.008 0.128
#> GSM617634     2  0.4821     0.7691 0.120 0.840 0.040
#> GSM617635     1  0.4291     0.6621 0.820 0.000 0.180
#> GSM617636     3  0.4291     0.7234 0.180 0.000 0.820
#> GSM617637     1  0.1529     0.7370 0.960 0.040 0.000
#> GSM617638     2  0.6008     0.2964 0.000 0.628 0.372
#> GSM617639     1  0.1315     0.7547 0.972 0.008 0.020
#> GSM617640     2  0.5465     0.6459 0.288 0.712 0.000
#> GSM617641     2  0.1643     0.7973 0.044 0.956 0.000
#> GSM617643     2  0.4605     0.7330 0.204 0.796 0.000
#> GSM617644     2  0.2625     0.7969 0.084 0.916 0.000
#> GSM617647     1  0.6267    -0.0519 0.548 0.452 0.000
#> GSM617648     2  0.4887     0.7130 0.228 0.772 0.000
#> GSM617649     2  0.4540     0.7849 0.124 0.848 0.028
#> GSM617650     3  0.6062     0.3808 0.384 0.000 0.616
#> GSM617651     1  0.0747     0.7540 0.984 0.000 0.016
#> GSM617653     1  0.0747     0.7489 0.984 0.016 0.000
#> GSM617654     1  0.6295    -0.1276 0.528 0.472 0.000
#> GSM617583     3  0.1163     0.8169 0.028 0.000 0.972
#> GSM617584     2  0.5529     0.6340 0.296 0.704 0.000
#> GSM617585     2  0.5216     0.5551 0.000 0.740 0.260
#> GSM617586     3  0.1411     0.8175 0.000 0.036 0.964
#> GSM617587     3  0.1643     0.8167 0.000 0.044 0.956
#> GSM617589     2  0.2711     0.7944 0.088 0.912 0.000
#> GSM617591     2  0.3619     0.7180 0.000 0.864 0.136
#> GSM617593     1  0.6062     0.2935 0.616 0.000 0.384
#> GSM617594     2  0.6045     0.4938 0.380 0.620 0.000
#> GSM617595     1  0.0747     0.7488 0.984 0.016 0.000
#> GSM617596     1  0.5650     0.4708 0.688 0.000 0.312
#> GSM617597     3  0.2066     0.8065 0.060 0.000 0.940
#> GSM617598     1  0.3752     0.6920 0.856 0.000 0.144
#> GSM617599     2  0.6215     0.3836 0.428 0.572 0.000
#> GSM617600     3  0.2066     0.8094 0.000 0.060 0.940
#> GSM617601     2  0.1015     0.7896 0.008 0.980 0.012
#> GSM617602     3  0.1289     0.8184 0.000 0.032 0.968
#> GSM617603     2  0.1163     0.7827 0.000 0.972 0.028
#> GSM617604     3  0.4062     0.7306 0.164 0.000 0.836
#> GSM617605     2  0.1964     0.7730 0.000 0.944 0.056
#> GSM617606     2  0.3532     0.7451 0.008 0.884 0.108
#> GSM617610     1  0.1643     0.7344 0.956 0.044 0.000
#> GSM617611     1  0.5529     0.4965 0.704 0.000 0.296
#> GSM617613     3  0.4121     0.7498 0.000 0.168 0.832
#> GSM617614     3  0.1643     0.8115 0.044 0.000 0.956
#> GSM617621     1  0.2796     0.7342 0.908 0.000 0.092
#> GSM617629     3  0.4796     0.7035 0.000 0.220 0.780
#> GSM617630     3  0.4654     0.7156 0.000 0.208 0.792
#> GSM617631     3  0.2959     0.7912 0.000 0.100 0.900
#> GSM617633     3  0.4346     0.7177 0.184 0.000 0.816
#> GSM617642     3  0.0592     0.8189 0.012 0.000 0.988
#> GSM617645     2  0.5254     0.6746 0.264 0.736 0.000
#> GSM617646     1  0.3091     0.7498 0.912 0.016 0.072
#> GSM617652     3  0.2448     0.8005 0.076 0.000 0.924
#> GSM617655     3  0.3941     0.7583 0.000 0.156 0.844
#> GSM617656     3  0.0892     0.8191 0.000 0.020 0.980
#> GSM617657     3  0.5926     0.4855 0.000 0.356 0.644
#> GSM617658     3  0.0424     0.8189 0.008 0.000 0.992
#> GSM617659     3  0.5098     0.6348 0.248 0.000 0.752

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM617581     1   0.631     0.3151 0.604 0.068 0.004 0.324
#> GSM617582     1   0.963     0.1942 0.372 0.216 0.152 0.260
#> GSM617588     4   0.349     0.6302 0.044 0.092 0.000 0.864
#> GSM617590     4   0.194     0.6494 0.000 0.032 0.028 0.940
#> GSM617592     4   0.371     0.6148 0.112 0.040 0.000 0.848
#> GSM617607     2   0.790    -0.2502 0.300 0.372 0.328 0.000
#> GSM617608     3   0.678     0.4321 0.232 0.164 0.604 0.000
#> GSM617609     3   0.291     0.7114 0.000 0.092 0.888 0.020
#> GSM617612     1   0.788     0.4488 0.512 0.308 0.152 0.028
#> GSM617615     4   0.704     0.4018 0.028 0.348 0.068 0.556
#> GSM617616     1   0.540     0.4642 0.632 0.348 0.012 0.008
#> GSM617617     2   0.648     0.4616 0.088 0.576 0.000 0.336
#> GSM617618     1   0.763     0.3827 0.500 0.372 0.088 0.040
#> GSM617619     3   0.726     0.3231 0.000 0.204 0.540 0.256
#> GSM617620     4   0.308     0.6337 0.024 0.096 0.000 0.880
#> GSM617622     4   0.594     0.3882 0.044 0.268 0.016 0.672
#> GSM617623     1   0.596     0.4335 0.676 0.096 0.000 0.228
#> GSM617624     2   0.783     0.0868 0.024 0.424 0.132 0.420
#> GSM617625     3   0.557     0.6568 0.120 0.108 0.756 0.016
#> GSM617626     1   0.595     0.4806 0.692 0.184 0.000 0.124
#> GSM617627     4   0.703    -0.0954 0.000 0.404 0.120 0.476
#> GSM617628     3   0.536     0.6901 0.092 0.072 0.788 0.048
#> GSM617632     1   0.566     0.5530 0.732 0.188 0.064 0.016
#> GSM617634     2   0.731     0.2053 0.064 0.516 0.040 0.380
#> GSM617635     2   0.655     0.0784 0.276 0.608 0.116 0.000
#> GSM617636     1   0.787     0.1223 0.448 0.208 0.336 0.008
#> GSM617637     2   0.528    -0.1939 0.464 0.528 0.000 0.008
#> GSM617638     2   0.870     0.1213 0.056 0.428 0.192 0.324
#> GSM617639     1   0.522     0.3455 0.568 0.424 0.008 0.000
#> GSM617640     2   0.533     0.4084 0.016 0.604 0.000 0.380
#> GSM617641     4   0.200     0.6507 0.044 0.020 0.000 0.936
#> GSM617643     2   0.506     0.3944 0.008 0.624 0.000 0.368
#> GSM617644     4   0.478     0.2774 0.004 0.336 0.000 0.660
#> GSM617647     2   0.642     0.5096 0.152 0.648 0.000 0.200
#> GSM617648     2   0.551     0.2183 0.016 0.508 0.000 0.476
#> GSM617649     2   0.682     0.2763 0.004 0.512 0.088 0.396
#> GSM617650     3   0.661     0.2125 0.376 0.088 0.536 0.000
#> GSM617651     1   0.433     0.5430 0.712 0.288 0.000 0.000
#> GSM617653     1   0.310     0.5980 0.868 0.120 0.000 0.012
#> GSM617654     2   0.623     0.5209 0.124 0.660 0.000 0.216
#> GSM617583     3   0.579     0.6636 0.116 0.068 0.760 0.056
#> GSM617584     4   0.601     0.3924 0.268 0.080 0.000 0.652
#> GSM617585     4   0.519     0.5129 0.004 0.068 0.172 0.756
#> GSM617586     3   0.294     0.7246 0.024 0.032 0.908 0.036
#> GSM617587     3   0.388     0.7148 0.028 0.084 0.860 0.028
#> GSM617589     4   0.615     0.5171 0.088 0.244 0.004 0.664
#> GSM617591     4   0.745     0.4254 0.016 0.204 0.204 0.576
#> GSM617593     1   0.544     0.5588 0.732 0.092 0.176 0.000
#> GSM617594     2   0.645     0.4305 0.056 0.608 0.016 0.320
#> GSM617595     1   0.530     0.4757 0.612 0.372 0.016 0.000
#> GSM617596     1   0.430     0.5971 0.832 0.076 0.084 0.008
#> GSM617597     3   0.234     0.7128 0.080 0.008 0.912 0.000
#> GSM617598     1   0.417     0.6035 0.828 0.092 0.080 0.000
#> GSM617599     2   0.673     0.4536 0.112 0.564 0.000 0.324
#> GSM617600     3   0.235     0.7223 0.008 0.040 0.928 0.024
#> GSM617601     4   0.528     0.4704 0.000 0.252 0.044 0.704
#> GSM617602     3   0.657     0.6041 0.140 0.104 0.704 0.052
#> GSM617603     4   0.253     0.6438 0.008 0.072 0.008 0.912
#> GSM617604     1   0.744     0.1438 0.536 0.052 0.348 0.064
#> GSM617605     4   0.199     0.6528 0.020 0.024 0.012 0.944
#> GSM617606     4   0.507     0.5931 0.000 0.148 0.088 0.764
#> GSM617610     1   0.502     0.5074 0.656 0.332 0.000 0.012
#> GSM617611     1   0.792     0.3405 0.432 0.296 0.268 0.004
#> GSM617613     3   0.371     0.7101 0.008 0.052 0.864 0.076
#> GSM617614     3   0.294     0.7018 0.128 0.000 0.868 0.004
#> GSM617621     1   0.341     0.5967 0.876 0.088 0.024 0.012
#> GSM617629     3   0.882     0.3883 0.108 0.172 0.500 0.220
#> GSM617630     3   0.665     0.4919 0.004 0.236 0.628 0.132
#> GSM617631     3   0.395     0.7104 0.044 0.044 0.864 0.048
#> GSM617633     3   0.736     0.2807 0.176 0.332 0.492 0.000
#> GSM617642     3   0.417     0.6948 0.132 0.004 0.824 0.040
#> GSM617645     2   0.601     0.4589 0.028 0.632 0.020 0.320
#> GSM617646     2   0.588     0.0967 0.312 0.632 0.056 0.000
#> GSM617652     3   0.345     0.7073 0.080 0.052 0.868 0.000
#> GSM617655     3   0.337     0.7155 0.008 0.020 0.872 0.100
#> GSM617656     3   0.111     0.7247 0.016 0.008 0.972 0.004
#> GSM617657     3   0.727     0.4437 0.024 0.112 0.580 0.284
#> GSM617658     3   0.717     0.5145 0.252 0.092 0.616 0.040
#> GSM617659     3   0.527     0.4311 0.340 0.020 0.640 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
#> GSM617581     5  0.7397     0.1123 0.260 0.040 0.000 0.260 0.440
#> GSM617582     5  0.4322     0.5010 0.044 0.012 0.036 0.092 0.816
#> GSM617588     4  0.4117     0.6491 0.020 0.164 0.000 0.788 0.028
#> GSM617590     4  0.2728     0.6700 0.000 0.040 0.004 0.888 0.068
#> GSM617592     4  0.4758     0.6357 0.048 0.068 0.000 0.776 0.108
#> GSM617607     2  0.7627     0.1985 0.176 0.476 0.256 0.000 0.092
#> GSM617608     3  0.5837     0.4460 0.316 0.028 0.608 0.012 0.036
#> GSM617609     3  0.3007     0.6918 0.000 0.104 0.864 0.004 0.028
#> GSM617612     1  0.5885     0.4795 0.704 0.040 0.168 0.056 0.032
#> GSM617615     4  0.7950     0.3846 0.160 0.208 0.124 0.496 0.012
#> GSM617616     5  0.6389     0.1806 0.348 0.124 0.004 0.008 0.516
#> GSM617617     2  0.3103     0.6903 0.012 0.872 0.000 0.072 0.044
#> GSM617618     5  0.5725     0.4314 0.196 0.080 0.012 0.024 0.688
#> GSM617619     3  0.7338     0.3600 0.000 0.160 0.544 0.112 0.184
#> GSM617620     4  0.4221     0.6540 0.008 0.160 0.000 0.780 0.052
#> GSM617622     4  0.6667     0.4034 0.004 0.248 0.000 0.480 0.268
#> GSM617623     5  0.7398    -0.0253 0.356 0.044 0.000 0.196 0.404
#> GSM617624     2  0.5852     0.5895 0.000 0.688 0.056 0.108 0.148
#> GSM617625     3  0.5370     0.5642 0.256 0.000 0.668 0.048 0.028
#> GSM617626     1  0.7252     0.2576 0.480 0.088 0.000 0.104 0.328
#> GSM617627     2  0.5082     0.5959 0.000 0.732 0.096 0.152 0.020
#> GSM617628     3  0.5913     0.5677 0.208 0.000 0.648 0.120 0.024
#> GSM617632     5  0.4844     0.3440 0.236 0.036 0.008 0.008 0.712
#> GSM617634     5  0.6997     0.0162 0.020 0.340 0.004 0.172 0.464
#> GSM617635     2  0.4326     0.6139 0.080 0.776 0.140 0.000 0.004
#> GSM617636     5  0.3597     0.4984 0.052 0.024 0.076 0.000 0.848
#> GSM617637     2  0.5338     0.3484 0.308 0.632 0.004 0.008 0.048
#> GSM617638     2  0.6570     0.3060 0.000 0.504 0.056 0.068 0.372
#> GSM617639     2  0.6169    -0.0813 0.420 0.484 0.012 0.004 0.080
#> GSM617640     2  0.2102     0.6956 0.000 0.916 0.004 0.068 0.012
#> GSM617641     4  0.3879     0.6729 0.020 0.088 0.000 0.828 0.064
#> GSM617643     2  0.3334     0.6691 0.008 0.844 0.008 0.128 0.012
#> GSM617644     2  0.5960    -0.0322 0.028 0.468 0.000 0.456 0.048
#> GSM617647     2  0.1787     0.6982 0.032 0.940 0.000 0.016 0.012
#> GSM617648     2  0.6331     0.4045 0.016 0.584 0.000 0.232 0.168
#> GSM617649     2  0.4017     0.6634 0.000 0.812 0.056 0.116 0.016
#> GSM617650     3  0.6401     0.1843 0.352 0.044 0.532 0.000 0.072
#> GSM617651     1  0.3966     0.5867 0.836 0.076 0.020 0.012 0.056
#> GSM617653     1  0.5347     0.4809 0.680 0.020 0.004 0.052 0.244
#> GSM617654     2  0.1862     0.7017 0.016 0.940 0.004 0.012 0.028
#> GSM617583     3  0.5608     0.5859 0.200 0.004 0.680 0.100 0.016
#> GSM617584     4  0.6742     0.4033 0.140 0.060 0.000 0.588 0.212
#> GSM617585     4  0.5212     0.5339 0.000 0.020 0.060 0.692 0.228
#> GSM617586     3  0.1498     0.7218 0.024 0.008 0.952 0.016 0.000
#> GSM617587     3  0.3206     0.7087 0.024 0.060 0.876 0.036 0.004
#> GSM617589     4  0.5245     0.4571 0.296 0.016 0.008 0.652 0.028
#> GSM617591     4  0.7551     0.1910 0.108 0.088 0.332 0.464 0.008
#> GSM617593     1  0.7164     0.4816 0.564 0.096 0.116 0.004 0.220
#> GSM617594     2  0.3716     0.6821 0.036 0.844 0.048 0.072 0.000
#> GSM617595     1  0.4886     0.4885 0.736 0.200 0.036 0.016 0.012
#> GSM617596     5  0.5393     0.1175 0.356 0.008 0.012 0.028 0.596
#> GSM617597     3  0.1300     0.7189 0.028 0.000 0.956 0.000 0.016
#> GSM617598     1  0.4190     0.5610 0.768 0.000 0.060 0.000 0.172
#> GSM617599     2  0.4519     0.6548 0.052 0.784 0.000 0.128 0.036
#> GSM617600     3  0.1591     0.7127 0.000 0.004 0.940 0.004 0.052
#> GSM617601     4  0.6205     0.1481 0.004 0.412 0.084 0.488 0.012
#> GSM617602     5  0.4734     0.2772 0.008 0.000 0.344 0.016 0.632
#> GSM617603     4  0.4635     0.6181 0.004 0.064 0.004 0.748 0.180
#> GSM617604     5  0.6772     0.2013 0.284 0.008 0.048 0.096 0.564
#> GSM617605     4  0.3339     0.6549 0.000 0.040 0.000 0.836 0.124
#> GSM617606     4  0.5925     0.5864 0.136 0.040 0.024 0.708 0.092
#> GSM617610     1  0.3469     0.5779 0.856 0.088 0.012 0.008 0.036
#> GSM617611     1  0.5961    -0.0403 0.520 0.056 0.404 0.008 0.012
#> GSM617613     3  0.3646     0.6716 0.000 0.008 0.828 0.044 0.120
#> GSM617614     3  0.3622     0.6875 0.068 0.000 0.832 0.004 0.096
#> GSM617621     1  0.5788     0.1692 0.472 0.052 0.000 0.016 0.460
#> GSM617629     5  0.5601     0.4450 0.000 0.024 0.196 0.100 0.680
#> GSM617630     3  0.6770     0.2785 0.000 0.304 0.532 0.044 0.120
#> GSM617631     3  0.4229     0.5307 0.000 0.000 0.704 0.020 0.276
#> GSM617633     5  0.7601     0.1936 0.052 0.236 0.308 0.000 0.404
#> GSM617642     3  0.3738     0.7025 0.064 0.000 0.844 0.040 0.052
#> GSM617645     2  0.2061     0.7011 0.004 0.928 0.024 0.040 0.004
#> GSM617646     2  0.4023     0.6312 0.144 0.800 0.048 0.004 0.004
#> GSM617652     3  0.2787     0.7050 0.028 0.088 0.880 0.000 0.004
#> GSM617655     3  0.1857     0.7218 0.000 0.004 0.928 0.060 0.008
#> GSM617656     3  0.0963     0.7181 0.000 0.000 0.964 0.000 0.036
#> GSM617657     3  0.6394     0.1330 0.000 0.008 0.464 0.132 0.396
#> GSM617658     5  0.5073     0.4601 0.040 0.000 0.220 0.032 0.708
#> GSM617659     3  0.5951     0.1534 0.364 0.000 0.520 0.000 0.116

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>           class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM617581     1   0.467    0.36207 0.624 0.004 0.004 0.332 0.032 0.004
#> GSM617582     5   0.322    0.63808 0.060 0.000 0.000 0.020 0.848 0.072
#> GSM617588     4   0.378    0.49274 0.000 0.080 0.000 0.812 0.032 0.076
#> GSM617590     4   0.329    0.50610 0.000 0.024 0.020 0.860 0.052 0.044
#> GSM617592     4   0.317    0.50804 0.128 0.020 0.000 0.836 0.008 0.008
#> GSM617607     2   0.697    0.38217 0.120 0.556 0.188 0.000 0.096 0.040
#> GSM617608     3   0.691    0.31987 0.096 0.040 0.432 0.000 0.052 0.380
#> GSM617609     3   0.288    0.66694 0.000 0.152 0.832 0.000 0.008 0.008
#> GSM617612     1   0.702    0.32315 0.508 0.032 0.192 0.040 0.004 0.224
#> GSM617615     6   0.659    0.16181 0.000 0.080 0.084 0.340 0.012 0.484
#> GSM617616     5   0.558    0.51517 0.076 0.036 0.004 0.004 0.628 0.252
#> GSM617617     2   0.459    0.62028 0.012 0.764 0.000 0.060 0.116 0.048
#> GSM617618     5   0.340    0.63463 0.036 0.016 0.000 0.008 0.836 0.104
#> GSM617619     3   0.697    0.35851 0.000 0.148 0.536 0.128 0.172 0.016
#> GSM617620     4   0.225    0.54108 0.032 0.064 0.000 0.900 0.004 0.000
#> GSM617622     4   0.712    0.30723 0.068 0.156 0.000 0.536 0.188 0.052
#> GSM617623     1   0.439    0.47307 0.696 0.012 0.000 0.256 0.032 0.004
#> GSM617624     2   0.516    0.58334 0.000 0.704 0.040 0.076 0.168 0.012
#> GSM617625     3   0.429    0.60327 0.028 0.000 0.692 0.008 0.004 0.268
#> GSM617626     1   0.459    0.60033 0.780 0.040 0.000 0.084 0.048 0.048
#> GSM617627     2   0.492    0.55324 0.000 0.704 0.116 0.160 0.012 0.008
#> GSM617628     3   0.506    0.32797 0.016 0.000 0.480 0.032 0.004 0.468
#> GSM617632     5   0.457    0.42420 0.304 0.016 0.004 0.024 0.652 0.000
#> GSM617634     5   0.534    0.47164 0.004 0.108 0.000 0.032 0.668 0.188
#> GSM617635     2   0.414    0.62432 0.040 0.804 0.092 0.000 0.024 0.040
#> GSM617636     5   0.297    0.64393 0.116 0.012 0.024 0.000 0.848 0.000
#> GSM617637     2   0.557    0.44333 0.244 0.620 0.008 0.000 0.020 0.108
#> GSM617638     2   0.581    0.32810 0.008 0.552 0.028 0.052 0.348 0.012
#> GSM617639     2   0.533    0.16306 0.436 0.504 0.024 0.012 0.008 0.016
#> GSM617640     2   0.256    0.66225 0.008 0.880 0.004 0.096 0.004 0.008
#> GSM617641     4   0.162    0.54241 0.040 0.020 0.000 0.936 0.004 0.000
#> GSM617643     2   0.467    0.59825 0.000 0.744 0.000 0.104 0.048 0.104
#> GSM617644     6   0.763   -0.07087 0.000 0.292 0.000 0.180 0.228 0.300
#> GSM617647     2   0.349    0.66412 0.056 0.840 0.000 0.064 0.004 0.036
#> GSM617648     5   0.709   -0.10983 0.004 0.364 0.000 0.076 0.364 0.192
#> GSM617649     2   0.567    0.57680 0.000 0.684 0.084 0.148 0.044 0.040
#> GSM617650     3   0.606    0.40507 0.296 0.024 0.568 0.000 0.036 0.076
#> GSM617651     1   0.541    0.32784 0.496 0.032 0.008 0.000 0.032 0.432
#> GSM617653     1   0.281    0.62070 0.876 0.000 0.000 0.040 0.024 0.060
#> GSM617654     2   0.273    0.66866 0.028 0.892 0.000 0.036 0.024 0.020
#> GSM617583     3   0.457    0.63483 0.036 0.000 0.732 0.044 0.004 0.184
#> GSM617584     4   0.432    0.19038 0.380 0.008 0.000 0.600 0.008 0.004
#> GSM617585     4   0.631    0.12863 0.000 0.020 0.040 0.476 0.384 0.080
#> GSM617586     3   0.146    0.70887 0.000 0.020 0.948 0.016 0.000 0.016
#> GSM617587     3   0.237    0.69322 0.000 0.084 0.892 0.012 0.004 0.008
#> GSM617589     6   0.414    0.25869 0.004 0.000 0.016 0.284 0.008 0.688
#> GSM617591     4   0.637   -0.03059 0.000 0.040 0.376 0.452 0.004 0.128
#> GSM617593     1   0.473    0.54870 0.768 0.072 0.084 0.000 0.044 0.032
#> GSM617594     2   0.631    0.54599 0.008 0.636 0.056 0.136 0.028 0.136
#> GSM617595     6   0.657   -0.26174 0.372 0.164 0.032 0.000 0.008 0.424
#> GSM617596     1   0.422    0.42151 0.660 0.000 0.000 0.036 0.304 0.000
#> GSM617597     3   0.151    0.71433 0.016 0.012 0.948 0.000 0.020 0.004
#> GSM617598     1   0.518    0.48962 0.624 0.000 0.040 0.000 0.048 0.288
#> GSM617599     2   0.690    0.25704 0.004 0.476 0.004 0.064 0.180 0.272
#> GSM617600     3   0.220    0.70511 0.000 0.016 0.896 0.004 0.084 0.000
#> GSM617601     4   0.678    0.16867 0.000 0.252 0.084 0.532 0.020 0.112
#> GSM617602     5   0.309    0.60549 0.024 0.000 0.148 0.004 0.824 0.000
#> GSM617603     4   0.633    0.13113 0.000 0.032 0.000 0.492 0.280 0.196
#> GSM617604     1   0.485    0.56788 0.712 0.000 0.016 0.136 0.132 0.004
#> GSM617605     4   0.263    0.54058 0.028 0.016 0.008 0.896 0.048 0.004
#> GSM617606     6   0.662    0.13742 0.000 0.036 0.032 0.352 0.104 0.476
#> GSM617610     1   0.535    0.34564 0.536 0.044 0.016 0.000 0.012 0.392
#> GSM617611     3   0.695    0.28268 0.204 0.064 0.432 0.000 0.004 0.296
#> GSM617613     3   0.359    0.64945 0.000 0.012 0.796 0.024 0.164 0.004
#> GSM617614     3   0.377    0.69512 0.072 0.000 0.816 0.004 0.084 0.024
#> GSM617621     1   0.300    0.61409 0.860 0.016 0.004 0.092 0.028 0.000
#> GSM617629     5   0.176    0.64552 0.004 0.012 0.028 0.020 0.936 0.000
#> GSM617630     3   0.658   -0.00636 0.000 0.416 0.428 0.072 0.056 0.028
#> GSM617631     3   0.437    0.48890 0.004 0.000 0.664 0.024 0.300 0.008
#> GSM617633     5   0.473    0.58102 0.016 0.152 0.040 0.000 0.744 0.048
#> GSM617642     3   0.245    0.70993 0.044 0.000 0.904 0.020 0.016 0.016
#> GSM617645     2   0.344    0.65633 0.020 0.840 0.028 0.100 0.004 0.008
#> GSM617646     2   0.414    0.63350 0.072 0.796 0.048 0.000 0.004 0.080
#> GSM617652     3   0.294    0.68106 0.012 0.124 0.848 0.000 0.012 0.004
#> GSM617655     3   0.167    0.70810 0.000 0.000 0.936 0.036 0.020 0.008
#> GSM617656     3   0.115    0.71068 0.000 0.000 0.952 0.004 0.044 0.000
#> GSM617657     5   0.630    0.06569 0.000 0.036 0.396 0.084 0.464 0.020
#> GSM617658     5   0.501    0.54374 0.176 0.000 0.112 0.012 0.692 0.008
#> GSM617659     3   0.538    0.39800 0.328 0.000 0.580 0.000 0.048 0.044

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

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

collect_plots(res)

plot of chunk ATC-hclust-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.436           0.731       0.884         0.3241 0.739   0.739
#> 3 3 0.524           0.714       0.833         0.7938 0.631   0.520
#> 4 4 0.498           0.528       0.745         0.1802 0.823   0.608
#> 5 5 0.562           0.524       0.741         0.0986 0.822   0.487
#> 6 6 0.580           0.497       0.739         0.0282 0.982   0.919

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

suggest_best_k(res)
#> [1] 3

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

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

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>           class entropy silhouette    p1    p2
#> GSM617581     1   0.833     0.6426 0.736 0.264
#> GSM617582     1   0.760     0.6980 0.780 0.220
#> GSM617588     2   0.000     0.8319 0.000 1.000
#> GSM617590     2   0.311     0.8189 0.056 0.944
#> GSM617592     2   0.000     0.8319 0.000 1.000
#> GSM617607     1   0.000     0.8542 1.000 0.000
#> GSM617608     1   0.000     0.8542 1.000 0.000
#> GSM617609     1   0.000     0.8542 1.000 0.000
#> GSM617612     1   0.000     0.8542 1.000 0.000
#> GSM617615     1   0.978     0.3794 0.588 0.412
#> GSM617616     1   0.000     0.8542 1.000 0.000
#> GSM617617     1   0.895     0.5773 0.688 0.312
#> GSM617618     1   0.506     0.7895 0.888 0.112
#> GSM617619     1   0.745     0.7060 0.788 0.212
#> GSM617620     2   0.000     0.8319 0.000 1.000
#> GSM617622     1   0.987     0.3296 0.568 0.432
#> GSM617623     1   0.833     0.6426 0.736 0.264
#> GSM617624     1   0.634     0.7560 0.840 0.160
#> GSM617625     1   0.000     0.8542 1.000 0.000
#> GSM617626     1   0.000     0.8542 1.000 0.000
#> GSM617627     1   0.662     0.7449 0.828 0.172
#> GSM617628     1   0.000     0.8542 1.000 0.000
#> GSM617632     1   0.000     0.8542 1.000 0.000
#> GSM617634     1   0.518     0.7885 0.884 0.116
#> GSM617635     1   0.000     0.8542 1.000 0.000
#> GSM617636     1   0.000     0.8542 1.000 0.000
#> GSM617637     1   0.000     0.8542 1.000 0.000
#> GSM617638     1   0.584     0.7706 0.860 0.140
#> GSM617639     1   0.000     0.8542 1.000 0.000
#> GSM617640     1   0.917     0.5441 0.668 0.332
#> GSM617641     2   0.000     0.8319 0.000 1.000
#> GSM617643     1   0.990     0.3076 0.560 0.440
#> GSM617644     1   0.990     0.3076 0.560 0.440
#> GSM617647     1   0.990     0.3076 0.560 0.440
#> GSM617648     1   0.990     0.3076 0.560 0.440
#> GSM617649     1   0.990     0.3076 0.560 0.440
#> GSM617650     1   0.000     0.8542 1.000 0.000
#> GSM617651     1   0.000     0.8542 1.000 0.000
#> GSM617653     1   0.000     0.8542 1.000 0.000
#> GSM617654     1   0.917     0.5441 0.668 0.332
#> GSM617583     1   0.000     0.8542 1.000 0.000
#> GSM617584     2   0.844     0.6017 0.272 0.728
#> GSM617585     2   0.895     0.5398 0.312 0.688
#> GSM617586     1   0.000     0.8542 1.000 0.000
#> GSM617587     1   0.625     0.7596 0.844 0.156
#> GSM617589     2   0.000     0.8319 0.000 1.000
#> GSM617591     2   0.994     0.0897 0.456 0.544
#> GSM617593     1   0.000     0.8542 1.000 0.000
#> GSM617594     1   0.981     0.3601 0.580 0.420
#> GSM617595     1   0.000     0.8542 1.000 0.000
#> GSM617596     1   0.000     0.8542 1.000 0.000
#> GSM617597     1   0.000     0.8542 1.000 0.000
#> GSM617598     1   0.000     0.8542 1.000 0.000
#> GSM617599     1   0.981     0.3601 0.580 0.420
#> GSM617600     1   0.000     0.8542 1.000 0.000
#> GSM617601     1   0.969     0.4155 0.604 0.396
#> GSM617602     1   0.000     0.8542 1.000 0.000
#> GSM617603     2   0.000     0.8319 0.000 1.000
#> GSM617604     1   0.000     0.8542 1.000 0.000
#> GSM617605     2   0.311     0.8189 0.056 0.944
#> GSM617606     2   0.895     0.5398 0.312 0.688
#> GSM617610     1   0.000     0.8542 1.000 0.000
#> GSM617611     1   0.000     0.8542 1.000 0.000
#> GSM617613     1   0.000     0.8542 1.000 0.000
#> GSM617614     1   0.000     0.8542 1.000 0.000
#> GSM617621     1   0.000     0.8542 1.000 0.000
#> GSM617629     1   0.000     0.8542 1.000 0.000
#> GSM617630     1   0.871     0.6046 0.708 0.292
#> GSM617631     1   0.000     0.8542 1.000 0.000
#> GSM617633     1   0.000     0.8542 1.000 0.000
#> GSM617642     1   0.000     0.8542 1.000 0.000
#> GSM617645     1   0.917     0.5441 0.668 0.332
#> GSM617646     1   0.000     0.8542 1.000 0.000
#> GSM617652     1   0.000     0.8542 1.000 0.000
#> GSM617655     1   0.000     0.8542 1.000 0.000
#> GSM617656     1   0.000     0.8542 1.000 0.000
#> GSM617657     1   0.000     0.8542 1.000 0.000
#> GSM617658     1   0.000     0.8542 1.000 0.000
#> GSM617659     1   0.000     0.8542 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
#> GSM617581     2  0.2165     0.6727 0.064 0.936 0.000
#> GSM617582     2  0.8054     0.4813 0.356 0.568 0.076
#> GSM617588     3  0.0424     0.9801 0.000 0.008 0.992
#> GSM617590     3  0.2165     0.9370 0.000 0.064 0.936
#> GSM617592     3  0.0424     0.9801 0.000 0.008 0.992
#> GSM617607     1  0.0747     0.8511 0.984 0.016 0.000
#> GSM617608     1  0.0424     0.8503 0.992 0.008 0.000
#> GSM617609     1  0.0747     0.8511 0.984 0.016 0.000
#> GSM617612     1  0.5138     0.7304 0.748 0.252 0.000
#> GSM617615     2  0.5791     0.7312 0.060 0.792 0.148
#> GSM617616     1  0.0747     0.8511 0.984 0.016 0.000
#> GSM617617     2  0.5371     0.6986 0.140 0.812 0.048
#> GSM617618     1  0.6451     0.0587 0.560 0.436 0.004
#> GSM617619     2  0.7953     0.4623 0.368 0.564 0.068
#> GSM617620     3  0.0424     0.9801 0.000 0.008 0.992
#> GSM617622     2  0.5524     0.7259 0.040 0.796 0.164
#> GSM617623     2  0.2165     0.6727 0.064 0.936 0.000
#> GSM617624     2  0.6819     0.2100 0.476 0.512 0.012
#> GSM617625     1  0.1453     0.8416 0.968 0.024 0.008
#> GSM617626     1  0.5138     0.7304 0.748 0.252 0.000
#> GSM617627     2  0.6804     0.2659 0.460 0.528 0.012
#> GSM617628     1  0.1453     0.8416 0.968 0.024 0.008
#> GSM617632     1  0.1753     0.8479 0.952 0.048 0.000
#> GSM617634     1  0.6509    -0.0551 0.524 0.472 0.004
#> GSM617635     1  0.1860     0.8470 0.948 0.052 0.000
#> GSM617636     1  0.1753     0.8479 0.952 0.048 0.000
#> GSM617637     1  0.2066     0.8450 0.940 0.060 0.000
#> GSM617638     2  0.6314     0.3767 0.392 0.604 0.004
#> GSM617639     1  0.5138     0.7304 0.748 0.252 0.000
#> GSM617640     2  0.2749     0.7019 0.012 0.924 0.064
#> GSM617641     3  0.0424     0.9801 0.000 0.008 0.992
#> GSM617643     2  0.5412     0.7217 0.032 0.796 0.172
#> GSM617644     2  0.5412     0.7217 0.032 0.796 0.172
#> GSM617647     2  0.5412     0.7217 0.032 0.796 0.172
#> GSM617648     2  0.5412     0.7217 0.032 0.796 0.172
#> GSM617649     2  0.5412     0.7217 0.032 0.796 0.172
#> GSM617650     1  0.1411     0.8508 0.964 0.036 0.000
#> GSM617651     1  0.6244     0.4605 0.560 0.440 0.000
#> GSM617653     1  0.6244     0.4605 0.560 0.440 0.000
#> GSM617654     2  0.2749     0.7019 0.012 0.924 0.064
#> GSM617583     1  0.1453     0.8416 0.968 0.024 0.008
#> GSM617584     2  0.6664     0.3041 0.008 0.528 0.464
#> GSM617585     2  0.6771     0.3260 0.012 0.548 0.440
#> GSM617586     1  0.1878     0.8373 0.952 0.044 0.004
#> GSM617587     2  0.7021     0.3184 0.436 0.544 0.020
#> GSM617589     3  0.0424     0.9801 0.000 0.008 0.992
#> GSM617591     2  0.8028     0.5551 0.096 0.616 0.288
#> GSM617593     1  0.1411     0.8508 0.964 0.036 0.000
#> GSM617594     2  0.5852     0.7302 0.060 0.788 0.152
#> GSM617595     1  0.5138     0.7304 0.748 0.252 0.000
#> GSM617596     1  0.6244     0.4605 0.560 0.440 0.000
#> GSM617597     1  0.0983     0.8508 0.980 0.016 0.004
#> GSM617598     1  0.4974     0.7421 0.764 0.236 0.000
#> GSM617599     2  0.5852     0.7302 0.060 0.788 0.152
#> GSM617600     1  0.1453     0.8416 0.968 0.024 0.008
#> GSM617601     2  0.6286     0.7274 0.092 0.772 0.136
#> GSM617602     1  0.1453     0.8416 0.968 0.024 0.008
#> GSM617603     3  0.0424     0.9801 0.000 0.008 0.992
#> GSM617604     1  0.6244     0.4605 0.560 0.440 0.000
#> GSM617605     3  0.2165     0.9370 0.000 0.064 0.936
#> GSM617606     2  0.6771     0.3260 0.012 0.548 0.440
#> GSM617610     1  0.5138     0.7304 0.748 0.252 0.000
#> GSM617611     1  0.1411     0.8508 0.964 0.036 0.000
#> GSM617613     1  0.1453     0.8416 0.968 0.024 0.008
#> GSM617614     1  0.1031     0.8516 0.976 0.024 0.000
#> GSM617621     1  0.5138     0.7304 0.748 0.252 0.000
#> GSM617629     1  0.3965     0.7697 0.860 0.132 0.008
#> GSM617630     2  0.2903     0.7089 0.048 0.924 0.028
#> GSM617631     1  0.1453     0.8416 0.968 0.024 0.008
#> GSM617633     1  0.1163     0.8518 0.972 0.028 0.000
#> GSM617642     1  0.1411     0.8508 0.964 0.036 0.000
#> GSM617645     2  0.2749     0.7019 0.012 0.924 0.064
#> GSM617646     1  0.5138     0.7304 0.748 0.252 0.000
#> GSM617652     1  0.0747     0.8511 0.984 0.016 0.000
#> GSM617655     1  0.1453     0.8416 0.968 0.024 0.008
#> GSM617656     1  0.1453     0.8416 0.968 0.024 0.008
#> GSM617657     1  0.4531     0.7363 0.824 0.168 0.008
#> GSM617658     1  0.1453     0.8416 0.968 0.024 0.008
#> GSM617659     1  0.1411     0.8508 0.964 0.036 0.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM617581     1  0.4866    -0.3542 0.596 0.404 0.000 0.000
#> GSM617582     2  0.6505     0.4609 0.064 0.572 0.356 0.008
#> GSM617588     4  0.0592     0.8644 0.000 0.016 0.000 0.984
#> GSM617590     4  0.3311     0.7757 0.000 0.172 0.000 0.828
#> GSM617592     4  0.0592     0.8644 0.000 0.016 0.000 0.984
#> GSM617607     3  0.3498     0.6511 0.160 0.008 0.832 0.000
#> GSM617608     3  0.3172     0.6494 0.160 0.000 0.840 0.000
#> GSM617609     3  0.3498     0.6511 0.160 0.008 0.832 0.000
#> GSM617612     1  0.4406     0.6378 0.700 0.000 0.300 0.000
#> GSM617615     2  0.1762     0.7024 0.012 0.952 0.020 0.016
#> GSM617616     3  0.3498     0.6511 0.160 0.008 0.832 0.000
#> GSM617617     2  0.6198     0.6243 0.224 0.660 0.116 0.000
#> GSM617618     3  0.5805     0.0802 0.036 0.388 0.576 0.000
#> GSM617619     2  0.6290     0.4453 0.068 0.568 0.364 0.000
#> GSM617620     4  0.0592     0.8644 0.000 0.016 0.000 0.984
#> GSM617622     2  0.0844     0.6997 0.004 0.980 0.004 0.012
#> GSM617623     1  0.4866    -0.3542 0.596 0.404 0.000 0.000
#> GSM617624     3  0.5861    -0.2077 0.032 0.480 0.488 0.000
#> GSM617625     3  0.2530     0.6520 0.112 0.000 0.888 0.000
#> GSM617626     1  0.4406     0.6378 0.700 0.000 0.300 0.000
#> GSM617627     2  0.6149     0.1926 0.048 0.480 0.472 0.000
#> GSM617628     3  0.1940     0.6639 0.076 0.000 0.924 0.000
#> GSM617632     3  0.4981     0.2424 0.464 0.000 0.536 0.000
#> GSM617634     3  0.5738    -0.0654 0.028 0.432 0.540 0.000
#> GSM617635     3  0.4985     0.2261 0.468 0.000 0.532 0.000
#> GSM617636     3  0.4955     0.2811 0.444 0.000 0.556 0.000
#> GSM617637     3  0.4994     0.1853 0.480 0.000 0.520 0.000
#> GSM617638     2  0.7502     0.3501 0.188 0.456 0.356 0.000
#> GSM617639     1  0.4406     0.6378 0.700 0.000 0.300 0.000
#> GSM617640     2  0.4605     0.5862 0.336 0.664 0.000 0.000
#> GSM617641     4  0.0592     0.8644 0.000 0.016 0.000 0.984
#> GSM617643     2  0.0469     0.6965 0.000 0.988 0.000 0.012
#> GSM617644     2  0.0469     0.6965 0.000 0.988 0.000 0.012
#> GSM617647     2  0.0469     0.6965 0.000 0.988 0.000 0.012
#> GSM617648     2  0.0469     0.6965 0.000 0.988 0.000 0.012
#> GSM617649     2  0.0469     0.6965 0.000 0.988 0.000 0.012
#> GSM617650     3  0.4972     0.2609 0.456 0.000 0.544 0.000
#> GSM617651     1  0.2773     0.6341 0.880 0.004 0.116 0.000
#> GSM617653     1  0.2773     0.6341 0.880 0.004 0.116 0.000
#> GSM617654     2  0.4605     0.5862 0.336 0.664 0.000 0.000
#> GSM617583     3  0.2408     0.6524 0.104 0.000 0.896 0.000
#> GSM617584     4  0.7182    -0.1318 0.136 0.412 0.000 0.452
#> GSM617585     2  0.6937     0.2939 0.100 0.556 0.008 0.336
#> GSM617586     3  0.3080     0.6626 0.096 0.024 0.880 0.000
#> GSM617587     2  0.6285     0.2836 0.060 0.528 0.412 0.000
#> GSM617589     4  0.0707     0.8638 0.000 0.020 0.000 0.980
#> GSM617591     2  0.7704     0.5210 0.096 0.608 0.088 0.208
#> GSM617593     3  0.4972     0.2609 0.456 0.000 0.544 0.000
#> GSM617594     2  0.1471     0.7024 0.004 0.960 0.024 0.012
#> GSM617595     1  0.4406     0.6378 0.700 0.000 0.300 0.000
#> GSM617596     1  0.2773     0.6341 0.880 0.004 0.116 0.000
#> GSM617597     3  0.2973     0.6565 0.144 0.000 0.856 0.000
#> GSM617598     1  0.4500     0.5996 0.684 0.000 0.316 0.000
#> GSM617599     2  0.1471     0.7024 0.004 0.960 0.024 0.012
#> GSM617600     3  0.0336     0.6445 0.008 0.000 0.992 0.000
#> GSM617601     2  0.2522     0.6947 0.012 0.920 0.052 0.016
#> GSM617602     3  0.0000     0.6488 0.000 0.000 1.000 0.000
#> GSM617603     4  0.1940     0.8381 0.000 0.076 0.000 0.924
#> GSM617604     1  0.2773     0.6341 0.880 0.004 0.116 0.000
#> GSM617605     4  0.3311     0.7757 0.000 0.172 0.000 0.828
#> GSM617606     2  0.6937     0.2939 0.100 0.556 0.008 0.336
#> GSM617610     1  0.4406     0.6378 0.700 0.000 0.300 0.000
#> GSM617611     3  0.4972     0.2609 0.456 0.000 0.544 0.000
#> GSM617613     3  0.0469     0.6421 0.012 0.000 0.988 0.000
#> GSM617614     3  0.4624     0.4749 0.340 0.000 0.660 0.000
#> GSM617621     1  0.4406     0.6378 0.700 0.000 0.300 0.000
#> GSM617629     3  0.3099     0.5645 0.020 0.104 0.876 0.000
#> GSM617630     2  0.5495     0.5922 0.348 0.624 0.028 0.000
#> GSM617631     3  0.0592     0.6520 0.016 0.000 0.984 0.000
#> GSM617633     3  0.4304     0.5322 0.284 0.000 0.716 0.000
#> GSM617642     3  0.4605     0.4586 0.336 0.000 0.664 0.000
#> GSM617645     2  0.4605     0.5862 0.336 0.664 0.000 0.000
#> GSM617646     1  0.4406     0.6378 0.700 0.000 0.300 0.000
#> GSM617652     3  0.3591     0.6469 0.168 0.008 0.824 0.000
#> GSM617655     3  0.0188     0.6504 0.004 0.000 0.996 0.000
#> GSM617656     3  0.0336     0.6488 0.008 0.000 0.992 0.000
#> GSM617657     3  0.3925     0.4979 0.016 0.176 0.808 0.000
#> GSM617658     3  0.2149     0.6637 0.088 0.000 0.912 0.000
#> GSM617659     3  0.4972     0.2609 0.456 0.000 0.544 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
#> GSM617581     5  0.5117     0.5108 0.276 0.072 0.000 0.000 0.652
#> GSM617582     2  0.7787     0.1154 0.076 0.416 0.284 0.000 0.224
#> GSM617588     4  0.0162     0.8100 0.000 0.004 0.000 0.996 0.000
#> GSM617590     4  0.5067     0.6918 0.000 0.172 0.000 0.700 0.128
#> GSM617592     4  0.0162     0.8100 0.000 0.004 0.000 0.996 0.000
#> GSM617607     3  0.4088     0.4732 0.304 0.008 0.688 0.000 0.000
#> GSM617608     3  0.3816     0.4680 0.304 0.000 0.696 0.000 0.000
#> GSM617609     3  0.4088     0.4732 0.304 0.008 0.688 0.000 0.000
#> GSM617612     1  0.0000     0.7028 1.000 0.000 0.000 0.000 0.000
#> GSM617615     2  0.1405     0.7161 0.008 0.956 0.020 0.000 0.016
#> GSM617616     3  0.4088     0.4732 0.304 0.008 0.688 0.000 0.000
#> GSM617617     5  0.6794     0.2744 0.096 0.388 0.048 0.000 0.468
#> GSM617618     3  0.7292     0.1652 0.092 0.300 0.496 0.000 0.112
#> GSM617619     2  0.7816     0.1132 0.080 0.412 0.292 0.000 0.216
#> GSM617620     4  0.0162     0.8100 0.000 0.004 0.000 0.996 0.000
#> GSM617622     2  0.0486     0.7224 0.004 0.988 0.004 0.000 0.004
#> GSM617623     5  0.5117     0.5108 0.276 0.072 0.000 0.000 0.652
#> GSM617624     3  0.7336    -0.1163 0.084 0.400 0.408 0.000 0.108
#> GSM617625     3  0.2674     0.6535 0.120 0.000 0.868 0.000 0.012
#> GSM617626     1  0.0000     0.7028 1.000 0.000 0.000 0.000 0.000
#> GSM617627     3  0.7592    -0.1406 0.084 0.380 0.392 0.000 0.144
#> GSM617628     3  0.1965     0.6745 0.096 0.000 0.904 0.000 0.000
#> GSM617632     1  0.3752     0.5741 0.708 0.000 0.292 0.000 0.000
#> GSM617634     3  0.6898     0.0744 0.060 0.352 0.492 0.000 0.096
#> GSM617635     1  0.3730     0.5788 0.712 0.000 0.288 0.000 0.000
#> GSM617636     1  0.3999     0.5187 0.656 0.000 0.344 0.000 0.000
#> GSM617637     1  0.3534     0.6007 0.744 0.000 0.256 0.000 0.000
#> GSM617638     5  0.8219     0.0605 0.116 0.260 0.276 0.000 0.348
#> GSM617639     1  0.0000     0.7028 1.000 0.000 0.000 0.000 0.000
#> GSM617640     5  0.3582     0.6044 0.008 0.224 0.000 0.000 0.768
#> GSM617641     4  0.0162     0.8100 0.000 0.004 0.000 0.996 0.000
#> GSM617643     2  0.0000     0.7222 0.000 1.000 0.000 0.000 0.000
#> GSM617644     2  0.0000     0.7222 0.000 1.000 0.000 0.000 0.000
#> GSM617647     2  0.0000     0.7222 0.000 1.000 0.000 0.000 0.000
#> GSM617648     2  0.0000     0.7222 0.000 1.000 0.000 0.000 0.000
#> GSM617649     2  0.0000     0.7222 0.000 1.000 0.000 0.000 0.000
#> GSM617650     1  0.4015     0.5149 0.652 0.000 0.348 0.000 0.000
#> GSM617651     1  0.3177     0.5166 0.792 0.000 0.000 0.000 0.208
#> GSM617653     1  0.3177     0.5166 0.792 0.000 0.000 0.000 0.208
#> GSM617654     5  0.3612     0.6026 0.008 0.228 0.000 0.000 0.764
#> GSM617583     3  0.2574     0.6576 0.112 0.000 0.876 0.000 0.012
#> GSM617584     4  0.6161    -0.1371 0.020 0.076 0.000 0.464 0.440
#> GSM617585     5  0.6892     0.2387 0.004 0.312 0.008 0.212 0.464
#> GSM617586     3  0.3264     0.6653 0.132 0.024 0.840 0.000 0.004
#> GSM617587     2  0.7458     0.1375 0.100 0.436 0.356 0.000 0.108
#> GSM617589     4  0.1952     0.8000 0.000 0.004 0.000 0.912 0.084
#> GSM617591     2  0.8081    -0.2101 0.040 0.388 0.056 0.140 0.376
#> GSM617593     1  0.4015     0.5149 0.652 0.000 0.348 0.000 0.000
#> GSM617594     2  0.1200     0.7194 0.012 0.964 0.016 0.000 0.008
#> GSM617595     1  0.0000     0.7028 1.000 0.000 0.000 0.000 0.000
#> GSM617596     1  0.3177     0.5166 0.792 0.000 0.000 0.000 0.208
#> GSM617597     3  0.3336     0.5684 0.228 0.000 0.772 0.000 0.000
#> GSM617598     1  0.1792     0.6882 0.916 0.000 0.084 0.000 0.000
#> GSM617599     2  0.1314     0.7185 0.012 0.960 0.016 0.000 0.012
#> GSM617600     3  0.1043     0.6829 0.000 0.000 0.960 0.000 0.040
#> GSM617601     2  0.2213     0.6928 0.016 0.924 0.040 0.004 0.016
#> GSM617602     3  0.1251     0.6863 0.008 0.000 0.956 0.000 0.036
#> GSM617603     4  0.4038     0.7614 0.000 0.080 0.000 0.792 0.128
#> GSM617604     1  0.3177     0.5166 0.792 0.000 0.000 0.000 0.208
#> GSM617605     4  0.5067     0.6918 0.000 0.172 0.000 0.700 0.128
#> GSM617606     5  0.6892     0.2387 0.004 0.312 0.008 0.212 0.464
#> GSM617610     1  0.0000     0.7028 1.000 0.000 0.000 0.000 0.000
#> GSM617611     1  0.3949     0.5355 0.668 0.000 0.332 0.000 0.000
#> GSM617613     3  0.1121     0.6819 0.000 0.000 0.956 0.000 0.044
#> GSM617614     1  0.4304     0.1533 0.516 0.000 0.484 0.000 0.000
#> GSM617621     1  0.0000     0.7028 1.000 0.000 0.000 0.000 0.000
#> GSM617629     3  0.3154     0.6323 0.012 0.104 0.860 0.000 0.024
#> GSM617630     5  0.4210     0.6003 0.016 0.184 0.028 0.000 0.772
#> GSM617631     3  0.0703     0.6892 0.024 0.000 0.976 0.000 0.000
#> GSM617633     3  0.4294    -0.0863 0.468 0.000 0.532 0.000 0.000
#> GSM617642     1  0.4297     0.2258 0.528 0.000 0.472 0.000 0.000
#> GSM617645     5  0.3582     0.6044 0.008 0.224 0.000 0.000 0.768
#> GSM617646     1  0.0290     0.7047 0.992 0.000 0.008 0.000 0.000
#> GSM617652     3  0.4127     0.4581 0.312 0.008 0.680 0.000 0.000
#> GSM617655     3  0.1364     0.6867 0.012 0.000 0.952 0.000 0.036
#> GSM617656     3  0.1251     0.6861 0.008 0.000 0.956 0.000 0.036
#> GSM617657     3  0.4162     0.5126 0.000 0.176 0.768 0.000 0.056
#> GSM617658     3  0.2074     0.6698 0.104 0.000 0.896 0.000 0.000
#> GSM617659     1  0.4015     0.5149 0.652 0.000 0.348 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
#> GSM617581     5  0.4339     0.4851 0.256 0.000 0.000 0.016 0.696 0.032
#> GSM617582     2  0.8698     0.0858 0.076 0.328 0.252 0.020 0.216 0.108
#> GSM617588     6  0.3288     1.0000 0.000 0.000 0.000 0.276 0.000 0.724
#> GSM617590     4  0.3134     0.4627 0.000 0.144 0.000 0.820 0.000 0.036
#> GSM617592     6  0.3288     1.0000 0.000 0.000 0.000 0.276 0.000 0.724
#> GSM617607     3  0.3885     0.4299 0.300 0.000 0.684 0.000 0.004 0.012
#> GSM617608     3  0.3684     0.4272 0.300 0.000 0.692 0.000 0.004 0.004
#> GSM617609     3  0.3885     0.4299 0.300 0.000 0.684 0.000 0.004 0.012
#> GSM617612     1  0.0000     0.6960 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM617615     2  0.1425     0.7121 0.008 0.952 0.020 0.008 0.012 0.000
#> GSM617616     3  0.3885     0.4299 0.300 0.000 0.684 0.000 0.004 0.012
#> GSM617617     5  0.6364     0.2143 0.092 0.332 0.048 0.000 0.512 0.016
#> GSM617618     3  0.8150     0.1975 0.092 0.216 0.456 0.016 0.108 0.112
#> GSM617619     2  0.8606     0.0843 0.080 0.324 0.260 0.012 0.216 0.108
#> GSM617620     6  0.3288     1.0000 0.000 0.000 0.000 0.276 0.000 0.724
#> GSM617622     2  0.0436     0.7197 0.004 0.988 0.004 0.000 0.004 0.000
#> GSM617623     5  0.4339     0.4851 0.256 0.000 0.000 0.016 0.696 0.032
#> GSM617624     3  0.8348    -0.0523 0.084 0.320 0.368 0.024 0.104 0.100
#> GSM617625     3  0.3392     0.6298 0.116 0.000 0.832 0.008 0.028 0.016
#> GSM617626     1  0.0000     0.6960 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM617627     3  0.8435    -0.0780 0.084 0.312 0.360 0.024 0.128 0.092
#> GSM617628     3  0.2001     0.6472 0.092 0.000 0.900 0.004 0.004 0.000
#> GSM617632     1  0.3626     0.5890 0.704 0.000 0.288 0.000 0.004 0.004
#> GSM617634     3  0.7846     0.1160 0.060 0.272 0.448 0.012 0.096 0.112
#> GSM617635     1  0.3606     0.5931 0.708 0.000 0.284 0.000 0.004 0.004
#> GSM617636     1  0.3850     0.5378 0.652 0.000 0.340 0.000 0.004 0.004
#> GSM617637     1  0.3429     0.6120 0.740 0.000 0.252 0.000 0.004 0.004
#> GSM617638     5  0.8519     0.1189 0.112 0.176 0.236 0.012 0.376 0.088
#> GSM617639     1  0.0000     0.6960 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM617640     5  0.1663     0.5872 0.000 0.088 0.000 0.000 0.912 0.000
#> GSM617641     6  0.3288     1.0000 0.000 0.000 0.000 0.276 0.000 0.724
#> GSM617643     2  0.0000     0.7186 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM617644     2  0.0000     0.7186 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM617647     2  0.0000     0.7186 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM617648     2  0.0000     0.7186 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM617649     2  0.0000     0.7186 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM617650     1  0.3864     0.5323 0.648 0.000 0.344 0.000 0.004 0.004
#> GSM617651     1  0.3716     0.4782 0.780 0.000 0.000 0.016 0.176 0.028
#> GSM617653     1  0.3716     0.4782 0.780 0.000 0.000 0.016 0.176 0.028
#> GSM617654     5  0.3424     0.5613 0.000 0.096 0.000 0.000 0.812 0.092
#> GSM617583     3  0.3303     0.6337 0.108 0.000 0.840 0.008 0.028 0.016
#> GSM617584     5  0.5183    -0.0103 0.012 0.000 0.000 0.060 0.516 0.412
#> GSM617585     4  0.7420     0.2419 0.004 0.256 0.000 0.360 0.276 0.104
#> GSM617586     3  0.3242     0.6361 0.128 0.004 0.832 0.012 0.000 0.024
#> GSM617587     2  0.8273     0.0562 0.100 0.356 0.328 0.012 0.104 0.100
#> GSM617589     4  0.3789    -0.5096 0.000 0.000 0.000 0.584 0.000 0.416
#> GSM617591     2  0.8629    -0.1656 0.040 0.340 0.044 0.228 0.248 0.100
#> GSM617593     1  0.3864     0.5323 0.648 0.000 0.344 0.000 0.004 0.004
#> GSM617594     2  0.1078     0.7170 0.012 0.964 0.016 0.000 0.008 0.000
#> GSM617595     1  0.0000     0.6960 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM617596     1  0.3716     0.4782 0.780 0.000 0.000 0.016 0.176 0.028
#> GSM617597     3  0.2969     0.5351 0.224 0.000 0.776 0.000 0.000 0.000
#> GSM617598     1  0.1753     0.6863 0.912 0.000 0.084 0.000 0.000 0.004
#> GSM617599     2  0.1275     0.7156 0.012 0.956 0.016 0.000 0.016 0.000
#> GSM617600     3  0.2541     0.6456 0.000 0.000 0.892 0.024 0.052 0.032
#> GSM617601     2  0.2101     0.6902 0.016 0.920 0.040 0.016 0.000 0.008
#> GSM617602     3  0.2721     0.6527 0.008 0.000 0.888 0.024 0.052 0.028
#> GSM617603     4  0.1723     0.3426 0.000 0.036 0.000 0.928 0.000 0.036
#> GSM617604     1  0.3716     0.4782 0.780 0.000 0.000 0.016 0.176 0.028
#> GSM617605     4  0.3134     0.4627 0.000 0.144 0.000 0.820 0.000 0.036
#> GSM617606     4  0.7420     0.2419 0.004 0.256 0.000 0.360 0.276 0.104
#> GSM617610     1  0.0000     0.6960 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM617611     1  0.3805     0.5519 0.664 0.000 0.328 0.000 0.004 0.004
#> GSM617613     3  0.2614     0.6438 0.000 0.000 0.888 0.024 0.052 0.036
#> GSM617614     1  0.4126     0.1962 0.512 0.000 0.480 0.000 0.004 0.004
#> GSM617621     1  0.0000     0.6960 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM617629     3  0.4327     0.5977 0.012 0.044 0.796 0.020 0.024 0.104
#> GSM617630     5  0.3577     0.5575 0.004 0.048 0.020 0.000 0.824 0.104
#> GSM617631     3  0.0837     0.6642 0.020 0.000 0.972 0.004 0.004 0.000
#> GSM617633     3  0.4117    -0.1296 0.464 0.000 0.528 0.004 0.004 0.000
#> GSM617642     1  0.4120     0.2661 0.524 0.000 0.468 0.000 0.004 0.004
#> GSM617645     5  0.1663     0.5872 0.000 0.088 0.000 0.000 0.912 0.000
#> GSM617646     1  0.0260     0.6979 0.992 0.000 0.008 0.000 0.000 0.000
#> GSM617652     3  0.3921     0.4144 0.308 0.000 0.676 0.000 0.004 0.012
#> GSM617655     3  0.2674     0.6574 0.012 0.000 0.892 0.020 0.048 0.028
#> GSM617656     3  0.2574     0.6554 0.008 0.000 0.896 0.020 0.048 0.028
#> GSM617657     3  0.6258     0.4136 0.000 0.108 0.644 0.056 0.060 0.132
#> GSM617658     3  0.2101     0.6427 0.100 0.000 0.892 0.004 0.004 0.000
#> GSM617659     1  0.3864     0.5323 0.648 0.000 0.344 0.000 0.004 0.004

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

consensus_heatmap(res, k = 2)

plot of chunk tab-ATC-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) k
#> ATC:hclust 68           1.0000 2
#> ATC:hclust 64           0.0791 3
#> ATC:hclust 55           0.2346 4
#> ATC:hclust 58           0.0430 5
#> ATC:hclust 47           0.0188 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 21168 rows and 79 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 4.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

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

collect_plots(res)

plot of chunk ATC-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           0.979       0.991         0.4939 0.503   0.503
#> 3 3 0.523           0.703       0.794         0.2608 0.883   0.775
#> 4 4 0.921           0.905       0.939         0.1541 0.817   0.581
#> 5 5 0.745           0.655       0.802         0.0828 0.918   0.732
#> 6 6 0.728           0.618       0.760         0.0496 0.883   0.565

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
#> GSM617581     2   0.000      0.978 0.000 1.000
#> GSM617582     2   0.402      0.911 0.080 0.920
#> GSM617588     2   0.000      0.978 0.000 1.000
#> GSM617590     2   0.000      0.978 0.000 1.000
#> GSM617592     2   0.000      0.978 0.000 1.000
#> GSM617607     1   0.000      1.000 1.000 0.000
#> GSM617608     1   0.000      1.000 1.000 0.000
#> GSM617609     1   0.000      1.000 1.000 0.000
#> GSM617612     1   0.000      1.000 1.000 0.000
#> GSM617615     2   0.000      0.978 0.000 1.000
#> GSM617616     1   0.000      1.000 1.000 0.000
#> GSM617617     2   0.000      0.978 0.000 1.000
#> GSM617618     1   0.000      1.000 1.000 0.000
#> GSM617619     2   0.402      0.911 0.080 0.920
#> GSM617620     2   0.000      0.978 0.000 1.000
#> GSM617622     2   0.000      0.978 0.000 1.000
#> GSM617623     2   0.000      0.978 0.000 1.000
#> GSM617624     2   0.402      0.911 0.080 0.920
#> GSM617625     1   0.000      1.000 1.000 0.000
#> GSM617626     1   0.000      1.000 1.000 0.000
#> GSM617627     2   0.242      0.947 0.040 0.960
#> GSM617628     1   0.000      1.000 1.000 0.000
#> GSM617632     1   0.000      1.000 1.000 0.000
#> GSM617634     2   0.987      0.264 0.432 0.568
#> GSM617635     1   0.000      1.000 1.000 0.000
#> GSM617636     1   0.000      1.000 1.000 0.000
#> GSM617637     1   0.000      1.000 1.000 0.000
#> GSM617638     1   0.000      1.000 1.000 0.000
#> GSM617639     1   0.000      1.000 1.000 0.000
#> GSM617640     2   0.000      0.978 0.000 1.000
#> GSM617641     2   0.000      0.978 0.000 1.000
#> GSM617643     2   0.000      0.978 0.000 1.000
#> GSM617644     2   0.000      0.978 0.000 1.000
#> GSM617647     2   0.000      0.978 0.000 1.000
#> GSM617648     2   0.000      0.978 0.000 1.000
#> GSM617649     2   0.000      0.978 0.000 1.000
#> GSM617650     1   0.000      1.000 1.000 0.000
#> GSM617651     1   0.000      1.000 1.000 0.000
#> GSM617653     1   0.000      1.000 1.000 0.000
#> GSM617654     2   0.000      0.978 0.000 1.000
#> GSM617583     1   0.000      1.000 1.000 0.000
#> GSM617584     2   0.000      0.978 0.000 1.000
#> GSM617585     2   0.000      0.978 0.000 1.000
#> GSM617586     1   0.000      1.000 1.000 0.000
#> GSM617587     1   0.000      1.000 1.000 0.000
#> GSM617589     2   0.000      0.978 0.000 1.000
#> GSM617591     2   0.000      0.978 0.000 1.000
#> GSM617593     1   0.000      1.000 1.000 0.000
#> GSM617594     2   0.000      0.978 0.000 1.000
#> GSM617595     1   0.000      1.000 1.000 0.000
#> GSM617596     1   0.000      1.000 1.000 0.000
#> GSM617597     1   0.000      1.000 1.000 0.000
#> GSM617598     1   0.000      1.000 1.000 0.000
#> GSM617599     2   0.000      0.978 0.000 1.000
#> GSM617600     1   0.000      1.000 1.000 0.000
#> GSM617601     2   0.000      0.978 0.000 1.000
#> GSM617602     1   0.000      1.000 1.000 0.000
#> GSM617603     2   0.000      0.978 0.000 1.000
#> GSM617604     1   0.000      1.000 1.000 0.000
#> GSM617605     2   0.000      0.978 0.000 1.000
#> GSM617606     2   0.000      0.978 0.000 1.000
#> GSM617610     1   0.000      1.000 1.000 0.000
#> GSM617611     1   0.000      1.000 1.000 0.000
#> GSM617613     1   0.000      1.000 1.000 0.000
#> GSM617614     1   0.000      1.000 1.000 0.000
#> GSM617621     1   0.000      1.000 1.000 0.000
#> GSM617629     1   0.000      1.000 1.000 0.000
#> GSM617630     2   0.000      0.978 0.000 1.000
#> GSM617631     1   0.000      1.000 1.000 0.000
#> GSM617633     1   0.000      1.000 1.000 0.000
#> GSM617642     1   0.000      1.000 1.000 0.000
#> GSM617645     2   0.000      0.978 0.000 1.000
#> GSM617646     1   0.000      1.000 1.000 0.000
#> GSM617652     1   0.000      1.000 1.000 0.000
#> GSM617655     1   0.000      1.000 1.000 0.000
#> GSM617656     1   0.000      1.000 1.000 0.000
#> GSM617657     1   0.000      1.000 1.000 0.000
#> GSM617658     1   0.000      1.000 1.000 0.000
#> GSM617659     1   0.000      1.000 1.000 0.000

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>           class entropy silhouette    p1    p2    p3
#> GSM617581     2  0.5621      0.521 0.000 0.692 0.308
#> GSM617582     2  0.4555      0.651 0.200 0.800 0.000
#> GSM617588     3  0.5621      0.997 0.000 0.308 0.692
#> GSM617590     3  0.5621      0.997 0.000 0.308 0.692
#> GSM617592     3  0.5621      0.997 0.000 0.308 0.692
#> GSM617607     1  0.0000      0.799 1.000 0.000 0.000
#> GSM617608     1  0.0000      0.799 1.000 0.000 0.000
#> GSM617609     1  0.0424      0.796 0.992 0.008 0.000
#> GSM617612     1  0.9940      0.408 0.388 0.304 0.308
#> GSM617615     2  0.2356      0.711 0.000 0.928 0.072
#> GSM617616     1  0.0424      0.799 0.992 0.000 0.008
#> GSM617617     2  0.0747      0.745 0.000 0.984 0.016
#> GSM617618     1  0.6917      0.377 0.608 0.368 0.024
#> GSM617619     2  0.4605      0.647 0.204 0.796 0.000
#> GSM617620     3  0.5621      0.997 0.000 0.308 0.692
#> GSM617622     2  0.0592      0.745 0.000 0.988 0.012
#> GSM617623     2  0.5431      0.542 0.000 0.716 0.284
#> GSM617624     2  0.4555      0.651 0.200 0.800 0.000
#> GSM617625     1  0.0000      0.799 1.000 0.000 0.000
#> GSM617626     1  0.9898      0.436 0.404 0.288 0.308
#> GSM617627     2  0.4002      0.679 0.160 0.840 0.000
#> GSM617628     1  0.0000      0.799 1.000 0.000 0.000
#> GSM617632     1  0.5588      0.718 0.720 0.004 0.276
#> GSM617634     2  0.4931      0.637 0.212 0.784 0.004
#> GSM617635     1  0.0892      0.798 0.980 0.000 0.020
#> GSM617636     1  0.0000      0.799 1.000 0.000 0.000
#> GSM617637     1  0.7644      0.668 0.624 0.068 0.308
#> GSM617638     1  0.5597      0.641 0.764 0.216 0.020
#> GSM617639     1  0.7391      0.675 0.636 0.056 0.308
#> GSM617640     2  0.4974      0.413 0.000 0.764 0.236
#> GSM617641     3  0.5621      0.997 0.000 0.308 0.692
#> GSM617643     2  0.5138      0.368 0.000 0.748 0.252
#> GSM617644     2  0.5138      0.368 0.000 0.748 0.252
#> GSM617647     2  0.0592      0.745 0.000 0.988 0.012
#> GSM617648     2  0.2711      0.695 0.000 0.912 0.088
#> GSM617649     2  0.0237      0.746 0.000 0.996 0.004
#> GSM617650     1  0.3816      0.763 0.852 0.000 0.148
#> GSM617651     1  0.9963      0.383 0.376 0.316 0.308
#> GSM617653     1  0.9751      0.488 0.440 0.252 0.308
#> GSM617654     2  0.1163      0.738 0.000 0.972 0.028
#> GSM617583     1  0.0000      0.799 1.000 0.000 0.000
#> GSM617584     3  0.5733      0.974 0.000 0.324 0.676
#> GSM617585     2  0.2711      0.694 0.000 0.912 0.088
#> GSM617586     1  0.0424      0.796 0.992 0.008 0.000
#> GSM617587     2  0.7330      0.559 0.092 0.692 0.216
#> GSM617589     3  0.5621      0.997 0.000 0.308 0.692
#> GSM617591     2  0.2261      0.713 0.000 0.932 0.068
#> GSM617593     1  0.5763      0.716 0.716 0.008 0.276
#> GSM617594     2  0.0000      0.747 0.000 1.000 0.000
#> GSM617595     1  0.9771      0.483 0.436 0.256 0.308
#> GSM617596     1  0.9940      0.408 0.388 0.304 0.308
#> GSM617597     1  0.0000      0.799 1.000 0.000 0.000
#> GSM617598     1  0.5763      0.716 0.716 0.008 0.276
#> GSM617599     2  0.0000      0.747 0.000 1.000 0.000
#> GSM617600     1  0.0424      0.796 0.992 0.008 0.000
#> GSM617601     2  0.1267      0.747 0.024 0.972 0.004
#> GSM617602     1  0.0000      0.799 1.000 0.000 0.000
#> GSM617603     3  0.5621      0.997 0.000 0.308 0.692
#> GSM617604     1  0.9931      0.416 0.392 0.300 0.308
#> GSM617605     3  0.5621      0.997 0.000 0.308 0.692
#> GSM617606     2  0.2711      0.694 0.000 0.912 0.088
#> GSM617610     1  0.9940      0.408 0.388 0.304 0.308
#> GSM617611     1  0.5831      0.712 0.708 0.008 0.284
#> GSM617613     1  0.0424      0.796 0.992 0.008 0.000
#> GSM617614     1  0.1031      0.797 0.976 0.000 0.024
#> GSM617621     1  0.7876      0.660 0.612 0.080 0.308
#> GSM617629     1  0.0424      0.796 0.992 0.008 0.000
#> GSM617630     2  0.1315      0.748 0.020 0.972 0.008
#> GSM617631     1  0.0000      0.799 1.000 0.000 0.000
#> GSM617633     1  0.0000      0.799 1.000 0.000 0.000
#> GSM617642     1  0.0592      0.798 0.988 0.000 0.012
#> GSM617645     2  0.5327      0.301 0.000 0.728 0.272
#> GSM617646     1  0.9638      0.513 0.460 0.232 0.308
#> GSM617652     1  0.0592      0.798 0.988 0.000 0.012
#> GSM617655     1  0.0000      0.799 1.000 0.000 0.000
#> GSM617656     1  0.0000      0.799 1.000 0.000 0.000
#> GSM617657     2  0.6235      0.333 0.436 0.564 0.000
#> GSM617658     1  0.0000      0.799 1.000 0.000 0.000
#> GSM617659     1  0.3816      0.763 0.852 0.000 0.148

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM617581     1  0.1867      0.767 0.928 0.072 0.000 0.000
#> GSM617582     2  0.0657      0.938 0.012 0.984 0.004 0.000
#> GSM617588     4  0.0937      0.985 0.012 0.012 0.000 0.976
#> GSM617590     4  0.0657      0.985 0.004 0.012 0.000 0.984
#> GSM617592     4  0.0937      0.985 0.012 0.012 0.000 0.976
#> GSM617607     3  0.0188      0.978 0.000 0.004 0.996 0.000
#> GSM617608     3  0.0188      0.978 0.000 0.004 0.996 0.000
#> GSM617609     3  0.0336      0.977 0.000 0.008 0.992 0.000
#> GSM617612     1  0.1824      0.877 0.936 0.004 0.060 0.000
#> GSM617615     2  0.1256      0.942 0.028 0.964 0.000 0.008
#> GSM617616     3  0.1209      0.953 0.032 0.004 0.964 0.000
#> GSM617617     2  0.1389      0.939 0.048 0.952 0.000 0.000
#> GSM617618     2  0.6295      0.553 0.144 0.660 0.196 0.000
#> GSM617619     2  0.0657      0.938 0.012 0.984 0.004 0.000
#> GSM617620     4  0.0937      0.985 0.012 0.012 0.000 0.976
#> GSM617622     2  0.1118      0.942 0.036 0.964 0.000 0.000
#> GSM617623     1  0.1792      0.768 0.932 0.068 0.000 0.000
#> GSM617624     2  0.0524      0.938 0.008 0.988 0.004 0.000
#> GSM617625     3  0.0524      0.977 0.004 0.000 0.988 0.008
#> GSM617626     1  0.1716      0.878 0.936 0.000 0.064 0.000
#> GSM617627     2  0.0657      0.938 0.012 0.984 0.004 0.000
#> GSM617628     3  0.0524      0.978 0.000 0.004 0.988 0.008
#> GSM617632     1  0.4905      0.571 0.632 0.004 0.364 0.000
#> GSM617634     2  0.0524      0.938 0.008 0.988 0.004 0.000
#> GSM617635     3  0.1489      0.943 0.044 0.004 0.952 0.000
#> GSM617636     3  0.0376      0.977 0.004 0.004 0.992 0.000
#> GSM617637     1  0.1978      0.875 0.928 0.004 0.068 0.000
#> GSM617638     3  0.4234      0.794 0.132 0.052 0.816 0.000
#> GSM617639     1  0.1978      0.875 0.928 0.004 0.068 0.000
#> GSM617640     2  0.1545      0.940 0.040 0.952 0.000 0.008
#> GSM617641     4  0.0937      0.985 0.012 0.012 0.000 0.976
#> GSM617643     2  0.1256      0.942 0.028 0.964 0.000 0.008
#> GSM617644     2  0.1256      0.942 0.028 0.964 0.000 0.008
#> GSM617647     2  0.1118      0.941 0.036 0.964 0.000 0.000
#> GSM617648     2  0.1256      0.942 0.028 0.964 0.000 0.008
#> GSM617649     2  0.1022      0.942 0.032 0.968 0.000 0.000
#> GSM617650     3  0.0376      0.977 0.004 0.004 0.992 0.000
#> GSM617651     1  0.1743      0.873 0.940 0.004 0.056 0.000
#> GSM617653     1  0.1716      0.878 0.936 0.000 0.064 0.000
#> GSM617654     2  0.1302      0.940 0.044 0.956 0.000 0.000
#> GSM617583     3  0.0469      0.977 0.000 0.000 0.988 0.012
#> GSM617584     4  0.2699      0.919 0.028 0.068 0.000 0.904
#> GSM617585     2  0.0672      0.941 0.008 0.984 0.000 0.008
#> GSM617586     3  0.0657      0.975 0.000 0.004 0.984 0.012
#> GSM617587     2  0.3157      0.814 0.144 0.852 0.004 0.000
#> GSM617589     4  0.0657      0.985 0.004 0.012 0.000 0.984
#> GSM617591     2  0.0672      0.941 0.008 0.984 0.000 0.008
#> GSM617593     1  0.5112      0.420 0.560 0.004 0.436 0.000
#> GSM617594     2  0.1022      0.943 0.032 0.968 0.000 0.000
#> GSM617595     1  0.1902      0.878 0.932 0.004 0.064 0.000
#> GSM617596     1  0.1824      0.877 0.936 0.004 0.060 0.000
#> GSM617597     3  0.0188      0.978 0.000 0.004 0.996 0.000
#> GSM617598     1  0.5060      0.479 0.584 0.004 0.412 0.000
#> GSM617599     2  0.0921      0.942 0.028 0.972 0.000 0.000
#> GSM617600     3  0.0657      0.975 0.000 0.004 0.984 0.012
#> GSM617601     2  0.0524      0.938 0.008 0.988 0.004 0.000
#> GSM617602     3  0.0469      0.977 0.000 0.000 0.988 0.012
#> GSM617603     4  0.0657      0.985 0.004 0.012 0.000 0.984
#> GSM617604     1  0.1902      0.878 0.932 0.004 0.064 0.000
#> GSM617605     4  0.0657      0.985 0.004 0.012 0.000 0.984
#> GSM617606     2  0.0927      0.940 0.016 0.976 0.000 0.008
#> GSM617610     1  0.1824      0.877 0.936 0.004 0.060 0.000
#> GSM617611     1  0.4741      0.631 0.668 0.004 0.328 0.000
#> GSM617613     3  0.0657      0.975 0.000 0.004 0.984 0.012
#> GSM617614     3  0.0376      0.977 0.004 0.004 0.992 0.000
#> GSM617621     1  0.1716      0.878 0.936 0.000 0.064 0.000
#> GSM617629     3  0.1509      0.952 0.008 0.020 0.960 0.012
#> GSM617630     2  0.0707      0.941 0.020 0.980 0.000 0.000
#> GSM617631     3  0.0469      0.977 0.000 0.000 0.988 0.012
#> GSM617633     3  0.0188      0.978 0.000 0.000 0.996 0.004
#> GSM617642     3  0.0188      0.977 0.004 0.000 0.996 0.000
#> GSM617645     2  0.2224      0.926 0.040 0.928 0.000 0.032
#> GSM617646     1  0.1902      0.878 0.932 0.004 0.064 0.000
#> GSM617652     3  0.1398      0.945 0.040 0.004 0.956 0.000
#> GSM617655     3  0.0469      0.977 0.000 0.000 0.988 0.012
#> GSM617656     3  0.0469      0.977 0.000 0.000 0.988 0.012
#> GSM617657     2  0.5349      0.482 0.008 0.644 0.336 0.012
#> GSM617658     3  0.0188      0.978 0.000 0.004 0.996 0.000
#> GSM617659     3  0.0376      0.977 0.004 0.004 0.992 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
#> GSM617581     1  0.2520    0.84233 0.896 0.048 0.000 0.000 0.056
#> GSM617582     2  0.4235    0.61445 0.000 0.576 0.000 0.000 0.424
#> GSM617588     4  0.0000    0.96269 0.000 0.000 0.000 1.000 0.000
#> GSM617590     4  0.1410    0.95727 0.000 0.000 0.000 0.940 0.060
#> GSM617592     4  0.0000    0.96269 0.000 0.000 0.000 1.000 0.000
#> GSM617607     3  0.2179    0.60762 0.000 0.000 0.888 0.000 0.112
#> GSM617608     3  0.1410    0.62515 0.000 0.000 0.940 0.000 0.060
#> GSM617609     3  0.3684    0.57438 0.000 0.000 0.720 0.000 0.280
#> GSM617612     1  0.0324    0.91968 0.992 0.000 0.004 0.000 0.004
#> GSM617615     2  0.0000    0.76244 0.000 1.000 0.000 0.000 0.000
#> GSM617616     3  0.2864    0.59488 0.024 0.000 0.864 0.000 0.112
#> GSM617617     2  0.3196    0.71179 0.004 0.804 0.000 0.000 0.192
#> GSM617618     5  0.7301    0.14440 0.052 0.284 0.184 0.000 0.480
#> GSM617619     2  0.4235    0.61445 0.000 0.576 0.000 0.000 0.424
#> GSM617620     4  0.0290    0.96229 0.000 0.000 0.000 0.992 0.008
#> GSM617622     2  0.0703    0.75978 0.000 0.976 0.000 0.000 0.024
#> GSM617623     1  0.2729    0.83123 0.884 0.060 0.000 0.000 0.056
#> GSM617624     2  0.3876    0.63748 0.000 0.684 0.000 0.000 0.316
#> GSM617625     3  0.3534    0.59016 0.000 0.000 0.744 0.000 0.256
#> GSM617626     1  0.0324    0.91968 0.992 0.000 0.004 0.000 0.004
#> GSM617627     2  0.4126    0.63100 0.000 0.620 0.000 0.000 0.380
#> GSM617628     3  0.3661    0.58249 0.000 0.000 0.724 0.000 0.276
#> GSM617632     3  0.5230   -0.11938 0.452 0.000 0.504 0.000 0.044
#> GSM617634     2  0.3983    0.61082 0.000 0.660 0.000 0.000 0.340
#> GSM617635     3  0.2719    0.53435 0.068 0.000 0.884 0.000 0.048
#> GSM617636     3  0.0510    0.60871 0.000 0.000 0.984 0.000 0.016
#> GSM617637     1  0.3635    0.71001 0.748 0.000 0.248 0.000 0.004
#> GSM617638     5  0.5681    0.39789 0.044 0.024 0.360 0.000 0.572
#> GSM617639     1  0.3550    0.72518 0.760 0.000 0.236 0.000 0.004
#> GSM617640     2  0.3489    0.70080 0.004 0.784 0.000 0.004 0.208
#> GSM617641     4  0.0290    0.96229 0.000 0.000 0.000 0.992 0.008
#> GSM617643     2  0.0162    0.76185 0.000 0.996 0.000 0.000 0.004
#> GSM617644     2  0.0162    0.76185 0.000 0.996 0.000 0.000 0.004
#> GSM617647     2  0.0290    0.76091 0.000 0.992 0.000 0.000 0.008
#> GSM617648     2  0.0000    0.76244 0.000 1.000 0.000 0.000 0.000
#> GSM617649     2  0.0000    0.76244 0.000 1.000 0.000 0.000 0.000
#> GSM617650     3  0.0566    0.60676 0.012 0.000 0.984 0.000 0.004
#> GSM617651     1  0.0451    0.91881 0.988 0.000 0.004 0.000 0.008
#> GSM617653     1  0.0162    0.91897 0.996 0.000 0.004 0.000 0.000
#> GSM617654     2  0.3333    0.70295 0.004 0.788 0.000 0.000 0.208
#> GSM617583     3  0.3895    0.55675 0.000 0.000 0.680 0.000 0.320
#> GSM617584     4  0.2669    0.84853 0.000 0.104 0.000 0.876 0.020
#> GSM617585     2  0.4138    0.66681 0.000 0.616 0.000 0.000 0.384
#> GSM617586     3  0.3999    0.54506 0.000 0.000 0.656 0.000 0.344
#> GSM617587     2  0.5056    0.55502 0.044 0.596 0.000 0.000 0.360
#> GSM617589     4  0.0963    0.96166 0.000 0.000 0.000 0.964 0.036
#> GSM617591     2  0.3837    0.71155 0.000 0.692 0.000 0.000 0.308
#> GSM617593     3  0.4383    0.01520 0.424 0.000 0.572 0.000 0.004
#> GSM617594     2  0.0794    0.76007 0.000 0.972 0.000 0.000 0.028
#> GSM617595     1  0.0324    0.91771 0.992 0.000 0.004 0.000 0.004
#> GSM617596     1  0.0451    0.91881 0.988 0.000 0.004 0.000 0.008
#> GSM617597     3  0.2471    0.62341 0.000 0.000 0.864 0.000 0.136
#> GSM617598     3  0.4390    0.00316 0.428 0.000 0.568 0.000 0.004
#> GSM617599     2  0.0703    0.76112 0.000 0.976 0.000 0.000 0.024
#> GSM617600     3  0.4015    0.53427 0.000 0.000 0.652 0.000 0.348
#> GSM617601     2  0.3395    0.69433 0.000 0.764 0.000 0.000 0.236
#> GSM617602     3  0.3999    0.53879 0.000 0.000 0.656 0.000 0.344
#> GSM617603     4  0.1410    0.95903 0.000 0.000 0.000 0.940 0.060
#> GSM617604     1  0.0451    0.91881 0.988 0.000 0.004 0.000 0.008
#> GSM617605     4  0.1410    0.95727 0.000 0.000 0.000 0.940 0.060
#> GSM617606     2  0.4367    0.65047 0.004 0.580 0.000 0.000 0.416
#> GSM617610     1  0.0324    0.91968 0.992 0.000 0.004 0.000 0.004
#> GSM617611     3  0.4452   -0.21227 0.496 0.000 0.500 0.000 0.004
#> GSM617613     3  0.4015    0.53427 0.000 0.000 0.652 0.000 0.348
#> GSM617614     3  0.0000    0.61377 0.000 0.000 1.000 0.000 0.000
#> GSM617621     1  0.0162    0.91897 0.996 0.000 0.004 0.000 0.000
#> GSM617629     5  0.4219   -0.16318 0.000 0.000 0.416 0.000 0.584
#> GSM617630     2  0.4425    0.62420 0.004 0.544 0.000 0.000 0.452
#> GSM617631     3  0.3999    0.53688 0.000 0.000 0.656 0.000 0.344
#> GSM617633     3  0.2020    0.61103 0.000 0.000 0.900 0.000 0.100
#> GSM617642     3  0.0510    0.61914 0.000 0.000 0.984 0.000 0.016
#> GSM617645     2  0.3489    0.70080 0.004 0.784 0.000 0.004 0.208
#> GSM617646     1  0.2890    0.80065 0.836 0.000 0.160 0.000 0.004
#> GSM617652     3  0.2729    0.54981 0.056 0.000 0.884 0.000 0.060
#> GSM617655     3  0.3895    0.55675 0.000 0.000 0.680 0.000 0.320
#> GSM617656     3  0.3966    0.54488 0.000 0.000 0.664 0.000 0.336
#> GSM617657     5  0.4525    0.42692 0.000 0.220 0.056 0.000 0.724
#> GSM617658     3  0.3424    0.59254 0.000 0.000 0.760 0.000 0.240
#> GSM617659     3  0.0290    0.61114 0.008 0.000 0.992 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
#> GSM617581     1  0.1863     0.8423 0.920 0.000 0.044 0.000 0.036 0.000
#> GSM617582     5  0.3536     0.5579 0.000 0.252 0.008 0.000 0.736 0.004
#> GSM617588     4  0.0000     0.9025 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM617590     4  0.3494     0.8846 0.000 0.004 0.168 0.792 0.036 0.000
#> GSM617592     4  0.0000     0.9025 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM617607     6  0.2680     0.5842 0.000 0.000 0.056 0.000 0.076 0.868
#> GSM617608     6  0.2527     0.5596 0.000 0.000 0.084 0.000 0.040 0.876
#> GSM617609     6  0.5250    -0.4103 0.000 0.000 0.352 0.000 0.108 0.540
#> GSM617612     1  0.0000     0.8831 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM617615     2  0.0146     0.7649 0.000 0.996 0.000 0.000 0.004 0.000
#> GSM617616     6  0.2649     0.5956 0.004 0.000 0.052 0.000 0.068 0.876
#> GSM617617     2  0.4931     0.5023 0.000 0.636 0.116 0.000 0.248 0.000
#> GSM617618     5  0.5869     0.5250 0.020 0.100 0.056 0.000 0.652 0.172
#> GSM617619     5  0.3512     0.5602 0.000 0.248 0.008 0.000 0.740 0.004
#> GSM617620     4  0.0363     0.9018 0.000 0.000 0.012 0.988 0.000 0.000
#> GSM617622     2  0.1196     0.7380 0.000 0.952 0.008 0.000 0.040 0.000
#> GSM617623     1  0.2119     0.8364 0.912 0.008 0.044 0.000 0.036 0.000
#> GSM617624     5  0.4025     0.4564 0.000 0.416 0.008 0.000 0.576 0.000
#> GSM617625     3  0.3868     0.7926 0.000 0.000 0.508 0.000 0.000 0.492
#> GSM617626     1  0.0000     0.8831 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM617627     5  0.3563     0.5244 0.000 0.336 0.000 0.000 0.664 0.000
#> GSM617628     3  0.4256     0.8101 0.000 0.000 0.520 0.000 0.016 0.464
#> GSM617632     6  0.4810     0.4524 0.260 0.000 0.020 0.000 0.056 0.664
#> GSM617634     5  0.4237     0.4778 0.000 0.396 0.020 0.000 0.584 0.000
#> GSM617635     6  0.2463     0.6203 0.020 0.000 0.020 0.000 0.068 0.892
#> GSM617636     6  0.0790     0.6202 0.000 0.000 0.000 0.000 0.032 0.968
#> GSM617637     1  0.4378     0.4129 0.588 0.000 0.008 0.000 0.016 0.388
#> GSM617638     5  0.4975     0.4796 0.016 0.008 0.076 0.000 0.684 0.216
#> GSM617639     1  0.4099     0.4552 0.612 0.000 0.000 0.000 0.016 0.372
#> GSM617640     2  0.5080     0.4673 0.000 0.600 0.112 0.000 0.288 0.000
#> GSM617641     4  0.0363     0.9018 0.000 0.000 0.012 0.988 0.000 0.000
#> GSM617643     2  0.0146     0.7650 0.000 0.996 0.000 0.000 0.004 0.000
#> GSM617644     2  0.0146     0.7650 0.000 0.996 0.000 0.000 0.004 0.000
#> GSM617647     2  0.0717     0.7608 0.000 0.976 0.016 0.000 0.008 0.000
#> GSM617648     2  0.0000     0.7655 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM617649     2  0.0291     0.7648 0.000 0.992 0.004 0.000 0.004 0.000
#> GSM617650     6  0.1801     0.6018 0.004 0.000 0.056 0.000 0.016 0.924
#> GSM617651     1  0.0603     0.8809 0.980 0.000 0.016 0.000 0.004 0.000
#> GSM617653     1  0.0146     0.8830 0.996 0.000 0.004 0.000 0.000 0.000
#> GSM617654     2  0.5046     0.4776 0.000 0.608 0.112 0.000 0.280 0.000
#> GSM617583     3  0.3789     0.8887 0.000 0.000 0.584 0.000 0.000 0.416
#> GSM617584     4  0.3272     0.7598 0.000 0.144 0.020 0.820 0.016 0.000
#> GSM617585     5  0.5184     0.2903 0.000 0.316 0.112 0.000 0.572 0.000
#> GSM617586     3  0.4808     0.7600 0.000 0.000 0.536 0.000 0.056 0.408
#> GSM617587     5  0.5706     0.5067 0.028 0.324 0.036 0.000 0.576 0.036
#> GSM617589     4  0.2783     0.8943 0.000 0.000 0.148 0.836 0.016 0.000
#> GSM617591     5  0.5350     0.0447 0.000 0.416 0.108 0.000 0.476 0.000
#> GSM617593     6  0.3828     0.5121 0.252 0.000 0.008 0.000 0.016 0.724
#> GSM617594     2  0.1204     0.7305 0.000 0.944 0.000 0.000 0.056 0.000
#> GSM617595     1  0.0603     0.8783 0.980 0.000 0.004 0.000 0.016 0.000
#> GSM617596     1  0.0508     0.8810 0.984 0.000 0.012 0.000 0.004 0.000
#> GSM617597     6  0.3923    -0.4493 0.000 0.000 0.372 0.000 0.008 0.620
#> GSM617598     6  0.3875     0.5085 0.260 0.000 0.008 0.000 0.016 0.716
#> GSM617599     2  0.1141     0.7350 0.000 0.948 0.000 0.000 0.052 0.000
#> GSM617600     3  0.4110     0.8878 0.000 0.000 0.608 0.000 0.016 0.376
#> GSM617601     2  0.3547     0.1059 0.000 0.668 0.000 0.000 0.332 0.000
#> GSM617602     3  0.4076     0.8989 0.000 0.000 0.592 0.000 0.012 0.396
#> GSM617603     4  0.3376     0.8880 0.000 0.004 0.180 0.792 0.024 0.000
#> GSM617604     1  0.0508     0.8810 0.984 0.000 0.012 0.000 0.004 0.000
#> GSM617605     4  0.3494     0.8846 0.000 0.004 0.168 0.792 0.036 0.000
#> GSM617606     5  0.5276     0.1919 0.000 0.312 0.124 0.000 0.564 0.000
#> GSM617610     1  0.0000     0.8831 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM617611     6  0.4078     0.4267 0.300 0.000 0.008 0.000 0.016 0.676
#> GSM617613     3  0.4110     0.8878 0.000 0.000 0.608 0.000 0.016 0.376
#> GSM617614     6  0.1204     0.5998 0.000 0.000 0.056 0.000 0.000 0.944
#> GSM617621     1  0.0632     0.8756 0.976 0.000 0.000 0.000 0.000 0.024
#> GSM617629     5  0.5683     0.1349 0.000 0.000 0.308 0.000 0.508 0.184
#> GSM617630     5  0.4888     0.3237 0.000 0.240 0.116 0.000 0.644 0.000
#> GSM617631     3  0.4150     0.8955 0.000 0.000 0.592 0.000 0.016 0.392
#> GSM617633     6  0.3102     0.4533 0.000 0.000 0.156 0.000 0.028 0.816
#> GSM617642     6  0.2135     0.5141 0.000 0.000 0.128 0.000 0.000 0.872
#> GSM617645     2  0.5080     0.4673 0.000 0.600 0.112 0.000 0.288 0.000
#> GSM617646     1  0.4014     0.6092 0.704 0.000 0.012 0.000 0.016 0.268
#> GSM617652     6  0.2507     0.6118 0.016 0.000 0.036 0.000 0.056 0.892
#> GSM617655     3  0.3789     0.8887 0.000 0.000 0.584 0.000 0.000 0.416
#> GSM617656     3  0.3737     0.8960 0.000 0.000 0.608 0.000 0.000 0.392
#> GSM617657     5  0.5508     0.5020 0.000 0.096 0.276 0.000 0.600 0.028
#> GSM617658     6  0.4823    -0.5708 0.000 0.000 0.388 0.000 0.060 0.552
#> GSM617659     6  0.1349     0.6020 0.004 0.000 0.056 0.000 0.000 0.940

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) k
#> ATC:kmeans 78           0.0667 2
#> ATC:kmeans 65           0.1640 3
#> ATC:kmeans 76           0.3201 4
#> ATC:kmeans 71           0.3510 5
#> ATC:kmeans 59           0.1650 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 21168 rows and 79 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 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-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.993       0.997         0.5004 0.500   0.500
#> 3 3 1.000           0.947       0.979         0.3066 0.803   0.621
#> 4 4 0.881           0.827       0.929         0.1135 0.875   0.660
#> 5 5 0.717           0.589       0.791         0.0635 0.958   0.852
#> 6 6 0.691           0.603       0.753         0.0430 0.896   0.624

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
#> GSM617581     2   0.000      0.997 0.000 1.000
#> GSM617582     2   0.000      0.997 0.000 1.000
#> GSM617588     2   0.000      0.997 0.000 1.000
#> GSM617590     2   0.000      0.997 0.000 1.000
#> GSM617592     2   0.000      0.997 0.000 1.000
#> GSM617607     1   0.000      0.997 1.000 0.000
#> GSM617608     1   0.000      0.997 1.000 0.000
#> GSM617609     1   0.000      0.997 1.000 0.000
#> GSM617612     1   0.000      0.997 1.000 0.000
#> GSM617615     2   0.000      0.997 0.000 1.000
#> GSM617616     1   0.000      0.997 1.000 0.000
#> GSM617617     2   0.000      0.997 0.000 1.000
#> GSM617618     1   0.000      0.997 1.000 0.000
#> GSM617619     2   0.000      0.997 0.000 1.000
#> GSM617620     2   0.000      0.997 0.000 1.000
#> GSM617622     2   0.000      0.997 0.000 1.000
#> GSM617623     2   0.000      0.997 0.000 1.000
#> GSM617624     2   0.000      0.997 0.000 1.000
#> GSM617625     1   0.000      0.997 1.000 0.000
#> GSM617626     1   0.000      0.997 1.000 0.000
#> GSM617627     2   0.000      0.997 0.000 1.000
#> GSM617628     1   0.000      0.997 1.000 0.000
#> GSM617632     1   0.000      0.997 1.000 0.000
#> GSM617634     2   0.000      0.997 0.000 1.000
#> GSM617635     1   0.000      0.997 1.000 0.000
#> GSM617636     1   0.000      0.997 1.000 0.000
#> GSM617637     1   0.000      0.997 1.000 0.000
#> GSM617638     1   0.000      0.997 1.000 0.000
#> GSM617639     1   0.000      0.997 1.000 0.000
#> GSM617640     2   0.000      0.997 0.000 1.000
#> GSM617641     2   0.000      0.997 0.000 1.000
#> GSM617643     2   0.000      0.997 0.000 1.000
#> GSM617644     2   0.000      0.997 0.000 1.000
#> GSM617647     2   0.000      0.997 0.000 1.000
#> GSM617648     2   0.000      0.997 0.000 1.000
#> GSM617649     2   0.000      0.997 0.000 1.000
#> GSM617650     1   0.000      0.997 1.000 0.000
#> GSM617651     1   0.000      0.997 1.000 0.000
#> GSM617653     1   0.000      0.997 1.000 0.000
#> GSM617654     2   0.000      0.997 0.000 1.000
#> GSM617583     1   0.000      0.997 1.000 0.000
#> GSM617584     2   0.000      0.997 0.000 1.000
#> GSM617585     2   0.000      0.997 0.000 1.000
#> GSM617586     1   0.000      0.997 1.000 0.000
#> GSM617587     1   0.595      0.832 0.856 0.144
#> GSM617589     2   0.000      0.997 0.000 1.000
#> GSM617591     2   0.000      0.997 0.000 1.000
#> GSM617593     1   0.000      0.997 1.000 0.000
#> GSM617594     2   0.000      0.997 0.000 1.000
#> GSM617595     1   0.000      0.997 1.000 0.000
#> GSM617596     1   0.000      0.997 1.000 0.000
#> GSM617597     1   0.000      0.997 1.000 0.000
#> GSM617598     1   0.000      0.997 1.000 0.000
#> GSM617599     2   0.000      0.997 0.000 1.000
#> GSM617600     1   0.000      0.997 1.000 0.000
#> GSM617601     2   0.000      0.997 0.000 1.000
#> GSM617602     1   0.000      0.997 1.000 0.000
#> GSM617603     2   0.000      0.997 0.000 1.000
#> GSM617604     1   0.000      0.997 1.000 0.000
#> GSM617605     2   0.000      0.997 0.000 1.000
#> GSM617606     2   0.000      0.997 0.000 1.000
#> GSM617610     1   0.000      0.997 1.000 0.000
#> GSM617611     1   0.000      0.997 1.000 0.000
#> GSM617613     1   0.000      0.997 1.000 0.000
#> GSM617614     1   0.000      0.997 1.000 0.000
#> GSM617621     1   0.000      0.997 1.000 0.000
#> GSM617629     1   0.000      0.997 1.000 0.000
#> GSM617630     2   0.000      0.997 0.000 1.000
#> GSM617631     1   0.000      0.997 1.000 0.000
#> GSM617633     1   0.000      0.997 1.000 0.000
#> GSM617642     1   0.000      0.997 1.000 0.000
#> GSM617645     2   0.000      0.997 0.000 1.000
#> GSM617646     1   0.000      0.997 1.000 0.000
#> GSM617652     1   0.000      0.997 1.000 0.000
#> GSM617655     1   0.000      0.997 1.000 0.000
#> GSM617656     1   0.000      0.997 1.000 0.000
#> GSM617657     2   0.518      0.869 0.116 0.884
#> GSM617658     1   0.000      0.997 1.000 0.000
#> GSM617659     1   0.000      0.997 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
#> GSM617581     1  0.0237      0.922 0.996 0.004 0.000
#> GSM617582     2  0.0237      0.996 0.000 0.996 0.004
#> GSM617588     2  0.0000      0.999 0.000 1.000 0.000
#> GSM617590     2  0.0000      0.999 0.000 1.000 0.000
#> GSM617592     2  0.0000      0.999 0.000 1.000 0.000
#> GSM617607     3  0.0000      0.983 0.000 0.000 1.000
#> GSM617608     3  0.0000      0.983 0.000 0.000 1.000
#> GSM617609     3  0.0000      0.983 0.000 0.000 1.000
#> GSM617612     1  0.0000      0.924 1.000 0.000 0.000
#> GSM617615     2  0.0000      0.999 0.000 1.000 0.000
#> GSM617616     3  0.0000      0.983 0.000 0.000 1.000
#> GSM617617     2  0.0000      0.999 0.000 1.000 0.000
#> GSM617618     3  0.0000      0.983 0.000 0.000 1.000
#> GSM617619     2  0.0424      0.992 0.000 0.992 0.008
#> GSM617620     2  0.0000      0.999 0.000 1.000 0.000
#> GSM617622     2  0.0000      0.999 0.000 1.000 0.000
#> GSM617623     1  0.0747      0.913 0.984 0.016 0.000
#> GSM617624     2  0.0237      0.996 0.000 0.996 0.004
#> GSM617625     3  0.0000      0.983 0.000 0.000 1.000
#> GSM617626     1  0.0000      0.924 1.000 0.000 0.000
#> GSM617627     2  0.0000      0.999 0.000 1.000 0.000
#> GSM617628     3  0.0000      0.983 0.000 0.000 1.000
#> GSM617632     3  0.6126      0.233 0.400 0.000 0.600
#> GSM617634     2  0.0424      0.992 0.000 0.992 0.008
#> GSM617635     3  0.0237      0.979 0.004 0.000 0.996
#> GSM617636     3  0.0000      0.983 0.000 0.000 1.000
#> GSM617637     1  0.0000      0.924 1.000 0.000 0.000
#> GSM617638     3  0.0000      0.983 0.000 0.000 1.000
#> GSM617639     1  0.0000      0.924 1.000 0.000 0.000
#> GSM617640     2  0.0000      0.999 0.000 1.000 0.000
#> GSM617641     2  0.0000      0.999 0.000 1.000 0.000
#> GSM617643     2  0.0000      0.999 0.000 1.000 0.000
#> GSM617644     2  0.0000      0.999 0.000 1.000 0.000
#> GSM617647     2  0.0000      0.999 0.000 1.000 0.000
#> GSM617648     2  0.0000      0.999 0.000 1.000 0.000
#> GSM617649     2  0.0000      0.999 0.000 1.000 0.000
#> GSM617650     3  0.0592      0.972 0.012 0.000 0.988
#> GSM617651     1  0.0000      0.924 1.000 0.000 0.000
#> GSM617653     1  0.0000      0.924 1.000 0.000 0.000
#> GSM617654     2  0.0000      0.999 0.000 1.000 0.000
#> GSM617583     3  0.0000      0.983 0.000 0.000 1.000
#> GSM617584     2  0.0000      0.999 0.000 1.000 0.000
#> GSM617585     2  0.0000      0.999 0.000 1.000 0.000
#> GSM617586     3  0.0000      0.983 0.000 0.000 1.000
#> GSM617587     1  0.2845      0.871 0.920 0.012 0.068
#> GSM617589     2  0.0000      0.999 0.000 1.000 0.000
#> GSM617591     2  0.0000      0.999 0.000 1.000 0.000
#> GSM617593     1  0.6026      0.455 0.624 0.000 0.376
#> GSM617594     2  0.0000      0.999 0.000 1.000 0.000
#> GSM617595     1  0.0000      0.924 1.000 0.000 0.000
#> GSM617596     1  0.0000      0.924 1.000 0.000 0.000
#> GSM617597     3  0.0000      0.983 0.000 0.000 1.000
#> GSM617598     1  0.6026      0.455 0.624 0.000 0.376
#> GSM617599     2  0.0000      0.999 0.000 1.000 0.000
#> GSM617600     3  0.0000      0.983 0.000 0.000 1.000
#> GSM617601     2  0.0000      0.999 0.000 1.000 0.000
#> GSM617602     3  0.0000      0.983 0.000 0.000 1.000
#> GSM617603     2  0.0000      0.999 0.000 1.000 0.000
#> GSM617604     1  0.0000      0.924 1.000 0.000 0.000
#> GSM617605     2  0.0000      0.999 0.000 1.000 0.000
#> GSM617606     2  0.0000      0.999 0.000 1.000 0.000
#> GSM617610     1  0.0000      0.924 1.000 0.000 0.000
#> GSM617611     1  0.6008      0.463 0.628 0.000 0.372
#> GSM617613     3  0.0000      0.983 0.000 0.000 1.000
#> GSM617614     3  0.0000      0.983 0.000 0.000 1.000
#> GSM617621     1  0.0000      0.924 1.000 0.000 0.000
#> GSM617629     3  0.0000      0.983 0.000 0.000 1.000
#> GSM617630     2  0.0000      0.999 0.000 1.000 0.000
#> GSM617631     3  0.0000      0.983 0.000 0.000 1.000
#> GSM617633     3  0.0000      0.983 0.000 0.000 1.000
#> GSM617642     3  0.0000      0.983 0.000 0.000 1.000
#> GSM617645     2  0.0000      0.999 0.000 1.000 0.000
#> GSM617646     1  0.0000      0.924 1.000 0.000 0.000
#> GSM617652     3  0.0000      0.983 0.000 0.000 1.000
#> GSM617655     3  0.0000      0.983 0.000 0.000 1.000
#> GSM617656     3  0.0000      0.983 0.000 0.000 1.000
#> GSM617657     3  0.0237      0.979 0.000 0.004 0.996
#> GSM617658     3  0.0000      0.983 0.000 0.000 1.000
#> GSM617659     3  0.0592      0.972 0.012 0.000 0.988

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM617581     1  0.2281     0.8130 0.904 0.096 0.000 0.000
#> GSM617582     4  0.0707     0.7704 0.000 0.020 0.000 0.980
#> GSM617588     2  0.0000     0.9504 0.000 1.000 0.000 0.000
#> GSM617590     2  0.0592     0.9493 0.000 0.984 0.000 0.016
#> GSM617592     2  0.0000     0.9504 0.000 1.000 0.000 0.000
#> GSM617607     3  0.0000     0.9379 0.000 0.000 1.000 0.000
#> GSM617608     3  0.0000     0.9379 0.000 0.000 1.000 0.000
#> GSM617609     3  0.0000     0.9379 0.000 0.000 1.000 0.000
#> GSM617612     1  0.0000     0.9012 1.000 0.000 0.000 0.000
#> GSM617615     2  0.0707     0.9486 0.000 0.980 0.000 0.020
#> GSM617616     3  0.0000     0.9379 0.000 0.000 1.000 0.000
#> GSM617617     2  0.0592     0.9460 0.000 0.984 0.000 0.016
#> GSM617618     4  0.4331     0.5887 0.000 0.000 0.288 0.712
#> GSM617619     4  0.0000     0.7733 0.000 0.000 0.000 1.000
#> GSM617620     2  0.0000     0.9504 0.000 1.000 0.000 0.000
#> GSM617622     2  0.2530     0.8964 0.000 0.888 0.000 0.112
#> GSM617623     1  0.2345     0.8085 0.900 0.100 0.000 0.000
#> GSM617624     4  0.0188     0.7736 0.000 0.004 0.000 0.996
#> GSM617625     3  0.0000     0.9379 0.000 0.000 1.000 0.000
#> GSM617626     1  0.0000     0.9012 1.000 0.000 0.000 0.000
#> GSM617627     4  0.0469     0.7723 0.000 0.012 0.000 0.988
#> GSM617628     3  0.0000     0.9379 0.000 0.000 1.000 0.000
#> GSM617632     3  0.4406     0.5460 0.300 0.000 0.700 0.000
#> GSM617634     4  0.0000     0.7733 0.000 0.000 0.000 1.000
#> GSM617635     3  0.0000     0.9379 0.000 0.000 1.000 0.000
#> GSM617636     3  0.0000     0.9379 0.000 0.000 1.000 0.000
#> GSM617637     1  0.0000     0.9012 1.000 0.000 0.000 0.000
#> GSM617638     4  0.4713     0.4858 0.000 0.000 0.360 0.640
#> GSM617639     1  0.0000     0.9012 1.000 0.000 0.000 0.000
#> GSM617640     2  0.0188     0.9496 0.000 0.996 0.000 0.004
#> GSM617641     2  0.0000     0.9504 0.000 1.000 0.000 0.000
#> GSM617643     2  0.0817     0.9480 0.000 0.976 0.000 0.024
#> GSM617644     2  0.1940     0.9245 0.000 0.924 0.000 0.076
#> GSM617647     2  0.0188     0.9504 0.000 0.996 0.000 0.004
#> GSM617648     2  0.1867     0.9271 0.000 0.928 0.000 0.072
#> GSM617649     2  0.2081     0.9192 0.000 0.916 0.000 0.084
#> GSM617650     3  0.0188     0.9343 0.004 0.000 0.996 0.000
#> GSM617651     1  0.0000     0.9012 1.000 0.000 0.000 0.000
#> GSM617653     1  0.0000     0.9012 1.000 0.000 0.000 0.000
#> GSM617654     2  0.0469     0.9473 0.000 0.988 0.000 0.012
#> GSM617583     3  0.0000     0.9379 0.000 0.000 1.000 0.000
#> GSM617584     2  0.0000     0.9504 0.000 1.000 0.000 0.000
#> GSM617585     4  0.4776     0.3580 0.000 0.376 0.000 0.624
#> GSM617586     3  0.0000     0.9379 0.000 0.000 1.000 0.000
#> GSM617587     1  0.8674     0.0397 0.424 0.060 0.172 0.344
#> GSM617589     2  0.0000     0.9504 0.000 1.000 0.000 0.000
#> GSM617591     2  0.1792     0.9226 0.000 0.932 0.000 0.068
#> GSM617593     3  0.4999     0.0326 0.492 0.000 0.508 0.000
#> GSM617594     2  0.3266     0.8378 0.000 0.832 0.000 0.168
#> GSM617595     1  0.0000     0.9012 1.000 0.000 0.000 0.000
#> GSM617596     1  0.0000     0.9012 1.000 0.000 0.000 0.000
#> GSM617597     3  0.0000     0.9379 0.000 0.000 1.000 0.000
#> GSM617598     3  0.5000     0.0182 0.496 0.000 0.504 0.000
#> GSM617599     2  0.1792     0.9306 0.000 0.932 0.000 0.068
#> GSM617600     3  0.0000     0.9379 0.000 0.000 1.000 0.000
#> GSM617601     2  0.4164     0.7106 0.000 0.736 0.000 0.264
#> GSM617602     3  0.0000     0.9379 0.000 0.000 1.000 0.000
#> GSM617603     2  0.0817     0.9475 0.000 0.976 0.000 0.024
#> GSM617604     1  0.0000     0.9012 1.000 0.000 0.000 0.000
#> GSM617605     2  0.0000     0.9504 0.000 1.000 0.000 0.000
#> GSM617606     2  0.2921     0.8336 0.000 0.860 0.000 0.140
#> GSM617610     1  0.0000     0.9012 1.000 0.000 0.000 0.000
#> GSM617611     1  0.5000    -0.0842 0.504 0.000 0.496 0.000
#> GSM617613     3  0.0000     0.9379 0.000 0.000 1.000 0.000
#> GSM617614     3  0.0000     0.9379 0.000 0.000 1.000 0.000
#> GSM617621     1  0.0000     0.9012 1.000 0.000 0.000 0.000
#> GSM617629     4  0.5000     0.1177 0.000 0.000 0.496 0.504
#> GSM617630     4  0.4356     0.5638 0.000 0.292 0.000 0.708
#> GSM617631     3  0.0000     0.9379 0.000 0.000 1.000 0.000
#> GSM617633     3  0.0000     0.9379 0.000 0.000 1.000 0.000
#> GSM617642     3  0.0000     0.9379 0.000 0.000 1.000 0.000
#> GSM617645     2  0.0000     0.9504 0.000 1.000 0.000 0.000
#> GSM617646     1  0.0000     0.9012 1.000 0.000 0.000 0.000
#> GSM617652     3  0.0000     0.9379 0.000 0.000 1.000 0.000
#> GSM617655     3  0.0000     0.9379 0.000 0.000 1.000 0.000
#> GSM617656     3  0.0000     0.9379 0.000 0.000 1.000 0.000
#> GSM617657     4  0.0188     0.7732 0.000 0.000 0.004 0.996
#> GSM617658     3  0.0000     0.9379 0.000 0.000 1.000 0.000
#> GSM617659     3  0.0188     0.9343 0.004 0.000 0.996 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
#> GSM617581     1  0.4599     0.2584 0.744 0.156 0.000 0.100 0.000
#> GSM617582     5  0.1403     0.4759 0.000 0.024 0.000 0.024 0.952
#> GSM617588     2  0.0162     0.7381 0.000 0.996 0.000 0.004 0.000
#> GSM617590     2  0.1281     0.7366 0.000 0.956 0.000 0.012 0.032
#> GSM617592     2  0.0290     0.7377 0.000 0.992 0.000 0.008 0.000
#> GSM617607     3  0.1557     0.8600 0.000 0.000 0.940 0.052 0.008
#> GSM617608     3  0.0963     0.8606 0.000 0.000 0.964 0.036 0.000
#> GSM617609     3  0.1041     0.8520 0.000 0.000 0.964 0.004 0.032
#> GSM617612     1  0.0703     0.6184 0.976 0.000 0.000 0.024 0.000
#> GSM617615     2  0.2953     0.7127 0.000 0.844 0.000 0.144 0.012
#> GSM617616     3  0.1952     0.8476 0.000 0.000 0.912 0.084 0.004
#> GSM617617     2  0.4418     0.6307 0.004 0.756 0.000 0.180 0.060
#> GSM617618     5  0.4933     0.3202 0.000 0.000 0.236 0.076 0.688
#> GSM617619     5  0.0451     0.4821 0.000 0.008 0.004 0.000 0.988
#> GSM617620     2  0.0162     0.7378 0.000 0.996 0.000 0.004 0.000
#> GSM617622     2  0.5276     0.4805 0.000 0.516 0.000 0.436 0.048
#> GSM617623     1  0.4675     0.2405 0.736 0.164 0.000 0.100 0.000
#> GSM617624     5  0.3300     0.3818 0.000 0.004 0.000 0.204 0.792
#> GSM617625     3  0.0162     0.8629 0.000 0.000 0.996 0.004 0.000
#> GSM617626     1  0.0794     0.6196 0.972 0.000 0.000 0.028 0.000
#> GSM617627     5  0.3723     0.3881 0.000 0.044 0.000 0.152 0.804
#> GSM617628     3  0.0510     0.8607 0.000 0.000 0.984 0.000 0.016
#> GSM617632     3  0.6800    -0.0978 0.292 0.000 0.364 0.344 0.000
#> GSM617634     5  0.3521     0.3532 0.000 0.004 0.000 0.232 0.764
#> GSM617635     3  0.3949     0.6196 0.000 0.000 0.668 0.332 0.000
#> GSM617636     3  0.2891     0.7967 0.000 0.000 0.824 0.176 0.000
#> GSM617637     1  0.4251     0.4681 0.672 0.000 0.012 0.316 0.000
#> GSM617638     5  0.5458     0.1282 0.000 0.000 0.464 0.060 0.476
#> GSM617639     1  0.4329     0.4677 0.672 0.000 0.016 0.312 0.000
#> GSM617640     2  0.3291     0.6747 0.000 0.840 0.000 0.120 0.040
#> GSM617641     2  0.0290     0.7377 0.000 0.992 0.000 0.008 0.000
#> GSM617643     2  0.4315     0.6437 0.000 0.700 0.000 0.276 0.024
#> GSM617644     2  0.4761     0.5864 0.000 0.616 0.000 0.356 0.028
#> GSM617647     2  0.4696     0.5803 0.000 0.616 0.000 0.360 0.024
#> GSM617648     2  0.4709     0.5824 0.000 0.612 0.000 0.364 0.024
#> GSM617649     2  0.4982     0.5287 0.000 0.556 0.000 0.412 0.032
#> GSM617650     3  0.4491     0.5902 0.020 0.000 0.652 0.328 0.000
#> GSM617651     1  0.0963     0.6110 0.964 0.000 0.000 0.036 0.000
#> GSM617653     1  0.0162     0.6174 0.996 0.000 0.000 0.004 0.000
#> GSM617654     2  0.3565     0.6670 0.000 0.816 0.000 0.144 0.040
#> GSM617583     3  0.0162     0.8629 0.000 0.000 0.996 0.004 0.000
#> GSM617584     2  0.0404     0.7371 0.000 0.988 0.000 0.012 0.000
#> GSM617585     2  0.5694     0.0687 0.000 0.460 0.000 0.080 0.460
#> GSM617586     3  0.1106     0.8564 0.000 0.000 0.964 0.012 0.024
#> GSM617587     4  0.8767     0.0000 0.276 0.048 0.108 0.396 0.172
#> GSM617589     2  0.0912     0.7383 0.000 0.972 0.000 0.016 0.012
#> GSM617591     2  0.3861     0.6657 0.000 0.804 0.000 0.068 0.128
#> GSM617593     1  0.6771     0.1009 0.392 0.000 0.284 0.324 0.000
#> GSM617594     2  0.5591     0.4442 0.000 0.496 0.000 0.432 0.072
#> GSM617595     1  0.2074     0.6008 0.896 0.000 0.000 0.104 0.000
#> GSM617596     1  0.0880     0.6002 0.968 0.000 0.000 0.032 0.000
#> GSM617597     3  0.0794     0.8618 0.000 0.000 0.972 0.028 0.000
#> GSM617598     1  0.6771     0.1015 0.392 0.000 0.284 0.324 0.000
#> GSM617599     2  0.4777     0.6256 0.000 0.664 0.000 0.292 0.044
#> GSM617600     3  0.0794     0.8565 0.000 0.000 0.972 0.000 0.028
#> GSM617601     2  0.6410     0.3736 0.000 0.476 0.000 0.340 0.184
#> GSM617602     3  0.0703     0.8579 0.000 0.000 0.976 0.000 0.024
#> GSM617603     2  0.1872     0.7364 0.000 0.928 0.000 0.052 0.020
#> GSM617604     1  0.1121     0.5963 0.956 0.000 0.000 0.044 0.000
#> GSM617605     2  0.0898     0.7373 0.000 0.972 0.000 0.008 0.020
#> GSM617606     2  0.5277     0.5124 0.000 0.664 0.000 0.108 0.228
#> GSM617610     1  0.0162     0.6143 0.996 0.000 0.000 0.004 0.000
#> GSM617611     1  0.6700     0.1358 0.420 0.000 0.256 0.324 0.000
#> GSM617613     3  0.0794     0.8565 0.000 0.000 0.972 0.000 0.028
#> GSM617614     3  0.3086     0.7852 0.004 0.000 0.816 0.180 0.000
#> GSM617621     1  0.2020     0.6050 0.900 0.000 0.000 0.100 0.000
#> GSM617629     5  0.5353     0.1361 0.000 0.000 0.472 0.052 0.476
#> GSM617630     5  0.6614    -0.0115 0.008 0.396 0.000 0.164 0.432
#> GSM617631     3  0.0703     0.8579 0.000 0.000 0.976 0.000 0.024
#> GSM617633     3  0.2230     0.8320 0.000 0.000 0.884 0.116 0.000
#> GSM617642     3  0.2970     0.7948 0.004 0.000 0.828 0.168 0.000
#> GSM617645     2  0.3214     0.6762 0.000 0.844 0.000 0.120 0.036
#> GSM617646     1  0.4130     0.4863 0.696 0.000 0.012 0.292 0.000
#> GSM617652     3  0.2970     0.7947 0.004 0.000 0.828 0.168 0.000
#> GSM617655     3  0.0324     0.8626 0.000 0.000 0.992 0.004 0.004
#> GSM617656     3  0.0510     0.8602 0.000 0.000 0.984 0.000 0.016
#> GSM617657     5  0.3297     0.4596 0.000 0.000 0.084 0.068 0.848
#> GSM617658     3  0.0955     0.8548 0.000 0.000 0.968 0.004 0.028
#> GSM617659     3  0.3961     0.7038 0.016 0.000 0.736 0.248 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
#> GSM617581     1  0.3755     0.7000 0.808 0.020 0.000 0.120 0.004 0.048
#> GSM617582     5  0.1863     0.5948 0.000 0.032 0.004 0.004 0.928 0.032
#> GSM617588     4  0.0000     0.7226 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM617590     4  0.2484     0.7110 0.000 0.036 0.000 0.896 0.044 0.024
#> GSM617592     4  0.0000     0.7226 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM617607     3  0.3081     0.7710 0.000 0.012 0.824 0.000 0.012 0.152
#> GSM617608     3  0.2473     0.7746 0.000 0.008 0.856 0.000 0.000 0.136
#> GSM617609     3  0.1737     0.7960 0.000 0.008 0.932 0.000 0.020 0.040
#> GSM617612     1  0.1858     0.8373 0.904 0.004 0.000 0.000 0.000 0.092
#> GSM617615     4  0.3232     0.5748 0.000 0.140 0.000 0.824 0.016 0.020
#> GSM617616     3  0.3454     0.7154 0.000 0.012 0.760 0.000 0.004 0.224
#> GSM617617     4  0.5856     0.5147 0.004 0.172 0.000 0.640 0.088 0.096
#> GSM617618     5  0.6519     0.5100 0.004 0.088 0.188 0.000 0.560 0.160
#> GSM617619     5  0.0862     0.6009 0.000 0.008 0.000 0.004 0.972 0.016
#> GSM617620     4  0.0000     0.7226 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM617622     2  0.3360     0.6578 0.000 0.732 0.000 0.264 0.004 0.000
#> GSM617623     1  0.3879     0.6863 0.796 0.020 0.000 0.132 0.004 0.048
#> GSM617624     5  0.4863     0.4315 0.000 0.412 0.000 0.000 0.528 0.060
#> GSM617625     3  0.0937     0.8117 0.000 0.000 0.960 0.000 0.000 0.040
#> GSM617626     1  0.2362     0.8074 0.860 0.004 0.000 0.000 0.000 0.136
#> GSM617627     5  0.4983     0.4956 0.000 0.224 0.000 0.032 0.676 0.068
#> GSM617628     3  0.0508     0.8138 0.000 0.000 0.984 0.000 0.004 0.012
#> GSM617632     6  0.4631     0.7069 0.168 0.000 0.140 0.000 0.000 0.692
#> GSM617634     5  0.4802     0.4299 0.000 0.404 0.000 0.000 0.540 0.056
#> GSM617635     6  0.4303     0.3449 0.016 0.012 0.332 0.000 0.000 0.640
#> GSM617636     3  0.3874     0.5453 0.000 0.008 0.636 0.000 0.000 0.356
#> GSM617637     6  0.3756     0.5631 0.352 0.000 0.004 0.000 0.000 0.644
#> GSM617638     5  0.6136     0.1536 0.000 0.052 0.416 0.000 0.440 0.092
#> GSM617639     6  0.3789     0.4503 0.416 0.000 0.000 0.000 0.000 0.584
#> GSM617640     4  0.4288     0.6555 0.004 0.088 0.000 0.784 0.048 0.076
#> GSM617641     4  0.0000     0.7226 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM617643     4  0.3659    -0.1199 0.000 0.364 0.000 0.636 0.000 0.000
#> GSM617644     2  0.3999     0.4871 0.000 0.500 0.000 0.496 0.004 0.000
#> GSM617647     2  0.4107     0.5520 0.004 0.540 0.000 0.452 0.000 0.004
#> GSM617648     2  0.3993     0.5312 0.000 0.520 0.000 0.476 0.004 0.000
#> GSM617649     2  0.3728     0.6535 0.000 0.652 0.000 0.344 0.004 0.000
#> GSM617650     6  0.4004     0.2826 0.012 0.000 0.368 0.000 0.000 0.620
#> GSM617651     1  0.1268     0.8373 0.952 0.008 0.000 0.000 0.004 0.036
#> GSM617653     1  0.1444     0.8423 0.928 0.000 0.000 0.000 0.000 0.072
#> GSM617654     4  0.4619     0.6354 0.004 0.116 0.000 0.756 0.056 0.068
#> GSM617583     3  0.0458     0.8136 0.000 0.000 0.984 0.000 0.000 0.016
#> GSM617584     4  0.0000     0.7226 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM617585     4  0.5997     0.2324 0.000 0.068 0.000 0.456 0.416 0.060
#> GSM617586     3  0.1080     0.8069 0.000 0.004 0.960 0.000 0.004 0.032
#> GSM617587     2  0.8905    -0.1501 0.228 0.352 0.076 0.052 0.092 0.200
#> GSM617589     4  0.1458     0.7194 0.000 0.016 0.000 0.948 0.016 0.020
#> GSM617591     4  0.4913     0.6283 0.000 0.076 0.000 0.720 0.144 0.060
#> GSM617593     6  0.4614     0.7260 0.228 0.000 0.096 0.000 0.000 0.676
#> GSM617594     2  0.3628     0.6585 0.000 0.720 0.000 0.268 0.004 0.008
#> GSM617595     1  0.3190     0.7079 0.772 0.008 0.000 0.000 0.000 0.220
#> GSM617596     1  0.0862     0.8330 0.972 0.008 0.000 0.000 0.004 0.016
#> GSM617597     3  0.1753     0.8025 0.000 0.004 0.912 0.000 0.000 0.084
#> GSM617598     6  0.4699     0.7262 0.228 0.000 0.104 0.000 0.000 0.668
#> GSM617599     4  0.4467    -0.1662 0.000 0.376 0.000 0.592 0.004 0.028
#> GSM617600     3  0.0951     0.8059 0.000 0.004 0.968 0.000 0.020 0.008
#> GSM617601     2  0.6287     0.4932 0.000 0.524 0.004 0.300 0.124 0.048
#> GSM617602     3  0.0909     0.8093 0.000 0.000 0.968 0.000 0.020 0.012
#> GSM617603     4  0.2401     0.7067 0.000 0.048 0.000 0.900 0.024 0.028
#> GSM617604     1  0.1155     0.8355 0.956 0.004 0.000 0.000 0.004 0.036
#> GSM617605     4  0.2266     0.7162 0.000 0.028 0.000 0.908 0.040 0.024
#> GSM617606     4  0.5636     0.5573 0.000 0.092 0.000 0.640 0.200 0.068
#> GSM617610     1  0.1471     0.8436 0.932 0.004 0.000 0.000 0.000 0.064
#> GSM617611     6  0.4662     0.7228 0.236 0.000 0.096 0.000 0.000 0.668
#> GSM617613     3  0.0891     0.8054 0.000 0.000 0.968 0.000 0.024 0.008
#> GSM617614     3  0.3684     0.5498 0.000 0.004 0.664 0.000 0.000 0.332
#> GSM617621     1  0.2996     0.6751 0.772 0.000 0.000 0.000 0.000 0.228
#> GSM617629     3  0.6352    -0.2202 0.000 0.084 0.440 0.000 0.396 0.080
#> GSM617630     5  0.7209     0.0105 0.012 0.124 0.000 0.296 0.444 0.124
#> GSM617631     3  0.1003     0.8077 0.000 0.000 0.964 0.000 0.020 0.016
#> GSM617633     3  0.3445     0.6940 0.000 0.012 0.744 0.000 0.000 0.244
#> GSM617642     3  0.3741     0.5846 0.000 0.008 0.672 0.000 0.000 0.320
#> GSM617645     4  0.3848     0.6703 0.000 0.084 0.000 0.808 0.036 0.072
#> GSM617646     6  0.4230     0.4526 0.400 0.008 0.008 0.000 0.000 0.584
#> GSM617652     3  0.4060     0.5269 0.008 0.008 0.644 0.000 0.000 0.340
#> GSM617655     3  0.0603     0.8135 0.000 0.004 0.980 0.000 0.000 0.016
#> GSM617656     3  0.0291     0.8127 0.000 0.004 0.992 0.000 0.000 0.004
#> GSM617657     5  0.5122     0.5797 0.000 0.112 0.112 0.000 0.708 0.068
#> GSM617658     3  0.2113     0.8049 0.000 0.008 0.912 0.000 0.032 0.048
#> GSM617659     3  0.4279     0.2759 0.012 0.004 0.548 0.000 0.000 0.436

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

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

collect_plots(res)

plot of chunk ATC-pam-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.947           0.926       0.970         0.4993 0.500   0.500
#> 3 3 0.613           0.744       0.857         0.3066 0.813   0.640
#> 4 4 0.665           0.776       0.877         0.0823 0.934   0.818
#> 5 5 0.768           0.845       0.910         0.0915 0.886   0.650
#> 6 6 0.749           0.561       0.756         0.0636 0.856   0.489

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
#> GSM617581     1  1.0000    -0.0317 0.500 0.500
#> GSM617582     2  0.3431     0.9150 0.064 0.936
#> GSM617588     2  0.0000     0.9634 0.000 1.000
#> GSM617590     2  0.0000     0.9634 0.000 1.000
#> GSM617592     2  0.0000     0.9634 0.000 1.000
#> GSM617607     1  0.0000     0.9717 1.000 0.000
#> GSM617608     1  0.0000     0.9717 1.000 0.000
#> GSM617609     1  0.0000     0.9717 1.000 0.000
#> GSM617612     1  0.0000     0.9717 1.000 0.000
#> GSM617615     2  0.0000     0.9634 0.000 1.000
#> GSM617616     1  0.0000     0.9717 1.000 0.000
#> GSM617617     2  0.0000     0.9634 0.000 1.000
#> GSM617618     1  0.0000     0.9717 1.000 0.000
#> GSM617619     2  0.3274     0.9183 0.060 0.940
#> GSM617620     2  0.0000     0.9634 0.000 1.000
#> GSM617622     2  0.0000     0.9634 0.000 1.000
#> GSM617623     2  0.8763     0.5813 0.296 0.704
#> GSM617624     2  0.0000     0.9634 0.000 1.000
#> GSM617625     1  0.0000     0.9717 1.000 0.000
#> GSM617626     1  0.0000     0.9717 1.000 0.000
#> GSM617627     2  0.0000     0.9634 0.000 1.000
#> GSM617628     1  0.0000     0.9717 1.000 0.000
#> GSM617632     1  0.0000     0.9717 1.000 0.000
#> GSM617634     2  0.4562     0.8837 0.096 0.904
#> GSM617635     1  0.0000     0.9717 1.000 0.000
#> GSM617636     1  0.0000     0.9717 1.000 0.000
#> GSM617637     1  0.0000     0.9717 1.000 0.000
#> GSM617638     1  0.0938     0.9603 0.988 0.012
#> GSM617639     1  0.0000     0.9717 1.000 0.000
#> GSM617640     2  0.0000     0.9634 0.000 1.000
#> GSM617641     2  0.0000     0.9634 0.000 1.000
#> GSM617643     2  0.0000     0.9634 0.000 1.000
#> GSM617644     2  0.0000     0.9634 0.000 1.000
#> GSM617647     2  0.0000     0.9634 0.000 1.000
#> GSM617648     2  0.0000     0.9634 0.000 1.000
#> GSM617649     2  0.0000     0.9634 0.000 1.000
#> GSM617650     1  0.0000     0.9717 1.000 0.000
#> GSM617651     1  0.0000     0.9717 1.000 0.000
#> GSM617653     1  0.0000     0.9717 1.000 0.000
#> GSM617654     2  0.0000     0.9634 0.000 1.000
#> GSM617583     1  0.0000     0.9717 1.000 0.000
#> GSM617584     2  0.0000     0.9634 0.000 1.000
#> GSM617585     2  0.0000     0.9634 0.000 1.000
#> GSM617586     1  0.9522     0.3836 0.628 0.372
#> GSM617587     2  0.8661     0.6102 0.288 0.712
#> GSM617589     2  0.0000     0.9634 0.000 1.000
#> GSM617591     2  0.0000     0.9634 0.000 1.000
#> GSM617593     1  0.0000     0.9717 1.000 0.000
#> GSM617594     2  0.0000     0.9634 0.000 1.000
#> GSM617595     1  0.0000     0.9717 1.000 0.000
#> GSM617596     1  0.0000     0.9717 1.000 0.000
#> GSM617597     1  0.0000     0.9717 1.000 0.000
#> GSM617598     1  0.0000     0.9717 1.000 0.000
#> GSM617599     2  0.0000     0.9634 0.000 1.000
#> GSM617600     1  0.0000     0.9717 1.000 0.000
#> GSM617601     2  0.0000     0.9634 0.000 1.000
#> GSM617602     1  0.0000     0.9717 1.000 0.000
#> GSM617603     2  0.0000     0.9634 0.000 1.000
#> GSM617604     1  0.0000     0.9717 1.000 0.000
#> GSM617605     2  0.0000     0.9634 0.000 1.000
#> GSM617606     2  0.0000     0.9634 0.000 1.000
#> GSM617610     1  0.0000     0.9717 1.000 0.000
#> GSM617611     1  0.0000     0.9717 1.000 0.000
#> GSM617613     1  0.0000     0.9717 1.000 0.000
#> GSM617614     1  0.0000     0.9717 1.000 0.000
#> GSM617621     1  0.0000     0.9717 1.000 0.000
#> GSM617629     1  0.8386     0.6132 0.732 0.268
#> GSM617630     2  0.3431     0.9150 0.064 0.936
#> GSM617631     1  0.0000     0.9717 1.000 0.000
#> GSM617633     1  0.0000     0.9717 1.000 0.000
#> GSM617642     1  0.0000     0.9717 1.000 0.000
#> GSM617645     2  0.0000     0.9634 0.000 1.000
#> GSM617646     1  0.0000     0.9717 1.000 0.000
#> GSM617652     1  0.0000     0.9717 1.000 0.000
#> GSM617655     1  0.0000     0.9717 1.000 0.000
#> GSM617656     1  0.0000     0.9717 1.000 0.000
#> GSM617657     2  0.9044     0.5392 0.320 0.680
#> GSM617658     1  0.0000     0.9717 1.000 0.000
#> GSM617659     1  0.0000     0.9717 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
#> GSM617581     1  0.4960      0.722 0.832 0.128 0.040
#> GSM617582     2  0.4399      0.761 0.000 0.812 0.188
#> GSM617588     2  0.1411      0.881 0.036 0.964 0.000
#> GSM617590     2  0.0000      0.890 0.000 1.000 0.000
#> GSM617592     2  0.1964      0.872 0.056 0.944 0.000
#> GSM617607     3  0.2878      0.790 0.096 0.000 0.904
#> GSM617608     3  0.4291      0.773 0.180 0.000 0.820
#> GSM617609     3  0.0000      0.789 0.000 0.000 1.000
#> GSM617612     1  0.2711      0.802 0.912 0.000 0.088
#> GSM617615     2  0.0000      0.890 0.000 1.000 0.000
#> GSM617616     3  0.0592      0.791 0.012 0.000 0.988
#> GSM617617     2  0.6180      0.310 0.416 0.584 0.000
#> GSM617618     3  0.2878      0.790 0.096 0.000 0.904
#> GSM617619     2  0.5397      0.674 0.000 0.720 0.280
#> GSM617620     2  0.1411      0.881 0.036 0.964 0.000
#> GSM617622     1  0.8705      0.212 0.524 0.360 0.116
#> GSM617623     1  0.5254      0.556 0.736 0.264 0.000
#> GSM617624     2  0.4796      0.741 0.000 0.780 0.220
#> GSM617625     3  0.4452      0.751 0.192 0.000 0.808
#> GSM617626     1  0.1411      0.825 0.964 0.000 0.036
#> GSM617627     2  0.4842      0.737 0.000 0.776 0.224
#> GSM617628     3  0.0747      0.792 0.016 0.000 0.984
#> GSM617632     3  0.6062      0.624 0.384 0.000 0.616
#> GSM617634     2  0.5760      0.589 0.000 0.672 0.328
#> GSM617635     3  0.5431      0.709 0.284 0.000 0.716
#> GSM617636     3  0.6045      0.629 0.380 0.000 0.620
#> GSM617637     1  0.1964      0.812 0.944 0.000 0.056
#> GSM617638     3  0.3030      0.790 0.092 0.004 0.904
#> GSM617639     1  0.1411      0.825 0.964 0.000 0.036
#> GSM617640     2  0.0000      0.890 0.000 1.000 0.000
#> GSM617641     2  0.1411      0.881 0.036 0.964 0.000
#> GSM617643     2  0.0000      0.890 0.000 1.000 0.000
#> GSM617644     2  0.0000      0.890 0.000 1.000 0.000
#> GSM617647     2  0.5706      0.516 0.320 0.680 0.000
#> GSM617648     2  0.0000      0.890 0.000 1.000 0.000
#> GSM617649     2  0.0000      0.890 0.000 1.000 0.000
#> GSM617650     3  0.6062      0.624 0.384 0.000 0.616
#> GSM617651     1  0.2711      0.802 0.912 0.000 0.088
#> GSM617653     1  0.1411      0.825 0.964 0.000 0.036
#> GSM617654     2  0.0000      0.890 0.000 1.000 0.000
#> GSM617583     3  0.4346      0.754 0.184 0.000 0.816
#> GSM617584     2  0.5621      0.574 0.308 0.692 0.000
#> GSM617585     2  0.0000      0.890 0.000 1.000 0.000
#> GSM617586     3  0.0000      0.789 0.000 0.000 1.000
#> GSM617587     2  0.8094      0.557 0.100 0.612 0.288
#> GSM617589     2  0.1411      0.881 0.036 0.964 0.000
#> GSM617591     2  0.0000      0.890 0.000 1.000 0.000
#> GSM617593     3  0.6062      0.624 0.384 0.000 0.616
#> GSM617594     2  0.0000      0.890 0.000 1.000 0.000
#> GSM617595     1  0.1411      0.825 0.964 0.000 0.036
#> GSM617596     1  0.3192      0.785 0.888 0.000 0.112
#> GSM617597     3  0.1753      0.794 0.048 0.000 0.952
#> GSM617598     1  0.6260     -0.216 0.552 0.000 0.448
#> GSM617599     2  0.0000      0.890 0.000 1.000 0.000
#> GSM617600     3  0.0000      0.789 0.000 0.000 1.000
#> GSM617601     2  0.0000      0.890 0.000 1.000 0.000
#> GSM617602     3  0.0000      0.789 0.000 0.000 1.000
#> GSM617603     2  0.1411      0.881 0.036 0.964 0.000
#> GSM617604     1  0.1643      0.823 0.956 0.000 0.044
#> GSM617605     2  0.1411      0.881 0.036 0.964 0.000
#> GSM617606     2  0.0000      0.890 0.000 1.000 0.000
#> GSM617610     1  0.1411      0.825 0.964 0.000 0.036
#> GSM617611     1  0.5988      0.125 0.632 0.000 0.368
#> GSM617613     3  0.0000      0.789 0.000 0.000 1.000
#> GSM617614     3  0.6062      0.624 0.384 0.000 0.616
#> GSM617621     1  0.1411      0.825 0.964 0.000 0.036
#> GSM617629     3  0.0000      0.789 0.000 0.000 1.000
#> GSM617630     2  0.5285      0.774 0.040 0.812 0.148
#> GSM617631     3  0.0592      0.790 0.012 0.000 0.988
#> GSM617633     3  0.5529      0.701 0.296 0.000 0.704
#> GSM617642     3  0.6062      0.624 0.384 0.000 0.616
#> GSM617645     2  0.0000      0.890 0.000 1.000 0.000
#> GSM617646     3  0.6140      0.585 0.404 0.000 0.596
#> GSM617652     3  0.5178      0.730 0.256 0.000 0.744
#> GSM617655     3  0.0000      0.789 0.000 0.000 1.000
#> GSM617656     3  0.0000      0.789 0.000 0.000 1.000
#> GSM617657     3  0.3551      0.663 0.000 0.132 0.868
#> GSM617658     3  0.4235      0.776 0.176 0.000 0.824
#> GSM617659     3  0.6062      0.624 0.384 0.000 0.616

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM617581     1  0.3876      0.705 0.836 0.124 0.000 0.040
#> GSM617582     2  0.1637      0.868 0.000 0.940 0.060 0.000
#> GSM617588     4  0.0817      0.983 0.000 0.024 0.000 0.976
#> GSM617590     2  0.1557      0.868 0.000 0.944 0.000 0.056
#> GSM617592     4  0.0817      0.983 0.000 0.024 0.000 0.976
#> GSM617607     3  0.2408      0.801 0.104 0.000 0.896 0.000
#> GSM617608     3  0.3444      0.787 0.184 0.000 0.816 0.000
#> GSM617609     3  0.0336      0.797 0.008 0.000 0.992 0.000
#> GSM617612     1  0.0937      0.844 0.976 0.012 0.012 0.000
#> GSM617615     2  0.0000      0.894 0.000 1.000 0.000 0.000
#> GSM617616     3  0.0707      0.800 0.020 0.000 0.980 0.000
#> GSM617617     2  0.4866      0.343 0.404 0.596 0.000 0.000
#> GSM617618     3  0.2408      0.801 0.104 0.000 0.896 0.000
#> GSM617619     2  0.3172      0.797 0.000 0.840 0.160 0.000
#> GSM617620     4  0.0817      0.983 0.000 0.024 0.000 0.976
#> GSM617622     1  0.6770      0.406 0.604 0.236 0.160 0.000
#> GSM617623     1  0.5994      0.346 0.636 0.068 0.000 0.296
#> GSM617624     2  0.3123      0.800 0.000 0.844 0.156 0.000
#> GSM617625     3  0.3497      0.785 0.124 0.000 0.852 0.024
#> GSM617626     1  0.0000      0.851 1.000 0.000 0.000 0.000
#> GSM617627     2  0.3172      0.797 0.000 0.840 0.160 0.000
#> GSM617628     3  0.0000      0.796 0.000 0.000 1.000 0.000
#> GSM617632     3  0.5467      0.661 0.364 0.000 0.612 0.024
#> GSM617634     2  0.3764      0.722 0.000 0.784 0.216 0.000
#> GSM617635     3  0.4621      0.731 0.284 0.000 0.708 0.008
#> GSM617636     3  0.5467      0.661 0.364 0.000 0.612 0.024
#> GSM617637     1  0.2111      0.808 0.932 0.000 0.044 0.024
#> GSM617638     3  0.2530      0.801 0.100 0.004 0.896 0.000
#> GSM617639     1  0.0817      0.842 0.976 0.000 0.000 0.024
#> GSM617640     2  0.0000      0.894 0.000 1.000 0.000 0.000
#> GSM617641     4  0.0817      0.983 0.000 0.024 0.000 0.976
#> GSM617643     2  0.0000      0.894 0.000 1.000 0.000 0.000
#> GSM617644     2  0.0000      0.894 0.000 1.000 0.000 0.000
#> GSM617647     2  0.4477      0.539 0.312 0.688 0.000 0.000
#> GSM617648     2  0.0000      0.894 0.000 1.000 0.000 0.000
#> GSM617649     2  0.0000      0.894 0.000 1.000 0.000 0.000
#> GSM617650     3  0.5467      0.661 0.364 0.000 0.612 0.024
#> GSM617651     1  0.0817      0.841 0.976 0.024 0.000 0.000
#> GSM617653     1  0.0000      0.851 1.000 0.000 0.000 0.000
#> GSM617654     2  0.0000      0.894 0.000 1.000 0.000 0.000
#> GSM617583     3  0.3166      0.791 0.116 0.000 0.868 0.016
#> GSM617584     4  0.1716      0.952 0.000 0.064 0.000 0.936
#> GSM617585     2  0.0000      0.894 0.000 1.000 0.000 0.000
#> GSM617586     3  0.0000      0.796 0.000 0.000 1.000 0.000
#> GSM617587     2  0.5511      0.696 0.084 0.720 0.196 0.000
#> GSM617589     4  0.1474      0.964 0.000 0.052 0.000 0.948
#> GSM617591     2  0.0000      0.894 0.000 1.000 0.000 0.000
#> GSM617593     3  0.5467      0.661 0.364 0.000 0.612 0.024
#> GSM617594     2  0.0000      0.894 0.000 1.000 0.000 0.000
#> GSM617595     1  0.0000      0.851 1.000 0.000 0.000 0.000
#> GSM617596     1  0.1824      0.815 0.936 0.004 0.060 0.000
#> GSM617597     3  0.1474      0.803 0.052 0.000 0.948 0.000
#> GSM617598     3  0.5695      0.440 0.476 0.000 0.500 0.024
#> GSM617599     2  0.0000      0.894 0.000 1.000 0.000 0.000
#> GSM617600     3  0.0000      0.796 0.000 0.000 1.000 0.000
#> GSM617601     2  0.0188      0.893 0.000 0.996 0.004 0.000
#> GSM617602     3  0.0000      0.796 0.000 0.000 1.000 0.000
#> GSM617603     2  0.3726      0.724 0.000 0.788 0.000 0.212
#> GSM617604     1  0.0188      0.850 0.996 0.000 0.004 0.000
#> GSM617605     2  0.3528      0.745 0.000 0.808 0.000 0.192
#> GSM617606     2  0.0000      0.894 0.000 1.000 0.000 0.000
#> GSM617610     1  0.0000      0.851 1.000 0.000 0.000 0.000
#> GSM617611     1  0.5602     -0.213 0.568 0.000 0.408 0.024
#> GSM617613     3  0.0000      0.796 0.000 0.000 1.000 0.000
#> GSM617614     3  0.5467      0.661 0.364 0.000 0.612 0.024
#> GSM617621     1  0.0817      0.842 0.976 0.000 0.000 0.024
#> GSM617629     3  0.0000      0.796 0.000 0.000 1.000 0.000
#> GSM617630     2  0.1637      0.868 0.000 0.940 0.060 0.000
#> GSM617631     3  0.0469      0.797 0.012 0.000 0.988 0.000
#> GSM617633     3  0.4464      0.766 0.208 0.000 0.768 0.024
#> GSM617642     3  0.5436      0.665 0.356 0.000 0.620 0.024
#> GSM617645     2  0.0000      0.894 0.000 1.000 0.000 0.000
#> GSM617646     3  0.4925      0.574 0.428 0.000 0.572 0.000
#> GSM617652     3  0.4331      0.732 0.288 0.000 0.712 0.000
#> GSM617655     3  0.0000      0.796 0.000 0.000 1.000 0.000
#> GSM617656     3  0.0000      0.796 0.000 0.000 1.000 0.000
#> GSM617657     3  0.2868      0.694 0.000 0.136 0.864 0.000
#> GSM617658     3  0.3768      0.787 0.184 0.000 0.808 0.008
#> GSM617659     3  0.5467      0.661 0.364 0.000 0.612 0.024

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>           class entropy silhouette    p1    p2    p3    p4    p5
#> GSM617581     5  0.0000      0.901 0.000 0.000 0.000 0.000 1.000
#> GSM617582     2  0.2726      0.870 0.052 0.884 0.064 0.000 0.000
#> GSM617588     4  0.0000      0.964 0.000 0.000 0.000 1.000 0.000
#> GSM617590     2  0.2329      0.851 0.000 0.876 0.000 0.124 0.000
#> GSM617592     4  0.0000      0.964 0.000 0.000 0.000 1.000 0.000
#> GSM617607     3  0.2179      0.841 0.112 0.000 0.888 0.000 0.000
#> GSM617608     3  0.3039      0.790 0.192 0.000 0.808 0.000 0.000
#> GSM617609     3  0.0000      0.870 0.000 0.000 1.000 0.000 0.000
#> GSM617612     5  0.0000      0.901 0.000 0.000 0.000 0.000 1.000
#> GSM617615     2  0.0162      0.900 0.004 0.996 0.000 0.000 0.000
#> GSM617616     3  0.0404      0.870 0.012 0.000 0.988 0.000 0.000
#> GSM617617     5  0.3635      0.635 0.004 0.248 0.000 0.000 0.748
#> GSM617618     3  0.2179      0.841 0.112 0.000 0.888 0.000 0.000
#> GSM617619     2  0.4096      0.787 0.052 0.772 0.176 0.000 0.000
#> GSM617620     4  0.0000      0.964 0.000 0.000 0.000 1.000 0.000
#> GSM617622     5  0.2894      0.784 0.008 0.124 0.008 0.000 0.860
#> GSM617623     5  0.0000      0.901 0.000 0.000 0.000 0.000 1.000
#> GSM617624     2  0.4059      0.791 0.052 0.776 0.172 0.000 0.000
#> GSM617625     3  0.2852      0.775 0.172 0.000 0.828 0.000 0.000
#> GSM617626     5  0.0000      0.901 0.000 0.000 0.000 0.000 1.000
#> GSM617627     2  0.4096      0.787 0.052 0.772 0.176 0.000 0.000
#> GSM617628     3  0.0000      0.870 0.000 0.000 1.000 0.000 0.000
#> GSM617632     1  0.1851      0.920 0.912 0.000 0.088 0.000 0.000
#> GSM617634     2  0.4519      0.716 0.052 0.720 0.228 0.000 0.000
#> GSM617635     3  0.4210      0.393 0.412 0.000 0.588 0.000 0.000
#> GSM617636     1  0.1608      0.937 0.928 0.000 0.072 0.000 0.000
#> GSM617637     1  0.1648      0.918 0.940 0.000 0.020 0.000 0.040
#> GSM617638     3  0.2233      0.844 0.104 0.004 0.892 0.000 0.000
#> GSM617639     1  0.1410      0.899 0.940 0.000 0.000 0.000 0.060
#> GSM617640     2  0.0000      0.901 0.000 1.000 0.000 0.000 0.000
#> GSM617641     4  0.0000      0.964 0.000 0.000 0.000 1.000 0.000
#> GSM617643     2  0.0290      0.899 0.008 0.992 0.000 0.000 0.000
#> GSM617644     2  0.0162      0.900 0.004 0.996 0.000 0.000 0.000
#> GSM617647     5  0.4510      0.320 0.008 0.432 0.000 0.000 0.560
#> GSM617648     2  0.0290      0.899 0.008 0.992 0.000 0.000 0.000
#> GSM617649     2  0.0290      0.899 0.008 0.992 0.000 0.000 0.000
#> GSM617650     1  0.1410      0.946 0.940 0.000 0.060 0.000 0.000
#> GSM617651     5  0.0000      0.901 0.000 0.000 0.000 0.000 1.000
#> GSM617653     5  0.0000      0.901 0.000 0.000 0.000 0.000 1.000
#> GSM617654     2  0.0162      0.900 0.004 0.996 0.000 0.000 0.000
#> GSM617583     3  0.2471      0.810 0.136 0.000 0.864 0.000 0.000
#> GSM617584     4  0.2513      0.855 0.008 0.116 0.000 0.876 0.000
#> GSM617585     2  0.1270      0.895 0.052 0.948 0.000 0.000 0.000
#> GSM617586     3  0.0000      0.870 0.000 0.000 1.000 0.000 0.000
#> GSM617587     2  0.5258      0.651 0.000 0.664 0.232 0.000 0.104
#> GSM617589     4  0.0794      0.945 0.000 0.028 0.000 0.972 0.000
#> GSM617591     2  0.1270      0.895 0.052 0.948 0.000 0.000 0.000
#> GSM617593     1  0.1410      0.946 0.940 0.000 0.060 0.000 0.000
#> GSM617594     2  0.0290      0.899 0.008 0.992 0.000 0.000 0.000
#> GSM617595     5  0.0000      0.901 0.000 0.000 0.000 0.000 1.000
#> GSM617596     5  0.0000      0.901 0.000 0.000 0.000 0.000 1.000
#> GSM617597     3  0.1197      0.864 0.048 0.000 0.952 0.000 0.000
#> GSM617598     1  0.1410      0.946 0.940 0.000 0.060 0.000 0.000
#> GSM617599     2  0.0290      0.901 0.008 0.992 0.000 0.000 0.000
#> GSM617600     3  0.0000      0.870 0.000 0.000 1.000 0.000 0.000
#> GSM617601     2  0.1197      0.896 0.048 0.952 0.000 0.000 0.000
#> GSM617602     3  0.0000      0.870 0.000 0.000 1.000 0.000 0.000
#> GSM617603     2  0.2439      0.829 0.004 0.876 0.000 0.120 0.000
#> GSM617604     1  0.3876      0.577 0.684 0.000 0.000 0.000 0.316
#> GSM617605     2  0.3109      0.779 0.000 0.800 0.000 0.200 0.000
#> GSM617606     2  0.1270      0.895 0.052 0.948 0.000 0.000 0.000
#> GSM617610     5  0.0000      0.901 0.000 0.000 0.000 0.000 1.000
#> GSM617611     1  0.1410      0.946 0.940 0.000 0.060 0.000 0.000
#> GSM617613     3  0.0000      0.870 0.000 0.000 1.000 0.000 0.000
#> GSM617614     1  0.1410      0.946 0.940 0.000 0.060 0.000 0.000
#> GSM617621     1  0.1410      0.899 0.940 0.000 0.000 0.000 0.060
#> GSM617629     3  0.0000      0.870 0.000 0.000 1.000 0.000 0.000
#> GSM617630     2  0.2726      0.870 0.052 0.884 0.064 0.000 0.000
#> GSM617631     3  0.0510      0.868 0.016 0.000 0.984 0.000 0.000
#> GSM617633     3  0.3586      0.704 0.264 0.000 0.736 0.000 0.000
#> GSM617642     1  0.1410      0.946 0.940 0.000 0.060 0.000 0.000
#> GSM617645     2  0.0162      0.900 0.004 0.996 0.000 0.000 0.000
#> GSM617646     3  0.6287      0.420 0.276 0.000 0.528 0.000 0.196
#> GSM617652     3  0.3913      0.616 0.324 0.000 0.676 0.000 0.000
#> GSM617655     3  0.0000      0.870 0.000 0.000 1.000 0.000 0.000
#> GSM617656     3  0.0000      0.870 0.000 0.000 1.000 0.000 0.000
#> GSM617657     3  0.3692      0.688 0.052 0.136 0.812 0.000 0.000
#> GSM617658     3  0.3039      0.791 0.192 0.000 0.808 0.000 0.000
#> GSM617659     1  0.1410      0.946 0.940 0.000 0.060 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>           class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM617581     5  0.0000     0.9673 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM617582     2  0.0713     0.7859 0.000 0.972 0.028 0.000 0.000 0.000
#> GSM617588     4  0.0000     0.9510 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM617590     2  0.2841     0.7341 0.000 0.824 0.000 0.164 0.000 0.012
#> GSM617592     4  0.0000     0.9510 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM617607     3  0.2092     0.5377 0.124 0.000 0.876 0.000 0.000 0.000
#> GSM617608     3  0.3828     0.0645 0.440 0.000 0.560 0.000 0.000 0.000
#> GSM617609     3  0.0547     0.5833 0.000 0.020 0.980 0.000 0.000 0.000
#> GSM617612     5  0.0000     0.9673 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM617615     2  0.2416     0.7810 0.000 0.844 0.000 0.000 0.000 0.156
#> GSM617616     3  0.0363     0.5851 0.012 0.000 0.988 0.000 0.000 0.000
#> GSM617617     5  0.3273     0.6492 0.000 0.212 0.004 0.000 0.776 0.008
#> GSM617618     3  0.2625     0.5636 0.072 0.056 0.872 0.000 0.000 0.000
#> GSM617619     3  0.3857     0.1839 0.000 0.468 0.532 0.000 0.000 0.000
#> GSM617620     4  0.0000     0.9510 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM617622     6  0.4998    -0.1343 0.000 0.028 0.024 0.000 0.444 0.504
#> GSM617623     5  0.0000     0.9673 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM617624     3  0.4179     0.1616 0.000 0.472 0.516 0.000 0.000 0.012
#> GSM617625     6  0.5061    -0.4315 0.076 0.000 0.428 0.000 0.000 0.496
#> GSM617626     5  0.0000     0.9673 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM617627     3  0.3868     0.1215 0.000 0.496 0.504 0.000 0.000 0.000
#> GSM617628     3  0.3868     0.4139 0.000 0.000 0.504 0.000 0.000 0.496
#> GSM617632     1  0.1714     0.7847 0.908 0.000 0.092 0.000 0.000 0.000
#> GSM617634     3  0.6131    -0.1032 0.000 0.332 0.340 0.000 0.000 0.328
#> GSM617635     1  0.5015     0.1767 0.504 0.000 0.424 0.000 0.000 0.072
#> GSM617636     1  0.0937     0.8216 0.960 0.000 0.040 0.000 0.000 0.000
#> GSM617637     1  0.0000     0.8410 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM617638     3  0.2685     0.5629 0.072 0.060 0.868 0.000 0.000 0.000
#> GSM617639     1  0.0000     0.8410 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM617640     2  0.2340     0.7861 0.000 0.852 0.000 0.000 0.000 0.148
#> GSM617641     4  0.0000     0.9510 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM617643     6  0.3868     0.0799 0.000 0.496 0.000 0.000 0.000 0.504
#> GSM617644     6  0.3868     0.0799 0.000 0.496 0.000 0.000 0.000 0.504
#> GSM617647     6  0.5787     0.2120 0.000 0.252 0.000 0.000 0.244 0.504
#> GSM617648     6  0.3868     0.0799 0.000 0.496 0.000 0.000 0.000 0.504
#> GSM617649     6  0.3868     0.0799 0.000 0.496 0.000 0.000 0.000 0.504
#> GSM617650     1  0.0000     0.8410 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM617651     5  0.0000     0.9673 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM617653     5  0.0000     0.9673 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM617654     2  0.3737     0.2318 0.000 0.608 0.000 0.000 0.000 0.392
#> GSM617583     6  0.5061    -0.4315 0.076 0.000 0.428 0.000 0.000 0.496
#> GSM617584     4  0.2981     0.7681 0.000 0.020 0.000 0.820 0.000 0.160
#> GSM617585     2  0.0000     0.8089 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM617586     3  0.0937     0.5801 0.000 0.000 0.960 0.000 0.000 0.040
#> GSM617587     3  0.5184     0.2801 0.000 0.316 0.572 0.000 0.112 0.000
#> GSM617589     4  0.0790     0.9292 0.000 0.032 0.000 0.968 0.000 0.000
#> GSM617591     2  0.0000     0.8089 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM617593     1  0.0000     0.8410 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM617594     2  0.2454     0.7776 0.000 0.840 0.000 0.000 0.000 0.160
#> GSM617595     5  0.0000     0.9673 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM617596     5  0.0000     0.9673 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM617597     3  0.1633     0.5864 0.044 0.000 0.932 0.000 0.000 0.024
#> GSM617598     1  0.0000     0.8410 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM617599     2  0.2703     0.7643 0.000 0.824 0.004 0.000 0.000 0.172
#> GSM617600     3  0.3868     0.4139 0.000 0.000 0.504 0.000 0.000 0.496
#> GSM617601     2  0.0632     0.8131 0.000 0.976 0.000 0.000 0.000 0.024
#> GSM617602     3  0.3868     0.4139 0.000 0.000 0.504 0.000 0.000 0.496
#> GSM617603     6  0.5029     0.0845 0.000 0.444 0.000 0.072 0.000 0.484
#> GSM617604     1  0.3482     0.5290 0.684 0.000 0.000 0.000 0.316 0.000
#> GSM617605     2  0.2883     0.6823 0.000 0.788 0.000 0.212 0.000 0.000
#> GSM617606     2  0.0000     0.8089 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM617610     5  0.0000     0.9673 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM617611     1  0.0000     0.8410 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM617613     3  0.3868     0.4139 0.000 0.000 0.504 0.000 0.000 0.496
#> GSM617614     1  0.0000     0.8410 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM617621     1  0.0000     0.8410 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM617629     3  0.0547     0.5831 0.000 0.000 0.980 0.000 0.000 0.020
#> GSM617630     2  0.0547     0.7918 0.000 0.980 0.020 0.000 0.000 0.000
#> GSM617631     3  0.3868     0.4139 0.000 0.000 0.504 0.000 0.000 0.496
#> GSM617633     1  0.5697     0.0774 0.476 0.000 0.356 0.000 0.000 0.168
#> GSM617642     1  0.2956     0.7314 0.840 0.000 0.040 0.000 0.000 0.120
#> GSM617645     2  0.2416     0.7810 0.000 0.844 0.000 0.000 0.000 0.156
#> GSM617646     1  0.5855     0.1625 0.408 0.000 0.192 0.000 0.400 0.000
#> GSM617652     3  0.3867    -0.1097 0.488 0.000 0.512 0.000 0.000 0.000
#> GSM617655     3  0.3868     0.4139 0.000 0.000 0.504 0.000 0.000 0.496
#> GSM617656     3  0.3868     0.4139 0.000 0.000 0.504 0.000 0.000 0.496
#> GSM617657     3  0.4061     0.4797 0.000 0.248 0.708 0.000 0.000 0.044
#> GSM617658     3  0.3823     0.0555 0.436 0.000 0.564 0.000 0.000 0.000
#> GSM617659     1  0.0000     0.8410 1.000 0.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-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) k
#> ATC:pam 77            0.204 2
#> ATC:pam 75            0.216 3
#> ATC:pam 74            0.401 4
#> ATC:pam 76            0.246 5
#> ATC:pam 50            0.250 6

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


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

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

collect_plots(res)

plot of chunk ATC-mclust-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.150           0.000       0.656         0.3687 1.000   1.000
#> 3 3 0.559           0.838       0.868         0.6381 0.361   0.361
#> 4 4 0.898           0.924       0.968         0.1803 0.853   0.630
#> 5 5 0.661           0.724       0.812         0.0595 1.000   1.000
#> 6 6 0.709           0.672       0.803         0.0619 0.852   0.520

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

suggest_best_k(res)
#> [1] 4

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

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

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>           class entropy silhouette    p1    p2
#> GSM617581     1   0.886          0 0.696 0.304
#> GSM617582     1   0.689          0 0.816 0.184
#> GSM617588     1   0.952          0 0.628 0.372
#> GSM617590     1   0.952          0 0.628 0.372
#> GSM617592     1   0.952          0 0.628 0.372
#> GSM617607     1   1.000          0 0.512 0.488
#> GSM617608     1   1.000          0 0.512 0.488
#> GSM617609     1   0.998          0 0.528 0.472
#> GSM617612     1   0.574          0 0.864 0.136
#> GSM617615     1   0.802          0 0.756 0.244
#> GSM617616     1   0.946          0 0.636 0.364
#> GSM617617     1   0.788          0 0.764 0.236
#> GSM617618     1   0.224          0 0.964 0.036
#> GSM617619     1   0.781          0 0.768 0.232
#> GSM617620     1   0.952          0 0.628 0.372
#> GSM617622     1   0.788          0 0.764 0.236
#> GSM617623     1   0.958          0 0.620 0.380
#> GSM617624     1   0.644          0 0.836 0.164
#> GSM617625     1   1.000          0 0.512 0.488
#> GSM617626     1   0.900          0 0.684 0.316
#> GSM617627     1   0.260          0 0.956 0.044
#> GSM617628     1   1.000          0 0.512 0.488
#> GSM617632     1   0.722          0 0.800 0.200
#> GSM617634     1   0.184          0 0.972 0.028
#> GSM617635     1   0.671          0 0.824 0.176
#> GSM617636     1   0.999          0 0.516 0.484
#> GSM617637     1   0.689          0 0.816 0.184
#> GSM617638     1   0.000          0 1.000 0.000
#> GSM617639     1   0.917          0 0.668 0.332
#> GSM617640     1   0.946          0 0.636 0.364
#> GSM617641     1   0.952          0 0.628 0.372
#> GSM617643     1   0.939          0 0.644 0.356
#> GSM617644     1   0.936          0 0.648 0.352
#> GSM617647     1   0.788          0 0.764 0.236
#> GSM617648     1   0.929          0 0.656 0.344
#> GSM617649     1   0.788          0 0.764 0.236
#> GSM617650     1   0.738          0 0.792 0.208
#> GSM617651     1   0.653          0 0.832 0.168
#> GSM617653     1   0.900          0 0.684 0.316
#> GSM617654     1   0.814          0 0.748 0.252
#> GSM617583     1   0.993          0 0.548 0.452
#> GSM617584     1   0.952          0 0.628 0.372
#> GSM617585     1   0.909          0 0.676 0.324
#> GSM617586     1   1.000          0 0.512 0.488
#> GSM617587     1   0.224          0 0.964 0.036
#> GSM617589     1   0.952          0 0.628 0.372
#> GSM617591     1   0.814          0 0.748 0.252
#> GSM617593     1   0.913          0 0.672 0.328
#> GSM617594     1   0.788          0 0.764 0.236
#> GSM617595     1   0.494          0 0.892 0.108
#> GSM617596     1   0.844          0 0.728 0.272
#> GSM617597     1   1.000          0 0.512 0.488
#> GSM617598     1   0.706          0 0.808 0.192
#> GSM617599     1   0.788          0 0.764 0.236
#> GSM617600     1   0.760          0 0.780 0.220
#> GSM617601     1   0.788          0 0.764 0.236
#> GSM617602     1   0.999          0 0.516 0.484
#> GSM617603     1   0.952          0 0.628 0.372
#> GSM617604     1   0.000          0 1.000 0.000
#> GSM617605     1   0.952          0 0.628 0.372
#> GSM617606     1   0.921          0 0.664 0.336
#> GSM617610     1   0.900          0 0.684 0.316
#> GSM617611     1   0.760          0 0.780 0.220
#> GSM617613     1   0.722          0 0.800 0.200
#> GSM617614     1   0.722          0 0.800 0.200
#> GSM617621     1   0.900          0 0.684 0.316
#> GSM617629     1   0.738          0 0.792 0.208
#> GSM617630     1   0.814          0 0.748 0.252
#> GSM617631     1   0.788          0 0.764 0.236
#> GSM617633     1   0.753          0 0.784 0.216
#> GSM617642     1   0.936          0 0.648 0.352
#> GSM617645     1   0.952          0 0.628 0.372
#> GSM617646     1   0.680          0 0.820 0.180
#> GSM617652     1   1.000          0 0.512 0.488
#> GSM617655     1   0.827          0 0.740 0.260
#> GSM617656     1   0.775          0 0.772 0.228
#> GSM617657     1   0.855          0 0.720 0.280
#> GSM617658     1   0.000          0 1.000 0.000
#> GSM617659     1   0.714          0 0.804 0.196

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>           class entropy silhouette    p1    p2    p3
#> GSM617581     2  0.3742     0.8632 0.036 0.892 0.072
#> GSM617582     2  0.5734     0.7903 0.048 0.788 0.164
#> GSM617588     2  0.0747     0.8806 0.016 0.984 0.000
#> GSM617590     2  0.0592     0.8804 0.012 0.988 0.000
#> GSM617592     2  0.0592     0.8804 0.012 0.988 0.000
#> GSM617607     3  0.0592     0.9219 0.012 0.000 0.988
#> GSM617608     3  0.0592     0.9219 0.012 0.000 0.988
#> GSM617609     3  0.0237     0.9223 0.004 0.000 0.996
#> GSM617612     1  0.4842     0.8508 0.776 0.000 0.224
#> GSM617615     2  0.4413     0.8571 0.160 0.832 0.008
#> GSM617616     3  0.0592     0.9219 0.012 0.000 0.988
#> GSM617617     2  0.5631     0.7914 0.044 0.792 0.164
#> GSM617618     3  0.2096     0.9046 0.004 0.052 0.944
#> GSM617619     2  0.5734     0.7903 0.048 0.788 0.164
#> GSM617620     2  0.0592     0.8804 0.012 0.988 0.000
#> GSM617622     2  0.5734     0.8472 0.164 0.788 0.048
#> GSM617623     2  0.1753     0.8789 0.048 0.952 0.000
#> GSM617624     2  0.6100     0.8299 0.120 0.784 0.096
#> GSM617625     3  0.0000     0.9218 0.000 0.000 1.000
#> GSM617626     1  0.5406     0.8505 0.764 0.012 0.224
#> GSM617627     2  0.4750     0.7403 0.000 0.784 0.216
#> GSM617628     3  0.0000     0.9218 0.000 0.000 1.000
#> GSM617632     3  0.6955     0.0752 0.332 0.032 0.636
#> GSM617634     2  0.5974     0.8416 0.148 0.784 0.068
#> GSM617635     3  0.4609     0.8160 0.092 0.052 0.856
#> GSM617636     3  0.0592     0.9219 0.012 0.000 0.988
#> GSM617637     1  0.7116     0.7719 0.636 0.040 0.324
#> GSM617638     3  0.5905     0.6236 0.044 0.184 0.772
#> GSM617639     1  0.4974     0.8507 0.764 0.000 0.236
#> GSM617640     2  0.1753     0.8789 0.048 0.952 0.000
#> GSM617641     2  0.0592     0.8804 0.012 0.988 0.000
#> GSM617643     2  0.4121     0.8544 0.168 0.832 0.000
#> GSM617644     2  0.4121     0.8544 0.168 0.832 0.000
#> GSM617647     2  0.4634     0.8553 0.164 0.824 0.012
#> GSM617648     2  0.4121     0.8544 0.168 0.832 0.000
#> GSM617649     2  0.4782     0.8551 0.164 0.820 0.016
#> GSM617650     3  0.2918     0.8953 0.044 0.032 0.924
#> GSM617651     1  0.5024     0.8488 0.776 0.004 0.220
#> GSM617653     1  0.5292     0.8522 0.764 0.008 0.228
#> GSM617654     2  0.2339     0.8790 0.048 0.940 0.012
#> GSM617583     3  0.0000     0.9218 0.000 0.000 1.000
#> GSM617584     2  0.0237     0.8814 0.004 0.996 0.000
#> GSM617585     2  0.1753     0.8789 0.048 0.952 0.000
#> GSM617586     3  0.0000     0.9218 0.000 0.000 1.000
#> GSM617587     2  0.6357     0.5071 0.012 0.652 0.336
#> GSM617589     2  0.0592     0.8804 0.012 0.988 0.000
#> GSM617591     2  0.1753     0.8789 0.048 0.952 0.000
#> GSM617593     1  0.6309     0.5239 0.504 0.000 0.496
#> GSM617594     2  0.5524     0.8500 0.164 0.796 0.040
#> GSM617595     1  0.7447     0.6831 0.700 0.160 0.140
#> GSM617596     1  0.4842     0.8508 0.776 0.000 0.224
#> GSM617597     3  0.0000     0.9218 0.000 0.000 1.000
#> GSM617598     1  0.7484     0.5713 0.504 0.036 0.460
#> GSM617599     2  0.5269     0.7566 0.016 0.784 0.200
#> GSM617600     3  0.1289     0.9226 0.000 0.032 0.968
#> GSM617601     2  0.4663     0.8584 0.156 0.828 0.016
#> GSM617602     3  0.0000     0.9218 0.000 0.000 1.000
#> GSM617603     2  0.0592     0.8804 0.012 0.988 0.000
#> GSM617604     1  0.8902     0.6729 0.536 0.144 0.320
#> GSM617605     2  0.1411     0.8794 0.036 0.964 0.000
#> GSM617606     2  0.1753     0.8789 0.048 0.952 0.000
#> GSM617610     1  0.4842     0.8508 0.776 0.000 0.224
#> GSM617611     1  0.6126     0.7198 0.600 0.000 0.400
#> GSM617613     3  0.1289     0.9226 0.000 0.032 0.968
#> GSM617614     3  0.1877     0.9193 0.012 0.032 0.956
#> GSM617621     1  0.4974     0.8507 0.764 0.000 0.236
#> GSM617629     3  0.1950     0.9128 0.008 0.040 0.952
#> GSM617630     2  0.1753     0.8789 0.048 0.952 0.000
#> GSM617631     3  0.1289     0.9226 0.000 0.032 0.968
#> GSM617633     3  0.2550     0.9030 0.024 0.040 0.936
#> GSM617642     3  0.1337     0.9249 0.012 0.016 0.972
#> GSM617645     2  0.1753     0.8789 0.048 0.952 0.000
#> GSM617646     1  0.6905     0.7689 0.676 0.044 0.280
#> GSM617652     3  0.0592     0.9219 0.012 0.000 0.988
#> GSM617655     3  0.1163     0.9241 0.000 0.028 0.972
#> GSM617656     3  0.1289     0.9226 0.000 0.032 0.968
#> GSM617657     2  0.4796     0.7349 0.000 0.780 0.220
#> GSM617658     3  0.3112     0.8818 0.028 0.056 0.916
#> GSM617659     3  0.2806     0.8996 0.040 0.032 0.928

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM617581     1  0.3649      0.708 0.796 0.204 0.000 0.000
#> GSM617582     2  0.0000      0.999 0.000 1.000 0.000 0.000
#> GSM617588     4  0.0188      0.870 0.000 0.004 0.000 0.996
#> GSM617590     4  0.4972      0.213 0.000 0.456 0.000 0.544
#> GSM617592     4  0.0000      0.869 0.000 0.000 0.000 1.000
#> GSM617607     3  0.0000      0.957 0.000 0.000 1.000 0.000
#> GSM617608     3  0.0000      0.957 0.000 0.000 1.000 0.000
#> GSM617609     3  0.0000      0.957 0.000 0.000 1.000 0.000
#> GSM617612     1  0.0000      0.957 1.000 0.000 0.000 0.000
#> GSM617615     2  0.0000      0.999 0.000 1.000 0.000 0.000
#> GSM617616     3  0.0000      0.957 0.000 0.000 1.000 0.000
#> GSM617617     2  0.0000      0.999 0.000 1.000 0.000 0.000
#> GSM617618     3  0.3636      0.755 0.008 0.172 0.820 0.000
#> GSM617619     2  0.0000      0.999 0.000 1.000 0.000 0.000
#> GSM617620     4  0.0000      0.869 0.000 0.000 0.000 1.000
#> GSM617622     2  0.0000      0.999 0.000 1.000 0.000 0.000
#> GSM617623     1  0.3649      0.708 0.796 0.204 0.000 0.000
#> GSM617624     2  0.0000      0.999 0.000 1.000 0.000 0.000
#> GSM617625     3  0.0000      0.957 0.000 0.000 1.000 0.000
#> GSM617626     1  0.0000      0.957 1.000 0.000 0.000 0.000
#> GSM617627     2  0.0000      0.999 0.000 1.000 0.000 0.000
#> GSM617628     3  0.0000      0.957 0.000 0.000 1.000 0.000
#> GSM617632     3  0.2408      0.871 0.104 0.000 0.896 0.000
#> GSM617634     2  0.0000      0.999 0.000 1.000 0.000 0.000
#> GSM617635     3  0.0000      0.957 0.000 0.000 1.000 0.000
#> GSM617636     3  0.0000      0.957 0.000 0.000 1.000 0.000
#> GSM617637     1  0.0000      0.957 1.000 0.000 0.000 0.000
#> GSM617638     3  0.3356      0.754 0.000 0.176 0.824 0.000
#> GSM617639     1  0.0000      0.957 1.000 0.000 0.000 0.000
#> GSM617640     2  0.0000      0.999 0.000 1.000 0.000 0.000
#> GSM617641     4  0.0000      0.869 0.000 0.000 0.000 1.000
#> GSM617643     2  0.0000      0.999 0.000 1.000 0.000 0.000
#> GSM617644     2  0.0000      0.999 0.000 1.000 0.000 0.000
#> GSM617647     2  0.0000      0.999 0.000 1.000 0.000 0.000
#> GSM617648     2  0.0000      0.999 0.000 1.000 0.000 0.000
#> GSM617649     2  0.0000      0.999 0.000 1.000 0.000 0.000
#> GSM617650     3  0.0000      0.957 0.000 0.000 1.000 0.000
#> GSM617651     1  0.0000      0.957 1.000 0.000 0.000 0.000
#> GSM617653     1  0.0000      0.957 1.000 0.000 0.000 0.000
#> GSM617654     2  0.0000      0.999 0.000 1.000 0.000 0.000
#> GSM617583     3  0.0000      0.957 0.000 0.000 1.000 0.000
#> GSM617584     4  0.3688      0.741 0.000 0.208 0.000 0.792
#> GSM617585     2  0.0000      0.999 0.000 1.000 0.000 0.000
#> GSM617586     3  0.0000      0.957 0.000 0.000 1.000 0.000
#> GSM617587     2  0.0188      0.994 0.004 0.996 0.000 0.000
#> GSM617589     4  0.0188      0.870 0.000 0.004 0.000 0.996
#> GSM617591     2  0.0000      0.999 0.000 1.000 0.000 0.000
#> GSM617593     3  0.3024      0.821 0.148 0.000 0.852 0.000
#> GSM617594     2  0.0000      0.999 0.000 1.000 0.000 0.000
#> GSM617595     1  0.0000      0.957 1.000 0.000 0.000 0.000
#> GSM617596     1  0.0000      0.957 1.000 0.000 0.000 0.000
#> GSM617597     3  0.0000      0.957 0.000 0.000 1.000 0.000
#> GSM617598     3  0.3801      0.726 0.220 0.000 0.780 0.000
#> GSM617599     2  0.0000      0.999 0.000 1.000 0.000 0.000
#> GSM617600     3  0.0000      0.957 0.000 0.000 1.000 0.000
#> GSM617601     2  0.0000      0.999 0.000 1.000 0.000 0.000
#> GSM617602     3  0.0000      0.957 0.000 0.000 1.000 0.000
#> GSM617603     4  0.0336      0.870 0.000 0.008 0.000 0.992
#> GSM617604     1  0.0000      0.957 1.000 0.000 0.000 0.000
#> GSM617605     4  0.1118      0.860 0.000 0.036 0.000 0.964
#> GSM617606     2  0.0000      0.999 0.000 1.000 0.000 0.000
#> GSM617610     1  0.0000      0.957 1.000 0.000 0.000 0.000
#> GSM617611     3  0.4500      0.563 0.316 0.000 0.684 0.000
#> GSM617613     3  0.0000      0.957 0.000 0.000 1.000 0.000
#> GSM617614     3  0.0000      0.957 0.000 0.000 1.000 0.000
#> GSM617621     1  0.0000      0.957 1.000 0.000 0.000 0.000
#> GSM617629     3  0.0000      0.957 0.000 0.000 1.000 0.000
#> GSM617630     2  0.0000      0.999 0.000 1.000 0.000 0.000
#> GSM617631     3  0.0000      0.957 0.000 0.000 1.000 0.000
#> GSM617633     3  0.0000      0.957 0.000 0.000 1.000 0.000
#> GSM617642     3  0.0000      0.957 0.000 0.000 1.000 0.000
#> GSM617645     4  0.3726      0.738 0.000 0.212 0.000 0.788
#> GSM617646     1  0.0000      0.957 1.000 0.000 0.000 0.000
#> GSM617652     3  0.0000      0.957 0.000 0.000 1.000 0.000
#> GSM617655     3  0.0000      0.957 0.000 0.000 1.000 0.000
#> GSM617656     3  0.0000      0.957 0.000 0.000 1.000 0.000
#> GSM617657     2  0.0592      0.976 0.000 0.984 0.016 0.000
#> GSM617658     3  0.0000      0.957 0.000 0.000 1.000 0.000
#> GSM617659     3  0.0000      0.957 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
#> GSM617581     1  0.6598      0.416 0.620 0.160 0.004 0.164 NA
#> GSM617582     2  0.4444      0.770 0.000 0.800 0.056 0.088 NA
#> GSM617588     4  0.0000      0.796 0.000 0.000 0.000 1.000 NA
#> GSM617590     4  0.5899      0.648 0.000 0.160 0.000 0.592 NA
#> GSM617592     4  0.0000      0.796 0.000 0.000 0.000 1.000 NA
#> GSM617607     3  0.0404      0.811 0.000 0.000 0.988 0.000 NA
#> GSM617608     3  0.0510      0.811 0.000 0.000 0.984 0.000 NA
#> GSM617609     3  0.1121      0.810 0.000 0.000 0.956 0.000 NA
#> GSM617612     1  0.0000      0.831 1.000 0.000 0.000 0.000 NA
#> GSM617615     2  0.0162      0.815 0.000 0.996 0.000 0.004 NA
#> GSM617616     3  0.1043      0.809 0.000 0.000 0.960 0.000 NA
#> GSM617617     2  0.4700      0.734 0.012 0.760 0.004 0.156 NA
#> GSM617618     3  0.4668      0.542 0.028 0.276 0.688 0.000 NA
#> GSM617619     2  0.4444      0.770 0.000 0.800 0.056 0.088 NA
#> GSM617620     4  0.0609      0.787 0.000 0.000 0.000 0.980 NA
#> GSM617622     2  0.0000      0.814 0.000 1.000 0.000 0.000 NA
#> GSM617623     1  0.6598      0.416 0.620 0.160 0.004 0.164 NA
#> GSM617624     2  0.0000      0.814 0.000 1.000 0.000 0.000 NA
#> GSM617625     3  0.0566      0.812 0.004 0.000 0.984 0.000 NA
#> GSM617626     1  0.0000      0.831 1.000 0.000 0.000 0.000 NA
#> GSM617627     2  0.3834      0.733 0.000 0.812 0.140 0.012 NA
#> GSM617628     3  0.1671      0.806 0.000 0.000 0.924 0.000 NA
#> GSM617632     3  0.5112      0.649 0.080 0.000 0.664 0.000 NA
#> GSM617634     2  0.0290      0.814 0.000 0.992 0.008 0.000 NA
#> GSM617635     3  0.3990      0.680 0.004 0.000 0.688 0.000 NA
#> GSM617636     3  0.1831      0.801 0.004 0.000 0.920 0.000 NA
#> GSM617637     1  0.5708      0.546 0.528 0.000 0.088 0.000 NA
#> GSM617638     3  0.3224      0.704 0.000 0.160 0.824 0.000 NA
#> GSM617639     1  0.2971      0.755 0.836 0.000 0.008 0.000 NA
#> GSM617640     2  0.6257      0.431 0.000 0.512 0.000 0.168 NA
#> GSM617641     4  0.0609      0.787 0.000 0.000 0.000 0.980 NA
#> GSM617643     2  0.0609      0.815 0.000 0.980 0.000 0.020 NA
#> GSM617644     2  0.0609      0.815 0.000 0.980 0.000 0.020 NA
#> GSM617647     2  0.0609      0.815 0.000 0.980 0.000 0.020 NA
#> GSM617648     2  0.0609      0.815 0.000 0.980 0.000 0.020 NA
#> GSM617649     2  0.0000      0.814 0.000 1.000 0.000 0.000 NA
#> GSM617650     3  0.3766      0.708 0.004 0.000 0.728 0.000 NA
#> GSM617651     1  0.0000      0.831 1.000 0.000 0.000 0.000 NA
#> GSM617653     1  0.0000      0.831 1.000 0.000 0.000 0.000 NA
#> GSM617654     2  0.4412      0.731 0.000 0.756 0.000 0.164 NA
#> GSM617583     3  0.2179      0.801 0.004 0.000 0.896 0.000 NA
#> GSM617584     4  0.3847      0.651 0.000 0.180 0.000 0.784 NA
#> GSM617585     2  0.6118      0.485 0.000 0.548 0.000 0.164 NA
#> GSM617586     3  0.2127      0.798 0.000 0.000 0.892 0.000 NA
#> GSM617587     2  0.3764      0.709 0.044 0.800 0.156 0.000 NA
#> GSM617589     4  0.3491      0.797 0.000 0.004 0.000 0.768 NA
#> GSM617591     2  0.5123      0.672 0.000 0.696 0.000 0.144 NA
#> GSM617593     3  0.6049      0.493 0.164 0.000 0.564 0.000 NA
#> GSM617594     2  0.0000      0.814 0.000 1.000 0.000 0.000 NA
#> GSM617595     1  0.2561      0.787 0.856 0.000 0.000 0.000 NA
#> GSM617596     1  0.0162      0.828 0.996 0.000 0.004 0.000 NA
#> GSM617597     3  0.0451      0.812 0.004 0.000 0.988 0.000 NA
#> GSM617598     3  0.6376      0.380 0.192 0.000 0.500 0.000 NA
#> GSM617599     2  0.2020      0.794 0.000 0.900 0.000 0.100 NA
#> GSM617600     3  0.3395      0.742 0.000 0.000 0.764 0.000 NA
#> GSM617601     2  0.0162      0.815 0.000 0.996 0.004 0.000 NA
#> GSM617602     3  0.3366      0.744 0.000 0.000 0.768 0.000 NA
#> GSM617603     4  0.3612      0.797 0.000 0.008 0.000 0.764 NA
#> GSM617604     1  0.2605      0.720 0.852 0.000 0.148 0.000 NA
#> GSM617605     4  0.4206      0.783 0.000 0.020 0.000 0.708 NA
#> GSM617606     2  0.6118      0.485 0.000 0.548 0.000 0.164 NA
#> GSM617610     1  0.0000      0.831 1.000 0.000 0.000 0.000 NA
#> GSM617611     3  0.6650      0.225 0.280 0.000 0.448 0.000 NA
#> GSM617613     3  0.3395      0.742 0.000 0.000 0.764 0.000 NA
#> GSM617614     3  0.3123      0.758 0.004 0.000 0.812 0.000 NA
#> GSM617621     1  0.0000      0.831 1.000 0.000 0.000 0.000 NA
#> GSM617629     3  0.2329      0.792 0.000 0.000 0.876 0.000 NA
#> GSM617630     2  0.6241      0.435 0.000 0.512 0.000 0.164 NA
#> GSM617631     3  0.3366      0.744 0.000 0.000 0.768 0.000 NA
#> GSM617633     3  0.0451      0.812 0.004 0.000 0.988 0.000 NA
#> GSM617642     3  0.3550      0.729 0.004 0.000 0.760 0.000 NA
#> GSM617645     4  0.6158      0.600 0.000 0.156 0.000 0.528 NA
#> GSM617646     1  0.4482      0.656 0.636 0.000 0.016 0.000 NA
#> GSM617652     3  0.2179      0.791 0.000 0.000 0.888 0.000 NA
#> GSM617655     3  0.3521      0.745 0.004 0.000 0.764 0.000 NA
#> GSM617656     3  0.3521      0.745 0.004 0.000 0.764 0.000 NA
#> GSM617657     2  0.3696      0.656 0.000 0.772 0.212 0.000 NA
#> GSM617658     3  0.1732      0.805 0.000 0.000 0.920 0.000 NA
#> GSM617659     3  0.3766      0.708 0.004 0.000 0.728 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
#> GSM617581     1  0.4127     0.5593 0.716 0.044 0.000 0.000 0.236 0.004
#> GSM617582     2  0.4178     0.4607 0.000 0.608 0.000 0.000 0.372 0.020
#> GSM617588     4  0.2118     0.7925 0.000 0.008 0.000 0.888 0.104 0.000
#> GSM617590     5  0.4343     0.5610 0.000 0.048 0.000 0.244 0.700 0.008
#> GSM617592     4  0.1204     0.8334 0.000 0.000 0.000 0.944 0.056 0.000
#> GSM617607     3  0.2442     0.7622 0.000 0.000 0.852 0.000 0.004 0.144
#> GSM617608     3  0.2632     0.7530 0.000 0.000 0.832 0.000 0.004 0.164
#> GSM617609     3  0.1806     0.7922 0.000 0.000 0.908 0.000 0.004 0.088
#> GSM617612     1  0.2135     0.8292 0.872 0.000 0.000 0.000 0.000 0.128
#> GSM617615     2  0.0000     0.8285 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM617616     3  0.3337     0.6054 0.000 0.000 0.736 0.000 0.004 0.260
#> GSM617617     2  0.5296     0.4438 0.128 0.564 0.000 0.000 0.308 0.000
#> GSM617618     3  0.4820     0.6436 0.056 0.140 0.728 0.000 0.000 0.076
#> GSM617619     2  0.5106     0.4037 0.000 0.564 0.048 0.000 0.368 0.020
#> GSM617620     4  0.0000     0.8341 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM617622     2  0.0000     0.8285 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM617623     1  0.4127     0.5593 0.716 0.044 0.000 0.000 0.236 0.004
#> GSM617624     2  0.0725     0.8286 0.000 0.976 0.000 0.000 0.012 0.012
#> GSM617625     3  0.2793     0.7246 0.000 0.000 0.800 0.000 0.000 0.200
#> GSM617626     1  0.1663     0.8606 0.912 0.000 0.000 0.000 0.000 0.088
#> GSM617627     2  0.4603     0.6417 0.000 0.712 0.068 0.000 0.200 0.020
#> GSM617628     3  0.1471     0.7973 0.000 0.000 0.932 0.000 0.004 0.064
#> GSM617632     6  0.3991     0.7444 0.088 0.000 0.156 0.000 0.000 0.756
#> GSM617634     2  0.1167     0.8225 0.000 0.960 0.012 0.000 0.008 0.020
#> GSM617635     6  0.2454     0.7550 0.000 0.000 0.160 0.000 0.000 0.840
#> GSM617636     6  0.3866     0.1037 0.000 0.000 0.484 0.000 0.000 0.516
#> GSM617637     6  0.3221     0.4142 0.264 0.000 0.000 0.000 0.000 0.736
#> GSM617638     3  0.3781     0.7600 0.016 0.040 0.820 0.000 0.024 0.100
#> GSM617639     6  0.3989     0.0380 0.468 0.000 0.004 0.000 0.000 0.528
#> GSM617640     5  0.1285     0.6810 0.004 0.052 0.000 0.000 0.944 0.000
#> GSM617641     4  0.0000     0.8341 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM617643     2  0.0790     0.8252 0.000 0.968 0.000 0.000 0.032 0.000
#> GSM617644     2  0.0790     0.8252 0.000 0.968 0.000 0.000 0.032 0.000
#> GSM617647     2  0.0713     0.8255 0.000 0.972 0.000 0.000 0.028 0.000
#> GSM617648     2  0.0458     0.8282 0.000 0.984 0.000 0.000 0.016 0.000
#> GSM617649     2  0.0000     0.8285 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM617650     6  0.2562     0.7549 0.000 0.000 0.172 0.000 0.000 0.828
#> GSM617651     1  0.0937     0.8574 0.960 0.000 0.000 0.000 0.000 0.040
#> GSM617653     1  0.1531     0.8683 0.928 0.000 0.004 0.000 0.000 0.068
#> GSM617654     2  0.3989     0.3294 0.004 0.528 0.000 0.000 0.468 0.000
#> GSM617583     3  0.2618     0.7640 0.000 0.000 0.860 0.000 0.024 0.116
#> GSM617584     4  0.4965     0.5194 0.000 0.140 0.000 0.644 0.216 0.000
#> GSM617585     5  0.2841     0.6743 0.000 0.164 0.000 0.000 0.824 0.012
#> GSM617586     3  0.1349     0.7973 0.000 0.000 0.940 0.000 0.004 0.056
#> GSM617587     2  0.5559     0.5423 0.044 0.664 0.188 0.000 0.012 0.092
#> GSM617589     5  0.5197     0.2434 0.000 0.068 0.000 0.420 0.504 0.008
#> GSM617591     5  0.3874     0.3160 0.000 0.356 0.000 0.000 0.636 0.008
#> GSM617593     6  0.3348     0.7429 0.016 0.000 0.216 0.000 0.000 0.768
#> GSM617594     2  0.0000     0.8285 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM617595     1  0.3330     0.7051 0.716 0.000 0.000 0.000 0.000 0.284
#> GSM617596     1  0.1204     0.8653 0.944 0.000 0.000 0.000 0.000 0.056
#> GSM617597     3  0.2730     0.7371 0.000 0.000 0.808 0.000 0.000 0.192
#> GSM617598     6  0.2613     0.7533 0.012 0.000 0.140 0.000 0.000 0.848
#> GSM617599     2  0.1204     0.8069 0.000 0.944 0.000 0.000 0.056 0.000
#> GSM617600     3  0.2088     0.7554 0.000 0.000 0.904 0.000 0.028 0.068
#> GSM617601     2  0.0363     0.8298 0.000 0.988 0.000 0.000 0.012 0.000
#> GSM617602     3  0.1492     0.7757 0.000 0.000 0.940 0.000 0.024 0.036
#> GSM617603     5  0.5279     0.2404 0.000 0.076 0.000 0.416 0.500 0.008
#> GSM617604     1  0.2039     0.8016 0.904 0.000 0.076 0.000 0.020 0.000
#> GSM617605     5  0.3510     0.6147 0.000 0.016 0.000 0.204 0.772 0.008
#> GSM617606     5  0.2632     0.6767 0.000 0.164 0.000 0.000 0.832 0.004
#> GSM617610     1  0.1387     0.8677 0.932 0.000 0.000 0.000 0.000 0.068
#> GSM617611     6  0.3683     0.7545 0.044 0.000 0.192 0.000 0.000 0.764
#> GSM617613     3  0.2088     0.7554 0.000 0.000 0.904 0.000 0.028 0.068
#> GSM617614     6  0.3499     0.6133 0.000 0.000 0.320 0.000 0.000 0.680
#> GSM617621     1  0.1531     0.8683 0.928 0.000 0.004 0.000 0.000 0.068
#> GSM617629     3  0.0935     0.7933 0.000 0.004 0.964 0.000 0.000 0.032
#> GSM617630     5  0.1204     0.6826 0.000 0.056 0.000 0.000 0.944 0.000
#> GSM617631     3  0.2009     0.7595 0.000 0.000 0.908 0.000 0.024 0.068
#> GSM617633     3  0.3330     0.6480 0.000 0.000 0.716 0.000 0.000 0.284
#> GSM617642     6  0.3244     0.7020 0.000 0.000 0.268 0.000 0.000 0.732
#> GSM617645     5  0.2705     0.6569 0.004 0.040 0.000 0.076 0.876 0.004
#> GSM617646     6  0.3368     0.4836 0.232 0.000 0.012 0.000 0.000 0.756
#> GSM617652     3  0.3923     0.1272 0.000 0.000 0.580 0.000 0.004 0.416
#> GSM617655     3  0.2573     0.7532 0.000 0.000 0.864 0.000 0.024 0.112
#> GSM617656     3  0.2122     0.7600 0.000 0.000 0.900 0.000 0.024 0.076
#> GSM617657     3  0.5183    -0.0264 0.000 0.456 0.480 0.000 0.040 0.024
#> GSM617658     3  0.1812     0.7940 0.000 0.000 0.912 0.000 0.008 0.080
#> GSM617659     6  0.3266     0.6936 0.000 0.000 0.272 0.000 0.000 0.728

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

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

collect_plots(res)

plot of chunk ATC-NMF-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.999           0.957       0.982         0.4617 0.529   0.529
#> 3 3 0.645           0.723       0.887         0.3897 0.759   0.569
#> 4 4 0.515           0.570       0.781         0.1448 0.798   0.500
#> 5 5 0.554           0.565       0.739         0.0703 0.779   0.354
#> 6 6 0.545           0.478       0.679         0.0334 0.969   0.854

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
#> GSM617581     2  0.0672      0.948 0.008 0.992
#> GSM617582     1  0.0938      0.986 0.988 0.012
#> GSM617588     2  0.0000      0.953 0.000 1.000
#> GSM617590     2  0.0000      0.953 0.000 1.000
#> GSM617592     2  0.0000      0.953 0.000 1.000
#> GSM617607     1  0.0000      0.997 1.000 0.000
#> GSM617608     1  0.0000      0.997 1.000 0.000
#> GSM617609     1  0.0000      0.997 1.000 0.000
#> GSM617612     1  0.0000      0.997 1.000 0.000
#> GSM617615     2  0.0000      0.953 0.000 1.000
#> GSM617616     1  0.0000      0.997 1.000 0.000
#> GSM617617     2  0.1843      0.933 0.028 0.972
#> GSM617618     1  0.0000      0.997 1.000 0.000
#> GSM617619     1  0.0376      0.994 0.996 0.004
#> GSM617620     2  0.0000      0.953 0.000 1.000
#> GSM617622     2  0.9248      0.521 0.340 0.660
#> GSM617623     2  0.0000      0.953 0.000 1.000
#> GSM617624     1  0.0938      0.986 0.988 0.012
#> GSM617625     1  0.0000      0.997 1.000 0.000
#> GSM617626     1  0.0000      0.997 1.000 0.000
#> GSM617627     1  0.4431      0.892 0.908 0.092
#> GSM617628     1  0.0000      0.997 1.000 0.000
#> GSM617632     1  0.0000      0.997 1.000 0.000
#> GSM617634     1  0.0000      0.997 1.000 0.000
#> GSM617635     1  0.0000      0.997 1.000 0.000
#> GSM617636     1  0.0000      0.997 1.000 0.000
#> GSM617637     1  0.0000      0.997 1.000 0.000
#> GSM617638     1  0.0000      0.997 1.000 0.000
#> GSM617639     1  0.0000      0.997 1.000 0.000
#> GSM617640     2  0.0000      0.953 0.000 1.000
#> GSM617641     2  0.0000      0.953 0.000 1.000
#> GSM617643     2  0.0000      0.953 0.000 1.000
#> GSM617644     2  0.0000      0.953 0.000 1.000
#> GSM617647     2  0.0000      0.953 0.000 1.000
#> GSM617648     2  0.0000      0.953 0.000 1.000
#> GSM617649     2  0.0000      0.953 0.000 1.000
#> GSM617650     1  0.0000      0.997 1.000 0.000
#> GSM617651     1  0.0000      0.997 1.000 0.000
#> GSM617653     1  0.0000      0.997 1.000 0.000
#> GSM617654     2  0.0000      0.953 0.000 1.000
#> GSM617583     1  0.0000      0.997 1.000 0.000
#> GSM617584     2  0.0000      0.953 0.000 1.000
#> GSM617585     2  0.0000      0.953 0.000 1.000
#> GSM617586     1  0.0000      0.997 1.000 0.000
#> GSM617587     1  0.0000      0.997 1.000 0.000
#> GSM617589     2  0.0000      0.953 0.000 1.000
#> GSM617591     2  0.0000      0.953 0.000 1.000
#> GSM617593     1  0.0000      0.997 1.000 0.000
#> GSM617594     2  0.5408      0.842 0.124 0.876
#> GSM617595     1  0.0000      0.997 1.000 0.000
#> GSM617596     1  0.0000      0.997 1.000 0.000
#> GSM617597     1  0.0000      0.997 1.000 0.000
#> GSM617598     1  0.0000      0.997 1.000 0.000
#> GSM617599     2  0.0938      0.945 0.012 0.988
#> GSM617600     1  0.0000      0.997 1.000 0.000
#> GSM617601     2  0.9996      0.107 0.488 0.512
#> GSM617602     1  0.0000      0.997 1.000 0.000
#> GSM617603     2  0.0000      0.953 0.000 1.000
#> GSM617604     1  0.0000      0.997 1.000 0.000
#> GSM617605     2  0.0000      0.953 0.000 1.000
#> GSM617606     2  0.0000      0.953 0.000 1.000
#> GSM617610     1  0.0000      0.997 1.000 0.000
#> GSM617611     1  0.0000      0.997 1.000 0.000
#> GSM617613     1  0.0000      0.997 1.000 0.000
#> GSM617614     1  0.0000      0.997 1.000 0.000
#> GSM617621     1  0.0000      0.997 1.000 0.000
#> GSM617629     1  0.0000      0.997 1.000 0.000
#> GSM617630     2  0.8955      0.576 0.312 0.688
#> GSM617631     1  0.0000      0.997 1.000 0.000
#> GSM617633     1  0.0000      0.997 1.000 0.000
#> GSM617642     1  0.0000      0.997 1.000 0.000
#> GSM617645     2  0.0000      0.953 0.000 1.000
#> GSM617646     1  0.0000      0.997 1.000 0.000
#> GSM617652     1  0.0000      0.997 1.000 0.000
#> GSM617655     1  0.0000      0.997 1.000 0.000
#> GSM617656     1  0.0000      0.997 1.000 0.000
#> GSM617657     1  0.0000      0.997 1.000 0.000
#> GSM617658     1  0.0000      0.997 1.000 0.000
#> GSM617659     1  0.0000      0.997 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
#> GSM617581     1  0.0000     0.7613 1.000 0.000 0.000
#> GSM617582     3  0.4062     0.7597 0.000 0.164 0.836
#> GSM617588     2  0.2711     0.8290 0.088 0.912 0.000
#> GSM617590     2  0.0000     0.8670 0.000 1.000 0.000
#> GSM617592     2  0.5859     0.5264 0.344 0.656 0.000
#> GSM617607     3  0.0000     0.8935 0.000 0.000 1.000
#> GSM617608     3  0.0000     0.8935 0.000 0.000 1.000
#> GSM617609     3  0.0000     0.8935 0.000 0.000 1.000
#> GSM617612     1  0.1289     0.7674 0.968 0.000 0.032
#> GSM617615     2  0.0000     0.8670 0.000 1.000 0.000
#> GSM617616     3  0.0237     0.8915 0.004 0.000 0.996
#> GSM617617     1  0.6566     0.2030 0.636 0.348 0.016
#> GSM617618     3  0.0000     0.8935 0.000 0.000 1.000
#> GSM617619     3  0.4931     0.6768 0.000 0.232 0.768
#> GSM617620     2  0.1643     0.8544 0.044 0.956 0.000
#> GSM617622     2  0.8280     0.3635 0.092 0.564 0.344
#> GSM617623     1  0.0000     0.7613 1.000 0.000 0.000
#> GSM617624     3  0.4062     0.7610 0.000 0.164 0.836
#> GSM617625     3  0.0000     0.8935 0.000 0.000 1.000
#> GSM617626     1  0.1964     0.7642 0.944 0.000 0.056
#> GSM617627     3  0.3879     0.7722 0.000 0.152 0.848
#> GSM617628     3  0.0000     0.8935 0.000 0.000 1.000
#> GSM617632     3  0.6244     0.0395 0.440 0.000 0.560
#> GSM617634     3  0.2356     0.8449 0.000 0.072 0.928
#> GSM617635     3  0.2165     0.8478 0.064 0.000 0.936
#> GSM617636     3  0.0424     0.8893 0.008 0.000 0.992
#> GSM617637     1  0.5178     0.6291 0.744 0.000 0.256
#> GSM617638     3  0.0000     0.8935 0.000 0.000 1.000
#> GSM617639     1  0.3686     0.7411 0.860 0.000 0.140
#> GSM617640     2  0.1163     0.8608 0.028 0.972 0.000
#> GSM617641     2  0.3619     0.7946 0.136 0.864 0.000
#> GSM617643     2  0.0000     0.8670 0.000 1.000 0.000
#> GSM617644     2  0.0000     0.8670 0.000 1.000 0.000
#> GSM617647     1  0.6252    -0.0966 0.556 0.444 0.000
#> GSM617648     2  0.0000     0.8670 0.000 1.000 0.000
#> GSM617649     2  0.1711     0.8589 0.032 0.960 0.008
#> GSM617650     3  0.6126     0.1856 0.400 0.000 0.600
#> GSM617651     1  0.0000     0.7613 1.000 0.000 0.000
#> GSM617653     1  0.0000     0.7613 1.000 0.000 0.000
#> GSM617654     2  0.3686     0.7902 0.140 0.860 0.000
#> GSM617583     3  0.0000     0.8935 0.000 0.000 1.000
#> GSM617584     2  0.6305     0.2432 0.484 0.516 0.000
#> GSM617585     2  0.3941     0.7390 0.000 0.844 0.156
#> GSM617586     3  0.0000     0.8935 0.000 0.000 1.000
#> GSM617587     3  0.2066     0.8513 0.060 0.000 0.940
#> GSM617589     2  0.0000     0.8670 0.000 1.000 0.000
#> GSM617591     2  0.1411     0.8483 0.000 0.964 0.036
#> GSM617593     1  0.6286     0.2511 0.536 0.000 0.464
#> GSM617594     2  0.4796     0.6665 0.000 0.780 0.220
#> GSM617595     1  0.0424     0.7644 0.992 0.000 0.008
#> GSM617596     1  0.0892     0.7672 0.980 0.000 0.020
#> GSM617597     3  0.0000     0.8935 0.000 0.000 1.000
#> GSM617598     1  0.6305     0.1879 0.516 0.000 0.484
#> GSM617599     2  0.0829     0.8641 0.004 0.984 0.012
#> GSM617600     3  0.0000     0.8935 0.000 0.000 1.000
#> GSM617601     3  0.6168     0.2798 0.000 0.412 0.588
#> GSM617602     3  0.0000     0.8935 0.000 0.000 1.000
#> GSM617603     2  0.0000     0.8670 0.000 1.000 0.000
#> GSM617604     1  0.3686     0.7408 0.860 0.000 0.140
#> GSM617605     2  0.0000     0.8670 0.000 1.000 0.000
#> GSM617606     2  0.0000     0.8670 0.000 1.000 0.000
#> GSM617610     1  0.0000     0.7613 1.000 0.000 0.000
#> GSM617611     1  0.6286     0.2508 0.536 0.000 0.464
#> GSM617613     3  0.0000     0.8935 0.000 0.000 1.000
#> GSM617614     3  0.3686     0.7596 0.140 0.000 0.860
#> GSM617621     1  0.0892     0.7671 0.980 0.000 0.020
#> GSM617629     3  0.0000     0.8935 0.000 0.000 1.000
#> GSM617630     2  0.6252     0.2101 0.000 0.556 0.444
#> GSM617631     3  0.0000     0.8935 0.000 0.000 1.000
#> GSM617633     3  0.0000     0.8935 0.000 0.000 1.000
#> GSM617642     3  0.2711     0.8222 0.088 0.000 0.912
#> GSM617645     2  0.1860     0.8539 0.052 0.948 0.000
#> GSM617646     1  0.6225     0.3288 0.568 0.000 0.432
#> GSM617652     3  0.0424     0.8893 0.008 0.000 0.992
#> GSM617655     3  0.0000     0.8935 0.000 0.000 1.000
#> GSM617656     3  0.0000     0.8935 0.000 0.000 1.000
#> GSM617657     3  0.3038     0.8183 0.000 0.104 0.896
#> GSM617658     3  0.0000     0.8935 0.000 0.000 1.000
#> GSM617659     3  0.6215     0.0871 0.428 0.000 0.572

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>           class entropy silhouette    p1    p2    p3    p4
#> GSM617581     1  0.3687    0.74221 0.856 0.064 0.000 0.080
#> GSM617582     2  0.3372    0.60555 0.000 0.868 0.036 0.096
#> GSM617588     4  0.1356    0.81397 0.032 0.008 0.000 0.960
#> GSM617590     4  0.1545    0.81363 0.000 0.040 0.008 0.952
#> GSM617592     4  0.3400    0.72769 0.180 0.000 0.000 0.820
#> GSM617607     2  0.2149    0.63169 0.000 0.912 0.088 0.000
#> GSM617608     2  0.4996    0.02515 0.000 0.516 0.484 0.000
#> GSM617609     2  0.2530    0.62386 0.000 0.888 0.112 0.000
#> GSM617612     1  0.1807    0.81226 0.940 0.000 0.052 0.008
#> GSM617615     4  0.2048    0.80593 0.000 0.008 0.064 0.928
#> GSM617616     3  0.3554    0.64954 0.020 0.136 0.844 0.000
#> GSM617617     4  0.7467    0.48025 0.264 0.204 0.004 0.528
#> GSM617618     3  0.4103    0.55289 0.000 0.256 0.744 0.000
#> GSM617619     2  0.4206    0.57989 0.000 0.816 0.048 0.136
#> GSM617620     4  0.0469    0.81432 0.012 0.000 0.000 0.988
#> GSM617622     3  0.4238    0.57110 0.060 0.004 0.828 0.108
#> GSM617623     1  0.1724    0.79717 0.948 0.020 0.000 0.032
#> GSM617624     3  0.1854    0.61927 0.000 0.012 0.940 0.048
#> GSM617625     2  0.5132    0.14615 0.004 0.548 0.448 0.000
#> GSM617626     1  0.2261    0.81000 0.932 0.024 0.036 0.008
#> GSM617627     2  0.6207   -0.05677 0.000 0.496 0.052 0.452
#> GSM617628     2  0.4608    0.45832 0.004 0.692 0.304 0.000
#> GSM617632     3  0.5920    0.41675 0.336 0.052 0.612 0.000
#> GSM617634     3  0.1059    0.63437 0.000 0.012 0.972 0.016
#> GSM617635     3  0.1637    0.64708 0.060 0.000 0.940 0.000
#> GSM617636     3  0.3925    0.63173 0.016 0.176 0.808 0.000
#> GSM617637     1  0.4907    0.30785 0.580 0.000 0.420 0.000
#> GSM617638     2  0.0336    0.62692 0.000 0.992 0.008 0.000
#> GSM617639     1  0.2799    0.77456 0.884 0.008 0.108 0.000
#> GSM617640     4  0.4188    0.72308 0.004 0.244 0.000 0.752
#> GSM617641     4  0.1637    0.80796 0.060 0.000 0.000 0.940
#> GSM617643     4  0.3105    0.77359 0.000 0.004 0.140 0.856
#> GSM617644     4  0.4509    0.63917 0.000 0.004 0.288 0.708
#> GSM617647     1  0.6292    0.32801 0.592 0.000 0.076 0.332
#> GSM617648     4  0.4401    0.66316 0.000 0.004 0.272 0.724
#> GSM617649     3  0.5920    0.22313 0.040 0.004 0.608 0.348
#> GSM617650     3  0.5650    0.57111 0.180 0.104 0.716 0.000
#> GSM617651     1  0.0712    0.81345 0.984 0.008 0.004 0.004
#> GSM617653     1  0.0188    0.81437 0.996 0.000 0.004 0.000
#> GSM617654     4  0.4282    0.77443 0.024 0.160 0.008 0.808
#> GSM617583     3  0.3356    0.63071 0.000 0.176 0.824 0.000
#> GSM617584     4  0.4697    0.47754 0.356 0.000 0.000 0.644
#> GSM617585     4  0.4855    0.57401 0.000 0.352 0.004 0.644
#> GSM617586     3  0.4981    0.12796 0.000 0.464 0.536 0.000
#> GSM617587     3  0.4359    0.64200 0.100 0.084 0.816 0.000
#> GSM617589     4  0.0336    0.81314 0.000 0.008 0.000 0.992
#> GSM617591     4  0.3975    0.69366 0.000 0.240 0.000 0.760
#> GSM617593     1  0.7200    0.33927 0.552 0.228 0.220 0.000
#> GSM617594     3  0.4372    0.42718 0.000 0.004 0.728 0.268
#> GSM617595     1  0.2868    0.77544 0.864 0.000 0.136 0.000
#> GSM617596     1  0.0188    0.81350 0.996 0.004 0.000 0.000
#> GSM617597     2  0.5080    0.22812 0.004 0.576 0.420 0.000
#> GSM617598     3  0.5511    0.37572 0.352 0.028 0.620 0.000
#> GSM617599     4  0.2384    0.80393 0.004 0.008 0.072 0.916
#> GSM617600     3  0.4992    0.09384 0.000 0.476 0.524 0.000
#> GSM617601     3  0.5143    0.30624 0.000 0.012 0.628 0.360
#> GSM617602     3  0.4164    0.55404 0.000 0.264 0.736 0.000
#> GSM617603     4  0.2402    0.80219 0.000 0.012 0.076 0.912
#> GSM617604     2  0.5689    0.00262 0.412 0.564 0.004 0.020
#> GSM617605     4  0.1867    0.80633 0.000 0.072 0.000 0.928
#> GSM617606     4  0.4624    0.59614 0.000 0.340 0.000 0.660
#> GSM617610     1  0.0188    0.81305 0.996 0.000 0.000 0.004
#> GSM617611     1  0.6461    0.43869 0.632 0.128 0.240 0.000
#> GSM617613     2  0.4543    0.41507 0.000 0.676 0.324 0.000
#> GSM617614     2  0.4212    0.55318 0.012 0.772 0.216 0.000
#> GSM617621     1  0.1443    0.81231 0.960 0.028 0.008 0.004
#> GSM617629     3  0.1302    0.64755 0.000 0.044 0.956 0.000
#> GSM617630     2  0.2589    0.54554 0.000 0.884 0.000 0.116
#> GSM617631     3  0.4585    0.46797 0.000 0.332 0.668 0.000
#> GSM617633     3  0.2216    0.65559 0.000 0.092 0.908 0.000
#> GSM617642     3  0.4877    0.60348 0.044 0.204 0.752 0.000
#> GSM617645     4  0.3547    0.78069 0.016 0.144 0.000 0.840
#> GSM617646     3  0.4991    0.24417 0.388 0.000 0.608 0.004
#> GSM617652     3  0.5004    0.30625 0.004 0.392 0.604 0.000
#> GSM617655     3  0.3172    0.63991 0.000 0.160 0.840 0.000
#> GSM617656     3  0.4679    0.41819 0.000 0.352 0.648 0.000
#> GSM617657     3  0.4290    0.56510 0.000 0.164 0.800 0.036
#> GSM617658     2  0.0592    0.62875 0.000 0.984 0.016 0.000
#> GSM617659     2  0.6683    0.43152 0.176 0.620 0.204 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
#> GSM617581     1  0.1911     0.7330 0.932 0.004 0.000 0.036 0.028
#> GSM617582     5  0.4550     0.6313 0.000 0.044 0.080 0.084 0.792
#> GSM617588     4  0.1741     0.8220 0.040 0.024 0.000 0.936 0.000
#> GSM617590     4  0.0324     0.8189 0.000 0.004 0.004 0.992 0.000
#> GSM617592     4  0.3826     0.7443 0.172 0.020 0.000 0.796 0.012
#> GSM617607     5  0.3087     0.5857 0.004 0.008 0.152 0.000 0.836
#> GSM617608     3  0.3513     0.7165 0.000 0.020 0.800 0.000 0.180
#> GSM617609     5  0.3160     0.5560 0.000 0.004 0.188 0.000 0.808
#> GSM617612     1  0.5785     0.4224 0.596 0.012 0.320 0.068 0.004
#> GSM617615     4  0.1285     0.8238 0.004 0.036 0.004 0.956 0.000
#> GSM617616     3  0.3362     0.6343 0.012 0.156 0.824 0.000 0.008
#> GSM617617     5  0.6137     0.5011 0.076 0.316 0.000 0.032 0.576
#> GSM617618     2  0.5959    -0.0817 0.000 0.472 0.108 0.000 0.420
#> GSM617619     5  0.3812     0.6286 0.000 0.136 0.016 0.032 0.816
#> GSM617620     4  0.3340     0.7642 0.004 0.156 0.000 0.824 0.016
#> GSM617622     2  0.4441     0.5976 0.024 0.716 0.252 0.008 0.000
#> GSM617623     1  0.2228     0.7318 0.920 0.040 0.000 0.012 0.028
#> GSM617624     2  0.5261     0.6027 0.000 0.696 0.200 0.012 0.092
#> GSM617625     3  0.3953     0.7090 0.012 0.040 0.804 0.000 0.144
#> GSM617626     1  0.5472     0.3396 0.580 0.036 0.368 0.008 0.008
#> GSM617627     5  0.6321     0.5635 0.000 0.216 0.020 0.168 0.596
#> GSM617628     3  0.6036     0.6360 0.012 0.052 0.684 0.080 0.172
#> GSM617632     3  0.5283     0.5305 0.188 0.136 0.676 0.000 0.000
#> GSM617634     2  0.4506     0.5716 0.000 0.676 0.296 0.000 0.028
#> GSM617635     2  0.5289     0.3165 0.040 0.528 0.428 0.000 0.004
#> GSM617636     3  0.3403     0.6298 0.012 0.160 0.820 0.000 0.008
#> GSM617637     1  0.6535     0.1086 0.476 0.232 0.292 0.000 0.000
#> GSM617638     5  0.1928     0.6235 0.004 0.004 0.072 0.000 0.920
#> GSM617639     1  0.3796     0.5026 0.700 0.000 0.300 0.000 0.000
#> GSM617640     5  0.6028     0.5178 0.004 0.304 0.000 0.128 0.564
#> GSM617641     4  0.3818     0.7699 0.028 0.144 0.000 0.812 0.016
#> GSM617643     2  0.4743     0.3672 0.004 0.700 0.000 0.248 0.048
#> GSM617644     2  0.4347     0.4117 0.000 0.712 0.012 0.264 0.012
#> GSM617647     2  0.5492     0.4157 0.236 0.672 0.000 0.064 0.028
#> GSM617648     2  0.4002     0.4873 0.000 0.780 0.008 0.184 0.028
#> GSM617649     2  0.3288     0.5637 0.008 0.876 0.028 0.048 0.040
#> GSM617650     3  0.4258     0.6068 0.072 0.160 0.768 0.000 0.000
#> GSM617651     1  0.3201     0.6925 0.852 0.096 0.000 0.000 0.052
#> GSM617653     1  0.0404     0.7547 0.988 0.000 0.012 0.000 0.000
#> GSM617654     5  0.6257     0.4705 0.024 0.340 0.000 0.092 0.544
#> GSM617583     3  0.2260     0.7087 0.012 0.048 0.920 0.016 0.004
#> GSM617584     4  0.4402     0.4979 0.352 0.012 0.000 0.636 0.000
#> GSM617585     5  0.5620     0.5003 0.000 0.092 0.004 0.296 0.608
#> GSM617586     3  0.2915     0.7266 0.000 0.024 0.860 0.000 0.116
#> GSM617587     3  0.5314     0.3463 0.068 0.296 0.632 0.000 0.004
#> GSM617589     4  0.1460     0.8112 0.012 0.020 0.008 0.956 0.004
#> GSM617591     4  0.4883     0.4814 0.000 0.052 0.004 0.684 0.260
#> GSM617593     3  0.5177     0.2164 0.416 0.008 0.548 0.000 0.028
#> GSM617594     2  0.4075     0.6309 0.000 0.780 0.160 0.060 0.000
#> GSM617595     1  0.3694     0.6255 0.796 0.172 0.032 0.000 0.000
#> GSM617596     1  0.1205     0.7480 0.956 0.040 0.000 0.000 0.004
#> GSM617597     3  0.3320     0.7171 0.012 0.008 0.828 0.000 0.152
#> GSM617598     3  0.4679     0.5727 0.216 0.068 0.716 0.000 0.000
#> GSM617599     4  0.2497     0.7985 0.000 0.112 0.004 0.880 0.004
#> GSM617600     3  0.5206     0.5914 0.000 0.048 0.664 0.016 0.272
#> GSM617601     4  0.4128     0.6879 0.004 0.068 0.124 0.800 0.004
#> GSM617602     3  0.1774     0.7264 0.000 0.016 0.932 0.000 0.052
#> GSM617603     4  0.3732     0.7122 0.000 0.176 0.000 0.792 0.032
#> GSM617604     5  0.5382    -0.0557 0.472 0.000 0.044 0.004 0.480
#> GSM617605     4  0.0727     0.8204 0.000 0.012 0.004 0.980 0.004
#> GSM617606     5  0.5096     0.5320 0.000 0.072 0.000 0.272 0.656
#> GSM617610     1  0.0324     0.7541 0.992 0.004 0.004 0.000 0.000
#> GSM617611     3  0.4517     0.1878 0.436 0.008 0.556 0.000 0.000
#> GSM617613     3  0.5430     0.4373 0.000 0.032 0.576 0.020 0.372
#> GSM617614     3  0.5740     0.5955 0.064 0.040 0.656 0.000 0.240
#> GSM617621     1  0.2054     0.7486 0.920 0.000 0.052 0.000 0.028
#> GSM617629     2  0.4736     0.4202 0.000 0.576 0.404 0.000 0.020
#> GSM617630     5  0.2143     0.6402 0.008 0.060 0.008 0.004 0.920
#> GSM617631     3  0.2813     0.7258 0.000 0.040 0.876 0.000 0.084
#> GSM617633     3  0.4242    -0.0224 0.000 0.428 0.572 0.000 0.000
#> GSM617642     3  0.2679     0.7114 0.056 0.048 0.892 0.000 0.004
#> GSM617645     5  0.6719     0.4282 0.008 0.316 0.000 0.204 0.472
#> GSM617646     2  0.6781     0.3783 0.228 0.468 0.296 0.000 0.008
#> GSM617652     3  0.2533     0.7320 0.008 0.008 0.888 0.000 0.096
#> GSM617655     3  0.1908     0.6763 0.000 0.092 0.908 0.000 0.000
#> GSM617656     3  0.2351     0.7294 0.000 0.016 0.896 0.000 0.088
#> GSM617657     2  0.8235     0.3057 0.000 0.388 0.268 0.164 0.180
#> GSM617658     5  0.4181     0.3846 0.000 0.020 0.268 0.000 0.712
#> GSM617659     3  0.6227     0.5524 0.144 0.024 0.612 0.000 0.220

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>           class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM617581     1   0.289    0.73115 0.872 0.000 0.000 0.040 0.028 0.060
#> GSM617582     5   0.571    0.40653 0.000 0.052 0.040 0.096 0.688 0.124
#> GSM617588     4   0.250    0.68670 0.020 0.012 0.000 0.884 0.000 0.084
#> GSM617590     4   0.242    0.68542 0.000 0.020 0.008 0.900 0.012 0.060
#> GSM617592     4   0.381    0.65259 0.096 0.016 0.000 0.800 0.000 0.088
#> GSM617607     5   0.374    0.43531 0.012 0.004 0.192 0.000 0.772 0.020
#> GSM617608     3   0.377    0.71979 0.028 0.032 0.804 0.000 0.132 0.004
#> GSM617609     5   0.458    0.35661 0.000 0.000 0.320 0.000 0.624 0.056
#> GSM617612     1   0.504    0.64452 0.708 0.004 0.164 0.044 0.000 0.080
#> GSM617615     4   0.472    0.64520 0.004 0.084 0.040 0.752 0.004 0.116
#> GSM617616     3   0.547    0.46333 0.056 0.300 0.604 0.000 0.012 0.028
#> GSM617617     6   0.739    0.72634 0.020 0.172 0.000 0.084 0.348 0.376
#> GSM617618     2   0.721    0.12855 0.004 0.404 0.104 0.004 0.340 0.144
#> GSM617619     5   0.363    0.36093 0.000 0.080 0.008 0.008 0.820 0.084
#> GSM617620     4   0.340    0.64888 0.016 0.040 0.000 0.824 0.000 0.120
#> GSM617622     2   0.375    0.50554 0.012 0.816 0.072 0.004 0.004 0.092
#> GSM617623     1   0.277    0.73446 0.880 0.004 0.000 0.016 0.036 0.064
#> GSM617624     2   0.517    0.48769 0.000 0.708 0.092 0.004 0.060 0.136
#> GSM617625     3   0.325    0.70635 0.020 0.000 0.848 0.004 0.040 0.088
#> GSM617626     1   0.641    0.51912 0.580 0.016 0.200 0.020 0.016 0.168
#> GSM617627     5   0.843   -0.47408 0.000 0.172 0.056 0.232 0.276 0.264
#> GSM617628     3   0.493    0.64852 0.028 0.000 0.736 0.032 0.060 0.144
#> GSM617632     3   0.650    0.20791 0.364 0.172 0.432 0.000 0.016 0.016
#> GSM617634     2   0.451    0.52522 0.000 0.744 0.152 0.000 0.036 0.068
#> GSM617635     2   0.443    0.28973 0.000 0.580 0.388 0.000 0.000 0.032
#> GSM617636     3   0.506    0.48508 0.040 0.292 0.636 0.000 0.020 0.012
#> GSM617637     1   0.697    0.20376 0.428 0.268 0.228 0.000 0.000 0.076
#> GSM617638     5   0.410    0.41004 0.004 0.012 0.108 0.000 0.780 0.096
#> GSM617639     1   0.490    0.34786 0.612 0.004 0.328 0.000 0.012 0.044
#> GSM617640     5   0.725   -0.76973 0.004 0.112 0.000 0.164 0.368 0.352
#> GSM617641     4   0.355    0.64559 0.028 0.028 0.000 0.812 0.000 0.132
#> GSM617643     2   0.634   -0.22971 0.000 0.408 0.000 0.276 0.012 0.304
#> GSM617644     2   0.394    0.38256 0.000 0.752 0.000 0.180 0.000 0.068
#> GSM617647     2   0.687   -0.00501 0.168 0.480 0.000 0.060 0.012 0.280
#> GSM617648     2   0.399    0.40661 0.000 0.768 0.004 0.136 0.000 0.092
#> GSM617649     2   0.424    0.42917 0.004 0.772 0.032 0.036 0.004 0.152
#> GSM617650     3   0.494    0.62124 0.116 0.164 0.700 0.000 0.004 0.016
#> GSM617651     1   0.422    0.71728 0.800 0.048 0.016 0.000 0.064 0.072
#> GSM617653     1   0.087    0.75628 0.972 0.000 0.012 0.004 0.000 0.012
#> GSM617654     6   0.757    0.72300 0.004 0.200 0.000 0.148 0.316 0.332
#> GSM617583     3   0.283    0.70341 0.000 0.044 0.872 0.008 0.004 0.072
#> GSM617584     4   0.484    0.39294 0.360 0.004 0.000 0.580 0.000 0.056
#> GSM617585     5   0.625    0.25028 0.000 0.060 0.000 0.244 0.552 0.144
#> GSM617586     3   0.287    0.71710 0.000 0.040 0.868 0.000 0.076 0.016
#> GSM617587     3   0.567    0.40341 0.020 0.268 0.620 0.024 0.004 0.064
#> GSM617589     4   0.307    0.66966 0.004 0.004 0.020 0.832 0.000 0.140
#> GSM617591     4   0.637    0.29246 0.000 0.060 0.012 0.576 0.216 0.136
#> GSM617593     3   0.525    0.16209 0.452 0.012 0.488 0.000 0.024 0.024
#> GSM617594     2   0.589    0.34381 0.000 0.612 0.064 0.092 0.004 0.228
#> GSM617595     1   0.412    0.65765 0.768 0.156 0.028 0.000 0.000 0.048
#> GSM617596     1   0.310    0.75450 0.872 0.024 0.028 0.000 0.028 0.048
#> GSM617597     3   0.322    0.71657 0.020 0.008 0.852 0.000 0.088 0.032
#> GSM617598     3   0.544    0.42624 0.332 0.028 0.576 0.000 0.004 0.060
#> GSM617599     4   0.583    0.49446 0.004 0.208 0.008 0.592 0.008 0.180
#> GSM617600     3   0.532    0.54435 0.000 0.032 0.652 0.000 0.212 0.104
#> GSM617601     4   0.717    0.31807 0.004 0.076 0.300 0.436 0.008 0.176
#> GSM617602     3   0.250    0.71301 0.000 0.060 0.892 0.000 0.032 0.016
#> GSM617603     4   0.562    0.48923 0.000 0.132 0.000 0.636 0.044 0.188
#> GSM617604     1   0.547    0.48232 0.588 0.004 0.068 0.000 0.312 0.028
#> GSM617605     4   0.144    0.69109 0.000 0.004 0.000 0.944 0.012 0.040
#> GSM617606     5   0.568    0.21711 0.000 0.028 0.004 0.276 0.592 0.100
#> GSM617610     1   0.100    0.75211 0.964 0.004 0.000 0.004 0.000 0.028
#> GSM617611     3   0.485    0.39077 0.380 0.012 0.576 0.000 0.012 0.020
#> GSM617613     3   0.481    0.54200 0.000 0.008 0.660 0.000 0.252 0.080
#> GSM617614     3   0.585    0.59295 0.168 0.000 0.620 0.000 0.156 0.056
#> GSM617621     1   0.256    0.75790 0.896 0.008 0.048 0.000 0.016 0.032
#> GSM617629     2   0.563    0.39793 0.000 0.564 0.320 0.000 0.036 0.080
#> GSM617630     5   0.262    0.37621 0.012 0.008 0.016 0.000 0.884 0.080
#> GSM617631     3   0.390    0.68852 0.000 0.072 0.800 0.000 0.100 0.028
#> GSM617633     2   0.422    0.05964 0.000 0.516 0.472 0.000 0.004 0.008
#> GSM617642     3   0.285    0.72047 0.044 0.032 0.880 0.000 0.004 0.040
#> GSM617645     6   0.733    0.69655 0.004 0.112 0.000 0.200 0.284 0.400
#> GSM617646     2   0.660    0.41923 0.104 0.536 0.208 0.000 0.000 0.152
#> GSM617652     3   0.289    0.73100 0.048 0.020 0.880 0.000 0.040 0.012
#> GSM617655     3   0.231    0.68618 0.000 0.092 0.888 0.000 0.004 0.016
#> GSM617656     3   0.216    0.71633 0.000 0.028 0.912 0.000 0.044 0.016
#> GSM617657     2   0.819    0.27651 0.000 0.412 0.148 0.092 0.136 0.212
#> GSM617658     5   0.450    0.42820 0.008 0.000 0.232 0.000 0.696 0.064
#> GSM617659     3   0.572    0.54037 0.236 0.000 0.612 0.000 0.100 0.052

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

consensus_heatmap(res, k = 2)

plot of chunk tab-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) k
#> ATC:NMF 78           0.3120 2
#> ATC:NMF 66           0.6044 3
#> ATC:NMF 54           0.8918 4
#> ATC:NMF 56           0.2131 5
#> ATC:NMF 40           0.0498 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