cola Report for recount2:SRP042596

Date: 2019-12-26 00:15:28 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 15595 rows and 72 columns.
#>   Top rows are extracted by 'SD, CV, MAD, ATC' methods.
#>   Subgroups are detected by 'hclust, kmeans, skmeans, pam, mclust, NMF' method.
#>   Number of partitions are tried for k = 2, 3, 4, 5, 6.
#>   Performed in total 30000 partitions by row resampling.
#> 
#> Following methods can be applied to this 'ConsensusPartitionList' object:
#>  [1] "cola_report"           "collect_classes"       "collect_plots"         "collect_stats"        
#>  [5] "colnames"              "functional_enrichment" "get_anno_col"          "get_anno"             
#>  [9] "get_classes"           "get_matrix"            "get_membership"        "get_stats"            
#> [13] "is_best_k"             "is_stable_k"           "ncol"                  "nrow"                 
#> [17] "rownames"              "show"                  "suggest_best_k"        "test_to_known_factors"
#> [21] "top_rows_heatmap"      "top_rows_overlap"     
#> 
#> You can get result for a single method by, e.g. object["SD", "hclust"] or object["SD:hclust"]
#> or a subset of methods by object[c("SD", "CV")], c("hclust", "kmeans")]

The call of run_all_consensus_partition_methods() was:

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

Dimension of the input matrix:

mat = get_matrix(res_list)
dim(mat)
#> [1] 15595    72

Density distribution

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

library(ComplexHeatmap)
densityHeatmap(mat, ylab = "value", cluster_columns = TRUE, show_column_names = FALSE,
    mc.cores = 4)

plot of chunk density-heatmap

Suggest the best k

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

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

suggest_best_k(res_list)
The best k 1-PAC Mean silhouette Concordance Optional k
SD:skmeans 2 1.000 0.980 0.991 **
SD:pam 3 1.000 0.934 0.968 **
CV:kmeans 2 1.000 0.969 0.964 **
CV:skmeans 2 1.000 0.935 0.975 **
ATC:mclust 6 1.000 0.976 0.991 **
MAD:skmeans 2 0.971 0.922 0.971 **
ATC:skmeans 4 0.965 0.950 0.969 **
ATC:pam 6 0.957 0.922 0.974 ** 3,4
MAD:pam 5 0.923 0.866 0.942 *
SD:NMF 2 0.906 0.893 0.954 *
CV:mclust 2 0.857 0.889 0.947
CV:pam 3 0.844 0.940 0.973
CV:NMF 2 0.836 0.903 0.958
MAD:NMF 2 0.832 0.904 0.959
ATC:NMF 5 0.792 0.795 0.890
SD:hclust 6 0.779 0.864 0.859
ATC:kmeans 6 0.693 0.804 0.856
ATC:hclust 3 0.597 0.856 0.900
SD:kmeans 2 0.586 0.852 0.875
MAD:mclust 5 0.554 0.566 0.752
MAD:hclust 5 0.504 0.687 0.778
CV:hclust 2 0.497 0.909 0.914
SD:mclust 3 0.470 0.730 0.873
MAD:kmeans 2 0.409 0.778 0.862

**: 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.906           0.893       0.955          0.489 0.507   0.507
#> CV:NMF      2 0.836           0.903       0.958          0.501 0.496   0.496
#> MAD:NMF     2 0.832           0.904       0.959          0.499 0.499   0.499
#> ATC:NMF     2 0.807           0.879       0.951          0.332 0.665   0.665
#> SD:skmeans  2 1.000           0.980       0.991          0.502 0.499   0.499
#> CV:skmeans  2 1.000           0.935       0.975          0.500 0.495   0.495
#> MAD:skmeans 2 0.971           0.922       0.971          0.504 0.496   0.496
#> ATC:skmeans 2 0.837           0.841       0.940          0.505 0.496   0.496
#> SD:mclust   2 0.215           0.750       0.810          0.364 0.757   0.757
#> CV:mclust   2 0.857           0.889       0.947          0.500 0.499   0.499
#> MAD:mclust  2 0.712           0.912       0.942          0.288 0.757   0.757
#> ATC:mclust  2 0.718           0.896       0.945          0.489 0.493   0.493
#> SD:kmeans   2 0.586           0.852       0.875          0.449 0.532   0.532
#> CV:kmeans   2 1.000           0.969       0.964          0.431 0.559   0.559
#> MAD:kmeans  2 0.409           0.778       0.862          0.445 0.507   0.507
#> ATC:kmeans  2 0.378           0.753       0.798          0.424 0.559   0.559
#> SD:pam      2 0.534           0.821       0.867          0.312 0.700   0.700
#> CV:pam      2 0.586           0.886       0.910          0.223 0.737   0.737
#> MAD:pam     2 0.304           0.756       0.841          0.368 0.682   0.682
#> ATC:pam     2 0.586           0.811       0.886          0.234 0.778   0.778
#> SD:hclust   2 0.442           0.753       0.885          0.441 0.581   0.581
#> CV:hclust   2 0.497           0.909       0.914          0.414 0.559   0.559
#> MAD:hclust  2 0.332           0.667       0.775          0.406 0.499   0.499
#> ATC:hclust  2 0.277           0.799       0.863          0.365 0.593   0.593
get_stats(res_list, k = 3)
#>             k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> SD:NMF      3 0.629           0.732       0.870         0.3355 0.737   0.528
#> CV:NMF      3 0.421           0.552       0.749         0.2939 0.796   0.612
#> MAD:NMF     3 0.622           0.563       0.788         0.3344 0.749   0.534
#> ATC:NMF     3 0.589           0.759       0.900         0.7182 0.734   0.600
#> SD:skmeans  3 0.612           0.613       0.686         0.3041 0.826   0.657
#> CV:skmeans  3 0.734           0.728       0.884         0.3264 0.755   0.542
#> MAD:skmeans 3 0.618           0.716       0.814         0.3140 0.793   0.601
#> ATC:skmeans 3 0.638           0.715       0.853         0.2915 0.812   0.641
#> SD:mclust   3 0.470           0.730       0.873         0.6544 0.628   0.508
#> CV:mclust   3 0.767           0.845       0.931         0.2028 0.771   0.593
#> MAD:mclust  3 0.270           0.460       0.678         0.9394 0.649   0.537
#> ATC:mclust  3 0.292           0.837       0.846         0.0633 0.521   0.307
#> SD:kmeans   3 0.454           0.733       0.786         0.3256 0.849   0.717
#> CV:kmeans   3 0.369           0.534       0.766         0.3250 0.963   0.934
#> MAD:kmeans  3 0.469           0.742       0.796         0.3612 0.784   0.612
#> ATC:kmeans  3 0.414           0.764       0.849         0.2169 0.585   0.462
#> SD:pam      3 1.000           0.934       0.969         0.7201 0.747   0.644
#> CV:pam      3 0.844           0.940       0.973         0.4849 0.954   0.937
#> MAD:pam     3 0.586           0.863       0.901         0.4501 0.774   0.678
#> ATC:pam     3 1.000           1.000       1.000         0.8370 0.793   0.734
#> SD:hclust   3 0.517           0.688       0.803         0.3387 0.687   0.497
#> CV:hclust   3 0.565           0.806       0.831         0.2035 1.000   1.000
#> MAD:hclust  3 0.303           0.509       0.743         0.2920 0.755   0.592
#> ATC:hclust  3 0.597           0.856       0.900         0.5133 0.836   0.723
get_stats(res_list, k = 4)
#>             k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> SD:NMF      4 0.485           0.477       0.687          0.119 0.846   0.625
#> CV:NMF      4 0.633           0.689       0.849          0.106 0.764   0.456
#> MAD:NMF     4 0.510           0.536       0.755          0.118 0.784   0.450
#> ATC:NMF     4 0.658           0.767       0.881          0.244 0.758   0.470
#> SD:skmeans  4 0.862           0.806       0.911          0.155 0.809   0.508
#> CV:skmeans  4 0.616           0.646       0.809          0.123 0.787   0.466
#> MAD:skmeans 4 0.808           0.784       0.898          0.143 0.837   0.561
#> ATC:skmeans 4 0.965           0.950       0.969          0.141 0.839   0.586
#> SD:mclust   4 0.483           0.676       0.791          0.151 0.888   0.729
#> CV:mclust   4 0.728           0.759       0.882          0.123 0.890   0.732
#> MAD:mclust  4 0.430           0.529       0.734          0.225 0.717   0.429
#> ATC:mclust  4 0.616           0.664       0.732          0.240 0.660   0.366
#> SD:kmeans   4 0.541           0.653       0.799          0.143 0.847   0.644
#> CV:kmeans   4 0.481           0.739       0.806          0.143 0.821   0.661
#> MAD:kmeans  4 0.502           0.651       0.782          0.153 0.840   0.615
#> ATC:kmeans  4 0.563           0.718       0.838          0.242 0.777   0.609
#> SD:pam      4 0.758           0.882       0.937          0.229 0.891   0.770
#> CV:pam      4 0.462           0.784       0.864          0.380 0.954   0.933
#> MAD:pam     4 0.586           0.727       0.834          0.273 0.784   0.577
#> ATC:pam     4 0.951           0.905       0.952          0.463 0.797   0.644
#> SD:hclust   4 0.663           0.789       0.832          0.107 0.854   0.650
#> CV:hclust   4 0.604           0.735       0.885          0.136 0.819   0.703
#> MAD:hclust  4 0.363           0.464       0.660          0.186 0.658   0.401
#> ATC:hclust  4 0.651           0.857       0.879          0.102 0.961   0.910
get_stats(res_list, k = 5)
#>             k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> SD:NMF      5 0.655           0.726       0.827         0.0742 0.816   0.486
#> CV:NMF      5 0.482           0.431       0.704         0.0728 0.864   0.577
#> MAD:NMF     5 0.644           0.614       0.767         0.0616 0.889   0.612
#> ATC:NMF     5 0.792           0.795       0.890         0.0856 0.881   0.612
#> SD:skmeans  5 0.845           0.788       0.884         0.0653 0.934   0.738
#> CV:skmeans  5 0.767           0.764       0.880         0.0798 0.898   0.629
#> MAD:skmeans 5 0.813           0.774       0.876         0.0651 0.842   0.466
#> ATC:skmeans 5 0.807           0.682       0.859         0.0693 0.928   0.726
#> SD:mclust   5 0.619           0.677       0.764         0.0975 0.888   0.679
#> CV:mclust   5 0.579           0.566       0.751         0.1156 0.830   0.517
#> MAD:mclust  5 0.554           0.566       0.752         0.1101 0.891   0.658
#> ATC:mclust  5 0.808           0.873       0.917         0.1836 0.825   0.518
#> SD:kmeans   5 0.634           0.635       0.795         0.0781 0.975   0.925
#> CV:kmeans   5 0.569           0.539       0.758         0.0942 0.958   0.881
#> MAD:kmeans  5 0.582           0.569       0.739         0.0864 0.905   0.705
#> ATC:kmeans  5 0.633           0.723       0.833         0.1214 0.887   0.719
#> SD:pam      5 0.774           0.775       0.851         0.1021 0.950   0.864
#> CV:pam      5 0.475           0.743       0.872         0.0680 0.947   0.918
#> MAD:pam     5 0.923           0.866       0.942         0.1281 0.901   0.692
#> ATC:pam     5 0.795           0.812       0.909         0.1724 0.838   0.577
#> SD:hclust   5 0.676           0.675       0.771         0.1109 0.904   0.726
#> CV:hclust   5 0.756           0.797       0.907         0.0792 0.913   0.822
#> MAD:hclust  5 0.504           0.687       0.778         0.1525 0.750   0.425
#> ATC:hclust  5 0.744           0.862       0.921         0.1037 0.954   0.883
get_stats(res_list, k = 6)
#>             k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> SD:NMF      6 0.695           0.714       0.828         0.0323 0.940   0.741
#> CV:NMF      6 0.578           0.478       0.702         0.0479 0.754   0.277
#> MAD:NMF     6 0.722           0.704       0.828         0.0390 0.903   0.605
#> ATC:NMF     6 0.763           0.689       0.830         0.0331 0.934   0.741
#> SD:skmeans  6 0.814           0.720       0.818         0.0348 0.964   0.819
#> CV:skmeans  6 0.773           0.702       0.797         0.0361 0.956   0.787
#> MAD:skmeans 6 0.803           0.704       0.806         0.0359 0.988   0.939
#> ATC:skmeans 6 0.791           0.714       0.855         0.0371 0.952   0.774
#> SD:mclust   6 0.662           0.494       0.667         0.0441 0.881   0.573
#> CV:mclust   6 0.571           0.462       0.679         0.0560 0.941   0.754
#> MAD:mclust  6 0.604           0.549       0.705         0.0558 0.914   0.635
#> ATC:mclust  6 1.000           0.976       0.991         0.0426 0.951   0.794
#> SD:kmeans   6 0.676           0.656       0.755         0.0658 0.900   0.686
#> CV:kmeans   6 0.601           0.465       0.757         0.0740 0.887   0.656
#> MAD:kmeans  6 0.651           0.587       0.711         0.0575 0.868   0.556
#> ATC:kmeans  6 0.693           0.804       0.856         0.0762 0.894   0.693
#> SD:pam      6 0.814           0.855       0.906         0.1011 0.865   0.590
#> CV:pam      6 0.468           0.851       0.884         0.0318 0.998   0.997
#> MAD:pam     6 0.867           0.852       0.919         0.0367 0.976   0.896
#> ATC:pam     6 0.957           0.922       0.974         0.0650 0.962   0.844
#> SD:hclust   6 0.779           0.864       0.859         0.0754 0.897   0.636
#> CV:hclust   6 0.617           0.752       0.847         0.0744 0.998   0.994
#> MAD:hclust  6 0.651           0.501       0.733         0.0736 0.933   0.764
#> ATC:hclust  6 0.759           0.838       0.892         0.1371 0.887   0.670

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

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

collect_plots(res)

plot of chunk SD-hclust-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.442           0.753       0.885         0.4414 0.581   0.581
#> 3 3 0.517           0.688       0.803         0.3387 0.687   0.497
#> 4 4 0.663           0.789       0.832         0.1070 0.854   0.650
#> 5 5 0.676           0.675       0.771         0.1109 0.904   0.726
#> 6 6 0.779           0.864       0.859         0.0754 0.897   0.636

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

suggest_best_k(res)
#> [1] 6

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
#> SRR1303990     1  0.0000      0.835 1.000 0.000
#> SRR1303991     1  0.0000      0.835 1.000 0.000
#> SRR1303992     1  0.0000      0.835 1.000 0.000
#> SRR1303993     1  0.0000      0.835 1.000 0.000
#> SRR1303994     1  0.0000      0.835 1.000 0.000
#> SRR1303995     1  0.0000      0.835 1.000 0.000
#> SRR1303996     1  0.0000      0.835 1.000 0.000
#> SRR1303997     1  0.0000      0.835 1.000 0.000
#> SRR1303998     1  0.0000      0.835 1.000 0.000
#> SRR1303999     1  0.0000      0.835 1.000 0.000
#> SRR1304000     1  0.0000      0.835 1.000 0.000
#> SRR1304001     1  0.0000      0.835 1.000 0.000
#> SRR1304004     1  0.0672      0.834 0.992 0.008
#> SRR1304005     1  0.0672      0.834 0.992 0.008
#> SRR1304002     1  0.2236      0.825 0.964 0.036
#> SRR1304003     1  0.2236      0.825 0.964 0.036
#> SRR1304006     1  0.1633      0.830 0.976 0.024
#> SRR1304007     1  0.1633      0.830 0.976 0.024
#> SRR1304008     1  0.0000      0.835 1.000 0.000
#> SRR1304009     1  0.0000      0.835 1.000 0.000
#> SRR1304010     1  0.9209      0.549 0.664 0.336
#> SRR1304011     1  0.9209      0.549 0.664 0.336
#> SRR1304012     1  0.0000      0.835 1.000 0.000
#> SRR1304013     1  0.0000      0.835 1.000 0.000
#> SRR1304014     1  0.1414      0.831 0.980 0.020
#> SRR1304015     1  0.0000      0.835 1.000 0.000
#> SRR1304016     1  0.0000      0.835 1.000 0.000
#> SRR1304017     2  0.0376      0.922 0.004 0.996
#> SRR1304018     2  0.0376      0.922 0.004 0.996
#> SRR1304019     1  0.0000      0.835 1.000 0.000
#> SRR1304020     1  0.0000      0.835 1.000 0.000
#> SRR1304021     1  0.1414      0.831 0.980 0.020
#> SRR1304022     2  0.0376      0.922 0.004 0.996
#> SRR1304024     2  0.0376      0.922 0.004 0.996
#> SRR1304023     1  0.0000      0.835 1.000 0.000
#> SRR1304026     2  0.0000      0.920 0.000 1.000
#> SRR1304027     2  0.0000      0.920 0.000 1.000
#> SRR1304025     1  1.0000      0.211 0.504 0.496
#> SRR1304028     2  0.5408      0.884 0.124 0.876
#> SRR1304029     2  0.5408      0.884 0.124 0.876
#> SRR1304030     1  0.0672      0.834 0.992 0.008
#> SRR1304031     1  0.0672      0.834 0.992 0.008
#> SRR1304032     2  0.0000      0.920 0.000 1.000
#> SRR1304033     2  0.0000      0.920 0.000 1.000
#> SRR1304034     2  0.5842      0.867 0.140 0.860
#> SRR1304035     2  0.5842      0.867 0.140 0.860
#> SRR1304036     2  0.5842      0.867 0.140 0.860
#> SRR1304037     2  0.5842      0.867 0.140 0.860
#> SRR1304038     1  1.0000      0.211 0.504 0.496
#> SRR1304039     1  1.0000      0.211 0.504 0.496
#> SRR1304040     2  0.0376      0.922 0.004 0.996
#> SRR1304041     2  0.0376      0.922 0.004 0.996
#> SRR1304042     2  0.0000      0.920 0.000 1.000
#> SRR1304043     2  0.0000      0.920 0.000 1.000
#> SRR1304046     1  0.0938      0.832 0.988 0.012
#> SRR1304047     1  0.0938      0.832 0.988 0.012
#> SRR1304044     2  0.5408      0.884 0.124 0.876
#> SRR1304045     2  0.5408      0.884 0.124 0.876
#> SRR1304048     1  1.0000      0.211 0.504 0.496
#> SRR1304049     1  1.0000      0.211 0.504 0.496
#> SRR1304050     1  0.1414      0.831 0.980 0.020
#> SRR1304051     1  0.8443      0.632 0.728 0.272
#> SRR1304052     1  0.8443      0.632 0.728 0.272
#> SRR1304053     1  0.8443      0.632 0.728 0.272
#> SRR1304055     1  0.9944      0.325 0.544 0.456
#> SRR1304054     2  0.5408      0.884 0.124 0.876
#> SRR1304056     1  0.9944      0.325 0.544 0.456
#> SRR1304059     1  0.9944      0.325 0.544 0.456
#> SRR1304057     1  0.9635      0.463 0.612 0.388
#> SRR1304058     1  0.9795      0.415 0.584 0.416
#> SRR1304060     1  0.7453      0.691 0.788 0.212
#> SRR1304061     1  0.9944      0.325 0.544 0.456

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>            class entropy silhouette    p1    p2    p3
#> SRR1303990     1  0.3192      0.465 0.888 0.000 0.112
#> SRR1303991     1  0.3192      0.465 0.888 0.000 0.112
#> SRR1303992     3  0.0592      0.965 0.012 0.000 0.988
#> SRR1303993     3  0.0592      0.965 0.012 0.000 0.988
#> SRR1303994     3  0.1031      0.960 0.024 0.000 0.976
#> SRR1303995     3  0.1031      0.960 0.024 0.000 0.976
#> SRR1303996     3  0.1031      0.960 0.024 0.000 0.976
#> SRR1303997     3  0.1031      0.960 0.024 0.000 0.976
#> SRR1303998     3  0.1031      0.960 0.024 0.000 0.976
#> SRR1303999     3  0.1031      0.960 0.024 0.000 0.976
#> SRR1304000     3  0.1031      0.960 0.024 0.000 0.976
#> SRR1304001     3  0.1031      0.960 0.024 0.000 0.976
#> SRR1304004     3  0.1315      0.959 0.020 0.008 0.972
#> SRR1304005     3  0.1315      0.959 0.020 0.008 0.972
#> SRR1304002     3  0.2297      0.936 0.020 0.036 0.944
#> SRR1304003     3  0.2297      0.936 0.020 0.036 0.944
#> SRR1304006     3  0.2879      0.915 0.052 0.024 0.924
#> SRR1304007     3  0.2879      0.915 0.052 0.024 0.924
#> SRR1304008     3  0.0000      0.968 0.000 0.000 1.000
#> SRR1304009     3  0.0000      0.968 0.000 0.000 1.000
#> SRR1304010     1  0.8593      0.594 0.596 0.248 0.156
#> SRR1304011     1  0.8593      0.594 0.596 0.248 0.156
#> SRR1304012     3  0.0000      0.968 0.000 0.000 1.000
#> SRR1304013     3  0.0000      0.968 0.000 0.000 1.000
#> SRR1304014     3  0.1781      0.953 0.020 0.020 0.960
#> SRR1304015     3  0.0000      0.968 0.000 0.000 1.000
#> SRR1304016     3  0.0237      0.967 0.004 0.000 0.996
#> SRR1304017     2  0.0237      0.699 0.000 0.996 0.004
#> SRR1304018     2  0.0237      0.699 0.000 0.996 0.004
#> SRR1304019     3  0.0000      0.968 0.000 0.000 1.000
#> SRR1304020     3  0.0000      0.968 0.000 0.000 1.000
#> SRR1304021     3  0.1781      0.953 0.020 0.020 0.960
#> SRR1304022     2  0.0237      0.699 0.000 0.996 0.004
#> SRR1304024     2  0.0237      0.699 0.000 0.996 0.004
#> SRR1304023     1  0.2959      0.460 0.900 0.000 0.100
#> SRR1304026     2  0.0237      0.695 0.004 0.996 0.000
#> SRR1304027     2  0.0237      0.695 0.004 0.996 0.000
#> SRR1304025     2  0.9732     -0.360 0.372 0.404 0.224
#> SRR1304028     2  0.5061      0.643 0.208 0.784 0.008
#> SRR1304029     2  0.5061      0.643 0.208 0.784 0.008
#> SRR1304030     3  0.1315      0.959 0.020 0.008 0.972
#> SRR1304031     3  0.1315      0.959 0.020 0.008 0.972
#> SRR1304032     2  0.0237      0.695 0.004 0.996 0.000
#> SRR1304033     2  0.0237      0.695 0.004 0.996 0.000
#> SRR1304034     2  0.5247      0.627 0.224 0.768 0.008
#> SRR1304035     2  0.5247      0.627 0.224 0.768 0.008
#> SRR1304036     2  0.5247      0.627 0.224 0.768 0.008
#> SRR1304037     2  0.5247      0.627 0.224 0.768 0.008
#> SRR1304038     2  0.9732     -0.360 0.372 0.404 0.224
#> SRR1304039     2  0.9732     -0.360 0.372 0.404 0.224
#> SRR1304040     2  0.0237      0.699 0.000 0.996 0.004
#> SRR1304041     2  0.0237      0.699 0.000 0.996 0.004
#> SRR1304042     2  0.0237      0.695 0.004 0.996 0.000
#> SRR1304043     2  0.0237      0.695 0.004 0.996 0.000
#> SRR1304046     3  0.0829      0.964 0.004 0.012 0.984
#> SRR1304047     3  0.0829      0.964 0.004 0.012 0.984
#> SRR1304044     2  0.5061      0.643 0.208 0.784 0.008
#> SRR1304045     2  0.5061      0.643 0.208 0.784 0.008
#> SRR1304048     2  0.9732     -0.360 0.372 0.404 0.224
#> SRR1304049     2  0.9732     -0.360 0.372 0.404 0.224
#> SRR1304050     3  0.1781      0.953 0.020 0.020 0.960
#> SRR1304051     1  0.8478      0.634 0.616 0.180 0.204
#> SRR1304052     1  0.8478      0.634 0.616 0.180 0.204
#> SRR1304053     1  0.8478      0.634 0.616 0.180 0.204
#> SRR1304055     1  0.9855      0.412 0.384 0.364 0.252
#> SRR1304054     2  0.5061      0.643 0.208 0.784 0.008
#> SRR1304056     1  0.9855      0.412 0.384 0.364 0.252
#> SRR1304059     1  0.9855      0.412 0.384 0.364 0.252
#> SRR1304057     1  0.9921      0.479 0.396 0.296 0.308
#> SRR1304058     1  0.6129      0.372 0.668 0.324 0.008
#> SRR1304060     1  0.7762      0.600 0.668 0.120 0.212
#> SRR1304061     1  0.9855      0.412 0.384 0.364 0.252

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> SRR1303990     3  0.0592      0.987 0.016 0.000 0.984 0.000
#> SRR1303991     3  0.0592      0.987 0.016 0.000 0.984 0.000
#> SRR1303992     1  0.0804      0.964 0.980 0.012 0.000 0.008
#> SRR1303993     1  0.0804      0.964 0.980 0.012 0.000 0.008
#> SRR1303994     1  0.1271      0.961 0.968 0.012 0.012 0.008
#> SRR1303995     1  0.1271      0.961 0.968 0.012 0.012 0.008
#> SRR1303996     1  0.1271      0.961 0.968 0.012 0.012 0.008
#> SRR1303997     1  0.1271      0.961 0.968 0.012 0.012 0.008
#> SRR1303998     1  0.1271      0.961 0.968 0.012 0.012 0.008
#> SRR1303999     1  0.1271      0.961 0.968 0.012 0.012 0.008
#> SRR1304000     1  0.1271      0.961 0.968 0.012 0.012 0.008
#> SRR1304001     1  0.1271      0.961 0.968 0.012 0.012 0.008
#> SRR1304004     1  0.0921      0.961 0.972 0.028 0.000 0.000
#> SRR1304005     1  0.0921      0.961 0.972 0.028 0.000 0.000
#> SRR1304002     1  0.1557      0.944 0.944 0.056 0.000 0.000
#> SRR1304003     1  0.1557      0.944 0.944 0.056 0.000 0.000
#> SRR1304006     1  0.2256      0.923 0.924 0.056 0.020 0.000
#> SRR1304007     1  0.2256      0.923 0.924 0.056 0.020 0.000
#> SRR1304008     1  0.0000      0.969 1.000 0.000 0.000 0.000
#> SRR1304009     1  0.0000      0.969 1.000 0.000 0.000 0.000
#> SRR1304010     2  0.7145      0.517 0.148 0.616 0.216 0.020
#> SRR1304011     2  0.7145      0.517 0.148 0.616 0.216 0.020
#> SRR1304012     1  0.0000      0.969 1.000 0.000 0.000 0.000
#> SRR1304013     1  0.0000      0.969 1.000 0.000 0.000 0.000
#> SRR1304014     1  0.1211      0.957 0.960 0.040 0.000 0.000
#> SRR1304015     1  0.0000      0.969 1.000 0.000 0.000 0.000
#> SRR1304016     1  0.0188      0.969 0.996 0.004 0.000 0.000
#> SRR1304017     4  0.1474      0.932 0.000 0.052 0.000 0.948
#> SRR1304018     4  0.1474      0.932 0.000 0.052 0.000 0.948
#> SRR1304019     1  0.0000      0.969 1.000 0.000 0.000 0.000
#> SRR1304020     1  0.0000      0.969 1.000 0.000 0.000 0.000
#> SRR1304021     1  0.1211      0.957 0.960 0.040 0.000 0.000
#> SRR1304022     4  0.1474      0.932 0.000 0.052 0.000 0.948
#> SRR1304024     4  0.1474      0.932 0.000 0.052 0.000 0.948
#> SRR1304023     3  0.0000      0.975 0.000 0.000 1.000 0.000
#> SRR1304026     4  0.0336      0.919 0.000 0.008 0.000 0.992
#> SRR1304027     4  0.0336      0.919 0.000 0.008 0.000 0.992
#> SRR1304025     2  0.4904      0.650 0.216 0.744 0.000 0.040
#> SRR1304028     2  0.4134      0.408 0.000 0.740 0.000 0.260
#> SRR1304029     2  0.4134      0.408 0.000 0.740 0.000 0.260
#> SRR1304030     1  0.0921      0.961 0.972 0.028 0.000 0.000
#> SRR1304031     1  0.0921      0.961 0.972 0.028 0.000 0.000
#> SRR1304032     4  0.3726      0.767 0.000 0.212 0.000 0.788
#> SRR1304033     4  0.3726      0.767 0.000 0.212 0.000 0.788
#> SRR1304034     2  0.3942      0.443 0.000 0.764 0.000 0.236
#> SRR1304035     2  0.3942      0.443 0.000 0.764 0.000 0.236
#> SRR1304036     2  0.3942      0.443 0.000 0.764 0.000 0.236
#> SRR1304037     2  0.3942      0.443 0.000 0.764 0.000 0.236
#> SRR1304038     2  0.4904      0.650 0.216 0.744 0.000 0.040
#> SRR1304039     2  0.4904      0.650 0.216 0.744 0.000 0.040
#> SRR1304040     4  0.1474      0.932 0.000 0.052 0.000 0.948
#> SRR1304041     4  0.1474      0.932 0.000 0.052 0.000 0.948
#> SRR1304042     4  0.0336      0.919 0.000 0.008 0.000 0.992
#> SRR1304043     4  0.0336      0.919 0.000 0.008 0.000 0.992
#> SRR1304046     1  0.0592      0.966 0.984 0.016 0.000 0.000
#> SRR1304047     1  0.0592      0.966 0.984 0.016 0.000 0.000
#> SRR1304044     2  0.4134      0.408 0.000 0.740 0.000 0.260
#> SRR1304045     2  0.4134      0.408 0.000 0.740 0.000 0.260
#> SRR1304048     2  0.4904      0.650 0.216 0.744 0.000 0.040
#> SRR1304049     2  0.4904      0.650 0.216 0.744 0.000 0.040
#> SRR1304050     1  0.1211      0.957 0.960 0.040 0.000 0.000
#> SRR1304051     2  0.7680      0.463 0.196 0.552 0.232 0.020
#> SRR1304052     2  0.7680      0.463 0.196 0.552 0.232 0.020
#> SRR1304053     2  0.7680      0.463 0.196 0.552 0.232 0.020
#> SRR1304055     2  0.4872      0.639 0.244 0.728 0.000 0.028
#> SRR1304054     2  0.4134      0.408 0.000 0.740 0.000 0.260
#> SRR1304056     2  0.4872      0.639 0.244 0.728 0.000 0.028
#> SRR1304059     2  0.4872      0.639 0.244 0.728 0.000 0.028
#> SRR1304057     2  0.5904      0.584 0.300 0.652 0.020 0.028
#> SRR1304058     2  0.7012      0.315 0.000 0.560 0.284 0.156
#> SRR1304060     2  0.7390      0.333 0.204 0.512 0.284 0.000
#> SRR1304061     2  0.4872      0.639 0.244 0.728 0.000 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
#> SRR1303990     5  0.0510      0.992 0.000 0.000 0.016 0.000 0.984
#> SRR1303991     5  0.0510      0.992 0.000 0.000 0.016 0.000 0.984
#> SRR1303992     3  0.0404      0.570 0.012 0.000 0.988 0.000 0.000
#> SRR1303993     3  0.0404      0.570 0.012 0.000 0.988 0.000 0.000
#> SRR1303994     3  0.0000      0.563 0.000 0.000 1.000 0.000 0.000
#> SRR1303995     3  0.0000      0.563 0.000 0.000 1.000 0.000 0.000
#> SRR1303996     3  0.0000      0.563 0.000 0.000 1.000 0.000 0.000
#> SRR1303997     3  0.0000      0.563 0.000 0.000 1.000 0.000 0.000
#> SRR1303998     3  0.0000      0.563 0.000 0.000 1.000 0.000 0.000
#> SRR1303999     3  0.0000      0.563 0.000 0.000 1.000 0.000 0.000
#> SRR1304000     3  0.0000      0.563 0.000 0.000 1.000 0.000 0.000
#> SRR1304001     3  0.0000      0.563 0.000 0.000 1.000 0.000 0.000
#> SRR1304004     3  0.4451      0.737 0.492 0.004 0.504 0.000 0.000
#> SRR1304005     3  0.4451      0.737 0.492 0.004 0.504 0.000 0.000
#> SRR1304002     3  0.5046      0.720 0.468 0.032 0.500 0.000 0.000
#> SRR1304003     3  0.5046      0.720 0.468 0.032 0.500 0.000 0.000
#> SRR1304006     1  0.4826     -0.714 0.508 0.020 0.472 0.000 0.000
#> SRR1304007     1  0.4826     -0.714 0.508 0.020 0.472 0.000 0.000
#> SRR1304008     3  0.4294      0.752 0.468 0.000 0.532 0.000 0.000
#> SRR1304009     3  0.4294      0.752 0.468 0.000 0.532 0.000 0.000
#> SRR1304010     1  0.6311      0.557 0.616 0.204 0.032 0.000 0.148
#> SRR1304011     1  0.6311      0.557 0.616 0.204 0.032 0.000 0.148
#> SRR1304012     3  0.4294      0.752 0.468 0.000 0.532 0.000 0.000
#> SRR1304013     3  0.4294      0.752 0.468 0.000 0.532 0.000 0.000
#> SRR1304014     3  0.4747      0.733 0.484 0.016 0.500 0.000 0.000
#> SRR1304015     3  0.4294      0.752 0.468 0.000 0.532 0.000 0.000
#> SRR1304016     3  0.4440      0.750 0.468 0.004 0.528 0.000 0.000
#> SRR1304017     4  0.1197      0.879 0.000 0.048 0.000 0.952 0.000
#> SRR1304018     4  0.1197      0.879 0.000 0.048 0.000 0.952 0.000
#> SRR1304019     3  0.4294      0.752 0.468 0.000 0.532 0.000 0.000
#> SRR1304020     3  0.4294      0.752 0.468 0.000 0.532 0.000 0.000
#> SRR1304021     3  0.4747      0.733 0.484 0.016 0.500 0.000 0.000
#> SRR1304022     4  0.1197      0.879 0.000 0.048 0.000 0.952 0.000
#> SRR1304024     4  0.1197      0.879 0.000 0.048 0.000 0.952 0.000
#> SRR1304023     5  0.0000      0.984 0.000 0.000 0.000 0.000 1.000
#> SRR1304026     4  0.0162      0.863 0.004 0.000 0.000 0.996 0.000
#> SRR1304027     4  0.0162      0.863 0.004 0.000 0.000 0.996 0.000
#> SRR1304025     1  0.4262      0.511 0.560 0.440 0.000 0.000 0.000
#> SRR1304028     2  0.0000      0.978 0.000 1.000 0.000 0.000 0.000
#> SRR1304029     2  0.0000      0.978 0.000 1.000 0.000 0.000 0.000
#> SRR1304030     3  0.4451      0.737 0.492 0.004 0.504 0.000 0.000
#> SRR1304031     3  0.4451      0.737 0.492 0.004 0.504 0.000 0.000
#> SRR1304032     4  0.4359      0.418 0.004 0.412 0.000 0.584 0.000
#> SRR1304033     4  0.4359      0.418 0.004 0.412 0.000 0.584 0.000
#> SRR1304034     2  0.0703      0.972 0.024 0.976 0.000 0.000 0.000
#> SRR1304035     2  0.0703      0.972 0.024 0.976 0.000 0.000 0.000
#> SRR1304036     2  0.0703      0.972 0.024 0.976 0.000 0.000 0.000
#> SRR1304037     2  0.0703      0.972 0.024 0.976 0.000 0.000 0.000
#> SRR1304038     1  0.4262      0.511 0.560 0.440 0.000 0.000 0.000
#> SRR1304039     1  0.4262      0.511 0.560 0.440 0.000 0.000 0.000
#> SRR1304040     4  0.1197      0.879 0.000 0.048 0.000 0.952 0.000
#> SRR1304041     4  0.1197      0.879 0.000 0.048 0.000 0.952 0.000
#> SRR1304042     4  0.0162      0.863 0.004 0.000 0.000 0.996 0.000
#> SRR1304043     4  0.0162      0.863 0.004 0.000 0.000 0.996 0.000
#> SRR1304046     3  0.4735      0.747 0.460 0.016 0.524 0.000 0.000
#> SRR1304047     3  0.4735      0.747 0.460 0.016 0.524 0.000 0.000
#> SRR1304044     2  0.0000      0.978 0.000 1.000 0.000 0.000 0.000
#> SRR1304045     2  0.0000      0.978 0.000 1.000 0.000 0.000 0.000
#> SRR1304048     1  0.4262      0.511 0.560 0.440 0.000 0.000 0.000
#> SRR1304049     1  0.4262      0.511 0.560 0.440 0.000 0.000 0.000
#> SRR1304050     3  0.4747      0.733 0.484 0.016 0.500 0.000 0.000
#> SRR1304051     1  0.5308      0.537 0.704 0.136 0.012 0.000 0.148
#> SRR1304052     1  0.5308      0.537 0.704 0.136 0.012 0.000 0.148
#> SRR1304053     1  0.5308      0.537 0.704 0.136 0.012 0.000 0.148
#> SRR1304055     1  0.3949      0.603 0.668 0.332 0.000 0.000 0.000
#> SRR1304054     2  0.0000      0.978 0.000 1.000 0.000 0.000 0.000
#> SRR1304056     1  0.3949      0.603 0.668 0.332 0.000 0.000 0.000
#> SRR1304059     1  0.3949      0.603 0.668 0.332 0.000 0.000 0.000
#> SRR1304057     1  0.4689      0.601 0.688 0.264 0.048 0.000 0.000
#> SRR1304058     1  0.7466      0.276 0.528 0.140 0.000 0.132 0.200
#> SRR1304060     1  0.6207      0.398 0.644 0.096 0.060 0.000 0.200
#> SRR1304061     1  0.3949      0.603 0.668 0.332 0.000 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>            class entropy silhouette    p1    p2    p3    p4    p5    p6
#> SRR1303990     6  0.0458      0.991 0.000 0.000 0.016 0.000 0.000 0.984
#> SRR1303991     6  0.0458      0.991 0.000 0.000 0.016 0.000 0.000 0.984
#> SRR1303992     3  0.0363      0.983 0.000 0.000 0.988 0.000 0.012 0.000
#> SRR1303993     3  0.0363      0.983 0.000 0.000 0.988 0.000 0.012 0.000
#> SRR1303994     3  0.0000      0.996 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1303995     3  0.0000      0.996 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1303996     3  0.0000      0.996 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1303997     3  0.0000      0.996 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1303998     3  0.0000      0.996 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1303999     3  0.0000      0.996 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1304000     3  0.0000      0.996 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1304001     3  0.0000      0.996 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1304004     5  0.0777      0.967 0.024 0.004 0.000 0.000 0.972 0.000
#> SRR1304005     5  0.0777      0.967 0.024 0.004 0.000 0.000 0.972 0.000
#> SRR1304002     5  0.1418      0.950 0.024 0.032 0.000 0.000 0.944 0.000
#> SRR1304003     5  0.1418      0.950 0.024 0.032 0.000 0.000 0.944 0.000
#> SRR1304006     5  0.1745      0.929 0.056 0.020 0.000 0.000 0.924 0.000
#> SRR1304007     5  0.1745      0.929 0.056 0.020 0.000 0.000 0.924 0.000
#> SRR1304008     5  0.0000      0.966 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR1304009     5  0.0000      0.966 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR1304010     1  0.3717      0.694 0.780 0.072 0.000 0.000 0.148 0.000
#> SRR1304011     1  0.3717      0.694 0.780 0.072 0.000 0.000 0.148 0.000
#> SRR1304012     5  0.0000      0.966 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR1304013     5  0.0000      0.966 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR1304014     5  0.1088      0.964 0.024 0.016 0.000 0.000 0.960 0.000
#> SRR1304015     5  0.0000      0.966 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR1304016     5  0.0146      0.967 0.000 0.004 0.000 0.000 0.996 0.000
#> SRR1304017     4  0.1196      0.820 0.040 0.008 0.000 0.952 0.000 0.000
#> SRR1304018     4  0.1196      0.820 0.040 0.008 0.000 0.952 0.000 0.000
#> SRR1304019     5  0.0000      0.966 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR1304020     5  0.0000      0.966 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR1304021     5  0.1088      0.964 0.024 0.016 0.000 0.000 0.960 0.000
#> SRR1304022     4  0.1196      0.820 0.040 0.008 0.000 0.952 0.000 0.000
#> SRR1304024     4  0.1196      0.820 0.040 0.008 0.000 0.952 0.000 0.000
#> SRR1304023     6  0.0000      0.983 0.000 0.000 0.000 0.000 0.000 1.000
#> SRR1304026     4  0.2178      0.795 0.132 0.000 0.000 0.868 0.000 0.000
#> SRR1304027     4  0.2178      0.795 0.132 0.000 0.000 0.868 0.000 0.000
#> SRR1304025     1  0.5879      0.694 0.460 0.324 0.000 0.000 0.216 0.000
#> SRR1304028     2  0.0000      0.979 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR1304029     2  0.0000      0.979 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR1304030     5  0.0777      0.967 0.024 0.004 0.000 0.000 0.972 0.000
#> SRR1304031     5  0.0777      0.967 0.024 0.004 0.000 0.000 0.972 0.000
#> SRR1304032     4  0.5501      0.310 0.128 0.412 0.000 0.460 0.000 0.000
#> SRR1304033     4  0.5501      0.310 0.128 0.412 0.000 0.460 0.000 0.000
#> SRR1304034     2  0.0632      0.974 0.024 0.976 0.000 0.000 0.000 0.000
#> SRR1304035     2  0.0632      0.974 0.024 0.976 0.000 0.000 0.000 0.000
#> SRR1304036     2  0.0632      0.974 0.024 0.976 0.000 0.000 0.000 0.000
#> SRR1304037     2  0.0632      0.974 0.024 0.976 0.000 0.000 0.000 0.000
#> SRR1304038     1  0.5879      0.694 0.460 0.324 0.000 0.000 0.216 0.000
#> SRR1304039     1  0.5879      0.694 0.460 0.324 0.000 0.000 0.216 0.000
#> SRR1304040     4  0.1196      0.820 0.040 0.008 0.000 0.952 0.000 0.000
#> SRR1304041     4  0.1196      0.820 0.040 0.008 0.000 0.952 0.000 0.000
#> SRR1304042     4  0.2178      0.795 0.132 0.000 0.000 0.868 0.000 0.000
#> SRR1304043     4  0.2178      0.795 0.132 0.000 0.000 0.868 0.000 0.000
#> SRR1304046     5  0.0458      0.965 0.000 0.016 0.000 0.000 0.984 0.000
#> SRR1304047     5  0.0458      0.965 0.000 0.016 0.000 0.000 0.984 0.000
#> SRR1304044     2  0.0000      0.979 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR1304045     2  0.0000      0.979 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR1304048     1  0.5879      0.694 0.460 0.324 0.000 0.000 0.216 0.000
#> SRR1304049     1  0.5879      0.694 0.460 0.324 0.000 0.000 0.216 0.000
#> SRR1304050     5  0.1088      0.964 0.024 0.016 0.000 0.000 0.960 0.000
#> SRR1304051     1  0.3512      0.665 0.772 0.032 0.000 0.000 0.196 0.000
#> SRR1304052     1  0.3512      0.665 0.772 0.032 0.000 0.000 0.196 0.000
#> SRR1304053     1  0.3512      0.665 0.772 0.032 0.000 0.000 0.196 0.000
#> SRR1304055     1  0.5625      0.755 0.540 0.216 0.000 0.000 0.244 0.000
#> SRR1304054     2  0.0000      0.979 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR1304056     1  0.5625      0.755 0.540 0.216 0.000 0.000 0.244 0.000
#> SRR1304059     1  0.5625      0.755 0.540 0.216 0.000 0.000 0.244 0.000
#> SRR1304057     1  0.5425      0.735 0.552 0.148 0.000 0.000 0.300 0.000
#> SRR1304058     1  0.2178      0.467 0.868 0.000 0.000 0.132 0.000 0.000
#> SRR1304060     1  0.3445      0.552 0.796 0.000 0.048 0.000 0.156 0.000
#> SRR1304061     1  0.5625      0.755 0.540 0.216 0.000 0.000 0.244 0.000

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

consensus_heatmap(res, k = 2)

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

consensus_heatmap(res, k = 3)

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

consensus_heatmap(res, k = 4)

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

consensus_heatmap(res, k = 5)

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

consensus_heatmap(res, k = 6)

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

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

membership_heatmap(res, k = 2)

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

membership_heatmap(res, k = 3)

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

membership_heatmap(res, k = 4)

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

membership_heatmap(res, k = 5)

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

membership_heatmap(res, k = 6)

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

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

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

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

get_signatures(res, k = 3)

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

get_signatures(res, k = 4)

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

get_signatures(res, k = 5)

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

get_signatures(res, k = 6)

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

Signature heatmaps where rows are not scaled:

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

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

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

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

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

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

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

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

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

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

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk SD-hclust-signature_compare

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

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

An example of the output of tb is:

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

The columns in tb are:

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

UMAP plot which shows how samples are separated.

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

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

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

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

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

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

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

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

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

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

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk SD-hclust-collect-classes

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 15595 rows and 72 columns.
#>   Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'SD' method.
#>   Subgroups are detected by 'kmeans' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 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.586           0.852       0.875         0.4494 0.532   0.532
#> 3 3 0.454           0.733       0.786         0.3256 0.849   0.717
#> 4 4 0.541           0.653       0.799         0.1427 0.847   0.644
#> 5 5 0.634           0.635       0.795         0.0781 0.975   0.925
#> 6 6 0.676           0.656       0.755         0.0658 0.900   0.686

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
#> SRR1303990     1  0.8386      0.807 0.732 0.268
#> SRR1303991     1  0.8386      0.807 0.732 0.268
#> SRR1303992     1  0.9170      0.778 0.668 0.332
#> SRR1303993     1  0.9170      0.778 0.668 0.332
#> SRR1303994     1  0.9170      0.778 0.668 0.332
#> SRR1303995     1  0.9170      0.778 0.668 0.332
#> SRR1303996     1  0.9170      0.778 0.668 0.332
#> SRR1303997     1  0.9170      0.778 0.668 0.332
#> SRR1303998     1  0.9170      0.778 0.668 0.332
#> SRR1303999     1  0.9170      0.778 0.668 0.332
#> SRR1304000     1  0.9170      0.778 0.668 0.332
#> SRR1304001     1  0.9170      0.778 0.668 0.332
#> SRR1304004     1  0.8207      0.810 0.744 0.256
#> SRR1304005     1  0.8207      0.810 0.744 0.256
#> SRR1304002     1  0.0672      0.750 0.992 0.008
#> SRR1304003     1  0.0672      0.750 0.992 0.008
#> SRR1304006     1  0.8081      0.810 0.752 0.248
#> SRR1304007     1  0.8081      0.810 0.752 0.248
#> SRR1304008     1  0.8267      0.809 0.740 0.260
#> SRR1304009     1  0.8267      0.809 0.740 0.260
#> SRR1304010     1  0.1414      0.744 0.980 0.020
#> SRR1304011     1  0.1414      0.744 0.980 0.020
#> SRR1304012     1  0.8144      0.810 0.748 0.252
#> SRR1304013     1  0.8144      0.810 0.748 0.252
#> SRR1304014     1  0.2043      0.739 0.968 0.032
#> SRR1304015     1  0.8144      0.810 0.748 0.252
#> SRR1304016     1  0.1633      0.745 0.976 0.024
#> SRR1304017     2  0.9209      1.000 0.336 0.664
#> SRR1304018     2  0.9209      1.000 0.336 0.664
#> SRR1304019     1  0.8144      0.810 0.748 0.252
#> SRR1304020     1  0.8207      0.810 0.744 0.256
#> SRR1304021     1  0.1633      0.745 0.976 0.024
#> SRR1304022     2  0.9209      1.000 0.336 0.664
#> SRR1304024     2  0.9209      1.000 0.336 0.664
#> SRR1304023     1  0.8144      0.717 0.748 0.252
#> SRR1304026     2  0.9209      1.000 0.336 0.664
#> SRR1304027     2  0.9209      1.000 0.336 0.664
#> SRR1304025     2  0.9209      1.000 0.336 0.664
#> SRR1304028     2  0.9209      1.000 0.336 0.664
#> SRR1304029     2  0.9209      1.000 0.336 0.664
#> SRR1304030     1  0.1633      0.741 0.976 0.024
#> SRR1304031     1  0.1633      0.741 0.976 0.024
#> SRR1304032     2  0.9209      1.000 0.336 0.664
#> SRR1304033     2  0.9209      1.000 0.336 0.664
#> SRR1304034     2  0.9209      1.000 0.336 0.664
#> SRR1304035     2  0.9209      1.000 0.336 0.664
#> SRR1304036     2  0.9209      1.000 0.336 0.664
#> SRR1304037     2  0.9209      1.000 0.336 0.664
#> SRR1304038     1  0.1843      0.737 0.972 0.028
#> SRR1304039     1  0.1843      0.737 0.972 0.028
#> SRR1304040     2  0.9209      1.000 0.336 0.664
#> SRR1304041     2  0.9209      1.000 0.336 0.664
#> SRR1304042     2  0.9209      1.000 0.336 0.664
#> SRR1304043     2  0.9209      1.000 0.336 0.664
#> SRR1304046     1  0.2043      0.739 0.968 0.032
#> SRR1304047     1  0.2043      0.739 0.968 0.032
#> SRR1304044     2  0.9209      1.000 0.336 0.664
#> SRR1304045     2  0.9209      1.000 0.336 0.664
#> SRR1304048     2  0.9209      1.000 0.336 0.664
#> SRR1304049     2  0.9209      1.000 0.336 0.664
#> SRR1304050     1  0.0672      0.750 0.992 0.008
#> SRR1304051     1  0.1414      0.744 0.980 0.020
#> SRR1304052     1  0.1843      0.737 0.972 0.028
#> SRR1304053     1  0.1414      0.744 0.980 0.020
#> SRR1304055     2  0.9209      1.000 0.336 0.664
#> SRR1304054     2  0.9209      1.000 0.336 0.664
#> SRR1304056     1  0.1843      0.737 0.972 0.028
#> SRR1304059     1  0.1843      0.737 0.972 0.028
#> SRR1304057     1  0.1843      0.737 0.972 0.028
#> SRR1304058     2  0.9209      1.000 0.336 0.664
#> SRR1304060     1  0.8713      0.796 0.708 0.292
#> SRR1304061     1  0.3114      0.696 0.944 0.056

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>            class entropy silhouette    p1    p2    p3
#> SRR1303990     1  0.6809    -0.2334 0.524 0.012 0.464
#> SRR1303991     1  0.6809    -0.2334 0.524 0.012 0.464
#> SRR1303992     3  0.5835     0.9181 0.340 0.000 0.660
#> SRR1303993     3  0.5835     0.9181 0.340 0.000 0.660
#> SRR1303994     3  0.5835     0.9181 0.340 0.000 0.660
#> SRR1303995     3  0.5835     0.9181 0.340 0.000 0.660
#> SRR1303996     3  0.5835     0.9181 0.340 0.000 0.660
#> SRR1303997     3  0.5835     0.9181 0.340 0.000 0.660
#> SRR1303998     3  0.5835     0.9181 0.340 0.000 0.660
#> SRR1303999     3  0.5835     0.9181 0.340 0.000 0.660
#> SRR1304000     3  0.5835     0.9181 0.340 0.000 0.660
#> SRR1304001     3  0.5835     0.9181 0.340 0.000 0.660
#> SRR1304004     1  0.4178     0.6591 0.828 0.000 0.172
#> SRR1304005     1  0.4178     0.6591 0.828 0.000 0.172
#> SRR1304002     1  0.0848     0.8144 0.984 0.008 0.008
#> SRR1304003     1  0.0848     0.8144 0.984 0.008 0.008
#> SRR1304006     1  0.0592     0.8091 0.988 0.000 0.012
#> SRR1304007     1  0.0592     0.8091 0.988 0.000 0.012
#> SRR1304008     1  0.4235     0.6581 0.824 0.000 0.176
#> SRR1304009     1  0.4235     0.6581 0.824 0.000 0.176
#> SRR1304010     1  0.2955     0.7529 0.912 0.008 0.080
#> SRR1304011     1  0.2955     0.7529 0.912 0.008 0.080
#> SRR1304012     1  0.4178     0.6639 0.828 0.000 0.172
#> SRR1304013     1  0.4178     0.6639 0.828 0.000 0.172
#> SRR1304014     1  0.0829     0.8151 0.984 0.012 0.004
#> SRR1304015     1  0.4121     0.6656 0.832 0.000 0.168
#> SRR1304016     1  0.0661     0.8154 0.988 0.004 0.008
#> SRR1304017     2  0.9243     0.7273 0.208 0.528 0.264
#> SRR1304018     2  0.9429     0.7061 0.232 0.504 0.264
#> SRR1304019     1  0.4178     0.6639 0.828 0.000 0.172
#> SRR1304020     1  0.4235     0.6570 0.824 0.000 0.176
#> SRR1304021     1  0.0661     0.8155 0.988 0.008 0.004
#> SRR1304022     2  0.8475     0.7195 0.112 0.568 0.320
#> SRR1304024     2  0.7665     0.7643 0.084 0.648 0.268
#> SRR1304023     3  0.7820    -0.0437 0.400 0.056 0.544
#> SRR1304026     2  0.2866     0.7811 0.008 0.916 0.076
#> SRR1304027     2  0.2866     0.7811 0.008 0.916 0.076
#> SRR1304025     2  0.9181     0.7363 0.224 0.540 0.236
#> SRR1304028     2  0.4676     0.7934 0.112 0.848 0.040
#> SRR1304029     2  0.4676     0.7934 0.112 0.848 0.040
#> SRR1304030     1  0.1315     0.8127 0.972 0.020 0.008
#> SRR1304031     1  0.1315     0.8127 0.972 0.020 0.008
#> SRR1304032     2  0.0592     0.7773 0.012 0.988 0.000
#> SRR1304033     2  0.0592     0.7773 0.012 0.988 0.000
#> SRR1304034     2  0.2301     0.7895 0.060 0.936 0.004
#> SRR1304035     2  0.2301     0.7895 0.060 0.936 0.004
#> SRR1304036     2  0.3112     0.7894 0.096 0.900 0.004
#> SRR1304037     2  0.3112     0.7894 0.096 0.900 0.004
#> SRR1304038     1  0.4663     0.6466 0.828 0.016 0.156
#> SRR1304039     1  0.4663     0.6466 0.828 0.016 0.156
#> SRR1304040     2  0.7665     0.7643 0.084 0.648 0.268
#> SRR1304041     2  0.7665     0.7643 0.084 0.648 0.268
#> SRR1304042     2  0.5412     0.7853 0.032 0.796 0.172
#> SRR1304043     2  0.5412     0.7853 0.032 0.796 0.172
#> SRR1304046     1  0.0592     0.8157 0.988 0.012 0.000
#> SRR1304047     1  0.0592     0.8157 0.988 0.012 0.000
#> SRR1304044     2  0.4676     0.7934 0.112 0.848 0.040
#> SRR1304045     2  0.4676     0.7934 0.112 0.848 0.040
#> SRR1304048     2  0.9584     0.5375 0.372 0.428 0.200
#> SRR1304049     2  0.9584     0.5375 0.372 0.428 0.200
#> SRR1304050     1  0.0592     0.8157 0.988 0.012 0.000
#> SRR1304051     1  0.1015     0.8138 0.980 0.008 0.012
#> SRR1304052     1  0.4873     0.6467 0.824 0.024 0.152
#> SRR1304053     1  0.1015     0.8138 0.980 0.008 0.012
#> SRR1304055     2  0.8472     0.7500 0.228 0.612 0.160
#> SRR1304054     2  0.3425     0.7862 0.112 0.884 0.004
#> SRR1304056     1  0.1636     0.8071 0.964 0.020 0.016
#> SRR1304059     1  0.1919     0.8019 0.956 0.024 0.020
#> SRR1304057     1  0.1781     0.8048 0.960 0.020 0.020
#> SRR1304058     2  0.8263     0.7489 0.120 0.612 0.268
#> SRR1304060     1  0.4842     0.5520 0.776 0.000 0.224
#> SRR1304061     1  0.1919     0.8019 0.956 0.024 0.020

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> SRR1303990     3  0.7877      0.315 0.304 0.000 0.388 0.308
#> SRR1303991     3  0.7877      0.315 0.304 0.000 0.388 0.308
#> SRR1303992     3  0.2730      0.891 0.088 0.000 0.896 0.016
#> SRR1303993     3  0.2730      0.891 0.088 0.000 0.896 0.016
#> SRR1303994     3  0.2334      0.892 0.088 0.000 0.908 0.004
#> SRR1303995     3  0.2334      0.892 0.088 0.000 0.908 0.004
#> SRR1303996     3  0.2843      0.891 0.088 0.000 0.892 0.020
#> SRR1303997     3  0.2843      0.891 0.088 0.000 0.892 0.020
#> SRR1303998     3  0.2480      0.892 0.088 0.000 0.904 0.008
#> SRR1303999     3  0.2480      0.892 0.088 0.000 0.904 0.008
#> SRR1304000     3  0.2149      0.892 0.088 0.000 0.912 0.000
#> SRR1304001     3  0.2149      0.892 0.088 0.000 0.912 0.000
#> SRR1304004     1  0.4791      0.668 0.784 0.000 0.136 0.080
#> SRR1304005     1  0.4791      0.668 0.784 0.000 0.136 0.080
#> SRR1304002     1  0.1362      0.786 0.964 0.012 0.020 0.004
#> SRR1304003     1  0.1362      0.786 0.964 0.012 0.020 0.004
#> SRR1304006     1  0.2066      0.783 0.940 0.008 0.028 0.024
#> SRR1304007     1  0.2066      0.783 0.940 0.008 0.028 0.024
#> SRR1304008     1  0.4920      0.663 0.776 0.000 0.136 0.088
#> SRR1304009     1  0.4920      0.663 0.776 0.000 0.136 0.088
#> SRR1304010     1  0.3847      0.716 0.844 0.012 0.020 0.124
#> SRR1304011     1  0.3847      0.716 0.844 0.012 0.020 0.124
#> SRR1304012     1  0.5247      0.646 0.752 0.000 0.148 0.100
#> SRR1304013     1  0.5247      0.646 0.752 0.000 0.148 0.100
#> SRR1304014     1  0.0336      0.785 0.992 0.008 0.000 0.000
#> SRR1304015     1  0.4920      0.663 0.776 0.000 0.136 0.088
#> SRR1304016     1  0.1211      0.781 0.960 0.000 0.000 0.040
#> SRR1304017     4  0.6577      0.734 0.176 0.172 0.004 0.648
#> SRR1304018     4  0.6657      0.714 0.208 0.152 0.004 0.636
#> SRR1304019     1  0.5304      0.642 0.748 0.000 0.148 0.104
#> SRR1304020     1  0.5247      0.646 0.752 0.000 0.148 0.100
#> SRR1304021     1  0.0657      0.784 0.984 0.000 0.004 0.012
#> SRR1304022     4  0.5126      0.733 0.072 0.148 0.008 0.772
#> SRR1304024     4  0.5489      0.740 0.060 0.240 0.000 0.700
#> SRR1304023     4  0.4621      0.542 0.092 0.012 0.080 0.816
#> SRR1304026     2  0.4163      0.616 0.000 0.792 0.020 0.188
#> SRR1304027     2  0.4163      0.616 0.000 0.792 0.020 0.188
#> SRR1304025     4  0.7404      0.523 0.336 0.180 0.000 0.484
#> SRR1304028     2  0.4626      0.708 0.064 0.808 0.008 0.120
#> SRR1304029     2  0.4626      0.708 0.064 0.808 0.008 0.120
#> SRR1304030     1  0.2300      0.775 0.924 0.048 0.000 0.028
#> SRR1304031     1  0.2300      0.775 0.924 0.048 0.000 0.028
#> SRR1304032     2  0.1584      0.731 0.000 0.952 0.012 0.036
#> SRR1304033     2  0.1584      0.731 0.000 0.952 0.012 0.036
#> SRR1304034     2  0.1389      0.763 0.048 0.952 0.000 0.000
#> SRR1304035     2  0.1389      0.763 0.048 0.952 0.000 0.000
#> SRR1304036     2  0.2197      0.753 0.080 0.916 0.000 0.004
#> SRR1304037     2  0.2197      0.753 0.080 0.916 0.000 0.004
#> SRR1304038     1  0.6129      0.226 0.584 0.024 0.020 0.372
#> SRR1304039     1  0.6129      0.226 0.584 0.024 0.020 0.372
#> SRR1304040     4  0.5489      0.740 0.060 0.240 0.000 0.700
#> SRR1304041     4  0.5489      0.740 0.060 0.240 0.000 0.700
#> SRR1304042     2  0.6101     -0.113 0.012 0.496 0.024 0.468
#> SRR1304043     2  0.6101     -0.113 0.012 0.496 0.024 0.468
#> SRR1304046     1  0.0921      0.782 0.972 0.000 0.000 0.028
#> SRR1304047     1  0.0921      0.782 0.972 0.000 0.000 0.028
#> SRR1304044     2  0.4733      0.702 0.064 0.800 0.008 0.128
#> SRR1304045     2  0.4733      0.702 0.064 0.800 0.008 0.128
#> SRR1304048     1  0.7577     -0.278 0.444 0.124 0.016 0.416
#> SRR1304049     1  0.7577     -0.278 0.444 0.124 0.016 0.416
#> SRR1304050     1  0.1229      0.786 0.968 0.008 0.020 0.004
#> SRR1304051     1  0.2196      0.779 0.936 0.016 0.016 0.032
#> SRR1304052     1  0.5195      0.574 0.740 0.028 0.016 0.216
#> SRR1304053     1  0.2196      0.779 0.936 0.016 0.016 0.032
#> SRR1304055     1  0.8247     -0.330 0.420 0.300 0.016 0.264
#> SRR1304054     2  0.2658      0.752 0.080 0.904 0.004 0.012
#> SRR1304056     1  0.2920      0.767 0.908 0.040 0.020 0.032
#> SRR1304059     1  0.3103      0.762 0.900 0.044 0.020 0.036
#> SRR1304057     1  0.2708      0.770 0.916 0.040 0.016 0.028
#> SRR1304058     4  0.6114      0.764 0.112 0.184 0.008 0.696
#> SRR1304060     1  0.4799      0.652 0.744 0.000 0.224 0.032
#> SRR1304061     1  0.2920      0.767 0.908 0.040 0.020 0.032

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>            class entropy silhouette    p1    p2    p3    p4    p5
#> SRR1303990     5  0.7613    1.00000 0.144 0.004 0.252 0.100 0.500
#> SRR1303991     5  0.7613    1.00000 0.144 0.004 0.252 0.100 0.500
#> SRR1303992     3  0.1871    0.96317 0.024 0.012 0.940 0.004 0.020
#> SRR1303993     3  0.1871    0.96317 0.024 0.012 0.940 0.004 0.020
#> SRR1303994     3  0.0992    0.97457 0.024 0.000 0.968 0.000 0.008
#> SRR1303995     3  0.0992    0.97457 0.024 0.000 0.968 0.000 0.008
#> SRR1303996     3  0.1865    0.96588 0.024 0.000 0.936 0.008 0.032
#> SRR1303997     3  0.1865    0.96588 0.024 0.000 0.936 0.008 0.032
#> SRR1303998     3  0.1471    0.97126 0.024 0.000 0.952 0.004 0.020
#> SRR1303999     3  0.1471    0.97126 0.024 0.000 0.952 0.004 0.020
#> SRR1304000     3  0.0703    0.97568 0.024 0.000 0.976 0.000 0.000
#> SRR1304001     3  0.0703    0.97568 0.024 0.000 0.976 0.000 0.000
#> SRR1304004     1  0.5308    0.47025 0.620 0.000 0.076 0.000 0.304
#> SRR1304005     1  0.5308    0.47025 0.620 0.000 0.076 0.000 0.304
#> SRR1304002     1  0.1530    0.71025 0.952 0.008 0.008 0.004 0.028
#> SRR1304003     1  0.1530    0.71025 0.952 0.008 0.008 0.004 0.028
#> SRR1304006     1  0.0867    0.70716 0.976 0.000 0.008 0.008 0.008
#> SRR1304007     1  0.0867    0.70716 0.976 0.000 0.008 0.008 0.008
#> SRR1304008     1  0.5555    0.46522 0.616 0.004 0.072 0.004 0.304
#> SRR1304009     1  0.5555    0.46522 0.616 0.004 0.072 0.004 0.304
#> SRR1304010     1  0.3606    0.65219 0.844 0.008 0.012 0.104 0.032
#> SRR1304011     1  0.3606    0.65219 0.844 0.008 0.012 0.104 0.032
#> SRR1304012     1  0.5520    0.38854 0.560 0.000 0.076 0.000 0.364
#> SRR1304013     1  0.5520    0.38854 0.560 0.000 0.076 0.000 0.364
#> SRR1304014     1  0.1430    0.70604 0.944 0.000 0.000 0.004 0.052
#> SRR1304015     1  0.5375    0.45886 0.604 0.000 0.076 0.000 0.320
#> SRR1304016     1  0.2732    0.66762 0.840 0.000 0.000 0.000 0.160
#> SRR1304017     4  0.5646    0.50317 0.220 0.044 0.004 0.680 0.052
#> SRR1304018     4  0.5560    0.48220 0.248 0.040 0.004 0.668 0.040
#> SRR1304019     1  0.5520    0.38854 0.560 0.000 0.076 0.000 0.364
#> SRR1304020     1  0.5498    0.39287 0.568 0.000 0.076 0.000 0.356
#> SRR1304021     1  0.1671    0.70100 0.924 0.000 0.000 0.000 0.076
#> SRR1304022     4  0.1804    0.64425 0.012 0.024 0.000 0.940 0.024
#> SRR1304024     4  0.1697    0.66394 0.008 0.060 0.000 0.932 0.000
#> SRR1304023     4  0.5573   -0.06436 0.040 0.008 0.004 0.484 0.464
#> SRR1304026     2  0.5711    0.44028 0.000 0.600 0.004 0.296 0.100
#> SRR1304027     2  0.5711    0.44028 0.000 0.600 0.004 0.296 0.100
#> SRR1304025     4  0.6271    0.20486 0.408 0.044 0.004 0.500 0.044
#> SRR1304028     2  0.4966    0.76072 0.032 0.776 0.016 0.076 0.100
#> SRR1304029     2  0.4966    0.76072 0.032 0.776 0.016 0.076 0.100
#> SRR1304030     1  0.3420    0.67908 0.836 0.036 0.004 0.000 0.124
#> SRR1304031     1  0.3420    0.67908 0.836 0.036 0.004 0.000 0.124
#> SRR1304032     2  0.2381    0.77640 0.000 0.908 0.004 0.052 0.036
#> SRR1304033     2  0.2381    0.77640 0.000 0.908 0.004 0.052 0.036
#> SRR1304034     2  0.0960    0.80666 0.016 0.972 0.000 0.008 0.004
#> SRR1304035     2  0.0960    0.80666 0.016 0.972 0.000 0.008 0.004
#> SRR1304036     2  0.1862    0.80043 0.048 0.932 0.000 0.004 0.016
#> SRR1304037     2  0.1862    0.80043 0.048 0.932 0.000 0.004 0.016
#> SRR1304038     1  0.5623    0.26321 0.596 0.016 0.012 0.344 0.032
#> SRR1304039     1  0.5623    0.26321 0.596 0.016 0.012 0.344 0.032
#> SRR1304040     4  0.1697    0.66394 0.008 0.060 0.000 0.932 0.000
#> SRR1304041     4  0.1697    0.66394 0.008 0.060 0.000 0.932 0.000
#> SRR1304042     4  0.5954    0.28169 0.000 0.296 0.008 0.584 0.112
#> SRR1304043     4  0.5954    0.28169 0.000 0.296 0.008 0.584 0.112
#> SRR1304046     1  0.2719    0.67215 0.852 0.000 0.000 0.004 0.144
#> SRR1304047     1  0.2719    0.67215 0.852 0.000 0.000 0.004 0.144
#> SRR1304044     2  0.5299    0.74147 0.028 0.748 0.016 0.092 0.116
#> SRR1304045     2  0.5299    0.74147 0.028 0.748 0.016 0.092 0.116
#> SRR1304048     1  0.6363   -0.00217 0.492 0.036 0.012 0.416 0.044
#> SRR1304049     1  0.6363   -0.00217 0.492 0.036 0.012 0.416 0.044
#> SRR1304050     1  0.0854    0.70906 0.976 0.000 0.008 0.004 0.012
#> SRR1304051     1  0.1616    0.70558 0.948 0.004 0.008 0.008 0.032
#> SRR1304052     1  0.5222    0.55614 0.740 0.024 0.016 0.160 0.060
#> SRR1304053     1  0.1616    0.70558 0.948 0.004 0.008 0.008 0.032
#> SRR1304055     1  0.7140    0.19965 0.564 0.120 0.016 0.244 0.056
#> SRR1304054     2  0.3742    0.78428 0.052 0.840 0.016 0.004 0.088
#> SRR1304056     1  0.2110    0.69622 0.932 0.020 0.012 0.012 0.024
#> SRR1304059     1  0.2977    0.67698 0.892 0.028 0.020 0.012 0.048
#> SRR1304057     1  0.2090    0.69592 0.932 0.024 0.008 0.012 0.024
#> SRR1304058     4  0.2358    0.65220 0.048 0.020 0.004 0.916 0.012
#> SRR1304060     1  0.3712    0.63902 0.820 0.000 0.132 0.008 0.040
#> SRR1304061     1  0.2292    0.69316 0.924 0.024 0.012 0.012 0.028

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>            class entropy silhouette    p1    p2    p3    p4    p5    p6
#> SRR1303990     6  0.7039     0.7462 0.048 0.000 0.164 0.048 0.220 0.520
#> SRR1303991     6  0.7039     0.7462 0.048 0.000 0.164 0.048 0.220 0.520
#> SRR1303992     3  0.2218     0.9396 0.004 0.004 0.916 0.012 0.036 0.028
#> SRR1303993     3  0.2218     0.9396 0.004 0.004 0.916 0.012 0.036 0.028
#> SRR1303994     3  0.0508     0.9646 0.004 0.000 0.984 0.000 0.012 0.000
#> SRR1303995     3  0.0508     0.9646 0.004 0.000 0.984 0.000 0.012 0.000
#> SRR1303996     3  0.1835     0.9556 0.004 0.004 0.936 0.016 0.020 0.020
#> SRR1303997     3  0.1835     0.9556 0.004 0.004 0.936 0.016 0.020 0.020
#> SRR1303998     3  0.1026     0.9610 0.004 0.000 0.968 0.012 0.008 0.008
#> SRR1303999     3  0.1026     0.9610 0.004 0.000 0.968 0.012 0.008 0.008
#> SRR1304000     3  0.0146     0.9657 0.004 0.000 0.996 0.000 0.000 0.000
#> SRR1304001     3  0.0146     0.9657 0.004 0.000 0.996 0.000 0.000 0.000
#> SRR1304004     5  0.3912     0.9366 0.340 0.000 0.012 0.000 0.648 0.000
#> SRR1304005     5  0.3912     0.9366 0.340 0.000 0.012 0.000 0.648 0.000
#> SRR1304002     1  0.2237     0.6823 0.896 0.000 0.000 0.000 0.068 0.036
#> SRR1304003     1  0.2237     0.6823 0.896 0.000 0.000 0.000 0.068 0.036
#> SRR1304006     1  0.0806     0.7000 0.972 0.000 0.000 0.000 0.020 0.008
#> SRR1304007     1  0.0806     0.7000 0.972 0.000 0.000 0.000 0.020 0.008
#> SRR1304008     5  0.4258     0.9538 0.308 0.000 0.012 0.004 0.664 0.012
#> SRR1304009     5  0.4258     0.9538 0.308 0.000 0.012 0.004 0.664 0.012
#> SRR1304010     1  0.5038     0.6301 0.720 0.004 0.000 0.128 0.092 0.056
#> SRR1304011     1  0.5038     0.6301 0.720 0.004 0.000 0.128 0.092 0.056
#> SRR1304012     5  0.3650     0.9576 0.280 0.000 0.012 0.000 0.708 0.000
#> SRR1304013     5  0.3650     0.9576 0.280 0.000 0.012 0.000 0.708 0.000
#> SRR1304014     1  0.2121     0.6551 0.892 0.000 0.000 0.000 0.096 0.012
#> SRR1304015     5  0.3710     0.9614 0.292 0.000 0.012 0.000 0.696 0.000
#> SRR1304016     1  0.3867     0.1380 0.660 0.000 0.000 0.000 0.328 0.012
#> SRR1304017     4  0.5665     0.4130 0.196 0.020 0.000 0.660 0.072 0.052
#> SRR1304018     4  0.5718     0.4068 0.204 0.020 0.000 0.652 0.072 0.052
#> SRR1304019     5  0.3808     0.9602 0.284 0.000 0.012 0.004 0.700 0.000
#> SRR1304020     5  0.3867     0.9612 0.296 0.000 0.012 0.004 0.688 0.000
#> SRR1304021     1  0.2896     0.6204 0.824 0.000 0.000 0.000 0.160 0.016
#> SRR1304022     4  0.1483     0.5614 0.012 0.000 0.000 0.944 0.008 0.036
#> SRR1304024     4  0.1396     0.5832 0.012 0.024 0.000 0.952 0.008 0.004
#> SRR1304023     6  0.5266     0.2638 0.024 0.000 0.000 0.384 0.052 0.540
#> SRR1304026     2  0.6944     0.2509 0.000 0.452 0.000 0.244 0.084 0.220
#> SRR1304027     2  0.6944     0.2509 0.000 0.452 0.000 0.244 0.084 0.220
#> SRR1304025     4  0.6521     0.0482 0.384 0.020 0.000 0.460 0.072 0.064
#> SRR1304028     2  0.4820     0.7218 0.012 0.760 0.004 0.064 0.076 0.084
#> SRR1304029     2  0.4820     0.7218 0.012 0.760 0.004 0.064 0.076 0.084
#> SRR1304030     1  0.4876     0.3077 0.668 0.060 0.000 0.000 0.248 0.024
#> SRR1304031     1  0.4876     0.3077 0.668 0.060 0.000 0.000 0.248 0.024
#> SRR1304032     2  0.3467     0.7052 0.004 0.836 0.000 0.032 0.036 0.092
#> SRR1304033     2  0.3467     0.7052 0.004 0.836 0.000 0.032 0.036 0.092
#> SRR1304034     2  0.1167     0.7672 0.020 0.960 0.000 0.000 0.012 0.008
#> SRR1304035     2  0.1167     0.7672 0.020 0.960 0.000 0.000 0.012 0.008
#> SRR1304036     2  0.1630     0.7656 0.024 0.940 0.000 0.000 0.020 0.016
#> SRR1304037     2  0.1630     0.7656 0.024 0.940 0.000 0.000 0.020 0.016
#> SRR1304038     1  0.5886     0.4482 0.600 0.004 0.000 0.252 0.076 0.068
#> SRR1304039     1  0.5886     0.4482 0.600 0.004 0.000 0.252 0.076 0.068
#> SRR1304040     4  0.1138     0.5845 0.012 0.024 0.000 0.960 0.000 0.004
#> SRR1304041     4  0.1138     0.5845 0.012 0.024 0.000 0.960 0.000 0.004
#> SRR1304042     4  0.7007     0.1869 0.004 0.228 0.000 0.460 0.080 0.228
#> SRR1304043     4  0.7007     0.1869 0.004 0.228 0.000 0.460 0.080 0.228
#> SRR1304046     1  0.3690     0.2479 0.700 0.000 0.000 0.000 0.288 0.012
#> SRR1304047     1  0.3690     0.2479 0.700 0.000 0.000 0.000 0.288 0.012
#> SRR1304044     2  0.5064     0.7108 0.012 0.740 0.004 0.064 0.088 0.092
#> SRR1304045     2  0.5064     0.7108 0.012 0.740 0.004 0.064 0.088 0.092
#> SRR1304048     1  0.6521     0.2076 0.488 0.016 0.000 0.348 0.080 0.068
#> SRR1304049     1  0.6521     0.2076 0.488 0.016 0.000 0.348 0.080 0.068
#> SRR1304050     1  0.1970     0.6829 0.912 0.000 0.000 0.000 0.060 0.028
#> SRR1304051     1  0.2113     0.6911 0.908 0.000 0.000 0.004 0.060 0.028
#> SRR1304052     1  0.4385     0.6536 0.776 0.004 0.000 0.100 0.068 0.052
#> SRR1304053     1  0.2113     0.6911 0.908 0.000 0.000 0.004 0.060 0.028
#> SRR1304055     1  0.5354     0.5786 0.720 0.040 0.000 0.116 0.056 0.068
#> SRR1304054     2  0.3487     0.7493 0.024 0.836 0.000 0.004 0.056 0.080
#> SRR1304056     1  0.1167     0.7020 0.960 0.012 0.000 0.000 0.008 0.020
#> SRR1304059     1  0.2421     0.6973 0.900 0.012 0.000 0.004 0.052 0.032
#> SRR1304057     1  0.1269     0.7031 0.956 0.012 0.000 0.000 0.012 0.020
#> SRR1304058     4  0.2119     0.5610 0.060 0.004 0.000 0.912 0.008 0.016
#> SRR1304060     1  0.3059     0.6600 0.864 0.000 0.032 0.004 0.072 0.028
#> SRR1304061     1  0.1605     0.7016 0.940 0.012 0.000 0.000 0.016 0.032

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

consensus_heatmap(res, k = 2)

plot of chunk tab-SD-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 15595 rows and 72 columns.
#>   Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'SD' method.
#>   Subgroups are detected by 'skmeans' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 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 1.000           0.980       0.991         0.5019 0.499   0.499
#> 3 3 0.612           0.613       0.686         0.3041 0.826   0.657
#> 4 4 0.862           0.806       0.911         0.1546 0.809   0.508
#> 5 5 0.845           0.788       0.884         0.0653 0.934   0.738
#> 6 6 0.814           0.720       0.818         0.0348 0.964   0.819

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
#> SRR1303990     1   0.000      0.988 1.000 0.000
#> SRR1303991     1   0.000      0.988 1.000 0.000
#> SRR1303992     1   0.000      0.988 1.000 0.000
#> SRR1303993     1   0.000      0.988 1.000 0.000
#> SRR1303994     1   0.000      0.988 1.000 0.000
#> SRR1303995     1   0.000      0.988 1.000 0.000
#> SRR1303996     1   0.000      0.988 1.000 0.000
#> SRR1303997     1   0.000      0.988 1.000 0.000
#> SRR1303998     1   0.000      0.988 1.000 0.000
#> SRR1303999     1   0.000      0.988 1.000 0.000
#> SRR1304000     1   0.000      0.988 1.000 0.000
#> SRR1304001     1   0.000      0.988 1.000 0.000
#> SRR1304004     1   0.000      0.988 1.000 0.000
#> SRR1304005     1   0.000      0.988 1.000 0.000
#> SRR1304002     1   0.000      0.988 1.000 0.000
#> SRR1304003     1   0.000      0.988 1.000 0.000
#> SRR1304006     1   0.000      0.988 1.000 0.000
#> SRR1304007     1   0.000      0.988 1.000 0.000
#> SRR1304008     1   0.000      0.988 1.000 0.000
#> SRR1304009     1   0.000      0.988 1.000 0.000
#> SRR1304010     1   0.430      0.904 0.912 0.088
#> SRR1304011     1   0.430      0.904 0.912 0.088
#> SRR1304012     1   0.000      0.988 1.000 0.000
#> SRR1304013     1   0.000      0.988 1.000 0.000
#> SRR1304014     1   0.000      0.988 1.000 0.000
#> SRR1304015     1   0.000      0.988 1.000 0.000
#> SRR1304016     1   0.000      0.988 1.000 0.000
#> SRR1304017     2   0.000      0.993 0.000 1.000
#> SRR1304018     2   0.000      0.993 0.000 1.000
#> SRR1304019     1   0.000      0.988 1.000 0.000
#> SRR1304020     1   0.000      0.988 1.000 0.000
#> SRR1304021     1   0.000      0.988 1.000 0.000
#> SRR1304022     2   0.000      0.993 0.000 1.000
#> SRR1304024     2   0.000      0.993 0.000 1.000
#> SRR1304023     2   0.722      0.747 0.200 0.800
#> SRR1304026     2   0.000      0.993 0.000 1.000
#> SRR1304027     2   0.000      0.993 0.000 1.000
#> SRR1304025     2   0.000      0.993 0.000 1.000
#> SRR1304028     2   0.000      0.993 0.000 1.000
#> SRR1304029     2   0.000      0.993 0.000 1.000
#> SRR1304030     1   0.000      0.988 1.000 0.000
#> SRR1304031     1   0.000      0.988 1.000 0.000
#> SRR1304032     2   0.000      0.993 0.000 1.000
#> SRR1304033     2   0.000      0.993 0.000 1.000
#> SRR1304034     2   0.000      0.993 0.000 1.000
#> SRR1304035     2   0.000      0.993 0.000 1.000
#> SRR1304036     2   0.000      0.993 0.000 1.000
#> SRR1304037     2   0.000      0.993 0.000 1.000
#> SRR1304038     2   0.000      0.993 0.000 1.000
#> SRR1304039     2   0.000      0.993 0.000 1.000
#> SRR1304040     2   0.000      0.993 0.000 1.000
#> SRR1304041     2   0.000      0.993 0.000 1.000
#> SRR1304042     2   0.000      0.993 0.000 1.000
#> SRR1304043     2   0.000      0.993 0.000 1.000
#> SRR1304046     1   0.000      0.988 1.000 0.000
#> SRR1304047     1   0.000      0.988 1.000 0.000
#> SRR1304044     2   0.000      0.993 0.000 1.000
#> SRR1304045     2   0.000      0.993 0.000 1.000
#> SRR1304048     2   0.000      0.993 0.000 1.000
#> SRR1304049     2   0.000      0.993 0.000 1.000
#> SRR1304050     1   0.000      0.988 1.000 0.000
#> SRR1304051     1   0.000      0.988 1.000 0.000
#> SRR1304052     2   0.000      0.993 0.000 1.000
#> SRR1304053     1   0.000      0.988 1.000 0.000
#> SRR1304055     2   0.000      0.993 0.000 1.000
#> SRR1304054     2   0.000      0.993 0.000 1.000
#> SRR1304056     1   0.443      0.899 0.908 0.092
#> SRR1304059     2   0.000      0.993 0.000 1.000
#> SRR1304057     1   0.722      0.756 0.800 0.200
#> SRR1304058     2   0.000      0.993 0.000 1.000
#> SRR1304060     1   0.000      0.988 1.000 0.000
#> SRR1304061     2   0.000      0.993 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
#> SRR1303990     3   0.601    -0.1682 0.372 0.000 0.628
#> SRR1303991     3   0.601    -0.1682 0.372 0.000 0.628
#> SRR1303992     3   0.000     0.8644 0.000 0.000 1.000
#> SRR1303993     3   0.000     0.8644 0.000 0.000 1.000
#> SRR1303994     3   0.000     0.8644 0.000 0.000 1.000
#> SRR1303995     3   0.000     0.8644 0.000 0.000 1.000
#> SRR1303996     3   0.000     0.8644 0.000 0.000 1.000
#> SRR1303997     3   0.000     0.8644 0.000 0.000 1.000
#> SRR1303998     3   0.000     0.8644 0.000 0.000 1.000
#> SRR1303999     3   0.000     0.8644 0.000 0.000 1.000
#> SRR1304000     3   0.000     0.8644 0.000 0.000 1.000
#> SRR1304001     3   0.000     0.8644 0.000 0.000 1.000
#> SRR1304004     1   0.627     0.5989 0.548 0.000 0.452
#> SRR1304005     1   0.627     0.5989 0.548 0.000 0.452
#> SRR1304002     3   0.484     0.5535 0.224 0.000 0.776
#> SRR1304003     3   0.484     0.5535 0.224 0.000 0.776
#> SRR1304006     3   0.103     0.8440 0.024 0.000 0.976
#> SRR1304007     3   0.103     0.8440 0.024 0.000 0.976
#> SRR1304008     1   0.627     0.5989 0.548 0.000 0.452
#> SRR1304009     1   0.627     0.5989 0.548 0.000 0.452
#> SRR1304010     1   0.777     0.2755 0.536 0.412 0.052
#> SRR1304011     1   0.777     0.2755 0.536 0.412 0.052
#> SRR1304012     1   0.627     0.5943 0.544 0.000 0.456
#> SRR1304013     1   0.627     0.5943 0.544 0.000 0.456
#> SRR1304014     1   0.617     0.5911 0.588 0.000 0.412
#> SRR1304015     1   0.627     0.5989 0.548 0.000 0.452
#> SRR1304016     1   0.617     0.5911 0.588 0.000 0.412
#> SRR1304017     2   0.000     0.7265 0.000 1.000 0.000
#> SRR1304018     2   0.000     0.7265 0.000 1.000 0.000
#> SRR1304019     1   0.627     0.5989 0.548 0.000 0.452
#> SRR1304020     1   0.627     0.5989 0.548 0.000 0.452
#> SRR1304021     1   0.627     0.5989 0.548 0.000 0.452
#> SRR1304022     2   0.000     0.7265 0.000 1.000 0.000
#> SRR1304024     2   0.000     0.7265 0.000 1.000 0.000
#> SRR1304023     2   0.926    -0.0251 0.272 0.524 0.204
#> SRR1304026     2   0.617     0.7565 0.412 0.588 0.000
#> SRR1304027     2   0.617     0.7565 0.412 0.588 0.000
#> SRR1304025     2   0.000     0.7265 0.000 1.000 0.000
#> SRR1304028     2   0.617     0.7565 0.412 0.588 0.000
#> SRR1304029     2   0.617     0.7565 0.412 0.588 0.000
#> SRR1304030     1   0.296     0.3376 0.900 0.000 0.100
#> SRR1304031     1   0.296     0.3376 0.900 0.000 0.100
#> SRR1304032     2   0.617     0.7565 0.412 0.588 0.000
#> SRR1304033     2   0.617     0.7565 0.412 0.588 0.000
#> SRR1304034     2   0.617     0.7565 0.412 0.588 0.000
#> SRR1304035     2   0.617     0.7565 0.412 0.588 0.000
#> SRR1304036     2   0.624     0.7415 0.440 0.560 0.000
#> SRR1304037     2   0.624     0.7415 0.440 0.560 0.000
#> SRR1304038     2   0.581     0.3386 0.000 0.664 0.336
#> SRR1304039     2   0.581     0.3386 0.000 0.664 0.336
#> SRR1304040     2   0.000     0.7265 0.000 1.000 0.000
#> SRR1304041     2   0.000     0.7265 0.000 1.000 0.000
#> SRR1304042     2   0.429     0.7496 0.180 0.820 0.000
#> SRR1304043     2   0.429     0.7496 0.180 0.820 0.000
#> SRR1304046     1   0.617     0.5911 0.588 0.000 0.412
#> SRR1304047     1   0.617     0.5911 0.588 0.000 0.412
#> SRR1304044     2   0.617     0.7565 0.412 0.588 0.000
#> SRR1304045     2   0.617     0.7565 0.412 0.588 0.000
#> SRR1304048     2   0.000     0.7265 0.000 1.000 0.000
#> SRR1304049     2   0.000     0.7265 0.000 1.000 0.000
#> SRR1304050     1   0.617     0.5911 0.588 0.000 0.412
#> SRR1304051     1   0.630     0.5711 0.528 0.000 0.472
#> SRR1304052     2   0.000     0.7265 0.000 1.000 0.000
#> SRR1304053     1   0.630     0.5711 0.528 0.000 0.472
#> SRR1304055     2   0.621     0.7483 0.428 0.572 0.000
#> SRR1304054     2   0.622     0.7462 0.432 0.568 0.000
#> SRR1304056     1   0.455     0.1216 0.800 0.000 0.200
#> SRR1304059     1   0.933    -0.3288 0.456 0.168 0.376
#> SRR1304057     1   0.910    -0.2893 0.456 0.140 0.404
#> SRR1304058     2   0.000     0.7265 0.000 1.000 0.000
#> SRR1304060     3   0.000     0.8644 0.000 0.000 1.000
#> SRR1304061     2   0.792     0.6866 0.456 0.488 0.056

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> SRR1303990     3  0.5125   3.14e-01 0.388 0.000 0.604 0.008
#> SRR1303991     3  0.5125   3.14e-01 0.388 0.000 0.604 0.008
#> SRR1303992     3  0.0707   8.97e-01 0.020 0.000 0.980 0.000
#> SRR1303993     3  0.0707   8.97e-01 0.020 0.000 0.980 0.000
#> SRR1303994     3  0.0707   8.97e-01 0.020 0.000 0.980 0.000
#> SRR1303995     3  0.0707   8.97e-01 0.020 0.000 0.980 0.000
#> SRR1303996     3  0.0707   8.97e-01 0.020 0.000 0.980 0.000
#> SRR1303997     3  0.0707   8.97e-01 0.020 0.000 0.980 0.000
#> SRR1303998     3  0.0707   8.97e-01 0.020 0.000 0.980 0.000
#> SRR1303999     3  0.0707   8.97e-01 0.020 0.000 0.980 0.000
#> SRR1304000     3  0.0707   8.97e-01 0.020 0.000 0.980 0.000
#> SRR1304001     3  0.0707   8.97e-01 0.020 0.000 0.980 0.000
#> SRR1304004     1  0.1022   8.88e-01 0.968 0.000 0.032 0.000
#> SRR1304005     1  0.1022   8.88e-01 0.968 0.000 0.032 0.000
#> SRR1304002     1  0.5085   3.43e-01 0.616 0.008 0.376 0.000
#> SRR1304003     1  0.5085   3.43e-01 0.616 0.008 0.376 0.000
#> SRR1304006     3  0.0592   8.83e-01 0.016 0.000 0.984 0.000
#> SRR1304007     3  0.0592   8.83e-01 0.016 0.000 0.984 0.000
#> SRR1304008     1  0.1022   8.88e-01 0.968 0.000 0.032 0.000
#> SRR1304009     1  0.1022   8.88e-01 0.968 0.000 0.032 0.000
#> SRR1304010     4  0.1637   8.76e-01 0.060 0.000 0.000 0.940
#> SRR1304011     4  0.1637   8.76e-01 0.060 0.000 0.000 0.940
#> SRR1304012     1  0.1022   8.88e-01 0.968 0.000 0.032 0.000
#> SRR1304013     1  0.1022   8.88e-01 0.968 0.000 0.032 0.000
#> SRR1304014     1  0.0336   8.78e-01 0.992 0.008 0.000 0.000
#> SRR1304015     1  0.1022   8.88e-01 0.968 0.000 0.032 0.000
#> SRR1304016     1  0.0707   8.70e-01 0.980 0.000 0.020 0.000
#> SRR1304017     4  0.0188   9.18e-01 0.000 0.004 0.000 0.996
#> SRR1304018     4  0.0188   9.18e-01 0.000 0.004 0.000 0.996
#> SRR1304019     1  0.1022   8.88e-01 0.968 0.000 0.032 0.000
#> SRR1304020     1  0.1022   8.88e-01 0.968 0.000 0.032 0.000
#> SRR1304021     1  0.1022   8.88e-01 0.968 0.000 0.032 0.000
#> SRR1304022     4  0.0188   9.18e-01 0.000 0.004 0.000 0.996
#> SRR1304024     4  0.0188   9.18e-01 0.000 0.004 0.000 0.996
#> SRR1304023     4  0.1305   8.98e-01 0.000 0.004 0.036 0.960
#> SRR1304026     2  0.2011   9.01e-01 0.000 0.920 0.000 0.080
#> SRR1304027     2  0.2011   9.01e-01 0.000 0.920 0.000 0.080
#> SRR1304025     4  0.0188   9.18e-01 0.000 0.004 0.000 0.996
#> SRR1304028     2  0.0592   9.18e-01 0.000 0.984 0.000 0.016
#> SRR1304029     2  0.0592   9.18e-01 0.000 0.984 0.000 0.016
#> SRR1304030     1  0.4737   6.51e-01 0.728 0.252 0.020 0.000
#> SRR1304031     1  0.4737   6.51e-01 0.728 0.252 0.020 0.000
#> SRR1304032     2  0.1716   9.12e-01 0.000 0.936 0.000 0.064
#> SRR1304033     2  0.1716   9.12e-01 0.000 0.936 0.000 0.064
#> SRR1304034     2  0.0592   9.18e-01 0.000 0.984 0.000 0.016
#> SRR1304035     2  0.0592   9.18e-01 0.000 0.984 0.000 0.016
#> SRR1304036     2  0.0336   9.16e-01 0.000 0.992 0.000 0.008
#> SRR1304037     2  0.0336   9.16e-01 0.000 0.992 0.000 0.008
#> SRR1304038     4  0.0592   9.12e-01 0.000 0.000 0.016 0.984
#> SRR1304039     4  0.0592   9.12e-01 0.000 0.000 0.016 0.984
#> SRR1304040     4  0.0188   9.18e-01 0.000 0.004 0.000 0.996
#> SRR1304041     4  0.0188   9.18e-01 0.000 0.004 0.000 0.996
#> SRR1304042     4  0.4998  -1.85e-05 0.000 0.488 0.000 0.512
#> SRR1304043     4  0.4998  -1.85e-05 0.000 0.488 0.000 0.512
#> SRR1304046     1  0.0336   8.78e-01 0.992 0.008 0.000 0.000
#> SRR1304047     1  0.0336   8.78e-01 0.992 0.008 0.000 0.000
#> SRR1304044     2  0.1716   9.12e-01 0.000 0.936 0.000 0.064
#> SRR1304045     2  0.1716   9.12e-01 0.000 0.936 0.000 0.064
#> SRR1304048     4  0.0188   9.18e-01 0.000 0.004 0.000 0.996
#> SRR1304049     4  0.0188   9.18e-01 0.000 0.004 0.000 0.996
#> SRR1304050     1  0.0336   8.78e-01 0.992 0.008 0.000 0.000
#> SRR1304051     1  0.5360   7.19e-01 0.744 0.044 0.196 0.016
#> SRR1304052     4  0.2002   8.79e-01 0.000 0.044 0.020 0.936
#> SRR1304053     1  0.5360   7.19e-01 0.744 0.044 0.196 0.016
#> SRR1304055     2  0.2053   9.05e-01 0.004 0.924 0.000 0.072
#> SRR1304054     2  0.0336   9.16e-01 0.000 0.992 0.000 0.008
#> SRR1304056     2  0.6700   4.09e-01 0.088 0.588 0.316 0.008
#> SRR1304059     2  0.5543   5.17e-01 0.032 0.660 0.304 0.004
#> SRR1304057     3  0.5853  -2.63e-02 0.032 0.460 0.508 0.000
#> SRR1304058     4  0.0000   9.17e-01 0.000 0.000 0.000 1.000
#> SRR1304060     3  0.0000   8.84e-01 0.000 0.000 1.000 0.000
#> SRR1304061     2  0.1943   8.84e-01 0.032 0.944 0.016 0.008

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>            class entropy silhouette    p1    p2    p3    p4    p5
#> SRR1303990     3  0.5681      0.412 0.048 0.000 0.588 0.024 0.340
#> SRR1303991     3  0.5681      0.412 0.048 0.000 0.588 0.024 0.340
#> SRR1303992     3  0.0000      0.842 0.000 0.000 1.000 0.000 0.000
#> SRR1303993     3  0.0000      0.842 0.000 0.000 1.000 0.000 0.000
#> SRR1303994     3  0.0000      0.842 0.000 0.000 1.000 0.000 0.000
#> SRR1303995     3  0.0000      0.842 0.000 0.000 1.000 0.000 0.000
#> SRR1303996     3  0.0000      0.842 0.000 0.000 1.000 0.000 0.000
#> SRR1303997     3  0.0000      0.842 0.000 0.000 1.000 0.000 0.000
#> SRR1303998     3  0.0000      0.842 0.000 0.000 1.000 0.000 0.000
#> SRR1303999     3  0.0000      0.842 0.000 0.000 1.000 0.000 0.000
#> SRR1304000     3  0.0000      0.842 0.000 0.000 1.000 0.000 0.000
#> SRR1304001     3  0.0000      0.842 0.000 0.000 1.000 0.000 0.000
#> SRR1304004     5  0.0579      0.848 0.008 0.000 0.008 0.000 0.984
#> SRR1304005     5  0.0579      0.848 0.008 0.000 0.008 0.000 0.984
#> SRR1304002     5  0.6612      0.335 0.248 0.000 0.296 0.000 0.456
#> SRR1304003     5  0.6612      0.335 0.248 0.000 0.296 0.000 0.456
#> SRR1304006     3  0.4270      0.508 0.320 0.000 0.668 0.000 0.012
#> SRR1304007     3  0.4270      0.508 0.320 0.000 0.668 0.000 0.012
#> SRR1304008     5  0.0579      0.848 0.008 0.000 0.008 0.000 0.984
#> SRR1304009     5  0.0579      0.848 0.008 0.000 0.008 0.000 0.984
#> SRR1304010     4  0.2110      0.878 0.072 0.000 0.000 0.912 0.016
#> SRR1304011     4  0.2110      0.878 0.072 0.000 0.000 0.912 0.016
#> SRR1304012     5  0.0693      0.845 0.012 0.000 0.008 0.000 0.980
#> SRR1304013     5  0.0693      0.845 0.012 0.000 0.008 0.000 0.980
#> SRR1304014     5  0.3109      0.749 0.200 0.000 0.000 0.000 0.800
#> SRR1304015     5  0.0693      0.845 0.012 0.000 0.008 0.000 0.980
#> SRR1304016     5  0.1544      0.795 0.068 0.000 0.000 0.000 0.932
#> SRR1304017     4  0.0794      0.883 0.028 0.000 0.000 0.972 0.000
#> SRR1304018     4  0.0794      0.883 0.028 0.000 0.000 0.972 0.000
#> SRR1304019     5  0.0693      0.845 0.012 0.000 0.008 0.000 0.980
#> SRR1304020     5  0.0579      0.846 0.008 0.000 0.008 0.000 0.984
#> SRR1304021     5  0.0324      0.848 0.004 0.000 0.004 0.000 0.992
#> SRR1304022     4  0.0794      0.883 0.028 0.000 0.000 0.972 0.000
#> SRR1304024     4  0.0162      0.887 0.000 0.004 0.000 0.996 0.000
#> SRR1304023     4  0.2589      0.840 0.048 0.000 0.044 0.900 0.008
#> SRR1304026     2  0.1121      0.933 0.000 0.956 0.000 0.044 0.000
#> SRR1304027     2  0.1121      0.933 0.000 0.956 0.000 0.044 0.000
#> SRR1304025     4  0.1697      0.883 0.060 0.008 0.000 0.932 0.000
#> SRR1304028     2  0.0290      0.963 0.008 0.992 0.000 0.000 0.000
#> SRR1304029     2  0.0290      0.963 0.008 0.992 0.000 0.000 0.000
#> SRR1304030     1  0.5509      0.719 0.644 0.104 0.004 0.000 0.248
#> SRR1304031     1  0.5509      0.719 0.644 0.104 0.004 0.000 0.248
#> SRR1304032     2  0.0000      0.963 0.000 1.000 0.000 0.000 0.000
#> SRR1304033     2  0.0000      0.963 0.000 1.000 0.000 0.000 0.000
#> SRR1304034     2  0.0290      0.963 0.008 0.992 0.000 0.000 0.000
#> SRR1304035     2  0.0290      0.963 0.008 0.992 0.000 0.000 0.000
#> SRR1304036     2  0.0404      0.961 0.012 0.988 0.000 0.000 0.000
#> SRR1304037     2  0.0404      0.961 0.012 0.988 0.000 0.000 0.000
#> SRR1304038     4  0.2390      0.873 0.060 0.008 0.024 0.908 0.000
#> SRR1304039     4  0.2390      0.873 0.060 0.008 0.024 0.908 0.000
#> SRR1304040     4  0.0162      0.887 0.000 0.004 0.000 0.996 0.000
#> SRR1304041     4  0.0162      0.887 0.000 0.004 0.000 0.996 0.000
#> SRR1304042     4  0.5044      0.284 0.036 0.408 0.000 0.556 0.000
#> SRR1304043     4  0.5044      0.284 0.036 0.408 0.000 0.556 0.000
#> SRR1304046     5  0.3109      0.749 0.200 0.000 0.000 0.000 0.800
#> SRR1304047     5  0.3109      0.749 0.200 0.000 0.000 0.000 0.800
#> SRR1304044     2  0.0404      0.959 0.012 0.988 0.000 0.000 0.000
#> SRR1304045     2  0.0404      0.959 0.012 0.988 0.000 0.000 0.000
#> SRR1304048     4  0.1697      0.883 0.060 0.008 0.000 0.932 0.000
#> SRR1304049     4  0.1697      0.883 0.060 0.008 0.000 0.932 0.000
#> SRR1304050     5  0.3109      0.749 0.200 0.000 0.000 0.000 0.800
#> SRR1304051     1  0.4609      0.713 0.704 0.000 0.016 0.020 0.260
#> SRR1304052     1  0.3838      0.556 0.716 0.000 0.000 0.280 0.004
#> SRR1304053     1  0.4542      0.711 0.704 0.000 0.016 0.016 0.264
#> SRR1304055     2  0.4799      0.637 0.228 0.708 0.000 0.060 0.004
#> SRR1304054     2  0.0162      0.963 0.004 0.996 0.000 0.000 0.000
#> SRR1304056     1  0.2931      0.749 0.896 0.040 0.020 0.028 0.016
#> SRR1304059     1  0.2060      0.747 0.928 0.036 0.000 0.024 0.012
#> SRR1304057     1  0.2824      0.714 0.872 0.032 0.096 0.000 0.000
#> SRR1304058     4  0.1341      0.863 0.056 0.000 0.000 0.944 0.000
#> SRR1304060     3  0.4171      0.367 0.396 0.000 0.604 0.000 0.000
#> SRR1304061     1  0.3605      0.717 0.832 0.120 0.000 0.036 0.012

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>            class entropy silhouette    p1    p2    p3    p4    p5    p6
#> SRR1303990     3  0.7093     0.3733 0.012 0.000 0.464 0.232 0.220 0.072
#> SRR1303991     3  0.7093     0.3733 0.012 0.000 0.464 0.232 0.220 0.072
#> SRR1303992     3  0.0000     0.8441 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1303993     3  0.0000     0.8441 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1303994     3  0.0000     0.8441 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1303995     3  0.0000     0.8441 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1303996     3  0.0000     0.8441 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1303997     3  0.0000     0.8441 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1303998     3  0.0000     0.8441 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1303999     3  0.0000     0.8441 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1304000     3  0.0000     0.8441 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1304001     3  0.0000     0.8441 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1304004     5  0.0146     0.8494 0.000 0.000 0.000 0.000 0.996 0.004
#> SRR1304005     5  0.0146     0.8494 0.000 0.000 0.000 0.000 0.996 0.004
#> SRR1304002     5  0.6442     0.4360 0.032 0.000 0.188 0.000 0.432 0.348
#> SRR1304003     5  0.6456     0.4357 0.032 0.000 0.192 0.000 0.432 0.344
#> SRR1304006     3  0.4234     0.3127 0.372 0.000 0.608 0.000 0.004 0.016
#> SRR1304007     3  0.4234     0.3127 0.372 0.000 0.608 0.000 0.004 0.016
#> SRR1304008     5  0.0146     0.8494 0.000 0.000 0.000 0.000 0.996 0.004
#> SRR1304009     5  0.0146     0.8494 0.000 0.000 0.000 0.000 0.996 0.004
#> SRR1304010     6  0.4984     0.6277 0.008 0.000 0.000 0.464 0.048 0.480
#> SRR1304011     6  0.4984     0.6277 0.008 0.000 0.000 0.464 0.048 0.480
#> SRR1304012     5  0.1327     0.8329 0.000 0.000 0.000 0.000 0.936 0.064
#> SRR1304013     5  0.1327     0.8329 0.000 0.000 0.000 0.000 0.936 0.064
#> SRR1304014     5  0.3642     0.7641 0.036 0.000 0.000 0.000 0.760 0.204
#> SRR1304015     5  0.1082     0.8414 0.004 0.000 0.000 0.000 0.956 0.040
#> SRR1304016     5  0.2510     0.7763 0.100 0.000 0.000 0.000 0.872 0.028
#> SRR1304017     4  0.0260     0.5596 0.000 0.000 0.000 0.992 0.000 0.008
#> SRR1304018     4  0.0405     0.5567 0.004 0.000 0.000 0.988 0.000 0.008
#> SRR1304019     5  0.0937     0.8422 0.000 0.000 0.000 0.000 0.960 0.040
#> SRR1304020     5  0.0790     0.8440 0.000 0.000 0.000 0.000 0.968 0.032
#> SRR1304021     5  0.0547     0.8490 0.000 0.000 0.000 0.000 0.980 0.020
#> SRR1304022     4  0.0000     0.5598 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR1304024     4  0.2416     0.5189 0.000 0.000 0.000 0.844 0.000 0.156
#> SRR1304023     4  0.4043     0.3963 0.044 0.000 0.056 0.800 0.004 0.096
#> SRR1304026     2  0.2704     0.7880 0.000 0.844 0.000 0.140 0.000 0.016
#> SRR1304027     2  0.2704     0.7880 0.000 0.844 0.000 0.140 0.000 0.016
#> SRR1304025     6  0.3847     0.8076 0.000 0.000 0.000 0.456 0.000 0.544
#> SRR1304028     2  0.1237     0.9053 0.020 0.956 0.000 0.004 0.000 0.020
#> SRR1304029     2  0.1237     0.9053 0.020 0.956 0.000 0.004 0.000 0.020
#> SRR1304030     1  0.2879     0.8011 0.868 0.044 0.000 0.000 0.072 0.016
#> SRR1304031     1  0.2879     0.8011 0.868 0.044 0.000 0.000 0.072 0.016
#> SRR1304032     2  0.0000     0.9178 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR1304033     2  0.0000     0.9178 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR1304034     2  0.0000     0.9178 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR1304035     2  0.0000     0.9178 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR1304036     2  0.0146     0.9171 0.004 0.996 0.000 0.000 0.000 0.000
#> SRR1304037     2  0.0146     0.9171 0.004 0.996 0.000 0.000 0.000 0.000
#> SRR1304038     6  0.3774     0.8034 0.000 0.000 0.000 0.408 0.000 0.592
#> SRR1304039     6  0.3774     0.8034 0.000 0.000 0.000 0.408 0.000 0.592
#> SRR1304040     4  0.2416     0.5189 0.000 0.000 0.000 0.844 0.000 0.156
#> SRR1304041     4  0.2416     0.5189 0.000 0.000 0.000 0.844 0.000 0.156
#> SRR1304042     4  0.6239     0.3281 0.016 0.296 0.000 0.464 0.000 0.224
#> SRR1304043     4  0.6239     0.3281 0.016 0.296 0.000 0.464 0.000 0.224
#> SRR1304046     5  0.3671     0.7623 0.036 0.000 0.000 0.000 0.756 0.208
#> SRR1304047     5  0.3671     0.7623 0.036 0.000 0.000 0.000 0.756 0.208
#> SRR1304044     2  0.1088     0.9070 0.016 0.960 0.000 0.000 0.000 0.024
#> SRR1304045     2  0.1088     0.9070 0.016 0.960 0.000 0.000 0.000 0.024
#> SRR1304048     6  0.3847     0.8076 0.000 0.000 0.000 0.456 0.000 0.544
#> SRR1304049     6  0.3847     0.8076 0.000 0.000 0.000 0.456 0.000 0.544
#> SRR1304050     5  0.3860     0.7451 0.036 0.000 0.000 0.000 0.728 0.236
#> SRR1304051     1  0.3088     0.8028 0.860 0.000 0.000 0.032 0.064 0.044
#> SRR1304052     1  0.2554     0.7876 0.876 0.000 0.000 0.076 0.000 0.048
#> SRR1304053     1  0.3088     0.8028 0.860 0.000 0.000 0.032 0.064 0.044
#> SRR1304055     2  0.6704     0.1360 0.076 0.432 0.000 0.140 0.000 0.352
#> SRR1304054     2  0.0000     0.9178 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR1304056     1  0.2320     0.7988 0.864 0.004 0.000 0.000 0.000 0.132
#> SRR1304059     1  0.2527     0.7872 0.832 0.000 0.000 0.000 0.000 0.168
#> SRR1304057     1  0.1531     0.8134 0.928 0.000 0.004 0.000 0.000 0.068
#> SRR1304058     4  0.3738     0.5117 0.040 0.000 0.000 0.752 0.000 0.208
#> SRR1304060     1  0.3993    -0.0148 0.520 0.000 0.476 0.000 0.000 0.004
#> SRR1304061     1  0.4270     0.6898 0.684 0.052 0.000 0.000 0.000 0.264

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

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

collect_plots(res)

plot of chunk SD-pam-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.534           0.821       0.867          0.312 0.700   0.700
#> 3 3 1.000           0.934       0.969          0.720 0.747   0.644
#> 4 4 0.758           0.882       0.937          0.229 0.891   0.770
#> 5 5 0.774           0.775       0.851          0.102 0.950   0.864
#> 6 6 0.814           0.855       0.906          0.101 0.865   0.590

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
#> SRR1303990     1  0.8909      0.610 0.692 0.308
#> SRR1303991     1  0.8909      0.610 0.692 0.308
#> SRR1303992     1  0.8909      0.610 0.692 0.308
#> SRR1303993     1  0.8909      0.610 0.692 0.308
#> SRR1303994     1  0.8909      0.610 0.692 0.308
#> SRR1303995     1  0.8909      0.610 0.692 0.308
#> SRR1303996     1  0.8909      0.610 0.692 0.308
#> SRR1303997     1  0.8909      0.610 0.692 0.308
#> SRR1303998     1  0.8909      0.610 0.692 0.308
#> SRR1303999     1  0.8909      0.610 0.692 0.308
#> SRR1304000     1  0.8909      0.610 0.692 0.308
#> SRR1304001     1  0.8909      0.610 0.692 0.308
#> SRR1304004     1  0.0000      0.874 1.000 0.000
#> SRR1304005     1  0.0000      0.874 1.000 0.000
#> SRR1304002     1  0.0000      0.874 1.000 0.000
#> SRR1304003     1  0.0000      0.874 1.000 0.000
#> SRR1304006     1  0.0000      0.874 1.000 0.000
#> SRR1304007     1  0.0000      0.874 1.000 0.000
#> SRR1304008     1  0.0000      0.874 1.000 0.000
#> SRR1304009     1  0.0000      0.874 1.000 0.000
#> SRR1304010     1  0.1633      0.865 0.976 0.024
#> SRR1304011     1  0.1633      0.865 0.976 0.024
#> SRR1304012     1  0.0000      0.874 1.000 0.000
#> SRR1304013     1  0.0000      0.874 1.000 0.000
#> SRR1304014     1  0.0000      0.874 1.000 0.000
#> SRR1304015     1  0.0000      0.874 1.000 0.000
#> SRR1304016     1  0.0000      0.874 1.000 0.000
#> SRR1304017     1  0.1843      0.863 0.972 0.028
#> SRR1304018     1  0.1843      0.863 0.972 0.028
#> SRR1304019     1  0.0000      0.874 1.000 0.000
#> SRR1304020     1  0.0000      0.874 1.000 0.000
#> SRR1304021     1  0.0000      0.874 1.000 0.000
#> SRR1304022     1  0.1843      0.863 0.972 0.028
#> SRR1304024     1  0.1843      0.863 0.972 0.028
#> SRR1304023     1  0.1843      0.863 0.972 0.028
#> SRR1304026     2  0.8909      0.995 0.308 0.692
#> SRR1304027     2  0.8909      0.995 0.308 0.692
#> SRR1304025     1  0.1843      0.863 0.972 0.028
#> SRR1304028     2  0.8955      0.997 0.312 0.688
#> SRR1304029     2  0.8955      0.997 0.312 0.688
#> SRR1304030     1  0.0000      0.874 1.000 0.000
#> SRR1304031     1  0.0000      0.874 1.000 0.000
#> SRR1304032     2  0.8909      0.995 0.308 0.692
#> SRR1304033     2  0.8909      0.995 0.308 0.692
#> SRR1304034     2  0.8955      0.997 0.312 0.688
#> SRR1304035     2  0.8955      0.997 0.312 0.688
#> SRR1304036     2  0.8955      0.997 0.312 0.688
#> SRR1304037     2  0.8955      0.997 0.312 0.688
#> SRR1304038     1  0.1633      0.865 0.976 0.024
#> SRR1304039     1  0.1633      0.865 0.976 0.024
#> SRR1304040     1  0.1843      0.863 0.972 0.028
#> SRR1304041     1  0.1843      0.863 0.972 0.028
#> SRR1304042     1  0.9522     -0.118 0.628 0.372
#> SRR1304043     1  0.9580     -0.156 0.620 0.380
#> SRR1304046     1  0.0000      0.874 1.000 0.000
#> SRR1304047     1  0.0000      0.874 1.000 0.000
#> SRR1304044     2  0.9044      0.986 0.320 0.680
#> SRR1304045     2  0.8955      0.997 0.312 0.688
#> SRR1304048     1  0.1633      0.865 0.976 0.024
#> SRR1304049     1  0.1633      0.865 0.976 0.024
#> SRR1304050     1  0.0000      0.874 1.000 0.000
#> SRR1304051     1  0.1184      0.868 0.984 0.016
#> SRR1304052     1  0.1633      0.865 0.976 0.024
#> SRR1304053     1  0.0376      0.873 0.996 0.004
#> SRR1304055     1  0.1633      0.865 0.976 0.024
#> SRR1304054     2  0.8955      0.997 0.312 0.688
#> SRR1304056     1  0.0000      0.874 1.000 0.000
#> SRR1304059     1  0.0672      0.871 0.992 0.008
#> SRR1304057     1  0.0672      0.871 0.992 0.008
#> SRR1304058     1  0.1843      0.863 0.972 0.028
#> SRR1304060     1  0.0000      0.874 1.000 0.000
#> SRR1304061     1  0.0000      0.874 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
#> SRR1303990     1  0.6140      0.383 0.596 0.000 0.404
#> SRR1303991     1  0.6140      0.383 0.596 0.000 0.404
#> SRR1303992     3  0.0000      0.999 0.000 0.000 1.000
#> SRR1303993     3  0.0000      0.999 0.000 0.000 1.000
#> SRR1303994     3  0.0000      0.999 0.000 0.000 1.000
#> SRR1303995     3  0.0000      0.999 0.000 0.000 1.000
#> SRR1303996     3  0.0000      0.999 0.000 0.000 1.000
#> SRR1303997     3  0.0000      0.999 0.000 0.000 1.000
#> SRR1303998     3  0.0000      0.999 0.000 0.000 1.000
#> SRR1303999     3  0.0000      0.999 0.000 0.000 1.000
#> SRR1304000     3  0.0000      0.999 0.000 0.000 1.000
#> SRR1304001     3  0.0000      0.999 0.000 0.000 1.000
#> SRR1304004     1  0.1163      0.970 0.972 0.000 0.028
#> SRR1304005     1  0.1163      0.970 0.972 0.000 0.028
#> SRR1304002     1  0.1163      0.970 0.972 0.000 0.028
#> SRR1304003     1  0.1163      0.970 0.972 0.000 0.028
#> SRR1304006     1  0.1163      0.970 0.972 0.000 0.028
#> SRR1304007     1  0.1163      0.970 0.972 0.000 0.028
#> SRR1304008     1  0.1163      0.970 0.972 0.000 0.028
#> SRR1304009     1  0.1163      0.970 0.972 0.000 0.028
#> SRR1304010     1  0.0000      0.965 1.000 0.000 0.000
#> SRR1304011     1  0.0000      0.965 1.000 0.000 0.000
#> SRR1304012     1  0.1163      0.970 0.972 0.000 0.028
#> SRR1304013     1  0.1163      0.970 0.972 0.000 0.028
#> SRR1304014     1  0.1163      0.970 0.972 0.000 0.028
#> SRR1304015     1  0.1163      0.970 0.972 0.000 0.028
#> SRR1304016     1  0.1163      0.970 0.972 0.000 0.028
#> SRR1304017     1  0.0000      0.965 1.000 0.000 0.000
#> SRR1304018     1  0.0000      0.965 1.000 0.000 0.000
#> SRR1304019     1  0.1163      0.970 0.972 0.000 0.028
#> SRR1304020     1  0.1163      0.970 0.972 0.000 0.028
#> SRR1304021     1  0.1163      0.970 0.972 0.000 0.028
#> SRR1304022     1  0.0000      0.965 1.000 0.000 0.000
#> SRR1304024     1  0.0000      0.965 1.000 0.000 0.000
#> SRR1304023     1  0.0000      0.965 1.000 0.000 0.000
#> SRR1304026     2  0.0000      0.921 0.000 1.000 0.000
#> SRR1304027     2  0.0000      0.921 0.000 1.000 0.000
#> SRR1304025     1  0.0000      0.965 1.000 0.000 0.000
#> SRR1304028     2  0.0000      0.921 0.000 1.000 0.000
#> SRR1304029     2  0.0000      0.921 0.000 1.000 0.000
#> SRR1304030     1  0.1163      0.970 0.972 0.000 0.028
#> SRR1304031     1  0.1163      0.970 0.972 0.000 0.028
#> SRR1304032     2  0.0000      0.921 0.000 1.000 0.000
#> SRR1304033     2  0.0000      0.921 0.000 1.000 0.000
#> SRR1304034     2  0.0000      0.921 0.000 1.000 0.000
#> SRR1304035     2  0.0000      0.921 0.000 1.000 0.000
#> SRR1304036     2  0.0000      0.921 0.000 1.000 0.000
#> SRR1304037     2  0.0000      0.921 0.000 1.000 0.000
#> SRR1304038     1  0.0000      0.965 1.000 0.000 0.000
#> SRR1304039     1  0.0000      0.965 1.000 0.000 0.000
#> SRR1304040     1  0.0000      0.965 1.000 0.000 0.000
#> SRR1304041     1  0.0000      0.965 1.000 0.000 0.000
#> SRR1304042     2  0.5882      0.499 0.348 0.652 0.000
#> SRR1304043     2  0.5835      0.510 0.340 0.660 0.000
#> SRR1304046     1  0.1163      0.970 0.972 0.000 0.028
#> SRR1304047     1  0.1163      0.970 0.972 0.000 0.028
#> SRR1304044     2  0.1411      0.896 0.036 0.964 0.000
#> SRR1304045     2  0.1163      0.902 0.028 0.972 0.000
#> SRR1304048     1  0.0000      0.965 1.000 0.000 0.000
#> SRR1304049     1  0.0000      0.965 1.000 0.000 0.000
#> SRR1304050     1  0.1163      0.970 0.972 0.000 0.028
#> SRR1304051     1  0.1163      0.970 0.972 0.000 0.028
#> SRR1304052     1  0.0000      0.965 1.000 0.000 0.000
#> SRR1304053     1  0.1163      0.970 0.972 0.000 0.028
#> SRR1304055     1  0.0000      0.965 1.000 0.000 0.000
#> SRR1304054     2  0.0000      0.921 0.000 1.000 0.000
#> SRR1304056     1  0.1163      0.970 0.972 0.000 0.028
#> SRR1304059     1  0.0000      0.965 1.000 0.000 0.000
#> SRR1304057     1  0.0237      0.966 0.996 0.000 0.004
#> SRR1304058     1  0.0000      0.965 1.000 0.000 0.000
#> SRR1304060     3  0.0237      0.994 0.004 0.000 0.996
#> SRR1304061     1  0.1163      0.970 0.972 0.000 0.028

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> SRR1303990     1  0.4776     0.4728 0.624 0.000 0.376 0.000
#> SRR1303991     1  0.4776     0.4728 0.624 0.000 0.376 0.000
#> SRR1303992     3  0.0817     0.9559 0.024 0.000 0.976 0.000
#> SRR1303993     3  0.0817     0.9559 0.024 0.000 0.976 0.000
#> SRR1303994     3  0.0000     0.9748 0.000 0.000 1.000 0.000
#> SRR1303995     3  0.0000     0.9748 0.000 0.000 1.000 0.000
#> SRR1303996     3  0.0000     0.9748 0.000 0.000 1.000 0.000
#> SRR1303997     3  0.0000     0.9748 0.000 0.000 1.000 0.000
#> SRR1303998     3  0.0000     0.9748 0.000 0.000 1.000 0.000
#> SRR1303999     3  0.0000     0.9748 0.000 0.000 1.000 0.000
#> SRR1304000     3  0.0000     0.9748 0.000 0.000 1.000 0.000
#> SRR1304001     3  0.0000     0.9748 0.000 0.000 1.000 0.000
#> SRR1304004     1  0.2408     0.8722 0.896 0.000 0.000 0.104
#> SRR1304005     1  0.2408     0.8722 0.896 0.000 0.000 0.104
#> SRR1304002     1  0.0000     0.9022 1.000 0.000 0.000 0.000
#> SRR1304003     1  0.0000     0.9022 1.000 0.000 0.000 0.000
#> SRR1304006     1  0.0000     0.9022 1.000 0.000 0.000 0.000
#> SRR1304007     1  0.0000     0.9022 1.000 0.000 0.000 0.000
#> SRR1304008     1  0.2408     0.8722 0.896 0.000 0.000 0.104
#> SRR1304009     1  0.2408     0.8722 0.896 0.000 0.000 0.104
#> SRR1304010     1  0.2760     0.8677 0.872 0.000 0.000 0.128
#> SRR1304011     1  0.2760     0.8677 0.872 0.000 0.000 0.128
#> SRR1304012     1  0.2408     0.8722 0.896 0.000 0.000 0.104
#> SRR1304013     1  0.2408     0.8722 0.896 0.000 0.000 0.104
#> SRR1304014     1  0.0188     0.9018 0.996 0.000 0.000 0.004
#> SRR1304015     1  0.2408     0.8722 0.896 0.000 0.000 0.104
#> SRR1304016     1  0.0000     0.9022 1.000 0.000 0.000 0.000
#> SRR1304017     1  0.4382     0.5666 0.704 0.000 0.000 0.296
#> SRR1304018     1  0.1022     0.8907 0.968 0.000 0.000 0.032
#> SRR1304019     1  0.2408     0.8722 0.896 0.000 0.000 0.104
#> SRR1304020     1  0.2408     0.8722 0.896 0.000 0.000 0.104
#> SRR1304021     1  0.2408     0.8722 0.896 0.000 0.000 0.104
#> SRR1304022     4  0.2408     0.9265 0.104 0.000 0.000 0.896
#> SRR1304024     4  0.2408     0.9265 0.104 0.000 0.000 0.896
#> SRR1304023     4  0.1637     0.8062 0.060 0.000 0.000 0.940
#> SRR1304026     2  0.0000     0.9893 0.000 1.000 0.000 0.000
#> SRR1304027     2  0.0000     0.9893 0.000 1.000 0.000 0.000
#> SRR1304025     1  0.5000    -0.0496 0.504 0.000 0.000 0.496
#> SRR1304028     2  0.0000     0.9893 0.000 1.000 0.000 0.000
#> SRR1304029     2  0.0000     0.9893 0.000 1.000 0.000 0.000
#> SRR1304030     1  0.0000     0.9022 1.000 0.000 0.000 0.000
#> SRR1304031     1  0.0000     0.9022 1.000 0.000 0.000 0.000
#> SRR1304032     2  0.0000     0.9893 0.000 1.000 0.000 0.000
#> SRR1304033     2  0.0000     0.9893 0.000 1.000 0.000 0.000
#> SRR1304034     2  0.0000     0.9893 0.000 1.000 0.000 0.000
#> SRR1304035     2  0.0000     0.9893 0.000 1.000 0.000 0.000
#> SRR1304036     2  0.0000     0.9893 0.000 1.000 0.000 0.000
#> SRR1304037     2  0.0000     0.9893 0.000 1.000 0.000 0.000
#> SRR1304038     1  0.0817     0.8945 0.976 0.000 0.000 0.024
#> SRR1304039     1  0.0817     0.8945 0.976 0.000 0.000 0.024
#> SRR1304040     4  0.2408     0.9265 0.104 0.000 0.000 0.896
#> SRR1304041     4  0.2408     0.9265 0.104 0.000 0.000 0.896
#> SRR1304042     4  0.2408     0.8464 0.000 0.104 0.000 0.896
#> SRR1304043     4  0.2408     0.8464 0.000 0.104 0.000 0.896
#> SRR1304046     1  0.0000     0.9022 1.000 0.000 0.000 0.000
#> SRR1304047     1  0.0000     0.9022 1.000 0.000 0.000 0.000
#> SRR1304044     2  0.2124     0.9130 0.008 0.924 0.000 0.068
#> SRR1304045     2  0.1118     0.9548 0.000 0.964 0.000 0.036
#> SRR1304048     1  0.3907     0.6773 0.768 0.000 0.000 0.232
#> SRR1304049     1  0.3801     0.6951 0.780 0.000 0.000 0.220
#> SRR1304050     1  0.0000     0.9022 1.000 0.000 0.000 0.000
#> SRR1304051     1  0.0000     0.9022 1.000 0.000 0.000 0.000
#> SRR1304052     1  0.0817     0.8945 0.976 0.000 0.000 0.024
#> SRR1304053     1  0.0000     0.9022 1.000 0.000 0.000 0.000
#> SRR1304055     1  0.0817     0.8945 0.976 0.000 0.000 0.024
#> SRR1304054     2  0.0000     0.9893 0.000 1.000 0.000 0.000
#> SRR1304056     1  0.0000     0.9022 1.000 0.000 0.000 0.000
#> SRR1304059     1  0.0817     0.8945 0.976 0.000 0.000 0.024
#> SRR1304057     1  0.0817     0.8945 0.976 0.000 0.000 0.024
#> SRR1304058     4  0.2408     0.9265 0.104 0.000 0.000 0.896
#> SRR1304060     3  0.2814     0.8005 0.132 0.000 0.868 0.000
#> SRR1304061     1  0.0000     0.9022 1.000 0.000 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>            class entropy silhouette    p1   p2    p3    p4    p5
#> SRR1303990     5   0.631      0.702 0.184 0.00 0.304 0.000 0.512
#> SRR1303991     5   0.631      0.702 0.184 0.00 0.304 0.000 0.512
#> SRR1303992     3   0.196      0.784 0.096 0.00 0.904 0.000 0.000
#> SRR1303993     3   0.196      0.784 0.096 0.00 0.904 0.000 0.000
#> SRR1303994     3   0.000      0.886 0.000 0.00 1.000 0.000 0.000
#> SRR1303995     3   0.000      0.886 0.000 0.00 1.000 0.000 0.000
#> SRR1303996     3   0.000      0.886 0.000 0.00 1.000 0.000 0.000
#> SRR1303997     3   0.000      0.886 0.000 0.00 1.000 0.000 0.000
#> SRR1303998     3   0.000      0.886 0.000 0.00 1.000 0.000 0.000
#> SRR1303999     3   0.000      0.886 0.000 0.00 1.000 0.000 0.000
#> SRR1304000     3   0.000      0.886 0.000 0.00 1.000 0.000 0.000
#> SRR1304001     3   0.000      0.886 0.000 0.00 1.000 0.000 0.000
#> SRR1304004     1   0.000      0.695 1.000 0.00 0.000 0.000 0.000
#> SRR1304005     1   0.000      0.695 1.000 0.00 0.000 0.000 0.000
#> SRR1304002     1   0.337      0.767 0.768 0.00 0.000 0.000 0.232
#> SRR1304003     1   0.337      0.767 0.768 0.00 0.000 0.000 0.232
#> SRR1304006     1   0.429      0.728 0.532 0.00 0.000 0.000 0.468
#> SRR1304007     1   0.430      0.724 0.524 0.00 0.000 0.000 0.476
#> SRR1304008     1   0.000      0.695 1.000 0.00 0.000 0.000 0.000
#> SRR1304009     1   0.000      0.695 1.000 0.00 0.000 0.000 0.000
#> SRR1304010     1   0.173      0.709 0.920 0.00 0.000 0.000 0.080
#> SRR1304011     1   0.196      0.716 0.904 0.00 0.000 0.000 0.096
#> SRR1304012     1   0.029      0.694 0.992 0.00 0.000 0.000 0.008
#> SRR1304013     1   0.029      0.694 0.992 0.00 0.000 0.000 0.008
#> SRR1304014     1   0.334      0.766 0.772 0.00 0.000 0.000 0.228
#> SRR1304015     1   0.029      0.694 0.992 0.00 0.000 0.000 0.008
#> SRR1304016     1   0.281      0.759 0.832 0.00 0.000 0.000 0.168
#> SRR1304017     1   0.418      0.438 0.600 0.00 0.000 0.400 0.000
#> SRR1304018     1   0.448      0.645 0.720 0.00 0.000 0.232 0.048
#> SRR1304019     1   0.029      0.694 0.992 0.00 0.000 0.000 0.008
#> SRR1304020     1   0.000      0.695 1.000 0.00 0.000 0.000 0.000
#> SRR1304021     1   0.161      0.707 0.928 0.00 0.000 0.000 0.072
#> SRR1304022     4   0.000      0.871 0.000 0.00 0.000 1.000 0.000
#> SRR1304024     4   0.000      0.871 0.000 0.00 0.000 1.000 0.000
#> SRR1304023     5   0.613      0.341 0.164 0.00 0.000 0.292 0.544
#> SRR1304026     2   0.000      0.987 0.000 1.00 0.000 0.000 0.000
#> SRR1304027     2   0.000      0.987 0.000 1.00 0.000 0.000 0.000
#> SRR1304025     4   0.418      0.064 0.400 0.00 0.000 0.600 0.000
#> SRR1304028     2   0.000      0.987 0.000 1.00 0.000 0.000 0.000
#> SRR1304029     2   0.000      0.987 0.000 1.00 0.000 0.000 0.000
#> SRR1304030     1   0.423      0.717 0.580 0.00 0.000 0.000 0.420
#> SRR1304031     1   0.423      0.717 0.580 0.00 0.000 0.000 0.420
#> SRR1304032     2   0.000      0.987 0.000 1.00 0.000 0.000 0.000
#> SRR1304033     2   0.000      0.987 0.000 1.00 0.000 0.000 0.000
#> SRR1304034     2   0.000      0.987 0.000 1.00 0.000 0.000 0.000
#> SRR1304035     2   0.000      0.987 0.000 1.00 0.000 0.000 0.000
#> SRR1304036     2   0.000      0.987 0.000 1.00 0.000 0.000 0.000
#> SRR1304037     2   0.000      0.987 0.000 1.00 0.000 0.000 0.000
#> SRR1304038     1   0.364      0.769 0.728 0.00 0.000 0.000 0.272
#> SRR1304039     1   0.364      0.769 0.728 0.00 0.000 0.000 0.272
#> SRR1304040     4   0.000      0.871 0.000 0.00 0.000 1.000 0.000
#> SRR1304041     4   0.000      0.871 0.000 0.00 0.000 1.000 0.000
#> SRR1304042     4   0.000      0.871 0.000 0.00 0.000 1.000 0.000
#> SRR1304043     4   0.000      0.871 0.000 0.00 0.000 1.000 0.000
#> SRR1304046     1   0.337      0.767 0.768 0.00 0.000 0.000 0.232
#> SRR1304047     1   0.337      0.767 0.768 0.00 0.000 0.000 0.232
#> SRR1304044     2   0.219      0.882 0.008 0.90 0.000 0.092 0.000
#> SRR1304045     2   0.104      0.949 0.000 0.96 0.000 0.040 0.000
#> SRR1304048     1   0.566      0.694 0.512 0.00 0.000 0.080 0.408
#> SRR1304049     1   0.566      0.694 0.512 0.00 0.000 0.080 0.408
#> SRR1304050     1   0.364      0.769 0.728 0.00 0.000 0.000 0.272
#> SRR1304051     1   0.422      0.716 0.584 0.00 0.000 0.000 0.416
#> SRR1304052     1   0.430      0.722 0.512 0.00 0.000 0.000 0.488
#> SRR1304053     1   0.422      0.716 0.584 0.00 0.000 0.000 0.416
#> SRR1304055     1   0.430      0.722 0.520 0.00 0.000 0.000 0.480
#> SRR1304054     2   0.000      0.987 0.000 1.00 0.000 0.000 0.000
#> SRR1304056     1   0.430      0.722 0.512 0.00 0.000 0.000 0.488
#> SRR1304059     1   0.430      0.722 0.520 0.00 0.000 0.000 0.480
#> SRR1304057     1   0.430      0.722 0.512 0.00 0.000 0.000 0.488
#> SRR1304058     4   0.000      0.871 0.000 0.00 0.000 1.000 0.000
#> SRR1304060     3   0.562      0.136 0.076 0.00 0.508 0.000 0.416
#> SRR1304061     1   0.430      0.722 0.520 0.00 0.000 0.000 0.480

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>            class entropy silhouette    p1    p2    p3    p4    p5    p6
#> SRR1303990     6  0.0632      0.984 0.000 0.000 0.024 0.000 0.000 0.976
#> SRR1303991     6  0.0632      0.984 0.000 0.000 0.024 0.000 0.000 0.976
#> SRR1303992     3  0.4074      0.665 0.140 0.000 0.752 0.000 0.108 0.000
#> SRR1303993     3  0.4074      0.665 0.140 0.000 0.752 0.000 0.108 0.000
#> SRR1303994     3  0.0000      0.923 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1303995     3  0.0000      0.923 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1303996     3  0.0000      0.923 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1303997     3  0.0000      0.923 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1303998     3  0.0000      0.923 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1303999     3  0.0000      0.923 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1304000     3  0.0000      0.923 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1304001     3  0.0000      0.923 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1304004     5  0.2872      0.850 0.140 0.000 0.000 0.000 0.836 0.024
#> SRR1304005     5  0.2872      0.850 0.140 0.000 0.000 0.000 0.836 0.024
#> SRR1304002     5  0.0146      0.848 0.004 0.000 0.000 0.000 0.996 0.000
#> SRR1304003     5  0.0146      0.848 0.004 0.000 0.000 0.000 0.996 0.000
#> SRR1304006     1  0.2762      0.835 0.804 0.000 0.000 0.000 0.196 0.000
#> SRR1304007     1  0.2562      0.851 0.828 0.000 0.000 0.000 0.172 0.000
#> SRR1304008     5  0.2872      0.850 0.140 0.000 0.000 0.000 0.836 0.024
#> SRR1304009     5  0.2872      0.850 0.140 0.000 0.000 0.000 0.836 0.024
#> SRR1304010     5  0.1462      0.837 0.056 0.000 0.000 0.000 0.936 0.008
#> SRR1304011     5  0.1765      0.813 0.096 0.000 0.000 0.000 0.904 0.000
#> SRR1304012     5  0.2872      0.850 0.140 0.000 0.000 0.000 0.836 0.024
#> SRR1304013     5  0.2872      0.850 0.140 0.000 0.000 0.000 0.836 0.024
#> SRR1304014     5  0.0146      0.848 0.004 0.000 0.000 0.000 0.996 0.000
#> SRR1304015     5  0.2872      0.850 0.140 0.000 0.000 0.000 0.836 0.024
#> SRR1304016     5  0.2768      0.848 0.156 0.000 0.000 0.000 0.832 0.012
#> SRR1304017     5  0.3756      0.385 0.000 0.000 0.000 0.400 0.600 0.000
#> SRR1304018     5  0.3743      0.660 0.024 0.000 0.000 0.252 0.724 0.000
#> SRR1304019     5  0.2872      0.850 0.140 0.000 0.000 0.000 0.836 0.024
#> SRR1304020     5  0.2872      0.850 0.140 0.000 0.000 0.000 0.836 0.024
#> SRR1304021     5  0.0000      0.848 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR1304022     4  0.0000      0.902 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR1304024     4  0.0000      0.902 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR1304023     6  0.0363      0.968 0.012 0.000 0.000 0.000 0.000 0.988
#> SRR1304026     2  0.0000      0.985 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR1304027     2  0.0000      0.985 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR1304025     4  0.3756      0.189 0.000 0.000 0.000 0.600 0.400 0.000
#> SRR1304028     2  0.0000      0.985 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR1304029     2  0.0000      0.985 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR1304030     1  0.0000      0.815 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR1304031     1  0.0000      0.815 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR1304032     2  0.0000      0.985 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR1304033     2  0.0000      0.985 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR1304034     2  0.0000      0.985 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR1304035     2  0.0000      0.985 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR1304036     2  0.0000      0.985 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR1304037     2  0.0000      0.985 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR1304038     5  0.1957      0.776 0.112 0.000 0.000 0.000 0.888 0.000
#> SRR1304039     5  0.1957      0.776 0.112 0.000 0.000 0.000 0.888 0.000
#> SRR1304040     4  0.0000      0.902 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR1304041     4  0.0000      0.902 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR1304042     4  0.0000      0.902 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR1304043     4  0.0000      0.902 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR1304046     5  0.0146      0.848 0.004 0.000 0.000 0.000 0.996 0.000
#> SRR1304047     5  0.0146      0.848 0.004 0.000 0.000 0.000 0.996 0.000
#> SRR1304044     2  0.2020      0.873 0.000 0.896 0.000 0.096 0.008 0.000
#> SRR1304045     2  0.1007      0.942 0.000 0.956 0.000 0.044 0.000 0.000
#> SRR1304048     1  0.4950      0.604 0.652 0.000 0.000 0.164 0.184 0.000
#> SRR1304049     1  0.4862      0.620 0.664 0.000 0.000 0.164 0.172 0.000
#> SRR1304050     5  0.1957      0.776 0.112 0.000 0.000 0.000 0.888 0.000
#> SRR1304051     1  0.0000      0.815 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR1304052     1  0.2260      0.857 0.860 0.000 0.000 0.000 0.140 0.000
#> SRR1304053     1  0.0000      0.815 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR1304055     1  0.2491      0.854 0.836 0.000 0.000 0.000 0.164 0.000
#> SRR1304054     2  0.0000      0.985 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR1304056     1  0.2260      0.857 0.860 0.000 0.000 0.000 0.140 0.000
#> SRR1304059     1  0.2491      0.854 0.836 0.000 0.000 0.000 0.164 0.000
#> SRR1304057     1  0.2260      0.857 0.860 0.000 0.000 0.000 0.140 0.000
#> SRR1304058     4  0.0000      0.902 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR1304060     1  0.0000      0.815 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR1304061     1  0.2491      0.854 0.836 0.000 0.000 0.000 0.164 0.000

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

consensus_heatmap(res, k = 2)

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

consensus_heatmap(res, k = 3)

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

consensus_heatmap(res, k = 4)

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

consensus_heatmap(res, k = 5)

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

consensus_heatmap(res, k = 6)

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

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

membership_heatmap(res, k = 2)

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

membership_heatmap(res, k = 3)

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

membership_heatmap(res, k = 4)

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

membership_heatmap(res, k = 5)

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

membership_heatmap(res, k = 6)

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

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

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

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

get_signatures(res, k = 3)

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

get_signatures(res, k = 4)

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

get_signatures(res, k = 5)

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

get_signatures(res, k = 6)

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

Signature heatmaps where rows are not scaled:

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

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

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

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

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

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

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

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

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

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

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk SD-pam-signature_compare

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

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

An example of the output of tb is:

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

The columns in tb are:

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

UMAP plot which shows how samples are separated.

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

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

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

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

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

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

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

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

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

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

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk SD-pam-collect-classes

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

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

collect_plots(res)

plot of chunk SD-mclust-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.215           0.750       0.810         0.3639 0.757   0.757
#> 3 3 0.470           0.730       0.873         0.6544 0.628   0.508
#> 4 4 0.483           0.676       0.791         0.1512 0.888   0.729
#> 5 5 0.619           0.677       0.764         0.0975 0.888   0.679
#> 6 6 0.662           0.494       0.667         0.0441 0.881   0.573

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
#> SRR1303990     2  0.7299      0.597 0.204 0.796
#> SRR1303991     2  0.7299      0.597 0.204 0.796
#> SRR1303992     1  0.6623      0.988 0.828 0.172
#> SRR1303993     1  0.6623      0.988 0.828 0.172
#> SRR1303994     1  0.6438      0.997 0.836 0.164
#> SRR1303995     1  0.6438      0.997 0.836 0.164
#> SRR1303996     1  0.6438      0.997 0.836 0.164
#> SRR1303997     1  0.6438      0.997 0.836 0.164
#> SRR1303998     1  0.6438      0.997 0.836 0.164
#> SRR1303999     1  0.6438      0.997 0.836 0.164
#> SRR1304000     1  0.6438      0.997 0.836 0.164
#> SRR1304001     1  0.6438      0.997 0.836 0.164
#> SRR1304004     2  0.2043      0.792 0.032 0.968
#> SRR1304005     2  0.2043      0.792 0.032 0.968
#> SRR1304002     2  0.9323      0.669 0.348 0.652
#> SRR1304003     2  0.9323      0.669 0.348 0.652
#> SRR1304006     2  0.8443      0.637 0.272 0.728
#> SRR1304007     2  0.9209      0.546 0.336 0.664
#> SRR1304008     2  0.0000      0.790 0.000 1.000
#> SRR1304009     2  0.0000      0.790 0.000 1.000
#> SRR1304010     2  0.6973      0.737 0.188 0.812
#> SRR1304011     2  0.6973      0.737 0.188 0.812
#> SRR1304012     2  0.0000      0.790 0.000 1.000
#> SRR1304013     2  0.0000      0.790 0.000 1.000
#> SRR1304014     2  0.6623      0.747 0.172 0.828
#> SRR1304015     2  0.0000      0.790 0.000 1.000
#> SRR1304016     2  0.6343      0.735 0.160 0.840
#> SRR1304017     2  0.2948      0.776 0.052 0.948
#> SRR1304018     2  0.0000      0.790 0.000 1.000
#> SRR1304019     2  0.0000      0.790 0.000 1.000
#> SRR1304020     2  0.0000      0.790 0.000 1.000
#> SRR1304021     2  0.6712      0.737 0.176 0.824
#> SRR1304022     2  0.1184      0.789 0.016 0.984
#> SRR1304024     2  0.0938      0.789 0.012 0.988
#> SRR1304023     2  0.3274      0.770 0.060 0.940
#> SRR1304026     2  0.6048      0.717 0.148 0.852
#> SRR1304027     2  0.6048      0.717 0.148 0.852
#> SRR1304025     2  0.0672      0.790 0.008 0.992
#> SRR1304028     2  0.7745      0.681 0.228 0.772
#> SRR1304029     2  0.7745      0.681 0.228 0.772
#> SRR1304030     2  0.7139      0.738 0.196 0.804
#> SRR1304031     2  0.8016      0.735 0.244 0.756
#> SRR1304032     2  0.7815      0.667 0.232 0.768
#> SRR1304033     2  0.7815      0.667 0.232 0.768
#> SRR1304034     2  0.7815      0.667 0.232 0.768
#> SRR1304035     2  0.7815      0.667 0.232 0.768
#> SRR1304036     2  0.8861      0.607 0.304 0.696
#> SRR1304037     2  0.8861      0.607 0.304 0.696
#> SRR1304038     2  0.8608      0.712 0.284 0.716
#> SRR1304039     2  0.9209      0.676 0.336 0.664
#> SRR1304040     2  0.0938      0.789 0.012 0.988
#> SRR1304041     2  0.0938      0.789 0.012 0.988
#> SRR1304042     2  0.6048      0.717 0.148 0.852
#> SRR1304043     2  0.6048      0.717 0.148 0.852
#> SRR1304046     2  0.6343      0.735 0.160 0.840
#> SRR1304047     2  0.6343      0.735 0.160 0.840
#> SRR1304044     2  0.8016      0.673 0.244 0.756
#> SRR1304045     2  0.8016      0.673 0.244 0.756
#> SRR1304048     2  0.2423      0.792 0.040 0.960
#> SRR1304049     2  0.2423      0.792 0.040 0.960
#> SRR1304050     2  0.8267      0.729 0.260 0.740
#> SRR1304051     2  0.6973      0.737 0.188 0.812
#> SRR1304052     2  0.6438      0.755 0.164 0.836
#> SRR1304053     2  0.6801      0.746 0.180 0.820
#> SRR1304055     2  0.8327      0.653 0.264 0.736
#> SRR1304054     2  0.6148      0.742 0.152 0.848
#> SRR1304056     2  0.9909      0.562 0.444 0.556
#> SRR1304059     2  0.9209      0.553 0.336 0.664
#> SRR1304057     2  0.9358      0.669 0.352 0.648
#> SRR1304058     2  0.6887      0.713 0.184 0.816
#> SRR1304060     2  0.9775      0.385 0.412 0.588
#> SRR1304061     2  0.8909      0.597 0.308 0.692

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>            class entropy silhouette    p1    p2    p3
#> SRR1303990     2  0.4784     0.6804 0.004 0.796 0.200
#> SRR1303991     2  0.4784     0.6804 0.004 0.796 0.200
#> SRR1303992     3  0.3532     0.8686 0.108 0.008 0.884
#> SRR1303993     3  0.3532     0.8686 0.108 0.008 0.884
#> SRR1303994     3  0.0000     0.9707 0.000 0.000 1.000
#> SRR1303995     3  0.0000     0.9707 0.000 0.000 1.000
#> SRR1303996     3  0.0000     0.9707 0.000 0.000 1.000
#> SRR1303997     3  0.0000     0.9707 0.000 0.000 1.000
#> SRR1303998     3  0.0000     0.9707 0.000 0.000 1.000
#> SRR1303999     3  0.0000     0.9707 0.000 0.000 1.000
#> SRR1304000     3  0.0000     0.9707 0.000 0.000 1.000
#> SRR1304001     3  0.0000     0.9707 0.000 0.000 1.000
#> SRR1304004     1  0.3116     0.7726 0.892 0.108 0.000
#> SRR1304005     1  0.2959     0.7766 0.900 0.100 0.000
#> SRR1304002     1  0.1015     0.8045 0.980 0.008 0.012
#> SRR1304003     1  0.1015     0.8045 0.980 0.008 0.012
#> SRR1304006     1  0.6887     0.6267 0.720 0.076 0.204
#> SRR1304007     1  0.7568     0.5881 0.680 0.108 0.212
#> SRR1304008     2  0.6308    -0.0366 0.492 0.508 0.000
#> SRR1304009     2  0.6308    -0.0366 0.492 0.508 0.000
#> SRR1304010     1  0.0424     0.8067 0.992 0.008 0.000
#> SRR1304011     1  0.0424     0.8067 0.992 0.008 0.000
#> SRR1304012     1  0.6192     0.3056 0.580 0.420 0.000
#> SRR1304013     1  0.6192     0.3056 0.580 0.420 0.000
#> SRR1304014     1  0.0237     0.8056 0.996 0.004 0.000
#> SRR1304015     1  0.6192     0.3056 0.580 0.420 0.000
#> SRR1304016     1  0.5785     0.4541 0.668 0.332 0.000
#> SRR1304017     2  0.0424     0.8524 0.008 0.992 0.000
#> SRR1304018     2  0.1031     0.8539 0.024 0.976 0.000
#> SRR1304019     1  0.6215     0.2833 0.572 0.428 0.000
#> SRR1304020     1  0.6192     0.3056 0.580 0.420 0.000
#> SRR1304021     1  0.0592     0.8078 0.988 0.012 0.000
#> SRR1304022     2  0.0424     0.8524 0.008 0.992 0.000
#> SRR1304024     2  0.0424     0.8524 0.008 0.992 0.000
#> SRR1304023     2  0.0424     0.8524 0.008 0.992 0.000
#> SRR1304026     2  0.0237     0.8498 0.004 0.996 0.000
#> SRR1304027     2  0.0237     0.8498 0.004 0.996 0.000
#> SRR1304025     2  0.4139     0.8289 0.124 0.860 0.016
#> SRR1304028     2  0.4139     0.8298 0.124 0.860 0.016
#> SRR1304029     2  0.4139     0.8298 0.124 0.860 0.016
#> SRR1304030     1  0.0747     0.8081 0.984 0.016 0.000
#> SRR1304031     1  0.0592     0.8081 0.988 0.012 0.000
#> SRR1304032     2  0.3193     0.8423 0.100 0.896 0.004
#> SRR1304033     2  0.3193     0.8423 0.100 0.896 0.004
#> SRR1304034     2  0.3272     0.8405 0.104 0.892 0.004
#> SRR1304035     2  0.3272     0.8405 0.104 0.892 0.004
#> SRR1304036     2  0.5623     0.6008 0.280 0.716 0.004
#> SRR1304037     2  0.5623     0.6008 0.280 0.716 0.004
#> SRR1304038     1  0.1491     0.8051 0.968 0.016 0.016
#> SRR1304039     1  0.1491     0.8051 0.968 0.016 0.016
#> SRR1304040     2  0.0424     0.8524 0.008 0.992 0.000
#> SRR1304041     2  0.0424     0.8524 0.008 0.992 0.000
#> SRR1304042     2  0.0237     0.8498 0.004 0.996 0.000
#> SRR1304043     2  0.0237     0.8498 0.004 0.996 0.000
#> SRR1304046     1  0.3551     0.7357 0.868 0.132 0.000
#> SRR1304047     1  0.2448     0.7798 0.924 0.076 0.000
#> SRR1304044     2  0.3989     0.8314 0.124 0.864 0.012
#> SRR1304045     2  0.3989     0.8314 0.124 0.864 0.012
#> SRR1304048     1  0.6948     0.0921 0.512 0.472 0.016
#> SRR1304049     1  0.6936     0.1338 0.524 0.460 0.016
#> SRR1304050     1  0.0000     0.8029 1.000 0.000 0.000
#> SRR1304051     1  0.0424     0.8067 0.992 0.008 0.000
#> SRR1304052     1  0.2537     0.7887 0.920 0.080 0.000
#> SRR1304053     1  0.0592     0.8078 0.988 0.012 0.000
#> SRR1304055     1  0.5138     0.6348 0.748 0.252 0.000
#> SRR1304054     2  0.3607     0.8359 0.112 0.880 0.008
#> SRR1304056     1  0.0747     0.8082 0.984 0.016 0.000
#> SRR1304059     1  0.0983     0.8085 0.980 0.016 0.004
#> SRR1304057     1  0.0424     0.8068 0.992 0.008 0.000
#> SRR1304058     2  0.0892     0.8526 0.020 0.980 0.000
#> SRR1304060     1  0.9016     0.4351 0.556 0.192 0.252
#> SRR1304061     1  0.3816     0.7465 0.852 0.148 0.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> SRR1303990     4  0.5219      0.526 0.000 0.056 0.216 0.728
#> SRR1303991     4  0.5219      0.526 0.000 0.056 0.216 0.728
#> SRR1303992     3  0.3505      0.825 0.108 0.012 0.864 0.016
#> SRR1303993     3  0.3505      0.825 0.108 0.012 0.864 0.016
#> SRR1303994     3  0.0000      0.959 0.000 0.000 1.000 0.000
#> SRR1303995     3  0.0000      0.959 0.000 0.000 1.000 0.000
#> SRR1303996     3  0.0000      0.959 0.000 0.000 1.000 0.000
#> SRR1303997     3  0.0000      0.959 0.000 0.000 1.000 0.000
#> SRR1303998     3  0.0000      0.959 0.000 0.000 1.000 0.000
#> SRR1303999     3  0.0000      0.959 0.000 0.000 1.000 0.000
#> SRR1304000     3  0.0000      0.959 0.000 0.000 1.000 0.000
#> SRR1304001     3  0.0000      0.959 0.000 0.000 1.000 0.000
#> SRR1304004     1  0.2996      0.792 0.892 0.064 0.000 0.044
#> SRR1304005     1  0.2996      0.792 0.892 0.064 0.000 0.044
#> SRR1304002     1  0.3392      0.773 0.872 0.056 0.072 0.000
#> SRR1304003     1  0.3392      0.773 0.872 0.056 0.072 0.000
#> SRR1304006     1  0.7813      0.398 0.536 0.124 0.300 0.040
#> SRR1304007     1  0.7845      0.379 0.528 0.124 0.308 0.040
#> SRR1304008     1  0.5530      0.647 0.712 0.076 0.000 0.212
#> SRR1304009     1  0.5530      0.647 0.712 0.076 0.000 0.212
#> SRR1304010     1  0.3149      0.783 0.880 0.088 0.000 0.032
#> SRR1304011     1  0.3149      0.783 0.880 0.088 0.000 0.032
#> SRR1304012     1  0.5392      0.660 0.724 0.072 0.000 0.204
#> SRR1304013     1  0.5392      0.660 0.724 0.072 0.000 0.204
#> SRR1304014     1  0.2021      0.788 0.932 0.056 0.012 0.000
#> SRR1304015     1  0.5392      0.660 0.724 0.072 0.000 0.204
#> SRR1304016     1  0.4932      0.677 0.728 0.032 0.000 0.240
#> SRR1304017     4  0.3548      0.590 0.056 0.056 0.012 0.876
#> SRR1304018     4  0.5247      0.435 0.188 0.048 0.012 0.752
#> SRR1304019     1  0.5392      0.660 0.724 0.072 0.000 0.204
#> SRR1304020     1  0.5392      0.660 0.724 0.072 0.000 0.204
#> SRR1304021     1  0.1297      0.796 0.964 0.016 0.000 0.020
#> SRR1304022     4  0.0000      0.646 0.000 0.000 0.000 1.000
#> SRR1304024     4  0.0469      0.649 0.012 0.000 0.000 0.988
#> SRR1304023     4  0.1109      0.641 0.000 0.004 0.028 0.968
#> SRR1304026     4  0.4661      0.434 0.000 0.348 0.000 0.652
#> SRR1304027     4  0.4661      0.434 0.000 0.348 0.000 0.652
#> SRR1304025     4  0.7598      0.172 0.268 0.112 0.044 0.576
#> SRR1304028     2  0.8408      0.546 0.112 0.424 0.072 0.392
#> SRR1304029     2  0.8408      0.546 0.112 0.424 0.072 0.392
#> SRR1304030     1  0.2392      0.797 0.928 0.024 0.012 0.036
#> SRR1304031     1  0.2392      0.797 0.928 0.024 0.012 0.036
#> SRR1304032     2  0.4175      0.630 0.012 0.776 0.000 0.212
#> SRR1304033     2  0.4175      0.630 0.012 0.776 0.000 0.212
#> SRR1304034     2  0.3969      0.657 0.016 0.804 0.000 0.180
#> SRR1304035     2  0.3969      0.657 0.016 0.804 0.000 0.180
#> SRR1304036     2  0.4083      0.644 0.068 0.832 0.000 0.100
#> SRR1304037     2  0.4083      0.644 0.068 0.832 0.000 0.100
#> SRR1304038     1  0.4242      0.772 0.836 0.108 0.020 0.036
#> SRR1304039     1  0.4447      0.769 0.828 0.108 0.028 0.036
#> SRR1304040     4  0.0469      0.649 0.012 0.000 0.000 0.988
#> SRR1304041     4  0.0469      0.649 0.012 0.000 0.000 0.988
#> SRR1304042     4  0.4661      0.434 0.000 0.348 0.000 0.652
#> SRR1304043     4  0.4661      0.434 0.000 0.348 0.000 0.652
#> SRR1304046     1  0.1792      0.789 0.932 0.068 0.000 0.000
#> SRR1304047     1  0.1792      0.789 0.932 0.068 0.000 0.000
#> SRR1304044     2  0.8410      0.542 0.112 0.420 0.072 0.396
#> SRR1304045     2  0.8410      0.542 0.112 0.420 0.072 0.396
#> SRR1304048     1  0.7450      0.566 0.616 0.172 0.040 0.172
#> SRR1304049     1  0.7450      0.566 0.616 0.172 0.040 0.172
#> SRR1304050     1  0.2021      0.788 0.932 0.056 0.012 0.000
#> SRR1304051     1  0.3211      0.790 0.892 0.056 0.012 0.040
#> SRR1304052     1  0.3453      0.783 0.868 0.080 0.000 0.052
#> SRR1304053     1  0.1362      0.798 0.964 0.004 0.012 0.020
#> SRR1304055     1  0.5646      0.562 0.708 0.204 0.000 0.088
#> SRR1304054     2  0.8187      0.521 0.112 0.520 0.072 0.296
#> SRR1304056     1  0.3377      0.774 0.848 0.140 0.012 0.000
#> SRR1304059     1  0.4125      0.773 0.832 0.128 0.024 0.016
#> SRR1304057     1  0.2867      0.780 0.884 0.104 0.012 0.000
#> SRR1304058     4  0.6585      0.416 0.188 0.180 0.000 0.632
#> SRR1304060     1  0.8576      0.149 0.420 0.132 0.376 0.072
#> SRR1304061     1  0.3732      0.753 0.852 0.092 0.000 0.056

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>            class entropy silhouette    p1    p2    p3    p4    p5
#> SRR1303990     4  0.4525      0.621 0.004 0.000 0.200 0.740 0.056
#> SRR1303991     4  0.4525      0.621 0.004 0.000 0.200 0.740 0.056
#> SRR1303992     3  0.2502      0.896 0.024 0.060 0.904 0.000 0.012
#> SRR1303993     3  0.2502      0.896 0.024 0.060 0.904 0.000 0.012
#> SRR1303994     3  0.0000      0.975 0.000 0.000 1.000 0.000 0.000
#> SRR1303995     3  0.0000      0.975 0.000 0.000 1.000 0.000 0.000
#> SRR1303996     3  0.0000      0.975 0.000 0.000 1.000 0.000 0.000
#> SRR1303997     3  0.0000      0.975 0.000 0.000 1.000 0.000 0.000
#> SRR1303998     3  0.0000      0.975 0.000 0.000 1.000 0.000 0.000
#> SRR1303999     3  0.0000      0.975 0.000 0.000 1.000 0.000 0.000
#> SRR1304000     3  0.0000      0.975 0.000 0.000 1.000 0.000 0.000
#> SRR1304001     3  0.0000      0.975 0.000 0.000 1.000 0.000 0.000
#> SRR1304004     1  0.4781      0.541 0.552 0.000 0.000 0.020 0.428
#> SRR1304005     1  0.4781      0.541 0.552 0.000 0.000 0.020 0.428
#> SRR1304002     1  0.6208      0.580 0.544 0.028 0.008 0.056 0.364
#> SRR1304003     1  0.6653      0.564 0.516 0.056 0.008 0.056 0.364
#> SRR1304006     1  0.6945      0.374 0.600 0.064 0.212 0.016 0.108
#> SRR1304007     1  0.7050      0.359 0.588 0.068 0.220 0.016 0.108
#> SRR1304008     5  0.1478      0.895 0.064 0.000 0.000 0.000 0.936
#> SRR1304009     5  0.1478      0.895 0.064 0.000 0.000 0.000 0.936
#> SRR1304010     1  0.2463      0.602 0.888 0.000 0.004 0.008 0.100
#> SRR1304011     1  0.2295      0.599 0.900 0.000 0.004 0.008 0.088
#> SRR1304012     5  0.2519      0.905 0.100 0.000 0.000 0.016 0.884
#> SRR1304013     5  0.2519      0.905 0.100 0.000 0.000 0.016 0.884
#> SRR1304014     1  0.5263      0.587 0.576 0.000 0.000 0.056 0.368
#> SRR1304015     5  0.3327      0.898 0.144 0.000 0.000 0.028 0.828
#> SRR1304016     1  0.4696      0.473 0.556 0.000 0.000 0.016 0.428
#> SRR1304017     4  0.6995      0.206 0.280 0.048 0.004 0.536 0.132
#> SRR1304018     1  0.7696      0.314 0.452 0.052 0.008 0.228 0.260
#> SRR1304019     5  0.3193      0.906 0.132 0.000 0.000 0.028 0.840
#> SRR1304020     5  0.1502      0.895 0.056 0.000 0.000 0.004 0.940
#> SRR1304021     1  0.4183      0.583 0.668 0.000 0.000 0.008 0.324
#> SRR1304022     4  0.3090      0.716 0.056 0.052 0.000 0.876 0.016
#> SRR1304024     4  0.3209      0.717 0.052 0.052 0.000 0.872 0.024
#> SRR1304023     4  0.3012      0.699 0.000 0.052 0.004 0.872 0.072
#> SRR1304026     4  0.4321      0.603 0.000 0.396 0.000 0.600 0.004
#> SRR1304027     4  0.4321      0.603 0.000 0.396 0.000 0.600 0.004
#> SRR1304025     1  0.4587      0.501 0.808 0.052 0.028 0.080 0.032
#> SRR1304028     2  0.6278      0.689 0.168 0.660 0.004 0.096 0.072
#> SRR1304029     2  0.6278      0.689 0.168 0.660 0.004 0.096 0.072
#> SRR1304030     1  0.4236      0.600 0.664 0.000 0.004 0.004 0.328
#> SRR1304031     1  0.4236      0.600 0.664 0.000 0.004 0.004 0.328
#> SRR1304032     2  0.1059      0.783 0.000 0.968 0.008 0.020 0.004
#> SRR1304033     2  0.1059      0.783 0.000 0.968 0.008 0.020 0.004
#> SRR1304034     2  0.0613      0.792 0.004 0.984 0.008 0.000 0.004
#> SRR1304035     2  0.0613      0.792 0.004 0.984 0.008 0.000 0.004
#> SRR1304036     2  0.1278      0.788 0.020 0.960 0.000 0.004 0.016
#> SRR1304037     2  0.1278      0.788 0.020 0.960 0.000 0.004 0.016
#> SRR1304038     1  0.1187      0.597 0.964 0.004 0.004 0.004 0.024
#> SRR1304039     1  0.1187      0.597 0.964 0.004 0.004 0.004 0.024
#> SRR1304040     4  0.3661      0.713 0.064 0.052 0.000 0.848 0.036
#> SRR1304041     4  0.3529      0.716 0.056 0.052 0.000 0.856 0.036
#> SRR1304042     4  0.4310      0.603 0.000 0.392 0.000 0.604 0.004
#> SRR1304043     4  0.4310      0.603 0.000 0.392 0.000 0.604 0.004
#> SRR1304046     1  0.5284      0.587 0.568 0.000 0.000 0.056 0.376
#> SRR1304047     1  0.5284      0.587 0.568 0.000 0.000 0.056 0.376
#> SRR1304044     2  0.6453      0.688 0.112 0.656 0.004 0.120 0.108
#> SRR1304045     2  0.6453      0.688 0.112 0.656 0.004 0.120 0.108
#> SRR1304048     1  0.2396      0.573 0.920 0.024 0.012 0.016 0.028
#> SRR1304049     1  0.1996      0.575 0.936 0.012 0.012 0.012 0.028
#> SRR1304050     1  0.5376      0.592 0.584 0.000 0.004 0.056 0.356
#> SRR1304051     1  0.3365      0.612 0.808 0.000 0.004 0.008 0.180
#> SRR1304052     1  0.2837      0.605 0.876 0.004 0.004 0.016 0.100
#> SRR1304053     1  0.4181      0.579 0.676 0.000 0.004 0.004 0.316
#> SRR1304055     1  0.7676      0.413 0.396 0.224 0.008 0.040 0.332
#> SRR1304054     2  0.2946      0.767 0.088 0.876 0.004 0.004 0.028
#> SRR1304056     1  0.5940      0.574 0.688 0.076 0.008 0.056 0.172
#> SRR1304059     1  0.7287      0.512 0.468 0.116 0.008 0.056 0.352
#> SRR1304057     1  0.4590      0.595 0.772 0.072 0.000 0.020 0.136
#> SRR1304058     4  0.5217      0.648 0.028 0.232 0.000 0.692 0.048
#> SRR1304060     1  0.7203      0.210 0.512 0.072 0.324 0.016 0.076
#> SRR1304061     1  0.7265      0.488 0.444 0.172 0.008 0.028 0.348

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>            class entropy silhouette    p1    p2    p3    p4    p5    p6
#> SRR1303990     4  0.3121     0.5491 0.004 0.000 0.192 0.796 0.000 0.008
#> SRR1303991     4  0.3121     0.5491 0.004 0.000 0.192 0.796 0.000 0.008
#> SRR1303992     3  0.2451     0.8958 0.016 0.044 0.904 0.000 0.016 0.020
#> SRR1303993     3  0.2358     0.9004 0.016 0.044 0.908 0.000 0.012 0.020
#> SRR1303994     3  0.0000     0.9729 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1303995     3  0.0000     0.9729 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1303996     3  0.0146     0.9722 0.000 0.000 0.996 0.000 0.000 0.004
#> SRR1303997     3  0.0146     0.9722 0.000 0.000 0.996 0.000 0.000 0.004
#> SRR1303998     3  0.0291     0.9697 0.004 0.000 0.992 0.004 0.000 0.000
#> SRR1303999     3  0.0291     0.9697 0.004 0.000 0.992 0.004 0.000 0.000
#> SRR1304000     3  0.0000     0.9729 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1304001     3  0.0000     0.9729 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1304004     5  0.4923     0.5961 0.368 0.000 0.000 0.000 0.560 0.072
#> SRR1304005     5  0.4932     0.5927 0.372 0.000 0.000 0.000 0.556 0.072
#> SRR1304002     5  0.4510     0.7910 0.408 0.012 0.016 0.000 0.564 0.000
#> SRR1304003     5  0.4662     0.7871 0.404 0.020 0.016 0.000 0.560 0.000
#> SRR1304006     1  0.6448     0.2560 0.540 0.044 0.224 0.000 0.184 0.008
#> SRR1304007     1  0.6552     0.2552 0.532 0.044 0.232 0.000 0.180 0.012
#> SRR1304008     6  0.4417     0.7216 0.028 0.000 0.000 0.000 0.416 0.556
#> SRR1304009     6  0.4417     0.7216 0.028 0.000 0.000 0.000 0.416 0.556
#> SRR1304010     1  0.2019     0.4475 0.900 0.000 0.000 0.000 0.012 0.088
#> SRR1304011     1  0.2121     0.4466 0.892 0.000 0.000 0.000 0.012 0.096
#> SRR1304012     6  0.4648     0.7597 0.056 0.000 0.000 0.000 0.340 0.604
#> SRR1304013     6  0.4648     0.7597 0.056 0.000 0.000 0.000 0.340 0.604
#> SRR1304014     5  0.4041     0.7941 0.408 0.004 0.000 0.000 0.584 0.004
#> SRR1304015     6  0.4360     0.7646 0.028 0.004 0.000 0.000 0.340 0.628
#> SRR1304016     1  0.5859    -0.3442 0.500 0.004 0.000 0.008 0.348 0.140
#> SRR1304017     4  0.6396     0.2473 0.336 0.012 0.000 0.496 0.116 0.040
#> SRR1304018     1  0.6759     0.0366 0.408 0.012 0.000 0.328 0.228 0.024
#> SRR1304019     6  0.4360     0.7646 0.028 0.004 0.000 0.000 0.340 0.628
#> SRR1304020     6  0.4950     0.7173 0.056 0.004 0.000 0.000 0.416 0.524
#> SRR1304021     1  0.5223    -0.2601 0.588 0.000 0.000 0.004 0.300 0.108
#> SRR1304022     4  0.4540     0.6620 0.016 0.012 0.000 0.668 0.016 0.288
#> SRR1304024     4  0.5676     0.6738 0.080 0.012 0.000 0.572 0.020 0.316
#> SRR1304023     4  0.1485     0.5980 0.024 0.004 0.000 0.944 0.000 0.028
#> SRR1304026     2  0.6774     0.1055 0.000 0.332 0.000 0.036 0.316 0.316
#> SRR1304027     2  0.6774     0.1055 0.000 0.332 0.000 0.036 0.316 0.316
#> SRR1304025     1  0.4433     0.4033 0.788 0.020 0.028 0.116 0.020 0.028
#> SRR1304028     2  0.6182     0.5117 0.072 0.644 0.000 0.160 0.048 0.076
#> SRR1304029     2  0.6182     0.5117 0.072 0.644 0.000 0.160 0.048 0.076
#> SRR1304030     1  0.4837    -0.4937 0.512 0.000 0.000 0.000 0.432 0.056
#> SRR1304031     1  0.4837    -0.4937 0.512 0.000 0.000 0.000 0.432 0.056
#> SRR1304032     2  0.0582     0.6313 0.000 0.984 0.004 0.004 0.004 0.004
#> SRR1304033     2  0.0582     0.6313 0.000 0.984 0.004 0.004 0.004 0.004
#> SRR1304034     2  0.0405     0.6330 0.000 0.988 0.004 0.008 0.000 0.000
#> SRR1304035     2  0.0405     0.6330 0.000 0.988 0.004 0.008 0.000 0.000
#> SRR1304036     2  0.2567     0.6074 0.004 0.876 0.000 0.008 0.100 0.012
#> SRR1304037     2  0.2567     0.6074 0.004 0.876 0.000 0.008 0.100 0.012
#> SRR1304038     1  0.2916     0.4513 0.860 0.000 0.024 0.000 0.020 0.096
#> SRR1304039     1  0.2994     0.4525 0.856 0.000 0.028 0.000 0.020 0.096
#> SRR1304040     4  0.5692     0.6755 0.084 0.012 0.000 0.576 0.020 0.308
#> SRR1304041     4  0.5692     0.6755 0.084 0.012 0.000 0.576 0.020 0.308
#> SRR1304042     2  0.6773     0.1053 0.000 0.332 0.000 0.036 0.324 0.308
#> SRR1304043     2  0.6773     0.1053 0.000 0.332 0.000 0.036 0.324 0.308
#> SRR1304046     5  0.4041     0.7941 0.408 0.004 0.000 0.000 0.584 0.004
#> SRR1304047     5  0.4144     0.7929 0.408 0.004 0.000 0.000 0.580 0.008
#> SRR1304044     2  0.6170     0.5114 0.072 0.644 0.000 0.160 0.044 0.080
#> SRR1304045     2  0.6170     0.5114 0.072 0.644 0.000 0.160 0.044 0.080
#> SRR1304048     1  0.2426     0.4475 0.912 0.012 0.028 0.020 0.016 0.012
#> SRR1304049     1  0.2338     0.4486 0.916 0.012 0.028 0.016 0.016 0.012
#> SRR1304050     5  0.4057     0.7797 0.436 0.000 0.000 0.000 0.556 0.008
#> SRR1304051     1  0.4094     0.1594 0.740 0.000 0.000 0.000 0.180 0.080
#> SRR1304052     1  0.1225     0.4484 0.952 0.000 0.000 0.000 0.012 0.036
#> SRR1304053     1  0.4728    -0.1174 0.652 0.000 0.000 0.000 0.256 0.092
#> SRR1304055     1  0.6489    -0.5564 0.400 0.172 0.004 0.016 0.400 0.008
#> SRR1304054     2  0.3516     0.6072 0.028 0.856 0.036 0.020 0.048 0.012
#> SRR1304056     1  0.4819     0.0245 0.636 0.052 0.004 0.000 0.300 0.008
#> SRR1304059     5  0.6150     0.6725 0.396 0.084 0.036 0.000 0.472 0.012
#> SRR1304057     1  0.4979     0.2039 0.700 0.044 0.020 0.000 0.208 0.028
#> SRR1304058     6  0.7608    -0.3664 0.024 0.128 0.000 0.148 0.300 0.400
#> SRR1304060     1  0.7314     0.2599 0.488 0.048 0.296 0.020 0.100 0.048
#> SRR1304061     5  0.5760     0.6403 0.404 0.116 0.004 0.008 0.468 0.000

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

consensus_heatmap(res, k = 2)

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

consensus_heatmap(res, k = 3)

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

consensus_heatmap(res, k = 4)

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

consensus_heatmap(res, k = 5)

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

consensus_heatmap(res, k = 6)

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

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

membership_heatmap(res, k = 2)

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

membership_heatmap(res, k = 3)

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

membership_heatmap(res, k = 4)

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

membership_heatmap(res, k = 5)

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

membership_heatmap(res, k = 6)

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

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

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

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

get_signatures(res, k = 3)

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

get_signatures(res, k = 4)

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

get_signatures(res, k = 5)

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

get_signatures(res, k = 6)

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

Signature heatmaps where rows are not scaled:

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

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

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

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

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

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

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

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

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

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

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk SD-mclust-signature_compare

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

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

An example of the output of tb is:

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

The columns in tb are:

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

UMAP plot which shows how samples are separated.

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

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

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

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

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

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

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

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

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

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

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk SD-mclust-collect-classes

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 15595 rows and 72 columns.
#>   Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'SD' method.
#>   Subgroups are detected by 'NMF' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 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.906           0.893       0.955         0.4894 0.507   0.507
#> 3 3 0.629           0.732       0.870         0.3355 0.737   0.528
#> 4 4 0.485           0.477       0.687         0.1186 0.846   0.625
#> 5 5 0.655           0.726       0.827         0.0742 0.816   0.486
#> 6 6 0.695           0.714       0.828         0.0323 0.940   0.741

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
#> SRR1303990     1  0.0000      0.948 1.000 0.000
#> SRR1303991     1  0.0000      0.948 1.000 0.000
#> SRR1303992     1  0.0000      0.948 1.000 0.000
#> SRR1303993     1  0.0000      0.948 1.000 0.000
#> SRR1303994     1  0.0000      0.948 1.000 0.000
#> SRR1303995     1  0.0000      0.948 1.000 0.000
#> SRR1303996     1  0.0000      0.948 1.000 0.000
#> SRR1303997     1  0.0000      0.948 1.000 0.000
#> SRR1303998     1  0.0000      0.948 1.000 0.000
#> SRR1303999     1  0.0000      0.948 1.000 0.000
#> SRR1304000     1  0.0000      0.948 1.000 0.000
#> SRR1304001     1  0.0000      0.948 1.000 0.000
#> SRR1304004     1  0.0000      0.948 1.000 0.000
#> SRR1304005     1  0.0000      0.948 1.000 0.000
#> SRR1304002     1  0.2948      0.925 0.948 0.052
#> SRR1304003     1  0.3431      0.918 0.936 0.064
#> SRR1304006     1  0.0000      0.948 1.000 0.000
#> SRR1304007     1  0.0000      0.948 1.000 0.000
#> SRR1304008     1  0.0000      0.948 1.000 0.000
#> SRR1304009     1  0.0000      0.948 1.000 0.000
#> SRR1304010     1  0.2236      0.934 0.964 0.036
#> SRR1304011     1  0.2423      0.932 0.960 0.040
#> SRR1304012     1  0.0000      0.948 1.000 0.000
#> SRR1304013     1  0.0000      0.948 1.000 0.000
#> SRR1304014     1  0.8081      0.698 0.752 0.248
#> SRR1304015     1  0.0000      0.948 1.000 0.000
#> SRR1304016     1  0.0376      0.947 0.996 0.004
#> SRR1304017     2  0.0000      0.951 0.000 1.000
#> SRR1304018     2  0.0000      0.951 0.000 1.000
#> SRR1304019     1  0.0000      0.948 1.000 0.000
#> SRR1304020     1  0.0000      0.948 1.000 0.000
#> SRR1304021     1  0.0000      0.948 1.000 0.000
#> SRR1304022     2  0.0000      0.951 0.000 1.000
#> SRR1304024     2  0.0000      0.951 0.000 1.000
#> SRR1304023     1  0.2948      0.920 0.948 0.052
#> SRR1304026     2  0.0000      0.951 0.000 1.000
#> SRR1304027     2  0.0000      0.951 0.000 1.000
#> SRR1304025     2  0.0000      0.951 0.000 1.000
#> SRR1304028     2  0.0000      0.951 0.000 1.000
#> SRR1304029     2  0.0000      0.951 0.000 1.000
#> SRR1304030     1  0.4562      0.892 0.904 0.096
#> SRR1304031     1  0.4022      0.906 0.920 0.080
#> SRR1304032     2  0.0000      0.951 0.000 1.000
#> SRR1304033     2  0.0000      0.951 0.000 1.000
#> SRR1304034     2  0.0000      0.951 0.000 1.000
#> SRR1304035     2  0.0000      0.951 0.000 1.000
#> SRR1304036     2  0.0000      0.951 0.000 1.000
#> SRR1304037     2  0.0000      0.951 0.000 1.000
#> SRR1304038     2  0.9635      0.326 0.388 0.612
#> SRR1304039     2  0.9775      0.257 0.412 0.588
#> SRR1304040     2  0.0000      0.951 0.000 1.000
#> SRR1304041     2  0.0000      0.951 0.000 1.000
#> SRR1304042     2  0.0000      0.951 0.000 1.000
#> SRR1304043     2  0.0000      0.951 0.000 1.000
#> SRR1304046     1  0.4161      0.903 0.916 0.084
#> SRR1304047     1  0.4161      0.904 0.916 0.084
#> SRR1304044     2  0.0000      0.951 0.000 1.000
#> SRR1304045     2  0.0000      0.951 0.000 1.000
#> SRR1304048     2  0.0000      0.951 0.000 1.000
#> SRR1304049     2  0.0000      0.951 0.000 1.000
#> SRR1304050     1  0.4022      0.906 0.920 0.080
#> SRR1304051     1  0.3114      0.923 0.944 0.056
#> SRR1304052     2  0.9815      0.231 0.420 0.580
#> SRR1304053     1  0.0672      0.946 0.992 0.008
#> SRR1304055     2  0.0000      0.951 0.000 1.000
#> SRR1304054     2  0.0000      0.951 0.000 1.000
#> SRR1304056     1  0.8813      0.605 0.700 0.300
#> SRR1304059     1  0.9963      0.165 0.536 0.464
#> SRR1304057     1  0.8267      0.678 0.740 0.260
#> SRR1304058     2  0.0000      0.951 0.000 1.000
#> SRR1304060     1  0.0000      0.948 1.000 0.000
#> SRR1304061     2  0.2778      0.906 0.048 0.952

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>            class entropy silhouette    p1    p2    p3
#> SRR1303990     1  0.5254     0.6549 0.736 0.000 0.264
#> SRR1303991     1  0.5327     0.6462 0.728 0.000 0.272
#> SRR1303992     3  0.0747     0.8405 0.016 0.000 0.984
#> SRR1303993     3  0.0747     0.8405 0.016 0.000 0.984
#> SRR1303994     3  0.0747     0.8405 0.016 0.000 0.984
#> SRR1303995     3  0.0747     0.8405 0.016 0.000 0.984
#> SRR1303996     3  0.0747     0.8405 0.016 0.000 0.984
#> SRR1303997     3  0.0747     0.8405 0.016 0.000 0.984
#> SRR1303998     3  0.0747     0.8405 0.016 0.000 0.984
#> SRR1303999     3  0.0747     0.8405 0.016 0.000 0.984
#> SRR1304000     3  0.0747     0.8405 0.016 0.000 0.984
#> SRR1304001     3  0.0747     0.8405 0.016 0.000 0.984
#> SRR1304004     3  0.0892     0.8338 0.020 0.000 0.980
#> SRR1304005     3  0.0424     0.8382 0.008 0.000 0.992
#> SRR1304002     3  0.0661     0.8403 0.004 0.008 0.988
#> SRR1304003     3  0.0424     0.8396 0.000 0.008 0.992
#> SRR1304006     3  0.0237     0.8392 0.004 0.000 0.996
#> SRR1304007     3  0.0000     0.8397 0.000 0.000 1.000
#> SRR1304008     3  0.4887     0.5912 0.228 0.000 0.772
#> SRR1304009     3  0.4178     0.6878 0.172 0.000 0.828
#> SRR1304010     1  0.6548     0.3388 0.616 0.012 0.372
#> SRR1304011     1  0.6819     0.0341 0.512 0.012 0.476
#> SRR1304012     1  0.1860     0.7855 0.948 0.000 0.052
#> SRR1304013     1  0.2448     0.7820 0.924 0.000 0.076
#> SRR1304014     3  0.7613     0.5111 0.116 0.204 0.680
#> SRR1304015     1  0.1529     0.7784 0.960 0.000 0.040
#> SRR1304016     1  0.4172     0.7464 0.840 0.004 0.156
#> SRR1304017     1  0.1031     0.7545 0.976 0.024 0.000
#> SRR1304018     1  0.2165     0.7272 0.936 0.064 0.000
#> SRR1304019     1  0.1643     0.7836 0.956 0.000 0.044
#> SRR1304020     1  0.4974     0.6906 0.764 0.000 0.236
#> SRR1304021     1  0.2400     0.7844 0.932 0.004 0.064
#> SRR1304022     1  0.1753     0.7436 0.952 0.048 0.000
#> SRR1304024     2  0.6180     0.4827 0.416 0.584 0.000
#> SRR1304023     1  0.0424     0.7633 0.992 0.008 0.000
#> SRR1304026     2  0.0000     0.8935 0.000 1.000 0.000
#> SRR1304027     2  0.0000     0.8935 0.000 1.000 0.000
#> SRR1304025     2  0.5650     0.6707 0.312 0.688 0.000
#> SRR1304028     2  0.1411     0.8844 0.036 0.964 0.000
#> SRR1304029     2  0.1411     0.8844 0.036 0.964 0.000
#> SRR1304030     3  0.2793     0.8144 0.044 0.028 0.928
#> SRR1304031     3  0.2527     0.8178 0.044 0.020 0.936
#> SRR1304032     2  0.0237     0.8940 0.004 0.996 0.000
#> SRR1304033     2  0.0237     0.8940 0.004 0.996 0.000
#> SRR1304034     2  0.0237     0.8940 0.004 0.996 0.000
#> SRR1304035     2  0.0237     0.8940 0.004 0.996 0.000
#> SRR1304036     2  0.0661     0.8902 0.008 0.988 0.004
#> SRR1304037     2  0.0661     0.8902 0.008 0.988 0.004
#> SRR1304038     3  0.9773    -0.0454 0.372 0.232 0.396
#> SRR1304039     3  0.9496     0.0271 0.372 0.188 0.440
#> SRR1304040     2  0.4974     0.7638 0.236 0.764 0.000
#> SRR1304041     2  0.4842     0.7756 0.224 0.776 0.000
#> SRR1304042     2  0.0424     0.8917 0.008 0.992 0.000
#> SRR1304043     2  0.0424     0.8917 0.008 0.992 0.000
#> SRR1304046     1  0.6822     0.2878 0.508 0.012 0.480
#> SRR1304047     1  0.6822     0.2878 0.508 0.012 0.480
#> SRR1304044     2  0.4291     0.8119 0.180 0.820 0.000
#> SRR1304045     2  0.4121     0.8198 0.168 0.832 0.000
#> SRR1304048     2  0.5335     0.7661 0.232 0.760 0.008
#> SRR1304049     2  0.5292     0.7701 0.228 0.764 0.008
#> SRR1304050     3  0.1015     0.8388 0.012 0.008 0.980
#> SRR1304051     3  0.2772     0.7968 0.080 0.004 0.916
#> SRR1304052     3  0.9284     0.2669 0.192 0.296 0.512
#> SRR1304053     3  0.3412     0.7534 0.124 0.000 0.876
#> SRR1304055     2  0.0424     0.8917 0.008 0.992 0.000
#> SRR1304054     2  0.0237     0.8940 0.004 0.996 0.000
#> SRR1304056     3  0.5623     0.5924 0.004 0.280 0.716
#> SRR1304059     3  0.6209     0.4731 0.004 0.368 0.628
#> SRR1304057     3  0.4682     0.6939 0.004 0.192 0.804
#> SRR1304058     2  0.0424     0.8917 0.008 0.992 0.000
#> SRR1304060     3  0.0237     0.8392 0.004 0.000 0.996
#> SRR1304061     2  0.3454     0.7993 0.008 0.888 0.104

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> SRR1303990     4  0.4605    0.75194 0.092 0.000 0.108 0.800
#> SRR1303991     4  0.4605    0.75194 0.092 0.000 0.108 0.800
#> SRR1303992     1  0.5600    0.48909 0.512 0.000 0.468 0.020
#> SRR1303993     1  0.5600    0.48909 0.512 0.000 0.468 0.020
#> SRR1303994     1  0.5399    0.49104 0.520 0.000 0.468 0.012
#> SRR1303995     1  0.5399    0.49104 0.520 0.000 0.468 0.012
#> SRR1303996     1  0.5399    0.49104 0.520 0.000 0.468 0.012
#> SRR1303997     1  0.5399    0.49104 0.520 0.000 0.468 0.012
#> SRR1303998     1  0.5399    0.49104 0.520 0.000 0.468 0.012
#> SRR1303999     1  0.5399    0.49104 0.520 0.000 0.468 0.012
#> SRR1304000     1  0.5399    0.49104 0.520 0.000 0.468 0.012
#> SRR1304001     1  0.5399    0.49104 0.520 0.000 0.468 0.012
#> SRR1304004     1  0.1209    0.57089 0.964 0.000 0.004 0.032
#> SRR1304005     1  0.0779    0.57448 0.980 0.000 0.004 0.016
#> SRR1304002     1  0.5294    0.44922 0.508 0.000 0.484 0.008
#> SRR1304003     1  0.5320    0.49119 0.572 0.000 0.416 0.012
#> SRR1304006     1  0.1637    0.57772 0.940 0.000 0.060 0.000
#> SRR1304007     1  0.2081    0.58121 0.916 0.000 0.084 0.000
#> SRR1304008     1  0.3266    0.51810 0.876 0.000 0.084 0.040
#> SRR1304009     1  0.2494    0.54965 0.916 0.000 0.048 0.036
#> SRR1304010     3  0.7851    0.34054 0.280 0.000 0.396 0.324
#> SRR1304011     3  0.7785    0.35652 0.352 0.008 0.452 0.188
#> SRR1304012     4  0.3105    0.79847 0.120 0.000 0.012 0.868
#> SRR1304013     4  0.2859    0.80130 0.112 0.000 0.008 0.880
#> SRR1304014     1  0.5872    0.13682 0.604 0.004 0.356 0.036
#> SRR1304015     1  0.7031   -0.03255 0.520 0.000 0.132 0.348
#> SRR1304016     1  0.7345   -0.15248 0.516 0.008 0.340 0.136
#> SRR1304017     4  0.3082    0.75735 0.000 0.084 0.032 0.884
#> SRR1304018     4  0.4540    0.61367 0.000 0.196 0.032 0.772
#> SRR1304019     4  0.3636    0.76189 0.172 0.000 0.008 0.820
#> SRR1304020     4  0.4632    0.60539 0.308 0.000 0.004 0.688
#> SRR1304021     3  0.7904    0.26617 0.300 0.000 0.360 0.340
#> SRR1304022     4  0.2845    0.77127 0.000 0.076 0.028 0.896
#> SRR1304024     2  0.7494   -0.15818 0.000 0.460 0.352 0.188
#> SRR1304023     4  0.2644    0.78644 0.000 0.060 0.032 0.908
#> SRR1304026     2  0.0336    0.71046 0.000 0.992 0.008 0.000
#> SRR1304027     2  0.0336    0.71046 0.000 0.992 0.008 0.000
#> SRR1304025     3  0.7018    0.15838 0.008 0.408 0.492 0.092
#> SRR1304028     2  0.3264    0.65143 0.096 0.876 0.004 0.024
#> SRR1304029     2  0.3200    0.65503 0.092 0.880 0.004 0.024
#> SRR1304030     1  0.4107    0.47378 0.804 0.176 0.004 0.016
#> SRR1304031     1  0.3972    0.48483 0.816 0.164 0.004 0.016
#> SRR1304032     2  0.0672    0.71027 0.000 0.984 0.008 0.008
#> SRR1304033     2  0.0672    0.71027 0.000 0.984 0.008 0.008
#> SRR1304034     2  0.0779    0.70699 0.000 0.980 0.004 0.016
#> SRR1304035     2  0.0779    0.70699 0.000 0.980 0.004 0.016
#> SRR1304036     2  0.5063    0.58091 0.144 0.784 0.020 0.052
#> SRR1304037     2  0.4837    0.58614 0.144 0.792 0.012 0.052
#> SRR1304038     3  0.5509    0.47350 0.012 0.108 0.756 0.124
#> SRR1304039     3  0.5395    0.47335 0.012 0.100 0.764 0.124
#> SRR1304040     2  0.6655   -0.16878 0.000 0.476 0.440 0.084
#> SRR1304041     2  0.6659   -0.18469 0.000 0.468 0.448 0.084
#> SRR1304042     2  0.5721    0.49877 0.000 0.660 0.284 0.056
#> SRR1304043     2  0.5721    0.49877 0.000 0.660 0.284 0.056
#> SRR1304046     1  0.5784   -0.00564 0.556 0.000 0.412 0.032
#> SRR1304047     1  0.5775    0.00636 0.560 0.000 0.408 0.032
#> SRR1304044     2  0.4443    0.60016 0.012 0.820 0.120 0.048
#> SRR1304045     2  0.4304    0.60996 0.012 0.828 0.116 0.044
#> SRR1304048     3  0.7575    0.17698 0.048 0.432 0.452 0.068
#> SRR1304049     3  0.7698    0.20551 0.060 0.420 0.456 0.064
#> SRR1304050     1  0.3757    0.55228 0.828 0.000 0.152 0.020
#> SRR1304051     1  0.2210    0.56502 0.936 0.020 0.016 0.028
#> SRR1304052     1  0.7220    0.24661 0.644 0.180 0.128 0.048
#> SRR1304053     1  0.2170    0.56316 0.936 0.008 0.028 0.028
#> SRR1304055     2  0.5219    0.58364 0.000 0.728 0.216 0.056
#> SRR1304054     2  0.4608    0.65999 0.064 0.824 0.088 0.024
#> SRR1304056     1  0.4709    0.50870 0.824 0.052 0.080 0.044
#> SRR1304059     1  0.5799    0.41108 0.728 0.048 0.192 0.032
#> SRR1304057     1  0.2055    0.56901 0.936 0.048 0.008 0.008
#> SRR1304058     2  0.4996    0.60399 0.000 0.752 0.192 0.056
#> SRR1304060     1  0.3610    0.55732 0.800 0.000 0.200 0.000
#> SRR1304061     1  0.8275    0.08460 0.512 0.272 0.164 0.052

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>            class entropy silhouette    p1    p2    p3    p4    p5
#> SRR1303990     5  0.3400     0.7543 0.036 0.000 0.136 0.000 0.828
#> SRR1303991     5  0.3355     0.7559 0.036 0.000 0.132 0.000 0.832
#> SRR1303992     3  0.1341     0.9451 0.056 0.000 0.944 0.000 0.000
#> SRR1303993     3  0.1341     0.9451 0.056 0.000 0.944 0.000 0.000
#> SRR1303994     3  0.1341     0.9451 0.056 0.000 0.944 0.000 0.000
#> SRR1303995     3  0.1341     0.9451 0.056 0.000 0.944 0.000 0.000
#> SRR1303996     3  0.1341     0.9451 0.056 0.000 0.944 0.000 0.000
#> SRR1303997     3  0.1341     0.9451 0.056 0.000 0.944 0.000 0.000
#> SRR1303998     3  0.1341     0.9451 0.056 0.000 0.944 0.000 0.000
#> SRR1303999     3  0.1341     0.9451 0.056 0.000 0.944 0.000 0.000
#> SRR1304000     3  0.1341     0.9451 0.056 0.000 0.944 0.000 0.000
#> SRR1304001     3  0.1341     0.9451 0.056 0.000 0.944 0.000 0.000
#> SRR1304004     1  0.1331     0.8151 0.952 0.000 0.040 0.000 0.008
#> SRR1304005     1  0.1331     0.8151 0.952 0.000 0.040 0.000 0.008
#> SRR1304002     4  0.7030     0.0420 0.132 0.000 0.372 0.452 0.044
#> SRR1304003     3  0.7097     0.1292 0.132 0.004 0.464 0.360 0.040
#> SRR1304006     1  0.4300     0.7549 0.772 0.000 0.132 0.096 0.000
#> SRR1304007     1  0.4434     0.6979 0.736 0.000 0.208 0.056 0.000
#> SRR1304008     1  0.1914     0.8193 0.932 0.000 0.032 0.032 0.004
#> SRR1304009     1  0.1828     0.8196 0.936 0.000 0.032 0.028 0.004
#> SRR1304010     4  0.4430     0.6534 0.096 0.000 0.024 0.792 0.088
#> SRR1304011     4  0.4368     0.6593 0.116 0.000 0.032 0.796 0.056
#> SRR1304012     5  0.3482     0.7723 0.104 0.000 0.040 0.012 0.844
#> SRR1304013     5  0.3372     0.7762 0.088 0.000 0.052 0.008 0.852
#> SRR1304014     1  0.5088     0.6989 0.728 0.004 0.020 0.184 0.064
#> SRR1304015     1  0.2171     0.8225 0.924 0.004 0.020 0.044 0.008
#> SRR1304016     1  0.2068     0.7947 0.904 0.000 0.000 0.092 0.004
#> SRR1304017     5  0.5500     0.6324 0.012 0.160 0.000 0.144 0.684
#> SRR1304018     5  0.5716     0.5990 0.008 0.172 0.000 0.168 0.652
#> SRR1304019     5  0.3642     0.6925 0.232 0.000 0.008 0.000 0.760
#> SRR1304020     5  0.4960     0.3883 0.388 0.000 0.020 0.008 0.584
#> SRR1304021     4  0.5434     0.5398 0.156 0.000 0.008 0.684 0.152
#> SRR1304022     5  0.4111     0.7016 0.000 0.092 0.000 0.120 0.788
#> SRR1304024     4  0.4075     0.6383 0.000 0.160 0.000 0.780 0.060
#> SRR1304023     5  0.2817     0.7636 0.008 0.036 0.028 0.028 0.900
#> SRR1304026     2  0.1251     0.8683 0.000 0.956 0.000 0.036 0.008
#> SRR1304027     2  0.1251     0.8683 0.000 0.956 0.000 0.036 0.008
#> SRR1304025     4  0.0898     0.7243 0.000 0.020 0.000 0.972 0.008
#> SRR1304028     2  0.2026     0.8699 0.056 0.924 0.000 0.012 0.008
#> SRR1304029     2  0.2026     0.8699 0.056 0.924 0.000 0.012 0.008
#> SRR1304030     1  0.2170     0.7981 0.904 0.088 0.004 0.000 0.004
#> SRR1304031     1  0.2228     0.7959 0.900 0.092 0.004 0.000 0.004
#> SRR1304032     2  0.0671     0.8783 0.000 0.980 0.000 0.016 0.004
#> SRR1304033     2  0.0671     0.8783 0.000 0.980 0.000 0.016 0.004
#> SRR1304034     2  0.0865     0.8822 0.024 0.972 0.000 0.000 0.004
#> SRR1304035     2  0.0865     0.8822 0.024 0.972 0.000 0.000 0.004
#> SRR1304036     2  0.3788     0.7782 0.088 0.836 0.008 0.008 0.060
#> SRR1304037     2  0.3898     0.7791 0.096 0.828 0.008 0.008 0.060
#> SRR1304038     4  0.1740     0.7189 0.000 0.000 0.056 0.932 0.012
#> SRR1304039     4  0.1956     0.7143 0.000 0.000 0.076 0.916 0.008
#> SRR1304040     4  0.1608     0.7216 0.000 0.072 0.000 0.928 0.000
#> SRR1304041     4  0.1544     0.7225 0.000 0.068 0.000 0.932 0.000
#> SRR1304042     4  0.6684     0.4719 0.016 0.272 0.052 0.588 0.072
#> SRR1304043     4  0.6794     0.4669 0.016 0.272 0.056 0.580 0.076
#> SRR1304046     1  0.4237     0.7362 0.784 0.000 0.020 0.160 0.036
#> SRR1304047     1  0.4148     0.7452 0.796 0.000 0.020 0.144 0.040
#> SRR1304044     2  0.4415     0.7034 0.044 0.760 0.000 0.184 0.012
#> SRR1304045     2  0.4234     0.7232 0.040 0.776 0.000 0.172 0.012
#> SRR1304048     4  0.2209     0.7231 0.056 0.032 0.000 0.912 0.000
#> SRR1304049     4  0.2362     0.7173 0.076 0.024 0.000 0.900 0.000
#> SRR1304050     1  0.6015     0.5934 0.648 0.004 0.084 0.228 0.036
#> SRR1304051     1  0.1347     0.8213 0.960 0.008 0.020 0.008 0.004
#> SRR1304052     1  0.3360     0.7880 0.856 0.080 0.004 0.056 0.004
#> SRR1304053     1  0.1966     0.8216 0.936 0.016 0.028 0.016 0.004
#> SRR1304055     4  0.7041     0.3970 0.020 0.312 0.056 0.536 0.076
#> SRR1304054     1  0.6150     0.0989 0.476 0.436 0.000 0.040 0.048
#> SRR1304056     1  0.1612     0.8225 0.948 0.016 0.024 0.000 0.012
#> SRR1304059     1  0.3771     0.7967 0.836 0.024 0.052 0.088 0.000
#> SRR1304057     1  0.2679     0.8103 0.892 0.056 0.048 0.000 0.004
#> SRR1304058     4  0.6962     0.3695 0.016 0.332 0.052 0.524 0.076
#> SRR1304060     1  0.3949     0.5146 0.668 0.000 0.332 0.000 0.000
#> SRR1304061     1  0.7771     0.4428 0.560 0.172 0.056 0.144 0.068

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>            class entropy silhouette    p1    p2    p3    p4    p5    p6
#> SRR1303990     5  0.3099     0.8373 0.084 0.000 0.008 0.000 0.848 0.060
#> SRR1303991     5  0.3099     0.8373 0.084 0.000 0.008 0.000 0.848 0.060
#> SRR1303992     3  0.0000     0.9115 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1303993     3  0.0000     0.9115 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1303994     3  0.0000     0.9115 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1303995     3  0.0000     0.9115 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1303996     3  0.0000     0.9115 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1303997     3  0.0000     0.9115 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1303998     3  0.0000     0.9115 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1303999     3  0.0000     0.9115 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1304000     3  0.0000     0.9115 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1304001     3  0.0000     0.9115 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1304004     1  0.1285     0.7894 0.944 0.000 0.004 0.000 0.052 0.000
#> SRR1304005     1  0.1219     0.7913 0.948 0.000 0.004 0.000 0.048 0.000
#> SRR1304002     3  0.6410     0.2566 0.108 0.000 0.508 0.304 0.000 0.080
#> SRR1304003     3  0.6283     0.4309 0.112 0.000 0.580 0.196 0.000 0.112
#> SRR1304006     1  0.4059     0.7010 0.768 0.000 0.172 0.032 0.004 0.024
#> SRR1304007     1  0.4253     0.5720 0.668 0.000 0.300 0.012 0.000 0.020
#> SRR1304008     1  0.0858     0.7961 0.968 0.000 0.004 0.000 0.028 0.000
#> SRR1304009     1  0.0777     0.7975 0.972 0.000 0.004 0.000 0.024 0.000
#> SRR1304010     4  0.2737     0.8331 0.096 0.000 0.000 0.868 0.012 0.024
#> SRR1304011     4  0.2526     0.8358 0.096 0.000 0.000 0.876 0.004 0.024
#> SRR1304012     5  0.2558     0.8545 0.156 0.000 0.004 0.000 0.840 0.000
#> SRR1304013     5  0.2520     0.8540 0.152 0.000 0.000 0.004 0.844 0.000
#> SRR1304014     1  0.3657     0.7010 0.792 0.000 0.000 0.000 0.108 0.100
#> SRR1304015     1  0.1003     0.8076 0.964 0.028 0.004 0.004 0.000 0.000
#> SRR1304016     1  0.0000     0.8035 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR1304017     2  0.6319     0.4420 0.000 0.528 0.000 0.192 0.236 0.044
#> SRR1304018     2  0.6332     0.4447 0.000 0.528 0.000 0.212 0.216 0.044
#> SRR1304019     5  0.3302     0.8067 0.232 0.000 0.004 0.004 0.760 0.000
#> SRR1304020     5  0.4399     0.7345 0.252 0.000 0.004 0.000 0.688 0.056
#> SRR1304021     4  0.3900     0.6302 0.248 0.000 0.000 0.724 0.016 0.012
#> SRR1304022     2  0.6554     0.2160 0.000 0.400 0.000 0.172 0.384 0.044
#> SRR1304024     4  0.3667     0.6598 0.000 0.160 0.000 0.788 0.008 0.044
#> SRR1304023     5  0.2815     0.6637 0.000 0.056 0.000 0.024 0.876 0.044
#> SRR1304026     2  0.4091     0.5694 0.000 0.720 0.000 0.056 0.000 0.224
#> SRR1304027     2  0.4085     0.5630 0.000 0.716 0.000 0.052 0.000 0.232
#> SRR1304025     4  0.0777     0.8471 0.024 0.000 0.000 0.972 0.000 0.004
#> SRR1304028     2  0.1007     0.6591 0.044 0.956 0.000 0.000 0.000 0.000
#> SRR1304029     2  0.1075     0.6581 0.048 0.952 0.000 0.000 0.000 0.000
#> SRR1304030     1  0.3221     0.7193 0.772 0.220 0.004 0.000 0.000 0.004
#> SRR1304031     1  0.3276     0.7099 0.764 0.228 0.004 0.000 0.000 0.004
#> SRR1304032     2  0.2513     0.6298 0.000 0.852 0.000 0.008 0.000 0.140
#> SRR1304033     2  0.2513     0.6298 0.000 0.852 0.000 0.008 0.000 0.140
#> SRR1304034     2  0.1765     0.6530 0.024 0.924 0.000 0.000 0.000 0.052
#> SRR1304035     2  0.1829     0.6523 0.024 0.920 0.000 0.000 0.000 0.056
#> SRR1304036     2  0.6007     0.0288 0.252 0.424 0.000 0.000 0.000 0.324
#> SRR1304037     2  0.6007     0.0288 0.252 0.424 0.000 0.000 0.000 0.324
#> SRR1304038     4  0.2376     0.8011 0.012 0.000 0.096 0.884 0.000 0.008
#> SRR1304039     4  0.3264     0.7038 0.012 0.000 0.184 0.796 0.000 0.008
#> SRR1304040     4  0.0622     0.8353 0.000 0.008 0.000 0.980 0.000 0.012
#> SRR1304041     4  0.0508     0.8360 0.000 0.004 0.000 0.984 0.000 0.012
#> SRR1304042     6  0.2527     0.8660 0.000 0.000 0.000 0.168 0.000 0.832
#> SRR1304043     6  0.2416     0.8722 0.000 0.000 0.000 0.156 0.000 0.844
#> SRR1304046     1  0.3613     0.7113 0.804 0.000 0.000 0.004 0.096 0.096
#> SRR1304047     1  0.3612     0.7117 0.804 0.000 0.000 0.004 0.100 0.092
#> SRR1304044     2  0.4481     0.5890 0.156 0.720 0.000 0.120 0.000 0.004
#> SRR1304045     2  0.4371     0.5941 0.148 0.732 0.000 0.116 0.000 0.004
#> SRR1304048     4  0.1387     0.8527 0.068 0.000 0.000 0.932 0.000 0.000
#> SRR1304049     4  0.1387     0.8527 0.068 0.000 0.000 0.932 0.000 0.000
#> SRR1304050     1  0.5379     0.6107 0.704 0.000 0.056 0.028 0.152 0.060
#> SRR1304051     1  0.1806     0.8024 0.908 0.088 0.004 0.000 0.000 0.000
#> SRR1304052     1  0.2553     0.7796 0.848 0.144 0.000 0.008 0.000 0.000
#> SRR1304053     1  0.1908     0.8005 0.900 0.096 0.004 0.000 0.000 0.000
#> SRR1304055     6  0.2212     0.8607 0.000 0.008 0.000 0.112 0.000 0.880
#> SRR1304054     1  0.4603     0.5704 0.644 0.288 0.000 0.000 0.000 0.068
#> SRR1304056     1  0.1888     0.8088 0.916 0.068 0.004 0.000 0.000 0.012
#> SRR1304059     1  0.3264     0.8006 0.856 0.072 0.024 0.012 0.000 0.036
#> SRR1304057     1  0.3121     0.7545 0.804 0.180 0.004 0.000 0.000 0.012
#> SRR1304058     6  0.2988     0.8646 0.000 0.028 0.000 0.144 0.000 0.828
#> SRR1304060     1  0.4116     0.3545 0.572 0.012 0.416 0.000 0.000 0.000
#> SRR1304061     6  0.3298     0.5855 0.236 0.008 0.000 0.000 0.000 0.756

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 15595 rows and 72 columns.
#>   Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'CV' method.
#>   Subgroups are detected by 'hclust' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 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.497           0.909       0.914         0.4140 0.559   0.559
#> 3 3 0.565           0.806       0.831         0.2035 1.000   1.000
#> 4 4 0.604           0.735       0.885         0.1358 0.819   0.703
#> 5 5 0.756           0.797       0.907         0.0792 0.913   0.822
#> 6 6 0.617           0.752       0.847         0.0744 0.998   0.994

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
#> SRR1303990     1  0.0000      0.947 1.000 0.000
#> SRR1303991     1  0.0000      0.947 1.000 0.000
#> SRR1303992     1  0.0000      0.947 1.000 0.000
#> SRR1303993     1  0.0000      0.947 1.000 0.000
#> SRR1303994     1  0.0000      0.947 1.000 0.000
#> SRR1303995     1  0.0000      0.947 1.000 0.000
#> SRR1303996     1  0.0000      0.947 1.000 0.000
#> SRR1303997     1  0.0000      0.947 1.000 0.000
#> SRR1303998     1  0.0000      0.947 1.000 0.000
#> SRR1303999     1  0.0000      0.947 1.000 0.000
#> SRR1304000     1  0.0000      0.947 1.000 0.000
#> SRR1304001     1  0.0000      0.947 1.000 0.000
#> SRR1304004     1  0.9044      0.445 0.680 0.320
#> SRR1304005     1  0.9044      0.445 0.680 0.320
#> SRR1304002     2  0.6887      0.918 0.184 0.816
#> SRR1304003     2  0.6887      0.918 0.184 0.816
#> SRR1304006     2  0.6048      0.938 0.148 0.852
#> SRR1304007     2  0.6048      0.938 0.148 0.852
#> SRR1304008     1  0.0000      0.947 1.000 0.000
#> SRR1304009     1  0.0000      0.947 1.000 0.000
#> SRR1304010     2  0.6531      0.930 0.168 0.832
#> SRR1304011     2  0.6531      0.930 0.168 0.832
#> SRR1304012     1  0.0000      0.947 1.000 0.000
#> SRR1304013     1  0.0000      0.947 1.000 0.000
#> SRR1304014     1  0.9044      0.445 0.680 0.320
#> SRR1304015     1  0.0376      0.943 0.996 0.004
#> SRR1304016     2  0.6048      0.938 0.148 0.852
#> SRR1304017     2  0.6048      0.942 0.148 0.852
#> SRR1304018     2  0.6438      0.933 0.164 0.836
#> SRR1304019     1  0.0000      0.947 1.000 0.000
#> SRR1304020     1  0.0000      0.947 1.000 0.000
#> SRR1304021     2  0.7376      0.893 0.208 0.792
#> SRR1304022     2  0.5946      0.942 0.144 0.856
#> SRR1304024     2  0.5946      0.942 0.144 0.856
#> SRR1304023     1  0.0000      0.947 1.000 0.000
#> SRR1304026     2  0.0000      0.870 0.000 1.000
#> SRR1304027     2  0.0000      0.870 0.000 1.000
#> SRR1304025     2  0.5842      0.943 0.140 0.860
#> SRR1304028     2  0.6048      0.942 0.148 0.852
#> SRR1304029     2  0.6048      0.942 0.148 0.852
#> SRR1304030     2  0.6048      0.938 0.148 0.852
#> SRR1304031     2  0.6048      0.938 0.148 0.852
#> SRR1304032     2  0.0000      0.870 0.000 1.000
#> SRR1304033     2  0.0000      0.870 0.000 1.000
#> SRR1304034     2  0.0000      0.870 0.000 1.000
#> SRR1304035     2  0.0000      0.870 0.000 1.000
#> SRR1304036     2  0.0000      0.870 0.000 1.000
#> SRR1304037     2  0.0000      0.870 0.000 1.000
#> SRR1304038     2  0.5842      0.943 0.140 0.860
#> SRR1304039     2  0.5842      0.943 0.140 0.860
#> SRR1304040     2  0.5519      0.942 0.128 0.872
#> SRR1304041     2  0.5519      0.942 0.128 0.872
#> SRR1304042     2  0.0000      0.870 0.000 1.000
#> SRR1304043     2  0.0000      0.870 0.000 1.000
#> SRR1304046     2  0.6438      0.934 0.164 0.836
#> SRR1304047     2  0.6438      0.934 0.164 0.836
#> SRR1304044     2  0.6048      0.942 0.148 0.852
#> SRR1304045     2  0.6048      0.942 0.148 0.852
#> SRR1304048     2  0.5737      0.943 0.136 0.864
#> SRR1304049     2  0.5737      0.943 0.136 0.864
#> SRR1304050     2  0.7056      0.910 0.192 0.808
#> SRR1304051     2  0.5519      0.943 0.128 0.872
#> SRR1304052     2  0.5519      0.943 0.128 0.872
#> SRR1304053     2  0.5519      0.943 0.128 0.872
#> SRR1304055     2  0.4939      0.936 0.108 0.892
#> SRR1304054     2  0.5842      0.943 0.140 0.860
#> SRR1304056     2  0.5294      0.941 0.120 0.880
#> SRR1304059     2  0.5059      0.939 0.112 0.888
#> SRR1304057     2  0.5294      0.941 0.120 0.880
#> SRR1304058     2  0.0000      0.870 0.000 1.000
#> SRR1304060     2  0.6048      0.938 0.148 0.852
#> SRR1304061     2  0.4939      0.936 0.108 0.892

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>            class entropy silhouette    p1 p2    p3
#> SRR1303990     3  0.6274      0.619 0.000 NA 0.544
#> SRR1303991     3  0.6274      0.619 0.000 NA 0.544
#> SRR1303992     3  0.4665      0.836 0.048 NA 0.852
#> SRR1303993     3  0.4665      0.836 0.048 NA 0.852
#> SRR1303994     3  0.4665      0.836 0.048 NA 0.852
#> SRR1303995     3  0.4665      0.836 0.048 NA 0.852
#> SRR1303996     3  0.4665      0.836 0.048 NA 0.852
#> SRR1303997     3  0.4665      0.836 0.048 NA 0.852
#> SRR1303998     3  0.4665      0.836 0.048 NA 0.852
#> SRR1303999     3  0.4665      0.836 0.048 NA 0.852
#> SRR1304000     3  0.4665      0.836 0.048 NA 0.852
#> SRR1304001     3  0.4665      0.836 0.048 NA 0.852
#> SRR1304004     3  0.6280      0.331 0.460 NA 0.540
#> SRR1304005     3  0.6280      0.331 0.460 NA 0.540
#> SRR1304002     1  0.1643      0.878 0.956 NA 0.044
#> SRR1304003     1  0.1643      0.878 0.956 NA 0.044
#> SRR1304006     1  0.1919      0.891 0.956 NA 0.024
#> SRR1304007     1  0.1919      0.891 0.956 NA 0.024
#> SRR1304008     3  0.4277      0.814 0.132 NA 0.852
#> SRR1304009     3  0.4277      0.814 0.132 NA 0.852
#> SRR1304010     1  0.1163      0.887 0.972 NA 0.028
#> SRR1304011     1  0.1163      0.887 0.972 NA 0.028
#> SRR1304012     3  0.5136      0.810 0.132 NA 0.824
#> SRR1304013     3  0.5136      0.810 0.132 NA 0.824
#> SRR1304014     3  0.6280      0.331 0.460 NA 0.540
#> SRR1304015     3  0.4195      0.812 0.136 NA 0.852
#> SRR1304016     1  0.1919      0.891 0.956 NA 0.024
#> SRR1304017     1  0.0424      0.895 0.992 NA 0.008
#> SRR1304018     1  0.1031      0.889 0.976 NA 0.024
#> SRR1304019     3  0.4277      0.814 0.132 NA 0.852
#> SRR1304020     3  0.4277      0.814 0.132 NA 0.852
#> SRR1304021     1  0.2261      0.858 0.932 NA 0.068
#> SRR1304022     1  0.0475      0.896 0.992 NA 0.004
#> SRR1304024     1  0.0475      0.896 0.992 NA 0.004
#> SRR1304023     3  0.6274      0.619 0.000 NA 0.544
#> SRR1304026     1  0.6252      0.569 0.556 NA 0.000
#> SRR1304027     1  0.6252      0.569 0.556 NA 0.000
#> SRR1304025     1  0.0000      0.895 1.000 NA 0.000
#> SRR1304028     1  0.0424      0.895 0.992 NA 0.008
#> SRR1304029     1  0.0424      0.895 0.992 NA 0.008
#> SRR1304030     1  0.1919      0.891 0.956 NA 0.024
#> SRR1304031     1  0.1919      0.891 0.956 NA 0.024
#> SRR1304032     1  0.3941      0.828 0.844 NA 0.000
#> SRR1304033     1  0.3941      0.828 0.844 NA 0.000
#> SRR1304034     1  0.3941      0.828 0.844 NA 0.000
#> SRR1304035     1  0.3941      0.828 0.844 NA 0.000
#> SRR1304036     1  0.3941      0.828 0.844 NA 0.000
#> SRR1304037     1  0.3941      0.828 0.844 NA 0.000
#> SRR1304038     1  0.0000      0.895 1.000 NA 0.000
#> SRR1304039     1  0.0000      0.895 1.000 NA 0.000
#> SRR1304040     1  0.1267      0.894 0.972 NA 0.004
#> SRR1304041     1  0.1267      0.894 0.972 NA 0.004
#> SRR1304042     1  0.6244      0.574 0.560 NA 0.000
#> SRR1304043     1  0.6244      0.574 0.560 NA 0.000
#> SRR1304046     1  0.1031      0.889 0.976 NA 0.024
#> SRR1304047     1  0.1031      0.889 0.976 NA 0.024
#> SRR1304044     1  0.0424      0.895 0.992 NA 0.008
#> SRR1304045     1  0.0424      0.895 0.992 NA 0.008
#> SRR1304048     1  0.0237      0.895 0.996 NA 0.000
#> SRR1304049     1  0.0237      0.895 0.996 NA 0.000
#> SRR1304050     1  0.1860      0.871 0.948 NA 0.052
#> SRR1304051     1  0.0747      0.895 0.984 NA 0.000
#> SRR1304052     1  0.0747      0.895 0.984 NA 0.000
#> SRR1304053     1  0.0747      0.895 0.984 NA 0.000
#> SRR1304055     1  0.4750      0.777 0.784 NA 0.000
#> SRR1304054     1  0.0237      0.895 0.996 NA 0.000
#> SRR1304056     1  0.4346      0.802 0.816 NA 0.000
#> SRR1304059     1  0.4605      0.788 0.796 NA 0.000
#> SRR1304057     1  0.4235      0.808 0.824 NA 0.000
#> SRR1304058     1  0.6244      0.574 0.560 NA 0.000
#> SRR1304060     1  0.1919      0.891 0.956 NA 0.024
#> SRR1304061     1  0.4750      0.777 0.784 NA 0.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> SRR1303990     4  0.0000      1.000 0.000 0.000 0.000 1.000
#> SRR1303991     4  0.0000      1.000 0.000 0.000 0.000 1.000
#> SRR1303992     3  0.0000      0.850 0.000 0.000 1.000 0.000
#> SRR1303993     3  0.0000      0.850 0.000 0.000 1.000 0.000
#> SRR1303994     3  0.0000      0.850 0.000 0.000 1.000 0.000
#> SRR1303995     3  0.0000      0.850 0.000 0.000 1.000 0.000
#> SRR1303996     3  0.0000      0.850 0.000 0.000 1.000 0.000
#> SRR1303997     3  0.0000      0.850 0.000 0.000 1.000 0.000
#> SRR1303998     3  0.0000      0.850 0.000 0.000 1.000 0.000
#> SRR1303999     3  0.0000      0.850 0.000 0.000 1.000 0.000
#> SRR1304000     3  0.0000      0.850 0.000 0.000 1.000 0.000
#> SRR1304001     3  0.0000      0.850 0.000 0.000 1.000 0.000
#> SRR1304004     1  0.7008     -0.142 0.460 0.004 0.436 0.100
#> SRR1304005     1  0.7008     -0.142 0.460 0.004 0.436 0.100
#> SRR1304002     1  0.1302      0.828 0.956 0.000 0.044 0.000
#> SRR1304003     1  0.1302      0.828 0.956 0.000 0.044 0.000
#> SRR1304006     1  0.1833      0.831 0.944 0.032 0.024 0.000
#> SRR1304007     1  0.1833      0.831 0.944 0.032 0.024 0.000
#> SRR1304008     3  0.5459      0.774 0.128 0.004 0.748 0.120
#> SRR1304009     3  0.5459      0.774 0.128 0.004 0.748 0.120
#> SRR1304010     1  0.0921      0.834 0.972 0.000 0.028 0.000
#> SRR1304011     1  0.0921      0.834 0.972 0.000 0.028 0.000
#> SRR1304012     3  0.5803      0.756 0.128 0.004 0.720 0.148
#> SRR1304013     3  0.5803      0.756 0.128 0.004 0.720 0.148
#> SRR1304014     1  0.7008     -0.142 0.460 0.004 0.436 0.100
#> SRR1304015     3  0.5457      0.771 0.132 0.004 0.748 0.116
#> SRR1304016     1  0.1833      0.831 0.944 0.032 0.024 0.000
#> SRR1304017     1  0.0524      0.839 0.988 0.008 0.004 0.000
#> SRR1304018     1  0.0817      0.835 0.976 0.000 0.024 0.000
#> SRR1304019     3  0.5459      0.774 0.128 0.004 0.748 0.120
#> SRR1304020     3  0.5459      0.774 0.128 0.004 0.748 0.120
#> SRR1304021     1  0.1970      0.811 0.932 0.000 0.060 0.008
#> SRR1304022     1  0.0469      0.839 0.988 0.012 0.000 0.000
#> SRR1304024     1  0.0469      0.839 0.988 0.012 0.000 0.000
#> SRR1304023     4  0.0000      1.000 0.000 0.000 0.000 1.000
#> SRR1304026     2  0.0188      0.541 0.004 0.996 0.000 0.000
#> SRR1304027     2  0.0188      0.541 0.004 0.996 0.000 0.000
#> SRR1304025     1  0.0000      0.838 1.000 0.000 0.000 0.000
#> SRR1304028     1  0.0524      0.839 0.988 0.008 0.004 0.000
#> SRR1304029     1  0.0524      0.839 0.988 0.008 0.004 0.000
#> SRR1304030     1  0.1833      0.831 0.944 0.032 0.024 0.000
#> SRR1304031     1  0.1833      0.831 0.944 0.032 0.024 0.000
#> SRR1304032     1  0.4406      0.492 0.700 0.300 0.000 0.000
#> SRR1304033     1  0.4406      0.492 0.700 0.300 0.000 0.000
#> SRR1304034     1  0.4382      0.495 0.704 0.296 0.000 0.000
#> SRR1304035     1  0.4382      0.495 0.704 0.296 0.000 0.000
#> SRR1304036     1  0.4382      0.495 0.704 0.296 0.000 0.000
#> SRR1304037     1  0.4382      0.495 0.704 0.296 0.000 0.000
#> SRR1304038     1  0.0000      0.838 1.000 0.000 0.000 0.000
#> SRR1304039     1  0.0000      0.838 1.000 0.000 0.000 0.000
#> SRR1304040     1  0.1302      0.827 0.956 0.044 0.000 0.000
#> SRR1304041     1  0.1302      0.827 0.956 0.044 0.000 0.000
#> SRR1304042     2  0.4008      0.747 0.244 0.756 0.000 0.000
#> SRR1304043     2  0.4008      0.747 0.244 0.756 0.000 0.000
#> SRR1304046     1  0.0817      0.837 0.976 0.000 0.024 0.000
#> SRR1304047     1  0.0817      0.837 0.976 0.000 0.024 0.000
#> SRR1304044     1  0.0524      0.839 0.988 0.008 0.004 0.000
#> SRR1304045     1  0.0524      0.839 0.988 0.008 0.004 0.000
#> SRR1304048     1  0.0336      0.838 0.992 0.008 0.000 0.000
#> SRR1304049     1  0.0336      0.838 0.992 0.008 0.000 0.000
#> SRR1304050     1  0.1474      0.823 0.948 0.000 0.052 0.000
#> SRR1304051     1  0.0592      0.836 0.984 0.016 0.000 0.000
#> SRR1304052     1  0.0592      0.836 0.984 0.016 0.000 0.000
#> SRR1304053     1  0.0592      0.836 0.984 0.016 0.000 0.000
#> SRR1304055     1  0.4454      0.454 0.692 0.308 0.000 0.000
#> SRR1304054     1  0.0336      0.839 0.992 0.008 0.000 0.000
#> SRR1304056     1  0.3873      0.613 0.772 0.228 0.000 0.000
#> SRR1304059     1  0.4164      0.550 0.736 0.264 0.000 0.000
#> SRR1304057     1  0.3726      0.638 0.788 0.212 0.000 0.000
#> SRR1304058     2  0.4304      0.704 0.284 0.716 0.000 0.000
#> SRR1304060     1  0.1833      0.831 0.944 0.032 0.024 0.000
#> SRR1304061     1  0.4454      0.454 0.692 0.308 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>            class entropy silhouette    p1    p2    p3    p4    p5
#> SRR1303990     2  0.0000      1.000 0.000 1.000 0.000 0.000 0.000
#> SRR1303991     2  0.0000      1.000 0.000 1.000 0.000 0.000 0.000
#> SRR1303992     3  0.0703      0.966 0.000 0.000 0.976 0.000 0.024
#> SRR1303993     3  0.0703      0.966 0.000 0.000 0.976 0.000 0.024
#> SRR1303994     3  0.0000      0.992 0.000 0.000 1.000 0.000 0.000
#> SRR1303995     3  0.0000      0.992 0.000 0.000 1.000 0.000 0.000
#> SRR1303996     3  0.0000      0.992 0.000 0.000 1.000 0.000 0.000
#> SRR1303997     3  0.0000      0.992 0.000 0.000 1.000 0.000 0.000
#> SRR1303998     3  0.0000      0.992 0.000 0.000 1.000 0.000 0.000
#> SRR1303999     3  0.0000      0.992 0.000 0.000 1.000 0.000 0.000
#> SRR1304000     3  0.0000      0.992 0.000 0.000 1.000 0.000 0.000
#> SRR1304001     3  0.0000      0.992 0.000 0.000 1.000 0.000 0.000
#> SRR1304004     5  0.4746      0.449 0.376 0.000 0.024 0.000 0.600
#> SRR1304005     5  0.4746      0.449 0.376 0.000 0.024 0.000 0.600
#> SRR1304002     1  0.1121      0.871 0.956 0.000 0.000 0.000 0.044
#> SRR1304003     1  0.1121      0.871 0.956 0.000 0.000 0.000 0.044
#> SRR1304006     1  0.1579      0.872 0.944 0.000 0.000 0.032 0.024
#> SRR1304007     1  0.1579      0.872 0.944 0.000 0.000 0.032 0.024
#> SRR1304008     5  0.1399      0.736 0.020 0.000 0.028 0.000 0.952
#> SRR1304009     5  0.1399      0.736 0.020 0.000 0.028 0.000 0.952
#> SRR1304010     1  0.0794      0.875 0.972 0.000 0.000 0.000 0.028
#> SRR1304011     1  0.0794      0.875 0.972 0.000 0.000 0.000 0.028
#> SRR1304012     5  0.2722      0.703 0.020 0.056 0.028 0.000 0.896
#> SRR1304013     5  0.2722      0.703 0.020 0.056 0.028 0.000 0.896
#> SRR1304014     5  0.4746      0.449 0.376 0.000 0.024 0.000 0.600
#> SRR1304015     5  0.1493      0.735 0.024 0.000 0.028 0.000 0.948
#> SRR1304016     1  0.1579      0.872 0.944 0.000 0.000 0.032 0.024
#> SRR1304017     1  0.0771      0.879 0.976 0.000 0.000 0.004 0.020
#> SRR1304018     1  0.0703      0.877 0.976 0.000 0.000 0.000 0.024
#> SRR1304019     5  0.1399      0.736 0.020 0.000 0.028 0.000 0.952
#> SRR1304020     5  0.1399      0.736 0.020 0.000 0.028 0.000 0.952
#> SRR1304021     1  0.1544      0.854 0.932 0.000 0.000 0.000 0.068
#> SRR1304022     1  0.0798      0.879 0.976 0.000 0.000 0.008 0.016
#> SRR1304024     1  0.0798      0.879 0.976 0.000 0.000 0.008 0.016
#> SRR1304023     2  0.0000      1.000 0.000 1.000 0.000 0.000 0.000
#> SRR1304026     4  0.0963      0.501 0.000 0.000 0.000 0.964 0.036
#> SRR1304027     4  0.0963      0.501 0.000 0.000 0.000 0.964 0.036
#> SRR1304025     1  0.0000      0.879 1.000 0.000 0.000 0.000 0.000
#> SRR1304028     1  0.0771      0.879 0.976 0.000 0.000 0.004 0.020
#> SRR1304029     1  0.0771      0.879 0.976 0.000 0.000 0.004 0.020
#> SRR1304030     1  0.1579      0.872 0.944 0.000 0.000 0.032 0.024
#> SRR1304031     1  0.1579      0.872 0.944 0.000 0.000 0.032 0.024
#> SRR1304032     1  0.4173      0.530 0.688 0.000 0.000 0.300 0.012
#> SRR1304033     1  0.4173      0.530 0.688 0.000 0.000 0.300 0.012
#> SRR1304034     1  0.3928      0.540 0.700 0.000 0.000 0.296 0.004
#> SRR1304035     1  0.3928      0.540 0.700 0.000 0.000 0.296 0.004
#> SRR1304036     1  0.3928      0.540 0.700 0.000 0.000 0.296 0.004
#> SRR1304037     1  0.3928      0.540 0.700 0.000 0.000 0.296 0.004
#> SRR1304038     1  0.0000      0.879 1.000 0.000 0.000 0.000 0.000
#> SRR1304039     1  0.0000      0.879 1.000 0.000 0.000 0.000 0.000
#> SRR1304040     1  0.1444      0.868 0.948 0.000 0.000 0.040 0.012
#> SRR1304041     1  0.1444      0.868 0.948 0.000 0.000 0.040 0.012
#> SRR1304042     4  0.3452      0.730 0.244 0.000 0.000 0.756 0.000
#> SRR1304043     4  0.3452      0.730 0.244 0.000 0.000 0.756 0.000
#> SRR1304046     1  0.0703      0.878 0.976 0.000 0.000 0.000 0.024
#> SRR1304047     1  0.0703      0.878 0.976 0.000 0.000 0.000 0.024
#> SRR1304044     1  0.0771      0.879 0.976 0.000 0.000 0.004 0.020
#> SRR1304045     1  0.0771      0.879 0.976 0.000 0.000 0.004 0.020
#> SRR1304048     1  0.0290      0.880 0.992 0.000 0.000 0.008 0.000
#> SRR1304049     1  0.0290      0.880 0.992 0.000 0.000 0.008 0.000
#> SRR1304050     1  0.1270      0.866 0.948 0.000 0.000 0.000 0.052
#> SRR1304051     1  0.0510      0.878 0.984 0.000 0.000 0.016 0.000
#> SRR1304052     1  0.0510      0.878 0.984 0.000 0.000 0.016 0.000
#> SRR1304053     1  0.0510      0.878 0.984 0.000 0.000 0.016 0.000
#> SRR1304055     1  0.3837      0.485 0.692 0.000 0.000 0.308 0.000
#> SRR1304054     1  0.0290      0.881 0.992 0.000 0.000 0.008 0.000
#> SRR1304056     1  0.3336      0.648 0.772 0.000 0.000 0.228 0.000
#> SRR1304059     1  0.3586      0.583 0.736 0.000 0.000 0.264 0.000
#> SRR1304057     1  0.3210      0.674 0.788 0.000 0.000 0.212 0.000
#> SRR1304058     4  0.3707      0.688 0.284 0.000 0.000 0.716 0.000
#> SRR1304060     1  0.1579      0.872 0.944 0.000 0.000 0.032 0.024
#> SRR1304061     1  0.3837      0.485 0.692 0.000 0.000 0.308 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
#> SRR1303990     6  0.0000      1.000 0.000 0.00 0.000 0.000 0.000 1.000
#> SRR1303991     6  0.0000      1.000 0.000 0.00 0.000 0.000 0.000 1.000
#> SRR1303992     3  0.0632      0.965 0.000 0.00 0.976 0.000 0.024 0.000
#> SRR1303993     3  0.0632      0.965 0.000 0.00 0.976 0.000 0.024 0.000
#> SRR1303994     3  0.0000      0.991 0.000 0.00 1.000 0.000 0.000 0.000
#> SRR1303995     3  0.0000      0.991 0.000 0.00 1.000 0.000 0.000 0.000
#> SRR1303996     3  0.0000      0.991 0.000 0.00 1.000 0.000 0.000 0.000
#> SRR1303997     3  0.0000      0.991 0.000 0.00 1.000 0.000 0.000 0.000
#> SRR1303998     3  0.0000      0.991 0.000 0.00 1.000 0.000 0.000 0.000
#> SRR1303999     3  0.0000      0.991 0.000 0.00 1.000 0.000 0.000 0.000
#> SRR1304000     3  0.0000      0.991 0.000 0.00 1.000 0.000 0.000 0.000
#> SRR1304001     3  0.0000      0.991 0.000 0.00 1.000 0.000 0.000 0.000
#> SRR1304004     5  0.3769      0.433 0.356 0.00 0.000 0.004 0.640 0.000
#> SRR1304005     5  0.3769      0.433 0.356 0.00 0.000 0.004 0.640 0.000
#> SRR1304002     1  0.1152      0.804 0.952 0.00 0.000 0.004 0.044 0.000
#> SRR1304003     1  0.1152      0.804 0.952 0.00 0.000 0.004 0.044 0.000
#> SRR1304006     1  0.2333      0.785 0.884 0.00 0.000 0.092 0.024 0.000
#> SRR1304007     1  0.2333      0.785 0.884 0.00 0.000 0.092 0.024 0.000
#> SRR1304008     5  0.0000      0.732 0.000 0.00 0.000 0.000 1.000 0.000
#> SRR1304009     5  0.0000      0.732 0.000 0.00 0.000 0.000 1.000 0.000
#> SRR1304010     1  0.0858      0.805 0.968 0.00 0.000 0.004 0.028 0.000
#> SRR1304011     1  0.0858      0.805 0.968 0.00 0.000 0.004 0.028 0.000
#> SRR1304012     5  0.1204      0.702 0.000 0.00 0.000 0.000 0.944 0.056
#> SRR1304013     5  0.1204      0.702 0.000 0.00 0.000 0.000 0.944 0.056
#> SRR1304014     5  0.3769      0.433 0.356 0.00 0.000 0.004 0.640 0.000
#> SRR1304015     5  0.0146      0.731 0.004 0.00 0.000 0.000 0.996 0.000
#> SRR1304016     1  0.2333      0.785 0.884 0.00 0.000 0.092 0.024 0.000
#> SRR1304017     1  0.2219      0.754 0.864 0.00 0.000 0.136 0.000 0.000
#> SRR1304018     1  0.0891      0.805 0.968 0.00 0.000 0.008 0.024 0.000
#> SRR1304019     5  0.0000      0.732 0.000 0.00 0.000 0.000 1.000 0.000
#> SRR1304020     5  0.0000      0.732 0.000 0.00 0.000 0.000 1.000 0.000
#> SRR1304021     1  0.1531      0.797 0.928 0.00 0.000 0.004 0.068 0.000
#> SRR1304022     1  0.2048      0.766 0.880 0.00 0.000 0.120 0.000 0.000
#> SRR1304024     1  0.2003      0.768 0.884 0.00 0.000 0.116 0.000 0.000
#> SRR1304023     6  0.0000      1.000 0.000 0.00 0.000 0.000 0.000 1.000
#> SRR1304026     2  0.0000      1.000 0.000 1.00 0.000 0.000 0.000 0.000
#> SRR1304027     2  0.0000      1.000 0.000 1.00 0.000 0.000 0.000 0.000
#> SRR1304025     1  0.0146      0.806 0.996 0.00 0.000 0.004 0.000 0.000
#> SRR1304028     1  0.2562      0.731 0.828 0.00 0.000 0.172 0.000 0.000
#> SRR1304029     1  0.2562      0.731 0.828 0.00 0.000 0.172 0.000 0.000
#> SRR1304030     1  0.2333      0.785 0.884 0.00 0.000 0.092 0.024 0.000
#> SRR1304031     1  0.2333      0.785 0.884 0.00 0.000 0.092 0.024 0.000
#> SRR1304032     1  0.3823      0.302 0.564 0.00 0.000 0.436 0.000 0.000
#> SRR1304033     1  0.3823      0.302 0.564 0.00 0.000 0.436 0.000 0.000
#> SRR1304034     1  0.3747      0.345 0.604 0.00 0.000 0.396 0.000 0.000
#> SRR1304035     1  0.3747      0.345 0.604 0.00 0.000 0.396 0.000 0.000
#> SRR1304036     1  0.3747      0.345 0.604 0.00 0.000 0.396 0.000 0.000
#> SRR1304037     1  0.3747      0.345 0.604 0.00 0.000 0.396 0.000 0.000
#> SRR1304038     1  0.0000      0.805 1.000 0.00 0.000 0.000 0.000 0.000
#> SRR1304039     1  0.0000      0.805 1.000 0.00 0.000 0.000 0.000 0.000
#> SRR1304040     1  0.2135      0.783 0.872 0.00 0.000 0.128 0.000 0.000
#> SRR1304041     1  0.2135      0.783 0.872 0.00 0.000 0.128 0.000 0.000
#> SRR1304042     4  0.3083      0.928 0.132 0.04 0.000 0.828 0.000 0.000
#> SRR1304043     4  0.3083      0.928 0.132 0.04 0.000 0.828 0.000 0.000
#> SRR1304046     1  0.0632      0.807 0.976 0.00 0.000 0.000 0.024 0.000
#> SRR1304047     1  0.0632      0.807 0.976 0.00 0.000 0.000 0.024 0.000
#> SRR1304044     1  0.2562      0.731 0.828 0.00 0.000 0.172 0.000 0.000
#> SRR1304045     1  0.2562      0.731 0.828 0.00 0.000 0.172 0.000 0.000
#> SRR1304048     1  0.1556      0.799 0.920 0.00 0.000 0.080 0.000 0.000
#> SRR1304049     1  0.1556      0.799 0.920 0.00 0.000 0.080 0.000 0.000
#> SRR1304050     1  0.1285      0.802 0.944 0.00 0.000 0.004 0.052 0.000
#> SRR1304051     1  0.1501      0.795 0.924 0.00 0.000 0.076 0.000 0.000
#> SRR1304052     1  0.1501      0.795 0.924 0.00 0.000 0.076 0.000 0.000
#> SRR1304053     1  0.1501      0.795 0.924 0.00 0.000 0.076 0.000 0.000
#> SRR1304055     1  0.3672      0.351 0.632 0.00 0.000 0.368 0.000 0.000
#> SRR1304054     1  0.1327      0.802 0.936 0.00 0.000 0.064 0.000 0.000
#> SRR1304056     1  0.3351      0.542 0.712 0.00 0.000 0.288 0.000 0.000
#> SRR1304059     1  0.3515      0.468 0.676 0.00 0.000 0.324 0.000 0.000
#> SRR1304057     1  0.3266      0.571 0.728 0.00 0.000 0.272 0.000 0.000
#> SRR1304058     4  0.3618      0.864 0.192 0.04 0.000 0.768 0.000 0.000
#> SRR1304060     1  0.2333      0.785 0.884 0.00 0.000 0.092 0.024 0.000
#> SRR1304061     1  0.3672      0.351 0.632 0.00 0.000 0.368 0.000 0.000

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

consensus_heatmap(res, k = 2)

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

consensus_heatmap(res, k = 3)

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

consensus_heatmap(res, k = 4)

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

consensus_heatmap(res, k = 5)

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

consensus_heatmap(res, k = 6)

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

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

membership_heatmap(res, k = 2)

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

membership_heatmap(res, k = 3)

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

membership_heatmap(res, k = 4)

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

membership_heatmap(res, k = 5)

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

membership_heatmap(res, k = 6)

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

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

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

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

get_signatures(res, k = 3)

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

get_signatures(res, k = 4)

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

get_signatures(res, k = 5)

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

get_signatures(res, k = 6)

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

Signature heatmaps where rows are not scaled:

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

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

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

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

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

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

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

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

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

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

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk CV-hclust-signature_compare

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

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

An example of the output of tb is:

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

The columns in tb are:

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

UMAP plot which shows how samples are separated.

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

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

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

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

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

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

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

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

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

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

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk CV-hclust-collect-classes

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 15595 rows and 72 columns.
#>   Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'CV' method.
#>   Subgroups are detected by 'kmeans' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 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.964         0.4315 0.559   0.559
#> 3 3 0.369           0.534       0.766         0.3250 0.963   0.934
#> 4 4 0.481           0.739       0.806         0.1430 0.821   0.661
#> 5 5 0.569           0.539       0.758         0.0942 0.958   0.881
#> 6 6 0.601           0.465       0.757         0.0740 0.887   0.656

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

suggest_best_k(res)
#> [1] 2

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

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

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>            class entropy silhouette    p1    p2
#> SRR1303990     1  0.2603      0.977 0.956 0.044
#> SRR1303991     1  0.2603      0.977 0.956 0.044
#> SRR1303992     1  0.3584      0.975 0.932 0.068
#> SRR1303993     1  0.3584      0.975 0.932 0.068
#> SRR1303994     1  0.3584      0.975 0.932 0.068
#> SRR1303995     1  0.3584      0.975 0.932 0.068
#> SRR1303996     1  0.3584      0.975 0.932 0.068
#> SRR1303997     1  0.3584      0.975 0.932 0.068
#> SRR1303998     1  0.3584      0.975 0.932 0.068
#> SRR1303999     1  0.3584      0.975 0.932 0.068
#> SRR1304000     1  0.3584      0.975 0.932 0.068
#> SRR1304001     1  0.3584      0.975 0.932 0.068
#> SRR1304004     1  0.2603      0.978 0.956 0.044
#> SRR1304005     1  0.2603      0.978 0.956 0.044
#> SRR1304002     2  0.2423      0.970 0.040 0.960
#> SRR1304003     2  0.1843      0.973 0.028 0.972
#> SRR1304006     2  0.1414      0.974 0.020 0.980
#> SRR1304007     2  0.1414      0.974 0.020 0.980
#> SRR1304008     1  0.2778      0.978 0.952 0.048
#> SRR1304009     1  0.2778      0.978 0.952 0.048
#> SRR1304010     2  0.2043      0.970 0.032 0.968
#> SRR1304011     2  0.2043      0.970 0.032 0.968
#> SRR1304012     1  0.2778      0.978 0.952 0.048
#> SRR1304013     1  0.2778      0.978 0.952 0.048
#> SRR1304014     1  0.3114      0.977 0.944 0.056
#> SRR1304015     1  0.2778      0.978 0.952 0.048
#> SRR1304016     2  0.0938      0.976 0.012 0.988
#> SRR1304017     2  0.2423      0.967 0.040 0.960
#> SRR1304018     2  0.2236      0.969 0.036 0.964
#> SRR1304019     1  0.2778      0.978 0.952 0.048
#> SRR1304020     1  0.2778      0.978 0.952 0.048
#> SRR1304021     2  0.5294      0.887 0.120 0.880
#> SRR1304022     2  0.2043      0.969 0.032 0.968
#> SRR1304024     2  0.2043      0.969 0.032 0.968
#> SRR1304023     1  0.2778      0.978 0.952 0.048
#> SRR1304026     2  0.2043      0.954 0.032 0.968
#> SRR1304027     2  0.2043      0.954 0.032 0.968
#> SRR1304025     2  0.2043      0.969 0.032 0.968
#> SRR1304028     2  0.2423      0.967 0.040 0.960
#> SRR1304029     2  0.2423      0.967 0.040 0.960
#> SRR1304030     2  0.1414      0.974 0.020 0.980
#> SRR1304031     2  0.1414      0.974 0.020 0.980
#> SRR1304032     2  0.0000      0.976 0.000 1.000
#> SRR1304033     2  0.0000      0.976 0.000 1.000
#> SRR1304034     2  0.0000      0.976 0.000 1.000
#> SRR1304035     2  0.0000      0.976 0.000 1.000
#> SRR1304036     2  0.0938      0.973 0.012 0.988
#> SRR1304037     2  0.0938      0.973 0.012 0.988
#> SRR1304038     2  0.2236      0.969 0.036 0.964
#> SRR1304039     2  0.2236      0.969 0.036 0.964
#> SRR1304040     2  0.0000      0.976 0.000 1.000
#> SRR1304041     2  0.0000      0.976 0.000 1.000
#> SRR1304042     2  0.0376      0.975 0.004 0.996
#> SRR1304043     2  0.0376      0.975 0.004 0.996
#> SRR1304046     2  0.2236      0.969 0.036 0.964
#> SRR1304047     2  0.2236      0.969 0.036 0.964
#> SRR1304044     2  0.2423      0.967 0.040 0.960
#> SRR1304045     2  0.2423      0.967 0.040 0.960
#> SRR1304048     2  0.0672      0.976 0.008 0.992
#> SRR1304049     2  0.0672      0.976 0.008 0.992
#> SRR1304050     2  0.7528      0.749 0.216 0.784
#> SRR1304051     2  0.0938      0.976 0.012 0.988
#> SRR1304052     2  0.0938      0.976 0.012 0.988
#> SRR1304053     2  0.1184      0.975 0.016 0.984
#> SRR1304055     2  0.0376      0.975 0.004 0.996
#> SRR1304054     2  0.0000      0.976 0.000 1.000
#> SRR1304056     2  0.0938      0.973 0.012 0.988
#> SRR1304059     2  0.0938      0.973 0.012 0.988
#> SRR1304057     2  0.1184      0.974 0.016 0.984
#> SRR1304058     2  0.0938      0.973 0.012 0.988
#> SRR1304060     2  0.1414      0.974 0.020 0.980
#> SRR1304061     2  0.0938      0.973 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
#> SRR1303990     3  0.6773      0.757 0.024 0.340 0.636
#> SRR1303991     3  0.6773      0.757 0.024 0.340 0.636
#> SRR1303992     3  0.0592      0.754 0.012 0.000 0.988
#> SRR1303993     3  0.0592      0.754 0.012 0.000 0.988
#> SRR1303994     3  0.0592      0.754 0.012 0.000 0.988
#> SRR1303995     3  0.0592      0.754 0.012 0.000 0.988
#> SRR1303996     3  0.0592      0.754 0.012 0.000 0.988
#> SRR1303997     3  0.0592      0.754 0.012 0.000 0.988
#> SRR1303998     3  0.0592      0.754 0.012 0.000 0.988
#> SRR1303999     3  0.0592      0.754 0.012 0.000 0.988
#> SRR1304000     3  0.0592      0.754 0.012 0.000 0.988
#> SRR1304001     3  0.0592      0.754 0.012 0.000 0.988
#> SRR1304004     3  0.7831      0.753 0.088 0.280 0.632
#> SRR1304005     3  0.7831      0.753 0.088 0.280 0.632
#> SRR1304002     1  0.5954      0.649 0.792 0.092 0.116
#> SRR1304003     1  0.5625      0.662 0.808 0.076 0.116
#> SRR1304006     1  0.4209      0.677 0.856 0.016 0.128
#> SRR1304007     1  0.4209      0.677 0.856 0.016 0.128
#> SRR1304008     3  0.8437      0.763 0.092 0.388 0.520
#> SRR1304009     3  0.8437      0.763 0.092 0.388 0.520
#> SRR1304010     1  0.5731      0.654 0.804 0.088 0.108
#> SRR1304011     1  0.5731      0.654 0.804 0.088 0.108
#> SRR1304012     3  0.8373      0.764 0.088 0.388 0.524
#> SRR1304013     3  0.8373      0.764 0.088 0.388 0.524
#> SRR1304014     3  0.8354      0.750 0.104 0.320 0.576
#> SRR1304015     3  0.8437      0.763 0.092 0.388 0.520
#> SRR1304016     1  0.3682      0.682 0.876 0.008 0.116
#> SRR1304017     1  0.5692      0.428 0.724 0.268 0.008
#> SRR1304018     1  0.3267      0.613 0.884 0.116 0.000
#> SRR1304019     3  0.8437      0.763 0.092 0.388 0.520
#> SRR1304020     3  0.8437      0.763 0.092 0.388 0.520
#> SRR1304021     1  0.7673      0.476 0.664 0.236 0.100
#> SRR1304022     1  0.2796      0.594 0.908 0.092 0.000
#> SRR1304024     1  0.2625      0.604 0.916 0.084 0.000
#> SRR1304023     3  0.8288      0.755 0.080 0.408 0.512
#> SRR1304026     2  0.6204      1.000 0.424 0.576 0.000
#> SRR1304027     2  0.6204      1.000 0.424 0.576 0.000
#> SRR1304025     1  0.1163      0.636 0.972 0.028 0.000
#> SRR1304028     1  0.6314     -0.311 0.604 0.392 0.004
#> SRR1304029     1  0.6314     -0.311 0.604 0.392 0.004
#> SRR1304030     1  0.4413      0.676 0.852 0.024 0.124
#> SRR1304031     1  0.4413      0.676 0.852 0.024 0.124
#> SRR1304032     1  0.6280     -0.660 0.540 0.460 0.000
#> SRR1304033     1  0.6280     -0.660 0.540 0.460 0.000
#> SRR1304034     1  0.6244     -0.621 0.560 0.440 0.000
#> SRR1304035     1  0.6244     -0.621 0.560 0.440 0.000
#> SRR1304036     1  0.6192     -0.568 0.580 0.420 0.000
#> SRR1304037     1  0.6192     -0.568 0.580 0.420 0.000
#> SRR1304038     1  0.5260      0.665 0.828 0.080 0.092
#> SRR1304039     1  0.5260      0.665 0.828 0.080 0.092
#> SRR1304040     1  0.2959      0.542 0.900 0.100 0.000
#> SRR1304041     1  0.2959      0.542 0.900 0.100 0.000
#> SRR1304042     1  0.5058      0.216 0.756 0.244 0.000
#> SRR1304043     1  0.5058      0.216 0.756 0.244 0.000
#> SRR1304046     1  0.5731      0.646 0.804 0.108 0.088
#> SRR1304047     1  0.5731      0.646 0.804 0.108 0.088
#> SRR1304044     1  0.4351      0.556 0.828 0.168 0.004
#> SRR1304045     1  0.4351      0.556 0.828 0.168 0.004
#> SRR1304048     1  0.2959      0.685 0.900 0.000 0.100
#> SRR1304049     1  0.2959      0.685 0.900 0.000 0.100
#> SRR1304050     1  0.7692      0.484 0.668 0.224 0.108
#> SRR1304051     1  0.3682      0.682 0.876 0.008 0.116
#> SRR1304052     1  0.3500      0.682 0.880 0.004 0.116
#> SRR1304053     1  0.4136      0.682 0.864 0.020 0.116
#> SRR1304055     1  0.3267      0.521 0.884 0.116 0.000
#> SRR1304054     1  0.2878      0.544 0.904 0.096 0.000
#> SRR1304056     1  0.5848      0.638 0.796 0.080 0.124
#> SRR1304059     1  0.5848      0.638 0.796 0.080 0.124
#> SRR1304057     1  0.4779      0.671 0.840 0.036 0.124
#> SRR1304058     1  0.5174      0.556 0.824 0.128 0.048
#> SRR1304060     1  0.4277      0.676 0.852 0.016 0.132
#> SRR1304061     1  0.5815      0.630 0.800 0.096 0.104

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> SRR1303990     4  0.6426     0.7369 0.004 0.088 0.288 0.620
#> SRR1303991     4  0.6426     0.7369 0.004 0.088 0.288 0.620
#> SRR1303992     3  0.1191     0.9818 0.024 0.004 0.968 0.004
#> SRR1303993     3  0.1191     0.9818 0.024 0.004 0.968 0.004
#> SRR1303994     3  0.1004     0.9817 0.024 0.004 0.972 0.000
#> SRR1303995     3  0.1004     0.9817 0.024 0.004 0.972 0.000
#> SRR1303996     3  0.1593     0.9798 0.024 0.016 0.956 0.004
#> SRR1303997     3  0.1593     0.9798 0.024 0.016 0.956 0.004
#> SRR1303998     3  0.1762     0.9742 0.020 0.016 0.952 0.012
#> SRR1303999     3  0.1762     0.9742 0.020 0.016 0.952 0.012
#> SRR1304000     3  0.1209     0.9745 0.032 0.004 0.964 0.000
#> SRR1304001     3  0.1209     0.9745 0.032 0.004 0.964 0.000
#> SRR1304004     4  0.6652     0.7516 0.108 0.000 0.316 0.576
#> SRR1304005     4  0.6652     0.7516 0.108 0.000 0.316 0.576
#> SRR1304002     1  0.4503     0.7043 0.784 0.012 0.016 0.188
#> SRR1304003     1  0.4419     0.7103 0.792 0.012 0.016 0.180
#> SRR1304006     1  0.1593     0.7642 0.956 0.016 0.024 0.004
#> SRR1304007     1  0.1593     0.7642 0.956 0.016 0.024 0.004
#> SRR1304008     4  0.4838     0.8784 0.024 0.000 0.252 0.724
#> SRR1304009     4  0.4838     0.8784 0.024 0.000 0.252 0.724
#> SRR1304010     1  0.4232     0.7148 0.804 0.024 0.004 0.168
#> SRR1304011     1  0.4232     0.7148 0.804 0.024 0.004 0.168
#> SRR1304012     4  0.5178     0.8783 0.020 0.012 0.252 0.716
#> SRR1304013     4  0.5178     0.8783 0.020 0.012 0.252 0.716
#> SRR1304014     4  0.6422     0.7738 0.120 0.000 0.248 0.632
#> SRR1304015     4  0.4807     0.8774 0.024 0.000 0.248 0.728
#> SRR1304016     1  0.0524     0.7701 0.988 0.000 0.008 0.004
#> SRR1304017     1  0.7628     0.2561 0.452 0.180 0.004 0.364
#> SRR1304018     1  0.6673     0.5569 0.636 0.160 0.004 0.200
#> SRR1304019     4  0.5024     0.8790 0.020 0.008 0.248 0.724
#> SRR1304020     4  0.5055     0.8787 0.020 0.008 0.252 0.720
#> SRR1304021     1  0.5182     0.5823 0.676 0.012 0.008 0.304
#> SRR1304022     1  0.6154     0.5503 0.688 0.200 0.008 0.104
#> SRR1304024     1  0.6082     0.5644 0.696 0.192 0.008 0.104
#> SRR1304023     4  0.5891     0.7258 0.000 0.132 0.168 0.700
#> SRR1304026     2  0.6009     0.7435 0.152 0.716 0.012 0.120
#> SRR1304027     2  0.6009     0.7435 0.152 0.716 0.012 0.120
#> SRR1304025     1  0.3411     0.7461 0.880 0.064 0.008 0.048
#> SRR1304028     2  0.6618     0.6577 0.284 0.608 0.004 0.104
#> SRR1304029     2  0.6618     0.6577 0.284 0.608 0.004 0.104
#> SRR1304030     1  0.1484     0.7639 0.960 0.016 0.020 0.004
#> SRR1304031     1  0.1484     0.7639 0.960 0.016 0.020 0.004
#> SRR1304032     2  0.4267     0.8040 0.188 0.788 0.000 0.024
#> SRR1304033     2  0.4267     0.8040 0.188 0.788 0.000 0.024
#> SRR1304034     2  0.4304     0.8048 0.284 0.716 0.000 0.000
#> SRR1304035     2  0.4304     0.8048 0.284 0.716 0.000 0.000
#> SRR1304036     2  0.5230     0.7122 0.368 0.620 0.008 0.004
#> SRR1304037     2  0.5230     0.7122 0.368 0.620 0.008 0.004
#> SRR1304038     1  0.4473     0.7201 0.804 0.036 0.008 0.152
#> SRR1304039     1  0.4424     0.7223 0.808 0.036 0.008 0.148
#> SRR1304040     1  0.3754     0.7042 0.852 0.112 0.008 0.028
#> SRR1304041     1  0.3754     0.7042 0.852 0.112 0.008 0.028
#> SRR1304042     1  0.6611     0.0122 0.584 0.336 0.012 0.068
#> SRR1304043     1  0.6611     0.0122 0.584 0.336 0.012 0.068
#> SRR1304046     1  0.4218     0.7080 0.796 0.012 0.008 0.184
#> SRR1304047     1  0.4218     0.7080 0.796 0.012 0.008 0.184
#> SRR1304044     1  0.7221     0.4103 0.568 0.236 0.004 0.192
#> SRR1304045     1  0.7221     0.4103 0.568 0.236 0.004 0.192
#> SRR1304048     1  0.0524     0.7702 0.988 0.008 0.000 0.004
#> SRR1304049     1  0.0524     0.7702 0.988 0.008 0.000 0.004
#> SRR1304050     1  0.5304     0.5743 0.672 0.012 0.012 0.304
#> SRR1304051     1  0.0804     0.7682 0.980 0.012 0.008 0.000
#> SRR1304052     1  0.0657     0.7700 0.984 0.012 0.004 0.000
#> SRR1304053     1  0.1526     0.7695 0.960 0.012 0.016 0.012
#> SRR1304055     1  0.2731     0.7227 0.896 0.092 0.004 0.008
#> SRR1304054     1  0.2334     0.7340 0.908 0.088 0.000 0.004
#> SRR1304056     1  0.1811     0.7587 0.948 0.028 0.020 0.004
#> SRR1304059     1  0.2057     0.7556 0.940 0.032 0.020 0.008
#> SRR1304057     1  0.1598     0.7626 0.956 0.020 0.020 0.004
#> SRR1304058     1  0.3734     0.6788 0.852 0.116 0.020 0.012
#> SRR1304060     1  0.1697     0.7634 0.952 0.016 0.028 0.004
#> SRR1304061     1  0.2125     0.7497 0.932 0.052 0.012 0.004

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>            class entropy silhouette    p1    p2    p3    p4    p5
#> SRR1303990     5  0.5333    0.64390 0.000 0.008 0.080 0.248 0.664
#> SRR1303991     5  0.5333    0.64390 0.000 0.008 0.080 0.248 0.664
#> SRR1303992     3  0.1074    0.96307 0.012 0.000 0.968 0.016 0.004
#> SRR1303993     3  0.1074    0.96307 0.012 0.000 0.968 0.016 0.004
#> SRR1303994     3  0.1362    0.96271 0.012 0.008 0.960 0.016 0.004
#> SRR1303995     3  0.1362    0.96271 0.012 0.008 0.960 0.016 0.004
#> SRR1303996     3  0.2593    0.95003 0.012 0.024 0.904 0.056 0.004
#> SRR1303997     3  0.2593    0.95003 0.012 0.024 0.904 0.056 0.004
#> SRR1303998     3  0.2260    0.95563 0.012 0.016 0.920 0.048 0.004
#> SRR1303999     3  0.2260    0.95563 0.012 0.016 0.920 0.048 0.004
#> SRR1304000     3  0.1314    0.96222 0.016 0.012 0.960 0.012 0.000
#> SRR1304001     3  0.1314    0.96222 0.016 0.012 0.960 0.012 0.000
#> SRR1304004     5  0.6328    0.66137 0.116 0.004 0.148 0.072 0.660
#> SRR1304005     5  0.6328    0.66137 0.116 0.004 0.148 0.072 0.660
#> SRR1304002     1  0.5986    0.19745 0.652 0.004 0.020 0.192 0.132
#> SRR1304003     1  0.5862    0.22165 0.664 0.004 0.020 0.192 0.120
#> SRR1304006     1  0.0968    0.60571 0.972 0.012 0.004 0.012 0.000
#> SRR1304007     1  0.0968    0.60571 0.972 0.012 0.004 0.012 0.000
#> SRR1304008     5  0.3263    0.82941 0.004 0.004 0.088 0.044 0.860
#> SRR1304009     5  0.3263    0.82941 0.004 0.004 0.088 0.044 0.860
#> SRR1304010     1  0.5216    0.20998 0.668 0.000 0.004 0.248 0.080
#> SRR1304011     1  0.5216    0.20998 0.668 0.000 0.004 0.248 0.080
#> SRR1304012     5  0.2237    0.83090 0.004 0.000 0.084 0.008 0.904
#> SRR1304013     5  0.2237    0.83090 0.004 0.000 0.084 0.008 0.904
#> SRR1304014     5  0.5326    0.72501 0.080 0.004 0.088 0.080 0.748
#> SRR1304015     5  0.3105    0.82916 0.004 0.000 0.088 0.044 0.864
#> SRR1304016     1  0.0510    0.60200 0.984 0.000 0.000 0.016 0.000
#> SRR1304017     4  0.7991    0.64369 0.276 0.096 0.000 0.396 0.232
#> SRR1304018     1  0.6789   -0.59428 0.472 0.080 0.000 0.388 0.060
#> SRR1304019     5  0.1952    0.83202 0.004 0.000 0.084 0.000 0.912
#> SRR1304020     5  0.1952    0.83202 0.004 0.000 0.084 0.000 0.912
#> SRR1304021     1  0.7052   -0.25888 0.444 0.004 0.016 0.196 0.340
#> SRR1304022     1  0.6066   -0.48905 0.464 0.092 0.000 0.436 0.008
#> SRR1304024     1  0.6021   -0.45925 0.476 0.088 0.000 0.428 0.008
#> SRR1304023     5  0.4669    0.57358 0.000 0.012 0.008 0.352 0.628
#> SRR1304026     2  0.4571    0.66557 0.048 0.772 0.004 0.156 0.020
#> SRR1304027     2  0.4571    0.66557 0.048 0.772 0.004 0.156 0.020
#> SRR1304025     1  0.4400    0.21422 0.672 0.020 0.000 0.308 0.000
#> SRR1304028     2  0.6346    0.39862 0.168 0.568 0.000 0.252 0.012
#> SRR1304029     2  0.6346    0.39862 0.168 0.568 0.000 0.252 0.012
#> SRR1304030     1  0.1179    0.60386 0.964 0.016 0.004 0.016 0.000
#> SRR1304031     1  0.1179    0.60386 0.964 0.016 0.004 0.016 0.000
#> SRR1304032     2  0.3593    0.72970 0.084 0.828 0.000 0.088 0.000
#> SRR1304033     2  0.3593    0.72970 0.084 0.828 0.000 0.088 0.000
#> SRR1304034     2  0.3353    0.73979 0.196 0.796 0.000 0.008 0.000
#> SRR1304035     2  0.3353    0.73979 0.196 0.796 0.000 0.008 0.000
#> SRR1304036     2  0.4422    0.63766 0.320 0.664 0.004 0.012 0.000
#> SRR1304037     2  0.4422    0.63766 0.320 0.664 0.004 0.012 0.000
#> SRR1304038     1  0.5159    0.12221 0.640 0.000 0.004 0.300 0.056
#> SRR1304039     1  0.5159    0.12221 0.640 0.000 0.004 0.300 0.056
#> SRR1304040     1  0.4550    0.41850 0.744 0.064 0.000 0.188 0.004
#> SRR1304041     1  0.4550    0.41850 0.744 0.064 0.000 0.188 0.004
#> SRR1304042     1  0.7197    0.00212 0.464 0.312 0.012 0.196 0.016
#> SRR1304043     1  0.7197    0.00212 0.464 0.312 0.012 0.196 0.016
#> SRR1304046     1  0.6003    0.11505 0.620 0.004 0.004 0.180 0.192
#> SRR1304047     1  0.6003    0.11505 0.620 0.004 0.004 0.180 0.192
#> SRR1304044     4  0.7542    0.79283 0.376 0.172 0.000 0.388 0.064
#> SRR1304045     4  0.7542    0.79283 0.376 0.172 0.000 0.388 0.064
#> SRR1304048     1  0.2074    0.55628 0.896 0.000 0.000 0.104 0.000
#> SRR1304049     1  0.2074    0.55628 0.896 0.000 0.000 0.104 0.000
#> SRR1304050     1  0.6960   -0.21587 0.480 0.004 0.016 0.192 0.308
#> SRR1304051     1  0.0290    0.60254 0.992 0.000 0.000 0.008 0.000
#> SRR1304052     1  0.0609    0.59936 0.980 0.000 0.000 0.020 0.000
#> SRR1304053     1  0.0671    0.60145 0.980 0.000 0.004 0.016 0.000
#> SRR1304055     1  0.2390    0.58321 0.908 0.044 0.000 0.044 0.004
#> SRR1304054     1  0.3693    0.52225 0.828 0.080 0.000 0.088 0.004
#> SRR1304056     1  0.1900    0.59225 0.936 0.024 0.004 0.032 0.004
#> SRR1304059     1  0.1900    0.59225 0.936 0.024 0.004 0.032 0.004
#> SRR1304057     1  0.0968    0.60571 0.972 0.012 0.004 0.012 0.000
#> SRR1304058     1  0.3475    0.52292 0.848 0.056 0.004 0.088 0.004
#> SRR1304060     1  0.0968    0.60571 0.972 0.012 0.004 0.012 0.000
#> SRR1304061     1  0.1989    0.58995 0.932 0.028 0.004 0.032 0.004

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>            class entropy silhouette    p1    p2    p3    p4    p5    p6
#> SRR1303990     5  0.4444    -0.6761 0.000 0.000 0.028 0.000 0.536 0.436
#> SRR1303991     5  0.4444    -0.6761 0.000 0.000 0.028 0.000 0.536 0.436
#> SRR1303992     3  0.1579     0.9239 0.004 0.000 0.944 0.024 0.008 0.020
#> SRR1303993     3  0.1579     0.9239 0.004 0.000 0.944 0.024 0.008 0.020
#> SRR1303994     3  0.1912     0.9273 0.008 0.012 0.932 0.012 0.004 0.032
#> SRR1303995     3  0.1912     0.9273 0.008 0.012 0.932 0.012 0.004 0.032
#> SRR1303996     3  0.2882     0.9117 0.004 0.008 0.872 0.024 0.008 0.084
#> SRR1303997     3  0.2882     0.9117 0.004 0.008 0.872 0.024 0.008 0.084
#> SRR1303998     3  0.2525     0.9195 0.004 0.004 0.892 0.020 0.008 0.072
#> SRR1303999     3  0.2525     0.9195 0.004 0.004 0.892 0.020 0.008 0.072
#> SRR1304000     3  0.1755     0.9283 0.008 0.012 0.940 0.012 0.004 0.024
#> SRR1304001     3  0.1755     0.9283 0.008 0.012 0.940 0.012 0.004 0.024
#> SRR1304004     5  0.4728     0.4277 0.140 0.000 0.036 0.060 0.748 0.016
#> SRR1304005     5  0.4728     0.4277 0.140 0.000 0.036 0.060 0.748 0.016
#> SRR1304002     1  0.6472    -0.0708 0.480 0.000 0.004 0.272 0.216 0.028
#> SRR1304003     1  0.6416    -0.0560 0.492 0.000 0.004 0.272 0.204 0.028
#> SRR1304006     1  0.0291     0.6564 0.992 0.000 0.004 0.004 0.000 0.000
#> SRR1304007     1  0.0291     0.6564 0.992 0.000 0.004 0.004 0.000 0.000
#> SRR1304008     5  0.0964     0.4748 0.004 0.000 0.016 0.012 0.968 0.000
#> SRR1304009     5  0.0964     0.4748 0.004 0.000 0.016 0.012 0.968 0.000
#> SRR1304010     1  0.6254    -0.2056 0.476 0.004 0.000 0.356 0.132 0.032
#> SRR1304011     1  0.6254    -0.2056 0.476 0.004 0.000 0.356 0.132 0.032
#> SRR1304012     5  0.2036     0.3785 0.000 0.000 0.016 0.008 0.912 0.064
#> SRR1304013     5  0.2036     0.3785 0.000 0.000 0.016 0.008 0.912 0.064
#> SRR1304014     5  0.4289     0.4333 0.088 0.000 0.016 0.092 0.784 0.020
#> SRR1304015     5  0.0964     0.4748 0.004 0.000 0.016 0.012 0.968 0.000
#> SRR1304016     1  0.0713     0.6492 0.972 0.000 0.000 0.028 0.000 0.000
#> SRR1304017     4  0.5278     0.6064 0.100 0.016 0.000 0.708 0.132 0.044
#> SRR1304018     4  0.4391     0.6912 0.208 0.012 0.000 0.728 0.044 0.008
#> SRR1304019     5  0.1409     0.4266 0.000 0.000 0.012 0.008 0.948 0.032
#> SRR1304020     5  0.1003     0.4447 0.000 0.000 0.016 0.000 0.964 0.020
#> SRR1304021     5  0.6624    -0.2220 0.308 0.000 0.000 0.280 0.384 0.028
#> SRR1304022     4  0.4436     0.6627 0.216 0.012 0.000 0.712 0.000 0.060
#> SRR1304024     4  0.4460     0.6621 0.216 0.012 0.004 0.716 0.000 0.052
#> SRR1304023     6  0.5479     0.0000 0.000 0.004 0.000 0.108 0.416 0.472
#> SRR1304026     2  0.4669     0.6075 0.028 0.744 0.004 0.072 0.004 0.148
#> SRR1304027     2  0.4565     0.6075 0.028 0.744 0.004 0.072 0.000 0.152
#> SRR1304025     4  0.4584     0.3239 0.444 0.000 0.004 0.524 0.000 0.028
#> SRR1304028     2  0.6365     0.4915 0.060 0.508 0.000 0.336 0.012 0.084
#> SRR1304029     2  0.6365     0.4915 0.060 0.508 0.000 0.336 0.012 0.084
#> SRR1304030     1  0.0291     0.6565 0.992 0.000 0.004 0.004 0.000 0.000
#> SRR1304031     1  0.0291     0.6565 0.992 0.000 0.004 0.004 0.000 0.000
#> SRR1304032     2  0.3858     0.6875 0.024 0.792 0.000 0.136 0.000 0.048
#> SRR1304033     2  0.3858     0.6875 0.024 0.792 0.000 0.136 0.000 0.048
#> SRR1304034     2  0.3174     0.7145 0.104 0.836 0.000 0.056 0.000 0.004
#> SRR1304035     2  0.3174     0.7145 0.104 0.836 0.000 0.056 0.000 0.004
#> SRR1304036     2  0.4416     0.6036 0.288 0.668 0.000 0.032 0.000 0.012
#> SRR1304037     2  0.4416     0.6036 0.288 0.668 0.000 0.032 0.000 0.012
#> SRR1304038     4  0.5701     0.3747 0.408 0.000 0.000 0.480 0.088 0.024
#> SRR1304039     4  0.5666     0.3710 0.412 0.000 0.000 0.480 0.084 0.024
#> SRR1304040     1  0.4877     0.1644 0.596 0.008 0.004 0.348 0.000 0.044
#> SRR1304041     1  0.4877     0.1644 0.596 0.008 0.004 0.348 0.000 0.044
#> SRR1304042     1  0.7715    -0.0883 0.364 0.248 0.008 0.204 0.000 0.176
#> SRR1304043     1  0.7715    -0.0883 0.364 0.248 0.008 0.204 0.000 0.176
#> SRR1304046     1  0.6402    -0.1074 0.456 0.000 0.000 0.276 0.244 0.024
#> SRR1304047     1  0.6402    -0.1074 0.456 0.000 0.000 0.276 0.244 0.024
#> SRR1304044     4  0.5913     0.6416 0.136 0.088 0.000 0.672 0.056 0.048
#> SRR1304045     4  0.5913     0.6416 0.136 0.088 0.000 0.672 0.056 0.048
#> SRR1304048     1  0.3213     0.4924 0.784 0.000 0.004 0.204 0.000 0.008
#> SRR1304049     1  0.3213     0.4924 0.784 0.000 0.004 0.204 0.000 0.008
#> SRR1304050     5  0.6621    -0.2406 0.340 0.000 0.000 0.264 0.368 0.028
#> SRR1304051     1  0.1007     0.6426 0.956 0.000 0.000 0.044 0.000 0.000
#> SRR1304052     1  0.1141     0.6380 0.948 0.000 0.000 0.052 0.000 0.000
#> SRR1304053     1  0.1075     0.6402 0.952 0.000 0.000 0.048 0.000 0.000
#> SRR1304055     1  0.2696     0.6204 0.884 0.044 0.004 0.056 0.000 0.012
#> SRR1304054     1  0.4646     0.4811 0.732 0.088 0.004 0.156 0.000 0.020
#> SRR1304056     1  0.0976     0.6485 0.968 0.008 0.000 0.016 0.000 0.008
#> SRR1304059     1  0.1167     0.6452 0.960 0.008 0.000 0.020 0.000 0.012
#> SRR1304057     1  0.0000     0.6559 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR1304058     1  0.2843     0.5875 0.876 0.048 0.000 0.044 0.000 0.032
#> SRR1304060     1  0.0436     0.6564 0.988 0.000 0.004 0.004 0.000 0.004
#> SRR1304061     1  0.1269     0.6429 0.956 0.012 0.000 0.020 0.000 0.012

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

consensus_heatmap(res, k = 2)

plot of chunk tab-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 15595 rows and 72 columns.
#>   Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'CV' method.
#>   Subgroups are detected by 'skmeans' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 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.935       0.975         0.5005 0.495   0.495
#> 3 3 0.734           0.728       0.884         0.3264 0.755   0.542
#> 4 4 0.616           0.646       0.809         0.1229 0.787   0.466
#> 5 5 0.767           0.764       0.880         0.0798 0.898   0.629
#> 6 6 0.773           0.702       0.797         0.0361 0.956   0.787

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
#> SRR1303990     1   0.000      0.944 1.000 0.000
#> SRR1303991     1   0.000      0.944 1.000 0.000
#> SRR1303992     1   0.000      0.944 1.000 0.000
#> SRR1303993     1   0.000      0.944 1.000 0.000
#> SRR1303994     1   0.000      0.944 1.000 0.000
#> SRR1303995     1   0.000      0.944 1.000 0.000
#> SRR1303996     1   0.000      0.944 1.000 0.000
#> SRR1303997     1   0.000      0.944 1.000 0.000
#> SRR1303998     1   0.000      0.944 1.000 0.000
#> SRR1303999     1   0.000      0.944 1.000 0.000
#> SRR1304000     1   0.000      0.944 1.000 0.000
#> SRR1304001     1   0.000      0.944 1.000 0.000
#> SRR1304004     1   0.000      0.944 1.000 0.000
#> SRR1304005     1   0.000      0.944 1.000 0.000
#> SRR1304002     1   0.000      0.944 1.000 0.000
#> SRR1304003     1   0.000      0.944 1.000 0.000
#> SRR1304006     2   0.000      1.000 0.000 1.000
#> SRR1304007     2   0.000      1.000 0.000 1.000
#> SRR1304008     1   0.000      0.944 1.000 0.000
#> SRR1304009     1   0.000      0.944 1.000 0.000
#> SRR1304010     1   0.000      0.944 1.000 0.000
#> SRR1304011     1   0.000      0.944 1.000 0.000
#> SRR1304012     1   0.000      0.944 1.000 0.000
#> SRR1304013     1   0.000      0.944 1.000 0.000
#> SRR1304014     1   0.000      0.944 1.000 0.000
#> SRR1304015     1   0.000      0.944 1.000 0.000
#> SRR1304016     2   0.000      1.000 0.000 1.000
#> SRR1304017     1   0.000      0.944 1.000 0.000
#> SRR1304018     2   0.000      1.000 0.000 1.000
#> SRR1304019     1   0.000      0.944 1.000 0.000
#> SRR1304020     1   0.000      0.944 1.000 0.000
#> SRR1304021     1   0.000      0.944 1.000 0.000
#> SRR1304022     2   0.000      1.000 0.000 1.000
#> SRR1304024     2   0.000      1.000 0.000 1.000
#> SRR1304023     1   0.000      0.944 1.000 0.000
#> SRR1304026     2   0.000      1.000 0.000 1.000
#> SRR1304027     2   0.000      1.000 0.000 1.000
#> SRR1304025     2   0.000      1.000 0.000 1.000
#> SRR1304028     2   0.000      1.000 0.000 1.000
#> SRR1304029     2   0.000      1.000 0.000 1.000
#> SRR1304030     2   0.000      1.000 0.000 1.000
#> SRR1304031     2   0.000      1.000 0.000 1.000
#> SRR1304032     2   0.000      1.000 0.000 1.000
#> SRR1304033     2   0.000      1.000 0.000 1.000
#> SRR1304034     2   0.000      1.000 0.000 1.000
#> SRR1304035     2   0.000      1.000 0.000 1.000
#> SRR1304036     2   0.000      1.000 0.000 1.000
#> SRR1304037     2   0.000      1.000 0.000 1.000
#> SRR1304038     1   0.995      0.222 0.540 0.460
#> SRR1304039     1   1.000      0.117 0.508 0.492
#> SRR1304040     2   0.000      1.000 0.000 1.000
#> SRR1304041     2   0.000      1.000 0.000 1.000
#> SRR1304042     2   0.000      1.000 0.000 1.000
#> SRR1304043     2   0.000      1.000 0.000 1.000
#> SRR1304046     1   0.981      0.333 0.580 0.420
#> SRR1304047     1   0.981      0.333 0.580 0.420
#> SRR1304044     2   0.000      1.000 0.000 1.000
#> SRR1304045     2   0.000      1.000 0.000 1.000
#> SRR1304048     2   0.000      1.000 0.000 1.000
#> SRR1304049     2   0.000      1.000 0.000 1.000
#> SRR1304050     1   0.000      0.944 1.000 0.000
#> SRR1304051     2   0.000      1.000 0.000 1.000
#> SRR1304052     2   0.000      1.000 0.000 1.000
#> SRR1304053     2   0.000      1.000 0.000 1.000
#> SRR1304055     2   0.000      1.000 0.000 1.000
#> SRR1304054     2   0.000      1.000 0.000 1.000
#> SRR1304056     2   0.000      1.000 0.000 1.000
#> SRR1304059     2   0.000      1.000 0.000 1.000
#> SRR1304057     2   0.000      1.000 0.000 1.000
#> SRR1304058     2   0.000      1.000 0.000 1.000
#> SRR1304060     2   0.000      1.000 0.000 1.000
#> SRR1304061     2   0.000      1.000 0.000 1.000

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>            class entropy silhouette    p1    p2    p3
#> SRR1303990     3  0.0424     0.9532 0.000 0.008 0.992
#> SRR1303991     3  0.0424     0.9532 0.000 0.008 0.992
#> SRR1303992     3  0.1031     0.9489 0.024 0.000 0.976
#> SRR1303993     3  0.1163     0.9478 0.028 0.000 0.972
#> SRR1303994     3  0.1529     0.9431 0.040 0.000 0.960
#> SRR1303995     3  0.1529     0.9431 0.040 0.000 0.960
#> SRR1303996     3  0.1411     0.9452 0.036 0.000 0.964
#> SRR1303997     3  0.1411     0.9452 0.036 0.000 0.964
#> SRR1303998     3  0.1411     0.9452 0.036 0.000 0.964
#> SRR1303999     3  0.1411     0.9452 0.036 0.000 0.964
#> SRR1304000     3  0.1529     0.9431 0.040 0.000 0.960
#> SRR1304001     3  0.1529     0.9431 0.040 0.000 0.960
#> SRR1304004     3  0.0000     0.9525 0.000 0.000 1.000
#> SRR1304005     3  0.0000     0.9525 0.000 0.000 1.000
#> SRR1304002     3  0.0592     0.9522 0.000 0.012 0.988
#> SRR1304003     3  0.2939     0.8891 0.072 0.012 0.916
#> SRR1304006     1  0.0424     0.7702 0.992 0.000 0.008
#> SRR1304007     1  0.0424     0.7702 0.992 0.000 0.008
#> SRR1304008     3  0.0424     0.9532 0.000 0.008 0.992
#> SRR1304009     3  0.0424     0.9532 0.000 0.008 0.992
#> SRR1304010     3  0.9584    -0.0498 0.200 0.372 0.428
#> SRR1304011     2  0.9946     0.0465 0.284 0.368 0.348
#> SRR1304012     3  0.0424     0.9532 0.000 0.008 0.992
#> SRR1304013     3  0.0424     0.9532 0.000 0.008 0.992
#> SRR1304014     3  0.0424     0.9532 0.000 0.008 0.992
#> SRR1304015     3  0.0424     0.9532 0.000 0.008 0.992
#> SRR1304016     1  0.0237     0.7722 0.996 0.004 0.000
#> SRR1304017     2  0.0237     0.8108 0.000 0.996 0.004
#> SRR1304018     2  0.0000     0.8129 0.000 1.000 0.000
#> SRR1304019     3  0.0592     0.9521 0.000 0.012 0.988
#> SRR1304020     3  0.0424     0.9532 0.000 0.008 0.992
#> SRR1304021     3  0.1031     0.9461 0.000 0.024 0.976
#> SRR1304022     2  0.0424     0.8146 0.008 0.992 0.000
#> SRR1304024     2  0.1529     0.8054 0.040 0.960 0.000
#> SRR1304023     3  0.3686     0.8292 0.000 0.140 0.860
#> SRR1304026     2  0.3116     0.7695 0.108 0.892 0.000
#> SRR1304027     2  0.3116     0.7695 0.108 0.892 0.000
#> SRR1304025     2  0.5650     0.4633 0.312 0.688 0.000
#> SRR1304028     2  0.0592     0.8151 0.012 0.988 0.000
#> SRR1304029     2  0.0592     0.8151 0.012 0.988 0.000
#> SRR1304030     1  0.0000     0.7729 1.000 0.000 0.000
#> SRR1304031     1  0.0000     0.7729 1.000 0.000 0.000
#> SRR1304032     2  0.0892     0.8144 0.020 0.980 0.000
#> SRR1304033     2  0.0892     0.8144 0.020 0.980 0.000
#> SRR1304034     2  0.4346     0.6964 0.184 0.816 0.000
#> SRR1304035     2  0.4346     0.6964 0.184 0.816 0.000
#> SRR1304036     1  0.6225     0.1840 0.568 0.432 0.000
#> SRR1304037     1  0.6225     0.1840 0.568 0.432 0.000
#> SRR1304038     2  0.5722     0.4908 0.292 0.704 0.004
#> SRR1304039     2  0.5656     0.5050 0.284 0.712 0.004
#> SRR1304040     1  0.6309     0.0205 0.504 0.496 0.000
#> SRR1304041     1  0.6308     0.0364 0.508 0.492 0.000
#> SRR1304042     1  0.5859     0.4160 0.656 0.344 0.000
#> SRR1304043     1  0.5859     0.4160 0.656 0.344 0.000
#> SRR1304046     1  0.8743     0.1487 0.452 0.108 0.440
#> SRR1304047     1  0.8637     0.1401 0.456 0.100 0.444
#> SRR1304044     2  0.0000     0.8129 0.000 1.000 0.000
#> SRR1304045     2  0.0000     0.8129 0.000 1.000 0.000
#> SRR1304048     1  0.4452     0.6487 0.808 0.192 0.000
#> SRR1304049     1  0.4235     0.6643 0.824 0.176 0.000
#> SRR1304050     3  0.0747     0.9506 0.000 0.016 0.984
#> SRR1304051     1  0.0237     0.7722 0.996 0.004 0.000
#> SRR1304052     1  0.1964     0.7498 0.944 0.056 0.000
#> SRR1304053     1  0.0848     0.7682 0.984 0.008 0.008
#> SRR1304055     1  0.5327     0.5342 0.728 0.272 0.000
#> SRR1304054     2  0.6126     0.3061 0.400 0.600 0.000
#> SRR1304056     1  0.0000     0.7729 1.000 0.000 0.000
#> SRR1304059     1  0.0000     0.7729 1.000 0.000 0.000
#> SRR1304057     1  0.0000     0.7729 1.000 0.000 0.000
#> SRR1304058     1  0.0000     0.7729 1.000 0.000 0.000
#> SRR1304060     1  0.0424     0.7702 0.992 0.000 0.008
#> SRR1304061     1  0.0000     0.7729 1.000 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> SRR1303990     4  0.4543     0.6118 0.000 0.000 0.324 0.676
#> SRR1303991     4  0.4564     0.6059 0.000 0.000 0.328 0.672
#> SRR1303992     3  0.0000     0.8883 0.000 0.000 1.000 0.000
#> SRR1303993     3  0.0000     0.8883 0.000 0.000 1.000 0.000
#> SRR1303994     3  0.0000     0.8883 0.000 0.000 1.000 0.000
#> SRR1303995     3  0.0188     0.8856 0.004 0.000 0.996 0.000
#> SRR1303996     3  0.0000     0.8883 0.000 0.000 1.000 0.000
#> SRR1303997     3  0.0000     0.8883 0.000 0.000 1.000 0.000
#> SRR1303998     3  0.0000     0.8883 0.000 0.000 1.000 0.000
#> SRR1303999     3  0.0000     0.8883 0.000 0.000 1.000 0.000
#> SRR1304000     3  0.0188     0.8856 0.004 0.000 0.996 0.000
#> SRR1304001     3  0.0188     0.8856 0.004 0.000 0.996 0.000
#> SRR1304004     4  0.4972     0.3261 0.000 0.000 0.456 0.544
#> SRR1304005     3  0.4992    -0.2206 0.000 0.000 0.524 0.476
#> SRR1304002     4  0.5158     0.1293 0.000 0.004 0.472 0.524
#> SRR1304003     3  0.5776    -0.0156 0.028 0.000 0.504 0.468
#> SRR1304006     1  0.1637     0.8812 0.940 0.000 0.060 0.000
#> SRR1304007     1  0.1637     0.8812 0.940 0.000 0.060 0.000
#> SRR1304008     4  0.3356     0.7564 0.000 0.000 0.176 0.824
#> SRR1304009     4  0.3400     0.7542 0.000 0.000 0.180 0.820
#> SRR1304010     4  0.6125     0.5076 0.080 0.096 0.080 0.744
#> SRR1304011     4  0.6651     0.4764 0.112 0.100 0.080 0.708
#> SRR1304012     4  0.3356     0.7564 0.000 0.000 0.176 0.824
#> SRR1304013     4  0.3356     0.7564 0.000 0.000 0.176 0.824
#> SRR1304014     4  0.3356     0.7564 0.000 0.000 0.176 0.824
#> SRR1304015     4  0.3356     0.7564 0.000 0.000 0.176 0.824
#> SRR1304016     1  0.0376     0.8831 0.992 0.004 0.004 0.000
#> SRR1304017     4  0.6071    -0.2345 0.044 0.452 0.000 0.504
#> SRR1304018     2  0.5365     0.6016 0.044 0.692 0.000 0.264
#> SRR1304019     4  0.3356     0.7564 0.000 0.000 0.176 0.824
#> SRR1304020     4  0.3356     0.7564 0.000 0.000 0.176 0.824
#> SRR1304021     4  0.1743     0.7074 0.000 0.004 0.056 0.940
#> SRR1304022     2  0.4713     0.6740 0.052 0.776 0.000 0.172
#> SRR1304024     2  0.5678     0.6569 0.112 0.716 0.000 0.172
#> SRR1304023     4  0.5020     0.7109 0.004 0.052 0.184 0.760
#> SRR1304026     2  0.1940     0.6953 0.076 0.924 0.000 0.000
#> SRR1304027     2  0.1940     0.6953 0.076 0.924 0.000 0.000
#> SRR1304025     2  0.6916     0.5605 0.236 0.588 0.000 0.176
#> SRR1304028     2  0.1256     0.7058 0.008 0.964 0.000 0.028
#> SRR1304029     2  0.1256     0.7058 0.008 0.964 0.000 0.028
#> SRR1304030     1  0.1629     0.8930 0.952 0.024 0.024 0.000
#> SRR1304031     1  0.1629     0.8930 0.952 0.024 0.024 0.000
#> SRR1304032     2  0.0592     0.7045 0.016 0.984 0.000 0.000
#> SRR1304033     2  0.0592     0.7045 0.016 0.984 0.000 0.000
#> SRR1304034     2  0.2647     0.6770 0.120 0.880 0.000 0.000
#> SRR1304035     2  0.2647     0.6770 0.120 0.880 0.000 0.000
#> SRR1304036     2  0.4866     0.3016 0.404 0.596 0.000 0.000
#> SRR1304037     2  0.4898     0.2721 0.416 0.584 0.000 0.000
#> SRR1304038     2  0.7817     0.3454 0.168 0.420 0.012 0.400
#> SRR1304039     2  0.7563     0.4028 0.168 0.452 0.004 0.376
#> SRR1304040     2  0.6434     0.3356 0.432 0.500 0.000 0.068
#> SRR1304041     1  0.6149    -0.3018 0.480 0.472 0.000 0.048
#> SRR1304042     2  0.5212     0.3421 0.420 0.572 0.000 0.008
#> SRR1304043     2  0.5212     0.3421 0.420 0.572 0.000 0.008
#> SRR1304046     4  0.4526     0.5897 0.160 0.024 0.016 0.800
#> SRR1304047     4  0.4193     0.5832 0.184 0.004 0.016 0.796
#> SRR1304044     2  0.4462     0.6714 0.044 0.792 0.000 0.164
#> SRR1304045     2  0.4507     0.6699 0.044 0.788 0.000 0.168
#> SRR1304048     1  0.3597     0.7051 0.836 0.148 0.000 0.016
#> SRR1304049     1  0.3447     0.7306 0.852 0.128 0.000 0.020
#> SRR1304050     4  0.2760     0.7441 0.000 0.000 0.128 0.872
#> SRR1304051     1  0.0672     0.8833 0.984 0.008 0.008 0.000
#> SRR1304052     1  0.0921     0.8650 0.972 0.028 0.000 0.000
#> SRR1304053     1  0.1211     0.8882 0.960 0.000 0.040 0.000
#> SRR1304055     2  0.5163     0.1827 0.480 0.516 0.000 0.004
#> SRR1304054     2  0.3764     0.6239 0.216 0.784 0.000 0.000
#> SRR1304056     1  0.1520     0.8925 0.956 0.024 0.020 0.000
#> SRR1304059     1  0.1520     0.8925 0.956 0.024 0.020 0.000
#> SRR1304057     1  0.1520     0.8925 0.956 0.024 0.020 0.000
#> SRR1304058     1  0.1661     0.8763 0.944 0.052 0.004 0.000
#> SRR1304060     1  0.1637     0.8812 0.940 0.000 0.060 0.000
#> SRR1304061     1  0.2011     0.8525 0.920 0.080 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>            class entropy silhouette    p1    p2    p3    p4    p5
#> SRR1303990     5  0.2358     0.8214 0.000 0.000 0.104 0.008 0.888
#> SRR1303991     5  0.2358     0.8214 0.000 0.000 0.104 0.008 0.888
#> SRR1303992     3  0.0162     0.9419 0.000 0.000 0.996 0.000 0.004
#> SRR1303993     3  0.0162     0.9419 0.000 0.000 0.996 0.000 0.004
#> SRR1303994     3  0.0162     0.9419 0.000 0.000 0.996 0.000 0.004
#> SRR1303995     3  0.0162     0.9419 0.000 0.000 0.996 0.000 0.004
#> SRR1303996     3  0.0162     0.9419 0.000 0.000 0.996 0.000 0.004
#> SRR1303997     3  0.0162     0.9419 0.000 0.000 0.996 0.000 0.004
#> SRR1303998     3  0.0162     0.9419 0.000 0.000 0.996 0.000 0.004
#> SRR1303999     3  0.0162     0.9419 0.000 0.000 0.996 0.000 0.004
#> SRR1304000     3  0.0162     0.9419 0.000 0.000 0.996 0.000 0.004
#> SRR1304001     3  0.0162     0.9419 0.000 0.000 0.996 0.000 0.004
#> SRR1304004     5  0.3109     0.7365 0.000 0.000 0.200 0.000 0.800
#> SRR1304005     5  0.3707     0.6249 0.000 0.000 0.284 0.000 0.716
#> SRR1304002     5  0.6160     0.2693 0.000 0.004 0.360 0.124 0.512
#> SRR1304003     3  0.7028    -0.0214 0.008 0.004 0.408 0.228 0.352
#> SRR1304006     1  0.0451     0.9016 0.988 0.000 0.004 0.008 0.000
#> SRR1304007     1  0.0324     0.9022 0.992 0.000 0.004 0.004 0.000
#> SRR1304008     5  0.0290     0.8612 0.000 0.000 0.008 0.000 0.992
#> SRR1304009     5  0.0510     0.8597 0.000 0.000 0.016 0.000 0.984
#> SRR1304010     4  0.5091     0.5968 0.044 0.004 0.008 0.672 0.272
#> SRR1304011     4  0.6004     0.5939 0.072 0.004 0.036 0.636 0.252
#> SRR1304012     5  0.0000     0.8617 0.000 0.000 0.000 0.000 1.000
#> SRR1304013     5  0.0000     0.8617 0.000 0.000 0.000 0.000 1.000
#> SRR1304014     5  0.0000     0.8617 0.000 0.000 0.000 0.000 1.000
#> SRR1304015     5  0.0000     0.8617 0.000 0.000 0.000 0.000 1.000
#> SRR1304016     1  0.0955     0.8905 0.968 0.004 0.000 0.028 0.000
#> SRR1304017     4  0.4709     0.6846 0.000 0.068 0.004 0.728 0.200
#> SRR1304018     4  0.3497     0.7383 0.000 0.112 0.004 0.836 0.048
#> SRR1304019     5  0.0000     0.8617 0.000 0.000 0.000 0.000 1.000
#> SRR1304020     5  0.0000     0.8617 0.000 0.000 0.000 0.000 1.000
#> SRR1304021     5  0.0671     0.8570 0.000 0.000 0.004 0.016 0.980
#> SRR1304022     4  0.2179     0.7481 0.000 0.100 0.004 0.896 0.000
#> SRR1304024     4  0.0880     0.7610 0.000 0.032 0.000 0.968 0.000
#> SRR1304023     5  0.3597     0.6843 0.000 0.012 0.008 0.180 0.800
#> SRR1304026     2  0.0290     0.8466 0.008 0.992 0.000 0.000 0.000
#> SRR1304027     2  0.0290     0.8466 0.008 0.992 0.000 0.000 0.000
#> SRR1304025     4  0.0912     0.7602 0.016 0.012 0.000 0.972 0.000
#> SRR1304028     2  0.3003     0.6785 0.000 0.812 0.000 0.188 0.000
#> SRR1304029     2  0.3003     0.6785 0.000 0.812 0.000 0.188 0.000
#> SRR1304030     1  0.0290     0.9026 0.992 0.008 0.000 0.000 0.000
#> SRR1304031     1  0.0290     0.9026 0.992 0.008 0.000 0.000 0.000
#> SRR1304032     2  0.0404     0.8417 0.000 0.988 0.000 0.012 0.000
#> SRR1304033     2  0.0404     0.8417 0.000 0.988 0.000 0.012 0.000
#> SRR1304034     2  0.0404     0.8466 0.012 0.988 0.000 0.000 0.000
#> SRR1304035     2  0.0404     0.8466 0.012 0.988 0.000 0.000 0.000
#> SRR1304036     2  0.1341     0.8349 0.056 0.944 0.000 0.000 0.000
#> SRR1304037     2  0.1478     0.8311 0.064 0.936 0.000 0.000 0.000
#> SRR1304038     4  0.0807     0.7604 0.012 0.012 0.000 0.976 0.000
#> SRR1304039     4  0.1074     0.7598 0.016 0.012 0.000 0.968 0.004
#> SRR1304040     4  0.5233     0.5742 0.168 0.148 0.000 0.684 0.000
#> SRR1304041     4  0.5414     0.5472 0.200 0.140 0.000 0.660 0.000
#> SRR1304042     2  0.5604     0.5497 0.132 0.628 0.000 0.240 0.000
#> SRR1304043     2  0.5580     0.5561 0.132 0.632 0.000 0.236 0.000
#> SRR1304046     5  0.5355     0.5171 0.044 0.016 0.000 0.316 0.624
#> SRR1304047     5  0.5205     0.5287 0.048 0.008 0.000 0.312 0.632
#> SRR1304044     4  0.4101     0.4779 0.000 0.372 0.000 0.628 0.000
#> SRR1304045     4  0.4088     0.4850 0.000 0.368 0.000 0.632 0.000
#> SRR1304048     1  0.4841     0.2255 0.560 0.024 0.000 0.416 0.000
#> SRR1304049     1  0.4841     0.2231 0.560 0.024 0.000 0.416 0.000
#> SRR1304050     5  0.0955     0.8535 0.000 0.004 0.000 0.028 0.968
#> SRR1304051     1  0.0290     0.9016 0.992 0.000 0.000 0.008 0.000
#> SRR1304052     1  0.1410     0.8699 0.940 0.000 0.000 0.060 0.000
#> SRR1304053     1  0.0000     0.9025 1.000 0.000 0.000 0.000 0.000
#> SRR1304055     2  0.5043     0.6497 0.160 0.704 0.000 0.136 0.000
#> SRR1304054     2  0.2853     0.7985 0.052 0.876 0.000 0.072 0.000
#> SRR1304056     1  0.0404     0.9018 0.988 0.012 0.000 0.000 0.000
#> SRR1304059     1  0.0404     0.9018 0.988 0.012 0.000 0.000 0.000
#> SRR1304057     1  0.0290     0.9027 0.992 0.008 0.000 0.000 0.000
#> SRR1304058     1  0.2068     0.8409 0.904 0.092 0.000 0.004 0.000
#> SRR1304060     1  0.0162     0.9023 0.996 0.000 0.004 0.000 0.000
#> SRR1304061     1  0.2971     0.7656 0.836 0.156 0.000 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
#> SRR1303990     5  0.2651      0.763 0.000 0.000 0.088 0.004 0.872 0.036
#> SRR1303991     5  0.2800      0.749 0.000 0.000 0.100 0.004 0.860 0.036
#> SRR1303992     3  0.0000      0.999 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1303993     3  0.0000      0.999 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1303994     3  0.0000      0.999 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1303995     3  0.0146      0.997 0.000 0.000 0.996 0.000 0.000 0.004
#> SRR1303996     3  0.0000      0.999 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1303997     3  0.0000      0.999 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1303998     3  0.0000      0.999 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1303999     3  0.0000      0.999 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1304000     3  0.0146      0.997 0.000 0.000 0.996 0.000 0.000 0.004
#> SRR1304001     3  0.0146      0.997 0.000 0.000 0.996 0.000 0.000 0.004
#> SRR1304004     5  0.3293      0.676 0.000 0.000 0.140 0.000 0.812 0.048
#> SRR1304005     5  0.4050      0.477 0.000 0.000 0.236 0.000 0.716 0.048
#> SRR1304002     6  0.6821      0.604 0.000 0.000 0.220 0.056 0.308 0.416
#> SRR1304003     6  0.6761      0.589 0.000 0.000 0.208 0.088 0.204 0.500
#> SRR1304006     1  0.0891      0.920 0.968 0.000 0.008 0.000 0.000 0.024
#> SRR1304007     1  0.0717      0.920 0.976 0.000 0.008 0.000 0.000 0.016
#> SRR1304008     5  0.1152      0.812 0.000 0.000 0.004 0.000 0.952 0.044
#> SRR1304009     5  0.1434      0.809 0.000 0.000 0.012 0.000 0.940 0.048
#> SRR1304010     4  0.6315      0.285 0.016 0.004 0.004 0.460 0.164 0.352
#> SRR1304011     4  0.6561      0.280 0.036 0.000 0.008 0.428 0.152 0.376
#> SRR1304012     5  0.0922      0.822 0.000 0.000 0.004 0.004 0.968 0.024
#> SRR1304013     5  0.1003      0.820 0.000 0.000 0.004 0.004 0.964 0.028
#> SRR1304014     5  0.1155      0.819 0.000 0.000 0.004 0.004 0.956 0.036
#> SRR1304015     5  0.0653      0.825 0.000 0.000 0.004 0.004 0.980 0.012
#> SRR1304016     1  0.1867      0.893 0.916 0.000 0.000 0.020 0.000 0.064
#> SRR1304017     4  0.5347      0.419 0.000 0.024 0.000 0.640 0.116 0.220
#> SRR1304018     4  0.4380      0.497 0.000 0.056 0.000 0.732 0.020 0.192
#> SRR1304019     5  0.0748      0.824 0.000 0.000 0.004 0.004 0.976 0.016
#> SRR1304020     5  0.0405      0.823 0.000 0.000 0.004 0.000 0.988 0.008
#> SRR1304021     5  0.2633      0.714 0.000 0.000 0.000 0.032 0.864 0.104
#> SRR1304022     4  0.2462      0.532 0.000 0.028 0.000 0.876 0.000 0.096
#> SRR1304024     4  0.0993      0.536 0.000 0.012 0.000 0.964 0.000 0.024
#> SRR1304023     5  0.5063      0.388 0.000 0.000 0.008 0.148 0.660 0.184
#> SRR1304026     2  0.0972      0.777 0.000 0.964 0.000 0.028 0.000 0.008
#> SRR1304027     2  0.0972      0.777 0.000 0.964 0.000 0.028 0.000 0.008
#> SRR1304025     4  0.3437      0.470 0.008 0.004 0.000 0.752 0.000 0.236
#> SRR1304028     2  0.5361      0.421 0.008 0.620 0.000 0.180 0.000 0.192
#> SRR1304029     2  0.5361      0.421 0.008 0.620 0.000 0.180 0.000 0.192
#> SRR1304030     1  0.0653      0.918 0.980 0.004 0.000 0.004 0.000 0.012
#> SRR1304031     1  0.0748      0.918 0.976 0.004 0.000 0.004 0.000 0.016
#> SRR1304032     2  0.1168      0.768 0.000 0.956 0.000 0.028 0.000 0.016
#> SRR1304033     2  0.1168      0.768 0.000 0.956 0.000 0.028 0.000 0.016
#> SRR1304034     2  0.0551      0.776 0.004 0.984 0.000 0.004 0.000 0.008
#> SRR1304035     2  0.0551      0.776 0.004 0.984 0.000 0.004 0.000 0.008
#> SRR1304036     2  0.1003      0.774 0.020 0.964 0.000 0.000 0.000 0.016
#> SRR1304037     2  0.1088      0.772 0.024 0.960 0.000 0.000 0.000 0.016
#> SRR1304038     4  0.4006      0.357 0.004 0.000 0.000 0.600 0.004 0.392
#> SRR1304039     4  0.3890      0.349 0.000 0.000 0.000 0.596 0.004 0.400
#> SRR1304040     4  0.5690      0.444 0.108 0.088 0.000 0.652 0.000 0.152
#> SRR1304041     4  0.5847      0.429 0.128 0.088 0.000 0.636 0.000 0.148
#> SRR1304042     2  0.6760      0.358 0.084 0.496 0.000 0.216 0.000 0.204
#> SRR1304043     2  0.6779      0.357 0.088 0.496 0.000 0.216 0.000 0.200
#> SRR1304046     6  0.5616      0.643 0.004 0.000 0.000 0.132 0.372 0.492
#> SRR1304047     6  0.5807      0.633 0.016 0.000 0.000 0.120 0.384 0.480
#> SRR1304044     4  0.6058      0.358 0.004 0.236 0.000 0.492 0.004 0.264
#> SRR1304045     4  0.6029      0.358 0.004 0.236 0.000 0.500 0.004 0.256
#> SRR1304048     4  0.5955      0.241 0.392 0.012 0.000 0.444 0.000 0.152
#> SRR1304049     4  0.6009      0.304 0.356 0.008 0.000 0.452 0.000 0.184
#> SRR1304050     5  0.2738      0.641 0.000 0.000 0.000 0.004 0.820 0.176
#> SRR1304051     1  0.1151      0.915 0.956 0.000 0.000 0.012 0.000 0.032
#> SRR1304052     1  0.2939      0.839 0.860 0.008 0.000 0.072 0.000 0.060
#> SRR1304053     1  0.1196      0.912 0.952 0.000 0.000 0.008 0.000 0.040
#> SRR1304055     2  0.6073      0.511 0.116 0.604 0.000 0.092 0.000 0.188
#> SRR1304054     2  0.3904      0.682 0.032 0.792 0.000 0.044 0.000 0.132
#> SRR1304056     1  0.1408      0.911 0.944 0.020 0.000 0.000 0.000 0.036
#> SRR1304059     1  0.1461      0.910 0.940 0.016 0.000 0.000 0.000 0.044
#> SRR1304057     1  0.1434      0.915 0.940 0.012 0.000 0.000 0.000 0.048
#> SRR1304058     1  0.3523      0.810 0.820 0.092 0.000 0.012 0.000 0.076
#> SRR1304060     1  0.0767      0.919 0.976 0.000 0.008 0.004 0.000 0.012
#> SRR1304061     1  0.4418      0.665 0.708 0.192 0.000 0.000 0.000 0.100

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

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

collect_plots(res)

plot of chunk CV-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.586           0.886       0.910         0.2232 0.737   0.737
#> 3 3 0.844           0.940       0.973         0.4849 0.954   0.937
#> 4 4 0.462           0.784       0.864         0.3801 0.954   0.933
#> 5 5 0.475           0.743       0.872         0.0680 0.947   0.918
#> 6 6 0.468           0.851       0.884         0.0318 0.998   0.997

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
#> SRR1303990     1  0.9170      0.975 0.668 0.332
#> SRR1303991     1  0.9170      0.975 0.668 0.332
#> SRR1303992     2  0.5178      0.794 0.116 0.884
#> SRR1303993     2  0.4562      0.826 0.096 0.904
#> SRR1303994     2  0.0672      0.928 0.008 0.992
#> SRR1303995     2  0.0376      0.930 0.004 0.996
#> SRR1303996     2  0.6531      0.694 0.168 0.832
#> SRR1303997     2  0.4690      0.819 0.100 0.900
#> SRR1303998     2  0.6801      0.668 0.180 0.820
#> SRR1303999     2  0.6887      0.658 0.184 0.816
#> SRR1304000     2  0.0000      0.932 0.000 1.000
#> SRR1304001     2  0.0000      0.932 0.000 1.000
#> SRR1304004     2  0.3733      0.861 0.072 0.928
#> SRR1304005     2  0.4022      0.851 0.080 0.920
#> SRR1304002     2  0.0672      0.928 0.008 0.992
#> SRR1304003     2  0.0000      0.932 0.000 1.000
#> SRR1304006     2  0.0000      0.932 0.000 1.000
#> SRR1304007     2  0.0000      0.932 0.000 1.000
#> SRR1304008     1  0.9323      0.969 0.652 0.348
#> SRR1304009     1  0.9323      0.969 0.652 0.348
#> SRR1304010     2  0.5629      0.767 0.132 0.868
#> SRR1304011     2  0.1843      0.912 0.028 0.972
#> SRR1304012     1  0.9170      0.975 0.668 0.332
#> SRR1304013     1  0.9209      0.975 0.664 0.336
#> SRR1304014     1  0.9850      0.836 0.572 0.428
#> SRR1304015     1  0.9358      0.966 0.648 0.352
#> SRR1304016     2  0.0000      0.932 0.000 1.000
#> SRR1304017     2  0.8267      0.464 0.260 0.740
#> SRR1304018     2  0.1184      0.926 0.016 0.984
#> SRR1304019     1  0.9170      0.975 0.668 0.332
#> SRR1304020     1  0.9248      0.974 0.660 0.340
#> SRR1304021     2  0.7219      0.644 0.200 0.800
#> SRR1304022     2  0.1184      0.926 0.016 0.984
#> SRR1304024     2  0.1184      0.926 0.016 0.984
#> SRR1304023     1  0.9170      0.975 0.668 0.332
#> SRR1304026     2  0.9323      0.328 0.348 0.652
#> SRR1304027     2  0.9323      0.328 0.348 0.652
#> SRR1304025     2  0.1184      0.926 0.016 0.984
#> SRR1304028     2  0.1184      0.928 0.016 0.984
#> SRR1304029     2  0.0672      0.929 0.008 0.992
#> SRR1304030     2  0.0000      0.932 0.000 1.000
#> SRR1304031     2  0.0000      0.932 0.000 1.000
#> SRR1304032     2  0.1184      0.926 0.016 0.984
#> SRR1304033     2  0.1184      0.926 0.016 0.984
#> SRR1304034     2  0.0000      0.932 0.000 1.000
#> SRR1304035     2  0.0000      0.932 0.000 1.000
#> SRR1304036     2  0.0000      0.932 0.000 1.000
#> SRR1304037     2  0.0000      0.932 0.000 1.000
#> SRR1304038     2  0.1184      0.926 0.016 0.984
#> SRR1304039     2  0.0672      0.929 0.008 0.992
#> SRR1304040     2  0.1184      0.926 0.016 0.984
#> SRR1304041     2  0.1184      0.926 0.016 0.984
#> SRR1304042     2  0.1184      0.926 0.016 0.984
#> SRR1304043     2  0.1184      0.926 0.016 0.984
#> SRR1304046     2  0.2948      0.882 0.052 0.948
#> SRR1304047     2  0.0000      0.932 0.000 1.000
#> SRR1304044     2  0.1633      0.923 0.024 0.976
#> SRR1304045     2  0.1414      0.924 0.020 0.980
#> SRR1304048     2  0.0000      0.932 0.000 1.000
#> SRR1304049     2  0.0000      0.932 0.000 1.000
#> SRR1304050     2  0.1184      0.923 0.016 0.984
#> SRR1304051     2  0.0000      0.932 0.000 1.000
#> SRR1304052     2  0.0000      0.932 0.000 1.000
#> SRR1304053     2  0.0000      0.932 0.000 1.000
#> SRR1304055     2  0.0000      0.932 0.000 1.000
#> SRR1304054     2  0.0000      0.932 0.000 1.000
#> SRR1304056     2  0.0000      0.932 0.000 1.000
#> SRR1304059     2  0.0000      0.932 0.000 1.000
#> SRR1304057     2  0.0000      0.932 0.000 1.000
#> SRR1304058     2  0.0000      0.932 0.000 1.000
#> SRR1304060     2  0.0000      0.932 0.000 1.000
#> SRR1304061     2  0.0000      0.932 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
#> SRR1303990     3  0.0000      0.944 0.000  0 1.000
#> SRR1303991     3  0.0000      0.944 0.000  0 1.000
#> SRR1303992     1  0.3412      0.874 0.876  0 0.124
#> SRR1303993     1  0.2959      0.897 0.900  0 0.100
#> SRR1303994     1  0.0592      0.963 0.988  0 0.012
#> SRR1303995     1  0.0237      0.968 0.996  0 0.004
#> SRR1303996     1  0.4121      0.826 0.832  0 0.168
#> SRR1303997     1  0.3038      0.893 0.896  0 0.104
#> SRR1303998     1  0.4121      0.826 0.832  0 0.168
#> SRR1303999     1  0.4235      0.816 0.824  0 0.176
#> SRR1304000     1  0.0000      0.970 1.000  0 0.000
#> SRR1304001     1  0.0000      0.970 1.000  0 0.000
#> SRR1304004     1  0.2165      0.927 0.936  0 0.064
#> SRR1304005     1  0.2796      0.903 0.908  0 0.092
#> SRR1304002     1  0.0592      0.963 0.988  0 0.012
#> SRR1304003     1  0.0000      0.970 1.000  0 0.000
#> SRR1304006     1  0.0000      0.970 1.000  0 0.000
#> SRR1304007     1  0.0000      0.970 1.000  0 0.000
#> SRR1304008     3  0.0000      0.944 0.000  0 1.000
#> SRR1304009     3  0.0000      0.944 0.000  0 1.000
#> SRR1304010     1  0.3267      0.882 0.884  0 0.116
#> SRR1304011     1  0.1031      0.955 0.976  0 0.024
#> SRR1304012     3  0.0000      0.944 0.000  0 1.000
#> SRR1304013     3  0.0000      0.944 0.000  0 1.000
#> SRR1304014     3  0.4931      0.468 0.232  0 0.768
#> SRR1304015     3  0.0424      0.931 0.008  0 0.992
#> SRR1304016     1  0.0000      0.970 1.000  0 0.000
#> SRR1304017     1  0.5178      0.698 0.744  0 0.256
#> SRR1304018     1  0.0000      0.970 1.000  0 0.000
#> SRR1304019     3  0.0000      0.944 0.000  0 1.000
#> SRR1304020     3  0.0000      0.944 0.000  0 1.000
#> SRR1304021     1  0.4346      0.806 0.816  0 0.184
#> SRR1304022     1  0.0000      0.970 1.000  0 0.000
#> SRR1304024     1  0.0000      0.970 1.000  0 0.000
#> SRR1304023     3  0.0000      0.944 0.000  0 1.000
#> SRR1304026     2  0.0000      1.000 0.000  1 0.000
#> SRR1304027     2  0.0000      1.000 0.000  1 0.000
#> SRR1304025     1  0.0000      0.970 1.000  0 0.000
#> SRR1304028     1  0.0237      0.968 0.996  0 0.004
#> SRR1304029     1  0.0000      0.970 1.000  0 0.000
#> SRR1304030     1  0.0000      0.970 1.000  0 0.000
#> SRR1304031     1  0.0000      0.970 1.000  0 0.000
#> SRR1304032     1  0.0000      0.970 1.000  0 0.000
#> SRR1304033     1  0.0000      0.970 1.000  0 0.000
#> SRR1304034     1  0.0000      0.970 1.000  0 0.000
#> SRR1304035     1  0.0000      0.970 1.000  0 0.000
#> SRR1304036     1  0.0000      0.970 1.000  0 0.000
#> SRR1304037     1  0.0000      0.970 1.000  0 0.000
#> SRR1304038     1  0.0000      0.970 1.000  0 0.000
#> SRR1304039     1  0.0000      0.970 1.000  0 0.000
#> SRR1304040     1  0.0000      0.970 1.000  0 0.000
#> SRR1304041     1  0.0000      0.970 1.000  0 0.000
#> SRR1304042     1  0.0000      0.970 1.000  0 0.000
#> SRR1304043     1  0.0000      0.970 1.000  0 0.000
#> SRR1304046     1  0.2625      0.901 0.916  0 0.084
#> SRR1304047     1  0.0000      0.970 1.000  0 0.000
#> SRR1304044     1  0.0000      0.970 1.000  0 0.000
#> SRR1304045     1  0.0000      0.970 1.000  0 0.000
#> SRR1304048     1  0.0000      0.970 1.000  0 0.000
#> SRR1304049     1  0.0000      0.970 1.000  0 0.000
#> SRR1304050     1  0.0237      0.968 0.996  0 0.004
#> SRR1304051     1  0.0000      0.970 1.000  0 0.000
#> SRR1304052     1  0.0000      0.970 1.000  0 0.000
#> SRR1304053     1  0.0000      0.970 1.000  0 0.000
#> SRR1304055     1  0.0000      0.970 1.000  0 0.000
#> SRR1304054     1  0.0000      0.970 1.000  0 0.000
#> SRR1304056     1  0.0000      0.970 1.000  0 0.000
#> SRR1304059     1  0.0000      0.970 1.000  0 0.000
#> SRR1304057     1  0.0000      0.970 1.000  0 0.000
#> SRR1304058     1  0.0000      0.970 1.000  0 0.000
#> SRR1304060     1  0.0000      0.970 1.000  0 0.000
#> SRR1304061     1  0.0000      0.970 1.000  0 0.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2 p3    p4
#> SRR1303990     4  0.2704      0.833 0.000 0.000 NA 0.876
#> SRR1303991     4  0.2704      0.833 0.000 0.000 NA 0.876
#> SRR1303992     1  0.2589      0.814 0.884 0.000 NA 0.116
#> SRR1303993     1  0.2281      0.829 0.904 0.000 NA 0.096
#> SRR1303994     1  0.0817      0.859 0.976 0.000 NA 0.024
#> SRR1303995     1  0.0336      0.862 0.992 0.000 NA 0.008
#> SRR1303996     1  0.3356      0.770 0.824 0.000 NA 0.176
#> SRR1303997     1  0.2345      0.824 0.900 0.000 NA 0.100
#> SRR1303998     1  0.3266      0.771 0.832 0.000 NA 0.168
#> SRR1303999     1  0.3400      0.761 0.820 0.000 NA 0.180
#> SRR1304000     1  0.0188      0.863 0.996 0.004 NA 0.000
#> SRR1304001     1  0.0000      0.862 1.000 0.000 NA 0.000
#> SRR1304004     1  0.1637      0.851 0.940 0.000 NA 0.060
#> SRR1304005     1  0.2647      0.826 0.880 0.000 NA 0.120
#> SRR1304002     1  0.1722      0.861 0.944 0.048 NA 0.008
#> SRR1304003     1  0.0817      0.863 0.976 0.024 NA 0.000
#> SRR1304006     1  0.0921      0.864 0.972 0.028 NA 0.000
#> SRR1304007     1  0.1716      0.858 0.936 0.064 NA 0.000
#> SRR1304008     4  0.0000      0.924 0.000 0.000 NA 1.000
#> SRR1304009     4  0.0000      0.924 0.000 0.000 NA 1.000
#> SRR1304010     1  0.2334      0.829 0.908 0.004 NA 0.088
#> SRR1304011     1  0.0817      0.861 0.976 0.000 NA 0.024
#> SRR1304012     4  0.0000      0.924 0.000 0.000 NA 1.000
#> SRR1304013     4  0.0000      0.924 0.000 0.000 NA 1.000
#> SRR1304014     4  0.3907      0.477 0.232 0.000 NA 0.768
#> SRR1304015     4  0.0336      0.916 0.008 0.000 NA 0.992
#> SRR1304016     1  0.1637      0.858 0.940 0.060 NA 0.000
#> SRR1304017     1  0.5463      0.634 0.692 0.052 NA 0.256
#> SRR1304018     1  0.0188      0.862 0.996 0.004 NA 0.000
#> SRR1304019     4  0.0000      0.924 0.000 0.000 NA 1.000
#> SRR1304020     4  0.0000      0.924 0.000 0.000 NA 1.000
#> SRR1304021     1  0.3402      0.777 0.832 0.004 NA 0.164
#> SRR1304022     1  0.4500      0.627 0.684 0.316 NA 0.000
#> SRR1304024     1  0.4522      0.624 0.680 0.320 NA 0.000
#> SRR1304023     4  0.0188      0.921 0.000 0.004 NA 0.996
#> SRR1304026     2  0.4977      0.460 0.000 0.540 NA 0.000
#> SRR1304027     2  0.4977      0.460 0.000 0.540 NA 0.000
#> SRR1304025     1  0.4605      0.617 0.664 0.336 NA 0.000
#> SRR1304028     1  0.1004      0.860 0.972 0.024 NA 0.004
#> SRR1304029     1  0.0817      0.861 0.976 0.024 NA 0.000
#> SRR1304030     1  0.0469      0.863 0.988 0.012 NA 0.000
#> SRR1304031     1  0.1118      0.862 0.964 0.036 NA 0.000
#> SRR1304032     1  0.4855      0.499 0.600 0.400 NA 0.000
#> SRR1304033     1  0.4916      0.480 0.576 0.424 NA 0.000
#> SRR1304034     1  0.2921      0.804 0.860 0.140 NA 0.000
#> SRR1304035     1  0.2921      0.804 0.860 0.140 NA 0.000
#> SRR1304036     1  0.2921      0.804 0.860 0.140 NA 0.000
#> SRR1304037     1  0.2921      0.804 0.860 0.140 NA 0.000
#> SRR1304038     1  0.4331      0.648 0.712 0.288 NA 0.000
#> SRR1304039     1  0.4477      0.633 0.688 0.312 NA 0.000
#> SRR1304040     1  0.4585      0.619 0.668 0.332 NA 0.000
#> SRR1304041     1  0.4543      0.622 0.676 0.324 NA 0.000
#> SRR1304042     2  0.7282      0.521 0.148 0.436 NA 0.000
#> SRR1304043     2  0.7282      0.521 0.148 0.436 NA 0.000
#> SRR1304046     1  0.4677      0.628 0.680 0.316 NA 0.004
#> SRR1304047     1  0.2216      0.844 0.908 0.092 NA 0.000
#> SRR1304044     1  0.0188      0.862 0.996 0.004 NA 0.000
#> SRR1304045     1  0.0336      0.863 0.992 0.008 NA 0.000
#> SRR1304048     1  0.1389      0.860 0.952 0.048 NA 0.000
#> SRR1304049     1  0.1118      0.862 0.964 0.036 NA 0.000
#> SRR1304050     1  0.0524      0.862 0.988 0.004 NA 0.008
#> SRR1304051     1  0.1557      0.859 0.944 0.056 NA 0.000
#> SRR1304052     1  0.0000      0.862 1.000 0.000 NA 0.000
#> SRR1304053     1  0.0000      0.862 1.000 0.000 NA 0.000
#> SRR1304055     1  0.3172      0.808 0.840 0.160 NA 0.000
#> SRR1304054     1  0.4804      0.568 0.616 0.384 NA 0.000
#> SRR1304056     1  0.1716      0.858 0.936 0.064 NA 0.000
#> SRR1304059     1  0.1557      0.860 0.944 0.056 NA 0.000
#> SRR1304057     1  0.0592      0.862 0.984 0.016 NA 0.000
#> SRR1304058     1  0.2921      0.810 0.860 0.140 NA 0.000
#> SRR1304060     1  0.0707      0.863 0.980 0.020 NA 0.000
#> SRR1304061     1  0.2868      0.811 0.864 0.136 NA 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
#> SRR1303990     3  0.3003      1.000 0.000  0 0.812 0.000 0.188
#> SRR1303991     3  0.3003      1.000 0.000  0 0.812 0.000 0.188
#> SRR1303992     1  0.2179      0.785 0.888  0 0.000 0.000 0.112
#> SRR1303993     1  0.1851      0.798 0.912  0 0.000 0.000 0.088
#> SRR1303994     1  0.1043      0.815 0.960  0 0.000 0.000 0.040
#> SRR1303995     1  0.0609      0.821 0.980  0 0.000 0.000 0.020
#> SRR1303996     1  0.2929      0.732 0.820  0 0.000 0.000 0.180
#> SRR1303997     1  0.1908      0.797 0.908  0 0.000 0.000 0.092
#> SRR1303998     1  0.2690      0.746 0.844  0 0.000 0.000 0.156
#> SRR1303999     1  0.2966      0.722 0.816  0 0.000 0.000 0.184
#> SRR1304000     1  0.0162      0.823 0.996  0 0.000 0.004 0.000
#> SRR1304001     1  0.0000      0.822 1.000  0 0.000 0.000 0.000
#> SRR1304004     1  0.1270      0.817 0.948  0 0.000 0.000 0.052
#> SRR1304005     1  0.2471      0.774 0.864  0 0.000 0.000 0.136
#> SRR1304002     1  0.2124      0.807 0.900  0 0.000 0.096 0.004
#> SRR1304003     1  0.1043      0.823 0.960  0 0.000 0.040 0.000
#> SRR1304006     1  0.1043      0.825 0.960  0 0.000 0.040 0.000
#> SRR1304007     1  0.2230      0.800 0.884  0 0.000 0.116 0.000
#> SRR1304008     5  0.0000      0.919 0.000  0 0.000 0.000 1.000
#> SRR1304009     5  0.0000      0.919 0.000  0 0.000 0.000 1.000
#> SRR1304010     1  0.1671      0.798 0.924  0 0.000 0.000 0.076
#> SRR1304011     1  0.0609      0.822 0.980  0 0.000 0.000 0.020
#> SRR1304012     5  0.0000      0.919 0.000  0 0.000 0.000 1.000
#> SRR1304013     5  0.0000      0.919 0.000  0 0.000 0.000 1.000
#> SRR1304014     5  0.3242      0.443 0.216  0 0.000 0.000 0.784
#> SRR1304015     5  0.0162      0.913 0.004  0 0.000 0.000 0.996
#> SRR1304016     1  0.2179      0.802 0.888  0 0.000 0.112 0.000
#> SRR1304017     1  0.4817      0.536 0.680  0 0.000 0.056 0.264
#> SRR1304018     1  0.0703      0.823 0.976  0 0.000 0.024 0.000
#> SRR1304019     5  0.0000      0.919 0.000  0 0.000 0.000 1.000
#> SRR1304020     5  0.0000      0.919 0.000  0 0.000 0.000 1.000
#> SRR1304021     1  0.3368      0.722 0.820  0 0.000 0.024 0.156
#> SRR1304022     1  0.3999      0.416 0.656  0 0.000 0.344 0.000
#> SRR1304024     1  0.4060      0.392 0.640  0 0.000 0.360 0.000
#> SRR1304023     5  0.0703      0.889 0.000  0 0.000 0.024 0.976
#> SRR1304026     2  0.0000      1.000 0.000  1 0.000 0.000 0.000
#> SRR1304027     2  0.0000      1.000 0.000  1 0.000 0.000 0.000
#> SRR1304025     1  0.4150      0.362 0.612  0 0.000 0.388 0.000
#> SRR1304028     1  0.1410      0.813 0.940  0 0.000 0.060 0.000
#> SRR1304029     1  0.1197      0.815 0.952  0 0.000 0.048 0.000
#> SRR1304030     1  0.0404      0.824 0.988  0 0.000 0.012 0.000
#> SRR1304031     1  0.1270      0.821 0.948  0 0.000 0.052 0.000
#> SRR1304032     4  0.4551      0.534 0.368  0 0.016 0.616 0.000
#> SRR1304033     4  0.4401      0.572 0.328  0 0.016 0.656 0.000
#> SRR1304034     1  0.2852      0.718 0.828  0 0.000 0.172 0.000
#> SRR1304035     1  0.2852      0.718 0.828  0 0.000 0.172 0.000
#> SRR1304036     1  0.2852      0.718 0.828  0 0.000 0.172 0.000
#> SRR1304037     1  0.2852      0.718 0.828  0 0.000 0.172 0.000
#> SRR1304038     1  0.3752      0.482 0.708  0 0.000 0.292 0.000
#> SRR1304039     1  0.3932      0.450 0.672  0 0.000 0.328 0.000
#> SRR1304040     1  0.4138      0.367 0.616  0 0.000 0.384 0.000
#> SRR1304041     1  0.4114      0.374 0.624  0 0.000 0.376 0.000
#> SRR1304042     4  0.4541      0.441 0.084  0 0.172 0.744 0.000
#> SRR1304043     4  0.4541      0.441 0.084  0 0.172 0.744 0.000
#> SRR1304046     1  0.4339      0.423 0.652  0 0.000 0.336 0.012
#> SRR1304047     1  0.2377      0.782 0.872  0 0.000 0.128 0.000
#> SRR1304044     1  0.0703      0.823 0.976  0 0.000 0.024 0.000
#> SRR1304045     1  0.0703      0.823 0.976  0 0.000 0.024 0.000
#> SRR1304048     1  0.1908      0.809 0.908  0 0.000 0.092 0.000
#> SRR1304049     1  0.1478      0.817 0.936  0 0.000 0.064 0.000
#> SRR1304050     1  0.0404      0.822 0.988  0 0.000 0.000 0.012
#> SRR1304051     1  0.1965      0.806 0.904  0 0.000 0.096 0.000
#> SRR1304052     1  0.0000      0.822 1.000  0 0.000 0.000 0.000
#> SRR1304053     1  0.0000      0.822 1.000  0 0.000 0.000 0.000
#> SRR1304055     1  0.2966      0.735 0.816  0 0.000 0.184 0.000
#> SRR1304054     1  0.4219      0.299 0.584  0 0.000 0.416 0.000
#> SRR1304056     1  0.2179      0.802 0.888  0 0.000 0.112 0.000
#> SRR1304059     1  0.1851      0.813 0.912  0 0.000 0.088 0.000
#> SRR1304057     1  0.0609      0.823 0.980  0 0.000 0.020 0.000
#> SRR1304058     1  0.2690      0.742 0.844  0 0.000 0.156 0.000
#> SRR1304060     1  0.0794      0.823 0.972  0 0.000 0.028 0.000
#> SRR1304061     1  0.2605      0.745 0.852  0 0.000 0.148 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
#> SRR1303990     6  0.0000      1.000 0.000  0 0.000 0.000 0.000  1
#> SRR1303991     6  0.0000      1.000 0.000  0 0.000 0.000 0.000  1
#> SRR1303992     1  0.2020      0.858 0.896  0 0.000 0.008 0.096  0
#> SRR1303993     1  0.1643      0.867 0.924  0 0.000 0.008 0.068  0
#> SRR1303994     1  0.0622      0.869 0.980  0 0.000 0.012 0.008  0
#> SRR1303995     1  0.0622      0.869 0.980  0 0.000 0.012 0.008  0
#> SRR1303996     1  0.2946      0.804 0.808  0 0.004 0.004 0.184  0
#> SRR1303997     1  0.1787      0.866 0.920  0 0.004 0.008 0.068  0
#> SRR1303998     1  0.2558      0.825 0.840  0 0.004 0.000 0.156  0
#> SRR1303999     1  0.2871      0.799 0.804  0 0.004 0.000 0.192  0
#> SRR1304000     1  0.0632      0.873 0.976  0 0.000 0.024 0.000  0
#> SRR1304001     1  0.0363      0.872 0.988  0 0.000 0.012 0.000  0
#> SRR1304004     1  0.1225      0.873 0.952  0 0.000 0.012 0.036  0
#> SRR1304005     1  0.2302      0.849 0.872  0 0.000 0.008 0.120  0
#> SRR1304002     1  0.2362      0.862 0.860  0 0.000 0.136 0.004  0
#> SRR1304003     1  0.1387      0.876 0.932  0 0.000 0.068 0.000  0
#> SRR1304006     1  0.1267      0.878 0.940  0 0.000 0.060 0.000  0
#> SRR1304007     1  0.2378      0.855 0.848  0 0.000 0.152 0.000  0
#> SRR1304008     5  0.0000      0.912 0.000  0 0.000 0.000 1.000  0
#> SRR1304009     5  0.0000      0.912 0.000  0 0.000 0.000 1.000  0
#> SRR1304010     1  0.1349      0.868 0.940  0 0.000 0.004 0.056  0
#> SRR1304011     1  0.0508      0.872 0.984  0 0.000 0.004 0.012  0
#> SRR1304012     5  0.0000      0.912 0.000  0 0.000 0.000 1.000  0
#> SRR1304013     5  0.0000      0.912 0.000  0 0.000 0.000 1.000  0
#> SRR1304014     5  0.2793      0.527 0.200  0 0.000 0.000 0.800  0
#> SRR1304015     5  0.0000      0.912 0.000  0 0.000 0.000 1.000  0
#> SRR1304016     1  0.2454      0.853 0.840  0 0.000 0.160 0.000  0
#> SRR1304017     1  0.5523      0.505 0.552  0 0.180 0.000 0.268  0
#> SRR1304018     1  0.3122      0.782 0.804  0 0.176 0.020 0.000  0
#> SRR1304019     5  0.0000      0.912 0.000  0 0.000 0.000 1.000  0
#> SRR1304020     5  0.0000      0.912 0.000  0 0.000 0.000 1.000  0
#> SRR1304021     1  0.4263      0.752 0.744  0 0.120 0.004 0.132  0
#> SRR1304022     1  0.4371      0.750 0.716  0 0.180 0.104 0.000  0
#> SRR1304024     1  0.4757      0.726 0.676  0 0.180 0.144 0.000  0
#> SRR1304023     5  0.2597      0.676 0.000  0 0.176 0.000 0.824  0
#> SRR1304026     2  0.0000      1.000 0.000  1 0.000 0.000 0.000  0
#> SRR1304027     2  0.0000      1.000 0.000  1 0.000 0.000 0.000  0
#> SRR1304025     1  0.4982      0.716 0.648  0 0.180 0.172 0.000  0
#> SRR1304028     1  0.3189      0.787 0.796  0 0.184 0.020 0.000  0
#> SRR1304029     1  0.2250      0.851 0.888  0 0.092 0.020 0.000  0
#> SRR1304030     1  0.0790      0.875 0.968  0 0.000 0.032 0.000  0
#> SRR1304031     1  0.1501      0.875 0.924  0 0.000 0.076 0.000  0
#> SRR1304032     3  0.1141      1.000 0.000  0 0.948 0.052 0.000  0
#> SRR1304033     3  0.1141      1.000 0.000  0 0.948 0.052 0.000  0
#> SRR1304034     1  0.1714      0.854 0.908  0 0.000 0.092 0.000  0
#> SRR1304035     1  0.1908      0.851 0.900  0 0.004 0.096 0.000  0
#> SRR1304036     1  0.1714      0.854 0.908  0 0.000 0.092 0.000  0
#> SRR1304037     1  0.1714      0.854 0.908  0 0.000 0.092 0.000  0
#> SRR1304038     1  0.3717      0.791 0.776  0 0.160 0.064 0.000  0
#> SRR1304039     1  0.2887      0.859 0.844  0 0.036 0.120 0.000  0
#> SRR1304040     1  0.4952      0.717 0.652  0 0.180 0.168 0.000  0
#> SRR1304041     1  0.4858      0.720 0.664  0 0.180 0.156 0.000  0
#> SRR1304042     4  0.0458      1.000 0.016  0 0.000 0.984 0.000  0
#> SRR1304043     4  0.0458      1.000 0.016  0 0.000 0.984 0.000  0
#> SRR1304046     1  0.4107      0.804 0.756  0 0.004 0.148 0.092  0
#> SRR1304047     1  0.2219      0.857 0.864  0 0.000 0.136 0.000  0
#> SRR1304044     1  0.3122      0.782 0.804  0 0.176 0.020 0.000  0
#> SRR1304045     1  0.3122      0.782 0.804  0 0.176 0.020 0.000  0
#> SRR1304048     1  0.2260      0.859 0.860  0 0.000 0.140 0.000  0
#> SRR1304049     1  0.1910      0.868 0.892  0 0.000 0.108 0.000  0
#> SRR1304050     1  0.0508      0.872 0.984  0 0.000 0.012 0.004  0
#> SRR1304051     1  0.2300      0.857 0.856  0 0.000 0.144 0.000  0
#> SRR1304052     1  0.0547      0.872 0.980  0 0.000 0.020 0.000  0
#> SRR1304053     1  0.0363      0.871 0.988  0 0.000 0.012 0.000  0
#> SRR1304055     1  0.2597      0.849 0.824  0 0.000 0.176 0.000  0
#> SRR1304054     1  0.3023      0.827 0.784  0 0.004 0.212 0.000  0
#> SRR1304056     1  0.2454      0.854 0.840  0 0.000 0.160 0.000  0
#> SRR1304059     1  0.2048      0.868 0.880  0 0.000 0.120 0.000  0
#> SRR1304057     1  0.0790      0.871 0.968  0 0.000 0.032 0.000  0
#> SRR1304058     1  0.2178      0.856 0.868  0 0.000 0.132 0.000  0
#> SRR1304060     1  0.1007      0.873 0.956  0 0.000 0.044 0.000  0
#> SRR1304061     1  0.1910      0.855 0.892  0 0.000 0.108 0.000  0

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

consensus_heatmap(res, k = 2)

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

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

collect_plots(res)

plot of chunk CV-mclust-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.857           0.889       0.947          0.500 0.499   0.499
#> 3 3 0.767           0.845       0.931          0.203 0.771   0.593
#> 4 4 0.728           0.759       0.882          0.123 0.890   0.732
#> 5 5 0.579           0.566       0.751          0.116 0.830   0.517
#> 6 6 0.571           0.462       0.679          0.056 0.941   0.754

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
#> SRR1303990     2  0.0376      0.914 0.004 0.996
#> SRR1303991     2  0.0376      0.914 0.004 0.996
#> SRR1303992     2  0.0672      0.914 0.008 0.992
#> SRR1303993     2  0.0672      0.914 0.008 0.992
#> SRR1303994     2  0.0672      0.914 0.008 0.992
#> SRR1303995     2  0.0672      0.914 0.008 0.992
#> SRR1303996     2  0.0672      0.914 0.008 0.992
#> SRR1303997     2  0.0672      0.914 0.008 0.992
#> SRR1303998     2  0.0672      0.914 0.008 0.992
#> SRR1303999     2  0.0672      0.914 0.008 0.992
#> SRR1304000     2  0.1633      0.914 0.024 0.976
#> SRR1304001     2  0.1414      0.915 0.020 0.980
#> SRR1304004     1  0.1184      0.973 0.984 0.016
#> SRR1304005     1  0.3879      0.908 0.924 0.076
#> SRR1304002     1  0.0000      0.985 1.000 0.000
#> SRR1304003     1  0.0000      0.985 1.000 0.000
#> SRR1304006     1  0.0000      0.985 1.000 0.000
#> SRR1304007     1  0.0000      0.985 1.000 0.000
#> SRR1304008     2  0.3431      0.893 0.064 0.936
#> SRR1304009     2  0.3431      0.893 0.064 0.936
#> SRR1304010     1  0.0000      0.985 1.000 0.000
#> SRR1304011     1  0.0000      0.985 1.000 0.000
#> SRR1304012     2  0.1843      0.912 0.028 0.972
#> SRR1304013     2  0.1843      0.912 0.028 0.972
#> SRR1304014     1  0.8144      0.641 0.748 0.252
#> SRR1304015     2  0.3431      0.893 0.064 0.936
#> SRR1304016     1  0.0376      0.983 0.996 0.004
#> SRR1304017     2  0.2423      0.909 0.040 0.960
#> SRR1304018     2  0.9998      0.194 0.492 0.508
#> SRR1304019     2  0.2043      0.911 0.032 0.968
#> SRR1304020     2  0.2043      0.911 0.032 0.968
#> SRR1304021     1  0.0376      0.982 0.996 0.004
#> SRR1304022     2  0.5842      0.833 0.140 0.860
#> SRR1304024     2  1.0000      0.179 0.496 0.504
#> SRR1304023     2  0.0376      0.914 0.004 0.996
#> SRR1304026     2  0.0938      0.916 0.012 0.988
#> SRR1304027     2  0.0938      0.916 0.012 0.988
#> SRR1304025     1  0.0376      0.983 0.996 0.004
#> SRR1304028     2  0.0938      0.916 0.012 0.988
#> SRR1304029     2  0.0938      0.916 0.012 0.988
#> SRR1304030     1  0.0000      0.985 1.000 0.000
#> SRR1304031     1  0.0000      0.985 1.000 0.000
#> SRR1304032     2  0.0938      0.916 0.012 0.988
#> SRR1304033     2  0.0938      0.916 0.012 0.988
#> SRR1304034     2  0.0938      0.916 0.012 0.988
#> SRR1304035     2  0.0938      0.916 0.012 0.988
#> SRR1304036     2  0.1414      0.916 0.020 0.980
#> SRR1304037     2  0.1414      0.916 0.020 0.980
#> SRR1304038     1  0.0000      0.985 1.000 0.000
#> SRR1304039     1  0.0000      0.985 1.000 0.000
#> SRR1304040     1  0.0000      0.985 1.000 0.000
#> SRR1304041     1  0.0000      0.985 1.000 0.000
#> SRR1304042     2  0.9988      0.244 0.480 0.520
#> SRR1304043     2  0.9963      0.290 0.464 0.536
#> SRR1304046     1  0.0376      0.983 0.996 0.004
#> SRR1304047     1  0.0376      0.983 0.996 0.004
#> SRR1304044     2  0.5294      0.852 0.120 0.880
#> SRR1304045     2  0.7376      0.759 0.208 0.792
#> SRR1304048     1  0.0000      0.985 1.000 0.000
#> SRR1304049     1  0.0000      0.985 1.000 0.000
#> SRR1304050     1  0.0672      0.979 0.992 0.008
#> SRR1304051     1  0.0000      0.985 1.000 0.000
#> SRR1304052     1  0.0000      0.985 1.000 0.000
#> SRR1304053     1  0.0000      0.985 1.000 0.000
#> SRR1304055     1  0.0000      0.985 1.000 0.000
#> SRR1304054     1  0.0000      0.985 1.000 0.000
#> SRR1304056     1  0.0000      0.985 1.000 0.000
#> SRR1304059     1  0.2603      0.941 0.956 0.044
#> SRR1304057     1  0.0000      0.985 1.000 0.000
#> SRR1304058     2  0.1414      0.916 0.020 0.980
#> SRR1304060     2  0.9710      0.450 0.400 0.600
#> SRR1304061     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
#> SRR1303990     2  0.1163      0.916 0.000 0.972 0.028
#> SRR1303991     2  0.1163      0.916 0.000 0.972 0.028
#> SRR1303992     3  0.0000      0.996 0.000 0.000 1.000
#> SRR1303993     3  0.0000      0.996 0.000 0.000 1.000
#> SRR1303994     3  0.0475      0.994 0.004 0.004 0.992
#> SRR1303995     3  0.0475      0.994 0.004 0.004 0.992
#> SRR1303996     3  0.0000      0.996 0.000 0.000 1.000
#> SRR1303997     3  0.0000      0.996 0.000 0.000 1.000
#> SRR1303998     3  0.0000      0.996 0.000 0.000 1.000
#> SRR1303999     3  0.0000      0.996 0.000 0.000 1.000
#> SRR1304000     3  0.0424      0.992 0.008 0.000 0.992
#> SRR1304001     3  0.0424      0.992 0.008 0.000 0.992
#> SRR1304004     1  0.0000      0.885 1.000 0.000 0.000
#> SRR1304005     1  0.0000      0.885 1.000 0.000 0.000
#> SRR1304002     1  0.0000      0.885 1.000 0.000 0.000
#> SRR1304003     1  0.0000      0.885 1.000 0.000 0.000
#> SRR1304006     1  0.0000      0.885 1.000 0.000 0.000
#> SRR1304007     1  0.0000      0.885 1.000 0.000 0.000
#> SRR1304008     2  0.5733      0.504 0.324 0.676 0.000
#> SRR1304009     2  0.5785      0.484 0.332 0.668 0.000
#> SRR1304010     1  0.0000      0.885 1.000 0.000 0.000
#> SRR1304011     1  0.0000      0.885 1.000 0.000 0.000
#> SRR1304012     2  0.1411      0.918 0.036 0.964 0.000
#> SRR1304013     2  0.1411      0.918 0.036 0.964 0.000
#> SRR1304014     1  0.4654      0.674 0.792 0.208 0.000
#> SRR1304015     1  0.6062      0.457 0.616 0.384 0.000
#> SRR1304016     1  0.5591      0.603 0.696 0.304 0.000
#> SRR1304017     2  0.0424      0.926 0.008 0.992 0.000
#> SRR1304018     2  0.2356      0.891 0.072 0.928 0.000
#> SRR1304019     2  0.1411      0.918 0.036 0.964 0.000
#> SRR1304020     2  0.5363      0.603 0.276 0.724 0.000
#> SRR1304021     1  0.0000      0.885 1.000 0.000 0.000
#> SRR1304022     2  0.0424      0.926 0.008 0.992 0.000
#> SRR1304024     2  0.1643      0.913 0.044 0.956 0.000
#> SRR1304023     2  0.1163      0.916 0.000 0.972 0.028
#> SRR1304026     2  0.0000      0.924 0.000 1.000 0.000
#> SRR1304027     2  0.0000      0.924 0.000 1.000 0.000
#> SRR1304025     1  0.5988      0.490 0.632 0.368 0.000
#> SRR1304028     2  0.0000      0.924 0.000 1.000 0.000
#> SRR1304029     2  0.0000      0.924 0.000 1.000 0.000
#> SRR1304030     1  0.0000      0.885 1.000 0.000 0.000
#> SRR1304031     1  0.0000      0.885 1.000 0.000 0.000
#> SRR1304032     2  0.0000      0.924 0.000 1.000 0.000
#> SRR1304033     2  0.0000      0.924 0.000 1.000 0.000
#> SRR1304034     2  0.0000      0.924 0.000 1.000 0.000
#> SRR1304035     2  0.0000      0.924 0.000 1.000 0.000
#> SRR1304036     2  0.2537      0.879 0.080 0.920 0.000
#> SRR1304037     2  0.2537      0.879 0.080 0.920 0.000
#> SRR1304038     1  0.0000      0.885 1.000 0.000 0.000
#> SRR1304039     1  0.0000      0.885 1.000 0.000 0.000
#> SRR1304040     1  0.5968      0.498 0.636 0.364 0.000
#> SRR1304041     1  0.5905      0.520 0.648 0.352 0.000
#> SRR1304042     1  0.6111      0.430 0.604 0.396 0.000
#> SRR1304043     1  0.6111      0.430 0.604 0.396 0.000
#> SRR1304046     1  0.5327      0.648 0.728 0.272 0.000
#> SRR1304047     1  0.4654      0.723 0.792 0.208 0.000
#> SRR1304044     2  0.0424      0.926 0.008 0.992 0.000
#> SRR1304045     2  0.0424      0.926 0.008 0.992 0.000
#> SRR1304048     1  0.0000      0.885 1.000 0.000 0.000
#> SRR1304049     1  0.0000      0.885 1.000 0.000 0.000
#> SRR1304050     1  0.0000      0.885 1.000 0.000 0.000
#> SRR1304051     1  0.0000      0.885 1.000 0.000 0.000
#> SRR1304052     1  0.0000      0.885 1.000 0.000 0.000
#> SRR1304053     1  0.0000      0.885 1.000 0.000 0.000
#> SRR1304055     1  0.0000      0.885 1.000 0.000 0.000
#> SRR1304054     1  0.5016      0.689 0.760 0.240 0.000
#> SRR1304056     1  0.0000      0.885 1.000 0.000 0.000
#> SRR1304059     1  0.0000      0.885 1.000 0.000 0.000
#> SRR1304057     1  0.0000      0.885 1.000 0.000 0.000
#> SRR1304058     1  0.0424      0.881 0.992 0.008 0.000
#> SRR1304060     1  0.0000      0.885 1.000 0.000 0.000
#> SRR1304061     1  0.0000      0.885 1.000 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> SRR1303990     4  0.0000     0.7081 0.000 0.000 0.000 1.000
#> SRR1303991     4  0.0000     0.7081 0.000 0.000 0.000 1.000
#> SRR1303992     3  0.0000     0.9970 0.000 0.000 1.000 0.000
#> SRR1303993     3  0.0000     0.9970 0.000 0.000 1.000 0.000
#> SRR1303994     3  0.0000     0.9970 0.000 0.000 1.000 0.000
#> SRR1303995     3  0.0000     0.9970 0.000 0.000 1.000 0.000
#> SRR1303996     3  0.0000     0.9970 0.000 0.000 1.000 0.000
#> SRR1303997     3  0.0000     0.9970 0.000 0.000 1.000 0.000
#> SRR1303998     3  0.0000     0.9970 0.000 0.000 1.000 0.000
#> SRR1303999     3  0.0000     0.9970 0.000 0.000 1.000 0.000
#> SRR1304000     3  0.0336     0.9880 0.008 0.000 0.992 0.000
#> SRR1304001     3  0.0336     0.9880 0.008 0.000 0.992 0.000
#> SRR1304004     1  0.0336     0.9036 0.992 0.008 0.000 0.000
#> SRR1304005     1  0.0188     0.9037 0.996 0.004 0.000 0.000
#> SRR1304002     1  0.0000     0.9036 1.000 0.000 0.000 0.000
#> SRR1304003     1  0.0000     0.9036 1.000 0.000 0.000 0.000
#> SRR1304006     1  0.3278     0.8650 0.864 0.116 0.020 0.000
#> SRR1304007     1  0.3335     0.8626 0.860 0.120 0.020 0.000
#> SRR1304008     4  0.4434     0.6186 0.228 0.016 0.000 0.756
#> SRR1304009     4  0.4434     0.6186 0.228 0.016 0.000 0.756
#> SRR1304010     1  0.0188     0.9032 0.996 0.004 0.000 0.000
#> SRR1304011     1  0.0188     0.9032 0.996 0.004 0.000 0.000
#> SRR1304012     4  0.0592     0.7184 0.016 0.000 0.000 0.984
#> SRR1304013     4  0.0592     0.7184 0.016 0.000 0.000 0.984
#> SRR1304014     1  0.1902     0.8688 0.932 0.004 0.000 0.064
#> SRR1304015     4  0.5050     0.4123 0.408 0.004 0.000 0.588
#> SRR1304016     1  0.6928     0.0449 0.512 0.116 0.000 0.372
#> SRR1304017     4  0.4290     0.6840 0.016 0.212 0.000 0.772
#> SRR1304018     4  0.5307     0.6914 0.076 0.188 0.000 0.736
#> SRR1304019     4  0.1576     0.7204 0.048 0.004 0.000 0.948
#> SRR1304020     4  0.2466     0.7099 0.096 0.004 0.000 0.900
#> SRR1304021     1  0.0188     0.9032 0.996 0.004 0.000 0.000
#> SRR1304022     4  0.4900     0.6725 0.032 0.236 0.000 0.732
#> SRR1304024     4  0.5272     0.6844 0.136 0.112 0.000 0.752
#> SRR1304023     4  0.0000     0.7081 0.000 0.000 0.000 1.000
#> SRR1304026     2  0.2345     0.7449 0.000 0.900 0.000 0.100
#> SRR1304027     2  0.2345     0.7449 0.000 0.900 0.000 0.100
#> SRR1304025     4  0.6197     0.2212 0.440 0.052 0.000 0.508
#> SRR1304028     4  0.4164     0.6374 0.000 0.264 0.000 0.736
#> SRR1304029     4  0.4164     0.6374 0.000 0.264 0.000 0.736
#> SRR1304030     1  0.1637     0.8933 0.940 0.060 0.000 0.000
#> SRR1304031     1  0.2408     0.8689 0.896 0.104 0.000 0.000
#> SRR1304032     2  0.4933     0.1497 0.000 0.568 0.000 0.432
#> SRR1304033     2  0.4866     0.2387 0.000 0.596 0.000 0.404
#> SRR1304034     2  0.2345     0.7449 0.000 0.900 0.000 0.100
#> SRR1304035     2  0.2345     0.7449 0.000 0.900 0.000 0.100
#> SRR1304036     2  0.2101     0.6992 0.060 0.928 0.000 0.012
#> SRR1304037     2  0.2101     0.6992 0.060 0.928 0.000 0.012
#> SRR1304038     1  0.0188     0.9032 0.996 0.004 0.000 0.000
#> SRR1304039     1  0.0188     0.9032 0.996 0.004 0.000 0.000
#> SRR1304040     1  0.1576     0.8990 0.948 0.048 0.000 0.004
#> SRR1304041     1  0.1576     0.8990 0.948 0.048 0.000 0.004
#> SRR1304042     1  0.2131     0.8922 0.932 0.036 0.000 0.032
#> SRR1304043     1  0.2131     0.8922 0.932 0.036 0.000 0.032
#> SRR1304046     1  0.6504    -0.1726 0.476 0.072 0.000 0.452
#> SRR1304047     1  0.6504    -0.1726 0.476 0.072 0.000 0.452
#> SRR1304044     4  0.4867     0.6750 0.032 0.232 0.000 0.736
#> SRR1304045     4  0.4867     0.6750 0.032 0.232 0.000 0.736
#> SRR1304048     1  0.1474     0.8983 0.948 0.052 0.000 0.000
#> SRR1304049     1  0.1389     0.8986 0.952 0.048 0.000 0.000
#> SRR1304050     1  0.0188     0.9032 0.996 0.004 0.000 0.000
#> SRR1304051     1  0.0336     0.9023 0.992 0.008 0.000 0.000
#> SRR1304052     1  0.0188     0.9032 0.996 0.004 0.000 0.000
#> SRR1304053     1  0.0188     0.9032 0.996 0.004 0.000 0.000
#> SRR1304055     1  0.1867     0.8949 0.928 0.072 0.000 0.000
#> SRR1304054     1  0.1302     0.8988 0.956 0.044 0.000 0.000
#> SRR1304056     1  0.3099     0.8716 0.876 0.104 0.020 0.000
#> SRR1304059     1  0.3099     0.8716 0.876 0.104 0.020 0.000
#> SRR1304057     1  0.1940     0.8861 0.924 0.076 0.000 0.000
#> SRR1304058     2  0.4431     0.3575 0.304 0.696 0.000 0.000
#> SRR1304060     1  0.3659     0.8470 0.840 0.136 0.024 0.000
#> SRR1304061     1  0.2345     0.8843 0.900 0.100 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>            class entropy silhouette    p1    p2    p3    p4    p5
#> SRR1303990     5  0.3388    0.73709 0.000 0.008 0.000 0.200 0.792
#> SRR1303991     5  0.3388    0.73709 0.000 0.008 0.000 0.200 0.792
#> SRR1303992     3  0.0000    1.00000 0.000 0.000 1.000 0.000 0.000
#> SRR1303993     3  0.0000    1.00000 0.000 0.000 1.000 0.000 0.000
#> SRR1303994     3  0.0000    1.00000 0.000 0.000 1.000 0.000 0.000
#> SRR1303995     3  0.0000    1.00000 0.000 0.000 1.000 0.000 0.000
#> SRR1303996     3  0.0000    1.00000 0.000 0.000 1.000 0.000 0.000
#> SRR1303997     3  0.0000    1.00000 0.000 0.000 1.000 0.000 0.000
#> SRR1303998     3  0.0000    1.00000 0.000 0.000 1.000 0.000 0.000
#> SRR1303999     3  0.0000    1.00000 0.000 0.000 1.000 0.000 0.000
#> SRR1304000     3  0.0000    1.00000 0.000 0.000 1.000 0.000 0.000
#> SRR1304001     3  0.0000    1.00000 0.000 0.000 1.000 0.000 0.000
#> SRR1304004     1  0.4184    0.51515 0.772 0.004 0.000 0.048 0.176
#> SRR1304005     1  0.4256    0.50641 0.764 0.004 0.000 0.048 0.184
#> SRR1304002     1  0.0794    0.62579 0.972 0.000 0.000 0.028 0.000
#> SRR1304003     1  0.0794    0.62579 0.972 0.000 0.000 0.028 0.000
#> SRR1304006     4  0.4111    0.70983 0.216 0.012 0.016 0.756 0.000
#> SRR1304007     4  0.4229    0.70796 0.208 0.012 0.024 0.756 0.000
#> SRR1304008     5  0.3110    0.73456 0.028 0.004 0.000 0.112 0.856
#> SRR1304009     5  0.3160    0.73132 0.028 0.004 0.000 0.116 0.852
#> SRR1304010     1  0.0290    0.62405 0.992 0.000 0.000 0.008 0.000
#> SRR1304011     1  0.0290    0.62405 0.992 0.000 0.000 0.008 0.000
#> SRR1304012     5  0.0324    0.79305 0.004 0.004 0.000 0.000 0.992
#> SRR1304013     5  0.0324    0.79305 0.004 0.004 0.000 0.000 0.992
#> SRR1304014     1  0.3534    0.41291 0.744 0.000 0.000 0.000 0.256
#> SRR1304015     5  0.3611    0.62517 0.208 0.004 0.000 0.008 0.780
#> SRR1304016     1  0.5309    0.32753 0.632 0.020 0.004 0.316 0.028
#> SRR1304017     5  0.6110   -0.31680 0.096 0.400 0.004 0.004 0.496
#> SRR1304018     2  0.6892    0.43181 0.228 0.408 0.000 0.008 0.356
#> SRR1304019     5  0.1074    0.79160 0.016 0.012 0.000 0.004 0.968
#> SRR1304020     5  0.0854    0.79309 0.012 0.004 0.000 0.008 0.976
#> SRR1304021     1  0.0898    0.62749 0.972 0.000 0.000 0.008 0.020
#> SRR1304022     2  0.6782    0.45507 0.204 0.440 0.000 0.008 0.348
#> SRR1304024     2  0.6748    0.48242 0.216 0.472 0.000 0.008 0.304
#> SRR1304023     5  0.3266    0.73842 0.000 0.004 0.000 0.200 0.796
#> SRR1304026     2  0.0290    0.62001 0.000 0.992 0.000 0.008 0.000
#> SRR1304027     2  0.0290    0.62001 0.000 0.992 0.000 0.008 0.000
#> SRR1304025     1  0.7815   -0.17053 0.344 0.312 0.004 0.292 0.048
#> SRR1304028     2  0.4201    0.48760 0.000 0.664 0.000 0.008 0.328
#> SRR1304029     2  0.4165    0.49518 0.000 0.672 0.000 0.008 0.320
#> SRR1304030     4  0.5412    0.50692 0.428 0.048 0.004 0.520 0.000
#> SRR1304031     4  0.5856    0.53117 0.400 0.068 0.012 0.520 0.000
#> SRR1304032     2  0.2732    0.60485 0.000 0.840 0.000 0.000 0.160
#> SRR1304033     2  0.2773    0.60341 0.000 0.836 0.000 0.000 0.164
#> SRR1304034     2  0.0510    0.62073 0.000 0.984 0.000 0.016 0.000
#> SRR1304035     2  0.0510    0.62073 0.000 0.984 0.000 0.016 0.000
#> SRR1304036     2  0.3171    0.52751 0.008 0.816 0.000 0.176 0.000
#> SRR1304037     2  0.3246    0.52349 0.008 0.808 0.000 0.184 0.000
#> SRR1304038     1  0.0290    0.62680 0.992 0.000 0.000 0.008 0.000
#> SRR1304039     1  0.0579    0.62827 0.984 0.000 0.000 0.008 0.008
#> SRR1304040     1  0.6503    0.00476 0.480 0.300 0.000 0.220 0.000
#> SRR1304041     1  0.6547   -0.01144 0.472 0.296 0.000 0.232 0.000
#> SRR1304042     4  0.7073    0.28541 0.276 0.312 0.012 0.400 0.000
#> SRR1304043     4  0.7073    0.28541 0.276 0.312 0.012 0.400 0.000
#> SRR1304046     1  0.5491    0.43543 0.692 0.040 0.000 0.204 0.064
#> SRR1304047     1  0.5603    0.43170 0.688 0.052 0.000 0.200 0.060
#> SRR1304044     2  0.6969    0.44240 0.212 0.420 0.004 0.008 0.356
#> SRR1304045     2  0.6969    0.44240 0.212 0.420 0.004 0.008 0.356
#> SRR1304048     1  0.5284    0.16887 0.568 0.056 0.000 0.376 0.000
#> SRR1304049     1  0.5002    0.22402 0.596 0.040 0.000 0.364 0.000
#> SRR1304050     1  0.0609    0.62550 0.980 0.000 0.000 0.000 0.020
#> SRR1304051     1  0.2104    0.60469 0.916 0.024 0.000 0.060 0.000
#> SRR1304052     1  0.3016    0.54878 0.848 0.020 0.000 0.132 0.000
#> SRR1304053     1  0.1121    0.62067 0.956 0.000 0.000 0.044 0.000
#> SRR1304055     1  0.6703   -0.16134 0.428 0.276 0.000 0.296 0.000
#> SRR1304054     1  0.6694   -0.01679 0.464 0.304 0.000 0.228 0.004
#> SRR1304056     4  0.3759    0.70775 0.220 0.000 0.016 0.764 0.000
#> SRR1304059     4  0.3821    0.70727 0.216 0.000 0.020 0.764 0.000
#> SRR1304057     4  0.5764    0.52515 0.404 0.068 0.008 0.520 0.000
#> SRR1304058     2  0.6497   -0.13583 0.208 0.472 0.000 0.320 0.000
#> SRR1304060     4  0.5661    0.68356 0.204 0.076 0.040 0.680 0.000
#> SRR1304061     4  0.4016    0.68723 0.272 0.000 0.012 0.716 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
#> SRR1303990     6  0.4673    0.40696 0.072 0.004 0.000 0.264 0.000 0.660
#> SRR1303991     6  0.4673    0.40696 0.072 0.004 0.000 0.264 0.000 0.660
#> SRR1303992     3  0.0000    1.00000 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1303993     3  0.0000    1.00000 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1303994     3  0.0000    1.00000 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1303995     3  0.0000    1.00000 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1303996     3  0.0000    1.00000 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1303997     3  0.0000    1.00000 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1303998     3  0.0000    1.00000 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1303999     3  0.0000    1.00000 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1304000     3  0.0000    1.00000 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1304001     3  0.0000    1.00000 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1304004     5  0.2899    0.50442 0.016 0.004 0.000 0.016 0.860 0.104
#> SRR1304005     5  0.3156    0.50415 0.016 0.004 0.012 0.016 0.856 0.096
#> SRR1304002     5  0.0405    0.54330 0.008 0.000 0.000 0.004 0.988 0.000
#> SRR1304003     5  0.0508    0.54339 0.012 0.000 0.000 0.004 0.984 0.000
#> SRR1304006     1  0.3893    0.84048 0.784 0.016 0.040 0.004 0.156 0.000
#> SRR1304007     1  0.3772    0.84424 0.788 0.012 0.036 0.004 0.160 0.000
#> SRR1304008     6  0.5816    0.28780 0.016 0.012 0.000 0.308 0.104 0.560
#> SRR1304009     6  0.5816    0.28780 0.016 0.012 0.000 0.308 0.104 0.560
#> SRR1304010     5  0.0653    0.54380 0.004 0.000 0.004 0.012 0.980 0.000
#> SRR1304011     5  0.0767    0.54213 0.012 0.000 0.004 0.008 0.976 0.000
#> SRR1304012     6  0.0653    0.48158 0.004 0.000 0.000 0.004 0.012 0.980
#> SRR1304013     6  0.0870    0.48384 0.004 0.000 0.000 0.012 0.012 0.972
#> SRR1304014     5  0.3958    0.42929 0.004 0.004 0.000 0.040 0.752 0.200
#> SRR1304015     6  0.5757    0.18521 0.004 0.000 0.000 0.192 0.276 0.528
#> SRR1304016     5  0.6164   -0.05606 0.164 0.008 0.008 0.396 0.424 0.000
#> SRR1304017     6  0.8165    0.15663 0.036 0.188 0.000 0.212 0.220 0.344
#> SRR1304018     5  0.8225   -0.24205 0.052 0.156 0.000 0.192 0.352 0.248
#> SRR1304019     6  0.3665    0.45384 0.004 0.076 0.000 0.040 0.052 0.828
#> SRR1304020     6  0.4410    0.45474 0.004 0.012 0.000 0.172 0.072 0.740
#> SRR1304021     5  0.3089    0.48817 0.000 0.004 0.000 0.188 0.800 0.008
#> SRR1304022     2  0.8247   -0.00563 0.048 0.332 0.000 0.172 0.184 0.264
#> SRR1304024     6  0.8326    0.09187 0.040 0.228 0.000 0.204 0.244 0.284
#> SRR1304023     6  0.4683    0.40362 0.068 0.004 0.000 0.276 0.000 0.652
#> SRR1304026     2  0.2506    0.58859 0.052 0.880 0.000 0.068 0.000 0.000
#> SRR1304027     2  0.2506    0.58859 0.052 0.880 0.000 0.068 0.000 0.000
#> SRR1304025     5  0.7643   -0.09912 0.072 0.108 0.008 0.340 0.412 0.060
#> SRR1304028     2  0.5806    0.43150 0.048 0.592 0.000 0.104 0.000 0.256
#> SRR1304029     2  0.5767    0.43520 0.048 0.596 0.000 0.100 0.000 0.256
#> SRR1304030     1  0.3570    0.80615 0.752 0.004 0.016 0.000 0.228 0.000
#> SRR1304031     1  0.3459    0.82488 0.768 0.004 0.016 0.000 0.212 0.000
#> SRR1304032     2  0.3900    0.51188 0.012 0.724 0.000 0.016 0.000 0.248
#> SRR1304033     2  0.3900    0.51188 0.012 0.724 0.000 0.016 0.000 0.248
#> SRR1304034     2  0.2226    0.60558 0.028 0.904 0.000 0.008 0.060 0.000
#> SRR1304035     2  0.2226    0.60558 0.028 0.904 0.000 0.008 0.060 0.000
#> SRR1304036     2  0.4008    0.51758 0.196 0.740 0.000 0.000 0.064 0.000
#> SRR1304037     2  0.4008    0.51758 0.196 0.740 0.000 0.000 0.064 0.000
#> SRR1304038     5  0.3380    0.44454 0.004 0.000 0.004 0.244 0.748 0.000
#> SRR1304039     5  0.3354    0.44394 0.004 0.000 0.004 0.240 0.752 0.000
#> SRR1304040     5  0.7299   -0.58788 0.256 0.100 0.000 0.304 0.340 0.000
#> SRR1304041     5  0.7281   -0.58720 0.264 0.096 0.000 0.300 0.340 0.000
#> SRR1304042     4  0.7611    0.76883 0.328 0.152 0.024 0.376 0.120 0.000
#> SRR1304043     4  0.7611    0.76883 0.328 0.152 0.024 0.376 0.120 0.000
#> SRR1304046     5  0.4743    0.26601 0.044 0.000 0.000 0.388 0.564 0.004
#> SRR1304047     5  0.4743    0.26601 0.044 0.000 0.000 0.388 0.564 0.004
#> SRR1304044     6  0.8395    0.11600 0.036 0.220 0.004 0.208 0.244 0.288
#> SRR1304045     6  0.8395    0.11600 0.036 0.220 0.004 0.208 0.244 0.288
#> SRR1304048     5  0.6963   -0.47081 0.244 0.060 0.000 0.344 0.352 0.000
#> SRR1304049     5  0.6827   -0.41366 0.240 0.048 0.000 0.344 0.368 0.000
#> SRR1304050     5  0.1863    0.53342 0.000 0.000 0.000 0.104 0.896 0.000
#> SRR1304051     5  0.2714    0.46617 0.136 0.004 0.000 0.012 0.848 0.000
#> SRR1304052     5  0.3200    0.39264 0.196 0.000 0.000 0.016 0.788 0.000
#> SRR1304053     5  0.2100    0.51254 0.112 0.004 0.000 0.000 0.884 0.000
#> SRR1304055     5  0.7119   -0.40311 0.340 0.112 0.004 0.140 0.404 0.000
#> SRR1304054     4  0.7247    0.46826 0.240 0.096 0.000 0.352 0.312 0.000
#> SRR1304056     1  0.3210    0.85190 0.804 0.000 0.028 0.000 0.168 0.000
#> SRR1304059     1  0.3239    0.84900 0.808 0.000 0.024 0.004 0.164 0.000
#> SRR1304057     1  0.3678    0.80679 0.748 0.008 0.016 0.000 0.228 0.000
#> SRR1304058     2  0.5390   -0.10613 0.396 0.500 0.000 0.004 0.100 0.000
#> SRR1304060     1  0.6273    0.50676 0.556 0.232 0.064 0.000 0.148 0.000
#> SRR1304061     1  0.3202    0.83881 0.800 0.000 0.024 0.000 0.176 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 15595 rows and 72 columns.
#>   Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'CV' method.
#>   Subgroups are detected by 'NMF' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 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.836           0.903       0.958         0.5009 0.496   0.496
#> 3 3 0.421           0.552       0.749         0.2939 0.796   0.612
#> 4 4 0.633           0.689       0.849         0.1065 0.764   0.456
#> 5 5 0.482           0.431       0.704         0.0728 0.864   0.577
#> 6 6 0.578           0.478       0.702         0.0479 0.754   0.277

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
#> SRR1303990     1   0.000     0.9752 1.000 0.000
#> SRR1303991     1   0.000     0.9752 1.000 0.000
#> SRR1303992     1   0.000     0.9752 1.000 0.000
#> SRR1303993     1   0.000     0.9752 1.000 0.000
#> SRR1303994     1   0.000     0.9752 1.000 0.000
#> SRR1303995     1   0.000     0.9752 1.000 0.000
#> SRR1303996     1   0.000     0.9752 1.000 0.000
#> SRR1303997     1   0.000     0.9752 1.000 0.000
#> SRR1303998     1   0.000     0.9752 1.000 0.000
#> SRR1303999     1   0.000     0.9752 1.000 0.000
#> SRR1304000     1   0.000     0.9752 1.000 0.000
#> SRR1304001     1   0.000     0.9752 1.000 0.000
#> SRR1304004     1   0.000     0.9752 1.000 0.000
#> SRR1304005     1   0.000     0.9752 1.000 0.000
#> SRR1304002     1   0.184     0.9586 0.972 0.028
#> SRR1304003     1   0.343     0.9299 0.936 0.064
#> SRR1304006     1   0.634     0.8168 0.840 0.160
#> SRR1304007     1   0.506     0.8793 0.888 0.112
#> SRR1304008     1   0.000     0.9752 1.000 0.000
#> SRR1304009     1   0.000     0.9752 1.000 0.000
#> SRR1304010     1   0.204     0.9557 0.968 0.032
#> SRR1304011     1   0.402     0.9150 0.920 0.080
#> SRR1304012     1   0.000     0.9752 1.000 0.000
#> SRR1304013     1   0.000     0.9752 1.000 0.000
#> SRR1304014     1   0.000     0.9752 1.000 0.000
#> SRR1304015     1   0.000     0.9752 1.000 0.000
#> SRR1304016     2   0.529     0.8435 0.120 0.880
#> SRR1304017     2   0.000     0.9361 0.000 1.000
#> SRR1304018     2   0.000     0.9361 0.000 1.000
#> SRR1304019     1   0.000     0.9752 1.000 0.000
#> SRR1304020     1   0.000     0.9752 1.000 0.000
#> SRR1304021     1   0.118     0.9662 0.984 0.016
#> SRR1304022     2   0.000     0.9361 0.000 1.000
#> SRR1304024     2   0.000     0.9361 0.000 1.000
#> SRR1304023     1   0.000     0.9752 1.000 0.000
#> SRR1304026     2   0.000     0.9361 0.000 1.000
#> SRR1304027     2   0.000     0.9361 0.000 1.000
#> SRR1304025     2   0.000     0.9361 0.000 1.000
#> SRR1304028     2   0.000     0.9361 0.000 1.000
#> SRR1304029     2   0.000     0.9361 0.000 1.000
#> SRR1304030     2   0.966     0.4003 0.392 0.608
#> SRR1304031     2   1.000     0.0928 0.492 0.508
#> SRR1304032     2   0.000     0.9361 0.000 1.000
#> SRR1304033     2   0.000     0.9361 0.000 1.000
#> SRR1304034     2   0.000     0.9361 0.000 1.000
#> SRR1304035     2   0.000     0.9361 0.000 1.000
#> SRR1304036     2   0.000     0.9361 0.000 1.000
#> SRR1304037     2   0.000     0.9361 0.000 1.000
#> SRR1304038     2   0.327     0.8973 0.060 0.940
#> SRR1304039     2   0.118     0.9270 0.016 0.984
#> SRR1304040     2   0.000     0.9361 0.000 1.000
#> SRR1304041     2   0.000     0.9361 0.000 1.000
#> SRR1304042     2   0.000     0.9361 0.000 1.000
#> SRR1304043     2   0.000     0.9361 0.000 1.000
#> SRR1304046     2   0.767     0.7172 0.224 0.776
#> SRR1304047     2   0.904     0.5592 0.320 0.680
#> SRR1304044     2   0.000     0.9361 0.000 1.000
#> SRR1304045     2   0.000     0.9361 0.000 1.000
#> SRR1304048     2   0.000     0.9361 0.000 1.000
#> SRR1304049     2   0.000     0.9361 0.000 1.000
#> SRR1304050     1   0.388     0.9185 0.924 0.076
#> SRR1304051     2   0.998     0.1520 0.476 0.524
#> SRR1304052     2   0.242     0.9117 0.040 0.960
#> SRR1304053     1   0.634     0.8168 0.840 0.160
#> SRR1304055     2   0.000     0.9361 0.000 1.000
#> SRR1304054     2   0.000     0.9361 0.000 1.000
#> SRR1304056     2   0.295     0.9033 0.052 0.948
#> SRR1304059     2   0.000     0.9361 0.000 1.000
#> SRR1304057     2   0.529     0.8435 0.120 0.880
#> SRR1304058     2   0.000     0.9361 0.000 1.000
#> SRR1304060     1   0.000     0.9752 1.000 0.000
#> SRR1304061     2   0.000     0.9361 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
#> SRR1303990     1  0.6244    0.52546 0.560 0.000 0.440
#> SRR1303991     1  0.6252    0.51757 0.556 0.000 0.444
#> SRR1303992     3  0.0000    0.78232 0.000 0.000 1.000
#> SRR1303993     3  0.0000    0.78232 0.000 0.000 1.000
#> SRR1303994     3  0.0000    0.78232 0.000 0.000 1.000
#> SRR1303995     3  0.0000    0.78232 0.000 0.000 1.000
#> SRR1303996     3  0.0000    0.78232 0.000 0.000 1.000
#> SRR1303997     3  0.0000    0.78232 0.000 0.000 1.000
#> SRR1303998     3  0.0000    0.78232 0.000 0.000 1.000
#> SRR1303999     3  0.0000    0.78232 0.000 0.000 1.000
#> SRR1304000     3  0.0000    0.78232 0.000 0.000 1.000
#> SRR1304001     3  0.0000    0.78232 0.000 0.000 1.000
#> SRR1304004     3  0.0237    0.77912 0.004 0.000 0.996
#> SRR1304005     3  0.0000    0.78232 0.000 0.000 1.000
#> SRR1304002     3  0.6195    0.58119 0.020 0.276 0.704
#> SRR1304003     3  0.6047    0.55627 0.008 0.312 0.680
#> SRR1304006     3  0.6742    0.52928 0.028 0.316 0.656
#> SRR1304007     3  0.6369    0.54381 0.016 0.316 0.668
#> SRR1304008     3  0.3879    0.61804 0.152 0.000 0.848
#> SRR1304009     3  0.1643    0.74286 0.044 0.000 0.956
#> SRR1304010     1  0.7884    0.55129 0.640 0.260 0.100
#> SRR1304011     1  0.8229    0.54680 0.620 0.256 0.124
#> SRR1304012     1  0.6154    0.57530 0.592 0.000 0.408
#> SRR1304013     1  0.6180    0.56464 0.584 0.000 0.416
#> SRR1304014     3  0.1525    0.75672 0.032 0.004 0.964
#> SRR1304015     1  0.6111    0.58992 0.604 0.000 0.396
#> SRR1304016     2  0.6180    0.38507 0.332 0.660 0.008
#> SRR1304017     1  0.4452    0.55272 0.808 0.192 0.000
#> SRR1304018     1  0.5158    0.54561 0.764 0.232 0.004
#> SRR1304019     1  0.6357    0.64396 0.684 0.020 0.296
#> SRR1304020     1  0.5988    0.61237 0.632 0.000 0.368
#> SRR1304021     1  0.7222    0.58431 0.684 0.244 0.072
#> SRR1304022     1  0.4399    0.54770 0.812 0.188 0.000
#> SRR1304024     1  0.5363    0.47292 0.724 0.276 0.000
#> SRR1304023     1  0.5859    0.62283 0.656 0.000 0.344
#> SRR1304026     2  0.5678    0.56997 0.316 0.684 0.000
#> SRR1304027     2  0.5678    0.56997 0.316 0.684 0.000
#> SRR1304025     2  0.5988    0.32027 0.368 0.632 0.000
#> SRR1304028     2  0.6274    0.49687 0.456 0.544 0.000
#> SRR1304029     2  0.6291    0.48675 0.468 0.532 0.000
#> SRR1304030     2  0.7043   -0.09734 0.020 0.532 0.448
#> SRR1304031     3  0.6799    0.29204 0.012 0.456 0.532
#> SRR1304032     2  0.5650    0.57253 0.312 0.688 0.000
#> SRR1304033     2  0.5678    0.56997 0.316 0.684 0.000
#> SRR1304034     2  0.5621    0.57364 0.308 0.692 0.000
#> SRR1304035     2  0.5621    0.57364 0.308 0.692 0.000
#> SRR1304036     2  0.5292    0.60184 0.228 0.764 0.008
#> SRR1304037     2  0.5247    0.60337 0.224 0.768 0.008
#> SRR1304038     2  0.6302   -0.00997 0.480 0.520 0.000
#> SRR1304039     1  0.6309   -0.00723 0.500 0.500 0.000
#> SRR1304040     2  0.4346    0.58810 0.184 0.816 0.000
#> SRR1304041     2  0.4121    0.59969 0.168 0.832 0.000
#> SRR1304042     2  0.0592    0.65573 0.012 0.988 0.000
#> SRR1304043     2  0.0892    0.65576 0.020 0.980 0.000
#> SRR1304046     2  0.6556    0.45345 0.276 0.692 0.032
#> SRR1304047     2  0.7065    0.38077 0.316 0.644 0.040
#> SRR1304044     2  0.6308    0.10246 0.492 0.508 0.000
#> SRR1304045     2  0.6225    0.27714 0.432 0.568 0.000
#> SRR1304048     2  0.3038    0.62848 0.104 0.896 0.000
#> SRR1304049     2  0.3192    0.62470 0.112 0.888 0.000
#> SRR1304050     3  0.9236    0.20965 0.248 0.220 0.532
#> SRR1304051     2  0.9321    0.23089 0.224 0.520 0.256
#> SRR1304052     2  0.5619    0.51333 0.244 0.744 0.012
#> SRR1304053     3  0.7918    0.47594 0.104 0.256 0.640
#> SRR1304055     2  0.0000    0.65457 0.000 1.000 0.000
#> SRR1304054     2  0.0592    0.65315 0.012 0.988 0.000
#> SRR1304056     2  0.5953    0.40422 0.012 0.708 0.280
#> SRR1304059     2  0.2590    0.62989 0.004 0.924 0.072
#> SRR1304057     2  0.5536    0.48928 0.012 0.752 0.236
#> SRR1304058     2  0.3349    0.64069 0.108 0.888 0.004
#> SRR1304060     3  0.5692    0.58932 0.008 0.268 0.724
#> SRR1304061     2  0.0829    0.65268 0.004 0.984 0.012

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> SRR1303990     4  0.2011      0.844 0.000 0.000 0.080 0.920
#> SRR1303991     4  0.2216      0.838 0.000 0.000 0.092 0.908
#> SRR1303992     3  0.1022      0.754 0.000 0.000 0.968 0.032
#> SRR1303993     3  0.0592      0.761 0.000 0.000 0.984 0.016
#> SRR1303994     3  0.0000      0.766 0.000 0.000 1.000 0.000
#> SRR1303995     3  0.0336      0.764 0.000 0.000 0.992 0.008
#> SRR1303996     3  0.0336      0.764 0.000 0.000 0.992 0.008
#> SRR1303997     3  0.0188      0.765 0.000 0.000 0.996 0.004
#> SRR1303998     3  0.1474      0.742 0.000 0.000 0.948 0.052
#> SRR1303999     3  0.0707      0.760 0.000 0.000 0.980 0.020
#> SRR1304000     3  0.0000      0.766 0.000 0.000 1.000 0.000
#> SRR1304001     3  0.0188      0.766 0.004 0.000 0.996 0.000
#> SRR1304004     3  0.0336      0.766 0.008 0.000 0.992 0.000
#> SRR1304005     3  0.0000      0.766 0.000 0.000 1.000 0.000
#> SRR1304002     3  0.5190      0.437 0.396 0.004 0.596 0.004
#> SRR1304003     3  0.5400      0.356 0.428 0.004 0.560 0.008
#> SRR1304006     3  0.5165      0.514 0.352 0.004 0.636 0.008
#> SRR1304007     3  0.5074      0.543 0.332 0.004 0.656 0.008
#> SRR1304008     3  0.7050      0.299 0.180 0.000 0.568 0.252
#> SRR1304009     3  0.3907      0.669 0.044 0.000 0.836 0.120
#> SRR1304010     1  0.2048      0.811 0.928 0.000 0.008 0.064
#> SRR1304011     1  0.2255      0.808 0.920 0.000 0.012 0.068
#> SRR1304012     4  0.1792      0.853 0.000 0.000 0.068 0.932
#> SRR1304013     4  0.1824      0.855 0.004 0.000 0.060 0.936
#> SRR1304014     3  0.4877      0.382 0.008 0.000 0.664 0.328
#> SRR1304015     4  0.3542      0.842 0.060 0.000 0.076 0.864
#> SRR1304016     1  0.0804      0.829 0.980 0.000 0.012 0.008
#> SRR1304017     4  0.3528      0.733 0.192 0.000 0.000 0.808
#> SRR1304018     4  0.4713      0.470 0.360 0.000 0.000 0.640
#> SRR1304019     4  0.1151      0.846 0.024 0.000 0.008 0.968
#> SRR1304020     4  0.2521      0.854 0.024 0.000 0.064 0.912
#> SRR1304021     1  0.3306      0.728 0.840 0.000 0.004 0.156
#> SRR1304022     4  0.3569      0.726 0.196 0.000 0.000 0.804
#> SRR1304024     1  0.4193      0.533 0.732 0.000 0.000 0.268
#> SRR1304023     4  0.0895      0.847 0.004 0.000 0.020 0.976
#> SRR1304026     2  0.0672      0.864 0.008 0.984 0.000 0.008
#> SRR1304027     2  0.0672      0.864 0.008 0.984 0.000 0.008
#> SRR1304025     1  0.0592      0.827 0.984 0.000 0.000 0.016
#> SRR1304028     2  0.5882      0.478 0.048 0.608 0.000 0.344
#> SRR1304029     2  0.5943      0.449 0.048 0.592 0.000 0.360
#> SRR1304030     3  0.5572      0.494 0.360 0.012 0.616 0.012
#> SRR1304031     3  0.5864      0.546 0.316 0.032 0.640 0.012
#> SRR1304032     2  0.1406      0.862 0.016 0.960 0.000 0.024
#> SRR1304033     2  0.1004      0.865 0.004 0.972 0.000 0.024
#> SRR1304034     2  0.1182      0.865 0.016 0.968 0.000 0.016
#> SRR1304035     2  0.0779      0.867 0.004 0.980 0.000 0.016
#> SRR1304036     2  0.0376      0.866 0.004 0.992 0.000 0.004
#> SRR1304037     2  0.1059      0.860 0.016 0.972 0.000 0.012
#> SRR1304038     1  0.0779      0.828 0.980 0.000 0.004 0.016
#> SRR1304039     1  0.0817      0.826 0.976 0.000 0.000 0.024
#> SRR1304040     1  0.0817      0.826 0.976 0.000 0.000 0.024
#> SRR1304041     1  0.0817      0.826 0.976 0.000 0.000 0.024
#> SRR1304042     1  0.4897      0.513 0.660 0.332 0.000 0.008
#> SRR1304043     1  0.5007      0.469 0.636 0.356 0.000 0.008
#> SRR1304046     1  0.0469      0.827 0.988 0.000 0.012 0.000
#> SRR1304047     1  0.0657      0.828 0.984 0.000 0.012 0.004
#> SRR1304044     1  0.2944      0.756 0.868 0.004 0.000 0.128
#> SRR1304045     1  0.2888      0.760 0.872 0.004 0.000 0.124
#> SRR1304048     1  0.0524      0.828 0.988 0.004 0.008 0.000
#> SRR1304049     1  0.0657      0.826 0.984 0.000 0.012 0.004
#> SRR1304050     1  0.5371      0.629 0.732 0.000 0.188 0.080
#> SRR1304051     1  0.0895      0.826 0.976 0.000 0.020 0.004
#> SRR1304052     1  0.1151      0.829 0.968 0.000 0.008 0.024
#> SRR1304053     1  0.5016      0.173 0.600 0.000 0.396 0.004
#> SRR1304055     1  0.5033      0.517 0.664 0.324 0.004 0.008
#> SRR1304054     1  0.3632      0.729 0.832 0.156 0.004 0.008
#> SRR1304056     3  0.5963      0.294 0.440 0.024 0.528 0.008
#> SRR1304059     1  0.5606      0.214 0.604 0.016 0.372 0.008
#> SRR1304057     3  0.5670      0.433 0.392 0.016 0.584 0.008
#> SRR1304058     2  0.5243      0.517 0.264 0.704 0.024 0.008
#> SRR1304060     3  0.3128      0.735 0.108 0.008 0.876 0.008
#> SRR1304061     1  0.7306      0.166 0.520 0.132 0.340 0.008

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>            class entropy silhouette    p1    p2    p3    p4    p5
#> SRR1303990     5  0.1124     0.6902 0.000 0.004 0.036 0.000 0.960
#> SRR1303991     5  0.1408     0.6865 0.000 0.008 0.044 0.000 0.948
#> SRR1303992     3  0.2280     0.6823 0.000 0.000 0.880 0.000 0.120
#> SRR1303993     3  0.1965     0.7033 0.000 0.000 0.904 0.000 0.096
#> SRR1303994     3  0.0162     0.7445 0.000 0.000 0.996 0.000 0.004
#> SRR1303995     3  0.0290     0.7439 0.000 0.000 0.992 0.000 0.008
#> SRR1303996     3  0.0000     0.7448 0.000 0.000 1.000 0.000 0.000
#> SRR1303997     3  0.0000     0.7448 0.000 0.000 1.000 0.000 0.000
#> SRR1303998     3  0.1410     0.7258 0.000 0.000 0.940 0.000 0.060
#> SRR1303999     3  0.0404     0.7426 0.000 0.000 0.988 0.000 0.012
#> SRR1304000     3  0.0000     0.7448 0.000 0.000 1.000 0.000 0.000
#> SRR1304001     3  0.0000     0.7448 0.000 0.000 1.000 0.000 0.000
#> SRR1304004     3  0.5952     0.6111 0.036 0.188 0.660 0.000 0.116
#> SRR1304005     3  0.5447     0.6350 0.020 0.176 0.696 0.000 0.108
#> SRR1304002     1  0.5429    -0.1267 0.488 0.040 0.464 0.000 0.008
#> SRR1304003     3  0.5241     0.4212 0.356 0.040 0.596 0.000 0.008
#> SRR1304006     3  0.6174     0.4417 0.256 0.192 0.552 0.000 0.000
#> SRR1304007     3  0.5770     0.5038 0.272 0.116 0.608 0.000 0.004
#> SRR1304008     1  0.8147     0.2495 0.408 0.232 0.136 0.000 0.224
#> SRR1304009     3  0.8579     0.0585 0.232 0.232 0.296 0.000 0.240
#> SRR1304010     1  0.3346     0.6557 0.844 0.092 0.000 0.000 0.064
#> SRR1304011     1  0.3804     0.6465 0.812 0.132 0.004 0.000 0.052
#> SRR1304012     5  0.1211     0.6920 0.000 0.016 0.024 0.000 0.960
#> SRR1304013     5  0.1173     0.6945 0.004 0.012 0.020 0.000 0.964
#> SRR1304014     5  0.5889     0.3609 0.020 0.096 0.260 0.000 0.624
#> SRR1304015     5  0.6586     0.3307 0.272 0.164 0.020 0.000 0.544
#> SRR1304016     1  0.3305     0.6254 0.776 0.224 0.000 0.000 0.000
#> SRR1304017     5  0.6538     0.3771 0.272 0.248 0.000 0.000 0.480
#> SRR1304018     5  0.6791     0.2012 0.356 0.284 0.000 0.000 0.360
#> SRR1304019     5  0.2462     0.6868 0.112 0.008 0.000 0.000 0.880
#> SRR1304020     5  0.2494     0.6914 0.056 0.032 0.008 0.000 0.904
#> SRR1304021     1  0.3723     0.6298 0.804 0.044 0.000 0.000 0.152
#> SRR1304022     5  0.6998     0.3879 0.264 0.224 0.000 0.024 0.488
#> SRR1304024     1  0.4294     0.5260 0.780 0.148 0.000 0.008 0.064
#> SRR1304023     5  0.2116     0.6736 0.008 0.076 0.004 0.000 0.912
#> SRR1304026     4  0.0000     0.6956 0.000 0.000 0.000 1.000 0.000
#> SRR1304027     4  0.0000     0.6956 0.000 0.000 0.000 1.000 0.000
#> SRR1304025     1  0.0290     0.6633 0.992 0.000 0.000 0.000 0.008
#> SRR1304028     2  0.5728    -0.1112 0.012 0.540 0.000 0.388 0.060
#> SRR1304029     2  0.5865    -0.1061 0.016 0.536 0.000 0.384 0.064
#> SRR1304030     2  0.5752     0.1956 0.100 0.628 0.260 0.000 0.012
#> SRR1304031     2  0.5919     0.1697 0.088 0.620 0.272 0.004 0.016
#> SRR1304032     2  0.4961    -0.1933 0.020 0.520 0.000 0.456 0.004
#> SRR1304033     2  0.4964    -0.1994 0.020 0.516 0.000 0.460 0.004
#> SRR1304034     2  0.4302    -0.2520 0.000 0.520 0.000 0.480 0.000
#> SRR1304035     2  0.4450    -0.2457 0.000 0.508 0.000 0.488 0.004
#> SRR1304036     4  0.4464     0.6186 0.000 0.288 0.028 0.684 0.000
#> SRR1304037     4  0.5084     0.5480 0.000 0.332 0.052 0.616 0.000
#> SRR1304038     1  0.0162     0.6632 0.996 0.000 0.000 0.000 0.004
#> SRR1304039     1  0.0451     0.6624 0.988 0.004 0.000 0.000 0.008
#> SRR1304040     1  0.2513     0.6099 0.876 0.116 0.000 0.000 0.008
#> SRR1304041     1  0.1732     0.6324 0.920 0.080 0.000 0.000 0.000
#> SRR1304042     1  0.5865     0.3443 0.608 0.268 0.000 0.116 0.008
#> SRR1304043     1  0.6003     0.3170 0.588 0.280 0.000 0.124 0.008
#> SRR1304046     1  0.3961     0.6355 0.760 0.212 0.000 0.000 0.028
#> SRR1304047     1  0.3656     0.6423 0.784 0.196 0.000 0.000 0.020
#> SRR1304044     2  0.4416     0.1575 0.356 0.632 0.000 0.000 0.012
#> SRR1304045     2  0.4599     0.1014 0.384 0.600 0.000 0.000 0.016
#> SRR1304048     1  0.2020     0.6682 0.900 0.100 0.000 0.000 0.000
#> SRR1304049     1  0.1671     0.6710 0.924 0.076 0.000 0.000 0.000
#> SRR1304050     1  0.6999     0.4981 0.580 0.188 0.136 0.000 0.096
#> SRR1304051     1  0.4193     0.5494 0.684 0.304 0.012 0.000 0.000
#> SRR1304052     2  0.4264     0.1058 0.376 0.620 0.000 0.000 0.004
#> SRR1304053     1  0.6789     0.1045 0.368 0.348 0.284 0.000 0.000
#> SRR1304055     1  0.6900     0.0606 0.436 0.300 0.000 0.256 0.008
#> SRR1304054     1  0.4858     0.4361 0.556 0.424 0.000 0.012 0.008
#> SRR1304056     3  0.6629     0.3313 0.168 0.356 0.468 0.004 0.004
#> SRR1304059     2  0.6673    -0.1780 0.332 0.424 0.244 0.000 0.000
#> SRR1304057     3  0.5163     0.4402 0.040 0.368 0.588 0.000 0.004
#> SRR1304058     2  0.8081    -0.2547 0.168 0.416 0.104 0.304 0.008
#> SRR1304060     3  0.3951     0.6541 0.028 0.192 0.776 0.000 0.004
#> SRR1304061     2  0.8192     0.0362 0.212 0.452 0.152 0.176 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
#> SRR1303990     5  0.0717     0.7849 0.016 0.000 0.008 0.000 0.976 0.000
#> SRR1303991     5  0.0914     0.7836 0.016 0.000 0.016 0.000 0.968 0.000
#> SRR1303992     3  0.1700     0.8405 0.004 0.000 0.916 0.000 0.080 0.000
#> SRR1303993     3  0.1349     0.8609 0.004 0.000 0.940 0.000 0.056 0.000
#> SRR1303994     3  0.0665     0.8843 0.008 0.000 0.980 0.004 0.008 0.000
#> SRR1303995     3  0.0862     0.8847 0.008 0.000 0.972 0.004 0.016 0.000
#> SRR1303996     3  0.0146     0.8854 0.000 0.000 0.996 0.000 0.004 0.000
#> SRR1303997     3  0.0000     0.8845 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1303998     3  0.0713     0.8808 0.000 0.000 0.972 0.000 0.028 0.000
#> SRR1303999     3  0.0547     0.8836 0.000 0.000 0.980 0.000 0.020 0.000
#> SRR1304000     3  0.0405     0.8820 0.008 0.000 0.988 0.004 0.000 0.000
#> SRR1304001     3  0.0146     0.8843 0.004 0.000 0.996 0.000 0.000 0.000
#> SRR1304004     1  0.5404     0.4244 0.580 0.000 0.184 0.000 0.236 0.000
#> SRR1304005     1  0.5590     0.3952 0.548 0.000 0.220 0.000 0.232 0.000
#> SRR1304002     3  0.6751     0.2609 0.120 0.000 0.516 0.148 0.000 0.216
#> SRR1304003     3  0.5989     0.4433 0.092 0.000 0.620 0.132 0.000 0.156
#> SRR1304006     1  0.3859     0.5888 0.776 0.000 0.168 0.040 0.000 0.016
#> SRR1304007     1  0.4447     0.5505 0.704 0.000 0.224 0.064 0.000 0.008
#> SRR1304008     1  0.3809     0.4929 0.732 0.000 0.024 0.004 0.240 0.000
#> SRR1304009     1  0.4385     0.4864 0.696 0.000 0.060 0.004 0.240 0.000
#> SRR1304010     4  0.4410     0.1543 0.472 0.012 0.008 0.508 0.000 0.000
#> SRR1304011     1  0.4849    -0.1724 0.496 0.024 0.012 0.464 0.000 0.004
#> SRR1304012     5  0.1116     0.7781 0.000 0.000 0.008 0.028 0.960 0.004
#> SRR1304013     5  0.1036     0.7798 0.000 0.000 0.008 0.024 0.964 0.004
#> SRR1304014     5  0.3432     0.6943 0.148 0.000 0.052 0.000 0.800 0.000
#> SRR1304015     1  0.3488     0.5705 0.800 0.000 0.012 0.028 0.160 0.000
#> SRR1304016     1  0.1333     0.5914 0.944 0.000 0.000 0.048 0.008 0.000
#> SRR1304017     4  0.6788     0.3715 0.100 0.128 0.000 0.520 0.244 0.008
#> SRR1304018     4  0.6757     0.4050 0.108 0.152 0.000 0.544 0.188 0.008
#> SRR1304019     5  0.3459     0.6685 0.212 0.000 0.000 0.016 0.768 0.004
#> SRR1304020     5  0.3445     0.6087 0.260 0.000 0.000 0.008 0.732 0.000
#> SRR1304021     1  0.4988     0.3179 0.640 0.000 0.000 0.268 0.080 0.012
#> SRR1304022     4  0.5643     0.4246 0.036 0.112 0.000 0.660 0.176 0.016
#> SRR1304024     4  0.3944     0.5542 0.136 0.044 0.000 0.788 0.032 0.000
#> SRR1304023     5  0.4676     0.3665 0.004 0.040 0.000 0.308 0.640 0.008
#> SRR1304026     6  0.3923     0.0784 0.004 0.416 0.000 0.000 0.000 0.580
#> SRR1304027     6  0.3923     0.0784 0.004 0.416 0.000 0.000 0.000 0.580
#> SRR1304025     4  0.4827     0.4940 0.276 0.000 0.000 0.632 0.000 0.092
#> SRR1304028     2  0.4458     0.5895 0.008 0.680 0.000 0.276 0.024 0.012
#> SRR1304029     2  0.4619     0.5866 0.016 0.676 0.000 0.272 0.024 0.012
#> SRR1304030     1  0.4180     0.4063 0.628 0.348 0.024 0.000 0.000 0.000
#> SRR1304031     1  0.4283     0.3504 0.592 0.384 0.024 0.000 0.000 0.000
#> SRR1304032     2  0.3153     0.7055 0.000 0.832 0.000 0.128 0.008 0.032
#> SRR1304033     2  0.2822     0.7130 0.000 0.856 0.000 0.108 0.004 0.032
#> SRR1304034     2  0.1882     0.7004 0.024 0.928 0.000 0.020 0.000 0.028
#> SRR1304035     2  0.1718     0.7009 0.020 0.936 0.000 0.020 0.000 0.024
#> SRR1304036     2  0.3452     0.5403 0.016 0.788 0.000 0.012 0.000 0.184
#> SRR1304037     2  0.4049     0.5496 0.044 0.772 0.012 0.008 0.000 0.164
#> SRR1304038     4  0.4606     0.5096 0.268 0.000 0.000 0.656 0.000 0.076
#> SRR1304039     4  0.4149     0.5436 0.216 0.000 0.000 0.720 0.000 0.064
#> SRR1304040     4  0.3714     0.5391 0.116 0.024 0.000 0.808 0.000 0.052
#> SRR1304041     4  0.3847     0.5196 0.136 0.004 0.000 0.780 0.000 0.080
#> SRR1304042     4  0.5626    -0.2210 0.072 0.028 0.000 0.460 0.000 0.440
#> SRR1304043     4  0.5584    -0.2210 0.068 0.028 0.000 0.464 0.000 0.440
#> SRR1304046     1  0.2925     0.5862 0.864 0.000 0.000 0.060 0.064 0.012
#> SRR1304047     1  0.2575     0.5819 0.880 0.000 0.000 0.072 0.044 0.004
#> SRR1304044     4  0.5636    -0.0147 0.104 0.428 0.000 0.456 0.012 0.000
#> SRR1304045     4  0.5858     0.1321 0.140 0.372 0.000 0.476 0.012 0.000
#> SRR1304048     1  0.5055    -0.0326 0.540 0.004 0.008 0.400 0.000 0.048
#> SRR1304049     1  0.4901    -0.1956 0.484 0.000 0.000 0.456 0.000 0.060
#> SRR1304050     1  0.3374     0.5980 0.836 0.000 0.024 0.048 0.092 0.000
#> SRR1304051     1  0.2209     0.5983 0.900 0.072 0.000 0.024 0.004 0.000
#> SRR1304052     1  0.5656     0.0248 0.440 0.408 0.000 0.152 0.000 0.000
#> SRR1304053     1  0.3317     0.6113 0.836 0.080 0.072 0.012 0.000 0.000
#> SRR1304055     6  0.5923     0.1448 0.060 0.064 0.000 0.384 0.000 0.492
#> SRR1304054     1  0.4414     0.4845 0.672 0.280 0.000 0.040 0.000 0.008
#> SRR1304056     1  0.4787     0.5465 0.712 0.152 0.120 0.012 0.000 0.004
#> SRR1304059     1  0.7709     0.1125 0.448 0.108 0.048 0.232 0.000 0.164
#> SRR1304057     1  0.6246     0.2192 0.416 0.268 0.308 0.008 0.000 0.000
#> SRR1304058     6  0.7554     0.3138 0.008 0.160 0.192 0.232 0.000 0.408
#> SRR1304060     1  0.4580     0.2622 0.528 0.028 0.440 0.004 0.000 0.000
#> SRR1304061     6  0.7672     0.1717 0.288 0.192 0.008 0.160 0.000 0.352

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

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

collect_plots(res)

plot of chunk MAD-hclust-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.332           0.667       0.775         0.4060 0.499   0.499
#> 3 3 0.303           0.509       0.743         0.2920 0.755   0.592
#> 4 4 0.363           0.464       0.660         0.1856 0.658   0.401
#> 5 5 0.504           0.687       0.778         0.1525 0.750   0.425
#> 6 6 0.651           0.501       0.733         0.0736 0.933   0.764

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
#> SRR1303990     1  0.9286      0.959 0.656 0.344
#> SRR1303991     1  0.9286      0.959 0.656 0.344
#> SRR1303992     1  0.9286      0.959 0.656 0.344
#> SRR1303993     1  0.9286      0.959 0.656 0.344
#> SRR1303994     1  0.9286      0.959 0.656 0.344
#> SRR1303995     1  0.9286      0.959 0.656 0.344
#> SRR1303996     1  0.9286      0.959 0.656 0.344
#> SRR1303997     1  0.9286      0.959 0.656 0.344
#> SRR1303998     1  0.9286      0.959 0.656 0.344
#> SRR1303999     1  0.9286      0.959 0.656 0.344
#> SRR1304000     1  0.9286      0.959 0.656 0.344
#> SRR1304001     1  0.9286      0.959 0.656 0.344
#> SRR1304004     1  0.9393      0.951 0.644 0.356
#> SRR1304005     1  0.9393      0.951 0.644 0.356
#> SRR1304002     1  0.9963      0.812 0.536 0.464
#> SRR1304003     1  0.9963      0.812 0.536 0.464
#> SRR1304006     2  0.9815     -0.390 0.420 0.580
#> SRR1304007     2  0.9815     -0.390 0.420 0.580
#> SRR1304008     1  0.9286      0.959 0.656 0.344
#> SRR1304009     1  0.9286      0.959 0.656 0.344
#> SRR1304010     2  0.7815      0.417 0.232 0.768
#> SRR1304011     2  0.7815      0.417 0.232 0.768
#> SRR1304012     1  0.9286      0.959 0.656 0.344
#> SRR1304013     1  0.9286      0.959 0.656 0.344
#> SRR1304014     1  0.9896      0.858 0.560 0.440
#> SRR1304015     1  0.9286      0.959 0.656 0.344
#> SRR1304016     1  0.9393      0.951 0.644 0.356
#> SRR1304017     2  0.9983      0.569 0.476 0.524
#> SRR1304018     2  0.9983      0.569 0.476 0.524
#> SRR1304019     1  0.9286      0.959 0.656 0.344
#> SRR1304020     1  0.9286      0.959 0.656 0.344
#> SRR1304021     1  0.9896      0.858 0.560 0.440
#> SRR1304022     2  0.9983      0.569 0.476 0.524
#> SRR1304024     2  0.9983      0.569 0.476 0.524
#> SRR1304023     1  0.9286      0.959 0.656 0.344
#> SRR1304026     2  0.9286      0.541 0.344 0.656
#> SRR1304027     2  0.9286      0.541 0.344 0.656
#> SRR1304025     2  0.6148      0.561 0.152 0.848
#> SRR1304028     2  0.5946      0.563 0.144 0.856
#> SRR1304029     2  0.5946      0.563 0.144 0.856
#> SRR1304030     1  0.9393      0.951 0.644 0.356
#> SRR1304031     1  0.9393      0.951 0.644 0.356
#> SRR1304032     2  0.9286      0.541 0.344 0.656
#> SRR1304033     2  0.9286      0.541 0.344 0.656
#> SRR1304034     2  0.0672      0.590 0.008 0.992
#> SRR1304035     2  0.0672      0.590 0.008 0.992
#> SRR1304036     2  0.0672      0.590 0.008 0.992
#> SRR1304037     2  0.0672      0.590 0.008 0.992
#> SRR1304038     2  0.6148      0.561 0.152 0.848
#> SRR1304039     2  0.6148      0.561 0.152 0.848
#> SRR1304040     2  0.9983      0.569 0.476 0.524
#> SRR1304041     2  0.9983      0.569 0.476 0.524
#> SRR1304042     2  0.9286      0.541 0.344 0.656
#> SRR1304043     2  0.9286      0.541 0.344 0.656
#> SRR1304046     1  0.9896      0.858 0.560 0.440
#> SRR1304047     1  0.9896      0.858 0.560 0.440
#> SRR1304044     2  0.5842      0.565 0.140 0.860
#> SRR1304045     2  0.5842      0.565 0.140 0.860
#> SRR1304048     2  0.6048      0.557 0.148 0.852
#> SRR1304049     2  0.6048      0.557 0.148 0.852
#> SRR1304050     1  0.9896      0.858 0.560 0.440
#> SRR1304051     2  0.8443      0.327 0.272 0.728
#> SRR1304052     2  0.8443      0.327 0.272 0.728
#> SRR1304053     2  0.8443      0.327 0.272 0.728
#> SRR1304055     2  0.6438      0.502 0.164 0.836
#> SRR1304054     2  0.4161      0.583 0.084 0.916
#> SRR1304056     2  0.6438      0.502 0.164 0.836
#> SRR1304059     2  0.6712      0.490 0.176 0.824
#> SRR1304057     2  0.7528      0.416 0.216 0.784
#> SRR1304058     2  0.9044      0.559 0.320 0.680
#> SRR1304060     2  0.9963     -0.505 0.464 0.536
#> SRR1304061     2  0.6438      0.502 0.164 0.836

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>            class entropy silhouette    p1    p2    p3
#> SRR1303990     3  0.3192      0.919 0.112 0.000 0.888
#> SRR1303991     3  0.3192      0.919 0.112 0.000 0.888
#> SRR1303992     1  0.4605      0.568 0.796 0.000 0.204
#> SRR1303993     1  0.4605      0.568 0.796 0.000 0.204
#> SRR1303994     1  0.5810      0.367 0.664 0.000 0.336
#> SRR1303995     1  0.5810      0.367 0.664 0.000 0.336
#> SRR1303996     1  0.5810      0.367 0.664 0.000 0.336
#> SRR1303997     1  0.5810      0.367 0.664 0.000 0.336
#> SRR1303998     1  0.5810      0.367 0.664 0.000 0.336
#> SRR1303999     1  0.5810      0.367 0.664 0.000 0.336
#> SRR1304000     1  0.5810      0.367 0.664 0.000 0.336
#> SRR1304001     1  0.5810      0.367 0.664 0.000 0.336
#> SRR1304004     1  0.0424      0.709 0.992 0.008 0.000
#> SRR1304005     1  0.0424      0.709 0.992 0.008 0.000
#> SRR1304002     1  0.3682      0.632 0.876 0.116 0.008
#> SRR1304003     1  0.3682      0.632 0.876 0.116 0.008
#> SRR1304006     1  0.5639      0.400 0.752 0.232 0.016
#> SRR1304007     1  0.5639      0.400 0.752 0.232 0.016
#> SRR1304008     1  0.0237      0.710 0.996 0.000 0.004
#> SRR1304009     1  0.0237      0.710 0.996 0.000 0.004
#> SRR1304010     1  0.8113     -0.298 0.504 0.428 0.068
#> SRR1304011     1  0.8113     -0.298 0.504 0.428 0.068
#> SRR1304012     1  0.0237      0.710 0.996 0.000 0.004
#> SRR1304013     1  0.0237      0.710 0.996 0.000 0.004
#> SRR1304014     1  0.2796      0.665 0.908 0.092 0.000
#> SRR1304015     1  0.0237      0.710 0.996 0.000 0.004
#> SRR1304016     1  0.0424      0.709 0.992 0.008 0.000
#> SRR1304017     2  0.4092      0.576 0.036 0.876 0.088
#> SRR1304018     2  0.4092      0.576 0.036 0.876 0.088
#> SRR1304019     1  0.0237      0.710 0.996 0.000 0.004
#> SRR1304020     1  0.0237      0.710 0.996 0.000 0.004
#> SRR1304021     1  0.2796      0.665 0.908 0.092 0.000
#> SRR1304022     2  0.4092      0.576 0.036 0.876 0.088
#> SRR1304024     2  0.4092      0.576 0.036 0.876 0.088
#> SRR1304023     3  0.1832      0.846 0.036 0.008 0.956
#> SRR1304026     2  0.0424      0.557 0.000 0.992 0.008
#> SRR1304027     2  0.0424      0.557 0.000 0.992 0.008
#> SRR1304025     2  0.8025      0.554 0.420 0.516 0.064
#> SRR1304028     2  0.8384      0.578 0.392 0.520 0.088
#> SRR1304029     2  0.8384      0.578 0.392 0.520 0.088
#> SRR1304030     1  0.0424      0.709 0.992 0.008 0.000
#> SRR1304031     1  0.0424      0.709 0.992 0.008 0.000
#> SRR1304032     2  0.0424      0.557 0.000 0.992 0.008
#> SRR1304033     2  0.0424      0.557 0.000 0.992 0.008
#> SRR1304034     2  0.6318      0.590 0.356 0.636 0.008
#> SRR1304035     2  0.6318      0.590 0.356 0.636 0.008
#> SRR1304036     2  0.6318      0.590 0.356 0.636 0.008
#> SRR1304037     2  0.6318      0.590 0.356 0.636 0.008
#> SRR1304038     2  0.8025      0.554 0.420 0.516 0.064
#> SRR1304039     2  0.8025      0.554 0.420 0.516 0.064
#> SRR1304040     2  0.4092      0.576 0.036 0.876 0.088
#> SRR1304041     2  0.4092      0.576 0.036 0.876 0.088
#> SRR1304042     2  0.0424      0.557 0.000 0.992 0.008
#> SRR1304043     2  0.0424      0.557 0.000 0.992 0.008
#> SRR1304046     1  0.2796      0.665 0.908 0.092 0.000
#> SRR1304047     1  0.2796      0.665 0.908 0.092 0.000
#> SRR1304044     2  0.8328      0.578 0.396 0.520 0.084
#> SRR1304045     2  0.8328      0.578 0.396 0.520 0.084
#> SRR1304048     2  0.7962      0.542 0.428 0.512 0.060
#> SRR1304049     2  0.7962      0.542 0.428 0.512 0.060
#> SRR1304050     1  0.2796      0.665 0.908 0.092 0.000
#> SRR1304051     1  0.7699     -0.134 0.560 0.388 0.052
#> SRR1304052     1  0.7699     -0.134 0.560 0.388 0.052
#> SRR1304053     1  0.7699     -0.134 0.560 0.388 0.052
#> SRR1304055     2  0.7995      0.370 0.460 0.480 0.060
#> SRR1304054     2  0.6608      0.543 0.432 0.560 0.008
#> SRR1304056     2  0.7995      0.370 0.460 0.480 0.060
#> SRR1304059     2  0.7841      0.342 0.472 0.476 0.052
#> SRR1304057     1  0.7814     -0.264 0.512 0.436 0.052
#> SRR1304058     2  0.2400      0.544 0.004 0.932 0.064
#> SRR1304060     1  0.6537      0.460 0.740 0.196 0.064
#> SRR1304061     2  0.7995      0.370 0.460 0.480 0.060

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> SRR1303990     2  0.3400      0.885 0.000 0.820 0.180 0.000
#> SRR1303991     2  0.3400      0.885 0.000 0.820 0.180 0.000
#> SRR1303992     3  0.2589      0.513 0.116 0.000 0.884 0.000
#> SRR1303993     3  0.2589      0.513 0.116 0.000 0.884 0.000
#> SRR1303994     3  0.0707      0.454 0.000 0.020 0.980 0.000
#> SRR1303995     3  0.0707      0.454 0.000 0.020 0.980 0.000
#> SRR1303996     3  0.0707      0.454 0.000 0.020 0.980 0.000
#> SRR1303997     3  0.0707      0.454 0.000 0.020 0.980 0.000
#> SRR1303998     3  0.0707      0.454 0.000 0.020 0.980 0.000
#> SRR1303999     3  0.0707      0.454 0.000 0.020 0.980 0.000
#> SRR1304000     3  0.0707      0.454 0.000 0.020 0.980 0.000
#> SRR1304001     3  0.0707      0.454 0.000 0.020 0.980 0.000
#> SRR1304004     3  0.5000      0.401 0.496 0.000 0.504 0.000
#> SRR1304005     3  0.5000      0.401 0.496 0.000 0.504 0.000
#> SRR1304002     1  0.5478     -0.102 0.580 0.008 0.404 0.008
#> SRR1304003     1  0.5478     -0.102 0.580 0.008 0.404 0.008
#> SRR1304006     1  0.5925      0.250 0.644 0.008 0.304 0.044
#> SRR1304007     1  0.5925      0.250 0.644 0.008 0.304 0.044
#> SRR1304008     3  0.4996      0.424 0.484 0.000 0.516 0.000
#> SRR1304009     3  0.4996      0.424 0.484 0.000 0.516 0.000
#> SRR1304010     1  0.6116      0.523 0.712 0.020 0.172 0.096
#> SRR1304011     1  0.6116      0.523 0.712 0.020 0.172 0.096
#> SRR1304012     3  0.4996      0.424 0.484 0.000 0.516 0.000
#> SRR1304013     3  0.4996      0.424 0.484 0.000 0.516 0.000
#> SRR1304014     1  0.4907     -0.187 0.580 0.000 0.420 0.000
#> SRR1304015     3  0.4996      0.424 0.484 0.000 0.516 0.000
#> SRR1304016     3  0.5000      0.401 0.496 0.000 0.504 0.000
#> SRR1304017     4  0.5842      0.782 0.168 0.128 0.000 0.704
#> SRR1304018     4  0.5842      0.782 0.168 0.128 0.000 0.704
#> SRR1304019     3  0.4996      0.424 0.484 0.000 0.516 0.000
#> SRR1304020     3  0.4996      0.424 0.484 0.000 0.516 0.000
#> SRR1304021     1  0.4907     -0.187 0.580 0.000 0.420 0.000
#> SRR1304022     4  0.5842      0.782 0.168 0.128 0.000 0.704
#> SRR1304024     4  0.5842      0.782 0.168 0.128 0.000 0.704
#> SRR1304023     2  0.0188      0.747 0.004 0.996 0.000 0.000
#> SRR1304026     4  0.2973      0.771 0.144 0.000 0.000 0.856
#> SRR1304027     4  0.2973      0.771 0.144 0.000 0.000 0.856
#> SRR1304025     1  0.6198      0.513 0.708 0.092 0.024 0.176
#> SRR1304028     1  0.6542      0.455 0.620 0.128 0.000 0.252
#> SRR1304029     1  0.6542      0.455 0.620 0.128 0.000 0.252
#> SRR1304030     3  0.5000      0.401 0.496 0.000 0.504 0.000
#> SRR1304031     3  0.5000      0.401 0.496 0.000 0.504 0.000
#> SRR1304032     4  0.2530      0.665 0.112 0.000 0.000 0.888
#> SRR1304033     4  0.2530      0.665 0.112 0.000 0.000 0.888
#> SRR1304034     1  0.4543      0.454 0.676 0.000 0.000 0.324
#> SRR1304035     1  0.4543      0.454 0.676 0.000 0.000 0.324
#> SRR1304036     1  0.4543      0.454 0.676 0.000 0.000 0.324
#> SRR1304037     1  0.4543      0.454 0.676 0.000 0.000 0.324
#> SRR1304038     1  0.6198      0.513 0.708 0.092 0.024 0.176
#> SRR1304039     1  0.6198      0.513 0.708 0.092 0.024 0.176
#> SRR1304040     4  0.5842      0.782 0.168 0.128 0.000 0.704
#> SRR1304041     4  0.5842      0.782 0.168 0.128 0.000 0.704
#> SRR1304042     4  0.2973      0.771 0.144 0.000 0.000 0.856
#> SRR1304043     4  0.2973      0.771 0.144 0.000 0.000 0.856
#> SRR1304046     1  0.4907     -0.187 0.580 0.000 0.420 0.000
#> SRR1304047     1  0.4907     -0.187 0.580 0.000 0.420 0.000
#> SRR1304044     1  0.6495      0.460 0.624 0.124 0.000 0.252
#> SRR1304045     1  0.6495      0.460 0.624 0.124 0.000 0.252
#> SRR1304048     1  0.6070      0.533 0.728 0.088 0.032 0.152
#> SRR1304049     1  0.6070      0.533 0.728 0.088 0.032 0.152
#> SRR1304050     1  0.4907     -0.187 0.580 0.000 0.420 0.000
#> SRR1304051     1  0.5894      0.482 0.696 0.004 0.212 0.088
#> SRR1304052     1  0.5894      0.482 0.696 0.004 0.212 0.088
#> SRR1304053     1  0.5894      0.482 0.696 0.004 0.212 0.088
#> SRR1304055     1  0.5277      0.542 0.752 0.000 0.132 0.116
#> SRR1304054     1  0.3726      0.543 0.788 0.000 0.000 0.212
#> SRR1304056     1  0.5277      0.542 0.752 0.000 0.132 0.116
#> SRR1304059     1  0.5160      0.541 0.760 0.000 0.136 0.104
#> SRR1304057     1  0.5250      0.525 0.744 0.000 0.176 0.080
#> SRR1304058     4  0.6080      0.667 0.272 0.012 0.056 0.660
#> SRR1304060     1  0.5997      0.156 0.592 0.012 0.368 0.028
#> SRR1304061     1  0.5277      0.542 0.752 0.000 0.132 0.116

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>            class entropy silhouette    p1    p2    p3    p4    p5
#> SRR1303990     5  0.3109      0.877 0.000 0.000 0.200 0.000 0.800
#> SRR1303991     5  0.3109      0.877 0.000 0.000 0.200 0.000 0.800
#> SRR1303992     3  0.3774      0.477 0.296 0.000 0.704 0.000 0.000
#> SRR1303993     3  0.3774      0.477 0.296 0.000 0.704 0.000 0.000
#> SRR1303994     3  0.0000      0.873 0.000 0.000 1.000 0.000 0.000
#> SRR1303995     3  0.0000      0.873 0.000 0.000 1.000 0.000 0.000
#> SRR1303996     3  0.0000      0.873 0.000 0.000 1.000 0.000 0.000
#> SRR1303997     3  0.0000      0.873 0.000 0.000 1.000 0.000 0.000
#> SRR1303998     3  0.0000      0.873 0.000 0.000 1.000 0.000 0.000
#> SRR1303999     3  0.0000      0.873 0.000 0.000 1.000 0.000 0.000
#> SRR1304000     3  0.0000      0.873 0.000 0.000 1.000 0.000 0.000
#> SRR1304001     3  0.0000      0.873 0.000 0.000 1.000 0.000 0.000
#> SRR1304004     1  0.3807      0.709 0.748 0.012 0.240 0.000 0.000
#> SRR1304005     1  0.3807      0.709 0.748 0.012 0.240 0.000 0.000
#> SRR1304002     1  0.4693      0.707 0.724 0.080 0.196 0.000 0.000
#> SRR1304003     1  0.4693      0.707 0.724 0.080 0.196 0.000 0.000
#> SRR1304006     1  0.2900      0.681 0.884 0.040 0.064 0.012 0.000
#> SRR1304007     1  0.2900      0.681 0.884 0.040 0.064 0.012 0.000
#> SRR1304008     1  0.4167      0.697 0.724 0.024 0.252 0.000 0.000
#> SRR1304009     1  0.4167      0.697 0.724 0.024 0.252 0.000 0.000
#> SRR1304010     1  0.6102      0.513 0.668 0.184 0.044 0.096 0.008
#> SRR1304011     1  0.6102      0.513 0.668 0.184 0.044 0.096 0.008
#> SRR1304012     1  0.4167      0.697 0.724 0.024 0.252 0.000 0.000
#> SRR1304013     1  0.4167      0.697 0.724 0.024 0.252 0.000 0.000
#> SRR1304014     1  0.3994      0.715 0.772 0.040 0.188 0.000 0.000
#> SRR1304015     1  0.4167      0.697 0.724 0.024 0.252 0.000 0.000
#> SRR1304016     1  0.3579      0.711 0.756 0.004 0.240 0.000 0.000
#> SRR1304017     4  0.5330      0.705 0.048 0.296 0.000 0.640 0.016
#> SRR1304018     4  0.5330      0.705 0.048 0.296 0.000 0.640 0.016
#> SRR1304019     1  0.4167      0.697 0.724 0.024 0.252 0.000 0.000
#> SRR1304020     1  0.4167      0.697 0.724 0.024 0.252 0.000 0.000
#> SRR1304021     1  0.3994      0.715 0.772 0.040 0.188 0.000 0.000
#> SRR1304022     4  0.5330      0.705 0.048 0.296 0.000 0.640 0.016
#> SRR1304024     4  0.5330      0.705 0.048 0.296 0.000 0.640 0.016
#> SRR1304023     5  0.0162      0.778 0.000 0.004 0.000 0.000 0.996
#> SRR1304026     4  0.0000      0.690 0.000 0.000 0.000 1.000 0.000
#> SRR1304027     4  0.0000      0.690 0.000 0.000 0.000 1.000 0.000
#> SRR1304025     2  0.4747      0.699 0.184 0.732 0.004 0.080 0.000
#> SRR1304028     2  0.2408      0.740 0.092 0.892 0.000 0.000 0.016
#> SRR1304029     2  0.2408      0.740 0.092 0.892 0.000 0.000 0.016
#> SRR1304030     1  0.3579      0.711 0.756 0.004 0.240 0.000 0.000
#> SRR1304031     1  0.3579      0.711 0.756 0.004 0.240 0.000 0.000
#> SRR1304032     4  0.3143      0.557 0.000 0.204 0.000 0.796 0.000
#> SRR1304033     4  0.3143      0.557 0.000 0.204 0.000 0.796 0.000
#> SRR1304034     2  0.5581      0.663 0.140 0.636 0.000 0.224 0.000
#> SRR1304035     2  0.5581      0.663 0.140 0.636 0.000 0.224 0.000
#> SRR1304036     2  0.5581      0.663 0.140 0.636 0.000 0.224 0.000
#> SRR1304037     2  0.5581      0.663 0.140 0.636 0.000 0.224 0.000
#> SRR1304038     2  0.4747      0.699 0.184 0.732 0.004 0.080 0.000
#> SRR1304039     2  0.4747      0.699 0.184 0.732 0.004 0.080 0.000
#> SRR1304040     4  0.5330      0.705 0.048 0.296 0.000 0.640 0.016
#> SRR1304041     4  0.5330      0.705 0.048 0.296 0.000 0.640 0.016
#> SRR1304042     4  0.0000      0.690 0.000 0.000 0.000 1.000 0.000
#> SRR1304043     4  0.0000      0.690 0.000 0.000 0.000 1.000 0.000
#> SRR1304046     1  0.3994      0.715 0.772 0.040 0.188 0.000 0.000
#> SRR1304047     1  0.3994      0.715 0.772 0.040 0.188 0.000 0.000
#> SRR1304044     2  0.2172      0.738 0.076 0.908 0.000 0.000 0.016
#> SRR1304045     2  0.2172      0.738 0.076 0.908 0.000 0.000 0.016
#> SRR1304048     2  0.5430      0.687 0.188 0.680 0.008 0.124 0.000
#> SRR1304049     2  0.5430      0.687 0.188 0.680 0.008 0.124 0.000
#> SRR1304050     1  0.3994      0.715 0.772 0.040 0.188 0.000 0.000
#> SRR1304051     1  0.5924      0.561 0.700 0.136 0.060 0.096 0.008
#> SRR1304052     1  0.5924      0.561 0.700 0.136 0.060 0.096 0.008
#> SRR1304053     1  0.5924      0.561 0.700 0.136 0.060 0.096 0.008
#> SRR1304055     1  0.5174      0.484 0.708 0.168 0.008 0.116 0.000
#> SRR1304054     2  0.4787      0.691 0.208 0.712 0.000 0.080 0.000
#> SRR1304056     1  0.5174      0.484 0.708 0.168 0.008 0.116 0.000
#> SRR1304059     1  0.5034      0.498 0.720 0.168 0.008 0.104 0.000
#> SRR1304057     1  0.4986      0.538 0.736 0.164 0.020 0.080 0.000
#> SRR1304058     4  0.6003      0.512 0.192 0.152 0.008 0.640 0.008
#> SRR1304060     1  0.3145      0.655 0.868 0.060 0.064 0.000 0.008
#> SRR1304061     1  0.5174      0.484 0.708 0.168 0.008 0.116 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
#> SRR1303990     1  0.5880    -0.3734 0.424 0.000 0.2 0.000 0.000 0.376
#> SRR1303991     1  0.5880    -0.3734 0.424 0.000 0.2 0.000 0.000 0.376
#> SRR1303992     3  0.3409     0.5283 0.000 0.000 0.7 0.000 0.300 0.000
#> SRR1303993     3  0.3409     0.5283 0.000 0.000 0.7 0.000 0.300 0.000
#> SRR1303994     3  0.0000     0.8914 0.000 0.000 1.0 0.000 0.000 0.000
#> SRR1303995     3  0.0000     0.8914 0.000 0.000 1.0 0.000 0.000 0.000
#> SRR1303996     3  0.0000     0.8914 0.000 0.000 1.0 0.000 0.000 0.000
#> SRR1303997     3  0.0000     0.8914 0.000 0.000 1.0 0.000 0.000 0.000
#> SRR1303998     3  0.0000     0.8914 0.000 0.000 1.0 0.000 0.000 0.000
#> SRR1303999     3  0.0000     0.8914 0.000 0.000 1.0 0.000 0.000 0.000
#> SRR1304000     3  0.0000     0.8914 0.000 0.000 1.0 0.000 0.000 0.000
#> SRR1304001     3  0.0000     0.8914 0.000 0.000 1.0 0.000 0.000 0.000
#> SRR1304004     5  0.0632     0.7215 0.000 0.024 0.0 0.000 0.976 0.000
#> SRR1304005     5  0.0632     0.7215 0.000 0.024 0.0 0.000 0.976 0.000
#> SRR1304002     5  0.3227     0.6555 0.116 0.060 0.0 0.000 0.824 0.000
#> SRR1304003     5  0.3227     0.6555 0.116 0.060 0.0 0.000 0.824 0.000
#> SRR1304006     5  0.3719     0.4788 0.248 0.024 0.0 0.000 0.728 0.000
#> SRR1304007     5  0.3719     0.4788 0.248 0.024 0.0 0.000 0.728 0.000
#> SRR1304008     5  0.1092     0.7124 0.000 0.020 0.0 0.000 0.960 0.020
#> SRR1304009     5  0.1092     0.7124 0.000 0.020 0.0 0.000 0.960 0.020
#> SRR1304010     5  0.5112    -0.2166 0.444 0.080 0.0 0.000 0.476 0.000
#> SRR1304011     5  0.5112    -0.2166 0.444 0.080 0.0 0.000 0.476 0.000
#> SRR1304012     5  0.1092     0.7124 0.000 0.020 0.0 0.000 0.960 0.020
#> SRR1304013     5  0.1092     0.7124 0.000 0.020 0.0 0.000 0.960 0.020
#> SRR1304014     5  0.3150     0.6599 0.120 0.052 0.0 0.000 0.828 0.000
#> SRR1304015     5  0.1092     0.7124 0.000 0.020 0.0 0.000 0.960 0.020
#> SRR1304016     5  0.0458     0.7205 0.000 0.016 0.0 0.000 0.984 0.000
#> SRR1304017     4  0.4332     0.5695 0.048 0.288 0.0 0.664 0.000 0.000
#> SRR1304018     4  0.4332     0.5695 0.048 0.288 0.0 0.664 0.000 0.000
#> SRR1304019     5  0.1092     0.7124 0.000 0.020 0.0 0.000 0.960 0.020
#> SRR1304020     5  0.1092     0.7124 0.000 0.020 0.0 0.000 0.960 0.020
#> SRR1304021     5  0.3150     0.6599 0.120 0.052 0.0 0.000 0.828 0.000
#> SRR1304022     4  0.4332     0.5695 0.048 0.288 0.0 0.664 0.000 0.000
#> SRR1304024     4  0.4332     0.5695 0.048 0.288 0.0 0.664 0.000 0.000
#> SRR1304023     6  0.3944     0.0680 0.428 0.000 0.0 0.004 0.000 0.568
#> SRR1304026     4  0.3774    -0.1948 0.000 0.000 0.0 0.592 0.000 0.408
#> SRR1304027     4  0.3774    -0.1948 0.000 0.000 0.0 0.592 0.000 0.408
#> SRR1304025     2  0.4146     0.6752 0.120 0.776 0.0 0.080 0.024 0.000
#> SRR1304028     2  0.0692     0.7183 0.000 0.976 0.0 0.004 0.020 0.000
#> SRR1304029     2  0.0692     0.7183 0.000 0.976 0.0 0.004 0.020 0.000
#> SRR1304030     5  0.0547     0.7208 0.000 0.020 0.0 0.000 0.980 0.000
#> SRR1304031     5  0.0547     0.7208 0.000 0.020 0.0 0.000 0.980 0.000
#> SRR1304032     6  0.5901     0.3651 0.000 0.204 0.0 0.388 0.000 0.408
#> SRR1304033     6  0.5901     0.3651 0.000 0.204 0.0 0.388 0.000 0.408
#> SRR1304034     2  0.5108     0.6250 0.136 0.688 0.0 0.152 0.020 0.004
#> SRR1304035     2  0.5108     0.6250 0.136 0.688 0.0 0.152 0.020 0.004
#> SRR1304036     2  0.5108     0.6250 0.136 0.688 0.0 0.152 0.020 0.004
#> SRR1304037     2  0.5108     0.6250 0.136 0.688 0.0 0.152 0.020 0.004
#> SRR1304038     2  0.4146     0.6752 0.120 0.776 0.0 0.080 0.024 0.000
#> SRR1304039     2  0.4146     0.6752 0.120 0.776 0.0 0.080 0.024 0.000
#> SRR1304040     4  0.4332     0.5695 0.048 0.288 0.0 0.664 0.000 0.000
#> SRR1304041     4  0.4332     0.5695 0.048 0.288 0.0 0.664 0.000 0.000
#> SRR1304042     4  0.3782    -0.1923 0.000 0.000 0.0 0.588 0.000 0.412
#> SRR1304043     4  0.3782    -0.1923 0.000 0.000 0.0 0.588 0.000 0.412
#> SRR1304046     5  0.3150     0.6599 0.120 0.052 0.0 0.000 0.828 0.000
#> SRR1304047     5  0.3150     0.6599 0.120 0.052 0.0 0.000 0.828 0.000
#> SRR1304044     2  0.0000     0.7150 0.000 1.000 0.0 0.000 0.000 0.000
#> SRR1304045     2  0.0000     0.7150 0.000 1.000 0.0 0.000 0.000 0.000
#> SRR1304048     2  0.4853     0.6672 0.204 0.696 0.0 0.068 0.032 0.000
#> SRR1304049     2  0.4853     0.6672 0.204 0.696 0.0 0.068 0.032 0.000
#> SRR1304050     5  0.3150     0.6599 0.120 0.052 0.0 0.000 0.828 0.000
#> SRR1304051     5  0.4872    -0.0355 0.388 0.064 0.0 0.000 0.548 0.000
#> SRR1304052     5  0.4872    -0.0355 0.388 0.064 0.0 0.000 0.548 0.000
#> SRR1304053     5  0.4872    -0.0355 0.388 0.064 0.0 0.000 0.548 0.000
#> SRR1304055     1  0.5182     0.3569 0.540 0.072 0.0 0.008 0.380 0.000
#> SRR1304054     2  0.3650     0.6393 0.272 0.716 0.0 0.008 0.004 0.000
#> SRR1304056     1  0.5182     0.3569 0.540 0.072 0.0 0.008 0.380 0.000
#> SRR1304059     1  0.4972     0.3338 0.536 0.072 0.0 0.000 0.392 0.000
#> SRR1304057     1  0.5025     0.2293 0.492 0.072 0.0 0.000 0.436 0.000
#> SRR1304058     4  0.4107     0.1444 0.452 0.004 0.0 0.540 0.000 0.004
#> SRR1304060     5  0.3221     0.4484 0.264 0.000 0.0 0.000 0.736 0.000
#> SRR1304061     1  0.5182     0.3569 0.540 0.072 0.0 0.008 0.380 0.000

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

consensus_heatmap(res, k = 2)

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

consensus_heatmap(res, k = 3)

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

consensus_heatmap(res, k = 4)

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

consensus_heatmap(res, k = 5)

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

consensus_heatmap(res, k = 6)

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

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

membership_heatmap(res, k = 2)

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

membership_heatmap(res, k = 3)

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

membership_heatmap(res, k = 4)

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

membership_heatmap(res, k = 5)

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

membership_heatmap(res, k = 6)

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

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

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

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

get_signatures(res, k = 3)

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

get_signatures(res, k = 4)

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

get_signatures(res, k = 5)

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

get_signatures(res, k = 6)

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

Signature heatmaps where rows are not scaled:

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

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

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

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

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

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

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

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

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

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

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk MAD-hclust-signature_compare

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

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

An example of the output of tb is:

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

The columns in tb are:

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

UMAP plot which shows how samples are separated.

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

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

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

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

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

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

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

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

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

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

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk MAD-hclust-collect-classes

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

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

collect_plots(res)

plot of chunk MAD-kmeans-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.409           0.778       0.862         0.4448 0.507   0.507
#> 3 3 0.469           0.742       0.796         0.3612 0.784   0.612
#> 4 4 0.502           0.651       0.782         0.1529 0.840   0.615
#> 5 5 0.582           0.569       0.739         0.0864 0.905   0.705
#> 6 6 0.651           0.587       0.711         0.0575 0.868   0.556

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
#> SRR1303990     1  0.2603     0.8032 0.956 0.044
#> SRR1303991     1  0.2603     0.8032 0.956 0.044
#> SRR1303992     1  0.2948     0.8006 0.948 0.052
#> SRR1303993     1  0.2948     0.8006 0.948 0.052
#> SRR1303994     1  0.2948     0.8006 0.948 0.052
#> SRR1303995     1  0.2948     0.8006 0.948 0.052
#> SRR1303996     1  0.2948     0.8006 0.948 0.052
#> SRR1303997     1  0.2948     0.8006 0.948 0.052
#> SRR1303998     1  0.3114     0.7996 0.944 0.056
#> SRR1303999     1  0.3114     0.7996 0.944 0.056
#> SRR1304000     1  0.2948     0.8006 0.948 0.052
#> SRR1304001     1  0.2948     0.8006 0.948 0.052
#> SRR1304004     1  0.5737     0.8394 0.864 0.136
#> SRR1304005     1  0.5737     0.8394 0.864 0.136
#> SRR1304002     1  0.9358     0.7367 0.648 0.352
#> SRR1304003     1  0.9358     0.7367 0.648 0.352
#> SRR1304006     1  0.6801     0.8359 0.820 0.180
#> SRR1304007     1  0.6801     0.8359 0.820 0.180
#> SRR1304008     1  0.5737     0.8394 0.864 0.136
#> SRR1304009     1  0.5737     0.8394 0.864 0.136
#> SRR1304010     1  0.9044     0.7756 0.680 0.320
#> SRR1304011     1  0.9044     0.7756 0.680 0.320
#> SRR1304012     1  0.5737     0.8385 0.864 0.136
#> SRR1304013     1  0.5737     0.8385 0.864 0.136
#> SRR1304014     1  0.8955     0.7596 0.688 0.312
#> SRR1304015     1  0.5737     0.8385 0.864 0.136
#> SRR1304016     1  0.8327     0.7993 0.736 0.264
#> SRR1304017     2  0.1184     0.8980 0.016 0.984
#> SRR1304018     2  0.0672     0.9055 0.008 0.992
#> SRR1304019     1  0.5737     0.8385 0.864 0.136
#> SRR1304020     1  0.5629     0.8386 0.868 0.132
#> SRR1304021     1  0.8386     0.7969 0.732 0.268
#> SRR1304022     2  0.0938     0.8996 0.012 0.988
#> SRR1304024     2  0.0376     0.9074 0.004 0.996
#> SRR1304023     1  0.8327     0.7750 0.736 0.264
#> SRR1304026     2  0.0376     0.9101 0.004 0.996
#> SRR1304027     2  0.0376     0.9101 0.004 0.996
#> SRR1304025     2  0.0000     0.9097 0.000 1.000
#> SRR1304028     2  0.0376     0.9083 0.004 0.996
#> SRR1304029     2  0.0376     0.9083 0.004 0.996
#> SRR1304030     1  0.8713     0.7931 0.708 0.292
#> SRR1304031     1  0.8713     0.7931 0.708 0.292
#> SRR1304032     2  0.0376     0.9101 0.004 0.996
#> SRR1304033     2  0.0376     0.9101 0.004 0.996
#> SRR1304034     2  0.0376     0.9101 0.004 0.996
#> SRR1304035     2  0.0376     0.9101 0.004 0.996
#> SRR1304036     2  0.0376     0.9101 0.004 0.996
#> SRR1304037     2  0.0376     0.9101 0.004 0.996
#> SRR1304038     2  0.9686    -0.0432 0.396 0.604
#> SRR1304039     2  0.9686    -0.0432 0.396 0.604
#> SRR1304040     2  0.0000     0.9097 0.000 1.000
#> SRR1304041     2  0.0000     0.9097 0.000 1.000
#> SRR1304042     2  0.0376     0.9101 0.004 0.996
#> SRR1304043     2  0.0376     0.9101 0.004 0.996
#> SRR1304046     1  0.8955     0.7596 0.688 0.312
#> SRR1304047     1  0.8955     0.7596 0.688 0.312
#> SRR1304044     2  0.0376     0.9083 0.004 0.996
#> SRR1304045     2  0.0376     0.9083 0.004 0.996
#> SRR1304048     2  0.0000     0.9097 0.000 1.000
#> SRR1304049     2  0.0000     0.9097 0.000 1.000
#> SRR1304050     1  0.9248     0.7441 0.660 0.340
#> SRR1304051     1  0.8813     0.7899 0.700 0.300
#> SRR1304052     2  0.9983    -0.3486 0.476 0.524
#> SRR1304053     1  0.8813     0.7899 0.700 0.300
#> SRR1304055     2  0.0376     0.9101 0.004 0.996
#> SRR1304054     2  0.0376     0.9101 0.004 0.996
#> SRR1304056     1  0.9358     0.7367 0.648 0.352
#> SRR1304059     1  0.9896     0.5606 0.560 0.440
#> SRR1304057     1  0.9358     0.7367 0.648 0.352
#> SRR1304058     2  0.0000     0.9097 0.000 1.000
#> SRR1304060     1  0.4431     0.8166 0.908 0.092
#> SRR1304061     2  1.0000    -0.4252 0.500 0.500

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>            class entropy silhouette    p1    p2    p3
#> SRR1303990     1  0.6836    -0.0714 0.572 0.016 0.412
#> SRR1303991     1  0.6836    -0.0714 0.572 0.016 0.412
#> SRR1303992     3  0.5859     1.0000 0.344 0.000 0.656
#> SRR1303993     3  0.5859     1.0000 0.344 0.000 0.656
#> SRR1303994     3  0.5859     1.0000 0.344 0.000 0.656
#> SRR1303995     3  0.5859     1.0000 0.344 0.000 0.656
#> SRR1303996     3  0.5859     1.0000 0.344 0.000 0.656
#> SRR1303997     3  0.5859     1.0000 0.344 0.000 0.656
#> SRR1303998     3  0.5859     1.0000 0.344 0.000 0.656
#> SRR1303999     3  0.5859     1.0000 0.344 0.000 0.656
#> SRR1304000     3  0.5859     1.0000 0.344 0.000 0.656
#> SRR1304001     3  0.5859     1.0000 0.344 0.000 0.656
#> SRR1304004     1  0.3482     0.6727 0.872 0.000 0.128
#> SRR1304005     1  0.3482     0.6727 0.872 0.000 0.128
#> SRR1304002     1  0.0848     0.7758 0.984 0.008 0.008
#> SRR1304003     1  0.0848     0.7758 0.984 0.008 0.008
#> SRR1304006     1  0.0892     0.7683 0.980 0.000 0.020
#> SRR1304007     1  0.0892     0.7683 0.980 0.000 0.020
#> SRR1304008     1  0.3551     0.6723 0.868 0.000 0.132
#> SRR1304009     1  0.3551     0.6723 0.868 0.000 0.132
#> SRR1304010     1  0.5420     0.5779 0.752 0.008 0.240
#> SRR1304011     1  0.5420     0.5779 0.752 0.008 0.240
#> SRR1304012     1  0.4047     0.6757 0.848 0.004 0.148
#> SRR1304013     1  0.4047     0.6757 0.848 0.004 0.148
#> SRR1304014     1  0.0424     0.7778 0.992 0.008 0.000
#> SRR1304015     1  0.3816     0.6793 0.852 0.000 0.148
#> SRR1304016     1  0.1015     0.7770 0.980 0.008 0.012
#> SRR1304017     2  0.8869     0.7509 0.160 0.560 0.280
#> SRR1304018     2  0.8958     0.7441 0.168 0.552 0.280
#> SRR1304019     1  0.3816     0.6793 0.852 0.000 0.148
#> SRR1304020     1  0.3816     0.6720 0.852 0.000 0.148
#> SRR1304021     1  0.0848     0.7774 0.984 0.008 0.008
#> SRR1304022     2  0.8107     0.7808 0.096 0.604 0.300
#> SRR1304024     2  0.7848     0.8005 0.096 0.640 0.264
#> SRR1304023     1  0.8157     0.3837 0.540 0.076 0.384
#> SRR1304026     2  0.1337     0.8091 0.016 0.972 0.012
#> SRR1304027     2  0.1337     0.8091 0.016 0.972 0.012
#> SRR1304025     2  0.8334     0.7950 0.136 0.616 0.248
#> SRR1304028     2  0.6128     0.8279 0.084 0.780 0.136
#> SRR1304029     2  0.6128     0.8279 0.084 0.780 0.136
#> SRR1304030     1  0.1453     0.7743 0.968 0.008 0.024
#> SRR1304031     1  0.1453     0.7743 0.968 0.008 0.024
#> SRR1304032     2  0.1031     0.8093 0.024 0.976 0.000
#> SRR1304033     2  0.1031     0.8093 0.024 0.976 0.000
#> SRR1304034     2  0.2152     0.8059 0.036 0.948 0.016
#> SRR1304035     2  0.2152     0.8059 0.036 0.948 0.016
#> SRR1304036     2  0.2998     0.8038 0.068 0.916 0.016
#> SRR1304037     2  0.2998     0.8038 0.068 0.916 0.016
#> SRR1304038     1  0.8996     0.2068 0.560 0.196 0.244
#> SRR1304039     1  0.8996     0.2068 0.560 0.196 0.244
#> SRR1304040     2  0.7848     0.8005 0.096 0.640 0.264
#> SRR1304041     2  0.7848     0.8005 0.096 0.640 0.264
#> SRR1304042     2  0.3850     0.8220 0.028 0.884 0.088
#> SRR1304043     2  0.3850     0.8220 0.028 0.884 0.088
#> SRR1304046     1  0.0424     0.7778 0.992 0.008 0.000
#> SRR1304047     1  0.0424     0.7778 0.992 0.008 0.000
#> SRR1304044     2  0.6644     0.8248 0.108 0.752 0.140
#> SRR1304045     2  0.6644     0.8248 0.108 0.752 0.140
#> SRR1304048     2  0.9578     0.6433 0.272 0.480 0.248
#> SRR1304049     2  0.9578     0.6433 0.272 0.480 0.248
#> SRR1304050     1  0.0424     0.7778 0.992 0.008 0.000
#> SRR1304051     1  0.1711     0.7722 0.960 0.008 0.032
#> SRR1304052     1  0.6053     0.5506 0.720 0.020 0.260
#> SRR1304053     1  0.1711     0.7722 0.960 0.008 0.032
#> SRR1304055     2  0.5815     0.8211 0.104 0.800 0.096
#> SRR1304054     2  0.3272     0.8061 0.080 0.904 0.016
#> SRR1304056     1  0.1711     0.7724 0.960 0.008 0.032
#> SRR1304059     1  0.1832     0.7707 0.956 0.008 0.036
#> SRR1304057     1  0.1832     0.7707 0.956 0.008 0.036
#> SRR1304058     2  0.7107     0.8178 0.092 0.712 0.196
#> SRR1304060     1  0.4346     0.5766 0.816 0.000 0.184
#> SRR1304061     1  0.4874     0.6525 0.828 0.144 0.028

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> SRR1303990     3  0.7684      0.232 0.388 0.000 0.396 0.216
#> SRR1303991     3  0.7684      0.232 0.388 0.000 0.396 0.216
#> SRR1303992     3  0.2546      0.896 0.092 0.000 0.900 0.008
#> SRR1303993     3  0.2546      0.896 0.092 0.000 0.900 0.008
#> SRR1303994     3  0.2401      0.896 0.092 0.000 0.904 0.004
#> SRR1303995     3  0.2401      0.896 0.092 0.000 0.904 0.004
#> SRR1303996     3  0.2676      0.896 0.092 0.000 0.896 0.012
#> SRR1303997     3  0.2676      0.896 0.092 0.000 0.896 0.012
#> SRR1303998     3  0.2676      0.895 0.092 0.000 0.896 0.012
#> SRR1303999     3  0.2676      0.895 0.092 0.000 0.896 0.012
#> SRR1304000     3  0.2216      0.897 0.092 0.000 0.908 0.000
#> SRR1304001     3  0.2216      0.897 0.092 0.000 0.908 0.000
#> SRR1304004     1  0.3856      0.716 0.832 0.000 0.136 0.032
#> SRR1304005     1  0.3856      0.716 0.832 0.000 0.136 0.032
#> SRR1304002     1  0.3564      0.796 0.860 0.016 0.012 0.112
#> SRR1304003     1  0.3564      0.796 0.860 0.016 0.012 0.112
#> SRR1304006     1  0.3317      0.796 0.868 0.012 0.008 0.112
#> SRR1304007     1  0.3317      0.796 0.868 0.012 0.008 0.112
#> SRR1304008     1  0.4174      0.710 0.816 0.000 0.140 0.044
#> SRR1304009     1  0.4174      0.710 0.816 0.000 0.140 0.044
#> SRR1304010     1  0.5531      0.152 0.548 0.004 0.012 0.436
#> SRR1304011     1  0.5531      0.152 0.548 0.004 0.012 0.436
#> SRR1304012     1  0.4605      0.698 0.796 0.000 0.132 0.072
#> SRR1304013     1  0.4605      0.698 0.796 0.000 0.132 0.072
#> SRR1304014     1  0.2255      0.808 0.920 0.012 0.000 0.068
#> SRR1304015     1  0.4388      0.706 0.808 0.000 0.132 0.060
#> SRR1304016     1  0.0376      0.805 0.992 0.004 0.000 0.004
#> SRR1304017     4  0.5591      0.633 0.084 0.172 0.008 0.736
#> SRR1304018     4  0.5628      0.640 0.092 0.164 0.008 0.736
#> SRR1304019     1  0.4462      0.702 0.804 0.000 0.132 0.064
#> SRR1304020     1  0.4388      0.706 0.808 0.000 0.132 0.060
#> SRR1304021     1  0.1151      0.804 0.968 0.000 0.008 0.024
#> SRR1304022     4  0.4077      0.559 0.012 0.184 0.004 0.800
#> SRR1304024     4  0.4663      0.530 0.012 0.272 0.000 0.716
#> SRR1304023     4  0.4724      0.493 0.148 0.012 0.044 0.796
#> SRR1304026     2  0.3099      0.679 0.000 0.876 0.020 0.104
#> SRR1304027     2  0.3099      0.679 0.000 0.876 0.020 0.104
#> SRR1304025     4  0.5910      0.589 0.088 0.236 0.000 0.676
#> SRR1304028     2  0.6357      0.354 0.028 0.604 0.032 0.336
#> SRR1304029     2  0.6357      0.354 0.028 0.604 0.032 0.336
#> SRR1304030     1  0.3320      0.794 0.876 0.056 0.000 0.068
#> SRR1304031     1  0.3320      0.794 0.876 0.056 0.000 0.068
#> SRR1304032     2  0.2256      0.691 0.000 0.924 0.020 0.056
#> SRR1304033     2  0.2256      0.691 0.000 0.924 0.020 0.056
#> SRR1304034     2  0.1174      0.692 0.012 0.968 0.000 0.020
#> SRR1304035     2  0.1174      0.692 0.012 0.968 0.000 0.020
#> SRR1304036     2  0.3582      0.634 0.068 0.868 0.004 0.060
#> SRR1304037     2  0.3582      0.634 0.068 0.868 0.004 0.060
#> SRR1304038     4  0.5540      0.502 0.352 0.012 0.012 0.624
#> SRR1304039     4  0.5540      0.502 0.352 0.012 0.012 0.624
#> SRR1304040     4  0.4776      0.531 0.016 0.272 0.000 0.712
#> SRR1304041     4  0.4776      0.531 0.016 0.272 0.000 0.712
#> SRR1304042     2  0.5215      0.497 0.004 0.680 0.020 0.296
#> SRR1304043     2  0.5215      0.497 0.004 0.680 0.020 0.296
#> SRR1304046     1  0.1042      0.807 0.972 0.008 0.000 0.020
#> SRR1304047     1  0.1042      0.807 0.972 0.008 0.000 0.020
#> SRR1304044     2  0.6667      0.204 0.032 0.524 0.032 0.412
#> SRR1304045     2  0.6667      0.204 0.032 0.524 0.032 0.412
#> SRR1304048     4  0.6438      0.618 0.208 0.132 0.004 0.656
#> SRR1304049     4  0.6438      0.618 0.208 0.132 0.004 0.656
#> SRR1304050     1  0.2926      0.802 0.888 0.012 0.004 0.096
#> SRR1304051     1  0.3575      0.790 0.852 0.020 0.004 0.124
#> SRR1304052     4  0.5845      0.278 0.424 0.020 0.008 0.548
#> SRR1304053     1  0.3575      0.790 0.852 0.020 0.004 0.124
#> SRR1304055     2  0.7658      0.206 0.164 0.524 0.016 0.296
#> SRR1304054     2  0.3471      0.668 0.068 0.880 0.016 0.036
#> SRR1304056     1  0.4342      0.767 0.820 0.044 0.008 0.128
#> SRR1304059     1  0.4425      0.764 0.816 0.048 0.008 0.128
#> SRR1304057     1  0.4288      0.769 0.824 0.044 0.008 0.124
#> SRR1304058     4  0.6395      0.475 0.080 0.260 0.012 0.648
#> SRR1304060     1  0.5664      0.741 0.740 0.012 0.156 0.092
#> SRR1304061     1  0.5436      0.704 0.756 0.108 0.008 0.128

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>            class entropy silhouette    p1    p2    p3    p4    p5
#> SRR1303990     5  0.7254     1.0000 0.152 0.000 0.260 0.072 0.516
#> SRR1303991     5  0.7254     1.0000 0.152 0.000 0.260 0.072 0.516
#> SRR1303992     3  0.1780     0.9654 0.024 0.000 0.940 0.008 0.028
#> SRR1303993     3  0.1780     0.9654 0.024 0.000 0.940 0.008 0.028
#> SRR1303994     3  0.0703     0.9771 0.024 0.000 0.976 0.000 0.000
#> SRR1303995     3  0.0703     0.9771 0.024 0.000 0.976 0.000 0.000
#> SRR1303996     3  0.1948     0.9683 0.024 0.000 0.932 0.008 0.036
#> SRR1303997     3  0.1948     0.9683 0.024 0.000 0.932 0.008 0.036
#> SRR1303998     3  0.1471     0.9720 0.024 0.000 0.952 0.004 0.020
#> SRR1303999     3  0.1471     0.9720 0.024 0.000 0.952 0.004 0.020
#> SRR1304000     3  0.0703     0.9771 0.024 0.000 0.976 0.000 0.000
#> SRR1304001     3  0.0703     0.9771 0.024 0.000 0.976 0.000 0.000
#> SRR1304004     1  0.5632     0.3760 0.620 0.000 0.088 0.008 0.284
#> SRR1304005     1  0.5632     0.3760 0.620 0.000 0.088 0.008 0.284
#> SRR1304002     1  0.2066     0.6138 0.932 0.008 0.008 0.024 0.028
#> SRR1304003     1  0.2066     0.6138 0.932 0.008 0.008 0.024 0.028
#> SRR1304006     1  0.3613     0.6023 0.844 0.000 0.016 0.068 0.072
#> SRR1304007     1  0.3613     0.6023 0.844 0.000 0.016 0.068 0.072
#> SRR1304008     1  0.5786     0.3262 0.584 0.000 0.088 0.008 0.320
#> SRR1304009     1  0.5786     0.3262 0.584 0.000 0.088 0.008 0.320
#> SRR1304010     4  0.5598     0.2729 0.452 0.000 0.004 0.484 0.060
#> SRR1304011     4  0.5598     0.2729 0.452 0.000 0.004 0.484 0.060
#> SRR1304012     1  0.6013     0.2811 0.556 0.000 0.084 0.016 0.344
#> SRR1304013     1  0.6013     0.2811 0.556 0.000 0.084 0.016 0.344
#> SRR1304014     1  0.1443     0.6125 0.948 0.004 0.004 0.000 0.044
#> SRR1304015     1  0.5882     0.3097 0.572 0.000 0.084 0.012 0.332
#> SRR1304016     1  0.3439     0.5648 0.800 0.000 0.004 0.008 0.188
#> SRR1304017     4  0.3325     0.6425 0.056 0.044 0.008 0.872 0.020
#> SRR1304018     4  0.3447     0.6471 0.068 0.040 0.008 0.864 0.020
#> SRR1304019     1  0.5921     0.2869 0.560 0.000 0.084 0.012 0.344
#> SRR1304020     1  0.5921     0.2869 0.560 0.000 0.084 0.012 0.344
#> SRR1304021     1  0.2957     0.5865 0.860 0.000 0.008 0.012 0.120
#> SRR1304022     4  0.1988     0.5981 0.000 0.048 0.008 0.928 0.016
#> SRR1304024     4  0.2362     0.5962 0.000 0.084 0.008 0.900 0.008
#> SRR1304023     4  0.4697     0.2701 0.012 0.000 0.008 0.620 0.360
#> SRR1304026     2  0.3359     0.7227 0.000 0.848 0.004 0.096 0.052
#> SRR1304027     2  0.3359     0.7227 0.000 0.848 0.004 0.096 0.052
#> SRR1304025     4  0.5300     0.6437 0.148 0.060 0.004 0.736 0.052
#> SRR1304028     2  0.6500     0.2498 0.020 0.548 0.012 0.328 0.092
#> SRR1304029     2  0.6500     0.2498 0.020 0.548 0.012 0.328 0.092
#> SRR1304030     1  0.4090     0.6017 0.800 0.036 0.008 0.008 0.148
#> SRR1304031     1  0.4090     0.6017 0.800 0.036 0.008 0.008 0.148
#> SRR1304032     2  0.1869     0.7509 0.000 0.936 0.008 0.028 0.028
#> SRR1304033     2  0.1869     0.7509 0.000 0.936 0.008 0.028 0.028
#> SRR1304034     2  0.0854     0.7542 0.004 0.976 0.000 0.008 0.012
#> SRR1304035     2  0.0854     0.7542 0.004 0.976 0.000 0.008 0.012
#> SRR1304036     2  0.2395     0.7382 0.048 0.912 0.000 0.016 0.024
#> SRR1304037     2  0.2395     0.7382 0.048 0.912 0.000 0.016 0.024
#> SRR1304038     4  0.5401     0.5975 0.308 0.004 0.008 0.628 0.052
#> SRR1304039     4  0.5401     0.5975 0.308 0.004 0.008 0.628 0.052
#> SRR1304040     4  0.2112     0.5988 0.000 0.084 0.004 0.908 0.004
#> SRR1304041     4  0.2112     0.5988 0.000 0.084 0.004 0.908 0.004
#> SRR1304042     2  0.6865     0.3670 0.036 0.504 0.000 0.320 0.140
#> SRR1304043     2  0.6865     0.3670 0.036 0.504 0.000 0.320 0.140
#> SRR1304046     1  0.2741     0.5795 0.860 0.004 0.004 0.000 0.132
#> SRR1304047     1  0.2741     0.5795 0.860 0.004 0.004 0.000 0.132
#> SRR1304044     4  0.6817    -0.0203 0.028 0.432 0.012 0.436 0.092
#> SRR1304045     4  0.6817    -0.0203 0.028 0.432 0.012 0.436 0.092
#> SRR1304048     4  0.5767     0.6378 0.232 0.036 0.008 0.668 0.056
#> SRR1304049     4  0.5767     0.6378 0.232 0.036 0.008 0.668 0.056
#> SRR1304050     1  0.1467     0.6184 0.956 0.004 0.008 0.016 0.016
#> SRR1304051     1  0.4925     0.5908 0.764 0.020 0.008 0.096 0.112
#> SRR1304052     1  0.6717    -0.2034 0.436 0.020 0.004 0.420 0.120
#> SRR1304053     1  0.4925     0.5908 0.764 0.020 0.008 0.096 0.112
#> SRR1304055     1  0.8438    -0.2014 0.348 0.296 0.004 0.200 0.152
#> SRR1304054     2  0.4953     0.6609 0.100 0.772 0.012 0.028 0.088
#> SRR1304056     1  0.5112     0.5442 0.740 0.024 0.004 0.080 0.152
#> SRR1304059     1  0.5436     0.5138 0.704 0.024 0.004 0.080 0.188
#> SRR1304057     1  0.4619     0.5729 0.784 0.024 0.004 0.076 0.112
#> SRR1304058     4  0.6766     0.4389 0.148 0.080 0.000 0.604 0.168
#> SRR1304060     1  0.6219     0.4699 0.652 0.000 0.176 0.064 0.108
#> SRR1304061     1  0.5639     0.5210 0.708 0.048 0.004 0.080 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
#> SRR1303990     6  0.6974     1.0000 0.028 0.000 0.188 0.028 0.368 0.388
#> SRR1303991     6  0.6974     1.0000 0.028 0.000 0.188 0.028 0.368 0.388
#> SRR1303992     3  0.2209     0.9087 0.000 0.004 0.900 0.000 0.024 0.072
#> SRR1303993     3  0.2209     0.9087 0.000 0.004 0.900 0.000 0.024 0.072
#> SRR1303994     3  0.0260     0.9572 0.000 0.000 0.992 0.000 0.008 0.000
#> SRR1303995     3  0.0260     0.9572 0.000 0.000 0.992 0.000 0.008 0.000
#> SRR1303996     3  0.1418     0.9501 0.000 0.000 0.944 0.000 0.024 0.032
#> SRR1303997     3  0.1418     0.9501 0.000 0.000 0.944 0.000 0.024 0.032
#> SRR1303998     3  0.1334     0.9459 0.000 0.000 0.948 0.000 0.032 0.020
#> SRR1303999     3  0.1334     0.9459 0.000 0.000 0.948 0.000 0.032 0.020
#> SRR1304000     3  0.0146     0.9575 0.000 0.000 0.996 0.000 0.004 0.000
#> SRR1304001     3  0.0146     0.9575 0.000 0.000 0.996 0.000 0.004 0.000
#> SRR1304004     5  0.3453     0.8072 0.164 0.000 0.044 0.000 0.792 0.000
#> SRR1304005     5  0.3453     0.8072 0.164 0.000 0.044 0.000 0.792 0.000
#> SRR1304002     1  0.5402     0.3833 0.612 0.004 0.000 0.016 0.272 0.096
#> SRR1304003     1  0.5402     0.3833 0.612 0.004 0.000 0.016 0.272 0.096
#> SRR1304006     1  0.2257     0.6451 0.876 0.000 0.000 0.000 0.116 0.008
#> SRR1304007     1  0.2257     0.6451 0.876 0.000 0.000 0.000 0.116 0.008
#> SRR1304008     5  0.3519     0.8079 0.144 0.000 0.044 0.000 0.804 0.008
#> SRR1304009     5  0.3519     0.8079 0.144 0.000 0.044 0.000 0.804 0.008
#> SRR1304010     1  0.6979    -0.1325 0.388 0.004 0.000 0.380 0.128 0.100
#> SRR1304011     1  0.6979    -0.1325 0.388 0.004 0.000 0.380 0.128 0.100
#> SRR1304012     5  0.2889     0.7822 0.108 0.000 0.044 0.000 0.848 0.000
#> SRR1304013     5  0.2889     0.7822 0.108 0.000 0.044 0.000 0.848 0.000
#> SRR1304014     1  0.4760     0.1506 0.576 0.000 0.000 0.008 0.376 0.040
#> SRR1304015     5  0.3149     0.8052 0.132 0.000 0.044 0.000 0.824 0.000
#> SRR1304016     5  0.3819     0.5884 0.372 0.000 0.000 0.000 0.624 0.004
#> SRR1304017     4  0.3935     0.5791 0.100 0.008 0.000 0.808 0.032 0.052
#> SRR1304018     4  0.4009     0.5797 0.112 0.008 0.000 0.800 0.032 0.048
#> SRR1304019     5  0.2979     0.7910 0.116 0.000 0.044 0.000 0.840 0.000
#> SRR1304020     5  0.3108     0.8012 0.128 0.000 0.044 0.000 0.828 0.000
#> SRR1304021     5  0.4763     0.4173 0.392 0.000 0.000 0.012 0.564 0.032
#> SRR1304022     4  0.2924     0.5511 0.028 0.000 0.000 0.864 0.024 0.084
#> SRR1304024     4  0.2179     0.5671 0.024 0.008 0.000 0.916 0.012 0.040
#> SRR1304023     4  0.6127    -0.0679 0.024 0.000 0.004 0.432 0.124 0.416
#> SRR1304026     2  0.4478     0.6552 0.000 0.728 0.000 0.116 0.008 0.148
#> SRR1304027     2  0.4478     0.6552 0.000 0.728 0.000 0.116 0.008 0.148
#> SRR1304025     4  0.5662     0.5441 0.192 0.020 0.000 0.652 0.028 0.108
#> SRR1304028     2  0.6123     0.4407 0.036 0.572 0.000 0.204 0.004 0.184
#> SRR1304029     2  0.6123     0.4407 0.036 0.572 0.000 0.204 0.004 0.184
#> SRR1304030     1  0.5024     0.4406 0.680 0.072 0.000 0.000 0.212 0.036
#> SRR1304031     1  0.5024     0.4406 0.680 0.072 0.000 0.000 0.212 0.036
#> SRR1304032     2  0.2575     0.7547 0.004 0.872 0.000 0.024 0.000 0.100
#> SRR1304033     2  0.2575     0.7547 0.004 0.872 0.000 0.024 0.000 0.100
#> SRR1304034     2  0.1340     0.7729 0.040 0.948 0.000 0.000 0.004 0.008
#> SRR1304035     2  0.1340     0.7729 0.040 0.948 0.000 0.000 0.004 0.008
#> SRR1304036     2  0.2056     0.7627 0.080 0.904 0.000 0.000 0.004 0.012
#> SRR1304037     2  0.2056     0.7627 0.080 0.904 0.000 0.000 0.004 0.012
#> SRR1304038     4  0.6134     0.4504 0.280 0.012 0.000 0.560 0.036 0.112
#> SRR1304039     4  0.6134     0.4504 0.280 0.012 0.000 0.560 0.036 0.112
#> SRR1304040     4  0.2050     0.5728 0.032 0.008 0.000 0.920 0.004 0.036
#> SRR1304041     4  0.2050     0.5728 0.032 0.008 0.000 0.920 0.004 0.036
#> SRR1304042     4  0.7246    -0.1255 0.076 0.348 0.000 0.356 0.008 0.212
#> SRR1304043     4  0.7246    -0.1255 0.076 0.348 0.000 0.356 0.008 0.212
#> SRR1304046     5  0.4676     0.5180 0.384 0.000 0.000 0.004 0.572 0.040
#> SRR1304047     5  0.4676     0.5180 0.384 0.000 0.000 0.004 0.572 0.040
#> SRR1304044     4  0.6656     0.0210 0.024 0.348 0.000 0.404 0.008 0.216
#> SRR1304045     4  0.6656     0.0210 0.024 0.348 0.000 0.404 0.008 0.216
#> SRR1304048     4  0.5967     0.4818 0.260 0.016 0.000 0.588 0.028 0.108
#> SRR1304049     4  0.5967     0.4818 0.260 0.016 0.000 0.588 0.028 0.108
#> SRR1304050     1  0.4705     0.2910 0.612 0.000 0.000 0.008 0.336 0.044
#> SRR1304051     1  0.2809     0.6473 0.848 0.000 0.000 0.004 0.128 0.020
#> SRR1304052     1  0.4563     0.4268 0.724 0.000 0.000 0.184 0.024 0.068
#> SRR1304053     1  0.2809     0.6473 0.848 0.000 0.000 0.004 0.128 0.020
#> SRR1304055     1  0.6207     0.2928 0.616 0.176 0.000 0.092 0.012 0.104
#> SRR1304054     2  0.5604     0.6019 0.120 0.660 0.000 0.036 0.012 0.172
#> SRR1304056     1  0.0951     0.6599 0.968 0.004 0.000 0.000 0.020 0.008
#> SRR1304059     1  0.0837     0.6569 0.972 0.004 0.000 0.004 0.000 0.020
#> SRR1304057     1  0.1226     0.6612 0.952 0.004 0.000 0.000 0.040 0.004
#> SRR1304058     4  0.6035     0.2791 0.360 0.020 0.000 0.488 0.004 0.128
#> SRR1304060     1  0.4141     0.6030 0.780 0.000 0.108 0.004 0.092 0.016
#> SRR1304061     1  0.1838     0.6550 0.928 0.012 0.000 0.000 0.020 0.040

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

consensus_heatmap(res, k = 2)

plot of chunk tab-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 15595 rows and 72 columns.
#>   Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'MAD' method.
#>   Subgroups are detected by 'skmeans' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 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.971           0.922       0.971         0.5035 0.496   0.496
#> 3 3 0.618           0.716       0.814         0.3140 0.793   0.601
#> 4 4 0.808           0.784       0.898         0.1434 0.837   0.561
#> 5 5 0.813           0.774       0.876         0.0651 0.842   0.466
#> 6 6 0.803           0.704       0.806         0.0359 0.988   0.939

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
#> SRR1303990     1   0.000     0.9727 1.000 0.000
#> SRR1303991     1   0.000     0.9727 1.000 0.000
#> SRR1303992     1   0.000     0.9727 1.000 0.000
#> SRR1303993     1   0.000     0.9727 1.000 0.000
#> SRR1303994     1   0.000     0.9727 1.000 0.000
#> SRR1303995     1   0.000     0.9727 1.000 0.000
#> SRR1303996     1   0.000     0.9727 1.000 0.000
#> SRR1303997     1   0.000     0.9727 1.000 0.000
#> SRR1303998     1   0.000     0.9727 1.000 0.000
#> SRR1303999     1   0.000     0.9727 1.000 0.000
#> SRR1304000     1   0.000     0.9727 1.000 0.000
#> SRR1304001     1   0.000     0.9727 1.000 0.000
#> SRR1304004     1   0.000     0.9727 1.000 0.000
#> SRR1304005     1   0.000     0.9727 1.000 0.000
#> SRR1304002     1   0.000     0.9727 1.000 0.000
#> SRR1304003     1   0.000     0.9727 1.000 0.000
#> SRR1304006     1   0.000     0.9727 1.000 0.000
#> SRR1304007     1   0.000     0.9727 1.000 0.000
#> SRR1304008     1   0.000     0.9727 1.000 0.000
#> SRR1304009     1   0.000     0.9727 1.000 0.000
#> SRR1304010     2   0.971     0.3402 0.400 0.600
#> SRR1304011     2   0.971     0.3402 0.400 0.600
#> SRR1304012     1   0.000     0.9727 1.000 0.000
#> SRR1304013     1   0.000     0.9727 1.000 0.000
#> SRR1304014     1   0.000     0.9727 1.000 0.000
#> SRR1304015     1   0.000     0.9727 1.000 0.000
#> SRR1304016     1   0.000     0.9727 1.000 0.000
#> SRR1304017     2   0.000     0.9636 0.000 1.000
#> SRR1304018     2   0.000     0.9636 0.000 1.000
#> SRR1304019     1   0.000     0.9727 1.000 0.000
#> SRR1304020     1   0.000     0.9727 1.000 0.000
#> SRR1304021     1   0.000     0.9727 1.000 0.000
#> SRR1304022     2   0.000     0.9636 0.000 1.000
#> SRR1304024     2   0.000     0.9636 0.000 1.000
#> SRR1304023     2   0.000     0.9636 0.000 1.000
#> SRR1304026     2   0.000     0.9636 0.000 1.000
#> SRR1304027     2   0.000     0.9636 0.000 1.000
#> SRR1304025     2   0.000     0.9636 0.000 1.000
#> SRR1304028     2   0.000     0.9636 0.000 1.000
#> SRR1304029     2   0.000     0.9636 0.000 1.000
#> SRR1304030     1   0.000     0.9727 1.000 0.000
#> SRR1304031     1   0.000     0.9727 1.000 0.000
#> SRR1304032     2   0.000     0.9636 0.000 1.000
#> SRR1304033     2   0.000     0.9636 0.000 1.000
#> SRR1304034     2   0.000     0.9636 0.000 1.000
#> SRR1304035     2   0.000     0.9636 0.000 1.000
#> SRR1304036     2   0.000     0.9636 0.000 1.000
#> SRR1304037     2   0.000     0.9636 0.000 1.000
#> SRR1304038     2   0.000     0.9636 0.000 1.000
#> SRR1304039     2   0.000     0.9636 0.000 1.000
#> SRR1304040     2   0.000     0.9636 0.000 1.000
#> SRR1304041     2   0.000     0.9636 0.000 1.000
#> SRR1304042     2   0.000     0.9636 0.000 1.000
#> SRR1304043     2   0.000     0.9636 0.000 1.000
#> SRR1304046     1   0.000     0.9727 1.000 0.000
#> SRR1304047     1   0.000     0.9727 1.000 0.000
#> SRR1304044     2   0.000     0.9636 0.000 1.000
#> SRR1304045     2   0.000     0.9636 0.000 1.000
#> SRR1304048     2   0.000     0.9636 0.000 1.000
#> SRR1304049     2   0.000     0.9636 0.000 1.000
#> SRR1304050     1   0.000     0.9727 1.000 0.000
#> SRR1304051     1   0.000     0.9727 1.000 0.000
#> SRR1304052     2   0.000     0.9636 0.000 1.000
#> SRR1304053     1   0.000     0.9727 1.000 0.000
#> SRR1304055     2   0.000     0.9636 0.000 1.000
#> SRR1304054     2   0.000     0.9636 0.000 1.000
#> SRR1304056     1   0.430     0.8802 0.912 0.088
#> SRR1304059     2   0.881     0.5510 0.300 0.700
#> SRR1304057     1   0.969     0.3268 0.604 0.396
#> SRR1304058     2   0.000     0.9636 0.000 1.000
#> SRR1304060     1   0.000     0.9727 1.000 0.000
#> SRR1304061     1   1.000     0.0024 0.504 0.496

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>            class entropy silhouette    p1    p2    p3
#> SRR1303990     1  0.1753      0.758 0.952 0.000 0.048
#> SRR1303991     1  0.1753      0.758 0.952 0.000 0.048
#> SRR1303992     3  0.5968      0.793 0.364 0.000 0.636
#> SRR1303993     3  0.5968      0.793 0.364 0.000 0.636
#> SRR1303994     3  0.5968      0.793 0.364 0.000 0.636
#> SRR1303995     3  0.5968      0.793 0.364 0.000 0.636
#> SRR1303996     3  0.5968      0.793 0.364 0.000 0.636
#> SRR1303997     3  0.5968      0.793 0.364 0.000 0.636
#> SRR1303998     3  0.5968      0.793 0.364 0.000 0.636
#> SRR1303999     3  0.5968      0.793 0.364 0.000 0.636
#> SRR1304000     3  0.5968      0.793 0.364 0.000 0.636
#> SRR1304001     3  0.5968      0.793 0.364 0.000 0.636
#> SRR1304004     1  0.0000      0.794 1.000 0.000 0.000
#> SRR1304005     1  0.0000      0.794 1.000 0.000 0.000
#> SRR1304002     3  0.5810      0.444 0.336 0.000 0.664
#> SRR1304003     3  0.5785      0.442 0.332 0.000 0.668
#> SRR1304006     3  0.5948      0.792 0.360 0.000 0.640
#> SRR1304007     3  0.5948      0.792 0.360 0.000 0.640
#> SRR1304008     1  0.0000      0.794 1.000 0.000 0.000
#> SRR1304009     1  0.0000      0.794 1.000 0.000 0.000
#> SRR1304010     1  0.6442      0.328 0.564 0.432 0.004
#> SRR1304011     1  0.6442      0.328 0.564 0.432 0.004
#> SRR1304012     1  0.0000      0.794 1.000 0.000 0.000
#> SRR1304013     1  0.0000      0.794 1.000 0.000 0.000
#> SRR1304014     1  0.4654      0.624 0.792 0.000 0.208
#> SRR1304015     1  0.0000      0.794 1.000 0.000 0.000
#> SRR1304016     1  0.0237      0.793 0.996 0.000 0.004
#> SRR1304017     2  0.0000      0.815 0.000 1.000 0.000
#> SRR1304018     2  0.0000      0.815 0.000 1.000 0.000
#> SRR1304019     1  0.0000      0.794 1.000 0.000 0.000
#> SRR1304020     1  0.0000      0.794 1.000 0.000 0.000
#> SRR1304021     1  0.0000      0.794 1.000 0.000 0.000
#> SRR1304022     2  0.0000      0.815 0.000 1.000 0.000
#> SRR1304024     2  0.0000      0.815 0.000 1.000 0.000
#> SRR1304023     2  0.6274     -0.101 0.456 0.544 0.000
#> SRR1304026     2  0.5948      0.760 0.000 0.640 0.360
#> SRR1304027     2  0.5948      0.760 0.000 0.640 0.360
#> SRR1304025     2  0.0000      0.815 0.000 1.000 0.000
#> SRR1304028     2  0.1753      0.814 0.000 0.952 0.048
#> SRR1304029     2  0.1753      0.814 0.000 0.952 0.048
#> SRR1304030     1  0.5591      0.372 0.696 0.000 0.304
#> SRR1304031     1  0.5591      0.372 0.696 0.000 0.304
#> SRR1304032     2  0.5948      0.760 0.000 0.640 0.360
#> SRR1304033     2  0.5948      0.760 0.000 0.640 0.360
#> SRR1304034     2  0.5948      0.760 0.000 0.640 0.360
#> SRR1304035     2  0.5948      0.760 0.000 0.640 0.360
#> SRR1304036     2  0.5968      0.757 0.000 0.636 0.364
#> SRR1304037     2  0.5968      0.757 0.000 0.636 0.364
#> SRR1304038     2  0.0747      0.808 0.000 0.984 0.016
#> SRR1304039     2  0.0747      0.808 0.000 0.984 0.016
#> SRR1304040     2  0.0000      0.815 0.000 1.000 0.000
#> SRR1304041     2  0.0000      0.815 0.000 1.000 0.000
#> SRR1304042     2  0.5948      0.760 0.000 0.640 0.360
#> SRR1304043     2  0.5948      0.760 0.000 0.640 0.360
#> SRR1304046     1  0.4654      0.624 0.792 0.000 0.208
#> SRR1304047     1  0.4654      0.624 0.792 0.000 0.208
#> SRR1304044     2  0.0237      0.816 0.000 0.996 0.004
#> SRR1304045     2  0.0237      0.816 0.000 0.996 0.004
#> SRR1304048     2  0.0000      0.815 0.000 1.000 0.000
#> SRR1304049     2  0.0000      0.815 0.000 1.000 0.000
#> SRR1304050     1  0.4654      0.624 0.792 0.000 0.208
#> SRR1304051     1  0.5092      0.586 0.804 0.020 0.176
#> SRR1304052     2  0.0237      0.814 0.000 0.996 0.004
#> SRR1304053     1  0.5092      0.586 0.804 0.020 0.176
#> SRR1304055     2  0.5948      0.760 0.000 0.640 0.360
#> SRR1304054     2  0.5948      0.760 0.000 0.640 0.360
#> SRR1304056     3  0.0000      0.562 0.000 0.000 1.000
#> SRR1304059     3  0.0000      0.562 0.000 0.000 1.000
#> SRR1304057     3  0.0000      0.562 0.000 0.000 1.000
#> SRR1304058     2  0.5591      0.772 0.000 0.696 0.304
#> SRR1304060     3  0.5948      0.792 0.360 0.000 0.640
#> SRR1304061     3  0.0424      0.555 0.000 0.008 0.992

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> SRR1303990     1  0.4981     0.2274 0.536 0.000 0.464 0.000
#> SRR1303991     1  0.4981     0.2274 0.536 0.000 0.464 0.000
#> SRR1303992     3  0.0336     0.9126 0.008 0.000 0.992 0.000
#> SRR1303993     3  0.0336     0.9126 0.008 0.000 0.992 0.000
#> SRR1303994     3  0.0336     0.9126 0.008 0.000 0.992 0.000
#> SRR1303995     3  0.0336     0.9126 0.008 0.000 0.992 0.000
#> SRR1303996     3  0.0336     0.9126 0.008 0.000 0.992 0.000
#> SRR1303997     3  0.0336     0.9126 0.008 0.000 0.992 0.000
#> SRR1303998     3  0.0336     0.9126 0.008 0.000 0.992 0.000
#> SRR1303999     3  0.0336     0.9126 0.008 0.000 0.992 0.000
#> SRR1304000     3  0.0336     0.9126 0.008 0.000 0.992 0.000
#> SRR1304001     3  0.0336     0.9126 0.008 0.000 0.992 0.000
#> SRR1304004     1  0.0188     0.8846 0.996 0.000 0.004 0.000
#> SRR1304005     1  0.0188     0.8846 0.996 0.000 0.004 0.000
#> SRR1304002     3  0.5602     0.1236 0.472 0.020 0.508 0.000
#> SRR1304003     3  0.5602     0.1236 0.472 0.020 0.508 0.000
#> SRR1304006     3  0.0921     0.8927 0.000 0.028 0.972 0.000
#> SRR1304007     3  0.0921     0.8927 0.000 0.028 0.972 0.000
#> SRR1304008     1  0.0188     0.8846 0.996 0.000 0.004 0.000
#> SRR1304009     1  0.0188     0.8846 0.996 0.000 0.004 0.000
#> SRR1304010     4  0.1389     0.9032 0.048 0.000 0.000 0.952
#> SRR1304011     4  0.1389     0.9032 0.048 0.000 0.000 0.952
#> SRR1304012     1  0.0376     0.8845 0.992 0.000 0.004 0.004
#> SRR1304013     1  0.0376     0.8845 0.992 0.000 0.004 0.004
#> SRR1304014     1  0.0817     0.8761 0.976 0.024 0.000 0.000
#> SRR1304015     1  0.0376     0.8845 0.992 0.000 0.004 0.004
#> SRR1304016     1  0.0336     0.8803 0.992 0.000 0.008 0.000
#> SRR1304017     4  0.0000     0.9373 0.000 0.000 0.000 1.000
#> SRR1304018     4  0.0000     0.9373 0.000 0.000 0.000 1.000
#> SRR1304019     1  0.0376     0.8845 0.992 0.000 0.004 0.004
#> SRR1304020     1  0.0188     0.8846 0.996 0.000 0.004 0.000
#> SRR1304021     1  0.0376     0.8845 0.992 0.000 0.004 0.004
#> SRR1304022     4  0.0000     0.9373 0.000 0.000 0.000 1.000
#> SRR1304024     4  0.0188     0.9376 0.000 0.004 0.000 0.996
#> SRR1304023     4  0.1042     0.9205 0.020 0.000 0.008 0.972
#> SRR1304026     2  0.2081     0.8152 0.000 0.916 0.000 0.084
#> SRR1304027     2  0.2081     0.8152 0.000 0.916 0.000 0.084
#> SRR1304025     4  0.0336     0.9365 0.000 0.008 0.000 0.992
#> SRR1304028     2  0.4996     0.0522 0.000 0.516 0.000 0.484
#> SRR1304029     2  0.4996     0.0522 0.000 0.516 0.000 0.484
#> SRR1304030     1  0.5351     0.7161 0.744 0.152 0.104 0.000
#> SRR1304031     1  0.5351     0.7161 0.744 0.152 0.104 0.000
#> SRR1304032     2  0.2081     0.8152 0.000 0.916 0.000 0.084
#> SRR1304033     2  0.2081     0.8152 0.000 0.916 0.000 0.084
#> SRR1304034     2  0.0921     0.8213 0.000 0.972 0.000 0.028
#> SRR1304035     2  0.0921     0.8213 0.000 0.972 0.000 0.028
#> SRR1304036     2  0.0336     0.8161 0.000 0.992 0.000 0.008
#> SRR1304037     2  0.0336     0.8161 0.000 0.992 0.000 0.008
#> SRR1304038     4  0.0672     0.9355 0.000 0.008 0.008 0.984
#> SRR1304039     4  0.0672     0.9355 0.000 0.008 0.008 0.984
#> SRR1304040     4  0.0188     0.9376 0.000 0.004 0.000 0.996
#> SRR1304041     4  0.0188     0.9376 0.000 0.004 0.000 0.996
#> SRR1304042     2  0.3444     0.7661 0.000 0.816 0.000 0.184
#> SRR1304043     2  0.3444     0.7661 0.000 0.816 0.000 0.184
#> SRR1304046     1  0.0707     0.8783 0.980 0.020 0.000 0.000
#> SRR1304047     1  0.0707     0.8783 0.980 0.020 0.000 0.000
#> SRR1304044     4  0.4277     0.5915 0.000 0.280 0.000 0.720
#> SRR1304045     4  0.4277     0.5915 0.000 0.280 0.000 0.720
#> SRR1304048     4  0.0336     0.9365 0.000 0.008 0.000 0.992
#> SRR1304049     4  0.0336     0.9365 0.000 0.008 0.000 0.992
#> SRR1304050     1  0.0817     0.8761 0.976 0.024 0.000 0.000
#> SRR1304051     1  0.6267     0.6568 0.692 0.088 0.200 0.020
#> SRR1304052     4  0.2520     0.8547 0.004 0.088 0.004 0.904
#> SRR1304053     1  0.6402     0.6481 0.684 0.088 0.204 0.024
#> SRR1304055     2  0.1389     0.8230 0.000 0.952 0.000 0.048
#> SRR1304054     2  0.1302     0.8221 0.000 0.956 0.000 0.044
#> SRR1304056     2  0.4576     0.5944 0.012 0.728 0.260 0.000
#> SRR1304059     2  0.4422     0.6031 0.008 0.736 0.256 0.000
#> SRR1304057     2  0.4511     0.5855 0.008 0.724 0.268 0.000
#> SRR1304058     2  0.4655     0.5467 0.000 0.684 0.004 0.312
#> SRR1304060     3  0.1398     0.8799 0.004 0.040 0.956 0.000
#> SRR1304061     2  0.2714     0.7577 0.004 0.884 0.112 0.000

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>            class entropy silhouette    p1    p2    p3    p4    p5
#> SRR1303990     3  0.5576      0.210 0.060 0.000 0.512 0.004 0.424
#> SRR1303991     3  0.5576      0.210 0.060 0.000 0.512 0.004 0.424
#> SRR1303992     3  0.0000      0.884 0.000 0.000 1.000 0.000 0.000
#> SRR1303993     3  0.0000      0.884 0.000 0.000 1.000 0.000 0.000
#> SRR1303994     3  0.0000      0.884 0.000 0.000 1.000 0.000 0.000
#> SRR1303995     3  0.0000      0.884 0.000 0.000 1.000 0.000 0.000
#> SRR1303996     3  0.0000      0.884 0.000 0.000 1.000 0.000 0.000
#> SRR1303997     3  0.0000      0.884 0.000 0.000 1.000 0.000 0.000
#> SRR1303998     3  0.0000      0.884 0.000 0.000 1.000 0.000 0.000
#> SRR1303999     3  0.0000      0.884 0.000 0.000 1.000 0.000 0.000
#> SRR1304000     3  0.0000      0.884 0.000 0.000 1.000 0.000 0.000
#> SRR1304001     3  0.0000      0.884 0.000 0.000 1.000 0.000 0.000
#> SRR1304004     5  0.0000      0.908 0.000 0.000 0.000 0.000 1.000
#> SRR1304005     5  0.0000      0.908 0.000 0.000 0.000 0.000 1.000
#> SRR1304002     5  0.6659      0.213 0.088 0.000 0.392 0.044 0.476
#> SRR1304003     5  0.6659      0.213 0.088 0.000 0.392 0.044 0.476
#> SRR1304006     1  0.4291      0.348 0.536 0.000 0.464 0.000 0.000
#> SRR1304007     1  0.4291      0.348 0.536 0.000 0.464 0.000 0.000
#> SRR1304008     5  0.0000      0.908 0.000 0.000 0.000 0.000 1.000
#> SRR1304009     5  0.0000      0.908 0.000 0.000 0.000 0.000 1.000
#> SRR1304010     4  0.1410      0.940 0.060 0.000 0.000 0.940 0.000
#> SRR1304011     4  0.1410      0.940 0.060 0.000 0.000 0.940 0.000
#> SRR1304012     5  0.0290      0.906 0.008 0.000 0.000 0.000 0.992
#> SRR1304013     5  0.0290      0.906 0.008 0.000 0.000 0.000 0.992
#> SRR1304014     5  0.1732      0.879 0.080 0.000 0.000 0.000 0.920
#> SRR1304015     5  0.0162      0.907 0.004 0.000 0.000 0.000 0.996
#> SRR1304016     5  0.0162      0.906 0.004 0.000 0.000 0.000 0.996
#> SRR1304017     4  0.2338      0.926 0.112 0.004 0.000 0.884 0.000
#> SRR1304018     4  0.2338      0.926 0.112 0.004 0.000 0.884 0.000
#> SRR1304019     5  0.0162      0.907 0.004 0.000 0.000 0.000 0.996
#> SRR1304020     5  0.0162      0.907 0.004 0.000 0.000 0.000 0.996
#> SRR1304021     5  0.0880      0.901 0.032 0.000 0.000 0.000 0.968
#> SRR1304022     4  0.2286      0.927 0.108 0.004 0.000 0.888 0.000
#> SRR1304024     4  0.1557      0.943 0.052 0.008 0.000 0.940 0.000
#> SRR1304023     4  0.3123      0.865 0.184 0.004 0.000 0.812 0.000
#> SRR1304026     2  0.0290      0.831 0.000 0.992 0.000 0.008 0.000
#> SRR1304027     2  0.0290      0.831 0.000 0.992 0.000 0.008 0.000
#> SRR1304025     4  0.0566      0.934 0.004 0.012 0.000 0.984 0.000
#> SRR1304028     2  0.4454      0.691 0.128 0.760 0.000 0.112 0.000
#> SRR1304029     2  0.4454      0.691 0.128 0.760 0.000 0.112 0.000
#> SRR1304030     1  0.4332      0.711 0.768 0.064 0.004 0.000 0.164
#> SRR1304031     1  0.4332      0.711 0.768 0.064 0.004 0.000 0.164
#> SRR1304032     2  0.0404      0.831 0.000 0.988 0.000 0.012 0.000
#> SRR1304033     2  0.0404      0.831 0.000 0.988 0.000 0.012 0.000
#> SRR1304034     2  0.0404      0.829 0.012 0.988 0.000 0.000 0.000
#> SRR1304035     2  0.0404      0.829 0.012 0.988 0.000 0.000 0.000
#> SRR1304036     2  0.0404      0.829 0.012 0.988 0.000 0.000 0.000
#> SRR1304037     2  0.0404      0.829 0.012 0.988 0.000 0.000 0.000
#> SRR1304038     4  0.0740      0.933 0.004 0.008 0.008 0.980 0.000
#> SRR1304039     4  0.0740      0.933 0.004 0.008 0.008 0.980 0.000
#> SRR1304040     4  0.1557      0.943 0.052 0.008 0.000 0.940 0.000
#> SRR1304041     4  0.1557      0.943 0.052 0.008 0.000 0.940 0.000
#> SRR1304042     2  0.4537      0.661 0.076 0.740 0.000 0.184 0.000
#> SRR1304043     2  0.4537      0.661 0.076 0.740 0.000 0.184 0.000
#> SRR1304046     5  0.1732      0.879 0.080 0.000 0.000 0.000 0.920
#> SRR1304047     5  0.1732      0.879 0.080 0.000 0.000 0.000 0.920
#> SRR1304044     2  0.4430      0.282 0.004 0.540 0.000 0.456 0.000
#> SRR1304045     2  0.4430      0.282 0.004 0.540 0.000 0.456 0.000
#> SRR1304048     4  0.0566      0.934 0.004 0.012 0.000 0.984 0.000
#> SRR1304049     4  0.0566      0.934 0.004 0.012 0.000 0.984 0.000
#> SRR1304050     5  0.1732      0.879 0.080 0.000 0.000 0.000 0.920
#> SRR1304051     1  0.2411      0.720 0.884 0.000 0.000 0.008 0.108
#> SRR1304052     1  0.2280      0.666 0.880 0.000 0.000 0.120 0.000
#> SRR1304053     1  0.2411      0.720 0.884 0.000 0.000 0.008 0.108
#> SRR1304055     2  0.2561      0.769 0.096 0.884 0.000 0.020 0.000
#> SRR1304054     2  0.0579      0.831 0.008 0.984 0.000 0.008 0.000
#> SRR1304056     1  0.4188      0.687 0.756 0.212 0.024 0.004 0.004
#> SRR1304059     1  0.4159      0.681 0.756 0.216 0.016 0.008 0.004
#> SRR1304057     1  0.3691      0.711 0.804 0.164 0.028 0.000 0.004
#> SRR1304058     1  0.5164      0.606 0.660 0.256 0.000 0.084 0.000
#> SRR1304060     1  0.4060      0.520 0.640 0.000 0.360 0.000 0.000
#> SRR1304061     1  0.4487      0.565 0.660 0.324 0.008 0.004 0.004

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>            class entropy silhouette    p1    p2    p3    p4    p5    p6
#> SRR1303990     3  0.6970     0.0772 0.016 0.000 0.408 0.032 0.292 0.252
#> SRR1303991     3  0.6970     0.0772 0.016 0.000 0.408 0.032 0.292 0.252
#> SRR1303992     3  0.0000     0.8720 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1303993     3  0.0000     0.8720 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1303994     3  0.0000     0.8720 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1303995     3  0.0000     0.8720 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1303996     3  0.0000     0.8720 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1303997     3  0.0000     0.8720 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1303998     3  0.0000     0.8720 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1303999     3  0.0000     0.8720 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1304000     3  0.0000     0.8720 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1304001     3  0.0000     0.8720 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1304004     5  0.0000     0.8395 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR1304005     5  0.0000     0.8395 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR1304002     6  0.5875     0.9909 0.008 0.000 0.156 0.000 0.372 0.464
#> SRR1304003     6  0.5894     0.9910 0.008 0.000 0.160 0.000 0.368 0.464
#> SRR1304006     1  0.3922     0.5568 0.664 0.000 0.320 0.000 0.000 0.016
#> SRR1304007     1  0.3922     0.5568 0.664 0.000 0.320 0.000 0.000 0.016
#> SRR1304008     5  0.0000     0.8395 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR1304009     5  0.0000     0.8395 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR1304010     4  0.4275     0.6783 0.008 0.000 0.000 0.644 0.020 0.328
#> SRR1304011     4  0.4275     0.6783 0.008 0.000 0.000 0.644 0.020 0.328
#> SRR1304012     5  0.1701     0.8133 0.008 0.000 0.000 0.000 0.920 0.072
#> SRR1304013     5  0.1701     0.8133 0.008 0.000 0.000 0.000 0.920 0.072
#> SRR1304014     5  0.3043     0.6356 0.008 0.000 0.000 0.000 0.792 0.200
#> SRR1304015     5  0.1779     0.8140 0.016 0.000 0.000 0.000 0.920 0.064
#> SRR1304016     5  0.2579     0.7253 0.088 0.000 0.000 0.000 0.872 0.040
#> SRR1304017     4  0.3136     0.6527 0.004 0.000 0.000 0.768 0.000 0.228
#> SRR1304018     4  0.3136     0.6527 0.004 0.000 0.000 0.768 0.000 0.228
#> SRR1304019     5  0.1398     0.8254 0.008 0.000 0.000 0.000 0.940 0.052
#> SRR1304020     5  0.0935     0.8340 0.004 0.000 0.000 0.000 0.964 0.032
#> SRR1304021     5  0.1434     0.8119 0.012 0.000 0.000 0.000 0.940 0.048
#> SRR1304022     4  0.3136     0.6527 0.004 0.000 0.000 0.768 0.000 0.228
#> SRR1304024     4  0.0000     0.7183 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR1304023     4  0.4821     0.5023 0.060 0.000 0.000 0.600 0.004 0.336
#> SRR1304026     2  0.0547     0.7982 0.000 0.980 0.000 0.020 0.000 0.000
#> SRR1304027     2  0.0547     0.7982 0.000 0.980 0.000 0.020 0.000 0.000
#> SRR1304025     4  0.3620     0.6560 0.000 0.000 0.000 0.648 0.000 0.352
#> SRR1304028     2  0.4156     0.6902 0.056 0.788 0.000 0.092 0.000 0.064
#> SRR1304029     2  0.4156     0.6902 0.056 0.788 0.000 0.092 0.000 0.064
#> SRR1304030     1  0.2753     0.7470 0.872 0.008 0.000 0.000 0.072 0.048
#> SRR1304031     1  0.2753     0.7470 0.872 0.008 0.000 0.000 0.072 0.048
#> SRR1304032     2  0.0000     0.8029 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR1304033     2  0.0000     0.8029 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR1304034     2  0.0000     0.8029 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR1304035     2  0.0000     0.8029 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR1304036     2  0.0146     0.8022 0.004 0.996 0.000 0.000 0.000 0.000
#> SRR1304037     2  0.0146     0.8022 0.004 0.996 0.000 0.000 0.000 0.000
#> SRR1304038     4  0.3659     0.6469 0.000 0.000 0.000 0.636 0.000 0.364
#> SRR1304039     4  0.3659     0.6469 0.000 0.000 0.000 0.636 0.000 0.364
#> SRR1304040     4  0.0000     0.7183 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR1304041     4  0.0000     0.7183 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR1304042     2  0.6135     0.4608 0.048 0.552 0.000 0.260 0.000 0.140
#> SRR1304043     2  0.6135     0.4608 0.048 0.552 0.000 0.260 0.000 0.140
#> SRR1304046     5  0.3043     0.6356 0.008 0.000 0.000 0.000 0.792 0.200
#> SRR1304047     5  0.3043     0.6356 0.008 0.000 0.000 0.000 0.792 0.200
#> SRR1304044     2  0.5820     0.0706 0.004 0.464 0.000 0.368 0.000 0.164
#> SRR1304045     2  0.5820     0.0706 0.004 0.464 0.000 0.368 0.000 0.164
#> SRR1304048     4  0.3592     0.6611 0.000 0.000 0.000 0.656 0.000 0.344
#> SRR1304049     4  0.3592     0.6611 0.000 0.000 0.000 0.656 0.000 0.344
#> SRR1304050     5  0.3073     0.6274 0.008 0.000 0.000 0.000 0.788 0.204
#> SRR1304051     1  0.3238     0.7422 0.832 0.000 0.000 0.012 0.036 0.120
#> SRR1304052     1  0.4402     0.6581 0.716 0.000 0.000 0.116 0.000 0.168
#> SRR1304053     1  0.3238     0.7422 0.832 0.000 0.000 0.012 0.036 0.120
#> SRR1304055     2  0.5304     0.6026 0.060 0.684 0.000 0.104 0.000 0.152
#> SRR1304054     2  0.0000     0.8029 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR1304056     1  0.2685     0.7540 0.868 0.060 0.000 0.000 0.000 0.072
#> SRR1304059     1  0.3112     0.7434 0.836 0.068 0.000 0.000 0.000 0.096
#> SRR1304057     1  0.2070     0.7631 0.908 0.044 0.000 0.000 0.000 0.048
#> SRR1304058     1  0.6860     0.4232 0.468 0.192 0.000 0.256 0.000 0.084
#> SRR1304060     1  0.2581     0.7451 0.860 0.000 0.120 0.000 0.000 0.020
#> SRR1304061     1  0.4798     0.6363 0.672 0.172 0.000 0.000 0.000 0.156

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

consensus_heatmap(res, k = 2)

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

consensus_heatmap(res, k = 3)

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

consensus_heatmap(res, k = 4)

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

consensus_heatmap(res, k = 5)

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

consensus_heatmap(res, k = 6)

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

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

membership_heatmap(res, k = 2)

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

membership_heatmap(res, k = 3)

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

membership_heatmap(res, k = 4)

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

membership_heatmap(res, k = 5)

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

membership_heatmap(res, k = 6)

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

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

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

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

get_signatures(res, k = 3)

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

get_signatures(res, k = 4)

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

get_signatures(res, k = 5)

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

get_signatures(res, k = 6)

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

Signature heatmaps where rows are not scaled:

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

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

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

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

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

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

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

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

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

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

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk MAD-skmeans-signature_compare

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

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

An example of the output of tb is:

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

The columns in tb are:

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

UMAP plot which shows how samples are separated.

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

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

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

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

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

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

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

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

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

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

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk MAD-skmeans-collect-classes

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

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

collect_plots(res)

plot of chunk MAD-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.304           0.756       0.841         0.3681 0.682   0.682
#> 3 3 0.586           0.863       0.901         0.4501 0.774   0.678
#> 4 4 0.586           0.727       0.834         0.2730 0.784   0.577
#> 5 5 0.923           0.866       0.942         0.1281 0.901   0.692
#> 6 6 0.867           0.852       0.919         0.0367 0.976   0.896

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
#> SRR1303990     1   0.000      0.822 1.000 0.000
#> SRR1303991     1   0.000      0.822 1.000 0.000
#> SRR1303992     1   0.552      0.808 0.872 0.128
#> SRR1303993     1   0.662      0.795 0.828 0.172
#> SRR1303994     1   0.662      0.795 0.828 0.172
#> SRR1303995     1   0.662      0.795 0.828 0.172
#> SRR1303996     1   0.662      0.795 0.828 0.172
#> SRR1303997     1   0.662      0.795 0.828 0.172
#> SRR1303998     1   0.662      0.795 0.828 0.172
#> SRR1303999     1   0.662      0.795 0.828 0.172
#> SRR1304000     1   0.662      0.795 0.828 0.172
#> SRR1304001     1   0.662      0.795 0.828 0.172
#> SRR1304004     1   0.000      0.822 1.000 0.000
#> SRR1304005     1   0.000      0.822 1.000 0.000
#> SRR1304002     1   0.000      0.822 1.000 0.000
#> SRR1304003     1   0.000      0.822 1.000 0.000
#> SRR1304006     1   0.662      0.795 0.828 0.172
#> SRR1304007     1   0.662      0.795 0.828 0.172
#> SRR1304008     1   0.000      0.822 1.000 0.000
#> SRR1304009     1   0.000      0.822 1.000 0.000
#> SRR1304010     1   0.184      0.816 0.972 0.028
#> SRR1304011     1   0.184      0.816 0.972 0.028
#> SRR1304012     1   0.000      0.822 1.000 0.000
#> SRR1304013     1   0.000      0.822 1.000 0.000
#> SRR1304014     1   0.000      0.822 1.000 0.000
#> SRR1304015     1   0.000      0.822 1.000 0.000
#> SRR1304016     1   0.000      0.822 1.000 0.000
#> SRR1304017     1   0.722      0.702 0.800 0.200
#> SRR1304018     1   0.722      0.702 0.800 0.200
#> SRR1304019     1   0.000      0.822 1.000 0.000
#> SRR1304020     1   0.000      0.822 1.000 0.000
#> SRR1304021     1   0.000      0.822 1.000 0.000
#> SRR1304022     1   0.722      0.702 0.800 0.200
#> SRR1304024     1   0.722      0.702 0.800 0.200
#> SRR1304023     1   0.775      0.702 0.772 0.228
#> SRR1304026     2   0.000      0.846 0.000 1.000
#> SRR1304027     2   0.000      0.846 0.000 1.000
#> SRR1304025     1   0.722      0.702 0.800 0.200
#> SRR1304028     2   0.000      0.846 0.000 1.000
#> SRR1304029     2   0.000      0.846 0.000 1.000
#> SRR1304030     1   0.680      0.789 0.820 0.180
#> SRR1304031     1   0.753      0.754 0.784 0.216
#> SRR1304032     2   0.000      0.846 0.000 1.000
#> SRR1304033     2   0.000      0.846 0.000 1.000
#> SRR1304034     2   0.000      0.846 0.000 1.000
#> SRR1304035     2   0.000      0.846 0.000 1.000
#> SRR1304036     2   0.671      0.718 0.176 0.824
#> SRR1304037     2   0.671      0.718 0.176 0.824
#> SRR1304038     1   0.722      0.702 0.800 0.200
#> SRR1304039     1   0.722      0.702 0.800 0.200
#> SRR1304040     1   0.760      0.702 0.780 0.220
#> SRR1304041     1   0.909      0.664 0.676 0.324
#> SRR1304042     2   0.821      0.530 0.256 0.744
#> SRR1304043     2   0.802      0.557 0.244 0.756
#> SRR1304046     1   0.000      0.822 1.000 0.000
#> SRR1304047     1   0.000      0.822 1.000 0.000
#> SRR1304044     1   0.844      0.604 0.728 0.272
#> SRR1304045     1   0.844      0.604 0.728 0.272
#> SRR1304048     1   0.932      0.646 0.652 0.348
#> SRR1304049     1   0.952      0.625 0.628 0.372
#> SRR1304050     1   0.000      0.822 1.000 0.000
#> SRR1304051     1   0.714      0.786 0.804 0.196
#> SRR1304052     1   0.952      0.625 0.628 0.372
#> SRR1304053     1   0.722      0.784 0.800 0.200
#> SRR1304055     1   0.952      0.625 0.628 0.372
#> SRR1304054     2   0.574      0.758 0.136 0.864
#> SRR1304056     1   0.662      0.795 0.828 0.172
#> SRR1304059     1   0.671      0.795 0.824 0.176
#> SRR1304057     1   0.671      0.795 0.824 0.176
#> SRR1304058     2   0.997     -0.250 0.468 0.532
#> SRR1304060     1   0.662      0.795 0.828 0.172
#> SRR1304061     1   0.662      0.795 0.828 0.172

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>            class entropy silhouette    p1    p2    p3
#> SRR1303990     1  0.4555      0.605 0.800 0.000 0.200
#> SRR1303991     1  0.4555      0.605 0.800 0.000 0.200
#> SRR1303992     3  0.4555      1.000 0.200 0.000 0.800
#> SRR1303993     3  0.4555      1.000 0.200 0.000 0.800
#> SRR1303994     3  0.4555      1.000 0.200 0.000 0.800
#> SRR1303995     3  0.4555      1.000 0.200 0.000 0.800
#> SRR1303996     3  0.4555      1.000 0.200 0.000 0.800
#> SRR1303997     3  0.4555      1.000 0.200 0.000 0.800
#> SRR1303998     3  0.4555      1.000 0.200 0.000 0.800
#> SRR1303999     3  0.4555      1.000 0.200 0.000 0.800
#> SRR1304000     3  0.4555      1.000 0.200 0.000 0.800
#> SRR1304001     3  0.4555      1.000 0.200 0.000 0.800
#> SRR1304004     1  0.0000      0.867 1.000 0.000 0.000
#> SRR1304005     1  0.0000      0.867 1.000 0.000 0.000
#> SRR1304002     1  0.0000      0.867 1.000 0.000 0.000
#> SRR1304003     1  0.0000      0.867 1.000 0.000 0.000
#> SRR1304006     1  0.0000      0.867 1.000 0.000 0.000
#> SRR1304007     1  0.0000      0.867 1.000 0.000 0.000
#> SRR1304008     1  0.0000      0.867 1.000 0.000 0.000
#> SRR1304009     1  0.0000      0.867 1.000 0.000 0.000
#> SRR1304010     1  0.4178      0.856 0.828 0.000 0.172
#> SRR1304011     1  0.4178      0.856 0.828 0.000 0.172
#> SRR1304012     1  0.0000      0.867 1.000 0.000 0.000
#> SRR1304013     1  0.0000      0.867 1.000 0.000 0.000
#> SRR1304014     1  0.0000      0.867 1.000 0.000 0.000
#> SRR1304015     1  0.0000      0.867 1.000 0.000 0.000
#> SRR1304016     1  0.0000      0.867 1.000 0.000 0.000
#> SRR1304017     1  0.4555      0.849 0.800 0.000 0.200
#> SRR1304018     1  0.4555      0.849 0.800 0.000 0.200
#> SRR1304019     1  0.0000      0.867 1.000 0.000 0.000
#> SRR1304020     1  0.0000      0.867 1.000 0.000 0.000
#> SRR1304021     1  0.0000      0.867 1.000 0.000 0.000
#> SRR1304022     1  0.4555      0.849 0.800 0.000 0.200
#> SRR1304024     1  0.4555      0.849 0.800 0.000 0.200
#> SRR1304023     1  0.4555      0.849 0.800 0.000 0.200
#> SRR1304026     2  0.0000      0.926 0.000 1.000 0.000
#> SRR1304027     2  0.0000      0.926 0.000 1.000 0.000
#> SRR1304025     1  0.4555      0.849 0.800 0.000 0.200
#> SRR1304028     2  0.0000      0.926 0.000 1.000 0.000
#> SRR1304029     2  0.0000      0.926 0.000 1.000 0.000
#> SRR1304030     1  0.0424      0.862 0.992 0.008 0.000
#> SRR1304031     1  0.3267      0.771 0.884 0.116 0.000
#> SRR1304032     2  0.0000      0.926 0.000 1.000 0.000
#> SRR1304033     2  0.0000      0.926 0.000 1.000 0.000
#> SRR1304034     2  0.0000      0.926 0.000 1.000 0.000
#> SRR1304035     2  0.0000      0.926 0.000 1.000 0.000
#> SRR1304036     2  0.0000      0.926 0.000 1.000 0.000
#> SRR1304037     2  0.0000      0.926 0.000 1.000 0.000
#> SRR1304038     1  0.4555      0.849 0.800 0.000 0.200
#> SRR1304039     1  0.4555      0.849 0.800 0.000 0.200
#> SRR1304040     1  0.4555      0.849 0.800 0.000 0.200
#> SRR1304041     1  0.4555      0.849 0.800 0.000 0.200
#> SRR1304042     2  0.7283      0.533 0.260 0.672 0.068
#> SRR1304043     2  0.6781      0.571 0.244 0.704 0.052
#> SRR1304046     1  0.0000      0.867 1.000 0.000 0.000
#> SRR1304047     1  0.0000      0.867 1.000 0.000 0.000
#> SRR1304044     1  0.4555      0.849 0.800 0.000 0.200
#> SRR1304045     1  0.4555      0.849 0.800 0.000 0.200
#> SRR1304048     1  0.4555      0.849 0.800 0.000 0.200
#> SRR1304049     1  0.4555      0.849 0.800 0.000 0.200
#> SRR1304050     1  0.0000      0.867 1.000 0.000 0.000
#> SRR1304051     1  0.0000      0.867 1.000 0.000 0.000
#> SRR1304052     1  0.4555      0.849 0.800 0.000 0.200
#> SRR1304053     1  0.2796      0.865 0.908 0.000 0.092
#> SRR1304055     1  0.5292      0.792 0.800 0.172 0.028
#> SRR1304054     2  0.0000      0.926 0.000 1.000 0.000
#> SRR1304056     1  0.0000      0.867 1.000 0.000 0.000
#> SRR1304059     1  0.4178      0.856 0.828 0.000 0.172
#> SRR1304057     1  0.4178      0.856 0.828 0.000 0.172
#> SRR1304058     1  0.9584      0.189 0.428 0.372 0.200
#> SRR1304060     3  0.4555      1.000 0.200 0.000 0.800
#> SRR1304061     1  0.3686      0.821 0.860 0.140 0.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> SRR1303990     1   0.398      0.551 0.760 0.000 0.240 0.000
#> SRR1303991     1   0.445      0.496 0.692 0.000 0.308 0.000
#> SRR1303992     3   0.327      0.783 0.168 0.000 0.832 0.000
#> SRR1303993     3   0.331      0.778 0.172 0.000 0.828 0.000
#> SRR1303994     3   0.000      0.951 0.000 0.000 1.000 0.000
#> SRR1303995     3   0.000      0.951 0.000 0.000 1.000 0.000
#> SRR1303996     3   0.000      0.951 0.000 0.000 1.000 0.000
#> SRR1303997     3   0.000      0.951 0.000 0.000 1.000 0.000
#> SRR1303998     3   0.000      0.951 0.000 0.000 1.000 0.000
#> SRR1303999     3   0.000      0.951 0.000 0.000 1.000 0.000
#> SRR1304000     3   0.000      0.951 0.000 0.000 1.000 0.000
#> SRR1304001     3   0.000      0.951 0.000 0.000 1.000 0.000
#> SRR1304004     1   0.000      0.762 1.000 0.000 0.000 0.000
#> SRR1304005     1   0.000      0.762 1.000 0.000 0.000 0.000
#> SRR1304002     1   0.000      0.762 1.000 0.000 0.000 0.000
#> SRR1304003     1   0.000      0.762 1.000 0.000 0.000 0.000
#> SRR1304006     4   0.499      0.658 0.476 0.000 0.000 0.524
#> SRR1304007     4   0.499      0.658 0.476 0.000 0.000 0.524
#> SRR1304008     1   0.000      0.762 1.000 0.000 0.000 0.000
#> SRR1304009     1   0.000      0.762 1.000 0.000 0.000 0.000
#> SRR1304010     1   0.336      0.716 0.824 0.000 0.000 0.176
#> SRR1304011     1   0.336      0.716 0.824 0.000 0.000 0.176
#> SRR1304012     1   0.000      0.762 1.000 0.000 0.000 0.000
#> SRR1304013     1   0.000      0.762 1.000 0.000 0.000 0.000
#> SRR1304014     1   0.000      0.762 1.000 0.000 0.000 0.000
#> SRR1304015     1   0.000      0.762 1.000 0.000 0.000 0.000
#> SRR1304016     1   0.000      0.762 1.000 0.000 0.000 0.000
#> SRR1304017     1   0.466      0.612 0.652 0.000 0.000 0.348
#> SRR1304018     1   0.365      0.708 0.796 0.000 0.000 0.204
#> SRR1304019     1   0.000      0.762 1.000 0.000 0.000 0.000
#> SRR1304020     1   0.000      0.762 1.000 0.000 0.000 0.000
#> SRR1304021     1   0.000      0.762 1.000 0.000 0.000 0.000
#> SRR1304022     1   0.499      0.460 0.524 0.000 0.000 0.476
#> SRR1304024     1   0.499      0.460 0.524 0.000 0.000 0.476
#> SRR1304023     1   0.471      0.604 0.640 0.000 0.000 0.360
#> SRR1304026     2   0.000      1.000 0.000 1.000 0.000 0.000
#> SRR1304027     2   0.000      1.000 0.000 1.000 0.000 0.000
#> SRR1304025     1   0.466      0.612 0.652 0.000 0.000 0.348
#> SRR1304028     2   0.000      1.000 0.000 1.000 0.000 0.000
#> SRR1304029     2   0.000      1.000 0.000 1.000 0.000 0.000
#> SRR1304030     4   0.499      0.658 0.476 0.000 0.000 0.524
#> SRR1304031     4   0.499      0.658 0.476 0.000 0.000 0.524
#> SRR1304032     2   0.000      1.000 0.000 1.000 0.000 0.000
#> SRR1304033     2   0.000      1.000 0.000 1.000 0.000 0.000
#> SRR1304034     2   0.000      1.000 0.000 1.000 0.000 0.000
#> SRR1304035     2   0.000      1.000 0.000 1.000 0.000 0.000
#> SRR1304036     2   0.000      1.000 0.000 1.000 0.000 0.000
#> SRR1304037     2   0.000      1.000 0.000 1.000 0.000 0.000
#> SRR1304038     1   0.365      0.708 0.796 0.000 0.000 0.204
#> SRR1304039     1   0.365      0.708 0.796 0.000 0.000 0.204
#> SRR1304040     1   0.500      0.441 0.508 0.000 0.000 0.492
#> SRR1304041     4   0.498     -0.429 0.464 0.000 0.000 0.536
#> SRR1304042     4   0.336      0.368 0.000 0.176 0.000 0.824
#> SRR1304043     4   0.349      0.356 0.000 0.188 0.000 0.812
#> SRR1304046     1   0.000      0.762 1.000 0.000 0.000 0.000
#> SRR1304047     1   0.000      0.762 1.000 0.000 0.000 0.000
#> SRR1304044     1   0.376      0.703 0.784 0.000 0.000 0.216
#> SRR1304045     1   0.369      0.706 0.792 0.000 0.000 0.208
#> SRR1304048     1   0.489      0.549 0.588 0.000 0.000 0.412
#> SRR1304049     1   0.489      0.549 0.588 0.000 0.000 0.412
#> SRR1304050     1   0.000      0.762 1.000 0.000 0.000 0.000
#> SRR1304051     4   0.499      0.658 0.476 0.000 0.000 0.524
#> SRR1304052     4   0.422      0.618 0.272 0.000 0.000 0.728
#> SRR1304053     4   0.479      0.661 0.380 0.000 0.000 0.620
#> SRR1304055     4   0.709      0.651 0.272 0.172 0.000 0.556
#> SRR1304054     2   0.000      1.000 0.000 1.000 0.000 0.000
#> SRR1304056     4   0.499      0.658 0.476 0.000 0.000 0.524
#> SRR1304059     4   0.441      0.635 0.300 0.000 0.000 0.700
#> SRR1304057     4   0.443      0.637 0.304 0.000 0.000 0.696
#> SRR1304058     4   0.000      0.466 0.000 0.000 0.000 1.000
#> SRR1304060     4   0.733      0.364 0.200 0.000 0.276 0.524
#> SRR1304061     4   0.707      0.665 0.336 0.140 0.000 0.524

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>            class entropy silhouette    p1    p2    p3    p4    p5
#> SRR1303990     5  0.4015      0.461 0.000 0.000 0.348 0.000 0.652
#> SRR1303991     5  0.4074      0.438 0.000 0.000 0.364 0.000 0.636
#> SRR1303992     3  0.0794      0.970 0.000 0.000 0.972 0.000 0.028
#> SRR1303993     3  0.0794      0.970 0.000 0.000 0.972 0.000 0.028
#> SRR1303994     3  0.0000      0.993 0.000 0.000 1.000 0.000 0.000
#> SRR1303995     3  0.0000      0.993 0.000 0.000 1.000 0.000 0.000
#> SRR1303996     3  0.0000      0.993 0.000 0.000 1.000 0.000 0.000
#> SRR1303997     3  0.0000      0.993 0.000 0.000 1.000 0.000 0.000
#> SRR1303998     3  0.0000      0.993 0.000 0.000 1.000 0.000 0.000
#> SRR1303999     3  0.0000      0.993 0.000 0.000 1.000 0.000 0.000
#> SRR1304000     3  0.0000      0.993 0.000 0.000 1.000 0.000 0.000
#> SRR1304001     3  0.0000      0.993 0.000 0.000 1.000 0.000 0.000
#> SRR1304004     5  0.0000      0.909 0.000 0.000 0.000 0.000 1.000
#> SRR1304005     5  0.0000      0.909 0.000 0.000 0.000 0.000 1.000
#> SRR1304002     5  0.0703      0.905 0.024 0.000 0.000 0.000 0.976
#> SRR1304003     5  0.0703      0.905 0.024 0.000 0.000 0.000 0.976
#> SRR1304006     1  0.0162      0.970 0.996 0.000 0.000 0.000 0.004
#> SRR1304007     1  0.0000      0.973 1.000 0.000 0.000 0.000 0.000
#> SRR1304008     5  0.0000      0.909 0.000 0.000 0.000 0.000 1.000
#> SRR1304009     5  0.0000      0.909 0.000 0.000 0.000 0.000 1.000
#> SRR1304010     5  0.0451      0.907 0.004 0.000 0.000 0.008 0.988
#> SRR1304011     5  0.0451      0.907 0.004 0.000 0.000 0.008 0.988
#> SRR1304012     5  0.0000      0.909 0.000 0.000 0.000 0.000 1.000
#> SRR1304013     5  0.0000      0.909 0.000 0.000 0.000 0.000 1.000
#> SRR1304014     5  0.0609      0.906 0.020 0.000 0.000 0.000 0.980
#> SRR1304015     5  0.0000      0.909 0.000 0.000 0.000 0.000 1.000
#> SRR1304016     5  0.0609      0.905 0.020 0.000 0.000 0.000 0.980
#> SRR1304017     5  0.4201      0.171 0.000 0.000 0.000 0.408 0.592
#> SRR1304018     5  0.1270      0.882 0.000 0.000 0.000 0.052 0.948
#> SRR1304019     5  0.0000      0.909 0.000 0.000 0.000 0.000 1.000
#> SRR1304020     5  0.0000      0.909 0.000 0.000 0.000 0.000 1.000
#> SRR1304021     5  0.0162      0.908 0.004 0.000 0.000 0.000 0.996
#> SRR1304022     4  0.0000      0.736 0.000 0.000 0.000 1.000 0.000
#> SRR1304024     4  0.0000      0.736 0.000 0.000 0.000 1.000 0.000
#> SRR1304023     4  0.4522      0.340 0.008 0.000 0.000 0.552 0.440
#> SRR1304026     2  0.0000      1.000 0.000 1.000 0.000 0.000 0.000
#> SRR1304027     2  0.0000      1.000 0.000 1.000 0.000 0.000 0.000
#> SRR1304025     4  0.4114      0.457 0.000 0.000 0.000 0.624 0.376
#> SRR1304028     2  0.0000      1.000 0.000 1.000 0.000 0.000 0.000
#> SRR1304029     2  0.0000      1.000 0.000 1.000 0.000 0.000 0.000
#> SRR1304030     1  0.0162      0.972 0.996 0.000 0.000 0.000 0.004
#> SRR1304031     1  0.0162      0.972 0.996 0.000 0.000 0.000 0.004
#> SRR1304032     2  0.0000      1.000 0.000 1.000 0.000 0.000 0.000
#> SRR1304033     2  0.0000      1.000 0.000 1.000 0.000 0.000 0.000
#> SRR1304034     2  0.0000      1.000 0.000 1.000 0.000 0.000 0.000
#> SRR1304035     2  0.0000      1.000 0.000 1.000 0.000 0.000 0.000
#> SRR1304036     2  0.0000      1.000 0.000 1.000 0.000 0.000 0.000
#> SRR1304037     2  0.0000      1.000 0.000 1.000 0.000 0.000 0.000
#> SRR1304038     5  0.1399      0.893 0.020 0.000 0.000 0.028 0.952
#> SRR1304039     5  0.1399      0.894 0.028 0.000 0.000 0.020 0.952
#> SRR1304040     4  0.0000      0.736 0.000 0.000 0.000 1.000 0.000
#> SRR1304041     4  0.0000      0.736 0.000 0.000 0.000 1.000 0.000
#> SRR1304042     4  0.0290      0.732 0.000 0.008 0.000 0.992 0.000
#> SRR1304043     4  0.0290      0.732 0.000 0.008 0.000 0.992 0.000
#> SRR1304046     5  0.0703      0.905 0.024 0.000 0.000 0.000 0.976
#> SRR1304047     5  0.0703      0.905 0.024 0.000 0.000 0.000 0.976
#> SRR1304044     5  0.3305      0.657 0.000 0.000 0.000 0.224 0.776
#> SRR1304045     5  0.3274      0.664 0.000 0.000 0.000 0.220 0.780
#> SRR1304048     4  0.5944      0.352 0.108 0.000 0.000 0.488 0.404
#> SRR1304049     4  0.6409      0.408 0.180 0.000 0.000 0.468 0.352
#> SRR1304050     5  0.1197      0.888 0.048 0.000 0.000 0.000 0.952
#> SRR1304051     1  0.0162      0.972 0.996 0.000 0.000 0.000 0.004
#> SRR1304052     1  0.0162      0.971 0.996 0.000 0.000 0.004 0.000
#> SRR1304053     1  0.0162      0.972 0.996 0.000 0.000 0.000 0.004
#> SRR1304055     1  0.0000      0.973 1.000 0.000 0.000 0.000 0.000
#> SRR1304054     2  0.0162      0.995 0.004 0.996 0.000 0.000 0.000
#> SRR1304056     1  0.0000      0.973 1.000 0.000 0.000 0.000 0.000
#> SRR1304059     1  0.0000      0.973 1.000 0.000 0.000 0.000 0.000
#> SRR1304057     1  0.0000      0.973 1.000 0.000 0.000 0.000 0.000
#> SRR1304058     1  0.3837      0.577 0.692 0.000 0.000 0.308 0.000
#> SRR1304060     1  0.0162      0.972 0.996 0.000 0.000 0.000 0.004
#> SRR1304061     1  0.0000      0.973 1.000 0.000 0.000 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>            class entropy silhouette    p1    p2    p3    p4    p5    p6
#> SRR1303990     6  0.1010      0.916 0.000 0.000 0.036 0.000 0.004 0.960
#> SRR1303991     6  0.1753      0.904 0.000 0.000 0.084 0.000 0.004 0.912
#> SRR1303992     3  0.1594      0.919 0.000 0.000 0.932 0.000 0.016 0.052
#> SRR1303993     3  0.1398      0.924 0.000 0.000 0.940 0.000 0.008 0.052
#> SRR1303994     3  0.0000      0.981 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1303995     3  0.0000      0.981 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1303996     3  0.0000      0.981 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1303997     3  0.0000      0.981 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1303998     3  0.0000      0.981 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1303999     3  0.0000      0.981 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1304000     3  0.0000      0.981 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1304001     3  0.0000      0.981 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1304004     5  0.1957      0.874 0.000 0.000 0.000 0.000 0.888 0.112
#> SRR1304005     5  0.1957      0.874 0.000 0.000 0.000 0.000 0.888 0.112
#> SRR1304002     5  0.0000      0.865 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR1304003     5  0.0000      0.865 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR1304006     1  0.2562      0.804 0.828 0.000 0.000 0.000 0.172 0.000
#> SRR1304007     1  0.2378      0.827 0.848 0.000 0.000 0.000 0.152 0.000
#> SRR1304008     5  0.2562      0.866 0.000 0.000 0.000 0.000 0.828 0.172
#> SRR1304009     5  0.2562      0.866 0.000 0.000 0.000 0.000 0.828 0.172
#> SRR1304010     5  0.3337      0.853 0.064 0.000 0.000 0.004 0.824 0.108
#> SRR1304011     5  0.3337      0.853 0.064 0.000 0.000 0.004 0.824 0.108
#> SRR1304012     5  0.2562      0.866 0.000 0.000 0.000 0.000 0.828 0.172
#> SRR1304013     5  0.2562      0.866 0.000 0.000 0.000 0.000 0.828 0.172
#> SRR1304014     5  0.0000      0.865 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR1304015     5  0.2562      0.866 0.000 0.000 0.000 0.000 0.828 0.172
#> SRR1304016     5  0.3196      0.834 0.108 0.000 0.000 0.000 0.828 0.064
#> SRR1304017     5  0.3774      0.291 0.000 0.000 0.000 0.408 0.592 0.000
#> SRR1304018     5  0.2631      0.783 0.000 0.000 0.000 0.180 0.820 0.000
#> SRR1304019     5  0.2562      0.866 0.000 0.000 0.000 0.000 0.828 0.172
#> SRR1304020     5  0.2562      0.866 0.000 0.000 0.000 0.000 0.828 0.172
#> SRR1304021     5  0.0000      0.865 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR1304022     4  0.0000      0.720 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR1304024     4  0.0000      0.720 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR1304023     6  0.1387      0.885 0.068 0.000 0.000 0.000 0.000 0.932
#> SRR1304026     2  0.0000      0.998 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR1304027     2  0.0000      0.998 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR1304025     4  0.3695      0.374 0.000 0.000 0.000 0.624 0.376 0.000
#> SRR1304028     2  0.0000      0.998 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR1304029     2  0.0000      0.998 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR1304030     1  0.0000      0.916 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR1304031     1  0.0000      0.916 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR1304032     2  0.0000      0.998 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR1304033     2  0.0000      0.998 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR1304034     2  0.0000      0.998 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR1304035     2  0.0000      0.998 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR1304036     2  0.0000      0.998 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR1304037     2  0.0000      0.998 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR1304038     5  0.0260      0.863 0.000 0.000 0.000 0.008 0.992 0.000
#> SRR1304039     5  0.0260      0.863 0.000 0.000 0.000 0.008 0.992 0.000
#> SRR1304040     4  0.0000      0.720 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR1304041     4  0.0000      0.720 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR1304042     4  0.0146      0.717 0.000 0.000 0.000 0.996 0.000 0.004
#> SRR1304043     4  0.0146      0.717 0.000 0.000 0.000 0.996 0.000 0.004
#> SRR1304046     5  0.0000      0.865 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR1304047     5  0.0000      0.865 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR1304044     5  0.2969      0.727 0.000 0.000 0.000 0.224 0.776 0.000
#> SRR1304045     5  0.2941      0.732 0.000 0.000 0.000 0.220 0.780 0.000
#> SRR1304048     4  0.5309      0.235 0.104 0.000 0.000 0.488 0.408 0.000
#> SRR1304049     4  0.5735      0.327 0.176 0.000 0.000 0.472 0.352 0.000
#> SRR1304050     5  0.0260      0.861 0.008 0.000 0.000 0.000 0.992 0.000
#> SRR1304051     1  0.0000      0.916 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR1304052     1  0.0000      0.916 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR1304053     1  0.0000      0.916 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR1304055     1  0.1910      0.866 0.892 0.000 0.000 0.000 0.108 0.000
#> SRR1304054     2  0.0508      0.980 0.004 0.984 0.000 0.000 0.012 0.000
#> SRR1304056     1  0.0000      0.916 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR1304059     1  0.1327      0.893 0.936 0.000 0.000 0.000 0.064 0.000
#> SRR1304057     1  0.0000      0.916 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR1304058     1  0.3647      0.471 0.640 0.000 0.000 0.360 0.000 0.000
#> SRR1304060     1  0.0000      0.916 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR1304061     1  0.1327      0.893 0.936 0.000 0.000 0.000 0.064 0.000

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

consensus_heatmap(res, k = 2)

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

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

collect_plots(res)

plot of chunk MAD-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.712           0.912       0.942         0.2883 0.757   0.757
#> 3 3 0.270           0.460       0.678         0.9394 0.649   0.537
#> 4 4 0.430           0.529       0.734         0.2254 0.717   0.429
#> 5 5 0.554           0.566       0.752         0.1101 0.891   0.658
#> 6 6 0.604           0.549       0.705         0.0558 0.914   0.635

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
#> SRR1303990     2  0.8016      0.737 0.244 0.756
#> SRR1303991     2  0.8016      0.737 0.244 0.756
#> SRR1303992     1  0.6247      0.836 0.844 0.156
#> SRR1303993     1  0.6247      0.836 0.844 0.156
#> SRR1303994     1  0.1414      0.965 0.980 0.020
#> SRR1303995     1  0.1414      0.965 0.980 0.020
#> SRR1303996     1  0.1414      0.965 0.980 0.020
#> SRR1303997     1  0.1414      0.965 0.980 0.020
#> SRR1303998     1  0.1414      0.965 0.980 0.020
#> SRR1303999     1  0.1414      0.965 0.980 0.020
#> SRR1304000     1  0.1414      0.965 0.980 0.020
#> SRR1304001     1  0.1414      0.965 0.980 0.020
#> SRR1304004     2  0.5519      0.851 0.128 0.872
#> SRR1304005     2  0.5294      0.859 0.120 0.880
#> SRR1304002     2  0.1414      0.934 0.020 0.980
#> SRR1304003     2  0.2043      0.935 0.032 0.968
#> SRR1304006     2  0.5842      0.872 0.140 0.860
#> SRR1304007     2  0.5946      0.868 0.144 0.856
#> SRR1304008     2  0.5519      0.851 0.128 0.872
#> SRR1304009     2  0.5519      0.851 0.128 0.872
#> SRR1304010     2  0.1414      0.935 0.020 0.980
#> SRR1304011     2  0.1184      0.936 0.016 0.984
#> SRR1304012     2  0.0376      0.937 0.004 0.996
#> SRR1304013     2  0.0376      0.937 0.004 0.996
#> SRR1304014     2  0.0938      0.934 0.012 0.988
#> SRR1304015     2  0.5408      0.855 0.124 0.876
#> SRR1304016     2  0.0938      0.934 0.012 0.988
#> SRR1304017     2  0.0672      0.938 0.008 0.992
#> SRR1304018     2  0.0672      0.938 0.008 0.992
#> SRR1304019     2  0.5519      0.851 0.128 0.872
#> SRR1304020     2  0.5519      0.851 0.128 0.872
#> SRR1304021     2  0.0938      0.934 0.012 0.988
#> SRR1304022     2  0.0672      0.938 0.008 0.992
#> SRR1304024     2  0.0672      0.938 0.008 0.992
#> SRR1304023     2  0.0938      0.937 0.012 0.988
#> SRR1304026     2  0.4022      0.918 0.080 0.920
#> SRR1304027     2  0.4022      0.918 0.080 0.920
#> SRR1304025     2  0.0376      0.937 0.004 0.996
#> SRR1304028     2  0.0376      0.937 0.004 0.996
#> SRR1304029     2  0.0376      0.937 0.004 0.996
#> SRR1304030     2  0.2603      0.934 0.044 0.956
#> SRR1304031     2  0.2603      0.934 0.044 0.956
#> SRR1304032     2  0.4022      0.918 0.080 0.920
#> SRR1304033     2  0.4022      0.918 0.080 0.920
#> SRR1304034     2  0.4022      0.918 0.080 0.920
#> SRR1304035     2  0.4022      0.918 0.080 0.920
#> SRR1304036     2  0.3879      0.920 0.076 0.924
#> SRR1304037     2  0.3879      0.920 0.076 0.924
#> SRR1304038     2  0.0672      0.938 0.008 0.992
#> SRR1304039     2  0.0672      0.938 0.008 0.992
#> SRR1304040     2  0.0672      0.938 0.008 0.992
#> SRR1304041     2  0.0672      0.938 0.008 0.992
#> SRR1304042     2  0.4022      0.918 0.080 0.920
#> SRR1304043     2  0.4022      0.918 0.080 0.920
#> SRR1304046     2  0.0938      0.934 0.012 0.988
#> SRR1304047     2  0.0938      0.934 0.012 0.988
#> SRR1304044     2  0.0672      0.938 0.008 0.992
#> SRR1304045     2  0.0672      0.938 0.008 0.992
#> SRR1304048     2  0.0376      0.937 0.004 0.996
#> SRR1304049     2  0.0376      0.937 0.004 0.996
#> SRR1304050     2  0.0938      0.934 0.012 0.988
#> SRR1304051     2  0.1633      0.935 0.024 0.976
#> SRR1304052     2  0.0672      0.938 0.008 0.992
#> SRR1304053     2  0.1633      0.935 0.024 0.976
#> SRR1304055     2  0.3879      0.919 0.076 0.924
#> SRR1304054     2  0.2236      0.932 0.036 0.964
#> SRR1304056     2  0.3733      0.920 0.072 0.928
#> SRR1304059     2  0.3733      0.920 0.072 0.928
#> SRR1304057     2  0.3733      0.922 0.072 0.928
#> SRR1304058     2  0.4022      0.918 0.080 0.920
#> SRR1304060     2  0.9393      0.561 0.356 0.644
#> SRR1304061     2  0.3733      0.920 0.072 0.928

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>            class entropy silhouette    p1    p2    p3
#> SRR1303990     2   0.923    0.44337 0.292 0.520 0.188
#> SRR1303991     2   0.923    0.44337 0.292 0.520 0.188
#> SRR1303992     3   0.698    0.65688 0.192 0.088 0.720
#> SRR1303993     3   0.684    0.67553 0.180 0.088 0.732
#> SRR1303994     3   0.117    0.93409 0.016 0.008 0.976
#> SRR1303995     3   0.117    0.93409 0.016 0.008 0.976
#> SRR1303996     3   0.117    0.93409 0.016 0.008 0.976
#> SRR1303997     3   0.117    0.93409 0.016 0.008 0.976
#> SRR1303998     3   0.117    0.93409 0.016 0.008 0.976
#> SRR1303999     3   0.117    0.93409 0.016 0.008 0.976
#> SRR1304000     3   0.117    0.93409 0.016 0.008 0.976
#> SRR1304001     3   0.117    0.93409 0.016 0.008 0.976
#> SRR1304004     2   0.792   -0.75961 0.468 0.476 0.056
#> SRR1304005     2   0.792   -0.75879 0.464 0.480 0.056
#> SRR1304002     1   0.667    0.78819 0.524 0.468 0.008
#> SRR1304003     1   0.666    0.78900 0.528 0.464 0.008
#> SRR1304006     2   0.851   -0.33910 0.428 0.480 0.092
#> SRR1304007     2   0.856   -0.05369 0.352 0.540 0.108
#> SRR1304008     1   0.792    0.74772 0.488 0.456 0.056
#> SRR1304009     1   0.792    0.74772 0.488 0.456 0.056
#> SRR1304010     1   0.700    0.75970 0.552 0.428 0.020
#> SRR1304011     1   0.712    0.75423 0.548 0.428 0.024
#> SRR1304012     1   0.792    0.74787 0.484 0.460 0.056
#> SRR1304013     1   0.792    0.74787 0.484 0.460 0.056
#> SRR1304014     1   0.630    0.79212 0.528 0.472 0.000
#> SRR1304015     1   0.792    0.74787 0.484 0.460 0.056
#> SRR1304016     2   0.630   -0.76874 0.476 0.524 0.000
#> SRR1304017     2   0.590    0.51256 0.232 0.744 0.024
#> SRR1304018     2   0.599    0.50985 0.240 0.736 0.024
#> SRR1304019     1   0.792    0.74787 0.484 0.460 0.056
#> SRR1304020     1   0.792    0.74787 0.484 0.460 0.056
#> SRR1304021     2   0.631   -0.78761 0.492 0.508 0.000
#> SRR1304022     2   0.522    0.51787 0.208 0.780 0.012
#> SRR1304024     2   0.522    0.51787 0.208 0.780 0.012
#> SRR1304023     2   0.634    0.50593 0.264 0.708 0.028
#> SRR1304026     2   0.780    0.49050 0.392 0.552 0.056
#> SRR1304027     2   0.780    0.49050 0.392 0.552 0.056
#> SRR1304025     2   0.231    0.43319 0.024 0.944 0.032
#> SRR1304028     2   0.162    0.45129 0.012 0.964 0.024
#> SRR1304029     2   0.162    0.45129 0.012 0.964 0.024
#> SRR1304030     1   0.629    0.78804 0.532 0.468 0.000
#> SRR1304031     1   0.626    0.78673 0.552 0.448 0.000
#> SRR1304032     2   0.635    0.47936 0.196 0.748 0.056
#> SRR1304033     2   0.635    0.47936 0.196 0.748 0.056
#> SRR1304034     2   0.630    0.47344 0.192 0.752 0.056
#> SRR1304035     2   0.630    0.47344 0.192 0.752 0.056
#> SRR1304036     2   0.694    0.31934 0.284 0.672 0.044
#> SRR1304037     2   0.694    0.31934 0.284 0.672 0.044
#> SRR1304038     1   0.713    0.75071 0.544 0.432 0.024
#> SRR1304039     1   0.713    0.75071 0.544 0.432 0.024
#> SRR1304040     2   0.531    0.51568 0.216 0.772 0.012
#> SRR1304041     2   0.531    0.51568 0.216 0.772 0.012
#> SRR1304042     2   0.776    0.49666 0.380 0.564 0.056
#> SRR1304043     2   0.776    0.49666 0.380 0.564 0.056
#> SRR1304046     2   0.631   -0.77456 0.488 0.512 0.000
#> SRR1304047     2   0.631   -0.77456 0.488 0.512 0.000
#> SRR1304044     2   0.140    0.44537 0.004 0.968 0.028
#> SRR1304045     2   0.140    0.44537 0.004 0.968 0.028
#> SRR1304048     2   0.541    0.26033 0.172 0.796 0.032
#> SRR1304049     2   0.571    0.19632 0.204 0.768 0.028
#> SRR1304050     1   0.630    0.79115 0.528 0.472 0.000
#> SRR1304051     1   0.698    0.75870 0.560 0.420 0.020
#> SRR1304052     2   0.719   -0.71054 0.480 0.496 0.024
#> SRR1304053     1   0.698    0.75870 0.560 0.420 0.020
#> SRR1304055     2   0.748    0.00535 0.356 0.596 0.048
#> SRR1304054     2   0.460    0.45706 0.108 0.852 0.040
#> SRR1304056     1   0.644    0.66385 0.696 0.276 0.028
#> SRR1304059     1   0.688    0.68883 0.616 0.360 0.024
#> SRR1304057     1   0.695    0.71753 0.620 0.352 0.028
#> SRR1304058     2   0.719    0.51223 0.380 0.588 0.032
#> SRR1304060     2   0.880    0.19754 0.212 0.584 0.204
#> SRR1304061     1   0.703    0.60264 0.580 0.396 0.024

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> SRR1303990     4  0.7469     0.3834 0.040 0.140 0.212 0.608
#> SRR1303991     4  0.7469     0.3834 0.040 0.140 0.212 0.608
#> SRR1303992     3  0.7460     0.3533 0.280 0.108 0.576 0.036
#> SRR1303993     3  0.7417     0.3659 0.272 0.108 0.584 0.036
#> SRR1303994     3  0.0000     0.8746 0.000 0.000 1.000 0.000
#> SRR1303995     3  0.0000     0.8746 0.000 0.000 1.000 0.000
#> SRR1303996     3  0.0000     0.8746 0.000 0.000 1.000 0.000
#> SRR1303997     3  0.0000     0.8746 0.000 0.000 1.000 0.000
#> SRR1303998     3  0.0524     0.8687 0.008 0.000 0.988 0.004
#> SRR1303999     3  0.0524     0.8687 0.008 0.000 0.988 0.004
#> SRR1304000     3  0.0000     0.8746 0.000 0.000 1.000 0.000
#> SRR1304001     3  0.0000     0.8746 0.000 0.000 1.000 0.000
#> SRR1304004     1  0.3694     0.7449 0.844 0.032 0.000 0.124
#> SRR1304005     1  0.3694     0.7449 0.844 0.032 0.000 0.124
#> SRR1304002     1  0.2981     0.7542 0.904 0.048 0.016 0.032
#> SRR1304003     1  0.2981     0.7542 0.904 0.048 0.016 0.032
#> SRR1304006     1  0.7513     0.4557 0.592 0.260 0.056 0.092
#> SRR1304007     1  0.7566     0.4521 0.588 0.260 0.056 0.096
#> SRR1304008     1  0.3674     0.7394 0.852 0.044 0.000 0.104
#> SRR1304009     1  0.3674     0.7394 0.852 0.044 0.000 0.104
#> SRR1304010     1  0.5586     0.5413 0.672 0.032 0.008 0.288
#> SRR1304011     1  0.5708     0.5417 0.668 0.032 0.012 0.288
#> SRR1304012     1  0.2918     0.7478 0.876 0.008 0.000 0.116
#> SRR1304013     1  0.2918     0.7478 0.876 0.008 0.000 0.116
#> SRR1304014     1  0.1182     0.7675 0.968 0.000 0.016 0.016
#> SRR1304015     1  0.3384     0.7424 0.860 0.024 0.000 0.116
#> SRR1304016     1  0.0707     0.7689 0.980 0.000 0.000 0.020
#> SRR1304017     4  0.6533     0.4434 0.160 0.184 0.004 0.652
#> SRR1304018     4  0.5902     0.5318 0.120 0.184 0.000 0.696
#> SRR1304019     1  0.3384     0.7424 0.860 0.024 0.000 0.116
#> SRR1304020     1  0.3047     0.7468 0.872 0.012 0.000 0.116
#> SRR1304021     1  0.1389     0.7590 0.952 0.000 0.000 0.048
#> SRR1304022     4  0.4916     0.5648 0.056 0.184 0.000 0.760
#> SRR1304024     4  0.4990     0.5664 0.060 0.184 0.000 0.756
#> SRR1304023     4  0.5292     0.5144 0.028 0.140 0.056 0.776
#> SRR1304026     2  0.4158     0.3763 0.008 0.768 0.000 0.224
#> SRR1304027     2  0.4158     0.3763 0.008 0.768 0.000 0.224
#> SRR1304025     4  0.8752     0.0265 0.304 0.324 0.036 0.336
#> SRR1304028     2  0.8582    -0.1519 0.224 0.388 0.036 0.352
#> SRR1304029     2  0.8554    -0.1627 0.216 0.388 0.036 0.360
#> SRR1304030     1  0.2499     0.7601 0.924 0.032 0.012 0.032
#> SRR1304031     1  0.2686     0.7581 0.916 0.040 0.012 0.032
#> SRR1304032     2  0.1489     0.4891 0.044 0.952 0.000 0.004
#> SRR1304033     2  0.1489     0.4891 0.044 0.952 0.000 0.004
#> SRR1304034     2  0.1389     0.4897 0.048 0.952 0.000 0.000
#> SRR1304035     2  0.1474     0.4894 0.052 0.948 0.000 0.000
#> SRR1304036     2  0.4564     0.3862 0.328 0.672 0.000 0.000
#> SRR1304037     2  0.4564     0.3862 0.328 0.672 0.000 0.000
#> SRR1304038     1  0.6491     0.4622 0.612 0.048 0.024 0.316
#> SRR1304039     1  0.6594     0.4656 0.612 0.056 0.024 0.308
#> SRR1304040     4  0.5434     0.5631 0.084 0.188 0.000 0.728
#> SRR1304041     4  0.5434     0.5631 0.084 0.188 0.000 0.728
#> SRR1304042     2  0.4158     0.3763 0.008 0.768 0.000 0.224
#> SRR1304043     2  0.4158     0.3763 0.008 0.768 0.000 0.224
#> SRR1304046     1  0.1911     0.7680 0.944 0.032 0.004 0.020
#> SRR1304047     1  0.1697     0.7683 0.952 0.028 0.004 0.016
#> SRR1304044     2  0.8684    -0.0425 0.296 0.388 0.036 0.280
#> SRR1304045     2  0.8684    -0.0425 0.296 0.388 0.036 0.280
#> SRR1304048     4  0.8492     0.1686 0.300 0.224 0.036 0.440
#> SRR1304049     4  0.8352     0.1662 0.312 0.220 0.028 0.440
#> SRR1304050     1  0.0524     0.7667 0.988 0.000 0.008 0.004
#> SRR1304051     1  0.5770     0.5493 0.672 0.032 0.016 0.280
#> SRR1304052     1  0.6432     0.2007 0.520 0.032 0.020 0.428
#> SRR1304053     1  0.6008     0.5315 0.656 0.048 0.012 0.284
#> SRR1304055     1  0.4977     0.0265 0.540 0.460 0.000 0.000
#> SRR1304054     2  0.6627     0.2659 0.180 0.660 0.012 0.148
#> SRR1304056     1  0.5664     0.6615 0.740 0.156 0.012 0.092
#> SRR1304059     1  0.2704     0.7255 0.876 0.124 0.000 0.000
#> SRR1304057     1  0.5543     0.6746 0.756 0.136 0.016 0.092
#> SRR1304058     2  0.7711     0.0589 0.232 0.428 0.000 0.340
#> SRR1304060     2  0.9695     0.0501 0.280 0.320 0.264 0.136
#> SRR1304061     1  0.3356     0.6984 0.824 0.176 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>            class entropy silhouette    p1    p2    p3    p4    p5
#> SRR1303990     4  0.4992     0.5934 0.036 0.008 0.228 0.712 0.016
#> SRR1303991     4  0.4992     0.5934 0.036 0.008 0.228 0.712 0.016
#> SRR1303992     3  0.5631     0.6511 0.108 0.128 0.720 0.016 0.028
#> SRR1303993     3  0.5631     0.6511 0.108 0.128 0.720 0.016 0.028
#> SRR1303994     3  0.0000     0.9208 0.000 0.000 1.000 0.000 0.000
#> SRR1303995     3  0.0000     0.9208 0.000 0.000 1.000 0.000 0.000
#> SRR1303996     3  0.0000     0.9208 0.000 0.000 1.000 0.000 0.000
#> SRR1303997     3  0.0000     0.9208 0.000 0.000 1.000 0.000 0.000
#> SRR1303998     3  0.0404     0.9145 0.000 0.000 0.988 0.012 0.000
#> SRR1303999     3  0.0404     0.9145 0.000 0.000 0.988 0.012 0.000
#> SRR1304000     3  0.0000     0.9208 0.000 0.000 1.000 0.000 0.000
#> SRR1304001     3  0.0000     0.9208 0.000 0.000 1.000 0.000 0.000
#> SRR1304004     1  0.3541     0.6664 0.852 0.044 0.000 0.028 0.076
#> SRR1304005     1  0.3238     0.6640 0.872 0.048 0.000 0.032 0.048
#> SRR1304002     1  0.1413     0.6666 0.956 0.012 0.000 0.020 0.012
#> SRR1304003     1  0.2086     0.6635 0.932 0.028 0.008 0.020 0.012
#> SRR1304006     1  0.8494    -0.3951 0.356 0.164 0.104 0.028 0.348
#> SRR1304007     1  0.8494    -0.3951 0.356 0.164 0.104 0.028 0.348
#> SRR1304008     1  0.5162     0.5866 0.648 0.032 0.000 0.020 0.300
#> SRR1304009     1  0.5162     0.5866 0.648 0.032 0.000 0.020 0.300
#> SRR1304010     5  0.4797     0.7552 0.296 0.000 0.000 0.044 0.660
#> SRR1304011     5  0.4756     0.7604 0.288 0.000 0.000 0.044 0.668
#> SRR1304012     1  0.4651     0.6087 0.684 0.012 0.000 0.020 0.284
#> SRR1304013     1  0.4651     0.6087 0.684 0.012 0.000 0.020 0.284
#> SRR1304014     1  0.1026     0.6680 0.968 0.004 0.000 0.004 0.024
#> SRR1304015     1  0.4624     0.6059 0.676 0.012 0.000 0.016 0.296
#> SRR1304016     1  0.2142     0.6621 0.920 0.004 0.000 0.048 0.028
#> SRR1304017     4  0.2917     0.7533 0.040 0.024 0.000 0.888 0.048
#> SRR1304018     4  0.3474     0.7356 0.052 0.024 0.000 0.856 0.068
#> SRR1304019     1  0.4624     0.6059 0.676 0.012 0.000 0.016 0.296
#> SRR1304020     1  0.4604     0.6065 0.680 0.012 0.000 0.016 0.292
#> SRR1304021     1  0.2478     0.6524 0.904 0.008 0.000 0.060 0.028
#> SRR1304022     4  0.2095     0.7536 0.020 0.024 0.000 0.928 0.028
#> SRR1304024     4  0.2607     0.7594 0.040 0.024 0.000 0.904 0.032
#> SRR1304023     4  0.1377     0.7336 0.020 0.000 0.004 0.956 0.020
#> SRR1304026     2  0.4046     0.3245 0.008 0.696 0.000 0.296 0.000
#> SRR1304027     2  0.4046     0.3245 0.008 0.696 0.000 0.296 0.000
#> SRR1304025     5  0.7813     0.3548 0.244 0.080 0.000 0.252 0.424
#> SRR1304028     2  0.8099     0.3189 0.220 0.408 0.000 0.248 0.124
#> SRR1304029     2  0.8099     0.3189 0.220 0.408 0.000 0.248 0.124
#> SRR1304030     1  0.1617     0.6660 0.948 0.012 0.000 0.020 0.020
#> SRR1304031     1  0.1820     0.6655 0.940 0.020 0.000 0.020 0.020
#> SRR1304032     2  0.1591     0.5852 0.052 0.940 0.000 0.004 0.004
#> SRR1304033     2  0.1591     0.5852 0.052 0.940 0.000 0.004 0.004
#> SRR1304034     2  0.1857     0.5887 0.060 0.928 0.000 0.004 0.008
#> SRR1304035     2  0.1857     0.5887 0.060 0.928 0.000 0.004 0.008
#> SRR1304036     2  0.4895     0.3684 0.336 0.632 0.000 0.012 0.020
#> SRR1304037     2  0.4895     0.3684 0.336 0.632 0.000 0.012 0.020
#> SRR1304038     5  0.5475     0.7650 0.284 0.012 0.000 0.068 0.636
#> SRR1304039     5  0.5379     0.7595 0.300 0.012 0.000 0.056 0.632
#> SRR1304040     4  0.2607     0.7594 0.040 0.024 0.000 0.904 0.032
#> SRR1304041     4  0.2607     0.7594 0.040 0.024 0.000 0.904 0.032
#> SRR1304042     2  0.3783     0.3717 0.008 0.740 0.000 0.252 0.000
#> SRR1304043     2  0.3783     0.3717 0.008 0.740 0.000 0.252 0.000
#> SRR1304046     1  0.1908     0.6624 0.936 0.024 0.000 0.016 0.024
#> SRR1304047     1  0.1804     0.6640 0.940 0.024 0.000 0.012 0.024
#> SRR1304044     2  0.7974     0.3338 0.232 0.412 0.000 0.256 0.100
#> SRR1304045     2  0.7974     0.3338 0.232 0.412 0.000 0.256 0.100
#> SRR1304048     5  0.6150     0.6396 0.140 0.012 0.004 0.232 0.612
#> SRR1304049     5  0.6150     0.6396 0.140 0.012 0.004 0.232 0.612
#> SRR1304050     1  0.1498     0.6682 0.952 0.008 0.000 0.016 0.024
#> SRR1304051     5  0.4817     0.7548 0.300 0.000 0.000 0.044 0.656
#> SRR1304052     5  0.5685     0.6708 0.116 0.008 0.000 0.236 0.640
#> SRR1304053     5  0.4925     0.7273 0.324 0.000 0.000 0.044 0.632
#> SRR1304055     1  0.4829     0.0653 0.500 0.480 0.000 0.020 0.000
#> SRR1304054     2  0.5258     0.5353 0.240 0.692 0.028 0.032 0.008
#> SRR1304056     1  0.6624    -0.2097 0.488 0.164 0.000 0.012 0.336
#> SRR1304059     1  0.3446     0.5936 0.828 0.144 0.000 0.012 0.016
#> SRR1304057     1  0.6797    -0.2634 0.484 0.152 0.000 0.024 0.340
#> SRR1304058     4  0.5831     0.2101 0.056 0.380 0.000 0.544 0.020
#> SRR1304060     4  0.9181     0.1755 0.120 0.128 0.308 0.344 0.100
#> SRR1304061     1  0.4061     0.5686 0.776 0.188 0.000 0.012 0.024

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>            class entropy silhouette    p1    p2    p3    p4    p5    p6
#> SRR1303990     4  0.4092     0.6135 0.040 0.000 0.104 0.800 0.044 0.012
#> SRR1303991     4  0.4092     0.6135 0.040 0.000 0.104 0.800 0.044 0.012
#> SRR1303992     3  0.6691     0.5382 0.008 0.140 0.572 0.040 0.032 0.208
#> SRR1303993     3  0.6691     0.5382 0.008 0.140 0.572 0.040 0.032 0.208
#> SRR1303994     3  0.0000     0.8672 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1303995     3  0.0000     0.8672 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1303996     3  0.0146     0.8666 0.000 0.000 0.996 0.000 0.000 0.004
#> SRR1303997     3  0.0146     0.8666 0.000 0.000 0.996 0.000 0.000 0.004
#> SRR1303998     3  0.2473     0.8061 0.000 0.000 0.856 0.136 0.000 0.008
#> SRR1303999     3  0.2473     0.8061 0.000 0.000 0.856 0.136 0.000 0.008
#> SRR1304000     3  0.0000     0.8672 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1304001     3  0.0000     0.8672 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1304004     5  0.4986     0.2563 0.096 0.004 0.000 0.000 0.628 0.272
#> SRR1304005     5  0.5368     0.1452 0.096 0.016 0.000 0.000 0.592 0.296
#> SRR1304002     6  0.5246     0.5100 0.056 0.008 0.008 0.000 0.392 0.536
#> SRR1304003     6  0.5328     0.5138 0.056 0.012 0.008 0.000 0.388 0.536
#> SRR1304006     6  0.6482     0.1783 0.388 0.088 0.056 0.004 0.008 0.456
#> SRR1304007     6  0.6774     0.1762 0.384 0.088 0.068 0.004 0.016 0.440
#> SRR1304008     5  0.0777     0.7291 0.000 0.000 0.000 0.004 0.972 0.024
#> SRR1304009     5  0.0777     0.7291 0.000 0.000 0.000 0.004 0.972 0.024
#> SRR1304010     1  0.1257     0.7647 0.952 0.000 0.000 0.000 0.028 0.020
#> SRR1304011     1  0.1257     0.7647 0.952 0.000 0.000 0.000 0.028 0.020
#> SRR1304012     5  0.0520     0.7344 0.008 0.000 0.000 0.008 0.984 0.000
#> SRR1304013     5  0.0520     0.7344 0.008 0.000 0.000 0.008 0.984 0.000
#> SRR1304014     6  0.5503     0.4862 0.076 0.012 0.004 0.000 0.424 0.484
#> SRR1304015     5  0.0146     0.7342 0.000 0.000 0.000 0.000 0.996 0.004
#> SRR1304016     5  0.5779     0.0824 0.144 0.008 0.000 0.012 0.580 0.256
#> SRR1304017     4  0.4557     0.7331 0.120 0.048 0.000 0.752 0.080 0.000
#> SRR1304018     4  0.5349     0.7072 0.192 0.048 0.004 0.680 0.072 0.004
#> SRR1304019     5  0.0146     0.7342 0.000 0.000 0.000 0.000 0.996 0.004
#> SRR1304020     5  0.0405     0.7344 0.008 0.000 0.000 0.004 0.988 0.000
#> SRR1304021     5  0.5886     0.0548 0.184 0.000 0.000 0.016 0.548 0.252
#> SRR1304022     4  0.4450     0.7349 0.136 0.048 0.000 0.756 0.060 0.000
#> SRR1304024     4  0.4428     0.7352 0.128 0.048 0.000 0.760 0.064 0.000
#> SRR1304023     4  0.1979     0.6841 0.004 0.008 0.016 0.928 0.036 0.008
#> SRR1304026     2  0.3984     0.4945 0.000 0.648 0.000 0.016 0.000 0.336
#> SRR1304027     2  0.3984     0.4945 0.000 0.648 0.000 0.016 0.000 0.336
#> SRR1304025     1  0.7009     0.4101 0.592 0.144 0.008 0.072 0.100 0.084
#> SRR1304028     2  0.7774     0.2443 0.248 0.464 0.004 0.092 0.088 0.104
#> SRR1304029     2  0.7774     0.2443 0.248 0.464 0.004 0.092 0.088 0.104
#> SRR1304030     6  0.5138     0.5136 0.056 0.008 0.004 0.000 0.388 0.544
#> SRR1304031     6  0.5181     0.5147 0.060 0.008 0.004 0.000 0.384 0.544
#> SRR1304032     2  0.1232     0.6195 0.016 0.956 0.000 0.004 0.024 0.000
#> SRR1304033     2  0.1232     0.6195 0.016 0.956 0.000 0.004 0.024 0.000
#> SRR1304034     2  0.1242     0.6185 0.012 0.960 0.000 0.008 0.012 0.008
#> SRR1304035     2  0.1140     0.6173 0.012 0.964 0.000 0.008 0.008 0.008
#> SRR1304036     2  0.2586     0.6076 0.020 0.876 0.000 0.004 0.004 0.096
#> SRR1304037     2  0.2586     0.6076 0.020 0.876 0.000 0.004 0.004 0.096
#> SRR1304038     1  0.3240     0.7234 0.812 0.000 0.000 0.000 0.148 0.040
#> SRR1304039     1  0.3041     0.7445 0.832 0.000 0.000 0.000 0.128 0.040
#> SRR1304040     4  0.5352     0.7057 0.156 0.088 0.000 0.688 0.064 0.004
#> SRR1304041     4  0.5352     0.7057 0.156 0.088 0.000 0.688 0.064 0.004
#> SRR1304042     2  0.4019     0.5011 0.000 0.652 0.000 0.012 0.004 0.332
#> SRR1304043     2  0.4019     0.5011 0.000 0.652 0.000 0.012 0.004 0.332
#> SRR1304046     6  0.5144     0.4686 0.052 0.008 0.000 0.004 0.428 0.508
#> SRR1304047     6  0.5144     0.4686 0.052 0.008 0.000 0.004 0.428 0.508
#> SRR1304044     2  0.8003     0.3005 0.180 0.464 0.004 0.100 0.152 0.100
#> SRR1304045     2  0.8003     0.3005 0.180 0.464 0.004 0.100 0.152 0.100
#> SRR1304048     1  0.3843     0.6697 0.820 0.088 0.000 0.048 0.016 0.028
#> SRR1304049     1  0.3843     0.6697 0.820 0.088 0.000 0.048 0.016 0.028
#> SRR1304050     6  0.5644     0.4102 0.096 0.004 0.004 0.004 0.436 0.456
#> SRR1304051     1  0.1921     0.7679 0.916 0.000 0.000 0.000 0.052 0.032
#> SRR1304052     1  0.4259     0.6755 0.744 0.000 0.000 0.028 0.188 0.040
#> SRR1304053     1  0.3481     0.6956 0.792 0.000 0.000 0.000 0.160 0.048
#> SRR1304055     2  0.6421     0.1048 0.040 0.496 0.000 0.004 0.304 0.156
#> SRR1304054     2  0.5239     0.5497 0.020 0.728 0.028 0.016 0.076 0.132
#> SRR1304056     6  0.7373     0.3876 0.244 0.144 0.004 0.004 0.160 0.444
#> SRR1304059     6  0.7197     0.3301 0.080 0.224 0.000 0.004 0.308 0.384
#> SRR1304057     6  0.5994     0.1827 0.400 0.088 0.016 0.004 0.012 0.480
#> SRR1304058     4  0.5264     0.2954 0.016 0.360 0.000 0.556 0.000 0.068
#> SRR1304060     4  0.7871     0.3018 0.100 0.040 0.232 0.480 0.032 0.116
#> SRR1304061     2  0.7289    -0.3273 0.080 0.340 0.000 0.004 0.312 0.264

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 15595 rows and 72 columns.
#>   Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'MAD' method.
#>   Subgroups are detected by 'NMF' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 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.832           0.904       0.959         0.4994 0.499   0.499
#> 3 3 0.622           0.563       0.788         0.3344 0.749   0.534
#> 4 4 0.510           0.536       0.755         0.1183 0.784   0.450
#> 5 5 0.644           0.614       0.767         0.0616 0.889   0.612
#> 6 6 0.722           0.704       0.828         0.0390 0.903   0.605

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
#> SRR1303990     1  0.0000      0.944 1.000 0.000
#> SRR1303991     1  0.0000      0.944 1.000 0.000
#> SRR1303992     1  0.0000      0.944 1.000 0.000
#> SRR1303993     1  0.0000      0.944 1.000 0.000
#> SRR1303994     1  0.0000      0.944 1.000 0.000
#> SRR1303995     1  0.0000      0.944 1.000 0.000
#> SRR1303996     1  0.0000      0.944 1.000 0.000
#> SRR1303997     1  0.0000      0.944 1.000 0.000
#> SRR1303998     1  0.0000      0.944 1.000 0.000
#> SRR1303999     1  0.0000      0.944 1.000 0.000
#> SRR1304000     1  0.0000      0.944 1.000 0.000
#> SRR1304001     1  0.0000      0.944 1.000 0.000
#> SRR1304004     1  0.0000      0.944 1.000 0.000
#> SRR1304005     1  0.0000      0.944 1.000 0.000
#> SRR1304002     1  0.1633      0.934 0.976 0.024
#> SRR1304003     1  0.2948      0.917 0.948 0.052
#> SRR1304006     1  0.0000      0.944 1.000 0.000
#> SRR1304007     1  0.0000      0.944 1.000 0.000
#> SRR1304008     1  0.0000      0.944 1.000 0.000
#> SRR1304009     1  0.0000      0.944 1.000 0.000
#> SRR1304010     1  0.5946      0.839 0.856 0.144
#> SRR1304011     1  0.6531      0.813 0.832 0.168
#> SRR1304012     1  0.0000      0.944 1.000 0.000
#> SRR1304013     1  0.0000      0.944 1.000 0.000
#> SRR1304014     1  0.9248      0.537 0.660 0.340
#> SRR1304015     1  0.0000      0.944 1.000 0.000
#> SRR1304016     1  0.1843      0.932 0.972 0.028
#> SRR1304017     2  0.0000      0.970 0.000 1.000
#> SRR1304018     2  0.0000      0.970 0.000 1.000
#> SRR1304019     1  0.0000      0.944 1.000 0.000
#> SRR1304020     1  0.0000      0.944 1.000 0.000
#> SRR1304021     1  0.2778      0.919 0.952 0.048
#> SRR1304022     2  0.0000      0.970 0.000 1.000
#> SRR1304024     2  0.0000      0.970 0.000 1.000
#> SRR1304023     1  0.9170      0.550 0.668 0.332
#> SRR1304026     2  0.0000      0.970 0.000 1.000
#> SRR1304027     2  0.0000      0.970 0.000 1.000
#> SRR1304025     2  0.0000      0.970 0.000 1.000
#> SRR1304028     2  0.0000      0.970 0.000 1.000
#> SRR1304029     2  0.0000      0.970 0.000 1.000
#> SRR1304030     1  0.0376      0.943 0.996 0.004
#> SRR1304031     1  0.0376      0.943 0.996 0.004
#> SRR1304032     2  0.0000      0.970 0.000 1.000
#> SRR1304033     2  0.0000      0.970 0.000 1.000
#> SRR1304034     2  0.0000      0.970 0.000 1.000
#> SRR1304035     2  0.0000      0.970 0.000 1.000
#> SRR1304036     2  0.0000      0.970 0.000 1.000
#> SRR1304037     2  0.0000      0.970 0.000 1.000
#> SRR1304038     2  0.2603      0.932 0.044 0.956
#> SRR1304039     2  0.2778      0.928 0.048 0.952
#> SRR1304040     2  0.0000      0.970 0.000 1.000
#> SRR1304041     2  0.0000      0.970 0.000 1.000
#> SRR1304042     2  0.0000      0.970 0.000 1.000
#> SRR1304043     2  0.0000      0.970 0.000 1.000
#> SRR1304046     1  0.6438      0.818 0.836 0.164
#> SRR1304047     1  0.5629      0.852 0.868 0.132
#> SRR1304044     2  0.0000      0.970 0.000 1.000
#> SRR1304045     2  0.0000      0.970 0.000 1.000
#> SRR1304048     2  0.0000      0.970 0.000 1.000
#> SRR1304049     2  0.0000      0.970 0.000 1.000
#> SRR1304050     1  0.6148      0.829 0.848 0.152
#> SRR1304051     1  0.2236      0.928 0.964 0.036
#> SRR1304052     2  0.2603      0.932 0.044 0.956
#> SRR1304053     1  0.0672      0.942 0.992 0.008
#> SRR1304055     2  0.0000      0.970 0.000 1.000
#> SRR1304054     2  0.0000      0.970 0.000 1.000
#> SRR1304056     2  1.0000     -0.116 0.500 0.500
#> SRR1304059     2  0.7453      0.703 0.212 0.788
#> SRR1304057     1  0.9970      0.182 0.532 0.468
#> SRR1304058     2  0.0000      0.970 0.000 1.000
#> SRR1304060     1  0.0000      0.944 1.000 0.000
#> SRR1304061     2  0.0000      0.970 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
#> SRR1303990     1  0.0237     0.4545 0.996 0.000 0.004
#> SRR1303991     1  0.0237     0.4545 0.996 0.000 0.004
#> SRR1303992     3  0.6111     0.8452 0.396 0.000 0.604
#> SRR1303993     3  0.6111     0.8452 0.396 0.000 0.604
#> SRR1303994     3  0.6111     0.8452 0.396 0.000 0.604
#> SRR1303995     3  0.6111     0.8452 0.396 0.000 0.604
#> SRR1303996     3  0.6111     0.8452 0.396 0.000 0.604
#> SRR1303997     3  0.6111     0.8452 0.396 0.000 0.604
#> SRR1303998     3  0.6111     0.8452 0.396 0.000 0.604
#> SRR1303999     3  0.6111     0.8452 0.396 0.000 0.604
#> SRR1304000     3  0.6111     0.8452 0.396 0.000 0.604
#> SRR1304001     3  0.6111     0.8452 0.396 0.000 0.604
#> SRR1304004     1  0.6192    -0.5122 0.580 0.000 0.420
#> SRR1304005     1  0.6308    -0.6732 0.508 0.000 0.492
#> SRR1304002     3  0.6111     0.8452 0.396 0.000 0.604
#> SRR1304003     3  0.6095     0.8419 0.392 0.000 0.608
#> SRR1304006     3  0.6111     0.8452 0.396 0.000 0.604
#> SRR1304007     3  0.6111     0.8452 0.396 0.000 0.604
#> SRR1304008     1  0.4796     0.0919 0.780 0.000 0.220
#> SRR1304009     1  0.4887     0.0680 0.772 0.000 0.228
#> SRR1304010     1  0.6330     0.5281 0.600 0.396 0.004
#> SRR1304011     1  0.7841     0.5054 0.536 0.408 0.056
#> SRR1304012     1  0.5926     0.5570 0.644 0.356 0.000
#> SRR1304013     1  0.5859     0.5620 0.656 0.344 0.000
#> SRR1304014     1  0.7531     0.0959 0.672 0.092 0.236
#> SRR1304015     1  0.6045     0.5418 0.620 0.380 0.000
#> SRR1304016     1  0.2301     0.5049 0.936 0.060 0.004
#> SRR1304017     1  0.6111     0.5275 0.604 0.396 0.000
#> SRR1304018     1  0.6111     0.5275 0.604 0.396 0.000
#> SRR1304019     1  0.6026     0.5447 0.624 0.376 0.000
#> SRR1304020     1  0.2537     0.5204 0.920 0.080 0.000
#> SRR1304021     1  0.5882     0.5606 0.652 0.348 0.000
#> SRR1304022     1  0.6111     0.5275 0.604 0.396 0.000
#> SRR1304024     2  0.4555     0.3933 0.200 0.800 0.000
#> SRR1304023     1  0.6111     0.5275 0.604 0.396 0.000
#> SRR1304026     2  0.6111     0.7735 0.000 0.604 0.396
#> SRR1304027     2  0.6111     0.7735 0.000 0.604 0.396
#> SRR1304025     2  0.2448     0.5683 0.076 0.924 0.000
#> SRR1304028     2  0.5291     0.7460 0.000 0.732 0.268
#> SRR1304029     2  0.5254     0.7449 0.000 0.736 0.264
#> SRR1304030     3  0.6205     0.7840 0.336 0.008 0.656
#> SRR1304031     3  0.6018     0.7536 0.308 0.008 0.684
#> SRR1304032     2  0.6111     0.7735 0.000 0.604 0.396
#> SRR1304033     2  0.6111     0.7735 0.000 0.604 0.396
#> SRR1304034     2  0.6111     0.7735 0.000 0.604 0.396
#> SRR1304035     2  0.6111     0.7735 0.000 0.604 0.396
#> SRR1304036     2  0.6111     0.7735 0.000 0.604 0.396
#> SRR1304037     2  0.6111     0.7735 0.000 0.604 0.396
#> SRR1304038     2  0.5277     0.3999 0.180 0.796 0.024
#> SRR1304039     2  0.5348     0.4024 0.176 0.796 0.028
#> SRR1304040     2  0.0592     0.6245 0.012 0.988 0.000
#> SRR1304041     2  0.0592     0.6245 0.012 0.988 0.000
#> SRR1304042     2  0.6111     0.7735 0.000 0.604 0.396
#> SRR1304043     2  0.6111     0.7735 0.000 0.604 0.396
#> SRR1304046     1  0.4002     0.2510 0.840 0.000 0.160
#> SRR1304047     1  0.4121     0.2261 0.832 0.000 0.168
#> SRR1304044     2  0.2261     0.5765 0.068 0.932 0.000
#> SRR1304045     2  0.2165     0.5805 0.064 0.936 0.000
#> SRR1304048     2  0.0592     0.6395 0.000 0.988 0.012
#> SRR1304049     2  0.1163     0.6483 0.000 0.972 0.028
#> SRR1304050     1  0.5835    -0.2622 0.660 0.000 0.340
#> SRR1304051     1  0.7065    -0.0236 0.664 0.048 0.288
#> SRR1304052     2  0.5072     0.3865 0.196 0.792 0.012
#> SRR1304053     3  0.8105     0.7034 0.336 0.084 0.580
#> SRR1304055     2  0.6111     0.7735 0.000 0.604 0.396
#> SRR1304054     2  0.6111     0.7735 0.000 0.604 0.396
#> SRR1304056     3  0.4128     0.1560 0.012 0.132 0.856
#> SRR1304059     3  0.4399    -0.0534 0.000 0.188 0.812
#> SRR1304057     3  0.4469     0.2262 0.028 0.120 0.852
#> SRR1304058     2  0.6111     0.7735 0.000 0.604 0.396
#> SRR1304060     3  0.6111     0.8452 0.396 0.000 0.604
#> SRR1304061     2  0.6140     0.7683 0.000 0.596 0.404

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> SRR1303990     4  0.7662     0.0831 0.220 0.000 0.344 0.436
#> SRR1303991     4  0.7668     0.0767 0.220 0.000 0.348 0.432
#> SRR1303992     3  0.0000     0.8456 0.000 0.000 1.000 0.000
#> SRR1303993     3  0.0000     0.8456 0.000 0.000 1.000 0.000
#> SRR1303994     3  0.0000     0.8456 0.000 0.000 1.000 0.000
#> SRR1303995     3  0.0000     0.8456 0.000 0.000 1.000 0.000
#> SRR1303996     3  0.0000     0.8456 0.000 0.000 1.000 0.000
#> SRR1303997     3  0.0000     0.8456 0.000 0.000 1.000 0.000
#> SRR1303998     3  0.0000     0.8456 0.000 0.000 1.000 0.000
#> SRR1303999     3  0.0000     0.8456 0.000 0.000 1.000 0.000
#> SRR1304000     3  0.0000     0.8456 0.000 0.000 1.000 0.000
#> SRR1304001     3  0.0000     0.8456 0.000 0.000 1.000 0.000
#> SRR1304004     1  0.4072     0.7005 0.748 0.000 0.252 0.000
#> SRR1304005     1  0.4193     0.6882 0.732 0.000 0.268 0.000
#> SRR1304002     3  0.4335     0.7061 0.128 0.020 0.824 0.028
#> SRR1304003     3  0.4015     0.7151 0.120 0.024 0.840 0.016
#> SRR1304006     3  0.5151    -0.1861 0.464 0.004 0.532 0.000
#> SRR1304007     3  0.4955    -0.1074 0.444 0.000 0.556 0.000
#> SRR1304008     1  0.3937     0.7317 0.800 0.000 0.188 0.012
#> SRR1304009     1  0.4011     0.7251 0.784 0.000 0.208 0.008
#> SRR1304010     4  0.2831     0.5835 0.120 0.000 0.004 0.876
#> SRR1304011     4  0.4908     0.5732 0.116 0.012 0.076 0.796
#> SRR1304012     4  0.6444     0.2502 0.284 0.000 0.104 0.612
#> SRR1304013     4  0.6473     0.2468 0.280 0.000 0.108 0.612
#> SRR1304014     1  0.3771     0.7148 0.868 0.048 0.064 0.020
#> SRR1304015     1  0.4419     0.7202 0.812 0.000 0.084 0.104
#> SRR1304016     1  0.3325     0.7417 0.864 0.000 0.112 0.024
#> SRR1304017     4  0.2830     0.5854 0.060 0.040 0.000 0.900
#> SRR1304018     4  0.2844     0.5786 0.048 0.052 0.000 0.900
#> SRR1304019     1  0.6683     0.2210 0.496 0.000 0.088 0.416
#> SRR1304020     1  0.6724     0.5884 0.612 0.000 0.164 0.224
#> SRR1304021     4  0.5526     0.2569 0.416 0.000 0.020 0.564
#> SRR1304022     4  0.2494     0.5846 0.048 0.036 0.000 0.916
#> SRR1304024     4  0.5292     0.4142 0.064 0.208 0.000 0.728
#> SRR1304023     4  0.2915     0.5896 0.080 0.028 0.000 0.892
#> SRR1304026     2  0.0707     0.7242 0.000 0.980 0.000 0.020
#> SRR1304027     2  0.0592     0.7243 0.000 0.984 0.000 0.016
#> SRR1304025     4  0.6523     0.1302 0.088 0.348 0.000 0.564
#> SRR1304028     2  0.5630     0.5662 0.136 0.724 0.000 0.140
#> SRR1304029     2  0.5677     0.5626 0.140 0.720 0.000 0.140
#> SRR1304030     1  0.5674     0.7035 0.720 0.148 0.132 0.000
#> SRR1304031     1  0.5677     0.7041 0.720 0.140 0.140 0.000
#> SRR1304032     2  0.1004     0.7229 0.004 0.972 0.000 0.024
#> SRR1304033     2  0.1004     0.7229 0.004 0.972 0.000 0.024
#> SRR1304034     2  0.1510     0.7194 0.028 0.956 0.000 0.016
#> SRR1304035     2  0.1510     0.7194 0.028 0.956 0.000 0.016
#> SRR1304036     2  0.2973     0.7165 0.096 0.884 0.020 0.000
#> SRR1304037     2  0.3266     0.7097 0.108 0.868 0.024 0.000
#> SRR1304038     4  0.8065     0.3997 0.088 0.088 0.284 0.540
#> SRR1304039     4  0.7983     0.3993 0.092 0.072 0.304 0.532
#> SRR1304040     4  0.6552    -0.1085 0.076 0.440 0.000 0.484
#> SRR1304041     4  0.6503    -0.1251 0.072 0.448 0.000 0.480
#> SRR1304042     2  0.3731     0.6990 0.120 0.844 0.000 0.036
#> SRR1304043     2  0.3731     0.6990 0.120 0.844 0.000 0.036
#> SRR1304046     1  0.3130     0.7132 0.896 0.012 0.052 0.040
#> SRR1304047     1  0.3257     0.7247 0.888 0.012 0.068 0.032
#> SRR1304044     2  0.6635     0.1581 0.088 0.524 0.000 0.388
#> SRR1304045     2  0.6583     0.1666 0.084 0.528 0.000 0.388
#> SRR1304048     2  0.6709     0.0497 0.088 0.456 0.000 0.456
#> SRR1304049     2  0.6709     0.0573 0.088 0.460 0.000 0.452
#> SRR1304050     1  0.6460     0.6190 0.648 0.056 0.268 0.028
#> SRR1304051     1  0.4712     0.7459 0.800 0.060 0.132 0.008
#> SRR1304052     1  0.7349     0.2903 0.588 0.184 0.016 0.212
#> SRR1304053     1  0.5185     0.7197 0.748 0.076 0.176 0.000
#> SRR1304055     2  0.3674     0.7004 0.116 0.848 0.000 0.036
#> SRR1304054     2  0.2662     0.7154 0.084 0.900 0.000 0.016
#> SRR1304056     1  0.6734     0.5196 0.636 0.244 0.104 0.016
#> SRR1304059     2  0.7406     0.1871 0.412 0.480 0.072 0.036
#> SRR1304057     1  0.7423     0.4749 0.504 0.292 0.204 0.000
#> SRR1304058     2  0.3435     0.7057 0.100 0.864 0.000 0.036
#> SRR1304060     3  0.4697     0.2734 0.356 0.000 0.644 0.000
#> SRR1304061     2  0.6634     0.1681 0.412 0.524 0.044 0.020

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>            class entropy silhouette    p1    p2    p3    p4    p5
#> SRR1303990     5  0.6315    0.53887 0.172 0.000 0.260 0.008 0.560
#> SRR1303991     5  0.6152    0.54217 0.168 0.000 0.256 0.004 0.572
#> SRR1303992     3  0.0404    0.93239 0.012 0.000 0.988 0.000 0.000
#> SRR1303993     3  0.0404    0.93239 0.012 0.000 0.988 0.000 0.000
#> SRR1303994     3  0.0510    0.93246 0.016 0.000 0.984 0.000 0.000
#> SRR1303995     3  0.0404    0.93239 0.012 0.000 0.988 0.000 0.000
#> SRR1303996     3  0.0510    0.93246 0.016 0.000 0.984 0.000 0.000
#> SRR1303997     3  0.0510    0.93246 0.016 0.000 0.984 0.000 0.000
#> SRR1303998     3  0.0510    0.93246 0.016 0.000 0.984 0.000 0.000
#> SRR1303999     3  0.0510    0.93246 0.016 0.000 0.984 0.000 0.000
#> SRR1304000     3  0.0404    0.93239 0.012 0.000 0.988 0.000 0.000
#> SRR1304001     3  0.0404    0.93239 0.012 0.000 0.988 0.000 0.000
#> SRR1304004     1  0.1750    0.74564 0.936 0.000 0.036 0.000 0.028
#> SRR1304005     1  0.1469    0.74943 0.948 0.000 0.036 0.000 0.016
#> SRR1304002     4  0.8279    0.03143 0.024 0.176 0.348 0.372 0.080
#> SRR1304003     3  0.7983    0.08208 0.012 0.176 0.444 0.284 0.084
#> SRR1304006     1  0.6799    0.52885 0.600 0.016 0.176 0.176 0.032
#> SRR1304007     1  0.6736    0.47232 0.556 0.016 0.300 0.100 0.028
#> SRR1304008     1  0.2087    0.75192 0.928 0.000 0.032 0.020 0.020
#> SRR1304009     1  0.1885    0.75367 0.936 0.000 0.032 0.020 0.012
#> SRR1304010     4  0.2463    0.76316 0.004 0.000 0.008 0.888 0.100
#> SRR1304011     4  0.2511    0.77402 0.000 0.000 0.028 0.892 0.080
#> SRR1304012     5  0.6336    0.43733 0.348 0.000 0.032 0.084 0.536
#> SRR1304013     5  0.6371    0.44426 0.344 0.000 0.032 0.088 0.536
#> SRR1304014     1  0.4240    0.70699 0.828 0.068 0.024 0.052 0.028
#> SRR1304015     1  0.0451    0.75393 0.988 0.000 0.008 0.004 0.000
#> SRR1304016     1  0.0854    0.75439 0.976 0.008 0.000 0.012 0.004
#> SRR1304017     5  0.3999    0.50820 0.000 0.020 0.000 0.240 0.740
#> SRR1304018     5  0.4268    0.50009 0.000 0.024 0.000 0.268 0.708
#> SRR1304019     1  0.5035    0.02691 0.548 0.000 0.020 0.008 0.424
#> SRR1304020     1  0.4082    0.60060 0.776 0.000 0.032 0.008 0.184
#> SRR1304021     4  0.4507    0.61630 0.100 0.000 0.004 0.764 0.132
#> SRR1304022     5  0.4337    0.49779 0.000 0.016 0.004 0.284 0.696
#> SRR1304024     4  0.4453    0.60267 0.000 0.048 0.000 0.724 0.228
#> SRR1304023     5  0.3685    0.58933 0.020 0.000 0.016 0.148 0.816
#> SRR1304026     2  0.3897    0.64007 0.000 0.768 0.000 0.028 0.204
#> SRR1304027     2  0.3863    0.64083 0.000 0.772 0.000 0.028 0.200
#> SRR1304025     4  0.0613    0.79667 0.004 0.008 0.000 0.984 0.004
#> SRR1304028     2  0.5808    0.57100 0.056 0.640 0.000 0.044 0.260
#> SRR1304029     2  0.5798    0.57857 0.060 0.648 0.000 0.044 0.248
#> SRR1304030     1  0.2141    0.73953 0.916 0.064 0.016 0.000 0.004
#> SRR1304031     1  0.2233    0.73405 0.904 0.080 0.016 0.000 0.000
#> SRR1304032     2  0.4431    0.62330 0.000 0.732 0.000 0.052 0.216
#> SRR1304033     2  0.4400    0.62532 0.000 0.736 0.000 0.052 0.212
#> SRR1304034     2  0.4100    0.63855 0.028 0.784 0.000 0.016 0.172
#> SRR1304035     2  0.3977    0.64006 0.024 0.792 0.000 0.016 0.168
#> SRR1304036     2  0.1697    0.60452 0.060 0.932 0.000 0.000 0.008
#> SRR1304037     2  0.1478    0.60477 0.064 0.936 0.000 0.000 0.000
#> SRR1304038     4  0.1768    0.78518 0.000 0.000 0.072 0.924 0.004
#> SRR1304039     4  0.1732    0.78027 0.000 0.000 0.080 0.920 0.000
#> SRR1304040     4  0.3058    0.75753 0.000 0.044 0.000 0.860 0.096
#> SRR1304041     4  0.2889    0.76658 0.000 0.044 0.000 0.872 0.084
#> SRR1304042     2  0.6056    0.24524 0.004 0.540 0.004 0.352 0.100
#> SRR1304043     2  0.6056    0.24524 0.004 0.540 0.004 0.352 0.100
#> SRR1304046     1  0.2912    0.73966 0.896 0.012 0.020 0.032 0.040
#> SRR1304047     1  0.3015    0.74065 0.892 0.016 0.020 0.032 0.040
#> SRR1304044     2  0.7373    0.19701 0.032 0.372 0.000 0.360 0.236
#> SRR1304045     2  0.7371    0.20585 0.032 0.376 0.000 0.356 0.236
#> SRR1304048     4  0.1168    0.80109 0.008 0.032 0.000 0.960 0.000
#> SRR1304049     4  0.1243    0.80192 0.008 0.028 0.000 0.960 0.004
#> SRR1304050     1  0.7791    0.44078 0.572 0.120 0.052 0.124 0.132
#> SRR1304051     1  0.0981    0.75370 0.972 0.012 0.008 0.008 0.000
#> SRR1304052     1  0.6490    0.48000 0.636 0.124 0.000 0.156 0.084
#> SRR1304053     1  0.1498    0.75205 0.952 0.024 0.016 0.008 0.000
#> SRR1304055     2  0.5899    0.37039 0.004 0.620 0.012 0.268 0.096
#> SRR1304054     2  0.4443    0.54694 0.152 0.776 0.000 0.052 0.020
#> SRR1304056     1  0.3193    0.70799 0.852 0.112 0.000 0.004 0.032
#> SRR1304059     1  0.8563   -0.00767 0.340 0.264 0.052 0.296 0.048
#> SRR1304057     1  0.4380    0.53580 0.688 0.292 0.016 0.000 0.004
#> SRR1304058     2  0.5494    0.37691 0.004 0.636 0.004 0.280 0.076
#> SRR1304060     1  0.4192    0.38246 0.596 0.000 0.404 0.000 0.000
#> SRR1304061     2  0.7243    0.23389 0.280 0.536 0.012 0.084 0.088

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>            class entropy silhouette    p1    p2    p3    p4    p5    p6
#> SRR1303990     6  0.1798      0.822 0.000 0.000 0.020 0.028 0.020 0.932
#> SRR1303991     6  0.1794      0.818 0.000 0.000 0.024 0.028 0.016 0.932
#> SRR1303992     3  0.0000      0.903 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1303993     3  0.0000      0.903 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1303994     3  0.0000      0.903 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1303995     3  0.0000      0.903 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1303996     3  0.0000      0.903 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1303997     3  0.0000      0.903 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1303998     3  0.0000      0.903 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1303999     3  0.0000      0.903 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1304000     3  0.0000      0.903 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1304001     3  0.0000      0.903 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1304004     5  0.2909      0.688 0.000 0.000 0.004 0.012 0.828 0.156
#> SRR1304005     5  0.2925      0.691 0.000 0.000 0.004 0.016 0.832 0.148
#> SRR1304002     3  0.6017      0.111 0.412 0.000 0.460 0.088 0.036 0.004
#> SRR1304003     3  0.6076      0.379 0.288 0.000 0.548 0.124 0.036 0.004
#> SRR1304006     5  0.6328      0.541 0.132 0.000 0.192 0.024 0.600 0.052
#> SRR1304007     5  0.6398      0.350 0.080 0.000 0.356 0.028 0.496 0.040
#> SRR1304008     5  0.2092      0.710 0.000 0.000 0.000 0.000 0.876 0.124
#> SRR1304009     5  0.2092      0.710 0.000 0.000 0.000 0.000 0.876 0.124
#> SRR1304010     1  0.1346      0.914 0.952 0.000 0.000 0.016 0.024 0.008
#> SRR1304011     1  0.1262      0.915 0.956 0.000 0.000 0.016 0.020 0.008
#> SRR1304012     6  0.2256      0.845 0.004 0.000 0.004 0.008 0.092 0.892
#> SRR1304013     6  0.2256      0.845 0.004 0.000 0.004 0.008 0.092 0.892
#> SRR1304014     5  0.5621      0.102 0.004 0.000 0.000 0.128 0.468 0.400
#> SRR1304015     5  0.1663      0.722 0.000 0.000 0.000 0.000 0.912 0.088
#> SRR1304016     5  0.1910      0.716 0.000 0.000 0.000 0.000 0.892 0.108
#> SRR1304017     2  0.5525      0.526 0.120 0.620 0.000 0.028 0.000 0.232
#> SRR1304018     2  0.5514      0.519 0.112 0.616 0.000 0.028 0.000 0.244
#> SRR1304019     6  0.2462      0.828 0.004 0.000 0.000 0.004 0.132 0.860
#> SRR1304020     6  0.3279      0.770 0.000 0.000 0.000 0.028 0.176 0.796
#> SRR1304021     1  0.3981      0.705 0.772 0.000 0.000 0.008 0.076 0.144
#> SRR1304022     2  0.5574      0.502 0.112 0.604 0.000 0.028 0.000 0.256
#> SRR1304024     1  0.3972      0.646 0.740 0.220 0.000 0.016 0.000 0.024
#> SRR1304023     6  0.3988      0.557 0.028 0.180 0.000 0.028 0.000 0.764
#> SRR1304026     2  0.3103      0.650 0.008 0.784 0.000 0.208 0.000 0.000
#> SRR1304027     2  0.3081      0.639 0.004 0.776 0.000 0.220 0.000 0.000
#> SRR1304025     1  0.0291      0.920 0.992 0.000 0.000 0.004 0.004 0.000
#> SRR1304028     2  0.2100      0.721 0.004 0.884 0.000 0.000 0.112 0.000
#> SRR1304029     2  0.2100      0.721 0.004 0.884 0.000 0.000 0.112 0.000
#> SRR1304030     5  0.2320      0.677 0.000 0.132 0.000 0.000 0.864 0.004
#> SRR1304031     5  0.2320      0.677 0.000 0.132 0.000 0.000 0.864 0.004
#> SRR1304032     2  0.2320      0.701 0.004 0.864 0.000 0.132 0.000 0.000
#> SRR1304033     2  0.2362      0.699 0.004 0.860 0.000 0.136 0.000 0.000
#> SRR1304034     2  0.3150      0.698 0.000 0.828 0.000 0.052 0.120 0.000
#> SRR1304035     2  0.3150      0.698 0.000 0.828 0.000 0.052 0.120 0.000
#> SRR1304036     4  0.5421      0.463 0.000 0.328 0.000 0.536 0.136 0.000
#> SRR1304037     4  0.5390      0.466 0.000 0.328 0.000 0.540 0.132 0.000
#> SRR1304038     1  0.0806      0.914 0.972 0.000 0.020 0.008 0.000 0.000
#> SRR1304039     1  0.0909      0.912 0.968 0.000 0.020 0.012 0.000 0.000
#> SRR1304040     1  0.0603      0.918 0.980 0.016 0.000 0.004 0.000 0.000
#> SRR1304041     1  0.0508      0.918 0.984 0.012 0.000 0.004 0.000 0.000
#> SRR1304042     4  0.2340      0.755 0.148 0.000 0.000 0.852 0.000 0.000
#> SRR1304043     4  0.2340      0.755 0.148 0.000 0.000 0.852 0.000 0.000
#> SRR1304046     5  0.5471      0.447 0.020 0.000 0.000 0.100 0.588 0.292
#> SRR1304047     5  0.5417      0.432 0.012 0.000 0.000 0.108 0.580 0.300
#> SRR1304044     2  0.5152      0.663 0.136 0.696 0.000 0.024 0.136 0.008
#> SRR1304045     2  0.4959      0.678 0.116 0.716 0.000 0.024 0.136 0.008
#> SRR1304048     1  0.0547      0.920 0.980 0.000 0.000 0.000 0.020 0.000
#> SRR1304049     1  0.0632      0.918 0.976 0.000 0.000 0.000 0.024 0.000
#> SRR1304050     6  0.5466      0.586 0.036 0.000 0.000 0.096 0.240 0.628
#> SRR1304051     5  0.0291      0.725 0.000 0.004 0.000 0.000 0.992 0.004
#> SRR1304052     5  0.2146      0.685 0.004 0.116 0.000 0.000 0.880 0.000
#> SRR1304053     5  0.0458      0.723 0.000 0.016 0.000 0.000 0.984 0.000
#> SRR1304055     4  0.1524      0.762 0.060 0.008 0.000 0.932 0.000 0.000
#> SRR1304054     5  0.4405      0.498 0.000 0.240 0.000 0.072 0.688 0.000
#> SRR1304056     5  0.1007      0.728 0.000 0.000 0.000 0.000 0.956 0.044
#> SRR1304059     5  0.5712      0.451 0.128 0.004 0.040 0.196 0.632 0.000
#> SRR1304057     5  0.2003      0.689 0.000 0.116 0.000 0.000 0.884 0.000
#> SRR1304058     4  0.2856      0.765 0.076 0.068 0.000 0.856 0.000 0.000
#> SRR1304060     5  0.3976      0.412 0.000 0.004 0.380 0.000 0.612 0.004
#> SRR1304061     4  0.2569      0.727 0.012 0.012 0.000 0.880 0.092 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-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 15595 rows and 72 columns.
#>   Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'ATC' method.
#>   Subgroups are detected by 'hclust' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 3.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

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

collect_plots(res)

plot of chunk ATC-hclust-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.277           0.799       0.863          0.365 0.593   0.593
#> 3 3 0.597           0.856       0.900          0.513 0.836   0.723
#> 4 4 0.651           0.857       0.879          0.102 0.961   0.910
#> 5 5 0.744           0.862       0.921          0.104 0.954   0.883
#> 6 6 0.759           0.838       0.892          0.137 0.887   0.670

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
#> SRR1303990     1  0.7602      0.699 0.780 0.220
#> SRR1303991     1  0.7602      0.699 0.780 0.220
#> SRR1303992     1  0.5629      0.781 0.868 0.132
#> SRR1303993     1  0.5629      0.781 0.868 0.132
#> SRR1303994     1  0.5629      0.781 0.868 0.132
#> SRR1303995     1  0.5629      0.781 0.868 0.132
#> SRR1303996     1  0.5629      0.781 0.868 0.132
#> SRR1303997     1  0.5629      0.781 0.868 0.132
#> SRR1303998     1  0.5629      0.781 0.868 0.132
#> SRR1303999     1  0.5629      0.781 0.868 0.132
#> SRR1304000     1  0.5629      0.781 0.868 0.132
#> SRR1304001     1  0.5629      0.781 0.868 0.132
#> SRR1304004     1  0.0376      0.875 0.996 0.004
#> SRR1304005     1  0.0376      0.875 0.996 0.004
#> SRR1304002     1  0.0000      0.876 1.000 0.000
#> SRR1304003     1  0.0000      0.876 1.000 0.000
#> SRR1304006     1  0.0000      0.876 1.000 0.000
#> SRR1304007     1  0.0000      0.876 1.000 0.000
#> SRR1304008     1  0.0376      0.875 0.996 0.004
#> SRR1304009     1  0.0376      0.875 0.996 0.004
#> SRR1304010     1  0.0000      0.876 1.000 0.000
#> SRR1304011     1  0.0000      0.876 1.000 0.000
#> SRR1304012     1  0.0376      0.875 0.996 0.004
#> SRR1304013     1  0.0376      0.875 0.996 0.004
#> SRR1304014     1  0.0000      0.876 1.000 0.000
#> SRR1304015     1  0.0376      0.875 0.996 0.004
#> SRR1304016     1  0.7674      0.683 0.776 0.224
#> SRR1304017     1  0.7674      0.683 0.776 0.224
#> SRR1304018     1  0.7674      0.683 0.776 0.224
#> SRR1304019     1  0.0376      0.875 0.996 0.004
#> SRR1304020     1  0.0376      0.875 0.996 0.004
#> SRR1304021     1  0.0000      0.876 1.000 0.000
#> SRR1304022     2  0.5629      0.800 0.132 0.868
#> SRR1304024     2  0.5629      0.800 0.132 0.868
#> SRR1304023     1  0.7602      0.699 0.780 0.220
#> SRR1304026     2  0.5629      0.800 0.132 0.868
#> SRR1304027     2  0.5629      0.800 0.132 0.868
#> SRR1304025     1  0.7453      0.703 0.788 0.212
#> SRR1304028     2  0.9896      0.679 0.440 0.560
#> SRR1304029     2  0.9896      0.679 0.440 0.560
#> SRR1304030     1  0.4562      0.830 0.904 0.096
#> SRR1304031     1  0.4562      0.830 0.904 0.096
#> SRR1304032     2  0.9000      0.769 0.316 0.684
#> SRR1304033     2  0.9000      0.769 0.316 0.684
#> SRR1304034     2  0.9000      0.769 0.316 0.684
#> SRR1304035     2  0.9000      0.769 0.316 0.684
#> SRR1304036     2  0.9896      0.679 0.440 0.560
#> SRR1304037     2  0.9896      0.679 0.440 0.560
#> SRR1304038     1  0.0000      0.876 1.000 0.000
#> SRR1304039     1  0.0000      0.876 1.000 0.000
#> SRR1304040     2  0.5629      0.800 0.132 0.868
#> SRR1304041     2  0.5629      0.800 0.132 0.868
#> SRR1304042     2  0.5629      0.800 0.132 0.868
#> SRR1304043     2  0.5629      0.800 0.132 0.868
#> SRR1304046     1  0.4562      0.830 0.904 0.096
#> SRR1304047     1  0.4562      0.830 0.904 0.096
#> SRR1304044     2  0.9896      0.679 0.440 0.560
#> SRR1304045     2  0.9896      0.679 0.440 0.560
#> SRR1304048     1  0.7376      0.709 0.792 0.208
#> SRR1304049     1  0.7376      0.709 0.792 0.208
#> SRR1304050     1  0.0000      0.876 1.000 0.000
#> SRR1304051     1  0.4298      0.834 0.912 0.088
#> SRR1304052     1  0.4298      0.834 0.912 0.088
#> SRR1304053     1  0.4298      0.834 0.912 0.088
#> SRR1304055     1  0.5178      0.815 0.884 0.116
#> SRR1304054     2  0.9896      0.679 0.440 0.560
#> SRR1304056     1  0.4298      0.834 0.912 0.088
#> SRR1304059     1  0.4298      0.834 0.912 0.088
#> SRR1304057     1  0.0000      0.876 1.000 0.000
#> SRR1304058     2  0.5629      0.800 0.132 0.868
#> SRR1304060     1  0.0000      0.876 1.000 0.000
#> SRR1304061     1  0.4298      0.834 0.912 0.088

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>            class entropy silhouette    p1    p2    p3
#> SRR1303990     1  0.4002      0.795 0.840 0.160 0.000
#> SRR1303991     1  0.4002      0.795 0.840 0.160 0.000
#> SRR1303992     3  0.0000      1.000 0.000 0.000 1.000
#> SRR1303993     3  0.0000      1.000 0.000 0.000 1.000
#> SRR1303994     3  0.0000      1.000 0.000 0.000 1.000
#> SRR1303995     3  0.0000      1.000 0.000 0.000 1.000
#> SRR1303996     3  0.0000      1.000 0.000 0.000 1.000
#> SRR1303997     3  0.0000      1.000 0.000 0.000 1.000
#> SRR1303998     3  0.0000      1.000 0.000 0.000 1.000
#> SRR1303999     3  0.0000      1.000 0.000 0.000 1.000
#> SRR1304000     3  0.0000      1.000 0.000 0.000 1.000
#> SRR1304001     3  0.0000      1.000 0.000 0.000 1.000
#> SRR1304004     1  0.2796      0.915 0.908 0.000 0.092
#> SRR1304005     1  0.2796      0.915 0.908 0.000 0.092
#> SRR1304002     1  0.2711      0.917 0.912 0.000 0.088
#> SRR1304003     1  0.2711      0.917 0.912 0.000 0.088
#> SRR1304006     1  0.2711      0.917 0.912 0.000 0.088
#> SRR1304007     1  0.2711      0.917 0.912 0.000 0.088
#> SRR1304008     1  0.2796      0.915 0.908 0.000 0.092
#> SRR1304009     1  0.2796      0.915 0.908 0.000 0.092
#> SRR1304010     1  0.2711      0.917 0.912 0.000 0.088
#> SRR1304011     1  0.2711      0.917 0.912 0.000 0.088
#> SRR1304012     1  0.2796      0.915 0.908 0.000 0.092
#> SRR1304013     1  0.2796      0.915 0.908 0.000 0.092
#> SRR1304014     1  0.2711      0.917 0.912 0.000 0.088
#> SRR1304015     1  0.2796      0.915 0.908 0.000 0.092
#> SRR1304016     1  0.3619      0.797 0.864 0.136 0.000
#> SRR1304017     1  0.3619      0.797 0.864 0.136 0.000
#> SRR1304018     1  0.3619      0.797 0.864 0.136 0.000
#> SRR1304019     1  0.2796      0.915 0.908 0.000 0.092
#> SRR1304020     1  0.2796      0.915 0.908 0.000 0.092
#> SRR1304021     1  0.2711      0.917 0.912 0.000 0.088
#> SRR1304022     2  0.0000      0.725 0.000 1.000 0.000
#> SRR1304024     2  0.0000      0.725 0.000 1.000 0.000
#> SRR1304023     1  0.4002      0.795 0.840 0.160 0.000
#> SRR1304026     2  0.0000      0.725 0.000 1.000 0.000
#> SRR1304027     2  0.0000      0.725 0.000 1.000 0.000
#> SRR1304025     1  0.3412      0.809 0.876 0.124 0.000
#> SRR1304028     2  0.6126      0.700 0.400 0.600 0.000
#> SRR1304029     2  0.6126      0.700 0.400 0.600 0.000
#> SRR1304030     1  0.0424      0.892 0.992 0.008 0.000
#> SRR1304031     1  0.0424      0.892 0.992 0.008 0.000
#> SRR1304032     2  0.5363      0.756 0.276 0.724 0.000
#> SRR1304033     2  0.5363      0.756 0.276 0.724 0.000
#> SRR1304034     2  0.5363      0.756 0.276 0.724 0.000
#> SRR1304035     2  0.5363      0.756 0.276 0.724 0.000
#> SRR1304036     2  0.6126      0.700 0.400 0.600 0.000
#> SRR1304037     2  0.6126      0.700 0.400 0.600 0.000
#> SRR1304038     1  0.2711      0.917 0.912 0.000 0.088
#> SRR1304039     1  0.2711      0.917 0.912 0.000 0.088
#> SRR1304040     2  0.0000      0.725 0.000 1.000 0.000
#> SRR1304041     2  0.0000      0.725 0.000 1.000 0.000
#> SRR1304042     2  0.0000      0.725 0.000 1.000 0.000
#> SRR1304043     2  0.0000      0.725 0.000 1.000 0.000
#> SRR1304046     1  0.0424      0.892 0.992 0.008 0.000
#> SRR1304047     1  0.0424      0.892 0.992 0.008 0.000
#> SRR1304044     2  0.6126      0.700 0.400 0.600 0.000
#> SRR1304045     2  0.6126      0.700 0.400 0.600 0.000
#> SRR1304048     1  0.3340      0.814 0.880 0.120 0.000
#> SRR1304049     1  0.3340      0.814 0.880 0.120 0.000
#> SRR1304050     1  0.2711      0.917 0.912 0.000 0.088
#> SRR1304051     1  0.0000      0.894 1.000 0.000 0.000
#> SRR1304052     1  0.0000      0.894 1.000 0.000 0.000
#> SRR1304053     1  0.0000      0.894 1.000 0.000 0.000
#> SRR1304055     1  0.1163      0.884 0.972 0.028 0.000
#> SRR1304054     2  0.6126      0.700 0.400 0.600 0.000
#> SRR1304056     1  0.0000      0.894 1.000 0.000 0.000
#> SRR1304059     1  0.0000      0.894 1.000 0.000 0.000
#> SRR1304057     1  0.2711      0.917 0.912 0.000 0.088
#> SRR1304058     2  0.0000      0.725 0.000 1.000 0.000
#> SRR1304060     1  0.2711      0.917 0.912 0.000 0.088
#> SRR1304061     1  0.0000      0.894 1.000 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> SRR1303990     1  0.6274      0.541 0.620 0.292 0.088 0.000
#> SRR1303991     1  0.6274      0.541 0.620 0.292 0.088 0.000
#> SRR1303992     3  0.2149      1.000 0.088 0.000 0.912 0.000
#> SRR1303993     3  0.2149      1.000 0.088 0.000 0.912 0.000
#> SRR1303994     3  0.2149      1.000 0.088 0.000 0.912 0.000
#> SRR1303995     3  0.2149      1.000 0.088 0.000 0.912 0.000
#> SRR1303996     3  0.2149      1.000 0.088 0.000 0.912 0.000
#> SRR1303997     3  0.2149      1.000 0.088 0.000 0.912 0.000
#> SRR1303998     3  0.2149      1.000 0.088 0.000 0.912 0.000
#> SRR1303999     3  0.2149      1.000 0.088 0.000 0.912 0.000
#> SRR1304000     3  0.2149      1.000 0.088 0.000 0.912 0.000
#> SRR1304001     3  0.2149      1.000 0.088 0.000 0.912 0.000
#> SRR1304004     1  0.0188      0.863 0.996 0.000 0.004 0.000
#> SRR1304005     1  0.0188      0.863 0.996 0.000 0.004 0.000
#> SRR1304002     1  0.0000      0.865 1.000 0.000 0.000 0.000
#> SRR1304003     1  0.0000      0.865 1.000 0.000 0.000 0.000
#> SRR1304006     1  0.0000      0.865 1.000 0.000 0.000 0.000
#> SRR1304007     1  0.0000      0.865 1.000 0.000 0.000 0.000
#> SRR1304008     1  0.0188      0.863 0.996 0.000 0.004 0.000
#> SRR1304009     1  0.0188      0.863 0.996 0.000 0.004 0.000
#> SRR1304010     1  0.0000      0.865 1.000 0.000 0.000 0.000
#> SRR1304011     1  0.0000      0.865 1.000 0.000 0.000 0.000
#> SRR1304012     1  0.0188      0.863 0.996 0.000 0.004 0.000
#> SRR1304013     1  0.0188      0.863 0.996 0.000 0.004 0.000
#> SRR1304014     1  0.0000      0.865 1.000 0.000 0.000 0.000
#> SRR1304015     1  0.0188      0.863 0.996 0.000 0.004 0.000
#> SRR1304016     1  0.6049      0.645 0.680 0.200 0.000 0.120
#> SRR1304017     1  0.6027      0.645 0.684 0.192 0.000 0.124
#> SRR1304018     1  0.6027      0.645 0.684 0.192 0.000 0.124
#> SRR1304019     1  0.0188      0.863 0.996 0.000 0.004 0.000
#> SRR1304020     1  0.0188      0.863 0.996 0.000 0.004 0.000
#> SRR1304021     1  0.0000      0.865 1.000 0.000 0.000 0.000
#> SRR1304022     4  0.0000      1.000 0.000 0.000 0.000 1.000
#> SRR1304024     4  0.0000      1.000 0.000 0.000 0.000 1.000
#> SRR1304023     1  0.6274      0.541 0.620 0.292 0.088 0.000
#> SRR1304026     4  0.0000      1.000 0.000 0.000 0.000 1.000
#> SRR1304027     4  0.0000      1.000 0.000 0.000 0.000 1.000
#> SRR1304025     1  0.5874      0.661 0.696 0.192 0.000 0.112
#> SRR1304028     2  0.4356      0.879 0.292 0.708 0.000 0.000
#> SRR1304029     2  0.4356      0.879 0.292 0.708 0.000 0.000
#> SRR1304030     1  0.3400      0.783 0.820 0.180 0.000 0.000
#> SRR1304031     1  0.3400      0.783 0.820 0.180 0.000 0.000
#> SRR1304032     2  0.4724      0.763 0.096 0.792 0.000 0.112
#> SRR1304033     2  0.4724      0.763 0.096 0.792 0.000 0.112
#> SRR1304034     2  0.4724      0.763 0.096 0.792 0.000 0.112
#> SRR1304035     2  0.4724      0.763 0.096 0.792 0.000 0.112
#> SRR1304036     2  0.4356      0.879 0.292 0.708 0.000 0.000
#> SRR1304037     2  0.4356      0.879 0.292 0.708 0.000 0.000
#> SRR1304038     1  0.0000      0.865 1.000 0.000 0.000 0.000
#> SRR1304039     1  0.0000      0.865 1.000 0.000 0.000 0.000
#> SRR1304040     4  0.0000      1.000 0.000 0.000 0.000 1.000
#> SRR1304041     4  0.0000      1.000 0.000 0.000 0.000 1.000
#> SRR1304042     4  0.0000      1.000 0.000 0.000 0.000 1.000
#> SRR1304043     4  0.0000      1.000 0.000 0.000 0.000 1.000
#> SRR1304046     1  0.3400      0.783 0.820 0.180 0.000 0.000
#> SRR1304047     1  0.3400      0.783 0.820 0.180 0.000 0.000
#> SRR1304044     2  0.4356      0.879 0.292 0.708 0.000 0.000
#> SRR1304045     2  0.4356      0.879 0.292 0.708 0.000 0.000
#> SRR1304048     1  0.5820      0.666 0.700 0.192 0.000 0.108
#> SRR1304049     1  0.5820      0.666 0.700 0.192 0.000 0.108
#> SRR1304050     1  0.0000      0.865 1.000 0.000 0.000 0.000
#> SRR1304051     1  0.2281      0.827 0.904 0.096 0.000 0.000
#> SRR1304052     1  0.2281      0.827 0.904 0.096 0.000 0.000
#> SRR1304053     1  0.2281      0.827 0.904 0.096 0.000 0.000
#> SRR1304055     1  0.3307      0.815 0.868 0.104 0.000 0.028
#> SRR1304054     2  0.4356      0.879 0.292 0.708 0.000 0.000
#> SRR1304056     1  0.2281      0.827 0.904 0.096 0.000 0.000
#> SRR1304059     1  0.2281      0.827 0.904 0.096 0.000 0.000
#> SRR1304057     1  0.0000      0.865 1.000 0.000 0.000 0.000
#> SRR1304058     4  0.0000      1.000 0.000 0.000 0.000 1.000
#> SRR1304060     1  0.0000      0.865 1.000 0.000 0.000 0.000
#> SRR1304061     1  0.2281      0.827 0.904 0.096 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>            class entropy silhouette    p1    p2 p3    p4    p5
#> SRR1303990     5  0.0000      1.000 0.000 0.000  0 0.000 1.000
#> SRR1303991     5  0.0000      1.000 0.000 0.000  0 0.000 1.000
#> SRR1303992     3  0.0000      1.000 0.000 0.000  1 0.000 0.000
#> SRR1303993     3  0.0000      1.000 0.000 0.000  1 0.000 0.000
#> SRR1303994     3  0.0000      1.000 0.000 0.000  1 0.000 0.000
#> SRR1303995     3  0.0000      1.000 0.000 0.000  1 0.000 0.000
#> SRR1303996     3  0.0000      1.000 0.000 0.000  1 0.000 0.000
#> SRR1303997     3  0.0000      1.000 0.000 0.000  1 0.000 0.000
#> SRR1303998     3  0.0000      1.000 0.000 0.000  1 0.000 0.000
#> SRR1303999     3  0.0000      1.000 0.000 0.000  1 0.000 0.000
#> SRR1304000     3  0.0000      1.000 0.000 0.000  1 0.000 0.000
#> SRR1304001     3  0.0000      1.000 0.000 0.000  1 0.000 0.000
#> SRR1304004     1  0.0162      0.871 0.996 0.004  0 0.000 0.000
#> SRR1304005     1  0.0162      0.871 0.996 0.004  0 0.000 0.000
#> SRR1304002     1  0.0000      0.873 1.000 0.000  0 0.000 0.000
#> SRR1304003     1  0.0000      0.873 1.000 0.000  0 0.000 0.000
#> SRR1304006     1  0.0000      0.873 1.000 0.000  0 0.000 0.000
#> SRR1304007     1  0.0000      0.873 1.000 0.000  0 0.000 0.000
#> SRR1304008     1  0.0162      0.871 0.996 0.004  0 0.000 0.000
#> SRR1304009     1  0.0162      0.871 0.996 0.004  0 0.000 0.000
#> SRR1304010     1  0.0000      0.873 1.000 0.000  0 0.000 0.000
#> SRR1304011     1  0.0000      0.873 1.000 0.000  0 0.000 0.000
#> SRR1304012     1  0.0162      0.871 0.996 0.004  0 0.000 0.000
#> SRR1304013     1  0.0162      0.871 0.996 0.004  0 0.000 0.000
#> SRR1304014     1  0.0000      0.873 1.000 0.000  0 0.000 0.000
#> SRR1304015     1  0.0162      0.871 0.996 0.004  0 0.000 0.000
#> SRR1304016     1  0.4892      0.529 0.584 0.392  0 0.012 0.012
#> SRR1304017     1  0.4686      0.532 0.588 0.396  0 0.012 0.004
#> SRR1304018     1  0.4686      0.532 0.588 0.396  0 0.012 0.004
#> SRR1304019     1  0.0162      0.871 0.996 0.004  0 0.000 0.000
#> SRR1304020     1  0.0162      0.871 0.996 0.004  0 0.000 0.000
#> SRR1304021     1  0.0000      0.873 1.000 0.000  0 0.000 0.000
#> SRR1304022     4  0.0000      1.000 0.000 0.000  0 1.000 0.000
#> SRR1304024     4  0.0000      1.000 0.000 0.000  0 1.000 0.000
#> SRR1304023     5  0.0000      1.000 0.000 0.000  0 0.000 1.000
#> SRR1304026     4  0.0000      1.000 0.000 0.000  0 1.000 0.000
#> SRR1304027     4  0.0000      1.000 0.000 0.000  0 1.000 0.000
#> SRR1304025     1  0.4171      0.554 0.604 0.396  0 0.000 0.000
#> SRR1304028     2  0.3109      0.863 0.200 0.800  0 0.000 0.000
#> SRR1304029     2  0.3109      0.863 0.200 0.800  0 0.000 0.000
#> SRR1304030     1  0.3636      0.692 0.728 0.272  0 0.000 0.000
#> SRR1304031     1  0.3636      0.692 0.728 0.272  0 0.000 0.000
#> SRR1304032     2  0.0162      0.745 0.004 0.996  0 0.000 0.000
#> SRR1304033     2  0.0162      0.745 0.004 0.996  0 0.000 0.000
#> SRR1304034     2  0.0162      0.745 0.004 0.996  0 0.000 0.000
#> SRR1304035     2  0.0162      0.745 0.004 0.996  0 0.000 0.000
#> SRR1304036     2  0.3109      0.863 0.200 0.800  0 0.000 0.000
#> SRR1304037     2  0.3109      0.863 0.200 0.800  0 0.000 0.000
#> SRR1304038     1  0.0000      0.873 1.000 0.000  0 0.000 0.000
#> SRR1304039     1  0.0000      0.873 1.000 0.000  0 0.000 0.000
#> SRR1304040     4  0.0000      1.000 0.000 0.000  0 1.000 0.000
#> SRR1304041     4  0.0000      1.000 0.000 0.000  0 1.000 0.000
#> SRR1304042     4  0.0000      1.000 0.000 0.000  0 1.000 0.000
#> SRR1304043     4  0.0000      1.000 0.000 0.000  0 1.000 0.000
#> SRR1304046     1  0.3636      0.692 0.728 0.272  0 0.000 0.000
#> SRR1304047     1  0.3636      0.692 0.728 0.272  0 0.000 0.000
#> SRR1304044     2  0.3109      0.863 0.200 0.800  0 0.000 0.000
#> SRR1304045     2  0.3109      0.863 0.200 0.800  0 0.000 0.000
#> SRR1304048     1  0.4161      0.560 0.608 0.392  0 0.000 0.000
#> SRR1304049     1  0.4161      0.560 0.608 0.392  0 0.000 0.000
#> SRR1304050     1  0.0000      0.873 1.000 0.000  0 0.000 0.000
#> SRR1304051     1  0.1965      0.838 0.904 0.096  0 0.000 0.000
#> SRR1304052     1  0.1965      0.838 0.904 0.096  0 0.000 0.000
#> SRR1304053     1  0.1965      0.838 0.904 0.096  0 0.000 0.000
#> SRR1304055     1  0.2424      0.822 0.868 0.132  0 0.000 0.000
#> SRR1304054     2  0.3109      0.863 0.200 0.800  0 0.000 0.000
#> SRR1304056     1  0.1965      0.838 0.904 0.096  0 0.000 0.000
#> SRR1304059     1  0.1965      0.838 0.904 0.096  0 0.000 0.000
#> SRR1304057     1  0.0000      0.873 1.000 0.000  0 0.000 0.000
#> SRR1304058     4  0.0000      1.000 0.000 0.000  0 1.000 0.000
#> SRR1304060     1  0.0000      0.873 1.000 0.000  0 0.000 0.000
#> SRR1304061     1  0.1965      0.838 0.904 0.096  0 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>            class entropy silhouette    p1    p2 p3    p4    p5    p6
#> SRR1303990     6  0.0000      1.000 0.000 0.000  0 0.000 0.000 1.000
#> SRR1303991     6  0.0000      1.000 0.000 0.000  0 0.000 0.000 1.000
#> SRR1303992     3  0.0000      1.000 0.000 0.000  1 0.000 0.000 0.000
#> SRR1303993     3  0.0000      1.000 0.000 0.000  1 0.000 0.000 0.000
#> SRR1303994     3  0.0000      1.000 0.000 0.000  1 0.000 0.000 0.000
#> SRR1303995     3  0.0000      1.000 0.000 0.000  1 0.000 0.000 0.000
#> SRR1303996     3  0.0000      1.000 0.000 0.000  1 0.000 0.000 0.000
#> SRR1303997     3  0.0000      1.000 0.000 0.000  1 0.000 0.000 0.000
#> SRR1303998     3  0.0000      1.000 0.000 0.000  1 0.000 0.000 0.000
#> SRR1303999     3  0.0000      1.000 0.000 0.000  1 0.000 0.000 0.000
#> SRR1304000     3  0.0000      1.000 0.000 0.000  1 0.000 0.000 0.000
#> SRR1304001     3  0.0000      1.000 0.000 0.000  1 0.000 0.000 0.000
#> SRR1304004     1  0.4114      0.702 0.732 0.072  0 0.000 0.196 0.000
#> SRR1304005     1  0.4114      0.702 0.732 0.072  0 0.000 0.196 0.000
#> SRR1304002     1  0.0000      0.837 1.000 0.000  0 0.000 0.000 0.000
#> SRR1304003     1  0.0000      0.837 1.000 0.000  0 0.000 0.000 0.000
#> SRR1304006     1  0.0000      0.837 1.000 0.000  0 0.000 0.000 0.000
#> SRR1304007     1  0.0000      0.837 1.000 0.000  0 0.000 0.000 0.000
#> SRR1304008     1  0.4307      0.687 0.704 0.072  0 0.000 0.224 0.000
#> SRR1304009     1  0.4307      0.687 0.704 0.072  0 0.000 0.224 0.000
#> SRR1304010     1  0.0146      0.836 0.996 0.000  0 0.000 0.004 0.000
#> SRR1304011     1  0.0146      0.836 0.996 0.000  0 0.000 0.004 0.000
#> SRR1304012     1  0.4307      0.687 0.704 0.072  0 0.000 0.224 0.000
#> SRR1304013     1  0.4307      0.687 0.704 0.072  0 0.000 0.224 0.000
#> SRR1304014     1  0.0146      0.836 0.996 0.000  0 0.000 0.004 0.000
#> SRR1304015     1  0.4307      0.687 0.704 0.072  0 0.000 0.224 0.000
#> SRR1304016     5  0.3374      0.659 0.044 0.120  0 0.000 0.824 0.012
#> SRR1304017     5  0.3915      0.696 0.092 0.128  0 0.000 0.776 0.004
#> SRR1304018     5  0.3915      0.696 0.092 0.128  0 0.000 0.776 0.004
#> SRR1304019     1  0.4307      0.687 0.704 0.072  0 0.000 0.224 0.000
#> SRR1304020     1  0.4307      0.687 0.704 0.072  0 0.000 0.224 0.000
#> SRR1304021     1  0.0146      0.836 0.996 0.000  0 0.000 0.004 0.000
#> SRR1304022     4  0.0363      0.994 0.000 0.000  0 0.988 0.012 0.000
#> SRR1304024     4  0.0363      0.994 0.000 0.000  0 0.988 0.012 0.000
#> SRR1304023     6  0.0000      1.000 0.000 0.000  0 0.000 0.000 1.000
#> SRR1304026     4  0.0000      0.992 0.000 0.000  0 1.000 0.000 0.000
#> SRR1304027     4  0.0000      0.992 0.000 0.000  0 1.000 0.000 0.000
#> SRR1304025     5  0.5462      0.584 0.376 0.128  0 0.000 0.496 0.000
#> SRR1304028     2  0.2793      0.870 0.200 0.800  0 0.000 0.000 0.000
#> SRR1304029     2  0.2793      0.870 0.200 0.800  0 0.000 0.000 0.000
#> SRR1304030     5  0.2697      0.744 0.188 0.000  0 0.000 0.812 0.000
#> SRR1304031     5  0.2697      0.744 0.188 0.000  0 0.000 0.812 0.000
#> SRR1304032     2  0.1444      0.757 0.000 0.928  0 0.000 0.072 0.000
#> SRR1304033     2  0.1444      0.757 0.000 0.928  0 0.000 0.072 0.000
#> SRR1304034     2  0.1444      0.757 0.000 0.928  0 0.000 0.072 0.000
#> SRR1304035     2  0.1444      0.757 0.000 0.928  0 0.000 0.072 0.000
#> SRR1304036     2  0.2793      0.870 0.200 0.800  0 0.000 0.000 0.000
#> SRR1304037     2  0.2793      0.870 0.200 0.800  0 0.000 0.000 0.000
#> SRR1304038     1  0.0000      0.837 1.000 0.000  0 0.000 0.000 0.000
#> SRR1304039     1  0.0000      0.837 1.000 0.000  0 0.000 0.000 0.000
#> SRR1304040     4  0.0363      0.994 0.000 0.000  0 0.988 0.012 0.000
#> SRR1304041     4  0.0363      0.994 0.000 0.000  0 0.988 0.012 0.000
#> SRR1304042     4  0.0000      0.992 0.000 0.000  0 1.000 0.000 0.000
#> SRR1304043     4  0.0000      0.992 0.000 0.000  0 1.000 0.000 0.000
#> SRR1304046     5  0.2793      0.747 0.200 0.000  0 0.000 0.800 0.000
#> SRR1304047     5  0.2793      0.747 0.200 0.000  0 0.000 0.800 0.000
#> SRR1304044     2  0.2793      0.870 0.200 0.800  0 0.000 0.000 0.000
#> SRR1304045     2  0.2793      0.870 0.200 0.800  0 0.000 0.000 0.000
#> SRR1304048     5  0.5438      0.581 0.380 0.124  0 0.000 0.496 0.000
#> SRR1304049     5  0.5438      0.581 0.380 0.124  0 0.000 0.496 0.000
#> SRR1304050     1  0.0000      0.837 1.000 0.000  0 0.000 0.000 0.000
#> SRR1304051     1  0.1970      0.774 0.900 0.008  0 0.000 0.092 0.000
#> SRR1304052     1  0.1970      0.774 0.900 0.008  0 0.000 0.092 0.000
#> SRR1304053     1  0.1970      0.774 0.900 0.008  0 0.000 0.092 0.000
#> SRR1304055     1  0.2752      0.739 0.856 0.036  0 0.000 0.108 0.000
#> SRR1304054     2  0.2793      0.870 0.200 0.800  0 0.000 0.000 0.000
#> SRR1304056     1  0.1970      0.774 0.900 0.008  0 0.000 0.092 0.000
#> SRR1304059     1  0.1918      0.776 0.904 0.008  0 0.000 0.088 0.000
#> SRR1304057     1  0.0000      0.837 1.000 0.000  0 0.000 0.000 0.000
#> SRR1304058     4  0.0363      0.994 0.000 0.000  0 0.988 0.012 0.000
#> SRR1304060     1  0.0000      0.837 1.000 0.000  0 0.000 0.000 0.000
#> SRR1304061     1  0.1970      0.774 0.900 0.008  0 0.000 0.092 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 15595 rows and 72 columns.
#>   Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'ATC' method.
#>   Subgroups are detected by 'kmeans' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 6.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

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

collect_plots(res)

plot of chunk ATC-kmeans-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.378           0.753       0.798         0.4241 0.559   0.559
#> 3 3 0.414           0.764       0.849         0.2169 0.585   0.462
#> 4 4 0.563           0.718       0.838         0.2423 0.777   0.609
#> 5 5 0.633           0.723       0.833         0.1214 0.887   0.719
#> 6 6 0.693           0.804       0.856         0.0762 0.894   0.693

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

suggest_best_k(res)
#> [1] 6

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
#> SRR1303990     2  0.4161      0.833 0.084 0.916
#> SRR1303991     2  0.4161      0.833 0.084 0.916
#> SRR1303992     1  0.0376      0.751 0.996 0.004
#> SRR1303993     1  0.0376      0.751 0.996 0.004
#> SRR1303994     1  0.0376      0.751 0.996 0.004
#> SRR1303995     1  0.0376      0.751 0.996 0.004
#> SRR1303996     1  0.0376      0.751 0.996 0.004
#> SRR1303997     1  0.0376      0.751 0.996 0.004
#> SRR1303998     1  0.0376      0.751 0.996 0.004
#> SRR1303999     1  0.0376      0.751 0.996 0.004
#> SRR1304000     1  0.0376      0.751 0.996 0.004
#> SRR1304001     1  0.0376      0.751 0.996 0.004
#> SRR1304004     1  0.3431      0.776 0.936 0.064
#> SRR1304005     1  0.3431      0.776 0.936 0.064
#> SRR1304002     1  0.1843      0.763 0.972 0.028
#> SRR1304003     1  0.1843      0.763 0.972 0.028
#> SRR1304006     1  0.8386      0.753 0.732 0.268
#> SRR1304007     1  0.8327      0.754 0.736 0.264
#> SRR1304008     1  0.1633      0.762 0.976 0.024
#> SRR1304009     1  0.1633      0.762 0.976 0.024
#> SRR1304010     1  0.8909      0.733 0.692 0.308
#> SRR1304011     1  0.8909      0.733 0.692 0.308
#> SRR1304012     1  0.3431      0.776 0.936 0.064
#> SRR1304013     1  0.3431      0.776 0.936 0.064
#> SRR1304014     1  0.8813      0.738 0.700 0.300
#> SRR1304015     1  0.3431      0.776 0.936 0.064
#> SRR1304016     2  0.0376      0.895 0.004 0.996
#> SRR1304017     2  0.0000      0.898 0.000 1.000
#> SRR1304018     2  0.0000      0.898 0.000 1.000
#> SRR1304019     1  0.3431      0.776 0.936 0.064
#> SRR1304020     1  0.3431      0.776 0.936 0.064
#> SRR1304021     1  0.8608      0.745 0.716 0.284
#> SRR1304022     2  0.0000      0.898 0.000 1.000
#> SRR1304024     2  0.0000      0.898 0.000 1.000
#> SRR1304023     2  0.0376      0.895 0.004 0.996
#> SRR1304026     2  0.0000      0.898 0.000 1.000
#> SRR1304027     2  0.0000      0.898 0.000 1.000
#> SRR1304025     2  0.5178      0.830 0.116 0.884
#> SRR1304028     1  0.9460      0.675 0.636 0.364
#> SRR1304029     1  0.9460      0.675 0.636 0.364
#> SRR1304030     1  0.8955      0.727 0.688 0.312
#> SRR1304031     1  0.8955      0.727 0.688 0.312
#> SRR1304032     2  0.5178      0.830 0.116 0.884
#> SRR1304033     2  0.5178      0.830 0.116 0.884
#> SRR1304034     2  0.5178      0.830 0.116 0.884
#> SRR1304035     2  0.5178      0.830 0.116 0.884
#> SRR1304036     1  0.9393      0.685 0.644 0.356
#> SRR1304037     1  0.9393      0.685 0.644 0.356
#> SRR1304038     1  0.8386      0.753 0.732 0.268
#> SRR1304039     1  0.8386      0.753 0.732 0.268
#> SRR1304040     2  0.0000      0.898 0.000 1.000
#> SRR1304041     2  0.0000      0.898 0.000 1.000
#> SRR1304042     2  0.0000      0.898 0.000 1.000
#> SRR1304043     2  0.0000      0.898 0.000 1.000
#> SRR1304046     1  0.8813      0.736 0.700 0.300
#> SRR1304047     1  0.8813      0.736 0.700 0.300
#> SRR1304044     1  0.9954      0.501 0.540 0.460
#> SRR1304045     1  0.9954      0.501 0.540 0.460
#> SRR1304048     1  0.9983      0.459 0.524 0.476
#> SRR1304049     1  0.9983      0.459 0.524 0.476
#> SRR1304050     1  0.3584      0.776 0.932 0.068
#> SRR1304051     1  0.9248      0.701 0.660 0.340
#> SRR1304052     1  0.9754      0.610 0.592 0.408
#> SRR1304053     1  0.8861      0.735 0.696 0.304
#> SRR1304055     2  0.8207      0.569 0.256 0.744
#> SRR1304054     1  0.9775      0.603 0.588 0.412
#> SRR1304056     2  0.8555      0.500 0.280 0.720
#> SRR1304059     1  0.9754      0.610 0.592 0.408
#> SRR1304057     1  0.8661      0.744 0.712 0.288
#> SRR1304058     2  0.0000      0.898 0.000 1.000
#> SRR1304060     1  0.3584      0.776 0.932 0.068
#> SRR1304061     2  0.8207      0.569 0.256 0.744

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>            class entropy silhouette    p1    p2    p3
#> SRR1303990     1  0.7670      0.378 0.620 0.312 0.068
#> SRR1303991     1  0.7670      0.378 0.620 0.312 0.068
#> SRR1303992     3  0.3267      1.000 0.116 0.000 0.884
#> SRR1303993     3  0.3267      1.000 0.116 0.000 0.884
#> SRR1303994     3  0.3267      1.000 0.116 0.000 0.884
#> SRR1303995     3  0.3267      1.000 0.116 0.000 0.884
#> SRR1303996     3  0.3267      1.000 0.116 0.000 0.884
#> SRR1303997     3  0.3267      1.000 0.116 0.000 0.884
#> SRR1303998     3  0.3267      1.000 0.116 0.000 0.884
#> SRR1303999     3  0.3267      1.000 0.116 0.000 0.884
#> SRR1304000     3  0.3267      1.000 0.116 0.000 0.884
#> SRR1304001     3  0.3267      1.000 0.116 0.000 0.884
#> SRR1304004     1  0.2878      0.775 0.904 0.000 0.096
#> SRR1304005     1  0.2878      0.775 0.904 0.000 0.096
#> SRR1304002     1  0.5062      0.717 0.800 0.016 0.184
#> SRR1304003     1  0.5062      0.717 0.800 0.016 0.184
#> SRR1304006     1  0.0592      0.811 0.988 0.000 0.012
#> SRR1304007     1  0.0592      0.811 0.988 0.000 0.012
#> SRR1304008     1  0.6309     -0.180 0.504 0.000 0.496
#> SRR1304009     1  0.6309     -0.180 0.504 0.000 0.496
#> SRR1304010     1  0.0000      0.813 1.000 0.000 0.000
#> SRR1304011     1  0.0000      0.813 1.000 0.000 0.000
#> SRR1304012     1  0.2711      0.779 0.912 0.000 0.088
#> SRR1304013     1  0.2711      0.779 0.912 0.000 0.088
#> SRR1304014     1  0.0237      0.813 0.996 0.000 0.004
#> SRR1304015     1  0.2878      0.775 0.904 0.000 0.096
#> SRR1304016     1  0.6912      0.376 0.628 0.344 0.028
#> SRR1304017     1  0.7036      0.239 0.536 0.444 0.020
#> SRR1304018     1  0.5551      0.689 0.768 0.212 0.020
#> SRR1304019     1  0.2878      0.775 0.904 0.000 0.096
#> SRR1304020     1  0.2711      0.779 0.912 0.000 0.088
#> SRR1304021     1  0.0424      0.812 0.992 0.000 0.008
#> SRR1304022     2  0.3120      0.957 0.080 0.908 0.012
#> SRR1304024     2  0.2796      0.975 0.092 0.908 0.000
#> SRR1304023     1  0.7670      0.378 0.620 0.312 0.068
#> SRR1304026     2  0.1411      0.921 0.036 0.964 0.000
#> SRR1304027     2  0.1411      0.921 0.036 0.964 0.000
#> SRR1304025     1  0.5850      0.711 0.772 0.188 0.040
#> SRR1304028     1  0.7297      0.701 0.704 0.188 0.108
#> SRR1304029     1  0.7297      0.701 0.704 0.188 0.108
#> SRR1304030     1  0.0000      0.813 1.000 0.000 0.000
#> SRR1304031     1  0.0000      0.813 1.000 0.000 0.000
#> SRR1304032     1  0.8013      0.599 0.612 0.296 0.092
#> SRR1304033     1  0.8013      0.599 0.612 0.296 0.092
#> SRR1304034     1  0.7248      0.663 0.676 0.256 0.068
#> SRR1304035     1  0.7248      0.663 0.676 0.256 0.068
#> SRR1304036     1  0.7297      0.701 0.704 0.188 0.108
#> SRR1304037     1  0.7297      0.701 0.704 0.188 0.108
#> SRR1304038     1  0.3183      0.792 0.908 0.016 0.076
#> SRR1304039     1  0.3183      0.792 0.908 0.016 0.076
#> SRR1304040     2  0.2796      0.975 0.092 0.908 0.000
#> SRR1304041     2  0.2796      0.975 0.092 0.908 0.000
#> SRR1304042     2  0.2796      0.975 0.092 0.908 0.000
#> SRR1304043     2  0.2796      0.975 0.092 0.908 0.000
#> SRR1304046     1  0.0237      0.813 0.996 0.000 0.004
#> SRR1304047     1  0.0237      0.813 0.996 0.000 0.004
#> SRR1304044     1  0.7272      0.696 0.700 0.204 0.096
#> SRR1304045     1  0.7272      0.696 0.700 0.204 0.096
#> SRR1304048     1  0.5094      0.752 0.824 0.136 0.040
#> SRR1304049     1  0.5094      0.752 0.824 0.136 0.040
#> SRR1304050     1  0.2063      0.802 0.948 0.008 0.044
#> SRR1304051     1  0.0000      0.813 1.000 0.000 0.000
#> SRR1304052     1  0.0237      0.813 0.996 0.004 0.000
#> SRR1304053     1  0.0000      0.813 1.000 0.000 0.000
#> SRR1304055     1  0.5094      0.752 0.824 0.136 0.040
#> SRR1304054     1  0.7227      0.699 0.704 0.200 0.096
#> SRR1304056     1  0.0661      0.813 0.988 0.008 0.004
#> SRR1304059     1  0.0592      0.813 0.988 0.012 0.000
#> SRR1304057     1  0.0848      0.812 0.984 0.008 0.008
#> SRR1304058     2  0.2796      0.975 0.092 0.908 0.000
#> SRR1304060     1  0.1031      0.808 0.976 0.000 0.024
#> SRR1304061     1  0.0661      0.813 0.988 0.008 0.004

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> SRR1303990     1  0.7346     0.3462 0.536 0.308 0.008 0.148
#> SRR1303991     1  0.7346     0.3462 0.536 0.308 0.008 0.148
#> SRR1303992     3  0.0336     0.9987 0.008 0.000 0.992 0.000
#> SRR1303993     3  0.0336     0.9987 0.008 0.000 0.992 0.000
#> SRR1303994     3  0.0524     0.9981 0.008 0.004 0.988 0.000
#> SRR1303995     3  0.0524     0.9981 0.008 0.004 0.988 0.000
#> SRR1303996     3  0.0336     0.9987 0.008 0.000 0.992 0.000
#> SRR1303997     3  0.0336     0.9987 0.008 0.000 0.992 0.000
#> SRR1303998     3  0.0336     0.9987 0.008 0.000 0.992 0.000
#> SRR1303999     3  0.0336     0.9987 0.008 0.000 0.992 0.000
#> SRR1304000     3  0.0524     0.9981 0.008 0.004 0.988 0.000
#> SRR1304001     3  0.0524     0.9981 0.008 0.004 0.988 0.000
#> SRR1304004     1  0.1443     0.7221 0.960 0.004 0.028 0.008
#> SRR1304005     1  0.1443     0.7221 0.960 0.004 0.028 0.008
#> SRR1304002     1  0.5946     0.4028 0.688 0.232 0.072 0.008
#> SRR1304003     1  0.5946     0.4028 0.688 0.232 0.072 0.008
#> SRR1304006     1  0.1716     0.7335 0.936 0.064 0.000 0.000
#> SRR1304007     1  0.1716     0.7335 0.936 0.064 0.000 0.000
#> SRR1304008     1  0.4114     0.5608 0.788 0.004 0.200 0.008
#> SRR1304009     1  0.4114     0.5608 0.788 0.004 0.200 0.008
#> SRR1304010     1  0.2530     0.7147 0.888 0.112 0.000 0.000
#> SRR1304011     1  0.2530     0.7147 0.888 0.112 0.000 0.000
#> SRR1304012     1  0.1721     0.7189 0.952 0.012 0.028 0.008
#> SRR1304013     1  0.1721     0.7189 0.952 0.012 0.028 0.008
#> SRR1304014     1  0.2149     0.7274 0.912 0.088 0.000 0.000
#> SRR1304015     1  0.1443     0.7221 0.960 0.004 0.028 0.008
#> SRR1304016     1  0.6217     0.5002 0.688 0.184 0.008 0.120
#> SRR1304017     1  0.7003     0.3083 0.564 0.316 0.008 0.112
#> SRR1304018     1  0.4722     0.4789 0.692 0.300 0.008 0.000
#> SRR1304019     1  0.1721     0.7189 0.952 0.012 0.028 0.008
#> SRR1304020     1  0.1721     0.7189 0.952 0.012 0.028 0.008
#> SRR1304021     1  0.0707     0.7378 0.980 0.020 0.000 0.000
#> SRR1304022     4  0.0672     0.9898 0.008 0.008 0.000 0.984
#> SRR1304024     4  0.0927     0.9978 0.008 0.016 0.000 0.976
#> SRR1304023     1  0.7444     0.3167 0.508 0.336 0.008 0.148
#> SRR1304026     4  0.1042     0.9957 0.008 0.020 0.000 0.972
#> SRR1304027     4  0.1042     0.9957 0.008 0.020 0.000 0.972
#> SRR1304025     2  0.4967     0.4430 0.452 0.548 0.000 0.000
#> SRR1304028     2  0.4304     0.7816 0.284 0.716 0.000 0.000
#> SRR1304029     2  0.4304     0.7816 0.284 0.716 0.000 0.000
#> SRR1304030     1  0.2081     0.7297 0.916 0.084 0.000 0.000
#> SRR1304031     1  0.2081     0.7297 0.916 0.084 0.000 0.000
#> SRR1304032     2  0.3486     0.8060 0.188 0.812 0.000 0.000
#> SRR1304033     2  0.3486     0.8060 0.188 0.812 0.000 0.000
#> SRR1304034     2  0.3486     0.8060 0.188 0.812 0.000 0.000
#> SRR1304035     2  0.3486     0.8060 0.188 0.812 0.000 0.000
#> SRR1304036     2  0.4331     0.7781 0.288 0.712 0.000 0.000
#> SRR1304037     2  0.4331     0.7781 0.288 0.712 0.000 0.000
#> SRR1304038     1  0.4936     0.0882 0.624 0.372 0.000 0.004
#> SRR1304039     1  0.4936     0.0882 0.624 0.372 0.000 0.004
#> SRR1304040     4  0.0927     0.9978 0.008 0.016 0.000 0.976
#> SRR1304041     4  0.0927     0.9978 0.008 0.016 0.000 0.976
#> SRR1304042     4  0.0927     0.9978 0.008 0.016 0.000 0.976
#> SRR1304043     4  0.0927     0.9978 0.008 0.016 0.000 0.976
#> SRR1304046     1  0.1022     0.7374 0.968 0.032 0.000 0.000
#> SRR1304047     1  0.1022     0.7374 0.968 0.032 0.000 0.000
#> SRR1304044     2  0.3726     0.8145 0.212 0.788 0.000 0.000
#> SRR1304045     2  0.3726     0.8145 0.212 0.788 0.000 0.000
#> SRR1304048     2  0.4989     0.4202 0.472 0.528 0.000 0.000
#> SRR1304049     2  0.4989     0.4202 0.472 0.528 0.000 0.000
#> SRR1304050     1  0.2222     0.7322 0.928 0.056 0.008 0.008
#> SRR1304051     1  0.3569     0.6463 0.804 0.196 0.000 0.000
#> SRR1304052     1  0.4331     0.4951 0.712 0.288 0.000 0.000
#> SRR1304053     1  0.2149     0.7274 0.912 0.088 0.000 0.000
#> SRR1304055     2  0.4972     0.4308 0.456 0.544 0.000 0.000
#> SRR1304054     2  0.3726     0.8145 0.212 0.788 0.000 0.000
#> SRR1304056     1  0.3873     0.6179 0.772 0.228 0.000 0.000
#> SRR1304059     1  0.4761     0.2297 0.628 0.372 0.000 0.000
#> SRR1304057     1  0.2704     0.7041 0.876 0.124 0.000 0.000
#> SRR1304058     4  0.0927     0.9978 0.008 0.016 0.000 0.976
#> SRR1304060     1  0.0895     0.7371 0.976 0.020 0.004 0.000
#> SRR1304061     1  0.4008     0.5949 0.756 0.244 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>            class entropy silhouette    p1    p2    p3    p4    p5
#> SRR1303990     5  0.4286      0.965 0.140 0.032 0.000 0.036 0.792
#> SRR1303991     5  0.4286      0.965 0.140 0.032 0.000 0.036 0.792
#> SRR1303992     3  0.0671      0.970 0.000 0.004 0.980 0.000 0.016
#> SRR1303993     3  0.0671      0.970 0.000 0.004 0.980 0.000 0.016
#> SRR1303994     3  0.1430      0.964 0.000 0.004 0.944 0.000 0.052
#> SRR1303995     3  0.1430      0.964 0.000 0.004 0.944 0.000 0.052
#> SRR1303996     3  0.0703      0.970 0.000 0.000 0.976 0.000 0.024
#> SRR1303997     3  0.0703      0.970 0.000 0.000 0.976 0.000 0.024
#> SRR1303998     3  0.0609      0.971 0.000 0.000 0.980 0.000 0.020
#> SRR1303999     3  0.0609      0.971 0.000 0.000 0.980 0.000 0.020
#> SRR1304000     3  0.1205      0.966 0.000 0.004 0.956 0.000 0.040
#> SRR1304001     3  0.1205      0.966 0.000 0.004 0.956 0.000 0.040
#> SRR1304004     1  0.4047      0.440 0.676 0.000 0.004 0.000 0.320
#> SRR1304005     1  0.4047      0.440 0.676 0.000 0.004 0.000 0.320
#> SRR1304002     1  0.3209      0.619 0.860 0.060 0.004 0.000 0.076
#> SRR1304003     1  0.3209      0.619 0.860 0.060 0.004 0.000 0.076
#> SRR1304006     1  0.0880      0.662 0.968 0.032 0.000 0.000 0.000
#> SRR1304007     1  0.0794      0.661 0.972 0.028 0.000 0.000 0.000
#> SRR1304008     1  0.4270      0.428 0.668 0.000 0.012 0.000 0.320
#> SRR1304009     1  0.4270      0.428 0.668 0.000 0.012 0.000 0.320
#> SRR1304010     1  0.2871      0.656 0.872 0.088 0.000 0.000 0.040
#> SRR1304011     1  0.2871      0.656 0.872 0.088 0.000 0.000 0.040
#> SRR1304012     1  0.4066      0.435 0.672 0.000 0.004 0.000 0.324
#> SRR1304013     1  0.4066      0.435 0.672 0.000 0.004 0.000 0.324
#> SRR1304014     1  0.1282      0.663 0.952 0.044 0.000 0.000 0.004
#> SRR1304015     1  0.4047      0.440 0.676 0.000 0.004 0.000 0.320
#> SRR1304016     1  0.6917      0.392 0.500 0.200 0.000 0.024 0.276
#> SRR1304017     1  0.5961      0.479 0.588 0.320 0.000 0.040 0.052
#> SRR1304018     1  0.5302      0.516 0.620 0.320 0.000 0.008 0.052
#> SRR1304019     1  0.4066      0.435 0.672 0.000 0.004 0.000 0.324
#> SRR1304020     1  0.4066      0.435 0.672 0.000 0.004 0.000 0.324
#> SRR1304021     1  0.1386      0.660 0.952 0.032 0.000 0.000 0.016
#> SRR1304022     4  0.0000      0.992 0.000 0.000 0.000 1.000 0.000
#> SRR1304024     4  0.0000      0.992 0.000 0.000 0.000 1.000 0.000
#> SRR1304023     5  0.4431      0.929 0.108 0.052 0.000 0.044 0.796
#> SRR1304026     4  0.0798      0.984 0.000 0.008 0.000 0.976 0.016
#> SRR1304027     4  0.0798      0.984 0.000 0.008 0.000 0.976 0.016
#> SRR1304025     1  0.5289      0.295 0.500 0.452 0.000 0.000 0.048
#> SRR1304028     2  0.2304      0.889 0.100 0.892 0.000 0.000 0.008
#> SRR1304029     2  0.2304      0.889 0.100 0.892 0.000 0.000 0.008
#> SRR1304030     1  0.3995      0.617 0.788 0.060 0.000 0.000 0.152
#> SRR1304031     1  0.3995      0.617 0.788 0.060 0.000 0.000 0.152
#> SRR1304032     2  0.1216      0.910 0.020 0.960 0.000 0.000 0.020
#> SRR1304033     2  0.1216      0.910 0.020 0.960 0.000 0.000 0.020
#> SRR1304034     2  0.1399      0.910 0.020 0.952 0.000 0.000 0.028
#> SRR1304035     2  0.1399      0.910 0.020 0.952 0.000 0.000 0.028
#> SRR1304036     2  0.3081      0.817 0.156 0.832 0.000 0.000 0.012
#> SRR1304037     2  0.3081      0.817 0.156 0.832 0.000 0.000 0.012
#> SRR1304038     1  0.3750      0.613 0.756 0.232 0.000 0.000 0.012
#> SRR1304039     1  0.3750      0.613 0.756 0.232 0.000 0.000 0.012
#> SRR1304040     4  0.0000      0.992 0.000 0.000 0.000 1.000 0.000
#> SRR1304041     4  0.0000      0.992 0.000 0.000 0.000 1.000 0.000
#> SRR1304042     4  0.0451      0.990 0.000 0.004 0.000 0.988 0.008
#> SRR1304043     4  0.0451      0.990 0.000 0.004 0.000 0.988 0.008
#> SRR1304046     1  0.4134      0.575 0.760 0.044 0.000 0.000 0.196
#> SRR1304047     1  0.4134      0.575 0.760 0.044 0.000 0.000 0.196
#> SRR1304044     2  0.1043      0.917 0.040 0.960 0.000 0.000 0.000
#> SRR1304045     2  0.1043      0.917 0.040 0.960 0.000 0.000 0.000
#> SRR1304048     1  0.5271      0.309 0.520 0.432 0.000 0.000 0.048
#> SRR1304049     1  0.5271      0.309 0.520 0.432 0.000 0.000 0.048
#> SRR1304050     1  0.1732      0.625 0.920 0.000 0.000 0.000 0.080
#> SRR1304051     1  0.4203      0.608 0.760 0.188 0.000 0.000 0.052
#> SRR1304052     1  0.4713      0.560 0.676 0.280 0.000 0.000 0.044
#> SRR1304053     1  0.2278      0.661 0.908 0.060 0.000 0.000 0.032
#> SRR1304055     1  0.5267      0.315 0.524 0.428 0.000 0.000 0.048
#> SRR1304054     2  0.1408      0.916 0.044 0.948 0.000 0.000 0.008
#> SRR1304056     1  0.4519      0.586 0.720 0.228 0.000 0.000 0.052
#> SRR1304059     1  0.4657      0.557 0.668 0.296 0.000 0.000 0.036
#> SRR1304057     1  0.2248      0.662 0.900 0.088 0.000 0.000 0.012
#> SRR1304058     4  0.0000      0.992 0.000 0.000 0.000 1.000 0.000
#> SRR1304060     1  0.0703      0.644 0.976 0.000 0.000 0.000 0.024
#> SRR1304061     1  0.4681      0.571 0.696 0.252 0.000 0.000 0.052

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>            class entropy silhouette    p1    p2    p3    p4    p5    p6
#> SRR1303990     6  0.3989     0.9513 0.032 0.008 0.000 0.004 0.208 0.748
#> SRR1303991     6  0.3989     0.9513 0.032 0.008 0.000 0.004 0.208 0.748
#> SRR1303992     3  0.1672     0.9424 0.000 0.004 0.932 0.000 0.016 0.048
#> SRR1303993     3  0.1672     0.9424 0.000 0.004 0.932 0.000 0.016 0.048
#> SRR1303994     3  0.1528     0.9499 0.000 0.012 0.944 0.000 0.016 0.028
#> SRR1303995     3  0.1528     0.9499 0.000 0.012 0.944 0.000 0.016 0.028
#> SRR1303996     3  0.1418     0.9501 0.000 0.000 0.944 0.000 0.032 0.024
#> SRR1303997     3  0.1418     0.9501 0.000 0.000 0.944 0.000 0.032 0.024
#> SRR1303998     3  0.1092     0.9521 0.000 0.000 0.960 0.000 0.020 0.020
#> SRR1303999     3  0.1092     0.9521 0.000 0.000 0.960 0.000 0.020 0.020
#> SRR1304000     3  0.0984     0.9535 0.000 0.008 0.968 0.000 0.012 0.012
#> SRR1304001     3  0.0984     0.9535 0.000 0.008 0.968 0.000 0.012 0.012
#> SRR1304004     5  0.2527     0.9936 0.168 0.000 0.000 0.000 0.832 0.000
#> SRR1304005     5  0.2527     0.9936 0.168 0.000 0.000 0.000 0.832 0.000
#> SRR1304002     1  0.5714     0.0948 0.512 0.044 0.000 0.000 0.380 0.064
#> SRR1304003     1  0.5714     0.0948 0.512 0.044 0.000 0.000 0.380 0.064
#> SRR1304006     1  0.2333     0.7193 0.872 0.004 0.000 0.000 0.120 0.004
#> SRR1304007     1  0.2333     0.7193 0.872 0.004 0.000 0.000 0.120 0.004
#> SRR1304008     5  0.2632     0.9925 0.164 0.000 0.004 0.000 0.832 0.000
#> SRR1304009     5  0.2632     0.9925 0.164 0.000 0.004 0.000 0.832 0.000
#> SRR1304010     1  0.1088     0.7593 0.960 0.000 0.000 0.000 0.024 0.016
#> SRR1304011     1  0.1088     0.7593 0.960 0.000 0.000 0.000 0.024 0.016
#> SRR1304012     5  0.2491     0.9948 0.164 0.000 0.000 0.000 0.836 0.000
#> SRR1304013     5  0.2491     0.9948 0.164 0.000 0.000 0.000 0.836 0.000
#> SRR1304014     1  0.2302     0.7215 0.872 0.000 0.000 0.000 0.120 0.008
#> SRR1304015     5  0.2527     0.9936 0.168 0.000 0.000 0.000 0.832 0.000
#> SRR1304016     1  0.5972     0.5313 0.636 0.092 0.000 0.024 0.196 0.052
#> SRR1304017     1  0.4268     0.6895 0.788 0.116 0.000 0.028 0.024 0.044
#> SRR1304018     1  0.3936     0.7019 0.804 0.116 0.000 0.012 0.024 0.044
#> SRR1304019     5  0.2491     0.9948 0.164 0.000 0.000 0.000 0.836 0.000
#> SRR1304020     5  0.2491     0.9948 0.164 0.000 0.000 0.000 0.836 0.000
#> SRR1304021     1  0.2302     0.7215 0.872 0.000 0.000 0.000 0.120 0.008
#> SRR1304022     4  0.0547     0.9508 0.000 0.000 0.000 0.980 0.020 0.000
#> SRR1304024     4  0.0146     0.9591 0.000 0.000 0.000 0.996 0.004 0.000
#> SRR1304023     6  0.4438     0.9065 0.056 0.008 0.000 0.020 0.168 0.748
#> SRR1304026     4  0.2604     0.9229 0.000 0.008 0.000 0.880 0.076 0.036
#> SRR1304027     4  0.2604     0.9229 0.000 0.008 0.000 0.880 0.076 0.036
#> SRR1304025     1  0.3854     0.6758 0.760 0.188 0.000 0.000 0.004 0.048
#> SRR1304028     2  0.2350     0.8760 0.100 0.880 0.000 0.000 0.000 0.020
#> SRR1304029     2  0.2350     0.8760 0.100 0.880 0.000 0.000 0.000 0.020
#> SRR1304030     1  0.3950     0.5116 0.696 0.000 0.000 0.000 0.276 0.028
#> SRR1304031     1  0.3950     0.5116 0.696 0.000 0.000 0.000 0.276 0.028
#> SRR1304032     2  0.2360     0.8779 0.044 0.900 0.000 0.000 0.012 0.044
#> SRR1304033     2  0.2360     0.8779 0.044 0.900 0.000 0.000 0.012 0.044
#> SRR1304034     2  0.2147     0.8818 0.044 0.912 0.000 0.000 0.012 0.032
#> SRR1304035     2  0.2147     0.8818 0.044 0.912 0.000 0.000 0.012 0.032
#> SRR1304036     2  0.2592     0.8507 0.116 0.864 0.000 0.000 0.004 0.016
#> SRR1304037     2  0.2592     0.8507 0.116 0.864 0.000 0.000 0.004 0.016
#> SRR1304038     1  0.2755     0.7462 0.876 0.068 0.000 0.000 0.016 0.040
#> SRR1304039     1  0.2755     0.7462 0.876 0.068 0.000 0.000 0.016 0.040
#> SRR1304040     4  0.0000     0.9597 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR1304041     4  0.0000     0.9597 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR1304042     4  0.1562     0.9506 0.000 0.004 0.000 0.940 0.032 0.024
#> SRR1304043     4  0.1562     0.9506 0.000 0.004 0.000 0.940 0.032 0.024
#> SRR1304046     1  0.4343     0.2775 0.592 0.000 0.000 0.000 0.380 0.028
#> SRR1304047     1  0.4343     0.2775 0.592 0.000 0.000 0.000 0.380 0.028
#> SRR1304044     2  0.1462     0.8987 0.056 0.936 0.000 0.000 0.000 0.008
#> SRR1304045     2  0.1462     0.8987 0.056 0.936 0.000 0.000 0.000 0.008
#> SRR1304048     1  0.3562     0.6910 0.784 0.176 0.000 0.000 0.004 0.036
#> SRR1304049     1  0.3562     0.6910 0.784 0.176 0.000 0.000 0.004 0.036
#> SRR1304050     1  0.4964     0.1327 0.540 0.012 0.000 0.000 0.404 0.044
#> SRR1304051     1  0.1332     0.7598 0.952 0.028 0.000 0.000 0.008 0.012
#> SRR1304052     1  0.1807     0.7557 0.920 0.060 0.000 0.000 0.000 0.020
#> SRR1304053     1  0.1049     0.7552 0.960 0.000 0.000 0.000 0.032 0.008
#> SRR1304055     1  0.3419     0.6918 0.792 0.176 0.000 0.000 0.004 0.028
#> SRR1304054     2  0.1701     0.8969 0.072 0.920 0.000 0.000 0.000 0.008
#> SRR1304056     1  0.2176     0.7457 0.896 0.080 0.000 0.000 0.000 0.024
#> SRR1304059     1  0.1765     0.7569 0.924 0.052 0.000 0.000 0.000 0.024
#> SRR1304057     1  0.2328     0.7494 0.904 0.032 0.000 0.000 0.044 0.020
#> SRR1304058     4  0.0146     0.9591 0.000 0.000 0.000 0.996 0.004 0.000
#> SRR1304060     1  0.2662     0.6970 0.840 0.004 0.000 0.000 0.152 0.004
#> SRR1304061     1  0.2230     0.7447 0.892 0.084 0.000 0.000 0.000 0.024

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

consensus_heatmap(res, k = 2)

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

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

collect_plots(res)

plot of chunk ATC-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 0.837           0.841       0.940         0.5054 0.496   0.496
#> 3 3 0.638           0.715       0.853         0.2915 0.812   0.641
#> 4 4 0.965           0.950       0.969         0.1413 0.839   0.586
#> 5 5 0.807           0.682       0.859         0.0693 0.928   0.726
#> 6 6 0.791           0.714       0.855         0.0371 0.952   0.774

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
#> SRR1303990     2   0.985      0.284 0.428 0.572
#> SRR1303991     2   0.985      0.284 0.428 0.572
#> SRR1303992     1   0.000      0.922 1.000 0.000
#> SRR1303993     1   0.000      0.922 1.000 0.000
#> SRR1303994     1   0.000      0.922 1.000 0.000
#> SRR1303995     1   0.000      0.922 1.000 0.000
#> SRR1303996     1   0.000      0.922 1.000 0.000
#> SRR1303997     1   0.000      0.922 1.000 0.000
#> SRR1303998     1   0.000      0.922 1.000 0.000
#> SRR1303999     1   0.000      0.922 1.000 0.000
#> SRR1304000     1   0.000      0.922 1.000 0.000
#> SRR1304001     1   0.000      0.922 1.000 0.000
#> SRR1304004     1   0.000      0.922 1.000 0.000
#> SRR1304005     1   0.000      0.922 1.000 0.000
#> SRR1304002     1   0.000      0.922 1.000 0.000
#> SRR1304003     1   0.000      0.922 1.000 0.000
#> SRR1304006     1   0.000      0.922 1.000 0.000
#> SRR1304007     1   0.000      0.922 1.000 0.000
#> SRR1304008     1   0.000      0.922 1.000 0.000
#> SRR1304009     1   0.000      0.922 1.000 0.000
#> SRR1304010     2   0.988      0.264 0.436 0.564
#> SRR1304011     2   0.990      0.253 0.440 0.560
#> SRR1304012     1   0.000      0.922 1.000 0.000
#> SRR1304013     1   0.000      0.922 1.000 0.000
#> SRR1304014     1   0.000      0.922 1.000 0.000
#> SRR1304015     1   0.000      0.922 1.000 0.000
#> SRR1304016     2   0.000      0.938 0.000 1.000
#> SRR1304017     2   0.000      0.938 0.000 1.000
#> SRR1304018     2   0.000      0.938 0.000 1.000
#> SRR1304019     1   0.000      0.922 1.000 0.000
#> SRR1304020     1   0.000      0.922 1.000 0.000
#> SRR1304021     1   0.000      0.922 1.000 0.000
#> SRR1304022     2   0.000      0.938 0.000 1.000
#> SRR1304024     2   0.000      0.938 0.000 1.000
#> SRR1304023     2   0.000      0.938 0.000 1.000
#> SRR1304026     2   0.000      0.938 0.000 1.000
#> SRR1304027     2   0.000      0.938 0.000 1.000
#> SRR1304025     2   0.000      0.938 0.000 1.000
#> SRR1304028     1   0.988      0.303 0.564 0.436
#> SRR1304029     1   0.988      0.303 0.564 0.436
#> SRR1304030     1   0.988      0.303 0.564 0.436
#> SRR1304031     1   0.988      0.303 0.564 0.436
#> SRR1304032     2   0.000      0.938 0.000 1.000
#> SRR1304033     2   0.000      0.938 0.000 1.000
#> SRR1304034     2   0.000      0.938 0.000 1.000
#> SRR1304035     2   0.000      0.938 0.000 1.000
#> SRR1304036     1   0.988      0.303 0.564 0.436
#> SRR1304037     1   0.988      0.303 0.564 0.436
#> SRR1304038     1   0.000      0.922 1.000 0.000
#> SRR1304039     1   0.000      0.922 1.000 0.000
#> SRR1304040     2   0.000      0.938 0.000 1.000
#> SRR1304041     2   0.000      0.938 0.000 1.000
#> SRR1304042     2   0.000      0.938 0.000 1.000
#> SRR1304043     2   0.000      0.938 0.000 1.000
#> SRR1304046     1   0.000      0.922 1.000 0.000
#> SRR1304047     1   0.000      0.922 1.000 0.000
#> SRR1304044     2   0.000      0.938 0.000 1.000
#> SRR1304045     2   0.000      0.938 0.000 1.000
#> SRR1304048     2   0.000      0.938 0.000 1.000
#> SRR1304049     2   0.000      0.938 0.000 1.000
#> SRR1304050     1   0.000      0.922 1.000 0.000
#> SRR1304051     2   0.000      0.938 0.000 1.000
#> SRR1304052     2   0.000      0.938 0.000 1.000
#> SRR1304053     1   0.000      0.922 1.000 0.000
#> SRR1304055     2   0.000      0.938 0.000 1.000
#> SRR1304054     2   0.000      0.938 0.000 1.000
#> SRR1304056     2   0.000      0.938 0.000 1.000
#> SRR1304059     2   0.000      0.938 0.000 1.000
#> SRR1304057     1   0.000      0.922 1.000 0.000
#> SRR1304058     2   0.000      0.938 0.000 1.000
#> SRR1304060     1   0.000      0.922 1.000 0.000
#> SRR1304061     2   0.000      0.938 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
#> SRR1303990     1  0.2537     0.7800 0.920 0.080 0.000
#> SRR1303991     1  0.2537     0.7800 0.920 0.080 0.000
#> SRR1303992     3  0.0000     0.8410 0.000 0.000 1.000
#> SRR1303993     3  0.0000     0.8410 0.000 0.000 1.000
#> SRR1303994     3  0.0000     0.8410 0.000 0.000 1.000
#> SRR1303995     3  0.0000     0.8410 0.000 0.000 1.000
#> SRR1303996     3  0.0000     0.8410 0.000 0.000 1.000
#> SRR1303997     3  0.0000     0.8410 0.000 0.000 1.000
#> SRR1303998     3  0.0000     0.8410 0.000 0.000 1.000
#> SRR1303999     3  0.0000     0.8410 0.000 0.000 1.000
#> SRR1304000     3  0.0000     0.8410 0.000 0.000 1.000
#> SRR1304001     3  0.0000     0.8410 0.000 0.000 1.000
#> SRR1304004     3  0.4931     0.8108 0.000 0.232 0.768
#> SRR1304005     3  0.4931     0.8108 0.000 0.232 0.768
#> SRR1304002     3  0.0000     0.8410 0.000 0.000 1.000
#> SRR1304003     3  0.0000     0.8410 0.000 0.000 1.000
#> SRR1304006     3  0.1163     0.8413 0.000 0.028 0.972
#> SRR1304007     3  0.1163     0.8413 0.000 0.028 0.972
#> SRR1304008     3  0.4931     0.8108 0.000 0.232 0.768
#> SRR1304009     3  0.4931     0.8108 0.000 0.232 0.768
#> SRR1304010     1  0.4887     0.6077 0.772 0.228 0.000
#> SRR1304011     1  0.4887     0.6077 0.772 0.228 0.000
#> SRR1304012     3  0.4931     0.8108 0.000 0.232 0.768
#> SRR1304013     3  0.4931     0.8108 0.000 0.232 0.768
#> SRR1304014     3  0.5158     0.8080 0.004 0.232 0.764
#> SRR1304015     3  0.4931     0.8108 0.000 0.232 0.768
#> SRR1304016     1  0.1289     0.8184 0.968 0.032 0.000
#> SRR1304017     1  0.0000     0.8345 1.000 0.000 0.000
#> SRR1304018     1  0.0000     0.8345 1.000 0.000 0.000
#> SRR1304019     3  0.4931     0.8108 0.000 0.232 0.768
#> SRR1304020     3  0.4931     0.8108 0.000 0.232 0.768
#> SRR1304021     3  0.4931     0.8108 0.000 0.232 0.768
#> SRR1304022     1  0.0000     0.8345 1.000 0.000 0.000
#> SRR1304024     1  0.0000     0.8345 1.000 0.000 0.000
#> SRR1304023     1  0.0424     0.8318 0.992 0.008 0.000
#> SRR1304026     1  0.0424     0.8306 0.992 0.008 0.000
#> SRR1304027     1  0.0424     0.8306 0.992 0.008 0.000
#> SRR1304025     1  0.5733     0.3781 0.676 0.324 0.000
#> SRR1304028     2  0.4974     0.6917 0.000 0.764 0.236
#> SRR1304029     2  0.4974     0.6917 0.000 0.764 0.236
#> SRR1304030     2  0.8351     0.2367 0.272 0.604 0.124
#> SRR1304031     2  0.8351     0.2367 0.272 0.604 0.124
#> SRR1304032     2  0.4974     0.7358 0.236 0.764 0.000
#> SRR1304033     2  0.4974     0.7358 0.236 0.764 0.000
#> SRR1304034     2  0.4974     0.7358 0.236 0.764 0.000
#> SRR1304035     2  0.4974     0.7358 0.236 0.764 0.000
#> SRR1304036     2  0.4974     0.6917 0.000 0.764 0.236
#> SRR1304037     2  0.4974     0.6917 0.000 0.764 0.236
#> SRR1304038     3  0.6079     0.1567 0.000 0.388 0.612
#> SRR1304039     3  0.6079     0.1567 0.000 0.388 0.612
#> SRR1304040     1  0.0000     0.8345 1.000 0.000 0.000
#> SRR1304041     1  0.0000     0.8345 1.000 0.000 0.000
#> SRR1304042     1  0.0000     0.8345 1.000 0.000 0.000
#> SRR1304043     1  0.0000     0.8345 1.000 0.000 0.000
#> SRR1304046     3  0.5378     0.8022 0.008 0.236 0.756
#> SRR1304047     3  0.5378     0.8022 0.008 0.236 0.756
#> SRR1304044     2  0.4974     0.7358 0.236 0.764 0.000
#> SRR1304045     2  0.4974     0.7358 0.236 0.764 0.000
#> SRR1304048     1  0.6215     0.0920 0.572 0.428 0.000
#> SRR1304049     1  0.6215     0.0920 0.572 0.428 0.000
#> SRR1304050     3  0.0000     0.8410 0.000 0.000 1.000
#> SRR1304051     1  0.1289     0.8184 0.968 0.032 0.000
#> SRR1304052     1  0.0424     0.8309 0.992 0.008 0.000
#> SRR1304053     1  0.9760    -0.0974 0.420 0.236 0.344
#> SRR1304055     1  0.5859     0.3352 0.656 0.344 0.000
#> SRR1304054     2  0.4974     0.7358 0.236 0.764 0.000
#> SRR1304056     1  0.0237     0.8336 0.996 0.004 0.000
#> SRR1304059     1  0.5138     0.5244 0.748 0.252 0.000
#> SRR1304057     3  0.5016     0.5387 0.000 0.240 0.760
#> SRR1304058     1  0.0000     0.8345 1.000 0.000 0.000
#> SRR1304060     3  0.1163     0.8413 0.000 0.028 0.972
#> SRR1304061     1  0.0237     0.8336 0.996 0.004 0.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> SRR1303990     1  0.3810      0.768 0.804 0.008 0.000 0.188
#> SRR1303991     1  0.3810      0.768 0.804 0.008 0.000 0.188
#> SRR1303992     3  0.0000      0.995 0.000 0.000 1.000 0.000
#> SRR1303993     3  0.0000      0.995 0.000 0.000 1.000 0.000
#> SRR1303994     3  0.0000      0.995 0.000 0.000 1.000 0.000
#> SRR1303995     3  0.0000      0.995 0.000 0.000 1.000 0.000
#> SRR1303996     3  0.0000      0.995 0.000 0.000 1.000 0.000
#> SRR1303997     3  0.0000      0.995 0.000 0.000 1.000 0.000
#> SRR1303998     3  0.0000      0.995 0.000 0.000 1.000 0.000
#> SRR1303999     3  0.0000      0.995 0.000 0.000 1.000 0.000
#> SRR1304000     3  0.0000      0.995 0.000 0.000 1.000 0.000
#> SRR1304001     3  0.0000      0.995 0.000 0.000 1.000 0.000
#> SRR1304004     1  0.0817      0.964 0.976 0.000 0.024 0.000
#> SRR1304005     1  0.0817      0.964 0.976 0.000 0.024 0.000
#> SRR1304002     3  0.0000      0.995 0.000 0.000 1.000 0.000
#> SRR1304003     3  0.0000      0.995 0.000 0.000 1.000 0.000
#> SRR1304006     3  0.0336      0.989 0.008 0.000 0.992 0.000
#> SRR1304007     3  0.0336      0.989 0.008 0.000 0.992 0.000
#> SRR1304008     1  0.0921      0.961 0.972 0.000 0.028 0.000
#> SRR1304009     1  0.0921      0.961 0.972 0.000 0.028 0.000
#> SRR1304010     4  0.2528      0.897 0.080 0.004 0.008 0.908
#> SRR1304011     4  0.2597      0.894 0.084 0.004 0.008 0.904
#> SRR1304012     1  0.0817      0.964 0.976 0.000 0.024 0.000
#> SRR1304013     1  0.0817      0.964 0.976 0.000 0.024 0.000
#> SRR1304014     1  0.0817      0.964 0.976 0.000 0.024 0.000
#> SRR1304015     1  0.0817      0.964 0.976 0.000 0.024 0.000
#> SRR1304016     4  0.3401      0.816 0.152 0.008 0.000 0.840
#> SRR1304017     4  0.0000      0.950 0.000 0.000 0.000 1.000
#> SRR1304018     4  0.0000      0.950 0.000 0.000 0.000 1.000
#> SRR1304019     1  0.0817      0.964 0.976 0.000 0.024 0.000
#> SRR1304020     1  0.0817      0.964 0.976 0.000 0.024 0.000
#> SRR1304021     1  0.0817      0.964 0.976 0.000 0.024 0.000
#> SRR1304022     4  0.0000      0.950 0.000 0.000 0.000 1.000
#> SRR1304024     4  0.0000      0.950 0.000 0.000 0.000 1.000
#> SRR1304023     4  0.0000      0.950 0.000 0.000 0.000 1.000
#> SRR1304026     4  0.0000      0.950 0.000 0.000 0.000 1.000
#> SRR1304027     4  0.0000      0.950 0.000 0.000 0.000 1.000
#> SRR1304025     4  0.1743      0.924 0.004 0.056 0.000 0.940
#> SRR1304028     2  0.0336      0.968 0.000 0.992 0.008 0.000
#> SRR1304029     2  0.0336      0.968 0.000 0.992 0.008 0.000
#> SRR1304030     1  0.0469      0.952 0.988 0.012 0.000 0.000
#> SRR1304031     1  0.0469      0.952 0.988 0.012 0.000 0.000
#> SRR1304032     2  0.1118      0.965 0.000 0.964 0.000 0.036
#> SRR1304033     2  0.1118      0.965 0.000 0.964 0.000 0.036
#> SRR1304034     2  0.1211      0.963 0.000 0.960 0.000 0.040
#> SRR1304035     2  0.1211      0.963 0.000 0.960 0.000 0.040
#> SRR1304036     2  0.1792      0.925 0.000 0.932 0.068 0.000
#> SRR1304037     2  0.1792      0.925 0.000 0.932 0.068 0.000
#> SRR1304038     3  0.0895      0.974 0.004 0.020 0.976 0.000
#> SRR1304039     3  0.0895      0.974 0.004 0.020 0.976 0.000
#> SRR1304040     4  0.0000      0.950 0.000 0.000 0.000 1.000
#> SRR1304041     4  0.0000      0.950 0.000 0.000 0.000 1.000
#> SRR1304042     4  0.0000      0.950 0.000 0.000 0.000 1.000
#> SRR1304043     4  0.0000      0.950 0.000 0.000 0.000 1.000
#> SRR1304046     1  0.0524      0.954 0.988 0.008 0.004 0.000
#> SRR1304047     1  0.0524      0.954 0.988 0.008 0.004 0.000
#> SRR1304044     2  0.0336      0.970 0.000 0.992 0.000 0.008
#> SRR1304045     2  0.0336      0.970 0.000 0.992 0.000 0.008
#> SRR1304048     4  0.3626      0.803 0.004 0.184 0.000 0.812
#> SRR1304049     4  0.3626      0.803 0.004 0.184 0.000 0.812
#> SRR1304050     3  0.0000      0.995 0.000 0.000 1.000 0.000
#> SRR1304051     4  0.1356      0.933 0.032 0.008 0.000 0.960
#> SRR1304052     4  0.1824      0.923 0.004 0.060 0.000 0.936
#> SRR1304053     1  0.0188      0.956 0.996 0.000 0.004 0.000
#> SRR1304055     4  0.1824      0.922 0.004 0.060 0.000 0.936
#> SRR1304054     2  0.0336      0.970 0.000 0.992 0.000 0.008
#> SRR1304056     4  0.1042      0.939 0.020 0.008 0.000 0.972
#> SRR1304059     4  0.2888      0.880 0.004 0.124 0.000 0.872
#> SRR1304057     3  0.0336      0.989 0.000 0.008 0.992 0.000
#> SRR1304058     4  0.0000      0.950 0.000 0.000 0.000 1.000
#> SRR1304060     3  0.0336      0.989 0.008 0.000 0.992 0.000
#> SRR1304061     4  0.1042      0.939 0.020 0.008 0.000 0.972

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>            class entropy silhouette    p1    p2    p3    p4    p5
#> SRR1303990     5  0.6817    -0.1256 0.332 0.000 0.000 0.312 0.356
#> SRR1303991     5  0.6817    -0.1256 0.332 0.000 0.000 0.312 0.356
#> SRR1303992     3  0.0000     0.9034 0.000 0.000 1.000 0.000 0.000
#> SRR1303993     3  0.0000     0.9034 0.000 0.000 1.000 0.000 0.000
#> SRR1303994     3  0.0000     0.9034 0.000 0.000 1.000 0.000 0.000
#> SRR1303995     3  0.0000     0.9034 0.000 0.000 1.000 0.000 0.000
#> SRR1303996     3  0.0000     0.9034 0.000 0.000 1.000 0.000 0.000
#> SRR1303997     3  0.0000     0.9034 0.000 0.000 1.000 0.000 0.000
#> SRR1303998     3  0.0000     0.9034 0.000 0.000 1.000 0.000 0.000
#> SRR1303999     3  0.0000     0.9034 0.000 0.000 1.000 0.000 0.000
#> SRR1304000     3  0.0000     0.9034 0.000 0.000 1.000 0.000 0.000
#> SRR1304001     3  0.0000     0.9034 0.000 0.000 1.000 0.000 0.000
#> SRR1304004     5  0.0404     0.8337 0.000 0.000 0.012 0.000 0.988
#> SRR1304005     5  0.0404     0.8337 0.000 0.000 0.012 0.000 0.988
#> SRR1304002     3  0.0000     0.9034 0.000 0.000 1.000 0.000 0.000
#> SRR1304003     3  0.0000     0.9034 0.000 0.000 1.000 0.000 0.000
#> SRR1304006     3  0.4030     0.5799 0.352 0.000 0.648 0.000 0.000
#> SRR1304007     3  0.4030     0.5799 0.352 0.000 0.648 0.000 0.000
#> SRR1304008     5  0.0404     0.8337 0.000 0.000 0.012 0.000 0.988
#> SRR1304009     5  0.0404     0.8337 0.000 0.000 0.012 0.000 0.988
#> SRR1304010     1  0.6483     0.0580 0.452 0.000 0.000 0.356 0.192
#> SRR1304011     1  0.6483     0.0580 0.452 0.000 0.000 0.356 0.192
#> SRR1304012     5  0.0290     0.8352 0.000 0.000 0.008 0.000 0.992
#> SRR1304013     5  0.0290     0.8352 0.000 0.000 0.008 0.000 0.992
#> SRR1304014     5  0.0290     0.8352 0.000 0.000 0.008 0.000 0.992
#> SRR1304015     5  0.0290     0.8352 0.000 0.000 0.008 0.000 0.992
#> SRR1304016     1  0.5044     0.2752 0.556 0.000 0.000 0.408 0.036
#> SRR1304017     4  0.0000     0.8331 0.000 0.000 0.000 1.000 0.000
#> SRR1304018     4  0.0000     0.8331 0.000 0.000 0.000 1.000 0.000
#> SRR1304019     5  0.0290     0.8352 0.000 0.000 0.008 0.000 0.992
#> SRR1304020     5  0.0290     0.8352 0.000 0.000 0.008 0.000 0.992
#> SRR1304021     5  0.0290     0.8352 0.000 0.000 0.008 0.000 0.992
#> SRR1304022     4  0.0000     0.8331 0.000 0.000 0.000 1.000 0.000
#> SRR1304024     4  0.0000     0.8331 0.000 0.000 0.000 1.000 0.000
#> SRR1304023     4  0.1608     0.7587 0.072 0.000 0.000 0.928 0.000
#> SRR1304026     4  0.0000     0.8331 0.000 0.000 0.000 1.000 0.000
#> SRR1304027     4  0.0000     0.8331 0.000 0.000 0.000 1.000 0.000
#> SRR1304025     4  0.3727     0.6064 0.216 0.016 0.000 0.768 0.000
#> SRR1304028     2  0.0404     0.9425 0.012 0.988 0.000 0.000 0.000
#> SRR1304029     2  0.0404     0.9425 0.012 0.988 0.000 0.000 0.000
#> SRR1304030     1  0.4304    -0.1072 0.516 0.000 0.000 0.000 0.484
#> SRR1304031     1  0.4304    -0.1072 0.516 0.000 0.000 0.000 0.484
#> SRR1304032     2  0.1851     0.9128 0.000 0.912 0.000 0.088 0.000
#> SRR1304033     2  0.1851     0.9128 0.000 0.912 0.000 0.088 0.000
#> SRR1304034     2  0.1851     0.9128 0.000 0.912 0.000 0.088 0.000
#> SRR1304035     2  0.1851     0.9128 0.000 0.912 0.000 0.088 0.000
#> SRR1304036     2  0.1012     0.9309 0.012 0.968 0.020 0.000 0.000
#> SRR1304037     2  0.1012     0.9309 0.012 0.968 0.020 0.000 0.000
#> SRR1304038     3  0.2583     0.8003 0.132 0.004 0.864 0.000 0.000
#> SRR1304039     3  0.2583     0.8003 0.132 0.004 0.864 0.000 0.000
#> SRR1304040     4  0.0000     0.8331 0.000 0.000 0.000 1.000 0.000
#> SRR1304041     4  0.0000     0.8331 0.000 0.000 0.000 1.000 0.000
#> SRR1304042     4  0.0000     0.8331 0.000 0.000 0.000 1.000 0.000
#> SRR1304043     4  0.0000     0.8331 0.000 0.000 0.000 1.000 0.000
#> SRR1304046     5  0.3480     0.5906 0.248 0.000 0.000 0.000 0.752
#> SRR1304047     5  0.3480     0.5906 0.248 0.000 0.000 0.000 0.752
#> SRR1304044     2  0.0000     0.9446 0.000 1.000 0.000 0.000 0.000
#> SRR1304045     2  0.0000     0.9446 0.000 1.000 0.000 0.000 0.000
#> SRR1304048     4  0.5525     0.4232 0.288 0.100 0.000 0.612 0.000
#> SRR1304049     4  0.5525     0.4232 0.288 0.100 0.000 0.612 0.000
#> SRR1304050     3  0.0000     0.9034 0.000 0.000 1.000 0.000 0.000
#> SRR1304051     1  0.4252     0.3440 0.652 0.000 0.000 0.340 0.008
#> SRR1304052     1  0.4761     0.1036 0.616 0.028 0.000 0.356 0.000
#> SRR1304053     1  0.4249     0.0700 0.568 0.000 0.000 0.000 0.432
#> SRR1304055     4  0.4380     0.5345 0.260 0.032 0.000 0.708 0.000
#> SRR1304054     2  0.0000     0.9446 0.000 1.000 0.000 0.000 0.000
#> SRR1304056     1  0.4425     0.2992 0.600 0.000 0.000 0.392 0.008
#> SRR1304059     1  0.4989     0.1982 0.648 0.056 0.000 0.296 0.000
#> SRR1304057     3  0.3636     0.6769 0.272 0.000 0.728 0.000 0.000
#> SRR1304058     4  0.0000     0.8331 0.000 0.000 0.000 1.000 0.000
#> SRR1304060     3  0.4030     0.5799 0.352 0.000 0.648 0.000 0.000
#> SRR1304061     4  0.4249    -0.0855 0.432 0.000 0.000 0.568 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
#> SRR1303990     6  0.6994      0.411 0.164 0.000 0.000 0.136 0.220 0.480
#> SRR1303991     6  0.6994      0.411 0.164 0.000 0.000 0.136 0.220 0.480
#> SRR1303992     3  0.0000      0.853 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1303993     3  0.0000      0.853 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1303994     3  0.0000      0.853 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1303995     3  0.0000      0.853 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1303996     3  0.0000      0.853 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1303997     3  0.0000      0.853 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1303998     3  0.0000      0.853 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1303999     3  0.0000      0.853 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1304000     3  0.0000      0.853 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1304001     3  0.0000      0.853 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1304004     5  0.0363      0.895 0.000 0.000 0.012 0.000 0.988 0.000
#> SRR1304005     5  0.0363      0.895 0.000 0.000 0.012 0.000 0.988 0.000
#> SRR1304002     3  0.0000      0.853 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1304003     3  0.0000      0.853 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1304006     3  0.5468      0.299 0.128 0.000 0.492 0.000 0.000 0.380
#> SRR1304007     3  0.5468      0.299 0.128 0.000 0.492 0.000 0.000 0.380
#> SRR1304008     5  0.0363      0.895 0.000 0.000 0.012 0.000 0.988 0.000
#> SRR1304009     5  0.0363      0.895 0.000 0.000 0.012 0.000 0.988 0.000
#> SRR1304010     1  0.3957      0.541 0.804 0.000 0.000 0.068 0.056 0.072
#> SRR1304011     1  0.3957      0.541 0.804 0.000 0.000 0.068 0.056 0.072
#> SRR1304012     5  0.0146      0.898 0.004 0.000 0.000 0.000 0.996 0.000
#> SRR1304013     5  0.0146      0.898 0.004 0.000 0.000 0.000 0.996 0.000
#> SRR1304014     5  0.0146      0.898 0.004 0.000 0.000 0.000 0.996 0.000
#> SRR1304015     5  0.0000      0.899 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR1304016     6  0.3309      0.568 0.024 0.000 0.000 0.172 0.004 0.800
#> SRR1304017     4  0.0790      0.867 0.032 0.000 0.000 0.968 0.000 0.000
#> SRR1304018     4  0.0790      0.867 0.032 0.000 0.000 0.968 0.000 0.000
#> SRR1304019     5  0.0000      0.899 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR1304020     5  0.0000      0.899 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR1304021     5  0.0260      0.897 0.008 0.000 0.000 0.000 0.992 0.000
#> SRR1304022     4  0.0790      0.867 0.032 0.000 0.000 0.968 0.000 0.000
#> SRR1304024     4  0.0000      0.884 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR1304023     4  0.3695      0.622 0.164 0.000 0.000 0.776 0.000 0.060
#> SRR1304026     4  0.0000      0.884 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR1304027     4  0.0000      0.884 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR1304025     4  0.3927      0.214 0.344 0.012 0.000 0.644 0.000 0.000
#> SRR1304028     2  0.0363      0.910 0.000 0.988 0.000 0.000 0.000 0.012
#> SRR1304029     2  0.0363      0.910 0.000 0.988 0.000 0.000 0.000 0.012
#> SRR1304030     6  0.2300      0.577 0.000 0.000 0.000 0.000 0.144 0.856
#> SRR1304031     6  0.2300      0.577 0.000 0.000 0.000 0.000 0.144 0.856
#> SRR1304032     2  0.2868      0.845 0.028 0.840 0.000 0.132 0.000 0.000
#> SRR1304033     2  0.2868      0.845 0.028 0.840 0.000 0.132 0.000 0.000
#> SRR1304034     2  0.2831      0.844 0.024 0.840 0.000 0.136 0.000 0.000
#> SRR1304035     2  0.2831      0.844 0.024 0.840 0.000 0.136 0.000 0.000
#> SRR1304036     2  0.0363      0.910 0.000 0.988 0.000 0.000 0.000 0.012
#> SRR1304037     2  0.0363      0.910 0.000 0.988 0.000 0.000 0.000 0.012
#> SRR1304038     3  0.3446      0.552 0.308 0.000 0.692 0.000 0.000 0.000
#> SRR1304039     3  0.3446      0.552 0.308 0.000 0.692 0.000 0.000 0.000
#> SRR1304040     4  0.0000      0.884 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR1304041     4  0.0000      0.884 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR1304042     4  0.0000      0.884 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR1304043     4  0.0000      0.884 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR1304046     5  0.3862      0.161 0.000 0.000 0.000 0.000 0.524 0.476
#> SRR1304047     5  0.3862      0.161 0.000 0.000 0.000 0.000 0.524 0.476
#> SRR1304044     2  0.0260      0.912 0.008 0.992 0.000 0.000 0.000 0.000
#> SRR1304045     2  0.0260      0.912 0.008 0.992 0.000 0.000 0.000 0.000
#> SRR1304048     1  0.4388      0.448 0.572 0.028 0.000 0.400 0.000 0.000
#> SRR1304049     1  0.4388      0.448 0.572 0.028 0.000 0.400 0.000 0.000
#> SRR1304050     3  0.0363      0.846 0.000 0.000 0.988 0.000 0.012 0.000
#> SRR1304051     6  0.4503      0.490 0.232 0.000 0.000 0.084 0.000 0.684
#> SRR1304052     1  0.4974      0.553 0.672 0.008 0.000 0.172 0.000 0.148
#> SRR1304053     6  0.5150      0.434 0.220 0.000 0.000 0.000 0.160 0.620
#> SRR1304055     4  0.4200      0.019 0.392 0.012 0.000 0.592 0.000 0.004
#> SRR1304054     2  0.0260      0.912 0.008 0.992 0.000 0.000 0.000 0.000
#> SRR1304056     6  0.5126      0.465 0.160 0.000 0.000 0.216 0.000 0.624
#> SRR1304059     1  0.4969      0.512 0.692 0.024 0.000 0.108 0.000 0.176
#> SRR1304057     3  0.4664      0.564 0.056 0.012 0.668 0.000 0.000 0.264
#> SRR1304058     4  0.0000      0.884 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR1304060     3  0.5515      0.299 0.136 0.000 0.492 0.000 0.000 0.372
#> SRR1304061     6  0.5228      0.306 0.100 0.000 0.000 0.376 0.000 0.524

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

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

collect_plots(res)

plot of chunk ATC-pam-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.586           0.811       0.886          0.234 0.778   0.778
#> 3 3 1.000           1.000       1.000          0.837 0.793   0.734
#> 4 4 0.951           0.905       0.952          0.463 0.797   0.644
#> 5 5 0.795           0.812       0.909          0.172 0.838   0.577
#> 6 6 0.957           0.922       0.974          0.065 0.962   0.844

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

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

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

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

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

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>            class entropy silhouette    p1    p2
#> SRR1303990     1   0.000      0.877 1.000 0.000
#> SRR1303991     1   0.000      0.877 1.000 0.000
#> SRR1303992     1   0.983      0.317 0.576 0.424
#> SRR1303993     1   0.983      0.317 0.576 0.424
#> SRR1303994     1   0.983      0.317 0.576 0.424
#> SRR1303995     1   0.983      0.317 0.576 0.424
#> SRR1303996     1   0.983      0.317 0.576 0.424
#> SRR1303997     1   0.983      0.317 0.576 0.424
#> SRR1303998     1   0.983      0.317 0.576 0.424
#> SRR1303999     1   0.983      0.317 0.576 0.424
#> SRR1304000     1   0.983      0.317 0.576 0.424
#> SRR1304001     1   0.983      0.317 0.576 0.424
#> SRR1304004     1   0.000      0.877 1.000 0.000
#> SRR1304005     1   0.000      0.877 1.000 0.000
#> SRR1304002     1   0.000      0.877 1.000 0.000
#> SRR1304003     1   0.000      0.877 1.000 0.000
#> SRR1304006     1   0.000      0.877 1.000 0.000
#> SRR1304007     1   0.000      0.877 1.000 0.000
#> SRR1304008     1   0.000      0.877 1.000 0.000
#> SRR1304009     1   0.000      0.877 1.000 0.000
#> SRR1304010     1   0.000      0.877 1.000 0.000
#> SRR1304011     1   0.000      0.877 1.000 0.000
#> SRR1304012     1   0.000      0.877 1.000 0.000
#> SRR1304013     1   0.000      0.877 1.000 0.000
#> SRR1304014     1   0.000      0.877 1.000 0.000
#> SRR1304015     1   0.000      0.877 1.000 0.000
#> SRR1304016     1   0.000      0.877 1.000 0.000
#> SRR1304017     1   0.000      0.877 1.000 0.000
#> SRR1304018     1   0.000      0.877 1.000 0.000
#> SRR1304019     1   0.000      0.877 1.000 0.000
#> SRR1304020     1   0.000      0.877 1.000 0.000
#> SRR1304021     1   0.000      0.877 1.000 0.000
#> SRR1304022     2   0.983      1.000 0.424 0.576
#> SRR1304024     2   0.983      1.000 0.424 0.576
#> SRR1304023     1   0.541      0.632 0.876 0.124
#> SRR1304026     2   0.983      1.000 0.424 0.576
#> SRR1304027     2   0.983      1.000 0.424 0.576
#> SRR1304025     1   0.000      0.877 1.000 0.000
#> SRR1304028     1   0.000      0.877 1.000 0.000
#> SRR1304029     1   0.000      0.877 1.000 0.000
#> SRR1304030     1   0.000      0.877 1.000 0.000
#> SRR1304031     1   0.000      0.877 1.000 0.000
#> SRR1304032     1   0.000      0.877 1.000 0.000
#> SRR1304033     1   0.000      0.877 1.000 0.000
#> SRR1304034     1   0.000      0.877 1.000 0.000
#> SRR1304035     1   0.000      0.877 1.000 0.000
#> SRR1304036     1   0.000      0.877 1.000 0.000
#> SRR1304037     1   0.000      0.877 1.000 0.000
#> SRR1304038     1   0.000      0.877 1.000 0.000
#> SRR1304039     1   0.000      0.877 1.000 0.000
#> SRR1304040     2   0.983      1.000 0.424 0.576
#> SRR1304041     2   0.983      1.000 0.424 0.576
#> SRR1304042     2   0.983      1.000 0.424 0.576
#> SRR1304043     2   0.983      1.000 0.424 0.576
#> SRR1304046     1   0.000      0.877 1.000 0.000
#> SRR1304047     1   0.000      0.877 1.000 0.000
#> SRR1304044     1   0.000      0.877 1.000 0.000
#> SRR1304045     1   0.000      0.877 1.000 0.000
#> SRR1304048     1   0.000      0.877 1.000 0.000
#> SRR1304049     1   0.000      0.877 1.000 0.000
#> SRR1304050     1   0.000      0.877 1.000 0.000
#> SRR1304051     1   0.000      0.877 1.000 0.000
#> SRR1304052     1   0.000      0.877 1.000 0.000
#> SRR1304053     1   0.000      0.877 1.000 0.000
#> SRR1304055     1   0.000      0.877 1.000 0.000
#> SRR1304054     1   0.000      0.877 1.000 0.000
#> SRR1304056     1   0.000      0.877 1.000 0.000
#> SRR1304059     1   0.000      0.877 1.000 0.000
#> SRR1304057     1   0.000      0.877 1.000 0.000
#> SRR1304058     2   0.983      1.000 0.424 0.576
#> SRR1304060     1   0.000      0.877 1.000 0.000
#> SRR1304061     1   0.000      0.877 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
#> SRR1303990     1       0          1  1  0  0
#> SRR1303991     1       0          1  1  0  0
#> SRR1303992     3       0          1  0  0  1
#> SRR1303993     3       0          1  0  0  1
#> SRR1303994     3       0          1  0  0  1
#> SRR1303995     3       0          1  0  0  1
#> SRR1303996     3       0          1  0  0  1
#> SRR1303997     3       0          1  0  0  1
#> SRR1303998     3       0          1  0  0  1
#> SRR1303999     3       0          1  0  0  1
#> SRR1304000     3       0          1  0  0  1
#> SRR1304001     3       0          1  0  0  1
#> SRR1304004     1       0          1  1  0  0
#> SRR1304005     1       0          1  1  0  0
#> SRR1304002     1       0          1  1  0  0
#> SRR1304003     1       0          1  1  0  0
#> SRR1304006     1       0          1  1  0  0
#> SRR1304007     1       0          1  1  0  0
#> SRR1304008     1       0          1  1  0  0
#> SRR1304009     1       0          1  1  0  0
#> SRR1304010     1       0          1  1  0  0
#> SRR1304011     1       0          1  1  0  0
#> SRR1304012     1       0          1  1  0  0
#> SRR1304013     1       0          1  1  0  0
#> SRR1304014     1       0          1  1  0  0
#> SRR1304015     1       0          1  1  0  0
#> SRR1304016     1       0          1  1  0  0
#> SRR1304017     1       0          1  1  0  0
#> SRR1304018     1       0          1  1  0  0
#> SRR1304019     1       0          1  1  0  0
#> SRR1304020     1       0          1  1  0  0
#> SRR1304021     1       0          1  1  0  0
#> SRR1304022     2       0          1  0  1  0
#> SRR1304024     2       0          1  0  1  0
#> SRR1304023     1       0          1  1  0  0
#> SRR1304026     2       0          1  0  1  0
#> SRR1304027     2       0          1  0  1  0
#> SRR1304025     1       0          1  1  0  0
#> SRR1304028     1       0          1  1  0  0
#> SRR1304029     1       0          1  1  0  0
#> SRR1304030     1       0          1  1  0  0
#> SRR1304031     1       0          1  1  0  0
#> SRR1304032     1       0          1  1  0  0
#> SRR1304033     1       0          1  1  0  0
#> SRR1304034     1       0          1  1  0  0
#> SRR1304035     1       0          1  1  0  0
#> SRR1304036     1       0          1  1  0  0
#> SRR1304037     1       0          1  1  0  0
#> SRR1304038     1       0          1  1  0  0
#> SRR1304039     1       0          1  1  0  0
#> SRR1304040     2       0          1  0  1  0
#> SRR1304041     2       0          1  0  1  0
#> SRR1304042     2       0          1  0  1  0
#> SRR1304043     2       0          1  0  1  0
#> SRR1304046     1       0          1  1  0  0
#> SRR1304047     1       0          1  1  0  0
#> SRR1304044     1       0          1  1  0  0
#> SRR1304045     1       0          1  1  0  0
#> SRR1304048     1       0          1  1  0  0
#> SRR1304049     1       0          1  1  0  0
#> SRR1304050     1       0          1  1  0  0
#> SRR1304051     1       0          1  1  0  0
#> SRR1304052     1       0          1  1  0  0
#> SRR1304053     1       0          1  1  0  0
#> SRR1304055     1       0          1  1  0  0
#> SRR1304054     1       0          1  1  0  0
#> SRR1304056     1       0          1  1  0  0
#> SRR1304059     1       0          1  1  0  0
#> SRR1304057     1       0          1  1  0  0
#> SRR1304058     2       0          1  0  1  0
#> SRR1304060     1       0          1  1  0  0
#> SRR1304061     1       0          1  1  0  0

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2 p3 p4
#> SRR1303990     1  0.1792     0.9415 0.932 0.068  0  0
#> SRR1303991     1  0.1792     0.9415 0.932 0.068  0  0
#> SRR1303992     3  0.0000     1.0000 0.000 0.000  1  0
#> SRR1303993     3  0.0000     1.0000 0.000 0.000  1  0
#> SRR1303994     3  0.0000     1.0000 0.000 0.000  1  0
#> SRR1303995     3  0.0000     1.0000 0.000 0.000  1  0
#> SRR1303996     3  0.0000     1.0000 0.000 0.000  1  0
#> SRR1303997     3  0.0000     1.0000 0.000 0.000  1  0
#> SRR1303998     3  0.0000     1.0000 0.000 0.000  1  0
#> SRR1303999     3  0.0000     1.0000 0.000 0.000  1  0
#> SRR1304000     3  0.0000     1.0000 0.000 0.000  1  0
#> SRR1304001     3  0.0000     1.0000 0.000 0.000  1  0
#> SRR1304004     1  0.0336     0.9433 0.992 0.008  0  0
#> SRR1304005     1  0.0336     0.9433 0.992 0.008  0  0
#> SRR1304002     1  0.0336     0.9433 0.992 0.008  0  0
#> SRR1304003     1  0.0336     0.9433 0.992 0.008  0  0
#> SRR1304006     1  0.1302     0.9505 0.956 0.044  0  0
#> SRR1304007     1  0.0469     0.9466 0.988 0.012  0  0
#> SRR1304008     1  0.0336     0.9433 0.992 0.008  0  0
#> SRR1304009     1  0.0336     0.9433 0.992 0.008  0  0
#> SRR1304010     1  0.1302     0.9505 0.956 0.044  0  0
#> SRR1304011     1  0.1302     0.9505 0.956 0.044  0  0
#> SRR1304012     1  0.0336     0.9433 0.992 0.008  0  0
#> SRR1304013     1  0.0336     0.9433 0.992 0.008  0  0
#> SRR1304014     1  0.1302     0.9505 0.956 0.044  0  0
#> SRR1304015     1  0.0336     0.9433 0.992 0.008  0  0
#> SRR1304016     1  0.1792     0.9415 0.932 0.068  0  0
#> SRR1304017     1  0.2081     0.9304 0.916 0.084  0  0
#> SRR1304018     1  0.1792     0.9415 0.932 0.068  0  0
#> SRR1304019     1  0.0336     0.9433 0.992 0.008  0  0
#> SRR1304020     1  0.0336     0.9433 0.992 0.008  0  0
#> SRR1304021     1  0.0921     0.9515 0.972 0.028  0  0
#> SRR1304022     4  0.0000     1.0000 0.000 0.000  0  1
#> SRR1304024     4  0.0000     1.0000 0.000 0.000  0  1
#> SRR1304023     1  0.1792     0.9415 0.932 0.068  0  0
#> SRR1304026     4  0.0000     1.0000 0.000 0.000  0  1
#> SRR1304027     4  0.0000     1.0000 0.000 0.000  0  1
#> SRR1304025     1  0.4967     0.1550 0.548 0.452  0  0
#> SRR1304028     2  0.1022     0.8483 0.032 0.968  0  0
#> SRR1304029     2  0.1022     0.8483 0.032 0.968  0  0
#> SRR1304030     1  0.0921     0.9515 0.972 0.028  0  0
#> SRR1304031     1  0.0921     0.9515 0.972 0.028  0  0
#> SRR1304032     2  0.0336     0.8374 0.008 0.992  0  0
#> SRR1304033     2  0.0336     0.8374 0.008 0.992  0  0
#> SRR1304034     2  0.0336     0.8374 0.008 0.992  0  0
#> SRR1304035     2  0.0336     0.8374 0.008 0.992  0  0
#> SRR1304036     2  0.2589     0.7870 0.116 0.884  0  0
#> SRR1304037     2  0.2647     0.7848 0.120 0.880  0  0
#> SRR1304038     1  0.1302     0.9505 0.956 0.044  0  0
#> SRR1304039     1  0.1302     0.9505 0.956 0.044  0  0
#> SRR1304040     4  0.0000     1.0000 0.000 0.000  0  1
#> SRR1304041     4  0.0000     1.0000 0.000 0.000  0  1
#> SRR1304042     4  0.0000     1.0000 0.000 0.000  0  1
#> SRR1304043     4  0.0000     1.0000 0.000 0.000  0  1
#> SRR1304046     1  0.0921     0.9515 0.972 0.028  0  0
#> SRR1304047     1  0.0921     0.9515 0.972 0.028  0  0
#> SRR1304044     2  0.1022     0.8483 0.032 0.968  0  0
#> SRR1304045     2  0.1022     0.8483 0.032 0.968  0  0
#> SRR1304048     2  0.4972     0.1706 0.456 0.544  0  0
#> SRR1304049     2  0.4992     0.0977 0.476 0.524  0  0
#> SRR1304050     1  0.0336     0.9433 0.992 0.008  0  0
#> SRR1304051     1  0.1302     0.9505 0.956 0.044  0  0
#> SRR1304052     1  0.1792     0.9362 0.932 0.068  0  0
#> SRR1304053     1  0.1302     0.9505 0.956 0.044  0  0
#> SRR1304055     1  0.4040     0.6835 0.752 0.248  0  0
#> SRR1304054     2  0.1022     0.8483 0.032 0.968  0  0
#> SRR1304056     1  0.1302     0.9505 0.956 0.044  0  0
#> SRR1304059     1  0.2345     0.9046 0.900 0.100  0  0
#> SRR1304057     1  0.1302     0.9505 0.956 0.044  0  0
#> SRR1304058     4  0.0000     1.0000 0.000 0.000  0  1
#> SRR1304060     1  0.0336     0.9433 0.992 0.008  0  0
#> SRR1304061     1  0.1389     0.9491 0.952 0.048  0  0

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>            class entropy silhouette    p1    p2 p3 p4    p5
#> SRR1303990     5  0.4622     0.2651 0.440 0.012  0  0 0.548
#> SRR1303991     5  0.4622     0.2651 0.440 0.012  0  0 0.548
#> SRR1303992     3  0.0000     1.0000 0.000 0.000  1  0 0.000
#> SRR1303993     3  0.0000     1.0000 0.000 0.000  1  0 0.000
#> SRR1303994     3  0.0000     1.0000 0.000 0.000  1  0 0.000
#> SRR1303995     3  0.0000     1.0000 0.000 0.000  1  0 0.000
#> SRR1303996     3  0.0000     1.0000 0.000 0.000  1  0 0.000
#> SRR1303997     3  0.0000     1.0000 0.000 0.000  1  0 0.000
#> SRR1303998     3  0.0000     1.0000 0.000 0.000  1  0 0.000
#> SRR1303999     3  0.0000     1.0000 0.000 0.000  1  0 0.000
#> SRR1304000     3  0.0000     1.0000 0.000 0.000  1  0 0.000
#> SRR1304001     3  0.0000     1.0000 0.000 0.000  1  0 0.000
#> SRR1304004     5  0.3336     0.8202 0.228 0.000  0  0 0.772
#> SRR1304005     5  0.3336     0.8202 0.228 0.000  0  0 0.772
#> SRR1304002     1  0.4278    -0.1406 0.548 0.000  0  0 0.452
#> SRR1304003     1  0.4278    -0.1406 0.548 0.000  0  0 0.452
#> SRR1304006     1  0.0000     0.8989 1.000 0.000  0  0 0.000
#> SRR1304007     1  0.0963     0.8739 0.964 0.000  0  0 0.036
#> SRR1304008     5  0.3336     0.8202 0.228 0.000  0  0 0.772
#> SRR1304009     5  0.3336     0.8202 0.228 0.000  0  0 0.772
#> SRR1304010     1  0.0000     0.8989 1.000 0.000  0  0 0.000
#> SRR1304011     1  0.0000     0.8989 1.000 0.000  0  0 0.000
#> SRR1304012     5  0.3336     0.8202 0.228 0.000  0  0 0.772
#> SRR1304013     5  0.3336     0.8202 0.228 0.000  0  0 0.772
#> SRR1304014     1  0.0000     0.8989 1.000 0.000  0  0 0.000
#> SRR1304015     5  0.3336     0.8202 0.228 0.000  0  0 0.772
#> SRR1304016     1  0.0404     0.8920 0.988 0.012  0  0 0.000
#> SRR1304017     1  0.0963     0.8747 0.964 0.036  0  0 0.000
#> SRR1304018     1  0.0609     0.8863 0.980 0.020  0  0 0.000
#> SRR1304019     5  0.3336     0.8202 0.228 0.000  0  0 0.772
#> SRR1304020     5  0.3336     0.8202 0.228 0.000  0  0 0.772
#> SRR1304021     1  0.0162     0.8976 0.996 0.000  0  0 0.004
#> SRR1304022     4  0.0000     1.0000 0.000 0.000  0  1 0.000
#> SRR1304024     4  0.0000     1.0000 0.000 0.000  0  1 0.000
#> SRR1304023     5  0.4622     0.2651 0.440 0.012  0  0 0.548
#> SRR1304026     4  0.0000     1.0000 0.000 0.000  0  1 0.000
#> SRR1304027     4  0.0000     1.0000 0.000 0.000  0  1 0.000
#> SRR1304025     2  0.4300     0.1036 0.476 0.524  0  0 0.000
#> SRR1304028     2  0.0404     0.8603 0.012 0.988  0  0 0.000
#> SRR1304029     2  0.0404     0.8603 0.012 0.988  0  0 0.000
#> SRR1304030     1  0.0162     0.8976 0.996 0.000  0  0 0.004
#> SRR1304031     1  0.0162     0.8976 0.996 0.000  0  0 0.004
#> SRR1304032     2  0.0162     0.8576 0.004 0.996  0  0 0.000
#> SRR1304033     2  0.0162     0.8576 0.004 0.996  0  0 0.000
#> SRR1304034     2  0.0162     0.8576 0.004 0.996  0  0 0.000
#> SRR1304035     2  0.0162     0.8576 0.004 0.996  0  0 0.000
#> SRR1304036     2  0.2424     0.7685 0.132 0.868  0  0 0.000
#> SRR1304037     2  0.2424     0.7685 0.132 0.868  0  0 0.000
#> SRR1304038     1  0.0963     0.8757 0.964 0.036  0  0 0.000
#> SRR1304039     1  0.0963     0.8757 0.964 0.036  0  0 0.000
#> SRR1304040     4  0.0000     1.0000 0.000 0.000  0  1 0.000
#> SRR1304041     4  0.0000     1.0000 0.000 0.000  0  1 0.000
#> SRR1304042     4  0.0000     1.0000 0.000 0.000  0  1 0.000
#> SRR1304043     4  0.0000     1.0000 0.000 0.000  0  1 0.000
#> SRR1304046     1  0.0162     0.8976 0.996 0.000  0  0 0.004
#> SRR1304047     1  0.0162     0.8976 0.996 0.000  0  0 0.004
#> SRR1304044     2  0.0404     0.8603 0.012 0.988  0  0 0.000
#> SRR1304045     2  0.0404     0.8603 0.012 0.988  0  0 0.000
#> SRR1304048     2  0.4283     0.1647 0.456 0.544  0  0 0.000
#> SRR1304049     1  0.4305    -0.0609 0.512 0.488  0  0 0.000
#> SRR1304050     1  0.2471     0.7349 0.864 0.000  0  0 0.136
#> SRR1304051     1  0.0000     0.8989 1.000 0.000  0  0 0.000
#> SRR1304052     1  0.0000     0.8989 1.000 0.000  0  0 0.000
#> SRR1304053     1  0.0000     0.8989 1.000 0.000  0  0 0.000
#> SRR1304055     1  0.1478     0.8419 0.936 0.064  0  0 0.000
#> SRR1304054     2  0.0404     0.8603 0.012 0.988  0  0 0.000
#> SRR1304056     1  0.0000     0.8989 1.000 0.000  0  0 0.000
#> SRR1304059     1  0.0000     0.8989 1.000 0.000  0  0 0.000
#> SRR1304057     1  0.0794     0.8825 0.972 0.028  0  0 0.000
#> SRR1304058     4  0.0000     1.0000 0.000 0.000  0  1 0.000
#> SRR1304060     1  0.1043     0.8706 0.960 0.000  0  0 0.040
#> SRR1304061     1  0.0000     0.8989 1.000 0.000  0  0 0.000

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>            class entropy silhouette    p1    p2 p3 p4   p5 p6
#> SRR1303990     6  0.0000      1.000 0.000 0.000  0  0 0.00  1
#> SRR1303991     6  0.0000      1.000 0.000 0.000  0  0 0.00  1
#> SRR1303992     3  0.0000      1.000 0.000 0.000  1  0 0.00  0
#> SRR1303993     3  0.0000      1.000 0.000 0.000  1  0 0.00  0
#> SRR1303994     3  0.0000      1.000 0.000 0.000  1  0 0.00  0
#> SRR1303995     3  0.0000      1.000 0.000 0.000  1  0 0.00  0
#> SRR1303996     3  0.0000      1.000 0.000 0.000  1  0 0.00  0
#> SRR1303997     3  0.0000      1.000 0.000 0.000  1  0 0.00  0
#> SRR1303998     3  0.0000      1.000 0.000 0.000  1  0 0.00  0
#> SRR1303999     3  0.0000      1.000 0.000 0.000  1  0 0.00  0
#> SRR1304000     3  0.0000      1.000 0.000 0.000  1  0 0.00  0
#> SRR1304001     3  0.0000      1.000 0.000 0.000  1  0 0.00  0
#> SRR1304004     5  0.0000      1.000 0.000 0.000  0  0 1.00  0
#> SRR1304005     5  0.0000      1.000 0.000 0.000  0  0 1.00  0
#> SRR1304002     5  0.0000      1.000 0.000 0.000  0  0 1.00  0
#> SRR1304003     5  0.0000      1.000 0.000 0.000  0  0 1.00  0
#> SRR1304006     1  0.0000      0.967 1.000 0.000  0  0 0.00  0
#> SRR1304007     1  0.0000      0.967 1.000 0.000  0  0 0.00  0
#> SRR1304008     5  0.0000      1.000 0.000 0.000  0  0 1.00  0
#> SRR1304009     5  0.0000      1.000 0.000 0.000  0  0 1.00  0
#> SRR1304010     1  0.0000      0.967 1.000 0.000  0  0 0.00  0
#> SRR1304011     1  0.0000      0.967 1.000 0.000  0  0 0.00  0
#> SRR1304012     5  0.0000      1.000 0.000 0.000  0  0 1.00  0
#> SRR1304013     5  0.0000      1.000 0.000 0.000  0  0 1.00  0
#> SRR1304014     1  0.0000      0.967 1.000 0.000  0  0 0.00  0
#> SRR1304015     5  0.0000      1.000 0.000 0.000  0  0 1.00  0
#> SRR1304016     1  0.0000      0.967 1.000 0.000  0  0 0.00  0
#> SRR1304017     1  0.0547      0.948 0.980 0.020  0  0 0.00  0
#> SRR1304018     1  0.0000      0.967 1.000 0.000  0  0 0.00  0
#> SRR1304019     5  0.0000      1.000 0.000 0.000  0  0 1.00  0
#> SRR1304020     5  0.0000      1.000 0.000 0.000  0  0 1.00  0
#> SRR1304021     1  0.0000      0.967 1.000 0.000  0  0 0.00  0
#> SRR1304022     4  0.0000      1.000 0.000 0.000  0  1 0.00  0
#> SRR1304024     4  0.0000      1.000 0.000 0.000  0  1 0.00  0
#> SRR1304023     6  0.0000      1.000 0.000 0.000  0  0 0.00  1
#> SRR1304026     4  0.0000      1.000 0.000 0.000  0  1 0.00  0
#> SRR1304027     4  0.0000      1.000 0.000 0.000  0  1 0.00  0
#> SRR1304025     2  0.3810      0.277 0.428 0.572  0  0 0.00  0
#> SRR1304028     2  0.0000      0.847 0.000 1.000  0  0 0.00  0
#> SRR1304029     2  0.0000      0.847 0.000 1.000  0  0 0.00  0
#> SRR1304030     1  0.0000      0.967 1.000 0.000  0  0 0.00  0
#> SRR1304031     1  0.0000      0.967 1.000 0.000  0  0 0.00  0
#> SRR1304032     2  0.0000      0.847 0.000 1.000  0  0 0.00  0
#> SRR1304033     2  0.0000      0.847 0.000 1.000  0  0 0.00  0
#> SRR1304034     2  0.0000      0.847 0.000 1.000  0  0 0.00  0
#> SRR1304035     2  0.0000      0.847 0.000 1.000  0  0 0.00  0
#> SRR1304036     2  0.2135      0.733 0.128 0.872  0  0 0.00  0
#> SRR1304037     2  0.2135      0.733 0.128 0.872  0  0 0.00  0
#> SRR1304038     1  0.0000      0.967 1.000 0.000  0  0 0.00  0
#> SRR1304039     1  0.0000      0.967 1.000 0.000  0  0 0.00  0
#> SRR1304040     4  0.0000      1.000 0.000 0.000  0  1 0.00  0
#> SRR1304041     4  0.0000      1.000 0.000 0.000  0  1 0.00  0
#> SRR1304042     4  0.0000      1.000 0.000 0.000  0  1 0.00  0
#> SRR1304043     4  0.0000      1.000 0.000 0.000  0  1 0.00  0
#> SRR1304046     1  0.0000      0.967 1.000 0.000  0  0 0.00  0
#> SRR1304047     1  0.0000      0.967 1.000 0.000  0  0 0.00  0
#> SRR1304044     2  0.0000      0.847 0.000 1.000  0  0 0.00  0
#> SRR1304045     2  0.0000      0.847 0.000 1.000  0  0 0.00  0
#> SRR1304048     2  0.3828      0.242 0.440 0.560  0  0 0.00  0
#> SRR1304049     1  0.3869     -0.129 0.500 0.500  0  0 0.00  0
#> SRR1304050     1  0.2260      0.810 0.860 0.000  0  0 0.14  0
#> SRR1304051     1  0.0000      0.967 1.000 0.000  0  0 0.00  0
#> SRR1304052     1  0.0000      0.967 1.000 0.000  0  0 0.00  0
#> SRR1304053     1  0.0000      0.967 1.000 0.000  0  0 0.00  0
#> SRR1304055     1  0.1501      0.888 0.924 0.076  0  0 0.00  0
#> SRR1304054     2  0.0000      0.847 0.000 1.000  0  0 0.00  0
#> SRR1304056     1  0.0000      0.967 1.000 0.000  0  0 0.00  0
#> SRR1304059     1  0.0000      0.967 1.000 0.000  0  0 0.00  0
#> SRR1304057     1  0.0000      0.967 1.000 0.000  0  0 0.00  0
#> SRR1304058     4  0.0000      1.000 0.000 0.000  0  1 0.00  0
#> SRR1304060     1  0.0000      0.967 1.000 0.000  0  0 0.00  0
#> SRR1304061     1  0.0000      0.967 1.000 0.000  0  0 0.00  0

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

consensus_heatmap(res, k = 2)

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

consensus_heatmap(res, k = 3)

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

consensus_heatmap(res, k = 4)

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

consensus_heatmap(res, k = 5)

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

consensus_heatmap(res, k = 6)

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

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

membership_heatmap(res, k = 2)

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

membership_heatmap(res, k = 3)

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

membership_heatmap(res, k = 4)

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

membership_heatmap(res, k = 5)

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

membership_heatmap(res, k = 6)

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

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

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

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

get_signatures(res, k = 3)

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

get_signatures(res, k = 4)

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

get_signatures(res, k = 5)

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

get_signatures(res, k = 6)

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

Signature heatmaps where rows are not scaled:

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

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

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

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

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

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

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

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

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

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

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk ATC-pam-signature_compare

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

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

An example of the output of tb is:

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

The columns in tb are:

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

UMAP plot which shows how samples are separated.

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

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

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

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

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

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

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

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

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

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

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk ATC-pam-collect-classes

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

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

collect_plots(res)

plot of chunk ATC-mclust-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.718           0.896       0.945         0.4892 0.493   0.493
#> 3 3 0.292           0.837       0.846         0.0633 0.521   0.307
#> 4 4 0.616           0.664       0.732         0.2403 0.660   0.366
#> 5 5 0.808           0.873       0.917         0.1836 0.825   0.518
#> 6 6 1.000           0.976       0.991         0.0426 0.951   0.794

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

suggest_best_k(res)
#> [1] 6

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
#> SRR1303990     1   0.000     0.9606 1.000 0.000
#> SRR1303991     1   0.000     0.9606 1.000 0.000
#> SRR1303992     2   0.000     0.9143 0.000 1.000
#> SRR1303993     2   0.000     0.9143 0.000 1.000
#> SRR1303994     2   0.000     0.9143 0.000 1.000
#> SRR1303995     2   0.000     0.9143 0.000 1.000
#> SRR1303996     2   0.000     0.9143 0.000 1.000
#> SRR1303997     2   0.000     0.9143 0.000 1.000
#> SRR1303998     2   0.000     0.9143 0.000 1.000
#> SRR1303999     2   0.000     0.9143 0.000 1.000
#> SRR1304000     2   0.000     0.9143 0.000 1.000
#> SRR1304001     2   0.000     0.9143 0.000 1.000
#> SRR1304004     1   0.000     0.9606 1.000 0.000
#> SRR1304005     1   0.000     0.9606 1.000 0.000
#> SRR1304002     2   0.781     0.7889 0.232 0.768
#> SRR1304003     2   0.781     0.7889 0.232 0.768
#> SRR1304006     2   0.781     0.7889 0.232 0.768
#> SRR1304007     2   0.781     0.7889 0.232 0.768
#> SRR1304008     1   0.000     0.9606 1.000 0.000
#> SRR1304009     1   0.000     0.9606 1.000 0.000
#> SRR1304010     2   0.738     0.8134 0.208 0.792
#> SRR1304011     2   0.767     0.7975 0.224 0.776
#> SRR1304012     1   0.000     0.9606 1.000 0.000
#> SRR1304013     1   0.000     0.9606 1.000 0.000
#> SRR1304014     1   0.000     0.9606 1.000 0.000
#> SRR1304015     1   0.000     0.9606 1.000 0.000
#> SRR1304016     1   0.000     0.9606 1.000 0.000
#> SRR1304017     1   0.482     0.8584 0.896 0.104
#> SRR1304018     2   0.722     0.8208 0.200 0.800
#> SRR1304019     1   0.000     0.9606 1.000 0.000
#> SRR1304020     1   0.000     0.9606 1.000 0.000
#> SRR1304021     1   0.000     0.9606 1.000 0.000
#> SRR1304022     2   0.204     0.9249 0.032 0.968
#> SRR1304024     2   0.204     0.9249 0.032 0.968
#> SRR1304023     1   0.000     0.9606 1.000 0.000
#> SRR1304026     2   0.204     0.9249 0.032 0.968
#> SRR1304027     2   0.204     0.9249 0.032 0.968
#> SRR1304025     2   0.204     0.9249 0.032 0.968
#> SRR1304028     1   0.000     0.9606 1.000 0.000
#> SRR1304029     1   0.000     0.9606 1.000 0.000
#> SRR1304030     1   0.000     0.9606 1.000 0.000
#> SRR1304031     1   0.000     0.9606 1.000 0.000
#> SRR1304032     1   0.000     0.9606 1.000 0.000
#> SRR1304033     1   0.000     0.9606 1.000 0.000
#> SRR1304034     1   0.000     0.9606 1.000 0.000
#> SRR1304035     1   0.000     0.9606 1.000 0.000
#> SRR1304036     1   0.000     0.9606 1.000 0.000
#> SRR1304037     1   0.000     0.9606 1.000 0.000
#> SRR1304038     2   0.204     0.9249 0.032 0.968
#> SRR1304039     2   0.204     0.9249 0.032 0.968
#> SRR1304040     2   0.204     0.9249 0.032 0.968
#> SRR1304041     2   0.204     0.9249 0.032 0.968
#> SRR1304042     2   0.204     0.9249 0.032 0.968
#> SRR1304043     2   0.204     0.9249 0.032 0.968
#> SRR1304046     1   0.000     0.9606 1.000 0.000
#> SRR1304047     1   0.000     0.9606 1.000 0.000
#> SRR1304044     1   0.000     0.9606 1.000 0.000
#> SRR1304045     1   0.000     0.9606 1.000 0.000
#> SRR1304048     2   0.373     0.9102 0.072 0.928
#> SRR1304049     2   0.358     0.9120 0.068 0.932
#> SRR1304050     1   0.634     0.7834 0.840 0.160
#> SRR1304051     1   0.327     0.9064 0.940 0.060
#> SRR1304052     2   0.781     0.7889 0.232 0.768
#> SRR1304053     1   0.000     0.9606 1.000 0.000
#> SRR1304055     2   0.574     0.8706 0.136 0.864
#> SRR1304054     1   0.000     0.9606 1.000 0.000
#> SRR1304056     1   0.430     0.8761 0.912 0.088
#> SRR1304059     2   0.781     0.7889 0.232 0.768
#> SRR1304057     1   0.990     0.0846 0.560 0.440
#> SRR1304058     2   0.204     0.9249 0.032 0.968
#> SRR1304060     2   0.311     0.9173 0.056 0.944
#> SRR1304061     1   0.969     0.2451 0.604 0.396

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>            class entropy silhouette    p1    p2    p3
#> SRR1303990     2  0.7152      0.682 0.444 0.532 0.024
#> SRR1303991     2  0.7152      0.682 0.444 0.532 0.024
#> SRR1303992     1  0.0892      0.917 0.980 0.000 0.020
#> SRR1303993     1  0.0892      0.917 0.980 0.000 0.020
#> SRR1303994     3  0.3551      1.000 0.132 0.000 0.868
#> SRR1303995     3  0.3551      1.000 0.132 0.000 0.868
#> SRR1303996     3  0.3551      1.000 0.132 0.000 0.868
#> SRR1303997     3  0.3551      1.000 0.132 0.000 0.868
#> SRR1303998     3  0.3551      1.000 0.132 0.000 0.868
#> SRR1303999     3  0.3551      1.000 0.132 0.000 0.868
#> SRR1304000     3  0.3551      1.000 0.132 0.000 0.868
#> SRR1304001     3  0.3551      1.000 0.132 0.000 0.868
#> SRR1304004     1  0.3425      0.867 0.884 0.004 0.112
#> SRR1304005     1  0.3425      0.867 0.884 0.004 0.112
#> SRR1304002     1  0.0237      0.928 0.996 0.000 0.004
#> SRR1304003     1  0.0237      0.928 0.996 0.000 0.004
#> SRR1304006     1  0.0000      0.930 1.000 0.000 0.000
#> SRR1304007     1  0.0000      0.930 1.000 0.000 0.000
#> SRR1304008     1  0.3425      0.867 0.884 0.004 0.112
#> SRR1304009     1  0.3425      0.867 0.884 0.004 0.112
#> SRR1304010     1  0.0000      0.930 1.000 0.000 0.000
#> SRR1304011     1  0.0000      0.930 1.000 0.000 0.000
#> SRR1304012     1  0.3425      0.867 0.884 0.004 0.112
#> SRR1304013     1  0.3425      0.867 0.884 0.004 0.112
#> SRR1304014     1  0.1289      0.920 0.968 0.000 0.032
#> SRR1304015     1  0.3425      0.867 0.884 0.004 0.112
#> SRR1304016     2  0.7446      0.661 0.432 0.532 0.036
#> SRR1304017     2  0.6500      0.655 0.464 0.532 0.004
#> SRR1304018     1  0.0000      0.930 1.000 0.000 0.000
#> SRR1304019     1  0.3425      0.867 0.884 0.004 0.112
#> SRR1304020     1  0.7478      0.538 0.692 0.192 0.116
#> SRR1304021     1  0.0000      0.930 1.000 0.000 0.000
#> SRR1304022     2  0.6482      0.736 0.296 0.680 0.024
#> SRR1304024     2  0.6482      0.736 0.296 0.680 0.024
#> SRR1304023     2  0.7152      0.682 0.444 0.532 0.024
#> SRR1304026     2  0.6482      0.736 0.296 0.680 0.024
#> SRR1304027     2  0.6482      0.736 0.296 0.680 0.024
#> SRR1304025     1  0.0000      0.930 1.000 0.000 0.000
#> SRR1304028     2  0.3816      0.698 0.148 0.852 0.000
#> SRR1304029     2  0.3816      0.698 0.148 0.852 0.000
#> SRR1304030     2  0.8620      0.656 0.352 0.536 0.112
#> SRR1304031     2  0.8620      0.656 0.352 0.536 0.112
#> SRR1304032     2  0.5785      0.741 0.300 0.696 0.004
#> SRR1304033     2  0.5785      0.741 0.300 0.696 0.004
#> SRR1304034     2  0.3816      0.698 0.148 0.852 0.000
#> SRR1304035     2  0.3816      0.698 0.148 0.852 0.000
#> SRR1304036     2  0.3816      0.698 0.148 0.852 0.000
#> SRR1304037     2  0.3816      0.698 0.148 0.852 0.000
#> SRR1304038     1  0.0237      0.928 0.996 0.000 0.004
#> SRR1304039     1  0.0237      0.928 0.996 0.000 0.004
#> SRR1304040     2  0.6482      0.736 0.296 0.680 0.024
#> SRR1304041     2  0.6482      0.736 0.296 0.680 0.024
#> SRR1304042     2  0.6482      0.736 0.296 0.680 0.024
#> SRR1304043     2  0.6482      0.736 0.296 0.680 0.024
#> SRR1304046     1  0.3425      0.867 0.884 0.004 0.112
#> SRR1304047     1  0.3425      0.867 0.884 0.004 0.112
#> SRR1304044     2  0.3816      0.698 0.148 0.852 0.000
#> SRR1304045     2  0.3816      0.698 0.148 0.852 0.000
#> SRR1304048     1  0.0000      0.930 1.000 0.000 0.000
#> SRR1304049     1  0.0000      0.930 1.000 0.000 0.000
#> SRR1304050     1  0.0000      0.930 1.000 0.000 0.000
#> SRR1304051     1  0.0000      0.930 1.000 0.000 0.000
#> SRR1304052     1  0.0000      0.930 1.000 0.000 0.000
#> SRR1304053     1  0.1289      0.920 0.968 0.000 0.032
#> SRR1304055     1  0.0000      0.930 1.000 0.000 0.000
#> SRR1304054     2  0.3816      0.698 0.148 0.852 0.000
#> SRR1304056     1  0.1163      0.922 0.972 0.000 0.028
#> SRR1304059     1  0.0000      0.930 1.000 0.000 0.000
#> SRR1304057     1  0.0000      0.930 1.000 0.000 0.000
#> SRR1304058     2  0.6482      0.736 0.296 0.680 0.024
#> SRR1304060     1  0.2772      0.819 0.916 0.080 0.004
#> SRR1304061     1  0.1163      0.922 0.972 0.000 0.028

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> SRR1303990     4  0.4155      0.705 0.240 0.000 0.004 0.756
#> SRR1303991     4  0.4155      0.705 0.240 0.000 0.004 0.756
#> SRR1303992     1  0.7885      0.499 0.532 0.024 0.212 0.232
#> SRR1303993     1  0.7885      0.499 0.532 0.024 0.212 0.232
#> SRR1303994     3  0.5503      0.779 0.016 0.468 0.516 0.000
#> SRR1303995     3  0.5503      0.779 0.016 0.468 0.516 0.000
#> SRR1303996     3  0.5503      0.779 0.016 0.468 0.516 0.000
#> SRR1303997     3  0.5503      0.779 0.016 0.468 0.516 0.000
#> SRR1303998     3  0.5503      0.779 0.016 0.468 0.516 0.000
#> SRR1303999     3  0.5503      0.779 0.016 0.468 0.516 0.000
#> SRR1304000     3  0.5503      0.779 0.016 0.468 0.516 0.000
#> SRR1304001     3  0.5503      0.779 0.016 0.468 0.516 0.000
#> SRR1304004     4  0.0000      0.850 0.000 0.000 0.000 1.000
#> SRR1304005     4  0.0000      0.850 0.000 0.000 0.000 1.000
#> SRR1304002     1  0.4955      0.708 0.556 0.000 0.000 0.444
#> SRR1304003     1  0.4955      0.708 0.556 0.000 0.000 0.444
#> SRR1304006     1  0.5372      0.708 0.544 0.000 0.012 0.444
#> SRR1304007     1  0.5372      0.708 0.544 0.000 0.012 0.444
#> SRR1304008     4  0.0000      0.850 0.000 0.000 0.000 1.000
#> SRR1304009     4  0.0000      0.850 0.000 0.000 0.000 1.000
#> SRR1304010     1  0.5372      0.708 0.544 0.000 0.012 0.444
#> SRR1304011     1  0.5372      0.708 0.544 0.000 0.012 0.444
#> SRR1304012     4  0.0000      0.850 0.000 0.000 0.000 1.000
#> SRR1304013     4  0.0000      0.850 0.000 0.000 0.000 1.000
#> SRR1304014     1  0.5383      0.701 0.536 0.000 0.012 0.452
#> SRR1304015     4  0.0000      0.850 0.000 0.000 0.000 1.000
#> SRR1304016     4  0.4448      0.745 0.188 0.024 0.004 0.784
#> SRR1304017     4  0.5497     -0.578 0.460 0.000 0.016 0.524
#> SRR1304018     1  0.5372      0.708 0.544 0.000 0.012 0.444
#> SRR1304019     4  0.0000      0.850 0.000 0.000 0.000 1.000
#> SRR1304020     4  0.1792      0.823 0.068 0.000 0.000 0.932
#> SRR1304021     1  0.5548      0.703 0.536 0.004 0.012 0.448
#> SRR1304022     1  0.0000      0.432 1.000 0.000 0.000 0.000
#> SRR1304024     1  0.0000      0.432 1.000 0.000 0.000 0.000
#> SRR1304023     4  0.4188      0.702 0.244 0.000 0.004 0.752
#> SRR1304026     1  0.4985     -0.492 0.532 0.000 0.468 0.000
#> SRR1304027     1  0.4985     -0.492 0.532 0.000 0.468 0.000
#> SRR1304025     1  0.4955      0.708 0.556 0.000 0.000 0.444
#> SRR1304028     2  0.4985      1.000 0.000 0.532 0.468 0.000
#> SRR1304029     2  0.4985      1.000 0.000 0.532 0.468 0.000
#> SRR1304030     4  0.3156      0.808 0.068 0.048 0.000 0.884
#> SRR1304031     4  0.3156      0.808 0.068 0.048 0.000 0.884
#> SRR1304032     3  0.8927     -0.306 0.152 0.112 0.472 0.264
#> SRR1304033     3  0.8927     -0.306 0.152 0.112 0.472 0.264
#> SRR1304034     2  0.4985      1.000 0.000 0.532 0.468 0.000
#> SRR1304035     2  0.4985      1.000 0.000 0.532 0.468 0.000
#> SRR1304036     2  0.4985      1.000 0.000 0.532 0.468 0.000
#> SRR1304037     2  0.4985      1.000 0.000 0.532 0.468 0.000
#> SRR1304038     1  0.4955      0.708 0.556 0.000 0.000 0.444
#> SRR1304039     1  0.4955      0.708 0.556 0.000 0.000 0.444
#> SRR1304040     1  0.0000      0.432 1.000 0.000 0.000 0.000
#> SRR1304041     1  0.0000      0.432 1.000 0.000 0.000 0.000
#> SRR1304042     1  0.0000      0.432 1.000 0.000 0.000 0.000
#> SRR1304043     1  0.0000      0.432 1.000 0.000 0.000 0.000
#> SRR1304046     4  0.0817      0.839 0.000 0.024 0.000 0.976
#> SRR1304047     4  0.0817      0.839 0.000 0.024 0.000 0.976
#> SRR1304044     2  0.4985      1.000 0.000 0.532 0.468 0.000
#> SRR1304045     2  0.4985      1.000 0.000 0.532 0.468 0.000
#> SRR1304048     1  0.4955      0.708 0.556 0.000 0.000 0.444
#> SRR1304049     1  0.4955      0.708 0.556 0.000 0.000 0.444
#> SRR1304050     1  0.5378      0.705 0.540 0.000 0.012 0.448
#> SRR1304051     1  0.5378      0.705 0.540 0.000 0.012 0.448
#> SRR1304052     1  0.5372      0.708 0.544 0.000 0.012 0.444
#> SRR1304053     1  0.5383      0.701 0.536 0.000 0.012 0.452
#> SRR1304055     1  0.4955      0.708 0.556 0.000 0.000 0.444
#> SRR1304054     2  0.4985      1.000 0.000 0.532 0.468 0.000
#> SRR1304056     1  0.5378      0.705 0.540 0.000 0.012 0.448
#> SRR1304059     1  0.4955      0.708 0.556 0.000 0.000 0.444
#> SRR1304057     1  0.5372      0.708 0.544 0.000 0.012 0.444
#> SRR1304058     1  0.0188      0.429 0.996 0.004 0.000 0.000
#> SRR1304060     1  0.6066      0.674 0.532 0.024 0.012 0.432
#> SRR1304061     1  0.5378      0.705 0.540 0.000 0.012 0.448

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>            class entropy silhouette    p1    p2    p3    p4    p5
#> SRR1303990     4  0.4138      0.587 0.000 0.000 0.000 0.616 0.384
#> SRR1303991     4  0.4138      0.587 0.000 0.000 0.000 0.616 0.384
#> SRR1303992     4  0.8157      0.286 0.220 0.000 0.284 0.376 0.120
#> SRR1303993     4  0.8143      0.292 0.216 0.000 0.284 0.380 0.120
#> SRR1303994     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000
#> SRR1303995     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000
#> SRR1303996     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000
#> SRR1303997     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000
#> SRR1303998     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000
#> SRR1303999     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000
#> SRR1304000     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000
#> SRR1304001     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000
#> SRR1304004     5  0.2329      0.965 0.124 0.000 0.000 0.000 0.876
#> SRR1304005     5  0.2329      0.965 0.124 0.000 0.000 0.000 0.876
#> SRR1304002     1  0.0451      0.961 0.988 0.000 0.000 0.004 0.008
#> SRR1304003     1  0.0451      0.961 0.988 0.000 0.000 0.004 0.008
#> SRR1304006     1  0.0000      0.964 1.000 0.000 0.000 0.000 0.000
#> SRR1304007     1  0.0000      0.964 1.000 0.000 0.000 0.000 0.000
#> SRR1304008     5  0.2329      0.965 0.124 0.000 0.000 0.000 0.876
#> SRR1304009     5  0.2329      0.965 0.124 0.000 0.000 0.000 0.876
#> SRR1304010     1  0.0290      0.961 0.992 0.000 0.000 0.000 0.008
#> SRR1304011     1  0.0162      0.963 0.996 0.000 0.000 0.000 0.004
#> SRR1304012     5  0.2329      0.965 0.124 0.000 0.000 0.000 0.876
#> SRR1304013     5  0.2329      0.965 0.124 0.000 0.000 0.000 0.876
#> SRR1304014     1  0.2471      0.797 0.864 0.000 0.000 0.000 0.136
#> SRR1304015     5  0.2424      0.961 0.132 0.000 0.000 0.000 0.868
#> SRR1304016     4  0.5396      0.510 0.064 0.000 0.000 0.560 0.376
#> SRR1304017     1  0.5583      0.178 0.564 0.000 0.000 0.352 0.084
#> SRR1304018     1  0.0162      0.962 0.996 0.000 0.000 0.000 0.004
#> SRR1304019     5  0.2424      0.961 0.132 0.000 0.000 0.000 0.868
#> SRR1304020     5  0.2329      0.965 0.124 0.000 0.000 0.000 0.876
#> SRR1304021     1  0.0000      0.964 1.000 0.000 0.000 0.000 0.000
#> SRR1304022     4  0.0000      0.773 0.000 0.000 0.000 1.000 0.000
#> SRR1304024     4  0.0404      0.773 0.000 0.012 0.000 0.988 0.000
#> SRR1304023     4  0.4987      0.612 0.044 0.000 0.000 0.616 0.340
#> SRR1304026     4  0.0000      0.773 0.000 0.000 0.000 1.000 0.000
#> SRR1304027     4  0.0000      0.773 0.000 0.000 0.000 1.000 0.000
#> SRR1304025     1  0.0807      0.954 0.976 0.012 0.000 0.012 0.000
#> SRR1304028     2  0.0000      0.998 0.000 1.000 0.000 0.000 0.000
#> SRR1304029     2  0.0000      0.998 0.000 1.000 0.000 0.000 0.000
#> SRR1304030     5  0.0609      0.826 0.020 0.000 0.000 0.000 0.980
#> SRR1304031     5  0.0609      0.826 0.020 0.000 0.000 0.000 0.980
#> SRR1304032     4  0.4219      0.374 0.000 0.416 0.000 0.584 0.000
#> SRR1304033     4  0.4219      0.374 0.000 0.416 0.000 0.584 0.000
#> SRR1304034     2  0.0000      0.998 0.000 1.000 0.000 0.000 0.000
#> SRR1304035     2  0.0000      0.998 0.000 1.000 0.000 0.000 0.000
#> SRR1304036     2  0.0000      0.998 0.000 1.000 0.000 0.000 0.000
#> SRR1304037     2  0.0000      0.998 0.000 1.000 0.000 0.000 0.000
#> SRR1304038     1  0.0404      0.961 0.988 0.000 0.000 0.012 0.000
#> SRR1304039     1  0.0404      0.961 0.988 0.000 0.000 0.012 0.000
#> SRR1304040     4  0.0000      0.773 0.000 0.000 0.000 1.000 0.000
#> SRR1304041     4  0.0000      0.773 0.000 0.000 0.000 1.000 0.000
#> SRR1304042     4  0.0404      0.773 0.000 0.012 0.000 0.988 0.000
#> SRR1304043     4  0.0404      0.773 0.000 0.012 0.000 0.988 0.000
#> SRR1304046     5  0.2561      0.951 0.144 0.000 0.000 0.000 0.856
#> SRR1304047     5  0.2561      0.951 0.144 0.000 0.000 0.000 0.856
#> SRR1304044     2  0.0000      0.998 0.000 1.000 0.000 0.000 0.000
#> SRR1304045     2  0.0000      0.998 0.000 1.000 0.000 0.000 0.000
#> SRR1304048     1  0.0798      0.955 0.976 0.008 0.000 0.016 0.000
#> SRR1304049     1  0.0798      0.955 0.976 0.008 0.000 0.016 0.000
#> SRR1304050     1  0.0290      0.961 0.992 0.000 0.000 0.000 0.008
#> SRR1304051     1  0.0000      0.964 1.000 0.000 0.000 0.000 0.000
#> SRR1304052     1  0.0000      0.964 1.000 0.000 0.000 0.000 0.000
#> SRR1304053     1  0.0000      0.964 1.000 0.000 0.000 0.000 0.000
#> SRR1304055     1  0.0798      0.955 0.976 0.008 0.000 0.016 0.000
#> SRR1304054     2  0.0609      0.980 0.000 0.980 0.000 0.000 0.020
#> SRR1304056     1  0.0000      0.964 1.000 0.000 0.000 0.000 0.000
#> SRR1304059     1  0.0162      0.963 0.996 0.000 0.000 0.004 0.000
#> SRR1304057     1  0.0000      0.964 1.000 0.000 0.000 0.000 0.000
#> SRR1304058     4  0.0404      0.773 0.000 0.012 0.000 0.988 0.000
#> SRR1304060     1  0.0162      0.963 0.996 0.000 0.000 0.004 0.000
#> SRR1304061     1  0.0510      0.953 0.984 0.000 0.000 0.000 0.016

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>            class entropy silhouette    p1   p2    p3    p4    p5    p6
#> SRR1303990     6  0.0000      0.873 0.000 0.00 0.000 0.000 0.000 1.000
#> SRR1303991     6  0.0000      0.873 0.000 0.00 0.000 0.000 0.000 1.000
#> SRR1303992     3  0.0632      0.966 0.024 0.00 0.976 0.000 0.000 0.000
#> SRR1303993     3  0.0632      0.966 0.024 0.00 0.976 0.000 0.000 0.000
#> SRR1303994     3  0.0000      0.992 0.000 0.00 1.000 0.000 0.000 0.000
#> SRR1303995     3  0.0000      0.992 0.000 0.00 1.000 0.000 0.000 0.000
#> SRR1303996     3  0.0000      0.992 0.000 0.00 1.000 0.000 0.000 0.000
#> SRR1303997     3  0.0000      0.992 0.000 0.00 1.000 0.000 0.000 0.000
#> SRR1303998     3  0.0000      0.992 0.000 0.00 1.000 0.000 0.000 0.000
#> SRR1303999     3  0.0000      0.992 0.000 0.00 1.000 0.000 0.000 0.000
#> SRR1304000     3  0.0000      0.992 0.000 0.00 1.000 0.000 0.000 0.000
#> SRR1304001     3  0.0000      0.992 0.000 0.00 1.000 0.000 0.000 0.000
#> SRR1304004     5  0.0000      1.000 0.000 0.00 0.000 0.000 1.000 0.000
#> SRR1304005     5  0.0000      1.000 0.000 0.00 0.000 0.000 1.000 0.000
#> SRR1304002     1  0.0000      0.987 1.000 0.00 0.000 0.000 0.000 0.000
#> SRR1304003     1  0.0000      0.987 1.000 0.00 0.000 0.000 0.000 0.000
#> SRR1304006     1  0.0000      0.987 1.000 0.00 0.000 0.000 0.000 0.000
#> SRR1304007     1  0.0000      0.987 1.000 0.00 0.000 0.000 0.000 0.000
#> SRR1304008     5  0.0000      1.000 0.000 0.00 0.000 0.000 1.000 0.000
#> SRR1304009     5  0.0000      1.000 0.000 0.00 0.000 0.000 1.000 0.000
#> SRR1304010     1  0.0000      0.987 1.000 0.00 0.000 0.000 0.000 0.000
#> SRR1304011     1  0.0000      0.987 1.000 0.00 0.000 0.000 0.000 0.000
#> SRR1304012     5  0.0000      1.000 0.000 0.00 0.000 0.000 1.000 0.000
#> SRR1304013     5  0.0000      1.000 0.000 0.00 0.000 0.000 1.000 0.000
#> SRR1304014     1  0.2597      0.766 0.824 0.00 0.000 0.000 0.176 0.000
#> SRR1304015     5  0.0000      1.000 0.000 0.00 0.000 0.000 1.000 0.000
#> SRR1304016     6  0.3464      0.543 0.000 0.00 0.000 0.000 0.312 0.688
#> SRR1304017     1  0.0000      0.987 1.000 0.00 0.000 0.000 0.000 0.000
#> SRR1304018     1  0.0000      0.987 1.000 0.00 0.000 0.000 0.000 0.000
#> SRR1304019     5  0.0000      1.000 0.000 0.00 0.000 0.000 1.000 0.000
#> SRR1304020     5  0.0000      1.000 0.000 0.00 0.000 0.000 1.000 0.000
#> SRR1304021     1  0.0000      0.987 1.000 0.00 0.000 0.000 0.000 0.000
#> SRR1304022     4  0.0000      1.000 0.000 0.00 0.000 1.000 0.000 0.000
#> SRR1304024     4  0.0000      1.000 0.000 0.00 0.000 1.000 0.000 0.000
#> SRR1304023     6  0.0363      0.868 0.000 0.00 0.000 0.012 0.000 0.988
#> SRR1304026     4  0.0000      1.000 0.000 0.00 0.000 1.000 0.000 0.000
#> SRR1304027     4  0.0000      1.000 0.000 0.00 0.000 1.000 0.000 0.000
#> SRR1304025     1  0.0000      0.987 1.000 0.00 0.000 0.000 0.000 0.000
#> SRR1304028     2  0.0000      0.995 0.000 1.00 0.000 0.000 0.000 0.000
#> SRR1304029     2  0.0000      0.995 0.000 1.00 0.000 0.000 0.000 0.000
#> SRR1304030     5  0.0000      1.000 0.000 0.00 0.000 0.000 1.000 0.000
#> SRR1304031     5  0.0000      1.000 0.000 0.00 0.000 0.000 1.000 0.000
#> SRR1304032     2  0.0547      0.978 0.000 0.98 0.000 0.020 0.000 0.000
#> SRR1304033     2  0.0547      0.978 0.000 0.98 0.000 0.020 0.000 0.000
#> SRR1304034     2  0.0000      0.995 0.000 1.00 0.000 0.000 0.000 0.000
#> SRR1304035     2  0.0000      0.995 0.000 1.00 0.000 0.000 0.000 0.000
#> SRR1304036     2  0.0000      0.995 0.000 1.00 0.000 0.000 0.000 0.000
#> SRR1304037     2  0.0000      0.995 0.000 1.00 0.000 0.000 0.000 0.000
#> SRR1304038     1  0.0000      0.987 1.000 0.00 0.000 0.000 0.000 0.000
#> SRR1304039     1  0.0000      0.987 1.000 0.00 0.000 0.000 0.000 0.000
#> SRR1304040     4  0.0000      1.000 0.000 0.00 0.000 1.000 0.000 0.000
#> SRR1304041     4  0.0000      1.000 0.000 0.00 0.000 1.000 0.000 0.000
#> SRR1304042     4  0.0000      1.000 0.000 0.00 0.000 1.000 0.000 0.000
#> SRR1304043     4  0.0000      1.000 0.000 0.00 0.000 1.000 0.000 0.000
#> SRR1304046     5  0.0000      1.000 0.000 0.00 0.000 0.000 1.000 0.000
#> SRR1304047     5  0.0000      1.000 0.000 0.00 0.000 0.000 1.000 0.000
#> SRR1304044     2  0.0000      0.995 0.000 1.00 0.000 0.000 0.000 0.000
#> SRR1304045     2  0.0000      0.995 0.000 1.00 0.000 0.000 0.000 0.000
#> SRR1304048     1  0.0000      0.987 1.000 0.00 0.000 0.000 0.000 0.000
#> SRR1304049     1  0.0000      0.987 1.000 0.00 0.000 0.000 0.000 0.000
#> SRR1304050     1  0.0000      0.987 1.000 0.00 0.000 0.000 0.000 0.000
#> SRR1304051     1  0.0000      0.987 1.000 0.00 0.000 0.000 0.000 0.000
#> SRR1304052     1  0.0000      0.987 1.000 0.00 0.000 0.000 0.000 0.000
#> SRR1304053     1  0.1501      0.904 0.924 0.00 0.000 0.000 0.076 0.000
#> SRR1304055     1  0.0000      0.987 1.000 0.00 0.000 0.000 0.000 0.000
#> SRR1304054     2  0.0000      0.995 0.000 1.00 0.000 0.000 0.000 0.000
#> SRR1304056     1  0.0146      0.984 0.996 0.00 0.000 0.000 0.004 0.000
#> SRR1304059     1  0.0000      0.987 1.000 0.00 0.000 0.000 0.000 0.000
#> SRR1304057     1  0.0000      0.987 1.000 0.00 0.000 0.000 0.000 0.000
#> SRR1304058     4  0.0000      1.000 0.000 0.00 0.000 1.000 0.000 0.000
#> SRR1304060     1  0.0000      0.987 1.000 0.00 0.000 0.000 0.000 0.000
#> SRR1304061     1  0.0146      0.984 0.996 0.00 0.000 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-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 15595 rows and 72 columns.
#>   Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'ATC' method.
#>   Subgroups are detected by 'NMF' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 5.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

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

collect_plots(res)

plot of chunk ATC-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.807           0.879       0.951         0.3318 0.665   0.665
#> 3 3 0.589           0.759       0.900         0.7182 0.734   0.600
#> 4 4 0.658           0.767       0.881         0.2444 0.758   0.470
#> 5 5 0.792           0.795       0.890         0.0856 0.881   0.612
#> 6 6 0.763           0.689       0.830         0.0331 0.934   0.741

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
#> SRR1303990     1  0.0000      0.961 1.000 0.000
#> SRR1303991     1  0.0000      0.961 1.000 0.000
#> SRR1303992     1  0.0000      0.961 1.000 0.000
#> SRR1303993     1  0.0000      0.961 1.000 0.000
#> SRR1303994     1  0.0000      0.961 1.000 0.000
#> SRR1303995     1  0.0000      0.961 1.000 0.000
#> SRR1303996     1  0.0000      0.961 1.000 0.000
#> SRR1303997     1  0.0000      0.961 1.000 0.000
#> SRR1303998     1  0.0000      0.961 1.000 0.000
#> SRR1303999     1  0.0000      0.961 1.000 0.000
#> SRR1304000     1  0.0000      0.961 1.000 0.000
#> SRR1304001     1  0.0000      0.961 1.000 0.000
#> SRR1304004     1  0.0000      0.961 1.000 0.000
#> SRR1304005     1  0.0000      0.961 1.000 0.000
#> SRR1304002     1  0.0000      0.961 1.000 0.000
#> SRR1304003     1  0.0000      0.961 1.000 0.000
#> SRR1304006     1  0.0000      0.961 1.000 0.000
#> SRR1304007     1  0.0000      0.961 1.000 0.000
#> SRR1304008     1  0.0000      0.961 1.000 0.000
#> SRR1304009     1  0.0000      0.961 1.000 0.000
#> SRR1304010     1  0.0000      0.961 1.000 0.000
#> SRR1304011     1  0.0000      0.961 1.000 0.000
#> SRR1304012     1  0.0000      0.961 1.000 0.000
#> SRR1304013     1  0.0000      0.961 1.000 0.000
#> SRR1304014     1  0.0000      0.961 1.000 0.000
#> SRR1304015     1  0.0000      0.961 1.000 0.000
#> SRR1304016     1  0.0000      0.961 1.000 0.000
#> SRR1304017     1  0.7453      0.691 0.788 0.212
#> SRR1304018     1  0.0672      0.954 0.992 0.008
#> SRR1304019     1  0.0000      0.961 1.000 0.000
#> SRR1304020     1  0.0000      0.961 1.000 0.000
#> SRR1304021     1  0.0000      0.961 1.000 0.000
#> SRR1304022     2  0.7219      0.761 0.200 0.800
#> SRR1304024     2  0.0000      0.871 0.000 1.000
#> SRR1304023     1  0.0000      0.961 1.000 0.000
#> SRR1304026     2  0.0000      0.871 0.000 1.000
#> SRR1304027     2  0.0000      0.871 0.000 1.000
#> SRR1304025     1  0.9833      0.146 0.576 0.424
#> SRR1304028     1  0.8909      0.497 0.692 0.308
#> SRR1304029     1  0.8861      0.506 0.696 0.304
#> SRR1304030     1  0.0000      0.961 1.000 0.000
#> SRR1304031     1  0.0000      0.961 1.000 0.000
#> SRR1304032     2  0.0672      0.871 0.008 0.992
#> SRR1304033     2  0.0672      0.871 0.008 0.992
#> SRR1304034     2  0.7674      0.737 0.224 0.776
#> SRR1304035     2  0.7883      0.722 0.236 0.764
#> SRR1304036     1  0.4690      0.856 0.900 0.100
#> SRR1304037     1  0.3879      0.884 0.924 0.076
#> SRR1304038     1  0.0000      0.961 1.000 0.000
#> SRR1304039     1  0.0000      0.961 1.000 0.000
#> SRR1304040     2  0.0000      0.871 0.000 1.000
#> SRR1304041     2  0.0000      0.871 0.000 1.000
#> SRR1304042     2  0.0000      0.871 0.000 1.000
#> SRR1304043     2  0.0000      0.871 0.000 1.000
#> SRR1304046     1  0.0000      0.961 1.000 0.000
#> SRR1304047     1  0.0000      0.961 1.000 0.000
#> SRR1304044     2  0.9922      0.291 0.448 0.552
#> SRR1304045     2  0.9922      0.291 0.448 0.552
#> SRR1304048     1  0.0672      0.954 0.992 0.008
#> SRR1304049     1  0.0376      0.957 0.996 0.004
#> SRR1304050     1  0.0000      0.961 1.000 0.000
#> SRR1304051     1  0.0000      0.961 1.000 0.000
#> SRR1304052     1  0.0000      0.961 1.000 0.000
#> SRR1304053     1  0.0000      0.961 1.000 0.000
#> SRR1304055     1  0.1843      0.935 0.972 0.028
#> SRR1304054     1  0.9754      0.205 0.592 0.408
#> SRR1304056     1  0.0000      0.961 1.000 0.000
#> SRR1304059     1  0.0000      0.961 1.000 0.000
#> SRR1304057     1  0.0000      0.961 1.000 0.000
#> SRR1304058     2  0.4298      0.838 0.088 0.912
#> SRR1304060     1  0.0000      0.961 1.000 0.000
#> SRR1304061     1  0.0000      0.961 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
#> SRR1303990     3  0.0000      0.782 0.000 0.000 1.000
#> SRR1303991     3  0.0000      0.782 0.000 0.000 1.000
#> SRR1303992     1  0.0000      0.913 1.000 0.000 0.000
#> SRR1303993     1  0.0000      0.913 1.000 0.000 0.000
#> SRR1303994     1  0.0000      0.913 1.000 0.000 0.000
#> SRR1303995     1  0.0000      0.913 1.000 0.000 0.000
#> SRR1303996     1  0.0000      0.913 1.000 0.000 0.000
#> SRR1303997     1  0.0000      0.913 1.000 0.000 0.000
#> SRR1303998     1  0.0000      0.913 1.000 0.000 0.000
#> SRR1303999     1  0.0000      0.913 1.000 0.000 0.000
#> SRR1304000     1  0.0000      0.913 1.000 0.000 0.000
#> SRR1304001     1  0.0000      0.913 1.000 0.000 0.000
#> SRR1304004     3  0.6299      0.243 0.476 0.000 0.524
#> SRR1304005     1  0.6154      0.144 0.592 0.000 0.408
#> SRR1304002     1  0.0000      0.913 1.000 0.000 0.000
#> SRR1304003     1  0.0000      0.913 1.000 0.000 0.000
#> SRR1304006     1  0.0000      0.913 1.000 0.000 0.000
#> SRR1304007     1  0.0000      0.913 1.000 0.000 0.000
#> SRR1304008     3  0.5835      0.581 0.340 0.000 0.660
#> SRR1304009     3  0.5835      0.582 0.340 0.000 0.660
#> SRR1304010     1  0.0000      0.913 1.000 0.000 0.000
#> SRR1304011     1  0.0000      0.913 1.000 0.000 0.000
#> SRR1304012     3  0.0237      0.783 0.004 0.000 0.996
#> SRR1304013     3  0.0237      0.783 0.004 0.000 0.996
#> SRR1304014     1  0.4504      0.679 0.804 0.000 0.196
#> SRR1304015     3  0.4399      0.732 0.188 0.000 0.812
#> SRR1304016     3  0.0000      0.782 0.000 0.000 1.000
#> SRR1304017     3  0.2866      0.736 0.008 0.076 0.916
#> SRR1304018     1  0.6442      0.126 0.564 0.432 0.004
#> SRR1304019     3  0.0000      0.782 0.000 0.000 1.000
#> SRR1304020     3  0.0000      0.782 0.000 0.000 1.000
#> SRR1304021     1  0.4555      0.672 0.800 0.000 0.200
#> SRR1304022     2  0.4974      0.644 0.000 0.764 0.236
#> SRR1304024     2  0.0000      0.793 0.000 1.000 0.000
#> SRR1304023     3  0.0000      0.782 0.000 0.000 1.000
#> SRR1304026     2  0.0000      0.793 0.000 1.000 0.000
#> SRR1304027     2  0.0000      0.793 0.000 1.000 0.000
#> SRR1304025     1  0.5882      0.390 0.652 0.348 0.000
#> SRR1304028     1  0.6126      0.248 0.600 0.400 0.000
#> SRR1304029     1  0.6126      0.248 0.600 0.400 0.000
#> SRR1304030     3  0.4842      0.709 0.224 0.000 0.776
#> SRR1304031     3  0.6180      0.425 0.416 0.000 0.584
#> SRR1304032     2  0.4555      0.771 0.200 0.800 0.000
#> SRR1304033     2  0.4555      0.771 0.200 0.800 0.000
#> SRR1304034     2  0.4555      0.771 0.200 0.800 0.000
#> SRR1304035     2  0.4605      0.768 0.204 0.796 0.000
#> SRR1304036     1  0.0000      0.913 1.000 0.000 0.000
#> SRR1304037     1  0.0000      0.913 1.000 0.000 0.000
#> SRR1304038     1  0.0000      0.913 1.000 0.000 0.000
#> SRR1304039     1  0.0000      0.913 1.000 0.000 0.000
#> SRR1304040     2  0.0000      0.793 0.000 1.000 0.000
#> SRR1304041     2  0.0000      0.793 0.000 1.000 0.000
#> SRR1304042     2  0.0000      0.793 0.000 1.000 0.000
#> SRR1304043     2  0.0000      0.793 0.000 1.000 0.000
#> SRR1304046     3  0.3340      0.760 0.120 0.000 0.880
#> SRR1304047     3  0.4291      0.734 0.180 0.000 0.820
#> SRR1304044     2  0.6045      0.478 0.380 0.620 0.000
#> SRR1304045     2  0.6111      0.436 0.396 0.604 0.000
#> SRR1304048     1  0.0000      0.913 1.000 0.000 0.000
#> SRR1304049     1  0.0000      0.913 1.000 0.000 0.000
#> SRR1304050     1  0.0000      0.913 1.000 0.000 0.000
#> SRR1304051     1  0.0000      0.913 1.000 0.000 0.000
#> SRR1304052     1  0.0000      0.913 1.000 0.000 0.000
#> SRR1304053     1  0.0000      0.913 1.000 0.000 0.000
#> SRR1304055     1  0.0000      0.913 1.000 0.000 0.000
#> SRR1304054     1  0.6140      0.235 0.596 0.404 0.000
#> SRR1304056     1  0.0000      0.913 1.000 0.000 0.000
#> SRR1304059     1  0.0000      0.913 1.000 0.000 0.000
#> SRR1304057     1  0.0000      0.913 1.000 0.000 0.000
#> SRR1304058     2  0.4750      0.756 0.216 0.784 0.000
#> SRR1304060     1  0.0000      0.913 1.000 0.000 0.000
#> SRR1304061     1  0.0000      0.913 1.000 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> SRR1303990     4  0.0336     0.9111 0.008 0.000 0.000 0.992
#> SRR1303991     4  0.0336     0.9111 0.008 0.000 0.000 0.992
#> SRR1303992     3  0.0188     0.8608 0.004 0.000 0.996 0.000
#> SRR1303993     3  0.0188     0.8608 0.004 0.000 0.996 0.000
#> SRR1303994     3  0.0336     0.8611 0.008 0.000 0.992 0.000
#> SRR1303995     3  0.0336     0.8611 0.008 0.000 0.992 0.000
#> SRR1303996     3  0.0188     0.8608 0.004 0.000 0.996 0.000
#> SRR1303997     3  0.0188     0.8608 0.004 0.000 0.996 0.000
#> SRR1303998     3  0.0188     0.8574 0.004 0.000 0.996 0.000
#> SRR1303999     3  0.0188     0.8574 0.004 0.000 0.996 0.000
#> SRR1304000     3  0.0188     0.8608 0.004 0.000 0.996 0.000
#> SRR1304001     3  0.0188     0.8608 0.004 0.000 0.996 0.000
#> SRR1304004     1  0.1545     0.8954 0.952 0.000 0.008 0.040
#> SRR1304005     1  0.1388     0.9068 0.960 0.000 0.012 0.028
#> SRR1304002     3  0.1474     0.8519 0.052 0.000 0.948 0.000
#> SRR1304003     3  0.1302     0.8546 0.044 0.000 0.956 0.000
#> SRR1304006     1  0.4994    -0.0611 0.520 0.000 0.480 0.000
#> SRR1304007     3  0.4843     0.3962 0.396 0.000 0.604 0.000
#> SRR1304008     1  0.0895     0.9105 0.976 0.000 0.004 0.020
#> SRR1304009     1  0.0895     0.9105 0.976 0.000 0.004 0.020
#> SRR1304010     3  0.3219     0.7769 0.164 0.000 0.836 0.000
#> SRR1304011     3  0.3219     0.7782 0.164 0.000 0.836 0.000
#> SRR1304012     4  0.0336     0.9111 0.008 0.000 0.000 0.992
#> SRR1304013     4  0.0469     0.9104 0.012 0.000 0.000 0.988
#> SRR1304014     1  0.0707     0.9123 0.980 0.000 0.020 0.000
#> SRR1304015     1  0.0921     0.9043 0.972 0.000 0.000 0.028
#> SRR1304016     1  0.1118     0.8933 0.964 0.000 0.000 0.036
#> SRR1304017     4  0.1398     0.8882 0.004 0.040 0.000 0.956
#> SRR1304018     2  0.7677     0.6052 0.040 0.560 0.280 0.120
#> SRR1304019     4  0.3528     0.7729 0.192 0.000 0.000 0.808
#> SRR1304020     4  0.4382     0.6197 0.296 0.000 0.000 0.704
#> SRR1304021     1  0.1545     0.8978 0.952 0.000 0.040 0.008
#> SRR1304022     4  0.2408     0.8383 0.000 0.104 0.000 0.896
#> SRR1304024     2  0.0000     0.7558 0.000 1.000 0.000 0.000
#> SRR1304023     4  0.0188     0.9096 0.004 0.000 0.000 0.996
#> SRR1304026     2  0.0000     0.7558 0.000 1.000 0.000 0.000
#> SRR1304027     2  0.0000     0.7558 0.000 1.000 0.000 0.000
#> SRR1304025     3  0.5296    -0.2853 0.008 0.496 0.496 0.000
#> SRR1304028     2  0.7225     0.5314 0.128 0.536 0.328 0.008
#> SRR1304029     2  0.7211     0.5399 0.128 0.540 0.324 0.008
#> SRR1304030     1  0.0376     0.9139 0.992 0.000 0.004 0.004
#> SRR1304031     1  0.0376     0.9139 0.992 0.000 0.004 0.004
#> SRR1304032     2  0.4088     0.7623 0.012 0.808 0.172 0.008
#> SRR1304033     2  0.4132     0.7613 0.012 0.804 0.176 0.008
#> SRR1304034     2  0.4825     0.6429 0.288 0.700 0.004 0.008
#> SRR1304035     2  0.4937     0.6480 0.284 0.700 0.008 0.008
#> SRR1304036     3  0.6962     0.4449 0.188 0.204 0.604 0.004
#> SRR1304037     3  0.6688     0.5142 0.184 0.176 0.636 0.004
#> SRR1304038     3  0.0000     0.8594 0.000 0.000 1.000 0.000
#> SRR1304039     3  0.0000     0.8594 0.000 0.000 1.000 0.000
#> SRR1304040     2  0.0000     0.7558 0.000 1.000 0.000 0.000
#> SRR1304041     2  0.0000     0.7558 0.000 1.000 0.000 0.000
#> SRR1304042     2  0.0000     0.7558 0.000 1.000 0.000 0.000
#> SRR1304043     2  0.0000     0.7558 0.000 1.000 0.000 0.000
#> SRR1304046     1  0.0376     0.9139 0.992 0.000 0.004 0.004
#> SRR1304047     1  0.0376     0.9139 0.992 0.000 0.004 0.004
#> SRR1304044     2  0.5519     0.7625 0.100 0.748 0.144 0.008
#> SRR1304045     2  0.5448     0.7637 0.092 0.752 0.148 0.008
#> SRR1304048     3  0.2124     0.8429 0.028 0.040 0.932 0.000
#> SRR1304049     3  0.1488     0.8496 0.012 0.032 0.956 0.000
#> SRR1304050     3  0.1716     0.8474 0.064 0.000 0.936 0.000
#> SRR1304051     1  0.0707     0.9126 0.980 0.000 0.020 0.000
#> SRR1304052     3  0.4164     0.6804 0.264 0.000 0.736 0.000
#> SRR1304053     1  0.0707     0.9126 0.980 0.000 0.020 0.000
#> SRR1304055     3  0.1406     0.8516 0.016 0.024 0.960 0.000
#> SRR1304054     2  0.6835     0.6413 0.252 0.592 0.156 0.000
#> SRR1304056     1  0.0592     0.9139 0.984 0.000 0.016 0.000
#> SRR1304059     1  0.4605     0.4170 0.664 0.000 0.336 0.000
#> SRR1304057     3  0.3569     0.7570 0.196 0.000 0.804 0.000
#> SRR1304058     2  0.4643     0.6154 0.000 0.656 0.344 0.000
#> SRR1304060     3  0.4331     0.6143 0.288 0.000 0.712 0.000
#> SRR1304061     1  0.0592     0.9139 0.984 0.000 0.016 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
#> SRR1303990     5  0.1815      0.796 0.016 0.020 0.000 0.024 0.940
#> SRR1303991     5  0.1815      0.796 0.016 0.020 0.000 0.024 0.940
#> SRR1303992     3  0.0162      0.881 0.000 0.004 0.996 0.000 0.000
#> SRR1303993     3  0.0162      0.881 0.000 0.004 0.996 0.000 0.000
#> SRR1303994     3  0.0000      0.881 0.000 0.000 1.000 0.000 0.000
#> SRR1303995     3  0.0162      0.881 0.004 0.000 0.996 0.000 0.000
#> SRR1303996     3  0.0000      0.881 0.000 0.000 1.000 0.000 0.000
#> SRR1303997     3  0.0000      0.881 0.000 0.000 1.000 0.000 0.000
#> SRR1303998     3  0.0000      0.881 0.000 0.000 1.000 0.000 0.000
#> SRR1303999     3  0.0000      0.881 0.000 0.000 1.000 0.000 0.000
#> SRR1304000     3  0.0000      0.881 0.000 0.000 1.000 0.000 0.000
#> SRR1304001     3  0.0000      0.881 0.000 0.000 1.000 0.000 0.000
#> SRR1304004     1  0.0510      0.959 0.984 0.000 0.000 0.000 0.016
#> SRR1304005     1  0.0566      0.964 0.984 0.004 0.000 0.000 0.012
#> SRR1304002     3  0.1341      0.860 0.000 0.056 0.944 0.000 0.000
#> SRR1304003     3  0.1341      0.860 0.000 0.056 0.944 0.000 0.000
#> SRR1304006     3  0.4165      0.571 0.320 0.008 0.672 0.000 0.000
#> SRR1304007     3  0.4109      0.621 0.288 0.012 0.700 0.000 0.000
#> SRR1304008     1  0.0510      0.959 0.984 0.000 0.000 0.000 0.016
#> SRR1304009     1  0.0671      0.962 0.980 0.004 0.000 0.000 0.016
#> SRR1304010     3  0.1549      0.864 0.040 0.000 0.944 0.016 0.000
#> SRR1304011     3  0.1444      0.865 0.040 0.000 0.948 0.012 0.000
#> SRR1304012     5  0.1205      0.805 0.040 0.004 0.000 0.000 0.956
#> SRR1304013     5  0.1205      0.805 0.040 0.004 0.000 0.000 0.956
#> SRR1304014     1  0.0609      0.967 0.980 0.020 0.000 0.000 0.000
#> SRR1304015     1  0.0162      0.968 0.996 0.004 0.000 0.000 0.000
#> SRR1304016     1  0.0162      0.965 0.996 0.000 0.000 0.000 0.004
#> SRR1304017     5  0.2284      0.778 0.004 0.096 0.000 0.004 0.896
#> SRR1304018     5  0.6987      0.409 0.028 0.120 0.024 0.272 0.556
#> SRR1304019     5  0.3983      0.546 0.340 0.000 0.000 0.000 0.660
#> SRR1304020     5  0.4745      0.333 0.424 0.004 0.000 0.012 0.560
#> SRR1304021     1  0.2439      0.811 0.876 0.004 0.120 0.000 0.000
#> SRR1304022     5  0.3736      0.707 0.000 0.052 0.000 0.140 0.808
#> SRR1304024     4  0.0880      0.874 0.000 0.032 0.000 0.968 0.000
#> SRR1304023     5  0.1270      0.790 0.000 0.052 0.000 0.000 0.948
#> SRR1304026     4  0.2690      0.794 0.000 0.156 0.000 0.844 0.000
#> SRR1304027     4  0.2690      0.794 0.000 0.156 0.000 0.844 0.000
#> SRR1304025     3  0.5049     -0.113 0.000 0.032 0.488 0.480 0.000
#> SRR1304028     2  0.1074      0.812 0.016 0.968 0.004 0.000 0.012
#> SRR1304029     2  0.1121      0.813 0.016 0.968 0.004 0.004 0.008
#> SRR1304030     1  0.0703      0.966 0.976 0.024 0.000 0.000 0.000
#> SRR1304031     1  0.0703      0.966 0.976 0.024 0.000 0.000 0.000
#> SRR1304032     2  0.2674      0.779 0.000 0.856 0.004 0.140 0.000
#> SRR1304033     2  0.2536      0.786 0.000 0.868 0.004 0.128 0.000
#> SRR1304034     2  0.2654      0.822 0.084 0.884 0.000 0.032 0.000
#> SRR1304035     2  0.2362      0.824 0.076 0.900 0.000 0.024 0.000
#> SRR1304036     2  0.2079      0.821 0.064 0.916 0.020 0.000 0.000
#> SRR1304037     2  0.2104      0.820 0.060 0.916 0.024 0.000 0.000
#> SRR1304038     3  0.0703      0.876 0.000 0.024 0.976 0.000 0.000
#> SRR1304039     3  0.0703      0.876 0.000 0.024 0.976 0.000 0.000
#> SRR1304040     4  0.0963      0.877 0.000 0.036 0.000 0.964 0.000
#> SRR1304041     4  0.0963      0.877 0.000 0.036 0.000 0.964 0.000
#> SRR1304042     4  0.0963      0.877 0.000 0.036 0.000 0.964 0.000
#> SRR1304043     4  0.0963      0.877 0.000 0.036 0.000 0.964 0.000
#> SRR1304046     1  0.0162      0.968 0.996 0.004 0.000 0.000 0.000
#> SRR1304047     1  0.0162      0.968 0.996 0.004 0.000 0.000 0.000
#> SRR1304044     2  0.3366      0.782 0.032 0.828 0.000 0.140 0.000
#> SRR1304045     2  0.3152      0.782 0.024 0.840 0.000 0.136 0.000
#> SRR1304048     3  0.0865      0.872 0.000 0.004 0.972 0.024 0.000
#> SRR1304049     3  0.0510      0.877 0.000 0.000 0.984 0.016 0.000
#> SRR1304050     3  0.2512      0.828 0.004 0.092 0.892 0.004 0.008
#> SRR1304051     1  0.0794      0.963 0.972 0.028 0.000 0.000 0.000
#> SRR1304052     2  0.6369      0.384 0.344 0.508 0.140 0.008 0.000
#> SRR1304053     1  0.0963      0.958 0.964 0.036 0.000 0.000 0.000
#> SRR1304055     3  0.5140      0.423 0.000 0.328 0.624 0.040 0.008
#> SRR1304054     2  0.4317      0.769 0.116 0.772 0.000 0.112 0.000
#> SRR1304056     1  0.0703      0.965 0.976 0.024 0.000 0.000 0.000
#> SRR1304059     3  0.4874      0.409 0.388 0.016 0.588 0.008 0.000
#> SRR1304057     2  0.6474      0.419 0.264 0.496 0.240 0.000 0.000
#> SRR1304058     4  0.4722      0.388 0.000 0.024 0.368 0.608 0.000
#> SRR1304060     3  0.2929      0.754 0.180 0.000 0.820 0.000 0.000
#> SRR1304061     1  0.1197      0.946 0.952 0.048 0.000 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>            class entropy silhouette    p1    p2    p3    p4    p5    p6
#> SRR1303990     6  0.0363     0.4400 0.000 0.000 0.000 0.000 0.012 0.988
#> SRR1303991     6  0.0363     0.4400 0.000 0.000 0.000 0.000 0.012 0.988
#> SRR1303992     1  0.1893     0.7886 0.928 0.036 0.004 0.000 0.008 0.024
#> SRR1303993     1  0.1973     0.7868 0.924 0.036 0.004 0.000 0.008 0.028
#> SRR1303994     1  0.0767     0.8015 0.976 0.004 0.012 0.000 0.008 0.000
#> SRR1303995     1  0.0622     0.8012 0.980 0.000 0.012 0.000 0.008 0.000
#> SRR1303996     1  0.0146     0.8009 0.996 0.000 0.004 0.000 0.000 0.000
#> SRR1303997     1  0.0146     0.8009 0.996 0.000 0.004 0.000 0.000 0.000
#> SRR1303998     1  0.0653     0.8017 0.980 0.012 0.004 0.000 0.004 0.000
#> SRR1303999     1  0.0520     0.8011 0.984 0.008 0.008 0.000 0.000 0.000
#> SRR1304000     1  0.0520     0.8013 0.984 0.000 0.008 0.000 0.008 0.000
#> SRR1304001     1  0.0405     0.8014 0.988 0.000 0.008 0.000 0.004 0.000
#> SRR1304004     5  0.0665     0.8637 0.008 0.000 0.004 0.000 0.980 0.008
#> SRR1304005     5  0.0665     0.8637 0.008 0.000 0.004 0.000 0.980 0.008
#> SRR1304002     1  0.1921     0.7907 0.920 0.056 0.012 0.000 0.012 0.000
#> SRR1304003     1  0.1757     0.7933 0.928 0.052 0.012 0.000 0.008 0.000
#> SRR1304006     1  0.3912     0.5258 0.648 0.000 0.012 0.000 0.340 0.000
#> SRR1304007     1  0.3421     0.6414 0.736 0.000 0.008 0.000 0.256 0.000
#> SRR1304008     5  0.0964     0.8645 0.016 0.000 0.012 0.000 0.968 0.004
#> SRR1304009     5  0.0964     0.8645 0.016 0.000 0.012 0.000 0.968 0.004
#> SRR1304010     1  0.5228     0.5944 0.580 0.000 0.328 0.012 0.080 0.000
#> SRR1304011     1  0.5196     0.5935 0.580 0.000 0.332 0.012 0.076 0.000
#> SRR1304012     6  0.5449     0.0115 0.000 0.000 0.388 0.000 0.124 0.488
#> SRR1304013     6  0.5543     0.0709 0.000 0.000 0.372 0.000 0.140 0.488
#> SRR1304014     5  0.1555     0.8606 0.000 0.008 0.040 0.000 0.940 0.012
#> SRR1304015     5  0.0653     0.8670 0.000 0.004 0.004 0.000 0.980 0.012
#> SRR1304016     5  0.0653     0.8665 0.000 0.004 0.012 0.000 0.980 0.004
#> SRR1304017     3  0.4291     0.6066 0.000 0.008 0.620 0.016 0.000 0.356
#> SRR1304018     3  0.3593     0.4764 0.000 0.016 0.816 0.020 0.016 0.132
#> SRR1304019     5  0.3899     0.3768 0.000 0.000 0.008 0.000 0.628 0.364
#> SRR1304020     5  0.3578     0.4748 0.000 0.000 0.000 0.000 0.660 0.340
#> SRR1304021     5  0.0717     0.8653 0.008 0.000 0.016 0.000 0.976 0.000
#> SRR1304022     3  0.4892     0.6032 0.000 0.000 0.628 0.100 0.000 0.272
#> SRR1304024     4  0.0632     0.7508 0.000 0.000 0.024 0.976 0.000 0.000
#> SRR1304023     3  0.3847     0.3981 0.000 0.000 0.544 0.000 0.000 0.456
#> SRR1304026     4  0.2933     0.6308 0.000 0.200 0.004 0.796 0.000 0.000
#> SRR1304027     4  0.2933     0.6308 0.000 0.200 0.004 0.796 0.000 0.000
#> SRR1304025     4  0.4321     0.2797 0.400 0.008 0.012 0.580 0.000 0.000
#> SRR1304028     2  0.0000     0.8885 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR1304029     2  0.0000     0.8885 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR1304030     5  0.1621     0.8527 0.004 0.048 0.008 0.000 0.936 0.004
#> SRR1304031     5  0.1606     0.8499 0.000 0.056 0.008 0.000 0.932 0.004
#> SRR1304032     2  0.1701     0.8746 0.000 0.920 0.008 0.072 0.000 0.000
#> SRR1304033     2  0.1701     0.8746 0.000 0.920 0.008 0.072 0.000 0.000
#> SRR1304034     2  0.1148     0.8895 0.000 0.960 0.004 0.016 0.020 0.000
#> SRR1304035     2  0.0909     0.8894 0.000 0.968 0.000 0.012 0.020 0.000
#> SRR1304036     2  0.0260     0.8905 0.000 0.992 0.000 0.000 0.008 0.000
#> SRR1304037     2  0.0260     0.8905 0.000 0.992 0.000 0.000 0.008 0.000
#> SRR1304038     1  0.1779     0.7923 0.920 0.016 0.064 0.000 0.000 0.000
#> SRR1304039     1  0.1719     0.7933 0.924 0.016 0.060 0.000 0.000 0.000
#> SRR1304040     4  0.0777     0.7513 0.000 0.000 0.024 0.972 0.004 0.000
#> SRR1304041     4  0.0777     0.7513 0.000 0.000 0.024 0.972 0.004 0.000
#> SRR1304042     4  0.0458     0.7507 0.000 0.000 0.016 0.984 0.000 0.000
#> SRR1304043     4  0.0458     0.7507 0.000 0.000 0.016 0.984 0.000 0.000
#> SRR1304046     5  0.0405     0.8668 0.000 0.004 0.000 0.000 0.988 0.008
#> SRR1304047     5  0.0405     0.8668 0.000 0.004 0.000 0.000 0.988 0.008
#> SRR1304044     2  0.3424     0.8274 0.000 0.816 0.048 0.128 0.008 0.000
#> SRR1304045     2  0.3465     0.8238 0.000 0.812 0.048 0.132 0.008 0.000
#> SRR1304048     1  0.6036     0.4329 0.508 0.000 0.308 0.164 0.020 0.000
#> SRR1304049     1  0.5587     0.5217 0.564 0.000 0.304 0.116 0.016 0.000
#> SRR1304050     1  0.4994     0.5395 0.536 0.012 0.416 0.000 0.024 0.012
#> SRR1304051     5  0.1951     0.8466 0.000 0.016 0.076 0.000 0.908 0.000
#> SRR1304052     5  0.5913     0.3872 0.012 0.228 0.224 0.000 0.536 0.000
#> SRR1304053     5  0.2250     0.8393 0.000 0.040 0.064 0.000 0.896 0.000
#> SRR1304055     1  0.7097     0.1533 0.384 0.340 0.196 0.076 0.004 0.000
#> SRR1304054     2  0.3405     0.8406 0.000 0.836 0.024 0.080 0.060 0.000
#> SRR1304056     5  0.1682     0.8571 0.000 0.020 0.052 0.000 0.928 0.000
#> SRR1304059     5  0.5675     0.2840 0.312 0.008 0.116 0.008 0.556 0.000
#> SRR1304057     2  0.5615     0.4331 0.100 0.592 0.032 0.000 0.276 0.000
#> SRR1304058     4  0.6150     0.2174 0.256 0.000 0.328 0.412 0.004 0.000
#> SRR1304060     1  0.4827     0.6253 0.652 0.000 0.112 0.000 0.236 0.000
#> SRR1304061     5  0.2384     0.8321 0.000 0.064 0.048 0.000 0.888 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-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