cola Report for recount2:SRP033393

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

The call of run_all_consensus_partition_methods() was:

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

Dimension of the input matrix:

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

Density distribution

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

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

plot of chunk density-heatmap

Suggest the best k

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

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

suggest_best_k(res_list)
The best k 1-PAC Mean silhouette Concordance Optional k
SD:hclust 2 1.000 0.951 0.980 **
SD:kmeans 2 1.000 0.978 0.991 **
SD:pam 2 1.000 0.973 0.989 **
SD:mclust 2 1.000 0.960 0.974 **
MAD:hclust 2 1.000 0.960 0.982 **
MAD:kmeans 2 1.000 0.976 0.990 **
MAD:pam 2 1.000 0.972 0.989 **
MAD:mclust 2 1.000 0.975 0.988 **
ATC:hclust 2 1.000 0.952 0.980 **
ATC:kmeans 2 1.000 0.982 0.992 **
ATC:skmeans 3 1.000 0.991 0.993 ** 2
ATC:pam 2 1.000 0.983 0.993 **
CV:pam 3 0.999 0.938 0.976 ** 2
CV:skmeans 3 0.986 0.927 0.968 **
MAD:skmeans 3 0.954 0.968 0.981 ** 2
CV:NMF 2 0.940 0.924 0.969 *
SD:skmeans 3 0.915 0.967 0.980 * 2
MAD:NMF 3 0.714 0.792 0.917
SD:NMF 3 0.709 0.782 0.903
CV:kmeans 2 0.701 0.917 0.954
CV:hclust 2 0.615 0.885 0.927
ATC:NMF 3 0.606 0.785 0.886
CV:mclust 4 0.585 0.779 0.819
ATC:mclust 2 0.555 0.897 0.939

**: 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.807           0.877       0.952          0.392 0.623   0.623
#> CV:NMF      2 0.940           0.924       0.969          0.465 0.535   0.535
#> MAD:NMF     2 0.783           0.857       0.946          0.400 0.597   0.597
#> ATC:NMF     2 0.809           0.874       0.949          0.401 0.584   0.584
#> SD:skmeans  2 1.000           0.994       0.997          0.492 0.509   0.509
#> CV:skmeans  2 0.864           0.938       0.972          0.504 0.498   0.498
#> MAD:skmeans 2 1.000           0.991       0.996          0.493 0.509   0.509
#> ATC:skmeans 2 1.000           0.997       0.999          0.496 0.505   0.505
#> SD:mclust   2 1.000           0.960       0.974          0.503 0.495   0.495
#> CV:mclust   2 0.142           0.348       0.764          0.337 0.895   0.895
#> MAD:mclust  2 1.000           0.975       0.988          0.505 0.494   0.494
#> ATC:mclust  2 0.555           0.897       0.939          0.497 0.498   0.498
#> SD:kmeans   2 1.000           0.978       0.991          0.483 0.514   0.514
#> CV:kmeans   2 0.701           0.917       0.954          0.488 0.505   0.505
#> MAD:kmeans  2 1.000           0.976       0.990          0.486 0.514   0.514
#> ATC:kmeans  2 1.000           0.982       0.992          0.483 0.521   0.521
#> SD:pam      2 1.000           0.973       0.989          0.492 0.505   0.505
#> CV:pam      2 1.000           0.981       0.993          0.398 0.610   0.610
#> MAD:pam     2 1.000           0.972       0.989          0.492 0.505   0.505
#> ATC:pam     2 1.000           0.983       0.993          0.494 0.505   0.505
#> SD:hclust   2 1.000           0.951       0.980          0.490 0.514   0.514
#> CV:hclust   2 0.615           0.885       0.927          0.435 0.562   0.562
#> MAD:hclust  2 1.000           0.960       0.982          0.486 0.514   0.514
#> ATC:hclust  2 1.000           0.952       0.980          0.481 0.521   0.521
get_stats(res_list, k = 3)
#>             k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> SD:NMF      3 0.709           0.782       0.903         0.6459 0.664   0.490
#> CV:NMF      3 0.632           0.808       0.890         0.4193 0.755   0.558
#> MAD:NMF     3 0.714           0.792       0.917         0.5982 0.647   0.459
#> ATC:NMF     3 0.606           0.785       0.886         0.6048 0.636   0.430
#> SD:skmeans  3 0.915           0.967       0.980         0.3487 0.824   0.655
#> CV:skmeans  3 0.986           0.927       0.968         0.2855 0.811   0.636
#> MAD:skmeans 3 0.954           0.968       0.981         0.3476 0.824   0.655
#> ATC:skmeans 3 1.000           0.991       0.993         0.3429 0.813   0.635
#> SD:mclust   3 0.833           0.903       0.932         0.2447 0.877   0.754
#> CV:mclust   3 0.302           0.493       0.793         0.4481 0.586   0.560
#> MAD:mclust  3 0.741           0.938       0.938         0.2285 0.888   0.773
#> ATC:mclust  3 0.493           0.822       0.866         0.2427 0.831   0.673
#> SD:kmeans   3 0.569           0.548       0.677         0.3590 0.765   0.578
#> CV:kmeans   3 0.755           0.871       0.932         0.3246 0.654   0.424
#> MAD:kmeans  3 0.576           0.535       0.762         0.3543 0.743   0.533
#> ATC:kmeans  3 0.701           0.820       0.891         0.3510 0.771   0.576
#> SD:pam      3 0.834           0.889       0.941         0.3666 0.756   0.546
#> CV:pam      3 0.999           0.938       0.976         0.5419 0.787   0.650
#> MAD:pam     3 0.841           0.900       0.948         0.3683 0.756   0.546
#> ATC:pam     3 0.897           0.912       0.963         0.3509 0.770   0.569
#> SD:hclust   3 0.888           0.772       0.915         0.1013 0.979   0.960
#> CV:hclust   3 0.724           0.808       0.892         0.4136 0.808   0.659
#> MAD:hclust  3 0.859           0.817       0.915         0.0983 0.989   0.979
#> ATC:hclust  3 0.757           0.853       0.856         0.1863 0.904   0.818
get_stats(res_list, k = 4)
#>             k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> SD:NMF      4 0.494           0.493       0.737         0.0886 0.784   0.514
#> CV:NMF      4 0.694           0.712       0.872         0.0869 0.912   0.747
#> MAD:NMF     4 0.492           0.358       0.644         0.1038 0.740   0.443
#> ATC:NMF     4 0.478           0.641       0.805         0.0772 0.723   0.378
#> SD:skmeans  4 0.878           0.940       0.958         0.1090 0.928   0.784
#> CV:skmeans  4 0.807           0.837       0.925         0.1188 0.893   0.707
#> MAD:skmeans 4 0.873           0.941       0.959         0.1088 0.928   0.784
#> ATC:skmeans 4 0.812           0.904       0.916         0.0722 0.963   0.890
#> SD:mclust   4 0.827           0.888       0.934         0.1964 0.851   0.616
#> CV:mclust   4 0.585           0.779       0.819         0.4716 0.586   0.324
#> MAD:mclust  4 0.773           0.762       0.888         0.1933 0.847   0.610
#> ATC:mclust  4 0.640           0.807       0.850         0.1328 0.837   0.594
#> SD:kmeans   4 0.603           0.688       0.796         0.1339 0.812   0.526
#> CV:kmeans   4 0.809           0.863       0.879         0.1431 0.852   0.599
#> MAD:kmeans  4 0.653           0.722       0.827         0.1381 0.874   0.638
#> ATC:kmeans  4 0.615           0.662       0.781         0.1397 0.844   0.578
#> SD:pam      4 0.738           0.595       0.743         0.0914 0.849   0.591
#> CV:pam      4 0.846           0.705       0.901         0.0474 0.966   0.915
#> MAD:pam     4 0.747           0.774       0.822         0.0914 0.902   0.711
#> ATC:pam     4 0.812           0.841       0.935         0.0885 0.918   0.761
#> SD:hclust   4 0.688           0.731       0.841         0.1397 0.914   0.829
#> CV:hclust   4 0.682           0.785       0.865         0.1089 0.932   0.815
#> MAD:hclust  4 0.654           0.629       0.777         0.1681 1.000   1.000
#> ATC:hclust  4 0.688           0.791       0.830         0.2343 0.818   0.588
get_stats(res_list, k = 5)
#>             k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> SD:NMF      5 0.519           0.492       0.729         0.0706 0.795   0.471
#> CV:NMF      5 0.616           0.598       0.805         0.0577 0.904   0.688
#> MAD:NMF     5 0.552           0.584       0.772         0.0533 0.804   0.502
#> ATC:NMF     5 0.499           0.539       0.741         0.0592 0.931   0.776
#> SD:skmeans  5 0.786           0.826       0.873         0.0641 0.914   0.696
#> CV:skmeans  5 0.763           0.688       0.844         0.0481 0.978   0.918
#> MAD:skmeans 5 0.787           0.797       0.872         0.0642 0.885   0.617
#> ATC:skmeans 5 0.829           0.875       0.898         0.0747 0.928   0.758
#> SD:mclust   5 0.832           0.788       0.868         0.0535 0.843   0.481
#> CV:mclust   5 0.565           0.509       0.681         0.0515 0.920   0.702
#> MAD:mclust  5 0.824           0.824       0.903         0.0725 0.885   0.594
#> ATC:mclust  5 0.807           0.694       0.839         0.1043 0.944   0.799
#> SD:kmeans   5 0.720           0.681       0.758         0.0687 0.895   0.624
#> CV:kmeans   5 0.737           0.813       0.832         0.0573 1.000   1.000
#> MAD:kmeans  5 0.741           0.678       0.763         0.0669 0.894   0.608
#> ATC:kmeans  5 0.739           0.719       0.826         0.0699 0.893   0.613
#> SD:pam      5 0.890           0.869       0.942         0.0797 0.837   0.482
#> CV:pam      5 0.892           0.732       0.895         0.0290 0.971   0.922
#> MAD:pam     5 0.897           0.877       0.947         0.0772 0.857   0.526
#> ATC:pam     5 0.815           0.724       0.869         0.0919 0.877   0.583
#> SD:hclust   5 0.678           0.782       0.847         0.1979 0.760   0.473
#> CV:hclust   5 0.662           0.673       0.847         0.0583 0.975   0.920
#> MAD:hclust  5 0.725           0.745       0.876         0.2039 0.743   0.489
#> ATC:hclust  5 0.729           0.745       0.888         0.0449 0.968   0.885
get_stats(res_list, k = 6)
#>             k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> SD:NMF      6 0.544           0.506       0.725         0.0284 0.894   0.635
#> CV:NMF      6 0.624           0.605       0.783         0.0357 0.924   0.713
#> MAD:NMF     6 0.552           0.549       0.749         0.0507 0.886   0.627
#> ATC:NMF     6 0.560           0.595       0.787         0.0442 0.929   0.746
#> SD:skmeans  6 0.791           0.765       0.821         0.0390 0.971   0.866
#> CV:skmeans  6 0.728           0.564       0.788         0.0256 0.968   0.878
#> MAD:skmeans 6 0.796           0.783       0.811         0.0417 0.930   0.703
#> ATC:skmeans 6 0.817           0.774       0.864         0.0260 0.994   0.975
#> SD:mclust   6 0.700           0.649       0.817         0.0309 0.937   0.710
#> CV:mclust   6 0.580           0.534       0.693         0.0427 0.915   0.637
#> MAD:mclust  6 0.725           0.621       0.804         0.0283 0.941   0.723
#> ATC:mclust  6 0.751           0.705       0.841         0.0333 0.875   0.538
#> SD:kmeans   6 0.751           0.587       0.732         0.0392 0.910   0.610
#> CV:kmeans   6 0.760           0.509       0.758         0.0327 0.935   0.754
#> MAD:kmeans  6 0.773           0.703       0.783         0.0384 0.910   0.595
#> ATC:kmeans  6 0.745           0.635       0.762         0.0410 0.962   0.813
#> SD:pam      6 0.846           0.882       0.916         0.0485 0.953   0.775
#> CV:pam      6 0.858           0.850       0.909         0.0246 0.970   0.912
#> MAD:pam     6 0.868           0.883       0.920         0.0492 0.943   0.735
#> ATC:pam     6 0.805           0.639       0.853         0.0382 0.960   0.801
#> SD:hclust   6 0.731           0.755       0.826         0.0685 0.973   0.890
#> CV:hclust   6 0.680           0.705       0.851         0.0214 0.975   0.914
#> MAD:hclust  6 0.741           0.698       0.826         0.0568 0.976   0.903
#> ATC:hclust  6 0.790           0.756       0.875         0.0954 0.929   0.727

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 15258 rows and 73 columns.
#>   Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'SD' method.
#>   Subgroups are detected by 'hclust' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 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-hclust-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 1.000           0.951       0.980         0.4902 0.514   0.514
#> 3 3 0.888           0.772       0.915         0.1013 0.979   0.960
#> 4 4 0.688           0.731       0.841         0.1397 0.914   0.829
#> 5 5 0.678           0.782       0.847         0.1979 0.760   0.473
#> 6 6 0.731           0.755       0.826         0.0685 0.973   0.890

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
#> SRR1040814     1  0.0000      0.970 1.000 0.000
#> SRR1040813     1  0.0000      0.970 1.000 0.000
#> SRR1040816     1  0.9129      0.520 0.672 0.328
#> SRR1040815     2  0.0000      0.992 0.000 1.000
#> SRR1040817     1  0.0000      0.970 1.000 0.000
#> SRR1040818     2  0.7219      0.737 0.200 0.800
#> SRR1040819     2  0.0000      0.992 0.000 1.000
#> SRR1040820     2  0.0000      0.992 0.000 1.000
#> SRR1040821     2  0.0000      0.992 0.000 1.000
#> SRR1040822     1  0.0000      0.970 1.000 0.000
#> SRR1040823     1  0.0000      0.970 1.000 0.000
#> SRR1040824     2  0.0000      0.992 0.000 1.000
#> SRR1040826     1  0.0000      0.970 1.000 0.000
#> SRR1040825     2  0.0000      0.992 0.000 1.000
#> SRR1040827     2  0.0000      0.992 0.000 1.000
#> SRR1040828     2  0.0000      0.992 0.000 1.000
#> SRR1040829     2  0.0000      0.992 0.000 1.000
#> SRR1040830     1  0.0000      0.970 1.000 0.000
#> SRR1040831     1  0.0000      0.970 1.000 0.000
#> SRR1040832     1  0.9710      0.359 0.600 0.400
#> SRR1040833     1  0.0000      0.970 1.000 0.000
#> SRR1040834     1  0.9710      0.359 0.600 0.400
#> SRR1040835     2  0.0000      0.992 0.000 1.000
#> SRR1040836     1  0.0000      0.970 1.000 0.000
#> SRR1040837     2  0.0000      0.992 0.000 1.000
#> SRR1040839     2  0.0000      0.992 0.000 1.000
#> SRR1040838     1  0.1633      0.952 0.976 0.024
#> SRR1040840     2  0.0000      0.992 0.000 1.000
#> SRR1040841     1  0.0000      0.970 1.000 0.000
#> SRR1040843     2  0.0000      0.992 0.000 1.000
#> SRR1040842     2  0.0000      0.992 0.000 1.000
#> SRR1040845     2  0.0000      0.992 0.000 1.000
#> SRR1040844     1  0.0000      0.970 1.000 0.000
#> SRR1040846     2  0.0000      0.992 0.000 1.000
#> SRR1040847     1  0.0000      0.970 1.000 0.000
#> SRR1040849     1  0.0000      0.970 1.000 0.000
#> SRR1040848     2  0.0000      0.992 0.000 1.000
#> SRR1040851     1  0.0000      0.970 1.000 0.000
#> SRR1040850     1  0.0000      0.970 1.000 0.000
#> SRR1040852     1  0.1633      0.952 0.976 0.024
#> SRR1040853     1  0.1633      0.952 0.976 0.024
#> SRR1040854     1  0.0000      0.970 1.000 0.000
#> SRR1040855     1  0.0000      0.970 1.000 0.000
#> SRR1040856     2  0.0000      0.992 0.000 1.000
#> SRR1040857     1  0.0000      0.970 1.000 0.000
#> SRR1040858     1  0.0000      0.970 1.000 0.000
#> SRR1040859     2  0.0000      0.992 0.000 1.000
#> SRR1040860     2  0.0000      0.992 0.000 1.000
#> SRR1040861     1  0.0938      0.961 0.988 0.012
#> SRR1040862     2  0.0000      0.992 0.000 1.000
#> SRR1040863     2  0.0000      0.992 0.000 1.000
#> SRR1040864     1  0.0000      0.970 1.000 0.000
#> SRR1040865     1  0.0000      0.970 1.000 0.000
#> SRR1040866     2  0.0000      0.992 0.000 1.000
#> SRR1040867     1  0.0000      0.970 1.000 0.000
#> SRR1040868     1  0.0000      0.970 1.000 0.000
#> SRR1040869     1  0.0000      0.970 1.000 0.000
#> SRR1040870     1  0.0000      0.970 1.000 0.000
#> SRR1040871     1  0.0000      0.970 1.000 0.000
#> SRR1040872     1  0.0000      0.970 1.000 0.000
#> SRR1040873     2  0.0000      0.992 0.000 1.000
#> SRR1040874     1  0.0000      0.970 1.000 0.000
#> SRR1040875     1  0.1633      0.952 0.976 0.024
#> SRR1040876     1  0.0000      0.970 1.000 0.000
#> SRR1040877     1  0.0000      0.970 1.000 0.000
#> SRR1040878     2  0.1633      0.968 0.024 0.976
#> SRR1040879     2  0.0000      0.992 0.000 1.000
#> SRR1040880     1  0.0000      0.970 1.000 0.000
#> SRR1040881     2  0.0000      0.992 0.000 1.000
#> SRR1040882     1  0.0000      0.970 1.000 0.000
#> SRR1040883     1  0.0000      0.970 1.000 0.000
#> SRR1040884     1  0.0000      0.970 1.000 0.000
#> SRR1040885     1  0.0000      0.970 1.000 0.000

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>            class entropy silhouette    p1    p2    p3
#> SRR1040814     1  0.0000     0.9650 1.000 0.000 0.000
#> SRR1040813     1  0.0000     0.9650 1.000 0.000 0.000
#> SRR1040816     1  0.5785     0.4397 0.668 0.000 0.332
#> SRR1040815     2  0.1163     0.7588 0.000 0.972 0.028
#> SRR1040817     1  0.0000     0.9650 1.000 0.000 0.000
#> SRR1040818     3  0.9577     0.0188 0.196 0.400 0.404
#> SRR1040819     2  0.1163     0.7588 0.000 0.972 0.028
#> SRR1040820     2  0.0000     0.7626 0.000 1.000 0.000
#> SRR1040821     2  0.0000     0.7626 0.000 1.000 0.000
#> SRR1040822     1  0.0000     0.9650 1.000 0.000 0.000
#> SRR1040823     1  0.0000     0.9650 1.000 0.000 0.000
#> SRR1040824     2  0.0000     0.7626 0.000 1.000 0.000
#> SRR1040826     1  0.0000     0.9650 1.000 0.000 0.000
#> SRR1040825     2  0.1643     0.7542 0.000 0.956 0.044
#> SRR1040827     2  0.0000     0.7626 0.000 1.000 0.000
#> SRR1040828     2  0.5363     0.5158 0.000 0.724 0.276
#> SRR1040829     2  0.0747     0.7611 0.000 0.984 0.016
#> SRR1040830     1  0.0237     0.9642 0.996 0.000 0.004
#> SRR1040831     1  0.0000     0.9650 1.000 0.000 0.000
#> SRR1040832     1  0.6140     0.2535 0.596 0.000 0.404
#> SRR1040833     1  0.0237     0.9642 0.996 0.000 0.004
#> SRR1040834     1  0.6140     0.2535 0.596 0.000 0.404
#> SRR1040835     2  0.1753     0.7523 0.000 0.952 0.048
#> SRR1040836     1  0.0237     0.9642 0.996 0.000 0.004
#> SRR1040837     2  0.0000     0.7626 0.000 1.000 0.000
#> SRR1040839     2  0.0000     0.7626 0.000 1.000 0.000
#> SRR1040838     1  0.1163     0.9447 0.972 0.000 0.028
#> SRR1040840     2  0.0000     0.7626 0.000 1.000 0.000
#> SRR1040841     1  0.0237     0.9642 0.996 0.000 0.004
#> SRR1040843     2  0.0000     0.7626 0.000 1.000 0.000
#> SRR1040842     3  0.1289     0.3319 0.000 0.032 0.968
#> SRR1040845     2  0.6299     0.1946 0.000 0.524 0.476
#> SRR1040844     1  0.0237     0.9642 0.996 0.000 0.004
#> SRR1040846     2  0.0000     0.7626 0.000 1.000 0.000
#> SRR1040847     1  0.0237     0.9642 0.996 0.000 0.004
#> SRR1040849     1  0.0000     0.9650 1.000 0.000 0.000
#> SRR1040848     2  0.0000     0.7626 0.000 1.000 0.000
#> SRR1040851     1  0.0000     0.9650 1.000 0.000 0.000
#> SRR1040850     1  0.0000     0.9650 1.000 0.000 0.000
#> SRR1040852     1  0.1163     0.9447 0.972 0.000 0.028
#> SRR1040853     1  0.1163     0.9447 0.972 0.000 0.028
#> SRR1040854     1  0.0000     0.9650 1.000 0.000 0.000
#> SRR1040855     1  0.0000     0.9650 1.000 0.000 0.000
#> SRR1040856     2  0.6299     0.1946 0.000 0.524 0.476
#> SRR1040857     1  0.0000     0.9650 1.000 0.000 0.000
#> SRR1040858     1  0.0000     0.9650 1.000 0.000 0.000
#> SRR1040859     2  0.6299     0.1946 0.000 0.524 0.476
#> SRR1040860     2  0.6299     0.1946 0.000 0.524 0.476
#> SRR1040861     1  0.0592     0.9562 0.988 0.000 0.012
#> SRR1040862     2  0.6302     0.1715 0.000 0.520 0.480
#> SRR1040863     2  0.6302     0.1715 0.000 0.520 0.480
#> SRR1040864     1  0.0237     0.9642 0.996 0.000 0.004
#> SRR1040865     1  0.0237     0.9642 0.996 0.000 0.004
#> SRR1040866     2  0.6299     0.1946 0.000 0.524 0.476
#> SRR1040867     1  0.0000     0.9650 1.000 0.000 0.000
#> SRR1040868     1  0.0237     0.9642 0.996 0.000 0.004
#> SRR1040869     1  0.0000     0.9650 1.000 0.000 0.000
#> SRR1040870     1  0.0000     0.9650 1.000 0.000 0.000
#> SRR1040871     1  0.0000     0.9650 1.000 0.000 0.000
#> SRR1040872     1  0.0000     0.9650 1.000 0.000 0.000
#> SRR1040873     2  0.0000     0.7626 0.000 1.000 0.000
#> SRR1040874     1  0.0237     0.9642 0.996 0.000 0.004
#> SRR1040875     1  0.1163     0.9447 0.972 0.000 0.028
#> SRR1040876     1  0.0237     0.9642 0.996 0.000 0.004
#> SRR1040877     1  0.0000     0.9650 1.000 0.000 0.000
#> SRR1040878     2  0.7072     0.1039 0.020 0.504 0.476
#> SRR1040879     2  0.1753     0.7523 0.000 0.952 0.048
#> SRR1040880     1  0.0237     0.9642 0.996 0.000 0.004
#> SRR1040881     2  0.1643     0.7542 0.000 0.956 0.044
#> SRR1040882     1  0.0000     0.9650 1.000 0.000 0.000
#> SRR1040883     1  0.0000     0.9650 1.000 0.000 0.000
#> SRR1040884     1  0.0237     0.9642 0.996 0.000 0.004
#> SRR1040885     1  0.0000     0.9650 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
#> SRR1040814     3  0.0657      0.840 0.012 0.000 0.984 0.004
#> SRR1040813     3  0.0657      0.840 0.012 0.000 0.984 0.004
#> SRR1040816     4  0.4855     -0.353 0.000 0.000 0.400 0.600
#> SRR1040815     2  0.4624      0.541 0.000 0.660 0.000 0.340
#> SRR1040817     3  0.0657      0.840 0.012 0.000 0.984 0.004
#> SRR1040818     4  0.6147      0.542 0.000 0.200 0.128 0.672
#> SRR1040819     2  0.4624      0.541 0.000 0.660 0.000 0.340
#> SRR1040820     2  0.0000      0.799 0.000 1.000 0.000 0.000
#> SRR1040821     2  0.0000      0.799 0.000 1.000 0.000 0.000
#> SRR1040822     3  0.0657      0.840 0.012 0.000 0.984 0.004
#> SRR1040823     3  0.0657      0.840 0.012 0.000 0.984 0.004
#> SRR1040824     2  0.0000      0.799 0.000 1.000 0.000 0.000
#> SRR1040826     3  0.0657      0.840 0.012 0.000 0.984 0.004
#> SRR1040825     2  0.4697      0.515 0.000 0.644 0.000 0.356
#> SRR1040827     2  0.0000      0.799 0.000 1.000 0.000 0.000
#> SRR1040828     4  0.5310      0.303 0.012 0.412 0.000 0.576
#> SRR1040829     2  0.4431      0.580 0.000 0.696 0.000 0.304
#> SRR1040830     3  0.4222      0.807 0.000 0.000 0.728 0.272
#> SRR1040831     3  0.3801      0.823 0.000 0.000 0.780 0.220
#> SRR1040832     3  0.4989      0.159 0.000 0.000 0.528 0.472
#> SRR1040833     3  0.4222      0.807 0.000 0.000 0.728 0.272
#> SRR1040834     3  0.4989      0.159 0.000 0.000 0.528 0.472
#> SRR1040835     2  0.4713      0.507 0.000 0.640 0.000 0.360
#> SRR1040836     3  0.4222      0.807 0.000 0.000 0.728 0.272
#> SRR1040837     2  0.0000      0.799 0.000 1.000 0.000 0.000
#> SRR1040839     2  0.0000      0.799 0.000 1.000 0.000 0.000
#> SRR1040838     3  0.1389      0.835 0.000 0.000 0.952 0.048
#> SRR1040840     2  0.0000      0.799 0.000 1.000 0.000 0.000
#> SRR1040841     3  0.4222      0.807 0.000 0.000 0.728 0.272
#> SRR1040843     2  0.0000      0.799 0.000 1.000 0.000 0.000
#> SRR1040842     1  0.0469      0.000 0.988 0.000 0.000 0.012
#> SRR1040845     4  0.5361      0.773 0.068 0.208 0.000 0.724
#> SRR1040844     3  0.4222      0.807 0.000 0.000 0.728 0.272
#> SRR1040846     2  0.0000      0.799 0.000 1.000 0.000 0.000
#> SRR1040847     3  0.4222      0.807 0.000 0.000 0.728 0.272
#> SRR1040849     3  0.0000      0.842 0.000 0.000 1.000 0.000
#> SRR1040848     2  0.0000      0.799 0.000 1.000 0.000 0.000
#> SRR1040851     3  0.0188      0.843 0.000 0.000 0.996 0.004
#> SRR1040850     3  0.0657      0.840 0.012 0.000 0.984 0.004
#> SRR1040852     3  0.1389      0.835 0.000 0.000 0.952 0.048
#> SRR1040853     3  0.1389      0.835 0.000 0.000 0.952 0.048
#> SRR1040854     3  0.3801      0.823 0.000 0.000 0.780 0.220
#> SRR1040855     3  0.0657      0.840 0.012 0.000 0.984 0.004
#> SRR1040856     4  0.5361      0.773 0.068 0.208 0.000 0.724
#> SRR1040857     3  0.3801      0.823 0.000 0.000 0.780 0.220
#> SRR1040858     3  0.3801      0.823 0.000 0.000 0.780 0.220
#> SRR1040859     4  0.5361      0.773 0.068 0.208 0.000 0.724
#> SRR1040860     4  0.5361      0.773 0.068 0.208 0.000 0.724
#> SRR1040861     3  0.1004      0.839 0.024 0.000 0.972 0.004
#> SRR1040862     4  0.5747      0.761 0.100 0.196 0.000 0.704
#> SRR1040863     4  0.5747      0.761 0.100 0.196 0.000 0.704
#> SRR1040864     3  0.0804      0.840 0.012 0.000 0.980 0.008
#> SRR1040865     3  0.4222      0.807 0.000 0.000 0.728 0.272
#> SRR1040866     4  0.5361      0.773 0.068 0.208 0.000 0.724
#> SRR1040867     3  0.0000      0.842 0.000 0.000 1.000 0.000
#> SRR1040868     3  0.4222      0.807 0.000 0.000 0.728 0.272
#> SRR1040869     3  0.3801      0.823 0.000 0.000 0.780 0.220
#> SRR1040870     3  0.0657      0.840 0.012 0.000 0.984 0.004
#> SRR1040871     3  0.3801      0.823 0.000 0.000 0.780 0.220
#> SRR1040872     3  0.0000      0.842 0.000 0.000 1.000 0.000
#> SRR1040873     2  0.0000      0.799 0.000 1.000 0.000 0.000
#> SRR1040874     3  0.4222      0.807 0.000 0.000 0.728 0.272
#> SRR1040875     3  0.1389      0.835 0.000 0.000 0.952 0.048
#> SRR1040876     3  0.4222      0.807 0.000 0.000 0.728 0.272
#> SRR1040877     3  0.0657      0.840 0.012 0.000 0.984 0.004
#> SRR1040878     4  0.5590      0.759 0.060 0.200 0.012 0.728
#> SRR1040879     2  0.4713      0.507 0.000 0.640 0.000 0.360
#> SRR1040880     3  0.4222      0.807 0.000 0.000 0.728 0.272
#> SRR1040881     2  0.4697      0.515 0.000 0.644 0.000 0.356
#> SRR1040882     3  0.0657      0.840 0.012 0.000 0.984 0.004
#> SRR1040883     3  0.3801      0.823 0.000 0.000 0.780 0.220
#> SRR1040884     3  0.4222      0.807 0.000 0.000 0.728 0.272
#> SRR1040885     3  0.0657      0.840 0.012 0.000 0.984 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
#> SRR1040814     3  0.0000      0.876 0.000 0.000 1.000 0.000 0.000
#> SRR1040813     3  0.0794      0.877 0.028 0.000 0.972 0.000 0.000
#> SRR1040816     1  0.4583      0.422 0.672 0.000 0.000 0.032 0.296
#> SRR1040815     4  0.0609      0.563 0.000 0.020 0.000 0.980 0.000
#> SRR1040817     3  0.0000      0.876 0.000 0.000 1.000 0.000 0.000
#> SRR1040818     4  0.6519      0.454 0.200 0.000 0.000 0.448 0.352
#> SRR1040819     4  0.0609      0.563 0.000 0.020 0.000 0.980 0.000
#> SRR1040820     2  0.3534      0.913 0.000 0.744 0.000 0.256 0.000
#> SRR1040821     2  0.3534      0.913 0.000 0.744 0.000 0.256 0.000
#> SRR1040822     3  0.0162      0.877 0.004 0.000 0.996 0.000 0.000
#> SRR1040823     3  0.0609      0.877 0.020 0.000 0.980 0.000 0.000
#> SRR1040824     2  0.3534      0.913 0.000 0.744 0.000 0.256 0.000
#> SRR1040826     3  0.0000      0.876 0.000 0.000 1.000 0.000 0.000
#> SRR1040825     4  0.0162      0.585 0.000 0.004 0.000 0.996 0.000
#> SRR1040827     2  0.3534      0.913 0.000 0.744 0.000 0.256 0.000
#> SRR1040828     4  0.3336      0.652 0.000 0.000 0.000 0.772 0.228
#> SRR1040829     4  0.1965      0.470 0.000 0.096 0.000 0.904 0.000
#> SRR1040830     1  0.2329      0.933 0.876 0.000 0.124 0.000 0.000
#> SRR1040831     1  0.3596      0.908 0.784 0.016 0.200 0.000 0.000
#> SRR1040832     3  0.7483      0.110 0.204 0.000 0.396 0.048 0.352
#> SRR1040833     1  0.2329      0.933 0.876 0.000 0.124 0.000 0.000
#> SRR1040834     3  0.7483      0.110 0.204 0.000 0.396 0.048 0.352
#> SRR1040835     4  0.0000      0.590 0.000 0.000 0.000 1.000 0.000
#> SRR1040836     1  0.2920      0.930 0.852 0.016 0.132 0.000 0.000
#> SRR1040837     2  0.4249      0.841 0.000 0.568 0.000 0.432 0.000
#> SRR1040839     2  0.4219      0.850 0.000 0.584 0.000 0.416 0.000
#> SRR1040838     3  0.3488      0.779 0.168 0.000 0.808 0.000 0.024
#> SRR1040840     2  0.3534      0.913 0.000 0.744 0.000 0.256 0.000
#> SRR1040841     1  0.2329      0.933 0.876 0.000 0.124 0.000 0.000
#> SRR1040843     2  0.4249      0.841 0.000 0.568 0.000 0.432 0.000
#> SRR1040842     5  0.5525      0.000 0.124 0.240 0.000 0.000 0.636
#> SRR1040845     4  0.4249      0.676 0.000 0.000 0.000 0.568 0.432
#> SRR1040844     1  0.2329      0.933 0.876 0.000 0.124 0.000 0.000
#> SRR1040846     2  0.4249      0.841 0.000 0.568 0.000 0.432 0.000
#> SRR1040847     1  0.2329      0.933 0.876 0.000 0.124 0.000 0.000
#> SRR1040849     3  0.1478      0.857 0.064 0.000 0.936 0.000 0.000
#> SRR1040848     2  0.3534      0.913 0.000 0.744 0.000 0.256 0.000
#> SRR1040851     3  0.2648      0.775 0.152 0.000 0.848 0.000 0.000
#> SRR1040850     3  0.0703      0.877 0.024 0.000 0.976 0.000 0.000
#> SRR1040852     3  0.3488      0.779 0.168 0.000 0.808 0.000 0.024
#> SRR1040853     3  0.3488      0.779 0.168 0.000 0.808 0.000 0.024
#> SRR1040854     1  0.3596      0.908 0.784 0.016 0.200 0.000 0.000
#> SRR1040855     3  0.0703      0.877 0.024 0.000 0.976 0.000 0.000
#> SRR1040856     4  0.4249      0.676 0.000 0.000 0.000 0.568 0.432
#> SRR1040857     1  0.3596      0.908 0.784 0.016 0.200 0.000 0.000
#> SRR1040858     1  0.3596      0.908 0.784 0.016 0.200 0.000 0.000
#> SRR1040859     4  0.4249      0.676 0.000 0.000 0.000 0.568 0.432
#> SRR1040860     4  0.4249      0.676 0.000 0.000 0.000 0.568 0.432
#> SRR1040861     3  0.1106      0.874 0.024 0.000 0.964 0.000 0.012
#> SRR1040862     4  0.4533      0.660 0.008 0.000 0.000 0.544 0.448
#> SRR1040863     4  0.4533      0.660 0.008 0.000 0.000 0.544 0.448
#> SRR1040864     3  0.0794      0.876 0.028 0.000 0.972 0.000 0.000
#> SRR1040865     1  0.2471      0.928 0.864 0.000 0.136 0.000 0.000
#> SRR1040866     4  0.4249      0.676 0.000 0.000 0.000 0.568 0.432
#> SRR1040867     3  0.1732      0.861 0.080 0.000 0.920 0.000 0.000
#> SRR1040868     1  0.2471      0.928 0.864 0.000 0.136 0.000 0.000
#> SRR1040869     1  0.3596      0.908 0.784 0.016 0.200 0.000 0.000
#> SRR1040870     3  0.0000      0.876 0.000 0.000 1.000 0.000 0.000
#> SRR1040871     1  0.3663      0.902 0.776 0.016 0.208 0.000 0.000
#> SRR1040872     3  0.1732      0.861 0.080 0.000 0.920 0.000 0.000
#> SRR1040873     2  0.3534      0.913 0.000 0.744 0.000 0.256 0.000
#> SRR1040874     1  0.2329      0.933 0.876 0.000 0.124 0.000 0.000
#> SRR1040875     3  0.3488      0.779 0.168 0.000 0.808 0.000 0.024
#> SRR1040876     1  0.2329      0.933 0.876 0.000 0.124 0.000 0.000
#> SRR1040877     3  0.0000      0.876 0.000 0.000 1.000 0.000 0.000
#> SRR1040878     4  0.4855      0.659 0.024 0.000 0.000 0.552 0.424
#> SRR1040879     4  0.0000      0.590 0.000 0.000 0.000 1.000 0.000
#> SRR1040880     1  0.2825      0.930 0.860 0.016 0.124 0.000 0.000
#> SRR1040881     4  0.0162      0.585 0.000 0.004 0.000 0.996 0.000
#> SRR1040882     3  0.0290      0.878 0.008 0.000 0.992 0.000 0.000
#> SRR1040883     1  0.3663      0.902 0.776 0.016 0.208 0.000 0.000
#> SRR1040884     1  0.2329      0.933 0.876 0.000 0.124 0.000 0.000
#> SRR1040885     3  0.0000      0.876 0.000 0.000 1.000 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>            class entropy silhouette    p1    p2    p3    p4    p5    p6
#> SRR1040814     3  0.0458    0.77575 0.000 0.000 0.984 0.000 0.016 0.000
#> SRR1040813     3  0.3135    0.78901 0.124 0.000 0.836 0.000 0.028 0.012
#> SRR1040816     1  0.3741    0.41600 0.672 0.000 0.000 0.320 0.000 0.008
#> SRR1040815     6  0.1075    0.79410 0.000 0.048 0.000 0.000 0.000 0.952
#> SRR1040817     3  0.0458    0.77575 0.000 0.000 0.984 0.000 0.016 0.000
#> SRR1040818     6  0.5887   -0.00348 0.200 0.000 0.000 0.392 0.000 0.408
#> SRR1040819     6  0.1075    0.79410 0.000 0.048 0.000 0.000 0.000 0.952
#> SRR1040820     2  0.0000    0.91116 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR1040821     2  0.0000    0.91116 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR1040822     3  0.0405    0.78187 0.008 0.000 0.988 0.000 0.004 0.000
#> SRR1040823     3  0.1858    0.79582 0.076 0.000 0.912 0.000 0.000 0.012
#> SRR1040824     2  0.0000    0.91116 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR1040826     3  0.0458    0.77575 0.000 0.000 0.984 0.000 0.016 0.000
#> SRR1040825     6  0.1151    0.80318 0.000 0.032 0.000 0.012 0.000 0.956
#> SRR1040827     2  0.0000    0.91116 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR1040828     6  0.3151    0.54503 0.000 0.000 0.000 0.252 0.000 0.748
#> SRR1040829     6  0.3515    0.49013 0.000 0.324 0.000 0.000 0.000 0.676
#> SRR1040830     1  0.0000    0.80635 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR1040831     1  0.4950    0.68615 0.652 0.000 0.184 0.000 0.164 0.000
#> SRR1040832     3  0.6122    0.11165 0.204 0.000 0.396 0.392 0.000 0.008
#> SRR1040833     1  0.0000    0.80635 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR1040834     3  0.6122    0.11165 0.204 0.000 0.396 0.392 0.000 0.008
#> SRR1040835     6  0.1168    0.80201 0.000 0.028 0.000 0.016 0.000 0.956
#> SRR1040836     1  0.1918    0.78520 0.904 0.000 0.008 0.000 0.088 0.000
#> SRR1040837     2  0.2597    0.83432 0.000 0.824 0.000 0.000 0.000 0.176
#> SRR1040839     2  0.2454    0.84330 0.000 0.840 0.000 0.000 0.000 0.160
#> SRR1040838     3  0.5027    0.69150 0.268 0.000 0.656 0.024 0.040 0.012
#> SRR1040840     2  0.0000    0.91116 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR1040841     1  0.0000    0.80635 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR1040843     2  0.2597    0.83432 0.000 0.824 0.000 0.000 0.000 0.176
#> SRR1040842     5  0.3352    0.00000 0.000 0.000 0.000 0.176 0.792 0.032
#> SRR1040845     4  0.2219    0.98263 0.000 0.000 0.000 0.864 0.000 0.136
#> SRR1040844     1  0.0000    0.80635 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR1040846     2  0.2597    0.83432 0.000 0.824 0.000 0.000 0.000 0.176
#> SRR1040847     1  0.0000    0.80635 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR1040849     3  0.1829    0.74788 0.024 0.000 0.920 0.000 0.056 0.000
#> SRR1040848     2  0.0000    0.91116 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR1040851     3  0.3167    0.67024 0.096 0.000 0.832 0.000 0.072 0.000
#> SRR1040850     3  0.3416    0.78318 0.124 0.000 0.820 0.000 0.044 0.012
#> SRR1040852     3  0.5027    0.69150 0.268 0.000 0.656 0.024 0.040 0.012
#> SRR1040853     3  0.5027    0.69150 0.268 0.000 0.656 0.024 0.040 0.012
#> SRR1040854     1  0.4950    0.68615 0.652 0.000 0.184 0.000 0.164 0.000
#> SRR1040855     3  0.3281    0.78583 0.124 0.000 0.828 0.000 0.036 0.012
#> SRR1040856     4  0.2219    0.98263 0.000 0.000 0.000 0.864 0.000 0.136
#> SRR1040857     1  0.4950    0.68615 0.652 0.000 0.184 0.000 0.164 0.000
#> SRR1040858     1  0.4950    0.68615 0.652 0.000 0.184 0.000 0.164 0.000
#> SRR1040859     4  0.2219    0.98263 0.000 0.000 0.000 0.864 0.000 0.136
#> SRR1040860     4  0.2219    0.98263 0.000 0.000 0.000 0.864 0.000 0.136
#> SRR1040861     3  0.3766    0.78029 0.124 0.000 0.808 0.012 0.044 0.012
#> SRR1040862     4  0.2494    0.96354 0.000 0.000 0.000 0.864 0.016 0.120
#> SRR1040863     4  0.2494    0.96354 0.000 0.000 0.000 0.864 0.016 0.120
#> SRR1040864     3  0.3392    0.78318 0.128 0.000 0.820 0.000 0.040 0.012
#> SRR1040865     1  0.0363    0.79828 0.988 0.000 0.012 0.000 0.000 0.000
#> SRR1040866     4  0.2219    0.98263 0.000 0.000 0.000 0.864 0.000 0.136
#> SRR1040867     3  0.3861    0.78343 0.144 0.000 0.784 0.000 0.060 0.012
#> SRR1040868     1  0.0363    0.79828 0.988 0.000 0.012 0.000 0.000 0.000
#> SRR1040869     1  0.4950    0.68615 0.652 0.000 0.184 0.000 0.164 0.000
#> SRR1040870     3  0.0458    0.77575 0.000 0.000 0.984 0.000 0.016 0.000
#> SRR1040871     1  0.5005    0.68049 0.644 0.000 0.192 0.000 0.164 0.000
#> SRR1040872     3  0.3861    0.78343 0.144 0.000 0.784 0.000 0.060 0.012
#> SRR1040873     2  0.0000    0.91116 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR1040874     1  0.0000    0.80635 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR1040875     3  0.4877    0.69859 0.264 0.000 0.668 0.024 0.032 0.012
#> SRR1040876     1  0.0000    0.80635 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR1040877     3  0.0458    0.77575 0.000 0.000 0.984 0.000 0.016 0.000
#> SRR1040878     4  0.2662    0.95149 0.024 0.000 0.000 0.856 0.000 0.120
#> SRR1040879     6  0.1168    0.80201 0.000 0.028 0.000 0.016 0.000 0.956
#> SRR1040880     1  0.1663    0.78565 0.912 0.000 0.000 0.000 0.088 0.000
#> SRR1040881     6  0.1151    0.80318 0.000 0.032 0.000 0.012 0.000 0.956
#> SRR1040882     3  0.1461    0.79126 0.044 0.000 0.940 0.000 0.016 0.000
#> SRR1040883     1  0.5005    0.68049 0.644 0.000 0.192 0.000 0.164 0.000
#> SRR1040884     1  0.0000    0.80635 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR1040885     3  0.0458    0.77575 0.000 0.000 0.984 0.000 0.016 0.000

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

consensus_heatmap(res, k = 2)

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

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

collect_plots(res)

plot of chunk SD-kmeans-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 1.000           0.978       0.991         0.4834 0.514   0.514
#> 3 3 0.569           0.548       0.677         0.3590 0.765   0.578
#> 4 4 0.603           0.688       0.796         0.1339 0.812   0.526
#> 5 5 0.720           0.681       0.758         0.0687 0.895   0.624
#> 6 6 0.751           0.587       0.732         0.0392 0.910   0.610

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
#> SRR1040814     1   0.000      0.997 1.000 0.000
#> SRR1040813     1   0.000      0.997 1.000 0.000
#> SRR1040816     1   0.000      0.997 1.000 0.000
#> SRR1040815     2   0.000      0.980 0.000 1.000
#> SRR1040817     1   0.000      0.997 1.000 0.000
#> SRR1040818     2   0.000      0.980 0.000 1.000
#> SRR1040819     2   0.000      0.980 0.000 1.000
#> SRR1040820     2   0.000      0.980 0.000 1.000
#> SRR1040821     2   0.000      0.980 0.000 1.000
#> SRR1040822     1   0.000      0.997 1.000 0.000
#> SRR1040823     1   0.000      0.997 1.000 0.000
#> SRR1040824     2   0.000      0.980 0.000 1.000
#> SRR1040826     1   0.000      0.997 1.000 0.000
#> SRR1040825     2   0.000      0.980 0.000 1.000
#> SRR1040827     2   0.000      0.980 0.000 1.000
#> SRR1040828     2   0.000      0.980 0.000 1.000
#> SRR1040829     2   0.000      0.980 0.000 1.000
#> SRR1040830     1   0.000      0.997 1.000 0.000
#> SRR1040831     1   0.000      0.997 1.000 0.000
#> SRR1040832     2   0.932      0.471 0.348 0.652
#> SRR1040833     1   0.000      0.997 1.000 0.000
#> SRR1040834     1   0.000      0.997 1.000 0.000
#> SRR1040835     2   0.000      0.980 0.000 1.000
#> SRR1040836     1   0.000      0.997 1.000 0.000
#> SRR1040837     2   0.000      0.980 0.000 1.000
#> SRR1040839     2   0.000      0.980 0.000 1.000
#> SRR1040838     1   0.000      0.997 1.000 0.000
#> SRR1040840     2   0.000      0.980 0.000 1.000
#> SRR1040841     1   0.000      0.997 1.000 0.000
#> SRR1040843     2   0.000      0.980 0.000 1.000
#> SRR1040842     2   0.000      0.980 0.000 1.000
#> SRR1040845     2   0.000      0.980 0.000 1.000
#> SRR1040844     1   0.000      0.997 1.000 0.000
#> SRR1040846     2   0.000      0.980 0.000 1.000
#> SRR1040847     1   0.000      0.997 1.000 0.000
#> SRR1040849     1   0.000      0.997 1.000 0.000
#> SRR1040848     2   0.000      0.980 0.000 1.000
#> SRR1040851     1   0.000      0.997 1.000 0.000
#> SRR1040850     1   0.000      0.997 1.000 0.000
#> SRR1040852     1   0.000      0.997 1.000 0.000
#> SRR1040853     1   0.000      0.997 1.000 0.000
#> SRR1040854     1   0.000      0.997 1.000 0.000
#> SRR1040855     1   0.000      0.997 1.000 0.000
#> SRR1040856     2   0.000      0.980 0.000 1.000
#> SRR1040857     1   0.000      0.997 1.000 0.000
#> SRR1040858     1   0.000      0.997 1.000 0.000
#> SRR1040859     2   0.000      0.980 0.000 1.000
#> SRR1040860     2   0.000      0.980 0.000 1.000
#> SRR1040861     1   0.000      0.997 1.000 0.000
#> SRR1040862     2   0.000      0.980 0.000 1.000
#> SRR1040863     2   0.000      0.980 0.000 1.000
#> SRR1040864     1   0.000      0.997 1.000 0.000
#> SRR1040865     1   0.000      0.997 1.000 0.000
#> SRR1040866     2   0.722      0.748 0.200 0.800
#> SRR1040867     1   0.000      0.997 1.000 0.000
#> SRR1040868     1   0.000      0.997 1.000 0.000
#> SRR1040869     1   0.000      0.997 1.000 0.000
#> SRR1040870     1   0.000      0.997 1.000 0.000
#> SRR1040871     1   0.000      0.997 1.000 0.000
#> SRR1040872     1   0.000      0.997 1.000 0.000
#> SRR1040873     2   0.000      0.980 0.000 1.000
#> SRR1040874     1   0.000      0.997 1.000 0.000
#> SRR1040875     1   0.000      0.997 1.000 0.000
#> SRR1040876     1   0.000      0.997 1.000 0.000
#> SRR1040877     1   0.000      0.997 1.000 0.000
#> SRR1040878     1   0.529      0.860 0.880 0.120
#> SRR1040879     2   0.000      0.980 0.000 1.000
#> SRR1040880     1   0.000      0.997 1.000 0.000
#> SRR1040881     2   0.000      0.980 0.000 1.000
#> SRR1040882     1   0.000      0.997 1.000 0.000
#> SRR1040883     1   0.000      0.997 1.000 0.000
#> SRR1040884     1   0.000      0.997 1.000 0.000
#> SRR1040885     1   0.000      0.997 1.000 0.000

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>            class entropy silhouette    p1    p2    p3
#> SRR1040814     1  0.0747     0.6594 0.984 0.016 0.000
#> SRR1040813     1  0.1289     0.6364 0.968 0.000 0.032
#> SRR1040816     2  0.9892    -0.5092 0.268 0.392 0.340
#> SRR1040815     2  0.6126     0.7269 0.000 0.600 0.400
#> SRR1040817     1  0.0747     0.6594 0.984 0.016 0.000
#> SRR1040818     3  0.1411     0.6041 0.000 0.036 0.964
#> SRR1040819     2  0.6126     0.7269 0.000 0.600 0.400
#> SRR1040820     2  0.6111     0.7323 0.000 0.604 0.396
#> SRR1040821     2  0.6111     0.7323 0.000 0.604 0.396
#> SRR1040822     1  0.0592     0.6582 0.988 0.012 0.000
#> SRR1040823     1  0.5529     0.3649 0.704 0.000 0.296
#> SRR1040824     2  0.6095     0.7313 0.000 0.608 0.392
#> SRR1040826     1  0.1163     0.6367 0.972 0.000 0.028
#> SRR1040825     2  0.6140     0.7225 0.000 0.596 0.404
#> SRR1040827     2  0.6095     0.7313 0.000 0.608 0.392
#> SRR1040828     3  0.4002     0.5225 0.000 0.160 0.840
#> SRR1040829     2  0.6111     0.7323 0.000 0.604 0.396
#> SRR1040830     2  0.9717    -0.6235 0.388 0.392 0.220
#> SRR1040831     1  0.6095     0.6894 0.608 0.392 0.000
#> SRR1040832     3  0.1636     0.6155 0.020 0.016 0.964
#> SRR1040833     1  0.8943     0.6592 0.480 0.392 0.128
#> SRR1040834     3  0.6753     0.3132 0.388 0.016 0.596
#> SRR1040835     3  0.5988    -0.1831 0.000 0.368 0.632
#> SRR1040836     1  0.8943     0.6592 0.480 0.392 0.128
#> SRR1040837     2  0.6111     0.7323 0.000 0.604 0.396
#> SRR1040839     2  0.6111     0.7323 0.000 0.604 0.396
#> SRR1040838     3  0.6154     0.3026 0.408 0.000 0.592
#> SRR1040840     2  0.6111     0.7323 0.000 0.604 0.396
#> SRR1040841     1  0.8943     0.6592 0.480 0.392 0.128
#> SRR1040843     2  0.6111     0.7323 0.000 0.604 0.396
#> SRR1040842     3  0.4261     0.5675 0.012 0.140 0.848
#> SRR1040845     3  0.3412     0.5667 0.000 0.124 0.876
#> SRR1040844     1  0.8943     0.6592 0.480 0.392 0.128
#> SRR1040846     2  0.6111     0.7323 0.000 0.604 0.396
#> SRR1040847     1  0.8943     0.6592 0.480 0.392 0.128
#> SRR1040849     1  0.0237     0.6516 0.996 0.000 0.004
#> SRR1040848     2  0.6095     0.7313 0.000 0.608 0.392
#> SRR1040851     1  0.6026     0.6923 0.624 0.376 0.000
#> SRR1040850     3  0.6154     0.3026 0.408 0.000 0.592
#> SRR1040852     1  0.6305    -0.0765 0.516 0.000 0.484
#> SRR1040853     1  0.6305    -0.0765 0.516 0.000 0.484
#> SRR1040854     1  0.6026     0.6923 0.624 0.376 0.000
#> SRR1040855     1  0.5138     0.3439 0.748 0.000 0.252
#> SRR1040856     3  0.3752     0.5490 0.000 0.144 0.856
#> SRR1040857     1  0.6026     0.6923 0.624 0.376 0.000
#> SRR1040858     1  0.6095     0.6894 0.608 0.392 0.000
#> SRR1040859     3  0.0000     0.6173 0.000 0.000 1.000
#> SRR1040860     3  0.3551     0.5641 0.000 0.132 0.868
#> SRR1040861     1  0.5098     0.3456 0.752 0.000 0.248
#> SRR1040862     3  0.4002     0.5225 0.000 0.160 0.840
#> SRR1040863     3  0.3551     0.5641 0.000 0.132 0.868
#> SRR1040864     3  0.6140     0.3097 0.404 0.000 0.596
#> SRR1040865     2  0.9737    -0.4853 0.224 0.392 0.384
#> SRR1040866     3  0.1289     0.6211 0.032 0.000 0.968
#> SRR1040867     1  0.0000     0.6537 1.000 0.000 0.000
#> SRR1040868     1  0.8991     0.6567 0.476 0.392 0.132
#> SRR1040869     1  0.6026     0.6923 0.624 0.376 0.000
#> SRR1040870     1  0.0747     0.6594 0.984 0.016 0.000
#> SRR1040871     1  0.6095     0.6894 0.608 0.392 0.000
#> SRR1040872     1  0.1163     0.6367 0.972 0.000 0.028
#> SRR1040873     2  0.6111     0.7323 0.000 0.604 0.396
#> SRR1040874     1  0.8991     0.6567 0.476 0.392 0.132
#> SRR1040875     1  0.5591     0.3822 0.696 0.000 0.304
#> SRR1040876     1  0.8943     0.6592 0.480 0.392 0.128
#> SRR1040877     1  0.0000     0.6537 1.000 0.000 0.000
#> SRR1040878     3  0.3690     0.5930 0.100 0.016 0.884
#> SRR1040879     2  0.6126     0.7269 0.000 0.600 0.400
#> SRR1040880     1  0.8991     0.6567 0.476 0.392 0.132
#> SRR1040881     2  0.6126     0.7269 0.000 0.600 0.400
#> SRR1040882     1  0.0000     0.6537 1.000 0.000 0.000
#> SRR1040883     1  0.6095     0.6894 0.608 0.392 0.000
#> SRR1040884     1  0.6314     0.6893 0.604 0.392 0.004
#> SRR1040885     1  0.1163     0.6367 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
#> SRR1040814     3  0.2530     0.8054 0.112 0.000 0.888 0.000
#> SRR1040813     3  0.6399     0.6529 0.276 0.000 0.620 0.104
#> SRR1040816     1  0.1356     0.7350 0.960 0.000 0.008 0.032
#> SRR1040815     2  0.3634     0.8702 0.000 0.856 0.096 0.048
#> SRR1040817     3  0.2469     0.8075 0.108 0.000 0.892 0.000
#> SRR1040818     4  0.5969     0.6492 0.148 0.020 0.104 0.728
#> SRR1040819     2  0.3301     0.8787 0.000 0.876 0.076 0.048
#> SRR1040820     2  0.0592     0.9265 0.000 0.984 0.000 0.016
#> SRR1040821     2  0.0592     0.9265 0.000 0.984 0.000 0.016
#> SRR1040822     3  0.2469     0.8075 0.108 0.000 0.892 0.000
#> SRR1040823     3  0.6869     0.6074 0.224 0.000 0.596 0.180
#> SRR1040824     2  0.0000     0.9231 0.000 1.000 0.000 0.000
#> SRR1040826     3  0.4605     0.8122 0.108 0.000 0.800 0.092
#> SRR1040825     2  0.5883     0.7448 0.012 0.724 0.104 0.160
#> SRR1040827     2  0.0000     0.9231 0.000 1.000 0.000 0.000
#> SRR1040828     4  0.5200     0.6433 0.016 0.124 0.080 0.780
#> SRR1040829     2  0.0592     0.9265 0.000 0.984 0.000 0.016
#> SRR1040830     1  0.0672     0.7566 0.984 0.000 0.008 0.008
#> SRR1040831     1  0.4284     0.6471 0.764 0.000 0.224 0.012
#> SRR1040832     4  0.4792     0.6856 0.144 0.016 0.044 0.796
#> SRR1040833     1  0.0779     0.7754 0.980 0.000 0.016 0.004
#> SRR1040834     4  0.5955     0.5381 0.328 0.000 0.056 0.616
#> SRR1040835     4  0.6424     0.5262 0.016 0.204 0.104 0.676
#> SRR1040836     1  0.0779     0.7754 0.980 0.000 0.016 0.004
#> SRR1040837     2  0.2840     0.9028 0.000 0.900 0.044 0.056
#> SRR1040839     2  0.0592     0.9265 0.000 0.984 0.000 0.016
#> SRR1040838     4  0.7516     0.1689 0.200 0.000 0.328 0.472
#> SRR1040840     2  0.0592     0.9265 0.000 0.984 0.000 0.016
#> SRR1040841     1  0.0779     0.7754 0.980 0.000 0.016 0.004
#> SRR1040843     2  0.0592     0.9265 0.000 0.984 0.000 0.016
#> SRR1040842     4  0.2266     0.6982 0.000 0.084 0.004 0.912
#> SRR1040845     4  0.3113     0.7044 0.012 0.108 0.004 0.876
#> SRR1040844     1  0.0779     0.7754 0.980 0.000 0.016 0.004
#> SRR1040846     2  0.2751     0.9041 0.000 0.904 0.040 0.056
#> SRR1040847     1  0.0779     0.7754 0.980 0.000 0.016 0.004
#> SRR1040849     3  0.2654     0.8057 0.108 0.000 0.888 0.004
#> SRR1040848     2  0.0336     0.9252 0.000 0.992 0.000 0.008
#> SRR1040851     1  0.5512     0.3088 0.496 0.000 0.488 0.016
#> SRR1040850     4  0.7307     0.0483 0.156 0.000 0.376 0.468
#> SRR1040852     4  0.7526     0.1591 0.200 0.000 0.332 0.468
#> SRR1040853     4  0.7526     0.1591 0.200 0.000 0.332 0.468
#> SRR1040854     1  0.5408     0.3150 0.500 0.000 0.488 0.012
#> SRR1040855     3  0.6916     0.5317 0.176 0.000 0.588 0.236
#> SRR1040856     4  0.2888     0.6985 0.004 0.124 0.000 0.872
#> SRR1040857     1  0.5408     0.3150 0.500 0.000 0.488 0.012
#> SRR1040858     1  0.5290     0.4682 0.584 0.000 0.404 0.012
#> SRR1040859     4  0.2987     0.7063 0.016 0.104 0.000 0.880
#> SRR1040860     4  0.2888     0.6985 0.004 0.124 0.000 0.872
#> SRR1040861     3  0.4610     0.6864 0.020 0.000 0.744 0.236
#> SRR1040862     4  0.2944     0.6936 0.000 0.128 0.004 0.868
#> SRR1040863     4  0.3072     0.6981 0.004 0.124 0.004 0.868
#> SRR1040864     4  0.7204     0.1775 0.156 0.000 0.332 0.512
#> SRR1040865     1  0.2589     0.6572 0.884 0.000 0.000 0.116
#> SRR1040866     4  0.1182     0.7094 0.016 0.016 0.000 0.968
#> SRR1040867     3  0.3160     0.8117 0.108 0.000 0.872 0.020
#> SRR1040868     1  0.0779     0.7754 0.980 0.000 0.016 0.004
#> SRR1040869     1  0.5408     0.3150 0.500 0.000 0.488 0.012
#> SRR1040870     3  0.2530     0.8054 0.112 0.000 0.888 0.000
#> SRR1040871     1  0.5038     0.5577 0.652 0.000 0.336 0.012
#> SRR1040872     3  0.4786     0.8093 0.108 0.000 0.788 0.104
#> SRR1040873     2  0.0592     0.9265 0.000 0.984 0.000 0.016
#> SRR1040874     1  0.0779     0.7754 0.980 0.000 0.016 0.004
#> SRR1040875     3  0.7839     0.2683 0.352 0.000 0.384 0.264
#> SRR1040876     1  0.0779     0.7754 0.980 0.000 0.016 0.004
#> SRR1040877     3  0.2469     0.8075 0.108 0.000 0.892 0.000
#> SRR1040878     4  0.3950     0.6863 0.160 0.008 0.012 0.820
#> SRR1040879     2  0.4297     0.8466 0.000 0.820 0.096 0.084
#> SRR1040880     1  0.0779     0.7754 0.980 0.000 0.016 0.004
#> SRR1040881     2  0.5883     0.7448 0.012 0.724 0.104 0.160
#> SRR1040882     3  0.3978     0.8153 0.108 0.000 0.836 0.056
#> SRR1040883     1  0.5038     0.5577 0.652 0.000 0.336 0.012
#> SRR1040884     1  0.1022     0.7684 0.968 0.000 0.032 0.000
#> SRR1040885     3  0.4786     0.8093 0.108 0.000 0.788 0.104

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>            class entropy silhouette    p1    p2    p3    p4    p5
#> SRR1040814     5  0.4583    0.22156 0.004 0.000 0.464 0.004 0.528
#> SRR1040813     5  0.2171    0.60234 0.064 0.000 0.024 0.000 0.912
#> SRR1040816     1  0.1251    0.84712 0.956 0.000 0.036 0.008 0.000
#> SRR1040815     2  0.4932    0.68237 0.000 0.668 0.280 0.048 0.004
#> SRR1040817     5  0.4572    0.24310 0.004 0.000 0.452 0.004 0.540
#> SRR1040818     4  0.5869    0.63858 0.080 0.016 0.316 0.588 0.000
#> SRR1040819     2  0.4793    0.69759 0.000 0.692 0.256 0.048 0.004
#> SRR1040820     2  0.0510    0.84479 0.000 0.984 0.000 0.016 0.000
#> SRR1040821     2  0.0510    0.84479 0.000 0.984 0.000 0.016 0.000
#> SRR1040822     5  0.4572    0.24310 0.004 0.000 0.452 0.004 0.540
#> SRR1040823     5  0.2050    0.60260 0.064 0.000 0.008 0.008 0.920
#> SRR1040824     2  0.0000    0.84340 0.000 1.000 0.000 0.000 0.000
#> SRR1040826     5  0.3647    0.52656 0.004 0.000 0.228 0.004 0.764
#> SRR1040825     2  0.6734    0.25498 0.000 0.408 0.324 0.268 0.000
#> SRR1040827     2  0.0000    0.84340 0.000 1.000 0.000 0.000 0.000
#> SRR1040828     4  0.3579    0.76830 0.000 0.004 0.240 0.756 0.000
#> SRR1040829     2  0.0727    0.84479 0.000 0.980 0.004 0.012 0.004
#> SRR1040830     1  0.0794    0.86125 0.972 0.000 0.028 0.000 0.000
#> SRR1040831     1  0.4901   -0.00297 0.672 0.000 0.268 0.000 0.060
#> SRR1040832     4  0.5589    0.70419 0.080 0.004 0.248 0.656 0.012
#> SRR1040833     1  0.0000    0.87925 1.000 0.000 0.000 0.000 0.000
#> SRR1040834     1  0.7416    0.08881 0.432 0.000 0.040 0.248 0.280
#> SRR1040835     4  0.5772    0.54758 0.000 0.108 0.328 0.564 0.000
#> SRR1040836     1  0.0000    0.87925 1.000 0.000 0.000 0.000 0.000
#> SRR1040837     2  0.3937    0.78433 0.000 0.808 0.116 0.072 0.004
#> SRR1040839     2  0.0671    0.84466 0.000 0.980 0.000 0.016 0.004
#> SRR1040838     5  0.5668    0.46895 0.116 0.000 0.016 0.204 0.664
#> SRR1040840     2  0.0510    0.84479 0.000 0.984 0.000 0.016 0.000
#> SRR1040841     1  0.0000    0.87925 1.000 0.000 0.000 0.000 0.000
#> SRR1040843     2  0.0960    0.84216 0.000 0.972 0.008 0.016 0.004
#> SRR1040842     4  0.4411    0.70768 0.000 0.004 0.096 0.772 0.128
#> SRR1040845     4  0.0324    0.85525 0.004 0.000 0.004 0.992 0.000
#> SRR1040844     1  0.0000    0.87925 1.000 0.000 0.000 0.000 0.000
#> SRR1040846     2  0.3567    0.79694 0.000 0.832 0.112 0.052 0.004
#> SRR1040847     1  0.0000    0.87925 1.000 0.000 0.000 0.000 0.000
#> SRR1040849     5  0.4538    0.29769 0.004 0.000 0.428 0.004 0.564
#> SRR1040848     2  0.0162    0.84407 0.000 0.996 0.000 0.004 0.000
#> SRR1040851     3  0.6147    0.91372 0.288 0.000 0.544 0.000 0.168
#> SRR1040850     5  0.5560    0.49741 0.068 0.000 0.052 0.180 0.700
#> SRR1040852     5  0.5668    0.46895 0.116 0.000 0.016 0.204 0.664
#> SRR1040853     5  0.5668    0.46895 0.116 0.000 0.016 0.204 0.664
#> SRR1040854     3  0.6177    0.93001 0.304 0.000 0.532 0.000 0.164
#> SRR1040855     5  0.3135    0.59529 0.060 0.000 0.036 0.028 0.876
#> SRR1040856     4  0.1116    0.85382 0.000 0.004 0.028 0.964 0.004
#> SRR1040857     3  0.6177    0.93001 0.304 0.000 0.532 0.000 0.164
#> SRR1040858     3  0.5960    0.91623 0.352 0.000 0.528 0.000 0.120
#> SRR1040859     4  0.0324    0.85525 0.004 0.000 0.004 0.992 0.000
#> SRR1040860     4  0.1116    0.85382 0.000 0.004 0.028 0.964 0.004
#> SRR1040861     5  0.1978    0.60164 0.004 0.000 0.044 0.024 0.928
#> SRR1040862     4  0.1798    0.84677 0.000 0.004 0.064 0.928 0.004
#> SRR1040863     4  0.1798    0.84401 0.000 0.004 0.064 0.928 0.004
#> SRR1040864     5  0.5378    0.38062 0.024 0.000 0.044 0.284 0.648
#> SRR1040865     1  0.3229    0.71013 0.840 0.000 0.032 0.128 0.000
#> SRR1040866     4  0.0324    0.85398 0.004 0.000 0.000 0.992 0.004
#> SRR1040867     5  0.3662    0.49850 0.004 0.000 0.252 0.000 0.744
#> SRR1040868     1  0.0290    0.87506 0.992 0.000 0.008 0.000 0.000
#> SRR1040869     3  0.6163    0.92636 0.300 0.000 0.536 0.000 0.164
#> SRR1040870     5  0.4583    0.22156 0.004 0.000 0.464 0.004 0.528
#> SRR1040871     3  0.5922    0.88031 0.388 0.000 0.504 0.000 0.108
#> SRR1040872     5  0.1892    0.58913 0.004 0.000 0.080 0.000 0.916
#> SRR1040873     2  0.0510    0.84479 0.000 0.984 0.000 0.016 0.000
#> SRR1040874     1  0.0000    0.87925 1.000 0.000 0.000 0.000 0.000
#> SRR1040875     5  0.5729    0.48085 0.180 0.000 0.016 0.140 0.664
#> SRR1040876     1  0.0000    0.87925 1.000 0.000 0.000 0.000 0.000
#> SRR1040877     5  0.4557    0.26685 0.004 0.000 0.440 0.004 0.552
#> SRR1040878     4  0.2416    0.82833 0.032 0.004 0.032 0.916 0.016
#> SRR1040879     2  0.5391    0.63314 0.000 0.616 0.300 0.084 0.000
#> SRR1040880     1  0.0000    0.87925 1.000 0.000 0.000 0.000 0.000
#> SRR1040881     2  0.6710    0.28131 0.000 0.420 0.316 0.264 0.000
#> SRR1040882     5  0.3676    0.52423 0.004 0.000 0.232 0.004 0.760
#> SRR1040883     3  0.5922    0.88031 0.388 0.000 0.504 0.000 0.108
#> SRR1040884     1  0.0162    0.87535 0.996 0.000 0.004 0.000 0.000
#> SRR1040885     5  0.3647    0.52656 0.004 0.000 0.228 0.004 0.764

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>            class entropy silhouette    p1    p2    p3    p4    p5    p6
#> SRR1040814     3  0.2762    0.56473 0.000 0.000 0.804 0.000 0.196 0.000
#> SRR1040813     3  0.5201    0.40701 0.028 0.000 0.648 0.000 0.240 0.084
#> SRR1040816     1  0.2179    0.80661 0.900 0.000 0.000 0.000 0.064 0.036
#> SRR1040815     6  0.4581    0.51320 0.000 0.368 0.000 0.020 0.016 0.596
#> SRR1040817     3  0.2631    0.57914 0.000 0.000 0.820 0.000 0.180 0.000
#> SRR1040818     6  0.4482    0.46126 0.020 0.000 0.000 0.336 0.016 0.628
#> SRR1040819     6  0.4676    0.43607 0.000 0.412 0.000 0.020 0.016 0.552
#> SRR1040820     2  0.0146    0.93497 0.000 0.996 0.000 0.000 0.004 0.000
#> SRR1040821     2  0.0146    0.93497 0.000 0.996 0.000 0.000 0.004 0.000
#> SRR1040822     3  0.2491    0.58864 0.000 0.000 0.836 0.000 0.164 0.000
#> SRR1040823     3  0.6036    0.27235 0.028 0.000 0.536 0.004 0.304 0.128
#> SRR1040824     2  0.0405    0.93202 0.000 0.988 0.000 0.000 0.004 0.008
#> SRR1040826     3  0.0146    0.62935 0.000 0.000 0.996 0.000 0.004 0.000
#> SRR1040825     6  0.4800    0.68806 0.000 0.164 0.000 0.164 0.000 0.672
#> SRR1040827     2  0.0405    0.93202 0.000 0.988 0.000 0.000 0.004 0.008
#> SRR1040828     4  0.5135   -0.00727 0.000 0.000 0.000 0.540 0.092 0.368
#> SRR1040829     2  0.1007    0.92308 0.000 0.956 0.000 0.000 0.044 0.000
#> SRR1040830     1  0.1765    0.83006 0.924 0.000 0.000 0.000 0.052 0.024
#> SRR1040831     1  0.5282    0.22866 0.584 0.000 0.116 0.000 0.296 0.004
#> SRR1040832     6  0.6039    0.09968 0.020 0.000 0.000 0.412 0.140 0.428
#> SRR1040833     1  0.0000    0.87161 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR1040834     1  0.8154    0.11251 0.404 0.000 0.124 0.116 0.248 0.108
#> SRR1040835     6  0.4339    0.53095 0.000 0.020 0.000 0.300 0.016 0.664
#> SRR1040836     1  0.0405    0.86869 0.988 0.000 0.000 0.000 0.004 0.008
#> SRR1040837     2  0.4270    0.67522 0.000 0.756 0.000 0.044 0.036 0.164
#> SRR1040839     2  0.0713    0.92718 0.000 0.972 0.000 0.000 0.028 0.000
#> SRR1040838     5  0.8037    0.02733 0.052 0.000 0.304 0.108 0.344 0.192
#> SRR1040840     2  0.0146    0.93497 0.000 0.996 0.000 0.000 0.004 0.000
#> SRR1040841     1  0.0000    0.87161 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR1040843     2  0.1297    0.91719 0.000 0.948 0.000 0.012 0.040 0.000
#> SRR1040842     4  0.4238    0.65930 0.000 0.000 0.000 0.728 0.092 0.180
#> SRR1040845     4  0.0935    0.82690 0.000 0.000 0.000 0.964 0.004 0.032
#> SRR1040844     1  0.0000    0.87161 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR1040846     2  0.4104    0.69664 0.000 0.768 0.000 0.036 0.036 0.160
#> SRR1040847     1  0.0000    0.87161 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR1040849     3  0.2178    0.60462 0.000 0.000 0.868 0.000 0.132 0.000
#> SRR1040848     2  0.0146    0.93412 0.000 0.996 0.000 0.000 0.004 0.000
#> SRR1040851     5  0.5896    0.31095 0.236 0.000 0.296 0.000 0.468 0.000
#> SRR1040850     5  0.7623   -0.03467 0.028 0.000 0.288 0.072 0.352 0.260
#> SRR1040852     5  0.8041    0.02149 0.052 0.000 0.312 0.108 0.336 0.192
#> SRR1040853     5  0.8041    0.02149 0.052 0.000 0.312 0.108 0.336 0.192
#> SRR1040854     5  0.5911    0.31350 0.240 0.000 0.296 0.000 0.464 0.000
#> SRR1040855     3  0.6645    0.22944 0.028 0.000 0.472 0.012 0.280 0.208
#> SRR1040856     4  0.0363    0.82978 0.000 0.000 0.000 0.988 0.000 0.012
#> SRR1040857     5  0.5911    0.31350 0.240 0.000 0.296 0.000 0.464 0.000
#> SRR1040858     5  0.5908    0.33044 0.284 0.000 0.248 0.000 0.468 0.000
#> SRR1040859     4  0.0858    0.82676 0.000 0.000 0.000 0.968 0.004 0.028
#> SRR1040860     4  0.0260    0.83101 0.000 0.000 0.000 0.992 0.000 0.008
#> SRR1040861     3  0.6147    0.25782 0.004 0.000 0.484 0.008 0.288 0.216
#> SRR1040862     4  0.1995    0.80336 0.000 0.000 0.000 0.912 0.036 0.052
#> SRR1040863     4  0.2350    0.79416 0.000 0.000 0.000 0.888 0.036 0.076
#> SRR1040864     5  0.7693   -0.00208 0.012 0.000 0.256 0.124 0.348 0.260
#> SRR1040865     1  0.5260    0.59989 0.696 0.000 0.000 0.080 0.128 0.096
#> SRR1040866     4  0.1528    0.81286 0.000 0.000 0.000 0.936 0.016 0.048
#> SRR1040867     3  0.4275    0.56846 0.004 0.000 0.728 0.000 0.192 0.076
#> SRR1040868     1  0.0717    0.86493 0.976 0.000 0.000 0.000 0.016 0.008
#> SRR1040869     5  0.5911    0.31350 0.240 0.000 0.296 0.000 0.464 0.000
#> SRR1040870     3  0.2762    0.56473 0.000 0.000 0.804 0.000 0.196 0.000
#> SRR1040871     5  0.5954    0.29311 0.324 0.000 0.204 0.000 0.468 0.004
#> SRR1040872     3  0.4244    0.47849 0.000 0.000 0.720 0.000 0.200 0.080
#> SRR1040873     2  0.0146    0.93497 0.000 0.996 0.000 0.000 0.004 0.000
#> SRR1040874     1  0.0000    0.87161 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR1040875     5  0.8079    0.01847 0.064 0.000 0.312 0.096 0.336 0.192
#> SRR1040876     1  0.0000    0.87161 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR1040877     3  0.2597    0.58266 0.000 0.000 0.824 0.000 0.176 0.000
#> SRR1040878     4  0.3832    0.67434 0.000 0.000 0.000 0.776 0.120 0.104
#> SRR1040879     6  0.4563    0.59483 0.000 0.316 0.000 0.056 0.000 0.628
#> SRR1040880     1  0.0405    0.86869 0.988 0.000 0.000 0.000 0.004 0.008
#> SRR1040881     6  0.4831    0.68885 0.000 0.168 0.000 0.164 0.000 0.668
#> SRR1040882     3  0.0260    0.62874 0.000 0.000 0.992 0.000 0.008 0.000
#> SRR1040883     5  0.5954    0.29311 0.324 0.000 0.204 0.000 0.468 0.004
#> SRR1040884     1  0.0000    0.87161 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR1040885     3  0.0291    0.62890 0.000 0.000 0.992 0.000 0.004 0.004

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

consensus_heatmap(res, k = 2)

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

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

collect_plots(res)

plot of chunk SD-skmeans-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 1.000           0.994       0.997         0.4923 0.509   0.509
#> 3 3 0.915           0.967       0.980         0.3487 0.824   0.655
#> 4 4 0.878           0.940       0.958         0.1090 0.928   0.784
#> 5 5 0.786           0.826       0.873         0.0641 0.914   0.696
#> 6 6 0.791           0.765       0.821         0.0390 0.971   0.866

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

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

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

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

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

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>            class entropy silhouette    p1    p2
#> SRR1040814     1   0.000      0.995 1.000 0.000
#> SRR1040813     1   0.000      0.995 1.000 0.000
#> SRR1040816     1   0.000      0.995 1.000 0.000
#> SRR1040815     2   0.000      1.000 0.000 1.000
#> SRR1040817     1   0.000      0.995 1.000 0.000
#> SRR1040818     2   0.000      1.000 0.000 1.000
#> SRR1040819     2   0.000      1.000 0.000 1.000
#> SRR1040820     2   0.000      1.000 0.000 1.000
#> SRR1040821     2   0.000      1.000 0.000 1.000
#> SRR1040822     1   0.000      0.995 1.000 0.000
#> SRR1040823     1   0.000      0.995 1.000 0.000
#> SRR1040824     2   0.000      1.000 0.000 1.000
#> SRR1040826     1   0.000      0.995 1.000 0.000
#> SRR1040825     2   0.000      1.000 0.000 1.000
#> SRR1040827     2   0.000      1.000 0.000 1.000
#> SRR1040828     2   0.000      1.000 0.000 1.000
#> SRR1040829     2   0.000      1.000 0.000 1.000
#> SRR1040830     1   0.000      0.995 1.000 0.000
#> SRR1040831     1   0.000      0.995 1.000 0.000
#> SRR1040832     2   0.000      1.000 0.000 1.000
#> SRR1040833     1   0.000      0.995 1.000 0.000
#> SRR1040834     1   0.000      0.995 1.000 0.000
#> SRR1040835     2   0.000      1.000 0.000 1.000
#> SRR1040836     1   0.000      0.995 1.000 0.000
#> SRR1040837     2   0.000      1.000 0.000 1.000
#> SRR1040839     2   0.000      1.000 0.000 1.000
#> SRR1040838     1   0.000      0.995 1.000 0.000
#> SRR1040840     2   0.000      1.000 0.000 1.000
#> SRR1040841     1   0.000      0.995 1.000 0.000
#> SRR1040843     2   0.000      1.000 0.000 1.000
#> SRR1040842     2   0.000      1.000 0.000 1.000
#> SRR1040845     2   0.000      1.000 0.000 1.000
#> SRR1040844     1   0.000      0.995 1.000 0.000
#> SRR1040846     2   0.000      1.000 0.000 1.000
#> SRR1040847     1   0.000      0.995 1.000 0.000
#> SRR1040849     1   0.000      0.995 1.000 0.000
#> SRR1040848     2   0.000      1.000 0.000 1.000
#> SRR1040851     1   0.000      0.995 1.000 0.000
#> SRR1040850     1   0.000      0.995 1.000 0.000
#> SRR1040852     1   0.000      0.995 1.000 0.000
#> SRR1040853     1   0.000      0.995 1.000 0.000
#> SRR1040854     1   0.000      0.995 1.000 0.000
#> SRR1040855     1   0.000      0.995 1.000 0.000
#> SRR1040856     2   0.000      1.000 0.000 1.000
#> SRR1040857     1   0.000      0.995 1.000 0.000
#> SRR1040858     1   0.000      0.995 1.000 0.000
#> SRR1040859     2   0.000      1.000 0.000 1.000
#> SRR1040860     2   0.000      1.000 0.000 1.000
#> SRR1040861     1   0.000      0.995 1.000 0.000
#> SRR1040862     2   0.000      1.000 0.000 1.000
#> SRR1040863     2   0.000      1.000 0.000 1.000
#> SRR1040864     1   0.706      0.762 0.808 0.192
#> SRR1040865     1   0.000      0.995 1.000 0.000
#> SRR1040866     2   0.000      1.000 0.000 1.000
#> SRR1040867     1   0.000      0.995 1.000 0.000
#> SRR1040868     1   0.000      0.995 1.000 0.000
#> SRR1040869     1   0.000      0.995 1.000 0.000
#> SRR1040870     1   0.000      0.995 1.000 0.000
#> SRR1040871     1   0.000      0.995 1.000 0.000
#> SRR1040872     1   0.000      0.995 1.000 0.000
#> SRR1040873     2   0.000      1.000 0.000 1.000
#> SRR1040874     1   0.000      0.995 1.000 0.000
#> SRR1040875     1   0.000      0.995 1.000 0.000
#> SRR1040876     1   0.000      0.995 1.000 0.000
#> SRR1040877     1   0.000      0.995 1.000 0.000
#> SRR1040878     2   0.000      1.000 0.000 1.000
#> SRR1040879     2   0.000      1.000 0.000 1.000
#> SRR1040880     1   0.000      0.995 1.000 0.000
#> SRR1040881     2   0.000      1.000 0.000 1.000
#> SRR1040882     1   0.000      0.995 1.000 0.000
#> SRR1040883     1   0.000      0.995 1.000 0.000
#> SRR1040884     1   0.000      0.995 1.000 0.000
#> SRR1040885     1   0.000      0.995 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
#> SRR1040814     3   0.000      1.000 0.000  0 1.000
#> SRR1040813     3   0.000      1.000 0.000  0 1.000
#> SRR1040816     1   0.000      0.929 1.000  0 0.000
#> SRR1040815     2   0.000      1.000 0.000  1 0.000
#> SRR1040817     3   0.000      1.000 0.000  0 1.000
#> SRR1040818     2   0.000      1.000 0.000  1 0.000
#> SRR1040819     2   0.000      1.000 0.000  1 0.000
#> SRR1040820     2   0.000      1.000 0.000  1 0.000
#> SRR1040821     2   0.000      1.000 0.000  1 0.000
#> SRR1040822     3   0.000      1.000 0.000  0 1.000
#> SRR1040823     3   0.000      1.000 0.000  0 1.000
#> SRR1040824     2   0.000      1.000 0.000  1 0.000
#> SRR1040826     3   0.000      1.000 0.000  0 1.000
#> SRR1040825     2   0.000      1.000 0.000  1 0.000
#> SRR1040827     2   0.000      1.000 0.000  1 0.000
#> SRR1040828     2   0.000      1.000 0.000  1 0.000
#> SRR1040829     2   0.000      1.000 0.000  1 0.000
#> SRR1040830     1   0.000      0.929 1.000  0 0.000
#> SRR1040831     1   0.000      0.929 1.000  0 0.000
#> SRR1040832     2   0.000      1.000 0.000  1 0.000
#> SRR1040833     1   0.000      0.929 1.000  0 0.000
#> SRR1040834     1   0.000      0.929 1.000  0 0.000
#> SRR1040835     2   0.000      1.000 0.000  1 0.000
#> SRR1040836     1   0.000      0.929 1.000  0 0.000
#> SRR1040837     2   0.000      1.000 0.000  1 0.000
#> SRR1040839     2   0.000      1.000 0.000  1 0.000
#> SRR1040838     3   0.000      1.000 0.000  0 1.000
#> SRR1040840     2   0.000      1.000 0.000  1 0.000
#> SRR1040841     1   0.000      0.929 1.000  0 0.000
#> SRR1040843     2   0.000      1.000 0.000  1 0.000
#> SRR1040842     2   0.000      1.000 0.000  1 0.000
#> SRR1040845     2   0.000      1.000 0.000  1 0.000
#> SRR1040844     1   0.000      0.929 1.000  0 0.000
#> SRR1040846     2   0.000      1.000 0.000  1 0.000
#> SRR1040847     1   0.000      0.929 1.000  0 0.000
#> SRR1040849     3   0.000      1.000 0.000  0 1.000
#> SRR1040848     2   0.000      1.000 0.000  1 0.000
#> SRR1040851     1   0.510      0.756 0.752  0 0.248
#> SRR1040850     3   0.000      1.000 0.000  0 1.000
#> SRR1040852     3   0.000      1.000 0.000  0 1.000
#> SRR1040853     3   0.000      1.000 0.000  0 1.000
#> SRR1040854     1   0.455      0.818 0.800  0 0.200
#> SRR1040855     3   0.000      1.000 0.000  0 1.000
#> SRR1040856     2   0.000      1.000 0.000  1 0.000
#> SRR1040857     1   0.455      0.818 0.800  0 0.200
#> SRR1040858     1   0.455      0.818 0.800  0 0.200
#> SRR1040859     2   0.000      1.000 0.000  1 0.000
#> SRR1040860     2   0.000      1.000 0.000  1 0.000
#> SRR1040861     3   0.000      1.000 0.000  0 1.000
#> SRR1040862     2   0.000      1.000 0.000  1 0.000
#> SRR1040863     2   0.000      1.000 0.000  1 0.000
#> SRR1040864     3   0.000      1.000 0.000  0 1.000
#> SRR1040865     1   0.000      0.929 1.000  0 0.000
#> SRR1040866     2   0.000      1.000 0.000  1 0.000
#> SRR1040867     3   0.000      1.000 0.000  0 1.000
#> SRR1040868     1   0.000      0.929 1.000  0 0.000
#> SRR1040869     1   0.455      0.818 0.800  0 0.200
#> SRR1040870     3   0.000      1.000 0.000  0 1.000
#> SRR1040871     1   0.445      0.824 0.808  0 0.192
#> SRR1040872     3   0.000      1.000 0.000  0 1.000
#> SRR1040873     2   0.000      1.000 0.000  1 0.000
#> SRR1040874     1   0.000      0.929 1.000  0 0.000
#> SRR1040875     3   0.000      1.000 0.000  0 1.000
#> SRR1040876     1   0.000      0.929 1.000  0 0.000
#> SRR1040877     3   0.000      1.000 0.000  0 1.000
#> SRR1040878     2   0.000      1.000 0.000  1 0.000
#> SRR1040879     2   0.000      1.000 0.000  1 0.000
#> SRR1040880     1   0.000      0.929 1.000  0 0.000
#> SRR1040881     2   0.000      1.000 0.000  1 0.000
#> SRR1040882     3   0.000      1.000 0.000  0 1.000
#> SRR1040883     1   0.445      0.824 0.808  0 0.192
#> SRR1040884     1   0.000      0.929 1.000  0 0.000
#> SRR1040885     3   0.000      1.000 0.000  0 1.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> SRR1040814     3  0.0000      0.991 0.000 0.000 1.000 0.000
#> SRR1040813     3  0.0000      0.991 0.000 0.000 1.000 0.000
#> SRR1040816     1  0.0000      0.915 1.000 0.000 0.000 0.000
#> SRR1040815     2  0.0000      0.940 0.000 1.000 0.000 0.000
#> SRR1040817     3  0.0000      0.991 0.000 0.000 1.000 0.000
#> SRR1040818     2  0.0000      0.940 0.000 1.000 0.000 0.000
#> SRR1040819     2  0.0000      0.940 0.000 1.000 0.000 0.000
#> SRR1040820     2  0.2589      0.924 0.000 0.884 0.000 0.116
#> SRR1040821     2  0.2589      0.924 0.000 0.884 0.000 0.116
#> SRR1040822     3  0.0000      0.991 0.000 0.000 1.000 0.000
#> SRR1040823     3  0.0000      0.991 0.000 0.000 1.000 0.000
#> SRR1040824     2  0.0000      0.940 0.000 1.000 0.000 0.000
#> SRR1040826     3  0.0000      0.991 0.000 0.000 1.000 0.000
#> SRR1040825     2  0.0000      0.940 0.000 1.000 0.000 0.000
#> SRR1040827     2  0.0000      0.940 0.000 1.000 0.000 0.000
#> SRR1040828     2  0.2149      0.931 0.000 0.912 0.000 0.088
#> SRR1040829     2  0.2149      0.931 0.000 0.912 0.000 0.088
#> SRR1040830     1  0.0000      0.915 1.000 0.000 0.000 0.000
#> SRR1040831     1  0.0000      0.915 1.000 0.000 0.000 0.000
#> SRR1040832     2  0.0000      0.940 0.000 1.000 0.000 0.000
#> SRR1040833     1  0.0000      0.915 1.000 0.000 0.000 0.000
#> SRR1040834     1  0.0188      0.913 0.996 0.000 0.004 0.000
#> SRR1040835     2  0.0000      0.940 0.000 1.000 0.000 0.000
#> SRR1040836     1  0.0000      0.915 1.000 0.000 0.000 0.000
#> SRR1040837     2  0.2589      0.924 0.000 0.884 0.000 0.116
#> SRR1040839     2  0.2589      0.924 0.000 0.884 0.000 0.116
#> SRR1040838     3  0.0921      0.981 0.000 0.000 0.972 0.028
#> SRR1040840     2  0.2589      0.924 0.000 0.884 0.000 0.116
#> SRR1040841     1  0.0000      0.915 1.000 0.000 0.000 0.000
#> SRR1040843     2  0.2589      0.924 0.000 0.884 0.000 0.116
#> SRR1040842     4  0.0592      0.985 0.000 0.016 0.000 0.984
#> SRR1040845     4  0.0921      0.998 0.000 0.028 0.000 0.972
#> SRR1040844     1  0.0000      0.915 1.000 0.000 0.000 0.000
#> SRR1040846     2  0.2589      0.924 0.000 0.884 0.000 0.116
#> SRR1040847     1  0.0000      0.915 1.000 0.000 0.000 0.000
#> SRR1040849     3  0.0000      0.991 0.000 0.000 1.000 0.000
#> SRR1040848     2  0.0000      0.940 0.000 1.000 0.000 0.000
#> SRR1040851     1  0.4134      0.745 0.740 0.000 0.260 0.000
#> SRR1040850     3  0.0921      0.981 0.000 0.000 0.972 0.028
#> SRR1040852     3  0.0921      0.981 0.000 0.000 0.972 0.028
#> SRR1040853     3  0.0921      0.981 0.000 0.000 0.972 0.028
#> SRR1040854     1  0.3726      0.806 0.788 0.000 0.212 0.000
#> SRR1040855     3  0.0921      0.981 0.000 0.000 0.972 0.028
#> SRR1040856     4  0.0921      0.998 0.000 0.028 0.000 0.972
#> SRR1040857     1  0.3726      0.806 0.788 0.000 0.212 0.000
#> SRR1040858     1  0.3649      0.812 0.796 0.000 0.204 0.000
#> SRR1040859     4  0.0921      0.998 0.000 0.028 0.000 0.972
#> SRR1040860     4  0.0921      0.998 0.000 0.028 0.000 0.972
#> SRR1040861     3  0.0921      0.981 0.000 0.000 0.972 0.028
#> SRR1040862     4  0.0921      0.998 0.000 0.028 0.000 0.972
#> SRR1040863     4  0.0921      0.998 0.000 0.028 0.000 0.972
#> SRR1040864     3  0.0921      0.981 0.000 0.000 0.972 0.028
#> SRR1040865     1  0.0000      0.915 1.000 0.000 0.000 0.000
#> SRR1040866     4  0.0921      0.998 0.000 0.028 0.000 0.972
#> SRR1040867     3  0.0000      0.991 0.000 0.000 1.000 0.000
#> SRR1040868     1  0.0000      0.915 1.000 0.000 0.000 0.000
#> SRR1040869     1  0.3726      0.806 0.788 0.000 0.212 0.000
#> SRR1040870     3  0.0000      0.991 0.000 0.000 1.000 0.000
#> SRR1040871     1  0.3569      0.817 0.804 0.000 0.196 0.000
#> SRR1040872     3  0.0000      0.991 0.000 0.000 1.000 0.000
#> SRR1040873     2  0.2589      0.924 0.000 0.884 0.000 0.116
#> SRR1040874     1  0.0000      0.915 1.000 0.000 0.000 0.000
#> SRR1040875     3  0.0000      0.991 0.000 0.000 1.000 0.000
#> SRR1040876     1  0.0000      0.915 1.000 0.000 0.000 0.000
#> SRR1040877     3  0.0000      0.991 0.000 0.000 1.000 0.000
#> SRR1040878     4  0.0921      0.998 0.000 0.028 0.000 0.972
#> SRR1040879     2  0.0000      0.940 0.000 1.000 0.000 0.000
#> SRR1040880     1  0.0000      0.915 1.000 0.000 0.000 0.000
#> SRR1040881     2  0.0000      0.940 0.000 1.000 0.000 0.000
#> SRR1040882     3  0.0000      0.991 0.000 0.000 1.000 0.000
#> SRR1040883     1  0.3528      0.820 0.808 0.000 0.192 0.000
#> SRR1040884     1  0.0000      0.915 1.000 0.000 0.000 0.000
#> SRR1040885     3  0.0000      0.991 0.000 0.000 1.000 0.000

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>            class entropy silhouette    p1    p2    p3    p4    p5
#> SRR1040814     3  0.0000      0.768 0.000 0.000 1.000 0.000 0.000
#> SRR1040813     3  0.2074      0.706 0.000 0.000 0.896 0.000 0.104
#> SRR1040816     1  0.0290      0.849 0.992 0.000 0.000 0.000 0.008
#> SRR1040815     2  0.1197      0.914 0.000 0.952 0.000 0.000 0.048
#> SRR1040817     3  0.0000      0.768 0.000 0.000 1.000 0.000 0.000
#> SRR1040818     2  0.1197      0.914 0.000 0.952 0.000 0.000 0.048
#> SRR1040819     2  0.1197      0.914 0.000 0.952 0.000 0.000 0.048
#> SRR1040820     2  0.2462      0.910 0.000 0.880 0.000 0.112 0.008
#> SRR1040821     2  0.2462      0.910 0.000 0.880 0.000 0.112 0.008
#> SRR1040822     3  0.0000      0.768 0.000 0.000 1.000 0.000 0.000
#> SRR1040823     3  0.2280      0.684 0.000 0.000 0.880 0.000 0.120
#> SRR1040824     2  0.0609      0.917 0.000 0.980 0.000 0.000 0.020
#> SRR1040826     3  0.2074      0.706 0.000 0.000 0.896 0.000 0.104
#> SRR1040825     2  0.1197      0.914 0.000 0.952 0.000 0.000 0.048
#> SRR1040827     2  0.0290      0.918 0.000 0.992 0.000 0.000 0.008
#> SRR1040828     2  0.2077      0.917 0.000 0.908 0.000 0.084 0.008
#> SRR1040829     2  0.2077      0.917 0.000 0.908 0.000 0.084 0.008
#> SRR1040830     1  0.0162      0.850 0.996 0.000 0.000 0.000 0.004
#> SRR1040831     1  0.1544      0.843 0.932 0.000 0.000 0.000 0.068
#> SRR1040832     2  0.1732      0.899 0.000 0.920 0.000 0.000 0.080
#> SRR1040833     1  0.0000      0.852 1.000 0.000 0.000 0.000 0.000
#> SRR1040834     1  0.3309      0.713 0.836 0.000 0.128 0.000 0.036
#> SRR1040835     2  0.1197      0.914 0.000 0.952 0.000 0.000 0.048
#> SRR1040836     1  0.3196      0.805 0.804 0.000 0.000 0.004 0.192
#> SRR1040837     2  0.2462      0.910 0.000 0.880 0.000 0.112 0.008
#> SRR1040839     2  0.2462      0.910 0.000 0.880 0.000 0.112 0.008
#> SRR1040838     5  0.3730      0.996 0.000 0.000 0.288 0.000 0.712
#> SRR1040840     2  0.2462      0.910 0.000 0.880 0.000 0.112 0.008
#> SRR1040841     1  0.0000      0.852 1.000 0.000 0.000 0.000 0.000
#> SRR1040843     2  0.2462      0.910 0.000 0.880 0.000 0.112 0.008
#> SRR1040842     4  0.3809      0.688 0.000 0.008 0.000 0.736 0.256
#> SRR1040845     4  0.0162      0.964 0.000 0.004 0.000 0.996 0.000
#> SRR1040844     1  0.0000      0.852 1.000 0.000 0.000 0.000 0.000
#> SRR1040846     2  0.2462      0.910 0.000 0.880 0.000 0.112 0.008
#> SRR1040847     1  0.0000      0.852 1.000 0.000 0.000 0.000 0.000
#> SRR1040849     3  0.2074      0.706 0.000 0.000 0.896 0.000 0.104
#> SRR1040848     2  0.0963      0.920 0.000 0.964 0.000 0.036 0.000
#> SRR1040851     3  0.5853      0.487 0.184 0.000 0.624 0.004 0.188
#> SRR1040850     5  0.3707      0.997 0.000 0.000 0.284 0.000 0.716
#> SRR1040852     5  0.3730      0.996 0.000 0.000 0.288 0.000 0.712
#> SRR1040853     5  0.3730      0.996 0.000 0.000 0.288 0.000 0.712
#> SRR1040854     3  0.5997      0.452 0.204 0.000 0.604 0.004 0.188
#> SRR1040855     5  0.3707      0.997 0.000 0.000 0.284 0.000 0.716
#> SRR1040856     4  0.0693      0.957 0.000 0.012 0.000 0.980 0.008
#> SRR1040857     3  0.5997      0.452 0.204 0.000 0.604 0.004 0.188
#> SRR1040858     1  0.6532      0.388 0.492 0.000 0.312 0.004 0.192
#> SRR1040859     4  0.0162      0.964 0.000 0.004 0.000 0.996 0.000
#> SRR1040860     4  0.0162      0.964 0.000 0.004 0.000 0.996 0.000
#> SRR1040861     5  0.3707      0.997 0.000 0.000 0.284 0.000 0.716
#> SRR1040862     4  0.0451      0.963 0.000 0.004 0.000 0.988 0.008
#> SRR1040863     4  0.0451      0.963 0.000 0.004 0.000 0.988 0.008
#> SRR1040864     5  0.3707      0.997 0.000 0.000 0.284 0.000 0.716
#> SRR1040865     1  0.3196      0.805 0.804 0.000 0.000 0.004 0.192
#> SRR1040866     4  0.0162      0.964 0.000 0.004 0.000 0.996 0.000
#> SRR1040867     3  0.0000      0.768 0.000 0.000 1.000 0.000 0.000
#> SRR1040868     1  0.3196      0.805 0.804 0.000 0.000 0.004 0.192
#> SRR1040869     3  0.5913      0.474 0.192 0.000 0.616 0.004 0.188
#> SRR1040870     3  0.0000      0.768 0.000 0.000 1.000 0.000 0.000
#> SRR1040871     1  0.6483      0.426 0.508 0.000 0.296 0.004 0.192
#> SRR1040872     3  0.2074      0.706 0.000 0.000 0.896 0.000 0.104
#> SRR1040873     2  0.2462      0.910 0.000 0.880 0.000 0.112 0.008
#> SRR1040874     1  0.0000      0.852 1.000 0.000 0.000 0.000 0.000
#> SRR1040875     3  0.3461      0.630 0.000 0.000 0.772 0.004 0.224
#> SRR1040876     1  0.0000      0.852 1.000 0.000 0.000 0.000 0.000
#> SRR1040877     3  0.0000      0.768 0.000 0.000 1.000 0.000 0.000
#> SRR1040878     4  0.0324      0.963 0.000 0.004 0.000 0.992 0.004
#> SRR1040879     2  0.1197      0.914 0.000 0.952 0.000 0.000 0.048
#> SRR1040880     1  0.3196      0.805 0.804 0.000 0.000 0.004 0.192
#> SRR1040881     2  0.1197      0.914 0.000 0.952 0.000 0.000 0.048
#> SRR1040882     3  0.0000      0.768 0.000 0.000 1.000 0.000 0.000
#> SRR1040883     1  0.6483      0.426 0.508 0.000 0.296 0.004 0.192
#> SRR1040884     1  0.0609      0.851 0.980 0.000 0.000 0.000 0.020
#> SRR1040885     3  0.2074      0.706 0.000 0.000 0.896 0.000 0.104

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>            class entropy silhouette    p1    p2    p3    p4    p5    p6
#> SRR1040814     3  0.0000     0.7771 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1040813     3  0.1908     0.7355 0.000 0.000 0.900 0.000 0.096 0.004
#> SRR1040816     1  0.0260     0.9335 0.992 0.000 0.000 0.000 0.000 0.008
#> SRR1040815     2  0.3924     0.7756 0.000 0.740 0.000 0.000 0.052 0.208
#> SRR1040817     3  0.0000     0.7771 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1040818     2  0.3924     0.7756 0.000 0.740 0.000 0.000 0.052 0.208
#> SRR1040819     2  0.3924     0.7756 0.000 0.740 0.000 0.000 0.052 0.208
#> SRR1040820     2  0.2003     0.8083 0.000 0.884 0.000 0.116 0.000 0.000
#> SRR1040821     2  0.2003     0.8083 0.000 0.884 0.000 0.116 0.000 0.000
#> SRR1040822     3  0.0146     0.7766 0.000 0.000 0.996 0.000 0.000 0.004
#> SRR1040823     3  0.2191     0.7141 0.000 0.000 0.876 0.000 0.120 0.004
#> SRR1040824     2  0.2581     0.8013 0.000 0.860 0.000 0.000 0.020 0.120
#> SRR1040826     3  0.1806     0.7406 0.000 0.000 0.908 0.000 0.088 0.004
#> SRR1040825     2  0.3924     0.7756 0.000 0.740 0.000 0.000 0.052 0.208
#> SRR1040827     2  0.1594     0.8099 0.000 0.932 0.000 0.000 0.016 0.052
#> SRR1040828     2  0.1714     0.8133 0.000 0.908 0.000 0.092 0.000 0.000
#> SRR1040829     2  0.1714     0.8133 0.000 0.908 0.000 0.092 0.000 0.000
#> SRR1040830     1  0.0146     0.9364 0.996 0.000 0.000 0.000 0.000 0.004
#> SRR1040831     1  0.1387     0.8390 0.932 0.000 0.000 0.000 0.000 0.068
#> SRR1040832     2  0.5106     0.5861 0.000 0.520 0.000 0.000 0.084 0.396
#> SRR1040833     1  0.0000     0.9389 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR1040834     1  0.4594     0.5600 0.708 0.000 0.044 0.000 0.032 0.216
#> SRR1040835     2  0.3924     0.7756 0.000 0.740 0.000 0.000 0.052 0.208
#> SRR1040836     6  0.3862     0.6932 0.476 0.000 0.000 0.000 0.000 0.524
#> SRR1040837     2  0.2003     0.8083 0.000 0.884 0.000 0.116 0.000 0.000
#> SRR1040839     2  0.2003     0.8083 0.000 0.884 0.000 0.116 0.000 0.000
#> SRR1040838     5  0.2118     0.9819 0.000 0.000 0.104 0.000 0.888 0.008
#> SRR1040840     2  0.2003     0.8083 0.000 0.884 0.000 0.116 0.000 0.000
#> SRR1040841     1  0.0000     0.9389 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR1040843     2  0.2003     0.8083 0.000 0.884 0.000 0.116 0.000 0.000
#> SRR1040842     4  0.4631     0.5083 0.000 0.060 0.000 0.620 0.320 0.000
#> SRR1040845     4  0.0508     0.9254 0.000 0.000 0.000 0.984 0.004 0.012
#> SRR1040844     1  0.0000     0.9389 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR1040846     2  0.2003     0.8083 0.000 0.884 0.000 0.116 0.000 0.000
#> SRR1040847     1  0.0000     0.9389 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR1040849     3  0.1610     0.7443 0.000 0.000 0.916 0.000 0.084 0.000
#> SRR1040848     2  0.2101     0.8152 0.000 0.912 0.000 0.052 0.008 0.028
#> SRR1040851     3  0.5087     0.0102 0.080 0.000 0.508 0.000 0.000 0.412
#> SRR1040850     5  0.1663     0.9819 0.000 0.000 0.088 0.000 0.912 0.000
#> SRR1040852     5  0.2165     0.9804 0.000 0.000 0.108 0.000 0.884 0.008
#> SRR1040853     5  0.2165     0.9804 0.000 0.000 0.108 0.000 0.884 0.008
#> SRR1040854     3  0.5322    -0.1205 0.104 0.000 0.472 0.000 0.000 0.424
#> SRR1040855     5  0.1663     0.9819 0.000 0.000 0.088 0.000 0.912 0.000
#> SRR1040856     4  0.1556     0.8907 0.000 0.080 0.000 0.920 0.000 0.000
#> SRR1040857     3  0.5355    -0.1368 0.108 0.000 0.468 0.000 0.000 0.424
#> SRR1040858     6  0.5938     0.6442 0.260 0.000 0.280 0.000 0.000 0.460
#> SRR1040859     4  0.0000     0.9270 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR1040860     4  0.0146     0.9274 0.000 0.004 0.000 0.996 0.000 0.000
#> SRR1040861     5  0.1957     0.9707 0.000 0.000 0.112 0.000 0.888 0.000
#> SRR1040862     4  0.0937     0.9199 0.000 0.040 0.000 0.960 0.000 0.000
#> SRR1040863     4  0.0937     0.9199 0.000 0.040 0.000 0.960 0.000 0.000
#> SRR1040864     5  0.1663     0.9819 0.000 0.000 0.088 0.000 0.912 0.000
#> SRR1040865     6  0.3966     0.6990 0.444 0.000 0.000 0.004 0.000 0.552
#> SRR1040866     4  0.0508     0.9254 0.000 0.000 0.000 0.984 0.004 0.012
#> SRR1040867     3  0.0405     0.7745 0.000 0.000 0.988 0.000 0.004 0.008
#> SRR1040868     6  0.3860     0.6960 0.472 0.000 0.000 0.000 0.000 0.528
#> SRR1040869     3  0.5099    -0.0259 0.080 0.000 0.496 0.000 0.000 0.424
#> SRR1040870     3  0.0000     0.7771 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1040871     6  0.5844     0.6990 0.268 0.000 0.244 0.000 0.000 0.488
#> SRR1040872     3  0.1814     0.7377 0.000 0.000 0.900 0.000 0.100 0.000
#> SRR1040873     2  0.2003     0.8083 0.000 0.884 0.000 0.116 0.000 0.000
#> SRR1040874     1  0.0000     0.9389 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR1040875     3  0.4460     0.4177 0.000 0.000 0.644 0.000 0.052 0.304
#> SRR1040876     1  0.0000     0.9389 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR1040877     3  0.0000     0.7771 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1040878     4  0.1082     0.9147 0.000 0.000 0.000 0.956 0.004 0.040
#> SRR1040879     2  0.3924     0.7756 0.000 0.740 0.000 0.000 0.052 0.208
#> SRR1040880     6  0.3866     0.6759 0.484 0.000 0.000 0.000 0.000 0.516
#> SRR1040881     2  0.3924     0.7756 0.000 0.740 0.000 0.000 0.052 0.208
#> SRR1040882     3  0.0291     0.7760 0.000 0.000 0.992 0.000 0.004 0.004
#> SRR1040883     6  0.5860     0.6957 0.268 0.000 0.248 0.000 0.000 0.484
#> SRR1040884     1  0.0547     0.9161 0.980 0.000 0.000 0.000 0.000 0.020
#> SRR1040885     3  0.2100     0.7213 0.000 0.000 0.884 0.000 0.112 0.004

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

consensus_heatmap(res, k = 2)

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

consensus_heatmap(res, k = 3)

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

consensus_heatmap(res, k = 4)

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

consensus_heatmap(res, k = 5)

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

consensus_heatmap(res, k = 6)

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

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

membership_heatmap(res, k = 2)

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

membership_heatmap(res, k = 3)

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

membership_heatmap(res, k = 4)

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

membership_heatmap(res, k = 5)

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

membership_heatmap(res, k = 6)

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

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

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

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

get_signatures(res, k = 3)

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

get_signatures(res, k = 4)

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

get_signatures(res, k = 5)

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

get_signatures(res, k = 6)

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

Signature heatmaps where rows are not scaled:

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

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

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

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

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

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

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

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

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

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

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk SD-skmeans-signature_compare

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

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

An example of the output of tb is:

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

The columns in tb are:

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

UMAP plot which shows how samples are separated.

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

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

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

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

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

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

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

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

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

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

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk SD-skmeans-collect-classes

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

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

collect_plots(res)

plot of chunk SD-pam-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 1.000           0.973       0.989         0.4922 0.505   0.505
#> 3 3 0.834           0.889       0.941         0.3666 0.756   0.546
#> 4 4 0.738           0.595       0.743         0.0914 0.849   0.591
#> 5 5 0.890           0.869       0.942         0.0797 0.837   0.482
#> 6 6 0.846           0.882       0.916         0.0485 0.953   0.775

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
#> SRR1040814     1   0.000      1.000 1.000 0.000
#> SRR1040813     1   0.000      1.000 1.000 0.000
#> SRR1040816     1   0.000      1.000 1.000 0.000
#> SRR1040815     2   0.000      0.974 0.000 1.000
#> SRR1040817     1   0.000      1.000 1.000 0.000
#> SRR1040818     2   0.000      0.974 0.000 1.000
#> SRR1040819     2   0.000      0.974 0.000 1.000
#> SRR1040820     2   0.000      0.974 0.000 1.000
#> SRR1040821     2   0.000      0.974 0.000 1.000
#> SRR1040822     1   0.000      1.000 1.000 0.000
#> SRR1040823     1   0.000      1.000 1.000 0.000
#> SRR1040824     2   0.000      0.974 0.000 1.000
#> SRR1040826     1   0.000      1.000 1.000 0.000
#> SRR1040825     2   0.000      0.974 0.000 1.000
#> SRR1040827     2   0.000      0.974 0.000 1.000
#> SRR1040828     2   0.000      0.974 0.000 1.000
#> SRR1040829     2   0.000      0.974 0.000 1.000
#> SRR1040830     1   0.000      1.000 1.000 0.000
#> SRR1040831     1   0.000      1.000 1.000 0.000
#> SRR1040832     2   0.000      0.974 0.000 1.000
#> SRR1040833     1   0.000      1.000 1.000 0.000
#> SRR1040834     1   0.000      1.000 1.000 0.000
#> SRR1040835     2   0.000      0.974 0.000 1.000
#> SRR1040836     1   0.000      1.000 1.000 0.000
#> SRR1040837     2   0.000      0.974 0.000 1.000
#> SRR1040839     2   0.000      0.974 0.000 1.000
#> SRR1040838     1   0.000      1.000 1.000 0.000
#> SRR1040840     2   0.000      0.974 0.000 1.000
#> SRR1040841     1   0.000      1.000 1.000 0.000
#> SRR1040843     2   0.000      0.974 0.000 1.000
#> SRR1040842     2   0.000      0.974 0.000 1.000
#> SRR1040845     2   0.000      0.974 0.000 1.000
#> SRR1040844     1   0.000      1.000 1.000 0.000
#> SRR1040846     2   0.000      0.974 0.000 1.000
#> SRR1040847     1   0.000      1.000 1.000 0.000
#> SRR1040849     1   0.000      1.000 1.000 0.000
#> SRR1040848     2   0.000      0.974 0.000 1.000
#> SRR1040851     1   0.000      1.000 1.000 0.000
#> SRR1040850     1   0.000      1.000 1.000 0.000
#> SRR1040852     1   0.000      1.000 1.000 0.000
#> SRR1040853     1   0.000      1.000 1.000 0.000
#> SRR1040854     1   0.000      1.000 1.000 0.000
#> SRR1040855     1   0.000      1.000 1.000 0.000
#> SRR1040856     2   0.000      0.974 0.000 1.000
#> SRR1040857     1   0.000      1.000 1.000 0.000
#> SRR1040858     1   0.000      1.000 1.000 0.000
#> SRR1040859     2   0.000      0.974 0.000 1.000
#> SRR1040860     2   0.000      0.974 0.000 1.000
#> SRR1040861     1   0.000      1.000 1.000 0.000
#> SRR1040862     2   0.000      0.974 0.000 1.000
#> SRR1040863     2   0.000      0.974 0.000 1.000
#> SRR1040864     2   0.971      0.355 0.400 0.600
#> SRR1040865     1   0.000      1.000 1.000 0.000
#> SRR1040866     2   0.000      0.974 0.000 1.000
#> SRR1040867     1   0.000      1.000 1.000 0.000
#> SRR1040868     1   0.000      1.000 1.000 0.000
#> SRR1040869     1   0.000      1.000 1.000 0.000
#> SRR1040870     1   0.000      1.000 1.000 0.000
#> SRR1040871     1   0.000      1.000 1.000 0.000
#> SRR1040872     1   0.000      1.000 1.000 0.000
#> SRR1040873     2   0.000      0.974 0.000 1.000
#> SRR1040874     1   0.000      1.000 1.000 0.000
#> SRR1040875     1   0.000      1.000 1.000 0.000
#> SRR1040876     1   0.000      1.000 1.000 0.000
#> SRR1040877     1   0.000      1.000 1.000 0.000
#> SRR1040878     2   0.949      0.435 0.368 0.632
#> SRR1040879     2   0.000      0.974 0.000 1.000
#> SRR1040880     1   0.000      1.000 1.000 0.000
#> SRR1040881     2   0.000      0.974 0.000 1.000
#> SRR1040882     1   0.000      1.000 1.000 0.000
#> SRR1040883     1   0.000      1.000 1.000 0.000
#> SRR1040884     1   0.000      1.000 1.000 0.000
#> SRR1040885     1   0.000      1.000 1.000 0.000

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>            class entropy silhouette    p1    p2    p3
#> SRR1040814     1  0.0000      0.878 1.000 0.000 0.000
#> SRR1040813     3  0.6079      0.219 0.388 0.000 0.612
#> SRR1040816     1  0.4555      0.829 0.800 0.000 0.200
#> SRR1040815     2  0.0000      0.997 0.000 1.000 0.000
#> SRR1040817     1  0.0000      0.878 1.000 0.000 0.000
#> SRR1040818     2  0.0000      0.997 0.000 1.000 0.000
#> SRR1040819     2  0.0000      0.997 0.000 1.000 0.000
#> SRR1040820     2  0.0000      0.997 0.000 1.000 0.000
#> SRR1040821     2  0.0000      0.997 0.000 1.000 0.000
#> SRR1040822     1  0.0000      0.878 1.000 0.000 0.000
#> SRR1040823     3  0.0237      0.906 0.004 0.000 0.996
#> SRR1040824     2  0.0000      0.997 0.000 1.000 0.000
#> SRR1040826     3  0.5882      0.596 0.348 0.000 0.652
#> SRR1040825     2  0.0000      0.997 0.000 1.000 0.000
#> SRR1040827     2  0.0000      0.997 0.000 1.000 0.000
#> SRR1040828     2  0.0000      0.997 0.000 1.000 0.000
#> SRR1040829     2  0.0000      0.997 0.000 1.000 0.000
#> SRR1040830     1  0.4555      0.829 0.800 0.000 0.200
#> SRR1040831     1  0.0000      0.878 1.000 0.000 0.000
#> SRR1040832     3  0.0000      0.907 0.000 0.000 1.000
#> SRR1040833     1  0.4504      0.831 0.804 0.000 0.196
#> SRR1040834     3  0.0000      0.907 0.000 0.000 1.000
#> SRR1040835     2  0.0000      0.997 0.000 1.000 0.000
#> SRR1040836     1  0.4555      0.829 0.800 0.000 0.200
#> SRR1040837     2  0.0000      0.997 0.000 1.000 0.000
#> SRR1040839     2  0.0000      0.997 0.000 1.000 0.000
#> SRR1040838     3  0.0000      0.907 0.000 0.000 1.000
#> SRR1040840     2  0.0000      0.997 0.000 1.000 0.000
#> SRR1040841     1  0.4555      0.829 0.800 0.000 0.200
#> SRR1040843     2  0.0000      0.997 0.000 1.000 0.000
#> SRR1040842     2  0.0000      0.997 0.000 1.000 0.000
#> SRR1040845     2  0.2356      0.916 0.000 0.928 0.072
#> SRR1040844     1  0.4555      0.829 0.800 0.000 0.200
#> SRR1040846     2  0.0000      0.997 0.000 1.000 0.000
#> SRR1040847     1  0.4555      0.829 0.800 0.000 0.200
#> SRR1040849     3  0.5397      0.696 0.280 0.000 0.720
#> SRR1040848     2  0.0000      0.997 0.000 1.000 0.000
#> SRR1040851     1  0.0000      0.878 1.000 0.000 0.000
#> SRR1040850     3  0.0000      0.907 0.000 0.000 1.000
#> SRR1040852     3  0.0000      0.907 0.000 0.000 1.000
#> SRR1040853     3  0.0000      0.907 0.000 0.000 1.000
#> SRR1040854     1  0.0000      0.878 1.000 0.000 0.000
#> SRR1040855     3  0.0424      0.905 0.008 0.000 0.992
#> SRR1040856     2  0.0000      0.997 0.000 1.000 0.000
#> SRR1040857     1  0.0000      0.878 1.000 0.000 0.000
#> SRR1040858     1  0.0000      0.878 1.000 0.000 0.000
#> SRR1040859     3  0.0237      0.905 0.000 0.004 0.996
#> SRR1040860     2  0.0000      0.997 0.000 1.000 0.000
#> SRR1040861     3  0.1031      0.897 0.024 0.000 0.976
#> SRR1040862     2  0.0000      0.997 0.000 1.000 0.000
#> SRR1040863     2  0.0237      0.993 0.000 0.996 0.004
#> SRR1040864     3  0.0000      0.907 0.000 0.000 1.000
#> SRR1040865     3  0.0000      0.907 0.000 0.000 1.000
#> SRR1040866     3  0.0000      0.907 0.000 0.000 1.000
#> SRR1040867     3  0.1529      0.888 0.040 0.000 0.960
#> SRR1040868     1  0.6308      0.265 0.508 0.000 0.492
#> SRR1040869     1  0.0000      0.878 1.000 0.000 0.000
#> SRR1040870     1  0.0000      0.878 1.000 0.000 0.000
#> SRR1040871     1  0.0000      0.878 1.000 0.000 0.000
#> SRR1040872     3  0.4452      0.770 0.192 0.000 0.808
#> SRR1040873     2  0.0000      0.997 0.000 1.000 0.000
#> SRR1040874     1  0.4555      0.829 0.800 0.000 0.200
#> SRR1040875     3  0.0000      0.907 0.000 0.000 1.000
#> SRR1040876     1  0.4555      0.829 0.800 0.000 0.200
#> SRR1040877     3  0.5138      0.725 0.252 0.000 0.748
#> SRR1040878     3  0.0000      0.907 0.000 0.000 1.000
#> SRR1040879     2  0.0000      0.997 0.000 1.000 0.000
#> SRR1040880     1  0.4555      0.829 0.800 0.000 0.200
#> SRR1040881     2  0.0000      0.997 0.000 1.000 0.000
#> SRR1040882     1  0.0424      0.877 0.992 0.000 0.008
#> SRR1040883     1  0.0000      0.878 1.000 0.000 0.000
#> SRR1040884     1  0.0592      0.877 0.988 0.000 0.012
#> SRR1040885     3  0.4555      0.763 0.200 0.000 0.800

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> SRR1040814     3  0.4977      0.485 0.000 0.000 0.540 0.460
#> SRR1040813     4  0.5723      0.674 0.032 0.000 0.388 0.580
#> SRR1040816     1  0.4981      0.999 0.536 0.000 0.000 0.464
#> SRR1040815     2  0.0000      0.723 0.000 1.000 0.000 0.000
#> SRR1040817     3  0.4977      0.485 0.000 0.000 0.540 0.460
#> SRR1040818     2  0.4564      0.256 0.328 0.672 0.000 0.000
#> SRR1040819     2  0.0000      0.723 0.000 1.000 0.000 0.000
#> SRR1040820     2  0.4981      0.760 0.464 0.536 0.000 0.000
#> SRR1040821     2  0.4981      0.760 0.464 0.536 0.000 0.000
#> SRR1040822     3  0.4977      0.485 0.000 0.000 0.540 0.460
#> SRR1040823     4  0.4977      0.793 0.000 0.000 0.460 0.540
#> SRR1040824     2  0.4164      0.755 0.264 0.736 0.000 0.000
#> SRR1040826     3  0.0592      0.157 0.000 0.000 0.984 0.016
#> SRR1040825     2  0.0000      0.723 0.000 1.000 0.000 0.000
#> SRR1040827     2  0.4916      0.755 0.424 0.576 0.000 0.000
#> SRR1040828     2  0.1211      0.729 0.040 0.960 0.000 0.000
#> SRR1040829     2  0.4981      0.760 0.464 0.536 0.000 0.000
#> SRR1040830     1  0.4981      0.999 0.536 0.000 0.000 0.464
#> SRR1040831     4  0.7368     -0.832 0.376 0.000 0.164 0.460
#> SRR1040832     4  0.4977      0.793 0.000 0.000 0.460 0.540
#> SRR1040833     1  0.4981      0.999 0.536 0.000 0.000 0.464
#> SRR1040834     4  0.4977      0.793 0.000 0.000 0.460 0.540
#> SRR1040835     2  0.0000      0.723 0.000 1.000 0.000 0.000
#> SRR1040836     1  0.4981      0.999 0.536 0.000 0.000 0.464
#> SRR1040837     2  0.4977      0.761 0.460 0.540 0.000 0.000
#> SRR1040839     2  0.4977      0.761 0.460 0.540 0.000 0.000
#> SRR1040838     4  0.4977      0.793 0.000 0.000 0.460 0.540
#> SRR1040840     2  0.4981      0.760 0.464 0.536 0.000 0.000
#> SRR1040841     1  0.4981      0.999 0.536 0.000 0.000 0.464
#> SRR1040843     2  0.4977      0.761 0.460 0.540 0.000 0.000
#> SRR1040842     2  0.5957      0.421 0.040 0.540 0.420 0.000
#> SRR1040845     2  0.3198      0.692 0.040 0.880 0.000 0.080
#> SRR1040844     1  0.4981      0.999 0.536 0.000 0.000 0.464
#> SRR1040846     2  0.4977      0.761 0.460 0.540 0.000 0.000
#> SRR1040847     1  0.4981      0.999 0.536 0.000 0.000 0.464
#> SRR1040849     3  0.0000      0.184 0.000 0.000 1.000 0.000
#> SRR1040848     2  0.4981      0.760 0.464 0.536 0.000 0.000
#> SRR1040851     3  0.4977      0.485 0.000 0.000 0.540 0.460
#> SRR1040850     4  0.4977      0.793 0.000 0.000 0.460 0.540
#> SRR1040852     4  0.4977      0.793 0.000 0.000 0.460 0.540
#> SRR1040853     4  0.4977      0.793 0.000 0.000 0.460 0.540
#> SRR1040854     3  0.4977      0.485 0.000 0.000 0.540 0.460
#> SRR1040855     4  0.4977      0.793 0.000 0.000 0.460 0.540
#> SRR1040856     2  0.5950      0.426 0.040 0.544 0.416 0.000
#> SRR1040857     3  0.4977      0.485 0.000 0.000 0.540 0.460
#> SRR1040858     3  0.4977      0.485 0.000 0.000 0.540 0.460
#> SRR1040859     4  0.4977      0.793 0.000 0.000 0.460 0.540
#> SRR1040860     2  0.5957      0.421 0.040 0.540 0.420 0.000
#> SRR1040861     4  0.4996      0.768 0.000 0.000 0.484 0.516
#> SRR1040862     2  0.1211      0.729 0.040 0.960 0.000 0.000
#> SRR1040863     2  0.6128      0.414 0.040 0.536 0.420 0.004
#> SRR1040864     4  0.4977      0.793 0.000 0.000 0.460 0.540
#> SRR1040865     4  0.4977      0.793 0.000 0.000 0.460 0.540
#> SRR1040866     4  0.4977      0.793 0.000 0.000 0.460 0.540
#> SRR1040867     3  0.4989     -0.744 0.000 0.000 0.528 0.472
#> SRR1040868     4  0.5600     -0.775 0.376 0.000 0.028 0.596
#> SRR1040869     3  0.4977      0.485 0.000 0.000 0.540 0.460
#> SRR1040870     3  0.4977      0.485 0.000 0.000 0.540 0.460
#> SRR1040871     3  0.4977      0.485 0.000 0.000 0.540 0.460
#> SRR1040872     3  0.4843     -0.641 0.000 0.000 0.604 0.396
#> SRR1040873     2  0.4981      0.760 0.464 0.536 0.000 0.000
#> SRR1040874     1  0.4981      0.999 0.536 0.000 0.000 0.464
#> SRR1040875     4  0.4977      0.793 0.000 0.000 0.460 0.540
#> SRR1040876     1  0.4981      0.999 0.536 0.000 0.000 0.464
#> SRR1040877     3  0.0000      0.184 0.000 0.000 1.000 0.000
#> SRR1040878     4  0.4977      0.793 0.000 0.000 0.460 0.540
#> SRR1040879     2  0.0000      0.723 0.000 1.000 0.000 0.000
#> SRR1040880     1  0.4981      0.999 0.536 0.000 0.000 0.464
#> SRR1040881     2  0.0000      0.723 0.000 1.000 0.000 0.000
#> SRR1040882     4  0.5155     -0.686 0.004 0.000 0.468 0.528
#> SRR1040883     3  0.4977      0.485 0.000 0.000 0.540 0.460
#> SRR1040884     1  0.5147      0.992 0.536 0.000 0.004 0.460
#> SRR1040885     3  0.0592      0.157 0.000 0.000 0.984 0.016

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>            class entropy silhouette    p1    p2    p3    p4    p5
#> SRR1040814     3  0.0000    0.90189 0.000 0.000 1.000 0.000 0.000
#> SRR1040813     5  0.1831    0.87438 0.076 0.000 0.004 0.000 0.920
#> SRR1040816     1  0.0000    0.97361 1.000 0.000 0.000 0.000 0.000
#> SRR1040815     4  0.0000    0.97972 0.000 0.000 0.000 1.000 0.000
#> SRR1040817     3  0.0000    0.90189 0.000 0.000 1.000 0.000 0.000
#> SRR1040818     4  0.0000    0.97972 0.000 0.000 0.000 1.000 0.000
#> SRR1040819     4  0.0000    0.97972 0.000 0.000 0.000 1.000 0.000
#> SRR1040820     2  0.0000    0.92476 0.000 1.000 0.000 0.000 0.000
#> SRR1040821     2  0.0000    0.92476 0.000 1.000 0.000 0.000 0.000
#> SRR1040822     3  0.0000    0.90189 0.000 0.000 1.000 0.000 0.000
#> SRR1040823     5  0.0771    0.90215 0.004 0.000 0.020 0.000 0.976
#> SRR1040824     2  0.3109    0.75998 0.000 0.800 0.000 0.200 0.000
#> SRR1040826     3  0.3796    0.60448 0.000 0.000 0.700 0.000 0.300
#> SRR1040825     4  0.0000    0.97972 0.000 0.000 0.000 1.000 0.000
#> SRR1040827     2  0.1043    0.90135 0.000 0.960 0.000 0.040 0.000
#> SRR1040828     4  0.1205    0.95322 0.000 0.040 0.000 0.956 0.004
#> SRR1040829     2  0.0000    0.92476 0.000 1.000 0.000 0.000 0.000
#> SRR1040830     1  0.0000    0.97361 1.000 0.000 0.000 0.000 0.000
#> SRR1040831     1  0.2852    0.78076 0.828 0.000 0.172 0.000 0.000
#> SRR1040832     5  0.0290    0.90578 0.000 0.000 0.000 0.008 0.992
#> SRR1040833     1  0.0000    0.97361 1.000 0.000 0.000 0.000 0.000
#> SRR1040834     5  0.0703    0.90613 0.024 0.000 0.000 0.000 0.976
#> SRR1040835     4  0.0000    0.97972 0.000 0.000 0.000 1.000 0.000
#> SRR1040836     1  0.0000    0.97361 1.000 0.000 0.000 0.000 0.000
#> SRR1040837     2  0.3636    0.66334 0.000 0.728 0.000 0.272 0.000
#> SRR1040839     2  0.0880    0.91447 0.000 0.968 0.000 0.032 0.000
#> SRR1040838     5  0.0703    0.90613 0.024 0.000 0.000 0.000 0.976
#> SRR1040840     2  0.0000    0.92476 0.000 1.000 0.000 0.000 0.000
#> SRR1040841     1  0.0000    0.97361 1.000 0.000 0.000 0.000 0.000
#> SRR1040843     2  0.0880    0.91447 0.000 0.968 0.000 0.032 0.000
#> SRR1040842     5  0.1915    0.86755 0.000 0.040 0.000 0.032 0.928
#> SRR1040845     4  0.1741    0.94479 0.000 0.040 0.000 0.936 0.024
#> SRR1040844     1  0.0000    0.97361 1.000 0.000 0.000 0.000 0.000
#> SRR1040846     2  0.3109    0.76610 0.000 0.800 0.000 0.200 0.000
#> SRR1040847     1  0.0000    0.97361 1.000 0.000 0.000 0.000 0.000
#> SRR1040849     3  0.3109    0.74335 0.000 0.000 0.800 0.000 0.200
#> SRR1040848     2  0.0000    0.92476 0.000 1.000 0.000 0.000 0.000
#> SRR1040851     3  0.0162    0.90228 0.004 0.000 0.996 0.000 0.000
#> SRR1040850     5  0.0609    0.90696 0.020 0.000 0.000 0.000 0.980
#> SRR1040852     5  0.0703    0.90613 0.024 0.000 0.000 0.000 0.976
#> SRR1040853     5  0.0609    0.90696 0.020 0.000 0.000 0.000 0.980
#> SRR1040854     3  0.0162    0.90228 0.004 0.000 0.996 0.000 0.000
#> SRR1040855     5  0.0703    0.90002 0.000 0.000 0.024 0.000 0.976
#> SRR1040856     5  0.4129    0.67754 0.000 0.040 0.000 0.204 0.756
#> SRR1040857     3  0.0162    0.90228 0.004 0.000 0.996 0.000 0.000
#> SRR1040858     3  0.0162    0.90228 0.004 0.000 0.996 0.000 0.000
#> SRR1040859     5  0.0000    0.90565 0.000 0.000 0.000 0.000 1.000
#> SRR1040860     5  0.2813    0.82226 0.000 0.040 0.000 0.084 0.876
#> SRR1040861     5  0.1478    0.87256 0.000 0.000 0.064 0.000 0.936
#> SRR1040862     4  0.1741    0.94479 0.000 0.040 0.000 0.936 0.024
#> SRR1040863     5  0.1915    0.86755 0.000 0.040 0.000 0.032 0.928
#> SRR1040864     5  0.0000    0.90565 0.000 0.000 0.000 0.000 1.000
#> SRR1040865     5  0.0609    0.90696 0.020 0.000 0.000 0.000 0.980
#> SRR1040866     5  0.0000    0.90565 0.000 0.000 0.000 0.000 1.000
#> SRR1040867     5  0.4302   -0.04929 0.000 0.000 0.480 0.000 0.520
#> SRR1040868     1  0.2074    0.86934 0.896 0.000 0.000 0.000 0.104
#> SRR1040869     3  0.0162    0.90228 0.004 0.000 0.996 0.000 0.000
#> SRR1040870     3  0.0000    0.90189 0.000 0.000 1.000 0.000 0.000
#> SRR1040871     3  0.1043    0.87668 0.040 0.000 0.960 0.000 0.000
#> SRR1040872     5  0.4297   -0.00192 0.000 0.000 0.472 0.000 0.528
#> SRR1040873     2  0.0000    0.92476 0.000 1.000 0.000 0.000 0.000
#> SRR1040874     1  0.0000    0.97361 1.000 0.000 0.000 0.000 0.000
#> SRR1040875     5  0.0703    0.90613 0.024 0.000 0.000 0.000 0.976
#> SRR1040876     1  0.0000    0.97361 1.000 0.000 0.000 0.000 0.000
#> SRR1040877     3  0.0609    0.89357 0.000 0.000 0.980 0.000 0.020
#> SRR1040878     5  0.0000    0.90565 0.000 0.000 0.000 0.000 1.000
#> SRR1040879     4  0.0000    0.97972 0.000 0.000 0.000 1.000 0.000
#> SRR1040880     1  0.0000    0.97361 1.000 0.000 0.000 0.000 0.000
#> SRR1040881     4  0.0000    0.97972 0.000 0.000 0.000 1.000 0.000
#> SRR1040882     3  0.4101    0.53909 0.004 0.000 0.664 0.000 0.332
#> SRR1040883     3  0.0162    0.90228 0.004 0.000 0.996 0.000 0.000
#> SRR1040884     1  0.0000    0.97361 1.000 0.000 0.000 0.000 0.000
#> SRR1040885     3  0.3796    0.60448 0.000 0.000 0.700 0.000 0.300

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>            class entropy silhouette    p1    p2    p3    p4    p5    p6
#> SRR1040814     3  0.0000      0.857 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1040813     5  0.2750      0.813 0.020 0.000 0.136 0.000 0.844 0.000
#> SRR1040816     1  0.0000      0.918 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR1040815     6  0.0000      0.989 0.000 0.000 0.000 0.000 0.000 1.000
#> SRR1040817     3  0.0000      0.857 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1040818     6  0.0000      0.989 0.000 0.000 0.000 0.000 0.000 1.000
#> SRR1040819     6  0.0000      0.989 0.000 0.000 0.000 0.000 0.000 1.000
#> SRR1040820     2  0.0000      0.923 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR1040821     2  0.0000      0.923 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR1040822     3  0.0000      0.857 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1040823     5  0.0000      0.958 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR1040824     2  0.2793      0.749 0.000 0.800 0.000 0.000 0.000 0.200
#> SRR1040826     3  0.2340      0.759 0.000 0.000 0.852 0.000 0.148 0.000
#> SRR1040825     6  0.0000      0.989 0.000 0.000 0.000 0.000 0.000 1.000
#> SRR1040827     2  0.1007      0.898 0.000 0.956 0.000 0.000 0.000 0.044
#> SRR1040828     6  0.1536      0.922 0.000 0.040 0.000 0.016 0.004 0.940
#> SRR1040829     2  0.0458      0.920 0.000 0.984 0.000 0.016 0.000 0.000
#> SRR1040830     1  0.0000      0.918 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR1040831     1  0.4921      0.601 0.656 0.000 0.164 0.180 0.000 0.000
#> SRR1040832     5  0.0000      0.958 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR1040833     1  0.0000      0.918 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR1040834     5  0.0000      0.958 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR1040835     6  0.0000      0.989 0.000 0.000 0.000 0.000 0.000 1.000
#> SRR1040836     1  0.2854      0.789 0.792 0.000 0.000 0.208 0.000 0.000
#> SRR1040837     2  0.3695      0.649 0.000 0.712 0.000 0.016 0.000 0.272
#> SRR1040839     2  0.0458      0.920 0.000 0.984 0.000 0.016 0.000 0.000
#> SRR1040838     5  0.0000      0.958 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR1040840     2  0.0000      0.923 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR1040841     1  0.0000      0.918 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR1040843     2  0.0458      0.920 0.000 0.984 0.000 0.016 0.000 0.000
#> SRR1040842     4  0.3422      0.907 0.000 0.040 0.000 0.792 0.168 0.000
#> SRR1040845     4  0.3422      0.738 0.000 0.040 0.000 0.792 0.000 0.168
#> SRR1040844     1  0.0000      0.918 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR1040846     2  0.3231      0.754 0.000 0.784 0.000 0.016 0.000 0.200
#> SRR1040847     1  0.0000      0.918 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR1040849     3  0.0363      0.853 0.000 0.000 0.988 0.000 0.012 0.000
#> SRR1040848     2  0.0000      0.923 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR1040851     3  0.2994      0.846 0.004 0.000 0.788 0.208 0.000 0.000
#> SRR1040850     5  0.0000      0.958 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR1040852     5  0.0000      0.958 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR1040853     5  0.0000      0.958 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR1040854     3  0.2994      0.846 0.004 0.000 0.788 0.208 0.000 0.000
#> SRR1040855     5  0.0000      0.958 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR1040856     4  0.3422      0.907 0.000 0.040 0.000 0.792 0.168 0.000
#> SRR1040857     3  0.2994      0.846 0.004 0.000 0.788 0.208 0.000 0.000
#> SRR1040858     3  0.2994      0.846 0.004 0.000 0.788 0.208 0.000 0.000
#> SRR1040859     4  0.2969      0.867 0.000 0.000 0.000 0.776 0.224 0.000
#> SRR1040860     4  0.3422      0.907 0.000 0.040 0.000 0.792 0.168 0.000
#> SRR1040861     5  0.2219      0.827 0.000 0.000 0.136 0.000 0.864 0.000
#> SRR1040862     4  0.3422      0.738 0.000 0.040 0.000 0.792 0.000 0.168
#> SRR1040863     4  0.3422      0.907 0.000 0.040 0.000 0.792 0.168 0.000
#> SRR1040864     5  0.0000      0.958 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR1040865     5  0.0000      0.958 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR1040866     4  0.2969      0.867 0.000 0.000 0.000 0.776 0.224 0.000
#> SRR1040867     5  0.0937      0.925 0.000 0.000 0.040 0.000 0.960 0.000
#> SRR1040868     1  0.2562      0.752 0.828 0.000 0.000 0.000 0.172 0.000
#> SRR1040869     3  0.2994      0.846 0.004 0.000 0.788 0.208 0.000 0.000
#> SRR1040870     3  0.0000      0.857 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1040871     3  0.3529      0.829 0.028 0.000 0.764 0.208 0.000 0.000
#> SRR1040872     5  0.2260      0.792 0.000 0.000 0.140 0.000 0.860 0.000
#> SRR1040873     2  0.0000      0.923 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR1040874     1  0.0000      0.918 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR1040875     5  0.0000      0.958 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR1040876     1  0.0000      0.918 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR1040877     3  0.0000      0.857 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1040878     5  0.0000      0.958 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR1040879     6  0.0000      0.989 0.000 0.000 0.000 0.000 0.000 1.000
#> SRR1040880     1  0.2854      0.789 0.792 0.000 0.000 0.208 0.000 0.000
#> SRR1040881     6  0.0000      0.989 0.000 0.000 0.000 0.000 0.000 1.000
#> SRR1040882     3  0.2964      0.691 0.004 0.000 0.792 0.000 0.204 0.000
#> SRR1040883     3  0.2994      0.846 0.004 0.000 0.788 0.208 0.000 0.000
#> SRR1040884     1  0.0000      0.918 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR1040885     3  0.2340      0.759 0.000 0.000 0.852 0.000 0.148 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 15258 rows and 73 columns.
#>   Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'SD' method.
#>   Subgroups are detected by 'mclust' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 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-mclust-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 1.000           0.960       0.974         0.5034 0.495   0.495
#> 3 3 0.833           0.903       0.932         0.2447 0.877   0.754
#> 4 4 0.827           0.888       0.934         0.1964 0.851   0.616
#> 5 5 0.832           0.788       0.868         0.0535 0.843   0.481
#> 6 6 0.700           0.649       0.817         0.0309 0.937   0.710

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
#> SRR1040814     1   0.000      0.977 1.000 0.000
#> SRR1040813     2   0.388      0.949 0.076 0.924
#> SRR1040816     2   0.388      0.949 0.076 0.924
#> SRR1040815     2   0.000      0.966 0.000 1.000
#> SRR1040817     1   0.000      0.977 1.000 0.000
#> SRR1040818     2   0.000      0.966 0.000 1.000
#> SRR1040819     2   0.000      0.966 0.000 1.000
#> SRR1040820     2   0.000      0.966 0.000 1.000
#> SRR1040821     2   0.000      0.966 0.000 1.000
#> SRR1040822     1   0.000      0.977 1.000 0.000
#> SRR1040823     1   0.745      0.715 0.788 0.212
#> SRR1040824     2   0.000      0.966 0.000 1.000
#> SRR1040826     1   0.000      0.977 1.000 0.000
#> SRR1040825     2   0.000      0.966 0.000 1.000
#> SRR1040827     2   0.000      0.966 0.000 1.000
#> SRR1040828     2   0.000      0.966 0.000 1.000
#> SRR1040829     2   0.000      0.966 0.000 1.000
#> SRR1040830     2   0.388      0.949 0.076 0.924
#> SRR1040831     2   0.388      0.949 0.076 0.924
#> SRR1040832     2   0.388      0.949 0.076 0.924
#> SRR1040833     2   0.388      0.949 0.076 0.924
#> SRR1040834     2   0.388      0.949 0.076 0.924
#> SRR1040835     2   0.000      0.966 0.000 1.000
#> SRR1040836     1   0.000      0.977 1.000 0.000
#> SRR1040837     2   0.000      0.966 0.000 1.000
#> SRR1040839     2   0.000      0.966 0.000 1.000
#> SRR1040838     1   0.000      0.977 1.000 0.000
#> SRR1040840     2   0.000      0.966 0.000 1.000
#> SRR1040841     2   0.388      0.949 0.076 0.924
#> SRR1040843     2   0.000      0.966 0.000 1.000
#> SRR1040842     1   0.388      0.928 0.924 0.076
#> SRR1040845     1   0.388      0.928 0.924 0.076
#> SRR1040844     2   0.388      0.949 0.076 0.924
#> SRR1040846     2   0.000      0.966 0.000 1.000
#> SRR1040847     2   0.388      0.949 0.076 0.924
#> SRR1040849     1   0.000      0.977 1.000 0.000
#> SRR1040848     2   0.000      0.966 0.000 1.000
#> SRR1040851     1   0.000      0.977 1.000 0.000
#> SRR1040850     1   0.000      0.977 1.000 0.000
#> SRR1040852     1   0.000      0.977 1.000 0.000
#> SRR1040853     1   0.000      0.977 1.000 0.000
#> SRR1040854     1   0.000      0.977 1.000 0.000
#> SRR1040855     1   0.000      0.977 1.000 0.000
#> SRR1040856     1   0.388      0.928 0.924 0.076
#> SRR1040857     1   0.000      0.977 1.000 0.000
#> SRR1040858     1   0.000      0.977 1.000 0.000
#> SRR1040859     1   0.388      0.928 0.924 0.076
#> SRR1040860     1   0.388      0.928 0.924 0.076
#> SRR1040861     1   0.000      0.977 1.000 0.000
#> SRR1040862     1   0.388      0.928 0.924 0.076
#> SRR1040863     1   0.388      0.928 0.924 0.076
#> SRR1040864     1   0.000      0.977 1.000 0.000
#> SRR1040865     1   0.000      0.977 1.000 0.000
#> SRR1040866     1   0.343      0.937 0.936 0.064
#> SRR1040867     1   0.000      0.977 1.000 0.000
#> SRR1040868     1   0.000      0.977 1.000 0.000
#> SRR1040869     1   0.000      0.977 1.000 0.000
#> SRR1040870     1   0.000      0.977 1.000 0.000
#> SRR1040871     1   0.000      0.977 1.000 0.000
#> SRR1040872     1   0.000      0.977 1.000 0.000
#> SRR1040873     2   0.000      0.966 0.000 1.000
#> SRR1040874     2   0.388      0.949 0.076 0.924
#> SRR1040875     1   0.000      0.977 1.000 0.000
#> SRR1040876     2   0.388      0.949 0.076 0.924
#> SRR1040877     1   0.000      0.977 1.000 0.000
#> SRR1040878     1   0.000      0.977 1.000 0.000
#> SRR1040879     2   0.000      0.966 0.000 1.000
#> SRR1040880     1   0.000      0.977 1.000 0.000
#> SRR1040881     2   0.000      0.966 0.000 1.000
#> SRR1040882     2   0.388      0.949 0.076 0.924
#> SRR1040883     1   0.000      0.977 1.000 0.000
#> SRR1040884     2   0.388      0.949 0.076 0.924
#> SRR1040885     1   0.000      0.977 1.000 0.000

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>            class entropy silhouette    p1    p2    p3
#> SRR1040814     3  0.2878      0.919 0.096 0.000 0.904
#> SRR1040813     1  0.3610      0.934 0.888 0.096 0.016
#> SRR1040816     1  0.3482      0.924 0.872 0.128 0.000
#> SRR1040815     2  0.0000      0.967 0.000 1.000 0.000
#> SRR1040817     3  0.2878      0.919 0.096 0.000 0.904
#> SRR1040818     1  0.6168      0.440 0.588 0.412 0.000
#> SRR1040819     2  0.0000      0.967 0.000 1.000 0.000
#> SRR1040820     2  0.0000      0.967 0.000 1.000 0.000
#> SRR1040821     2  0.0000      0.967 0.000 1.000 0.000
#> SRR1040822     3  0.2878      0.919 0.096 0.000 0.904
#> SRR1040823     1  0.5823      0.758 0.792 0.064 0.144
#> SRR1040824     2  0.0000      0.967 0.000 1.000 0.000
#> SRR1040826     3  0.3116      0.914 0.108 0.000 0.892
#> SRR1040825     2  0.0000      0.967 0.000 1.000 0.000
#> SRR1040827     2  0.0000      0.967 0.000 1.000 0.000
#> SRR1040828     2  0.0747      0.950 0.016 0.984 0.000
#> SRR1040829     2  0.0000      0.967 0.000 1.000 0.000
#> SRR1040830     2  0.6309     -0.210 0.496 0.504 0.000
#> SRR1040831     1  0.3116      0.938 0.892 0.108 0.000
#> SRR1040832     2  0.1860      0.912 0.052 0.948 0.000
#> SRR1040833     1  0.3116      0.938 0.892 0.108 0.000
#> SRR1040834     1  0.3482      0.924 0.872 0.128 0.000
#> SRR1040835     2  0.0000      0.967 0.000 1.000 0.000
#> SRR1040836     3  0.5678      0.576 0.316 0.000 0.684
#> SRR1040837     2  0.0000      0.967 0.000 1.000 0.000
#> SRR1040839     2  0.0000      0.967 0.000 1.000 0.000
#> SRR1040838     3  0.3116      0.921 0.108 0.000 0.892
#> SRR1040840     2  0.0000      0.967 0.000 1.000 0.000
#> SRR1040841     1  0.2878      0.939 0.904 0.096 0.000
#> SRR1040843     2  0.0000      0.967 0.000 1.000 0.000
#> SRR1040842     3  0.2878      0.919 0.096 0.000 0.904
#> SRR1040845     3  0.1411      0.929 0.036 0.000 0.964
#> SRR1040844     1  0.2878      0.939 0.904 0.096 0.000
#> SRR1040846     2  0.0000      0.967 0.000 1.000 0.000
#> SRR1040847     1  0.2878      0.939 0.904 0.096 0.000
#> SRR1040849     3  0.2878      0.919 0.096 0.000 0.904
#> SRR1040848     2  0.0000      0.967 0.000 1.000 0.000
#> SRR1040851     3  0.0000      0.937 0.000 0.000 1.000
#> SRR1040850     3  0.2878      0.919 0.096 0.000 0.904
#> SRR1040852     3  0.0747      0.934 0.016 0.000 0.984
#> SRR1040853     3  0.0000      0.937 0.000 0.000 1.000
#> SRR1040854     3  0.0000      0.937 0.000 0.000 1.000
#> SRR1040855     3  0.2878      0.919 0.096 0.000 0.904
#> SRR1040856     3  0.1411      0.929 0.036 0.000 0.964
#> SRR1040857     3  0.0000      0.937 0.000 0.000 1.000
#> SRR1040858     3  0.0000      0.937 0.000 0.000 1.000
#> SRR1040859     3  0.1411      0.929 0.036 0.000 0.964
#> SRR1040860     3  0.1411      0.929 0.036 0.000 0.964
#> SRR1040861     3  0.2537      0.924 0.080 0.000 0.920
#> SRR1040862     3  0.1411      0.929 0.036 0.000 0.964
#> SRR1040863     3  0.1411      0.929 0.036 0.000 0.964
#> SRR1040864     3  0.2878      0.919 0.096 0.000 0.904
#> SRR1040865     3  0.1411      0.929 0.036 0.000 0.964
#> SRR1040866     3  0.1411      0.929 0.036 0.000 0.964
#> SRR1040867     3  0.0000      0.937 0.000 0.000 1.000
#> SRR1040868     3  0.5216      0.678 0.260 0.000 0.740
#> SRR1040869     3  0.0000      0.937 0.000 0.000 1.000
#> SRR1040870     3  0.1643      0.932 0.044 0.000 0.956
#> SRR1040871     3  0.0000      0.937 0.000 0.000 1.000
#> SRR1040872     3  0.0424      0.937 0.008 0.000 0.992
#> SRR1040873     2  0.0000      0.967 0.000 1.000 0.000
#> SRR1040874     1  0.2878      0.939 0.904 0.096 0.000
#> SRR1040875     3  0.0000      0.937 0.000 0.000 1.000
#> SRR1040876     1  0.3116      0.938 0.892 0.108 0.000
#> SRR1040877     3  0.2448      0.925 0.076 0.000 0.924
#> SRR1040878     3  0.1411      0.929 0.036 0.000 0.964
#> SRR1040879     2  0.0000      0.967 0.000 1.000 0.000
#> SRR1040880     3  0.5216      0.678 0.260 0.000 0.740
#> SRR1040881     2  0.0000      0.967 0.000 1.000 0.000
#> SRR1040882     1  0.3610      0.934 0.888 0.096 0.016
#> SRR1040883     3  0.0000      0.937 0.000 0.000 1.000
#> SRR1040884     1  0.3610      0.934 0.888 0.096 0.016
#> SRR1040885     3  0.2878      0.919 0.096 0.000 0.904

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> SRR1040814     3  0.1557      0.896 0.000 0.000 0.944 0.056
#> SRR1040813     1  0.0524      0.944 0.988 0.000 0.008 0.004
#> SRR1040816     1  0.0000      0.950 1.000 0.000 0.000 0.000
#> SRR1040815     2  0.0000      0.973 0.000 1.000 0.000 0.000
#> SRR1040817     3  0.0817      0.922 0.000 0.000 0.976 0.024
#> SRR1040818     1  0.3356      0.780 0.824 0.176 0.000 0.000
#> SRR1040819     2  0.0000      0.973 0.000 1.000 0.000 0.000
#> SRR1040820     2  0.0000      0.973 0.000 1.000 0.000 0.000
#> SRR1040821     2  0.0000      0.973 0.000 1.000 0.000 0.000
#> SRR1040822     3  0.1557      0.896 0.000 0.000 0.944 0.056
#> SRR1040823     1  0.5199      0.702 0.756 0.000 0.100 0.144
#> SRR1040824     2  0.0000      0.973 0.000 1.000 0.000 0.000
#> SRR1040826     3  0.1557      0.896 0.000 0.000 0.944 0.056
#> SRR1040825     2  0.0000      0.973 0.000 1.000 0.000 0.000
#> SRR1040827     2  0.0000      0.973 0.000 1.000 0.000 0.000
#> SRR1040828     2  0.3219      0.795 0.164 0.836 0.000 0.000
#> SRR1040829     2  0.0000      0.973 0.000 1.000 0.000 0.000
#> SRR1040830     1  0.3801      0.704 0.780 0.220 0.000 0.000
#> SRR1040831     1  0.0000      0.950 1.000 0.000 0.000 0.000
#> SRR1040832     2  0.4585      0.507 0.332 0.668 0.000 0.000
#> SRR1040833     1  0.0000      0.950 1.000 0.000 0.000 0.000
#> SRR1040834     1  0.0000      0.950 1.000 0.000 0.000 0.000
#> SRR1040835     2  0.0000      0.973 0.000 1.000 0.000 0.000
#> SRR1040836     4  0.4920      0.789 0.068 0.000 0.164 0.768
#> SRR1040837     2  0.0000      0.973 0.000 1.000 0.000 0.000
#> SRR1040839     2  0.0000      0.973 0.000 1.000 0.000 0.000
#> SRR1040838     4  0.3528      0.776 0.000 0.000 0.192 0.808
#> SRR1040840     2  0.0000      0.973 0.000 1.000 0.000 0.000
#> SRR1040841     1  0.0000      0.950 1.000 0.000 0.000 0.000
#> SRR1040843     2  0.0000      0.973 0.000 1.000 0.000 0.000
#> SRR1040842     4  0.3801      0.755 0.000 0.000 0.220 0.780
#> SRR1040845     4  0.1474      0.885 0.000 0.000 0.052 0.948
#> SRR1040844     1  0.0000      0.950 1.000 0.000 0.000 0.000
#> SRR1040846     2  0.0000      0.973 0.000 1.000 0.000 0.000
#> SRR1040847     1  0.0000      0.950 1.000 0.000 0.000 0.000
#> SRR1040849     3  0.0707      0.931 0.000 0.000 0.980 0.020
#> SRR1040848     2  0.0000      0.973 0.000 1.000 0.000 0.000
#> SRR1040851     3  0.1557      0.932 0.000 0.000 0.944 0.056
#> SRR1040850     3  0.4103      0.652 0.000 0.000 0.744 0.256
#> SRR1040852     4  0.3764      0.765 0.000 0.000 0.216 0.784
#> SRR1040853     4  0.4989      0.203 0.000 0.000 0.472 0.528
#> SRR1040854     3  0.1557      0.932 0.000 0.000 0.944 0.056
#> SRR1040855     3  0.1474      0.902 0.000 0.000 0.948 0.052
#> SRR1040856     4  0.1022      0.849 0.000 0.000 0.032 0.968
#> SRR1040857     3  0.1557      0.932 0.000 0.000 0.944 0.056
#> SRR1040858     3  0.1557      0.932 0.000 0.000 0.944 0.056
#> SRR1040859     4  0.1389      0.885 0.000 0.000 0.048 0.952
#> SRR1040860     4  0.1389      0.885 0.000 0.000 0.048 0.952
#> SRR1040861     3  0.1022      0.932 0.000 0.000 0.968 0.032
#> SRR1040862     4  0.1474      0.885 0.000 0.000 0.052 0.948
#> SRR1040863     4  0.1474      0.885 0.000 0.000 0.052 0.948
#> SRR1040864     4  0.4624      0.571 0.000 0.000 0.340 0.660
#> SRR1040865     4  0.1474      0.885 0.000 0.000 0.052 0.948
#> SRR1040866     4  0.1474      0.885 0.000 0.000 0.052 0.948
#> SRR1040867     3  0.1557      0.932 0.000 0.000 0.944 0.056
#> SRR1040868     4  0.1474      0.884 0.000 0.000 0.052 0.948
#> SRR1040869     3  0.1557      0.932 0.000 0.000 0.944 0.056
#> SRR1040870     3  0.0921      0.932 0.000 0.000 0.972 0.028
#> SRR1040871     3  0.1557      0.932 0.000 0.000 0.944 0.056
#> SRR1040872     3  0.1302      0.933 0.000 0.000 0.956 0.044
#> SRR1040873     2  0.0000      0.973 0.000 1.000 0.000 0.000
#> SRR1040874     1  0.0000      0.950 1.000 0.000 0.000 0.000
#> SRR1040875     3  0.4072      0.676 0.000 0.000 0.748 0.252
#> SRR1040876     1  0.0000      0.950 1.000 0.000 0.000 0.000
#> SRR1040877     3  0.1022      0.932 0.000 0.000 0.968 0.032
#> SRR1040878     4  0.1722      0.881 0.008 0.000 0.048 0.944
#> SRR1040879     2  0.0000      0.973 0.000 1.000 0.000 0.000
#> SRR1040880     4  0.1474      0.885 0.000 0.000 0.052 0.948
#> SRR1040881     2  0.0000      0.973 0.000 1.000 0.000 0.000
#> SRR1040882     1  0.0524      0.944 0.988 0.000 0.008 0.004
#> SRR1040883     3  0.1557      0.932 0.000 0.000 0.944 0.056
#> SRR1040884     1  0.0000      0.950 1.000 0.000 0.000 0.000
#> SRR1040885     3  0.1557      0.900 0.000 0.000 0.944 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
#> SRR1040814     5  0.0162     0.8173 0.000 0.000 0.004 0.000 0.996
#> SRR1040813     1  0.1026     0.9219 0.968 0.000 0.024 0.004 0.004
#> SRR1040816     1  0.0771     0.9233 0.976 0.000 0.020 0.004 0.000
#> SRR1040815     2  0.0324     0.9685 0.004 0.992 0.004 0.000 0.000
#> SRR1040817     5  0.1043     0.8133 0.000 0.000 0.040 0.000 0.960
#> SRR1040818     2  0.4717     0.4975 0.308 0.660 0.028 0.004 0.000
#> SRR1040819     2  0.0451     0.9672 0.004 0.988 0.008 0.000 0.000
#> SRR1040820     2  0.0162     0.9690 0.000 0.996 0.004 0.000 0.000
#> SRR1040821     2  0.0162     0.9690 0.000 0.996 0.004 0.000 0.000
#> SRR1040822     5  0.0000     0.8169 0.000 0.000 0.000 0.000 1.000
#> SRR1040823     5  0.5440     0.0567 0.468 0.000 0.048 0.004 0.480
#> SRR1040824     2  0.0162     0.9690 0.000 0.996 0.004 0.000 0.000
#> SRR1040826     5  0.0162     0.8160 0.000 0.000 0.004 0.000 0.996
#> SRR1040825     2  0.0451     0.9672 0.004 0.988 0.008 0.000 0.000
#> SRR1040827     2  0.0162     0.9690 0.000 0.996 0.004 0.000 0.000
#> SRR1040828     1  0.5568     0.2286 0.516 0.412 0.072 0.000 0.000
#> SRR1040829     2  0.1124     0.9514 0.004 0.960 0.036 0.000 0.000
#> SRR1040830     1  0.2270     0.8912 0.908 0.016 0.072 0.004 0.000
#> SRR1040831     1  0.0955     0.9113 0.968 0.000 0.000 0.004 0.028
#> SRR1040832     1  0.4054     0.7667 0.788 0.140 0.072 0.000 0.000
#> SRR1040833     1  0.0404     0.9281 0.988 0.000 0.012 0.000 0.000
#> SRR1040834     1  0.0771     0.9233 0.976 0.000 0.020 0.004 0.000
#> SRR1040835     2  0.2304     0.9035 0.048 0.908 0.044 0.000 0.000
#> SRR1040836     3  0.5190     0.6187 0.004 0.000 0.680 0.228 0.088
#> SRR1040837     2  0.0451     0.9672 0.004 0.988 0.008 0.000 0.000
#> SRR1040839     2  0.0162     0.9690 0.000 0.996 0.004 0.000 0.000
#> SRR1040838     5  0.5664     0.3716 0.000 0.000 0.168 0.200 0.632
#> SRR1040840     2  0.0162     0.9690 0.000 0.996 0.004 0.000 0.000
#> SRR1040841     1  0.0404     0.9281 0.988 0.000 0.012 0.000 0.000
#> SRR1040843     2  0.0000     0.9688 0.000 1.000 0.000 0.000 0.000
#> SRR1040842     5  0.2102     0.7671 0.012 0.000 0.068 0.004 0.916
#> SRR1040845     4  0.0162     0.9679 0.000 0.000 0.000 0.996 0.004
#> SRR1040844     1  0.0404     0.9281 0.988 0.000 0.012 0.000 0.000
#> SRR1040846     2  0.0290     0.9675 0.000 0.992 0.008 0.000 0.000
#> SRR1040847     1  0.0404     0.9281 0.988 0.000 0.012 0.000 0.000
#> SRR1040849     5  0.2020     0.7931 0.000 0.000 0.100 0.000 0.900
#> SRR1040848     2  0.0162     0.9690 0.000 0.996 0.004 0.000 0.000
#> SRR1040851     3  0.3280     0.6868 0.000 0.000 0.812 0.012 0.176
#> SRR1040850     5  0.0932     0.8091 0.004 0.000 0.020 0.004 0.972
#> SRR1040852     5  0.6022     0.1399 0.000 0.000 0.280 0.156 0.564
#> SRR1040853     3  0.5856     0.6380 0.000 0.000 0.604 0.224 0.172
#> SRR1040854     3  0.4505     0.3833 0.000 0.000 0.604 0.012 0.384
#> SRR1040855     5  0.0290     0.8168 0.000 0.000 0.008 0.000 0.992
#> SRR1040856     4  0.1095     0.9540 0.008 0.000 0.012 0.968 0.012
#> SRR1040857     3  0.4464     0.3226 0.000 0.000 0.584 0.008 0.408
#> SRR1040858     3  0.3242     0.6864 0.000 0.000 0.816 0.012 0.172
#> SRR1040859     4  0.0693     0.9601 0.000 0.000 0.012 0.980 0.008
#> SRR1040860     4  0.0162     0.9679 0.000 0.000 0.000 0.996 0.004
#> SRR1040861     5  0.1965     0.7976 0.000 0.000 0.096 0.000 0.904
#> SRR1040862     4  0.0162     0.9679 0.000 0.000 0.000 0.996 0.004
#> SRR1040863     4  0.0162     0.9679 0.000 0.000 0.000 0.996 0.004
#> SRR1040864     5  0.1106     0.8076 0.000 0.000 0.024 0.012 0.964
#> SRR1040865     3  0.5095     0.3579 0.000 0.000 0.560 0.400 0.040
#> SRR1040866     4  0.0162     0.9679 0.000 0.000 0.000 0.996 0.004
#> SRR1040867     5  0.4339     0.4328 0.000 0.000 0.336 0.012 0.652
#> SRR1040868     3  0.5024     0.4889 0.004 0.000 0.628 0.328 0.040
#> SRR1040869     3  0.4622     0.2298 0.000 0.000 0.548 0.012 0.440
#> SRR1040870     5  0.2929     0.7343 0.000 0.000 0.180 0.000 0.820
#> SRR1040871     3  0.2818     0.7009 0.000 0.000 0.856 0.012 0.132
#> SRR1040872     5  0.2886     0.7540 0.000 0.000 0.148 0.008 0.844
#> SRR1040873     2  0.0162     0.9690 0.000 0.996 0.004 0.000 0.000
#> SRR1040874     1  0.0404     0.9281 0.988 0.000 0.012 0.000 0.000
#> SRR1040875     3  0.4364     0.6941 0.000 0.000 0.768 0.120 0.112
#> SRR1040876     1  0.0404     0.9281 0.988 0.000 0.012 0.000 0.000
#> SRR1040877     5  0.2230     0.7879 0.000 0.000 0.116 0.000 0.884
#> SRR1040878     4  0.2929     0.7968 0.000 0.000 0.152 0.840 0.008
#> SRR1040879     2  0.0451     0.9672 0.004 0.988 0.008 0.000 0.000
#> SRR1040880     3  0.4935     0.4659 0.000 0.000 0.616 0.344 0.040
#> SRR1040881     2  0.0451     0.9672 0.004 0.988 0.008 0.000 0.000
#> SRR1040882     1  0.1202     0.9196 0.960 0.000 0.032 0.004 0.004
#> SRR1040883     3  0.2909     0.6999 0.000 0.000 0.848 0.012 0.140
#> SRR1040884     1  0.0162     0.9278 0.996 0.000 0.004 0.000 0.000
#> SRR1040885     5  0.0000     0.8169 0.000 0.000 0.000 0.000 1.000

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>            class entropy silhouette    p1    p2    p3    p4    p5    p6
#> SRR1040814     5  0.1444     0.8313 0.000 0.000 0.072 0.000 0.928 0.000
#> SRR1040813     1  0.3808     0.6890 0.736 0.000 0.000 0.000 0.036 0.228
#> SRR1040816     1  0.2697     0.7523 0.812 0.000 0.000 0.000 0.000 0.188
#> SRR1040815     2  0.4231     0.3891 0.000 0.616 0.008 0.012 0.000 0.364
#> SRR1040817     5  0.1444     0.8313 0.000 0.000 0.072 0.000 0.928 0.000
#> SRR1040818     6  0.6064    -0.0377 0.132 0.420 0.012 0.008 0.000 0.428
#> SRR1040819     2  0.4312     0.3259 0.000 0.584 0.008 0.012 0.000 0.396
#> SRR1040820     2  0.0000     0.7836 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR1040821     2  0.0000     0.7836 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR1040822     5  0.1444     0.8313 0.000 0.000 0.072 0.000 0.928 0.000
#> SRR1040823     1  0.6194     0.3686 0.552 0.000 0.088 0.000 0.272 0.088
#> SRR1040824     2  0.2169     0.7548 0.000 0.900 0.008 0.012 0.000 0.080
#> SRR1040826     5  0.1701     0.8302 0.000 0.000 0.072 0.000 0.920 0.008
#> SRR1040825     2  0.4411     0.1464 0.000 0.504 0.008 0.012 0.000 0.476
#> SRR1040827     2  0.1757     0.7676 0.000 0.928 0.008 0.012 0.000 0.052
#> SRR1040828     6  0.3880     0.4865 0.136 0.044 0.016 0.008 0.000 0.796
#> SRR1040829     6  0.3887     0.2886 0.000 0.360 0.000 0.008 0.000 0.632
#> SRR1040830     6  0.4113     0.2375 0.308 0.000 0.016 0.008 0.000 0.668
#> SRR1040831     1  0.0146     0.8633 0.996 0.000 0.000 0.000 0.004 0.000
#> SRR1040832     6  0.3919     0.3789 0.244 0.004 0.016 0.008 0.000 0.728
#> SRR1040833     1  0.0000     0.8650 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR1040834     1  0.2527     0.7668 0.832 0.000 0.000 0.000 0.000 0.168
#> SRR1040835     6  0.3240     0.4279 0.004 0.244 0.000 0.000 0.000 0.752
#> SRR1040836     3  0.4245     0.3533 0.000 0.000 0.604 0.016 0.376 0.004
#> SRR1040837     2  0.2553     0.6922 0.000 0.848 0.008 0.000 0.000 0.144
#> SRR1040839     2  0.0405     0.7816 0.000 0.988 0.008 0.000 0.000 0.004
#> SRR1040838     5  0.2431     0.7485 0.000 0.000 0.132 0.008 0.860 0.000
#> SRR1040840     2  0.0146     0.7833 0.000 0.996 0.000 0.000 0.000 0.004
#> SRR1040841     1  0.0000     0.8650 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR1040843     2  0.0405     0.7816 0.000 0.988 0.008 0.000 0.000 0.004
#> SRR1040842     5  0.3014     0.7027 0.000 0.000 0.012 0.184 0.804 0.000
#> SRR1040845     4  0.0692     0.8067 0.000 0.000 0.020 0.976 0.004 0.000
#> SRR1040844     1  0.0000     0.8650 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR1040846     2  0.1398     0.7610 0.000 0.940 0.008 0.000 0.000 0.052
#> SRR1040847     1  0.0000     0.8650 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR1040849     5  0.1814     0.8195 0.000 0.000 0.100 0.000 0.900 0.000
#> SRR1040848     2  0.1578     0.7700 0.000 0.936 0.004 0.012 0.000 0.048
#> SRR1040851     3  0.2178     0.7262 0.000 0.000 0.868 0.000 0.132 0.000
#> SRR1040850     5  0.1462     0.7963 0.000 0.000 0.056 0.000 0.936 0.008
#> SRR1040852     5  0.2669     0.7340 0.000 0.000 0.156 0.008 0.836 0.000
#> SRR1040853     3  0.5913     0.4291 0.000 0.000 0.496 0.220 0.280 0.004
#> SRR1040854     3  0.2135     0.7263 0.000 0.000 0.872 0.000 0.128 0.000
#> SRR1040855     5  0.0622     0.8203 0.000 0.000 0.012 0.000 0.980 0.008
#> SRR1040856     4  0.3878     0.7081 0.000 0.000 0.032 0.748 0.212 0.008
#> SRR1040857     3  0.2527     0.7127 0.000 0.000 0.832 0.000 0.168 0.000
#> SRR1040858     3  0.2135     0.7263 0.000 0.000 0.872 0.000 0.128 0.000
#> SRR1040859     4  0.3637     0.7565 0.000 0.000 0.084 0.792 0.124 0.000
#> SRR1040860     4  0.3439     0.7686 0.000 0.000 0.072 0.808 0.120 0.000
#> SRR1040861     5  0.2879     0.7749 0.000 0.000 0.056 0.072 0.864 0.008
#> SRR1040862     4  0.0806     0.8084 0.000 0.000 0.020 0.972 0.008 0.000
#> SRR1040863     4  0.0951     0.8060 0.000 0.000 0.020 0.968 0.004 0.008
#> SRR1040864     5  0.2094     0.7909 0.000 0.000 0.068 0.016 0.908 0.008
#> SRR1040865     3  0.5779     0.3373 0.000 0.000 0.532 0.240 0.224 0.004
#> SRR1040866     4  0.0806     0.8077 0.000 0.000 0.020 0.972 0.008 0.000
#> SRR1040867     3  0.3851     0.3065 0.000 0.000 0.540 0.000 0.460 0.000
#> SRR1040868     3  0.5117     0.5111 0.000 0.000 0.644 0.180 0.172 0.004
#> SRR1040869     3  0.2178     0.7242 0.000 0.000 0.868 0.000 0.132 0.000
#> SRR1040870     5  0.3515     0.5150 0.000 0.000 0.324 0.000 0.676 0.000
#> SRR1040871     3  0.2135     0.7263 0.000 0.000 0.872 0.000 0.128 0.000
#> SRR1040872     5  0.3198     0.5331 0.000 0.000 0.260 0.000 0.740 0.000
#> SRR1040873     2  0.0405     0.7816 0.000 0.988 0.008 0.000 0.000 0.004
#> SRR1040874     1  0.0000     0.8650 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR1040875     3  0.4323     0.6047 0.000 0.000 0.652 0.032 0.312 0.004
#> SRR1040876     1  0.1007     0.8498 0.956 0.000 0.000 0.000 0.000 0.044
#> SRR1040877     5  0.2883     0.7127 0.000 0.000 0.212 0.000 0.788 0.000
#> SRR1040878     4  0.5868     0.2718 0.000 0.000 0.304 0.472 0.224 0.000
#> SRR1040879     6  0.4217    -0.1030 0.000 0.464 0.008 0.004 0.000 0.524
#> SRR1040880     3  0.5136     0.4926 0.000 0.000 0.640 0.196 0.160 0.004
#> SRR1040881     2  0.4400     0.2073 0.000 0.524 0.008 0.012 0.000 0.456
#> SRR1040882     1  0.3344     0.7599 0.804 0.000 0.000 0.000 0.044 0.152
#> SRR1040883     3  0.2135     0.7263 0.000 0.000 0.872 0.000 0.128 0.000
#> SRR1040884     1  0.0000     0.8650 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR1040885     5  0.1701     0.8302 0.000 0.000 0.072 0.000 0.920 0.008

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

consensus_heatmap(res, k = 2)

plot of chunk tab-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 15258 rows and 73 columns.
#>   Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'SD' method.
#>   Subgroups are detected by 'NMF' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 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-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.807           0.877       0.952         0.3922 0.623   0.623
#> 3 3 0.709           0.782       0.903         0.6459 0.664   0.490
#> 4 4 0.494           0.493       0.737         0.0886 0.784   0.514
#> 5 5 0.519           0.492       0.729         0.0706 0.795   0.471
#> 6 6 0.544           0.506       0.725         0.0284 0.894   0.635

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
#> SRR1040814     1  0.0000    0.94807 1.000 0.000
#> SRR1040813     1  0.0000    0.94807 1.000 0.000
#> SRR1040816     1  0.0000    0.94807 1.000 0.000
#> SRR1040815     2  0.0000    0.93695 0.000 1.000
#> SRR1040817     1  0.0000    0.94807 1.000 0.000
#> SRR1040818     1  0.0000    0.94807 1.000 0.000
#> SRR1040819     2  0.0000    0.93695 0.000 1.000
#> SRR1040820     2  0.0000    0.93695 0.000 1.000
#> SRR1040821     2  0.0000    0.93695 0.000 1.000
#> SRR1040822     1  0.0000    0.94807 1.000 0.000
#> SRR1040823     1  0.0000    0.94807 1.000 0.000
#> SRR1040824     2  0.0000    0.93695 0.000 1.000
#> SRR1040826     1  0.0000    0.94807 1.000 0.000
#> SRR1040825     2  0.1184    0.92886 0.016 0.984
#> SRR1040827     2  0.0000    0.93695 0.000 1.000
#> SRR1040828     1  0.7219    0.73401 0.800 0.200
#> SRR1040829     2  0.0000    0.93695 0.000 1.000
#> SRR1040830     1  0.0000    0.94807 1.000 0.000
#> SRR1040831     1  0.0000    0.94807 1.000 0.000
#> SRR1040832     1  0.0000    0.94807 1.000 0.000
#> SRR1040833     1  0.0000    0.94807 1.000 0.000
#> SRR1040834     1  0.0000    0.94807 1.000 0.000
#> SRR1040835     1  0.6247    0.79420 0.844 0.156
#> SRR1040836     1  0.0000    0.94807 1.000 0.000
#> SRR1040837     2  0.7139    0.74506 0.196 0.804
#> SRR1040839     2  0.0000    0.93695 0.000 1.000
#> SRR1040838     1  0.0000    0.94807 1.000 0.000
#> SRR1040840     2  0.0000    0.93695 0.000 1.000
#> SRR1040841     1  0.0000    0.94807 1.000 0.000
#> SRR1040843     2  0.3584    0.88823 0.068 0.932
#> SRR1040842     1  0.9608    0.38045 0.616 0.384
#> SRR1040845     1  0.9922    0.19262 0.552 0.448
#> SRR1040844     1  0.0000    0.94807 1.000 0.000
#> SRR1040846     2  0.7139    0.74506 0.196 0.804
#> SRR1040847     1  0.0000    0.94807 1.000 0.000
#> SRR1040849     1  0.0000    0.94807 1.000 0.000
#> SRR1040848     2  0.0000    0.93695 0.000 1.000
#> SRR1040851     1  0.0000    0.94807 1.000 0.000
#> SRR1040850     1  0.0000    0.94807 1.000 0.000
#> SRR1040852     1  0.0000    0.94807 1.000 0.000
#> SRR1040853     1  0.0000    0.94807 1.000 0.000
#> SRR1040854     1  0.0000    0.94807 1.000 0.000
#> SRR1040855     1  0.0000    0.94807 1.000 0.000
#> SRR1040856     1  0.9775    0.30530 0.588 0.412
#> SRR1040857     1  0.0000    0.94807 1.000 0.000
#> SRR1040858     1  0.0000    0.94807 1.000 0.000
#> SRR1040859     1  0.8016    0.66833 0.756 0.244
#> SRR1040860     1  0.9850    0.25785 0.572 0.428
#> SRR1040861     1  0.0000    0.94807 1.000 0.000
#> SRR1040862     2  0.9993    0.00252 0.484 0.516
#> SRR1040863     1  0.7883    0.68112 0.764 0.236
#> SRR1040864     1  0.0000    0.94807 1.000 0.000
#> SRR1040865     1  0.0000    0.94807 1.000 0.000
#> SRR1040866     1  0.2603    0.90986 0.956 0.044
#> SRR1040867     1  0.0000    0.94807 1.000 0.000
#> SRR1040868     1  0.0000    0.94807 1.000 0.000
#> SRR1040869     1  0.0000    0.94807 1.000 0.000
#> SRR1040870     1  0.0000    0.94807 1.000 0.000
#> SRR1040871     1  0.0000    0.94807 1.000 0.000
#> SRR1040872     1  0.0000    0.94807 1.000 0.000
#> SRR1040873     2  0.0000    0.93695 0.000 1.000
#> SRR1040874     1  0.0000    0.94807 1.000 0.000
#> SRR1040875     1  0.0000    0.94807 1.000 0.000
#> SRR1040876     1  0.0000    0.94807 1.000 0.000
#> SRR1040877     1  0.0000    0.94807 1.000 0.000
#> SRR1040878     1  0.0000    0.94807 1.000 0.000
#> SRR1040879     2  0.0000    0.93695 0.000 1.000
#> SRR1040880     1  0.0000    0.94807 1.000 0.000
#> SRR1040881     2  0.0938    0.93120 0.012 0.988
#> SRR1040882     1  0.0000    0.94807 1.000 0.000
#> SRR1040883     1  0.0000    0.94807 1.000 0.000
#> SRR1040884     1  0.0000    0.94807 1.000 0.000
#> SRR1040885     1  0.0000    0.94807 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
#> SRR1040814     3  0.1643     0.8482 0.044 0.000 0.956
#> SRR1040813     3  0.0747     0.8512 0.016 0.000 0.984
#> SRR1040816     1  0.0000     0.9289 1.000 0.000 0.000
#> SRR1040815     1  0.6280     0.1241 0.540 0.460 0.000
#> SRR1040817     3  0.2261     0.8399 0.068 0.000 0.932
#> SRR1040818     1  0.0000     0.9289 1.000 0.000 0.000
#> SRR1040819     1  0.5591     0.5270 0.696 0.304 0.000
#> SRR1040820     2  0.0000     0.8982 0.000 1.000 0.000
#> SRR1040821     2  0.0000     0.8982 0.000 1.000 0.000
#> SRR1040822     3  0.1411     0.8498 0.036 0.000 0.964
#> SRR1040823     3  0.0237     0.8491 0.004 0.000 0.996
#> SRR1040824     2  0.0000     0.8982 0.000 1.000 0.000
#> SRR1040826     3  0.0000     0.8478 0.000 0.000 1.000
#> SRR1040825     1  0.1411     0.9029 0.964 0.036 0.000
#> SRR1040827     2  0.0000     0.8982 0.000 1.000 0.000
#> SRR1040828     3  0.7080     0.2508 0.024 0.412 0.564
#> SRR1040829     2  0.0000     0.8982 0.000 1.000 0.000
#> SRR1040830     1  0.0000     0.9289 1.000 0.000 0.000
#> SRR1040831     1  0.0000     0.9289 1.000 0.000 0.000
#> SRR1040832     1  0.1860     0.8949 0.948 0.000 0.052
#> SRR1040833     1  0.0000     0.9289 1.000 0.000 0.000
#> SRR1040834     3  0.6095     0.4699 0.392 0.000 0.608
#> SRR1040835     1  0.0424     0.9239 0.992 0.008 0.000
#> SRR1040836     1  0.0237     0.9273 0.996 0.000 0.004
#> SRR1040837     2  0.0424     0.8950 0.000 0.992 0.008
#> SRR1040839     2  0.0000     0.8982 0.000 1.000 0.000
#> SRR1040838     3  0.1529     0.8489 0.040 0.000 0.960
#> SRR1040840     2  0.0000     0.8982 0.000 1.000 0.000
#> SRR1040841     1  0.0000     0.9289 1.000 0.000 0.000
#> SRR1040843     2  0.2711     0.8367 0.000 0.912 0.088
#> SRR1040842     3  0.0424     0.8457 0.000 0.008 0.992
#> SRR1040845     2  0.8466     0.4915 0.212 0.616 0.172
#> SRR1040844     1  0.0000     0.9289 1.000 0.000 0.000
#> SRR1040846     2  0.1163     0.8842 0.000 0.972 0.028
#> SRR1040847     1  0.0000     0.9289 1.000 0.000 0.000
#> SRR1040849     3  0.0237     0.8491 0.004 0.000 0.996
#> SRR1040848     2  0.0000     0.8982 0.000 1.000 0.000
#> SRR1040851     3  0.5650     0.6179 0.312 0.000 0.688
#> SRR1040850     3  0.0000     0.8478 0.000 0.000 1.000
#> SRR1040852     3  0.1411     0.8499 0.036 0.000 0.964
#> SRR1040853     3  0.1163     0.8514 0.028 0.000 0.972
#> SRR1040854     3  0.5810     0.5821 0.336 0.000 0.664
#> SRR1040855     3  0.0000     0.8478 0.000 0.000 1.000
#> SRR1040856     3  0.5988     0.3422 0.000 0.368 0.632
#> SRR1040857     3  0.5785     0.5889 0.332 0.000 0.668
#> SRR1040858     1  0.4062     0.7588 0.836 0.000 0.164
#> SRR1040859     3  0.8793     0.0796 0.112 0.436 0.452
#> SRR1040860     3  0.5810     0.4136 0.000 0.336 0.664
#> SRR1040861     3  0.0000     0.8478 0.000 0.000 1.000
#> SRR1040862     2  0.6308     0.0138 0.000 0.508 0.492
#> SRR1040863     3  0.1031     0.8380 0.000 0.024 0.976
#> SRR1040864     3  0.0000     0.8478 0.000 0.000 1.000
#> SRR1040865     1  0.0892     0.9189 0.980 0.000 0.020
#> SRR1040866     3  0.2947     0.8203 0.020 0.060 0.920
#> SRR1040867     3  0.2625     0.8311 0.084 0.000 0.916
#> SRR1040868     1  0.0000     0.9289 1.000 0.000 0.000
#> SRR1040869     3  0.5497     0.6456 0.292 0.000 0.708
#> SRR1040870     3  0.1163     0.8509 0.028 0.000 0.972
#> SRR1040871     1  0.2959     0.8468 0.900 0.000 0.100
#> SRR1040872     3  0.0237     0.8491 0.004 0.000 0.996
#> SRR1040873     2  0.0000     0.8982 0.000 1.000 0.000
#> SRR1040874     1  0.0000     0.9289 1.000 0.000 0.000
#> SRR1040875     3  0.3816     0.7888 0.148 0.000 0.852
#> SRR1040876     1  0.0000     0.9289 1.000 0.000 0.000
#> SRR1040877     3  0.0747     0.8510 0.016 0.000 0.984
#> SRR1040878     3  0.5882     0.5641 0.348 0.000 0.652
#> SRR1040879     2  0.5678     0.4854 0.316 0.684 0.000
#> SRR1040880     1  0.0000     0.9289 1.000 0.000 0.000
#> SRR1040881     1  0.2796     0.8467 0.908 0.092 0.000
#> SRR1040882     3  0.1753     0.8471 0.048 0.000 0.952
#> SRR1040883     1  0.3267     0.8310 0.884 0.000 0.116
#> SRR1040884     1  0.0892     0.9188 0.980 0.000 0.020
#> SRR1040885     3  0.0000     0.8478 0.000 0.000 1.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> SRR1040814     3  0.4661     0.5925 0.000 0.000 0.652 0.348
#> SRR1040813     4  0.0188     0.3243 0.000 0.000 0.004 0.996
#> SRR1040816     1  0.4907     0.5524 0.580 0.000 0.000 0.420
#> SRR1040815     2  0.4998     0.2326 0.488 0.512 0.000 0.000
#> SRR1040817     3  0.4543     0.6115 0.000 0.000 0.676 0.324
#> SRR1040818     1  0.1022     0.4979 0.968 0.000 0.000 0.032
#> SRR1040819     1  0.2149     0.4652 0.912 0.088 0.000 0.000
#> SRR1040820     2  0.0000     0.8990 0.000 1.000 0.000 0.000
#> SRR1040821     2  0.0000     0.8990 0.000 1.000 0.000 0.000
#> SRR1040822     3  0.4605     0.6032 0.000 0.000 0.664 0.336
#> SRR1040823     4  0.4643    -0.0311 0.000 0.000 0.344 0.656
#> SRR1040824     2  0.0188     0.8957 0.004 0.996 0.000 0.000
#> SRR1040826     3  0.4713     0.5828 0.000 0.000 0.640 0.360
#> SRR1040825     1  0.0921     0.4959 0.972 0.000 0.000 0.028
#> SRR1040827     2  0.0000     0.8990 0.000 1.000 0.000 0.000
#> SRR1040828     4  0.2888     0.3427 0.004 0.124 0.000 0.872
#> SRR1040829     2  0.0000     0.8990 0.000 1.000 0.000 0.000
#> SRR1040830     1  0.4967     0.5262 0.548 0.000 0.000 0.452
#> SRR1040831     1  0.5138     0.5514 0.600 0.000 0.008 0.392
#> SRR1040832     4  0.4585    -0.2518 0.332 0.000 0.000 0.668
#> SRR1040833     1  0.4382     0.5644 0.704 0.000 0.000 0.296
#> SRR1040834     4  0.4989    -0.4992 0.472 0.000 0.000 0.528
#> SRR1040835     1  0.7188     0.4004 0.552 0.244 0.000 0.204
#> SRR1040836     1  0.6500    -0.2175 0.544 0.000 0.376 0.080
#> SRR1040837     4  0.5132    -0.2149 0.004 0.448 0.000 0.548
#> SRR1040839     2  0.0000     0.8990 0.000 1.000 0.000 0.000
#> SRR1040838     3  0.3982     0.6673 0.004 0.000 0.776 0.220
#> SRR1040840     2  0.0000     0.8990 0.000 1.000 0.000 0.000
#> SRR1040841     1  0.4955     0.5343 0.556 0.000 0.000 0.444
#> SRR1040843     4  0.4996    -0.2921 0.000 0.484 0.000 0.516
#> SRR1040842     4  0.4967     0.1358 0.000 0.000 0.452 0.548
#> SRR1040845     3  0.7082     0.2833 0.152 0.308 0.540 0.000
#> SRR1040844     1  0.4941     0.5372 0.564 0.000 0.000 0.436
#> SRR1040846     2  0.4843     0.3882 0.000 0.604 0.000 0.396
#> SRR1040847     1  0.4804     0.5659 0.616 0.000 0.000 0.384
#> SRR1040849     3  0.4277     0.6426 0.000 0.000 0.720 0.280
#> SRR1040848     2  0.0000     0.8990 0.000 1.000 0.000 0.000
#> SRR1040851     3  0.6547     0.6149 0.124 0.000 0.616 0.260
#> SRR1040850     3  0.2345     0.6131 0.000 0.000 0.900 0.100
#> SRR1040852     3  0.2345     0.6744 0.000 0.000 0.900 0.100
#> SRR1040853     3  0.0000     0.6493 0.000 0.000 1.000 0.000
#> SRR1040854     3  0.6587     0.5746 0.100 0.000 0.576 0.324
#> SRR1040855     3  0.1716     0.6666 0.000 0.000 0.936 0.064
#> SRR1040856     3  0.3907     0.4626 0.000 0.232 0.768 0.000
#> SRR1040857     3  0.6603     0.5705 0.100 0.000 0.572 0.328
#> SRR1040858     3  0.7166     0.5561 0.176 0.000 0.544 0.280
#> SRR1040859     3  0.5631     0.4564 0.076 0.224 0.700 0.000
#> SRR1040860     3  0.3942     0.4577 0.000 0.236 0.764 0.000
#> SRR1040861     3  0.0592     0.6538 0.000 0.000 0.984 0.016
#> SRR1040862     3  0.4560     0.3764 0.000 0.296 0.700 0.004
#> SRR1040863     3  0.2401     0.6005 0.000 0.092 0.904 0.004
#> SRR1040864     3  0.3801     0.4629 0.000 0.000 0.780 0.220
#> SRR1040865     3  0.4967     0.4574 0.452 0.000 0.548 0.000
#> SRR1040866     3  0.1733     0.6433 0.024 0.028 0.948 0.000
#> SRR1040867     3  0.3972     0.6725 0.008 0.000 0.788 0.204
#> SRR1040868     1  0.4843    -0.2289 0.604 0.000 0.396 0.000
#> SRR1040869     3  0.6483     0.5800 0.092 0.000 0.584 0.324
#> SRR1040870     3  0.4406     0.6286 0.000 0.000 0.700 0.300
#> SRR1040871     3  0.6357     0.4990 0.388 0.000 0.544 0.068
#> SRR1040872     3  0.1302     0.6662 0.000 0.000 0.956 0.044
#> SRR1040873     2  0.0000     0.8990 0.000 1.000 0.000 0.000
#> SRR1040874     1  0.4643     0.5728 0.656 0.000 0.000 0.344
#> SRR1040875     3  0.1118     0.6531 0.036 0.000 0.964 0.000
#> SRR1040876     1  0.4955     0.5344 0.556 0.000 0.000 0.444
#> SRR1040877     3  0.4164     0.6506 0.000 0.000 0.736 0.264
#> SRR1040878     3  0.4713     0.5842 0.292 0.004 0.700 0.004
#> SRR1040879     1  0.6743     0.2536 0.512 0.392 0.000 0.096
#> SRR1040880     1  0.0921     0.4619 0.972 0.000 0.028 0.000
#> SRR1040881     1  0.3934     0.4797 0.836 0.116 0.000 0.048
#> SRR1040882     4  0.4382     0.1040 0.000 0.000 0.296 0.704
#> SRR1040883     3  0.6702     0.5150 0.356 0.000 0.544 0.100
#> SRR1040884     1  0.4961     0.5300 0.552 0.000 0.000 0.448
#> SRR1040885     3  0.3837     0.6673 0.000 0.000 0.776 0.224

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>            class entropy silhouette    p1    p2    p3    p4    p5
#> SRR1040814     3  0.3031     0.6032 0.128 0.000 0.852 0.016 0.004
#> SRR1040813     1  0.6204     0.5282 0.584 0.000 0.180 0.008 0.228
#> SRR1040816     1  0.3195     0.6148 0.856 0.000 0.040 0.100 0.004
#> SRR1040815     4  0.6558     0.3825 0.232 0.300 0.000 0.468 0.000
#> SRR1040817     3  0.2079     0.6484 0.064 0.000 0.916 0.020 0.000
#> SRR1040818     4  0.4599     0.4927 0.356 0.000 0.020 0.624 0.000
#> SRR1040819     4  0.4558     0.5384 0.324 0.024 0.000 0.652 0.000
#> SRR1040820     2  0.0000     0.8267 0.000 1.000 0.000 0.000 0.000
#> SRR1040821     2  0.0162     0.8263 0.000 0.996 0.000 0.000 0.004
#> SRR1040822     3  0.2802     0.6221 0.100 0.000 0.876 0.016 0.008
#> SRR1040823     3  0.6308    -0.0413 0.352 0.000 0.500 0.004 0.144
#> SRR1040824     2  0.0510     0.8232 0.000 0.984 0.000 0.016 0.000
#> SRR1040826     3  0.5166     0.4047 0.232 0.000 0.680 0.004 0.084
#> SRR1040825     4  0.4151     0.5257 0.344 0.004 0.000 0.652 0.000
#> SRR1040827     2  0.0510     0.8234 0.000 0.984 0.000 0.016 0.000
#> SRR1040828     1  0.4642     0.4074 0.620 0.004 0.004 0.008 0.364
#> SRR1040829     2  0.2908     0.7506 0.108 0.868 0.000 0.016 0.008
#> SRR1040830     1  0.1251     0.5724 0.956 0.000 0.000 0.036 0.008
#> SRR1040831     1  0.6439     0.5166 0.504 0.000 0.260 0.236 0.000
#> SRR1040832     1  0.2669     0.6053 0.876 0.000 0.020 0.000 0.104
#> SRR1040833     1  0.4349     0.5899 0.756 0.000 0.068 0.176 0.000
#> SRR1040834     1  0.4355     0.6563 0.732 0.000 0.224 0.000 0.044
#> SRR1040835     1  0.1492     0.5718 0.948 0.008 0.000 0.040 0.004
#> SRR1040836     3  0.5603     0.1547 0.072 0.000 0.476 0.452 0.000
#> SRR1040837     2  0.4675     0.6395 0.100 0.736 0.000 0.000 0.164
#> SRR1040839     2  0.0404     0.8232 0.000 0.988 0.000 0.000 0.012
#> SRR1040838     3  0.3985     0.5271 0.028 0.000 0.772 0.004 0.196
#> SRR1040840     2  0.0000     0.8267 0.000 1.000 0.000 0.000 0.000
#> SRR1040841     1  0.4847     0.6696 0.720 0.000 0.196 0.080 0.004
#> SRR1040843     5  0.4283     0.0942 0.008 0.348 0.000 0.000 0.644
#> SRR1040842     5  0.1124     0.4732 0.000 0.000 0.036 0.004 0.960
#> SRR1040845     4  0.8256    -0.1431 0.000 0.324 0.200 0.336 0.140
#> SRR1040844     1  0.5422     0.6430 0.656 0.000 0.212 0.132 0.000
#> SRR1040846     2  0.4294     0.6719 0.080 0.768 0.000 0.000 0.152
#> SRR1040847     1  0.5190     0.6409 0.688 0.000 0.140 0.172 0.000
#> SRR1040849     3  0.1216     0.6577 0.020 0.000 0.960 0.000 0.020
#> SRR1040848     2  0.0162     0.8264 0.000 0.996 0.000 0.004 0.000
#> SRR1040851     3  0.2828     0.6460 0.020 0.000 0.872 0.104 0.004
#> SRR1040850     5  0.4582     0.3095 0.012 0.000 0.416 0.000 0.572
#> SRR1040852     3  0.2798     0.5985 0.008 0.000 0.852 0.000 0.140
#> SRR1040853     3  0.1764     0.6436 0.000 0.000 0.928 0.008 0.064
#> SRR1040854     3  0.1012     0.6637 0.020 0.000 0.968 0.012 0.000
#> SRR1040855     5  0.4249     0.3035 0.000 0.000 0.432 0.000 0.568
#> SRR1040856     2  0.7112    -0.3670 0.000 0.380 0.308 0.012 0.300
#> SRR1040857     3  0.1818     0.6633 0.044 0.000 0.932 0.024 0.000
#> SRR1040858     3  0.1836     0.6613 0.036 0.000 0.932 0.032 0.000
#> SRR1040859     3  0.7281    -0.0323 0.000 0.312 0.476 0.152 0.060
#> SRR1040860     5  0.8084     0.3412 0.000 0.272 0.256 0.100 0.372
#> SRR1040861     3  0.6573     0.0767 0.000 0.000 0.456 0.320 0.224
#> SRR1040862     4  0.8610    -0.2314 0.008 0.160 0.292 0.328 0.212
#> SRR1040863     3  0.7143     0.0462 0.004 0.016 0.432 0.328 0.220
#> SRR1040864     5  0.3003     0.5709 0.000 0.000 0.188 0.000 0.812
#> SRR1040865     3  0.4193     0.4960 0.012 0.000 0.684 0.304 0.000
#> SRR1040866     3  0.6947     0.0651 0.000 0.016 0.472 0.252 0.260
#> SRR1040867     3  0.1682     0.6533 0.012 0.000 0.940 0.004 0.044
#> SRR1040868     3  0.5178     0.1749 0.040 0.000 0.484 0.476 0.000
#> SRR1040869     3  0.0912     0.6625 0.012 0.000 0.972 0.016 0.000
#> SRR1040870     3  0.0981     0.6588 0.008 0.000 0.972 0.008 0.012
#> SRR1040871     3  0.2331     0.6539 0.020 0.000 0.900 0.080 0.000
#> SRR1040872     3  0.3730     0.3967 0.000 0.000 0.712 0.000 0.288
#> SRR1040873     2  0.0162     0.8263 0.000 0.996 0.000 0.000 0.004
#> SRR1040874     1  0.4823     0.4390 0.672 0.000 0.052 0.276 0.000
#> SRR1040875     3  0.6568     0.1514 0.004 0.000 0.500 0.276 0.220
#> SRR1040876     1  0.2712     0.6668 0.880 0.000 0.088 0.032 0.000
#> SRR1040877     3  0.1731     0.6526 0.008 0.000 0.940 0.040 0.012
#> SRR1040878     3  0.5469     0.2777 0.004 0.016 0.560 0.392 0.028
#> SRR1040879     2  0.4590     0.2733 0.420 0.568 0.000 0.012 0.000
#> SRR1040880     4  0.5159     0.4975 0.284 0.000 0.072 0.644 0.000
#> SRR1040881     4  0.5571     0.5178 0.348 0.084 0.000 0.568 0.000
#> SRR1040882     1  0.6261     0.3421 0.492 0.000 0.400 0.020 0.088
#> SRR1040883     3  0.3060     0.6316 0.024 0.000 0.848 0.128 0.000
#> SRR1040884     1  0.4949     0.6140 0.656 0.000 0.296 0.044 0.004
#> SRR1040885     3  0.3380     0.5941 0.028 0.000 0.840 0.008 0.124

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>            class entropy silhouette    p1    p2    p3    p4    p5    p6
#> SRR1040814     3  0.2982     0.6855 0.152 0.000 0.828 0.012 0.008 0.000
#> SRR1040813     1  0.4632     0.5398 0.656 0.000 0.276 0.000 0.064 0.004
#> SRR1040816     1  0.5380     0.1732 0.476 0.000 0.112 0.000 0.000 0.412
#> SRR1040815     6  0.3163     0.5472 0.004 0.212 0.004 0.000 0.000 0.780
#> SRR1040817     3  0.2531     0.7024 0.132 0.000 0.856 0.012 0.000 0.000
#> SRR1040818     6  0.1942     0.6654 0.064 0.000 0.012 0.008 0.000 0.916
#> SRR1040819     6  0.1492     0.6742 0.024 0.036 0.000 0.000 0.000 0.940
#> SRR1040820     2  0.0000     0.7561 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR1040821     2  0.0000     0.7561 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR1040822     3  0.2685     0.7057 0.132 0.000 0.852 0.008 0.008 0.000
#> SRR1040823     3  0.3770     0.5976 0.212 0.000 0.752 0.004 0.032 0.000
#> SRR1040824     2  0.0547     0.7503 0.000 0.980 0.000 0.000 0.000 0.020
#> SRR1040826     3  0.3288     0.6596 0.176 0.000 0.800 0.008 0.016 0.000
#> SRR1040825     6  0.1082     0.6748 0.040 0.000 0.000 0.004 0.000 0.956
#> SRR1040827     2  0.0547     0.7503 0.000 0.980 0.000 0.000 0.000 0.020
#> SRR1040828     1  0.4644     0.1621 0.696 0.000 0.000 0.076 0.216 0.012
#> SRR1040829     2  0.5912     0.3300 0.348 0.536 0.000 0.064 0.012 0.040
#> SRR1040830     1  0.3991     0.2435 0.772 0.000 0.000 0.064 0.012 0.152
#> SRR1040831     1  0.6231     0.3986 0.368 0.000 0.332 0.004 0.000 0.296
#> SRR1040832     1  0.3201     0.5026 0.848 0.000 0.088 0.000 0.028 0.036
#> SRR1040833     6  0.5353    -0.1236 0.388 0.000 0.112 0.000 0.000 0.500
#> SRR1040834     1  0.4585     0.5541 0.672 0.000 0.272 0.000 0.028 0.028
#> SRR1040835     1  0.4110     0.2376 0.680 0.012 0.008 0.000 0.004 0.296
#> SRR1040836     3  0.4450     0.2022 0.020 0.000 0.528 0.004 0.000 0.448
#> SRR1040837     2  0.3949     0.6401 0.088 0.784 0.000 0.000 0.116 0.012
#> SRR1040839     2  0.1285     0.7313 0.000 0.944 0.000 0.004 0.052 0.000
#> SRR1040838     3  0.2355     0.7175 0.008 0.000 0.876 0.004 0.112 0.000
#> SRR1040840     2  0.0000     0.7561 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR1040841     1  0.5975     0.4439 0.444 0.000 0.256 0.000 0.000 0.300
#> SRR1040843     5  0.4091    -0.2174 0.000 0.472 0.000 0.008 0.520 0.000
#> SRR1040842     5  0.0603     0.3820 0.000 0.000 0.004 0.016 0.980 0.000
#> SRR1040845     4  0.6402     0.5713 0.000 0.072 0.104 0.596 0.024 0.204
#> SRR1040844     1  0.6211     0.4057 0.420 0.000 0.244 0.008 0.000 0.328
#> SRR1040846     2  0.3802     0.6455 0.084 0.792 0.000 0.000 0.116 0.008
#> SRR1040847     1  0.5962     0.4155 0.436 0.000 0.236 0.000 0.000 0.328
#> SRR1040849     3  0.1116     0.7485 0.028 0.000 0.960 0.004 0.008 0.000
#> SRR1040848     2  0.0000     0.7561 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR1040851     3  0.4156     0.6537 0.040 0.000 0.780 0.040 0.004 0.136
#> SRR1040850     5  0.5186     0.2839 0.064 0.000 0.364 0.008 0.560 0.004
#> SRR1040852     3  0.2231     0.7258 0.000 0.000 0.900 0.028 0.068 0.004
#> SRR1040853     3  0.2699     0.7229 0.008 0.000 0.888 0.052 0.036 0.016
#> SRR1040854     3  0.1173     0.7493 0.016 0.000 0.960 0.016 0.000 0.008
#> SRR1040855     3  0.4074     0.4374 0.008 0.000 0.640 0.008 0.344 0.000
#> SRR1040856     2  0.6745    -0.1308 0.000 0.404 0.360 0.060 0.176 0.000
#> SRR1040857     3  0.2146     0.7472 0.044 0.000 0.908 0.044 0.000 0.004
#> SRR1040858     3  0.2007     0.7393 0.012 0.000 0.920 0.036 0.000 0.032
#> SRR1040859     3  0.7379    -0.1829 0.008 0.324 0.404 0.192 0.024 0.048
#> SRR1040860     2  0.7656    -0.2429 0.008 0.328 0.312 0.140 0.212 0.000
#> SRR1040861     4  0.2588     0.7663 0.008 0.000 0.092 0.876 0.024 0.000
#> SRR1040862     4  0.2203     0.7657 0.004 0.000 0.084 0.896 0.016 0.000
#> SRR1040863     4  0.2474     0.7645 0.004 0.000 0.080 0.884 0.032 0.000
#> SRR1040864     5  0.2833     0.4471 0.004 0.000 0.148 0.012 0.836 0.000
#> SRR1040865     3  0.5642     0.2391 0.008 0.000 0.532 0.136 0.000 0.324
#> SRR1040866     5  0.6967    -0.1339 0.004 0.008 0.220 0.304 0.424 0.040
#> SRR1040867     3  0.1439     0.7455 0.008 0.000 0.952 0.016 0.012 0.012
#> SRR1040868     3  0.4084     0.3624 0.012 0.000 0.588 0.000 0.000 0.400
#> SRR1040869     3  0.0405     0.7462 0.000 0.000 0.988 0.008 0.000 0.004
#> SRR1040870     3  0.1245     0.7478 0.032 0.000 0.952 0.016 0.000 0.000
#> SRR1040871     3  0.1720     0.7355 0.000 0.000 0.928 0.032 0.000 0.040
#> SRR1040872     3  0.4344     0.3068 0.000 0.000 0.612 0.032 0.356 0.000
#> SRR1040873     2  0.0000     0.7561 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR1040874     6  0.5817    -0.0478 0.364 0.000 0.100 0.028 0.000 0.508
#> SRR1040875     4  0.6590     0.5273 0.004 0.000 0.152 0.552 0.196 0.096
#> SRR1040876     1  0.3514     0.4918 0.824 0.000 0.084 0.016 0.000 0.076
#> SRR1040877     3  0.3183     0.7214 0.060 0.000 0.828 0.112 0.000 0.000
#> SRR1040878     4  0.3612     0.6653 0.000 0.000 0.200 0.764 0.000 0.036
#> SRR1040879     2  0.4795     0.4987 0.152 0.672 0.000 0.000 0.000 0.176
#> SRR1040880     6  0.2905     0.5745 0.012 0.000 0.144 0.008 0.000 0.836
#> SRR1040881     6  0.2442     0.6681 0.048 0.068 0.000 0.000 0.000 0.884
#> SRR1040882     3  0.4136     0.0751 0.428 0.000 0.560 0.000 0.012 0.000
#> SRR1040883     3  0.3304     0.6674 0.004 0.000 0.816 0.040 0.000 0.140
#> SRR1040884     1  0.5171     0.5202 0.560 0.000 0.336 0.000 0.000 0.104
#> SRR1040885     3  0.3656     0.6958 0.112 0.000 0.804 0.008 0.076 0.000

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

consensus_heatmap(res, k = 2)

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

consensus_heatmap(res, k = 3)

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

consensus_heatmap(res, k = 4)

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

consensus_heatmap(res, k = 5)

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

consensus_heatmap(res, k = 6)

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

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

membership_heatmap(res, k = 2)

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

membership_heatmap(res, k = 3)

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

membership_heatmap(res, k = 4)

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

membership_heatmap(res, k = 5)

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

membership_heatmap(res, k = 6)

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

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

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

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

get_signatures(res, k = 3)

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

get_signatures(res, k = 4)

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

get_signatures(res, k = 5)

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

get_signatures(res, k = 6)

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

Signature heatmaps where rows are not scaled:

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

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

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

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

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

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

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

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

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

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

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk SD-NMF-signature_compare

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

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

An example of the output of tb is:

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

The columns in tb are:

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

UMAP plot which shows how samples are separated.

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

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

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

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

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

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

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

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

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

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

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk SD-NMF-collect-classes

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


CV:hclust

The object with results only for a single top-value method and a single partition method can be extracted as:

res = res_list["CV", "hclust"]
# you can also extract it by
# res = res_list["CV:hclust"]

A summary of res and all the functions that can be applied to it:

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

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

collect_plots(res)

plot of chunk CV-hclust-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.615           0.885       0.927         0.4353 0.562   0.562
#> 3 3 0.724           0.808       0.892         0.4136 0.808   0.659
#> 4 4 0.682           0.785       0.865         0.1089 0.932   0.815
#> 5 5 0.662           0.673       0.847         0.0583 0.975   0.920
#> 6 6 0.680           0.705       0.851         0.0214 0.975   0.914

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
#> SRR1040814     1  0.0000      0.907 1.000 0.000
#> SRR1040813     1  0.4298      0.914 0.912 0.088
#> SRR1040816     2  0.9635      0.248 0.388 0.612
#> SRR1040815     2  0.0000      0.946 0.000 1.000
#> SRR1040817     1  0.0000      0.907 1.000 0.000
#> SRR1040818     2  0.0376      0.942 0.004 0.996
#> SRR1040819     2  0.0000      0.946 0.000 1.000
#> SRR1040820     2  0.0000      0.946 0.000 1.000
#> SRR1040821     2  0.0000      0.946 0.000 1.000
#> SRR1040822     1  0.0000      0.907 1.000 0.000
#> SRR1040823     1  0.0000      0.907 1.000 0.000
#> SRR1040824     2  0.0000      0.946 0.000 1.000
#> SRR1040826     1  0.0000      0.907 1.000 0.000
#> SRR1040825     2  0.0000      0.946 0.000 1.000
#> SRR1040827     2  0.0000      0.946 0.000 1.000
#> SRR1040828     2  0.0000      0.946 0.000 1.000
#> SRR1040829     2  0.0000      0.946 0.000 1.000
#> SRR1040830     2  0.7883      0.631 0.236 0.764
#> SRR1040831     1  0.0376      0.908 0.996 0.004
#> SRR1040832     2  0.9608      0.258 0.384 0.616
#> SRR1040833     1  0.4298      0.914 0.912 0.088
#> SRR1040834     1  0.7056      0.854 0.808 0.192
#> SRR1040835     2  0.0000      0.946 0.000 1.000
#> SRR1040836     1  0.1843      0.912 0.972 0.028
#> SRR1040837     2  0.0000      0.946 0.000 1.000
#> SRR1040839     2  0.0000      0.946 0.000 1.000
#> SRR1040838     1  0.7299      0.846 0.796 0.204
#> SRR1040840     2  0.0000      0.946 0.000 1.000
#> SRR1040841     1  0.4298      0.914 0.912 0.088
#> SRR1040843     2  0.0000      0.946 0.000 1.000
#> SRR1040842     1  0.7453      0.840 0.788 0.212
#> SRR1040845     1  0.7528      0.835 0.784 0.216
#> SRR1040844     1  0.4298      0.914 0.912 0.088
#> SRR1040846     2  0.0000      0.946 0.000 1.000
#> SRR1040847     1  0.4298      0.914 0.912 0.088
#> SRR1040849     1  0.0000      0.907 1.000 0.000
#> SRR1040848     2  0.0000      0.946 0.000 1.000
#> SRR1040851     1  0.5059      0.906 0.888 0.112
#> SRR1040850     1  0.7453      0.840 0.788 0.212
#> SRR1040852     1  0.4298      0.914 0.912 0.088
#> SRR1040853     1  0.7376      0.842 0.792 0.208
#> SRR1040854     1  0.0000      0.907 1.000 0.000
#> SRR1040855     1  0.5178      0.882 0.884 0.116
#> SRR1040856     1  0.7674      0.827 0.776 0.224
#> SRR1040857     1  0.0000      0.907 1.000 0.000
#> SRR1040858     1  0.0000      0.907 1.000 0.000
#> SRR1040859     1  0.7674      0.827 0.776 0.224
#> SRR1040860     1  0.7674      0.827 0.776 0.224
#> SRR1040861     1  0.5294      0.902 0.880 0.120
#> SRR1040862     1  0.5294      0.902 0.880 0.120
#> SRR1040863     1  0.6148      0.884 0.848 0.152
#> SRR1040864     1  0.7376      0.842 0.792 0.208
#> SRR1040865     1  0.4690      0.911 0.900 0.100
#> SRR1040866     1  0.7528      0.836 0.784 0.216
#> SRR1040867     1  0.0376      0.908 0.996 0.004
#> SRR1040868     1  0.4298      0.914 0.912 0.088
#> SRR1040869     1  0.0000      0.907 1.000 0.000
#> SRR1040870     1  0.0000      0.907 1.000 0.000
#> SRR1040871     1  0.0000      0.907 1.000 0.000
#> SRR1040872     1  0.0000      0.907 1.000 0.000
#> SRR1040873     2  0.0000      0.946 0.000 1.000
#> SRR1040874     1  0.4298      0.914 0.912 0.088
#> SRR1040875     1  0.4161      0.915 0.916 0.084
#> SRR1040876     1  0.4298      0.914 0.912 0.088
#> SRR1040877     1  0.0000      0.907 1.000 0.000
#> SRR1040878     1  0.7674      0.827 0.776 0.224
#> SRR1040879     2  0.0000      0.946 0.000 1.000
#> SRR1040880     1  0.1843      0.912 0.972 0.028
#> SRR1040881     2  0.0000      0.946 0.000 1.000
#> SRR1040882     1  0.0000      0.907 1.000 0.000
#> SRR1040883     1  0.0000      0.907 1.000 0.000
#> SRR1040884     1  0.4298      0.914 0.912 0.088
#> SRR1040885     1  0.0000      0.907 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
#> SRR1040814     1  0.1860     0.8560 0.948 0.000 0.052
#> SRR1040813     1  0.3715     0.8463 0.868 0.004 0.128
#> SRR1040816     2  0.8950     0.2090 0.172 0.556 0.272
#> SRR1040815     2  0.0000     0.9398 0.000 1.000 0.000
#> SRR1040817     1  0.1860     0.8560 0.948 0.000 0.052
#> SRR1040818     2  0.0237     0.9362 0.000 0.996 0.004
#> SRR1040819     2  0.0000     0.9398 0.000 1.000 0.000
#> SRR1040820     2  0.0000     0.9398 0.000 1.000 0.000
#> SRR1040821     2  0.0000     0.9398 0.000 1.000 0.000
#> SRR1040822     1  0.0592     0.8781 0.988 0.000 0.012
#> SRR1040823     1  0.0237     0.8818 0.996 0.000 0.004
#> SRR1040824     2  0.0000     0.9398 0.000 1.000 0.000
#> SRR1040826     1  0.1860     0.8560 0.948 0.000 0.052
#> SRR1040825     2  0.0000     0.9398 0.000 1.000 0.000
#> SRR1040827     2  0.0000     0.9398 0.000 1.000 0.000
#> SRR1040828     2  0.0000     0.9398 0.000 1.000 0.000
#> SRR1040829     2  0.0000     0.9398 0.000 1.000 0.000
#> SRR1040830     2  0.5506     0.6037 0.220 0.764 0.016
#> SRR1040831     1  0.0747     0.8832 0.984 0.000 0.016
#> SRR1040832     2  0.8907     0.2165 0.168 0.560 0.272
#> SRR1040833     1  0.3715     0.8463 0.868 0.004 0.128
#> SRR1040834     1  0.8334    -0.1225 0.480 0.080 0.440
#> SRR1040835     2  0.0000     0.9398 0.000 1.000 0.000
#> SRR1040836     1  0.1643     0.8787 0.956 0.000 0.044
#> SRR1040837     2  0.0000     0.9398 0.000 1.000 0.000
#> SRR1040839     2  0.0000     0.9398 0.000 1.000 0.000
#> SRR1040838     3  0.8236     0.3809 0.416 0.076 0.508
#> SRR1040840     2  0.0000     0.9398 0.000 1.000 0.000
#> SRR1040841     1  0.3715     0.8463 0.868 0.004 0.128
#> SRR1040843     2  0.0000     0.9398 0.000 1.000 0.000
#> SRR1040842     3  0.4035     0.8265 0.040 0.080 0.880
#> SRR1040845     3  0.5505     0.8515 0.096 0.088 0.816
#> SRR1040844     1  0.3715     0.8463 0.868 0.004 0.128
#> SRR1040846     2  0.0000     0.9398 0.000 1.000 0.000
#> SRR1040847     1  0.3715     0.8463 0.868 0.004 0.128
#> SRR1040849     1  0.0000     0.8834 1.000 0.000 0.000
#> SRR1040848     2  0.0000     0.9398 0.000 1.000 0.000
#> SRR1040851     1  0.4002     0.8216 0.840 0.000 0.160
#> SRR1040850     3  0.4253     0.8332 0.048 0.080 0.872
#> SRR1040852     1  0.3644     0.8489 0.872 0.004 0.124
#> SRR1040853     3  0.8280     0.4119 0.404 0.080 0.516
#> SRR1040854     1  0.0000     0.8834 1.000 0.000 0.000
#> SRR1040855     1  0.8043    -0.0944 0.556 0.072 0.372
#> SRR1040856     3  0.5426     0.8522 0.088 0.092 0.820
#> SRR1040857     1  0.0000     0.8834 1.000 0.000 0.000
#> SRR1040858     1  0.0000     0.8834 1.000 0.000 0.000
#> SRR1040859     3  0.5426     0.8522 0.088 0.092 0.820
#> SRR1040860     3  0.5426     0.8522 0.088 0.092 0.820
#> SRR1040861     3  0.2448     0.8083 0.076 0.000 0.924
#> SRR1040862     3  0.2448     0.8083 0.076 0.000 0.924
#> SRR1040863     3  0.2173     0.8126 0.048 0.008 0.944
#> SRR1040864     3  0.8322     0.3492 0.428 0.080 0.492
#> SRR1040865     1  0.3965     0.8371 0.860 0.008 0.132
#> SRR1040866     3  0.5344     0.8510 0.092 0.084 0.824
#> SRR1040867     1  0.0237     0.8838 0.996 0.000 0.004
#> SRR1040868     1  0.3644     0.8489 0.872 0.004 0.124
#> SRR1040869     1  0.0000     0.8834 1.000 0.000 0.000
#> SRR1040870     1  0.1860     0.8560 0.948 0.000 0.052
#> SRR1040871     1  0.0000     0.8834 1.000 0.000 0.000
#> SRR1040872     1  0.0000     0.8834 1.000 0.000 0.000
#> SRR1040873     2  0.0000     0.9398 0.000 1.000 0.000
#> SRR1040874     1  0.3715     0.8463 0.868 0.004 0.128
#> SRR1040875     1  0.5678     0.5405 0.684 0.000 0.316
#> SRR1040876     1  0.3715     0.8463 0.868 0.004 0.128
#> SRR1040877     1  0.1860     0.8560 0.948 0.000 0.052
#> SRR1040878     3  0.5426     0.8522 0.088 0.092 0.820
#> SRR1040879     2  0.0000     0.9398 0.000 1.000 0.000
#> SRR1040880     1  0.1643     0.8789 0.956 0.000 0.044
#> SRR1040881     2  0.0000     0.9398 0.000 1.000 0.000
#> SRR1040882     1  0.0592     0.8834 0.988 0.000 0.012
#> SRR1040883     1  0.0000     0.8834 1.000 0.000 0.000
#> SRR1040884     1  0.3715     0.8463 0.868 0.004 0.128
#> SRR1040885     1  0.1860     0.8560 0.948 0.000 0.052

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> SRR1040814     3  0.3873     0.9799 0.228 0.000 0.772 0.000
#> SRR1040813     1  0.2888     0.8193 0.872 0.004 0.000 0.124
#> SRR1040816     2  0.7501     0.2533 0.164 0.540 0.012 0.284
#> SRR1040815     2  0.0469     0.9256 0.000 0.988 0.012 0.000
#> SRR1040817     3  0.3907     0.9771 0.232 0.000 0.768 0.000
#> SRR1040818     2  0.0657     0.9244 0.000 0.984 0.012 0.004
#> SRR1040819     2  0.0469     0.9256 0.000 0.988 0.012 0.000
#> SRR1040820     2  0.0000     0.9273 0.000 1.000 0.000 0.000
#> SRR1040821     2  0.0000     0.9273 0.000 1.000 0.000 0.000
#> SRR1040822     1  0.1716     0.8023 0.936 0.000 0.064 0.000
#> SRR1040823     1  0.1890     0.8064 0.936 0.000 0.056 0.008
#> SRR1040824     2  0.0000     0.9273 0.000 1.000 0.000 0.000
#> SRR1040826     3  0.3873     0.9799 0.228 0.000 0.772 0.000
#> SRR1040825     2  0.0657     0.9244 0.000 0.984 0.012 0.004
#> SRR1040827     2  0.0000     0.9273 0.000 1.000 0.000 0.000
#> SRR1040828     2  0.2654     0.8673 0.000 0.888 0.108 0.004
#> SRR1040829     2  0.2654     0.8673 0.000 0.888 0.108 0.004
#> SRR1040830     2  0.6713     0.5537 0.220 0.652 0.108 0.020
#> SRR1040831     1  0.0000     0.8117 1.000 0.000 0.000 0.000
#> SRR1040832     2  0.7466     0.2600 0.160 0.544 0.012 0.284
#> SRR1040833     1  0.2999     0.8178 0.864 0.004 0.000 0.132
#> SRR1040834     1  0.6559    -0.0651 0.468 0.076 0.000 0.456
#> SRR1040835     2  0.0657     0.9244 0.000 0.984 0.012 0.004
#> SRR1040836     1  0.1022     0.8207 0.968 0.000 0.000 0.032
#> SRR1040837     2  0.0000     0.9273 0.000 1.000 0.000 0.000
#> SRR1040839     2  0.0000     0.9273 0.000 1.000 0.000 0.000
#> SRR1040838     4  0.7129     0.3958 0.348 0.068 0.032 0.552
#> SRR1040840     2  0.0000     0.9273 0.000 1.000 0.000 0.000
#> SRR1040841     1  0.2999     0.8178 0.864 0.004 0.000 0.132
#> SRR1040843     2  0.0000     0.9273 0.000 1.000 0.000 0.000
#> SRR1040842     4  0.2198     0.7967 0.000 0.072 0.008 0.920
#> SRR1040845     4  0.3542     0.8234 0.060 0.076 0.000 0.864
#> SRR1040844     1  0.2999     0.8178 0.864 0.004 0.000 0.132
#> SRR1040846     2  0.0000     0.9273 0.000 1.000 0.000 0.000
#> SRR1040847     1  0.2999     0.8178 0.864 0.004 0.000 0.132
#> SRR1040849     1  0.2216     0.7807 0.908 0.000 0.092 0.000
#> SRR1040848     2  0.0000     0.9273 0.000 1.000 0.000 0.000
#> SRR1040851     1  0.3300     0.8049 0.848 0.000 0.008 0.144
#> SRR1040850     4  0.2515     0.8073 0.012 0.072 0.004 0.912
#> SRR1040852     1  0.2999     0.8173 0.864 0.004 0.000 0.132
#> SRR1040853     4  0.7147     0.4255 0.336 0.072 0.032 0.560
#> SRR1040854     1  0.2216     0.7838 0.908 0.000 0.092 0.000
#> SRR1040855     1  0.7344    -0.1195 0.500 0.064 0.040 0.396
#> SRR1040856     4  0.3453     0.8252 0.052 0.080 0.000 0.868
#> SRR1040857     1  0.2216     0.7838 0.908 0.000 0.092 0.000
#> SRR1040858     1  0.2216     0.7838 0.908 0.000 0.092 0.000
#> SRR1040859     4  0.3453     0.8252 0.052 0.080 0.000 0.868
#> SRR1040860     4  0.3453     0.8252 0.052 0.080 0.000 0.868
#> SRR1040861     4  0.2578     0.7267 0.036 0.000 0.052 0.912
#> SRR1040862     4  0.2578     0.7267 0.036 0.000 0.052 0.912
#> SRR1040863     4  0.1474     0.7310 0.000 0.000 0.052 0.948
#> SRR1040864     4  0.7293     0.3729 0.356 0.072 0.036 0.536
#> SRR1040865     1  0.3300     0.8010 0.848 0.008 0.000 0.144
#> SRR1040866     4  0.3577     0.8205 0.056 0.072 0.004 0.868
#> SRR1040867     1  0.1824     0.8030 0.936 0.000 0.060 0.004
#> SRR1040868     1  0.2999     0.8173 0.864 0.004 0.000 0.132
#> SRR1040869     1  0.2216     0.7838 0.908 0.000 0.092 0.000
#> SRR1040870     3  0.3907     0.9771 0.232 0.000 0.768 0.000
#> SRR1040871     1  0.2011     0.7884 0.920 0.000 0.080 0.000
#> SRR1040872     1  0.2011     0.7893 0.920 0.000 0.080 0.000
#> SRR1040873     2  0.0000     0.9273 0.000 1.000 0.000 0.000
#> SRR1040874     1  0.2999     0.8178 0.864 0.004 0.000 0.132
#> SRR1040875     1  0.4543     0.5606 0.676 0.000 0.000 0.324
#> SRR1040876     1  0.2999     0.8178 0.864 0.004 0.000 0.132
#> SRR1040877     3  0.3873     0.9799 0.228 0.000 0.772 0.000
#> SRR1040878     4  0.3453     0.8252 0.052 0.080 0.000 0.868
#> SRR1040879     2  0.0469     0.9256 0.000 0.988 0.012 0.000
#> SRR1040880     1  0.1022     0.8205 0.968 0.000 0.000 0.032
#> SRR1040881     2  0.0469     0.9256 0.000 0.988 0.012 0.000
#> SRR1040882     1  0.1389     0.8062 0.952 0.000 0.048 0.000
#> SRR1040883     1  0.2216     0.7838 0.908 0.000 0.092 0.000
#> SRR1040884     1  0.2999     0.8178 0.864 0.004 0.000 0.132
#> SRR1040885     3  0.3266     0.9101 0.168 0.000 0.832 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
#> SRR1040814     3  0.1965      0.963 0.096 0.000 0.904 0.000 0.000
#> SRR1040813     1  0.3304      0.799 0.816 0.000 0.000 0.168 0.016
#> SRR1040816     2  0.7833     -0.447 0.120 0.412 0.000 0.328 0.140
#> SRR1040815     2  0.2719      0.720 0.000 0.852 0.000 0.004 0.144
#> SRR1040817     3  0.2020      0.960 0.100 0.000 0.900 0.000 0.000
#> SRR1040818     2  0.2843      0.717 0.000 0.848 0.000 0.008 0.144
#> SRR1040819     2  0.2416      0.748 0.000 0.888 0.000 0.012 0.100
#> SRR1040820     2  0.0000      0.782 0.000 1.000 0.000 0.000 0.000
#> SRR1040821     2  0.0000      0.782 0.000 1.000 0.000 0.000 0.000
#> SRR1040822     1  0.1628      0.838 0.936 0.000 0.056 0.000 0.008
#> SRR1040823     1  0.1770      0.840 0.936 0.000 0.048 0.008 0.008
#> SRR1040824     2  0.0000      0.782 0.000 1.000 0.000 0.000 0.000
#> SRR1040826     3  0.1965      0.963 0.096 0.000 0.904 0.000 0.000
#> SRR1040825     2  0.2921      0.723 0.000 0.856 0.000 0.020 0.124
#> SRR1040827     2  0.0000      0.782 0.000 1.000 0.000 0.000 0.000
#> SRR1040828     2  0.5678     -0.172 0.000 0.524 0.000 0.084 0.392
#> SRR1040829     2  0.5632     -0.155 0.000 0.528 0.000 0.080 0.392
#> SRR1040830     5  0.8056      0.000 0.160 0.288 0.000 0.144 0.408
#> SRR1040831     1  0.0162      0.839 0.996 0.000 0.000 0.004 0.000
#> SRR1040832     2  0.7807     -0.444 0.116 0.412 0.000 0.332 0.140
#> SRR1040833     1  0.2516      0.831 0.860 0.000 0.000 0.140 0.000
#> SRR1040834     4  0.5401      0.170 0.404 0.000 0.000 0.536 0.060
#> SRR1040835     2  0.2625      0.741 0.000 0.876 0.000 0.016 0.108
#> SRR1040836     1  0.0963      0.844 0.964 0.000 0.000 0.036 0.000
#> SRR1040837     2  0.0609      0.780 0.000 0.980 0.000 0.000 0.020
#> SRR1040839     2  0.0000      0.782 0.000 1.000 0.000 0.000 0.000
#> SRR1040838     4  0.4779      0.384 0.340 0.000 0.032 0.628 0.000
#> SRR1040840     2  0.0000      0.782 0.000 1.000 0.000 0.000 0.000
#> SRR1040841     1  0.2516      0.831 0.860 0.000 0.000 0.140 0.000
#> SRR1040843     2  0.0609      0.780 0.000 0.980 0.000 0.000 0.020
#> SRR1040842     4  0.1792      0.687 0.000 0.000 0.000 0.916 0.084
#> SRR1040845     4  0.0404      0.700 0.012 0.000 0.000 0.988 0.000
#> SRR1040844     1  0.2516      0.831 0.860 0.000 0.000 0.140 0.000
#> SRR1040846     2  0.0000      0.782 0.000 1.000 0.000 0.000 0.000
#> SRR1040847     1  0.2516      0.831 0.860 0.000 0.000 0.140 0.000
#> SRR1040849     1  0.2011      0.824 0.908 0.000 0.088 0.000 0.004
#> SRR1040848     2  0.0000      0.782 0.000 1.000 0.000 0.000 0.000
#> SRR1040851     1  0.4951      0.682 0.704 0.000 0.000 0.100 0.196
#> SRR1040850     4  0.1478      0.694 0.000 0.000 0.000 0.936 0.064
#> SRR1040852     1  0.2516      0.831 0.860 0.000 0.000 0.140 0.000
#> SRR1040853     4  0.4731      0.411 0.328 0.000 0.032 0.640 0.000
#> SRR1040854     1  0.2124      0.823 0.900 0.000 0.096 0.000 0.004
#> SRR1040855     1  0.5255     -0.130 0.496 0.000 0.036 0.464 0.004
#> SRR1040856     4  0.0162      0.701 0.004 0.000 0.000 0.996 0.000
#> SRR1040857     1  0.2068      0.824 0.904 0.000 0.092 0.000 0.004
#> SRR1040858     1  0.2124      0.823 0.900 0.000 0.096 0.000 0.004
#> SRR1040859     4  0.0162      0.701 0.004 0.000 0.000 0.996 0.000
#> SRR1040860     4  0.0162      0.701 0.004 0.000 0.000 0.996 0.000
#> SRR1040861     4  0.4949      0.504 0.032 0.000 0.000 0.572 0.396
#> SRR1040862     4  0.4949      0.504 0.032 0.000 0.000 0.572 0.396
#> SRR1040863     4  0.4235      0.496 0.000 0.000 0.000 0.576 0.424
#> SRR1040864     4  0.4894      0.353 0.352 0.000 0.036 0.612 0.000
#> SRR1040865     1  0.2690      0.817 0.844 0.000 0.000 0.156 0.000
#> SRR1040866     4  0.1628      0.688 0.008 0.000 0.000 0.936 0.056
#> SRR1040867     1  0.1662      0.838 0.936 0.000 0.056 0.004 0.004
#> SRR1040868     1  0.2516      0.831 0.860 0.000 0.000 0.140 0.000
#> SRR1040869     1  0.2124      0.823 0.900 0.000 0.096 0.000 0.004
#> SRR1040870     3  0.2020      0.960 0.100 0.000 0.900 0.000 0.000
#> SRR1040871     1  0.1892      0.827 0.916 0.000 0.080 0.000 0.004
#> SRR1040872     1  0.1831      0.829 0.920 0.000 0.076 0.000 0.004
#> SRR1040873     2  0.0000      0.782 0.000 1.000 0.000 0.000 0.000
#> SRR1040874     1  0.2516      0.831 0.860 0.000 0.000 0.140 0.000
#> SRR1040875     1  0.4444      0.476 0.624 0.000 0.000 0.364 0.012
#> SRR1040876     1  0.2516      0.831 0.860 0.000 0.000 0.140 0.000
#> SRR1040877     3  0.1965      0.963 0.096 0.000 0.904 0.000 0.000
#> SRR1040878     4  0.0162      0.701 0.004 0.000 0.000 0.996 0.000
#> SRR1040879     2  0.2625      0.741 0.000 0.876 0.000 0.016 0.108
#> SRR1040880     1  0.0963      0.844 0.964 0.000 0.000 0.036 0.000
#> SRR1040881     2  0.2416      0.748 0.000 0.888 0.000 0.012 0.100
#> SRR1040882     1  0.1518      0.840 0.944 0.000 0.048 0.004 0.004
#> SRR1040883     1  0.2124      0.823 0.900 0.000 0.096 0.000 0.004
#> SRR1040884     1  0.2516      0.831 0.860 0.000 0.000 0.140 0.000
#> SRR1040885     3  0.0000      0.826 0.000 0.000 1.000 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>            class entropy silhouette    p1    p2    p3    p4    p5    p6
#> SRR1040814     3  0.1765     0.9585 0.096 0.000 0.904 0.000 0.000 0.000
#> SRR1040813     1  0.3763     0.6992 0.768 0.000 0.000 0.172 0.000 0.060
#> SRR1040816     2  0.6895    -0.0250 0.072 0.408 0.000 0.332 0.000 0.188
#> SRR1040815     2  0.2482     0.7916 0.000 0.848 0.000 0.004 0.000 0.148
#> SRR1040817     3  0.1814     0.9548 0.100 0.000 0.900 0.000 0.000 0.000
#> SRR1040818     2  0.2593     0.7895 0.000 0.844 0.000 0.008 0.000 0.148
#> SRR1040819     2  0.2218     0.8092 0.000 0.884 0.000 0.012 0.000 0.104
#> SRR1040820     2  0.0000     0.8291 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR1040821     2  0.0000     0.8291 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR1040822     1  0.1605     0.8133 0.936 0.000 0.044 0.000 0.004 0.016
#> SRR1040823     1  0.1722     0.8160 0.936 0.000 0.036 0.008 0.004 0.016
#> SRR1040824     2  0.0000     0.8291 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR1040826     3  0.1765     0.9585 0.096 0.000 0.904 0.000 0.000 0.000
#> SRR1040825     2  0.2667     0.7941 0.000 0.852 0.000 0.020 0.000 0.128
#> SRR1040827     2  0.0000     0.8291 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR1040828     2  0.5075     0.2071 0.000 0.468 0.000 0.076 0.000 0.456
#> SRR1040829     2  0.5034     0.2167 0.000 0.472 0.000 0.072 0.000 0.456
#> SRR1040830     6  0.6706     0.0657 0.116 0.232 0.000 0.136 0.000 0.516
#> SRR1040831     1  0.0146     0.8149 0.996 0.000 0.000 0.004 0.000 0.000
#> SRR1040832     2  0.6860    -0.0183 0.068 0.408 0.000 0.336 0.000 0.188
#> SRR1040833     1  0.2260     0.8031 0.860 0.000 0.000 0.140 0.000 0.000
#> SRR1040834     4  0.5223     0.1584 0.356 0.000 0.000 0.540 0.000 0.104
#> SRR1040835     2  0.2404     0.8049 0.000 0.872 0.000 0.016 0.000 0.112
#> SRR1040836     1  0.0865     0.8201 0.964 0.000 0.000 0.036 0.000 0.000
#> SRR1040837     2  0.0547     0.8286 0.000 0.980 0.000 0.000 0.000 0.020
#> SRR1040839     2  0.0000     0.8291 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR1040838     4  0.4346     0.4136 0.336 0.000 0.028 0.632 0.000 0.004
#> SRR1040840     2  0.0000     0.8291 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR1040841     1  0.2260     0.8031 0.860 0.000 0.000 0.140 0.000 0.000
#> SRR1040843     2  0.0547     0.8286 0.000 0.980 0.000 0.000 0.000 0.020
#> SRR1040842     4  0.2230     0.6304 0.000 0.000 0.000 0.892 0.024 0.084
#> SRR1040845     4  0.0260     0.6878 0.008 0.000 0.000 0.992 0.000 0.000
#> SRR1040844     1  0.2260     0.8031 0.860 0.000 0.000 0.140 0.000 0.000
#> SRR1040846     2  0.0000     0.8291 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR1040847     1  0.2260     0.8031 0.860 0.000 0.000 0.140 0.000 0.000
#> SRR1040849     1  0.2002     0.7960 0.908 0.000 0.076 0.000 0.004 0.012
#> SRR1040848     2  0.0000     0.8291 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR1040851     6  0.5783     0.0568 0.372 0.000 0.000 0.000 0.180 0.448
#> SRR1040850     4  0.1657     0.6587 0.000 0.000 0.000 0.928 0.016 0.056
#> SRR1040852     1  0.2260     0.8026 0.860 0.000 0.000 0.140 0.000 0.000
#> SRR1040853     4  0.4302     0.4280 0.324 0.000 0.028 0.644 0.000 0.004
#> SRR1040854     1  0.1970     0.7950 0.900 0.000 0.092 0.000 0.000 0.008
#> SRR1040855     1  0.4761    -0.1821 0.492 0.000 0.032 0.468 0.000 0.008
#> SRR1040856     4  0.0000     0.6909 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR1040857     1  0.1918     0.7957 0.904 0.000 0.088 0.000 0.000 0.008
#> SRR1040858     1  0.1970     0.7950 0.900 0.000 0.092 0.000 0.000 0.008
#> SRR1040859     4  0.0000     0.6909 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR1040860     4  0.0000     0.6909 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR1040861     5  0.3543     0.9694 0.032 0.000 0.000 0.200 0.768 0.000
#> SRR1040862     5  0.3543     0.9694 0.032 0.000 0.000 0.200 0.768 0.000
#> SRR1040863     5  0.2730     0.9395 0.000 0.000 0.000 0.192 0.808 0.000
#> SRR1040864     4  0.4454     0.3901 0.348 0.000 0.032 0.616 0.000 0.004
#> SRR1040865     1  0.2416     0.7847 0.844 0.000 0.000 0.156 0.000 0.000
#> SRR1040866     4  0.2056     0.6310 0.004 0.000 0.000 0.904 0.012 0.080
#> SRR1040867     1  0.1655     0.8130 0.936 0.000 0.044 0.004 0.004 0.012
#> SRR1040868     1  0.2260     0.8026 0.860 0.000 0.000 0.140 0.000 0.000
#> SRR1040869     1  0.1970     0.7950 0.900 0.000 0.092 0.000 0.000 0.008
#> SRR1040870     3  0.1814     0.9549 0.100 0.000 0.900 0.000 0.000 0.000
#> SRR1040871     1  0.1845     0.7997 0.916 0.000 0.072 0.000 0.004 0.008
#> SRR1040872     1  0.1829     0.8022 0.920 0.000 0.064 0.000 0.004 0.012
#> SRR1040873     2  0.0000     0.8291 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR1040874     1  0.2260     0.8031 0.860 0.000 0.000 0.140 0.000 0.000
#> SRR1040875     1  0.4155     0.4155 0.616 0.000 0.000 0.364 0.000 0.020
#> SRR1040876     1  0.2260     0.8031 0.860 0.000 0.000 0.140 0.000 0.000
#> SRR1040877     3  0.1765     0.9585 0.096 0.000 0.904 0.000 0.000 0.000
#> SRR1040878     4  0.0000     0.6909 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR1040879     2  0.2404     0.8047 0.000 0.872 0.000 0.016 0.000 0.112
#> SRR1040880     1  0.0865     0.8201 0.964 0.000 0.000 0.036 0.000 0.000
#> SRR1040881     2  0.2218     0.8092 0.000 0.884 0.000 0.012 0.000 0.104
#> SRR1040882     1  0.1364     0.8159 0.944 0.000 0.048 0.004 0.000 0.004
#> SRR1040883     1  0.1970     0.7950 0.900 0.000 0.092 0.000 0.000 0.008
#> SRR1040884     1  0.2260     0.8031 0.860 0.000 0.000 0.140 0.000 0.000
#> SRR1040885     3  0.0260     0.7991 0.000 0.000 0.992 0.000 0.008 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 15258 rows and 73 columns.
#>   Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'CV' method.
#>   Subgroups are detected by 'kmeans' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 2.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

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

collect_plots(res)

plot of chunk CV-kmeans-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.701           0.917       0.954         0.4879 0.505   0.505
#> 3 3 0.755           0.871       0.932         0.3246 0.654   0.424
#> 4 4 0.809           0.863       0.879         0.1431 0.852   0.599
#> 5 5 0.737           0.813       0.832         0.0573 1.000   1.000
#> 6 6 0.760           0.509       0.758         0.0327 0.935   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
#> SRR1040814     1  0.0000      0.935 1.000 0.000
#> SRR1040813     1  0.5059      0.899 0.888 0.112
#> SRR1040816     2  0.0938      0.961 0.012 0.988
#> SRR1040815     2  0.0000      0.968 0.000 1.000
#> SRR1040817     1  0.0000      0.935 1.000 0.000
#> SRR1040818     2  0.0000      0.968 0.000 1.000
#> SRR1040819     2  0.0000      0.968 0.000 1.000
#> SRR1040820     2  0.0000      0.968 0.000 1.000
#> SRR1040821     2  0.0000      0.968 0.000 1.000
#> SRR1040822     1  0.0000      0.935 1.000 0.000
#> SRR1040823     1  0.1633      0.932 0.976 0.024
#> SRR1040824     2  0.0000      0.968 0.000 1.000
#> SRR1040826     1  0.0000      0.935 1.000 0.000
#> SRR1040825     2  0.0000      0.968 0.000 1.000
#> SRR1040827     2  0.0000      0.968 0.000 1.000
#> SRR1040828     2  0.0000      0.968 0.000 1.000
#> SRR1040829     2  0.0000      0.968 0.000 1.000
#> SRR1040830     1  0.7376      0.816 0.792 0.208
#> SRR1040831     1  0.0000      0.935 1.000 0.000
#> SRR1040832     2  0.0000      0.968 0.000 1.000
#> SRR1040833     1  0.7056      0.833 0.808 0.192
#> SRR1040834     1  0.7219      0.824 0.800 0.200
#> SRR1040835     2  0.0000      0.968 0.000 1.000
#> SRR1040836     1  0.4022      0.914 0.920 0.080
#> SRR1040837     2  0.0000      0.968 0.000 1.000
#> SRR1040839     2  0.0000      0.968 0.000 1.000
#> SRR1040838     1  0.5519      0.888 0.872 0.128
#> SRR1040840     2  0.0000      0.968 0.000 1.000
#> SRR1040841     1  0.7139      0.829 0.804 0.196
#> SRR1040843     2  0.0000      0.968 0.000 1.000
#> SRR1040842     2  0.0672      0.963 0.008 0.992
#> SRR1040845     2  0.2603      0.939 0.044 0.956
#> SRR1040844     1  0.6887      0.841 0.816 0.184
#> SRR1040846     2  0.0000      0.968 0.000 1.000
#> SRR1040847     1  0.7056      0.833 0.808 0.192
#> SRR1040849     1  0.0000      0.935 1.000 0.000
#> SRR1040848     2  0.0000      0.968 0.000 1.000
#> SRR1040851     1  0.0000      0.935 1.000 0.000
#> SRR1040850     2  0.7219      0.730 0.200 0.800
#> SRR1040852     1  0.4939      0.902 0.892 0.108
#> SRR1040853     1  0.2236      0.929 0.964 0.036
#> SRR1040854     1  0.0000      0.935 1.000 0.000
#> SRR1040855     1  0.0000      0.935 1.000 0.000
#> SRR1040856     2  0.0000      0.968 0.000 1.000
#> SRR1040857     1  0.0000      0.935 1.000 0.000
#> SRR1040858     1  0.0000      0.935 1.000 0.000
#> SRR1040859     2  0.2603      0.939 0.044 0.956
#> SRR1040860     2  0.2603      0.939 0.044 0.956
#> SRR1040861     1  0.0000      0.935 1.000 0.000
#> SRR1040862     2  0.2603      0.939 0.044 0.956
#> SRR1040863     2  0.2603      0.939 0.044 0.956
#> SRR1040864     1  0.1633      0.932 0.976 0.024
#> SRR1040865     1  0.0000      0.935 1.000 0.000
#> SRR1040866     2  0.9850      0.153 0.428 0.572
#> SRR1040867     1  0.0000      0.935 1.000 0.000
#> SRR1040868     1  0.4939      0.902 0.892 0.108
#> SRR1040869     1  0.0000      0.935 1.000 0.000
#> SRR1040870     1  0.0000      0.935 1.000 0.000
#> SRR1040871     1  0.0000      0.935 1.000 0.000
#> SRR1040872     1  0.0000      0.935 1.000 0.000
#> SRR1040873     2  0.0000      0.968 0.000 1.000
#> SRR1040874     1  0.7219      0.826 0.800 0.200
#> SRR1040875     1  0.4815      0.904 0.896 0.104
#> SRR1040876     1  0.6887      0.841 0.816 0.184
#> SRR1040877     1  0.0000      0.935 1.000 0.000
#> SRR1040878     1  0.4939      0.902 0.892 0.108
#> SRR1040879     2  0.0000      0.968 0.000 1.000
#> SRR1040880     1  0.2236      0.929 0.964 0.036
#> SRR1040881     2  0.0000      0.968 0.000 1.000
#> SRR1040882     1  0.0000      0.935 1.000 0.000
#> SRR1040883     1  0.0000      0.935 1.000 0.000
#> SRR1040884     1  0.4690      0.906 0.900 0.100
#> SRR1040885     1  0.0000      0.935 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
#> SRR1040814     1  0.0000     0.9458 1.000 0.000 0.000
#> SRR1040813     3  0.4645     0.8448 0.176 0.008 0.816
#> SRR1040816     3  0.4750     0.6851 0.000 0.216 0.784
#> SRR1040815     2  0.0424     0.9631 0.000 0.992 0.008
#> SRR1040817     1  0.0000     0.9458 1.000 0.000 0.000
#> SRR1040818     2  0.6286     0.0625 0.000 0.536 0.464
#> SRR1040819     2  0.0000     0.9690 0.000 1.000 0.000
#> SRR1040820     2  0.0000     0.9690 0.000 1.000 0.000
#> SRR1040821     2  0.0000     0.9690 0.000 1.000 0.000
#> SRR1040822     1  0.0000     0.9458 1.000 0.000 0.000
#> SRR1040823     3  0.1031     0.8914 0.024 0.000 0.976
#> SRR1040824     2  0.0000     0.9690 0.000 1.000 0.000
#> SRR1040826     1  0.0000     0.9458 1.000 0.000 0.000
#> SRR1040825     2  0.0000     0.9690 0.000 1.000 0.000
#> SRR1040827     2  0.0000     0.9690 0.000 1.000 0.000
#> SRR1040828     2  0.0747     0.9580 0.000 0.984 0.016
#> SRR1040829     2  0.0747     0.9580 0.000 0.984 0.016
#> SRR1040830     3  0.3755     0.8652 0.120 0.008 0.872
#> SRR1040831     1  0.4452     0.7060 0.808 0.000 0.192
#> SRR1040832     3  0.5397     0.5757 0.000 0.280 0.720
#> SRR1040833     3  0.4645     0.8448 0.176 0.008 0.816
#> SRR1040834     3  0.1170     0.8914 0.016 0.008 0.976
#> SRR1040835     2  0.0000     0.9690 0.000 1.000 0.000
#> SRR1040836     3  0.4235     0.8429 0.176 0.000 0.824
#> SRR1040837     2  0.0000     0.9690 0.000 1.000 0.000
#> SRR1040839     2  0.0000     0.9690 0.000 1.000 0.000
#> SRR1040838     3  0.1170     0.8914 0.016 0.008 0.976
#> SRR1040840     2  0.0000     0.9690 0.000 1.000 0.000
#> SRR1040841     3  0.4291     0.8578 0.152 0.008 0.840
#> SRR1040843     2  0.0000     0.9690 0.000 1.000 0.000
#> SRR1040842     3  0.0747     0.8869 0.000 0.016 0.984
#> SRR1040845     3  0.1031     0.8873 0.000 0.024 0.976
#> SRR1040844     3  0.4645     0.8448 0.176 0.008 0.816
#> SRR1040846     2  0.0000     0.9690 0.000 1.000 0.000
#> SRR1040847     3  0.4645     0.8448 0.176 0.008 0.816
#> SRR1040849     1  0.0000     0.9458 1.000 0.000 0.000
#> SRR1040848     2  0.0424     0.9631 0.000 0.992 0.008
#> SRR1040851     1  0.6305    -0.1309 0.516 0.000 0.484
#> SRR1040850     3  0.1031     0.8873 0.000 0.024 0.976
#> SRR1040852     3  0.1031     0.8914 0.024 0.000 0.976
#> SRR1040853     3  0.1031     0.8914 0.024 0.000 0.976
#> SRR1040854     1  0.0000     0.9458 1.000 0.000 0.000
#> SRR1040855     3  0.1031     0.8914 0.024 0.000 0.976
#> SRR1040856     3  0.1031     0.8873 0.000 0.024 0.976
#> SRR1040857     1  0.0000     0.9458 1.000 0.000 0.000
#> SRR1040858     1  0.0000     0.9458 1.000 0.000 0.000
#> SRR1040859     3  0.1031     0.8873 0.000 0.024 0.976
#> SRR1040860     3  0.1031     0.8873 0.000 0.024 0.976
#> SRR1040861     1  0.4002     0.7710 0.840 0.000 0.160
#> SRR1040862     3  0.1031     0.8873 0.000 0.024 0.976
#> SRR1040863     3  0.0747     0.8869 0.000 0.016 0.984
#> SRR1040864     3  0.1031     0.8914 0.024 0.000 0.976
#> SRR1040865     3  0.4346     0.8404 0.184 0.000 0.816
#> SRR1040866     3  0.0747     0.8869 0.000 0.016 0.984
#> SRR1040867     3  0.6252     0.3413 0.444 0.000 0.556
#> SRR1040868     3  0.4062     0.8535 0.164 0.000 0.836
#> SRR1040869     1  0.0000     0.9458 1.000 0.000 0.000
#> SRR1040870     1  0.0000     0.9458 1.000 0.000 0.000
#> SRR1040871     1  0.0000     0.9458 1.000 0.000 0.000
#> SRR1040872     1  0.0000     0.9458 1.000 0.000 0.000
#> SRR1040873     2  0.0000     0.9690 0.000 1.000 0.000
#> SRR1040874     3  0.4228     0.8595 0.148 0.008 0.844
#> SRR1040875     3  0.1031     0.8914 0.024 0.000 0.976
#> SRR1040876     3  0.4645     0.8448 0.176 0.008 0.816
#> SRR1040877     1  0.0000     0.9458 1.000 0.000 0.000
#> SRR1040878     3  0.1129     0.8916 0.020 0.004 0.976
#> SRR1040879     2  0.0000     0.9690 0.000 1.000 0.000
#> SRR1040880     3  0.4346     0.8404 0.184 0.000 0.816
#> SRR1040881     2  0.0000     0.9690 0.000 1.000 0.000
#> SRR1040882     1  0.0000     0.9458 1.000 0.000 0.000
#> SRR1040883     1  0.0000     0.9458 1.000 0.000 0.000
#> SRR1040884     3  0.4346     0.8404 0.184 0.000 0.816
#> SRR1040885     1  0.0000     0.9458 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
#> SRR1040814     3  0.1637      0.923 0.060 0.000 0.940 0.000
#> SRR1040813     1  0.5184      0.913 0.672 0.000 0.024 0.304
#> SRR1040816     1  0.6388      0.657 0.652 0.192 0.000 0.156
#> SRR1040815     2  0.1637      0.951 0.060 0.940 0.000 0.000
#> SRR1040817     3  0.1637      0.923 0.060 0.000 0.940 0.000
#> SRR1040818     2  0.5700      0.323 0.412 0.560 0.000 0.028
#> SRR1040819     2  0.1022      0.957 0.032 0.968 0.000 0.000
#> SRR1040820     2  0.0188      0.959 0.004 0.996 0.000 0.000
#> SRR1040821     2  0.0188      0.959 0.004 0.996 0.000 0.000
#> SRR1040822     3  0.1716      0.922 0.064 0.000 0.936 0.000
#> SRR1040823     4  0.0707      0.877 0.020 0.000 0.000 0.980
#> SRR1040824     2  0.0592      0.959 0.016 0.984 0.000 0.000
#> SRR1040826     3  0.1637      0.923 0.060 0.000 0.940 0.000
#> SRR1040825     2  0.1474      0.953 0.052 0.948 0.000 0.000
#> SRR1040827     2  0.1302      0.955 0.044 0.956 0.000 0.000
#> SRR1040828     2  0.1389      0.944 0.048 0.952 0.000 0.000
#> SRR1040829     2  0.1302      0.944 0.044 0.956 0.000 0.000
#> SRR1040830     1  0.4567      0.883 0.716 0.000 0.008 0.276
#> SRR1040831     1  0.6063      0.704 0.680 0.000 0.196 0.124
#> SRR1040832     1  0.6750      0.496 0.584 0.288 0.000 0.128
#> SRR1040833     1  0.5184      0.913 0.672 0.000 0.024 0.304
#> SRR1040834     1  0.4564      0.880 0.672 0.000 0.000 0.328
#> SRR1040835     2  0.1474      0.953 0.052 0.948 0.000 0.000
#> SRR1040836     1  0.5036      0.896 0.696 0.000 0.024 0.280
#> SRR1040837     2  0.0469      0.959 0.012 0.988 0.000 0.000
#> SRR1040839     2  0.0000      0.959 0.000 1.000 0.000 0.000
#> SRR1040838     4  0.4134      0.412 0.260 0.000 0.000 0.740
#> SRR1040840     2  0.0188      0.959 0.004 0.996 0.000 0.000
#> SRR1040841     1  0.5184      0.913 0.672 0.000 0.024 0.304
#> SRR1040843     2  0.0188      0.959 0.004 0.996 0.000 0.000
#> SRR1040842     4  0.3708      0.779 0.148 0.020 0.000 0.832
#> SRR1040845     4  0.0000      0.878 0.000 0.000 0.000 1.000
#> SRR1040844     1  0.5184      0.913 0.672 0.000 0.024 0.304
#> SRR1040846     2  0.0000      0.959 0.000 1.000 0.000 0.000
#> SRR1040847     1  0.5184      0.913 0.672 0.000 0.024 0.304
#> SRR1040849     3  0.0469      0.926 0.012 0.000 0.988 0.000
#> SRR1040848     2  0.0921      0.958 0.028 0.972 0.000 0.000
#> SRR1040851     3  0.6862      0.425 0.312 0.000 0.560 0.128
#> SRR1040850     4  0.0000      0.878 0.000 0.000 0.000 1.000
#> SRR1040852     4  0.0469      0.874 0.012 0.000 0.000 0.988
#> SRR1040853     4  0.0592      0.875 0.016 0.000 0.000 0.984
#> SRR1040854     3  0.0000      0.928 0.000 0.000 1.000 0.000
#> SRR1040855     4  0.2174      0.844 0.020 0.000 0.052 0.928
#> SRR1040856     4  0.0895      0.873 0.004 0.020 0.000 0.976
#> SRR1040857     3  0.0000      0.928 0.000 0.000 1.000 0.000
#> SRR1040858     3  0.0000      0.928 0.000 0.000 1.000 0.000
#> SRR1040859     4  0.0188      0.877 0.004 0.000 0.000 0.996
#> SRR1040860     4  0.0469      0.877 0.000 0.012 0.000 0.988
#> SRR1040861     4  0.5574      0.517 0.048 0.000 0.284 0.668
#> SRR1040862     4  0.1388      0.867 0.028 0.012 0.000 0.960
#> SRR1040863     4  0.3529      0.782 0.152 0.012 0.000 0.836
#> SRR1040864     4  0.0592      0.877 0.016 0.000 0.000 0.984
#> SRR1040865     1  0.5573      0.881 0.676 0.000 0.052 0.272
#> SRR1040866     4  0.2814      0.803 0.132 0.000 0.000 0.868
#> SRR1040867     3  0.7121      0.407 0.216 0.000 0.564 0.220
#> SRR1040868     1  0.5184      0.913 0.672 0.000 0.024 0.304
#> SRR1040869     3  0.0000      0.928 0.000 0.000 1.000 0.000
#> SRR1040870     3  0.1637      0.923 0.060 0.000 0.940 0.000
#> SRR1040871     3  0.0336      0.927 0.008 0.000 0.992 0.000
#> SRR1040872     3  0.0804      0.923 0.012 0.000 0.980 0.008
#> SRR1040873     2  0.0188      0.959 0.004 0.996 0.000 0.000
#> SRR1040874     1  0.5184      0.913 0.672 0.000 0.024 0.304
#> SRR1040875     4  0.3400      0.636 0.180 0.000 0.000 0.820
#> SRR1040876     1  0.5184      0.913 0.672 0.000 0.024 0.304
#> SRR1040877     3  0.1637      0.923 0.060 0.000 0.940 0.000
#> SRR1040878     4  0.0921      0.862 0.028 0.000 0.000 0.972
#> SRR1040879     2  0.1474      0.953 0.052 0.948 0.000 0.000
#> SRR1040880     1  0.5161      0.910 0.676 0.000 0.024 0.300
#> SRR1040881     2  0.1474      0.953 0.052 0.948 0.000 0.000
#> SRR1040882     3  0.0336      0.927 0.008 0.000 0.992 0.000
#> SRR1040883     3  0.0336      0.927 0.008 0.000 0.992 0.000
#> SRR1040884     1  0.5184      0.913 0.672 0.000 0.024 0.304
#> SRR1040885     3  0.1716      0.921 0.064 0.000 0.936 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
#> SRR1040814     3  0.2930      0.830 0.000 0.000 0.832 NA 0.004
#> SRR1040813     1  0.0290      0.909 0.992 0.000 0.000 NA 0.008
#> SRR1040816     1  0.4573      0.687 0.744 0.164 0.000 NA 0.000
#> SRR1040815     2  0.3395      0.857 0.000 0.764 0.000 NA 0.000
#> SRR1040817     3  0.2930      0.830 0.000 0.000 0.832 NA 0.004
#> SRR1040818     2  0.6655      0.333 0.296 0.444 0.000 NA 0.000
#> SRR1040819     2  0.2074      0.905 0.000 0.896 0.000 NA 0.000
#> SRR1040820     2  0.0290      0.914 0.000 0.992 0.000 NA 0.000
#> SRR1040821     2  0.0290      0.914 0.000 0.992 0.000 NA 0.000
#> SRR1040822     3  0.3132      0.827 0.000 0.000 0.820 NA 0.008
#> SRR1040823     5  0.2915      0.817 0.116 0.000 0.000 NA 0.860
#> SRR1040824     2  0.0404      0.914 0.000 0.988 0.000 NA 0.000
#> SRR1040826     3  0.2930      0.830 0.000 0.000 0.832 NA 0.004
#> SRR1040825     2  0.2773      0.889 0.000 0.836 0.000 NA 0.000
#> SRR1040827     2  0.2230      0.904 0.000 0.884 0.000 NA 0.000
#> SRR1040828     2  0.3067      0.868 0.004 0.844 0.000 NA 0.012
#> SRR1040829     2  0.2248      0.880 0.000 0.900 0.000 NA 0.012
#> SRR1040830     1  0.2470      0.847 0.884 0.000 0.000 NA 0.012
#> SRR1040831     1  0.3693      0.754 0.808 0.000 0.156 NA 0.032
#> SRR1040832     1  0.6148      0.344 0.552 0.268 0.000 NA 0.000
#> SRR1040833     1  0.0000      0.912 1.000 0.000 0.000 NA 0.000
#> SRR1040834     1  0.0609      0.904 0.980 0.000 0.000 NA 0.000
#> SRR1040835     2  0.2773      0.889 0.000 0.836 0.000 NA 0.000
#> SRR1040836     1  0.0992      0.902 0.968 0.000 0.000 NA 0.024
#> SRR1040837     2  0.1197      0.914 0.000 0.952 0.000 NA 0.000
#> SRR1040839     2  0.0000      0.914 0.000 1.000 0.000 NA 0.000
#> SRR1040838     5  0.4276      0.563 0.380 0.000 0.000 NA 0.616
#> SRR1040840     2  0.0290      0.914 0.000 0.992 0.000 NA 0.000
#> SRR1040841     1  0.0000      0.912 1.000 0.000 0.000 NA 0.000
#> SRR1040843     2  0.0290      0.914 0.000 0.992 0.000 NA 0.000
#> SRR1040842     5  0.3845      0.796 0.024 0.000 0.000 NA 0.768
#> SRR1040845     5  0.5218      0.833 0.136 0.000 0.000 NA 0.684
#> SRR1040844     1  0.0000      0.912 1.000 0.000 0.000 NA 0.000
#> SRR1040846     2  0.0290      0.914 0.000 0.992 0.000 NA 0.000
#> SRR1040847     1  0.0000      0.912 1.000 0.000 0.000 NA 0.000
#> SRR1040849     3  0.4210      0.705 0.004 0.000 0.756 NA 0.204
#> SRR1040848     2  0.2179      0.886 0.000 0.888 0.000 NA 0.000
#> SRR1040851     3  0.8007      0.337 0.136 0.000 0.420 NA 0.280
#> SRR1040850     5  0.4083      0.839 0.132 0.000 0.000 NA 0.788
#> SRR1040852     5  0.2848      0.818 0.156 0.000 0.000 NA 0.840
#> SRR1040853     5  0.2674      0.821 0.140 0.000 0.000 NA 0.856
#> SRR1040854     3  0.0324      0.842 0.004 0.000 0.992 NA 0.004
#> SRR1040855     5  0.3340      0.780 0.064 0.000 0.048 NA 0.864
#> SRR1040856     5  0.5184      0.833 0.136 0.000 0.000 NA 0.688
#> SRR1040857     3  0.0162      0.842 0.004 0.000 0.996 NA 0.000
#> SRR1040858     3  0.0162      0.842 0.004 0.000 0.996 NA 0.000
#> SRR1040859     5  0.5218      0.833 0.136 0.000 0.000 NA 0.684
#> SRR1040860     5  0.5144      0.833 0.132 0.000 0.000 NA 0.692
#> SRR1040861     5  0.5196      0.590 0.004 0.000 0.136 NA 0.700
#> SRR1040862     5  0.5772      0.791 0.120 0.000 0.000 NA 0.584
#> SRR1040863     5  0.4808      0.698 0.024 0.000 0.000 NA 0.576
#> SRR1040864     5  0.2286      0.820 0.108 0.000 0.000 NA 0.888
#> SRR1040865     1  0.3355      0.820 0.856 0.000 0.048 NA 0.084
#> SRR1040866     5  0.4250      0.781 0.028 0.000 0.000 NA 0.720
#> SRR1040867     3  0.6974      0.218 0.092 0.000 0.444 NA 0.400
#> SRR1040868     1  0.0451      0.909 0.988 0.000 0.000 NA 0.004
#> SRR1040869     3  0.0162      0.842 0.004 0.000 0.996 NA 0.000
#> SRR1040870     3  0.2930      0.830 0.000 0.000 0.832 NA 0.004
#> SRR1040871     3  0.1412      0.832 0.004 0.000 0.952 NA 0.036
#> SRR1040872     3  0.4365      0.686 0.004 0.000 0.736 NA 0.224
#> SRR1040873     2  0.0290      0.914 0.000 0.992 0.000 NA 0.000
#> SRR1040874     1  0.0000      0.912 1.000 0.000 0.000 NA 0.000
#> SRR1040875     5  0.4268      0.703 0.268 0.000 0.000 NA 0.708
#> SRR1040876     1  0.0000      0.912 1.000 0.000 0.000 NA 0.000
#> SRR1040877     3  0.2930      0.830 0.000 0.000 0.832 NA 0.004
#> SRR1040878     5  0.5309      0.829 0.160 0.000 0.000 NA 0.676
#> SRR1040879     2  0.2690      0.891 0.000 0.844 0.000 NA 0.000
#> SRR1040880     1  0.0693      0.906 0.980 0.000 0.000 NA 0.012
#> SRR1040881     2  0.2773      0.889 0.000 0.836 0.000 NA 0.000
#> SRR1040882     3  0.2047      0.833 0.012 0.000 0.928 NA 0.040
#> SRR1040883     3  0.1412      0.832 0.004 0.000 0.952 NA 0.036
#> SRR1040884     1  0.0000      0.912 1.000 0.000 0.000 NA 0.000
#> SRR1040885     3  0.3048      0.827 0.000 0.000 0.820 NA 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
#> SRR1040814     3  0.0000     0.8570 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1040813     1  0.0777     0.8613 0.972 0.000 0.000 0.000 0.024 0.004
#> SRR1040816     1  0.4946     0.3538 0.676 0.152 0.000 0.008 0.000 0.164
#> SRR1040815     2  0.4432     0.2320 0.000 0.600 0.000 0.036 0.000 0.364
#> SRR1040817     3  0.0000     0.8570 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1040818     6  0.6702     0.0000 0.212 0.352 0.000 0.044 0.000 0.392
#> SRR1040819     2  0.2340     0.6885 0.000 0.852 0.000 0.000 0.000 0.148
#> SRR1040820     2  0.0405     0.7474 0.000 0.988 0.000 0.004 0.000 0.008
#> SRR1040821     2  0.0405     0.7474 0.000 0.988 0.000 0.004 0.000 0.008
#> SRR1040822     3  0.1251     0.8391 0.000 0.000 0.956 0.012 0.008 0.024
#> SRR1040823     5  0.2239     0.2611 0.048 0.000 0.000 0.020 0.908 0.024
#> SRR1040824     2  0.0458     0.7492 0.000 0.984 0.000 0.000 0.000 0.016
#> SRR1040826     3  0.0000     0.8570 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1040825     2  0.3244     0.5579 0.000 0.732 0.000 0.000 0.000 0.268
#> SRR1040827     2  0.3073     0.6324 0.000 0.788 0.000 0.008 0.000 0.204
#> SRR1040828     2  0.4566     0.4039 0.000 0.692 0.000 0.084 0.004 0.220
#> SRR1040829     2  0.3616     0.5241 0.000 0.792 0.000 0.076 0.000 0.132
#> SRR1040830     1  0.3872     0.6809 0.776 0.000 0.000 0.076 0.004 0.144
#> SRR1040831     1  0.3293     0.7047 0.812 0.000 0.000 0.000 0.048 0.140
#> SRR1040832     1  0.6022    -0.3816 0.484 0.212 0.000 0.008 0.000 0.296
#> SRR1040833     1  0.0000     0.8730 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR1040834     1  0.0777     0.8623 0.972 0.000 0.000 0.004 0.000 0.024
#> SRR1040835     2  0.3244     0.5579 0.000 0.732 0.000 0.000 0.000 0.268
#> SRR1040836     1  0.1053     0.8621 0.964 0.000 0.000 0.004 0.012 0.020
#> SRR1040837     2  0.2053     0.7204 0.000 0.888 0.000 0.004 0.000 0.108
#> SRR1040839     2  0.0622     0.7498 0.000 0.980 0.000 0.008 0.000 0.012
#> SRR1040838     5  0.4167     0.1592 0.344 0.000 0.000 0.012 0.636 0.008
#> SRR1040840     2  0.0405     0.7474 0.000 0.988 0.000 0.004 0.000 0.008
#> SRR1040841     1  0.0000     0.8730 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR1040843     2  0.0405     0.7484 0.000 0.988 0.000 0.004 0.000 0.008
#> SRR1040842     5  0.4521    -0.4197 0.004 0.000 0.000 0.448 0.524 0.024
#> SRR1040845     5  0.5161    -0.2098 0.080 0.000 0.000 0.376 0.540 0.004
#> SRR1040844     1  0.0000     0.8730 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR1040846     2  0.0891     0.7484 0.000 0.968 0.000 0.008 0.000 0.024
#> SRR1040847     1  0.0000     0.8730 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR1040849     5  0.6726    -0.2169 0.000 0.000 0.340 0.060 0.424 0.176
#> SRR1040848     2  0.3588     0.5267 0.000 0.788 0.000 0.060 0.000 0.152
#> SRR1040851     5  0.8204     0.0570 0.072 0.000 0.104 0.220 0.360 0.244
#> SRR1040850     5  0.4406     0.0239 0.080 0.000 0.000 0.224 0.696 0.000
#> SRR1040852     5  0.2633     0.2684 0.112 0.000 0.000 0.020 0.864 0.004
#> SRR1040853     5  0.2443     0.2706 0.096 0.000 0.000 0.020 0.880 0.004
#> SRR1040854     3  0.4006     0.8516 0.000 0.000 0.748 0.016 0.032 0.204
#> SRR1040855     5  0.1750     0.2516 0.016 0.000 0.000 0.012 0.932 0.040
#> SRR1040856     5  0.5029    -0.2106 0.080 0.000 0.000 0.376 0.544 0.000
#> SRR1040857     3  0.3934     0.8531 0.000 0.000 0.752 0.016 0.028 0.204
#> SRR1040858     3  0.3934     0.8531 0.000 0.000 0.752 0.016 0.028 0.204
#> SRR1040859     5  0.5161    -0.2098 0.080 0.000 0.000 0.376 0.540 0.004
#> SRR1040860     5  0.5029    -0.2106 0.080 0.000 0.000 0.376 0.544 0.000
#> SRR1040861     5  0.5823    -0.0550 0.000 0.000 0.068 0.224 0.612 0.096
#> SRR1040862     4  0.5607     0.6216 0.052 0.000 0.000 0.528 0.372 0.048
#> SRR1040863     4  0.4644     0.6698 0.004 0.000 0.000 0.660 0.268 0.068
#> SRR1040864     5  0.1807     0.2695 0.060 0.000 0.000 0.020 0.920 0.000
#> SRR1040865     1  0.3829     0.6700 0.760 0.000 0.000 0.000 0.180 0.060
#> SRR1040866     5  0.4664    -0.4759 0.004 0.000 0.000 0.480 0.484 0.032
#> SRR1040867     5  0.6666     0.1721 0.036 0.000 0.156 0.056 0.576 0.176
#> SRR1040868     1  0.0891     0.8642 0.968 0.000 0.000 0.000 0.008 0.024
#> SRR1040869     3  0.3934     0.8531 0.000 0.000 0.752 0.016 0.028 0.204
#> SRR1040870     3  0.0000     0.8570 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1040871     3  0.4550     0.8285 0.000 0.000 0.704 0.016 0.060 0.220
#> SRR1040872     5  0.6490    -0.2109 0.000 0.000 0.344 0.040 0.440 0.176
#> SRR1040873     2  0.0405     0.7474 0.000 0.988 0.000 0.004 0.000 0.008
#> SRR1040874     1  0.0000     0.8730 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR1040875     5  0.3673     0.2493 0.204 0.000 0.000 0.008 0.764 0.024
#> SRR1040876     1  0.0000     0.8730 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR1040877     3  0.0000     0.8570 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1040878     5  0.5293    -0.1514 0.108 0.000 0.000 0.320 0.568 0.004
#> SRR1040879     2  0.3244     0.5579 0.000 0.732 0.000 0.000 0.000 0.268
#> SRR1040880     1  0.0692     0.8667 0.976 0.000 0.000 0.000 0.004 0.020
#> SRR1040881     2  0.3244     0.5579 0.000 0.732 0.000 0.000 0.000 0.268
#> SRR1040882     3  0.4890     0.8261 0.020 0.000 0.704 0.012 0.064 0.200
#> SRR1040883     3  0.4550     0.8285 0.000 0.000 0.704 0.016 0.060 0.220
#> SRR1040884     1  0.0000     0.8730 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR1040885     3  0.1261     0.8461 0.000 0.000 0.952 0.024 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-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 15258 rows and 73 columns.
#>   Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'CV' method.
#>   Subgroups are detected by 'skmeans' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 3.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

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

collect_plots(res)

plot of chunk CV-skmeans-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.864           0.938       0.972         0.5040 0.498   0.498
#> 3 3 0.986           0.927       0.968         0.2855 0.811   0.636
#> 4 4 0.807           0.837       0.925         0.1188 0.893   0.707
#> 5 5 0.763           0.688       0.844         0.0481 0.978   0.918
#> 6 6 0.728           0.564       0.788         0.0256 0.968   0.878

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
#> SRR1040814     1   0.000      0.958 1.000 0.000
#> SRR1040813     1   0.000      0.958 1.000 0.000
#> SRR1040816     2   0.000      0.985 0.000 1.000
#> SRR1040815     2   0.000      0.985 0.000 1.000
#> SRR1040817     1   0.000      0.958 1.000 0.000
#> SRR1040818     2   0.000      0.985 0.000 1.000
#> SRR1040819     2   0.000      0.985 0.000 1.000
#> SRR1040820     2   0.000      0.985 0.000 1.000
#> SRR1040821     2   0.000      0.985 0.000 1.000
#> SRR1040822     1   0.000      0.958 1.000 0.000
#> SRR1040823     1   0.000      0.958 1.000 0.000
#> SRR1040824     2   0.000      0.985 0.000 1.000
#> SRR1040826     1   0.000      0.958 1.000 0.000
#> SRR1040825     2   0.000      0.985 0.000 1.000
#> SRR1040827     2   0.000      0.985 0.000 1.000
#> SRR1040828     2   0.000      0.985 0.000 1.000
#> SRR1040829     2   0.000      0.985 0.000 1.000
#> SRR1040830     1   0.971      0.402 0.600 0.400
#> SRR1040831     1   0.000      0.958 1.000 0.000
#> SRR1040832     2   0.000      0.985 0.000 1.000
#> SRR1040833     1   0.722      0.771 0.800 0.200
#> SRR1040834     2   0.000      0.985 0.000 1.000
#> SRR1040835     2   0.000      0.985 0.000 1.000
#> SRR1040836     1   0.000      0.958 1.000 0.000
#> SRR1040837     2   0.000      0.985 0.000 1.000
#> SRR1040839     2   0.000      0.985 0.000 1.000
#> SRR1040838     1   0.000      0.958 1.000 0.000
#> SRR1040840     2   0.000      0.985 0.000 1.000
#> SRR1040841     1   0.760      0.745 0.780 0.220
#> SRR1040843     2   0.000      0.985 0.000 1.000
#> SRR1040842     2   0.000      0.985 0.000 1.000
#> SRR1040845     2   0.000      0.985 0.000 1.000
#> SRR1040844     1   0.506      0.866 0.888 0.112
#> SRR1040846     2   0.000      0.985 0.000 1.000
#> SRR1040847     1   0.722      0.771 0.800 0.200
#> SRR1040849     1   0.000      0.958 1.000 0.000
#> SRR1040848     2   0.000      0.985 0.000 1.000
#> SRR1040851     1   0.000      0.958 1.000 0.000
#> SRR1040850     2   0.000      0.985 0.000 1.000
#> SRR1040852     1   0.000      0.958 1.000 0.000
#> SRR1040853     1   0.000      0.958 1.000 0.000
#> SRR1040854     1   0.000      0.958 1.000 0.000
#> SRR1040855     1   0.000      0.958 1.000 0.000
#> SRR1040856     2   0.000      0.985 0.000 1.000
#> SRR1040857     1   0.000      0.958 1.000 0.000
#> SRR1040858     1   0.000      0.958 1.000 0.000
#> SRR1040859     2   0.000      0.985 0.000 1.000
#> SRR1040860     2   0.000      0.985 0.000 1.000
#> SRR1040861     1   0.000      0.958 1.000 0.000
#> SRR1040862     2   0.000      0.985 0.000 1.000
#> SRR1040863     2   0.000      0.985 0.000 1.000
#> SRR1040864     1   0.000      0.958 1.000 0.000
#> SRR1040865     1   0.000      0.958 1.000 0.000
#> SRR1040866     2   0.563      0.837 0.132 0.868
#> SRR1040867     1   0.000      0.958 1.000 0.000
#> SRR1040868     1   0.000      0.958 1.000 0.000
#> SRR1040869     1   0.000      0.958 1.000 0.000
#> SRR1040870     1   0.000      0.958 1.000 0.000
#> SRR1040871     1   0.000      0.958 1.000 0.000
#> SRR1040872     1   0.000      0.958 1.000 0.000
#> SRR1040873     2   0.000      0.985 0.000 1.000
#> SRR1040874     1   0.900      0.588 0.684 0.316
#> SRR1040875     1   0.000      0.958 1.000 0.000
#> SRR1040876     1   0.595      0.834 0.856 0.144
#> SRR1040877     1   0.000      0.958 1.000 0.000
#> SRR1040878     2   0.913      0.515 0.328 0.672
#> SRR1040879     2   0.000      0.985 0.000 1.000
#> SRR1040880     1   0.000      0.958 1.000 0.000
#> SRR1040881     2   0.000      0.985 0.000 1.000
#> SRR1040882     1   0.000      0.958 1.000 0.000
#> SRR1040883     1   0.000      0.958 1.000 0.000
#> SRR1040884     1   0.000      0.958 1.000 0.000
#> SRR1040885     1   0.000      0.958 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
#> SRR1040814     3  0.0237      0.958 0.004 0.000 0.996
#> SRR1040813     1  0.4178      0.769 0.828 0.000 0.172
#> SRR1040816     1  0.6305      0.102 0.516 0.484 0.000
#> SRR1040815     2  0.0000      0.993 0.000 1.000 0.000
#> SRR1040817     3  0.0237      0.958 0.004 0.000 0.996
#> SRR1040818     2  0.0000      0.993 0.000 1.000 0.000
#> SRR1040819     2  0.0000      0.993 0.000 1.000 0.000
#> SRR1040820     2  0.0000      0.993 0.000 1.000 0.000
#> SRR1040821     2  0.0000      0.993 0.000 1.000 0.000
#> SRR1040822     3  0.0237      0.958 0.004 0.000 0.996
#> SRR1040823     3  0.0237      0.954 0.004 0.000 0.996
#> SRR1040824     2  0.0000      0.993 0.000 1.000 0.000
#> SRR1040826     3  0.0237      0.958 0.004 0.000 0.996
#> SRR1040825     2  0.0000      0.993 0.000 1.000 0.000
#> SRR1040827     2  0.0000      0.993 0.000 1.000 0.000
#> SRR1040828     2  0.0000      0.993 0.000 1.000 0.000
#> SRR1040829     2  0.0000      0.993 0.000 1.000 0.000
#> SRR1040830     1  0.2945      0.878 0.908 0.088 0.004
#> SRR1040831     1  0.0592      0.929 0.988 0.000 0.012
#> SRR1040832     2  0.0000      0.993 0.000 1.000 0.000
#> SRR1040833     1  0.0661      0.930 0.988 0.004 0.008
#> SRR1040834     1  0.2066      0.900 0.940 0.060 0.000
#> SRR1040835     2  0.0000      0.993 0.000 1.000 0.000
#> SRR1040836     1  0.1643      0.915 0.956 0.000 0.044
#> SRR1040837     2  0.0000      0.993 0.000 1.000 0.000
#> SRR1040839     2  0.0000      0.993 0.000 1.000 0.000
#> SRR1040838     3  0.6225      0.257 0.432 0.000 0.568
#> SRR1040840     2  0.0000      0.993 0.000 1.000 0.000
#> SRR1040841     1  0.0661      0.928 0.988 0.008 0.004
#> SRR1040843     2  0.0000      0.993 0.000 1.000 0.000
#> SRR1040842     2  0.0829      0.984 0.012 0.984 0.004
#> SRR1040845     2  0.0661      0.987 0.008 0.988 0.004
#> SRR1040844     1  0.0592      0.929 0.988 0.000 0.012
#> SRR1040846     2  0.0000      0.993 0.000 1.000 0.000
#> SRR1040847     1  0.0661      0.930 0.988 0.004 0.008
#> SRR1040849     3  0.0237      0.958 0.004 0.000 0.996
#> SRR1040848     2  0.0000      0.993 0.000 1.000 0.000
#> SRR1040851     3  0.0424      0.955 0.008 0.000 0.992
#> SRR1040850     2  0.0829      0.984 0.012 0.984 0.004
#> SRR1040852     3  0.0237      0.954 0.004 0.000 0.996
#> SRR1040853     3  0.0424      0.951 0.008 0.000 0.992
#> SRR1040854     3  0.0237      0.958 0.004 0.000 0.996
#> SRR1040855     3  0.0424      0.951 0.008 0.000 0.992
#> SRR1040856     2  0.0000      0.993 0.000 1.000 0.000
#> SRR1040857     3  0.0237      0.958 0.004 0.000 0.996
#> SRR1040858     3  0.0237      0.958 0.004 0.000 0.996
#> SRR1040859     2  0.0424      0.989 0.008 0.992 0.000
#> SRR1040860     2  0.0829      0.984 0.012 0.984 0.004
#> SRR1040861     3  0.0424      0.951 0.008 0.000 0.992
#> SRR1040862     2  0.0829      0.984 0.012 0.984 0.004
#> SRR1040863     2  0.0829      0.984 0.012 0.984 0.004
#> SRR1040864     3  0.0424      0.951 0.008 0.000 0.992
#> SRR1040865     3  0.0592      0.952 0.012 0.000 0.988
#> SRR1040866     2  0.3670      0.872 0.020 0.888 0.092
#> SRR1040867     3  0.0237      0.958 0.004 0.000 0.996
#> SRR1040868     1  0.1163      0.924 0.972 0.000 0.028
#> SRR1040869     3  0.0237      0.958 0.004 0.000 0.996
#> SRR1040870     3  0.0237      0.958 0.004 0.000 0.996
#> SRR1040871     3  0.0237      0.958 0.004 0.000 0.996
#> SRR1040872     3  0.0237      0.958 0.004 0.000 0.996
#> SRR1040873     2  0.0000      0.993 0.000 1.000 0.000
#> SRR1040874     1  0.0661      0.928 0.988 0.008 0.004
#> SRR1040875     3  0.2448      0.890 0.076 0.000 0.924
#> SRR1040876     1  0.0661      0.930 0.988 0.004 0.008
#> SRR1040877     3  0.0237      0.958 0.004 0.000 0.996
#> SRR1040878     3  0.6754      0.211 0.012 0.432 0.556
#> SRR1040879     2  0.0000      0.993 0.000 1.000 0.000
#> SRR1040880     1  0.2066      0.903 0.940 0.000 0.060
#> SRR1040881     2  0.0000      0.993 0.000 1.000 0.000
#> SRR1040882     3  0.0237      0.958 0.004 0.000 0.996
#> SRR1040883     3  0.0237      0.958 0.004 0.000 0.996
#> SRR1040884     1  0.0592      0.929 0.988 0.000 0.012
#> SRR1040885     3  0.0237      0.958 0.004 0.000 0.996

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> SRR1040814     3  0.0000      0.925 0.000 0.000 1.000 0.000
#> SRR1040813     1  0.5150      0.319 0.596 0.000 0.396 0.008
#> SRR1040816     2  0.4331      0.561 0.288 0.712 0.000 0.000
#> SRR1040815     2  0.0000      0.969 0.000 1.000 0.000 0.000
#> SRR1040817     3  0.0000      0.925 0.000 0.000 1.000 0.000
#> SRR1040818     2  0.0592      0.953 0.000 0.984 0.000 0.016
#> SRR1040819     2  0.0000      0.969 0.000 1.000 0.000 0.000
#> SRR1040820     2  0.0000      0.969 0.000 1.000 0.000 0.000
#> SRR1040821     2  0.0000      0.969 0.000 1.000 0.000 0.000
#> SRR1040822     3  0.0000      0.925 0.000 0.000 1.000 0.000
#> SRR1040823     3  0.2589      0.853 0.000 0.000 0.884 0.116
#> SRR1040824     2  0.0000      0.969 0.000 1.000 0.000 0.000
#> SRR1040826     3  0.0000      0.925 0.000 0.000 1.000 0.000
#> SRR1040825     2  0.0000      0.969 0.000 1.000 0.000 0.000
#> SRR1040827     2  0.0000      0.969 0.000 1.000 0.000 0.000
#> SRR1040828     2  0.0000      0.969 0.000 1.000 0.000 0.000
#> SRR1040829     2  0.0000      0.969 0.000 1.000 0.000 0.000
#> SRR1040830     1  0.3306      0.748 0.840 0.156 0.000 0.004
#> SRR1040831     1  0.0817      0.872 0.976 0.000 0.024 0.000
#> SRR1040832     2  0.0000      0.969 0.000 1.000 0.000 0.000
#> SRR1040833     1  0.0000      0.876 1.000 0.000 0.000 0.000
#> SRR1040834     1  0.3402      0.739 0.832 0.164 0.000 0.004
#> SRR1040835     2  0.0000      0.969 0.000 1.000 0.000 0.000
#> SRR1040836     1  0.4599      0.774 0.800 0.000 0.112 0.088
#> SRR1040837     2  0.0000      0.969 0.000 1.000 0.000 0.000
#> SRR1040839     2  0.0000      0.969 0.000 1.000 0.000 0.000
#> SRR1040838     3  0.8223      0.124 0.312 0.020 0.440 0.228
#> SRR1040840     2  0.0000      0.969 0.000 1.000 0.000 0.000
#> SRR1040841     1  0.0469      0.874 0.988 0.012 0.000 0.000
#> SRR1040843     2  0.0000      0.969 0.000 1.000 0.000 0.000
#> SRR1040842     4  0.0592      0.765 0.000 0.016 0.000 0.984
#> SRR1040845     4  0.4222      0.645 0.000 0.272 0.000 0.728
#> SRR1040844     1  0.0000      0.876 1.000 0.000 0.000 0.000
#> SRR1040846     2  0.0000      0.969 0.000 1.000 0.000 0.000
#> SRR1040847     1  0.0000      0.876 1.000 0.000 0.000 0.000
#> SRR1040849     3  0.0000      0.925 0.000 0.000 1.000 0.000
#> SRR1040848     2  0.0000      0.969 0.000 1.000 0.000 0.000
#> SRR1040851     3  0.2737      0.854 0.008 0.000 0.888 0.104
#> SRR1040850     4  0.2401      0.769 0.004 0.092 0.000 0.904
#> SRR1040852     3  0.2149      0.876 0.000 0.000 0.912 0.088
#> SRR1040853     3  0.4122      0.704 0.004 0.000 0.760 0.236
#> SRR1040854     3  0.0000      0.925 0.000 0.000 1.000 0.000
#> SRR1040855     3  0.1637      0.894 0.000 0.000 0.940 0.060
#> SRR1040856     2  0.4103      0.585 0.000 0.744 0.000 0.256
#> SRR1040857     3  0.0000      0.925 0.000 0.000 1.000 0.000
#> SRR1040858     3  0.0000      0.925 0.000 0.000 1.000 0.000
#> SRR1040859     4  0.5277      0.237 0.008 0.460 0.000 0.532
#> SRR1040860     4  0.4008      0.685 0.000 0.244 0.000 0.756
#> SRR1040861     3  0.4331      0.615 0.000 0.000 0.712 0.288
#> SRR1040862     4  0.2088      0.773 0.004 0.064 0.004 0.928
#> SRR1040863     4  0.0592      0.764 0.000 0.016 0.000 0.984
#> SRR1040864     4  0.4877      0.193 0.000 0.000 0.408 0.592
#> SRR1040865     3  0.1398      0.899 0.040 0.000 0.956 0.004
#> SRR1040866     4  0.0657      0.761 0.000 0.012 0.004 0.984
#> SRR1040867     3  0.1302      0.904 0.000 0.000 0.956 0.044
#> SRR1040868     1  0.3208      0.786 0.848 0.000 0.148 0.004
#> SRR1040869     3  0.0000      0.925 0.000 0.000 1.000 0.000
#> SRR1040870     3  0.0000      0.925 0.000 0.000 1.000 0.000
#> SRR1040871     3  0.0000      0.925 0.000 0.000 1.000 0.000
#> SRR1040872     3  0.0000      0.925 0.000 0.000 1.000 0.000
#> SRR1040873     2  0.0000      0.969 0.000 1.000 0.000 0.000
#> SRR1040874     1  0.0817      0.869 0.976 0.024 0.000 0.000
#> SRR1040875     3  0.5576      0.675 0.096 0.000 0.720 0.184
#> SRR1040876     1  0.0000      0.876 1.000 0.000 0.000 0.000
#> SRR1040877     3  0.0000      0.925 0.000 0.000 1.000 0.000
#> SRR1040878     4  0.4114      0.680 0.016 0.008 0.164 0.812
#> SRR1040879     2  0.0000      0.969 0.000 1.000 0.000 0.000
#> SRR1040880     1  0.2918      0.817 0.876 0.000 0.116 0.008
#> SRR1040881     2  0.0000      0.969 0.000 1.000 0.000 0.000
#> SRR1040882     3  0.0188      0.923 0.004 0.000 0.996 0.000
#> SRR1040883     3  0.0000      0.925 0.000 0.000 1.000 0.000
#> SRR1040884     1  0.0188      0.876 0.996 0.000 0.004 0.000
#> SRR1040885     3  0.0000      0.925 0.000 0.000 1.000 0.000

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>            class entropy silhouette    p1    p2    p3    p4    p5
#> SRR1040814     3  0.0290      0.808 0.000 0.000 0.992 0.000 0.008
#> SRR1040813     1  0.6891     -0.139 0.424 0.000 0.404 0.028 0.144
#> SRR1040816     2  0.4797      0.518 0.280 0.676 0.000 0.004 0.040
#> SRR1040815     2  0.0671      0.946 0.000 0.980 0.000 0.004 0.016
#> SRR1040817     3  0.0162      0.808 0.000 0.000 0.996 0.000 0.004
#> SRR1040818     2  0.1750      0.915 0.000 0.936 0.000 0.028 0.036
#> SRR1040819     2  0.0404      0.949 0.000 0.988 0.000 0.000 0.012
#> SRR1040820     2  0.0324      0.950 0.000 0.992 0.000 0.004 0.004
#> SRR1040821     2  0.0324      0.950 0.000 0.992 0.000 0.004 0.004
#> SRR1040822     3  0.1410      0.792 0.000 0.000 0.940 0.000 0.060
#> SRR1040823     3  0.5068      0.278 0.000 0.000 0.640 0.060 0.300
#> SRR1040824     2  0.0162      0.950 0.000 0.996 0.000 0.000 0.004
#> SRR1040826     3  0.0794      0.805 0.000 0.000 0.972 0.000 0.028
#> SRR1040825     2  0.0510      0.948 0.000 0.984 0.000 0.000 0.016
#> SRR1040827     2  0.0324      0.950 0.000 0.992 0.000 0.004 0.004
#> SRR1040828     2  0.1571      0.914 0.000 0.936 0.000 0.004 0.060
#> SRR1040829     2  0.1168      0.934 0.000 0.960 0.000 0.008 0.032
#> SRR1040830     1  0.3916      0.688 0.804 0.104 0.000 0.000 0.092
#> SRR1040831     1  0.3012      0.740 0.860 0.000 0.104 0.000 0.036
#> SRR1040832     2  0.0963      0.938 0.000 0.964 0.000 0.000 0.036
#> SRR1040833     1  0.0000      0.790 1.000 0.000 0.000 0.000 0.000
#> SRR1040834     1  0.5488      0.541 0.676 0.180 0.000 0.008 0.136
#> SRR1040835     2  0.0510      0.948 0.000 0.984 0.000 0.000 0.016
#> SRR1040836     1  0.6532      0.535 0.624 0.000 0.180 0.072 0.124
#> SRR1040837     2  0.0162      0.950 0.000 0.996 0.000 0.000 0.004
#> SRR1040839     2  0.0162      0.950 0.000 0.996 0.000 0.000 0.004
#> SRR1040838     5  0.7458      0.321 0.160 0.004 0.180 0.112 0.544
#> SRR1040840     2  0.0324      0.950 0.000 0.992 0.000 0.004 0.004
#> SRR1040841     1  0.0566      0.790 0.984 0.004 0.000 0.000 0.012
#> SRR1040843     2  0.0451      0.949 0.000 0.988 0.000 0.008 0.004
#> SRR1040842     4  0.2389      0.577 0.000 0.004 0.000 0.880 0.116
#> SRR1040845     4  0.5490      0.488 0.000 0.228 0.000 0.644 0.128
#> SRR1040844     1  0.0290      0.790 0.992 0.000 0.000 0.000 0.008
#> SRR1040846     2  0.0324      0.950 0.000 0.992 0.000 0.004 0.004
#> SRR1040847     1  0.0000      0.790 1.000 0.000 0.000 0.000 0.000
#> SRR1040849     3  0.1544      0.785 0.000 0.000 0.932 0.000 0.068
#> SRR1040848     2  0.0290      0.949 0.000 0.992 0.000 0.008 0.000
#> SRR1040851     3  0.4713      0.561 0.008 0.000 0.752 0.100 0.140
#> SRR1040850     4  0.5252      0.478 0.000 0.068 0.000 0.616 0.316
#> SRR1040852     3  0.5171     -0.220 0.000 0.000 0.504 0.040 0.456
#> SRR1040853     5  0.6243      0.434 0.000 0.000 0.380 0.148 0.472
#> SRR1040854     3  0.0963      0.802 0.000 0.000 0.964 0.000 0.036
#> SRR1040855     3  0.4083      0.542 0.000 0.000 0.744 0.028 0.228
#> SRR1040856     2  0.4865      0.491 0.000 0.684 0.000 0.252 0.064
#> SRR1040857     3  0.0880      0.803 0.000 0.000 0.968 0.000 0.032
#> SRR1040858     3  0.0963      0.802 0.000 0.000 0.964 0.000 0.036
#> SRR1040859     4  0.6703      0.340 0.000 0.360 0.000 0.396 0.244
#> SRR1040860     4  0.5882      0.535 0.000 0.148 0.000 0.588 0.264
#> SRR1040861     3  0.6193     -0.171 0.000 0.000 0.544 0.272 0.184
#> SRR1040862     4  0.3398      0.587 0.000 0.024 0.004 0.828 0.144
#> SRR1040863     4  0.1952      0.574 0.000 0.004 0.000 0.912 0.084
#> SRR1040864     5  0.6752      0.349 0.000 0.000 0.264 0.352 0.384
#> SRR1040865     3  0.3526      0.680 0.072 0.000 0.832 0.000 0.096
#> SRR1040866     4  0.2732      0.552 0.000 0.000 0.000 0.840 0.160
#> SRR1040867     3  0.3267      0.714 0.000 0.000 0.844 0.044 0.112
#> SRR1040868     1  0.5661      0.518 0.644 0.000 0.208 0.004 0.144
#> SRR1040869     3  0.0963      0.802 0.000 0.000 0.964 0.000 0.036
#> SRR1040870     3  0.0703      0.805 0.000 0.000 0.976 0.000 0.024
#> SRR1040871     3  0.1341      0.794 0.000 0.000 0.944 0.000 0.056
#> SRR1040872     3  0.1478      0.799 0.000 0.000 0.936 0.000 0.064
#> SRR1040873     2  0.0324      0.950 0.000 0.992 0.000 0.004 0.004
#> SRR1040874     1  0.1106      0.784 0.964 0.024 0.000 0.000 0.012
#> SRR1040875     3  0.7773     -0.299 0.108 0.000 0.452 0.164 0.276
#> SRR1040876     1  0.0510      0.790 0.984 0.000 0.000 0.000 0.016
#> SRR1040877     3  0.0880      0.803 0.000 0.000 0.968 0.000 0.032
#> SRR1040878     4  0.6315      0.190 0.020 0.000 0.092 0.476 0.412
#> SRR1040879     2  0.0290      0.950 0.000 0.992 0.000 0.000 0.008
#> SRR1040880     1  0.4999      0.637 0.720 0.000 0.148 0.004 0.128
#> SRR1040881     2  0.0404      0.949 0.000 0.988 0.000 0.000 0.012
#> SRR1040882     3  0.0693      0.808 0.012 0.000 0.980 0.000 0.008
#> SRR1040883     3  0.0963      0.802 0.000 0.000 0.964 0.000 0.036
#> SRR1040884     1  0.1300      0.786 0.956 0.000 0.016 0.000 0.028
#> SRR1040885     3  0.0880      0.803 0.000 0.000 0.968 0.000 0.032

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>            class entropy silhouette    p1    p2    p3    p4    p5    p6
#> SRR1040814     3  0.0405     0.7319 0.000 0.000 0.988 0.000 0.004 0.008
#> SRR1040813     3  0.7575    -0.3039 0.316 0.000 0.368 0.012 0.144 0.160
#> SRR1040816     2  0.5444     0.3859 0.244 0.628 0.000 0.000 0.036 0.092
#> SRR1040815     2  0.1218     0.9087 0.000 0.956 0.000 0.012 0.004 0.028
#> SRR1040817     3  0.0405     0.7329 0.000 0.000 0.988 0.000 0.008 0.004
#> SRR1040818     2  0.2800     0.8415 0.000 0.876 0.000 0.052 0.020 0.052
#> SRR1040819     2  0.0405     0.9244 0.000 0.988 0.000 0.000 0.004 0.008
#> SRR1040820     2  0.0000     0.9264 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR1040821     2  0.0000     0.9264 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR1040822     3  0.1168     0.7213 0.000 0.000 0.956 0.000 0.016 0.028
#> SRR1040823     3  0.6950    -0.3284 0.000 0.000 0.456 0.104 0.276 0.164
#> SRR1040824     2  0.0146     0.9261 0.000 0.996 0.000 0.000 0.000 0.004
#> SRR1040826     3  0.0508     0.7307 0.000 0.000 0.984 0.000 0.004 0.012
#> SRR1040825     2  0.0692     0.9197 0.000 0.976 0.000 0.000 0.004 0.020
#> SRR1040827     2  0.0146     0.9261 0.000 0.996 0.000 0.000 0.000 0.004
#> SRR1040828     2  0.2814     0.7601 0.000 0.820 0.000 0.000 0.008 0.172
#> SRR1040829     2  0.1765     0.8540 0.000 0.904 0.000 0.000 0.000 0.096
#> SRR1040830     1  0.5689     0.5251 0.628 0.080 0.000 0.008 0.048 0.236
#> SRR1040831     1  0.3803     0.6900 0.804 0.000 0.088 0.000 0.088 0.020
#> SRR1040832     2  0.2436     0.8453 0.000 0.880 0.000 0.000 0.032 0.088
#> SRR1040833     1  0.0725     0.7662 0.976 0.000 0.000 0.000 0.012 0.012
#> SRR1040834     1  0.6915     0.3964 0.552 0.152 0.000 0.020 0.132 0.144
#> SRR1040835     2  0.0603     0.9211 0.000 0.980 0.000 0.000 0.004 0.016
#> SRR1040836     1  0.8048     0.2113 0.416 0.000 0.224 0.092 0.180 0.088
#> SRR1040837     2  0.0000     0.9264 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR1040839     2  0.0000     0.9264 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR1040838     5  0.7364     0.2397 0.128 0.000 0.144 0.040 0.512 0.176
#> SRR1040840     2  0.0000     0.9264 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR1040841     1  0.1552     0.7609 0.940 0.004 0.000 0.000 0.036 0.020
#> SRR1040843     2  0.0000     0.9264 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR1040842     4  0.3843     0.3589 0.000 0.036 0.000 0.808 0.088 0.068
#> SRR1040845     4  0.6146    -0.0763 0.000 0.276 0.000 0.520 0.028 0.176
#> SRR1040844     1  0.0717     0.7675 0.976 0.000 0.000 0.000 0.016 0.008
#> SRR1040846     2  0.0000     0.9264 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR1040847     1  0.0891     0.7674 0.968 0.000 0.000 0.000 0.024 0.008
#> SRR1040849     3  0.2452     0.6805 0.000 0.000 0.884 0.004 0.084 0.028
#> SRR1040848     2  0.0291     0.9242 0.000 0.992 0.000 0.004 0.000 0.004
#> SRR1040851     3  0.6135     0.2721 0.008 0.000 0.616 0.120 0.176 0.080
#> SRR1040850     4  0.6605     0.1923 0.000 0.072 0.000 0.508 0.244 0.176
#> SRR1040852     5  0.5678     0.3886 0.000 0.000 0.432 0.052 0.468 0.048
#> SRR1040853     5  0.6853     0.5069 0.004 0.000 0.308 0.092 0.464 0.132
#> SRR1040854     3  0.1196     0.7271 0.000 0.000 0.952 0.000 0.040 0.008
#> SRR1040855     3  0.5443     0.2321 0.000 0.000 0.656 0.084 0.200 0.060
#> SRR1040856     2  0.5458     0.3194 0.000 0.636 0.000 0.224 0.036 0.104
#> SRR1040857     3  0.1225     0.7291 0.000 0.000 0.952 0.000 0.036 0.012
#> SRR1040858     3  0.1398     0.7229 0.000 0.000 0.940 0.000 0.052 0.008
#> SRR1040859     6  0.7111    -0.0786 0.004 0.316 0.000 0.264 0.060 0.356
#> SRR1040860     4  0.6762    -0.1227 0.000 0.184 0.000 0.468 0.072 0.276
#> SRR1040861     3  0.6837    -0.2202 0.000 0.000 0.504 0.220 0.140 0.136
#> SRR1040862     4  0.5089     0.2405 0.000 0.040 0.000 0.676 0.072 0.212
#> SRR1040863     4  0.2611     0.3436 0.000 0.016 0.000 0.876 0.016 0.092
#> SRR1040864     4  0.7497    -0.2245 0.000 0.000 0.212 0.332 0.304 0.152
#> SRR1040865     3  0.5354     0.3150 0.072 0.000 0.644 0.000 0.236 0.048
#> SRR1040866     4  0.3826     0.3378 0.000 0.000 0.004 0.784 0.088 0.124
#> SRR1040867     3  0.3788     0.5983 0.000 0.000 0.812 0.040 0.092 0.056
#> SRR1040868     1  0.6184     0.3699 0.520 0.000 0.156 0.000 0.288 0.036
#> SRR1040869     3  0.1196     0.7271 0.000 0.000 0.952 0.000 0.040 0.008
#> SRR1040870     3  0.0405     0.7319 0.000 0.000 0.988 0.000 0.004 0.008
#> SRR1040871     3  0.2264     0.6918 0.004 0.000 0.888 0.000 0.096 0.012
#> SRR1040872     3  0.2113     0.6938 0.000 0.000 0.896 0.004 0.092 0.008
#> SRR1040873     2  0.0000     0.9264 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR1040874     1  0.0665     0.7665 0.980 0.004 0.000 0.000 0.008 0.008
#> SRR1040875     3  0.7472    -0.4226 0.036 0.000 0.384 0.096 0.360 0.124
#> SRR1040876     1  0.1225     0.7656 0.952 0.000 0.000 0.000 0.012 0.036
#> SRR1040877     3  0.0520     0.7309 0.000 0.000 0.984 0.000 0.008 0.008
#> SRR1040878     6  0.7403    -0.2854 0.016 0.000 0.076 0.328 0.216 0.364
#> SRR1040879     2  0.0260     0.9254 0.000 0.992 0.000 0.000 0.000 0.008
#> SRR1040880     1  0.6461     0.4383 0.552 0.000 0.164 0.008 0.220 0.056
#> SRR1040881     2  0.0405     0.9244 0.000 0.988 0.000 0.000 0.004 0.008
#> SRR1040882     3  0.1871     0.7187 0.016 0.000 0.928 0.000 0.024 0.032
#> SRR1040883     3  0.1707     0.7185 0.004 0.000 0.928 0.000 0.056 0.012
#> SRR1040884     1  0.2112     0.7540 0.916 0.000 0.028 0.000 0.036 0.020
#> SRR1040885     3  0.0508     0.7307 0.000 0.000 0.984 0.000 0.004 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-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 15258 rows and 73 columns.
#>   Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'CV' method.
#>   Subgroups are detected by 'pam' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 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 1.000           0.981       0.993         0.3976 0.610   0.610
#> 3 3 0.999           0.938       0.976         0.5419 0.787   0.650
#> 4 4 0.846           0.705       0.901         0.0474 0.966   0.915
#> 5 5 0.892           0.732       0.895         0.0290 0.971   0.922
#> 6 6 0.858           0.850       0.909         0.0246 0.970   0.912

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

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

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

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

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

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>            class entropy silhouette    p1    p2
#> SRR1040814     1  0.0000      0.990 1.000 0.000
#> SRR1040813     1  0.0000      0.990 1.000 0.000
#> SRR1040816     1  0.2778      0.944 0.952 0.048
#> SRR1040815     2  0.0000      1.000 0.000 1.000
#> SRR1040817     1  0.0000      0.990 1.000 0.000
#> SRR1040818     1  0.9815      0.284 0.580 0.420
#> SRR1040819     2  0.0000      1.000 0.000 1.000
#> SRR1040820     2  0.0000      1.000 0.000 1.000
#> SRR1040821     2  0.0000      1.000 0.000 1.000
#> SRR1040822     1  0.0000      0.990 1.000 0.000
#> SRR1040823     1  0.0000      0.990 1.000 0.000
#> SRR1040824     2  0.0000      1.000 0.000 1.000
#> SRR1040826     1  0.0000      0.990 1.000 0.000
#> SRR1040825     2  0.0000      1.000 0.000 1.000
#> SRR1040827     2  0.0000      1.000 0.000 1.000
#> SRR1040828     2  0.0672      0.992 0.008 0.992
#> SRR1040829     2  0.0000      1.000 0.000 1.000
#> SRR1040830     1  0.0000      0.990 1.000 0.000
#> SRR1040831     1  0.0000      0.990 1.000 0.000
#> SRR1040832     1  0.3274      0.931 0.940 0.060
#> SRR1040833     1  0.0000      0.990 1.000 0.000
#> SRR1040834     1  0.0000      0.990 1.000 0.000
#> SRR1040835     2  0.0000      1.000 0.000 1.000
#> SRR1040836     1  0.0000      0.990 1.000 0.000
#> SRR1040837     2  0.0000      1.000 0.000 1.000
#> SRR1040839     2  0.0000      1.000 0.000 1.000
#> SRR1040838     1  0.0000      0.990 1.000 0.000
#> SRR1040840     2  0.0000      1.000 0.000 1.000
#> SRR1040841     1  0.0000      0.990 1.000 0.000
#> SRR1040843     2  0.0000      1.000 0.000 1.000
#> SRR1040842     1  0.0000      0.990 1.000 0.000
#> SRR1040845     1  0.0000      0.990 1.000 0.000
#> SRR1040844     1  0.0000      0.990 1.000 0.000
#> SRR1040846     2  0.0000      1.000 0.000 1.000
#> SRR1040847     1  0.0000      0.990 1.000 0.000
#> SRR1040849     1  0.0000      0.990 1.000 0.000
#> SRR1040848     2  0.0000      1.000 0.000 1.000
#> SRR1040851     1  0.0000      0.990 1.000 0.000
#> SRR1040850     1  0.0000      0.990 1.000 0.000
#> SRR1040852     1  0.0000      0.990 1.000 0.000
#> SRR1040853     1  0.0000      0.990 1.000 0.000
#> SRR1040854     1  0.0000      0.990 1.000 0.000
#> SRR1040855     1  0.0000      0.990 1.000 0.000
#> SRR1040856     1  0.0000      0.990 1.000 0.000
#> SRR1040857     1  0.0000      0.990 1.000 0.000
#> SRR1040858     1  0.0000      0.990 1.000 0.000
#> SRR1040859     1  0.0000      0.990 1.000 0.000
#> SRR1040860     1  0.0000      0.990 1.000 0.000
#> SRR1040861     1  0.0000      0.990 1.000 0.000
#> SRR1040862     1  0.0000      0.990 1.000 0.000
#> SRR1040863     1  0.0000      0.990 1.000 0.000
#> SRR1040864     1  0.0000      0.990 1.000 0.000
#> SRR1040865     1  0.0000      0.990 1.000 0.000
#> SRR1040866     1  0.0000      0.990 1.000 0.000
#> SRR1040867     1  0.0000      0.990 1.000 0.000
#> SRR1040868     1  0.0000      0.990 1.000 0.000
#> SRR1040869     1  0.0000      0.990 1.000 0.000
#> SRR1040870     1  0.0000      0.990 1.000 0.000
#> SRR1040871     1  0.0000      0.990 1.000 0.000
#> SRR1040872     1  0.0000      0.990 1.000 0.000
#> SRR1040873     2  0.0000      1.000 0.000 1.000
#> SRR1040874     1  0.0000      0.990 1.000 0.000
#> SRR1040875     1  0.0000      0.990 1.000 0.000
#> SRR1040876     1  0.0000      0.990 1.000 0.000
#> SRR1040877     1  0.0000      0.990 1.000 0.000
#> SRR1040878     1  0.0000      0.990 1.000 0.000
#> SRR1040879     2  0.0000      1.000 0.000 1.000
#> SRR1040880     1  0.0000      0.990 1.000 0.000
#> SRR1040881     2  0.0000      1.000 0.000 1.000
#> SRR1040882     1  0.0000      0.990 1.000 0.000
#> SRR1040883     1  0.0000      0.990 1.000 0.000
#> SRR1040884     1  0.0000      0.990 1.000 0.000
#> SRR1040885     1  0.0000      0.990 1.000 0.000

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>            class entropy silhouette    p1    p2    p3
#> SRR1040814     1  0.0000      0.969 1.000 0.000 0.000
#> SRR1040813     3  0.0000      0.961 0.000 0.000 1.000
#> SRR1040816     3  0.1753      0.920 0.000 0.048 0.952
#> SRR1040815     2  0.0000      0.999 0.000 1.000 0.000
#> SRR1040817     1  0.0000      0.969 1.000 0.000 0.000
#> SRR1040818     3  0.6192      0.301 0.000 0.420 0.580
#> SRR1040819     2  0.0000      0.999 0.000 1.000 0.000
#> SRR1040820     2  0.0000      0.999 0.000 1.000 0.000
#> SRR1040821     2  0.0000      0.999 0.000 1.000 0.000
#> SRR1040822     3  0.6260      0.178 0.448 0.000 0.552
#> SRR1040823     3  0.0000      0.961 0.000 0.000 1.000
#> SRR1040824     2  0.0000      0.999 0.000 1.000 0.000
#> SRR1040826     1  0.0000      0.969 1.000 0.000 0.000
#> SRR1040825     2  0.0000      0.999 0.000 1.000 0.000
#> SRR1040827     2  0.0000      0.999 0.000 1.000 0.000
#> SRR1040828     2  0.0424      0.989 0.000 0.992 0.008
#> SRR1040829     2  0.0000      0.999 0.000 1.000 0.000
#> SRR1040830     3  0.0000      0.961 0.000 0.000 1.000
#> SRR1040831     1  0.0237      0.967 0.996 0.000 0.004
#> SRR1040832     3  0.2066      0.908 0.000 0.060 0.940
#> SRR1040833     3  0.5905      0.452 0.352 0.000 0.648
#> SRR1040834     3  0.0000      0.961 0.000 0.000 1.000
#> SRR1040835     2  0.0000      0.999 0.000 1.000 0.000
#> SRR1040836     3  0.0000      0.961 0.000 0.000 1.000
#> SRR1040837     2  0.0000      0.999 0.000 1.000 0.000
#> SRR1040839     2  0.0000      0.999 0.000 1.000 0.000
#> SRR1040838     3  0.0000      0.961 0.000 0.000 1.000
#> SRR1040840     2  0.0000      0.999 0.000 1.000 0.000
#> SRR1040841     3  0.0000      0.961 0.000 0.000 1.000
#> SRR1040843     2  0.0000      0.999 0.000 1.000 0.000
#> SRR1040842     3  0.0000      0.961 0.000 0.000 1.000
#> SRR1040845     3  0.0000      0.961 0.000 0.000 1.000
#> SRR1040844     3  0.0000      0.961 0.000 0.000 1.000
#> SRR1040846     2  0.0000      0.999 0.000 1.000 0.000
#> SRR1040847     3  0.0000      0.961 0.000 0.000 1.000
#> SRR1040849     3  0.1529      0.929 0.040 0.000 0.960
#> SRR1040848     2  0.0000      0.999 0.000 1.000 0.000
#> SRR1040851     3  0.0592      0.952 0.012 0.000 0.988
#> SRR1040850     3  0.0000      0.961 0.000 0.000 1.000
#> SRR1040852     3  0.0000      0.961 0.000 0.000 1.000
#> SRR1040853     3  0.0000      0.961 0.000 0.000 1.000
#> SRR1040854     1  0.0000      0.969 1.000 0.000 0.000
#> SRR1040855     3  0.0000      0.961 0.000 0.000 1.000
#> SRR1040856     3  0.0000      0.961 0.000 0.000 1.000
#> SRR1040857     1  0.0000      0.969 1.000 0.000 0.000
#> SRR1040858     1  0.0000      0.969 1.000 0.000 0.000
#> SRR1040859     3  0.0000      0.961 0.000 0.000 1.000
#> SRR1040860     3  0.0000      0.961 0.000 0.000 1.000
#> SRR1040861     3  0.2165      0.906 0.064 0.000 0.936
#> SRR1040862     3  0.0000      0.961 0.000 0.000 1.000
#> SRR1040863     3  0.0000      0.961 0.000 0.000 1.000
#> SRR1040864     3  0.0000      0.961 0.000 0.000 1.000
#> SRR1040865     3  0.0000      0.961 0.000 0.000 1.000
#> SRR1040866     3  0.0000      0.961 0.000 0.000 1.000
#> SRR1040867     3  0.0000      0.961 0.000 0.000 1.000
#> SRR1040868     3  0.0000      0.961 0.000 0.000 1.000
#> SRR1040869     1  0.0000      0.969 1.000 0.000 0.000
#> SRR1040870     1  0.0000      0.969 1.000 0.000 0.000
#> SRR1040871     1  0.0237      0.967 0.996 0.000 0.004
#> SRR1040872     3  0.0424      0.955 0.008 0.000 0.992
#> SRR1040873     2  0.0000      0.999 0.000 1.000 0.000
#> SRR1040874     3  0.0000      0.961 0.000 0.000 1.000
#> SRR1040875     3  0.0000      0.961 0.000 0.000 1.000
#> SRR1040876     3  0.0000      0.961 0.000 0.000 1.000
#> SRR1040877     1  0.1860      0.919 0.948 0.000 0.052
#> SRR1040878     3  0.0000      0.961 0.000 0.000 1.000
#> SRR1040879     2  0.0000      0.999 0.000 1.000 0.000
#> SRR1040880     3  0.0000      0.961 0.000 0.000 1.000
#> SRR1040881     2  0.0000      0.999 0.000 1.000 0.000
#> SRR1040882     1  0.5216      0.640 0.740 0.000 0.260
#> SRR1040883     1  0.0000      0.969 1.000 0.000 0.000
#> SRR1040884     3  0.0000      0.961 0.000 0.000 1.000
#> SRR1040885     1  0.0000      0.969 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
#> SRR1040814     3  0.0000     0.9637 0.000 0.000 1.000 0.000
#> SRR1040813     1  0.0000     0.9564 1.000 0.000 0.000 0.000
#> SRR1040816     1  0.1637     0.9091 0.940 0.060 0.000 0.000
#> SRR1040815     2  0.0000     0.4320 0.000 1.000 0.000 0.000
#> SRR1040817     3  0.0000     0.9637 0.000 0.000 1.000 0.000
#> SRR1040818     2  0.4356     0.0772 0.292 0.708 0.000 0.000
#> SRR1040819     2  0.0000     0.4320 0.000 1.000 0.000 0.000
#> SRR1040820     2  0.4933    -0.2535 0.000 0.568 0.000 0.432
#> SRR1040821     2  0.4933    -0.2535 0.000 0.568 0.000 0.432
#> SRR1040822     1  0.4961     0.1929 0.552 0.000 0.448 0.000
#> SRR1040823     1  0.0000     0.9564 1.000 0.000 0.000 0.000
#> SRR1040824     2  0.2973     0.2939 0.000 0.856 0.000 0.144
#> SRR1040826     3  0.0000     0.9637 0.000 0.000 1.000 0.000
#> SRR1040825     2  0.0000     0.4320 0.000 1.000 0.000 0.000
#> SRR1040827     2  0.0188     0.4301 0.000 0.996 0.000 0.004
#> SRR1040828     4  0.4843     1.0000 0.000 0.396 0.000 0.604
#> SRR1040829     4  0.4843     1.0000 0.000 0.396 0.000 0.604
#> SRR1040830     1  0.3311     0.8046 0.828 0.000 0.000 0.172
#> SRR1040831     3  0.0188     0.9607 0.004 0.000 0.996 0.000
#> SRR1040832     1  0.2281     0.8767 0.904 0.096 0.000 0.000
#> SRR1040833     1  0.4679     0.4574 0.648 0.000 0.352 0.000
#> SRR1040834     1  0.0000     0.9564 1.000 0.000 0.000 0.000
#> SRR1040835     2  0.0000     0.4320 0.000 1.000 0.000 0.000
#> SRR1040836     1  0.0000     0.9564 1.000 0.000 0.000 0.000
#> SRR1040837     2  0.4933    -0.2535 0.000 0.568 0.000 0.432
#> SRR1040839     2  0.4933    -0.2535 0.000 0.568 0.000 0.432
#> SRR1040838     1  0.0000     0.9564 1.000 0.000 0.000 0.000
#> SRR1040840     2  0.4933    -0.2535 0.000 0.568 0.000 0.432
#> SRR1040841     1  0.0000     0.9564 1.000 0.000 0.000 0.000
#> SRR1040843     2  0.4933    -0.2535 0.000 0.568 0.000 0.432
#> SRR1040842     1  0.0000     0.9564 1.000 0.000 0.000 0.000
#> SRR1040845     1  0.0000     0.9564 1.000 0.000 0.000 0.000
#> SRR1040844     1  0.0000     0.9564 1.000 0.000 0.000 0.000
#> SRR1040846     2  0.4933    -0.2535 0.000 0.568 0.000 0.432
#> SRR1040847     1  0.0000     0.9564 1.000 0.000 0.000 0.000
#> SRR1040849     1  0.1211     0.9289 0.960 0.000 0.040 0.000
#> SRR1040848     2  0.4925    -0.2503 0.000 0.572 0.000 0.428
#> SRR1040851     1  0.1854     0.9196 0.940 0.000 0.012 0.048
#> SRR1040850     1  0.0000     0.9564 1.000 0.000 0.000 0.000
#> SRR1040852     1  0.0000     0.9564 1.000 0.000 0.000 0.000
#> SRR1040853     1  0.0000     0.9564 1.000 0.000 0.000 0.000
#> SRR1040854     3  0.0000     0.9637 0.000 0.000 1.000 0.000
#> SRR1040855     1  0.0000     0.9564 1.000 0.000 0.000 0.000
#> SRR1040856     1  0.0000     0.9564 1.000 0.000 0.000 0.000
#> SRR1040857     3  0.0000     0.9637 0.000 0.000 1.000 0.000
#> SRR1040858     3  0.0000     0.9637 0.000 0.000 1.000 0.000
#> SRR1040859     1  0.0000     0.9564 1.000 0.000 0.000 0.000
#> SRR1040860     1  0.0000     0.9564 1.000 0.000 0.000 0.000
#> SRR1040861     1  0.1716     0.9074 0.936 0.000 0.064 0.000
#> SRR1040862     1  0.0000     0.9564 1.000 0.000 0.000 0.000
#> SRR1040863     1  0.4661     0.5967 0.652 0.000 0.000 0.348
#> SRR1040864     1  0.0000     0.9564 1.000 0.000 0.000 0.000
#> SRR1040865     1  0.0000     0.9564 1.000 0.000 0.000 0.000
#> SRR1040866     1  0.0000     0.9564 1.000 0.000 0.000 0.000
#> SRR1040867     1  0.0000     0.9564 1.000 0.000 0.000 0.000
#> SRR1040868     1  0.0000     0.9564 1.000 0.000 0.000 0.000
#> SRR1040869     3  0.0000     0.9637 0.000 0.000 1.000 0.000
#> SRR1040870     3  0.0000     0.9637 0.000 0.000 1.000 0.000
#> SRR1040871     3  0.0188     0.9607 0.004 0.000 0.996 0.000
#> SRR1040872     1  0.0336     0.9514 0.992 0.000 0.008 0.000
#> SRR1040873     2  0.4933    -0.2535 0.000 0.568 0.000 0.432
#> SRR1040874     1  0.0000     0.9564 1.000 0.000 0.000 0.000
#> SRR1040875     1  0.0000     0.9564 1.000 0.000 0.000 0.000
#> SRR1040876     1  0.0000     0.9564 1.000 0.000 0.000 0.000
#> SRR1040877     3  0.1474     0.9033 0.052 0.000 0.948 0.000
#> SRR1040878     1  0.0000     0.9564 1.000 0.000 0.000 0.000
#> SRR1040879     2  0.0000     0.4320 0.000 1.000 0.000 0.000
#> SRR1040880     1  0.0000     0.9564 1.000 0.000 0.000 0.000
#> SRR1040881     2  0.0000     0.4320 0.000 1.000 0.000 0.000
#> SRR1040882     3  0.4134     0.6005 0.260 0.000 0.740 0.000
#> SRR1040883     3  0.0000     0.9637 0.000 0.000 1.000 0.000
#> SRR1040884     1  0.0000     0.9564 1.000 0.000 0.000 0.000
#> SRR1040885     3  0.0000     0.9637 0.000 0.000 1.000 0.000

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>            class entropy silhouette    p1    p2    p3    p4    p5
#> SRR1040814     3  0.0000     0.9598 0.000 0.000 1.000 0.000 0.000
#> SRR1040813     1  0.0000     0.9129 1.000 0.000 0.000 0.000 0.000
#> SRR1040816     1  0.1410     0.7931 0.940 0.060 0.000 0.000 0.000
#> SRR1040815     2  0.0000     0.5767 0.000 1.000 0.000 0.000 0.000
#> SRR1040817     3  0.0000     0.9598 0.000 0.000 1.000 0.000 0.000
#> SRR1040818     2  0.3395     0.0669 0.236 0.764 0.000 0.000 0.000
#> SRR1040819     2  0.0000     0.5767 0.000 1.000 0.000 0.000 0.000
#> SRR1040820     2  0.4305     0.6325 0.000 0.512 0.000 0.000 0.488
#> SRR1040821     2  0.4305     0.6325 0.000 0.512 0.000 0.000 0.488
#> SRR1040822     1  0.4273    -0.3750 0.552 0.000 0.448 0.000 0.000
#> SRR1040823     1  0.0000     0.9129 1.000 0.000 0.000 0.000 0.000
#> SRR1040824     2  0.3109     0.6021 0.000 0.800 0.000 0.000 0.200
#> SRR1040826     3  0.0000     0.9598 0.000 0.000 1.000 0.000 0.000
#> SRR1040825     2  0.0000     0.5767 0.000 1.000 0.000 0.000 0.000
#> SRR1040827     2  0.0162     0.5776 0.000 0.996 0.000 0.000 0.004
#> SRR1040828     4  0.4015     0.4376 0.000 0.348 0.000 0.652 0.000
#> SRR1040829     4  0.4015     0.4376 0.000 0.348 0.000 0.652 0.000
#> SRR1040830     4  0.4015    -0.2065 0.348 0.000 0.000 0.652 0.000
#> SRR1040831     3  0.0162     0.9564 0.004 0.000 0.996 0.000 0.000
#> SRR1040832     1  0.1965     0.7079 0.904 0.096 0.000 0.000 0.000
#> SRR1040833     1  0.4030    -0.1537 0.648 0.000 0.352 0.000 0.000
#> SRR1040834     1  0.0000     0.9129 1.000 0.000 0.000 0.000 0.000
#> SRR1040835     2  0.0000     0.5767 0.000 1.000 0.000 0.000 0.000
#> SRR1040836     1  0.0000     0.9129 1.000 0.000 0.000 0.000 0.000
#> SRR1040837     2  0.4294     0.6396 0.000 0.532 0.000 0.000 0.468
#> SRR1040839     2  0.4294     0.6396 0.000 0.532 0.000 0.000 0.468
#> SRR1040838     1  0.0000     0.9129 1.000 0.000 0.000 0.000 0.000
#> SRR1040840     2  0.4305     0.6325 0.000 0.512 0.000 0.000 0.488
#> SRR1040841     1  0.0000     0.9129 1.000 0.000 0.000 0.000 0.000
#> SRR1040843     2  0.4304     0.6344 0.000 0.516 0.000 0.000 0.484
#> SRR1040842     1  0.0000     0.9129 1.000 0.000 0.000 0.000 0.000
#> SRR1040845     1  0.0000     0.9129 1.000 0.000 0.000 0.000 0.000
#> SRR1040844     1  0.0000     0.9129 1.000 0.000 0.000 0.000 0.000
#> SRR1040846     2  0.4294     0.6396 0.000 0.532 0.000 0.000 0.468
#> SRR1040847     1  0.0000     0.9129 1.000 0.000 0.000 0.000 0.000
#> SRR1040849     1  0.1043     0.8404 0.960 0.000 0.040 0.000 0.000
#> SRR1040848     2  0.4300     0.6375 0.000 0.524 0.000 0.000 0.476
#> SRR1040851     1  0.4387    -0.4357 0.640 0.000 0.012 0.348 0.000
#> SRR1040850     1  0.0000     0.9129 1.000 0.000 0.000 0.000 0.000
#> SRR1040852     1  0.0000     0.9129 1.000 0.000 0.000 0.000 0.000
#> SRR1040853     1  0.0000     0.9129 1.000 0.000 0.000 0.000 0.000
#> SRR1040854     3  0.0000     0.9598 0.000 0.000 1.000 0.000 0.000
#> SRR1040855     1  0.0000     0.9129 1.000 0.000 0.000 0.000 0.000
#> SRR1040856     1  0.0000     0.9129 1.000 0.000 0.000 0.000 0.000
#> SRR1040857     3  0.0000     0.9598 0.000 0.000 1.000 0.000 0.000
#> SRR1040858     3  0.0000     0.9598 0.000 0.000 1.000 0.000 0.000
#> SRR1040859     1  0.0000     0.9129 1.000 0.000 0.000 0.000 0.000
#> SRR1040860     1  0.0000     0.9129 1.000 0.000 0.000 0.000 0.000
#> SRR1040861     1  0.1478     0.7851 0.936 0.000 0.064 0.000 0.000
#> SRR1040862     1  0.0000     0.9129 1.000 0.000 0.000 0.000 0.000
#> SRR1040863     5  0.4305     0.0000 0.488 0.000 0.000 0.000 0.512
#> SRR1040864     1  0.0000     0.9129 1.000 0.000 0.000 0.000 0.000
#> SRR1040865     1  0.0000     0.9129 1.000 0.000 0.000 0.000 0.000
#> SRR1040866     1  0.0000     0.9129 1.000 0.000 0.000 0.000 0.000
#> SRR1040867     1  0.0000     0.9129 1.000 0.000 0.000 0.000 0.000
#> SRR1040868     1  0.0000     0.9129 1.000 0.000 0.000 0.000 0.000
#> SRR1040869     3  0.0000     0.9598 0.000 0.000 1.000 0.000 0.000
#> SRR1040870     3  0.0000     0.9598 0.000 0.000 1.000 0.000 0.000
#> SRR1040871     3  0.0162     0.9564 0.004 0.000 0.996 0.000 0.000
#> SRR1040872     1  0.0290     0.9000 0.992 0.000 0.008 0.000 0.000
#> SRR1040873     2  0.4305     0.6325 0.000 0.512 0.000 0.000 0.488
#> SRR1040874     1  0.0000     0.9129 1.000 0.000 0.000 0.000 0.000
#> SRR1040875     1  0.0000     0.9129 1.000 0.000 0.000 0.000 0.000
#> SRR1040876     1  0.0000     0.9129 1.000 0.000 0.000 0.000 0.000
#> SRR1040877     3  0.1270     0.8910 0.052 0.000 0.948 0.000 0.000
#> SRR1040878     1  0.0000     0.9129 1.000 0.000 0.000 0.000 0.000
#> SRR1040879     2  0.0000     0.5767 0.000 1.000 0.000 0.000 0.000
#> SRR1040880     1  0.0000     0.9129 1.000 0.000 0.000 0.000 0.000
#> SRR1040881     2  0.0000     0.5767 0.000 1.000 0.000 0.000 0.000
#> SRR1040882     3  0.3561     0.4337 0.260 0.000 0.740 0.000 0.000
#> SRR1040883     3  0.0000     0.9598 0.000 0.000 1.000 0.000 0.000
#> SRR1040884     1  0.0000     0.9129 1.000 0.000 0.000 0.000 0.000
#> SRR1040885     3  0.0000     0.9598 0.000 0.000 1.000 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>            class entropy silhouette    p1    p2    p3    p4    p5    p6
#> SRR1040814     3  0.1007     0.9069 0.000 0.000 0.956 0.000 0.044 0.000
#> SRR1040813     1  0.0000     0.9507 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR1040816     1  0.1549     0.8904 0.936 0.044 0.000 0.000 0.000 0.020
#> SRR1040815     6  0.3782     0.9250 0.000 0.412 0.000 0.000 0.000 0.588
#> SRR1040817     3  0.0000     0.9281 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1040818     6  0.5238     0.5962 0.140 0.268 0.000 0.000 0.000 0.592
#> SRR1040819     6  0.3782     0.9250 0.000 0.412 0.000 0.000 0.000 0.588
#> SRR1040820     2  0.0000     0.9272 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR1040821     2  0.0000     0.9272 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR1040822     1  0.3838     0.1948 0.552 0.000 0.448 0.000 0.000 0.000
#> SRR1040823     1  0.0000     0.9507 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR1040824     2  0.3371     0.0902 0.000 0.708 0.000 0.000 0.000 0.292
#> SRR1040826     3  0.1007     0.9069 0.000 0.000 0.956 0.000 0.044 0.000
#> SRR1040825     6  0.3782     0.9250 0.000 0.412 0.000 0.000 0.000 0.588
#> SRR1040827     6  0.3828     0.8809 0.000 0.440 0.000 0.000 0.000 0.560
#> SRR1040828     5  0.3101     0.5894 0.000 0.244 0.000 0.000 0.756 0.000
#> SRR1040829     5  0.3101     0.5894 0.000 0.244 0.000 0.000 0.756 0.000
#> SRR1040830     5  0.3215     0.2178 0.240 0.000 0.000 0.000 0.756 0.004
#> SRR1040831     3  0.0146     0.9261 0.004 0.000 0.996 0.000 0.000 0.000
#> SRR1040832     1  0.2258     0.8442 0.896 0.044 0.000 0.000 0.000 0.060
#> SRR1040833     1  0.3756     0.4027 0.644 0.000 0.352 0.000 0.000 0.004
#> SRR1040834     1  0.0000     0.9507 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR1040835     6  0.3774     0.9199 0.000 0.408 0.000 0.000 0.000 0.592
#> SRR1040836     1  0.0000     0.9507 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR1040837     2  0.0632     0.9203 0.000 0.976 0.000 0.000 0.000 0.024
#> SRR1040839     2  0.0713     0.9165 0.000 0.972 0.000 0.000 0.000 0.028
#> SRR1040838     1  0.0000     0.9507 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR1040840     2  0.0000     0.9272 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR1040841     1  0.0146     0.9488 0.996 0.000 0.000 0.000 0.000 0.004
#> SRR1040843     2  0.0146     0.9278 0.000 0.996 0.000 0.000 0.000 0.004
#> SRR1040842     1  0.0000     0.9507 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR1040845     1  0.0000     0.9507 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR1040844     1  0.0146     0.9488 0.996 0.000 0.000 0.000 0.000 0.004
#> SRR1040846     2  0.0632     0.9203 0.000 0.976 0.000 0.000 0.000 0.024
#> SRR1040847     1  0.0146     0.9488 0.996 0.000 0.000 0.000 0.000 0.004
#> SRR1040849     1  0.0937     0.9163 0.960 0.000 0.040 0.000 0.000 0.000
#> SRR1040848     2  0.0363     0.9265 0.000 0.988 0.000 0.000 0.000 0.012
#> SRR1040851     1  0.4303     0.3515 0.588 0.000 0.012 0.392 0.008 0.000
#> SRR1040850     1  0.0000     0.9507 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR1040852     1  0.0000     0.9507 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR1040853     1  0.0000     0.9507 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR1040854     3  0.0000     0.9281 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1040855     1  0.0000     0.9507 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR1040856     1  0.0000     0.9507 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR1040857     3  0.0000     0.9281 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1040858     3  0.0000     0.9281 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1040859     1  0.0000     0.9507 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR1040860     1  0.0000     0.9507 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR1040861     1  0.1327     0.8905 0.936 0.000 0.064 0.000 0.000 0.000
#> SRR1040862     1  0.0000     0.9507 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR1040863     4  0.3737     0.0000 0.000 0.000 0.000 0.608 0.000 0.392
#> SRR1040864     1  0.0000     0.9507 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR1040865     1  0.0000     0.9507 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR1040866     1  0.0146     0.9487 0.996 0.000 0.000 0.000 0.004 0.000
#> SRR1040867     1  0.0000     0.9507 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR1040868     1  0.0000     0.9507 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR1040869     3  0.0000     0.9281 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1040870     3  0.0000     0.9281 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1040871     3  0.0146     0.9261 0.004 0.000 0.996 0.000 0.000 0.000
#> SRR1040872     1  0.0260     0.9451 0.992 0.000 0.008 0.000 0.000 0.000
#> SRR1040873     2  0.0000     0.9272 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR1040874     1  0.0146     0.9488 0.996 0.000 0.000 0.000 0.000 0.004
#> SRR1040875     1  0.0000     0.9507 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR1040876     1  0.0146     0.9488 0.996 0.000 0.000 0.000 0.000 0.004
#> SRR1040877     3  0.1921     0.8573 0.052 0.000 0.916 0.000 0.032 0.000
#> SRR1040878     1  0.0000     0.9507 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR1040879     6  0.3782     0.9250 0.000 0.412 0.000 0.000 0.000 0.588
#> SRR1040880     1  0.0000     0.9507 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR1040881     6  0.3782     0.9250 0.000 0.412 0.000 0.000 0.000 0.588
#> SRR1040882     3  0.3198     0.4792 0.260 0.000 0.740 0.000 0.000 0.000
#> SRR1040883     3  0.0000     0.9281 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1040884     1  0.0000     0.9507 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR1040885     3  0.3457     0.6926 0.000 0.000 0.752 0.000 0.232 0.016

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

consensus_heatmap(res, k = 2)

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

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

collect_plots(res)

plot of chunk CV-mclust-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.142           0.348       0.764         0.3366 0.895   0.895
#> 3 3 0.302           0.493       0.793         0.4481 0.586   0.560
#> 4 4 0.585           0.779       0.819         0.4716 0.586   0.324
#> 5 5 0.565           0.509       0.681         0.0515 0.920   0.702
#> 6 6 0.580           0.534       0.693         0.0427 0.915   0.637

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
#> SRR1040814     1  0.1843     0.5661 0.972 0.028
#> SRR1040813     1  0.6148     0.5477 0.848 0.152
#> SRR1040816     1  0.9000     0.3003 0.684 0.316
#> SRR1040815     1  0.9732    -0.1916 0.596 0.404
#> SRR1040817     1  0.0938     0.5605 0.988 0.012
#> SRR1040818     2  0.9993     0.2084 0.484 0.516
#> SRR1040819     1  0.9686     0.1978 0.604 0.396
#> SRR1040820     1  0.8661     0.3808 0.712 0.288
#> SRR1040821     1  0.8555     0.3854 0.720 0.280
#> SRR1040822     1  0.1414     0.5568 0.980 0.020
#> SRR1040823     1  0.1414     0.5568 0.980 0.020
#> SRR1040824     1  0.9552     0.2809 0.624 0.376
#> SRR1040826     1  0.1414     0.5568 0.980 0.020
#> SRR1040825     2  0.9896    -0.0594 0.440 0.560
#> SRR1040827     1  0.9850     0.1850 0.572 0.428
#> SRR1040828     1  0.4298     0.4848 0.912 0.088
#> SRR1040829     1  0.4298     0.4848 0.912 0.088
#> SRR1040830     1  0.1184     0.5589 0.984 0.016
#> SRR1040831     1  0.9833     0.1766 0.576 0.424
#> SRR1040832     1  0.9686     0.2308 0.604 0.396
#> SRR1040833     1  0.9850     0.1701 0.572 0.428
#> SRR1040834     1  0.7453     0.4282 0.788 0.212
#> SRR1040835     1  0.9754     0.1643 0.592 0.408
#> SRR1040836     2  0.9983     0.2234 0.476 0.524
#> SRR1040837     1  0.9552     0.2788 0.624 0.376
#> SRR1040839     1  0.9552     0.2765 0.624 0.376
#> SRR1040838     1  0.8499     0.4344 0.724 0.276
#> SRR1040840     1  0.8267     0.3959 0.740 0.260
#> SRR1040841     1  0.9866     0.1620 0.568 0.432
#> SRR1040843     1  0.8608     0.3819 0.716 0.284
#> SRR1040842     1  0.9491    -0.1420 0.632 0.368
#> SRR1040845     1  0.3733     0.5072 0.928 0.072
#> SRR1040844     1  0.9881     0.1567 0.564 0.436
#> SRR1040846     1  0.8207     0.3995 0.744 0.256
#> SRR1040847     1  0.9881     0.1567 0.564 0.436
#> SRR1040849     1  0.1414     0.5647 0.980 0.020
#> SRR1040848     1  0.9732    -0.1916 0.596 0.404
#> SRR1040851     1  0.9775    -0.1876 0.588 0.412
#> SRR1040850     1  0.0938     0.5605 0.988 0.012
#> SRR1040852     1  0.7528     0.5006 0.784 0.216
#> SRR1040853     1  0.6148     0.5433 0.848 0.152
#> SRR1040854     1  0.6148     0.5405 0.848 0.152
#> SRR1040855     1  0.1414     0.5643 0.980 0.020
#> SRR1040856     1  0.6623     0.5323 0.828 0.172
#> SRR1040857     1  0.7950     0.4714 0.760 0.240
#> SRR1040858     1  0.7453     0.4966 0.788 0.212
#> SRR1040859     1  0.4431     0.5567 0.908 0.092
#> SRR1040860     1  0.0938     0.5620 0.988 0.012
#> SRR1040861     1  0.2236     0.5662 0.964 0.036
#> SRR1040862     1  0.2778     0.5683 0.952 0.048
#> SRR1040863     1  0.9775    -0.1876 0.588 0.412
#> SRR1040864     1  0.3274     0.5674 0.940 0.060
#> SRR1040865     1  0.8443     0.4381 0.728 0.272
#> SRR1040866     1  0.9775    -0.1876 0.588 0.412
#> SRR1040867     1  0.9686    -0.1665 0.604 0.396
#> SRR1040868     1  0.9732     0.2051 0.596 0.404
#> SRR1040869     1  0.7815     0.4799 0.768 0.232
#> SRR1040870     1  0.0672     0.5652 0.992 0.008
#> SRR1040871     1  0.7056     0.5114 0.808 0.192
#> SRR1040872     1  0.3879     0.5655 0.924 0.076
#> SRR1040873     1  0.8813     0.3736 0.700 0.300
#> SRR1040874     1  0.8608     0.3255 0.716 0.284
#> SRR1040875     1  0.3584     0.5109 0.932 0.068
#> SRR1040876     1  0.6048     0.4208 0.852 0.148
#> SRR1040877     1  0.1414     0.5568 0.980 0.020
#> SRR1040878     1  0.2043     0.5622 0.968 0.032
#> SRR1040879     1  0.9732     0.2243 0.596 0.404
#> SRR1040880     1  0.6048     0.4208 0.852 0.148
#> SRR1040881     2  0.9963    -0.1018 0.464 0.536
#> SRR1040882     1  0.0938     0.5605 0.988 0.012
#> SRR1040883     1  0.8016     0.4651 0.756 0.244
#> SRR1040884     1  0.9881     0.1567 0.564 0.436
#> SRR1040885     1  0.1414     0.5568 0.980 0.020

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>            class entropy silhouette    p1    p2    p3
#> SRR1040814     3  0.2446    0.66721 0.052 0.012 0.936
#> SRR1040813     3  0.3237    0.64165 0.056 0.032 0.912
#> SRR1040816     3  0.6659    0.49971 0.132 0.116 0.752
#> SRR1040815     2  0.8936    0.34768 0.132 0.500 0.368
#> SRR1040817     3  0.2339    0.66636 0.048 0.012 0.940
#> SRR1040818     3  0.8834    0.11456 0.140 0.316 0.544
#> SRR1040819     2  0.7545    0.52427 0.076 0.652 0.272
#> SRR1040820     2  0.0747    0.70637 0.000 0.984 0.016
#> SRR1040821     2  0.0747    0.70637 0.000 0.984 0.016
#> SRR1040822     3  0.2339    0.66636 0.048 0.012 0.940
#> SRR1040823     3  0.0983    0.66611 0.004 0.016 0.980
#> SRR1040824     2  0.0747    0.70410 0.000 0.984 0.016
#> SRR1040826     3  0.2339    0.66636 0.048 0.012 0.940
#> SRR1040825     3  0.8185   -0.03960 0.072 0.428 0.500
#> SRR1040827     2  0.5874    0.62142 0.032 0.760 0.208
#> SRR1040828     3  0.6282    0.24467 0.004 0.384 0.612
#> SRR1040829     3  0.6505   -0.00442 0.004 0.468 0.528
#> SRR1040830     3  0.2384    0.65717 0.008 0.056 0.936
#> SRR1040831     3  0.5627    0.53350 0.188 0.032 0.780
#> SRR1040832     3  0.6511    0.50439 0.136 0.104 0.760
#> SRR1040833     3  0.5355    0.50626 0.168 0.032 0.800
#> SRR1040834     3  0.3134    0.63702 0.052 0.032 0.916
#> SRR1040835     2  0.8820    0.15442 0.116 0.476 0.408
#> SRR1040836     1  0.6307   -0.15614 0.512 0.000 0.488
#> SRR1040837     2  0.5062    0.64807 0.016 0.800 0.184
#> SRR1040839     2  0.1399    0.70695 0.004 0.968 0.028
#> SRR1040838     3  0.4015    0.60836 0.096 0.028 0.876
#> SRR1040840     2  0.0747    0.70637 0.000 0.984 0.016
#> SRR1040841     1  0.7319    0.68724 0.548 0.032 0.420
#> SRR1040843     2  0.1031    0.70787 0.000 0.976 0.024
#> SRR1040842     3  0.6154    0.14950 0.408 0.000 0.592
#> SRR1040845     3  0.6034    0.46472 0.212 0.036 0.752
#> SRR1040844     1  0.7319    0.68724 0.548 0.032 0.420
#> SRR1040846     2  0.0592    0.70322 0.000 0.988 0.012
#> SRR1040847     1  0.7319    0.68724 0.548 0.032 0.420
#> SRR1040849     3  0.2446    0.66624 0.052 0.012 0.936
#> SRR1040848     2  0.8457    0.40942 0.100 0.544 0.356
#> SRR1040851     3  0.6180    0.15148 0.416 0.000 0.584
#> SRR1040850     3  0.5402    0.51181 0.180 0.028 0.792
#> SRR1040852     3  0.2681    0.66218 0.040 0.028 0.932
#> SRR1040853     3  0.2176    0.66650 0.032 0.020 0.948
#> SRR1040854     3  0.3784    0.61967 0.132 0.004 0.864
#> SRR1040855     3  0.0592    0.66663 0.000 0.012 0.988
#> SRR1040856     3  0.2269    0.66339 0.016 0.040 0.944
#> SRR1040857     3  0.4521    0.57255 0.180 0.004 0.816
#> SRR1040858     3  0.4521    0.56466 0.180 0.004 0.816
#> SRR1040859     3  0.1529    0.66224 0.000 0.040 0.960
#> SRR1040860     3  0.3502    0.62258 0.084 0.020 0.896
#> SRR1040861     3  0.2446    0.66599 0.052 0.012 0.936
#> SRR1040862     3  0.4953    0.51757 0.176 0.016 0.808
#> SRR1040863     3  0.6180    0.15148 0.416 0.000 0.584
#> SRR1040864     3  0.1620    0.66555 0.024 0.012 0.964
#> SRR1040865     3  0.4995    0.54311 0.144 0.032 0.824
#> SRR1040866     3  0.6180    0.15148 0.416 0.000 0.584
#> SRR1040867     3  0.6168    0.15646 0.412 0.000 0.588
#> SRR1040868     3  0.6772    0.09818 0.304 0.032 0.664
#> SRR1040869     3  0.3879    0.59943 0.152 0.000 0.848
#> SRR1040870     3  0.2229    0.66686 0.044 0.012 0.944
#> SRR1040871     3  0.4409    0.57594 0.172 0.004 0.824
#> SRR1040872     3  0.2749    0.66382 0.064 0.012 0.924
#> SRR1040873     2  0.1643    0.70227 0.000 0.956 0.044
#> SRR1040874     3  0.7372   -0.55394 0.448 0.032 0.520
#> SRR1040875     3  0.5967    0.47042 0.216 0.032 0.752
#> SRR1040876     3  0.2806    0.64396 0.040 0.032 0.928
#> SRR1040877     3  0.2339    0.66636 0.048 0.012 0.940
#> SRR1040878     3  0.1711    0.66440 0.008 0.032 0.960
#> SRR1040879     2  0.7230    0.44030 0.040 0.616 0.344
#> SRR1040880     3  0.6264    0.22226 0.244 0.032 0.724
#> SRR1040881     2  0.8097    0.29731 0.072 0.540 0.388
#> SRR1040882     3  0.1999    0.67059 0.036 0.012 0.952
#> SRR1040883     3  0.4629    0.55352 0.188 0.004 0.808
#> SRR1040884     3  0.7263   -0.35004 0.400 0.032 0.568
#> SRR1040885     3  0.2339    0.66636 0.048 0.012 0.940

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> SRR1040814     3  0.0817     0.8946 0.024 0.000 0.976 0.000
#> SRR1040813     1  0.2973     0.8127 0.884 0.000 0.096 0.020
#> SRR1040816     1  0.6836     0.6952 0.688 0.144 0.064 0.104
#> SRR1040815     2  0.4428     0.7310 0.000 0.720 0.004 0.276
#> SRR1040817     3  0.0188     0.8918 0.004 0.000 0.996 0.000
#> SRR1040818     1  0.8035     0.4741 0.472 0.100 0.056 0.372
#> SRR1040819     2  0.2266     0.9122 0.084 0.912 0.004 0.000
#> SRR1040820     2  0.0657     0.9131 0.004 0.984 0.012 0.000
#> SRR1040821     2  0.0779     0.9126 0.004 0.980 0.016 0.000
#> SRR1040822     3  0.0000     0.8906 0.000 0.000 1.000 0.000
#> SRR1040823     4  0.6382     0.7686 0.080 0.000 0.340 0.580
#> SRR1040824     2  0.1970     0.9210 0.060 0.932 0.008 0.000
#> SRR1040826     3  0.0000     0.8906 0.000 0.000 1.000 0.000
#> SRR1040825     2  0.2530     0.9036 0.100 0.896 0.004 0.000
#> SRR1040827     2  0.2010     0.9205 0.060 0.932 0.004 0.004
#> SRR1040828     2  0.3216     0.8519 0.004 0.864 0.008 0.124
#> SRR1040829     2  0.2345     0.8754 0.000 0.900 0.000 0.100
#> SRR1040830     1  0.2999     0.8006 0.864 0.000 0.004 0.132
#> SRR1040831     1  0.4344     0.7665 0.816 0.000 0.108 0.076
#> SRR1040832     1  0.7094     0.6447 0.652 0.200 0.060 0.088
#> SRR1040833     1  0.1637     0.8297 0.940 0.000 0.060 0.000
#> SRR1040834     1  0.3584     0.8182 0.868 0.004 0.064 0.064
#> SRR1040835     2  0.2715     0.9019 0.100 0.892 0.004 0.004
#> SRR1040836     1  0.7063     0.4635 0.508 0.000 0.132 0.360
#> SRR1040837     2  0.1824     0.9211 0.060 0.936 0.004 0.000
#> SRR1040839     2  0.1661     0.9212 0.052 0.944 0.004 0.000
#> SRR1040838     1  0.5815     0.6425 0.716 0.004 0.168 0.112
#> SRR1040840     2  0.0469     0.9121 0.000 0.988 0.012 0.000
#> SRR1040841     1  0.0524     0.8081 0.988 0.000 0.004 0.008
#> SRR1040843     2  0.2282     0.9186 0.052 0.924 0.024 0.000
#> SRR1040842     4  0.2149     0.6189 0.000 0.000 0.088 0.912
#> SRR1040845     4  0.6731     0.7745 0.068 0.024 0.296 0.612
#> SRR1040844     1  0.0188     0.8027 0.996 0.000 0.004 0.000
#> SRR1040846     2  0.0188     0.9119 0.000 0.996 0.004 0.000
#> SRR1040847     1  0.0188     0.8027 0.996 0.000 0.004 0.000
#> SRR1040849     3  0.1510     0.8863 0.028 0.000 0.956 0.016
#> SRR1040848     2  0.4428     0.7310 0.000 0.720 0.004 0.276
#> SRR1040851     4  0.7008    -0.4427 0.436 0.000 0.116 0.448
#> SRR1040850     4  0.6972     0.7755 0.056 0.044 0.300 0.600
#> SRR1040852     4  0.7196     0.7573 0.128 0.008 0.320 0.544
#> SRR1040853     4  0.6778     0.7556 0.112 0.000 0.336 0.552
#> SRR1040854     3  0.1940     0.8916 0.076 0.000 0.924 0.000
#> SRR1040855     4  0.5805     0.7254 0.036 0.000 0.388 0.576
#> SRR1040856     4  0.8211     0.6766 0.092 0.164 0.172 0.572
#> SRR1040857     3  0.1867     0.8925 0.072 0.000 0.928 0.000
#> SRR1040858     3  0.2011     0.8898 0.080 0.000 0.920 0.000
#> SRR1040859     4  0.7980     0.7354 0.096 0.100 0.224 0.580
#> SRR1040860     4  0.7271     0.7752 0.080 0.040 0.300 0.580
#> SRR1040861     4  0.5784     0.6662 0.032 0.000 0.412 0.556
#> SRR1040862     4  0.6560     0.7738 0.068 0.012 0.324 0.596
#> SRR1040863     4  0.2081     0.6150 0.000 0.000 0.084 0.916
#> SRR1040864     4  0.6634     0.7523 0.100 0.000 0.336 0.564
#> SRR1040865     1  0.5907     0.5207 0.668 0.000 0.252 0.080
#> SRR1040866     4  0.2081     0.6150 0.000 0.000 0.084 0.916
#> SRR1040867     3  0.7358     0.0714 0.160 0.000 0.448 0.392
#> SRR1040868     1  0.1557     0.8300 0.944 0.000 0.056 0.000
#> SRR1040869     3  0.2011     0.8898 0.080 0.000 0.920 0.000
#> SRR1040870     3  0.0000     0.8906 0.000 0.000 1.000 0.000
#> SRR1040871     3  0.2011     0.8898 0.080 0.000 0.920 0.000
#> SRR1040872     3  0.3286     0.7877 0.044 0.000 0.876 0.080
#> SRR1040873     2  0.0657     0.9131 0.004 0.984 0.012 0.000
#> SRR1040874     1  0.1733     0.8232 0.948 0.000 0.024 0.028
#> SRR1040875     4  0.7325     0.6553 0.192 0.000 0.288 0.520
#> SRR1040876     1  0.2739     0.8295 0.904 0.000 0.060 0.036
#> SRR1040877     3  0.0000     0.8906 0.000 0.000 1.000 0.000
#> SRR1040878     4  0.6848     0.7751 0.080 0.016 0.324 0.580
#> SRR1040879     2  0.2466     0.9063 0.096 0.900 0.004 0.000
#> SRR1040880     1  0.2739     0.8290 0.904 0.000 0.060 0.036
#> SRR1040881     2  0.2530     0.9036 0.100 0.896 0.004 0.000
#> SRR1040882     3  0.3037     0.8446 0.076 0.000 0.888 0.036
#> SRR1040883     3  0.2011     0.8898 0.080 0.000 0.920 0.000
#> SRR1040884     1  0.1637     0.8293 0.940 0.000 0.060 0.000
#> SRR1040885     3  0.0000     0.8906 0.000 0.000 1.000 0.000

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>            class entropy silhouette    p1    p2    p3    p4    p5
#> SRR1040814     3  0.1928    0.74098 0.072 0.000 0.920 0.004 0.004
#> SRR1040813     1  0.3269    0.70139 0.868 0.004 0.024 0.024 0.080
#> SRR1040816     1  0.5599    0.50646 0.664 0.184 0.000 0.008 0.144
#> SRR1040815     5  0.5596   -0.00659 0.000 0.340 0.004 0.076 0.580
#> SRR1040817     3  0.2971    0.74917 0.072 0.000 0.880 0.016 0.032
#> SRR1040818     5  0.6633    0.22639 0.224 0.096 0.004 0.068 0.608
#> SRR1040819     2  0.2429    0.88489 0.020 0.900 0.000 0.076 0.004
#> SRR1040820     2  0.1121    0.89679 0.000 0.956 0.000 0.044 0.000
#> SRR1040821     2  0.1121    0.89679 0.000 0.956 0.000 0.044 0.000
#> SRR1040822     3  0.0162    0.69310 0.000 0.000 0.996 0.004 0.000
#> SRR1040823     5  0.8360   -0.47474 0.120 0.004 0.244 0.284 0.348
#> SRR1040824     2  0.0960    0.90331 0.016 0.972 0.004 0.008 0.000
#> SRR1040826     3  0.0162    0.69310 0.000 0.000 0.996 0.004 0.000
#> SRR1040825     2  0.3007    0.87124 0.028 0.864 0.000 0.104 0.004
#> SRR1040827     2  0.1362    0.90264 0.016 0.960 0.004 0.012 0.008
#> SRR1040828     2  0.5468    0.60438 0.008 0.612 0.004 0.324 0.052
#> SRR1040829     2  0.4470    0.65823 0.008 0.656 0.000 0.328 0.008
#> SRR1040830     1  0.5244    0.49772 0.660 0.004 0.008 0.276 0.052
#> SRR1040831     1  0.3496    0.67230 0.832 0.004 0.124 0.000 0.040
#> SRR1040832     1  0.6728    0.22540 0.488 0.384 0.004 0.072 0.052
#> SRR1040833     1  0.0162    0.78210 0.996 0.000 0.004 0.000 0.000
#> SRR1040834     1  0.2074    0.74661 0.920 0.016 0.004 0.000 0.060
#> SRR1040835     2  0.3848    0.81837 0.076 0.816 0.000 0.104 0.004
#> SRR1040836     1  0.5136    0.21660 0.528 0.000 0.008 0.024 0.440
#> SRR1040837     2  0.1469    0.89923 0.016 0.948 0.000 0.036 0.000
#> SRR1040839     2  0.0671    0.90344 0.016 0.980 0.004 0.000 0.000
#> SRR1040838     1  0.6958   -0.24298 0.548 0.004 0.036 0.184 0.228
#> SRR1040840     2  0.1121    0.89679 0.000 0.956 0.000 0.044 0.000
#> SRR1040841     1  0.0000    0.78264 1.000 0.000 0.000 0.000 0.000
#> SRR1040843     2  0.1074    0.90287 0.016 0.968 0.004 0.012 0.000
#> SRR1040842     5  0.5641    0.08025 0.152 0.012 0.012 0.128 0.696
#> SRR1040845     5  0.6446   -0.13788 0.028 0.012 0.080 0.308 0.572
#> SRR1040844     1  0.0162    0.78210 0.996 0.000 0.004 0.000 0.000
#> SRR1040846     2  0.1121    0.89679 0.000 0.956 0.000 0.044 0.000
#> SRR1040847     1  0.0324    0.78167 0.992 0.004 0.004 0.000 0.000
#> SRR1040849     3  0.5240    0.69086 0.204 0.000 0.676 0.000 0.120
#> SRR1040848     5  0.4637   -0.08127 0.000 0.420 0.004 0.008 0.568
#> SRR1040851     5  0.3449    0.28857 0.088 0.000 0.004 0.064 0.844
#> SRR1040850     5  0.6491   -0.23017 0.012 0.024 0.072 0.388 0.504
#> SRR1040852     5  0.8355   -0.67696 0.268 0.012 0.088 0.284 0.348
#> SRR1040853     5  0.8058   -0.62898 0.208 0.004 0.096 0.284 0.408
#> SRR1040854     3  0.5773    0.75441 0.216 0.000 0.668 0.068 0.048
#> SRR1040855     5  0.8465   -0.45492 0.196 0.000 0.252 0.212 0.340
#> SRR1040856     4  0.8628    0.81562 0.248 0.064 0.052 0.388 0.248
#> SRR1040857     3  0.5751    0.75606 0.204 0.000 0.676 0.068 0.052
#> SRR1040858     3  0.5588    0.75398 0.224 0.000 0.676 0.052 0.048
#> SRR1040859     4  0.8577    0.82156 0.260 0.056 0.052 0.380 0.252
#> SRR1040860     4  0.8460    0.79760 0.252 0.020 0.092 0.380 0.256
#> SRR1040861     3  0.6495    0.06146 0.188 0.000 0.424 0.000 0.388
#> SRR1040862     4  0.8104    0.62081 0.144 0.016 0.096 0.396 0.348
#> SRR1040863     5  0.2970    0.28007 0.000 0.000 0.004 0.168 0.828
#> SRR1040864     5  0.8144   -0.61506 0.212 0.004 0.104 0.284 0.396
#> SRR1040865     1  0.5252    0.53048 0.752 0.004 0.068 0.076 0.100
#> SRR1040866     5  0.2488    0.26900 0.000 0.000 0.004 0.124 0.872
#> SRR1040867     5  0.5283    0.02863 0.192 0.000 0.084 0.020 0.704
#> SRR1040868     1  0.0000    0.78264 1.000 0.000 0.000 0.000 0.000
#> SRR1040869     3  0.5800    0.75264 0.220 0.000 0.664 0.068 0.048
#> SRR1040870     3  0.3365    0.75540 0.180 0.000 0.808 0.008 0.004
#> SRR1040871     3  0.5990    0.74284 0.224 0.000 0.648 0.080 0.048
#> SRR1040872     3  0.5871    0.58841 0.212 0.000 0.604 0.000 0.184
#> SRR1040873     2  0.1121    0.89679 0.000 0.956 0.000 0.044 0.000
#> SRR1040874     1  0.0566    0.78097 0.984 0.004 0.000 0.000 0.012
#> SRR1040875     5  0.5980   -0.03060 0.088 0.008 0.060 0.152 0.692
#> SRR1040876     1  0.1117    0.77426 0.964 0.000 0.016 0.000 0.020
#> SRR1040877     3  0.0162    0.69310 0.000 0.000 0.996 0.004 0.000
#> SRR1040878     5  0.8500   -0.71422 0.256 0.020 0.088 0.296 0.340
#> SRR1040879     2  0.2828    0.87497 0.020 0.872 0.000 0.104 0.004
#> SRR1040880     1  0.0932    0.77806 0.972 0.004 0.004 0.000 0.020
#> SRR1040881     2  0.2828    0.87497 0.020 0.872 0.000 0.104 0.004
#> SRR1040882     3  0.5108    0.65960 0.136 0.000 0.744 0.040 0.080
#> SRR1040883     3  0.5828    0.74749 0.224 0.000 0.660 0.068 0.048
#> SRR1040884     1  0.0162    0.78248 0.996 0.004 0.000 0.000 0.000
#> SRR1040885     3  0.0162    0.69310 0.000 0.000 0.996 0.004 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
#> SRR1040814     3  0.3452    0.60229 0.052 0.004 0.844 0.052 0.048 0.000
#> SRR1040813     1  0.3534    0.68578 0.824 0.000 0.020 0.064 0.092 0.000
#> SRR1040816     1  0.4274    0.57598 0.688 0.000 0.004 0.004 0.032 0.272
#> SRR1040815     5  0.3534    0.47315 0.000 0.008 0.000 0.000 0.716 0.276
#> SRR1040817     3  0.5038    0.62406 0.064 0.044 0.756 0.052 0.080 0.004
#> SRR1040818     5  0.3805    0.48169 0.016 0.008 0.000 0.000 0.728 0.248
#> SRR1040819     6  0.1588    0.65051 0.004 0.072 0.000 0.000 0.000 0.924
#> SRR1040820     2  0.5911    0.73384 0.000 0.468 0.000 0.280 0.000 0.252
#> SRR1040821     2  0.5911    0.73384 0.000 0.468 0.000 0.280 0.000 0.252
#> SRR1040822     3  0.1141    0.57062 0.000 0.000 0.948 0.052 0.000 0.000
#> SRR1040823     4  0.7184    0.46860 0.052 0.040 0.224 0.488 0.196 0.000
#> SRR1040824     6  0.5958   -0.00456 0.004 0.200 0.000 0.284 0.004 0.508
#> SRR1040826     3  0.1141    0.57062 0.000 0.000 0.948 0.052 0.000 0.000
#> SRR1040825     6  0.0458    0.67042 0.016 0.000 0.000 0.000 0.000 0.984
#> SRR1040827     6  0.4530    0.51638 0.004 0.148 0.000 0.072 0.028 0.748
#> SRR1040828     2  0.3914    0.34062 0.048 0.816 0.004 0.012 0.024 0.096
#> SRR1040829     2  0.2704    0.40347 0.004 0.856 0.004 0.004 0.004 0.128
#> SRR1040830     1  0.4578    0.50823 0.616 0.348 0.016 0.004 0.016 0.000
#> SRR1040831     1  0.2321    0.76283 0.904 0.004 0.052 0.008 0.032 0.000
#> SRR1040832     1  0.5015    0.19577 0.480 0.000 0.012 0.008 0.028 0.472
#> SRR1040833     1  0.0146    0.79818 0.996 0.000 0.000 0.000 0.004 0.000
#> SRR1040834     1  0.1312    0.79191 0.956 0.000 0.012 0.008 0.020 0.004
#> SRR1040835     6  0.0260    0.67395 0.008 0.000 0.000 0.000 0.000 0.992
#> SRR1040836     1  0.4987    0.22066 0.524 0.000 0.012 0.044 0.420 0.000
#> SRR1040837     6  0.5527    0.15238 0.004 0.156 0.000 0.276 0.000 0.564
#> SRR1040839     6  0.5965   -0.12804 0.004 0.232 0.000 0.280 0.000 0.484
#> SRR1040838     1  0.6248   -0.31388 0.428 0.000 0.012 0.332 0.228 0.000
#> SRR1040840     2  0.5911    0.73384 0.000 0.468 0.000 0.280 0.000 0.252
#> SRR1040841     1  0.0000    0.79712 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR1040843     2  0.6216    0.54508 0.004 0.376 0.000 0.284 0.000 0.336
#> SRR1040842     5  0.3613    0.40841 0.024 0.000 0.008 0.196 0.772 0.000
#> SRR1040845     4  0.5295    0.46104 0.064 0.000 0.008 0.488 0.436 0.004
#> SRR1040844     1  0.0146    0.79774 0.996 0.000 0.000 0.004 0.000 0.000
#> SRR1040846     2  0.5938    0.72692 0.000 0.460 0.000 0.280 0.000 0.260
#> SRR1040847     1  0.0000    0.79712 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR1040849     3  0.7956    0.10538 0.112 0.060 0.364 0.144 0.320 0.000
#> SRR1040848     5  0.4455    0.44726 0.000 0.128 0.000 0.000 0.712 0.160
#> SRR1040851     5  0.0291    0.47542 0.004 0.004 0.000 0.000 0.992 0.000
#> SRR1040850     4  0.4417    0.53205 0.008 0.004 0.004 0.568 0.412 0.004
#> SRR1040852     4  0.5719    0.73020 0.128 0.000 0.012 0.516 0.344 0.000
#> SRR1040853     4  0.5622    0.73301 0.116 0.000 0.012 0.528 0.344 0.000
#> SRR1040854     3  0.7509    0.62586 0.260 0.116 0.480 0.060 0.080 0.004
#> SRR1040855     4  0.7324    0.60562 0.104 0.048 0.080 0.432 0.336 0.000
#> SRR1040856     4  0.6175    0.71734 0.116 0.008 0.012 0.580 0.256 0.028
#> SRR1040857     3  0.7509    0.62586 0.260 0.116 0.480 0.060 0.080 0.004
#> SRR1040858     3  0.7488    0.62331 0.268 0.116 0.476 0.056 0.080 0.004
#> SRR1040859     4  0.5709    0.71823 0.124 0.004 0.012 0.604 0.248 0.008
#> SRR1040860     4  0.5145    0.72837 0.072 0.000 0.012 0.652 0.252 0.012
#> SRR1040861     5  0.6986   -0.19371 0.076 0.004 0.352 0.168 0.400 0.000
#> SRR1040862     4  0.5192    0.71761 0.068 0.000 0.012 0.620 0.292 0.008
#> SRR1040863     5  0.1958    0.48409 0.000 0.004 0.000 0.100 0.896 0.000
#> SRR1040864     4  0.6300    0.71347 0.112 0.008 0.040 0.492 0.348 0.000
#> SRR1040865     1  0.4514    0.58958 0.744 0.000 0.024 0.124 0.108 0.000
#> SRR1040866     5  0.2048    0.47777 0.000 0.000 0.000 0.120 0.880 0.000
#> SRR1040867     5  0.4878    0.19213 0.096 0.032 0.016 0.116 0.740 0.000
#> SRR1040868     1  0.0603    0.79764 0.980 0.000 0.000 0.004 0.016 0.000
#> SRR1040869     3  0.7509    0.62586 0.260 0.116 0.480 0.060 0.080 0.004
#> SRR1040870     3  0.5452    0.48688 0.092 0.000 0.656 0.056 0.196 0.000
#> SRR1040871     3  0.7577    0.61957 0.260 0.108 0.476 0.072 0.080 0.004
#> SRR1040872     5  0.8006   -0.24895 0.108 0.052 0.328 0.180 0.332 0.000
#> SRR1040873     2  0.5911    0.73384 0.000 0.468 0.000 0.280 0.000 0.252
#> SRR1040874     1  0.0622    0.79234 0.980 0.000 0.000 0.008 0.000 0.012
#> SRR1040875     5  0.5688   -0.30537 0.152 0.000 0.016 0.256 0.576 0.000
#> SRR1040876     1  0.0976    0.79459 0.968 0.000 0.016 0.008 0.008 0.000
#> SRR1040877     3  0.1141    0.57062 0.000 0.000 0.948 0.052 0.000 0.000
#> SRR1040878     4  0.5552    0.73614 0.084 0.000 0.012 0.552 0.344 0.008
#> SRR1040879     6  0.0260    0.67395 0.008 0.000 0.000 0.000 0.000 0.992
#> SRR1040880     1  0.1218    0.79193 0.956 0.000 0.004 0.012 0.028 0.000
#> SRR1040881     6  0.0260    0.67395 0.008 0.000 0.000 0.000 0.000 0.992
#> SRR1040882     3  0.6605    0.60928 0.100 0.084 0.632 0.084 0.096 0.004
#> SRR1040883     3  0.7554    0.62240 0.260 0.116 0.476 0.064 0.080 0.004
#> SRR1040884     1  0.0146    0.79774 0.996 0.000 0.000 0.004 0.000 0.000
#> SRR1040885     3  0.1141    0.57062 0.000 0.000 0.948 0.052 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-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 15258 rows and 73 columns.
#>   Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'CV' method.
#>   Subgroups are detected by 'NMF' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 2.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

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

collect_plots(res)

plot of chunk CV-NMF-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.940           0.924       0.969         0.4650 0.535   0.535
#> 3 3 0.632           0.808       0.890         0.4193 0.755   0.558
#> 4 4 0.694           0.712       0.872         0.0869 0.912   0.747
#> 5 5 0.616           0.598       0.805         0.0577 0.904   0.688
#> 6 6 0.624           0.605       0.783         0.0357 0.924   0.713

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

suggest_best_k(res)
#> [1] 2

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

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

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>            class entropy silhouette    p1    p2
#> SRR1040814     1  0.0000      0.973 1.000 0.000
#> SRR1040813     1  0.0000      0.973 1.000 0.000
#> SRR1040816     2  0.9552      0.402 0.376 0.624
#> SRR1040815     2  0.0000      0.956 0.000 1.000
#> SRR1040817     1  0.0000      0.973 1.000 0.000
#> SRR1040818     2  0.0000      0.956 0.000 1.000
#> SRR1040819     2  0.0000      0.956 0.000 1.000
#> SRR1040820     2  0.0000      0.956 0.000 1.000
#> SRR1040821     2  0.0000      0.956 0.000 1.000
#> SRR1040822     1  0.0000      0.973 1.000 0.000
#> SRR1040823     1  0.0000      0.973 1.000 0.000
#> SRR1040824     2  0.0000      0.956 0.000 1.000
#> SRR1040826     1  0.0000      0.973 1.000 0.000
#> SRR1040825     2  0.0000      0.956 0.000 1.000
#> SRR1040827     2  0.0000      0.956 0.000 1.000
#> SRR1040828     2  0.0000      0.956 0.000 1.000
#> SRR1040829     2  0.0000      0.956 0.000 1.000
#> SRR1040830     2  0.3114      0.908 0.056 0.944
#> SRR1040831     1  0.0000      0.973 1.000 0.000
#> SRR1040832     2  0.0000      0.956 0.000 1.000
#> SRR1040833     1  0.3114      0.923 0.944 0.056
#> SRR1040834     1  0.0376      0.970 0.996 0.004
#> SRR1040835     2  0.0000      0.956 0.000 1.000
#> SRR1040836     1  0.0000      0.973 1.000 0.000
#> SRR1040837     2  0.0000      0.956 0.000 1.000
#> SRR1040839     2  0.0000      0.956 0.000 1.000
#> SRR1040838     1  0.0000      0.973 1.000 0.000
#> SRR1040840     2  0.0000      0.956 0.000 1.000
#> SRR1040841     1  0.1184      0.960 0.984 0.016
#> SRR1040843     2  0.0000      0.956 0.000 1.000
#> SRR1040842     1  0.1633      0.953 0.976 0.024
#> SRR1040845     2  0.6887      0.761 0.184 0.816
#> SRR1040844     1  0.0000      0.973 1.000 0.000
#> SRR1040846     2  0.0000      0.956 0.000 1.000
#> SRR1040847     1  0.0000      0.973 1.000 0.000
#> SRR1040849     1  0.0000      0.973 1.000 0.000
#> SRR1040848     2  0.0000      0.956 0.000 1.000
#> SRR1040851     1  0.0000      0.973 1.000 0.000
#> SRR1040850     1  0.0000      0.973 1.000 0.000
#> SRR1040852     1  0.0000      0.973 1.000 0.000
#> SRR1040853     1  0.0000      0.973 1.000 0.000
#> SRR1040854     1  0.0000      0.973 1.000 0.000
#> SRR1040855     1  0.0000      0.973 1.000 0.000
#> SRR1040856     2  0.0938      0.947 0.012 0.988
#> SRR1040857     1  0.0000      0.973 1.000 0.000
#> SRR1040858     1  0.0000      0.973 1.000 0.000
#> SRR1040859     2  0.9881      0.242 0.436 0.564
#> SRR1040860     1  0.9000      0.523 0.684 0.316
#> SRR1040861     1  0.0000      0.973 1.000 0.000
#> SRR1040862     1  0.1843      0.950 0.972 0.028
#> SRR1040863     1  0.4562      0.881 0.904 0.096
#> SRR1040864     1  0.0000      0.973 1.000 0.000
#> SRR1040865     1  0.0000      0.973 1.000 0.000
#> SRR1040866     1  0.9427      0.430 0.640 0.360
#> SRR1040867     1  0.0000      0.973 1.000 0.000
#> SRR1040868     1  0.0000      0.973 1.000 0.000
#> SRR1040869     1  0.0000      0.973 1.000 0.000
#> SRR1040870     1  0.0000      0.973 1.000 0.000
#> SRR1040871     1  0.0000      0.973 1.000 0.000
#> SRR1040872     1  0.0000      0.973 1.000 0.000
#> SRR1040873     2  0.0000      0.956 0.000 1.000
#> SRR1040874     1  0.8713      0.578 0.708 0.292
#> SRR1040875     1  0.0000      0.973 1.000 0.000
#> SRR1040876     1  0.0000      0.973 1.000 0.000
#> SRR1040877     1  0.0000      0.973 1.000 0.000
#> SRR1040878     1  0.0000      0.973 1.000 0.000
#> SRR1040879     2  0.0000      0.956 0.000 1.000
#> SRR1040880     1  0.0000      0.973 1.000 0.000
#> SRR1040881     2  0.0000      0.956 0.000 1.000
#> SRR1040882     1  0.0000      0.973 1.000 0.000
#> SRR1040883     1  0.0000      0.973 1.000 0.000
#> SRR1040884     1  0.0000      0.973 1.000 0.000
#> SRR1040885     1  0.0000      0.973 1.000 0.000

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>            class entropy silhouette    p1    p2    p3
#> SRR1040814     3  0.0892     0.8773 0.020 0.000 0.980
#> SRR1040813     1  0.3551     0.8295 0.868 0.000 0.132
#> SRR1040816     1  0.3340     0.8186 0.880 0.120 0.000
#> SRR1040815     2  0.3038     0.8769 0.104 0.896 0.000
#> SRR1040817     3  0.2165     0.8513 0.064 0.000 0.936
#> SRR1040818     2  0.5621     0.6852 0.308 0.692 0.000
#> SRR1040819     2  0.0000     0.9342 0.000 1.000 0.000
#> SRR1040820     2  0.0000     0.9342 0.000 1.000 0.000
#> SRR1040821     2  0.0000     0.9342 0.000 1.000 0.000
#> SRR1040822     3  0.0000     0.8822 0.000 0.000 1.000
#> SRR1040823     3  0.0000     0.8822 0.000 0.000 1.000
#> SRR1040824     2  0.0000     0.9342 0.000 1.000 0.000
#> SRR1040826     3  0.0237     0.8821 0.004 0.000 0.996
#> SRR1040825     2  0.3340     0.8490 0.120 0.880 0.000
#> SRR1040827     2  0.1529     0.9172 0.040 0.960 0.000
#> SRR1040828     2  0.0424     0.9322 0.008 0.992 0.000
#> SRR1040829     2  0.0237     0.9336 0.004 0.996 0.000
#> SRR1040830     1  0.5138     0.6643 0.748 0.252 0.000
#> SRR1040831     1  0.3038     0.8435 0.896 0.000 0.104
#> SRR1040832     1  0.5327     0.6303 0.728 0.272 0.000
#> SRR1040833     1  0.3193     0.8342 0.896 0.100 0.004
#> SRR1040834     1  0.3502     0.8462 0.896 0.084 0.020
#> SRR1040835     2  0.5835     0.4842 0.340 0.660 0.000
#> SRR1040836     1  0.2945     0.8313 0.908 0.004 0.088
#> SRR1040837     2  0.0000     0.9342 0.000 1.000 0.000
#> SRR1040839     2  0.0000     0.9342 0.000 1.000 0.000
#> SRR1040838     1  0.6140     0.4000 0.596 0.000 0.404
#> SRR1040840     2  0.0237     0.9336 0.004 0.996 0.000
#> SRR1040841     1  0.3502     0.8461 0.896 0.084 0.020
#> SRR1040843     2  0.0000     0.9342 0.000 1.000 0.000
#> SRR1040842     3  0.4295     0.7913 0.104 0.032 0.864
#> SRR1040845     2  0.3083     0.8854 0.024 0.916 0.060
#> SRR1040844     1  0.3692     0.8516 0.896 0.056 0.048
#> SRR1040846     2  0.0237     0.9336 0.004 0.996 0.000
#> SRR1040847     1  0.3590     0.8494 0.896 0.076 0.028
#> SRR1040849     3  0.0592     0.8804 0.012 0.000 0.988
#> SRR1040848     2  0.3038     0.8769 0.104 0.896 0.000
#> SRR1040851     3  0.6026     0.5302 0.376 0.000 0.624
#> SRR1040850     3  0.0000     0.8822 0.000 0.000 1.000
#> SRR1040852     3  0.1860     0.8600 0.052 0.000 0.948
#> SRR1040853     3  0.0424     0.8818 0.008 0.000 0.992
#> SRR1040854     3  0.5178     0.6180 0.256 0.000 0.744
#> SRR1040855     3  0.0000     0.8822 0.000 0.000 1.000
#> SRR1040856     2  0.2625     0.8784 0.000 0.916 0.084
#> SRR1040857     3  0.5465     0.5582 0.288 0.000 0.712
#> SRR1040858     1  0.5138     0.7184 0.748 0.000 0.252
#> SRR1040859     2  0.3771     0.8411 0.012 0.876 0.112
#> SRR1040860     3  0.4931     0.6643 0.000 0.232 0.768
#> SRR1040861     3  0.0000     0.8822 0.000 0.000 1.000
#> SRR1040862     3  0.1031     0.8703 0.000 0.024 0.976
#> SRR1040863     3  0.4845     0.7759 0.104 0.052 0.844
#> SRR1040864     3  0.0000     0.8822 0.000 0.000 1.000
#> SRR1040865     1  0.5882     0.5549 0.652 0.000 0.348
#> SRR1040866     3  0.7624     0.5769 0.104 0.224 0.672
#> SRR1040867     3  0.0747     0.8794 0.016 0.000 0.984
#> SRR1040868     1  0.3038     0.8435 0.896 0.000 0.104
#> SRR1040869     3  0.5178     0.6185 0.256 0.000 0.744
#> SRR1040870     3  0.0424     0.8818 0.008 0.000 0.992
#> SRR1040871     3  0.6295    -0.0261 0.472 0.000 0.528
#> SRR1040872     3  0.0000     0.8822 0.000 0.000 1.000
#> SRR1040873     2  0.0000     0.9342 0.000 1.000 0.000
#> SRR1040874     1  0.3116     0.8276 0.892 0.108 0.000
#> SRR1040875     3  0.3340     0.8067 0.120 0.000 0.880
#> SRR1040876     1  0.3445     0.8436 0.896 0.088 0.016
#> SRR1040877     3  0.0000     0.8822 0.000 0.000 1.000
#> SRR1040878     3  0.0424     0.8818 0.008 0.000 0.992
#> SRR1040879     2  0.1411     0.9188 0.036 0.964 0.000
#> SRR1040880     1  0.3116     0.8421 0.892 0.000 0.108
#> SRR1040881     2  0.1643     0.9138 0.044 0.956 0.000
#> SRR1040882     1  0.4796     0.7571 0.780 0.000 0.220
#> SRR1040883     1  0.5835     0.5767 0.660 0.000 0.340
#> SRR1040884     1  0.3116     0.8421 0.892 0.000 0.108
#> SRR1040885     3  0.0000     0.8822 0.000 0.000 1.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> SRR1040814     3  0.0817      0.845 0.024 0.000 0.976 0.000
#> SRR1040813     1  0.2546      0.775 0.900 0.000 0.092 0.008
#> SRR1040816     1  0.0895      0.801 0.976 0.020 0.000 0.004
#> SRR1040815     4  0.5130      0.589 0.016 0.332 0.000 0.652
#> SRR1040817     3  0.1302      0.838 0.044 0.000 0.956 0.000
#> SRR1040818     4  0.4274      0.762 0.108 0.072 0.000 0.820
#> SRR1040819     2  0.1004      0.848 0.004 0.972 0.000 0.024
#> SRR1040820     2  0.0188      0.855 0.000 0.996 0.000 0.004
#> SRR1040821     2  0.0000      0.855 0.000 1.000 0.000 0.000
#> SRR1040822     3  0.0336      0.845 0.008 0.000 0.992 0.000
#> SRR1040823     3  0.0672      0.845 0.008 0.000 0.984 0.008
#> SRR1040824     2  0.0188      0.855 0.000 0.996 0.000 0.004
#> SRR1040826     3  0.0707      0.846 0.020 0.000 0.980 0.000
#> SRR1040825     2  0.4095      0.666 0.192 0.792 0.000 0.016
#> SRR1040827     2  0.2401      0.793 0.004 0.904 0.000 0.092
#> SRR1040828     2  0.1118      0.842 0.000 0.964 0.000 0.036
#> SRR1040829     2  0.1118      0.842 0.000 0.964 0.000 0.036
#> SRR1040830     2  0.6105      0.100 0.476 0.484 0.004 0.036
#> SRR1040831     1  0.0000      0.819 1.000 0.000 0.000 0.000
#> SRR1040832     1  0.3710      0.589 0.804 0.192 0.000 0.004
#> SRR1040833     1  0.0000      0.819 1.000 0.000 0.000 0.000
#> SRR1040834     1  0.1406      0.805 0.960 0.024 0.016 0.000
#> SRR1040835     2  0.4955      0.443 0.344 0.648 0.000 0.008
#> SRR1040836     1  0.0921      0.806 0.972 0.000 0.000 0.028
#> SRR1040837     2  0.0000      0.855 0.000 1.000 0.000 0.000
#> SRR1040839     2  0.0188      0.855 0.000 0.996 0.000 0.004
#> SRR1040838     1  0.4955      0.254 0.556 0.000 0.444 0.000
#> SRR1040840     2  0.0000      0.855 0.000 1.000 0.000 0.000
#> SRR1040841     1  0.0000      0.819 1.000 0.000 0.000 0.000
#> SRR1040843     2  0.0188      0.855 0.000 0.996 0.000 0.004
#> SRR1040842     3  0.5244      0.346 0.000 0.012 0.600 0.388
#> SRR1040845     2  0.7867     -0.190 0.000 0.392 0.316 0.292
#> SRR1040844     1  0.0000      0.819 1.000 0.000 0.000 0.000
#> SRR1040846     2  0.0000      0.855 0.000 1.000 0.000 0.000
#> SRR1040847     1  0.0000      0.819 1.000 0.000 0.000 0.000
#> SRR1040849     3  0.1388      0.843 0.012 0.000 0.960 0.028
#> SRR1040848     4  0.4564      0.609 0.000 0.328 0.000 0.672
#> SRR1040851     4  0.4710      0.690 0.120 0.000 0.088 0.792
#> SRR1040850     3  0.2466      0.806 0.000 0.004 0.900 0.096
#> SRR1040852     3  0.2149      0.812 0.088 0.000 0.912 0.000
#> SRR1040853     3  0.1452      0.842 0.036 0.000 0.956 0.008
#> SRR1040854     3  0.4250      0.562 0.276 0.000 0.724 0.000
#> SRR1040855     3  0.0188      0.843 0.000 0.000 0.996 0.004
#> SRR1040856     2  0.2469      0.755 0.000 0.892 0.108 0.000
#> SRR1040857     3  0.4605      0.432 0.336 0.000 0.664 0.000
#> SRR1040858     1  0.3873      0.679 0.772 0.000 0.228 0.000
#> SRR1040859     2  0.1637      0.812 0.000 0.940 0.060 0.000
#> SRR1040860     3  0.5212      0.222 0.000 0.420 0.572 0.008
#> SRR1040861     3  0.2814      0.769 0.000 0.000 0.868 0.132
#> SRR1040862     3  0.4956      0.648 0.000 0.056 0.756 0.188
#> SRR1040863     4  0.2563      0.776 0.000 0.020 0.072 0.908
#> SRR1040864     3  0.1637      0.820 0.000 0.000 0.940 0.060
#> SRR1040865     1  0.4761      0.441 0.628 0.000 0.372 0.000
#> SRR1040866     4  0.2759      0.784 0.000 0.044 0.052 0.904
#> SRR1040867     3  0.4764      0.752 0.088 0.000 0.788 0.124
#> SRR1040868     1  0.0188      0.819 0.996 0.000 0.004 0.000
#> SRR1040869     3  0.4431      0.509 0.304 0.000 0.696 0.000
#> SRR1040870     3  0.0336      0.845 0.008 0.000 0.992 0.000
#> SRR1040871     1  0.4998      0.119 0.512 0.000 0.488 0.000
#> SRR1040872     3  0.0469      0.841 0.000 0.000 0.988 0.012
#> SRR1040873     2  0.0336      0.854 0.000 0.992 0.000 0.008
#> SRR1040874     1  0.0000      0.819 1.000 0.000 0.000 0.000
#> SRR1040875     3  0.6597      0.468 0.304 0.000 0.588 0.108
#> SRR1040876     1  0.0336      0.818 0.992 0.000 0.008 0.000
#> SRR1040877     3  0.0188      0.844 0.004 0.000 0.996 0.000
#> SRR1040878     3  0.0592      0.845 0.016 0.000 0.984 0.000
#> SRR1040879     2  0.0707      0.849 0.020 0.980 0.000 0.000
#> SRR1040880     1  0.0000      0.819 1.000 0.000 0.000 0.000
#> SRR1040881     2  0.2266      0.799 0.084 0.912 0.000 0.004
#> SRR1040882     1  0.4800      0.522 0.656 0.000 0.340 0.004
#> SRR1040883     1  0.4830      0.416 0.608 0.000 0.392 0.000
#> SRR1040884     1  0.0336      0.818 0.992 0.000 0.008 0.000
#> SRR1040885     3  0.0000      0.843 0.000 0.000 1.000 0.000

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>            class entropy silhouette    p1    p2    p3    p4    p5
#> SRR1040814     3  0.0671    0.72026 0.016 0.000 0.980 0.000 0.004
#> SRR1040813     1  0.5908    0.58733 0.652 0.000 0.196 0.024 0.128
#> SRR1040816     1  0.1026    0.82072 0.968 0.004 0.000 0.004 0.024
#> SRR1040815     4  0.3509    0.60980 0.008 0.196 0.000 0.792 0.004
#> SRR1040817     3  0.0451    0.71852 0.008 0.000 0.988 0.000 0.004
#> SRR1040818     4  0.3266    0.57053 0.108 0.032 0.000 0.852 0.008
#> SRR1040819     2  0.1865    0.81780 0.008 0.936 0.000 0.024 0.032
#> SRR1040820     2  0.0290    0.83186 0.000 0.992 0.000 0.000 0.008
#> SRR1040821     2  0.0290    0.83186 0.000 0.992 0.000 0.000 0.008
#> SRR1040822     3  0.0727    0.71670 0.004 0.000 0.980 0.004 0.012
#> SRR1040823     3  0.2696    0.68405 0.012 0.000 0.892 0.024 0.072
#> SRR1040824     2  0.0798    0.83054 0.000 0.976 0.000 0.008 0.016
#> SRR1040826     3  0.0290    0.71603 0.000 0.000 0.992 0.000 0.008
#> SRR1040825     2  0.5929    0.49791 0.276 0.620 0.000 0.036 0.068
#> SRR1040827     2  0.3752    0.73768 0.000 0.812 0.000 0.124 0.064
#> SRR1040828     2  0.2797    0.79404 0.000 0.880 0.000 0.060 0.060
#> SRR1040829     2  0.2661    0.79983 0.000 0.888 0.000 0.056 0.056
#> SRR1040830     2  0.7235    0.26754 0.348 0.480 0.008 0.064 0.100
#> SRR1040831     1  0.0451    0.82394 0.988 0.000 0.004 0.000 0.008
#> SRR1040832     1  0.3933    0.69529 0.816 0.112 0.000 0.012 0.060
#> SRR1040833     1  0.0703    0.82099 0.976 0.000 0.000 0.000 0.024
#> SRR1040834     1  0.3674    0.76112 0.852 0.032 0.024 0.012 0.080
#> SRR1040835     2  0.5439    0.28263 0.432 0.520 0.000 0.012 0.036
#> SRR1040836     1  0.1461    0.81446 0.952 0.000 0.004 0.028 0.016
#> SRR1040837     2  0.0566    0.83241 0.000 0.984 0.000 0.012 0.004
#> SRR1040839     2  0.0451    0.83229 0.000 0.988 0.000 0.004 0.008
#> SRR1040838     1  0.5420    0.31459 0.592 0.000 0.332 0.000 0.076
#> SRR1040840     2  0.0566    0.83209 0.000 0.984 0.000 0.004 0.012
#> SRR1040841     1  0.0833    0.82357 0.976 0.000 0.004 0.004 0.016
#> SRR1040843     2  0.0566    0.83209 0.000 0.984 0.000 0.004 0.012
#> SRR1040842     5  0.6567    0.34532 0.000 0.012 0.384 0.144 0.460
#> SRR1040845     5  0.6314    0.00556 0.000 0.284 0.036 0.096 0.584
#> SRR1040844     1  0.0162    0.82251 0.996 0.000 0.000 0.000 0.004
#> SRR1040846     2  0.0566    0.83241 0.000 0.984 0.000 0.012 0.004
#> SRR1040847     1  0.1043    0.81385 0.960 0.000 0.000 0.000 0.040
#> SRR1040849     3  0.5513    0.30913 0.044 0.000 0.580 0.016 0.360
#> SRR1040848     4  0.3563    0.60237 0.000 0.208 0.000 0.780 0.012
#> SRR1040851     4  0.7161    0.24544 0.120 0.000 0.092 0.540 0.248
#> SRR1040850     5  0.6238    0.09085 0.036 0.016 0.400 0.032 0.516
#> SRR1040852     3  0.4083    0.64645 0.080 0.000 0.788 0.000 0.132
#> SRR1040853     3  0.5350    0.42808 0.072 0.000 0.632 0.004 0.292
#> SRR1040854     3  0.3944    0.62836 0.160 0.000 0.788 0.000 0.052
#> SRR1040855     3  0.1410    0.70190 0.000 0.000 0.940 0.000 0.060
#> SRR1040856     2  0.3003    0.75848 0.000 0.864 0.044 0.000 0.092
#> SRR1040857     3  0.3197    0.65629 0.140 0.000 0.836 0.000 0.024
#> SRR1040858     1  0.5204    0.30625 0.580 0.000 0.368 0.000 0.052
#> SRR1040859     2  0.2540    0.77603 0.000 0.888 0.088 0.000 0.024
#> SRR1040860     2  0.5192    0.45632 0.000 0.664 0.244 0.000 0.092
#> SRR1040861     5  0.4897    0.31038 0.000 0.000 0.460 0.024 0.516
#> SRR1040862     5  0.6266    0.41177 0.000 0.040 0.328 0.072 0.560
#> SRR1040863     5  0.5390   -0.14790 0.000 0.004 0.048 0.412 0.536
#> SRR1040864     3  0.4707    0.10701 0.000 0.000 0.588 0.020 0.392
#> SRR1040865     1  0.4887    0.54330 0.692 0.000 0.252 0.008 0.048
#> SRR1040866     4  0.5549    0.25404 0.000 0.036 0.020 0.552 0.392
#> SRR1040867     3  0.6624    0.23197 0.080 0.000 0.544 0.060 0.316
#> SRR1040868     1  0.1243    0.81284 0.960 0.000 0.008 0.004 0.028
#> SRR1040869     3  0.3278    0.64829 0.156 0.000 0.824 0.000 0.020
#> SRR1040870     3  0.0510    0.71495 0.000 0.000 0.984 0.000 0.016
#> SRR1040871     3  0.5177    0.06679 0.472 0.000 0.488 0.000 0.040
#> SRR1040872     3  0.2997    0.63538 0.000 0.000 0.840 0.012 0.148
#> SRR1040873     2  0.0566    0.83107 0.000 0.984 0.000 0.004 0.012
#> SRR1040874     1  0.0162    0.82311 0.996 0.000 0.000 0.000 0.004
#> SRR1040875     5  0.6417    0.32739 0.224 0.000 0.216 0.008 0.552
#> SRR1040876     1  0.1799    0.81576 0.940 0.000 0.012 0.020 0.028
#> SRR1040877     3  0.0609    0.71370 0.000 0.000 0.980 0.000 0.020
#> SRR1040878     3  0.3257    0.65981 0.012 0.024 0.852 0.000 0.112
#> SRR1040879     2  0.2606    0.80245 0.032 0.900 0.000 0.012 0.056
#> SRR1040880     1  0.0960    0.81743 0.972 0.000 0.004 0.008 0.016
#> SRR1040881     2  0.4267    0.72271 0.116 0.800 0.000 0.024 0.060
#> SRR1040882     3  0.5005    0.34906 0.340 0.000 0.624 0.016 0.020
#> SRR1040883     1  0.4653    0.04841 0.516 0.000 0.472 0.000 0.012
#> SRR1040884     1  0.1173    0.82315 0.964 0.000 0.012 0.004 0.020
#> SRR1040885     3  0.0404    0.71613 0.000 0.000 0.988 0.000 0.012

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>            class entropy silhouette    p1    p2    p3    p4    p5    p6
#> SRR1040814     3  0.0984     0.7060 0.008 0.000 0.968 0.012 0.012 0.000
#> SRR1040813     1  0.6347     0.4891 0.616 0.004 0.180 0.072 0.108 0.020
#> SRR1040816     1  0.1608     0.8214 0.940 0.004 0.000 0.016 0.036 0.004
#> SRR1040815     6  0.2734     0.8526 0.004 0.148 0.000 0.000 0.008 0.840
#> SRR1040817     3  0.0881     0.7072 0.012 0.000 0.972 0.008 0.008 0.000
#> SRR1040818     6  0.3078     0.7341 0.068 0.032 0.000 0.004 0.032 0.864
#> SRR1040819     2  0.2381     0.7905 0.008 0.908 0.000 0.028 0.028 0.028
#> SRR1040820     2  0.0508     0.8093 0.000 0.984 0.000 0.012 0.000 0.004
#> SRR1040821     2  0.0291     0.8096 0.000 0.992 0.000 0.004 0.000 0.004
#> SRR1040822     3  0.1518     0.6985 0.008 0.000 0.944 0.024 0.024 0.000
#> SRR1040823     3  0.4916     0.5215 0.012 0.008 0.744 0.076 0.128 0.032
#> SRR1040824     2  0.1434     0.8078 0.000 0.948 0.000 0.020 0.024 0.008
#> SRR1040826     3  0.0964     0.7036 0.004 0.000 0.968 0.012 0.016 0.000
#> SRR1040825     2  0.5948     0.2953 0.388 0.504 0.000 0.044 0.044 0.020
#> SRR1040827     2  0.4623     0.6778 0.000 0.740 0.000 0.056 0.056 0.148
#> SRR1040828     2  0.4733     0.6756 0.000 0.740 0.000 0.056 0.116 0.088
#> SRR1040829     2  0.4589     0.6863 0.000 0.752 0.000 0.052 0.108 0.088
#> SRR1040830     2  0.8004     0.1534 0.308 0.388 0.008 0.060 0.148 0.088
#> SRR1040831     1  0.0551     0.8287 0.984 0.000 0.004 0.004 0.008 0.000
#> SRR1040832     1  0.3454     0.7580 0.844 0.072 0.008 0.032 0.044 0.000
#> SRR1040833     1  0.0291     0.8274 0.992 0.000 0.004 0.000 0.004 0.000
#> SRR1040834     1  0.3739     0.7576 0.828 0.020 0.020 0.056 0.076 0.000
#> SRR1040835     1  0.5293     0.0189 0.516 0.420 0.000 0.024 0.028 0.012
#> SRR1040836     1  0.2898     0.7880 0.872 0.000 0.008 0.008 0.060 0.052
#> SRR1040837     2  0.0909     0.8084 0.000 0.968 0.000 0.020 0.012 0.000
#> SRR1040839     2  0.1749     0.8052 0.000 0.932 0.000 0.036 0.024 0.008
#> SRR1040838     1  0.5485     0.3770 0.600 0.004 0.232 0.004 0.160 0.000
#> SRR1040840     2  0.0146     0.8097 0.000 0.996 0.000 0.004 0.000 0.000
#> SRR1040841     1  0.0458     0.8279 0.984 0.000 0.000 0.000 0.016 0.000
#> SRR1040843     2  0.0363     0.8088 0.000 0.988 0.000 0.012 0.000 0.000
#> SRR1040842     5  0.7667     0.2344 0.000 0.016 0.240 0.216 0.396 0.132
#> SRR1040845     4  0.7269     0.2538 0.008 0.268 0.020 0.428 0.236 0.040
#> SRR1040844     1  0.1124     0.8200 0.956 0.000 0.000 0.008 0.036 0.000
#> SRR1040846     2  0.0260     0.8093 0.000 0.992 0.000 0.008 0.000 0.000
#> SRR1040847     1  0.0837     0.8285 0.972 0.000 0.004 0.004 0.020 0.000
#> SRR1040849     5  0.4904     0.3585 0.016 0.000 0.364 0.040 0.580 0.000
#> SRR1040848     6  0.2593     0.8479 0.000 0.148 0.000 0.008 0.000 0.844
#> SRR1040851     5  0.6894     0.1456 0.080 0.000 0.064 0.044 0.476 0.336
#> SRR1040850     5  0.5054     0.4406 0.008 0.008 0.168 0.108 0.700 0.008
#> SRR1040852     3  0.4327     0.5530 0.052 0.000 0.728 0.016 0.204 0.000
#> SRR1040853     3  0.5464     0.1951 0.028 0.004 0.568 0.060 0.340 0.000
#> SRR1040854     3  0.3904     0.6265 0.112 0.000 0.784 0.008 0.096 0.000
#> SRR1040855     3  0.1528     0.6888 0.000 0.000 0.936 0.016 0.048 0.000
#> SRR1040856     2  0.4038     0.6805 0.000 0.784 0.048 0.036 0.132 0.000
#> SRR1040857     3  0.2774     0.6880 0.076 0.000 0.872 0.012 0.040 0.000
#> SRR1040858     3  0.5576     0.2536 0.396 0.000 0.492 0.012 0.100 0.000
#> SRR1040859     2  0.3311     0.7377 0.008 0.840 0.108 0.024 0.020 0.000
#> SRR1040860     2  0.4753     0.5629 0.000 0.712 0.188 0.036 0.064 0.000
#> SRR1040861     4  0.3168     0.5603 0.000 0.000 0.192 0.792 0.016 0.000
#> SRR1040862     4  0.3355     0.6363 0.000 0.040 0.116 0.828 0.016 0.000
#> SRR1040863     4  0.3479     0.5531 0.000 0.004 0.020 0.796 0.008 0.172
#> SRR1040864     5  0.6067     0.3877 0.000 0.000 0.388 0.136 0.452 0.024
#> SRR1040865     1  0.5635     0.3427 0.580 0.000 0.244 0.012 0.164 0.000
#> SRR1040866     5  0.6294     0.0989 0.000 0.012 0.016 0.160 0.488 0.324
#> SRR1040867     5  0.5981     0.2141 0.056 0.000 0.420 0.012 0.468 0.044
#> SRR1040868     1  0.2791     0.7676 0.864 0.000 0.032 0.008 0.096 0.000
#> SRR1040869     3  0.2822     0.6798 0.076 0.000 0.864 0.004 0.056 0.000
#> SRR1040870     3  0.0748     0.7033 0.004 0.000 0.976 0.016 0.004 0.000
#> SRR1040871     3  0.5613     0.3306 0.336 0.000 0.540 0.016 0.108 0.000
#> SRR1040872     3  0.4008     0.4482 0.000 0.000 0.740 0.064 0.196 0.000
#> SRR1040873     2  0.0520     0.8095 0.000 0.984 0.000 0.008 0.000 0.008
#> SRR1040874     1  0.0508     0.8256 0.984 0.000 0.000 0.004 0.012 0.000
#> SRR1040875     5  0.7215     0.1345 0.172 0.000 0.096 0.304 0.420 0.008
#> SRR1040876     1  0.1149     0.8263 0.960 0.000 0.008 0.008 0.024 0.000
#> SRR1040877     3  0.1036     0.7022 0.004 0.000 0.964 0.024 0.008 0.000
#> SRR1040878     3  0.5086     0.5534 0.012 0.064 0.736 0.112 0.072 0.004
#> SRR1040879     2  0.3335     0.7621 0.064 0.856 0.000 0.032 0.028 0.020
#> SRR1040880     1  0.2879     0.7758 0.864 0.000 0.012 0.012 0.100 0.012
#> SRR1040881     2  0.4517     0.6664 0.156 0.756 0.000 0.036 0.032 0.020
#> SRR1040882     3  0.4595     0.4373 0.264 0.000 0.676 0.020 0.040 0.000
#> SRR1040883     3  0.5014     0.3477 0.368 0.000 0.564 0.008 0.060 0.000
#> SRR1040884     1  0.1409     0.8243 0.948 0.000 0.012 0.008 0.032 0.000
#> SRR1040885     3  0.1092     0.6980 0.000 0.000 0.960 0.020 0.020 0.000

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

consensus_heatmap(res, k = 2)

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

consensus_heatmap(res, k = 3)

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

consensus_heatmap(res, k = 4)

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

consensus_heatmap(res, k = 5)

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

consensus_heatmap(res, k = 6)

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

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

membership_heatmap(res, k = 2)

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

membership_heatmap(res, k = 3)

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

membership_heatmap(res, k = 4)

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

membership_heatmap(res, k = 5)

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

membership_heatmap(res, k = 6)

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

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

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

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

get_signatures(res, k = 3)

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

get_signatures(res, k = 4)

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

get_signatures(res, k = 5)

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

get_signatures(res, k = 6)

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

Signature heatmaps where rows are not scaled:

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

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

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

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

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

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

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

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

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

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

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk CV-NMF-signature_compare

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

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

An example of the output of tb is:

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

The columns in tb are:

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

UMAP plot which shows how samples are separated.

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

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

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

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

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

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

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

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

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

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

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk CV-NMF-collect-classes

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


MAD:hclust**

The object with results only for a single top-value method and a single partition method can be extracted as:

res = res_list["MAD", "hclust"]
# you can also extract it by
# res = res_list["MAD:hclust"]

A summary of res and all the functions that can be applied to it:

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

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

collect_plots(res)

plot of chunk MAD-hclust-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 1.000           0.960       0.982         0.4859 0.514   0.514
#> 3 3 0.859           0.817       0.915         0.0983 0.989   0.979
#> 4 4 0.654           0.629       0.777         0.1681 1.000   1.000
#> 5 5 0.725           0.745       0.876         0.2039 0.743   0.489
#> 6 6 0.741           0.698       0.826         0.0568 0.976   0.903

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
#> SRR1040814     1  0.0000      0.981 1.000 0.000
#> SRR1040813     1  0.0000      0.981 1.000 0.000
#> SRR1040816     1  0.6712      0.782 0.824 0.176
#> SRR1040815     2  0.0000      0.981 0.000 1.000
#> SRR1040817     1  0.0000      0.981 1.000 0.000
#> SRR1040818     2  0.9358      0.445 0.352 0.648
#> SRR1040819     2  0.0000      0.981 0.000 1.000
#> SRR1040820     2  0.0000      0.981 0.000 1.000
#> SRR1040821     2  0.0000      0.981 0.000 1.000
#> SRR1040822     1  0.0000      0.981 1.000 0.000
#> SRR1040823     1  0.0000      0.981 1.000 0.000
#> SRR1040824     2  0.0000      0.981 0.000 1.000
#> SRR1040826     1  0.0000      0.981 1.000 0.000
#> SRR1040825     2  0.0000      0.981 0.000 1.000
#> SRR1040827     2  0.0000      0.981 0.000 1.000
#> SRR1040828     2  0.0938      0.978 0.012 0.988
#> SRR1040829     2  0.0000      0.981 0.000 1.000
#> SRR1040830     1  0.0000      0.981 1.000 0.000
#> SRR1040831     1  0.0000      0.981 1.000 0.000
#> SRR1040832     1  0.8661      0.600 0.712 0.288
#> SRR1040833     1  0.0000      0.981 1.000 0.000
#> SRR1040834     1  0.8661      0.600 0.712 0.288
#> SRR1040835     2  0.0000      0.981 0.000 1.000
#> SRR1040836     1  0.0000      0.981 1.000 0.000
#> SRR1040837     2  0.0000      0.981 0.000 1.000
#> SRR1040839     2  0.0000      0.981 0.000 1.000
#> SRR1040838     1  0.0376      0.978 0.996 0.004
#> SRR1040840     2  0.0000      0.981 0.000 1.000
#> SRR1040841     1  0.0000      0.981 1.000 0.000
#> SRR1040843     2  0.0000      0.981 0.000 1.000
#> SRR1040842     2  0.1184      0.976 0.016 0.984
#> SRR1040845     2  0.1184      0.976 0.016 0.984
#> SRR1040844     1  0.0000      0.981 1.000 0.000
#> SRR1040846     2  0.0000      0.981 0.000 1.000
#> SRR1040847     1  0.0000      0.981 1.000 0.000
#> SRR1040849     1  0.0000      0.981 1.000 0.000
#> SRR1040848     2  0.0000      0.981 0.000 1.000
#> SRR1040851     1  0.0000      0.981 1.000 0.000
#> SRR1040850     1  0.0000      0.981 1.000 0.000
#> SRR1040852     1  0.0376      0.978 0.996 0.004
#> SRR1040853     1  0.0376      0.978 0.996 0.004
#> SRR1040854     1  0.0000      0.981 1.000 0.000
#> SRR1040855     1  0.0000      0.981 1.000 0.000
#> SRR1040856     2  0.1184      0.976 0.016 0.984
#> SRR1040857     1  0.0000      0.981 1.000 0.000
#> SRR1040858     1  0.0000      0.981 1.000 0.000
#> SRR1040859     2  0.1184      0.976 0.016 0.984
#> SRR1040860     2  0.1184      0.976 0.016 0.984
#> SRR1040861     1  0.0000      0.981 1.000 0.000
#> SRR1040862     2  0.1184      0.976 0.016 0.984
#> SRR1040863     2  0.1184      0.976 0.016 0.984
#> SRR1040864     1  0.0000      0.981 1.000 0.000
#> SRR1040865     1  0.0000      0.981 1.000 0.000
#> SRR1040866     2  0.1184      0.976 0.016 0.984
#> SRR1040867     1  0.0000      0.981 1.000 0.000
#> SRR1040868     1  0.0000      0.981 1.000 0.000
#> SRR1040869     1  0.0000      0.981 1.000 0.000
#> SRR1040870     1  0.0000      0.981 1.000 0.000
#> SRR1040871     1  0.0000      0.981 1.000 0.000
#> SRR1040872     1  0.0000      0.981 1.000 0.000
#> SRR1040873     2  0.0000      0.981 0.000 1.000
#> SRR1040874     1  0.0000      0.981 1.000 0.000
#> SRR1040875     1  0.0376      0.978 0.996 0.004
#> SRR1040876     1  0.0000      0.981 1.000 0.000
#> SRR1040877     1  0.0000      0.981 1.000 0.000
#> SRR1040878     2  0.1414      0.973 0.020 0.980
#> SRR1040879     2  0.0000      0.981 0.000 1.000
#> SRR1040880     1  0.0000      0.981 1.000 0.000
#> SRR1040881     2  0.0000      0.981 0.000 1.000
#> SRR1040882     1  0.0000      0.981 1.000 0.000
#> SRR1040883     1  0.0000      0.981 1.000 0.000
#> SRR1040884     1  0.0000      0.981 1.000 0.000
#> SRR1040885     1  0.0000      0.981 1.000 0.000

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>            class entropy silhouette    p1    p2    p3
#> SRR1040814     1  0.0000     0.9759 1.000 0.000 0.000
#> SRR1040813     1  0.0000     0.9759 1.000 0.000 0.000
#> SRR1040816     1  0.4452     0.7526 0.808 0.000 0.192
#> SRR1040815     2  0.2448     0.7413 0.000 0.924 0.076
#> SRR1040817     1  0.0000     0.9759 1.000 0.000 0.000
#> SRR1040818     2  0.9968    -0.0419 0.332 0.368 0.300
#> SRR1040819     2  0.2448     0.7413 0.000 0.924 0.076
#> SRR1040820     2  0.0000     0.7437 0.000 1.000 0.000
#> SRR1040821     2  0.0000     0.7437 0.000 1.000 0.000
#> SRR1040822     1  0.0000     0.9759 1.000 0.000 0.000
#> SRR1040823     1  0.0000     0.9759 1.000 0.000 0.000
#> SRR1040824     2  0.0000     0.7437 0.000 1.000 0.000
#> SRR1040826     1  0.0000     0.9759 1.000 0.000 0.000
#> SRR1040825     2  0.3941     0.7261 0.000 0.844 0.156
#> SRR1040827     2  0.0000     0.7437 0.000 1.000 0.000
#> SRR1040828     2  0.5968     0.5839 0.000 0.636 0.364
#> SRR1040829     2  0.0747     0.7444 0.000 0.984 0.016
#> SRR1040830     1  0.0424     0.9735 0.992 0.000 0.008
#> SRR1040831     1  0.0000     0.9759 1.000 0.000 0.000
#> SRR1040832     1  0.5958     0.5517 0.692 0.008 0.300
#> SRR1040833     1  0.0000     0.9759 1.000 0.000 0.000
#> SRR1040834     1  0.5958     0.5517 0.692 0.008 0.300
#> SRR1040835     2  0.4002     0.7247 0.000 0.840 0.160
#> SRR1040836     1  0.0424     0.9735 0.992 0.000 0.008
#> SRR1040837     2  0.0000     0.7437 0.000 1.000 0.000
#> SRR1040839     2  0.0000     0.7437 0.000 1.000 0.000
#> SRR1040838     1  0.0237     0.9744 0.996 0.000 0.004
#> SRR1040840     2  0.0000     0.7437 0.000 1.000 0.000
#> SRR1040841     1  0.0424     0.9735 0.992 0.000 0.008
#> SRR1040843     2  0.0000     0.7437 0.000 1.000 0.000
#> SRR1040842     3  0.2537     0.0000 0.000 0.080 0.920
#> SRR1040845     2  0.6280     0.4986 0.000 0.540 0.460
#> SRR1040844     1  0.0424     0.9735 0.992 0.000 0.008
#> SRR1040846     2  0.0000     0.7437 0.000 1.000 0.000
#> SRR1040847     1  0.0424     0.9735 0.992 0.000 0.008
#> SRR1040849     1  0.0000     0.9759 1.000 0.000 0.000
#> SRR1040848     2  0.0000     0.7437 0.000 1.000 0.000
#> SRR1040851     1  0.0000     0.9759 1.000 0.000 0.000
#> SRR1040850     1  0.0592     0.9689 0.988 0.000 0.012
#> SRR1040852     1  0.0237     0.9744 0.996 0.000 0.004
#> SRR1040853     1  0.0237     0.9744 0.996 0.000 0.004
#> SRR1040854     1  0.0000     0.9759 1.000 0.000 0.000
#> SRR1040855     1  0.0592     0.9689 0.988 0.000 0.012
#> SRR1040856     2  0.6280     0.4986 0.000 0.540 0.460
#> SRR1040857     1  0.0000     0.9759 1.000 0.000 0.000
#> SRR1040858     1  0.0000     0.9759 1.000 0.000 0.000
#> SRR1040859     2  0.6280     0.4986 0.000 0.540 0.460
#> SRR1040860     2  0.6280     0.4986 0.000 0.540 0.460
#> SRR1040861     1  0.0592     0.9689 0.988 0.000 0.012
#> SRR1040862     2  0.6280     0.4986 0.000 0.540 0.460
#> SRR1040863     2  0.6280     0.4986 0.000 0.540 0.460
#> SRR1040864     1  0.0592     0.9689 0.988 0.000 0.012
#> SRR1040865     1  0.0424     0.9735 0.992 0.000 0.008
#> SRR1040866     2  0.6280     0.4986 0.000 0.540 0.460
#> SRR1040867     1  0.0000     0.9759 1.000 0.000 0.000
#> SRR1040868     1  0.0424     0.9735 0.992 0.000 0.008
#> SRR1040869     1  0.0000     0.9759 1.000 0.000 0.000
#> SRR1040870     1  0.0000     0.9759 1.000 0.000 0.000
#> SRR1040871     1  0.0000     0.9759 1.000 0.000 0.000
#> SRR1040872     1  0.0000     0.9759 1.000 0.000 0.000
#> SRR1040873     2  0.0000     0.7437 0.000 1.000 0.000
#> SRR1040874     1  0.0424     0.9735 0.992 0.000 0.008
#> SRR1040875     1  0.0424     0.9736 0.992 0.000 0.008
#> SRR1040876     1  0.0424     0.9735 0.992 0.000 0.008
#> SRR1040877     1  0.0000     0.9759 1.000 0.000 0.000
#> SRR1040878     2  0.6286     0.4919 0.000 0.536 0.464
#> SRR1040879     2  0.4002     0.7247 0.000 0.840 0.160
#> SRR1040880     1  0.0424     0.9735 0.992 0.000 0.008
#> SRR1040881     2  0.3941     0.7261 0.000 0.844 0.156
#> SRR1040882     1  0.0000     0.9759 1.000 0.000 0.000
#> SRR1040883     1  0.0000     0.9759 1.000 0.000 0.000
#> SRR1040884     1  0.0000     0.9759 1.000 0.000 0.000
#> SRR1040885     1  0.0000     0.9759 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
#> SRR1040814     3  0.3649      0.827 NA 0.000 0.796 0.000
#> SRR1040813     3  0.3649      0.827 NA 0.000 0.796 0.000
#> SRR1040816     3  0.7091      0.454 NA 0.048 0.644 0.212
#> SRR1040815     2  0.2081      0.524 NA 0.916 0.000 0.000
#> SRR1040817     3  0.3649      0.827 NA 0.000 0.796 0.000
#> SRR1040818     2  0.8952      0.074 NA 0.452 0.168 0.284
#> SRR1040819     2  0.2081      0.524 NA 0.916 0.000 0.000
#> SRR1040820     2  0.4999      0.501 NA 0.508 0.000 0.000
#> SRR1040821     2  0.4999      0.501 NA 0.508 0.000 0.000
#> SRR1040822     3  0.3649      0.827 NA 0.000 0.796 0.000
#> SRR1040823     3  0.3649      0.827 NA 0.000 0.796 0.000
#> SRR1040824     2  0.4999      0.501 NA 0.508 0.000 0.000
#> SRR1040826     3  0.3649      0.827 NA 0.000 0.796 0.000
#> SRR1040825     2  0.0188      0.514 NA 0.996 0.000 0.000
#> SRR1040827     2  0.4999      0.501 NA 0.508 0.000 0.000
#> SRR1040828     2  0.3649      0.420 NA 0.796 0.000 0.204
#> SRR1040829     2  0.4406      0.511 NA 0.700 0.000 0.000
#> SRR1040830     3  0.4163      0.713 NA 0.000 0.828 0.076
#> SRR1040831     3  0.0000      0.795 NA 0.000 1.000 0.000
#> SRR1040832     3  0.9402      0.258 NA 0.092 0.324 0.284
#> SRR1040833     3  0.0336      0.793 NA 0.000 0.992 0.000
#> SRR1040834     3  0.9402      0.258 NA 0.092 0.324 0.284
#> SRR1040835     2  0.0000      0.513 NA 1.000 0.000 0.000
#> SRR1040836     3  0.4163      0.713 NA 0.000 0.828 0.076
#> SRR1040837     2  0.4999      0.501 NA 0.508 0.000 0.000
#> SRR1040839     2  0.4999      0.501 NA 0.508 0.000 0.000
#> SRR1040838     3  0.3831      0.825 NA 0.000 0.792 0.004
#> SRR1040840     2  0.4999      0.501 NA 0.508 0.000 0.000
#> SRR1040841     3  0.4163      0.713 NA 0.000 0.828 0.076
#> SRR1040843     2  0.4999      0.501 NA 0.508 0.000 0.000
#> SRR1040842     4  0.5494      0.000 NA 0.076 0.000 0.716
#> SRR1040845     2  0.4431      0.362 NA 0.696 0.000 0.304
#> SRR1040844     3  0.4163      0.713 NA 0.000 0.828 0.076
#> SRR1040846     2  0.4999      0.501 NA 0.508 0.000 0.000
#> SRR1040847     3  0.4163      0.713 NA 0.000 0.828 0.076
#> SRR1040849     3  0.3649      0.827 NA 0.000 0.796 0.000
#> SRR1040848     2  0.4999      0.501 NA 0.508 0.000 0.000
#> SRR1040851     3  0.3649      0.827 NA 0.000 0.796 0.000
#> SRR1040850     3  0.3764      0.821 NA 0.000 0.784 0.000
#> SRR1040852     3  0.3831      0.825 NA 0.000 0.792 0.004
#> SRR1040853     3  0.3831      0.825 NA 0.000 0.792 0.004
#> SRR1040854     3  0.0000      0.795 NA 0.000 1.000 0.000
#> SRR1040855     3  0.3764      0.821 NA 0.000 0.784 0.000
#> SRR1040856     2  0.4431      0.362 NA 0.696 0.000 0.304
#> SRR1040857     3  0.0000      0.795 NA 0.000 1.000 0.000
#> SRR1040858     3  0.0000      0.795 NA 0.000 1.000 0.000
#> SRR1040859     2  0.4431      0.362 NA 0.696 0.000 0.304
#> SRR1040860     2  0.4431      0.362 NA 0.696 0.000 0.304
#> SRR1040861     3  0.3764      0.821 NA 0.000 0.784 0.000
#> SRR1040862     2  0.4454      0.360 NA 0.692 0.000 0.308
#> SRR1040863     2  0.4454      0.360 NA 0.692 0.000 0.308
#> SRR1040864     3  0.3764      0.821 NA 0.000 0.784 0.000
#> SRR1040865     3  0.4163      0.713 NA 0.000 0.828 0.076
#> SRR1040866     2  0.4431      0.362 NA 0.696 0.000 0.304
#> SRR1040867     3  0.3649      0.827 NA 0.000 0.796 0.000
#> SRR1040868     3  0.4163      0.713 NA 0.000 0.828 0.076
#> SRR1040869     3  0.0000      0.795 NA 0.000 1.000 0.000
#> SRR1040870     3  0.3649      0.827 NA 0.000 0.796 0.000
#> SRR1040871     3  0.0000      0.795 NA 0.000 1.000 0.000
#> SRR1040872     3  0.3649      0.827 NA 0.000 0.796 0.000
#> SRR1040873     2  0.4999      0.501 NA 0.508 0.000 0.000
#> SRR1040874     3  0.4163      0.713 NA 0.000 0.828 0.076
#> SRR1040875     3  0.3870      0.825 NA 0.000 0.788 0.004
#> SRR1040876     3  0.4163      0.713 NA 0.000 0.828 0.076
#> SRR1040877     3  0.3649      0.827 NA 0.000 0.796 0.000
#> SRR1040878     2  0.4584      0.361 NA 0.696 0.000 0.300
#> SRR1040879     2  0.0000      0.513 NA 1.000 0.000 0.000
#> SRR1040880     3  0.4163      0.713 NA 0.000 0.828 0.076
#> SRR1040881     2  0.0188      0.514 NA 0.996 0.000 0.000
#> SRR1040882     3  0.3649      0.827 NA 0.000 0.796 0.000
#> SRR1040883     3  0.0000      0.795 NA 0.000 1.000 0.000
#> SRR1040884     3  0.0336      0.793 NA 0.000 0.992 0.000
#> SRR1040885     3  0.3649      0.827 NA 0.000 0.796 0.000

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>            class entropy silhouette    p1    p2    p3    p4    p5
#> SRR1040814     3  0.0451     0.8764 0.008 0.000 0.988 0.000 0.004
#> SRR1040813     3  0.2300     0.8722 0.052 0.000 0.908 0.000 0.040
#> SRR1040816     1  0.2966     0.6086 0.816 0.000 0.000 0.184 0.000
#> SRR1040815     4  0.5145     0.5587 0.000 0.332 0.000 0.612 0.056
#> SRR1040817     3  0.0451     0.8764 0.008 0.000 0.988 0.000 0.004
#> SRR1040818     4  0.3983     0.3253 0.340 0.000 0.000 0.660 0.000
#> SRR1040819     4  0.5145     0.5587 0.000 0.332 0.000 0.612 0.056
#> SRR1040820     2  0.0000     0.9204 0.000 1.000 0.000 0.000 0.000
#> SRR1040821     2  0.0000     0.9204 0.000 1.000 0.000 0.000 0.000
#> SRR1040822     3  0.0324     0.8769 0.004 0.000 0.992 0.000 0.004
#> SRR1040823     3  0.1915     0.8732 0.032 0.000 0.928 0.000 0.040
#> SRR1040824     2  0.0000     0.9204 0.000 1.000 0.000 0.000 0.000
#> SRR1040826     3  0.0162     0.8753 0.000 0.000 0.996 0.000 0.004
#> SRR1040825     4  0.4744     0.6736 0.000 0.252 0.000 0.692 0.056
#> SRR1040827     2  0.0000     0.9204 0.000 1.000 0.000 0.000 0.000
#> SRR1040828     4  0.2446     0.7451 0.000 0.044 0.000 0.900 0.056
#> SRR1040829     2  0.4717     0.0617 0.000 0.584 0.000 0.396 0.020
#> SRR1040830     1  0.0000     0.7912 1.000 0.000 0.000 0.000 0.000
#> SRR1040831     1  0.3366     0.7646 0.784 0.000 0.212 0.000 0.004
#> SRR1040832     1  0.6808    -0.0430 0.360 0.000 0.340 0.300 0.000
#> SRR1040833     1  0.3086     0.7720 0.816 0.000 0.180 0.000 0.004
#> SRR1040834     1  0.6808    -0.0430 0.360 0.000 0.340 0.300 0.000
#> SRR1040835     4  0.4719     0.6759 0.000 0.248 0.000 0.696 0.056
#> SRR1040836     1  0.0000     0.7912 1.000 0.000 0.000 0.000 0.000
#> SRR1040837     2  0.1341     0.9041 0.000 0.944 0.000 0.000 0.056
#> SRR1040839     2  0.1341     0.9041 0.000 0.944 0.000 0.000 0.056
#> SRR1040838     3  0.4378     0.7375 0.216 0.000 0.740 0.004 0.040
#> SRR1040840     2  0.0000     0.9204 0.000 1.000 0.000 0.000 0.000
#> SRR1040841     1  0.0000     0.7912 1.000 0.000 0.000 0.000 0.000
#> SRR1040843     2  0.1341     0.9041 0.000 0.944 0.000 0.000 0.056
#> SRR1040842     5  0.2020     0.0000 0.000 0.000 0.000 0.100 0.900
#> SRR1040845     4  0.0000     0.7613 0.000 0.000 0.000 1.000 0.000
#> SRR1040844     1  0.0000     0.7912 1.000 0.000 0.000 0.000 0.000
#> SRR1040846     2  0.1341     0.9041 0.000 0.944 0.000 0.000 0.056
#> SRR1040847     1  0.0000     0.7912 1.000 0.000 0.000 0.000 0.000
#> SRR1040849     3  0.0671     0.8730 0.016 0.000 0.980 0.000 0.004
#> SRR1040848     2  0.0000     0.9204 0.000 1.000 0.000 0.000 0.000
#> SRR1040851     3  0.4341     0.1715 0.404 0.000 0.592 0.000 0.004
#> SRR1040850     3  0.2139     0.8695 0.032 0.000 0.916 0.000 0.052
#> SRR1040852     3  0.4378     0.7375 0.216 0.000 0.740 0.004 0.040
#> SRR1040853     3  0.4378     0.7375 0.216 0.000 0.740 0.004 0.040
#> SRR1040854     1  0.3366     0.7646 0.784 0.000 0.212 0.000 0.004
#> SRR1040855     3  0.2139     0.8695 0.032 0.000 0.916 0.000 0.052
#> SRR1040856     4  0.0000     0.7613 0.000 0.000 0.000 1.000 0.000
#> SRR1040857     1  0.3366     0.7646 0.784 0.000 0.212 0.000 0.004
#> SRR1040858     1  0.3366     0.7646 0.784 0.000 0.212 0.000 0.004
#> SRR1040859     4  0.0000     0.7613 0.000 0.000 0.000 1.000 0.000
#> SRR1040860     4  0.0000     0.7613 0.000 0.000 0.000 1.000 0.000
#> SRR1040861     3  0.2139     0.8695 0.032 0.000 0.916 0.000 0.052
#> SRR1040862     4  0.0162     0.7597 0.000 0.000 0.000 0.996 0.004
#> SRR1040863     4  0.0162     0.7597 0.000 0.000 0.000 0.996 0.004
#> SRR1040864     3  0.2139     0.8695 0.032 0.000 0.916 0.000 0.052
#> SRR1040865     1  0.0000     0.7912 1.000 0.000 0.000 0.000 0.000
#> SRR1040866     4  0.0000     0.7613 0.000 0.000 0.000 1.000 0.000
#> SRR1040867     3  0.2077     0.8759 0.040 0.000 0.920 0.000 0.040
#> SRR1040868     1  0.0000     0.7912 1.000 0.000 0.000 0.000 0.000
#> SRR1040869     1  0.3366     0.7646 0.784 0.000 0.212 0.000 0.004
#> SRR1040870     3  0.0451     0.8764 0.008 0.000 0.988 0.000 0.004
#> SRR1040871     1  0.3366     0.7646 0.784 0.000 0.212 0.000 0.004
#> SRR1040872     3  0.2077     0.8759 0.040 0.000 0.920 0.000 0.040
#> SRR1040873     2  0.0000     0.9204 0.000 1.000 0.000 0.000 0.000
#> SRR1040874     1  0.0000     0.7912 1.000 0.000 0.000 0.000 0.000
#> SRR1040875     3  0.4365     0.7281 0.224 0.000 0.736 0.004 0.036
#> SRR1040876     1  0.0000     0.7912 1.000 0.000 0.000 0.000 0.000
#> SRR1040877     3  0.0451     0.8764 0.008 0.000 0.988 0.000 0.004
#> SRR1040878     4  0.0162     0.7599 0.004 0.000 0.000 0.996 0.000
#> SRR1040879     4  0.4719     0.6759 0.000 0.248 0.000 0.696 0.056
#> SRR1040880     1  0.0000     0.7912 1.000 0.000 0.000 0.000 0.000
#> SRR1040881     4  0.4744     0.6736 0.000 0.252 0.000 0.692 0.056
#> SRR1040882     3  0.0880     0.8767 0.032 0.000 0.968 0.000 0.000
#> SRR1040883     1  0.3366     0.7646 0.784 0.000 0.212 0.000 0.004
#> SRR1040884     1  0.3086     0.7720 0.816 0.000 0.180 0.000 0.004
#> SRR1040885     3  0.0162     0.8753 0.000 0.000 0.996 0.000 0.004

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>            class entropy silhouette    p1    p2    p3    p4    p5    p6
#> SRR1040814     3  0.2902      0.788 0.004 0.000 0.800 0.000 0.196 0.000
#> SRR1040813     3  0.0790      0.794 0.032 0.000 0.968 0.000 0.000 0.000
#> SRR1040816     1  0.3172      0.535 0.816 0.000 0.000 0.148 0.000 0.036
#> SRR1040815     6  0.4461      0.767 0.000 0.104 0.000 0.192 0.000 0.704
#> SRR1040817     3  0.2902      0.788 0.004 0.000 0.800 0.000 0.196 0.000
#> SRR1040818     6  0.6095      0.131 0.340 0.000 0.000 0.284 0.000 0.376
#> SRR1040819     6  0.4461      0.767 0.000 0.104 0.000 0.192 0.000 0.704
#> SRR1040820     2  0.0000      0.905 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR1040821     2  0.0000      0.905 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR1040822     3  0.2697      0.791 0.000 0.000 0.812 0.000 0.188 0.000
#> SRR1040823     3  0.0363      0.797 0.012 0.000 0.988 0.000 0.000 0.000
#> SRR1040824     2  0.0000      0.905 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR1040826     3  0.2730      0.789 0.000 0.000 0.808 0.000 0.192 0.000
#> SRR1040825     6  0.3855      0.807 0.000 0.024 0.000 0.272 0.000 0.704
#> SRR1040827     2  0.0000      0.905 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR1040828     4  0.3869     -0.433 0.000 0.000 0.000 0.500 0.000 0.500
#> SRR1040829     2  0.4468      0.180 0.000 0.560 0.000 0.032 0.000 0.408
#> SRR1040830     1  0.0000      0.711 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR1040831     1  0.4273      0.613 0.596 0.000 0.024 0.000 0.380 0.000
#> SRR1040832     1  0.6730     -0.140 0.360 0.000 0.340 0.264 0.000 0.036
#> SRR1040833     1  0.2912      0.681 0.816 0.000 0.012 0.000 0.172 0.000
#> SRR1040834     1  0.6730     -0.140 0.360 0.000 0.340 0.264 0.000 0.036
#> SRR1040835     6  0.3799      0.804 0.000 0.020 0.000 0.276 0.000 0.704
#> SRR1040836     1  0.1556      0.699 0.920 0.000 0.000 0.000 0.080 0.000
#> SRR1040837     2  0.1814      0.874 0.000 0.900 0.000 0.000 0.000 0.100
#> SRR1040839     2  0.1814      0.874 0.000 0.900 0.000 0.000 0.000 0.100
#> SRR1040838     3  0.2902      0.678 0.196 0.000 0.800 0.004 0.000 0.000
#> SRR1040840     2  0.0000      0.905 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR1040841     1  0.0000      0.711 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR1040843     2  0.1814      0.874 0.000 0.900 0.000 0.000 0.000 0.100
#> SRR1040842     5  0.4905      0.000 0.000 0.000 0.000 0.096 0.620 0.284
#> SRR1040845     4  0.0000      0.908 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR1040844     1  0.0000      0.711 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR1040846     2  0.1814      0.874 0.000 0.900 0.000 0.000 0.000 0.100
#> SRR1040847     1  0.0000      0.711 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR1040849     3  0.3110      0.782 0.012 0.000 0.792 0.000 0.196 0.000
#> SRR1040848     2  0.0000      0.905 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR1040851     3  0.6044      0.125 0.260 0.000 0.404 0.000 0.336 0.000
#> SRR1040850     3  0.0725      0.794 0.012 0.000 0.976 0.000 0.000 0.012
#> SRR1040852     3  0.2902      0.678 0.196 0.000 0.800 0.004 0.000 0.000
#> SRR1040853     3  0.2902      0.678 0.196 0.000 0.800 0.004 0.000 0.000
#> SRR1040854     1  0.4273      0.613 0.596 0.000 0.024 0.000 0.380 0.000
#> SRR1040855     3  0.0725      0.794 0.012 0.000 0.976 0.000 0.000 0.012
#> SRR1040856     4  0.0000      0.908 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR1040857     1  0.4273      0.613 0.596 0.000 0.024 0.000 0.380 0.000
#> SRR1040858     1  0.4273      0.613 0.596 0.000 0.024 0.000 0.380 0.000
#> SRR1040859     4  0.0000      0.908 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR1040860     4  0.0000      0.908 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR1040861     3  0.0725      0.794 0.012 0.000 0.976 0.000 0.000 0.012
#> SRR1040862     4  0.0146      0.905 0.000 0.000 0.000 0.996 0.000 0.004
#> SRR1040863     4  0.0146      0.905 0.000 0.000 0.000 0.996 0.000 0.004
#> SRR1040864     3  0.0725      0.794 0.012 0.000 0.976 0.000 0.000 0.012
#> SRR1040865     1  0.0000      0.711 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR1040866     4  0.0000      0.908 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR1040867     3  0.0603      0.799 0.016 0.000 0.980 0.000 0.004 0.000
#> SRR1040868     1  0.0000      0.711 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR1040869     1  0.4273      0.613 0.596 0.000 0.024 0.000 0.380 0.000
#> SRR1040870     3  0.2902      0.788 0.004 0.000 0.800 0.000 0.196 0.000
#> SRR1040871     1  0.4273      0.613 0.596 0.000 0.024 0.000 0.380 0.000
#> SRR1040872     3  0.0603      0.799 0.016 0.000 0.980 0.000 0.004 0.000
#> SRR1040873     2  0.0000      0.905 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR1040874     1  0.0000      0.711 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR1040875     3  0.2964      0.670 0.204 0.000 0.792 0.004 0.000 0.000
#> SRR1040876     1  0.0000      0.711 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR1040877     3  0.2902      0.788 0.004 0.000 0.800 0.000 0.196 0.000
#> SRR1040878     4  0.0146      0.904 0.004 0.000 0.000 0.996 0.000 0.000
#> SRR1040879     6  0.3799      0.804 0.000 0.020 0.000 0.276 0.000 0.704
#> SRR1040880     1  0.1556      0.699 0.920 0.000 0.000 0.000 0.080 0.000
#> SRR1040881     6  0.3855      0.807 0.000 0.024 0.000 0.272 0.000 0.704
#> SRR1040882     3  0.3202      0.791 0.024 0.000 0.800 0.000 0.176 0.000
#> SRR1040883     1  0.4273      0.613 0.596 0.000 0.024 0.000 0.380 0.000
#> SRR1040884     1  0.2912      0.681 0.816 0.000 0.012 0.000 0.172 0.000
#> SRR1040885     3  0.2730      0.789 0.000 0.000 0.808 0.000 0.192 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 15258 rows and 73 columns.
#>   Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'MAD' method.
#>   Subgroups are detected by 'kmeans' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 2.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

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

collect_plots(res)

plot of chunk MAD-kmeans-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 1.000           0.976       0.990         0.4855 0.514   0.514
#> 3 3 0.576           0.535       0.762         0.3543 0.743   0.533
#> 4 4 0.653           0.722       0.827         0.1381 0.874   0.638
#> 5 5 0.741           0.678       0.763         0.0669 0.894   0.608
#> 6 6 0.773           0.703       0.783         0.0384 0.910   0.595

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
#> SRR1040814     1   0.000      0.992 1.000 0.000
#> SRR1040813     1   0.000      0.992 1.000 0.000
#> SRR1040816     1   0.000      0.992 1.000 0.000
#> SRR1040815     2   0.000      0.986 0.000 1.000
#> SRR1040817     1   0.000      0.992 1.000 0.000
#> SRR1040818     2   0.000      0.986 0.000 1.000
#> SRR1040819     2   0.000      0.986 0.000 1.000
#> SRR1040820     2   0.000      0.986 0.000 1.000
#> SRR1040821     2   0.000      0.986 0.000 1.000
#> SRR1040822     1   0.000      0.992 1.000 0.000
#> SRR1040823     1   0.000      0.992 1.000 0.000
#> SRR1040824     2   0.000      0.986 0.000 1.000
#> SRR1040826     1   0.000      0.992 1.000 0.000
#> SRR1040825     2   0.000      0.986 0.000 1.000
#> SRR1040827     2   0.000      0.986 0.000 1.000
#> SRR1040828     2   0.000      0.986 0.000 1.000
#> SRR1040829     2   0.000      0.986 0.000 1.000
#> SRR1040830     1   0.000      0.992 1.000 0.000
#> SRR1040831     1   0.000      0.992 1.000 0.000
#> SRR1040832     2   0.866      0.596 0.288 0.712
#> SRR1040833     1   0.000      0.992 1.000 0.000
#> SRR1040834     1   0.000      0.992 1.000 0.000
#> SRR1040835     2   0.000      0.986 0.000 1.000
#> SRR1040836     1   0.000      0.992 1.000 0.000
#> SRR1040837     2   0.000      0.986 0.000 1.000
#> SRR1040839     2   0.000      0.986 0.000 1.000
#> SRR1040838     1   0.000      0.992 1.000 0.000
#> SRR1040840     2   0.000      0.986 0.000 1.000
#> SRR1040841     1   0.000      0.992 1.000 0.000
#> SRR1040843     2   0.000      0.986 0.000 1.000
#> SRR1040842     2   0.000      0.986 0.000 1.000
#> SRR1040845     2   0.000      0.986 0.000 1.000
#> SRR1040844     1   0.000      0.992 1.000 0.000
#> SRR1040846     2   0.000      0.986 0.000 1.000
#> SRR1040847     1   0.000      0.992 1.000 0.000
#> SRR1040849     1   0.000      0.992 1.000 0.000
#> SRR1040848     2   0.000      0.986 0.000 1.000
#> SRR1040851     1   0.000      0.992 1.000 0.000
#> SRR1040850     1   0.000      0.992 1.000 0.000
#> SRR1040852     1   0.000      0.992 1.000 0.000
#> SRR1040853     1   0.000      0.992 1.000 0.000
#> SRR1040854     1   0.000      0.992 1.000 0.000
#> SRR1040855     1   0.000      0.992 1.000 0.000
#> SRR1040856     2   0.000      0.986 0.000 1.000
#> SRR1040857     1   0.000      0.992 1.000 0.000
#> SRR1040858     1   0.000      0.992 1.000 0.000
#> SRR1040859     2   0.000      0.986 0.000 1.000
#> SRR1040860     2   0.000      0.986 0.000 1.000
#> SRR1040861     1   0.000      0.992 1.000 0.000
#> SRR1040862     2   0.000      0.986 0.000 1.000
#> SRR1040863     2   0.000      0.986 0.000 1.000
#> SRR1040864     1   0.000      0.992 1.000 0.000
#> SRR1040865     1   0.000      0.992 1.000 0.000
#> SRR1040866     2   0.482      0.878 0.104 0.896
#> SRR1040867     1   0.000      0.992 1.000 0.000
#> SRR1040868     1   0.000      0.992 1.000 0.000
#> SRR1040869     1   0.000      0.992 1.000 0.000
#> SRR1040870     1   0.000      0.992 1.000 0.000
#> SRR1040871     1   0.000      0.992 1.000 0.000
#> SRR1040872     1   0.000      0.992 1.000 0.000
#> SRR1040873     2   0.000      0.986 0.000 1.000
#> SRR1040874     1   0.000      0.992 1.000 0.000
#> SRR1040875     1   0.000      0.992 1.000 0.000
#> SRR1040876     1   0.000      0.992 1.000 0.000
#> SRR1040877     1   0.000      0.992 1.000 0.000
#> SRR1040878     1   0.904      0.520 0.680 0.320
#> SRR1040879     2   0.000      0.986 0.000 1.000
#> SRR1040880     1   0.000      0.992 1.000 0.000
#> SRR1040881     2   0.000      0.986 0.000 1.000
#> SRR1040882     1   0.000      0.992 1.000 0.000
#> SRR1040883     1   0.000      0.992 1.000 0.000
#> SRR1040884     1   0.000      0.992 1.000 0.000
#> SRR1040885     1   0.000      0.992 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
#> SRR1040814     3  0.6286     0.1663 0.464 0.000 0.536
#> SRR1040813     3  0.6252     0.2218 0.444 0.000 0.556
#> SRR1040816     1  0.4121     0.5365 0.832 0.000 0.168
#> SRR1040815     2  0.1163     0.8470 0.000 0.972 0.028
#> SRR1040817     3  0.6286     0.1663 0.464 0.000 0.536
#> SRR1040818     3  0.9512    -0.2939 0.188 0.384 0.428
#> SRR1040819     2  0.1163     0.8470 0.000 0.972 0.028
#> SRR1040820     2  0.0000     0.8521 0.000 1.000 0.000
#> SRR1040821     2  0.0000     0.8521 0.000 1.000 0.000
#> SRR1040822     3  0.6286     0.1663 0.464 0.000 0.536
#> SRR1040823     3  0.6079     0.3448 0.388 0.000 0.612
#> SRR1040824     2  0.0424     0.8505 0.000 0.992 0.008
#> SRR1040826     3  0.6215     0.2270 0.428 0.000 0.572
#> SRR1040825     2  0.1163     0.8470 0.000 0.972 0.028
#> SRR1040827     2  0.0424     0.8505 0.000 0.992 0.008
#> SRR1040828     2  0.6180     0.5867 0.000 0.584 0.416
#> SRR1040829     2  0.0000     0.8521 0.000 1.000 0.000
#> SRR1040830     1  0.1753     0.7272 0.952 0.000 0.048
#> SRR1040831     1  0.4121     0.7304 0.832 0.000 0.168
#> SRR1040832     3  0.9672    -0.1349 0.240 0.304 0.456
#> SRR1040833     1  0.0000     0.7849 1.000 0.000 0.000
#> SRR1040834     3  0.5058     0.3643 0.244 0.000 0.756
#> SRR1040835     2  0.4555     0.7603 0.000 0.800 0.200
#> SRR1040836     1  0.0237     0.7854 0.996 0.000 0.004
#> SRR1040837     2  0.0000     0.8521 0.000 1.000 0.000
#> SRR1040839     2  0.0000     0.8521 0.000 1.000 0.000
#> SRR1040838     3  0.4605     0.4017 0.204 0.000 0.796
#> SRR1040840     2  0.0000     0.8521 0.000 1.000 0.000
#> SRR1040841     1  0.0237     0.7854 0.996 0.000 0.004
#> SRR1040843     2  0.0000     0.8521 0.000 1.000 0.000
#> SRR1040842     2  0.6235     0.5494 0.000 0.564 0.436
#> SRR1040845     2  0.8387     0.4387 0.084 0.488 0.428
#> SRR1040844     1  0.0237     0.7854 0.996 0.000 0.004
#> SRR1040846     2  0.0000     0.8521 0.000 1.000 0.000
#> SRR1040847     1  0.0237     0.7854 0.996 0.000 0.004
#> SRR1040849     3  0.6267     0.1929 0.452 0.000 0.548
#> SRR1040848     2  0.0424     0.8505 0.000 0.992 0.008
#> SRR1040851     1  0.4931     0.6795 0.768 0.000 0.232
#> SRR1040850     3  0.4504     0.4050 0.196 0.000 0.804
#> SRR1040852     3  0.5529     0.3910 0.296 0.000 0.704
#> SRR1040853     3  0.5529     0.3910 0.296 0.000 0.704
#> SRR1040854     1  0.4931     0.6795 0.768 0.000 0.232
#> SRR1040855     3  0.4931     0.3861 0.232 0.000 0.768
#> SRR1040856     2  0.6180     0.5751 0.000 0.584 0.416
#> SRR1040857     1  0.4931     0.6795 0.768 0.000 0.232
#> SRR1040858     1  0.4504     0.7158 0.804 0.000 0.196
#> SRR1040859     3  0.9068    -0.3545 0.136 0.420 0.444
#> SRR1040860     2  0.6192     0.5707 0.000 0.580 0.420
#> SRR1040861     3  0.4605     0.3798 0.204 0.000 0.796
#> SRR1040862     2  0.6126     0.5907 0.000 0.600 0.400
#> SRR1040863     2  0.6192     0.5707 0.000 0.580 0.420
#> SRR1040864     3  0.4504     0.4050 0.196 0.000 0.804
#> SRR1040865     1  0.5591     0.2423 0.696 0.000 0.304
#> SRR1040866     3  0.9374    -0.2342 0.176 0.360 0.464
#> SRR1040867     3  0.6274     0.1847 0.456 0.000 0.544
#> SRR1040868     1  0.0237     0.7854 0.996 0.000 0.004
#> SRR1040869     1  0.4931     0.6795 0.768 0.000 0.232
#> SRR1040870     3  0.6286     0.1663 0.464 0.000 0.536
#> SRR1040871     1  0.4452     0.7188 0.808 0.000 0.192
#> SRR1040872     3  0.6215     0.2270 0.428 0.000 0.572
#> SRR1040873     2  0.0000     0.8521 0.000 1.000 0.000
#> SRR1040874     1  0.0237     0.7854 0.996 0.000 0.004
#> SRR1040875     3  0.6192     0.3317 0.420 0.000 0.580
#> SRR1040876     1  0.0237     0.7854 0.996 0.000 0.004
#> SRR1040877     3  0.6267     0.1929 0.452 0.000 0.548
#> SRR1040878     3  0.9528    -0.0612 0.240 0.272 0.488
#> SRR1040879     2  0.1163     0.8470 0.000 0.972 0.028
#> SRR1040880     1  0.0237     0.7854 0.996 0.000 0.004
#> SRR1040881     2  0.1163     0.8470 0.000 0.972 0.028
#> SRR1040882     3  0.6267     0.1929 0.452 0.000 0.548
#> SRR1040883     1  0.4452     0.7188 0.808 0.000 0.192
#> SRR1040884     1  0.3752     0.7432 0.856 0.000 0.144
#> SRR1040885     3  0.6215     0.2270 0.428 0.000 0.572

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> SRR1040814     3  0.2741      0.713 0.096 0.000 0.892 0.012
#> SRR1040813     3  0.5579      0.646 0.252 0.000 0.688 0.060
#> SRR1040816     1  0.2111      0.737 0.932 0.000 0.024 0.044
#> SRR1040815     2  0.2840      0.893 0.000 0.900 0.056 0.044
#> SRR1040817     3  0.2741      0.713 0.096 0.000 0.892 0.012
#> SRR1040818     4  0.4419      0.799 0.088 0.012 0.072 0.828
#> SRR1040819     2  0.2840      0.893 0.000 0.900 0.056 0.044
#> SRR1040820     2  0.0336      0.935 0.000 0.992 0.000 0.008
#> SRR1040821     2  0.0336      0.935 0.000 0.992 0.000 0.008
#> SRR1040822     3  0.2741      0.713 0.096 0.000 0.892 0.012
#> SRR1040823     3  0.6240      0.643 0.200 0.000 0.664 0.136
#> SRR1040824     2  0.0188      0.933 0.000 0.996 0.000 0.004
#> SRR1040826     3  0.3796      0.735 0.096 0.000 0.848 0.056
#> SRR1040825     2  0.5870      0.637 0.004 0.684 0.072 0.240
#> SRR1040827     2  0.0188      0.933 0.000 0.996 0.000 0.004
#> SRR1040828     4  0.4131      0.820 0.004 0.096 0.064 0.836
#> SRR1040829     2  0.0336      0.935 0.000 0.992 0.000 0.008
#> SRR1040830     1  0.1297      0.766 0.964 0.000 0.020 0.016
#> SRR1040831     1  0.4464      0.677 0.768 0.000 0.208 0.024
#> SRR1040832     4  0.3333      0.809 0.088 0.000 0.040 0.872
#> SRR1040833     1  0.0188      0.785 0.996 0.000 0.004 0.000
#> SRR1040834     4  0.4964      0.630 0.256 0.000 0.028 0.716
#> SRR1040835     4  0.5607      0.663 0.004 0.208 0.072 0.716
#> SRR1040836     1  0.0524      0.787 0.988 0.000 0.004 0.008
#> SRR1040837     2  0.1837      0.921 0.000 0.944 0.028 0.028
#> SRR1040839     2  0.0336      0.935 0.000 0.992 0.000 0.008
#> SRR1040838     3  0.7451      0.281 0.172 0.000 0.416 0.412
#> SRR1040840     2  0.0336      0.935 0.000 0.992 0.000 0.008
#> SRR1040841     1  0.0524      0.787 0.988 0.000 0.004 0.008
#> SRR1040843     2  0.0336      0.935 0.000 0.992 0.000 0.008
#> SRR1040842     4  0.2924      0.844 0.000 0.100 0.016 0.884
#> SRR1040845     4  0.2810      0.853 0.008 0.088 0.008 0.896
#> SRR1040844     1  0.0524      0.787 0.988 0.000 0.004 0.008
#> SRR1040846     2  0.1284      0.929 0.000 0.964 0.024 0.012
#> SRR1040847     1  0.0524      0.787 0.988 0.000 0.004 0.008
#> SRR1040849     3  0.2281      0.720 0.096 0.000 0.904 0.000
#> SRR1040848     2  0.0000      0.934 0.000 1.000 0.000 0.000
#> SRR1040851     1  0.5643      0.465 0.548 0.000 0.428 0.024
#> SRR1040850     3  0.7421      0.310 0.168 0.000 0.432 0.400
#> SRR1040852     3  0.7451      0.281 0.172 0.000 0.416 0.412
#> SRR1040853     3  0.7451      0.281 0.172 0.000 0.416 0.412
#> SRR1040854     1  0.5643      0.465 0.548 0.000 0.428 0.024
#> SRR1040855     3  0.6231      0.645 0.184 0.000 0.668 0.148
#> SRR1040856     4  0.3088      0.847 0.000 0.128 0.008 0.864
#> SRR1040857     1  0.5643      0.465 0.548 0.000 0.428 0.024
#> SRR1040858     1  0.5436      0.562 0.620 0.000 0.356 0.024
#> SRR1040859     4  0.2673      0.854 0.008 0.080 0.008 0.904
#> SRR1040860     4  0.3088      0.847 0.000 0.128 0.008 0.864
#> SRR1040861     3  0.3999      0.710 0.036 0.000 0.824 0.140
#> SRR1040862     4  0.3335      0.845 0.000 0.128 0.016 0.856
#> SRR1040863     4  0.3335      0.845 0.000 0.128 0.016 0.856
#> SRR1040864     4  0.6407     -0.169 0.068 0.000 0.412 0.520
#> SRR1040865     1  0.4245      0.567 0.784 0.000 0.020 0.196
#> SRR1040866     4  0.1721      0.828 0.012 0.028 0.008 0.952
#> SRR1040867     3  0.3182      0.730 0.096 0.000 0.876 0.028
#> SRR1040868     1  0.0804      0.781 0.980 0.000 0.012 0.008
#> SRR1040869     1  0.5643      0.465 0.548 0.000 0.428 0.024
#> SRR1040870     3  0.2741      0.713 0.096 0.000 0.892 0.012
#> SRR1040871     1  0.5184      0.616 0.672 0.000 0.304 0.024
#> SRR1040872     3  0.3745      0.734 0.088 0.000 0.852 0.060
#> SRR1040873     2  0.0336      0.935 0.000 0.992 0.000 0.008
#> SRR1040874     1  0.0524      0.787 0.988 0.000 0.004 0.008
#> SRR1040875     3  0.7671      0.464 0.300 0.000 0.456 0.244
#> SRR1040876     1  0.0524      0.787 0.988 0.000 0.004 0.008
#> SRR1040877     3  0.2466      0.718 0.096 0.000 0.900 0.004
#> SRR1040878     4  0.2345      0.803 0.100 0.000 0.000 0.900
#> SRR1040879     2  0.3247      0.881 0.000 0.880 0.060 0.060
#> SRR1040880     1  0.0524      0.787 0.988 0.000 0.004 0.008
#> SRR1040881     2  0.5870      0.637 0.004 0.684 0.072 0.240
#> SRR1040882     3  0.3372      0.732 0.096 0.000 0.868 0.036
#> SRR1040883     1  0.5184      0.616 0.672 0.000 0.304 0.024
#> SRR1040884     1  0.0469      0.783 0.988 0.000 0.012 0.000
#> SRR1040885     3  0.3796      0.735 0.096 0.000 0.848 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
#> SRR1040814     3  0.4318     0.4899 0.004 0.000 0.644 0.004 0.348
#> SRR1040813     5  0.3301     0.6600 0.072 0.000 0.080 0.000 0.848
#> SRR1040816     1  0.1205     0.8720 0.956 0.000 0.040 0.000 0.004
#> SRR1040815     2  0.5953     0.6785 0.000 0.660 0.204 0.048 0.088
#> SRR1040817     3  0.4318     0.4899 0.004 0.000 0.644 0.004 0.348
#> SRR1040818     4  0.7195     0.6062 0.108 0.004 0.240 0.552 0.096
#> SRR1040819     2  0.5506     0.6989 0.000 0.692 0.204 0.048 0.056
#> SRR1040820     2  0.0162     0.8609 0.000 0.996 0.000 0.004 0.000
#> SRR1040821     2  0.0162     0.8609 0.000 0.996 0.000 0.004 0.000
#> SRR1040822     3  0.4414     0.4449 0.004 0.000 0.616 0.004 0.376
#> SRR1040823     5  0.3002     0.6771 0.068 0.000 0.048 0.008 0.876
#> SRR1040824     2  0.0000     0.8606 0.000 1.000 0.000 0.000 0.000
#> SRR1040826     5  0.4490     0.1809 0.004 0.000 0.404 0.004 0.588
#> SRR1040825     2  0.7838     0.3067 0.000 0.432 0.236 0.244 0.088
#> SRR1040827     2  0.0000     0.8606 0.000 1.000 0.000 0.000 0.000
#> SRR1040828     4  0.5040     0.7145 0.000 0.008 0.192 0.712 0.088
#> SRR1040829     2  0.0162     0.8609 0.000 0.996 0.000 0.004 0.000
#> SRR1040830     1  0.0794     0.8832 0.972 0.000 0.028 0.000 0.000
#> SRR1040831     1  0.3966     0.3001 0.664 0.000 0.336 0.000 0.000
#> SRR1040832     4  0.6688     0.6592 0.096 0.000 0.216 0.600 0.088
#> SRR1040833     1  0.0162     0.8968 0.996 0.000 0.004 0.000 0.000
#> SRR1040834     1  0.7348    -0.0779 0.416 0.000 0.040 0.200 0.344
#> SRR1040835     4  0.7150     0.5061 0.000 0.128 0.240 0.544 0.088
#> SRR1040836     1  0.0000     0.8992 1.000 0.000 0.000 0.000 0.000
#> SRR1040837     2  0.2958     0.8217 0.000 0.880 0.020 0.024 0.076
#> SRR1040839     2  0.0162     0.8609 0.000 0.996 0.000 0.004 0.000
#> SRR1040838     5  0.4755     0.6719 0.072 0.000 0.012 0.172 0.744
#> SRR1040840     2  0.0162     0.8609 0.000 0.996 0.000 0.004 0.000
#> SRR1040841     1  0.0000     0.8992 1.000 0.000 0.000 0.000 0.000
#> SRR1040843     2  0.0324     0.8599 0.000 0.992 0.000 0.004 0.004
#> SRR1040842     4  0.3387     0.7382 0.000 0.008 0.024 0.836 0.132
#> SRR1040845     4  0.0727     0.8466 0.004 0.004 0.000 0.980 0.012
#> SRR1040844     1  0.0000     0.8992 1.000 0.000 0.000 0.000 0.000
#> SRR1040846     2  0.2037     0.8384 0.000 0.920 0.004 0.012 0.064
#> SRR1040847     1  0.0000     0.8992 1.000 0.000 0.000 0.000 0.000
#> SRR1040849     3  0.4621     0.3427 0.004 0.000 0.576 0.008 0.412
#> SRR1040848     2  0.0000     0.8606 0.000 1.000 0.000 0.000 0.000
#> SRR1040851     3  0.4503     0.6778 0.268 0.000 0.700 0.004 0.028
#> SRR1040850     5  0.4623     0.6639 0.040 0.000 0.024 0.184 0.752
#> SRR1040852     5  0.4755     0.6719 0.072 0.000 0.012 0.172 0.744
#> SRR1040853     5  0.4755     0.6719 0.072 0.000 0.012 0.172 0.744
#> SRR1040854     3  0.4397     0.6775 0.276 0.000 0.696 0.000 0.028
#> SRR1040855     5  0.3178     0.6812 0.036 0.000 0.068 0.024 0.872
#> SRR1040856     4  0.1087     0.8464 0.000 0.008 0.008 0.968 0.016
#> SRR1040857     3  0.4397     0.6775 0.276 0.000 0.696 0.000 0.028
#> SRR1040858     3  0.4213     0.6415 0.308 0.000 0.680 0.000 0.012
#> SRR1040859     4  0.0833     0.8459 0.004 0.004 0.000 0.976 0.016
#> SRR1040860     4  0.1186     0.8458 0.000 0.008 0.008 0.964 0.020
#> SRR1040861     5  0.2761     0.6620 0.000 0.000 0.104 0.024 0.872
#> SRR1040862     4  0.1280     0.8454 0.000 0.008 0.008 0.960 0.024
#> SRR1040863     4  0.1483     0.8428 0.000 0.008 0.012 0.952 0.028
#> SRR1040864     5  0.4820     0.4971 0.012 0.000 0.024 0.300 0.664
#> SRR1040865     1  0.3325     0.7682 0.852 0.000 0.032 0.104 0.012
#> SRR1040866     4  0.0771     0.8443 0.004 0.000 0.000 0.976 0.020
#> SRR1040867     5  0.4359     0.1315 0.004 0.000 0.412 0.000 0.584
#> SRR1040868     1  0.0290     0.8958 0.992 0.000 0.008 0.000 0.000
#> SRR1040869     3  0.4397     0.6775 0.276 0.000 0.696 0.000 0.028
#> SRR1040870     3  0.4318     0.4899 0.004 0.000 0.644 0.004 0.348
#> SRR1040871     3  0.4088     0.5477 0.368 0.000 0.632 0.000 0.000
#> SRR1040872     5  0.3160     0.5797 0.004 0.000 0.188 0.000 0.808
#> SRR1040873     2  0.0162     0.8609 0.000 0.996 0.000 0.004 0.000
#> SRR1040874     1  0.0000     0.8992 1.000 0.000 0.000 0.000 0.000
#> SRR1040875     5  0.4749     0.6613 0.116 0.000 0.012 0.116 0.756
#> SRR1040876     1  0.0000     0.8992 1.000 0.000 0.000 0.000 0.000
#> SRR1040877     3  0.4460     0.4117 0.004 0.000 0.600 0.004 0.392
#> SRR1040878     4  0.2067     0.8290 0.012 0.000 0.028 0.928 0.032
#> SRR1040879     2  0.6196     0.6604 0.000 0.640 0.212 0.060 0.088
#> SRR1040880     1  0.0000     0.8992 1.000 0.000 0.000 0.000 0.000
#> SRR1040881     2  0.7808     0.3232 0.000 0.440 0.232 0.240 0.088
#> SRR1040882     5  0.4490     0.1809 0.004 0.000 0.404 0.004 0.588
#> SRR1040883     3  0.4088     0.5477 0.368 0.000 0.632 0.000 0.000
#> SRR1040884     1  0.0162     0.8968 0.996 0.000 0.004 0.000 0.000
#> SRR1040885     5  0.4490     0.1809 0.004 0.000 0.404 0.004 0.588

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>            class entropy silhouette    p1    p2    p3    p4    p5    p6
#> SRR1040814     3  0.0291     0.5857 0.000 0.000 0.992 0.000 0.004 0.004
#> SRR1040813     5  0.4897     0.5676 0.028 0.000 0.416 0.000 0.536 0.020
#> SRR1040816     1  0.2318     0.8489 0.892 0.000 0.000 0.000 0.064 0.044
#> SRR1040815     6  0.4924     0.5106 0.000 0.372 0.000 0.040 0.016 0.572
#> SRR1040817     3  0.0146     0.5846 0.000 0.000 0.996 0.000 0.004 0.000
#> SRR1040818     6  0.5422     0.5530 0.060 0.000 0.000 0.280 0.048 0.612
#> SRR1040819     6  0.5016     0.4162 0.000 0.424 0.000 0.040 0.016 0.520
#> SRR1040820     2  0.0291     0.9411 0.000 0.992 0.000 0.004 0.004 0.000
#> SRR1040821     2  0.0291     0.9411 0.000 0.992 0.000 0.004 0.004 0.000
#> SRR1040822     3  0.0622     0.5771 0.000 0.000 0.980 0.000 0.012 0.008
#> SRR1040823     5  0.4436     0.7171 0.028 0.000 0.272 0.000 0.680 0.020
#> SRR1040824     2  0.0820     0.9318 0.000 0.972 0.000 0.000 0.012 0.016
#> SRR1040826     3  0.3200     0.3273 0.000 0.000 0.788 0.000 0.196 0.016
#> SRR1040825     6  0.5188     0.7054 0.000 0.204 0.000 0.160 0.004 0.632
#> SRR1040827     2  0.0820     0.9318 0.000 0.972 0.000 0.000 0.012 0.016
#> SRR1040828     6  0.5031     0.3166 0.000 0.004 0.000 0.460 0.060 0.476
#> SRR1040829     2  0.0547     0.9369 0.000 0.980 0.000 0.000 0.020 0.000
#> SRR1040830     1  0.1865     0.8708 0.920 0.000 0.000 0.000 0.040 0.040
#> SRR1040831     1  0.6460     0.1678 0.528 0.000 0.160 0.000 0.068 0.244
#> SRR1040832     6  0.6350     0.4191 0.060 0.000 0.000 0.328 0.120 0.492
#> SRR1040833     1  0.0000     0.9214 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR1040834     5  0.6617     0.0681 0.412 0.000 0.044 0.044 0.432 0.068
#> SRR1040835     6  0.5309     0.6279 0.000 0.072 0.000 0.276 0.032 0.620
#> SRR1040836     1  0.0458     0.9166 0.984 0.000 0.000 0.000 0.000 0.016
#> SRR1040837     2  0.3958     0.6622 0.000 0.768 0.000 0.044 0.016 0.172
#> SRR1040839     2  0.0508     0.9397 0.000 0.984 0.000 0.004 0.012 0.000
#> SRR1040838     5  0.4467     0.7652 0.032 0.000 0.104 0.080 0.772 0.012
#> SRR1040840     2  0.0291     0.9411 0.000 0.992 0.000 0.004 0.004 0.000
#> SRR1040841     1  0.0000     0.9214 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR1040843     2  0.0692     0.9376 0.000 0.976 0.000 0.004 0.020 0.000
#> SRR1040842     4  0.3718     0.7353 0.000 0.004 0.000 0.780 0.164 0.052
#> SRR1040845     4  0.0993     0.9123 0.000 0.000 0.000 0.964 0.024 0.012
#> SRR1040844     1  0.0000     0.9214 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR1040846     2  0.3391     0.7435 0.000 0.812 0.000 0.024 0.016 0.148
#> SRR1040847     1  0.0000     0.9214 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR1040849     3  0.1719     0.5387 0.000 0.000 0.924 0.000 0.060 0.016
#> SRR1040848     2  0.0405     0.9385 0.000 0.988 0.000 0.000 0.008 0.004
#> SRR1040851     3  0.6716     0.5481 0.180 0.000 0.480 0.000 0.072 0.268
#> SRR1040850     5  0.4568     0.7495 0.020 0.000 0.104 0.080 0.768 0.028
#> SRR1040852     5  0.4512     0.7666 0.032 0.000 0.108 0.080 0.768 0.012
#> SRR1040853     5  0.4512     0.7666 0.032 0.000 0.108 0.080 0.768 0.012
#> SRR1040854     3  0.6623     0.5537 0.184 0.000 0.500 0.000 0.068 0.248
#> SRR1040855     5  0.4531     0.7108 0.020 0.000 0.264 0.004 0.684 0.028
#> SRR1040856     4  0.0603     0.9152 0.000 0.004 0.000 0.980 0.016 0.000
#> SRR1040857     3  0.6623     0.5537 0.184 0.000 0.500 0.000 0.068 0.248
#> SRR1040858     3  0.6722     0.5355 0.200 0.000 0.480 0.000 0.068 0.252
#> SRR1040859     4  0.0993     0.9123 0.000 0.000 0.000 0.964 0.024 0.012
#> SRR1040860     4  0.0603     0.9152 0.000 0.004 0.000 0.980 0.016 0.000
#> SRR1040861     5  0.4224     0.6952 0.004 0.000 0.276 0.004 0.688 0.028
#> SRR1040862     4  0.1053     0.8994 0.000 0.004 0.000 0.964 0.020 0.012
#> SRR1040863     4  0.1138     0.8981 0.000 0.004 0.000 0.960 0.024 0.012
#> SRR1040864     5  0.3889     0.6780 0.000 0.000 0.044 0.164 0.776 0.016
#> SRR1040865     1  0.4219     0.7274 0.764 0.000 0.000 0.032 0.152 0.052
#> SRR1040866     4  0.1434     0.9025 0.000 0.000 0.000 0.940 0.048 0.012
#> SRR1040867     3  0.3518     0.2119 0.000 0.000 0.732 0.000 0.256 0.012
#> SRR1040868     1  0.1176     0.9067 0.956 0.000 0.000 0.000 0.020 0.024
#> SRR1040869     3  0.6623     0.5537 0.184 0.000 0.500 0.000 0.068 0.248
#> SRR1040870     3  0.0291     0.5857 0.000 0.000 0.992 0.000 0.004 0.004
#> SRR1040871     3  0.6837     0.5036 0.220 0.000 0.452 0.000 0.068 0.260
#> SRR1040872     5  0.4264     0.4434 0.000 0.000 0.484 0.000 0.500 0.016
#> SRR1040873     2  0.0291     0.9411 0.000 0.992 0.000 0.004 0.004 0.000
#> SRR1040874     1  0.0000     0.9214 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR1040875     5  0.4569     0.7622 0.052 0.000 0.108 0.060 0.768 0.012
#> SRR1040876     1  0.0000     0.9214 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR1040877     3  0.0603     0.5769 0.000 0.000 0.980 0.000 0.016 0.004
#> SRR1040878     4  0.3304     0.7855 0.004 0.000 0.000 0.816 0.140 0.040
#> SRR1040879     6  0.4897     0.5614 0.000 0.344 0.000 0.064 0.004 0.588
#> SRR1040880     1  0.0458     0.9166 0.984 0.000 0.000 0.000 0.000 0.016
#> SRR1040881     6  0.5078     0.7036 0.000 0.208 0.000 0.160 0.000 0.632
#> SRR1040882     3  0.3315     0.3125 0.000 0.000 0.780 0.000 0.200 0.020
#> SRR1040883     3  0.6837     0.5036 0.220 0.000 0.452 0.000 0.068 0.260
#> SRR1040884     1  0.0000     0.9214 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR1040885     3  0.3200     0.3273 0.000 0.000 0.788 0.000 0.196 0.016

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

consensus_heatmap(res, k = 2)

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

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

collect_plots(res)

plot of chunk MAD-skmeans-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 1.000           0.991       0.996         0.4926 0.509   0.509
#> 3 3 0.954           0.968       0.981         0.3476 0.824   0.655
#> 4 4 0.873           0.941       0.959         0.1088 0.928   0.784
#> 5 5 0.787           0.797       0.872         0.0642 0.885   0.617
#> 6 6 0.796           0.783       0.811         0.0417 0.930   0.703

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

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

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

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

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

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>            class entropy silhouette    p1    p2
#> SRR1040814     1    0.00      0.993 1.000 0.000
#> SRR1040813     1    0.00      0.993 1.000 0.000
#> SRR1040816     1    0.00      0.993 1.000 0.000
#> SRR1040815     2    0.00      1.000 0.000 1.000
#> SRR1040817     1    0.00      0.993 1.000 0.000
#> SRR1040818     2    0.00      1.000 0.000 1.000
#> SRR1040819     2    0.00      1.000 0.000 1.000
#> SRR1040820     2    0.00      1.000 0.000 1.000
#> SRR1040821     2    0.00      1.000 0.000 1.000
#> SRR1040822     1    0.00      0.993 1.000 0.000
#> SRR1040823     1    0.00      0.993 1.000 0.000
#> SRR1040824     2    0.00      1.000 0.000 1.000
#> SRR1040826     1    0.00      0.993 1.000 0.000
#> SRR1040825     2    0.00      1.000 0.000 1.000
#> SRR1040827     2    0.00      1.000 0.000 1.000
#> SRR1040828     2    0.00      1.000 0.000 1.000
#> SRR1040829     2    0.00      1.000 0.000 1.000
#> SRR1040830     1    0.00      0.993 1.000 0.000
#> SRR1040831     1    0.00      0.993 1.000 0.000
#> SRR1040832     2    0.00      1.000 0.000 1.000
#> SRR1040833     1    0.00      0.993 1.000 0.000
#> SRR1040834     1    0.00      0.993 1.000 0.000
#> SRR1040835     2    0.00      1.000 0.000 1.000
#> SRR1040836     1    0.00      0.993 1.000 0.000
#> SRR1040837     2    0.00      1.000 0.000 1.000
#> SRR1040839     2    0.00      1.000 0.000 1.000
#> SRR1040838     1    0.00      0.993 1.000 0.000
#> SRR1040840     2    0.00      1.000 0.000 1.000
#> SRR1040841     1    0.00      0.993 1.000 0.000
#> SRR1040843     2    0.00      1.000 0.000 1.000
#> SRR1040842     2    0.00      1.000 0.000 1.000
#> SRR1040845     2    0.00      1.000 0.000 1.000
#> SRR1040844     1    0.00      0.993 1.000 0.000
#> SRR1040846     2    0.00      1.000 0.000 1.000
#> SRR1040847     1    0.00      0.993 1.000 0.000
#> SRR1040849     1    0.00      0.993 1.000 0.000
#> SRR1040848     2    0.00      1.000 0.000 1.000
#> SRR1040851     1    0.00      0.993 1.000 0.000
#> SRR1040850     1    0.00      0.993 1.000 0.000
#> SRR1040852     1    0.00      0.993 1.000 0.000
#> SRR1040853     1    0.00      0.993 1.000 0.000
#> SRR1040854     1    0.00      0.993 1.000 0.000
#> SRR1040855     1    0.00      0.993 1.000 0.000
#> SRR1040856     2    0.00      1.000 0.000 1.000
#> SRR1040857     1    0.00      0.993 1.000 0.000
#> SRR1040858     1    0.00      0.993 1.000 0.000
#> SRR1040859     2    0.00      1.000 0.000 1.000
#> SRR1040860     2    0.00      1.000 0.000 1.000
#> SRR1040861     1    0.00      0.993 1.000 0.000
#> SRR1040862     2    0.00      1.000 0.000 1.000
#> SRR1040863     2    0.00      1.000 0.000 1.000
#> SRR1040864     1    0.85      0.619 0.724 0.276
#> SRR1040865     1    0.00      0.993 1.000 0.000
#> SRR1040866     2    0.00      1.000 0.000 1.000
#> SRR1040867     1    0.00      0.993 1.000 0.000
#> SRR1040868     1    0.00      0.993 1.000 0.000
#> SRR1040869     1    0.00      0.993 1.000 0.000
#> SRR1040870     1    0.00      0.993 1.000 0.000
#> SRR1040871     1    0.00      0.993 1.000 0.000
#> SRR1040872     1    0.00      0.993 1.000 0.000
#> SRR1040873     2    0.00      1.000 0.000 1.000
#> SRR1040874     1    0.00      0.993 1.000 0.000
#> SRR1040875     1    0.00      0.993 1.000 0.000
#> SRR1040876     1    0.00      0.993 1.000 0.000
#> SRR1040877     1    0.00      0.993 1.000 0.000
#> SRR1040878     2    0.00      1.000 0.000 1.000
#> SRR1040879     2    0.00      1.000 0.000 1.000
#> SRR1040880     1    0.00      0.993 1.000 0.000
#> SRR1040881     2    0.00      1.000 0.000 1.000
#> SRR1040882     1    0.00      0.993 1.000 0.000
#> SRR1040883     1    0.00      0.993 1.000 0.000
#> SRR1040884     1    0.00      0.993 1.000 0.000
#> SRR1040885     1    0.00      0.993 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
#> SRR1040814     3   0.000      1.000 0.000  0 1.000
#> SRR1040813     3   0.000      1.000 0.000  0 1.000
#> SRR1040816     1   0.000      0.929 1.000  0 0.000
#> SRR1040815     2   0.000      1.000 0.000  1 0.000
#> SRR1040817     3   0.000      1.000 0.000  0 1.000
#> SRR1040818     2   0.000      1.000 0.000  1 0.000
#> SRR1040819     2   0.000      1.000 0.000  1 0.000
#> SRR1040820     2   0.000      1.000 0.000  1 0.000
#> SRR1040821     2   0.000      1.000 0.000  1 0.000
#> SRR1040822     3   0.000      1.000 0.000  0 1.000
#> SRR1040823     3   0.000      1.000 0.000  0 1.000
#> SRR1040824     2   0.000      1.000 0.000  1 0.000
#> SRR1040826     3   0.000      1.000 0.000  0 1.000
#> SRR1040825     2   0.000      1.000 0.000  1 0.000
#> SRR1040827     2   0.000      1.000 0.000  1 0.000
#> SRR1040828     2   0.000      1.000 0.000  1 0.000
#> SRR1040829     2   0.000      1.000 0.000  1 0.000
#> SRR1040830     1   0.000      0.929 1.000  0 0.000
#> SRR1040831     1   0.000      0.929 1.000  0 0.000
#> SRR1040832     2   0.000      1.000 0.000  1 0.000
#> SRR1040833     1   0.000      0.929 1.000  0 0.000
#> SRR1040834     1   0.000      0.929 1.000  0 0.000
#> SRR1040835     2   0.000      1.000 0.000  1 0.000
#> SRR1040836     1   0.000      0.929 1.000  0 0.000
#> SRR1040837     2   0.000      1.000 0.000  1 0.000
#> SRR1040839     2   0.000      1.000 0.000  1 0.000
#> SRR1040838     3   0.000      1.000 0.000  0 1.000
#> SRR1040840     2   0.000      1.000 0.000  1 0.000
#> SRR1040841     1   0.000      0.929 1.000  0 0.000
#> SRR1040843     2   0.000      1.000 0.000  1 0.000
#> SRR1040842     2   0.000      1.000 0.000  1 0.000
#> SRR1040845     2   0.000      1.000 0.000  1 0.000
#> SRR1040844     1   0.000      0.929 1.000  0 0.000
#> SRR1040846     2   0.000      1.000 0.000  1 0.000
#> SRR1040847     1   0.000      0.929 1.000  0 0.000
#> SRR1040849     3   0.000      1.000 0.000  0 1.000
#> SRR1040848     2   0.000      1.000 0.000  1 0.000
#> SRR1040851     1   0.489      0.785 0.772  0 0.228
#> SRR1040850     3   0.000      1.000 0.000  0 1.000
#> SRR1040852     3   0.000      1.000 0.000  0 1.000
#> SRR1040853     3   0.000      1.000 0.000  0 1.000
#> SRR1040854     1   0.460      0.815 0.796  0 0.204
#> SRR1040855     3   0.000      1.000 0.000  0 1.000
#> SRR1040856     2   0.000      1.000 0.000  1 0.000
#> SRR1040857     1   0.460      0.815 0.796  0 0.204
#> SRR1040858     1   0.445      0.825 0.808  0 0.192
#> SRR1040859     2   0.000      1.000 0.000  1 0.000
#> SRR1040860     2   0.000      1.000 0.000  1 0.000
#> SRR1040861     3   0.000      1.000 0.000  0 1.000
#> SRR1040862     2   0.000      1.000 0.000  1 0.000
#> SRR1040863     2   0.000      1.000 0.000  1 0.000
#> SRR1040864     3   0.000      1.000 0.000  0 1.000
#> SRR1040865     1   0.000      0.929 1.000  0 0.000
#> SRR1040866     2   0.000      1.000 0.000  1 0.000
#> SRR1040867     3   0.000      1.000 0.000  0 1.000
#> SRR1040868     1   0.000      0.929 1.000  0 0.000
#> SRR1040869     1   0.460      0.815 0.796  0 0.204
#> SRR1040870     3   0.000      1.000 0.000  0 1.000
#> SRR1040871     1   0.445      0.825 0.808  0 0.192
#> SRR1040872     3   0.000      1.000 0.000  0 1.000
#> SRR1040873     2   0.000      1.000 0.000  1 0.000
#> SRR1040874     1   0.000      0.929 1.000  0 0.000
#> SRR1040875     3   0.000      1.000 0.000  0 1.000
#> SRR1040876     1   0.000      0.929 1.000  0 0.000
#> SRR1040877     3   0.000      1.000 0.000  0 1.000
#> SRR1040878     2   0.000      1.000 0.000  1 0.000
#> SRR1040879     2   0.000      1.000 0.000  1 0.000
#> SRR1040880     1   0.000      0.929 1.000  0 0.000
#> SRR1040881     2   0.000      1.000 0.000  1 0.000
#> SRR1040882     3   0.000      1.000 0.000  0 1.000
#> SRR1040883     1   0.445      0.825 0.808  0 0.192
#> SRR1040884     1   0.000      0.929 1.000  0 0.000
#> SRR1040885     3   0.000      1.000 0.000  0 1.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> SRR1040814     3  0.0000      0.991 0.000 0.000 1.000 0.000
#> SRR1040813     3  0.0000      0.991 0.000 0.000 1.000 0.000
#> SRR1040816     1  0.0000      0.917 1.000 0.000 0.000 0.000
#> SRR1040815     2  0.0000      0.940 0.000 1.000 0.000 0.000
#> SRR1040817     3  0.0000      0.991 0.000 0.000 1.000 0.000
#> SRR1040818     2  0.0000      0.940 0.000 1.000 0.000 0.000
#> SRR1040819     2  0.0000      0.940 0.000 1.000 0.000 0.000
#> SRR1040820     2  0.2530      0.930 0.000 0.888 0.000 0.112
#> SRR1040821     2  0.2530      0.930 0.000 0.888 0.000 0.112
#> SRR1040822     3  0.0000      0.991 0.000 0.000 1.000 0.000
#> SRR1040823     3  0.0000      0.991 0.000 0.000 1.000 0.000
#> SRR1040824     2  0.0000      0.940 0.000 1.000 0.000 0.000
#> SRR1040826     3  0.0000      0.991 0.000 0.000 1.000 0.000
#> SRR1040825     2  0.0000      0.940 0.000 1.000 0.000 0.000
#> SRR1040827     2  0.0000      0.940 0.000 1.000 0.000 0.000
#> SRR1040828     2  0.2345      0.933 0.000 0.900 0.000 0.100
#> SRR1040829     2  0.2345      0.933 0.000 0.900 0.000 0.100
#> SRR1040830     1  0.0000      0.917 1.000 0.000 0.000 0.000
#> SRR1040831     1  0.0000      0.917 1.000 0.000 0.000 0.000
#> SRR1040832     2  0.0000      0.940 0.000 1.000 0.000 0.000
#> SRR1040833     1  0.0000      0.917 1.000 0.000 0.000 0.000
#> SRR1040834     1  0.0000      0.917 1.000 0.000 0.000 0.000
#> SRR1040835     2  0.0000      0.940 0.000 1.000 0.000 0.000
#> SRR1040836     1  0.0000      0.917 1.000 0.000 0.000 0.000
#> SRR1040837     2  0.2530      0.930 0.000 0.888 0.000 0.112
#> SRR1040839     2  0.2530      0.930 0.000 0.888 0.000 0.112
#> SRR1040838     3  0.0921      0.982 0.000 0.000 0.972 0.028
#> SRR1040840     2  0.2530      0.930 0.000 0.888 0.000 0.112
#> SRR1040841     1  0.0000      0.917 1.000 0.000 0.000 0.000
#> SRR1040843     2  0.2530      0.930 0.000 0.888 0.000 0.112
#> SRR1040842     4  0.0469      0.980 0.000 0.012 0.000 0.988
#> SRR1040845     4  0.0921      0.997 0.000 0.028 0.000 0.972
#> SRR1040844     1  0.0000      0.917 1.000 0.000 0.000 0.000
#> SRR1040846     2  0.2530      0.930 0.000 0.888 0.000 0.112
#> SRR1040847     1  0.0000      0.917 1.000 0.000 0.000 0.000
#> SRR1040849     3  0.0000      0.991 0.000 0.000 1.000 0.000
#> SRR1040848     2  0.0707      0.940 0.000 0.980 0.000 0.020
#> SRR1040851     1  0.4008      0.768 0.756 0.000 0.244 0.000
#> SRR1040850     3  0.0921      0.982 0.000 0.000 0.972 0.028
#> SRR1040852     3  0.0921      0.982 0.000 0.000 0.972 0.028
#> SRR1040853     3  0.0921      0.982 0.000 0.000 0.972 0.028
#> SRR1040854     1  0.3801      0.798 0.780 0.000 0.220 0.000
#> SRR1040855     3  0.0921      0.982 0.000 0.000 0.972 0.028
#> SRR1040856     4  0.0921      0.997 0.000 0.028 0.000 0.972
#> SRR1040857     1  0.3801      0.798 0.780 0.000 0.220 0.000
#> SRR1040858     1  0.3486      0.822 0.812 0.000 0.188 0.000
#> SRR1040859     4  0.0921      0.997 0.000 0.028 0.000 0.972
#> SRR1040860     4  0.0921      0.997 0.000 0.028 0.000 0.972
#> SRR1040861     3  0.0921      0.982 0.000 0.000 0.972 0.028
#> SRR1040862     4  0.0921      0.997 0.000 0.028 0.000 0.972
#> SRR1040863     4  0.0921      0.997 0.000 0.028 0.000 0.972
#> SRR1040864     3  0.0921      0.982 0.000 0.000 0.972 0.028
#> SRR1040865     1  0.0000      0.917 1.000 0.000 0.000 0.000
#> SRR1040866     4  0.0921      0.997 0.000 0.028 0.000 0.972
#> SRR1040867     3  0.0000      0.991 0.000 0.000 1.000 0.000
#> SRR1040868     1  0.0000      0.917 1.000 0.000 0.000 0.000
#> SRR1040869     1  0.3801      0.798 0.780 0.000 0.220 0.000
#> SRR1040870     3  0.0000      0.991 0.000 0.000 1.000 0.000
#> SRR1040871     1  0.3486      0.822 0.812 0.000 0.188 0.000
#> SRR1040872     3  0.0000      0.991 0.000 0.000 1.000 0.000
#> SRR1040873     2  0.2530      0.930 0.000 0.888 0.000 0.112
#> SRR1040874     1  0.0000      0.917 1.000 0.000 0.000 0.000
#> SRR1040875     3  0.0000      0.991 0.000 0.000 1.000 0.000
#> SRR1040876     1  0.0000      0.917 1.000 0.000 0.000 0.000
#> SRR1040877     3  0.0000      0.991 0.000 0.000 1.000 0.000
#> SRR1040878     4  0.0921      0.997 0.000 0.028 0.000 0.972
#> SRR1040879     2  0.0000      0.940 0.000 1.000 0.000 0.000
#> SRR1040880     1  0.0000      0.917 1.000 0.000 0.000 0.000
#> SRR1040881     2  0.0000      0.940 0.000 1.000 0.000 0.000
#> SRR1040882     3  0.0000      0.991 0.000 0.000 1.000 0.000
#> SRR1040883     1  0.3486      0.822 0.812 0.000 0.188 0.000
#> SRR1040884     1  0.0000      0.917 1.000 0.000 0.000 0.000
#> SRR1040885     3  0.0000      0.991 0.000 0.000 1.000 0.000

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>            class entropy silhouette    p1    p2    p3    p4    p5
#> SRR1040814     3  0.3452      0.702 0.000 0.000 0.756 0.000 0.244
#> SRR1040813     3  0.3730      0.677 0.000 0.000 0.712 0.000 0.288
#> SRR1040816     1  0.0324      0.927 0.992 0.000 0.004 0.000 0.004
#> SRR1040815     2  0.1197      0.860 0.000 0.952 0.048 0.000 0.000
#> SRR1040817     3  0.3452      0.702 0.000 0.000 0.756 0.000 0.244
#> SRR1040818     2  0.1197      0.860 0.000 0.952 0.048 0.000 0.000
#> SRR1040819     2  0.1197      0.860 0.000 0.952 0.048 0.000 0.000
#> SRR1040820     2  0.3074      0.859 0.000 0.804 0.000 0.196 0.000
#> SRR1040821     2  0.3074      0.859 0.000 0.804 0.000 0.196 0.000
#> SRR1040822     3  0.3452      0.702 0.000 0.000 0.756 0.000 0.244
#> SRR1040823     3  0.3999      0.609 0.000 0.000 0.656 0.000 0.344
#> SRR1040824     2  0.0290      0.865 0.000 0.992 0.008 0.000 0.000
#> SRR1040826     3  0.3730      0.677 0.000 0.000 0.712 0.000 0.288
#> SRR1040825     2  0.1197      0.860 0.000 0.952 0.048 0.000 0.000
#> SRR1040827     2  0.0000      0.865 0.000 1.000 0.000 0.000 0.000
#> SRR1040828     2  0.3010      0.865 0.000 0.824 0.004 0.172 0.000
#> SRR1040829     2  0.2891      0.865 0.000 0.824 0.000 0.176 0.000
#> SRR1040830     1  0.0290      0.926 0.992 0.000 0.008 0.000 0.000
#> SRR1040831     1  0.1043      0.916 0.960 0.000 0.040 0.000 0.000
#> SRR1040832     2  0.1768      0.847 0.000 0.924 0.072 0.000 0.004
#> SRR1040833     1  0.0000      0.930 1.000 0.000 0.000 0.000 0.000
#> SRR1040834     1  0.3196      0.706 0.804 0.000 0.192 0.000 0.004
#> SRR1040835     2  0.1197      0.860 0.000 0.952 0.048 0.000 0.000
#> SRR1040836     1  0.2813      0.848 0.832 0.000 0.168 0.000 0.000
#> SRR1040837     2  0.3074      0.859 0.000 0.804 0.000 0.196 0.000
#> SRR1040839     2  0.3074      0.859 0.000 0.804 0.000 0.196 0.000
#> SRR1040838     5  0.0162      0.997 0.000 0.000 0.004 0.000 0.996
#> SRR1040840     2  0.3039      0.860 0.000 0.808 0.000 0.192 0.000
#> SRR1040841     1  0.0000      0.930 1.000 0.000 0.000 0.000 0.000
#> SRR1040843     2  0.3074      0.859 0.000 0.804 0.000 0.196 0.000
#> SRR1040842     4  0.3424      0.682 0.000 0.000 0.000 0.760 0.240
#> SRR1040845     4  0.0000      0.969 0.000 0.000 0.000 1.000 0.000
#> SRR1040844     1  0.0000      0.930 1.000 0.000 0.000 0.000 0.000
#> SRR1040846     2  0.3074      0.859 0.000 0.804 0.000 0.196 0.000
#> SRR1040847     1  0.0000      0.930 1.000 0.000 0.000 0.000 0.000
#> SRR1040849     3  0.3707      0.680 0.000 0.000 0.716 0.000 0.284
#> SRR1040848     2  0.2471      0.869 0.000 0.864 0.000 0.136 0.000
#> SRR1040851     3  0.3109      0.558 0.200 0.000 0.800 0.000 0.000
#> SRR1040850     5  0.0162      0.997 0.000 0.000 0.004 0.000 0.996
#> SRR1040852     5  0.0162      0.997 0.000 0.000 0.004 0.000 0.996
#> SRR1040853     5  0.0162      0.997 0.000 0.000 0.004 0.000 0.996
#> SRR1040854     3  0.3305      0.531 0.224 0.000 0.776 0.000 0.000
#> SRR1040855     5  0.0162      0.997 0.000 0.000 0.004 0.000 0.996
#> SRR1040856     4  0.0000      0.969 0.000 0.000 0.000 1.000 0.000
#> SRR1040857     3  0.3305      0.531 0.224 0.000 0.776 0.000 0.000
#> SRR1040858     3  0.4304     -0.105 0.484 0.000 0.516 0.000 0.000
#> SRR1040859     4  0.0000      0.969 0.000 0.000 0.000 1.000 0.000
#> SRR1040860     4  0.0000      0.969 0.000 0.000 0.000 1.000 0.000
#> SRR1040861     5  0.0510      0.984 0.000 0.000 0.016 0.000 0.984
#> SRR1040862     4  0.0000      0.969 0.000 0.000 0.000 1.000 0.000
#> SRR1040863     4  0.0000      0.969 0.000 0.000 0.000 1.000 0.000
#> SRR1040864     5  0.0162      0.997 0.000 0.000 0.004 0.000 0.996
#> SRR1040865     1  0.2813      0.848 0.832 0.000 0.168 0.000 0.000
#> SRR1040866     4  0.0000      0.969 0.000 0.000 0.000 1.000 0.000
#> SRR1040867     3  0.3452      0.702 0.000 0.000 0.756 0.000 0.244
#> SRR1040868     1  0.2813      0.848 0.832 0.000 0.168 0.000 0.000
#> SRR1040869     3  0.3210      0.546 0.212 0.000 0.788 0.000 0.000
#> SRR1040870     3  0.3452      0.702 0.000 0.000 0.756 0.000 0.244
#> SRR1040871     3  0.4304     -0.105 0.484 0.000 0.516 0.000 0.000
#> SRR1040872     3  0.3774      0.673 0.000 0.000 0.704 0.000 0.296
#> SRR1040873     2  0.3074      0.859 0.000 0.804 0.000 0.196 0.000
#> SRR1040874     1  0.0000      0.930 1.000 0.000 0.000 0.000 0.000
#> SRR1040875     3  0.2891      0.616 0.000 0.000 0.824 0.000 0.176
#> SRR1040876     1  0.0000      0.930 1.000 0.000 0.000 0.000 0.000
#> SRR1040877     3  0.3452      0.702 0.000 0.000 0.756 0.000 0.244
#> SRR1040878     4  0.0000      0.969 0.000 0.000 0.000 1.000 0.000
#> SRR1040879     2  0.1197      0.860 0.000 0.952 0.048 0.000 0.000
#> SRR1040880     1  0.2813      0.848 0.832 0.000 0.168 0.000 0.000
#> SRR1040881     2  0.1197      0.860 0.000 0.952 0.048 0.000 0.000
#> SRR1040882     3  0.3452      0.702 0.000 0.000 0.756 0.000 0.244
#> SRR1040883     3  0.4304     -0.105 0.484 0.000 0.516 0.000 0.000
#> SRR1040884     1  0.0000      0.930 1.000 0.000 0.000 0.000 0.000
#> SRR1040885     3  0.3816      0.662 0.000 0.000 0.696 0.000 0.304

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>            class entropy silhouette    p1    p2    p3    p4    p5    p6
#> SRR1040814     3  0.0000      0.923 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1040813     3  0.1367      0.915 0.012 0.000 0.944 0.000 0.044 0.000
#> SRR1040816     1  0.3810      0.944 0.572 0.000 0.000 0.000 0.000 0.428
#> SRR1040815     2  0.3909      0.753 0.244 0.720 0.000 0.000 0.036 0.000
#> SRR1040817     3  0.0000      0.923 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1040818     2  0.3909      0.753 0.244 0.720 0.000 0.000 0.036 0.000
#> SRR1040819     2  0.3909      0.753 0.244 0.720 0.000 0.000 0.036 0.000
#> SRR1040820     2  0.2048      0.809 0.000 0.880 0.000 0.120 0.000 0.000
#> SRR1040821     2  0.2048      0.809 0.000 0.880 0.000 0.120 0.000 0.000
#> SRR1040822     3  0.0363      0.923 0.012 0.000 0.988 0.000 0.000 0.000
#> SRR1040823     3  0.1858      0.888 0.012 0.000 0.912 0.000 0.076 0.000
#> SRR1040824     2  0.1858      0.794 0.092 0.904 0.000 0.000 0.004 0.000
#> SRR1040826     3  0.1367      0.915 0.012 0.000 0.944 0.000 0.044 0.000
#> SRR1040825     2  0.3909      0.753 0.244 0.720 0.000 0.000 0.036 0.000
#> SRR1040827     2  0.0790      0.802 0.032 0.968 0.000 0.000 0.000 0.000
#> SRR1040828     2  0.1910      0.811 0.000 0.892 0.000 0.108 0.000 0.000
#> SRR1040829     2  0.1910      0.811 0.000 0.892 0.000 0.108 0.000 0.000
#> SRR1040830     1  0.3817      0.948 0.568 0.000 0.000 0.000 0.000 0.432
#> SRR1040831     6  0.3868     -0.856 0.492 0.000 0.000 0.000 0.000 0.508
#> SRR1040832     2  0.4845      0.609 0.400 0.540 0.000 0.000 0.060 0.000
#> SRR1040833     1  0.3823      0.950 0.564 0.000 0.000 0.000 0.000 0.436
#> SRR1040834     1  0.4722      0.564 0.720 0.000 0.100 0.000 0.024 0.156
#> SRR1040835     2  0.3909      0.753 0.244 0.720 0.000 0.000 0.036 0.000
#> SRR1040836     6  0.0260      0.458 0.008 0.000 0.000 0.000 0.000 0.992
#> SRR1040837     2  0.2048      0.809 0.000 0.880 0.000 0.120 0.000 0.000
#> SRR1040839     2  0.2048      0.809 0.000 0.880 0.000 0.120 0.000 0.000
#> SRR1040838     5  0.1584      0.985 0.008 0.000 0.064 0.000 0.928 0.000
#> SRR1040840     2  0.2048      0.809 0.000 0.880 0.000 0.120 0.000 0.000
#> SRR1040841     1  0.3823      0.950 0.564 0.000 0.000 0.000 0.000 0.436
#> SRR1040843     2  0.2048      0.809 0.000 0.880 0.000 0.120 0.000 0.000
#> SRR1040842     4  0.3778      0.591 0.000 0.016 0.000 0.696 0.288 0.000
#> SRR1040845     4  0.0000      0.948 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR1040844     1  0.3823      0.950 0.564 0.000 0.000 0.000 0.000 0.436
#> SRR1040846     2  0.2048      0.809 0.000 0.880 0.000 0.120 0.000 0.000
#> SRR1040847     1  0.3823      0.950 0.564 0.000 0.000 0.000 0.000 0.436
#> SRR1040849     3  0.0865      0.921 0.000 0.000 0.964 0.000 0.036 0.000
#> SRR1040848     2  0.1700      0.811 0.004 0.916 0.000 0.080 0.000 0.000
#> SRR1040851     6  0.3857      0.368 0.000 0.000 0.468 0.000 0.000 0.532
#> SRR1040850     5  0.1327      0.986 0.000 0.000 0.064 0.000 0.936 0.000
#> SRR1040852     5  0.1643      0.985 0.008 0.000 0.068 0.000 0.924 0.000
#> SRR1040853     5  0.1643      0.985 0.008 0.000 0.068 0.000 0.924 0.000
#> SRR1040854     6  0.3817      0.457 0.000 0.000 0.432 0.000 0.000 0.568
#> SRR1040855     5  0.1327      0.986 0.000 0.000 0.064 0.000 0.936 0.000
#> SRR1040856     4  0.0790      0.940 0.000 0.032 0.000 0.968 0.000 0.000
#> SRR1040857     6  0.3817      0.457 0.000 0.000 0.432 0.000 0.000 0.568
#> SRR1040858     6  0.3198      0.636 0.000 0.000 0.260 0.000 0.000 0.740
#> SRR1040859     4  0.0000      0.948 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR1040860     4  0.0363      0.949 0.000 0.012 0.000 0.988 0.000 0.000
#> SRR1040861     5  0.2003      0.938 0.000 0.000 0.116 0.000 0.884 0.000
#> SRR1040862     4  0.0632      0.946 0.000 0.024 0.000 0.976 0.000 0.000
#> SRR1040863     4  0.0632      0.946 0.000 0.024 0.000 0.976 0.000 0.000
#> SRR1040864     5  0.1327      0.986 0.000 0.000 0.064 0.000 0.936 0.000
#> SRR1040865     6  0.0508      0.470 0.004 0.000 0.000 0.012 0.000 0.984
#> SRR1040866     4  0.0000      0.948 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR1040867     3  0.0603      0.910 0.000 0.000 0.980 0.000 0.004 0.016
#> SRR1040868     6  0.0000      0.465 0.000 0.000 0.000 0.000 0.000 1.000
#> SRR1040869     6  0.3843      0.413 0.000 0.000 0.452 0.000 0.000 0.548
#> SRR1040870     3  0.0000      0.923 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1040871     6  0.2762      0.633 0.000 0.000 0.196 0.000 0.000 0.804
#> SRR1040872     3  0.1267      0.911 0.000 0.000 0.940 0.000 0.060 0.000
#> SRR1040873     2  0.2048      0.809 0.000 0.880 0.000 0.120 0.000 0.000
#> SRR1040874     1  0.3823      0.950 0.564 0.000 0.000 0.000 0.000 0.436
#> SRR1040875     3  0.5021      0.154 0.004 0.000 0.592 0.000 0.080 0.324
#> SRR1040876     1  0.3823      0.950 0.564 0.000 0.000 0.000 0.000 0.436
#> SRR1040877     3  0.0000      0.923 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1040878     4  0.0551      0.943 0.004 0.000 0.000 0.984 0.004 0.008
#> SRR1040879     2  0.3909      0.753 0.244 0.720 0.000 0.000 0.036 0.000
#> SRR1040880     6  0.0260      0.453 0.008 0.000 0.000 0.000 0.000 0.992
#> SRR1040881     2  0.3909      0.753 0.244 0.720 0.000 0.000 0.036 0.000
#> SRR1040882     3  0.0363      0.923 0.012 0.000 0.988 0.000 0.000 0.000
#> SRR1040883     6  0.2762      0.633 0.000 0.000 0.196 0.000 0.000 0.804
#> SRR1040884     1  0.3823      0.950 0.564 0.000 0.000 0.000 0.000 0.436
#> SRR1040885     3  0.1500      0.910 0.012 0.000 0.936 0.000 0.052 0.000

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

consensus_heatmap(res, k = 2)

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

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

collect_plots(res)

plot of chunk MAD-pam-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 1.000           0.972       0.989         0.4920 0.505   0.505
#> 3 3 0.841           0.900       0.948         0.3683 0.756   0.546
#> 4 4 0.747           0.774       0.822         0.0914 0.902   0.711
#> 5 5 0.897           0.877       0.947         0.0772 0.857   0.526
#> 6 6 0.868           0.883       0.920         0.0492 0.943   0.735

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
#> SRR1040814     1   0.000      1.000 1.0 0.0
#> SRR1040813     1   0.000      1.000 1.0 0.0
#> SRR1040816     1   0.000      1.000 1.0 0.0
#> SRR1040815     2   0.000      0.973 0.0 1.0
#> SRR1040817     1   0.000      1.000 1.0 0.0
#> SRR1040818     2   0.000      0.973 0.0 1.0
#> SRR1040819     2   0.000      0.973 0.0 1.0
#> SRR1040820     2   0.000      0.973 0.0 1.0
#> SRR1040821     2   0.000      0.973 0.0 1.0
#> SRR1040822     1   0.000      1.000 1.0 0.0
#> SRR1040823     1   0.000      1.000 1.0 0.0
#> SRR1040824     2   0.000      0.973 0.0 1.0
#> SRR1040826     1   0.000      1.000 1.0 0.0
#> SRR1040825     2   0.000      0.973 0.0 1.0
#> SRR1040827     2   0.000      0.973 0.0 1.0
#> SRR1040828     2   0.000      0.973 0.0 1.0
#> SRR1040829     2   0.000      0.973 0.0 1.0
#> SRR1040830     1   0.000      1.000 1.0 0.0
#> SRR1040831     1   0.000      1.000 1.0 0.0
#> SRR1040832     2   0.000      0.973 0.0 1.0
#> SRR1040833     1   0.000      1.000 1.0 0.0
#> SRR1040834     1   0.000      1.000 1.0 0.0
#> SRR1040835     2   0.000      0.973 0.0 1.0
#> SRR1040836     1   0.000      1.000 1.0 0.0
#> SRR1040837     2   0.000      0.973 0.0 1.0
#> SRR1040839     2   0.000      0.973 0.0 1.0
#> SRR1040838     1   0.000      1.000 1.0 0.0
#> SRR1040840     2   0.000      0.973 0.0 1.0
#> SRR1040841     1   0.000      1.000 1.0 0.0
#> SRR1040843     2   0.000      0.973 0.0 1.0
#> SRR1040842     2   0.000      0.973 0.0 1.0
#> SRR1040845     2   0.000      0.973 0.0 1.0
#> SRR1040844     1   0.000      1.000 1.0 0.0
#> SRR1040846     2   0.000      0.973 0.0 1.0
#> SRR1040847     1   0.000      1.000 1.0 0.0
#> SRR1040849     1   0.000      1.000 1.0 0.0
#> SRR1040848     2   0.000      0.973 0.0 1.0
#> SRR1040851     1   0.000      1.000 1.0 0.0
#> SRR1040850     1   0.000      1.000 1.0 0.0
#> SRR1040852     1   0.000      1.000 1.0 0.0
#> SRR1040853     1   0.000      1.000 1.0 0.0
#> SRR1040854     1   0.000      1.000 1.0 0.0
#> SRR1040855     1   0.000      1.000 1.0 0.0
#> SRR1040856     2   0.000      0.973 0.0 1.0
#> SRR1040857     1   0.000      1.000 1.0 0.0
#> SRR1040858     1   0.000      1.000 1.0 0.0
#> SRR1040859     2   0.000      0.973 0.0 1.0
#> SRR1040860     2   0.000      0.973 0.0 1.0
#> SRR1040861     1   0.000      1.000 1.0 0.0
#> SRR1040862     2   0.000      0.973 0.0 1.0
#> SRR1040863     2   0.000      0.973 0.0 1.0
#> SRR1040864     2   0.971      0.356 0.4 0.6
#> SRR1040865     1   0.000      1.000 1.0 0.0
#> SRR1040866     2   0.000      0.973 0.0 1.0
#> SRR1040867     1   0.000      1.000 1.0 0.0
#> SRR1040868     1   0.000      1.000 1.0 0.0
#> SRR1040869     1   0.000      1.000 1.0 0.0
#> SRR1040870     1   0.000      1.000 1.0 0.0
#> SRR1040871     1   0.000      1.000 1.0 0.0
#> SRR1040872     1   0.000      1.000 1.0 0.0
#> SRR1040873     2   0.000      0.973 0.0 1.0
#> SRR1040874     1   0.000      1.000 1.0 0.0
#> SRR1040875     1   0.000      1.000 1.0 0.0
#> SRR1040876     1   0.000      1.000 1.0 0.0
#> SRR1040877     1   0.000      1.000 1.0 0.0
#> SRR1040878     2   0.971      0.356 0.4 0.6
#> SRR1040879     2   0.000      0.973 0.0 1.0
#> SRR1040880     1   0.000      1.000 1.0 0.0
#> SRR1040881     2   0.000      0.973 0.0 1.0
#> SRR1040882     1   0.000      1.000 1.0 0.0
#> SRR1040883     1   0.000      1.000 1.0 0.0
#> SRR1040884     1   0.000      1.000 1.0 0.0
#> SRR1040885     1   0.000      1.000 1.0 0.0

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>            class entropy silhouette    p1    p2    p3
#> SRR1040814     1  0.0000     0.8907 1.000 0.000 0.000
#> SRR1040813     3  0.6192     0.0743 0.420 0.000 0.580
#> SRR1040816     1  0.4555     0.8256 0.800 0.000 0.200
#> SRR1040815     2  0.0000     0.9993 0.000 1.000 0.000
#> SRR1040817     1  0.0000     0.8907 1.000 0.000 0.000
#> SRR1040818     2  0.0000     0.9993 0.000 1.000 0.000
#> SRR1040819     2  0.0000     0.9993 0.000 1.000 0.000
#> SRR1040820     2  0.0000     0.9993 0.000 1.000 0.000
#> SRR1040821     2  0.0000     0.9993 0.000 1.000 0.000
#> SRR1040822     1  0.0000     0.8907 1.000 0.000 0.000
#> SRR1040823     3  0.0000     0.9170 0.000 0.000 1.000
#> SRR1040824     2  0.0000     0.9993 0.000 1.000 0.000
#> SRR1040826     3  0.5397     0.6864 0.280 0.000 0.720
#> SRR1040825     2  0.0000     0.9993 0.000 1.000 0.000
#> SRR1040827     2  0.0000     0.9993 0.000 1.000 0.000
#> SRR1040828     2  0.0000     0.9993 0.000 1.000 0.000
#> SRR1040829     2  0.0000     0.9993 0.000 1.000 0.000
#> SRR1040830     1  0.4555     0.8256 0.800 0.000 0.200
#> SRR1040831     1  0.0000     0.8907 1.000 0.000 0.000
#> SRR1040832     3  0.0000     0.9170 0.000 0.000 1.000
#> SRR1040833     1  0.1860     0.8779 0.948 0.000 0.052
#> SRR1040834     3  0.0000     0.9170 0.000 0.000 1.000
#> SRR1040835     2  0.0000     0.9993 0.000 1.000 0.000
#> SRR1040836     1  0.4555     0.8256 0.800 0.000 0.200
#> SRR1040837     2  0.0000     0.9993 0.000 1.000 0.000
#> SRR1040839     2  0.0000     0.9993 0.000 1.000 0.000
#> SRR1040838     3  0.0000     0.9170 0.000 0.000 1.000
#> SRR1040840     2  0.0000     0.9993 0.000 1.000 0.000
#> SRR1040841     1  0.4555     0.8256 0.800 0.000 0.200
#> SRR1040843     2  0.0000     0.9993 0.000 1.000 0.000
#> SRR1040842     2  0.0000     0.9993 0.000 1.000 0.000
#> SRR1040845     2  0.0747     0.9824 0.000 0.984 0.016
#> SRR1040844     1  0.4555     0.8256 0.800 0.000 0.200
#> SRR1040846     2  0.0000     0.9993 0.000 1.000 0.000
#> SRR1040847     1  0.4555     0.8256 0.800 0.000 0.200
#> SRR1040849     3  0.4555     0.7696 0.200 0.000 0.800
#> SRR1040848     2  0.0000     0.9993 0.000 1.000 0.000
#> SRR1040851     1  0.0000     0.8907 1.000 0.000 0.000
#> SRR1040850     3  0.0000     0.9170 0.000 0.000 1.000
#> SRR1040852     3  0.0000     0.9170 0.000 0.000 1.000
#> SRR1040853     3  0.0000     0.9170 0.000 0.000 1.000
#> SRR1040854     1  0.0000     0.8907 1.000 0.000 0.000
#> SRR1040855     3  0.0000     0.9170 0.000 0.000 1.000
#> SRR1040856     2  0.0000     0.9993 0.000 1.000 0.000
#> SRR1040857     1  0.0000     0.8907 1.000 0.000 0.000
#> SRR1040858     1  0.0000     0.8907 1.000 0.000 0.000
#> SRR1040859     3  0.0000     0.9170 0.000 0.000 1.000
#> SRR1040860     2  0.0000     0.9993 0.000 1.000 0.000
#> SRR1040861     3  0.0000     0.9170 0.000 0.000 1.000
#> SRR1040862     2  0.0000     0.9993 0.000 1.000 0.000
#> SRR1040863     2  0.0000     0.9993 0.000 1.000 0.000
#> SRR1040864     3  0.0000     0.9170 0.000 0.000 1.000
#> SRR1040865     3  0.0000     0.9170 0.000 0.000 1.000
#> SRR1040866     3  0.0000     0.9170 0.000 0.000 1.000
#> SRR1040867     3  0.0592     0.9102 0.012 0.000 0.988
#> SRR1040868     1  0.6215     0.4386 0.572 0.000 0.428
#> SRR1040869     1  0.0000     0.8907 1.000 0.000 0.000
#> SRR1040870     1  0.0000     0.8907 1.000 0.000 0.000
#> SRR1040871     1  0.0000     0.8907 1.000 0.000 0.000
#> SRR1040872     3  0.4291     0.7879 0.180 0.000 0.820
#> SRR1040873     2  0.0000     0.9993 0.000 1.000 0.000
#> SRR1040874     1  0.4555     0.8256 0.800 0.000 0.200
#> SRR1040875     3  0.0000     0.9170 0.000 0.000 1.000
#> SRR1040876     1  0.4555     0.8256 0.800 0.000 0.200
#> SRR1040877     3  0.4702     0.7609 0.212 0.000 0.788
#> SRR1040878     3  0.0000     0.9170 0.000 0.000 1.000
#> SRR1040879     2  0.0000     0.9993 0.000 1.000 0.000
#> SRR1040880     1  0.4555     0.8256 0.800 0.000 0.200
#> SRR1040881     2  0.0000     0.9993 0.000 1.000 0.000
#> SRR1040882     1  0.0000     0.8907 1.000 0.000 0.000
#> SRR1040883     1  0.0000     0.8907 1.000 0.000 0.000
#> SRR1040884     1  0.0000     0.8907 1.000 0.000 0.000
#> SRR1040885     3  0.4555     0.7696 0.200 0.000 0.800

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> SRR1040814     3  0.0000      0.846 0.000 0.000 1.000 0.000
#> SRR1040813     4  0.1635      0.873 0.008 0.000 0.044 0.948
#> SRR1040816     1  0.4855      0.888 0.600 0.000 0.400 0.000
#> SRR1040815     2  0.4855      0.756 0.400 0.600 0.000 0.000
#> SRR1040817     3  0.0000      0.846 0.000 0.000 1.000 0.000
#> SRR1040818     1  0.4897     -0.428 0.660 0.332 0.000 0.008
#> SRR1040819     2  0.4855      0.756 0.400 0.600 0.000 0.000
#> SRR1040820     2  0.0000      0.810 0.000 1.000 0.000 0.000
#> SRR1040821     2  0.0000      0.810 0.000 1.000 0.000 0.000
#> SRR1040822     3  0.0000      0.846 0.000 0.000 1.000 0.000
#> SRR1040823     4  0.0000      0.923 0.000 0.000 0.000 1.000
#> SRR1040824     2  0.3400      0.795 0.180 0.820 0.000 0.000
#> SRR1040826     4  0.4977      0.213 0.000 0.000 0.460 0.540
#> SRR1040825     2  0.4855      0.756 0.400 0.600 0.000 0.000
#> SRR1040827     2  0.0000      0.810 0.000 1.000 0.000 0.000
#> SRR1040828     2  0.4661      0.771 0.348 0.652 0.000 0.000
#> SRR1040829     2  0.0000      0.810 0.000 1.000 0.000 0.000
#> SRR1040830     1  0.4855      0.888 0.600 0.000 0.400 0.000
#> SRR1040831     1  0.4877      0.877 0.592 0.000 0.408 0.000
#> SRR1040832     4  0.0188      0.920 0.004 0.000 0.000 0.996
#> SRR1040833     1  0.4855      0.888 0.600 0.000 0.400 0.000
#> SRR1040834     4  0.0000      0.923 0.000 0.000 0.000 1.000
#> SRR1040835     2  0.4855      0.756 0.400 0.600 0.000 0.000
#> SRR1040836     1  0.4855      0.888 0.600 0.000 0.400 0.000
#> SRR1040837     2  0.0000      0.810 0.000 1.000 0.000 0.000
#> SRR1040839     2  0.0000      0.810 0.000 1.000 0.000 0.000
#> SRR1040838     4  0.0000      0.923 0.000 0.000 0.000 1.000
#> SRR1040840     2  0.0000      0.810 0.000 1.000 0.000 0.000
#> SRR1040841     1  0.4855      0.888 0.600 0.000 0.400 0.000
#> SRR1040843     2  0.0000      0.810 0.000 1.000 0.000 0.000
#> SRR1040842     2  0.4661      0.552 0.000 0.652 0.000 0.348
#> SRR1040845     2  0.5203      0.769 0.348 0.636 0.000 0.016
#> SRR1040844     1  0.4855      0.888 0.600 0.000 0.400 0.000
#> SRR1040846     2  0.0000      0.810 0.000 1.000 0.000 0.000
#> SRR1040847     1  0.4855      0.888 0.600 0.000 0.400 0.000
#> SRR1040849     3  0.4855      0.131 0.000 0.000 0.600 0.400
#> SRR1040848     2  0.0000      0.810 0.000 1.000 0.000 0.000
#> SRR1040851     3  0.0000      0.846 0.000 0.000 1.000 0.000
#> SRR1040850     4  0.0000      0.923 0.000 0.000 0.000 1.000
#> SRR1040852     4  0.0000      0.923 0.000 0.000 0.000 1.000
#> SRR1040853     4  0.0000      0.923 0.000 0.000 0.000 1.000
#> SRR1040854     3  0.0000      0.846 0.000 0.000 1.000 0.000
#> SRR1040855     4  0.0000      0.923 0.000 0.000 0.000 1.000
#> SRR1040856     2  0.4661      0.552 0.000 0.652 0.000 0.348
#> SRR1040857     3  0.0000      0.846 0.000 0.000 1.000 0.000
#> SRR1040858     3  0.0000      0.846 0.000 0.000 1.000 0.000
#> SRR1040859     4  0.0000      0.923 0.000 0.000 0.000 1.000
#> SRR1040860     2  0.4661      0.552 0.000 0.652 0.000 0.348
#> SRR1040861     4  0.0000      0.923 0.000 0.000 0.000 1.000
#> SRR1040862     2  0.4500      0.779 0.316 0.684 0.000 0.000
#> SRR1040863     2  0.4661      0.552 0.000 0.652 0.000 0.348
#> SRR1040864     4  0.0000      0.923 0.000 0.000 0.000 1.000
#> SRR1040865     4  0.0000      0.923 0.000 0.000 0.000 1.000
#> SRR1040866     4  0.0000      0.923 0.000 0.000 0.000 1.000
#> SRR1040867     4  0.3074      0.786 0.000 0.000 0.152 0.848
#> SRR1040868     1  0.7335      0.647 0.444 0.000 0.400 0.156
#> SRR1040869     3  0.0000      0.846 0.000 0.000 1.000 0.000
#> SRR1040870     3  0.0000      0.846 0.000 0.000 1.000 0.000
#> SRR1040871     3  0.0000      0.846 0.000 0.000 1.000 0.000
#> SRR1040872     4  0.3486      0.739 0.000 0.000 0.188 0.812
#> SRR1040873     2  0.0000      0.810 0.000 1.000 0.000 0.000
#> SRR1040874     1  0.4855      0.888 0.600 0.000 0.400 0.000
#> SRR1040875     4  0.0000      0.923 0.000 0.000 0.000 1.000
#> SRR1040876     1  0.4855      0.888 0.600 0.000 0.400 0.000
#> SRR1040877     3  0.4855      0.131 0.000 0.000 0.600 0.400
#> SRR1040878     4  0.0000      0.923 0.000 0.000 0.000 1.000
#> SRR1040879     2  0.4855      0.756 0.400 0.600 0.000 0.000
#> SRR1040880     1  0.4855      0.888 0.600 0.000 0.400 0.000
#> SRR1040881     2  0.4855      0.756 0.400 0.600 0.000 0.000
#> SRR1040882     3  0.2921      0.655 0.000 0.000 0.860 0.140
#> SRR1040883     3  0.0000      0.846 0.000 0.000 1.000 0.000
#> SRR1040884     1  0.4855      0.888 0.600 0.000 0.400 0.000
#> SRR1040885     4  0.4977      0.213 0.000 0.000 0.460 0.540

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>            class entropy silhouette    p1    p2    p3    p4    p5
#> SRR1040814     3  0.0000      0.850 0.000 0.000 1.000 0.000 0.000
#> SRR1040813     5  0.0510      0.935 0.016 0.000 0.000 0.000 0.984
#> SRR1040816     1  0.0000      0.985 1.000 0.000 0.000 0.000 0.000
#> SRR1040815     4  0.0000      0.976 0.000 0.000 0.000 1.000 0.000
#> SRR1040817     3  0.0000      0.850 0.000 0.000 1.000 0.000 0.000
#> SRR1040818     4  0.0000      0.976 0.000 0.000 0.000 1.000 0.000
#> SRR1040819     4  0.0000      0.976 0.000 0.000 0.000 1.000 0.000
#> SRR1040820     2  0.0000      0.937 0.000 1.000 0.000 0.000 0.000
#> SRR1040821     2  0.0000      0.937 0.000 1.000 0.000 0.000 0.000
#> SRR1040822     3  0.0000      0.850 0.000 0.000 1.000 0.000 0.000
#> SRR1040823     5  0.0000      0.946 0.000 0.000 0.000 0.000 1.000
#> SRR1040824     2  0.2929      0.784 0.000 0.820 0.000 0.180 0.000
#> SRR1040826     3  0.4182      0.457 0.000 0.000 0.600 0.000 0.400
#> SRR1040825     4  0.0000      0.976 0.000 0.000 0.000 1.000 0.000
#> SRR1040827     2  0.0000      0.937 0.000 1.000 0.000 0.000 0.000
#> SRR1040828     4  0.1270      0.945 0.000 0.052 0.000 0.948 0.000
#> SRR1040829     2  0.0162      0.937 0.000 0.996 0.000 0.004 0.000
#> SRR1040830     1  0.0000      0.985 1.000 0.000 0.000 0.000 0.000
#> SRR1040831     1  0.0290      0.977 0.992 0.000 0.008 0.000 0.000
#> SRR1040832     5  0.0162      0.943 0.000 0.000 0.000 0.004 0.996
#> SRR1040833     1  0.0000      0.985 1.000 0.000 0.000 0.000 0.000
#> SRR1040834     5  0.0000      0.946 0.000 0.000 0.000 0.000 1.000
#> SRR1040835     4  0.0000      0.976 0.000 0.000 0.000 1.000 0.000
#> SRR1040836     1  0.0000      0.985 1.000 0.000 0.000 0.000 0.000
#> SRR1040837     2  0.3109      0.771 0.000 0.800 0.000 0.200 0.000
#> SRR1040839     2  0.0794      0.928 0.000 0.972 0.000 0.028 0.000
#> SRR1040838     5  0.0000      0.946 0.000 0.000 0.000 0.000 1.000
#> SRR1040840     2  0.0000      0.937 0.000 1.000 0.000 0.000 0.000
#> SRR1040841     1  0.0000      0.985 1.000 0.000 0.000 0.000 0.000
#> SRR1040843     2  0.0794      0.928 0.000 0.972 0.000 0.028 0.000
#> SRR1040842     5  0.2054      0.888 0.000 0.052 0.000 0.028 0.920
#> SRR1040845     4  0.1270      0.945 0.000 0.052 0.000 0.948 0.000
#> SRR1040844     1  0.0000      0.985 1.000 0.000 0.000 0.000 0.000
#> SRR1040846     2  0.3109      0.771 0.000 0.800 0.000 0.200 0.000
#> SRR1040847     1  0.0000      0.985 1.000 0.000 0.000 0.000 0.000
#> SRR1040849     3  0.3177      0.721 0.000 0.000 0.792 0.000 0.208
#> SRR1040848     2  0.0000      0.937 0.000 1.000 0.000 0.000 0.000
#> SRR1040851     3  0.0000      0.850 0.000 0.000 1.000 0.000 0.000
#> SRR1040850     5  0.0000      0.946 0.000 0.000 0.000 0.000 1.000
#> SRR1040852     5  0.0000      0.946 0.000 0.000 0.000 0.000 1.000
#> SRR1040853     5  0.0000      0.946 0.000 0.000 0.000 0.000 1.000
#> SRR1040854     3  0.0000      0.850 0.000 0.000 1.000 0.000 0.000
#> SRR1040855     5  0.0000      0.946 0.000 0.000 0.000 0.000 1.000
#> SRR1040856     5  0.4400      0.669 0.000 0.052 0.000 0.212 0.736
#> SRR1040857     3  0.0000      0.850 0.000 0.000 1.000 0.000 0.000
#> SRR1040858     3  0.0000      0.850 0.000 0.000 1.000 0.000 0.000
#> SRR1040859     5  0.0000      0.946 0.000 0.000 0.000 0.000 1.000
#> SRR1040860     5  0.2221      0.882 0.000 0.052 0.000 0.036 0.912
#> SRR1040861     5  0.0000      0.946 0.000 0.000 0.000 0.000 1.000
#> SRR1040862     4  0.1792      0.914 0.000 0.084 0.000 0.916 0.000
#> SRR1040863     5  0.2139      0.885 0.000 0.052 0.000 0.032 0.916
#> SRR1040864     5  0.0000      0.946 0.000 0.000 0.000 0.000 1.000
#> SRR1040865     5  0.0000      0.946 0.000 0.000 0.000 0.000 1.000
#> SRR1040866     5  0.0000      0.946 0.000 0.000 0.000 0.000 1.000
#> SRR1040867     5  0.4182      0.121 0.000 0.000 0.400 0.000 0.600
#> SRR1040868     1  0.2605      0.813 0.852 0.000 0.000 0.000 0.148
#> SRR1040869     3  0.0000      0.850 0.000 0.000 1.000 0.000 0.000
#> SRR1040870     3  0.0000      0.850 0.000 0.000 1.000 0.000 0.000
#> SRR1040871     3  0.0162      0.848 0.004 0.000 0.996 0.000 0.000
#> SRR1040872     3  0.4305      0.217 0.000 0.000 0.512 0.000 0.488
#> SRR1040873     2  0.0000      0.937 0.000 1.000 0.000 0.000 0.000
#> SRR1040874     1  0.0000      0.985 1.000 0.000 0.000 0.000 0.000
#> SRR1040875     5  0.0000      0.946 0.000 0.000 0.000 0.000 1.000
#> SRR1040876     1  0.0000      0.985 1.000 0.000 0.000 0.000 0.000
#> SRR1040877     3  0.1608      0.818 0.000 0.000 0.928 0.000 0.072
#> SRR1040878     5  0.0000      0.946 0.000 0.000 0.000 0.000 1.000
#> SRR1040879     4  0.0000      0.976 0.000 0.000 0.000 1.000 0.000
#> SRR1040880     1  0.0000      0.985 1.000 0.000 0.000 0.000 0.000
#> SRR1040881     4  0.0000      0.976 0.000 0.000 0.000 1.000 0.000
#> SRR1040882     3  0.4182      0.457 0.000 0.000 0.600 0.000 0.400
#> SRR1040883     3  0.0000      0.850 0.000 0.000 1.000 0.000 0.000
#> SRR1040884     1  0.0000      0.985 1.000 0.000 0.000 0.000 0.000
#> SRR1040885     3  0.4182      0.457 0.000 0.000 0.600 0.000 0.400

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>            class entropy silhouette    p1    p2    p3    p4    p5    p6
#> SRR1040814     3  0.0000      0.830 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1040813     5  0.1643      0.900 0.008 0.000 0.068 0.000 0.924 0.000
#> SRR1040816     1  0.0000      0.938 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR1040815     6  0.0000      0.990 0.000 0.000 0.000 0.000 0.000 1.000
#> SRR1040817     3  0.0000      0.830 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1040818     6  0.0000      0.990 0.000 0.000 0.000 0.000 0.000 1.000
#> SRR1040819     6  0.0000      0.990 0.000 0.000 0.000 0.000 0.000 1.000
#> SRR1040820     2  0.0000      0.942 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR1040821     2  0.0000      0.942 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR1040822     3  0.0000      0.830 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1040823     5  0.0000      0.956 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR1040824     2  0.2631      0.778 0.000 0.820 0.000 0.000 0.000 0.180
#> SRR1040826     3  0.3446      0.519 0.000 0.000 0.692 0.000 0.308 0.000
#> SRR1040825     6  0.0000      0.990 0.000 0.000 0.000 0.000 0.000 1.000
#> SRR1040827     2  0.0000      0.942 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR1040828     6  0.1141      0.927 0.000 0.052 0.000 0.000 0.000 0.948
#> SRR1040829     2  0.0000      0.942 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR1040830     1  0.0000      0.938 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR1040831     1  0.2706      0.840 0.832 0.000 0.008 0.160 0.000 0.000
#> SRR1040832     5  0.0865      0.929 0.000 0.000 0.000 0.000 0.964 0.036
#> SRR1040833     1  0.0000      0.938 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR1040834     5  0.0000      0.956 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR1040835     6  0.0000      0.990 0.000 0.000 0.000 0.000 0.000 1.000
#> SRR1040836     1  0.2730      0.821 0.808 0.000 0.000 0.192 0.000 0.000
#> SRR1040837     2  0.2793      0.771 0.000 0.800 0.000 0.000 0.000 0.200
#> SRR1040839     2  0.0000      0.942 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR1040838     5  0.0000      0.956 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR1040840     2  0.0000      0.942 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR1040841     1  0.0000      0.938 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR1040843     2  0.0000      0.942 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR1040842     4  0.3356      0.921 0.000 0.052 0.000 0.808 0.140 0.000
#> SRR1040845     4  0.3356      0.780 0.000 0.052 0.000 0.808 0.000 0.140
#> SRR1040844     1  0.0000      0.938 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR1040846     2  0.2793      0.771 0.000 0.800 0.000 0.000 0.000 0.200
#> SRR1040847     1  0.0000      0.938 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR1040849     3  0.0547      0.823 0.000 0.000 0.980 0.000 0.020 0.000
#> SRR1040848     2  0.0000      0.942 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR1040851     3  0.2730      0.827 0.000 0.000 0.808 0.192 0.000 0.000
#> SRR1040850     5  0.0000      0.956 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR1040852     5  0.0000      0.956 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR1040853     5  0.0000      0.956 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR1040854     3  0.2730      0.827 0.000 0.000 0.808 0.192 0.000 0.000
#> SRR1040855     5  0.0000      0.956 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR1040856     4  0.3356      0.921 0.000 0.052 0.000 0.808 0.140 0.000
#> SRR1040857     3  0.2730      0.827 0.000 0.000 0.808 0.192 0.000 0.000
#> SRR1040858     3  0.2730      0.827 0.000 0.000 0.808 0.192 0.000 0.000
#> SRR1040859     4  0.2730      0.884 0.000 0.000 0.000 0.808 0.192 0.000
#> SRR1040860     4  0.3356      0.921 0.000 0.052 0.000 0.808 0.140 0.000
#> SRR1040861     5  0.1387      0.904 0.000 0.000 0.068 0.000 0.932 0.000
#> SRR1040862     4  0.3464      0.792 0.000 0.084 0.000 0.808 0.000 0.108
#> SRR1040863     4  0.3356      0.921 0.000 0.052 0.000 0.808 0.140 0.000
#> SRR1040864     5  0.0000      0.956 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR1040865     5  0.0000      0.956 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR1040866     4  0.2730      0.884 0.000 0.000 0.000 0.808 0.192 0.000
#> SRR1040867     5  0.2340      0.796 0.000 0.000 0.148 0.000 0.852 0.000
#> SRR1040868     1  0.2416      0.781 0.844 0.000 0.000 0.000 0.156 0.000
#> SRR1040869     3  0.2730      0.827 0.000 0.000 0.808 0.192 0.000 0.000
#> SRR1040870     3  0.0000      0.830 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1040871     3  0.2871      0.825 0.004 0.000 0.804 0.192 0.000 0.000
#> SRR1040872     5  0.2631      0.747 0.000 0.000 0.180 0.000 0.820 0.000
#> SRR1040873     2  0.0000      0.942 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR1040874     1  0.0000      0.938 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR1040875     5  0.0000      0.956 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR1040876     1  0.0000      0.938 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR1040877     3  0.0146      0.829 0.000 0.000 0.996 0.000 0.004 0.000
#> SRR1040878     5  0.0000      0.956 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR1040879     6  0.0000      0.990 0.000 0.000 0.000 0.000 0.000 1.000
#> SRR1040880     1  0.2730      0.821 0.808 0.000 0.000 0.192 0.000 0.000
#> SRR1040881     6  0.0000      0.990 0.000 0.000 0.000 0.000 0.000 1.000
#> SRR1040882     3  0.3446      0.519 0.000 0.000 0.692 0.000 0.308 0.000
#> SRR1040883     3  0.2730      0.827 0.000 0.000 0.808 0.192 0.000 0.000
#> SRR1040884     1  0.0000      0.938 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR1040885     3  0.3446      0.519 0.000 0.000 0.692 0.000 0.308 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 15258 rows and 73 columns.
#>   Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'MAD' method.
#>   Subgroups are detected by 'mclust' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 2.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

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

collect_plots(res)

plot of chunk MAD-mclust-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 1.000           0.975       0.988         0.5054 0.494   0.494
#> 3 3 0.741           0.938       0.938         0.2285 0.888   0.773
#> 4 4 0.773           0.762       0.888         0.1933 0.847   0.610
#> 5 5 0.824           0.824       0.903         0.0725 0.885   0.594
#> 6 6 0.725           0.621       0.804         0.0283 0.941   0.723

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
#> SRR1040814     1   0.000      0.996 1.00 0.00
#> SRR1040813     2   0.141      0.975 0.02 0.98
#> SRR1040816     2   0.141      0.975 0.02 0.98
#> SRR1040815     2   0.000      0.979 0.00 1.00
#> SRR1040817     1   0.000      0.996 1.00 0.00
#> SRR1040818     2   0.000      0.979 0.00 1.00
#> SRR1040819     2   0.000      0.979 0.00 1.00
#> SRR1040820     2   0.000      0.979 0.00 1.00
#> SRR1040821     2   0.000      0.979 0.00 1.00
#> SRR1040822     1   0.000      0.996 1.00 0.00
#> SRR1040823     2   0.990      0.239 0.44 0.56
#> SRR1040824     2   0.000      0.979 0.00 1.00
#> SRR1040826     1   0.000      0.996 1.00 0.00
#> SRR1040825     2   0.000      0.979 0.00 1.00
#> SRR1040827     2   0.000      0.979 0.00 1.00
#> SRR1040828     2   0.000      0.979 0.00 1.00
#> SRR1040829     2   0.000      0.979 0.00 1.00
#> SRR1040830     2   0.141      0.975 0.02 0.98
#> SRR1040831     2   0.141      0.975 0.02 0.98
#> SRR1040832     2   0.141      0.975 0.02 0.98
#> SRR1040833     2   0.141      0.975 0.02 0.98
#> SRR1040834     2   0.141      0.975 0.02 0.98
#> SRR1040835     2   0.000      0.979 0.00 1.00
#> SRR1040836     1   0.000      0.996 1.00 0.00
#> SRR1040837     2   0.000      0.979 0.00 1.00
#> SRR1040839     2   0.000      0.979 0.00 1.00
#> SRR1040838     1   0.000      0.996 1.00 0.00
#> SRR1040840     2   0.000      0.979 0.00 1.00
#> SRR1040841     2   0.141      0.975 0.02 0.98
#> SRR1040843     2   0.000      0.979 0.00 1.00
#> SRR1040842     1   0.141      0.983 0.98 0.02
#> SRR1040845     1   0.141      0.983 0.98 0.02
#> SRR1040844     2   0.141      0.975 0.02 0.98
#> SRR1040846     2   0.000      0.979 0.00 1.00
#> SRR1040847     2   0.141      0.975 0.02 0.98
#> SRR1040849     1   0.000      0.996 1.00 0.00
#> SRR1040848     2   0.000      0.979 0.00 1.00
#> SRR1040851     1   0.000      0.996 1.00 0.00
#> SRR1040850     1   0.000      0.996 1.00 0.00
#> SRR1040852     1   0.000      0.996 1.00 0.00
#> SRR1040853     1   0.000      0.996 1.00 0.00
#> SRR1040854     1   0.000      0.996 1.00 0.00
#> SRR1040855     1   0.000      0.996 1.00 0.00
#> SRR1040856     1   0.141      0.983 0.98 0.02
#> SRR1040857     1   0.000      0.996 1.00 0.00
#> SRR1040858     1   0.000      0.996 1.00 0.00
#> SRR1040859     1   0.141      0.983 0.98 0.02
#> SRR1040860     1   0.141      0.983 0.98 0.02
#> SRR1040861     1   0.000      0.996 1.00 0.00
#> SRR1040862     1   0.141      0.983 0.98 0.02
#> SRR1040863     1   0.141      0.983 0.98 0.02
#> SRR1040864     1   0.000      0.996 1.00 0.00
#> SRR1040865     1   0.000      0.996 1.00 0.00
#> SRR1040866     1   0.141      0.983 0.98 0.02
#> SRR1040867     1   0.000      0.996 1.00 0.00
#> SRR1040868     1   0.000      0.996 1.00 0.00
#> SRR1040869     1   0.000      0.996 1.00 0.00
#> SRR1040870     1   0.000      0.996 1.00 0.00
#> SRR1040871     1   0.000      0.996 1.00 0.00
#> SRR1040872     1   0.000      0.996 1.00 0.00
#> SRR1040873     2   0.000      0.979 0.00 1.00
#> SRR1040874     2   0.141      0.975 0.02 0.98
#> SRR1040875     1   0.000      0.996 1.00 0.00
#> SRR1040876     2   0.141      0.975 0.02 0.98
#> SRR1040877     1   0.000      0.996 1.00 0.00
#> SRR1040878     1   0.000      0.996 1.00 0.00
#> SRR1040879     2   0.000      0.979 0.00 1.00
#> SRR1040880     1   0.000      0.996 1.00 0.00
#> SRR1040881     2   0.000      0.979 0.00 1.00
#> SRR1040882     2   0.141      0.975 0.02 0.98
#> SRR1040883     1   0.000      0.996 1.00 0.00
#> SRR1040884     2   0.141      0.975 0.02 0.98
#> SRR1040885     1   0.000      0.996 1.00 0.00

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>            class entropy silhouette    p1    p2    p3
#> SRR1040814     3  0.3267      0.921 0.116 0.000 0.884
#> SRR1040813     1  0.3267      0.909 0.884 0.116 0.000
#> SRR1040816     1  0.4750      0.924 0.784 0.216 0.000
#> SRR1040815     2  0.0000      0.984 0.000 1.000 0.000
#> SRR1040817     3  0.3267      0.921 0.116 0.000 0.884
#> SRR1040818     1  0.5098      0.888 0.752 0.248 0.000
#> SRR1040819     2  0.0000      0.984 0.000 1.000 0.000
#> SRR1040820     2  0.0000      0.984 0.000 1.000 0.000
#> SRR1040821     2  0.0000      0.984 0.000 1.000 0.000
#> SRR1040822     3  0.4002      0.898 0.160 0.000 0.840
#> SRR1040823     1  0.0424      0.796 0.992 0.008 0.000
#> SRR1040824     2  0.0000      0.984 0.000 1.000 0.000
#> SRR1040826     3  0.4399      0.877 0.188 0.000 0.812
#> SRR1040825     2  0.0000      0.984 0.000 1.000 0.000
#> SRR1040827     2  0.0000      0.984 0.000 1.000 0.000
#> SRR1040828     2  0.0000      0.984 0.000 1.000 0.000
#> SRR1040829     2  0.0000      0.984 0.000 1.000 0.000
#> SRR1040830     2  0.5178      0.542 0.256 0.744 0.000
#> SRR1040831     1  0.4750      0.924 0.784 0.216 0.000
#> SRR1040832     2  0.0000      0.984 0.000 1.000 0.000
#> SRR1040833     1  0.4750      0.924 0.784 0.216 0.000
#> SRR1040834     1  0.4750      0.924 0.784 0.216 0.000
#> SRR1040835     2  0.0000      0.984 0.000 1.000 0.000
#> SRR1040836     3  0.3551      0.865 0.132 0.000 0.868
#> SRR1040837     2  0.0000      0.984 0.000 1.000 0.000
#> SRR1040839     2  0.0000      0.984 0.000 1.000 0.000
#> SRR1040838     3  0.2537      0.934 0.080 0.000 0.920
#> SRR1040840     2  0.0000      0.984 0.000 1.000 0.000
#> SRR1040841     1  0.4452      0.925 0.808 0.192 0.000
#> SRR1040843     2  0.0000      0.984 0.000 1.000 0.000
#> SRR1040842     3  0.3267      0.921 0.116 0.000 0.884
#> SRR1040845     3  0.0000      0.955 0.000 0.000 1.000
#> SRR1040844     1  0.3267      0.909 0.884 0.116 0.000
#> SRR1040846     2  0.0000      0.984 0.000 1.000 0.000
#> SRR1040847     1  0.4750      0.924 0.784 0.216 0.000
#> SRR1040849     3  0.3116      0.924 0.108 0.000 0.892
#> SRR1040848     2  0.0000      0.984 0.000 1.000 0.000
#> SRR1040851     3  0.0000      0.955 0.000 0.000 1.000
#> SRR1040850     3  0.3192      0.923 0.112 0.000 0.888
#> SRR1040852     3  0.0000      0.955 0.000 0.000 1.000
#> SRR1040853     3  0.0000      0.955 0.000 0.000 1.000
#> SRR1040854     3  0.0000      0.955 0.000 0.000 1.000
#> SRR1040855     3  0.3267      0.921 0.116 0.000 0.884
#> SRR1040856     3  0.0000      0.955 0.000 0.000 1.000
#> SRR1040857     3  0.0000      0.955 0.000 0.000 1.000
#> SRR1040858     3  0.0000      0.955 0.000 0.000 1.000
#> SRR1040859     3  0.0000      0.955 0.000 0.000 1.000
#> SRR1040860     3  0.0000      0.955 0.000 0.000 1.000
#> SRR1040861     3  0.3038      0.926 0.104 0.000 0.896
#> SRR1040862     3  0.0000      0.955 0.000 0.000 1.000
#> SRR1040863     3  0.0000      0.955 0.000 0.000 1.000
#> SRR1040864     3  0.3267      0.921 0.116 0.000 0.884
#> SRR1040865     3  0.0000      0.955 0.000 0.000 1.000
#> SRR1040866     3  0.0000      0.955 0.000 0.000 1.000
#> SRR1040867     3  0.0000      0.955 0.000 0.000 1.000
#> SRR1040868     3  0.3192      0.884 0.112 0.000 0.888
#> SRR1040869     3  0.0000      0.955 0.000 0.000 1.000
#> SRR1040870     3  0.0000      0.955 0.000 0.000 1.000
#> SRR1040871     3  0.0000      0.955 0.000 0.000 1.000
#> SRR1040872     3  0.0000      0.955 0.000 0.000 1.000
#> SRR1040873     2  0.0000      0.984 0.000 1.000 0.000
#> SRR1040874     1  0.3686      0.917 0.860 0.140 0.000
#> SRR1040875     3  0.0000      0.955 0.000 0.000 1.000
#> SRR1040876     1  0.4750      0.924 0.784 0.216 0.000
#> SRR1040877     3  0.3038      0.926 0.104 0.000 0.896
#> SRR1040878     3  0.0000      0.955 0.000 0.000 1.000
#> SRR1040879     2  0.0000      0.984 0.000 1.000 0.000
#> SRR1040880     3  0.3192      0.884 0.112 0.000 0.888
#> SRR1040881     2  0.0000      0.984 0.000 1.000 0.000
#> SRR1040882     1  0.3267      0.909 0.884 0.116 0.000
#> SRR1040883     3  0.0000      0.955 0.000 0.000 1.000
#> SRR1040884     1  0.3267      0.909 0.884 0.116 0.000
#> SRR1040885     3  0.3267      0.921 0.116 0.000 0.884

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> SRR1040814     3  0.0000     0.7385 0.000 0.000 1.000 0.000
#> SRR1040813     1  0.0000     0.9035 1.000 0.000 0.000 0.000
#> SRR1040816     1  0.1474     0.8764 0.948 0.052 0.000 0.000
#> SRR1040815     2  0.0000     0.9746 0.000 1.000 0.000 0.000
#> SRR1040817     3  0.0592     0.7470 0.000 0.000 0.984 0.016
#> SRR1040818     1  0.4866     0.3409 0.596 0.404 0.000 0.000
#> SRR1040819     2  0.0000     0.9746 0.000 1.000 0.000 0.000
#> SRR1040820     2  0.0000     0.9746 0.000 1.000 0.000 0.000
#> SRR1040821     2  0.0000     0.9746 0.000 1.000 0.000 0.000
#> SRR1040822     3  0.0000     0.7385 0.000 0.000 1.000 0.000
#> SRR1040823     1  0.2921     0.7643 0.860 0.000 0.140 0.000
#> SRR1040824     2  0.0000     0.9746 0.000 1.000 0.000 0.000
#> SRR1040826     3  0.0000     0.7385 0.000 0.000 1.000 0.000
#> SRR1040825     2  0.0000     0.9746 0.000 1.000 0.000 0.000
#> SRR1040827     2  0.0000     0.9746 0.000 1.000 0.000 0.000
#> SRR1040828     2  0.4746     0.3435 0.368 0.632 0.000 0.000
#> SRR1040829     2  0.0188     0.9712 0.004 0.996 0.000 0.000
#> SRR1040830     1  0.3486     0.7388 0.812 0.188 0.000 0.000
#> SRR1040831     1  0.0000     0.9035 1.000 0.000 0.000 0.000
#> SRR1040832     1  0.4992     0.1062 0.524 0.476 0.000 0.000
#> SRR1040833     1  0.0469     0.9030 0.988 0.000 0.000 0.012
#> SRR1040834     1  0.0000     0.9035 1.000 0.000 0.000 0.000
#> SRR1040835     2  0.1022     0.9429 0.032 0.968 0.000 0.000
#> SRR1040836     4  0.5250     0.0399 0.008 0.000 0.440 0.552
#> SRR1040837     2  0.0000     0.9746 0.000 1.000 0.000 0.000
#> SRR1040839     2  0.0000     0.9746 0.000 1.000 0.000 0.000
#> SRR1040838     3  0.4998    -0.0266 0.000 0.000 0.512 0.488
#> SRR1040840     2  0.0000     0.9746 0.000 1.000 0.000 0.000
#> SRR1040841     1  0.0469     0.9030 0.988 0.000 0.000 0.012
#> SRR1040843     2  0.0000     0.9746 0.000 1.000 0.000 0.000
#> SRR1040842     3  0.4661     0.2503 0.000 0.000 0.652 0.348
#> SRR1040845     4  0.0469     0.8440 0.000 0.000 0.012 0.988
#> SRR1040844     1  0.0000     0.9035 1.000 0.000 0.000 0.000
#> SRR1040846     2  0.0000     0.9746 0.000 1.000 0.000 0.000
#> SRR1040847     1  0.0469     0.9030 0.988 0.000 0.000 0.012
#> SRR1040849     3  0.2589     0.7749 0.000 0.000 0.884 0.116
#> SRR1040848     2  0.0000     0.9746 0.000 1.000 0.000 0.000
#> SRR1040851     3  0.4164     0.7498 0.000 0.000 0.736 0.264
#> SRR1040850     3  0.2760     0.6670 0.000 0.000 0.872 0.128
#> SRR1040852     4  0.4998    -0.1450 0.000 0.000 0.488 0.512
#> SRR1040853     4  0.4967    -0.1911 0.000 0.000 0.452 0.548
#> SRR1040854     3  0.4134     0.7513 0.000 0.000 0.740 0.260
#> SRR1040855     3  0.2011     0.7682 0.000 0.000 0.920 0.080
#> SRR1040856     4  0.2011     0.7841 0.000 0.000 0.080 0.920
#> SRR1040857     3  0.4134     0.7513 0.000 0.000 0.740 0.260
#> SRR1040858     3  0.4134     0.7513 0.000 0.000 0.740 0.260
#> SRR1040859     4  0.0469     0.8440 0.000 0.000 0.012 0.988
#> SRR1040860     4  0.0469     0.8440 0.000 0.000 0.012 0.988
#> SRR1040861     3  0.2589     0.7749 0.000 0.000 0.884 0.116
#> SRR1040862     4  0.0469     0.8440 0.000 0.000 0.012 0.988
#> SRR1040863     4  0.0469     0.8440 0.000 0.000 0.012 0.988
#> SRR1040864     3  0.4277     0.4840 0.000 0.000 0.720 0.280
#> SRR1040865     4  0.0592     0.8430 0.000 0.000 0.016 0.984
#> SRR1040866     4  0.0469     0.8440 0.000 0.000 0.012 0.988
#> SRR1040867     3  0.4193     0.7478 0.000 0.000 0.732 0.268
#> SRR1040868     4  0.1389     0.8247 0.000 0.000 0.048 0.952
#> SRR1040869     3  0.4134     0.7513 0.000 0.000 0.740 0.260
#> SRR1040870     3  0.3400     0.7745 0.000 0.000 0.820 0.180
#> SRR1040871     3  0.4134     0.7513 0.000 0.000 0.740 0.260
#> SRR1040872     3  0.3801     0.7677 0.000 0.000 0.780 0.220
#> SRR1040873     2  0.0000     0.9746 0.000 1.000 0.000 0.000
#> SRR1040874     1  0.0469     0.9030 0.988 0.000 0.000 0.012
#> SRR1040875     3  0.4992     0.3766 0.000 0.000 0.524 0.476
#> SRR1040876     1  0.0469     0.9030 0.988 0.000 0.000 0.012
#> SRR1040877     3  0.2589     0.7749 0.000 0.000 0.884 0.116
#> SRR1040878     4  0.0592     0.8430 0.000 0.000 0.016 0.984
#> SRR1040879     2  0.0000     0.9746 0.000 1.000 0.000 0.000
#> SRR1040880     4  0.0817     0.8388 0.000 0.000 0.024 0.976
#> SRR1040881     2  0.0000     0.9746 0.000 1.000 0.000 0.000
#> SRR1040882     1  0.0000     0.9035 1.000 0.000 0.000 0.000
#> SRR1040883     3  0.4134     0.7513 0.000 0.000 0.740 0.260
#> SRR1040884     1  0.0000     0.9035 1.000 0.000 0.000 0.000
#> SRR1040885     3  0.0336     0.7385 0.000 0.000 0.992 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
#> SRR1040814     5  0.0404     0.8443 0.000 0.000 0.012 0.000 0.988
#> SRR1040813     1  0.0000     0.9246 1.000 0.000 0.000 0.000 0.000
#> SRR1040816     1  0.0162     0.9230 0.996 0.004 0.000 0.000 0.000
#> SRR1040815     2  0.0000     0.9690 0.000 1.000 0.000 0.000 0.000
#> SRR1040817     5  0.0703     0.8459 0.000 0.000 0.024 0.000 0.976
#> SRR1040818     2  0.3530     0.7392 0.204 0.784 0.012 0.000 0.000
#> SRR1040819     2  0.0404     0.9665 0.000 0.988 0.012 0.000 0.000
#> SRR1040820     2  0.0000     0.9690 0.000 1.000 0.000 0.000 0.000
#> SRR1040821     2  0.0000     0.9690 0.000 1.000 0.000 0.000 0.000
#> SRR1040822     5  0.0404     0.8443 0.000 0.000 0.012 0.000 0.988
#> SRR1040823     1  0.3983     0.4353 0.660 0.000 0.000 0.000 0.340
#> SRR1040824     2  0.0000     0.9690 0.000 1.000 0.000 0.000 0.000
#> SRR1040826     5  0.0404     0.8443 0.000 0.000 0.012 0.000 0.988
#> SRR1040825     2  0.0566     0.9653 0.004 0.984 0.012 0.000 0.000
#> SRR1040827     2  0.0000     0.9690 0.000 1.000 0.000 0.000 0.000
#> SRR1040828     1  0.5486     0.5676 0.648 0.268 0.016 0.068 0.000
#> SRR1040829     2  0.1942     0.9231 0.000 0.920 0.012 0.068 0.000
#> SRR1040830     1  0.2908     0.8562 0.884 0.032 0.016 0.068 0.000
#> SRR1040831     1  0.0000     0.9246 1.000 0.000 0.000 0.000 0.000
#> SRR1040832     1  0.4543     0.7430 0.768 0.152 0.016 0.064 0.000
#> SRR1040833     1  0.0162     0.9246 0.996 0.000 0.004 0.000 0.000
#> SRR1040834     1  0.0000     0.9246 1.000 0.000 0.000 0.000 0.000
#> SRR1040835     2  0.4275     0.7780 0.136 0.792 0.020 0.052 0.000
#> SRR1040836     3  0.4021     0.6953 0.000 0.000 0.780 0.168 0.052
#> SRR1040837     2  0.0404     0.9665 0.000 0.988 0.012 0.000 0.000
#> SRR1040839     2  0.0000     0.9690 0.000 1.000 0.000 0.000 0.000
#> SRR1040838     5  0.3723     0.7854 0.000 0.000 0.152 0.044 0.804
#> SRR1040840     2  0.0000     0.9690 0.000 1.000 0.000 0.000 0.000
#> SRR1040841     1  0.0162     0.9246 0.996 0.000 0.004 0.000 0.000
#> SRR1040843     2  0.0000     0.9690 0.000 1.000 0.000 0.000 0.000
#> SRR1040842     5  0.0451     0.8359 0.000 0.000 0.004 0.008 0.988
#> SRR1040845     4  0.1544     0.9350 0.000 0.000 0.068 0.932 0.000
#> SRR1040844     1  0.0000     0.9246 1.000 0.000 0.000 0.000 0.000
#> SRR1040846     2  0.0290     0.9675 0.000 0.992 0.008 0.000 0.000
#> SRR1040847     1  0.0162     0.9246 0.996 0.000 0.004 0.000 0.000
#> SRR1040849     5  0.3274     0.7829 0.000 0.000 0.220 0.000 0.780
#> SRR1040848     2  0.0000     0.9690 0.000 1.000 0.000 0.000 0.000
#> SRR1040851     3  0.0880     0.7996 0.000 0.000 0.968 0.000 0.032
#> SRR1040850     5  0.0162     0.8406 0.000 0.000 0.004 0.000 0.996
#> SRR1040852     5  0.5644     0.4103 0.000 0.000 0.316 0.100 0.584
#> SRR1040853     3  0.3563     0.6648 0.000 0.000 0.780 0.208 0.012
#> SRR1040854     3  0.1732     0.7810 0.000 0.000 0.920 0.000 0.080
#> SRR1040855     5  0.2230     0.8359 0.000 0.000 0.116 0.000 0.884
#> SRR1040856     4  0.1914     0.9252 0.000 0.000 0.060 0.924 0.016
#> SRR1040857     3  0.3177     0.6128 0.000 0.000 0.792 0.000 0.208
#> SRR1040858     3  0.0880     0.7996 0.000 0.000 0.968 0.000 0.032
#> SRR1040859     4  0.1544     0.9350 0.000 0.000 0.068 0.932 0.000
#> SRR1040860     4  0.1544     0.9350 0.000 0.000 0.068 0.932 0.000
#> SRR1040861     5  0.3274     0.7929 0.000 0.000 0.220 0.000 0.780
#> SRR1040862     4  0.1638     0.9341 0.000 0.000 0.064 0.932 0.004
#> SRR1040863     4  0.1638     0.9341 0.000 0.000 0.064 0.932 0.004
#> SRR1040864     5  0.2505     0.8333 0.000 0.000 0.092 0.020 0.888
#> SRR1040865     4  0.4410     0.2092 0.000 0.000 0.440 0.556 0.004
#> SRR1040866     4  0.1544     0.9350 0.000 0.000 0.068 0.932 0.000
#> SRR1040867     3  0.4150     0.0838 0.000 0.000 0.612 0.000 0.388
#> SRR1040868     3  0.3783     0.5923 0.000 0.000 0.740 0.252 0.008
#> SRR1040869     3  0.2020     0.7635 0.000 0.000 0.900 0.000 0.100
#> SRR1040870     5  0.3684     0.7429 0.000 0.000 0.280 0.000 0.720
#> SRR1040871     3  0.0880     0.7996 0.000 0.000 0.968 0.000 0.032
#> SRR1040872     5  0.3999     0.6532 0.000 0.000 0.344 0.000 0.656
#> SRR1040873     2  0.0000     0.9690 0.000 1.000 0.000 0.000 0.000
#> SRR1040874     1  0.0162     0.9246 0.996 0.000 0.004 0.000 0.000
#> SRR1040875     3  0.2900     0.7521 0.000 0.000 0.864 0.108 0.028
#> SRR1040876     1  0.0162     0.9246 0.996 0.000 0.004 0.000 0.000
#> SRR1040877     5  0.3661     0.7465 0.000 0.000 0.276 0.000 0.724
#> SRR1040878     4  0.1764     0.9323 0.000 0.000 0.064 0.928 0.008
#> SRR1040879     2  0.0807     0.9612 0.012 0.976 0.012 0.000 0.000
#> SRR1040880     3  0.4310     0.2387 0.000 0.000 0.604 0.392 0.004
#> SRR1040881     2  0.0566     0.9653 0.004 0.984 0.012 0.000 0.000
#> SRR1040882     1  0.0000     0.9246 1.000 0.000 0.000 0.000 0.000
#> SRR1040883     3  0.0880     0.7996 0.000 0.000 0.968 0.000 0.032
#> SRR1040884     1  0.0162     0.9246 0.996 0.000 0.004 0.000 0.000
#> SRR1040885     5  0.0404     0.8443 0.000 0.000 0.012 0.000 0.988

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>            class entropy silhouette    p1    p2    p3    p4    p5    p6
#> SRR1040814     5  0.1765     0.7499 0.000 0.000 0.096 0.000 0.904 0.000
#> SRR1040813     1  0.3139     0.7867 0.812 0.000 0.000 0.000 0.028 0.160
#> SRR1040816     1  0.2664     0.7742 0.816 0.000 0.000 0.000 0.000 0.184
#> SRR1040815     2  0.5262    -0.2908 0.000 0.496 0.084 0.004 0.000 0.416
#> SRR1040817     5  0.1765     0.7499 0.000 0.000 0.096 0.000 0.904 0.000
#> SRR1040818     6  0.7124     0.3784 0.316 0.240 0.080 0.000 0.000 0.364
#> SRR1040819     6  0.5281     0.2694 0.000 0.452 0.084 0.004 0.000 0.460
#> SRR1040820     2  0.0000     0.8731 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR1040821     2  0.0000     0.8731 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR1040822     5  0.1765     0.7499 0.000 0.000 0.096 0.000 0.904 0.000
#> SRR1040823     1  0.5453     0.3642 0.584 0.000 0.072 0.000 0.312 0.032
#> SRR1040824     2  0.2309     0.7981 0.000 0.888 0.084 0.000 0.000 0.028
#> SRR1040826     5  0.1765     0.7499 0.000 0.000 0.096 0.000 0.904 0.000
#> SRR1040825     6  0.5258     0.3340 0.000 0.412 0.084 0.004 0.000 0.500
#> SRR1040827     2  0.1610     0.8271 0.000 0.916 0.084 0.000 0.000 0.000
#> SRR1040828     6  0.5095     0.0927 0.344 0.072 0.008 0.000 0.000 0.576
#> SRR1040829     6  0.3198     0.5061 0.000 0.260 0.000 0.000 0.000 0.740
#> SRR1040830     1  0.4208     0.3395 0.536 0.004 0.008 0.000 0.000 0.452
#> SRR1040831     1  0.0000     0.8568 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR1040832     6  0.5188    -0.1105 0.412 0.068 0.008 0.000 0.000 0.512
#> SRR1040833     1  0.0000     0.8568 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR1040834     1  0.2300     0.8028 0.856 0.000 0.000 0.000 0.000 0.144
#> SRR1040835     6  0.1757     0.5260 0.008 0.076 0.000 0.000 0.000 0.916
#> SRR1040836     5  0.6097    -0.0669 0.000 0.000 0.360 0.084 0.496 0.060
#> SRR1040837     2  0.1141     0.8696 0.000 0.948 0.000 0.000 0.000 0.052
#> SRR1040839     2  0.0713     0.8770 0.000 0.972 0.000 0.000 0.000 0.028
#> SRR1040838     5  0.1493     0.7175 0.000 0.000 0.056 0.004 0.936 0.004
#> SRR1040840     2  0.0937     0.8760 0.000 0.960 0.000 0.000 0.000 0.040
#> SRR1040841     1  0.0000     0.8568 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR1040843     2  0.0937     0.8760 0.000 0.960 0.000 0.000 0.000 0.040
#> SRR1040842     5  0.2301     0.7002 0.000 0.000 0.000 0.096 0.884 0.020
#> SRR1040845     4  0.0146     0.8231 0.000 0.000 0.004 0.996 0.000 0.000
#> SRR1040844     1  0.0000     0.8568 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR1040846     2  0.0937     0.8760 0.000 0.960 0.000 0.000 0.000 0.040
#> SRR1040847     1  0.0000     0.8568 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR1040849     5  0.3607     0.5728 0.000 0.000 0.348 0.000 0.652 0.000
#> SRR1040848     2  0.1556     0.8302 0.000 0.920 0.080 0.000 0.000 0.000
#> SRR1040851     3  0.2846     0.7131 0.000 0.000 0.856 0.084 0.060 0.000
#> SRR1040850     5  0.0508     0.7244 0.000 0.000 0.000 0.004 0.984 0.012
#> SRR1040852     5  0.3669     0.6141 0.000 0.000 0.084 0.104 0.804 0.008
#> SRR1040853     3  0.6103     0.2924 0.000 0.000 0.368 0.344 0.288 0.000
#> SRR1040854     3  0.1967     0.7268 0.000 0.000 0.904 0.084 0.012 0.000
#> SRR1040855     5  0.2053     0.7288 0.000 0.000 0.108 0.004 0.888 0.000
#> SRR1040856     4  0.3265     0.5881 0.000 0.000 0.004 0.748 0.248 0.000
#> SRR1040857     3  0.3125     0.6978 0.000 0.000 0.836 0.080 0.084 0.000
#> SRR1040858     3  0.1866     0.7275 0.000 0.000 0.908 0.084 0.008 0.000
#> SRR1040859     4  0.0508     0.8177 0.000 0.000 0.004 0.984 0.012 0.000
#> SRR1040860     4  0.0146     0.8231 0.000 0.000 0.004 0.996 0.000 0.000
#> SRR1040861     5  0.3468     0.5802 0.000 0.000 0.284 0.004 0.712 0.000
#> SRR1040862     4  0.0146     0.8231 0.000 0.000 0.004 0.996 0.000 0.000
#> SRR1040863     4  0.0146     0.8231 0.000 0.000 0.004 0.996 0.000 0.000
#> SRR1040864     5  0.2001     0.7289 0.000 0.000 0.048 0.040 0.912 0.000
#> SRR1040865     4  0.6625     0.0180 0.000 0.000 0.220 0.452 0.284 0.044
#> SRR1040866     4  0.0146     0.8231 0.000 0.000 0.004 0.996 0.000 0.000
#> SRR1040867     3  0.5136     0.0611 0.000 0.000 0.496 0.084 0.420 0.000
#> SRR1040868     3  0.6947     0.3192 0.000 0.000 0.388 0.300 0.252 0.060
#> SRR1040869     3  0.1967     0.7268 0.000 0.000 0.904 0.084 0.012 0.000
#> SRR1040870     5  0.4797     0.2586 0.000 0.000 0.444 0.052 0.504 0.000
#> SRR1040871     3  0.1866     0.7275 0.000 0.000 0.908 0.084 0.008 0.000
#> SRR1040872     5  0.4798     0.2692 0.000 0.000 0.376 0.060 0.564 0.000
#> SRR1040873     2  0.0632     0.8775 0.000 0.976 0.000 0.000 0.000 0.024
#> SRR1040874     1  0.0000     0.8568 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR1040875     3  0.5659     0.5079 0.000 0.000 0.552 0.156 0.284 0.008
#> SRR1040876     1  0.1327     0.8414 0.936 0.000 0.000 0.000 0.000 0.064
#> SRR1040877     5  0.3717     0.5175 0.000 0.000 0.384 0.000 0.616 0.000
#> SRR1040878     4  0.3468     0.5716 0.000 0.000 0.008 0.728 0.264 0.000
#> SRR1040879     6  0.3248     0.5258 0.000 0.224 0.004 0.004 0.000 0.768
#> SRR1040880     3  0.6842     0.2177 0.000 0.000 0.368 0.364 0.212 0.056
#> SRR1040881     6  0.5274     0.2978 0.000 0.432 0.084 0.004 0.000 0.480
#> SRR1040882     1  0.3027     0.7939 0.824 0.000 0.000 0.000 0.028 0.148
#> SRR1040883     3  0.1866     0.7275 0.000 0.000 0.908 0.084 0.008 0.000
#> SRR1040884     1  0.0000     0.8568 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR1040885     5  0.1765     0.7499 0.000 0.000 0.096 0.000 0.904 0.000

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

consensus_heatmap(res, k = 2)

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

consensus_heatmap(res, k = 3)

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

consensus_heatmap(res, k = 4)

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

consensus_heatmap(res, k = 5)

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

consensus_heatmap(res, k = 6)

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

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

membership_heatmap(res, k = 2)

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

membership_heatmap(res, k = 3)

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

membership_heatmap(res, k = 4)

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

membership_heatmap(res, k = 5)

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

membership_heatmap(res, k = 6)

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

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

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

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

get_signatures(res, k = 3)

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

get_signatures(res, k = 4)

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

get_signatures(res, k = 5)

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

get_signatures(res, k = 6)

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

Signature heatmaps where rows are not scaled:

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

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

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

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

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

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

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

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

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

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

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk MAD-mclust-signature_compare

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

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

An example of the output of tb is:

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

The columns in tb are:

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

UMAP plot which shows how samples are separated.

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

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

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

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

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

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

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

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

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

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

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk MAD-mclust-collect-classes

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

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

collect_plots(res)

plot of chunk MAD-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.783           0.857       0.946         0.3998 0.597   0.597
#> 3 3 0.714           0.792       0.917         0.5982 0.647   0.459
#> 4 4 0.492           0.358       0.644         0.1038 0.740   0.443
#> 5 5 0.552           0.584       0.772         0.0533 0.804   0.502
#> 6 6 0.552           0.549       0.749         0.0507 0.886   0.627

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
#> SRR1040814     1   0.000    0.95265 1.000 0.000
#> SRR1040813     1   0.000    0.95265 1.000 0.000
#> SRR1040816     1   0.000    0.95265 1.000 0.000
#> SRR1040815     2   0.000    0.89323 0.000 1.000
#> SRR1040817     1   0.000    0.95265 1.000 0.000
#> SRR1040818     1   0.000    0.95265 1.000 0.000
#> SRR1040819     2   0.000    0.89323 0.000 1.000
#> SRR1040820     2   0.000    0.89323 0.000 1.000
#> SRR1040821     2   0.000    0.89323 0.000 1.000
#> SRR1040822     1   0.000    0.95265 1.000 0.000
#> SRR1040823     1   0.000    0.95265 1.000 0.000
#> SRR1040824     2   0.000    0.89323 0.000 1.000
#> SRR1040826     1   0.000    0.95265 1.000 0.000
#> SRR1040825     2   0.615    0.79583 0.152 0.848
#> SRR1040827     2   0.000    0.89323 0.000 1.000
#> SRR1040828     1   0.891    0.50656 0.692 0.308
#> SRR1040829     2   0.000    0.89323 0.000 1.000
#> SRR1040830     1   0.000    0.95265 1.000 0.000
#> SRR1040831     1   0.000    0.95265 1.000 0.000
#> SRR1040832     1   0.000    0.95265 1.000 0.000
#> SRR1040833     1   0.000    0.95265 1.000 0.000
#> SRR1040834     1   0.000    0.95265 1.000 0.000
#> SRR1040835     1   0.605    0.78621 0.852 0.148
#> SRR1040836     1   0.000    0.95265 1.000 0.000
#> SRR1040837     2   0.605    0.80015 0.148 0.852
#> SRR1040839     2   0.000    0.89323 0.000 1.000
#> SRR1040838     1   0.000    0.95265 1.000 0.000
#> SRR1040840     2   0.000    0.89323 0.000 1.000
#> SRR1040841     1   0.000    0.95265 1.000 0.000
#> SRR1040843     2   0.000    0.89323 0.000 1.000
#> SRR1040842     1   0.983    0.18030 0.576 0.424
#> SRR1040845     2   1.000    0.10912 0.488 0.512
#> SRR1040844     1   0.000    0.95265 1.000 0.000
#> SRR1040846     2   0.574    0.81131 0.136 0.864
#> SRR1040847     1   0.000    0.95265 1.000 0.000
#> SRR1040849     1   0.000    0.95265 1.000 0.000
#> SRR1040848     2   0.000    0.89323 0.000 1.000
#> SRR1040851     1   0.000    0.95265 1.000 0.000
#> SRR1040850     1   0.000    0.95265 1.000 0.000
#> SRR1040852     1   0.000    0.95265 1.000 0.000
#> SRR1040853     1   0.000    0.95265 1.000 0.000
#> SRR1040854     1   0.000    0.95265 1.000 0.000
#> SRR1040855     1   0.000    0.95265 1.000 0.000
#> SRR1040856     1   0.997    0.00853 0.532 0.468
#> SRR1040857     1   0.000    0.95265 1.000 0.000
#> SRR1040858     1   0.000    0.95265 1.000 0.000
#> SRR1040859     1   0.891    0.50656 0.692 0.308
#> SRR1040860     2   0.993    0.23478 0.452 0.548
#> SRR1040861     1   0.000    0.95265 1.000 0.000
#> SRR1040862     2   0.973    0.36958 0.404 0.596
#> SRR1040863     1   0.955    0.33342 0.624 0.376
#> SRR1040864     1   0.000    0.95265 1.000 0.000
#> SRR1040865     1   0.000    0.95265 1.000 0.000
#> SRR1040866     1   0.443    0.85696 0.908 0.092
#> SRR1040867     1   0.000    0.95265 1.000 0.000
#> SRR1040868     1   0.000    0.95265 1.000 0.000
#> SRR1040869     1   0.000    0.95265 1.000 0.000
#> SRR1040870     1   0.000    0.95265 1.000 0.000
#> SRR1040871     1   0.000    0.95265 1.000 0.000
#> SRR1040872     1   0.000    0.95265 1.000 0.000
#> SRR1040873     2   0.000    0.89323 0.000 1.000
#> SRR1040874     1   0.000    0.95265 1.000 0.000
#> SRR1040875     1   0.000    0.95265 1.000 0.000
#> SRR1040876     1   0.000    0.95265 1.000 0.000
#> SRR1040877     1   0.000    0.95265 1.000 0.000
#> SRR1040878     1   0.000    0.95265 1.000 0.000
#> SRR1040879     2   0.000    0.89323 0.000 1.000
#> SRR1040880     1   0.000    0.95265 1.000 0.000
#> SRR1040881     2   0.373    0.85674 0.072 0.928
#> SRR1040882     1   0.000    0.95265 1.000 0.000
#> SRR1040883     1   0.000    0.95265 1.000 0.000
#> SRR1040884     1   0.000    0.95265 1.000 0.000
#> SRR1040885     1   0.000    0.95265 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
#> SRR1040814     3  0.0592     0.9072 0.012 0.000 0.988
#> SRR1040813     3  0.0000     0.9095 0.000 0.000 1.000
#> SRR1040816     1  0.0000     0.8838 1.000 0.000 0.000
#> SRR1040815     1  0.5678     0.5097 0.684 0.316 0.000
#> SRR1040817     3  0.1031     0.9019 0.024 0.000 0.976
#> SRR1040818     1  0.0000     0.8838 1.000 0.000 0.000
#> SRR1040819     1  0.3267     0.7905 0.884 0.116 0.000
#> SRR1040820     2  0.0000     0.8858 0.000 1.000 0.000
#> SRR1040821     2  0.0000     0.8858 0.000 1.000 0.000
#> SRR1040822     3  0.0424     0.9082 0.008 0.000 0.992
#> SRR1040823     3  0.0000     0.9095 0.000 0.000 1.000
#> SRR1040824     2  0.0000     0.8858 0.000 1.000 0.000
#> SRR1040826     3  0.0000     0.9095 0.000 0.000 1.000
#> SRR1040825     1  0.0424     0.8798 0.992 0.008 0.000
#> SRR1040827     2  0.0000     0.8858 0.000 1.000 0.000
#> SRR1040828     2  0.6936     0.0922 0.016 0.524 0.460
#> SRR1040829     2  0.0000     0.8858 0.000 1.000 0.000
#> SRR1040830     1  0.0000     0.8838 1.000 0.000 0.000
#> SRR1040831     1  0.0000     0.8838 1.000 0.000 0.000
#> SRR1040832     1  0.2066     0.8493 0.940 0.000 0.060
#> SRR1040833     1  0.0000     0.8838 1.000 0.000 0.000
#> SRR1040834     3  0.5733     0.5181 0.324 0.000 0.676
#> SRR1040835     1  0.0000     0.8838 1.000 0.000 0.000
#> SRR1040836     1  0.1163     0.8711 0.972 0.000 0.028
#> SRR1040837     2  0.0424     0.8814 0.000 0.992 0.008
#> SRR1040839     2  0.0000     0.8858 0.000 1.000 0.000
#> SRR1040838     3  0.0000     0.9095 0.000 0.000 1.000
#> SRR1040840     2  0.0000     0.8858 0.000 1.000 0.000
#> SRR1040841     1  0.0000     0.8838 1.000 0.000 0.000
#> SRR1040843     2  0.0000     0.8858 0.000 1.000 0.000
#> SRR1040842     3  0.1643     0.8834 0.000 0.044 0.956
#> SRR1040845     2  0.5988     0.3902 0.000 0.632 0.368
#> SRR1040844     1  0.0000     0.8838 1.000 0.000 0.000
#> SRR1040846     2  0.0424     0.8814 0.000 0.992 0.008
#> SRR1040847     1  0.0000     0.8838 1.000 0.000 0.000
#> SRR1040849     3  0.0000     0.9095 0.000 0.000 1.000
#> SRR1040848     2  0.0000     0.8858 0.000 1.000 0.000
#> SRR1040851     3  0.3340     0.8343 0.120 0.000 0.880
#> SRR1040850     3  0.0000     0.9095 0.000 0.000 1.000
#> SRR1040852     3  0.0000     0.9095 0.000 0.000 1.000
#> SRR1040853     3  0.0000     0.9095 0.000 0.000 1.000
#> SRR1040854     3  0.3267     0.8381 0.116 0.000 0.884
#> SRR1040855     3  0.0000     0.9095 0.000 0.000 1.000
#> SRR1040856     3  0.6095     0.3006 0.000 0.392 0.608
#> SRR1040857     3  0.3752     0.8131 0.144 0.000 0.856
#> SRR1040858     1  0.6140     0.2992 0.596 0.000 0.404
#> SRR1040859     3  0.6299     0.0361 0.000 0.476 0.524
#> SRR1040860     3  0.5968     0.3722 0.000 0.364 0.636
#> SRR1040861     3  0.0000     0.9095 0.000 0.000 1.000
#> SRR1040862     2  0.6204     0.2560 0.000 0.576 0.424
#> SRR1040863     3  0.2165     0.8683 0.000 0.064 0.936
#> SRR1040864     3  0.0000     0.9095 0.000 0.000 1.000
#> SRR1040865     1  0.4291     0.7311 0.820 0.000 0.180
#> SRR1040866     3  0.3116     0.8258 0.000 0.108 0.892
#> SRR1040867     3  0.0592     0.9072 0.012 0.000 0.988
#> SRR1040868     1  0.0424     0.8811 0.992 0.000 0.008
#> SRR1040869     3  0.3038     0.8471 0.104 0.000 0.896
#> SRR1040870     3  0.0237     0.9090 0.004 0.000 0.996
#> SRR1040871     1  0.5760     0.4890 0.672 0.000 0.328
#> SRR1040872     3  0.0000     0.9095 0.000 0.000 1.000
#> SRR1040873     2  0.0000     0.8858 0.000 1.000 0.000
#> SRR1040874     1  0.0000     0.8838 1.000 0.000 0.000
#> SRR1040875     3  0.0747     0.9057 0.016 0.000 0.984
#> SRR1040876     1  0.0000     0.8838 1.000 0.000 0.000
#> SRR1040877     3  0.0000     0.9095 0.000 0.000 1.000
#> SRR1040878     3  0.4413     0.8204 0.124 0.024 0.852
#> SRR1040879     1  0.6045     0.3724 0.620 0.380 0.000
#> SRR1040880     1  0.0000     0.8838 1.000 0.000 0.000
#> SRR1040881     1  0.2261     0.8351 0.932 0.068 0.000
#> SRR1040882     3  0.0747     0.9057 0.016 0.000 0.984
#> SRR1040883     1  0.6008     0.3966 0.628 0.000 0.372
#> SRR1040884     1  0.0892     0.8758 0.980 0.000 0.020
#> SRR1040885     3  0.0000     0.9095 0.000 0.000 1.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> SRR1040814     3  0.4830     0.5187 0.392 0.000 0.608 0.000
#> SRR1040813     1  0.0469     0.4298 0.988 0.000 0.012 0.000
#> SRR1040816     2  0.5781    -0.5875 0.480 0.492 0.000 0.028
#> SRR1040815     4  0.4605     0.1348 0.000 0.336 0.000 0.664
#> SRR1040817     3  0.4624     0.5796 0.340 0.000 0.660 0.000
#> SRR1040818     4  0.5576     0.3613 0.012 0.488 0.004 0.496
#> SRR1040819     4  0.4977     0.3973 0.000 0.460 0.000 0.540
#> SRR1040820     2  0.4999     0.4612 0.000 0.508 0.000 0.492
#> SRR1040821     2  0.5000     0.4599 0.000 0.504 0.000 0.496
#> SRR1040822     3  0.4804     0.5384 0.384 0.000 0.616 0.000
#> SRR1040823     1  0.2647     0.4025 0.880 0.000 0.120 0.000
#> SRR1040824     2  0.4999     0.4585 0.000 0.508 0.000 0.492
#> SRR1040826     3  0.4843     0.5237 0.396 0.000 0.604 0.000
#> SRR1040825     2  0.5296    -0.5047 0.008 0.496 0.000 0.496
#> SRR1040827     2  0.5000     0.4597 0.000 0.504 0.000 0.496
#> SRR1040828     1  0.2973     0.2767 0.856 0.144 0.000 0.000
#> SRR1040829     2  0.4999     0.4612 0.000 0.508 0.000 0.492
#> SRR1040830     1  0.4996     0.5666 0.516 0.484 0.000 0.000
#> SRR1040831     2  0.6540    -0.5933 0.472 0.472 0.020 0.036
#> SRR1040832     1  0.4697     0.5643 0.644 0.356 0.000 0.000
#> SRR1040833     2  0.7403    -0.4377 0.356 0.488 0.004 0.152
#> SRR1040834     1  0.5050     0.5742 0.588 0.408 0.004 0.000
#> SRR1040835     2  0.4857    -0.3098 0.284 0.700 0.000 0.016
#> SRR1040836     4  0.8268     0.3030 0.060 0.116 0.376 0.448
#> SRR1040837     1  0.7218    -0.2968 0.444 0.416 0.000 0.140
#> SRR1040839     2  0.4999     0.4612 0.000 0.508 0.000 0.492
#> SRR1040838     3  0.3219     0.6664 0.164 0.000 0.836 0.000
#> SRR1040840     2  0.4999     0.4612 0.000 0.508 0.000 0.492
#> SRR1040841     1  0.5167     0.5670 0.508 0.488 0.004 0.000
#> SRR1040843     2  0.6430     0.2323 0.428 0.504 0.000 0.068
#> SRR1040842     3  0.5165     0.1833 0.484 0.000 0.512 0.004
#> SRR1040845     3  0.5460     0.3489 0.000 0.028 0.632 0.340
#> SRR1040844     1  0.5463     0.5607 0.500 0.488 0.004 0.008
#> SRR1040846     2  0.7764     0.2996 0.324 0.424 0.000 0.252
#> SRR1040847     2  0.6609    -0.5404 0.440 0.488 0.004 0.068
#> SRR1040849     3  0.4072     0.6418 0.252 0.000 0.748 0.000
#> SRR1040848     2  0.4999     0.4612 0.000 0.508 0.000 0.492
#> SRR1040851     3  0.4574     0.6455 0.220 0.000 0.756 0.024
#> SRR1040850     3  0.1716     0.6452 0.064 0.000 0.936 0.000
#> SRR1040852     3  0.0921     0.6623 0.028 0.000 0.972 0.000
#> SRR1040853     3  0.0000     0.6513 0.000 0.000 1.000 0.000
#> SRR1040854     3  0.4973     0.5707 0.348 0.000 0.644 0.008
#> SRR1040855     3  0.1389     0.6636 0.048 0.000 0.952 0.000
#> SRR1040856     3  0.4252     0.4755 0.000 0.004 0.744 0.252
#> SRR1040857     3  0.4955     0.5741 0.344 0.000 0.648 0.008
#> SRR1040858     3  0.7387     0.4198 0.292 0.008 0.540 0.160
#> SRR1040859     3  0.4122     0.4938 0.000 0.004 0.760 0.236
#> SRR1040860     3  0.4372     0.4583 0.000 0.004 0.728 0.268
#> SRR1040861     3  0.0817     0.6587 0.024 0.000 0.976 0.000
#> SRR1040862     3  0.4914     0.3946 0.000 0.012 0.676 0.312
#> SRR1040863     3  0.3448     0.5550 0.004 0.000 0.828 0.168
#> SRR1040864     3  0.4040     0.4944 0.248 0.000 0.752 0.000
#> SRR1040865     4  0.5464     0.0531 0.004 0.008 0.492 0.496
#> SRR1040866     3  0.1389     0.6360 0.000 0.000 0.952 0.048
#> SRR1040867     3  0.2704     0.6694 0.124 0.000 0.876 0.000
#> SRR1040868     4  0.6959     0.3280 0.004 0.100 0.392 0.504
#> SRR1040869     3  0.4917     0.5798 0.336 0.000 0.656 0.008
#> SRR1040870     3  0.4222     0.6273 0.272 0.000 0.728 0.000
#> SRR1040871     3  0.6708     0.1141 0.072 0.008 0.536 0.384
#> SRR1040872     3  0.1557     0.6668 0.056 0.000 0.944 0.000
#> SRR1040873     2  0.5000     0.4599 0.000 0.504 0.000 0.496
#> SRR1040874     2  0.7063    -0.4999 0.400 0.488 0.004 0.108
#> SRR1040875     3  0.0188     0.6510 0.004 0.000 0.996 0.000
#> SRR1040876     1  0.5167     0.5670 0.508 0.488 0.004 0.000
#> SRR1040877     3  0.3873     0.6518 0.228 0.000 0.772 0.000
#> SRR1040878     3  0.2593     0.6186 0.004 0.000 0.892 0.104
#> SRR1040879     2  0.2909     0.0280 0.092 0.888 0.000 0.020
#> SRR1040880     4  0.6425     0.4253 0.004 0.436 0.056 0.504
#> SRR1040881     2  0.5273    -0.4811 0.008 0.536 0.000 0.456
#> SRR1040882     1  0.4072     0.2535 0.748 0.000 0.252 0.000
#> SRR1040883     3  0.7207     0.1251 0.116 0.008 0.512 0.364
#> SRR1040884     1  0.5167     0.5670 0.508 0.488 0.004 0.000
#> SRR1040885     3  0.3569     0.6629 0.196 0.000 0.804 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
#> SRR1040814     3  0.2920    0.64342 0.132 0.000 0.852 0.016 0.000
#> SRR1040813     1  0.5805    0.66113 0.652 0.000 0.200 0.016 0.132
#> SRR1040816     1  0.2228    0.65599 0.912 0.000 0.040 0.048 0.000
#> SRR1040815     4  0.6250    0.70559 0.256 0.204 0.000 0.540 0.000
#> SRR1040817     3  0.2362    0.68575 0.076 0.000 0.900 0.024 0.000
#> SRR1040818     4  0.4323    0.87507 0.332 0.000 0.012 0.656 0.000
#> SRR1040819     4  0.4366    0.88512 0.320 0.016 0.000 0.664 0.000
#> SRR1040820     2  0.0000    0.78011 0.000 1.000 0.000 0.000 0.000
#> SRR1040821     2  0.0000    0.78011 0.000 1.000 0.000 0.000 0.000
#> SRR1040822     3  0.3182    0.64526 0.124 0.000 0.844 0.032 0.000
#> SRR1040823     1  0.6294    0.43871 0.476 0.000 0.404 0.012 0.108
#> SRR1040824     2  0.0290    0.77835 0.000 0.992 0.000 0.008 0.000
#> SRR1040826     3  0.5040    0.40459 0.256 0.000 0.680 0.008 0.056
#> SRR1040825     4  0.3966    0.88224 0.336 0.000 0.000 0.664 0.000
#> SRR1040827     2  0.0290    0.77835 0.000 0.992 0.000 0.008 0.000
#> SRR1040828     1  0.4633    0.44929 0.632 0.004 0.000 0.016 0.348
#> SRR1040829     2  0.1121    0.75990 0.044 0.956 0.000 0.000 0.000
#> SRR1040830     1  0.1430    0.57610 0.944 0.000 0.004 0.052 0.000
#> SRR1040831     1  0.5852    0.64012 0.584 0.000 0.280 0.136 0.000
#> SRR1040832     1  0.2605    0.69676 0.896 0.000 0.056 0.004 0.044
#> SRR1040833     1  0.3239    0.66901 0.852 0.000 0.068 0.080 0.000
#> SRR1040834     1  0.3951    0.74364 0.776 0.000 0.192 0.004 0.028
#> SRR1040835     1  0.1444    0.56245 0.948 0.012 0.000 0.040 0.000
#> SRR1040836     3  0.5030    0.36353 0.044 0.000 0.604 0.352 0.000
#> SRR1040837     2  0.4307    0.62634 0.128 0.772 0.000 0.000 0.100
#> SRR1040839     2  0.1608    0.74370 0.000 0.928 0.000 0.000 0.072
#> SRR1040838     3  0.3141    0.64296 0.016 0.000 0.832 0.000 0.152
#> SRR1040840     2  0.0000    0.78011 0.000 1.000 0.000 0.000 0.000
#> SRR1040841     1  0.3724    0.74410 0.788 0.000 0.184 0.028 0.000
#> SRR1040843     5  0.4088    0.10298 0.000 0.368 0.000 0.000 0.632
#> SRR1040842     5  0.0404    0.55716 0.000 0.000 0.012 0.000 0.988
#> SRR1040845     2  0.8235   -0.09444 0.000 0.312 0.280 0.296 0.112
#> SRR1040844     1  0.4129    0.73909 0.756 0.000 0.204 0.040 0.000
#> SRR1040846     2  0.4016    0.65594 0.092 0.796 0.000 0.000 0.112
#> SRR1040847     1  0.4428    0.72973 0.756 0.000 0.160 0.084 0.000
#> SRR1040849     3  0.1329    0.71076 0.032 0.000 0.956 0.004 0.008
#> SRR1040848     2  0.0000    0.78011 0.000 1.000 0.000 0.000 0.000
#> SRR1040851     3  0.1211    0.71457 0.024 0.000 0.960 0.016 0.000
#> SRR1040850     5  0.4546    0.46206 0.028 0.000 0.304 0.000 0.668
#> SRR1040852     3  0.1965    0.68443 0.000 0.000 0.904 0.000 0.096
#> SRR1040853     3  0.1444    0.70462 0.000 0.000 0.948 0.012 0.040
#> SRR1040854     3  0.0771    0.71359 0.020 0.000 0.976 0.004 0.000
#> SRR1040855     5  0.4549    0.07137 0.008 0.000 0.464 0.000 0.528
#> SRR1040856     2  0.7602   -0.10292 0.000 0.396 0.336 0.056 0.212
#> SRR1040857     3  0.1522    0.70572 0.044 0.000 0.944 0.012 0.000
#> SRR1040858     3  0.0912    0.71431 0.012 0.000 0.972 0.016 0.000
#> SRR1040859     3  0.7200    0.25211 0.000 0.248 0.532 0.140 0.080
#> SRR1040860     3  0.8172   -0.10453 0.000 0.304 0.348 0.112 0.236
#> SRR1040861     3  0.6040    0.35238 0.000 0.000 0.556 0.292 0.152
#> SRR1040862     3  0.8221    0.00818 0.000 0.188 0.364 0.304 0.144
#> SRR1040863     3  0.6665    0.28060 0.000 0.016 0.508 0.308 0.168
#> SRR1040864     5  0.1478    0.59053 0.000 0.000 0.064 0.000 0.936
#> SRR1040865     3  0.4066    0.50978 0.004 0.000 0.672 0.324 0.000
#> SRR1040866     3  0.6894    0.27562 0.000 0.024 0.512 0.220 0.244
#> SRR1040867     3  0.0451    0.71272 0.008 0.000 0.988 0.000 0.004
#> SRR1040868     3  0.4517    0.35027 0.012 0.000 0.600 0.388 0.000
#> SRR1040869     3  0.0404    0.71346 0.012 0.000 0.988 0.000 0.000
#> SRR1040870     3  0.0833    0.71338 0.016 0.000 0.976 0.004 0.004
#> SRR1040871     3  0.0865    0.71252 0.004 0.000 0.972 0.024 0.000
#> SRR1040872     3  0.3521    0.55219 0.004 0.000 0.764 0.000 0.232
#> SRR1040873     2  0.0000    0.78011 0.000 1.000 0.000 0.000 0.000
#> SRR1040874     1  0.3875    0.64361 0.804 0.000 0.072 0.124 0.000
#> SRR1040875     3  0.5981    0.39840 0.000 0.000 0.588 0.216 0.196
#> SRR1040876     1  0.3165    0.73673 0.848 0.000 0.116 0.036 0.000
#> SRR1040877     3  0.1059    0.71288 0.008 0.000 0.968 0.020 0.004
#> SRR1040878     3  0.4623    0.46768 0.000 0.008 0.640 0.340 0.012
#> SRR1040879     2  0.4803    0.17037 0.444 0.536 0.000 0.020 0.000
#> SRR1040880     4  0.5287    0.78932 0.260 0.000 0.092 0.648 0.000
#> SRR1040881     4  0.4987    0.87366 0.340 0.044 0.000 0.616 0.000
#> SRR1040882     1  0.5814    0.58637 0.576 0.000 0.344 0.024 0.056
#> SRR1040883     3  0.1571    0.70524 0.004 0.000 0.936 0.060 0.000
#> SRR1040884     1  0.3885    0.71062 0.724 0.000 0.268 0.008 0.000
#> SRR1040885     3  0.3412    0.66151 0.048 0.000 0.848 0.008 0.096

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>            class entropy silhouette    p1    p2    p3    p4    p5    p6
#> SRR1040814     3  0.3707    0.58573 0.156 0.000 0.784 0.056 0.004 0.000
#> SRR1040813     1  0.4465    0.62264 0.668 0.000 0.284 0.004 0.040 0.004
#> SRR1040816     1  0.5278    0.63713 0.604 0.000 0.192 0.000 0.000 0.204
#> SRR1040815     6  0.3306    0.71896 0.008 0.184 0.008 0.004 0.000 0.796
#> SRR1040817     3  0.3254    0.61977 0.136 0.000 0.816 0.048 0.000 0.000
#> SRR1040818     6  0.2703    0.80948 0.080 0.000 0.028 0.016 0.000 0.876
#> SRR1040819     6  0.0653    0.84945 0.012 0.004 0.000 0.004 0.000 0.980
#> SRR1040820     2  0.0000    0.76328 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR1040821     2  0.0000    0.76328 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR1040822     3  0.3621    0.59191 0.160 0.000 0.788 0.048 0.004 0.000
#> SRR1040823     3  0.4931    0.28986 0.288 0.000 0.640 0.036 0.036 0.000
#> SRR1040824     2  0.1082    0.75504 0.004 0.956 0.000 0.000 0.000 0.040
#> SRR1040826     3  0.4486    0.50968 0.192 0.000 0.728 0.032 0.048 0.000
#> SRR1040825     6  0.0603    0.84978 0.016 0.004 0.000 0.000 0.000 0.980
#> SRR1040827     2  0.1007    0.75504 0.000 0.956 0.000 0.000 0.000 0.044
#> SRR1040828     1  0.4715    0.22459 0.712 0.000 0.000 0.080 0.184 0.024
#> SRR1040829     2  0.6255    0.37937 0.328 0.524 0.000 0.080 0.012 0.056
#> SRR1040830     1  0.3870    0.33064 0.788 0.000 0.000 0.072 0.012 0.128
#> SRR1040831     1  0.6095    0.49515 0.448 0.000 0.380 0.020 0.000 0.152
#> SRR1040832     1  0.2620    0.57893 0.884 0.000 0.076 0.004 0.012 0.024
#> SRR1040833     1  0.5813    0.54926 0.504 0.000 0.184 0.004 0.000 0.308
#> SRR1040834     1  0.3806    0.65351 0.724 0.000 0.256 0.004 0.008 0.008
#> SRR1040835     1  0.3801    0.33195 0.740 0.012 0.000 0.016 0.000 0.232
#> SRR1040836     3  0.5012    0.26467 0.036 0.000 0.536 0.020 0.000 0.408
#> SRR1040837     2  0.3114    0.69767 0.128 0.832 0.000 0.004 0.036 0.000
#> SRR1040839     2  0.1610    0.73889 0.000 0.916 0.000 0.000 0.084 0.000
#> SRR1040838     3  0.3277    0.66470 0.024 0.000 0.828 0.020 0.128 0.000
#> SRR1040840     2  0.0000    0.76328 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR1040841     1  0.5311    0.64428 0.588 0.000 0.296 0.008 0.000 0.108
#> SRR1040843     2  0.4320    0.29958 0.008 0.516 0.000 0.008 0.468 0.000
#> SRR1040842     5  0.0717    0.52805 0.008 0.000 0.000 0.016 0.976 0.000
#> SRR1040845     4  0.7162    0.54075 0.008 0.124 0.136 0.576 0.068 0.088
#> SRR1040844     1  0.5614    0.63548 0.568 0.000 0.300 0.020 0.000 0.112
#> SRR1040846     2  0.3466    0.70321 0.100 0.820 0.000 0.008 0.072 0.000
#> SRR1040847     1  0.5510    0.65155 0.560 0.000 0.248 0.000 0.000 0.192
#> SRR1040849     3  0.2615    0.69759 0.044 0.000 0.892 0.040 0.020 0.004
#> SRR1040848     2  0.0405    0.76251 0.000 0.988 0.000 0.004 0.000 0.008
#> SRR1040851     3  0.2186    0.70188 0.032 0.000 0.916 0.024 0.004 0.024
#> SRR1040850     5  0.4906    0.46209 0.024 0.000 0.284 0.040 0.648 0.004
#> SRR1040852     3  0.2056    0.68560 0.004 0.000 0.904 0.012 0.080 0.000
#> SRR1040853     3  0.3179    0.67573 0.012 0.000 0.856 0.060 0.064 0.008
#> SRR1040854     3  0.0862    0.70972 0.008 0.000 0.972 0.016 0.000 0.004
#> SRR1040855     3  0.4297    0.10718 0.004 0.000 0.532 0.012 0.452 0.000
#> SRR1040856     2  0.7015    0.00165 0.000 0.416 0.256 0.076 0.252 0.000
#> SRR1040857     3  0.2471    0.69912 0.056 0.000 0.888 0.052 0.000 0.004
#> SRR1040858     3  0.2377    0.69272 0.024 0.000 0.892 0.076 0.000 0.008
#> SRR1040859     3  0.7191   -0.31102 0.000 0.320 0.372 0.248 0.032 0.028
#> SRR1040860     2  0.7864   -0.21364 0.004 0.312 0.228 0.184 0.268 0.004
#> SRR1040861     4  0.3191    0.76186 0.024 0.000 0.128 0.832 0.016 0.000
#> SRR1040862     4  0.3143    0.76553 0.008 0.016 0.108 0.848 0.020 0.000
#> SRR1040863     4  0.3013    0.76710 0.008 0.004 0.116 0.848 0.024 0.000
#> SRR1040864     5  0.1838    0.57388 0.000 0.000 0.068 0.016 0.916 0.000
#> SRR1040865     3  0.6016    0.02384 0.012 0.000 0.508 0.272 0.000 0.208
#> SRR1040866     5  0.6645   -0.19667 0.000 0.020 0.280 0.332 0.364 0.004
#> SRR1040867     3  0.1138    0.70709 0.000 0.000 0.960 0.024 0.012 0.004
#> SRR1040868     3  0.4669    0.27627 0.016 0.000 0.556 0.020 0.000 0.408
#> SRR1040869     3  0.0748    0.70913 0.004 0.000 0.976 0.016 0.000 0.004
#> SRR1040870     3  0.2074    0.70474 0.036 0.000 0.912 0.048 0.004 0.000
#> SRR1040871     3  0.2365    0.68875 0.012 0.000 0.896 0.068 0.000 0.024
#> SRR1040872     3  0.4355    0.03522 0.000 0.000 0.556 0.024 0.420 0.000
#> SRR1040873     2  0.0146    0.76278 0.000 0.996 0.000 0.000 0.004 0.000
#> SRR1040874     1  0.6328    0.55254 0.488 0.000 0.188 0.032 0.000 0.292
#> SRR1040875     4  0.6130    0.53146 0.016 0.000 0.192 0.576 0.196 0.020
#> SRR1040876     1  0.2734    0.59646 0.872 0.000 0.088 0.020 0.000 0.020
#> SRR1040877     3  0.4322    0.50509 0.032 0.000 0.672 0.288 0.008 0.000
#> SRR1040878     4  0.3847    0.71054 0.004 0.008 0.220 0.748 0.000 0.020
#> SRR1040879     2  0.5403    0.48917 0.212 0.620 0.000 0.012 0.000 0.156
#> SRR1040880     6  0.3384    0.70888 0.016 0.000 0.132 0.032 0.000 0.820
#> SRR1040881     6  0.2088    0.83507 0.028 0.068 0.000 0.000 0.000 0.904
#> SRR1040882     1  0.4635    0.31369 0.492 0.000 0.476 0.024 0.008 0.000
#> SRR1040883     3  0.3792    0.61099 0.012 0.000 0.784 0.048 0.000 0.156
#> SRR1040884     1  0.4265    0.54462 0.596 0.000 0.384 0.004 0.000 0.016
#> SRR1040885     3  0.4487    0.61144 0.116 0.000 0.756 0.040 0.088 0.000

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

consensus_heatmap(res, k = 2)

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

consensus_heatmap(res, k = 3)

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

consensus_heatmap(res, k = 4)

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

consensus_heatmap(res, k = 5)

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

consensus_heatmap(res, k = 6)

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

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

membership_heatmap(res, k = 2)

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

membership_heatmap(res, k = 3)

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

membership_heatmap(res, k = 4)

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

membership_heatmap(res, k = 5)

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

membership_heatmap(res, k = 6)

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

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

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

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

get_signatures(res, k = 3)

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

get_signatures(res, k = 4)

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

get_signatures(res, k = 5)

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

get_signatures(res, k = 6)

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

Signature heatmaps where rows are not scaled:

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

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

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

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

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

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

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

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

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

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

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk MAD-NMF-signature_compare

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

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

An example of the output of tb is:

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

The columns in tb are:

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

UMAP plot which shows how samples are separated.

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

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

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

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

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

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

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

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

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

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

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk MAD-NMF-collect-classes

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


ATC:hclust**

The object with results only for a single top-value method and a single partition method can be extracted as:

res = res_list["ATC", "hclust"]
# you can also extract it by
# res = res_list["ATC:hclust"]

A summary of res and all the functions that can be applied to it:

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

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

collect_plots(res)

plot of chunk ATC-hclust-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 1.000           0.952       0.980         0.4805 0.521   0.521
#> 3 3 0.757           0.853       0.856         0.1863 0.904   0.818
#> 4 4 0.688           0.791       0.830         0.2343 0.818   0.588
#> 5 5 0.729           0.745       0.888         0.0449 0.968   0.885
#> 6 6 0.790           0.756       0.875         0.0954 0.929   0.727

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
#> SRR1040814     1  0.0000      0.977 1.000 0.000
#> SRR1040813     1  0.0000      0.977 1.000 0.000
#> SRR1040816     1  0.2236      0.956 0.964 0.036
#> SRR1040815     2  0.0000      0.981 0.000 1.000
#> SRR1040817     1  0.0000      0.977 1.000 0.000
#> SRR1040818     2  0.9754      0.277 0.408 0.592
#> SRR1040819     2  0.0000      0.981 0.000 1.000
#> SRR1040820     2  0.0000      0.981 0.000 1.000
#> SRR1040821     2  0.0000      0.981 0.000 1.000
#> SRR1040822     1  0.0000      0.977 1.000 0.000
#> SRR1040823     1  0.0000      0.977 1.000 0.000
#> SRR1040824     2  0.0000      0.981 0.000 1.000
#> SRR1040826     1  0.0000      0.977 1.000 0.000
#> SRR1040825     2  0.0672      0.979 0.008 0.992
#> SRR1040827     2  0.0000      0.981 0.000 1.000
#> SRR1040828     2  0.0672      0.979 0.008 0.992
#> SRR1040829     2  0.0000      0.981 0.000 1.000
#> SRR1040830     1  0.0000      0.977 1.000 0.000
#> SRR1040831     1  0.0000      0.977 1.000 0.000
#> SRR1040832     1  0.7453      0.738 0.788 0.212
#> SRR1040833     1  0.0000      0.977 1.000 0.000
#> SRR1040834     1  0.2236      0.956 0.964 0.036
#> SRR1040835     2  0.0672      0.979 0.008 0.992
#> SRR1040836     1  0.0000      0.977 1.000 0.000
#> SRR1040837     2  0.0000      0.981 0.000 1.000
#> SRR1040839     2  0.0000      0.981 0.000 1.000
#> SRR1040838     1  0.2236      0.956 0.964 0.036
#> SRR1040840     2  0.0000      0.981 0.000 1.000
#> SRR1040841     1  0.0000      0.977 1.000 0.000
#> SRR1040843     2  0.0000      0.981 0.000 1.000
#> SRR1040842     2  0.0000      0.981 0.000 1.000
#> SRR1040845     2  0.0672      0.979 0.008 0.992
#> SRR1040844     1  0.0000      0.977 1.000 0.000
#> SRR1040846     2  0.0000      0.981 0.000 1.000
#> SRR1040847     1  0.0000      0.977 1.000 0.000
#> SRR1040849     1  0.0000      0.977 1.000 0.000
#> SRR1040848     2  0.0000      0.981 0.000 1.000
#> SRR1040851     1  0.0000      0.977 1.000 0.000
#> SRR1040850     1  0.2236      0.956 0.964 0.036
#> SRR1040852     1  0.2236      0.956 0.964 0.036
#> SRR1040853     1  0.2236      0.956 0.964 0.036
#> SRR1040854     1  0.0000      0.977 1.000 0.000
#> SRR1040855     1  0.0938      0.971 0.988 0.012
#> SRR1040856     2  0.0672      0.979 0.008 0.992
#> SRR1040857     1  0.0000      0.977 1.000 0.000
#> SRR1040858     1  0.0000      0.977 1.000 0.000
#> SRR1040859     2  0.0672      0.979 0.008 0.992
#> SRR1040860     2  0.0672      0.979 0.008 0.992
#> SRR1040861     1  0.0000      0.977 1.000 0.000
#> SRR1040862     2  0.0672      0.979 0.008 0.992
#> SRR1040863     2  0.0672      0.979 0.008 0.992
#> SRR1040864     1  0.2236      0.956 0.964 0.036
#> SRR1040865     1  0.2236      0.956 0.964 0.036
#> SRR1040866     2  0.0672      0.979 0.008 0.992
#> SRR1040867     1  0.0000      0.977 1.000 0.000
#> SRR1040868     1  0.0000      0.977 1.000 0.000
#> SRR1040869     1  0.0000      0.977 1.000 0.000
#> SRR1040870     1  0.0000      0.977 1.000 0.000
#> SRR1040871     1  0.0000      0.977 1.000 0.000
#> SRR1040872     1  0.0000      0.977 1.000 0.000
#> SRR1040873     2  0.0000      0.981 0.000 1.000
#> SRR1040874     1  0.0000      0.977 1.000 0.000
#> SRR1040875     1  0.2043      0.959 0.968 0.032
#> SRR1040876     1  0.0000      0.977 1.000 0.000
#> SRR1040877     1  0.0000      0.977 1.000 0.000
#> SRR1040878     1  0.9896      0.224 0.560 0.440
#> SRR1040879     2  0.0000      0.981 0.000 1.000
#> SRR1040880     1  0.0000      0.977 1.000 0.000
#> SRR1040881     2  0.0672      0.979 0.008 0.992
#> SRR1040882     1  0.0000      0.977 1.000 0.000
#> SRR1040883     1  0.0000      0.977 1.000 0.000
#> SRR1040884     1  0.0000      0.977 1.000 0.000
#> SRR1040885     1  0.0000      0.977 1.000 0.000

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>            class entropy silhouette    p1    p2    p3
#> SRR1040814     1   0.245     0.9123 0.924 0.000 0.076
#> SRR1040813     1   0.288     0.8927 0.904 0.000 0.096
#> SRR1040816     1   0.164     0.9070 0.956 0.000 0.044
#> SRR1040815     2   0.418     0.7355 0.000 0.828 0.172
#> SRR1040817     1   0.245     0.9123 0.924 0.000 0.076
#> SRR1040818     3   0.550     0.3780 0.292 0.000 0.708
#> SRR1040819     2   0.418     0.7355 0.000 0.828 0.172
#> SRR1040820     2   0.000     0.9329 0.000 1.000 0.000
#> SRR1040821     2   0.000     0.9329 0.000 1.000 0.000
#> SRR1040822     1   0.245     0.9123 0.924 0.000 0.076
#> SRR1040823     1   0.288     0.8927 0.904 0.000 0.096
#> SRR1040824     2   0.000     0.9329 0.000 1.000 0.000
#> SRR1040826     1   0.245     0.9123 0.924 0.000 0.076
#> SRR1040825     3   0.597     0.7961 0.000 0.364 0.636
#> SRR1040827     2   0.000     0.9329 0.000 1.000 0.000
#> SRR1040828     3   0.597     0.7961 0.000 0.364 0.636
#> SRR1040829     2   0.000     0.9329 0.000 1.000 0.000
#> SRR1040830     1   0.000     0.9199 1.000 0.000 0.000
#> SRR1040831     1   0.245     0.9123 0.924 0.000 0.076
#> SRR1040832     1   0.576     0.6218 0.672 0.000 0.328
#> SRR1040833     1   0.000     0.9199 1.000 0.000 0.000
#> SRR1040834     1   0.388     0.8628 0.848 0.000 0.152
#> SRR1040835     3   0.597     0.7961 0.000 0.364 0.636
#> SRR1040836     1   0.000     0.9199 1.000 0.000 0.000
#> SRR1040837     2   0.175     0.8971 0.000 0.952 0.048
#> SRR1040839     2   0.000     0.9329 0.000 1.000 0.000
#> SRR1040838     1   0.388     0.8628 0.848 0.000 0.152
#> SRR1040840     2   0.000     0.9329 0.000 1.000 0.000
#> SRR1040841     1   0.000     0.9199 1.000 0.000 0.000
#> SRR1040843     2   0.000     0.9329 0.000 1.000 0.000
#> SRR1040842     3   0.571     0.4589 0.000 0.320 0.680
#> SRR1040845     3   0.597     0.7961 0.000 0.364 0.636
#> SRR1040844     1   0.000     0.9199 1.000 0.000 0.000
#> SRR1040846     2   0.175     0.8971 0.000 0.952 0.048
#> SRR1040847     1   0.000     0.9199 1.000 0.000 0.000
#> SRR1040849     1   0.245     0.9123 0.924 0.000 0.076
#> SRR1040848     2   0.000     0.9329 0.000 1.000 0.000
#> SRR1040851     1   0.245     0.9123 0.924 0.000 0.076
#> SRR1040850     1   0.388     0.8628 0.848 0.000 0.152
#> SRR1040852     1   0.388     0.8628 0.848 0.000 0.152
#> SRR1040853     1   0.388     0.8628 0.848 0.000 0.152
#> SRR1040854     1   0.245     0.9123 0.924 0.000 0.076
#> SRR1040855     1   0.348     0.8773 0.872 0.000 0.128
#> SRR1040856     3   0.597     0.7961 0.000 0.364 0.636
#> SRR1040857     1   0.245     0.9123 0.924 0.000 0.076
#> SRR1040858     1   0.245     0.9123 0.924 0.000 0.076
#> SRR1040859     3   0.597     0.7961 0.000 0.364 0.636
#> SRR1040860     3   0.597     0.7961 0.000 0.364 0.636
#> SRR1040861     1   0.288     0.8927 0.904 0.000 0.096
#> SRR1040862     3   0.597     0.7961 0.000 0.364 0.636
#> SRR1040863     3   0.597     0.7961 0.000 0.364 0.636
#> SRR1040864     1   0.388     0.8628 0.848 0.000 0.152
#> SRR1040865     1   0.388     0.8628 0.848 0.000 0.152
#> SRR1040866     3   0.597     0.7961 0.000 0.364 0.636
#> SRR1040867     1   0.288     0.8927 0.904 0.000 0.096
#> SRR1040868     1   0.000     0.9199 1.000 0.000 0.000
#> SRR1040869     1   0.245     0.9123 0.924 0.000 0.076
#> SRR1040870     1   0.245     0.9123 0.924 0.000 0.076
#> SRR1040871     1   0.245     0.9123 0.924 0.000 0.076
#> SRR1040872     1   0.288     0.8927 0.904 0.000 0.096
#> SRR1040873     2   0.000     0.9329 0.000 1.000 0.000
#> SRR1040874     1   0.000     0.9199 1.000 0.000 0.000
#> SRR1040875     1   0.382     0.8654 0.852 0.000 0.148
#> SRR1040876     1   0.000     0.9199 1.000 0.000 0.000
#> SRR1040877     1   0.245     0.9123 0.924 0.000 0.076
#> SRR1040878     3   0.625    -0.0552 0.444 0.000 0.556
#> SRR1040879     2   0.418     0.7355 0.000 0.828 0.172
#> SRR1040880     1   0.000     0.9199 1.000 0.000 0.000
#> SRR1040881     3   0.597     0.7961 0.000 0.364 0.636
#> SRR1040882     1   0.245     0.9123 0.924 0.000 0.076
#> SRR1040883     1   0.245     0.9123 0.924 0.000 0.076
#> SRR1040884     1   0.000     0.9199 1.000 0.000 0.000
#> SRR1040885     1   0.245     0.9123 0.924 0.000 0.076

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> SRR1040814     1  0.0000      0.860 1.000 0.000 0.000 0.000
#> SRR1040813     3  0.4222      0.659 0.272 0.000 0.728 0.000
#> SRR1040816     3  0.4543      0.535 0.324 0.000 0.676 0.000
#> SRR1040815     2  0.4072      0.585 0.000 0.748 0.000 0.252
#> SRR1040817     1  0.0336      0.859 0.992 0.000 0.008 0.000
#> SRR1040818     4  0.5756      0.206 0.032 0.000 0.400 0.568
#> SRR1040819     2  0.4072      0.585 0.000 0.748 0.000 0.252
#> SRR1040820     2  0.0000      0.912 0.000 1.000 0.000 0.000
#> SRR1040821     2  0.0000      0.912 0.000 1.000 0.000 0.000
#> SRR1040822     1  0.0000      0.860 1.000 0.000 0.000 0.000
#> SRR1040823     3  0.4222      0.659 0.272 0.000 0.728 0.000
#> SRR1040824     2  0.0000      0.912 0.000 1.000 0.000 0.000
#> SRR1040826     1  0.0336      0.859 0.992 0.000 0.008 0.000
#> SRR1040825     4  0.4621      0.888 0.000 0.284 0.008 0.708
#> SRR1040827     2  0.0000      0.912 0.000 1.000 0.000 0.000
#> SRR1040828     4  0.4621      0.888 0.000 0.284 0.008 0.708
#> SRR1040829     2  0.0000      0.912 0.000 1.000 0.000 0.000
#> SRR1040830     1  0.4103      0.743 0.744 0.000 0.256 0.000
#> SRR1040831     1  0.0000      0.860 1.000 0.000 0.000 0.000
#> SRR1040832     3  0.4332      0.614 0.032 0.000 0.792 0.176
#> SRR1040833     1  0.3801      0.768 0.780 0.000 0.220 0.000
#> SRR1040834     3  0.1022      0.827 0.032 0.000 0.968 0.000
#> SRR1040835     4  0.4621      0.888 0.000 0.284 0.008 0.708
#> SRR1040836     1  0.4103      0.743 0.744 0.000 0.256 0.000
#> SRR1040837     2  0.1389      0.876 0.000 0.952 0.000 0.048
#> SRR1040839     2  0.0000      0.912 0.000 1.000 0.000 0.000
#> SRR1040838     3  0.1022      0.827 0.032 0.000 0.968 0.000
#> SRR1040840     2  0.0000      0.912 0.000 1.000 0.000 0.000
#> SRR1040841     1  0.4103      0.743 0.744 0.000 0.256 0.000
#> SRR1040843     2  0.0000      0.912 0.000 1.000 0.000 0.000
#> SRR1040842     4  0.4332      0.382 0.000 0.176 0.032 0.792
#> SRR1040845     4  0.4621      0.888 0.000 0.284 0.008 0.708
#> SRR1040844     1  0.4103      0.743 0.744 0.000 0.256 0.000
#> SRR1040846     2  0.1389      0.876 0.000 0.952 0.000 0.048
#> SRR1040847     1  0.4103      0.743 0.744 0.000 0.256 0.000
#> SRR1040849     1  0.0000      0.860 1.000 0.000 0.000 0.000
#> SRR1040848     2  0.0000      0.912 0.000 1.000 0.000 0.000
#> SRR1040851     1  0.0000      0.860 1.000 0.000 0.000 0.000
#> SRR1040850     3  0.1022      0.827 0.032 0.000 0.968 0.000
#> SRR1040852     3  0.1022      0.827 0.032 0.000 0.968 0.000
#> SRR1040853     3  0.1022      0.827 0.032 0.000 0.968 0.000
#> SRR1040854     1  0.0000      0.860 1.000 0.000 0.000 0.000
#> SRR1040855     3  0.1557      0.822 0.056 0.000 0.944 0.000
#> SRR1040856     4  0.4621      0.888 0.000 0.284 0.008 0.708
#> SRR1040857     1  0.0000      0.860 1.000 0.000 0.000 0.000
#> SRR1040858     1  0.0000      0.860 1.000 0.000 0.000 0.000
#> SRR1040859     4  0.4621      0.888 0.000 0.284 0.008 0.708
#> SRR1040860     4  0.4621      0.888 0.000 0.284 0.008 0.708
#> SRR1040861     3  0.4040      0.686 0.248 0.000 0.752 0.000
#> SRR1040862     4  0.4621      0.888 0.000 0.284 0.008 0.708
#> SRR1040863     4  0.4621      0.888 0.000 0.284 0.008 0.708
#> SRR1040864     3  0.1022      0.827 0.032 0.000 0.968 0.000
#> SRR1040865     3  0.1022      0.827 0.032 0.000 0.968 0.000
#> SRR1040866     4  0.4621      0.888 0.000 0.284 0.008 0.708
#> SRR1040867     3  0.4454      0.610 0.308 0.000 0.692 0.000
#> SRR1040868     1  0.4103      0.743 0.744 0.000 0.256 0.000
#> SRR1040869     1  0.0000      0.860 1.000 0.000 0.000 0.000
#> SRR1040870     1  0.0000      0.860 1.000 0.000 0.000 0.000
#> SRR1040871     1  0.0000      0.860 1.000 0.000 0.000 0.000
#> SRR1040872     3  0.4382      0.619 0.296 0.000 0.704 0.000
#> SRR1040873     2  0.0000      0.912 0.000 1.000 0.000 0.000
#> SRR1040874     1  0.4103      0.743 0.744 0.000 0.256 0.000
#> SRR1040875     3  0.1118      0.827 0.036 0.000 0.964 0.000
#> SRR1040876     1  0.4103      0.743 0.744 0.000 0.256 0.000
#> SRR1040877     1  0.0000      0.860 1.000 0.000 0.000 0.000
#> SRR1040878     3  0.4866      0.157 0.000 0.000 0.596 0.404
#> SRR1040879     2  0.4072      0.585 0.000 0.748 0.000 0.252
#> SRR1040880     1  0.4103      0.743 0.744 0.000 0.256 0.000
#> SRR1040881     4  0.4621      0.888 0.000 0.284 0.008 0.708
#> SRR1040882     1  0.2530      0.823 0.888 0.000 0.112 0.000
#> SRR1040883     1  0.0000      0.860 1.000 0.000 0.000 0.000
#> SRR1040884     1  0.3801      0.768 0.780 0.000 0.220 0.000
#> SRR1040885     1  0.0336      0.859 0.992 0.000 0.008 0.000

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>            class entropy silhouette    p1    p2    p3    p4    p5
#> SRR1040814     3  0.0290      0.830 0.008 0.000 0.992 0.000 0.000
#> SRR1040813     5  0.3819      0.672 0.016 0.000 0.228 0.000 0.756
#> SRR1040816     5  0.3752      0.543 0.000 0.000 0.292 0.000 0.708
#> SRR1040815     4  0.5295      0.172 0.048 0.464 0.000 0.488 0.000
#> SRR1040817     3  0.0693      0.830 0.012 0.000 0.980 0.000 0.008
#> SRR1040818     4  0.4235      0.148 0.000 0.000 0.000 0.576 0.424
#> SRR1040819     4  0.5295      0.172 0.048 0.464 0.000 0.488 0.000
#> SRR1040820     2  0.0000      0.989 0.000 1.000 0.000 0.000 0.000
#> SRR1040821     2  0.0000      0.989 0.000 1.000 0.000 0.000 0.000
#> SRR1040822     3  0.0000      0.830 0.000 0.000 1.000 0.000 0.000
#> SRR1040823     5  0.3988      0.655 0.016 0.000 0.252 0.000 0.732
#> SRR1040824     2  0.0000      0.989 0.000 1.000 0.000 0.000 0.000
#> SRR1040826     3  0.0693      0.830 0.012 0.000 0.980 0.000 0.008
#> SRR1040825     4  0.1197      0.768 0.048 0.000 0.000 0.952 0.000
#> SRR1040827     2  0.0000      0.989 0.000 1.000 0.000 0.000 0.000
#> SRR1040828     4  0.1197      0.768 0.048 0.000 0.000 0.952 0.000
#> SRR1040829     2  0.0000      0.989 0.000 1.000 0.000 0.000 0.000
#> SRR1040830     3  0.4206      0.695 0.016 0.000 0.696 0.000 0.288
#> SRR1040831     3  0.0290      0.830 0.008 0.000 0.992 0.000 0.000
#> SRR1040832     5  0.2891      0.552 0.000 0.000 0.000 0.176 0.824
#> SRR1040833     3  0.3890      0.724 0.012 0.000 0.736 0.000 0.252
#> SRR1040834     5  0.0000      0.788 0.000 0.000 0.000 0.000 1.000
#> SRR1040835     4  0.1197      0.768 0.048 0.000 0.000 0.952 0.000
#> SRR1040836     3  0.4206      0.695 0.016 0.000 0.696 0.000 0.288
#> SRR1040837     2  0.1197      0.945 0.048 0.952 0.000 0.000 0.000
#> SRR1040839     2  0.0000      0.989 0.000 1.000 0.000 0.000 0.000
#> SRR1040838     5  0.0000      0.788 0.000 0.000 0.000 0.000 1.000
#> SRR1040840     2  0.0000      0.989 0.000 1.000 0.000 0.000 0.000
#> SRR1040841     3  0.4206      0.695 0.016 0.000 0.696 0.000 0.288
#> SRR1040843     2  0.0000      0.989 0.000 1.000 0.000 0.000 0.000
#> SRR1040842     1  0.0794      0.000 0.972 0.000 0.000 0.028 0.000
#> SRR1040845     4  0.0000      0.779 0.000 0.000 0.000 1.000 0.000
#> SRR1040844     3  0.4206      0.695 0.016 0.000 0.696 0.000 0.288
#> SRR1040846     2  0.1197      0.945 0.048 0.952 0.000 0.000 0.000
#> SRR1040847     3  0.4206      0.695 0.016 0.000 0.696 0.000 0.288
#> SRR1040849     3  0.0290      0.830 0.008 0.000 0.992 0.000 0.000
#> SRR1040848     2  0.0000      0.989 0.000 1.000 0.000 0.000 0.000
#> SRR1040851     3  0.0290      0.830 0.008 0.000 0.992 0.000 0.000
#> SRR1040850     5  0.0000      0.788 0.000 0.000 0.000 0.000 1.000
#> SRR1040852     5  0.0000      0.788 0.000 0.000 0.000 0.000 1.000
#> SRR1040853     5  0.0000      0.788 0.000 0.000 0.000 0.000 1.000
#> SRR1040854     3  0.0290      0.830 0.008 0.000 0.992 0.000 0.000
#> SRR1040855     5  0.0798      0.781 0.016 0.000 0.008 0.000 0.976
#> SRR1040856     4  0.0000      0.779 0.000 0.000 0.000 1.000 0.000
#> SRR1040857     3  0.0290      0.830 0.008 0.000 0.992 0.000 0.000
#> SRR1040858     3  0.0290      0.830 0.008 0.000 0.992 0.000 0.000
#> SRR1040859     4  0.0000      0.779 0.000 0.000 0.000 1.000 0.000
#> SRR1040860     4  0.0000      0.779 0.000 0.000 0.000 1.000 0.000
#> SRR1040861     5  0.3596      0.701 0.016 0.000 0.200 0.000 0.784
#> SRR1040862     4  0.0000      0.779 0.000 0.000 0.000 1.000 0.000
#> SRR1040863     4  0.0000      0.779 0.000 0.000 0.000 1.000 0.000
#> SRR1040864     5  0.0000      0.788 0.000 0.000 0.000 0.000 1.000
#> SRR1040865     5  0.0000      0.788 0.000 0.000 0.000 0.000 1.000
#> SRR1040866     4  0.0000      0.779 0.000 0.000 0.000 1.000 0.000
#> SRR1040867     5  0.4065      0.629 0.016 0.000 0.264 0.000 0.720
#> SRR1040868     3  0.4206      0.695 0.016 0.000 0.696 0.000 0.288
#> SRR1040869     3  0.0290      0.830 0.008 0.000 0.992 0.000 0.000
#> SRR1040870     3  0.0290      0.830 0.008 0.000 0.992 0.000 0.000
#> SRR1040871     3  0.0290      0.830 0.008 0.000 0.992 0.000 0.000
#> SRR1040872     5  0.3988      0.637 0.016 0.000 0.252 0.000 0.732
#> SRR1040873     2  0.0000      0.989 0.000 1.000 0.000 0.000 0.000
#> SRR1040874     3  0.4206      0.695 0.016 0.000 0.696 0.000 0.288
#> SRR1040875     5  0.0162      0.787 0.004 0.000 0.000 0.000 0.996
#> SRR1040876     3  0.4206      0.695 0.016 0.000 0.696 0.000 0.288
#> SRR1040877     3  0.0000      0.830 0.000 0.000 1.000 0.000 0.000
#> SRR1040878     5  0.4210      0.178 0.000 0.000 0.000 0.412 0.588
#> SRR1040879     4  0.5295      0.172 0.048 0.464 0.000 0.488 0.000
#> SRR1040880     3  0.4206      0.695 0.016 0.000 0.696 0.000 0.288
#> SRR1040881     4  0.1197      0.768 0.048 0.000 0.000 0.952 0.000
#> SRR1040882     3  0.2677      0.797 0.016 0.000 0.872 0.000 0.112
#> SRR1040883     3  0.0290      0.830 0.008 0.000 0.992 0.000 0.000
#> SRR1040884     3  0.3890      0.724 0.012 0.000 0.736 0.000 0.252
#> SRR1040885     3  0.0693      0.830 0.012 0.000 0.980 0.000 0.008

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>            class entropy silhouette    p1    p2    p3 p4    p5    p6
#> SRR1040814     3  0.0146      0.701 0.004 0.000 0.996  0 0.000 0.000
#> SRR1040813     5  0.4328      0.649 0.080 0.000 0.212  0 0.708 0.000
#> SRR1040816     5  0.3843      0.291 0.452 0.000 0.000  0 0.548 0.000
#> SRR1040815     6  0.4833      0.174 0.004 0.464 0.000  0 0.044 0.488
#> SRR1040817     3  0.0865      0.691 0.036 0.000 0.964  0 0.000 0.000
#> SRR1040818     6  0.5147      0.186 0.108 0.000 0.000  0 0.316 0.576
#> SRR1040819     6  0.4833      0.174 0.004 0.464 0.000  0 0.044 0.488
#> SRR1040820     2  0.0000      0.990 0.000 1.000 0.000  0 0.000 0.000
#> SRR1040821     2  0.0000      0.990 0.000 1.000 0.000  0 0.000 0.000
#> SRR1040822     3  0.0363      0.702 0.012 0.000 0.988  0 0.000 0.000
#> SRR1040823     5  0.4479      0.640 0.080 0.000 0.236  0 0.684 0.000
#> SRR1040824     2  0.0000      0.990 0.000 1.000 0.000  0 0.000 0.000
#> SRR1040826     3  0.0865      0.691 0.036 0.000 0.964  0 0.000 0.000
#> SRR1040825     6  0.1152      0.781 0.004 0.000 0.000  0 0.044 0.952
#> SRR1040827     2  0.0000      0.990 0.000 1.000 0.000  0 0.000 0.000
#> SRR1040828     6  0.1152      0.781 0.004 0.000 0.000  0 0.044 0.952
#> SRR1040829     2  0.0000      0.990 0.000 1.000 0.000  0 0.000 0.000
#> SRR1040830     1  0.0146      0.988 0.996 0.000 0.000  0 0.004 0.000
#> SRR1040831     3  0.3499      0.743 0.320 0.000 0.680  0 0.000 0.000
#> SRR1040832     5  0.4383      0.596 0.108 0.000 0.000  0 0.716 0.176
#> SRR1040833     1  0.0937      0.948 0.960 0.000 0.040  0 0.000 0.000
#> SRR1040834     5  0.2454      0.755 0.160 0.000 0.000  0 0.840 0.000
#> SRR1040835     6  0.1152      0.781 0.004 0.000 0.000  0 0.044 0.952
#> SRR1040836     1  0.0146      0.988 0.996 0.000 0.000  0 0.004 0.000
#> SRR1040837     2  0.1152      0.947 0.004 0.952 0.000  0 0.044 0.000
#> SRR1040839     2  0.0000      0.990 0.000 1.000 0.000  0 0.000 0.000
#> SRR1040838     5  0.2340      0.760 0.148 0.000 0.000  0 0.852 0.000
#> SRR1040840     2  0.0000      0.990 0.000 1.000 0.000  0 0.000 0.000
#> SRR1040841     1  0.0146      0.988 0.996 0.000 0.000  0 0.004 0.000
#> SRR1040843     2  0.0000      0.990 0.000 1.000 0.000  0 0.000 0.000
#> SRR1040842     4  0.0000      0.000 0.000 0.000 0.000  1 0.000 0.000
#> SRR1040845     6  0.0000      0.791 0.000 0.000 0.000  0 0.000 1.000
#> SRR1040844     1  0.0146      0.988 0.996 0.000 0.000  0 0.004 0.000
#> SRR1040846     2  0.1152      0.947 0.004 0.952 0.000  0 0.044 0.000
#> SRR1040847     1  0.0146      0.988 0.996 0.000 0.000  0 0.004 0.000
#> SRR1040849     3  0.3499      0.743 0.320 0.000 0.680  0 0.000 0.000
#> SRR1040848     2  0.0000      0.990 0.000 1.000 0.000  0 0.000 0.000
#> SRR1040851     3  0.3499      0.743 0.320 0.000 0.680  0 0.000 0.000
#> SRR1040850     5  0.1007      0.744 0.044 0.000 0.000  0 0.956 0.000
#> SRR1040852     5  0.2340      0.760 0.148 0.000 0.000  0 0.852 0.000
#> SRR1040853     5  0.2340      0.760 0.148 0.000 0.000  0 0.852 0.000
#> SRR1040854     3  0.3499      0.743 0.320 0.000 0.680  0 0.000 0.000
#> SRR1040855     5  0.1387      0.747 0.068 0.000 0.000  0 0.932 0.000
#> SRR1040856     6  0.0000      0.791 0.000 0.000 0.000  0 0.000 1.000
#> SRR1040857     3  0.3499      0.743 0.320 0.000 0.680  0 0.000 0.000
#> SRR1040858     3  0.3499      0.743 0.320 0.000 0.680  0 0.000 0.000
#> SRR1040859     6  0.0000      0.791 0.000 0.000 0.000  0 0.000 1.000
#> SRR1040860     6  0.0000      0.791 0.000 0.000 0.000  0 0.000 1.000
#> SRR1040861     5  0.4125      0.666 0.080 0.000 0.184  0 0.736 0.000
#> SRR1040862     6  0.0000      0.791 0.000 0.000 0.000  0 0.000 1.000
#> SRR1040863     6  0.0000      0.791 0.000 0.000 0.000  0 0.000 1.000
#> SRR1040864     5  0.1007      0.744 0.044 0.000 0.000  0 0.956 0.000
#> SRR1040865     5  0.2454      0.755 0.160 0.000 0.000  0 0.840 0.000
#> SRR1040866     6  0.0000      0.791 0.000 0.000 0.000  0 0.000 1.000
#> SRR1040867     5  0.4500      0.618 0.076 0.000 0.248  0 0.676 0.000
#> SRR1040868     1  0.0260      0.984 0.992 0.000 0.000  0 0.008 0.000
#> SRR1040869     3  0.3499      0.743 0.320 0.000 0.680  0 0.000 0.000
#> SRR1040870     3  0.0146      0.701 0.004 0.000 0.996  0 0.000 0.000
#> SRR1040871     3  0.3499      0.743 0.320 0.000 0.680  0 0.000 0.000
#> SRR1040872     5  0.4479      0.629 0.080 0.000 0.236  0 0.684 0.000
#> SRR1040873     2  0.0000      0.990 0.000 1.000 0.000  0 0.000 0.000
#> SRR1040874     1  0.0146      0.988 0.996 0.000 0.000  0 0.004 0.000
#> SRR1040875     5  0.2178      0.761 0.132 0.000 0.000  0 0.868 0.000
#> SRR1040876     1  0.0146      0.988 0.996 0.000 0.000  0 0.004 0.000
#> SRR1040877     3  0.0363      0.702 0.012 0.000 0.988  0 0.000 0.000
#> SRR1040878     5  0.5045      0.236 0.076 0.000 0.000  0 0.512 0.412
#> SRR1040879     6  0.4833      0.174 0.004 0.464 0.000  0 0.044 0.488
#> SRR1040880     1  0.0146      0.988 0.996 0.000 0.000  0 0.004 0.000
#> SRR1040881     6  0.1152      0.781 0.004 0.000 0.000  0 0.044 0.952
#> SRR1040882     3  0.2856      0.568 0.068 0.000 0.856  0 0.076 0.000
#> SRR1040883     3  0.3499      0.743 0.320 0.000 0.680  0 0.000 0.000
#> SRR1040884     1  0.0937      0.948 0.960 0.000 0.040  0 0.000 0.000
#> SRR1040885     3  0.0632      0.696 0.024 0.000 0.976  0 0.000 0.000

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

consensus_heatmap(res, k = 2)

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

consensus_heatmap(res, k = 3)

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

consensus_heatmap(res, k = 4)

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

consensus_heatmap(res, k = 5)

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

consensus_heatmap(res, k = 6)

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

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

membership_heatmap(res, k = 2)

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

membership_heatmap(res, k = 3)

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

membership_heatmap(res, k = 4)

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

membership_heatmap(res, k = 5)

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

membership_heatmap(res, k = 6)

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

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

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

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

get_signatures(res, k = 3)

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

get_signatures(res, k = 4)

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

get_signatures(res, k = 5)

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

get_signatures(res, k = 6)

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

Signature heatmaps where rows are not scaled:

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

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

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

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

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

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

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

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

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

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

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk ATC-hclust-signature_compare

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

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

An example of the output of tb is:

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

The columns in tb are:

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

UMAP plot which shows how samples are separated.

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

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

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

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

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

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

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

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

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

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

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk ATC-hclust-collect-classes

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


ATC:kmeans**

The object with results only for a single top-value method and a single partition method can be extracted as:

res = res_list["ATC", "kmeans"]
# you can also extract it by
# res = res_list["ATC:kmeans"]

A summary of res and all the functions that can be applied to it:

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

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

collect_plots(res)

plot of chunk ATC-kmeans-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 1.000           0.982       0.992         0.4833 0.521   0.521
#> 3 3 0.701           0.820       0.891         0.3510 0.771   0.576
#> 4 4 0.615           0.662       0.781         0.1397 0.844   0.578
#> 5 5 0.739           0.719       0.826         0.0699 0.893   0.613
#> 6 6 0.745           0.635       0.762         0.0410 0.962   0.813

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
#> SRR1040814     1   0.000      0.987 1.000 0.000
#> SRR1040813     1   0.000      0.987 1.000 0.000
#> SRR1040816     1   0.000      0.987 1.000 0.000
#> SRR1040815     2   0.000      1.000 0.000 1.000
#> SRR1040817     1   0.000      0.987 1.000 0.000
#> SRR1040818     2   0.000      1.000 0.000 1.000
#> SRR1040819     2   0.000      1.000 0.000 1.000
#> SRR1040820     2   0.000      1.000 0.000 1.000
#> SRR1040821     2   0.000      1.000 0.000 1.000
#> SRR1040822     1   0.000      0.987 1.000 0.000
#> SRR1040823     1   0.000      0.987 1.000 0.000
#> SRR1040824     2   0.000      1.000 0.000 1.000
#> SRR1040826     1   0.000      0.987 1.000 0.000
#> SRR1040825     2   0.000      1.000 0.000 1.000
#> SRR1040827     2   0.000      1.000 0.000 1.000
#> SRR1040828     2   0.000      1.000 0.000 1.000
#> SRR1040829     2   0.000      1.000 0.000 1.000
#> SRR1040830     1   0.000      0.987 1.000 0.000
#> SRR1040831     1   0.000      0.987 1.000 0.000
#> SRR1040832     1   0.730      0.743 0.796 0.204
#> SRR1040833     1   0.000      0.987 1.000 0.000
#> SRR1040834     1   0.000      0.987 1.000 0.000
#> SRR1040835     2   0.000      1.000 0.000 1.000
#> SRR1040836     1   0.000      0.987 1.000 0.000
#> SRR1040837     2   0.000      1.000 0.000 1.000
#> SRR1040839     2   0.000      1.000 0.000 1.000
#> SRR1040838     1   0.000      0.987 1.000 0.000
#> SRR1040840     2   0.000      1.000 0.000 1.000
#> SRR1040841     1   0.000      0.987 1.000 0.000
#> SRR1040843     2   0.000      1.000 0.000 1.000
#> SRR1040842     2   0.000      1.000 0.000 1.000
#> SRR1040845     2   0.000      1.000 0.000 1.000
#> SRR1040844     1   0.000      0.987 1.000 0.000
#> SRR1040846     2   0.000      1.000 0.000 1.000
#> SRR1040847     1   0.000      0.987 1.000 0.000
#> SRR1040849     1   0.000      0.987 1.000 0.000
#> SRR1040848     2   0.000      1.000 0.000 1.000
#> SRR1040851     1   0.000      0.987 1.000 0.000
#> SRR1040850     1   0.000      0.987 1.000 0.000
#> SRR1040852     1   0.000      0.987 1.000 0.000
#> SRR1040853     1   0.000      0.987 1.000 0.000
#> SRR1040854     1   0.000      0.987 1.000 0.000
#> SRR1040855     1   0.000      0.987 1.000 0.000
#> SRR1040856     2   0.000      1.000 0.000 1.000
#> SRR1040857     1   0.000      0.987 1.000 0.000
#> SRR1040858     1   0.000      0.987 1.000 0.000
#> SRR1040859     2   0.000      1.000 0.000 1.000
#> SRR1040860     2   0.000      1.000 0.000 1.000
#> SRR1040861     1   0.000      0.987 1.000 0.000
#> SRR1040862     2   0.000      1.000 0.000 1.000
#> SRR1040863     2   0.000      1.000 0.000 1.000
#> SRR1040864     1   0.000      0.987 1.000 0.000
#> SRR1040865     1   0.000      0.987 1.000 0.000
#> SRR1040866     2   0.000      1.000 0.000 1.000
#> SRR1040867     1   0.000      0.987 1.000 0.000
#> SRR1040868     1   0.000      0.987 1.000 0.000
#> SRR1040869     1   0.000      0.987 1.000 0.000
#> SRR1040870     1   0.000      0.987 1.000 0.000
#> SRR1040871     1   0.000      0.987 1.000 0.000
#> SRR1040872     1   0.000      0.987 1.000 0.000
#> SRR1040873     2   0.000      1.000 0.000 1.000
#> SRR1040874     1   0.000      0.987 1.000 0.000
#> SRR1040875     1   0.000      0.987 1.000 0.000
#> SRR1040876     1   0.000      0.987 1.000 0.000
#> SRR1040877     1   0.000      0.987 1.000 0.000
#> SRR1040878     1   0.932      0.470 0.652 0.348
#> SRR1040879     2   0.000      1.000 0.000 1.000
#> SRR1040880     1   0.000      0.987 1.000 0.000
#> SRR1040881     2   0.000      1.000 0.000 1.000
#> SRR1040882     1   0.000      0.987 1.000 0.000
#> SRR1040883     1   0.000      0.987 1.000 0.000
#> SRR1040884     1   0.000      0.987 1.000 0.000
#> SRR1040885     1   0.000      0.987 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
#> SRR1040814     1  0.0000      0.968 1.000 0.000 0.000
#> SRR1040813     3  0.6308      0.291 0.492 0.000 0.508
#> SRR1040816     3  0.5178      0.734 0.256 0.000 0.744
#> SRR1040815     2  0.1031      0.864 0.000 0.976 0.024
#> SRR1040817     1  0.0000      0.968 1.000 0.000 0.000
#> SRR1040818     3  0.0000      0.715 0.000 0.000 1.000
#> SRR1040819     2  0.1031      0.864 0.000 0.976 0.024
#> SRR1040820     2  0.0000      0.862 0.000 1.000 0.000
#> SRR1040821     2  0.0000      0.862 0.000 1.000 0.000
#> SRR1040822     1  0.0000      0.968 1.000 0.000 0.000
#> SRR1040823     3  0.5621      0.681 0.308 0.000 0.692
#> SRR1040824     2  0.0000      0.862 0.000 1.000 0.000
#> SRR1040826     1  0.0747      0.956 0.984 0.000 0.016
#> SRR1040825     2  0.5497      0.788 0.000 0.708 0.292
#> SRR1040827     2  0.0000      0.862 0.000 1.000 0.000
#> SRR1040828     2  0.5678      0.772 0.000 0.684 0.316
#> SRR1040829     2  0.0000      0.862 0.000 1.000 0.000
#> SRR1040830     3  0.6045      0.591 0.380 0.000 0.620
#> SRR1040831     1  0.0000      0.968 1.000 0.000 0.000
#> SRR1040832     3  0.0000      0.715 0.000 0.000 1.000
#> SRR1040833     1  0.0000      0.968 1.000 0.000 0.000
#> SRR1040834     3  0.3038      0.790 0.104 0.000 0.896
#> SRR1040835     2  0.5678      0.772 0.000 0.684 0.316
#> SRR1040836     1  0.2261      0.907 0.932 0.000 0.068
#> SRR1040837     2  0.2796      0.855 0.000 0.908 0.092
#> SRR1040839     2  0.0000      0.862 0.000 1.000 0.000
#> SRR1040838     3  0.3551      0.803 0.132 0.000 0.868
#> SRR1040840     2  0.0000      0.862 0.000 1.000 0.000
#> SRR1040841     1  0.2261      0.907 0.932 0.000 0.068
#> SRR1040843     2  0.0000      0.862 0.000 1.000 0.000
#> SRR1040842     2  0.5497      0.788 0.000 0.708 0.292
#> SRR1040845     2  0.6215      0.624 0.000 0.572 0.428
#> SRR1040844     1  0.0747      0.957 0.984 0.000 0.016
#> SRR1040846     2  0.1031      0.864 0.000 0.976 0.024
#> SRR1040847     1  0.0000      0.968 1.000 0.000 0.000
#> SRR1040849     1  0.0000      0.968 1.000 0.000 0.000
#> SRR1040848     2  0.0000      0.862 0.000 1.000 0.000
#> SRR1040851     1  0.0000      0.968 1.000 0.000 0.000
#> SRR1040850     3  0.3551      0.803 0.132 0.000 0.868
#> SRR1040852     3  0.3551      0.803 0.132 0.000 0.868
#> SRR1040853     3  0.3551      0.803 0.132 0.000 0.868
#> SRR1040854     1  0.0000      0.968 1.000 0.000 0.000
#> SRR1040855     3  0.4887      0.755 0.228 0.000 0.772
#> SRR1040856     2  0.5678      0.772 0.000 0.684 0.316
#> SRR1040857     1  0.0000      0.968 1.000 0.000 0.000
#> SRR1040858     1  0.0000      0.968 1.000 0.000 0.000
#> SRR1040859     3  0.5905     -0.101 0.000 0.352 0.648
#> SRR1040860     2  0.5678      0.772 0.000 0.684 0.316
#> SRR1040861     3  0.6111      0.544 0.396 0.000 0.604
#> SRR1040862     2  0.5591      0.781 0.000 0.696 0.304
#> SRR1040863     2  0.6045      0.698 0.000 0.620 0.380
#> SRR1040864     3  0.0000      0.715 0.000 0.000 1.000
#> SRR1040865     3  0.3551      0.803 0.132 0.000 0.868
#> SRR1040866     3  0.0000      0.715 0.000 0.000 1.000
#> SRR1040867     1  0.0000      0.968 1.000 0.000 0.000
#> SRR1040868     3  0.6045      0.591 0.380 0.000 0.620
#> SRR1040869     1  0.0000      0.968 1.000 0.000 0.000
#> SRR1040870     1  0.0000      0.968 1.000 0.000 0.000
#> SRR1040871     1  0.0000      0.968 1.000 0.000 0.000
#> SRR1040872     1  0.5760      0.336 0.672 0.000 0.328
#> SRR1040873     2  0.0000      0.862 0.000 1.000 0.000
#> SRR1040874     1  0.2261      0.907 0.932 0.000 0.068
#> SRR1040875     3  0.5591      0.686 0.304 0.000 0.696
#> SRR1040876     1  0.0000      0.968 1.000 0.000 0.000
#> SRR1040877     1  0.0000      0.968 1.000 0.000 0.000
#> SRR1040878     3  0.0000      0.715 0.000 0.000 1.000
#> SRR1040879     2  0.2796      0.855 0.000 0.908 0.092
#> SRR1040880     1  0.2261      0.907 0.932 0.000 0.068
#> SRR1040881     2  0.4931      0.814 0.000 0.768 0.232
#> SRR1040882     1  0.0000      0.968 1.000 0.000 0.000
#> SRR1040883     1  0.0000      0.968 1.000 0.000 0.000
#> SRR1040884     1  0.0000      0.968 1.000 0.000 0.000
#> SRR1040885     1  0.1289      0.940 0.968 0.000 0.032

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> SRR1040814     3  0.2401     0.7102 0.092 0.000 0.904 0.004
#> SRR1040813     1  0.1936     0.7521 0.940 0.000 0.028 0.032
#> SRR1040816     1  0.6475     0.5780 0.644 0.000 0.172 0.184
#> SRR1040815     2  0.3528     0.7316 0.000 0.808 0.000 0.192
#> SRR1040817     3  0.2714     0.7024 0.112 0.000 0.884 0.004
#> SRR1040818     4  0.2831     0.7384 0.120 0.004 0.000 0.876
#> SRR1040819     2  0.3486     0.7375 0.000 0.812 0.000 0.188
#> SRR1040820     2  0.0000     0.9295 0.000 1.000 0.000 0.000
#> SRR1040821     2  0.0000     0.9295 0.000 1.000 0.000 0.000
#> SRR1040822     3  0.2714     0.7024 0.112 0.000 0.884 0.004
#> SRR1040823     1  0.1151     0.7646 0.968 0.000 0.024 0.008
#> SRR1040824     2  0.0000     0.9295 0.000 1.000 0.000 0.000
#> SRR1040826     3  0.4632     0.5243 0.308 0.000 0.688 0.004
#> SRR1040825     4  0.3569     0.8174 0.000 0.196 0.000 0.804
#> SRR1040827     2  0.0000     0.9295 0.000 1.000 0.000 0.000
#> SRR1040828     4  0.3937     0.8284 0.012 0.188 0.000 0.800
#> SRR1040829     2  0.0000     0.9295 0.000 1.000 0.000 0.000
#> SRR1040830     1  0.6617     0.5470 0.628 0.000 0.196 0.176
#> SRR1040831     3  0.1488     0.7175 0.012 0.000 0.956 0.032
#> SRR1040832     4  0.4624     0.4411 0.340 0.000 0.000 0.660
#> SRR1040833     3  0.3862     0.6493 0.024 0.000 0.824 0.152
#> SRR1040834     1  0.3172     0.7699 0.840 0.000 0.000 0.160
#> SRR1040835     4  0.3356     0.8271 0.000 0.176 0.000 0.824
#> SRR1040836     3  0.7362     0.0323 0.396 0.000 0.444 0.160
#> SRR1040837     4  0.4948     0.3972 0.000 0.440 0.000 0.560
#> SRR1040839     2  0.0000     0.9295 0.000 1.000 0.000 0.000
#> SRR1040838     1  0.2888     0.7803 0.872 0.000 0.004 0.124
#> SRR1040840     2  0.0000     0.9295 0.000 1.000 0.000 0.000
#> SRR1040841     3  0.7362     0.0323 0.396 0.000 0.444 0.160
#> SRR1040843     2  0.0000     0.9295 0.000 1.000 0.000 0.000
#> SRR1040842     4  0.4054     0.8279 0.016 0.188 0.000 0.796
#> SRR1040845     4  0.3999     0.8166 0.036 0.140 0.000 0.824
#> SRR1040844     3  0.7362     0.0323 0.396 0.000 0.444 0.160
#> SRR1040846     2  0.4277     0.5437 0.000 0.720 0.000 0.280
#> SRR1040847     3  0.7293     0.1180 0.368 0.000 0.476 0.156
#> SRR1040849     3  0.3494     0.6558 0.172 0.000 0.824 0.004
#> SRR1040848     2  0.0000     0.9295 0.000 1.000 0.000 0.000
#> SRR1040851     3  0.0000     0.7297 0.000 0.000 1.000 0.000
#> SRR1040850     1  0.2831     0.7799 0.876 0.000 0.004 0.120
#> SRR1040852     1  0.2888     0.7803 0.872 0.000 0.004 0.124
#> SRR1040853     1  0.2888     0.7803 0.872 0.000 0.004 0.124
#> SRR1040854     3  0.0000     0.7297 0.000 0.000 1.000 0.000
#> SRR1040855     1  0.0804     0.7689 0.980 0.000 0.008 0.012
#> SRR1040856     4  0.3937     0.8284 0.012 0.188 0.000 0.800
#> SRR1040857     3  0.0000     0.7297 0.000 0.000 1.000 0.000
#> SRR1040858     3  0.0000     0.7297 0.000 0.000 1.000 0.000
#> SRR1040859     4  0.4150     0.7714 0.120 0.056 0.000 0.824
#> SRR1040860     4  0.3937     0.8284 0.012 0.188 0.000 0.800
#> SRR1040861     1  0.1256     0.7603 0.964 0.000 0.028 0.008
#> SRR1040862     4  0.3978     0.8260 0.012 0.192 0.000 0.796
#> SRR1040863     4  0.4139     0.8281 0.024 0.176 0.000 0.800
#> SRR1040864     1  0.3444     0.7132 0.816 0.000 0.000 0.184
#> SRR1040865     1  0.3355     0.7706 0.836 0.000 0.004 0.160
#> SRR1040866     4  0.3907     0.7551 0.140 0.032 0.000 0.828
#> SRR1040867     1  0.4781     0.2606 0.660 0.000 0.336 0.004
#> SRR1040868     1  0.6617     0.5470 0.628 0.000 0.196 0.176
#> SRR1040869     3  0.0000     0.7297 0.000 0.000 1.000 0.000
#> SRR1040870     3  0.2401     0.7102 0.092 0.000 0.904 0.004
#> SRR1040871     3  0.0937     0.7242 0.012 0.000 0.976 0.012
#> SRR1040872     1  0.3626     0.5939 0.812 0.000 0.184 0.004
#> SRR1040873     2  0.0000     0.9295 0.000 1.000 0.000 0.000
#> SRR1040874     1  0.7367     0.0236 0.436 0.000 0.404 0.160
#> SRR1040875     1  0.1706     0.7739 0.948 0.000 0.016 0.036
#> SRR1040876     3  0.7293     0.1180 0.368 0.000 0.476 0.156
#> SRR1040877     3  0.2714     0.7024 0.112 0.000 0.884 0.004
#> SRR1040878     4  0.4697     0.3940 0.356 0.000 0.000 0.644
#> SRR1040879     4  0.4925     0.4133 0.000 0.428 0.000 0.572
#> SRR1040880     3  0.7362     0.0323 0.396 0.000 0.444 0.160
#> SRR1040881     4  0.3569     0.8174 0.000 0.196 0.000 0.804
#> SRR1040882     3  0.5004     0.4247 0.392 0.000 0.604 0.004
#> SRR1040883     3  0.0469     0.7272 0.012 0.000 0.988 0.000
#> SRR1040884     3  0.3659     0.6590 0.024 0.000 0.840 0.136
#> SRR1040885     3  0.4632     0.5243 0.308 0.000 0.688 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
#> SRR1040814     3  0.0000    0.81481 0.000 0.000 1.000 0.000 0.000
#> SRR1040813     5  0.3868    0.64485 0.140 0.000 0.060 0.000 0.800
#> SRR1040816     1  0.4747    0.18084 0.496 0.000 0.016 0.000 0.488
#> SRR1040815     2  0.6478    0.20157 0.220 0.488 0.000 0.292 0.000
#> SRR1040817     3  0.1168    0.80653 0.008 0.000 0.960 0.000 0.032
#> SRR1040818     4  0.3048    0.82591 0.176 0.000 0.000 0.820 0.004
#> SRR1040819     2  0.6323    0.30832 0.220 0.528 0.000 0.252 0.000
#> SRR1040820     2  0.0000    0.91103 0.000 1.000 0.000 0.000 0.000
#> SRR1040821     2  0.0000    0.91103 0.000 1.000 0.000 0.000 0.000
#> SRR1040822     3  0.1168    0.80653 0.008 0.000 0.960 0.000 0.032
#> SRR1040823     5  0.1638    0.74485 0.064 0.000 0.004 0.000 0.932
#> SRR1040824     2  0.0000    0.91103 0.000 1.000 0.000 0.000 0.000
#> SRR1040826     3  0.4387    0.44057 0.012 0.000 0.640 0.000 0.348
#> SRR1040825     4  0.3689    0.79448 0.256 0.004 0.000 0.740 0.000
#> SRR1040827     2  0.0000    0.91103 0.000 1.000 0.000 0.000 0.000
#> SRR1040828     4  0.0671    0.85697 0.016 0.000 0.000 0.980 0.004
#> SRR1040829     2  0.0000    0.91103 0.000 1.000 0.000 0.000 0.000
#> SRR1040830     1  0.4550    0.65871 0.688 0.000 0.036 0.000 0.276
#> SRR1040831     3  0.2471    0.76854 0.136 0.000 0.864 0.000 0.000
#> SRR1040832     5  0.5431    0.02758 0.060 0.000 0.000 0.424 0.516
#> SRR1040833     1  0.4268    0.58033 0.648 0.000 0.344 0.000 0.008
#> SRR1040834     5  0.1792    0.76023 0.084 0.000 0.000 0.000 0.916
#> SRR1040835     4  0.3635    0.79911 0.248 0.000 0.000 0.748 0.004
#> SRR1040836     1  0.5008    0.84324 0.708 0.000 0.152 0.000 0.140
#> SRR1040837     4  0.3980    0.79146 0.128 0.076 0.000 0.796 0.000
#> SRR1040839     2  0.0000    0.91103 0.000 1.000 0.000 0.000 0.000
#> SRR1040838     5  0.1410    0.77113 0.060 0.000 0.000 0.000 0.940
#> SRR1040840     2  0.0000    0.91103 0.000 1.000 0.000 0.000 0.000
#> SRR1040841     1  0.5008    0.84324 0.708 0.000 0.152 0.000 0.140
#> SRR1040843     2  0.0000    0.91103 0.000 1.000 0.000 0.000 0.000
#> SRR1040842     4  0.0771    0.85263 0.020 0.000 0.000 0.976 0.004
#> SRR1040845     4  0.0865    0.85498 0.024 0.000 0.000 0.972 0.004
#> SRR1040844     1  0.5008    0.84324 0.708 0.000 0.152 0.000 0.140
#> SRR1040846     4  0.6110    0.14218 0.128 0.396 0.000 0.476 0.000
#> SRR1040847     1  0.5025    0.83396 0.704 0.000 0.172 0.000 0.124
#> SRR1040849     3  0.1830    0.78078 0.008 0.000 0.924 0.000 0.068
#> SRR1040848     2  0.0000    0.91103 0.000 1.000 0.000 0.000 0.000
#> SRR1040851     3  0.1965    0.81377 0.096 0.000 0.904 0.000 0.000
#> SRR1040850     5  0.1121    0.77294 0.044 0.000 0.000 0.000 0.956
#> SRR1040852     5  0.1410    0.77113 0.060 0.000 0.000 0.000 0.940
#> SRR1040853     5  0.1410    0.77113 0.060 0.000 0.000 0.000 0.940
#> SRR1040854     3  0.1965    0.81377 0.096 0.000 0.904 0.000 0.000
#> SRR1040855     5  0.0451    0.76252 0.004 0.000 0.008 0.000 0.988
#> SRR1040856     4  0.0162    0.85688 0.000 0.000 0.000 0.996 0.004
#> SRR1040857     3  0.1965    0.81377 0.096 0.000 0.904 0.000 0.000
#> SRR1040858     3  0.1965    0.81377 0.096 0.000 0.904 0.000 0.000
#> SRR1040859     4  0.0865    0.85498 0.024 0.000 0.000 0.972 0.004
#> SRR1040860     4  0.0162    0.85688 0.000 0.000 0.000 0.996 0.004
#> SRR1040861     5  0.2922    0.71414 0.072 0.000 0.056 0.000 0.872
#> SRR1040862     4  0.0162    0.85688 0.000 0.000 0.000 0.996 0.004
#> SRR1040863     4  0.0162    0.85688 0.000 0.000 0.000 0.996 0.004
#> SRR1040864     5  0.3242    0.69757 0.040 0.000 0.000 0.116 0.844
#> SRR1040865     5  0.4060    0.24719 0.360 0.000 0.000 0.000 0.640
#> SRR1040866     4  0.2236    0.82213 0.024 0.000 0.000 0.908 0.068
#> SRR1040867     5  0.6229    0.07115 0.144 0.000 0.392 0.000 0.464
#> SRR1040868     1  0.4844    0.67269 0.668 0.000 0.052 0.000 0.280
#> SRR1040869     3  0.1965    0.81377 0.096 0.000 0.904 0.000 0.000
#> SRR1040870     3  0.0000    0.81481 0.000 0.000 1.000 0.000 0.000
#> SRR1040871     3  0.1965    0.81377 0.096 0.000 0.904 0.000 0.000
#> SRR1040872     5  0.4478    0.60462 0.144 0.000 0.100 0.000 0.756
#> SRR1040873     2  0.0000    0.91103 0.000 1.000 0.000 0.000 0.000
#> SRR1040874     1  0.5010    0.83780 0.708 0.000 0.144 0.000 0.148
#> SRR1040875     5  0.1638    0.77095 0.064 0.000 0.004 0.000 0.932
#> SRR1040876     1  0.4989    0.83609 0.708 0.000 0.168 0.000 0.124
#> SRR1040877     3  0.1168    0.80653 0.008 0.000 0.960 0.000 0.032
#> SRR1040878     4  0.5325    0.40283 0.076 0.000 0.000 0.616 0.308
#> SRR1040879     4  0.4254    0.77532 0.220 0.040 0.000 0.740 0.000
#> SRR1040880     1  0.5008    0.84324 0.708 0.000 0.152 0.000 0.140
#> SRR1040881     4  0.3689    0.79448 0.256 0.004 0.000 0.740 0.000
#> SRR1040882     3  0.6244    0.00774 0.144 0.000 0.444 0.000 0.412
#> SRR1040883     3  0.1965    0.81377 0.096 0.000 0.904 0.000 0.000
#> SRR1040884     1  0.4235    0.58369 0.656 0.000 0.336 0.000 0.008
#> SRR1040885     3  0.4387    0.44057 0.012 0.000 0.640 0.000 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
#> SRR1040814     3  0.1643     0.6773 0.008 0.000 0.924 0.000 0.000 0.068
#> SRR1040813     5  0.6672     0.0181 0.180 0.000 0.052 0.000 0.412 0.356
#> SRR1040816     1  0.4957     0.1519 0.544 0.000 0.012 0.000 0.400 0.044
#> SRR1040815     6  0.6208    -0.3064 0.008 0.280 0.000 0.276 0.000 0.436
#> SRR1040817     3  0.4358     0.4839 0.012 0.000 0.624 0.000 0.016 0.348
#> SRR1040818     4  0.4842     0.6236 0.000 0.000 0.000 0.600 0.076 0.324
#> SRR1040819     6  0.6140    -0.2295 0.008 0.336 0.000 0.220 0.000 0.436
#> SRR1040820     2  0.0260     0.9912 0.000 0.992 0.000 0.000 0.008 0.000
#> SRR1040821     2  0.0260     0.9912 0.000 0.992 0.000 0.000 0.008 0.000
#> SRR1040822     3  0.4358     0.4839 0.012 0.000 0.624 0.000 0.016 0.348
#> SRR1040823     5  0.4467     0.5956 0.080 0.000 0.012 0.000 0.724 0.184
#> SRR1040824     2  0.0000     0.9914 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR1040826     3  0.5917     0.1038 0.012 0.000 0.428 0.000 0.144 0.416
#> SRR1040825     4  0.4348     0.5739 0.004 0.004 0.000 0.520 0.008 0.464
#> SRR1040827     2  0.0000     0.9914 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR1040828     4  0.1546     0.7404 0.016 0.000 0.000 0.944 0.020 0.020
#> SRR1040829     2  0.0146     0.9904 0.000 0.996 0.000 0.000 0.000 0.004
#> SRR1040830     1  0.2698     0.8152 0.872 0.000 0.016 0.000 0.092 0.020
#> SRR1040831     3  0.2234     0.6997 0.124 0.000 0.872 0.000 0.000 0.004
#> SRR1040832     5  0.5164     0.4898 0.012 0.000 0.000 0.176 0.656 0.156
#> SRR1040833     1  0.2520     0.7964 0.844 0.000 0.152 0.000 0.000 0.004
#> SRR1040834     5  0.2854     0.7263 0.088 0.000 0.000 0.004 0.860 0.048
#> SRR1040835     4  0.4218     0.6151 0.004 0.000 0.000 0.584 0.012 0.400
#> SRR1040836     1  0.1594     0.8928 0.932 0.000 0.052 0.000 0.016 0.000
#> SRR1040837     4  0.6195     0.5685 0.032 0.128 0.000 0.580 0.020 0.240
#> SRR1040839     2  0.0436     0.9852 0.004 0.988 0.000 0.000 0.004 0.004
#> SRR1040838     5  0.2062     0.7384 0.088 0.000 0.000 0.004 0.900 0.008
#> SRR1040840     2  0.0000     0.9914 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR1040841     1  0.1594     0.8928 0.932 0.000 0.052 0.000 0.016 0.000
#> SRR1040843     2  0.1078     0.9660 0.016 0.964 0.000 0.000 0.012 0.008
#> SRR1040842     4  0.3550     0.7003 0.064 0.000 0.000 0.832 0.048 0.056
#> SRR1040845     4  0.1934     0.7264 0.000 0.000 0.000 0.916 0.040 0.044
#> SRR1040844     1  0.1594     0.8928 0.932 0.000 0.052 0.000 0.016 0.000
#> SRR1040846     4  0.6925     0.3679 0.032 0.260 0.000 0.448 0.020 0.240
#> SRR1040847     1  0.1588     0.8846 0.924 0.000 0.072 0.000 0.000 0.004
#> SRR1040849     3  0.4582     0.4664 0.012 0.000 0.612 0.000 0.028 0.348
#> SRR1040848     2  0.0260     0.9912 0.000 0.992 0.000 0.000 0.008 0.000
#> SRR1040851     3  0.1957     0.7168 0.112 0.000 0.888 0.000 0.000 0.000
#> SRR1040850     5  0.2290     0.7380 0.084 0.000 0.000 0.004 0.892 0.020
#> SRR1040852     5  0.1949     0.7398 0.088 0.000 0.004 0.004 0.904 0.000
#> SRR1040853     5  0.1949     0.7398 0.088 0.000 0.004 0.004 0.904 0.000
#> SRR1040854     3  0.1863     0.7178 0.104 0.000 0.896 0.000 0.000 0.000
#> SRR1040855     5  0.4002     0.6503 0.076 0.000 0.012 0.000 0.776 0.136
#> SRR1040856     4  0.0405     0.7399 0.004 0.000 0.000 0.988 0.008 0.000
#> SRR1040857     3  0.1863     0.7178 0.104 0.000 0.896 0.000 0.000 0.000
#> SRR1040858     3  0.1863     0.7178 0.104 0.000 0.896 0.000 0.000 0.000
#> SRR1040859     4  0.1934     0.7264 0.000 0.000 0.000 0.916 0.040 0.044
#> SRR1040860     4  0.0405     0.7399 0.004 0.000 0.000 0.988 0.008 0.000
#> SRR1040861     5  0.5992     0.2247 0.084 0.000 0.052 0.000 0.508 0.356
#> SRR1040862     4  0.0653     0.7400 0.012 0.000 0.000 0.980 0.004 0.004
#> SRR1040863     4  0.0870     0.7383 0.012 0.000 0.000 0.972 0.012 0.004
#> SRR1040864     5  0.2034     0.6908 0.004 0.000 0.000 0.060 0.912 0.024
#> SRR1040865     5  0.4700     0.4894 0.288 0.000 0.000 0.000 0.636 0.076
#> SRR1040866     4  0.3861     0.5882 0.000 0.000 0.000 0.756 0.184 0.060
#> SRR1040867     6  0.7292     0.1401 0.192 0.000 0.248 0.000 0.144 0.416
#> SRR1040868     1  0.2611     0.8199 0.876 0.000 0.016 0.000 0.092 0.016
#> SRR1040869     3  0.1863     0.7178 0.104 0.000 0.896 0.000 0.000 0.000
#> SRR1040870     3  0.1643     0.6773 0.008 0.000 0.924 0.000 0.000 0.068
#> SRR1040871     3  0.2053     0.7166 0.108 0.000 0.888 0.000 0.000 0.004
#> SRR1040872     6  0.6851    -0.1023 0.184 0.000 0.068 0.000 0.344 0.404
#> SRR1040873     2  0.0260     0.9912 0.000 0.992 0.000 0.000 0.008 0.000
#> SRR1040874     1  0.1616     0.8911 0.932 0.000 0.048 0.000 0.020 0.000
#> SRR1040875     5  0.2162     0.7356 0.088 0.000 0.004 0.000 0.896 0.012
#> SRR1040876     1  0.1531     0.8855 0.928 0.000 0.068 0.000 0.000 0.004
#> SRR1040877     3  0.4358     0.4839 0.012 0.000 0.624 0.000 0.016 0.348
#> SRR1040878     5  0.5205     0.1630 0.000 0.000 0.000 0.384 0.520 0.096
#> SRR1040879     4  0.4801     0.5537 0.008 0.036 0.000 0.520 0.000 0.436
#> SRR1040880     1  0.1801     0.8916 0.924 0.000 0.056 0.000 0.016 0.004
#> SRR1040881     4  0.4348     0.5739 0.004 0.004 0.000 0.520 0.008 0.464
#> SRR1040882     6  0.7207     0.0668 0.156 0.000 0.284 0.000 0.144 0.416
#> SRR1040883     3  0.2006     0.7162 0.104 0.000 0.892 0.000 0.000 0.004
#> SRR1040884     1  0.2482     0.7985 0.848 0.000 0.148 0.000 0.000 0.004
#> SRR1040885     3  0.5917     0.1038 0.012 0.000 0.428 0.000 0.144 0.416

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

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

collect_plots(res)

plot of chunk ATC-skmeans-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 1.000           0.997       0.999         0.4955 0.505   0.505
#> 3 3 1.000           0.991       0.993         0.3429 0.813   0.635
#> 4 4 0.812           0.904       0.916         0.0722 0.963   0.890
#> 5 5 0.829           0.875       0.898         0.0747 0.928   0.758
#> 6 6 0.817           0.774       0.864         0.0260 0.994   0.975

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

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

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

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

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

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>            class entropy silhouette    p1    p2
#> SRR1040814     1    0.00      1.000 1.000 0.000
#> SRR1040813     1    0.00      1.000 1.000 0.000
#> SRR1040816     1    0.00      1.000 1.000 0.000
#> SRR1040815     2    0.00      0.997 0.000 1.000
#> SRR1040817     1    0.00      1.000 1.000 0.000
#> SRR1040818     2    0.00      0.997 0.000 1.000
#> SRR1040819     2    0.00      0.997 0.000 1.000
#> SRR1040820     2    0.00      0.997 0.000 1.000
#> SRR1040821     2    0.00      0.997 0.000 1.000
#> SRR1040822     1    0.00      1.000 1.000 0.000
#> SRR1040823     1    0.00      1.000 1.000 0.000
#> SRR1040824     2    0.00      0.997 0.000 1.000
#> SRR1040826     1    0.00      1.000 1.000 0.000
#> SRR1040825     2    0.00      0.997 0.000 1.000
#> SRR1040827     2    0.00      0.997 0.000 1.000
#> SRR1040828     2    0.00      0.997 0.000 1.000
#> SRR1040829     2    0.00      0.997 0.000 1.000
#> SRR1040830     1    0.00      1.000 1.000 0.000
#> SRR1040831     1    0.00      1.000 1.000 0.000
#> SRR1040832     2    0.00      0.997 0.000 1.000
#> SRR1040833     1    0.00      1.000 1.000 0.000
#> SRR1040834     1    0.00      1.000 1.000 0.000
#> SRR1040835     2    0.00      0.997 0.000 1.000
#> SRR1040836     1    0.00      1.000 1.000 0.000
#> SRR1040837     2    0.00      0.997 0.000 1.000
#> SRR1040839     2    0.00      0.997 0.000 1.000
#> SRR1040838     1    0.00      1.000 1.000 0.000
#> SRR1040840     2    0.00      0.997 0.000 1.000
#> SRR1040841     1    0.00      1.000 1.000 0.000
#> SRR1040843     2    0.00      0.997 0.000 1.000
#> SRR1040842     2    0.00      0.997 0.000 1.000
#> SRR1040845     2    0.00      0.997 0.000 1.000
#> SRR1040844     1    0.00      1.000 1.000 0.000
#> SRR1040846     2    0.00      0.997 0.000 1.000
#> SRR1040847     1    0.00      1.000 1.000 0.000
#> SRR1040849     1    0.00      1.000 1.000 0.000
#> SRR1040848     2    0.00      0.997 0.000 1.000
#> SRR1040851     1    0.00      1.000 1.000 0.000
#> SRR1040850     1    0.00      1.000 1.000 0.000
#> SRR1040852     1    0.00      1.000 1.000 0.000
#> SRR1040853     1    0.00      1.000 1.000 0.000
#> SRR1040854     1    0.00      1.000 1.000 0.000
#> SRR1040855     1    0.00      1.000 1.000 0.000
#> SRR1040856     2    0.00      0.997 0.000 1.000
#> SRR1040857     1    0.00      1.000 1.000 0.000
#> SRR1040858     1    0.00      1.000 1.000 0.000
#> SRR1040859     2    0.00      0.997 0.000 1.000
#> SRR1040860     2    0.00      0.997 0.000 1.000
#> SRR1040861     1    0.00      1.000 1.000 0.000
#> SRR1040862     2    0.00      0.997 0.000 1.000
#> SRR1040863     2    0.00      0.997 0.000 1.000
#> SRR1040864     2    0.43      0.904 0.088 0.912
#> SRR1040865     1    0.00      1.000 1.000 0.000
#> SRR1040866     2    0.00      0.997 0.000 1.000
#> SRR1040867     1    0.00      1.000 1.000 0.000
#> SRR1040868     1    0.00      1.000 1.000 0.000
#> SRR1040869     1    0.00      1.000 1.000 0.000
#> SRR1040870     1    0.00      1.000 1.000 0.000
#> SRR1040871     1    0.00      1.000 1.000 0.000
#> SRR1040872     1    0.00      1.000 1.000 0.000
#> SRR1040873     2    0.00      0.997 0.000 1.000
#> SRR1040874     1    0.00      1.000 1.000 0.000
#> SRR1040875     1    0.00      1.000 1.000 0.000
#> SRR1040876     1    0.00      1.000 1.000 0.000
#> SRR1040877     1    0.00      1.000 1.000 0.000
#> SRR1040878     2    0.00      0.997 0.000 1.000
#> SRR1040879     2    0.00      0.997 0.000 1.000
#> SRR1040880     1    0.00      1.000 1.000 0.000
#> SRR1040881     2    0.00      0.997 0.000 1.000
#> SRR1040882     1    0.00      1.000 1.000 0.000
#> SRR1040883     1    0.00      1.000 1.000 0.000
#> SRR1040884     1    0.00      1.000 1.000 0.000
#> SRR1040885     1    0.00      1.000 1.000 0.000

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>            class entropy silhouette    p1 p2    p3
#> SRR1040814     3  0.1643      0.972 0.044  0 0.956
#> SRR1040813     3  0.0000      0.976 0.000  0 1.000
#> SRR1040816     1  0.0000      1.000 1.000  0 0.000
#> SRR1040815     2  0.0000      1.000 0.000  1 0.000
#> SRR1040817     3  0.1643      0.972 0.044  0 0.956
#> SRR1040818     2  0.0000      1.000 0.000  1 0.000
#> SRR1040819     2  0.0000      1.000 0.000  1 0.000
#> SRR1040820     2  0.0000      1.000 0.000  1 0.000
#> SRR1040821     2  0.0000      1.000 0.000  1 0.000
#> SRR1040822     3  0.1643      0.972 0.044  0 0.956
#> SRR1040823     3  0.0000      0.976 0.000  0 1.000
#> SRR1040824     2  0.0000      1.000 0.000  1 0.000
#> SRR1040826     3  0.0424      0.977 0.008  0 0.992
#> SRR1040825     2  0.0000      1.000 0.000  1 0.000
#> SRR1040827     2  0.0000      1.000 0.000  1 0.000
#> SRR1040828     2  0.0000      1.000 0.000  1 0.000
#> SRR1040829     2  0.0000      1.000 0.000  1 0.000
#> SRR1040830     1  0.0000      1.000 1.000  0 0.000
#> SRR1040831     1  0.0000      1.000 1.000  0 0.000
#> SRR1040832     2  0.0000      1.000 0.000  1 0.000
#> SRR1040833     1  0.0000      1.000 1.000  0 0.000
#> SRR1040834     3  0.2959      0.916 0.100  0 0.900
#> SRR1040835     2  0.0000      1.000 0.000  1 0.000
#> SRR1040836     1  0.0000      1.000 1.000  0 0.000
#> SRR1040837     2  0.0000      1.000 0.000  1 0.000
#> SRR1040839     2  0.0000      1.000 0.000  1 0.000
#> SRR1040838     3  0.0000      0.976 0.000  0 1.000
#> SRR1040840     2  0.0000      1.000 0.000  1 0.000
#> SRR1040841     1  0.0000      1.000 1.000  0 0.000
#> SRR1040843     2  0.0000      1.000 0.000  1 0.000
#> SRR1040842     2  0.0000      1.000 0.000  1 0.000
#> SRR1040845     2  0.0000      1.000 0.000  1 0.000
#> SRR1040844     1  0.0000      1.000 1.000  0 0.000
#> SRR1040846     2  0.0000      1.000 0.000  1 0.000
#> SRR1040847     1  0.0000      1.000 1.000  0 0.000
#> SRR1040849     3  0.1529      0.973 0.040  0 0.960
#> SRR1040848     2  0.0000      1.000 0.000  1 0.000
#> SRR1040851     1  0.0000      1.000 1.000  0 0.000
#> SRR1040850     3  0.0000      0.976 0.000  0 1.000
#> SRR1040852     3  0.0000      0.976 0.000  0 1.000
#> SRR1040853     3  0.0000      0.976 0.000  0 1.000
#> SRR1040854     1  0.0000      1.000 1.000  0 0.000
#> SRR1040855     3  0.0000      0.976 0.000  0 1.000
#> SRR1040856     2  0.0000      1.000 0.000  1 0.000
#> SRR1040857     1  0.0000      1.000 1.000  0 0.000
#> SRR1040858     1  0.0000      1.000 1.000  0 0.000
#> SRR1040859     2  0.0000      1.000 0.000  1 0.000
#> SRR1040860     2  0.0000      1.000 0.000  1 0.000
#> SRR1040861     3  0.0000      0.976 0.000  0 1.000
#> SRR1040862     2  0.0000      1.000 0.000  1 0.000
#> SRR1040863     2  0.0000      1.000 0.000  1 0.000
#> SRR1040864     3  0.0000      0.976 0.000  0 1.000
#> SRR1040865     1  0.0000      1.000 1.000  0 0.000
#> SRR1040866     2  0.0000      1.000 0.000  1 0.000
#> SRR1040867     3  0.1643      0.972 0.044  0 0.956
#> SRR1040868     1  0.0000      1.000 1.000  0 0.000
#> SRR1040869     1  0.0000      1.000 1.000  0 0.000
#> SRR1040870     3  0.1643      0.972 0.044  0 0.956
#> SRR1040871     1  0.0000      1.000 1.000  0 0.000
#> SRR1040872     3  0.0424      0.977 0.008  0 0.992
#> SRR1040873     2  0.0000      1.000 0.000  1 0.000
#> SRR1040874     1  0.0000      1.000 1.000  0 0.000
#> SRR1040875     3  0.1643      0.972 0.044  0 0.956
#> SRR1040876     1  0.0000      1.000 1.000  0 0.000
#> SRR1040877     3  0.1643      0.972 0.044  0 0.956
#> SRR1040878     2  0.0000      1.000 0.000  1 0.000
#> SRR1040879     2  0.0000      1.000 0.000  1 0.000
#> SRR1040880     1  0.0000      1.000 1.000  0 0.000
#> SRR1040881     2  0.0000      1.000 0.000  1 0.000
#> SRR1040882     3  0.1643      0.972 0.044  0 0.956
#> SRR1040883     1  0.0000      1.000 1.000  0 0.000
#> SRR1040884     1  0.0000      1.000 1.000  0 0.000
#> SRR1040885     3  0.0000      0.976 0.000  0 1.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> SRR1040814     3   0.550      0.964 0.024 0.000 0.604 0.372
#> SRR1040813     3   0.484      0.952 0.000 0.000 0.604 0.396
#> SRR1040816     1   0.000      0.970 1.000 0.000 0.000 0.000
#> SRR1040815     2   0.234      0.883 0.000 0.900 0.100 0.000
#> SRR1040817     3   0.550      0.964 0.024 0.000 0.604 0.372
#> SRR1040818     2   0.234      0.883 0.000 0.900 0.100 0.000
#> SRR1040819     2   0.234      0.883 0.000 0.900 0.100 0.000
#> SRR1040820     2   0.000      0.901 0.000 1.000 0.000 0.000
#> SRR1040821     2   0.000      0.901 0.000 1.000 0.000 0.000
#> SRR1040822     3   0.550      0.964 0.024 0.000 0.604 0.372
#> SRR1040823     3   0.489      0.934 0.000 0.000 0.588 0.412
#> SRR1040824     2   0.234      0.883 0.000 0.900 0.100 0.000
#> SRR1040826     3   0.484      0.952 0.000 0.000 0.604 0.396
#> SRR1040825     2   0.234      0.883 0.000 0.900 0.100 0.000
#> SRR1040827     2   0.228      0.884 0.000 0.904 0.096 0.000
#> SRR1040828     2   0.000      0.901 0.000 1.000 0.000 0.000
#> SRR1040829     2   0.000      0.901 0.000 1.000 0.000 0.000
#> SRR1040830     1   0.000      0.970 1.000 0.000 0.000 0.000
#> SRR1040831     1   0.000      0.970 1.000 0.000 0.000 0.000
#> SRR1040832     2   0.234      0.883 0.000 0.900 0.100 0.000
#> SRR1040833     1   0.000      0.970 1.000 0.000 0.000 0.000
#> SRR1040834     3   0.656      0.813 0.092 0.000 0.564 0.344
#> SRR1040835     2   0.234      0.883 0.000 0.900 0.100 0.000
#> SRR1040836     1   0.000      0.970 1.000 0.000 0.000 0.000
#> SRR1040837     2   0.000      0.901 0.000 1.000 0.000 0.000
#> SRR1040839     2   0.000      0.901 0.000 1.000 0.000 0.000
#> SRR1040838     4   0.121      0.871 0.000 0.000 0.040 0.960
#> SRR1040840     2   0.000      0.901 0.000 1.000 0.000 0.000
#> SRR1040841     1   0.000      0.970 1.000 0.000 0.000 0.000
#> SRR1040843     2   0.000      0.901 0.000 1.000 0.000 0.000
#> SRR1040842     2   0.565      0.739 0.000 0.712 0.192 0.096
#> SRR1040845     2   0.349      0.827 0.000 0.812 0.188 0.000
#> SRR1040844     1   0.000      0.970 1.000 0.000 0.000 0.000
#> SRR1040846     2   0.000      0.901 0.000 1.000 0.000 0.000
#> SRR1040847     1   0.000      0.970 1.000 0.000 0.000 0.000
#> SRR1040849     3   0.541      0.963 0.020 0.000 0.604 0.376
#> SRR1040848     2   0.000      0.901 0.000 1.000 0.000 0.000
#> SRR1040851     1   0.287      0.857 0.864 0.000 0.136 0.000
#> SRR1040850     4   0.000      0.849 0.000 0.000 0.000 1.000
#> SRR1040852     4   0.130      0.868 0.000 0.000 0.044 0.956
#> SRR1040853     4   0.130      0.868 0.000 0.000 0.044 0.956
#> SRR1040854     1   0.265      0.876 0.880 0.000 0.120 0.000
#> SRR1040855     4   0.121      0.871 0.000 0.000 0.040 0.960
#> SRR1040856     2   0.349      0.827 0.000 0.812 0.188 0.000
#> SRR1040857     1   0.265      0.876 0.880 0.000 0.120 0.000
#> SRR1040858     1   0.112      0.946 0.964 0.000 0.036 0.000
#> SRR1040859     2   0.349      0.827 0.000 0.812 0.188 0.000
#> SRR1040860     2   0.349      0.827 0.000 0.812 0.188 0.000
#> SRR1040861     3   0.489      0.934 0.000 0.000 0.588 0.412
#> SRR1040862     2   0.349      0.827 0.000 0.812 0.188 0.000
#> SRR1040863     2   0.349      0.827 0.000 0.812 0.188 0.000
#> SRR1040864     4   0.413      0.599 0.000 0.000 0.260 0.740
#> SRR1040865     1   0.000      0.970 1.000 0.000 0.000 0.000
#> SRR1040866     2   0.453      0.740 0.000 0.704 0.292 0.004
#> SRR1040867     3   0.550      0.964 0.024 0.000 0.604 0.372
#> SRR1040868     1   0.000      0.970 1.000 0.000 0.000 0.000
#> SRR1040869     1   0.265      0.876 0.880 0.000 0.120 0.000
#> SRR1040870     3   0.550      0.964 0.024 0.000 0.604 0.372
#> SRR1040871     1   0.000      0.970 1.000 0.000 0.000 0.000
#> SRR1040872     3   0.484      0.952 0.000 0.000 0.604 0.396
#> SRR1040873     2   0.000      0.901 0.000 1.000 0.000 0.000
#> SRR1040874     1   0.000      0.970 1.000 0.000 0.000 0.000
#> SRR1040875     3   0.550      0.964 0.024 0.000 0.604 0.372
#> SRR1040876     1   0.000      0.970 1.000 0.000 0.000 0.000
#> SRR1040877     3   0.550      0.964 0.024 0.000 0.604 0.372
#> SRR1040878     2   0.438      0.740 0.000 0.704 0.296 0.000
#> SRR1040879     2   0.234      0.883 0.000 0.900 0.100 0.000
#> SRR1040880     1   0.000      0.970 1.000 0.000 0.000 0.000
#> SRR1040881     2   0.234      0.883 0.000 0.900 0.100 0.000
#> SRR1040882     3   0.541      0.963 0.020 0.000 0.604 0.376
#> SRR1040883     1   0.000      0.970 1.000 0.000 0.000 0.000
#> SRR1040884     1   0.000      0.970 1.000 0.000 0.000 0.000
#> SRR1040885     3   0.484      0.952 0.000 0.000 0.604 0.396

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>            class entropy silhouette    p1    p2    p3    p4    p5
#> SRR1040814     3  0.0000      0.975 0.000 0.000 1.000 0.000 0.000
#> SRR1040813     3  0.0000      0.975 0.000 0.000 1.000 0.000 0.000
#> SRR1040816     1  0.0290      0.932 0.992 0.000 0.000 0.008 0.000
#> SRR1040815     2  0.0000      0.764 0.000 1.000 0.000 0.000 0.000
#> SRR1040817     3  0.0000      0.975 0.000 0.000 1.000 0.000 0.000
#> SRR1040818     2  0.0000      0.764 0.000 1.000 0.000 0.000 0.000
#> SRR1040819     2  0.0000      0.764 0.000 1.000 0.000 0.000 0.000
#> SRR1040820     2  0.3752      0.741 0.000 0.708 0.000 0.292 0.000
#> SRR1040821     2  0.3752      0.741 0.000 0.708 0.000 0.292 0.000
#> SRR1040822     3  0.0000      0.975 0.000 0.000 1.000 0.000 0.000
#> SRR1040823     3  0.0880      0.946 0.000 0.000 0.968 0.000 0.032
#> SRR1040824     2  0.0000      0.764 0.000 1.000 0.000 0.000 0.000
#> SRR1040826     3  0.0000      0.975 0.000 0.000 1.000 0.000 0.000
#> SRR1040825     2  0.0000      0.764 0.000 1.000 0.000 0.000 0.000
#> SRR1040827     2  0.0609      0.764 0.000 0.980 0.000 0.020 0.000
#> SRR1040828     2  0.3752      0.741 0.000 0.708 0.000 0.292 0.000
#> SRR1040829     2  0.3752      0.741 0.000 0.708 0.000 0.292 0.000
#> SRR1040830     1  0.0290      0.932 0.992 0.000 0.000 0.008 0.000
#> SRR1040831     1  0.0162      0.931 0.996 0.000 0.004 0.000 0.000
#> SRR1040832     2  0.1764      0.699 0.000 0.928 0.000 0.064 0.008
#> SRR1040833     1  0.0290      0.932 0.992 0.000 0.000 0.008 0.000
#> SRR1040834     3  0.5099      0.700 0.100 0.000 0.756 0.072 0.072
#> SRR1040835     2  0.0000      0.764 0.000 1.000 0.000 0.000 0.000
#> SRR1040836     1  0.0000      0.931 1.000 0.000 0.000 0.000 0.000
#> SRR1040837     2  0.3752      0.741 0.000 0.708 0.000 0.292 0.000
#> SRR1040839     2  0.3752      0.741 0.000 0.708 0.000 0.292 0.000
#> SRR1040838     5  0.2280      0.945 0.000 0.000 0.120 0.000 0.880
#> SRR1040840     2  0.3752      0.741 0.000 0.708 0.000 0.292 0.000
#> SRR1040841     1  0.0290      0.932 0.992 0.000 0.000 0.008 0.000
#> SRR1040843     2  0.3752      0.741 0.000 0.708 0.000 0.292 0.000
#> SRR1040842     4  0.2909      0.969 0.000 0.140 0.000 0.848 0.012
#> SRR1040845     4  0.2561      0.977 0.000 0.144 0.000 0.856 0.000
#> SRR1040844     1  0.0290      0.932 0.992 0.000 0.000 0.008 0.000
#> SRR1040846     2  0.3752      0.741 0.000 0.708 0.000 0.292 0.000
#> SRR1040847     1  0.0290      0.932 0.992 0.000 0.000 0.008 0.000
#> SRR1040849     3  0.0000      0.975 0.000 0.000 1.000 0.000 0.000
#> SRR1040848     2  0.3752      0.741 0.000 0.708 0.000 0.292 0.000
#> SRR1040851     1  0.3661      0.685 0.724 0.000 0.276 0.000 0.000
#> SRR1040850     5  0.0794      0.906 0.000 0.000 0.028 0.000 0.972
#> SRR1040852     5  0.2471      0.938 0.000 0.000 0.136 0.000 0.864
#> SRR1040853     5  0.2471      0.938 0.000 0.000 0.136 0.000 0.864
#> SRR1040854     1  0.3424      0.732 0.760 0.000 0.240 0.000 0.000
#> SRR1040855     5  0.2280      0.944 0.000 0.000 0.120 0.000 0.880
#> SRR1040856     4  0.2690      0.970 0.000 0.156 0.000 0.844 0.000
#> SRR1040857     1  0.3336      0.745 0.772 0.000 0.228 0.000 0.000
#> SRR1040858     1  0.1732      0.880 0.920 0.000 0.080 0.000 0.000
#> SRR1040859     4  0.2648      0.974 0.000 0.152 0.000 0.848 0.000
#> SRR1040860     4  0.2605      0.976 0.000 0.148 0.000 0.852 0.000
#> SRR1040861     3  0.1544      0.904 0.000 0.000 0.932 0.000 0.068
#> SRR1040862     4  0.2605      0.977 0.000 0.148 0.000 0.852 0.000
#> SRR1040863     4  0.2561      0.977 0.000 0.144 0.000 0.856 0.000
#> SRR1040864     5  0.0451      0.887 0.000 0.000 0.008 0.004 0.988
#> SRR1040865     1  0.1043      0.912 0.960 0.000 0.000 0.040 0.000
#> SRR1040866     4  0.2516      0.975 0.000 0.140 0.000 0.860 0.000
#> SRR1040867     3  0.0000      0.975 0.000 0.000 1.000 0.000 0.000
#> SRR1040868     1  0.0162      0.931 0.996 0.000 0.000 0.004 0.000
#> SRR1040869     1  0.3452      0.728 0.756 0.000 0.244 0.000 0.000
#> SRR1040870     3  0.0000      0.975 0.000 0.000 1.000 0.000 0.000
#> SRR1040871     1  0.0162      0.931 0.996 0.000 0.004 0.000 0.000
#> SRR1040872     3  0.0000      0.975 0.000 0.000 1.000 0.000 0.000
#> SRR1040873     2  0.3752      0.741 0.000 0.708 0.000 0.292 0.000
#> SRR1040874     1  0.0290      0.932 0.992 0.000 0.000 0.008 0.000
#> SRR1040875     3  0.0000      0.975 0.000 0.000 1.000 0.000 0.000
#> SRR1040876     1  0.0290      0.932 0.992 0.000 0.000 0.008 0.000
#> SRR1040877     3  0.0000      0.975 0.000 0.000 1.000 0.000 0.000
#> SRR1040878     4  0.1892      0.896 0.000 0.080 0.000 0.916 0.004
#> SRR1040879     2  0.0000      0.764 0.000 1.000 0.000 0.000 0.000
#> SRR1040880     1  0.0162      0.931 0.996 0.000 0.000 0.004 0.000
#> SRR1040881     2  0.0000      0.764 0.000 1.000 0.000 0.000 0.000
#> SRR1040882     3  0.0000      0.975 0.000 0.000 1.000 0.000 0.000
#> SRR1040883     1  0.0162      0.931 0.996 0.000 0.004 0.000 0.000
#> SRR1040884     1  0.0162      0.931 0.996 0.000 0.004 0.000 0.000
#> SRR1040885     3  0.0000      0.975 0.000 0.000 1.000 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>            class entropy silhouette    p1    p2    p3    p4    p5    p6
#> SRR1040814     3  0.0146     0.9469 0.000 0.000 0.996 0.000 0.000 0.004
#> SRR1040813     3  0.1116     0.9398 0.000 0.000 0.960 0.004 0.008 0.028
#> SRR1040816     1  0.1007     0.8489 0.956 0.000 0.000 0.000 0.000 0.044
#> SRR1040815     2  0.0146     0.6647 0.000 0.996 0.000 0.000 0.000 0.004
#> SRR1040817     3  0.0146     0.9469 0.000 0.000 0.996 0.000 0.000 0.004
#> SRR1040818     2  0.0146     0.6647 0.000 0.996 0.000 0.000 0.000 0.004
#> SRR1040819     2  0.0146     0.6647 0.000 0.996 0.000 0.000 0.000 0.004
#> SRR1040820     2  0.3774     0.6630 0.000 0.592 0.000 0.000 0.408 0.000
#> SRR1040821     2  0.3774     0.6630 0.000 0.592 0.000 0.000 0.408 0.000
#> SRR1040822     3  0.0000     0.9480 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1040823     3  0.2655     0.8411 0.000 0.000 0.884 0.020 0.060 0.036
#> SRR1040824     2  0.0713     0.6747 0.000 0.972 0.000 0.000 0.028 0.000
#> SRR1040826     3  0.1003     0.9417 0.000 0.000 0.964 0.004 0.004 0.028
#> SRR1040825     2  0.0146     0.6647 0.000 0.996 0.000 0.000 0.000 0.004
#> SRR1040827     2  0.2340     0.6800 0.000 0.852 0.000 0.000 0.148 0.000
#> SRR1040828     2  0.3899     0.6629 0.000 0.592 0.000 0.000 0.404 0.004
#> SRR1040829     2  0.3774     0.6630 0.000 0.592 0.000 0.000 0.408 0.000
#> SRR1040830     1  0.1007     0.8489 0.956 0.000 0.000 0.000 0.000 0.044
#> SRR1040831     1  0.0405     0.8498 0.988 0.000 0.008 0.000 0.000 0.004
#> SRR1040832     2  0.3854     0.0106 0.000 0.536 0.000 0.000 0.000 0.464
#> SRR1040833     1  0.0937     0.8505 0.960 0.000 0.000 0.000 0.000 0.040
#> SRR1040834     6  0.4855     0.0000 0.060 0.000 0.248 0.004 0.016 0.672
#> SRR1040835     2  0.0146     0.6647 0.000 0.996 0.000 0.000 0.000 0.004
#> SRR1040836     1  0.0291     0.8499 0.992 0.000 0.004 0.000 0.000 0.004
#> SRR1040837     2  0.3774     0.6630 0.000 0.592 0.000 0.000 0.408 0.000
#> SRR1040839     2  0.3774     0.6630 0.000 0.592 0.000 0.000 0.408 0.000
#> SRR1040838     5  0.6287     0.9023 0.000 0.000 0.120 0.344 0.484 0.052
#> SRR1040840     2  0.3774     0.6630 0.000 0.592 0.000 0.000 0.408 0.000
#> SRR1040841     1  0.0937     0.8505 0.960 0.000 0.000 0.000 0.000 0.040
#> SRR1040843     2  0.3774     0.6630 0.000 0.592 0.000 0.000 0.408 0.000
#> SRR1040842     4  0.4610     0.9232 0.000 0.044 0.000 0.568 0.388 0.000
#> SRR1040845     4  0.4609     0.9410 0.000 0.048 0.000 0.588 0.364 0.000
#> SRR1040844     1  0.0937     0.8505 0.960 0.000 0.000 0.000 0.000 0.040
#> SRR1040846     2  0.3774     0.6630 0.000 0.592 0.000 0.000 0.408 0.000
#> SRR1040847     1  0.0937     0.8505 0.960 0.000 0.000 0.000 0.000 0.040
#> SRR1040849     3  0.0000     0.9480 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1040848     2  0.3756     0.6645 0.000 0.600 0.000 0.000 0.400 0.000
#> SRR1040851     1  0.3915     0.3536 0.584 0.000 0.412 0.000 0.000 0.004
#> SRR1040850     5  0.5095     0.8245 0.000 0.000 0.008 0.344 0.576 0.072
#> SRR1040852     5  0.6347     0.8977 0.000 0.000 0.128 0.344 0.476 0.052
#> SRR1040853     5  0.6347     0.8977 0.000 0.000 0.128 0.344 0.476 0.052
#> SRR1040854     1  0.3742     0.4888 0.648 0.000 0.348 0.000 0.000 0.004
#> SRR1040855     5  0.6297     0.9018 0.000 0.000 0.116 0.340 0.488 0.056
#> SRR1040856     4  0.4690     0.9151 0.000 0.048 0.000 0.552 0.400 0.000
#> SRR1040857     1  0.3714     0.5019 0.656 0.000 0.340 0.000 0.000 0.004
#> SRR1040858     1  0.2482     0.7574 0.848 0.000 0.148 0.000 0.000 0.004
#> SRR1040859     4  0.4552     0.9418 0.000 0.044 0.000 0.592 0.364 0.000
#> SRR1040860     4  0.4552     0.9418 0.000 0.044 0.000 0.592 0.364 0.000
#> SRR1040861     3  0.3255     0.7788 0.000 0.000 0.848 0.032 0.076 0.044
#> SRR1040862     4  0.4630     0.9388 0.000 0.048 0.000 0.580 0.372 0.000
#> SRR1040863     4  0.4563     0.9419 0.000 0.044 0.000 0.588 0.368 0.000
#> SRR1040864     5  0.4993     0.8021 0.000 0.000 0.000 0.360 0.560 0.080
#> SRR1040865     1  0.2790     0.7401 0.840 0.000 0.000 0.020 0.000 0.140
#> SRR1040866     4  0.4344     0.9280 0.000 0.032 0.000 0.612 0.356 0.000
#> SRR1040867     3  0.0146     0.9469 0.000 0.000 0.996 0.000 0.000 0.004
#> SRR1040868     1  0.0547     0.8468 0.980 0.000 0.000 0.000 0.000 0.020
#> SRR1040869     1  0.3782     0.4666 0.636 0.000 0.360 0.000 0.000 0.004
#> SRR1040870     3  0.0146     0.9469 0.000 0.000 0.996 0.000 0.000 0.004
#> SRR1040871     1  0.1285     0.8357 0.944 0.000 0.052 0.000 0.000 0.004
#> SRR1040872     3  0.1116     0.9398 0.000 0.000 0.960 0.004 0.008 0.028
#> SRR1040873     2  0.3774     0.6630 0.000 0.592 0.000 0.000 0.408 0.000
#> SRR1040874     1  0.0937     0.8505 0.960 0.000 0.000 0.000 0.000 0.040
#> SRR1040875     3  0.0692     0.9475 0.000 0.000 0.976 0.004 0.000 0.020
#> SRR1040876     1  0.0937     0.8505 0.960 0.000 0.000 0.000 0.000 0.040
#> SRR1040877     3  0.0146     0.9469 0.000 0.000 0.996 0.000 0.000 0.004
#> SRR1040878     4  0.6426     0.5995 0.000 0.040 0.000 0.500 0.232 0.228
#> SRR1040879     2  0.0000     0.6661 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR1040880     1  0.0632     0.8457 0.976 0.000 0.000 0.000 0.000 0.024
#> SRR1040881     2  0.0146     0.6647 0.000 0.996 0.000 0.000 0.000 0.004
#> SRR1040882     3  0.0713     0.9439 0.000 0.000 0.972 0.000 0.000 0.028
#> SRR1040883     1  0.1531     0.8265 0.928 0.000 0.068 0.000 0.000 0.004
#> SRR1040884     1  0.1225     0.8445 0.952 0.000 0.036 0.000 0.000 0.012
#> SRR1040885     3  0.1116     0.9398 0.000 0.000 0.960 0.004 0.008 0.028

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

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

collect_plots(res)

plot of chunk ATC-pam-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 1.000           0.983       0.993         0.4937 0.505   0.505
#> 3 3 0.897           0.912       0.963         0.3509 0.770   0.569
#> 4 4 0.812           0.841       0.935         0.0885 0.918   0.761
#> 5 5 0.815           0.724       0.869         0.0919 0.877   0.583
#> 6 6 0.805           0.639       0.853         0.0382 0.960   0.801

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
#> SRR1040814     1   0.000      1.000 1.000 0.000
#> SRR1040813     1   0.000      1.000 1.000 0.000
#> SRR1040816     1   0.000      1.000 1.000 0.000
#> SRR1040815     2   0.000      0.984 0.000 1.000
#> SRR1040817     1   0.000      1.000 1.000 0.000
#> SRR1040818     2   0.000      0.984 0.000 1.000
#> SRR1040819     2   0.000      0.984 0.000 1.000
#> SRR1040820     2   0.000      0.984 0.000 1.000
#> SRR1040821     2   0.000      0.984 0.000 1.000
#> SRR1040822     1   0.000      1.000 1.000 0.000
#> SRR1040823     1   0.000      1.000 1.000 0.000
#> SRR1040824     2   0.000      0.984 0.000 1.000
#> SRR1040826     1   0.000      1.000 1.000 0.000
#> SRR1040825     2   0.000      0.984 0.000 1.000
#> SRR1040827     2   0.000      0.984 0.000 1.000
#> SRR1040828     2   0.000      0.984 0.000 1.000
#> SRR1040829     2   0.000      0.984 0.000 1.000
#> SRR1040830     1   0.000      1.000 1.000 0.000
#> SRR1040831     1   0.000      1.000 1.000 0.000
#> SRR1040832     2   0.000      0.984 0.000 1.000
#> SRR1040833     1   0.000      1.000 1.000 0.000
#> SRR1040834     1   0.000      1.000 1.000 0.000
#> SRR1040835     2   0.000      0.984 0.000 1.000
#> SRR1040836     1   0.000      1.000 1.000 0.000
#> SRR1040837     2   0.000      0.984 0.000 1.000
#> SRR1040839     2   0.000      0.984 0.000 1.000
#> SRR1040838     1   0.000      1.000 1.000 0.000
#> SRR1040840     2   0.000      0.984 0.000 1.000
#> SRR1040841     1   0.000      1.000 1.000 0.000
#> SRR1040843     2   0.000      0.984 0.000 1.000
#> SRR1040842     2   0.000      0.984 0.000 1.000
#> SRR1040845     2   0.000      0.984 0.000 1.000
#> SRR1040844     1   0.000      1.000 1.000 0.000
#> SRR1040846     2   0.000      0.984 0.000 1.000
#> SRR1040847     1   0.000      1.000 1.000 0.000
#> SRR1040849     1   0.000      1.000 1.000 0.000
#> SRR1040848     2   0.000      0.984 0.000 1.000
#> SRR1040851     1   0.000      1.000 1.000 0.000
#> SRR1040850     1   0.000      1.000 1.000 0.000
#> SRR1040852     1   0.000      1.000 1.000 0.000
#> SRR1040853     1   0.000      1.000 1.000 0.000
#> SRR1040854     1   0.000      1.000 1.000 0.000
#> SRR1040855     1   0.000      1.000 1.000 0.000
#> SRR1040856     2   0.000      0.984 0.000 1.000
#> SRR1040857     1   0.000      1.000 1.000 0.000
#> SRR1040858     1   0.000      1.000 1.000 0.000
#> SRR1040859     2   0.000      0.984 0.000 1.000
#> SRR1040860     2   0.000      0.984 0.000 1.000
#> SRR1040861     1   0.000      1.000 1.000 0.000
#> SRR1040862     2   0.000      0.984 0.000 1.000
#> SRR1040863     2   0.000      0.984 0.000 1.000
#> SRR1040864     2   0.971      0.340 0.400 0.600
#> SRR1040865     1   0.000      1.000 1.000 0.000
#> SRR1040866     2   0.000      0.984 0.000 1.000
#> SRR1040867     1   0.000      1.000 1.000 0.000
#> SRR1040868     1   0.000      1.000 1.000 0.000
#> SRR1040869     1   0.000      1.000 1.000 0.000
#> SRR1040870     1   0.000      1.000 1.000 0.000
#> SRR1040871     1   0.000      1.000 1.000 0.000
#> SRR1040872     1   0.000      1.000 1.000 0.000
#> SRR1040873     2   0.000      0.984 0.000 1.000
#> SRR1040874     1   0.000      1.000 1.000 0.000
#> SRR1040875     1   0.000      1.000 1.000 0.000
#> SRR1040876     1   0.000      1.000 1.000 0.000
#> SRR1040877     1   0.000      1.000 1.000 0.000
#> SRR1040878     2   0.388      0.908 0.076 0.924
#> SRR1040879     2   0.000      0.984 0.000 1.000
#> SRR1040880     1   0.000      1.000 1.000 0.000
#> SRR1040881     2   0.000      0.984 0.000 1.000
#> SRR1040882     1   0.000      1.000 1.000 0.000
#> SRR1040883     1   0.000      1.000 1.000 0.000
#> SRR1040884     1   0.000      1.000 1.000 0.000
#> SRR1040885     1   0.000      1.000 1.000 0.000

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>            class entropy silhouette    p1   p2    p3
#> SRR1040814     1   0.000      0.933 1.000 0.00 0.000
#> SRR1040813     1   0.608      0.415 0.612 0.00 0.388
#> SRR1040816     3   0.440      0.737 0.188 0.00 0.812
#> SRR1040815     2   0.000      1.000 0.000 1.00 0.000
#> SRR1040817     1   0.000      0.933 1.000 0.00 0.000
#> SRR1040818     3   0.000      0.940 0.000 0.00 1.000
#> SRR1040819     2   0.000      1.000 0.000 1.00 0.000
#> SRR1040820     2   0.000      1.000 0.000 1.00 0.000
#> SRR1040821     2   0.000      1.000 0.000 1.00 0.000
#> SRR1040822     1   0.000      0.933 1.000 0.00 0.000
#> SRR1040823     3   0.000      0.940 0.000 0.00 1.000
#> SRR1040824     2   0.000      1.000 0.000 1.00 0.000
#> SRR1040826     1   0.480      0.725 0.780 0.00 0.220
#> SRR1040825     2   0.000      1.000 0.000 1.00 0.000
#> SRR1040827     2   0.000      1.000 0.000 1.00 0.000
#> SRR1040828     2   0.000      1.000 0.000 1.00 0.000
#> SRR1040829     2   0.000      1.000 0.000 1.00 0.000
#> SRR1040830     1   0.562      0.589 0.692 0.00 0.308
#> SRR1040831     1   0.000      0.933 1.000 0.00 0.000
#> SRR1040832     3   0.000      0.940 0.000 0.00 1.000
#> SRR1040833     1   0.000      0.933 1.000 0.00 0.000
#> SRR1040834     3   0.000      0.940 0.000 0.00 1.000
#> SRR1040835     2   0.000      1.000 0.000 1.00 0.000
#> SRR1040836     1   0.000      0.933 1.000 0.00 0.000
#> SRR1040837     2   0.000      1.000 0.000 1.00 0.000
#> SRR1040839     2   0.000      1.000 0.000 1.00 0.000
#> SRR1040838     3   0.000      0.940 0.000 0.00 1.000
#> SRR1040840     2   0.000      1.000 0.000 1.00 0.000
#> SRR1040841     1   0.000      0.933 1.000 0.00 0.000
#> SRR1040843     2   0.000      1.000 0.000 1.00 0.000
#> SRR1040842     2   0.000      1.000 0.000 1.00 0.000
#> SRR1040845     2   0.000      1.000 0.000 1.00 0.000
#> SRR1040844     1   0.000      0.933 1.000 0.00 0.000
#> SRR1040846     2   0.000      1.000 0.000 1.00 0.000
#> SRR1040847     1   0.000      0.933 1.000 0.00 0.000
#> SRR1040849     1   0.000      0.933 1.000 0.00 0.000
#> SRR1040848     2   0.000      1.000 0.000 1.00 0.000
#> SRR1040851     1   0.000      0.933 1.000 0.00 0.000
#> SRR1040850     3   0.000      0.940 0.000 0.00 1.000
#> SRR1040852     3   0.000      0.940 0.000 0.00 1.000
#> SRR1040853     3   0.000      0.940 0.000 0.00 1.000
#> SRR1040854     1   0.000      0.933 1.000 0.00 0.000
#> SRR1040855     3   0.000      0.940 0.000 0.00 1.000
#> SRR1040856     2   0.000      1.000 0.000 1.00 0.000
#> SRR1040857     1   0.000      0.933 1.000 0.00 0.000
#> SRR1040858     1   0.000      0.933 1.000 0.00 0.000
#> SRR1040859     3   0.522      0.634 0.000 0.26 0.740
#> SRR1040860     2   0.000      1.000 0.000 1.00 0.000
#> SRR1040861     3   0.000      0.940 0.000 0.00 1.000
#> SRR1040862     2   0.000      1.000 0.000 1.00 0.000
#> SRR1040863     2   0.000      1.000 0.000 1.00 0.000
#> SRR1040864     3   0.000      0.940 0.000 0.00 1.000
#> SRR1040865     3   0.000      0.940 0.000 0.00 1.000
#> SRR1040866     3   0.000      0.940 0.000 0.00 1.000
#> SRR1040867     1   0.480      0.725 0.780 0.00 0.220
#> SRR1040868     3   0.341      0.822 0.124 0.00 0.876
#> SRR1040869     1   0.000      0.933 1.000 0.00 0.000
#> SRR1040870     1   0.000      0.933 1.000 0.00 0.000
#> SRR1040871     1   0.000      0.933 1.000 0.00 0.000
#> SRR1040872     3   0.613      0.238 0.400 0.00 0.600
#> SRR1040873     2   0.000      1.000 0.000 1.00 0.000
#> SRR1040874     1   0.000      0.933 1.000 0.00 0.000
#> SRR1040875     3   0.000      0.940 0.000 0.00 1.000
#> SRR1040876     1   0.000      0.933 1.000 0.00 0.000
#> SRR1040877     1   0.000      0.933 1.000 0.00 0.000
#> SRR1040878     3   0.000      0.940 0.000 0.00 1.000
#> SRR1040879     2   0.000      1.000 0.000 1.00 0.000
#> SRR1040880     1   0.000      0.933 1.000 0.00 0.000
#> SRR1040881     2   0.000      1.000 0.000 1.00 0.000
#> SRR1040882     1   0.470      0.734 0.788 0.00 0.212
#> SRR1040883     1   0.000      0.933 1.000 0.00 0.000
#> SRR1040884     1   0.000      0.933 1.000 0.00 0.000
#> SRR1040885     1   0.613      0.399 0.600 0.00 0.400

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> SRR1040814     1   0.000      0.932 1.000 0.000 0.000 0.000
#> SRR1040813     1   0.482      0.414 0.612 0.000 0.388 0.000
#> SRR1040816     3   0.349      0.739 0.188 0.000 0.812 0.000
#> SRR1040815     4   0.000      0.902 0.000 0.000 0.000 1.000
#> SRR1040817     1   0.000      0.932 1.000 0.000 0.000 0.000
#> SRR1040818     4   0.387      0.635 0.000 0.000 0.228 0.772
#> SRR1040819     4   0.000      0.902 0.000 0.000 0.000 1.000
#> SRR1040820     2   0.000      0.873 0.000 1.000 0.000 0.000
#> SRR1040821     2   0.000      0.873 0.000 1.000 0.000 0.000
#> SRR1040822     1   0.000      0.932 1.000 0.000 0.000 0.000
#> SRR1040823     3   0.000      0.941 0.000 0.000 1.000 0.000
#> SRR1040824     2   0.000      0.873 0.000 1.000 0.000 0.000
#> SRR1040826     1   0.380      0.723 0.780 0.000 0.220 0.000
#> SRR1040825     4   0.000      0.902 0.000 0.000 0.000 1.000
#> SRR1040827     2   0.000      0.873 0.000 1.000 0.000 0.000
#> SRR1040828     4   0.000      0.902 0.000 0.000 0.000 1.000
#> SRR1040829     2   0.387      0.739 0.000 0.772 0.000 0.228
#> SRR1040830     1   0.445      0.588 0.692 0.000 0.308 0.000
#> SRR1040831     1   0.000      0.932 1.000 0.000 0.000 0.000
#> SRR1040832     3   0.000      0.941 0.000 0.000 1.000 0.000
#> SRR1040833     1   0.000      0.932 1.000 0.000 0.000 0.000
#> SRR1040834     3   0.000      0.941 0.000 0.000 1.000 0.000
#> SRR1040835     4   0.000      0.902 0.000 0.000 0.000 1.000
#> SRR1040836     1   0.000      0.932 1.000 0.000 0.000 0.000
#> SRR1040837     4   0.468      0.356 0.000 0.352 0.000 0.648
#> SRR1040839     2   0.387      0.739 0.000 0.772 0.000 0.228
#> SRR1040838     3   0.000      0.941 0.000 0.000 1.000 0.000
#> SRR1040840     2   0.000      0.873 0.000 1.000 0.000 0.000
#> SRR1040841     1   0.000      0.932 1.000 0.000 0.000 0.000
#> SRR1040843     2   0.387      0.739 0.000 0.772 0.000 0.228
#> SRR1040842     2   0.493      0.311 0.000 0.568 0.000 0.432
#> SRR1040845     4   0.000      0.902 0.000 0.000 0.000 1.000
#> SRR1040844     1   0.000      0.932 1.000 0.000 0.000 0.000
#> SRR1040846     4   0.480      0.263 0.000 0.384 0.000 0.616
#> SRR1040847     1   0.000      0.932 1.000 0.000 0.000 0.000
#> SRR1040849     1   0.000      0.932 1.000 0.000 0.000 0.000
#> SRR1040848     2   0.000      0.873 0.000 1.000 0.000 0.000
#> SRR1040851     1   0.000      0.932 1.000 0.000 0.000 0.000
#> SRR1040850     3   0.000      0.941 0.000 0.000 1.000 0.000
#> SRR1040852     3   0.000      0.941 0.000 0.000 1.000 0.000
#> SRR1040853     3   0.000      0.941 0.000 0.000 1.000 0.000
#> SRR1040854     1   0.000      0.932 1.000 0.000 0.000 0.000
#> SRR1040855     3   0.000      0.941 0.000 0.000 1.000 0.000
#> SRR1040856     4   0.000      0.902 0.000 0.000 0.000 1.000
#> SRR1040857     1   0.000      0.932 1.000 0.000 0.000 0.000
#> SRR1040858     1   0.000      0.932 1.000 0.000 0.000 0.000
#> SRR1040859     4   0.353      0.699 0.000 0.000 0.192 0.808
#> SRR1040860     4   0.000      0.902 0.000 0.000 0.000 1.000
#> SRR1040861     3   0.000      0.941 0.000 0.000 1.000 0.000
#> SRR1040862     4   0.000      0.902 0.000 0.000 0.000 1.000
#> SRR1040863     4   0.000      0.902 0.000 0.000 0.000 1.000
#> SRR1040864     3   0.000      0.941 0.000 0.000 1.000 0.000
#> SRR1040865     3   0.000      0.941 0.000 0.000 1.000 0.000
#> SRR1040866     3   0.000      0.941 0.000 0.000 1.000 0.000
#> SRR1040867     1   0.380      0.723 0.780 0.000 0.220 0.000
#> SRR1040868     3   0.270      0.816 0.124 0.000 0.876 0.000
#> SRR1040869     1   0.000      0.932 1.000 0.000 0.000 0.000
#> SRR1040870     1   0.000      0.932 1.000 0.000 0.000 0.000
#> SRR1040871     1   0.000      0.932 1.000 0.000 0.000 0.000
#> SRR1040872     3   0.485      0.248 0.400 0.000 0.600 0.000
#> SRR1040873     2   0.000      0.873 0.000 1.000 0.000 0.000
#> SRR1040874     1   0.000      0.932 1.000 0.000 0.000 0.000
#> SRR1040875     3   0.000      0.941 0.000 0.000 1.000 0.000
#> SRR1040876     1   0.000      0.932 1.000 0.000 0.000 0.000
#> SRR1040877     1   0.000      0.932 1.000 0.000 0.000 0.000
#> SRR1040878     3   0.000      0.941 0.000 0.000 1.000 0.000
#> SRR1040879     4   0.000      0.902 0.000 0.000 0.000 1.000
#> SRR1040880     1   0.000      0.932 1.000 0.000 0.000 0.000
#> SRR1040881     4   0.000      0.902 0.000 0.000 0.000 1.000
#> SRR1040882     1   0.373      0.732 0.788 0.000 0.212 0.000
#> SRR1040883     1   0.000      0.932 1.000 0.000 0.000 0.000
#> SRR1040884     1   0.000      0.932 1.000 0.000 0.000 0.000
#> SRR1040885     1   0.485      0.395 0.600 0.000 0.400 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
#> SRR1040814     3  0.1544     0.7633 0.068 0.000 0.932 0.000 0.000
#> SRR1040813     5  0.3480     0.5499 0.248 0.000 0.000 0.000 0.752
#> SRR1040816     1  0.4171     0.3042 0.604 0.000 0.000 0.000 0.396
#> SRR1040815     4  0.1544     0.8649 0.000 0.000 0.068 0.932 0.000
#> SRR1040817     3  0.4192     0.6843 0.404 0.000 0.596 0.000 0.000
#> SRR1040818     4  0.3171     0.6935 0.000 0.000 0.008 0.816 0.176
#> SRR1040819     4  0.1544     0.8649 0.000 0.000 0.068 0.932 0.000
#> SRR1040820     2  0.0000     0.8842 0.000 1.000 0.000 0.000 0.000
#> SRR1040821     2  0.0000     0.8842 0.000 1.000 0.000 0.000 0.000
#> SRR1040822     3  0.4192     0.6843 0.404 0.000 0.596 0.000 0.000
#> SRR1040823     5  0.0000     0.8888 0.000 0.000 0.000 0.000 1.000
#> SRR1040824     2  0.0000     0.8842 0.000 1.000 0.000 0.000 0.000
#> SRR1040826     1  0.6571     0.0223 0.404 0.000 0.204 0.000 0.392
#> SRR1040825     4  0.1544     0.8649 0.000 0.000 0.068 0.932 0.000
#> SRR1040827     2  0.0000     0.8842 0.000 1.000 0.000 0.000 0.000
#> SRR1040828     4  0.0000     0.8732 0.000 0.000 0.000 1.000 0.000
#> SRR1040829     2  0.2966     0.7806 0.000 0.816 0.000 0.184 0.000
#> SRR1040830     1  0.1965     0.6977 0.904 0.000 0.000 0.000 0.096
#> SRR1040831     3  0.1544     0.7633 0.068 0.000 0.932 0.000 0.000
#> SRR1040832     5  0.1410     0.8508 0.000 0.000 0.000 0.060 0.940
#> SRR1040833     1  0.0000     0.7574 1.000 0.000 0.000 0.000 0.000
#> SRR1040834     5  0.0000     0.8888 0.000 0.000 0.000 0.000 1.000
#> SRR1040835     4  0.0290     0.8720 0.000 0.000 0.008 0.992 0.000
#> SRR1040836     1  0.0000     0.7574 1.000 0.000 0.000 0.000 0.000
#> SRR1040837     4  0.5369     0.1909 0.000 0.388 0.060 0.552 0.000
#> SRR1040839     2  0.4298     0.7448 0.000 0.756 0.060 0.184 0.000
#> SRR1040838     5  0.0000     0.8888 0.000 0.000 0.000 0.000 1.000
#> SRR1040840     2  0.0000     0.8842 0.000 1.000 0.000 0.000 0.000
#> SRR1040841     1  0.0000     0.7574 1.000 0.000 0.000 0.000 0.000
#> SRR1040843     2  0.4298     0.7448 0.000 0.756 0.060 0.184 0.000
#> SRR1040842     2  0.5188     0.4785 0.000 0.612 0.060 0.328 0.000
#> SRR1040845     4  0.0290     0.8720 0.000 0.000 0.008 0.992 0.000
#> SRR1040844     1  0.0000     0.7574 1.000 0.000 0.000 0.000 0.000
#> SRR1040846     4  0.5435     0.0459 0.000 0.428 0.060 0.512 0.000
#> SRR1040847     1  0.0000     0.7574 1.000 0.000 0.000 0.000 0.000
#> SRR1040849     3  0.4182     0.6878 0.400 0.000 0.600 0.000 0.000
#> SRR1040848     2  0.0000     0.8842 0.000 1.000 0.000 0.000 0.000
#> SRR1040851     3  0.4192     0.6843 0.404 0.000 0.596 0.000 0.000
#> SRR1040850     5  0.0000     0.8888 0.000 0.000 0.000 0.000 1.000
#> SRR1040852     5  0.0000     0.8888 0.000 0.000 0.000 0.000 1.000
#> SRR1040853     5  0.0000     0.8888 0.000 0.000 0.000 0.000 1.000
#> SRR1040854     3  0.1544     0.7633 0.068 0.000 0.932 0.000 0.000
#> SRR1040855     5  0.0000     0.8888 0.000 0.000 0.000 0.000 1.000
#> SRR1040856     4  0.0000     0.8732 0.000 0.000 0.000 1.000 0.000
#> SRR1040857     3  0.1544     0.7633 0.068 0.000 0.932 0.000 0.000
#> SRR1040858     3  0.1544     0.7633 0.068 0.000 0.932 0.000 0.000
#> SRR1040859     4  0.3003     0.6880 0.000 0.000 0.000 0.812 0.188
#> SRR1040860     4  0.0000     0.8732 0.000 0.000 0.000 1.000 0.000
#> SRR1040861     5  0.0000     0.8888 0.000 0.000 0.000 0.000 1.000
#> SRR1040862     4  0.0000     0.8732 0.000 0.000 0.000 1.000 0.000
#> SRR1040863     4  0.0000     0.8732 0.000 0.000 0.000 1.000 0.000
#> SRR1040864     5  0.0000     0.8888 0.000 0.000 0.000 0.000 1.000
#> SRR1040865     5  0.0000     0.8888 0.000 0.000 0.000 0.000 1.000
#> SRR1040866     5  0.1410     0.8508 0.000 0.000 0.000 0.060 0.940
#> SRR1040867     1  0.4300     0.0740 0.524 0.000 0.000 0.000 0.476
#> SRR1040868     1  0.4182     0.2956 0.600 0.000 0.000 0.000 0.400
#> SRR1040869     3  0.1544     0.7633 0.068 0.000 0.932 0.000 0.000
#> SRR1040870     3  0.1544     0.7633 0.068 0.000 0.932 0.000 0.000
#> SRR1040871     3  0.4192     0.6843 0.404 0.000 0.596 0.000 0.000
#> SRR1040872     5  0.4171     0.2078 0.396 0.000 0.000 0.000 0.604
#> SRR1040873     2  0.0000     0.8842 0.000 1.000 0.000 0.000 0.000
#> SRR1040874     1  0.0000     0.7574 1.000 0.000 0.000 0.000 0.000
#> SRR1040875     5  0.0000     0.8888 0.000 0.000 0.000 0.000 1.000
#> SRR1040876     1  0.0000     0.7574 1.000 0.000 0.000 0.000 0.000
#> SRR1040877     3  0.4138     0.6975 0.384 0.000 0.616 0.000 0.000
#> SRR1040878     5  0.0703     0.8754 0.000 0.000 0.000 0.024 0.976
#> SRR1040879     4  0.1544     0.8649 0.000 0.000 0.068 0.932 0.000
#> SRR1040880     1  0.0000     0.7574 1.000 0.000 0.000 0.000 0.000
#> SRR1040881     4  0.1544     0.8649 0.000 0.000 0.068 0.932 0.000
#> SRR1040882     1  0.3366     0.5600 0.768 0.000 0.000 0.000 0.232
#> SRR1040883     3  0.4126     0.6990 0.380 0.000 0.620 0.000 0.000
#> SRR1040884     1  0.0000     0.7574 1.000 0.000 0.000 0.000 0.000
#> SRR1040885     5  0.6571    -0.1786 0.396 0.000 0.204 0.000 0.400

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>            class entropy silhouette    p1    p2    p3    p4    p5    p6
#> SRR1040814     3  0.0146     0.7237 0.000 0.000 0.996 0.004 0.000 0.000
#> SRR1040813     5  0.3076     0.5631 0.240 0.000 0.000 0.000 0.760 0.000
#> SRR1040816     1  0.3747     0.3065 0.604 0.000 0.000 0.000 0.396 0.000
#> SRR1040815     6  0.0000     0.7763 0.000 0.000 0.000 0.000 0.000 1.000
#> SRR1040817     3  0.3881     0.6289 0.396 0.000 0.600 0.004 0.000 0.000
#> SRR1040818     6  0.2527     0.6420 0.000 0.000 0.000 0.168 0.000 0.832
#> SRR1040819     6  0.0000     0.7763 0.000 0.000 0.000 0.000 0.000 1.000
#> SRR1040820     2  0.0000     0.8129 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR1040821     2  0.0000     0.8129 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR1040822     3  0.3881     0.6289 0.396 0.000 0.600 0.004 0.000 0.000
#> SRR1040823     5  0.0000     0.8765 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR1040824     2  0.0000     0.8129 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR1040826     1  0.6028     0.0283 0.396 0.000 0.204 0.004 0.396 0.000
#> SRR1040825     6  0.0000     0.7763 0.000 0.000 0.000 0.000 0.000 1.000
#> SRR1040827     2  0.0000     0.8129 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR1040828     4  0.3828    -0.0531 0.000 0.000 0.000 0.560 0.000 0.440
#> SRR1040829     2  0.3747     0.4157 0.000 0.604 0.000 0.396 0.000 0.000
#> SRR1040830     1  0.1765     0.7077 0.904 0.000 0.000 0.000 0.096 0.000
#> SRR1040831     3  0.0000     0.7240 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1040832     5  0.2527     0.7093 0.000 0.000 0.000 0.168 0.832 0.000
#> SRR1040833     1  0.0000     0.7688 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR1040834     5  0.0000     0.8765 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR1040835     6  0.2527     0.6420 0.000 0.000 0.000 0.168 0.000 0.832
#> SRR1040836     1  0.0000     0.7688 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR1040837     6  0.3881     0.2089 0.000 0.004 0.000 0.396 0.000 0.600
#> SRR1040839     2  0.5740     0.2277 0.000 0.436 0.000 0.396 0.000 0.168
#> SRR1040838     5  0.0000     0.8765 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR1040840     2  0.0000     0.8129 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR1040841     1  0.0000     0.7688 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR1040843     2  0.5740     0.2277 0.000 0.436 0.000 0.396 0.000 0.168
#> SRR1040842     4  0.2668     0.5653 0.000 0.004 0.000 0.828 0.000 0.168
#> SRR1040845     4  0.3756     0.1587 0.000 0.000 0.000 0.600 0.000 0.400
#> SRR1040844     1  0.0000     0.7688 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR1040846     6  0.5903    -0.0333 0.000 0.204 0.000 0.396 0.000 0.400
#> SRR1040847     1  0.0000     0.7688 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR1040849     3  0.3862     0.6368 0.388 0.000 0.608 0.004 0.000 0.000
#> SRR1040848     2  0.0000     0.8129 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR1040851     3  0.3747     0.6305 0.396 0.000 0.604 0.000 0.000 0.000
#> SRR1040850     5  0.0000     0.8765 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR1040852     5  0.0000     0.8765 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR1040853     5  0.0000     0.8765 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR1040854     3  0.0000     0.7240 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1040855     5  0.0000     0.8765 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR1040856     4  0.0146     0.7359 0.000 0.000 0.000 0.996 0.000 0.004
#> SRR1040857     3  0.0000     0.7240 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1040858     3  0.0000     0.7240 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1040859     4  0.0146     0.7338 0.000 0.000 0.000 0.996 0.004 0.000
#> SRR1040860     4  0.0146     0.7359 0.000 0.000 0.000 0.996 0.000 0.004
#> SRR1040861     5  0.0000     0.8765 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR1040862     4  0.0146     0.7359 0.000 0.000 0.000 0.996 0.000 0.004
#> SRR1040863     4  0.0146     0.7359 0.000 0.000 0.000 0.996 0.000 0.004
#> SRR1040864     5  0.0000     0.8765 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR1040865     5  0.0000     0.8765 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR1040866     4  0.3756     0.1446 0.000 0.000 0.000 0.600 0.400 0.000
#> SRR1040867     1  0.3995     0.0281 0.516 0.000 0.000 0.004 0.480 0.000
#> SRR1040868     1  0.3747     0.3065 0.604 0.000 0.000 0.000 0.396 0.000
#> SRR1040869     3  0.0000     0.7240 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1040870     3  0.0146     0.7237 0.000 0.000 0.996 0.004 0.000 0.000
#> SRR1040871     3  0.3747     0.6305 0.396 0.000 0.604 0.000 0.000 0.000
#> SRR1040872     5  0.3747     0.2204 0.396 0.000 0.000 0.000 0.604 0.000
#> SRR1040873     2  0.0000     0.8129 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR1040874     1  0.0000     0.7688 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR1040875     5  0.0000     0.8765 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR1040876     1  0.0000     0.7688 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR1040877     3  0.3830     0.6445 0.376 0.000 0.620 0.004 0.000 0.000
#> SRR1040878     5  0.1007     0.8440 0.000 0.000 0.000 0.044 0.956 0.000
#> SRR1040879     6  0.0000     0.7763 0.000 0.000 0.000 0.000 0.000 1.000
#> SRR1040880     1  0.0000     0.7688 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR1040881     6  0.0000     0.7763 0.000 0.000 0.000 0.000 0.000 1.000
#> SRR1040882     1  0.3163     0.5766 0.764 0.000 0.000 0.004 0.232 0.000
#> SRR1040883     3  0.3684     0.6466 0.372 0.000 0.628 0.000 0.000 0.000
#> SRR1040884     1  0.0000     0.7688 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR1040885     5  0.6028    -0.1498 0.396 0.000 0.204 0.004 0.396 0.000

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

consensus_heatmap(res, k = 2)

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

consensus_heatmap(res, k = 3)

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

consensus_heatmap(res, k = 4)

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

consensus_heatmap(res, k = 5)

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

consensus_heatmap(res, k = 6)

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

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

membership_heatmap(res, k = 2)

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

membership_heatmap(res, k = 3)

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

membership_heatmap(res, k = 4)

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

membership_heatmap(res, k = 5)

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

membership_heatmap(res, k = 6)

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

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

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

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

get_signatures(res, k = 3)

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

get_signatures(res, k = 4)

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

get_signatures(res, k = 5)

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

get_signatures(res, k = 6)

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

Signature heatmaps where rows are not scaled:

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

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

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

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

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

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

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

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

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

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

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk ATC-pam-signature_compare

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

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

An example of the output of tb is:

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

The columns in tb are:

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

UMAP plot which shows how samples are separated.

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

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

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

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

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

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

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

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

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

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

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk ATC-pam-collect-classes

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


ATC:mclust

The object with results only for a single top-value method and a single partition method can be extracted as:

res = res_list["ATC", "mclust"]
# you can also extract it by
# res = res_list["ATC:mclust"]

A summary of res and all the functions that can be applied to it:

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

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

collect_plots(res)

plot of chunk ATC-mclust-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.555           0.897       0.939         0.4969 0.498   0.498
#> 3 3 0.493           0.822       0.866         0.2427 0.831   0.673
#> 4 4 0.640           0.807       0.850         0.1328 0.837   0.594
#> 5 5 0.807           0.694       0.839         0.1043 0.944   0.799
#> 6 6 0.751           0.705       0.841         0.0333 0.875   0.538

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
#> SRR1040814     1  0.0000      0.941 1.000 0.000
#> SRR1040813     2  0.7219      0.826 0.200 0.800
#> SRR1040816     2  0.5519      0.892 0.128 0.872
#> SRR1040815     2  0.0000      0.923 0.000 1.000
#> SRR1040817     1  0.0672      0.941 0.992 0.008
#> SRR1040818     2  0.0938      0.920 0.012 0.988
#> SRR1040819     2  0.0000      0.923 0.000 1.000
#> SRR1040820     2  0.0000      0.923 0.000 1.000
#> SRR1040821     2  0.0000      0.923 0.000 1.000
#> SRR1040822     1  0.0000      0.941 1.000 0.000
#> SRR1040823     1  0.1414      0.937 0.980 0.020
#> SRR1040824     2  0.0000      0.923 0.000 1.000
#> SRR1040826     1  0.0000      0.941 1.000 0.000
#> SRR1040825     2  0.0000      0.923 0.000 1.000
#> SRR1040827     2  0.0000      0.923 0.000 1.000
#> SRR1040828     2  0.5178      0.894 0.116 0.884
#> SRR1040829     2  0.0000      0.923 0.000 1.000
#> SRR1040830     2  0.5519      0.892 0.128 0.872
#> SRR1040831     2  0.9954      0.278 0.460 0.540
#> SRR1040832     2  0.5178      0.894 0.116 0.884
#> SRR1040833     2  0.5842      0.887 0.140 0.860
#> SRR1040834     2  0.5842      0.887 0.140 0.860
#> SRR1040835     2  0.1414      0.920 0.020 0.980
#> SRR1040836     1  0.9710      0.225 0.600 0.400
#> SRR1040837     2  0.0000      0.923 0.000 1.000
#> SRR1040839     2  0.0000      0.923 0.000 1.000
#> SRR1040838     1  0.1414      0.937 0.980 0.020
#> SRR1040840     2  0.0000      0.923 0.000 1.000
#> SRR1040841     2  0.5842      0.887 0.140 0.860
#> SRR1040843     2  0.0000      0.923 0.000 1.000
#> SRR1040842     1  0.0000      0.941 1.000 0.000
#> SRR1040845     1  0.5737      0.880 0.864 0.136
#> SRR1040844     2  0.5842      0.887 0.140 0.860
#> SRR1040846     2  0.0000      0.923 0.000 1.000
#> SRR1040847     2  0.5842      0.887 0.140 0.860
#> SRR1040849     1  0.0672      0.941 0.992 0.008
#> SRR1040848     2  0.0000      0.923 0.000 1.000
#> SRR1040851     1  0.0376      0.942 0.996 0.004
#> SRR1040850     1  0.0672      0.941 0.992 0.008
#> SRR1040852     1  0.0672      0.941 0.992 0.008
#> SRR1040853     1  0.1414      0.937 0.980 0.020
#> SRR1040854     1  0.0000      0.941 1.000 0.000
#> SRR1040855     1  0.0000      0.941 1.000 0.000
#> SRR1040856     1  0.5737      0.880 0.864 0.136
#> SRR1040857     1  0.0672      0.941 0.992 0.008
#> SRR1040858     1  0.0000      0.941 1.000 0.000
#> SRR1040859     1  0.5737      0.880 0.864 0.136
#> SRR1040860     1  0.5737      0.880 0.864 0.136
#> SRR1040861     1  0.0000      0.941 1.000 0.000
#> SRR1040862     1  0.5737      0.880 0.864 0.136
#> SRR1040863     1  0.5737      0.880 0.864 0.136
#> SRR1040864     1  0.0000      0.941 1.000 0.000
#> SRR1040865     1  0.5737      0.880 0.864 0.136
#> SRR1040866     1  0.5737      0.880 0.864 0.136
#> SRR1040867     1  0.0000      0.941 1.000 0.000
#> SRR1040868     1  0.4690      0.901 0.900 0.100
#> SRR1040869     1  0.0000      0.941 1.000 0.000
#> SRR1040870     1  0.0000      0.941 1.000 0.000
#> SRR1040871     1  0.0938      0.940 0.988 0.012
#> SRR1040872     1  0.0376      0.942 0.996 0.004
#> SRR1040873     2  0.0000      0.923 0.000 1.000
#> SRR1040874     2  0.5842      0.887 0.140 0.860
#> SRR1040875     1  0.1184      0.939 0.984 0.016
#> SRR1040876     2  0.5842      0.887 0.140 0.860
#> SRR1040877     1  0.0000      0.941 1.000 0.000
#> SRR1040878     1  0.5737      0.880 0.864 0.136
#> SRR1040879     2  0.0000      0.923 0.000 1.000
#> SRR1040880     1  0.5737      0.880 0.864 0.136
#> SRR1040881     2  0.0000      0.923 0.000 1.000
#> SRR1040882     1  0.5519      0.832 0.872 0.128
#> SRR1040883     1  0.0672      0.941 0.992 0.008
#> SRR1040884     2  0.6247      0.874 0.156 0.844
#> SRR1040885     1  0.0000      0.941 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
#> SRR1040814     3  0.0237      0.825 0.004 0.000 0.996
#> SRR1040813     1  0.6633      0.805 0.728 0.060 0.212
#> SRR1040816     1  0.5875      0.813 0.792 0.136 0.072
#> SRR1040815     2  0.1753      0.950 0.048 0.952 0.000
#> SRR1040817     3  0.1753      0.825 0.048 0.000 0.952
#> SRR1040818     2  0.4139      0.888 0.124 0.860 0.016
#> SRR1040819     2  0.1753      0.950 0.048 0.952 0.000
#> SRR1040820     2  0.0000      0.919 0.000 1.000 0.000
#> SRR1040821     2  0.0000      0.919 0.000 1.000 0.000
#> SRR1040822     3  0.0237      0.825 0.004 0.000 0.996
#> SRR1040823     3  0.4504      0.590 0.196 0.000 0.804
#> SRR1040824     2  0.1753      0.950 0.048 0.952 0.000
#> SRR1040826     3  0.0237      0.825 0.004 0.000 0.996
#> SRR1040825     2  0.1753      0.950 0.048 0.952 0.000
#> SRR1040827     2  0.1753      0.950 0.048 0.952 0.000
#> SRR1040828     2  0.5688      0.825 0.168 0.788 0.044
#> SRR1040829     2  0.1753      0.950 0.048 0.952 0.000
#> SRR1040830     1  0.6239      0.788 0.768 0.160 0.072
#> SRR1040831     1  0.4805      0.822 0.812 0.012 0.176
#> SRR1040832     2  0.6859      0.498 0.356 0.620 0.024
#> SRR1040833     1  0.2939      0.874 0.916 0.012 0.072
#> SRR1040834     1  0.5319      0.828 0.824 0.104 0.072
#> SRR1040835     2  0.3192      0.902 0.112 0.888 0.000
#> SRR1040836     1  0.4345      0.852 0.848 0.016 0.136
#> SRR1040837     2  0.1753      0.950 0.048 0.952 0.000
#> SRR1040839     2  0.0424      0.926 0.008 0.992 0.000
#> SRR1040838     3  0.4068      0.822 0.120 0.016 0.864
#> SRR1040840     2  0.0424      0.926 0.008 0.992 0.000
#> SRR1040841     1  0.2939      0.874 0.916 0.012 0.072
#> SRR1040843     2  0.1753      0.950 0.048 0.952 0.000
#> SRR1040842     3  0.5875      0.764 0.056 0.160 0.784
#> SRR1040845     3  0.7750      0.723 0.184 0.140 0.676
#> SRR1040844     1  0.2939      0.874 0.916 0.012 0.072
#> SRR1040846     2  0.1753      0.950 0.048 0.952 0.000
#> SRR1040847     1  0.2939      0.874 0.916 0.012 0.072
#> SRR1040849     3  0.0237      0.825 0.004 0.000 0.996
#> SRR1040848     2  0.1753      0.950 0.048 0.952 0.000
#> SRR1040851     3  0.4805      0.800 0.176 0.012 0.812
#> SRR1040850     3  0.2682      0.785 0.076 0.004 0.920
#> SRR1040852     3  0.1964      0.827 0.056 0.000 0.944
#> SRR1040853     3  0.4045      0.825 0.104 0.024 0.872
#> SRR1040854     3  0.4805      0.800 0.176 0.012 0.812
#> SRR1040855     3  0.0424      0.825 0.008 0.000 0.992
#> SRR1040856     3  0.7750      0.723 0.184 0.140 0.676
#> SRR1040857     3  0.4805      0.800 0.176 0.012 0.812
#> SRR1040858     3  0.4805      0.800 0.176 0.012 0.812
#> SRR1040859     3  0.7750      0.723 0.184 0.140 0.676
#> SRR1040860     3  0.7750      0.723 0.184 0.140 0.676
#> SRR1040861     3  0.0237      0.825 0.004 0.000 0.996
#> SRR1040862     3  0.7750      0.723 0.184 0.140 0.676
#> SRR1040863     3  0.7750      0.723 0.184 0.140 0.676
#> SRR1040864     3  0.1919      0.833 0.024 0.020 0.956
#> SRR1040865     3  0.7043      0.747 0.136 0.136 0.728
#> SRR1040866     3  0.7750      0.723 0.184 0.140 0.676
#> SRR1040867     3  0.1753      0.825 0.048 0.000 0.952
#> SRR1040868     1  0.4840      0.816 0.816 0.016 0.168
#> SRR1040869     3  0.4805      0.800 0.176 0.012 0.812
#> SRR1040870     3  0.0237      0.825 0.004 0.000 0.996
#> SRR1040871     3  0.4861      0.798 0.180 0.012 0.808
#> SRR1040872     3  0.0237      0.825 0.004 0.000 0.996
#> SRR1040873     2  0.0000      0.919 0.000 1.000 0.000
#> SRR1040874     1  0.2939      0.874 0.916 0.012 0.072
#> SRR1040875     3  0.4295      0.824 0.104 0.032 0.864
#> SRR1040876     1  0.3091      0.874 0.912 0.016 0.072
#> SRR1040877     3  0.0237      0.825 0.004 0.000 0.996
#> SRR1040878     3  0.7644      0.728 0.180 0.136 0.684
#> SRR1040879     2  0.1753      0.950 0.048 0.952 0.000
#> SRR1040880     1  0.8535      0.406 0.556 0.112 0.332
#> SRR1040881     2  0.1753      0.950 0.048 0.952 0.000
#> SRR1040882     1  0.6825      0.325 0.500 0.012 0.488
#> SRR1040883     3  0.4915      0.798 0.184 0.012 0.804
#> SRR1040884     1  0.4196      0.863 0.864 0.024 0.112
#> SRR1040885     3  0.0237      0.825 0.004 0.000 0.996

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> SRR1040814     3  0.0188      0.829 0.000 0.000 0.996 0.004
#> SRR1040813     1  0.8466      0.441 0.516 0.236 0.180 0.068
#> SRR1040816     1  0.2675      0.742 0.892 0.100 0.008 0.000
#> SRR1040815     2  0.0000      0.973 0.000 1.000 0.000 0.000
#> SRR1040817     3  0.0188      0.829 0.004 0.000 0.996 0.000
#> SRR1040818     2  0.3082      0.850 0.084 0.884 0.000 0.032
#> SRR1040819     2  0.0707      0.968 0.000 0.980 0.000 0.020
#> SRR1040820     2  0.0336      0.973 0.008 0.992 0.000 0.000
#> SRR1040821     2  0.0336      0.973 0.008 0.992 0.000 0.000
#> SRR1040822     3  0.0000      0.830 0.000 0.000 1.000 0.000
#> SRR1040823     3  0.2593      0.796 0.004 0.000 0.892 0.104
#> SRR1040824     2  0.0188      0.974 0.004 0.996 0.000 0.000
#> SRR1040826     3  0.0000      0.830 0.000 0.000 1.000 0.000
#> SRR1040825     2  0.0707      0.968 0.000 0.980 0.000 0.020
#> SRR1040827     2  0.0188      0.974 0.004 0.996 0.000 0.000
#> SRR1040828     1  0.6171      0.471 0.588 0.348 0.000 0.064
#> SRR1040829     2  0.0707      0.968 0.000 0.980 0.000 0.020
#> SRR1040830     1  0.5281      0.605 0.708 0.256 0.008 0.028
#> SRR1040831     1  0.8380      0.333 0.492 0.148 0.300 0.060
#> SRR1040832     1  0.5444      0.590 0.688 0.264 0.000 0.048
#> SRR1040833     1  0.1118      0.777 0.964 0.000 0.036 0.000
#> SRR1040834     1  0.6106      0.615 0.688 0.236 0.040 0.036
#> SRR1040835     2  0.2385      0.906 0.052 0.920 0.000 0.028
#> SRR1040836     3  0.8844      0.138 0.256 0.236 0.444 0.064
#> SRR1040837     2  0.0592      0.967 0.016 0.984 0.000 0.000
#> SRR1040839     2  0.0000      0.973 0.000 1.000 0.000 0.000
#> SRR1040838     3  0.2654      0.796 0.004 0.000 0.888 0.108
#> SRR1040840     2  0.0188      0.974 0.004 0.996 0.000 0.000
#> SRR1040841     1  0.1118      0.777 0.964 0.000 0.036 0.000
#> SRR1040843     2  0.0000      0.973 0.000 1.000 0.000 0.000
#> SRR1040842     3  0.6664      0.440 0.000 0.272 0.600 0.128
#> SRR1040845     4  0.4855      0.950 0.020 0.268 0.000 0.712
#> SRR1040844     1  0.1118      0.777 0.964 0.000 0.036 0.000
#> SRR1040846     2  0.0592      0.967 0.016 0.984 0.000 0.000
#> SRR1040847     1  0.1118      0.777 0.964 0.000 0.036 0.000
#> SRR1040849     3  0.0000      0.830 0.000 0.000 1.000 0.000
#> SRR1040848     2  0.0336      0.973 0.008 0.992 0.000 0.000
#> SRR1040851     3  0.4840      0.733 0.028 0.000 0.732 0.240
#> SRR1040850     3  0.2741      0.798 0.000 0.012 0.892 0.096
#> SRR1040852     3  0.2593      0.797 0.004 0.000 0.892 0.104
#> SRR1040853     3  0.7277      0.324 0.004 0.256 0.556 0.184
#> SRR1040854     3  0.4840      0.733 0.028 0.000 0.732 0.240
#> SRR1040855     3  0.0592      0.827 0.000 0.000 0.984 0.016
#> SRR1040856     4  0.4331      0.959 0.000 0.288 0.000 0.712
#> SRR1040857     3  0.4840      0.733 0.028 0.000 0.732 0.240
#> SRR1040858     3  0.4840      0.733 0.028 0.000 0.732 0.240
#> SRR1040859     4  0.4331      0.959 0.000 0.288 0.000 0.712
#> SRR1040860     4  0.4331      0.959 0.000 0.288 0.000 0.712
#> SRR1040861     3  0.0188      0.829 0.000 0.000 0.996 0.004
#> SRR1040862     4  0.4331      0.959 0.000 0.288 0.000 0.712
#> SRR1040863     4  0.4331      0.959 0.000 0.288 0.000 0.712
#> SRR1040864     3  0.6134      0.513 0.000 0.236 0.660 0.104
#> SRR1040865     4  0.5750      0.938 0.024 0.260 0.028 0.688
#> SRR1040866     4  0.4331      0.959 0.000 0.288 0.000 0.712
#> SRR1040867     3  0.0188      0.829 0.004 0.000 0.996 0.000
#> SRR1040868     4  0.7232      0.805 0.024 0.260 0.120 0.596
#> SRR1040869     3  0.4840      0.733 0.028 0.000 0.732 0.240
#> SRR1040870     3  0.0188      0.829 0.000 0.000 0.996 0.004
#> SRR1040871     3  0.6238      0.651 0.112 0.000 0.652 0.236
#> SRR1040872     3  0.0000      0.830 0.000 0.000 1.000 0.000
#> SRR1040873     2  0.0336      0.973 0.008 0.992 0.000 0.000
#> SRR1040874     1  0.1118      0.777 0.964 0.000 0.036 0.000
#> SRR1040875     3  0.3993      0.774 0.004 0.060 0.844 0.092
#> SRR1040876     1  0.1022      0.775 0.968 0.000 0.032 0.000
#> SRR1040877     3  0.0000      0.830 0.000 0.000 1.000 0.000
#> SRR1040878     4  0.5512      0.947 0.020 0.268 0.020 0.692
#> SRR1040879     2  0.0707      0.968 0.000 0.980 0.000 0.020
#> SRR1040880     4  0.5263      0.936 0.004 0.260 0.032 0.704
#> SRR1040881     2  0.0707      0.968 0.000 0.980 0.000 0.020
#> SRR1040882     3  0.3667      0.759 0.088 0.000 0.856 0.056
#> SRR1040883     3  0.6216      0.655 0.108 0.000 0.652 0.240
#> SRR1040884     1  0.2399      0.767 0.920 0.000 0.048 0.032
#> SRR1040885     3  0.0000      0.830 0.000 0.000 1.000 0.000

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>            class entropy silhouette    p1    p2    p3    p4    p5
#> SRR1040814     3  0.0609     0.7600 0.000 0.000 0.980 0.000 0.020
#> SRR1040813     5  0.8554    -0.1764 0.316 0.052 0.180 0.068 0.384
#> SRR1040816     1  0.2299     0.8798 0.912 0.052 0.000 0.004 0.032
#> SRR1040815     2  0.0880     0.9468 0.000 0.968 0.000 0.000 0.032
#> SRR1040817     3  0.0703     0.7595 0.000 0.000 0.976 0.000 0.024
#> SRR1040818     2  0.1877     0.9335 0.012 0.924 0.000 0.000 0.064
#> SRR1040819     2  0.2011     0.9256 0.004 0.908 0.000 0.000 0.088
#> SRR1040820     2  0.0000     0.9536 0.000 1.000 0.000 0.000 0.000
#> SRR1040821     2  0.0000     0.9536 0.000 1.000 0.000 0.000 0.000
#> SRR1040822     3  0.0609     0.7600 0.000 0.000 0.980 0.000 0.020
#> SRR1040823     3  0.4109     0.4771 0.000 0.000 0.700 0.012 0.288
#> SRR1040824     2  0.0000     0.9536 0.000 1.000 0.000 0.000 0.000
#> SRR1040826     3  0.0290     0.7595 0.000 0.000 0.992 0.000 0.008
#> SRR1040825     2  0.2124     0.9215 0.004 0.900 0.000 0.000 0.096
#> SRR1040827     2  0.0000     0.9536 0.000 1.000 0.000 0.000 0.000
#> SRR1040828     1  0.4011     0.8470 0.828 0.064 0.000 0.064 0.044
#> SRR1040829     2  0.3635     0.8720 0.004 0.828 0.000 0.056 0.112
#> SRR1040830     1  0.3821     0.8550 0.840 0.056 0.000 0.056 0.048
#> SRR1040831     5  0.5431     0.0658 0.472 0.008 0.040 0.000 0.480
#> SRR1040832     1  0.4092     0.8475 0.824 0.060 0.000 0.056 0.060
#> SRR1040833     1  0.0162     0.8945 0.996 0.000 0.000 0.000 0.004
#> SRR1040834     1  0.3327     0.8558 0.864 0.072 0.000 0.036 0.028
#> SRR1040835     2  0.5022     0.7474 0.136 0.736 0.000 0.016 0.112
#> SRR1040836     5  0.5967     0.1173 0.444 0.032 0.044 0.000 0.480
#> SRR1040837     2  0.0404     0.9501 0.000 0.988 0.000 0.000 0.012
#> SRR1040839     2  0.0000     0.9536 0.000 1.000 0.000 0.000 0.000
#> SRR1040838     5  0.4798    -0.1311 0.004 0.000 0.472 0.012 0.512
#> SRR1040840     2  0.0000     0.9536 0.000 1.000 0.000 0.000 0.000
#> SRR1040841     1  0.0162     0.8945 0.996 0.000 0.000 0.000 0.004
#> SRR1040843     2  0.0290     0.9516 0.000 0.992 0.000 0.000 0.008
#> SRR1040842     3  0.4330     0.6487 0.000 0.052 0.808 0.060 0.080
#> SRR1040845     4  0.1410     0.9217 0.000 0.060 0.000 0.940 0.000
#> SRR1040844     1  0.0162     0.8945 0.996 0.000 0.000 0.000 0.004
#> SRR1040846     2  0.0290     0.9516 0.000 0.992 0.000 0.000 0.008
#> SRR1040847     1  0.0162     0.8945 0.996 0.000 0.000 0.000 0.004
#> SRR1040849     3  0.0000     0.7593 0.000 0.000 1.000 0.000 0.000
#> SRR1040848     2  0.0000     0.9536 0.000 1.000 0.000 0.000 0.000
#> SRR1040851     3  0.4304     0.0244 0.000 0.000 0.516 0.000 0.484
#> SRR1040850     3  0.3012     0.7032 0.004 0.040 0.876 0.004 0.076
#> SRR1040852     3  0.4309     0.4543 0.000 0.000 0.676 0.016 0.308
#> SRR1040853     3  0.6404    -0.1590 0.000 0.020 0.452 0.100 0.428
#> SRR1040854     3  0.2424     0.6919 0.000 0.000 0.868 0.000 0.132
#> SRR1040855     3  0.1608     0.7267 0.000 0.000 0.928 0.000 0.072
#> SRR1040856     4  0.2408     0.8959 0.000 0.092 0.000 0.892 0.016
#> SRR1040857     3  0.3966     0.4093 0.000 0.000 0.664 0.000 0.336
#> SRR1040858     3  0.4307    -0.0328 0.000 0.000 0.500 0.000 0.500
#> SRR1040859     4  0.1502     0.9218 0.000 0.056 0.000 0.940 0.004
#> SRR1040860     4  0.1341     0.9224 0.000 0.056 0.000 0.944 0.000
#> SRR1040861     3  0.0290     0.7581 0.000 0.000 0.992 0.000 0.008
#> SRR1040862     4  0.1341     0.9224 0.000 0.056 0.000 0.944 0.000
#> SRR1040863     4  0.1341     0.9224 0.000 0.056 0.000 0.944 0.000
#> SRR1040864     3  0.2172     0.7199 0.000 0.016 0.908 0.000 0.076
#> SRR1040865     4  0.5026     0.8212 0.000 0.088 0.056 0.760 0.096
#> SRR1040866     4  0.1341     0.9224 0.000 0.056 0.000 0.944 0.000
#> SRR1040867     3  0.0880     0.7569 0.000 0.000 0.968 0.000 0.032
#> SRR1040868     5  0.6674    -0.2787 0.004 0.052 0.064 0.440 0.440
#> SRR1040869     3  0.2648     0.6761 0.000 0.000 0.848 0.000 0.152
#> SRR1040870     3  0.0703     0.7595 0.000 0.000 0.976 0.000 0.024
#> SRR1040871     5  0.5605     0.1530 0.076 0.000 0.404 0.000 0.520
#> SRR1040872     3  0.0290     0.7595 0.000 0.000 0.992 0.000 0.008
#> SRR1040873     2  0.0000     0.9536 0.000 1.000 0.000 0.000 0.000
#> SRR1040874     1  0.0955     0.8864 0.968 0.000 0.004 0.000 0.028
#> SRR1040875     3  0.5527    -0.0278 0.004 0.000 0.512 0.056 0.428
#> SRR1040876     1  0.0000     0.8938 1.000 0.000 0.000 0.000 0.000
#> SRR1040877     3  0.0609     0.7600 0.000 0.000 0.980 0.000 0.020
#> SRR1040878     4  0.4310     0.8569 0.000 0.088 0.052 0.808 0.052
#> SRR1040879     2  0.2179     0.9194 0.004 0.896 0.000 0.000 0.100
#> SRR1040880     4  0.5670     0.7022 0.000 0.052 0.108 0.704 0.136
#> SRR1040881     2  0.1952     0.9273 0.004 0.912 0.000 0.000 0.084
#> SRR1040882     3  0.4626     0.3974 0.004 0.004 0.648 0.012 0.332
#> SRR1040883     5  0.5381     0.0966 0.056 0.000 0.428 0.000 0.516
#> SRR1040884     1  0.3963     0.6589 0.732 0.004 0.008 0.000 0.256
#> SRR1040885     3  0.0290     0.7595 0.000 0.000 0.992 0.000 0.008

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>            class entropy silhouette    p1    p2    p3    p4    p5    p6
#> SRR1040814     3  0.0000     0.8925 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1040813     5  0.6385    -0.1246 0.404 0.000 0.048 0.000 0.416 0.132
#> SRR1040816     6  0.4723     0.0681 0.472 0.004 0.000 0.000 0.036 0.488
#> SRR1040815     2  0.0972     0.9364 0.000 0.964 0.000 0.000 0.028 0.008
#> SRR1040817     3  0.0458     0.8922 0.000 0.000 0.984 0.000 0.016 0.000
#> SRR1040818     2  0.5523     0.4536 0.040 0.648 0.000 0.000 0.156 0.156
#> SRR1040819     2  0.1168     0.9355 0.000 0.956 0.000 0.000 0.028 0.016
#> SRR1040820     2  0.0260     0.9354 0.000 0.992 0.000 0.000 0.000 0.008
#> SRR1040821     2  0.0260     0.9354 0.000 0.992 0.000 0.000 0.000 0.008
#> SRR1040822     3  0.0000     0.8925 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1040823     5  0.3468     0.6559 0.000 0.000 0.284 0.000 0.712 0.004
#> SRR1040824     2  0.0260     0.9354 0.000 0.992 0.000 0.000 0.000 0.008
#> SRR1040826     3  0.0363     0.8922 0.000 0.000 0.988 0.000 0.012 0.000
#> SRR1040825     2  0.1498     0.9249 0.000 0.940 0.000 0.000 0.028 0.032
#> SRR1040827     2  0.0260     0.9354 0.000 0.992 0.000 0.000 0.000 0.008
#> SRR1040828     6  0.2007     0.6678 0.044 0.004 0.000 0.000 0.036 0.916
#> SRR1040829     2  0.3470     0.7196 0.000 0.772 0.000 0.000 0.028 0.200
#> SRR1040830     6  0.2074     0.6679 0.048 0.004 0.000 0.000 0.036 0.912
#> SRR1040831     5  0.6013     0.4229 0.268 0.000 0.160 0.000 0.544 0.028
#> SRR1040832     6  0.3628     0.6033 0.184 0.004 0.000 0.000 0.036 0.776
#> SRR1040833     1  0.0000     0.7427 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR1040834     1  0.5137     0.1080 0.508 0.000 0.004 0.000 0.416 0.072
#> SRR1040835     6  0.4353     0.2196 0.000 0.384 0.000 0.000 0.028 0.588
#> SRR1040836     5  0.4300     0.2367 0.364 0.000 0.028 0.000 0.608 0.000
#> SRR1040837     2  0.0972     0.9355 0.000 0.964 0.000 0.000 0.028 0.008
#> SRR1040839     2  0.0146     0.9365 0.000 0.996 0.000 0.000 0.000 0.004
#> SRR1040838     5  0.2823     0.6693 0.000 0.000 0.204 0.000 0.796 0.000
#> SRR1040840     2  0.0000     0.9362 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR1040841     1  0.0000     0.7427 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR1040843     2  0.0858     0.9361 0.000 0.968 0.000 0.000 0.028 0.004
#> SRR1040842     5  0.4466     0.6069 0.000 0.000 0.180 0.004 0.716 0.100
#> SRR1040845     4  0.0000     0.8919 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR1040844     1  0.0000     0.7427 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR1040846     2  0.0972     0.9355 0.000 0.964 0.000 0.000 0.028 0.008
#> SRR1040847     1  0.0000     0.7427 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR1040849     3  0.0363     0.8923 0.000 0.000 0.988 0.000 0.012 0.000
#> SRR1040848     2  0.0260     0.9354 0.000 0.992 0.000 0.000 0.000 0.008
#> SRR1040851     3  0.3155     0.8299 0.004 0.000 0.828 0.000 0.132 0.036
#> SRR1040850     5  0.3735     0.6589 0.008 0.000 0.224 0.000 0.748 0.020
#> SRR1040852     5  0.3266     0.6401 0.000 0.000 0.272 0.000 0.728 0.000
#> SRR1040853     5  0.5347     0.5687 0.000 0.000 0.304 0.136 0.560 0.000
#> SRR1040854     3  0.2263     0.8665 0.004 0.000 0.900 0.000 0.060 0.036
#> SRR1040855     5  0.3706     0.5795 0.000 0.000 0.380 0.000 0.620 0.000
#> SRR1040856     4  0.2597     0.7148 0.000 0.000 0.000 0.824 0.176 0.000
#> SRR1040857     3  0.2437     0.8610 0.004 0.000 0.888 0.000 0.072 0.036
#> SRR1040858     3  0.2547     0.8560 0.004 0.000 0.880 0.000 0.080 0.036
#> SRR1040859     4  0.0000     0.8919 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR1040860     4  0.0000     0.8919 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR1040861     3  0.2135     0.7746 0.000 0.000 0.872 0.000 0.128 0.000
#> SRR1040862     4  0.0000     0.8919 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR1040863     4  0.0000     0.8919 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR1040864     5  0.3290     0.6681 0.000 0.000 0.252 0.000 0.744 0.004
#> SRR1040865     5  0.4032     0.1063 0.000 0.000 0.008 0.420 0.572 0.000
#> SRR1040866     4  0.0000     0.8919 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR1040867     3  0.1610     0.8545 0.000 0.000 0.916 0.000 0.084 0.000
#> SRR1040868     5  0.3833     0.3852 0.004 0.000 0.016 0.272 0.708 0.000
#> SRR1040869     3  0.2380     0.8631 0.004 0.000 0.892 0.000 0.068 0.036
#> SRR1040870     3  0.0000     0.8925 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1040871     3  0.4670     0.1970 0.004 0.000 0.548 0.000 0.412 0.036
#> SRR1040872     3  0.0458     0.8908 0.000 0.000 0.984 0.000 0.016 0.000
#> SRR1040873     2  0.0260     0.9354 0.000 0.992 0.000 0.000 0.000 0.008
#> SRR1040874     1  0.1501     0.7034 0.924 0.000 0.000 0.000 0.076 0.000
#> SRR1040875     5  0.3823     0.3928 0.000 0.000 0.436 0.000 0.564 0.000
#> SRR1040876     1  0.1141     0.7078 0.948 0.000 0.000 0.000 0.000 0.052
#> SRR1040877     3  0.0000     0.8925 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1040878     4  0.3782     0.3304 0.000 0.000 0.000 0.588 0.412 0.000
#> SRR1040879     2  0.1498     0.9249 0.000 0.940 0.000 0.000 0.028 0.032
#> SRR1040880     5  0.4069     0.1938 0.004 0.000 0.008 0.376 0.612 0.000
#> SRR1040881     2  0.1168     0.9334 0.000 0.956 0.000 0.000 0.028 0.016
#> SRR1040882     5  0.4949     0.5886 0.144 0.000 0.208 0.000 0.648 0.000
#> SRR1040883     3  0.3691     0.7643 0.004 0.000 0.768 0.000 0.192 0.036
#> SRR1040884     1  0.3847     0.0607 0.544 0.000 0.000 0.000 0.456 0.000
#> SRR1040885     3  0.0363     0.8922 0.000 0.000 0.988 0.000 0.012 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 15258 rows and 73 columns.
#>   Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'ATC' method.
#>   Subgroups are detected by 'NMF' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 3.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

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

collect_plots(res)

plot of chunk ATC-NMF-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.809           0.874       0.949         0.4014 0.584   0.584
#> 3 3 0.606           0.785       0.886         0.6048 0.636   0.430
#> 4 4 0.478           0.641       0.805         0.0772 0.723   0.378
#> 5 5 0.499           0.539       0.741         0.0592 0.931   0.776
#> 6 6 0.560           0.595       0.787         0.0442 0.929   0.746

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
#> SRR1040814     1  0.0000     0.9651 1.000 0.000
#> SRR1040813     1  0.0000     0.9651 1.000 0.000
#> SRR1040816     1  0.0000     0.9651 1.000 0.000
#> SRR1040815     2  0.0000     0.8827 0.000 1.000
#> SRR1040817     1  0.0000     0.9651 1.000 0.000
#> SRR1040818     1  0.0000     0.9651 1.000 0.000
#> SRR1040819     2  0.0000     0.8827 0.000 1.000
#> SRR1040820     2  0.0000     0.8827 0.000 1.000
#> SRR1040821     2  0.0000     0.8827 0.000 1.000
#> SRR1040822     1  0.0000     0.9651 1.000 0.000
#> SRR1040823     1  0.0000     0.9651 1.000 0.000
#> SRR1040824     2  0.0000     0.8827 0.000 1.000
#> SRR1040826     1  0.0000     0.9651 1.000 0.000
#> SRR1040825     1  0.9170     0.4153 0.668 0.332
#> SRR1040827     2  0.0000     0.8827 0.000 1.000
#> SRR1040828     1  0.9896     0.0597 0.560 0.440
#> SRR1040829     2  0.0000     0.8827 0.000 1.000
#> SRR1040830     1  0.0000     0.9651 1.000 0.000
#> SRR1040831     1  0.0000     0.9651 1.000 0.000
#> SRR1040832     1  0.0000     0.9651 1.000 0.000
#> SRR1040833     1  0.0000     0.9651 1.000 0.000
#> SRR1040834     1  0.0000     0.9651 1.000 0.000
#> SRR1040835     1  0.1843     0.9371 0.972 0.028
#> SRR1040836     1  0.0000     0.9651 1.000 0.000
#> SRR1040837     2  0.2778     0.8630 0.048 0.952
#> SRR1040839     2  0.0000     0.8827 0.000 1.000
#> SRR1040838     1  0.0000     0.9651 1.000 0.000
#> SRR1040840     2  0.0000     0.8827 0.000 1.000
#> SRR1040841     1  0.0000     0.9651 1.000 0.000
#> SRR1040843     2  0.0000     0.8827 0.000 1.000
#> SRR1040842     2  0.5408     0.8181 0.124 0.876
#> SRR1040845     1  0.9896     0.0597 0.560 0.440
#> SRR1040844     1  0.0000     0.9651 1.000 0.000
#> SRR1040846     2  0.0376     0.8815 0.004 0.996
#> SRR1040847     1  0.0000     0.9651 1.000 0.000
#> SRR1040849     1  0.0000     0.9651 1.000 0.000
#> SRR1040848     2  0.0000     0.8827 0.000 1.000
#> SRR1040851     1  0.0000     0.9651 1.000 0.000
#> SRR1040850     1  0.0000     0.9651 1.000 0.000
#> SRR1040852     1  0.0000     0.9651 1.000 0.000
#> SRR1040853     1  0.0000     0.9651 1.000 0.000
#> SRR1040854     1  0.0000     0.9651 1.000 0.000
#> SRR1040855     1  0.0000     0.9651 1.000 0.000
#> SRR1040856     2  0.9552     0.4957 0.376 0.624
#> SRR1040857     1  0.0000     0.9651 1.000 0.000
#> SRR1040858     1  0.0000     0.9651 1.000 0.000
#> SRR1040859     1  0.8016     0.6172 0.756 0.244
#> SRR1040860     2  0.9286     0.5574 0.344 0.656
#> SRR1040861     1  0.0000     0.9651 1.000 0.000
#> SRR1040862     2  0.8081     0.6993 0.248 0.752
#> SRR1040863     2  0.9944     0.2863 0.456 0.544
#> SRR1040864     1  0.0000     0.9651 1.000 0.000
#> SRR1040865     1  0.0000     0.9651 1.000 0.000
#> SRR1040866     1  0.2043     0.9329 0.968 0.032
#> SRR1040867     1  0.0000     0.9651 1.000 0.000
#> SRR1040868     1  0.0000     0.9651 1.000 0.000
#> SRR1040869     1  0.0000     0.9651 1.000 0.000
#> SRR1040870     1  0.0000     0.9651 1.000 0.000
#> SRR1040871     1  0.0000     0.9651 1.000 0.000
#> SRR1040872     1  0.0000     0.9651 1.000 0.000
#> SRR1040873     2  0.0000     0.8827 0.000 1.000
#> SRR1040874     1  0.0000     0.9651 1.000 0.000
#> SRR1040875     1  0.0000     0.9651 1.000 0.000
#> SRR1040876     1  0.0000     0.9651 1.000 0.000
#> SRR1040877     1  0.0000     0.9651 1.000 0.000
#> SRR1040878     1  0.0000     0.9651 1.000 0.000
#> SRR1040879     2  0.6531     0.7833 0.168 0.832
#> SRR1040880     1  0.0000     0.9651 1.000 0.000
#> SRR1040881     2  0.9754     0.4221 0.408 0.592
#> SRR1040882     1  0.0000     0.9651 1.000 0.000
#> SRR1040883     1  0.0000     0.9651 1.000 0.000
#> SRR1040884     1  0.0000     0.9651 1.000 0.000
#> SRR1040885     1  0.0000     0.9651 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
#> SRR1040814     3  0.5363    0.72340 0.276 0.000 0.724
#> SRR1040813     3  0.0237    0.77916 0.004 0.000 0.996
#> SRR1040816     1  0.0000    0.91742 1.000 0.000 0.000
#> SRR1040815     2  0.5016    0.72306 0.240 0.760 0.000
#> SRR1040817     3  0.5905    0.61985 0.352 0.000 0.648
#> SRR1040818     1  0.0000    0.91742 1.000 0.000 0.000
#> SRR1040819     2  0.5363    0.68533 0.276 0.724 0.000
#> SRR1040820     2  0.0000    0.86663 0.000 1.000 0.000
#> SRR1040821     2  0.0000    0.86663 0.000 1.000 0.000
#> SRR1040822     3  0.5291    0.73199 0.268 0.000 0.732
#> SRR1040823     3  0.1964    0.79069 0.056 0.000 0.944
#> SRR1040824     2  0.0000    0.86663 0.000 1.000 0.000
#> SRR1040826     3  0.0000    0.77744 0.000 0.000 1.000
#> SRR1040825     1  0.4235    0.70325 0.824 0.176 0.000
#> SRR1040827     2  0.0000    0.86663 0.000 1.000 0.000
#> SRR1040828     2  0.5244    0.69343 0.004 0.756 0.240
#> SRR1040829     2  0.0000    0.86663 0.000 1.000 0.000
#> SRR1040830     1  0.0000    0.91742 1.000 0.000 0.000
#> SRR1040831     1  0.0237    0.91856 0.996 0.000 0.004
#> SRR1040832     1  0.3482    0.84661 0.872 0.000 0.128
#> SRR1040833     1  0.0000    0.91742 1.000 0.000 0.000
#> SRR1040834     1  0.4702    0.71088 0.788 0.000 0.212
#> SRR1040835     1  0.2066    0.86784 0.940 0.060 0.000
#> SRR1040836     1  0.1289    0.91430 0.968 0.000 0.032
#> SRR1040837     2  0.0000    0.86663 0.000 1.000 0.000
#> SRR1040839     2  0.0000    0.86663 0.000 1.000 0.000
#> SRR1040838     3  0.4887    0.76044 0.228 0.000 0.772
#> SRR1040840     2  0.0000    0.86663 0.000 1.000 0.000
#> SRR1040841     1  0.0237    0.91856 0.996 0.000 0.004
#> SRR1040843     2  0.0000    0.86663 0.000 1.000 0.000
#> SRR1040842     3  0.4121    0.58952 0.000 0.168 0.832
#> SRR1040845     2  0.5363    0.66018 0.276 0.724 0.000
#> SRR1040844     1  0.0424    0.91855 0.992 0.000 0.008
#> SRR1040846     2  0.0000    0.86663 0.000 1.000 0.000
#> SRR1040847     1  0.0000    0.91742 1.000 0.000 0.000
#> SRR1040849     3  0.2448    0.79289 0.076 0.000 0.924
#> SRR1040848     2  0.0000    0.86663 0.000 1.000 0.000
#> SRR1040851     1  0.3340    0.85607 0.880 0.000 0.120
#> SRR1040850     3  0.0000    0.77744 0.000 0.000 1.000
#> SRR1040852     3  0.5098    0.74783 0.248 0.000 0.752
#> SRR1040853     3  0.5948    0.60609 0.360 0.000 0.640
#> SRR1040854     1  0.2959    0.87541 0.900 0.000 0.100
#> SRR1040855     3  0.0000    0.77744 0.000 0.000 1.000
#> SRR1040856     2  0.4555    0.74320 0.000 0.800 0.200
#> SRR1040857     1  0.2878    0.87871 0.904 0.000 0.096
#> SRR1040858     1  0.2165    0.90123 0.936 0.000 0.064
#> SRR1040859     2  0.6318    0.50161 0.356 0.636 0.008
#> SRR1040860     2  0.4605    0.73991 0.000 0.796 0.204
#> SRR1040861     3  0.0000    0.77744 0.000 0.000 1.000
#> SRR1040862     2  0.4555    0.74320 0.000 0.800 0.200
#> SRR1040863     3  0.6168   -0.00896 0.000 0.412 0.588
#> SRR1040864     3  0.0000    0.77744 0.000 0.000 1.000
#> SRR1040865     1  0.0747    0.91777 0.984 0.000 0.016
#> SRR1040866     2  0.9425    0.31400 0.312 0.488 0.200
#> SRR1040867     3  0.6079    0.54930 0.388 0.000 0.612
#> SRR1040868     1  0.0237    0.91856 0.996 0.000 0.004
#> SRR1040869     1  0.3752    0.82583 0.856 0.000 0.144
#> SRR1040870     3  0.5254    0.73576 0.264 0.000 0.736
#> SRR1040871     1  0.1163    0.91541 0.972 0.000 0.028
#> SRR1040872     3  0.0424    0.78038 0.008 0.000 0.992
#> SRR1040873     2  0.0000    0.86663 0.000 1.000 0.000
#> SRR1040874     1  0.0000    0.91742 1.000 0.000 0.000
#> SRR1040875     3  0.6168    0.49472 0.412 0.000 0.588
#> SRR1040876     1  0.0237    0.91856 0.996 0.000 0.004
#> SRR1040877     3  0.4842    0.76231 0.224 0.000 0.776
#> SRR1040878     1  0.3043    0.88598 0.908 0.008 0.084
#> SRR1040879     2  0.1860    0.84602 0.052 0.948 0.000
#> SRR1040880     1  0.0000    0.91742 1.000 0.000 0.000
#> SRR1040881     1  0.5650    0.42683 0.688 0.312 0.000
#> SRR1040882     3  0.4796    0.76388 0.220 0.000 0.780
#> SRR1040883     1  0.2165    0.90123 0.936 0.000 0.064
#> SRR1040884     1  0.2165    0.90123 0.936 0.000 0.064
#> SRR1040885     3  0.0000    0.77744 0.000 0.000 1.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> SRR1040814     3  0.0937     0.7840 0.012 0.000 0.976 0.012
#> SRR1040813     4  0.4720     0.6506 0.016 0.000 0.264 0.720
#> SRR1040816     1  0.3542     0.7007 0.852 0.000 0.120 0.028
#> SRR1040815     1  0.4456     0.4745 0.716 0.280 0.000 0.004
#> SRR1040817     3  0.0804     0.7863 0.012 0.000 0.980 0.008
#> SRR1040818     1  0.1209     0.6858 0.964 0.000 0.032 0.004
#> SRR1040819     1  0.3494     0.5819 0.824 0.172 0.000 0.004
#> SRR1040820     2  0.0000     0.7874 0.000 1.000 0.000 0.000
#> SRR1040821     2  0.0000     0.7874 0.000 1.000 0.000 0.000
#> SRR1040822     3  0.0817     0.7780 0.000 0.000 0.976 0.024
#> SRR1040823     3  0.3032     0.6994 0.008 0.000 0.868 0.124
#> SRR1040824     2  0.0336     0.7856 0.008 0.992 0.000 0.000
#> SRR1040826     3  0.2216     0.7485 0.000 0.000 0.908 0.092
#> SRR1040825     1  0.1631     0.6774 0.956 0.016 0.008 0.020
#> SRR1040827     2  0.0188     0.7864 0.004 0.996 0.000 0.000
#> SRR1040828     4  0.4700     0.5292 0.052 0.096 0.032 0.820
#> SRR1040829     2  0.3377     0.6862 0.012 0.848 0.000 0.140
#> SRR1040830     1  0.5759     0.5752 0.708 0.000 0.112 0.180
#> SRR1040831     3  0.4072     0.7032 0.252 0.000 0.748 0.000
#> SRR1040832     4  0.7069     0.2229 0.324 0.000 0.144 0.532
#> SRR1040833     1  0.4624     0.4899 0.660 0.000 0.340 0.000
#> SRR1040834     4  0.7774     0.0437 0.372 0.000 0.240 0.388
#> SRR1040835     1  0.4803     0.6526 0.816 0.088 0.032 0.064
#> SRR1040836     3  0.4252     0.6963 0.252 0.000 0.744 0.004
#> SRR1040837     2  0.2345     0.7407 0.000 0.900 0.000 0.100
#> SRR1040839     2  0.0000     0.7874 0.000 1.000 0.000 0.000
#> SRR1040838     3  0.2021     0.7618 0.012 0.000 0.932 0.056
#> SRR1040840     2  0.0000     0.7874 0.000 1.000 0.000 0.000
#> SRR1040841     1  0.3074     0.7056 0.848 0.000 0.152 0.000
#> SRR1040843     2  0.0921     0.7798 0.000 0.972 0.000 0.028
#> SRR1040842     4  0.4589     0.6533 0.000 0.048 0.168 0.784
#> SRR1040845     2  0.8297     0.3073 0.188 0.472 0.304 0.036
#> SRR1040844     1  0.3688     0.6762 0.792 0.000 0.208 0.000
#> SRR1040846     2  0.1118     0.7775 0.000 0.964 0.000 0.036
#> SRR1040847     1  0.3528     0.6874 0.808 0.000 0.192 0.000
#> SRR1040849     3  0.2011     0.7584 0.000 0.000 0.920 0.080
#> SRR1040848     2  0.0000     0.7874 0.000 1.000 0.000 0.000
#> SRR1040851     3  0.3945     0.7403 0.216 0.000 0.780 0.004
#> SRR1040850     4  0.3528     0.6746 0.000 0.000 0.192 0.808
#> SRR1040852     3  0.1452     0.7766 0.008 0.000 0.956 0.036
#> SRR1040853     3  0.2271     0.7491 0.008 0.000 0.916 0.076
#> SRR1040854     3  0.3610     0.7486 0.200 0.000 0.800 0.000
#> SRR1040855     4  0.4998     0.2061 0.000 0.000 0.488 0.512
#> SRR1040856     2  0.5394     0.5895 0.000 0.712 0.228 0.060
#> SRR1040857     3  0.3400     0.7589 0.180 0.000 0.820 0.000
#> SRR1040858     3  0.3982     0.7281 0.220 0.000 0.776 0.004
#> SRR1040859     2  0.8253     0.0931 0.112 0.420 0.408 0.060
#> SRR1040860     2  0.6426     0.5069 0.000 0.628 0.256 0.116
#> SRR1040861     3  0.4008     0.5963 0.000 0.000 0.756 0.244
#> SRR1040862     2  0.6998     0.5219 0.008 0.612 0.192 0.188
#> SRR1040863     2  0.7716     0.2747 0.004 0.460 0.332 0.204
#> SRR1040864     4  0.3907     0.6738 0.000 0.000 0.232 0.768
#> SRR1040865     3  0.4957     0.6725 0.300 0.000 0.684 0.016
#> SRR1040866     3  0.6458     0.6148 0.048 0.108 0.712 0.132
#> SRR1040867     3  0.1452     0.7856 0.036 0.000 0.956 0.008
#> SRR1040868     3  0.4699     0.6678 0.320 0.000 0.676 0.004
#> SRR1040869     3  0.3528     0.7537 0.192 0.000 0.808 0.000
#> SRR1040870     3  0.0804     0.7832 0.008 0.000 0.980 0.012
#> SRR1040871     3  0.4155     0.7212 0.240 0.000 0.756 0.004
#> SRR1040872     3  0.3123     0.6839 0.000 0.000 0.844 0.156
#> SRR1040873     2  0.0000     0.7874 0.000 1.000 0.000 0.000
#> SRR1040874     1  0.2868     0.7080 0.864 0.000 0.136 0.000
#> SRR1040875     3  0.3142     0.7145 0.008 0.000 0.860 0.132
#> SRR1040876     1  0.4756     0.6815 0.772 0.000 0.176 0.052
#> SRR1040877     3  0.1022     0.7780 0.000 0.000 0.968 0.032
#> SRR1040878     3  0.5476     0.6931 0.244 0.004 0.704 0.048
#> SRR1040879     1  0.5250     0.2483 0.552 0.440 0.000 0.008
#> SRR1040880     1  0.4422     0.5253 0.736 0.000 0.256 0.008
#> SRR1040881     1  0.2777     0.6613 0.888 0.104 0.004 0.004
#> SRR1040882     3  0.2412     0.7438 0.008 0.000 0.908 0.084
#> SRR1040883     3  0.4088     0.7255 0.232 0.000 0.764 0.004
#> SRR1040884     1  0.4972     0.1212 0.544 0.000 0.456 0.000
#> SRR1040885     3  0.4103     0.5557 0.000 0.000 0.744 0.256

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>            class entropy silhouette    p1    p2    p3    p4    p5
#> SRR1040814     3  0.1522     0.7704 0.012 0.000 0.944 0.000 0.044
#> SRR1040813     4  0.5618     0.1690 0.000 0.000 0.088 0.564 0.348
#> SRR1040816     1  0.4349     0.6286 0.788 0.000 0.088 0.112 0.012
#> SRR1040815     1  0.3707     0.4657 0.768 0.220 0.004 0.000 0.008
#> SRR1040817     3  0.1670     0.7623 0.012 0.000 0.936 0.000 0.052
#> SRR1040818     1  0.2208     0.6446 0.908 0.000 0.072 0.000 0.020
#> SRR1040819     1  0.3392     0.5460 0.832 0.144 0.012 0.004 0.008
#> SRR1040820     2  0.0000     0.8444 0.000 1.000 0.000 0.000 0.000
#> SRR1040821     2  0.0000     0.8444 0.000 1.000 0.000 0.000 0.000
#> SRR1040822     3  0.1365     0.7662 0.004 0.000 0.952 0.004 0.040
#> SRR1040823     3  0.5059     0.5163 0.000 0.000 0.696 0.112 0.192
#> SRR1040824     2  0.0404     0.8410 0.012 0.988 0.000 0.000 0.000
#> SRR1040826     3  0.3812     0.6767 0.000 0.000 0.812 0.096 0.092
#> SRR1040825     1  0.1588     0.6043 0.948 0.000 0.016 0.028 0.008
#> SRR1040827     2  0.0290     0.8423 0.008 0.992 0.000 0.000 0.000
#> SRR1040828     4  0.1430     0.3805 0.052 0.000 0.000 0.944 0.004
#> SRR1040829     2  0.4457     0.4652 0.012 0.620 0.000 0.368 0.000
#> SRR1040830     4  0.4902    -0.1665 0.468 0.000 0.000 0.508 0.024
#> SRR1040831     3  0.4147     0.7207 0.128 0.000 0.804 0.028 0.040
#> SRR1040832     4  0.6600     0.4402 0.200 0.000 0.032 0.580 0.188
#> SRR1040833     1  0.6446     0.3266 0.496 0.000 0.392 0.052 0.060
#> SRR1040834     4  0.7783     0.2153 0.268 0.000 0.164 0.456 0.112
#> SRR1040835     1  0.3583     0.5345 0.792 0.000 0.012 0.192 0.004
#> SRR1040836     3  0.3818     0.7263 0.144 0.000 0.812 0.016 0.028
#> SRR1040837     2  0.1682     0.8213 0.004 0.940 0.000 0.044 0.012
#> SRR1040839     2  0.0000     0.8444 0.000 1.000 0.000 0.000 0.000
#> SRR1040838     3  0.3059     0.7327 0.008 0.000 0.856 0.016 0.120
#> SRR1040840     2  0.0000     0.8444 0.000 1.000 0.000 0.000 0.000
#> SRR1040841     1  0.5456     0.6046 0.684 0.000 0.224 0.044 0.048
#> SRR1040843     2  0.0579     0.8407 0.000 0.984 0.000 0.008 0.008
#> SRR1040842     5  0.5353    -0.3207 0.000 0.000 0.052 0.472 0.476
#> SRR1040845     2  0.6240     0.5139 0.072 0.648 0.188 0.000 0.092
#> SRR1040844     1  0.5622     0.5738 0.640 0.000 0.276 0.032 0.052
#> SRR1040846     2  0.1285     0.8301 0.004 0.956 0.000 0.036 0.004
#> SRR1040847     1  0.6067     0.5425 0.604 0.000 0.288 0.044 0.064
#> SRR1040849     3  0.2074     0.7618 0.004 0.000 0.920 0.016 0.060
#> SRR1040848     2  0.0000     0.8444 0.000 1.000 0.000 0.000 0.000
#> SRR1040851     3  0.2408     0.7664 0.092 0.000 0.892 0.000 0.016
#> SRR1040850     5  0.5778    -0.2812 0.000 0.000 0.088 0.452 0.460
#> SRR1040852     3  0.2457     0.7589 0.016 0.000 0.900 0.008 0.076
#> SRR1040853     3  0.0807     0.7753 0.012 0.000 0.976 0.000 0.012
#> SRR1040854     3  0.1764     0.7751 0.064 0.000 0.928 0.000 0.008
#> SRR1040855     5  0.6548    -0.1388 0.000 0.000 0.200 0.380 0.420
#> SRR1040856     2  0.3237     0.7441 0.000 0.848 0.104 0.000 0.048
#> SRR1040857     3  0.2230     0.7680 0.044 0.000 0.912 0.000 0.044
#> SRR1040858     3  0.2104     0.7732 0.060 0.000 0.916 0.000 0.024
#> SRR1040859     2  0.5163     0.2597 0.004 0.588 0.368 0.000 0.040
#> SRR1040860     2  0.3639     0.7005 0.000 0.812 0.144 0.000 0.044
#> SRR1040861     5  0.5124    -0.0333 0.004 0.000 0.480 0.028 0.488
#> SRR1040862     5  0.7071     0.2153 0.020 0.268 0.256 0.000 0.456
#> SRR1040863     5  0.6829     0.2754 0.016 0.160 0.336 0.004 0.484
#> SRR1040864     4  0.5407     0.0183 0.000 0.000 0.056 0.472 0.472
#> SRR1040865     3  0.3194     0.7065 0.020 0.000 0.832 0.000 0.148
#> SRR1040866     3  0.6465     0.0542 0.012 0.320 0.520 0.000 0.148
#> SRR1040867     3  0.2945     0.7597 0.056 0.000 0.880 0.008 0.056
#> SRR1040868     3  0.3574     0.7193 0.168 0.000 0.804 0.000 0.028
#> SRR1040869     3  0.1877     0.7760 0.064 0.000 0.924 0.000 0.012
#> SRR1040870     3  0.1788     0.7640 0.008 0.000 0.932 0.004 0.056
#> SRR1040871     3  0.2270     0.7714 0.076 0.000 0.904 0.000 0.020
#> SRR1040872     3  0.4989     0.3970 0.000 0.000 0.648 0.056 0.296
#> SRR1040873     2  0.0000     0.8444 0.000 1.000 0.000 0.000 0.000
#> SRR1040874     1  0.3994     0.6532 0.804 0.000 0.144 0.032 0.020
#> SRR1040875     3  0.3519     0.6135 0.000 0.000 0.776 0.008 0.216
#> SRR1040876     1  0.6777     0.3207 0.540 0.000 0.104 0.300 0.056
#> SRR1040877     3  0.2516     0.6971 0.000 0.000 0.860 0.000 0.140
#> SRR1040878     3  0.5234     0.1587 0.040 0.004 0.560 0.000 0.396
#> SRR1040879     2  0.4546     0.0831 0.460 0.532 0.000 0.008 0.000
#> SRR1040880     1  0.4438     0.5858 0.732 0.000 0.224 0.004 0.040
#> SRR1040881     1  0.3189     0.5725 0.848 0.128 0.016 0.004 0.004
#> SRR1040882     3  0.4583     0.6232 0.000 0.000 0.748 0.140 0.112
#> SRR1040883     3  0.2079     0.7738 0.064 0.000 0.916 0.000 0.020
#> SRR1040884     3  0.6607     0.1756 0.328 0.000 0.536 0.056 0.080
#> SRR1040885     3  0.6601    -0.0918 0.000 0.000 0.460 0.292 0.248

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>            class entropy silhouette    p1    p2    p3    p4    p5    p6
#> SRR1040814     3  0.2001     0.7792 0.008 0.000 0.912 0.068 0.012 0.000
#> SRR1040813     5  0.4641     0.4907 0.044 0.000 0.132 0.024 0.760 0.040
#> SRR1040816     6  0.3417     0.5917 0.032 0.000 0.088 0.036 0.004 0.840
#> SRR1040815     6  0.5173     0.4500 0.080 0.180 0.004 0.036 0.004 0.696
#> SRR1040817     3  0.1668     0.7766 0.004 0.000 0.928 0.060 0.008 0.000
#> SRR1040818     6  0.2620     0.6057 0.028 0.000 0.032 0.052 0.000 0.888
#> SRR1040819     6  0.4630     0.5315 0.104 0.084 0.008 0.036 0.004 0.764
#> SRR1040820     2  0.0000     0.8491 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR1040821     2  0.0000     0.8491 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR1040822     3  0.1914     0.7751 0.008 0.000 0.920 0.056 0.016 0.000
#> SRR1040823     3  0.3758     0.6994 0.012 0.000 0.796 0.044 0.144 0.004
#> SRR1040824     2  0.1970     0.8106 0.028 0.920 0.000 0.008 0.000 0.044
#> SRR1040826     3  0.3079     0.7443 0.004 0.000 0.844 0.056 0.096 0.000
#> SRR1040825     6  0.2060     0.5816 0.084 0.000 0.000 0.016 0.000 0.900
#> SRR1040827     2  0.0935     0.8364 0.004 0.964 0.000 0.000 0.000 0.032
#> SRR1040828     1  0.2765     0.4919 0.848 0.000 0.000 0.004 0.132 0.016
#> SRR1040829     1  0.3360     0.4451 0.732 0.264 0.000 0.004 0.000 0.000
#> SRR1040830     1  0.2266     0.5442 0.880 0.000 0.000 0.012 0.000 0.108
#> SRR1040831     3  0.3577     0.6972 0.004 0.000 0.808 0.056 0.004 0.128
#> SRR1040832     5  0.7379     0.1193 0.192 0.000 0.096 0.016 0.432 0.264
#> SRR1040833     6  0.5342     0.0475 0.012 0.000 0.440 0.072 0.000 0.476
#> SRR1040834     5  0.8078     0.1304 0.112 0.000 0.300 0.044 0.308 0.236
#> SRR1040835     6  0.2153     0.5828 0.084 0.000 0.004 0.008 0.004 0.900
#> SRR1040836     3  0.4338     0.6419 0.004 0.000 0.732 0.100 0.000 0.164
#> SRR1040837     2  0.2653     0.7813 0.000 0.844 0.000 0.000 0.144 0.012
#> SRR1040839     2  0.0725     0.8470 0.000 0.976 0.000 0.000 0.012 0.012
#> SRR1040838     3  0.3211     0.7514 0.008 0.000 0.844 0.028 0.108 0.012
#> SRR1040840     2  0.0000     0.8491 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR1040841     6  0.4353     0.5236 0.012 0.000 0.204 0.060 0.000 0.724
#> SRR1040843     2  0.1663     0.8250 0.000 0.912 0.000 0.000 0.088 0.000
#> SRR1040842     5  0.0881     0.5137 0.012 0.000 0.008 0.008 0.972 0.000
#> SRR1040845     2  0.6170     0.1305 0.016 0.472 0.084 0.396 0.000 0.032
#> SRR1040844     6  0.3994     0.5364 0.012 0.000 0.196 0.040 0.000 0.752
#> SRR1040846     2  0.2357     0.8040 0.000 0.872 0.000 0.000 0.116 0.012
#> SRR1040847     6  0.5028     0.3958 0.020 0.000 0.308 0.056 0.000 0.616
#> SRR1040849     3  0.2375     0.7686 0.016 0.000 0.896 0.020 0.068 0.000
#> SRR1040848     2  0.0000     0.8491 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR1040851     3  0.4148     0.7164 0.032 0.000 0.788 0.108 0.004 0.068
#> SRR1040850     5  0.2094     0.5189 0.028 0.000 0.032 0.016 0.920 0.004
#> SRR1040852     3  0.2002     0.7734 0.004 0.000 0.908 0.012 0.076 0.000
#> SRR1040853     3  0.2544     0.7715 0.016 0.000 0.888 0.076 0.016 0.004
#> SRR1040854     3  0.1608     0.7790 0.004 0.000 0.940 0.036 0.004 0.016
#> SRR1040855     5  0.3136     0.4768 0.000 0.000 0.228 0.004 0.768 0.000
#> SRR1040856     2  0.3321     0.7733 0.000 0.844 0.064 0.064 0.028 0.000
#> SRR1040857     3  0.2734     0.7542 0.004 0.000 0.860 0.116 0.004 0.016
#> SRR1040858     3  0.2871     0.7671 0.008 0.000 0.868 0.080 0.004 0.040
#> SRR1040859     2  0.4849     0.4078 0.004 0.648 0.272 0.072 0.004 0.000
#> SRR1040860     2  0.3807     0.6897 0.004 0.792 0.140 0.056 0.008 0.000
#> SRR1040861     4  0.3932     0.8192 0.008 0.000 0.184 0.760 0.048 0.000
#> SRR1040862     4  0.4240     0.7740 0.012 0.064 0.152 0.764 0.008 0.000
#> SRR1040863     4  0.3542     0.8159 0.012 0.004 0.172 0.796 0.012 0.004
#> SRR1040864     5  0.0520     0.5156 0.000 0.000 0.008 0.008 0.984 0.000
#> SRR1040865     3  0.4095     0.5576 0.008 0.000 0.708 0.260 0.004 0.020
#> SRR1040866     3  0.7697    -0.4477 0.020 0.284 0.312 0.304 0.076 0.004
#> SRR1040867     3  0.2672     0.7733 0.016 0.000 0.892 0.040 0.040 0.012
#> SRR1040868     3  0.3955     0.7295 0.016 0.000 0.796 0.088 0.004 0.096
#> SRR1040869     3  0.1124     0.7798 0.000 0.000 0.956 0.036 0.000 0.008
#> SRR1040870     3  0.1769     0.7737 0.004 0.000 0.924 0.060 0.012 0.000
#> SRR1040871     3  0.2213     0.7700 0.004 0.000 0.904 0.068 0.004 0.020
#> SRR1040872     5  0.4821    -0.0788 0.008 0.000 0.468 0.036 0.488 0.000
#> SRR1040873     2  0.0000     0.8491 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR1040874     6  0.3029     0.5980 0.004 0.000 0.120 0.036 0.000 0.840
#> SRR1040875     4  0.6270     0.6278 0.012 0.000 0.316 0.504 0.148 0.020
#> SRR1040876     1  0.6852    -0.0759 0.360 0.000 0.252 0.048 0.000 0.340
#> SRR1040877     3  0.3492     0.6395 0.008 0.000 0.772 0.208 0.008 0.004
#> SRR1040878     4  0.4437     0.7734 0.028 0.008 0.276 0.680 0.000 0.008
#> SRR1040879     6  0.3975     0.1159 0.000 0.452 0.000 0.004 0.000 0.544
#> SRR1040880     6  0.5181     0.5171 0.072 0.000 0.116 0.096 0.004 0.712
#> SRR1040881     6  0.3441     0.5525 0.040 0.124 0.000 0.016 0.000 0.820
#> SRR1040882     3  0.4757     0.6752 0.024 0.000 0.764 0.060 0.092 0.060
#> SRR1040883     3  0.3147     0.7444 0.008 0.000 0.844 0.108 0.004 0.036
#> SRR1040884     3  0.5444     0.3151 0.016 0.000 0.572 0.080 0.004 0.328
#> SRR1040885     3  0.4254     0.2375 0.000 0.000 0.576 0.020 0.404 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