cola Report for recount2:SRP058181

Date: 2019-12-26 01:02: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 17223 rows and 73 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)

Dimension of the input matrix:

mat = get_matrix(res_list)
dim(mat)
#> [1] 17223    73

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, ylab = "value", cluster_columns = TRUE, show_column_names = FALSE,
    mc.cores = 4)

plot of chunk density-heatmap

Suggest the best k

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

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

suggest_best_k(res_list)
The best k 1-PAC Mean silhouette Concordance Optional k
CV:kmeans 2 1.000 0.969 0.986 **
CV:skmeans 2 1.000 0.962 0.985 **
ATC:kmeans 3 1.000 0.971 0.986 ** 2
ATC:skmeans 2 1.000 0.997 0.999 **
MAD:NMF 2 0.943 0.965 0.983 *
CV:NMF 2 0.942 0.932 0.972 *
SD:pam 2 0.942 0.945 0.976 *
ATC:pam 3 0.936 0.932 0.973 * 2
SD:NMF 2 0.916 0.946 0.975 *
CV:pam 2 0.914 0.916 0.967 *
MAD:pam 6 0.908 0.850 0.944 * 2
ATC:mclust 3 0.905 0.890 0.954 * 2
MAD:skmeans 2 0.862 0.939 0.970
CV:mclust 5 0.820 0.865 0.924
SD:kmeans 2 0.802 0.951 0.970
SD:skmeans 2 0.761 0.894 0.955
MAD:kmeans 2 0.683 0.896 0.951
ATC:hclust 2 0.618 0.805 0.906
ATC:NMF 3 0.601 0.811 0.902
SD:mclust 4 0.572 0.805 0.869
SD:hclust 4 0.504 0.665 0.800
MAD:hclust 2 0.368 0.745 0.872
MAD:mclust 2 0.365 0.857 0.869
CV:hclust 2 0.354 0.656 0.847

**: 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.916           0.946       0.975          0.492 0.514   0.514
#> CV:NMF      2 0.942           0.932       0.972          0.504 0.498   0.498
#> MAD:NMF     2 0.943           0.965       0.983          0.487 0.514   0.514
#> ATC:NMF     2 0.716           0.922       0.961          0.357 0.638   0.638
#> SD:skmeans  2 0.761           0.894       0.955          0.506 0.498   0.498
#> CV:skmeans  2 1.000           0.962       0.985          0.503 0.498   0.498
#> MAD:skmeans 2 0.862           0.939       0.970          0.507 0.493   0.493
#> ATC:skmeans 2 1.000           0.997       0.999          0.506 0.494   0.494
#> SD:mclust   2 0.191           0.307       0.679          0.335 0.584   0.584
#> CV:mclust   2 0.732           0.831       0.935          0.492 0.501   0.501
#> MAD:mclust  2 0.365           0.857       0.869          0.428 0.521   0.521
#> ATC:mclust  2 1.000           0.954       0.982          0.481 0.527   0.527
#> SD:kmeans   2 0.802           0.951       0.970          0.485 0.521   0.521
#> CV:kmeans   2 1.000           0.969       0.986          0.495 0.505   0.505
#> MAD:kmeans  2 0.683           0.896       0.951          0.487 0.509   0.509
#> ATC:kmeans  2 1.000           0.986       0.995          0.504 0.495   0.495
#> SD:pam      2 0.942           0.945       0.976          0.493 0.509   0.509
#> CV:pam      2 0.914           0.916       0.967          0.506 0.494   0.494
#> MAD:pam     2 0.916           0.937       0.975          0.497 0.505   0.505
#> ATC:pam     2 1.000           1.000       1.000          0.500 0.501   0.501
#> SD:hclust   2 0.367           0.372       0.695          0.445 0.740   0.740
#> CV:hclust   2 0.354           0.656       0.847          0.465 0.494   0.494
#> MAD:hclust  2 0.368           0.745       0.872          0.468 0.495   0.495
#> ATC:hclust  2 0.618           0.805       0.906          0.454 0.509   0.509
get_stats(res_list, k = 3)
#>             k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> SD:NMF      3 0.786           0.802       0.916          0.238 0.813   0.658
#> CV:NMF      3 0.837           0.842       0.932          0.237 0.799   0.627
#> MAD:NMF     3 0.754           0.749       0.893          0.260 0.734   0.548
#> ATC:NMF     3 0.601           0.811       0.902          0.739 0.638   0.469
#> SD:skmeans  3 0.736           0.743       0.851          0.309 0.755   0.543
#> CV:skmeans  3 0.670           0.752       0.884          0.309 0.844   0.690
#> MAD:skmeans 3 0.624           0.764       0.853          0.309 0.742   0.523
#> ATC:skmeans 3 0.872           0.957       0.966          0.277 0.823   0.652
#> SD:mclust   3 0.343           0.577       0.798          0.593 0.521   0.381
#> CV:mclust   3 0.635           0.827       0.858          0.288 0.807   0.633
#> MAD:mclust  3 0.225           0.775       0.829          0.253 0.924   0.854
#> ATC:mclust  3 0.905           0.890       0.954          0.254 0.841   0.706
#> SD:kmeans   3 0.534           0.686       0.838          0.304 0.703   0.484
#> CV:kmeans   3 0.509           0.674       0.747          0.267 0.767   0.562
#> MAD:kmeans  3 0.595           0.435       0.721          0.310 0.808   0.640
#> ATC:kmeans  3 1.000           0.971       0.986          0.231 0.610   0.387
#> SD:pam      3 0.790           0.860       0.939          0.350 0.689   0.462
#> CV:pam      3 0.893           0.893       0.955          0.311 0.811   0.632
#> MAD:pam     3 0.828           0.869       0.940          0.337 0.666   0.434
#> ATC:pam     3 0.936           0.932       0.973          0.316 0.748   0.538
#> SD:hclust   3 0.431           0.522       0.818          0.218 0.612   0.504
#> CV:hclust   3 0.295           0.491       0.739          0.191 0.831   0.687
#> MAD:hclust  3 0.422           0.698       0.828          0.284 0.866   0.736
#> ATC:hclust  3 0.527           0.663       0.758          0.386 0.643   0.423
get_stats(res_list, k = 4)
#>             k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> SD:NMF      4 0.555           0.649       0.821         0.1690 0.737   0.441
#> CV:NMF      4 0.623           0.652       0.835         0.1666 0.772   0.483
#> MAD:NMF     4 0.659           0.725       0.873         0.1726 0.720   0.410
#> ATC:NMF     4 0.558           0.596       0.767         0.0976 0.844   0.622
#> SD:skmeans  4 0.595           0.621       0.771         0.1009 0.867   0.640
#> CV:skmeans  4 0.621           0.590       0.752         0.1232 0.907   0.739
#> MAD:skmeans 4 0.576           0.569       0.728         0.0965 0.807   0.535
#> ATC:skmeans 4 0.835           0.856       0.911         0.0965 0.940   0.831
#> SD:mclust   4 0.572           0.805       0.869         0.2532 0.689   0.438
#> CV:mclust   4 0.543           0.675       0.815         0.0408 0.651   0.340
#> MAD:mclust  4 0.538           0.564       0.817         0.2194 0.846   0.671
#> ATC:mclust  4 0.673           0.724       0.835         0.1364 0.907   0.772
#> SD:kmeans   4 0.641           0.765       0.850         0.1283 0.832   0.576
#> CV:kmeans   4 0.550           0.692       0.810         0.1363 0.829   0.557
#> MAD:kmeans  4 0.649           0.714       0.815         0.1297 0.709   0.390
#> ATC:kmeans  4 0.802           0.918       0.916         0.1900 0.860   0.637
#> SD:pam      4 0.802           0.849       0.939         0.0540 0.963   0.891
#> CV:pam      4 0.891           0.854       0.938         0.0676 0.957   0.875
#> MAD:pam     4 0.833           0.858       0.940         0.0526 0.967   0.902
#> ATC:pam     4 0.817           0.794       0.909         0.0943 0.916   0.763
#> SD:hclust   4 0.504           0.665       0.800         0.2899 0.736   0.465
#> CV:hclust   4 0.390           0.422       0.653         0.1677 0.767   0.601
#> MAD:hclust  4 0.517           0.664       0.805         0.1539 0.884   0.710
#> ATC:hclust  4 0.712           0.742       0.784         0.1271 0.833   0.576
get_stats(res_list, k = 5)
#>             k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> SD:NMF      5 0.621           0.692       0.824         0.0810 0.752   0.340
#> CV:NMF      5 0.637           0.614       0.773         0.0810 0.798   0.404
#> MAD:NMF     5 0.672           0.713       0.853         0.0739 0.806   0.434
#> ATC:NMF     5 0.492           0.483       0.729         0.0679 0.934   0.802
#> SD:skmeans  5 0.681           0.725       0.829         0.0656 0.932   0.763
#> CV:skmeans  5 0.723           0.747       0.857         0.0686 0.880   0.599
#> MAD:skmeans 5 0.674           0.729       0.823         0.0605 0.868   0.603
#> ATC:skmeans 5 0.824           0.661       0.776         0.0660 0.915   0.723
#> SD:mclust   5 0.568           0.648       0.815         0.1058 0.969   0.902
#> CV:mclust   5 0.820           0.865       0.924         0.1193 0.742   0.403
#> MAD:mclust  5 0.586           0.672       0.807         0.1490 0.874   0.656
#> ATC:mclust  5 0.712           0.678       0.836         0.1122 0.797   0.459
#> SD:kmeans   5 0.676           0.671       0.772         0.0832 0.905   0.689
#> CV:kmeans   5 0.662           0.577       0.739         0.0831 0.900   0.668
#> MAD:kmeans  5 0.688           0.752       0.830         0.0810 0.901   0.682
#> ATC:kmeans  5 0.807           0.844       0.864         0.0599 0.953   0.811
#> SD:pam      5 0.738           0.801       0.907         0.0781 0.924   0.756
#> CV:pam      5 0.782           0.674       0.862         0.0633 0.932   0.783
#> MAD:pam     5 0.768           0.680       0.846         0.0876 0.894   0.678
#> ATC:pam     5 0.824           0.742       0.882         0.0688 0.906   0.698
#> SD:hclust   5 0.528           0.621       0.795         0.0270 0.946   0.829
#> CV:hclust   5 0.489           0.498       0.695         0.0453 0.765   0.562
#> MAD:hclust  5 0.615           0.583       0.754         0.0702 0.951   0.838
#> ATC:hclust  5 0.712           0.726       0.848         0.0345 0.991   0.964
get_stats(res_list, k = 6)
#>             k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> SD:NMF      6 0.659           0.606       0.801         0.0319 0.874   0.548
#> CV:NMF      6 0.637           0.517       0.730         0.0432 0.860   0.456
#> MAD:NMF     6 0.657           0.615       0.798         0.0307 0.860   0.507
#> ATC:NMF     6 0.487           0.418       0.695         0.0448 0.815   0.504
#> SD:skmeans  6 0.746           0.653       0.825         0.0438 0.909   0.653
#> CV:skmeans  6 0.761           0.723       0.851         0.0431 0.944   0.750
#> MAD:skmeans 6 0.783           0.699       0.859         0.0476 0.924   0.688
#> ATC:skmeans 6 0.867           0.779       0.876         0.0542 0.885   0.573
#> SD:mclust   6 0.596           0.525       0.762         0.0465 0.946   0.809
#> CV:mclust   6 0.816           0.813       0.917         0.0412 0.948   0.810
#> MAD:mclust  6 0.644           0.733       0.814         0.0548 0.903   0.657
#> ATC:mclust  6 0.714           0.681       0.793         0.0614 0.890   0.564
#> SD:kmeans   6 0.685           0.585       0.740         0.0500 0.915   0.663
#> CV:kmeans   6 0.672           0.681       0.778         0.0466 0.896   0.596
#> MAD:kmeans  6 0.701           0.635       0.761         0.0450 0.949   0.776
#> ATC:kmeans  6 0.820           0.680       0.824         0.0429 0.972   0.867
#> SD:pam      6 0.826           0.795       0.903         0.0581 0.904   0.645
#> CV:pam      6 0.878           0.855       0.937         0.0552 0.908   0.670
#> MAD:pam     6 0.908           0.850       0.944         0.0505 0.917   0.686
#> ATC:pam     6 0.885           0.802       0.917         0.0734 0.895   0.591
#> SD:hclust   6 0.515           0.639       0.813         0.0158 0.932   0.785
#> CV:hclust   6 0.525           0.539       0.684         0.0518 0.811   0.490
#> MAD:hclust  6 0.601           0.563       0.762         0.0230 0.969   0.888
#> ATC:hclust  6 0.765           0.664       0.868         0.0417 0.924   0.724

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

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 17223 rows and 73 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 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-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.367           0.372       0.695         0.4449 0.740   0.740
#> 3 3 0.431           0.522       0.818         0.2178 0.612   0.504
#> 4 4 0.504           0.665       0.800         0.2899 0.736   0.465
#> 5 5 0.528           0.621       0.795         0.0270 0.946   0.829
#> 6 6 0.515           0.639       0.813         0.0158 0.932   0.785

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
#> SRR2015715     1   0.990     0.6124 0.560 0.440
#> SRR2015735     1   0.680     0.5729 0.820 0.180
#> SRR2015759     1   0.991     0.6118 0.556 0.444
#> SRR2015753     1   0.991     0.6118 0.556 0.444
#> SRR2015746     1   0.358     0.4801 0.932 0.068
#> SRR2015758     1   0.998    -0.8372 0.524 0.476
#> SRR2015756     1   0.991     0.6118 0.556 0.444
#> SRR2015757     1   0.224     0.4415 0.964 0.036
#> SRR2015755     1   0.991     0.6118 0.556 0.444
#> SRR2015754     1   0.991     0.6118 0.556 0.444
#> SRR2015752     1   0.991     0.6118 0.556 0.444
#> SRR2015749     1   0.991     0.6118 0.556 0.444
#> SRR2015750     1   0.996    -0.8158 0.536 0.464
#> SRR2015751     1   0.358     0.4801 0.932 0.068
#> SRR2015748     2   0.975     0.8913 0.408 0.592
#> SRR2015747     1   0.991     0.6118 0.556 0.444
#> SRR2015745     1   0.861    -0.3633 0.716 0.284
#> SRR2015743     1   0.991     0.6118 0.556 0.444
#> SRR2015744     1   0.529     0.5214 0.880 0.120
#> SRR2015742     1   0.388     0.4877 0.924 0.076
#> SRR2015741     1   0.991     0.6118 0.556 0.444
#> SRR2015740     1   0.991     0.6118 0.556 0.444
#> SRR2015738     1   0.991     0.6118 0.556 0.444
#> SRR2015739     1   0.991     0.6118 0.556 0.444
#> SRR2015737     1   0.998    -0.8372 0.524 0.476
#> SRR2015736     1   0.118     0.4277 0.984 0.016
#> SRR2015732     1   0.990     0.6124 0.560 0.440
#> SRR2015733     1   0.141     0.4221 0.980 0.020
#> SRR2015734     1   0.990     0.6124 0.560 0.440
#> SRR2015731     1   0.689     0.5719 0.816 0.184
#> SRR2015730     1   0.991     0.6118 0.556 0.444
#> SRR2015728     1   0.958     0.5976 0.620 0.380
#> SRR2015729     1   0.995    -0.8082 0.540 0.460
#> SRR2015727     1   0.689     0.5719 0.816 0.184
#> SRR2015726     1   0.990     0.6124 0.560 0.440
#> SRR2015723     1   0.781     0.5832 0.768 0.232
#> SRR2015724     1   0.456     0.5112 0.904 0.096
#> SRR2015725     1   0.991     0.6118 0.556 0.444
#> SRR2015722     1   0.689     0.5719 0.816 0.184
#> SRR2015721     1   0.295     0.3697 0.948 0.052
#> SRR2015720     1   0.118     0.4277 0.984 0.016
#> SRR2015718     1   0.456     0.5112 0.904 0.096
#> SRR2015719     2   0.991     0.9898 0.444 0.556
#> SRR2015717     1   0.680     0.5729 0.820 0.180
#> SRR2015716     1   0.781     0.5832 0.768 0.232
#> SRR2015714     2   0.991     0.9898 0.444 0.556
#> SRR2015713     1   0.118     0.4277 0.984 0.016
#> SRR2015784     2   0.991     0.9898 0.444 0.556
#> SRR2015785     2   0.991     0.9898 0.444 0.556
#> SRR2015783     1   0.991     0.6118 0.556 0.444
#> SRR2015782     1   0.973    -0.6942 0.596 0.404
#> SRR2015781     2   0.991     0.9898 0.444 0.556
#> SRR2015780     2   0.991     0.9898 0.444 0.556
#> SRR2015779     2   0.991     0.9898 0.444 0.556
#> SRR2015778     1   0.358     0.4801 0.932 0.068
#> SRR2015777     1   0.358     0.4801 0.932 0.068
#> SRR2015776     2   0.991     0.9898 0.444 0.556
#> SRR2015775     1   0.995    -0.8082 0.540 0.460
#> SRR2015774     1   0.343     0.3487 0.936 0.064
#> SRR2015773     1   0.995    -0.8086 0.540 0.460
#> SRR2015772     1   0.995    -0.8086 0.540 0.460
#> SRR2015771     1   0.990     0.6124 0.560 0.440
#> SRR2015769     1   0.995    -0.8082 0.540 0.460
#> SRR2015770     1   0.998    -0.8372 0.524 0.476
#> SRR2015768     1   0.998    -0.8372 0.524 0.476
#> SRR2015767     2   0.991     0.9898 0.444 0.556
#> SRR2015766     1   0.625     0.5630 0.844 0.156
#> SRR2015764     1   0.995    -0.8086 0.540 0.460
#> SRR2015765     1   0.662     0.0502 0.828 0.172
#> SRR2015763     1   0.990     0.6124 0.560 0.440
#> SRR2015762     2   0.991     0.9898 0.444 0.556
#> SRR2015761     1   0.343     0.3487 0.936 0.064
#> SRR2015760     1   0.671     0.5715 0.824 0.176

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>            class entropy silhouette    p1    p2    p3
#> SRR2015715     1  0.0592    0.77321 0.988 0.012 0.000
#> SRR2015735     1  0.6016    0.59137 0.724 0.256 0.020
#> SRR2015759     1  0.0000    0.77397 1.000 0.000 0.000
#> SRR2015753     1  0.0000    0.77397 1.000 0.000 0.000
#> SRR2015746     1  0.6822    0.10234 0.508 0.480 0.012
#> SRR2015758     2  0.0237    0.61370 0.000 0.996 0.004
#> SRR2015756     1  0.0000    0.77397 1.000 0.000 0.000
#> SRR2015757     2  0.6291    0.00828 0.468 0.532 0.000
#> SRR2015755     1  0.0000    0.77397 1.000 0.000 0.000
#> SRR2015754     1  0.0237    0.77189 0.996 0.000 0.004
#> SRR2015752     1  0.0000    0.77397 1.000 0.000 0.000
#> SRR2015749     1  0.0000    0.77397 1.000 0.000 0.000
#> SRR2015750     2  0.1015    0.62170 0.008 0.980 0.012
#> SRR2015751     1  0.6822    0.10234 0.508 0.480 0.012
#> SRR2015748     3  0.6662    0.68479 0.052 0.232 0.716
#> SRR2015747     1  0.0000    0.77397 1.000 0.000 0.000
#> SRR2015745     2  0.4968    0.56390 0.188 0.800 0.012
#> SRR2015743     1  0.0000    0.77397 1.000 0.000 0.000
#> SRR2015744     1  0.6879    0.26012 0.556 0.428 0.016
#> SRR2015742     1  0.6816    0.13045 0.516 0.472 0.012
#> SRR2015741     1  0.0000    0.77397 1.000 0.000 0.000
#> SRR2015740     1  0.0000    0.77397 1.000 0.000 0.000
#> SRR2015738     1  0.0237    0.77189 0.996 0.000 0.004
#> SRR2015739     1  0.0000    0.77397 1.000 0.000 0.000
#> SRR2015737     2  0.0237    0.61370 0.000 0.996 0.004
#> SRR2015736     2  0.6274    0.04970 0.456 0.544 0.000
#> SRR2015732     1  0.0592    0.77276 0.988 0.012 0.000
#> SRR2015733     2  0.6267    0.06136 0.452 0.548 0.000
#> SRR2015734     1  0.0592    0.77321 0.988 0.012 0.000
#> SRR2015731     1  0.6143    0.58831 0.720 0.256 0.024
#> SRR2015730     1  0.0000    0.77397 1.000 0.000 0.000
#> SRR2015728     1  0.2878    0.72313 0.904 0.096 0.000
#> SRR2015729     2  0.1182    0.62399 0.012 0.976 0.012
#> SRR2015727     1  0.6143    0.58831 0.720 0.256 0.024
#> SRR2015726     1  0.0592    0.77276 0.988 0.012 0.000
#> SRR2015723     1  0.5497    0.53884 0.708 0.292 0.000
#> SRR2015724     1  0.6779    0.21445 0.544 0.444 0.012
#> SRR2015725     1  0.0000    0.77397 1.000 0.000 0.000
#> SRR2015722     1  0.6143    0.58831 0.720 0.256 0.024
#> SRR2015721     2  0.6724    0.15400 0.420 0.568 0.012
#> SRR2015720     2  0.6274    0.04970 0.456 0.544 0.000
#> SRR2015718     1  0.6779    0.21445 0.544 0.444 0.012
#> SRR2015719     3  0.0424    0.86832 0.000 0.008 0.992
#> SRR2015717     1  0.6016    0.59137 0.724 0.256 0.020
#> SRR2015716     1  0.5497    0.53884 0.708 0.292 0.000
#> SRR2015714     3  0.0747    0.86666 0.000 0.016 0.984
#> SRR2015713     2  0.6274    0.04970 0.456 0.544 0.000
#> SRR2015784     2  0.5016    0.27869 0.000 0.760 0.240
#> SRR2015785     2  0.5138    0.28043 0.000 0.748 0.252
#> SRR2015783     1  0.0000    0.77397 1.000 0.000 0.000
#> SRR2015782     2  0.2261    0.62338 0.068 0.932 0.000
#> SRR2015781     2  0.6305   -0.30691 0.000 0.516 0.484
#> SRR2015780     2  0.5138    0.28043 0.000 0.748 0.252
#> SRR2015779     2  0.6305   -0.30691 0.000 0.516 0.484
#> SRR2015778     1  0.6822    0.10234 0.508 0.480 0.012
#> SRR2015777     1  0.6822    0.10234 0.508 0.480 0.012
#> SRR2015776     3  0.0424    0.86832 0.000 0.008 0.992
#> SRR2015775     2  0.1182    0.62399 0.012 0.976 0.012
#> SRR2015774     2  0.6688    0.18245 0.408 0.580 0.012
#> SRR2015773     2  0.0983    0.62432 0.016 0.980 0.004
#> SRR2015772     2  0.0983    0.62432 0.016 0.980 0.004
#> SRR2015771     1  0.0592    0.77321 0.988 0.012 0.000
#> SRR2015769     2  0.1182    0.62399 0.012 0.976 0.012
#> SRR2015770     2  0.0237    0.61370 0.000 0.996 0.004
#> SRR2015768     2  0.0237    0.61370 0.000 0.996 0.004
#> SRR2015767     3  0.0424    0.86832 0.000 0.008 0.992
#> SRR2015766     1  0.6445    0.51857 0.672 0.308 0.020
#> SRR2015764     2  0.0983    0.62432 0.016 0.980 0.004
#> SRR2015765     2  0.6113    0.40822 0.300 0.688 0.012
#> SRR2015763     1  0.0592    0.77321 0.988 0.012 0.000
#> SRR2015762     3  0.5948    0.46665 0.000 0.360 0.640
#> SRR2015761     2  0.6688    0.18245 0.408 0.580 0.012
#> SRR2015760     1  0.6053    0.58705 0.720 0.260 0.020

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> SRR2015715     1   0.321     0.7849 0.848 0.004 0.148 0.000
#> SRR2015735     3   0.544     0.6411 0.048 0.012 0.732 0.208
#> SRR2015759     1   0.000     0.8213 1.000 0.000 0.000 0.000
#> SRR2015753     1   0.000     0.8213 1.000 0.000 0.000 0.000
#> SRR2015746     3   0.486     0.7170 0.136 0.084 0.780 0.000
#> SRR2015758     2   0.365     0.7649 0.000 0.796 0.204 0.000
#> SRR2015756     1   0.000     0.8213 1.000 0.000 0.000 0.000
#> SRR2015757     3   0.280     0.7441 0.016 0.092 0.892 0.000
#> SRR2015755     1   0.206     0.8035 0.932 0.000 0.016 0.052
#> SRR2015754     1   0.732     0.3829 0.512 0.000 0.308 0.180
#> SRR2015752     1   0.000     0.8213 1.000 0.000 0.000 0.000
#> SRR2015749     1   0.000     0.8213 1.000 0.000 0.000 0.000
#> SRR2015750     2   0.398     0.7578 0.000 0.760 0.240 0.000
#> SRR2015751     3   0.486     0.7170 0.136 0.084 0.780 0.000
#> SRR2015748     4   0.661     0.6407 0.000 0.376 0.088 0.536
#> SRR2015747     1   0.000     0.8213 1.000 0.000 0.000 0.000
#> SRR2015745     2   0.500     0.2552 0.000 0.504 0.496 0.000
#> SRR2015743     1   0.000     0.8213 1.000 0.000 0.000 0.000
#> SRR2015744     3   0.399     0.7147 0.140 0.028 0.828 0.004
#> SRR2015742     3   0.466     0.7199 0.136 0.072 0.792 0.000
#> SRR2015741     1   0.655     0.5873 0.636 0.000 0.188 0.176
#> SRR2015740     1   0.000     0.8213 1.000 0.000 0.000 0.000
#> SRR2015738     1   0.732     0.3829 0.512 0.000 0.308 0.180
#> SRR2015739     1   0.000     0.8213 1.000 0.000 0.000 0.000
#> SRR2015737     2   0.365     0.7649 0.000 0.796 0.204 0.000
#> SRR2015736     3   0.222     0.7394 0.000 0.092 0.908 0.000
#> SRR2015732     1   0.307     0.7845 0.848 0.000 0.152 0.000
#> SRR2015733     3   0.228     0.7376 0.000 0.096 0.904 0.000
#> SRR2015734     1   0.321     0.7849 0.848 0.004 0.148 0.000
#> SRR2015731     3   0.530     0.6442 0.036 0.016 0.740 0.208
#> SRR2015730     1   0.000     0.8213 1.000 0.000 0.000 0.000
#> SRR2015728     1   0.535     0.5311 0.700 0.036 0.260 0.004
#> SRR2015729     2   0.410     0.7494 0.000 0.744 0.256 0.000
#> SRR2015727     3   0.530     0.6442 0.036 0.016 0.740 0.208
#> SRR2015726     1   0.307     0.7845 0.848 0.000 0.152 0.000
#> SRR2015723     1   0.530     0.1116 0.500 0.008 0.492 0.000
#> SRR2015724     3   0.472     0.7138 0.136 0.076 0.788 0.000
#> SRR2015725     1   0.000     0.8213 1.000 0.000 0.000 0.000
#> SRR2015722     3   0.530     0.6442 0.036 0.016 0.740 0.208
#> SRR2015721     3   0.297     0.6997 0.000 0.144 0.856 0.000
#> SRR2015720     3   0.222     0.7394 0.000 0.092 0.908 0.000
#> SRR2015718     3   0.472     0.7138 0.136 0.076 0.788 0.000
#> SRR2015719     4   0.373     0.9253 0.000 0.212 0.000 0.788
#> SRR2015717     3   0.544     0.6411 0.048 0.012 0.732 0.208
#> SRR2015716     1   0.530     0.1116 0.500 0.008 0.492 0.000
#> SRR2015714     4   0.380     0.9209 0.000 0.220 0.000 0.780
#> SRR2015713     3   0.222     0.7394 0.000 0.092 0.908 0.000
#> SRR2015784     2   0.131     0.5293 0.000 0.960 0.004 0.036
#> SRR2015785     2   0.171     0.5321 0.000 0.948 0.016 0.036
#> SRR2015783     1   0.000     0.8213 1.000 0.000 0.000 0.000
#> SRR2015782     2   0.462     0.6356 0.000 0.660 0.340 0.000
#> SRR2015781     2   0.428     0.0356 0.000 0.720 0.000 0.280
#> SRR2015780     2   0.171     0.5321 0.000 0.948 0.016 0.036
#> SRR2015779     2   0.428     0.0356 0.000 0.720 0.000 0.280
#> SRR2015778     3   0.486     0.7170 0.136 0.084 0.780 0.000
#> SRR2015777     3   0.486     0.7170 0.136 0.084 0.780 0.000
#> SRR2015776     4   0.373     0.9253 0.000 0.212 0.000 0.788
#> SRR2015775     2   0.410     0.7494 0.000 0.744 0.256 0.000
#> SRR2015774     3   0.307     0.6915 0.000 0.152 0.848 0.000
#> SRR2015773     2   0.441     0.7124 0.000 0.700 0.300 0.000
#> SRR2015772     2   0.441     0.7124 0.000 0.700 0.300 0.000
#> SRR2015771     1   0.321     0.7849 0.848 0.004 0.148 0.000
#> SRR2015769     2   0.410     0.7494 0.000 0.744 0.256 0.000
#> SRR2015770     2   0.365     0.7649 0.000 0.796 0.204 0.000
#> SRR2015768     2   0.365     0.7649 0.000 0.796 0.204 0.000
#> SRR2015767     4   0.373     0.9253 0.000 0.212 0.000 0.788
#> SRR2015766     3   0.469     0.6806 0.036 0.012 0.792 0.160
#> SRR2015764     2   0.441     0.7124 0.000 0.700 0.300 0.000
#> SRR2015765     3   0.464     0.2808 0.000 0.344 0.656 0.000
#> SRR2015763     1   0.321     0.7849 0.848 0.004 0.148 0.000
#> SRR2015762     2   0.494    -0.3936 0.000 0.564 0.000 0.436
#> SRR2015761     3   0.307     0.6915 0.000 0.152 0.848 0.000
#> SRR2015760     3   0.524     0.6485 0.040 0.012 0.744 0.204

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>            class entropy silhouette    p1    p2    p3    p4    p5
#> SRR2015715     1  0.2690     0.7859 0.844 0.000 0.156 0.000 0.000
#> SRR2015735     3  0.4639     0.5145 0.024 0.000 0.632 0.000 0.344
#> SRR2015759     1  0.0000     0.8347 1.000 0.000 0.000 0.000 0.000
#> SRR2015753     1  0.0000     0.8347 1.000 0.000 0.000 0.000 0.000
#> SRR2015746     3  0.3730     0.6915 0.136 0.028 0.820 0.000 0.016
#> SRR2015758     2  0.3074     0.7535 0.000 0.804 0.196 0.000 0.000
#> SRR2015756     1  0.0000     0.8347 1.000 0.000 0.000 0.000 0.000
#> SRR2015757     3  0.0912     0.7103 0.012 0.016 0.972 0.000 0.000
#> SRR2015755     1  0.1697     0.8071 0.932 0.000 0.008 0.000 0.060
#> SRR2015754     1  0.6472     0.3225 0.492 0.000 0.224 0.000 0.284
#> SRR2015752     1  0.0000     0.8347 1.000 0.000 0.000 0.000 0.000
#> SRR2015749     1  0.0000     0.8347 1.000 0.000 0.000 0.000 0.000
#> SRR2015750     2  0.3779     0.7475 0.000 0.752 0.236 0.000 0.012
#> SRR2015751     3  0.3730     0.6915 0.136 0.028 0.820 0.000 0.016
#> SRR2015748     5  0.6448     0.0000 0.000 0.172 0.016 0.248 0.564
#> SRR2015747     1  0.0000     0.8347 1.000 0.000 0.000 0.000 0.000
#> SRR2015745     3  0.4655    -0.2705 0.000 0.476 0.512 0.000 0.012
#> SRR2015743     1  0.0000     0.8347 1.000 0.000 0.000 0.000 0.000
#> SRR2015744     3  0.4863     0.6846 0.140 0.028 0.756 0.000 0.076
#> SRR2015742     3  0.4000     0.6930 0.136 0.028 0.808 0.000 0.028
#> SRR2015741     1  0.5759     0.5467 0.616 0.000 0.160 0.000 0.224
#> SRR2015740     1  0.0000     0.8347 1.000 0.000 0.000 0.000 0.000
#> SRR2015738     1  0.6472     0.3225 0.492 0.000 0.224 0.000 0.284
#> SRR2015739     1  0.0000     0.8347 1.000 0.000 0.000 0.000 0.000
#> SRR2015737     2  0.3074     0.7535 0.000 0.804 0.196 0.000 0.000
#> SRR2015736     3  0.0609     0.7062 0.000 0.020 0.980 0.000 0.000
#> SRR2015732     1  0.2690     0.7861 0.844 0.000 0.156 0.000 0.000
#> SRR2015733     3  0.0703     0.7049 0.000 0.024 0.976 0.000 0.000
#> SRR2015734     1  0.2690     0.7859 0.844 0.000 0.156 0.000 0.000
#> SRR2015731     3  0.4387     0.5175 0.012 0.000 0.640 0.000 0.348
#> SRR2015730     1  0.0000     0.8347 1.000 0.000 0.000 0.000 0.000
#> SRR2015728     1  0.8443    -0.1630 0.316 0.000 0.300 0.196 0.188
#> SRR2015729     2  0.3878     0.7455 0.000 0.748 0.236 0.000 0.016
#> SRR2015727     3  0.4387     0.5175 0.012 0.000 0.640 0.000 0.348
#> SRR2015726     1  0.2690     0.7861 0.844 0.000 0.156 0.000 0.000
#> SRR2015723     3  0.4452    -0.0574 0.496 0.000 0.500 0.000 0.004
#> SRR2015724     3  0.3174     0.6898 0.132 0.020 0.844 0.000 0.004
#> SRR2015725     1  0.0000     0.8347 1.000 0.000 0.000 0.000 0.000
#> SRR2015722     3  0.4387     0.5175 0.012 0.000 0.640 0.000 0.348
#> SRR2015721     3  0.1608     0.6764 0.000 0.072 0.928 0.000 0.000
#> SRR2015720     3  0.0609     0.7062 0.000 0.020 0.980 0.000 0.000
#> SRR2015718     3  0.3174     0.6898 0.132 0.020 0.844 0.000 0.004
#> SRR2015719     4  0.3074     0.9880 0.000 0.196 0.000 0.804 0.000
#> SRR2015717     3  0.4639     0.5145 0.024 0.000 0.632 0.000 0.344
#> SRR2015716     3  0.4452    -0.0574 0.496 0.000 0.500 0.000 0.004
#> SRR2015714     4  0.3177     0.9641 0.000 0.208 0.000 0.792 0.000
#> SRR2015713     3  0.0609     0.7062 0.000 0.020 0.980 0.000 0.000
#> SRR2015784     2  0.1043     0.5431 0.000 0.960 0.000 0.040 0.000
#> SRR2015785     2  0.1444     0.5426 0.000 0.948 0.000 0.040 0.012
#> SRR2015783     1  0.0000     0.8347 1.000 0.000 0.000 0.000 0.000
#> SRR2015782     2  0.4088     0.5995 0.000 0.632 0.368 0.000 0.000
#> SRR2015781     2  0.3707     0.1276 0.000 0.716 0.000 0.284 0.000
#> SRR2015780     2  0.1444     0.5426 0.000 0.948 0.000 0.040 0.012
#> SRR2015779     2  0.3707     0.1276 0.000 0.716 0.000 0.284 0.000
#> SRR2015778     3  0.3730     0.6915 0.136 0.028 0.820 0.000 0.016
#> SRR2015777     3  0.3730     0.6915 0.136 0.028 0.820 0.000 0.016
#> SRR2015776     4  0.3074     0.9880 0.000 0.196 0.000 0.804 0.000
#> SRR2015775     2  0.3878     0.7455 0.000 0.748 0.236 0.000 0.016
#> SRR2015774     3  0.2068     0.6686 0.000 0.092 0.904 0.000 0.004
#> SRR2015773     2  0.3966     0.6819 0.000 0.664 0.336 0.000 0.000
#> SRR2015772     2  0.3966     0.6819 0.000 0.664 0.336 0.000 0.000
#> SRR2015771     1  0.2690     0.7859 0.844 0.000 0.156 0.000 0.000
#> SRR2015769     2  0.3878     0.7455 0.000 0.748 0.236 0.000 0.016
#> SRR2015770     2  0.3074     0.7535 0.000 0.804 0.196 0.000 0.000
#> SRR2015768     2  0.3074     0.7535 0.000 0.804 0.196 0.000 0.000
#> SRR2015767     4  0.3074     0.9880 0.000 0.196 0.000 0.804 0.000
#> SRR2015766     3  0.4109     0.5733 0.012 0.000 0.700 0.000 0.288
#> SRR2015764     2  0.3966     0.6819 0.000 0.664 0.336 0.000 0.000
#> SRR2015765     3  0.3969     0.3093 0.000 0.304 0.692 0.000 0.004
#> SRR2015763     1  0.2690     0.7859 0.844 0.000 0.156 0.000 0.000
#> SRR2015762     2  0.4268    -0.3568 0.000 0.556 0.000 0.444 0.000
#> SRR2015761     3  0.2068     0.6686 0.000 0.092 0.904 0.000 0.004
#> SRR2015760     3  0.4435     0.5264 0.016 0.000 0.648 0.000 0.336

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>            class entropy silhouette    p1    p2    p3    p4    p5    p6
#> SRR2015715     1  0.2704     0.7730 0.844 0.000 0.140 0.000 0.016 0.000
#> SRR2015735     3  0.3238     0.5580 0.012 0.000 0.832 0.000 0.120 0.036
#> SRR2015759     1  0.0000     0.8105 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2015753     1  0.0000     0.8105 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2015746     3  0.5081     0.7225 0.124 0.204 0.660 0.000 0.012 0.000
#> SRR2015758     2  0.0000     0.7715 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2015756     1  0.0000     0.8105 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2015757     3  0.4004     0.7535 0.012 0.188 0.764 0.000 0.020 0.016
#> SRR2015755     1  0.1563     0.7805 0.932 0.000 0.056 0.000 0.012 0.000
#> SRR2015754     1  0.5841     0.3326 0.480 0.000 0.400 0.000 0.084 0.036
#> SRR2015752     1  0.0000     0.8105 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2015749     1  0.0000     0.8105 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2015750     2  0.1297     0.7684 0.000 0.948 0.040 0.000 0.012 0.000
#> SRR2015751     3  0.5081     0.7225 0.124 0.204 0.660 0.000 0.012 0.000
#> SRR2015748     5  0.2412     0.0000 0.000 0.000 0.028 0.092 0.880 0.000
#> SRR2015747     1  0.0000     0.8105 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2015745     2  0.3898     0.2659 0.000 0.652 0.336 0.000 0.012 0.000
#> SRR2015743     1  0.0000     0.8105 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2015744     3  0.6397     0.7128 0.128 0.204 0.592 0.000 0.040 0.036
#> SRR2015742     3  0.5323     0.7234 0.124 0.204 0.648 0.000 0.024 0.000
#> SRR2015741     1  0.4683     0.5497 0.616 0.000 0.320 0.000 0.064 0.000
#> SRR2015740     1  0.0000     0.8105 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2015738     1  0.5841     0.3326 0.480 0.000 0.400 0.000 0.084 0.036
#> SRR2015739     1  0.0000     0.8105 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2015737     2  0.0000     0.7715 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2015736     3  0.3720     0.7504 0.000 0.196 0.768 0.000 0.020 0.016
#> SRR2015732     1  0.2750     0.7732 0.844 0.000 0.136 0.000 0.020 0.000
#> SRR2015733     3  0.3750     0.7489 0.000 0.200 0.764 0.000 0.020 0.016
#> SRR2015734     1  0.2704     0.7730 0.844 0.000 0.140 0.000 0.016 0.000
#> SRR2015731     3  0.2930     0.5620 0.000 0.000 0.840 0.000 0.124 0.036
#> SRR2015730     1  0.0000     0.8105 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2015728     6  0.0935     0.0000 0.004 0.000 0.032 0.000 0.000 0.964
#> SRR2015729     2  0.1391     0.7665 0.000 0.944 0.040 0.000 0.016 0.000
#> SRR2015727     3  0.2930     0.5620 0.000 0.000 0.840 0.000 0.124 0.036
#> SRR2015726     1  0.2750     0.7732 0.844 0.000 0.136 0.000 0.020 0.000
#> SRR2015723     1  0.6081     0.1397 0.496 0.140 0.336 0.000 0.028 0.000
#> SRR2015724     3  0.4817     0.7070 0.132 0.184 0.680 0.000 0.004 0.000
#> SRR2015725     1  0.0000     0.8105 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2015722     3  0.2930     0.5620 0.000 0.000 0.840 0.000 0.124 0.036
#> SRR2015721     3  0.3983     0.7172 0.000 0.248 0.720 0.000 0.020 0.012
#> SRR2015720     3  0.3720     0.7504 0.000 0.196 0.768 0.000 0.020 0.016
#> SRR2015718     3  0.4817     0.7070 0.132 0.184 0.680 0.000 0.004 0.000
#> SRR2015719     4  0.0000     0.7371 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR2015717     3  0.3238     0.5580 0.012 0.000 0.832 0.000 0.120 0.036
#> SRR2015716     1  0.6081     0.1397 0.496 0.140 0.336 0.000 0.028 0.000
#> SRR2015714     4  0.1434     0.6993 0.000 0.012 0.000 0.940 0.048 0.000
#> SRR2015713     3  0.3720     0.7504 0.000 0.196 0.768 0.000 0.020 0.016
#> SRR2015784     2  0.3893     0.5562 0.000 0.764 0.000 0.080 0.156 0.000
#> SRR2015785     2  0.3996     0.5559 0.000 0.752 0.000 0.080 0.168 0.000
#> SRR2015783     1  0.0000     0.8105 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2015782     2  0.2730     0.6334 0.000 0.808 0.192 0.000 0.000 0.000
#> SRR2015781     2  0.5553     0.0916 0.000 0.520 0.000 0.324 0.156 0.000
#> SRR2015780     2  0.3996     0.5559 0.000 0.752 0.000 0.080 0.168 0.000
#> SRR2015779     2  0.5553     0.0916 0.000 0.520 0.000 0.324 0.156 0.000
#> SRR2015778     3  0.5081     0.7225 0.124 0.204 0.660 0.000 0.012 0.000
#> SRR2015777     3  0.5081     0.7225 0.124 0.204 0.660 0.000 0.012 0.000
#> SRR2015776     4  0.0000     0.7371 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR2015775     2  0.1391     0.7665 0.000 0.944 0.040 0.000 0.016 0.000
#> SRR2015774     3  0.3831     0.7093 0.000 0.268 0.712 0.000 0.008 0.012
#> SRR2015773     2  0.2489     0.7183 0.000 0.860 0.128 0.000 0.000 0.012
#> SRR2015772     2  0.2489     0.7183 0.000 0.860 0.128 0.000 0.000 0.012
#> SRR2015771     1  0.2704     0.7730 0.844 0.000 0.140 0.000 0.016 0.000
#> SRR2015769     2  0.1391     0.7665 0.000 0.944 0.040 0.000 0.016 0.000
#> SRR2015770     2  0.0000     0.7715 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2015768     2  0.0000     0.7715 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2015767     4  0.0000     0.7371 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR2015766     3  0.3493     0.6141 0.000 0.036 0.828 0.000 0.100 0.036
#> SRR2015764     2  0.2489     0.7183 0.000 0.860 0.128 0.000 0.000 0.012
#> SRR2015765     3  0.4095     0.3060 0.000 0.480 0.512 0.000 0.008 0.000
#> SRR2015763     1  0.2704     0.7730 0.844 0.000 0.140 0.000 0.016 0.000
#> SRR2015762     4  0.5631     0.1090 0.000 0.360 0.000 0.484 0.156 0.000
#> SRR2015761     3  0.3831     0.7093 0.000 0.268 0.712 0.000 0.008 0.012
#> SRR2015760     3  0.3126     0.5708 0.004 0.004 0.840 0.000 0.116 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-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

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 17223 rows and 73 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.802           0.951       0.970         0.4855 0.521   0.521
#> 3 3 0.534           0.686       0.838         0.3040 0.703   0.484
#> 4 4 0.641           0.765       0.850         0.1283 0.832   0.576
#> 5 5 0.676           0.671       0.772         0.0832 0.905   0.689
#> 6 6 0.685           0.585       0.740         0.0500 0.915   0.663

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
#> SRR2015715     1   0.000      0.951 1.000 0.000
#> SRR2015735     1   0.000      0.951 1.000 0.000
#> SRR2015759     1   0.000      0.951 1.000 0.000
#> SRR2015753     1   0.000      0.951 1.000 0.000
#> SRR2015746     1   0.343      0.921 0.936 0.064
#> SRR2015758     2   0.000      1.000 0.000 1.000
#> SRR2015756     1   0.000      0.951 1.000 0.000
#> SRR2015757     1   0.000      0.951 1.000 0.000
#> SRR2015755     1   0.000      0.951 1.000 0.000
#> SRR2015754     1   0.000      0.951 1.000 0.000
#> SRR2015752     1   0.000      0.951 1.000 0.000
#> SRR2015749     1   0.000      0.951 1.000 0.000
#> SRR2015750     2   0.000      1.000 0.000 1.000
#> SRR2015751     1   0.000      0.951 1.000 0.000
#> SRR2015748     2   0.000      1.000 0.000 1.000
#> SRR2015747     1   0.000      0.951 1.000 0.000
#> SRR2015745     2   0.000      1.000 0.000 1.000
#> SRR2015743     1   0.000      0.951 1.000 0.000
#> SRR2015744     1   0.680      0.834 0.820 0.180
#> SRR2015742     1   0.671      0.838 0.824 0.176
#> SRR2015741     1   0.000      0.951 1.000 0.000
#> SRR2015740     1   0.000      0.951 1.000 0.000
#> SRR2015738     1   0.000      0.951 1.000 0.000
#> SRR2015739     1   0.000      0.951 1.000 0.000
#> SRR2015737     2   0.000      1.000 0.000 1.000
#> SRR2015736     1   0.430      0.906 0.912 0.088
#> SRR2015732     1   0.000      0.951 1.000 0.000
#> SRR2015733     2   0.000      1.000 0.000 1.000
#> SRR2015734     1   0.000      0.951 1.000 0.000
#> SRR2015731     1   0.680      0.834 0.820 0.180
#> SRR2015730     1   0.000      0.951 1.000 0.000
#> SRR2015728     1   0.000      0.951 1.000 0.000
#> SRR2015729     2   0.000      1.000 0.000 1.000
#> SRR2015727     1   0.680      0.834 0.820 0.180
#> SRR2015726     1   0.000      0.951 1.000 0.000
#> SRR2015723     1   0.000      0.951 1.000 0.000
#> SRR2015724     1   0.000      0.951 1.000 0.000
#> SRR2015725     1   0.000      0.951 1.000 0.000
#> SRR2015722     1   0.680      0.834 0.820 0.180
#> SRR2015721     1   0.760      0.775 0.780 0.220
#> SRR2015720     1   0.430      0.906 0.912 0.088
#> SRR2015718     1   0.482      0.896 0.896 0.104
#> SRR2015719     2   0.000      1.000 0.000 1.000
#> SRR2015717     1   0.000      0.951 1.000 0.000
#> SRR2015716     1   0.000      0.951 1.000 0.000
#> SRR2015714     2   0.000      1.000 0.000 1.000
#> SRR2015713     1   0.760      0.775 0.780 0.220
#> SRR2015784     2   0.000      1.000 0.000 1.000
#> SRR2015785     2   0.000      1.000 0.000 1.000
#> SRR2015783     1   0.000      0.951 1.000 0.000
#> SRR2015782     2   0.000      1.000 0.000 1.000
#> SRR2015781     2   0.000      1.000 0.000 1.000
#> SRR2015780     2   0.000      1.000 0.000 1.000
#> SRR2015779     2   0.000      1.000 0.000 1.000
#> SRR2015778     1   0.689      0.830 0.816 0.184
#> SRR2015777     1   0.506      0.891 0.888 0.112
#> SRR2015776     2   0.000      1.000 0.000 1.000
#> SRR2015775     2   0.000      1.000 0.000 1.000
#> SRR2015774     2   0.000      1.000 0.000 1.000
#> SRR2015773     2   0.000      1.000 0.000 1.000
#> SRR2015772     2   0.000      1.000 0.000 1.000
#> SRR2015771     1   0.000      0.951 1.000 0.000
#> SRR2015769     2   0.000      1.000 0.000 1.000
#> SRR2015770     2   0.000      1.000 0.000 1.000
#> SRR2015768     2   0.000      1.000 0.000 1.000
#> SRR2015767     2   0.000      1.000 0.000 1.000
#> SRR2015766     1   0.680      0.834 0.820 0.180
#> SRR2015764     2   0.000      1.000 0.000 1.000
#> SRR2015765     2   0.000      1.000 0.000 1.000
#> SRR2015763     1   0.000      0.951 1.000 0.000
#> SRR2015762     2   0.000      1.000 0.000 1.000
#> SRR2015761     2   0.000      1.000 0.000 1.000
#> SRR2015760     1   0.000      0.951 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
#> SRR2015715     1  0.6305     0.0309 0.516 0.000 0.484
#> SRR2015735     3  0.6274     0.1300 0.456 0.000 0.544
#> SRR2015759     1  0.0000     0.8634 1.000 0.000 0.000
#> SRR2015753     1  0.0000     0.8634 1.000 0.000 0.000
#> SRR2015746     3  0.3340     0.8247 0.120 0.000 0.880
#> SRR2015758     2  0.5760     0.7647 0.000 0.672 0.328
#> SRR2015756     1  0.0000     0.8634 1.000 0.000 0.000
#> SRR2015757     3  0.3267     0.8267 0.116 0.000 0.884
#> SRR2015755     1  0.0000     0.8634 1.000 0.000 0.000
#> SRR2015754     1  0.0000     0.8634 1.000 0.000 0.000
#> SRR2015752     1  0.0000     0.8634 1.000 0.000 0.000
#> SRR2015749     1  0.0000     0.8634 1.000 0.000 0.000
#> SRR2015750     2  0.6168     0.6864 0.000 0.588 0.412
#> SRR2015751     3  0.3340     0.8247 0.120 0.000 0.880
#> SRR2015748     2  0.5722     0.7193 0.004 0.704 0.292
#> SRR2015747     1  0.0000     0.8634 1.000 0.000 0.000
#> SRR2015745     2  0.6140     0.6962 0.000 0.596 0.404
#> SRR2015743     1  0.0000     0.8634 1.000 0.000 0.000
#> SRR2015744     3  0.3340     0.8247 0.120 0.000 0.880
#> SRR2015742     3  0.3267     0.8268 0.116 0.000 0.884
#> SRR2015741     1  0.0000     0.8634 1.000 0.000 0.000
#> SRR2015740     1  0.0000     0.8634 1.000 0.000 0.000
#> SRR2015738     1  0.0000     0.8634 1.000 0.000 0.000
#> SRR2015739     1  0.0000     0.8634 1.000 0.000 0.000
#> SRR2015737     2  0.5706     0.7698 0.000 0.680 0.320
#> SRR2015736     3  0.3192     0.8275 0.112 0.000 0.888
#> SRR2015732     1  0.5706     0.4565 0.680 0.000 0.320
#> SRR2015733     3  0.6299    -0.5066 0.000 0.476 0.524
#> SRR2015734     1  0.6274     0.1364 0.544 0.000 0.456
#> SRR2015731     3  0.3116     0.8274 0.108 0.000 0.892
#> SRR2015730     1  0.0000     0.8634 1.000 0.000 0.000
#> SRR2015728     3  0.4121     0.7757 0.168 0.000 0.832
#> SRR2015729     3  0.6309    -0.5418 0.000 0.496 0.504
#> SRR2015727     3  0.3267     0.8260 0.116 0.000 0.884
#> SRR2015726     3  0.6168     0.2828 0.412 0.000 0.588
#> SRR2015723     3  0.3116     0.8269 0.108 0.000 0.892
#> SRR2015724     3  0.3267     0.8266 0.116 0.000 0.884
#> SRR2015725     1  0.0000     0.8634 1.000 0.000 0.000
#> SRR2015722     3  0.3267     0.8260 0.116 0.000 0.884
#> SRR2015721     3  0.1411     0.7849 0.036 0.000 0.964
#> SRR2015720     3  0.3192     0.8275 0.112 0.000 0.888
#> SRR2015718     3  0.2959     0.8250 0.100 0.000 0.900
#> SRR2015719     2  0.0747     0.7778 0.000 0.984 0.016
#> SRR2015717     3  0.5968     0.4138 0.364 0.000 0.636
#> SRR2015716     3  0.5988     0.4059 0.368 0.000 0.632
#> SRR2015714     2  0.0747     0.7778 0.000 0.984 0.016
#> SRR2015713     3  0.1411     0.7849 0.036 0.000 0.964
#> SRR2015784     2  0.3192     0.8104 0.000 0.888 0.112
#> SRR2015785     2  0.2796     0.8081 0.000 0.908 0.092
#> SRR2015783     1  0.0000     0.8634 1.000 0.000 0.000
#> SRR2015782     2  0.6168     0.6864 0.000 0.588 0.412
#> SRR2015781     2  0.1964     0.8019 0.000 0.944 0.056
#> SRR2015780     2  0.3116     0.8103 0.000 0.892 0.108
#> SRR2015779     2  0.1860     0.8024 0.000 0.948 0.052
#> SRR2015778     3  0.1753     0.7945 0.048 0.000 0.952
#> SRR2015777     3  0.3192     0.8276 0.112 0.000 0.888
#> SRR2015776     2  0.0747     0.7778 0.000 0.984 0.016
#> SRR2015775     3  0.0892     0.7409 0.000 0.020 0.980
#> SRR2015774     3  0.0747     0.7443 0.000 0.016 0.984
#> SRR2015773     2  0.5905     0.7459 0.000 0.648 0.352
#> SRR2015772     2  0.5706     0.7698 0.000 0.680 0.320
#> SRR2015771     1  0.6274     0.1364 0.544 0.000 0.456
#> SRR2015769     2  0.6280     0.6053 0.000 0.540 0.460
#> SRR2015770     2  0.5098     0.7962 0.000 0.752 0.248
#> SRR2015768     2  0.4178     0.8102 0.000 0.828 0.172
#> SRR2015767     2  0.0747     0.7778 0.000 0.984 0.016
#> SRR2015766     3  0.3038     0.8267 0.104 0.000 0.896
#> SRR2015764     2  0.6235     0.6511 0.000 0.564 0.436
#> SRR2015765     3  0.5810    -0.0671 0.000 0.336 0.664
#> SRR2015763     1  0.6274     0.1364 0.544 0.000 0.456
#> SRR2015762     2  0.1964     0.8019 0.000 0.944 0.056
#> SRR2015761     3  0.0592     0.7456 0.000 0.012 0.988
#> SRR2015760     3  0.3551     0.8142 0.132 0.000 0.868

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> SRR2015715     3  0.4869     0.6689 0.260 0.004 0.720 0.016
#> SRR2015735     3  0.3090     0.8391 0.056 0.000 0.888 0.056
#> SRR2015759     1  0.0188     0.9423 0.996 0.000 0.004 0.000
#> SRR2015753     1  0.0188     0.9423 0.996 0.000 0.004 0.000
#> SRR2015746     3  0.5493     0.7917 0.004 0.084 0.736 0.176
#> SRR2015758     2  0.1284     0.7332 0.000 0.964 0.024 0.012
#> SRR2015756     1  0.0376     0.9418 0.992 0.000 0.004 0.004
#> SRR2015757     3  0.2587     0.8488 0.004 0.076 0.908 0.012
#> SRR2015755     1  0.1807     0.9138 0.940 0.000 0.052 0.008
#> SRR2015754     1  0.2271     0.8925 0.916 0.000 0.076 0.008
#> SRR2015752     1  0.0657     0.9391 0.984 0.000 0.004 0.012
#> SRR2015749     1  0.0188     0.9423 0.996 0.000 0.004 0.000
#> SRR2015750     2  0.2385     0.7368 0.000 0.920 0.028 0.052
#> SRR2015751     3  0.5321     0.7971 0.004 0.084 0.752 0.160
#> SRR2015748     2  0.6618     0.1081 0.004 0.468 0.068 0.460
#> SRR2015747     1  0.0376     0.9418 0.992 0.000 0.004 0.004
#> SRR2015745     2  0.3575     0.6933 0.004 0.852 0.020 0.124
#> SRR2015743     1  0.0188     0.9423 0.996 0.000 0.004 0.000
#> SRR2015744     3  0.4151     0.7840 0.004 0.016 0.800 0.180
#> SRR2015742     3  0.4107     0.7862 0.004 0.016 0.804 0.176
#> SRR2015741     1  0.1807     0.9138 0.940 0.000 0.052 0.008
#> SRR2015740     1  0.0657     0.9391 0.984 0.000 0.004 0.012
#> SRR2015738     1  0.1970     0.9075 0.932 0.000 0.060 0.008
#> SRR2015739     1  0.0376     0.9418 0.992 0.000 0.004 0.004
#> SRR2015737     2  0.1284     0.7332 0.000 0.964 0.024 0.012
#> SRR2015736     3  0.2197     0.8503 0.000 0.080 0.916 0.004
#> SRR2015732     1  0.5750     0.0479 0.532 0.000 0.440 0.028
#> SRR2015733     2  0.3975     0.5538 0.000 0.760 0.240 0.000
#> SRR2015734     3  0.4980     0.6023 0.304 0.000 0.680 0.016
#> SRR2015731     3  0.2048     0.8472 0.000 0.008 0.928 0.064
#> SRR2015730     1  0.0657     0.9391 0.984 0.000 0.004 0.012
#> SRR2015728     3  0.3730     0.8451 0.060 0.028 0.872 0.040
#> SRR2015729     2  0.4519     0.6790 0.004 0.804 0.140 0.052
#> SRR2015727     3  0.2234     0.8474 0.004 0.008 0.924 0.064
#> SRR2015726     3  0.4364     0.7641 0.180 0.004 0.792 0.024
#> SRR2015723     3  0.3266     0.8431 0.004 0.084 0.880 0.032
#> SRR2015724     3  0.2593     0.8470 0.000 0.080 0.904 0.016
#> SRR2015725     1  0.0804     0.9378 0.980 0.000 0.008 0.012
#> SRR2015722     3  0.2716     0.8454 0.012 0.012 0.908 0.068
#> SRR2015721     3  0.2011     0.8500 0.000 0.080 0.920 0.000
#> SRR2015720     3  0.2011     0.8507 0.000 0.080 0.920 0.000
#> SRR2015718     3  0.2949     0.8434 0.000 0.088 0.888 0.024
#> SRR2015719     4  0.3975     0.8477 0.000 0.240 0.000 0.760
#> SRR2015717     3  0.2021     0.8495 0.024 0.000 0.936 0.040
#> SRR2015716     3  0.3450     0.8246 0.108 0.004 0.864 0.024
#> SRR2015714     4  0.3975     0.8477 0.000 0.240 0.000 0.760
#> SRR2015713     3  0.2610     0.8460 0.000 0.088 0.900 0.012
#> SRR2015784     2  0.2266     0.6048 0.004 0.912 0.000 0.084
#> SRR2015785     2  0.4560     0.1140 0.004 0.700 0.000 0.296
#> SRR2015783     1  0.0188     0.9423 0.996 0.000 0.004 0.000
#> SRR2015782     2  0.3679     0.6940 0.004 0.840 0.016 0.140
#> SRR2015781     4  0.4925     0.7453 0.000 0.428 0.000 0.572
#> SRR2015780     2  0.5039     0.1913 0.004 0.592 0.000 0.404
#> SRR2015779     4  0.4967     0.7207 0.000 0.452 0.000 0.548
#> SRR2015778     3  0.5555     0.7834 0.004 0.088 0.732 0.176
#> SRR2015777     3  0.5555     0.7907 0.004 0.088 0.732 0.176
#> SRR2015776     4  0.3975     0.8477 0.000 0.240 0.000 0.760
#> SRR2015775     2  0.5177     0.6182 0.004 0.744 0.200 0.052
#> SRR2015774     3  0.3117     0.8468 0.000 0.092 0.880 0.028
#> SRR2015773     2  0.1004     0.7356 0.000 0.972 0.024 0.004
#> SRR2015772     2  0.1284     0.7332 0.000 0.964 0.024 0.012
#> SRR2015771     3  0.5134     0.6064 0.300 0.004 0.680 0.016
#> SRR2015769     2  0.4519     0.6790 0.004 0.804 0.140 0.052
#> SRR2015770     2  0.1059     0.7261 0.000 0.972 0.016 0.012
#> SRR2015768     2  0.0937     0.7219 0.000 0.976 0.012 0.012
#> SRR2015767     4  0.3975     0.8477 0.000 0.240 0.000 0.760
#> SRR2015766     3  0.1807     0.8497 0.000 0.008 0.940 0.052
#> SRR2015764     2  0.1637     0.7348 0.000 0.940 0.060 0.000
#> SRR2015765     2  0.6404     0.4901 0.004 0.624 0.284 0.088
#> SRR2015763     3  0.4980     0.6023 0.304 0.000 0.680 0.016
#> SRR2015762     4  0.5257     0.7136 0.000 0.444 0.008 0.548
#> SRR2015761     3  0.3745     0.8432 0.000 0.088 0.852 0.060
#> SRR2015760     3  0.1182     0.8523 0.016 0.000 0.968 0.016

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>            class entropy silhouette    p1    p2    p3    p4    p5
#> SRR2015715     3  0.3851      0.626 0.212 0.000 0.768 0.016 0.004
#> SRR2015735     3  0.4811      0.618 0.020 0.000 0.732 0.048 0.200
#> SRR2015759     1  0.0000      0.952 1.000 0.000 0.000 0.000 0.000
#> SRR2015753     1  0.0000      0.952 1.000 0.000 0.000 0.000 0.000
#> SRR2015746     5  0.4508      0.642 0.000 0.020 0.332 0.000 0.648
#> SRR2015758     2  0.0162      0.782 0.000 0.996 0.000 0.000 0.004
#> SRR2015756     1  0.0609      0.950 0.980 0.000 0.000 0.000 0.020
#> SRR2015757     3  0.2276      0.690 0.004 0.040 0.920 0.008 0.028
#> SRR2015755     1  0.2295      0.911 0.900 0.000 0.004 0.008 0.088
#> SRR2015754     1  0.2694      0.890 0.876 0.000 0.008 0.008 0.108
#> SRR2015752     1  0.1668      0.933 0.940 0.000 0.000 0.028 0.032
#> SRR2015749     1  0.0000      0.952 1.000 0.000 0.000 0.000 0.000
#> SRR2015750     2  0.2171      0.768 0.000 0.924 0.032 0.016 0.028
#> SRR2015751     5  0.4882      0.481 0.000 0.024 0.444 0.000 0.532
#> SRR2015748     5  0.5161      0.382 0.000 0.112 0.012 0.160 0.716
#> SRR2015747     1  0.0609      0.950 0.980 0.000 0.000 0.000 0.020
#> SRR2015745     2  0.4305      0.195 0.000 0.512 0.000 0.000 0.488
#> SRR2015743     1  0.0000      0.952 1.000 0.000 0.000 0.000 0.000
#> SRR2015744     5  0.3837      0.630 0.000 0.000 0.308 0.000 0.692
#> SRR2015742     5  0.3796      0.644 0.000 0.000 0.300 0.000 0.700
#> SRR2015741     1  0.2295      0.911 0.900 0.000 0.004 0.008 0.088
#> SRR2015740     1  0.1668      0.933 0.940 0.000 0.000 0.028 0.032
#> SRR2015738     1  0.2352      0.908 0.896 0.000 0.004 0.008 0.092
#> SRR2015739     1  0.0609      0.950 0.980 0.000 0.000 0.000 0.020
#> SRR2015737     2  0.0000      0.783 0.000 1.000 0.000 0.000 0.000
#> SRR2015736     3  0.1741      0.690 0.000 0.040 0.936 0.000 0.024
#> SRR2015732     3  0.5978      0.393 0.364 0.000 0.552 0.044 0.040
#> SRR2015733     2  0.3958      0.583 0.000 0.780 0.176 0.000 0.044
#> SRR2015734     3  0.3878      0.609 0.236 0.000 0.748 0.016 0.000
#> SRR2015731     3  0.5000      0.347 0.000 0.000 0.576 0.036 0.388
#> SRR2015730     1  0.1836      0.929 0.932 0.000 0.000 0.036 0.032
#> SRR2015728     3  0.3417      0.680 0.008 0.024 0.868 0.044 0.056
#> SRR2015729     2  0.4771      0.687 0.000 0.764 0.088 0.024 0.124
#> SRR2015727     3  0.5000      0.347 0.000 0.000 0.576 0.036 0.388
#> SRR2015726     3  0.3470      0.678 0.080 0.000 0.852 0.016 0.052
#> SRR2015723     3  0.2912      0.677 0.000 0.028 0.876 0.008 0.088
#> SRR2015724     3  0.2027      0.694 0.000 0.024 0.928 0.008 0.040
#> SRR2015725     1  0.1836      0.929 0.932 0.000 0.000 0.036 0.032
#> SRR2015722     3  0.5068      0.341 0.000 0.000 0.572 0.040 0.388
#> SRR2015721     3  0.1753      0.692 0.000 0.032 0.936 0.000 0.032
#> SRR2015720     3  0.1741      0.690 0.000 0.040 0.936 0.000 0.024
#> SRR2015718     3  0.2707      0.682 0.000 0.024 0.888 0.008 0.080
#> SRR2015719     4  0.2127      0.778 0.000 0.108 0.000 0.892 0.000
#> SRR2015717     3  0.4186      0.628 0.004 0.000 0.768 0.044 0.184
#> SRR2015716     3  0.3114      0.689 0.036 0.000 0.872 0.016 0.076
#> SRR2015714     4  0.2127      0.778 0.000 0.108 0.000 0.892 0.000
#> SRR2015713     3  0.1907      0.688 0.000 0.044 0.928 0.000 0.028
#> SRR2015784     2  0.2193      0.723 0.000 0.912 0.000 0.028 0.060
#> SRR2015785     2  0.4666      0.478 0.000 0.732 0.000 0.180 0.088
#> SRR2015783     1  0.0000      0.952 1.000 0.000 0.000 0.000 0.000
#> SRR2015782     2  0.4341      0.381 0.000 0.592 0.000 0.004 0.404
#> SRR2015781     4  0.5206      0.572 0.000 0.428 0.000 0.528 0.044
#> SRR2015780     5  0.6347     -0.157 0.000 0.376 0.000 0.164 0.460
#> SRR2015779     4  0.5216      0.562 0.000 0.436 0.000 0.520 0.044
#> SRR2015778     5  0.4206      0.661 0.000 0.020 0.272 0.000 0.708
#> SRR2015777     5  0.4654      0.629 0.000 0.024 0.348 0.000 0.628
#> SRR2015776     4  0.2127      0.778 0.000 0.108 0.000 0.892 0.000
#> SRR2015775     2  0.4927      0.674 0.000 0.752 0.100 0.024 0.124
#> SRR2015774     3  0.5075      0.389 0.000 0.044 0.628 0.004 0.324
#> SRR2015773     2  0.0000      0.783 0.000 1.000 0.000 0.000 0.000
#> SRR2015772     2  0.0000      0.783 0.000 1.000 0.000 0.000 0.000
#> SRR2015771     3  0.3944      0.615 0.224 0.000 0.756 0.016 0.004
#> SRR2015769     2  0.4771      0.687 0.000 0.764 0.088 0.024 0.124
#> SRR2015770     2  0.0000      0.783 0.000 1.000 0.000 0.000 0.000
#> SRR2015768     2  0.0000      0.783 0.000 1.000 0.000 0.000 0.000
#> SRR2015767     4  0.2127      0.778 0.000 0.108 0.000 0.892 0.000
#> SRR2015766     3  0.5095      0.379 0.000 0.004 0.592 0.036 0.368
#> SRR2015764     2  0.1386      0.765 0.000 0.952 0.032 0.000 0.016
#> SRR2015765     5  0.7241      0.201 0.000 0.356 0.176 0.040 0.428
#> SRR2015763     3  0.3849      0.612 0.232 0.000 0.752 0.016 0.000
#> SRR2015762     4  0.4965      0.545 0.000 0.452 0.000 0.520 0.028
#> SRR2015761     3  0.5304      0.353 0.000 0.028 0.632 0.028 0.312
#> SRR2015760     3  0.3887      0.646 0.004 0.000 0.796 0.040 0.160

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>            class entropy silhouette    p1    p2    p3    p4    p5    p6
#> SRR2015715     6  0.2402     0.6227 0.140 0.000 0.000 0.000 0.004 0.856
#> SRR2015735     3  0.6461     0.5048 0.032 0.000 0.416 0.004 0.160 0.388
#> SRR2015759     1  0.0146     0.9071 0.996 0.000 0.000 0.000 0.000 0.004
#> SRR2015753     1  0.0146     0.9071 0.996 0.000 0.000 0.000 0.000 0.004
#> SRR2015746     5  0.2051     0.5296 0.004 0.004 0.000 0.000 0.896 0.096
#> SRR2015758     2  0.0779     0.7230 0.000 0.976 0.008 0.000 0.008 0.008
#> SRR2015756     1  0.0748     0.9056 0.976 0.000 0.016 0.000 0.004 0.004
#> SRR2015757     6  0.4783     0.5790 0.004 0.020 0.100 0.000 0.156 0.720
#> SRR2015755     1  0.2624     0.8416 0.844 0.000 0.148 0.004 0.004 0.000
#> SRR2015754     1  0.3494     0.8004 0.792 0.000 0.168 0.004 0.036 0.000
#> SRR2015752     1  0.2880     0.8536 0.864 0.000 0.096 0.024 0.004 0.012
#> SRR2015749     1  0.0000     0.9068 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2015750     2  0.2952     0.6966 0.000 0.864 0.092 0.008 0.016 0.020
#> SRR2015751     5  0.3450     0.4500 0.000 0.008 0.012 0.000 0.772 0.208
#> SRR2015748     5  0.5658     0.4481 0.004 0.072 0.128 0.132 0.664 0.000
#> SRR2015747     1  0.0748     0.9056 0.976 0.000 0.016 0.000 0.004 0.004
#> SRR2015745     5  0.4903     0.1204 0.000 0.380 0.068 0.000 0.552 0.000
#> SRR2015743     1  0.0146     0.9071 0.996 0.000 0.000 0.000 0.000 0.004
#> SRR2015744     5  0.3508     0.4270 0.004 0.000 0.092 0.004 0.820 0.080
#> SRR2015742     5  0.1643     0.5183 0.000 0.000 0.008 0.000 0.924 0.068
#> SRR2015741     1  0.2737     0.8352 0.832 0.000 0.160 0.004 0.004 0.000
#> SRR2015740     1  0.2880     0.8536 0.864 0.000 0.096 0.024 0.004 0.012
#> SRR2015738     1  0.3203     0.8194 0.812 0.000 0.160 0.004 0.024 0.000
#> SRR2015739     1  0.0748     0.9056 0.976 0.000 0.016 0.000 0.004 0.004
#> SRR2015737     2  0.0000     0.7257 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2015736     6  0.4943     0.5536 0.000 0.012 0.124 0.000 0.184 0.680
#> SRR2015732     6  0.5396     0.4151 0.248 0.000 0.092 0.024 0.004 0.632
#> SRR2015733     2  0.5382     0.4626 0.000 0.660 0.096 0.000 0.196 0.048
#> SRR2015734     6  0.2527     0.6058 0.168 0.000 0.000 0.000 0.000 0.832
#> SRR2015731     3  0.6058     0.8234 0.000 0.000 0.404 0.000 0.324 0.272
#> SRR2015730     1  0.3433     0.8362 0.836 0.000 0.096 0.024 0.004 0.040
#> SRR2015728     6  0.6035     0.4604 0.004 0.012 0.216 0.024 0.144 0.600
#> SRR2015729     2  0.5734     0.5445 0.000 0.612 0.216 0.008 0.020 0.144
#> SRR2015727     3  0.6058     0.8234 0.000 0.000 0.404 0.000 0.324 0.272
#> SRR2015726     6  0.1251     0.6234 0.024 0.000 0.012 0.000 0.008 0.956
#> SRR2015723     6  0.2944     0.5371 0.008 0.000 0.148 0.000 0.012 0.832
#> SRR2015724     6  0.2066     0.6144 0.000 0.000 0.024 0.000 0.072 0.904
#> SRR2015725     1  0.3915     0.8091 0.804 0.000 0.096 0.024 0.004 0.072
#> SRR2015722     3  0.5982     0.8006 0.000 0.000 0.436 0.000 0.316 0.248
#> SRR2015721     6  0.4980     0.5512 0.000 0.012 0.128 0.000 0.184 0.676
#> SRR2015720     6  0.4884     0.5481 0.000 0.008 0.116 0.000 0.200 0.676
#> SRR2015718     6  0.2999     0.5560 0.000 0.000 0.124 0.000 0.040 0.836
#> SRR2015719     4  0.1267     1.0000 0.000 0.060 0.000 0.940 0.000 0.000
#> SRR2015717     6  0.5737    -0.5607 0.000 0.000 0.392 0.000 0.168 0.440
#> SRR2015716     6  0.2315     0.5840 0.016 0.000 0.084 0.000 0.008 0.892
#> SRR2015714     4  0.1267     1.0000 0.000 0.060 0.000 0.940 0.000 0.000
#> SRR2015713     6  0.5051     0.5510 0.000 0.020 0.124 0.000 0.176 0.680
#> SRR2015784     2  0.2515     0.6920 0.000 0.888 0.072 0.016 0.024 0.000
#> SRR2015785     2  0.5196     0.5793 0.000 0.692 0.128 0.132 0.048 0.000
#> SRR2015783     1  0.0146     0.9071 0.996 0.000 0.000 0.000 0.000 0.004
#> SRR2015782     2  0.5584     0.0100 0.000 0.448 0.104 0.004 0.440 0.004
#> SRR2015781     2  0.5528     0.1916 0.000 0.520 0.068 0.384 0.028 0.000
#> SRR2015780     5  0.7102    -0.0609 0.000 0.340 0.136 0.132 0.392 0.000
#> SRR2015779     2  0.5220     0.2162 0.000 0.540 0.060 0.384 0.016 0.000
#> SRR2015778     5  0.1508     0.5369 0.004 0.004 0.004 0.000 0.940 0.048
#> SRR2015777     5  0.2389     0.5190 0.000 0.008 0.000 0.000 0.864 0.128
#> SRR2015776     4  0.1267     1.0000 0.000 0.060 0.000 0.940 0.000 0.000
#> SRR2015775     2  0.5944     0.5051 0.000 0.576 0.216 0.008 0.016 0.184
#> SRR2015774     3  0.6774     0.5442 0.000 0.036 0.332 0.000 0.316 0.316
#> SRR2015773     2  0.0260     0.7265 0.000 0.992 0.008 0.000 0.000 0.000
#> SRR2015772     2  0.0260     0.7265 0.000 0.992 0.008 0.000 0.000 0.000
#> SRR2015771     6  0.2300     0.6206 0.144 0.000 0.000 0.000 0.000 0.856
#> SRR2015769     2  0.5711     0.5485 0.000 0.616 0.212 0.008 0.020 0.144
#> SRR2015770     2  0.0291     0.7260 0.000 0.992 0.004 0.000 0.000 0.004
#> SRR2015768     2  0.0146     0.7260 0.000 0.996 0.004 0.000 0.000 0.000
#> SRR2015767     4  0.1267     1.0000 0.000 0.060 0.000 0.940 0.000 0.000
#> SRR2015766     3  0.6093     0.8097 0.000 0.000 0.388 0.000 0.316 0.296
#> SRR2015764     2  0.2842     0.6863 0.000 0.872 0.068 0.000 0.040 0.020
#> SRR2015765     5  0.6884    -0.0589 0.000 0.164 0.364 0.000 0.392 0.080
#> SRR2015763     6  0.2416     0.6151 0.156 0.000 0.000 0.000 0.000 0.844
#> SRR2015762     2  0.5415     0.1966 0.000 0.528 0.064 0.384 0.024 0.000
#> SRR2015761     5  0.6499    -0.6839 0.000 0.020 0.308 0.000 0.392 0.280
#> SRR2015760     6  0.5625    -0.4420 0.000 0.000 0.332 0.000 0.164 0.504

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

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 17223 rows and 73 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.761           0.894       0.955         0.5055 0.498   0.498
#> 3 3 0.736           0.743       0.851         0.3094 0.755   0.543
#> 4 4 0.595           0.621       0.771         0.1009 0.867   0.640
#> 5 5 0.681           0.725       0.829         0.0656 0.932   0.763
#> 6 6 0.746           0.653       0.825         0.0438 0.909   0.653

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
#> SRR2015715     1  0.0000      0.930 1.000 0.000
#> SRR2015735     1  0.0000      0.930 1.000 0.000
#> SRR2015759     1  0.0000      0.930 1.000 0.000
#> SRR2015753     1  0.0000      0.930 1.000 0.000
#> SRR2015746     1  0.5178      0.838 0.884 0.116
#> SRR2015758     2  0.0000      0.975 0.000 1.000
#> SRR2015756     1  0.0000      0.930 1.000 0.000
#> SRR2015757     1  0.7299      0.725 0.796 0.204
#> SRR2015755     1  0.0000      0.930 1.000 0.000
#> SRR2015754     1  0.0000      0.930 1.000 0.000
#> SRR2015752     1  0.0000      0.930 1.000 0.000
#> SRR2015749     1  0.0000      0.930 1.000 0.000
#> SRR2015750     2  0.0000      0.975 0.000 1.000
#> SRR2015751     1  0.0000      0.930 1.000 0.000
#> SRR2015748     2  0.0000      0.975 0.000 1.000
#> SRR2015747     1  0.0000      0.930 1.000 0.000
#> SRR2015745     2  0.0000      0.975 0.000 1.000
#> SRR2015743     1  0.0000      0.930 1.000 0.000
#> SRR2015744     1  0.8555      0.635 0.720 0.280
#> SRR2015742     1  0.7602      0.722 0.780 0.220
#> SRR2015741     1  0.0000      0.930 1.000 0.000
#> SRR2015740     1  0.0000      0.930 1.000 0.000
#> SRR2015738     1  0.0000      0.930 1.000 0.000
#> SRR2015739     1  0.0000      0.930 1.000 0.000
#> SRR2015737     2  0.0000      0.975 0.000 1.000
#> SRR2015736     1  0.9710      0.338 0.600 0.400
#> SRR2015732     1  0.0000      0.930 1.000 0.000
#> SRR2015733     2  0.0000      0.975 0.000 1.000
#> SRR2015734     1  0.0000      0.930 1.000 0.000
#> SRR2015731     2  0.5519      0.829 0.128 0.872
#> SRR2015730     1  0.0000      0.930 1.000 0.000
#> SRR2015728     1  0.0000      0.930 1.000 0.000
#> SRR2015729     2  0.0000      0.975 0.000 1.000
#> SRR2015727     1  0.9580      0.441 0.620 0.380
#> SRR2015726     1  0.0000      0.930 1.000 0.000
#> SRR2015723     1  0.0000      0.930 1.000 0.000
#> SRR2015724     1  0.0000      0.930 1.000 0.000
#> SRR2015725     1  0.0000      0.930 1.000 0.000
#> SRR2015722     1  0.9580      0.441 0.620 0.380
#> SRR2015721     2  0.7745      0.683 0.228 0.772
#> SRR2015720     1  0.9661      0.360 0.608 0.392
#> SRR2015718     1  0.0938      0.923 0.988 0.012
#> SRR2015719     2  0.0000      0.975 0.000 1.000
#> SRR2015717     1  0.0000      0.930 1.000 0.000
#> SRR2015716     1  0.0000      0.930 1.000 0.000
#> SRR2015714     2  0.0000      0.975 0.000 1.000
#> SRR2015713     2  0.9491      0.389 0.368 0.632
#> SRR2015784     2  0.0000      0.975 0.000 1.000
#> SRR2015785     2  0.0000      0.975 0.000 1.000
#> SRR2015783     1  0.0000      0.930 1.000 0.000
#> SRR2015782     2  0.0000      0.975 0.000 1.000
#> SRR2015781     2  0.0000      0.975 0.000 1.000
#> SRR2015780     2  0.0000      0.975 0.000 1.000
#> SRR2015779     2  0.0000      0.975 0.000 1.000
#> SRR2015778     2  0.0000      0.975 0.000 1.000
#> SRR2015777     1  0.6343      0.796 0.840 0.160
#> SRR2015776     2  0.0000      0.975 0.000 1.000
#> SRR2015775     2  0.0000      0.975 0.000 1.000
#> SRR2015774     2  0.0000      0.975 0.000 1.000
#> SRR2015773     2  0.0000      0.975 0.000 1.000
#> SRR2015772     2  0.0000      0.975 0.000 1.000
#> SRR2015771     1  0.0000      0.930 1.000 0.000
#> SRR2015769     2  0.0000      0.975 0.000 1.000
#> SRR2015770     2  0.0000      0.975 0.000 1.000
#> SRR2015768     2  0.0000      0.975 0.000 1.000
#> SRR2015767     2  0.0000      0.975 0.000 1.000
#> SRR2015766     2  0.0376      0.971 0.004 0.996
#> SRR2015764     2  0.0000      0.975 0.000 1.000
#> SRR2015765     2  0.0000      0.975 0.000 1.000
#> SRR2015763     1  0.0000      0.930 1.000 0.000
#> SRR2015762     2  0.0000      0.975 0.000 1.000
#> SRR2015761     2  0.0000      0.975 0.000 1.000
#> SRR2015760     1  0.0000      0.930 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
#> SRR2015715     3  0.1860      0.735 0.052 0.000 0.948
#> SRR2015735     1  0.6244     -0.189 0.560 0.000 0.440
#> SRR2015759     1  0.6095      0.692 0.608 0.000 0.392
#> SRR2015753     1  0.6095      0.692 0.608 0.000 0.392
#> SRR2015746     1  0.2066      0.633 0.940 0.000 0.060
#> SRR2015758     2  0.0000      0.963 0.000 1.000 0.000
#> SRR2015756     1  0.6095      0.692 0.608 0.000 0.392
#> SRR2015757     3  0.0983      0.738 0.004 0.016 0.980
#> SRR2015755     1  0.2448      0.638 0.924 0.000 0.076
#> SRR2015754     1  0.2356      0.637 0.928 0.000 0.072
#> SRR2015752     1  0.6095      0.692 0.608 0.000 0.392
#> SRR2015749     1  0.6095      0.692 0.608 0.000 0.392
#> SRR2015750     2  0.0000      0.963 0.000 1.000 0.000
#> SRR2015751     1  0.6079      0.690 0.612 0.000 0.388
#> SRR2015748     2  0.6111      0.447 0.396 0.604 0.000
#> SRR2015747     1  0.6095      0.692 0.608 0.000 0.392
#> SRR2015745     2  0.0747      0.961 0.016 0.984 0.000
#> SRR2015743     1  0.6095      0.692 0.608 0.000 0.392
#> SRR2015744     1  0.0000      0.591 1.000 0.000 0.000
#> SRR2015742     1  0.1031      0.571 0.976 0.000 0.024
#> SRR2015741     1  0.2356      0.637 0.928 0.000 0.072
#> SRR2015740     1  0.6095      0.692 0.608 0.000 0.392
#> SRR2015738     1  0.2356      0.637 0.928 0.000 0.072
#> SRR2015739     1  0.6095      0.692 0.608 0.000 0.392
#> SRR2015737     2  0.0000      0.963 0.000 1.000 0.000
#> SRR2015736     3  0.0983      0.736 0.004 0.016 0.980
#> SRR2015732     3  0.4555      0.543 0.200 0.000 0.800
#> SRR2015733     2  0.0424      0.963 0.008 0.992 0.000
#> SRR2015734     3  0.1964      0.732 0.056 0.000 0.944
#> SRR2015731     3  0.6451      0.478 0.384 0.008 0.608
#> SRR2015730     3  0.4931      0.471 0.232 0.000 0.768
#> SRR2015728     3  0.2796      0.698 0.092 0.000 0.908
#> SRR2015729     2  0.0000      0.963 0.000 1.000 0.000
#> SRR2015727     3  0.6062      0.480 0.384 0.000 0.616
#> SRR2015726     3  0.4555      0.543 0.200 0.000 0.800
#> SRR2015723     3  0.2280      0.736 0.052 0.008 0.940
#> SRR2015724     3  0.0892      0.738 0.020 0.000 0.980
#> SRR2015725     3  0.4555      0.543 0.200 0.000 0.800
#> SRR2015722     3  0.6286      0.387 0.464 0.000 0.536
#> SRR2015721     3  0.3500      0.672 0.004 0.116 0.880
#> SRR2015720     3  0.0983      0.736 0.004 0.016 0.980
#> SRR2015718     3  0.3045      0.717 0.020 0.064 0.916
#> SRR2015719     2  0.2165      0.948 0.064 0.936 0.000
#> SRR2015717     3  0.5733      0.510 0.324 0.000 0.676
#> SRR2015716     3  0.1860      0.735 0.052 0.000 0.948
#> SRR2015714     2  0.2165      0.948 0.064 0.936 0.000
#> SRR2015713     3  0.2711      0.697 0.000 0.088 0.912
#> SRR2015784     2  0.0592      0.962 0.012 0.988 0.000
#> SRR2015785     2  0.0592      0.962 0.012 0.988 0.000
#> SRR2015783     1  0.6095      0.692 0.608 0.000 0.392
#> SRR2015782     2  0.0592      0.962 0.012 0.988 0.000
#> SRR2015781     2  0.2165      0.948 0.064 0.936 0.000
#> SRR2015780     2  0.2261      0.946 0.068 0.932 0.000
#> SRR2015779     2  0.0592      0.962 0.012 0.988 0.000
#> SRR2015778     1  0.2711      0.534 0.912 0.088 0.000
#> SRR2015777     1  0.8129      0.616 0.632 0.124 0.244
#> SRR2015776     2  0.2165      0.948 0.064 0.936 0.000
#> SRR2015775     2  0.0000      0.963 0.000 1.000 0.000
#> SRR2015774     2  0.2031      0.945 0.016 0.952 0.032
#> SRR2015773     2  0.0000      0.963 0.000 1.000 0.000
#> SRR2015772     2  0.0000      0.963 0.000 1.000 0.000
#> SRR2015771     3  0.1860      0.735 0.052 0.000 0.948
#> SRR2015769     2  0.0000      0.963 0.000 1.000 0.000
#> SRR2015770     2  0.0000      0.963 0.000 1.000 0.000
#> SRR2015768     2  0.0000      0.963 0.000 1.000 0.000
#> SRR2015767     2  0.2165      0.948 0.064 0.936 0.000
#> SRR2015766     3  0.6451      0.478 0.384 0.008 0.608
#> SRR2015764     2  0.0000      0.963 0.000 1.000 0.000
#> SRR2015765     2  0.2066      0.949 0.060 0.940 0.000
#> SRR2015763     3  0.1860      0.735 0.052 0.000 0.948
#> SRR2015762     2  0.2066      0.949 0.060 0.940 0.000
#> SRR2015761     2  0.3337      0.931 0.060 0.908 0.032
#> SRR2015760     3  0.5733      0.510 0.324 0.000 0.676

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> SRR2015715     3  0.4585   0.743486 0.332 0.000 0.668 0.000
#> SRR2015735     4  0.5681   0.197638 0.404 0.000 0.028 0.568
#> SRR2015759     1  0.0000   0.714224 1.000 0.000 0.000 0.000
#> SRR2015753     1  0.0000   0.714224 1.000 0.000 0.000 0.000
#> SRR2015746     1  0.6235   0.118383 0.544 0.008 0.040 0.408
#> SRR2015758     2  0.0921   0.852251 0.000 0.972 0.028 0.000
#> SRR2015756     1  0.0000   0.714224 1.000 0.000 0.000 0.000
#> SRR2015757     3  0.2647   0.772788 0.120 0.000 0.880 0.000
#> SRR2015755     1  0.3266   0.562016 0.832 0.000 0.000 0.168
#> SRR2015754     1  0.3649   0.514388 0.796 0.000 0.000 0.204
#> SRR2015752     1  0.0000   0.714224 1.000 0.000 0.000 0.000
#> SRR2015749     1  0.0000   0.714224 1.000 0.000 0.000 0.000
#> SRR2015750     2  0.1557   0.844949 0.000 0.944 0.056 0.000
#> SRR2015751     1  0.5851   0.379044 0.680 0.000 0.084 0.236
#> SRR2015748     2  0.7312   0.259455 0.152 0.436 0.000 0.412
#> SRR2015747     1  0.0000   0.714224 1.000 0.000 0.000 0.000
#> SRR2015745     2  0.3942   0.678302 0.000 0.764 0.000 0.236
#> SRR2015743     1  0.0000   0.714224 1.000 0.000 0.000 0.000
#> SRR2015744     4  0.4950   0.225053 0.376 0.000 0.004 0.620
#> SRR2015742     4  0.5496   0.221444 0.372 0.000 0.024 0.604
#> SRR2015741     1  0.3528   0.532286 0.808 0.000 0.000 0.192
#> SRR2015740     1  0.0000   0.714224 1.000 0.000 0.000 0.000
#> SRR2015738     1  0.3528   0.532286 0.808 0.000 0.000 0.192
#> SRR2015739     1  0.0000   0.714224 1.000 0.000 0.000 0.000
#> SRR2015737     2  0.0921   0.852251 0.000 0.972 0.028 0.000
#> SRR2015736     3  0.2773   0.770378 0.116 0.000 0.880 0.004
#> SRR2015732     1  0.4790   0.000486 0.620 0.000 0.380 0.000
#> SRR2015733     2  0.2408   0.817145 0.000 0.896 0.104 0.000
#> SRR2015734     3  0.4697   0.714829 0.356 0.000 0.644 0.000
#> SRR2015731     4  0.4436   0.573920 0.000 0.020 0.216 0.764
#> SRR2015730     1  0.4776   0.015147 0.624 0.000 0.376 0.000
#> SRR2015728     1  0.7073  -0.271338 0.464 0.000 0.412 0.124
#> SRR2015729     2  0.2868   0.798403 0.000 0.864 0.136 0.000
#> SRR2015727     4  0.4436   0.573920 0.000 0.020 0.216 0.764
#> SRR2015726     1  0.4916  -0.041549 0.576 0.000 0.424 0.000
#> SRR2015723     3  0.4163   0.747557 0.220 0.004 0.772 0.004
#> SRR2015724     3  0.2589   0.755509 0.116 0.000 0.884 0.000
#> SRR2015725     1  0.4790   0.000486 0.620 0.000 0.380 0.000
#> SRR2015722     4  0.5383   0.580419 0.064 0.020 0.152 0.764
#> SRR2015721     3  0.5927   0.616462 0.104 0.040 0.748 0.108
#> SRR2015720     3  0.2589   0.770481 0.116 0.000 0.884 0.000
#> SRR2015718     3  0.2658   0.729551 0.080 0.012 0.904 0.004
#> SRR2015719     2  0.3486   0.811313 0.000 0.812 0.000 0.188
#> SRR2015717     4  0.6716   0.404979 0.112 0.000 0.320 0.568
#> SRR2015716     3  0.4122   0.745728 0.236 0.000 0.760 0.004
#> SRR2015714     2  0.3486   0.811313 0.000 0.812 0.000 0.188
#> SRR2015713     3  0.3384   0.755035 0.116 0.024 0.860 0.000
#> SRR2015784     2  0.0336   0.852977 0.000 0.992 0.008 0.000
#> SRR2015785     2  0.0000   0.852935 0.000 1.000 0.000 0.000
#> SRR2015783     1  0.0000   0.714224 1.000 0.000 0.000 0.000
#> SRR2015782     2  0.4158   0.692225 0.000 0.768 0.008 0.224
#> SRR2015781     2  0.3400   0.814769 0.000 0.820 0.000 0.180
#> SRR2015780     2  0.3444   0.813250 0.000 0.816 0.000 0.184
#> SRR2015779     2  0.0000   0.852935 0.000 1.000 0.000 0.000
#> SRR2015778     4  0.8263   0.124538 0.376 0.152 0.040 0.432
#> SRR2015777     1  0.7934   0.212980 0.572 0.076 0.108 0.244
#> SRR2015776     2  0.3486   0.811313 0.000 0.812 0.000 0.188
#> SRR2015775     2  0.3649   0.732171 0.000 0.796 0.204 0.000
#> SRR2015774     2  0.5143   0.796964 0.000 0.752 0.076 0.172
#> SRR2015773     2  0.0921   0.852251 0.000 0.972 0.028 0.000
#> SRR2015772     2  0.0921   0.852251 0.000 0.972 0.028 0.000
#> SRR2015771     3  0.4624   0.736322 0.340 0.000 0.660 0.000
#> SRR2015769     2  0.2868   0.798403 0.000 0.864 0.136 0.000
#> SRR2015770     2  0.0921   0.852251 0.000 0.972 0.028 0.000
#> SRR2015768     2  0.0921   0.852251 0.000 0.972 0.028 0.000
#> SRR2015767     2  0.3486   0.811313 0.000 0.812 0.000 0.188
#> SRR2015766     4  0.4472   0.571366 0.000 0.020 0.220 0.760
#> SRR2015764     2  0.0921   0.852251 0.000 0.972 0.028 0.000
#> SRR2015765     2  0.3486   0.811313 0.000 0.812 0.000 0.188
#> SRR2015763     3  0.4643   0.732101 0.344 0.000 0.656 0.000
#> SRR2015762     2  0.3444   0.813299 0.000 0.816 0.000 0.184
#> SRR2015761     2  0.4459   0.789136 0.000 0.780 0.032 0.188
#> SRR2015760     4  0.5827   0.318016 0.036 0.000 0.396 0.568

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>            class entropy silhouette    p1    p2    p3    p4    p5
#> SRR2015715     3  0.4161      0.690 0.280 0.000 0.704 0.016 0.000
#> SRR2015735     4  0.3671      0.650 0.236 0.000 0.008 0.756 0.000
#> SRR2015759     1  0.0000      0.882 1.000 0.000 0.000 0.000 0.000
#> SRR2015753     1  0.0000      0.882 1.000 0.000 0.000 0.000 0.000
#> SRR2015746     5  0.3518      0.728 0.104 0.000 0.008 0.048 0.840
#> SRR2015758     2  0.0566      0.787 0.000 0.984 0.012 0.000 0.004
#> SRR2015756     1  0.0000      0.882 1.000 0.000 0.000 0.000 0.000
#> SRR2015757     3  0.4718      0.707 0.040 0.020 0.772 0.016 0.152
#> SRR2015755     1  0.1043      0.860 0.960 0.000 0.000 0.040 0.000
#> SRR2015754     1  0.3074      0.693 0.804 0.000 0.000 0.196 0.000
#> SRR2015752     1  0.0000      0.882 1.000 0.000 0.000 0.000 0.000
#> SRR2015749     1  0.0000      0.882 1.000 0.000 0.000 0.000 0.000
#> SRR2015750     2  0.2813      0.724 0.000 0.876 0.040 0.000 0.084
#> SRR2015751     5  0.2864      0.717 0.112 0.000 0.024 0.000 0.864
#> SRR2015748     5  0.5463      0.557 0.012 0.228 0.000 0.092 0.668
#> SRR2015747     1  0.0000      0.882 1.000 0.000 0.000 0.000 0.000
#> SRR2015745     5  0.3274      0.643 0.000 0.220 0.000 0.000 0.780
#> SRR2015743     1  0.0000      0.882 1.000 0.000 0.000 0.000 0.000
#> SRR2015744     5  0.4479      0.658 0.072 0.000 0.000 0.184 0.744
#> SRR2015742     5  0.4138      0.687 0.072 0.000 0.000 0.148 0.780
#> SRR2015741     1  0.2377      0.784 0.872 0.000 0.000 0.128 0.000
#> SRR2015740     1  0.0000      0.882 1.000 0.000 0.000 0.000 0.000
#> SRR2015738     1  0.2648      0.756 0.848 0.000 0.000 0.152 0.000
#> SRR2015739     1  0.0000      0.882 1.000 0.000 0.000 0.000 0.000
#> SRR2015737     2  0.0404      0.787 0.000 0.988 0.012 0.000 0.000
#> SRR2015736     3  0.4706      0.704 0.032 0.020 0.776 0.024 0.148
#> SRR2015732     1  0.3796      0.489 0.700 0.000 0.300 0.000 0.000
#> SRR2015733     2  0.4657      0.599 0.000 0.740 0.108 0.000 0.152
#> SRR2015734     3  0.4306      0.628 0.328 0.000 0.660 0.012 0.000
#> SRR2015731     4  0.0000      0.811 0.000 0.000 0.000 1.000 0.000
#> SRR2015730     1  0.1608      0.831 0.928 0.000 0.072 0.000 0.000
#> SRR2015728     1  0.7233      0.217 0.508 0.000 0.264 0.168 0.060
#> SRR2015729     2  0.3760      0.652 0.000 0.784 0.188 0.000 0.028
#> SRR2015727     4  0.0000      0.811 0.000 0.000 0.000 1.000 0.000
#> SRR2015726     1  0.3398      0.664 0.780 0.000 0.216 0.000 0.004
#> SRR2015723     3  0.3899      0.690 0.076 0.020 0.844 0.032 0.028
#> SRR2015724     3  0.2110      0.719 0.072 0.000 0.912 0.016 0.000
#> SRR2015725     1  0.2516      0.767 0.860 0.000 0.140 0.000 0.000
#> SRR2015722     4  0.0000      0.811 0.000 0.000 0.000 1.000 0.000
#> SRR2015721     3  0.6500      0.563 0.000 0.136 0.640 0.100 0.124
#> SRR2015720     3  0.4612      0.696 0.020 0.020 0.772 0.024 0.164
#> SRR2015718     3  0.3484      0.666 0.016 0.056 0.868 0.032 0.028
#> SRR2015719     2  0.4906      0.739 0.000 0.692 0.000 0.232 0.076
#> SRR2015717     4  0.4334      0.691 0.140 0.000 0.092 0.768 0.000
#> SRR2015716     3  0.4712      0.618 0.236 0.000 0.716 0.028 0.020
#> SRR2015714     2  0.4906      0.739 0.000 0.692 0.000 0.232 0.076
#> SRR2015713     3  0.5756      0.651 0.032 0.112 0.700 0.008 0.148
#> SRR2015784     2  0.1768      0.786 0.000 0.924 0.000 0.004 0.072
#> SRR2015785     2  0.2069      0.785 0.000 0.912 0.000 0.012 0.076
#> SRR2015783     1  0.0000      0.882 1.000 0.000 0.000 0.000 0.000
#> SRR2015782     5  0.4538      0.294 0.000 0.452 0.008 0.000 0.540
#> SRR2015781     2  0.4793      0.747 0.000 0.708 0.000 0.216 0.076
#> SRR2015780     2  0.4793      0.747 0.000 0.708 0.000 0.216 0.076
#> SRR2015779     2  0.1831      0.785 0.000 0.920 0.000 0.004 0.076
#> SRR2015778     5  0.2847      0.730 0.028 0.028 0.004 0.044 0.896
#> SRR2015777     5  0.2795      0.719 0.100 0.000 0.028 0.000 0.872
#> SRR2015776     2  0.4906      0.739 0.000 0.692 0.000 0.232 0.076
#> SRR2015775     2  0.4485      0.519 0.000 0.680 0.292 0.000 0.028
#> SRR2015774     2  0.4912      0.744 0.000 0.716 0.040 0.220 0.024
#> SRR2015773     2  0.0404      0.787 0.000 0.988 0.012 0.000 0.000
#> SRR2015772     2  0.0404      0.787 0.000 0.988 0.012 0.000 0.000
#> SRR2015771     3  0.4227      0.680 0.292 0.000 0.692 0.016 0.000
#> SRR2015769     2  0.3760      0.652 0.000 0.784 0.188 0.000 0.028
#> SRR2015770     2  0.0404      0.787 0.000 0.988 0.012 0.000 0.000
#> SRR2015768     2  0.0404      0.787 0.000 0.988 0.012 0.000 0.000
#> SRR2015767     2  0.4906      0.739 0.000 0.692 0.000 0.232 0.076
#> SRR2015766     4  0.0000      0.811 0.000 0.000 0.000 1.000 0.000
#> SRR2015764     2  0.1549      0.774 0.000 0.944 0.040 0.000 0.016
#> SRR2015765     2  0.5113      0.737 0.000 0.684 0.004 0.232 0.080
#> SRR2015763     3  0.4318      0.679 0.292 0.000 0.688 0.020 0.000
#> SRR2015762     2  0.4295      0.757 0.000 0.740 0.000 0.216 0.044
#> SRR2015761     2  0.4413      0.749 0.000 0.724 0.000 0.232 0.044
#> SRR2015760     4  0.4062      0.632 0.040 0.000 0.196 0.764 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
#> SRR2015715     6  0.6251    -0.1396 0.336 0.000 0.000 0.320 0.004 0.340
#> SRR2015735     3  0.2092     0.8266 0.124 0.000 0.876 0.000 0.000 0.000
#> SRR2015759     1  0.0000     0.8031 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2015753     1  0.0000     0.8031 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2015746     5  0.1353     0.8258 0.024 0.000 0.012 0.000 0.952 0.012
#> SRR2015758     2  0.4525     0.6918 0.000 0.728 0.000 0.188 0.036 0.048
#> SRR2015756     1  0.0000     0.8031 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2015757     6  0.0146     0.6609 0.000 0.000 0.000 0.004 0.000 0.996
#> SRR2015755     1  0.0458     0.7951 0.984 0.000 0.016 0.000 0.000 0.000
#> SRR2015754     1  0.2527     0.6538 0.832 0.000 0.168 0.000 0.000 0.000
#> SRR2015752     1  0.0000     0.8031 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2015749     1  0.0000     0.8031 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2015750     2  0.6472     0.4274 0.000 0.516 0.000 0.240 0.056 0.188
#> SRR2015751     5  0.1257     0.8228 0.028 0.000 0.000 0.000 0.952 0.020
#> SRR2015748     5  0.4703     0.4055 0.000 0.380 0.052 0.000 0.568 0.000
#> SRR2015747     1  0.0000     0.8031 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2015745     5  0.2668     0.7265 0.000 0.168 0.000 0.004 0.828 0.000
#> SRR2015743     1  0.0000     0.8031 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2015744     5  0.1982     0.8022 0.016 0.004 0.068 0.000 0.912 0.000
#> SRR2015742     5  0.1313     0.8235 0.016 0.000 0.028 0.000 0.952 0.004
#> SRR2015741     1  0.1204     0.7698 0.944 0.000 0.056 0.000 0.000 0.000
#> SRR2015740     1  0.0000     0.8031 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2015738     1  0.1327     0.7639 0.936 0.000 0.064 0.000 0.000 0.000
#> SRR2015739     1  0.0000     0.8031 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2015737     2  0.4493     0.6936 0.000 0.728 0.000 0.192 0.036 0.044
#> SRR2015736     6  0.0000     0.6616 0.000 0.000 0.000 0.000 0.000 1.000
#> SRR2015732     1  0.5756     0.3653 0.532 0.000 0.000 0.264 0.004 0.200
#> SRR2015733     6  0.5112     0.3042 0.000 0.212 0.000 0.132 0.008 0.648
#> SRR2015734     1  0.6242     0.0288 0.360 0.000 0.000 0.312 0.004 0.324
#> SRR2015731     3  0.0000     0.9126 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2015730     1  0.2163     0.7469 0.892 0.000 0.000 0.096 0.004 0.008
#> SRR2015728     6  0.6590     0.3273 0.232 0.000 0.168 0.080 0.000 0.520
#> SRR2015729     4  0.4224     0.3926 0.000 0.276 0.000 0.684 0.004 0.036
#> SRR2015727     3  0.0000     0.9126 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2015726     1  0.4659     0.5042 0.624 0.000 0.000 0.320 0.004 0.052
#> SRR2015723     4  0.2709     0.5140 0.020 0.000 0.000 0.848 0.000 0.132
#> SRR2015724     4  0.4386     0.1888 0.024 0.000 0.000 0.600 0.004 0.372
#> SRR2015725     1  0.4117     0.6264 0.740 0.000 0.000 0.192 0.004 0.064
#> SRR2015722     3  0.0000     0.9126 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2015721     6  0.2125     0.6319 0.000 0.004 0.016 0.068 0.004 0.908
#> SRR2015720     6  0.0146     0.6609 0.000 0.000 0.000 0.004 0.000 0.996
#> SRR2015718     4  0.2219     0.5179 0.000 0.000 0.000 0.864 0.000 0.136
#> SRR2015719     2  0.2118     0.7633 0.000 0.888 0.104 0.000 0.008 0.000
#> SRR2015717     3  0.2563     0.8579 0.052 0.000 0.876 0.072 0.000 0.000
#> SRR2015716     4  0.3707     0.4575 0.100 0.000 0.000 0.796 0.004 0.100
#> SRR2015714     2  0.2118     0.7633 0.000 0.888 0.104 0.000 0.008 0.000
#> SRR2015713     6  0.1349     0.6457 0.000 0.004 0.000 0.056 0.000 0.940
#> SRR2015784     2  0.1723     0.7619 0.000 0.928 0.000 0.036 0.036 0.000
#> SRR2015785     2  0.0777     0.7694 0.000 0.972 0.000 0.004 0.024 0.000
#> SRR2015783     1  0.0000     0.8031 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2015782     5  0.4750     0.5261 0.000 0.244 0.000 0.100 0.656 0.000
#> SRR2015781     2  0.1701     0.7716 0.000 0.920 0.072 0.000 0.008 0.000
#> SRR2015780     2  0.1728     0.7727 0.000 0.924 0.064 0.004 0.008 0.000
#> SRR2015779     2  0.0713     0.7693 0.000 0.972 0.000 0.000 0.028 0.000
#> SRR2015778     5  0.1074     0.8219 0.000 0.028 0.000 0.000 0.960 0.012
#> SRR2015777     5  0.0909     0.8267 0.020 0.000 0.000 0.000 0.968 0.012
#> SRR2015776     2  0.2118     0.7633 0.000 0.888 0.104 0.000 0.008 0.000
#> SRR2015775     4  0.3960     0.4740 0.000 0.220 0.000 0.736 0.004 0.040
#> SRR2015774     2  0.5753     0.6455 0.000 0.604 0.116 0.244 0.004 0.032
#> SRR2015773     2  0.4493     0.6936 0.000 0.728 0.000 0.192 0.036 0.044
#> SRR2015772     2  0.4493     0.6936 0.000 0.728 0.000 0.192 0.036 0.044
#> SRR2015771     1  0.6251    -0.0196 0.340 0.000 0.000 0.320 0.004 0.336
#> SRR2015769     4  0.4224     0.3926 0.000 0.276 0.000 0.684 0.004 0.036
#> SRR2015770     2  0.4493     0.6936 0.000 0.728 0.000 0.192 0.036 0.044
#> SRR2015768     2  0.4493     0.6936 0.000 0.728 0.000 0.192 0.036 0.044
#> SRR2015767     2  0.2118     0.7633 0.000 0.888 0.104 0.000 0.008 0.000
#> SRR2015766     3  0.0000     0.9126 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2015764     2  0.6216     0.4995 0.000 0.532 0.000 0.188 0.036 0.244
#> SRR2015765     2  0.2804     0.7502 0.000 0.852 0.120 0.024 0.004 0.000
#> SRR2015763     1  0.6247     0.0104 0.352 0.000 0.000 0.316 0.004 0.328
#> SRR2015762     2  0.1918     0.7722 0.000 0.904 0.088 0.000 0.000 0.008
#> SRR2015761     2  0.2581     0.7585 0.000 0.856 0.128 0.000 0.000 0.016
#> SRR2015760     3  0.2703     0.8539 0.028 0.000 0.876 0.080 0.000 0.016

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

consensus_heatmap(res, k = 2)

plot of chunk tab-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

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

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

collect_plots(res)

plot of chunk SD-pam-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.942           0.945       0.976         0.4929 0.509   0.509
#> 3 3 0.790           0.860       0.939         0.3499 0.689   0.462
#> 4 4 0.802           0.849       0.939         0.0540 0.963   0.891
#> 5 5 0.738           0.801       0.907         0.0781 0.924   0.756
#> 6 6 0.826           0.795       0.903         0.0581 0.904   0.645

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
#> SRR2015715     1  0.0000      0.977 1.000 0.000
#> SRR2015735     1  0.0000      0.977 1.000 0.000
#> SRR2015759     1  0.0000      0.977 1.000 0.000
#> SRR2015753     1  0.0000      0.977 1.000 0.000
#> SRR2015746     1  0.9000      0.533 0.684 0.316
#> SRR2015758     2  0.0000      0.973 0.000 1.000
#> SRR2015756     1  0.0000      0.977 1.000 0.000
#> SRR2015757     2  0.9286      0.477 0.344 0.656
#> SRR2015755     1  0.0000      0.977 1.000 0.000
#> SRR2015754     1  0.0000      0.977 1.000 0.000
#> SRR2015752     1  0.0000      0.977 1.000 0.000
#> SRR2015749     1  0.0000      0.977 1.000 0.000
#> SRR2015750     2  0.0000      0.973 0.000 1.000
#> SRR2015751     1  0.0000      0.977 1.000 0.000
#> SRR2015748     2  0.7219      0.748 0.200 0.800
#> SRR2015747     1  0.0000      0.977 1.000 0.000
#> SRR2015745     2  0.0000      0.973 0.000 1.000
#> SRR2015743     1  0.0000      0.977 1.000 0.000
#> SRR2015744     1  0.8081      0.663 0.752 0.248
#> SRR2015742     2  0.0376      0.970 0.004 0.996
#> SRR2015741     1  0.0000      0.977 1.000 0.000
#> SRR2015740     1  0.0000      0.977 1.000 0.000
#> SRR2015738     1  0.0000      0.977 1.000 0.000
#> SRR2015739     1  0.0000      0.977 1.000 0.000
#> SRR2015737     2  0.0000      0.973 0.000 1.000
#> SRR2015736     2  0.0000      0.973 0.000 1.000
#> SRR2015732     1  0.0000      0.977 1.000 0.000
#> SRR2015733     2  0.0000      0.973 0.000 1.000
#> SRR2015734     1  0.0000      0.977 1.000 0.000
#> SRR2015731     2  0.0000      0.973 0.000 1.000
#> SRR2015730     1  0.0000      0.977 1.000 0.000
#> SRR2015728     1  0.3879      0.903 0.924 0.076
#> SRR2015729     2  0.0000      0.973 0.000 1.000
#> SRR2015727     2  0.0000      0.973 0.000 1.000
#> SRR2015726     1  0.0000      0.977 1.000 0.000
#> SRR2015723     2  0.0000      0.973 0.000 1.000
#> SRR2015724     2  0.5519      0.845 0.128 0.872
#> SRR2015725     1  0.0000      0.977 1.000 0.000
#> SRR2015722     2  0.1633      0.954 0.024 0.976
#> SRR2015721     2  0.0000      0.973 0.000 1.000
#> SRR2015720     2  0.0000      0.973 0.000 1.000
#> SRR2015718     2  0.0000      0.973 0.000 1.000
#> SRR2015719     2  0.0000      0.973 0.000 1.000
#> SRR2015717     1  0.0000      0.977 1.000 0.000
#> SRR2015716     1  0.0000      0.977 1.000 0.000
#> SRR2015714     2  0.0000      0.973 0.000 1.000
#> SRR2015713     2  0.0000      0.973 0.000 1.000
#> SRR2015784     2  0.0000      0.973 0.000 1.000
#> SRR2015785     2  0.0000      0.973 0.000 1.000
#> SRR2015783     1  0.0000      0.977 1.000 0.000
#> SRR2015782     2  0.0000      0.973 0.000 1.000
#> SRR2015781     2  0.0000      0.973 0.000 1.000
#> SRR2015780     2  0.0000      0.973 0.000 1.000
#> SRR2015779     2  0.0000      0.973 0.000 1.000
#> SRR2015778     2  0.3431      0.916 0.064 0.936
#> SRR2015777     2  0.8955      0.549 0.312 0.688
#> SRR2015776     2  0.0000      0.973 0.000 1.000
#> SRR2015775     2  0.0000      0.973 0.000 1.000
#> SRR2015774     2  0.0000      0.973 0.000 1.000
#> SRR2015773     2  0.0000      0.973 0.000 1.000
#> SRR2015772     2  0.0000      0.973 0.000 1.000
#> SRR2015771     1  0.0000      0.977 1.000 0.000
#> SRR2015769     2  0.0000      0.973 0.000 1.000
#> SRR2015770     2  0.0000      0.973 0.000 1.000
#> SRR2015768     2  0.0000      0.973 0.000 1.000
#> SRR2015767     2  0.0000      0.973 0.000 1.000
#> SRR2015766     2  0.0000      0.973 0.000 1.000
#> SRR2015764     2  0.0000      0.973 0.000 1.000
#> SRR2015765     2  0.0000      0.973 0.000 1.000
#> SRR2015763     1  0.0000      0.977 1.000 0.000
#> SRR2015762     2  0.0000      0.973 0.000 1.000
#> SRR2015761     2  0.0000      0.973 0.000 1.000
#> SRR2015760     1  0.0000      0.977 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
#> SRR2015715     3  0.5835      0.542 0.340 0.000 0.660
#> SRR2015735     1  0.6168      0.311 0.588 0.000 0.412
#> SRR2015759     1  0.0000      0.953 1.000 0.000 0.000
#> SRR2015753     1  0.0000      0.953 1.000 0.000 0.000
#> SRR2015746     3  0.0000      0.890 0.000 0.000 1.000
#> SRR2015758     2  0.0000      0.953 0.000 1.000 0.000
#> SRR2015756     1  0.0000      0.953 1.000 0.000 0.000
#> SRR2015757     3  0.0000      0.890 0.000 0.000 1.000
#> SRR2015755     1  0.0000      0.953 1.000 0.000 0.000
#> SRR2015754     1  0.1964      0.902 0.944 0.000 0.056
#> SRR2015752     1  0.0000      0.953 1.000 0.000 0.000
#> SRR2015749     1  0.0000      0.953 1.000 0.000 0.000
#> SRR2015750     2  0.0000      0.953 0.000 1.000 0.000
#> SRR2015751     3  0.5291      0.660 0.268 0.000 0.732
#> SRR2015748     2  0.8681      0.467 0.188 0.596 0.216
#> SRR2015747     1  0.0000      0.953 1.000 0.000 0.000
#> SRR2015745     2  0.0000      0.953 0.000 1.000 0.000
#> SRR2015743     1  0.0000      0.953 1.000 0.000 0.000
#> SRR2015744     3  0.0237      0.889 0.000 0.004 0.996
#> SRR2015742     3  0.0000      0.890 0.000 0.000 1.000
#> SRR2015741     1  0.0000      0.953 1.000 0.000 0.000
#> SRR2015740     1  0.0000      0.953 1.000 0.000 0.000
#> SRR2015738     1  0.0000      0.953 1.000 0.000 0.000
#> SRR2015739     1  0.0000      0.953 1.000 0.000 0.000
#> SRR2015737     2  0.0000      0.953 0.000 1.000 0.000
#> SRR2015736     3  0.0000      0.890 0.000 0.000 1.000
#> SRR2015732     1  0.5058      0.609 0.756 0.000 0.244
#> SRR2015733     2  0.3879      0.793 0.000 0.848 0.152
#> SRR2015734     3  0.6192      0.381 0.420 0.000 0.580
#> SRR2015731     3  0.0000      0.890 0.000 0.000 1.000
#> SRR2015730     1  0.0000      0.953 1.000 0.000 0.000
#> SRR2015728     3  0.0237      0.889 0.004 0.000 0.996
#> SRR2015729     2  0.0000      0.953 0.000 1.000 0.000
#> SRR2015727     3  0.0000      0.890 0.000 0.000 1.000
#> SRR2015726     3  0.2066      0.860 0.060 0.000 0.940
#> SRR2015723     3  0.0892      0.883 0.000 0.020 0.980
#> SRR2015724     3  0.0000      0.890 0.000 0.000 1.000
#> SRR2015725     1  0.0000      0.953 1.000 0.000 0.000
#> SRR2015722     3  0.0000      0.890 0.000 0.000 1.000
#> SRR2015721     3  0.4178      0.751 0.000 0.172 0.828
#> SRR2015720     3  0.0000      0.890 0.000 0.000 1.000
#> SRR2015718     3  0.2165      0.858 0.000 0.064 0.936
#> SRR2015719     2  0.0000      0.953 0.000 1.000 0.000
#> SRR2015717     3  0.0000      0.890 0.000 0.000 1.000
#> SRR2015716     3  0.0000      0.890 0.000 0.000 1.000
#> SRR2015714     2  0.0000      0.953 0.000 1.000 0.000
#> SRR2015713     3  0.3941      0.786 0.000 0.156 0.844
#> SRR2015784     2  0.0000      0.953 0.000 1.000 0.000
#> SRR2015785     2  0.0000      0.953 0.000 1.000 0.000
#> SRR2015783     1  0.0000      0.953 1.000 0.000 0.000
#> SRR2015782     2  0.0000      0.953 0.000 1.000 0.000
#> SRR2015781     2  0.0000      0.953 0.000 1.000 0.000
#> SRR2015780     2  0.0000      0.953 0.000 1.000 0.000
#> SRR2015779     2  0.0000      0.953 0.000 1.000 0.000
#> SRR2015778     3  0.4796      0.708 0.000 0.220 0.780
#> SRR2015777     3  0.4842      0.705 0.000 0.224 0.776
#> SRR2015776     2  0.0000      0.953 0.000 1.000 0.000
#> SRR2015775     2  0.5254      0.612 0.000 0.736 0.264
#> SRR2015774     2  0.6079      0.317 0.000 0.612 0.388
#> SRR2015773     2  0.0000      0.953 0.000 1.000 0.000
#> SRR2015772     2  0.0000      0.953 0.000 1.000 0.000
#> SRR2015771     3  0.6140      0.416 0.404 0.000 0.596
#> SRR2015769     2  0.0000      0.953 0.000 1.000 0.000
#> SRR2015770     2  0.0000      0.953 0.000 1.000 0.000
#> SRR2015768     2  0.0000      0.953 0.000 1.000 0.000
#> SRR2015767     2  0.0000      0.953 0.000 1.000 0.000
#> SRR2015766     3  0.0000      0.890 0.000 0.000 1.000
#> SRR2015764     2  0.0000      0.953 0.000 1.000 0.000
#> SRR2015765     2  0.0000      0.953 0.000 1.000 0.000
#> SRR2015763     3  0.4654      0.724 0.208 0.000 0.792
#> SRR2015762     2  0.0000      0.953 0.000 1.000 0.000
#> SRR2015761     2  0.0000      0.953 0.000 1.000 0.000
#> SRR2015760     3  0.0000      0.890 0.000 0.000 1.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3 p4
#> SRR2015715     3  0.4624      0.544 0.340 0.000 0.660  0
#> SRR2015735     1  0.4888      0.311 0.588 0.000 0.412  0
#> SRR2015759     1  0.0000      0.942 1.000 0.000 0.000  0
#> SRR2015753     1  0.0000      0.942 1.000 0.000 0.000  0
#> SRR2015746     3  0.0000      0.878 0.000 0.000 1.000  0
#> SRR2015758     2  0.0000      0.933 0.000 1.000 0.000  0
#> SRR2015756     1  0.0000      0.942 1.000 0.000 0.000  0
#> SRR2015757     3  0.0000      0.878 0.000 0.000 1.000  0
#> SRR2015755     1  0.0000      0.942 1.000 0.000 0.000  0
#> SRR2015754     1  0.1557      0.880 0.944 0.000 0.056  0
#> SRR2015752     1  0.0000      0.942 1.000 0.000 0.000  0
#> SRR2015749     1  0.0000      0.942 1.000 0.000 0.000  0
#> SRR2015750     2  0.0000      0.933 0.000 1.000 0.000  0
#> SRR2015751     3  0.4193      0.662 0.268 0.000 0.732  0
#> SRR2015748     2  0.6879      0.435 0.188 0.596 0.216  0
#> SRR2015747     1  0.0000      0.942 1.000 0.000 0.000  0
#> SRR2015745     2  0.0000      0.933 0.000 1.000 0.000  0
#> SRR2015743     1  0.0000      0.942 1.000 0.000 0.000  0
#> SRR2015744     3  0.0188      0.877 0.000 0.004 0.996  0
#> SRR2015742     3  0.0000      0.878 0.000 0.000 1.000  0
#> SRR2015741     1  0.0000      0.942 1.000 0.000 0.000  0
#> SRR2015740     1  0.0000      0.942 1.000 0.000 0.000  0
#> SRR2015738     1  0.0000      0.942 1.000 0.000 0.000  0
#> SRR2015739     1  0.0000      0.942 1.000 0.000 0.000  0
#> SRR2015737     2  0.0000      0.933 0.000 1.000 0.000  0
#> SRR2015736     3  0.0000      0.878 0.000 0.000 1.000  0
#> SRR2015732     1  0.4008      0.604 0.756 0.000 0.244  0
#> SRR2015733     2  0.3074      0.757 0.000 0.848 0.152  0
#> SRR2015734     3  0.4907      0.382 0.420 0.000 0.580  0
#> SRR2015731     3  0.0000      0.878 0.000 0.000 1.000  0
#> SRR2015730     1  0.0000      0.942 1.000 0.000 0.000  0
#> SRR2015728     3  0.0188      0.877 0.004 0.000 0.996  0
#> SRR2015729     2  0.0000      0.933 0.000 1.000 0.000  0
#> SRR2015727     3  0.0000      0.878 0.000 0.000 1.000  0
#> SRR2015726     3  0.1637      0.847 0.060 0.000 0.940  0
#> SRR2015723     3  0.0707      0.869 0.000 0.020 0.980  0
#> SRR2015724     3  0.0000      0.878 0.000 0.000 1.000  0
#> SRR2015725     1  0.0000      0.942 1.000 0.000 0.000  0
#> SRR2015722     3  0.0000      0.878 0.000 0.000 1.000  0
#> SRR2015721     3  0.3311      0.714 0.000 0.172 0.828  0
#> SRR2015720     3  0.0000      0.878 0.000 0.000 1.000  0
#> SRR2015718     3  0.1716      0.842 0.000 0.064 0.936  0
#> SRR2015719     4  0.0000      1.000 0.000 0.000 0.000  1
#> SRR2015717     3  0.0000      0.878 0.000 0.000 1.000  0
#> SRR2015716     3  0.0000      0.878 0.000 0.000 1.000  0
#> SRR2015714     4  0.0000      1.000 0.000 0.000 0.000  1
#> SRR2015713     3  0.3123      0.759 0.000 0.156 0.844  0
#> SRR2015784     2  0.0000      0.933 0.000 1.000 0.000  0
#> SRR2015785     2  0.0000      0.933 0.000 1.000 0.000  0
#> SRR2015783     1  0.0000      0.942 1.000 0.000 0.000  0
#> SRR2015782     2  0.0000      0.933 0.000 1.000 0.000  0
#> SRR2015781     2  0.0000      0.933 0.000 1.000 0.000  0
#> SRR2015780     2  0.0000      0.933 0.000 1.000 0.000  0
#> SRR2015779     2  0.0000      0.933 0.000 1.000 0.000  0
#> SRR2015778     3  0.3801      0.688 0.000 0.220 0.780  0
#> SRR2015777     3  0.3837      0.688 0.000 0.224 0.776  0
#> SRR2015776     4  0.0000      1.000 0.000 0.000 0.000  1
#> SRR2015775     2  0.4164      0.601 0.000 0.736 0.264  0
#> SRR2015774     2  0.4817      0.318 0.000 0.612 0.388  0
#> SRR2015773     2  0.0000      0.933 0.000 1.000 0.000  0
#> SRR2015772     2  0.0000      0.933 0.000 1.000 0.000  0
#> SRR2015771     3  0.4866      0.418 0.404 0.000 0.596  0
#> SRR2015769     2  0.0000      0.933 0.000 1.000 0.000  0
#> SRR2015770     2  0.0000      0.933 0.000 1.000 0.000  0
#> SRR2015768     2  0.0000      0.933 0.000 1.000 0.000  0
#> SRR2015767     4  0.0000      1.000 0.000 0.000 0.000  1
#> SRR2015766     3  0.0000      0.878 0.000 0.000 1.000  0
#> SRR2015764     2  0.0000      0.933 0.000 1.000 0.000  0
#> SRR2015765     2  0.0000      0.933 0.000 1.000 0.000  0
#> SRR2015763     3  0.3688      0.719 0.208 0.000 0.792  0
#> SRR2015762     2  0.0000      0.933 0.000 1.000 0.000  0
#> SRR2015761     2  0.0000      0.933 0.000 1.000 0.000  0
#> SRR2015760     3  0.0000      0.878 0.000 0.000 1.000  0

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>            class entropy silhouette    p1    p2    p3 p4    p5
#> SRR2015715     3  0.5222      0.718 0.196 0.000 0.680  0 0.124
#> SRR2015735     5  0.0162      0.829 0.004 0.000 0.000  0 0.996
#> SRR2015759     1  0.0000      0.884 1.000 0.000 0.000  0 0.000
#> SRR2015753     1  0.0000      0.884 1.000 0.000 0.000  0 0.000
#> SRR2015746     3  0.0162      0.785 0.000 0.000 0.996  0 0.004
#> SRR2015758     2  0.0000      0.934 0.000 1.000 0.000  0 0.000
#> SRR2015756     1  0.0000      0.884 1.000 0.000 0.000  0 0.000
#> SRR2015757     3  0.2329      0.808 0.000 0.000 0.876  0 0.124
#> SRR2015755     1  0.3109      0.732 0.800 0.000 0.000  0 0.200
#> SRR2015754     1  0.3109      0.732 0.800 0.000 0.000  0 0.200
#> SRR2015752     1  0.0000      0.884 1.000 0.000 0.000  0 0.000
#> SRR2015749     1  0.0000      0.884 1.000 0.000 0.000  0 0.000
#> SRR2015750     2  0.0000      0.934 0.000 1.000 0.000  0 0.000
#> SRR2015751     3  0.0162      0.785 0.000 0.000 0.996  0 0.004
#> SRR2015748     5  0.5475      0.408 0.000 0.232 0.124  0 0.644
#> SRR2015747     1  0.0000      0.884 1.000 0.000 0.000  0 0.000
#> SRR2015745     2  0.2488      0.822 0.000 0.872 0.124  0 0.004
#> SRR2015743     1  0.0000      0.884 1.000 0.000 0.000  0 0.000
#> SRR2015744     3  0.0162      0.785 0.000 0.000 0.996  0 0.004
#> SRR2015742     3  0.1671      0.741 0.000 0.000 0.924  0 0.076
#> SRR2015741     1  0.3109      0.732 0.800 0.000 0.000  0 0.200
#> SRR2015740     1  0.0000      0.884 1.000 0.000 0.000  0 0.000
#> SRR2015738     1  0.3109      0.732 0.800 0.000 0.000  0 0.200
#> SRR2015739     1  0.0000      0.884 1.000 0.000 0.000  0 0.000
#> SRR2015737     2  0.0000      0.934 0.000 1.000 0.000  0 0.000
#> SRR2015736     3  0.2329      0.808 0.000 0.000 0.876  0 0.124
#> SRR2015732     1  0.4503      0.591 0.756 0.000 0.120  0 0.124
#> SRR2015733     2  0.3074      0.712 0.000 0.804 0.196  0 0.000
#> SRR2015734     1  0.4300     -0.157 0.524 0.000 0.476  0 0.000
#> SRR2015731     5  0.0162      0.832 0.000 0.000 0.004  0 0.996
#> SRR2015730     1  0.0000      0.884 1.000 0.000 0.000  0 0.000
#> SRR2015728     3  0.2329      0.808 0.000 0.000 0.876  0 0.124
#> SRR2015729     2  0.0000      0.934 0.000 1.000 0.000  0 0.000
#> SRR2015727     5  0.0162      0.832 0.000 0.000 0.004  0 0.996
#> SRR2015726     3  0.5258      0.722 0.180 0.000 0.680  0 0.140
#> SRR2015723     3  0.5222      0.672 0.000 0.196 0.680  0 0.124
#> SRR2015724     3  0.2329      0.808 0.000 0.000 0.876  0 0.124
#> SRR2015725     1  0.0000      0.884 1.000 0.000 0.000  0 0.000
#> SRR2015722     5  0.0000      0.830 0.000 0.000 0.000  0 1.000
#> SRR2015721     3  0.2929      0.698 0.000 0.180 0.820  0 0.000
#> SRR2015720     3  0.2329      0.808 0.000 0.000 0.876  0 0.124
#> SRR2015718     3  0.5222      0.672 0.000 0.196 0.680  0 0.124
#> SRR2015719     4  0.0000      1.000 0.000 0.000 0.000  1 0.000
#> SRR2015717     5  0.3707      0.396 0.000 0.000 0.284  0 0.716
#> SRR2015716     3  0.4720      0.759 0.140 0.000 0.736  0 0.124
#> SRR2015714     4  0.0000      1.000 0.000 0.000 0.000  1 0.000
#> SRR2015713     3  0.2329      0.756 0.000 0.124 0.876  0 0.000
#> SRR2015784     2  0.0000      0.934 0.000 1.000 0.000  0 0.000
#> SRR2015785     2  0.0000      0.934 0.000 1.000 0.000  0 0.000
#> SRR2015783     1  0.0000      0.884 1.000 0.000 0.000  0 0.000
#> SRR2015782     2  0.2488      0.822 0.000 0.872 0.124  0 0.004
#> SRR2015781     2  0.0000      0.934 0.000 1.000 0.000  0 0.000
#> SRR2015780     2  0.0000      0.934 0.000 1.000 0.000  0 0.000
#> SRR2015779     2  0.0000      0.934 0.000 1.000 0.000  0 0.000
#> SRR2015778     3  0.3301      0.667 0.000 0.072 0.848  0 0.080
#> SRR2015777     3  0.0000      0.786 0.000 0.000 1.000  0 0.000
#> SRR2015776     4  0.0000      1.000 0.000 0.000 0.000  1 0.000
#> SRR2015775     2  0.4242      0.133 0.000 0.572 0.428  0 0.000
#> SRR2015774     2  0.3586      0.581 0.000 0.736 0.264  0 0.000
#> SRR2015773     2  0.0000      0.934 0.000 1.000 0.000  0 0.000
#> SRR2015772     2  0.0000      0.934 0.000 1.000 0.000  0 0.000
#> SRR2015771     3  0.5222      0.718 0.196 0.000 0.680  0 0.124
#> SRR2015769     2  0.0000      0.934 0.000 1.000 0.000  0 0.000
#> SRR2015770     2  0.0000      0.934 0.000 1.000 0.000  0 0.000
#> SRR2015768     2  0.0000      0.934 0.000 1.000 0.000  0 0.000
#> SRR2015767     4  0.0000      1.000 0.000 0.000 0.000  1 0.000
#> SRR2015766     5  0.0290      0.830 0.000 0.000 0.008  0 0.992
#> SRR2015764     2  0.0000      0.934 0.000 1.000 0.000  0 0.000
#> SRR2015765     2  0.0162      0.932 0.000 0.996 0.000  0 0.004
#> SRR2015763     3  0.5312      0.706 0.208 0.000 0.668  0 0.124
#> SRR2015762     2  0.0000      0.934 0.000 1.000 0.000  0 0.000
#> SRR2015761     2  0.0000      0.934 0.000 1.000 0.000  0 0.000
#> SRR2015760     3  0.3949      0.635 0.000 0.000 0.668  0 0.332

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>            class entropy silhouette    p1    p2    p3 p4    p5    p6
#> SRR2015715     6  0.2793     0.7430 0.200 0.000 0.000  0 0.000 0.800
#> SRR2015735     3  0.0000     0.8363 0.000 0.000 1.000  0 0.000 0.000
#> SRR2015759     1  0.0000     0.9153 1.000 0.000 0.000  0 0.000 0.000
#> SRR2015753     1  0.0000     0.9153 1.000 0.000 0.000  0 0.000 0.000
#> SRR2015746     5  0.0000     0.8131 0.000 0.000 0.000  0 1.000 0.000
#> SRR2015758     2  0.0000     0.9171 0.000 1.000 0.000  0 0.000 0.000
#> SRR2015756     1  0.0000     0.9153 1.000 0.000 0.000  0 0.000 0.000
#> SRR2015757     6  0.2793     0.7785 0.000 0.000 0.000  0 0.200 0.800
#> SRR2015755     1  0.2793     0.7395 0.800 0.000 0.200  0 0.000 0.000
#> SRR2015754     1  0.3371     0.6349 0.708 0.000 0.292  0 0.000 0.000
#> SRR2015752     1  0.0000     0.9153 1.000 0.000 0.000  0 0.000 0.000
#> SRR2015749     1  0.0000     0.9153 1.000 0.000 0.000  0 0.000 0.000
#> SRR2015750     2  0.0000     0.9171 0.000 1.000 0.000  0 0.000 0.000
#> SRR2015751     5  0.0000     0.8131 0.000 0.000 0.000  0 1.000 0.000
#> SRR2015748     5  0.2793     0.6818 0.000 0.200 0.000  0 0.800 0.000
#> SRR2015747     1  0.0000     0.9153 1.000 0.000 0.000  0 0.000 0.000
#> SRR2015745     5  0.2793     0.6818 0.000 0.200 0.000  0 0.800 0.000
#> SRR2015743     1  0.0000     0.9153 1.000 0.000 0.000  0 0.000 0.000
#> SRR2015744     5  0.0000     0.8131 0.000 0.000 0.000  0 1.000 0.000
#> SRR2015742     5  0.0000     0.8131 0.000 0.000 0.000  0 1.000 0.000
#> SRR2015741     1  0.3371     0.6349 0.708 0.000 0.292  0 0.000 0.000
#> SRR2015740     1  0.0000     0.9153 1.000 0.000 0.000  0 0.000 0.000
#> SRR2015738     1  0.3371     0.6349 0.708 0.000 0.292  0 0.000 0.000
#> SRR2015739     1  0.0000     0.9153 1.000 0.000 0.000  0 0.000 0.000
#> SRR2015737     2  0.0000     0.9171 0.000 1.000 0.000  0 0.000 0.000
#> SRR2015736     6  0.2793     0.7785 0.000 0.000 0.000  0 0.200 0.800
#> SRR2015732     6  0.3789     0.4901 0.416 0.000 0.000  0 0.000 0.584
#> SRR2015733     2  0.2793     0.7004 0.000 0.800 0.000  0 0.200 0.000
#> SRR2015734     6  0.3706     0.5594 0.380 0.000 0.000  0 0.000 0.620
#> SRR2015731     3  0.0000     0.8363 0.000 0.000 1.000  0 0.000 0.000
#> SRR2015730     1  0.0000     0.9153 1.000 0.000 0.000  0 0.000 0.000
#> SRR2015728     6  0.2793     0.7785 0.000 0.000 0.000  0 0.200 0.800
#> SRR2015729     2  0.2597     0.7778 0.000 0.824 0.000  0 0.000 0.176
#> SRR2015727     3  0.0000     0.8363 0.000 0.000 1.000  0 0.000 0.000
#> SRR2015726     6  0.1556     0.6972 0.000 0.000 0.080  0 0.000 0.920
#> SRR2015723     6  0.0000     0.7481 0.000 0.000 0.000  0 0.000 1.000
#> SRR2015724     6  0.2793     0.7785 0.000 0.000 0.000  0 0.200 0.800
#> SRR2015725     1  0.0000     0.9153 1.000 0.000 0.000  0 0.000 0.000
#> SRR2015722     3  0.0000     0.8363 0.000 0.000 1.000  0 0.000 0.000
#> SRR2015721     2  0.5844     0.0545 0.000 0.456 0.000  0 0.200 0.344
#> SRR2015720     6  0.2793     0.7785 0.000 0.000 0.000  0 0.200 0.800
#> SRR2015718     6  0.0000     0.7481 0.000 0.000 0.000  0 0.000 1.000
#> SRR2015719     4  0.0000     1.0000 0.000 0.000 0.000  1 0.000 0.000
#> SRR2015717     3  0.3857    -0.0440 0.000 0.000 0.532  0 0.000 0.468
#> SRR2015716     6  0.0000     0.7481 0.000 0.000 0.000  0 0.000 1.000
#> SRR2015714     4  0.0000     1.0000 0.000 0.000 0.000  1 0.000 0.000
#> SRR2015713     6  0.2793     0.7785 0.000 0.000 0.000  0 0.200 0.800
#> SRR2015784     2  0.0000     0.9171 0.000 1.000 0.000  0 0.000 0.000
#> SRR2015785     2  0.0000     0.9171 0.000 1.000 0.000  0 0.000 0.000
#> SRR2015783     1  0.0000     0.9153 1.000 0.000 0.000  0 0.000 0.000
#> SRR2015782     5  0.3782     0.4105 0.000 0.412 0.000  0 0.588 0.000
#> SRR2015781     2  0.0000     0.9171 0.000 1.000 0.000  0 0.000 0.000
#> SRR2015780     2  0.0000     0.9171 0.000 1.000 0.000  0 0.000 0.000
#> SRR2015779     2  0.0000     0.9171 0.000 1.000 0.000  0 0.000 0.000
#> SRR2015778     5  0.0000     0.8131 0.000 0.000 0.000  0 1.000 0.000
#> SRR2015777     5  0.2300     0.6771 0.000 0.000 0.000  0 0.856 0.144
#> SRR2015776     4  0.0000     1.0000 0.000 0.000 0.000  1 0.000 0.000
#> SRR2015775     2  0.3737     0.5075 0.000 0.608 0.000  0 0.000 0.392
#> SRR2015774     2  0.0146     0.9142 0.000 0.996 0.000  0 0.000 0.004
#> SRR2015773     2  0.0000     0.9171 0.000 1.000 0.000  0 0.000 0.000
#> SRR2015772     2  0.0000     0.9171 0.000 1.000 0.000  0 0.000 0.000
#> SRR2015771     6  0.2793     0.7430 0.200 0.000 0.000  0 0.000 0.800
#> SRR2015769     2  0.2793     0.7549 0.000 0.800 0.000  0 0.000 0.200
#> SRR2015770     2  0.0000     0.9171 0.000 1.000 0.000  0 0.000 0.000
#> SRR2015768     2  0.0000     0.9171 0.000 1.000 0.000  0 0.000 0.000
#> SRR2015767     4  0.0000     1.0000 0.000 0.000 0.000  1 0.000 0.000
#> SRR2015766     3  0.1471     0.7750 0.000 0.000 0.932  0 0.004 0.064
#> SRR2015764     2  0.0000     0.9171 0.000 1.000 0.000  0 0.000 0.000
#> SRR2015765     2  0.0363     0.9086 0.000 0.988 0.012  0 0.000 0.000
#> SRR2015763     6  0.2854     0.7378 0.208 0.000 0.000  0 0.000 0.792
#> SRR2015762     2  0.0000     0.9171 0.000 1.000 0.000  0 0.000 0.000
#> SRR2015761     2  0.0000     0.9171 0.000 1.000 0.000  0 0.000 0.000
#> SRR2015760     6  0.3371     0.5324 0.000 0.000 0.292  0 0.000 0.708

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

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 17223 rows and 73 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.191           0.307       0.679         0.3351 0.584   0.584
#> 3 3 0.343           0.577       0.798         0.5927 0.521   0.381
#> 4 4 0.572           0.805       0.869         0.2532 0.689   0.438
#> 5 5 0.568           0.648       0.815         0.1058 0.969   0.902
#> 6 6 0.596           0.525       0.762         0.0465 0.946   0.809

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
#> SRR2015715     1   1.000    -0.2792 0.508 0.492
#> SRR2015735     1   0.871     0.2813 0.708 0.292
#> SRR2015759     1   0.141     0.3249 0.980 0.020
#> SRR2015753     1   0.000     0.3419 1.000 0.000
#> SRR2015746     1   0.929     0.4340 0.656 0.344
#> SRR2015758     1   0.983     0.3777 0.576 0.424
#> SRR2015756     1   0.000     0.3419 1.000 0.000
#> SRR2015757     2   0.788     0.5597 0.236 0.764
#> SRR2015755     1   0.242     0.3480 0.960 0.040
#> SRR2015754     1   0.850     0.3462 0.724 0.276
#> SRR2015752     1   0.634     0.3739 0.840 0.160
#> SRR2015749     1   0.141     0.3249 0.980 0.020
#> SRR2015750     1   0.978     0.3913 0.588 0.412
#> SRR2015751     1   0.876     0.4201 0.704 0.296
#> SRR2015748     1   0.952     0.4311 0.628 0.372
#> SRR2015747     1   0.000     0.3419 1.000 0.000
#> SRR2015745     1   0.952     0.4311 0.628 0.372
#> SRR2015743     1   0.000     0.3419 1.000 0.000
#> SRR2015744     1   0.952     0.4311 0.628 0.372
#> SRR2015742     1   0.936     0.4323 0.648 0.352
#> SRR2015741     1   0.416     0.2683 0.916 0.084
#> SRR2015740     1   0.634     0.3739 0.840 0.160
#> SRR2015738     1   0.697     0.3613 0.812 0.188
#> SRR2015739     1   0.000     0.3419 1.000 0.000
#> SRR2015737     1   0.978     0.3913 0.588 0.412
#> SRR2015736     2   0.788     0.5597 0.236 0.764
#> SRR2015732     2   1.000     0.2442 0.496 0.504
#> SRR2015733     2   0.788     0.5597 0.236 0.764
#> SRR2015734     1   0.999    -0.2698 0.516 0.484
#> SRR2015731     1   0.994     0.3198 0.544 0.456
#> SRR2015730     1   0.745     0.3420 0.788 0.212
#> SRR2015728     1   1.000     0.2080 0.504 0.496
#> SRR2015729     1   0.996     0.3286 0.536 0.464
#> SRR2015727     2   1.000    -0.2572 0.488 0.512
#> SRR2015726     1   0.993    -0.2369 0.548 0.452
#> SRR2015723     2   0.988     0.1536 0.436 0.564
#> SRR2015724     2   0.909     0.4830 0.324 0.676
#> SRR2015725     1   0.999    -0.2698 0.516 0.484
#> SRR2015722     2   0.966     0.0124 0.392 0.608
#> SRR2015721     2   0.788     0.5597 0.236 0.764
#> SRR2015720     2   0.788     0.5597 0.236 0.764
#> SRR2015718     2   0.971     0.2852 0.400 0.600
#> SRR2015719     2   0.966     0.0124 0.392 0.608
#> SRR2015717     1   0.781     0.3251 0.768 0.232
#> SRR2015716     2   0.975     0.3958 0.408 0.592
#> SRR2015714     2   0.966     0.0124 0.392 0.608
#> SRR2015713     2   0.814     0.5451 0.252 0.748
#> SRR2015784     1   0.952     0.4311 0.628 0.372
#> SRR2015785     1   0.952     0.4311 0.628 0.372
#> SRR2015783     1   0.141     0.3249 0.980 0.020
#> SRR2015782     1   0.952     0.4311 0.628 0.372
#> SRR2015781     1   0.987     0.3629 0.568 0.432
#> SRR2015780     1   0.952     0.4311 0.628 0.372
#> SRR2015779     1   0.966     0.4142 0.608 0.392
#> SRR2015778     1   0.952     0.4311 0.628 0.372
#> SRR2015777     1   0.936     0.4347 0.648 0.352
#> SRR2015776     2   0.966     0.0124 0.392 0.608
#> SRR2015775     1   0.996     0.3286 0.536 0.464
#> SRR2015774     2   0.788     0.5597 0.236 0.764
#> SRR2015773     1   0.990     0.3484 0.560 0.440
#> SRR2015772     1   1.000     0.2092 0.512 0.488
#> SRR2015771     2   1.000     0.2442 0.496 0.504
#> SRR2015769     1   0.996     0.3286 0.536 0.464
#> SRR2015770     1   0.981     0.3835 0.580 0.420
#> SRR2015768     1   0.978     0.3913 0.588 0.412
#> SRR2015767     2   0.966     0.0124 0.392 0.608
#> SRR2015766     1   0.994     0.3198 0.544 0.456
#> SRR2015764     2   0.788     0.5597 0.236 0.764
#> SRR2015765     1   0.993     0.3283 0.548 0.452
#> SRR2015763     2   0.994     0.2480 0.456 0.544
#> SRR2015762     1   0.997     0.3017 0.532 0.468
#> SRR2015761     1   0.997     0.2957 0.532 0.468
#> SRR2015760     1   0.871     0.2101 0.708 0.292

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>            class entropy silhouette    p1    p2    p3
#> SRR2015715     1  0.7824     0.4595 0.580 0.356 0.064
#> SRR2015735     1  0.9466     0.3993 0.456 0.356 0.188
#> SRR2015759     1  0.0892     0.6781 0.980 0.020 0.000
#> SRR2015753     1  0.0892     0.6781 0.980 0.020 0.000
#> SRR2015746     2  0.7956     0.3606 0.424 0.516 0.060
#> SRR2015758     2  0.0892     0.7087 0.000 0.980 0.020
#> SRR2015756     1  0.0892     0.6781 0.980 0.020 0.000
#> SRR2015757     2  0.6488     0.6051 0.160 0.756 0.084
#> SRR2015755     1  0.4280     0.6123 0.856 0.020 0.124
#> SRR2015754     1  0.4280     0.6123 0.856 0.020 0.124
#> SRR2015752     1  0.1031     0.6622 0.976 0.000 0.024
#> SRR2015749     1  0.0747     0.6760 0.984 0.016 0.000
#> SRR2015750     2  0.0000     0.7167 0.000 1.000 0.000
#> SRR2015751     1  0.8039    -0.2006 0.508 0.428 0.064
#> SRR2015748     2  0.5810     0.4086 0.336 0.664 0.000
#> SRR2015747     1  0.0892     0.6781 0.980 0.020 0.000
#> SRR2015745     2  0.5810     0.4086 0.336 0.664 0.000
#> SRR2015743     1  0.0892     0.6781 0.980 0.020 0.000
#> SRR2015744     2  0.6598     0.3821 0.428 0.564 0.008
#> SRR2015742     2  0.7858     0.4483 0.364 0.572 0.064
#> SRR2015741     1  0.4280     0.6123 0.856 0.020 0.124
#> SRR2015740     1  0.1031     0.6622 0.976 0.000 0.024
#> SRR2015738     1  0.4280     0.6123 0.856 0.020 0.124
#> SRR2015739     1  0.0892     0.6781 0.980 0.020 0.000
#> SRR2015737     2  0.0000     0.7167 0.000 1.000 0.000
#> SRR2015736     2  0.4821     0.6912 0.088 0.848 0.064
#> SRR2015732     1  0.7841     0.4524 0.576 0.360 0.064
#> SRR2015733     2  0.0892     0.7087 0.000 0.980 0.020
#> SRR2015734     1  0.7824     0.4595 0.580 0.356 0.064
#> SRR2015731     2  0.4737     0.6934 0.084 0.852 0.064
#> SRR2015730     1  0.6867     0.5052 0.636 0.336 0.028
#> SRR2015728     2  0.7816     0.3400 0.288 0.628 0.084
#> SRR2015729     2  0.0892     0.7131 0.020 0.980 0.000
#> SRR2015727     2  0.4737     0.6934 0.084 0.852 0.064
#> SRR2015726     2  0.8063    -0.1610 0.448 0.488 0.064
#> SRR2015723     2  0.5060     0.6880 0.100 0.836 0.064
#> SRR2015724     2  0.5760     0.6502 0.140 0.796 0.064
#> SRR2015725     1  0.6448     0.4971 0.636 0.352 0.012
#> SRR2015722     2  0.8924     0.0436 0.140 0.524 0.336
#> SRR2015721     2  0.4565     0.6971 0.076 0.860 0.064
#> SRR2015720     2  0.4565     0.6968 0.076 0.860 0.064
#> SRR2015718     2  0.3780     0.7048 0.044 0.892 0.064
#> SRR2015719     3  0.4702     1.0000 0.000 0.212 0.788
#> SRR2015717     1  0.9515     0.3323 0.424 0.388 0.188
#> SRR2015716     2  0.8025    -0.0650 0.420 0.516 0.064
#> SRR2015714     3  0.4702     1.0000 0.000 0.212 0.788
#> SRR2015713     2  0.3554     0.7066 0.036 0.900 0.064
#> SRR2015784     2  0.5810     0.4086 0.336 0.664 0.000
#> SRR2015785     2  0.5810     0.4086 0.336 0.664 0.000
#> SRR2015783     1  0.0892     0.6781 0.980 0.020 0.000
#> SRR2015782     2  0.5810     0.4086 0.336 0.664 0.000
#> SRR2015781     2  0.1482     0.7079 0.012 0.968 0.020
#> SRR2015780     2  0.5810     0.4086 0.336 0.664 0.000
#> SRR2015779     2  0.1315     0.7087 0.008 0.972 0.020
#> SRR2015778     2  0.6168     0.4019 0.412 0.588 0.000
#> SRR2015777     2  0.8009     0.3768 0.412 0.524 0.064
#> SRR2015776     3  0.4702     1.0000 0.000 0.212 0.788
#> SRR2015775     2  0.0892     0.7131 0.020 0.980 0.000
#> SRR2015774     2  0.1753     0.7124 0.000 0.952 0.048
#> SRR2015773     2  0.0000     0.7167 0.000 1.000 0.000
#> SRR2015772     2  0.0000     0.7167 0.000 1.000 0.000
#> SRR2015771     1  0.7824     0.4595 0.580 0.356 0.064
#> SRR2015769     2  0.0892     0.7131 0.020 0.980 0.000
#> SRR2015770     2  0.0000     0.7167 0.000 1.000 0.000
#> SRR2015768     2  0.0000     0.7167 0.000 1.000 0.000
#> SRR2015767     3  0.4702     1.0000 0.000 0.212 0.788
#> SRR2015766     2  0.4565     0.6971 0.076 0.860 0.064
#> SRR2015764     2  0.0000     0.7167 0.000 1.000 0.000
#> SRR2015765     2  0.0000     0.7167 0.000 1.000 0.000
#> SRR2015763     1  0.7824     0.4595 0.580 0.356 0.064
#> SRR2015762     2  0.0892     0.7087 0.000 0.980 0.020
#> SRR2015761     2  0.0000     0.7167 0.000 1.000 0.000
#> SRR2015760     2  0.7858     0.1217 0.364 0.572 0.064

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> SRR2015715     3  0.3266      0.722 0.168 0.000 0.832 0.000
#> SRR2015735     3  0.2530      0.655 0.112 0.000 0.888 0.000
#> SRR2015759     1  0.0188      0.897 0.996 0.000 0.004 0.000
#> SRR2015753     1  0.0188      0.897 0.996 0.000 0.004 0.000
#> SRR2015746     3  0.5090      0.669 0.016 0.324 0.660 0.000
#> SRR2015758     2  0.1022      0.886 0.000 0.968 0.032 0.000
#> SRR2015756     1  0.0188      0.897 0.996 0.000 0.004 0.000
#> SRR2015757     3  0.3024      0.850 0.000 0.148 0.852 0.000
#> SRR2015755     1  0.3610      0.788 0.800 0.000 0.200 0.000
#> SRR2015754     1  0.3610      0.788 0.800 0.000 0.200 0.000
#> SRR2015752     1  0.0188      0.893 0.996 0.000 0.000 0.004
#> SRR2015749     1  0.0188      0.897 0.996 0.000 0.004 0.000
#> SRR2015750     2  0.0000      0.897 0.000 1.000 0.000 0.000
#> SRR2015751     3  0.5090      0.669 0.016 0.324 0.660 0.000
#> SRR2015748     2  0.0779      0.893 0.016 0.980 0.000 0.004
#> SRR2015747     1  0.0188      0.897 0.996 0.000 0.004 0.000
#> SRR2015745     2  0.0592      0.893 0.016 0.984 0.000 0.000
#> SRR2015743     1  0.0188      0.897 0.996 0.000 0.004 0.000
#> SRR2015744     3  0.6295      0.703 0.196 0.144 0.660 0.000
#> SRR2015742     3  0.3547      0.844 0.016 0.144 0.840 0.000
#> SRR2015741     1  0.3610      0.788 0.800 0.000 0.200 0.000
#> SRR2015740     1  0.0188      0.893 0.996 0.000 0.000 0.004
#> SRR2015738     1  0.3610      0.788 0.800 0.000 0.200 0.000
#> SRR2015739     1  0.0188      0.897 0.996 0.000 0.004 0.000
#> SRR2015737     2  0.0000      0.897 0.000 1.000 0.000 0.000
#> SRR2015736     3  0.2973      0.851 0.000 0.144 0.856 0.000
#> SRR2015732     3  0.5004      0.394 0.392 0.004 0.604 0.000
#> SRR2015733     2  0.4916      0.229 0.000 0.576 0.424 0.000
#> SRR2015734     3  0.4843      0.386 0.396 0.000 0.604 0.000
#> SRR2015731     3  0.2973      0.851 0.000 0.144 0.856 0.000
#> SRR2015730     1  0.3751      0.674 0.800 0.000 0.196 0.004
#> SRR2015728     3  0.3024      0.850 0.000 0.148 0.852 0.000
#> SRR2015729     2  0.0188      0.897 0.000 0.996 0.000 0.004
#> SRR2015727     3  0.2973      0.851 0.000 0.144 0.856 0.000
#> SRR2015726     3  0.2973      0.851 0.000 0.144 0.856 0.000
#> SRR2015723     3  0.3157      0.850 0.000 0.144 0.852 0.004
#> SRR2015724     3  0.2973      0.851 0.000 0.144 0.856 0.000
#> SRR2015725     1  0.3908      0.655 0.784 0.000 0.212 0.004
#> SRR2015722     3  0.6295      0.702 0.000 0.144 0.660 0.196
#> SRR2015721     3  0.2973      0.851 0.000 0.144 0.856 0.000
#> SRR2015720     3  0.3024      0.850 0.000 0.148 0.852 0.000
#> SRR2015718     3  0.3157      0.850 0.000 0.144 0.852 0.004
#> SRR2015719     4  0.0336      1.000 0.000 0.008 0.000 0.992
#> SRR2015717     3  0.0469      0.756 0.000 0.012 0.988 0.000
#> SRR2015716     3  0.3157      0.850 0.000 0.144 0.852 0.004
#> SRR2015714     4  0.0336      1.000 0.000 0.008 0.000 0.992
#> SRR2015713     3  0.3024      0.850 0.000 0.148 0.852 0.000
#> SRR2015784     2  0.0000      0.897 0.000 1.000 0.000 0.000
#> SRR2015785     2  0.0657      0.895 0.012 0.984 0.000 0.004
#> SRR2015783     1  0.0188      0.897 0.996 0.000 0.004 0.000
#> SRR2015782     2  0.0779      0.893 0.016 0.980 0.000 0.004
#> SRR2015781     2  0.0000      0.897 0.000 1.000 0.000 0.000
#> SRR2015780     2  0.0657      0.895 0.012 0.984 0.000 0.004
#> SRR2015779     2  0.0000      0.897 0.000 1.000 0.000 0.000
#> SRR2015778     3  0.5090      0.669 0.016 0.324 0.660 0.000
#> SRR2015777     3  0.5090      0.669 0.016 0.324 0.660 0.000
#> SRR2015776     4  0.0336      1.000 0.000 0.008 0.000 0.992
#> SRR2015775     2  0.0376      0.897 0.000 0.992 0.004 0.004
#> SRR2015774     3  0.3751      0.805 0.000 0.196 0.800 0.004
#> SRR2015773     2  0.3569      0.748 0.000 0.804 0.196 0.000
#> SRR2015772     2  0.3569      0.748 0.000 0.804 0.196 0.000
#> SRR2015771     3  0.4843      0.386 0.396 0.000 0.604 0.000
#> SRR2015769     2  0.0188      0.897 0.000 0.996 0.000 0.004
#> SRR2015770     2  0.0592      0.894 0.000 0.984 0.016 0.000
#> SRR2015768     2  0.0000      0.897 0.000 1.000 0.000 0.000
#> SRR2015767     4  0.0336      1.000 0.000 0.008 0.000 0.992
#> SRR2015766     3  0.2973      0.851 0.000 0.144 0.856 0.000
#> SRR2015764     2  0.3569      0.748 0.000 0.804 0.196 0.000
#> SRR2015765     2  0.3751      0.748 0.000 0.800 0.196 0.004
#> SRR2015763     3  0.4843      0.386 0.396 0.000 0.604 0.000
#> SRR2015762     2  0.4348      0.734 0.000 0.780 0.196 0.024
#> SRR2015761     3  0.3024      0.850 0.000 0.148 0.852 0.000
#> SRR2015760     3  0.2973      0.851 0.000 0.144 0.856 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
#> SRR2015715     3  0.3123     0.6731 0.184 0.000 0.812 0.000 0.004
#> SRR2015735     3  0.4901     0.4269 0.196 0.000 0.708 0.000 0.096
#> SRR2015759     1  0.0000     0.8886 1.000 0.000 0.000 0.000 0.000
#> SRR2015753     1  0.1197     0.8490 0.952 0.048 0.000 0.000 0.000
#> SRR2015746     3  0.4946    -0.0435 0.000 0.052 0.648 0.000 0.300
#> SRR2015758     2  0.0404     0.7242 0.000 0.988 0.012 0.000 0.000
#> SRR2015756     1  0.0000     0.8886 1.000 0.000 0.000 0.000 0.000
#> SRR2015757     3  0.2605     0.6872 0.000 0.148 0.852 0.000 0.000
#> SRR2015755     1  0.2450     0.8324 0.900 0.000 0.052 0.000 0.048
#> SRR2015754     1  0.3835     0.7226 0.796 0.000 0.156 0.000 0.048
#> SRR2015752     1  0.0162     0.8877 0.996 0.000 0.000 0.000 0.004
#> SRR2015749     1  0.0000     0.8886 1.000 0.000 0.000 0.000 0.000
#> SRR2015750     2  0.0510     0.7221 0.000 0.984 0.016 0.000 0.000
#> SRR2015751     3  0.6459     0.3902 0.064 0.196 0.624 0.000 0.116
#> SRR2015748     5  0.4486     0.5914 0.000 0.080 0.172 0.000 0.748
#> SRR2015747     1  0.0000     0.8886 1.000 0.000 0.000 0.000 0.000
#> SRR2015745     2  0.4497     0.4933 0.000 0.632 0.016 0.000 0.352
#> SRR2015743     1  0.0000     0.8886 1.000 0.000 0.000 0.000 0.000
#> SRR2015744     5  0.6526     0.6385 0.076 0.052 0.336 0.000 0.536
#> SRR2015742     3  0.2629     0.5855 0.136 0.004 0.860 0.000 0.000
#> SRR2015741     1  0.3794     0.7269 0.800 0.000 0.152 0.000 0.048
#> SRR2015740     1  0.0162     0.8877 0.996 0.000 0.000 0.000 0.004
#> SRR2015738     1  0.3794     0.7269 0.800 0.000 0.152 0.000 0.048
#> SRR2015739     1  0.0000     0.8886 1.000 0.000 0.000 0.000 0.000
#> SRR2015737     2  0.0000     0.7243 0.000 1.000 0.000 0.000 0.000
#> SRR2015736     3  0.2605     0.6872 0.000 0.148 0.852 0.000 0.000
#> SRR2015732     3  0.4029     0.5487 0.316 0.000 0.680 0.000 0.004
#> SRR2015733     2  0.4262     0.2073 0.000 0.560 0.440 0.000 0.000
#> SRR2015734     3  0.3521     0.6381 0.232 0.000 0.764 0.000 0.004
#> SRR2015731     3  0.3010     0.5645 0.000 0.004 0.824 0.000 0.172
#> SRR2015730     1  0.3491     0.6163 0.768 0.000 0.228 0.000 0.004
#> SRR2015728     3  0.3752     0.6786 0.000 0.148 0.804 0.000 0.048
#> SRR2015729     2  0.3284     0.6640 0.000 0.828 0.024 0.000 0.148
#> SRR2015727     3  0.3969     0.3339 0.000 0.004 0.692 0.000 0.304
#> SRR2015726     3  0.2719     0.6955 0.144 0.004 0.852 0.000 0.000
#> SRR2015723     3  0.2719     0.6880 0.000 0.004 0.852 0.000 0.144
#> SRR2015724     3  0.2719     0.6955 0.144 0.004 0.852 0.000 0.000
#> SRR2015725     1  0.3491     0.6163 0.768 0.000 0.228 0.000 0.004
#> SRR2015722     3  0.6795    -0.4597 0.000 0.004 0.400 0.228 0.368
#> SRR2015721     3  0.2605     0.6872 0.000 0.148 0.852 0.000 0.000
#> SRR2015720     3  0.2605     0.6872 0.000 0.148 0.852 0.000 0.000
#> SRR2015718     3  0.2719     0.6880 0.000 0.004 0.852 0.000 0.144
#> SRR2015719     4  0.0000     1.0000 0.000 0.000 0.000 1.000 0.000
#> SRR2015717     3  0.1270     0.6634 0.000 0.000 0.948 0.000 0.052
#> SRR2015716     3  0.3334     0.7031 0.064 0.004 0.852 0.000 0.080
#> SRR2015714     4  0.0000     1.0000 0.000 0.000 0.000 1.000 0.000
#> SRR2015713     3  0.2605     0.6872 0.000 0.148 0.852 0.000 0.000
#> SRR2015784     2  0.3039     0.6605 0.000 0.808 0.000 0.000 0.192
#> SRR2015785     2  0.3636     0.6067 0.000 0.728 0.000 0.000 0.272
#> SRR2015783     1  0.0000     0.8886 1.000 0.000 0.000 0.000 0.000
#> SRR2015782     2  0.4080     0.6111 0.000 0.728 0.020 0.000 0.252
#> SRR2015781     2  0.5819     0.5381 0.000 0.600 0.000 0.148 0.252
#> SRR2015780     2  0.5990     0.4038 0.000 0.560 0.144 0.000 0.296
#> SRR2015779     2  0.5392     0.5968 0.000 0.664 0.000 0.144 0.192
#> SRR2015778     5  0.6001     0.5906 0.000 0.176 0.244 0.000 0.580
#> SRR2015777     3  0.5877     0.3029 0.000 0.196 0.604 0.000 0.200
#> SRR2015776     4  0.0000     1.0000 0.000 0.000 0.000 1.000 0.000
#> SRR2015775     2  0.3284     0.6640 0.000 0.828 0.024 0.000 0.148
#> SRR2015774     3  0.3508     0.3591 0.000 0.252 0.748 0.000 0.000
#> SRR2015773     2  0.1197     0.7120 0.000 0.952 0.048 0.000 0.000
#> SRR2015772     2  0.1792     0.6995 0.000 0.916 0.084 0.000 0.000
#> SRR2015771     3  0.3398     0.6505 0.216 0.000 0.780 0.000 0.004
#> SRR2015769     2  0.3284     0.6640 0.000 0.828 0.024 0.000 0.148
#> SRR2015770     2  0.0000     0.7243 0.000 1.000 0.000 0.000 0.000
#> SRR2015768     2  0.0000     0.7243 0.000 1.000 0.000 0.000 0.000
#> SRR2015767     4  0.0000     1.0000 0.000 0.000 0.000 1.000 0.000
#> SRR2015766     3  0.2233     0.6322 0.000 0.004 0.892 0.000 0.104
#> SRR2015764     2  0.3508     0.5471 0.000 0.748 0.252 0.000 0.000
#> SRR2015765     2  0.4201     0.4031 0.000 0.592 0.408 0.000 0.000
#> SRR2015763     3  0.3814     0.5961 0.276 0.000 0.720 0.000 0.004
#> SRR2015762     2  0.5941     0.4935 0.000 0.592 0.180 0.228 0.000
#> SRR2015761     3  0.1608     0.6974 0.000 0.072 0.928 0.000 0.000
#> SRR2015760     3  0.1357     0.6652 0.000 0.004 0.948 0.000 0.048

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>            class entropy silhouette    p1    p2    p3    p4    p5    p6
#> SRR2015715     6  0.4282    0.57381 0.200 0.000 0.004 0.000 0.072 0.724
#> SRR2015735     3  0.2721    0.58400 0.040 0.000 0.868 0.000 0.004 0.088
#> SRR2015759     1  0.0000    0.80985 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2015753     1  0.3487    0.59522 0.756 0.000 0.000 0.000 0.224 0.020
#> SRR2015746     6  0.5076   -0.28677 0.016 0.000 0.044 0.000 0.428 0.512
#> SRR2015758     2  0.3314    0.57947 0.000 0.764 0.000 0.000 0.012 0.224
#> SRR2015756     1  0.0508    0.81075 0.984 0.000 0.004 0.000 0.000 0.012
#> SRR2015757     6  0.1924    0.64762 0.000 0.028 0.004 0.000 0.048 0.920
#> SRR2015755     1  0.3404    0.70108 0.744 0.000 0.248 0.000 0.004 0.004
#> SRR2015754     1  0.3789    0.63155 0.668 0.000 0.324 0.000 0.004 0.004
#> SRR2015752     1  0.2219    0.77982 0.864 0.000 0.000 0.000 0.136 0.000
#> SRR2015749     1  0.0000    0.80985 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2015750     2  0.0790    0.59359 0.000 0.968 0.000 0.000 0.000 0.032
#> SRR2015751     6  0.5218    0.20015 0.088 0.016 0.000 0.000 0.280 0.616
#> SRR2015748     5  0.5475    0.29235 0.000 0.176 0.072 0.000 0.664 0.088
#> SRR2015747     1  0.0603    0.81009 0.980 0.000 0.004 0.000 0.000 0.016
#> SRR2015745     5  0.4574   -0.21346 0.000 0.440 0.000 0.000 0.524 0.036
#> SRR2015743     1  0.0777    0.80715 0.972 0.000 0.000 0.000 0.004 0.024
#> SRR2015744     5  0.6816    0.11041 0.056 0.004 0.172 0.000 0.388 0.380
#> SRR2015742     6  0.5448    0.18621 0.288 0.016 0.076 0.000 0.012 0.608
#> SRR2015741     1  0.3606    0.67115 0.708 0.000 0.284 0.000 0.004 0.004
#> SRR2015740     1  0.2219    0.77982 0.864 0.000 0.000 0.000 0.136 0.000
#> SRR2015738     1  0.3646    0.66451 0.700 0.000 0.292 0.000 0.004 0.004
#> SRR2015739     1  0.0508    0.81075 0.984 0.000 0.004 0.000 0.000 0.012
#> SRR2015737     2  0.0363    0.59336 0.000 0.988 0.000 0.000 0.012 0.000
#> SRR2015736     6  0.2543    0.66201 0.024 0.016 0.004 0.000 0.064 0.892
#> SRR2015732     6  0.4725    0.52682 0.248 0.004 0.004 0.000 0.072 0.672
#> SRR2015733     2  0.4703    0.33104 0.000 0.492 0.000 0.000 0.044 0.464
#> SRR2015734     6  0.4392    0.56274 0.216 0.000 0.004 0.000 0.072 0.708
#> SRR2015731     3  0.3076    0.69554 0.000 0.000 0.760 0.000 0.000 0.240
#> SRR2015730     1  0.5289    0.43029 0.576 0.000 0.000 0.000 0.136 0.288
#> SRR2015728     6  0.4912    0.13133 0.000 0.028 0.300 0.000 0.040 0.632
#> SRR2015729     2  0.2803    0.57357 0.000 0.864 0.004 0.000 0.048 0.084
#> SRR2015727     3  0.2883    0.70541 0.000 0.000 0.788 0.000 0.000 0.212
#> SRR2015726     6  0.1367    0.66681 0.044 0.000 0.000 0.000 0.012 0.944
#> SRR2015723     6  0.1268    0.66191 0.008 0.004 0.000 0.000 0.036 0.952
#> SRR2015724     6  0.1615    0.66586 0.064 0.004 0.000 0.000 0.004 0.928
#> SRR2015725     1  0.5042    0.43445 0.604 0.000 0.000 0.000 0.108 0.288
#> SRR2015722     3  0.4999    0.46702 0.000 0.000 0.632 0.240 0.000 0.128
#> SRR2015721     6  0.2341    0.66358 0.024 0.016 0.008 0.000 0.044 0.908
#> SRR2015720     6  0.2543    0.66201 0.024 0.016 0.004 0.000 0.064 0.892
#> SRR2015718     6  0.1268    0.66190 0.008 0.004 0.000 0.000 0.036 0.952
#> SRR2015719     4  0.0000    1.00000 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR2015717     6  0.3756    0.00157 0.000 0.000 0.400 0.000 0.000 0.600
#> SRR2015716     6  0.1296    0.66273 0.012 0.004 0.000 0.000 0.032 0.952
#> SRR2015714     4  0.0000    1.00000 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR2015713     6  0.1857    0.65229 0.000 0.044 0.004 0.000 0.028 0.924
#> SRR2015784     2  0.3862    0.35106 0.000 0.608 0.000 0.000 0.388 0.004
#> SRR2015785     2  0.4165    0.28685 0.000 0.536 0.000 0.000 0.452 0.012
#> SRR2015783     1  0.0000    0.80985 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2015782     2  0.4743    0.30940 0.000 0.548 0.000 0.000 0.400 0.052
#> SRR2015781     2  0.4962    0.26803 0.000 0.516 0.000 0.068 0.416 0.000
#> SRR2015780     2  0.4797    0.22448 0.000 0.500 0.024 0.000 0.460 0.016
#> SRR2015779     2  0.4534    0.34150 0.000 0.580 0.000 0.040 0.380 0.000
#> SRR2015778     5  0.5836    0.23914 0.008 0.020 0.084 0.000 0.456 0.432
#> SRR2015777     6  0.4835   -0.03789 0.024 0.016 0.004 0.000 0.388 0.568
#> SRR2015776     4  0.0000    1.00000 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR2015775     2  0.2854    0.57064 0.000 0.860 0.004 0.000 0.048 0.088
#> SRR2015774     6  0.5083   -0.15163 0.000 0.404 0.032 0.000 0.028 0.536
#> SRR2015773     2  0.3710    0.53656 0.000 0.696 0.000 0.000 0.012 0.292
#> SRR2015772     2  0.3729    0.53346 0.000 0.692 0.000 0.000 0.012 0.296
#> SRR2015771     6  0.4392    0.56274 0.216 0.000 0.004 0.000 0.072 0.708
#> SRR2015769     2  0.2803    0.57357 0.000 0.864 0.004 0.000 0.048 0.084
#> SRR2015770     2  0.0260    0.59138 0.000 0.992 0.000 0.000 0.008 0.000
#> SRR2015768     2  0.0260    0.59346 0.000 0.992 0.000 0.000 0.008 0.000
#> SRR2015767     4  0.0000    1.00000 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR2015766     3  0.3852    0.50722 0.000 0.004 0.612 0.000 0.000 0.384
#> SRR2015764     2  0.3547    0.51349 0.000 0.668 0.000 0.000 0.000 0.332
#> SRR2015765     2  0.5153    0.40575 0.000 0.528 0.032 0.000 0.032 0.408
#> SRR2015763     6  0.3904    0.57612 0.232 0.000 0.004 0.000 0.032 0.732
#> SRR2015762     2  0.6239    0.51177 0.000 0.600 0.112 0.104 0.004 0.180
#> SRR2015761     6  0.4826    0.24267 0.000 0.312 0.036 0.000 0.024 0.628
#> SRR2015760     6  0.2340    0.57649 0.000 0.000 0.148 0.000 0.000 0.852

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

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 17223 rows and 73 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.916           0.946       0.975         0.4915 0.514   0.514
#> 3 3 0.786           0.802       0.916         0.2383 0.813   0.658
#> 4 4 0.555           0.649       0.821         0.1690 0.737   0.441
#> 5 5 0.621           0.692       0.824         0.0810 0.752   0.340
#> 6 6 0.659           0.606       0.801         0.0319 0.874   0.548

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
#> SRR2015715     1  0.0000      0.960 1.000 0.000
#> SRR2015735     1  0.0000      0.960 1.000 0.000
#> SRR2015759     1  0.0000      0.960 1.000 0.000
#> SRR2015753     1  0.0000      0.960 1.000 0.000
#> SRR2015746     1  0.1633      0.944 0.976 0.024
#> SRR2015758     2  0.0000      0.995 0.000 1.000
#> SRR2015756     1  0.0000      0.960 1.000 0.000
#> SRR2015757     1  0.0000      0.960 1.000 0.000
#> SRR2015755     1  0.0000      0.960 1.000 0.000
#> SRR2015754     1  0.0000      0.960 1.000 0.000
#> SRR2015752     1  0.0000      0.960 1.000 0.000
#> SRR2015749     1  0.0000      0.960 1.000 0.000
#> SRR2015750     2  0.0000      0.995 0.000 1.000
#> SRR2015751     1  0.0000      0.960 1.000 0.000
#> SRR2015748     2  0.1633      0.972 0.024 0.976
#> SRR2015747     1  0.0000      0.960 1.000 0.000
#> SRR2015745     2  0.0000      0.995 0.000 1.000
#> SRR2015743     1  0.0000      0.960 1.000 0.000
#> SRR2015744     1  0.7674      0.734 0.776 0.224
#> SRR2015742     1  0.5059      0.866 0.888 0.112
#> SRR2015741     1  0.0000      0.960 1.000 0.000
#> SRR2015740     1  0.0000      0.960 1.000 0.000
#> SRR2015738     1  0.0000      0.960 1.000 0.000
#> SRR2015739     1  0.0000      0.960 1.000 0.000
#> SRR2015737     2  0.0000      0.995 0.000 1.000
#> SRR2015736     1  0.0000      0.960 1.000 0.000
#> SRR2015732     1  0.0000      0.960 1.000 0.000
#> SRR2015733     2  0.0000      0.995 0.000 1.000
#> SRR2015734     1  0.0000      0.960 1.000 0.000
#> SRR2015731     1  0.8443      0.662 0.728 0.272
#> SRR2015730     1  0.0000      0.960 1.000 0.000
#> SRR2015728     1  0.0000      0.960 1.000 0.000
#> SRR2015729     2  0.0000      0.995 0.000 1.000
#> SRR2015727     1  0.9710      0.397 0.600 0.400
#> SRR2015726     1  0.0000      0.960 1.000 0.000
#> SRR2015723     1  0.1184      0.950 0.984 0.016
#> SRR2015724     1  0.0000      0.960 1.000 0.000
#> SRR2015725     1  0.0000      0.960 1.000 0.000
#> SRR2015722     1  0.9323      0.519 0.652 0.348
#> SRR2015721     1  0.0376      0.958 0.996 0.004
#> SRR2015720     1  0.0000      0.960 1.000 0.000
#> SRR2015718     1  0.2948      0.922 0.948 0.052
#> SRR2015719     2  0.0000      0.995 0.000 1.000
#> SRR2015717     1  0.0000      0.960 1.000 0.000
#> SRR2015716     1  0.0000      0.960 1.000 0.000
#> SRR2015714     2  0.0000      0.995 0.000 1.000
#> SRR2015713     1  0.0376      0.958 0.996 0.004
#> SRR2015784     2  0.0000      0.995 0.000 1.000
#> SRR2015785     2  0.0000      0.995 0.000 1.000
#> SRR2015783     1  0.0000      0.960 1.000 0.000
#> SRR2015782     2  0.0000      0.995 0.000 1.000
#> SRR2015781     2  0.0000      0.995 0.000 1.000
#> SRR2015780     2  0.0000      0.995 0.000 1.000
#> SRR2015779     2  0.0000      0.995 0.000 1.000
#> SRR2015778     1  0.7674      0.734 0.776 0.224
#> SRR2015777     1  0.0672      0.955 0.992 0.008
#> SRR2015776     2  0.0000      0.995 0.000 1.000
#> SRR2015775     2  0.0000      0.995 0.000 1.000
#> SRR2015774     2  0.0000      0.995 0.000 1.000
#> SRR2015773     2  0.0000      0.995 0.000 1.000
#> SRR2015772     2  0.0000      0.995 0.000 1.000
#> SRR2015771     1  0.0000      0.960 1.000 0.000
#> SRR2015769     2  0.0000      0.995 0.000 1.000
#> SRR2015770     2  0.0000      0.995 0.000 1.000
#> SRR2015768     2  0.0000      0.995 0.000 1.000
#> SRR2015767     2  0.0000      0.995 0.000 1.000
#> SRR2015766     2  0.4690      0.881 0.100 0.900
#> SRR2015764     2  0.0000      0.995 0.000 1.000
#> SRR2015765     2  0.0000      0.995 0.000 1.000
#> SRR2015763     1  0.0000      0.960 1.000 0.000
#> SRR2015762     2  0.0000      0.995 0.000 1.000
#> SRR2015761     2  0.0000      0.995 0.000 1.000
#> SRR2015760     1  0.0000      0.960 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
#> SRR2015715     1  0.1411     0.8941 0.964 0.036 0.000
#> SRR2015735     1  0.0000     0.9126 1.000 0.000 0.000
#> SRR2015759     1  0.0237     0.9131 0.996 0.000 0.004
#> SRR2015753     1  0.0892     0.9117 0.980 0.000 0.020
#> SRR2015746     1  0.0892     0.9117 0.980 0.000 0.020
#> SRR2015758     2  0.0000     0.9052 0.000 1.000 0.000
#> SRR2015756     1  0.0892     0.9117 0.980 0.000 0.020
#> SRR2015757     1  0.6095     0.3977 0.608 0.392 0.000
#> SRR2015755     1  0.0892     0.9117 0.980 0.000 0.020
#> SRR2015754     1  0.1031     0.9099 0.976 0.000 0.024
#> SRR2015752     1  0.0237     0.9131 0.996 0.000 0.004
#> SRR2015749     1  0.0747     0.9126 0.984 0.000 0.016
#> SRR2015750     2  0.0000     0.9052 0.000 1.000 0.000
#> SRR2015751     1  0.0747     0.9126 0.984 0.000 0.016
#> SRR2015748     3  0.0237     0.7947 0.004 0.000 0.996
#> SRR2015747     1  0.0892     0.9117 0.980 0.000 0.020
#> SRR2015745     2  0.4883     0.7098 0.004 0.788 0.208
#> SRR2015743     1  0.0747     0.9126 0.984 0.000 0.016
#> SRR2015744     1  0.1289     0.9058 0.968 0.000 0.032
#> SRR2015742     1  0.1163     0.9082 0.972 0.000 0.028
#> SRR2015741     1  0.0892     0.9117 0.980 0.000 0.020
#> SRR2015740     1  0.0000     0.9126 1.000 0.000 0.000
#> SRR2015738     1  0.0892     0.9117 0.980 0.000 0.020
#> SRR2015739     1  0.0892     0.9117 0.980 0.000 0.020
#> SRR2015737     2  0.0237     0.9048 0.000 0.996 0.004
#> SRR2015736     1  0.6062     0.4163 0.616 0.384 0.000
#> SRR2015732     1  0.0892     0.9055 0.980 0.020 0.000
#> SRR2015733     2  0.4645     0.7494 0.008 0.816 0.176
#> SRR2015734     1  0.0892     0.9055 0.980 0.020 0.000
#> SRR2015731     3  0.6664     0.2315 0.464 0.008 0.528
#> SRR2015730     1  0.0000     0.9126 1.000 0.000 0.000
#> SRR2015728     1  0.0000     0.9126 1.000 0.000 0.000
#> SRR2015729     2  0.0000     0.9052 0.000 1.000 0.000
#> SRR2015727     3  0.4861     0.7088 0.180 0.012 0.808
#> SRR2015726     1  0.0747     0.9076 0.984 0.016 0.000
#> SRR2015723     2  0.3340     0.7903 0.120 0.880 0.000
#> SRR2015724     1  0.6235     0.2789 0.564 0.436 0.000
#> SRR2015725     1  0.0237     0.9118 0.996 0.004 0.000
#> SRR2015722     3  0.0892     0.7918 0.020 0.000 0.980
#> SRR2015721     1  0.5988     0.4508 0.632 0.368 0.000
#> SRR2015720     1  0.6168     0.3464 0.588 0.412 0.000
#> SRR2015718     2  0.1753     0.8693 0.048 0.952 0.000
#> SRR2015719     3  0.0892     0.7986 0.000 0.020 0.980
#> SRR2015717     1  0.0237     0.9118 0.996 0.004 0.000
#> SRR2015716     1  0.0424     0.9107 0.992 0.008 0.000
#> SRR2015714     3  0.1031     0.7987 0.000 0.024 0.976
#> SRR2015713     2  0.4399     0.6915 0.188 0.812 0.000
#> SRR2015784     2  0.0747     0.8984 0.000 0.984 0.016
#> SRR2015785     2  0.5363     0.5818 0.000 0.724 0.276
#> SRR2015783     1  0.0237     0.9131 0.996 0.000 0.004
#> SRR2015782     2  0.0424     0.9029 0.000 0.992 0.008
#> SRR2015781     3  0.1163     0.7968 0.000 0.028 0.972
#> SRR2015780     3  0.6309    -0.0883 0.000 0.500 0.500
#> SRR2015779     2  0.1860     0.8737 0.000 0.948 0.052
#> SRR2015778     1  0.1529     0.9011 0.960 0.000 0.040
#> SRR2015777     1  0.2846     0.8681 0.924 0.056 0.020
#> SRR2015776     3  0.1031     0.7987 0.000 0.024 0.976
#> SRR2015775     2  0.0237     0.9030 0.004 0.996 0.000
#> SRR2015774     2  0.0000     0.9052 0.000 1.000 0.000
#> SRR2015773     2  0.0000     0.9052 0.000 1.000 0.000
#> SRR2015772     2  0.0237     0.9048 0.000 0.996 0.004
#> SRR2015771     1  0.1411     0.8941 0.964 0.036 0.000
#> SRR2015769     2  0.0000     0.9052 0.000 1.000 0.000
#> SRR2015770     2  0.0237     0.9048 0.000 0.996 0.004
#> SRR2015768     2  0.0237     0.9048 0.000 0.996 0.004
#> SRR2015767     3  0.1031     0.7987 0.000 0.024 0.976
#> SRR2015766     3  0.7459     0.4286 0.372 0.044 0.584
#> SRR2015764     2  0.0000     0.9052 0.000 1.000 0.000
#> SRR2015765     2  0.0424     0.9043 0.000 0.992 0.008
#> SRR2015763     1  0.0892     0.9055 0.980 0.020 0.000
#> SRR2015762     2  0.5988     0.4542 0.000 0.632 0.368
#> SRR2015761     2  0.6200     0.5362 0.012 0.676 0.312
#> SRR2015760     1  0.0592     0.9093 0.988 0.012 0.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> SRR2015715     3  0.3074     0.6476 0.152 0.000 0.848 0.000
#> SRR2015735     1  0.4543     0.6596 0.676 0.000 0.324 0.000
#> SRR2015759     1  0.4072     0.7384 0.748 0.000 0.252 0.000
#> SRR2015753     1  0.1211     0.7924 0.960 0.000 0.040 0.000
#> SRR2015746     1  0.0000     0.7813 1.000 0.000 0.000 0.000
#> SRR2015758     2  0.4898     0.3731 0.000 0.584 0.416 0.000
#> SRR2015756     1  0.0817     0.7890 0.976 0.000 0.024 0.000
#> SRR2015757     3  0.1182     0.7127 0.016 0.016 0.968 0.000
#> SRR2015755     1  0.0592     0.7870 0.984 0.000 0.016 0.000
#> SRR2015754     1  0.2345     0.7952 0.900 0.000 0.100 0.000
#> SRR2015752     1  0.4072     0.7384 0.748 0.000 0.252 0.000
#> SRR2015749     1  0.1792     0.7981 0.932 0.000 0.068 0.000
#> SRR2015750     2  0.2011     0.8062 0.000 0.920 0.080 0.000
#> SRR2015751     1  0.0469     0.7761 0.988 0.000 0.012 0.000
#> SRR2015748     1  0.6327    -0.1888 0.496 0.060 0.000 0.444
#> SRR2015747     1  0.0707     0.7879 0.980 0.000 0.020 0.000
#> SRR2015745     2  0.6107     0.5760 0.264 0.648 0.088 0.000
#> SRR2015743     1  0.2281     0.7977 0.904 0.000 0.096 0.000
#> SRR2015744     1  0.0188     0.7800 0.996 0.000 0.000 0.004
#> SRR2015742     1  0.1722     0.7436 0.944 0.000 0.048 0.008
#> SRR2015741     1  0.2814     0.7905 0.868 0.000 0.132 0.000
#> SRR2015740     1  0.4193     0.7257 0.732 0.000 0.268 0.000
#> SRR2015738     1  0.2973     0.7847 0.856 0.000 0.144 0.000
#> SRR2015739     1  0.2011     0.7990 0.920 0.000 0.080 0.000
#> SRR2015737     2  0.2345     0.7978 0.000 0.900 0.100 0.000
#> SRR2015736     3  0.1151     0.7169 0.024 0.008 0.968 0.000
#> SRR2015732     1  0.4985     0.3642 0.532 0.000 0.468 0.000
#> SRR2015733     3  0.5782     0.5124 0.028 0.200 0.724 0.048
#> SRR2015734     3  0.4564     0.3133 0.328 0.000 0.672 0.000
#> SRR2015731     3  0.4767     0.5465 0.020 0.000 0.724 0.256
#> SRR2015730     1  0.4522     0.6746 0.680 0.000 0.320 0.000
#> SRR2015728     3  0.4967    -0.1996 0.452 0.000 0.548 0.000
#> SRR2015729     2  0.0000     0.8111 0.000 1.000 0.000 0.000
#> SRR2015727     4  0.1867     0.8556 0.000 0.000 0.072 0.928
#> SRR2015726     1  0.4431     0.6912 0.696 0.000 0.304 0.000
#> SRR2015723     1  0.7665     0.2764 0.424 0.216 0.360 0.000
#> SRR2015724     3  0.3037     0.6972 0.100 0.020 0.880 0.000
#> SRR2015725     1  0.4697     0.6241 0.644 0.000 0.356 0.000
#> SRR2015722     4  0.0707     0.9052 0.020 0.000 0.000 0.980
#> SRR2015721     3  0.0779     0.7166 0.016 0.004 0.980 0.000
#> SRR2015720     3  0.1452     0.7110 0.036 0.008 0.956 0.000
#> SRR2015718     3  0.5962     0.6522 0.180 0.128 0.692 0.000
#> SRR2015719     4  0.0000     0.9166 0.000 0.000 0.000 1.000
#> SRR2015717     3  0.4331     0.4187 0.288 0.000 0.712 0.000
#> SRR2015716     1  0.4679     0.6443 0.648 0.000 0.352 0.000
#> SRR2015714     4  0.0000     0.9166 0.000 0.000 0.000 1.000
#> SRR2015713     3  0.3751     0.5728 0.004 0.196 0.800 0.000
#> SRR2015784     2  0.0921     0.8158 0.000 0.972 0.028 0.000
#> SRR2015785     2  0.1174     0.8000 0.012 0.968 0.000 0.020
#> SRR2015783     1  0.3528     0.7715 0.808 0.000 0.192 0.000
#> SRR2015782     2  0.3528     0.6499 0.192 0.808 0.000 0.000
#> SRR2015781     4  0.5752     0.4278 0.036 0.328 0.004 0.632
#> SRR2015780     2  0.3271     0.7102 0.132 0.856 0.000 0.012
#> SRR2015779     2  0.1722     0.8141 0.000 0.944 0.048 0.008
#> SRR2015778     1  0.0376     0.7784 0.992 0.000 0.004 0.004
#> SRR2015777     1  0.2466     0.6983 0.900 0.004 0.096 0.000
#> SRR2015776     4  0.0000     0.9166 0.000 0.000 0.000 1.000
#> SRR2015775     2  0.0000     0.8111 0.000 1.000 0.000 0.000
#> SRR2015774     3  0.4576     0.5069 0.000 0.232 0.748 0.020
#> SRR2015773     2  0.4972     0.2674 0.000 0.544 0.456 0.000
#> SRR2015772     3  0.4730     0.2443 0.000 0.364 0.636 0.000
#> SRR2015771     3  0.3907     0.5331 0.232 0.000 0.768 0.000
#> SRR2015769     2  0.0000     0.8111 0.000 1.000 0.000 0.000
#> SRR2015770     2  0.2589     0.7899 0.000 0.884 0.116 0.000
#> SRR2015768     2  0.0592     0.8149 0.000 0.984 0.016 0.000
#> SRR2015767     4  0.0000     0.9166 0.000 0.000 0.000 1.000
#> SRR2015766     3  0.3610     0.6158 0.000 0.000 0.800 0.200
#> SRR2015764     3  0.4543     0.3476 0.000 0.324 0.676 0.000
#> SRR2015765     2  0.6167     0.5041 0.000 0.652 0.248 0.100
#> SRR2015763     3  0.2760     0.6712 0.128 0.000 0.872 0.000
#> SRR2015762     3  0.7835    -0.0501 0.016 0.156 0.420 0.408
#> SRR2015761     3  0.4215     0.6247 0.000 0.104 0.824 0.072
#> SRR2015760     3  0.2647     0.6774 0.120 0.000 0.880 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
#> SRR2015715     3  0.2006    0.76791 0.012 0.072 0.916 0.000 0.000
#> SRR2015735     3  0.3391    0.76854 0.188 0.012 0.800 0.000 0.000
#> SRR2015759     3  0.4060    0.56073 0.360 0.000 0.640 0.000 0.000
#> SRR2015753     1  0.2424    0.77253 0.868 0.000 0.132 0.000 0.000
#> SRR2015746     1  0.0880    0.80159 0.968 0.000 0.032 0.000 0.000
#> SRR2015758     2  0.1205    0.76944 0.004 0.956 0.000 0.000 0.040
#> SRR2015756     1  0.2929    0.72422 0.820 0.000 0.180 0.000 0.000
#> SRR2015757     2  0.2612    0.78901 0.008 0.868 0.124 0.000 0.000
#> SRR2015755     1  0.1965    0.79134 0.904 0.000 0.096 0.000 0.000
#> SRR2015754     1  0.3837    0.48104 0.692 0.000 0.308 0.000 0.000
#> SRR2015752     3  0.3452    0.72574 0.244 0.000 0.756 0.000 0.000
#> SRR2015749     1  0.1908    0.79406 0.908 0.000 0.092 0.000 0.000
#> SRR2015750     2  0.4907   -0.05336 0.024 0.492 0.000 0.000 0.484
#> SRR2015751     1  0.1981    0.79576 0.924 0.048 0.028 0.000 0.000
#> SRR2015748     1  0.4595    0.66570 0.768 0.000 0.012 0.124 0.096
#> SRR2015747     1  0.2690    0.75214 0.844 0.000 0.156 0.000 0.000
#> SRR2015745     1  0.4454    0.61238 0.760 0.128 0.000 0.000 0.112
#> SRR2015743     3  0.4066    0.62069 0.324 0.000 0.672 0.000 0.004
#> SRR2015744     1  0.1341    0.79957 0.944 0.000 0.056 0.000 0.000
#> SRR2015742     1  0.2977    0.78677 0.876 0.076 0.040 0.008 0.000
#> SRR2015741     3  0.4304    0.23748 0.484 0.000 0.516 0.000 0.000
#> SRR2015740     3  0.3424    0.72984 0.240 0.000 0.760 0.000 0.000
#> SRR2015738     1  0.2852    0.73642 0.828 0.000 0.172 0.000 0.000
#> SRR2015739     1  0.3636    0.56387 0.728 0.000 0.272 0.000 0.000
#> SRR2015737     2  0.3783    0.53928 0.008 0.740 0.000 0.000 0.252
#> SRR2015736     2  0.4126    0.46607 0.000 0.620 0.380 0.000 0.000
#> SRR2015732     3  0.2920    0.79221 0.132 0.016 0.852 0.000 0.000
#> SRR2015733     2  0.1952    0.79971 0.004 0.912 0.084 0.000 0.000
#> SRR2015734     3  0.2046    0.79480 0.068 0.016 0.916 0.000 0.000
#> SRR2015731     4  0.3840    0.74683 0.000 0.076 0.116 0.808 0.000
#> SRR2015730     3  0.3039    0.76526 0.192 0.000 0.808 0.000 0.000
#> SRR2015728     3  0.1399    0.75002 0.028 0.000 0.952 0.000 0.020
#> SRR2015729     5  0.0854    0.83061 0.008 0.012 0.004 0.000 0.976
#> SRR2015727     4  0.2625    0.79137 0.000 0.016 0.108 0.876 0.000
#> SRR2015726     3  0.3010    0.78241 0.172 0.000 0.824 0.000 0.004
#> SRR2015723     3  0.3123    0.70144 0.000 0.012 0.828 0.000 0.160
#> SRR2015724     3  0.3551    0.60556 0.000 0.220 0.772 0.000 0.008
#> SRR2015725     3  0.2806    0.78551 0.152 0.004 0.844 0.000 0.000
#> SRR2015722     4  0.0609    0.84498 0.000 0.020 0.000 0.980 0.000
#> SRR2015721     3  0.4510   -0.00344 0.000 0.432 0.560 0.000 0.008
#> SRR2015720     2  0.2513    0.79263 0.008 0.876 0.116 0.000 0.000
#> SRR2015718     3  0.2740    0.73014 0.004 0.044 0.888 0.000 0.064
#> SRR2015719     4  0.0000    0.84944 0.000 0.000 0.000 1.000 0.000
#> SRR2015717     3  0.2438    0.79336 0.060 0.040 0.900 0.000 0.000
#> SRR2015716     3  0.2464    0.79355 0.096 0.000 0.888 0.000 0.016
#> SRR2015714     4  0.0000    0.84944 0.000 0.000 0.000 1.000 0.000
#> SRR2015713     2  0.2411    0.79660 0.000 0.884 0.108 0.000 0.008
#> SRR2015784     5  0.3646    0.76370 0.036 0.144 0.000 0.004 0.816
#> SRR2015785     5  0.1710    0.82686 0.012 0.024 0.000 0.020 0.944
#> SRR2015783     3  0.4227    0.42854 0.420 0.000 0.580 0.000 0.000
#> SRR2015782     1  0.4901    0.54469 0.712 0.104 0.000 0.000 0.184
#> SRR2015781     4  0.3966    0.70072 0.040 0.168 0.000 0.788 0.004
#> SRR2015780     1  0.6132    0.24538 0.552 0.088 0.000 0.020 0.340
#> SRR2015779     5  0.4956    0.58257 0.028 0.292 0.000 0.016 0.664
#> SRR2015778     1  0.2124    0.79311 0.916 0.056 0.028 0.000 0.000
#> SRR2015777     1  0.2763    0.73085 0.848 0.148 0.004 0.000 0.000
#> SRR2015776     4  0.0162    0.84817 0.000 0.000 0.000 0.996 0.004
#> SRR2015775     5  0.0771    0.83173 0.000 0.020 0.004 0.000 0.976
#> SRR2015774     2  0.4020    0.74530 0.000 0.788 0.172 0.020 0.020
#> SRR2015773     2  0.2850    0.77222 0.000 0.872 0.036 0.000 0.092
#> SRR2015772     2  0.2927    0.79516 0.000 0.872 0.068 0.000 0.060
#> SRR2015771     3  0.2221    0.78995 0.052 0.036 0.912 0.000 0.000
#> SRR2015769     5  0.0898    0.83369 0.008 0.020 0.000 0.000 0.972
#> SRR2015770     2  0.3274    0.61196 0.000 0.780 0.000 0.000 0.220
#> SRR2015768     5  0.1197    0.82896 0.000 0.048 0.000 0.000 0.952
#> SRR2015767     4  0.0000    0.84944 0.000 0.000 0.000 1.000 0.000
#> SRR2015766     4  0.5684    0.45507 0.000 0.096 0.340 0.564 0.000
#> SRR2015764     2  0.0771    0.77949 0.004 0.976 0.000 0.000 0.020
#> SRR2015765     5  0.7923    0.07049 0.000 0.232 0.080 0.340 0.348
#> SRR2015763     3  0.2654    0.77256 0.032 0.084 0.884 0.000 0.000
#> SRR2015762     2  0.1124    0.76814 0.004 0.960 0.000 0.036 0.000
#> SRR2015761     2  0.3216    0.77795 0.000 0.848 0.108 0.044 0.000
#> SRR2015760     3  0.2727    0.75127 0.016 0.116 0.868 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
#> SRR2015715     1  0.3894     0.4311 0.784 0.120 0.088 0.000 0.008 0.000
#> SRR2015735     1  0.1176     0.6969 0.956 0.000 0.024 0.000 0.020 0.000
#> SRR2015759     1  0.2302     0.6963 0.872 0.000 0.008 0.000 0.120 0.000
#> SRR2015753     5  0.4660     0.2016 0.416 0.000 0.044 0.000 0.540 0.000
#> SRR2015746     5  0.1908     0.7788 0.096 0.000 0.004 0.000 0.900 0.000
#> SRR2015758     2  0.3447     0.6687 0.000 0.800 0.164 0.000 0.024 0.012
#> SRR2015756     1  0.3867     0.4961 0.660 0.000 0.012 0.000 0.328 0.000
#> SRR2015757     2  0.2094     0.7503 0.020 0.900 0.080 0.000 0.000 0.000
#> SRR2015755     5  0.3364     0.6944 0.196 0.000 0.024 0.000 0.780 0.000
#> SRR2015754     1  0.3612     0.6301 0.764 0.000 0.036 0.000 0.200 0.000
#> SRR2015752     1  0.1524     0.7094 0.932 0.000 0.008 0.000 0.060 0.000
#> SRR2015749     1  0.4322     0.4150 0.600 0.000 0.028 0.000 0.372 0.000
#> SRR2015750     6  0.5745     0.4880 0.000 0.276 0.084 0.000 0.052 0.588
#> SRR2015751     5  0.2118     0.7955 0.048 0.004 0.020 0.000 0.916 0.012
#> SRR2015748     5  0.3722     0.7364 0.000 0.000 0.068 0.032 0.816 0.084
#> SRR2015747     1  0.4176     0.3332 0.580 0.000 0.016 0.000 0.404 0.000
#> SRR2015745     5  0.1952     0.7615 0.000 0.016 0.012 0.000 0.920 0.052
#> SRR2015743     1  0.2006     0.7085 0.904 0.000 0.016 0.000 0.080 0.000
#> SRR2015744     5  0.3084     0.7578 0.132 0.000 0.032 0.004 0.832 0.000
#> SRR2015742     5  0.4461     0.7289 0.072 0.060 0.104 0.000 0.764 0.000
#> SRR2015741     1  0.2821     0.6794 0.832 0.000 0.016 0.000 0.152 0.000
#> SRR2015740     1  0.1779     0.7093 0.920 0.000 0.016 0.000 0.064 0.000
#> SRR2015738     1  0.4284     0.5564 0.688 0.000 0.056 0.000 0.256 0.000
#> SRR2015739     1  0.4057     0.3697 0.600 0.000 0.012 0.000 0.388 0.000
#> SRR2015737     2  0.5567     0.3402 0.000 0.584 0.128 0.000 0.016 0.272
#> SRR2015736     2  0.3871     0.5572 0.148 0.768 0.084 0.000 0.000 0.000
#> SRR2015732     1  0.1452     0.6982 0.948 0.008 0.032 0.000 0.008 0.004
#> SRR2015733     2  0.2433     0.7430 0.004 0.888 0.084 0.000 0.020 0.004
#> SRR2015734     1  0.3072     0.5492 0.840 0.076 0.084 0.000 0.000 0.000
#> SRR2015731     4  0.4154     0.6878 0.020 0.100 0.064 0.796 0.020 0.000
#> SRR2015730     1  0.0291     0.6982 0.992 0.000 0.004 0.000 0.004 0.000
#> SRR2015728     3  0.4234     0.6650 0.408 0.012 0.576 0.000 0.004 0.000
#> SRR2015729     6  0.1408     0.7350 0.000 0.000 0.020 0.000 0.036 0.944
#> SRR2015727     4  0.2919     0.7096 0.056 0.008 0.040 0.876 0.020 0.000
#> SRR2015726     1  0.3690     0.5813 0.824 0.004 0.056 0.000 0.032 0.084
#> SRR2015723     1  0.3904     0.3282 0.732 0.000 0.032 0.000 0.004 0.232
#> SRR2015724     2  0.5502    -0.2354 0.404 0.480 0.112 0.000 0.004 0.000
#> SRR2015725     1  0.0865     0.6826 0.964 0.000 0.036 0.000 0.000 0.000
#> SRR2015722     4  0.1564     0.7501 0.000 0.000 0.040 0.936 0.024 0.000
#> SRR2015721     2  0.5608    -0.1803 0.144 0.444 0.412 0.000 0.000 0.000
#> SRR2015720     2  0.1297     0.7492 0.012 0.948 0.040 0.000 0.000 0.000
#> SRR2015718     3  0.6537     0.6976 0.280 0.132 0.520 0.000 0.008 0.060
#> SRR2015719     4  0.0260     0.7598 0.000 0.000 0.008 0.992 0.000 0.000
#> SRR2015717     1  0.2201     0.6444 0.912 0.024 0.048 0.004 0.012 0.000
#> SRR2015716     1  0.1116     0.6860 0.960 0.000 0.028 0.000 0.004 0.008
#> SRR2015714     4  0.0000     0.7601 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR2015713     2  0.1225     0.7463 0.012 0.952 0.036 0.000 0.000 0.000
#> SRR2015784     6  0.7255     0.5219 0.000 0.188 0.216 0.024 0.088 0.484
#> SRR2015785     6  0.1410     0.7396 0.000 0.000 0.008 0.004 0.044 0.944
#> SRR2015783     1  0.2389     0.6925 0.864 0.000 0.008 0.000 0.128 0.000
#> SRR2015782     5  0.4020     0.6535 0.000 0.016 0.048 0.000 0.764 0.172
#> SRR2015781     4  0.6884     0.2218 0.000 0.284 0.188 0.448 0.080 0.000
#> SRR2015780     5  0.4535     0.5890 0.000 0.004 0.032 0.032 0.716 0.216
#> SRR2015779     6  0.7065     0.4380 0.000 0.256 0.180 0.044 0.036 0.484
#> SRR2015778     5  0.1262     0.7901 0.020 0.000 0.008 0.000 0.956 0.016
#> SRR2015777     5  0.2790     0.7757 0.028 0.080 0.020 0.000 0.872 0.000
#> SRR2015776     4  0.1327     0.7438 0.000 0.000 0.064 0.936 0.000 0.000
#> SRR2015775     6  0.1668     0.7231 0.008 0.000 0.060 0.000 0.004 0.928
#> SRR2015774     2  0.3059     0.6973 0.052 0.860 0.072 0.012 0.000 0.004
#> SRR2015773     2  0.2577     0.7306 0.000 0.892 0.052 0.008 0.008 0.040
#> SRR2015772     2  0.1508     0.7518 0.004 0.948 0.020 0.012 0.000 0.016
#> SRR2015771     1  0.2134     0.6267 0.904 0.044 0.052 0.000 0.000 0.000
#> SRR2015769     6  0.1418     0.7343 0.000 0.000 0.024 0.000 0.032 0.944
#> SRR2015770     2  0.5043     0.5041 0.000 0.680 0.120 0.000 0.020 0.180
#> SRR2015768     6  0.2854     0.7188 0.000 0.048 0.088 0.000 0.004 0.860
#> SRR2015767     4  0.0146     0.7599 0.000 0.000 0.004 0.996 0.000 0.000
#> SRR2015766     4  0.5747     0.4319 0.136 0.152 0.060 0.648 0.004 0.000
#> SRR2015764     2  0.2491     0.7174 0.000 0.868 0.112 0.000 0.020 0.000
#> SRR2015765     4  0.7113     0.0396 0.012 0.292 0.032 0.356 0.004 0.304
#> SRR2015763     1  0.3235     0.5098 0.820 0.128 0.052 0.000 0.000 0.000
#> SRR2015762     2  0.3032     0.7147 0.000 0.852 0.096 0.040 0.012 0.000
#> SRR2015761     2  0.2644     0.7242 0.008 0.880 0.060 0.052 0.000 0.000
#> SRR2015760     1  0.3112     0.5539 0.840 0.104 0.052 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-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

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 17223 rows and 73 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 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-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.354           0.656       0.847         0.4650 0.494   0.494
#> 3 3 0.295           0.491       0.739         0.1906 0.831   0.687
#> 4 4 0.390           0.422       0.653         0.1677 0.767   0.601
#> 5 5 0.489           0.498       0.695         0.0453 0.765   0.562
#> 6 6 0.525           0.539       0.684         0.0518 0.811   0.490

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
#> SRR2015715     1  0.9170     0.5872 0.668 0.332
#> SRR2015735     1  0.8386     0.6328 0.732 0.268
#> SRR2015759     1  0.0000     0.7764 1.000 0.000
#> SRR2015753     1  0.2778     0.7528 0.952 0.048
#> SRR2015746     1  0.9795     0.4023 0.584 0.416
#> SRR2015758     2  0.1843     0.8240 0.028 0.972
#> SRR2015756     1  0.0000     0.7764 1.000 0.000
#> SRR2015757     1  0.3879     0.7599 0.924 0.076
#> SRR2015755     1  0.0000     0.7764 1.000 0.000
#> SRR2015754     1  0.0000     0.7764 1.000 0.000
#> SRR2015752     1  0.0000     0.7764 1.000 0.000
#> SRR2015749     1  0.0000     0.7764 1.000 0.000
#> SRR2015750     2  0.7745     0.6441 0.228 0.772
#> SRR2015751     1  0.8909     0.6157 0.692 0.308
#> SRR2015748     2  0.0376     0.8164 0.004 0.996
#> SRR2015747     1  0.0000     0.7764 1.000 0.000
#> SRR2015745     1  0.9850     0.3730 0.572 0.428
#> SRR2015743     1  0.0000     0.7764 1.000 0.000
#> SRR2015744     2  0.9850     0.1814 0.428 0.572
#> SRR2015742     1  0.8909     0.6157 0.692 0.308
#> SRR2015741     1  0.0000     0.7764 1.000 0.000
#> SRR2015740     1  0.0000     0.7764 1.000 0.000
#> SRR2015738     1  0.0000     0.7764 1.000 0.000
#> SRR2015739     1  0.0000     0.7764 1.000 0.000
#> SRR2015737     2  0.1633     0.8239 0.024 0.976
#> SRR2015736     1  0.9044     0.6064 0.680 0.320
#> SRR2015732     1  1.0000     0.0661 0.504 0.496
#> SRR2015733     1  0.4431     0.7543 0.908 0.092
#> SRR2015734     1  0.0000     0.7764 1.000 0.000
#> SRR2015731     2  0.9944     0.0431 0.456 0.544
#> SRR2015730     1  0.0000     0.7764 1.000 0.000
#> SRR2015728     1  0.0000     0.7764 1.000 0.000
#> SRR2015729     2  0.1633     0.8159 0.024 0.976
#> SRR2015727     2  0.9933     0.0612 0.452 0.548
#> SRR2015726     2  0.9795     0.2576 0.416 0.584
#> SRR2015723     2  0.6531     0.7156 0.168 0.832
#> SRR2015724     1  0.9460     0.5291 0.636 0.364
#> SRR2015725     1  0.0000     0.7764 1.000 0.000
#> SRR2015722     2  0.9933     0.0612 0.452 0.548
#> SRR2015721     1  0.8608     0.6392 0.716 0.284
#> SRR2015720     1  0.8955     0.6150 0.688 0.312
#> SRR2015718     2  0.6973     0.6922 0.188 0.812
#> SRR2015719     2  0.0000     0.8145 0.000 1.000
#> SRR2015717     1  0.8386     0.6328 0.732 0.268
#> SRR2015716     2  0.6531     0.7156 0.168 0.832
#> SRR2015714     2  0.0000     0.8145 0.000 1.000
#> SRR2015713     1  0.8955     0.6150 0.688 0.312
#> SRR2015784     2  0.1633     0.8239 0.024 0.976
#> SRR2015785     2  0.0376     0.8164 0.004 0.996
#> SRR2015783     1  0.0000     0.7764 1.000 0.000
#> SRR2015782     2  0.5519     0.7574 0.128 0.872
#> SRR2015781     2  0.2603     0.8179 0.044 0.956
#> SRR2015780     2  0.0938     0.8199 0.012 0.988
#> SRR2015779     2  0.1843     0.8240 0.028 0.972
#> SRR2015778     1  0.8909     0.6157 0.692 0.308
#> SRR2015777     1  0.9460     0.5249 0.636 0.364
#> SRR2015776     2  0.0000     0.8145 0.000 1.000
#> SRR2015775     2  0.1633     0.8159 0.024 0.976
#> SRR2015774     2  0.9460     0.3592 0.364 0.636
#> SRR2015773     2  0.1843     0.8240 0.028 0.972
#> SRR2015772     2  0.1843     0.8240 0.028 0.972
#> SRR2015771     1  0.9170     0.5872 0.668 0.332
#> SRR2015769     2  0.1633     0.8159 0.024 0.976
#> SRR2015770     2  0.1633     0.8239 0.024 0.976
#> SRR2015768     2  0.1633     0.8239 0.024 0.976
#> SRR2015767     2  0.0000     0.8145 0.000 1.000
#> SRR2015766     2  0.9881     0.1043 0.436 0.564
#> SRR2015764     2  0.1843     0.8240 0.028 0.972
#> SRR2015765     2  0.4939     0.7701 0.108 0.892
#> SRR2015763     1  0.9170     0.5872 0.668 0.332
#> SRR2015762     2  0.2236     0.8199 0.036 0.964
#> SRR2015761     2  0.9754     0.2080 0.408 0.592
#> SRR2015760     1  0.9815     0.3971 0.580 0.420

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>            class entropy silhouette    p1    p2    p3
#> SRR2015715     1  0.7927   0.616626 0.664 0.160 0.176
#> SRR2015735     1  0.6586   0.620270 0.728 0.216 0.056
#> SRR2015759     1  0.0000   0.729918 1.000 0.000 0.000
#> SRR2015753     1  0.1753   0.693800 0.952 0.000 0.048
#> SRR2015746     1  0.8841   0.481585 0.580 0.216 0.204
#> SRR2015758     2  0.6777   0.536878 0.020 0.616 0.364
#> SRR2015756     1  0.0000   0.729918 1.000 0.000 0.000
#> SRR2015757     1  0.2774   0.713829 0.920 0.008 0.072
#> SRR2015755     1  0.0000   0.729918 1.000 0.000 0.000
#> SRR2015754     1  0.0000   0.729918 1.000 0.000 0.000
#> SRR2015752     1  0.0000   0.729918 1.000 0.000 0.000
#> SRR2015749     1  0.0000   0.729918 1.000 0.000 0.000
#> SRR2015750     3  0.4963   0.504184 0.200 0.008 0.792
#> SRR2015751     1  0.7615   0.631331 0.688 0.148 0.164
#> SRR2015748     2  0.5465   0.341072 0.000 0.712 0.288
#> SRR2015747     1  0.0000   0.729918 1.000 0.000 0.000
#> SRR2015745     1  0.8950   0.460683 0.568 0.216 0.216
#> SRR2015743     1  0.0000   0.729918 1.000 0.000 0.000
#> SRR2015744     1  0.9678  -0.020374 0.420 0.364 0.216
#> SRR2015742     1  0.7615   0.631331 0.688 0.148 0.164
#> SRR2015741     1  0.0000   0.729918 1.000 0.000 0.000
#> SRR2015740     1  0.0000   0.729918 1.000 0.000 0.000
#> SRR2015738     1  0.0000   0.729918 1.000 0.000 0.000
#> SRR2015739     1  0.0000   0.729918 1.000 0.000 0.000
#> SRR2015737     2  0.6667   0.534363 0.016 0.616 0.368
#> SRR2015736     1  0.7775   0.625528 0.676 0.168 0.156
#> SRR2015732     3  0.6521  -0.073290 0.496 0.004 0.500
#> SRR2015733     1  0.3272   0.709264 0.904 0.016 0.080
#> SRR2015734     1  0.0000   0.729918 1.000 0.000 0.000
#> SRR2015731     2  0.8208  -0.082546 0.452 0.476 0.072
#> SRR2015730     1  0.0000   0.729918 1.000 0.000 0.000
#> SRR2015728     1  0.0000   0.729918 1.000 0.000 0.000
#> SRR2015729     3  0.0000   0.532431 0.000 0.000 1.000
#> SRR2015727     2  0.8206  -0.065643 0.448 0.480 0.072
#> SRR2015726     3  0.6314   0.267815 0.392 0.004 0.604
#> SRR2015723     2  0.9234   0.271909 0.160 0.476 0.364
#> SRR2015724     1  0.8309   0.575228 0.632 0.188 0.180
#> SRR2015725     1  0.0000   0.729918 1.000 0.000 0.000
#> SRR2015722     2  0.8206  -0.065643 0.448 0.480 0.072
#> SRR2015721     1  0.7179   0.644183 0.712 0.184 0.104
#> SRR2015720     1  0.7672   0.634065 0.684 0.156 0.160
#> SRR2015718     2  0.9417   0.251951 0.180 0.456 0.364
#> SRR2015719     2  0.0237   0.403387 0.000 0.996 0.004
#> SRR2015717     1  0.6586   0.620270 0.728 0.216 0.056
#> SRR2015716     2  0.9234   0.271909 0.160 0.476 0.364
#> SRR2015714     2  0.0237   0.403387 0.000 0.996 0.004
#> SRR2015713     1  0.7672   0.634065 0.684 0.156 0.160
#> SRR2015784     2  0.6686   0.531693 0.016 0.612 0.372
#> SRR2015785     3  0.6225  -0.235587 0.000 0.432 0.568
#> SRR2015783     1  0.0000   0.729918 1.000 0.000 0.000
#> SRR2015782     3  0.3539   0.519542 0.100 0.012 0.888
#> SRR2015781     2  0.7190   0.529844 0.036 0.608 0.356
#> SRR2015780     3  0.6468  -0.261130 0.004 0.444 0.552
#> SRR2015779     2  0.6777   0.536878 0.020 0.616 0.364
#> SRR2015778     1  0.7615   0.631331 0.688 0.148 0.164
#> SRR2015777     1  0.8307   0.573176 0.632 0.176 0.192
#> SRR2015776     2  0.0237   0.403387 0.000 0.996 0.004
#> SRR2015775     3  0.0000   0.532431 0.000 0.000 1.000
#> SRR2015774     2  0.9930   0.142762 0.356 0.368 0.276
#> SRR2015773     2  0.6777   0.536878 0.020 0.616 0.364
#> SRR2015772     2  0.6777   0.536878 0.020 0.616 0.364
#> SRR2015771     1  0.7927   0.616626 0.664 0.160 0.176
#> SRR2015769     3  0.0000   0.532431 0.000 0.000 1.000
#> SRR2015770     2  0.6667   0.534363 0.016 0.616 0.368
#> SRR2015768     2  0.6667   0.534363 0.016 0.616 0.368
#> SRR2015767     2  0.0237   0.403387 0.000 0.996 0.004
#> SRR2015766     1  0.9579   0.117168 0.432 0.368 0.200
#> SRR2015764     2  0.6777   0.536878 0.020 0.616 0.364
#> SRR2015765     2  0.8487   0.294393 0.100 0.536 0.364
#> SRR2015763     1  0.7927   0.616626 0.664 0.160 0.176
#> SRR2015762     2  0.6855   0.526757 0.032 0.652 0.316
#> SRR2015761     1  0.9865  -0.000858 0.404 0.332 0.264
#> SRR2015760     1  0.8722   0.470168 0.576 0.272 0.152

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> SRR2015715     3  0.1174     0.5413 0.012 0.020 0.968 0.000
#> SRR2015735     3  0.5339     0.5382 0.356 0.020 0.624 0.000
#> SRR2015759     3  0.4925     0.6123 0.428 0.000 0.572 0.000
#> SRR2015753     3  0.5548     0.5917 0.448 0.004 0.536 0.012
#> SRR2015746     3  0.5369     0.4763 0.112 0.144 0.744 0.000
#> SRR2015758     2  0.2814     0.6941 0.000 0.868 0.132 0.000
#> SRR2015756     3  0.4941     0.6114 0.436 0.000 0.564 0.000
#> SRR2015757     3  0.4621     0.6140 0.284 0.008 0.708 0.000
#> SRR2015755     3  0.4916     0.6135 0.424 0.000 0.576 0.000
#> SRR2015754     3  0.4916     0.6142 0.424 0.000 0.576 0.000
#> SRR2015752     3  0.4925     0.6123 0.428 0.000 0.572 0.000
#> SRR2015749     3  0.4925     0.6135 0.428 0.000 0.572 0.000
#> SRR2015750     4  0.8951     0.4488 0.112 0.164 0.248 0.476
#> SRR2015751     3  0.4440     0.5608 0.136 0.060 0.804 0.000
#> SRR2015748     1  0.9525     0.0000 0.392 0.172 0.164 0.272
#> SRR2015747     3  0.4916     0.6135 0.424 0.000 0.576 0.000
#> SRR2015745     3  0.5396     0.4649 0.104 0.156 0.740 0.000
#> SRR2015743     3  0.4933     0.6125 0.432 0.000 0.568 0.000
#> SRR2015744     3  0.6616     0.2140 0.108 0.308 0.584 0.000
#> SRR2015742     3  0.4440     0.5608 0.136 0.060 0.804 0.000
#> SRR2015741     3  0.4916     0.6135 0.424 0.000 0.576 0.000
#> SRR2015740     3  0.4925     0.6123 0.428 0.000 0.572 0.000
#> SRR2015738     3  0.4916     0.6142 0.424 0.000 0.576 0.000
#> SRR2015739     3  0.4941     0.6114 0.436 0.000 0.564 0.000
#> SRR2015737     2  0.2760     0.6935 0.000 0.872 0.128 0.000
#> SRR2015736     3  0.1510     0.5513 0.028 0.016 0.956 0.000
#> SRR2015732     3  0.8025     0.0823 0.144 0.040 0.512 0.304
#> SRR2015733     3  0.5038     0.6107 0.296 0.020 0.684 0.000
#> SRR2015734     3  0.4925     0.6123 0.428 0.000 0.572 0.000
#> SRR2015731     3  0.6412     0.1426 0.348 0.080 0.572 0.000
#> SRR2015730     3  0.4925     0.6123 0.428 0.000 0.572 0.000
#> SRR2015728     3  0.4866     0.6127 0.404 0.000 0.596 0.000
#> SRR2015729     4  0.3907     0.6688 0.000 0.232 0.000 0.768
#> SRR2015727     3  0.6426     0.1305 0.352 0.080 0.568 0.000
#> SRR2015726     3  0.8188    -0.2669 0.140 0.040 0.412 0.408
#> SRR2015723     3  0.9534    -0.4871 0.232 0.172 0.408 0.188
#> SRR2015724     3  0.2123     0.5177 0.028 0.032 0.936 0.004
#> SRR2015725     3  0.4925     0.6123 0.428 0.000 0.572 0.000
#> SRR2015722     3  0.6426     0.1305 0.352 0.080 0.568 0.000
#> SRR2015721     3  0.4323     0.5681 0.184 0.028 0.788 0.000
#> SRR2015720     3  0.1059     0.5534 0.012 0.016 0.972 0.000
#> SRR2015718     3  0.9385    -0.4466 0.228 0.156 0.432 0.184
#> SRR2015719     2  0.6818     0.2383 0.168 0.600 0.000 0.232
#> SRR2015717     3  0.5339     0.5382 0.356 0.020 0.624 0.000
#> SRR2015716     3  0.9534    -0.4871 0.232 0.172 0.408 0.188
#> SRR2015714     2  0.7263     0.1964 0.208 0.564 0.004 0.224
#> SRR2015713     3  0.0927     0.5540 0.008 0.016 0.976 0.000
#> SRR2015784     2  0.2944     0.6910 0.000 0.868 0.128 0.004
#> SRR2015785     2  0.9478    -0.4717 0.200 0.340 0.124 0.336
#> SRR2015783     3  0.4925     0.6123 0.428 0.000 0.572 0.000
#> SRR2015782     4  0.8614     0.5286 0.060 0.256 0.204 0.480
#> SRR2015781     2  0.3257     0.6728 0.004 0.844 0.152 0.000
#> SRR2015780     2  0.9712    -0.4322 0.204 0.344 0.164 0.288
#> SRR2015779     2  0.2814     0.6941 0.000 0.868 0.132 0.000
#> SRR2015778     3  0.4440     0.5608 0.136 0.060 0.804 0.000
#> SRR2015777     3  0.4780     0.5270 0.116 0.096 0.788 0.000
#> SRR2015776     2  0.6780     0.2416 0.164 0.604 0.000 0.232
#> SRR2015775     4  0.3907     0.6688 0.000 0.232 0.000 0.768
#> SRR2015774     3  0.6092     0.0890 0.056 0.320 0.620 0.004
#> SRR2015773     2  0.2814     0.6941 0.000 0.868 0.132 0.000
#> SRR2015772     2  0.2814     0.6941 0.000 0.868 0.132 0.000
#> SRR2015771     3  0.1174     0.5413 0.012 0.020 0.968 0.000
#> SRR2015769     4  0.3907     0.6688 0.000 0.232 0.000 0.768
#> SRR2015770     2  0.2760     0.6935 0.000 0.872 0.128 0.000
#> SRR2015768     2  0.2760     0.6935 0.000 0.872 0.128 0.000
#> SRR2015767     2  0.6780     0.2416 0.164 0.604 0.000 0.232
#> SRR2015766     3  0.5886     0.2656 0.160 0.124 0.712 0.004
#> SRR2015764     2  0.2814     0.6941 0.000 0.868 0.132 0.000
#> SRR2015765     3  0.9693    -0.5881 0.292 0.172 0.348 0.188
#> SRR2015763     3  0.1174     0.5413 0.012 0.020 0.968 0.000
#> SRR2015762     2  0.4856     0.6237 0.084 0.780 0.136 0.000
#> SRR2015761     3  0.6219     0.2142 0.104 0.224 0.668 0.004
#> SRR2015760     3  0.4238     0.4624 0.176 0.028 0.796 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
#> SRR2015715     1  0.5993     0.2443 0.524 0.092 0.376 0.008 0.000
#> SRR2015735     1  0.4965     0.3884 0.676 0.024 0.276 0.024 0.000
#> SRR2015759     1  0.0000     0.6587 1.000 0.000 0.000 0.000 0.000
#> SRR2015753     1  0.2095     0.6095 0.920 0.000 0.012 0.008 0.060
#> SRR2015746     1  0.6799     0.1468 0.464 0.232 0.296 0.008 0.000
#> SRR2015758     2  0.0000     0.8587 0.000 1.000 0.000 0.000 0.000
#> SRR2015756     1  0.0566     0.6528 0.984 0.000 0.012 0.004 0.000
#> SRR2015757     1  0.3870     0.5921 0.820 0.092 0.080 0.008 0.000
#> SRR2015755     1  0.0162     0.6594 0.996 0.000 0.004 0.000 0.000
#> SRR2015754     1  0.0898     0.6574 0.972 0.000 0.020 0.008 0.000
#> SRR2015752     1  0.0000     0.6587 1.000 0.000 0.000 0.000 0.000
#> SRR2015749     1  0.0798     0.6579 0.976 0.000 0.016 0.008 0.000
#> SRR2015750     5  0.8414     0.4435 0.152 0.208 0.204 0.012 0.424
#> SRR2015751     1  0.6167     0.3554 0.572 0.144 0.276 0.008 0.000
#> SRR2015748     3  0.6899    -0.2927 0.000 0.008 0.440 0.280 0.272
#> SRR2015747     1  0.0162     0.6594 0.996 0.000 0.004 0.000 0.000
#> SRR2015745     1  0.6852     0.1183 0.452 0.248 0.292 0.008 0.000
#> SRR2015743     1  0.0162     0.6582 0.996 0.000 0.004 0.000 0.000
#> SRR2015744     2  0.6994    -0.3652 0.304 0.400 0.288 0.008 0.000
#> SRR2015742     1  0.6167     0.3554 0.572 0.144 0.276 0.008 0.000
#> SRR2015741     1  0.0162     0.6594 0.996 0.000 0.004 0.000 0.000
#> SRR2015740     1  0.0000     0.6587 1.000 0.000 0.000 0.000 0.000
#> SRR2015738     1  0.0898     0.6574 0.972 0.000 0.020 0.008 0.000
#> SRR2015739     1  0.0566     0.6528 0.984 0.000 0.012 0.004 0.000
#> SRR2015737     2  0.0162     0.8565 0.000 0.996 0.004 0.000 0.000
#> SRR2015736     1  0.5834     0.2804 0.548 0.092 0.356 0.004 0.000
#> SRR2015732     1  0.8357    -0.0953 0.372 0.084 0.272 0.016 0.256
#> SRR2015733     1  0.4197     0.5782 0.796 0.100 0.096 0.008 0.000
#> SRR2015734     1  0.0000     0.6587 1.000 0.000 0.000 0.000 0.000
#> SRR2015731     3  0.5813     0.3672 0.344 0.016 0.572 0.068 0.000
#> SRR2015730     1  0.0000     0.6587 1.000 0.000 0.000 0.000 0.000
#> SRR2015728     1  0.6237     0.2751 0.648 0.000 0.060 0.112 0.180
#> SRR2015729     5  0.5817     0.5878 0.000 0.204 0.184 0.000 0.612
#> SRR2015727     3  0.5800     0.3746 0.340 0.016 0.576 0.068 0.000
#> SRR2015726     5  0.8389     0.0750 0.268 0.084 0.276 0.016 0.356
#> SRR2015723     3  0.3718     0.4059 0.060 0.040 0.856 0.020 0.024
#> SRR2015724     1  0.5935     0.1647 0.496 0.092 0.408 0.004 0.000
#> SRR2015725     1  0.0000     0.6587 1.000 0.000 0.000 0.000 0.000
#> SRR2015722     3  0.5800     0.3746 0.340 0.016 0.576 0.068 0.000
#> SRR2015721     1  0.5152     0.3780 0.632 0.052 0.312 0.004 0.000
#> SRR2015720     1  0.5946     0.2862 0.544 0.092 0.356 0.008 0.000
#> SRR2015718     3  0.3951     0.4268 0.080 0.036 0.840 0.020 0.024
#> SRR2015719     4  0.4047     0.9712 0.000 0.320 0.004 0.676 0.000
#> SRR2015717     1  0.4965     0.3884 0.676 0.024 0.276 0.024 0.000
#> SRR2015716     3  0.3718     0.4059 0.060 0.040 0.856 0.020 0.024
#> SRR2015714     4  0.4442     0.9242 0.000 0.284 0.028 0.688 0.000
#> SRR2015713     1  0.5935     0.2897 0.548 0.092 0.352 0.008 0.000
#> SRR2015784     2  0.0290     0.8533 0.000 0.992 0.008 0.000 0.000
#> SRR2015785     5  0.8423     0.3002 0.000 0.208 0.188 0.252 0.352
#> SRR2015783     1  0.0000     0.6587 1.000 0.000 0.000 0.000 0.000
#> SRR2015782     5  0.7828     0.4732 0.056 0.308 0.196 0.012 0.428
#> SRR2015781     2  0.0703     0.8295 0.000 0.976 0.024 0.000 0.000
#> SRR2015780     5  0.8551     0.3078 0.000 0.248 0.200 0.252 0.300
#> SRR2015779     2  0.0000     0.8587 0.000 1.000 0.000 0.000 0.000
#> SRR2015778     1  0.6167     0.3554 0.572 0.144 0.276 0.008 0.000
#> SRR2015777     1  0.6518     0.2611 0.516 0.180 0.296 0.008 0.000
#> SRR2015776     4  0.4066     0.9716 0.000 0.324 0.004 0.672 0.000
#> SRR2015775     5  0.5817     0.5878 0.000 0.204 0.184 0.000 0.612
#> SRR2015774     3  0.6771     0.3321 0.220 0.380 0.396 0.004 0.000
#> SRR2015773     2  0.0000     0.8587 0.000 1.000 0.000 0.000 0.000
#> SRR2015772     2  0.0000     0.8587 0.000 1.000 0.000 0.000 0.000
#> SRR2015771     1  0.5993     0.2443 0.524 0.092 0.376 0.008 0.000
#> SRR2015769     5  0.5817     0.5878 0.000 0.204 0.184 0.000 0.612
#> SRR2015770     2  0.0162     0.8565 0.000 0.996 0.004 0.000 0.000
#> SRR2015768     2  0.0162     0.8565 0.000 0.996 0.004 0.000 0.000
#> SRR2015767     4  0.4066     0.9716 0.000 0.324 0.004 0.672 0.000
#> SRR2015766     3  0.7155     0.3221 0.280 0.172 0.500 0.048 0.000
#> SRR2015764     2  0.0000     0.8587 0.000 1.000 0.000 0.000 0.000
#> SRR2015765     3  0.2342     0.3148 0.000 0.040 0.916 0.020 0.024
#> SRR2015763     1  0.5993     0.2443 0.524 0.092 0.376 0.008 0.000
#> SRR2015762     2  0.3267     0.6518 0.000 0.844 0.044 0.112 0.000
#> SRR2015761     3  0.7568     0.3135 0.264 0.276 0.412 0.048 0.000
#> SRR2015760     3  0.6193    -0.0447 0.452 0.072 0.452 0.024 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
#> SRR2015715     3  0.4868     0.4686 0.396 0.052 0.548 0.000 0.000 0.004
#> SRR2015735     1  0.4595     0.2237 0.608 0.012 0.352 0.000 0.028 0.000
#> SRR2015759     1  0.0790     0.7461 0.968 0.000 0.032 0.000 0.000 0.000
#> SRR2015753     1  0.1918     0.6572 0.904 0.000 0.008 0.000 0.088 0.000
#> SRR2015746     3  0.6214     0.4035 0.344 0.204 0.440 0.000 0.004 0.008
#> SRR2015758     2  0.0260     0.9692 0.000 0.992 0.008 0.000 0.000 0.000
#> SRR2015756     1  0.0858     0.7210 0.968 0.000 0.004 0.000 0.028 0.000
#> SRR2015757     1  0.4729     0.3934 0.688 0.064 0.232 0.000 0.004 0.012
#> SRR2015755     1  0.1204     0.7386 0.944 0.000 0.056 0.000 0.000 0.000
#> SRR2015754     1  0.1949     0.7197 0.904 0.000 0.088 0.000 0.004 0.004
#> SRR2015752     1  0.0000     0.7415 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2015749     1  0.1493     0.7378 0.936 0.000 0.056 0.000 0.004 0.004
#> SRR2015750     6  0.7461     0.4686 0.072 0.140 0.188 0.004 0.076 0.520
#> SRR2015751     1  0.5773    -0.3091 0.444 0.116 0.428 0.000 0.004 0.008
#> SRR2015748     5  0.5660     0.4091 0.000 0.000 0.224 0.044 0.620 0.112
#> SRR2015747     1  0.0937     0.7448 0.960 0.000 0.040 0.000 0.000 0.000
#> SRR2015745     3  0.6261     0.4111 0.332 0.220 0.436 0.000 0.004 0.008
#> SRR2015743     1  0.0146     0.7410 0.996 0.000 0.004 0.000 0.000 0.000
#> SRR2015744     3  0.6298     0.3724 0.220 0.372 0.396 0.000 0.004 0.008
#> SRR2015742     1  0.5773    -0.3091 0.444 0.116 0.428 0.000 0.004 0.008
#> SRR2015741     1  0.1204     0.7386 0.944 0.000 0.056 0.000 0.000 0.000
#> SRR2015740     1  0.0000     0.7415 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2015738     1  0.1949     0.7197 0.904 0.000 0.088 0.000 0.004 0.004
#> SRR2015739     1  0.0858     0.7210 0.968 0.000 0.004 0.000 0.028 0.000
#> SRR2015737     2  0.0260     0.9670 0.000 0.992 0.008 0.000 0.000 0.000
#> SRR2015736     3  0.5140     0.4244 0.424 0.052 0.512 0.000 0.008 0.004
#> SRR2015732     6  0.8309     0.1828 0.272 0.056 0.256 0.004 0.108 0.304
#> SRR2015733     1  0.4924     0.3538 0.664 0.072 0.248 0.000 0.004 0.012
#> SRR2015734     1  0.0508     0.7449 0.984 0.000 0.012 0.000 0.000 0.004
#> SRR2015731     3  0.5330     0.4273 0.268 0.000 0.612 0.016 0.104 0.000
#> SRR2015730     1  0.0000     0.7415 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2015728     5  0.8912     0.0771 0.236 0.004 0.160 0.220 0.256 0.124
#> SRR2015729     6  0.2320     0.3496 0.000 0.132 0.004 0.000 0.000 0.864
#> SRR2015727     3  0.5311     0.4281 0.264 0.000 0.616 0.016 0.104 0.000
#> SRR2015726     6  0.8054     0.3703 0.176 0.056 0.252 0.004 0.108 0.404
#> SRR2015723     3  0.6185     0.1929 0.060 0.008 0.600 0.000 0.184 0.148
#> SRR2015724     3  0.4941     0.4941 0.368 0.052 0.572 0.000 0.004 0.004
#> SRR2015725     1  0.0405     0.7437 0.988 0.000 0.008 0.000 0.000 0.004
#> SRR2015722     3  0.5311     0.4281 0.264 0.000 0.616 0.016 0.104 0.000
#> SRR2015721     1  0.4920    -0.0410 0.556 0.028 0.396 0.000 0.016 0.004
#> SRR2015720     3  0.4900     0.4352 0.416 0.052 0.528 0.000 0.000 0.004
#> SRR2015718     3  0.6343     0.2264 0.072 0.012 0.596 0.000 0.172 0.148
#> SRR2015719     4  0.2996     0.9657 0.000 0.228 0.000 0.772 0.000 0.000
#> SRR2015717     1  0.4595     0.2237 0.608 0.012 0.352 0.000 0.028 0.000
#> SRR2015716     3  0.6185     0.1929 0.060 0.008 0.600 0.000 0.184 0.148
#> SRR2015714     4  0.4380     0.9061 0.000 0.216 0.056 0.716 0.012 0.000
#> SRR2015713     3  0.4905     0.4313 0.420 0.052 0.524 0.000 0.000 0.004
#> SRR2015784     2  0.0405     0.9639 0.000 0.988 0.008 0.000 0.000 0.004
#> SRR2015785     5  0.7433     0.4114 0.000 0.128 0.092 0.036 0.420 0.324
#> SRR2015783     1  0.0790     0.7461 0.968 0.000 0.032 0.000 0.000 0.000
#> SRR2015782     6  0.6667     0.4410 0.000 0.244 0.172 0.004 0.068 0.512
#> SRR2015781     2  0.0865     0.9330 0.000 0.964 0.036 0.000 0.000 0.000
#> SRR2015780     5  0.7705     0.3960 0.000 0.168 0.112 0.036 0.420 0.264
#> SRR2015779     2  0.0260     0.9692 0.000 0.992 0.008 0.000 0.000 0.000
#> SRR2015778     1  0.5773    -0.3091 0.444 0.116 0.428 0.000 0.004 0.008
#> SRR2015777     3  0.5995     0.3574 0.388 0.152 0.448 0.000 0.004 0.008
#> SRR2015776     4  0.3023     0.9667 0.000 0.232 0.000 0.768 0.000 0.000
#> SRR2015775     6  0.2320     0.3496 0.000 0.132 0.004 0.000 0.000 0.864
#> SRR2015774     3  0.5713     0.4154 0.152 0.348 0.496 0.000 0.004 0.000
#> SRR2015773     2  0.0260     0.9692 0.000 0.992 0.008 0.000 0.000 0.000
#> SRR2015772     2  0.0260     0.9692 0.000 0.992 0.008 0.000 0.000 0.000
#> SRR2015771     3  0.4868     0.4686 0.396 0.052 0.548 0.000 0.000 0.004
#> SRR2015769     6  0.2320     0.3496 0.000 0.132 0.004 0.000 0.000 0.864
#> SRR2015770     2  0.0260     0.9670 0.000 0.992 0.008 0.000 0.000 0.000
#> SRR2015768     2  0.0260     0.9670 0.000 0.992 0.008 0.000 0.000 0.000
#> SRR2015767     4  0.3023     0.9667 0.000 0.232 0.000 0.768 0.000 0.000
#> SRR2015766     3  0.5660     0.5610 0.192 0.132 0.640 0.020 0.016 0.000
#> SRR2015764     2  0.0260     0.9692 0.000 0.992 0.008 0.000 0.000 0.000
#> SRR2015765     3  0.5063     0.0498 0.000 0.008 0.660 0.000 0.184 0.148
#> SRR2015763     3  0.4868     0.4686 0.396 0.052 0.548 0.000 0.000 0.004
#> SRR2015762     2  0.3371     0.7673 0.000 0.832 0.080 0.076 0.012 0.000
#> SRR2015761     3  0.6009     0.5082 0.176 0.244 0.556 0.020 0.004 0.000
#> SRR2015760     3  0.4938     0.4820 0.344 0.036 0.596 0.000 0.024 0.000

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

consensus_heatmap(res, k = 2)

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

consensus_heatmap(res, k = 3)

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

consensus_heatmap(res, k = 4)

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

consensus_heatmap(res, k = 5)

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

consensus_heatmap(res, k = 6)

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

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

membership_heatmap(res, k = 2)

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

membership_heatmap(res, k = 3)

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

membership_heatmap(res, k = 4)

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

membership_heatmap(res, k = 5)

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

membership_heatmap(res, k = 6)

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

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

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

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

get_signatures(res, k = 3)

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

get_signatures(res, k = 4)

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

get_signatures(res, k = 5)

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

get_signatures(res, k = 6)

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

Signature heatmaps where rows are not scaled:

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

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

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

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

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

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

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

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

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

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

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk CV-hclust-signature_compare

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

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

An example of the output of tb is:

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

The columns in tb are:

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

UMAP plot which shows how samples are separated.

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

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

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

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

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

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

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

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

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

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

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk CV-hclust-collect-classes

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

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

collect_plots(res)

plot of chunk CV-kmeans-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 1.000           0.969       0.986         0.4954 0.505   0.505
#> 3 3 0.509           0.674       0.747         0.2667 0.767   0.562
#> 4 4 0.550           0.692       0.810         0.1363 0.829   0.557
#> 5 5 0.662           0.577       0.739         0.0831 0.900   0.668
#> 6 6 0.672           0.681       0.778         0.0466 0.896   0.596

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

suggest_best_k(res)
#> [1] 2

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

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

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>            class entropy silhouette    p1    p2
#> SRR2015715     1  0.0000      0.985 1.000 0.000
#> SRR2015735     1  0.0000      0.985 1.000 0.000
#> SRR2015759     1  0.0000      0.985 1.000 0.000
#> SRR2015753     1  0.0000      0.985 1.000 0.000
#> SRR2015746     1  0.0938      0.981 0.988 0.012
#> SRR2015758     2  0.0000      0.987 0.000 1.000
#> SRR2015756     1  0.0000      0.985 1.000 0.000
#> SRR2015757     1  0.0000      0.985 1.000 0.000
#> SRR2015755     1  0.0000      0.985 1.000 0.000
#> SRR2015754     1  0.0000      0.985 1.000 0.000
#> SRR2015752     1  0.0000      0.985 1.000 0.000
#> SRR2015749     1  0.0000      0.985 1.000 0.000
#> SRR2015750     2  0.0000      0.987 0.000 1.000
#> SRR2015751     1  0.0000      0.985 1.000 0.000
#> SRR2015748     2  0.0000      0.987 0.000 1.000
#> SRR2015747     1  0.0000      0.985 1.000 0.000
#> SRR2015745     2  0.0000      0.987 0.000 1.000
#> SRR2015743     1  0.0000      0.985 1.000 0.000
#> SRR2015744     2  0.0376      0.984 0.004 0.996
#> SRR2015742     1  0.0938      0.981 0.988 0.012
#> SRR2015741     1  0.0000      0.985 1.000 0.000
#> SRR2015740     1  0.0000      0.985 1.000 0.000
#> SRR2015738     1  0.0000      0.985 1.000 0.000
#> SRR2015739     1  0.0000      0.985 1.000 0.000
#> SRR2015737     2  0.0000      0.987 0.000 1.000
#> SRR2015736     1  0.0938      0.981 0.988 0.012
#> SRR2015732     1  0.0000      0.985 1.000 0.000
#> SRR2015733     1  0.1843      0.967 0.972 0.028
#> SRR2015734     1  0.0000      0.985 1.000 0.000
#> SRR2015731     1  0.0938      0.981 0.988 0.012
#> SRR2015730     1  0.0000      0.985 1.000 0.000
#> SRR2015728     1  0.0938      0.981 0.988 0.012
#> SRR2015729     2  0.0000      0.987 0.000 1.000
#> SRR2015727     1  0.0938      0.981 0.988 0.012
#> SRR2015726     1  0.0000      0.985 1.000 0.000
#> SRR2015723     2  0.0000      0.987 0.000 1.000
#> SRR2015724     1  0.0938      0.981 0.988 0.012
#> SRR2015725     1  0.0000      0.985 1.000 0.000
#> SRR2015722     1  0.0938      0.981 0.988 0.012
#> SRR2015721     1  0.0938      0.981 0.988 0.012
#> SRR2015720     1  0.0938      0.981 0.988 0.012
#> SRR2015718     2  0.6343      0.810 0.160 0.840
#> SRR2015719     2  0.0000      0.987 0.000 1.000
#> SRR2015717     1  0.0000      0.985 1.000 0.000
#> SRR2015716     1  0.9775      0.291 0.588 0.412
#> SRR2015714     2  0.0000      0.987 0.000 1.000
#> SRR2015713     1  0.0938      0.981 0.988 0.012
#> SRR2015784     2  0.0000      0.987 0.000 1.000
#> SRR2015785     2  0.0000      0.987 0.000 1.000
#> SRR2015783     1  0.0000      0.985 1.000 0.000
#> SRR2015782     2  0.0000      0.987 0.000 1.000
#> SRR2015781     2  0.0000      0.987 0.000 1.000
#> SRR2015780     2  0.0000      0.987 0.000 1.000
#> SRR2015779     2  0.0000      0.987 0.000 1.000
#> SRR2015778     1  0.0938      0.981 0.988 0.012
#> SRR2015777     1  0.1633      0.971 0.976 0.024
#> SRR2015776     2  0.0000      0.987 0.000 1.000
#> SRR2015775     2  0.0000      0.987 0.000 1.000
#> SRR2015774     2  0.0000      0.987 0.000 1.000
#> SRR2015773     2  0.0000      0.987 0.000 1.000
#> SRR2015772     2  0.0000      0.987 0.000 1.000
#> SRR2015771     1  0.0000      0.985 1.000 0.000
#> SRR2015769     2  0.0000      0.987 0.000 1.000
#> SRR2015770     2  0.0000      0.987 0.000 1.000
#> SRR2015768     2  0.0000      0.987 0.000 1.000
#> SRR2015767     2  0.0000      0.987 0.000 1.000
#> SRR2015766     2  0.7139      0.759 0.196 0.804
#> SRR2015764     2  0.0000      0.987 0.000 1.000
#> SRR2015765     2  0.0000      0.987 0.000 1.000
#> SRR2015763     1  0.0000      0.985 1.000 0.000
#> SRR2015762     2  0.0000      0.987 0.000 1.000
#> SRR2015761     2  0.1414      0.969 0.020 0.980
#> SRR2015760     1  0.0000      0.985 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
#> SRR2015715     1  0.6154    -0.2792 0.592 0.000 0.408
#> SRR2015735     1  0.3619     0.6728 0.864 0.000 0.136
#> SRR2015759     1  0.0000     0.8406 1.000 0.000 0.000
#> SRR2015753     1  0.0000     0.8406 1.000 0.000 0.000
#> SRR2015746     3  0.6973     0.7680 0.416 0.020 0.564
#> SRR2015758     2  0.5098     0.6779 0.000 0.752 0.248
#> SRR2015756     1  0.0000     0.8406 1.000 0.000 0.000
#> SRR2015757     3  0.6869     0.7620 0.424 0.016 0.560
#> SRR2015755     1  0.0000     0.8406 1.000 0.000 0.000
#> SRR2015754     1  0.0424     0.8344 0.992 0.000 0.008
#> SRR2015752     1  0.0000     0.8406 1.000 0.000 0.000
#> SRR2015749     1  0.0000     0.8406 1.000 0.000 0.000
#> SRR2015750     2  0.4842     0.7823 0.000 0.776 0.224
#> SRR2015751     1  0.6225    -0.3691 0.568 0.000 0.432
#> SRR2015748     2  0.4291     0.8017 0.000 0.820 0.180
#> SRR2015747     1  0.0000     0.8406 1.000 0.000 0.000
#> SRR2015745     2  0.5363     0.6314 0.000 0.724 0.276
#> SRR2015743     1  0.0000     0.8406 1.000 0.000 0.000
#> SRR2015744     3  0.7123     0.2726 0.032 0.364 0.604
#> SRR2015742     3  0.6973     0.7680 0.416 0.020 0.564
#> SRR2015741     1  0.0000     0.8406 1.000 0.000 0.000
#> SRR2015740     1  0.0000     0.8406 1.000 0.000 0.000
#> SRR2015738     1  0.0424     0.8344 0.992 0.000 0.008
#> SRR2015739     1  0.0000     0.8406 1.000 0.000 0.000
#> SRR2015737     2  0.0892     0.8098 0.000 0.980 0.020
#> SRR2015736     3  0.6984     0.7671 0.420 0.020 0.560
#> SRR2015732     1  0.1031     0.8195 0.976 0.000 0.024
#> SRR2015733     3  0.6973     0.7678 0.416 0.020 0.564
#> SRR2015734     1  0.3686     0.6617 0.860 0.000 0.140
#> SRR2015731     3  0.6848     0.7661 0.416 0.016 0.568
#> SRR2015730     1  0.0000     0.8406 1.000 0.000 0.000
#> SRR2015728     3  0.6451     0.7388 0.436 0.004 0.560
#> SRR2015729     2  0.4796     0.7825 0.000 0.780 0.220
#> SRR2015727     3  0.6704     0.7415 0.376 0.016 0.608
#> SRR2015726     1  0.6839     0.4690 0.684 0.044 0.272
#> SRR2015723     2  0.6267     0.5193 0.000 0.548 0.452
#> SRR2015724     3  0.6984     0.7671 0.420 0.020 0.560
#> SRR2015725     1  0.0000     0.8406 1.000 0.000 0.000
#> SRR2015722     3  0.6264     0.7260 0.380 0.004 0.616
#> SRR2015721     3  0.6994     0.7629 0.424 0.020 0.556
#> SRR2015720     3  0.6984     0.7671 0.420 0.020 0.560
#> SRR2015718     3  0.6422     0.2258 0.016 0.324 0.660
#> SRR2015719     2  0.6008     0.6593 0.000 0.628 0.372
#> SRR2015717     3  0.6299     0.6465 0.476 0.000 0.524
#> SRR2015716     3  0.8159     0.3064 0.092 0.320 0.588
#> SRR2015714     2  0.6008     0.6593 0.000 0.628 0.372
#> SRR2015713     3  0.6984     0.7671 0.420 0.020 0.560
#> SRR2015784     2  0.0237     0.8094 0.000 0.996 0.004
#> SRR2015785     2  0.4654     0.7802 0.000 0.792 0.208
#> SRR2015783     1  0.0000     0.8406 1.000 0.000 0.000
#> SRR2015782     2  0.4796     0.7825 0.000 0.780 0.220
#> SRR2015781     2  0.4002     0.7743 0.000 0.840 0.160
#> SRR2015780     2  0.0237     0.8102 0.000 0.996 0.004
#> SRR2015779     2  0.3619     0.7860 0.000 0.864 0.136
#> SRR2015778     3  0.6984     0.7671 0.420 0.020 0.560
#> SRR2015777     3  0.8534     0.6871 0.320 0.116 0.564
#> SRR2015776     2  0.5016     0.7394 0.000 0.760 0.240
#> SRR2015775     2  0.4796     0.7825 0.000 0.780 0.220
#> SRR2015774     2  0.5397     0.6061 0.000 0.720 0.280
#> SRR2015773     2  0.0892     0.8098 0.000 0.980 0.020
#> SRR2015772     2  0.0892     0.8098 0.000 0.980 0.020
#> SRR2015771     1  0.6154    -0.2792 0.592 0.000 0.408
#> SRR2015769     2  0.4796     0.7825 0.000 0.780 0.220
#> SRR2015770     2  0.2878     0.8083 0.000 0.904 0.096
#> SRR2015768     2  0.2878     0.8083 0.000 0.904 0.096
#> SRR2015767     2  0.5016     0.7394 0.000 0.760 0.240
#> SRR2015766     3  0.8442     0.5890 0.188 0.192 0.620
#> SRR2015764     2  0.5948     0.5030 0.000 0.640 0.360
#> SRR2015765     2  0.4750     0.7663 0.000 0.784 0.216
#> SRR2015763     1  0.5948    -0.0648 0.640 0.000 0.360
#> SRR2015762     2  0.6062     0.6166 0.000 0.616 0.384
#> SRR2015761     3  0.6209     0.2258 0.004 0.368 0.628
#> SRR2015760     3  0.6460     0.7338 0.440 0.004 0.556

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> SRR2015715     3  0.3852      0.809 0.192 0.000 0.800 0.008
#> SRR2015735     1  0.4877      0.494 0.664 0.000 0.328 0.008
#> SRR2015759     1  0.0188      0.943 0.996 0.000 0.004 0.000
#> SRR2015753     1  0.0336      0.935 0.992 0.000 0.000 0.008
#> SRR2015746     3  0.5036      0.831 0.100 0.020 0.796 0.084
#> SRR2015758     4  0.7143      0.320 0.000 0.132 0.408 0.460
#> SRR2015756     1  0.0188      0.943 0.996 0.000 0.004 0.000
#> SRR2015757     3  0.4858      0.837 0.112 0.008 0.796 0.084
#> SRR2015755     1  0.0376      0.941 0.992 0.000 0.004 0.004
#> SRR2015754     1  0.2928      0.851 0.880 0.000 0.108 0.012
#> SRR2015752     1  0.0188      0.943 0.996 0.000 0.004 0.000
#> SRR2015749     1  0.0188      0.943 0.996 0.000 0.004 0.000
#> SRR2015750     2  0.4707      0.515 0.004 0.800 0.080 0.116
#> SRR2015751     3  0.5266      0.833 0.116 0.020 0.780 0.084
#> SRR2015748     2  0.3672      0.548 0.000 0.824 0.012 0.164
#> SRR2015747     1  0.0188      0.943 0.996 0.000 0.004 0.000
#> SRR2015745     3  0.6112      0.428 0.000 0.128 0.676 0.196
#> SRR2015743     1  0.0188      0.943 0.996 0.000 0.004 0.000
#> SRR2015744     3  0.5187      0.552 0.004 0.040 0.728 0.228
#> SRR2015742     3  0.5153      0.834 0.108 0.020 0.788 0.084
#> SRR2015741     1  0.0376      0.941 0.992 0.000 0.004 0.004
#> SRR2015740     1  0.0188      0.943 0.996 0.000 0.004 0.000
#> SRR2015738     1  0.2928      0.851 0.880 0.000 0.108 0.012
#> SRR2015739     1  0.0188      0.943 0.996 0.000 0.004 0.000
#> SRR2015737     2  0.6574      0.300 0.000 0.532 0.084 0.384
#> SRR2015736     3  0.2530      0.849 0.112 0.000 0.888 0.000
#> SRR2015732     1  0.1610      0.912 0.952 0.000 0.032 0.016
#> SRR2015733     3  0.4496      0.829 0.088 0.008 0.820 0.084
#> SRR2015734     1  0.4420      0.645 0.748 0.000 0.240 0.012
#> SRR2015731     3  0.3404      0.845 0.104 0.000 0.864 0.032
#> SRR2015730     1  0.0188      0.943 0.996 0.000 0.004 0.000
#> SRR2015728     3  0.3205      0.847 0.104 0.000 0.872 0.024
#> SRR2015729     2  0.0804      0.612 0.000 0.980 0.008 0.012
#> SRR2015727     3  0.3820      0.836 0.088 0.000 0.848 0.064
#> SRR2015726     2  0.7534     -0.100 0.408 0.456 0.120 0.016
#> SRR2015723     2  0.3224      0.515 0.000 0.864 0.120 0.016
#> SRR2015724     3  0.2859      0.849 0.112 0.000 0.880 0.008
#> SRR2015725     1  0.0188      0.943 0.996 0.000 0.004 0.000
#> SRR2015722     3  0.3820      0.836 0.088 0.000 0.848 0.064
#> SRR2015721     3  0.3325      0.846 0.112 0.000 0.864 0.024
#> SRR2015720     3  0.4444      0.843 0.112 0.004 0.816 0.068
#> SRR2015718     3  0.4651      0.696 0.004 0.112 0.804 0.080
#> SRR2015719     4  0.3105      0.620 0.000 0.120 0.012 0.868
#> SRR2015717     3  0.3441      0.845 0.120 0.000 0.856 0.024
#> SRR2015716     3  0.5457      0.667 0.012 0.160 0.752 0.076
#> SRR2015714     4  0.3105      0.620 0.000 0.120 0.012 0.868
#> SRR2015713     3  0.4514      0.842 0.112 0.004 0.812 0.072
#> SRR2015784     2  0.6564      0.301 0.000 0.536 0.084 0.380
#> SRR2015785     2  0.0895      0.611 0.000 0.976 0.004 0.020
#> SRR2015783     1  0.0188      0.943 0.996 0.000 0.004 0.000
#> SRR2015782     2  0.2670      0.598 0.000 0.908 0.052 0.040
#> SRR2015781     4  0.5740      0.533 0.000 0.208 0.092 0.700
#> SRR2015780     2  0.6274      0.404 0.000 0.620 0.088 0.292
#> SRR2015779     4  0.5880      0.487 0.000 0.232 0.088 0.680
#> SRR2015778     3  0.5210      0.833 0.112 0.020 0.784 0.084
#> SRR2015777     3  0.4012      0.765 0.028 0.028 0.852 0.092
#> SRR2015776     4  0.3074      0.615 0.000 0.152 0.000 0.848
#> SRR2015775     2  0.0804      0.612 0.000 0.980 0.008 0.012
#> SRR2015774     3  0.7034      0.063 0.000 0.220 0.576 0.204
#> SRR2015773     2  0.6574      0.300 0.000 0.532 0.084 0.384
#> SRR2015772     2  0.6574      0.300 0.000 0.532 0.084 0.384
#> SRR2015771     3  0.4137      0.794 0.208 0.000 0.780 0.012
#> SRR2015769     2  0.0804      0.612 0.000 0.980 0.008 0.012
#> SRR2015770     2  0.6098      0.427 0.000 0.632 0.076 0.292
#> SRR2015768     2  0.6075      0.429 0.000 0.636 0.076 0.288
#> SRR2015767     4  0.3074      0.615 0.000 0.152 0.000 0.848
#> SRR2015766     3  0.3398      0.824 0.060 0.000 0.872 0.068
#> SRR2015764     4  0.7076      0.319 0.000 0.124 0.416 0.460
#> SRR2015765     2  0.4411      0.567 0.000 0.812 0.080 0.108
#> SRR2015763     3  0.4814      0.631 0.316 0.000 0.676 0.008
#> SRR2015762     4  0.5140      0.581 0.000 0.096 0.144 0.760
#> SRR2015761     3  0.2255      0.776 0.000 0.012 0.920 0.068
#> SRR2015760     3  0.3367      0.846 0.108 0.000 0.864 0.028

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>            class entropy silhouette    p1    p2    p3    p4    p5
#> SRR2015715     3  0.4070     0.7270 0.112 0.076 0.804 0.008 0.000
#> SRR2015735     3  0.4137     0.5405 0.248 0.012 0.732 0.008 0.000
#> SRR2015759     1  0.0451     0.9218 0.988 0.000 0.004 0.008 0.000
#> SRR2015753     1  0.1799     0.9042 0.940 0.028 0.000 0.020 0.012
#> SRR2015746     3  0.4449     0.5386 0.004 0.484 0.512 0.000 0.000
#> SRR2015758     2  0.5592     0.2701 0.000 0.652 0.068 0.256 0.024
#> SRR2015756     1  0.1679     0.9123 0.948 0.020 0.004 0.016 0.012
#> SRR2015757     3  0.4341     0.6103 0.004 0.404 0.592 0.000 0.000
#> SRR2015755     1  0.1622     0.9123 0.948 0.004 0.028 0.016 0.004
#> SRR2015754     1  0.4361     0.7558 0.780 0.064 0.144 0.012 0.000
#> SRR2015752     1  0.0162     0.9225 0.996 0.000 0.004 0.000 0.000
#> SRR2015749     1  0.0451     0.9218 0.988 0.000 0.004 0.008 0.000
#> SRR2015750     5  0.4698     0.2137 0.004 0.468 0.000 0.008 0.520
#> SRR2015751     3  0.4552     0.5528 0.008 0.468 0.524 0.000 0.000
#> SRR2015748     5  0.4530     0.5379 0.000 0.080 0.008 0.148 0.764
#> SRR2015747     1  0.0889     0.9217 0.976 0.004 0.004 0.012 0.004
#> SRR2015745     2  0.3341     0.2789 0.000 0.840 0.128 0.024 0.008
#> SRR2015743     1  0.1460     0.9152 0.956 0.020 0.004 0.008 0.012
#> SRR2015744     2  0.3667     0.2710 0.000 0.812 0.140 0.048 0.000
#> SRR2015742     3  0.4440     0.5490 0.004 0.468 0.528 0.000 0.000
#> SRR2015741     1  0.1106     0.9134 0.964 0.000 0.024 0.012 0.000
#> SRR2015740     1  0.0162     0.9225 0.996 0.000 0.004 0.000 0.000
#> SRR2015738     1  0.4380     0.7551 0.780 0.068 0.140 0.012 0.000
#> SRR2015739     1  0.1679     0.9123 0.948 0.020 0.004 0.016 0.012
#> SRR2015737     2  0.6767     0.3323 0.000 0.392 0.000 0.280 0.328
#> SRR2015736     3  0.2304     0.7543 0.008 0.100 0.892 0.000 0.000
#> SRR2015732     1  0.2338     0.8813 0.916 0.036 0.032 0.016 0.000
#> SRR2015733     3  0.4341     0.6070 0.004 0.404 0.592 0.000 0.000
#> SRR2015734     1  0.5182     0.2369 0.576 0.032 0.384 0.008 0.000
#> SRR2015731     3  0.1917     0.7447 0.008 0.016 0.936 0.036 0.004
#> SRR2015730     1  0.0324     0.9222 0.992 0.000 0.004 0.004 0.000
#> SRR2015728     3  0.2150     0.7560 0.004 0.068 0.916 0.008 0.004
#> SRR2015729     5  0.0566     0.6594 0.000 0.012 0.000 0.004 0.984
#> SRR2015727     3  0.2512     0.7353 0.008 0.032 0.908 0.048 0.004
#> SRR2015726     5  0.6445     0.3631 0.216 0.056 0.056 0.028 0.644
#> SRR2015723     5  0.2331     0.6204 0.000 0.024 0.064 0.004 0.908
#> SRR2015724     3  0.2621     0.7549 0.008 0.112 0.876 0.004 0.000
#> SRR2015725     1  0.0486     0.9216 0.988 0.004 0.004 0.004 0.000
#> SRR2015722     3  0.2512     0.7353 0.008 0.032 0.908 0.048 0.004
#> SRR2015721     3  0.1628     0.7581 0.008 0.056 0.936 0.000 0.000
#> SRR2015720     3  0.4196     0.6472 0.004 0.356 0.640 0.000 0.000
#> SRR2015718     3  0.4695     0.6457 0.000 0.184 0.748 0.024 0.044
#> SRR2015719     4  0.1485     0.6809 0.000 0.000 0.020 0.948 0.032
#> SRR2015717     3  0.1612     0.7509 0.024 0.016 0.948 0.012 0.000
#> SRR2015716     3  0.5080     0.6185 0.000 0.184 0.724 0.024 0.068
#> SRR2015714     4  0.1485     0.6809 0.000 0.000 0.020 0.948 0.032
#> SRR2015713     3  0.4225     0.6419 0.004 0.364 0.632 0.000 0.000
#> SRR2015784     2  0.6767     0.3316 0.000 0.392 0.000 0.280 0.328
#> SRR2015785     5  0.0932     0.6583 0.000 0.020 0.004 0.004 0.972
#> SRR2015783     1  0.0162     0.9225 0.996 0.000 0.004 0.000 0.000
#> SRR2015782     5  0.4165     0.3758 0.000 0.320 0.000 0.008 0.672
#> SRR2015781     4  0.5351    -0.0168 0.000 0.464 0.000 0.484 0.052
#> SRR2015780     2  0.6798     0.2659 0.000 0.392 0.004 0.228 0.376
#> SRR2015779     2  0.5649    -0.1363 0.000 0.472 0.000 0.452 0.076
#> SRR2015778     3  0.4443     0.5443 0.004 0.472 0.524 0.000 0.000
#> SRR2015777     2  0.4211    -0.2656 0.004 0.636 0.360 0.000 0.000
#> SRR2015776     4  0.2221     0.6877 0.000 0.036 0.000 0.912 0.052
#> SRR2015775     5  0.0566     0.6594 0.000 0.012 0.000 0.004 0.984
#> SRR2015774     2  0.7703     0.2026 0.000 0.436 0.320 0.120 0.124
#> SRR2015773     2  0.6772     0.3320 0.000 0.388 0.000 0.280 0.332
#> SRR2015772     2  0.6772     0.3320 0.000 0.388 0.000 0.280 0.332
#> SRR2015771     3  0.4119     0.7246 0.116 0.076 0.800 0.008 0.000
#> SRR2015769     5  0.0671     0.6590 0.000 0.016 0.000 0.004 0.980
#> SRR2015770     5  0.6646    -0.3424 0.000 0.380 0.000 0.224 0.396
#> SRR2015768     5  0.6646    -0.3424 0.000 0.380 0.000 0.224 0.396
#> SRR2015767     4  0.2221     0.6877 0.000 0.036 0.000 0.912 0.052
#> SRR2015766     3  0.2536     0.7320 0.000 0.044 0.900 0.052 0.004
#> SRR2015764     2  0.5377     0.2693 0.000 0.664 0.052 0.260 0.024
#> SRR2015765     5  0.4448     0.5597 0.000 0.148 0.036 0.036 0.780
#> SRR2015763     3  0.4184     0.6887 0.176 0.048 0.772 0.004 0.000
#> SRR2015762     4  0.5421     0.0170 0.000 0.456 0.024 0.500 0.020
#> SRR2015761     3  0.3953     0.7022 0.000 0.168 0.784 0.048 0.000
#> SRR2015760     3  0.0981     0.7520 0.008 0.008 0.972 0.012 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
#> SRR2015715     3  0.5331      0.620 0.080 0.004 0.712 0.012 0.132 0.060
#> SRR2015735     3  0.4789      0.596 0.128 0.000 0.752 0.052 0.024 0.044
#> SRR2015759     1  0.0725      0.867 0.976 0.000 0.000 0.012 0.000 0.012
#> SRR2015753     1  0.3101      0.833 0.860 0.000 0.000 0.044 0.036 0.060
#> SRR2015746     5  0.3323      0.735 0.000 0.008 0.200 0.004 0.784 0.004
#> SRR2015758     2  0.3248      0.653 0.000 0.768 0.004 0.004 0.224 0.000
#> SRR2015756     1  0.2664      0.844 0.884 0.000 0.000 0.040 0.020 0.056
#> SRR2015757     5  0.4135      0.584 0.000 0.004 0.404 0.008 0.584 0.000
#> SRR2015755     1  0.2825      0.847 0.884 0.000 0.032 0.040 0.008 0.036
#> SRR2015754     1  0.5715      0.608 0.652 0.000 0.112 0.020 0.184 0.032
#> SRR2015752     1  0.0000      0.869 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2015749     1  0.0964      0.866 0.968 0.000 0.000 0.016 0.004 0.012
#> SRR2015750     6  0.6669      0.246 0.000 0.332 0.000 0.028 0.308 0.332
#> SRR2015751     5  0.3136      0.737 0.004 0.000 0.228 0.000 0.768 0.000
#> SRR2015748     6  0.6935      0.575 0.000 0.156 0.028 0.168 0.096 0.552
#> SRR2015747     1  0.1418      0.867 0.944 0.000 0.000 0.032 0.000 0.024
#> SRR2015745     5  0.3950      0.406 0.000 0.268 0.016 0.004 0.708 0.004
#> SRR2015743     1  0.2351      0.849 0.900 0.000 0.000 0.036 0.012 0.052
#> SRR2015744     5  0.4661      0.400 0.000 0.276 0.056 0.004 0.660 0.004
#> SRR2015742     5  0.2996      0.737 0.000 0.000 0.228 0.000 0.772 0.000
#> SRR2015741     1  0.2222      0.851 0.916 0.000 0.024 0.028 0.008 0.024
#> SRR2015740     1  0.0000      0.869 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2015738     1  0.5476      0.623 0.668 0.000 0.088 0.020 0.196 0.028
#> SRR2015739     1  0.2664      0.844 0.884 0.000 0.000 0.040 0.020 0.056
#> SRR2015737     2  0.0000      0.769 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2015736     3  0.3197      0.615 0.000 0.000 0.804 0.008 0.176 0.012
#> SRR2015732     1  0.4808      0.713 0.760 0.000 0.076 0.020 0.072 0.072
#> SRR2015733     5  0.3819      0.656 0.000 0.000 0.340 0.008 0.652 0.000
#> SRR2015734     1  0.6320     -0.029 0.476 0.000 0.380 0.012 0.060 0.072
#> SRR2015731     3  0.3406      0.681 0.000 0.000 0.840 0.068 0.036 0.056
#> SRR2015730     1  0.0405      0.868 0.988 0.000 0.000 0.004 0.000 0.008
#> SRR2015728     3  0.4058      0.674 0.000 0.000 0.776 0.044 0.148 0.032
#> SRR2015729     6  0.2969      0.770 0.000 0.224 0.000 0.000 0.000 0.776
#> SRR2015727     3  0.3779      0.674 0.000 0.000 0.816 0.072 0.048 0.064
#> SRR2015726     6  0.5122      0.543 0.056 0.008 0.056 0.060 0.064 0.756
#> SRR2015723     6  0.5098      0.722 0.000 0.156 0.040 0.024 0.060 0.720
#> SRR2015724     3  0.4193      0.601 0.000 0.004 0.744 0.008 0.192 0.052
#> SRR2015725     1  0.0405      0.868 0.988 0.000 0.000 0.004 0.000 0.008
#> SRR2015722     3  0.3779      0.674 0.000 0.000 0.816 0.072 0.048 0.064
#> SRR2015721     3  0.2257      0.674 0.000 0.000 0.876 0.000 0.116 0.008
#> SRR2015720     5  0.4534      0.438 0.000 0.004 0.460 0.008 0.516 0.012
#> SRR2015718     3  0.6237      0.556 0.000 0.112 0.632 0.028 0.152 0.076
#> SRR2015719     4  0.2989      0.969 0.000 0.176 0.004 0.812 0.000 0.008
#> SRR2015717     3  0.2424      0.708 0.000 0.000 0.900 0.036 0.028 0.036
#> SRR2015716     3  0.6455      0.534 0.000 0.124 0.616 0.028 0.124 0.108
#> SRR2015714     4  0.2989      0.969 0.000 0.176 0.004 0.812 0.000 0.008
#> SRR2015713     5  0.4542      0.395 0.000 0.004 0.480 0.008 0.496 0.012
#> SRR2015784     2  0.0291      0.768 0.000 0.992 0.000 0.000 0.004 0.004
#> SRR2015785     6  0.3966      0.758 0.000 0.236 0.000 0.008 0.028 0.728
#> SRR2015783     1  0.0291      0.869 0.992 0.000 0.000 0.004 0.000 0.004
#> SRR2015782     2  0.5762     -0.160 0.000 0.520 0.000 0.024 0.104 0.352
#> SRR2015781     2  0.3698      0.662 0.000 0.788 0.000 0.116 0.096 0.000
#> SRR2015780     2  0.2521      0.700 0.000 0.892 0.000 0.020 0.032 0.056
#> SRR2015779     2  0.3520      0.678 0.000 0.804 0.000 0.100 0.096 0.000
#> SRR2015778     5  0.3190      0.739 0.000 0.008 0.220 0.000 0.772 0.000
#> SRR2015777     5  0.3930      0.720 0.000 0.048 0.180 0.004 0.764 0.004
#> SRR2015776     4  0.3103      0.968 0.000 0.208 0.000 0.784 0.000 0.008
#> SRR2015775     6  0.2969      0.770 0.000 0.224 0.000 0.000 0.000 0.776
#> SRR2015774     2  0.5309      0.471 0.000 0.664 0.228 0.016 0.064 0.028
#> SRR2015773     2  0.0000      0.769 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2015772     2  0.0000      0.769 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2015771     3  0.5360      0.618 0.084 0.004 0.708 0.012 0.136 0.056
#> SRR2015769     6  0.2969      0.770 0.000 0.224 0.000 0.000 0.000 0.776
#> SRR2015770     2  0.1219      0.748 0.000 0.948 0.000 0.000 0.004 0.048
#> SRR2015768     2  0.1075      0.747 0.000 0.952 0.000 0.000 0.000 0.048
#> SRR2015767     4  0.3103      0.968 0.000 0.208 0.000 0.784 0.000 0.008
#> SRR2015766     3  0.3631      0.692 0.000 0.004 0.832 0.064 0.048 0.052
#> SRR2015764     2  0.3370      0.654 0.000 0.772 0.012 0.004 0.212 0.000
#> SRR2015765     6  0.5987      0.623 0.000 0.300 0.036 0.024 0.068 0.572
#> SRR2015763     3  0.5125      0.619 0.120 0.000 0.724 0.012 0.084 0.060
#> SRR2015762     2  0.4471      0.632 0.000 0.740 0.008 0.128 0.120 0.004
#> SRR2015761     3  0.5475      0.506 0.000 0.124 0.664 0.016 0.176 0.020
#> SRR2015760     3  0.1675      0.713 0.000 0.000 0.936 0.024 0.032 0.008

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

consensus_heatmap(res, k = 2)

plot of chunk tab-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

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 17223 rows and 73 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 1.000           0.962       0.985         0.5028 0.498   0.498
#> 3 3 0.670           0.752       0.884         0.3090 0.844   0.690
#> 4 4 0.621           0.590       0.752         0.1232 0.907   0.739
#> 5 5 0.723           0.747       0.857         0.0686 0.880   0.599
#> 6 6 0.761           0.723       0.851         0.0431 0.944   0.750

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
#> SRR2015715     1  0.0000      0.985 1.000 0.000
#> SRR2015735     1  0.0000      0.985 1.000 0.000
#> SRR2015759     1  0.0000      0.985 1.000 0.000
#> SRR2015753     1  0.0000      0.985 1.000 0.000
#> SRR2015746     1  0.6887      0.766 0.816 0.184
#> SRR2015758     2  0.0000      0.983 0.000 1.000
#> SRR2015756     1  0.0000      0.985 1.000 0.000
#> SRR2015757     1  0.0000      0.985 1.000 0.000
#> SRR2015755     1  0.0000      0.985 1.000 0.000
#> SRR2015754     1  0.0000      0.985 1.000 0.000
#> SRR2015752     1  0.0000      0.985 1.000 0.000
#> SRR2015749     1  0.0000      0.985 1.000 0.000
#> SRR2015750     2  0.0000      0.983 0.000 1.000
#> SRR2015751     1  0.0000      0.985 1.000 0.000
#> SRR2015748     2  0.0000      0.983 0.000 1.000
#> SRR2015747     1  0.0000      0.985 1.000 0.000
#> SRR2015745     2  0.0000      0.983 0.000 1.000
#> SRR2015743     1  0.0000      0.985 1.000 0.000
#> SRR2015744     2  0.0000      0.983 0.000 1.000
#> SRR2015742     1  0.0000      0.985 1.000 0.000
#> SRR2015741     1  0.0000      0.985 1.000 0.000
#> SRR2015740     1  0.0000      0.985 1.000 0.000
#> SRR2015738     1  0.0000      0.985 1.000 0.000
#> SRR2015739     1  0.0000      0.985 1.000 0.000
#> SRR2015737     2  0.0000      0.983 0.000 1.000
#> SRR2015736     1  0.0000      0.985 1.000 0.000
#> SRR2015732     1  0.0000      0.985 1.000 0.000
#> SRR2015733     1  0.9608      0.363 0.616 0.384
#> SRR2015734     1  0.0000      0.985 1.000 0.000
#> SRR2015731     1  0.0000      0.985 1.000 0.000
#> SRR2015730     1  0.0000      0.985 1.000 0.000
#> SRR2015728     1  0.0000      0.985 1.000 0.000
#> SRR2015729     2  0.0000      0.983 0.000 1.000
#> SRR2015727     1  0.0000      0.985 1.000 0.000
#> SRR2015726     1  0.0000      0.985 1.000 0.000
#> SRR2015723     2  0.0000      0.983 0.000 1.000
#> SRR2015724     1  0.0000      0.985 1.000 0.000
#> SRR2015725     1  0.0000      0.985 1.000 0.000
#> SRR2015722     1  0.0000      0.985 1.000 0.000
#> SRR2015721     1  0.0000      0.985 1.000 0.000
#> SRR2015720     1  0.0000      0.985 1.000 0.000
#> SRR2015718     2  0.0000      0.983 0.000 1.000
#> SRR2015719     2  0.0000      0.983 0.000 1.000
#> SRR2015717     1  0.0000      0.985 1.000 0.000
#> SRR2015716     2  0.9608      0.363 0.384 0.616
#> SRR2015714     2  0.0000      0.983 0.000 1.000
#> SRR2015713     1  0.0000      0.985 1.000 0.000
#> SRR2015784     2  0.0000      0.983 0.000 1.000
#> SRR2015785     2  0.0000      0.983 0.000 1.000
#> SRR2015783     1  0.0000      0.985 1.000 0.000
#> SRR2015782     2  0.0000      0.983 0.000 1.000
#> SRR2015781     2  0.0000      0.983 0.000 1.000
#> SRR2015780     2  0.0000      0.983 0.000 1.000
#> SRR2015779     2  0.0000      0.983 0.000 1.000
#> SRR2015778     1  0.0376      0.981 0.996 0.004
#> SRR2015777     2  0.5519      0.843 0.128 0.872
#> SRR2015776     2  0.0000      0.983 0.000 1.000
#> SRR2015775     2  0.0000      0.983 0.000 1.000
#> SRR2015774     2  0.0000      0.983 0.000 1.000
#> SRR2015773     2  0.0000      0.983 0.000 1.000
#> SRR2015772     2  0.0000      0.983 0.000 1.000
#> SRR2015771     1  0.0000      0.985 1.000 0.000
#> SRR2015769     2  0.0000      0.983 0.000 1.000
#> SRR2015770     2  0.0000      0.983 0.000 1.000
#> SRR2015768     2  0.0000      0.983 0.000 1.000
#> SRR2015767     2  0.0000      0.983 0.000 1.000
#> SRR2015766     2  0.0000      0.983 0.000 1.000
#> SRR2015764     2  0.0000      0.983 0.000 1.000
#> SRR2015765     2  0.0000      0.983 0.000 1.000
#> SRR2015763     1  0.0000      0.985 1.000 0.000
#> SRR2015762     2  0.0000      0.983 0.000 1.000
#> SRR2015761     2  0.0000      0.983 0.000 1.000
#> SRR2015760     1  0.0000      0.985 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
#> SRR2015715     1  0.6299    -0.2305 0.524 0.000 0.476
#> SRR2015735     1  0.4121     0.7138 0.832 0.000 0.168
#> SRR2015759     1  0.0000     0.8601 1.000 0.000 0.000
#> SRR2015753     1  0.0000     0.8601 1.000 0.000 0.000
#> SRR2015746     1  0.6737     0.5632 0.688 0.040 0.272
#> SRR2015758     2  0.1529     0.8904 0.000 0.960 0.040
#> SRR2015756     1  0.0000     0.8601 1.000 0.000 0.000
#> SRR2015757     3  0.3879     0.8075 0.152 0.000 0.848
#> SRR2015755     1  0.0000     0.8601 1.000 0.000 0.000
#> SRR2015754     1  0.3412     0.7625 0.876 0.000 0.124
#> SRR2015752     1  0.0000     0.8601 1.000 0.000 0.000
#> SRR2015749     1  0.0000     0.8601 1.000 0.000 0.000
#> SRR2015750     2  0.2711     0.8568 0.000 0.912 0.088
#> SRR2015751     1  0.2796     0.7932 0.908 0.000 0.092
#> SRR2015748     2  0.1411     0.8937 0.000 0.964 0.036
#> SRR2015747     1  0.0000     0.8601 1.000 0.000 0.000
#> SRR2015745     2  0.3340     0.8498 0.000 0.880 0.120
#> SRR2015743     1  0.0000     0.8601 1.000 0.000 0.000
#> SRR2015744     2  0.2537     0.8792 0.000 0.920 0.080
#> SRR2015742     3  0.6204     0.0622 0.424 0.000 0.576
#> SRR2015741     1  0.0000     0.8601 1.000 0.000 0.000
#> SRR2015740     1  0.0000     0.8601 1.000 0.000 0.000
#> SRR2015738     1  0.2959     0.7834 0.900 0.000 0.100
#> SRR2015739     1  0.0000     0.8601 1.000 0.000 0.000
#> SRR2015737     2  0.0000     0.8976 0.000 1.000 0.000
#> SRR2015736     3  0.3619     0.8363 0.136 0.000 0.864
#> SRR2015732     1  0.0000     0.8601 1.000 0.000 0.000
#> SRR2015733     3  0.2229     0.7991 0.044 0.012 0.944
#> SRR2015734     1  0.3192     0.7500 0.888 0.000 0.112
#> SRR2015731     3  0.2711     0.8243 0.088 0.000 0.912
#> SRR2015730     1  0.0000     0.8601 1.000 0.000 0.000
#> SRR2015728     3  0.5216     0.7474 0.260 0.000 0.740
#> SRR2015729     2  0.0592     0.8958 0.000 0.988 0.012
#> SRR2015727     3  0.2959     0.8259 0.100 0.000 0.900
#> SRR2015726     1  0.2749     0.7906 0.924 0.064 0.012
#> SRR2015723     2  0.0747     0.8948 0.000 0.984 0.016
#> SRR2015724     3  0.6095     0.5406 0.392 0.000 0.608
#> SRR2015725     1  0.0000     0.8601 1.000 0.000 0.000
#> SRR2015722     3  0.2959     0.8259 0.100 0.000 0.900
#> SRR2015721     3  0.4002     0.8314 0.160 0.000 0.840
#> SRR2015720     3  0.3879     0.8075 0.152 0.000 0.848
#> SRR2015718     2  0.6204     0.2257 0.000 0.576 0.424
#> SRR2015719     2  0.5216     0.7175 0.000 0.740 0.260
#> SRR2015717     3  0.4399     0.8164 0.188 0.000 0.812
#> SRR2015716     2  0.8935    -0.1268 0.124 0.452 0.424
#> SRR2015714     2  0.4842     0.7581 0.000 0.776 0.224
#> SRR2015713     3  0.4887     0.7468 0.228 0.000 0.772
#> SRR2015784     2  0.0000     0.8976 0.000 1.000 0.000
#> SRR2015785     2  0.0592     0.8958 0.000 0.988 0.012
#> SRR2015783     1  0.0000     0.8601 1.000 0.000 0.000
#> SRR2015782     2  0.0592     0.8958 0.000 0.988 0.012
#> SRR2015781     2  0.2165     0.8829 0.000 0.936 0.064
#> SRR2015780     2  0.0000     0.8976 0.000 1.000 0.000
#> SRR2015779     2  0.1529     0.8904 0.000 0.960 0.040
#> SRR2015778     1  0.5098     0.6371 0.752 0.000 0.248
#> SRR2015777     2  0.7713     0.5723 0.080 0.636 0.284
#> SRR2015776     2  0.2165     0.8829 0.000 0.936 0.064
#> SRR2015775     2  0.0592     0.8958 0.000 0.988 0.012
#> SRR2015774     2  0.0000     0.8976 0.000 1.000 0.000
#> SRR2015773     2  0.0000     0.8976 0.000 1.000 0.000
#> SRR2015772     2  0.0000     0.8976 0.000 1.000 0.000
#> SRR2015771     1  0.6192    -0.0364 0.580 0.000 0.420
#> SRR2015769     2  0.0592     0.8958 0.000 0.988 0.012
#> SRR2015770     2  0.0000     0.8976 0.000 1.000 0.000
#> SRR2015768     2  0.0000     0.8976 0.000 1.000 0.000
#> SRR2015767     2  0.2165     0.8829 0.000 0.936 0.064
#> SRR2015766     3  0.2796     0.7400 0.000 0.092 0.908
#> SRR2015764     2  0.1529     0.8904 0.000 0.960 0.040
#> SRR2015765     2  0.0592     0.8958 0.000 0.988 0.012
#> SRR2015763     1  0.6295    -0.2173 0.528 0.000 0.472
#> SRR2015762     2  0.5621     0.6544 0.000 0.692 0.308
#> SRR2015761     2  0.5760     0.6246 0.000 0.672 0.328
#> SRR2015760     3  0.3941     0.8317 0.156 0.000 0.844

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> SRR2015715     1  0.6121     0.1708 0.588 0.000 0.352 0.060
#> SRR2015735     1  0.4277     0.5337 0.720 0.000 0.280 0.000
#> SRR2015759     1  0.0000     0.7837 1.000 0.000 0.000 0.000
#> SRR2015753     1  0.0000     0.7837 1.000 0.000 0.000 0.000
#> SRR2015746     1  0.7639     0.2130 0.440 0.032 0.096 0.432
#> SRR2015758     2  0.0524     0.6780 0.000 0.988 0.004 0.008
#> SRR2015756     1  0.0000     0.7837 1.000 0.000 0.000 0.000
#> SRR2015757     3  0.5147     0.6220 0.004 0.000 0.536 0.460
#> SRR2015755     1  0.0707     0.7765 0.980 0.000 0.020 0.000
#> SRR2015754     1  0.4499     0.6540 0.792 0.000 0.048 0.160
#> SRR2015752     1  0.0000     0.7837 1.000 0.000 0.000 0.000
#> SRR2015749     1  0.2675     0.7280 0.892 0.000 0.008 0.100
#> SRR2015750     4  0.4819     0.5239 0.000 0.344 0.004 0.652
#> SRR2015751     1  0.6775     0.2817 0.492 0.000 0.096 0.412
#> SRR2015748     4  0.6979     0.5810 0.000 0.344 0.128 0.528
#> SRR2015747     1  0.0000     0.7837 1.000 0.000 0.000 0.000
#> SRR2015745     2  0.5872     0.3102 0.000 0.576 0.040 0.384
#> SRR2015743     1  0.0000     0.7837 1.000 0.000 0.000 0.000
#> SRR2015744     2  0.4274     0.6173 0.000 0.820 0.072 0.108
#> SRR2015742     4  0.8759    -0.4075 0.244 0.048 0.292 0.416
#> SRR2015741     1  0.0469     0.7798 0.988 0.000 0.012 0.000
#> SRR2015740     1  0.0000     0.7837 1.000 0.000 0.000 0.000
#> SRR2015738     1  0.5030     0.6144 0.752 0.000 0.060 0.188
#> SRR2015739     1  0.0000     0.7837 1.000 0.000 0.000 0.000
#> SRR2015737     2  0.1792     0.6471 0.000 0.932 0.000 0.068
#> SRR2015736     3  0.4353     0.7146 0.012 0.000 0.756 0.232
#> SRR2015732     1  0.0336     0.7806 0.992 0.000 0.000 0.008
#> SRR2015733     3  0.5459     0.5985 0.000 0.016 0.552 0.432
#> SRR2015734     1  0.4465     0.6021 0.800 0.000 0.144 0.056
#> SRR2015731     3  0.1182     0.7096 0.016 0.000 0.968 0.016
#> SRR2015730     1  0.0000     0.7837 1.000 0.000 0.000 0.000
#> SRR2015728     3  0.5572     0.6693 0.196 0.000 0.716 0.088
#> SRR2015729     4  0.4994     0.6917 0.000 0.480 0.000 0.520
#> SRR2015727     3  0.2234     0.7124 0.064 0.004 0.924 0.008
#> SRR2015726     1  0.4981     0.2080 0.536 0.000 0.000 0.464
#> SRR2015723     4  0.5399     0.6951 0.000 0.468 0.012 0.520
#> SRR2015724     3  0.6451     0.3261 0.404 0.000 0.524 0.072
#> SRR2015725     1  0.1635     0.7545 0.948 0.000 0.008 0.044
#> SRR2015722     3  0.2234     0.7124 0.064 0.004 0.924 0.008
#> SRR2015721     3  0.4440     0.7113 0.136 0.000 0.804 0.060
#> SRR2015720     3  0.4948     0.6352 0.000 0.000 0.560 0.440
#> SRR2015718     4  0.6603     0.6353 0.000 0.328 0.100 0.572
#> SRR2015719     2  0.4936     0.5140 0.000 0.652 0.340 0.008
#> SRR2015717     3  0.4916     0.6730 0.184 0.000 0.760 0.056
#> SRR2015716     4  0.7402     0.6063 0.036 0.288 0.100 0.576
#> SRR2015714     2  0.4936     0.5140 0.000 0.652 0.340 0.008
#> SRR2015713     3  0.5750     0.6300 0.028 0.000 0.532 0.440
#> SRR2015784     2  0.1474     0.6577 0.000 0.948 0.000 0.052
#> SRR2015785     4  0.5000     0.6623 0.000 0.500 0.000 0.500
#> SRR2015783     1  0.0000     0.7837 1.000 0.000 0.000 0.000
#> SRR2015782     2  0.4431    -0.0666 0.000 0.696 0.000 0.304
#> SRR2015781     2  0.2473     0.6665 0.000 0.908 0.080 0.012
#> SRR2015780     2  0.1792     0.6471 0.000 0.932 0.000 0.068
#> SRR2015779     2  0.0376     0.6779 0.000 0.992 0.004 0.004
#> SRR2015778     1  0.7888     0.2141 0.444 0.044 0.100 0.412
#> SRR2015777     2  0.6633     0.2315 0.000 0.500 0.084 0.416
#> SRR2015776     2  0.3142     0.6462 0.000 0.860 0.132 0.008
#> SRR2015775     4  0.4994     0.6917 0.000 0.480 0.000 0.520
#> SRR2015774     2  0.2101     0.6549 0.000 0.928 0.012 0.060
#> SRR2015773     2  0.1792     0.6471 0.000 0.932 0.000 0.068
#> SRR2015772     2  0.1792     0.6471 0.000 0.932 0.000 0.068
#> SRR2015771     1  0.5815     0.3386 0.652 0.000 0.288 0.060
#> SRR2015769     4  0.4994     0.6917 0.000 0.480 0.000 0.520
#> SRR2015770     2  0.2149     0.6205 0.000 0.912 0.000 0.088
#> SRR2015768     2  0.2149     0.6205 0.000 0.912 0.000 0.088
#> SRR2015767     2  0.3142     0.6462 0.000 0.860 0.132 0.008
#> SRR2015766     3  0.2611     0.6368 0.000 0.096 0.896 0.008
#> SRR2015764     2  0.0376     0.6779 0.000 0.992 0.004 0.004
#> SRR2015765     4  0.5917     0.6825 0.000 0.444 0.036 0.520
#> SRR2015763     1  0.6121     0.1693 0.588 0.000 0.352 0.060
#> SRR2015762     2  0.5038     0.5155 0.000 0.652 0.336 0.012
#> SRR2015761     2  0.5024     0.4938 0.000 0.632 0.360 0.008
#> SRR2015760     3  0.4514     0.7100 0.136 0.000 0.800 0.064

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>            class entropy silhouette    p1    p2    p3    p4    p5
#> SRR2015715     1  0.6564      0.520 0.616 0.000 0.152 0.172 0.060
#> SRR2015735     3  0.4045      0.429 0.356 0.000 0.644 0.000 0.000
#> SRR2015759     1  0.0000      0.864 1.000 0.000 0.000 0.000 0.000
#> SRR2015753     1  0.0000      0.864 1.000 0.000 0.000 0.000 0.000
#> SRR2015746     4  0.3484      0.717 0.152 0.024 0.004 0.820 0.000
#> SRR2015758     2  0.1653      0.848 0.000 0.944 0.004 0.028 0.024
#> SRR2015756     1  0.0000      0.864 1.000 0.000 0.000 0.000 0.000
#> SRR2015757     4  0.3890      0.611 0.004 0.000 0.168 0.792 0.036
#> SRR2015755     1  0.1121      0.844 0.956 0.000 0.044 0.000 0.000
#> SRR2015754     1  0.3862      0.722 0.808 0.000 0.104 0.088 0.000
#> SRR2015752     1  0.0000      0.864 1.000 0.000 0.000 0.000 0.000
#> SRR2015749     1  0.1121      0.840 0.956 0.000 0.000 0.044 0.000
#> SRR2015750     5  0.5812      0.336 0.000 0.100 0.000 0.372 0.528
#> SRR2015751     4  0.2891      0.704 0.176 0.000 0.000 0.824 0.000
#> SRR2015748     5  0.2659      0.825 0.000 0.060 0.052 0.000 0.888
#> SRR2015747     1  0.0000      0.864 1.000 0.000 0.000 0.000 0.000
#> SRR2015745     4  0.3876      0.484 0.000 0.316 0.000 0.684 0.000
#> SRR2015743     1  0.0000      0.864 1.000 0.000 0.000 0.000 0.000
#> SRR2015744     2  0.3480      0.626 0.000 0.752 0.000 0.248 0.000
#> SRR2015742     4  0.3807      0.706 0.072 0.012 0.088 0.828 0.000
#> SRR2015741     1  0.0963      0.849 0.964 0.000 0.036 0.000 0.000
#> SRR2015740     1  0.0000      0.864 1.000 0.000 0.000 0.000 0.000
#> SRR2015738     1  0.3909      0.623 0.760 0.000 0.024 0.216 0.000
#> SRR2015739     1  0.0000      0.864 1.000 0.000 0.000 0.000 0.000
#> SRR2015737     2  0.2516      0.830 0.000 0.860 0.000 0.000 0.140
#> SRR2015736     3  0.4726      0.661 0.008 0.000 0.716 0.228 0.048
#> SRR2015732     1  0.1410      0.842 0.940 0.000 0.000 0.060 0.000
#> SRR2015733     4  0.3152      0.663 0.000 0.024 0.136 0.840 0.000
#> SRR2015734     1  0.3714      0.745 0.808 0.000 0.016 0.160 0.016
#> SRR2015731     3  0.1644      0.796 0.000 0.048 0.940 0.008 0.004
#> SRR2015730     1  0.0162      0.863 0.996 0.000 0.000 0.004 0.000
#> SRR2015728     3  0.4728      0.716 0.116 0.008 0.772 0.092 0.012
#> SRR2015729     5  0.1410      0.857 0.000 0.060 0.000 0.000 0.940
#> SRR2015727     3  0.1357      0.795 0.000 0.048 0.948 0.000 0.004
#> SRR2015726     5  0.3366      0.609 0.232 0.000 0.000 0.000 0.768
#> SRR2015723     5  0.1121      0.854 0.000 0.044 0.000 0.000 0.956
#> SRR2015724     1  0.7803      0.127 0.436 0.000 0.284 0.184 0.096
#> SRR2015725     1  0.2017      0.825 0.912 0.000 0.008 0.080 0.000
#> SRR2015722     3  0.1357      0.795 0.000 0.048 0.948 0.000 0.004
#> SRR2015721     3  0.3822      0.755 0.012 0.000 0.816 0.132 0.040
#> SRR2015720     4  0.3885      0.602 0.000 0.000 0.176 0.784 0.040
#> SRR2015718     5  0.1310      0.832 0.000 0.020 0.024 0.000 0.956
#> SRR2015719     2  0.2848      0.775 0.000 0.840 0.156 0.000 0.004
#> SRR2015717     3  0.3288      0.785 0.044 0.000 0.868 0.060 0.028
#> SRR2015716     5  0.1372      0.830 0.004 0.016 0.024 0.000 0.956
#> SRR2015714     2  0.2806      0.778 0.000 0.844 0.152 0.000 0.004
#> SRR2015713     4  0.3958      0.597 0.000 0.000 0.176 0.780 0.044
#> SRR2015784     2  0.2329      0.837 0.000 0.876 0.000 0.000 0.124
#> SRR2015785     5  0.2732      0.784 0.000 0.160 0.000 0.000 0.840
#> SRR2015783     1  0.0000      0.864 1.000 0.000 0.000 0.000 0.000
#> SRR2015782     5  0.5671      0.395 0.000 0.336 0.000 0.096 0.568
#> SRR2015781     2  0.0693      0.848 0.000 0.980 0.000 0.008 0.012
#> SRR2015780     2  0.2690      0.820 0.000 0.844 0.000 0.000 0.156
#> SRR2015779     2  0.1493      0.849 0.000 0.948 0.000 0.024 0.028
#> SRR2015778     4  0.3280      0.714 0.160 0.012 0.004 0.824 0.000
#> SRR2015777     4  0.2891      0.671 0.000 0.176 0.000 0.824 0.000
#> SRR2015776     2  0.1544      0.829 0.000 0.932 0.068 0.000 0.000
#> SRR2015775     5  0.1410      0.857 0.000 0.060 0.000 0.000 0.940
#> SRR2015774     2  0.3106      0.838 0.000 0.844 0.024 0.000 0.132
#> SRR2015773     2  0.2516      0.830 0.000 0.860 0.000 0.000 0.140
#> SRR2015772     2  0.2516      0.830 0.000 0.860 0.000 0.000 0.140
#> SRR2015771     1  0.6398      0.555 0.636 0.000 0.128 0.172 0.064
#> SRR2015769     5  0.1410      0.857 0.000 0.060 0.000 0.000 0.940
#> SRR2015770     2  0.3395      0.726 0.000 0.764 0.000 0.000 0.236
#> SRR2015768     2  0.3480      0.709 0.000 0.752 0.000 0.000 0.248
#> SRR2015767     2  0.1608      0.827 0.000 0.928 0.072 0.000 0.000
#> SRR2015766     3  0.1704      0.783 0.000 0.068 0.928 0.000 0.004
#> SRR2015764     2  0.1525      0.850 0.000 0.948 0.004 0.012 0.036
#> SRR2015765     5  0.1628      0.856 0.000 0.056 0.008 0.000 0.936
#> SRR2015763     1  0.6280      0.544 0.636 0.000 0.148 0.172 0.044
#> SRR2015762     2  0.2233      0.809 0.000 0.892 0.104 0.000 0.004
#> SRR2015761     2  0.3123      0.748 0.000 0.812 0.184 0.000 0.004
#> SRR2015760     3  0.2775      0.789 0.000 0.008 0.888 0.068 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
#> SRR2015715     4  0.3023     0.6756 0.180 0.000 0.008 0.808 0.000 0.004
#> SRR2015735     3  0.3101     0.5800 0.244 0.000 0.756 0.000 0.000 0.000
#> SRR2015759     1  0.0000     0.9227 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2015753     1  0.0000     0.9227 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2015746     5  0.0632     0.7638 0.024 0.000 0.000 0.000 0.976 0.000
#> SRR2015758     2  0.1269     0.8373 0.000 0.956 0.000 0.012 0.020 0.012
#> SRR2015756     1  0.0000     0.9227 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2015757     4  0.3969     0.5364 0.000 0.004 0.008 0.644 0.344 0.000
#> SRR2015755     1  0.0937     0.9018 0.960 0.000 0.040 0.000 0.000 0.000
#> SRR2015754     1  0.3633     0.7613 0.800 0.000 0.076 0.004 0.120 0.000
#> SRR2015752     1  0.0000     0.9227 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2015749     1  0.1007     0.8979 0.956 0.000 0.000 0.000 0.044 0.000
#> SRR2015750     6  0.5262     0.2200 0.000 0.084 0.000 0.004 0.416 0.496
#> SRR2015751     5  0.0713     0.7633 0.028 0.000 0.000 0.000 0.972 0.000
#> SRR2015748     6  0.3104     0.7787 0.000 0.032 0.060 0.040 0.004 0.864
#> SRR2015747     1  0.0000     0.9227 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2015745     5  0.3105     0.6693 0.000 0.108 0.000 0.036 0.844 0.012
#> SRR2015743     1  0.0260     0.9198 0.992 0.000 0.000 0.008 0.000 0.000
#> SRR2015744     5  0.5329    -0.0455 0.000 0.444 0.000 0.104 0.452 0.000
#> SRR2015742     5  0.1078     0.7585 0.012 0.000 0.016 0.008 0.964 0.000
#> SRR2015741     1  0.0865     0.9046 0.964 0.000 0.036 0.000 0.000 0.000
#> SRR2015740     1  0.0000     0.9227 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2015738     1  0.3623     0.6967 0.764 0.000 0.020 0.008 0.208 0.000
#> SRR2015739     1  0.0000     0.9227 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2015737     2  0.2850     0.8220 0.000 0.856 0.000 0.016 0.016 0.112
#> SRR2015736     4  0.4029     0.3773 0.000 0.000 0.292 0.680 0.028 0.000
#> SRR2015732     1  0.1910     0.8324 0.892 0.000 0.000 0.108 0.000 0.000
#> SRR2015733     5  0.4891    -0.1499 0.000 0.020 0.028 0.412 0.540 0.000
#> SRR2015734     1  0.3807     0.2769 0.628 0.000 0.000 0.368 0.000 0.004
#> SRR2015731     3  0.0000     0.7788 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2015730     1  0.0146     0.9213 0.996 0.000 0.000 0.004 0.000 0.000
#> SRR2015728     3  0.5121     0.4604 0.068 0.000 0.616 0.300 0.012 0.004
#> SRR2015729     6  0.0146     0.8210 0.000 0.004 0.000 0.000 0.000 0.996
#> SRR2015727     3  0.0146     0.7788 0.000 0.004 0.996 0.000 0.000 0.000
#> SRR2015726     6  0.2668     0.6824 0.168 0.000 0.000 0.004 0.000 0.828
#> SRR2015723     6  0.1196     0.8124 0.000 0.000 0.000 0.040 0.008 0.952
#> SRR2015724     4  0.2622     0.6737 0.088 0.008 0.008 0.880 0.000 0.016
#> SRR2015725     1  0.1444     0.8721 0.928 0.000 0.000 0.072 0.000 0.000
#> SRR2015722     3  0.0146     0.7788 0.000 0.004 0.996 0.000 0.000 0.000
#> SRR2015721     3  0.3982     0.2140 0.004 0.000 0.536 0.460 0.000 0.000
#> SRR2015720     4  0.3861     0.5758 0.000 0.004 0.008 0.672 0.316 0.000
#> SRR2015718     6  0.4009     0.7074 0.000 0.032 0.008 0.196 0.008 0.756
#> SRR2015719     2  0.4719     0.6689 0.000 0.680 0.216 0.100 0.004 0.000
#> SRR2015717     3  0.3125     0.7314 0.032 0.000 0.828 0.136 0.000 0.004
#> SRR2015716     6  0.3166     0.7303 0.000 0.000 0.008 0.184 0.008 0.800
#> SRR2015714     2  0.4497     0.7025 0.000 0.712 0.184 0.100 0.004 0.000
#> SRR2015713     4  0.3521     0.6163 0.000 0.004 0.004 0.724 0.268 0.000
#> SRR2015784     2  0.2468     0.8317 0.000 0.880 0.000 0.008 0.016 0.096
#> SRR2015785     6  0.2412     0.7752 0.000 0.092 0.000 0.028 0.000 0.880
#> SRR2015783     1  0.0000     0.9227 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2015782     6  0.5676     0.3725 0.000 0.280 0.000 0.004 0.176 0.540
#> SRR2015781     2  0.1958     0.8183 0.000 0.896 0.000 0.100 0.000 0.004
#> SRR2015780     2  0.3624     0.7995 0.000 0.784 0.000 0.060 0.000 0.156
#> SRR2015779     2  0.1546     0.8377 0.000 0.944 0.000 0.020 0.020 0.016
#> SRR2015778     5  0.0713     0.7633 0.028 0.000 0.000 0.000 0.972 0.000
#> SRR2015777     5  0.0363     0.7566 0.000 0.012 0.000 0.000 0.988 0.000
#> SRR2015776     2  0.2942     0.8057 0.000 0.856 0.036 0.100 0.004 0.004
#> SRR2015775     6  0.0146     0.8210 0.000 0.004 0.000 0.000 0.000 0.996
#> SRR2015774     2  0.2547     0.8413 0.000 0.880 0.000 0.036 0.004 0.080
#> SRR2015773     2  0.2804     0.8244 0.000 0.860 0.000 0.016 0.016 0.108
#> SRR2015772     2  0.2804     0.8244 0.000 0.860 0.000 0.016 0.016 0.108
#> SRR2015771     4  0.3056     0.6737 0.184 0.000 0.004 0.804 0.000 0.008
#> SRR2015769     6  0.0146     0.8210 0.000 0.004 0.000 0.000 0.000 0.996
#> SRR2015770     2  0.3515     0.7544 0.000 0.780 0.000 0.012 0.016 0.192
#> SRR2015768     2  0.3605     0.7521 0.000 0.776 0.000 0.016 0.016 0.192
#> SRR2015767     2  0.3144     0.8003 0.000 0.844 0.048 0.100 0.004 0.004
#> SRR2015766     3  0.1390     0.7529 0.000 0.016 0.948 0.032 0.004 0.000
#> SRR2015764     2  0.1078     0.8379 0.000 0.964 0.000 0.008 0.016 0.012
#> SRR2015765     6  0.0582     0.8201 0.000 0.004 0.004 0.004 0.004 0.984
#> SRR2015763     4  0.3844     0.5781 0.312 0.000 0.008 0.676 0.000 0.004
#> SRR2015762     2  0.2822     0.8063 0.000 0.864 0.056 0.076 0.004 0.000
#> SRR2015761     2  0.4141     0.7243 0.000 0.740 0.188 0.068 0.004 0.000
#> SRR2015760     3  0.2632     0.7213 0.000 0.000 0.832 0.164 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-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

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 17223 rows and 73 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.914           0.916       0.967         0.5059 0.494   0.494
#> 3 3 0.893           0.893       0.955         0.3108 0.811   0.632
#> 4 4 0.891           0.854       0.938         0.0676 0.957   0.875
#> 5 5 0.782           0.674       0.862         0.0633 0.932   0.783
#> 6 6 0.878           0.855       0.937         0.0552 0.908   0.670

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
#> SRR2015715     1  0.0000      0.963 1.000 0.000
#> SRR2015735     1  0.0000      0.963 1.000 0.000
#> SRR2015759     1  0.0000      0.963 1.000 0.000
#> SRR2015753     1  0.0000      0.963 1.000 0.000
#> SRR2015746     1  0.8555      0.597 0.720 0.280
#> SRR2015758     2  0.0000      0.965 0.000 1.000
#> SRR2015756     1  0.0000      0.963 1.000 0.000
#> SRR2015757     1  0.6048      0.815 0.852 0.148
#> SRR2015755     1  0.0000      0.963 1.000 0.000
#> SRR2015754     1  0.0000      0.963 1.000 0.000
#> SRR2015752     1  0.0000      0.963 1.000 0.000
#> SRR2015749     1  0.0000      0.963 1.000 0.000
#> SRR2015750     2  0.0000      0.965 0.000 1.000
#> SRR2015751     1  0.0000      0.963 1.000 0.000
#> SRR2015748     2  0.0376      0.962 0.004 0.996
#> SRR2015747     1  0.0000      0.963 1.000 0.000
#> SRR2015745     2  0.0000      0.965 0.000 1.000
#> SRR2015743     1  0.0000      0.963 1.000 0.000
#> SRR2015744     2  0.8955      0.532 0.312 0.688
#> SRR2015742     1  0.0000      0.963 1.000 0.000
#> SRR2015741     1  0.0000      0.963 1.000 0.000
#> SRR2015740     1  0.0000      0.963 1.000 0.000
#> SRR2015738     1  0.0000      0.963 1.000 0.000
#> SRR2015739     1  0.0000      0.963 1.000 0.000
#> SRR2015737     2  0.0000      0.965 0.000 1.000
#> SRR2015736     1  0.8861      0.567 0.696 0.304
#> SRR2015732     1  0.0000      0.963 1.000 0.000
#> SRR2015733     2  0.9286      0.451 0.344 0.656
#> SRR2015734     1  0.0000      0.963 1.000 0.000
#> SRR2015731     1  0.0376      0.960 0.996 0.004
#> SRR2015730     1  0.0000      0.963 1.000 0.000
#> SRR2015728     1  0.3431      0.910 0.936 0.064
#> SRR2015729     2  0.0000      0.965 0.000 1.000
#> SRR2015727     1  0.3879      0.898 0.924 0.076
#> SRR2015726     1  0.0000      0.963 1.000 0.000
#> SRR2015723     2  0.0000      0.965 0.000 1.000
#> SRR2015724     1  0.1414      0.947 0.980 0.020
#> SRR2015725     1  0.0000      0.963 1.000 0.000
#> SRR2015722     1  0.0000      0.963 1.000 0.000
#> SRR2015721     1  0.9754      0.316 0.592 0.408
#> SRR2015720     1  0.0000      0.963 1.000 0.000
#> SRR2015718     2  0.0000      0.965 0.000 1.000
#> SRR2015719     2  0.0000      0.965 0.000 1.000
#> SRR2015717     1  0.0000      0.963 1.000 0.000
#> SRR2015716     2  0.0000      0.965 0.000 1.000
#> SRR2015714     2  0.0000      0.965 0.000 1.000
#> SRR2015713     2  0.9922      0.154 0.448 0.552
#> SRR2015784     2  0.0000      0.965 0.000 1.000
#> SRR2015785     2  0.0000      0.965 0.000 1.000
#> SRR2015783     1  0.0000      0.963 1.000 0.000
#> SRR2015782     2  0.0000      0.965 0.000 1.000
#> SRR2015781     2  0.0000      0.965 0.000 1.000
#> SRR2015780     2  0.0000      0.965 0.000 1.000
#> SRR2015779     2  0.0000      0.965 0.000 1.000
#> SRR2015778     1  0.0000      0.963 1.000 0.000
#> SRR2015777     2  0.0000      0.965 0.000 1.000
#> SRR2015776     2  0.0000      0.965 0.000 1.000
#> SRR2015775     2  0.0000      0.965 0.000 1.000
#> SRR2015774     2  0.0000      0.965 0.000 1.000
#> SRR2015773     2  0.0000      0.965 0.000 1.000
#> SRR2015772     2  0.0000      0.965 0.000 1.000
#> SRR2015771     1  0.0000      0.963 1.000 0.000
#> SRR2015769     2  0.0000      0.965 0.000 1.000
#> SRR2015770     2  0.0000      0.965 0.000 1.000
#> SRR2015768     2  0.0000      0.965 0.000 1.000
#> SRR2015767     2  0.0000      0.965 0.000 1.000
#> SRR2015766     2  0.0000      0.965 0.000 1.000
#> SRR2015764     2  0.0000      0.965 0.000 1.000
#> SRR2015765     2  0.0000      0.965 0.000 1.000
#> SRR2015763     1  0.0000      0.963 1.000 0.000
#> SRR2015762     2  0.0000      0.965 0.000 1.000
#> SRR2015761     2  0.0000      0.965 0.000 1.000
#> SRR2015760     1  0.0000      0.963 1.000 0.000

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>            class entropy silhouette    p1    p2    p3
#> SRR2015715     3  0.4974      0.701 0.236 0.000 0.764
#> SRR2015735     1  0.0892      0.967 0.980 0.000 0.020
#> SRR2015759     1  0.0000      0.987 1.000 0.000 0.000
#> SRR2015753     1  0.0000      0.987 1.000 0.000 0.000
#> SRR2015746     3  0.6111      0.388 0.396 0.000 0.604
#> SRR2015758     2  0.0000      0.945 0.000 1.000 0.000
#> SRR2015756     1  0.0000      0.987 1.000 0.000 0.000
#> SRR2015757     3  0.0829      0.913 0.004 0.012 0.984
#> SRR2015755     1  0.0000      0.987 1.000 0.000 0.000
#> SRR2015754     1  0.0000      0.987 1.000 0.000 0.000
#> SRR2015752     1  0.0000      0.987 1.000 0.000 0.000
#> SRR2015749     1  0.0000      0.987 1.000 0.000 0.000
#> SRR2015750     2  0.0000      0.945 0.000 1.000 0.000
#> SRR2015751     1  0.4974      0.654 0.764 0.000 0.236
#> SRR2015748     2  0.0983      0.932 0.004 0.980 0.016
#> SRR2015747     1  0.0000      0.987 1.000 0.000 0.000
#> SRR2015745     2  0.3192      0.843 0.000 0.888 0.112
#> SRR2015743     1  0.0000      0.987 1.000 0.000 0.000
#> SRR2015744     2  0.7039      0.492 0.312 0.648 0.040
#> SRR2015742     3  0.0000      0.920 0.000 0.000 1.000
#> SRR2015741     1  0.0000      0.987 1.000 0.000 0.000
#> SRR2015740     1  0.0000      0.987 1.000 0.000 0.000
#> SRR2015738     1  0.0000      0.987 1.000 0.000 0.000
#> SRR2015739     1  0.0000      0.987 1.000 0.000 0.000
#> SRR2015737     2  0.0000      0.945 0.000 1.000 0.000
#> SRR2015736     3  0.0000      0.920 0.000 0.000 1.000
#> SRR2015732     1  0.0000      0.987 1.000 0.000 0.000
#> SRR2015733     3  0.0000      0.920 0.000 0.000 1.000
#> SRR2015734     1  0.0000      0.987 1.000 0.000 0.000
#> SRR2015731     3  0.0000      0.920 0.000 0.000 1.000
#> SRR2015730     1  0.0000      0.987 1.000 0.000 0.000
#> SRR2015728     3  0.0000      0.920 0.000 0.000 1.000
#> SRR2015729     2  0.0000      0.945 0.000 1.000 0.000
#> SRR2015727     3  0.0000      0.920 0.000 0.000 1.000
#> SRR2015726     1  0.0000      0.987 1.000 0.000 0.000
#> SRR2015723     2  0.0000      0.945 0.000 1.000 0.000
#> SRR2015724     3  0.0747      0.912 0.016 0.000 0.984
#> SRR2015725     1  0.0000      0.987 1.000 0.000 0.000
#> SRR2015722     3  0.0000      0.920 0.000 0.000 1.000
#> SRR2015721     3  0.0000      0.920 0.000 0.000 1.000
#> SRR2015720     3  0.0000      0.920 0.000 0.000 1.000
#> SRR2015718     2  0.0000      0.945 0.000 1.000 0.000
#> SRR2015719     2  0.0747      0.934 0.000 0.984 0.016
#> SRR2015717     3  0.0000      0.920 0.000 0.000 1.000
#> SRR2015716     2  0.6260      0.207 0.000 0.552 0.448
#> SRR2015714     2  0.0000      0.945 0.000 1.000 0.000
#> SRR2015713     3  0.0747      0.910 0.000 0.016 0.984
#> SRR2015784     2  0.0000      0.945 0.000 1.000 0.000
#> SRR2015785     2  0.0000      0.945 0.000 1.000 0.000
#> SRR2015783     1  0.0000      0.987 1.000 0.000 0.000
#> SRR2015782     2  0.0000      0.945 0.000 1.000 0.000
#> SRR2015781     2  0.0000      0.945 0.000 1.000 0.000
#> SRR2015780     2  0.0000      0.945 0.000 1.000 0.000
#> SRR2015779     2  0.0000      0.945 0.000 1.000 0.000
#> SRR2015778     3  0.5254      0.654 0.264 0.000 0.736
#> SRR2015777     2  0.5810      0.511 0.000 0.664 0.336
#> SRR2015776     2  0.0000      0.945 0.000 1.000 0.000
#> SRR2015775     2  0.0000      0.945 0.000 1.000 0.000
#> SRR2015774     2  0.0000      0.945 0.000 1.000 0.000
#> SRR2015773     2  0.0000      0.945 0.000 1.000 0.000
#> SRR2015772     2  0.0000      0.945 0.000 1.000 0.000
#> SRR2015771     3  0.6235      0.280 0.436 0.000 0.564
#> SRR2015769     2  0.0000      0.945 0.000 1.000 0.000
#> SRR2015770     2  0.0000      0.945 0.000 1.000 0.000
#> SRR2015768     2  0.0000      0.945 0.000 1.000 0.000
#> SRR2015767     2  0.0000      0.945 0.000 1.000 0.000
#> SRR2015766     3  0.0000      0.920 0.000 0.000 1.000
#> SRR2015764     2  0.0000      0.945 0.000 1.000 0.000
#> SRR2015765     2  0.0237      0.942 0.000 0.996 0.004
#> SRR2015763     1  0.0000      0.987 1.000 0.000 0.000
#> SRR2015762     2  0.0000      0.945 0.000 1.000 0.000
#> SRR2015761     2  0.5882      0.486 0.000 0.652 0.348
#> SRR2015760     3  0.0000      0.920 0.000 0.000 1.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> SRR2015715     3  0.3764      0.677 0.216 0.000 0.784 0.000
#> SRR2015735     1  0.2053      0.903 0.924 0.000 0.004 0.072
#> SRR2015759     1  0.0000      0.979 1.000 0.000 0.000 0.000
#> SRR2015753     1  0.0000      0.979 1.000 0.000 0.000 0.000
#> SRR2015746     3  0.4843      0.392 0.396 0.000 0.604 0.000
#> SRR2015758     2  0.0000      0.897 0.000 1.000 0.000 0.000
#> SRR2015756     1  0.0000      0.979 1.000 0.000 0.000 0.000
#> SRR2015757     3  0.0000      0.880 0.000 0.000 1.000 0.000
#> SRR2015755     1  0.0000      0.979 1.000 0.000 0.000 0.000
#> SRR2015754     1  0.0000      0.979 1.000 0.000 0.000 0.000
#> SRR2015752     1  0.0000      0.979 1.000 0.000 0.000 0.000
#> SRR2015749     1  0.0000      0.979 1.000 0.000 0.000 0.000
#> SRR2015750     2  0.1474      0.862 0.000 0.948 0.052 0.000
#> SRR2015751     1  0.4382      0.550 0.704 0.000 0.296 0.000
#> SRR2015748     2  0.2053      0.847 0.004 0.924 0.000 0.072
#> SRR2015747     1  0.0000      0.979 1.000 0.000 0.000 0.000
#> SRR2015745     2  0.2469      0.808 0.000 0.892 0.108 0.000
#> SRR2015743     1  0.0000      0.979 1.000 0.000 0.000 0.000
#> SRR2015744     2  0.5947      0.396 0.312 0.628 0.060 0.000
#> SRR2015742     3  0.0188      0.879 0.004 0.000 0.996 0.000
#> SRR2015741     1  0.0000      0.979 1.000 0.000 0.000 0.000
#> SRR2015740     1  0.0000      0.979 1.000 0.000 0.000 0.000
#> SRR2015738     1  0.0000      0.979 1.000 0.000 0.000 0.000
#> SRR2015739     1  0.0000      0.979 1.000 0.000 0.000 0.000
#> SRR2015737     2  0.0000      0.897 0.000 1.000 0.000 0.000
#> SRR2015736     3  0.0000      0.880 0.000 0.000 1.000 0.000
#> SRR2015732     1  0.0000      0.979 1.000 0.000 0.000 0.000
#> SRR2015733     3  0.0188      0.878 0.000 0.004 0.996 0.000
#> SRR2015734     1  0.0188      0.975 0.996 0.000 0.004 0.000
#> SRR2015731     3  0.1867      0.862 0.000 0.000 0.928 0.072
#> SRR2015730     1  0.0000      0.979 1.000 0.000 0.000 0.000
#> SRR2015728     3  0.0188      0.880 0.000 0.000 0.996 0.004
#> SRR2015729     2  0.0469      0.894 0.000 0.988 0.000 0.012
#> SRR2015727     3  0.1867      0.862 0.000 0.000 0.928 0.072
#> SRR2015726     1  0.0000      0.979 1.000 0.000 0.000 0.000
#> SRR2015723     2  0.0657      0.892 0.000 0.984 0.004 0.012
#> SRR2015724     3  0.0000      0.880 0.000 0.000 1.000 0.000
#> SRR2015725     1  0.0000      0.979 1.000 0.000 0.000 0.000
#> SRR2015722     3  0.1867      0.862 0.000 0.000 0.928 0.072
#> SRR2015721     3  0.0000      0.880 0.000 0.000 1.000 0.000
#> SRR2015720     3  0.0000      0.880 0.000 0.000 1.000 0.000
#> SRR2015718     2  0.0188      0.896 0.000 0.996 0.004 0.000
#> SRR2015719     4  0.0469      0.906 0.000 0.012 0.000 0.988
#> SRR2015717     3  0.1792      0.863 0.000 0.000 0.932 0.068
#> SRR2015716     2  0.4898      0.294 0.000 0.584 0.416 0.000
#> SRR2015714     4  0.2081      0.960 0.000 0.084 0.000 0.916
#> SRR2015713     3  0.0000      0.880 0.000 0.000 1.000 0.000
#> SRR2015784     2  0.0000      0.897 0.000 1.000 0.000 0.000
#> SRR2015785     2  0.0336      0.895 0.000 0.992 0.000 0.008
#> SRR2015783     1  0.0000      0.979 1.000 0.000 0.000 0.000
#> SRR2015782     2  0.0000      0.897 0.000 1.000 0.000 0.000
#> SRR2015781     2  0.0000      0.897 0.000 1.000 0.000 0.000
#> SRR2015780     2  0.0000      0.897 0.000 1.000 0.000 0.000
#> SRR2015779     2  0.0000      0.897 0.000 1.000 0.000 0.000
#> SRR2015778     3  0.4103      0.632 0.256 0.000 0.744 0.000
#> SRR2015777     2  0.4804      0.433 0.000 0.616 0.384 0.000
#> SRR2015776     4  0.2081      0.964 0.000 0.084 0.000 0.916
#> SRR2015775     2  0.0469      0.894 0.000 0.988 0.000 0.012
#> SRR2015774     2  0.0000      0.897 0.000 1.000 0.000 0.000
#> SRR2015773     2  0.0000      0.897 0.000 1.000 0.000 0.000
#> SRR2015772     2  0.0000      0.897 0.000 1.000 0.000 0.000
#> SRR2015771     3  0.4898      0.318 0.416 0.000 0.584 0.000
#> SRR2015769     2  0.0469      0.894 0.000 0.988 0.000 0.012
#> SRR2015770     2  0.0000      0.897 0.000 1.000 0.000 0.000
#> SRR2015768     2  0.0000      0.897 0.000 1.000 0.000 0.000
#> SRR2015767     4  0.2081      0.964 0.000 0.084 0.000 0.916
#> SRR2015766     3  0.1867      0.862 0.000 0.000 0.928 0.072
#> SRR2015764     2  0.0000      0.897 0.000 1.000 0.000 0.000
#> SRR2015765     2  0.1389      0.868 0.000 0.952 0.000 0.048
#> SRR2015763     1  0.0188      0.975 0.996 0.000 0.004 0.000
#> SRR2015762     2  0.4837      0.408 0.000 0.648 0.004 0.348
#> SRR2015761     2  0.5213      0.473 0.000 0.652 0.328 0.020
#> SRR2015760     3  0.0921      0.875 0.000 0.000 0.972 0.028

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>            class entropy silhouette    p1    p2    p3    p4    p5
#> SRR2015715     3  0.2813     0.6128 0.168 0.000 0.832 0.000 0.000
#> SRR2015735     1  0.4706     0.2155 0.496 0.000 0.004 0.008 0.492
#> SRR2015759     1  0.0000     0.9695 1.000 0.000 0.000 0.000 0.000
#> SRR2015753     1  0.0000     0.9695 1.000 0.000 0.000 0.000 0.000
#> SRR2015746     3  0.4219     0.3731 0.416 0.000 0.584 0.000 0.000
#> SRR2015758     2  0.0000     0.7372 0.000 1.000 0.000 0.000 0.000
#> SRR2015756     1  0.0000     0.9695 1.000 0.000 0.000 0.000 0.000
#> SRR2015757     3  0.0000     0.7078 0.000 0.000 1.000 0.000 0.000
#> SRR2015755     1  0.0000     0.9695 1.000 0.000 0.000 0.000 0.000
#> SRR2015754     1  0.0000     0.9695 1.000 0.000 0.000 0.000 0.000
#> SRR2015752     1  0.0000     0.9695 1.000 0.000 0.000 0.000 0.000
#> SRR2015749     1  0.0000     0.9695 1.000 0.000 0.000 0.000 0.000
#> SRR2015750     2  0.4235     0.1143 0.000 0.576 0.424 0.000 0.000
#> SRR2015751     3  0.4182     0.3294 0.400 0.000 0.600 0.000 0.000
#> SRR2015748     5  0.3728     0.1711 0.000 0.244 0.000 0.008 0.748
#> SRR2015747     1  0.0000     0.9695 1.000 0.000 0.000 0.000 0.000
#> SRR2015745     2  0.2127     0.5886 0.000 0.892 0.108 0.000 0.000
#> SRR2015743     1  0.0000     0.9695 1.000 0.000 0.000 0.000 0.000
#> SRR2015744     2  0.6510     0.0133 0.260 0.488 0.252 0.000 0.000
#> SRR2015742     3  0.0794     0.7021 0.028 0.000 0.972 0.000 0.000
#> SRR2015741     1  0.0000     0.9695 1.000 0.000 0.000 0.000 0.000
#> SRR2015740     1  0.0000     0.9695 1.000 0.000 0.000 0.000 0.000
#> SRR2015738     1  0.0000     0.9695 1.000 0.000 0.000 0.000 0.000
#> SRR2015739     1  0.0000     0.9695 1.000 0.000 0.000 0.000 0.000
#> SRR2015737     2  0.0000     0.7372 0.000 1.000 0.000 0.000 0.000
#> SRR2015736     3  0.0000     0.7078 0.000 0.000 1.000 0.000 0.000
#> SRR2015732     1  0.0000     0.9695 1.000 0.000 0.000 0.000 0.000
#> SRR2015733     3  0.0794     0.6971 0.000 0.028 0.972 0.000 0.000
#> SRR2015734     1  0.0794     0.9418 0.972 0.000 0.028 0.000 0.000
#> SRR2015731     3  0.4562     0.5052 0.000 0.000 0.500 0.008 0.492
#> SRR2015730     1  0.0000     0.9695 1.000 0.000 0.000 0.000 0.000
#> SRR2015728     3  0.0880     0.7056 0.000 0.000 0.968 0.000 0.032
#> SRR2015729     5  0.4560     0.6358 0.000 0.484 0.000 0.008 0.508
#> SRR2015727     3  0.4562     0.5052 0.000 0.000 0.500 0.008 0.492
#> SRR2015726     1  0.0000     0.9695 1.000 0.000 0.000 0.000 0.000
#> SRR2015723     2  0.4764    -0.5700 0.000 0.548 0.012 0.004 0.436
#> SRR2015724     3  0.0000     0.7078 0.000 0.000 1.000 0.000 0.000
#> SRR2015725     1  0.0000     0.9695 1.000 0.000 0.000 0.000 0.000
#> SRR2015722     3  0.4562     0.5052 0.000 0.000 0.500 0.008 0.492
#> SRR2015721     3  0.0162     0.7078 0.000 0.000 0.996 0.000 0.004
#> SRR2015720     3  0.0000     0.7078 0.000 0.000 1.000 0.000 0.000
#> SRR2015718     2  0.1399     0.6872 0.000 0.952 0.028 0.000 0.020
#> SRR2015719     4  0.0290     0.9733 0.000 0.000 0.000 0.992 0.008
#> SRR2015717     3  0.4549     0.5164 0.000 0.000 0.528 0.008 0.464
#> SRR2015716     2  0.4584    -0.0942 0.000 0.660 0.028 0.000 0.312
#> SRR2015714     4  0.0609     0.9798 0.000 0.020 0.000 0.980 0.000
#> SRR2015713     3  0.0000     0.7078 0.000 0.000 1.000 0.000 0.000
#> SRR2015784     2  0.0000     0.7372 0.000 1.000 0.000 0.000 0.000
#> SRR2015785     2  0.1478     0.6634 0.000 0.936 0.000 0.000 0.064
#> SRR2015783     1  0.0000     0.9695 1.000 0.000 0.000 0.000 0.000
#> SRR2015782     2  0.0000     0.7372 0.000 1.000 0.000 0.000 0.000
#> SRR2015781     2  0.0000     0.7372 0.000 1.000 0.000 0.000 0.000
#> SRR2015780     2  0.0000     0.7372 0.000 1.000 0.000 0.000 0.000
#> SRR2015779     2  0.0000     0.7372 0.000 1.000 0.000 0.000 0.000
#> SRR2015778     3  0.4101     0.4592 0.372 0.000 0.628 0.000 0.000
#> SRR2015777     3  0.3336     0.4858 0.000 0.228 0.772 0.000 0.000
#> SRR2015776     4  0.0510     0.9860 0.000 0.016 0.000 0.984 0.000
#> SRR2015775     5  0.4560     0.6358 0.000 0.484 0.000 0.008 0.508
#> SRR2015774     2  0.0000     0.7372 0.000 1.000 0.000 0.000 0.000
#> SRR2015773     2  0.0000     0.7372 0.000 1.000 0.000 0.000 0.000
#> SRR2015772     2  0.0000     0.7372 0.000 1.000 0.000 0.000 0.000
#> SRR2015771     3  0.3949     0.4328 0.332 0.000 0.668 0.000 0.000
#> SRR2015769     5  0.4560     0.6358 0.000 0.484 0.000 0.008 0.508
#> SRR2015770     2  0.0000     0.7372 0.000 1.000 0.000 0.000 0.000
#> SRR2015768     2  0.0000     0.7372 0.000 1.000 0.000 0.000 0.000
#> SRR2015767     4  0.0510     0.9860 0.000 0.016 0.000 0.984 0.000
#> SRR2015766     3  0.4562     0.5052 0.000 0.000 0.500 0.008 0.492
#> SRR2015764     2  0.0000     0.7372 0.000 1.000 0.000 0.000 0.000
#> SRR2015765     2  0.3612     0.3031 0.000 0.732 0.000 0.000 0.268
#> SRR2015763     1  0.0794     0.9418 0.972 0.000 0.028 0.000 0.000
#> SRR2015762     2  0.4074     0.0584 0.000 0.636 0.000 0.364 0.000
#> SRR2015761     2  0.4483     0.1351 0.000 0.672 0.308 0.008 0.012
#> SRR2015760     3  0.4201     0.5894 0.000 0.000 0.664 0.008 0.328

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>            class entropy silhouette    p1    p2    p3    p4    p5    p6
#> SRR2015715     5  0.2697      0.697 0.188 0.000 0.000 0.000 0.812 0.000
#> SRR2015735     3  0.0000      0.955 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2015759     1  0.0000      0.996 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2015753     1  0.0000      0.996 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2015746     5  0.4453      0.394 0.400 0.000 0.000 0.000 0.568 0.032
#> SRR2015758     2  0.0260      0.890 0.000 0.992 0.000 0.000 0.008 0.000
#> SRR2015756     1  0.0000      0.996 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2015757     5  0.0000      0.831 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR2015755     1  0.0000      0.996 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2015754     1  0.0000      0.996 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2015752     1  0.0000      0.996 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2015749     1  0.0000      0.996 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2015750     5  0.3584      0.486 0.000 0.308 0.000 0.000 0.688 0.004
#> SRR2015751     5  0.2046      0.802 0.060 0.000 0.000 0.000 0.908 0.032
#> SRR2015748     3  0.0000      0.955 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2015747     1  0.0000      0.996 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2015745     2  0.3213      0.697 0.000 0.808 0.000 0.000 0.160 0.032
#> SRR2015743     1  0.0000      0.996 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2015744     5  0.5794      0.528 0.200 0.168 0.000 0.000 0.600 0.032
#> SRR2015742     5  0.0790      0.825 0.000 0.000 0.000 0.000 0.968 0.032
#> SRR2015741     1  0.0000      0.996 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2015740     1  0.0000      0.996 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2015738     1  0.0000      0.996 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2015739     1  0.0000      0.996 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2015737     2  0.0000      0.895 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2015736     5  0.0000      0.831 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR2015732     1  0.0000      0.996 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2015733     5  0.0790      0.825 0.000 0.000 0.000 0.000 0.968 0.032
#> SRR2015734     1  0.0790      0.964 0.968 0.000 0.000 0.000 0.032 0.000
#> SRR2015731     3  0.0000      0.955 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2015730     1  0.0000      0.996 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2015728     5  0.0937      0.818 0.000 0.000 0.040 0.000 0.960 0.000
#> SRR2015729     6  0.0790      0.840 0.000 0.032 0.000 0.000 0.000 0.968
#> SRR2015727     3  0.0000      0.955 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2015726     1  0.0000      0.996 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2015723     6  0.2006      0.807 0.000 0.104 0.000 0.000 0.004 0.892
#> SRR2015724     5  0.0000      0.831 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR2015725     1  0.0000      0.996 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2015722     3  0.0000      0.955 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2015721     5  0.0146      0.830 0.000 0.000 0.004 0.000 0.996 0.000
#> SRR2015720     5  0.0000      0.831 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR2015718     2  0.4409      0.177 0.000 0.588 0.000 0.000 0.032 0.380
#> SRR2015719     4  0.0000      0.993 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR2015717     3  0.0865      0.926 0.000 0.000 0.964 0.000 0.036 0.000
#> SRR2015716     6  0.4319      0.484 0.000 0.348 0.000 0.000 0.032 0.620
#> SRR2015714     4  0.0363      0.980 0.000 0.012 0.000 0.988 0.000 0.000
#> SRR2015713     5  0.0000      0.831 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR2015784     2  0.0000      0.895 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2015785     2  0.1327      0.849 0.000 0.936 0.000 0.000 0.000 0.064
#> SRR2015783     1  0.0000      0.996 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2015782     2  0.0000      0.895 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2015781     2  0.0000      0.895 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2015780     2  0.0000      0.895 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2015779     2  0.0000      0.895 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2015778     5  0.4319      0.508 0.348 0.000 0.000 0.000 0.620 0.032
#> SRR2015777     5  0.0790      0.825 0.000 0.000 0.000 0.000 0.968 0.032
#> SRR2015776     4  0.0000      0.993 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR2015775     6  0.0790      0.840 0.000 0.032 0.000 0.000 0.000 0.968
#> SRR2015774     2  0.0000      0.895 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2015773     2  0.0000      0.895 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2015772     2  0.0000      0.895 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2015771     5  0.2762      0.688 0.196 0.000 0.000 0.000 0.804 0.000
#> SRR2015769     6  0.0790      0.840 0.000 0.032 0.000 0.000 0.000 0.968
#> SRR2015770     2  0.0000      0.895 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2015768     2  0.0000      0.895 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2015767     4  0.0000      0.993 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR2015766     3  0.0000      0.955 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2015764     2  0.0000      0.895 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2015765     2  0.3860      0.597 0.000 0.728 0.236 0.000 0.000 0.036
#> SRR2015763     1  0.0790      0.964 0.968 0.000 0.000 0.000 0.032 0.000
#> SRR2015762     2  0.3706      0.396 0.000 0.620 0.000 0.380 0.000 0.000
#> SRR2015761     2  0.3512      0.676 0.000 0.772 0.196 0.000 0.032 0.000
#> SRR2015760     3  0.2883      0.714 0.000 0.000 0.788 0.000 0.212 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

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

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

collect_plots(res)

plot of chunk CV-mclust-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.732           0.831       0.935         0.4920 0.501   0.501
#> 3 3 0.635           0.827       0.858         0.2875 0.807   0.633
#> 4 4 0.543           0.675       0.815         0.0408 0.651   0.340
#> 5 5 0.820           0.865       0.924         0.1193 0.742   0.403
#> 6 6 0.816           0.813       0.917         0.0412 0.948   0.810

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
#> SRR2015715     1  0.0000     0.9176 1.000 0.000
#> SRR2015735     1  0.0000     0.9176 1.000 0.000
#> SRR2015759     1  0.0000     0.9176 1.000 0.000
#> SRR2015753     1  0.0000     0.9176 1.000 0.000
#> SRR2015746     1  0.9896     0.2301 0.560 0.440
#> SRR2015758     2  0.0000     0.9285 0.000 1.000
#> SRR2015756     1  0.0000     0.9176 1.000 0.000
#> SRR2015757     2  0.9833     0.2246 0.424 0.576
#> SRR2015755     1  0.0000     0.9176 1.000 0.000
#> SRR2015754     1  0.0000     0.9176 1.000 0.000
#> SRR2015752     1  0.0000     0.9176 1.000 0.000
#> SRR2015749     1  0.0000     0.9176 1.000 0.000
#> SRR2015750     2  0.0000     0.9285 0.000 1.000
#> SRR2015751     1  0.0672     0.9124 0.992 0.008
#> SRR2015748     2  0.0000     0.9285 0.000 1.000
#> SRR2015747     1  0.0000     0.9176 1.000 0.000
#> SRR2015745     2  0.0000     0.9285 0.000 1.000
#> SRR2015743     1  0.0000     0.9176 1.000 0.000
#> SRR2015744     2  0.0000     0.9285 0.000 1.000
#> SRR2015742     2  0.9661     0.3219 0.392 0.608
#> SRR2015741     1  0.0000     0.9176 1.000 0.000
#> SRR2015740     1  0.0000     0.9176 1.000 0.000
#> SRR2015738     1  0.0000     0.9176 1.000 0.000
#> SRR2015739     1  0.0000     0.9176 1.000 0.000
#> SRR2015737     2  0.0000     0.9285 0.000 1.000
#> SRR2015736     1  0.6973     0.7427 0.812 0.188
#> SRR2015732     1  0.0000     0.9176 1.000 0.000
#> SRR2015733     2  0.8661     0.5583 0.288 0.712
#> SRR2015734     1  0.0000     0.9176 1.000 0.000
#> SRR2015731     2  0.9881     0.1857 0.436 0.564
#> SRR2015730     1  0.0000     0.9176 1.000 0.000
#> SRR2015728     1  0.8661     0.6010 0.712 0.288
#> SRR2015729     2  0.0000     0.9285 0.000 1.000
#> SRR2015727     2  0.1843     0.9065 0.028 0.972
#> SRR2015726     2  0.8555     0.5756 0.280 0.720
#> SRR2015723     2  0.0000     0.9285 0.000 1.000
#> SRR2015724     1  0.8016     0.6692 0.756 0.244
#> SRR2015725     1  0.0000     0.9176 1.000 0.000
#> SRR2015722     2  0.0376     0.9256 0.004 0.996
#> SRR2015721     1  0.9170     0.5168 0.668 0.332
#> SRR2015720     1  0.8499     0.6206 0.724 0.276
#> SRR2015718     2  0.0000     0.9285 0.000 1.000
#> SRR2015719     2  0.0000     0.9285 0.000 1.000
#> SRR2015717     1  0.0000     0.9176 1.000 0.000
#> SRR2015716     2  0.5842     0.7871 0.140 0.860
#> SRR2015714     2  0.0000     0.9285 0.000 1.000
#> SRR2015713     2  0.9896     0.1720 0.440 0.560
#> SRR2015784     2  0.0000     0.9285 0.000 1.000
#> SRR2015785     2  0.0000     0.9285 0.000 1.000
#> SRR2015783     1  0.0000     0.9176 1.000 0.000
#> SRR2015782     2  0.0000     0.9285 0.000 1.000
#> SRR2015781     2  0.0000     0.9285 0.000 1.000
#> SRR2015780     2  0.0000     0.9285 0.000 1.000
#> SRR2015779     2  0.0000     0.9285 0.000 1.000
#> SRR2015778     1  0.9996     0.0601 0.512 0.488
#> SRR2015777     2  0.3274     0.8777 0.060 0.940
#> SRR2015776     2  0.0000     0.9285 0.000 1.000
#> SRR2015775     2  0.0000     0.9285 0.000 1.000
#> SRR2015774     2  0.0000     0.9285 0.000 1.000
#> SRR2015773     2  0.0000     0.9285 0.000 1.000
#> SRR2015772     2  0.0000     0.9285 0.000 1.000
#> SRR2015771     1  0.0000     0.9176 1.000 0.000
#> SRR2015769     2  0.0000     0.9285 0.000 1.000
#> SRR2015770     2  0.0000     0.9285 0.000 1.000
#> SRR2015768     2  0.0000     0.9285 0.000 1.000
#> SRR2015767     2  0.0000     0.9285 0.000 1.000
#> SRR2015766     2  0.0000     0.9285 0.000 1.000
#> SRR2015764     2  0.0000     0.9285 0.000 1.000
#> SRR2015765     2  0.0000     0.9285 0.000 1.000
#> SRR2015763     1  0.0000     0.9176 1.000 0.000
#> SRR2015762     2  0.0000     0.9285 0.000 1.000
#> SRR2015761     2  0.0000     0.9285 0.000 1.000
#> SRR2015760     1  0.0376     0.9151 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
#> SRR2015715     3  0.6309      0.234 0.496 0.000 0.504
#> SRR2015735     1  0.1860      0.891 0.948 0.000 0.052
#> SRR2015759     1  0.0237      0.927 0.996 0.000 0.004
#> SRR2015753     1  0.0000      0.928 1.000 0.000 0.000
#> SRR2015746     3  0.3551      0.887 0.132 0.000 0.868
#> SRR2015758     2  0.0237      0.907 0.000 0.996 0.004
#> SRR2015756     1  0.0000      0.928 1.000 0.000 0.000
#> SRR2015757     2  0.9151     -0.190 0.144 0.436 0.420
#> SRR2015755     1  0.0424      0.925 0.992 0.000 0.008
#> SRR2015754     1  0.5098      0.605 0.752 0.000 0.248
#> SRR2015752     1  0.0000      0.928 1.000 0.000 0.000
#> SRR2015749     1  0.0000      0.928 1.000 0.000 0.000
#> SRR2015750     2  0.2625      0.895 0.000 0.916 0.084
#> SRR2015751     3  0.3482      0.888 0.128 0.000 0.872
#> SRR2015748     2  0.0424      0.907 0.000 0.992 0.008
#> SRR2015747     1  0.0237      0.927 0.996 0.000 0.004
#> SRR2015745     2  0.5404      0.660 0.004 0.740 0.256
#> SRR2015743     1  0.0000      0.928 1.000 0.000 0.000
#> SRR2015744     3  0.6523      0.660 0.048 0.228 0.724
#> SRR2015742     3  0.3482      0.888 0.128 0.000 0.872
#> SRR2015741     1  0.0000      0.928 1.000 0.000 0.000
#> SRR2015740     1  0.0000      0.928 1.000 0.000 0.000
#> SRR2015738     1  0.4555      0.699 0.800 0.000 0.200
#> SRR2015739     1  0.0000      0.928 1.000 0.000 0.000
#> SRR2015737     2  0.0424      0.907 0.000 0.992 0.008
#> SRR2015736     3  0.3551      0.887 0.132 0.000 0.868
#> SRR2015732     1  0.2448      0.858 0.924 0.000 0.076
#> SRR2015733     3  0.3715      0.887 0.128 0.004 0.868
#> SRR2015734     1  0.0000      0.928 1.000 0.000 0.000
#> SRR2015731     3  0.8408      0.622 0.152 0.232 0.616
#> SRR2015730     1  0.0000      0.928 1.000 0.000 0.000
#> SRR2015728     3  0.4002      0.875 0.160 0.000 0.840
#> SRR2015729     2  0.2711      0.892 0.000 0.912 0.088
#> SRR2015727     2  0.3340      0.830 0.120 0.880 0.000
#> SRR2015726     2  0.3886      0.849 0.096 0.880 0.024
#> SRR2015723     2  0.2537      0.894 0.000 0.920 0.080
#> SRR2015724     3  0.4618      0.876 0.136 0.024 0.840
#> SRR2015725     1  0.0000      0.928 1.000 0.000 0.000
#> SRR2015722     2  0.3340      0.830 0.120 0.880 0.000
#> SRR2015721     3  0.4002      0.875 0.160 0.000 0.840
#> SRR2015720     3  0.3482      0.888 0.128 0.000 0.872
#> SRR2015718     2  0.5241      0.781 0.048 0.820 0.132
#> SRR2015719     2  0.1529      0.898 0.000 0.960 0.040
#> SRR2015717     3  0.6302      0.282 0.480 0.000 0.520
#> SRR2015716     2  0.6960      0.668 0.116 0.732 0.152
#> SRR2015714     2  0.1529      0.898 0.000 0.960 0.040
#> SRR2015713     3  0.3482      0.888 0.128 0.000 0.872
#> SRR2015784     2  0.0237      0.907 0.000 0.996 0.004
#> SRR2015785     2  0.2537      0.894 0.000 0.920 0.080
#> SRR2015783     1  0.0000      0.928 1.000 0.000 0.000
#> SRR2015782     2  0.2625      0.895 0.000 0.916 0.084
#> SRR2015781     2  0.0237      0.907 0.000 0.996 0.004
#> SRR2015780     2  0.0000      0.906 0.000 1.000 0.000
#> SRR2015779     2  0.0237      0.907 0.000 0.996 0.004
#> SRR2015778     3  0.3551      0.887 0.132 0.000 0.868
#> SRR2015777     3  0.3755      0.882 0.120 0.008 0.872
#> SRR2015776     2  0.1529      0.898 0.000 0.960 0.040
#> SRR2015775     2  0.2711      0.892 0.000 0.912 0.088
#> SRR2015774     2  0.0237      0.907 0.000 0.996 0.004
#> SRR2015773     2  0.0237      0.907 0.000 0.996 0.004
#> SRR2015772     2  0.0237      0.907 0.000 0.996 0.004
#> SRR2015771     1  0.7844      0.303 0.624 0.084 0.292
#> SRR2015769     2  0.2711      0.892 0.000 0.912 0.088
#> SRR2015770     2  0.2625      0.895 0.000 0.916 0.084
#> SRR2015768     2  0.2625      0.895 0.000 0.916 0.084
#> SRR2015767     2  0.1529      0.898 0.000 0.960 0.040
#> SRR2015766     2  0.6109      0.696 0.048 0.760 0.192
#> SRR2015764     2  0.0237      0.907 0.000 0.996 0.004
#> SRR2015765     2  0.0237      0.907 0.000 0.996 0.004
#> SRR2015763     1  0.4062      0.757 0.836 0.000 0.164
#> SRR2015762     2  0.0237      0.907 0.000 0.996 0.004
#> SRR2015761     2  0.6075      0.535 0.008 0.676 0.316
#> SRR2015760     3  0.4002      0.875 0.160 0.000 0.840

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> SRR2015715     1  0.3498      0.783 0.832 0.160 0.000 0.008
#> SRR2015735     1  0.1411      0.827 0.960 0.020 0.000 0.020
#> SRR2015759     1  0.0000      0.830 1.000 0.000 0.000 0.000
#> SRR2015753     1  0.0000      0.830 1.000 0.000 0.000 0.000
#> SRR2015746     2  0.6392     -0.269 0.452 0.484 0.000 0.064
#> SRR2015758     2  0.0921      0.692 0.000 0.972 0.028 0.000
#> SRR2015756     1  0.0000      0.830 1.000 0.000 0.000 0.000
#> SRR2015757     2  0.3979      0.647 0.096 0.844 0.004 0.056
#> SRR2015755     1  0.0188      0.830 0.996 0.000 0.000 0.004
#> SRR2015754     1  0.2443      0.819 0.916 0.060 0.000 0.024
#> SRR2015752     1  0.0000      0.830 1.000 0.000 0.000 0.000
#> SRR2015749     1  0.2647      0.736 0.880 0.120 0.000 0.000
#> SRR2015750     2  0.4304      0.589 0.000 0.716 0.284 0.000
#> SRR2015751     2  0.4711      0.592 0.152 0.784 0.000 0.064
#> SRR2015748     3  0.4617      0.568 0.000 0.032 0.764 0.204
#> SRR2015747     1  0.0336      0.831 0.992 0.008 0.000 0.000
#> SRR2015745     2  0.0592      0.691 0.000 0.984 0.016 0.000
#> SRR2015743     1  0.0000      0.830 1.000 0.000 0.000 0.000
#> SRR2015744     2  0.3840      0.633 0.104 0.844 0.052 0.000
#> SRR2015742     2  0.4614      0.600 0.144 0.792 0.000 0.064
#> SRR2015741     1  0.0000      0.830 1.000 0.000 0.000 0.000
#> SRR2015740     1  0.0000      0.830 1.000 0.000 0.000 0.000
#> SRR2015738     1  0.2596      0.808 0.908 0.068 0.000 0.024
#> SRR2015739     1  0.0000      0.830 1.000 0.000 0.000 0.000
#> SRR2015737     2  0.4797      0.598 0.000 0.720 0.260 0.020
#> SRR2015736     1  0.5420      0.609 0.624 0.352 0.000 0.024
#> SRR2015732     1  0.0000      0.830 1.000 0.000 0.000 0.000
#> SRR2015733     2  0.3474      0.657 0.068 0.868 0.000 0.064
#> SRR2015734     1  0.0000      0.830 1.000 0.000 0.000 0.000
#> SRR2015731     1  0.5214      0.695 0.692 0.280 0.004 0.024
#> SRR2015730     1  0.0000      0.830 1.000 0.000 0.000 0.000
#> SRR2015728     1  0.5061      0.707 0.704 0.272 0.004 0.020
#> SRR2015729     3  0.0188      0.767 0.000 0.004 0.996 0.000
#> SRR2015727     1  0.8543      0.374 0.460 0.292 0.048 0.200
#> SRR2015726     3  0.5894      0.194 0.428 0.036 0.536 0.000
#> SRR2015723     3  0.0817      0.766 0.000 0.024 0.976 0.000
#> SRR2015724     1  0.5233      0.683 0.684 0.292 0.012 0.012
#> SRR2015725     1  0.0000      0.830 1.000 0.000 0.000 0.000
#> SRR2015722     4  0.7647      0.362 0.100 0.292 0.048 0.560
#> SRR2015721     1  0.5188      0.700 0.696 0.276 0.004 0.024
#> SRR2015720     2  0.4010      0.638 0.100 0.836 0.000 0.064
#> SRR2015718     1  0.6212      0.524 0.560 0.380 0.060 0.000
#> SRR2015719     4  0.2256      0.832 0.000 0.020 0.056 0.924
#> SRR2015717     1  0.4507      0.742 0.756 0.224 0.000 0.020
#> SRR2015716     1  0.6120      0.628 0.628 0.296 0.076 0.000
#> SRR2015714     4  0.2256      0.832 0.000 0.020 0.056 0.924
#> SRR2015713     2  0.3885      0.644 0.092 0.844 0.000 0.064
#> SRR2015784     2  0.4826      0.593 0.000 0.716 0.264 0.020
#> SRR2015785     3  0.0817      0.766 0.000 0.024 0.976 0.000
#> SRR2015783     1  0.0000      0.830 1.000 0.000 0.000 0.000
#> SRR2015782     2  0.4304      0.589 0.000 0.716 0.284 0.000
#> SRR2015781     2  0.4290      0.645 0.000 0.800 0.164 0.036
#> SRR2015780     2  0.6537      0.512 0.056 0.608 0.316 0.020
#> SRR2015779     2  0.4808      0.610 0.000 0.736 0.236 0.028
#> SRR2015778     2  0.4849      0.577 0.164 0.772 0.000 0.064
#> SRR2015777     2  0.2623      0.670 0.028 0.908 0.000 0.064
#> SRR2015776     4  0.2256      0.832 0.000 0.020 0.056 0.924
#> SRR2015775     3  0.0188      0.767 0.000 0.004 0.996 0.000
#> SRR2015774     2  0.6643      0.527 0.164 0.672 0.144 0.020
#> SRR2015773     2  0.4797      0.598 0.000 0.720 0.260 0.020
#> SRR2015772     2  0.4826      0.593 0.000 0.716 0.264 0.020
#> SRR2015771     1  0.2831      0.803 0.876 0.120 0.004 0.000
#> SRR2015769     3  0.0188      0.767 0.000 0.004 0.996 0.000
#> SRR2015770     2  0.4304      0.589 0.000 0.716 0.284 0.000
#> SRR2015768     2  0.4304      0.589 0.000 0.716 0.284 0.000
#> SRR2015767     4  0.2256      0.832 0.000 0.020 0.056 0.924
#> SRR2015766     1  0.8679      0.352 0.452 0.300 0.060 0.188
#> SRR2015764     2  0.1297      0.691 0.000 0.964 0.016 0.020
#> SRR2015765     3  0.6938      0.480 0.184 0.136 0.652 0.028
#> SRR2015763     1  0.1151      0.829 0.968 0.024 0.000 0.008
#> SRR2015762     2  0.1833      0.689 0.000 0.944 0.024 0.032
#> SRR2015761     2  0.4949      0.537 0.180 0.760 0.060 0.000
#> SRR2015760     1  0.5188      0.700 0.696 0.276 0.004 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
#> SRR2015715     3  0.2179      0.886 0.112 0.000 0.888 0.000 0.000
#> SRR2015735     3  0.4473      0.393 0.412 0.000 0.580 0.008 0.000
#> SRR2015759     1  0.0162      0.930 0.996 0.000 0.004 0.000 0.000
#> SRR2015753     1  0.0162      0.930 0.996 0.000 0.004 0.000 0.000
#> SRR2015746     3  0.0898      0.892 0.008 0.020 0.972 0.000 0.000
#> SRR2015758     2  0.1124      0.919 0.000 0.960 0.036 0.004 0.000
#> SRR2015756     1  0.0162      0.930 0.996 0.000 0.004 0.000 0.000
#> SRR2015757     3  0.1121      0.893 0.008 0.016 0.968 0.004 0.004
#> SRR2015755     1  0.1484      0.891 0.944 0.000 0.048 0.008 0.000
#> SRR2015754     3  0.2660      0.874 0.128 0.000 0.864 0.008 0.000
#> SRR2015752     1  0.0000      0.929 1.000 0.000 0.000 0.000 0.000
#> SRR2015749     1  0.1124      0.896 0.960 0.004 0.036 0.000 0.000
#> SRR2015750     2  0.0727      0.931 0.000 0.980 0.004 0.004 0.012
#> SRR2015751     3  0.1018      0.893 0.016 0.016 0.968 0.000 0.000
#> SRR2015748     5  0.2758      0.839 0.000 0.024 0.012 0.076 0.888
#> SRR2015747     1  0.0609      0.920 0.980 0.000 0.020 0.000 0.000
#> SRR2015745     2  0.4367      0.249 0.000 0.580 0.416 0.004 0.000
#> SRR2015743     1  0.0162      0.930 0.996 0.000 0.004 0.000 0.000
#> SRR2015744     3  0.2736      0.869 0.004 0.084 0.888 0.008 0.016
#> SRR2015742     3  0.0671      0.891 0.004 0.016 0.980 0.000 0.000
#> SRR2015741     1  0.0162      0.930 0.996 0.000 0.004 0.000 0.000
#> SRR2015740     1  0.0000      0.929 1.000 0.000 0.000 0.000 0.000
#> SRR2015738     3  0.4585      0.378 0.396 0.004 0.592 0.008 0.000
#> SRR2015739     1  0.0162      0.930 0.996 0.000 0.004 0.000 0.000
#> SRR2015737     2  0.0000      0.934 0.000 1.000 0.000 0.000 0.000
#> SRR2015736     3  0.1732      0.896 0.080 0.000 0.920 0.000 0.000
#> SRR2015732     1  0.2179      0.820 0.888 0.000 0.112 0.000 0.000
#> SRR2015733     3  0.0798      0.892 0.008 0.016 0.976 0.000 0.000
#> SRR2015734     1  0.0162      0.930 0.996 0.000 0.004 0.000 0.000
#> SRR2015731     3  0.2586      0.894 0.084 0.000 0.892 0.012 0.012
#> SRR2015730     1  0.0000      0.929 1.000 0.000 0.000 0.000 0.000
#> SRR2015728     3  0.2305      0.893 0.092 0.000 0.896 0.012 0.000
#> SRR2015729     5  0.0290      0.881 0.000 0.008 0.000 0.000 0.992
#> SRR2015727     3  0.2270      0.873 0.000 0.000 0.904 0.076 0.020
#> SRR2015726     1  0.6569      0.475 0.584 0.000 0.204 0.032 0.180
#> SRR2015723     5  0.1251      0.879 0.000 0.008 0.000 0.036 0.956
#> SRR2015724     3  0.2407      0.894 0.088 0.000 0.896 0.004 0.012
#> SRR2015725     1  0.0000      0.929 1.000 0.000 0.000 0.000 0.000
#> SRR2015722     3  0.2270      0.873 0.000 0.000 0.904 0.076 0.020
#> SRR2015721     3  0.2361      0.891 0.096 0.000 0.892 0.012 0.000
#> SRR2015720     3  0.0798      0.892 0.008 0.016 0.976 0.000 0.000
#> SRR2015718     3  0.4328      0.837 0.044 0.084 0.820 0.032 0.020
#> SRR2015719     4  0.0609      1.000 0.000 0.000 0.000 0.980 0.020
#> SRR2015717     3  0.2358      0.888 0.104 0.000 0.888 0.008 0.000
#> SRR2015716     3  0.3862      0.873 0.044 0.044 0.852 0.032 0.028
#> SRR2015714     4  0.0609      1.000 0.000 0.000 0.000 0.980 0.020
#> SRR2015713     3  0.0798      0.892 0.008 0.016 0.976 0.000 0.000
#> SRR2015784     2  0.0000      0.934 0.000 1.000 0.000 0.000 0.000
#> SRR2015785     5  0.1251      0.879 0.000 0.008 0.000 0.036 0.956
#> SRR2015783     1  0.0162      0.930 0.996 0.000 0.004 0.000 0.000
#> SRR2015782     2  0.0290      0.934 0.000 0.992 0.000 0.000 0.008
#> SRR2015781     2  0.0451      0.934 0.000 0.988 0.008 0.004 0.000
#> SRR2015780     2  0.1547      0.902 0.004 0.948 0.000 0.032 0.016
#> SRR2015779     2  0.0727      0.933 0.000 0.980 0.012 0.004 0.004
#> SRR2015778     3  0.0798      0.892 0.008 0.016 0.976 0.000 0.000
#> SRR2015777     3  0.0703      0.888 0.000 0.024 0.976 0.000 0.000
#> SRR2015776     4  0.0609      1.000 0.000 0.000 0.000 0.980 0.020
#> SRR2015775     5  0.0290      0.881 0.000 0.008 0.000 0.000 0.992
#> SRR2015774     2  0.1856      0.904 0.008 0.940 0.008 0.032 0.012
#> SRR2015773     2  0.0290      0.933 0.000 0.992 0.008 0.000 0.000
#> SRR2015772     2  0.0000      0.934 0.000 1.000 0.000 0.000 0.000
#> SRR2015771     3  0.3756      0.743 0.248 0.000 0.744 0.000 0.008
#> SRR2015769     5  0.0290      0.881 0.000 0.008 0.000 0.000 0.992
#> SRR2015770     2  0.0290      0.934 0.000 0.992 0.000 0.000 0.008
#> SRR2015768     2  0.0290      0.934 0.000 0.992 0.000 0.000 0.008
#> SRR2015767     4  0.0609      1.000 0.000 0.000 0.000 0.980 0.020
#> SRR2015766     3  0.2721      0.877 0.012 0.000 0.892 0.068 0.028
#> SRR2015764     2  0.0566      0.933 0.000 0.984 0.012 0.004 0.000
#> SRR2015765     5  0.5240      0.469 0.008 0.320 0.000 0.048 0.624
#> SRR2015763     1  0.3857      0.506 0.688 0.000 0.312 0.000 0.000
#> SRR2015762     2  0.2228      0.874 0.000 0.908 0.076 0.004 0.012
#> SRR2015761     3  0.2771      0.891 0.028 0.016 0.904 0.032 0.020
#> SRR2015760     3  0.2305      0.892 0.092 0.000 0.896 0.012 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
#> SRR2015715     3  0.1387     0.8390 0.068 0.000 0.932 0.000 0.000 0.000
#> SRR2015735     1  0.4671     0.5406 0.688 0.000 0.152 0.000 0.160 0.000
#> SRR2015759     1  0.0291     0.8852 0.992 0.000 0.004 0.000 0.004 0.000
#> SRR2015753     1  0.0458     0.8812 0.984 0.000 0.000 0.000 0.016 0.000
#> SRR2015746     3  0.0000     0.8799 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2015758     2  0.2957     0.8433 0.000 0.836 0.008 0.016 0.140 0.000
#> SRR2015756     1  0.0458     0.8812 0.984 0.000 0.000 0.000 0.016 0.000
#> SRR2015757     3  0.0820     0.8751 0.000 0.000 0.972 0.016 0.012 0.000
#> SRR2015755     1  0.0146     0.8855 0.996 0.000 0.004 0.000 0.000 0.000
#> SRR2015754     3  0.3830     0.2237 0.376 0.000 0.620 0.000 0.004 0.000
#> SRR2015752     1  0.0000     0.8847 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2015749     1  0.0508     0.8823 0.984 0.000 0.012 0.000 0.004 0.000
#> SRR2015750     2  0.0458     0.8915 0.000 0.984 0.000 0.016 0.000 0.000
#> SRR2015751     3  0.0146     0.8797 0.000 0.000 0.996 0.000 0.004 0.000
#> SRR2015748     6  0.1059     0.8949 0.000 0.016 0.000 0.016 0.004 0.964
#> SRR2015747     1  0.0146     0.8855 0.996 0.000 0.004 0.000 0.000 0.000
#> SRR2015745     2  0.4264    -0.0389 0.000 0.496 0.488 0.016 0.000 0.000
#> SRR2015743     1  0.0458     0.8812 0.984 0.000 0.000 0.000 0.016 0.000
#> SRR2015744     3  0.2565     0.7773 0.008 0.104 0.872 0.016 0.000 0.000
#> SRR2015742     3  0.0000     0.8799 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2015741     1  0.0146     0.8855 0.996 0.000 0.004 0.000 0.000 0.000
#> SRR2015740     1  0.0146     0.8847 0.996 0.000 0.000 0.000 0.004 0.000
#> SRR2015738     1  0.3804     0.2649 0.576 0.000 0.424 0.000 0.000 0.000
#> SRR2015739     1  0.0458     0.8812 0.984 0.000 0.000 0.000 0.016 0.000
#> SRR2015737     2  0.0000     0.8944 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2015736     3  0.0260     0.8787 0.008 0.000 0.992 0.000 0.000 0.000
#> SRR2015732     1  0.2300     0.7440 0.856 0.000 0.144 0.000 0.000 0.000
#> SRR2015733     3  0.0146     0.8797 0.000 0.000 0.996 0.000 0.004 0.000
#> SRR2015734     1  0.0632     0.8730 0.976 0.000 0.024 0.000 0.000 0.000
#> SRR2015731     3  0.2917     0.7651 0.008 0.000 0.840 0.016 0.136 0.000
#> SRR2015730     1  0.0146     0.8847 0.996 0.000 0.000 0.000 0.004 0.000
#> SRR2015728     3  0.0717     0.8778 0.008 0.000 0.976 0.000 0.016 0.000
#> SRR2015729     6  0.0000     0.9067 0.000 0.000 0.000 0.000 0.000 1.000
#> SRR2015727     5  0.3202     0.9917 0.000 0.000 0.176 0.024 0.800 0.000
#> SRR2015726     1  0.6283     0.0704 0.448 0.000 0.228 0.016 0.000 0.308
#> SRR2015723     6  0.0458     0.9068 0.000 0.000 0.000 0.016 0.000 0.984
#> SRR2015724     3  0.0717     0.8753 0.008 0.000 0.976 0.016 0.000 0.000
#> SRR2015725     1  0.0146     0.8847 0.996 0.000 0.000 0.000 0.004 0.000
#> SRR2015722     5  0.3168     0.9917 0.000 0.000 0.172 0.024 0.804 0.000
#> SRR2015721     3  0.0717     0.8778 0.008 0.000 0.976 0.000 0.016 0.000
#> SRR2015720     3  0.0146     0.8797 0.000 0.000 0.996 0.000 0.004 0.000
#> SRR2015718     3  0.3254     0.6714 0.000 0.172 0.804 0.016 0.008 0.000
#> SRR2015719     4  0.0000     1.0000 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR2015717     3  0.2122     0.8292 0.024 0.000 0.900 0.000 0.076 0.000
#> SRR2015716     3  0.4400     0.6370 0.000 0.072 0.756 0.016 0.008 0.148
#> SRR2015714     4  0.0000     1.0000 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR2015713     3  0.0260     0.8784 0.000 0.000 0.992 0.000 0.008 0.000
#> SRR2015784     2  0.0000     0.8944 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2015785     6  0.0458     0.9068 0.000 0.000 0.000 0.016 0.000 0.984
#> SRR2015783     1  0.0291     0.8852 0.992 0.000 0.004 0.000 0.004 0.000
#> SRR2015782     2  0.0000     0.8944 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2015781     2  0.2996     0.8412 0.000 0.832 0.008 0.016 0.144 0.000
#> SRR2015780     2  0.0603     0.8908 0.000 0.980 0.000 0.016 0.000 0.004
#> SRR2015779     2  0.2996     0.8412 0.000 0.832 0.008 0.016 0.144 0.000
#> SRR2015778     3  0.0000     0.8799 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2015777     3  0.0146     0.8797 0.000 0.000 0.996 0.000 0.004 0.000
#> SRR2015776     4  0.0000     1.0000 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR2015775     6  0.0000     0.9067 0.000 0.000 0.000 0.000 0.000 1.000
#> SRR2015774     2  0.0458     0.8915 0.000 0.984 0.000 0.016 0.000 0.000
#> SRR2015773     2  0.0000     0.8944 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2015772     2  0.0000     0.8944 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2015771     3  0.2793     0.6534 0.200 0.000 0.800 0.000 0.000 0.000
#> SRR2015769     6  0.0000     0.9067 0.000 0.000 0.000 0.000 0.000 1.000
#> SRR2015770     2  0.0000     0.8944 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2015768     2  0.0000     0.8944 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2015767     4  0.0000     1.0000 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR2015766     3  0.4241     0.2350 0.000 0.000 0.608 0.024 0.368 0.000
#> SRR2015764     2  0.2876     0.8469 0.000 0.844 0.008 0.016 0.132 0.000
#> SRR2015765     6  0.3982     0.5201 0.000 0.280 0.000 0.016 0.008 0.696
#> SRR2015763     1  0.2941     0.6337 0.780 0.000 0.220 0.000 0.000 0.000
#> SRR2015762     2  0.3642     0.8133 0.000 0.800 0.040 0.016 0.144 0.000
#> SRR2015761     3  0.0862     0.8755 0.008 0.004 0.972 0.016 0.000 0.000
#> SRR2015760     3  0.0717     0.8778 0.008 0.000 0.976 0.000 0.016 0.000

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

consensus_heatmap(res, k = 2)

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

consensus_heatmap(res, k = 3)

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

consensus_heatmap(res, k = 4)

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

consensus_heatmap(res, k = 5)

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

consensus_heatmap(res, k = 6)

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

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

membership_heatmap(res, k = 2)

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

membership_heatmap(res, k = 3)

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

membership_heatmap(res, k = 4)

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

membership_heatmap(res, k = 5)

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

membership_heatmap(res, k = 6)

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

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

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

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

get_signatures(res, k = 3)

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

get_signatures(res, k = 4)

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

get_signatures(res, k = 5)

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

get_signatures(res, k = 6)

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

Signature heatmaps where rows are not scaled:

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

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

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

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

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

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

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

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

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

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

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk CV-mclust-signature_compare

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

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

An example of the output of tb is:

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

The columns in tb are:

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

UMAP plot which shows how samples are separated.

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

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

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

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

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

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

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

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

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

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

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk CV-mclust-collect-classes

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 17223 rows and 73 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.942           0.932       0.972         0.5042 0.498   0.498
#> 3 3 0.837           0.842       0.932         0.2372 0.799   0.627
#> 4 4 0.623           0.652       0.835         0.1666 0.772   0.483
#> 5 5 0.637           0.614       0.773         0.0810 0.798   0.404
#> 6 6 0.637           0.517       0.730         0.0432 0.860   0.456

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
#> SRR2015715     1  0.0000      0.957 1.000 0.000
#> SRR2015735     1  0.0000      0.957 1.000 0.000
#> SRR2015759     1  0.0000      0.957 1.000 0.000
#> SRR2015753     1  0.0000      0.957 1.000 0.000
#> SRR2015746     1  0.9866      0.290 0.568 0.432
#> SRR2015758     2  0.0000      0.987 0.000 1.000
#> SRR2015756     1  0.0000      0.957 1.000 0.000
#> SRR2015757     1  0.0000      0.957 1.000 0.000
#> SRR2015755     1  0.0000      0.957 1.000 0.000
#> SRR2015754     1  0.0000      0.957 1.000 0.000
#> SRR2015752     1  0.0000      0.957 1.000 0.000
#> SRR2015749     1  0.0000      0.957 1.000 0.000
#> SRR2015750     2  0.0000      0.987 0.000 1.000
#> SRR2015751     1  0.0000      0.957 1.000 0.000
#> SRR2015748     2  0.0000      0.987 0.000 1.000
#> SRR2015747     1  0.0000      0.957 1.000 0.000
#> SRR2015745     2  0.0000      0.987 0.000 1.000
#> SRR2015743     1  0.0000      0.957 1.000 0.000
#> SRR2015744     2  0.0000      0.987 0.000 1.000
#> SRR2015742     1  0.9129      0.538 0.672 0.328
#> SRR2015741     1  0.0000      0.957 1.000 0.000
#> SRR2015740     1  0.0000      0.957 1.000 0.000
#> SRR2015738     1  0.0000      0.957 1.000 0.000
#> SRR2015739     1  0.0000      0.957 1.000 0.000
#> SRR2015737     2  0.0000      0.987 0.000 1.000
#> SRR2015736     1  0.0000      0.957 1.000 0.000
#> SRR2015732     1  0.0000      0.957 1.000 0.000
#> SRR2015733     2  0.8909      0.532 0.308 0.692
#> SRR2015734     1  0.0000      0.957 1.000 0.000
#> SRR2015731     1  0.0672      0.952 0.992 0.008
#> SRR2015730     1  0.0000      0.957 1.000 0.000
#> SRR2015728     1  0.0000      0.957 1.000 0.000
#> SRR2015729     2  0.0000      0.987 0.000 1.000
#> SRR2015727     1  0.2778      0.921 0.952 0.048
#> SRR2015726     1  0.0000      0.957 1.000 0.000
#> SRR2015723     2  0.0000      0.987 0.000 1.000
#> SRR2015724     1  0.6438      0.798 0.836 0.164
#> SRR2015725     1  0.0000      0.957 1.000 0.000
#> SRR2015722     1  0.1184      0.946 0.984 0.016
#> SRR2015721     1  0.0000      0.957 1.000 0.000
#> SRR2015720     1  0.0376      0.954 0.996 0.004
#> SRR2015718     2  0.0376      0.984 0.004 0.996
#> SRR2015719     2  0.0000      0.987 0.000 1.000
#> SRR2015717     1  0.0000      0.957 1.000 0.000
#> SRR2015716     1  0.9988      0.137 0.520 0.480
#> SRR2015714     2  0.0000      0.987 0.000 1.000
#> SRR2015713     1  0.2603      0.924 0.956 0.044
#> SRR2015784     2  0.0000      0.987 0.000 1.000
#> SRR2015785     2  0.0000      0.987 0.000 1.000
#> SRR2015783     1  0.0000      0.957 1.000 0.000
#> SRR2015782     2  0.0000      0.987 0.000 1.000
#> SRR2015781     2  0.0000      0.987 0.000 1.000
#> SRR2015780     2  0.0000      0.987 0.000 1.000
#> SRR2015779     2  0.0000      0.987 0.000 1.000
#> SRR2015778     1  0.5294      0.851 0.880 0.120
#> SRR2015777     2  0.3733      0.910 0.072 0.928
#> SRR2015776     2  0.0000      0.987 0.000 1.000
#> SRR2015775     2  0.0000      0.987 0.000 1.000
#> SRR2015774     2  0.0000      0.987 0.000 1.000
#> SRR2015773     2  0.0000      0.987 0.000 1.000
#> SRR2015772     2  0.0000      0.987 0.000 1.000
#> SRR2015771     1  0.0000      0.957 1.000 0.000
#> SRR2015769     2  0.0000      0.987 0.000 1.000
#> SRR2015770     2  0.0000      0.987 0.000 1.000
#> SRR2015768     2  0.0000      0.987 0.000 1.000
#> SRR2015767     2  0.0000      0.987 0.000 1.000
#> SRR2015766     2  0.0000      0.987 0.000 1.000
#> SRR2015764     2  0.0000      0.987 0.000 1.000
#> SRR2015765     2  0.0000      0.987 0.000 1.000
#> SRR2015763     1  0.0000      0.957 1.000 0.000
#> SRR2015762     2  0.0000      0.987 0.000 1.000
#> SRR2015761     2  0.0000      0.987 0.000 1.000
#> SRR2015760     1  0.0000      0.957 1.000 0.000

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>            class entropy silhouette    p1    p2    p3
#> SRR2015715     1  0.1482     0.9286 0.968 0.020 0.012
#> SRR2015735     1  0.0000     0.9369 1.000 0.000 0.000
#> SRR2015759     1  0.0000     0.9369 1.000 0.000 0.000
#> SRR2015753     1  0.0000     0.9369 1.000 0.000 0.000
#> SRR2015746     1  0.5465     0.6064 0.712 0.288 0.000
#> SRR2015758     2  0.0237     0.9174 0.000 0.996 0.004
#> SRR2015756     1  0.0000     0.9369 1.000 0.000 0.000
#> SRR2015757     1  0.1877     0.9213 0.956 0.032 0.012
#> SRR2015755     1  0.0000     0.9369 1.000 0.000 0.000
#> SRR2015754     1  0.1031     0.9268 0.976 0.000 0.024
#> SRR2015752     1  0.0000     0.9369 1.000 0.000 0.000
#> SRR2015749     1  0.0000     0.9369 1.000 0.000 0.000
#> SRR2015750     2  0.0237     0.9173 0.000 0.996 0.004
#> SRR2015751     1  0.0000     0.9369 1.000 0.000 0.000
#> SRR2015748     3  0.3619     0.7952 0.000 0.136 0.864
#> SRR2015747     1  0.0000     0.9369 1.000 0.000 0.000
#> SRR2015745     2  0.0592     0.9162 0.000 0.988 0.012
#> SRR2015743     1  0.0000     0.9369 1.000 0.000 0.000
#> SRR2015744     3  0.9963     0.1397 0.292 0.348 0.360
#> SRR2015742     1  0.6126     0.3484 0.600 0.000 0.400
#> SRR2015741     1  0.0000     0.9369 1.000 0.000 0.000
#> SRR2015740     1  0.0000     0.9369 1.000 0.000 0.000
#> SRR2015738     1  0.0000     0.9369 1.000 0.000 0.000
#> SRR2015739     1  0.0000     0.9369 1.000 0.000 0.000
#> SRR2015737     2  0.0237     0.9174 0.000 0.996 0.004
#> SRR2015736     1  0.1337     0.9305 0.972 0.016 0.012
#> SRR2015732     1  0.0661     0.9350 0.988 0.004 0.008
#> SRR2015733     1  0.9148     0.3407 0.544 0.236 0.220
#> SRR2015734     1  0.0829     0.9340 0.984 0.004 0.012
#> SRR2015731     3  0.0661     0.8889 0.008 0.004 0.988
#> SRR2015730     1  0.0424     0.9358 0.992 0.000 0.008
#> SRR2015728     1  0.1525     0.9279 0.964 0.004 0.032
#> SRR2015729     2  0.0237     0.9173 0.000 0.996 0.004
#> SRR2015727     3  0.0829     0.8884 0.012 0.004 0.984
#> SRR2015726     1  0.1964     0.9053 0.944 0.056 0.000
#> SRR2015723     2  0.0424     0.9155 0.000 0.992 0.008
#> SRR2015724     1  0.5450     0.7124 0.760 0.228 0.012
#> SRR2015725     1  0.0829     0.9340 0.984 0.004 0.012
#> SRR2015722     3  0.0892     0.8842 0.020 0.000 0.980
#> SRR2015721     1  0.1315     0.9318 0.972 0.008 0.020
#> SRR2015720     1  0.1482     0.9286 0.968 0.020 0.012
#> SRR2015718     2  0.0592     0.9077 0.000 0.988 0.012
#> SRR2015719     3  0.0592     0.8916 0.000 0.012 0.988
#> SRR2015717     1  0.2200     0.9119 0.940 0.004 0.056
#> SRR2015716     2  0.6771     0.0983 0.440 0.548 0.012
#> SRR2015714     3  0.0592     0.8916 0.000 0.012 0.988
#> SRR2015713     2  0.6701     0.2533 0.412 0.576 0.012
#> SRR2015784     2  0.0592     0.9162 0.000 0.988 0.012
#> SRR2015785     2  0.0592     0.9162 0.000 0.988 0.012
#> SRR2015783     1  0.0000     0.9369 1.000 0.000 0.000
#> SRR2015782     2  0.0592     0.9162 0.000 0.988 0.012
#> SRR2015781     2  0.6308    -0.0961 0.000 0.508 0.492
#> SRR2015780     2  0.1031     0.9059 0.000 0.976 0.024
#> SRR2015779     2  0.0592     0.9162 0.000 0.988 0.012
#> SRR2015778     1  0.0892     0.9295 0.980 0.000 0.020
#> SRR2015777     2  0.0237     0.9174 0.000 0.996 0.004
#> SRR2015776     3  0.0592     0.8916 0.000 0.012 0.988
#> SRR2015775     2  0.0237     0.9142 0.000 0.996 0.004
#> SRR2015774     2  0.0424     0.9113 0.000 0.992 0.008
#> SRR2015773     2  0.0237     0.9174 0.000 0.996 0.004
#> SRR2015772     2  0.0237     0.9174 0.000 0.996 0.004
#> SRR2015771     1  0.3771     0.8514 0.876 0.112 0.012
#> SRR2015769     2  0.0237     0.9173 0.000 0.996 0.004
#> SRR2015770     2  0.0237     0.9174 0.000 0.996 0.004
#> SRR2015768     2  0.0592     0.9162 0.000 0.988 0.012
#> SRR2015767     3  0.0592     0.8916 0.000 0.012 0.988
#> SRR2015766     3  0.0237     0.8869 0.000 0.004 0.996
#> SRR2015764     2  0.0237     0.9142 0.000 0.996 0.004
#> SRR2015765     2  0.0592     0.9162 0.000 0.988 0.012
#> SRR2015763     1  0.1015     0.9330 0.980 0.008 0.012
#> SRR2015762     3  0.2959     0.8426 0.000 0.100 0.900
#> SRR2015761     3  0.5431     0.6038 0.000 0.284 0.716
#> SRR2015760     1  0.4808     0.7708 0.804 0.008 0.188

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> SRR2015715     3  0.4222     0.5916 0.272 0.000 0.728 0.000
#> SRR2015735     1  0.1474     0.7941 0.948 0.000 0.052 0.000
#> SRR2015759     1  0.0336     0.8153 0.992 0.000 0.008 0.000
#> SRR2015753     1  0.3400     0.7299 0.820 0.180 0.000 0.000
#> SRR2015746     1  0.4436     0.6941 0.764 0.216 0.020 0.000
#> SRR2015758     3  0.3311     0.5526 0.000 0.172 0.828 0.000
#> SRR2015756     1  0.0000     0.8172 1.000 0.000 0.000 0.000
#> SRR2015757     3  0.3569     0.6531 0.196 0.000 0.804 0.000
#> SRR2015755     1  0.0000     0.8172 1.000 0.000 0.000 0.000
#> SRR2015754     1  0.2593     0.7653 0.892 0.000 0.004 0.104
#> SRR2015752     1  0.0188     0.8163 0.996 0.000 0.004 0.000
#> SRR2015749     1  0.0188     0.8167 0.996 0.000 0.004 0.000
#> SRR2015750     2  0.0000     0.8292 0.000 1.000 0.000 0.000
#> SRR2015751     1  0.4245     0.7080 0.784 0.196 0.020 0.000
#> SRR2015748     4  0.6133     0.2070 0.028 0.420 0.012 0.540
#> SRR2015747     1  0.0000     0.8172 1.000 0.000 0.000 0.000
#> SRR2015745     2  0.0895     0.8175 0.004 0.976 0.020 0.000
#> SRR2015743     1  0.0592     0.8124 0.984 0.000 0.016 0.000
#> SRR2015744     1  0.8741     0.0652 0.436 0.052 0.236 0.276
#> SRR2015742     1  0.7371     0.0946 0.472 0.000 0.168 0.360
#> SRR2015741     1  0.0000     0.8172 1.000 0.000 0.000 0.000
#> SRR2015740     1  0.0000     0.8172 1.000 0.000 0.000 0.000
#> SRR2015738     1  0.0188     0.8167 0.996 0.000 0.004 0.000
#> SRR2015739     1  0.0188     0.8167 0.996 0.000 0.004 0.000
#> SRR2015737     2  0.4406     0.7473 0.000 0.700 0.300 0.000
#> SRR2015736     3  0.3801     0.6443 0.220 0.000 0.780 0.000
#> SRR2015732     1  0.3117     0.7832 0.880 0.092 0.028 0.000
#> SRR2015733     3  0.4986     0.5220 0.044 0.000 0.740 0.216
#> SRR2015734     1  0.3873     0.6041 0.772 0.000 0.228 0.000
#> SRR2015731     4  0.2281     0.7720 0.000 0.000 0.096 0.904
#> SRR2015730     1  0.1637     0.7890 0.940 0.000 0.060 0.000
#> SRR2015728     1  0.4843     0.2426 0.604 0.000 0.396 0.000
#> SRR2015729     2  0.0000     0.8292 0.000 1.000 0.000 0.000
#> SRR2015727     4  0.0188     0.8378 0.000 0.000 0.004 0.996
#> SRR2015726     1  0.4428     0.6489 0.720 0.276 0.004 0.000
#> SRR2015723     2  0.3688     0.8364 0.000 0.792 0.208 0.000
#> SRR2015724     3  0.0817     0.6900 0.024 0.000 0.976 0.000
#> SRR2015725     1  0.2973     0.7146 0.856 0.000 0.144 0.000
#> SRR2015722     4  0.0000     0.8389 0.000 0.000 0.000 1.000
#> SRR2015721     3  0.4925     0.2901 0.428 0.000 0.572 0.000
#> SRR2015720     3  0.3356     0.6614 0.176 0.000 0.824 0.000
#> SRR2015718     3  0.0707     0.6841 0.000 0.020 0.980 0.000
#> SRR2015719     4  0.0000     0.8389 0.000 0.000 0.000 1.000
#> SRR2015717     1  0.4500     0.4457 0.684 0.000 0.316 0.000
#> SRR2015716     3  0.6737    -0.0464 0.420 0.092 0.488 0.000
#> SRR2015714     4  0.0000     0.8389 0.000 0.000 0.000 1.000
#> SRR2015713     3  0.1022     0.6908 0.032 0.000 0.968 0.000
#> SRR2015784     2  0.3942     0.8213 0.000 0.764 0.236 0.000
#> SRR2015785     2  0.1211     0.8447 0.000 0.960 0.040 0.000
#> SRR2015783     1  0.0000     0.8172 1.000 0.000 0.000 0.000
#> SRR2015782     2  0.0000     0.8292 0.000 1.000 0.000 0.000
#> SRR2015781     4  0.6472     0.4920 0.000 0.212 0.148 0.640
#> SRR2015780     2  0.2999     0.8562 0.000 0.864 0.132 0.004
#> SRR2015779     2  0.4134     0.7977 0.000 0.740 0.260 0.000
#> SRR2015778     1  0.4284     0.7052 0.780 0.200 0.020 0.000
#> SRR2015777     3  0.5466     0.2768 0.040 0.292 0.668 0.000
#> SRR2015776     4  0.0336     0.8360 0.000 0.000 0.008 0.992
#> SRR2015775     2  0.2589     0.8575 0.000 0.884 0.116 0.000
#> SRR2015774     3  0.0707     0.6819 0.000 0.020 0.980 0.000
#> SRR2015773     3  0.4500     0.2700 0.000 0.316 0.684 0.000
#> SRR2015772     3  0.3801     0.4855 0.000 0.220 0.780 0.000
#> SRR2015771     3  0.4843     0.3594 0.396 0.000 0.604 0.000
#> SRR2015769     2  0.0000     0.8292 0.000 1.000 0.000 0.000
#> SRR2015770     2  0.4072     0.8054 0.000 0.748 0.252 0.000
#> SRR2015768     2  0.3726     0.8331 0.000 0.788 0.212 0.000
#> SRR2015767     4  0.0000     0.8389 0.000 0.000 0.000 1.000
#> SRR2015766     4  0.4866     0.2512 0.000 0.000 0.404 0.596
#> SRR2015764     3  0.2281     0.6360 0.000 0.096 0.904 0.000
#> SRR2015765     3  0.3494     0.5798 0.000 0.172 0.824 0.004
#> SRR2015763     1  0.4981     0.0078 0.536 0.000 0.464 0.000
#> SRR2015762     3  0.4855     0.2399 0.000 0.000 0.600 0.400
#> SRR2015761     3  0.1211     0.6752 0.000 0.000 0.960 0.040
#> SRR2015760     3  0.4584     0.5511 0.300 0.000 0.696 0.004

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>            class entropy silhouette    p1    p2    p3    p4    p5
#> SRR2015715     3  0.0740    0.77310 0.008 0.008 0.980 0.000 0.004
#> SRR2015735     3  0.4054    0.53051 0.248 0.000 0.732 0.020 0.000
#> SRR2015759     1  0.3561    0.72014 0.740 0.000 0.260 0.000 0.000
#> SRR2015753     1  0.2905    0.63171 0.868 0.000 0.096 0.000 0.036
#> SRR2015746     1  0.3885    0.49892 0.724 0.268 0.000 0.000 0.008
#> SRR2015758     2  0.0324    0.71908 0.000 0.992 0.004 0.000 0.004
#> SRR2015756     1  0.3774    0.69932 0.704 0.000 0.296 0.000 0.000
#> SRR2015757     2  0.4272    0.67735 0.052 0.752 0.196 0.000 0.000
#> SRR2015755     1  0.3452    0.72699 0.756 0.000 0.244 0.000 0.000
#> SRR2015754     1  0.4025    0.69909 0.792 0.000 0.132 0.076 0.000
#> SRR2015752     1  0.4235    0.45802 0.576 0.000 0.424 0.000 0.000
#> SRR2015749     1  0.3177    0.72856 0.792 0.000 0.208 0.000 0.000
#> SRR2015750     5  0.3519    0.68706 0.216 0.008 0.000 0.000 0.776
#> SRR2015751     1  0.4040    0.49826 0.724 0.260 0.000 0.000 0.016
#> SRR2015748     5  0.6021    0.25586 0.128 0.000 0.000 0.348 0.524
#> SRR2015747     1  0.3612    0.71782 0.732 0.000 0.268 0.000 0.000
#> SRR2015745     1  0.5816    0.00644 0.468 0.440 0.000 0.000 0.092
#> SRR2015743     3  0.4291   -0.18591 0.464 0.000 0.536 0.000 0.000
#> SRR2015744     1  0.5496    0.23269 0.548 0.400 0.000 0.020 0.032
#> SRR2015742     2  0.4807   -0.03908 0.448 0.532 0.000 0.020 0.000
#> SRR2015741     1  0.3534    0.72347 0.744 0.000 0.256 0.000 0.000
#> SRR2015740     1  0.3932    0.65167 0.672 0.000 0.328 0.000 0.000
#> SRR2015738     1  0.3177    0.72856 0.792 0.000 0.208 0.000 0.000
#> SRR2015739     1  0.3932    0.65540 0.672 0.000 0.328 0.000 0.000
#> SRR2015737     5  0.2208    0.70989 0.000 0.072 0.020 0.000 0.908
#> SRR2015736     3  0.2068    0.74056 0.004 0.092 0.904 0.000 0.000
#> SRR2015732     3  0.4942    0.31413 0.432 0.000 0.540 0.000 0.028
#> SRR2015733     2  0.2689    0.70247 0.084 0.888 0.016 0.012 0.000
#> SRR2015734     3  0.1478    0.75245 0.064 0.000 0.936 0.000 0.000
#> SRR2015731     4  0.0703    0.90536 0.000 0.000 0.024 0.976 0.000
#> SRR2015730     3  0.3480    0.54641 0.248 0.000 0.752 0.000 0.000
#> SRR2015728     3  0.0404    0.77259 0.012 0.000 0.988 0.000 0.000
#> SRR2015729     5  0.2732    0.71082 0.160 0.000 0.000 0.000 0.840
#> SRR2015727     4  0.1121    0.89068 0.000 0.000 0.044 0.956 0.000
#> SRR2015726     5  0.6235    0.40347 0.412 0.004 0.124 0.000 0.460
#> SRR2015723     5  0.3771    0.63690 0.000 0.040 0.164 0.000 0.796
#> SRR2015724     3  0.5237    0.47934 0.000 0.160 0.684 0.000 0.156
#> SRR2015725     3  0.2424    0.70358 0.132 0.000 0.868 0.000 0.000
#> SRR2015722     4  0.0000    0.91082 0.000 0.000 0.000 1.000 0.000
#> SRR2015721     3  0.0451    0.77241 0.008 0.004 0.988 0.000 0.000
#> SRR2015720     2  0.4451    0.63712 0.040 0.712 0.248 0.000 0.000
#> SRR2015718     3  0.4841    0.49110 0.000 0.084 0.708 0.000 0.208
#> SRR2015719     4  0.0000    0.91082 0.000 0.000 0.000 1.000 0.000
#> SRR2015717     3  0.1282    0.76424 0.044 0.000 0.952 0.004 0.000
#> SRR2015716     3  0.4254    0.52447 0.000 0.040 0.740 0.000 0.220
#> SRR2015714     4  0.0000    0.91082 0.000 0.000 0.000 1.000 0.000
#> SRR2015713     2  0.4283    0.59396 0.012 0.692 0.292 0.000 0.004
#> SRR2015784     5  0.4310    0.32744 0.000 0.392 0.004 0.000 0.604
#> SRR2015785     5  0.1608    0.73410 0.072 0.000 0.000 0.000 0.928
#> SRR2015783     1  0.3586    0.72007 0.736 0.000 0.264 0.000 0.000
#> SRR2015782     5  0.5653    0.60586 0.208 0.160 0.000 0.000 0.632
#> SRR2015781     2  0.2843    0.65515 0.008 0.848 0.000 0.144 0.000
#> SRR2015780     5  0.1965    0.73154 0.024 0.052 0.000 0.000 0.924
#> SRR2015779     2  0.1205    0.70092 0.004 0.956 0.000 0.000 0.040
#> SRR2015778     1  0.4206    0.45315 0.696 0.288 0.000 0.000 0.016
#> SRR2015777     2  0.2127    0.68457 0.108 0.892 0.000 0.000 0.000
#> SRR2015776     4  0.0794    0.90037 0.000 0.000 0.000 0.972 0.028
#> SRR2015775     5  0.0566    0.73553 0.012 0.004 0.000 0.000 0.984
#> SRR2015774     2  0.6348    0.42288 0.000 0.512 0.292 0.000 0.196
#> SRR2015773     2  0.4424    0.55014 0.000 0.728 0.048 0.000 0.224
#> SRR2015772     2  0.5008    0.44371 0.000 0.644 0.056 0.000 0.300
#> SRR2015771     3  0.1365    0.76052 0.004 0.004 0.952 0.000 0.040
#> SRR2015769     5  0.3039    0.69793 0.192 0.000 0.000 0.000 0.808
#> SRR2015770     5  0.2017    0.71265 0.000 0.080 0.008 0.000 0.912
#> SRR2015768     5  0.1670    0.71972 0.000 0.052 0.012 0.000 0.936
#> SRR2015767     4  0.0609    0.90582 0.000 0.000 0.000 0.980 0.020
#> SRR2015766     4  0.4238    0.40589 0.000 0.004 0.368 0.628 0.000
#> SRR2015764     2  0.0693    0.72000 0.000 0.980 0.012 0.000 0.008
#> SRR2015765     5  0.7148   -0.16066 0.000 0.324 0.332 0.012 0.332
#> SRR2015763     3  0.1281    0.77131 0.032 0.012 0.956 0.000 0.000
#> SRR2015762     2  0.1205    0.71606 0.000 0.956 0.004 0.040 0.000
#> SRR2015761     2  0.5616    0.59153 0.000 0.648 0.232 0.112 0.008
#> SRR2015760     3  0.2390    0.75980 0.024 0.060 0.908 0.008 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
#> SRR2015715     3  0.1806     0.7241 0.088 0.000 0.908 0.000 0.004 0.000
#> SRR2015735     1  0.5346     0.4446 0.604 0.032 0.296 0.068 0.000 0.000
#> SRR2015759     1  0.2119     0.7317 0.904 0.036 0.060 0.000 0.000 0.000
#> SRR2015753     1  0.3394     0.7004 0.840 0.060 0.032 0.000 0.000 0.068
#> SRR2015746     1  0.6906    -0.0524 0.408 0.172 0.000 0.000 0.340 0.080
#> SRR2015758     5  0.1411     0.5971 0.000 0.060 0.004 0.000 0.936 0.000
#> SRR2015756     1  0.2066     0.7295 0.908 0.040 0.052 0.000 0.000 0.000
#> SRR2015757     5  0.3584     0.3939 0.000 0.004 0.308 0.000 0.688 0.000
#> SRR2015755     1  0.1610     0.7081 0.916 0.084 0.000 0.000 0.000 0.000
#> SRR2015754     1  0.3175     0.6748 0.844 0.108 0.012 0.004 0.032 0.000
#> SRR2015752     1  0.3139     0.6709 0.812 0.028 0.160 0.000 0.000 0.000
#> SRR2015749     1  0.2679     0.6830 0.868 0.096 0.004 0.000 0.032 0.000
#> SRR2015750     6  0.0000     0.6591 0.000 0.000 0.000 0.000 0.000 1.000
#> SRR2015751     5  0.6590     0.0507 0.384 0.144 0.000 0.000 0.412 0.060
#> SRR2015748     2  0.7214     0.1840 0.092 0.368 0.000 0.292 0.000 0.248
#> SRR2015747     1  0.0405     0.7306 0.988 0.004 0.008 0.000 0.000 0.000
#> SRR2015745     5  0.7180     0.2655 0.164 0.160 0.000 0.000 0.448 0.228
#> SRR2015743     1  0.3210     0.6783 0.812 0.036 0.152 0.000 0.000 0.000
#> SRR2015744     1  0.6366     0.1155 0.468 0.244 0.000 0.024 0.264 0.000
#> SRR2015742     5  0.5399     0.4182 0.252 0.136 0.004 0.004 0.604 0.000
#> SRR2015741     1  0.0972     0.7318 0.964 0.008 0.028 0.000 0.000 0.000
#> SRR2015740     1  0.2581     0.6999 0.856 0.016 0.128 0.000 0.000 0.000
#> SRR2015738     1  0.3120     0.6636 0.840 0.112 0.008 0.000 0.040 0.000
#> SRR2015739     1  0.3718     0.6860 0.784 0.084 0.132 0.000 0.000 0.000
#> SRR2015737     2  0.4838     0.5556 0.000 0.636 0.016 0.004 0.040 0.304
#> SRR2015736     3  0.1806     0.6902 0.004 0.000 0.908 0.000 0.088 0.000
#> SRR2015732     6  0.6602     0.0117 0.304 0.020 0.272 0.000 0.004 0.400
#> SRR2015733     5  0.4150     0.5011 0.004 0.032 0.232 0.008 0.724 0.000
#> SRR2015734     3  0.2212     0.7065 0.112 0.008 0.880 0.000 0.000 0.000
#> SRR2015731     4  0.1464     0.8752 0.000 0.036 0.016 0.944 0.004 0.000
#> SRR2015730     1  0.4150     0.4619 0.652 0.028 0.320 0.000 0.000 0.000
#> SRR2015728     3  0.4232     0.5968 0.048 0.188 0.744 0.020 0.000 0.000
#> SRR2015729     6  0.0146     0.6597 0.000 0.004 0.000 0.000 0.000 0.996
#> SRR2015727     4  0.1088     0.8805 0.000 0.016 0.024 0.960 0.000 0.000
#> SRR2015726     6  0.2586     0.5939 0.100 0.000 0.032 0.000 0.000 0.868
#> SRR2015723     2  0.4753     0.5001 0.004 0.596 0.052 0.000 0.000 0.348
#> SRR2015724     3  0.3436     0.6928 0.032 0.052 0.836 0.000 0.080 0.000
#> SRR2015725     1  0.4755     0.0932 0.492 0.048 0.460 0.000 0.000 0.000
#> SRR2015722     4  0.0692     0.8841 0.000 0.020 0.004 0.976 0.000 0.000
#> SRR2015721     3  0.1049     0.7008 0.008 0.032 0.960 0.000 0.000 0.000
#> SRR2015720     5  0.4084     0.1885 0.000 0.012 0.400 0.000 0.588 0.000
#> SRR2015718     3  0.4468     0.0635 0.020 0.488 0.488 0.000 0.004 0.000
#> SRR2015719     4  0.0000     0.8850 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR2015717     3  0.3525     0.6206 0.180 0.032 0.784 0.004 0.000 0.000
#> SRR2015716     2  0.6015     0.2582 0.128 0.568 0.264 0.004 0.000 0.036
#> SRR2015714     4  0.0146     0.8852 0.000 0.000 0.004 0.996 0.000 0.000
#> SRR2015713     3  0.3838     0.1303 0.000 0.000 0.552 0.000 0.448 0.000
#> SRR2015784     2  0.5468     0.4955 0.000 0.520 0.000 0.004 0.360 0.116
#> SRR2015785     6  0.2092     0.5455 0.000 0.124 0.000 0.000 0.000 0.876
#> SRR2015783     1  0.1528     0.7326 0.936 0.016 0.048 0.000 0.000 0.000
#> SRR2015782     6  0.4196     0.4257 0.016 0.032 0.000 0.000 0.232 0.720
#> SRR2015781     5  0.2876     0.5706 0.000 0.056 0.000 0.080 0.860 0.004
#> SRR2015780     2  0.5614     0.3923 0.016 0.548 0.000 0.012 0.072 0.352
#> SRR2015779     5  0.2230     0.5723 0.000 0.084 0.000 0.000 0.892 0.024
#> SRR2015778     1  0.7034    -0.1305 0.372 0.168 0.000 0.000 0.364 0.096
#> SRR2015777     5  0.2448     0.5985 0.052 0.064 0.000 0.000 0.884 0.000
#> SRR2015776     4  0.2957     0.7560 0.000 0.120 0.004 0.844 0.032 0.000
#> SRR2015775     6  0.3887    -0.0420 0.000 0.360 0.008 0.000 0.000 0.632
#> SRR2015774     3  0.6088     0.1006 0.000 0.296 0.392 0.000 0.312 0.000
#> SRR2015773     2  0.4517     0.3563 0.000 0.524 0.032 0.000 0.444 0.000
#> SRR2015772     2  0.5063     0.4649 0.000 0.576 0.060 0.000 0.352 0.012
#> SRR2015771     3  0.1858     0.7234 0.092 0.000 0.904 0.000 0.004 0.000
#> SRR2015769     6  0.0146     0.6597 0.000 0.004 0.000 0.000 0.000 0.996
#> SRR2015770     2  0.5629     0.5496 0.000 0.548 0.008 0.000 0.144 0.300
#> SRR2015768     2  0.4260     0.5276 0.000 0.632 0.012 0.000 0.012 0.344
#> SRR2015767     4  0.0603     0.8804 0.000 0.016 0.004 0.980 0.000 0.000
#> SRR2015766     4  0.3852     0.2936 0.000 0.000 0.384 0.612 0.004 0.000
#> SRR2015764     5  0.1564     0.6021 0.000 0.040 0.024 0.000 0.936 0.000
#> SRR2015765     3  0.7636     0.1690 0.000 0.188 0.408 0.064 0.288 0.052
#> SRR2015763     3  0.2431     0.7081 0.132 0.000 0.860 0.000 0.008 0.000
#> SRR2015762     5  0.1642     0.6144 0.000 0.004 0.028 0.032 0.936 0.000
#> SRR2015761     5  0.5272     0.1557 0.000 0.020 0.352 0.064 0.564 0.000
#> SRR2015760     3  0.2747     0.7136 0.096 0.000 0.860 0.000 0.044 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-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

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

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

collect_plots(res)

plot of chunk MAD-hclust-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.368           0.745       0.872         0.4683 0.495   0.495
#> 3 3 0.422           0.698       0.828         0.2837 0.866   0.736
#> 4 4 0.517           0.664       0.805         0.1539 0.884   0.710
#> 5 5 0.615           0.583       0.754         0.0702 0.951   0.838
#> 6 6 0.601           0.563       0.762         0.0230 0.969   0.888

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
#> SRR2015715     1   0.184      0.867 0.972 0.028
#> SRR2015735     1   0.802      0.677 0.756 0.244
#> SRR2015759     1   0.000      0.870 1.000 0.000
#> SRR2015753     1   0.000      0.870 1.000 0.000
#> SRR2015746     2   0.795      0.749 0.240 0.760
#> SRR2015758     2   0.000      0.813 0.000 1.000
#> SRR2015756     1   0.000      0.870 1.000 0.000
#> SRR2015757     2   0.904      0.622 0.320 0.680
#> SRR2015755     1   0.000      0.870 1.000 0.000
#> SRR2015754     1   0.000      0.870 1.000 0.000
#> SRR2015752     1   0.000      0.870 1.000 0.000
#> SRR2015749     1   0.000      0.870 1.000 0.000
#> SRR2015750     2   0.388      0.818 0.076 0.924
#> SRR2015751     2   0.795      0.749 0.240 0.760
#> SRR2015748     2   0.998      0.133 0.472 0.528
#> SRR2015747     1   0.000      0.870 1.000 0.000
#> SRR2015745     2   0.689      0.778 0.184 0.816
#> SRR2015743     1   0.000      0.870 1.000 0.000
#> SRR2015744     2   0.980      0.427 0.416 0.584
#> SRR2015742     2   0.795      0.749 0.240 0.760
#> SRR2015741     1   0.000      0.870 1.000 0.000
#> SRR2015740     1   0.000      0.870 1.000 0.000
#> SRR2015738     1   0.000      0.870 1.000 0.000
#> SRR2015739     1   0.000      0.870 1.000 0.000
#> SRR2015737     2   0.000      0.813 0.000 1.000
#> SRR2015736     2   0.904      0.622 0.320 0.680
#> SRR2015732     1   0.184      0.867 0.972 0.028
#> SRR2015733     2   0.494      0.813 0.108 0.892
#> SRR2015734     1   0.184      0.867 0.972 0.028
#> SRR2015731     1   0.827      0.652 0.740 0.260
#> SRR2015730     1   0.000      0.870 1.000 0.000
#> SRR2015728     1   0.388      0.839 0.924 0.076
#> SRR2015729     2   0.634      0.793 0.160 0.840
#> SRR2015727     1   0.827      0.652 0.740 0.260
#> SRR2015726     1   0.184      0.867 0.972 0.028
#> SRR2015723     1   0.680      0.754 0.820 0.180
#> SRR2015724     1   0.975      0.240 0.592 0.408
#> SRR2015725     1   0.000      0.870 1.000 0.000
#> SRR2015722     1   0.827      0.652 0.740 0.260
#> SRR2015721     2   0.921      0.586 0.336 0.664
#> SRR2015720     2   0.904      0.622 0.320 0.680
#> SRR2015718     1   0.973      0.254 0.596 0.404
#> SRR2015719     2   0.000      0.813 0.000 1.000
#> SRR2015717     1   0.802      0.677 0.756 0.244
#> SRR2015716     1   0.680      0.754 0.820 0.180
#> SRR2015714     2   0.000      0.813 0.000 1.000
#> SRR2015713     2   0.904      0.622 0.320 0.680
#> SRR2015784     2   0.000      0.813 0.000 1.000
#> SRR2015785     2   0.000      0.813 0.000 1.000
#> SRR2015783     1   0.000      0.870 1.000 0.000
#> SRR2015782     2   0.494      0.812 0.108 0.892
#> SRR2015781     2   0.000      0.813 0.000 1.000
#> SRR2015780     2   0.000      0.813 0.000 1.000
#> SRR2015779     2   0.000      0.813 0.000 1.000
#> SRR2015778     2   0.795      0.749 0.240 0.760
#> SRR2015777     2   0.795      0.749 0.240 0.760
#> SRR2015776     2   0.000      0.813 0.000 1.000
#> SRR2015775     2   0.634      0.793 0.160 0.840
#> SRR2015774     2   0.996      0.260 0.464 0.536
#> SRR2015773     2   0.343      0.819 0.064 0.936
#> SRR2015772     2   0.343      0.819 0.064 0.936
#> SRR2015771     1   0.184      0.867 0.972 0.028
#> SRR2015769     2   0.634      0.793 0.160 0.840
#> SRR2015770     2   0.000      0.813 0.000 1.000
#> SRR2015768     2   0.000      0.813 0.000 1.000
#> SRR2015767     2   0.000      0.813 0.000 1.000
#> SRR2015766     1   0.886      0.563 0.696 0.304
#> SRR2015764     2   0.343      0.819 0.064 0.936
#> SRR2015765     2   0.881      0.653 0.300 0.700
#> SRR2015763     1   0.184      0.867 0.972 0.028
#> SRR2015762     2   0.000      0.813 0.000 1.000
#> SRR2015761     2   0.996      0.260 0.464 0.536
#> SRR2015760     1   0.876      0.581 0.704 0.296

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>            class entropy silhouette    p1    p2    p3
#> SRR2015715     1  0.1964     0.8257 0.944 0.056 0.000
#> SRR2015735     1  0.6814     0.4940 0.608 0.372 0.020
#> SRR2015759     1  0.0000     0.8272 1.000 0.000 0.000
#> SRR2015753     1  0.0000     0.8272 1.000 0.000 0.000
#> SRR2015746     2  0.6594     0.7043 0.128 0.756 0.116
#> SRR2015758     2  0.4178     0.6469 0.000 0.828 0.172
#> SRR2015756     1  0.0475     0.8278 0.992 0.004 0.004
#> SRR2015757     2  0.4235     0.6901 0.176 0.824 0.000
#> SRR2015755     1  0.1315     0.8260 0.972 0.008 0.020
#> SRR2015754     1  0.3670     0.7930 0.888 0.092 0.020
#> SRR2015752     1  0.0000     0.8272 1.000 0.000 0.000
#> SRR2015749     1  0.0000     0.8272 1.000 0.000 0.000
#> SRR2015750     2  0.2711     0.7182 0.000 0.912 0.088
#> SRR2015751     2  0.6594     0.7043 0.128 0.756 0.116
#> SRR2015748     2  0.9894     0.1327 0.356 0.380 0.264
#> SRR2015747     1  0.0000     0.8272 1.000 0.000 0.000
#> SRR2015745     2  0.5915     0.7160 0.080 0.792 0.128
#> SRR2015743     1  0.0000     0.8272 1.000 0.000 0.000
#> SRR2015744     2  0.8600     0.5114 0.284 0.580 0.136
#> SRR2015742     2  0.6594     0.7043 0.128 0.756 0.116
#> SRR2015741     1  0.1315     0.8260 0.972 0.008 0.020
#> SRR2015740     1  0.0000     0.8272 1.000 0.000 0.000
#> SRR2015738     1  0.3670     0.7930 0.888 0.092 0.020
#> SRR2015739     1  0.0475     0.8278 0.992 0.004 0.004
#> SRR2015737     2  0.4178     0.6469 0.000 0.828 0.172
#> SRR2015736     2  0.4235     0.6901 0.176 0.824 0.000
#> SRR2015732     1  0.1964     0.8257 0.944 0.056 0.000
#> SRR2015733     2  0.1860     0.7318 0.000 0.948 0.052
#> SRR2015734     1  0.1964     0.8257 0.944 0.056 0.000
#> SRR2015731     1  0.7083     0.4653 0.592 0.380 0.028
#> SRR2015730     1  0.0000     0.8272 1.000 0.000 0.000
#> SRR2015728     1  0.3116     0.7952 0.892 0.108 0.000
#> SRR2015729     2  0.1905     0.7399 0.028 0.956 0.016
#> SRR2015727     1  0.7083     0.4653 0.592 0.380 0.028
#> SRR2015726     1  0.1964     0.8257 0.944 0.056 0.000
#> SRR2015723     1  0.6090     0.6482 0.716 0.264 0.020
#> SRR2015724     2  0.7295    -0.1032 0.484 0.488 0.028
#> SRR2015725     1  0.0000     0.8272 1.000 0.000 0.000
#> SRR2015722     1  0.7083     0.4653 0.592 0.380 0.028
#> SRR2015721     2  0.4452     0.6713 0.192 0.808 0.000
#> SRR2015720     2  0.4235     0.6901 0.176 0.824 0.000
#> SRR2015718     1  0.7295     0.0539 0.488 0.484 0.028
#> SRR2015719     3  0.0892     0.8909 0.000 0.020 0.980
#> SRR2015717     1  0.6814     0.4940 0.608 0.372 0.020
#> SRR2015716     1  0.6090     0.6482 0.716 0.264 0.020
#> SRR2015714     3  0.1031     0.8919 0.000 0.024 0.976
#> SRR2015713     2  0.4235     0.6901 0.176 0.824 0.000
#> SRR2015784     3  0.4887     0.8143 0.000 0.228 0.772
#> SRR2015785     3  0.4887     0.8143 0.000 0.228 0.772
#> SRR2015783     1  0.0000     0.8272 1.000 0.000 0.000
#> SRR2015782     2  0.5115     0.6778 0.016 0.796 0.188
#> SRR2015781     3  0.3619     0.8790 0.000 0.136 0.864
#> SRR2015780     3  0.4887     0.8143 0.000 0.228 0.772
#> SRR2015779     3  0.3686     0.8777 0.000 0.140 0.860
#> SRR2015778     2  0.6594     0.7043 0.128 0.756 0.116
#> SRR2015777     2  0.6594     0.7043 0.128 0.756 0.116
#> SRR2015776     3  0.0892     0.8909 0.000 0.020 0.980
#> SRR2015775     2  0.1905     0.7399 0.028 0.956 0.016
#> SRR2015774     2  0.6772     0.4729 0.304 0.664 0.032
#> SRR2015773     2  0.2878     0.7150 0.000 0.904 0.096
#> SRR2015772     2  0.2878     0.7150 0.000 0.904 0.096
#> SRR2015771     1  0.1964     0.8257 0.944 0.056 0.000
#> SRR2015769     2  0.1905     0.7399 0.028 0.956 0.016
#> SRR2015770     2  0.4178     0.6469 0.000 0.828 0.172
#> SRR2015768     2  0.4178     0.6469 0.000 0.828 0.172
#> SRR2015767     3  0.0892     0.8909 0.000 0.020 0.980
#> SRR2015766     1  0.7213     0.3528 0.552 0.420 0.028
#> SRR2015764     2  0.2878     0.7150 0.000 0.904 0.096
#> SRR2015765     2  0.5393     0.7186 0.148 0.808 0.044
#> SRR2015763     1  0.1964     0.8257 0.944 0.056 0.000
#> SRR2015762     3  0.1163     0.8925 0.000 0.028 0.972
#> SRR2015761     2  0.6772     0.4729 0.304 0.664 0.032
#> SRR2015760     1  0.7192     0.3764 0.560 0.412 0.028

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> SRR2015715     1  0.2411     0.8352 0.920 0.040 0.040 0.000
#> SRR2015735     3  0.5620     0.8125 0.208 0.084 0.708 0.000
#> SRR2015759     1  0.0000     0.8569 1.000 0.000 0.000 0.000
#> SRR2015753     1  0.0000     0.8569 1.000 0.000 0.000 0.000
#> SRR2015746     2  0.5736     0.5716 0.044 0.628 0.328 0.000
#> SRR2015758     2  0.2714     0.6505 0.000 0.884 0.004 0.112
#> SRR2015756     1  0.0921     0.8490 0.972 0.000 0.028 0.000
#> SRR2015757     2  0.4948     0.6150 0.124 0.776 0.100 0.000
#> SRR2015755     1  0.3074     0.7446 0.848 0.000 0.152 0.000
#> SRR2015754     1  0.4925     0.1576 0.572 0.000 0.428 0.000
#> SRR2015752     1  0.0000     0.8569 1.000 0.000 0.000 0.000
#> SRR2015749     1  0.0000     0.8569 1.000 0.000 0.000 0.000
#> SRR2015750     2  0.1109     0.6986 0.000 0.968 0.004 0.028
#> SRR2015751     2  0.5736     0.5716 0.044 0.628 0.328 0.000
#> SRR2015748     3  0.3009     0.4402 0.000 0.052 0.892 0.056
#> SRR2015747     1  0.0000     0.8569 1.000 0.000 0.000 0.000
#> SRR2015745     2  0.4522     0.6023 0.000 0.680 0.320 0.000
#> SRR2015743     1  0.0000     0.8569 1.000 0.000 0.000 0.000
#> SRR2015744     3  0.5913    -0.0355 0.048 0.352 0.600 0.000
#> SRR2015742     2  0.5736     0.5716 0.044 0.628 0.328 0.000
#> SRR2015741     1  0.3123     0.7399 0.844 0.000 0.156 0.000
#> SRR2015740     1  0.0000     0.8569 1.000 0.000 0.000 0.000
#> SRR2015738     1  0.4925     0.1576 0.572 0.000 0.428 0.000
#> SRR2015739     1  0.0921     0.8490 0.972 0.000 0.028 0.000
#> SRR2015737     2  0.2714     0.6505 0.000 0.884 0.004 0.112
#> SRR2015736     2  0.5006     0.6124 0.124 0.772 0.104 0.000
#> SRR2015732     1  0.2411     0.8352 0.920 0.040 0.040 0.000
#> SRR2015733     2  0.2021     0.7050 0.000 0.936 0.040 0.024
#> SRR2015734     1  0.2411     0.8352 0.920 0.040 0.040 0.000
#> SRR2015731     3  0.5594     0.8290 0.192 0.092 0.716 0.000
#> SRR2015730     1  0.0000     0.8569 1.000 0.000 0.000 0.000
#> SRR2015728     1  0.3439     0.7612 0.868 0.084 0.048 0.000
#> SRR2015729     2  0.1474     0.6986 0.000 0.948 0.052 0.000
#> SRR2015727     3  0.5594     0.8290 0.192 0.092 0.716 0.000
#> SRR2015726     1  0.2411     0.8352 0.920 0.040 0.040 0.000
#> SRR2015723     1  0.6730     0.2993 0.592 0.132 0.276 0.000
#> SRR2015724     2  0.7919    -0.2218 0.320 0.352 0.328 0.000
#> SRR2015725     1  0.0000     0.8569 1.000 0.000 0.000 0.000
#> SRR2015722     3  0.5594     0.8290 0.192 0.092 0.716 0.000
#> SRR2015721     2  0.5209     0.5886 0.140 0.756 0.104 0.000
#> SRR2015720     2  0.5006     0.6124 0.124 0.772 0.104 0.000
#> SRR2015718     2  0.7919    -0.2228 0.324 0.352 0.324 0.000
#> SRR2015719     4  0.0000     0.8340 0.000 0.000 0.000 1.000
#> SRR2015717     3  0.5620     0.8125 0.208 0.084 0.708 0.000
#> SRR2015716     1  0.6730     0.2993 0.592 0.132 0.276 0.000
#> SRR2015714     4  0.0188     0.8353 0.000 0.004 0.000 0.996
#> SRR2015713     2  0.5006     0.6124 0.124 0.772 0.104 0.000
#> SRR2015784     4  0.5705     0.7584 0.000 0.260 0.064 0.676
#> SRR2015785     4  0.5705     0.7584 0.000 0.260 0.064 0.676
#> SRR2015783     1  0.0000     0.8569 1.000 0.000 0.000 0.000
#> SRR2015782     2  0.4804     0.6548 0.000 0.780 0.148 0.072
#> SRR2015781     4  0.4656     0.8256 0.000 0.160 0.056 0.784
#> SRR2015780     4  0.5705     0.7584 0.000 0.260 0.064 0.676
#> SRR2015779     4  0.4701     0.8246 0.000 0.164 0.056 0.780
#> SRR2015778     2  0.5736     0.5716 0.044 0.628 0.328 0.000
#> SRR2015777     2  0.5736     0.5716 0.044 0.628 0.328 0.000
#> SRR2015776     4  0.0000     0.8340 0.000 0.000 0.000 1.000
#> SRR2015775     2  0.1474     0.6986 0.000 0.948 0.052 0.000
#> SRR2015774     2  0.7201     0.2184 0.140 0.532 0.324 0.004
#> SRR2015773     2  0.1677     0.6984 0.000 0.948 0.012 0.040
#> SRR2015772     2  0.1677     0.6984 0.000 0.948 0.012 0.040
#> SRR2015771     1  0.2411     0.8352 0.920 0.040 0.040 0.000
#> SRR2015769     2  0.1474     0.6986 0.000 0.948 0.052 0.000
#> SRR2015770     2  0.2714     0.6505 0.000 0.884 0.004 0.112
#> SRR2015768     2  0.2714     0.6505 0.000 0.884 0.004 0.112
#> SRR2015767     4  0.0000     0.8340 0.000 0.000 0.000 1.000
#> SRR2015766     3  0.6303     0.7895 0.192 0.148 0.660 0.000
#> SRR2015764     2  0.1677     0.6984 0.000 0.948 0.012 0.040
#> SRR2015765     2  0.4509     0.4981 0.000 0.708 0.288 0.004
#> SRR2015763     1  0.2411     0.8352 0.920 0.040 0.040 0.000
#> SRR2015762     4  0.0707     0.8374 0.000 0.020 0.000 0.980
#> SRR2015761     2  0.7201     0.2184 0.140 0.532 0.324 0.004
#> SRR2015760     3  0.6123     0.8071 0.192 0.132 0.676 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
#> SRR2015715     1  0.3563     0.6757 0.780 0.012 0.000 0.000 0.208
#> SRR2015735     3  0.4928     0.7271 0.056 0.000 0.660 0.000 0.284
#> SRR2015759     1  0.0000     0.7983 1.000 0.000 0.000 0.000 0.000
#> SRR2015753     1  0.0000     0.7983 1.000 0.000 0.000 0.000 0.000
#> SRR2015746     2  0.6298     0.4402 0.044 0.540 0.352 0.000 0.064
#> SRR2015758     2  0.2011     0.6045 0.000 0.908 0.000 0.088 0.004
#> SRR2015756     1  0.0794     0.7899 0.972 0.000 0.028 0.000 0.000
#> SRR2015757     2  0.4508     0.3642 0.000 0.648 0.020 0.000 0.332
#> SRR2015755     1  0.2648     0.7138 0.848 0.000 0.152 0.000 0.000
#> SRR2015754     1  0.5295     0.2455 0.540 0.000 0.408 0.000 0.052
#> SRR2015752     1  0.0000     0.7983 1.000 0.000 0.000 0.000 0.000
#> SRR2015749     1  0.0000     0.7983 1.000 0.000 0.000 0.000 0.000
#> SRR2015750     2  0.0324     0.6457 0.000 0.992 0.000 0.004 0.004
#> SRR2015751     2  0.6298     0.4402 0.044 0.540 0.352 0.000 0.064
#> SRR2015748     3  0.2561     0.3756 0.000 0.000 0.884 0.020 0.096
#> SRR2015747     1  0.0000     0.7983 1.000 0.000 0.000 0.000 0.000
#> SRR2015745     2  0.5016     0.4960 0.000 0.608 0.348 0.000 0.044
#> SRR2015743     1  0.0000     0.7983 1.000 0.000 0.000 0.000 0.000
#> SRR2015744     3  0.6820    -0.1168 0.044 0.264 0.548 0.000 0.144
#> SRR2015742     2  0.6298     0.4402 0.044 0.540 0.352 0.000 0.064
#> SRR2015741     1  0.2690     0.7104 0.844 0.000 0.156 0.000 0.000
#> SRR2015740     1  0.0000     0.7983 1.000 0.000 0.000 0.000 0.000
#> SRR2015738     1  0.5295     0.2455 0.540 0.000 0.408 0.000 0.052
#> SRR2015739     1  0.0794     0.7899 0.972 0.000 0.028 0.000 0.000
#> SRR2015737     2  0.2011     0.6045 0.000 0.908 0.000 0.088 0.004
#> SRR2015736     2  0.4608     0.3489 0.000 0.640 0.024 0.000 0.336
#> SRR2015732     1  0.3563     0.6757 0.780 0.012 0.000 0.000 0.208
#> SRR2015733     2  0.2270     0.6403 0.000 0.904 0.020 0.000 0.076
#> SRR2015734     1  0.3563     0.6757 0.780 0.012 0.000 0.000 0.208
#> SRR2015731     3  0.4708     0.7402 0.040 0.000 0.668 0.000 0.292
#> SRR2015730     1  0.0000     0.7983 1.000 0.000 0.000 0.000 0.000
#> SRR2015728     5  0.4182    -0.0945 0.352 0.000 0.004 0.000 0.644
#> SRR2015729     2  0.2127     0.6347 0.000 0.892 0.000 0.000 0.108
#> SRR2015727     3  0.4708     0.7402 0.040 0.000 0.668 0.000 0.292
#> SRR2015726     1  0.3563     0.6757 0.780 0.012 0.000 0.000 0.208
#> SRR2015723     1  0.6618    -0.0597 0.448 0.028 0.108 0.000 0.416
#> SRR2015724     5  0.8062     0.4535 0.180 0.228 0.156 0.000 0.436
#> SRR2015725     1  0.0000     0.7983 1.000 0.000 0.000 0.000 0.000
#> SRR2015722     3  0.4708     0.7402 0.040 0.000 0.668 0.000 0.292
#> SRR2015721     2  0.4585     0.3008 0.000 0.628 0.020 0.000 0.352
#> SRR2015720     2  0.4608     0.3489 0.000 0.640 0.024 0.000 0.336
#> SRR2015718     5  0.8083     0.4517 0.184 0.228 0.156 0.000 0.432
#> SRR2015719     4  0.1478     0.7742 0.000 0.000 0.000 0.936 0.064
#> SRR2015717     3  0.4928     0.7271 0.056 0.000 0.660 0.000 0.284
#> SRR2015716     1  0.6618    -0.0597 0.448 0.028 0.108 0.000 0.416
#> SRR2015714     4  0.0324     0.7916 0.000 0.004 0.000 0.992 0.004
#> SRR2015713     2  0.4608     0.3489 0.000 0.640 0.024 0.000 0.336
#> SRR2015784     4  0.6171     0.7464 0.000 0.272 0.052 0.608 0.068
#> SRR2015785     4  0.6171     0.7464 0.000 0.272 0.052 0.608 0.068
#> SRR2015783     1  0.0000     0.7983 1.000 0.000 0.000 0.000 0.000
#> SRR2015782     2  0.4104     0.5917 0.000 0.788 0.124 0.000 0.088
#> SRR2015781     4  0.5333     0.7918 0.000 0.176 0.044 0.716 0.064
#> SRR2015780     4  0.6171     0.7464 0.000 0.272 0.052 0.608 0.068
#> SRR2015779     4  0.5467     0.7888 0.000 0.192 0.044 0.700 0.064
#> SRR2015778     2  0.6298     0.4402 0.044 0.540 0.352 0.000 0.064
#> SRR2015777     2  0.6298     0.4402 0.044 0.540 0.352 0.000 0.064
#> SRR2015776     4  0.1478     0.7742 0.000 0.000 0.000 0.936 0.064
#> SRR2015775     2  0.2127     0.6347 0.000 0.892 0.000 0.000 0.108
#> SRR2015774     5  0.6505     0.3470 0.000 0.392 0.164 0.004 0.440
#> SRR2015773     2  0.1211     0.6520 0.000 0.960 0.000 0.016 0.024
#> SRR2015772     2  0.1211     0.6520 0.000 0.960 0.000 0.016 0.024
#> SRR2015771     1  0.3563     0.6757 0.780 0.012 0.000 0.000 0.208
#> SRR2015769     2  0.2127     0.6347 0.000 0.892 0.000 0.000 0.108
#> SRR2015770     2  0.2011     0.6045 0.000 0.908 0.000 0.088 0.004
#> SRR2015768     2  0.2011     0.6045 0.000 0.908 0.000 0.088 0.004
#> SRR2015767     4  0.1478     0.7742 0.000 0.000 0.000 0.936 0.064
#> SRR2015766     3  0.6118     0.5856 0.040 0.052 0.536 0.000 0.372
#> SRR2015764     2  0.1211     0.6520 0.000 0.960 0.000 0.016 0.024
#> SRR2015765     2  0.6048     0.1507 0.000 0.588 0.160 0.004 0.248
#> SRR2015763     1  0.3563     0.6757 0.780 0.012 0.000 0.000 0.208
#> SRR2015762     4  0.0510     0.7944 0.000 0.016 0.000 0.984 0.000
#> SRR2015761     5  0.6505     0.3470 0.000 0.392 0.164 0.004 0.440
#> SRR2015760     3  0.5652     0.6875 0.040 0.036 0.616 0.000 0.308

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>            class entropy silhouette    p1    p2    p3    p4    p5    p6
#> SRR2015715     1  0.3859     0.7029 0.772 0.000 0.176 0.000 0.036 0.016
#> SRR2015735     3  0.0458     0.5839 0.016 0.000 0.984 0.000 0.000 0.000
#> SRR2015759     1  0.0000     0.7971 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2015753     1  0.0000     0.7971 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2015746     6  0.6272     0.4458 0.044 0.000 0.148 0.260 0.004 0.544
#> SRR2015758     6  0.2997     0.5770 0.000 0.096 0.000 0.000 0.060 0.844
#> SRR2015756     1  0.0713     0.7882 0.972 0.000 0.028 0.000 0.000 0.000
#> SRR2015757     6  0.5286     0.5514 0.000 0.000 0.204 0.024 0.120 0.652
#> SRR2015755     1  0.2378     0.7072 0.848 0.000 0.152 0.000 0.000 0.000
#> SRR2015754     1  0.3851     0.2984 0.540 0.000 0.460 0.000 0.000 0.000
#> SRR2015752     1  0.0000     0.7971 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2015749     1  0.0000     0.7971 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2015750     6  0.1625     0.6298 0.000 0.012 0.000 0.000 0.060 0.928
#> SRR2015751     6  0.6272     0.4458 0.044 0.000 0.148 0.260 0.004 0.544
#> SRR2015748     5  0.5817     0.0000 0.000 0.000 0.260 0.244 0.496 0.000
#> SRR2015747     1  0.0000     0.7971 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2015745     6  0.5267     0.4872 0.000 0.000 0.120 0.260 0.008 0.612
#> SRR2015743     1  0.0000     0.7971 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2015744     3  0.7855    -0.1951 0.044 0.000 0.356 0.252 0.080 0.268
#> SRR2015742     6  0.6272     0.4458 0.044 0.000 0.148 0.260 0.004 0.544
#> SRR2015741     1  0.2416     0.7034 0.844 0.000 0.156 0.000 0.000 0.000
#> SRR2015740     1  0.0000     0.7971 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2015738     1  0.3851     0.2984 0.540 0.000 0.460 0.000 0.000 0.000
#> SRR2015739     1  0.0713     0.7882 0.972 0.000 0.028 0.000 0.000 0.000
#> SRR2015737     6  0.2997     0.5770 0.000 0.096 0.000 0.000 0.060 0.844
#> SRR2015736     6  0.5181     0.5454 0.000 0.000 0.212 0.016 0.120 0.652
#> SRR2015732     1  0.3859     0.7029 0.772 0.000 0.176 0.000 0.036 0.016
#> SRR2015733     6  0.3127     0.6563 0.000 0.000 0.060 0.024 0.060 0.856
#> SRR2015734     1  0.3859     0.7029 0.772 0.000 0.176 0.000 0.036 0.016
#> SRR2015731     3  0.0000     0.5943 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2015730     1  0.0000     0.7971 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2015728     4  0.4527     0.0000 0.008 0.000 0.132 0.724 0.136 0.000
#> SRR2015729     6  0.2624     0.6516 0.000 0.000 0.004 0.004 0.148 0.844
#> SRR2015727     3  0.0000     0.5943 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2015726     1  0.3859     0.7029 0.772 0.000 0.176 0.000 0.036 0.016
#> SRR2015723     1  0.6436     0.0942 0.440 0.000 0.324 0.000 0.208 0.028
#> SRR2015724     3  0.7432     0.2538 0.176 0.000 0.396 0.000 0.200 0.228
#> SRR2015725     1  0.0000     0.7971 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2015722     3  0.0000     0.5943 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2015721     6  0.4832     0.5166 0.000 0.000 0.244 0.000 0.108 0.648
#> SRR2015720     6  0.5181     0.5454 0.000 0.000 0.212 0.016 0.120 0.652
#> SRR2015718     3  0.7434     0.2538 0.180 0.000 0.396 0.000 0.196 0.228
#> SRR2015719     2  0.1967     0.6578 0.000 0.904 0.000 0.012 0.084 0.000
#> SRR2015717     3  0.0458     0.5839 0.016 0.000 0.984 0.000 0.000 0.000
#> SRR2015716     1  0.6436     0.0942 0.440 0.000 0.324 0.000 0.208 0.028
#> SRR2015714     2  0.0551     0.6977 0.000 0.984 0.000 0.008 0.004 0.004
#> SRR2015713     6  0.5181     0.5454 0.000 0.000 0.212 0.016 0.120 0.652
#> SRR2015784     2  0.5294     0.6636 0.000 0.616 0.000 0.008 0.132 0.244
#> SRR2015785     2  0.5294     0.6636 0.000 0.616 0.000 0.008 0.132 0.244
#> SRR2015783     1  0.0000     0.7971 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2015782     6  0.4252     0.5765 0.000 0.000 0.028 0.076 0.128 0.768
#> SRR2015781     2  0.4343     0.7102 0.000 0.724 0.000 0.000 0.120 0.156
#> SRR2015780     2  0.5294     0.6636 0.000 0.616 0.000 0.008 0.132 0.244
#> SRR2015779     2  0.4482     0.7055 0.000 0.708 0.000 0.000 0.124 0.168
#> SRR2015778     6  0.6272     0.4458 0.044 0.000 0.148 0.260 0.004 0.544
#> SRR2015777     6  0.6272     0.4458 0.044 0.000 0.148 0.260 0.004 0.544
#> SRR2015776     2  0.1967     0.6578 0.000 0.904 0.000 0.012 0.084 0.000
#> SRR2015775     6  0.2624     0.6516 0.000 0.000 0.004 0.004 0.148 0.844
#> SRR2015774     6  0.5963     0.0783 0.000 0.004 0.396 0.000 0.188 0.412
#> SRR2015773     6  0.1232     0.6453 0.000 0.024 0.004 0.000 0.016 0.956
#> SRR2015772     6  0.1232     0.6453 0.000 0.024 0.004 0.000 0.016 0.956
#> SRR2015771     1  0.3859     0.7029 0.772 0.000 0.176 0.000 0.036 0.016
#> SRR2015769     6  0.2624     0.6516 0.000 0.000 0.004 0.004 0.148 0.844
#> SRR2015770     6  0.2997     0.5770 0.000 0.096 0.000 0.000 0.060 0.844
#> SRR2015768     6  0.2997     0.5770 0.000 0.096 0.000 0.000 0.060 0.844
#> SRR2015767     2  0.1967     0.6578 0.000 0.904 0.000 0.012 0.084 0.000
#> SRR2015766     3  0.2837     0.5082 0.000 0.000 0.856 0.000 0.088 0.056
#> SRR2015764     6  0.1232     0.6453 0.000 0.024 0.004 0.000 0.016 0.956
#> SRR2015765     6  0.5835     0.4049 0.000 0.004 0.228 0.004 0.220 0.544
#> SRR2015763     1  0.3859     0.7029 0.772 0.000 0.176 0.000 0.036 0.016
#> SRR2015762     2  0.0260     0.7023 0.000 0.992 0.000 0.000 0.000 0.008
#> SRR2015761     6  0.5963     0.0783 0.000 0.004 0.396 0.000 0.188 0.412
#> SRR2015760     3  0.1320     0.5787 0.000 0.000 0.948 0.000 0.016 0.036

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

consensus_heatmap(res, k = 2)

plot of chunk tab-MAD-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

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 17223 rows and 73 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.683           0.896       0.951          0.487 0.509   0.509
#> 3 3 0.595           0.435       0.721          0.310 0.808   0.640
#> 4 4 0.649           0.714       0.815          0.130 0.709   0.390
#> 5 5 0.688           0.752       0.830          0.081 0.901   0.682
#> 6 6 0.701           0.635       0.761          0.045 0.949   0.776

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
#> SRR2015715     1  0.0000     0.9363 1.000 0.000
#> SRR2015735     1  0.0000     0.9363 1.000 0.000
#> SRR2015759     1  0.0000     0.9363 1.000 0.000
#> SRR2015753     1  0.0000     0.9363 1.000 0.000
#> SRR2015746     1  0.5842     0.8594 0.860 0.140
#> SRR2015758     2  0.0000     0.9571 0.000 1.000
#> SRR2015756     1  0.0000     0.9363 1.000 0.000
#> SRR2015757     1  0.6712     0.8198 0.824 0.176
#> SRR2015755     1  0.0000     0.9363 1.000 0.000
#> SRR2015754     1  0.0000     0.9363 1.000 0.000
#> SRR2015752     1  0.0000     0.9363 1.000 0.000
#> SRR2015749     1  0.0000     0.9363 1.000 0.000
#> SRR2015750     2  0.0000     0.9571 0.000 1.000
#> SRR2015751     1  0.2043     0.9229 0.968 0.032
#> SRR2015748     2  0.8327     0.5932 0.264 0.736
#> SRR2015747     1  0.0000     0.9363 1.000 0.000
#> SRR2015745     2  0.0000     0.9571 0.000 1.000
#> SRR2015743     1  0.0000     0.9363 1.000 0.000
#> SRR2015744     1  0.6247     0.8477 0.844 0.156
#> SRR2015742     1  0.6247     0.8477 0.844 0.156
#> SRR2015741     1  0.0000     0.9363 1.000 0.000
#> SRR2015740     1  0.0000     0.9363 1.000 0.000
#> SRR2015738     1  0.0000     0.9363 1.000 0.000
#> SRR2015739     1  0.0000     0.9363 1.000 0.000
#> SRR2015737     2  0.0000     0.9571 0.000 1.000
#> SRR2015736     1  0.8267     0.7218 0.740 0.260
#> SRR2015732     1  0.0000     0.9363 1.000 0.000
#> SRR2015733     2  0.0000     0.9571 0.000 1.000
#> SRR2015734     1  0.0000     0.9363 1.000 0.000
#> SRR2015731     1  0.7528     0.7831 0.784 0.216
#> SRR2015730     1  0.0000     0.9363 1.000 0.000
#> SRR2015728     1  0.0000     0.9363 1.000 0.000
#> SRR2015729     2  0.0000     0.9571 0.000 1.000
#> SRR2015727     1  0.6247     0.8477 0.844 0.156
#> SRR2015726     1  0.0000     0.9363 1.000 0.000
#> SRR2015723     1  0.0938     0.9317 0.988 0.012
#> SRR2015724     1  0.1843     0.9251 0.972 0.028
#> SRR2015725     1  0.0000     0.9363 1.000 0.000
#> SRR2015722     1  0.6148     0.8508 0.848 0.152
#> SRR2015721     2  0.9954     0.0146 0.460 0.540
#> SRR2015720     1  0.8267     0.7218 0.740 0.260
#> SRR2015718     1  0.6247     0.8477 0.844 0.156
#> SRR2015719     2  0.0000     0.9571 0.000 1.000
#> SRR2015717     1  0.0000     0.9363 1.000 0.000
#> SRR2015716     1  0.0000     0.9363 1.000 0.000
#> SRR2015714     2  0.0000     0.9571 0.000 1.000
#> SRR2015713     2  0.9552     0.3138 0.376 0.624
#> SRR2015784     2  0.0000     0.9571 0.000 1.000
#> SRR2015785     2  0.0000     0.9571 0.000 1.000
#> SRR2015783     1  0.0000     0.9363 1.000 0.000
#> SRR2015782     2  0.0000     0.9571 0.000 1.000
#> SRR2015781     2  0.0000     0.9571 0.000 1.000
#> SRR2015780     2  0.0000     0.9571 0.000 1.000
#> SRR2015779     2  0.0000     0.9571 0.000 1.000
#> SRR2015778     1  0.7602     0.7782 0.780 0.220
#> SRR2015777     1  0.6247     0.8477 0.844 0.156
#> SRR2015776     2  0.0000     0.9571 0.000 1.000
#> SRR2015775     2  0.0000     0.9571 0.000 1.000
#> SRR2015774     2  0.0000     0.9571 0.000 1.000
#> SRR2015773     2  0.0000     0.9571 0.000 1.000
#> SRR2015772     2  0.0000     0.9571 0.000 1.000
#> SRR2015771     1  0.0000     0.9363 1.000 0.000
#> SRR2015769     2  0.0000     0.9571 0.000 1.000
#> SRR2015770     2  0.0000     0.9571 0.000 1.000
#> SRR2015768     2  0.0000     0.9571 0.000 1.000
#> SRR2015767     2  0.0000     0.9571 0.000 1.000
#> SRR2015766     1  0.7528     0.7831 0.784 0.216
#> SRR2015764     2  0.0000     0.9571 0.000 1.000
#> SRR2015765     2  0.0000     0.9571 0.000 1.000
#> SRR2015763     1  0.0000     0.9363 1.000 0.000
#> SRR2015762     2  0.0000     0.9571 0.000 1.000
#> SRR2015761     2  0.0000     0.9571 0.000 1.000
#> SRR2015760     1  0.0000     0.9363 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
#> SRR2015715     1  0.2711      0.156 0.912 0.000 0.088
#> SRR2015735     1  0.1031      0.313 0.976 0.000 0.024
#> SRR2015759     1  0.6154      0.548 0.592 0.000 0.408
#> SRR2015753     1  0.6154      0.548 0.592 0.000 0.408
#> SRR2015746     1  0.6305     -0.793 0.516 0.000 0.484
#> SRR2015758     2  0.2796      0.862 0.000 0.908 0.092
#> SRR2015756     1  0.6154      0.548 0.592 0.000 0.408
#> SRR2015757     3  0.7293      0.866 0.476 0.028 0.496
#> SRR2015755     1  0.6154      0.548 0.592 0.000 0.408
#> SRR2015754     1  0.6154      0.548 0.592 0.000 0.408
#> SRR2015752     1  0.6154      0.548 0.592 0.000 0.408
#> SRR2015749     1  0.6154      0.548 0.592 0.000 0.408
#> SRR2015750     2  0.5733      0.629 0.000 0.676 0.324
#> SRR2015751     1  0.6305     -0.793 0.516 0.000 0.484
#> SRR2015748     3  0.8840      0.818 0.428 0.116 0.456
#> SRR2015747     1  0.6154      0.548 0.592 0.000 0.408
#> SRR2015745     2  0.5785      0.627 0.000 0.668 0.332
#> SRR2015743     1  0.6154      0.548 0.592 0.000 0.408
#> SRR2015744     1  0.6307     -0.792 0.512 0.000 0.488
#> SRR2015742     1  0.6309     -0.805 0.504 0.000 0.496
#> SRR2015741     1  0.6154      0.548 0.592 0.000 0.408
#> SRR2015740     1  0.6154      0.548 0.592 0.000 0.408
#> SRR2015738     1  0.6154      0.548 0.592 0.000 0.408
#> SRR2015739     1  0.6154      0.548 0.592 0.000 0.408
#> SRR2015737     2  0.2448      0.869 0.000 0.924 0.076
#> SRR2015736     3  0.7293      0.866 0.476 0.028 0.496
#> SRR2015732     1  0.1529      0.341 0.960 0.000 0.040
#> SRR2015733     2  0.5835      0.607 0.000 0.660 0.340
#> SRR2015734     1  0.0000      0.303 1.000 0.000 0.000
#> SRR2015731     3  0.6520      0.842 0.488 0.004 0.508
#> SRR2015730     1  0.6154      0.548 0.592 0.000 0.408
#> SRR2015728     1  0.6168     -0.681 0.588 0.000 0.412
#> SRR2015729     3  0.9424      0.769 0.340 0.188 0.472
#> SRR2015727     1  0.6299     -0.787 0.524 0.000 0.476
#> SRR2015726     1  0.4654     -0.142 0.792 0.000 0.208
#> SRR2015723     1  0.6286     -0.773 0.536 0.000 0.464
#> SRR2015724     1  0.6309     -0.835 0.504 0.000 0.496
#> SRR2015725     1  0.6154      0.548 0.592 0.000 0.408
#> SRR2015722     1  0.6291     -0.773 0.532 0.000 0.468
#> SRR2015721     3  0.8124      0.880 0.436 0.068 0.496
#> SRR2015720     3  0.7293      0.866 0.476 0.028 0.496
#> SRR2015718     3  0.6680      0.852 0.484 0.008 0.508
#> SRR2015719     2  0.2066      0.858 0.000 0.940 0.060
#> SRR2015717     1  0.4654     -0.142 0.792 0.000 0.208
#> SRR2015716     1  0.4654     -0.142 0.792 0.000 0.208
#> SRR2015714     2  0.2066      0.858 0.000 0.940 0.060
#> SRR2015713     3  0.8236      0.879 0.416 0.076 0.508
#> SRR2015784     2  0.0592      0.875 0.000 0.988 0.012
#> SRR2015785     2  0.0237      0.875 0.000 0.996 0.004
#> SRR2015783     1  0.6154      0.548 0.592 0.000 0.408
#> SRR2015782     2  0.6180      0.455 0.000 0.584 0.416
#> SRR2015781     2  0.0592      0.874 0.000 0.988 0.012
#> SRR2015780     2  0.1411      0.871 0.000 0.964 0.036
#> SRR2015779     2  0.0000      0.875 0.000 1.000 0.000
#> SRR2015778     3  0.6955      0.817 0.488 0.016 0.496
#> SRR2015777     1  0.6682     -0.813 0.504 0.008 0.488
#> SRR2015776     2  0.2066      0.858 0.000 0.940 0.060
#> SRR2015775     3  0.8419      0.873 0.408 0.088 0.504
#> SRR2015774     3  0.8288      0.876 0.408 0.080 0.512
#> SRR2015773     2  0.2796      0.862 0.000 0.908 0.092
#> SRR2015772     2  0.2448      0.869 0.000 0.924 0.076
#> SRR2015771     1  0.0237      0.298 0.996 0.000 0.004
#> SRR2015769     3  0.9445      0.763 0.336 0.192 0.472
#> SRR2015770     2  0.1860      0.874 0.000 0.948 0.052
#> SRR2015768     2  0.1860      0.874 0.000 0.948 0.052
#> SRR2015767     2  0.2066      0.858 0.000 0.940 0.060
#> SRR2015766     3  0.6520      0.842 0.488 0.004 0.508
#> SRR2015764     2  0.5733      0.629 0.000 0.676 0.324
#> SRR2015765     3  0.9086      0.815 0.372 0.144 0.484
#> SRR2015763     1  0.0000      0.303 1.000 0.000 0.000
#> SRR2015762     2  0.0747      0.875 0.000 0.984 0.016
#> SRR2015761     3  0.8149      0.877 0.408 0.072 0.520
#> SRR2015760     1  0.6274     -0.758 0.544 0.000 0.456

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> SRR2015715     3  0.3448     0.7298 0.168 0.004 0.828 0.000
#> SRR2015735     3  0.5705     0.6992 0.204 0.092 0.704 0.000
#> SRR2015759     1  0.0000     0.9837 1.000 0.000 0.000 0.000
#> SRR2015753     1  0.0000     0.9837 1.000 0.000 0.000 0.000
#> SRR2015746     3  0.5150     0.6401 0.008 0.396 0.596 0.000
#> SRR2015758     2  0.5417     0.5363 0.000 0.572 0.016 0.412
#> SRR2015756     1  0.0188     0.9836 0.996 0.004 0.000 0.000
#> SRR2015757     3  0.1474     0.7938 0.000 0.052 0.948 0.000
#> SRR2015755     1  0.1356     0.9646 0.960 0.008 0.032 0.000
#> SRR2015754     1  0.1913     0.9474 0.940 0.020 0.040 0.000
#> SRR2015752     1  0.0188     0.9827 0.996 0.004 0.000 0.000
#> SRR2015749     1  0.0188     0.9836 0.996 0.004 0.000 0.000
#> SRR2015750     2  0.5489     0.5545 0.000 0.664 0.040 0.296
#> SRR2015751     3  0.4905     0.6520 0.004 0.364 0.632 0.000
#> SRR2015748     3  0.7297     0.4649 0.008 0.432 0.444 0.116
#> SRR2015747     1  0.0188     0.9836 0.996 0.004 0.000 0.000
#> SRR2015745     2  0.3324     0.4511 0.000 0.852 0.012 0.136
#> SRR2015743     1  0.0000     0.9837 1.000 0.000 0.000 0.000
#> SRR2015744     3  0.5138     0.6403 0.008 0.392 0.600 0.000
#> SRR2015742     3  0.4843     0.6433 0.000 0.396 0.604 0.000
#> SRR2015741     1  0.1356     0.9646 0.960 0.008 0.032 0.000
#> SRR2015740     1  0.0188     0.9827 0.996 0.004 0.000 0.000
#> SRR2015738     1  0.1677     0.9546 0.948 0.012 0.040 0.000
#> SRR2015739     1  0.0188     0.9836 0.996 0.004 0.000 0.000
#> SRR2015737     2  0.5329     0.5269 0.000 0.568 0.012 0.420
#> SRR2015736     3  0.1637     0.7934 0.000 0.060 0.940 0.000
#> SRR2015732     3  0.4632     0.5758 0.308 0.004 0.688 0.000
#> SRR2015733     2  0.6543     0.5116 0.000 0.544 0.084 0.372
#> SRR2015734     3  0.3907     0.6856 0.232 0.000 0.768 0.000
#> SRR2015731     3  0.3172     0.7841 0.000 0.160 0.840 0.000
#> SRR2015730     1  0.0524     0.9782 0.988 0.004 0.008 0.000
#> SRR2015728     3  0.1890     0.7921 0.056 0.008 0.936 0.000
#> SRR2015729     2  0.5130     0.4521 0.000 0.668 0.312 0.020
#> SRR2015727     3  0.3172     0.7841 0.000 0.160 0.840 0.000
#> SRR2015726     3  0.1576     0.7935 0.048 0.004 0.948 0.000
#> SRR2015723     3  0.1716     0.7918 0.000 0.064 0.936 0.000
#> SRR2015724     3  0.1557     0.7902 0.000 0.056 0.944 0.000
#> SRR2015725     1  0.0657     0.9755 0.984 0.004 0.012 0.000
#> SRR2015722     3  0.3402     0.7841 0.004 0.164 0.832 0.000
#> SRR2015721     3  0.1637     0.7934 0.000 0.060 0.940 0.000
#> SRR2015720     3  0.1716     0.7935 0.000 0.064 0.936 0.000
#> SRR2015718     3  0.1716     0.7918 0.000 0.064 0.936 0.000
#> SRR2015719     4  0.0000     0.8383 0.000 0.000 0.000 1.000
#> SRR2015717     3  0.2730     0.7977 0.016 0.088 0.896 0.000
#> SRR2015716     3  0.1706     0.7947 0.036 0.016 0.948 0.000
#> SRR2015714     4  0.0000     0.8383 0.000 0.000 0.000 1.000
#> SRR2015713     3  0.2760     0.7545 0.000 0.128 0.872 0.000
#> SRR2015784     2  0.4996     0.3641 0.000 0.516 0.000 0.484
#> SRR2015785     4  0.4543     0.2576 0.000 0.324 0.000 0.676
#> SRR2015783     1  0.0000     0.9837 1.000 0.000 0.000 0.000
#> SRR2015782     2  0.2949     0.4588 0.000 0.888 0.024 0.088
#> SRR2015781     4  0.2149     0.8117 0.000 0.088 0.000 0.912
#> SRR2015780     2  0.4972    -0.0830 0.000 0.544 0.000 0.456
#> SRR2015779     4  0.2589     0.7917 0.000 0.116 0.000 0.884
#> SRR2015778     3  0.5088     0.6145 0.004 0.424 0.572 0.000
#> SRR2015777     3  0.5039     0.6436 0.004 0.404 0.592 0.000
#> SRR2015776     4  0.0000     0.8383 0.000 0.000 0.000 1.000
#> SRR2015775     2  0.4661     0.4263 0.000 0.652 0.348 0.000
#> SRR2015774     3  0.3837     0.7421 0.000 0.224 0.776 0.000
#> SRR2015773     2  0.5417     0.5363 0.000 0.572 0.016 0.412
#> SRR2015772     2  0.5329     0.5269 0.000 0.568 0.012 0.420
#> SRR2015771     3  0.3870     0.6968 0.208 0.004 0.788 0.000
#> SRR2015769     2  0.5130     0.4521 0.000 0.668 0.312 0.020
#> SRR2015770     2  0.5329     0.5269 0.000 0.568 0.012 0.420
#> SRR2015768     2  0.5329     0.5269 0.000 0.568 0.012 0.420
#> SRR2015767     4  0.0000     0.8383 0.000 0.000 0.000 1.000
#> SRR2015766     3  0.2814     0.7910 0.000 0.132 0.868 0.000
#> SRR2015764     2  0.5440     0.5482 0.000 0.596 0.020 0.384
#> SRR2015765     2  0.5498    -0.0455 0.000 0.576 0.404 0.020
#> SRR2015763     3  0.3907     0.6856 0.232 0.000 0.768 0.000
#> SRR2015762     4  0.3219     0.7218 0.000 0.164 0.000 0.836
#> SRR2015761     3  0.4040     0.7504 0.000 0.248 0.752 0.000
#> SRR2015760     3  0.2179     0.8007 0.012 0.064 0.924 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
#> SRR2015715     3  0.3124     0.7430 0.136 0.000 0.844 0.016 0.004
#> SRR2015735     3  0.6686     0.6447 0.080 0.000 0.604 0.112 0.204
#> SRR2015759     1  0.0000     0.9648 1.000 0.000 0.000 0.000 0.000
#> SRR2015753     1  0.0000     0.9648 1.000 0.000 0.000 0.000 0.000
#> SRR2015746     5  0.2233     0.7774 0.004 0.000 0.104 0.000 0.892
#> SRR2015758     2  0.1041     0.7907 0.000 0.964 0.004 0.000 0.032
#> SRR2015756     1  0.0671     0.9635 0.980 0.000 0.000 0.004 0.016
#> SRR2015757     3  0.2352     0.7648 0.000 0.008 0.896 0.004 0.092
#> SRR2015755     1  0.1996     0.9404 0.928 0.000 0.004 0.032 0.036
#> SRR2015754     1  0.2605     0.9153 0.896 0.000 0.004 0.044 0.056
#> SRR2015752     1  0.1082     0.9552 0.964 0.000 0.000 0.028 0.008
#> SRR2015749     1  0.0290     0.9651 0.992 0.000 0.000 0.008 0.000
#> SRR2015750     2  0.1857     0.7816 0.000 0.928 0.004 0.008 0.060
#> SRR2015751     5  0.3205     0.7356 0.004 0.004 0.176 0.000 0.816
#> SRR2015748     5  0.3496     0.7415 0.008 0.008 0.104 0.032 0.848
#> SRR2015747     1  0.0671     0.9635 0.980 0.000 0.000 0.004 0.016
#> SRR2015745     5  0.4084     0.4754 0.000 0.328 0.000 0.004 0.668
#> SRR2015743     1  0.0162     0.9642 0.996 0.000 0.000 0.004 0.000
#> SRR2015744     5  0.3203     0.7457 0.008 0.000 0.124 0.020 0.848
#> SRR2015742     5  0.2179     0.7774 0.004 0.000 0.100 0.000 0.896
#> SRR2015741     1  0.2078     0.9390 0.924 0.000 0.004 0.036 0.036
#> SRR2015740     1  0.1082     0.9552 0.964 0.000 0.000 0.028 0.008
#> SRR2015738     1  0.2313     0.9297 0.912 0.000 0.004 0.040 0.044
#> SRR2015739     1  0.0671     0.9635 0.980 0.000 0.000 0.004 0.016
#> SRR2015737     2  0.0000     0.7924 0.000 1.000 0.000 0.000 0.000
#> SRR2015736     3  0.2136     0.7661 0.000 0.008 0.904 0.000 0.088
#> SRR2015732     3  0.4296     0.7010 0.176 0.000 0.772 0.036 0.016
#> SRR2015733     2  0.3390     0.7067 0.000 0.840 0.060 0.000 0.100
#> SRR2015734     3  0.3421     0.7271 0.164 0.000 0.816 0.016 0.004
#> SRR2015731     3  0.5552     0.5431 0.000 0.000 0.584 0.088 0.328
#> SRR2015730     1  0.1331     0.9490 0.952 0.000 0.000 0.040 0.008
#> SRR2015728     3  0.4378     0.7537 0.032 0.000 0.800 0.080 0.088
#> SRR2015729     2  0.4484     0.6761 0.000 0.764 0.176 0.028 0.032
#> SRR2015727     3  0.5552     0.5431 0.000 0.000 0.584 0.088 0.328
#> SRR2015726     3  0.2277     0.7733 0.052 0.000 0.916 0.016 0.016
#> SRR2015723     3  0.1597     0.7663 0.000 0.008 0.948 0.020 0.024
#> SRR2015724     3  0.1116     0.7703 0.000 0.004 0.964 0.004 0.028
#> SRR2015725     1  0.1331     0.9490 0.952 0.000 0.000 0.040 0.008
#> SRR2015722     3  0.5658     0.5336 0.000 0.000 0.572 0.096 0.332
#> SRR2015721     3  0.2193     0.7662 0.000 0.008 0.900 0.000 0.092
#> SRR2015720     3  0.2304     0.7635 0.000 0.008 0.892 0.000 0.100
#> SRR2015718     3  0.1503     0.7660 0.000 0.008 0.952 0.020 0.020
#> SRR2015719     4  0.3074     0.8603 0.000 0.196 0.000 0.804 0.000
#> SRR2015717     3  0.4901     0.6901 0.000 0.000 0.708 0.096 0.196
#> SRR2015716     3  0.2087     0.7698 0.020 0.000 0.928 0.032 0.020
#> SRR2015714     4  0.3074     0.8603 0.000 0.196 0.000 0.804 0.000
#> SRR2015713     3  0.3862     0.7067 0.000 0.104 0.808 0.000 0.088
#> SRR2015784     2  0.1281     0.7647 0.000 0.956 0.000 0.012 0.032
#> SRR2015785     2  0.3577     0.5227 0.000 0.808 0.000 0.160 0.032
#> SRR2015783     1  0.0000     0.9648 1.000 0.000 0.000 0.000 0.000
#> SRR2015782     5  0.4341     0.3246 0.000 0.404 0.000 0.004 0.592
#> SRR2015781     4  0.4779     0.7676 0.000 0.388 0.000 0.588 0.024
#> SRR2015780     5  0.5885     0.3404 0.000 0.296 0.000 0.132 0.572
#> SRR2015779     4  0.4789     0.7633 0.000 0.392 0.000 0.584 0.024
#> SRR2015778     5  0.2068     0.7803 0.004 0.000 0.092 0.000 0.904
#> SRR2015777     5  0.3087     0.7556 0.004 0.008 0.152 0.000 0.836
#> SRR2015776     4  0.3074     0.8603 0.000 0.196 0.000 0.804 0.000
#> SRR2015775     2  0.4590     0.6630 0.000 0.752 0.188 0.028 0.032
#> SRR2015774     3  0.6319     0.4925 0.000 0.140 0.604 0.028 0.228
#> SRR2015773     2  0.0000     0.7924 0.000 1.000 0.000 0.000 0.000
#> SRR2015772     2  0.0000     0.7924 0.000 1.000 0.000 0.000 0.000
#> SRR2015771     3  0.3340     0.7314 0.156 0.000 0.824 0.016 0.004
#> SRR2015769     2  0.4484     0.6761 0.000 0.764 0.176 0.028 0.032
#> SRR2015770     2  0.0000     0.7924 0.000 1.000 0.000 0.000 0.000
#> SRR2015768     2  0.0000     0.7924 0.000 1.000 0.000 0.000 0.000
#> SRR2015767     4  0.3074     0.8603 0.000 0.196 0.000 0.804 0.000
#> SRR2015766     3  0.5308     0.5710 0.000 0.000 0.620 0.076 0.304
#> SRR2015764     2  0.1430     0.7865 0.000 0.944 0.004 0.000 0.052
#> SRR2015765     2  0.7706    -0.0948 0.000 0.364 0.284 0.052 0.300
#> SRR2015763     3  0.3381     0.7300 0.160 0.000 0.820 0.016 0.004
#> SRR2015762     4  0.4547     0.7599 0.000 0.400 0.000 0.588 0.012
#> SRR2015761     3  0.6483     0.4853 0.000 0.088 0.552 0.044 0.316
#> SRR2015760     3  0.4322     0.7187 0.000 0.000 0.768 0.088 0.144

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>            class entropy silhouette    p1    p2    p3    p4    p5    p6
#> SRR2015715     3  0.1714      0.607 0.092 0.000 0.908 0.000 0.000 0.000
#> SRR2015735     3  0.6372     -0.274 0.036 0.000 0.460 0.020 0.092 0.392
#> SRR2015759     1  0.0622      0.918 0.980 0.000 0.012 0.000 0.000 0.008
#> SRR2015753     1  0.0551      0.919 0.984 0.000 0.008 0.000 0.004 0.004
#> SRR2015746     5  0.1471      0.757 0.000 0.000 0.064 0.000 0.932 0.004
#> SRR2015758     2  0.1059      0.769 0.000 0.964 0.000 0.004 0.016 0.016
#> SRR2015756     1  0.0798      0.918 0.976 0.000 0.004 0.004 0.004 0.012
#> SRR2015757     3  0.5494      0.491 0.000 0.052 0.660 0.000 0.128 0.160
#> SRR2015755     1  0.3086      0.845 0.820 0.000 0.000 0.020 0.004 0.156
#> SRR2015754     1  0.3680      0.794 0.756 0.000 0.000 0.020 0.008 0.216
#> SRR2015752     1  0.1503      0.908 0.944 0.000 0.008 0.016 0.000 0.032
#> SRR2015749     1  0.0713      0.916 0.972 0.000 0.000 0.000 0.000 0.028
#> SRR2015750     2  0.1844      0.763 0.000 0.928 0.000 0.016 0.016 0.040
#> SRR2015751     5  0.2558      0.719 0.000 0.000 0.104 0.000 0.868 0.028
#> SRR2015748     5  0.3830      0.677 0.000 0.016 0.060 0.008 0.808 0.108
#> SRR2015747     1  0.0798      0.918 0.976 0.000 0.004 0.004 0.004 0.012
#> SRR2015745     5  0.3602      0.664 0.000 0.208 0.000 0.000 0.760 0.032
#> SRR2015743     1  0.0870      0.918 0.972 0.000 0.012 0.000 0.004 0.012
#> SRR2015744     5  0.3213      0.678 0.000 0.004 0.084 0.000 0.836 0.076
#> SRR2015742     5  0.1411      0.757 0.000 0.000 0.060 0.000 0.936 0.004
#> SRR2015741     1  0.3189      0.832 0.796 0.000 0.000 0.020 0.000 0.184
#> SRR2015740     1  0.1592      0.906 0.940 0.000 0.008 0.020 0.000 0.032
#> SRR2015738     1  0.3438      0.823 0.788 0.000 0.000 0.020 0.008 0.184
#> SRR2015739     1  0.0798      0.918 0.976 0.000 0.004 0.004 0.004 0.012
#> SRR2015737     2  0.0777      0.772 0.000 0.972 0.000 0.024 0.000 0.004
#> SRR2015736     3  0.5564      0.480 0.000 0.048 0.648 0.000 0.132 0.172
#> SRR2015732     3  0.3095      0.570 0.144 0.000 0.828 0.012 0.000 0.016
#> SRR2015733     2  0.4799      0.549 0.000 0.704 0.008 0.004 0.160 0.124
#> SRR2015734     3  0.2048      0.595 0.120 0.000 0.880 0.000 0.000 0.000
#> SRR2015731     6  0.5945      0.590 0.000 0.000 0.360 0.000 0.220 0.420
#> SRR2015730     1  0.2582      0.876 0.888 0.000 0.060 0.020 0.000 0.032
#> SRR2015728     3  0.5131      0.492 0.004 0.016 0.696 0.016 0.076 0.192
#> SRR2015729     2  0.5601      0.564 0.000 0.624 0.108 0.024 0.008 0.236
#> SRR2015727     6  0.5949      0.587 0.000 0.000 0.364 0.000 0.220 0.416
#> SRR2015726     3  0.0806      0.598 0.020 0.000 0.972 0.000 0.000 0.008
#> SRR2015723     3  0.3284      0.455 0.000 0.004 0.804 0.016 0.004 0.172
#> SRR2015724     3  0.1982      0.569 0.000 0.004 0.912 0.000 0.016 0.068
#> SRR2015725     1  0.2994      0.846 0.856 0.000 0.096 0.020 0.000 0.028
#> SRR2015722     6  0.6016      0.555 0.000 0.000 0.316 0.008 0.200 0.476
#> SRR2015721     3  0.5685      0.467 0.000 0.052 0.636 0.000 0.136 0.176
#> SRR2015720     3  0.5628      0.473 0.000 0.048 0.640 0.000 0.136 0.176
#> SRR2015718     3  0.3804      0.423 0.000 0.004 0.756 0.016 0.012 0.212
#> SRR2015719     4  0.1700      0.764 0.000 0.080 0.000 0.916 0.000 0.004
#> SRR2015717     3  0.5198     -0.190 0.000 0.000 0.564 0.004 0.092 0.340
#> SRR2015716     3  0.2113      0.541 0.000 0.000 0.896 0.008 0.004 0.092
#> SRR2015714     4  0.1556      0.765 0.000 0.080 0.000 0.920 0.000 0.000
#> SRR2015713     3  0.6161      0.413 0.000 0.092 0.596 0.000 0.132 0.180
#> SRR2015784     2  0.3366      0.668 0.000 0.844 0.000 0.044 0.052 0.060
#> SRR2015785     2  0.4824      0.486 0.000 0.724 0.000 0.152 0.056 0.068
#> SRR2015783     1  0.0622      0.918 0.980 0.000 0.012 0.000 0.000 0.008
#> SRR2015782     5  0.4157      0.570 0.000 0.276 0.000 0.004 0.688 0.032
#> SRR2015781     4  0.5383      0.541 0.000 0.408 0.000 0.512 0.032 0.048
#> SRR2015780     5  0.6276      0.391 0.000 0.236 0.000 0.128 0.560 0.076
#> SRR2015779     4  0.5134      0.522 0.000 0.432 0.000 0.504 0.016 0.048
#> SRR2015778     5  0.1141      0.761 0.000 0.000 0.052 0.000 0.948 0.000
#> SRR2015777     5  0.1753      0.751 0.000 0.000 0.084 0.000 0.912 0.004
#> SRR2015776     4  0.1556      0.765 0.000 0.080 0.000 0.920 0.000 0.000
#> SRR2015775     2  0.5968      0.512 0.000 0.580 0.148 0.024 0.008 0.240
#> SRR2015774     6  0.7179      0.425 0.000 0.104 0.308 0.008 0.152 0.428
#> SRR2015773     2  0.0909      0.775 0.000 0.968 0.000 0.020 0.000 0.012
#> SRR2015772     2  0.0993      0.774 0.000 0.964 0.000 0.024 0.000 0.012
#> SRR2015771     3  0.1765      0.605 0.096 0.000 0.904 0.000 0.000 0.000
#> SRR2015769     2  0.5601      0.564 0.000 0.624 0.108 0.024 0.008 0.236
#> SRR2015770     2  0.0632      0.772 0.000 0.976 0.000 0.024 0.000 0.000
#> SRR2015768     2  0.0777      0.772 0.000 0.972 0.000 0.024 0.000 0.004
#> SRR2015767     4  0.1556      0.765 0.000 0.080 0.000 0.920 0.000 0.000
#> SRR2015766     6  0.5929      0.541 0.000 0.004 0.408 0.000 0.180 0.408
#> SRR2015764     2  0.2069      0.752 0.000 0.908 0.000 0.004 0.020 0.068
#> SRR2015765     6  0.7423      0.364 0.000 0.196 0.144 0.008 0.216 0.436
#> SRR2015763     3  0.2003      0.598 0.116 0.000 0.884 0.000 0.000 0.000
#> SRR2015762     4  0.4629      0.527 0.000 0.436 0.000 0.524 0.000 0.040
#> SRR2015761     6  0.7113      0.495 0.000 0.076 0.312 0.000 0.252 0.360
#> SRR2015760     3  0.4957     -0.125 0.000 0.000 0.584 0.000 0.084 0.332

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

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 17223 rows and 73 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.862           0.939       0.970         0.5070 0.493   0.493
#> 3 3 0.624           0.764       0.853         0.3094 0.742   0.523
#> 4 4 0.576           0.569       0.728         0.0965 0.807   0.535
#> 5 5 0.674           0.729       0.823         0.0605 0.868   0.603
#> 6 6 0.783           0.699       0.859         0.0476 0.924   0.688

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
#> SRR2015715     1   0.000      0.975 1.000 0.000
#> SRR2015735     1   0.000      0.975 1.000 0.000
#> SRR2015759     1   0.000      0.975 1.000 0.000
#> SRR2015753     1   0.000      0.975 1.000 0.000
#> SRR2015746     1   0.343      0.924 0.936 0.064
#> SRR2015758     2   0.000      0.961 0.000 1.000
#> SRR2015756     1   0.000      0.975 1.000 0.000
#> SRR2015757     2   0.886      0.619 0.304 0.696
#> SRR2015755     1   0.000      0.975 1.000 0.000
#> SRR2015754     1   0.000      0.975 1.000 0.000
#> SRR2015752     1   0.000      0.975 1.000 0.000
#> SRR2015749     1   0.000      0.975 1.000 0.000
#> SRR2015750     2   0.000      0.961 0.000 1.000
#> SRR2015751     1   0.000      0.975 1.000 0.000
#> SRR2015748     2   0.738      0.730 0.208 0.792
#> SRR2015747     1   0.000      0.975 1.000 0.000
#> SRR2015745     2   0.000      0.961 0.000 1.000
#> SRR2015743     1   0.000      0.975 1.000 0.000
#> SRR2015744     1   0.722      0.772 0.800 0.200
#> SRR2015742     1   0.722      0.772 0.800 0.200
#> SRR2015741     1   0.000      0.975 1.000 0.000
#> SRR2015740     1   0.000      0.975 1.000 0.000
#> SRR2015738     1   0.000      0.975 1.000 0.000
#> SRR2015739     1   0.000      0.975 1.000 0.000
#> SRR2015737     2   0.000      0.961 0.000 1.000
#> SRR2015736     2   0.722      0.780 0.200 0.800
#> SRR2015732     1   0.000      0.975 1.000 0.000
#> SRR2015733     2   0.000      0.961 0.000 1.000
#> SRR2015734     1   0.000      0.975 1.000 0.000
#> SRR2015731     2   0.615      0.831 0.152 0.848
#> SRR2015730     1   0.000      0.975 1.000 0.000
#> SRR2015728     1   0.000      0.975 1.000 0.000
#> SRR2015729     2   0.000      0.961 0.000 1.000
#> SRR2015727     1   0.343      0.924 0.936 0.064
#> SRR2015726     1   0.000      0.975 1.000 0.000
#> SRR2015723     1   0.000      0.975 1.000 0.000
#> SRR2015724     1   0.000      0.975 1.000 0.000
#> SRR2015725     1   0.000      0.975 1.000 0.000
#> SRR2015722     1   0.343      0.924 0.936 0.064
#> SRR2015721     2   0.722      0.780 0.200 0.800
#> SRR2015720     2   0.722      0.780 0.200 0.800
#> SRR2015718     1   0.430      0.901 0.912 0.088
#> SRR2015719     2   0.000      0.961 0.000 1.000
#> SRR2015717     1   0.000      0.975 1.000 0.000
#> SRR2015716     1   0.000      0.975 1.000 0.000
#> SRR2015714     2   0.000      0.961 0.000 1.000
#> SRR2015713     2   0.388      0.902 0.076 0.924
#> SRR2015784     2   0.000      0.961 0.000 1.000
#> SRR2015785     2   0.000      0.961 0.000 1.000
#> SRR2015783     1   0.000      0.975 1.000 0.000
#> SRR2015782     2   0.000      0.961 0.000 1.000
#> SRR2015781     2   0.000      0.961 0.000 1.000
#> SRR2015780     2   0.000      0.961 0.000 1.000
#> SRR2015779     2   0.000      0.961 0.000 1.000
#> SRR2015778     2   0.000      0.961 0.000 1.000
#> SRR2015777     1   0.680      0.797 0.820 0.180
#> SRR2015776     2   0.000      0.961 0.000 1.000
#> SRR2015775     2   0.000      0.961 0.000 1.000
#> SRR2015774     2   0.000      0.961 0.000 1.000
#> SRR2015773     2   0.000      0.961 0.000 1.000
#> SRR2015772     2   0.000      0.961 0.000 1.000
#> SRR2015771     1   0.000      0.975 1.000 0.000
#> SRR2015769     2   0.000      0.961 0.000 1.000
#> SRR2015770     2   0.000      0.961 0.000 1.000
#> SRR2015768     2   0.000      0.961 0.000 1.000
#> SRR2015767     2   0.000      0.961 0.000 1.000
#> SRR2015766     2   0.000      0.961 0.000 1.000
#> SRR2015764     2   0.000      0.961 0.000 1.000
#> SRR2015765     2   0.000      0.961 0.000 1.000
#> SRR2015763     1   0.000      0.975 1.000 0.000
#> SRR2015762     2   0.000      0.961 0.000 1.000
#> SRR2015761     2   0.000      0.961 0.000 1.000
#> SRR2015760     1   0.000      0.975 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
#> SRR2015715     3  0.0592     0.8251 0.012 0.000 0.988
#> SRR2015735     3  0.6244     0.2453 0.440 0.000 0.560
#> SRR2015759     1  0.5785     0.7688 0.668 0.000 0.332
#> SRR2015753     1  0.5785     0.7688 0.668 0.000 0.332
#> SRR2015746     1  0.2959     0.7288 0.900 0.000 0.100
#> SRR2015758     2  0.0000     0.9169 0.000 1.000 0.000
#> SRR2015756     1  0.5785     0.7688 0.668 0.000 0.332
#> SRR2015757     3  0.3192     0.7680 0.000 0.112 0.888
#> SRR2015755     1  0.3879     0.7461 0.848 0.000 0.152
#> SRR2015754     1  0.3686     0.7432 0.860 0.000 0.140
#> SRR2015752     1  0.5785     0.7688 0.668 0.000 0.332
#> SRR2015749     1  0.5785     0.7688 0.668 0.000 0.332
#> SRR2015750     2  0.0000     0.9169 0.000 1.000 0.000
#> SRR2015751     1  0.5621     0.7670 0.692 0.000 0.308
#> SRR2015748     1  0.5560     0.3614 0.700 0.300 0.000
#> SRR2015747     1  0.5785     0.7688 0.668 0.000 0.332
#> SRR2015745     2  0.2165     0.9117 0.064 0.936 0.000
#> SRR2015743     1  0.5785     0.7688 0.668 0.000 0.332
#> SRR2015744     1  0.0000     0.6658 1.000 0.000 0.000
#> SRR2015742     1  0.0475     0.6604 0.992 0.004 0.004
#> SRR2015741     1  0.3879     0.7461 0.848 0.000 0.152
#> SRR2015740     1  0.5785     0.7688 0.668 0.000 0.332
#> SRR2015738     1  0.3686     0.7432 0.860 0.000 0.140
#> SRR2015739     1  0.5785     0.7688 0.668 0.000 0.332
#> SRR2015737     2  0.0000     0.9169 0.000 1.000 0.000
#> SRR2015736     3  0.3412     0.7598 0.000 0.124 0.876
#> SRR2015732     3  0.1163     0.8166 0.028 0.000 0.972
#> SRR2015733     2  0.0424     0.9173 0.008 0.992 0.000
#> SRR2015734     3  0.0592     0.8251 0.012 0.000 0.988
#> SRR2015731     3  0.6632     0.5400 0.392 0.012 0.596
#> SRR2015730     3  0.1860     0.7957 0.052 0.000 0.948
#> SRR2015728     3  0.0747     0.8235 0.016 0.000 0.984
#> SRR2015729     2  0.0000     0.9169 0.000 1.000 0.000
#> SRR2015727     3  0.6095     0.5454 0.392 0.000 0.608
#> SRR2015726     3  0.1411     0.8113 0.036 0.000 0.964
#> SRR2015723     3  0.0592     0.8251 0.012 0.000 0.988
#> SRR2015724     3  0.1031     0.8159 0.000 0.024 0.976
#> SRR2015725     3  0.1289     0.8139 0.032 0.000 0.968
#> SRR2015722     1  0.6267    -0.2924 0.548 0.000 0.452
#> SRR2015721     2  0.6299     0.0707 0.000 0.524 0.476
#> SRR2015720     3  0.3551     0.7532 0.000 0.132 0.868
#> SRR2015718     3  0.3192     0.7694 0.000 0.112 0.888
#> SRR2015719     2  0.3482     0.8916 0.128 0.872 0.000
#> SRR2015717     3  0.5254     0.6282 0.264 0.000 0.736
#> SRR2015716     3  0.0592     0.8251 0.012 0.000 0.988
#> SRR2015714     2  0.3482     0.8916 0.128 0.872 0.000
#> SRR2015713     2  0.6192     0.2309 0.000 0.580 0.420
#> SRR2015784     2  0.1289     0.9168 0.032 0.968 0.000
#> SRR2015785     2  0.1860     0.9142 0.052 0.948 0.000
#> SRR2015783     1  0.5785     0.7688 0.668 0.000 0.332
#> SRR2015782     2  0.1529     0.9154 0.040 0.960 0.000
#> SRR2015781     2  0.3482     0.8916 0.128 0.872 0.000
#> SRR2015780     2  0.3551     0.8897 0.132 0.868 0.000
#> SRR2015779     2  0.1860     0.9142 0.052 0.948 0.000
#> SRR2015778     1  0.0592     0.6572 0.988 0.012 0.000
#> SRR2015777     1  0.7179     0.6700 0.712 0.184 0.104
#> SRR2015776     2  0.3482     0.8916 0.128 0.872 0.000
#> SRR2015775     2  0.0000     0.9169 0.000 1.000 0.000
#> SRR2015774     2  0.1711     0.9136 0.032 0.960 0.008
#> SRR2015773     2  0.0000     0.9169 0.000 1.000 0.000
#> SRR2015772     2  0.0000     0.9169 0.000 1.000 0.000
#> SRR2015771     3  0.0592     0.8251 0.012 0.000 0.988
#> SRR2015769     2  0.0000     0.9169 0.000 1.000 0.000
#> SRR2015770     2  0.0000     0.9169 0.000 1.000 0.000
#> SRR2015768     2  0.0000     0.9169 0.000 1.000 0.000
#> SRR2015767     2  0.3482     0.8916 0.128 0.872 0.000
#> SRR2015766     3  0.7948     0.5359 0.320 0.080 0.600
#> SRR2015764     2  0.0000     0.9169 0.000 1.000 0.000
#> SRR2015765     2  0.3482     0.8916 0.128 0.872 0.000
#> SRR2015763     3  0.0592     0.8251 0.012 0.000 0.988
#> SRR2015762     2  0.3340     0.8949 0.120 0.880 0.000
#> SRR2015761     2  0.3896     0.8890 0.128 0.864 0.008
#> SRR2015760     3  0.4346     0.7022 0.184 0.000 0.816

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> SRR2015715     1  0.4252      0.230 0.744 0.000 0.252 0.004
#> SRR2015735     1  0.5366      0.142 0.548 0.000 0.440 0.012
#> SRR2015759     1  0.4585      0.542 0.668 0.000 0.000 0.332
#> SRR2015753     1  0.4585      0.542 0.668 0.000 0.000 0.332
#> SRR2015746     4  0.3245      0.779 0.028 0.000 0.100 0.872
#> SRR2015758     2  0.0000      0.841 0.000 1.000 0.000 0.000
#> SRR2015756     1  0.4585      0.542 0.668 0.000 0.000 0.332
#> SRR2015757     3  0.9669      0.541 0.268 0.172 0.368 0.192
#> SRR2015755     1  0.6980      0.407 0.536 0.000 0.132 0.332
#> SRR2015754     1  0.7449      0.332 0.480 0.000 0.188 0.332
#> SRR2015752     1  0.4585      0.542 0.668 0.000 0.000 0.332
#> SRR2015749     1  0.4585      0.542 0.668 0.000 0.000 0.332
#> SRR2015750     2  0.2149      0.780 0.000 0.912 0.000 0.088
#> SRR2015751     4  0.2271      0.716 0.076 0.000 0.008 0.916
#> SRR2015748     4  0.6971      0.306 0.000 0.276 0.156 0.568
#> SRR2015747     1  0.4585      0.542 0.668 0.000 0.000 0.332
#> SRR2015745     2  0.6487      0.231 0.000 0.500 0.072 0.428
#> SRR2015743     1  0.4585      0.542 0.668 0.000 0.000 0.332
#> SRR2015744     4  0.4088      0.717 0.004 0.000 0.232 0.764
#> SRR2015742     4  0.2921      0.777 0.000 0.000 0.140 0.860
#> SRR2015741     1  0.7302      0.359 0.500 0.000 0.168 0.332
#> SRR2015740     1  0.4585      0.542 0.668 0.000 0.000 0.332
#> SRR2015738     1  0.7363      0.348 0.492 0.000 0.176 0.332
#> SRR2015739     1  0.4585      0.542 0.668 0.000 0.000 0.332
#> SRR2015737     2  0.0000      0.841 0.000 1.000 0.000 0.000
#> SRR2015736     3  0.9639      0.539 0.272 0.172 0.372 0.184
#> SRR2015732     1  0.1584      0.489 0.952 0.000 0.036 0.012
#> SRR2015733     2  0.3591      0.688 0.000 0.824 0.008 0.168
#> SRR2015734     1  0.3907      0.266 0.768 0.000 0.232 0.000
#> SRR2015731     3  0.2742      0.535 0.076 0.000 0.900 0.024
#> SRR2015730     1  0.1022      0.520 0.968 0.000 0.000 0.032
#> SRR2015728     1  0.4700      0.343 0.792 0.000 0.124 0.084
#> SRR2015729     2  0.1022      0.828 0.000 0.968 0.000 0.032
#> SRR2015727     3  0.2742      0.535 0.076 0.000 0.900 0.024
#> SRR2015726     1  0.1677      0.486 0.948 0.000 0.040 0.012
#> SRR2015723     1  0.5284      0.165 0.696 0.000 0.264 0.040
#> SRR2015724     1  0.6028     -0.115 0.596 0.004 0.356 0.044
#> SRR2015725     1  0.0469      0.509 0.988 0.000 0.000 0.012
#> SRR2015722     3  0.4644      0.365 0.228 0.000 0.748 0.024
#> SRR2015721     3  0.9817      0.494 0.228 0.280 0.320 0.172
#> SRR2015720     3  0.9659      0.543 0.264 0.172 0.372 0.192
#> SRR2015718     1  0.7396     -0.259 0.528 0.068 0.360 0.044
#> SRR2015719     2  0.4348      0.822 0.000 0.780 0.196 0.024
#> SRR2015717     3  0.4560      0.345 0.296 0.000 0.700 0.004
#> SRR2015716     1  0.4501      0.278 0.764 0.000 0.212 0.024
#> SRR2015714     2  0.4348      0.822 0.000 0.780 0.196 0.024
#> SRR2015713     3  0.9922      0.485 0.248 0.276 0.284 0.192
#> SRR2015784     2  0.3711      0.834 0.000 0.836 0.140 0.024
#> SRR2015785     2  0.3813      0.833 0.000 0.828 0.148 0.024
#> SRR2015783     1  0.4585      0.542 0.668 0.000 0.000 0.332
#> SRR2015782     2  0.6487      0.231 0.000 0.500 0.072 0.428
#> SRR2015781     2  0.4267      0.824 0.000 0.788 0.188 0.024
#> SRR2015780     2  0.4720      0.814 0.000 0.768 0.188 0.044
#> SRR2015779     2  0.3813      0.833 0.000 0.828 0.148 0.024
#> SRR2015778     4  0.3718      0.752 0.000 0.012 0.168 0.820
#> SRR2015777     4  0.1920      0.763 0.024 0.028 0.004 0.944
#> SRR2015776     2  0.4267      0.824 0.000 0.788 0.188 0.024
#> SRR2015775     2  0.1545      0.819 0.000 0.952 0.008 0.040
#> SRR2015774     2  0.3933      0.791 0.000 0.792 0.200 0.008
#> SRR2015773     2  0.0000      0.841 0.000 1.000 0.000 0.000
#> SRR2015772     2  0.0000      0.841 0.000 1.000 0.000 0.000
#> SRR2015771     1  0.4252      0.230 0.744 0.000 0.252 0.004
#> SRR2015769     2  0.1022      0.828 0.000 0.968 0.000 0.032
#> SRR2015770     2  0.0000      0.841 0.000 1.000 0.000 0.000
#> SRR2015768     2  0.0000      0.841 0.000 1.000 0.000 0.000
#> SRR2015767     2  0.4348      0.822 0.000 0.780 0.196 0.024
#> SRR2015766     3  0.2635      0.538 0.072 0.004 0.908 0.016
#> SRR2015764     2  0.0000      0.841 0.000 1.000 0.000 0.000
#> SRR2015765     2  0.3937      0.830 0.000 0.800 0.188 0.012
#> SRR2015763     1  0.4220      0.236 0.748 0.000 0.248 0.004
#> SRR2015762     2  0.2918      0.840 0.000 0.876 0.116 0.008
#> SRR2015761     2  0.3852      0.802 0.000 0.800 0.192 0.008
#> SRR2015760     3  0.3873      0.466 0.228 0.000 0.772 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
#> SRR2015715     3  0.4958      0.497 0.372 0.000 0.592 0.036 0.000
#> SRR2015735     4  0.3231      0.724 0.196 0.000 0.004 0.800 0.000
#> SRR2015759     1  0.0000      0.906 1.000 0.000 0.000 0.000 0.000
#> SRR2015753     1  0.0000      0.906 1.000 0.000 0.000 0.000 0.000
#> SRR2015746     5  0.3323      0.797 0.100 0.000 0.000 0.056 0.844
#> SRR2015758     2  0.0794      0.837 0.000 0.972 0.028 0.000 0.000
#> SRR2015756     1  0.0000      0.906 1.000 0.000 0.000 0.000 0.000
#> SRR2015757     3  0.5214      0.490 0.004 0.124 0.724 0.012 0.136
#> SRR2015755     1  0.1121      0.874 0.956 0.000 0.000 0.044 0.000
#> SRR2015754     1  0.2806      0.749 0.844 0.000 0.000 0.152 0.004
#> SRR2015752     1  0.0000      0.906 1.000 0.000 0.000 0.000 0.000
#> SRR2015749     1  0.0000      0.906 1.000 0.000 0.000 0.000 0.000
#> SRR2015750     2  0.3159      0.767 0.000 0.856 0.056 0.000 0.088
#> SRR2015751     5  0.2179      0.794 0.100 0.000 0.004 0.000 0.896
#> SRR2015748     5  0.4426      0.665 0.004 0.196 0.000 0.052 0.748
#> SRR2015747     1  0.0000      0.906 1.000 0.000 0.000 0.000 0.000
#> SRR2015745     5  0.3074      0.712 0.000 0.196 0.000 0.000 0.804
#> SRR2015743     1  0.0000      0.906 1.000 0.000 0.000 0.000 0.000
#> SRR2015744     5  0.4075      0.775 0.096 0.004 0.000 0.100 0.800
#> SRR2015742     5  0.3336      0.798 0.096 0.000 0.000 0.060 0.844
#> SRR2015741     1  0.1544      0.853 0.932 0.000 0.000 0.068 0.000
#> SRR2015740     1  0.0000      0.906 1.000 0.000 0.000 0.000 0.000
#> SRR2015738     1  0.2358      0.807 0.888 0.000 0.000 0.104 0.008
#> SRR2015739     1  0.0000      0.906 1.000 0.000 0.000 0.000 0.000
#> SRR2015737     2  0.0794      0.837 0.000 0.972 0.028 0.000 0.000
#> SRR2015736     3  0.5606      0.478 0.004 0.128 0.716 0.044 0.108
#> SRR2015732     3  0.4304      0.297 0.484 0.000 0.516 0.000 0.000
#> SRR2015733     2  0.4743      0.650 0.000 0.732 0.156 0.000 0.112
#> SRR2015734     3  0.4942      0.410 0.432 0.000 0.540 0.028 0.000
#> SRR2015731     4  0.0000      0.871 0.000 0.000 0.000 1.000 0.000
#> SRR2015730     1  0.2377      0.762 0.872 0.000 0.128 0.000 0.000
#> SRR2015728     3  0.7268      0.311 0.352 0.000 0.452 0.132 0.064
#> SRR2015729     2  0.2970      0.758 0.000 0.828 0.168 0.000 0.004
#> SRR2015727     4  0.0000      0.871 0.000 0.000 0.000 1.000 0.000
#> SRR2015726     1  0.4211      0.182 0.636 0.000 0.360 0.004 0.000
#> SRR2015723     3  0.4847      0.556 0.196 0.000 0.720 0.080 0.004
#> SRR2015724     3  0.3003      0.552 0.092 0.000 0.864 0.044 0.000
#> SRR2015725     1  0.2773      0.707 0.836 0.000 0.164 0.000 0.000
#> SRR2015722     4  0.0000      0.871 0.000 0.000 0.000 1.000 0.000
#> SRR2015721     3  0.6472      0.377 0.000 0.228 0.612 0.080 0.080
#> SRR2015720     3  0.5199      0.485 0.000 0.124 0.720 0.016 0.140
#> SRR2015718     3  0.4244      0.508 0.056 0.036 0.816 0.088 0.004
#> SRR2015719     2  0.4334      0.798 0.000 0.764 0.000 0.156 0.080
#> SRR2015717     4  0.3535      0.786 0.080 0.000 0.088 0.832 0.000
#> SRR2015716     3  0.5623      0.363 0.388 0.000 0.540 0.068 0.004
#> SRR2015714     2  0.4334      0.798 0.000 0.764 0.000 0.156 0.080
#> SRR2015713     3  0.5544      0.446 0.000 0.192 0.668 0.008 0.132
#> SRR2015784     2  0.2795      0.825 0.000 0.872 0.000 0.028 0.100
#> SRR2015785     2  0.2848      0.825 0.000 0.868 0.000 0.028 0.104
#> SRR2015783     1  0.0000      0.906 1.000 0.000 0.000 0.000 0.000
#> SRR2015782     5  0.3480      0.670 0.000 0.248 0.000 0.000 0.752
#> SRR2015781     2  0.4022      0.810 0.000 0.796 0.000 0.100 0.104
#> SRR2015780     2  0.4307      0.795 0.000 0.772 0.000 0.100 0.128
#> SRR2015779     2  0.2795      0.827 0.000 0.872 0.000 0.028 0.100
#> SRR2015778     5  0.2103      0.788 0.020 0.004 0.000 0.056 0.920
#> SRR2015777     5  0.2339      0.796 0.100 0.004 0.004 0.000 0.892
#> SRR2015776     2  0.4254      0.802 0.000 0.772 0.000 0.148 0.080
#> SRR2015775     2  0.3689      0.661 0.000 0.740 0.256 0.000 0.004
#> SRR2015774     2  0.3774      0.825 0.000 0.808 0.032 0.152 0.008
#> SRR2015773     2  0.0794      0.837 0.000 0.972 0.028 0.000 0.000
#> SRR2015772     2  0.0794      0.837 0.000 0.972 0.028 0.000 0.000
#> SRR2015771     3  0.4990      0.484 0.384 0.000 0.580 0.036 0.000
#> SRR2015769     2  0.2970      0.758 0.000 0.828 0.168 0.000 0.004
#> SRR2015770     2  0.0794      0.837 0.000 0.972 0.028 0.000 0.000
#> SRR2015768     2  0.0794      0.837 0.000 0.972 0.028 0.000 0.000
#> SRR2015767     2  0.4334      0.798 0.000 0.764 0.000 0.156 0.080
#> SRR2015766     4  0.0162      0.867 0.000 0.000 0.000 0.996 0.004
#> SRR2015764     2  0.1408      0.829 0.000 0.948 0.044 0.000 0.008
#> SRR2015765     2  0.4276      0.798 0.000 0.764 0.000 0.168 0.068
#> SRR2015763     3  0.5065      0.430 0.420 0.000 0.544 0.036 0.000
#> SRR2015762     2  0.2305      0.842 0.000 0.896 0.000 0.092 0.012
#> SRR2015761     2  0.3010      0.817 0.000 0.824 0.000 0.172 0.004
#> SRR2015760     4  0.3413      0.774 0.044 0.000 0.124 0.832 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
#> SRR2015715     4  0.5430     0.2927 0.376 0.000 0.004 0.512 0.000 0.108
#> SRR2015735     3  0.1471     0.9156 0.064 0.000 0.932 0.004 0.000 0.000
#> SRR2015759     1  0.0000     0.8911 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2015753     1  0.0000     0.8911 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2015746     5  0.0458     0.8943 0.016 0.000 0.000 0.000 0.984 0.000
#> SRR2015758     2  0.3445     0.7406 0.000 0.744 0.000 0.012 0.000 0.244
#> SRR2015756     1  0.0000     0.8911 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2015757     6  0.0935     0.7766 0.000 0.000 0.000 0.032 0.004 0.964
#> SRR2015755     1  0.0000     0.8911 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2015754     1  0.2631     0.6742 0.820 0.000 0.180 0.000 0.000 0.000
#> SRR2015752     1  0.0000     0.8911 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2015749     1  0.0000     0.8911 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2015750     6  0.4047     0.1106 0.000 0.384 0.000 0.012 0.000 0.604
#> SRR2015751     5  0.0458     0.8943 0.016 0.000 0.000 0.000 0.984 0.000
#> SRR2015748     5  0.3558     0.6930 0.000 0.248 0.016 0.000 0.736 0.000
#> SRR2015747     1  0.0000     0.8911 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2015745     5  0.2595     0.8003 0.000 0.160 0.000 0.000 0.836 0.004
#> SRR2015743     1  0.0000     0.8911 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2015744     5  0.0603     0.8938 0.016 0.004 0.000 0.000 0.980 0.000
#> SRR2015742     5  0.0458     0.8943 0.016 0.000 0.000 0.000 0.984 0.000
#> SRR2015741     1  0.0363     0.8816 0.988 0.000 0.012 0.000 0.000 0.000
#> SRR2015740     1  0.0000     0.8911 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2015738     1  0.0363     0.8816 0.988 0.000 0.012 0.000 0.000 0.000
#> SRR2015739     1  0.0000     0.8911 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2015737     2  0.3171     0.7798 0.000 0.784 0.000 0.012 0.000 0.204
#> SRR2015736     6  0.0935     0.7761 0.000 0.000 0.004 0.032 0.000 0.964
#> SRR2015732     4  0.5487     0.1682 0.432 0.000 0.004 0.456 0.000 0.108
#> SRR2015733     6  0.2003     0.6888 0.000 0.116 0.000 0.000 0.000 0.884
#> SRR2015734     4  0.5455     0.2666 0.392 0.000 0.004 0.496 0.000 0.108
#> SRR2015731     3  0.0146     0.9572 0.000 0.004 0.996 0.000 0.000 0.000
#> SRR2015730     1  0.3360     0.5362 0.732 0.000 0.004 0.264 0.000 0.000
#> SRR2015728     6  0.7219    -0.0125 0.208 0.000 0.116 0.264 0.000 0.412
#> SRR2015729     4  0.5945    -0.0255 0.000 0.312 0.000 0.492 0.008 0.188
#> SRR2015727     3  0.0146     0.9572 0.000 0.004 0.996 0.000 0.000 0.000
#> SRR2015726     1  0.4384    -0.0198 0.520 0.000 0.004 0.460 0.000 0.016
#> SRR2015723     4  0.0767     0.4436 0.012 0.000 0.004 0.976 0.008 0.000
#> SRR2015724     4  0.2257     0.4099 0.008 0.000 0.000 0.876 0.000 0.116
#> SRR2015725     1  0.3878     0.3503 0.644 0.000 0.004 0.348 0.000 0.004
#> SRR2015722     3  0.0146     0.9572 0.000 0.004 0.996 0.000 0.000 0.000
#> SRR2015721     6  0.0653     0.7777 0.000 0.004 0.004 0.012 0.000 0.980
#> SRR2015720     6  0.0935     0.7766 0.000 0.000 0.000 0.032 0.004 0.964
#> SRR2015718     4  0.0405     0.4366 0.000 0.000 0.004 0.988 0.008 0.000
#> SRR2015719     2  0.1049     0.8497 0.000 0.960 0.032 0.000 0.008 0.000
#> SRR2015717     3  0.1536     0.9336 0.016 0.000 0.940 0.040 0.000 0.004
#> SRR2015716     4  0.0972     0.4512 0.028 0.000 0.008 0.964 0.000 0.000
#> SRR2015714     2  0.1049     0.8497 0.000 0.960 0.032 0.000 0.008 0.000
#> SRR2015713     6  0.0508     0.7772 0.000 0.004 0.000 0.012 0.000 0.984
#> SRR2015784     2  0.0881     0.8550 0.000 0.972 0.000 0.008 0.008 0.012
#> SRR2015785     2  0.0405     0.8564 0.000 0.988 0.000 0.000 0.008 0.004
#> SRR2015783     1  0.0000     0.8911 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2015782     5  0.3295     0.7712 0.000 0.176 0.000 0.012 0.800 0.012
#> SRR2015781     2  0.0405     0.8560 0.000 0.988 0.004 0.000 0.008 0.000
#> SRR2015780     2  0.0820     0.8541 0.000 0.972 0.016 0.000 0.012 0.000
#> SRR2015779     2  0.0405     0.8565 0.000 0.988 0.000 0.000 0.008 0.004
#> SRR2015778     5  0.0291     0.8897 0.004 0.004 0.000 0.000 0.992 0.000
#> SRR2015777     5  0.0458     0.8943 0.016 0.000 0.000 0.000 0.984 0.000
#> SRR2015776     2  0.0806     0.8539 0.000 0.972 0.020 0.000 0.008 0.000
#> SRR2015775     4  0.5820     0.0527 0.000 0.272 0.000 0.532 0.008 0.188
#> SRR2015774     2  0.5557     0.7022 0.000 0.672 0.056 0.104 0.008 0.160
#> SRR2015773     2  0.3141     0.7811 0.000 0.788 0.000 0.012 0.000 0.200
#> SRR2015772     2  0.3141     0.7811 0.000 0.788 0.000 0.012 0.000 0.200
#> SRR2015771     4  0.5430     0.2927 0.376 0.000 0.004 0.512 0.000 0.108
#> SRR2015769     4  0.5945    -0.0255 0.000 0.312 0.000 0.492 0.008 0.188
#> SRR2015770     2  0.3171     0.7798 0.000 0.784 0.000 0.012 0.000 0.204
#> SRR2015768     2  0.3171     0.7798 0.000 0.784 0.000 0.012 0.000 0.204
#> SRR2015767     2  0.0891     0.8529 0.000 0.968 0.024 0.000 0.008 0.000
#> SRR2015766     3  0.0146     0.9562 0.000 0.000 0.996 0.004 0.000 0.000
#> SRR2015764     2  0.4116     0.4320 0.000 0.572 0.000 0.012 0.000 0.416
#> SRR2015765     2  0.1750     0.8415 0.000 0.928 0.056 0.004 0.008 0.004
#> SRR2015763     4  0.5455     0.2666 0.392 0.000 0.004 0.496 0.000 0.108
#> SRR2015762     2  0.0508     0.8580 0.000 0.984 0.004 0.000 0.000 0.012
#> SRR2015761     2  0.2106     0.8424 0.000 0.904 0.064 0.000 0.000 0.032
#> SRR2015760     3  0.1511     0.9329 0.012 0.000 0.940 0.044 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-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

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

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

collect_plots(res)

plot of chunk MAD-pam-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.916           0.937       0.975         0.4966 0.505   0.505
#> 3 3 0.828           0.869       0.940         0.3373 0.666   0.434
#> 4 4 0.833           0.858       0.940         0.0526 0.967   0.902
#> 5 5 0.768           0.680       0.846         0.0876 0.894   0.678
#> 6 6 0.908           0.850       0.944         0.0505 0.917   0.686

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

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

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
#> SRR2015715     1   0.000      0.977 1.000 0.000
#> SRR2015735     1   0.000      0.977 1.000 0.000
#> SRR2015759     1   0.000      0.977 1.000 0.000
#> SRR2015753     1   0.000      0.977 1.000 0.000
#> SRR2015746     1   0.722      0.752 0.800 0.200
#> SRR2015758     2   0.000      0.970 0.000 1.000
#> SRR2015756     1   0.000      0.977 1.000 0.000
#> SRR2015757     2   0.541      0.840 0.124 0.876
#> SRR2015755     1   0.000      0.977 1.000 0.000
#> SRR2015754     1   0.000      0.977 1.000 0.000
#> SRR2015752     1   0.000      0.977 1.000 0.000
#> SRR2015749     1   0.000      0.977 1.000 0.000
#> SRR2015750     2   0.000      0.970 0.000 1.000
#> SRR2015751     1   0.000      0.977 1.000 0.000
#> SRR2015748     2   0.971      0.324 0.400 0.600
#> SRR2015747     1   0.000      0.977 1.000 0.000
#> SRR2015745     2   0.000      0.970 0.000 1.000
#> SRR2015743     1   0.000      0.977 1.000 0.000
#> SRR2015744     1   0.722      0.752 0.800 0.200
#> SRR2015742     2   0.000      0.970 0.000 1.000
#> SRR2015741     1   0.000      0.977 1.000 0.000
#> SRR2015740     1   0.000      0.977 1.000 0.000
#> SRR2015738     1   0.000      0.977 1.000 0.000
#> SRR2015739     1   0.000      0.977 1.000 0.000
#> SRR2015737     2   0.000      0.970 0.000 1.000
#> SRR2015736     2   0.000      0.970 0.000 1.000
#> SRR2015732     1   0.000      0.977 1.000 0.000
#> SRR2015733     2   0.000      0.970 0.000 1.000
#> SRR2015734     1   0.000      0.977 1.000 0.000
#> SRR2015731     2   0.000      0.970 0.000 1.000
#> SRR2015730     1   0.000      0.977 1.000 0.000
#> SRR2015728     1   0.000      0.977 1.000 0.000
#> SRR2015729     2   0.000      0.970 0.000 1.000
#> SRR2015727     2   0.000      0.970 0.000 1.000
#> SRR2015726     1   0.000      0.977 1.000 0.000
#> SRR2015723     2   0.000      0.970 0.000 1.000
#> SRR2015724     2   0.000      0.970 0.000 1.000
#> SRR2015725     1   0.000      0.977 1.000 0.000
#> SRR2015722     1   0.839      0.638 0.732 0.268
#> SRR2015721     2   0.000      0.970 0.000 1.000
#> SRR2015720     2   0.000      0.970 0.000 1.000
#> SRR2015718     2   0.000      0.970 0.000 1.000
#> SRR2015719     2   0.000      0.970 0.000 1.000
#> SRR2015717     1   0.000      0.977 1.000 0.000
#> SRR2015716     1   0.000      0.977 1.000 0.000
#> SRR2015714     2   0.000      0.970 0.000 1.000
#> SRR2015713     2   0.000      0.970 0.000 1.000
#> SRR2015784     2   0.000      0.970 0.000 1.000
#> SRR2015785     2   0.000      0.970 0.000 1.000
#> SRR2015783     1   0.000      0.977 1.000 0.000
#> SRR2015782     2   0.000      0.970 0.000 1.000
#> SRR2015781     2   0.000      0.970 0.000 1.000
#> SRR2015780     2   0.000      0.970 0.000 1.000
#> SRR2015779     2   0.000      0.970 0.000 1.000
#> SRR2015778     2   0.730      0.730 0.204 0.796
#> SRR2015777     2   0.991      0.190 0.444 0.556
#> SRR2015776     2   0.000      0.970 0.000 1.000
#> SRR2015775     2   0.000      0.970 0.000 1.000
#> SRR2015774     2   0.000      0.970 0.000 1.000
#> SRR2015773     2   0.000      0.970 0.000 1.000
#> SRR2015772     2   0.000      0.970 0.000 1.000
#> SRR2015771     1   0.000      0.977 1.000 0.000
#> SRR2015769     2   0.000      0.970 0.000 1.000
#> SRR2015770     2   0.000      0.970 0.000 1.000
#> SRR2015768     2   0.000      0.970 0.000 1.000
#> SRR2015767     2   0.000      0.970 0.000 1.000
#> SRR2015766     2   0.000      0.970 0.000 1.000
#> SRR2015764     2   0.000      0.970 0.000 1.000
#> SRR2015765     2   0.000      0.970 0.000 1.000
#> SRR2015763     1   0.000      0.977 1.000 0.000
#> SRR2015762     2   0.000      0.970 0.000 1.000
#> SRR2015761     2   0.000      0.970 0.000 1.000
#> SRR2015760     1   0.000      0.977 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
#> SRR2015715     3  0.4555     0.7424 0.200 0.000 0.800
#> SRR2015735     1  0.5216     0.6499 0.740 0.000 0.260
#> SRR2015759     1  0.0000     0.9734 1.000 0.000 0.000
#> SRR2015753     1  0.0000     0.9734 1.000 0.000 0.000
#> SRR2015746     3  0.1411     0.8571 0.036 0.000 0.964
#> SRR2015758     2  0.0000     0.9765 0.000 1.000 0.000
#> SRR2015756     1  0.0000     0.9734 1.000 0.000 0.000
#> SRR2015757     3  0.0000     0.8739 0.000 0.000 1.000
#> SRR2015755     1  0.0000     0.9734 1.000 0.000 0.000
#> SRR2015754     1  0.3482     0.8385 0.872 0.000 0.128
#> SRR2015752     1  0.0000     0.9734 1.000 0.000 0.000
#> SRR2015749     1  0.0000     0.9734 1.000 0.000 0.000
#> SRR2015750     2  0.0000     0.9765 0.000 1.000 0.000
#> SRR2015751     3  0.4235     0.7624 0.176 0.000 0.824
#> SRR2015748     3  0.9455     0.4006 0.208 0.304 0.488
#> SRR2015747     1  0.0000     0.9734 1.000 0.000 0.000
#> SRR2015745     2  0.0000     0.9765 0.000 1.000 0.000
#> SRR2015743     1  0.0000     0.9734 1.000 0.000 0.000
#> SRR2015744     3  0.2448     0.8300 0.076 0.000 0.924
#> SRR2015742     3  0.0000     0.8739 0.000 0.000 1.000
#> SRR2015741     1  0.0000     0.9734 1.000 0.000 0.000
#> SRR2015740     1  0.0000     0.9734 1.000 0.000 0.000
#> SRR2015738     1  0.0000     0.9734 1.000 0.000 0.000
#> SRR2015739     1  0.0000     0.9734 1.000 0.000 0.000
#> SRR2015737     2  0.0000     0.9765 0.000 1.000 0.000
#> SRR2015736     3  0.0000     0.8739 0.000 0.000 1.000
#> SRR2015732     3  0.6235     0.3552 0.436 0.000 0.564
#> SRR2015733     2  0.2356     0.8989 0.000 0.928 0.072
#> SRR2015734     3  0.5926     0.5333 0.356 0.000 0.644
#> SRR2015731     3  0.0000     0.8739 0.000 0.000 1.000
#> SRR2015730     1  0.0000     0.9734 1.000 0.000 0.000
#> SRR2015728     3  0.0000     0.8739 0.000 0.000 1.000
#> SRR2015729     2  0.0000     0.9765 0.000 1.000 0.000
#> SRR2015727     3  0.0000     0.8739 0.000 0.000 1.000
#> SRR2015726     3  0.0000     0.8739 0.000 0.000 1.000
#> SRR2015723     3  0.0000     0.8739 0.000 0.000 1.000
#> SRR2015724     3  0.0000     0.8739 0.000 0.000 1.000
#> SRR2015725     1  0.0000     0.9734 1.000 0.000 0.000
#> SRR2015722     3  0.0000     0.8739 0.000 0.000 1.000
#> SRR2015721     3  0.5465     0.5896 0.000 0.288 0.712
#> SRR2015720     3  0.0000     0.8739 0.000 0.000 1.000
#> SRR2015718     3  0.0892     0.8664 0.000 0.020 0.980
#> SRR2015719     2  0.0000     0.9765 0.000 1.000 0.000
#> SRR2015717     3  0.0000     0.8739 0.000 0.000 1.000
#> SRR2015716     3  0.0237     0.8728 0.004 0.000 0.996
#> SRR2015714     2  0.0000     0.9765 0.000 1.000 0.000
#> SRR2015713     3  0.5138     0.6658 0.000 0.252 0.748
#> SRR2015784     2  0.0000     0.9765 0.000 1.000 0.000
#> SRR2015785     2  0.0000     0.9765 0.000 1.000 0.000
#> SRR2015783     1  0.0000     0.9734 1.000 0.000 0.000
#> SRR2015782     2  0.0000     0.9765 0.000 1.000 0.000
#> SRR2015781     2  0.0000     0.9765 0.000 1.000 0.000
#> SRR2015780     2  0.0000     0.9765 0.000 1.000 0.000
#> SRR2015779     2  0.0000     0.9765 0.000 1.000 0.000
#> SRR2015778     3  0.0424     0.8712 0.008 0.000 0.992
#> SRR2015777     3  0.3340     0.8049 0.000 0.120 0.880
#> SRR2015776     2  0.0000     0.9765 0.000 1.000 0.000
#> SRR2015775     3  0.6305     0.1652 0.000 0.484 0.516
#> SRR2015774     2  0.6267     0.0314 0.000 0.548 0.452
#> SRR2015773     2  0.0000     0.9765 0.000 1.000 0.000
#> SRR2015772     2  0.0000     0.9765 0.000 1.000 0.000
#> SRR2015771     3  0.5397     0.6521 0.280 0.000 0.720
#> SRR2015769     2  0.0000     0.9765 0.000 1.000 0.000
#> SRR2015770     2  0.0000     0.9765 0.000 1.000 0.000
#> SRR2015768     2  0.0000     0.9765 0.000 1.000 0.000
#> SRR2015767     2  0.0000     0.9765 0.000 1.000 0.000
#> SRR2015766     3  0.0000     0.8739 0.000 0.000 1.000
#> SRR2015764     2  0.0000     0.9765 0.000 1.000 0.000
#> SRR2015765     2  0.0000     0.9765 0.000 1.000 0.000
#> SRR2015763     3  0.4555     0.7424 0.200 0.000 0.800
#> SRR2015762     2  0.0000     0.9765 0.000 1.000 0.000
#> SRR2015761     2  0.0000     0.9765 0.000 1.000 0.000
#> SRR2015760     3  0.0000     0.8739 0.000 0.000 1.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> SRR2015715     3  0.3610     0.7337 0.200 0.000 0.800 0.000
#> SRR2015735     1  0.4134     0.6044 0.740 0.000 0.260 0.000
#> SRR2015759     1  0.0000     0.9667 1.000 0.000 0.000 0.000
#> SRR2015753     1  0.0000     0.9667 1.000 0.000 0.000 0.000
#> SRR2015746     3  0.1118     0.8424 0.036 0.000 0.964 0.000
#> SRR2015758     2  0.0000     0.9652 0.000 1.000 0.000 0.000
#> SRR2015756     1  0.0000     0.9667 1.000 0.000 0.000 0.000
#> SRR2015757     3  0.0000     0.8597 0.000 0.000 1.000 0.000
#> SRR2015755     1  0.0000     0.9667 1.000 0.000 0.000 0.000
#> SRR2015754     1  0.2760     0.8033 0.872 0.000 0.128 0.000
#> SRR2015752     1  0.0000     0.9667 1.000 0.000 0.000 0.000
#> SRR2015749     1  0.0000     0.9667 1.000 0.000 0.000 0.000
#> SRR2015750     2  0.0000     0.9652 0.000 1.000 0.000 0.000
#> SRR2015751     3  0.3356     0.7506 0.176 0.000 0.824 0.000
#> SRR2015748     3  0.7493     0.3563 0.208 0.304 0.488 0.000
#> SRR2015747     1  0.0000     0.9667 1.000 0.000 0.000 0.000
#> SRR2015745     2  0.0000     0.9652 0.000 1.000 0.000 0.000
#> SRR2015743     1  0.0000     0.9667 1.000 0.000 0.000 0.000
#> SRR2015744     3  0.1940     0.8143 0.076 0.000 0.924 0.000
#> SRR2015742     3  0.0000     0.8597 0.000 0.000 1.000 0.000
#> SRR2015741     1  0.0000     0.9667 1.000 0.000 0.000 0.000
#> SRR2015740     1  0.0000     0.9667 1.000 0.000 0.000 0.000
#> SRR2015738     1  0.0000     0.9667 1.000 0.000 0.000 0.000
#> SRR2015739     1  0.0000     0.9667 1.000 0.000 0.000 0.000
#> SRR2015737     2  0.0000     0.9652 0.000 1.000 0.000 0.000
#> SRR2015736     3  0.0000     0.8597 0.000 0.000 1.000 0.000
#> SRR2015732     3  0.4941     0.3586 0.436 0.000 0.564 0.000
#> SRR2015733     2  0.1867     0.8747 0.000 0.928 0.072 0.000
#> SRR2015734     3  0.4697     0.5365 0.356 0.000 0.644 0.000
#> SRR2015731     3  0.0000     0.8597 0.000 0.000 1.000 0.000
#> SRR2015730     1  0.0000     0.9667 1.000 0.000 0.000 0.000
#> SRR2015728     3  0.0000     0.8597 0.000 0.000 1.000 0.000
#> SRR2015729     2  0.0000     0.9652 0.000 1.000 0.000 0.000
#> SRR2015727     3  0.0000     0.8597 0.000 0.000 1.000 0.000
#> SRR2015726     3  0.0000     0.8597 0.000 0.000 1.000 0.000
#> SRR2015723     3  0.0000     0.8597 0.000 0.000 1.000 0.000
#> SRR2015724     3  0.0000     0.8597 0.000 0.000 1.000 0.000
#> SRR2015725     1  0.0000     0.9667 1.000 0.000 0.000 0.000
#> SRR2015722     3  0.0000     0.8597 0.000 0.000 1.000 0.000
#> SRR2015721     3  0.4331     0.5647 0.000 0.288 0.712 0.000
#> SRR2015720     3  0.0000     0.8597 0.000 0.000 1.000 0.000
#> SRR2015718     3  0.0707     0.8511 0.000 0.020 0.980 0.000
#> SRR2015719     4  0.0000     1.0000 0.000 0.000 0.000 1.000
#> SRR2015717     3  0.0000     0.8597 0.000 0.000 1.000 0.000
#> SRR2015716     3  0.0188     0.8587 0.004 0.000 0.996 0.000
#> SRR2015714     4  0.0000     1.0000 0.000 0.000 0.000 1.000
#> SRR2015713     3  0.4072     0.6457 0.000 0.252 0.748 0.000
#> SRR2015784     2  0.0000     0.9652 0.000 1.000 0.000 0.000
#> SRR2015785     2  0.0000     0.9652 0.000 1.000 0.000 0.000
#> SRR2015783     1  0.0000     0.9667 1.000 0.000 0.000 0.000
#> SRR2015782     2  0.0000     0.9652 0.000 1.000 0.000 0.000
#> SRR2015781     2  0.0188     0.9620 0.000 0.996 0.000 0.004
#> SRR2015780     2  0.0000     0.9652 0.000 1.000 0.000 0.000
#> SRR2015779     2  0.0000     0.9652 0.000 1.000 0.000 0.000
#> SRR2015778     3  0.0336     0.8570 0.008 0.000 0.992 0.000
#> SRR2015777     3  0.2647     0.7805 0.000 0.120 0.880 0.000
#> SRR2015776     4  0.0000     1.0000 0.000 0.000 0.000 1.000
#> SRR2015775     3  0.4996     0.1660 0.000 0.484 0.516 0.000
#> SRR2015774     2  0.4967     0.0258 0.000 0.548 0.452 0.000
#> SRR2015773     2  0.0000     0.9652 0.000 1.000 0.000 0.000
#> SRR2015772     2  0.0000     0.9652 0.000 1.000 0.000 0.000
#> SRR2015771     3  0.4277     0.6552 0.280 0.000 0.720 0.000
#> SRR2015769     2  0.0000     0.9652 0.000 1.000 0.000 0.000
#> SRR2015770     2  0.0000     0.9652 0.000 1.000 0.000 0.000
#> SRR2015768     2  0.0000     0.9652 0.000 1.000 0.000 0.000
#> SRR2015767     4  0.0000     1.0000 0.000 0.000 0.000 1.000
#> SRR2015766     3  0.0000     0.8597 0.000 0.000 1.000 0.000
#> SRR2015764     2  0.0000     0.9652 0.000 1.000 0.000 0.000
#> SRR2015765     2  0.0000     0.9652 0.000 1.000 0.000 0.000
#> SRR2015763     3  0.3610     0.7337 0.200 0.000 0.800 0.000
#> SRR2015762     2  0.0188     0.9620 0.000 0.996 0.000 0.004
#> SRR2015761     2  0.0000     0.9652 0.000 1.000 0.000 0.000
#> SRR2015760     3  0.0000     0.8597 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
#> SRR2015715     3  0.3109     0.4198 0.200 0.000 0.800 0.000 0.000
#> SRR2015735     3  0.5044     0.3603 0.036 0.000 0.556 0.000 0.408
#> SRR2015759     1  0.0000     0.9206 1.000 0.000 0.000 0.000 0.000
#> SRR2015753     1  0.0000     0.9206 1.000 0.000 0.000 0.000 0.000
#> SRR2015746     5  0.4201     0.8075 0.000 0.000 0.408 0.000 0.592
#> SRR2015758     2  0.0000     0.9189 0.000 1.000 0.000 0.000 0.000
#> SRR2015756     1  0.0000     0.9206 1.000 0.000 0.000 0.000 0.000
#> SRR2015757     3  0.3039     0.3281 0.000 0.000 0.808 0.000 0.192
#> SRR2015755     1  0.2732     0.8077 0.840 0.000 0.160 0.000 0.000
#> SRR2015754     1  0.3039     0.7726 0.808 0.000 0.192 0.000 0.000
#> SRR2015752     1  0.0000     0.9206 1.000 0.000 0.000 0.000 0.000
#> SRR2015749     1  0.0000     0.9206 1.000 0.000 0.000 0.000 0.000
#> SRR2015750     2  0.0000     0.9189 0.000 1.000 0.000 0.000 0.000
#> SRR2015751     5  0.4201     0.8075 0.000 0.000 0.408 0.000 0.592
#> SRR2015748     5  0.3039     0.0389 0.000 0.192 0.000 0.000 0.808
#> SRR2015747     1  0.0000     0.9206 1.000 0.000 0.000 0.000 0.000
#> SRR2015745     2  0.4182     0.3859 0.000 0.600 0.000 0.000 0.400
#> SRR2015743     1  0.0000     0.9206 1.000 0.000 0.000 0.000 0.000
#> SRR2015744     5  0.4256     0.7738 0.000 0.000 0.436 0.000 0.564
#> SRR2015742     5  0.4201     0.8075 0.000 0.000 0.408 0.000 0.592
#> SRR2015741     1  0.2732     0.8077 0.840 0.000 0.160 0.000 0.000
#> SRR2015740     1  0.0000     0.9206 1.000 0.000 0.000 0.000 0.000
#> SRR2015738     1  0.2732     0.8077 0.840 0.000 0.160 0.000 0.000
#> SRR2015739     1  0.0000     0.9206 1.000 0.000 0.000 0.000 0.000
#> SRR2015737     2  0.0000     0.9189 0.000 1.000 0.000 0.000 0.000
#> SRR2015736     3  0.3039     0.3281 0.000 0.000 0.808 0.000 0.192
#> SRR2015732     3  0.4256     0.2838 0.436 0.000 0.564 0.000 0.000
#> SRR2015733     2  0.3318     0.6884 0.000 0.800 0.008 0.000 0.192
#> SRR2015734     1  0.3932     0.3874 0.672 0.000 0.328 0.000 0.000
#> SRR2015731     3  0.4201     0.3878 0.000 0.000 0.592 0.000 0.408
#> SRR2015730     1  0.0000     0.9206 1.000 0.000 0.000 0.000 0.000
#> SRR2015728     3  0.3039     0.3281 0.000 0.000 0.808 0.000 0.192
#> SRR2015729     2  0.0000     0.9189 0.000 1.000 0.000 0.000 0.000
#> SRR2015727     3  0.4201     0.3878 0.000 0.000 0.592 0.000 0.408
#> SRR2015726     3  0.0609     0.4513 0.020 0.000 0.980 0.000 0.000
#> SRR2015723     3  0.2813     0.3602 0.000 0.168 0.832 0.000 0.000
#> SRR2015724     3  0.3039     0.3281 0.000 0.000 0.808 0.000 0.192
#> SRR2015725     1  0.0000     0.9206 1.000 0.000 0.000 0.000 0.000
#> SRR2015722     3  0.4227     0.3781 0.000 0.000 0.580 0.000 0.420
#> SRR2015721     3  0.6499    -0.1784 0.000 0.368 0.440 0.000 0.192
#> SRR2015720     3  0.3039     0.3281 0.000 0.000 0.808 0.000 0.192
#> SRR2015718     3  0.2852     0.3561 0.000 0.172 0.828 0.000 0.000
#> SRR2015719     4  0.0000     1.0000 0.000 0.000 0.000 1.000 0.000
#> SRR2015717     3  0.4201     0.3878 0.000 0.000 0.592 0.000 0.408
#> SRR2015716     3  0.2773     0.4347 0.164 0.000 0.836 0.000 0.000
#> SRR2015714     4  0.0000     1.0000 0.000 0.000 0.000 1.000 0.000
#> SRR2015713     3  0.6494    -0.1768 0.000 0.364 0.444 0.000 0.192
#> SRR2015784     2  0.0000     0.9189 0.000 1.000 0.000 0.000 0.000
#> SRR2015785     2  0.0000     0.9189 0.000 1.000 0.000 0.000 0.000
#> SRR2015783     1  0.0000     0.9206 1.000 0.000 0.000 0.000 0.000
#> SRR2015782     2  0.4182     0.3859 0.000 0.600 0.000 0.000 0.400
#> SRR2015781     2  0.0162     0.9163 0.000 0.996 0.000 0.004 0.000
#> SRR2015780     2  0.0000     0.9189 0.000 1.000 0.000 0.000 0.000
#> SRR2015779     2  0.0000     0.9189 0.000 1.000 0.000 0.000 0.000
#> SRR2015778     5  0.4161     0.7981 0.000 0.000 0.392 0.000 0.608
#> SRR2015777     5  0.4235     0.7865 0.000 0.000 0.424 0.000 0.576
#> SRR2015776     4  0.0000     1.0000 0.000 0.000 0.000 1.000 0.000
#> SRR2015775     2  0.4161     0.2181 0.000 0.608 0.392 0.000 0.000
#> SRR2015774     2  0.1908     0.8283 0.000 0.908 0.092 0.000 0.000
#> SRR2015773     2  0.0000     0.9189 0.000 1.000 0.000 0.000 0.000
#> SRR2015772     2  0.0000     0.9189 0.000 1.000 0.000 0.000 0.000
#> SRR2015771     3  0.3109     0.4198 0.200 0.000 0.800 0.000 0.000
#> SRR2015769     2  0.0000     0.9189 0.000 1.000 0.000 0.000 0.000
#> SRR2015770     2  0.0000     0.9189 0.000 1.000 0.000 0.000 0.000
#> SRR2015768     2  0.0000     0.9189 0.000 1.000 0.000 0.000 0.000
#> SRR2015767     4  0.0000     1.0000 0.000 0.000 0.000 1.000 0.000
#> SRR2015766     3  0.4210     0.3875 0.000 0.000 0.588 0.000 0.412
#> SRR2015764     2  0.0000     0.9189 0.000 1.000 0.000 0.000 0.000
#> SRR2015765     2  0.0000     0.9189 0.000 1.000 0.000 0.000 0.000
#> SRR2015763     3  0.3109     0.4198 0.200 0.000 0.800 0.000 0.000
#> SRR2015762     2  0.0162     0.9163 0.000 0.996 0.000 0.004 0.000
#> SRR2015761     2  0.0000     0.9189 0.000 1.000 0.000 0.000 0.000
#> SRR2015760     3  0.0290     0.4462 0.000 0.000 0.992 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
#> SRR2015715     6  0.0000    0.86734 0.000 0.000 0.000 0.000 0.000 1.000
#> SRR2015735     3  0.0000    0.79326 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2015759     1  0.0000    0.93848 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2015753     1  0.0000    0.93848 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2015746     5  0.0000    0.92137 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR2015758     2  0.0000    0.95440 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2015756     1  0.0000    0.93848 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2015757     6  0.0000    0.86734 0.000 0.000 0.000 0.000 0.000 1.000
#> SRR2015755     1  0.2793    0.78578 0.800 0.000 0.200 0.000 0.000 0.000
#> SRR2015754     1  0.2793    0.78578 0.800 0.000 0.200 0.000 0.000 0.000
#> SRR2015752     1  0.0000    0.93848 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2015749     1  0.0000    0.93848 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2015750     2  0.0000    0.95440 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2015751     5  0.0000    0.92137 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR2015748     5  0.0146    0.91863 0.000 0.000 0.004 0.000 0.996 0.000
#> SRR2015747     1  0.0000    0.93848 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2015745     5  0.0000    0.92137 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR2015743     1  0.0000    0.93848 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2015744     5  0.0000    0.92137 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR2015742     5  0.0000    0.92137 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR2015741     1  0.2793    0.78578 0.800 0.000 0.200 0.000 0.000 0.000
#> SRR2015740     1  0.0000    0.93848 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2015738     1  0.2793    0.78578 0.800 0.000 0.200 0.000 0.000 0.000
#> SRR2015739     1  0.0000    0.93848 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2015737     2  0.0000    0.95440 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2015736     6  0.0000    0.86734 0.000 0.000 0.000 0.000 0.000 1.000
#> SRR2015732     6  0.3717    0.43239 0.384 0.000 0.000 0.000 0.000 0.616
#> SRR2015733     2  0.0000    0.95440 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2015734     6  0.3464    0.54280 0.312 0.000 0.000 0.000 0.000 0.688
#> SRR2015731     3  0.0000    0.79326 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2015730     1  0.0000    0.93848 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2015728     6  0.0000    0.86734 0.000 0.000 0.000 0.000 0.000 1.000
#> SRR2015729     2  0.0000    0.95440 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2015727     3  0.0000    0.79326 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2015726     6  0.0000    0.86734 0.000 0.000 0.000 0.000 0.000 1.000
#> SRR2015723     6  0.0000    0.86734 0.000 0.000 0.000 0.000 0.000 1.000
#> SRR2015724     6  0.0000    0.86734 0.000 0.000 0.000 0.000 0.000 1.000
#> SRR2015725     1  0.0000    0.93848 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2015722     3  0.0000    0.79326 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2015721     2  0.3727    0.39484 0.000 0.612 0.000 0.000 0.000 0.388
#> SRR2015720     6  0.0000    0.86734 0.000 0.000 0.000 0.000 0.000 1.000
#> SRR2015718     6  0.0000    0.86734 0.000 0.000 0.000 0.000 0.000 1.000
#> SRR2015719     4  0.0000    1.00000 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR2015717     3  0.3866    0.00826 0.000 0.000 0.516 0.000 0.000 0.484
#> SRR2015716     6  0.0000    0.86734 0.000 0.000 0.000 0.000 0.000 1.000
#> SRR2015714     4  0.0000    1.00000 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR2015713     6  0.3371    0.44920 0.000 0.292 0.000 0.000 0.000 0.708
#> SRR2015784     2  0.0000    0.95440 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2015785     2  0.0000    0.95440 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2015783     1  0.0000    0.93848 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2015782     5  0.3765    0.33909 0.000 0.404 0.000 0.000 0.596 0.000
#> SRR2015781     2  0.0146    0.95188 0.000 0.996 0.000 0.004 0.000 0.000
#> SRR2015780     2  0.0000    0.95440 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2015779     2  0.0000    0.95440 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2015778     5  0.0000    0.92137 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR2015777     5  0.0146    0.91728 0.000 0.000 0.000 0.000 0.996 0.004
#> SRR2015776     4  0.0000    1.00000 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR2015775     2  0.3727    0.39484 0.000 0.612 0.000 0.000 0.000 0.388
#> SRR2015774     2  0.0146    0.95111 0.000 0.996 0.000 0.000 0.000 0.004
#> SRR2015773     2  0.0000    0.95440 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2015772     2  0.0000    0.95440 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2015771     6  0.0000    0.86734 0.000 0.000 0.000 0.000 0.000 1.000
#> SRR2015769     2  0.0000    0.95440 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2015770     2  0.0000    0.95440 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2015768     2  0.0000    0.95440 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2015767     4  0.0000    1.00000 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR2015766     3  0.2631    0.61792 0.000 0.000 0.820 0.000 0.000 0.180
#> SRR2015764     2  0.0000    0.95440 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2015765     2  0.0458    0.94074 0.000 0.984 0.016 0.000 0.000 0.000
#> SRR2015763     6  0.2793    0.68392 0.200 0.000 0.000 0.000 0.000 0.800
#> SRR2015762     2  0.0146    0.95188 0.000 0.996 0.000 0.004 0.000 0.000
#> SRR2015761     2  0.0000    0.95440 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2015760     6  0.2762    0.64801 0.000 0.000 0.196 0.000 0.000 0.804

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

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

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

collect_plots(res)

plot of chunk MAD-mclust-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.365           0.857       0.869         0.4276 0.521   0.521
#> 3 3 0.225           0.775       0.829         0.2533 0.924   0.854
#> 4 4 0.538           0.564       0.817         0.2194 0.846   0.671
#> 5 5 0.586           0.672       0.807         0.1490 0.874   0.656
#> 6 6 0.644           0.733       0.814         0.0548 0.903   0.657

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
#> SRR2015715     2  0.4161      0.877 0.084 0.916
#> SRR2015735     2  0.4815      0.880 0.104 0.896
#> SRR2015759     1  0.5059      0.797 0.888 0.112
#> SRR2015753     1  0.4161      0.795 0.916 0.084
#> SRR2015746     1  0.9044      0.832 0.680 0.320
#> SRR2015758     2  0.0672      0.918 0.008 0.992
#> SRR2015756     1  0.3274      0.789 0.940 0.060
#> SRR2015757     2  0.1633      0.912 0.024 0.976
#> SRR2015755     1  0.6973      0.836 0.812 0.188
#> SRR2015754     1  0.9248      0.810 0.660 0.340
#> SRR2015752     1  0.6531      0.799 0.832 0.168
#> SRR2015749     1  0.4815      0.797 0.896 0.104
#> SRR2015750     2  0.4022      0.883 0.080 0.920
#> SRR2015751     1  0.9358      0.817 0.648 0.352
#> SRR2015748     1  0.8713      0.836 0.708 0.292
#> SRR2015747     1  0.4431      0.800 0.908 0.092
#> SRR2015745     1  0.8909      0.836 0.692 0.308
#> SRR2015743     1  0.4690      0.805 0.900 0.100
#> SRR2015744     1  0.8713      0.836 0.708 0.292
#> SRR2015742     1  0.9286      0.807 0.656 0.344
#> SRR2015741     1  0.7883      0.829 0.764 0.236
#> SRR2015740     1  0.6531      0.799 0.832 0.168
#> SRR2015738     1  0.8499      0.825 0.724 0.276
#> SRR2015739     1  0.4022      0.795 0.920 0.080
#> SRR2015737     2  0.4022      0.883 0.080 0.920
#> SRR2015736     2  0.2043      0.909 0.032 0.968
#> SRR2015732     2  0.6887      0.767 0.184 0.816
#> SRR2015733     2  0.0938      0.917 0.012 0.988
#> SRR2015734     2  0.7602      0.719 0.220 0.780
#> SRR2015731     2  0.3114      0.902 0.056 0.944
#> SRR2015730     2  0.7376      0.729 0.208 0.792
#> SRR2015728     2  0.1633      0.912 0.024 0.976
#> SRR2015729     2  0.4431      0.883 0.092 0.908
#> SRR2015727     2  0.3431      0.897 0.064 0.936
#> SRR2015726     2  0.2778      0.909 0.048 0.952
#> SRR2015723     2  0.3584      0.893 0.068 0.932
#> SRR2015724     2  0.0672      0.918 0.008 0.992
#> SRR2015725     2  0.7602      0.719 0.220 0.780
#> SRR2015722     2  0.3584      0.897 0.068 0.932
#> SRR2015721     2  0.1633      0.912 0.024 0.976
#> SRR2015720     2  0.1843      0.911 0.028 0.972
#> SRR2015718     2  0.3584      0.893 0.068 0.932
#> SRR2015719     2  0.3584      0.897 0.068 0.932
#> SRR2015717     2  0.2423      0.911 0.040 0.960
#> SRR2015716     2  0.3733      0.893 0.072 0.928
#> SRR2015714     2  0.3584      0.897 0.068 0.932
#> SRR2015713     2  0.1633      0.912 0.024 0.976
#> SRR2015784     1  0.9044      0.832 0.680 0.320
#> SRR2015785     1  0.9044      0.832 0.680 0.320
#> SRR2015783     1  0.4431      0.797 0.908 0.092
#> SRR2015782     1  0.8955      0.834 0.688 0.312
#> SRR2015781     1  0.9286      0.807 0.656 0.344
#> SRR2015780     1  0.8713      0.836 0.708 0.292
#> SRR2015779     1  0.9608      0.775 0.616 0.384
#> SRR2015778     1  0.8763      0.835 0.704 0.296
#> SRR2015777     1  0.8955      0.835 0.688 0.312
#> SRR2015776     2  0.3584      0.897 0.068 0.932
#> SRR2015775     2  0.4431      0.883 0.092 0.908
#> SRR2015774     2  0.0376      0.918 0.004 0.996
#> SRR2015773     2  0.0672      0.918 0.008 0.992
#> SRR2015772     2  0.0376      0.918 0.004 0.996
#> SRR2015771     2  0.4022      0.879 0.080 0.920
#> SRR2015769     2  0.4431      0.883 0.092 0.908
#> SRR2015770     2  0.1414      0.915 0.020 0.980
#> SRR2015768     2  0.3733      0.890 0.072 0.928
#> SRR2015767     2  0.3584      0.897 0.068 0.932
#> SRR2015766     2  0.2236      0.910 0.036 0.964
#> SRR2015764     2  0.0000      0.918 0.000 1.000
#> SRR2015765     2  0.2778      0.908 0.048 0.952
#> SRR2015763     2  0.7528      0.719 0.216 0.784
#> SRR2015762     2  0.0376      0.918 0.004 0.996
#> SRR2015761     2  0.0376      0.918 0.004 0.996
#> SRR2015760     2  0.0938      0.919 0.012 0.988

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>            class entropy silhouette    p1    p2    p3
#> SRR2015715     3  0.5588      0.785 0.276 0.004 0.720
#> SRR2015735     3  0.7180      0.741 0.268 0.060 0.672
#> SRR2015759     1  0.0000      0.787 1.000 0.000 0.000
#> SRR2015753     1  0.0000      0.787 1.000 0.000 0.000
#> SRR2015746     1  0.4931      0.749 0.784 0.004 0.212
#> SRR2015758     3  0.1529      0.763 0.000 0.040 0.960
#> SRR2015756     1  0.0000      0.787 1.000 0.000 0.000
#> SRR2015757     3  0.0237      0.769 0.000 0.004 0.996
#> SRR2015755     1  0.1877      0.795 0.956 0.012 0.032
#> SRR2015754     1  0.1999      0.795 0.952 0.012 0.036
#> SRR2015752     1  0.3482      0.639 0.872 0.128 0.000
#> SRR2015749     1  0.1163      0.764 0.972 0.028 0.000
#> SRR2015750     3  0.2165      0.746 0.000 0.064 0.936
#> SRR2015751     1  0.6057      0.639 0.656 0.004 0.340
#> SRR2015748     1  0.5574      0.749 0.784 0.032 0.184
#> SRR2015747     1  0.0000      0.787 1.000 0.000 0.000
#> SRR2015745     1  0.6400      0.731 0.740 0.052 0.208
#> SRR2015743     1  0.0000      0.787 1.000 0.000 0.000
#> SRR2015744     1  0.4931      0.749 0.784 0.004 0.212
#> SRR2015742     1  0.5061      0.750 0.784 0.008 0.208
#> SRR2015741     1  0.1877      0.795 0.956 0.012 0.032
#> SRR2015740     1  0.3482      0.639 0.872 0.128 0.000
#> SRR2015738     1  0.1877      0.795 0.956 0.012 0.032
#> SRR2015739     1  0.0000      0.787 1.000 0.000 0.000
#> SRR2015737     3  0.5656      0.832 0.128 0.068 0.804
#> SRR2015736     3  0.3715      0.846 0.128 0.004 0.868
#> SRR2015732     3  0.5785      0.762 0.300 0.004 0.696
#> SRR2015733     3  0.2356      0.747 0.000 0.072 0.928
#> SRR2015734     3  0.5785      0.762 0.300 0.004 0.696
#> SRR2015731     3  0.5603      0.826 0.136 0.060 0.804
#> SRR2015730     3  0.7902      0.604 0.208 0.132 0.660
#> SRR2015728     3  0.0475      0.770 0.004 0.004 0.992
#> SRR2015729     3  0.5466      0.846 0.160 0.040 0.800
#> SRR2015727     3  0.6854      0.757 0.136 0.124 0.740
#> SRR2015726     3  0.5325      0.808 0.248 0.004 0.748
#> SRR2015723     3  0.4293      0.849 0.164 0.004 0.832
#> SRR2015724     3  0.4233      0.849 0.160 0.004 0.836
#> SRR2015725     3  0.7902      0.604 0.208 0.132 0.660
#> SRR2015722     2  0.8349      0.622 0.128 0.608 0.264
#> SRR2015721     3  0.3715      0.846 0.128 0.004 0.868
#> SRR2015720     3  0.2682      0.833 0.076 0.004 0.920
#> SRR2015718     3  0.4233      0.849 0.160 0.004 0.836
#> SRR2015719     2  0.4209      0.913 0.128 0.856 0.016
#> SRR2015717     3  0.5723      0.803 0.240 0.016 0.744
#> SRR2015716     3  0.5254      0.803 0.264 0.000 0.736
#> SRR2015714     2  0.4209      0.913 0.128 0.856 0.016
#> SRR2015713     3  0.0237      0.769 0.000 0.004 0.996
#> SRR2015784     1  0.6892      0.718 0.736 0.112 0.152
#> SRR2015785     1  0.6865      0.709 0.736 0.160 0.104
#> SRR2015783     1  0.0000      0.787 1.000 0.000 0.000
#> SRR2015782     1  0.6203      0.734 0.760 0.056 0.184
#> SRR2015781     1  0.6180      0.621 0.716 0.260 0.024
#> SRR2015780     1  0.6332      0.742 0.768 0.088 0.144
#> SRR2015779     1  0.8937      0.366 0.564 0.252 0.184
#> SRR2015778     1  0.5220      0.750 0.780 0.012 0.208
#> SRR2015777     1  0.4978      0.747 0.780 0.004 0.216
#> SRR2015776     2  0.4209      0.913 0.128 0.856 0.016
#> SRR2015775     3  0.5466      0.846 0.160 0.040 0.800
#> SRR2015774     3  0.4059      0.845 0.128 0.012 0.860
#> SRR2015773     3  0.4960      0.840 0.128 0.040 0.832
#> SRR2015772     3  0.5276      0.840 0.128 0.052 0.820
#> SRR2015771     3  0.5690      0.774 0.288 0.004 0.708
#> SRR2015769     3  0.5466      0.846 0.160 0.040 0.800
#> SRR2015770     3  0.5744      0.835 0.128 0.072 0.800
#> SRR2015768     3  0.5744      0.835 0.128 0.072 0.800
#> SRR2015767     2  0.4209      0.913 0.128 0.856 0.016
#> SRR2015766     3  0.4982      0.835 0.136 0.036 0.828
#> SRR2015764     3  0.2116      0.776 0.012 0.040 0.948
#> SRR2015765     3  0.4960      0.840 0.128 0.040 0.832
#> SRR2015763     3  0.5785      0.762 0.300 0.004 0.696
#> SRR2015762     3  0.8141      0.646 0.116 0.260 0.624
#> SRR2015761     3  0.4059      0.844 0.128 0.012 0.860
#> SRR2015760     3  0.4634      0.846 0.164 0.012 0.824

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> SRR2015715     3  0.3528     0.6390 0.192 0.000 0.808 0.000
#> SRR2015735     3  0.3375     0.7014 0.092 0.016 0.876 0.016
#> SRR2015759     1  0.0000     0.7747 1.000 0.000 0.000 0.000
#> SRR2015753     1  0.0000     0.7747 1.000 0.000 0.000 0.000
#> SRR2015746     1  0.5884     0.5071 0.580 0.032 0.384 0.004
#> SRR2015758     3  0.4907    -0.0144 0.000 0.420 0.580 0.000
#> SRR2015756     1  0.0000     0.7747 1.000 0.000 0.000 0.000
#> SRR2015757     3  0.0000     0.7475 0.000 0.000 1.000 0.000
#> SRR2015755     1  0.0804     0.7720 0.980 0.012 0.008 0.000
#> SRR2015754     1  0.0992     0.7708 0.976 0.012 0.008 0.004
#> SRR2015752     1  0.0188     0.7720 0.996 0.000 0.000 0.004
#> SRR2015749     1  0.0000     0.7747 1.000 0.000 0.000 0.000
#> SRR2015750     2  0.4817     0.4561 0.000 0.612 0.388 0.000
#> SRR2015751     1  0.6644     0.4776 0.532 0.076 0.388 0.004
#> SRR2015748     1  0.6119     0.5015 0.568 0.044 0.384 0.004
#> SRR2015747     1  0.0000     0.7747 1.000 0.000 0.000 0.000
#> SRR2015745     1  0.5763     0.1725 0.516 0.460 0.020 0.004
#> SRR2015743     1  0.0188     0.7740 0.996 0.004 0.000 0.000
#> SRR2015744     1  0.5966     0.5051 0.576 0.036 0.384 0.004
#> SRR2015742     3  0.7988    -0.3598 0.352 0.260 0.384 0.004
#> SRR2015741     1  0.0804     0.7720 0.980 0.012 0.008 0.000
#> SRR2015740     1  0.0188     0.7720 0.996 0.000 0.000 0.004
#> SRR2015738     1  0.0804     0.7720 0.980 0.012 0.008 0.000
#> SRR2015739     1  0.0000     0.7747 1.000 0.000 0.000 0.000
#> SRR2015737     2  0.5105     0.4099 0.004 0.564 0.432 0.000
#> SRR2015736     3  0.0188     0.7477 0.004 0.000 0.996 0.000
#> SRR2015732     3  0.3569     0.6322 0.196 0.000 0.804 0.000
#> SRR2015733     3  0.4088     0.4764 0.000 0.232 0.764 0.004
#> SRR2015734     3  0.3610     0.6325 0.200 0.000 0.800 0.000
#> SRR2015731     3  0.1082     0.7404 0.004 0.004 0.972 0.020
#> SRR2015730     3  0.4978     0.3738 0.384 0.000 0.612 0.004
#> SRR2015728     3  0.0188     0.7473 0.000 0.004 0.996 0.000
#> SRR2015729     2  0.4925     0.4154 0.000 0.572 0.428 0.000
#> SRR2015727     3  0.1296     0.7363 0.004 0.004 0.964 0.028
#> SRR2015726     3  0.0524     0.7481 0.008 0.004 0.988 0.000
#> SRR2015723     3  0.1022     0.7371 0.000 0.032 0.968 0.000
#> SRR2015724     3  0.0336     0.7481 0.008 0.000 0.992 0.000
#> SRR2015725     3  0.4978     0.3738 0.384 0.000 0.612 0.004
#> SRR2015722     4  0.5152     0.3805 0.004 0.004 0.384 0.608
#> SRR2015721     3  0.0376     0.7477 0.004 0.004 0.992 0.000
#> SRR2015720     3  0.0000     0.7475 0.000 0.000 1.000 0.000
#> SRR2015718     3  0.0817     0.7418 0.000 0.024 0.976 0.000
#> SRR2015719     4  0.0188     0.8548 0.004 0.000 0.000 0.996
#> SRR2015717     3  0.0376     0.7477 0.004 0.004 0.992 0.000
#> SRR2015716     3  0.0592     0.7463 0.000 0.016 0.984 0.000
#> SRR2015714     4  0.0188     0.8548 0.004 0.000 0.000 0.996
#> SRR2015713     3  0.0000     0.7475 0.000 0.000 1.000 0.000
#> SRR2015784     2  0.3408     0.4070 0.120 0.860 0.016 0.004
#> SRR2015785     2  0.3408     0.4070 0.120 0.860 0.016 0.004
#> SRR2015783     1  0.0000     0.7747 1.000 0.000 0.000 0.000
#> SRR2015782     1  0.5666     0.1765 0.520 0.460 0.016 0.004
#> SRR2015781     2  0.6289     0.0784 0.116 0.648 0.000 0.236
#> SRR2015780     2  0.3736     0.3995 0.124 0.848 0.016 0.012
#> SRR2015779     2  0.4240     0.1515 0.012 0.784 0.004 0.200
#> SRR2015778     1  0.6272     0.4959 0.556 0.052 0.388 0.004
#> SRR2015777     1  0.6634     0.4793 0.536 0.076 0.384 0.004
#> SRR2015776     4  0.0188     0.8548 0.004 0.000 0.000 0.996
#> SRR2015775     2  0.4933     0.4072 0.000 0.568 0.432 0.000
#> SRR2015774     3  0.1902     0.7127 0.004 0.064 0.932 0.000
#> SRR2015773     3  0.4950     0.1604 0.004 0.376 0.620 0.000
#> SRR2015772     3  0.4936     0.1731 0.004 0.372 0.624 0.000
#> SRR2015771     3  0.3710     0.6365 0.192 0.004 0.804 0.000
#> SRR2015769     2  0.4925     0.4154 0.000 0.572 0.428 0.000
#> SRR2015770     3  0.4972    -0.1549 0.000 0.456 0.544 0.000
#> SRR2015768     2  0.5105     0.4099 0.004 0.564 0.432 0.000
#> SRR2015767     4  0.0188     0.8548 0.004 0.000 0.000 0.996
#> SRR2015766     3  0.0844     0.7440 0.004 0.004 0.980 0.012
#> SRR2015764     3  0.4761     0.1695 0.000 0.372 0.628 0.000
#> SRR2015765     3  0.4051     0.5247 0.004 0.208 0.784 0.004
#> SRR2015763     3  0.3610     0.6325 0.200 0.000 0.800 0.000
#> SRR2015762     3  0.6121     0.2696 0.000 0.060 0.588 0.352
#> SRR2015761     3  0.0376     0.7477 0.004 0.004 0.992 0.000
#> SRR2015760     3  0.0376     0.7477 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
#> SRR2015715     3   0.000    0.73889 0.000 0.000 1.000 0.000 0.000
#> SRR2015735     3   0.665    0.62662 0.136 0.000 0.600 0.060 0.204
#> SRR2015759     1   0.311    0.82924 0.800 0.000 0.200 0.000 0.000
#> SRR2015753     1   0.417    0.80485 0.756 0.000 0.200 0.000 0.044
#> SRR2015746     5   0.201    0.56398 0.060 0.000 0.020 0.000 0.920
#> SRR2015758     2   0.417    0.73786 0.200 0.756 0.044 0.000 0.000
#> SRR2015756     1   0.311    0.82924 0.800 0.000 0.200 0.000 0.000
#> SRR2015757     3   0.369    0.70215 0.200 0.020 0.780 0.000 0.000
#> SRR2015755     1   0.332    0.73238 0.800 0.000 0.008 0.000 0.192
#> SRR2015754     1   0.311    0.72608 0.800 0.000 0.000 0.000 0.200
#> SRR2015752     1   0.311    0.82924 0.800 0.000 0.200 0.000 0.000
#> SRR2015749     1   0.311    0.82924 0.800 0.000 0.200 0.000 0.000
#> SRR2015750     2   0.311    0.77055 0.200 0.800 0.000 0.000 0.000
#> SRR2015751     1   0.609   -0.17261 0.552 0.000 0.160 0.000 0.288
#> SRR2015748     5   0.141    0.56148 0.060 0.000 0.000 0.000 0.940
#> SRR2015747     1   0.311    0.82924 0.800 0.000 0.200 0.000 0.000
#> SRR2015745     5   0.553    0.65515 0.200 0.152 0.000 0.000 0.648
#> SRR2015743     1   0.339    0.71242 0.800 0.188 0.012 0.000 0.000
#> SRR2015744     5   0.201    0.56398 0.060 0.000 0.020 0.000 0.920
#> SRR2015742     1   0.376    0.39328 0.772 0.000 0.020 0.000 0.208
#> SRR2015741     1   0.311    0.72608 0.800 0.000 0.000 0.000 0.200
#> SRR2015740     1   0.311    0.82924 0.800 0.000 0.200 0.000 0.000
#> SRR2015738     1   0.311    0.72608 0.800 0.000 0.000 0.000 0.200
#> SRR2015739     1   0.311    0.82924 0.800 0.000 0.200 0.000 0.000
#> SRR2015737     2   0.311    0.77055 0.200 0.800 0.000 0.000 0.000
#> SRR2015736     3   0.311    0.71199 0.200 0.000 0.800 0.000 0.000
#> SRR2015732     3   0.000    0.73889 0.000 0.000 1.000 0.000 0.000
#> SRR2015733     3   0.631    0.53366 0.012 0.220 0.580 0.188 0.000
#> SRR2015734     3   0.000    0.73889 0.000 0.000 1.000 0.000 0.000
#> SRR2015731     3   0.523    0.61756 0.000 0.000 0.600 0.060 0.340
#> SRR2015730     3   0.273    0.63353 0.160 0.000 0.840 0.000 0.000
#> SRR2015728     3   0.311    0.71199 0.200 0.000 0.800 0.000 0.000
#> SRR2015729     2   0.000    0.69337 0.000 1.000 0.000 0.000 0.000
#> SRR2015727     3   0.523    0.61756 0.000 0.000 0.600 0.060 0.340
#> SRR2015726     3   0.000    0.73889 0.000 0.000 1.000 0.000 0.000
#> SRR2015723     3   0.363    0.70814 0.012 0.216 0.772 0.000 0.000
#> SRR2015724     3   0.000    0.73889 0.000 0.000 1.000 0.000 0.000
#> SRR2015725     3   0.273    0.63353 0.160 0.000 0.840 0.000 0.000
#> SRR2015722     4   0.454    0.50868 0.000 0.000 0.020 0.640 0.340
#> SRR2015721     3   0.332    0.71611 0.192 0.000 0.800 0.000 0.008
#> SRR2015720     3   0.311    0.71199 0.200 0.000 0.800 0.000 0.000
#> SRR2015718     3   0.327    0.70918 0.000 0.220 0.780 0.000 0.000
#> SRR2015719     4   0.000    0.89209 0.000 0.000 0.000 1.000 0.000
#> SRR2015717     3   0.350    0.72385 0.000 0.000 0.788 0.012 0.200
#> SRR2015716     3   0.360    0.71455 0.016 0.200 0.784 0.000 0.000
#> SRR2015714     4   0.000    0.89209 0.000 0.000 0.000 1.000 0.000
#> SRR2015713     3   0.455    0.66596 0.200 0.068 0.732 0.000 0.000
#> SRR2015784     5   0.560    0.64945 0.200 0.160 0.000 0.000 0.640
#> SRR2015785     5   0.553    0.65515 0.200 0.152 0.000 0.000 0.648
#> SRR2015783     1   0.311    0.82924 0.800 0.000 0.200 0.000 0.000
#> SRR2015782     5   0.560    0.64945 0.200 0.160 0.000 0.000 0.640
#> SRR2015781     5   0.492    0.49191 0.000 0.048 0.000 0.308 0.644
#> SRR2015780     5   0.357    0.65820 0.036 0.152 0.000 0.000 0.812
#> SRR2015779     5   0.566    0.57978 0.000 0.152 0.000 0.220 0.628
#> SRR2015778     5   0.388    0.66502 0.224 0.000 0.020 0.000 0.756
#> SRR2015777     5   0.563    0.58806 0.204 0.000 0.160 0.000 0.636
#> SRR2015776     4   0.000    0.89209 0.000 0.000 0.000 1.000 0.000
#> SRR2015775     2   0.000    0.69337 0.000 1.000 0.000 0.000 0.000
#> SRR2015774     3   0.556    0.65261 0.000 0.156 0.644 0.000 0.200
#> SRR2015773     2   0.655   -0.00402 0.200 0.424 0.376 0.000 0.000
#> SRR2015772     3   0.623    0.43867 0.200 0.256 0.544 0.000 0.000
#> SRR2015771     3   0.223    0.73966 0.000 0.116 0.884 0.000 0.000
#> SRR2015769     2   0.000    0.69337 0.000 1.000 0.000 0.000 0.000
#> SRR2015770     2   0.311    0.77055 0.200 0.800 0.000 0.000 0.000
#> SRR2015768     2   0.311    0.77055 0.200 0.800 0.000 0.000 0.000
#> SRR2015767     4   0.000    0.89209 0.000 0.000 0.000 1.000 0.000
#> SRR2015766     3   0.523    0.61756 0.000 0.000 0.600 0.060 0.340
#> SRR2015764     3   0.610    0.47832 0.200 0.232 0.568 0.000 0.000
#> SRR2015765     3   0.573    0.63765 0.000 0.176 0.624 0.000 0.200
#> SRR2015763     3   0.000    0.73889 0.000 0.000 1.000 0.000 0.000
#> SRR2015762     3   0.543    0.41266 0.000 0.060 0.516 0.424 0.000
#> SRR2015761     3   0.604    0.63839 0.160 0.140 0.660 0.000 0.040
#> SRR2015760     3   0.311    0.72605 0.000 0.000 0.800 0.000 0.200

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>            class entropy silhouette    p1    p2    p3    p4    p5    p6
#> SRR2015715     6  0.2664      0.763 0.136 0.000 0.000 0.000 0.016 0.848
#> SRR2015735     3  0.1327      0.755 0.000 0.000 0.936 0.000 0.000 0.064
#> SRR2015759     1  0.0000      0.867 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2015753     1  0.2912      0.650 0.784 0.000 0.000 0.000 0.216 0.000
#> SRR2015746     5  0.4121      0.659 0.000 0.000 0.116 0.000 0.748 0.136
#> SRR2015758     2  0.4223      0.777 0.000 0.720 0.000 0.000 0.076 0.204
#> SRR2015756     1  0.0000      0.867 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2015757     6  0.0260      0.757 0.000 0.000 0.000 0.000 0.008 0.992
#> SRR2015755     1  0.3453      0.774 0.804 0.000 0.132 0.000 0.000 0.064
#> SRR2015754     1  0.3801      0.766 0.792 0.000 0.132 0.000 0.012 0.064
#> SRR2015752     1  0.1471      0.853 0.932 0.000 0.064 0.000 0.004 0.000
#> SRR2015749     1  0.0000      0.867 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2015750     2  0.3544      0.846 0.000 0.800 0.000 0.000 0.080 0.120
#> SRR2015751     5  0.5161      0.573 0.068 0.000 0.012 0.000 0.568 0.352
#> SRR2015748     5  0.3384      0.654 0.000 0.000 0.120 0.000 0.812 0.068
#> SRR2015747     1  0.0000      0.867 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2015745     5  0.4277      0.677 0.000 0.144 0.000 0.000 0.732 0.124
#> SRR2015743     1  0.1007      0.854 0.956 0.044 0.000 0.000 0.000 0.000
#> SRR2015744     5  0.4032      0.621 0.000 0.000 0.192 0.000 0.740 0.068
#> SRR2015742     1  0.5856      0.552 0.628 0.000 0.108 0.000 0.084 0.180
#> SRR2015741     1  0.3493      0.771 0.800 0.000 0.136 0.000 0.000 0.064
#> SRR2015740     1  0.1471      0.853 0.932 0.000 0.064 0.000 0.004 0.000
#> SRR2015738     1  0.3719      0.774 0.800 0.000 0.124 0.000 0.012 0.064
#> SRR2015739     1  0.0000      0.867 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2015737     2  0.3432      0.862 0.000 0.800 0.000 0.000 0.148 0.052
#> SRR2015736     6  0.0000      0.757 0.000 0.000 0.000 0.000 0.000 1.000
#> SRR2015732     6  0.3200      0.743 0.196 0.000 0.000 0.000 0.016 0.788
#> SRR2015733     6  0.5015      0.628 0.000 0.168 0.000 0.064 0.064 0.704
#> SRR2015734     6  0.3231      0.740 0.200 0.000 0.000 0.000 0.016 0.784
#> SRR2015731     3  0.1745      0.755 0.000 0.000 0.920 0.000 0.012 0.068
#> SRR2015730     6  0.4723      0.626 0.296 0.000 0.064 0.000 0.004 0.636
#> SRR2015728     3  0.3817      0.559 0.000 0.000 0.568 0.000 0.000 0.432
#> SRR2015729     2  0.1411      0.843 0.000 0.936 0.000 0.000 0.060 0.004
#> SRR2015727     3  0.1387      0.757 0.000 0.000 0.932 0.000 0.000 0.068
#> SRR2015726     6  0.2531      0.763 0.132 0.000 0.012 0.000 0.000 0.856
#> SRR2015723     6  0.2833      0.747 0.004 0.148 0.012 0.000 0.000 0.836
#> SRR2015724     6  0.2755      0.766 0.120 0.012 0.012 0.000 0.000 0.856
#> SRR2015725     6  0.3659      0.616 0.364 0.000 0.000 0.000 0.000 0.636
#> SRR2015722     3  0.4802      0.509 0.000 0.000 0.660 0.260 0.012 0.068
#> SRR2015721     6  0.0891      0.756 0.000 0.000 0.024 0.000 0.008 0.968
#> SRR2015720     6  0.0000      0.757 0.000 0.000 0.000 0.000 0.000 1.000
#> SRR2015718     6  0.2613      0.749 0.000 0.140 0.012 0.000 0.000 0.848
#> SRR2015719     4  0.0000      1.000 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR2015717     3  0.2416      0.741 0.000 0.000 0.844 0.000 0.000 0.156
#> SRR2015716     6  0.3015      0.753 0.024 0.120 0.012 0.000 0.000 0.844
#> SRR2015714     4  0.0000      1.000 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR2015713     6  0.0000      0.757 0.000 0.000 0.000 0.000 0.000 1.000
#> SRR2015784     5  0.3542      0.664 0.000 0.160 0.000 0.000 0.788 0.052
#> SRR2015785     5  0.3172      0.676 0.000 0.148 0.000 0.000 0.816 0.036
#> SRR2015783     1  0.0000      0.867 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2015782     5  0.3752      0.668 0.000 0.164 0.000 0.000 0.772 0.064
#> SRR2015781     5  0.3872      0.599 0.000 0.020 0.000 0.264 0.712 0.004
#> SRR2015780     5  0.2949      0.688 0.000 0.140 0.000 0.000 0.832 0.028
#> SRR2015779     5  0.4492      0.647 0.000 0.080 0.000 0.216 0.700 0.004
#> SRR2015778     5  0.4156      0.685 0.000 0.000 0.080 0.000 0.732 0.188
#> SRR2015777     5  0.3953      0.637 0.000 0.000 0.016 0.000 0.656 0.328
#> SRR2015776     4  0.0000      1.000 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR2015775     2  0.0865      0.793 0.000 0.964 0.000 0.000 0.000 0.036
#> SRR2015774     6  0.4860      0.687 0.000 0.164 0.048 0.000 0.072 0.716
#> SRR2015773     6  0.5277      0.448 0.000 0.256 0.000 0.000 0.152 0.592
#> SRR2015772     6  0.5032      0.524 0.000 0.216 0.000 0.000 0.148 0.636
#> SRR2015771     6  0.3124      0.769 0.096 0.040 0.000 0.000 0.016 0.848
#> SRR2015769     2  0.0000      0.801 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2015770     2  0.3522      0.865 0.000 0.800 0.000 0.000 0.128 0.072
#> SRR2015768     2  0.3432      0.862 0.000 0.800 0.000 0.000 0.148 0.052
#> SRR2015767     4  0.0000      1.000 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR2015766     3  0.1926      0.754 0.000 0.000 0.912 0.000 0.020 0.068
#> SRR2015764     6  0.4044      0.605 0.000 0.180 0.000 0.000 0.076 0.744
#> SRR2015765     6  0.5504      0.647 0.000 0.172 0.060 0.000 0.108 0.660
#> SRR2015763     6  0.3183      0.742 0.200 0.000 0.004 0.000 0.008 0.788
#> SRR2015762     3  0.7225      0.178 0.000 0.020 0.428 0.296 0.064 0.192
#> SRR2015761     6  0.5337      0.642 0.000 0.156 0.104 0.000 0.060 0.680
#> SRR2015760     3  0.4034      0.625 0.000 0.000 0.652 0.000 0.020 0.328

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

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 17223 rows and 73 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.943           0.965       0.983         0.4873 0.514   0.514
#> 3 3 0.754           0.749       0.893         0.2602 0.734   0.548
#> 4 4 0.659           0.725       0.873         0.1726 0.720   0.410
#> 5 5 0.672           0.713       0.853         0.0739 0.806   0.434
#> 6 6 0.657           0.615       0.798         0.0307 0.860   0.507

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
#> SRR2015715     1  0.0000      0.978 1.000 0.000
#> SRR2015735     1  0.0000      0.978 1.000 0.000
#> SRR2015759     1  0.0000      0.978 1.000 0.000
#> SRR2015753     1  0.0000      0.978 1.000 0.000
#> SRR2015746     1  0.0376      0.976 0.996 0.004
#> SRR2015758     2  0.0000      0.986 0.000 1.000
#> SRR2015756     1  0.0000      0.978 1.000 0.000
#> SRR2015757     1  0.0000      0.978 1.000 0.000
#> SRR2015755     1  0.0000      0.978 1.000 0.000
#> SRR2015754     1  0.0000      0.978 1.000 0.000
#> SRR2015752     1  0.0000      0.978 1.000 0.000
#> SRR2015749     1  0.0000      0.978 1.000 0.000
#> SRR2015750     2  0.0000      0.986 0.000 1.000
#> SRR2015751     1  0.0000      0.978 1.000 0.000
#> SRR2015748     2  0.7376      0.732 0.208 0.792
#> SRR2015747     1  0.0000      0.978 1.000 0.000
#> SRR2015745     2  0.0000      0.986 0.000 1.000
#> SRR2015743     1  0.0000      0.978 1.000 0.000
#> SRR2015744     1  0.6531      0.818 0.832 0.168
#> SRR2015742     1  0.4562      0.901 0.904 0.096
#> SRR2015741     1  0.0000      0.978 1.000 0.000
#> SRR2015740     1  0.0000      0.978 1.000 0.000
#> SRR2015738     1  0.0000      0.978 1.000 0.000
#> SRR2015739     1  0.0000      0.978 1.000 0.000
#> SRR2015737     2  0.0000      0.986 0.000 1.000
#> SRR2015736     1  0.0000      0.978 1.000 0.000
#> SRR2015732     1  0.0000      0.978 1.000 0.000
#> SRR2015733     2  0.0000      0.986 0.000 1.000
#> SRR2015734     1  0.0000      0.978 1.000 0.000
#> SRR2015731     1  0.6048      0.845 0.852 0.148
#> SRR2015730     1  0.0000      0.978 1.000 0.000
#> SRR2015728     1  0.0000      0.978 1.000 0.000
#> SRR2015729     2  0.0000      0.986 0.000 1.000
#> SRR2015727     1  0.6712      0.808 0.824 0.176
#> SRR2015726     1  0.0000      0.978 1.000 0.000
#> SRR2015723     1  0.0000      0.978 1.000 0.000
#> SRR2015724     1  0.0000      0.978 1.000 0.000
#> SRR2015725     1  0.0000      0.978 1.000 0.000
#> SRR2015722     1  0.4815      0.893 0.896 0.104
#> SRR2015721     1  0.0376      0.976 0.996 0.004
#> SRR2015720     1  0.0000      0.978 1.000 0.000
#> SRR2015718     1  0.1184      0.968 0.984 0.016
#> SRR2015719     2  0.0000      0.986 0.000 1.000
#> SRR2015717     1  0.0000      0.978 1.000 0.000
#> SRR2015716     1  0.0000      0.978 1.000 0.000
#> SRR2015714     2  0.0000      0.986 0.000 1.000
#> SRR2015713     1  0.4562      0.896 0.904 0.096
#> SRR2015784     2  0.0000      0.986 0.000 1.000
#> SRR2015785     2  0.0000      0.986 0.000 1.000
#> SRR2015783     1  0.0000      0.978 1.000 0.000
#> SRR2015782     2  0.0000      0.986 0.000 1.000
#> SRR2015781     2  0.0000      0.986 0.000 1.000
#> SRR2015780     2  0.0000      0.986 0.000 1.000
#> SRR2015779     2  0.0000      0.986 0.000 1.000
#> SRR2015778     1  0.4298      0.908 0.912 0.088
#> SRR2015777     1  0.0938      0.971 0.988 0.012
#> SRR2015776     2  0.0000      0.986 0.000 1.000
#> SRR2015775     2  0.0000      0.986 0.000 1.000
#> SRR2015774     2  0.0000      0.986 0.000 1.000
#> SRR2015773     2  0.0000      0.986 0.000 1.000
#> SRR2015772     2  0.0000      0.986 0.000 1.000
#> SRR2015771     1  0.0000      0.978 1.000 0.000
#> SRR2015769     2  0.0000      0.986 0.000 1.000
#> SRR2015770     2  0.0000      0.986 0.000 1.000
#> SRR2015768     2  0.0000      0.986 0.000 1.000
#> SRR2015767     2  0.0000      0.986 0.000 1.000
#> SRR2015766     2  0.6247      0.811 0.156 0.844
#> SRR2015764     2  0.0000      0.986 0.000 1.000
#> SRR2015765     2  0.0000      0.986 0.000 1.000
#> SRR2015763     1  0.0000      0.978 1.000 0.000
#> SRR2015762     2  0.0000      0.986 0.000 1.000
#> SRR2015761     2  0.0000      0.986 0.000 1.000
#> SRR2015760     1  0.0000      0.978 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
#> SRR2015715     1  0.2486     0.8889 0.932 0.060 0.008
#> SRR2015735     1  0.0592     0.9244 0.988 0.000 0.012
#> SRR2015759     1  0.0424     0.9247 0.992 0.000 0.008
#> SRR2015753     1  0.0892     0.9245 0.980 0.000 0.020
#> SRR2015746     1  0.1031     0.9233 0.976 0.000 0.024
#> SRR2015758     2  0.0424     0.7842 0.000 0.992 0.008
#> SRR2015756     1  0.0892     0.9245 0.980 0.000 0.020
#> SRR2015757     2  0.6513     0.3708 0.400 0.592 0.008
#> SRR2015755     1  0.1031     0.9233 0.976 0.000 0.024
#> SRR2015754     1  0.1031     0.9233 0.976 0.000 0.024
#> SRR2015752     1  0.0000     0.9239 1.000 0.000 0.000
#> SRR2015749     1  0.0892     0.9245 0.980 0.000 0.020
#> SRR2015750     2  0.0000     0.7848 0.000 1.000 0.000
#> SRR2015751     1  0.0892     0.9245 0.980 0.000 0.020
#> SRR2015748     3  0.1163     0.8605 0.028 0.000 0.972
#> SRR2015747     1  0.0892     0.9245 0.980 0.000 0.020
#> SRR2015745     2  0.6888     0.1412 0.016 0.552 0.432
#> SRR2015743     1  0.0892     0.9245 0.980 0.000 0.020
#> SRR2015744     1  0.1860     0.9081 0.948 0.000 0.052
#> SRR2015742     1  0.1289     0.9198 0.968 0.000 0.032
#> SRR2015741     1  0.1031     0.9233 0.976 0.000 0.024
#> SRR2015740     1  0.0237     0.9232 0.996 0.000 0.004
#> SRR2015738     1  0.1031     0.9233 0.976 0.000 0.024
#> SRR2015739     1  0.0892     0.9245 0.980 0.000 0.020
#> SRR2015737     2  0.0892     0.7806 0.000 0.980 0.020
#> SRR2015736     2  0.6654     0.2195 0.456 0.536 0.008
#> SRR2015732     1  0.1711     0.9108 0.960 0.032 0.008
#> SRR2015733     2  0.4555     0.6462 0.000 0.800 0.200
#> SRR2015734     1  0.1585     0.9131 0.964 0.028 0.008
#> SRR2015731     1  0.7268     0.0981 0.524 0.028 0.448
#> SRR2015730     1  0.0848     0.9205 0.984 0.008 0.008
#> SRR2015728     1  0.1015     0.9195 0.980 0.012 0.008
#> SRR2015729     2  0.0000     0.7848 0.000 1.000 0.000
#> SRR2015727     3  0.6627     0.4514 0.336 0.020 0.644
#> SRR2015726     1  0.1453     0.9150 0.968 0.024 0.008
#> SRR2015723     2  0.5831     0.5580 0.284 0.708 0.008
#> SRR2015724     2  0.6513     0.3739 0.400 0.592 0.008
#> SRR2015725     1  0.1170     0.9182 0.976 0.016 0.008
#> SRR2015722     3  0.1753     0.8487 0.048 0.000 0.952
#> SRR2015721     1  0.6682    -0.1070 0.504 0.488 0.008
#> SRR2015720     2  0.6654     0.2203 0.456 0.536 0.008
#> SRR2015718     2  0.2680     0.7545 0.068 0.924 0.008
#> SRR2015719     3  0.1289     0.8824 0.000 0.032 0.968
#> SRR2015717     1  0.1315     0.9167 0.972 0.020 0.008
#> SRR2015716     1  0.1453     0.9150 0.968 0.024 0.008
#> SRR2015714     3  0.1289     0.8824 0.000 0.032 0.968
#> SRR2015713     2  0.3454     0.7308 0.104 0.888 0.008
#> SRR2015784     2  0.2537     0.7440 0.000 0.920 0.080
#> SRR2015785     2  0.6309    -0.0839 0.000 0.504 0.496
#> SRR2015783     1  0.0747     0.9248 0.984 0.000 0.016
#> SRR2015782     2  0.2066     0.7693 0.000 0.940 0.060
#> SRR2015781     3  0.1163     0.8815 0.000 0.028 0.972
#> SRR2015780     3  0.5397     0.5736 0.000 0.280 0.720
#> SRR2015779     2  0.5882     0.3513 0.000 0.652 0.348
#> SRR2015778     1  0.3412     0.8398 0.876 0.000 0.124
#> SRR2015777     1  0.1129     0.9238 0.976 0.004 0.020
#> SRR2015776     3  0.1289     0.8824 0.000 0.032 0.968
#> SRR2015775     2  0.1015     0.7786 0.012 0.980 0.008
#> SRR2015774     2  0.0000     0.7848 0.000 1.000 0.000
#> SRR2015773     2  0.0424     0.7842 0.000 0.992 0.008
#> SRR2015772     2  0.0592     0.7833 0.000 0.988 0.012
#> SRR2015771     1  0.2486     0.8889 0.932 0.060 0.008
#> SRR2015769     2  0.0000     0.7848 0.000 1.000 0.000
#> SRR2015770     2  0.0892     0.7806 0.000 0.980 0.020
#> SRR2015768     2  0.1031     0.7788 0.000 0.976 0.024
#> SRR2015767     3  0.1289     0.8824 0.000 0.032 0.968
#> SRR2015766     1  0.9267     0.0193 0.460 0.160 0.380
#> SRR2015764     2  0.0000     0.7848 0.000 1.000 0.000
#> SRR2015765     2  0.1163     0.7769 0.000 0.972 0.028
#> SRR2015763     1  0.1711     0.9108 0.960 0.032 0.008
#> SRR2015762     2  0.4974     0.6243 0.000 0.764 0.236
#> SRR2015761     2  0.5167     0.6648 0.024 0.804 0.172
#> SRR2015760     1  0.1711     0.9108 0.960 0.032 0.008

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> SRR2015715     3  0.0188     0.8042 0.004 0.000 0.996 0.000
#> SRR2015735     3  0.4888     0.2330 0.412 0.000 0.588 0.000
#> SRR2015759     1  0.4103     0.7305 0.744 0.000 0.256 0.000
#> SRR2015753     1  0.2216     0.8808 0.908 0.000 0.092 0.000
#> SRR2015746     1  0.0592     0.8792 0.984 0.000 0.016 0.000
#> SRR2015758     2  0.1624     0.8383 0.028 0.952 0.020 0.000
#> SRR2015756     1  0.1637     0.8897 0.940 0.000 0.060 0.000
#> SRR2015757     3  0.1510     0.7847 0.028 0.016 0.956 0.000
#> SRR2015755     1  0.1022     0.8855 0.968 0.000 0.032 0.000
#> SRR2015754     1  0.1389     0.8890 0.952 0.000 0.048 0.000
#> SRR2015752     1  0.4406     0.6568 0.700 0.000 0.300 0.000
#> SRR2015749     1  0.1474     0.8897 0.948 0.000 0.052 0.000
#> SRR2015750     2  0.1109     0.8423 0.028 0.968 0.004 0.000
#> SRR2015751     1  0.0188     0.8719 0.996 0.000 0.004 0.000
#> SRR2015748     1  0.4485     0.6567 0.772 0.028 0.000 0.200
#> SRR2015747     1  0.1118     0.8869 0.964 0.000 0.036 0.000
#> SRR2015745     2  0.4948     0.3668 0.440 0.560 0.000 0.000
#> SRR2015743     1  0.3444     0.8161 0.816 0.000 0.184 0.000
#> SRR2015744     1  0.1022     0.8855 0.968 0.000 0.032 0.000
#> SRR2015742     1  0.0000     0.8692 1.000 0.000 0.000 0.000
#> SRR2015741     1  0.2345     0.8780 0.900 0.000 0.100 0.000
#> SRR2015740     1  0.4564     0.5986 0.672 0.000 0.328 0.000
#> SRR2015738     1  0.2149     0.8827 0.912 0.000 0.088 0.000
#> SRR2015739     1  0.2814     0.8603 0.868 0.000 0.132 0.000
#> SRR2015737     2  0.0469     0.8435 0.012 0.988 0.000 0.000
#> SRR2015736     3  0.0000     0.8030 0.000 0.000 1.000 0.000
#> SRR2015732     3  0.3074     0.7260 0.152 0.000 0.848 0.000
#> SRR2015733     3  0.7806     0.2835 0.048 0.268 0.560 0.124
#> SRR2015734     3  0.0817     0.8026 0.024 0.000 0.976 0.000
#> SRR2015731     3  0.4188     0.5899 0.004 0.000 0.752 0.244
#> SRR2015730     3  0.4955     0.1168 0.444 0.000 0.556 0.000
#> SRR2015728     3  0.0469     0.8044 0.012 0.000 0.988 0.000
#> SRR2015729     2  0.0000     0.8409 0.000 1.000 0.000 0.000
#> SRR2015727     4  0.4304     0.4859 0.000 0.000 0.284 0.716
#> SRR2015726     3  0.4679     0.4049 0.352 0.000 0.648 0.000
#> SRR2015723     3  0.4227     0.7331 0.120 0.060 0.820 0.000
#> SRR2015724     3  0.0188     0.8042 0.004 0.000 0.996 0.000
#> SRR2015725     3  0.4522     0.4729 0.320 0.000 0.680 0.000
#> SRR2015722     4  0.0188     0.8239 0.004 0.000 0.000 0.996
#> SRR2015721     3  0.0000     0.8030 0.000 0.000 1.000 0.000
#> SRR2015720     3  0.1356     0.7898 0.032 0.008 0.960 0.000
#> SRR2015718     3  0.1890     0.7878 0.008 0.056 0.936 0.000
#> SRR2015719     4  0.0000     0.8251 0.000 0.000 0.000 1.000
#> SRR2015717     3  0.0817     0.8026 0.024 0.000 0.976 0.000
#> SRR2015716     3  0.4605     0.4396 0.336 0.000 0.664 0.000
#> SRR2015714     4  0.0000     0.8251 0.000 0.000 0.000 1.000
#> SRR2015713     3  0.3707     0.6877 0.028 0.132 0.840 0.000
#> SRR2015784     2  0.0921     0.8428 0.028 0.972 0.000 0.000
#> SRR2015785     2  0.0672     0.8373 0.008 0.984 0.000 0.008
#> SRR2015783     1  0.3764     0.7834 0.784 0.000 0.216 0.000
#> SRR2015782     2  0.4500     0.5483 0.316 0.684 0.000 0.000
#> SRR2015781     4  0.6009     0.0432 0.040 0.468 0.000 0.492
#> SRR2015780     2  0.3647     0.7065 0.152 0.832 0.000 0.016
#> SRR2015779     2  0.1004     0.8432 0.024 0.972 0.000 0.004
#> SRR2015778     1  0.0000     0.8692 1.000 0.000 0.000 0.000
#> SRR2015777     1  0.0188     0.8686 0.996 0.004 0.000 0.000
#> SRR2015776     4  0.0188     0.8238 0.000 0.004 0.000 0.996
#> SRR2015775     2  0.0921     0.8308 0.000 0.972 0.028 0.000
#> SRR2015774     3  0.4690     0.5444 0.000 0.260 0.724 0.016
#> SRR2015773     2  0.1284     0.8429 0.024 0.964 0.012 0.000
#> SRR2015772     2  0.4194     0.6179 0.008 0.764 0.228 0.000
#> SRR2015771     3  0.0592     0.8039 0.016 0.000 0.984 0.000
#> SRR2015769     2  0.0000     0.8409 0.000 1.000 0.000 0.000
#> SRR2015770     2  0.1109     0.8423 0.028 0.968 0.004 0.000
#> SRR2015768     2  0.0000     0.8409 0.000 1.000 0.000 0.000
#> SRR2015767     4  0.0000     0.8251 0.000 0.000 0.000 1.000
#> SRR2015766     3  0.2469     0.7361 0.000 0.000 0.892 0.108
#> SRR2015764     2  0.5708     0.2880 0.028 0.556 0.416 0.000
#> SRR2015765     2  0.4088     0.6946 0.000 0.820 0.140 0.040
#> SRR2015763     3  0.0188     0.8042 0.004 0.000 0.996 0.000
#> SRR2015762     4  0.5484     0.5385 0.032 0.272 0.008 0.688
#> SRR2015761     3  0.4676     0.6670 0.012 0.076 0.812 0.100
#> SRR2015760     3  0.0188     0.8042 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
#> SRR2015715     3  0.0771     0.8527 0.004 0.020 0.976 0.000 0.000
#> SRR2015735     3  0.2077     0.8486 0.084 0.008 0.908 0.000 0.000
#> SRR2015759     3  0.4242     0.1762 0.428 0.000 0.572 0.000 0.000
#> SRR2015753     1  0.2424     0.7888 0.868 0.000 0.132 0.000 0.000
#> SRR2015746     1  0.0162     0.8068 0.996 0.004 0.000 0.000 0.000
#> SRR2015758     2  0.1892     0.7323 0.000 0.916 0.004 0.000 0.080
#> SRR2015756     1  0.3550     0.6883 0.760 0.004 0.236 0.000 0.000
#> SRR2015757     2  0.2536     0.7497 0.004 0.868 0.128 0.000 0.000
#> SRR2015755     1  0.1671     0.8122 0.924 0.000 0.076 0.000 0.000
#> SRR2015754     1  0.2471     0.7906 0.864 0.000 0.136 0.000 0.000
#> SRR2015752     3  0.2773     0.7782 0.164 0.000 0.836 0.000 0.000
#> SRR2015749     1  0.1478     0.8135 0.936 0.000 0.064 0.000 0.000
#> SRR2015750     2  0.3769     0.6257 0.032 0.788 0.000 0.000 0.180
#> SRR2015751     1  0.1168     0.8034 0.960 0.032 0.008 0.000 0.000
#> SRR2015748     1  0.3689     0.7513 0.848 0.012 0.012 0.080 0.048
#> SRR2015747     1  0.2806     0.7780 0.844 0.004 0.152 0.000 0.000
#> SRR2015745     1  0.2905     0.7340 0.868 0.096 0.000 0.000 0.036
#> SRR2015743     3  0.4428     0.5896 0.284 0.004 0.692 0.000 0.020
#> SRR2015744     1  0.0566     0.8091 0.984 0.004 0.012 0.000 0.000
#> SRR2015742     1  0.1626     0.8019 0.940 0.044 0.016 0.000 0.000
#> SRR2015741     1  0.4088     0.4619 0.632 0.000 0.368 0.000 0.000
#> SRR2015740     3  0.2605     0.7965 0.148 0.000 0.852 0.000 0.000
#> SRR2015738     1  0.1851     0.8108 0.912 0.000 0.088 0.000 0.000
#> SRR2015739     1  0.4126     0.4183 0.620 0.000 0.380 0.000 0.000
#> SRR2015737     5  0.3231     0.7601 0.004 0.196 0.000 0.000 0.800
#> SRR2015736     2  0.4249     0.3428 0.000 0.568 0.432 0.000 0.000
#> SRR2015732     3  0.1764     0.8574 0.064 0.008 0.928 0.000 0.000
#> SRR2015733     2  0.2122     0.7581 0.016 0.928 0.040 0.008 0.008
#> SRR2015734     3  0.0798     0.8552 0.008 0.016 0.976 0.000 0.000
#> SRR2015731     4  0.3384     0.7845 0.004 0.060 0.088 0.848 0.000
#> SRR2015730     3  0.1908     0.8425 0.092 0.000 0.908 0.000 0.000
#> SRR2015728     3  0.1653     0.8482 0.004 0.024 0.944 0.000 0.028
#> SRR2015729     5  0.0880     0.8534 0.000 0.032 0.000 0.000 0.968
#> SRR2015727     4  0.4088     0.3774 0.000 0.000 0.368 0.632 0.000
#> SRR2015726     3  0.1792     0.8474 0.084 0.000 0.916 0.000 0.000
#> SRR2015723     3  0.2554     0.8372 0.008 0.020 0.896 0.000 0.076
#> SRR2015724     3  0.2890     0.7236 0.004 0.160 0.836 0.000 0.000
#> SRR2015725     3  0.1478     0.8558 0.064 0.000 0.936 0.000 0.000
#> SRR2015722     4  0.0510     0.8664 0.000 0.016 0.000 0.984 0.000
#> SRR2015721     3  0.3621     0.6546 0.000 0.192 0.788 0.000 0.020
#> SRR2015720     2  0.2731     0.7562 0.016 0.876 0.104 0.000 0.004
#> SRR2015718     3  0.1915     0.8431 0.000 0.032 0.928 0.000 0.040
#> SRR2015719     4  0.0162     0.8724 0.000 0.000 0.000 0.996 0.004
#> SRR2015717     3  0.0579     0.8578 0.008 0.008 0.984 0.000 0.000
#> SRR2015716     3  0.2321     0.8533 0.056 0.008 0.912 0.000 0.024
#> SRR2015714     4  0.0162     0.8724 0.000 0.000 0.000 0.996 0.004
#> SRR2015713     2  0.2286     0.7571 0.000 0.888 0.108 0.000 0.004
#> SRR2015784     5  0.3090     0.8190 0.040 0.104 0.000 0.000 0.856
#> SRR2015785     5  0.1560     0.8485 0.004 0.028 0.000 0.020 0.948
#> SRR2015783     1  0.4307     0.0404 0.500 0.000 0.500 0.000 0.000
#> SRR2015782     1  0.3593     0.6996 0.828 0.088 0.000 0.000 0.084
#> SRR2015781     4  0.4041     0.7440 0.064 0.100 0.000 0.816 0.020
#> SRR2015780     1  0.5548     0.4316 0.640 0.056 0.000 0.024 0.280
#> SRR2015779     5  0.3456     0.7669 0.004 0.204 0.000 0.004 0.788
#> SRR2015778     1  0.1121     0.7961 0.956 0.044 0.000 0.000 0.000
#> SRR2015777     1  0.1357     0.7921 0.948 0.048 0.000 0.000 0.004
#> SRR2015776     4  0.0162     0.8724 0.000 0.000 0.000 0.996 0.004
#> SRR2015775     5  0.1106     0.8528 0.000 0.024 0.012 0.000 0.964
#> SRR2015774     2  0.4325     0.6508 0.000 0.724 0.240 0.000 0.036
#> SRR2015773     2  0.4138     0.5250 0.000 0.708 0.016 0.000 0.276
#> SRR2015772     2  0.3214     0.7309 0.000 0.844 0.036 0.000 0.120
#> SRR2015771     3  0.0000     0.8570 0.000 0.000 1.000 0.000 0.000
#> SRR2015769     5  0.1043     0.8574 0.000 0.040 0.000 0.000 0.960
#> SRR2015770     2  0.4306    -0.1533 0.000 0.508 0.000 0.000 0.492
#> SRR2015768     5  0.1270     0.8565 0.000 0.052 0.000 0.000 0.948
#> SRR2015767     4  0.0162     0.8724 0.000 0.000 0.000 0.996 0.004
#> SRR2015766     3  0.5414     0.0340 0.000 0.060 0.528 0.412 0.000
#> SRR2015764     2  0.1282     0.7455 0.004 0.952 0.000 0.000 0.044
#> SRR2015765     5  0.7426     0.1443 0.000 0.304 0.044 0.220 0.432
#> SRR2015763     3  0.0865     0.8519 0.004 0.024 0.972 0.000 0.000
#> SRR2015762     2  0.1774     0.7377 0.000 0.932 0.000 0.052 0.016
#> SRR2015761     2  0.4350     0.6951 0.000 0.764 0.152 0.084 0.000
#> SRR2015760     3  0.0794     0.8499 0.000 0.028 0.972 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
#> SRR2015715     1  0.3270     0.5151 0.820 0.060 0.120 0.000 0.000 0.000
#> SRR2015735     1  0.1401     0.6881 0.948 0.000 0.020 0.004 0.028 0.000
#> SRR2015759     1  0.2911     0.6803 0.832 0.000 0.024 0.000 0.144 0.000
#> SRR2015753     5  0.4396    -0.0356 0.456 0.000 0.024 0.000 0.520 0.000
#> SRR2015746     5  0.1049     0.8143 0.032 0.000 0.008 0.000 0.960 0.000
#> SRR2015758     2  0.4169     0.6144 0.000 0.752 0.180 0.000 0.020 0.048
#> SRR2015756     1  0.3725     0.5505 0.676 0.000 0.008 0.000 0.316 0.000
#> SRR2015757     2  0.2009     0.6787 0.024 0.908 0.068 0.000 0.000 0.000
#> SRR2015755     5  0.3265     0.5913 0.248 0.000 0.004 0.000 0.748 0.000
#> SRR2015754     1  0.4247     0.5519 0.664 0.000 0.040 0.000 0.296 0.000
#> SRR2015752     1  0.1701     0.7046 0.920 0.000 0.008 0.000 0.072 0.000
#> SRR2015749     1  0.4439     0.2814 0.540 0.000 0.028 0.000 0.432 0.000
#> SRR2015750     2  0.5770     0.3522 0.000 0.564 0.108 0.000 0.032 0.296
#> SRR2015751     5  0.1760     0.8185 0.020 0.012 0.028 0.000 0.936 0.004
#> SRR2015748     5  0.3617     0.7609 0.004 0.000 0.088 0.032 0.828 0.048
#> SRR2015747     1  0.4205     0.3315 0.564 0.000 0.016 0.000 0.420 0.000
#> SRR2015745     5  0.2213     0.7880 0.000 0.012 0.032 0.000 0.908 0.048
#> SRR2015743     1  0.1967     0.7050 0.904 0.000 0.012 0.000 0.084 0.000
#> SRR2015744     5  0.2474     0.7877 0.080 0.000 0.040 0.000 0.880 0.000
#> SRR2015742     5  0.3564     0.7799 0.032 0.072 0.068 0.000 0.828 0.000
#> SRR2015741     1  0.3385     0.6593 0.788 0.000 0.032 0.000 0.180 0.000
#> SRR2015740     1  0.2019     0.7017 0.900 0.000 0.012 0.000 0.088 0.000
#> SRR2015738     1  0.4769     0.4134 0.576 0.000 0.060 0.000 0.364 0.000
#> SRR2015739     1  0.3782     0.4726 0.636 0.000 0.004 0.000 0.360 0.000
#> SRR2015737     6  0.3924     0.6416 0.000 0.208 0.052 0.000 0.000 0.740
#> SRR2015736     2  0.4671     0.3748 0.160 0.688 0.152 0.000 0.000 0.000
#> SRR2015732     1  0.1692     0.6948 0.932 0.008 0.048 0.000 0.012 0.000
#> SRR2015733     2  0.1781     0.6833 0.008 0.924 0.060 0.000 0.008 0.000
#> SRR2015734     1  0.3094     0.5269 0.824 0.036 0.140 0.000 0.000 0.000
#> SRR2015731     4  0.4281     0.7609 0.028 0.076 0.072 0.796 0.028 0.000
#> SRR2015730     1  0.0717     0.6962 0.976 0.000 0.008 0.000 0.016 0.000
#> SRR2015728     3  0.4204     0.4660 0.448 0.008 0.540 0.000 0.004 0.000
#> SRR2015729     6  0.0692     0.8468 0.000 0.000 0.020 0.000 0.004 0.976
#> SRR2015727     4  0.3565     0.7250 0.112 0.000 0.056 0.816 0.016 0.000
#> SRR2015726     1  0.1010     0.6916 0.960 0.004 0.036 0.000 0.000 0.000
#> SRR2015723     1  0.3163     0.5344 0.820 0.000 0.040 0.000 0.000 0.140
#> SRR2015724     2  0.5978    -0.2502 0.364 0.472 0.148 0.000 0.000 0.016
#> SRR2015725     1  0.1668     0.6735 0.928 0.004 0.060 0.000 0.008 0.000
#> SRR2015722     4  0.2135     0.8123 0.012 0.004 0.044 0.916 0.024 0.000
#> SRR2015721     3  0.5673     0.1335 0.160 0.372 0.468 0.000 0.000 0.000
#> SRR2015720     2  0.1340     0.6765 0.008 0.948 0.040 0.000 0.004 0.000
#> SRR2015718     3  0.6267     0.5724 0.380 0.044 0.452 0.000 0.000 0.124
#> SRR2015719     4  0.0146     0.8262 0.000 0.000 0.004 0.996 0.000 0.000
#> SRR2015717     1  0.2237     0.6289 0.896 0.020 0.080 0.004 0.000 0.000
#> SRR2015716     1  0.1285     0.6729 0.944 0.000 0.052 0.000 0.000 0.004
#> SRR2015714     4  0.0146     0.8265 0.000 0.000 0.004 0.996 0.000 0.000
#> SRR2015713     2  0.1578     0.6721 0.012 0.936 0.048 0.000 0.000 0.004
#> SRR2015784     6  0.5792     0.6977 0.000 0.064 0.180 0.024 0.072 0.660
#> SRR2015785     6  0.1173     0.8452 0.000 0.000 0.008 0.016 0.016 0.960
#> SRR2015783     1  0.2669     0.6799 0.836 0.000 0.008 0.000 0.156 0.000
#> SRR2015782     5  0.3574     0.7369 0.000 0.032 0.048 0.000 0.824 0.096
#> SRR2015781     4  0.6510     0.4705 0.000 0.172 0.212 0.552 0.052 0.012
#> SRR2015780     5  0.3489     0.6832 0.000 0.004 0.024 0.008 0.800 0.164
#> SRR2015779     6  0.6351     0.6266 0.000 0.112 0.188 0.064 0.028 0.608
#> SRR2015778     5  0.0909     0.8178 0.020 0.000 0.012 0.000 0.968 0.000
#> SRR2015777     5  0.1700     0.8169 0.012 0.024 0.028 0.000 0.936 0.000
#> SRR2015776     4  0.1531     0.8109 0.000 0.000 0.068 0.928 0.000 0.004
#> SRR2015775     6  0.0692     0.8448 0.004 0.000 0.020 0.000 0.000 0.976
#> SRR2015774     2  0.5166     0.5588 0.052 0.728 0.132 0.036 0.000 0.052
#> SRR2015773     2  0.4094     0.6595 0.004 0.780 0.056 0.008 0.008 0.144
#> SRR2015772     2  0.3106     0.6801 0.004 0.852 0.024 0.020 0.000 0.100
#> SRR2015771     1  0.2039     0.6322 0.904 0.020 0.076 0.000 0.000 0.000
#> SRR2015769     6  0.0363     0.8490 0.000 0.000 0.012 0.000 0.000 0.988
#> SRR2015770     2  0.5763     0.0399 0.000 0.476 0.124 0.000 0.012 0.388
#> SRR2015768     6  0.0935     0.8476 0.000 0.004 0.032 0.000 0.000 0.964
#> SRR2015767     4  0.0713     0.8246 0.000 0.000 0.028 0.972 0.000 0.000
#> SRR2015766     4  0.5756     0.4863 0.140 0.116 0.096 0.648 0.000 0.000
#> SRR2015764     2  0.2451     0.6768 0.004 0.876 0.108 0.000 0.008 0.004
#> SRR2015765     2  0.7287     0.2636 0.016 0.420 0.044 0.200 0.012 0.308
#> SRR2015763     1  0.3362     0.5233 0.824 0.096 0.076 0.000 0.004 0.000
#> SRR2015762     2  0.4306     0.6310 0.000 0.752 0.124 0.112 0.012 0.000
#> SRR2015761     2  0.4749     0.5825 0.020 0.716 0.120 0.144 0.000 0.000
#> SRR2015760     1  0.3241     0.5190 0.824 0.112 0.064 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-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

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

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

collect_plots(res)

plot of chunk ATC-hclust-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.618           0.805       0.906         0.4540 0.509   0.509
#> 3 3 0.527           0.663       0.758         0.3857 0.643   0.423
#> 4 4 0.712           0.742       0.784         0.1271 0.833   0.576
#> 5 5 0.712           0.726       0.848         0.0345 0.991   0.964
#> 6 6 0.765           0.664       0.868         0.0417 0.924   0.724

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

suggest_best_k(res)
#> [1] 2

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

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

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>            class entropy silhouette    p1    p2
#> SRR2015715     1   0.327      0.922 0.940 0.060
#> SRR2015735     1   0.327      0.922 0.940 0.060
#> SRR2015759     1   0.000      0.921 1.000 0.000
#> SRR2015753     1   0.000      0.921 1.000 0.000
#> SRR2015746     1   0.118      0.922 0.984 0.016
#> SRR2015758     2   0.000      0.826 0.000 1.000
#> SRR2015756     1   0.000      0.921 1.000 0.000
#> SRR2015757     2   0.855      0.658 0.280 0.720
#> SRR2015755     1   0.000      0.921 1.000 0.000
#> SRR2015754     1   0.000      0.921 1.000 0.000
#> SRR2015752     1   0.000      0.921 1.000 0.000
#> SRR2015749     1   0.000      0.921 1.000 0.000
#> SRR2015750     2   0.000      0.826 0.000 1.000
#> SRR2015751     1   0.706      0.722 0.808 0.192
#> SRR2015748     1   0.000      0.921 1.000 0.000
#> SRR2015747     1   0.000      0.921 1.000 0.000
#> SRR2015745     1   0.949      0.272 0.632 0.368
#> SRR2015743     1   0.000      0.921 1.000 0.000
#> SRR2015744     1   0.327      0.922 0.940 0.060
#> SRR2015742     1   0.706      0.722 0.808 0.192
#> SRR2015741     1   0.000      0.921 1.000 0.000
#> SRR2015740     1   0.000      0.921 1.000 0.000
#> SRR2015738     1   0.000      0.921 1.000 0.000
#> SRR2015739     1   0.000      0.921 1.000 0.000
#> SRR2015737     2   0.000      0.826 0.000 1.000
#> SRR2015736     2   0.855      0.658 0.280 0.720
#> SRR2015732     1   0.443      0.894 0.908 0.092
#> SRR2015733     2   0.000      0.826 0.000 1.000
#> SRR2015734     1   0.327      0.922 0.940 0.060
#> SRR2015731     1   0.541      0.860 0.876 0.124
#> SRR2015730     1   0.000      0.921 1.000 0.000
#> SRR2015728     1   0.000      0.921 1.000 0.000
#> SRR2015729     2   0.987      0.388 0.432 0.568
#> SRR2015727     1   0.327      0.922 0.940 0.060
#> SRR2015726     1   0.327      0.922 0.940 0.060
#> SRR2015723     1   0.327      0.922 0.940 0.060
#> SRR2015724     1   0.327      0.922 0.940 0.060
#> SRR2015725     1   0.000      0.921 1.000 0.000
#> SRR2015722     1   0.327      0.922 0.940 0.060
#> SRR2015721     2   0.839      0.670 0.268 0.732
#> SRR2015720     2   0.855      0.658 0.280 0.720
#> SRR2015718     1   0.327      0.922 0.940 0.060
#> SRR2015719     2   0.000      0.826 0.000 1.000
#> SRR2015717     1   0.327      0.922 0.940 0.060
#> SRR2015716     1   0.327      0.922 0.940 0.060
#> SRR2015714     2   0.000      0.826 0.000 1.000
#> SRR2015713     2   0.855      0.658 0.280 0.720
#> SRR2015784     2   0.000      0.826 0.000 1.000
#> SRR2015785     2   0.000      0.826 0.000 1.000
#> SRR2015783     1   0.000      0.921 1.000 0.000
#> SRR2015782     1   0.949      0.272 0.632 0.368
#> SRR2015781     2   0.000      0.826 0.000 1.000
#> SRR2015780     2   0.839      0.670 0.268 0.732
#> SRR2015779     2   0.000      0.826 0.000 1.000
#> SRR2015778     1   0.745      0.685 0.788 0.212
#> SRR2015777     1   0.327      0.922 0.940 0.060
#> SRR2015776     2   0.000      0.826 0.000 1.000
#> SRR2015775     2   0.987      0.388 0.432 0.568
#> SRR2015774     2   0.987      0.388 0.432 0.568
#> SRR2015773     2   0.000      0.826 0.000 1.000
#> SRR2015772     2   0.000      0.826 0.000 1.000
#> SRR2015771     1   0.327      0.922 0.940 0.060
#> SRR2015769     2   0.987      0.388 0.432 0.568
#> SRR2015770     2   0.000      0.826 0.000 1.000
#> SRR2015768     2   0.000      0.826 0.000 1.000
#> SRR2015767     2   0.000      0.826 0.000 1.000
#> SRR2015766     1   0.416      0.903 0.916 0.084
#> SRR2015764     2   0.000      0.826 0.000 1.000
#> SRR2015765     2   0.987      0.388 0.432 0.568
#> SRR2015763     1   0.327      0.922 0.940 0.060
#> SRR2015762     2   0.000      0.826 0.000 1.000
#> SRR2015761     2   0.987      0.388 0.432 0.568
#> SRR2015760     1   0.327      0.922 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
#> SRR2015715     3   0.533      0.657 0.272 0.000 0.728
#> SRR2015735     3   0.533      0.657 0.272 0.000 0.728
#> SRR2015759     1   0.000      0.969 1.000 0.000 0.000
#> SRR2015753     1   0.000      0.969 1.000 0.000 0.000
#> SRR2015746     3   0.514      0.603 0.252 0.000 0.748
#> SRR2015758     2   0.000      0.863 0.000 1.000 0.000
#> SRR2015756     1   0.000      0.969 1.000 0.000 0.000
#> SRR2015757     3   0.627     -0.146 0.000 0.452 0.548
#> SRR2015755     1   0.000      0.969 1.000 0.000 0.000
#> SRR2015754     1   0.000      0.969 1.000 0.000 0.000
#> SRR2015752     1   0.000      0.969 1.000 0.000 0.000
#> SRR2015749     1   0.000      0.969 1.000 0.000 0.000
#> SRR2015750     2   0.514      0.808 0.000 0.748 0.252
#> SRR2015751     3   0.245      0.614 0.076 0.000 0.924
#> SRR2015748     1   0.621      0.193 0.572 0.000 0.428
#> SRR2015747     1   0.000      0.969 1.000 0.000 0.000
#> SRR2015745     3   0.654      0.469 0.076 0.176 0.748
#> SRR2015743     1   0.000      0.969 1.000 0.000 0.000
#> SRR2015744     3   0.533      0.657 0.272 0.000 0.728
#> SRR2015742     3   0.245      0.614 0.076 0.000 0.924
#> SRR2015741     1   0.000      0.969 1.000 0.000 0.000
#> SRR2015740     1   0.000      0.969 1.000 0.000 0.000
#> SRR2015738     1   0.000      0.969 1.000 0.000 0.000
#> SRR2015739     1   0.000      0.969 1.000 0.000 0.000
#> SRR2015737     2   0.465      0.843 0.000 0.792 0.208
#> SRR2015736     3   0.627     -0.146 0.000 0.452 0.548
#> SRR2015732     3   0.502      0.654 0.240 0.000 0.760
#> SRR2015733     2   0.514      0.808 0.000 0.748 0.252
#> SRR2015734     3   0.533      0.657 0.272 0.000 0.728
#> SRR2015731     3   0.662      0.652 0.248 0.044 0.708
#> SRR2015730     1   0.000      0.969 1.000 0.000 0.000
#> SRR2015728     3   0.623      0.207 0.436 0.000 0.564
#> SRR2015729     3   0.556      0.308 0.000 0.300 0.700
#> SRR2015727     3   0.533      0.657 0.272 0.000 0.728
#> SRR2015726     3   0.533      0.657 0.272 0.000 0.728
#> SRR2015723     3   0.533      0.657 0.272 0.000 0.728
#> SRR2015724     3   0.533      0.657 0.272 0.000 0.728
#> SRR2015725     1   0.000      0.969 1.000 0.000 0.000
#> SRR2015722     3   0.533      0.657 0.272 0.000 0.728
#> SRR2015721     3   0.630     -0.234 0.000 0.480 0.520
#> SRR2015720     3   0.627     -0.146 0.000 0.452 0.548
#> SRR2015718     3   0.533      0.657 0.272 0.000 0.728
#> SRR2015719     2   0.000      0.863 0.000 1.000 0.000
#> SRR2015717     3   0.533      0.657 0.272 0.000 0.728
#> SRR2015716     3   0.533      0.657 0.272 0.000 0.728
#> SRR2015714     2   0.000      0.863 0.000 1.000 0.000
#> SRR2015713     3   0.627     -0.146 0.000 0.452 0.548
#> SRR2015784     2   0.418      0.853 0.000 0.828 0.172
#> SRR2015785     2   0.418      0.853 0.000 0.828 0.172
#> SRR2015783     1   0.000      0.969 1.000 0.000 0.000
#> SRR2015782     3   0.654      0.469 0.076 0.176 0.748
#> SRR2015781     2   0.418      0.853 0.000 0.828 0.172
#> SRR2015780     2   0.624      0.316 0.000 0.560 0.440
#> SRR2015779     2   0.000      0.863 0.000 1.000 0.000
#> SRR2015778     3   0.333      0.611 0.076 0.020 0.904
#> SRR2015777     3   0.533      0.657 0.272 0.000 0.728
#> SRR2015776     2   0.000      0.863 0.000 1.000 0.000
#> SRR2015775     3   0.556      0.308 0.000 0.300 0.700
#> SRR2015774     3   0.556      0.308 0.000 0.300 0.700
#> SRR2015773     2   0.465      0.843 0.000 0.792 0.208
#> SRR2015772     2   0.465      0.843 0.000 0.792 0.208
#> SRR2015771     3   0.533      0.657 0.272 0.000 0.728
#> SRR2015769     3   0.556      0.308 0.000 0.300 0.700
#> SRR2015770     2   0.000      0.863 0.000 1.000 0.000
#> SRR2015768     2   0.000      0.863 0.000 1.000 0.000
#> SRR2015767     2   0.000      0.863 0.000 1.000 0.000
#> SRR2015766     3   0.533      0.659 0.248 0.004 0.748
#> SRR2015764     2   0.465      0.843 0.000 0.792 0.208
#> SRR2015765     3   0.556      0.308 0.000 0.300 0.700
#> SRR2015763     3   0.533      0.657 0.272 0.000 0.728
#> SRR2015762     2   0.000      0.863 0.000 1.000 0.000
#> SRR2015761     3   0.556      0.308 0.000 0.300 0.700
#> SRR2015760     3   0.533      0.657 0.272 0.000 0.728

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> SRR2015715     3  0.0336     0.8742 0.008 0.000 0.992 0.000
#> SRR2015735     3  0.0336     0.8742 0.008 0.000 0.992 0.000
#> SRR2015759     1  0.1940     1.0000 0.924 0.000 0.076 0.000
#> SRR2015753     1  0.1940     1.0000 0.924 0.000 0.076 0.000
#> SRR2015746     3  0.2919     0.7676 0.060 0.044 0.896 0.000
#> SRR2015758     4  0.0469     0.7964 0.000 0.012 0.000 0.988
#> SRR2015756     1  0.1940     1.0000 0.924 0.000 0.076 0.000
#> SRR2015757     2  0.4008     0.7253 0.000 0.756 0.244 0.000
#> SRR2015755     1  0.1940     1.0000 0.924 0.000 0.076 0.000
#> SRR2015754     1  0.1940     1.0000 0.924 0.000 0.076 0.000
#> SRR2015752     1  0.1940     1.0000 0.924 0.000 0.076 0.000
#> SRR2015749     1  0.1940     1.0000 0.924 0.000 0.076 0.000
#> SRR2015750     2  0.6024    -0.2541 0.000 0.540 0.044 0.416
#> SRR2015751     3  0.5327     0.4646 0.060 0.220 0.720 0.000
#> SRR2015748     3  0.7774     0.1206 0.372 0.240 0.388 0.000
#> SRR2015747     1  0.1940     1.0000 0.924 0.000 0.076 0.000
#> SRR2015745     2  0.6330     0.4463 0.060 0.492 0.448 0.000
#> SRR2015743     1  0.1940     1.0000 0.924 0.000 0.076 0.000
#> SRR2015744     3  0.0336     0.8742 0.008 0.000 0.992 0.000
#> SRR2015742     3  0.5327     0.4646 0.060 0.220 0.720 0.000
#> SRR2015741     1  0.1940     1.0000 0.924 0.000 0.076 0.000
#> SRR2015740     1  0.1940     1.0000 0.924 0.000 0.076 0.000
#> SRR2015738     1  0.1940     1.0000 0.924 0.000 0.076 0.000
#> SRR2015739     1  0.1940     1.0000 0.924 0.000 0.076 0.000
#> SRR2015737     4  0.5290     0.4322 0.000 0.476 0.008 0.516
#> SRR2015736     2  0.4008     0.7253 0.000 0.756 0.244 0.000
#> SRR2015732     3  0.1209     0.8422 0.004 0.032 0.964 0.000
#> SRR2015733     2  0.6024    -0.2541 0.000 0.540 0.044 0.416
#> SRR2015734     3  0.0336     0.8742 0.008 0.000 0.992 0.000
#> SRR2015731     3  0.2647     0.7261 0.000 0.120 0.880 0.000
#> SRR2015730     1  0.1940     1.0000 0.924 0.000 0.076 0.000
#> SRR2015728     3  0.5787     0.5279 0.076 0.244 0.680 0.000
#> SRR2015729     2  0.4843     0.6938 0.000 0.604 0.396 0.000
#> SRR2015727     3  0.0336     0.8742 0.008 0.000 0.992 0.000
#> SRR2015726     3  0.0336     0.8742 0.008 0.000 0.992 0.000
#> SRR2015723     3  0.0336     0.8742 0.008 0.000 0.992 0.000
#> SRR2015724     3  0.0336     0.8742 0.008 0.000 0.992 0.000
#> SRR2015725     1  0.1940     1.0000 0.924 0.000 0.076 0.000
#> SRR2015722     3  0.0336     0.8742 0.008 0.000 0.992 0.000
#> SRR2015721     2  0.4635     0.6971 0.000 0.756 0.216 0.028
#> SRR2015720     2  0.4008     0.7253 0.000 0.756 0.244 0.000
#> SRR2015718     3  0.0336     0.8742 0.008 0.000 0.992 0.000
#> SRR2015719     4  0.0000     0.7976 0.000 0.000 0.000 1.000
#> SRR2015717     3  0.0336     0.8742 0.008 0.000 0.992 0.000
#> SRR2015716     3  0.0336     0.8742 0.008 0.000 0.992 0.000
#> SRR2015714     4  0.0000     0.7976 0.000 0.000 0.000 1.000
#> SRR2015713     2  0.4008     0.7253 0.000 0.756 0.244 0.000
#> SRR2015784     4  0.4434     0.6747 0.000 0.228 0.016 0.756
#> SRR2015785     4  0.4434     0.6747 0.000 0.228 0.016 0.756
#> SRR2015783     1  0.1940     1.0000 0.924 0.000 0.076 0.000
#> SRR2015782     2  0.6330     0.4463 0.060 0.492 0.448 0.000
#> SRR2015781     4  0.4434     0.6747 0.000 0.228 0.016 0.756
#> SRR2015780     2  0.7538     0.2832 0.000 0.428 0.188 0.384
#> SRR2015779     4  0.0000     0.7976 0.000 0.000 0.000 1.000
#> SRR2015778     3  0.6058     0.0775 0.060 0.336 0.604 0.000
#> SRR2015777     3  0.0336     0.8742 0.008 0.000 0.992 0.000
#> SRR2015776     4  0.0000     0.7976 0.000 0.000 0.000 1.000
#> SRR2015775     2  0.4843     0.6938 0.000 0.604 0.396 0.000
#> SRR2015774     2  0.4843     0.6938 0.000 0.604 0.396 0.000
#> SRR2015773     4  0.5290     0.4322 0.000 0.476 0.008 0.516
#> SRR2015772     4  0.5290     0.4322 0.000 0.476 0.008 0.516
#> SRR2015771     3  0.0336     0.8742 0.008 0.000 0.992 0.000
#> SRR2015769     2  0.4843     0.6938 0.000 0.604 0.396 0.000
#> SRR2015770     4  0.0000     0.7976 0.000 0.000 0.000 1.000
#> SRR2015768     4  0.0469     0.7964 0.000 0.012 0.000 0.988
#> SRR2015767     4  0.0000     0.7976 0.000 0.000 0.000 1.000
#> SRR2015766     3  0.0817     0.8488 0.000 0.024 0.976 0.000
#> SRR2015764     4  0.5290     0.4322 0.000 0.476 0.008 0.516
#> SRR2015765     2  0.4843     0.6938 0.000 0.604 0.396 0.000
#> SRR2015763     3  0.0336     0.8742 0.008 0.000 0.992 0.000
#> SRR2015762     4  0.0000     0.7976 0.000 0.000 0.000 1.000
#> SRR2015761     2  0.4843     0.6938 0.000 0.604 0.396 0.000
#> SRR2015760     3  0.0336     0.8742 0.008 0.000 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
#> SRR2015715     3  0.0162      0.881 0.004 0.000 0.996 0.000 0.000
#> SRR2015735     3  0.0162      0.881 0.004 0.000 0.996 0.000 0.000
#> SRR2015759     1  0.0609      1.000 0.980 0.000 0.020 0.000 0.000
#> SRR2015753     1  0.0609      1.000 0.980 0.000 0.020 0.000 0.000
#> SRR2015746     3  0.3789      0.646 0.000 0.016 0.760 0.000 0.224
#> SRR2015758     4  0.0404      0.757 0.000 0.012 0.000 0.988 0.000
#> SRR2015756     1  0.0609      1.000 0.980 0.000 0.020 0.000 0.000
#> SRR2015757     2  0.3109      0.713 0.000 0.800 0.200 0.000 0.000
#> SRR2015755     1  0.0609      1.000 0.980 0.000 0.020 0.000 0.000
#> SRR2015754     1  0.0609      1.000 0.980 0.000 0.020 0.000 0.000
#> SRR2015752     1  0.0609      1.000 0.980 0.000 0.020 0.000 0.000
#> SRR2015749     1  0.0609      1.000 0.980 0.000 0.020 0.000 0.000
#> SRR2015750     2  0.4219     -0.245 0.000 0.584 0.000 0.416 0.000
#> SRR2015751     3  0.6003      0.253 0.000 0.192 0.584 0.000 0.224
#> SRR2015748     5  0.0865      0.000 0.024 0.000 0.004 0.000 0.972
#> SRR2015747     1  0.0609      1.000 0.980 0.000 0.020 0.000 0.000
#> SRR2015745     2  0.6554      0.534 0.000 0.464 0.312 0.000 0.224
#> SRR2015743     1  0.0609      1.000 0.980 0.000 0.020 0.000 0.000
#> SRR2015744     3  0.0162      0.881 0.004 0.000 0.996 0.000 0.000
#> SRR2015742     3  0.6003      0.253 0.000 0.192 0.584 0.000 0.224
#> SRR2015741     1  0.0609      1.000 0.980 0.000 0.020 0.000 0.000
#> SRR2015740     1  0.0609      1.000 0.980 0.000 0.020 0.000 0.000
#> SRR2015738     1  0.0609      1.000 0.980 0.000 0.020 0.000 0.000
#> SRR2015739     1  0.0609      1.000 0.980 0.000 0.020 0.000 0.000
#> SRR2015737     4  0.4304      0.412 0.000 0.484 0.000 0.516 0.000
#> SRR2015736     2  0.3109      0.713 0.000 0.800 0.200 0.000 0.000
#> SRR2015732     3  0.0880      0.854 0.000 0.032 0.968 0.000 0.000
#> SRR2015733     2  0.4219     -0.245 0.000 0.584 0.000 0.416 0.000
#> SRR2015734     3  0.0162      0.881 0.004 0.000 0.996 0.000 0.000
#> SRR2015731     3  0.2280      0.743 0.000 0.120 0.880 0.000 0.000
#> SRR2015730     1  0.0609      1.000 0.980 0.000 0.020 0.000 0.000
#> SRR2015728     3  0.6310      0.333 0.020 0.184 0.600 0.000 0.196
#> SRR2015729     2  0.4030      0.706 0.000 0.648 0.352 0.000 0.000
#> SRR2015727     3  0.0162      0.881 0.004 0.000 0.996 0.000 0.000
#> SRR2015726     3  0.0162      0.881 0.004 0.000 0.996 0.000 0.000
#> SRR2015723     3  0.0162      0.881 0.004 0.000 0.996 0.000 0.000
#> SRR2015724     3  0.0162      0.881 0.004 0.000 0.996 0.000 0.000
#> SRR2015725     1  0.0609      1.000 0.980 0.000 0.020 0.000 0.000
#> SRR2015722     3  0.0162      0.881 0.004 0.000 0.996 0.000 0.000
#> SRR2015721     2  0.3612      0.687 0.000 0.800 0.172 0.028 0.000
#> SRR2015720     2  0.3109      0.713 0.000 0.800 0.200 0.000 0.000
#> SRR2015718     3  0.0162      0.881 0.004 0.000 0.996 0.000 0.000
#> SRR2015719     4  0.0000      0.756 0.000 0.000 0.000 1.000 0.000
#> SRR2015717     3  0.0162      0.881 0.004 0.000 0.996 0.000 0.000
#> SRR2015716     3  0.0162      0.881 0.004 0.000 0.996 0.000 0.000
#> SRR2015714     4  0.0000      0.756 0.000 0.000 0.000 1.000 0.000
#> SRR2015713     2  0.3109      0.713 0.000 0.800 0.200 0.000 0.000
#> SRR2015784     4  0.3452      0.674 0.000 0.244 0.000 0.756 0.000
#> SRR2015785     4  0.3452      0.674 0.000 0.244 0.000 0.756 0.000
#> SRR2015783     1  0.0609      1.000 0.980 0.000 0.020 0.000 0.000
#> SRR2015782     2  0.6554      0.534 0.000 0.464 0.312 0.000 0.224
#> SRR2015781     4  0.3452      0.674 0.000 0.244 0.000 0.756 0.000
#> SRR2015780     2  0.6405      0.288 0.000 0.444 0.172 0.384 0.000
#> SRR2015779     4  0.0000      0.756 0.000 0.000 0.000 1.000 0.000
#> SRR2015778     3  0.6544     -0.175 0.000 0.308 0.468 0.000 0.224
#> SRR2015777     3  0.0162      0.881 0.004 0.000 0.996 0.000 0.000
#> SRR2015776     4  0.0000      0.756 0.000 0.000 0.000 1.000 0.000
#> SRR2015775     2  0.4030      0.706 0.000 0.648 0.352 0.000 0.000
#> SRR2015774     2  0.4030      0.706 0.000 0.648 0.352 0.000 0.000
#> SRR2015773     4  0.4304      0.412 0.000 0.484 0.000 0.516 0.000
#> SRR2015772     4  0.4304      0.412 0.000 0.484 0.000 0.516 0.000
#> SRR2015771     3  0.0162      0.881 0.004 0.000 0.996 0.000 0.000
#> SRR2015769     2  0.4030      0.706 0.000 0.648 0.352 0.000 0.000
#> SRR2015770     4  0.0000      0.756 0.000 0.000 0.000 1.000 0.000
#> SRR2015768     4  0.0404      0.757 0.000 0.012 0.000 0.988 0.000
#> SRR2015767     4  0.0000      0.756 0.000 0.000 0.000 1.000 0.000
#> SRR2015766     3  0.0703      0.856 0.000 0.024 0.976 0.000 0.000
#> SRR2015764     4  0.4304      0.412 0.000 0.484 0.000 0.516 0.000
#> SRR2015765     2  0.4030      0.706 0.000 0.648 0.352 0.000 0.000
#> SRR2015763     3  0.0162      0.881 0.004 0.000 0.996 0.000 0.000
#> SRR2015762     4  0.0000      0.756 0.000 0.000 0.000 1.000 0.000
#> SRR2015761     2  0.4030      0.706 0.000 0.648 0.352 0.000 0.000
#> SRR2015760     3  0.0162      0.881 0.004 0.000 0.996 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
#> SRR2015715     3  0.0000     0.9135  0 0.000 1.000 0.000 0.000 0.000
#> SRR2015735     3  0.0000     0.9135  0 0.000 1.000 0.000 0.000 0.000
#> SRR2015759     1  0.0000     1.0000  1 0.000 0.000 0.000 0.000 0.000
#> SRR2015753     1  0.0000     1.0000  1 0.000 0.000 0.000 0.000 0.000
#> SRR2015746     3  0.3431     0.6357  0 0.000 0.756 0.000 0.228 0.016
#> SRR2015758     2  0.4254     0.8962  0 0.576 0.000 0.404 0.000 0.020
#> SRR2015756     1  0.0000     1.0000  1 0.000 0.000 0.000 0.000 0.000
#> SRR2015757     6  0.0713     0.5995  0 0.000 0.028 0.000 0.000 0.972
#> SRR2015755     1  0.0000     1.0000  1 0.000 0.000 0.000 0.000 0.000
#> SRR2015754     1  0.0000     1.0000  1 0.000 0.000 0.000 0.000 0.000
#> SRR2015752     1  0.0000     1.0000  1 0.000 0.000 0.000 0.000 0.000
#> SRR2015749     1  0.0000     1.0000  1 0.000 0.000 0.000 0.000 0.000
#> SRR2015750     6  0.3765     0.1116  0 0.000 0.000 0.404 0.000 0.596
#> SRR2015751     3  0.5934     0.0274  0 0.000 0.444 0.000 0.228 0.328
#> SRR2015748     5  0.0000     0.0000  0 0.000 0.000 0.000 1.000 0.000
#> SRR2015747     1  0.0000     1.0000  1 0.000 0.000 0.000 0.000 0.000
#> SRR2015745     6  0.5002     0.4206  0 0.000 0.136 0.000 0.228 0.636
#> SRR2015743     1  0.0000     1.0000  1 0.000 0.000 0.000 0.000 0.000
#> SRR2015744     3  0.0000     0.9135  0 0.000 1.000 0.000 0.000 0.000
#> SRR2015742     3  0.5934     0.0274  0 0.000 0.444 0.000 0.228 0.328
#> SRR2015741     1  0.0000     1.0000  1 0.000 0.000 0.000 0.000 0.000
#> SRR2015740     1  0.0000     1.0000  1 0.000 0.000 0.000 0.000 0.000
#> SRR2015738     1  0.0000     1.0000  1 0.000 0.000 0.000 0.000 0.000
#> SRR2015739     1  0.0000     1.0000  1 0.000 0.000 0.000 0.000 0.000
#> SRR2015737     6  0.5270    -0.0862  0 0.100 0.000 0.404 0.000 0.496
#> SRR2015736     6  0.0713     0.5995  0 0.000 0.028 0.000 0.000 0.972
#> SRR2015732     3  0.0790     0.8873  0 0.000 0.968 0.000 0.000 0.032
#> SRR2015733     6  0.3765     0.1116  0 0.000 0.000 0.404 0.000 0.596
#> SRR2015734     3  0.0000     0.9135  0 0.000 1.000 0.000 0.000 0.000
#> SRR2015731     3  0.2135     0.7790  0 0.000 0.872 0.000 0.000 0.128
#> SRR2015730     1  0.0000     1.0000  1 0.000 0.000 0.000 0.000 0.000
#> SRR2015728     4  0.3765    -0.5765  0 0.404 0.000 0.596 0.000 0.000
#> SRR2015729     6  0.2631     0.6028  0 0.000 0.180 0.000 0.000 0.820
#> SRR2015727     3  0.0000     0.9135  0 0.000 1.000 0.000 0.000 0.000
#> SRR2015726     3  0.0000     0.9135  0 0.000 1.000 0.000 0.000 0.000
#> SRR2015723     3  0.0000     0.9135  0 0.000 1.000 0.000 0.000 0.000
#> SRR2015724     3  0.0000     0.9135  0 0.000 1.000 0.000 0.000 0.000
#> SRR2015725     1  0.0000     1.0000  1 0.000 0.000 0.000 0.000 0.000
#> SRR2015722     3  0.0000     0.9135  0 0.000 1.000 0.000 0.000 0.000
#> SRR2015721     6  0.0458     0.5805  0 0.000 0.000 0.016 0.000 0.984
#> SRR2015720     6  0.0713     0.5995  0 0.000 0.028 0.000 0.000 0.972
#> SRR2015718     3  0.0000     0.9135  0 0.000 1.000 0.000 0.000 0.000
#> SRR2015719     2  0.3765     0.9167  0 0.596 0.000 0.404 0.000 0.000
#> SRR2015717     3  0.0000     0.9135  0 0.000 1.000 0.000 0.000 0.000
#> SRR2015716     3  0.0000     0.9135  0 0.000 1.000 0.000 0.000 0.000
#> SRR2015714     2  0.3765     0.9167  0 0.596 0.000 0.404 0.000 0.000
#> SRR2015713     6  0.0713     0.5995  0 0.000 0.028 0.000 0.000 0.972
#> SRR2015784     4  0.6053    -0.3345  0 0.372 0.000 0.372 0.000 0.256
#> SRR2015785     2  0.6053    -0.0984  0 0.372 0.000 0.372 0.000 0.256
#> SRR2015783     1  0.0000     1.0000  1 0.000 0.000 0.000 0.000 0.000
#> SRR2015782     6  0.5002     0.4206  0 0.000 0.136 0.000 0.228 0.636
#> SRR2015781     4  0.6053    -0.3345  0 0.372 0.000 0.372 0.000 0.256
#> SRR2015780     6  0.3684     0.2098  0 0.372 0.000 0.000 0.000 0.628
#> SRR2015779     2  0.3765     0.9167  0 0.596 0.000 0.404 0.000 0.000
#> SRR2015778     6  0.5854     0.2183  0 0.000 0.292 0.000 0.228 0.480
#> SRR2015777     3  0.0000     0.9135  0 0.000 1.000 0.000 0.000 0.000
#> SRR2015776     2  0.3765     0.9167  0 0.596 0.000 0.404 0.000 0.000
#> SRR2015775     6  0.2631     0.6028  0 0.000 0.180 0.000 0.000 0.820
#> SRR2015774     6  0.2631     0.6028  0 0.000 0.180 0.000 0.000 0.820
#> SRR2015773     6  0.5270    -0.0862  0 0.100 0.000 0.404 0.000 0.496
#> SRR2015772     6  0.5270    -0.0862  0 0.100 0.000 0.404 0.000 0.496
#> SRR2015771     3  0.0000     0.9135  0 0.000 1.000 0.000 0.000 0.000
#> SRR2015769     6  0.2631     0.6028  0 0.000 0.180 0.000 0.000 0.820
#> SRR2015770     2  0.4002     0.9108  0 0.588 0.000 0.404 0.000 0.008
#> SRR2015768     2  0.4254     0.8962  0 0.576 0.000 0.404 0.000 0.020
#> SRR2015767     2  0.3765     0.9167  0 0.596 0.000 0.404 0.000 0.000
#> SRR2015766     3  0.0632     0.8936  0 0.000 0.976 0.000 0.000 0.024
#> SRR2015764     6  0.5270    -0.0862  0 0.100 0.000 0.404 0.000 0.496
#> SRR2015765     6  0.2631     0.6028  0 0.000 0.180 0.000 0.000 0.820
#> SRR2015763     3  0.0000     0.9135  0 0.000 1.000 0.000 0.000 0.000
#> SRR2015762     2  0.3765     0.9167  0 0.596 0.000 0.404 0.000 0.000
#> SRR2015761     6  0.2631     0.6028  0 0.000 0.180 0.000 0.000 0.820
#> SRR2015760     3  0.0000     0.9135  0 0.000 1.000 0.000 0.000 0.000

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

consensus_heatmap(res, k = 2)

plot of chunk tab-ATC-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

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

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

collect_plots(res)

plot of chunk ATC-kmeans-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 1.000           0.986       0.995         0.5042 0.495   0.495
#> 3 3 1.000           0.971       0.986         0.2312 0.610   0.387
#> 4 4 0.802           0.918       0.916         0.1900 0.860   0.637
#> 5 5 0.807           0.844       0.864         0.0599 0.953   0.811
#> 6 6 0.820           0.680       0.824         0.0429 0.972   0.867

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
#> SRR2015715     1   0.000      1.000 1.00 0.00
#> SRR2015735     1   0.000      1.000 1.00 0.00
#> SRR2015759     1   0.000      1.000 1.00 0.00
#> SRR2015753     1   0.000      1.000 1.00 0.00
#> SRR2015746     1   0.000      1.000 1.00 0.00
#> SRR2015758     2   0.000      0.988 0.00 1.00
#> SRR2015756     1   0.000      1.000 1.00 0.00
#> SRR2015757     2   0.000      0.988 0.00 1.00
#> SRR2015755     1   0.000      1.000 1.00 0.00
#> SRR2015754     1   0.000      1.000 1.00 0.00
#> SRR2015752     1   0.000      1.000 1.00 0.00
#> SRR2015749     1   0.000      1.000 1.00 0.00
#> SRR2015750     2   0.000      0.988 0.00 1.00
#> SRR2015751     1   0.000      1.000 1.00 0.00
#> SRR2015748     1   0.000      1.000 1.00 0.00
#> SRR2015747     1   0.000      1.000 1.00 0.00
#> SRR2015745     2   0.000      0.988 0.00 1.00
#> SRR2015743     1   0.000      1.000 1.00 0.00
#> SRR2015744     1   0.000      1.000 1.00 0.00
#> SRR2015742     1   0.000      1.000 1.00 0.00
#> SRR2015741     1   0.000      1.000 1.00 0.00
#> SRR2015740     1   0.000      1.000 1.00 0.00
#> SRR2015738     1   0.000      1.000 1.00 0.00
#> SRR2015739     1   0.000      1.000 1.00 0.00
#> SRR2015737     2   0.000      0.988 0.00 1.00
#> SRR2015736     2   0.000      0.988 0.00 1.00
#> SRR2015732     1   0.000      1.000 1.00 0.00
#> SRR2015733     2   0.000      0.988 0.00 1.00
#> SRR2015734     1   0.000      1.000 1.00 0.00
#> SRR2015731     2   0.000      0.988 0.00 1.00
#> SRR2015730     1   0.000      1.000 1.00 0.00
#> SRR2015728     1   0.000      1.000 1.00 0.00
#> SRR2015729     2   0.000      0.988 0.00 1.00
#> SRR2015727     1   0.000      1.000 1.00 0.00
#> SRR2015726     1   0.000      1.000 1.00 0.00
#> SRR2015723     1   0.000      1.000 1.00 0.00
#> SRR2015724     1   0.000      1.000 1.00 0.00
#> SRR2015725     1   0.000      1.000 1.00 0.00
#> SRR2015722     1   0.000      1.000 1.00 0.00
#> SRR2015721     2   0.000      0.988 0.00 1.00
#> SRR2015720     2   0.000      0.988 0.00 1.00
#> SRR2015718     1   0.000      1.000 1.00 0.00
#> SRR2015719     2   0.000      0.988 0.00 1.00
#> SRR2015717     1   0.000      1.000 1.00 0.00
#> SRR2015716     1   0.000      1.000 1.00 0.00
#> SRR2015714     2   0.000      0.988 0.00 1.00
#> SRR2015713     2   0.000      0.988 0.00 1.00
#> SRR2015784     2   0.000      0.988 0.00 1.00
#> SRR2015785     2   0.000      0.988 0.00 1.00
#> SRR2015783     1   0.000      1.000 1.00 0.00
#> SRR2015782     2   0.000      0.988 0.00 1.00
#> SRR2015781     2   0.000      0.988 0.00 1.00
#> SRR2015780     2   0.000      0.988 0.00 1.00
#> SRR2015779     2   0.000      0.988 0.00 1.00
#> SRR2015778     2   0.958      0.387 0.38 0.62
#> SRR2015777     1   0.000      1.000 1.00 0.00
#> SRR2015776     2   0.000      0.988 0.00 1.00
#> SRR2015775     2   0.000      0.988 0.00 1.00
#> SRR2015774     2   0.000      0.988 0.00 1.00
#> SRR2015773     2   0.000      0.988 0.00 1.00
#> SRR2015772     2   0.000      0.988 0.00 1.00
#> SRR2015771     1   0.000      1.000 1.00 0.00
#> SRR2015769     2   0.000      0.988 0.00 1.00
#> SRR2015770     2   0.000      0.988 0.00 1.00
#> SRR2015768     2   0.000      0.988 0.00 1.00
#> SRR2015767     2   0.000      0.988 0.00 1.00
#> SRR2015766     1   0.000      1.000 1.00 0.00
#> SRR2015764     2   0.000      0.988 0.00 1.00
#> SRR2015765     2   0.000      0.988 0.00 1.00
#> SRR2015763     1   0.000      1.000 1.00 0.00
#> SRR2015762     2   0.000      0.988 0.00 1.00
#> SRR2015761     2   0.000      0.988 0.00 1.00
#> SRR2015760     1   0.000      1.000 1.00 0.00

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>            class entropy silhouette    p1    p2    p3
#> SRR2015715     3  0.0000      0.973 0.000 0.000 1.000
#> SRR2015735     3  0.0000      0.973 0.000 0.000 1.000
#> SRR2015759     1  0.0000      1.000 1.000 0.000 0.000
#> SRR2015753     1  0.0000      1.000 1.000 0.000 0.000
#> SRR2015746     3  0.0000      0.973 0.000 0.000 1.000
#> SRR2015758     2  0.0000      1.000 0.000 1.000 0.000
#> SRR2015756     1  0.0000      1.000 1.000 0.000 0.000
#> SRR2015757     3  0.1964      0.943 0.000 0.056 0.944
#> SRR2015755     1  0.0000      1.000 1.000 0.000 0.000
#> SRR2015754     1  0.0000      1.000 1.000 0.000 0.000
#> SRR2015752     1  0.0000      1.000 1.000 0.000 0.000
#> SRR2015749     1  0.0000      1.000 1.000 0.000 0.000
#> SRR2015750     2  0.0000      1.000 0.000 1.000 0.000
#> SRR2015751     3  0.0000      0.973 0.000 0.000 1.000
#> SRR2015748     3  0.6235      0.224 0.436 0.000 0.564
#> SRR2015747     1  0.0000      1.000 1.000 0.000 0.000
#> SRR2015745     3  0.2537      0.923 0.000 0.080 0.920
#> SRR2015743     1  0.0000      1.000 1.000 0.000 0.000
#> SRR2015744     3  0.0000      0.973 0.000 0.000 1.000
#> SRR2015742     3  0.0000      0.973 0.000 0.000 1.000
#> SRR2015741     1  0.0000      1.000 1.000 0.000 0.000
#> SRR2015740     1  0.0000      1.000 1.000 0.000 0.000
#> SRR2015738     1  0.0000      1.000 1.000 0.000 0.000
#> SRR2015739     1  0.0000      1.000 1.000 0.000 0.000
#> SRR2015737     2  0.0000      1.000 0.000 1.000 0.000
#> SRR2015736     3  0.0000      0.973 0.000 0.000 1.000
#> SRR2015732     3  0.0000      0.973 0.000 0.000 1.000
#> SRR2015733     2  0.0000      1.000 0.000 1.000 0.000
#> SRR2015734     3  0.0000      0.973 0.000 0.000 1.000
#> SRR2015731     3  0.0000      0.973 0.000 0.000 1.000
#> SRR2015730     1  0.0000      1.000 1.000 0.000 0.000
#> SRR2015728     3  0.0000      0.973 0.000 0.000 1.000
#> SRR2015729     3  0.1529      0.953 0.000 0.040 0.960
#> SRR2015727     3  0.0000      0.973 0.000 0.000 1.000
#> SRR2015726     3  0.0000      0.973 0.000 0.000 1.000
#> SRR2015723     3  0.0000      0.973 0.000 0.000 1.000
#> SRR2015724     3  0.0000      0.973 0.000 0.000 1.000
#> SRR2015725     1  0.0000      1.000 1.000 0.000 0.000
#> SRR2015722     3  0.0000      0.973 0.000 0.000 1.000
#> SRR2015721     3  0.1964      0.943 0.000 0.056 0.944
#> SRR2015720     3  0.0000      0.973 0.000 0.000 1.000
#> SRR2015718     3  0.0000      0.973 0.000 0.000 1.000
#> SRR2015719     2  0.0000      1.000 0.000 1.000 0.000
#> SRR2015717     3  0.0000      0.973 0.000 0.000 1.000
#> SRR2015716     3  0.0000      0.973 0.000 0.000 1.000
#> SRR2015714     2  0.0000      1.000 0.000 1.000 0.000
#> SRR2015713     3  0.1964      0.943 0.000 0.056 0.944
#> SRR2015784     2  0.0000      1.000 0.000 1.000 0.000
#> SRR2015785     2  0.0000      1.000 0.000 1.000 0.000
#> SRR2015783     1  0.0000      1.000 1.000 0.000 0.000
#> SRR2015782     3  0.0747      0.966 0.000 0.016 0.984
#> SRR2015781     2  0.0000      1.000 0.000 1.000 0.000
#> SRR2015780     3  0.2537      0.923 0.000 0.080 0.920
#> SRR2015779     2  0.0000      1.000 0.000 1.000 0.000
#> SRR2015778     3  0.0000      0.973 0.000 0.000 1.000
#> SRR2015777     3  0.0000      0.973 0.000 0.000 1.000
#> SRR2015776     2  0.0000      1.000 0.000 1.000 0.000
#> SRR2015775     3  0.1643      0.951 0.000 0.044 0.956
#> SRR2015774     3  0.0000      0.973 0.000 0.000 1.000
#> SRR2015773     2  0.0000      1.000 0.000 1.000 0.000
#> SRR2015772     2  0.0000      1.000 0.000 1.000 0.000
#> SRR2015771     3  0.0000      0.973 0.000 0.000 1.000
#> SRR2015769     3  0.1964      0.943 0.000 0.056 0.944
#> SRR2015770     2  0.0000      1.000 0.000 1.000 0.000
#> SRR2015768     2  0.0000      1.000 0.000 1.000 0.000
#> SRR2015767     2  0.0000      1.000 0.000 1.000 0.000
#> SRR2015766     3  0.0000      0.973 0.000 0.000 1.000
#> SRR2015764     2  0.0000      1.000 0.000 1.000 0.000
#> SRR2015765     3  0.1529      0.953 0.000 0.040 0.960
#> SRR2015763     3  0.0000      0.973 0.000 0.000 1.000
#> SRR2015762     2  0.0000      1.000 0.000 1.000 0.000
#> SRR2015761     3  0.1964      0.943 0.000 0.056 0.944
#> SRR2015760     3  0.0000      0.973 0.000 0.000 1.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> SRR2015715     3  0.0000      0.925 0.000 0.000 1.000 0.000
#> SRR2015735     3  0.0000      0.925 0.000 0.000 1.000 0.000
#> SRR2015759     1  0.0707      0.992 0.980 0.000 0.000 0.020
#> SRR2015753     1  0.0000      0.992 1.000 0.000 0.000 0.000
#> SRR2015746     3  0.3024      0.830 0.000 0.000 0.852 0.148
#> SRR2015758     2  0.0336      0.947 0.000 0.992 0.000 0.008
#> SRR2015756     1  0.0000      0.992 1.000 0.000 0.000 0.000
#> SRR2015757     4  0.4188      0.925 0.000 0.004 0.244 0.752
#> SRR2015755     1  0.0000      0.992 1.000 0.000 0.000 0.000
#> SRR2015754     1  0.0707      0.992 0.980 0.000 0.000 0.020
#> SRR2015752     1  0.0000      0.992 1.000 0.000 0.000 0.000
#> SRR2015749     1  0.0707      0.992 0.980 0.000 0.000 0.020
#> SRR2015750     2  0.4500      0.618 0.000 0.684 0.000 0.316
#> SRR2015751     3  0.4072      0.738 0.000 0.000 0.748 0.252
#> SRR2015748     3  0.4692      0.748 0.032 0.000 0.756 0.212
#> SRR2015747     1  0.0000      0.992 1.000 0.000 0.000 0.000
#> SRR2015745     4  0.2530      0.826 0.000 0.004 0.100 0.896
#> SRR2015743     1  0.0000      0.992 1.000 0.000 0.000 0.000
#> SRR2015744     3  0.3024      0.830 0.000 0.000 0.852 0.148
#> SRR2015742     3  0.4072      0.738 0.000 0.000 0.748 0.252
#> SRR2015741     1  0.0000      0.992 1.000 0.000 0.000 0.000
#> SRR2015740     1  0.0707      0.992 0.980 0.000 0.000 0.020
#> SRR2015738     1  0.0707      0.992 0.980 0.000 0.000 0.020
#> SRR2015739     1  0.0000      0.992 1.000 0.000 0.000 0.000
#> SRR2015737     2  0.2345      0.917 0.000 0.900 0.000 0.100
#> SRR2015736     4  0.4103      0.928 0.000 0.000 0.256 0.744
#> SRR2015732     3  0.0000      0.925 0.000 0.000 1.000 0.000
#> SRR2015733     2  0.2345      0.917 0.000 0.900 0.000 0.100
#> SRR2015734     3  0.0000      0.925 0.000 0.000 1.000 0.000
#> SRR2015731     4  0.4661      0.808 0.000 0.000 0.348 0.652
#> SRR2015730     1  0.0707      0.992 0.980 0.000 0.000 0.020
#> SRR2015728     3  0.3266      0.820 0.000 0.000 0.832 0.168
#> SRR2015729     4  0.4072      0.930 0.000 0.000 0.252 0.748
#> SRR2015727     3  0.0000      0.925 0.000 0.000 1.000 0.000
#> SRR2015726     3  0.0000      0.925 0.000 0.000 1.000 0.000
#> SRR2015723     3  0.0000      0.925 0.000 0.000 1.000 0.000
#> SRR2015724     3  0.0000      0.925 0.000 0.000 1.000 0.000
#> SRR2015725     1  0.0707      0.992 0.980 0.000 0.000 0.020
#> SRR2015722     3  0.0000      0.925 0.000 0.000 1.000 0.000
#> SRR2015721     4  0.4188      0.925 0.000 0.004 0.244 0.752
#> SRR2015720     4  0.4103      0.928 0.000 0.000 0.256 0.744
#> SRR2015718     3  0.0000      0.925 0.000 0.000 1.000 0.000
#> SRR2015719     2  0.0592      0.944 0.000 0.984 0.000 0.016
#> SRR2015717     3  0.0000      0.925 0.000 0.000 1.000 0.000
#> SRR2015716     3  0.0000      0.925 0.000 0.000 1.000 0.000
#> SRR2015714     2  0.0592      0.944 0.000 0.984 0.000 0.016
#> SRR2015713     4  0.4188      0.925 0.000 0.004 0.244 0.752
#> SRR2015784     2  0.0817      0.947 0.000 0.976 0.000 0.024
#> SRR2015785     2  0.0817      0.947 0.000 0.976 0.000 0.024
#> SRR2015783     1  0.0707      0.992 0.980 0.000 0.000 0.020
#> SRR2015782     4  0.2408      0.828 0.000 0.000 0.104 0.896
#> SRR2015781     2  0.0817      0.947 0.000 0.976 0.000 0.024
#> SRR2015780     4  0.2530      0.826 0.000 0.004 0.100 0.896
#> SRR2015779     2  0.0000      0.946 0.000 1.000 0.000 0.000
#> SRR2015778     4  0.3610      0.756 0.000 0.000 0.200 0.800
#> SRR2015777     3  0.3024      0.830 0.000 0.000 0.852 0.148
#> SRR2015776     2  0.0469      0.945 0.000 0.988 0.000 0.012
#> SRR2015775     4  0.4072      0.930 0.000 0.000 0.252 0.748
#> SRR2015774     4  0.4072      0.930 0.000 0.000 0.252 0.748
#> SRR2015773     2  0.2345      0.917 0.000 0.900 0.000 0.100
#> SRR2015772     2  0.2345      0.917 0.000 0.900 0.000 0.100
#> SRR2015771     3  0.0000      0.925 0.000 0.000 1.000 0.000
#> SRR2015769     4  0.4072      0.930 0.000 0.000 0.252 0.748
#> SRR2015770     2  0.0336      0.947 0.000 0.992 0.000 0.008
#> SRR2015768     2  0.0336      0.947 0.000 0.992 0.000 0.008
#> SRR2015767     2  0.0592      0.944 0.000 0.984 0.000 0.016
#> SRR2015766     3  0.0707      0.905 0.000 0.000 0.980 0.020
#> SRR2015764     2  0.2345      0.917 0.000 0.900 0.000 0.100
#> SRR2015765     4  0.4072      0.930 0.000 0.000 0.252 0.748
#> SRR2015763     3  0.0000      0.925 0.000 0.000 1.000 0.000
#> SRR2015762     2  0.0000      0.946 0.000 1.000 0.000 0.000
#> SRR2015761     4  0.4072      0.930 0.000 0.000 0.252 0.748
#> SRR2015760     3  0.0000      0.925 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
#> SRR2015715     3  0.0000     0.9391 0.000 0.000 1.000 0.000 0.000
#> SRR2015735     3  0.0162     0.9352 0.000 0.000 0.996 0.004 0.000
#> SRR2015759     1  0.2153     0.9588 0.916 0.000 0.000 0.040 0.044
#> SRR2015753     1  0.0000     0.9720 1.000 0.000 0.000 0.000 0.000
#> SRR2015746     5  0.4740     0.7124 0.000 0.000 0.468 0.016 0.516
#> SRR2015758     2  0.0898     0.8665 0.000 0.972 0.000 0.020 0.008
#> SRR2015756     1  0.0000     0.9720 1.000 0.000 0.000 0.000 0.000
#> SRR2015757     4  0.2597     0.8640 0.000 0.024 0.092 0.884 0.000
#> SRR2015755     1  0.0000     0.9720 1.000 0.000 0.000 0.000 0.000
#> SRR2015754     1  0.2153     0.9588 0.916 0.000 0.000 0.040 0.044
#> SRR2015752     1  0.0000     0.9720 1.000 0.000 0.000 0.000 0.000
#> SRR2015749     1  0.2153     0.9588 0.916 0.000 0.000 0.040 0.044
#> SRR2015750     2  0.4485     0.5997 0.000 0.680 0.000 0.292 0.028
#> SRR2015751     5  0.5708     0.7472 0.000 0.000 0.384 0.088 0.528
#> SRR2015748     5  0.4520     0.6593 0.008 0.000 0.296 0.016 0.680
#> SRR2015747     1  0.0000     0.9720 1.000 0.000 0.000 0.000 0.000
#> SRR2015745     4  0.5216     0.4721 0.000 0.012 0.032 0.596 0.360
#> SRR2015743     1  0.0000     0.9720 1.000 0.000 0.000 0.000 0.000
#> SRR2015744     5  0.5165     0.7111 0.000 0.000 0.448 0.040 0.512
#> SRR2015742     5  0.5708     0.7472 0.000 0.000 0.384 0.088 0.528
#> SRR2015741     1  0.0000     0.9720 1.000 0.000 0.000 0.000 0.000
#> SRR2015740     1  0.0693     0.9709 0.980 0.000 0.000 0.012 0.008
#> SRR2015738     1  0.2153     0.9588 0.916 0.000 0.000 0.040 0.044
#> SRR2015739     1  0.0000     0.9720 1.000 0.000 0.000 0.000 0.000
#> SRR2015737     2  0.2233     0.8471 0.000 0.892 0.000 0.104 0.004
#> SRR2015736     4  0.2439     0.8821 0.000 0.000 0.120 0.876 0.004
#> SRR2015732     3  0.0290     0.9359 0.000 0.000 0.992 0.000 0.008
#> SRR2015733     2  0.2074     0.8481 0.000 0.896 0.000 0.104 0.000
#> SRR2015734     3  0.0000     0.9391 0.000 0.000 1.000 0.000 0.000
#> SRR2015731     4  0.3487     0.7688 0.000 0.000 0.212 0.780 0.008
#> SRR2015730     1  0.2026     0.9619 0.928 0.000 0.012 0.016 0.044
#> SRR2015728     3  0.5102     0.0205 0.000 0.000 0.580 0.044 0.376
#> SRR2015729     4  0.2389     0.8855 0.000 0.004 0.116 0.880 0.000
#> SRR2015727     3  0.1082     0.9177 0.000 0.000 0.964 0.008 0.028
#> SRR2015726     3  0.0000     0.9391 0.000 0.000 1.000 0.000 0.000
#> SRR2015723     3  0.0000     0.9391 0.000 0.000 1.000 0.000 0.000
#> SRR2015724     3  0.0955     0.9215 0.000 0.000 0.968 0.004 0.028
#> SRR2015725     1  0.2026     0.9619 0.928 0.000 0.012 0.016 0.044
#> SRR2015722     3  0.1082     0.9177 0.000 0.000 0.964 0.008 0.028
#> SRR2015721     4  0.2561     0.8675 0.000 0.020 0.096 0.884 0.000
#> SRR2015720     4  0.2439     0.8821 0.000 0.000 0.120 0.876 0.004
#> SRR2015718     3  0.1082     0.9177 0.000 0.000 0.964 0.008 0.028
#> SRR2015719     2  0.3940     0.8340 0.000 0.756 0.000 0.024 0.220
#> SRR2015717     3  0.0000     0.9391 0.000 0.000 1.000 0.000 0.000
#> SRR2015716     3  0.0000     0.9391 0.000 0.000 1.000 0.000 0.000
#> SRR2015714     2  0.3940     0.8340 0.000 0.756 0.000 0.024 0.220
#> SRR2015713     4  0.2597     0.8640 0.000 0.024 0.092 0.884 0.000
#> SRR2015784     2  0.2408     0.8622 0.000 0.892 0.000 0.016 0.092
#> SRR2015785     2  0.2707     0.8598 0.000 0.876 0.000 0.024 0.100
#> SRR2015783     1  0.1626     0.9648 0.940 0.000 0.000 0.016 0.044
#> SRR2015782     4  0.5254     0.4698 0.000 0.008 0.040 0.592 0.360
#> SRR2015781     2  0.2293     0.8642 0.000 0.900 0.000 0.016 0.084
#> SRR2015780     4  0.5015     0.5586 0.000 0.012 0.032 0.648 0.308
#> SRR2015779     2  0.2966     0.8533 0.000 0.816 0.000 0.000 0.184
#> SRR2015778     5  0.5518     0.0301 0.000 0.000 0.072 0.384 0.544
#> SRR2015777     5  0.4740     0.7124 0.000 0.000 0.468 0.016 0.516
#> SRR2015776     2  0.3759     0.8362 0.000 0.764 0.000 0.016 0.220
#> SRR2015775     4  0.2389     0.8855 0.000 0.004 0.116 0.880 0.000
#> SRR2015774     4  0.2280     0.8834 0.000 0.000 0.120 0.880 0.000
#> SRR2015773     2  0.2573     0.8430 0.000 0.880 0.000 0.104 0.016
#> SRR2015772     2  0.2074     0.8481 0.000 0.896 0.000 0.104 0.000
#> SRR2015771     3  0.0000     0.9391 0.000 0.000 1.000 0.000 0.000
#> SRR2015769     4  0.2389     0.8855 0.000 0.004 0.116 0.880 0.000
#> SRR2015770     2  0.2873     0.8640 0.000 0.860 0.000 0.020 0.120
#> SRR2015768     2  0.2331     0.8694 0.000 0.900 0.000 0.020 0.080
#> SRR2015767     2  0.3940     0.8340 0.000 0.756 0.000 0.024 0.220
#> SRR2015766     3  0.2069     0.8270 0.000 0.000 0.912 0.076 0.012
#> SRR2015764     2  0.2233     0.8471 0.000 0.892 0.000 0.104 0.004
#> SRR2015765     4  0.2389     0.8855 0.000 0.004 0.116 0.880 0.000
#> SRR2015763     3  0.0000     0.9391 0.000 0.000 1.000 0.000 0.000
#> SRR2015762     2  0.2723     0.8631 0.000 0.864 0.000 0.012 0.124
#> SRR2015761     4  0.2389     0.8855 0.000 0.004 0.116 0.880 0.000
#> SRR2015760     3  0.0290     0.9359 0.000 0.000 0.992 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
#> SRR2015715     3  0.0000      0.928 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2015735     3  0.0000      0.928 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2015759     1  0.3171      0.882 0.784 0.000 0.000 0.204 0.012 0.000
#> SRR2015753     1  0.0000      0.915 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2015746     5  0.4310      0.661 0.000 0.000 0.268 0.044 0.684 0.004
#> SRR2015758     2  0.3953      0.207 0.000 0.656 0.000 0.328 0.000 0.016
#> SRR2015756     1  0.0000      0.915 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2015757     6  0.1148      0.951 0.000 0.000 0.016 0.020 0.004 0.960
#> SRR2015755     1  0.0146      0.915 0.996 0.000 0.000 0.000 0.004 0.000
#> SRR2015754     1  0.3342      0.870 0.760 0.000 0.000 0.228 0.012 0.000
#> SRR2015752     1  0.0000      0.915 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2015749     1  0.3171      0.882 0.784 0.000 0.000 0.204 0.012 0.000
#> SRR2015750     4  0.6267      0.000 0.000 0.368 0.000 0.396 0.012 0.224
#> SRR2015751     5  0.3424      0.697 0.000 0.000 0.204 0.000 0.772 0.024
#> SRR2015748     5  0.3947      0.668 0.000 0.000 0.136 0.100 0.764 0.000
#> SRR2015747     1  0.0146      0.915 0.996 0.000 0.000 0.000 0.004 0.000
#> SRR2015745     5  0.5011      0.405 0.000 0.000 0.000 0.080 0.552 0.368
#> SRR2015743     1  0.0000      0.915 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2015744     5  0.4990      0.653 0.000 0.000 0.256 0.104 0.636 0.004
#> SRR2015742     5  0.3424      0.697 0.000 0.000 0.204 0.000 0.772 0.024
#> SRR2015741     1  0.0146      0.915 0.996 0.000 0.000 0.000 0.004 0.000
#> SRR2015740     1  0.1524      0.912 0.932 0.000 0.000 0.060 0.008 0.000
#> SRR2015738     1  0.3342      0.870 0.760 0.000 0.000 0.228 0.012 0.000
#> SRR2015739     1  0.0000      0.915 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2015737     2  0.5157     -0.181 0.000 0.544 0.000 0.360 0.000 0.096
#> SRR2015736     6  0.1116      0.967 0.000 0.000 0.028 0.008 0.004 0.960
#> SRR2015732     3  0.0935      0.918 0.000 0.000 0.964 0.004 0.032 0.000
#> SRR2015733     2  0.5116     -0.162 0.000 0.560 0.000 0.344 0.000 0.096
#> SRR2015734     3  0.0000      0.928 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2015731     6  0.3210      0.801 0.000 0.000 0.108 0.020 0.032 0.840
#> SRR2015730     1  0.3488      0.887 0.800 0.000 0.028 0.160 0.012 0.000
#> SRR2015728     3  0.6193      0.135 0.000 0.000 0.460 0.232 0.296 0.012
#> SRR2015729     6  0.0713      0.971 0.000 0.000 0.028 0.000 0.000 0.972
#> SRR2015727     3  0.2103      0.897 0.000 0.000 0.912 0.020 0.056 0.012
#> SRR2015726     3  0.0000      0.928 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2015723     3  0.0000      0.928 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2015724     3  0.1820      0.903 0.000 0.000 0.924 0.008 0.056 0.012
#> SRR2015725     1  0.3561      0.885 0.796 0.000 0.032 0.160 0.012 0.000
#> SRR2015722     3  0.2103      0.897 0.000 0.000 0.912 0.020 0.056 0.012
#> SRR2015721     6  0.0964      0.957 0.000 0.000 0.016 0.012 0.004 0.968
#> SRR2015720     6  0.1194      0.965 0.000 0.000 0.032 0.008 0.004 0.956
#> SRR2015718     3  0.1921      0.901 0.000 0.000 0.920 0.012 0.056 0.012
#> SRR2015719     2  0.2398      0.441 0.000 0.876 0.000 0.104 0.020 0.000
#> SRR2015717     3  0.0000      0.928 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2015716     3  0.0000      0.928 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2015714     2  0.2398      0.441 0.000 0.876 0.000 0.104 0.020 0.000
#> SRR2015713     6  0.1148      0.951 0.000 0.000 0.016 0.020 0.004 0.960
#> SRR2015784     2  0.4801      0.233 0.000 0.672 0.000 0.244 0.068 0.016
#> SRR2015785     2  0.4978      0.235 0.000 0.644 0.000 0.268 0.072 0.016
#> SRR2015783     1  0.2859      0.895 0.828 0.000 0.000 0.156 0.016 0.000
#> SRR2015782     5  0.5037      0.393 0.000 0.000 0.000 0.080 0.540 0.380
#> SRR2015781     2  0.4401      0.261 0.000 0.696 0.000 0.248 0.044 0.012
#> SRR2015780     5  0.5102      0.279 0.000 0.000 0.000 0.080 0.492 0.428
#> SRR2015779     2  0.0000      0.455 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2015778     5  0.2982      0.644 0.000 0.000 0.012 0.004 0.820 0.164
#> SRR2015777     5  0.4310      0.661 0.000 0.000 0.268 0.044 0.684 0.004
#> SRR2015776     2  0.2218      0.442 0.000 0.884 0.000 0.104 0.012 0.000
#> SRR2015775     6  0.0713      0.971 0.000 0.000 0.028 0.000 0.000 0.972
#> SRR2015774     6  0.0713      0.971 0.000 0.000 0.028 0.000 0.000 0.972
#> SRR2015773     2  0.5314     -0.238 0.000 0.528 0.000 0.372 0.004 0.096
#> SRR2015772     2  0.5147     -0.171 0.000 0.548 0.000 0.356 0.000 0.096
#> SRR2015771     3  0.0000      0.928 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2015769     6  0.0713      0.971 0.000 0.000 0.028 0.000 0.000 0.972
#> SRR2015770     2  0.3136      0.369 0.000 0.796 0.000 0.188 0.000 0.016
#> SRR2015768     2  0.3431      0.340 0.000 0.756 0.000 0.228 0.000 0.016
#> SRR2015767     2  0.2398      0.441 0.000 0.876 0.000 0.104 0.020 0.000
#> SRR2015766     3  0.3371      0.791 0.000 0.000 0.828 0.020 0.036 0.116
#> SRR2015764     2  0.5157     -0.181 0.000 0.544 0.000 0.360 0.000 0.096
#> SRR2015765     6  0.0713      0.971 0.000 0.000 0.028 0.000 0.000 0.972
#> SRR2015763     3  0.0000      0.928 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2015762     2  0.2730      0.389 0.000 0.836 0.000 0.152 0.000 0.012
#> SRR2015761     6  0.0713      0.971 0.000 0.000 0.028 0.000 0.000 0.972
#> SRR2015760     3  0.0972      0.918 0.000 0.000 0.964 0.008 0.028 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-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

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

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

collect_plots(res)

plot of chunk ATC-skmeans-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 1.000           0.997       0.999         0.5064 0.494   0.494
#> 3 3 0.872           0.957       0.966         0.2770 0.823   0.652
#> 4 4 0.835           0.856       0.911         0.0965 0.940   0.831
#> 5 5 0.824           0.661       0.776         0.0660 0.915   0.723
#> 6 6 0.867           0.779       0.876         0.0542 0.885   0.573

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
#> SRR2015715     1   0.000      1.000 1.000 0.000
#> SRR2015735     1   0.000      1.000 1.000 0.000
#> SRR2015759     1   0.000      1.000 1.000 0.000
#> SRR2015753     1   0.000      1.000 1.000 0.000
#> SRR2015746     1   0.000      1.000 1.000 0.000
#> SRR2015758     2   0.000      0.997 0.000 1.000
#> SRR2015756     1   0.000      1.000 1.000 0.000
#> SRR2015757     2   0.000      0.997 0.000 1.000
#> SRR2015755     1   0.000      1.000 1.000 0.000
#> SRR2015754     1   0.000      1.000 1.000 0.000
#> SRR2015752     1   0.000      1.000 1.000 0.000
#> SRR2015749     1   0.000      1.000 1.000 0.000
#> SRR2015750     2   0.000      0.997 0.000 1.000
#> SRR2015751     1   0.000      1.000 1.000 0.000
#> SRR2015748     1   0.000      1.000 1.000 0.000
#> SRR2015747     1   0.000      1.000 1.000 0.000
#> SRR2015745     2   0.000      0.997 0.000 1.000
#> SRR2015743     1   0.000      1.000 1.000 0.000
#> SRR2015744     1   0.000      1.000 1.000 0.000
#> SRR2015742     1   0.000      1.000 1.000 0.000
#> SRR2015741     1   0.000      1.000 1.000 0.000
#> SRR2015740     1   0.000      1.000 1.000 0.000
#> SRR2015738     1   0.000      1.000 1.000 0.000
#> SRR2015739     1   0.000      1.000 1.000 0.000
#> SRR2015737     2   0.000      0.997 0.000 1.000
#> SRR2015736     2   0.000      0.997 0.000 1.000
#> SRR2015732     1   0.000      1.000 1.000 0.000
#> SRR2015733     2   0.000      0.997 0.000 1.000
#> SRR2015734     1   0.000      1.000 1.000 0.000
#> SRR2015731     2   0.000      0.997 0.000 1.000
#> SRR2015730     1   0.000      1.000 1.000 0.000
#> SRR2015728     1   0.000      1.000 1.000 0.000
#> SRR2015729     2   0.000      0.997 0.000 1.000
#> SRR2015727     1   0.000      1.000 1.000 0.000
#> SRR2015726     1   0.000      1.000 1.000 0.000
#> SRR2015723     1   0.000      1.000 1.000 0.000
#> SRR2015724     1   0.000      1.000 1.000 0.000
#> SRR2015725     1   0.000      1.000 1.000 0.000
#> SRR2015722     1   0.000      1.000 1.000 0.000
#> SRR2015721     2   0.000      0.997 0.000 1.000
#> SRR2015720     2   0.000      0.997 0.000 1.000
#> SRR2015718     1   0.000      1.000 1.000 0.000
#> SRR2015719     2   0.000      0.997 0.000 1.000
#> SRR2015717     1   0.000      1.000 1.000 0.000
#> SRR2015716     1   0.000      1.000 1.000 0.000
#> SRR2015714     2   0.000      0.997 0.000 1.000
#> SRR2015713     2   0.000      0.997 0.000 1.000
#> SRR2015784     2   0.000      0.997 0.000 1.000
#> SRR2015785     2   0.000      0.997 0.000 1.000
#> SRR2015783     1   0.000      1.000 1.000 0.000
#> SRR2015782     2   0.000      0.997 0.000 1.000
#> SRR2015781     2   0.000      0.997 0.000 1.000
#> SRR2015780     2   0.000      0.997 0.000 1.000
#> SRR2015779     2   0.000      0.997 0.000 1.000
#> SRR2015778     2   0.000      0.997 0.000 1.000
#> SRR2015777     1   0.000      1.000 1.000 0.000
#> SRR2015776     2   0.000      0.997 0.000 1.000
#> SRR2015775     2   0.000      0.997 0.000 1.000
#> SRR2015774     2   0.000      0.997 0.000 1.000
#> SRR2015773     2   0.000      0.997 0.000 1.000
#> SRR2015772     2   0.000      0.997 0.000 1.000
#> SRR2015771     1   0.000      1.000 1.000 0.000
#> SRR2015769     2   0.000      0.997 0.000 1.000
#> SRR2015770     2   0.000      0.997 0.000 1.000
#> SRR2015768     2   0.000      0.997 0.000 1.000
#> SRR2015767     2   0.000      0.997 0.000 1.000
#> SRR2015766     2   0.443      0.899 0.092 0.908
#> SRR2015764     2   0.000      0.997 0.000 1.000
#> SRR2015765     2   0.000      0.997 0.000 1.000
#> SRR2015763     1   0.000      1.000 1.000 0.000
#> SRR2015762     2   0.000      0.997 0.000 1.000
#> SRR2015761     2   0.000      0.997 0.000 1.000
#> SRR2015760     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
#> SRR2015715     3   0.000      0.978 0.000 0.000 1.000
#> SRR2015735     3   0.000      0.978 0.000 0.000 1.000
#> SRR2015759     1   0.327      0.943 0.884 0.000 0.116
#> SRR2015753     1   0.327      0.943 0.884 0.000 0.116
#> SRR2015746     1   0.000      0.891 1.000 0.000 0.000
#> SRR2015758     2   0.000      0.993 0.000 1.000 0.000
#> SRR2015756     1   0.327      0.943 0.884 0.000 0.116
#> SRR2015757     2   0.000      0.993 0.000 1.000 0.000
#> SRR2015755     1   0.327      0.943 0.884 0.000 0.116
#> SRR2015754     1   0.327      0.943 0.884 0.000 0.116
#> SRR2015752     1   0.327      0.943 0.884 0.000 0.116
#> SRR2015749     1   0.327      0.943 0.884 0.000 0.116
#> SRR2015750     2   0.000      0.993 0.000 1.000 0.000
#> SRR2015751     1   0.000      0.891 1.000 0.000 0.000
#> SRR2015748     1   0.000      0.891 1.000 0.000 0.000
#> SRR2015747     1   0.327      0.943 0.884 0.000 0.116
#> SRR2015745     2   0.207      0.945 0.060 0.940 0.000
#> SRR2015743     1   0.327      0.943 0.884 0.000 0.116
#> SRR2015744     1   0.186      0.917 0.948 0.000 0.052
#> SRR2015742     1   0.000      0.891 1.000 0.000 0.000
#> SRR2015741     1   0.327      0.943 0.884 0.000 0.116
#> SRR2015740     1   0.327      0.943 0.884 0.000 0.116
#> SRR2015738     1   0.327      0.943 0.884 0.000 0.116
#> SRR2015739     1   0.327      0.943 0.884 0.000 0.116
#> SRR2015737     2   0.000      0.993 0.000 1.000 0.000
#> SRR2015736     2   0.000      0.993 0.000 1.000 0.000
#> SRR2015732     3   0.000      0.978 0.000 0.000 1.000
#> SRR2015733     2   0.000      0.993 0.000 1.000 0.000
#> SRR2015734     3   0.000      0.978 0.000 0.000 1.000
#> SRR2015731     2   0.296      0.889 0.000 0.900 0.100
#> SRR2015730     3   0.000      0.978 0.000 0.000 1.000
#> SRR2015728     3   0.540      0.548 0.280 0.000 0.720
#> SRR2015729     2   0.000      0.993 0.000 1.000 0.000
#> SRR2015727     3   0.000      0.978 0.000 0.000 1.000
#> SRR2015726     3   0.000      0.978 0.000 0.000 1.000
#> SRR2015723     3   0.000      0.978 0.000 0.000 1.000
#> SRR2015724     3   0.000      0.978 0.000 0.000 1.000
#> SRR2015725     3   0.000      0.978 0.000 0.000 1.000
#> SRR2015722     3   0.000      0.978 0.000 0.000 1.000
#> SRR2015721     2   0.000      0.993 0.000 1.000 0.000
#> SRR2015720     2   0.000      0.993 0.000 1.000 0.000
#> SRR2015718     3   0.000      0.978 0.000 0.000 1.000
#> SRR2015719     2   0.000      0.993 0.000 1.000 0.000
#> SRR2015717     3   0.000      0.978 0.000 0.000 1.000
#> SRR2015716     3   0.000      0.978 0.000 0.000 1.000
#> SRR2015714     2   0.000      0.993 0.000 1.000 0.000
#> SRR2015713     2   0.000      0.993 0.000 1.000 0.000
#> SRR2015784     2   0.000      0.993 0.000 1.000 0.000
#> SRR2015785     2   0.000      0.993 0.000 1.000 0.000
#> SRR2015783     1   0.327      0.943 0.884 0.000 0.116
#> SRR2015782     2   0.207      0.945 0.060 0.940 0.000
#> SRR2015781     2   0.000      0.993 0.000 1.000 0.000
#> SRR2015780     2   0.000      0.993 0.000 1.000 0.000
#> SRR2015779     2   0.000      0.993 0.000 1.000 0.000
#> SRR2015778     1   0.506      0.615 0.756 0.244 0.000
#> SRR2015777     1   0.000      0.891 1.000 0.000 0.000
#> SRR2015776     2   0.000      0.993 0.000 1.000 0.000
#> SRR2015775     2   0.000      0.993 0.000 1.000 0.000
#> SRR2015774     2   0.000      0.993 0.000 1.000 0.000
#> SRR2015773     2   0.000      0.993 0.000 1.000 0.000
#> SRR2015772     2   0.000      0.993 0.000 1.000 0.000
#> SRR2015771     3   0.000      0.978 0.000 0.000 1.000
#> SRR2015769     2   0.000      0.993 0.000 1.000 0.000
#> SRR2015770     2   0.000      0.993 0.000 1.000 0.000
#> SRR2015768     2   0.000      0.993 0.000 1.000 0.000
#> SRR2015767     2   0.000      0.993 0.000 1.000 0.000
#> SRR2015766     3   0.207      0.900 0.000 0.060 0.940
#> SRR2015764     2   0.000      0.993 0.000 1.000 0.000
#> SRR2015765     2   0.000      0.993 0.000 1.000 0.000
#> SRR2015763     3   0.000      0.978 0.000 0.000 1.000
#> SRR2015762     2   0.000      0.993 0.000 1.000 0.000
#> SRR2015761     2   0.000      0.993 0.000 1.000 0.000
#> SRR2015760     3   0.000      0.978 0.000 0.000 1.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> SRR2015715     3  0.1867      0.964 0.072 0.000 0.928 0.000
#> SRR2015735     3  0.2408      0.945 0.104 0.000 0.896 0.000
#> SRR2015759     1  0.0000      0.932 1.000 0.000 0.000 0.000
#> SRR2015753     1  0.0000      0.932 1.000 0.000 0.000 0.000
#> SRR2015746     1  0.3975      0.643 0.760 0.000 0.000 0.240
#> SRR2015758     2  0.0000      0.888 0.000 1.000 0.000 0.000
#> SRR2015756     1  0.0000      0.932 1.000 0.000 0.000 0.000
#> SRR2015757     2  0.1890      0.869 0.000 0.936 0.008 0.056
#> SRR2015755     1  0.0000      0.932 1.000 0.000 0.000 0.000
#> SRR2015754     1  0.0000      0.932 1.000 0.000 0.000 0.000
#> SRR2015752     1  0.0000      0.932 1.000 0.000 0.000 0.000
#> SRR2015749     1  0.0000      0.932 1.000 0.000 0.000 0.000
#> SRR2015750     2  0.0000      0.888 0.000 1.000 0.000 0.000
#> SRR2015751     4  0.4643      0.468 0.344 0.000 0.000 0.656
#> SRR2015748     1  0.2149      0.841 0.912 0.000 0.000 0.088
#> SRR2015747     1  0.0000      0.932 1.000 0.000 0.000 0.000
#> SRR2015745     4  0.3123      0.698 0.000 0.156 0.000 0.844
#> SRR2015743     1  0.0000      0.932 1.000 0.000 0.000 0.000
#> SRR2015744     1  0.1022      0.903 0.968 0.000 0.000 0.032
#> SRR2015742     4  0.4643      0.468 0.344 0.000 0.000 0.656
#> SRR2015741     1  0.0000      0.932 1.000 0.000 0.000 0.000
#> SRR2015740     1  0.0000      0.932 1.000 0.000 0.000 0.000
#> SRR2015738     1  0.0000      0.932 1.000 0.000 0.000 0.000
#> SRR2015739     1  0.0000      0.932 1.000 0.000 0.000 0.000
#> SRR2015737     2  0.0000      0.888 0.000 1.000 0.000 0.000
#> SRR2015736     2  0.1890      0.869 0.000 0.936 0.008 0.056
#> SRR2015732     3  0.2011      0.962 0.080 0.000 0.920 0.000
#> SRR2015733     2  0.0707      0.885 0.000 0.980 0.000 0.020
#> SRR2015734     3  0.2011      0.962 0.080 0.000 0.920 0.000
#> SRR2015731     2  0.4163      0.768 0.000 0.828 0.076 0.096
#> SRR2015730     3  0.2760      0.923 0.128 0.000 0.872 0.000
#> SRR2015728     1  0.5746      0.388 0.612 0.000 0.348 0.040
#> SRR2015729     2  0.0657      0.886 0.000 0.984 0.004 0.012
#> SRR2015727     3  0.1545      0.893 0.008 0.000 0.952 0.040
#> SRR2015726     3  0.2011      0.962 0.080 0.000 0.920 0.000
#> SRR2015723     3  0.1792      0.964 0.068 0.000 0.932 0.000
#> SRR2015724     3  0.1792      0.964 0.068 0.000 0.932 0.000
#> SRR2015725     3  0.2921      0.910 0.140 0.000 0.860 0.000
#> SRR2015722     3  0.1545      0.893 0.008 0.000 0.952 0.040
#> SRR2015721     2  0.1890      0.869 0.000 0.936 0.008 0.056
#> SRR2015720     2  0.1890      0.869 0.000 0.936 0.008 0.056
#> SRR2015718     3  0.1792      0.964 0.068 0.000 0.932 0.000
#> SRR2015719     2  0.4040      0.742 0.000 0.752 0.000 0.248
#> SRR2015717     3  0.1792      0.964 0.068 0.000 0.932 0.000
#> SRR2015716     3  0.1792      0.964 0.068 0.000 0.932 0.000
#> SRR2015714     2  0.4040      0.742 0.000 0.752 0.000 0.248
#> SRR2015713     2  0.1890      0.869 0.000 0.936 0.008 0.056
#> SRR2015784     2  0.4040      0.742 0.000 0.752 0.000 0.248
#> SRR2015785     2  0.4040      0.742 0.000 0.752 0.000 0.248
#> SRR2015783     1  0.0000      0.932 1.000 0.000 0.000 0.000
#> SRR2015782     4  0.3123      0.698 0.000 0.156 0.000 0.844
#> SRR2015781     2  0.4040      0.742 0.000 0.752 0.000 0.248
#> SRR2015780     2  0.4040      0.742 0.000 0.752 0.000 0.248
#> SRR2015779     2  0.4040      0.742 0.000 0.752 0.000 0.248
#> SRR2015778     4  0.2759      0.720 0.044 0.052 0.000 0.904
#> SRR2015777     1  0.3837      0.670 0.776 0.000 0.000 0.224
#> SRR2015776     2  0.4040      0.742 0.000 0.752 0.000 0.248
#> SRR2015775     2  0.1890      0.869 0.000 0.936 0.008 0.056
#> SRR2015774     2  0.1890      0.869 0.000 0.936 0.008 0.056
#> SRR2015773     2  0.0000      0.888 0.000 1.000 0.000 0.000
#> SRR2015772     2  0.0188      0.887 0.000 0.996 0.000 0.004
#> SRR2015771     3  0.1867      0.964 0.072 0.000 0.928 0.000
#> SRR2015769     2  0.0657      0.886 0.000 0.984 0.004 0.012
#> SRR2015770     2  0.0000      0.888 0.000 1.000 0.000 0.000
#> SRR2015768     2  0.0000      0.888 0.000 1.000 0.000 0.000
#> SRR2015767     2  0.4040      0.742 0.000 0.752 0.000 0.248
#> SRR2015766     3  0.1940      0.855 0.000 0.000 0.924 0.076
#> SRR2015764     2  0.0469      0.887 0.000 0.988 0.000 0.012
#> SRR2015765     2  0.0000      0.888 0.000 1.000 0.000 0.000
#> SRR2015763     3  0.1867      0.964 0.072 0.000 0.928 0.000
#> SRR2015762     2  0.0000      0.888 0.000 1.000 0.000 0.000
#> SRR2015761     2  0.0592      0.886 0.000 0.984 0.000 0.016
#> SRR2015760     3  0.1792      0.964 0.068 0.000 0.932 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
#> SRR2015715     3  0.0162     0.9093 0.004 0.000 0.996 0.000 0.000
#> SRR2015735     3  0.0794     0.8970 0.028 0.000 0.972 0.000 0.000
#> SRR2015759     1  0.0162     0.9236 0.996 0.000 0.004 0.000 0.000
#> SRR2015753     1  0.0162     0.9236 0.996 0.000 0.004 0.000 0.000
#> SRR2015746     1  0.3906     0.5553 0.704 0.000 0.000 0.004 0.292
#> SRR2015758     2  0.4150     0.3994 0.000 0.612 0.000 0.388 0.000
#> SRR2015756     1  0.0162     0.9236 0.996 0.000 0.004 0.000 0.000
#> SRR2015757     2  0.0000     0.4200 0.000 1.000 0.000 0.000 0.000
#> SRR2015755     1  0.0162     0.9236 0.996 0.000 0.004 0.000 0.000
#> SRR2015754     1  0.0162     0.9236 0.996 0.000 0.004 0.000 0.000
#> SRR2015752     1  0.0162     0.9236 0.996 0.000 0.004 0.000 0.000
#> SRR2015749     1  0.0162     0.9236 0.996 0.000 0.004 0.000 0.000
#> SRR2015750     2  0.4126     0.4051 0.000 0.620 0.000 0.380 0.000
#> SRR2015751     5  0.2966     0.7562 0.184 0.000 0.000 0.000 0.816
#> SRR2015748     1  0.1571     0.8694 0.936 0.000 0.000 0.004 0.060
#> SRR2015747     1  0.0162     0.9236 0.996 0.000 0.004 0.000 0.000
#> SRR2015745     5  0.3480     0.8289 0.000 0.000 0.000 0.248 0.752
#> SRR2015743     1  0.0162     0.9236 0.996 0.000 0.004 0.000 0.000
#> SRR2015744     1  0.0609     0.9056 0.980 0.000 0.000 0.000 0.020
#> SRR2015742     5  0.2966     0.7562 0.184 0.000 0.000 0.000 0.816
#> SRR2015741     1  0.0162     0.9236 0.996 0.000 0.004 0.000 0.000
#> SRR2015740     1  0.0162     0.9236 0.996 0.000 0.004 0.000 0.000
#> SRR2015738     1  0.0162     0.9236 0.996 0.000 0.004 0.000 0.000
#> SRR2015739     1  0.0162     0.9236 0.996 0.000 0.004 0.000 0.000
#> SRR2015737     2  0.4150     0.3994 0.000 0.612 0.000 0.388 0.000
#> SRR2015736     2  0.0000     0.4200 0.000 1.000 0.000 0.000 0.000
#> SRR2015732     3  0.1281     0.8884 0.012 0.032 0.956 0.000 0.000
#> SRR2015733     2  0.3816     0.3990 0.000 0.696 0.000 0.304 0.000
#> SRR2015734     3  0.0404     0.9067 0.012 0.000 0.988 0.000 0.000
#> SRR2015731     2  0.6521    -0.2162 0.000 0.480 0.004 0.336 0.180
#> SRR2015730     3  0.1608     0.8582 0.072 0.000 0.928 0.000 0.000
#> SRR2015728     1  0.7895     0.0514 0.396 0.000 0.096 0.320 0.188
#> SRR2015729     2  0.4150     0.3963 0.000 0.612 0.000 0.388 0.000
#> SRR2015727     3  0.6478     0.2520 0.000 0.000 0.420 0.396 0.184
#> SRR2015726     3  0.0404     0.9067 0.012 0.000 0.988 0.000 0.000
#> SRR2015723     3  0.0000     0.9075 0.000 0.000 1.000 0.000 0.000
#> SRR2015724     3  0.0162     0.9093 0.004 0.000 0.996 0.000 0.000
#> SRR2015725     3  0.1732     0.8495 0.080 0.000 0.920 0.000 0.000
#> SRR2015722     3  0.6478     0.2520 0.000 0.000 0.420 0.396 0.184
#> SRR2015721     2  0.0000     0.4200 0.000 1.000 0.000 0.000 0.000
#> SRR2015720     2  0.0000     0.4200 0.000 1.000 0.000 0.000 0.000
#> SRR2015718     3  0.0162     0.9062 0.000 0.000 0.996 0.004 0.000
#> SRR2015719     4  0.4182     0.7090 0.000 0.400 0.000 0.600 0.000
#> SRR2015717     3  0.0162     0.9093 0.004 0.000 0.996 0.000 0.000
#> SRR2015716     3  0.0162     0.9093 0.004 0.000 0.996 0.000 0.000
#> SRR2015714     4  0.4182     0.7090 0.000 0.400 0.000 0.600 0.000
#> SRR2015713     2  0.0290     0.4223 0.000 0.992 0.000 0.008 0.000
#> SRR2015784     4  0.4182     0.7090 0.000 0.400 0.000 0.600 0.000
#> SRR2015785     4  0.4182     0.7090 0.000 0.400 0.000 0.600 0.000
#> SRR2015783     1  0.0162     0.9236 0.996 0.000 0.004 0.000 0.000
#> SRR2015782     5  0.3480     0.8289 0.000 0.000 0.000 0.248 0.752
#> SRR2015781     4  0.4182     0.7090 0.000 0.400 0.000 0.600 0.000
#> SRR2015780     4  0.4182     0.7090 0.000 0.400 0.000 0.600 0.000
#> SRR2015779     4  0.4182     0.7090 0.000 0.400 0.000 0.600 0.000
#> SRR2015778     5  0.3086     0.8430 0.004 0.000 0.000 0.180 0.816
#> SRR2015777     1  0.3607     0.6412 0.752 0.000 0.000 0.004 0.244
#> SRR2015776     4  0.4182     0.7090 0.000 0.400 0.000 0.600 0.000
#> SRR2015775     2  0.0703     0.4243 0.000 0.976 0.000 0.024 0.000
#> SRR2015774     2  0.0880     0.4237 0.000 0.968 0.000 0.032 0.000
#> SRR2015773     2  0.4150     0.3994 0.000 0.612 0.000 0.388 0.000
#> SRR2015772     2  0.4150     0.3994 0.000 0.612 0.000 0.388 0.000
#> SRR2015771     3  0.0162     0.9093 0.004 0.000 0.996 0.000 0.000
#> SRR2015769     2  0.4150     0.3963 0.000 0.612 0.000 0.388 0.000
#> SRR2015770     2  0.4150     0.3994 0.000 0.612 0.000 0.388 0.000
#> SRR2015768     2  0.4182     0.3598 0.000 0.600 0.000 0.400 0.000
#> SRR2015767     4  0.4182     0.7090 0.000 0.400 0.000 0.600 0.000
#> SRR2015766     4  0.8139    -0.3645 0.000 0.280 0.140 0.396 0.184
#> SRR2015764     2  0.4030     0.4080 0.000 0.648 0.000 0.352 0.000
#> SRR2015765     2  0.4192     0.3434 0.000 0.596 0.000 0.404 0.000
#> SRR2015763     3  0.0162     0.9093 0.004 0.000 0.996 0.000 0.000
#> SRR2015762     2  0.4150     0.3994 0.000 0.612 0.000 0.388 0.000
#> SRR2015761     2  0.4114     0.4081 0.000 0.624 0.000 0.376 0.000
#> SRR2015760     3  0.0000     0.9075 0.000 0.000 1.000 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>            class entropy silhouette    p1    p2    p3    p4    p5    p6
#> SRR2015715     3  0.0146      0.989 0.004 0.000 0.996 0.000 0.000 0.000
#> SRR2015735     3  0.0547      0.979 0.020 0.000 0.980 0.000 0.000 0.000
#> SRR2015759     1  0.0000      0.934 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2015753     1  0.0000      0.934 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2015746     1  0.4653      0.103 0.488 0.000 0.000 0.012 0.480 0.020
#> SRR2015758     2  0.3684      0.557 0.000 0.628 0.000 0.000 0.000 0.372
#> SRR2015756     1  0.0000      0.934 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2015757     6  0.1701      0.850 0.000 0.072 0.000 0.008 0.000 0.920
#> SRR2015755     1  0.0000      0.934 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2015754     1  0.0000      0.934 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2015752     1  0.0000      0.934 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2015749     1  0.0000      0.934 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2015750     2  0.3862      0.306 0.000 0.524 0.000 0.000 0.000 0.476
#> SRR2015751     5  0.0458      0.792 0.016 0.000 0.000 0.000 0.984 0.000
#> SRR2015748     1  0.2247      0.861 0.904 0.000 0.000 0.012 0.060 0.024
#> SRR2015747     1  0.0000      0.934 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2015745     5  0.3674      0.714 0.000 0.268 0.000 0.000 0.716 0.016
#> SRR2015743     1  0.0000      0.934 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2015744     1  0.0820      0.915 0.972 0.000 0.000 0.012 0.000 0.016
#> SRR2015742     5  0.0603      0.790 0.016 0.000 0.000 0.000 0.980 0.004
#> SRR2015741     1  0.0000      0.934 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2015740     1  0.0000      0.934 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2015738     1  0.0000      0.934 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2015739     1  0.0000      0.934 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2015737     2  0.3659      0.566 0.000 0.636 0.000 0.000 0.000 0.364
#> SRR2015736     6  0.1701      0.850 0.000 0.072 0.000 0.008 0.000 0.920
#> SRR2015732     3  0.0405      0.985 0.004 0.000 0.988 0.008 0.000 0.000
#> SRR2015733     6  0.3531      0.430 0.000 0.328 0.000 0.000 0.000 0.672
#> SRR2015734     3  0.0146      0.989 0.004 0.000 0.996 0.000 0.000 0.000
#> SRR2015731     4  0.3426      0.662 0.000 0.004 0.000 0.720 0.000 0.276
#> SRR2015730     3  0.0790      0.967 0.032 0.000 0.968 0.000 0.000 0.000
#> SRR2015728     4  0.2907      0.764 0.096 0.000 0.016 0.860 0.000 0.028
#> SRR2015729     2  0.4048      0.545 0.000 0.644 0.000 0.004 0.012 0.340
#> SRR2015727     4  0.1075      0.854 0.000 0.000 0.048 0.952 0.000 0.000
#> SRR2015726     3  0.0146      0.989 0.004 0.000 0.996 0.000 0.000 0.000
#> SRR2015723     3  0.0363      0.982 0.000 0.000 0.988 0.000 0.000 0.012
#> SRR2015724     3  0.0146      0.989 0.004 0.000 0.996 0.000 0.000 0.000
#> SRR2015725     3  0.0790      0.967 0.032 0.000 0.968 0.000 0.000 0.000
#> SRR2015722     4  0.1075      0.854 0.000 0.000 0.048 0.952 0.000 0.000
#> SRR2015721     6  0.1757      0.850 0.000 0.076 0.000 0.008 0.000 0.916
#> SRR2015720     6  0.1701      0.850 0.000 0.072 0.000 0.008 0.000 0.920
#> SRR2015718     3  0.0725      0.973 0.000 0.000 0.976 0.012 0.000 0.012
#> SRR2015719     2  0.0000      0.688 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2015717     3  0.0146      0.989 0.004 0.000 0.996 0.000 0.000 0.000
#> SRR2015716     3  0.0508      0.984 0.004 0.000 0.984 0.000 0.000 0.012
#> SRR2015714     2  0.0000      0.688 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2015713     6  0.1918      0.848 0.000 0.088 0.000 0.008 0.000 0.904
#> SRR2015784     2  0.0146      0.685 0.000 0.996 0.000 0.000 0.004 0.000
#> SRR2015785     2  0.0146      0.685 0.000 0.996 0.000 0.000 0.004 0.000
#> SRR2015783     1  0.0000      0.934 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2015782     5  0.3717      0.705 0.000 0.276 0.000 0.000 0.708 0.016
#> SRR2015781     2  0.0000      0.688 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2015780     2  0.0405      0.678 0.000 0.988 0.000 0.000 0.008 0.004
#> SRR2015779     2  0.0000      0.688 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2015778     5  0.0820      0.794 0.000 0.012 0.000 0.000 0.972 0.016
#> SRR2015777     1  0.4612      0.270 0.544 0.000 0.000 0.012 0.424 0.020
#> SRR2015776     2  0.0000      0.688 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2015775     6  0.2455      0.829 0.000 0.112 0.000 0.004 0.012 0.872
#> SRR2015774     6  0.3020      0.779 0.000 0.156 0.000 0.008 0.012 0.824
#> SRR2015773     2  0.3706      0.545 0.000 0.620 0.000 0.000 0.000 0.380
#> SRR2015772     2  0.3782      0.490 0.000 0.588 0.000 0.000 0.000 0.412
#> SRR2015771     3  0.0146      0.989 0.004 0.000 0.996 0.000 0.000 0.000
#> SRR2015769     2  0.4138      0.511 0.000 0.616 0.000 0.004 0.012 0.368
#> SRR2015770     2  0.3684      0.557 0.000 0.628 0.000 0.000 0.000 0.372
#> SRR2015768     2  0.3221      0.636 0.000 0.736 0.000 0.000 0.000 0.264
#> SRR2015767     2  0.0000      0.688 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2015766     4  0.1745      0.846 0.000 0.000 0.020 0.924 0.000 0.056
#> SRR2015764     6  0.3684      0.293 0.000 0.372 0.000 0.000 0.000 0.628
#> SRR2015765     2  0.3250      0.647 0.000 0.788 0.000 0.004 0.012 0.196
#> SRR2015763     3  0.0146      0.989 0.004 0.000 0.996 0.000 0.000 0.000
#> SRR2015762     2  0.3672      0.562 0.000 0.632 0.000 0.000 0.000 0.368
#> SRR2015761     2  0.3961      0.419 0.000 0.556 0.000 0.000 0.004 0.440
#> SRR2015760     3  0.0000      0.986 0.000 0.000 1.000 0.000 0.000 0.000

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

consensus_heatmap(res, k = 2)

plot of chunk tab-ATC-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

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

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

collect_plots(res)

plot of chunk ATC-pam-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 1.000           1.000       1.000         0.4997 0.501   0.501
#> 3 3 0.936           0.932       0.973         0.3156 0.748   0.538
#> 4 4 0.817           0.794       0.909         0.0943 0.916   0.763
#> 5 5 0.824           0.742       0.882         0.0688 0.906   0.698
#> 6 6 0.885           0.802       0.917         0.0734 0.895   0.591

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
#> SRR2015715     1       0          1  1  0
#> SRR2015735     1       0          1  1  0
#> SRR2015759     1       0          1  1  0
#> SRR2015753     1       0          1  1  0
#> SRR2015746     1       0          1  1  0
#> SRR2015758     2       0          1  0  1
#> SRR2015756     1       0          1  1  0
#> SRR2015757     2       0          1  0  1
#> SRR2015755     1       0          1  1  0
#> SRR2015754     1       0          1  1  0
#> SRR2015752     1       0          1  1  0
#> SRR2015749     1       0          1  1  0
#> SRR2015750     2       0          1  0  1
#> SRR2015751     1       0          1  1  0
#> SRR2015748     1       0          1  1  0
#> SRR2015747     1       0          1  1  0
#> SRR2015745     2       0          1  0  1
#> SRR2015743     1       0          1  1  0
#> SRR2015744     1       0          1  1  0
#> SRR2015742     1       0          1  1  0
#> SRR2015741     1       0          1  1  0
#> SRR2015740     1       0          1  1  0
#> SRR2015738     1       0          1  1  0
#> SRR2015739     1       0          1  1  0
#> SRR2015737     2       0          1  0  1
#> SRR2015736     2       0          1  0  1
#> SRR2015732     1       0          1  1  0
#> SRR2015733     2       0          1  0  1
#> SRR2015734     1       0          1  1  0
#> SRR2015731     1       0          1  1  0
#> SRR2015730     1       0          1  1  0
#> SRR2015728     1       0          1  1  0
#> SRR2015729     2       0          1  0  1
#> SRR2015727     1       0          1  1  0
#> SRR2015726     1       0          1  1  0
#> SRR2015723     1       0          1  1  0
#> SRR2015724     1       0          1  1  0
#> SRR2015725     1       0          1  1  0
#> SRR2015722     1       0          1  1  0
#> SRR2015721     2       0          1  0  1
#> SRR2015720     2       0          1  0  1
#> SRR2015718     1       0          1  1  0
#> SRR2015719     2       0          1  0  1
#> SRR2015717     1       0          1  1  0
#> SRR2015716     1       0          1  1  0
#> SRR2015714     2       0          1  0  1
#> SRR2015713     2       0          1  0  1
#> SRR2015784     2       0          1  0  1
#> SRR2015785     2       0          1  0  1
#> SRR2015783     1       0          1  1  0
#> SRR2015782     2       0          1  0  1
#> SRR2015781     2       0          1  0  1
#> SRR2015780     2       0          1  0  1
#> SRR2015779     2       0          1  0  1
#> SRR2015778     1       0          1  1  0
#> SRR2015777     1       0          1  1  0
#> SRR2015776     2       0          1  0  1
#> SRR2015775     2       0          1  0  1
#> SRR2015774     2       0          1  0  1
#> SRR2015773     2       0          1  0  1
#> SRR2015772     2       0          1  0  1
#> SRR2015771     1       0          1  1  0
#> SRR2015769     2       0          1  0  1
#> SRR2015770     2       0          1  0  1
#> SRR2015768     2       0          1  0  1
#> SRR2015767     2       0          1  0  1
#> SRR2015766     1       0          1  1  0
#> SRR2015764     2       0          1  0  1
#> SRR2015765     2       0          1  0  1
#> SRR2015763     1       0          1  1  0
#> SRR2015762     2       0          1  0  1
#> SRR2015761     2       0          1  0  1
#> SRR2015760     1       0          1  1  0

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>            class entropy silhouette  p1    p2    p3
#> SRR2015715     3  0.0000      0.968 0.0 0.000 1.000
#> SRR2015735     3  0.0000      0.968 0.0 0.000 1.000
#> SRR2015759     1  0.0000      0.986 1.0 0.000 0.000
#> SRR2015753     1  0.0000      0.986 1.0 0.000 0.000
#> SRR2015746     3  0.0000      0.968 0.0 0.000 1.000
#> SRR2015758     2  0.0000      0.957 0.0 1.000 0.000
#> SRR2015756     1  0.0000      0.986 1.0 0.000 0.000
#> SRR2015757     2  0.0237      0.955 0.0 0.996 0.004
#> SRR2015755     1  0.0000      0.986 1.0 0.000 0.000
#> SRR2015754     1  0.0000      0.986 1.0 0.000 0.000
#> SRR2015752     1  0.0000      0.986 1.0 0.000 0.000
#> SRR2015749     1  0.0000      0.986 1.0 0.000 0.000
#> SRR2015750     2  0.0000      0.957 0.0 1.000 0.000
#> SRR2015751     3  0.0000      0.968 0.0 0.000 1.000
#> SRR2015748     1  0.4555      0.734 0.8 0.000 0.200
#> SRR2015747     1  0.0000      0.986 1.0 0.000 0.000
#> SRR2015745     2  0.4452      0.768 0.0 0.808 0.192
#> SRR2015743     1  0.0000      0.986 1.0 0.000 0.000
#> SRR2015744     3  0.0000      0.968 0.0 0.000 1.000
#> SRR2015742     3  0.0000      0.968 0.0 0.000 1.000
#> SRR2015741     1  0.0000      0.986 1.0 0.000 0.000
#> SRR2015740     1  0.0000      0.986 1.0 0.000 0.000
#> SRR2015738     1  0.0000      0.986 1.0 0.000 0.000
#> SRR2015739     1  0.0000      0.986 1.0 0.000 0.000
#> SRR2015737     2  0.0000      0.957 0.0 1.000 0.000
#> SRR2015736     3  0.0424      0.961 0.0 0.008 0.992
#> SRR2015732     3  0.0000      0.968 0.0 0.000 1.000
#> SRR2015733     2  0.0000      0.957 0.0 1.000 0.000
#> SRR2015734     3  0.0000      0.968 0.0 0.000 1.000
#> SRR2015731     3  0.0000      0.968 0.0 0.000 1.000
#> SRR2015730     1  0.0000      0.986 1.0 0.000 0.000
#> SRR2015728     3  0.0000      0.968 0.0 0.000 1.000
#> SRR2015729     3  0.5968      0.402 0.0 0.364 0.636
#> SRR2015727     3  0.0000      0.968 0.0 0.000 1.000
#> SRR2015726     3  0.0000      0.968 0.0 0.000 1.000
#> SRR2015723     3  0.0000      0.968 0.0 0.000 1.000
#> SRR2015724     3  0.0000      0.968 0.0 0.000 1.000
#> SRR2015725     1  0.0000      0.986 1.0 0.000 0.000
#> SRR2015722     3  0.0000      0.968 0.0 0.000 1.000
#> SRR2015721     2  0.0237      0.955 0.0 0.996 0.004
#> SRR2015720     3  0.0000      0.968 0.0 0.000 1.000
#> SRR2015718     3  0.0000      0.968 0.0 0.000 1.000
#> SRR2015719     2  0.0000      0.957 0.0 1.000 0.000
#> SRR2015717     3  0.0000      0.968 0.0 0.000 1.000
#> SRR2015716     3  0.0000      0.968 0.0 0.000 1.000
#> SRR2015714     2  0.0000      0.957 0.0 1.000 0.000
#> SRR2015713     2  0.0237      0.955 0.0 0.996 0.004
#> SRR2015784     2  0.0000      0.957 0.0 1.000 0.000
#> SRR2015785     2  0.0000      0.957 0.0 1.000 0.000
#> SRR2015783     1  0.0000      0.986 1.0 0.000 0.000
#> SRR2015782     2  0.6045      0.417 0.0 0.620 0.380
#> SRR2015781     2  0.0000      0.957 0.0 1.000 0.000
#> SRR2015780     2  0.0747      0.946 0.0 0.984 0.016
#> SRR2015779     2  0.0000      0.957 0.0 1.000 0.000
#> SRR2015778     3  0.0000      0.968 0.0 0.000 1.000
#> SRR2015777     3  0.0000      0.968 0.0 0.000 1.000
#> SRR2015776     2  0.0000      0.957 0.0 1.000 0.000
#> SRR2015775     2  0.4452      0.768 0.0 0.808 0.192
#> SRR2015774     3  0.0424      0.961 0.0 0.008 0.992
#> SRR2015773     2  0.0000      0.957 0.0 1.000 0.000
#> SRR2015772     2  0.0000      0.957 0.0 1.000 0.000
#> SRR2015771     3  0.0000      0.968 0.0 0.000 1.000
#> SRR2015769     2  0.0237      0.955 0.0 0.996 0.004
#> SRR2015770     2  0.0000      0.957 0.0 1.000 0.000
#> SRR2015768     2  0.0000      0.957 0.0 1.000 0.000
#> SRR2015767     2  0.0000      0.957 0.0 1.000 0.000
#> SRR2015766     3  0.0000      0.968 0.0 0.000 1.000
#> SRR2015764     2  0.0000      0.957 0.0 1.000 0.000
#> SRR2015765     3  0.6168      0.267 0.0 0.412 0.588
#> SRR2015763     3  0.0000      0.968 0.0 0.000 1.000
#> SRR2015762     2  0.0000      0.957 0.0 1.000 0.000
#> SRR2015761     2  0.4452      0.768 0.0 0.808 0.192
#> SRR2015760     3  0.0000      0.968 0.0 0.000 1.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette  p1    p2    p3    p4
#> SRR2015715     3   0.000     0.9388 0.0 0.000 1.000 0.000
#> SRR2015735     3   0.000     0.9388 0.0 0.000 1.000 0.000
#> SRR2015759     1   0.000     0.9842 1.0 0.000 0.000 0.000
#> SRR2015753     1   0.000     0.9842 1.0 0.000 0.000 0.000
#> SRR2015746     3   0.000     0.9388 0.0 0.000 1.000 0.000
#> SRR2015758     2   0.485     0.4125 0.0 0.600 0.000 0.400
#> SRR2015756     1   0.000     0.9842 1.0 0.000 0.000 0.000
#> SRR2015757     2   0.000     0.6862 0.0 1.000 0.000 0.000
#> SRR2015755     1   0.000     0.9842 1.0 0.000 0.000 0.000
#> SRR2015754     1   0.000     0.9842 1.0 0.000 0.000 0.000
#> SRR2015752     1   0.000     0.9842 1.0 0.000 0.000 0.000
#> SRR2015749     1   0.000     0.9842 1.0 0.000 0.000 0.000
#> SRR2015750     2   0.404     0.6543 0.0 0.752 0.000 0.248
#> SRR2015751     3   0.000     0.9388 0.0 0.000 1.000 0.000
#> SRR2015748     1   0.361     0.7179 0.8 0.000 0.200 0.000
#> SRR2015747     1   0.000     0.9842 1.0 0.000 0.000 0.000
#> SRR2015745     2   0.000     0.6862 0.0 1.000 0.000 0.000
#> SRR2015743     1   0.000     0.9842 1.0 0.000 0.000 0.000
#> SRR2015744     3   0.000     0.9388 0.0 0.000 1.000 0.000
#> SRR2015742     3   0.000     0.9388 0.0 0.000 1.000 0.000
#> SRR2015741     1   0.000     0.9842 1.0 0.000 0.000 0.000
#> SRR2015740     1   0.000     0.9842 1.0 0.000 0.000 0.000
#> SRR2015738     1   0.000     0.9842 1.0 0.000 0.000 0.000
#> SRR2015739     1   0.000     0.9842 1.0 0.000 0.000 0.000
#> SRR2015737     2   0.404     0.6543 0.0 0.752 0.000 0.248
#> SRR2015736     3   0.404     0.7544 0.0 0.248 0.752 0.000
#> SRR2015732     3   0.000     0.9388 0.0 0.000 1.000 0.000
#> SRR2015733     2   0.404     0.6543 0.0 0.752 0.000 0.248
#> SRR2015734     3   0.000     0.9388 0.0 0.000 1.000 0.000
#> SRR2015731     3   0.404     0.7544 0.0 0.248 0.752 0.000
#> SRR2015730     1   0.000     0.9842 1.0 0.000 0.000 0.000
#> SRR2015728     3   0.000     0.9388 0.0 0.000 1.000 0.000
#> SRR2015729     2   0.495    -0.0966 0.0 0.556 0.444 0.000
#> SRR2015727     3   0.000     0.9388 0.0 0.000 1.000 0.000
#> SRR2015726     3   0.000     0.9388 0.0 0.000 1.000 0.000
#> SRR2015723     3   0.000     0.9388 0.0 0.000 1.000 0.000
#> SRR2015724     3   0.000     0.9388 0.0 0.000 1.000 0.000
#> SRR2015725     1   0.000     0.9842 1.0 0.000 0.000 0.000
#> SRR2015722     3   0.000     0.9388 0.0 0.000 1.000 0.000
#> SRR2015721     2   0.000     0.6862 0.0 1.000 0.000 0.000
#> SRR2015720     3   0.404     0.7544 0.0 0.248 0.752 0.000
#> SRR2015718     3   0.000     0.9388 0.0 0.000 1.000 0.000
#> SRR2015719     4   0.000     0.8109 0.0 0.000 0.000 1.000
#> SRR2015717     3   0.000     0.9388 0.0 0.000 1.000 0.000
#> SRR2015716     3   0.000     0.9388 0.0 0.000 1.000 0.000
#> SRR2015714     4   0.000     0.8109 0.0 0.000 0.000 1.000
#> SRR2015713     2   0.000     0.6862 0.0 1.000 0.000 0.000
#> SRR2015784     2   0.369     0.6697 0.0 0.792 0.000 0.208
#> SRR2015785     2   0.404     0.6543 0.0 0.752 0.000 0.248
#> SRR2015783     1   0.000     0.9842 1.0 0.000 0.000 0.000
#> SRR2015782     2   0.292     0.5403 0.0 0.860 0.140 0.000
#> SRR2015781     2   0.404     0.6543 0.0 0.752 0.000 0.248
#> SRR2015780     2   0.000     0.6862 0.0 1.000 0.000 0.000
#> SRR2015779     4   0.462     0.4055 0.0 0.340 0.000 0.660
#> SRR2015778     3   0.398     0.7617 0.0 0.240 0.760 0.000
#> SRR2015777     3   0.000     0.9388 0.0 0.000 1.000 0.000
#> SRR2015776     4   0.000     0.8109 0.0 0.000 0.000 1.000
#> SRR2015775     2   0.000     0.6862 0.0 1.000 0.000 0.000
#> SRR2015774     3   0.404     0.7544 0.0 0.248 0.752 0.000
#> SRR2015773     2   0.369     0.6697 0.0 0.792 0.000 0.208
#> SRR2015772     2   0.404     0.6543 0.0 0.752 0.000 0.248
#> SRR2015771     3   0.000     0.9388 0.0 0.000 1.000 0.000
#> SRR2015769     2   0.000     0.6862 0.0 1.000 0.000 0.000
#> SRR2015770     2   0.485     0.4125 0.0 0.600 0.000 0.400
#> SRR2015768     2   0.485     0.4125 0.0 0.600 0.000 0.400
#> SRR2015767     4   0.000     0.8109 0.0 0.000 0.000 1.000
#> SRR2015766     3   0.380     0.7788 0.0 0.220 0.780 0.000
#> SRR2015764     2   0.404     0.6543 0.0 0.752 0.000 0.248
#> SRR2015765     2   0.484     0.0833 0.0 0.604 0.396 0.000
#> SRR2015763     3   0.000     0.9388 0.0 0.000 1.000 0.000
#> SRR2015762     4   0.462     0.4055 0.0 0.340 0.000 0.660
#> SRR2015761     2   0.000     0.6862 0.0 1.000 0.000 0.000
#> SRR2015760     3   0.000     0.9388 0.0 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
#> SRR2015715     3  0.4171     0.8248 0.0 0.000 0.604 0.000 0.396
#> SRR2015735     3  0.4171     0.8248 0.0 0.000 0.604 0.000 0.396
#> SRR2015759     1  0.0000     1.0000 1.0 0.000 0.000 0.000 0.000
#> SRR2015753     1  0.0000     1.0000 1.0 0.000 0.000 0.000 0.000
#> SRR2015746     5  0.0162     0.4911 0.0 0.000 0.004 0.000 0.996
#> SRR2015758     2  0.3752     0.5333 0.0 0.708 0.000 0.292 0.000
#> SRR2015756     1  0.0000     1.0000 1.0 0.000 0.000 0.000 0.000
#> SRR2015757     2  0.4088     0.6132 0.0 0.632 0.368 0.000 0.000
#> SRR2015755     1  0.0000     1.0000 1.0 0.000 0.000 0.000 0.000
#> SRR2015754     1  0.0000     1.0000 1.0 0.000 0.000 0.000 0.000
#> SRR2015752     1  0.0000     1.0000 1.0 0.000 0.000 0.000 0.000
#> SRR2015749     1  0.0000     1.0000 1.0 0.000 0.000 0.000 0.000
#> SRR2015750     2  0.0162     0.7589 0.0 0.996 0.000 0.004 0.000
#> SRR2015751     5  0.0609     0.5143 0.0 0.000 0.020 0.000 0.980
#> SRR2015748     5  0.3109     0.5059 0.2 0.000 0.000 0.000 0.800
#> SRR2015747     1  0.0000     1.0000 1.0 0.000 0.000 0.000 0.000
#> SRR2015745     5  0.5854     0.5779 0.0 0.160 0.240 0.000 0.600
#> SRR2015743     1  0.0000     1.0000 1.0 0.000 0.000 0.000 0.000
#> SRR2015744     3  0.4171     0.8248 0.0 0.000 0.604 0.000 0.396
#> SRR2015742     3  0.4182     0.7905 0.0 0.000 0.600 0.000 0.400
#> SRR2015741     1  0.0000     1.0000 1.0 0.000 0.000 0.000 0.000
#> SRR2015740     1  0.0000     1.0000 1.0 0.000 0.000 0.000 0.000
#> SRR2015738     1  0.0000     1.0000 1.0 0.000 0.000 0.000 0.000
#> SRR2015739     1  0.0000     1.0000 1.0 0.000 0.000 0.000 0.000
#> SRR2015737     2  0.0162     0.7589 0.0 0.996 0.000 0.004 0.000
#> SRR2015736     3  0.0162     0.4542 0.0 0.004 0.996 0.000 0.000
#> SRR2015732     3  0.4171     0.8248 0.0 0.000 0.604 0.000 0.396
#> SRR2015733     2  0.2516     0.6906 0.0 0.860 0.000 0.140 0.000
#> SRR2015734     3  0.4171     0.8248 0.0 0.000 0.604 0.000 0.396
#> SRR2015731     3  0.0162     0.4561 0.0 0.000 0.996 0.000 0.004
#> SRR2015730     1  0.0000     1.0000 1.0 0.000 0.000 0.000 0.000
#> SRR2015728     3  0.4138     0.8169 0.0 0.000 0.616 0.000 0.384
#> SRR2015729     3  0.2732     0.1821 0.0 0.160 0.840 0.000 0.000
#> SRR2015727     3  0.4101     0.8104 0.0 0.000 0.628 0.000 0.372
#> SRR2015726     3  0.4171     0.8248 0.0 0.000 0.604 0.000 0.396
#> SRR2015723     3  0.4171     0.8248 0.0 0.000 0.604 0.000 0.396
#> SRR2015724     3  0.4182     0.8234 0.0 0.000 0.600 0.000 0.400
#> SRR2015725     1  0.0000     1.0000 1.0 0.000 0.000 0.000 0.000
#> SRR2015722     3  0.4101     0.8104 0.0 0.000 0.628 0.000 0.372
#> SRR2015721     2  0.3305     0.6895 0.0 0.776 0.224 0.000 0.000
#> SRR2015720     3  0.0162     0.4542 0.0 0.004 0.996 0.000 0.000
#> SRR2015718     3  0.4182     0.8234 0.0 0.000 0.600 0.000 0.400
#> SRR2015719     4  0.0000     0.8028 0.0 0.000 0.000 1.000 0.000
#> SRR2015717     3  0.4171     0.8248 0.0 0.000 0.604 0.000 0.396
#> SRR2015716     3  0.4171     0.8248 0.0 0.000 0.604 0.000 0.396
#> SRR2015714     4  0.0000     0.8028 0.0 0.000 0.000 1.000 0.000
#> SRR2015713     2  0.3612     0.6727 0.0 0.732 0.268 0.000 0.000
#> SRR2015784     2  0.0000     0.7587 0.0 1.000 0.000 0.000 0.000
#> SRR2015785     2  0.0162     0.7589 0.0 0.996 0.000 0.004 0.000
#> SRR2015783     1  0.0000     1.0000 1.0 0.000 0.000 0.000 0.000
#> SRR2015782     5  0.4321     0.6268 0.0 0.004 0.396 0.000 0.600
#> SRR2015781     2  0.0162     0.7589 0.0 0.996 0.000 0.004 0.000
#> SRR2015780     5  0.4321     0.6268 0.0 0.004 0.396 0.000 0.600
#> SRR2015779     4  0.3983     0.4507 0.0 0.340 0.000 0.660 0.000
#> SRR2015778     5  0.3966     0.6535 0.0 0.000 0.336 0.000 0.664
#> SRR2015777     3  0.4171     0.8248 0.0 0.000 0.604 0.000 0.396
#> SRR2015776     4  0.0000     0.8028 0.0 0.000 0.000 1.000 0.000
#> SRR2015775     2  0.4171     0.5917 0.0 0.604 0.396 0.000 0.000
#> SRR2015774     3  0.0162     0.4542 0.0 0.004 0.996 0.000 0.000
#> SRR2015773     2  0.0000     0.7587 0.0 1.000 0.000 0.000 0.000
#> SRR2015772     2  0.0162     0.7589 0.0 0.996 0.000 0.004 0.000
#> SRR2015771     3  0.4171     0.8248 0.0 0.000 0.604 0.000 0.396
#> SRR2015769     2  0.4126     0.6049 0.0 0.620 0.380 0.000 0.000
#> SRR2015770     2  0.4182     0.3523 0.0 0.600 0.000 0.400 0.000
#> SRR2015768     2  0.3752     0.5333 0.0 0.708 0.000 0.292 0.000
#> SRR2015767     4  0.0000     0.8028 0.0 0.000 0.000 1.000 0.000
#> SRR2015766     3  0.0162     0.4561 0.0 0.000 0.996 0.000 0.004
#> SRR2015764     2  0.0162     0.7589 0.0 0.996 0.000 0.004 0.000
#> SRR2015765     3  0.3177     0.0825 0.0 0.208 0.792 0.000 0.000
#> SRR2015763     3  0.4171     0.8248 0.0 0.000 0.604 0.000 0.396
#> SRR2015762     4  0.3983     0.4507 0.0 0.340 0.000 0.660 0.000
#> SRR2015761     2  0.4171     0.5917 0.0 0.604 0.396 0.000 0.000
#> SRR2015760     3  0.4171     0.8248 0.0 0.000 0.604 0.000 0.396

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>            class entropy silhouette    p1    p2    p3    p4    p5    p6
#> SRR2015715     3  0.0000      0.968 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2015735     3  0.0000      0.968 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2015759     1  0.0000      0.998 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2015753     1  0.0146      0.997 0.996 0.000 0.000 0.000 0.000 0.004
#> SRR2015746     5  0.0146      0.875 0.000 0.000 0.004 0.000 0.996 0.000
#> SRR2015758     2  0.3371      0.552 0.000 0.708 0.000 0.292 0.000 0.000
#> SRR2015756     1  0.0146      0.997 0.996 0.000 0.000 0.000 0.000 0.004
#> SRR2015757     2  0.3288      0.616 0.000 0.724 0.000 0.000 0.000 0.276
#> SRR2015755     1  0.0146      0.997 0.996 0.000 0.000 0.000 0.000 0.004
#> SRR2015754     1  0.0000      0.998 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2015752     1  0.0146      0.997 0.996 0.000 0.000 0.000 0.000 0.004
#> SRR2015749     1  0.0000      0.998 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2015750     2  0.0000      0.811 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2015751     5  0.0000      0.875 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR2015748     5  0.0363      0.872 0.000 0.000 0.012 0.000 0.988 0.000
#> SRR2015747     1  0.0000      0.998 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2015745     5  0.1663      0.831 0.000 0.000 0.000 0.000 0.912 0.088
#> SRR2015743     1  0.0146      0.997 0.996 0.000 0.000 0.000 0.000 0.004
#> SRR2015744     3  0.2662      0.823 0.120 0.000 0.856 0.000 0.024 0.000
#> SRR2015742     5  0.0146      0.874 0.000 0.000 0.004 0.000 0.996 0.000
#> SRR2015741     1  0.0000      0.998 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2015740     1  0.0000      0.998 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2015738     1  0.0000      0.998 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2015739     1  0.0146      0.997 0.996 0.000 0.000 0.000 0.000 0.004
#> SRR2015737     2  0.0000      0.811 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2015736     6  0.0146      0.779 0.000 0.000 0.004 0.000 0.000 0.996
#> SRR2015732     3  0.0937      0.953 0.000 0.000 0.960 0.000 0.040 0.000
#> SRR2015733     2  0.2260      0.728 0.000 0.860 0.000 0.140 0.000 0.000
#> SRR2015734     3  0.0000      0.968 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2015731     6  0.0508      0.776 0.000 0.000 0.004 0.000 0.012 0.984
#> SRR2015730     1  0.0000      0.998 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2015728     6  0.4317      0.571 0.000 0.000 0.252 0.000 0.060 0.688
#> SRR2015729     6  0.0146      0.779 0.000 0.000 0.004 0.000 0.000 0.996
#> SRR2015727     6  0.4149      0.610 0.000 0.000 0.216 0.000 0.064 0.720
#> SRR2015726     3  0.0000      0.968 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2015723     3  0.0547      0.962 0.000 0.000 0.980 0.000 0.020 0.000
#> SRR2015724     3  0.1327      0.939 0.000 0.000 0.936 0.000 0.064 0.000
#> SRR2015725     1  0.0363      0.986 0.988 0.000 0.012 0.000 0.000 0.000
#> SRR2015722     6  0.4149      0.610 0.000 0.000 0.216 0.000 0.064 0.720
#> SRR2015721     6  0.3765      0.243 0.000 0.404 0.000 0.000 0.000 0.596
#> SRR2015720     6  0.0146      0.779 0.000 0.000 0.004 0.000 0.000 0.996
#> SRR2015718     3  0.1327      0.939 0.000 0.000 0.936 0.000 0.064 0.000
#> SRR2015719     4  0.0000      0.815 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR2015717     3  0.0000      0.968 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2015716     3  0.0000      0.968 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2015714     4  0.0000      0.815 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR2015713     2  0.2912      0.670 0.000 0.784 0.000 0.000 0.000 0.216
#> SRR2015784     2  0.0000      0.811 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2015785     2  0.0000      0.811 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2015783     1  0.0000      0.998 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2015782     5  0.1327      0.845 0.000 0.000 0.000 0.000 0.936 0.064
#> SRR2015781     2  0.0000      0.811 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2015780     5  0.3862      0.173 0.000 0.000 0.000 0.000 0.524 0.476
#> SRR2015779     4  0.3578      0.432 0.000 0.340 0.000 0.660 0.000 0.000
#> SRR2015778     5  0.0000      0.875 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR2015777     5  0.2562      0.722 0.000 0.000 0.172 0.000 0.828 0.000
#> SRR2015776     4  0.0000      0.815 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR2015775     6  0.3101      0.538 0.000 0.244 0.000 0.000 0.000 0.756
#> SRR2015774     6  0.0146      0.779 0.000 0.000 0.004 0.000 0.000 0.996
#> SRR2015773     2  0.0000      0.811 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2015772     2  0.0000      0.811 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2015771     3  0.0000      0.968 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2015769     2  0.3866      0.123 0.000 0.516 0.000 0.000 0.000 0.484
#> SRR2015770     2  0.3756      0.339 0.000 0.600 0.000 0.400 0.000 0.000
#> SRR2015768     2  0.3371      0.552 0.000 0.708 0.000 0.292 0.000 0.000
#> SRR2015767     4  0.0000      0.815 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR2015766     6  0.1471      0.748 0.000 0.000 0.004 0.000 0.064 0.932
#> SRR2015764     2  0.0000      0.811 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2015765     6  0.0146      0.779 0.000 0.000 0.004 0.000 0.000 0.996
#> SRR2015763     3  0.0000      0.968 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2015762     4  0.3578      0.432 0.000 0.340 0.000 0.660 0.000 0.000
#> SRR2015761     6  0.3765      0.163 0.000 0.404 0.000 0.000 0.000 0.596
#> SRR2015760     3  0.1141      0.947 0.000 0.000 0.948 0.000 0.052 0.000

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

consensus_heatmap(res, k = 2)

plot of chunk tab-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

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

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

collect_plots(res)

plot of chunk ATC-mclust-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 1.000           0.954       0.982         0.4809 0.527   0.527
#> 3 3 0.905           0.890       0.954         0.2541 0.841   0.706
#> 4 4 0.673           0.724       0.835         0.1364 0.907   0.772
#> 5 5 0.712           0.678       0.836         0.1122 0.797   0.459
#> 6 6 0.714           0.681       0.793         0.0614 0.890   0.564

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
#> SRR2015715     2   0.000      0.971 0.000 1.000
#> SRR2015735     2   0.000      0.971 0.000 1.000
#> SRR2015759     1   0.000      1.000 1.000 0.000
#> SRR2015753     1   0.000      1.000 1.000 0.000
#> SRR2015746     1   0.000      1.000 1.000 0.000
#> SRR2015758     2   0.000      0.971 0.000 1.000
#> SRR2015756     1   0.000      1.000 1.000 0.000
#> SRR2015757     2   0.000      0.971 0.000 1.000
#> SRR2015755     1   0.000      1.000 1.000 0.000
#> SRR2015754     1   0.000      1.000 1.000 0.000
#> SRR2015752     1   0.000      1.000 1.000 0.000
#> SRR2015749     1   0.000      1.000 1.000 0.000
#> SRR2015750     2   0.983      0.296 0.424 0.576
#> SRR2015751     1   0.000      1.000 1.000 0.000
#> SRR2015748     1   0.000      1.000 1.000 0.000
#> SRR2015747     1   0.000      1.000 1.000 0.000
#> SRR2015745     1   0.000      1.000 1.000 0.000
#> SRR2015743     1   0.000      1.000 1.000 0.000
#> SRR2015744     1   0.000      1.000 1.000 0.000
#> SRR2015742     1   0.000      1.000 1.000 0.000
#> SRR2015741     1   0.000      1.000 1.000 0.000
#> SRR2015740     1   0.000      1.000 1.000 0.000
#> SRR2015738     1   0.000      1.000 1.000 0.000
#> SRR2015739     1   0.000      1.000 1.000 0.000
#> SRR2015737     2   0.983      0.296 0.424 0.576
#> SRR2015736     2   0.000      0.971 0.000 1.000
#> SRR2015732     2   0.000      0.971 0.000 1.000
#> SRR2015733     2   0.000      0.971 0.000 1.000
#> SRR2015734     2   0.000      0.971 0.000 1.000
#> SRR2015731     2   0.000      0.971 0.000 1.000
#> SRR2015730     2   0.000      0.971 0.000 1.000
#> SRR2015728     2   0.000      0.971 0.000 1.000
#> SRR2015729     2   0.000      0.971 0.000 1.000
#> SRR2015727     2   0.000      0.971 0.000 1.000
#> SRR2015726     2   0.000      0.971 0.000 1.000
#> SRR2015723     2   0.000      0.971 0.000 1.000
#> SRR2015724     2   0.000      0.971 0.000 1.000
#> SRR2015725     2   0.000      0.971 0.000 1.000
#> SRR2015722     2   0.000      0.971 0.000 1.000
#> SRR2015721     2   0.000      0.971 0.000 1.000
#> SRR2015720     2   0.000      0.971 0.000 1.000
#> SRR2015718     2   0.000      0.971 0.000 1.000
#> SRR2015719     2   0.000      0.971 0.000 1.000
#> SRR2015717     2   0.000      0.971 0.000 1.000
#> SRR2015716     2   0.000      0.971 0.000 1.000
#> SRR2015714     2   0.000      0.971 0.000 1.000
#> SRR2015713     2   0.000      0.971 0.000 1.000
#> SRR2015784     1   0.000      1.000 1.000 0.000
#> SRR2015785     1   0.000      1.000 1.000 0.000
#> SRR2015783     1   0.000      1.000 1.000 0.000
#> SRR2015782     1   0.000      1.000 1.000 0.000
#> SRR2015781     1   0.000      1.000 1.000 0.000
#> SRR2015780     1   0.000      1.000 1.000 0.000
#> SRR2015779     2   0.987      0.273 0.432 0.568
#> SRR2015778     1   0.000      1.000 1.000 0.000
#> SRR2015777     1   0.000      1.000 1.000 0.000
#> SRR2015776     2   0.000      0.971 0.000 1.000
#> SRR2015775     2   0.000      0.971 0.000 1.000
#> SRR2015774     2   0.000      0.971 0.000 1.000
#> SRR2015773     2   0.000      0.971 0.000 1.000
#> SRR2015772     2   0.000      0.971 0.000 1.000
#> SRR2015771     2   0.000      0.971 0.000 1.000
#> SRR2015769     2   0.000      0.971 0.000 1.000
#> SRR2015770     2   0.000      0.971 0.000 1.000
#> SRR2015768     2   0.000      0.971 0.000 1.000
#> SRR2015767     2   0.000      0.971 0.000 1.000
#> SRR2015766     2   0.000      0.971 0.000 1.000
#> SRR2015764     2   0.000      0.971 0.000 1.000
#> SRR2015765     2   0.000      0.971 0.000 1.000
#> SRR2015763     2   0.000      0.971 0.000 1.000
#> SRR2015762     2   0.000      0.971 0.000 1.000
#> SRR2015761     2   0.000      0.971 0.000 1.000
#> SRR2015760     2   0.000      0.971 0.000 1.000

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>            class entropy silhouette    p1    p2    p3
#> SRR2015715     3  0.0000      0.971 0.000 0.000 1.000
#> SRR2015735     3  0.0000      0.971 0.000 0.000 1.000
#> SRR2015759     1  0.0000      0.962 1.000 0.000 0.000
#> SRR2015753     1  0.0000      0.962 1.000 0.000 0.000
#> SRR2015746     1  0.0237      0.960 0.996 0.004 0.000
#> SRR2015758     3  0.0000      0.971 0.000 0.000 1.000
#> SRR2015756     1  0.0000      0.962 1.000 0.000 0.000
#> SRR2015757     3  0.0000      0.971 0.000 0.000 1.000
#> SRR2015755     1  0.0000      0.962 1.000 0.000 0.000
#> SRR2015754     1  0.0000      0.962 1.000 0.000 0.000
#> SRR2015752     1  0.0000      0.962 1.000 0.000 0.000
#> SRR2015749     1  0.0000      0.962 1.000 0.000 0.000
#> SRR2015750     2  0.6095      0.470 0.000 0.608 0.392
#> SRR2015751     1  0.0237      0.960 0.996 0.004 0.000
#> SRR2015748     1  0.5810      0.496 0.664 0.336 0.000
#> SRR2015747     1  0.0000      0.962 1.000 0.000 0.000
#> SRR2015745     1  0.4346      0.764 0.816 0.184 0.000
#> SRR2015743     1  0.0000      0.962 1.000 0.000 0.000
#> SRR2015744     1  0.0237      0.960 0.996 0.004 0.000
#> SRR2015742     1  0.0237      0.960 0.996 0.004 0.000
#> SRR2015741     1  0.0000      0.962 1.000 0.000 0.000
#> SRR2015740     1  0.0000      0.962 1.000 0.000 0.000
#> SRR2015738     1  0.0000      0.962 1.000 0.000 0.000
#> SRR2015739     1  0.0000      0.962 1.000 0.000 0.000
#> SRR2015737     2  0.5905      0.539 0.000 0.648 0.352
#> SRR2015736     3  0.0000      0.971 0.000 0.000 1.000
#> SRR2015732     3  0.0000      0.971 0.000 0.000 1.000
#> SRR2015733     3  0.0000      0.971 0.000 0.000 1.000
#> SRR2015734     3  0.0000      0.971 0.000 0.000 1.000
#> SRR2015731     3  0.0000      0.971 0.000 0.000 1.000
#> SRR2015730     3  0.0000      0.971 0.000 0.000 1.000
#> SRR2015728     3  0.5926      0.432 0.000 0.356 0.644
#> SRR2015729     3  0.0000      0.971 0.000 0.000 1.000
#> SRR2015727     3  0.0000      0.971 0.000 0.000 1.000
#> SRR2015726     3  0.0000      0.971 0.000 0.000 1.000
#> SRR2015723     3  0.0000      0.971 0.000 0.000 1.000
#> SRR2015724     3  0.0000      0.971 0.000 0.000 1.000
#> SRR2015725     3  0.0000      0.971 0.000 0.000 1.000
#> SRR2015722     3  0.4974      0.658 0.000 0.236 0.764
#> SRR2015721     3  0.0000      0.971 0.000 0.000 1.000
#> SRR2015720     3  0.0000      0.971 0.000 0.000 1.000
#> SRR2015718     3  0.0000      0.971 0.000 0.000 1.000
#> SRR2015719     2  0.0237      0.812 0.000 0.996 0.004
#> SRR2015717     3  0.0000      0.971 0.000 0.000 1.000
#> SRR2015716     3  0.0000      0.971 0.000 0.000 1.000
#> SRR2015714     3  0.5948      0.422 0.000 0.360 0.640
#> SRR2015713     3  0.0000      0.971 0.000 0.000 1.000
#> SRR2015784     2  0.1163      0.809 0.028 0.972 0.000
#> SRR2015785     2  0.0892      0.811 0.020 0.980 0.000
#> SRR2015783     1  0.0000      0.962 1.000 0.000 0.000
#> SRR2015782     2  0.6045      0.307 0.380 0.620 0.000
#> SRR2015781     2  0.1163      0.809 0.028 0.972 0.000
#> SRR2015780     2  0.1031      0.811 0.024 0.976 0.000
#> SRR2015779     2  0.0892      0.814 0.000 0.980 0.020
#> SRR2015778     1  0.4504      0.746 0.804 0.196 0.000
#> SRR2015777     1  0.0237      0.960 0.996 0.004 0.000
#> SRR2015776     2  0.1163      0.812 0.000 0.972 0.028
#> SRR2015775     3  0.0000      0.971 0.000 0.000 1.000
#> SRR2015774     3  0.0000      0.971 0.000 0.000 1.000
#> SRR2015773     3  0.0000      0.971 0.000 0.000 1.000
#> SRR2015772     3  0.0000      0.971 0.000 0.000 1.000
#> SRR2015771     3  0.0000      0.971 0.000 0.000 1.000
#> SRR2015769     3  0.0000      0.971 0.000 0.000 1.000
#> SRR2015770     3  0.0424      0.963 0.000 0.008 0.992
#> SRR2015768     2  0.6095      0.470 0.000 0.608 0.392
#> SRR2015767     2  0.0237      0.812 0.000 0.996 0.004
#> SRR2015766     3  0.0000      0.971 0.000 0.000 1.000
#> SRR2015764     3  0.0000      0.971 0.000 0.000 1.000
#> SRR2015765     3  0.0000      0.971 0.000 0.000 1.000
#> SRR2015763     3  0.0000      0.971 0.000 0.000 1.000
#> SRR2015762     3  0.0424      0.963 0.000 0.008 0.992
#> SRR2015761     3  0.0000      0.971 0.000 0.000 1.000
#> SRR2015760     3  0.0000      0.971 0.000 0.000 1.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> SRR2015715     3  0.3074     0.7915 0.000 0.152 0.848 0.000
#> SRR2015735     3  0.3074     0.7915 0.000 0.152 0.848 0.000
#> SRR2015759     1  0.0000     0.9220 1.000 0.000 0.000 0.000
#> SRR2015753     1  0.0000     0.9220 1.000 0.000 0.000 0.000
#> SRR2015746     1  0.3806     0.7923 0.824 0.020 0.000 0.156
#> SRR2015758     2  0.4990     0.7088 0.000 0.640 0.352 0.008
#> SRR2015756     1  0.0000     0.9220 1.000 0.000 0.000 0.000
#> SRR2015757     3  0.5000    -0.4682 0.000 0.496 0.504 0.000
#> SRR2015755     1  0.0000     0.9220 1.000 0.000 0.000 0.000
#> SRR2015754     1  0.0000     0.9220 1.000 0.000 0.000 0.000
#> SRR2015752     1  0.0000     0.9220 1.000 0.000 0.000 0.000
#> SRR2015749     1  0.0000     0.9220 1.000 0.000 0.000 0.000
#> SRR2015750     2  0.4590     0.6689 0.000 0.772 0.192 0.036
#> SRR2015751     1  0.3853     0.7874 0.820 0.020 0.000 0.160
#> SRR2015748     1  0.4511     0.6525 0.724 0.008 0.000 0.268
#> SRR2015747     1  0.0000     0.9220 1.000 0.000 0.000 0.000
#> SRR2015745     4  0.5013     0.5995 0.292 0.020 0.000 0.688
#> SRR2015743     1  0.0000     0.9220 1.000 0.000 0.000 0.000
#> SRR2015744     1  0.3806     0.7923 0.824 0.020 0.000 0.156
#> SRR2015742     1  0.3853     0.7874 0.820 0.020 0.000 0.160
#> SRR2015741     1  0.0000     0.9220 1.000 0.000 0.000 0.000
#> SRR2015740     1  0.0000     0.9220 1.000 0.000 0.000 0.000
#> SRR2015738     1  0.0188     0.9198 0.996 0.000 0.000 0.004
#> SRR2015739     1  0.0000     0.9220 1.000 0.000 0.000 0.000
#> SRR2015737     2  0.4832     0.4648 0.000 0.768 0.056 0.176
#> SRR2015736     3  0.1302     0.8070 0.000 0.044 0.956 0.000
#> SRR2015732     3  0.2216     0.8097 0.000 0.092 0.908 0.000
#> SRR2015733     3  0.4999    -0.4559 0.000 0.492 0.508 0.000
#> SRR2015734     3  0.3074     0.7915 0.000 0.152 0.848 0.000
#> SRR2015731     3  0.0000     0.8181 0.000 0.000 1.000 0.000
#> SRR2015730     3  0.3074     0.7915 0.000 0.152 0.848 0.000
#> SRR2015728     3  0.6324     0.3566 0.000 0.076 0.584 0.340
#> SRR2015729     3  0.0188     0.8178 0.000 0.004 0.996 0.000
#> SRR2015727     3  0.0000     0.8181 0.000 0.000 1.000 0.000
#> SRR2015726     3  0.3074     0.7915 0.000 0.152 0.848 0.000
#> SRR2015723     3  0.3024     0.7925 0.000 0.148 0.852 0.000
#> SRR2015724     3  0.0000     0.8181 0.000 0.000 1.000 0.000
#> SRR2015725     3  0.3074     0.7915 0.000 0.152 0.848 0.000
#> SRR2015722     3  0.5590     0.5223 0.000 0.064 0.692 0.244
#> SRR2015721     3  0.1302     0.8070 0.000 0.044 0.956 0.000
#> SRR2015720     3  0.1302     0.8070 0.000 0.044 0.956 0.000
#> SRR2015718     3  0.0000     0.8181 0.000 0.000 1.000 0.000
#> SRR2015719     4  0.1302     0.7385 0.000 0.044 0.000 0.956
#> SRR2015717     3  0.3074     0.7915 0.000 0.152 0.848 0.000
#> SRR2015716     3  0.3074     0.7915 0.000 0.152 0.848 0.000
#> SRR2015714     3  0.7111     0.1216 0.000 0.136 0.500 0.364
#> SRR2015713     3  0.1302     0.8070 0.000 0.044 0.956 0.000
#> SRR2015784     4  0.3105     0.7693 0.004 0.140 0.000 0.856
#> SRR2015785     4  0.2530     0.7656 0.000 0.112 0.000 0.888
#> SRR2015783     1  0.0000     0.9220 1.000 0.000 0.000 0.000
#> SRR2015782     4  0.4361     0.6969 0.208 0.020 0.000 0.772
#> SRR2015781     4  0.3105     0.7693 0.004 0.140 0.000 0.856
#> SRR2015780     4  0.2999     0.7698 0.004 0.132 0.000 0.864
#> SRR2015779     2  0.5070    -0.0346 0.000 0.580 0.004 0.416
#> SRR2015778     4  0.5386     0.4459 0.368 0.020 0.000 0.612
#> SRR2015777     1  0.3806     0.7923 0.824 0.020 0.000 0.156
#> SRR2015776     4  0.5113     0.4316 0.000 0.252 0.036 0.712
#> SRR2015775     3  0.1302     0.8070 0.000 0.044 0.956 0.000
#> SRR2015774     3  0.1211     0.8087 0.000 0.040 0.960 0.000
#> SRR2015773     3  0.1389     0.8047 0.000 0.048 0.952 0.000
#> SRR2015772     3  0.1557     0.7993 0.000 0.056 0.944 0.000
#> SRR2015771     3  0.3074     0.7915 0.000 0.152 0.848 0.000
#> SRR2015769     3  0.1211     0.8087 0.000 0.040 0.960 0.000
#> SRR2015770     2  0.5527     0.7057 0.000 0.616 0.356 0.028
#> SRR2015768     2  0.6381     0.6636 0.000 0.652 0.196 0.152
#> SRR2015767     4  0.1302     0.7385 0.000 0.044 0.000 0.956
#> SRR2015766     3  0.0188     0.8178 0.000 0.004 0.996 0.000
#> SRR2015764     2  0.4967     0.5336 0.000 0.548 0.452 0.000
#> SRR2015765     3  0.1389     0.8056 0.000 0.048 0.952 0.000
#> SRR2015763     3  0.3074     0.7915 0.000 0.152 0.848 0.000
#> SRR2015762     2  0.5496     0.7392 0.000 0.652 0.312 0.036
#> SRR2015761     3  0.0921     0.8127 0.000 0.028 0.972 0.000
#> SRR2015760     3  0.3074     0.7915 0.000 0.152 0.848 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
#> SRR2015715     3  0.0000     0.7686 0.000 0.000 1.000 0.000 0.000
#> SRR2015735     3  0.0000     0.7686 0.000 0.000 1.000 0.000 0.000
#> SRR2015759     1  0.0000     0.9620 1.000 0.000 0.000 0.000 0.000
#> SRR2015753     1  0.0000     0.9620 1.000 0.000 0.000 0.000 0.000
#> SRR2015746     5  0.3074     0.6705 0.196 0.000 0.000 0.000 0.804
#> SRR2015758     2  0.0880     0.7818 0.000 0.968 0.032 0.000 0.000
#> SRR2015756     1  0.0000     0.9620 1.000 0.000 0.000 0.000 0.000
#> SRR2015757     2  0.1544     0.7830 0.000 0.932 0.068 0.000 0.000
#> SRR2015755     1  0.0000     0.9620 1.000 0.000 0.000 0.000 0.000
#> SRR2015754     1  0.0162     0.9594 0.996 0.000 0.000 0.000 0.004
#> SRR2015752     1  0.0000     0.9620 1.000 0.000 0.000 0.000 0.000
#> SRR2015749     1  0.0162     0.9594 0.996 0.000 0.000 0.000 0.004
#> SRR2015750     2  0.1525     0.7784 0.000 0.948 0.036 0.012 0.004
#> SRR2015751     5  0.3074     0.6705 0.196 0.000 0.000 0.000 0.804
#> SRR2015748     4  0.5322     0.3162 0.360 0.028 0.000 0.592 0.020
#> SRR2015747     1  0.0000     0.9620 1.000 0.000 0.000 0.000 0.000
#> SRR2015745     5  0.1626     0.6787 0.044 0.000 0.000 0.016 0.940
#> SRR2015743     1  0.0000     0.9620 1.000 0.000 0.000 0.000 0.000
#> SRR2015744     1  0.4283     0.1138 0.544 0.000 0.000 0.000 0.456
#> SRR2015742     5  0.3074     0.6705 0.196 0.000 0.000 0.000 0.804
#> SRR2015741     1  0.0000     0.9620 1.000 0.000 0.000 0.000 0.000
#> SRR2015740     1  0.0000     0.9620 1.000 0.000 0.000 0.000 0.000
#> SRR2015738     1  0.0162     0.9594 0.996 0.000 0.000 0.000 0.004
#> SRR2015739     1  0.0000     0.9620 1.000 0.000 0.000 0.000 0.000
#> SRR2015737     2  0.1996     0.7671 0.000 0.928 0.036 0.032 0.004
#> SRR2015736     2  0.3366     0.6542 0.000 0.768 0.232 0.000 0.000
#> SRR2015732     2  0.4307     0.2158 0.000 0.504 0.496 0.000 0.000
#> SRR2015733     2  0.0963     0.7833 0.000 0.964 0.036 0.000 0.000
#> SRR2015734     3  0.0000     0.7686 0.000 0.000 1.000 0.000 0.000
#> SRR2015731     3  0.3932     0.6191 0.000 0.328 0.672 0.000 0.000
#> SRR2015730     3  0.0000     0.7686 0.000 0.000 1.000 0.000 0.000
#> SRR2015728     4  0.0510     0.6533 0.000 0.000 0.016 0.984 0.000
#> SRR2015729     3  0.4161     0.5385 0.000 0.392 0.608 0.000 0.000
#> SRR2015727     3  0.3895     0.6271 0.000 0.320 0.680 0.000 0.000
#> SRR2015726     3  0.0000     0.7686 0.000 0.000 1.000 0.000 0.000
#> SRR2015723     3  0.0404     0.7663 0.000 0.012 0.988 0.000 0.000
#> SRR2015724     3  0.2127     0.7359 0.000 0.108 0.892 0.000 0.000
#> SRR2015725     3  0.0000     0.7686 0.000 0.000 1.000 0.000 0.000
#> SRR2015722     4  0.4660     0.4812 0.000 0.192 0.080 0.728 0.000
#> SRR2015721     2  0.3274     0.6708 0.000 0.780 0.220 0.000 0.000
#> SRR2015720     2  0.3452     0.6516 0.000 0.756 0.244 0.000 0.000
#> SRR2015718     3  0.3857     0.6298 0.000 0.312 0.688 0.000 0.000
#> SRR2015719     4  0.3098     0.6336 0.000 0.016 0.000 0.836 0.148
#> SRR2015717     3  0.0162     0.7687 0.000 0.004 0.996 0.000 0.000
#> SRR2015716     3  0.0290     0.7678 0.000 0.008 0.992 0.000 0.000
#> SRR2015714     4  0.3409     0.6130 0.000 0.032 0.144 0.824 0.000
#> SRR2015713     2  0.3336     0.6741 0.000 0.772 0.228 0.000 0.000
#> SRR2015784     5  0.3932     0.4105 0.000 0.000 0.000 0.328 0.672
#> SRR2015785     5  0.4273     0.1297 0.000 0.000 0.000 0.448 0.552
#> SRR2015783     1  0.0000     0.9620 1.000 0.000 0.000 0.000 0.000
#> SRR2015782     5  0.1121     0.6810 0.044 0.000 0.000 0.000 0.956
#> SRR2015781     5  0.3949     0.4049 0.000 0.000 0.000 0.332 0.668
#> SRR2015780     5  0.3966     0.3986 0.000 0.000 0.000 0.336 0.664
#> SRR2015779     2  0.5261    -0.1286 0.000 0.528 0.000 0.424 0.048
#> SRR2015778     5  0.1410     0.6850 0.060 0.000 0.000 0.000 0.940
#> SRR2015777     5  0.3074     0.6705 0.196 0.000 0.000 0.000 0.804
#> SRR2015776     2  0.4262    -0.0786 0.000 0.560 0.000 0.440 0.000
#> SRR2015775     3  0.4242     0.4667 0.000 0.428 0.572 0.000 0.000
#> SRR2015774     3  0.4182     0.5255 0.000 0.400 0.600 0.000 0.000
#> SRR2015773     2  0.3143     0.6878 0.000 0.796 0.204 0.000 0.000
#> SRR2015772     2  0.3003     0.7035 0.000 0.812 0.188 0.000 0.000
#> SRR2015771     3  0.0000     0.7686 0.000 0.000 1.000 0.000 0.000
#> SRR2015769     3  0.4235     0.4780 0.000 0.424 0.576 0.000 0.000
#> SRR2015770     2  0.1251     0.7824 0.000 0.956 0.036 0.008 0.000
#> SRR2015768     2  0.1981     0.7466 0.000 0.924 0.028 0.048 0.000
#> SRR2015767     4  0.3098     0.6336 0.000 0.016 0.000 0.836 0.148
#> SRR2015766     3  0.3895     0.6271 0.000 0.320 0.680 0.000 0.000
#> SRR2015764     2  0.1121     0.7824 0.000 0.956 0.044 0.000 0.000
#> SRR2015765     3  0.4161     0.5310 0.000 0.392 0.608 0.000 0.000
#> SRR2015763     3  0.0000     0.7686 0.000 0.000 1.000 0.000 0.000
#> SRR2015762     2  0.1364     0.7809 0.000 0.952 0.036 0.012 0.000
#> SRR2015761     3  0.4192     0.5183 0.000 0.404 0.596 0.000 0.000
#> SRR2015760     3  0.0162     0.7687 0.000 0.004 0.996 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
#> SRR2015715     3  0.0146     0.7700 0.000 0.004 0.996 0.000 0.000 0.000
#> SRR2015735     3  0.1267     0.7625 0.000 0.000 0.940 0.000 0.000 0.060
#> SRR2015759     1  0.1007     0.9735 0.956 0.000 0.000 0.000 0.000 0.044
#> SRR2015753     1  0.0146     0.9775 0.996 0.000 0.000 0.000 0.004 0.000
#> SRR2015746     5  0.2664     0.8774 0.184 0.000 0.000 0.000 0.816 0.000
#> SRR2015758     2  0.0146     0.7007 0.000 0.996 0.004 0.000 0.000 0.000
#> SRR2015756     1  0.0000     0.9800 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2015757     2  0.5422     0.4791 0.000 0.592 0.164 0.004 0.000 0.240
#> SRR2015755     1  0.0000     0.9800 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2015754     1  0.1007     0.9735 0.956 0.000 0.000 0.000 0.000 0.044
#> SRR2015752     1  0.0000     0.9800 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2015749     1  0.1152     0.9711 0.952 0.000 0.000 0.000 0.004 0.044
#> SRR2015750     2  0.5194     0.6013 0.000 0.716 0.088 0.056 0.012 0.128
#> SRR2015751     5  0.2048     0.9123 0.120 0.000 0.000 0.000 0.880 0.000
#> SRR2015748     4  0.6505     0.4827 0.144 0.000 0.000 0.548 0.208 0.100
#> SRR2015747     1  0.0000     0.9800 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2015745     5  0.3657     0.7918 0.100 0.000 0.000 0.108 0.792 0.000
#> SRR2015743     1  0.0000     0.9800 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2015744     5  0.3151     0.7941 0.252 0.000 0.000 0.000 0.748 0.000
#> SRR2015742     5  0.2048     0.9123 0.120 0.000 0.000 0.000 0.880 0.000
#> SRR2015741     1  0.0000     0.9800 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2015740     1  0.1007     0.9735 0.956 0.000 0.000 0.000 0.000 0.044
#> SRR2015738     1  0.1007     0.9735 0.956 0.000 0.000 0.000 0.000 0.044
#> SRR2015739     1  0.0000     0.9800 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2015737     2  0.5409     0.5930 0.000 0.700 0.088 0.072 0.012 0.128
#> SRR2015736     2  0.5896    -0.0237 0.000 0.420 0.204 0.000 0.000 0.376
#> SRR2015732     3  0.5418    -0.0428 0.000 0.356 0.536 0.008 0.000 0.100
#> SRR2015733     2  0.0000     0.7009 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2015734     3  0.0146     0.7700 0.000 0.004 0.996 0.000 0.000 0.000
#> SRR2015731     6  0.4855     0.6198 0.000 0.064 0.380 0.000 0.000 0.556
#> SRR2015730     3  0.0146     0.7700 0.000 0.004 0.996 0.000 0.000 0.000
#> SRR2015728     4  0.3962     0.6195 0.000 0.000 0.120 0.764 0.000 0.116
#> SRR2015729     6  0.4979     0.8665 0.000 0.136 0.224 0.000 0.000 0.640
#> SRR2015727     3  0.5095    -0.0354 0.000 0.088 0.544 0.000 0.000 0.368
#> SRR2015726     3  0.0146     0.7700 0.000 0.004 0.996 0.000 0.000 0.000
#> SRR2015723     3  0.3717     0.5897 0.000 0.064 0.776 0.000 0.000 0.160
#> SRR2015724     3  0.3345     0.5431 0.000 0.020 0.776 0.000 0.000 0.204
#> SRR2015725     3  0.0146     0.7700 0.000 0.004 0.996 0.000 0.000 0.000
#> SRR2015722     4  0.6870     0.2034 0.000 0.088 0.228 0.476 0.000 0.208
#> SRR2015721     2  0.5096     0.3111 0.000 0.576 0.100 0.000 0.000 0.324
#> SRR2015720     2  0.6029     0.0252 0.000 0.424 0.276 0.000 0.000 0.300
#> SRR2015718     3  0.4105     0.2382 0.000 0.020 0.632 0.000 0.000 0.348
#> SRR2015719     4  0.1926     0.6661 0.000 0.068 0.000 0.912 0.020 0.000
#> SRR2015717     3  0.1267     0.7625 0.000 0.000 0.940 0.000 0.000 0.060
#> SRR2015716     3  0.2265     0.7211 0.000 0.052 0.896 0.000 0.000 0.052
#> SRR2015714     4  0.1701     0.6632 0.000 0.072 0.000 0.920 0.000 0.008
#> SRR2015713     2  0.5089     0.5275 0.000 0.620 0.136 0.000 0.000 0.244
#> SRR2015784     4  0.4377     0.5462 0.000 0.000 0.000 0.540 0.436 0.024
#> SRR2015785     4  0.4230     0.6005 0.000 0.000 0.000 0.612 0.364 0.024
#> SRR2015783     1  0.1007     0.9735 0.956 0.000 0.000 0.000 0.000 0.044
#> SRR2015782     5  0.2263     0.8951 0.100 0.000 0.000 0.016 0.884 0.000
#> SRR2015781     4  0.4499     0.5512 0.000 0.000 0.000 0.540 0.428 0.032
#> SRR2015780     4  0.4377     0.5462 0.000 0.000 0.000 0.540 0.436 0.024
#> SRR2015779     4  0.6636     0.5893 0.000 0.204 0.000 0.536 0.132 0.128
#> SRR2015778     5  0.1958     0.9005 0.100 0.000 0.000 0.004 0.896 0.000
#> SRR2015777     5  0.2378     0.9026 0.152 0.000 0.000 0.000 0.848 0.000
#> SRR2015776     4  0.3499     0.5391 0.000 0.320 0.000 0.680 0.000 0.000
#> SRR2015775     2  0.5794    -0.0341 0.000 0.436 0.180 0.000 0.000 0.384
#> SRR2015774     6  0.5089     0.8655 0.000 0.136 0.244 0.000 0.000 0.620
#> SRR2015773     2  0.2480     0.6728 0.000 0.872 0.024 0.000 0.000 0.104
#> SRR2015772     2  0.2009     0.6860 0.000 0.908 0.024 0.000 0.000 0.068
#> SRR2015771     3  0.0363     0.7717 0.000 0.000 0.988 0.000 0.000 0.012
#> SRR2015769     6  0.5275     0.8443 0.000 0.168 0.232 0.000 0.000 0.600
#> SRR2015770     2  0.0291     0.7002 0.000 0.992 0.004 0.004 0.000 0.000
#> SRR2015768     2  0.0405     0.7010 0.000 0.988 0.008 0.004 0.000 0.000
#> SRR2015767     4  0.1926     0.6661 0.000 0.068 0.000 0.912 0.020 0.000
#> SRR2015766     3  0.5211    -0.1441 0.000 0.096 0.516 0.000 0.000 0.388
#> SRR2015764     2  0.1765     0.6750 0.000 0.904 0.096 0.000 0.000 0.000
#> SRR2015765     6  0.5509     0.7154 0.000 0.164 0.292 0.000 0.000 0.544
#> SRR2015763     3  0.0363     0.7717 0.000 0.000 0.988 0.000 0.000 0.012
#> SRR2015762     2  0.0291     0.7002 0.000 0.992 0.004 0.004 0.000 0.000
#> SRR2015761     6  0.4954     0.8699 0.000 0.128 0.232 0.000 0.000 0.640
#> SRR2015760     3  0.1204     0.7637 0.000 0.000 0.944 0.000 0.000 0.056

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

consensus_heatmap(res, k = 2)

plot of chunk tab-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

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

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

collect_plots(res)

plot of chunk ATC-NMF-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.716           0.922       0.961         0.3569 0.638   0.638
#> 3 3 0.601           0.811       0.902         0.7393 0.638   0.469
#> 4 4 0.558           0.596       0.767         0.0976 0.844   0.622
#> 5 5 0.492           0.483       0.729         0.0679 0.934   0.802
#> 6 6 0.487           0.418       0.695         0.0448 0.815   0.504

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
#> SRR2015715     1  0.0000      0.970 1.000 0.000
#> SRR2015735     1  0.0000      0.970 1.000 0.000
#> SRR2015759     1  0.0000      0.970 1.000 0.000
#> SRR2015753     1  0.0000      0.970 1.000 0.000
#> SRR2015746     1  0.0000      0.970 1.000 0.000
#> SRR2015758     2  0.5519      0.895 0.128 0.872
#> SRR2015756     1  0.0000      0.970 1.000 0.000
#> SRR2015757     1  0.0672      0.963 0.992 0.008
#> SRR2015755     1  0.0000      0.970 1.000 0.000
#> SRR2015754     1  0.0000      0.970 1.000 0.000
#> SRR2015752     1  0.0000      0.970 1.000 0.000
#> SRR2015749     1  0.0000      0.970 1.000 0.000
#> SRR2015750     1  0.9983     -0.026 0.524 0.476
#> SRR2015751     1  0.0000      0.970 1.000 0.000
#> SRR2015748     1  0.0376      0.967 0.996 0.004
#> SRR2015747     1  0.0000      0.970 1.000 0.000
#> SRR2015745     1  0.0000      0.970 1.000 0.000
#> SRR2015743     1  0.0000      0.970 1.000 0.000
#> SRR2015744     1  0.0000      0.970 1.000 0.000
#> SRR2015742     1  0.0000      0.970 1.000 0.000
#> SRR2015741     1  0.0000      0.970 1.000 0.000
#> SRR2015740     1  0.0000      0.970 1.000 0.000
#> SRR2015738     1  0.0000      0.970 1.000 0.000
#> SRR2015739     1  0.0000      0.970 1.000 0.000
#> SRR2015737     2  0.5629      0.894 0.132 0.868
#> SRR2015736     1  0.0000      0.970 1.000 0.000
#> SRR2015732     1  0.0000      0.970 1.000 0.000
#> SRR2015733     2  0.5629      0.894 0.132 0.868
#> SRR2015734     1  0.0000      0.970 1.000 0.000
#> SRR2015731     1  0.0000      0.970 1.000 0.000
#> SRR2015730     1  0.0000      0.970 1.000 0.000
#> SRR2015728     1  0.0376      0.967 0.996 0.004
#> SRR2015729     1  0.0000      0.970 1.000 0.000
#> SRR2015727     1  0.0000      0.970 1.000 0.000
#> SRR2015726     1  0.0000      0.970 1.000 0.000
#> SRR2015723     1  0.0000      0.970 1.000 0.000
#> SRR2015724     1  0.0000      0.970 1.000 0.000
#> SRR2015725     1  0.0000      0.970 1.000 0.000
#> SRR2015722     1  0.0000      0.970 1.000 0.000
#> SRR2015721     1  0.0000      0.970 1.000 0.000
#> SRR2015720     1  0.0000      0.970 1.000 0.000
#> SRR2015718     1  0.0000      0.970 1.000 0.000
#> SRR2015719     2  0.0000      0.906 0.000 1.000
#> SRR2015717     1  0.0000      0.970 1.000 0.000
#> SRR2015716     1  0.0000      0.970 1.000 0.000
#> SRR2015714     2  0.0000      0.906 0.000 1.000
#> SRR2015713     1  0.0000      0.970 1.000 0.000
#> SRR2015784     2  0.7056      0.841 0.192 0.808
#> SRR2015785     2  0.4690      0.893 0.100 0.900
#> SRR2015783     1  0.0000      0.970 1.000 0.000
#> SRR2015782     1  0.0000      0.970 1.000 0.000
#> SRR2015781     2  0.6343      0.873 0.160 0.840
#> SRR2015780     1  0.6623      0.779 0.828 0.172
#> SRR2015779     2  0.0000      0.906 0.000 1.000
#> SRR2015778     1  0.0000      0.970 1.000 0.000
#> SRR2015777     1  0.0000      0.970 1.000 0.000
#> SRR2015776     2  0.0000      0.906 0.000 1.000
#> SRR2015775     1  0.4431      0.879 0.908 0.092
#> SRR2015774     1  0.6712      0.771 0.824 0.176
#> SRR2015773     2  0.7745      0.793 0.228 0.772
#> SRR2015772     2  0.5629      0.894 0.132 0.868
#> SRR2015771     1  0.0000      0.970 1.000 0.000
#> SRR2015769     1  0.7056      0.747 0.808 0.192
#> SRR2015770     2  0.0376      0.907 0.004 0.996
#> SRR2015768     2  0.0376      0.907 0.004 0.996
#> SRR2015767     2  0.0000      0.906 0.000 1.000
#> SRR2015766     1  0.0000      0.970 1.000 0.000
#> SRR2015764     2  0.7528      0.810 0.216 0.784
#> SRR2015765     1  0.5294      0.846 0.880 0.120
#> SRR2015763     1  0.0000      0.970 1.000 0.000
#> SRR2015762     2  0.0376      0.907 0.004 0.996
#> SRR2015761     1  0.7219      0.734 0.800 0.200
#> SRR2015760     1  0.0000      0.970 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
#> SRR2015715     3  0.3619      0.843 0.136 0.000 0.864
#> SRR2015735     3  0.5058      0.749 0.244 0.000 0.756
#> SRR2015759     1  0.4504      0.731 0.804 0.000 0.196
#> SRR2015753     1  0.0237      0.944 0.996 0.000 0.004
#> SRR2015746     1  0.0237      0.944 0.996 0.000 0.004
#> SRR2015758     2  0.5529      0.684 0.000 0.704 0.296
#> SRR2015756     1  0.0237      0.944 0.996 0.000 0.004
#> SRR2015757     3  0.0000      0.835 0.000 0.000 1.000
#> SRR2015755     1  0.0237      0.944 0.996 0.000 0.004
#> SRR2015754     1  0.0237      0.944 0.996 0.000 0.004
#> SRR2015752     1  0.0424      0.942 0.992 0.000 0.008
#> SRR2015749     1  0.1753      0.914 0.952 0.000 0.048
#> SRR2015750     3  0.1643      0.812 0.000 0.044 0.956
#> SRR2015751     1  0.2625      0.878 0.916 0.000 0.084
#> SRR2015748     1  0.0000      0.941 1.000 0.000 0.000
#> SRR2015747     1  0.0237      0.944 0.996 0.000 0.004
#> SRR2015745     1  0.0475      0.942 0.992 0.004 0.004
#> SRR2015743     1  0.0237      0.944 0.996 0.000 0.004
#> SRR2015744     1  0.0237      0.944 0.996 0.000 0.004
#> SRR2015742     1  0.1031      0.933 0.976 0.000 0.024
#> SRR2015741     1  0.0237      0.944 0.996 0.000 0.004
#> SRR2015740     1  0.6026      0.311 0.624 0.000 0.376
#> SRR2015738     1  0.3267      0.842 0.884 0.000 0.116
#> SRR2015739     1  0.0237      0.944 0.996 0.000 0.004
#> SRR2015737     2  0.6062      0.545 0.000 0.616 0.384
#> SRR2015736     3  0.0000      0.835 0.000 0.000 1.000
#> SRR2015732     3  0.2625      0.853 0.084 0.000 0.916
#> SRR2015733     3  0.2878      0.770 0.000 0.096 0.904
#> SRR2015734     3  0.3941      0.832 0.156 0.000 0.844
#> SRR2015731     3  0.3192      0.851 0.112 0.000 0.888
#> SRR2015730     3  0.4887      0.767 0.228 0.000 0.772
#> SRR2015728     1  0.0000      0.941 1.000 0.000 0.000
#> SRR2015729     3  0.2066      0.853 0.060 0.000 0.940
#> SRR2015727     3  0.5397      0.703 0.280 0.000 0.720
#> SRR2015726     3  0.3340      0.849 0.120 0.000 0.880
#> SRR2015723     3  0.3752      0.839 0.144 0.000 0.856
#> SRR2015724     3  0.3340      0.849 0.120 0.000 0.880
#> SRR2015725     3  0.4842      0.772 0.224 0.000 0.776
#> SRR2015722     1  0.1289      0.928 0.968 0.000 0.032
#> SRR2015721     3  0.0000      0.835 0.000 0.000 1.000
#> SRR2015720     3  0.0000      0.835 0.000 0.000 1.000
#> SRR2015718     3  0.4796      0.777 0.220 0.000 0.780
#> SRR2015719     2  0.0237      0.834 0.004 0.996 0.000
#> SRR2015717     3  0.3816      0.837 0.148 0.000 0.852
#> SRR2015716     3  0.3941      0.832 0.156 0.000 0.844
#> SRR2015714     2  0.0000      0.834 0.000 1.000 0.000
#> SRR2015713     3  0.0000      0.835 0.000 0.000 1.000
#> SRR2015784     2  0.5254      0.609 0.264 0.736 0.000
#> SRR2015785     1  0.4062      0.769 0.836 0.164 0.000
#> SRR2015783     1  0.0592      0.941 0.988 0.000 0.012
#> SRR2015782     1  0.1129      0.930 0.976 0.020 0.004
#> SRR2015781     2  0.4605      0.692 0.204 0.796 0.000
#> SRR2015780     1  0.2711      0.852 0.912 0.088 0.000
#> SRR2015779     2  0.0000      0.834 0.000 1.000 0.000
#> SRR2015778     1  0.0237      0.944 0.996 0.000 0.004
#> SRR2015777     1  0.0237      0.944 0.996 0.000 0.004
#> SRR2015776     2  0.0000      0.834 0.000 1.000 0.000
#> SRR2015775     3  0.0000      0.835 0.000 0.000 1.000
#> SRR2015774     3  0.0237      0.834 0.000 0.004 0.996
#> SRR2015773     3  0.6299     -0.244 0.000 0.476 0.524
#> SRR2015772     2  0.6286      0.360 0.000 0.536 0.464
#> SRR2015771     3  0.3340      0.849 0.120 0.000 0.880
#> SRR2015769     3  0.2448      0.788 0.000 0.076 0.924
#> SRR2015770     2  0.4654      0.764 0.000 0.792 0.208
#> SRR2015768     2  0.2165      0.827 0.000 0.936 0.064
#> SRR2015767     2  0.0000      0.834 0.000 1.000 0.000
#> SRR2015766     3  0.0000      0.835 0.000 0.000 1.000
#> SRR2015764     3  0.4842      0.577 0.000 0.224 0.776
#> SRR2015765     3  0.5891      0.705 0.052 0.168 0.780
#> SRR2015763     3  0.2537      0.854 0.080 0.000 0.920
#> SRR2015762     2  0.2711      0.821 0.000 0.912 0.088
#> SRR2015761     3  0.2878      0.769 0.000 0.096 0.904
#> SRR2015760     3  0.2356      0.854 0.072 0.000 0.928

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> SRR2015715     3  0.1867     0.7547 0.000 0.072 0.928 0.000
#> SRR2015735     3  0.0779     0.7613 0.004 0.016 0.980 0.000
#> SRR2015759     1  0.5781     0.2377 0.488 0.028 0.484 0.000
#> SRR2015753     1  0.1489     0.8217 0.952 0.004 0.044 0.000
#> SRR2015746     1  0.0336     0.8166 0.992 0.008 0.000 0.000
#> SRR2015758     2  0.6517    -0.2082 0.004 0.520 0.064 0.412
#> SRR2015756     1  0.3529     0.7950 0.836 0.012 0.152 0.000
#> SRR2015757     3  0.4605     0.3836 0.000 0.336 0.664 0.000
#> SRR2015755     1  0.3142     0.8033 0.860 0.008 0.132 0.000
#> SRR2015754     1  0.2216     0.8193 0.908 0.000 0.092 0.000
#> SRR2015752     1  0.6387     0.3282 0.492 0.064 0.444 0.000
#> SRR2015749     1  0.2480     0.8200 0.904 0.008 0.088 0.000
#> SRR2015750     2  0.7693     0.5206 0.108 0.572 0.268 0.052
#> SRR2015751     1  0.0592     0.8154 0.984 0.016 0.000 0.000
#> SRR2015748     1  0.0895     0.8196 0.976 0.004 0.020 0.000
#> SRR2015747     1  0.4012     0.7778 0.800 0.016 0.184 0.000
#> SRR2015745     1  0.0188     0.8160 0.996 0.004 0.000 0.000
#> SRR2015743     1  0.4079     0.7777 0.800 0.020 0.180 0.000
#> SRR2015744     1  0.0336     0.8166 0.992 0.008 0.000 0.000
#> SRR2015742     1  0.0592     0.8154 0.984 0.016 0.000 0.000
#> SRR2015741     1  0.3768     0.7811 0.808 0.008 0.184 0.000
#> SRR2015740     3  0.4335     0.5375 0.168 0.036 0.796 0.000
#> SRR2015738     1  0.2675     0.8169 0.892 0.008 0.100 0.000
#> SRR2015739     1  0.5288     0.7351 0.732 0.068 0.200 0.000
#> SRR2015737     2  0.7526    -0.2166 0.192 0.508 0.004 0.296
#> SRR2015736     3  0.3873     0.6045 0.000 0.228 0.772 0.000
#> SRR2015732     3  0.3801     0.6191 0.000 0.220 0.780 0.000
#> SRR2015733     2  0.5080     0.4250 0.000 0.576 0.420 0.004
#> SRR2015734     3  0.0188     0.7719 0.000 0.004 0.996 0.000
#> SRR2015731     3  0.1004     0.7747 0.000 0.024 0.972 0.004
#> SRR2015730     3  0.0657     0.7639 0.004 0.012 0.984 0.000
#> SRR2015728     2  0.8047    -0.0919 0.032 0.416 0.412 0.140
#> SRR2015729     3  0.0817     0.7747 0.000 0.024 0.976 0.000
#> SRR2015727     3  0.3113     0.6812 0.004 0.052 0.892 0.052
#> SRR2015726     3  0.1211     0.7711 0.000 0.040 0.960 0.000
#> SRR2015723     3  0.0524     0.7662 0.004 0.008 0.988 0.000
#> SRR2015724     3  0.3710     0.6574 0.004 0.192 0.804 0.000
#> SRR2015725     3  0.0376     0.7676 0.004 0.004 0.992 0.000
#> SRR2015722     3  0.7824    -0.0340 0.004 0.356 0.424 0.216
#> SRR2015721     3  0.3266     0.6677 0.000 0.168 0.832 0.000
#> SRR2015720     3  0.5060     0.1039 0.004 0.412 0.584 0.000
#> SRR2015718     3  0.0779     0.7620 0.004 0.016 0.980 0.000
#> SRR2015719     4  0.1792     0.6674 0.000 0.068 0.000 0.932
#> SRR2015717     3  0.0000     0.7710 0.000 0.000 1.000 0.000
#> SRR2015716     3  0.0657     0.7644 0.004 0.012 0.984 0.000
#> SRR2015714     4  0.0000     0.6944 0.000 0.000 0.000 1.000
#> SRR2015713     2  0.5151     0.3178 0.004 0.532 0.464 0.000
#> SRR2015784     1  0.5322     0.4208 0.660 0.312 0.000 0.028
#> SRR2015785     1  0.5174     0.4378 0.620 0.012 0.000 0.368
#> SRR2015783     1  0.4194     0.7432 0.764 0.008 0.228 0.000
#> SRR2015782     1  0.0817     0.8122 0.976 0.024 0.000 0.000
#> SRR2015781     1  0.6446     0.2789 0.584 0.328 0.000 0.088
#> SRR2015780     1  0.0188     0.8160 0.996 0.004 0.000 0.000
#> SRR2015779     4  0.5677     0.5957 0.040 0.332 0.000 0.628
#> SRR2015778     1  0.0336     0.8166 0.992 0.008 0.000 0.000
#> SRR2015777     1  0.0469     0.8162 0.988 0.012 0.000 0.000
#> SRR2015776     4  0.0592     0.6969 0.000 0.016 0.000 0.984
#> SRR2015775     2  0.4996     0.2589 0.000 0.516 0.484 0.000
#> SRR2015774     3  0.4295     0.5669 0.000 0.240 0.752 0.008
#> SRR2015773     2  0.7231     0.4924 0.000 0.540 0.268 0.192
#> SRR2015772     2  0.7363     0.3495 0.000 0.520 0.208 0.272
#> SRR2015771     3  0.0469     0.7738 0.000 0.012 0.988 0.000
#> SRR2015769     3  0.5444    -0.0460 0.000 0.424 0.560 0.016
#> SRR2015770     4  0.5294     0.3705 0.000 0.484 0.008 0.508
#> SRR2015768     4  0.4697     0.5958 0.000 0.356 0.000 0.644
#> SRR2015767     4  0.0000     0.6944 0.000 0.000 0.000 1.000
#> SRR2015766     3  0.0921     0.7734 0.000 0.028 0.972 0.000
#> SRR2015764     2  0.6335     0.5111 0.004 0.572 0.364 0.060
#> SRR2015765     3  0.6407     0.3052 0.008 0.292 0.624 0.076
#> SRR2015763     3  0.0707     0.7747 0.000 0.020 0.980 0.000
#> SRR2015762     4  0.5105     0.4912 0.000 0.432 0.004 0.564
#> SRR2015761     3  0.4980     0.4153 0.000 0.304 0.680 0.016
#> SRR2015760     3  0.1022     0.7733 0.000 0.032 0.968 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
#> SRR2015715     3  0.1893     0.6123 0.000 0.024 0.928 0.000 0.048
#> SRR2015735     3  0.2825     0.5199 0.016 0.000 0.860 0.000 0.124
#> SRR2015759     1  0.5778     0.2099 0.460 0.000 0.452 0.000 0.088
#> SRR2015753     1  0.2514     0.7333 0.896 0.000 0.044 0.000 0.060
#> SRR2015746     1  0.0671     0.7377 0.980 0.016 0.000 0.000 0.004
#> SRR2015758     2  0.4768     0.4633 0.000 0.776 0.056 0.060 0.108
#> SRR2015756     1  0.5159     0.6363 0.700 0.000 0.180 0.004 0.116
#> SRR2015757     3  0.5153     0.4410 0.000 0.204 0.684 0.000 0.112
#> SRR2015755     1  0.4541     0.6801 0.760 0.000 0.140 0.004 0.096
#> SRR2015754     1  0.4203     0.7035 0.780 0.000 0.128 0.000 0.092
#> SRR2015752     3  0.6778    -0.2428 0.364 0.000 0.408 0.004 0.224
#> SRR2015749     1  0.4291     0.6953 0.772 0.000 0.136 0.000 0.092
#> SRR2015750     2  0.6398     0.5332 0.028 0.568 0.288 0.000 0.116
#> SRR2015751     1  0.0912     0.7371 0.972 0.016 0.000 0.000 0.012
#> SRR2015748     1  0.2853     0.7255 0.892 0.016 0.004 0.028 0.060
#> SRR2015747     1  0.5451     0.6079 0.664 0.000 0.212 0.004 0.120
#> SRR2015745     1  0.1267     0.7337 0.960 0.024 0.000 0.004 0.012
#> SRR2015743     1  0.6295     0.4761 0.572 0.000 0.220 0.008 0.200
#> SRR2015744     1  0.1430     0.7398 0.944 0.000 0.004 0.000 0.052
#> SRR2015742     1  0.1914     0.7289 0.924 0.016 0.000 0.000 0.060
#> SRR2015741     1  0.5117     0.6327 0.696 0.000 0.204 0.004 0.096
#> SRR2015740     3  0.5654     0.0981 0.224 0.000 0.628 0.000 0.148
#> SRR2015738     1  0.6017     0.4516 0.572 0.004 0.292 0.000 0.132
#> SRR2015739     1  0.6651     0.4158 0.536 0.000 0.232 0.016 0.216
#> SRR2015737     2  0.5928     0.5025 0.152 0.696 0.096 0.012 0.044
#> SRR2015736     3  0.4718     0.5101 0.000 0.180 0.728 0.000 0.092
#> SRR2015732     3  0.4025     0.5882 0.000 0.076 0.792 0.000 0.132
#> SRR2015733     2  0.5834     0.4528 0.000 0.532 0.364 0.000 0.104
#> SRR2015734     3  0.1443     0.6067 0.004 0.004 0.948 0.000 0.044
#> SRR2015731     3  0.4591     0.5561 0.000 0.072 0.776 0.128 0.024
#> SRR2015730     3  0.3141     0.4880 0.016 0.000 0.832 0.000 0.152
#> SRR2015728     5  0.5661     0.3760 0.012 0.020 0.148 0.116 0.704
#> SRR2015729     3  0.3664     0.5780 0.000 0.104 0.828 0.004 0.064
#> SRR2015727     3  0.4398     0.4327 0.008 0.000 0.780 0.100 0.112
#> SRR2015726     3  0.2036     0.6111 0.000 0.024 0.920 0.000 0.056
#> SRR2015723     3  0.4225    -0.0718 0.000 0.004 0.632 0.000 0.364
#> SRR2015724     3  0.2624     0.6121 0.000 0.116 0.872 0.000 0.012
#> SRR2015725     3  0.3197     0.4955 0.012 0.004 0.832 0.000 0.152
#> SRR2015722     4  0.6406    -0.1671 0.008 0.000 0.240 0.552 0.200
#> SRR2015721     3  0.2905     0.6105 0.000 0.096 0.868 0.000 0.036
#> SRR2015720     3  0.5403     0.3583 0.000 0.248 0.644 0.000 0.108
#> SRR2015718     5  0.4937     0.3756 0.000 0.028 0.428 0.000 0.544
#> SRR2015719     4  0.2067     0.6179 0.000 0.032 0.000 0.920 0.048
#> SRR2015717     3  0.2966     0.5344 0.000 0.016 0.848 0.000 0.136
#> SRR2015716     3  0.4288    -0.1102 0.004 0.000 0.612 0.000 0.384
#> SRR2015714     4  0.3642     0.7084 0.000 0.232 0.000 0.760 0.008
#> SRR2015713     2  0.5853     0.3094 0.000 0.472 0.432 0.000 0.096
#> SRR2015784     1  0.4557     0.3004 0.584 0.404 0.000 0.000 0.012
#> SRR2015785     1  0.6041     0.1504 0.520 0.036 0.000 0.396 0.048
#> SRR2015783     1  0.5296     0.5557 0.636 0.000 0.280 0.000 0.084
#> SRR2015782     1  0.1408     0.7342 0.948 0.044 0.000 0.000 0.008
#> SRR2015781     1  0.6318     0.4375 0.628 0.160 0.000 0.172 0.040
#> SRR2015780     1  0.2067     0.7259 0.928 0.032 0.000 0.028 0.012
#> SRR2015779     2  0.4945     0.2157 0.044 0.752 0.000 0.148 0.056
#> SRR2015778     1  0.0771     0.7365 0.976 0.020 0.000 0.000 0.004
#> SRR2015777     1  0.1012     0.7379 0.968 0.020 0.000 0.000 0.012
#> SRR2015776     4  0.5168     0.5984 0.000 0.356 0.000 0.592 0.052
#> SRR2015775     2  0.5019     0.3537 0.000 0.536 0.436 0.004 0.024
#> SRR2015774     3  0.4645     0.5022 0.000 0.204 0.724 0.000 0.072
#> SRR2015773     2  0.4382     0.6091 0.000 0.700 0.276 0.020 0.004
#> SRR2015772     2  0.4170     0.6085 0.000 0.712 0.272 0.012 0.004
#> SRR2015771     3  0.1121     0.6048 0.000 0.000 0.956 0.000 0.044
#> SRR2015769     3  0.5537     0.0953 0.000 0.380 0.560 0.012 0.048
#> SRR2015770     2  0.3595     0.4617 0.000 0.852 0.044 0.064 0.040
#> SRR2015768     2  0.4005     0.3219 0.004 0.804 0.004 0.136 0.052
#> SRR2015767     4  0.3196     0.7107 0.000 0.192 0.000 0.804 0.004
#> SRR2015766     3  0.3610     0.6043 0.000 0.068 0.848 0.060 0.024
#> SRR2015764     2  0.5501     0.5603 0.004 0.620 0.304 0.004 0.068
#> SRR2015765     3  0.6029     0.0944 0.004 0.356 0.560 0.048 0.032
#> SRR2015763     3  0.0671     0.6208 0.000 0.004 0.980 0.000 0.016
#> SRR2015762     2  0.4093     0.3697 0.000 0.808 0.020 0.120 0.052
#> SRR2015761     3  0.5229    -0.1265 0.000 0.432 0.528 0.004 0.036
#> SRR2015760     3  0.1522     0.6249 0.000 0.012 0.944 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
#> SRR2015715     1  0.2201    0.62581 0.896 0.000 0.028 0.000 0.000 0.076
#> SRR2015735     1  0.1036    0.61656 0.964 0.004 0.008 0.000 0.000 0.024
#> SRR2015759     1  0.4551    0.36058 0.624 0.004 0.016 0.000 0.340 0.016
#> SRR2015753     5  0.2952    0.67143 0.064 0.016 0.040 0.000 0.872 0.008
#> SRR2015746     5  0.1714    0.68968 0.000 0.016 0.024 0.000 0.936 0.024
#> SRR2015758     2  0.6297    0.54118 0.032 0.504 0.100 0.012 0.004 0.348
#> SRR2015756     5  0.5542    0.36689 0.312 0.016 0.108 0.000 0.564 0.000
#> SRR2015757     6  0.3805    0.56261 0.248 0.008 0.016 0.000 0.000 0.728
#> SRR2015755     5  0.4502    0.53227 0.240 0.016 0.048 0.000 0.696 0.000
#> SRR2015754     5  0.5649    0.29880 0.360 0.016 0.060 0.000 0.544 0.020
#> SRR2015752     1  0.4718    0.45251 0.684 0.008 0.088 0.000 0.220 0.000
#> SRR2015749     5  0.5468    0.31281 0.356 0.008 0.060 0.000 0.556 0.020
#> SRR2015750     6  0.4085    0.38583 0.016 0.092 0.072 0.000 0.020 0.800
#> SRR2015751     5  0.2038    0.69392 0.000 0.032 0.020 0.000 0.920 0.028
#> SRR2015748     5  0.5174    0.61840 0.024 0.048 0.132 0.012 0.736 0.048
#> SRR2015747     1  0.4841    0.17490 0.544 0.008 0.032 0.000 0.412 0.004
#> SRR2015745     5  0.3167    0.66183 0.000 0.028 0.080 0.000 0.852 0.040
#> SRR2015743     1  0.5800    0.15349 0.508 0.012 0.140 0.000 0.340 0.000
#> SRR2015744     5  0.3418    0.67497 0.036 0.040 0.056 0.000 0.852 0.016
#> SRR2015742     5  0.3532    0.65647 0.000 0.044 0.036 0.000 0.828 0.092
#> SRR2015741     1  0.4942    0.16563 0.540 0.008 0.032 0.000 0.412 0.008
#> SRR2015740     1  0.3417    0.55853 0.808 0.004 0.024 0.000 0.156 0.008
#> SRR2015738     5  0.6268    0.27875 0.348 0.008 0.064 0.000 0.504 0.076
#> SRR2015739     1  0.5966    0.17730 0.512 0.012 0.152 0.004 0.320 0.000
#> SRR2015737     6  0.6550   -0.23275 0.020 0.348 0.072 0.004 0.060 0.496
#> SRR2015736     6  0.3729    0.48861 0.296 0.000 0.012 0.000 0.000 0.692
#> SRR2015732     1  0.4135    0.46000 0.668 0.000 0.032 0.000 0.000 0.300
#> SRR2015733     6  0.2221    0.56041 0.072 0.032 0.000 0.000 0.000 0.896
#> SRR2015734     1  0.3496    0.59386 0.804 0.004 0.052 0.000 0.000 0.140
#> SRR2015731     1  0.5940    0.15026 0.460 0.000 0.000 0.268 0.000 0.272
#> SRR2015730     1  0.0405    0.61257 0.988 0.000 0.008 0.000 0.000 0.004
#> SRR2015728     3  0.4195    0.00000 0.148 0.020 0.780 0.036 0.008 0.008
#> SRR2015729     1  0.6354    0.45407 0.584 0.096 0.128 0.004 0.000 0.188
#> SRR2015727     1  0.4183    0.57968 0.772 0.000 0.040 0.140 0.000 0.048
#> SRR2015726     1  0.2207    0.62729 0.900 0.008 0.016 0.000 0.000 0.076
#> SRR2015723     1  0.3547    0.49769 0.768 0.012 0.208 0.000 0.000 0.012
#> SRR2015724     6  0.3995    0.03884 0.480 0.000 0.004 0.000 0.000 0.516
#> SRR2015725     1  0.2340    0.60563 0.896 0.004 0.056 0.000 0.000 0.044
#> SRR2015722     4  0.5304    0.01690 0.356 0.012 0.068 0.560 0.000 0.004
#> SRR2015721     1  0.4845    0.45753 0.664 0.016 0.068 0.000 0.000 0.252
#> SRR2015720     6  0.3183    0.58860 0.164 0.016 0.008 0.000 0.000 0.812
#> SRR2015718     1  0.4644   -0.01442 0.512 0.020 0.456 0.000 0.000 0.012
#> SRR2015719     4  0.0291    0.52137 0.000 0.004 0.004 0.992 0.000 0.000
#> SRR2015717     1  0.3305    0.58110 0.832 0.012 0.108 0.000 0.000 0.048
#> SRR2015716     1  0.3018    0.52065 0.816 0.012 0.168 0.000 0.000 0.004
#> SRR2015714     4  0.3050    0.59187 0.000 0.236 0.000 0.764 0.000 0.000
#> SRR2015713     6  0.2350    0.57960 0.100 0.020 0.000 0.000 0.000 0.880
#> SRR2015784     5  0.6074    0.02377 0.000 0.360 0.024 0.004 0.488 0.124
#> SRR2015785     5  0.7302    0.38310 0.004 0.136 0.144 0.124 0.544 0.048
#> SRR2015783     1  0.4683    0.27954 0.592 0.004 0.028 0.000 0.368 0.008
#> SRR2015782     5  0.1932    0.69279 0.000 0.040 0.020 0.000 0.924 0.016
#> SRR2015781     5  0.6095    0.43727 0.000 0.100 0.040 0.232 0.604 0.024
#> SRR2015780     5  0.4654    0.61174 0.000 0.064 0.108 0.016 0.764 0.048
#> SRR2015779     2  0.4771    0.61119 0.000 0.736 0.000 0.100 0.052 0.112
#> SRR2015778     5  0.1616    0.69097 0.000 0.012 0.028 0.000 0.940 0.020
#> SRR2015777     5  0.1726    0.69209 0.000 0.044 0.012 0.000 0.932 0.012
#> SRR2015776     2  0.3647    0.05249 0.000 0.640 0.000 0.360 0.000 0.000
#> SRR2015775     6  0.6216    0.38834 0.276 0.188 0.028 0.000 0.000 0.508
#> SRR2015774     1  0.4408    0.00562 0.512 0.012 0.008 0.000 0.000 0.468
#> SRR2015773     6  0.5133   -0.08242 0.052 0.392 0.016 0.000 0.000 0.540
#> SRR2015772     6  0.4756   -0.09114 0.052 0.408 0.000 0.000 0.000 0.540
#> SRR2015771     1  0.2263    0.61973 0.884 0.000 0.016 0.000 0.000 0.100
#> SRR2015769     1  0.6923   -0.08536 0.396 0.220 0.064 0.000 0.000 0.320
#> SRR2015770     2  0.4090    0.55586 0.004 0.604 0.000 0.008 0.000 0.384
#> SRR2015768     2  0.4581    0.63665 0.004 0.684 0.032 0.008 0.008 0.264
#> SRR2015767     4  0.2823    0.60277 0.000 0.204 0.000 0.796 0.000 0.000
#> SRR2015766     1  0.5616    0.35940 0.588 0.004 0.012 0.132 0.000 0.264
#> SRR2015764     6  0.4028    0.43148 0.048 0.144 0.012 0.000 0.012 0.784
#> SRR2015765     6  0.5223    0.57722 0.160 0.072 0.012 0.036 0.008 0.712
#> SRR2015763     1  0.2980    0.57758 0.808 0.000 0.012 0.000 0.000 0.180
#> SRR2015762     2  0.3917    0.67807 0.000 0.692 0.000 0.024 0.000 0.284
#> SRR2015761     1  0.6852   -0.20707 0.376 0.216 0.056 0.000 0.000 0.352
#> SRR2015760     1  0.3277    0.57450 0.792 0.004 0.016 0.000 0.000 0.188

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

consensus_heatmap(res, k = 2)

plot of chunk tab-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

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