cola Report for recount2:SRP026537

Date: 2019-12-25 23:42:08 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 15949 rows and 64 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] 15949    64

Density distribution

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

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

plot of chunk density-heatmap

Suggest the best k

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

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

suggest_best_k(res_list)
The best k 1-PAC Mean silhouette Concordance Optional k
SD:skmeans 2 1.000 1.000 1.000 **
SD:pam 2 1.000 0.958 0.985 **
SD:mclust 2 1.000 0.991 0.993 **
SD:NMF 2 1.000 1.000 1.000 **
CV:hclust 4 1.000 0.926 0.975 ** 3
CV:kmeans 2 1.000 0.994 0.965 **
CV:skmeans 2 1.000 0.998 0.999 **
CV:mclust 2 1.000 0.982 0.991 **
CV:NMF 2 1.000 0.966 0.988 **
MAD:pam 2 1.000 0.986 0.994 **
MAD:mclust 2 1.000 0.999 0.999 **
ATC:hclust 2 1.000 0.935 0.971 **
ATC:skmeans 2 1.000 0.977 0.990 **
ATC:kmeans 3 0.999 0.967 0.975 ** 2
ATC:pam 5 0.901 0.891 0.940 * 2
ATC:NMF 3 0.901 0.906 0.958 * 2
MAD:skmeans 4 0.864 0.907 0.940
CV:pam 2 0.766 0.923 0.958
MAD:NMF 3 0.763 0.853 0.921
MAD:hclust 4 0.686 0.840 0.848
ATC:mclust 3 0.607 0.855 0.898
MAD:kmeans 3 0.584 0.830 0.861
SD:kmeans 2 0.504 0.903 0.922
SD:hclust 2 0.497 0.807 0.870

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

CDF of consensus matrices

Cumulative distribution function curves of consensus matrix for all methods.

collect_plots(res_list, fun = plot_ecdf)

plot of chunk collect-plots

Consensus heatmap

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

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

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

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

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

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

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

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

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

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

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

Membership heatmap

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

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

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

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

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

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

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

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

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

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

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

Signature heatmap

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

Note in following heatmaps, rows are scaled.

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

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

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

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

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

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

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

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

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

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

Statistics table

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

get_stats(res_list, k = 2)
#>             k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> SD:NMF      2 1.000           1.000       1.000         0.5065 0.494   0.494
#> CV:NMF      2 1.000           0.966       0.988         0.5078 0.493   0.493
#> MAD:NMF     2 0.489           0.727       0.889         0.4974 0.504   0.504
#> ATC:NMF     2 0.967           0.950       0.974         0.4515 0.542   0.542
#> SD:skmeans  2 1.000           1.000       1.000         0.5064 0.494   0.494
#> CV:skmeans  2 1.000           0.998       0.999         0.5084 0.492   0.492
#> MAD:skmeans 2 0.500           0.880       0.914         0.5053 0.494   0.494
#> ATC:skmeans 2 1.000           0.977       0.990         0.5032 0.497   0.497
#> SD:mclust   2 1.000           0.991       0.993         0.5049 0.494   0.494
#> CV:mclust   2 1.000           0.982       0.991         0.5077 0.492   0.492
#> MAD:mclust  2 1.000           0.999       0.999         0.5059 0.494   0.494
#> ATC:mclust  2 0.492           0.820       0.846         0.4225 0.493   0.493
#> SD:kmeans   2 0.504           0.903       0.922         0.5021 0.494   0.494
#> CV:kmeans   2 1.000           0.994       0.965         0.4766 0.492   0.492
#> MAD:kmeans  2 0.467           0.647       0.789         0.4936 0.494   0.494
#> ATC:kmeans  2 1.000           0.979       0.990         0.4808 0.524   0.524
#> SD:pam      2 1.000           0.958       0.985         0.5035 0.497   0.497
#> CV:pam      2 0.766           0.923       0.958         0.4932 0.494   0.494
#> MAD:pam     2 1.000           0.986       0.994         0.5055 0.494   0.494
#> ATC:pam     2 1.000           0.974       0.988         0.4741 0.532   0.532
#> SD:hclust   2 0.497           0.807       0.870         0.5015 0.493   0.493
#> CV:hclust   2 1.000           0.984       1.000         0.0322 0.969   0.969
#> MAD:hclust  2 0.494           0.659       0.801         0.4978 0.516   0.516
#> ATC:hclust  2 1.000           0.935       0.971         0.4708 0.542   0.542
get_stats(res_list, k = 3)
#>             k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> SD:NMF      3 0.727           0.711       0.882          0.245 0.837   0.681
#> CV:NMF      3 0.808           0.901       0.920          0.243 0.865   0.729
#> MAD:NMF     3 0.763           0.853       0.921          0.317 0.793   0.602
#> ATC:NMF     3 0.901           0.906       0.959          0.430 0.694   0.488
#> SD:skmeans  3 0.736           0.924       0.901          0.267 0.859   0.714
#> CV:skmeans  3 0.753           0.891       0.893          0.248 0.877   0.751
#> MAD:skmeans 3 0.809           0.829       0.906          0.304 0.840   0.680
#> ATC:skmeans 3 0.774           0.882       0.913          0.297 0.805   0.619
#> SD:mclust   3 0.784           0.924       0.931          0.187 0.920   0.838
#> CV:mclust   3 0.786           0.824       0.911          0.186 0.913   0.824
#> MAD:mclust  3 0.751           0.950       0.918          0.255 0.840   0.685
#> ATC:mclust  3 0.607           0.855       0.898          0.484 0.842   0.684
#> SD:kmeans   3 0.710           0.870       0.821          0.250 0.859   0.714
#> CV:kmeans   3 0.681           0.769       0.869          0.262 0.970   0.940
#> MAD:kmeans  3 0.584           0.830       0.861          0.300 0.840   0.680
#> ATC:kmeans  3 0.999           0.967       0.975          0.406 0.760   0.558
#> SD:pam      3 0.872           0.792       0.896          0.187 0.884   0.771
#> CV:pam      3 0.760           0.872       0.931          0.198 0.906   0.810
#> MAD:pam     3 0.645           0.563       0.809          0.255 0.884   0.770
#> ATC:pam     3 0.824           0.926       0.937          0.393 0.795   0.614
#> SD:hclust   3 0.542           0.685       0.830          0.152 0.971   0.942
#> CV:hclust   3 1.000           0.945       0.983         15.107 0.508   0.492
#> MAD:hclust  3 0.395           0.357       0.671          0.225 0.572   0.416
#> ATC:hclust  3 0.899           0.901       0.949          0.419 0.786   0.604
get_stats(res_list, k = 4)
#>             k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> SD:NMF      4 0.668           0.724       0.839         0.1182 0.867   0.665
#> CV:NMF      4 0.728           0.702       0.861         0.1650 0.864   0.642
#> MAD:NMF     4 0.667           0.770       0.870         0.0829 0.912   0.747
#> ATC:NMF     4 0.546           0.552       0.730         0.1156 0.911   0.767
#> SD:skmeans  4 0.743           0.776       0.871         0.1637 0.889   0.685
#> CV:skmeans  4 0.729           0.695       0.851         0.1701 0.875   0.669
#> MAD:skmeans 4 0.864           0.907       0.940         0.1346 0.899   0.714
#> ATC:skmeans 4 0.754           0.672       0.831         0.1006 0.851   0.613
#> SD:mclust   4 0.825           0.953       0.939         0.1951 0.861   0.665
#> CV:mclust   4 0.696           0.864       0.899         0.0341 0.969   0.927
#> MAD:mclust  4 0.874           0.917       0.930         0.1396 0.880   0.684
#> ATC:mclust  4 0.676           0.721       0.826         0.1554 0.826   0.573
#> SD:kmeans   4 0.592           0.654       0.746         0.1383 0.906   0.734
#> CV:kmeans   4 0.574           0.629       0.716         0.1292 0.886   0.757
#> MAD:kmeans  4 0.709           0.853       0.836         0.1274 0.899   0.714
#> ATC:kmeans  4 0.676           0.630       0.772         0.0970 0.975   0.922
#> SD:pam      4 0.661           0.679       0.809         0.2043 0.847   0.625
#> CV:pam      4 0.667           0.748       0.852         0.1999 0.875   0.686
#> MAD:pam     4 0.766           0.894       0.918         0.1661 0.787   0.502
#> ATC:pam     4 0.684           0.788       0.790         0.1118 0.905   0.717
#> SD:hclust   4 0.711           0.539       0.737         0.1845 0.852   0.689
#> CV:hclust   4 1.000           0.926       0.975         0.1420 0.936   0.865
#> MAD:hclust  4 0.686           0.840       0.849         0.1714 0.675   0.409
#> ATC:hclust  4 0.798           0.807       0.848         0.0762 0.960   0.877
get_stats(res_list, k = 5)
#>             k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> SD:NMF      5 0.679           0.601       0.725         0.0998 0.801   0.439
#> CV:NMF      5 0.725           0.705       0.833         0.0735 0.902   0.649
#> MAD:NMF     5 0.630           0.511       0.752         0.0963 0.915   0.708
#> ATC:NMF     5 0.551           0.431       0.708         0.0675 0.853   0.589
#> SD:skmeans  5 0.752           0.647       0.807         0.0589 0.949   0.797
#> CV:skmeans  5 0.720           0.548       0.781         0.0651 0.910   0.679
#> MAD:skmeans 5 0.793           0.783       0.828         0.0563 1.000   1.000
#> ATC:skmeans 5 0.751           0.605       0.811         0.0574 0.878   0.632
#> SD:mclust   5 0.855           0.795       0.876         0.0867 0.887   0.623
#> CV:mclust   5 0.669           0.532       0.807         0.1345 0.905   0.768
#> MAD:mclust  5 0.871           0.884       0.910         0.0738 0.924   0.734
#> ATC:mclust  5 0.779           0.680       0.846         0.0830 0.870   0.591
#> SD:kmeans   5 0.618           0.604       0.728         0.0814 0.974   0.899
#> CV:kmeans   5 0.567           0.566       0.721         0.0838 0.845   0.587
#> MAD:kmeans  5 0.736           0.769       0.797         0.0687 0.984   0.938
#> ATC:kmeans  5 0.697           0.540       0.716         0.0651 0.821   0.467
#> SD:pam      5 0.671           0.587       0.819         0.0670 0.907   0.685
#> CV:pam      5 0.717           0.733       0.862         0.0833 0.911   0.698
#> MAD:pam     5 0.743           0.730       0.835         0.0476 0.948   0.800
#> ATC:pam     5 0.901           0.891       0.940         0.0750 0.939   0.765
#> SD:hclust   5 0.654           0.391       0.726         0.0765 0.890   0.691
#> CV:hclust   5 0.815           0.821       0.881         0.1116 0.898   0.764
#> MAD:hclust  5 0.728           0.714       0.792         0.0761 0.965   0.866
#> ATC:hclust  5 0.772           0.684       0.821         0.0798 0.953   0.836
get_stats(res_list, k = 6)
#>             k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> SD:NMF      6 0.723           0.681       0.803         0.0560 0.939   0.729
#> CV:NMF      6 0.795           0.757       0.797         0.0450 0.933   0.699
#> MAD:NMF     6 0.655           0.417       0.671         0.0501 0.858   0.492
#> ATC:NMF     6 0.595           0.544       0.763         0.0359 0.876   0.573
#> SD:skmeans  6 0.714           0.372       0.692         0.0412 0.917   0.649
#> CV:skmeans  6 0.727           0.484       0.751         0.0417 0.906   0.631
#> MAD:skmeans 6 0.762           0.636       0.768         0.0405 0.915   0.678
#> ATC:skmeans 6 0.730           0.625       0.804         0.0369 0.926   0.716
#> SD:mclust   6 0.811           0.767       0.810         0.0475 0.935   0.709
#> CV:mclust   6 0.745           0.680       0.863         0.1043 0.857   0.574
#> MAD:mclust  6 0.782           0.654       0.823         0.0481 0.973   0.878
#> ATC:mclust  6 0.773           0.597       0.769         0.0458 0.872   0.527
#> SD:kmeans   6 0.721           0.721       0.770         0.0484 0.953   0.810
#> CV:kmeans   6 0.577           0.564       0.702         0.0506 0.986   0.939
#> MAD:kmeans  6 0.758           0.662       0.749         0.0505 0.899   0.621
#> ATC:kmeans  6 0.731           0.733       0.779         0.0451 0.912   0.600
#> SD:pam      6 0.698           0.654       0.809         0.0348 0.936   0.742
#> CV:pam      6 0.814           0.757       0.903         0.0507 0.927   0.704
#> MAD:pam     6 0.772           0.708       0.858         0.0281 0.984   0.926
#> ATC:pam     6 0.892           0.857       0.932         0.0287 0.989   0.946
#> SD:hclust   6 0.667           0.693       0.800         0.0595 0.887   0.613
#> CV:hclust   6 0.777           0.711       0.898         0.0708 0.973   0.925
#> MAD:hclust  6 0.778           0.716       0.800         0.0376 0.963   0.842
#> ATC:hclust  6 0.767           0.579       0.753         0.0456 0.887   0.567

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 15949 rows and 64 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 0.497           0.807       0.870         0.5015 0.493   0.493
#> 3 3 0.542           0.685       0.830         0.1519 0.971   0.942
#> 4 4 0.711           0.539       0.737         0.1845 0.852   0.689
#> 5 5 0.654           0.391       0.726         0.0765 0.890   0.691
#> 6 6 0.667           0.693       0.800         0.0595 0.887   0.613

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
#> SRR925687      1   0.844      0.848 0.728 0.272
#> SRR925688      1   0.844      0.848 0.728 0.272
#> SRR925689      1   0.000      0.748 1.000 0.000
#> SRR925690      1   0.000      0.748 1.000 0.000
#> SRR925691      1   0.000      0.748 1.000 0.000
#> SRR925692      1   0.000      0.748 1.000 0.000
#> SRR925693      2   0.000      0.822 0.000 1.000
#> SRR925694      2   0.844      0.796 0.272 0.728
#> SRR925695      2   0.000      0.822 0.000 1.000
#> SRR925697      1   0.844      0.848 0.728 0.272
#> SRR925696      2   0.000      0.822 0.000 1.000
#> SRR925698      2   0.000      0.822 0.000 1.000
#> SRR925699      2   0.844      0.796 0.272 0.728
#> SRR925700      2   0.844      0.796 0.272 0.728
#> SRR925701      2   0.844      0.796 0.272 0.728
#> SRR925702      1   0.891      0.828 0.692 0.308
#> SRR925703      1   0.844      0.848 0.728 0.272
#> SRR925704      2   0.000      0.822 0.000 1.000
#> SRR925705      2   0.000      0.822 0.000 1.000
#> SRR925706      1   0.929      0.799 0.656 0.344
#> SRR925708      1   0.844      0.848 0.728 0.272
#> SRR925707      1   0.929      0.799 0.656 0.344
#> SRR925709      1   0.844      0.848 0.728 0.272
#> SRR925710      1   0.925      0.803 0.660 0.340
#> SRR925711      2   0.000      0.822 0.000 1.000
#> SRR934631      2   0.844      0.796 0.272 0.728
#> SRR934632      2   0.844      0.796 0.272 0.728
#> SRR934633      2   0.844      0.796 0.272 0.728
#> SRR925713      1   0.886      0.831 0.696 0.304
#> SRR925714      1   0.844      0.848 0.728 0.272
#> SRR925715      1   0.929      0.799 0.656 0.344
#> SRR925716      1   0.844      0.848 0.728 0.272
#> SRR925717      1   0.844      0.848 0.728 0.272
#> SRR925718      2   0.844      0.796 0.272 0.728
#> SRR925719      1   0.844      0.848 0.728 0.272
#> SRR925720      1   0.844      0.848 0.728 0.272
#> SRR925721      1   0.844      0.848 0.728 0.272
#> SRR934634      1   0.000      0.748 1.000 0.000
#> SRR934635      1   0.000      0.748 1.000 0.000
#> SRR925723      2   0.000      0.822 0.000 1.000
#> SRR925724      2   0.000      0.822 0.000 1.000
#> SRR925725      2   0.000      0.822 0.000 1.000
#> SRR925726      1   0.844      0.848 0.728 0.272
#> SRR925727      2   0.000      0.822 0.000 1.000
#> SRR925728      1   0.929      0.799 0.656 0.344
#> SRR934636      1   0.000      0.748 1.000 0.000
#> SRR934637      1   0.000      0.748 1.000 0.000
#> SRR925729      2   0.844      0.796 0.272 0.728
#> SRR934638      1   0.000      0.748 1.000 0.000
#> SRR934639      1   0.000      0.748 1.000 0.000
#> SRR934640      2   0.844      0.796 0.272 0.728
#> SRR934641      2   0.844      0.796 0.272 0.728
#> SRR925734      1   0.000      0.748 1.000 0.000
#> SRR925735      2   0.000      0.822 0.000 1.000
#> SRR925736      2   0.000      0.822 0.000 1.000
#> SRR925737      2   0.000      0.822 0.000 1.000
#> SRR934642      2   0.844      0.796 0.272 0.728
#> SRR934643      2   0.844      0.796 0.272 0.728
#> SRR934644      2   0.844      0.796 0.272 0.728
#> SRR934645      2   0.844      0.796 0.272 0.728
#> SRR925740      2   0.000      0.822 0.000 1.000
#> SRR925741      2   0.000      0.822 0.000 1.000
#> SRR925742      2   0.000      0.822 0.000 1.000
#> SRR1283038     2   0.000      0.822 0.000 1.000

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>            class entropy silhouette    p1    p2    p3
#> SRR925687      1   0.000      0.703 1.000 0.000 0.000
#> SRR925688      1   0.000      0.703 1.000 0.000 0.000
#> SRR925689      1   0.611      0.325 0.604 0.000 0.396
#> SRR925690      1   0.611      0.325 0.604 0.000 0.396
#> SRR925691      1   0.611      0.325 0.604 0.000 0.396
#> SRR925692      1   0.611      0.325 0.604 0.000 0.396
#> SRR925693      2   0.533      0.826 0.272 0.728 0.000
#> SRR925694      2   0.000      0.789 0.000 1.000 0.000
#> SRR925695      2   0.533      0.826 0.272 0.728 0.000
#> SRR925697      1   0.597      0.340 0.636 0.000 0.364
#> SRR925696      2   0.533      0.826 0.272 0.728 0.000
#> SRR925698      2   0.533      0.826 0.272 0.728 0.000
#> SRR925699      2   0.000      0.789 0.000 1.000 0.000
#> SRR925700      2   0.000      0.789 0.000 1.000 0.000
#> SRR925701      2   0.000      0.789 0.000 1.000 0.000
#> SRR925702      1   0.162      0.697 0.964 0.024 0.012
#> SRR925703      1   0.597      0.340 0.636 0.000 0.364
#> SRR925704      2   0.533      0.826 0.272 0.728 0.000
#> SRR925705      2   0.533      0.826 0.272 0.728 0.000
#> SRR925706      1   0.277      0.686 0.928 0.024 0.048
#> SRR925708      1   0.000      0.703 1.000 0.000 0.000
#> SRR925707      1   0.277      0.686 0.928 0.024 0.048
#> SRR925709      1   0.000      0.703 1.000 0.000 0.000
#> SRR925710      1   0.266      0.688 0.932 0.024 0.044
#> SRR925711      2   0.694      0.789 0.272 0.680 0.048
#> SRR934631      2   0.000      0.789 0.000 1.000 0.000
#> SRR934632      2   0.000      0.789 0.000 1.000 0.000
#> SRR934633      2   0.000      0.789 0.000 1.000 0.000
#> SRR925713      1   0.145      0.697 0.968 0.024 0.008
#> SRR925714      1   0.597      0.340 0.636 0.000 0.364
#> SRR925715      1   0.277      0.686 0.928 0.024 0.048
#> SRR925716      1   0.597      0.340 0.636 0.000 0.364
#> SRR925717      1   0.236      0.672 0.928 0.000 0.072
#> SRR925718      2   0.000      0.789 0.000 1.000 0.000
#> SRR925719      1   0.000      0.703 1.000 0.000 0.000
#> SRR925720      1   0.000      0.703 1.000 0.000 0.000
#> SRR925721      1   0.000      0.703 1.000 0.000 0.000
#> SRR934634      1   0.611      0.325 0.604 0.000 0.396
#> SRR934635      1   0.611      0.325 0.604 0.000 0.396
#> SRR925723      2   0.533      0.826 0.272 0.728 0.000
#> SRR925724      2   0.533      0.826 0.272 0.728 0.000
#> SRR925725      2   0.533      0.826 0.272 0.728 0.000
#> SRR925726      1   0.475      0.541 0.784 0.000 0.216
#> SRR925727      2   0.533      0.826 0.272 0.728 0.000
#> SRR925728      1   0.277      0.686 0.928 0.024 0.048
#> SRR934636      3   0.175      1.000 0.048 0.000 0.952
#> SRR934637      3   0.175      1.000 0.048 0.000 0.952
#> SRR925729      2   0.000      0.789 0.000 1.000 0.000
#> SRR934638      1   0.611      0.325 0.604 0.000 0.396
#> SRR934639      1   0.611      0.325 0.604 0.000 0.396
#> SRR934640      2   0.175      0.760 0.000 0.952 0.048
#> SRR934641      2   0.175      0.760 0.000 0.952 0.048
#> SRR925734      1   0.611      0.325 0.604 0.000 0.396
#> SRR925735      2   0.555      0.823 0.272 0.724 0.004
#> SRR925736      2   0.533      0.826 0.272 0.728 0.000
#> SRR925737      2   0.533      0.826 0.272 0.728 0.000
#> SRR934642      2   0.000      0.789 0.000 1.000 0.000
#> SRR934643      2   0.000      0.789 0.000 1.000 0.000
#> SRR934644      2   0.000      0.789 0.000 1.000 0.000
#> SRR934645      2   0.000      0.789 0.000 1.000 0.000
#> SRR925740      2   0.533      0.826 0.272 0.728 0.000
#> SRR925741      2   0.533      0.826 0.272 0.728 0.000
#> SRR925742      2   0.533      0.826 0.272 0.728 0.000
#> SRR1283038     2   0.533      0.826 0.272 0.728 0.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> SRR925687      1   0.484     0.3903 0.604 0.000 0.000 0.396
#> SRR925688      1   0.484     0.3903 0.604 0.000 0.000 0.396
#> SRR925689      1   0.000     0.6633 1.000 0.000 0.000 0.000
#> SRR925690      1   0.000     0.6633 1.000 0.000 0.000 0.000
#> SRR925691      1   0.000     0.6633 1.000 0.000 0.000 0.000
#> SRR925692      1   0.000     0.6633 1.000 0.000 0.000 0.000
#> SRR925693      3   0.499     0.6764 0.000 0.476 0.524 0.000
#> SRR925694      3   0.000     0.7130 0.000 0.000 1.000 0.000
#> SRR925695      3   0.498     0.6864 0.000 0.464 0.536 0.000
#> SRR925697      4   0.156     0.4994 0.056 0.000 0.000 0.944
#> SRR925696      3   0.485     0.7148 0.000 0.400 0.600 0.000
#> SRR925698      3   0.494     0.7006 0.000 0.436 0.564 0.000
#> SRR925699      3   0.000     0.7130 0.000 0.000 1.000 0.000
#> SRR925700      3   0.000     0.7130 0.000 0.000 1.000 0.000
#> SRR925701      3   0.000     0.7130 0.000 0.000 1.000 0.000
#> SRR925702      4   0.789    -0.0491 0.324 0.300 0.000 0.376
#> SRR925703      4   0.156     0.4994 0.056 0.000 0.000 0.944
#> SRR925704      3   0.498     0.6864 0.000 0.464 0.536 0.000
#> SRR925705      3   0.485     0.7148 0.000 0.400 0.600 0.000
#> SRR925706      2   0.748     0.3850 0.204 0.488 0.000 0.308
#> SRR925708      1   0.599     0.3258 0.556 0.044 0.000 0.400
#> SRR925707      2   0.748     0.3850 0.204 0.488 0.000 0.308
#> SRR925709      1   0.606     0.3179 0.552 0.048 0.000 0.400
#> SRR925710      4   0.784    -0.0834 0.272 0.328 0.000 0.400
#> SRR925711      2   0.500    -0.7130 0.000 0.508 0.492 0.000
#> SRR934631      3   0.000     0.7130 0.000 0.000 1.000 0.000
#> SRR934632      3   0.000     0.7130 0.000 0.000 1.000 0.000
#> SRR934633      3   0.000     0.7130 0.000 0.000 1.000 0.000
#> SRR925713      4   0.782     0.0385 0.340 0.260 0.000 0.400
#> SRR925714      4   0.156     0.4994 0.056 0.000 0.000 0.944
#> SRR925715      2   0.748     0.3850 0.204 0.488 0.000 0.308
#> SRR925716      4   0.156     0.4994 0.056 0.000 0.000 0.944
#> SRR925717      4   0.533     0.1169 0.380 0.016 0.000 0.604
#> SRR925718      3   0.000     0.7130 0.000 0.000 1.000 0.000
#> SRR925719      1   0.599     0.3258 0.556 0.044 0.000 0.400
#> SRR925720      1   0.484     0.3903 0.604 0.000 0.000 0.396
#> SRR925721      1   0.484     0.3903 0.604 0.000 0.000 0.396
#> SRR934634      1   0.000     0.6633 1.000 0.000 0.000 0.000
#> SRR934635      1   0.000     0.6633 1.000 0.000 0.000 0.000
#> SRR925723      3   0.485     0.7148 0.000 0.400 0.600 0.000
#> SRR925724      3   0.496     0.6951 0.000 0.448 0.552 0.000
#> SRR925725      3   0.498     0.6864 0.000 0.464 0.536 0.000
#> SRR925726      4   0.404     0.3932 0.248 0.000 0.000 0.752
#> SRR925727      3   0.498     0.6864 0.000 0.464 0.536 0.000
#> SRR925728      2   0.748     0.3850 0.204 0.488 0.000 0.308
#> SRR934636      4   0.717     0.1564 0.396 0.136 0.000 0.468
#> SRR934637      4   0.717     0.1564 0.396 0.136 0.000 0.468
#> SRR925729      3   0.000     0.7130 0.000 0.000 1.000 0.000
#> SRR934638      1   0.000     0.6633 1.000 0.000 0.000 0.000
#> SRR934639      1   0.000     0.6633 1.000 0.000 0.000 0.000
#> SRR934640      3   0.187     0.6526 0.000 0.072 0.928 0.000
#> SRR934641      3   0.187     0.6526 0.000 0.072 0.928 0.000
#> SRR925734      1   0.000     0.6633 1.000 0.000 0.000 0.000
#> SRR925735      3   0.498     0.6854 0.000 0.464 0.536 0.000
#> SRR925736      3   0.485     0.7148 0.000 0.400 0.600 0.000
#> SRR925737      3   0.485     0.7148 0.000 0.400 0.600 0.000
#> SRR934642      3   0.000     0.7130 0.000 0.000 1.000 0.000
#> SRR934643      3   0.000     0.7130 0.000 0.000 1.000 0.000
#> SRR934644      3   0.000     0.7130 0.000 0.000 1.000 0.000
#> SRR934645      3   0.000     0.7130 0.000 0.000 1.000 0.000
#> SRR925740      3   0.485     0.7148 0.000 0.400 0.600 0.000
#> SRR925741      3   0.498     0.6864 0.000 0.464 0.536 0.000
#> SRR925742      3   0.485     0.7148 0.000 0.400 0.600 0.000
#> SRR1283038     3   0.492     0.7041 0.000 0.428 0.572 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
#> SRR925687      1  0.6969      0.221 0.544 0.060 0.000 0.260 0.136
#> SRR925688      1  0.6969      0.221 0.544 0.060 0.000 0.260 0.136
#> SRR925689      1  0.0000      0.677 1.000 0.000 0.000 0.000 0.000
#> SRR925690      1  0.0000      0.677 1.000 0.000 0.000 0.000 0.000
#> SRR925691      1  0.0000      0.677 1.000 0.000 0.000 0.000 0.000
#> SRR925692      1  0.0000      0.677 1.000 0.000 0.000 0.000 0.000
#> SRR925693      3  0.4162      0.530 0.000 0.056 0.768 0.176 0.000
#> SRR925694      2  0.4306      0.912 0.000 0.508 0.492 0.000 0.000
#> SRR925695      3  0.3381      0.546 0.000 0.016 0.808 0.176 0.000
#> SRR925697      5  0.0000      0.714 0.000 0.000 0.000 0.000 1.000
#> SRR925696      3  0.0290      0.529 0.000 0.008 0.992 0.000 0.000
#> SRR925698      3  0.2179      0.559 0.000 0.004 0.896 0.100 0.000
#> SRR925699      3  0.4256     -0.751 0.000 0.436 0.564 0.000 0.000
#> SRR925700      3  0.4256     -0.751 0.000 0.436 0.564 0.000 0.000
#> SRR925701      3  0.4256     -0.751 0.000 0.436 0.564 0.000 0.000
#> SRR925702      4  0.7202      0.494 0.288 0.028 0.000 0.448 0.236
#> SRR925703      5  0.0000      0.714 0.000 0.000 0.000 0.000 1.000
#> SRR925704      3  0.3381      0.546 0.000 0.016 0.808 0.176 0.000
#> SRR925705      3  0.0290      0.529 0.000 0.008 0.992 0.000 0.000
#> SRR925706      4  0.3074      0.791 0.196 0.000 0.000 0.804 0.000
#> SRR925708      1  0.6842      0.185 0.520 0.028 0.000 0.176 0.276
#> SRR925707      4  0.3074      0.791 0.196 0.000 0.000 0.804 0.000
#> SRR925709      1  0.6869      0.174 0.516 0.028 0.000 0.180 0.276
#> SRR925710      4  0.6939      0.669 0.224 0.064 0.000 0.564 0.148
#> SRR925711      3  0.4796      0.458 0.000 0.120 0.728 0.152 0.000
#> SRR934631      3  0.4287     -0.797 0.000 0.460 0.540 0.000 0.000
#> SRR934632      3  0.4287     -0.797 0.000 0.460 0.540 0.000 0.000
#> SRR934633      3  0.4287     -0.797 0.000 0.460 0.540 0.000 0.000
#> SRR925713      4  0.6903      0.572 0.292 0.040 0.000 0.520 0.148
#> SRR925714      5  0.0000      0.714 0.000 0.000 0.000 0.000 1.000
#> SRR925715      4  0.3745      0.781 0.196 0.024 0.000 0.780 0.000
#> SRR925716      5  0.0000      0.714 0.000 0.000 0.000 0.000 1.000
#> SRR925717      5  0.7224      0.315 0.124 0.236 0.000 0.100 0.540
#> SRR925718      3  0.4227     -0.722 0.000 0.420 0.580 0.000 0.000
#> SRR925719      1  0.6842      0.185 0.520 0.028 0.000 0.176 0.276
#> SRR925720      1  0.6855      0.235 0.552 0.052 0.000 0.260 0.136
#> SRR925721      1  0.6381      0.272 0.580 0.024 0.000 0.260 0.136
#> SRR934634      1  0.0703      0.667 0.976 0.024 0.000 0.000 0.000
#> SRR934635      1  0.0703      0.667 0.976 0.024 0.000 0.000 0.000
#> SRR925723      3  0.0609      0.515 0.000 0.020 0.980 0.000 0.000
#> SRR925724      3  0.2612      0.558 0.000 0.008 0.868 0.124 0.000
#> SRR925725      3  0.3810      0.542 0.000 0.036 0.788 0.176 0.000
#> SRR925726      5  0.3461      0.610 0.004 0.224 0.000 0.000 0.772
#> SRR925727      3  0.3476      0.546 0.000 0.020 0.804 0.176 0.000
#> SRR925728      4  0.3074      0.791 0.196 0.000 0.000 0.804 0.000
#> SRR934636      5  0.6938      0.348 0.396 0.176 0.000 0.020 0.408
#> SRR934637      5  0.6938      0.348 0.396 0.176 0.000 0.020 0.408
#> SRR925729      2  0.4306      0.912 0.000 0.508 0.492 0.000 0.000
#> SRR934638      1  0.0000      0.677 1.000 0.000 0.000 0.000 0.000
#> SRR934639      1  0.0000      0.677 1.000 0.000 0.000 0.000 0.000
#> SRR934640      2  0.5250      0.838 0.000 0.536 0.416 0.048 0.000
#> SRR934641      2  0.5250      0.838 0.000 0.536 0.416 0.048 0.000
#> SRR925734      1  0.0000      0.677 1.000 0.000 0.000 0.000 0.000
#> SRR925735      3  0.4138      0.535 0.000 0.072 0.780 0.148 0.000
#> SRR925736      3  0.0162      0.532 0.000 0.004 0.996 0.000 0.000
#> SRR925737      3  0.0162      0.532 0.000 0.004 0.996 0.000 0.000
#> SRR934642      3  0.4256     -0.751 0.000 0.436 0.564 0.000 0.000
#> SRR934643      3  0.4256     -0.751 0.000 0.436 0.564 0.000 0.000
#> SRR934644      2  0.4306      0.912 0.000 0.508 0.492 0.000 0.000
#> SRR934645      2  0.4306      0.912 0.000 0.508 0.492 0.000 0.000
#> SRR925740      3  0.0162      0.532 0.000 0.004 0.996 0.000 0.000
#> SRR925741      3  0.3732      0.543 0.000 0.032 0.792 0.176 0.000
#> SRR925742      3  0.0162      0.532 0.000 0.004 0.996 0.000 0.000
#> SRR1283038     3  0.1892      0.558 0.000 0.004 0.916 0.080 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
#> SRR925687      1  0.7234      0.340 0.464 0.000 0.012 0.256 0.124 0.144
#> SRR925688      1  0.7234      0.340 0.464 0.000 0.012 0.256 0.124 0.144
#> SRR925689      1  0.0000      0.715 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR925690      1  0.0000      0.715 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR925691      1  0.0000      0.715 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR925692      1  0.0000      0.715 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR925693      3  0.2070      0.735 0.000 0.100 0.892 0.000 0.000 0.008
#> SRR925694      2  0.0713      0.841 0.000 0.972 0.028 0.000 0.000 0.000
#> SRR925695      3  0.1918      0.760 0.000 0.088 0.904 0.000 0.000 0.008
#> SRR925697      5  0.0000      0.754 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR925696      3  0.3409      0.691 0.000 0.300 0.700 0.000 0.000 0.000
#> SRR925698      3  0.2260      0.768 0.000 0.140 0.860 0.000 0.000 0.000
#> SRR925699      2  0.2854      0.827 0.000 0.792 0.208 0.000 0.000 0.000
#> SRR925700      2  0.2854      0.827 0.000 0.792 0.208 0.000 0.000 0.000
#> SRR925701      2  0.2854      0.827 0.000 0.792 0.208 0.000 0.000 0.000
#> SRR925702      4  0.6020      0.452 0.160 0.000 0.000 0.572 0.228 0.040
#> SRR925703      5  0.0000      0.754 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR925704      3  0.1918      0.760 0.000 0.088 0.904 0.000 0.000 0.008
#> SRR925705      3  0.3409      0.691 0.000 0.300 0.700 0.000 0.000 0.000
#> SRR925706      4  0.0146      0.720 0.000 0.000 0.004 0.996 0.000 0.000
#> SRR925708      1  0.6522      0.368 0.504 0.000 0.000 0.172 0.264 0.060
#> SRR925707      4  0.0146      0.720 0.000 0.000 0.004 0.996 0.000 0.000
#> SRR925709      1  0.6545      0.361 0.500 0.000 0.000 0.176 0.264 0.060
#> SRR925710      4  0.6635      0.526 0.168 0.024 0.012 0.600 0.136 0.060
#> SRR925711      3  0.4650      0.492 0.000 0.416 0.548 0.028 0.000 0.008
#> SRR934631      2  0.2003      0.854 0.000 0.884 0.116 0.000 0.000 0.000
#> SRR934632      2  0.2003      0.854 0.000 0.884 0.116 0.000 0.000 0.000
#> SRR934633      2  0.2003      0.854 0.000 0.884 0.116 0.000 0.000 0.000
#> SRR925713      4  0.6139      0.388 0.244 0.000 0.000 0.564 0.136 0.056
#> SRR925714      5  0.0000      0.754 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR925715      4  0.1218      0.704 0.000 0.028 0.012 0.956 0.000 0.004
#> SRR925716      5  0.0000      0.754 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR925717      5  0.6576      0.389 0.112 0.000 0.000 0.096 0.496 0.296
#> SRR925718      2  0.3309      0.719 0.000 0.720 0.280 0.000 0.000 0.000
#> SRR925719      1  0.6522      0.368 0.504 0.000 0.000 0.172 0.264 0.060
#> SRR925720      1  0.7122      0.361 0.480 0.000 0.012 0.256 0.124 0.128
#> SRR925721      1  0.6195      0.435 0.556 0.000 0.000 0.256 0.124 0.064
#> SRR934634      1  0.1075      0.701 0.952 0.000 0.000 0.000 0.000 0.048
#> SRR934635      1  0.1075      0.701 0.952 0.000 0.000 0.000 0.000 0.048
#> SRR925723      3  0.3499      0.659 0.000 0.320 0.680 0.000 0.000 0.000
#> SRR925724      3  0.1957      0.769 0.000 0.112 0.888 0.000 0.000 0.000
#> SRR925725      3  0.2118      0.749 0.000 0.104 0.888 0.000 0.000 0.008
#> SRR925726      5  0.3314      0.599 0.004 0.000 0.000 0.000 0.740 0.256
#> SRR925727      3  0.2020      0.758 0.000 0.096 0.896 0.000 0.000 0.008
#> SRR925728      4  0.0146      0.720 0.000 0.000 0.004 0.996 0.000 0.000
#> SRR934636      6  0.4159      1.000 0.016 0.000 0.000 0.000 0.396 0.588
#> SRR934637      6  0.4159      1.000 0.016 0.000 0.000 0.000 0.396 0.588
#> SRR925729      2  0.0713      0.841 0.000 0.972 0.028 0.000 0.000 0.000
#> SRR934638      1  0.0000      0.715 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR934639      1  0.0000      0.715 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR934640      2  0.1679      0.769 0.000 0.936 0.028 0.028 0.000 0.008
#> SRR934641      2  0.1679      0.769 0.000 0.936 0.028 0.028 0.000 0.008
#> SRR925734      1  0.0000      0.715 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR925735      3  0.2845      0.725 0.000 0.172 0.820 0.004 0.000 0.004
#> SRR925736      3  0.3428      0.686 0.000 0.304 0.696 0.000 0.000 0.000
#> SRR925737      3  0.3428      0.686 0.000 0.304 0.696 0.000 0.000 0.000
#> SRR934642      2  0.2854      0.827 0.000 0.792 0.208 0.000 0.000 0.000
#> SRR934643      2  0.2854      0.827 0.000 0.792 0.208 0.000 0.000 0.000
#> SRR934644      2  0.0713      0.841 0.000 0.972 0.028 0.000 0.000 0.000
#> SRR934645      2  0.0713      0.841 0.000 0.972 0.028 0.000 0.000 0.000
#> SRR925740      3  0.3409      0.691 0.000 0.300 0.700 0.000 0.000 0.000
#> SRR925741      3  0.2212      0.752 0.000 0.112 0.880 0.000 0.000 0.008
#> SRR925742      3  0.3409      0.691 0.000 0.300 0.700 0.000 0.000 0.000
#> SRR1283038     3  0.2562      0.769 0.000 0.172 0.828 0.000 0.000 0.000

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

consensus_heatmap(res, k = 2)

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

consensus_heatmap(res, k = 3)

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

consensus_heatmap(res, k = 4)

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

consensus_heatmap(res, k = 5)

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

consensus_heatmap(res, k = 6)

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

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

membership_heatmap(res, k = 2)

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

membership_heatmap(res, k = 3)

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

membership_heatmap(res, k = 4)

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

membership_heatmap(res, k = 5)

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

membership_heatmap(res, k = 6)

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

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

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

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

get_signatures(res, k = 3)

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

get_signatures(res, k = 4)

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

get_signatures(res, k = 5)

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

get_signatures(res, k = 6)

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

Signature heatmaps where rows are not scaled:

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

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

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

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

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

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

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

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

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

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

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk SD-hclust-signature_compare

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

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

An example of the output of tb is:

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

The columns in tb are:

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

UMAP plot which shows how samples are separated.

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

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

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

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

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

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

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

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

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

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

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk SD-hclust-collect-classes

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

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

collect_plots(res)

plot of chunk SD-kmeans-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.504           0.903       0.922         0.5021 0.494   0.494
#> 3 3 0.710           0.870       0.821         0.2501 0.859   0.714
#> 4 4 0.592           0.654       0.746         0.1383 0.906   0.734
#> 5 5 0.618           0.604       0.728         0.0814 0.974   0.899
#> 6 6 0.721           0.721       0.770         0.0484 0.953   0.810

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
#> SRR925687      1  0.0376      0.932 0.996 0.004
#> SRR925688      1  0.0376      0.932 0.996 0.004
#> SRR925689      1  0.6148      0.866 0.848 0.152
#> SRR925690      1  0.6148      0.866 0.848 0.152
#> SRR925691      1  0.6148      0.866 0.848 0.152
#> SRR925692      1  0.6148      0.866 0.848 0.152
#> SRR925693      2  0.6048      0.908 0.148 0.852
#> SRR925694      2  0.1843      0.885 0.028 0.972
#> SRR925695      2  0.6148      0.908 0.152 0.848
#> SRR925697      1  0.1843      0.920 0.972 0.028
#> SRR925696      2  0.6048      0.908 0.148 0.852
#> SRR925698      2  0.6148      0.908 0.152 0.848
#> SRR925699      2  0.1843      0.885 0.028 0.972
#> SRR925700      2  0.1843      0.885 0.028 0.972
#> SRR925701      2  0.1843      0.885 0.028 0.972
#> SRR925702      1  0.0376      0.932 0.996 0.004
#> SRR925703      1  0.1843      0.920 0.972 0.028
#> SRR925704      2  0.6148      0.908 0.152 0.848
#> SRR925705      2  0.6148      0.908 0.152 0.848
#> SRR925706      1  0.2043      0.921 0.968 0.032
#> SRR925708      1  0.0376      0.932 0.996 0.004
#> SRR925707      2  0.2043      0.886 0.032 0.968
#> SRR925709      1  0.0376      0.932 0.996 0.004
#> SRR925710      1  0.2043      0.921 0.968 0.032
#> SRR925711      2  0.6048      0.908 0.148 0.852
#> SRR934631      2  0.1843      0.885 0.028 0.972
#> SRR934632      2  0.1843      0.885 0.028 0.972
#> SRR934633      2  0.0000      0.886 0.000 1.000
#> SRR925713      1  0.2043      0.921 0.968 0.032
#> SRR925714      1  0.1843      0.920 0.972 0.028
#> SRR925715      1  0.2043      0.921 0.968 0.032
#> SRR925716      1  0.0000      0.931 1.000 0.000
#> SRR925717      1  0.2043      0.921 0.968 0.032
#> SRR925718      2  0.1843      0.885 0.028 0.972
#> SRR925719      1  0.0376      0.932 0.996 0.004
#> SRR925720      1  0.0938      0.929 0.988 0.012
#> SRR925721      1  0.0376      0.932 0.996 0.004
#> SRR934634      1  0.6148      0.866 0.848 0.152
#> SRR934635      1  0.6148      0.866 0.848 0.152
#> SRR925723      2  0.6148      0.908 0.152 0.848
#> SRR925724      2  0.6148      0.908 0.152 0.848
#> SRR925725      2  0.6048      0.908 0.148 0.852
#> SRR925726      1  0.1843      0.920 0.972 0.028
#> SRR925727      2  0.6048      0.908 0.148 0.852
#> SRR925728      1  0.0376      0.932 0.996 0.004
#> SRR934636      1  0.6048      0.866 0.852 0.148
#> SRR934637      1  0.3733      0.904 0.928 0.072
#> SRR925729      2  0.6048      0.908 0.148 0.852
#> SRR934638      1  0.6148      0.866 0.848 0.152
#> SRR934639      1  0.0376      0.932 0.996 0.004
#> SRR934640      2  0.1843      0.885 0.028 0.972
#> SRR934641      2  0.1843      0.885 0.028 0.972
#> SRR925734      1  0.6148      0.866 0.848 0.152
#> SRR925735      2  0.6048      0.908 0.148 0.852
#> SRR925736      2  0.6048      0.908 0.148 0.852
#> SRR925737      2  0.6048      0.908 0.148 0.852
#> SRR934642      2  0.1843      0.885 0.028 0.972
#> SRR934643      2  0.1843      0.885 0.028 0.972
#> SRR934644      2  0.1843      0.885 0.028 0.972
#> SRR934645      2  0.1843      0.885 0.028 0.972
#> SRR925740      2  0.6048      0.908 0.148 0.852
#> SRR925741      2  0.6148      0.908 0.152 0.848
#> SRR925742      2  0.6148      0.908 0.152 0.848
#> SRR1283038     2  0.6148      0.908 0.152 0.848

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>            class entropy silhouette    p1    p2    p3
#> SRR925687      1  0.0592      0.897 0.988 0.000 0.012
#> SRR925688      1  0.0237      0.897 0.996 0.000 0.004
#> SRR925689      1  0.4087      0.872 0.880 0.052 0.068
#> SRR925690      1  0.4087      0.872 0.880 0.052 0.068
#> SRR925691      1  0.4087      0.872 0.880 0.052 0.068
#> SRR925692      1  0.4087      0.872 0.880 0.052 0.068
#> SRR925693      3  0.6832      0.904 0.020 0.376 0.604
#> SRR925694      2  0.0424      0.899 0.000 0.992 0.008
#> SRR925695      3  0.6154      0.961 0.000 0.408 0.592
#> SRR925697      1  0.5529      0.791 0.704 0.000 0.296
#> SRR925696      3  0.6180      0.963 0.000 0.416 0.584
#> SRR925698      3  0.6168      0.964 0.000 0.412 0.588
#> SRR925699      2  0.0592      0.902 0.000 0.988 0.012
#> SRR925700      2  0.0424      0.902 0.000 0.992 0.008
#> SRR925701      2  0.0592      0.902 0.000 0.988 0.012
#> SRR925702      1  0.2537      0.889 0.920 0.000 0.080
#> SRR925703      1  0.5529      0.791 0.704 0.000 0.296
#> SRR925704      3  0.6168      0.960 0.000 0.412 0.588
#> SRR925705      3  0.6180      0.963 0.000 0.416 0.584
#> SRR925706      1  0.2796      0.886 0.908 0.000 0.092
#> SRR925708      1  0.0237      0.897 0.996 0.000 0.004
#> SRR925707      2  0.6644      0.564 0.160 0.748 0.092
#> SRR925709      1  0.1753      0.890 0.952 0.000 0.048
#> SRR925710      1  0.3038      0.882 0.896 0.000 0.104
#> SRR925711      3  0.6204      0.865 0.000 0.424 0.576
#> SRR934631      2  0.0892      0.895 0.000 0.980 0.020
#> SRR934632      2  0.0892      0.895 0.000 0.980 0.020
#> SRR934633      2  0.5810     -0.280 0.000 0.664 0.336
#> SRR925713      1  0.2796      0.886 0.908 0.000 0.092
#> SRR925714      1  0.5529      0.791 0.704 0.000 0.296
#> SRR925715      1  0.3038      0.882 0.896 0.000 0.104
#> SRR925716      1  0.5497      0.792 0.708 0.000 0.292
#> SRR925717      1  0.1860      0.894 0.948 0.000 0.052
#> SRR925718      2  0.1163      0.888 0.000 0.972 0.028
#> SRR925719      1  0.0237      0.897 0.996 0.000 0.004
#> SRR925720      1  0.0592      0.897 0.988 0.000 0.012
#> SRR925721      1  0.0747      0.897 0.984 0.000 0.016
#> SRR934634      1  0.4179      0.872 0.876 0.052 0.072
#> SRR934635      1  0.2774      0.887 0.920 0.008 0.072
#> SRR925723      3  0.6168      0.964 0.000 0.412 0.588
#> SRR925724      3  0.6168      0.964 0.000 0.412 0.588
#> SRR925725      3  0.6168      0.956 0.000 0.412 0.588
#> SRR925726      1  0.5529      0.791 0.704 0.000 0.296
#> SRR925727      3  0.6154      0.961 0.000 0.408 0.592
#> SRR925728      1  0.2537      0.889 0.920 0.000 0.080
#> SRR934636      1  0.7492      0.755 0.608 0.052 0.340
#> SRR934637      1  0.5835      0.783 0.660 0.000 0.340
#> SRR925729      3  0.6308      0.840 0.000 0.492 0.508
#> SRR934638      1  0.3896      0.872 0.888 0.052 0.060
#> SRR934639      1  0.0237      0.897 0.996 0.000 0.004
#> SRR934640      2  0.2066      0.859 0.000 0.940 0.060
#> SRR934641      2  0.2066      0.859 0.000 0.940 0.060
#> SRR925734      1  0.3896      0.872 0.888 0.052 0.060
#> SRR925735      3  0.6180      0.938 0.000 0.416 0.584
#> SRR925736      3  0.6204      0.959 0.000 0.424 0.576
#> SRR925737      3  0.6204      0.959 0.000 0.424 0.576
#> SRR934642      2  0.0592      0.902 0.000 0.988 0.012
#> SRR934643      2  0.0592      0.902 0.000 0.988 0.012
#> SRR934644      2  0.0424      0.899 0.000 0.992 0.008
#> SRR934645      2  0.0424      0.899 0.000 0.992 0.008
#> SRR925740      3  0.6180      0.963 0.000 0.416 0.584
#> SRR925741      3  0.6168      0.956 0.000 0.412 0.588
#> SRR925742      3  0.6180      0.963 0.000 0.416 0.584
#> SRR1283038     3  0.6192      0.963 0.000 0.420 0.580

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> SRR925687      1   0.456     0.6096 0.764 0.000 0.028 0.208
#> SRR925688      1   0.449     0.6110 0.772 0.000 0.028 0.200
#> SRR925689      1   0.261     0.5799 0.920 0.020 0.040 0.020
#> SRR925690      1   0.261     0.5799 0.920 0.020 0.040 0.020
#> SRR925691      1   0.261     0.5799 0.920 0.020 0.040 0.020
#> SRR925692      1   0.261     0.5799 0.920 0.020 0.040 0.020
#> SRR925693      3   0.520     0.8720 0.000 0.160 0.752 0.088
#> SRR925694      2   0.183     0.8478 0.000 0.944 0.032 0.024
#> SRR925695      3   0.537     0.8982 0.000 0.188 0.732 0.080
#> SRR925697      4   0.398     0.6641 0.240 0.000 0.000 0.760
#> SRR925696      3   0.363     0.9139 0.000 0.184 0.812 0.004
#> SRR925698      3   0.336     0.9157 0.000 0.176 0.824 0.000
#> SRR925699      2   0.222     0.8516 0.000 0.924 0.060 0.016
#> SRR925700      2   0.222     0.8516 0.000 0.924 0.060 0.016
#> SRR925701      2   0.252     0.8494 0.000 0.908 0.076 0.016
#> SRR925702      1   0.712     0.3114 0.552 0.020 0.088 0.340
#> SRR925703      4   0.398     0.6641 0.240 0.000 0.000 0.760
#> SRR925704      3   0.547     0.8959 0.000 0.192 0.724 0.084
#> SRR925705      3   0.363     0.9139 0.000 0.184 0.812 0.004
#> SRR925706      4   0.788    -0.1620 0.424 0.036 0.112 0.428
#> SRR925708      1   0.418     0.6118 0.784 0.000 0.016 0.200
#> SRR925707      2   0.938     0.2177 0.204 0.436 0.204 0.156
#> SRR925709      1   0.673     0.4667 0.632 0.020 0.088 0.260
#> SRR925710      1   0.764     0.0673 0.444 0.028 0.104 0.424
#> SRR925711      3   0.652     0.6553 0.000 0.288 0.604 0.108
#> SRR934631      2   0.284     0.8350 0.000 0.896 0.076 0.028
#> SRR934632      2   0.284     0.8350 0.000 0.896 0.076 0.028
#> SRR934633      2   0.620    -0.2874 0.000 0.500 0.448 0.052
#> SRR925713      1   0.755     0.1042 0.464 0.024 0.104 0.408
#> SRR925714      4   0.398     0.6641 0.240 0.000 0.000 0.760
#> SRR925715      4   0.779    -0.1517 0.412 0.036 0.104 0.448
#> SRR925716      4   0.461     0.6016 0.304 0.000 0.004 0.692
#> SRR925717      1   0.652     0.2650 0.564 0.000 0.088 0.348
#> SRR925718      2   0.322     0.8172 0.000 0.864 0.120 0.016
#> SRR925719      1   0.418     0.6118 0.784 0.000 0.016 0.200
#> SRR925720      1   0.456     0.6096 0.764 0.000 0.028 0.208
#> SRR925721      1   0.422     0.6184 0.792 0.000 0.024 0.184
#> SRR934634      1   0.157     0.5928 0.956 0.004 0.028 0.012
#> SRR934635      1   0.192     0.5842 0.944 0.004 0.028 0.024
#> SRR925723      3   0.336     0.9157 0.000 0.176 0.824 0.000
#> SRR925724      3   0.354     0.9152 0.000 0.176 0.820 0.004
#> SRR925725      3   0.547     0.8959 0.000 0.192 0.724 0.084
#> SRR925726      4   0.398     0.6641 0.240 0.000 0.000 0.760
#> SRR925727      3   0.533     0.8996 0.000 0.184 0.736 0.080
#> SRR925728      1   0.767     0.2222 0.516 0.032 0.112 0.340
#> SRR934636      4   0.609     0.4429 0.440 0.016 0.020 0.524
#> SRR934637      4   0.560     0.4581 0.464 0.000 0.020 0.516
#> SRR925729      3   0.601     0.7910 0.000 0.312 0.624 0.064
#> SRR934638      1   0.138     0.5954 0.964 0.020 0.008 0.008
#> SRR934639      1   0.327     0.6264 0.832 0.000 0.000 0.168
#> SRR934640      2   0.308     0.7863 0.000 0.884 0.032 0.084
#> SRR934641      2   0.308     0.7863 0.000 0.884 0.032 0.084
#> SRR925734      1   0.130     0.5988 0.964 0.020 0.016 0.000
#> SRR925735      3   0.525     0.8660 0.000 0.196 0.736 0.068
#> SRR925736      3   0.410     0.9068 0.000 0.192 0.792 0.016
#> SRR925737      3   0.410     0.9068 0.000 0.192 0.792 0.016
#> SRR934642      2   0.247     0.8486 0.000 0.908 0.080 0.012
#> SRR934643      2   0.247     0.8486 0.000 0.908 0.080 0.012
#> SRR934644      2   0.194     0.8470 0.000 0.940 0.032 0.028
#> SRR934645      2   0.194     0.8470 0.000 0.940 0.032 0.028
#> SRR925740      3   0.401     0.9103 0.000 0.184 0.800 0.016
#> SRR925741      3   0.547     0.8959 0.000 0.192 0.724 0.084
#> SRR925742      3   0.401     0.9103 0.000 0.184 0.800 0.016
#> SRR1283038     3   0.389     0.9137 0.000 0.184 0.804 0.012

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>            class entropy silhouette    p1    p2    p3    p4    p5
#> SRR925687      1  0.2139     0.5133 0.916 0.000 0.000 0.052 0.032
#> SRR925688      1  0.2036     0.5110 0.920 0.000 0.000 0.056 0.024
#> SRR925689      1  0.6047     0.5470 0.660 0.044 0.000 0.124 0.172
#> SRR925690      1  0.6047     0.5470 0.660 0.044 0.000 0.124 0.172
#> SRR925691      1  0.6047     0.5470 0.660 0.044 0.000 0.124 0.172
#> SRR925692      1  0.6047     0.5470 0.660 0.044 0.000 0.124 0.172
#> SRR925693      3  0.5509     0.7424 0.000 0.060 0.664 0.248 0.028
#> SRR925694      2  0.2790     0.8392 0.000 0.892 0.060 0.020 0.028
#> SRR925695      3  0.4763     0.7648 0.000 0.020 0.716 0.232 0.032
#> SRR925697      5  0.4520     0.8268 0.284 0.000 0.000 0.032 0.684
#> SRR925696      3  0.1173     0.8179 0.000 0.020 0.964 0.012 0.004
#> SRR925698      3  0.0566     0.8232 0.000 0.012 0.984 0.004 0.000
#> SRR925699      2  0.3415     0.8489 0.000 0.840 0.120 0.032 0.008
#> SRR925700      2  0.3463     0.8480 0.000 0.836 0.124 0.032 0.008
#> SRR925701      2  0.3689     0.8439 0.000 0.816 0.144 0.032 0.008
#> SRR925702      1  0.5480    -0.4684 0.560 0.000 0.000 0.368 0.072
#> SRR925703      5  0.4687     0.8257 0.288 0.000 0.000 0.040 0.672
#> SRR925704      3  0.5227     0.7557 0.000 0.044 0.692 0.232 0.032
#> SRR925705      3  0.0960     0.8198 0.000 0.016 0.972 0.008 0.004
#> SRR925706      4  0.6027     0.6209 0.420 0.004 0.000 0.476 0.100
#> SRR925708      1  0.2130     0.4414 0.908 0.000 0.000 0.080 0.012
#> SRR925707      4  0.8059     0.3568 0.124 0.144 0.204 0.504 0.024
#> SRR925709      1  0.4354    -0.3316 0.624 0.000 0.000 0.368 0.008
#> SRR925710      1  0.6208    -0.5858 0.492 0.012 0.000 0.396 0.100
#> SRR925711      3  0.6257     0.5197 0.000 0.148 0.588 0.248 0.016
#> SRR934631      2  0.4404     0.8212 0.000 0.796 0.096 0.080 0.028
#> SRR934632      2  0.4404     0.8212 0.000 0.796 0.096 0.080 0.028
#> SRR934633      2  0.6586     0.0545 0.000 0.440 0.428 0.104 0.028
#> SRR925713      1  0.5938    -0.5359 0.512 0.000 0.000 0.376 0.112
#> SRR925714      5  0.4687     0.8257 0.288 0.000 0.000 0.040 0.672
#> SRR925715      4  0.6100     0.6339 0.408 0.012 0.000 0.492 0.088
#> SRR925716      5  0.3774     0.8067 0.296 0.000 0.000 0.000 0.704
#> SRR925717      1  0.5796    -0.2957 0.588 0.000 0.000 0.284 0.128
#> SRR925718      2  0.4330     0.8055 0.000 0.752 0.204 0.036 0.008
#> SRR925719      1  0.2077     0.4408 0.908 0.000 0.000 0.084 0.008
#> SRR925720      1  0.2139     0.5133 0.916 0.000 0.000 0.052 0.032
#> SRR925721      1  0.2067     0.5341 0.920 0.000 0.000 0.032 0.048
#> SRR934634      1  0.5244     0.5545 0.688 0.004 0.000 0.112 0.196
#> SRR934635      1  0.5289     0.5539 0.684 0.004 0.000 0.116 0.196
#> SRR925723      3  0.0566     0.8232 0.000 0.012 0.984 0.004 0.000
#> SRR925724      3  0.0566     0.8232 0.000 0.012 0.984 0.004 0.000
#> SRR925725      3  0.5360     0.7479 0.000 0.052 0.676 0.244 0.028
#> SRR925726      5  0.4687     0.8257 0.288 0.000 0.000 0.040 0.672
#> SRR925727      3  0.4763     0.7648 0.000 0.020 0.716 0.232 0.032
#> SRR925728      4  0.5649     0.5598 0.452 0.000 0.000 0.472 0.076
#> SRR934636      5  0.3860     0.6529 0.148 0.016 0.000 0.028 0.808
#> SRR934637      5  0.3717     0.6596 0.144 0.012 0.000 0.028 0.816
#> SRR925729      3  0.6227     0.6475 0.000 0.216 0.632 0.104 0.048
#> SRR934638      1  0.5332     0.5599 0.712 0.024 0.000 0.100 0.164
#> SRR934639      1  0.1721     0.5324 0.944 0.020 0.000 0.016 0.020
#> SRR934640      2  0.4918     0.7564 0.000 0.748 0.080 0.148 0.024
#> SRR934641      2  0.4918     0.7564 0.000 0.748 0.080 0.148 0.024
#> SRR925734      1  0.4985     0.5627 0.732 0.016 0.000 0.084 0.168
#> SRR925735      3  0.4943     0.7742 0.000 0.088 0.752 0.132 0.028
#> SRR925736      3  0.2201     0.8020 0.000 0.032 0.920 0.040 0.008
#> SRR925737      3  0.2201     0.8020 0.000 0.032 0.920 0.040 0.008
#> SRR934642      2  0.4181     0.8395 0.000 0.788 0.152 0.048 0.012
#> SRR934643      2  0.4181     0.8395 0.000 0.788 0.152 0.048 0.012
#> SRR934644      2  0.3054     0.8375 0.000 0.880 0.060 0.028 0.032
#> SRR934645      2  0.3054     0.8375 0.000 0.880 0.060 0.028 0.032
#> SRR925740      3  0.1967     0.8092 0.000 0.020 0.932 0.036 0.012
#> SRR925741      3  0.5360     0.7479 0.000 0.052 0.676 0.244 0.028
#> SRR925742      3  0.1869     0.8111 0.000 0.016 0.936 0.036 0.012
#> SRR1283038     3  0.1739     0.8222 0.000 0.024 0.940 0.032 0.004

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>            class entropy silhouette    p1    p2    p3    p4    p5 p6
#> SRR925687      1  0.4461      0.652 0.732 0.004 0.000 0.192 0.052 NA
#> SRR925688      1  0.4431      0.652 0.732 0.004 0.000 0.196 0.048 NA
#> SRR925689      1  0.3769      0.680 0.780 0.000 0.000 0.040 0.012 NA
#> SRR925690      1  0.3769      0.680 0.780 0.000 0.000 0.040 0.012 NA
#> SRR925691      1  0.3769      0.680 0.780 0.000 0.000 0.040 0.012 NA
#> SRR925692      1  0.3769      0.680 0.780 0.000 0.000 0.040 0.012 NA
#> SRR925693      3  0.4662      0.708 0.000 0.032 0.604 0.012 0.000 NA
#> SRR925694      2  0.4138      0.812 0.000 0.796 0.036 0.016 0.040 NA
#> SRR925695      3  0.4210      0.724 0.000 0.016 0.644 0.008 0.000 NA
#> SRR925697      5  0.3530      0.877 0.056 0.000 0.000 0.152 0.792 NA
#> SRR925696      3  0.1419      0.779 0.000 0.012 0.952 0.016 0.016 NA
#> SRR925698      3  0.0405      0.787 0.000 0.000 0.988 0.000 0.004 NA
#> SRR925699      2  0.1411      0.820 0.000 0.936 0.060 0.004 0.000 NA
#> SRR925700      2  0.1411      0.820 0.000 0.936 0.060 0.004 0.000 NA
#> SRR925701      2  0.1531      0.819 0.000 0.928 0.068 0.004 0.000 NA
#> SRR925702      4  0.3511      0.764 0.148 0.000 0.000 0.800 0.048 NA
#> SRR925703      5  0.3530      0.877 0.056 0.000 0.000 0.152 0.792 NA
#> SRR925704      3  0.3998      0.725 0.000 0.016 0.644 0.000 0.000 NA
#> SRR925705      3  0.1204      0.780 0.000 0.004 0.960 0.016 0.016 NA
#> SRR925706      4  0.2588      0.768 0.040 0.004 0.000 0.888 0.008 NA
#> SRR925708      1  0.5263      0.434 0.580 0.012 0.000 0.344 0.052 NA
#> SRR925707      4  0.5476      0.551 0.004 0.048 0.096 0.708 0.024 NA
#> SRR925709      4  0.4113      0.675 0.212 0.012 0.000 0.740 0.032 NA
#> SRR925710      4  0.3632      0.787 0.088 0.012 0.000 0.828 0.056 NA
#> SRR925711      3  0.7644      0.120 0.000 0.096 0.352 0.328 0.024 NA
#> SRR934631      2  0.5227      0.789 0.000 0.704 0.040 0.020 0.068 NA
#> SRR934632      2  0.5227      0.789 0.000 0.704 0.040 0.020 0.068 NA
#> SRR934633      2  0.7378      0.329 0.000 0.400 0.300 0.020 0.072 NA
#> SRR925713      4  0.3150      0.787 0.088 0.000 0.000 0.844 0.060 NA
#> SRR925714      5  0.3530      0.877 0.056 0.000 0.000 0.152 0.792 NA
#> SRR925715      4  0.2762      0.776 0.048 0.012 0.000 0.880 0.004 NA
#> SRR925716      5  0.3123      0.863 0.076 0.000 0.000 0.088 0.836 NA
#> SRR925717      4  0.5163      0.616 0.184 0.012 0.000 0.680 0.112 NA
#> SRR925718      2  0.2558      0.783 0.000 0.840 0.156 0.004 0.000 NA
#> SRR925719      1  0.5231      0.423 0.576 0.012 0.000 0.352 0.048 NA
#> SRR925720      1  0.4461      0.652 0.732 0.004 0.000 0.192 0.052 NA
#> SRR925721      1  0.3910      0.687 0.784 0.004 0.000 0.156 0.036 NA
#> SRR934634      1  0.0984      0.731 0.968 0.000 0.000 0.012 0.008 NA
#> SRR934635      1  0.0984      0.731 0.968 0.000 0.000 0.012 0.008 NA
#> SRR925723      3  0.0291      0.787 0.000 0.000 0.992 0.000 0.004 NA
#> SRR925724      3  0.0405      0.787 0.000 0.000 0.988 0.000 0.004 NA
#> SRR925725      3  0.4278      0.716 0.000 0.016 0.624 0.008 0.000 NA
#> SRR925726      5  0.4051      0.841 0.056 0.000 0.000 0.184 0.752 NA
#> SRR925727      3  0.4252      0.720 0.000 0.016 0.632 0.008 0.000 NA
#> SRR925728      4  0.3716      0.764 0.092 0.004 0.000 0.812 0.012 NA
#> SRR934636      5  0.5037      0.770 0.164 0.004 0.000 0.044 0.708 NA
#> SRR934637      5  0.5037      0.770 0.164 0.004 0.000 0.044 0.708 NA
#> SRR925729      3  0.6231      0.534 0.000 0.192 0.572 0.012 0.032 NA
#> SRR934638      1  0.3132      0.719 0.856 0.008 0.000 0.072 0.008 NA
#> SRR934639      1  0.5002      0.681 0.700 0.012 0.000 0.200 0.032 NA
#> SRR934640      2  0.6265      0.667 0.000 0.580 0.020 0.124 0.040 NA
#> SRR934641      2  0.6265      0.667 0.000 0.580 0.020 0.124 0.040 NA
#> SRR925734      1  0.1923      0.734 0.928 0.008 0.000 0.036 0.008 NA
#> SRR925735      3  0.4669      0.742 0.000 0.044 0.704 0.020 0.008 NA
#> SRR925736      3  0.3421      0.742 0.000 0.060 0.852 0.024 0.024 NA
#> SRR925737      3  0.3421      0.742 0.000 0.060 0.852 0.024 0.024 NA
#> SRR934642      2  0.2829      0.811 0.000 0.876 0.076 0.008 0.020 NA
#> SRR934643      2  0.2829      0.811 0.000 0.876 0.076 0.008 0.020 NA
#> SRR934644      2  0.4634      0.806 0.000 0.756 0.036 0.020 0.048 NA
#> SRR934645      2  0.4634      0.806 0.000 0.756 0.036 0.020 0.048 NA
#> SRR925740      3  0.2082      0.769 0.000 0.024 0.924 0.016 0.016 NA
#> SRR925741      3  0.4278      0.717 0.000 0.016 0.624 0.008 0.000 NA
#> SRR925742      3  0.2082      0.769 0.000 0.024 0.924 0.016 0.016 NA
#> SRR1283038     3  0.1307      0.787 0.000 0.008 0.952 0.000 0.008 NA

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

consensus_heatmap(res, k = 2)

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

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

collect_plots(res)

plot of chunk SD-skmeans-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 1.000           1.000       1.000         0.5064 0.494   0.494
#> 3 3 0.736           0.924       0.901         0.2665 0.859   0.714
#> 4 4 0.743           0.776       0.871         0.1637 0.889   0.685
#> 5 5 0.752           0.647       0.807         0.0589 0.949   0.797
#> 6 6 0.714           0.372       0.692         0.0412 0.917   0.649

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
#> SRR925687      1       0          1  1  0
#> SRR925688      1       0          1  1  0
#> SRR925689      1       0          1  1  0
#> SRR925690      1       0          1  1  0
#> SRR925691      1       0          1  1  0
#> SRR925692      1       0          1  1  0
#> SRR925693      2       0          1  0  1
#> SRR925694      2       0          1  0  1
#> SRR925695      2       0          1  0  1
#> SRR925697      1       0          1  1  0
#> SRR925696      2       0          1  0  1
#> SRR925698      2       0          1  0  1
#> SRR925699      2       0          1  0  1
#> SRR925700      2       0          1  0  1
#> SRR925701      2       0          1  0  1
#> SRR925702      1       0          1  1  0
#> SRR925703      1       0          1  1  0
#> SRR925704      2       0          1  0  1
#> SRR925705      2       0          1  0  1
#> SRR925706      1       0          1  1  0
#> SRR925708      1       0          1  1  0
#> SRR925707      2       0          1  0  1
#> SRR925709      1       0          1  1  0
#> SRR925710      1       0          1  1  0
#> SRR925711      2       0          1  0  1
#> SRR934631      2       0          1  0  1
#> SRR934632      2       0          1  0  1
#> SRR934633      2       0          1  0  1
#> SRR925713      1       0          1  1  0
#> SRR925714      1       0          1  1  0
#> SRR925715      1       0          1  1  0
#> SRR925716      1       0          1  1  0
#> SRR925717      1       0          1  1  0
#> SRR925718      2       0          1  0  1
#> SRR925719      1       0          1  1  0
#> SRR925720      1       0          1  1  0
#> SRR925721      1       0          1  1  0
#> SRR934634      1       0          1  1  0
#> SRR934635      1       0          1  1  0
#> SRR925723      2       0          1  0  1
#> SRR925724      2       0          1  0  1
#> SRR925725      2       0          1  0  1
#> SRR925726      1       0          1  1  0
#> SRR925727      2       0          1  0  1
#> SRR925728      1       0          1  1  0
#> SRR934636      1       0          1  1  0
#> SRR934637      1       0          1  1  0
#> SRR925729      2       0          1  0  1
#> SRR934638      1       0          1  1  0
#> SRR934639      1       0          1  1  0
#> SRR934640      2       0          1  0  1
#> SRR934641      2       0          1  0  1
#> SRR925734      1       0          1  1  0
#> SRR925735      2       0          1  0  1
#> SRR925736      2       0          1  0  1
#> SRR925737      2       0          1  0  1
#> SRR934642      2       0          1  0  1
#> SRR934643      2       0          1  0  1
#> SRR934644      2       0          1  0  1
#> SRR934645      2       0          1  0  1
#> SRR925740      2       0          1  0  1
#> SRR925741      2       0          1  0  1
#> SRR925742      2       0          1  0  1
#> SRR1283038     2       0          1  0  1

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>            class entropy silhouette    p1    p2    p3
#> SRR925687      1  0.0000      0.925 1.000 0.000 0.000
#> SRR925688      1  0.0000      0.925 1.000 0.000 0.000
#> SRR925689      1  0.1163      0.920 0.972 0.028 0.000
#> SRR925690      1  0.1163      0.920 0.972 0.028 0.000
#> SRR925691      1  0.1163      0.920 0.972 0.028 0.000
#> SRR925692      1  0.1163      0.920 0.972 0.028 0.000
#> SRR925693      3  0.4796      0.977 0.000 0.220 0.780
#> SRR925694      2  0.0000      0.969 0.000 1.000 0.000
#> SRR925695      3  0.4796      0.977 0.000 0.220 0.780
#> SRR925697      1  0.4750      0.867 0.784 0.000 0.216
#> SRR925696      3  0.4796      0.977 0.000 0.220 0.780
#> SRR925698      3  0.4796      0.977 0.000 0.220 0.780
#> SRR925699      2  0.0000      0.969 0.000 1.000 0.000
#> SRR925700      2  0.0000      0.969 0.000 1.000 0.000
#> SRR925701      2  0.0000      0.969 0.000 1.000 0.000
#> SRR925702      1  0.3267      0.905 0.884 0.000 0.116
#> SRR925703      1  0.4750      0.867 0.784 0.000 0.216
#> SRR925704      3  0.4796      0.977 0.000 0.220 0.780
#> SRR925705      3  0.4796      0.977 0.000 0.220 0.780
#> SRR925706      1  0.4796      0.865 0.780 0.000 0.220
#> SRR925708      1  0.0000      0.925 1.000 0.000 0.000
#> SRR925707      2  0.3116      0.828 0.000 0.892 0.108
#> SRR925709      1  0.0237      0.925 0.996 0.000 0.004
#> SRR925710      1  0.1163      0.924 0.972 0.000 0.028
#> SRR925711      3  0.6140      0.698 0.000 0.404 0.596
#> SRR934631      2  0.0000      0.969 0.000 1.000 0.000
#> SRR934632      2  0.0000      0.969 0.000 1.000 0.000
#> SRR934633      2  0.4452      0.644 0.000 0.808 0.192
#> SRR925713      1  0.3340      0.904 0.880 0.000 0.120
#> SRR925714      1  0.4750      0.867 0.784 0.000 0.216
#> SRR925715      1  0.1529      0.923 0.960 0.000 0.040
#> SRR925716      1  0.4750      0.867 0.784 0.000 0.216
#> SRR925717      1  0.2356      0.917 0.928 0.000 0.072
#> SRR925718      2  0.0000      0.969 0.000 1.000 0.000
#> SRR925719      1  0.0000      0.925 1.000 0.000 0.000
#> SRR925720      1  0.0000      0.925 1.000 0.000 0.000
#> SRR925721      1  0.0000      0.925 1.000 0.000 0.000
#> SRR934634      1  0.1163      0.920 0.972 0.028 0.000
#> SRR934635      1  0.0747      0.923 0.984 0.016 0.000
#> SRR925723      3  0.4796      0.977 0.000 0.220 0.780
#> SRR925724      3  0.4796      0.977 0.000 0.220 0.780
#> SRR925725      3  0.4796      0.977 0.000 0.220 0.780
#> SRR925726      1  0.4750      0.867 0.784 0.000 0.216
#> SRR925727      3  0.4796      0.977 0.000 0.220 0.780
#> SRR925728      1  0.3686      0.897 0.860 0.000 0.140
#> SRR934636      1  0.8802      0.651 0.584 0.200 0.216
#> SRR934637      1  0.4750      0.867 0.784 0.000 0.216
#> SRR925729      3  0.5859      0.811 0.000 0.344 0.656
#> SRR934638      1  0.1163      0.920 0.972 0.028 0.000
#> SRR934639      1  0.0000      0.925 1.000 0.000 0.000
#> SRR934640      2  0.0000      0.969 0.000 1.000 0.000
#> SRR934641      2  0.0000      0.969 0.000 1.000 0.000
#> SRR925734      1  0.1163      0.920 0.972 0.028 0.000
#> SRR925735      3  0.4796      0.977 0.000 0.220 0.780
#> SRR925736      3  0.4796      0.977 0.000 0.220 0.780
#> SRR925737      3  0.4796      0.977 0.000 0.220 0.780
#> SRR934642      2  0.0000      0.969 0.000 1.000 0.000
#> SRR934643      2  0.0000      0.969 0.000 1.000 0.000
#> SRR934644      2  0.0000      0.969 0.000 1.000 0.000
#> SRR934645      2  0.0000      0.969 0.000 1.000 0.000
#> SRR925740      3  0.4796      0.977 0.000 0.220 0.780
#> SRR925741      3  0.4796      0.977 0.000 0.220 0.780
#> SRR925742      3  0.4796      0.977 0.000 0.220 0.780
#> SRR1283038     3  0.4796      0.977 0.000 0.220 0.780

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> SRR925687      1  0.4866      0.516 0.596 0.000 0.000 0.404
#> SRR925688      1  0.4866      0.516 0.596 0.000 0.000 0.404
#> SRR925689      1  0.0336      0.687 0.992 0.008 0.000 0.000
#> SRR925690      1  0.0336      0.687 0.992 0.008 0.000 0.000
#> SRR925691      1  0.0336      0.687 0.992 0.008 0.000 0.000
#> SRR925692      1  0.0336      0.687 0.992 0.008 0.000 0.000
#> SRR925693      3  0.2149      0.912 0.000 0.088 0.912 0.000
#> SRR925694      2  0.1474      0.942 0.000 0.948 0.052 0.000
#> SRR925695      3  0.1389      0.927 0.000 0.048 0.952 0.000
#> SRR925697      4  0.1211      0.777 0.040 0.000 0.000 0.960
#> SRR925696      3  0.0188      0.932 0.000 0.004 0.996 0.000
#> SRR925698      3  0.0188      0.932 0.000 0.004 0.996 0.000
#> SRR925699      2  0.2704      0.935 0.000 0.876 0.124 0.000
#> SRR925700      2  0.2647      0.934 0.000 0.880 0.120 0.000
#> SRR925701      2  0.2868      0.931 0.000 0.864 0.136 0.000
#> SRR925702      4  0.3523      0.731 0.112 0.032 0.000 0.856
#> SRR925703      4  0.1211      0.777 0.040 0.000 0.000 0.960
#> SRR925704      3  0.1867      0.919 0.000 0.072 0.928 0.000
#> SRR925705      3  0.0188      0.932 0.000 0.004 0.996 0.000
#> SRR925706      4  0.1305      0.756 0.004 0.036 0.000 0.960
#> SRR925708      1  0.4898      0.497 0.584 0.000 0.000 0.416
#> SRR925707      2  0.3442      0.840 0.012 0.876 0.028 0.084
#> SRR925709      1  0.5850      0.369 0.512 0.032 0.000 0.456
#> SRR925710      4  0.5136      0.561 0.224 0.048 0.000 0.728
#> SRR925711      3  0.5018      0.591 0.000 0.332 0.656 0.012
#> SRR934631      2  0.1716      0.942 0.000 0.936 0.064 0.000
#> SRR934632      2  0.1716      0.942 0.000 0.936 0.064 0.000
#> SRR934633      2  0.2345      0.921 0.000 0.900 0.100 0.000
#> SRR925713      4  0.3435      0.737 0.100 0.036 0.000 0.864
#> SRR925714      4  0.1211      0.777 0.040 0.000 0.000 0.960
#> SRR925715      4  0.5094      0.590 0.208 0.044 0.004 0.744
#> SRR925716      4  0.1211      0.777 0.040 0.000 0.000 0.960
#> SRR925717      4  0.3539      0.682 0.176 0.004 0.000 0.820
#> SRR925718      2  0.3400      0.896 0.000 0.820 0.180 0.000
#> SRR925719      1  0.4907      0.482 0.580 0.000 0.000 0.420
#> SRR925720      1  0.4877      0.510 0.592 0.000 0.000 0.408
#> SRR925721      1  0.4605      0.574 0.664 0.000 0.000 0.336
#> SRR934634      1  0.0336      0.688 0.992 0.000 0.000 0.008
#> SRR934635      1  0.0336      0.688 0.992 0.000 0.000 0.008
#> SRR925723      3  0.0188      0.932 0.000 0.004 0.996 0.000
#> SRR925724      3  0.0188      0.932 0.000 0.004 0.996 0.000
#> SRR925725      3  0.2011      0.915 0.000 0.080 0.920 0.000
#> SRR925726      4  0.1211      0.777 0.040 0.000 0.000 0.960
#> SRR925727      3  0.1389      0.927 0.000 0.048 0.952 0.000
#> SRR925728      4  0.4244      0.711 0.160 0.036 0.000 0.804
#> SRR934636      4  0.5263      0.271 0.448 0.008 0.000 0.544
#> SRR934637      4  0.4941      0.296 0.436 0.000 0.000 0.564
#> SRR925729      3  0.4431      0.651 0.000 0.304 0.696 0.000
#> SRR934638      1  0.0000      0.689 1.000 0.000 0.000 0.000
#> SRR934639      1  0.4454      0.588 0.692 0.000 0.000 0.308
#> SRR934640      2  0.1489      0.934 0.000 0.952 0.044 0.004
#> SRR934641      2  0.1489      0.934 0.000 0.952 0.044 0.004
#> SRR925734      1  0.0000      0.689 1.000 0.000 0.000 0.000
#> SRR925735      3  0.2469      0.900 0.000 0.108 0.892 0.000
#> SRR925736      3  0.0188      0.932 0.000 0.004 0.996 0.000
#> SRR925737      3  0.0188      0.932 0.000 0.004 0.996 0.000
#> SRR934642      2  0.2921      0.929 0.000 0.860 0.140 0.000
#> SRR934643      2  0.2921      0.929 0.000 0.860 0.140 0.000
#> SRR934644      2  0.1474      0.942 0.000 0.948 0.052 0.000
#> SRR934645      2  0.1474      0.942 0.000 0.948 0.052 0.000
#> SRR925740      3  0.0188      0.932 0.000 0.004 0.996 0.000
#> SRR925741      3  0.1940      0.917 0.000 0.076 0.924 0.000
#> SRR925742      3  0.0188      0.932 0.000 0.004 0.996 0.000
#> SRR1283038     3  0.1118      0.930 0.000 0.036 0.964 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
#> SRR925687      1  0.6237     0.4856 0.536 0.000 0.000 0.188 0.276
#> SRR925688      1  0.6237     0.4856 0.536 0.000 0.000 0.188 0.276
#> SRR925689      1  0.1341     0.6817 0.944 0.000 0.000 0.056 0.000
#> SRR925690      1  0.1341     0.6817 0.944 0.000 0.000 0.056 0.000
#> SRR925691      1  0.1341     0.6817 0.944 0.000 0.000 0.056 0.000
#> SRR925692      1  0.1341     0.6817 0.944 0.000 0.000 0.056 0.000
#> SRR925693      3  0.3980     0.8380 0.000 0.076 0.796 0.128 0.000
#> SRR925694      2  0.0000     0.9085 0.000 1.000 0.000 0.000 0.000
#> SRR925695      3  0.3267     0.8589 0.000 0.044 0.844 0.112 0.000
#> SRR925697      5  0.0162     0.6681 0.004 0.000 0.000 0.000 0.996
#> SRR925696      3  0.1267     0.8696 0.000 0.012 0.960 0.024 0.004
#> SRR925698      3  0.0324     0.8762 0.000 0.004 0.992 0.004 0.000
#> SRR925699      2  0.1862     0.9082 0.000 0.932 0.048 0.016 0.004
#> SRR925700      2  0.2074     0.9054 0.000 0.920 0.060 0.016 0.004
#> SRR925701      2  0.2332     0.9020 0.000 0.904 0.076 0.016 0.004
#> SRR925702      4  0.5646     0.1116 0.076 0.000 0.000 0.480 0.444
#> SRR925703      5  0.0162     0.6681 0.004 0.000 0.000 0.000 0.996
#> SRR925704      3  0.3906     0.8451 0.000 0.084 0.804 0.112 0.000
#> SRR925705      3  0.1267     0.8696 0.000 0.012 0.960 0.024 0.004
#> SRR925706      5  0.4307     0.0205 0.000 0.000 0.000 0.500 0.500
#> SRR925708      1  0.6231     0.4677 0.532 0.000 0.000 0.180 0.288
#> SRR925707      4  0.4392    -0.0219 0.000 0.380 0.000 0.612 0.008
#> SRR925709      4  0.6627     0.1115 0.296 0.000 0.000 0.452 0.252
#> SRR925710      4  0.5892     0.2226 0.108 0.000 0.000 0.520 0.372
#> SRR925711      4  0.6756    -0.2388 0.000 0.264 0.364 0.372 0.000
#> SRR934631      2  0.1106     0.9034 0.000 0.964 0.024 0.012 0.000
#> SRR934632      2  0.1106     0.9034 0.000 0.964 0.024 0.012 0.000
#> SRR934633      2  0.3416     0.7876 0.000 0.840 0.088 0.072 0.000
#> SRR925713      5  0.5406    -0.2564 0.056 0.000 0.000 0.464 0.480
#> SRR925714      5  0.0162     0.6681 0.004 0.000 0.000 0.000 0.996
#> SRR925715      4  0.5105     0.3001 0.076 0.000 0.000 0.660 0.264
#> SRR925716      5  0.0671     0.6624 0.004 0.000 0.000 0.016 0.980
#> SRR925717      5  0.5016     0.2833 0.120 0.000 0.000 0.176 0.704
#> SRR925718      2  0.3169     0.8472 0.000 0.840 0.140 0.016 0.004
#> SRR925719      1  0.6243     0.4657 0.532 0.000 0.000 0.184 0.284
#> SRR925720      1  0.6237     0.4856 0.536 0.000 0.000 0.188 0.276
#> SRR925721      1  0.5740     0.5491 0.620 0.000 0.000 0.164 0.216
#> SRR934634      1  0.0807     0.6989 0.976 0.000 0.000 0.012 0.012
#> SRR934635      1  0.0807     0.6989 0.976 0.000 0.000 0.012 0.012
#> SRR925723      3  0.0162     0.8757 0.000 0.004 0.996 0.000 0.000
#> SRR925724      3  0.0324     0.8764 0.000 0.004 0.992 0.004 0.000
#> SRR925725      3  0.4111     0.8332 0.000 0.092 0.788 0.120 0.000
#> SRR925726      5  0.0566     0.6604 0.004 0.000 0.000 0.012 0.984
#> SRR925727      3  0.3165     0.8582 0.000 0.036 0.848 0.116 0.000
#> SRR925728      4  0.5640     0.0811 0.104 0.000 0.000 0.592 0.304
#> SRR934636      5  0.5013     0.4488 0.232 0.000 0.000 0.084 0.684
#> SRR934637      5  0.4901     0.4620 0.216 0.000 0.000 0.084 0.700
#> SRR925729      3  0.5951     0.4971 0.000 0.364 0.520 0.116 0.000
#> SRR934638      1  0.0162     0.6980 0.996 0.000 0.000 0.004 0.000
#> SRR934639      1  0.4058     0.6294 0.784 0.000 0.000 0.064 0.152
#> SRR934640      2  0.2286     0.8541 0.000 0.888 0.004 0.108 0.000
#> SRR934641      2  0.2286     0.8541 0.000 0.888 0.004 0.108 0.000
#> SRR925734      1  0.0000     0.6981 1.000 0.000 0.000 0.000 0.000
#> SRR925735      3  0.4624     0.8076 0.000 0.112 0.744 0.144 0.000
#> SRR925736      3  0.1885     0.8604 0.000 0.020 0.932 0.044 0.004
#> SRR925737      3  0.1885     0.8604 0.000 0.020 0.932 0.044 0.004
#> SRR934642      2  0.2429     0.9008 0.000 0.900 0.076 0.020 0.004
#> SRR934643      2  0.2429     0.9008 0.000 0.900 0.076 0.020 0.004
#> SRR934644      2  0.0000     0.9085 0.000 1.000 0.000 0.000 0.000
#> SRR934645      2  0.0000     0.9085 0.000 1.000 0.000 0.000 0.000
#> SRR925740      3  0.1365     0.8688 0.000 0.004 0.952 0.040 0.004
#> SRR925741      3  0.4002     0.8380 0.000 0.084 0.796 0.120 0.000
#> SRR925742      3  0.1365     0.8688 0.000 0.004 0.952 0.040 0.004
#> SRR1283038     3  0.2074     0.8731 0.000 0.044 0.920 0.036 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
#> SRR925687      1  0.0405     0.6184 0.988 0.000 0.000 0.008 0.004 0.000
#> SRR925688      1  0.0260     0.6160 0.992 0.000 0.000 0.008 0.000 0.000
#> SRR925689      5  0.3706    -0.3011 0.380 0.000 0.000 0.000 0.620 0.000
#> SRR925690      5  0.3706    -0.3011 0.380 0.000 0.000 0.000 0.620 0.000
#> SRR925691      5  0.3706    -0.3011 0.380 0.000 0.000 0.000 0.620 0.000
#> SRR925692      5  0.3706    -0.3011 0.380 0.000 0.000 0.000 0.620 0.000
#> SRR925693      3  0.1913     0.4377 0.000 0.016 0.924 0.016 0.000 0.044
#> SRR925694      2  0.0665     0.8596 0.000 0.980 0.008 0.004 0.000 0.008
#> SRR925695      3  0.0551     0.4547 0.000 0.004 0.984 0.004 0.000 0.008
#> SRR925697      5  0.7224     0.3507 0.116 0.000 0.000 0.184 0.376 0.324
#> SRR925696      3  0.3872    -0.5500 0.000 0.004 0.604 0.000 0.000 0.392
#> SRR925698      3  0.3547    -0.1899 0.000 0.004 0.696 0.000 0.000 0.300
#> SRR925699      2  0.2450     0.8630 0.000 0.868 0.016 0.000 0.000 0.116
#> SRR925700      2  0.2257     0.8628 0.000 0.876 0.008 0.000 0.000 0.116
#> SRR925701      2  0.2623     0.8595 0.000 0.852 0.016 0.000 0.000 0.132
#> SRR925702      4  0.5151     0.5612 0.296 0.000 0.000 0.620 0.044 0.040
#> SRR925703      5  0.7224     0.3507 0.116 0.000 0.000 0.184 0.376 0.324
#> SRR925704      3  0.0717     0.4576 0.000 0.016 0.976 0.000 0.000 0.008
#> SRR925705      3  0.3881    -0.5608 0.000 0.004 0.600 0.000 0.000 0.396
#> SRR925706      4  0.3406     0.5480 0.036 0.000 0.000 0.840 0.056 0.068
#> SRR925708      1  0.2373     0.5606 0.888 0.000 0.000 0.084 0.004 0.024
#> SRR925707      4  0.4163     0.4846 0.000 0.184 0.000 0.740 0.004 0.072
#> SRR925709      1  0.4631    -0.2787 0.528 0.000 0.000 0.440 0.012 0.020
#> SRR925710      4  0.5736     0.5076 0.356 0.000 0.004 0.532 0.028 0.080
#> SRR925711      4  0.7882    -0.0276 0.000 0.192 0.272 0.276 0.008 0.252
#> SRR934631      2  0.1923     0.8546 0.000 0.916 0.064 0.004 0.000 0.016
#> SRR934632      2  0.1923     0.8546 0.000 0.916 0.064 0.004 0.000 0.016
#> SRR934633      2  0.4016     0.6077 0.000 0.684 0.292 0.004 0.000 0.020
#> SRR925713      4  0.5599     0.5361 0.328 0.000 0.000 0.564 0.048 0.060
#> SRR925714      5  0.7224     0.3507 0.116 0.000 0.000 0.184 0.376 0.324
#> SRR925715      4  0.4296     0.6056 0.224 0.000 0.008 0.720 0.004 0.044
#> SRR925716      5  0.7230     0.3553 0.136 0.000 0.000 0.156 0.372 0.336
#> SRR925717      1  0.7268    -0.2177 0.412 0.000 0.000 0.196 0.260 0.132
#> SRR925718      2  0.3352     0.8132 0.000 0.792 0.032 0.000 0.000 0.176
#> SRR925719      1  0.2009     0.5676 0.904 0.000 0.000 0.084 0.004 0.008
#> SRR925720      1  0.0405     0.6184 0.988 0.000 0.000 0.008 0.004 0.000
#> SRR925721      1  0.1007     0.6164 0.956 0.000 0.000 0.000 0.044 0.000
#> SRR934634      1  0.3841     0.4497 0.616 0.000 0.000 0.000 0.380 0.004
#> SRR934635      1  0.3923     0.4284 0.580 0.000 0.000 0.000 0.416 0.004
#> SRR925723      3  0.3652    -0.2764 0.000 0.004 0.672 0.000 0.000 0.324
#> SRR925724      3  0.3584    -0.2174 0.000 0.004 0.688 0.000 0.000 0.308
#> SRR925725      3  0.1350     0.4531 0.000 0.020 0.952 0.008 0.000 0.020
#> SRR925726      5  0.7368     0.3188 0.152 0.000 0.000 0.176 0.376 0.296
#> SRR925727      3  0.0767     0.4560 0.000 0.012 0.976 0.004 0.000 0.008
#> SRR925728      4  0.4156     0.5807 0.092 0.000 0.000 0.788 0.064 0.056
#> SRR934636      5  0.6357     0.3335 0.044 0.000 0.000 0.156 0.492 0.308
#> SRR934637      5  0.6401     0.3356 0.044 0.000 0.000 0.160 0.480 0.316
#> SRR925729      3  0.4454     0.1495 0.000 0.348 0.616 0.004 0.000 0.032
#> SRR934638      1  0.4328     0.3979 0.520 0.000 0.000 0.020 0.460 0.000
#> SRR934639      1  0.3871     0.5198 0.676 0.000 0.000 0.016 0.308 0.000
#> SRR934640      2  0.3880     0.7582 0.000 0.804 0.032 0.076 0.000 0.088
#> SRR934641      2  0.3880     0.7582 0.000 0.804 0.032 0.076 0.000 0.088
#> SRR925734      1  0.3866     0.3822 0.516 0.000 0.000 0.000 0.484 0.000
#> SRR925735      3  0.3940     0.3490 0.000 0.068 0.804 0.048 0.000 0.080
#> SRR925736      6  0.4413     1.0000 0.000 0.008 0.484 0.012 0.000 0.496
#> SRR925737      6  0.4413     1.0000 0.000 0.008 0.484 0.012 0.000 0.496
#> SRR934642      2  0.2623     0.8595 0.000 0.852 0.016 0.000 0.000 0.132
#> SRR934643      2  0.2623     0.8595 0.000 0.852 0.016 0.000 0.000 0.132
#> SRR934644      2  0.0622     0.8583 0.000 0.980 0.008 0.000 0.000 0.012
#> SRR934645      2  0.0405     0.8595 0.000 0.988 0.008 0.000 0.000 0.004
#> SRR925740      3  0.4070    -0.6783 0.000 0.004 0.568 0.004 0.000 0.424
#> SRR925741      3  0.0984     0.4589 0.000 0.012 0.968 0.008 0.000 0.012
#> SRR925742      3  0.4070    -0.6783 0.000 0.004 0.568 0.004 0.000 0.424
#> SRR1283038     3  0.3468    -0.0257 0.000 0.008 0.728 0.000 0.000 0.264

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

consensus_heatmap(res, k = 2)

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

consensus_heatmap(res, k = 3)

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

consensus_heatmap(res, k = 4)

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

consensus_heatmap(res, k = 5)

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

consensus_heatmap(res, k = 6)

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

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

membership_heatmap(res, k = 2)

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

membership_heatmap(res, k = 3)

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

membership_heatmap(res, k = 4)

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

membership_heatmap(res, k = 5)

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

membership_heatmap(res, k = 6)

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

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

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

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

get_signatures(res, k = 3)

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

get_signatures(res, k = 4)

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

get_signatures(res, k = 5)

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

get_signatures(res, k = 6)

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

Signature heatmaps where rows are not scaled:

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

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

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

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

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

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

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

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

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

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

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk SD-skmeans-signature_compare

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

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

An example of the output of tb is:

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

The columns in tb are:

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

UMAP plot which shows how samples are separated.

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

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

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

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

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

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

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

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

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

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

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk SD-skmeans-collect-classes

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


SD:pam**

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

res = res_list["SD", "pam"]
# you can also extract it by
# res = res_list["SD:pam"]

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

res
#> A 'ConsensusPartition' object with k = 2, 3, 4, 5, 6.
#>   On a matrix with 15949 rows and 64 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.958       0.985         0.5035 0.497   0.497
#> 3 3 0.872           0.792       0.896         0.1866 0.884   0.771
#> 4 4 0.661           0.679       0.809         0.2043 0.847   0.625
#> 5 5 0.671           0.587       0.819         0.0670 0.907   0.685
#> 6 6 0.698           0.654       0.809         0.0348 0.936   0.742

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
#> SRR925687      1  0.0000     0.9826 1.000 0.000
#> SRR925688      1  0.0000     0.9826 1.000 0.000
#> SRR925689      1  0.0000     0.9826 1.000 0.000
#> SRR925690      1  0.0000     0.9826 1.000 0.000
#> SRR925691      1  0.0000     0.9826 1.000 0.000
#> SRR925692      1  0.0000     0.9826 1.000 0.000
#> SRR925693      2  0.0000     0.9848 0.000 1.000
#> SRR925694      2  0.0000     0.9848 0.000 1.000
#> SRR925695      2  0.0000     0.9848 0.000 1.000
#> SRR925697      1  0.0000     0.9826 1.000 0.000
#> SRR925696      2  0.0000     0.9848 0.000 1.000
#> SRR925698      2  0.0000     0.9848 0.000 1.000
#> SRR925699      2  0.0000     0.9848 0.000 1.000
#> SRR925700      2  0.0000     0.9848 0.000 1.000
#> SRR925701      2  0.0000     0.9848 0.000 1.000
#> SRR925702      1  0.0000     0.9826 1.000 0.000
#> SRR925703      1  0.0000     0.9826 1.000 0.000
#> SRR925704      2  0.0000     0.9848 0.000 1.000
#> SRR925705      2  0.0000     0.9848 0.000 1.000
#> SRR925706      2  1.0000    -0.0439 0.500 0.500
#> SRR925708      1  0.0000     0.9826 1.000 0.000
#> SRR925707      2  0.0000     0.9848 0.000 1.000
#> SRR925709      1  0.0000     0.9826 1.000 0.000
#> SRR925710      1  0.0672     0.9761 0.992 0.008
#> SRR925711      2  0.0000     0.9848 0.000 1.000
#> SRR934631      2  0.0000     0.9848 0.000 1.000
#> SRR934632      2  0.0000     0.9848 0.000 1.000
#> SRR934633      2  0.0000     0.9848 0.000 1.000
#> SRR925713      1  0.5519     0.8465 0.872 0.128
#> SRR925714      1  0.0000     0.9826 1.000 0.000
#> SRR925715      1  0.9170     0.5027 0.668 0.332
#> SRR925716      1  0.0000     0.9826 1.000 0.000
#> SRR925717      1  0.0000     0.9826 1.000 0.000
#> SRR925718      2  0.0000     0.9848 0.000 1.000
#> SRR925719      1  0.0000     0.9826 1.000 0.000
#> SRR925720      1  0.0000     0.9826 1.000 0.000
#> SRR925721      1  0.0000     0.9826 1.000 0.000
#> SRR934634      1  0.0000     0.9826 1.000 0.000
#> SRR934635      1  0.0000     0.9826 1.000 0.000
#> SRR925723      2  0.0000     0.9848 0.000 1.000
#> SRR925724      2  0.0000     0.9848 0.000 1.000
#> SRR925725      2  0.0000     0.9848 0.000 1.000
#> SRR925726      1  0.0000     0.9826 1.000 0.000
#> SRR925727      2  0.0000     0.9848 0.000 1.000
#> SRR925728      1  0.0672     0.9760 0.992 0.008
#> SRR934636      1  0.0000     0.9826 1.000 0.000
#> SRR934637      1  0.0000     0.9826 1.000 0.000
#> SRR925729      2  0.0000     0.9848 0.000 1.000
#> SRR934638      1  0.0000     0.9826 1.000 0.000
#> SRR934639      1  0.0000     0.9826 1.000 0.000
#> SRR934640      2  0.0000     0.9848 0.000 1.000
#> SRR934641      2  0.0000     0.9848 0.000 1.000
#> SRR925734      1  0.0000     0.9826 1.000 0.000
#> SRR925735      2  0.0000     0.9848 0.000 1.000
#> SRR925736      2  0.0000     0.9848 0.000 1.000
#> SRR925737      2  0.0000     0.9848 0.000 1.000
#> SRR934642      2  0.0000     0.9848 0.000 1.000
#> SRR934643      2  0.0000     0.9848 0.000 1.000
#> SRR934644      2  0.0000     0.9848 0.000 1.000
#> SRR934645      2  0.0000     0.9848 0.000 1.000
#> SRR925740      2  0.0000     0.9848 0.000 1.000
#> SRR925741      2  0.0000     0.9848 0.000 1.000
#> SRR925742      2  0.0000     0.9848 0.000 1.000
#> SRR1283038     2  0.0000     0.9848 0.000 1.000

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>            class entropy silhouette    p1    p2    p3
#> SRR925687      1  0.0000      0.692 1.000 0.000 0.000
#> SRR925688      1  0.0000      0.692 1.000 0.000 0.000
#> SRR925689      3  0.6140      0.808 0.404 0.000 0.596
#> SRR925690      3  0.6140      0.808 0.404 0.000 0.596
#> SRR925691      3  0.6140      0.808 0.404 0.000 0.596
#> SRR925692      3  0.6140      0.808 0.404 0.000 0.596
#> SRR925693      2  0.0000      0.997 0.000 1.000 0.000
#> SRR925694      2  0.0424      0.995 0.000 0.992 0.008
#> SRR925695      2  0.0000      0.997 0.000 1.000 0.000
#> SRR925697      1  0.6111      0.466 0.604 0.000 0.396
#> SRR925696      2  0.0000      0.997 0.000 1.000 0.000
#> SRR925698      2  0.0000      0.997 0.000 1.000 0.000
#> SRR925699      2  0.0237      0.996 0.000 0.996 0.004
#> SRR925700      2  0.0237      0.996 0.000 0.996 0.004
#> SRR925701      2  0.0424      0.995 0.000 0.992 0.008
#> SRR925702      1  0.0592      0.683 0.988 0.000 0.012
#> SRR925703      1  0.6111      0.466 0.604 0.000 0.396
#> SRR925704      2  0.0000      0.997 0.000 1.000 0.000
#> SRR925705      2  0.0000      0.997 0.000 1.000 0.000
#> SRR925706      1  0.5696      0.505 0.800 0.136 0.064
#> SRR925708      1  0.0000      0.692 1.000 0.000 0.000
#> SRR925707      2  0.0592      0.987 0.012 0.988 0.000
#> SRR925709      3  0.6180      0.793 0.416 0.000 0.584
#> SRR925710      1  0.0237      0.690 0.996 0.004 0.000
#> SRR925711      2  0.0592      0.987 0.012 0.988 0.000
#> SRR934631      2  0.0424      0.995 0.000 0.992 0.008
#> SRR934632      2  0.0424      0.995 0.000 0.992 0.008
#> SRR934633      2  0.0424      0.995 0.000 0.992 0.008
#> SRR925713      1  0.0000      0.692 1.000 0.000 0.000
#> SRR925714      1  0.6111      0.466 0.604 0.000 0.396
#> SRR925715      1  0.4861      0.407 0.808 0.012 0.180
#> SRR925716      1  0.6111      0.466 0.604 0.000 0.396
#> SRR925717      1  0.0000      0.692 1.000 0.000 0.000
#> SRR925718      2  0.0237      0.996 0.000 0.996 0.004
#> SRR925719      1  0.0000      0.692 1.000 0.000 0.000
#> SRR925720      1  0.0000      0.692 1.000 0.000 0.000
#> SRR925721      1  0.0592      0.684 0.988 0.000 0.012
#> SRR934634      1  0.0592      0.684 0.988 0.000 0.012
#> SRR934635      1  0.6154     -0.428 0.592 0.000 0.408
#> SRR925723      2  0.0000      0.997 0.000 1.000 0.000
#> SRR925724      2  0.0000      0.997 0.000 1.000 0.000
#> SRR925725      2  0.0000      0.997 0.000 1.000 0.000
#> SRR925726      1  0.6111      0.466 0.604 0.000 0.396
#> SRR925727      2  0.0000      0.997 0.000 1.000 0.000
#> SRR925728      1  0.9847     -0.335 0.416 0.268 0.316
#> SRR934636      3  0.0237      0.426 0.004 0.000 0.996
#> SRR934637      3  0.2537      0.369 0.080 0.000 0.920
#> SRR925729      2  0.0237      0.996 0.000 0.996 0.004
#> SRR934638      3  0.6154      0.804 0.408 0.000 0.592
#> SRR934639      1  0.4654      0.347 0.792 0.000 0.208
#> SRR934640      2  0.0424      0.995 0.000 0.992 0.008
#> SRR934641      2  0.0424      0.995 0.000 0.992 0.008
#> SRR925734      3  0.6140      0.808 0.404 0.000 0.596
#> SRR925735      2  0.0000      0.997 0.000 1.000 0.000
#> SRR925736      2  0.0000      0.997 0.000 1.000 0.000
#> SRR925737      2  0.0000      0.997 0.000 1.000 0.000
#> SRR934642      2  0.0237      0.996 0.000 0.996 0.004
#> SRR934643      2  0.0000      0.997 0.000 1.000 0.000
#> SRR934644      2  0.0424      0.995 0.000 0.992 0.008
#> SRR934645      2  0.0424      0.995 0.000 0.992 0.008
#> SRR925740      2  0.0000      0.997 0.000 1.000 0.000
#> SRR925741      2  0.0000      0.997 0.000 1.000 0.000
#> SRR925742      2  0.0000      0.997 0.000 1.000 0.000
#> SRR1283038     2  0.0000      0.997 0.000 1.000 0.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> SRR925687      4  0.0000     0.7123 0.000 0.000 0.000 1.000
#> SRR925688      4  0.0000     0.7123 0.000 0.000 0.000 1.000
#> SRR925689      1  0.3942     0.7623 0.764 0.000 0.000 0.236
#> SRR925690      1  0.3942     0.7623 0.764 0.000 0.000 0.236
#> SRR925691      1  0.3942     0.7623 0.764 0.000 0.000 0.236
#> SRR925692      1  0.3942     0.7623 0.764 0.000 0.000 0.236
#> SRR925693      3  0.0336     0.8625 0.000 0.008 0.992 0.000
#> SRR925694      2  0.3311     0.8728 0.000 0.828 0.172 0.000
#> SRR925695      3  0.1302     0.8514 0.000 0.044 0.956 0.000
#> SRR925697      4  0.6808     0.5262 0.236 0.164 0.000 0.600
#> SRR925696      3  0.0188     0.8609 0.000 0.004 0.996 0.000
#> SRR925698      3  0.0000     0.8622 0.000 0.000 1.000 0.000
#> SRR925699      2  0.4072     0.8467 0.000 0.748 0.252 0.000
#> SRR925700      3  0.5000    -0.5160 0.000 0.500 0.500 0.000
#> SRR925701      2  0.4008     0.8502 0.000 0.756 0.244 0.000
#> SRR925702      4  0.0469     0.7024 0.012 0.000 0.000 0.988
#> SRR925703      4  0.6808     0.5262 0.236 0.164 0.000 0.600
#> SRR925704      3  0.1792     0.8372 0.000 0.068 0.932 0.000
#> SRR925705      3  0.0188     0.8609 0.000 0.004 0.996 0.000
#> SRR925706      4  0.6134     0.0816 0.048 0.000 0.444 0.508
#> SRR925708      4  0.0000     0.7123 0.000 0.000 0.000 1.000
#> SRR925707      3  0.4035     0.6494 0.000 0.020 0.804 0.176
#> SRR925709      1  0.4888     0.7092 0.588 0.000 0.000 0.412
#> SRR925710      4  0.0000     0.7123 0.000 0.000 0.000 1.000
#> SRR925711      3  0.3672     0.6709 0.000 0.012 0.824 0.164
#> SRR934631      2  0.3266     0.8695 0.000 0.832 0.168 0.000
#> SRR934632      2  0.3266     0.8695 0.000 0.832 0.168 0.000
#> SRR934633      2  0.3444     0.8626 0.000 0.816 0.184 0.000
#> SRR925713      4  0.0000     0.7123 0.000 0.000 0.000 1.000
#> SRR925714      4  0.6808     0.5262 0.236 0.164 0.000 0.600
#> SRR925715      4  0.3725     0.4263 0.180 0.000 0.008 0.812
#> SRR925716      4  0.6808     0.5262 0.236 0.164 0.000 0.600
#> SRR925717      4  0.0000     0.7123 0.000 0.000 0.000 1.000
#> SRR925718      2  0.4925     0.6380 0.000 0.572 0.428 0.000
#> SRR925719      4  0.0000     0.7123 0.000 0.000 0.000 1.000
#> SRR925720      4  0.0188     0.7106 0.004 0.000 0.000 0.996
#> SRR925721      4  0.3356     0.5823 0.176 0.000 0.000 0.824
#> SRR934634      4  0.2530     0.6422 0.112 0.000 0.000 0.888
#> SRR934635      1  0.4916     0.5238 0.576 0.000 0.000 0.424
#> SRR925723      3  0.0336     0.8625 0.000 0.008 0.992 0.000
#> SRR925724      3  0.0000     0.8622 0.000 0.000 1.000 0.000
#> SRR925725      3  0.1792     0.8372 0.000 0.068 0.932 0.000
#> SRR925726      4  0.6808     0.5262 0.236 0.164 0.000 0.600
#> SRR925727      3  0.0336     0.8625 0.000 0.008 0.992 0.000
#> SRR925728      1  0.5398     0.7044 0.580 0.000 0.016 0.404
#> SRR934636      1  0.3219     0.4884 0.836 0.164 0.000 0.000
#> SRR934637      1  0.4989     0.4281 0.764 0.164 0.000 0.072
#> SRR925729      3  0.3024     0.7486 0.000 0.148 0.852 0.000
#> SRR934638      1  0.4855     0.7204 0.600 0.000 0.000 0.400
#> SRR934639      4  0.4643     0.2003 0.344 0.000 0.000 0.656
#> SRR934640      2  0.5080     0.6423 0.000 0.576 0.420 0.004
#> SRR934641      2  0.5105     0.6172 0.000 0.564 0.432 0.004
#> SRR925734      1  0.4843     0.7230 0.604 0.000 0.000 0.396
#> SRR925735      3  0.1211     0.8517 0.000 0.040 0.960 0.000
#> SRR925736      3  0.0469     0.8574 0.000 0.012 0.988 0.000
#> SRR925737      3  0.0336     0.8595 0.000 0.008 0.992 0.000
#> SRR934642      3  0.4955    -0.3440 0.000 0.444 0.556 0.000
#> SRR934643      3  0.3311     0.6375 0.000 0.172 0.828 0.000
#> SRR934644      2  0.3311     0.8728 0.000 0.828 0.172 0.000
#> SRR934645      2  0.3311     0.8728 0.000 0.828 0.172 0.000
#> SRR925740      3  0.0000     0.8622 0.000 0.000 1.000 0.000
#> SRR925741      3  0.1792     0.8372 0.000 0.068 0.932 0.000
#> SRR925742      3  0.0336     0.8625 0.000 0.008 0.992 0.000
#> SRR1283038     3  0.2081     0.8258 0.000 0.084 0.916 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
#> SRR925687      4  0.0000    0.72848 0.000 0.000 0.000 1.000 0.000
#> SRR925688      4  0.0000    0.72848 0.000 0.000 0.000 1.000 0.000
#> SRR925689      1  0.0000    0.74466 1.000 0.000 0.000 0.000 0.000
#> SRR925690      1  0.0000    0.74466 1.000 0.000 0.000 0.000 0.000
#> SRR925691      1  0.0000    0.74466 1.000 0.000 0.000 0.000 0.000
#> SRR925692      1  0.0000    0.74466 1.000 0.000 0.000 0.000 0.000
#> SRR925693      3  0.1732    0.79322 0.000 0.080 0.920 0.000 0.000
#> SRR925694      2  0.2424    0.69390 0.000 0.868 0.132 0.000 0.000
#> SRR925695      3  0.2127    0.78462 0.000 0.108 0.892 0.000 0.000
#> SRR925697      5  0.3177    0.75378 0.000 0.000 0.000 0.208 0.792
#> SRR925696      3  0.0162    0.81447 0.000 0.004 0.996 0.000 0.000
#> SRR925698      3  0.0000    0.81579 0.000 0.000 1.000 0.000 0.000
#> SRR925699      2  0.3242    0.68410 0.000 0.784 0.216 0.000 0.000
#> SRR925700      3  0.4297   -0.24070 0.000 0.472 0.528 0.000 0.000
#> SRR925701      2  0.3242    0.68399 0.000 0.784 0.216 0.000 0.000
#> SRR925702      4  0.0162    0.72789 0.004 0.000 0.000 0.996 0.000
#> SRR925703      5  0.4182    0.60353 0.000 0.000 0.000 0.400 0.600
#> SRR925704      3  0.2605    0.76145 0.000 0.148 0.852 0.000 0.000
#> SRR925705      3  0.0162    0.81447 0.000 0.004 0.996 0.000 0.000
#> SRR925706      4  0.4759    0.37046 0.024 0.000 0.336 0.636 0.004
#> SRR925708      4  0.0000    0.72848 0.000 0.000 0.000 1.000 0.000
#> SRR925707      4  0.6155    0.32736 0.000 0.212 0.228 0.560 0.000
#> SRR925709      4  0.4262    0.05977 0.440 0.000 0.000 0.560 0.000
#> SRR925710      4  0.0794    0.71979 0.028 0.000 0.000 0.972 0.000
#> SRR925711      3  0.4757    0.26580 0.000 0.024 0.596 0.380 0.000
#> SRR934631      2  0.3333    0.58989 0.000 0.788 0.004 0.000 0.208
#> SRR934632      2  0.3333    0.58989 0.000 0.788 0.004 0.000 0.208
#> SRR934633      2  0.3333    0.58989 0.000 0.788 0.004 0.000 0.208
#> SRR925713      4  0.0000    0.72848 0.000 0.000 0.000 1.000 0.000
#> SRR925714      5  0.4182    0.60353 0.000 0.000 0.000 0.400 0.600
#> SRR925715      4  0.1043    0.71397 0.040 0.000 0.000 0.960 0.000
#> SRR925716      5  0.3177    0.75378 0.000 0.000 0.000 0.208 0.792
#> SRR925717      4  0.0000    0.72848 0.000 0.000 0.000 1.000 0.000
#> SRR925718      2  0.4242    0.42090 0.000 0.572 0.428 0.000 0.000
#> SRR925719      4  0.0000    0.72848 0.000 0.000 0.000 1.000 0.000
#> SRR925720      4  0.0963    0.70947 0.036 0.000 0.000 0.964 0.000
#> SRR925721      1  0.4262    0.10441 0.560 0.000 0.000 0.440 0.000
#> SRR934634      4  0.4273    0.00722 0.448 0.000 0.000 0.552 0.000
#> SRR934635      1  0.1043    0.72163 0.960 0.000 0.000 0.040 0.000
#> SRR925723      3  0.0000    0.81579 0.000 0.000 1.000 0.000 0.000
#> SRR925724      3  0.0000    0.81579 0.000 0.000 1.000 0.000 0.000
#> SRR925725      3  0.3109    0.71903 0.000 0.200 0.800 0.000 0.000
#> SRR925726      4  0.4101   -0.10009 0.000 0.000 0.000 0.628 0.372
#> SRR925727      3  0.0404    0.81436 0.000 0.012 0.988 0.000 0.000
#> SRR925728      4  0.6197    0.23023 0.272 0.164 0.004 0.560 0.000
#> SRR934636      5  0.3953    0.58448 0.060 0.148 0.000 0.000 0.792
#> SRR934637      5  0.3300    0.54401 0.204 0.000 0.000 0.004 0.792
#> SRR925729      3  0.2732    0.71621 0.000 0.160 0.840 0.000 0.000
#> SRR934638      1  0.4126    0.33303 0.620 0.000 0.000 0.380 0.000
#> SRR934639      4  0.4088    0.32636 0.368 0.000 0.000 0.632 0.000
#> SRR934640      2  0.4567    0.36171 0.000 0.544 0.448 0.004 0.004
#> SRR934641      2  0.4580    0.33108 0.000 0.532 0.460 0.004 0.004
#> SRR925734      1  0.4060    0.37727 0.640 0.000 0.000 0.360 0.000
#> SRR925735      3  0.2921    0.77010 0.000 0.124 0.856 0.020 0.000
#> SRR925736      3  0.0162    0.81447 0.000 0.004 0.996 0.000 0.000
#> SRR925737      3  0.0162    0.81447 0.000 0.004 0.996 0.000 0.000
#> SRR934642      3  0.4262   -0.13657 0.000 0.440 0.560 0.000 0.000
#> SRR934643      3  0.3395    0.50731 0.000 0.236 0.764 0.000 0.000
#> SRR934644      2  0.4010    0.60808 0.000 0.760 0.032 0.000 0.208
#> SRR934645      2  0.2424    0.69390 0.000 0.868 0.132 0.000 0.000
#> SRR925740      3  0.0000    0.81579 0.000 0.000 1.000 0.000 0.000
#> SRR925741      3  0.3109    0.71903 0.000 0.200 0.800 0.000 0.000
#> SRR925742      3  0.0000    0.81579 0.000 0.000 1.000 0.000 0.000
#> SRR1283038     3  0.3210    0.71078 0.000 0.212 0.788 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
#> SRR925687      4  0.3094     0.6256 0.000 0.036 0.000 0.824 0.000 0.140
#> SRR925688      4  0.3094     0.6256 0.000 0.036 0.000 0.824 0.000 0.140
#> SRR925689      1  0.0000     0.7852 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR925690      1  0.0000     0.7852 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR925691      1  0.0000     0.7852 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR925692      1  0.0000     0.7852 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR925693      3  0.2593     0.7637 0.000 0.148 0.844 0.000 0.000 0.008
#> SRR925694      2  0.4732     0.6378 0.000 0.680 0.148 0.000 0.000 0.172
#> SRR925695      3  0.0790     0.8488 0.000 0.000 0.968 0.000 0.000 0.032
#> SRR925697      5  0.2454     0.7176 0.000 0.000 0.000 0.160 0.840 0.000
#> SRR925696      3  0.0000     0.8570 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR925698      3  0.0000     0.8570 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR925699      2  0.4721     0.6988 0.000 0.672 0.212 0.000 0.000 0.116
#> SRR925700      2  0.4366     0.6880 0.000 0.548 0.428 0.000 0.000 0.024
#> SRR925701      2  0.4681     0.7009 0.000 0.676 0.212 0.000 0.000 0.112
#> SRR925702      4  0.0000     0.6845 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR925703      5  0.3756     0.4898 0.000 0.000 0.000 0.400 0.600 0.000
#> SRR925704      3  0.1471     0.8300 0.000 0.004 0.932 0.000 0.000 0.064
#> SRR925705      3  0.0000     0.8570 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR925706      4  0.4180     0.2963 0.024 0.000 0.348 0.628 0.000 0.000
#> SRR925708      4  0.0000     0.6845 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR925707      4  0.4423     0.1877 0.000 0.420 0.028 0.552 0.000 0.000
#> SRR925709      4  0.3838    -0.1060 0.448 0.000 0.000 0.552 0.000 0.000
#> SRR925710      4  0.0632     0.6775 0.024 0.000 0.000 0.976 0.000 0.000
#> SRR925711      3  0.5007     0.5244 0.000 0.144 0.656 0.196 0.000 0.004
#> SRR934631      6  0.2260     0.9927 0.000 0.140 0.000 0.000 0.000 0.860
#> SRR934632      6  0.2260     0.9927 0.000 0.140 0.000 0.000 0.000 0.860
#> SRR934633      6  0.2260     0.9927 0.000 0.140 0.000 0.000 0.000 0.860
#> SRR925713      4  0.0000     0.6845 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR925714      5  0.3756     0.4898 0.000 0.000 0.000 0.400 0.600 0.000
#> SRR925715      4  0.1245     0.6699 0.016 0.032 0.000 0.952 0.000 0.000
#> SRR925716      5  0.0000     0.7190 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR925717      4  0.0000     0.6845 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR925718      2  0.4868     0.6983 0.000 0.524 0.416 0.000 0.000 0.060
#> SRR925719      4  0.0000     0.6845 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR925720      4  0.3094     0.6256 0.000 0.036 0.000 0.824 0.000 0.140
#> SRR925721      4  0.6264     0.1587 0.376 0.036 0.000 0.448 0.000 0.140
#> SRR934634      4  0.6056     0.3240 0.284 0.036 0.000 0.540 0.000 0.140
#> SRR934635      1  0.4116     0.6564 0.776 0.036 0.000 0.048 0.000 0.140
#> SRR925723      3  0.0000     0.8570 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR925724      3  0.0000     0.8570 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR925725      3  0.2793     0.7429 0.000 0.000 0.800 0.000 0.000 0.200
#> SRR925726      4  0.5496     0.2671 0.000 0.016 0.000 0.608 0.236 0.140
#> SRR925727      3  0.0146     0.8566 0.000 0.000 0.996 0.000 0.000 0.004
#> SRR925728      4  0.5654     0.1975 0.188 0.256 0.004 0.552 0.000 0.000
#> SRR934636      5  0.0000     0.7190 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR934637      5  0.0000     0.7190 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR925729      3  0.4904     0.0253 0.000 0.316 0.600 0.000 0.000 0.084
#> SRR934638      1  0.3756     0.3904 0.600 0.000 0.000 0.400 0.000 0.000
#> SRR934639      4  0.4650     0.4600 0.292 0.016 0.000 0.652 0.000 0.040
#> SRR934640      2  0.2191     0.5987 0.000 0.876 0.120 0.000 0.000 0.004
#> SRR934641      2  0.2234     0.6013 0.000 0.872 0.124 0.000 0.000 0.004
#> SRR925734      1  0.3717     0.4224 0.616 0.000 0.000 0.384 0.000 0.000
#> SRR925735      3  0.4673     0.6547 0.000 0.196 0.712 0.064 0.000 0.028
#> SRR925736      3  0.0458     0.8465 0.000 0.016 0.984 0.000 0.000 0.000
#> SRR925737      3  0.0363     0.8496 0.000 0.012 0.988 0.000 0.000 0.000
#> SRR934642      2  0.4157     0.6693 0.000 0.544 0.444 0.000 0.000 0.012
#> SRR934643      2  0.4067     0.6660 0.000 0.548 0.444 0.000 0.000 0.008
#> SRR934644      6  0.2593     0.9777 0.000 0.148 0.008 0.000 0.000 0.844
#> SRR934645      2  0.4728     0.6323 0.000 0.680 0.144 0.000 0.000 0.176
#> SRR925740      3  0.0000     0.8570 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR925741      3  0.2902     0.7443 0.000 0.004 0.800 0.000 0.000 0.196
#> SRR925742      3  0.0000     0.8570 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1283038     3  0.2933     0.7404 0.000 0.004 0.796 0.000 0.000 0.200

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 15949 rows and 64 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.991       0.993         0.5049 0.494   0.494
#> 3 3 0.784           0.924       0.931         0.1868 0.920   0.838
#> 4 4 0.825           0.953       0.939         0.1951 0.861   0.665
#> 5 5 0.855           0.795       0.876         0.0867 0.887   0.623
#> 6 6 0.811           0.767       0.810         0.0475 0.935   0.709

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
#> SRR925687      1  0.0376      0.994 0.996 0.004
#> SRR925688      1  0.0376      0.994 0.996 0.004
#> SRR925689      1  0.0376      0.994 0.996 0.004
#> SRR925690      1  0.0376      0.994 0.996 0.004
#> SRR925691      1  0.0376      0.994 0.996 0.004
#> SRR925692      1  0.0376      0.994 0.996 0.004
#> SRR925693      2  0.0376      0.996 0.004 0.996
#> SRR925694      2  0.0000      0.994 0.000 1.000
#> SRR925695      2  0.0376      0.996 0.004 0.996
#> SRR925697      1  0.0376      0.991 0.996 0.004
#> SRR925696      2  0.0376      0.996 0.004 0.996
#> SRR925698      2  0.0376      0.996 0.004 0.996
#> SRR925699      2  0.0000      0.994 0.000 1.000
#> SRR925700      2  0.0000      0.994 0.000 1.000
#> SRR925701      2  0.0000      0.994 0.000 1.000
#> SRR925702      1  0.0376      0.994 0.996 0.004
#> SRR925703      1  0.0376      0.991 0.996 0.004
#> SRR925704      2  0.0376      0.996 0.004 0.996
#> SRR925705      2  0.0376      0.996 0.004 0.996
#> SRR925706      1  0.0672      0.992 0.992 0.008
#> SRR925708      1  0.0376      0.994 0.996 0.004
#> SRR925707      2  0.4298      0.908 0.088 0.912
#> SRR925709      1  0.0376      0.994 0.996 0.004
#> SRR925710      1  0.2948      0.949 0.948 0.052
#> SRR925711      2  0.0376      0.996 0.004 0.996
#> SRR934631      2  0.0000      0.994 0.000 1.000
#> SRR934632      2  0.0000      0.994 0.000 1.000
#> SRR934633      2  0.0376      0.996 0.004 0.996
#> SRR925713      1  0.0376      0.994 0.996 0.004
#> SRR925714      1  0.0376      0.991 0.996 0.004
#> SRR925715      1  0.3733      0.928 0.928 0.072
#> SRR925716      1  0.0376      0.991 0.996 0.004
#> SRR925717      1  0.0376      0.994 0.996 0.004
#> SRR925718      2  0.0000      0.994 0.000 1.000
#> SRR925719      1  0.0376      0.994 0.996 0.004
#> SRR925720      1  0.0376      0.994 0.996 0.004
#> SRR925721      1  0.0376      0.994 0.996 0.004
#> SRR934634      1  0.0376      0.994 0.996 0.004
#> SRR934635      1  0.0376      0.994 0.996 0.004
#> SRR925723      2  0.0376      0.996 0.004 0.996
#> SRR925724      2  0.0376      0.996 0.004 0.996
#> SRR925725      2  0.0376      0.996 0.004 0.996
#> SRR925726      1  0.0376      0.991 0.996 0.004
#> SRR925727      2  0.0376      0.996 0.004 0.996
#> SRR925728      1  0.0376      0.994 0.996 0.004
#> SRR934636      1  0.0376      0.991 0.996 0.004
#> SRR934637      1  0.0376      0.991 0.996 0.004
#> SRR925729      2  0.0376      0.996 0.004 0.996
#> SRR934638      1  0.0376      0.994 0.996 0.004
#> SRR934639      1  0.0376      0.994 0.996 0.004
#> SRR934640      2  0.0672      0.989 0.008 0.992
#> SRR934641      2  0.0672      0.989 0.008 0.992
#> SRR925734      1  0.0376      0.994 0.996 0.004
#> SRR925735      2  0.0376      0.996 0.004 0.996
#> SRR925736      2  0.0376      0.996 0.004 0.996
#> SRR925737      2  0.0376      0.996 0.004 0.996
#> SRR934642      2  0.0000      0.994 0.000 1.000
#> SRR934643      2  0.0000      0.994 0.000 1.000
#> SRR934644      2  0.0000      0.994 0.000 1.000
#> SRR934645      2  0.0000      0.994 0.000 1.000
#> SRR925740      2  0.0376      0.996 0.004 0.996
#> SRR925741      2  0.0376      0.996 0.004 0.996
#> SRR925742      2  0.0376      0.996 0.004 0.996
#> SRR1283038     2  0.0376      0.996 0.004 0.996

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>            class entropy silhouette    p1    p2    p3
#> SRR925687      1  0.0000      0.982 1.000 0.000 0.000
#> SRR925688      1  0.0000      0.982 1.000 0.000 0.000
#> SRR925689      1  0.2537      0.907 0.920 0.000 0.080
#> SRR925690      1  0.2537      0.907 0.920 0.000 0.080
#> SRR925691      1  0.2537      0.907 0.920 0.000 0.080
#> SRR925692      1  0.2537      0.907 0.920 0.000 0.080
#> SRR925693      2  0.1289      0.896 0.032 0.968 0.000
#> SRR925694      2  0.4121      0.880 0.000 0.832 0.168
#> SRR925695      2  0.0000      0.914 0.000 1.000 0.000
#> SRR925697      3  0.4121      1.000 0.168 0.000 0.832
#> SRR925696      2  0.0000      0.914 0.000 1.000 0.000
#> SRR925698      2  0.0000      0.914 0.000 1.000 0.000
#> SRR925699      2  0.4121      0.880 0.000 0.832 0.168
#> SRR925700      2  0.4121      0.880 0.000 0.832 0.168
#> SRR925701      2  0.4121      0.880 0.000 0.832 0.168
#> SRR925702      1  0.0000      0.982 1.000 0.000 0.000
#> SRR925703      3  0.4121      1.000 0.168 0.000 0.832
#> SRR925704      2  0.0000      0.914 0.000 1.000 0.000
#> SRR925705      2  0.0000      0.914 0.000 1.000 0.000
#> SRR925706      1  0.0000      0.982 1.000 0.000 0.000
#> SRR925708      1  0.0000      0.982 1.000 0.000 0.000
#> SRR925707      2  0.5988      0.467 0.368 0.632 0.000
#> SRR925709      1  0.0000      0.982 1.000 0.000 0.000
#> SRR925710      1  0.0000      0.982 1.000 0.000 0.000
#> SRR925711      2  0.4504      0.722 0.196 0.804 0.000
#> SRR934631      2  0.4121      0.880 0.000 0.832 0.168
#> SRR934632      2  0.4121      0.880 0.000 0.832 0.168
#> SRR934633      2  0.0424      0.913 0.000 0.992 0.008
#> SRR925713      1  0.0000      0.982 1.000 0.000 0.000
#> SRR925714      3  0.4121      1.000 0.168 0.000 0.832
#> SRR925715      1  0.0000      0.982 1.000 0.000 0.000
#> SRR925716      3  0.4121      1.000 0.168 0.000 0.832
#> SRR925717      1  0.0000      0.982 1.000 0.000 0.000
#> SRR925718      2  0.4121      0.880 0.000 0.832 0.168
#> SRR925719      1  0.0000      0.982 1.000 0.000 0.000
#> SRR925720      1  0.0000      0.982 1.000 0.000 0.000
#> SRR925721      1  0.0000      0.982 1.000 0.000 0.000
#> SRR934634      1  0.0000      0.982 1.000 0.000 0.000
#> SRR934635      1  0.0000      0.982 1.000 0.000 0.000
#> SRR925723      2  0.0000      0.914 0.000 1.000 0.000
#> SRR925724      2  0.0000      0.914 0.000 1.000 0.000
#> SRR925725      2  0.0000      0.914 0.000 1.000 0.000
#> SRR925726      3  0.4121      1.000 0.168 0.000 0.832
#> SRR925727      2  0.0000      0.914 0.000 1.000 0.000
#> SRR925728      1  0.0000      0.982 1.000 0.000 0.000
#> SRR934636      3  0.4121      1.000 0.168 0.000 0.832
#> SRR934637      3  0.4121      1.000 0.168 0.000 0.832
#> SRR925729      2  0.0000      0.914 0.000 1.000 0.000
#> SRR934638      1  0.0000      0.982 1.000 0.000 0.000
#> SRR934639      1  0.0000      0.982 1.000 0.000 0.000
#> SRR934640      2  0.5000      0.876 0.044 0.832 0.124
#> SRR934641      2  0.5000      0.876 0.044 0.832 0.124
#> SRR925734      1  0.0237      0.979 0.996 0.000 0.004
#> SRR925735      2  0.3619      0.801 0.136 0.864 0.000
#> SRR925736      2  0.0000      0.914 0.000 1.000 0.000
#> SRR925737      2  0.0000      0.914 0.000 1.000 0.000
#> SRR934642      2  0.4121      0.880 0.000 0.832 0.168
#> SRR934643      2  0.4121      0.880 0.000 0.832 0.168
#> SRR934644      2  0.4121      0.880 0.000 0.832 0.168
#> SRR934645      2  0.4121      0.880 0.000 0.832 0.168
#> SRR925740      2  0.0000      0.914 0.000 1.000 0.000
#> SRR925741      2  0.0000      0.914 0.000 1.000 0.000
#> SRR925742      2  0.0000      0.914 0.000 1.000 0.000
#> SRR1283038     2  0.0000      0.914 0.000 1.000 0.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3 p4
#> SRR925687      1  0.0000      0.957 1.000 0.000 0.000  0
#> SRR925688      1  0.0817      0.953 0.976 0.024 0.000  0
#> SRR925689      1  0.0336      0.954 0.992 0.008 0.000  0
#> SRR925690      1  0.0336      0.954 0.992 0.008 0.000  0
#> SRR925691      1  0.0336      0.954 0.992 0.008 0.000  0
#> SRR925692      1  0.0336      0.954 0.992 0.008 0.000  0
#> SRR925693      3  0.0657      0.963 0.004 0.012 0.984  0
#> SRR925694      2  0.3024      0.961 0.000 0.852 0.148  0
#> SRR925695      3  0.0000      0.977 0.000 0.000 1.000  0
#> SRR925697      4  0.0000      1.000 0.000 0.000 0.000  1
#> SRR925696      3  0.0000      0.977 0.000 0.000 1.000  0
#> SRR925698      3  0.0000      0.977 0.000 0.000 1.000  0
#> SRR925699      2  0.3024      0.961 0.000 0.852 0.148  0
#> SRR925700      2  0.3074      0.960 0.000 0.848 0.152  0
#> SRR925701      2  0.3024      0.961 0.000 0.852 0.148  0
#> SRR925702      1  0.2814      0.913 0.868 0.132 0.000  0
#> SRR925703      4  0.0000      1.000 0.000 0.000 0.000  1
#> SRR925704      3  0.0000      0.977 0.000 0.000 1.000  0
#> SRR925705      3  0.0000      0.977 0.000 0.000 1.000  0
#> SRR925706      1  0.2814      0.913 0.868 0.132 0.000  0
#> SRR925708      1  0.0469      0.955 0.988 0.012 0.000  0
#> SRR925707      3  0.3384      0.838 0.024 0.116 0.860  0
#> SRR925709      1  0.1557      0.943 0.944 0.056 0.000  0
#> SRR925710      1  0.2814      0.913 0.868 0.132 0.000  0
#> SRR925711      3  0.2742      0.883 0.024 0.076 0.900  0
#> SRR934631      2  0.2921      0.958 0.000 0.860 0.140  0
#> SRR934632      2  0.2921      0.958 0.000 0.860 0.140  0
#> SRR934633      2  0.3726      0.906 0.000 0.788 0.212  0
#> SRR925713      1  0.2814      0.913 0.868 0.132 0.000  0
#> SRR925714      4  0.0000      1.000 0.000 0.000 0.000  1
#> SRR925715      1  0.2814      0.913 0.868 0.132 0.000  0
#> SRR925716      4  0.0000      1.000 0.000 0.000 0.000  1
#> SRR925717      1  0.2814      0.913 0.868 0.132 0.000  0
#> SRR925718      2  0.3074      0.960 0.000 0.848 0.152  0
#> SRR925719      1  0.0336      0.956 0.992 0.008 0.000  0
#> SRR925720      1  0.0000      0.957 1.000 0.000 0.000  0
#> SRR925721      1  0.0000      0.957 1.000 0.000 0.000  0
#> SRR934634      1  0.0000      0.957 1.000 0.000 0.000  0
#> SRR934635      1  0.0000      0.957 1.000 0.000 0.000  0
#> SRR925723      3  0.0000      0.977 0.000 0.000 1.000  0
#> SRR925724      3  0.0000      0.977 0.000 0.000 1.000  0
#> SRR925725      3  0.0000      0.977 0.000 0.000 1.000  0
#> SRR925726      4  0.0000      1.000 0.000 0.000 0.000  1
#> SRR925727      3  0.0000      0.977 0.000 0.000 1.000  0
#> SRR925728      1  0.2814      0.913 0.868 0.132 0.000  0
#> SRR934636      4  0.0000      1.000 0.000 0.000 0.000  1
#> SRR934637      4  0.0000      1.000 0.000 0.000 0.000  1
#> SRR925729      3  0.0000      0.977 0.000 0.000 1.000  0
#> SRR934638      1  0.0000      0.957 1.000 0.000 0.000  0
#> SRR934639      1  0.0000      0.957 1.000 0.000 0.000  0
#> SRR934640      2  0.4004      0.820 0.024 0.812 0.164  0
#> SRR934641      2  0.4004      0.820 0.024 0.812 0.164  0
#> SRR925734      1  0.0000      0.957 1.000 0.000 0.000  0
#> SRR925735      3  0.2522      0.890 0.016 0.076 0.908  0
#> SRR925736      3  0.0000      0.977 0.000 0.000 1.000  0
#> SRR925737      3  0.0000      0.977 0.000 0.000 1.000  0
#> SRR934642      2  0.2921      0.958 0.000 0.860 0.140  0
#> SRR934643      2  0.2921      0.958 0.000 0.860 0.140  0
#> SRR934644      2  0.3024      0.961 0.000 0.852 0.148  0
#> SRR934645      2  0.3024      0.961 0.000 0.852 0.148  0
#> SRR925740      3  0.0000      0.977 0.000 0.000 1.000  0
#> SRR925741      3  0.0000      0.977 0.000 0.000 1.000  0
#> SRR925742      3  0.0000      0.977 0.000 0.000 1.000  0
#> SRR1283038     3  0.0000      0.977 0.000 0.000 1.000  0

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>            class entropy silhouette    p1    p2    p3    p4    p5
#> SRR925687      1  0.4088      0.739 0.632 0.000 0.000 0.368 0.000
#> SRR925688      1  0.4182      0.706 0.600 0.000 0.000 0.400 0.000
#> SRR925689      1  0.0290      0.684 0.992 0.008 0.000 0.000 0.000
#> SRR925690      1  0.0290      0.684 0.992 0.008 0.000 0.000 0.000
#> SRR925691      1  0.0290      0.684 0.992 0.008 0.000 0.000 0.000
#> SRR925692      1  0.0290      0.684 0.992 0.008 0.000 0.000 0.000
#> SRR925693      3  0.2951      0.829 0.000 0.028 0.860 0.112 0.000
#> SRR925694      2  0.1043      0.857 0.000 0.960 0.040 0.000 0.000
#> SRR925695      3  0.0000      0.935 0.000 0.000 1.000 0.000 0.000
#> SRR925697      5  0.0000      1.000 0.000 0.000 0.000 0.000 1.000
#> SRR925696      3  0.0794      0.927 0.000 0.028 0.972 0.000 0.000
#> SRR925698      3  0.0000      0.935 0.000 0.000 1.000 0.000 0.000
#> SRR925699      2  0.1043      0.857 0.000 0.960 0.040 0.000 0.000
#> SRR925700      2  0.1205      0.856 0.000 0.956 0.040 0.004 0.000
#> SRR925701      2  0.1043      0.857 0.000 0.960 0.040 0.000 0.000
#> SRR925702      4  0.2046      0.806 0.068 0.000 0.000 0.916 0.016
#> SRR925703      5  0.0000      1.000 0.000 0.000 0.000 0.000 1.000
#> SRR925704      3  0.0162      0.935 0.000 0.004 0.996 0.000 0.000
#> SRR925705      3  0.0000      0.935 0.000 0.000 1.000 0.000 0.000
#> SRR925706      4  0.1549      0.836 0.040 0.000 0.000 0.944 0.016
#> SRR925708      1  0.4161      0.716 0.608 0.000 0.000 0.392 0.000
#> SRR925707      4  0.7037     -0.125 0.000 0.244 0.360 0.384 0.012
#> SRR925709      1  0.4294      0.593 0.532 0.000 0.000 0.468 0.000
#> SRR925710      4  0.1469      0.834 0.036 0.000 0.000 0.948 0.016
#> SRR925711      2  0.6074      0.325 0.000 0.500 0.372 0.128 0.000
#> SRR934631      2  0.0703      0.851 0.000 0.976 0.024 0.000 0.000
#> SRR934632      2  0.0703      0.851 0.000 0.976 0.024 0.000 0.000
#> SRR934633      3  0.3730      0.575 0.000 0.288 0.712 0.000 0.000
#> SRR925713      4  0.1549      0.836 0.040 0.000 0.000 0.944 0.016
#> SRR925714      5  0.0000      1.000 0.000 0.000 0.000 0.000 1.000
#> SRR925715      4  0.1469      0.834 0.036 0.000 0.000 0.948 0.016
#> SRR925716      5  0.0000      1.000 0.000 0.000 0.000 0.000 1.000
#> SRR925717      4  0.2464      0.760 0.096 0.000 0.000 0.888 0.016
#> SRR925718      2  0.1341      0.850 0.000 0.944 0.056 0.000 0.000
#> SRR925719      1  0.4101      0.736 0.628 0.000 0.000 0.372 0.000
#> SRR925720      1  0.4074      0.741 0.636 0.000 0.000 0.364 0.000
#> SRR925721      1  0.4074      0.741 0.636 0.000 0.000 0.364 0.000
#> SRR934634      1  0.3242      0.733 0.784 0.000 0.000 0.216 0.000
#> SRR934635      1  0.4508      0.736 0.648 0.000 0.000 0.332 0.020
#> SRR925723      3  0.0000      0.935 0.000 0.000 1.000 0.000 0.000
#> SRR925724      3  0.0000      0.935 0.000 0.000 1.000 0.000 0.000
#> SRR925725      3  0.0898      0.928 0.000 0.020 0.972 0.008 0.000
#> SRR925726      5  0.0000      1.000 0.000 0.000 0.000 0.000 1.000
#> SRR925727      3  0.0290      0.934 0.000 0.008 0.992 0.000 0.000
#> SRR925728      4  0.1549      0.836 0.040 0.000 0.000 0.944 0.016
#> SRR934636      5  0.0000      1.000 0.000 0.000 0.000 0.000 1.000
#> SRR934637      5  0.0000      1.000 0.000 0.000 0.000 0.000 1.000
#> SRR925729      3  0.3895      0.422 0.000 0.320 0.680 0.000 0.000
#> SRR934638      1  0.0703      0.697 0.976 0.000 0.000 0.024 0.000
#> SRR934639      1  0.4074      0.741 0.636 0.000 0.000 0.364 0.000
#> SRR934640      2  0.5635      0.571 0.000 0.620 0.252 0.128 0.000
#> SRR934641      2  0.5635      0.571 0.000 0.620 0.252 0.128 0.000
#> SRR925734      1  0.0703      0.697 0.976 0.000 0.000 0.024 0.000
#> SRR925735      2  0.6047      0.319 0.000 0.500 0.376 0.124 0.000
#> SRR925736      3  0.0290      0.934 0.000 0.008 0.992 0.000 0.000
#> SRR925737      3  0.1732      0.876 0.000 0.080 0.920 0.000 0.000
#> SRR934642      2  0.0703      0.851 0.000 0.976 0.024 0.000 0.000
#> SRR934643      2  0.0703      0.851 0.000 0.976 0.024 0.000 0.000
#> SRR934644      2  0.1043      0.857 0.000 0.960 0.040 0.000 0.000
#> SRR934645      2  0.1043      0.857 0.000 0.960 0.040 0.000 0.000
#> SRR925740      3  0.1121      0.917 0.000 0.044 0.956 0.000 0.000
#> SRR925741      3  0.0000      0.935 0.000 0.000 1.000 0.000 0.000
#> SRR925742      3  0.0609      0.928 0.000 0.020 0.980 0.000 0.000
#> SRR1283038     3  0.0000      0.935 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
#> SRR925687      6  0.0146     0.8218 0.004 0.000 0.000 0.000 0.000 0.996
#> SRR925688      6  0.1663     0.7664 0.000 0.000 0.000 0.088 0.000 0.912
#> SRR925689      1  0.3076     0.8447 0.760 0.000 0.000 0.000 0.000 0.240
#> SRR925690      1  0.3076     0.8447 0.760 0.000 0.000 0.000 0.000 0.240
#> SRR925691      1  0.3076     0.8447 0.760 0.000 0.000 0.000 0.000 0.240
#> SRR925692      1  0.3076     0.8447 0.760 0.000 0.000 0.000 0.000 0.240
#> SRR925693      4  0.4097    -0.3865 0.008 0.000 0.488 0.504 0.000 0.000
#> SRR925694      2  0.0000     0.9340 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR925695      3  0.2697     0.8160 0.000 0.000 0.812 0.188 0.000 0.000
#> SRR925697      5  0.0000     0.9841 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR925696      3  0.0508     0.9017 0.000 0.012 0.984 0.004 0.000 0.000
#> SRR925698      3  0.0547     0.9019 0.000 0.000 0.980 0.020 0.000 0.000
#> SRR925699      2  0.0000     0.9340 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR925700      2  0.0260     0.9283 0.000 0.992 0.008 0.000 0.000 0.000
#> SRR925701      2  0.0000     0.9340 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR925702      4  0.5531     0.5107 0.000 0.000 0.000 0.528 0.156 0.316
#> SRR925703      5  0.0000     0.9841 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR925704      3  0.0692     0.9020 0.000 0.004 0.976 0.020 0.000 0.000
#> SRR925705      3  0.0000     0.9022 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR925706      4  0.5186     0.6030 0.000 0.000 0.000 0.612 0.156 0.232
#> SRR925708      6  0.0000     0.8220 0.000 0.000 0.000 0.000 0.000 1.000
#> SRR925707      4  0.7032     0.4197 0.240 0.008 0.080 0.492 0.176 0.004
#> SRR925709      6  0.3050     0.5880 0.000 0.000 0.000 0.236 0.000 0.764
#> SRR925710      4  0.5880     0.6067 0.040 0.000 0.000 0.596 0.156 0.208
#> SRR925711      4  0.7208     0.3799 0.240 0.036 0.232 0.456 0.032 0.004
#> SRR934631      2  0.0000     0.9340 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR934632      2  0.0000     0.9340 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR934633      3  0.4948     0.3752 0.000 0.360 0.564 0.076 0.000 0.000
#> SRR925713      4  0.5269     0.5941 0.000 0.000 0.000 0.596 0.156 0.248
#> SRR925714      5  0.0000     0.9841 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR925715      4  0.5880     0.6067 0.040 0.000 0.000 0.596 0.156 0.208
#> SRR925716      5  0.0790     0.9789 0.000 0.000 0.000 0.032 0.968 0.000
#> SRR925717      4  0.5543     0.5016 0.000 0.000 0.000 0.524 0.156 0.320
#> SRR925718      2  0.0458     0.9221 0.000 0.984 0.016 0.000 0.000 0.000
#> SRR925719      6  0.0000     0.8220 0.000 0.000 0.000 0.000 0.000 1.000
#> SRR925720      6  0.0146     0.8218 0.004 0.000 0.000 0.000 0.000 0.996
#> SRR925721      6  0.1765     0.7131 0.096 0.000 0.000 0.000 0.000 0.904
#> SRR934634      1  0.4083     0.6241 0.532 0.000 0.000 0.008 0.000 0.460
#> SRR934635      6  0.6539     0.0773 0.204 0.000 0.000 0.052 0.248 0.496
#> SRR925723      3  0.0000     0.9022 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR925724      3  0.0547     0.9019 0.000 0.000 0.980 0.020 0.000 0.000
#> SRR925725      3  0.3586     0.7546 0.000 0.012 0.720 0.268 0.000 0.000
#> SRR925726      5  0.0000     0.9841 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR925727      3  0.2994     0.8073 0.000 0.004 0.788 0.208 0.000 0.000
#> SRR925728      4  0.5324     0.5962 0.000 0.000 0.000 0.592 0.172 0.236
#> SRR934636      5  0.1007     0.9752 0.000 0.000 0.000 0.044 0.956 0.000
#> SRR934637      5  0.1007     0.9752 0.000 0.000 0.000 0.044 0.956 0.000
#> SRR925729      3  0.2114     0.8716 0.008 0.012 0.904 0.076 0.000 0.000
#> SRR934638      1  0.3782     0.7477 0.588 0.000 0.000 0.000 0.000 0.412
#> SRR934639      6  0.0692     0.8090 0.020 0.000 0.000 0.004 0.000 0.976
#> SRR934640      2  0.4424     0.5204 0.024 0.628 0.004 0.340 0.000 0.004
#> SRR934641      2  0.4424     0.5204 0.024 0.628 0.004 0.340 0.000 0.004
#> SRR925734      1  0.3782     0.7477 0.588 0.000 0.000 0.000 0.000 0.412
#> SRR925735      4  0.7542     0.3927 0.240 0.032 0.208 0.444 0.072 0.004
#> SRR925736      3  0.0405     0.9024 0.000 0.004 0.988 0.008 0.000 0.000
#> SRR925737      3  0.1296     0.8886 0.032 0.004 0.952 0.012 0.000 0.000
#> SRR934642      2  0.0000     0.9340 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR934643      2  0.0000     0.9340 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR934644      2  0.0000     0.9340 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR934645      2  0.0000     0.9340 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR925740      3  0.0935     0.8925 0.000 0.032 0.964 0.004 0.000 0.000
#> SRR925741      3  0.2902     0.8153 0.000 0.004 0.800 0.196 0.000 0.000
#> SRR925742      3  0.0146     0.9024 0.000 0.004 0.996 0.000 0.000 0.000
#> SRR1283038     3  0.0000     0.9022 0.000 0.000 1.000 0.000 0.000 0.000

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

consensus_heatmap(res, k = 2)

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

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

collect_plots(res)

plot of chunk SD-NMF-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 1.000           1.000       1.000         0.5065 0.494   0.494
#> 3 3 0.727           0.711       0.882         0.2454 0.837   0.681
#> 4 4 0.668           0.724       0.839         0.1182 0.867   0.665
#> 5 5 0.679           0.601       0.725         0.0998 0.801   0.439
#> 6 6 0.723           0.681       0.803         0.0560 0.939   0.729

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
#> SRR925687      1  0.0000      1.000 1.000 0.000
#> SRR925688      1  0.0000      1.000 1.000 0.000
#> SRR925689      1  0.0000      1.000 1.000 0.000
#> SRR925690      1  0.0000      1.000 1.000 0.000
#> SRR925691      1  0.0000      1.000 1.000 0.000
#> SRR925692      1  0.0000      1.000 1.000 0.000
#> SRR925693      2  0.0672      0.992 0.008 0.992
#> SRR925694      2  0.0000      1.000 0.000 1.000
#> SRR925695      2  0.0000      1.000 0.000 1.000
#> SRR925697      1  0.0000      1.000 1.000 0.000
#> SRR925696      2  0.0000      1.000 0.000 1.000
#> SRR925698      2  0.0000      1.000 0.000 1.000
#> SRR925699      2  0.0000      1.000 0.000 1.000
#> SRR925700      2  0.0000      1.000 0.000 1.000
#> SRR925701      2  0.0000      1.000 0.000 1.000
#> SRR925702      1  0.0000      1.000 1.000 0.000
#> SRR925703      1  0.0000      1.000 1.000 0.000
#> SRR925704      2  0.0000      1.000 0.000 1.000
#> SRR925705      2  0.0000      1.000 0.000 1.000
#> SRR925706      1  0.0000      1.000 1.000 0.000
#> SRR925708      1  0.0000      1.000 1.000 0.000
#> SRR925707      2  0.0000      1.000 0.000 1.000
#> SRR925709      1  0.0000      1.000 1.000 0.000
#> SRR925710      1  0.0000      1.000 1.000 0.000
#> SRR925711      2  0.0376      0.996 0.004 0.996
#> SRR934631      2  0.0000      1.000 0.000 1.000
#> SRR934632      2  0.0000      1.000 0.000 1.000
#> SRR934633      2  0.0000      1.000 0.000 1.000
#> SRR925713      1  0.0000      1.000 1.000 0.000
#> SRR925714      1  0.0000      1.000 1.000 0.000
#> SRR925715      1  0.0000      1.000 1.000 0.000
#> SRR925716      1  0.0000      1.000 1.000 0.000
#> SRR925717      1  0.0000      1.000 1.000 0.000
#> SRR925718      2  0.0000      1.000 0.000 1.000
#> SRR925719      1  0.0000      1.000 1.000 0.000
#> SRR925720      1  0.0000      1.000 1.000 0.000
#> SRR925721      1  0.0000      1.000 1.000 0.000
#> SRR934634      1  0.0000      1.000 1.000 0.000
#> SRR934635      1  0.0000      1.000 1.000 0.000
#> SRR925723      2  0.0000      1.000 0.000 1.000
#> SRR925724      2  0.0000      1.000 0.000 1.000
#> SRR925725      2  0.0000      1.000 0.000 1.000
#> SRR925726      1  0.0000      1.000 1.000 0.000
#> SRR925727      2  0.0000      1.000 0.000 1.000
#> SRR925728      1  0.0000      1.000 1.000 0.000
#> SRR934636      1  0.0000      1.000 1.000 0.000
#> SRR934637      1  0.0000      1.000 1.000 0.000
#> SRR925729      2  0.0000      1.000 0.000 1.000
#> SRR934638      1  0.0000      1.000 1.000 0.000
#> SRR934639      1  0.0000      1.000 1.000 0.000
#> SRR934640      2  0.0000      1.000 0.000 1.000
#> SRR934641      2  0.0000      1.000 0.000 1.000
#> SRR925734      1  0.0000      1.000 1.000 0.000
#> SRR925735      2  0.0376      0.996 0.004 0.996
#> SRR925736      2  0.0000      1.000 0.000 1.000
#> SRR925737      2  0.0000      1.000 0.000 1.000
#> SRR934642      2  0.0000      1.000 0.000 1.000
#> SRR934643      2  0.0000      1.000 0.000 1.000
#> SRR934644      2  0.0000      1.000 0.000 1.000
#> SRR934645      2  0.0000      1.000 0.000 1.000
#> SRR925740      2  0.0000      1.000 0.000 1.000
#> SRR925741      2  0.0000      1.000 0.000 1.000
#> SRR925742      2  0.0000      1.000 0.000 1.000
#> SRR1283038     2  0.0000      1.000 0.000 1.000

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>            class entropy silhouette    p1    p2    p3
#> SRR925687      1  0.0000     0.8866 1.000 0.000 0.000
#> SRR925688      1  0.0000     0.8866 1.000 0.000 0.000
#> SRR925689      1  0.0000     0.8866 1.000 0.000 0.000
#> SRR925690      1  0.0000     0.8866 1.000 0.000 0.000
#> SRR925691      1  0.0000     0.8866 1.000 0.000 0.000
#> SRR925692      1  0.0000     0.8866 1.000 0.000 0.000
#> SRR925693      3  0.6126     0.2807 0.000 0.400 0.600
#> SRR925694      2  0.0000     0.9133 0.000 1.000 0.000
#> SRR925695      3  0.6126     0.2807 0.000 0.400 0.600
#> SRR925697      3  0.3551     0.4992 0.132 0.000 0.868
#> SRR925696      2  0.0000     0.9133 0.000 1.000 0.000
#> SRR925698      3  0.6252     0.1773 0.000 0.444 0.556
#> SRR925699      2  0.0000     0.9133 0.000 1.000 0.000
#> SRR925700      2  0.0000     0.9133 0.000 1.000 0.000
#> SRR925701      2  0.0000     0.9133 0.000 1.000 0.000
#> SRR925702      1  0.3941     0.7580 0.844 0.000 0.156
#> SRR925703      3  0.0424     0.5676 0.008 0.000 0.992
#> SRR925704      2  0.4654     0.6717 0.000 0.792 0.208
#> SRR925705      2  0.0000     0.9133 0.000 1.000 0.000
#> SRR925706      3  0.5465     0.3282 0.288 0.000 0.712
#> SRR925708      1  0.0000     0.8866 1.000 0.000 0.000
#> SRR925707      2  0.0592     0.9009 0.012 0.988 0.000
#> SRR925709      1  0.0000     0.8866 1.000 0.000 0.000
#> SRR925710      3  0.6244     0.2560 0.440 0.000 0.560
#> SRR925711      2  0.1163     0.8854 0.028 0.972 0.000
#> SRR934631      2  0.0000     0.9133 0.000 1.000 0.000
#> SRR934632      2  0.0000     0.9133 0.000 1.000 0.000
#> SRR934633      2  0.0000     0.9133 0.000 1.000 0.000
#> SRR925713      3  0.6154     0.2828 0.408 0.000 0.592
#> SRR925714      3  0.0000     0.5685 0.000 0.000 1.000
#> SRR925715      1  0.6252    -0.0836 0.556 0.000 0.444
#> SRR925716      1  0.6126     0.4505 0.600 0.000 0.400
#> SRR925717      3  0.5859     0.3765 0.344 0.000 0.656
#> SRR925718      2  0.0000     0.9133 0.000 1.000 0.000
#> SRR925719      1  0.0000     0.8866 1.000 0.000 0.000
#> SRR925720      1  0.0237     0.8844 0.996 0.000 0.004
#> SRR925721      1  0.0000     0.8866 1.000 0.000 0.000
#> SRR934634      1  0.0000     0.8866 1.000 0.000 0.000
#> SRR934635      1  0.0237     0.8844 0.996 0.000 0.004
#> SRR925723      2  0.3551     0.7769 0.000 0.868 0.132
#> SRR925724      2  0.6026     0.3393 0.000 0.624 0.376
#> SRR925725      2  0.6180     0.2251 0.000 0.584 0.416
#> SRR925726      3  0.5465     0.3142 0.288 0.000 0.712
#> SRR925727      3  0.6252     0.1784 0.000 0.444 0.556
#> SRR925728      1  0.3551     0.7825 0.868 0.000 0.132
#> SRR934636      1  0.6126     0.4505 0.600 0.000 0.400
#> SRR934637      1  0.6126     0.4505 0.600 0.000 0.400
#> SRR925729      2  0.0000     0.9133 0.000 1.000 0.000
#> SRR934638      1  0.0000     0.8866 1.000 0.000 0.000
#> SRR934639      1  0.0000     0.8866 1.000 0.000 0.000
#> SRR934640      2  0.0000     0.9133 0.000 1.000 0.000
#> SRR934641      2  0.0000     0.9133 0.000 1.000 0.000
#> SRR925734      1  0.0000     0.8866 1.000 0.000 0.000
#> SRR925735      2  0.6111     0.2820 0.000 0.604 0.396
#> SRR925736      2  0.0000     0.9133 0.000 1.000 0.000
#> SRR925737      2  0.0000     0.9133 0.000 1.000 0.000
#> SRR934642      2  0.0000     0.9133 0.000 1.000 0.000
#> SRR934643      2  0.0000     0.9133 0.000 1.000 0.000
#> SRR934644      2  0.0000     0.9133 0.000 1.000 0.000
#> SRR934645      2  0.0000     0.9133 0.000 1.000 0.000
#> SRR925740      2  0.0000     0.9133 0.000 1.000 0.000
#> SRR925741      2  0.6180     0.2250 0.000 0.584 0.416
#> SRR925742      2  0.0000     0.9133 0.000 1.000 0.000
#> SRR1283038     2  0.0000     0.9133 0.000 1.000 0.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> SRR925687      1  0.0000    0.89175 1.000 0.000 0.000 0.000
#> SRR925688      1  0.0188    0.89051 0.996 0.000 0.000 0.004
#> SRR925689      1  0.0469    0.89055 0.988 0.000 0.012 0.000
#> SRR925690      1  0.0469    0.89055 0.988 0.000 0.012 0.000
#> SRR925691      1  0.0657    0.88978 0.984 0.000 0.012 0.004
#> SRR925692      1  0.0469    0.89055 0.988 0.000 0.012 0.000
#> SRR925693      3  0.5160    0.65880 0.000 0.180 0.748 0.072
#> SRR925694      2  0.3718    0.72767 0.000 0.820 0.168 0.012
#> SRR925695      3  0.5599    0.68303 0.000 0.228 0.700 0.072
#> SRR925697      4  0.0817    0.86164 0.024 0.000 0.000 0.976
#> SRR925696      2  0.3208    0.71031 0.000 0.848 0.148 0.004
#> SRR925698      3  0.5744    0.56032 0.000 0.436 0.536 0.028
#> SRR925699      2  0.0817    0.79032 0.000 0.976 0.024 0.000
#> SRR925700      2  0.1211    0.78883 0.000 0.960 0.040 0.000
#> SRR925701      2  0.0000    0.78932 0.000 1.000 0.000 0.000
#> SRR925702      1  0.6649    0.22533 0.560 0.000 0.100 0.340
#> SRR925703      4  0.0657    0.85259 0.004 0.000 0.012 0.984
#> SRR925704      2  0.4877    0.49192 0.000 0.664 0.328 0.008
#> SRR925705      2  0.3266    0.69183 0.000 0.832 0.168 0.000
#> SRR925706      4  0.5497    0.75983 0.052 0.008 0.220 0.720
#> SRR925708      1  0.0000    0.89175 1.000 0.000 0.000 0.000
#> SRR925707      2  0.4201    0.66015 0.012 0.788 0.196 0.004
#> SRR925709      1  0.2714    0.80422 0.884 0.000 0.112 0.004
#> SRR925710      1  0.6355    0.47038 0.576 0.000 0.348 0.076
#> SRR925711      2  0.4206    0.73168 0.048 0.816 0.136 0.000
#> SRR934631      2  0.2741    0.77270 0.000 0.892 0.096 0.012
#> SRR934632      2  0.2676    0.77402 0.000 0.896 0.092 0.012
#> SRR934633      2  0.2741    0.77270 0.000 0.892 0.096 0.012
#> SRR925713      3  0.6116    0.00868 0.320 0.000 0.612 0.068
#> SRR925714      4  0.0657    0.85259 0.004 0.000 0.012 0.984
#> SRR925715      1  0.5535    0.59377 0.656 0.000 0.304 0.040
#> SRR925716      4  0.2216    0.86524 0.092 0.000 0.000 0.908
#> SRR925717      1  0.6559    0.13288 0.468 0.000 0.456 0.076
#> SRR925718      2  0.0707    0.78395 0.000 0.980 0.020 0.000
#> SRR925719      1  0.0000    0.89175 1.000 0.000 0.000 0.000
#> SRR925720      1  0.0000    0.89175 1.000 0.000 0.000 0.000
#> SRR925721      1  0.0000    0.89175 1.000 0.000 0.000 0.000
#> SRR934634      1  0.0000    0.89175 1.000 0.000 0.000 0.000
#> SRR934635      1  0.1174    0.87921 0.968 0.000 0.012 0.020
#> SRR925723      2  0.3539    0.67462 0.000 0.820 0.176 0.004
#> SRR925724      2  0.5364    0.23140 0.000 0.652 0.320 0.028
#> SRR925725      3  0.5150    0.57102 0.000 0.396 0.596 0.008
#> SRR925726      4  0.6058    0.60766 0.072 0.000 0.296 0.632
#> SRR925727      3  0.6120    0.68634 0.000 0.296 0.628 0.076
#> SRR925728      4  0.5859    0.76080 0.140 0.000 0.156 0.704
#> SRR934636      4  0.2216    0.86524 0.092 0.000 0.000 0.908
#> SRR934637      4  0.2216    0.86524 0.092 0.000 0.000 0.908
#> SRR925729      2  0.4182    0.71575 0.000 0.796 0.180 0.024
#> SRR934638      1  0.0336    0.89141 0.992 0.000 0.008 0.000
#> SRR934639      1  0.0657    0.88922 0.984 0.000 0.012 0.004
#> SRR934640      2  0.4948    0.62921 0.008 0.724 0.252 0.016
#> SRR934641      2  0.4948    0.62921 0.008 0.724 0.252 0.016
#> SRR925734      1  0.0336    0.89141 0.992 0.000 0.008 0.000
#> SRR925735      3  0.5149    0.61528 0.000 0.336 0.648 0.016
#> SRR925736      2  0.3266    0.69183 0.000 0.832 0.168 0.000
#> SRR925737      2  0.2760    0.73373 0.000 0.872 0.128 0.000
#> SRR934642      2  0.0188    0.78869 0.000 0.996 0.004 0.000
#> SRR934643      2  0.0188    0.78869 0.000 0.996 0.004 0.000
#> SRR934644      2  0.3428    0.75262 0.000 0.844 0.144 0.012
#> SRR934645      2  0.2928    0.77029 0.000 0.880 0.108 0.012
#> SRR925740      2  0.2589    0.74154 0.000 0.884 0.116 0.000
#> SRR925741      3  0.5099    0.58605 0.000 0.380 0.612 0.008
#> SRR925742      2  0.2408    0.74953 0.000 0.896 0.104 0.000
#> SRR1283038     2  0.3583    0.71597 0.000 0.816 0.180 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
#> SRR925687      1  0.1830     0.8874 0.924 0.000 0.000 0.068 0.008
#> SRR925688      1  0.1671     0.8863 0.924 0.000 0.000 0.076 0.000
#> SRR925689      1  0.1211     0.8827 0.960 0.024 0.000 0.016 0.000
#> SRR925690      1  0.1211     0.8827 0.960 0.024 0.000 0.016 0.000
#> SRR925691      1  0.1211     0.8827 0.960 0.024 0.000 0.016 0.000
#> SRR925692      1  0.1211     0.8827 0.960 0.024 0.000 0.016 0.000
#> SRR925693      2  0.6503     0.1440 0.000 0.480 0.220 0.300 0.000
#> SRR925694      2  0.4958     0.5014 0.000 0.592 0.372 0.036 0.000
#> SRR925695      3  0.6744    -0.0593 0.000 0.268 0.400 0.332 0.000
#> SRR925697      5  0.1043     0.8767 0.000 0.000 0.000 0.040 0.960
#> SRR925696      3  0.0162     0.7212 0.000 0.004 0.996 0.000 0.000
#> SRR925698      3  0.3375     0.5739 0.000 0.104 0.840 0.056 0.000
#> SRR925699      3  0.3990     0.4052 0.000 0.308 0.688 0.004 0.000
#> SRR925700      3  0.4248     0.5072 0.000 0.240 0.728 0.032 0.000
#> SRR925701      3  0.3398     0.5812 0.000 0.216 0.780 0.004 0.000
#> SRR925702      4  0.6274     0.1649 0.148 0.000 0.000 0.428 0.424
#> SRR925703      5  0.1341     0.8701 0.000 0.000 0.000 0.056 0.944
#> SRR925704      2  0.4559     0.4622 0.000 0.512 0.480 0.008 0.000
#> SRR925705      3  0.0000     0.7227 0.000 0.000 1.000 0.000 0.000
#> SRR925706      4  0.4415     0.2177 0.000 0.004 0.000 0.552 0.444
#> SRR925708      1  0.1205     0.8927 0.956 0.000 0.000 0.040 0.004
#> SRR925707      4  0.7493     0.4415 0.000 0.228 0.084 0.500 0.188
#> SRR925709      1  0.4321     0.3442 0.600 0.000 0.000 0.396 0.004
#> SRR925710      4  0.4532     0.4592 0.248 0.036 0.004 0.712 0.000
#> SRR925711      2  0.6589     0.0618 0.016 0.484 0.140 0.360 0.000
#> SRR934631      2  0.3966     0.5833 0.000 0.664 0.336 0.000 0.000
#> SRR934632      2  0.3966     0.5833 0.000 0.664 0.336 0.000 0.000
#> SRR934633      2  0.4030     0.5876 0.000 0.648 0.352 0.000 0.000
#> SRR925713      4  0.3890     0.4547 0.068 0.080 0.004 0.832 0.016
#> SRR925714      5  0.1410     0.8700 0.000 0.000 0.000 0.060 0.940
#> SRR925715      4  0.4510     0.5366 0.164 0.076 0.004 0.756 0.000
#> SRR925716      5  0.0162     0.8768 0.000 0.000 0.000 0.004 0.996
#> SRR925717      1  0.7196     0.0865 0.420 0.208 0.000 0.344 0.028
#> SRR925718      3  0.3006     0.6402 0.000 0.156 0.836 0.004 0.004
#> SRR925719      1  0.1671     0.8866 0.924 0.000 0.000 0.076 0.000
#> SRR925720      1  0.1831     0.8855 0.920 0.000 0.000 0.076 0.004
#> SRR925721      1  0.1544     0.8892 0.932 0.000 0.000 0.068 0.000
#> SRR934634      1  0.1478     0.8901 0.936 0.000 0.000 0.064 0.000
#> SRR934635      1  0.0000     0.8890 1.000 0.000 0.000 0.000 0.000
#> SRR925723      3  0.0404     0.7173 0.000 0.012 0.988 0.000 0.000
#> SRR925724      3  0.1918     0.6750 0.000 0.036 0.928 0.036 0.000
#> SRR925725      2  0.4235     0.5087 0.000 0.656 0.336 0.008 0.000
#> SRR925726      5  0.6188     0.3755 0.000 0.176 0.000 0.284 0.540
#> SRR925727      3  0.6621    -0.0106 0.000 0.224 0.428 0.348 0.000
#> SRR925728      4  0.4753     0.2983 0.004 0.008 0.004 0.580 0.404
#> SRR934636      5  0.0162     0.8749 0.000 0.000 0.000 0.004 0.996
#> SRR934637      5  0.0162     0.8749 0.000 0.000 0.000 0.004 0.996
#> SRR925729      2  0.5528     0.5784 0.000 0.644 0.216 0.140 0.000
#> SRR934638      1  0.1740     0.8925 0.932 0.012 0.000 0.056 0.000
#> SRR934639      1  0.1012     0.8844 0.968 0.020 0.000 0.012 0.000
#> SRR934640      4  0.5238     0.1664 0.000 0.476 0.044 0.480 0.000
#> SRR934641      4  0.5238     0.1664 0.000 0.476 0.044 0.480 0.000
#> SRR925734      1  0.0162     0.8900 0.996 0.000 0.000 0.004 0.000
#> SRR925735      2  0.6491     0.3417 0.000 0.492 0.244 0.264 0.000
#> SRR925736      3  0.0000     0.7227 0.000 0.000 1.000 0.000 0.000
#> SRR925737      3  0.0771     0.7220 0.000 0.020 0.976 0.004 0.000
#> SRR934642      3  0.3048     0.6246 0.000 0.176 0.820 0.004 0.000
#> SRR934643      3  0.3048     0.6261 0.000 0.176 0.820 0.004 0.000
#> SRR934644      2  0.4777     0.5904 0.000 0.664 0.292 0.044 0.000
#> SRR934645      2  0.4570     0.5511 0.000 0.632 0.348 0.020 0.000
#> SRR925740      3  0.0609     0.7227 0.000 0.020 0.980 0.000 0.000
#> SRR925741      2  0.4135     0.5046 0.000 0.656 0.340 0.004 0.000
#> SRR925742      3  0.0703     0.7228 0.000 0.024 0.976 0.000 0.000
#> SRR1283038     3  0.2488     0.5857 0.000 0.124 0.872 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
#> SRR925687      1  0.2019     0.8276 0.900 0.000 0.000 0.088 0.012 0.000
#> SRR925688      1  0.1814     0.8260 0.900 0.000 0.000 0.100 0.000 0.000
#> SRR925689      1  0.4721     0.7194 0.724 0.036 0.000 0.076 0.000 0.164
#> SRR925690      1  0.4653     0.7248 0.732 0.036 0.000 0.076 0.000 0.156
#> SRR925691      1  0.4653     0.7248 0.732 0.036 0.000 0.076 0.000 0.156
#> SRR925692      1  0.4653     0.7248 0.732 0.036 0.000 0.076 0.000 0.156
#> SRR925693      6  0.5144     0.5100 0.000 0.256 0.120 0.004 0.000 0.620
#> SRR925694      2  0.5622     0.4737 0.000 0.624 0.236 0.072 0.000 0.068
#> SRR925695      6  0.5703     0.4848 0.000 0.236 0.240 0.000 0.000 0.524
#> SRR925697      5  0.1686     0.8622 0.000 0.000 0.000 0.012 0.924 0.064
#> SRR925696      3  0.1633     0.7978 0.000 0.024 0.932 0.000 0.000 0.044
#> SRR925698      3  0.3670     0.5385 0.000 0.024 0.736 0.000 0.000 0.240
#> SRR925699      3  0.4038     0.6513 0.000 0.216 0.728 0.000 0.000 0.056
#> SRR925700      3  0.4729     0.6878 0.000 0.124 0.740 0.068 0.000 0.068
#> SRR925701      3  0.2740     0.7880 0.000 0.120 0.852 0.000 0.000 0.028
#> SRR925702      4  0.5368     0.6122 0.072 0.000 0.000 0.676 0.168 0.084
#> SRR925703      5  0.2762     0.8475 0.000 0.000 0.000 0.048 0.860 0.092
#> SRR925704      2  0.4669     0.4740 0.000 0.688 0.164 0.000 0.000 0.148
#> SRR925705      3  0.1408     0.8061 0.000 0.020 0.944 0.000 0.000 0.036
#> SRR925706      4  0.2956     0.7164 0.000 0.000 0.000 0.840 0.120 0.040
#> SRR925708      1  0.1777     0.8293 0.928 0.000 0.000 0.044 0.024 0.004
#> SRR925707      4  0.3924     0.7054 0.000 0.072 0.096 0.800 0.032 0.000
#> SRR925709      1  0.4312     0.0429 0.508 0.000 0.000 0.476 0.004 0.012
#> SRR925710      4  0.4245     0.6739 0.044 0.000 0.000 0.696 0.004 0.256
#> SRR925711      4  0.5660     0.4878 0.004 0.308 0.064 0.580 0.000 0.044
#> SRR934631      2  0.1501     0.6931 0.000 0.924 0.076 0.000 0.000 0.000
#> SRR934632      2  0.1501     0.6931 0.000 0.924 0.076 0.000 0.000 0.000
#> SRR934633      2  0.1531     0.6818 0.000 0.928 0.068 0.000 0.000 0.004
#> SRR925713      4  0.4060     0.7185 0.060 0.000 0.000 0.768 0.016 0.156
#> SRR925714      5  0.2948     0.8409 0.000 0.000 0.000 0.060 0.848 0.092
#> SRR925715      4  0.2277     0.7408 0.076 0.000 0.000 0.892 0.000 0.032
#> SRR925716      5  0.0000     0.8548 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR925717      6  0.5695     0.1120 0.204 0.000 0.000 0.100 0.064 0.632
#> SRR925718      3  0.1908     0.8153 0.000 0.096 0.900 0.000 0.000 0.004
#> SRR925719      1  0.2001     0.8268 0.900 0.000 0.000 0.092 0.004 0.004
#> SRR925720      1  0.2342     0.8230 0.888 0.000 0.000 0.088 0.020 0.004
#> SRR925721      1  0.1663     0.8287 0.912 0.000 0.000 0.088 0.000 0.000
#> SRR934634      1  0.1444     0.8319 0.928 0.000 0.000 0.072 0.000 0.000
#> SRR934635      1  0.0458     0.8296 0.984 0.000 0.000 0.016 0.000 0.000
#> SRR925723      3  0.2432     0.7473 0.000 0.024 0.876 0.000 0.000 0.100
#> SRR925724      3  0.3168     0.6593 0.000 0.024 0.804 0.000 0.000 0.172
#> SRR925725      2  0.4613     0.4426 0.000 0.692 0.128 0.000 0.000 0.180
#> SRR925726      5  0.4985     0.4931 0.000 0.000 0.000 0.076 0.548 0.376
#> SRR925727      6  0.4683     0.4970 0.000 0.056 0.312 0.004 0.000 0.628
#> SRR925728      4  0.2507     0.7485 0.040 0.000 0.000 0.884 0.072 0.004
#> SRR934636      5  0.0972     0.8482 0.000 0.000 0.000 0.028 0.964 0.008
#> SRR934637      5  0.0972     0.8482 0.000 0.000 0.000 0.028 0.964 0.008
#> SRR925729      2  0.3869     0.6260 0.000 0.804 0.052 0.040 0.000 0.104
#> SRR934638      1  0.3477     0.8219 0.820 0.008 0.000 0.092 0.000 0.080
#> SRR934639      1  0.3880     0.7648 0.800 0.032 0.000 0.056 0.000 0.112
#> SRR934640      4  0.3490     0.6592 0.000 0.268 0.000 0.724 0.000 0.008
#> SRR934641      4  0.3490     0.6592 0.000 0.268 0.000 0.724 0.000 0.008
#> SRR925734      1  0.0891     0.8218 0.968 0.008 0.000 0.024 0.000 0.000
#> SRR925735      6  0.6173     0.2483 0.000 0.380 0.084 0.064 0.000 0.472
#> SRR925736      3  0.0692     0.8304 0.000 0.020 0.976 0.000 0.000 0.004
#> SRR925737      3  0.0937     0.8300 0.000 0.040 0.960 0.000 0.000 0.000
#> SRR934642      3  0.2006     0.8125 0.000 0.104 0.892 0.000 0.000 0.004
#> SRR934643      3  0.2070     0.8134 0.000 0.100 0.892 0.000 0.000 0.008
#> SRR934644      2  0.2828     0.6767 0.000 0.864 0.072 0.004 0.000 0.060
#> SRR934645      2  0.3840     0.6386 0.000 0.788 0.136 0.012 0.000 0.064
#> SRR925740      3  0.1492     0.8149 0.000 0.024 0.940 0.000 0.000 0.036
#> SRR925741      2  0.4552     0.4565 0.000 0.700 0.128 0.000 0.000 0.172
#> SRR925742      3  0.0820     0.8297 0.000 0.016 0.972 0.000 0.000 0.012
#> SRR1283038     2  0.5543     0.1441 0.000 0.488 0.372 0.000 0.000 0.140

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

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

collect_plots(res)

plot of chunk CV-hclust-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 1.000           0.984       1.000         0.0322 0.969   0.969
#> 3 3 1.000           0.945       0.983        15.1072 0.508   0.492
#> 4 4 1.000           0.926       0.975         0.1420 0.936   0.865
#> 5 5 0.815           0.821       0.881         0.1116 0.898   0.764
#> 6 6 0.777           0.711       0.898         0.0708 0.973   0.925

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

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

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

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

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

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>            class entropy silhouette p1 p2
#> SRR925687      2       0          1  0  1
#> SRR925688      2       0          1  0  1
#> SRR925689      2       0          1  0  1
#> SRR925690      2       0          1  0  1
#> SRR925691      2       0          1  0  1
#> SRR925692      2       0          1  0  1
#> SRR925693      2       0          1  0  1
#> SRR925694      2       0          1  0  1
#> SRR925695      2       0          1  0  1
#> SRR925697      2       0          1  0  1
#> SRR925696      2       0          1  0  1
#> SRR925698      2       0          1  0  1
#> SRR925699      2       0          1  0  1
#> SRR925700      2       0          1  0  1
#> SRR925701      2       0          1  0  1
#> SRR925702      2       0          1  0  1
#> SRR925703      2       0          1  0  1
#> SRR925704      2       0          1  0  1
#> SRR925705      2       0          1  0  1
#> SRR925706      2       0          1  0  1
#> SRR925708      2       0          1  0  1
#> SRR925707      2       0          1  0  1
#> SRR925709      2       0          1  0  1
#> SRR925710      2       0          1  0  1
#> SRR925711      1       0          0  1  0
#> SRR934631      2       0          1  0  1
#> SRR934632      2       0          1  0  1
#> SRR934633      2       0          1  0  1
#> SRR925713      2       0          1  0  1
#> SRR925714      2       0          1  0  1
#> SRR925715      2       0          1  0  1
#> SRR925716      2       0          1  0  1
#> SRR925717      2       0          1  0  1
#> SRR925718      2       0          1  0  1
#> SRR925719      2       0          1  0  1
#> SRR925720      2       0          1  0  1
#> SRR925721      2       0          1  0  1
#> SRR934634      2       0          1  0  1
#> SRR934635      2       0          1  0  1
#> SRR925723      2       0          1  0  1
#> SRR925724      2       0          1  0  1
#> SRR925725      2       0          1  0  1
#> SRR925726      2       0          1  0  1
#> SRR925727      2       0          1  0  1
#> SRR925728      2       0          1  0  1
#> SRR934636      2       0          1  0  1
#> SRR934637      2       0          1  0  1
#> SRR925729      2       0          1  0  1
#> SRR934638      2       0          1  0  1
#> SRR934639      2       0          1  0  1
#> SRR934640      2       0          1  0  1
#> SRR934641      2       0          1  0  1
#> SRR925734      2       0          1  0  1
#> SRR925735      2       0          1  0  1
#> SRR925736      2       0          1  0  1
#> SRR925737      2       0          1  0  1
#> SRR934642      2       0          1  0  1
#> SRR934643      2       0          1  0  1
#> SRR934644      2       0          1  0  1
#> SRR934645      2       0          1  0  1
#> SRR925740      2       0          1  0  1
#> SRR925741      2       0          1  0  1
#> SRR925742      2       0          1  0  1
#> SRR1283038     2       0          1  0  1

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>            class entropy silhouette    p1    p2 p3
#> SRR925687      1  0.0000      0.965 1.000 0.000  0
#> SRR925688      1  0.0000      0.965 1.000 0.000  0
#> SRR925689      1  0.0000      0.965 1.000 0.000  0
#> SRR925690      1  0.0000      0.965 1.000 0.000  0
#> SRR925691      1  0.0000      0.965 1.000 0.000  0
#> SRR925692      1  0.0000      0.965 1.000 0.000  0
#> SRR925693      2  0.0000      0.986 0.000 1.000  0
#> SRR925694      2  0.0592      0.994 0.012 0.988  0
#> SRR925695      2  0.0000      0.986 0.000 1.000  0
#> SRR925697      1  0.0000      0.965 1.000 0.000  0
#> SRR925696      2  0.0592      0.994 0.012 0.988  0
#> SRR925698      2  0.0592      0.994 0.012 0.988  0
#> SRR925699      2  0.0592      0.994 0.012 0.988  0
#> SRR925700      2  0.0592      0.994 0.012 0.988  0
#> SRR925701      2  0.0592      0.994 0.012 0.988  0
#> SRR925702      1  0.1753      0.923 0.952 0.048  0
#> SRR925703      1  0.0000      0.965 1.000 0.000  0
#> SRR925704      2  0.0000      0.986 0.000 1.000  0
#> SRR925705      2  0.0592      0.994 0.012 0.988  0
#> SRR925706      1  0.1753      0.923 0.952 0.048  0
#> SRR925708      1  0.0000      0.965 1.000 0.000  0
#> SRR925707      1  0.1753      0.923 0.952 0.048  0
#> SRR925709      1  0.0000      0.965 1.000 0.000  0
#> SRR925710      1  0.6295      0.107 0.528 0.472  0
#> SRR925711      3  0.0000      0.000 0.000 0.000  1
#> SRR934631      2  0.0592      0.994 0.012 0.988  0
#> SRR934632      2  0.0592      0.994 0.012 0.988  0
#> SRR934633      2  0.0592      0.994 0.012 0.988  0
#> SRR925713      1  0.1411      0.934 0.964 0.036  0
#> SRR925714      1  0.0000      0.965 1.000 0.000  0
#> SRR925715      1  0.1753      0.923 0.952 0.048  0
#> SRR925716      1  0.0000      0.965 1.000 0.000  0
#> SRR925717      1  0.0000      0.965 1.000 0.000  0
#> SRR925718      2  0.0592      0.994 0.012 0.988  0
#> SRR925719      1  0.0000      0.965 1.000 0.000  0
#> SRR925720      1  0.0000      0.965 1.000 0.000  0
#> SRR925721      1  0.0000      0.965 1.000 0.000  0
#> SRR934634      1  0.0000      0.965 1.000 0.000  0
#> SRR934635      1  0.0000      0.965 1.000 0.000  0
#> SRR925723      2  0.0592      0.994 0.012 0.988  0
#> SRR925724      2  0.0000      0.986 0.000 1.000  0
#> SRR925725      2  0.0000      0.986 0.000 1.000  0
#> SRR925726      1  0.0000      0.965 1.000 0.000  0
#> SRR925727      2  0.0000      0.986 0.000 1.000  0
#> SRR925728      1  0.1753      0.923 0.952 0.048  0
#> SRR934636      1  0.0000      0.965 1.000 0.000  0
#> SRR934637      1  0.0000      0.965 1.000 0.000  0
#> SRR925729      2  0.0592      0.994 0.012 0.988  0
#> SRR934638      1  0.0000      0.965 1.000 0.000  0
#> SRR934639      1  0.0000      0.965 1.000 0.000  0
#> SRR934640      2  0.1289      0.971 0.032 0.968  0
#> SRR934641      2  0.1289      0.971 0.032 0.968  0
#> SRR925734      1  0.0000      0.965 1.000 0.000  0
#> SRR925735      2  0.0892      0.986 0.020 0.980  0
#> SRR925736      2  0.0592      0.994 0.012 0.988  0
#> SRR925737      2  0.0592      0.994 0.012 0.988  0
#> SRR934642      2  0.0424      0.992 0.008 0.992  0
#> SRR934643      2  0.0424      0.992 0.008 0.992  0
#> SRR934644      2  0.0592      0.994 0.012 0.988  0
#> SRR934645      2  0.0592      0.994 0.012 0.988  0
#> SRR925740      2  0.0592      0.994 0.012 0.988  0
#> SRR925741      2  0.0000      0.986 0.000 1.000  0
#> SRR925742      2  0.0592      0.994 0.012 0.988  0
#> SRR1283038     2  0.0592      0.994 0.012 0.988  0

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1 p2    p3    p4
#> SRR925687      1  0.0000     0.9396 1.000  0 0.000 0.000
#> SRR925688      1  0.0000     0.9396 1.000  0 0.000 0.000
#> SRR925689      1  0.0000     0.9396 1.000  0 0.000 0.000
#> SRR925690      1  0.0000     0.9396 1.000  0 0.000 0.000
#> SRR925691      1  0.0000     0.9396 1.000  0 0.000 0.000
#> SRR925692      1  0.0000     0.9396 1.000  0 0.000 0.000
#> SRR925693      3  0.0469     0.9898 0.000  0 0.988 0.012
#> SRR925694      3  0.0000     0.9951 0.000  0 1.000 0.000
#> SRR925695      3  0.0469     0.9898 0.000  0 0.988 0.012
#> SRR925697      1  0.1118     0.9204 0.964  0 0.000 0.036
#> SRR925696      3  0.0000     0.9951 0.000  0 1.000 0.000
#> SRR925698      3  0.0000     0.9951 0.000  0 1.000 0.000
#> SRR925699      3  0.0000     0.9951 0.000  0 1.000 0.000
#> SRR925700      3  0.0000     0.9951 0.000  0 1.000 0.000
#> SRR925701      3  0.0000     0.9951 0.000  0 1.000 0.000
#> SRR925702      4  0.1474     0.9808 0.052  0 0.000 0.948
#> SRR925703      1  0.1118     0.9204 0.964  0 0.000 0.036
#> SRR925704      3  0.0469     0.9898 0.000  0 0.988 0.012
#> SRR925705      3  0.0000     0.9951 0.000  0 1.000 0.000
#> SRR925706      4  0.1489     0.9952 0.044  0 0.004 0.952
#> SRR925708      1  0.0000     0.9396 1.000  0 0.000 0.000
#> SRR925707      4  0.1489     0.9952 0.044  0 0.004 0.952
#> SRR925709      1  0.0000     0.9396 1.000  0 0.000 0.000
#> SRR925710      1  0.6081     0.0422 0.484  0 0.472 0.044
#> SRR925711      2  0.0000     0.0000 0.000  1 0.000 0.000
#> SRR934631      3  0.0000     0.9951 0.000  0 1.000 0.000
#> SRR934632      3  0.0000     0.9951 0.000  0 1.000 0.000
#> SRR934633      3  0.0000     0.9951 0.000  0 1.000 0.000
#> SRR925713      1  0.4972     0.0929 0.544  0 0.000 0.456
#> SRR925714      1  0.1118     0.9204 0.964  0 0.000 0.036
#> SRR925715      4  0.1489     0.9952 0.044  0 0.004 0.952
#> SRR925716      1  0.1118     0.9204 0.964  0 0.000 0.036
#> SRR925717      1  0.0000     0.9396 1.000  0 0.000 0.000
#> SRR925718      3  0.0000     0.9951 0.000  0 1.000 0.000
#> SRR925719      1  0.0000     0.9396 1.000  0 0.000 0.000
#> SRR925720      1  0.0000     0.9396 1.000  0 0.000 0.000
#> SRR925721      1  0.0000     0.9396 1.000  0 0.000 0.000
#> SRR934634      1  0.0000     0.9396 1.000  0 0.000 0.000
#> SRR934635      1  0.0000     0.9396 1.000  0 0.000 0.000
#> SRR925723      3  0.0000     0.9951 0.000  0 1.000 0.000
#> SRR925724      3  0.0469     0.9898 0.000  0 0.988 0.012
#> SRR925725      3  0.0469     0.9898 0.000  0 0.988 0.012
#> SRR925726      1  0.0336     0.9360 0.992  0 0.000 0.008
#> SRR925727      3  0.0469     0.9898 0.000  0 0.988 0.012
#> SRR925728      4  0.1489     0.9952 0.044  0 0.004 0.952
#> SRR934636      1  0.1452     0.9138 0.956  0 0.008 0.036
#> SRR934637      1  0.1452     0.9138 0.956  0 0.008 0.036
#> SRR925729      3  0.0000     0.9951 0.000  0 1.000 0.000
#> SRR934638      1  0.0188     0.9372 0.996  0 0.000 0.004
#> SRR934639      1  0.0188     0.9372 0.996  0 0.000 0.004
#> SRR934640      3  0.0817     0.9750 0.000  0 0.976 0.024
#> SRR934641      3  0.0817     0.9750 0.000  0 0.976 0.024
#> SRR925734      1  0.0000     0.9396 1.000  0 0.000 0.000
#> SRR925735      3  0.0336     0.9882 0.008  0 0.992 0.000
#> SRR925736      3  0.0000     0.9951 0.000  0 1.000 0.000
#> SRR925737      3  0.0000     0.9951 0.000  0 1.000 0.000
#> SRR934642      3  0.0188     0.9934 0.000  0 0.996 0.004
#> SRR934643      3  0.0188     0.9934 0.000  0 0.996 0.004
#> SRR934644      3  0.0000     0.9951 0.000  0 1.000 0.000
#> SRR934645      3  0.0000     0.9951 0.000  0 1.000 0.000
#> SRR925740      3  0.0000     0.9951 0.000  0 1.000 0.000
#> SRR925741      3  0.0469     0.9898 0.000  0 0.988 0.012
#> SRR925742      3  0.0000     0.9951 0.000  0 1.000 0.000
#> SRR1283038     3  0.0000     0.9951 0.000  0 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
#> SRR925687      1  0.4201     0.9915 0.592  0 0.000 0.000 0.408
#> SRR925688      1  0.4201     0.9915 0.592  0 0.000 0.000 0.408
#> SRR925689      1  0.4201     0.9915 0.592  0 0.000 0.000 0.408
#> SRR925690      1  0.4201     0.9915 0.592  0 0.000 0.000 0.408
#> SRR925691      1  0.4201     0.9915 0.592  0 0.000 0.000 0.408
#> SRR925692      1  0.4201     0.9915 0.592  0 0.000 0.000 0.408
#> SRR925693      3  0.4908     0.5833 0.356  0 0.608 0.036 0.000
#> SRR925694      3  0.0290     0.8937 0.008  0 0.992 0.000 0.000
#> SRR925695      3  0.3224     0.8003 0.160  0 0.824 0.016 0.000
#> SRR925697      5  0.0000     0.9035 0.000  0 0.000 0.000 1.000
#> SRR925696      3  0.0963     0.8898 0.036  0 0.964 0.000 0.000
#> SRR925698      3  0.0898     0.8886 0.020  0 0.972 0.008 0.000
#> SRR925699      3  0.0290     0.8937 0.008  0 0.992 0.000 0.000
#> SRR925700      3  0.0290     0.8937 0.008  0 0.992 0.000 0.000
#> SRR925701      3  0.0290     0.8937 0.008  0 0.992 0.000 0.000
#> SRR925702      4  0.1251     0.7779 0.036  0 0.000 0.956 0.008
#> SRR925703      5  0.0000     0.9035 0.000  0 0.000 0.000 1.000
#> SRR925704      3  0.3224     0.8003 0.160  0 0.824 0.016 0.000
#> SRR925705      3  0.0963     0.8898 0.036  0 0.964 0.000 0.000
#> SRR925706      4  0.0963     0.7857 0.036  0 0.000 0.964 0.000
#> SRR925708      1  0.4201     0.9915 0.592  0 0.000 0.000 0.408
#> SRR925707      4  0.0963     0.7857 0.036  0 0.000 0.964 0.000
#> SRR925709      1  0.4201     0.9915 0.592  0 0.000 0.000 0.408
#> SRR925710      3  0.7145    -0.0726 0.156  0 0.464 0.044 0.336
#> SRR925711      2  0.0000     0.0000 0.000  1 0.000 0.000 0.000
#> SRR934631      3  0.0290     0.8937 0.008  0 0.992 0.000 0.000
#> SRR934632      3  0.0290     0.8937 0.008  0 0.992 0.000 0.000
#> SRR934633      3  0.0290     0.8937 0.008  0 0.992 0.000 0.000
#> SRR925713      4  0.6506    -0.2041 0.200  0 0.000 0.456 0.344
#> SRR925714      5  0.0000     0.9035 0.000  0 0.000 0.000 1.000
#> SRR925715      4  0.0963     0.7857 0.036  0 0.000 0.964 0.000
#> SRR925716      5  0.0000     0.9035 0.000  0 0.000 0.000 1.000
#> SRR925717      1  0.4297     0.8667 0.528  0 0.000 0.000 0.472
#> SRR925718      3  0.0794     0.8916 0.028  0 0.972 0.000 0.000
#> SRR925719      1  0.4201     0.9915 0.592  0 0.000 0.000 0.408
#> SRR925720      1  0.4201     0.9915 0.592  0 0.000 0.000 0.408
#> SRR925721      1  0.4201     0.9915 0.592  0 0.000 0.000 0.408
#> SRR934634      1  0.4201     0.9915 0.592  0 0.000 0.000 0.408
#> SRR934635      1  0.4201     0.9915 0.592  0 0.000 0.000 0.408
#> SRR925723      3  0.0794     0.8916 0.028  0 0.972 0.000 0.000
#> SRR925724      3  0.5028     0.5266 0.400  0 0.564 0.036 0.000
#> SRR925725      3  0.4908     0.5833 0.356  0 0.608 0.036 0.000
#> SRR925726      5  0.3837    -0.1048 0.308  0 0.000 0.000 0.692
#> SRR925727      3  0.4908     0.5833 0.356  0 0.608 0.036 0.000
#> SRR925728      4  0.0963     0.7857 0.036  0 0.000 0.964 0.000
#> SRR934636      5  0.0290     0.8961 0.000  0 0.008 0.000 0.992
#> SRR934637      5  0.0290     0.8961 0.000  0 0.008 0.000 0.992
#> SRR925729      3  0.0290     0.8937 0.008  0 0.992 0.000 0.000
#> SRR934638      1  0.4350     0.9857 0.588  0 0.000 0.004 0.408
#> SRR934639      1  0.4350     0.9857 0.588  0 0.000 0.004 0.408
#> SRR934640      3  0.0992     0.8844 0.008  0 0.968 0.024 0.000
#> SRR934641      3  0.0992     0.8844 0.008  0 0.968 0.024 0.000
#> SRR925734      1  0.4201     0.9915 0.592  0 0.000 0.000 0.408
#> SRR925735      3  0.0510     0.8913 0.016  0 0.984 0.000 0.000
#> SRR925736      3  0.0963     0.8898 0.036  0 0.964 0.000 0.000
#> SRR925737      3  0.0963     0.8898 0.036  0 0.964 0.000 0.000
#> SRR934642      3  0.2377     0.8485 0.128  0 0.872 0.000 0.000
#> SRR934643      3  0.2377     0.8485 0.128  0 0.872 0.000 0.000
#> SRR934644      3  0.0290     0.8937 0.008  0 0.992 0.000 0.000
#> SRR934645      3  0.0290     0.8937 0.008  0 0.992 0.000 0.000
#> SRR925740      3  0.0794     0.8916 0.028  0 0.972 0.000 0.000
#> SRR925741      3  0.3224     0.8003 0.160  0 0.824 0.016 0.000
#> SRR925742      3  0.0794     0.8916 0.028  0 0.972 0.000 0.000
#> SRR1283038     3  0.0898     0.8886 0.020  0 0.972 0.008 0.000

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>            class entropy silhouette    p1    p2    p3    p4    p5 p6
#> SRR925687      1  0.0000      0.959 1.000 0.000 0.000 0.000 0.000  0
#> SRR925688      1  0.0000      0.959 1.000 0.000 0.000 0.000 0.000  0
#> SRR925689      1  0.0146      0.958 0.996 0.004 0.000 0.000 0.000  0
#> SRR925690      1  0.0146      0.958 0.996 0.004 0.000 0.000 0.000  0
#> SRR925691      1  0.0146      0.958 0.996 0.004 0.000 0.000 0.000  0
#> SRR925692      1  0.0146      0.958 0.996 0.004 0.000 0.000 0.000  0
#> SRR925693      3  0.3817      0.115 0.000 0.432 0.568 0.000 0.000  0
#> SRR925694      3  0.0146      0.800 0.000 0.004 0.996 0.000 0.000  0
#> SRR925695      3  0.2823      0.629 0.000 0.204 0.796 0.000 0.000  0
#> SRR925697      5  0.2300      0.806 0.144 0.000 0.000 0.000 0.856  0
#> SRR925696      3  0.2340      0.727 0.000 0.148 0.852 0.000 0.000  0
#> SRR925698      3  0.1007      0.789 0.000 0.044 0.956 0.000 0.000  0
#> SRR925699      3  0.0000      0.800 0.000 0.000 1.000 0.000 0.000  0
#> SRR925700      3  0.0000      0.800 0.000 0.000 1.000 0.000 0.000  0
#> SRR925701      3  0.0000      0.800 0.000 0.000 1.000 0.000 0.000  0
#> SRR925702      4  0.0260      0.945 0.008 0.000 0.000 0.992 0.000  0
#> SRR925703      5  0.2300      0.806 0.144 0.000 0.000 0.000 0.856  0
#> SRR925704      3  0.2823      0.629 0.000 0.204 0.796 0.000 0.000  0
#> SRR925705      3  0.2340      0.727 0.000 0.148 0.852 0.000 0.000  0
#> SRR925706      4  0.0146      0.952 0.000 0.004 0.000 0.996 0.000  0
#> SRR925708      1  0.0000      0.959 1.000 0.000 0.000 0.000 0.000  0
#> SRR925707      4  0.0000      0.951 0.000 0.000 0.000 1.000 0.000  0
#> SRR925709      1  0.0000      0.959 1.000 0.000 0.000 0.000 0.000  0
#> SRR925710      3  0.5278     -0.119 0.464 0.048 0.468 0.004 0.016  0
#> SRR925711      6  0.0000      0.000 0.000 0.000 0.000 0.000 0.000  1
#> SRR934631      3  0.0260      0.800 0.000 0.008 0.992 0.000 0.000  0
#> SRR934632      3  0.0260      0.800 0.000 0.008 0.992 0.000 0.000  0
#> SRR934633      3  0.0260      0.800 0.000 0.008 0.992 0.000 0.000  0
#> SRR925713      1  0.4250      0.160 0.528 0.000 0.000 0.456 0.016  0
#> SRR925714      5  0.2300      0.806 0.144 0.000 0.000 0.000 0.856  0
#> SRR925715      4  0.2562      0.812 0.000 0.172 0.000 0.828 0.000  0
#> SRR925716      5  0.2300      0.806 0.144 0.000 0.000 0.000 0.856  0
#> SRR925717      1  0.1858      0.849 0.904 0.004 0.000 0.000 0.092  0
#> SRR925718      3  0.1765      0.768 0.000 0.096 0.904 0.000 0.000  0
#> SRR925719      1  0.0000      0.959 1.000 0.000 0.000 0.000 0.000  0
#> SRR925720      1  0.0000      0.959 1.000 0.000 0.000 0.000 0.000  0
#> SRR925721      1  0.0000      0.959 1.000 0.000 0.000 0.000 0.000  0
#> SRR934634      1  0.0000      0.959 1.000 0.000 0.000 0.000 0.000  0
#> SRR934635      1  0.0000      0.959 1.000 0.000 0.000 0.000 0.000  0
#> SRR925723      3  0.1765      0.768 0.000 0.096 0.904 0.000 0.000  0
#> SRR925724      2  0.2664      0.000 0.000 0.816 0.184 0.000 0.000  0
#> SRR925725      3  0.3817      0.115 0.000 0.432 0.568 0.000 0.000  0
#> SRR925726      5  0.3996      0.239 0.484 0.004 0.000 0.000 0.512  0
#> SRR925727      3  0.3810      0.115 0.000 0.428 0.572 0.000 0.000  0
#> SRR925728      4  0.0146      0.952 0.000 0.004 0.000 0.996 0.000  0
#> SRR934636      5  0.0000      0.654 0.000 0.000 0.000 0.000 1.000  0
#> SRR934637      5  0.0000      0.654 0.000 0.000 0.000 0.000 1.000  0
#> SRR925729      3  0.0146      0.800 0.000 0.004 0.996 0.000 0.000  0
#> SRR934638      1  0.0146      0.957 0.996 0.000 0.000 0.004 0.000  0
#> SRR934639      1  0.0146      0.957 0.996 0.000 0.000 0.004 0.000  0
#> SRR934640      3  0.0713      0.790 0.000 0.028 0.972 0.000 0.000  0
#> SRR934641      3  0.0713      0.790 0.000 0.028 0.972 0.000 0.000  0
#> SRR925734      1  0.0000      0.959 1.000 0.000 0.000 0.000 0.000  0
#> SRR925735      3  0.0405      0.798 0.004 0.008 0.988 0.000 0.000  0
#> SRR925736      3  0.2178      0.742 0.000 0.132 0.868 0.000 0.000  0
#> SRR925737      3  0.2178      0.742 0.000 0.132 0.868 0.000 0.000  0
#> SRR934642      3  0.3867     -0.154 0.000 0.488 0.512 0.000 0.000  0
#> SRR934643      3  0.3867     -0.154 0.000 0.488 0.512 0.000 0.000  0
#> SRR934644      3  0.0146      0.800 0.000 0.004 0.996 0.000 0.000  0
#> SRR934645      3  0.0146      0.800 0.000 0.004 0.996 0.000 0.000  0
#> SRR925740      3  0.1714      0.771 0.000 0.092 0.908 0.000 0.000  0
#> SRR925741      3  0.2854      0.628 0.000 0.208 0.792 0.000 0.000  0
#> SRR925742      3  0.1714      0.771 0.000 0.092 0.908 0.000 0.000  0
#> SRR1283038     3  0.1007      0.789 0.000 0.044 0.956 0.000 0.000  0

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

consensus_heatmap(res, k = 2)

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

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

collect_plots(res)

plot of chunk CV-kmeans-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 1.000           0.994       0.965         0.4766 0.492   0.492
#> 3 3 0.681           0.769       0.869         0.2624 0.970   0.940
#> 4 4 0.574           0.629       0.716         0.1292 0.886   0.757
#> 5 5 0.567           0.566       0.721         0.0838 0.845   0.587
#> 6 6 0.577           0.564       0.702         0.0506 0.986   0.939

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

suggest_best_k(res)
#> [1] 2

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

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

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>            class entropy silhouette    p1    p2
#> SRR925687      1  0.0000      0.995 1.000 0.000
#> SRR925688      1  0.0000      0.995 1.000 0.000
#> SRR925689      1  0.0000      0.995 1.000 0.000
#> SRR925690      1  0.0000      0.995 1.000 0.000
#> SRR925691      1  0.0000      0.995 1.000 0.000
#> SRR925692      1  0.0000      0.995 1.000 0.000
#> SRR925693      2  0.3584      0.997 0.068 0.932
#> SRR925694      2  0.3733      0.997 0.072 0.928
#> SRR925695      2  0.3584      0.997 0.068 0.932
#> SRR925697      1  0.0376      0.994 0.996 0.004
#> SRR925696      2  0.3431      0.995 0.064 0.936
#> SRR925698      2  0.3584      0.997 0.068 0.932
#> SRR925699      2  0.3733      0.997 0.072 0.928
#> SRR925700      2  0.3733      0.997 0.072 0.928
#> SRR925701      2  0.3733      0.997 0.072 0.928
#> SRR925702      1  0.0376      0.994 0.996 0.004
#> SRR925703      1  0.0376      0.994 0.996 0.004
#> SRR925704      2  0.3584      0.997 0.068 0.932
#> SRR925705      2  0.3584      0.997 0.068 0.932
#> SRR925706      1  0.0376      0.994 0.996 0.004
#> SRR925708      1  0.0000      0.995 1.000 0.000
#> SRR925707      1  0.2043      0.967 0.968 0.032
#> SRR925709      1  0.0000      0.995 1.000 0.000
#> SRR925710      1  0.0000      0.995 1.000 0.000
#> SRR925711      1  0.3879      0.927 0.924 0.076
#> SRR934631      2  0.3733      0.997 0.072 0.928
#> SRR934632      2  0.3733      0.997 0.072 0.928
#> SRR934633      2  0.3733      0.997 0.072 0.928
#> SRR925713      1  0.0376      0.994 0.996 0.004
#> SRR925714      1  0.0376      0.994 0.996 0.004
#> SRR925715      1  0.0376      0.994 0.996 0.004
#> SRR925716      1  0.0376      0.994 0.996 0.004
#> SRR925717      1  0.0376      0.994 0.996 0.004
#> SRR925718      2  0.3733      0.997 0.072 0.928
#> SRR925719      1  0.0000      0.995 1.000 0.000
#> SRR925720      1  0.0000      0.995 1.000 0.000
#> SRR925721      1  0.0000      0.995 1.000 0.000
#> SRR934634      1  0.0000      0.995 1.000 0.000
#> SRR934635      1  0.0000      0.995 1.000 0.000
#> SRR925723      2  0.3584      0.997 0.068 0.932
#> SRR925724      2  0.3431      0.995 0.064 0.936
#> SRR925725      2  0.3584      0.997 0.068 0.932
#> SRR925726      1  0.0376      0.994 0.996 0.004
#> SRR925727      2  0.3584      0.997 0.068 0.932
#> SRR925728      1  0.0376      0.994 0.996 0.004
#> SRR934636      1  0.0376      0.994 0.996 0.004
#> SRR934637      1  0.0376      0.994 0.996 0.004
#> SRR925729      2  0.3733      0.997 0.072 0.928
#> SRR934638      1  0.0000      0.995 1.000 0.000
#> SRR934639      1  0.0000      0.995 1.000 0.000
#> SRR934640      2  0.3733      0.997 0.072 0.928
#> SRR934641      2  0.3733      0.997 0.072 0.928
#> SRR925734      1  0.0000      0.995 1.000 0.000
#> SRR925735      2  0.3733      0.997 0.072 0.928
#> SRR925736      2  0.3584      0.997 0.068 0.932
#> SRR925737      2  0.3584      0.997 0.068 0.932
#> SRR934642      2  0.3584      0.995 0.068 0.932
#> SRR934643      2  0.3584      0.995 0.068 0.932
#> SRR934644      2  0.3733      0.997 0.072 0.928
#> SRR934645      2  0.3733      0.997 0.072 0.928
#> SRR925740      2  0.3584      0.997 0.068 0.932
#> SRR925741      2  0.3584      0.997 0.068 0.932
#> SRR925742      2  0.3584      0.997 0.068 0.932
#> SRR1283038     2  0.3584      0.997 0.068 0.932

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>            class entropy silhouette    p1    p2    p3
#> SRR925687      1  0.1163      0.786 0.972 0.000 0.028
#> SRR925688      1  0.1289      0.786 0.968 0.000 0.032
#> SRR925689      1  0.1753      0.785 0.952 0.000 0.048
#> SRR925690      1  0.1753      0.785 0.952 0.000 0.048
#> SRR925691      1  0.1753      0.785 0.952 0.000 0.048
#> SRR925692      1  0.1753      0.785 0.952 0.000 0.048
#> SRR925693      2  0.4121      0.872 0.000 0.832 0.168
#> SRR925694      2  0.1411      0.899 0.000 0.964 0.036
#> SRR925695      2  0.2537      0.909 0.000 0.920 0.080
#> SRR925697      1  0.5591      0.564 0.696 0.000 0.304
#> SRR925696      2  0.4555      0.872 0.000 0.800 0.200
#> SRR925698      2  0.3482      0.903 0.000 0.872 0.128
#> SRR925699      2  0.2165      0.906 0.000 0.936 0.064
#> SRR925700      2  0.2261      0.906 0.000 0.932 0.068
#> SRR925701      2  0.2356      0.906 0.000 0.928 0.072
#> SRR925702      1  0.5529      0.542 0.704 0.000 0.296
#> SRR925703      1  0.5591      0.564 0.696 0.000 0.304
#> SRR925704      2  0.2261      0.907 0.000 0.932 0.068
#> SRR925705      2  0.4346      0.881 0.000 0.816 0.184
#> SRR925706      1  0.6225      0.156 0.568 0.000 0.432
#> SRR925708      1  0.1163      0.787 0.972 0.000 0.028
#> SRR925707      3  0.9228      0.349 0.380 0.156 0.464
#> SRR925709      1  0.3116      0.733 0.892 0.000 0.108
#> SRR925710      1  0.4095      0.707 0.880 0.056 0.064
#> SRR925711      3  0.3987      0.545 0.108 0.020 0.872
#> SRR934631      2  0.1289      0.900 0.000 0.968 0.032
#> SRR934632      2  0.1289      0.900 0.000 0.968 0.032
#> SRR934633      2  0.1289      0.900 0.000 0.968 0.032
#> SRR925713      1  0.5497      0.546 0.708 0.000 0.292
#> SRR925714      1  0.5591      0.564 0.696 0.000 0.304
#> SRR925715      1  0.6095      0.226 0.608 0.000 0.392
#> SRR925716      1  0.5497      0.574 0.708 0.000 0.292
#> SRR925717      1  0.1860      0.784 0.948 0.000 0.052
#> SRR925718      2  0.2537      0.906 0.000 0.920 0.080
#> SRR925719      1  0.1289      0.788 0.968 0.000 0.032
#> SRR925720      1  0.1163      0.786 0.972 0.000 0.028
#> SRR925721      1  0.1163      0.786 0.972 0.000 0.028
#> SRR934634      1  0.1163      0.786 0.972 0.000 0.028
#> SRR934635      1  0.1163      0.786 0.972 0.000 0.028
#> SRR925723      2  0.3482      0.903 0.000 0.872 0.128
#> SRR925724      2  0.5058      0.840 0.000 0.756 0.244
#> SRR925725      2  0.3816      0.882 0.000 0.852 0.148
#> SRR925726      1  0.1643      0.785 0.956 0.000 0.044
#> SRR925727      2  0.4291      0.880 0.000 0.820 0.180
#> SRR925728      1  0.6215      0.171 0.572 0.000 0.428
#> SRR934636      1  0.5529      0.572 0.704 0.000 0.296
#> SRR934637      1  0.5529      0.572 0.704 0.000 0.296
#> SRR925729      2  0.1411      0.899 0.000 0.964 0.036
#> SRR934638      1  0.0424      0.790 0.992 0.000 0.008
#> SRR934639      1  0.0424      0.790 0.992 0.000 0.008
#> SRR934640      2  0.3816      0.803 0.000 0.852 0.148
#> SRR934641      2  0.3816      0.803 0.000 0.852 0.148
#> SRR925734      1  0.1289      0.786 0.968 0.000 0.032
#> SRR925735      2  0.1860      0.908 0.000 0.948 0.052
#> SRR925736      2  0.4062      0.889 0.000 0.836 0.164
#> SRR925737      2  0.4062      0.889 0.000 0.836 0.164
#> SRR934642      2  0.3941      0.882 0.000 0.844 0.156
#> SRR934643      2  0.3941      0.882 0.000 0.844 0.156
#> SRR934644      2  0.1411      0.899 0.000 0.964 0.036
#> SRR934645      2  0.1411      0.899 0.000 0.964 0.036
#> SRR925740      2  0.3192      0.907 0.000 0.888 0.112
#> SRR925741      2  0.2261      0.906 0.000 0.932 0.068
#> SRR925742      2  0.2959      0.909 0.000 0.900 0.100
#> SRR1283038     2  0.1753      0.909 0.000 0.952 0.048

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> SRR925687      1  0.5229     0.8107 0.564 0.008 0.000 0.428
#> SRR925688      1  0.5229     0.8107 0.564 0.008 0.000 0.428
#> SRR925689      1  0.5917     0.6957 0.520 0.036 0.000 0.444
#> SRR925690      1  0.5917     0.6957 0.520 0.036 0.000 0.444
#> SRR925691      1  0.5917     0.6957 0.520 0.036 0.000 0.444
#> SRR925692      1  0.5917     0.6957 0.520 0.036 0.000 0.444
#> SRR925693      3  0.3479     0.7175 0.012 0.148 0.840 0.000
#> SRR925694      3  0.4564     0.7153 0.000 0.328 0.672 0.000
#> SRR925695      3  0.0672     0.7669 0.008 0.008 0.984 0.000
#> SRR925697      4  0.0000     0.6111 0.000 0.000 0.000 1.000
#> SRR925696      3  0.4088     0.7173 0.004 0.232 0.764 0.000
#> SRR925698      3  0.2921     0.7553 0.000 0.140 0.860 0.000
#> SRR925699      3  0.4830     0.7411 0.000 0.392 0.608 0.000
#> SRR925700      3  0.4830     0.7411 0.000 0.392 0.608 0.000
#> SRR925701      3  0.4843     0.7396 0.000 0.396 0.604 0.000
#> SRR925702      4  0.6391     0.4222 0.328 0.084 0.000 0.588
#> SRR925703      4  0.0000     0.6111 0.000 0.000 0.000 1.000
#> SRR925704      3  0.1452     0.7606 0.008 0.036 0.956 0.000
#> SRR925705      3  0.3801     0.7276 0.000 0.220 0.780 0.000
#> SRR925706      4  0.7193     0.3210 0.340 0.152 0.000 0.508
#> SRR925708      1  0.5088     0.8110 0.572 0.004 0.000 0.424
#> SRR925707      4  0.8464    -0.0216 0.288 0.212 0.040 0.460
#> SRR925709      1  0.5677     0.6051 0.628 0.040 0.000 0.332
#> SRR925710      1  0.8057     0.4572 0.532 0.096 0.076 0.296
#> SRR925711      2  0.8131     0.0000 0.340 0.428 0.016 0.216
#> SRR934631      3  0.4134     0.7359 0.000 0.260 0.740 0.000
#> SRR934632      3  0.4134     0.7359 0.000 0.260 0.740 0.000
#> SRR934633      3  0.4134     0.7359 0.000 0.260 0.740 0.000
#> SRR925713      4  0.6394     0.4276 0.316 0.088 0.000 0.596
#> SRR925714      4  0.0000     0.6111 0.000 0.000 0.000 1.000
#> SRR925715      1  0.7526    -0.3097 0.468 0.200 0.000 0.332
#> SRR925716      4  0.0188     0.6078 0.004 0.000 0.000 0.996
#> SRR925717      4  0.5366    -0.6810 0.440 0.012 0.000 0.548
#> SRR925718      3  0.4500     0.7573 0.000 0.316 0.684 0.000
#> SRR925719      1  0.5097     0.8092 0.568 0.004 0.000 0.428
#> SRR925720      1  0.5229     0.8107 0.564 0.008 0.000 0.428
#> SRR925721      1  0.5229     0.8107 0.564 0.008 0.000 0.428
#> SRR934634      1  0.5220     0.8111 0.568 0.008 0.000 0.424
#> SRR934635      1  0.5220     0.8111 0.568 0.008 0.000 0.424
#> SRR925723      3  0.2921     0.7553 0.000 0.140 0.860 0.000
#> SRR925724      3  0.4831     0.6743 0.016 0.280 0.704 0.000
#> SRR925725      3  0.2988     0.7303 0.012 0.112 0.876 0.000
#> SRR925726      4  0.3893     0.1376 0.196 0.008 0.000 0.796
#> SRR925727      3  0.3105     0.7427 0.012 0.120 0.868 0.000
#> SRR925728      4  0.7122     0.3406 0.340 0.144 0.000 0.516
#> SRR934636      4  0.0937     0.6065 0.012 0.012 0.000 0.976
#> SRR934637      4  0.0937     0.6065 0.012 0.012 0.000 0.976
#> SRR925729      3  0.4564     0.7153 0.000 0.328 0.672 0.000
#> SRR934638      1  0.5250     0.7889 0.552 0.008 0.000 0.440
#> SRR934639      1  0.5250     0.7889 0.552 0.008 0.000 0.440
#> SRR934640      3  0.6648     0.5620 0.092 0.372 0.536 0.000
#> SRR934641      3  0.6648     0.5620 0.092 0.372 0.536 0.000
#> SRR925734      1  0.5203     0.8104 0.576 0.008 0.000 0.416
#> SRR925735      3  0.3448     0.7555 0.004 0.168 0.828 0.000
#> SRR925736      3  0.4343     0.7381 0.004 0.264 0.732 0.000
#> SRR925737      3  0.4343     0.7381 0.004 0.264 0.732 0.000
#> SRR934642      3  0.5217     0.7170 0.012 0.380 0.608 0.000
#> SRR934643      3  0.5217     0.7170 0.012 0.380 0.608 0.000
#> SRR934644      3  0.4477     0.7174 0.000 0.312 0.688 0.000
#> SRR934645      3  0.4477     0.7174 0.000 0.312 0.688 0.000
#> SRR925740      3  0.3649     0.7511 0.000 0.204 0.796 0.000
#> SRR925741      3  0.2473     0.7535 0.012 0.080 0.908 0.000
#> SRR925742      3  0.3356     0.7617 0.000 0.176 0.824 0.000
#> SRR1283038     3  0.1716     0.7605 0.000 0.064 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
#> SRR925687      1  0.0693     0.7753 0.980 0.008 0.000 0.000 0.012
#> SRR925688      1  0.0693     0.7753 0.980 0.008 0.000 0.000 0.012
#> SRR925689      1  0.5953     0.5647 0.660 0.048 0.000 0.088 0.204
#> SRR925690      1  0.5953     0.5647 0.660 0.048 0.000 0.088 0.204
#> SRR925691      1  0.5953     0.5647 0.660 0.048 0.000 0.088 0.204
#> SRR925692      1  0.5953     0.5647 0.660 0.048 0.000 0.088 0.204
#> SRR925693      3  0.5374     0.1442 0.000 0.376 0.568 0.004 0.052
#> SRR925694      2  0.4132     0.7298 0.000 0.720 0.260 0.000 0.020
#> SRR925695      3  0.5071     0.2307 0.000 0.340 0.616 0.004 0.040
#> SRR925697      5  0.6534     0.9421 0.328 0.000 0.000 0.212 0.460
#> SRR925696      3  0.0451     0.5617 0.000 0.000 0.988 0.004 0.008
#> SRR925698      3  0.2573     0.5679 0.000 0.104 0.880 0.000 0.016
#> SRR925699      3  0.4894    -0.0139 0.000 0.456 0.520 0.000 0.024
#> SRR925700      3  0.4894    -0.0139 0.000 0.456 0.520 0.000 0.024
#> SRR925701      3  0.4833     0.1103 0.000 0.412 0.564 0.000 0.024
#> SRR925702      4  0.3707     0.6116 0.284 0.000 0.000 0.716 0.000
#> SRR925703      5  0.6534     0.9421 0.328 0.000 0.000 0.212 0.460
#> SRR925704      3  0.5185     0.1355 0.000 0.376 0.580 0.004 0.040
#> SRR925705      3  0.0451     0.5617 0.000 0.000 0.988 0.004 0.008
#> SRR925706      4  0.2629     0.7346 0.136 0.004 0.000 0.860 0.000
#> SRR925708      1  0.0566     0.7770 0.984 0.000 0.000 0.012 0.004
#> SRR925707      4  0.3282     0.7059 0.092 0.024 0.024 0.860 0.000
#> SRR925709      1  0.4165     0.3859 0.672 0.000 0.000 0.320 0.008
#> SRR925710      1  0.6768     0.1392 0.544 0.132 0.004 0.288 0.032
#> SRR925711      4  0.6620     0.3546 0.000 0.160 0.016 0.512 0.312
#> SRR934631      2  0.4400     0.6909 0.000 0.672 0.308 0.000 0.020
#> SRR934632      2  0.4400     0.6909 0.000 0.672 0.308 0.000 0.020
#> SRR934633      2  0.4400     0.6909 0.000 0.672 0.308 0.000 0.020
#> SRR925713      4  0.3730     0.6097 0.288 0.000 0.000 0.712 0.000
#> SRR925714      5  0.6534     0.9421 0.328 0.000 0.000 0.212 0.460
#> SRR925715      4  0.5865     0.6507 0.228 0.056 0.000 0.656 0.060
#> SRR925716      5  0.6503     0.9406 0.332 0.000 0.000 0.204 0.464
#> SRR925717      1  0.4216     0.6345 0.780 0.000 0.000 0.120 0.100
#> SRR925718      3  0.4193     0.3617 0.000 0.304 0.684 0.000 0.012
#> SRR925719      1  0.0566     0.7761 0.984 0.000 0.000 0.012 0.004
#> SRR925720      1  0.0579     0.7760 0.984 0.008 0.000 0.000 0.008
#> SRR925721      1  0.0579     0.7760 0.984 0.008 0.000 0.000 0.008
#> SRR934634      1  0.0854     0.7764 0.976 0.008 0.000 0.004 0.012
#> SRR934635      1  0.0854     0.7764 0.976 0.008 0.000 0.004 0.012
#> SRR925723      3  0.2304     0.5715 0.000 0.100 0.892 0.000 0.008
#> SRR925724      3  0.1954     0.5382 0.000 0.032 0.932 0.008 0.028
#> SRR925725      3  0.5341     0.1606 0.000 0.364 0.580 0.004 0.052
#> SRR925726      5  0.6160     0.7732 0.420 0.000 0.000 0.132 0.448
#> SRR925727      3  0.4615     0.4329 0.000 0.220 0.724 0.004 0.052
#> SRR925728      4  0.2629     0.7346 0.136 0.004 0.000 0.860 0.000
#> SRR934636      5  0.6586     0.9192 0.300 0.004 0.000 0.208 0.488
#> SRR934637      5  0.6586     0.9192 0.300 0.004 0.000 0.208 0.488
#> SRR925729      2  0.4132     0.7298 0.000 0.720 0.260 0.000 0.020
#> SRR934638      1  0.2949     0.7470 0.880 0.012 0.000 0.072 0.036
#> SRR934639      1  0.2949     0.7470 0.880 0.012 0.000 0.072 0.036
#> SRR934640      2  0.7112     0.4309 0.000 0.544 0.212 0.180 0.064
#> SRR934641      2  0.7112     0.4309 0.000 0.544 0.212 0.180 0.064
#> SRR925734      1  0.0693     0.7793 0.980 0.000 0.000 0.012 0.008
#> SRR925735      2  0.4974     0.1547 0.000 0.508 0.464 0.000 0.028
#> SRR925736      3  0.2835     0.5623 0.000 0.112 0.868 0.004 0.016
#> SRR925737      3  0.2835     0.5623 0.000 0.112 0.868 0.004 0.016
#> SRR934642      3  0.3777     0.4242 0.000 0.192 0.784 0.004 0.020
#> SRR934643      3  0.3777     0.4242 0.000 0.192 0.784 0.004 0.020
#> SRR934644      2  0.4132     0.7298 0.000 0.720 0.260 0.000 0.020
#> SRR934645      2  0.4132     0.7298 0.000 0.720 0.260 0.000 0.020
#> SRR925740      3  0.2124     0.5771 0.000 0.096 0.900 0.000 0.004
#> SRR925741      3  0.5199     0.0346 0.000 0.412 0.548 0.004 0.036
#> SRR925742      3  0.2707     0.5652 0.000 0.132 0.860 0.000 0.008
#> SRR1283038     3  0.4866     0.0677 0.000 0.392 0.580 0.000 0.028

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>            class entropy silhouette    p1    p2    p3    p4    p5    p6
#> SRR925687      1  0.0405     0.7867 0.988 0.000 0.000 0.008 0.000 0.004
#> SRR925688      1  0.0405     0.7867 0.988 0.000 0.000 0.008 0.000 0.004
#> SRR925689      1  0.7180     0.5531 0.556 0.120 0.000 0.088 0.156 0.080
#> SRR925690      1  0.7180     0.5531 0.556 0.120 0.000 0.088 0.156 0.080
#> SRR925691      1  0.7180     0.5531 0.556 0.120 0.000 0.088 0.156 0.080
#> SRR925692      1  0.7180     0.5531 0.556 0.120 0.000 0.088 0.156 0.080
#> SRR925693      3  0.5841     0.1060 0.000 0.328 0.488 0.000 0.004 0.180
#> SRR925694      2  0.4097     0.7036 0.000 0.712 0.256 0.016 0.008 0.008
#> SRR925695      3  0.5318     0.2460 0.000 0.272 0.580 0.000 0.000 0.148
#> SRR925697      5  0.3202     0.9496 0.176 0.000 0.000 0.024 0.800 0.000
#> SRR925696      3  0.2322     0.5534 0.000 0.016 0.912 0.024 0.016 0.032
#> SRR925698      3  0.2724     0.5430 0.000 0.052 0.864 0.000 0.000 0.084
#> SRR925699      3  0.4932     0.0702 0.000 0.392 0.560 0.008 0.028 0.012
#> SRR925700      3  0.4932     0.0702 0.000 0.392 0.560 0.008 0.028 0.012
#> SRR925701      3  0.4786     0.1220 0.000 0.368 0.588 0.008 0.028 0.008
#> SRR925702      4  0.4200     0.7509 0.140 0.000 0.000 0.740 0.120 0.000
#> SRR925703      5  0.3202     0.9496 0.176 0.000 0.000 0.024 0.800 0.000
#> SRR925704      3  0.5382     0.2133 0.000 0.288 0.564 0.000 0.000 0.148
#> SRR925705      3  0.1994     0.5588 0.000 0.016 0.928 0.016 0.016 0.024
#> SRR925706      4  0.3368     0.7483 0.060 0.000 0.000 0.820 0.116 0.004
#> SRR925708      1  0.0603     0.7863 0.980 0.000 0.000 0.016 0.004 0.000
#> SRR925707      4  0.3514     0.7221 0.040 0.008 0.008 0.828 0.112 0.004
#> SRR925709      1  0.3982    -0.0650 0.536 0.000 0.000 0.460 0.004 0.000
#> SRR925710      4  0.6895     0.3416 0.336 0.172 0.008 0.440 0.028 0.016
#> SRR925711      6  0.4448     0.0000 0.000 0.008 0.000 0.252 0.052 0.688
#> SRR934631      2  0.4675     0.6543 0.000 0.628 0.324 0.008 0.004 0.036
#> SRR934632      2  0.4675     0.6543 0.000 0.628 0.324 0.008 0.004 0.036
#> SRR934633      2  0.4675     0.6543 0.000 0.628 0.324 0.008 0.004 0.036
#> SRR925713      4  0.4203     0.7492 0.136 0.000 0.000 0.740 0.124 0.000
#> SRR925714      5  0.3202     0.9496 0.176 0.000 0.000 0.024 0.800 0.000
#> SRR925715      4  0.4870     0.6347 0.124 0.076 0.000 0.744 0.036 0.020
#> SRR925716      5  0.3156     0.9484 0.180 0.000 0.000 0.020 0.800 0.000
#> SRR925717      1  0.5344     0.5096 0.644 0.020 0.000 0.144 0.192 0.000
#> SRR925718      3  0.3517     0.4220 0.000 0.204 0.772 0.000 0.012 0.012
#> SRR925719      1  0.0777     0.7835 0.972 0.000 0.000 0.024 0.004 0.000
#> SRR925720      1  0.0520     0.7870 0.984 0.000 0.000 0.008 0.000 0.008
#> SRR925721      1  0.0520     0.7870 0.984 0.000 0.000 0.008 0.000 0.008
#> SRR934634      1  0.0405     0.7871 0.988 0.000 0.000 0.004 0.000 0.008
#> SRR934635      1  0.0405     0.7871 0.988 0.000 0.000 0.004 0.000 0.008
#> SRR925723      3  0.1464     0.5670 0.000 0.036 0.944 0.000 0.004 0.016
#> SRR925724      3  0.3738     0.5334 0.000 0.032 0.820 0.020 0.020 0.108
#> SRR925725      3  0.5874     0.1663 0.000 0.300 0.516 0.004 0.004 0.176
#> SRR925726      5  0.3745     0.8787 0.240 0.000 0.000 0.028 0.732 0.000
#> SRR925727      3  0.4798     0.4089 0.000 0.156 0.672 0.000 0.000 0.172
#> SRR925728      4  0.3368     0.7483 0.060 0.000 0.000 0.820 0.116 0.004
#> SRR934636      5  0.4192     0.9107 0.172 0.028 0.000 0.012 0.764 0.024
#> SRR934637      5  0.4192     0.9107 0.172 0.028 0.000 0.012 0.764 0.024
#> SRR925729      2  0.4097     0.7036 0.000 0.712 0.256 0.016 0.008 0.008
#> SRR934638      1  0.3938     0.7400 0.820 0.052 0.000 0.072 0.032 0.024
#> SRR934639      1  0.3938     0.7400 0.820 0.052 0.000 0.072 0.032 0.024
#> SRR934640      2  0.6800     0.4312 0.000 0.548 0.168 0.192 0.024 0.068
#> SRR934641      2  0.6800     0.4312 0.000 0.548 0.168 0.192 0.024 0.068
#> SRR925734      1  0.0363     0.7881 0.988 0.000 0.000 0.012 0.000 0.000
#> SRR925735      2  0.5725     0.1461 0.000 0.464 0.432 0.016 0.008 0.080
#> SRR925736      3  0.2945     0.5491 0.000 0.040 0.880 0.016 0.032 0.032
#> SRR925737      3  0.2945     0.5491 0.000 0.040 0.880 0.016 0.032 0.032
#> SRR934642      3  0.5205     0.4236 0.000 0.164 0.708 0.020 0.044 0.064
#> SRR934643      3  0.5205     0.4236 0.000 0.164 0.708 0.020 0.044 0.064
#> SRR934644      2  0.3767     0.7097 0.000 0.720 0.260 0.016 0.004 0.000
#> SRR934645      2  0.3767     0.7097 0.000 0.720 0.260 0.016 0.004 0.000
#> SRR925740      3  0.1837     0.5695 0.000 0.032 0.932 0.004 0.012 0.020
#> SRR925741      3  0.5674     0.0590 0.000 0.356 0.496 0.000 0.004 0.144
#> SRR925742      3  0.2034     0.5658 0.000 0.044 0.920 0.004 0.008 0.024
#> SRR1283038     3  0.5206     0.1636 0.000 0.312 0.572 0.000 0.000 0.116

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

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

collect_plots(res)

plot of chunk CV-skmeans-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 1.000           0.998       0.999         0.5084 0.492   0.492
#> 3 3 0.753           0.891       0.893         0.2482 0.877   0.751
#> 4 4 0.729           0.695       0.851         0.1701 0.875   0.669
#> 5 5 0.720           0.548       0.781         0.0651 0.910   0.679
#> 6 6 0.727           0.484       0.751         0.0417 0.906   0.631

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
#> SRR925687      1   0.000      0.998 1.000 0.000
#> SRR925688      1   0.000      0.998 1.000 0.000
#> SRR925689      1   0.000      0.998 1.000 0.000
#> SRR925690      1   0.000      0.998 1.000 0.000
#> SRR925691      1   0.000      0.998 1.000 0.000
#> SRR925692      1   0.000      0.998 1.000 0.000
#> SRR925693      2   0.000      1.000 0.000 1.000
#> SRR925694      2   0.000      1.000 0.000 1.000
#> SRR925695      2   0.000      1.000 0.000 1.000
#> SRR925697      1   0.000      0.998 1.000 0.000
#> SRR925696      2   0.000      1.000 0.000 1.000
#> SRR925698      2   0.000      1.000 0.000 1.000
#> SRR925699      2   0.000      1.000 0.000 1.000
#> SRR925700      2   0.000      1.000 0.000 1.000
#> SRR925701      2   0.000      1.000 0.000 1.000
#> SRR925702      1   0.000      0.998 1.000 0.000
#> SRR925703      1   0.000      0.998 1.000 0.000
#> SRR925704      2   0.000      1.000 0.000 1.000
#> SRR925705      2   0.000      1.000 0.000 1.000
#> SRR925706      1   0.000      0.998 1.000 0.000
#> SRR925708      1   0.000      0.998 1.000 0.000
#> SRR925707      1   0.358      0.927 0.932 0.068
#> SRR925709      1   0.000      0.998 1.000 0.000
#> SRR925710      1   0.000      0.998 1.000 0.000
#> SRR925711      1   0.000      0.998 1.000 0.000
#> SRR934631      2   0.000      1.000 0.000 1.000
#> SRR934632      2   0.000      1.000 0.000 1.000
#> SRR934633      2   0.000      1.000 0.000 1.000
#> SRR925713      1   0.000      0.998 1.000 0.000
#> SRR925714      1   0.000      0.998 1.000 0.000
#> SRR925715      1   0.000      0.998 1.000 0.000
#> SRR925716      1   0.000      0.998 1.000 0.000
#> SRR925717      1   0.000      0.998 1.000 0.000
#> SRR925718      2   0.000      1.000 0.000 1.000
#> SRR925719      1   0.000      0.998 1.000 0.000
#> SRR925720      1   0.000      0.998 1.000 0.000
#> SRR925721      1   0.000      0.998 1.000 0.000
#> SRR934634      1   0.000      0.998 1.000 0.000
#> SRR934635      1   0.000      0.998 1.000 0.000
#> SRR925723      2   0.000      1.000 0.000 1.000
#> SRR925724      2   0.000      1.000 0.000 1.000
#> SRR925725      2   0.000      1.000 0.000 1.000
#> SRR925726      1   0.000      0.998 1.000 0.000
#> SRR925727      2   0.000      1.000 0.000 1.000
#> SRR925728      1   0.000      0.998 1.000 0.000
#> SRR934636      1   0.000      0.998 1.000 0.000
#> SRR934637      1   0.000      0.998 1.000 0.000
#> SRR925729      2   0.000      1.000 0.000 1.000
#> SRR934638      1   0.000      0.998 1.000 0.000
#> SRR934639      1   0.000      0.998 1.000 0.000
#> SRR934640      2   0.000      1.000 0.000 1.000
#> SRR934641      2   0.000      1.000 0.000 1.000
#> SRR925734      1   0.000      0.998 1.000 0.000
#> SRR925735      2   0.000      1.000 0.000 1.000
#> SRR925736      2   0.000      1.000 0.000 1.000
#> SRR925737      2   0.000      1.000 0.000 1.000
#> SRR934642      2   0.000      1.000 0.000 1.000
#> SRR934643      2   0.000      1.000 0.000 1.000
#> SRR934644      2   0.000      1.000 0.000 1.000
#> SRR934645      2   0.000      1.000 0.000 1.000
#> SRR925740      2   0.000      1.000 0.000 1.000
#> SRR925741      2   0.000      1.000 0.000 1.000
#> SRR925742      2   0.000      1.000 0.000 1.000
#> SRR1283038     2   0.000      1.000 0.000 1.000

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>            class entropy silhouette    p1    p2    p3
#> SRR925687      1  0.0000      0.960 1.000 0.000 0.000
#> SRR925688      1  0.0000      0.960 1.000 0.000 0.000
#> SRR925689      1  0.0592      0.953 0.988 0.000 0.012
#> SRR925690      1  0.0592      0.953 0.988 0.000 0.012
#> SRR925691      1  0.0592      0.953 0.988 0.000 0.012
#> SRR925692      1  0.0592      0.953 0.988 0.000 0.012
#> SRR925693      2  0.0892      0.908 0.000 0.980 0.020
#> SRR925694      2  0.4452      0.896 0.000 0.808 0.192
#> SRR925695      2  0.0592      0.910 0.000 0.988 0.012
#> SRR925697      3  0.5216      0.886 0.260 0.000 0.740
#> SRR925696      2  0.0592      0.909 0.000 0.988 0.012
#> SRR925698      2  0.0592      0.909 0.000 0.988 0.012
#> SRR925699      2  0.4346      0.897 0.000 0.816 0.184
#> SRR925700      2  0.4399      0.897 0.000 0.812 0.188
#> SRR925701      2  0.4399      0.897 0.000 0.812 0.188
#> SRR925702      3  0.4842      0.882 0.224 0.000 0.776
#> SRR925703      3  0.5216      0.886 0.260 0.000 0.740
#> SRR925704      2  0.0592      0.910 0.000 0.988 0.012
#> SRR925705      2  0.0592      0.909 0.000 0.988 0.012
#> SRR925706      3  0.4750      0.880 0.216 0.000 0.784
#> SRR925708      1  0.0000      0.960 1.000 0.000 0.000
#> SRR925707      3  0.2056      0.697 0.024 0.024 0.952
#> SRR925709      1  0.1860      0.905 0.948 0.000 0.052
#> SRR925710      1  0.1860      0.907 0.948 0.000 0.052
#> SRR925711      3  0.5331      0.687 0.024 0.184 0.792
#> SRR934631      2  0.4452      0.896 0.000 0.808 0.192
#> SRR934632      2  0.4452      0.896 0.000 0.808 0.192
#> SRR934633      2  0.4452      0.896 0.000 0.808 0.192
#> SRR925713      3  0.4796      0.881 0.220 0.000 0.780
#> SRR925714      3  0.5216      0.886 0.260 0.000 0.740
#> SRR925715      3  0.6168      0.601 0.412 0.000 0.588
#> SRR925716      3  0.5216      0.886 0.260 0.000 0.740
#> SRR925717      1  0.1964      0.909 0.944 0.000 0.056
#> SRR925718      2  0.4399      0.898 0.000 0.812 0.188
#> SRR925719      1  0.0000      0.960 1.000 0.000 0.000
#> SRR925720      1  0.0000      0.960 1.000 0.000 0.000
#> SRR925721      1  0.0000      0.960 1.000 0.000 0.000
#> SRR934634      1  0.0000      0.960 1.000 0.000 0.000
#> SRR934635      1  0.0000      0.960 1.000 0.000 0.000
#> SRR925723      2  0.0592      0.909 0.000 0.988 0.012
#> SRR925724      2  0.0592      0.909 0.000 0.988 0.012
#> SRR925725      2  0.0747      0.909 0.000 0.984 0.016
#> SRR925726      1  0.5785      0.272 0.668 0.000 0.332
#> SRR925727      2  0.0424      0.909 0.000 0.992 0.008
#> SRR925728      3  0.4750      0.880 0.216 0.000 0.784
#> SRR934636      3  0.5216      0.886 0.260 0.000 0.740
#> SRR934637      3  0.5216      0.886 0.260 0.000 0.740
#> SRR925729      2  0.4452      0.896 0.000 0.808 0.192
#> SRR934638      1  0.0000      0.960 1.000 0.000 0.000
#> SRR934639      1  0.0000      0.960 1.000 0.000 0.000
#> SRR934640      2  0.5098      0.862 0.000 0.752 0.248
#> SRR934641      2  0.5098      0.862 0.000 0.752 0.248
#> SRR925734      1  0.0000      0.960 1.000 0.000 0.000
#> SRR925735      2  0.0892      0.910 0.000 0.980 0.020
#> SRR925736      2  0.0592      0.909 0.000 0.988 0.012
#> SRR925737      2  0.0592      0.909 0.000 0.988 0.012
#> SRR934642      2  0.4399      0.898 0.000 0.812 0.188
#> SRR934643      2  0.4399      0.898 0.000 0.812 0.188
#> SRR934644      2  0.4452      0.896 0.000 0.808 0.192
#> SRR934645      2  0.4452      0.896 0.000 0.808 0.192
#> SRR925740      2  0.0592      0.909 0.000 0.988 0.012
#> SRR925741      2  0.0747      0.910 0.000 0.984 0.016
#> SRR925742      2  0.0747      0.910 0.000 0.984 0.016
#> SRR1283038     2  0.0592      0.910 0.000 0.988 0.012

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> SRR925687      1  0.0188    0.94784 0.996 0.000 0.000 0.004
#> SRR925688      1  0.0188    0.94784 0.996 0.000 0.000 0.004
#> SRR925689      1  0.1297    0.93513 0.964 0.016 0.000 0.020
#> SRR925690      1  0.1297    0.93513 0.964 0.016 0.000 0.020
#> SRR925691      1  0.1297    0.93513 0.964 0.016 0.000 0.020
#> SRR925692      1  0.1297    0.93513 0.964 0.016 0.000 0.020
#> SRR925693      3  0.4941    0.13342 0.000 0.436 0.564 0.000
#> SRR925694      2  0.3649    0.82929 0.000 0.796 0.204 0.000
#> SRR925695      3  0.4382    0.38626 0.000 0.296 0.704 0.000
#> SRR925697      4  0.1022    0.85132 0.032 0.000 0.000 0.968
#> SRR925696      3  0.0000    0.67965 0.000 0.000 1.000 0.000
#> SRR925698      3  0.0469    0.67979 0.000 0.012 0.988 0.000
#> SRR925699      3  0.4916    0.14849 0.000 0.424 0.576 0.000
#> SRR925700      3  0.4877    0.18848 0.000 0.408 0.592 0.000
#> SRR925701      3  0.4843    0.20424 0.000 0.396 0.604 0.000
#> SRR925702      4  0.3813    0.84761 0.024 0.148 0.000 0.828
#> SRR925703      4  0.1022    0.85132 0.032 0.000 0.000 0.968
#> SRR925704      3  0.4746    0.22774 0.000 0.368 0.632 0.000
#> SRR925705      3  0.0000    0.67965 0.000 0.000 1.000 0.000
#> SRR925706      4  0.3450    0.84516 0.008 0.156 0.000 0.836
#> SRR925708      1  0.0188    0.94784 0.996 0.000 0.000 0.004
#> SRR925707      4  0.3727    0.84063 0.008 0.164 0.004 0.824
#> SRR925709      1  0.3638    0.81575 0.848 0.120 0.000 0.032
#> SRR925710      1  0.5279    0.67668 0.716 0.232 0.000 0.052
#> SRR925711      4  0.4359    0.82743 0.008 0.176 0.020 0.796
#> SRR934631      2  0.3975    0.81826 0.000 0.760 0.240 0.000
#> SRR934632      2  0.3975    0.81826 0.000 0.760 0.240 0.000
#> SRR934633      2  0.3975    0.81826 0.000 0.760 0.240 0.000
#> SRR925713      4  0.3401    0.84599 0.008 0.152 0.000 0.840
#> SRR925714      4  0.1022    0.85132 0.032 0.000 0.000 0.968
#> SRR925715      4  0.7143    0.58998 0.232 0.208 0.000 0.560
#> SRR925716      4  0.1211    0.84891 0.040 0.000 0.000 0.960
#> SRR925717      1  0.4511    0.63856 0.724 0.008 0.000 0.268
#> SRR925718      3  0.3975    0.49852 0.000 0.240 0.760 0.000
#> SRR925719      1  0.0707    0.94068 0.980 0.000 0.000 0.020
#> SRR925720      1  0.0188    0.94784 0.996 0.000 0.000 0.004
#> SRR925721      1  0.0188    0.94784 0.996 0.000 0.000 0.004
#> SRR934634      1  0.0188    0.94784 0.996 0.000 0.000 0.004
#> SRR934635      1  0.0188    0.94784 0.996 0.000 0.000 0.004
#> SRR925723      3  0.0336    0.67987 0.000 0.008 0.992 0.000
#> SRR925724      3  0.0336    0.67756 0.000 0.008 0.992 0.000
#> SRR925725      3  0.4761    0.23393 0.000 0.372 0.628 0.000
#> SRR925726      4  0.5277    0.02027 0.460 0.008 0.000 0.532
#> SRR925727      3  0.2589    0.62037 0.000 0.116 0.884 0.000
#> SRR925728      4  0.3450    0.84516 0.008 0.156 0.000 0.836
#> SRR934636      4  0.1118    0.85041 0.036 0.000 0.000 0.964
#> SRR934637      4  0.1118    0.85041 0.036 0.000 0.000 0.964
#> SRR925729      2  0.3649    0.82929 0.000 0.796 0.204 0.000
#> SRR934638      1  0.0188    0.94784 0.996 0.000 0.000 0.004
#> SRR934639      1  0.0188    0.94784 0.996 0.000 0.000 0.004
#> SRR934640      2  0.1406    0.63661 0.000 0.960 0.024 0.016
#> SRR934641      2  0.1406    0.63661 0.000 0.960 0.024 0.016
#> SRR925734      1  0.0000    0.94614 1.000 0.000 0.000 0.000
#> SRR925735      2  0.4776    0.44279 0.000 0.624 0.376 0.000
#> SRR925736      3  0.0592    0.67847 0.000 0.016 0.984 0.000
#> SRR925737      3  0.0592    0.67847 0.000 0.016 0.984 0.000
#> SRR934642      3  0.3726    0.52947 0.000 0.212 0.788 0.000
#> SRR934643      3  0.3726    0.52947 0.000 0.212 0.788 0.000
#> SRR934644      2  0.3726    0.83047 0.000 0.788 0.212 0.000
#> SRR934645      2  0.3837    0.82743 0.000 0.776 0.224 0.000
#> SRR925740      3  0.0336    0.68017 0.000 0.008 0.992 0.000
#> SRR925741      3  0.4961    0.00345 0.000 0.448 0.552 0.000
#> SRR925742      3  0.1022    0.67468 0.000 0.032 0.968 0.000
#> SRR1283038     3  0.4843    0.15033 0.000 0.396 0.604 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
#> SRR925687      1  0.0324     0.8814 0.992 0.000 0.000 0.004 0.004
#> SRR925688      1  0.0324     0.8814 0.992 0.000 0.000 0.004 0.004
#> SRR925689      1  0.4286     0.8002 0.792 0.032 0.000 0.140 0.036
#> SRR925690      1  0.4286     0.8002 0.792 0.032 0.000 0.140 0.036
#> SRR925691      1  0.4286     0.8002 0.792 0.032 0.000 0.140 0.036
#> SRR925692      1  0.4286     0.8002 0.792 0.032 0.000 0.140 0.036
#> SRR925693      3  0.6618    -0.3385 0.000 0.384 0.400 0.216 0.000
#> SRR925694      2  0.1818     0.6834 0.000 0.932 0.044 0.024 0.000
#> SRR925695      3  0.5691    -0.1929 0.000 0.400 0.516 0.084 0.000
#> SRR925697      5  0.0162     0.7019 0.004 0.000 0.000 0.000 0.996
#> SRR925696      3  0.0290     0.7112 0.000 0.000 0.992 0.008 0.000
#> SRR925698      3  0.2378     0.6733 0.000 0.048 0.904 0.048 0.000
#> SRR925699      3  0.4552     0.2858 0.000 0.468 0.524 0.008 0.000
#> SRR925700      3  0.4504     0.3552 0.000 0.428 0.564 0.008 0.000
#> SRR925701      3  0.4497     0.3599 0.000 0.424 0.568 0.008 0.000
#> SRR925702      5  0.5167     0.3186 0.044 0.000 0.000 0.404 0.552
#> SRR925703      5  0.0162     0.7019 0.004 0.000 0.000 0.000 0.996
#> SRR925704      2  0.5736     0.2882 0.000 0.468 0.448 0.084 0.000
#> SRR925705      3  0.0162     0.7110 0.000 0.000 0.996 0.004 0.000
#> SRR925706      5  0.4443     0.2466 0.004 0.000 0.000 0.472 0.524
#> SRR925708      1  0.0798     0.8762 0.976 0.000 0.000 0.016 0.008
#> SRR925707      4  0.4448    -0.3376 0.004 0.000 0.000 0.516 0.480
#> SRR925709      1  0.4173     0.5142 0.688 0.000 0.000 0.300 0.012
#> SRR925710      4  0.5913     0.0493 0.396 0.044 0.000 0.528 0.032
#> SRR925711      4  0.4684    -0.2560 0.004 0.000 0.008 0.536 0.452
#> SRR934631      2  0.1704     0.7035 0.000 0.928 0.068 0.004 0.000
#> SRR934632      2  0.1704     0.7035 0.000 0.928 0.068 0.004 0.000
#> SRR934633      2  0.1704     0.7035 0.000 0.928 0.068 0.004 0.000
#> SRR925713      5  0.4848     0.3193 0.024 0.000 0.000 0.420 0.556
#> SRR925714      5  0.0162     0.7019 0.004 0.000 0.000 0.000 0.996
#> SRR925715      4  0.4404     0.2999 0.092 0.016 0.000 0.788 0.104
#> SRR925716      5  0.0162     0.7019 0.004 0.000 0.000 0.000 0.996
#> SRR925717      1  0.6368     0.2633 0.484 0.016 0.000 0.108 0.392
#> SRR925718      3  0.3662     0.5736 0.000 0.252 0.744 0.004 0.000
#> SRR925719      1  0.1106     0.8711 0.964 0.000 0.000 0.024 0.012
#> SRR925720      1  0.0324     0.8814 0.992 0.000 0.000 0.004 0.004
#> SRR925721      1  0.0324     0.8814 0.992 0.000 0.000 0.004 0.004
#> SRR934634      1  0.0000     0.8814 1.000 0.000 0.000 0.000 0.000
#> SRR934635      1  0.0162     0.8812 0.996 0.000 0.000 0.004 0.000
#> SRR925723      3  0.1579     0.6964 0.000 0.032 0.944 0.024 0.000
#> SRR925724      3  0.1121     0.7021 0.000 0.000 0.956 0.044 0.000
#> SRR925725      2  0.6070     0.2723 0.000 0.440 0.440 0.120 0.000
#> SRR925726      5  0.4619     0.3668 0.216 0.000 0.000 0.064 0.720
#> SRR925727      3  0.4317     0.5251 0.000 0.112 0.772 0.116 0.000
#> SRR925728      5  0.4555     0.2425 0.008 0.000 0.000 0.472 0.520
#> SRR934636      5  0.0451     0.7002 0.008 0.000 0.000 0.004 0.988
#> SRR934637      5  0.0451     0.7002 0.008 0.000 0.000 0.004 0.988
#> SRR925729      2  0.1818     0.6834 0.000 0.932 0.044 0.024 0.000
#> SRR934638      1  0.1484     0.8706 0.944 0.008 0.000 0.048 0.000
#> SRR934639      1  0.1408     0.8719 0.948 0.008 0.000 0.044 0.000
#> SRR934640      4  0.4542     0.1075 0.000 0.456 0.008 0.536 0.000
#> SRR934641      4  0.4542     0.1075 0.000 0.456 0.008 0.536 0.000
#> SRR925734      1  0.0404     0.8810 0.988 0.000 0.000 0.012 0.000
#> SRR925735      2  0.6323     0.4184 0.000 0.516 0.192 0.292 0.000
#> SRR925736      3  0.0579     0.7111 0.000 0.008 0.984 0.008 0.000
#> SRR925737      3  0.0579     0.7111 0.000 0.008 0.984 0.008 0.000
#> SRR934642      3  0.3455     0.6109 0.000 0.208 0.784 0.008 0.000
#> SRR934643      3  0.3455     0.6109 0.000 0.208 0.784 0.008 0.000
#> SRR934644      2  0.1725     0.6902 0.000 0.936 0.044 0.020 0.000
#> SRR934645      2  0.1725     0.6902 0.000 0.936 0.044 0.020 0.000
#> SRR925740      3  0.0404     0.7123 0.000 0.012 0.988 0.000 0.000
#> SRR925741      2  0.5595     0.4482 0.000 0.560 0.356 0.084 0.000
#> SRR925742      3  0.1697     0.7007 0.000 0.060 0.932 0.008 0.000
#> SRR1283038     2  0.5314     0.3804 0.000 0.528 0.420 0.052 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
#> SRR925687      1  0.0806     0.7949 0.972 0.000 0.000 0.008 0.000 0.020
#> SRR925688      1  0.0806     0.7949 0.972 0.000 0.000 0.008 0.000 0.020
#> SRR925689      1  0.5100     0.6097 0.556 0.000 0.000 0.028 0.036 0.380
#> SRR925690      1  0.5100     0.6097 0.556 0.000 0.000 0.028 0.036 0.380
#> SRR925691      1  0.5100     0.6097 0.556 0.000 0.000 0.028 0.036 0.380
#> SRR925692      1  0.5100     0.6097 0.556 0.000 0.000 0.028 0.036 0.380
#> SRR925693      6  0.6911     0.0000 0.000 0.324 0.264 0.052 0.000 0.360
#> SRR925694      2  0.2186     0.4032 0.000 0.908 0.024 0.012 0.000 0.056
#> SRR925695      2  0.6205    -0.6075 0.000 0.364 0.360 0.004 0.000 0.272
#> SRR925697      5  0.0436     0.8742 0.004 0.000 0.000 0.004 0.988 0.004
#> SRR925696      3  0.0922     0.7072 0.000 0.004 0.968 0.004 0.000 0.024
#> SRR925698      3  0.3490     0.5055 0.000 0.040 0.784 0.000 0.000 0.176
#> SRR925699      2  0.5548    -0.2947 0.000 0.472 0.436 0.016 0.004 0.072
#> SRR925700      3  0.5550     0.2665 0.000 0.444 0.464 0.016 0.004 0.072
#> SRR925701      3  0.5313     0.3393 0.000 0.412 0.512 0.012 0.004 0.060
#> SRR925702      4  0.4495     0.8266 0.060 0.000 0.000 0.720 0.200 0.020
#> SRR925703      5  0.0603     0.8661 0.004 0.000 0.000 0.016 0.980 0.000
#> SRR925704      2  0.6130    -0.5988 0.000 0.432 0.292 0.004 0.000 0.272
#> SRR925705      3  0.0777     0.7054 0.000 0.000 0.972 0.004 0.000 0.024
#> SRR925706      4  0.3134     0.8556 0.004 0.000 0.000 0.784 0.208 0.004
#> SRR925708      1  0.2195     0.7798 0.904 0.000 0.000 0.016 0.012 0.068
#> SRR925707      4  0.2765     0.8526 0.004 0.000 0.004 0.840 0.148 0.004
#> SRR925709      1  0.5440     0.1477 0.496 0.000 0.000 0.408 0.012 0.084
#> SRR925710      1  0.6869     0.0886 0.392 0.028 0.000 0.320 0.012 0.248
#> SRR925711      4  0.4758     0.7813 0.020 0.000 0.024 0.744 0.140 0.072
#> SRR934631      2  0.1682     0.3985 0.000 0.928 0.020 0.000 0.000 0.052
#> SRR934632      2  0.1682     0.3985 0.000 0.928 0.020 0.000 0.000 0.052
#> SRR934633      2  0.1682     0.3985 0.000 0.928 0.020 0.000 0.000 0.052
#> SRR925713      4  0.4548     0.8031 0.032 0.000 0.000 0.688 0.252 0.028
#> SRR925714      5  0.0291     0.8741 0.004 0.000 0.000 0.004 0.992 0.000
#> SRR925715      4  0.3704     0.7017 0.036 0.008 0.000 0.816 0.024 0.116
#> SRR925716      5  0.0260     0.8726 0.008 0.000 0.000 0.000 0.992 0.000
#> SRR925717      5  0.6453     0.3171 0.264 0.000 0.000 0.044 0.496 0.196
#> SRR925718      3  0.3987     0.6521 0.000 0.204 0.748 0.004 0.004 0.040
#> SRR925719      1  0.2577     0.7640 0.888 0.000 0.000 0.040 0.016 0.056
#> SRR925720      1  0.0291     0.7989 0.992 0.000 0.000 0.004 0.000 0.004
#> SRR925721      1  0.0291     0.8000 0.992 0.000 0.000 0.004 0.000 0.004
#> SRR934634      1  0.0405     0.8001 0.988 0.000 0.000 0.004 0.000 0.008
#> SRR934635      1  0.0458     0.7999 0.984 0.000 0.000 0.000 0.000 0.016
#> SRR925723      3  0.2094     0.6729 0.000 0.020 0.900 0.000 0.000 0.080
#> SRR925724      3  0.2051     0.6626 0.000 0.004 0.896 0.004 0.000 0.096
#> SRR925725      2  0.6695    -0.7914 0.000 0.364 0.280 0.032 0.000 0.324
#> SRR925726      5  0.3011     0.7557 0.100 0.000 0.000 0.012 0.852 0.036
#> SRR925727      3  0.5666    -0.1577 0.000 0.120 0.580 0.024 0.000 0.276
#> SRR925728      4  0.3104     0.8560 0.004 0.000 0.000 0.788 0.204 0.004
#> SRR934636      5  0.0551     0.8734 0.004 0.000 0.000 0.008 0.984 0.004
#> SRR934637      5  0.0551     0.8734 0.004 0.000 0.000 0.008 0.984 0.004
#> SRR925729      2  0.2076     0.4044 0.000 0.912 0.016 0.012 0.000 0.060
#> SRR934638      1  0.2408     0.7825 0.876 0.000 0.000 0.012 0.004 0.108
#> SRR934639      1  0.2408     0.7825 0.876 0.000 0.000 0.012 0.004 0.108
#> SRR934640      2  0.6516     0.0212 0.000 0.372 0.020 0.332 0.000 0.276
#> SRR934641      2  0.6516     0.0212 0.000 0.372 0.020 0.332 0.000 0.276
#> SRR925734      1  0.1010     0.7999 0.960 0.000 0.000 0.004 0.000 0.036
#> SRR925735      2  0.6691    -0.3756 0.000 0.440 0.112 0.096 0.000 0.352
#> SRR925736      3  0.2177     0.7037 0.000 0.004 0.908 0.024 0.004 0.060
#> SRR925737      3  0.2177     0.7037 0.000 0.004 0.908 0.024 0.004 0.060
#> SRR934642      3  0.3940     0.6637 0.000 0.168 0.772 0.008 0.004 0.048
#> SRR934643      3  0.3940     0.6637 0.000 0.168 0.772 0.008 0.004 0.048
#> SRR934644      2  0.1148     0.4110 0.000 0.960 0.016 0.004 0.000 0.020
#> SRR934645      2  0.1434     0.4134 0.000 0.948 0.020 0.008 0.000 0.024
#> SRR925740      3  0.1565     0.7149 0.000 0.028 0.940 0.004 0.000 0.028
#> SRR925741      2  0.5918    -0.5610 0.000 0.484 0.204 0.004 0.000 0.308
#> SRR925742      3  0.2839     0.6883 0.000 0.092 0.860 0.004 0.000 0.044
#> SRR1283038     2  0.5816    -0.5034 0.000 0.484 0.304 0.000 0.000 0.212

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

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

collect_plots(res)

plot of chunk CV-pam-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.766           0.923       0.958         0.4932 0.494   0.494
#> 3 3 0.760           0.872       0.931         0.1979 0.906   0.810
#> 4 4 0.667           0.748       0.852         0.1999 0.875   0.686
#> 5 5 0.717           0.733       0.862         0.0833 0.911   0.698
#> 6 6 0.814           0.757       0.903         0.0507 0.927   0.704

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
#> SRR925687      1   0.000      0.910 1.000 0.000
#> SRR925688      1   0.118      0.908 0.984 0.016
#> SRR925689      1   0.000      0.910 1.000 0.000
#> SRR925690      1   0.000      0.910 1.000 0.000
#> SRR925691      1   0.000      0.910 1.000 0.000
#> SRR925692      1   0.000      0.910 1.000 0.000
#> SRR925693      2   0.000      0.996 0.000 1.000
#> SRR925694      2   0.000      0.996 0.000 1.000
#> SRR925695      2   0.000      0.996 0.000 1.000
#> SRR925697      1   0.563      0.863 0.868 0.132
#> SRR925696      2   0.000      0.996 0.000 1.000
#> SRR925698      2   0.000      0.996 0.000 1.000
#> SRR925699      2   0.000      0.996 0.000 1.000
#> SRR925700      2   0.000      0.996 0.000 1.000
#> SRR925701      2   0.000      0.996 0.000 1.000
#> SRR925702      1   0.278      0.901 0.952 0.048
#> SRR925703      1   0.541      0.868 0.876 0.124
#> SRR925704      2   0.000      0.996 0.000 1.000
#> SRR925705      2   0.000      0.996 0.000 1.000
#> SRR925706      2   0.494      0.861 0.108 0.892
#> SRR925708      1   0.000      0.910 1.000 0.000
#> SRR925707      2   0.000      0.996 0.000 1.000
#> SRR925709      1   0.141      0.906 0.980 0.020
#> SRR925710      1   0.995      0.315 0.540 0.460
#> SRR925711      1   0.827      0.684 0.740 0.260
#> SRR934631      2   0.000      0.996 0.000 1.000
#> SRR934632      2   0.000      0.996 0.000 1.000
#> SRR934633      2   0.000      0.996 0.000 1.000
#> SRR925713      1   0.866      0.673 0.712 0.288
#> SRR925714      1   0.552      0.866 0.872 0.128
#> SRR925715      1   0.980      0.433 0.584 0.416
#> SRR925716      1   0.242      0.904 0.960 0.040
#> SRR925717      1   0.469      0.882 0.900 0.100
#> SRR925718      2   0.000      0.996 0.000 1.000
#> SRR925719      1   0.000      0.910 1.000 0.000
#> SRR925720      1   0.000      0.910 1.000 0.000
#> SRR925721      1   0.000      0.910 1.000 0.000
#> SRR934634      1   0.000      0.910 1.000 0.000
#> SRR934635      1   0.000      0.910 1.000 0.000
#> SRR925723      2   0.000      0.996 0.000 1.000
#> SRR925724      2   0.000      0.996 0.000 1.000
#> SRR925725      2   0.000      0.996 0.000 1.000
#> SRR925726      1   0.430      0.886 0.912 0.088
#> SRR925727      2   0.000      0.996 0.000 1.000
#> SRR925728      1   0.730      0.776 0.796 0.204
#> SRR934636      1   0.584      0.857 0.860 0.140
#> SRR934637      1   0.563      0.863 0.868 0.132
#> SRR925729      2   0.000      0.996 0.000 1.000
#> SRR934638      1   0.000      0.910 1.000 0.000
#> SRR934639      1   0.000      0.910 1.000 0.000
#> SRR934640      2   0.000      0.996 0.000 1.000
#> SRR934641      2   0.000      0.996 0.000 1.000
#> SRR925734      1   0.000      0.910 1.000 0.000
#> SRR925735      2   0.000      0.996 0.000 1.000
#> SRR925736      2   0.000      0.996 0.000 1.000
#> SRR925737      2   0.000      0.996 0.000 1.000
#> SRR934642      2   0.000      0.996 0.000 1.000
#> SRR934643      2   0.000      0.996 0.000 1.000
#> SRR934644      2   0.000      0.996 0.000 1.000
#> SRR934645      2   0.000      0.996 0.000 1.000
#> SRR925740      2   0.000      0.996 0.000 1.000
#> SRR925741      2   0.000      0.996 0.000 1.000
#> SRR925742      2   0.000      0.996 0.000 1.000
#> SRR1283038     2   0.000      0.996 0.000 1.000

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>            class entropy silhouette    p1    p2    p3
#> SRR925687      1  0.0000      0.854 1.000 0.000 0.000
#> SRR925688      1  0.0000      0.854 1.000 0.000 0.000
#> SRR925689      3  0.1163      0.835 0.028 0.000 0.972
#> SRR925690      3  0.1163      0.835 0.028 0.000 0.972
#> SRR925691      3  0.1163      0.835 0.028 0.000 0.972
#> SRR925692      3  0.1163      0.835 0.028 0.000 0.972
#> SRR925693      2  0.0592      0.980 0.000 0.988 0.012
#> SRR925694      2  0.0000      0.981 0.000 1.000 0.000
#> SRR925695      2  0.0747      0.978 0.000 0.984 0.016
#> SRR925697      1  0.6920      0.708 0.736 0.132 0.132
#> SRR925696      2  0.0000      0.981 0.000 1.000 0.000
#> SRR925698      2  0.0592      0.979 0.000 0.988 0.012
#> SRR925699      2  0.0000      0.981 0.000 1.000 0.000
#> SRR925700      2  0.0000      0.981 0.000 1.000 0.000
#> SRR925701      2  0.0000      0.981 0.000 1.000 0.000
#> SRR925702      1  0.0000      0.854 1.000 0.000 0.000
#> SRR925703      1  0.6854      0.715 0.740 0.124 0.136
#> SRR925704      2  0.0747      0.978 0.000 0.984 0.016
#> SRR925705      2  0.0000      0.981 0.000 1.000 0.000
#> SRR925706      2  0.6726      0.388 0.332 0.644 0.024
#> SRR925708      1  0.0237      0.853 0.996 0.000 0.004
#> SRR925707      2  0.0000      0.981 0.000 1.000 0.000
#> SRR925709      3  0.5859      0.528 0.344 0.000 0.656
#> SRR925710      3  0.7988      0.645 0.144 0.200 0.656
#> SRR925711      3  0.1774      0.828 0.016 0.024 0.960
#> SRR934631      2  0.0747      0.978 0.000 0.984 0.016
#> SRR934632      2  0.0747      0.978 0.000 0.984 0.016
#> SRR934633      2  0.0747      0.978 0.000 0.984 0.016
#> SRR925713      1  0.6902      0.598 0.736 0.148 0.116
#> SRR925714      1  0.7327      0.685 0.708 0.132 0.160
#> SRR925715      3  0.7507      0.569 0.068 0.288 0.644
#> SRR925716      1  0.4418      0.799 0.848 0.020 0.132
#> SRR925717      3  0.4379      0.797 0.072 0.060 0.868
#> SRR925718      2  0.0000      0.981 0.000 1.000 0.000
#> SRR925719      1  0.0000      0.854 1.000 0.000 0.000
#> SRR925720      1  0.0000      0.854 1.000 0.000 0.000
#> SRR925721      1  0.0000      0.854 1.000 0.000 0.000
#> SRR934634      1  0.0000      0.854 1.000 0.000 0.000
#> SRR934635      1  0.0000      0.854 1.000 0.000 0.000
#> SRR925723      2  0.0592      0.979 0.000 0.988 0.012
#> SRR925724      2  0.0424      0.980 0.000 0.992 0.008
#> SRR925725      2  0.0747      0.978 0.000 0.984 0.016
#> SRR925726      1  0.6912      0.540 0.628 0.028 0.344
#> SRR925727      2  0.0424      0.980 0.000 0.992 0.008
#> SRR925728      1  0.1031      0.847 0.976 0.000 0.024
#> SRR934636      1  0.7485      0.690 0.696 0.132 0.172
#> SRR934637      1  0.7926      0.651 0.656 0.128 0.216
#> SRR925729      2  0.0000      0.981 0.000 1.000 0.000
#> SRR934638      1  0.1964      0.836 0.944 0.000 0.056
#> SRR934639      1  0.3879      0.796 0.848 0.000 0.152
#> SRR934640      2  0.0000      0.981 0.000 1.000 0.000
#> SRR934641      2  0.0000      0.981 0.000 1.000 0.000
#> SRR925734      1  0.1643      0.837 0.956 0.000 0.044
#> SRR925735      2  0.0237      0.981 0.000 0.996 0.004
#> SRR925736      2  0.0000      0.981 0.000 1.000 0.000
#> SRR925737      2  0.0000      0.981 0.000 1.000 0.000
#> SRR934642      2  0.0000      0.981 0.000 1.000 0.000
#> SRR934643      2  0.0000      0.981 0.000 1.000 0.000
#> SRR934644      2  0.0424      0.980 0.000 0.992 0.008
#> SRR934645      2  0.0747      0.978 0.000 0.984 0.016
#> SRR925740      2  0.0000      0.981 0.000 1.000 0.000
#> SRR925741      2  0.0747      0.978 0.000 0.984 0.016
#> SRR925742      2  0.0237      0.981 0.000 0.996 0.004
#> SRR1283038     2  0.0747      0.978 0.000 0.984 0.016

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> SRR925687      4  0.0000      0.855 0.000 0.000 0.000 1.000
#> SRR925688      4  0.0000      0.855 0.000 0.000 0.000 1.000
#> SRR925689      1  0.0592      0.861 0.984 0.000 0.000 0.016
#> SRR925690      1  0.0592      0.861 0.984 0.000 0.000 0.016
#> SRR925691      1  0.0592      0.861 0.984 0.000 0.000 0.016
#> SRR925692      1  0.0592      0.861 0.984 0.000 0.000 0.016
#> SRR925693      3  0.4996     -0.350 0.000 0.484 0.516 0.000
#> SRR925694      3  0.0000      0.851 0.000 0.000 1.000 0.000
#> SRR925695      2  0.4605      0.808 0.000 0.664 0.336 0.000
#> SRR925697      4  0.5599      0.736 0.072 0.228 0.000 0.700
#> SRR925696      3  0.0000      0.851 0.000 0.000 1.000 0.000
#> SRR925698      2  0.4998      0.496 0.000 0.512 0.488 0.000
#> SRR925699      3  0.0000      0.851 0.000 0.000 1.000 0.000
#> SRR925700      3  0.0000      0.851 0.000 0.000 1.000 0.000
#> SRR925701      3  0.0000      0.851 0.000 0.000 1.000 0.000
#> SRR925702      4  0.0000      0.855 0.000 0.000 0.000 1.000
#> SRR925703      4  0.5782      0.740 0.068 0.220 0.008 0.704
#> SRR925704      2  0.4713      0.776 0.000 0.640 0.360 0.000
#> SRR925705      3  0.0000      0.851 0.000 0.000 1.000 0.000
#> SRR925706      3  0.5467      0.253 0.024 0.000 0.612 0.364
#> SRR925708      4  0.0188      0.854 0.004 0.000 0.000 0.996
#> SRR925707      3  0.0188      0.849 0.000 0.004 0.996 0.000
#> SRR925709      1  0.4585      0.594 0.668 0.000 0.000 0.332
#> SRR925710      1  0.6661      0.703 0.676 0.028 0.116 0.180
#> SRR925711      1  0.3249      0.789 0.852 0.140 0.008 0.000
#> SRR934631      2  0.3873      0.881 0.000 0.772 0.228 0.000
#> SRR934632      2  0.3873      0.881 0.000 0.772 0.228 0.000
#> SRR934633      2  0.3873      0.881 0.000 0.772 0.228 0.000
#> SRR925713      4  0.5175      0.607 0.120 0.000 0.120 0.760
#> SRR925714      4  0.5599      0.736 0.072 0.228 0.000 0.700
#> SRR925715      1  0.5969      0.681 0.704 0.008 0.192 0.096
#> SRR925716      4  0.5321      0.747 0.056 0.228 0.000 0.716
#> SRR925717      1  0.2489      0.842 0.912 0.000 0.020 0.068
#> SRR925718      3  0.0000      0.851 0.000 0.000 1.000 0.000
#> SRR925719      4  0.0000      0.855 0.000 0.000 0.000 1.000
#> SRR925720      4  0.0000      0.855 0.000 0.000 0.000 1.000
#> SRR925721      4  0.0000      0.855 0.000 0.000 0.000 1.000
#> SRR934634      4  0.0000      0.855 0.000 0.000 0.000 1.000
#> SRR934635      4  0.0000      0.855 0.000 0.000 0.000 1.000
#> SRR925723      3  0.5000     -0.514 0.000 0.496 0.504 0.000
#> SRR925724      3  0.2760      0.711 0.000 0.128 0.872 0.000
#> SRR925725      2  0.3873      0.881 0.000 0.772 0.228 0.000
#> SRR925726      4  0.5040      0.522 0.364 0.000 0.008 0.628
#> SRR925727      3  0.3569      0.589 0.000 0.196 0.804 0.000
#> SRR925728      4  0.0817      0.848 0.024 0.000 0.000 0.976
#> SRR934636      4  0.6229      0.713 0.116 0.228 0.000 0.656
#> SRR934637      4  0.6374      0.702 0.128 0.228 0.000 0.644
#> SRR925729      3  0.1302      0.817 0.000 0.044 0.956 0.000
#> SRR934638      4  0.1557      0.838 0.056 0.000 0.000 0.944
#> SRR934639      4  0.3123      0.795 0.156 0.000 0.000 0.844
#> SRR934640      3  0.0707      0.839 0.000 0.020 0.980 0.000
#> SRR934641      3  0.1022      0.830 0.000 0.032 0.968 0.000
#> SRR925734      4  0.1302      0.839 0.044 0.000 0.000 0.956
#> SRR925735      3  0.3688      0.562 0.000 0.208 0.792 0.000
#> SRR925736      3  0.0000      0.851 0.000 0.000 1.000 0.000
#> SRR925737      3  0.0000      0.851 0.000 0.000 1.000 0.000
#> SRR934642      3  0.0000      0.851 0.000 0.000 1.000 0.000
#> SRR934643      3  0.0000      0.851 0.000 0.000 1.000 0.000
#> SRR934644      2  0.4907      0.621 0.000 0.580 0.420 0.000
#> SRR934645      2  0.4222      0.868 0.000 0.728 0.272 0.000
#> SRR925740      3  0.0000      0.851 0.000 0.000 1.000 0.000
#> SRR925741      2  0.4072      0.874 0.000 0.748 0.252 0.000
#> SRR925742      3  0.3074      0.671 0.000 0.152 0.848 0.000
#> SRR1283038     2  0.3873      0.881 0.000 0.772 0.228 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
#> SRR925687      4  0.0000     0.8841 0.000 0.000 0.000 1.000 0.000
#> SRR925688      4  0.0000     0.8841 0.000 0.000 0.000 1.000 0.000
#> SRR925689      1  0.0000     0.7723 1.000 0.000 0.000 0.000 0.000
#> SRR925690      1  0.0000     0.7723 1.000 0.000 0.000 0.000 0.000
#> SRR925691      1  0.0000     0.7723 1.000 0.000 0.000 0.000 0.000
#> SRR925692      1  0.0000     0.7723 1.000 0.000 0.000 0.000 0.000
#> SRR925693      3  0.3906     0.5396 0.000 0.292 0.704 0.000 0.004
#> SRR925694      2  0.0000     0.8573 0.000 1.000 0.000 0.000 0.000
#> SRR925695      3  0.3143     0.7115 0.000 0.204 0.796 0.000 0.000
#> SRR925697      5  0.3932     0.8996 0.000 0.000 0.000 0.328 0.672
#> SRR925696      2  0.0000     0.8573 0.000 1.000 0.000 0.000 0.000
#> SRR925698      3  0.4305     0.0268 0.000 0.488 0.512 0.000 0.000
#> SRR925699      2  0.0000     0.8573 0.000 1.000 0.000 0.000 0.000
#> SRR925700      2  0.0000     0.8573 0.000 1.000 0.000 0.000 0.000
#> SRR925701      2  0.0000     0.8573 0.000 1.000 0.000 0.000 0.000
#> SRR925702      4  0.0000     0.8841 0.000 0.000 0.000 1.000 0.000
#> SRR925703      5  0.3932     0.8996 0.000 0.000 0.000 0.328 0.672
#> SRR925704      3  0.3039     0.7286 0.000 0.192 0.808 0.000 0.000
#> SRR925705      2  0.0000     0.8573 0.000 1.000 0.000 0.000 0.000
#> SRR925706      2  0.5405     0.5410 0.016 0.672 0.000 0.236 0.076
#> SRR925708      4  0.0162     0.8822 0.004 0.000 0.000 0.996 0.000
#> SRR925707      2  0.2171     0.8184 0.000 0.912 0.024 0.000 0.064
#> SRR925709      4  0.4249     0.1813 0.432 0.000 0.000 0.568 0.000
#> SRR925710      1  0.6444     0.4239 0.532 0.012 0.152 0.304 0.000
#> SRR925711      5  0.2020     0.3205 0.100 0.000 0.000 0.000 0.900
#> SRR934631      3  0.0000     0.8103 0.000 0.000 1.000 0.000 0.000
#> SRR934632      3  0.0000     0.8103 0.000 0.000 1.000 0.000 0.000
#> SRR934633      3  0.0000     0.8103 0.000 0.000 1.000 0.000 0.000
#> SRR925713      4  0.3012     0.7555 0.104 0.036 0.000 0.860 0.000
#> SRR925714      5  0.3932     0.8996 0.000 0.000 0.000 0.328 0.672
#> SRR925715      1  0.7809     0.4262 0.456 0.092 0.020 0.104 0.328
#> SRR925716      5  0.3932     0.8996 0.000 0.000 0.000 0.328 0.672
#> SRR925717      1  0.1732     0.7430 0.920 0.000 0.000 0.080 0.000
#> SRR925718      2  0.0000     0.8573 0.000 1.000 0.000 0.000 0.000
#> SRR925719      4  0.0000     0.8841 0.000 0.000 0.000 1.000 0.000
#> SRR925720      4  0.0000     0.8841 0.000 0.000 0.000 1.000 0.000
#> SRR925721      4  0.0000     0.8841 0.000 0.000 0.000 1.000 0.000
#> SRR934634      4  0.0000     0.8841 0.000 0.000 0.000 1.000 0.000
#> SRR934635      4  0.0000     0.8841 0.000 0.000 0.000 1.000 0.000
#> SRR925723      2  0.4306    -0.0703 0.000 0.508 0.492 0.000 0.000
#> SRR925724      2  0.2377     0.7689 0.000 0.872 0.128 0.000 0.000
#> SRR925725      3  0.0000     0.8103 0.000 0.000 1.000 0.000 0.000
#> SRR925726      1  0.4242     0.2207 0.572 0.000 0.000 0.428 0.000
#> SRR925727      2  0.3210     0.6723 0.000 0.788 0.212 0.000 0.000
#> SRR925728      4  0.1121     0.8594 0.044 0.000 0.000 0.956 0.000
#> SRR934636      5  0.3932     0.8996 0.000 0.000 0.000 0.328 0.672
#> SRR934637      5  0.3932     0.8996 0.000 0.000 0.000 0.328 0.672
#> SRR925729      2  0.1732     0.8102 0.000 0.920 0.080 0.000 0.000
#> SRR934638      4  0.2329     0.8012 0.124 0.000 0.000 0.876 0.000
#> SRR934639      4  0.3752     0.5639 0.292 0.000 0.000 0.708 0.000
#> SRR934640      2  0.5129     0.5551 0.000 0.616 0.056 0.000 0.328
#> SRR934641      2  0.5300     0.5387 0.000 0.604 0.068 0.000 0.328
#> SRR925734      4  0.2179     0.8081 0.112 0.000 0.000 0.888 0.000
#> SRR925735      2  0.4251     0.3087 0.000 0.624 0.372 0.000 0.004
#> SRR925736      2  0.0000     0.8573 0.000 1.000 0.000 0.000 0.000
#> SRR925737      2  0.0000     0.8573 0.000 1.000 0.000 0.000 0.000
#> SRR934642      2  0.0000     0.8573 0.000 1.000 0.000 0.000 0.000
#> SRR934643      2  0.0000     0.8573 0.000 1.000 0.000 0.000 0.000
#> SRR934644      3  0.3039     0.6848 0.000 0.192 0.808 0.000 0.000
#> SRR934645      3  0.1908     0.7966 0.000 0.092 0.908 0.000 0.000
#> SRR925740      2  0.0000     0.8573 0.000 1.000 0.000 0.000 0.000
#> SRR925741      3  0.0609     0.8103 0.000 0.020 0.980 0.000 0.000
#> SRR925742      2  0.2424     0.7669 0.000 0.868 0.132 0.000 0.000
#> SRR1283038     3  0.0000     0.8103 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
#> SRR925687      4  0.0000     0.8608 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR925688      4  0.0000     0.8608 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR925689      1  0.0000     0.7775 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR925690      1  0.0000     0.7775 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR925691      1  0.0000     0.7775 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR925692      1  0.0000     0.7775 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR925693      2  0.3755     0.6706 0.000 0.744 0.220 0.000 0.000 0.036
#> SRR925694      3  0.0000     0.8580 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR925695      2  0.2883     0.7205 0.000 0.788 0.212 0.000 0.000 0.000
#> SRR925697      5  0.0146     0.9989 0.000 0.000 0.000 0.004 0.996 0.000
#> SRR925696      3  0.0000     0.8580 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR925698      3  0.3838     0.2105 0.000 0.448 0.552 0.000 0.000 0.000
#> SRR925699      3  0.0000     0.8580 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR925700      3  0.0000     0.8580 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR925701      3  0.0000     0.8580 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR925702      4  0.0363     0.8558 0.012 0.000 0.000 0.988 0.000 0.000
#> SRR925703      5  0.0260     0.9946 0.000 0.000 0.000 0.008 0.992 0.000
#> SRR925704      2  0.2793     0.7405 0.000 0.800 0.200 0.000 0.000 0.000
#> SRR925705      3  0.0000     0.8580 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR925706      6  0.3850     0.4223 0.004 0.000 0.340 0.004 0.000 0.652
#> SRR925708      4  0.0000     0.8608 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR925707      3  0.3934     0.4568 0.000 0.020 0.676 0.000 0.000 0.304
#> SRR925709      4  0.3482     0.5622 0.316 0.000 0.000 0.684 0.000 0.000
#> SRR925710      4  0.5751     0.0211 0.288 0.000 0.000 0.504 0.000 0.208
#> SRR925711      6  0.0146     0.8705 0.000 0.000 0.000 0.000 0.004 0.996
#> SRR934631      2  0.0000     0.8677 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR934632      2  0.0000     0.8677 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR934633      2  0.0000     0.8677 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR925713      4  0.0520     0.8509 0.008 0.000 0.008 0.984 0.000 0.000
#> SRR925714      5  0.0146     0.9989 0.000 0.000 0.000 0.004 0.996 0.000
#> SRR925715      6  0.0000     0.8717 0.000 0.000 0.000 0.000 0.000 1.000
#> SRR925716      5  0.0146     0.9989 0.000 0.000 0.000 0.004 0.996 0.000
#> SRR925717      1  0.2854     0.6856 0.792 0.000 0.000 0.208 0.000 0.000
#> SRR925718      3  0.0000     0.8580 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR925719      4  0.0000     0.8608 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR925720      4  0.0000     0.8608 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR925721      4  0.0000     0.8608 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR934634      4  0.0000     0.8608 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR934635      4  0.0000     0.8608 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR925723      3  0.3843     0.1992 0.000 0.452 0.548 0.000 0.000 0.000
#> SRR925724      3  0.2135     0.7749 0.000 0.128 0.872 0.000 0.000 0.000
#> SRR925725      2  0.0000     0.8677 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR925726      1  0.3482     0.5515 0.684 0.000 0.000 0.316 0.000 0.000
#> SRR925727      3  0.2996     0.6648 0.000 0.228 0.772 0.000 0.000 0.000
#> SRR925728      4  0.2165     0.7836 0.108 0.000 0.000 0.884 0.000 0.008
#> SRR934636      5  0.0146     0.9989 0.000 0.000 0.000 0.004 0.996 0.000
#> SRR934637      5  0.0146     0.9989 0.000 0.000 0.000 0.004 0.996 0.000
#> SRR925729      3  0.1765     0.8030 0.000 0.096 0.904 0.000 0.000 0.000
#> SRR934638      4  0.3547     0.5359 0.332 0.000 0.000 0.668 0.000 0.000
#> SRR934639      1  0.3857    -0.0450 0.532 0.000 0.000 0.468 0.000 0.000
#> SRR934640      6  0.0000     0.8717 0.000 0.000 0.000 0.000 0.000 1.000
#> SRR934641      6  0.0000     0.8717 0.000 0.000 0.000 0.000 0.000 1.000
#> SRR925734      4  0.3446     0.5724 0.308 0.000 0.000 0.692 0.000 0.000
#> SRR925735      3  0.4305     0.0879 0.000 0.436 0.544 0.000 0.000 0.020
#> SRR925736      3  0.0000     0.8580 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR925737      3  0.0000     0.8580 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR934642      3  0.0000     0.8580 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR934643      3  0.0000     0.8580 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR934644      2  0.2730     0.7107 0.000 0.808 0.192 0.000 0.000 0.000
#> SRR934645      2  0.1765     0.8388 0.000 0.904 0.096 0.000 0.000 0.000
#> SRR925740      3  0.0000     0.8580 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR925741      2  0.0458     0.8658 0.000 0.984 0.016 0.000 0.000 0.000
#> SRR925742      3  0.2003     0.7902 0.000 0.116 0.884 0.000 0.000 0.000
#> SRR1283038     2  0.0000     0.8677 0.000 1.000 0.000 0.000 0.000 0.000

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

consensus_heatmap(res, k = 2)

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

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

collect_plots(res)

plot of chunk CV-mclust-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 1.000           0.982       0.991         0.5077 0.492   0.492
#> 3 3 0.786           0.824       0.911         0.1857 0.913   0.824
#> 4 4 0.696           0.864       0.899         0.0341 0.969   0.927
#> 5 5 0.669           0.532       0.807         0.1345 0.905   0.768
#> 6 6 0.745           0.680       0.863         0.1043 0.857   0.574

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
#> SRR925687      1   0.000      0.998 1.000 0.000
#> SRR925688      1   0.000      0.998 1.000 0.000
#> SRR925689      1   0.000      0.998 1.000 0.000
#> SRR925690      1   0.000      0.998 1.000 0.000
#> SRR925691      1   0.000      0.998 1.000 0.000
#> SRR925692      1   0.000      0.998 1.000 0.000
#> SRR925693      2   0.000      0.984 0.000 1.000
#> SRR925694      2   0.000      0.984 0.000 1.000
#> SRR925695      2   0.000      0.984 0.000 1.000
#> SRR925697      1   0.000      0.998 1.000 0.000
#> SRR925696      2   0.000      0.984 0.000 1.000
#> SRR925698      2   0.000      0.984 0.000 1.000
#> SRR925699      2   0.000      0.984 0.000 1.000
#> SRR925700      2   0.000      0.984 0.000 1.000
#> SRR925701      2   0.000      0.984 0.000 1.000
#> SRR925702      1   0.000      0.998 1.000 0.000
#> SRR925703      1   0.000      0.998 1.000 0.000
#> SRR925704      2   0.000      0.984 0.000 1.000
#> SRR925705      2   0.000      0.984 0.000 1.000
#> SRR925706      1   0.000      0.998 1.000 0.000
#> SRR925708      1   0.000      0.998 1.000 0.000
#> SRR925707      1   0.204      0.967 0.968 0.032
#> SRR925709      1   0.000      0.998 1.000 0.000
#> SRR925710      1   0.000      0.998 1.000 0.000
#> SRR925711      1   0.204      0.967 0.968 0.032
#> SRR934631      2   0.000      0.984 0.000 1.000
#> SRR934632      2   0.000      0.984 0.000 1.000
#> SRR934633      2   0.000      0.984 0.000 1.000
#> SRR925713      1   0.000      0.998 1.000 0.000
#> SRR925714      1   0.000      0.998 1.000 0.000
#> SRR925715      1   0.000      0.998 1.000 0.000
#> SRR925716      1   0.000      0.998 1.000 0.000
#> SRR925717      1   0.000      0.998 1.000 0.000
#> SRR925718      2   0.000      0.984 0.000 1.000
#> SRR925719      1   0.000      0.998 1.000 0.000
#> SRR925720      1   0.000      0.998 1.000 0.000
#> SRR925721      1   0.000      0.998 1.000 0.000
#> SRR934634      1   0.000      0.998 1.000 0.000
#> SRR934635      1   0.000      0.998 1.000 0.000
#> SRR925723      2   0.000      0.984 0.000 1.000
#> SRR925724      2   0.000      0.984 0.000 1.000
#> SRR925725      2   0.000      0.984 0.000 1.000
#> SRR925726      1   0.000      0.998 1.000 0.000
#> SRR925727      2   0.000      0.984 0.000 1.000
#> SRR925728      1   0.000      0.998 1.000 0.000
#> SRR934636      1   0.000      0.998 1.000 0.000
#> SRR934637      1   0.000      0.998 1.000 0.000
#> SRR925729      2   0.000      0.984 0.000 1.000
#> SRR934638      1   0.000      0.998 1.000 0.000
#> SRR934639      1   0.000      0.998 1.000 0.000
#> SRR934640      2   0.662      0.805 0.172 0.828
#> SRR934641      2   0.662      0.805 0.172 0.828
#> SRR925734      1   0.000      0.998 1.000 0.000
#> SRR925735      2   0.595      0.839 0.144 0.856
#> SRR925736      2   0.000      0.984 0.000 1.000
#> SRR925737      2   0.000      0.984 0.000 1.000
#> SRR934642      2   0.000      0.984 0.000 1.000
#> SRR934643      2   0.000      0.984 0.000 1.000
#> SRR934644      2   0.000      0.984 0.000 1.000
#> SRR934645      2   0.000      0.984 0.000 1.000
#> SRR925740      2   0.000      0.984 0.000 1.000
#> SRR925741      2   0.000      0.984 0.000 1.000
#> SRR925742      2   0.000      0.984 0.000 1.000
#> SRR1283038     2   0.000      0.984 0.000 1.000

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>            class entropy silhouette    p1    p2    p3
#> SRR925687      1  0.0000      0.776 1.000 0.000 0.000
#> SRR925688      1  0.0000      0.776 1.000 0.000 0.000
#> SRR925689      1  0.0000      0.776 1.000 0.000 0.000
#> SRR925690      1  0.0000      0.776 1.000 0.000 0.000
#> SRR925691      1  0.0000      0.776 1.000 0.000 0.000
#> SRR925692      1  0.0000      0.776 1.000 0.000 0.000
#> SRR925693      2  0.0000      0.979 0.000 1.000 0.000
#> SRR925694      2  0.0000      0.979 0.000 1.000 0.000
#> SRR925695      2  0.0000      0.979 0.000 1.000 0.000
#> SRR925697      3  0.4002      0.884 0.160 0.000 0.840
#> SRR925696      2  0.0000      0.979 0.000 1.000 0.000
#> SRR925698      2  0.0000      0.979 0.000 1.000 0.000
#> SRR925699      2  0.0000      0.979 0.000 1.000 0.000
#> SRR925700      2  0.0000      0.979 0.000 1.000 0.000
#> SRR925701      2  0.0592      0.973 0.000 0.988 0.012
#> SRR925702      1  0.5810      0.492 0.664 0.000 0.336
#> SRR925703      3  0.5216      0.775 0.260 0.000 0.740
#> SRR925704      2  0.0000      0.979 0.000 1.000 0.000
#> SRR925705      2  0.0000      0.979 0.000 1.000 0.000
#> SRR925706      1  0.6062      0.442 0.616 0.000 0.384
#> SRR925708      1  0.0000      0.776 1.000 0.000 0.000
#> SRR925707      1  0.8347      0.241 0.512 0.084 0.404
#> SRR925709      1  0.5216      0.582 0.740 0.000 0.260
#> SRR925710      1  0.7770      0.315 0.560 0.056 0.384
#> SRR925711      3  0.1643      0.740 0.044 0.000 0.956
#> SRR934631      2  0.0892      0.968 0.000 0.980 0.020
#> SRR934632      2  0.0892      0.968 0.000 0.980 0.020
#> SRR934633      2  0.0000      0.979 0.000 1.000 0.000
#> SRR925713      1  0.6062      0.442 0.616 0.000 0.384
#> SRR925714      3  0.4062      0.885 0.164 0.000 0.836
#> SRR925715      1  0.6062      0.442 0.616 0.000 0.384
#> SRR925716      3  0.4750      0.893 0.216 0.000 0.784
#> SRR925717      1  0.6062      0.442 0.616 0.000 0.384
#> SRR925718      2  0.0000      0.979 0.000 1.000 0.000
#> SRR925719      1  0.0747      0.770 0.984 0.000 0.016
#> SRR925720      1  0.0000      0.776 1.000 0.000 0.000
#> SRR925721      1  0.0424      0.773 0.992 0.000 0.008
#> SRR934634      1  0.0000      0.776 1.000 0.000 0.000
#> SRR934635      1  0.0000      0.776 1.000 0.000 0.000
#> SRR925723      2  0.0000      0.979 0.000 1.000 0.000
#> SRR925724      2  0.0000      0.979 0.000 1.000 0.000
#> SRR925725      2  0.0000      0.979 0.000 1.000 0.000
#> SRR925726      1  0.6008      0.456 0.628 0.000 0.372
#> SRR925727      2  0.0000      0.979 0.000 1.000 0.000
#> SRR925728      1  0.5835      0.486 0.660 0.000 0.340
#> SRR934636      3  0.4750      0.893 0.216 0.000 0.784
#> SRR934637      3  0.4750      0.893 0.216 0.000 0.784
#> SRR925729      2  0.0000      0.979 0.000 1.000 0.000
#> SRR934638      1  0.0000      0.776 1.000 0.000 0.000
#> SRR934639      1  0.0000      0.776 1.000 0.000 0.000
#> SRR934640      2  0.4121      0.821 0.000 0.832 0.168
#> SRR934641      2  0.4121      0.820 0.000 0.832 0.168
#> SRR925734      1  0.0000      0.776 1.000 0.000 0.000
#> SRR925735      2  0.3551      0.856 0.000 0.868 0.132
#> SRR925736      2  0.0000      0.979 0.000 1.000 0.000
#> SRR925737      2  0.0000      0.979 0.000 1.000 0.000
#> SRR934642      2  0.2165      0.936 0.000 0.936 0.064
#> SRR934643      2  0.2165      0.936 0.000 0.936 0.064
#> SRR934644      2  0.0000      0.979 0.000 1.000 0.000
#> SRR934645      2  0.0000      0.979 0.000 1.000 0.000
#> SRR925740      2  0.0000      0.979 0.000 1.000 0.000
#> SRR925741      2  0.0000      0.979 0.000 1.000 0.000
#> SRR925742      2  0.0000      0.979 0.000 1.000 0.000
#> SRR1283038     2  0.0000      0.979 0.000 1.000 0.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> SRR925687      1  0.0000      0.928 1.000 0.000 0.000 0.000
#> SRR925688      1  0.0000      0.928 1.000 0.000 0.000 0.000
#> SRR925689      1  0.0000      0.928 1.000 0.000 0.000 0.000
#> SRR925690      1  0.0000      0.928 1.000 0.000 0.000 0.000
#> SRR925691      1  0.0000      0.928 1.000 0.000 0.000 0.000
#> SRR925692      1  0.0000      0.928 1.000 0.000 0.000 0.000
#> SRR925693      3  0.4228      0.833 0.000 0.232 0.760 0.008
#> SRR925694      3  0.1118      0.880 0.000 0.036 0.964 0.000
#> SRR925695      3  0.3074      0.859 0.000 0.152 0.848 0.000
#> SRR925697      4  0.3610      0.995 0.200 0.000 0.000 0.800
#> SRR925696      3  0.3649      0.848 0.000 0.204 0.796 0.000
#> SRR925698      3  0.3074      0.859 0.000 0.152 0.848 0.000
#> SRR925699      3  0.1118      0.880 0.000 0.036 0.964 0.000
#> SRR925700      3  0.1389      0.881 0.000 0.048 0.952 0.000
#> SRR925701      3  0.0000      0.885 0.000 0.000 1.000 0.000
#> SRR925702      1  0.3398      0.866 0.872 0.060 0.000 0.068
#> SRR925703      4  0.4175      0.976 0.200 0.016 0.000 0.784
#> SRR925704      3  0.3074      0.859 0.000 0.152 0.848 0.000
#> SRR925705      3  0.3528      0.852 0.000 0.192 0.808 0.000
#> SRR925706      1  0.3691      0.855 0.856 0.076 0.000 0.068
#> SRR925708      1  0.0000      0.928 1.000 0.000 0.000 0.000
#> SRR925707      3  0.7736      0.302 0.252 0.108 0.580 0.060
#> SRR925709      1  0.2101      0.896 0.928 0.012 0.000 0.060
#> SRR925710      1  0.5222      0.720 0.792 0.056 0.108 0.044
#> SRR925711      2  0.4406      0.000 0.000 0.700 0.000 0.300
#> SRR934631      3  0.1118      0.880 0.000 0.036 0.964 0.000
#> SRR934632      3  0.1118      0.880 0.000 0.036 0.964 0.000
#> SRR934633      3  0.1118      0.880 0.000 0.036 0.964 0.000
#> SRR925713      1  0.3691      0.855 0.856 0.076 0.000 0.068
#> SRR925714      4  0.3610      0.995 0.200 0.000 0.000 0.800
#> SRR925715      1  0.3948      0.841 0.840 0.096 0.000 0.064
#> SRR925716      4  0.3610      0.995 0.200 0.000 0.000 0.800
#> SRR925717      1  0.3547      0.860 0.864 0.072 0.000 0.064
#> SRR925718      3  0.0000      0.885 0.000 0.000 1.000 0.000
#> SRR925719      1  0.0592      0.921 0.984 0.000 0.000 0.016
#> SRR925720      1  0.0000      0.928 1.000 0.000 0.000 0.000
#> SRR925721      1  0.0000      0.928 1.000 0.000 0.000 0.000
#> SRR934634      1  0.0000      0.928 1.000 0.000 0.000 0.000
#> SRR934635      1  0.0000      0.928 1.000 0.000 0.000 0.000
#> SRR925723      3  0.3074      0.859 0.000 0.152 0.848 0.000
#> SRR925724      3  0.4228      0.833 0.000 0.232 0.760 0.008
#> SRR925725      3  0.4228      0.833 0.000 0.232 0.760 0.008
#> SRR925726      1  0.4552      0.789 0.800 0.072 0.000 0.128
#> SRR925727      3  0.4228      0.833 0.000 0.232 0.760 0.008
#> SRR925728      1  0.4055      0.834 0.832 0.108 0.000 0.060
#> SRR934636      4  0.3610      0.995 0.200 0.000 0.000 0.800
#> SRR934637      4  0.3610      0.995 0.200 0.000 0.000 0.800
#> SRR925729      3  0.1118      0.880 0.000 0.036 0.964 0.000
#> SRR934638      1  0.0000      0.928 1.000 0.000 0.000 0.000
#> SRR934639      1  0.0000      0.928 1.000 0.000 0.000 0.000
#> SRR934640      3  0.4050      0.801 0.000 0.144 0.820 0.036
#> SRR934641      3  0.4050      0.801 0.000 0.144 0.820 0.036
#> SRR925734      1  0.0000      0.928 1.000 0.000 0.000 0.000
#> SRR925735      3  0.3876      0.836 0.000 0.124 0.836 0.040
#> SRR925736      3  0.2814      0.875 0.000 0.132 0.868 0.000
#> SRR925737      3  0.1716      0.882 0.000 0.064 0.936 0.000
#> SRR934642      3  0.0921      0.885 0.000 0.028 0.972 0.000
#> SRR934643      3  0.0921      0.885 0.000 0.028 0.972 0.000
#> SRR934644      3  0.1118      0.880 0.000 0.036 0.964 0.000
#> SRR934645      3  0.1118      0.880 0.000 0.036 0.964 0.000
#> SRR925740      3  0.0000      0.885 0.000 0.000 1.000 0.000
#> SRR925741      3  0.3074      0.859 0.000 0.152 0.848 0.000
#> SRR925742      3  0.0000      0.885 0.000 0.000 1.000 0.000
#> SRR1283038     3  0.2973      0.862 0.000 0.144 0.856 0.000

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>            class entropy silhouette    p1    p2    p3    p4    p5
#> SRR925687      4  0.0880     0.7606 0.000 0.000 0.000 0.968 0.032
#> SRR925688      4  0.1270     0.7568 0.000 0.000 0.000 0.948 0.052
#> SRR925689      4  0.0000     0.7761 0.000 0.000 0.000 1.000 0.000
#> SRR925690      4  0.0000     0.7761 0.000 0.000 0.000 1.000 0.000
#> SRR925691      4  0.0000     0.7761 0.000 0.000 0.000 1.000 0.000
#> SRR925692      4  0.0000     0.7761 0.000 0.000 0.000 1.000 0.000
#> SRR925693      3  0.4256     0.5256 0.000 0.436 0.564 0.000 0.000
#> SRR925694      2  0.0404     0.6945 0.012 0.988 0.000 0.000 0.000
#> SRR925695      2  0.3752     0.3145 0.000 0.708 0.292 0.000 0.000
#> SRR925697      5  0.0000     0.7248 0.000 0.000 0.000 0.000 1.000
#> SRR925696      3  0.4305     0.5065 0.000 0.488 0.512 0.000 0.000
#> SRR925698      2  0.3707     0.3379 0.000 0.716 0.284 0.000 0.000
#> SRR925699      2  0.0404     0.6945 0.012 0.988 0.000 0.000 0.000
#> SRR925700      2  0.1282     0.6705 0.004 0.952 0.044 0.000 0.000
#> SRR925701      2  0.0000     0.6926 0.000 1.000 0.000 0.000 0.000
#> SRR925702      4  0.7082     0.4198 0.048 0.000 0.348 0.468 0.136
#> SRR925703      5  0.0000     0.7248 0.000 0.000 0.000 0.000 1.000
#> SRR925704      2  0.3661     0.3588 0.000 0.724 0.276 0.000 0.000
#> SRR925705      2  0.4262    -0.3503 0.000 0.560 0.440 0.000 0.000
#> SRR925706      4  0.6793     0.3846 0.024 0.000 0.400 0.436 0.140
#> SRR925708      4  0.0000     0.7761 0.000 0.000 0.000 1.000 0.000
#> SRR925707      3  0.5666    -0.3222 0.008 0.064 0.720 0.072 0.136
#> SRR925709      4  0.5392     0.5764 0.004 0.000 0.216 0.668 0.112
#> SRR925710      4  0.7346     0.3522 0.008 0.028 0.360 0.420 0.184
#> SRR925711      1  0.0404     0.0000 0.988 0.000 0.012 0.000 0.000
#> SRR934631      2  0.0404     0.6945 0.012 0.988 0.000 0.000 0.000
#> SRR934632      2  0.0404     0.6945 0.012 0.988 0.000 0.000 0.000
#> SRR934633      2  0.0404     0.6945 0.012 0.988 0.000 0.000 0.000
#> SRR925713      4  0.7488     0.3319 0.048 0.000 0.360 0.388 0.204
#> SRR925714      5  0.0000     0.7248 0.000 0.000 0.000 0.000 1.000
#> SRR925715      4  0.6593     0.4155 0.008 0.000 0.372 0.456 0.164
#> SRR925716      5  0.2471     0.6499 0.000 0.000 0.000 0.136 0.864
#> SRR925717      4  0.7171     0.4477 0.048 0.000 0.232 0.512 0.208
#> SRR925718      2  0.0000     0.6926 0.000 1.000 0.000 0.000 0.000
#> SRR925719      4  0.0404     0.7713 0.000 0.000 0.000 0.988 0.012
#> SRR925720      4  0.1341     0.7440 0.000 0.000 0.000 0.944 0.056
#> SRR925721      4  0.0162     0.7743 0.000 0.000 0.000 0.996 0.004
#> SRR934634      4  0.0000     0.7761 0.000 0.000 0.000 1.000 0.000
#> SRR934635      4  0.0000     0.7761 0.000 0.000 0.000 1.000 0.000
#> SRR925723      2  0.3586     0.3864 0.000 0.736 0.264 0.000 0.000
#> SRR925724      3  0.4304     0.5226 0.000 0.484 0.516 0.000 0.000
#> SRR925725      3  0.4283     0.5520 0.000 0.456 0.544 0.000 0.000
#> SRR925726      5  0.5159    -0.1570 0.008 0.000 0.024 0.472 0.496
#> SRR925727      3  0.4294     0.5478 0.000 0.468 0.532 0.000 0.000
#> SRR925728      4  0.7132     0.4049 0.052 0.000 0.364 0.452 0.132
#> SRR934636      5  0.2773     0.6587 0.000 0.000 0.000 0.164 0.836
#> SRR934637      5  0.1732     0.7151 0.000 0.000 0.000 0.080 0.920
#> SRR925729      2  0.0404     0.6945 0.012 0.988 0.000 0.000 0.000
#> SRR934638      4  0.0000     0.7761 0.000 0.000 0.000 1.000 0.000
#> SRR934639      4  0.0000     0.7761 0.000 0.000 0.000 1.000 0.000
#> SRR934640      2  0.3809     0.4068 0.008 0.736 0.256 0.000 0.000
#> SRR934641      2  0.3783     0.4129 0.008 0.740 0.252 0.000 0.000
#> SRR925734      4  0.0000     0.7761 0.000 0.000 0.000 1.000 0.000
#> SRR925735      2  0.2971     0.5914 0.008 0.836 0.156 0.000 0.000
#> SRR925736      2  0.3966     0.0869 0.000 0.664 0.336 0.000 0.000
#> SRR925737      2  0.3661     0.2696 0.000 0.724 0.276 0.000 0.000
#> SRR934642      2  0.3857     0.1703 0.000 0.688 0.312 0.000 0.000
#> SRR934643      2  0.3816     0.1930 0.000 0.696 0.304 0.000 0.000
#> SRR934644      2  0.0404     0.6945 0.012 0.988 0.000 0.000 0.000
#> SRR934645      2  0.0404     0.6945 0.012 0.988 0.000 0.000 0.000
#> SRR925740      2  0.3752     0.2886 0.000 0.708 0.292 0.000 0.000
#> SRR925741      2  0.3266     0.4984 0.004 0.796 0.200 0.000 0.000
#> SRR925742      2  0.0609     0.6854 0.000 0.980 0.020 0.000 0.000
#> SRR1283038     2  0.2966     0.5221 0.000 0.816 0.184 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
#> SRR925687      1  0.1327     0.9391 0.936 0.000 0.000 0.000 0.064  0
#> SRR925688      1  0.1075     0.9507 0.952 0.000 0.000 0.000 0.048  0
#> SRR925689      1  0.0000     0.9728 1.000 0.000 0.000 0.000 0.000  0
#> SRR925690      1  0.0000     0.9728 1.000 0.000 0.000 0.000 0.000  0
#> SRR925691      1  0.0000     0.9728 1.000 0.000 0.000 0.000 0.000  0
#> SRR925692      1  0.0000     0.9728 1.000 0.000 0.000 0.000 0.000  0
#> SRR925693      3  0.2915     0.7801 0.000 0.184 0.808 0.008 0.000  0
#> SRR925694      2  0.0000     0.6955 0.000 1.000 0.000 0.000 0.000  0
#> SRR925695      2  0.3975     0.3445 0.000 0.600 0.392 0.008 0.000  0
#> SRR925697      5  0.0000     0.7784 0.000 0.000 0.000 0.000 1.000  0
#> SRR925696      3  0.1610     0.7748 0.000 0.084 0.916 0.000 0.000  0
#> SRR925698      2  0.3975     0.3445 0.000 0.600 0.392 0.008 0.000  0
#> SRR925699      2  0.0000     0.6955 0.000 1.000 0.000 0.000 0.000  0
#> SRR925700      2  0.3620     0.0464 0.000 0.648 0.352 0.000 0.000  0
#> SRR925701      2  0.0713     0.6895 0.000 0.972 0.028 0.000 0.000  0
#> SRR925702      4  0.0632     0.8134 0.024 0.000 0.000 0.976 0.000  0
#> SRR925703      5  0.0000     0.7784 0.000 0.000 0.000 0.000 1.000  0
#> SRR925704      2  0.3975     0.3445 0.000 0.600 0.392 0.008 0.000  0
#> SRR925705      3  0.3371     0.6297 0.000 0.292 0.708 0.000 0.000  0
#> SRR925706      4  0.0260     0.8171 0.008 0.000 0.000 0.992 0.000  0
#> SRR925708      1  0.1564     0.9372 0.936 0.000 0.000 0.040 0.024  0
#> SRR925707      4  0.0260     0.8123 0.000 0.008 0.000 0.992 0.000  0
#> SRR925709      4  0.2003     0.7332 0.116 0.000 0.000 0.884 0.000  0
#> SRR925710      4  0.4651     0.5728 0.208 0.028 0.040 0.716 0.008  0
#> SRR925711      6  0.0000     0.0000 0.000 0.000 0.000 0.000 0.000  1
#> SRR934631      2  0.0000     0.6955 0.000 1.000 0.000 0.000 0.000  0
#> SRR934632      2  0.0000     0.6955 0.000 1.000 0.000 0.000 0.000  0
#> SRR934633      2  0.0260     0.6951 0.000 0.992 0.008 0.000 0.000  0
#> SRR925713      4  0.0260     0.8141 0.000 0.000 0.000 0.992 0.008  0
#> SRR925714      5  0.0000     0.7784 0.000 0.000 0.000 0.000 1.000  0
#> SRR925715      4  0.1036     0.8072 0.004 0.000 0.024 0.964 0.008  0
#> SRR925716      5  0.0000     0.7784 0.000 0.000 0.000 0.000 1.000  0
#> SRR925717      4  0.5886     0.1425 0.388 0.000 0.000 0.412 0.200  0
#> SRR925718      2  0.1957     0.6452 0.000 0.888 0.112 0.000 0.000  0
#> SRR925719      1  0.1951     0.9201 0.908 0.000 0.000 0.016 0.076  0
#> SRR925720      1  0.1501     0.9282 0.924 0.000 0.000 0.000 0.076  0
#> SRR925721      1  0.0458     0.9670 0.984 0.000 0.000 0.000 0.016  0
#> SRR934634      1  0.0000     0.9728 1.000 0.000 0.000 0.000 0.000  0
#> SRR934635      1  0.0000     0.9728 1.000 0.000 0.000 0.000 0.000  0
#> SRR925723      2  0.3706     0.3862 0.000 0.620 0.380 0.000 0.000  0
#> SRR925724      3  0.1714     0.7797 0.000 0.092 0.908 0.000 0.000  0
#> SRR925725      3  0.2473     0.7928 0.000 0.136 0.856 0.008 0.000  0
#> SRR925726      5  0.4851     0.2061 0.404 0.000 0.000 0.060 0.536  0
#> SRR925727      3  0.2212     0.7894 0.000 0.112 0.880 0.008 0.000  0
#> SRR925728      4  0.0260     0.8171 0.008 0.000 0.000 0.992 0.000  0
#> SRR934636      5  0.3284     0.6516 0.168 0.000 0.000 0.032 0.800  0
#> SRR934637      5  0.3252     0.6834 0.108 0.000 0.000 0.068 0.824  0
#> SRR925729      2  0.0260     0.6951 0.000 0.992 0.008 0.000 0.000  0
#> SRR934638      1  0.0000     0.9728 1.000 0.000 0.000 0.000 0.000  0
#> SRR934639      1  0.0000     0.9728 1.000 0.000 0.000 0.000 0.000  0
#> SRR934640      2  0.3868    -0.1225 0.000 0.508 0.492 0.000 0.000  0
#> SRR934641      2  0.3868    -0.1225 0.000 0.508 0.492 0.000 0.000  0
#> SRR925734      1  0.0000     0.9728 1.000 0.000 0.000 0.000 0.000  0
#> SRR925735      2  0.2793     0.5990 0.000 0.800 0.200 0.000 0.000  0
#> SRR925736      3  0.2762     0.7720 0.000 0.196 0.804 0.000 0.000  0
#> SRR925737      3  0.3634     0.6372 0.000 0.356 0.644 0.000 0.000  0
#> SRR934642      3  0.3330     0.6421 0.000 0.284 0.716 0.000 0.000  0
#> SRR934643      3  0.3330     0.6421 0.000 0.284 0.716 0.000 0.000  0
#> SRR934644      2  0.0000     0.6955 0.000 1.000 0.000 0.000 0.000  0
#> SRR934645      2  0.0000     0.6955 0.000 1.000 0.000 0.000 0.000  0
#> SRR925740      3  0.3737     0.5778 0.000 0.392 0.608 0.000 0.000  0
#> SRR925741      2  0.3725     0.4752 0.000 0.676 0.316 0.008 0.000  0
#> SRR925742      2  0.2454     0.6119 0.000 0.840 0.160 0.000 0.000  0
#> SRR1283038     2  0.3446     0.4963 0.000 0.692 0.308 0.000 0.000  0

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

consensus_heatmap(res, k = 2)

plot of chunk tab-CV-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 15949 rows and 64 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 1.000           0.966       0.988         0.5078 0.493   0.493
#> 3 3 0.808           0.901       0.920         0.2434 0.865   0.729
#> 4 4 0.728           0.702       0.861         0.1650 0.864   0.642
#> 5 5 0.725           0.705       0.833         0.0735 0.902   0.649
#> 6 6 0.795           0.757       0.797         0.0450 0.933   0.699

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
#> SRR925687      1   0.000      0.988 1.000 0.000
#> SRR925688      1   0.000      0.988 1.000 0.000
#> SRR925689      1   0.000      0.988 1.000 0.000
#> SRR925690      1   0.000      0.988 1.000 0.000
#> SRR925691      1   0.000      0.988 1.000 0.000
#> SRR925692      1   0.000      0.988 1.000 0.000
#> SRR925693      2   0.000      0.986 0.000 1.000
#> SRR925694      2   0.000      0.986 0.000 1.000
#> SRR925695      2   0.000      0.986 0.000 1.000
#> SRR925697      1   0.000      0.988 1.000 0.000
#> SRR925696      2   0.000      0.986 0.000 1.000
#> SRR925698      2   0.000      0.986 0.000 1.000
#> SRR925699      2   0.000      0.986 0.000 1.000
#> SRR925700      2   0.000      0.986 0.000 1.000
#> SRR925701      2   0.000      0.986 0.000 1.000
#> SRR925702      1   0.000      0.988 1.000 0.000
#> SRR925703      1   0.000      0.988 1.000 0.000
#> SRR925704      2   0.000      0.986 0.000 1.000
#> SRR925705      2   0.000      0.986 0.000 1.000
#> SRR925706      1   0.000      0.988 1.000 0.000
#> SRR925708      1   0.000      0.988 1.000 0.000
#> SRR925707      2   0.992      0.173 0.448 0.552
#> SRR925709      1   0.000      0.988 1.000 0.000
#> SRR925710      1   0.000      0.988 1.000 0.000
#> SRR925711      1   0.929      0.465 0.656 0.344
#> SRR934631      2   0.000      0.986 0.000 1.000
#> SRR934632      2   0.000      0.986 0.000 1.000
#> SRR934633      2   0.000      0.986 0.000 1.000
#> SRR925713      1   0.000      0.988 1.000 0.000
#> SRR925714      1   0.000      0.988 1.000 0.000
#> SRR925715      1   0.000      0.988 1.000 0.000
#> SRR925716      1   0.000      0.988 1.000 0.000
#> SRR925717      1   0.000      0.988 1.000 0.000
#> SRR925718      2   0.000      0.986 0.000 1.000
#> SRR925719      1   0.000      0.988 1.000 0.000
#> SRR925720      1   0.000      0.988 1.000 0.000
#> SRR925721      1   0.000      0.988 1.000 0.000
#> SRR934634      1   0.000      0.988 1.000 0.000
#> SRR934635      1   0.000      0.988 1.000 0.000
#> SRR925723      2   0.000      0.986 0.000 1.000
#> SRR925724      2   0.000      0.986 0.000 1.000
#> SRR925725      2   0.000      0.986 0.000 1.000
#> SRR925726      1   0.000      0.988 1.000 0.000
#> SRR925727      2   0.000      0.986 0.000 1.000
#> SRR925728      1   0.000      0.988 1.000 0.000
#> SRR934636      1   0.000      0.988 1.000 0.000
#> SRR934637      1   0.000      0.988 1.000 0.000
#> SRR925729      2   0.000      0.986 0.000 1.000
#> SRR934638      1   0.000      0.988 1.000 0.000
#> SRR934639      1   0.000      0.988 1.000 0.000
#> SRR934640      2   0.000      0.986 0.000 1.000
#> SRR934641      2   0.000      0.986 0.000 1.000
#> SRR925734      1   0.000      0.988 1.000 0.000
#> SRR925735      2   0.000      0.986 0.000 1.000
#> SRR925736      2   0.000      0.986 0.000 1.000
#> SRR925737      2   0.000      0.986 0.000 1.000
#> SRR934642      2   0.000      0.986 0.000 1.000
#> SRR934643      2   0.000      0.986 0.000 1.000
#> SRR934644      2   0.000      0.986 0.000 1.000
#> SRR934645      2   0.000      0.986 0.000 1.000
#> SRR925740      2   0.000      0.986 0.000 1.000
#> SRR925741      2   0.000      0.986 0.000 1.000
#> SRR925742      2   0.000      0.986 0.000 1.000
#> SRR1283038     2   0.000      0.986 0.000 1.000

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>            class entropy silhouette    p1    p2    p3
#> SRR925687      1  0.0000      0.943 1.000 0.000 0.000
#> SRR925688      1  0.0000      0.943 1.000 0.000 0.000
#> SRR925689      1  0.0000      0.943 1.000 0.000 0.000
#> SRR925690      1  0.0000      0.943 1.000 0.000 0.000
#> SRR925691      1  0.0000      0.943 1.000 0.000 0.000
#> SRR925692      1  0.0000      0.943 1.000 0.000 0.000
#> SRR925693      2  0.2878      0.939 0.000 0.904 0.096
#> SRR925694      2  0.2796      0.937 0.000 0.908 0.092
#> SRR925695      2  0.1163      0.947 0.000 0.972 0.028
#> SRR925697      3  0.4887      0.862 0.228 0.000 0.772
#> SRR925696      2  0.0592      0.953 0.000 0.988 0.012
#> SRR925698      2  0.1411      0.943 0.000 0.964 0.036
#> SRR925699      2  0.2066      0.949 0.000 0.940 0.060
#> SRR925700      2  0.1289      0.954 0.000 0.968 0.032
#> SRR925701      2  0.0747      0.954 0.000 0.984 0.016
#> SRR925702      3  0.3686      0.822 0.140 0.000 0.860
#> SRR925703      3  0.4931      0.863 0.232 0.000 0.768
#> SRR925704      2  0.0892      0.955 0.000 0.980 0.020
#> SRR925705      2  0.0592      0.953 0.000 0.988 0.012
#> SRR925706      3  0.2448      0.830 0.076 0.000 0.924
#> SRR925708      1  0.0000      0.943 1.000 0.000 0.000
#> SRR925707      3  0.2689      0.800 0.032 0.036 0.932
#> SRR925709      1  0.3816      0.799 0.852 0.000 0.148
#> SRR925710      1  0.3941      0.792 0.844 0.000 0.156
#> SRR925711      3  0.8650      0.555 0.136 0.292 0.572
#> SRR934631      2  0.2261      0.946 0.000 0.932 0.068
#> SRR934632      2  0.2261      0.946 0.000 0.932 0.068
#> SRR934633      2  0.2261      0.946 0.000 0.932 0.068
#> SRR925713      3  0.2537      0.831 0.080 0.000 0.920
#> SRR925714      3  0.4931      0.863 0.232 0.000 0.768
#> SRR925715      1  0.4750      0.738 0.784 0.000 0.216
#> SRR925716      3  0.5138      0.851 0.252 0.000 0.748
#> SRR925717      1  0.5363      0.464 0.724 0.000 0.276
#> SRR925718      2  0.0424      0.953 0.000 0.992 0.008
#> SRR925719      1  0.0000      0.943 1.000 0.000 0.000
#> SRR925720      1  0.0000      0.943 1.000 0.000 0.000
#> SRR925721      1  0.0000      0.943 1.000 0.000 0.000
#> SRR934634      1  0.0000      0.943 1.000 0.000 0.000
#> SRR934635      1  0.0000      0.943 1.000 0.000 0.000
#> SRR925723      2  0.0592      0.953 0.000 0.988 0.012
#> SRR925724      2  0.1529      0.941 0.000 0.960 0.040
#> SRR925725      2  0.2261      0.948 0.000 0.932 0.068
#> SRR925726      3  0.5138      0.851 0.252 0.000 0.748
#> SRR925727      2  0.1289      0.945 0.000 0.968 0.032
#> SRR925728      3  0.3116      0.830 0.108 0.000 0.892
#> SRR934636      3  0.4974      0.861 0.236 0.000 0.764
#> SRR934637      3  0.4974      0.861 0.236 0.000 0.764
#> SRR925729      2  0.3116      0.928 0.000 0.892 0.108
#> SRR934638      1  0.0592      0.934 0.988 0.000 0.012
#> SRR934639      1  0.0000      0.943 1.000 0.000 0.000
#> SRR934640      2  0.4796      0.824 0.000 0.780 0.220
#> SRR934641      2  0.4796      0.824 0.000 0.780 0.220
#> SRR925734      1  0.0000      0.943 1.000 0.000 0.000
#> SRR925735      2  0.3879      0.893 0.000 0.848 0.152
#> SRR925736      2  0.0592      0.953 0.000 0.988 0.012
#> SRR925737      2  0.0592      0.953 0.000 0.988 0.012
#> SRR934642      2  0.0424      0.953 0.000 0.992 0.008
#> SRR934643      2  0.0424      0.953 0.000 0.992 0.008
#> SRR934644      2  0.2448      0.944 0.000 0.924 0.076
#> SRR934645      2  0.2356      0.945 0.000 0.928 0.072
#> SRR925740      2  0.0424      0.953 0.000 0.992 0.008
#> SRR925741      2  0.2261      0.946 0.000 0.932 0.068
#> SRR925742      2  0.0592      0.953 0.000 0.988 0.012
#> SRR1283038     2  0.1031      0.955 0.000 0.976 0.024

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> SRR925687      1  0.0188      0.964 0.996 0.004 0.000 0.000
#> SRR925688      1  0.0188      0.964 0.996 0.004 0.000 0.000
#> SRR925689      1  0.0921      0.956 0.972 0.028 0.000 0.000
#> SRR925690      1  0.0921      0.956 0.972 0.028 0.000 0.000
#> SRR925691      1  0.0921      0.956 0.972 0.028 0.000 0.000
#> SRR925692      1  0.0921      0.956 0.972 0.028 0.000 0.000
#> SRR925693      3  0.4819      0.301 0.000 0.344 0.652 0.004
#> SRR925694      2  0.2589      0.579 0.000 0.884 0.116 0.000
#> SRR925695      3  0.0779      0.794 0.000 0.016 0.980 0.004
#> SRR925697      4  0.0469      0.838 0.012 0.000 0.000 0.988
#> SRR925696      3  0.0469      0.802 0.000 0.012 0.988 0.000
#> SRR925698      3  0.0469      0.797 0.000 0.012 0.988 0.000
#> SRR925699      3  0.4713      0.403 0.000 0.360 0.640 0.000
#> SRR925700      3  0.4522      0.488 0.000 0.320 0.680 0.000
#> SRR925701      3  0.3528      0.698 0.000 0.192 0.808 0.000
#> SRR925702      4  0.4248      0.767 0.012 0.220 0.000 0.768
#> SRR925703      4  0.0469      0.838 0.012 0.000 0.000 0.988
#> SRR925704      3  0.1398      0.787 0.000 0.040 0.956 0.004
#> SRR925705      3  0.0000      0.802 0.000 0.000 1.000 0.000
#> SRR925706      4  0.4564      0.708 0.000 0.328 0.000 0.672
#> SRR925708      1  0.0188      0.964 0.996 0.004 0.000 0.000
#> SRR925707      4  0.5028      0.645 0.000 0.400 0.004 0.596
#> SRR925709      1  0.4868      0.572 0.684 0.304 0.000 0.012
#> SRR925710      2  0.5503     -0.198 0.468 0.516 0.000 0.016
#> SRR925711      4  0.3236      0.719 0.004 0.004 0.136 0.856
#> SRR934631      2  0.4955      0.185 0.000 0.556 0.444 0.000
#> SRR934632      2  0.4955      0.185 0.000 0.556 0.444 0.000
#> SRR934633      2  0.4955      0.185 0.000 0.556 0.444 0.000
#> SRR925713      4  0.5204      0.665 0.012 0.376 0.000 0.612
#> SRR925714      4  0.0469      0.838 0.012 0.000 0.000 0.988
#> SRR925715      2  0.4732      0.359 0.200 0.768 0.012 0.020
#> SRR925716      4  0.0592      0.838 0.016 0.000 0.000 0.984
#> SRR925717      1  0.3108      0.863 0.872 0.016 0.000 0.112
#> SRR925718      3  0.3486      0.703 0.000 0.188 0.812 0.000
#> SRR925719      1  0.0188      0.964 0.996 0.004 0.000 0.000
#> SRR925720      1  0.0188      0.964 0.996 0.004 0.000 0.000
#> SRR925721      1  0.0188      0.964 0.996 0.004 0.000 0.000
#> SRR934634      1  0.0188      0.964 0.996 0.004 0.000 0.000
#> SRR934635      1  0.0188      0.963 0.996 0.004 0.000 0.000
#> SRR925723      3  0.0000      0.802 0.000 0.000 1.000 0.000
#> SRR925724      3  0.0188      0.800 0.000 0.004 0.996 0.000
#> SRR925725      3  0.4252      0.504 0.000 0.252 0.744 0.004
#> SRR925726      4  0.0707      0.836 0.020 0.000 0.000 0.980
#> SRR925727      3  0.0779      0.794 0.000 0.016 0.980 0.004
#> SRR925728      4  0.5099      0.667 0.008 0.380 0.000 0.612
#> SRR934636      4  0.0592      0.838 0.016 0.000 0.000 0.984
#> SRR934637      4  0.0592      0.838 0.016 0.000 0.000 0.984
#> SRR925729      2  0.2011      0.587 0.000 0.920 0.080 0.000
#> SRR934638      1  0.0000      0.964 1.000 0.000 0.000 0.000
#> SRR934639      1  0.0188      0.963 0.996 0.004 0.000 0.000
#> SRR934640      2  0.1545      0.562 0.000 0.952 0.040 0.008
#> SRR934641      2  0.1545      0.562 0.000 0.952 0.040 0.008
#> SRR925734      1  0.0188      0.963 0.996 0.004 0.000 0.000
#> SRR925735      2  0.4819      0.389 0.004 0.652 0.344 0.000
#> SRR925736      3  0.0336      0.802 0.000 0.008 0.992 0.000
#> SRR925737      3  0.1940      0.787 0.000 0.076 0.924 0.000
#> SRR934642      3  0.3486      0.703 0.000 0.188 0.812 0.000
#> SRR934643      3  0.3486      0.703 0.000 0.188 0.812 0.000
#> SRR934644      2  0.4661      0.369 0.000 0.652 0.348 0.000
#> SRR934645      2  0.4916      0.232 0.000 0.576 0.424 0.000
#> SRR925740      3  0.1716      0.793 0.000 0.064 0.936 0.000
#> SRR925741      3  0.4730      0.239 0.000 0.364 0.636 0.000
#> SRR925742      3  0.1557      0.795 0.000 0.056 0.944 0.000
#> SRR1283038     3  0.2647      0.720 0.000 0.120 0.880 0.000

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>            class entropy silhouette    p1    p2    p3    p4    p5
#> SRR925687      1  0.0703     0.9022 0.976 0.000 0.000 0.024 0.000
#> SRR925688      1  0.0703     0.9022 0.976 0.000 0.000 0.024 0.000
#> SRR925689      1  0.4322     0.8072 0.768 0.088 0.000 0.144 0.000
#> SRR925690      1  0.4322     0.8072 0.768 0.088 0.000 0.144 0.000
#> SRR925691      1  0.4322     0.8072 0.768 0.088 0.000 0.144 0.000
#> SRR925692      1  0.4322     0.8072 0.768 0.088 0.000 0.144 0.000
#> SRR925693      2  0.5908     0.4566 0.000 0.512 0.380 0.108 0.000
#> SRR925694      2  0.2124     0.6667 0.000 0.900 0.004 0.096 0.000
#> SRR925695      3  0.4490     0.4124 0.000 0.224 0.724 0.052 0.000
#> SRR925697      5  0.0000     0.9624 0.000 0.000 0.000 0.000 1.000
#> SRR925696      3  0.0880     0.7737 0.000 0.032 0.968 0.000 0.000
#> SRR925698      3  0.1408     0.7374 0.000 0.008 0.948 0.044 0.000
#> SRR925699      3  0.4291     0.2511 0.000 0.464 0.536 0.000 0.000
#> SRR925700      3  0.3983     0.4995 0.000 0.340 0.660 0.000 0.000
#> SRR925701      3  0.3796     0.5573 0.000 0.300 0.700 0.000 0.000
#> SRR925702      4  0.4329     0.5869 0.016 0.000 0.000 0.672 0.312
#> SRR925703      5  0.0000     0.9624 0.000 0.000 0.000 0.000 1.000
#> SRR925704      3  0.5302    -0.1954 0.000 0.412 0.536 0.052 0.000
#> SRR925705      3  0.0290     0.7692 0.000 0.008 0.992 0.000 0.000
#> SRR925706      4  0.3521     0.6974 0.000 0.004 0.000 0.764 0.232
#> SRR925708      1  0.0703     0.9022 0.976 0.000 0.000 0.024 0.000
#> SRR925707      4  0.3496     0.7195 0.000 0.012 0.000 0.788 0.200
#> SRR925709      4  0.3913     0.5095 0.324 0.000 0.000 0.676 0.000
#> SRR925710      4  0.4000     0.6845 0.164 0.044 0.004 0.788 0.000
#> SRR925711      5  0.3975     0.7074 0.000 0.000 0.144 0.064 0.792
#> SRR934631      2  0.2329     0.7292 0.000 0.876 0.124 0.000 0.000
#> SRR934632      2  0.2329     0.7292 0.000 0.876 0.124 0.000 0.000
#> SRR934633      2  0.2329     0.7292 0.000 0.876 0.124 0.000 0.000
#> SRR925713      4  0.3381     0.7254 0.016 0.000 0.000 0.808 0.176
#> SRR925714      5  0.0000     0.9624 0.000 0.000 0.000 0.000 1.000
#> SRR925715      4  0.3193     0.6933 0.032 0.112 0.004 0.852 0.000
#> SRR925716      5  0.0000     0.9624 0.000 0.000 0.000 0.000 1.000
#> SRR925717      1  0.6679     0.6351 0.624 0.072 0.012 0.088 0.204
#> SRR925718      3  0.2690     0.7189 0.000 0.156 0.844 0.000 0.000
#> SRR925719      1  0.0703     0.9022 0.976 0.000 0.000 0.024 0.000
#> SRR925720      1  0.0703     0.9022 0.976 0.000 0.000 0.024 0.000
#> SRR925721      1  0.0703     0.9022 0.976 0.000 0.000 0.024 0.000
#> SRR934634      1  0.0703     0.9022 0.976 0.000 0.000 0.024 0.000
#> SRR934635      1  0.0290     0.8983 0.992 0.000 0.000 0.008 0.000
#> SRR925723      3  0.0000     0.7658 0.000 0.000 1.000 0.000 0.000
#> SRR925724      3  0.0162     0.7637 0.000 0.004 0.996 0.000 0.000
#> SRR925725      2  0.5341     0.3784 0.000 0.504 0.444 0.052 0.000
#> SRR925726      5  0.0162     0.9588 0.000 0.000 0.000 0.004 0.996
#> SRR925727      3  0.2054     0.7179 0.000 0.028 0.920 0.052 0.000
#> SRR925728      4  0.3333     0.7157 0.000 0.004 0.000 0.788 0.208
#> SRR934636      5  0.0000     0.9624 0.000 0.000 0.000 0.000 1.000
#> SRR934637      5  0.0000     0.9624 0.000 0.000 0.000 0.000 1.000
#> SRR925729      2  0.2471     0.6285 0.000 0.864 0.000 0.136 0.000
#> SRR934638      1  0.2074     0.8411 0.896 0.000 0.000 0.104 0.000
#> SRR934639      1  0.0703     0.8969 0.976 0.000 0.000 0.024 0.000
#> SRR934640      4  0.4219     0.3539 0.000 0.416 0.000 0.584 0.000
#> SRR934641      4  0.4235     0.3347 0.000 0.424 0.000 0.576 0.000
#> SRR925734      1  0.0162     0.9001 0.996 0.000 0.000 0.004 0.000
#> SRR925735      2  0.6231     0.4925 0.000 0.544 0.204 0.252 0.000
#> SRR925736      3  0.0510     0.7714 0.000 0.016 0.984 0.000 0.000
#> SRR925737      3  0.1121     0.7737 0.000 0.044 0.956 0.000 0.000
#> SRR934642      3  0.2690     0.7189 0.000 0.156 0.844 0.000 0.000
#> SRR934643      3  0.2690     0.7189 0.000 0.156 0.844 0.000 0.000
#> SRR934644      2  0.2300     0.7240 0.000 0.908 0.052 0.040 0.000
#> SRR934645      2  0.1908     0.7368 0.000 0.908 0.092 0.000 0.000
#> SRR925740      3  0.1197     0.7727 0.000 0.048 0.952 0.000 0.000
#> SRR925741      2  0.5272     0.4728 0.000 0.552 0.396 0.052 0.000
#> SRR925742      3  0.1121     0.7737 0.000 0.044 0.956 0.000 0.000
#> SRR1283038     3  0.5236    -0.0916 0.000 0.380 0.568 0.052 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
#> SRR925687      1  0.3817      0.948 0.568 0.000 0.000 0.000 0.000 0.432
#> SRR925688      1  0.3817      0.948 0.568 0.000 0.000 0.000 0.000 0.432
#> SRR925689      6  0.0000      0.829 0.000 0.000 0.000 0.000 0.000 1.000
#> SRR925690      6  0.0000      0.829 0.000 0.000 0.000 0.000 0.000 1.000
#> SRR925691      6  0.0000      0.829 0.000 0.000 0.000 0.000 0.000 1.000
#> SRR925692      6  0.0000      0.829 0.000 0.000 0.000 0.000 0.000 1.000
#> SRR925693      2  0.3370      0.571 0.008 0.828 0.092 0.072 0.000 0.000
#> SRR925694      2  0.5348      0.561 0.404 0.504 0.008 0.084 0.000 0.000
#> SRR925695      2  0.3804      0.358 0.000 0.656 0.336 0.008 0.000 0.000
#> SRR925697      5  0.0000      0.963 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR925696      3  0.0260      0.858 0.000 0.008 0.992 0.000 0.000 0.000
#> SRR925698      3  0.3428      0.528 0.000 0.304 0.696 0.000 0.000 0.000
#> SRR925699      3  0.5442      0.384 0.164 0.244 0.588 0.004 0.000 0.000
#> SRR925700      3  0.3732      0.699 0.076 0.144 0.780 0.000 0.000 0.000
#> SRR925701      3  0.2867      0.765 0.040 0.112 0.848 0.000 0.000 0.000
#> SRR925702      4  0.2070      0.801 0.008 0.000 0.000 0.892 0.100 0.000
#> SRR925703      5  0.0000      0.963 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR925704      2  0.3217      0.549 0.000 0.768 0.224 0.008 0.000 0.000
#> SRR925705      3  0.0458      0.856 0.000 0.016 0.984 0.000 0.000 0.000
#> SRR925706      4  0.1531      0.822 0.004 0.000 0.000 0.928 0.068 0.000
#> SRR925708      1  0.3817      0.948 0.568 0.000 0.000 0.000 0.000 0.432
#> SRR925707      4  0.1387      0.822 0.000 0.000 0.000 0.932 0.068 0.000
#> SRR925709      4  0.3261      0.662 0.204 0.000 0.000 0.780 0.000 0.016
#> SRR925710      4  0.5358      0.658 0.240 0.092 0.000 0.636 0.000 0.032
#> SRR925711      5  0.3802      0.754 0.008 0.000 0.116 0.084 0.792 0.000
#> SRR934631      2  0.5513      0.643 0.288 0.600 0.056 0.056 0.000 0.000
#> SRR934632      2  0.5513      0.643 0.288 0.600 0.056 0.056 0.000 0.000
#> SRR934633      2  0.5513      0.643 0.288 0.600 0.056 0.056 0.000 0.000
#> SRR925713      4  0.1625      0.823 0.012 0.000 0.000 0.928 0.060 0.000
#> SRR925714      5  0.0146      0.962 0.004 0.000 0.000 0.000 0.996 0.000
#> SRR925715      4  0.2457      0.796 0.084 0.036 0.000 0.880 0.000 0.000
#> SRR925716      5  0.0000      0.963 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR925717      6  0.6135      0.390 0.076 0.076 0.000 0.000 0.332 0.516
#> SRR925718      3  0.1152      0.844 0.004 0.044 0.952 0.000 0.000 0.000
#> SRR925719      1  0.4123      0.931 0.568 0.000 0.000 0.000 0.012 0.420
#> SRR925720      1  0.3823      0.949 0.564 0.000 0.000 0.000 0.000 0.436
#> SRR925721      1  0.3823      0.949 0.564 0.000 0.000 0.000 0.000 0.436
#> SRR934634      1  0.3823      0.949 0.564 0.000 0.000 0.000 0.000 0.436
#> SRR934635      1  0.3823      0.949 0.564 0.000 0.000 0.000 0.000 0.436
#> SRR925723      3  0.0632      0.852 0.000 0.024 0.976 0.000 0.000 0.000
#> SRR925724      3  0.1007      0.841 0.000 0.044 0.956 0.000 0.000 0.000
#> SRR925725      2  0.2805      0.599 0.000 0.828 0.160 0.012 0.000 0.000
#> SRR925726      5  0.0146      0.962 0.004 0.000 0.000 0.000 0.996 0.000
#> SRR925727      3  0.4072      0.208 0.000 0.448 0.544 0.008 0.000 0.000
#> SRR925728      4  0.1643      0.821 0.008 0.000 0.000 0.924 0.068 0.000
#> SRR934636      5  0.0363      0.960 0.012 0.000 0.000 0.000 0.988 0.000
#> SRR934637      5  0.0363      0.960 0.012 0.000 0.000 0.000 0.988 0.000
#> SRR925729      2  0.5207      0.568 0.404 0.512 0.004 0.080 0.000 0.000
#> SRR934638      1  0.5862      0.551 0.468 0.000 0.000 0.216 0.000 0.316
#> SRR934639      1  0.4080      0.917 0.536 0.000 0.000 0.008 0.000 0.456
#> SRR934640      4  0.4760      0.561 0.120 0.212 0.000 0.668 0.000 0.000
#> SRR934641      4  0.4760      0.561 0.120 0.212 0.000 0.668 0.000 0.000
#> SRR925734      1  0.3823      0.949 0.564 0.000 0.000 0.000 0.000 0.436
#> SRR925735      2  0.4848      0.509 0.124 0.728 0.052 0.096 0.000 0.000
#> SRR925736      3  0.0717      0.856 0.008 0.016 0.976 0.000 0.000 0.000
#> SRR925737      3  0.0520      0.857 0.008 0.008 0.984 0.000 0.000 0.000
#> SRR934642      3  0.1265      0.843 0.008 0.044 0.948 0.000 0.000 0.000
#> SRR934643      3  0.1265      0.843 0.008 0.044 0.948 0.000 0.000 0.000
#> SRR934644      2  0.4909      0.612 0.348 0.588 0.008 0.056 0.000 0.000
#> SRR934645      2  0.5006      0.594 0.388 0.548 0.008 0.056 0.000 0.000
#> SRR925740      3  0.0260      0.858 0.000 0.008 0.992 0.000 0.000 0.000
#> SRR925741      2  0.2699      0.614 0.008 0.864 0.108 0.020 0.000 0.000
#> SRR925742      3  0.0260      0.858 0.000 0.008 0.992 0.000 0.000 0.000
#> SRR1283038     2  0.3606      0.496 0.004 0.724 0.264 0.008 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-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 15949 rows and 64 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 4.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

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

collect_plots(res)

plot of chunk MAD-hclust-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.494           0.659       0.801         0.4978 0.516   0.516
#> 3 3 0.395           0.357       0.671         0.2251 0.572   0.416
#> 4 4 0.686           0.840       0.849         0.1714 0.675   0.409
#> 5 5 0.728           0.714       0.792         0.0761 0.965   0.866
#> 6 6 0.778           0.716       0.800         0.0376 0.963   0.842

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
#> SRR925687      1  0.3584      0.626 0.932 0.068
#> SRR925688      1  0.3584      0.626 0.932 0.068
#> SRR925689      2  0.9686      0.627 0.396 0.604
#> SRR925690      2  0.9686      0.627 0.396 0.604
#> SRR925691      2  0.9686      0.627 0.396 0.604
#> SRR925692      2  0.9686      0.627 0.396 0.604
#> SRR925693      1  0.9686      0.659 0.604 0.396
#> SRR925694      2  0.0000      0.716 0.000 1.000
#> SRR925695      1  0.9686      0.659 0.604 0.396
#> SRR925697      1  0.0000      0.675 1.000 0.000
#> SRR925696      1  0.9686      0.659 0.604 0.396
#> SRR925698      1  0.9686      0.659 0.604 0.396
#> SRR925699      2  0.0000      0.716 0.000 1.000
#> SRR925700      2  0.0000      0.716 0.000 1.000
#> SRR925701      2  0.0000      0.716 0.000 1.000
#> SRR925702      1  0.2043      0.659 0.968 0.032
#> SRR925703      1  0.0000      0.675 1.000 0.000
#> SRR925704      1  0.9686      0.659 0.604 0.396
#> SRR925705      1  0.9686      0.659 0.604 0.396
#> SRR925706      1  0.0376      0.676 0.996 0.004
#> SRR925708      1  0.2043      0.659 0.968 0.032
#> SRR925707      1  0.7219      0.523 0.800 0.200
#> SRR925709      1  0.2043      0.659 0.968 0.032
#> SRR925710      1  0.0000      0.675 1.000 0.000
#> SRR925711      1  0.9552      0.601 0.624 0.376
#> SRR934631      2  0.0000      0.716 0.000 1.000
#> SRR934632      2  0.0000      0.716 0.000 1.000
#> SRR934633      2  0.0000      0.716 0.000 1.000
#> SRR925713      1  0.0000      0.675 1.000 0.000
#> SRR925714      1  0.0000      0.675 1.000 0.000
#> SRR925715      1  0.0376      0.676 0.996 0.004
#> SRR925716      1  0.1414      0.666 0.980 0.020
#> SRR925717      1  0.0000      0.675 1.000 0.000
#> SRR925718      2  0.0000      0.716 0.000 1.000
#> SRR925719      1  0.2043      0.659 0.968 0.032
#> SRR925720      1  0.3584      0.626 0.932 0.068
#> SRR925721      1  0.3584      0.626 0.932 0.068
#> SRR934634      2  0.9686      0.627 0.396 0.604
#> SRR934635      2  0.9686      0.627 0.396 0.604
#> SRR925723      1  0.9686      0.659 0.604 0.396
#> SRR925724      1  0.9686      0.659 0.604 0.396
#> SRR925725      1  0.9686      0.659 0.604 0.396
#> SRR925726      1  0.0000      0.675 1.000 0.000
#> SRR925727      1  0.9686      0.659 0.604 0.396
#> SRR925728      1  0.6048      0.508 0.852 0.148
#> SRR934636      2  0.9686      0.627 0.396 0.604
#> SRR934637      2  0.9686      0.627 0.396 0.604
#> SRR925729      1  1.0000      0.520 0.504 0.496
#> SRR934638      2  0.9686      0.627 0.396 0.604
#> SRR934639      2  0.9686      0.627 0.396 0.604
#> SRR934640      2  0.0000      0.716 0.000 1.000
#> SRR934641      2  0.0000      0.716 0.000 1.000
#> SRR925734      2  0.9686      0.627 0.396 0.604
#> SRR925735      1  0.9686      0.659 0.604 0.396
#> SRR925736      1  0.9686      0.659 0.604 0.396
#> SRR925737      1  0.9686      0.659 0.604 0.396
#> SRR934642      2  0.0000      0.716 0.000 1.000
#> SRR934643      2  0.0000      0.716 0.000 1.000
#> SRR934644      2  0.0000      0.716 0.000 1.000
#> SRR934645      2  0.0000      0.716 0.000 1.000
#> SRR925740      1  0.9686      0.659 0.604 0.396
#> SRR925741      1  0.9686      0.659 0.604 0.396
#> SRR925742      1  0.9686      0.659 0.604 0.396
#> SRR1283038     1  0.9686      0.659 0.604 0.396

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>            class entropy silhouette    p1    p2    p3
#> SRR925687      1  0.2261      0.818 0.932 0.000 0.068
#> SRR925688      1  0.2261      0.818 0.932 0.000 0.068
#> SRR925689      2  0.9956     -0.701 0.352 0.360 0.288
#> SRR925690      2  0.9956     -0.701 0.352 0.360 0.288
#> SRR925691      2  0.9956     -0.701 0.352 0.360 0.288
#> SRR925692      2  0.9956     -0.701 0.352 0.360 0.288
#> SRR925693      2  0.9757      0.446 0.228 0.392 0.380
#> SRR925694      2  0.0000      0.240 0.000 1.000 0.000
#> SRR925695      2  0.9757      0.446 0.228 0.392 0.380
#> SRR925697      1  0.3038      0.830 0.896 0.000 0.104
#> SRR925696      2  0.9757      0.446 0.228 0.392 0.380
#> SRR925698      2  0.9757      0.446 0.228 0.392 0.380
#> SRR925699      2  0.0000      0.240 0.000 1.000 0.000
#> SRR925700      2  0.0000      0.240 0.000 1.000 0.000
#> SRR925701      2  0.0000      0.240 0.000 1.000 0.000
#> SRR925702      1  0.2537      0.833 0.920 0.000 0.080
#> SRR925703      1  0.3038      0.830 0.896 0.000 0.104
#> SRR925704      2  0.9757      0.446 0.228 0.392 0.380
#> SRR925705      2  0.9757      0.446 0.228 0.392 0.380
#> SRR925706      1  0.3941      0.787 0.844 0.000 0.156
#> SRR925708      1  0.0747      0.847 0.984 0.000 0.016
#> SRR925707      1  0.9488      0.203 0.424 0.184 0.392
#> SRR925709      1  0.0747      0.847 0.984 0.000 0.016
#> SRR925710      1  0.1031      0.853 0.976 0.000 0.024
#> SRR925711      2  0.9969      0.306 0.308 0.372 0.320
#> SRR934631      2  0.0000      0.240 0.000 1.000 0.000
#> SRR934632      2  0.0000      0.240 0.000 1.000 0.000
#> SRR934633      2  0.0000      0.240 0.000 1.000 0.000
#> SRR925713      1  0.1031      0.853 0.976 0.000 0.024
#> SRR925714      1  0.3038      0.830 0.896 0.000 0.104
#> SRR925715      1  0.3879      0.788 0.848 0.000 0.152
#> SRR925716      1  0.3267      0.827 0.884 0.000 0.116
#> SRR925717      1  0.0747      0.852 0.984 0.000 0.016
#> SRR925718      2  0.0000      0.240 0.000 1.000 0.000
#> SRR925719      1  0.0747      0.847 0.984 0.000 0.016
#> SRR925720      1  0.2261      0.818 0.932 0.000 0.068
#> SRR925721      1  0.2261      0.818 0.932 0.000 0.068
#> SRR934634      2  0.9956     -0.701 0.352 0.360 0.288
#> SRR934635      2  0.9956     -0.701 0.352 0.360 0.288
#> SRR925723      2  0.9757      0.446 0.228 0.392 0.380
#> SRR925724      2  0.9757      0.446 0.228 0.392 0.380
#> SRR925725      2  0.9757      0.446 0.228 0.392 0.380
#> SRR925726      1  0.3038      0.830 0.896 0.000 0.104
#> SRR925727      2  0.9757      0.446 0.228 0.392 0.380
#> SRR925728      1  0.8991      0.342 0.476 0.132 0.392
#> SRR934636      3  0.8925      1.000 0.132 0.364 0.504
#> SRR934637      3  0.8925      1.000 0.132 0.364 0.504
#> SRR925729      2  0.8909      0.456 0.128 0.496 0.376
#> SRR934638      2  0.9956     -0.701 0.352 0.360 0.288
#> SRR934639      2  0.9956     -0.701 0.352 0.360 0.288
#> SRR934640      2  0.0000      0.240 0.000 1.000 0.000
#> SRR934641      2  0.0000      0.240 0.000 1.000 0.000
#> SRR925734      2  0.9956     -0.701 0.352 0.360 0.288
#> SRR925735      2  0.9757      0.446 0.228 0.392 0.380
#> SRR925736      2  0.9757      0.446 0.228 0.392 0.380
#> SRR925737      2  0.9757      0.446 0.228 0.392 0.380
#> SRR934642      2  0.0000      0.240 0.000 1.000 0.000
#> SRR934643      2  0.0000      0.240 0.000 1.000 0.000
#> SRR934644      2  0.0000      0.240 0.000 1.000 0.000
#> SRR934645      2  0.0000      0.240 0.000 1.000 0.000
#> SRR925740      2  0.9757      0.446 0.228 0.392 0.380
#> SRR925741      2  0.9757      0.446 0.228 0.392 0.380
#> SRR925742      2  0.9757      0.446 0.228 0.392 0.380
#> SRR1283038     2  0.9757      0.446 0.228 0.392 0.380

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> SRR925687      4  0.2255      0.769 0.068 0.000 0.012 0.920
#> SRR925688      4  0.2255      0.769 0.068 0.000 0.012 0.920
#> SRR925689      1  0.4624      0.904 0.660 0.000 0.000 0.340
#> SRR925690      1  0.4624      0.904 0.660 0.000 0.000 0.340
#> SRR925691      1  0.4624      0.904 0.660 0.000 0.000 0.340
#> SRR925692      1  0.4624      0.904 0.660 0.000 0.000 0.340
#> SRR925693      3  0.3610      0.906 0.000 0.200 0.800 0.000
#> SRR925694      2  0.0000      1.000 0.000 1.000 0.000 0.000
#> SRR925695      3  0.3610      0.906 0.000 0.200 0.800 0.000
#> SRR925697      4  0.3933      0.747 0.200 0.000 0.008 0.792
#> SRR925696      3  0.3610      0.906 0.000 0.200 0.800 0.000
#> SRR925698      3  0.3610      0.906 0.000 0.200 0.800 0.000
#> SRR925699      2  0.0000      1.000 0.000 1.000 0.000 0.000
#> SRR925700      2  0.0000      1.000 0.000 1.000 0.000 0.000
#> SRR925701      2  0.0000      1.000 0.000 1.000 0.000 0.000
#> SRR925702      4  0.3542      0.778 0.028 0.000 0.120 0.852
#> SRR925703      4  0.3933      0.747 0.200 0.000 0.008 0.792
#> SRR925704      3  0.3610      0.906 0.000 0.200 0.800 0.000
#> SRR925705      3  0.3610      0.906 0.000 0.200 0.800 0.000
#> SRR925706      4  0.5050      0.520 0.004 0.000 0.408 0.588
#> SRR925708      4  0.0921      0.798 0.028 0.000 0.000 0.972
#> SRR925707      3  0.7400      0.289 0.072 0.128 0.644 0.156
#> SRR925709      4  0.0921      0.798 0.028 0.000 0.000 0.972
#> SRR925710      4  0.0921      0.807 0.000 0.000 0.028 0.972
#> SRR925711      3  0.6640      0.617 0.000 0.352 0.552 0.096
#> SRR934631      2  0.0000      1.000 0.000 1.000 0.000 0.000
#> SRR934632      2  0.0000      1.000 0.000 1.000 0.000 0.000
#> SRR934633      2  0.0000      1.000 0.000 1.000 0.000 0.000
#> SRR925713      4  0.0921      0.807 0.000 0.000 0.028 0.972
#> SRR925714      4  0.3933      0.747 0.200 0.000 0.008 0.792
#> SRR925715      4  0.4843      0.541 0.000 0.000 0.396 0.604
#> SRR925716      4  0.3945      0.744 0.216 0.000 0.004 0.780
#> SRR925717      4  0.0188      0.806 0.000 0.000 0.004 0.996
#> SRR925718      2  0.0000      1.000 0.000 1.000 0.000 0.000
#> SRR925719      4  0.0921      0.798 0.028 0.000 0.000 0.972
#> SRR925720      4  0.2255      0.769 0.068 0.000 0.012 0.920
#> SRR925721      4  0.2255      0.769 0.068 0.000 0.012 0.920
#> SRR934634      1  0.4624      0.904 0.660 0.000 0.000 0.340
#> SRR934635      1  0.4624      0.904 0.660 0.000 0.000 0.340
#> SRR925723      3  0.3610      0.906 0.000 0.200 0.800 0.000
#> SRR925724      3  0.3610      0.906 0.000 0.200 0.800 0.000
#> SRR925725      3  0.3610      0.906 0.000 0.200 0.800 0.000
#> SRR925726      4  0.3768      0.755 0.184 0.000 0.008 0.808
#> SRR925727      3  0.3610      0.906 0.000 0.200 0.800 0.000
#> SRR925728      3  0.7180      0.217 0.072 0.076 0.644 0.208
#> SRR934636      1  0.0188      0.605 0.996 0.000 0.004 0.000
#> SRR934637      1  0.0188      0.605 0.996 0.000 0.004 0.000
#> SRR925729      3  0.5000      0.408 0.000 0.496 0.504 0.000
#> SRR934638      1  0.4624      0.904 0.660 0.000 0.000 0.340
#> SRR934639      1  0.4624      0.904 0.660 0.000 0.000 0.340
#> SRR934640      2  0.0000      1.000 0.000 1.000 0.000 0.000
#> SRR934641      2  0.0000      1.000 0.000 1.000 0.000 0.000
#> SRR925734      1  0.4624      0.904 0.660 0.000 0.000 0.340
#> SRR925735      3  0.3933      0.899 0.000 0.200 0.792 0.008
#> SRR925736      3  0.3610      0.906 0.000 0.200 0.800 0.000
#> SRR925737      3  0.3610      0.906 0.000 0.200 0.800 0.000
#> SRR934642      2  0.0000      1.000 0.000 1.000 0.000 0.000
#> SRR934643      2  0.0000      1.000 0.000 1.000 0.000 0.000
#> SRR934644      2  0.0000      1.000 0.000 1.000 0.000 0.000
#> SRR934645      2  0.0000      1.000 0.000 1.000 0.000 0.000
#> SRR925740      3  0.3610      0.906 0.000 0.200 0.800 0.000
#> SRR925741      3  0.3610      0.906 0.000 0.200 0.800 0.000
#> SRR925742      3  0.3610      0.906 0.000 0.200 0.800 0.000
#> SRR1283038     3  0.3610      0.906 0.000 0.200 0.800 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
#> SRR925687      4  0.5295     0.6784 0.408 0.000 0.000 0.540 0.052
#> SRR925688      4  0.5295     0.6784 0.408 0.000 0.000 0.540 0.052
#> SRR925689      1  0.0000     0.8538 1.000 0.000 0.000 0.000 0.000
#> SRR925690      1  0.0000     0.8538 1.000 0.000 0.000 0.000 0.000
#> SRR925691      1  0.0000     0.8538 1.000 0.000 0.000 0.000 0.000
#> SRR925692      1  0.0000     0.8538 1.000 0.000 0.000 0.000 0.000
#> SRR925693      3  0.0000     0.7159 0.000 0.000 1.000 0.000 0.000
#> SRR925694      2  0.0000     0.9309 0.000 1.000 0.000 0.000 0.000
#> SRR925695      3  0.0290     0.7220 0.000 0.008 0.992 0.000 0.000
#> SRR925697      4  0.0000     0.5625 0.000 0.000 0.000 1.000 0.000
#> SRR925696      3  0.5148     0.7180 0.000 0.120 0.688 0.000 0.192
#> SRR925698      3  0.2230     0.7352 0.000 0.116 0.884 0.000 0.000
#> SRR925699      2  0.0609     0.9303 0.000 0.980 0.020 0.000 0.000
#> SRR925700      2  0.0609     0.9303 0.000 0.980 0.020 0.000 0.000
#> SRR925701      2  0.0609     0.9303 0.000 0.980 0.020 0.000 0.000
#> SRR925702      4  0.5866     0.6620 0.248 0.000 0.000 0.596 0.156
#> SRR925703      4  0.0000     0.5625 0.000 0.000 0.000 1.000 0.000
#> SRR925704      3  0.0290     0.7220 0.000 0.008 0.992 0.000 0.000
#> SRR925705      3  0.5408     0.6985 0.000 0.120 0.652 0.000 0.228
#> SRR925706      4  0.7375     0.1885 0.136 0.000 0.068 0.412 0.384
#> SRR925708      4  0.4946     0.7110 0.368 0.000 0.000 0.596 0.036
#> SRR925707      5  0.6235     0.9031 0.180 0.088 0.080 0.000 0.652
#> SRR925709      4  0.4946     0.7110 0.368 0.000 0.000 0.596 0.036
#> SRR925710      4  0.5530     0.7119 0.328 0.000 0.016 0.604 0.052
#> SRR925711      3  0.8120     0.0762 0.096 0.292 0.332 0.000 0.280
#> SRR934631      2  0.0000     0.9309 0.000 1.000 0.000 0.000 0.000
#> SRR934632      2  0.0000     0.9309 0.000 1.000 0.000 0.000 0.000
#> SRR934633      2  0.0000     0.9309 0.000 1.000 0.000 0.000 0.000
#> SRR925713      4  0.5530     0.7119 0.328 0.000 0.016 0.604 0.052
#> SRR925714      4  0.0000     0.5625 0.000 0.000 0.000 1.000 0.000
#> SRR925715      4  0.7364     0.2335 0.136 0.000 0.068 0.428 0.368
#> SRR925716      4  0.0609     0.5624 0.020 0.000 0.000 0.980 0.000
#> SRR925717      4  0.3266     0.6641 0.200 0.000 0.000 0.796 0.004
#> SRR925718      2  0.0880     0.9205 0.000 0.968 0.032 0.000 0.000
#> SRR925719      4  0.4946     0.7110 0.368 0.000 0.000 0.596 0.036
#> SRR925720      4  0.5295     0.6784 0.408 0.000 0.000 0.540 0.052
#> SRR925721      4  0.5295     0.6784 0.408 0.000 0.000 0.540 0.052
#> SRR934634      1  0.0000     0.8538 1.000 0.000 0.000 0.000 0.000
#> SRR934635      1  0.0000     0.8538 1.000 0.000 0.000 0.000 0.000
#> SRR925723      3  0.3488     0.7171 0.000 0.168 0.808 0.000 0.024
#> SRR925724      3  0.2230     0.7352 0.000 0.116 0.884 0.000 0.000
#> SRR925725      3  0.0000     0.7159 0.000 0.000 1.000 0.000 0.000
#> SRR925726      4  0.0510     0.5733 0.016 0.000 0.000 0.984 0.000
#> SRR925727      3  0.0162     0.7191 0.000 0.004 0.996 0.000 0.000
#> SRR925728      5  0.6184     0.9015 0.180 0.036 0.080 0.028 0.676
#> SRR934636      1  0.6464     0.2704 0.476 0.000 0.000 0.200 0.324
#> SRR934637      1  0.6464     0.2704 0.476 0.000 0.000 0.200 0.324
#> SRR925729      2  0.6463    -0.1347 0.000 0.496 0.276 0.000 0.228
#> SRR934638      1  0.0703     0.8379 0.976 0.000 0.000 0.000 0.024
#> SRR934639      1  0.0703     0.8379 0.976 0.000 0.000 0.000 0.024
#> SRR934640      2  0.1197     0.8972 0.000 0.952 0.048 0.000 0.000
#> SRR934641      2  0.1197     0.8972 0.000 0.952 0.048 0.000 0.000
#> SRR925734      1  0.0000     0.8538 1.000 0.000 0.000 0.000 0.000
#> SRR925735      3  0.3612     0.6770 0.000 0.000 0.764 0.008 0.228
#> SRR925736      3  0.5941     0.6613 0.000 0.180 0.592 0.000 0.228
#> SRR925737      3  0.5941     0.6613 0.000 0.180 0.592 0.000 0.228
#> SRR934642      2  0.0609     0.9303 0.000 0.980 0.020 0.000 0.000
#> SRR934643      2  0.0609     0.9303 0.000 0.980 0.020 0.000 0.000
#> SRR934644      2  0.0000     0.9309 0.000 1.000 0.000 0.000 0.000
#> SRR934645      2  0.0000     0.9309 0.000 1.000 0.000 0.000 0.000
#> SRR925740      3  0.5848     0.6727 0.000 0.168 0.604 0.000 0.228
#> SRR925741      3  0.0290     0.7220 0.000 0.008 0.992 0.000 0.000
#> SRR925742      3  0.5848     0.6727 0.000 0.168 0.604 0.000 0.228
#> SRR1283038     3  0.3912     0.6921 0.000 0.020 0.752 0.000 0.228

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>            class entropy silhouette    p1    p2    p3    p4    p5    p6
#> SRR925687      4  0.5436     0.6406 0.404 0.000 0.000 0.476 0.000 0.120
#> SRR925688      4  0.5436     0.6406 0.404 0.000 0.000 0.476 0.000 0.120
#> SRR925689      1  0.0000     0.9920 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR925690      1  0.0000     0.9920 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR925691      1  0.0000     0.9920 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR925692      1  0.0000     0.9920 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR925693      3  0.0547     0.7550 0.000 0.000 0.980 0.000 0.020 0.000
#> SRR925694      2  0.0146     0.8924 0.000 0.996 0.000 0.000 0.000 0.004
#> SRR925695      3  0.0146     0.7607 0.000 0.004 0.996 0.000 0.000 0.000
#> SRR925697      4  0.1082     0.4522 0.000 0.000 0.000 0.956 0.040 0.004
#> SRR925696      3  0.5114     0.7386 0.000 0.016 0.664 0.000 0.124 0.196
#> SRR925698      3  0.2446     0.7611 0.000 0.012 0.864 0.000 0.124 0.000
#> SRR925699      2  0.1913     0.8828 0.000 0.908 0.012 0.000 0.080 0.000
#> SRR925700      2  0.1913     0.8828 0.000 0.908 0.012 0.000 0.080 0.000
#> SRR925701      2  0.1913     0.8828 0.000 0.908 0.012 0.000 0.080 0.000
#> SRR925702      4  0.5587     0.6307 0.240 0.000 0.000 0.548 0.000 0.212
#> SRR925703      4  0.1082     0.4522 0.000 0.000 0.000 0.956 0.040 0.004
#> SRR925704      3  0.0146     0.7607 0.000 0.004 0.996 0.000 0.000 0.000
#> SRR925705      3  0.5380     0.7148 0.000 0.016 0.620 0.000 0.124 0.240
#> SRR925706      6  0.3592     0.1635 0.000 0.000 0.000 0.344 0.000 0.656
#> SRR925708      4  0.5108     0.6891 0.356 0.000 0.000 0.552 0.000 0.092
#> SRR925707      6  0.2134     0.3378 0.044 0.052 0.000 0.000 0.000 0.904
#> SRR925709      4  0.5108     0.6891 0.356 0.000 0.000 0.552 0.000 0.092
#> SRR925710      4  0.5378     0.6965 0.304 0.000 0.000 0.556 0.000 0.140
#> SRR925711      6  0.6902    -0.2857 0.000 0.184 0.300 0.000 0.080 0.436
#> SRR934631      2  0.0000     0.8937 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR934632      2  0.0000     0.8937 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR934633      2  0.0000     0.8937 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR925713      4  0.5378     0.6965 0.304 0.000 0.000 0.556 0.000 0.140
#> SRR925714      4  0.1082     0.4522 0.000 0.000 0.000 0.956 0.040 0.004
#> SRR925715      6  0.3659     0.1214 0.000 0.000 0.000 0.364 0.000 0.636
#> SRR925716      4  0.1624     0.4552 0.020 0.000 0.000 0.936 0.040 0.004
#> SRR925717      4  0.3635     0.6205 0.180 0.000 0.000 0.780 0.008 0.032
#> SRR925718      2  0.2768     0.8161 0.000 0.832 0.012 0.000 0.156 0.000
#> SRR925719      4  0.5108     0.6891 0.356 0.000 0.000 0.552 0.000 0.092
#> SRR925720      4  0.5436     0.6406 0.404 0.000 0.000 0.476 0.000 0.120
#> SRR925721      4  0.5436     0.6406 0.404 0.000 0.000 0.476 0.000 0.120
#> SRR934634      1  0.0146     0.9898 0.996 0.000 0.000 0.004 0.000 0.000
#> SRR934635      1  0.0146     0.9898 0.996 0.000 0.000 0.004 0.000 0.000
#> SRR925723      3  0.3856     0.7480 0.000 0.032 0.784 0.000 0.156 0.028
#> SRR925724      3  0.2446     0.7611 0.000 0.012 0.864 0.000 0.124 0.000
#> SRR925725      3  0.0547     0.7550 0.000 0.000 0.980 0.000 0.020 0.000
#> SRR925726      4  0.0937     0.4610 0.000 0.000 0.000 0.960 0.040 0.000
#> SRR925727      3  0.0405     0.7565 0.000 0.004 0.988 0.000 0.008 0.000
#> SRR925728      6  0.1007     0.3626 0.044 0.000 0.000 0.000 0.000 0.956
#> SRR934636      5  0.3269     1.0000 0.024 0.000 0.000 0.184 0.792 0.000
#> SRR934637      5  0.3269     1.0000 0.024 0.000 0.000 0.184 0.792 0.000
#> SRR925729      2  0.5831    -0.0429 0.000 0.492 0.264 0.000 0.000 0.244
#> SRR934638      1  0.0632     0.9765 0.976 0.000 0.000 0.000 0.000 0.024
#> SRR934639      1  0.0632     0.9765 0.976 0.000 0.000 0.000 0.000 0.024
#> SRR934640      2  0.1225     0.8770 0.000 0.952 0.036 0.000 0.012 0.000
#> SRR934641      2  0.1225     0.8770 0.000 0.952 0.036 0.000 0.012 0.000
#> SRR925734      1  0.0000     0.9920 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR925735      3  0.3838     0.7145 0.000 0.000 0.732 0.008 0.020 0.240
#> SRR925736      3  0.6183     0.6440 0.000 0.108 0.568 0.000 0.080 0.244
#> SRR925737      3  0.6183     0.6440 0.000 0.108 0.568 0.000 0.080 0.244
#> SRR934642      2  0.1913     0.8828 0.000 0.908 0.012 0.000 0.080 0.000
#> SRR934643      2  0.1913     0.8828 0.000 0.908 0.012 0.000 0.080 0.000
#> SRR934644      2  0.0000     0.8937 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR934645      2  0.0000     0.8937 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR925740      3  0.5927     0.6880 0.000 0.032 0.572 0.000 0.156 0.240
#> SRR925741      3  0.0146     0.7607 0.000 0.004 0.996 0.000 0.000 0.000
#> SRR925742      3  0.5927     0.6880 0.000 0.032 0.572 0.000 0.156 0.240
#> SRR1283038     3  0.3667     0.7281 0.000 0.008 0.740 0.000 0.012 0.240

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 15949 rows and 64 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 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-kmeans-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.467           0.647       0.789         0.4936 0.494   0.494
#> 3 3 0.584           0.830       0.861         0.3000 0.840   0.680
#> 4 4 0.709           0.853       0.836         0.1274 0.899   0.714
#> 5 5 0.736           0.769       0.797         0.0687 0.984   0.938
#> 6 6 0.758           0.662       0.749         0.0505 0.899   0.621

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
#> SRR925687      1  0.0672      0.753 0.992 0.008
#> SRR925688      1  0.0672      0.753 0.992 0.008
#> SRR925689      1  0.9963      0.487 0.536 0.464
#> SRR925690      1  0.9963      0.487 0.536 0.464
#> SRR925691      1  0.9963      0.487 0.536 0.464
#> SRR925692      1  0.9963      0.487 0.536 0.464
#> SRR925693      2  0.9970      0.650 0.468 0.532
#> SRR925694      2  0.0000      0.600 0.000 1.000
#> SRR925695      2  0.9970      0.650 0.468 0.532
#> SRR925697      1  0.0000      0.749 1.000 0.000
#> SRR925696      2  0.9944      0.657 0.456 0.544
#> SRR925698      2  0.9970      0.650 0.468 0.532
#> SRR925699      2  0.0000      0.600 0.000 1.000
#> SRR925700      2  0.0000      0.600 0.000 1.000
#> SRR925701      2  0.0000      0.600 0.000 1.000
#> SRR925702      1  0.0672      0.753 0.992 0.008
#> SRR925703      1  0.0000      0.749 1.000 0.000
#> SRR925704      2  0.9963      0.653 0.464 0.536
#> SRR925705      2  0.9944      0.657 0.456 0.544
#> SRR925706      1  0.0000      0.749 1.000 0.000
#> SRR925708      1  0.0672      0.753 0.992 0.008
#> SRR925707      2  0.0376      0.599 0.004 0.996
#> SRR925709      1  0.0672      0.753 0.992 0.008
#> SRR925710      1  0.0000      0.749 1.000 0.000
#> SRR925711      2  0.9944      0.657 0.456 0.544
#> SRR934631      2  0.0000      0.600 0.000 1.000
#> SRR934632      2  0.0000      0.600 0.000 1.000
#> SRR934633      2  0.8608      0.629 0.284 0.716
#> SRR925713      1  0.0000      0.749 1.000 0.000
#> SRR925714      1  0.0000      0.749 1.000 0.000
#> SRR925715      1  0.0000      0.749 1.000 0.000
#> SRR925716      1  0.0672      0.753 0.992 0.008
#> SRR925717      1  0.0000      0.749 1.000 0.000
#> SRR925718      2  0.0000      0.600 0.000 1.000
#> SRR925719      1  0.0672      0.753 0.992 0.008
#> SRR925720      1  0.0672      0.753 0.992 0.008
#> SRR925721      1  0.0672      0.753 0.992 0.008
#> SRR934634      1  0.9963      0.487 0.536 0.464
#> SRR934635      1  0.9944      0.491 0.544 0.456
#> SRR925723      2  0.9963      0.653 0.464 0.536
#> SRR925724      2  0.9970      0.650 0.468 0.532
#> SRR925725      2  0.9970      0.650 0.468 0.532
#> SRR925726      1  0.0000      0.749 1.000 0.000
#> SRR925727      2  0.9970      0.650 0.468 0.532
#> SRR925728      1  0.2043      0.740 0.968 0.032
#> SRR934636      1  0.9970      0.482 0.532 0.468
#> SRR934637      1  0.9209      0.554 0.664 0.336
#> SRR925729      2  0.9963      0.653 0.464 0.536
#> SRR934638      1  0.9963      0.487 0.536 0.464
#> SRR934639      1  0.0672      0.753 0.992 0.008
#> SRR934640      2  0.0000      0.600 0.000 1.000
#> SRR934641      2  0.0000      0.600 0.000 1.000
#> SRR925734      1  0.9963      0.487 0.536 0.464
#> SRR925735      2  0.9970      0.650 0.468 0.532
#> SRR925736      2  0.9944      0.657 0.456 0.544
#> SRR925737      2  0.9944      0.657 0.456 0.544
#> SRR934642      2  0.0000      0.600 0.000 1.000
#> SRR934643      2  0.0000      0.600 0.000 1.000
#> SRR934644      2  0.0000      0.600 0.000 1.000
#> SRR934645      2  0.0000      0.600 0.000 1.000
#> SRR925740      2  0.9881      0.658 0.436 0.564
#> SRR925741      2  0.9970      0.650 0.468 0.532
#> SRR925742      2  0.9881      0.658 0.436 0.564
#> SRR1283038     2  0.9922      0.658 0.448 0.552

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>            class entropy silhouette    p1    p2    p3
#> SRR925687      1  0.0237      0.840 0.996 0.004 0.000
#> SRR925688      1  0.0237      0.840 0.996 0.004 0.000
#> SRR925689      1  0.5650      0.654 0.688 0.312 0.000
#> SRR925690      1  0.5621      0.659 0.692 0.308 0.000
#> SRR925691      1  0.5621      0.659 0.692 0.308 0.000
#> SRR925692      1  0.5621      0.659 0.692 0.308 0.000
#> SRR925693      3  0.1525      0.922 0.032 0.004 0.964
#> SRR925694      2  0.4931      0.905 0.000 0.768 0.232
#> SRR925695      3  0.0237      0.964 0.004 0.000 0.996
#> SRR925697      1  0.6448      0.760 0.764 0.132 0.104
#> SRR925696      3  0.0747      0.967 0.000 0.016 0.984
#> SRR925698      3  0.0237      0.967 0.000 0.004 0.996
#> SRR925699      2  0.4887      0.905 0.000 0.772 0.228
#> SRR925700      2  0.4887      0.905 0.000 0.772 0.228
#> SRR925701      2  0.4887      0.905 0.000 0.772 0.228
#> SRR925702      1  0.0237      0.839 0.996 0.004 0.000
#> SRR925703      1  0.6519      0.757 0.760 0.132 0.108
#> SRR925704      3  0.0237      0.967 0.000 0.004 0.996
#> SRR925705      3  0.0747      0.967 0.000 0.016 0.984
#> SRR925706      1  0.3695      0.806 0.880 0.012 0.108
#> SRR925708      1  0.0000      0.839 1.000 0.000 0.000
#> SRR925707      2  0.9558      0.507 0.200 0.444 0.356
#> SRR925709      1  0.0000      0.839 1.000 0.000 0.000
#> SRR925710      1  0.3532      0.806 0.884 0.008 0.108
#> SRR925711      3  0.0592      0.966 0.000 0.012 0.988
#> SRR934631      2  0.4931      0.905 0.000 0.768 0.232
#> SRR934632      2  0.4931      0.905 0.000 0.768 0.232
#> SRR934633      3  0.4605      0.670 0.000 0.204 0.796
#> SRR925713      1  0.3532      0.806 0.884 0.008 0.108
#> SRR925714      1  0.6519      0.757 0.760 0.132 0.108
#> SRR925715      1  0.3532      0.806 0.884 0.008 0.108
#> SRR925716      1  0.3551      0.802 0.868 0.132 0.000
#> SRR925717      1  0.3532      0.806 0.884 0.008 0.108
#> SRR925718      2  0.4887      0.905 0.000 0.772 0.228
#> SRR925719      1  0.0000      0.839 1.000 0.000 0.000
#> SRR925720      1  0.0237      0.840 0.996 0.004 0.000
#> SRR925721      1  0.0592      0.839 0.988 0.012 0.000
#> SRR934634      1  0.5650      0.659 0.688 0.312 0.000
#> SRR934635      1  0.5058      0.722 0.756 0.244 0.000
#> SRR925723      3  0.0424      0.967 0.000 0.008 0.992
#> SRR925724      3  0.0237      0.967 0.000 0.004 0.996
#> SRR925725      3  0.0237      0.964 0.004 0.000 0.996
#> SRR925726      1  0.6448      0.760 0.764 0.132 0.104
#> SRR925727      3  0.0237      0.964 0.004 0.000 0.996
#> SRR925728      1  0.0892      0.838 0.980 0.020 0.000
#> SRR934636      2  0.6267     -0.409 0.452 0.548 0.000
#> SRR934637      1  0.4887      0.779 0.772 0.228 0.000
#> SRR925729      3  0.2796      0.868 0.000 0.092 0.908
#> SRR934638      1  0.5650      0.654 0.688 0.312 0.000
#> SRR934639      1  0.0424      0.839 0.992 0.008 0.000
#> SRR934640      2  0.5058      0.896 0.000 0.756 0.244
#> SRR934641      2  0.5058      0.896 0.000 0.756 0.244
#> SRR925734      1  0.5621      0.659 0.692 0.308 0.000
#> SRR925735      3  0.0237      0.964 0.004 0.000 0.996
#> SRR925736      3  0.0747      0.967 0.000 0.016 0.984
#> SRR925737      3  0.0747      0.967 0.000 0.016 0.984
#> SRR934642      2  0.4887      0.905 0.000 0.772 0.228
#> SRR934643      2  0.4887      0.905 0.000 0.772 0.228
#> SRR934644      2  0.4931      0.905 0.000 0.768 0.232
#> SRR934645      2  0.4931      0.905 0.000 0.768 0.232
#> SRR925740      3  0.0747      0.967 0.000 0.016 0.984
#> SRR925741      3  0.0000      0.966 0.000 0.000 1.000
#> SRR925742      3  0.0747      0.967 0.000 0.016 0.984
#> SRR1283038     3  0.0592      0.966 0.000 0.012 0.988

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> SRR925687      4  0.2334      0.817 0.088 0.004 0.000 0.908
#> SRR925688      4  0.2334      0.817 0.088 0.004 0.000 0.908
#> SRR925689      1  0.6412      0.915 0.592 0.088 0.000 0.320
#> SRR925690      1  0.6412      0.915 0.592 0.088 0.000 0.320
#> SRR925691      1  0.6412      0.915 0.592 0.088 0.000 0.320
#> SRR925692      1  0.6412      0.915 0.592 0.088 0.000 0.320
#> SRR925693      3  0.3134      0.916 0.100 0.012 0.880 0.008
#> SRR925694      2  0.2610      0.927 0.012 0.900 0.088 0.000
#> SRR925695      3  0.2546      0.924 0.092 0.008 0.900 0.000
#> SRR925697      4  0.4937      0.736 0.144 0.064 0.008 0.784
#> SRR925696      3  0.0524      0.941 0.004 0.008 0.988 0.000
#> SRR925698      3  0.0336      0.941 0.000 0.008 0.992 0.000
#> SRR925699      2  0.2987      0.930 0.016 0.880 0.104 0.000
#> SRR925700      2  0.2987      0.930 0.016 0.880 0.104 0.000
#> SRR925701      2  0.2987      0.930 0.016 0.880 0.104 0.000
#> SRR925702      4  0.1576      0.822 0.048 0.004 0.000 0.948
#> SRR925703      4  0.5179      0.733 0.144 0.064 0.016 0.776
#> SRR925704      3  0.2546      0.924 0.092 0.008 0.900 0.000
#> SRR925705      3  0.0524      0.941 0.004 0.008 0.988 0.000
#> SRR925706      4  0.2781      0.797 0.072 0.008 0.016 0.904
#> SRR925708      4  0.1940      0.815 0.076 0.000 0.000 0.924
#> SRR925707      2  0.9288      0.111 0.320 0.388 0.176 0.116
#> SRR925709      4  0.1902      0.820 0.064 0.004 0.000 0.932
#> SRR925710      4  0.2328      0.806 0.056 0.004 0.016 0.924
#> SRR925711      3  0.2060      0.929 0.052 0.016 0.932 0.000
#> SRR934631      2  0.3333      0.913 0.040 0.872 0.088 0.000
#> SRR934632      2  0.3333      0.913 0.040 0.872 0.088 0.000
#> SRR934633      3  0.4638      0.789 0.060 0.152 0.788 0.000
#> SRR925713      4  0.1796      0.820 0.032 0.004 0.016 0.948
#> SRR925714      4  0.5179      0.733 0.144 0.064 0.016 0.776
#> SRR925715      4  0.3036      0.783 0.080 0.008 0.020 0.892
#> SRR925716      4  0.4849      0.736 0.164 0.064 0.000 0.772
#> SRR925717      4  0.1369      0.830 0.016 0.004 0.016 0.964
#> SRR925718      2  0.3224      0.923 0.016 0.864 0.120 0.000
#> SRR925719      4  0.1940      0.815 0.076 0.000 0.000 0.924
#> SRR925720      4  0.1978      0.823 0.068 0.004 0.000 0.928
#> SRR925721      4  0.2401      0.815 0.092 0.004 0.000 0.904
#> SRR934634      1  0.6319      0.902 0.604 0.084 0.000 0.312
#> SRR934635      1  0.6153      0.886 0.604 0.068 0.000 0.328
#> SRR925723      3  0.0336      0.941 0.000 0.008 0.992 0.000
#> SRR925724      3  0.0336      0.941 0.000 0.008 0.992 0.000
#> SRR925725      3  0.2611      0.923 0.096 0.008 0.896 0.000
#> SRR925726      4  0.4937      0.736 0.144 0.064 0.008 0.784
#> SRR925727      3  0.2546      0.924 0.092 0.008 0.900 0.000
#> SRR925728      4  0.4673      0.395 0.292 0.008 0.000 0.700
#> SRR934636      1  0.6295      0.718 0.660 0.144 0.000 0.196
#> SRR934637      1  0.5663      0.631 0.676 0.060 0.000 0.264
#> SRR925729      3  0.3962      0.847 0.044 0.124 0.832 0.000
#> SRR934638      1  0.6356      0.914 0.596 0.084 0.000 0.320
#> SRR934639      4  0.2081      0.810 0.084 0.000 0.000 0.916
#> SRR934640      2  0.3858      0.904 0.056 0.844 0.100 0.000
#> SRR934641      2  0.3858      0.904 0.056 0.844 0.100 0.000
#> SRR925734      1  0.6356      0.914 0.596 0.084 0.000 0.320
#> SRR925735      3  0.2727      0.924 0.084 0.012 0.900 0.004
#> SRR925736      3  0.1284      0.936 0.024 0.012 0.964 0.000
#> SRR925737      3  0.1284      0.936 0.024 0.012 0.964 0.000
#> SRR934642      2  0.3160      0.929 0.020 0.872 0.108 0.000
#> SRR934643      2  0.3160      0.929 0.020 0.872 0.108 0.000
#> SRR934644      2  0.2730      0.926 0.016 0.896 0.088 0.000
#> SRR934645      2  0.2730      0.926 0.016 0.896 0.088 0.000
#> SRR925740      3  0.0804      0.940 0.012 0.008 0.980 0.000
#> SRR925741      3  0.2546      0.924 0.092 0.008 0.900 0.000
#> SRR925742      3  0.0804      0.940 0.012 0.008 0.980 0.000
#> SRR1283038     3  0.0336      0.941 0.000 0.008 0.992 0.000

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>            class entropy silhouette    p1    p2    p3    p4 p5
#> SRR925687      4  0.4577     0.6225 0.244 0.012 0.000 0.716 NA
#> SRR925688      4  0.4577     0.6225 0.244 0.012 0.000 0.716 NA
#> SRR925689      1  0.3294     0.8593 0.844 0.024 0.000 0.124 NA
#> SRR925690      1  0.3294     0.8593 0.844 0.024 0.000 0.124 NA
#> SRR925691      1  0.3294     0.8593 0.844 0.024 0.000 0.124 NA
#> SRR925692      1  0.3294     0.8593 0.844 0.024 0.000 0.124 NA
#> SRR925693      3  0.4064     0.8142 0.000 0.004 0.716 0.008 NA
#> SRR925694      2  0.2087     0.9375 0.020 0.928 0.032 0.000 NA
#> SRR925695      3  0.3910     0.8154 0.000 0.000 0.720 0.008 NA
#> SRR925697      4  0.5080     0.5491 0.048 0.000 0.000 0.604 NA
#> SRR925696      3  0.1173     0.8779 0.004 0.012 0.964 0.000 NA
#> SRR925698      3  0.0865     0.8801 0.000 0.004 0.972 0.000 NA
#> SRR925699      2  0.1934     0.9420 0.016 0.928 0.052 0.000 NA
#> SRR925700      2  0.2005     0.9416 0.016 0.924 0.056 0.000 NA
#> SRR925701      2  0.2005     0.9416 0.016 0.924 0.056 0.000 NA
#> SRR925702      4  0.2362     0.6873 0.076 0.000 0.000 0.900 NA
#> SRR925703      4  0.5230     0.5482 0.048 0.000 0.004 0.600 NA
#> SRR925704      3  0.3790     0.8176 0.000 0.004 0.724 0.000 NA
#> SRR925705      3  0.0854     0.8758 0.004 0.012 0.976 0.000 NA
#> SRR925706      4  0.2782     0.6654 0.016 0.004 0.004 0.880 NA
#> SRR925708      4  0.3439     0.6669 0.188 0.008 0.000 0.800 NA
#> SRR925707      4  0.9630     0.0325 0.108 0.144 0.248 0.296 NA
#> SRR925709      4  0.2951     0.6771 0.112 0.000 0.000 0.860 NA
#> SRR925710      4  0.1404     0.6947 0.008 0.004 0.004 0.956 NA
#> SRR925711      3  0.2850     0.8533 0.016 0.016 0.880 0.000 NA
#> SRR934631      2  0.3097     0.9188 0.024 0.876 0.032 0.000 NA
#> SRR934632      2  0.3097     0.9188 0.024 0.876 0.032 0.000 NA
#> SRR934633      3  0.5391     0.7078 0.024 0.160 0.708 0.000 NA
#> SRR925713      4  0.0932     0.6939 0.000 0.004 0.004 0.972 NA
#> SRR925714      4  0.5230     0.5482 0.048 0.000 0.004 0.600 NA
#> SRR925715      4  0.2943     0.6652 0.016 0.004 0.004 0.868 NA
#> SRR925716      4  0.5658     0.4867 0.080 0.000 0.000 0.512 NA
#> SRR925717      4  0.2649     0.6853 0.020 0.004 0.004 0.892 NA
#> SRR925718      2  0.2577     0.9301 0.016 0.892 0.084 0.000 NA
#> SRR925719      4  0.3670     0.6659 0.188 0.008 0.000 0.792 NA
#> SRR925720      4  0.4345     0.6422 0.212 0.012 0.000 0.748 NA
#> SRR925721      4  0.4603     0.6189 0.248 0.012 0.000 0.712 NA
#> SRR934634      1  0.3985     0.8431 0.812 0.024 0.000 0.128 NA
#> SRR934635      1  0.3985     0.8431 0.812 0.024 0.000 0.128 NA
#> SRR925723      3  0.0566     0.8799 0.000 0.004 0.984 0.000 NA
#> SRR925724      3  0.0865     0.8801 0.000 0.004 0.972 0.000 NA
#> SRR925725      3  0.4064     0.8142 0.000 0.004 0.716 0.008 NA
#> SRR925726      4  0.5080     0.5491 0.048 0.000 0.000 0.604 NA
#> SRR925727      3  0.3910     0.8154 0.000 0.000 0.720 0.008 NA
#> SRR925728      4  0.5684     0.5227 0.132 0.004 0.020 0.688 NA
#> SRR934636      1  0.6155     0.5280 0.544 0.020 0.000 0.088 NA
#> SRR934637      1  0.5868     0.4765 0.516 0.004 0.000 0.088 NA
#> SRR925729      3  0.4275     0.7963 0.012 0.136 0.788 0.000 NA
#> SRR934638      1  0.3649     0.8497 0.824 0.020 0.000 0.136 NA
#> SRR934639      4  0.4096     0.6208 0.260 0.004 0.000 0.724 NA
#> SRR934640      2  0.3856     0.9040 0.028 0.828 0.040 0.000 NA
#> SRR934641      2  0.3856     0.9040 0.028 0.828 0.040 0.000 NA
#> SRR925734      1  0.3459     0.8516 0.832 0.016 0.000 0.136 NA
#> SRR925735      3  0.3139     0.8625 0.008 0.012 0.860 0.008 NA
#> SRR925736      3  0.1682     0.8658 0.004 0.012 0.940 0.000 NA
#> SRR925737      3  0.1682     0.8658 0.004 0.012 0.940 0.000 NA
#> SRR934642      2  0.2444     0.9377 0.012 0.904 0.068 0.000 NA
#> SRR934643      2  0.2444     0.9377 0.012 0.904 0.068 0.000 NA
#> SRR934644      2  0.2529     0.9339 0.024 0.908 0.032 0.000 NA
#> SRR934645      2  0.2529     0.9339 0.024 0.908 0.032 0.000 NA
#> SRR925740      3  0.1074     0.8745 0.004 0.012 0.968 0.000 NA
#> SRR925741      3  0.4064     0.8142 0.000 0.004 0.716 0.008 NA
#> SRR925742      3  0.1074     0.8745 0.004 0.012 0.968 0.000 NA
#> SRR1283038     3  0.0451     0.8801 0.000 0.004 0.988 0.000 NA

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>            class entropy silhouette    p1    p2    p3    p4    p5    p6
#> SRR925687      4  0.5495     0.4754 0.316 0.000 0.064 0.580 0.040 0.000
#> SRR925688      4  0.5371     0.4831 0.316 0.000 0.064 0.588 0.032 0.000
#> SRR925689      1  0.1921     0.8420 0.924 0.000 0.044 0.024 0.004 0.004
#> SRR925690      1  0.1921     0.8420 0.924 0.000 0.044 0.024 0.004 0.004
#> SRR925691      1  0.1921     0.8420 0.924 0.000 0.044 0.024 0.004 0.004
#> SRR925692      1  0.1921     0.8420 0.924 0.000 0.044 0.024 0.004 0.004
#> SRR925693      6  0.0767     0.7742 0.000 0.008 0.000 0.004 0.012 0.976
#> SRR925694      2  0.1880     0.9072 0.008 0.932 0.032 0.004 0.020 0.004
#> SRR925695      6  0.0862     0.7739 0.000 0.008 0.016 0.000 0.004 0.972
#> SRR925697      5  0.4439     0.9490 0.028 0.000 0.000 0.432 0.540 0.000
#> SRR925696      3  0.4284     0.7485 0.000 0.016 0.588 0.000 0.004 0.392
#> SRR925698      3  0.4325     0.7297 0.000 0.016 0.568 0.000 0.004 0.412
#> SRR925699      2  0.0508     0.9078 0.004 0.984 0.012 0.000 0.000 0.000
#> SRR925700      2  0.0603     0.9076 0.004 0.980 0.016 0.000 0.000 0.000
#> SRR925701      2  0.0837     0.9064 0.004 0.972 0.020 0.000 0.000 0.004
#> SRR925702      4  0.2015     0.5092 0.056 0.000 0.016 0.916 0.012 0.000
#> SRR925703      5  0.4566     0.9494 0.028 0.000 0.000 0.428 0.540 0.004
#> SRR925704      6  0.1053     0.7713 0.000 0.012 0.020 0.000 0.004 0.964
#> SRR925705      3  0.4245     0.7525 0.000 0.016 0.604 0.000 0.004 0.376
#> SRR925706      4  0.4203     0.3670 0.004 0.000 0.072 0.764 0.148 0.012
#> SRR925708      4  0.4156     0.5205 0.224 0.000 0.020 0.728 0.028 0.000
#> SRR925707      3  0.7415    -0.0558 0.048 0.036 0.380 0.356 0.176 0.004
#> SRR925709      4  0.2415     0.5280 0.084 0.000 0.016 0.888 0.012 0.000
#> SRR925710      4  0.1980     0.4380 0.016 0.000 0.000 0.920 0.048 0.016
#> SRR925711      3  0.5408     0.6200 0.000 0.020 0.552 0.016 0.040 0.372
#> SRR934631      2  0.3221     0.8895 0.004 0.844 0.100 0.004 0.044 0.004
#> SRR934632      2  0.3221     0.8895 0.004 0.844 0.100 0.004 0.044 0.004
#> SRR934633      3  0.6817     0.1030 0.004 0.160 0.456 0.004 0.056 0.320
#> SRR925713      4  0.1887     0.4329 0.016 0.000 0.000 0.924 0.048 0.012
#> SRR925714      5  0.4566     0.9494 0.028 0.000 0.000 0.428 0.540 0.004
#> SRR925715      4  0.4239     0.3725 0.004 0.000 0.068 0.764 0.148 0.016
#> SRR925716      5  0.4703     0.8561 0.048 0.000 0.000 0.408 0.544 0.000
#> SRR925717      4  0.4330     0.0633 0.036 0.000 0.016 0.744 0.192 0.012
#> SRR925718      2  0.2051     0.8614 0.004 0.896 0.096 0.000 0.000 0.004
#> SRR925719      4  0.3831     0.5301 0.224 0.000 0.020 0.744 0.012 0.000
#> SRR925720      4  0.5481     0.4670 0.296 0.000 0.064 0.596 0.044 0.000
#> SRR925721      4  0.5411     0.4725 0.328 0.000 0.064 0.576 0.032 0.000
#> SRR934634      1  0.1838     0.8135 0.928 0.000 0.040 0.020 0.012 0.000
#> SRR934635      1  0.1861     0.8148 0.928 0.000 0.036 0.020 0.016 0.000
#> SRR925723      3  0.4301     0.7410 0.000 0.016 0.580 0.000 0.004 0.400
#> SRR925724      3  0.4332     0.7304 0.000 0.016 0.564 0.000 0.004 0.416
#> SRR925725      6  0.0725     0.7753 0.000 0.012 0.000 0.000 0.012 0.976
#> SRR925726      5  0.4463     0.9212 0.028 0.000 0.000 0.456 0.516 0.000
#> SRR925727      6  0.0665     0.7747 0.000 0.008 0.008 0.000 0.004 0.980
#> SRR925728      4  0.5542     0.3519 0.076 0.000 0.104 0.664 0.156 0.000
#> SRR934636      1  0.5546     0.4301 0.508 0.004 0.068 0.020 0.400 0.000
#> SRR934637      1  0.5452     0.3606 0.468 0.000 0.068 0.020 0.444 0.000
#> SRR925729      6  0.6211    -0.2948 0.000 0.148 0.396 0.000 0.028 0.428
#> SRR934638      1  0.1049     0.8328 0.960 0.000 0.000 0.032 0.008 0.000
#> SRR934639      4  0.4211     0.4770 0.364 0.000 0.004 0.616 0.016 0.000
#> SRR934640      2  0.5075     0.8243 0.004 0.716 0.088 0.016 0.156 0.020
#> SRR934641      2  0.5075     0.8243 0.004 0.716 0.088 0.016 0.156 0.020
#> SRR925734      1  0.0972     0.8343 0.964 0.000 0.000 0.028 0.008 0.000
#> SRR925735      6  0.4930    -0.1234 0.000 0.008 0.332 0.008 0.044 0.608
#> SRR925736      3  0.5059     0.7176 0.000 0.024 0.596 0.004 0.036 0.340
#> SRR925737      3  0.5059     0.7176 0.000 0.024 0.596 0.004 0.036 0.340
#> SRR934642      2  0.1514     0.9035 0.004 0.944 0.036 0.000 0.012 0.004
#> SRR934643      2  0.1514     0.9035 0.004 0.944 0.036 0.000 0.012 0.004
#> SRR934644      2  0.3313     0.8947 0.008 0.844 0.052 0.004 0.088 0.004
#> SRR934645      2  0.3313     0.8947 0.008 0.844 0.052 0.004 0.088 0.004
#> SRR925740      3  0.4497     0.7502 0.000 0.020 0.600 0.000 0.012 0.368
#> SRR925741      6  0.0984     0.7764 0.000 0.012 0.008 0.000 0.012 0.968
#> SRR925742      3  0.4486     0.7505 0.000 0.020 0.604 0.000 0.012 0.364
#> SRR1283038     3  0.4387     0.7406 0.000 0.016 0.584 0.000 0.008 0.392

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

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

collect_plots(res)

plot of chunk MAD-skmeans-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.500           0.880       0.914         0.5053 0.494   0.494
#> 3 3 0.809           0.829       0.906         0.3042 0.840   0.680
#> 4 4 0.864           0.907       0.940         0.1346 0.899   0.714
#> 5 5 0.793           0.783       0.828         0.0563 1.000   1.000
#> 6 6 0.762           0.636       0.768         0.0405 0.915   0.678

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
#> SRR925687      1   0.000      0.910 1.000 0.000
#> SRR925688      1   0.000      0.910 1.000 0.000
#> SRR925689      1   0.714      0.840 0.804 0.196
#> SRR925690      1   0.714      0.840 0.804 0.196
#> SRR925691      1   0.714      0.840 0.804 0.196
#> SRR925692      1   0.714      0.840 0.804 0.196
#> SRR925693      2   0.714      0.874 0.196 0.804
#> SRR925694      2   0.000      0.879 0.000 1.000
#> SRR925695      2   0.714      0.874 0.196 0.804
#> SRR925697      1   0.000      0.910 1.000 0.000
#> SRR925696      2   0.714      0.874 0.196 0.804
#> SRR925698      2   0.714      0.874 0.196 0.804
#> SRR925699      2   0.000      0.879 0.000 1.000
#> SRR925700      2   0.000      0.879 0.000 1.000
#> SRR925701      2   0.000      0.879 0.000 1.000
#> SRR925702      1   0.000      0.910 1.000 0.000
#> SRR925703      1   0.000      0.910 1.000 0.000
#> SRR925704      2   0.714      0.874 0.196 0.804
#> SRR925705      2   0.714      0.874 0.196 0.804
#> SRR925706      1   0.000      0.910 1.000 0.000
#> SRR925708      1   0.000      0.910 1.000 0.000
#> SRR925707      2   0.000      0.879 0.000 1.000
#> SRR925709      1   0.000      0.910 1.000 0.000
#> SRR925710      1   0.000      0.910 1.000 0.000
#> SRR925711      2   0.714      0.874 0.196 0.804
#> SRR934631      2   0.000      0.879 0.000 1.000
#> SRR934632      2   0.000      0.879 0.000 1.000
#> SRR934633      2   0.000      0.879 0.000 1.000
#> SRR925713      1   0.000      0.910 1.000 0.000
#> SRR925714      1   0.000      0.910 1.000 0.000
#> SRR925715      1   0.000      0.910 1.000 0.000
#> SRR925716      1   0.000      0.910 1.000 0.000
#> SRR925717      1   0.000      0.910 1.000 0.000
#> SRR925718      2   0.000      0.879 0.000 1.000
#> SRR925719      1   0.000      0.910 1.000 0.000
#> SRR925720      1   0.000      0.910 1.000 0.000
#> SRR925721      1   0.000      0.910 1.000 0.000
#> SRR934634      1   0.714      0.840 0.804 0.196
#> SRR934635      1   0.714      0.840 0.804 0.196
#> SRR925723      2   0.714      0.874 0.196 0.804
#> SRR925724      2   0.714      0.874 0.196 0.804
#> SRR925725      2   0.714      0.874 0.196 0.804
#> SRR925726      1   0.000      0.910 1.000 0.000
#> SRR925727      2   0.714      0.874 0.196 0.804
#> SRR925728      1   0.714      0.840 0.804 0.196
#> SRR934636      1   0.714      0.840 0.804 0.196
#> SRR934637      1   0.714      0.840 0.804 0.196
#> SRR925729      2   0.714      0.874 0.196 0.804
#> SRR934638      1   0.714      0.840 0.804 0.196
#> SRR934639      1   0.000      0.910 1.000 0.000
#> SRR934640      2   0.000      0.879 0.000 1.000
#> SRR934641      2   0.000      0.879 0.000 1.000
#> SRR925734      1   0.714      0.840 0.804 0.196
#> SRR925735      2   0.714      0.874 0.196 0.804
#> SRR925736      2   0.714      0.874 0.196 0.804
#> SRR925737      2   0.714      0.874 0.196 0.804
#> SRR934642      2   0.000      0.879 0.000 1.000
#> SRR934643      2   0.000      0.879 0.000 1.000
#> SRR934644      2   0.000      0.879 0.000 1.000
#> SRR934645      2   0.000      0.879 0.000 1.000
#> SRR925740      2   0.000      0.879 0.000 1.000
#> SRR925741      2   0.714      0.874 0.196 0.804
#> SRR925742      2   0.000      0.879 0.000 1.000
#> SRR1283038     2   0.714      0.874 0.196 0.804

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>            class entropy silhouette    p1    p2    p3
#> SRR925687      1  0.2356     0.8272 0.928 0.072 0.000
#> SRR925688      1  0.2356     0.8272 0.928 0.072 0.000
#> SRR925689      1  0.6309     0.3794 0.504 0.496 0.000
#> SRR925690      1  0.6309     0.3794 0.504 0.496 0.000
#> SRR925691      1  0.6309     0.3794 0.504 0.496 0.000
#> SRR925692      1  0.6309     0.3794 0.504 0.496 0.000
#> SRR925693      3  0.0000     0.9775 0.000 0.000 1.000
#> SRR925694      2  0.2356     0.9571 0.000 0.928 0.072
#> SRR925695      3  0.0000     0.9775 0.000 0.000 1.000
#> SRR925697      1  0.0000     0.8299 1.000 0.000 0.000
#> SRR925696      3  0.0000     0.9775 0.000 0.000 1.000
#> SRR925698      3  0.0000     0.9775 0.000 0.000 1.000
#> SRR925699      2  0.2356     0.9571 0.000 0.928 0.072
#> SRR925700      2  0.2356     0.9571 0.000 0.928 0.072
#> SRR925701      2  0.2356     0.9571 0.000 0.928 0.072
#> SRR925702      1  0.0000     0.8299 1.000 0.000 0.000
#> SRR925703      1  0.0000     0.8299 1.000 0.000 0.000
#> SRR925704      3  0.0000     0.9775 0.000 0.000 1.000
#> SRR925705      3  0.0000     0.9775 0.000 0.000 1.000
#> SRR925706      1  0.0000     0.8299 1.000 0.000 0.000
#> SRR925708      1  0.2356     0.8272 0.928 0.072 0.000
#> SRR925707      2  0.2356     0.8729 0.072 0.928 0.000
#> SRR925709      1  0.2356     0.8272 0.928 0.072 0.000
#> SRR925710      1  0.1411     0.8301 0.964 0.036 0.000
#> SRR925711      3  0.3038     0.8853 0.000 0.104 0.896
#> SRR934631      2  0.2356     0.9571 0.000 0.928 0.072
#> SRR934632      2  0.2356     0.9571 0.000 0.928 0.072
#> SRR934633      3  0.4235     0.7984 0.000 0.176 0.824
#> SRR925713      1  0.0000     0.8299 1.000 0.000 0.000
#> SRR925714      1  0.0000     0.8299 1.000 0.000 0.000
#> SRR925715      1  0.0747     0.8208 0.984 0.000 0.016
#> SRR925716      1  0.0000     0.8299 1.000 0.000 0.000
#> SRR925717      1  0.0237     0.8303 0.996 0.004 0.000
#> SRR925718      2  0.2356     0.9571 0.000 0.928 0.072
#> SRR925719      1  0.2356     0.8272 0.928 0.072 0.000
#> SRR925720      1  0.2356     0.8272 0.928 0.072 0.000
#> SRR925721      1  0.2356     0.8272 0.928 0.072 0.000
#> SRR934634      1  0.6309     0.3794 0.504 0.496 0.000
#> SRR934635      1  0.6295     0.4192 0.528 0.472 0.000
#> SRR925723      3  0.0000     0.9775 0.000 0.000 1.000
#> SRR925724      3  0.0000     0.9775 0.000 0.000 1.000
#> SRR925725      3  0.0000     0.9775 0.000 0.000 1.000
#> SRR925726      1  0.0000     0.8299 1.000 0.000 0.000
#> SRR925727      3  0.0000     0.9775 0.000 0.000 1.000
#> SRR925728      1  0.0424     0.8288 0.992 0.008 0.000
#> SRR934636      2  0.6192     0.0929 0.420 0.580 0.000
#> SRR934637      1  0.0237     0.8296 0.996 0.004 0.000
#> SRR925729      3  0.3482     0.8595 0.000 0.128 0.872
#> SRR934638      1  0.6309     0.3794 0.504 0.496 0.000
#> SRR934639      1  0.2356     0.8272 0.928 0.072 0.000
#> SRR934640      2  0.2356     0.9571 0.000 0.928 0.072
#> SRR934641      2  0.2356     0.9571 0.000 0.928 0.072
#> SRR925734      1  0.6309     0.3794 0.504 0.496 0.000
#> SRR925735      3  0.0000     0.9775 0.000 0.000 1.000
#> SRR925736      3  0.0000     0.9775 0.000 0.000 1.000
#> SRR925737      3  0.0000     0.9775 0.000 0.000 1.000
#> SRR934642      2  0.2356     0.9571 0.000 0.928 0.072
#> SRR934643      2  0.2356     0.9571 0.000 0.928 0.072
#> SRR934644      2  0.2356     0.9571 0.000 0.928 0.072
#> SRR934645      2  0.2356     0.9571 0.000 0.928 0.072
#> SRR925740      3  0.0000     0.9775 0.000 0.000 1.000
#> SRR925741      3  0.0000     0.9775 0.000 0.000 1.000
#> SRR925742      3  0.0000     0.9775 0.000 0.000 1.000
#> SRR1283038     3  0.0000     0.9775 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
#> SRR925687      4  0.3649      0.848 0.204 0.000 0.000 0.796
#> SRR925688      4  0.3649      0.848 0.204 0.000 0.000 0.796
#> SRR925689      1  0.0188      0.954 0.996 0.000 0.000 0.004
#> SRR925690      1  0.0188      0.954 0.996 0.000 0.000 0.004
#> SRR925691      1  0.0188      0.954 0.996 0.000 0.000 0.004
#> SRR925692      1  0.0188      0.954 0.996 0.000 0.000 0.004
#> SRR925693      3  0.0895      0.959 0.004 0.020 0.976 0.000
#> SRR925694      2  0.0336      0.980 0.000 0.992 0.008 0.000
#> SRR925695      3  0.0779      0.961 0.004 0.016 0.980 0.000
#> SRR925697      4  0.1022      0.875 0.032 0.000 0.000 0.968
#> SRR925696      3  0.0000      0.963 0.000 0.000 1.000 0.000
#> SRR925698      3  0.0000      0.963 0.000 0.000 1.000 0.000
#> SRR925699      2  0.0817      0.979 0.000 0.976 0.024 0.000
#> SRR925700      2  0.0817      0.979 0.000 0.976 0.024 0.000
#> SRR925701      2  0.0817      0.979 0.000 0.976 0.024 0.000
#> SRR925702      4  0.0524      0.867 0.008 0.004 0.000 0.988
#> SRR925703      4  0.1022      0.875 0.032 0.000 0.000 0.968
#> SRR925704      3  0.0779      0.961 0.004 0.016 0.980 0.000
#> SRR925705      3  0.0000      0.963 0.000 0.000 1.000 0.000
#> SRR925706      4  0.0188      0.863 0.000 0.004 0.000 0.996
#> SRR925708      4  0.3649      0.848 0.204 0.000 0.000 0.796
#> SRR925707      2  0.2814      0.845 0.000 0.868 0.000 0.132
#> SRR925709      4  0.3448      0.847 0.168 0.004 0.000 0.828
#> SRR925710      4  0.2053      0.873 0.072 0.004 0.000 0.924
#> SRR925711      3  0.2773      0.886 0.004 0.116 0.880 0.000
#> SRR934631      2  0.0336      0.980 0.000 0.992 0.008 0.000
#> SRR934632      2  0.0336      0.980 0.000 0.992 0.008 0.000
#> SRR934633      3  0.4252      0.710 0.004 0.252 0.744 0.000
#> SRR925713      4  0.0376      0.865 0.004 0.004 0.000 0.992
#> SRR925714      4  0.1022      0.875 0.032 0.000 0.000 0.968
#> SRR925715      4  0.1151      0.872 0.024 0.008 0.000 0.968
#> SRR925716      4  0.1118      0.874 0.036 0.000 0.000 0.964
#> SRR925717      4  0.1637      0.878 0.060 0.000 0.000 0.940
#> SRR925718      2  0.0817      0.979 0.000 0.976 0.024 0.000
#> SRR925719      4  0.3649      0.848 0.204 0.000 0.000 0.796
#> SRR925720      4  0.3649      0.848 0.204 0.000 0.000 0.796
#> SRR925721      4  0.3764      0.839 0.216 0.000 0.000 0.784
#> SRR934634      1  0.0188      0.954 0.996 0.000 0.000 0.004
#> SRR934635      1  0.0188      0.954 0.996 0.000 0.000 0.004
#> SRR925723      3  0.0000      0.963 0.000 0.000 1.000 0.000
#> SRR925724      3  0.0000      0.963 0.000 0.000 1.000 0.000
#> SRR925725      3  0.0779      0.961 0.004 0.016 0.980 0.000
#> SRR925726      4  0.1022      0.875 0.032 0.000 0.000 0.968
#> SRR925727      3  0.0657      0.962 0.004 0.012 0.984 0.000
#> SRR925728      4  0.5028      0.148 0.400 0.004 0.000 0.596
#> SRR934636      1  0.3356      0.803 0.824 0.000 0.000 0.176
#> SRR934637      1  0.3356      0.803 0.824 0.000 0.000 0.176
#> SRR925729      3  0.3710      0.797 0.004 0.192 0.804 0.000
#> SRR934638      1  0.0188      0.954 0.996 0.000 0.000 0.004
#> SRR934639      4  0.3764      0.839 0.216 0.000 0.000 0.784
#> SRR934640      2  0.0188      0.978 0.000 0.996 0.004 0.000
#> SRR934641      2  0.0188      0.978 0.000 0.996 0.004 0.000
#> SRR925734      1  0.0188      0.954 0.996 0.000 0.000 0.004
#> SRR925735      3  0.1209      0.955 0.004 0.032 0.964 0.000
#> SRR925736      3  0.0000      0.963 0.000 0.000 1.000 0.000
#> SRR925737      3  0.0000      0.963 0.000 0.000 1.000 0.000
#> SRR934642      2  0.0817      0.979 0.000 0.976 0.024 0.000
#> SRR934643      2  0.0817      0.979 0.000 0.976 0.024 0.000
#> SRR934644      2  0.0336      0.980 0.000 0.992 0.008 0.000
#> SRR934645      2  0.0336      0.980 0.000 0.992 0.008 0.000
#> SRR925740      3  0.0000      0.963 0.000 0.000 1.000 0.000
#> SRR925741      3  0.0779      0.961 0.004 0.016 0.980 0.000
#> SRR925742      3  0.0000      0.963 0.000 0.000 1.000 0.000
#> SRR1283038     3  0.0469      0.962 0.000 0.012 0.988 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
#> SRR925687      4  0.3929      0.735 0.208 0.000 0.000 0.764 NA
#> SRR925688      4  0.3929      0.735 0.208 0.000 0.000 0.764 NA
#> SRR925689      1  0.0000      0.893 1.000 0.000 0.000 0.000 NA
#> SRR925690      1  0.0000      0.893 1.000 0.000 0.000 0.000 NA
#> SRR925691      1  0.0000      0.893 1.000 0.000 0.000 0.000 NA
#> SRR925692      1  0.0000      0.893 1.000 0.000 0.000 0.000 NA
#> SRR925693      3  0.0703      0.778 0.000 0.000 0.976 0.000 NA
#> SRR925694      2  0.0162      0.954 0.000 0.996 0.004 0.000 NA
#> SRR925695      3  0.0000      0.785 0.000 0.000 1.000 0.000 NA
#> SRR925697      4  0.3661      0.720 0.000 0.000 0.000 0.724 NA
#> SRR925696      3  0.4182      0.794 0.000 0.004 0.644 0.000 NA
#> SRR925698      3  0.3579      0.808 0.000 0.004 0.756 0.000 NA
#> SRR925699      2  0.0609      0.953 0.000 0.980 0.000 0.000 NA
#> SRR925700      2  0.0609      0.953 0.000 0.980 0.000 0.000 NA
#> SRR925701      2  0.0771      0.952 0.000 0.976 0.004 0.000 NA
#> SRR925702      4  0.2077      0.764 0.008 0.000 0.000 0.908 NA
#> SRR925703      4  0.3661      0.720 0.000 0.000 0.000 0.724 NA
#> SRR925704      3  0.0162      0.785 0.000 0.004 0.996 0.000 NA
#> SRR925705      3  0.4299      0.785 0.000 0.004 0.608 0.000 NA
#> SRR925706      4  0.3774      0.660 0.000 0.000 0.000 0.704 NA
#> SRR925708      4  0.3300      0.744 0.204 0.000 0.000 0.792 NA
#> SRR925707      2  0.5870      0.565 0.000 0.584 0.000 0.140 NA
#> SRR925709      4  0.3090      0.757 0.104 0.000 0.000 0.856 NA
#> SRR925710      4  0.2221      0.773 0.052 0.000 0.000 0.912 NA
#> SRR925711      3  0.5458      0.761 0.000 0.088 0.608 0.000 NA
#> SRR934631      2  0.0162      0.954 0.000 0.996 0.004 0.000 NA
#> SRR934632      2  0.0162      0.954 0.000 0.996 0.004 0.000 NA
#> SRR934633      3  0.5119      0.376 0.000 0.360 0.592 0.000 NA
#> SRR925713      4  0.1331      0.772 0.008 0.000 0.000 0.952 NA
#> SRR925714      4  0.3661      0.720 0.000 0.000 0.000 0.724 NA
#> SRR925715      4  0.2942      0.743 0.008 0.000 0.008 0.856 NA
#> SRR925716      4  0.4697      0.659 0.032 0.000 0.000 0.648 NA
#> SRR925717      4  0.2624      0.772 0.012 0.000 0.000 0.872 NA
#> SRR925718      2  0.1571      0.926 0.000 0.936 0.004 0.000 NA
#> SRR925719      4  0.3492      0.747 0.188 0.000 0.000 0.796 NA
#> SRR925720      4  0.3929      0.735 0.208 0.000 0.000 0.764 NA
#> SRR925721      4  0.4083      0.722 0.228 0.000 0.000 0.744 NA
#> SRR934634      1  0.0451      0.892 0.988 0.000 0.000 0.004 NA
#> SRR934635      1  0.0451      0.892 0.988 0.000 0.000 0.004 NA
#> SRR925723      3  0.3715      0.808 0.000 0.004 0.736 0.000 NA
#> SRR925724      3  0.3521      0.809 0.000 0.004 0.764 0.000 NA
#> SRR925725      3  0.0324      0.784 0.000 0.004 0.992 0.000 NA
#> SRR925726      4  0.3336      0.741 0.000 0.000 0.000 0.772 NA
#> SRR925727      3  0.0000      0.785 0.000 0.000 1.000 0.000 NA
#> SRR925728      4  0.6715      0.050 0.248 0.000 0.000 0.392 NA
#> SRR934636      1  0.5751      0.527 0.552 0.000 0.000 0.100 NA
#> SRR934637      1  0.5900      0.483 0.516 0.000 0.000 0.108 NA
#> SRR925729      3  0.3919      0.665 0.000 0.188 0.776 0.000 NA
#> SRR934638      1  0.0451      0.892 0.988 0.000 0.000 0.004 NA
#> SRR934639      4  0.4297      0.677 0.288 0.000 0.000 0.692 NA
#> SRR934640      2  0.0865      0.946 0.000 0.972 0.004 0.000 NA
#> SRR934641      2  0.0865      0.946 0.000 0.972 0.004 0.000 NA
#> SRR925734      1  0.0324      0.893 0.992 0.000 0.000 0.004 NA
#> SRR925735      3  0.1753      0.762 0.000 0.032 0.936 0.000 NA
#> SRR925736      3  0.4425      0.761 0.000 0.004 0.544 0.000 NA
#> SRR925737      3  0.4425      0.761 0.000 0.004 0.544 0.000 NA
#> SRR934642      2  0.1041      0.947 0.000 0.964 0.004 0.000 NA
#> SRR934643      2  0.1041      0.947 0.000 0.964 0.004 0.000 NA
#> SRR934644      2  0.0162      0.954 0.000 0.996 0.004 0.000 NA
#> SRR934645      2  0.0162      0.954 0.000 0.996 0.004 0.000 NA
#> SRR925740      3  0.4403      0.768 0.000 0.004 0.560 0.000 NA
#> SRR925741      3  0.0324      0.784 0.000 0.004 0.992 0.000 NA
#> SRR925742      3  0.4403      0.768 0.000 0.004 0.560 0.000 NA
#> SRR1283038     3  0.4060      0.795 0.000 0.000 0.640 0.000 NA

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>            class entropy silhouette    p1    p2    p3    p4    p5    p6
#> SRR925687      4  0.6175     0.5689 0.136 0.000 0.000 0.600 0.104 0.160
#> SRR925688      4  0.6227     0.5674 0.132 0.000 0.000 0.592 0.104 0.172
#> SRR925689      1  0.0146     0.8009 0.996 0.000 0.004 0.000 0.000 0.000
#> SRR925690      1  0.0146     0.8009 0.996 0.000 0.004 0.000 0.000 0.000
#> SRR925691      1  0.0146     0.8009 0.996 0.000 0.004 0.000 0.000 0.000
#> SRR925692      1  0.0146     0.8009 0.996 0.000 0.004 0.000 0.000 0.000
#> SRR925693      5  0.3619     0.8801 0.000 0.000 0.316 0.000 0.680 0.004
#> SRR925694      2  0.0146     0.8985 0.000 0.996 0.000 0.000 0.004 0.000
#> SRR925695      5  0.3634     0.8879 0.000 0.000 0.356 0.000 0.644 0.000
#> SRR925697      4  0.3551     0.3998 0.000 0.000 0.000 0.792 0.148 0.060
#> SRR925696      3  0.2278     0.7278 0.000 0.004 0.868 0.000 0.128 0.000
#> SRR925698      3  0.3426     0.5302 0.000 0.004 0.720 0.000 0.276 0.000
#> SRR925699      2  0.1086     0.8981 0.000 0.964 0.012 0.000 0.012 0.012
#> SRR925700      2  0.1086     0.8981 0.000 0.964 0.012 0.000 0.012 0.012
#> SRR925701      2  0.1086     0.8981 0.000 0.964 0.012 0.000 0.012 0.012
#> SRR925702      4  0.4549     0.3764 0.004 0.000 0.000 0.552 0.028 0.416
#> SRR925703      4  0.3551     0.3998 0.000 0.000 0.000 0.792 0.148 0.060
#> SRR925704      5  0.3634     0.8879 0.000 0.000 0.356 0.000 0.644 0.000
#> SRR925705      3  0.1858     0.7404 0.000 0.004 0.904 0.000 0.092 0.000
#> SRR925706      6  0.4276     0.1088 0.000 0.000 0.000 0.416 0.020 0.564
#> SRR925708      4  0.5345     0.5890 0.124 0.000 0.000 0.680 0.056 0.140
#> SRR925707      6  0.4097     0.3956 0.000 0.284 0.012 0.000 0.016 0.688
#> SRR925709      4  0.5322     0.4952 0.056 0.000 0.000 0.580 0.032 0.332
#> SRR925710      4  0.3627     0.4609 0.020 0.000 0.000 0.752 0.004 0.224
#> SRR925711      3  0.6551     0.1508 0.000 0.104 0.488 0.000 0.312 0.096
#> SRR934631      2  0.0405     0.8978 0.000 0.988 0.000 0.000 0.008 0.004
#> SRR934632      2  0.0405     0.8978 0.000 0.988 0.000 0.000 0.008 0.004
#> SRR934633      2  0.6003    -0.1940 0.000 0.444 0.180 0.000 0.368 0.008
#> SRR925713      4  0.3215     0.4338 0.000 0.000 0.000 0.756 0.004 0.240
#> SRR925714      4  0.3551     0.3998 0.000 0.000 0.000 0.792 0.148 0.060
#> SRR925715      4  0.4276     0.0589 0.000 0.000 0.000 0.564 0.020 0.416
#> SRR925716      4  0.5400     0.2590 0.012 0.000 0.000 0.624 0.184 0.180
#> SRR925717      4  0.1296     0.5312 0.004 0.000 0.000 0.948 0.004 0.044
#> SRR925718      2  0.2043     0.8611 0.000 0.912 0.064 0.000 0.012 0.012
#> SRR925719      4  0.5605     0.5848 0.116 0.000 0.000 0.652 0.064 0.168
#> SRR925720      4  0.6175     0.5689 0.136 0.000 0.000 0.600 0.104 0.160
#> SRR925721      4  0.6425     0.5485 0.156 0.000 0.000 0.568 0.108 0.168
#> SRR934634      1  0.2811     0.7814 0.872 0.000 0.000 0.032 0.076 0.020
#> SRR934635      1  0.2681     0.7856 0.880 0.000 0.000 0.028 0.072 0.020
#> SRR925723      3  0.2994     0.6530 0.000 0.004 0.788 0.000 0.208 0.000
#> SRR925724      3  0.3646     0.4731 0.000 0.004 0.700 0.000 0.292 0.004
#> SRR925725      5  0.3684     0.8912 0.000 0.000 0.332 0.000 0.664 0.004
#> SRR925726      4  0.2432     0.4639 0.000 0.000 0.000 0.876 0.100 0.024
#> SRR925727      5  0.3782     0.8843 0.000 0.000 0.360 0.000 0.636 0.004
#> SRR925728      6  0.3652     0.4909 0.088 0.000 0.004 0.072 0.016 0.820
#> SRR934636      1  0.7480     0.1661 0.376 0.000 0.000 0.196 0.176 0.252
#> SRR934637      1  0.7577     0.1155 0.344 0.000 0.000 0.212 0.184 0.260
#> SRR925729      5  0.5557     0.5912 0.000 0.148 0.300 0.000 0.548 0.004
#> SRR934638      1  0.2613     0.7881 0.884 0.000 0.000 0.016 0.068 0.032
#> SRR934639      4  0.6695     0.4778 0.264 0.000 0.000 0.496 0.088 0.152
#> SRR934640      2  0.2258     0.8351 0.000 0.896 0.000 0.000 0.044 0.060
#> SRR934641      2  0.2258     0.8351 0.000 0.896 0.000 0.000 0.044 0.060
#> SRR925734      1  0.1692     0.7961 0.932 0.000 0.000 0.012 0.048 0.008
#> SRR925735      5  0.4061     0.8333 0.000 0.012 0.316 0.000 0.664 0.008
#> SRR925736      3  0.1434     0.7148 0.000 0.008 0.948 0.000 0.020 0.024
#> SRR925737      3  0.1426     0.7102 0.000 0.008 0.948 0.000 0.016 0.028
#> SRR934642      2  0.1434     0.8920 0.000 0.948 0.028 0.000 0.012 0.012
#> SRR934643      2  0.1434     0.8920 0.000 0.948 0.028 0.000 0.012 0.012
#> SRR934644      2  0.0405     0.8979 0.000 0.988 0.000 0.000 0.004 0.008
#> SRR934645      2  0.0405     0.8979 0.000 0.988 0.000 0.000 0.004 0.008
#> SRR925740      3  0.0405     0.7349 0.000 0.008 0.988 0.000 0.000 0.004
#> SRR925741      5  0.3592     0.8935 0.000 0.000 0.344 0.000 0.656 0.000
#> SRR925742      3  0.0405     0.7349 0.000 0.008 0.988 0.000 0.000 0.004
#> SRR1283038     3  0.2595     0.6918 0.000 0.004 0.836 0.000 0.160 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 15949 rows and 64 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.986       0.994         0.5055 0.494   0.494
#> 3 3 0.645           0.563       0.809         0.2554 0.884   0.770
#> 4 4 0.766           0.894       0.918         0.1661 0.787   0.502
#> 5 5 0.743           0.730       0.835         0.0476 0.948   0.800
#> 6 6 0.772           0.708       0.858         0.0281 0.984   0.926

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
#> SRR925687      1  0.0000      0.987 1.000 0.000
#> SRR925688      1  0.0000      0.987 1.000 0.000
#> SRR925689      1  0.0000      0.987 1.000 0.000
#> SRR925690      1  0.0000      0.987 1.000 0.000
#> SRR925691      1  0.0000      0.987 1.000 0.000
#> SRR925692      1  0.0000      0.987 1.000 0.000
#> SRR925693      2  0.0000      1.000 0.000 1.000
#> SRR925694      2  0.0000      1.000 0.000 1.000
#> SRR925695      2  0.0000      1.000 0.000 1.000
#> SRR925697      1  0.0000      0.987 1.000 0.000
#> SRR925696      2  0.0000      1.000 0.000 1.000
#> SRR925698      2  0.0000      1.000 0.000 1.000
#> SRR925699      2  0.0000      1.000 0.000 1.000
#> SRR925700      2  0.0000      1.000 0.000 1.000
#> SRR925701      2  0.0000      1.000 0.000 1.000
#> SRR925702      1  0.0000      0.987 1.000 0.000
#> SRR925703      1  0.0000      0.987 1.000 0.000
#> SRR925704      2  0.0000      1.000 0.000 1.000
#> SRR925705      2  0.0000      1.000 0.000 1.000
#> SRR925706      1  0.0376      0.984 0.996 0.004
#> SRR925708      1  0.0000      0.987 1.000 0.000
#> SRR925707      2  0.0000      1.000 0.000 1.000
#> SRR925709      1  0.0000      0.987 1.000 0.000
#> SRR925710      1  0.0000      0.987 1.000 0.000
#> SRR925711      2  0.0000      1.000 0.000 1.000
#> SRR934631      2  0.0000      1.000 0.000 1.000
#> SRR934632      2  0.0000      1.000 0.000 1.000
#> SRR934633      2  0.0000      1.000 0.000 1.000
#> SRR925713      1  0.0000      0.987 1.000 0.000
#> SRR925714      1  0.0000      0.987 1.000 0.000
#> SRR925715      1  0.3584      0.920 0.932 0.068
#> SRR925716      1  0.0000      0.987 1.000 0.000
#> SRR925717      1  0.0000      0.987 1.000 0.000
#> SRR925718      2  0.0000      1.000 0.000 1.000
#> SRR925719      1  0.0000      0.987 1.000 0.000
#> SRR925720      1  0.0000      0.987 1.000 0.000
#> SRR925721      1  0.0000      0.987 1.000 0.000
#> SRR934634      1  0.0000      0.987 1.000 0.000
#> SRR934635      1  0.0000      0.987 1.000 0.000
#> SRR925723      2  0.0000      1.000 0.000 1.000
#> SRR925724      2  0.0000      1.000 0.000 1.000
#> SRR925725      2  0.0000      1.000 0.000 1.000
#> SRR925726      1  0.0000      0.987 1.000 0.000
#> SRR925727      2  0.0000      1.000 0.000 1.000
#> SRR925728      1  0.8861      0.565 0.696 0.304
#> SRR934636      1  0.0000      0.987 1.000 0.000
#> SRR934637      1  0.0000      0.987 1.000 0.000
#> SRR925729      2  0.0000      1.000 0.000 1.000
#> SRR934638      1  0.0000      0.987 1.000 0.000
#> SRR934639      1  0.0000      0.987 1.000 0.000
#> SRR934640      2  0.0000      1.000 0.000 1.000
#> SRR934641      2  0.0000      1.000 0.000 1.000
#> SRR925734      1  0.0000      0.987 1.000 0.000
#> SRR925735      2  0.0000      1.000 0.000 1.000
#> SRR925736      2  0.0000      1.000 0.000 1.000
#> SRR925737      2  0.0000      1.000 0.000 1.000
#> SRR934642      2  0.0000      1.000 0.000 1.000
#> SRR934643      2  0.0000      1.000 0.000 1.000
#> SRR934644      2  0.0000      1.000 0.000 1.000
#> SRR934645      2  0.0000      1.000 0.000 1.000
#> SRR925740      2  0.0000      1.000 0.000 1.000
#> SRR925741      2  0.0000      1.000 0.000 1.000
#> SRR925742      2  0.0000      1.000 0.000 1.000
#> SRR1283038     2  0.0000      1.000 0.000 1.000

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>            class entropy silhouette    p1    p2    p3
#> SRR925687      1  0.0000     0.8011 1.000 0.000 0.000
#> SRR925688      1  0.0000     0.8011 1.000 0.000 0.000
#> SRR925689      3  0.5678     0.3502 0.316 0.000 0.684
#> SRR925690      1  0.6126     0.3672 0.600 0.000 0.400
#> SRR925691      1  0.5948     0.4612 0.640 0.000 0.360
#> SRR925692      3  0.6267     0.0342 0.452 0.000 0.548
#> SRR925693      2  0.0000     0.7706 0.000 1.000 0.000
#> SRR925694      3  0.6244    -0.2216 0.000 0.440 0.560
#> SRR925695      2  0.0000     0.7706 0.000 1.000 0.000
#> SRR925697      1  0.4178     0.7580 0.828 0.000 0.172
#> SRR925696      2  0.0000     0.7706 0.000 1.000 0.000
#> SRR925698      2  0.0000     0.7706 0.000 1.000 0.000
#> SRR925699      2  0.6280     0.3356 0.000 0.540 0.460
#> SRR925700      2  0.6308     0.2520 0.000 0.508 0.492
#> SRR925701      2  0.6280     0.3356 0.000 0.540 0.460
#> SRR925702      1  0.1163     0.7994 0.972 0.000 0.028
#> SRR925703      1  0.4178     0.7580 0.828 0.000 0.172
#> SRR925704      2  0.0000     0.7706 0.000 1.000 0.000
#> SRR925705      2  0.0000     0.7706 0.000 1.000 0.000
#> SRR925706      1  0.5817     0.7032 0.800 0.100 0.100
#> SRR925708      1  0.0000     0.8011 1.000 0.000 0.000
#> SRR925707      2  0.5948     0.4458 0.000 0.640 0.360
#> SRR925709      1  0.5835     0.4991 0.660 0.000 0.340
#> SRR925710      1  0.0000     0.8011 1.000 0.000 0.000
#> SRR925711      2  0.0000     0.7706 0.000 1.000 0.000
#> SRR934631      2  0.6307     0.2917 0.000 0.512 0.488
#> SRR934632      2  0.6307     0.2917 0.000 0.512 0.488
#> SRR934633      2  0.2878     0.7180 0.000 0.904 0.096
#> SRR925713      1  0.3551     0.7750 0.868 0.000 0.132
#> SRR925714      1  0.4178     0.7580 0.828 0.000 0.172
#> SRR925715      1  0.0592     0.7959 0.988 0.012 0.000
#> SRR925716      1  0.4178     0.7580 0.828 0.000 0.172
#> SRR925717      1  0.3551     0.7750 0.868 0.000 0.132
#> SRR925718      2  0.6280     0.3356 0.000 0.540 0.460
#> SRR925719      1  0.0000     0.8011 1.000 0.000 0.000
#> SRR925720      1  0.0000     0.8011 1.000 0.000 0.000
#> SRR925721      1  0.0000     0.8011 1.000 0.000 0.000
#> SRR934634      1  0.3686     0.7196 0.860 0.000 0.140
#> SRR934635      1  0.5835     0.4991 0.660 0.000 0.340
#> SRR925723      2  0.0000     0.7706 0.000 1.000 0.000
#> SRR925724      2  0.0000     0.7706 0.000 1.000 0.000
#> SRR925725      2  0.0000     0.7706 0.000 1.000 0.000
#> SRR925726      1  0.4178     0.7580 0.828 0.000 0.172
#> SRR925727      2  0.0000     0.7706 0.000 1.000 0.000
#> SRR925728      1  0.9266    -0.3058 0.424 0.156 0.420
#> SRR934636      3  0.2711     0.3658 0.088 0.000 0.912
#> SRR934637      1  0.6280     0.5452 0.540 0.000 0.460
#> SRR925729      2  0.1031     0.7556 0.000 0.976 0.024
#> SRR934638      3  0.5678     0.3502 0.316 0.000 0.684
#> SRR934639      1  0.1529     0.7870 0.960 0.000 0.040
#> SRR934640      2  0.6302     0.3060 0.000 0.520 0.480
#> SRR934641      2  0.6302     0.3060 0.000 0.520 0.480
#> SRR925734      3  0.6260     0.0488 0.448 0.000 0.552
#> SRR925735      2  0.0592     0.7613 0.012 0.988 0.000
#> SRR925736      2  0.0000     0.7706 0.000 1.000 0.000
#> SRR925737      2  0.0000     0.7706 0.000 1.000 0.000
#> SRR934642      2  0.6280     0.3356 0.000 0.540 0.460
#> SRR934643      2  0.6280     0.3356 0.000 0.540 0.460
#> SRR934644      3  0.6295    -0.2926 0.000 0.472 0.528
#> SRR934645      3  0.6299    -0.3028 0.000 0.476 0.524
#> SRR925740      2  0.0000     0.7706 0.000 1.000 0.000
#> SRR925741      2  0.0000     0.7706 0.000 1.000 0.000
#> SRR925742      2  0.0000     0.7706 0.000 1.000 0.000
#> SRR1283038     2  0.0000     0.7706 0.000 1.000 0.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> SRR925687      4  0.3569      0.885 0.196 0.000 0.000 0.804
#> SRR925688      4  0.3569      0.885 0.196 0.000 0.000 0.804
#> SRR925689      1  0.0000      0.927 1.000 0.000 0.000 0.000
#> SRR925690      1  0.0000      0.927 1.000 0.000 0.000 0.000
#> SRR925691      1  0.0000      0.927 1.000 0.000 0.000 0.000
#> SRR925692      1  0.0000      0.927 1.000 0.000 0.000 0.000
#> SRR925693      3  0.0188      0.975 0.000 0.004 0.996 0.000
#> SRR925694      2  0.0592      0.852 0.000 0.984 0.016 0.000
#> SRR925695      3  0.0592      0.970 0.000 0.016 0.984 0.000
#> SRR925697      4  0.0000      0.850 0.000 0.000 0.000 1.000
#> SRR925696      3  0.0336      0.977 0.000 0.008 0.992 0.000
#> SRR925698      3  0.0336      0.977 0.000 0.008 0.992 0.000
#> SRR925699      2  0.2921      0.887 0.000 0.860 0.140 0.000
#> SRR925700      2  0.3528      0.873 0.000 0.808 0.192 0.000
#> SRR925701      2  0.3444      0.877 0.000 0.816 0.184 0.000
#> SRR925702      4  0.3219      0.886 0.164 0.000 0.000 0.836
#> SRR925703      4  0.0000      0.850 0.000 0.000 0.000 1.000
#> SRR925704      3  0.0592      0.970 0.000 0.016 0.984 0.000
#> SRR925705      3  0.0336      0.977 0.000 0.008 0.992 0.000
#> SRR925706      4  0.3903      0.817 0.076 0.000 0.080 0.844
#> SRR925708      4  0.3569      0.885 0.196 0.000 0.000 0.804
#> SRR925707      3  0.2266      0.893 0.004 0.084 0.912 0.000
#> SRR925709      1  0.0188      0.927 0.996 0.000 0.000 0.004
#> SRR925710      4  0.3610      0.883 0.200 0.000 0.000 0.800
#> SRR925711      3  0.0336      0.977 0.000 0.008 0.992 0.000
#> SRR934631      2  0.0336      0.841 0.000 0.992 0.008 0.000
#> SRR934632      2  0.0336      0.841 0.000 0.992 0.008 0.000
#> SRR934633      2  0.3311      0.768 0.000 0.828 0.172 0.000
#> SRR925713      4  0.1211      0.866 0.040 0.000 0.000 0.960
#> SRR925714      4  0.0000      0.850 0.000 0.000 0.000 1.000
#> SRR925715      4  0.4019      0.879 0.196 0.000 0.012 0.792
#> SRR925716      4  0.0000      0.850 0.000 0.000 0.000 1.000
#> SRR925717      4  0.1211      0.866 0.040 0.000 0.000 0.960
#> SRR925718      2  0.3528      0.873 0.000 0.808 0.192 0.000
#> SRR925719      4  0.3569      0.885 0.196 0.000 0.000 0.804
#> SRR925720      4  0.3569      0.885 0.196 0.000 0.000 0.804
#> SRR925721      4  0.3569      0.885 0.196 0.000 0.000 0.804
#> SRR934634      1  0.3649      0.668 0.796 0.000 0.000 0.204
#> SRR934635      1  0.0188      0.927 0.996 0.000 0.000 0.004
#> SRR925723      3  0.0336      0.974 0.000 0.008 0.992 0.000
#> SRR925724      3  0.0336      0.977 0.000 0.008 0.992 0.000
#> SRR925725      3  0.0592      0.970 0.000 0.016 0.984 0.000
#> SRR925726      4  0.0000      0.850 0.000 0.000 0.000 1.000
#> SRR925727      3  0.0000      0.976 0.000 0.000 1.000 0.000
#> SRR925728      1  0.1004      0.912 0.972 0.024 0.000 0.004
#> SRR934636      1  0.4579      0.750 0.768 0.032 0.000 0.200
#> SRR934637      1  0.4164      0.726 0.736 0.000 0.000 0.264
#> SRR925729      3  0.3074      0.838 0.000 0.152 0.848 0.000
#> SRR934638      1  0.0188      0.927 0.996 0.000 0.000 0.004
#> SRR934639      4  0.3942      0.850 0.236 0.000 0.000 0.764
#> SRR934640      2  0.3123      0.886 0.000 0.844 0.156 0.000
#> SRR934641      2  0.3123      0.886 0.000 0.844 0.156 0.000
#> SRR925734      1  0.0188      0.927 0.996 0.000 0.000 0.004
#> SRR925735      3  0.0188      0.977 0.000 0.004 0.996 0.000
#> SRR925736      3  0.0336      0.977 0.000 0.008 0.992 0.000
#> SRR925737      3  0.0336      0.977 0.000 0.008 0.992 0.000
#> SRR934642      2  0.3528      0.873 0.000 0.808 0.192 0.000
#> SRR934643      2  0.4477      0.715 0.000 0.688 0.312 0.000
#> SRR934644      2  0.0592      0.852 0.000 0.984 0.016 0.000
#> SRR934645      2  0.0707      0.854 0.000 0.980 0.020 0.000
#> SRR925740      3  0.0336      0.977 0.000 0.008 0.992 0.000
#> SRR925741      3  0.0592      0.970 0.000 0.016 0.984 0.000
#> SRR925742      3  0.0188      0.977 0.000 0.004 0.996 0.000
#> SRR1283038     3  0.0921      0.962 0.000 0.028 0.972 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
#> SRR925687      4  0.0000     0.8133 0.000 0.000 0.000 1.000 0.000
#> SRR925688      4  0.0000     0.8133 0.000 0.000 0.000 1.000 0.000
#> SRR925689      1  0.0000     0.8622 1.000 0.000 0.000 0.000 0.000
#> SRR925690      1  0.0000     0.8622 1.000 0.000 0.000 0.000 0.000
#> SRR925691      1  0.0000     0.8622 1.000 0.000 0.000 0.000 0.000
#> SRR925692      1  0.0000     0.8622 1.000 0.000 0.000 0.000 0.000
#> SRR925693      3  0.0290     0.9605 0.000 0.008 0.992 0.000 0.000
#> SRR925694      2  0.0162     0.4371 0.000 0.996 0.004 0.000 0.000
#> SRR925695      3  0.0162     0.9556 0.000 0.004 0.996 0.000 0.000
#> SRR925697      4  0.4256     0.6228 0.000 0.000 0.000 0.564 0.436
#> SRR925696      3  0.0609     0.9616 0.000 0.020 0.980 0.000 0.000
#> SRR925698      3  0.0609     0.9616 0.000 0.020 0.980 0.000 0.000
#> SRR925699      2  0.2377     0.6202 0.000 0.872 0.128 0.000 0.000
#> SRR925700      2  0.2929     0.6521 0.000 0.820 0.180 0.000 0.000
#> SRR925701      2  0.2852     0.6503 0.000 0.828 0.172 0.000 0.000
#> SRR925702      4  0.0880     0.8076 0.032 0.000 0.000 0.968 0.000
#> SRR925703      4  0.4256     0.6228 0.000 0.000 0.000 0.564 0.436
#> SRR925704      3  0.0162     0.9556 0.000 0.004 0.996 0.000 0.000
#> SRR925705      3  0.0609     0.9616 0.000 0.020 0.980 0.000 0.000
#> SRR925706      4  0.3747     0.7600 0.044 0.000 0.060 0.844 0.052
#> SRR925708      4  0.0000     0.8133 0.000 0.000 0.000 1.000 0.000
#> SRR925707      2  0.6461     0.3081 0.004 0.492 0.172 0.332 0.000
#> SRR925709      1  0.3983     0.4848 0.660 0.000 0.000 0.340 0.000
#> SRR925710      4  0.2074     0.7800 0.104 0.000 0.000 0.896 0.000
#> SRR925711      3  0.0609     0.9616 0.000 0.020 0.980 0.000 0.000
#> SRR934631      5  0.4829     0.6553 0.000 0.480 0.020 0.000 0.500
#> SRR934632      5  0.4829     0.6553 0.000 0.480 0.020 0.000 0.500
#> SRR934633      5  0.5861     0.5822 0.000 0.400 0.100 0.000 0.500
#> SRR925713      4  0.0000     0.8133 0.000 0.000 0.000 1.000 0.000
#> SRR925714      4  0.4256     0.6228 0.000 0.000 0.000 0.564 0.436
#> SRR925715      4  0.2249     0.7790 0.096 0.000 0.008 0.896 0.000
#> SRR925716      4  0.4268     0.6158 0.000 0.000 0.000 0.556 0.444
#> SRR925717      4  0.1197     0.8100 0.000 0.000 0.000 0.952 0.048
#> SRR925718      2  0.2929     0.6521 0.000 0.820 0.180 0.000 0.000
#> SRR925719      4  0.0000     0.8133 0.000 0.000 0.000 1.000 0.000
#> SRR925720      4  0.1608     0.7924 0.072 0.000 0.000 0.928 0.000
#> SRR925721      4  0.3932     0.5157 0.328 0.000 0.000 0.672 0.000
#> SRR934634      1  0.2020     0.8081 0.900 0.000 0.000 0.100 0.000
#> SRR934635      1  0.2074     0.8069 0.896 0.000 0.000 0.104 0.000
#> SRR925723      3  0.0162     0.9593 0.000 0.004 0.996 0.000 0.000
#> SRR925724      3  0.0609     0.9616 0.000 0.020 0.980 0.000 0.000
#> SRR925725      3  0.0162     0.9556 0.000 0.004 0.996 0.000 0.000
#> SRR925726      4  0.3949     0.6682 0.000 0.000 0.000 0.668 0.332
#> SRR925727      3  0.0404     0.9613 0.000 0.012 0.988 0.000 0.000
#> SRR925728      2  0.6753     0.0946 0.268 0.392 0.000 0.340 0.000
#> SRR934636      5  0.6671    -0.1128 0.232 0.372 0.000 0.000 0.396
#> SRR934637      1  0.4718     0.4054 0.540 0.000 0.000 0.016 0.444
#> SRR925729      3  0.2605     0.8061 0.000 0.148 0.852 0.000 0.000
#> SRR934638      1  0.0609     0.8571 0.980 0.000 0.000 0.020 0.000
#> SRR934639      4  0.2773     0.7597 0.164 0.000 0.000 0.836 0.000
#> SRR934640      2  0.5972     0.2617 0.000 0.560 0.140 0.000 0.300
#> SRR934641      2  0.5770     0.3588 0.000 0.604 0.140 0.000 0.256
#> SRR925734      1  0.0290     0.8611 0.992 0.000 0.000 0.008 0.000
#> SRR925735      3  0.3720     0.6463 0.000 0.012 0.760 0.228 0.000
#> SRR925736      3  0.0609     0.9616 0.000 0.020 0.980 0.000 0.000
#> SRR925737      3  0.0609     0.9616 0.000 0.020 0.980 0.000 0.000
#> SRR934642      2  0.2929     0.6521 0.000 0.820 0.180 0.000 0.000
#> SRR934643      2  0.3796     0.5307 0.000 0.700 0.300 0.000 0.000
#> SRR934644      5  0.4452     0.6280 0.000 0.496 0.004 0.000 0.500
#> SRR934645      2  0.0290     0.4459 0.000 0.992 0.008 0.000 0.000
#> SRR925740      3  0.0609     0.9616 0.000 0.020 0.980 0.000 0.000
#> SRR925741      3  0.0162     0.9556 0.000 0.004 0.996 0.000 0.000
#> SRR925742      3  0.0510     0.9616 0.000 0.016 0.984 0.000 0.000
#> SRR1283038     3  0.0609     0.9442 0.000 0.020 0.980 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
#> SRR925687      4  0.0000     0.7829 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR925688      4  0.0000     0.7829 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR925689      1  0.0000     0.8819 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR925690      1  0.0000     0.8819 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR925691      1  0.0000     0.8819 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR925692      1  0.0000     0.8819 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR925693      3  0.1321     0.9330 0.000 0.004 0.952 0.000 0.020 0.024
#> SRR925694      2  0.2362     0.6287 0.000 0.860 0.004 0.000 0.000 0.136
#> SRR925695      3  0.1092     0.9331 0.000 0.000 0.960 0.000 0.020 0.020
#> SRR925697      4  0.3810     0.3208 0.000 0.000 0.000 0.572 0.428 0.000
#> SRR925696      3  0.0260     0.9383 0.000 0.008 0.992 0.000 0.000 0.000
#> SRR925698      3  0.1262     0.9336 0.000 0.008 0.956 0.000 0.020 0.016
#> SRR925699      2  0.2680     0.7102 0.000 0.860 0.108 0.000 0.000 0.032
#> SRR925700      2  0.2260     0.7163 0.000 0.860 0.140 0.000 0.000 0.000
#> SRR925701      2  0.2431     0.7170 0.000 0.860 0.132 0.000 0.000 0.008
#> SRR925702      4  0.1204     0.7680 0.056 0.000 0.000 0.944 0.000 0.000
#> SRR925703      4  0.3810     0.3208 0.000 0.000 0.000 0.572 0.428 0.000
#> SRR925704      3  0.1237     0.9329 0.000 0.004 0.956 0.000 0.020 0.020
#> SRR925705      3  0.0260     0.9383 0.000 0.008 0.992 0.000 0.000 0.000
#> SRR925706      4  0.4214     0.6620 0.060 0.000 0.064 0.784 0.092 0.000
#> SRR925708      4  0.0000     0.7829 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR925707      2  0.4769     0.3567 0.000 0.652 0.068 0.272 0.000 0.008
#> SRR925709      1  0.3288     0.4968 0.724 0.000 0.000 0.276 0.000 0.000
#> SRR925710      4  0.2416     0.6976 0.156 0.000 0.000 0.844 0.000 0.000
#> SRR925711      3  0.1124     0.9167 0.000 0.036 0.956 0.000 0.000 0.008
#> SRR934631      6  0.1265     0.9707 0.000 0.044 0.008 0.000 0.000 0.948
#> SRR934632      6  0.1265     0.9707 0.000 0.044 0.008 0.000 0.000 0.948
#> SRR934633      6  0.1265     0.9707 0.000 0.044 0.008 0.000 0.000 0.948
#> SRR925713      4  0.0000     0.7829 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR925714      4  0.3810     0.3208 0.000 0.000 0.000 0.572 0.428 0.000
#> SRR925715      4  0.3168     0.7038 0.024 0.120 0.008 0.840 0.000 0.008
#> SRR925716      5  0.3828    -0.2645 0.000 0.000 0.000 0.440 0.560 0.000
#> SRR925717      4  0.0937     0.7721 0.000 0.000 0.000 0.960 0.040 0.000
#> SRR925718      2  0.2300     0.7151 0.000 0.856 0.144 0.000 0.000 0.000
#> SRR925719      4  0.0000     0.7829 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR925720      4  0.0713     0.7758 0.028 0.000 0.000 0.972 0.000 0.000
#> SRR925721      4  0.3244     0.4986 0.268 0.000 0.000 0.732 0.000 0.000
#> SRR934634      1  0.2416     0.7501 0.844 0.000 0.000 0.156 0.000 0.000
#> SRR934635      1  0.2416     0.7501 0.844 0.000 0.000 0.156 0.000 0.000
#> SRR925723      3  0.0000     0.9379 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR925724      3  0.0405     0.9386 0.000 0.008 0.988 0.000 0.004 0.000
#> SRR925725      3  0.1092     0.9331 0.000 0.000 0.960 0.000 0.020 0.020
#> SRR925726      4  0.3266     0.5271 0.000 0.000 0.000 0.728 0.272 0.000
#> SRR925727      3  0.1003     0.9340 0.000 0.000 0.964 0.000 0.020 0.016
#> SRR925728      2  0.6682     0.1179 0.280 0.408 0.036 0.276 0.000 0.000
#> SRR934636      5  0.5264     0.0792 0.104 0.376 0.000 0.000 0.520 0.000
#> SRR934637      5  0.3955    -0.0051 0.436 0.000 0.000 0.004 0.560 0.000
#> SRR925729      3  0.4328     0.5913 0.000 0.212 0.708 0.000 0.000 0.080
#> SRR934638      1  0.0260     0.8796 0.992 0.000 0.000 0.008 0.000 0.000
#> SRR934639      4  0.2378     0.7221 0.152 0.000 0.000 0.848 0.000 0.000
#> SRR934640      2  0.5175     0.2146 0.000 0.492 0.000 0.000 0.420 0.088
#> SRR934641      2  0.5054     0.2338 0.000 0.504 0.000 0.000 0.420 0.076
#> SRR925734      1  0.0146     0.8812 0.996 0.000 0.000 0.004 0.000 0.000
#> SRR925735      3  0.5415     0.4712 0.000 0.192 0.612 0.188 0.000 0.008
#> SRR925736      3  0.0260     0.9383 0.000 0.008 0.992 0.000 0.000 0.000
#> SRR925737      3  0.0260     0.9383 0.000 0.008 0.992 0.000 0.000 0.000
#> SRR934642      2  0.2340     0.7130 0.000 0.852 0.148 0.000 0.000 0.000
#> SRR934643      2  0.2491     0.7029 0.000 0.836 0.164 0.000 0.000 0.000
#> SRR934644      6  0.2053     0.9094 0.000 0.108 0.004 0.000 0.000 0.888
#> SRR934645      2  0.2431     0.6332 0.000 0.860 0.008 0.000 0.000 0.132
#> SRR925740      3  0.0260     0.9383 0.000 0.008 0.992 0.000 0.000 0.000
#> SRR925741      3  0.1350     0.9315 0.000 0.008 0.952 0.000 0.020 0.020
#> SRR925742      3  0.0146     0.9384 0.000 0.004 0.996 0.000 0.000 0.000
#> SRR1283038     3  0.0632     0.9290 0.000 0.000 0.976 0.000 0.000 0.024

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

consensus_heatmap(res, k = 2)

plot of chunk tab-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 15949 rows and 64 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.999       0.999         0.5059 0.494   0.494
#> 3 3 0.751           0.950       0.918         0.2550 0.840   0.685
#> 4 4 0.874           0.917       0.930         0.1396 0.880   0.684
#> 5 5 0.871           0.884       0.910         0.0738 0.924   0.734
#> 6 6 0.782           0.654       0.823         0.0481 0.973   0.878

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
#> SRR925687      1  0.0000      1.000 1.000 0.000
#> SRR925688      1  0.0000      1.000 1.000 0.000
#> SRR925689      1  0.0000      1.000 1.000 0.000
#> SRR925690      1  0.0000      1.000 1.000 0.000
#> SRR925691      1  0.0000      1.000 1.000 0.000
#> SRR925692      1  0.0000      1.000 1.000 0.000
#> SRR925693      2  0.0376      0.998 0.004 0.996
#> SRR925694      2  0.0000      0.997 0.000 1.000
#> SRR925695      2  0.0376      0.998 0.004 0.996
#> SRR925697      1  0.0000      1.000 1.000 0.000
#> SRR925696      2  0.0376      0.998 0.004 0.996
#> SRR925698      2  0.0376      0.998 0.004 0.996
#> SRR925699      2  0.0000      0.997 0.000 1.000
#> SRR925700      2  0.0000      0.997 0.000 1.000
#> SRR925701      2  0.0000      0.997 0.000 1.000
#> SRR925702      1  0.0000      1.000 1.000 0.000
#> SRR925703      1  0.0000      1.000 1.000 0.000
#> SRR925704      2  0.0376      0.998 0.004 0.996
#> SRR925705      2  0.0376      0.998 0.004 0.996
#> SRR925706      1  0.0000      1.000 1.000 0.000
#> SRR925708      1  0.0000      1.000 1.000 0.000
#> SRR925707      2  0.0376      0.998 0.004 0.996
#> SRR925709      1  0.0000      1.000 1.000 0.000
#> SRR925710      1  0.0000      1.000 1.000 0.000
#> SRR925711      2  0.0376      0.998 0.004 0.996
#> SRR934631      2  0.0000      0.997 0.000 1.000
#> SRR934632      2  0.0000      0.997 0.000 1.000
#> SRR934633      2  0.0376      0.998 0.004 0.996
#> SRR925713      1  0.0000      1.000 1.000 0.000
#> SRR925714      1  0.0000      1.000 1.000 0.000
#> SRR925715      1  0.0000      1.000 1.000 0.000
#> SRR925716      1  0.0000      1.000 1.000 0.000
#> SRR925717      1  0.0000      1.000 1.000 0.000
#> SRR925718      2  0.0000      0.997 0.000 1.000
#> SRR925719      1  0.0000      1.000 1.000 0.000
#> SRR925720      1  0.0000      1.000 1.000 0.000
#> SRR925721      1  0.0000      1.000 1.000 0.000
#> SRR934634      1  0.0000      1.000 1.000 0.000
#> SRR934635      1  0.0000      1.000 1.000 0.000
#> SRR925723      2  0.0376      0.998 0.004 0.996
#> SRR925724      2  0.0376      0.998 0.004 0.996
#> SRR925725      2  0.0376      0.998 0.004 0.996
#> SRR925726      1  0.0000      1.000 1.000 0.000
#> SRR925727      2  0.0376      0.998 0.004 0.996
#> SRR925728      1  0.0000      1.000 1.000 0.000
#> SRR934636      1  0.0000      1.000 1.000 0.000
#> SRR934637      1  0.0000      1.000 1.000 0.000
#> SRR925729      2  0.0376      0.998 0.004 0.996
#> SRR934638      1  0.0000      1.000 1.000 0.000
#> SRR934639      1  0.0000      1.000 1.000 0.000
#> SRR934640      2  0.0000      0.997 0.000 1.000
#> SRR934641      2  0.0000      0.997 0.000 1.000
#> SRR925734      1  0.0000      1.000 1.000 0.000
#> SRR925735      2  0.0376      0.998 0.004 0.996
#> SRR925736      2  0.0376      0.998 0.004 0.996
#> SRR925737      2  0.0376      0.998 0.004 0.996
#> SRR934642      2  0.0000      0.997 0.000 1.000
#> SRR934643      2  0.0000      0.997 0.000 1.000
#> SRR934644      2  0.0000      0.997 0.000 1.000
#> SRR934645      2  0.0000      0.997 0.000 1.000
#> SRR925740      2  0.0376      0.998 0.004 0.996
#> SRR925741      2  0.0376      0.998 0.004 0.996
#> SRR925742      2  0.0376      0.998 0.004 0.996
#> SRR1283038     2  0.0376      0.998 0.004 0.996

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>            class entropy silhouette    p1    p2    p3
#> SRR925687      1   0.000      0.930 1.000 0.000 0.000
#> SRR925688      1   0.000      0.930 1.000 0.000 0.000
#> SRR925689      1   0.412      0.913 0.832 0.168 0.000
#> SRR925690      1   0.412      0.913 0.832 0.168 0.000
#> SRR925691      1   0.412      0.913 0.832 0.168 0.000
#> SRR925692      1   0.412      0.913 0.832 0.168 0.000
#> SRR925693      3   0.254      0.879 0.080 0.000 0.920
#> SRR925694      2   0.445      0.997 0.000 0.808 0.192
#> SRR925695      3   0.000      0.981 0.000 0.000 1.000
#> SRR925697      1   0.435      0.908 0.816 0.184 0.000
#> SRR925696      3   0.000      0.981 0.000 0.000 1.000
#> SRR925698      3   0.000      0.981 0.000 0.000 1.000
#> SRR925699      2   0.445      0.997 0.000 0.808 0.192
#> SRR925700      2   0.445      0.997 0.000 0.808 0.192
#> SRR925701      2   0.445      0.997 0.000 0.808 0.192
#> SRR925702      1   0.000      0.930 1.000 0.000 0.000
#> SRR925703      1   0.435      0.908 0.816 0.184 0.000
#> SRR925704      3   0.000      0.981 0.000 0.000 1.000
#> SRR925705      3   0.000      0.981 0.000 0.000 1.000
#> SRR925706      1   0.000      0.930 1.000 0.000 0.000
#> SRR925708      1   0.000      0.930 1.000 0.000 0.000
#> SRR925707      1   0.153      0.906 0.960 0.000 0.040
#> SRR925709      1   0.000      0.930 1.000 0.000 0.000
#> SRR925710      1   0.000      0.930 1.000 0.000 0.000
#> SRR925711      3   0.000      0.981 0.000 0.000 1.000
#> SRR934631      2   0.445      0.997 0.000 0.808 0.192
#> SRR934632      2   0.445      0.997 0.000 0.808 0.192
#> SRR934633      3   0.000      0.981 0.000 0.000 1.000
#> SRR925713      1   0.000      0.930 1.000 0.000 0.000
#> SRR925714      1   0.435      0.908 0.816 0.184 0.000
#> SRR925715      1   0.000      0.930 1.000 0.000 0.000
#> SRR925716      1   0.435      0.908 0.816 0.184 0.000
#> SRR925717      1   0.000      0.930 1.000 0.000 0.000
#> SRR925718      2   0.445      0.997 0.000 0.808 0.192
#> SRR925719      1   0.000      0.930 1.000 0.000 0.000
#> SRR925720      1   0.000      0.930 1.000 0.000 0.000
#> SRR925721      1   0.000      0.930 1.000 0.000 0.000
#> SRR934634      1   0.207      0.929 0.940 0.060 0.000
#> SRR934635      1   0.141      0.930 0.964 0.036 0.000
#> SRR925723      3   0.000      0.981 0.000 0.000 1.000
#> SRR925724      3   0.000      0.981 0.000 0.000 1.000
#> SRR925725      3   0.000      0.981 0.000 0.000 1.000
#> SRR925726      1   0.435      0.908 0.816 0.184 0.000
#> SRR925727      3   0.000      0.981 0.000 0.000 1.000
#> SRR925728      1   0.000      0.930 1.000 0.000 0.000
#> SRR934636      1   0.435      0.908 0.816 0.184 0.000
#> SRR934637      1   0.435      0.908 0.816 0.184 0.000
#> SRR925729      3   0.000      0.981 0.000 0.000 1.000
#> SRR934638      1   0.412      0.913 0.832 0.168 0.000
#> SRR934639      1   0.226      0.928 0.932 0.068 0.000
#> SRR934640      2   0.460      0.986 0.000 0.796 0.204
#> SRR934641      2   0.460      0.986 0.000 0.796 0.204
#> SRR925734      1   0.412      0.913 0.832 0.168 0.000
#> SRR925735      3   0.400      0.767 0.160 0.000 0.840
#> SRR925736      3   0.000      0.981 0.000 0.000 1.000
#> SRR925737      3   0.000      0.981 0.000 0.000 1.000
#> SRR934642      2   0.445      0.997 0.000 0.808 0.192
#> SRR934643      2   0.445      0.997 0.000 0.808 0.192
#> SRR934644      2   0.445      0.997 0.000 0.808 0.192
#> SRR934645      2   0.445      0.997 0.000 0.808 0.192
#> SRR925740      3   0.000      0.981 0.000 0.000 1.000
#> SRR925741      3   0.000      0.981 0.000 0.000 1.000
#> SRR925742      3   0.000      0.981 0.000 0.000 1.000
#> SRR1283038     3   0.000      0.981 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
#> SRR925687      1  0.0000      0.880 1.000 0.000 0.000 0.000
#> SRR925688      1  0.0000      0.880 1.000 0.000 0.000 0.000
#> SRR925689      1  0.4313      0.757 0.736 0.004 0.000 0.260
#> SRR925690      1  0.4313      0.757 0.736 0.004 0.000 0.260
#> SRR925691      1  0.4313      0.757 0.736 0.004 0.000 0.260
#> SRR925692      1  0.4313      0.757 0.736 0.004 0.000 0.260
#> SRR925693      3  0.0000      0.982 0.000 0.000 1.000 0.000
#> SRR925694      2  0.0336      0.968 0.000 0.992 0.008 0.000
#> SRR925695      3  0.0000      0.982 0.000 0.000 1.000 0.000
#> SRR925697      4  0.4134      1.000 0.260 0.000 0.000 0.740
#> SRR925696      3  0.0000      0.982 0.000 0.000 1.000 0.000
#> SRR925698      3  0.0000      0.982 0.000 0.000 1.000 0.000
#> SRR925699      2  0.0469      0.967 0.000 0.988 0.012 0.000
#> SRR925700      2  0.0336      0.968 0.000 0.992 0.008 0.000
#> SRR925701      2  0.0336      0.968 0.000 0.992 0.008 0.000
#> SRR925702      1  0.0188      0.879 0.996 0.004 0.000 0.000
#> SRR925703      4  0.4134      1.000 0.260 0.000 0.000 0.740
#> SRR925704      3  0.0000      0.982 0.000 0.000 1.000 0.000
#> SRR925705      3  0.0000      0.982 0.000 0.000 1.000 0.000
#> SRR925706      1  0.0188      0.879 0.996 0.004 0.000 0.000
#> SRR925708      1  0.0000      0.880 1.000 0.000 0.000 0.000
#> SRR925707      3  0.4343      0.541 0.264 0.004 0.732 0.000
#> SRR925709      1  0.0188      0.879 0.996 0.004 0.000 0.000
#> SRR925710      1  0.0188      0.879 0.996 0.004 0.000 0.000
#> SRR925711      3  0.0000      0.982 0.000 0.000 1.000 0.000
#> SRR934631      2  0.0336      0.968 0.000 0.992 0.008 0.000
#> SRR934632      2  0.0336      0.968 0.000 0.992 0.008 0.000
#> SRR934633      2  0.4222      0.645 0.000 0.728 0.272 0.000
#> SRR925713      1  0.0188      0.879 0.996 0.004 0.000 0.000
#> SRR925714      4  0.4134      1.000 0.260 0.000 0.000 0.740
#> SRR925715      1  0.0188      0.879 0.996 0.004 0.000 0.000
#> SRR925716      4  0.4134      1.000 0.260 0.000 0.000 0.740
#> SRR925717      1  0.0188      0.879 0.996 0.004 0.000 0.000
#> SRR925718      2  0.0921      0.955 0.000 0.972 0.028 0.000
#> SRR925719      1  0.0000      0.880 1.000 0.000 0.000 0.000
#> SRR925720      1  0.0000      0.880 1.000 0.000 0.000 0.000
#> SRR925721      1  0.0000      0.880 1.000 0.000 0.000 0.000
#> SRR934634      1  0.4134      0.759 0.740 0.000 0.000 0.260
#> SRR934635      1  0.2345      0.837 0.900 0.000 0.000 0.100
#> SRR925723      3  0.0000      0.982 0.000 0.000 1.000 0.000
#> SRR925724      3  0.0000      0.982 0.000 0.000 1.000 0.000
#> SRR925725      3  0.0000      0.982 0.000 0.000 1.000 0.000
#> SRR925726      4  0.4134      1.000 0.260 0.000 0.000 0.740
#> SRR925727      3  0.0000      0.982 0.000 0.000 1.000 0.000
#> SRR925728      1  0.0188      0.879 0.996 0.004 0.000 0.000
#> SRR934636      4  0.4134      1.000 0.260 0.000 0.000 0.740
#> SRR934637      4  0.4134      1.000 0.260 0.000 0.000 0.740
#> SRR925729      3  0.0000      0.982 0.000 0.000 1.000 0.000
#> SRR934638      1  0.4220      0.764 0.748 0.004 0.000 0.248
#> SRR934639      1  0.0000      0.880 1.000 0.000 0.000 0.000
#> SRR934640      2  0.0921      0.956 0.000 0.972 0.028 0.000
#> SRR934641      2  0.1118      0.949 0.000 0.964 0.036 0.000
#> SRR925734      1  0.4313      0.757 0.736 0.004 0.000 0.260
#> SRR925735      3  0.0188      0.977 0.004 0.000 0.996 0.000
#> SRR925736      3  0.0000      0.982 0.000 0.000 1.000 0.000
#> SRR925737      3  0.0000      0.982 0.000 0.000 1.000 0.000
#> SRR934642      2  0.0336      0.968 0.000 0.992 0.008 0.000
#> SRR934643      2  0.0469      0.967 0.000 0.988 0.012 0.000
#> SRR934644      2  0.0336      0.968 0.000 0.992 0.008 0.000
#> SRR934645      2  0.0336      0.968 0.000 0.992 0.008 0.000
#> SRR925740      3  0.0000      0.982 0.000 0.000 1.000 0.000
#> SRR925741      3  0.0000      0.982 0.000 0.000 1.000 0.000
#> SRR925742      3  0.0000      0.982 0.000 0.000 1.000 0.000
#> SRR1283038     3  0.0000      0.982 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
#> SRR925687      4  0.3013      0.824 0.008 0.000 0.000 0.832 0.160
#> SRR925688      4  0.0162      0.858 0.004 0.000 0.000 0.996 0.000
#> SRR925689      1  0.1043      0.917 0.960 0.000 0.000 0.040 0.000
#> SRR925690      1  0.1043      0.917 0.960 0.000 0.000 0.040 0.000
#> SRR925691      1  0.1043      0.917 0.960 0.000 0.000 0.040 0.000
#> SRR925692      1  0.1043      0.917 0.960 0.000 0.000 0.040 0.000
#> SRR925693      3  0.1300      0.929 0.016 0.000 0.956 0.000 0.028
#> SRR925694      2  0.0000      0.957 0.000 1.000 0.000 0.000 0.000
#> SRR925695      3  0.1830      0.921 0.040 0.000 0.932 0.000 0.028
#> SRR925697      5  0.3508      0.968 0.000 0.000 0.000 0.252 0.748
#> SRR925696      3  0.0451      0.939 0.004 0.000 0.988 0.000 0.008
#> SRR925698      3  0.0000      0.939 0.000 0.000 1.000 0.000 0.000
#> SRR925699      2  0.0162      0.958 0.000 0.996 0.004 0.000 0.000
#> SRR925700      2  0.0162      0.958 0.000 0.996 0.004 0.000 0.000
#> SRR925701      2  0.0162      0.958 0.000 0.996 0.004 0.000 0.000
#> SRR925702      4  0.0609      0.856 0.000 0.000 0.000 0.980 0.020
#> SRR925703      5  0.3508      0.968 0.000 0.000 0.000 0.252 0.748
#> SRR925704      3  0.1043      0.930 0.040 0.000 0.960 0.000 0.000
#> SRR925705      3  0.0290      0.939 0.000 0.000 0.992 0.000 0.008
#> SRR925706      4  0.2179      0.757 0.000 0.000 0.000 0.888 0.112
#> SRR925708      4  0.3013      0.824 0.008 0.000 0.000 0.832 0.160
#> SRR925707      3  0.4967      0.533 0.000 0.012 0.692 0.248 0.048
#> SRR925709      4  0.0162      0.858 0.000 0.000 0.000 0.996 0.004
#> SRR925710      4  0.0609      0.856 0.000 0.000 0.000 0.980 0.020
#> SRR925711      3  0.0162      0.938 0.000 0.004 0.996 0.000 0.000
#> SRR934631      2  0.0000      0.957 0.000 1.000 0.000 0.000 0.000
#> SRR934632      2  0.0000      0.957 0.000 1.000 0.000 0.000 0.000
#> SRR934633      3  0.3932      0.490 0.000 0.328 0.672 0.000 0.000
#> SRR925713      4  0.0609      0.856 0.000 0.000 0.000 0.980 0.020
#> SRR925714      5  0.3508      0.968 0.000 0.000 0.000 0.252 0.748
#> SRR925715      4  0.0609      0.856 0.000 0.000 0.000 0.980 0.020
#> SRR925716      5  0.3305      0.961 0.000 0.000 0.000 0.224 0.776
#> SRR925717      4  0.0609      0.856 0.000 0.000 0.000 0.980 0.020
#> SRR925718      2  0.0880      0.936 0.000 0.968 0.032 0.000 0.000
#> SRR925719      4  0.3013      0.824 0.008 0.000 0.000 0.832 0.160
#> SRR925720      4  0.3013      0.824 0.008 0.000 0.000 0.832 0.160
#> SRR925721      4  0.4916      0.714 0.124 0.000 0.000 0.716 0.160
#> SRR934634      1  0.2732      0.834 0.840 0.000 0.000 0.160 0.000
#> SRR934635      1  0.6031      0.536 0.576 0.000 0.000 0.244 0.180
#> SRR925723      3  0.0290      0.939 0.000 0.000 0.992 0.000 0.008
#> SRR925724      3  0.0000      0.939 0.000 0.000 1.000 0.000 0.000
#> SRR925725      3  0.1830      0.921 0.040 0.000 0.932 0.000 0.028
#> SRR925726      5  0.3508      0.968 0.000 0.000 0.000 0.252 0.748
#> SRR925727      3  0.1830      0.921 0.040 0.000 0.932 0.000 0.028
#> SRR925728      4  0.2561      0.707 0.000 0.000 0.000 0.856 0.144
#> SRR934636      5  0.3074      0.944 0.000 0.000 0.000 0.196 0.804
#> SRR934637      5  0.3074      0.944 0.000 0.000 0.000 0.196 0.804
#> SRR925729      3  0.0510      0.936 0.016 0.000 0.984 0.000 0.000
#> SRR934638      1  0.1792      0.898 0.916 0.000 0.000 0.084 0.000
#> SRR934639      4  0.3224      0.821 0.016 0.000 0.000 0.824 0.160
#> SRR934640      2  0.2813      0.785 0.000 0.832 0.168 0.000 0.000
#> SRR934641      2  0.2852      0.780 0.000 0.828 0.172 0.000 0.000
#> SRR925734      1  0.1043      0.917 0.960 0.000 0.000 0.040 0.000
#> SRR925735      3  0.2942      0.811 0.004 0.004 0.864 0.116 0.012
#> SRR925736      3  0.0290      0.939 0.000 0.000 0.992 0.000 0.008
#> SRR925737      3  0.0290      0.939 0.000 0.000 0.992 0.000 0.008
#> SRR934642      2  0.0162      0.958 0.000 0.996 0.004 0.000 0.000
#> SRR934643      2  0.0162      0.958 0.000 0.996 0.004 0.000 0.000
#> SRR934644      2  0.0000      0.957 0.000 1.000 0.000 0.000 0.000
#> SRR934645      2  0.0000      0.957 0.000 1.000 0.000 0.000 0.000
#> SRR925740      3  0.0290      0.939 0.000 0.000 0.992 0.000 0.008
#> SRR925741      3  0.1830      0.921 0.040 0.000 0.932 0.000 0.028
#> SRR925742      3  0.0290      0.939 0.000 0.000 0.992 0.000 0.008
#> SRR1283038     3  0.0290      0.939 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
#> SRR925687      4  0.2491    0.76524 0.164 0.000 0.000 0.836 0.000 0.000
#> SRR925688      4  0.3699    0.76561 0.160 0.000 0.000 0.788 0.040 0.012
#> SRR925689      1  0.0146    0.93708 0.996 0.000 0.000 0.004 0.000 0.000
#> SRR925690      1  0.0146    0.93708 0.996 0.000 0.000 0.004 0.000 0.000
#> SRR925691      1  0.0146    0.93708 0.996 0.000 0.000 0.004 0.000 0.000
#> SRR925692      1  0.0146    0.93708 0.996 0.000 0.000 0.004 0.000 0.000
#> SRR925693      6  0.3804    0.22225 0.000 0.000 0.424 0.000 0.000 0.576
#> SRR925694      2  0.0000    0.96679 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR925695      3  0.3756   -0.13986 0.000 0.000 0.600 0.000 0.000 0.400
#> SRR925697      5  0.3563    0.75342 0.000 0.000 0.000 0.336 0.664 0.000
#> SRR925696      3  0.2823    0.62178 0.000 0.000 0.796 0.000 0.000 0.204
#> SRR925698      3  0.0632    0.54066 0.000 0.000 0.976 0.000 0.000 0.024
#> SRR925699      2  0.0146    0.96697 0.004 0.996 0.000 0.000 0.000 0.000
#> SRR925700      2  0.0146    0.96697 0.004 0.996 0.000 0.000 0.000 0.000
#> SRR925701      2  0.0146    0.96697 0.004 0.996 0.000 0.000 0.000 0.000
#> SRR925702      4  0.1219    0.75534 0.000 0.000 0.000 0.948 0.048 0.004
#> SRR925703      5  0.3563    0.75342 0.000 0.000 0.000 0.336 0.664 0.000
#> SRR925704      3  0.1765    0.48367 0.000 0.000 0.904 0.000 0.000 0.096
#> SRR925705      3  0.3244    0.63051 0.000 0.000 0.732 0.000 0.000 0.268
#> SRR925706      4  0.3714    0.53026 0.000 0.000 0.000 0.760 0.196 0.044
#> SRR925708      4  0.2491    0.76524 0.164 0.000 0.000 0.836 0.000 0.000
#> SRR925707      6  0.7132   -0.40339 0.000 0.020 0.044 0.320 0.216 0.400
#> SRR925709      4  0.1767    0.76408 0.020 0.000 0.000 0.932 0.036 0.012
#> SRR925710      4  0.2384    0.73787 0.000 0.000 0.000 0.888 0.048 0.064
#> SRR925711      3  0.3852    0.30083 0.000 0.004 0.612 0.000 0.000 0.384
#> SRR934631      2  0.0000    0.96679 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR934632      2  0.0000    0.96679 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR934633      3  0.4361    0.29787 0.000 0.168 0.720 0.000 0.000 0.112
#> SRR925713      4  0.2136    0.74262 0.000 0.000 0.000 0.904 0.048 0.048
#> SRR925714      5  0.3563    0.75342 0.000 0.000 0.000 0.336 0.664 0.000
#> SRR925715      4  0.3088    0.70160 0.000 0.000 0.000 0.832 0.048 0.120
#> SRR925716      5  0.3101    0.74466 0.000 0.000 0.000 0.244 0.756 0.000
#> SRR925717      4  0.2070    0.74430 0.000 0.000 0.000 0.908 0.048 0.044
#> SRR925718      2  0.0146    0.96697 0.004 0.996 0.000 0.000 0.000 0.000
#> SRR925719      4  0.2491    0.76524 0.164 0.000 0.000 0.836 0.000 0.000
#> SRR925720      4  0.2632    0.76597 0.164 0.000 0.000 0.832 0.004 0.000
#> SRR925721      4  0.3126    0.68328 0.248 0.000 0.000 0.752 0.000 0.000
#> SRR934634      1  0.1556    0.88215 0.920 0.000 0.000 0.080 0.000 0.000
#> SRR934635      1  0.4475    0.61382 0.692 0.000 0.000 0.088 0.220 0.000
#> SRR925723      3  0.3244    0.63051 0.000 0.000 0.732 0.000 0.000 0.268
#> SRR925724      3  0.0146    0.55346 0.000 0.000 0.996 0.000 0.000 0.004
#> SRR925725      6  0.3867    0.12775 0.000 0.000 0.488 0.000 0.000 0.512
#> SRR925726      5  0.3563    0.75342 0.000 0.000 0.000 0.336 0.664 0.000
#> SRR925727      3  0.3782   -0.17045 0.000 0.000 0.588 0.000 0.000 0.412
#> SRR925728      4  0.4239    0.37618 0.000 0.000 0.000 0.696 0.248 0.056
#> SRR934636      5  0.0000    0.57202 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR934637      5  0.0000    0.57202 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR925729      3  0.3314    0.33034 0.000 0.012 0.764 0.000 0.000 0.224
#> SRR934638      1  0.0790    0.92335 0.968 0.000 0.000 0.032 0.000 0.000
#> SRR934639      4  0.2631    0.75370 0.180 0.000 0.000 0.820 0.000 0.000
#> SRR934640      2  0.2631    0.80067 0.000 0.820 0.000 0.000 0.000 0.180
#> SRR934641      2  0.2631    0.80067 0.000 0.820 0.000 0.000 0.000 0.180
#> SRR925734      1  0.0146    0.93708 0.996 0.000 0.000 0.004 0.000 0.000
#> SRR925735      3  0.4837    0.00164 0.000 0.000 0.564 0.032 0.016 0.388
#> SRR925736      3  0.3266    0.63084 0.000 0.000 0.728 0.000 0.000 0.272
#> SRR925737      3  0.3309    0.62542 0.000 0.000 0.720 0.000 0.000 0.280
#> SRR934642      2  0.0146    0.96697 0.004 0.996 0.000 0.000 0.000 0.000
#> SRR934643      2  0.0146    0.96697 0.004 0.996 0.000 0.000 0.000 0.000
#> SRR934644      2  0.0000    0.96679 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR934645      2  0.0000    0.96679 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR925740      3  0.3528    0.62687 0.000 0.004 0.700 0.000 0.000 0.296
#> SRR925741      3  0.3797   -0.19253 0.000 0.000 0.580 0.000 0.000 0.420
#> SRR925742      3  0.3244    0.63051 0.000 0.000 0.732 0.000 0.000 0.268
#> SRR1283038     3  0.3244    0.63051 0.000 0.000 0.732 0.000 0.000 0.268

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 15949 rows and 64 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.489           0.727       0.889         0.4974 0.504   0.504
#> 3 3 0.763           0.853       0.921         0.3174 0.793   0.602
#> 4 4 0.667           0.770       0.870         0.0829 0.912   0.747
#> 5 5 0.630           0.511       0.752         0.0963 0.915   0.708
#> 6 6 0.655           0.417       0.671         0.0501 0.858   0.492

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
#> SRR925687      1   0.000     0.8351 1.000 0.000
#> SRR925688      1   0.000     0.8351 1.000 0.000
#> SRR925689      1   0.985     0.3259 0.572 0.428
#> SRR925690      1   0.358     0.7967 0.932 0.068
#> SRR925691      1   0.529     0.7589 0.880 0.120
#> SRR925692      1   0.795     0.6394 0.760 0.240
#> SRR925693      1   0.969     0.2946 0.604 0.396
#> SRR925694      2   0.000     0.8925 0.000 1.000
#> SRR925695      1   0.971     0.2849 0.600 0.400
#> SRR925697      1   0.000     0.8351 1.000 0.000
#> SRR925696      2   0.518     0.8154 0.116 0.884
#> SRR925698      1   0.971     0.2849 0.600 0.400
#> SRR925699      2   0.000     0.8925 0.000 1.000
#> SRR925700      2   0.000     0.8925 0.000 1.000
#> SRR925701      2   0.000     0.8925 0.000 1.000
#> SRR925702      1   0.000     0.8351 1.000 0.000
#> SRR925703      1   0.000     0.8351 1.000 0.000
#> SRR925704      2   0.871     0.5952 0.292 0.708
#> SRR925705      2   0.388     0.8458 0.076 0.924
#> SRR925706      1   0.000     0.8351 1.000 0.000
#> SRR925708      1   0.000     0.8351 1.000 0.000
#> SRR925707      2   0.000     0.8925 0.000 1.000
#> SRR925709      1   0.000     0.8351 1.000 0.000
#> SRR925710      1   0.000     0.8351 1.000 0.000
#> SRR925711      2   0.788     0.6825 0.236 0.764
#> SRR934631      2   0.000     0.8925 0.000 1.000
#> SRR934632      2   0.000     0.8925 0.000 1.000
#> SRR934633      2   0.000     0.8925 0.000 1.000
#> SRR925713      1   0.000     0.8351 1.000 0.000
#> SRR925714      1   0.000     0.8351 1.000 0.000
#> SRR925715      1   0.000     0.8351 1.000 0.000
#> SRR925716      1   0.000     0.8351 1.000 0.000
#> SRR925717      1   0.000     0.8351 1.000 0.000
#> SRR925718      2   0.000     0.8925 0.000 1.000
#> SRR925719      1   0.000     0.8351 1.000 0.000
#> SRR925720      1   0.000     0.8351 1.000 0.000
#> SRR925721      1   0.000     0.8351 1.000 0.000
#> SRR934634      1   0.494     0.7688 0.892 0.108
#> SRR934635      1   0.000     0.8351 1.000 0.000
#> SRR925723      2   0.980     0.3187 0.416 0.584
#> SRR925724      1   0.995     0.0853 0.540 0.460
#> SRR925725      1   0.978     0.2500 0.588 0.412
#> SRR925726      1   0.000     0.8351 1.000 0.000
#> SRR925727      1   0.971     0.2849 0.600 0.400
#> SRR925728      1   0.118     0.8270 0.984 0.016
#> SRR934636      1   0.971     0.3842 0.600 0.400
#> SRR934637      1   0.000     0.8351 1.000 0.000
#> SRR925729      2   0.943     0.4580 0.360 0.640
#> SRR934638      1   0.943     0.4587 0.640 0.360
#> SRR934639      1   0.000     0.8351 1.000 0.000
#> SRR934640      2   0.000     0.8925 0.000 1.000
#> SRR934641      2   0.000     0.8925 0.000 1.000
#> SRR925734      1   0.775     0.6534 0.772 0.228
#> SRR925735      1   0.971     0.2849 0.600 0.400
#> SRR925736      2   0.584     0.7940 0.140 0.860
#> SRR925737      2   0.706     0.7378 0.192 0.808
#> SRR934642      2   0.000     0.8925 0.000 1.000
#> SRR934643      2   0.000     0.8925 0.000 1.000
#> SRR934644      2   0.000     0.8925 0.000 1.000
#> SRR934645      2   0.000     0.8925 0.000 1.000
#> SRR925740      2   0.000     0.8925 0.000 1.000
#> SRR925741      2   0.985     0.2842 0.428 0.572
#> SRR925742      2   0.000     0.8925 0.000 1.000
#> SRR1283038     2   0.000     0.8925 0.000 1.000

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>            class entropy silhouette    p1    p2    p3
#> SRR925687      1  0.0000     0.9583 1.000 0.000 0.000
#> SRR925688      1  0.0237     0.9556 0.996 0.000 0.004
#> SRR925689      1  0.0000     0.9583 1.000 0.000 0.000
#> SRR925690      1  0.0000     0.9583 1.000 0.000 0.000
#> SRR925691      1  0.0000     0.9583 1.000 0.000 0.000
#> SRR925692      1  0.0000     0.9583 1.000 0.000 0.000
#> SRR925693      3  0.4555     0.7690 0.000 0.200 0.800
#> SRR925694      2  0.0000     0.9535 0.000 1.000 0.000
#> SRR925695      3  0.4555     0.7690 0.000 0.200 0.800
#> SRR925697      3  0.1411     0.7683 0.036 0.000 0.964
#> SRR925696      2  0.1643     0.9170 0.000 0.956 0.044
#> SRR925698      3  0.4654     0.7654 0.000 0.208 0.792
#> SRR925699      2  0.0000     0.9535 0.000 1.000 0.000
#> SRR925700      2  0.0000     0.9535 0.000 1.000 0.000
#> SRR925701      2  0.0000     0.9535 0.000 1.000 0.000
#> SRR925702      1  0.3482     0.8809 0.872 0.000 0.128
#> SRR925703      3  0.0424     0.7779 0.008 0.000 0.992
#> SRR925704      3  0.6305     0.3022 0.000 0.484 0.516
#> SRR925705      2  0.0747     0.9432 0.000 0.984 0.016
#> SRR925706      3  0.3038     0.7276 0.104 0.000 0.896
#> SRR925708      1  0.0000     0.9583 1.000 0.000 0.000
#> SRR925707      2  0.0000     0.9535 0.000 1.000 0.000
#> SRR925709      1  0.0000     0.9583 1.000 0.000 0.000
#> SRR925710      3  0.4654     0.6944 0.208 0.000 0.792
#> SRR925711      2  0.2261     0.8882 0.000 0.932 0.068
#> SRR934631      2  0.0000     0.9535 0.000 1.000 0.000
#> SRR934632      2  0.0000     0.9535 0.000 1.000 0.000
#> SRR934633      2  0.0000     0.9535 0.000 1.000 0.000
#> SRR925713      3  0.1753     0.7775 0.048 0.000 0.952
#> SRR925714      3  0.0424     0.7779 0.008 0.000 0.992
#> SRR925715      3  0.3349     0.7609 0.108 0.004 0.888
#> SRR925716      1  0.4555     0.8279 0.800 0.000 0.200
#> SRR925717      3  0.1964     0.7744 0.056 0.000 0.944
#> SRR925718      2  0.0000     0.9535 0.000 1.000 0.000
#> SRR925719      1  0.0237     0.9566 0.996 0.000 0.004
#> SRR925720      1  0.0000     0.9583 1.000 0.000 0.000
#> SRR925721      1  0.0000     0.9583 1.000 0.000 0.000
#> SRR934634      1  0.0000     0.9583 1.000 0.000 0.000
#> SRR934635      1  0.0000     0.9583 1.000 0.000 0.000
#> SRR925723      2  0.6204    -0.0143 0.000 0.576 0.424
#> SRR925724      3  0.5835     0.6420 0.000 0.340 0.660
#> SRR925725      3  0.5988     0.5946 0.000 0.368 0.632
#> SRR925726      3  0.1529     0.7672 0.040 0.000 0.960
#> SRR925727      3  0.4750     0.7605 0.000 0.216 0.784
#> SRR925728      1  0.3752     0.8697 0.856 0.000 0.144
#> SRR934636      1  0.4555     0.8279 0.800 0.000 0.200
#> SRR934637      1  0.4555     0.8279 0.800 0.000 0.200
#> SRR925729      2  0.5397     0.4967 0.000 0.720 0.280
#> SRR934638      1  0.0000     0.9583 1.000 0.000 0.000
#> SRR934639      1  0.0000     0.9583 1.000 0.000 0.000
#> SRR934640      2  0.0000     0.9535 0.000 1.000 0.000
#> SRR934641      2  0.0000     0.9535 0.000 1.000 0.000
#> SRR925734      1  0.0000     0.9583 1.000 0.000 0.000
#> SRR925735      3  0.5810     0.6482 0.000 0.336 0.664
#> SRR925736      2  0.1289     0.9293 0.000 0.968 0.032
#> SRR925737      2  0.0424     0.9490 0.000 0.992 0.008
#> SRR934642      2  0.0000     0.9535 0.000 1.000 0.000
#> SRR934643      2  0.0000     0.9535 0.000 1.000 0.000
#> SRR934644      2  0.0000     0.9535 0.000 1.000 0.000
#> SRR934645      2  0.0000     0.9535 0.000 1.000 0.000
#> SRR925740      2  0.0000     0.9535 0.000 1.000 0.000
#> SRR925741      3  0.5785     0.6530 0.000 0.332 0.668
#> SRR925742      2  0.0000     0.9535 0.000 1.000 0.000
#> SRR1283038     2  0.0424     0.9490 0.000 0.992 0.008

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> SRR925687      1  0.0592      0.963 0.984 0.000 0.000 0.016
#> SRR925688      1  0.0804      0.961 0.980 0.000 0.008 0.012
#> SRR925689      1  0.0188      0.964 0.996 0.000 0.004 0.000
#> SRR925690      1  0.0188      0.964 0.996 0.000 0.004 0.000
#> SRR925691      1  0.0188      0.964 0.996 0.000 0.004 0.000
#> SRR925692      1  0.0188      0.964 0.996 0.000 0.004 0.000
#> SRR925693      3  0.0895      0.614 0.000 0.020 0.976 0.004
#> SRR925694      2  0.1411      0.885 0.000 0.960 0.020 0.020
#> SRR925695      3  0.2216      0.660 0.000 0.092 0.908 0.000
#> SRR925697      4  0.3105      0.695 0.004 0.000 0.140 0.856
#> SRR925696      2  0.2999      0.842 0.000 0.864 0.132 0.004
#> SRR925698      3  0.4228      0.655 0.000 0.232 0.760 0.008
#> SRR925699      2  0.0000      0.887 0.000 1.000 0.000 0.000
#> SRR925700      2  0.0524      0.887 0.000 0.988 0.004 0.008
#> SRR925701      2  0.0376      0.887 0.000 0.992 0.004 0.004
#> SRR925702      1  0.5167      0.432 0.644 0.000 0.016 0.340
#> SRR925703      4  0.4746      0.508 0.000 0.000 0.368 0.632
#> SRR925704      2  0.6087      0.258 0.000 0.540 0.412 0.048
#> SRR925705      2  0.3142      0.836 0.000 0.860 0.132 0.008
#> SRR925706      4  0.5297      0.365 0.004 0.004 0.444 0.548
#> SRR925708      1  0.0469      0.964 0.988 0.000 0.000 0.012
#> SRR925707      2  0.2227      0.881 0.000 0.928 0.036 0.036
#> SRR925709      1  0.1059      0.956 0.972 0.000 0.012 0.016
#> SRR925710      3  0.5400      0.343 0.372 0.000 0.608 0.020
#> SRR925711      2  0.4015      0.839 0.000 0.832 0.116 0.052
#> SRR934631      2  0.1820      0.882 0.000 0.944 0.020 0.036
#> SRR934632      2  0.1820      0.882 0.000 0.944 0.020 0.036
#> SRR934633      2  0.3176      0.863 0.000 0.880 0.036 0.084
#> SRR925713      3  0.4514      0.499 0.136 0.000 0.800 0.064
#> SRR925714      4  0.4941      0.395 0.000 0.000 0.436 0.564
#> SRR925715      3  0.4586      0.559 0.136 0.000 0.796 0.068
#> SRR925716      4  0.2737      0.738 0.104 0.000 0.008 0.888
#> SRR925717      3  0.5100      0.477 0.168 0.000 0.756 0.076
#> SRR925718      2  0.1151      0.886 0.000 0.968 0.008 0.024
#> SRR925719      1  0.0592      0.963 0.984 0.000 0.000 0.016
#> SRR925720      1  0.0817      0.959 0.976 0.000 0.000 0.024
#> SRR925721      1  0.0336      0.965 0.992 0.000 0.000 0.008
#> SRR934634      1  0.0000      0.964 1.000 0.000 0.000 0.000
#> SRR934635      1  0.0707      0.954 0.980 0.000 0.000 0.020
#> SRR925723      2  0.5024      0.432 0.000 0.632 0.360 0.008
#> SRR925724      3  0.4973      0.507 0.000 0.348 0.644 0.008
#> SRR925725      3  0.5900      0.616 0.000 0.260 0.664 0.076
#> SRR925726      3  0.4882      0.205 0.020 0.000 0.708 0.272
#> SRR925727      3  0.3494      0.673 0.000 0.172 0.824 0.004
#> SRR925728      4  0.2983      0.731 0.108 0.004 0.008 0.880
#> SRR934636      4  0.2647      0.730 0.120 0.000 0.000 0.880
#> SRR934637      4  0.2408      0.735 0.104 0.000 0.000 0.896
#> SRR925729      2  0.4818      0.711 0.000 0.748 0.216 0.036
#> SRR934638      1  0.0188      0.964 0.996 0.000 0.004 0.000
#> SRR934639      1  0.0469      0.964 0.988 0.000 0.000 0.012
#> SRR934640      2  0.3266      0.858 0.000 0.876 0.040 0.084
#> SRR934641      2  0.3266      0.858 0.000 0.876 0.040 0.084
#> SRR925734      1  0.0000      0.964 1.000 0.000 0.000 0.000
#> SRR925735      3  0.4423      0.671 0.000 0.168 0.792 0.040
#> SRR925736      2  0.3249      0.832 0.000 0.852 0.140 0.008
#> SRR925737      2  0.2048      0.879 0.000 0.928 0.064 0.008
#> SRR934642      2  0.0524      0.887 0.000 0.988 0.008 0.004
#> SRR934643      2  0.0524      0.887 0.000 0.988 0.008 0.004
#> SRR934644      2  0.1833      0.881 0.000 0.944 0.024 0.032
#> SRR934645      2  0.1624      0.883 0.000 0.952 0.020 0.028
#> SRR925740      2  0.1302      0.885 0.000 0.956 0.044 0.000
#> SRR925741      3  0.5900      0.615 0.000 0.260 0.664 0.076
#> SRR925742      2  0.1576      0.884 0.000 0.948 0.048 0.004
#> SRR1283038     2  0.2647      0.850 0.000 0.880 0.120 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
#> SRR925687      1  0.3143     0.8546 0.872 0.000 0.044 0.068 0.016
#> SRR925688      1  0.3651     0.8324 0.828 0.000 0.060 0.108 0.004
#> SRR925689      1  0.0566     0.8792 0.984 0.004 0.012 0.000 0.000
#> SRR925690      1  0.0404     0.8802 0.988 0.000 0.012 0.000 0.000
#> SRR925691      1  0.0404     0.8802 0.988 0.000 0.012 0.000 0.000
#> SRR925692      1  0.0404     0.8802 0.988 0.000 0.012 0.000 0.000
#> SRR925693      4  0.4297     0.2503 0.000 0.000 0.472 0.528 0.000
#> SRR925694      2  0.4299     0.2026 0.000 0.672 0.316 0.008 0.004
#> SRR925695      4  0.5371     0.2266 0.000 0.056 0.420 0.524 0.000
#> SRR925697      5  0.3074     0.7679 0.000 0.000 0.000 0.196 0.804
#> SRR925696      2  0.4477     0.5449 0.000 0.708 0.252 0.040 0.000
#> SRR925698      4  0.6693     0.1174 0.000 0.364 0.240 0.396 0.000
#> SRR925699      2  0.1282     0.5911 0.000 0.952 0.044 0.004 0.000
#> SRR925700      2  0.0693     0.6014 0.000 0.980 0.012 0.008 0.000
#> SRR925701      2  0.0290     0.6048 0.000 0.992 0.008 0.000 0.000
#> SRR925702      1  0.7235    -0.1421 0.376 0.000 0.020 0.264 0.340
#> SRR925703      5  0.4227     0.5197 0.000 0.000 0.000 0.420 0.580
#> SRR925704      3  0.4450     0.5587 0.000 0.132 0.760 0.108 0.000
#> SRR925705      2  0.4169     0.5569 0.000 0.732 0.240 0.028 0.000
#> SRR925706      5  0.5591     0.6862 0.008 0.020 0.040 0.304 0.628
#> SRR925708      1  0.0880     0.8799 0.968 0.000 0.000 0.032 0.000
#> SRR925707      2  0.6625     0.1749 0.004 0.592 0.144 0.036 0.224
#> SRR925709      1  0.4896     0.7047 0.716 0.000 0.044 0.220 0.020
#> SRR925710      4  0.5257     0.2462 0.264 0.000 0.076 0.656 0.004
#> SRR925711      3  0.4536     0.5553 0.000 0.240 0.712 0.048 0.000
#> SRR934631      2  0.4273    -0.1696 0.000 0.552 0.448 0.000 0.000
#> SRR934632      2  0.4268    -0.1574 0.000 0.556 0.444 0.000 0.000
#> SRR934633      3  0.4150     0.4752 0.000 0.388 0.612 0.000 0.000
#> SRR925713      4  0.3353     0.3269 0.104 0.000 0.020 0.852 0.024
#> SRR925714      4  0.4273    -0.3475 0.000 0.000 0.000 0.552 0.448
#> SRR925715      4  0.5992     0.2328 0.104 0.000 0.328 0.560 0.008
#> SRR925716      5  0.1892     0.7764 0.004 0.000 0.000 0.080 0.916
#> SRR925717      4  0.3883     0.3225 0.152 0.000 0.012 0.804 0.032
#> SRR925718      2  0.1173     0.6046 0.000 0.964 0.020 0.004 0.012
#> SRR925719      1  0.4351     0.7823 0.776 0.000 0.040 0.164 0.020
#> SRR925720      1  0.4368     0.7844 0.772 0.000 0.044 0.168 0.016
#> SRR925721      1  0.2649     0.8656 0.900 0.000 0.048 0.036 0.016
#> SRR934634      1  0.1579     0.8756 0.944 0.000 0.032 0.024 0.000
#> SRR934635      1  0.0740     0.8822 0.980 0.000 0.004 0.008 0.008
#> SRR925723      2  0.5354     0.4813 0.000 0.652 0.240 0.108 0.000
#> SRR925724      4  0.6717     0.1268 0.000 0.364 0.248 0.388 0.000
#> SRR925725      3  0.4268     0.5042 0.000 0.084 0.772 0.144 0.000
#> SRR925726      4  0.3719     0.1561 0.004 0.000 0.012 0.776 0.208
#> SRR925727      4  0.5252     0.3590 0.000 0.076 0.292 0.632 0.000
#> SRR925728      5  0.6250     0.7035 0.048 0.036 0.044 0.212 0.660
#> SRR934636      5  0.0833     0.7300 0.004 0.016 0.000 0.004 0.976
#> SRR934637      5  0.0000     0.7439 0.000 0.000 0.000 0.000 1.000
#> SRR925729      3  0.6615     0.4669 0.000 0.324 0.444 0.232 0.000
#> SRR934638      1  0.0671     0.8818 0.980 0.000 0.016 0.000 0.004
#> SRR934639      1  0.0613     0.8830 0.984 0.000 0.004 0.008 0.004
#> SRR934640      3  0.4602     0.5643 0.000 0.240 0.708 0.052 0.000
#> SRR934641      3  0.4602     0.5643 0.000 0.240 0.708 0.052 0.000
#> SRR925734      1  0.0290     0.8803 0.992 0.000 0.008 0.000 0.000
#> SRR925735      4  0.5421     0.1753 0.004 0.048 0.436 0.512 0.000
#> SRR925736      2  0.4674     0.5411 0.000 0.708 0.232 0.060 0.000
#> SRR925737      2  0.3663     0.5788 0.000 0.776 0.208 0.016 0.000
#> SRR934642      2  0.0162     0.6056 0.000 0.996 0.004 0.000 0.000
#> SRR934643      2  0.0404     0.6068 0.000 0.988 0.012 0.000 0.000
#> SRR934644      2  0.4542    -0.1563 0.000 0.536 0.456 0.008 0.000
#> SRR934645      2  0.4276     0.0582 0.004 0.616 0.380 0.000 0.000
#> SRR925740      2  0.3366     0.5841 0.000 0.768 0.232 0.000 0.000
#> SRR925741      3  0.4179     0.5007 0.000 0.072 0.776 0.152 0.000
#> SRR925742      2  0.3143     0.5866 0.000 0.796 0.204 0.000 0.000
#> SRR1283038     2  0.4984     0.4919 0.000 0.640 0.308 0.052 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
#> SRR925687      1  0.4488    0.70025 0.664 0.000 0.000 0.280 0.004 0.052
#> SRR925688      1  0.5318    0.61255 0.580 0.004 0.000 0.296 0.000 0.120
#> SRR925689      1  0.1370    0.77830 0.948 0.004 0.000 0.012 0.000 0.036
#> SRR925690      1  0.0993    0.78483 0.964 0.000 0.000 0.012 0.000 0.024
#> SRR925691      1  0.0993    0.78483 0.964 0.000 0.000 0.012 0.000 0.024
#> SRR925692      1  0.1074    0.78306 0.960 0.000 0.000 0.012 0.000 0.028
#> SRR925693      3  0.4493    0.29662 0.000 0.000 0.596 0.040 0.000 0.364
#> SRR925694      2  0.6626   -0.27720 0.004 0.388 0.304 0.020 0.000 0.284
#> SRR925695      3  0.4262    0.37507 0.000 0.012 0.724 0.048 0.000 0.216
#> SRR925697      5  0.4076    0.43644 0.000 0.000 0.004 0.348 0.636 0.012
#> SRR925696      2  0.3797    0.41540 0.000 0.580 0.420 0.000 0.000 0.000
#> SRR925698      3  0.6332   -0.05541 0.000 0.352 0.472 0.052 0.000 0.124
#> SRR925699      2  0.1461    0.62068 0.000 0.940 0.016 0.000 0.000 0.044
#> SRR925700      2  0.0748    0.63991 0.000 0.976 0.004 0.004 0.000 0.016
#> SRR925701      2  0.0622    0.64146 0.000 0.980 0.012 0.000 0.000 0.008
#> SRR925702      4  0.4215    0.33520 0.044 0.000 0.004 0.720 0.228 0.004
#> SRR925703      5  0.4919    0.27506 0.000 0.000 0.012 0.412 0.536 0.040
#> SRR925704      3  0.1485    0.36607 0.000 0.004 0.944 0.024 0.000 0.028
#> SRR925705      2  0.3878    0.53391 0.000 0.668 0.320 0.004 0.000 0.008
#> SRR925706      4  0.5046    0.35537 0.000 0.020 0.008 0.688 0.200 0.084
#> SRR925708      1  0.2664    0.70312 0.816 0.000 0.000 0.184 0.000 0.000
#> SRR925707      2  0.7590   -0.43876 0.000 0.356 0.032 0.332 0.072 0.208
#> SRR925709      4  0.4237   -0.00909 0.396 0.000 0.000 0.584 0.000 0.020
#> SRR925710      4  0.5165    0.46151 0.036 0.000 0.068 0.652 0.000 0.244
#> SRR925711      3  0.4145    0.20582 0.000 0.040 0.784 0.108 0.000 0.068
#> SRR934631      3  0.6053    0.04424 0.000 0.308 0.412 0.000 0.000 0.280
#> SRR934632      3  0.6059    0.04613 0.000 0.312 0.408 0.000 0.000 0.280
#> SRR934633      3  0.5351    0.02875 0.000 0.144 0.568 0.000 0.000 0.288
#> SRR925713      4  0.3647    0.47668 0.000 0.000 0.052 0.788 0.004 0.156
#> SRR925714      4  0.5816   -0.25144 0.000 0.000 0.028 0.444 0.436 0.092
#> SRR925715      4  0.5184   -0.08086 0.016 0.000 0.108 0.644 0.000 0.232
#> SRR925716      5  0.2006    0.66452 0.000 0.000 0.000 0.104 0.892 0.004
#> SRR925717      4  0.6615    0.35043 0.108 0.000 0.036 0.492 0.032 0.332
#> SRR925718      2  0.0692    0.64295 0.000 0.976 0.004 0.000 0.000 0.020
#> SRR925719      1  0.4264    0.37644 0.492 0.000 0.000 0.492 0.000 0.016
#> SRR925720      1  0.4743    0.56850 0.564 0.000 0.000 0.388 0.004 0.044
#> SRR925721      1  0.4223    0.73709 0.720 0.000 0.000 0.204 0.000 0.076
#> SRR934634      1  0.3139    0.77925 0.812 0.000 0.000 0.160 0.000 0.028
#> SRR934635      1  0.1643    0.79902 0.924 0.000 0.000 0.068 0.008 0.000
#> SRR925723      2  0.4627    0.32808 0.000 0.532 0.436 0.012 0.000 0.020
#> SRR925724      3  0.6076   -0.07820 0.000 0.364 0.484 0.036 0.000 0.116
#> SRR925725      3  0.0837    0.36606 0.000 0.004 0.972 0.004 0.000 0.020
#> SRR925726      4  0.6459    0.18300 0.000 0.000 0.036 0.468 0.200 0.296
#> SRR925727      3  0.5674    0.32618 0.000 0.068 0.548 0.044 0.000 0.340
#> SRR925728      4  0.5283    0.20578 0.004 0.016 0.000 0.580 0.336 0.064
#> SRR934636      5  0.0000    0.66244 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR934637      5  0.0000    0.66244 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR925729      3  0.6866   -0.04371 0.000 0.196 0.388 0.064 0.000 0.352
#> SRR934638      1  0.3309    0.78075 0.800 0.000 0.000 0.172 0.004 0.024
#> SRR934639      1  0.1349    0.79492 0.940 0.000 0.000 0.056 0.000 0.004
#> SRR934640      6  0.6747    0.98426 0.000 0.040 0.256 0.316 0.000 0.388
#> SRR934641      6  0.6690    0.98415 0.000 0.036 0.252 0.320 0.000 0.392
#> SRR925734      1  0.0260    0.79403 0.992 0.000 0.000 0.008 0.000 0.000
#> SRR925735      3  0.5127    0.30176 0.000 0.004 0.616 0.112 0.000 0.268
#> SRR925736      2  0.3398    0.59011 0.000 0.740 0.252 0.000 0.000 0.008
#> SRR925737      2  0.2748    0.63242 0.000 0.856 0.120 0.008 0.000 0.016
#> SRR934642      2  0.0909    0.64417 0.000 0.968 0.020 0.000 0.000 0.012
#> SRR934643      2  0.0858    0.64472 0.000 0.968 0.028 0.000 0.000 0.004
#> SRR934644      3  0.6293    0.03070 0.000 0.312 0.392 0.008 0.000 0.288
#> SRR934645      3  0.6351    0.03577 0.004 0.328 0.368 0.004 0.000 0.296
#> SRR925740      2  0.3578    0.53053 0.000 0.660 0.340 0.000 0.000 0.000
#> SRR925741      3  0.1307    0.35633 0.000 0.008 0.952 0.008 0.000 0.032
#> SRR925742      2  0.3101    0.59671 0.000 0.756 0.244 0.000 0.000 0.000
#> SRR1283038     3  0.4569   -0.15075 0.000 0.396 0.564 0.000 0.000 0.040

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

consensus_heatmap(res, k = 2)

plot of chunk tab-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 15949 rows and 64 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.935       0.971         0.4708 0.542   0.542
#> 3 3 0.899           0.901       0.949         0.4188 0.786   0.604
#> 4 4 0.798           0.807       0.848         0.0762 0.960   0.877
#> 5 5 0.772           0.684       0.821         0.0798 0.953   0.836
#> 6 6 0.767           0.579       0.753         0.0456 0.887   0.567

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
#> SRR925687      1  0.0672      0.955 0.992 0.008
#> SRR925688      1  0.3114      0.927 0.944 0.056
#> SRR925689      2  0.0000      1.000 0.000 1.000
#> SRR925690      2  0.0000      1.000 0.000 1.000
#> SRR925691      2  0.0000      1.000 0.000 1.000
#> SRR925692      2  0.0000      1.000 0.000 1.000
#> SRR925693      1  0.0000      0.956 1.000 0.000
#> SRR925694      2  0.0000      1.000 0.000 1.000
#> SRR925695      1  0.0000      0.956 1.000 0.000
#> SRR925697      1  0.0000      0.956 1.000 0.000
#> SRR925696      1  0.0376      0.956 0.996 0.004
#> SRR925698      1  0.0000      0.956 1.000 0.000
#> SRR925699      2  0.0000      1.000 0.000 1.000
#> SRR925700      2  0.0000      1.000 0.000 1.000
#> SRR925701      2  0.0000      1.000 0.000 1.000
#> SRR925702      1  0.2236      0.940 0.964 0.036
#> SRR925703      1  0.0000      0.956 1.000 0.000
#> SRR925704      1  0.0000      0.956 1.000 0.000
#> SRR925705      1  0.0672      0.955 0.992 0.008
#> SRR925706      1  0.0000      0.956 1.000 0.000
#> SRR925708      1  0.0672      0.955 0.992 0.008
#> SRR925707      1  0.9866      0.310 0.568 0.432
#> SRR925709      1  0.2236      0.940 0.964 0.036
#> SRR925710      1  0.0000      0.956 1.000 0.000
#> SRR925711      1  0.0000      0.956 1.000 0.000
#> SRR934631      2  0.0000      1.000 0.000 1.000
#> SRR934632      2  0.0000      1.000 0.000 1.000
#> SRR934633      1  0.3114      0.927 0.944 0.056
#> SRR925713      1  0.0000      0.956 1.000 0.000
#> SRR925714      1  0.0000      0.956 1.000 0.000
#> SRR925715      1  0.0000      0.956 1.000 0.000
#> SRR925716      1  0.2423      0.938 0.960 0.040
#> SRR925717      1  0.0000      0.956 1.000 0.000
#> SRR925718      2  0.0000      1.000 0.000 1.000
#> SRR925719      1  0.0672      0.955 0.992 0.008
#> SRR925720      1  0.0672      0.955 0.992 0.008
#> SRR925721      1  0.3114      0.927 0.944 0.056
#> SRR934634      2  0.0000      1.000 0.000 1.000
#> SRR934635      2  0.0000      1.000 0.000 1.000
#> SRR925723      1  0.0376      0.956 0.996 0.004
#> SRR925724      1  0.0000      0.956 1.000 0.000
#> SRR925725      1  0.0000      0.956 1.000 0.000
#> SRR925726      1  0.0000      0.956 1.000 0.000
#> SRR925727      1  0.0000      0.956 1.000 0.000
#> SRR925728      1  0.9833      0.332 0.576 0.424
#> SRR934636      2  0.0000      1.000 0.000 1.000
#> SRR934637      1  0.9993      0.150 0.516 0.484
#> SRR925729      1  0.0672      0.955 0.992 0.008
#> SRR934638      2  0.0000      1.000 0.000 1.000
#> SRR934639      1  0.0672      0.955 0.992 0.008
#> SRR934640      2  0.0000      1.000 0.000 1.000
#> SRR934641      2  0.0000      1.000 0.000 1.000
#> SRR925734      2  0.0000      1.000 0.000 1.000
#> SRR925735      1  0.0672      0.955 0.992 0.008
#> SRR925736      1  0.0672      0.955 0.992 0.008
#> SRR925737      1  0.0672      0.955 0.992 0.008
#> SRR934642      2  0.0000      1.000 0.000 1.000
#> SRR934643      2  0.0000      1.000 0.000 1.000
#> SRR934644      2  0.0000      1.000 0.000 1.000
#> SRR934645      2  0.0000      1.000 0.000 1.000
#> SRR925740      1  0.3114      0.927 0.944 0.056
#> SRR925741      1  0.0000      0.956 1.000 0.000
#> SRR925742      1  0.3114      0.927 0.944 0.056
#> SRR1283038     1  0.0672      0.955 0.992 0.008

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>            class entropy silhouette    p1    p2    p3
#> SRR925687      1  0.1753      0.895 0.952 0.000 0.048
#> SRR925688      1  0.0000      0.885 1.000 0.000 0.000
#> SRR925689      2  0.0000      0.986 0.000 1.000 0.000
#> SRR925690      2  0.1860      0.963 0.052 0.948 0.000
#> SRR925691      2  0.1860      0.963 0.052 0.948 0.000
#> SRR925692      2  0.1860      0.963 0.052 0.948 0.000
#> SRR925693      3  0.0000      0.959 0.000 0.000 1.000
#> SRR925694      2  0.0000      0.986 0.000 1.000 0.000
#> SRR925695      3  0.0000      0.959 0.000 0.000 1.000
#> SRR925697      3  0.0000      0.959 0.000 0.000 1.000
#> SRR925696      1  0.5216      0.646 0.740 0.000 0.260
#> SRR925698      3  0.0000      0.959 0.000 0.000 1.000
#> SRR925699      2  0.0000      0.986 0.000 1.000 0.000
#> SRR925700      2  0.0000      0.986 0.000 1.000 0.000
#> SRR925701      2  0.0000      0.986 0.000 1.000 0.000
#> SRR925702      1  0.0892      0.892 0.980 0.000 0.020
#> SRR925703      3  0.0000      0.959 0.000 0.000 1.000
#> SRR925704      3  0.4702      0.747 0.212 0.000 0.788
#> SRR925705      1  0.2066      0.888 0.940 0.000 0.060
#> SRR925706      3  0.2448      0.922 0.076 0.000 0.924
#> SRR925708      1  0.1753      0.895 0.952 0.000 0.048
#> SRR925707      1  0.6026      0.383 0.624 0.376 0.000
#> SRR925709      1  0.0892      0.892 0.980 0.000 0.020
#> SRR925710      3  0.2448      0.922 0.076 0.000 0.924
#> SRR925711      3  0.3038      0.895 0.104 0.000 0.896
#> SRR934631      2  0.0000      0.986 0.000 1.000 0.000
#> SRR934632      2  0.0000      0.986 0.000 1.000 0.000
#> SRR934633      1  0.0000      0.885 1.000 0.000 0.000
#> SRR925713      3  0.0000      0.959 0.000 0.000 1.000
#> SRR925714      3  0.0000      0.959 0.000 0.000 1.000
#> SRR925715      3  0.2448      0.922 0.076 0.000 0.924
#> SRR925716      1  0.0747      0.891 0.984 0.000 0.016
#> SRR925717      3  0.0000      0.959 0.000 0.000 1.000
#> SRR925718      2  0.0000      0.986 0.000 1.000 0.000
#> SRR925719      1  0.1753      0.895 0.952 0.000 0.048
#> SRR925720      1  0.1753      0.895 0.952 0.000 0.048
#> SRR925721      1  0.0000      0.885 1.000 0.000 0.000
#> SRR934634      2  0.0000      0.986 0.000 1.000 0.000
#> SRR934635      2  0.1860      0.963 0.052 0.948 0.000
#> SRR925723      1  0.5216      0.646 0.740 0.000 0.260
#> SRR925724      3  0.0000      0.959 0.000 0.000 1.000
#> SRR925725      3  0.0000      0.959 0.000 0.000 1.000
#> SRR925726      3  0.0000      0.959 0.000 0.000 1.000
#> SRR925727      3  0.0000      0.959 0.000 0.000 1.000
#> SRR925728      1  0.5988      0.401 0.632 0.368 0.000
#> SRR934636      2  0.0000      0.986 0.000 1.000 0.000
#> SRR934637      1  0.6215      0.241 0.572 0.428 0.000
#> SRR925729      1  0.1753      0.895 0.952 0.000 0.048
#> SRR934638      2  0.1860      0.963 0.052 0.948 0.000
#> SRR934639      1  0.1753      0.895 0.952 0.000 0.048
#> SRR934640      2  0.0000      0.986 0.000 1.000 0.000
#> SRR934641      2  0.0000      0.986 0.000 1.000 0.000
#> SRR925734      2  0.1860      0.963 0.052 0.948 0.000
#> SRR925735      1  0.1860      0.893 0.948 0.000 0.052
#> SRR925736      1  0.1753      0.895 0.952 0.000 0.048
#> SRR925737      1  0.1753      0.895 0.952 0.000 0.048
#> SRR934642      2  0.0000      0.986 0.000 1.000 0.000
#> SRR934643      2  0.0000      0.986 0.000 1.000 0.000
#> SRR934644      2  0.0000      0.986 0.000 1.000 0.000
#> SRR934645      2  0.0747      0.980 0.016 0.984 0.000
#> SRR925740      1  0.0000      0.885 1.000 0.000 0.000
#> SRR925741      3  0.2448      0.922 0.076 0.000 0.924
#> SRR925742      1  0.0000      0.885 1.000 0.000 0.000
#> SRR1283038     1  0.2066      0.888 0.940 0.000 0.060

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> SRR925687      1  0.0000      0.848 1.000 0.000 0.000 0.000
#> SRR925688      1  0.3400      0.797 0.820 0.000 0.180 0.000
#> SRR925689      2  0.1867      0.941 0.000 0.928 0.072 0.000
#> SRR925690      2  0.2868      0.916 0.000 0.864 0.136 0.000
#> SRR925691      2  0.2868      0.916 0.000 0.864 0.136 0.000
#> SRR925692      2  0.2868      0.916 0.000 0.864 0.136 0.000
#> SRR925693      3  0.4998      0.741 0.000 0.000 0.512 0.488
#> SRR925694      2  0.0000      0.956 0.000 1.000 0.000 0.000
#> SRR925695      3  0.5155      0.753 0.004 0.000 0.528 0.468
#> SRR925697      4  0.0000      0.829 0.000 0.000 0.000 1.000
#> SRR925696      1  0.4638      0.642 0.788 0.000 0.152 0.060
#> SRR925698      3  0.5151      0.754 0.004 0.000 0.532 0.464
#> SRR925699      2  0.0000      0.956 0.000 1.000 0.000 0.000
#> SRR925700      2  0.0000      0.956 0.000 1.000 0.000 0.000
#> SRR925701      2  0.0000      0.956 0.000 1.000 0.000 0.000
#> SRR925702      1  0.1716      0.839 0.936 0.000 0.064 0.000
#> SRR925703      4  0.0000      0.829 0.000 0.000 0.000 1.000
#> SRR925704      3  0.7039      0.443 0.256 0.000 0.568 0.176
#> SRR925705      1  0.0469      0.843 0.988 0.000 0.012 0.000
#> SRR925706      4  0.5012      0.660 0.116 0.000 0.112 0.772
#> SRR925708      1  0.0000      0.848 1.000 0.000 0.000 0.000
#> SRR925707      1  0.7733      0.316 0.440 0.304 0.256 0.000
#> SRR925709      1  0.1716      0.839 0.936 0.000 0.064 0.000
#> SRR925710      4  0.5012      0.660 0.116 0.000 0.112 0.772
#> SRR925711      3  0.5515      0.529 0.152 0.000 0.732 0.116
#> SRR934631      2  0.0000      0.956 0.000 1.000 0.000 0.000
#> SRR934632      2  0.0000      0.956 0.000 1.000 0.000 0.000
#> SRR934633      1  0.3356      0.799 0.824 0.000 0.176 0.000
#> SRR925713      4  0.0000      0.829 0.000 0.000 0.000 1.000
#> SRR925714      4  0.0000      0.829 0.000 0.000 0.000 1.000
#> SRR925715      4  0.5012      0.660 0.116 0.000 0.112 0.772
#> SRR925716      1  0.2011      0.835 0.920 0.000 0.080 0.000
#> SRR925717      4  0.0000      0.829 0.000 0.000 0.000 1.000
#> SRR925718      2  0.0000      0.956 0.000 1.000 0.000 0.000
#> SRR925719      1  0.0000      0.848 1.000 0.000 0.000 0.000
#> SRR925720      1  0.0000      0.848 1.000 0.000 0.000 0.000
#> SRR925721      1  0.3400      0.797 0.820 0.000 0.180 0.000
#> SRR934634      2  0.1716      0.943 0.000 0.936 0.064 0.000
#> SRR934635      2  0.2868      0.916 0.000 0.864 0.136 0.000
#> SRR925723      1  0.4638      0.642 0.788 0.000 0.152 0.060
#> SRR925724      3  0.5151      0.754 0.004 0.000 0.532 0.464
#> SRR925725      3  0.4998      0.741 0.000 0.000 0.512 0.488
#> SRR925726      4  0.0000      0.829 0.000 0.000 0.000 1.000
#> SRR925727      3  0.4998      0.741 0.000 0.000 0.512 0.488
#> SRR925728      1  0.7683      0.331 0.452 0.304 0.244 0.000
#> SRR934636      2  0.1716      0.943 0.000 0.936 0.064 0.000
#> SRR934637      1  0.7843      0.176 0.388 0.344 0.268 0.000
#> SRR925729      1  0.0000      0.848 1.000 0.000 0.000 0.000
#> SRR934638      2  0.2868      0.916 0.000 0.864 0.136 0.000
#> SRR934639      1  0.0000      0.848 1.000 0.000 0.000 0.000
#> SRR934640      2  0.0000      0.956 0.000 1.000 0.000 0.000
#> SRR934641      2  0.0000      0.956 0.000 1.000 0.000 0.000
#> SRR925734      2  0.2868      0.916 0.000 0.864 0.136 0.000
#> SRR925735      1  0.0188      0.846 0.996 0.000 0.004 0.000
#> SRR925736      1  0.0000      0.848 1.000 0.000 0.000 0.000
#> SRR925737      1  0.0000      0.848 1.000 0.000 0.000 0.000
#> SRR934642      2  0.0000      0.956 0.000 1.000 0.000 0.000
#> SRR934643      2  0.0000      0.956 0.000 1.000 0.000 0.000
#> SRR934644      2  0.0000      0.956 0.000 1.000 0.000 0.000
#> SRR934645      2  0.0921      0.950 0.000 0.972 0.028 0.000
#> SRR925740      1  0.3356      0.799 0.824 0.000 0.176 0.000
#> SRR925741      3  0.6278      0.585 0.120 0.000 0.652 0.228
#> SRR925742      1  0.3356      0.799 0.824 0.000 0.176 0.000
#> SRR1283038     1  0.0469      0.843 0.988 0.000 0.012 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
#> SRR925687      4  0.1043     0.7935 0.040 0.000 0.000 0.960 0.000
#> SRR925688      1  0.5443     0.0585 0.516 0.036 0.012 0.436 0.000
#> SRR925689      2  0.1478     0.6296 0.064 0.936 0.000 0.000 0.000
#> SRR925690      2  0.0000     0.5859 0.000 1.000 0.000 0.000 0.000
#> SRR925691      2  0.0000     0.5859 0.000 1.000 0.000 0.000 0.000
#> SRR925692      2  0.0000     0.5859 0.000 1.000 0.000 0.000 0.000
#> SRR925693      3  0.4150     0.7915 0.000 0.000 0.612 0.000 0.388
#> SRR925694      2  0.4302     0.7884 0.480 0.520 0.000 0.000 0.000
#> SRR925695      3  0.4238     0.8005 0.000 0.000 0.628 0.004 0.368
#> SRR925697      5  0.0000     0.8563 0.000 0.000 0.000 0.000 1.000
#> SRR925696      4  0.4400     0.5806 0.000 0.000 0.212 0.736 0.052
#> SRR925698      3  0.4225     0.8016 0.000 0.000 0.632 0.004 0.364
#> SRR925699      2  0.4302     0.7884 0.480 0.520 0.000 0.000 0.000
#> SRR925700      2  0.4302     0.7884 0.480 0.520 0.000 0.000 0.000
#> SRR925701      2  0.4302     0.7884 0.480 0.520 0.000 0.000 0.000
#> SRR925702      4  0.2526     0.7596 0.080 0.012 0.012 0.896 0.000
#> SRR925703      5  0.0000     0.8563 0.000 0.000 0.000 0.000 1.000
#> SRR925704      3  0.5180     0.5025 0.000 0.000 0.684 0.196 0.120
#> SRR925705      4  0.3039     0.6953 0.152 0.000 0.012 0.836 0.000
#> SRR925706      5  0.4234     0.7138 0.000 0.000 0.184 0.056 0.760
#> SRR925708      4  0.1043     0.7935 0.040 0.000 0.000 0.960 0.000
#> SRR925707      1  0.5628     0.6575 0.516 0.420 0.008 0.056 0.000
#> SRR925709      4  0.2526     0.7596 0.080 0.012 0.012 0.896 0.000
#> SRR925710      5  0.4234     0.7138 0.000 0.000 0.184 0.056 0.760
#> SRR925711      3  0.0566     0.5831 0.004 0.000 0.984 0.012 0.000
#> SRR934631      2  0.4302     0.7884 0.480 0.520 0.000 0.000 0.000
#> SRR934632      2  0.4302     0.7884 0.480 0.520 0.000 0.000 0.000
#> SRR934633      4  0.5372     0.1161 0.392 0.036 0.012 0.560 0.000
#> SRR925713      5  0.0000     0.8563 0.000 0.000 0.000 0.000 1.000
#> SRR925714      5  0.0000     0.8563 0.000 0.000 0.000 0.000 1.000
#> SRR925715      5  0.4234     0.7138 0.000 0.000 0.184 0.056 0.760
#> SRR925716      4  0.3653     0.6861 0.164 0.016 0.012 0.808 0.000
#> SRR925717      5  0.0000     0.8563 0.000 0.000 0.000 0.000 1.000
#> SRR925718      2  0.4302     0.7884 0.480 0.520 0.000 0.000 0.000
#> SRR925719      4  0.1043     0.7935 0.040 0.000 0.000 0.960 0.000
#> SRR925720      4  0.1043     0.7935 0.040 0.000 0.000 0.960 0.000
#> SRR925721      1  0.5443     0.0585 0.516 0.036 0.012 0.436 0.000
#> SRR934634      2  0.1608     0.6343 0.072 0.928 0.000 0.000 0.000
#> SRR934635      2  0.0000     0.5859 0.000 1.000 0.000 0.000 0.000
#> SRR925723      4  0.4400     0.5806 0.000 0.000 0.212 0.736 0.052
#> SRR925724      3  0.4225     0.8016 0.000 0.000 0.632 0.004 0.364
#> SRR925725      3  0.4150     0.7915 0.000 0.000 0.612 0.000 0.388
#> SRR925726      5  0.0000     0.8563 0.000 0.000 0.000 0.000 1.000
#> SRR925727      3  0.4150     0.7915 0.000 0.000 0.612 0.000 0.388
#> SRR925728      1  0.5868     0.6562 0.512 0.408 0.012 0.068 0.000
#> SRR934636      2  0.1608     0.6343 0.072 0.928 0.000 0.000 0.000
#> SRR934637      1  0.4448     0.6097 0.516 0.480 0.000 0.004 0.000
#> SRR925729      4  0.0000     0.7913 0.000 0.000 0.000 1.000 0.000
#> SRR934638      2  0.0000     0.5859 0.000 1.000 0.000 0.000 0.000
#> SRR934639      4  0.1043     0.7935 0.040 0.000 0.000 0.960 0.000
#> SRR934640      2  0.4302     0.7884 0.480 0.520 0.000 0.000 0.000
#> SRR934641      2  0.4302     0.7884 0.480 0.520 0.000 0.000 0.000
#> SRR925734      2  0.0000     0.5859 0.000 1.000 0.000 0.000 0.000
#> SRR925735      4  0.0162     0.7908 0.000 0.000 0.004 0.996 0.000
#> SRR925736      4  0.0000     0.7913 0.000 0.000 0.000 1.000 0.000
#> SRR925737      4  0.0000     0.7913 0.000 0.000 0.000 1.000 0.000
#> SRR934642      2  0.4302     0.7884 0.480 0.520 0.000 0.000 0.000
#> SRR934643      2  0.4302     0.7884 0.480 0.520 0.000 0.000 0.000
#> SRR934644      2  0.4302     0.7884 0.480 0.520 0.000 0.000 0.000
#> SRR934645      2  0.4278     0.7775 0.452 0.548 0.000 0.000 0.000
#> SRR925740      4  0.5363     0.1298 0.388 0.036 0.012 0.564 0.000
#> SRR925741      3  0.3641     0.6443 0.000 0.000 0.820 0.060 0.120
#> SRR925742      4  0.5363     0.1298 0.388 0.036 0.012 0.564 0.000
#> SRR1283038     4  0.3039     0.6953 0.152 0.000 0.012 0.836 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
#> SRR925687      4  0.0000     0.6350 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR925688      4  0.5748     0.0923 0.360 0.000 0.000 0.464 0.000 0.176
#> SRR925689      2  0.3789    -0.1119 0.416 0.584 0.000 0.000 0.000 0.000
#> SRR925690      1  0.3706     0.5699 0.620 0.380 0.000 0.000 0.000 0.000
#> SRR925691      1  0.3706     0.5699 0.620 0.380 0.000 0.000 0.000 0.000
#> SRR925692      1  0.3706     0.5699 0.620 0.380 0.000 0.000 0.000 0.000
#> SRR925693      3  0.3515     0.7801 0.000 0.000 0.676 0.000 0.324 0.000
#> SRR925694      2  0.0000     0.8358 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR925695      3  0.3565     0.7888 0.000 0.000 0.692 0.004 0.304 0.000
#> SRR925697      5  0.0000     0.8429 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR925696      6  0.6122     0.4795 0.000 0.000 0.260 0.304 0.004 0.432
#> SRR925698      3  0.3547     0.7894 0.000 0.000 0.696 0.004 0.300 0.000
#> SRR925699      2  0.0458     0.8355 0.016 0.984 0.000 0.000 0.000 0.000
#> SRR925700      2  0.0458     0.8355 0.016 0.984 0.000 0.000 0.000 0.000
#> SRR925701      2  0.0000     0.8358 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR925702      4  0.1327     0.6112 0.000 0.000 0.000 0.936 0.000 0.064
#> SRR925703      5  0.0000     0.8429 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR925704      3  0.4466     0.5052 0.000 0.000 0.760 0.108 0.044 0.088
#> SRR925705      6  0.5981     0.5065 0.156 0.000 0.012 0.396 0.000 0.436
#> SRR925706      5  0.4239     0.6781 0.000 0.000 0.248 0.056 0.696 0.000
#> SRR925708      4  0.0000     0.6350 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR925707      1  0.3948     0.2383 0.748 0.000 0.000 0.064 0.000 0.188
#> SRR925709      4  0.1327     0.6112 0.000 0.000 0.000 0.936 0.000 0.064
#> SRR925710      5  0.4239     0.6781 0.000 0.000 0.248 0.056 0.696 0.000
#> SRR925711      3  0.4552     0.4083 0.040 0.000 0.572 0.000 0.000 0.388
#> SRR934631      2  0.0000     0.8358 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR934632      2  0.0000     0.8358 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR934633      6  0.5103     0.5984 0.276 0.000 0.000 0.120 0.000 0.604
#> SRR925713      5  0.0000     0.8429 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR925714      5  0.0000     0.8429 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR925715      5  0.4239     0.6781 0.000 0.000 0.248 0.056 0.696 0.000
#> SRR925716      4  0.3068     0.5388 0.088 0.000 0.000 0.840 0.000 0.072
#> SRR925717      5  0.0146     0.8391 0.000 0.000 0.004 0.000 0.996 0.000
#> SRR925718      2  0.0458     0.8355 0.016 0.984 0.000 0.000 0.000 0.000
#> SRR925719      4  0.0000     0.6350 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR925720      4  0.0000     0.6350 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR925721      4  0.5748     0.0923 0.360 0.000 0.000 0.464 0.000 0.176
#> SRR934634      2  0.3774    -0.0797 0.408 0.592 0.000 0.000 0.000 0.000
#> SRR934635      1  0.3706     0.5699 0.620 0.380 0.000 0.000 0.000 0.000
#> SRR925723      6  0.6122     0.4795 0.000 0.000 0.260 0.304 0.004 0.432
#> SRR925724      3  0.3547     0.7894 0.000 0.000 0.696 0.004 0.300 0.000
#> SRR925725      3  0.3515     0.7801 0.000 0.000 0.676 0.000 0.324 0.000
#> SRR925726      5  0.0000     0.8429 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR925727      3  0.3515     0.7801 0.000 0.000 0.676 0.000 0.324 0.000
#> SRR925728      1  0.4114     0.2147 0.732 0.000 0.000 0.072 0.000 0.196
#> SRR934636      2  0.3774    -0.0797 0.408 0.592 0.000 0.000 0.000 0.000
#> SRR934637      1  0.3202     0.3142 0.816 0.000 0.000 0.040 0.000 0.144
#> SRR925729      4  0.3659     0.0802 0.000 0.000 0.000 0.636 0.000 0.364
#> SRR934638      1  0.3706     0.5699 0.620 0.380 0.000 0.000 0.000 0.000
#> SRR934639      4  0.0000     0.6350 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR934640      2  0.1444     0.7955 0.072 0.928 0.000 0.000 0.000 0.000
#> SRR934641      2  0.1444     0.7955 0.072 0.928 0.000 0.000 0.000 0.000
#> SRR925734      1  0.3706     0.5699 0.620 0.380 0.000 0.000 0.000 0.000
#> SRR925735      4  0.3795     0.0709 0.000 0.000 0.004 0.632 0.000 0.364
#> SRR925736      4  0.3659     0.0802 0.000 0.000 0.000 0.636 0.000 0.364
#> SRR925737      4  0.3659     0.0802 0.000 0.000 0.000 0.636 0.000 0.364
#> SRR934642      2  0.0000     0.8358 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR934643      2  0.0458     0.8355 0.016 0.984 0.000 0.000 0.000 0.000
#> SRR934644      2  0.0000     0.8358 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR934645      2  0.2527     0.6742 0.168 0.832 0.000 0.000 0.000 0.000
#> SRR925740      6  0.5138     0.6013 0.276 0.000 0.000 0.124 0.000 0.600
#> SRR925741      3  0.2258     0.6208 0.000 0.000 0.896 0.060 0.044 0.000
#> SRR925742      6  0.5138     0.6013 0.276 0.000 0.000 0.124 0.000 0.600
#> SRR1283038     6  0.5981     0.5065 0.156 0.000 0.012 0.396 0.000 0.436

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

consensus_heatmap(res, k = 2)

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

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

collect_plots(res)

plot of chunk ATC-kmeans-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 1.000           0.979       0.990         0.4808 0.524   0.524
#> 3 3 0.999           0.967       0.975         0.4060 0.760   0.558
#> 4 4 0.676           0.630       0.772         0.0970 0.975   0.922
#> 5 5 0.697           0.540       0.716         0.0651 0.821   0.467
#> 6 6 0.731           0.733       0.779         0.0451 0.912   0.600

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
#> SRR925687      1   0.000      0.983 1.000 0.000
#> SRR925688      1   0.000      0.983 1.000 0.000
#> SRR925689      2   0.000      1.000 0.000 1.000
#> SRR925690      2   0.000      1.000 0.000 1.000
#> SRR925691      2   0.000      1.000 0.000 1.000
#> SRR925692      2   0.000      1.000 0.000 1.000
#> SRR925693      1   0.000      0.983 1.000 0.000
#> SRR925694      2   0.000      1.000 0.000 1.000
#> SRR925695      1   0.000      0.983 1.000 0.000
#> SRR925697      1   0.000      0.983 1.000 0.000
#> SRR925696      1   0.000      0.983 1.000 0.000
#> SRR925698      1   0.000      0.983 1.000 0.000
#> SRR925699      2   0.000      1.000 0.000 1.000
#> SRR925700      2   0.000      1.000 0.000 1.000
#> SRR925701      2   0.000      1.000 0.000 1.000
#> SRR925702      1   0.000      0.983 1.000 0.000
#> SRR925703      1   0.000      0.983 1.000 0.000
#> SRR925704      1   0.000      0.983 1.000 0.000
#> SRR925705      1   0.000      0.983 1.000 0.000
#> SRR925706      1   0.000      0.983 1.000 0.000
#> SRR925708      1   0.000      0.983 1.000 0.000
#> SRR925707      2   0.000      1.000 0.000 1.000
#> SRR925709      1   0.000      0.983 1.000 0.000
#> SRR925710      1   0.000      0.983 1.000 0.000
#> SRR925711      1   0.000      0.983 1.000 0.000
#> SRR934631      2   0.000      1.000 0.000 1.000
#> SRR934632      2   0.000      1.000 0.000 1.000
#> SRR934633      1   0.722      0.767 0.800 0.200
#> SRR925713      1   0.000      0.983 1.000 0.000
#> SRR925714      1   0.000      0.983 1.000 0.000
#> SRR925715      1   0.000      0.983 1.000 0.000
#> SRR925716      1   0.388      0.914 0.924 0.076
#> SRR925717      1   0.000      0.983 1.000 0.000
#> SRR925718      2   0.000      1.000 0.000 1.000
#> SRR925719      1   0.000      0.983 1.000 0.000
#> SRR925720      1   0.000      0.983 1.000 0.000
#> SRR925721      1   0.000      0.983 1.000 0.000
#> SRR934634      2   0.000      1.000 0.000 1.000
#> SRR934635      2   0.000      1.000 0.000 1.000
#> SRR925723      1   0.000      0.983 1.000 0.000
#> SRR925724      1   0.000      0.983 1.000 0.000
#> SRR925725      1   0.000      0.983 1.000 0.000
#> SRR925726      1   0.000      0.983 1.000 0.000
#> SRR925727      1   0.000      0.983 1.000 0.000
#> SRR925728      1   0.714      0.773 0.804 0.196
#> SRR934636      2   0.000      1.000 0.000 1.000
#> SRR934637      2   0.000      1.000 0.000 1.000
#> SRR925729      1   0.000      0.983 1.000 0.000
#> SRR934638      2   0.000      1.000 0.000 1.000
#> SRR934639      1   0.000      0.983 1.000 0.000
#> SRR934640      2   0.000      1.000 0.000 1.000
#> SRR934641      2   0.000      1.000 0.000 1.000
#> SRR925734      2   0.000      1.000 0.000 1.000
#> SRR925735      1   0.000      0.983 1.000 0.000
#> SRR925736      1   0.000      0.983 1.000 0.000
#> SRR925737      1   0.000      0.983 1.000 0.000
#> SRR934642      2   0.000      1.000 0.000 1.000
#> SRR934643      2   0.000      1.000 0.000 1.000
#> SRR934644      2   0.000      1.000 0.000 1.000
#> SRR934645      2   0.000      1.000 0.000 1.000
#> SRR925740      1   0.000      0.983 1.000 0.000
#> SRR925741      1   0.000      0.983 1.000 0.000
#> SRR925742      1   0.680      0.794 0.820 0.180
#> SRR1283038     1   0.000      0.983 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
#> SRR925687      1  0.0000      0.968 1.000 0.000 0.000
#> SRR925688      1  0.0000      0.968 1.000 0.000 0.000
#> SRR925689      2  0.0592      0.989 0.012 0.988 0.000
#> SRR925690      2  0.1753      0.958 0.048 0.952 0.000
#> SRR925691      2  0.1753      0.958 0.048 0.952 0.000
#> SRR925692      2  0.0592      0.989 0.012 0.988 0.000
#> SRR925693      3  0.0000      0.962 0.000 0.000 1.000
#> SRR925694      2  0.0000      0.992 0.000 1.000 0.000
#> SRR925695      3  0.0000      0.962 0.000 0.000 1.000
#> SRR925697      3  0.2356      0.950 0.072 0.000 0.928
#> SRR925696      3  0.4121      0.787 0.168 0.000 0.832
#> SRR925698      3  0.0000      0.962 0.000 0.000 1.000
#> SRR925699      2  0.0000      0.992 0.000 1.000 0.000
#> SRR925700      2  0.0000      0.992 0.000 1.000 0.000
#> SRR925701      2  0.0000      0.992 0.000 1.000 0.000
#> SRR925702      1  0.0000      0.968 1.000 0.000 0.000
#> SRR925703      3  0.1860      0.958 0.052 0.000 0.948
#> SRR925704      3  0.0237      0.961 0.004 0.000 0.996
#> SRR925705      1  0.2165      0.958 0.936 0.000 0.064
#> SRR925706      3  0.1860      0.958 0.052 0.000 0.948
#> SRR925708      1  0.0000      0.968 1.000 0.000 0.000
#> SRR925707      1  0.2356      0.923 0.928 0.072 0.000
#> SRR925709      1  0.0000      0.968 1.000 0.000 0.000
#> SRR925710      3  0.2448      0.948 0.076 0.000 0.924
#> SRR925711      3  0.0237      0.961 0.004 0.000 0.996
#> SRR934631      2  0.0000      0.992 0.000 1.000 0.000
#> SRR934632      2  0.0000      0.992 0.000 1.000 0.000
#> SRR934633      1  0.2096      0.960 0.944 0.004 0.052
#> SRR925713      3  0.1860      0.958 0.052 0.000 0.948
#> SRR925714      3  0.1860      0.958 0.052 0.000 0.948
#> SRR925715      3  0.1860      0.958 0.052 0.000 0.948
#> SRR925716      1  0.0000      0.968 1.000 0.000 0.000
#> SRR925717      3  0.1860      0.958 0.052 0.000 0.948
#> SRR925718      2  0.0000      0.992 0.000 1.000 0.000
#> SRR925719      1  0.0000      0.968 1.000 0.000 0.000
#> SRR925720      1  0.0592      0.964 0.988 0.000 0.012
#> SRR925721      1  0.0000      0.968 1.000 0.000 0.000
#> SRR934634      2  0.0592      0.989 0.012 0.988 0.000
#> SRR934635      2  0.0592      0.989 0.012 0.988 0.000
#> SRR925723      3  0.1031      0.951 0.024 0.000 0.976
#> SRR925724      3  0.0000      0.962 0.000 0.000 1.000
#> SRR925725      3  0.0000      0.962 0.000 0.000 1.000
#> SRR925726      3  0.2356      0.950 0.072 0.000 0.928
#> SRR925727      3  0.0000      0.962 0.000 0.000 1.000
#> SRR925728      1  0.0000      0.968 1.000 0.000 0.000
#> SRR934636      2  0.0000      0.992 0.000 1.000 0.000
#> SRR934637      1  0.1860      0.941 0.948 0.052 0.000
#> SRR925729      1  0.2066      0.960 0.940 0.000 0.060
#> SRR934638      2  0.0592      0.989 0.012 0.988 0.000
#> SRR934639      1  0.0000      0.968 1.000 0.000 0.000
#> SRR934640      2  0.0000      0.992 0.000 1.000 0.000
#> SRR934641      2  0.0000      0.992 0.000 1.000 0.000
#> SRR925734      2  0.0592      0.989 0.012 0.988 0.000
#> SRR925735      1  0.2448      0.950 0.924 0.000 0.076
#> SRR925736      1  0.2066      0.960 0.940 0.000 0.060
#> SRR925737      1  0.2066      0.960 0.940 0.000 0.060
#> SRR934642      2  0.0000      0.992 0.000 1.000 0.000
#> SRR934643      2  0.0000      0.992 0.000 1.000 0.000
#> SRR934644      2  0.0000      0.992 0.000 1.000 0.000
#> SRR934645      2  0.0000      0.992 0.000 1.000 0.000
#> SRR925740      1  0.2165      0.958 0.936 0.000 0.064
#> SRR925741      3  0.0000      0.962 0.000 0.000 1.000
#> SRR925742      1  0.1753      0.961 0.952 0.000 0.048
#> SRR1283038     1  0.2165      0.958 0.936 0.000 0.064

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> SRR925687      1  0.1211     0.6563 0.960 0.000 0.040 0.000
#> SRR925688      1  0.0707     0.6617 0.980 0.000 0.020 0.000
#> SRR925689      2  0.4957     0.7468 0.016 0.684 0.300 0.000
#> SRR925690      2  0.6926     0.5975 0.108 0.460 0.432 0.000
#> SRR925691      2  0.6926     0.5975 0.108 0.460 0.432 0.000
#> SRR925692      2  0.6278     0.6727 0.060 0.532 0.408 0.000
#> SRR925693      4  0.2149     0.7062 0.000 0.000 0.088 0.912
#> SRR925694      2  0.0000     0.8372 0.000 1.000 0.000 0.000
#> SRR925695      4  0.2814     0.6848 0.000 0.000 0.132 0.868
#> SRR925697      4  0.3695     0.6661 0.156 0.000 0.016 0.828
#> SRR925696      3  0.7416     0.7826 0.244 0.000 0.516 0.240
#> SRR925698      4  0.3172     0.6533 0.000 0.000 0.160 0.840
#> SRR925699      2  0.0000     0.8372 0.000 1.000 0.000 0.000
#> SRR925700      2  0.0000     0.8372 0.000 1.000 0.000 0.000
#> SRR925701      2  0.0000     0.8372 0.000 1.000 0.000 0.000
#> SRR925702      1  0.0592     0.6618 0.984 0.000 0.016 0.000
#> SRR925703      4  0.1792     0.7335 0.068 0.000 0.000 0.932
#> SRR925704      3  0.6627     0.5254 0.084 0.000 0.504 0.412
#> SRR925705      1  0.5898     0.4107 0.604 0.000 0.348 0.048
#> SRR925706      4  0.4374     0.6985 0.068 0.000 0.120 0.812
#> SRR925708      1  0.1389     0.6531 0.952 0.000 0.048 0.000
#> SRR925707      1  0.6957     0.2371 0.472 0.112 0.416 0.000
#> SRR925709      1  0.0592     0.6636 0.984 0.000 0.016 0.000
#> SRR925710      4  0.6488     0.4007 0.244 0.000 0.128 0.628
#> SRR925711      4  0.6337    -0.1208 0.068 0.000 0.380 0.552
#> SRR934631      2  0.0000     0.8372 0.000 1.000 0.000 0.000
#> SRR934632      2  0.0000     0.8372 0.000 1.000 0.000 0.000
#> SRR934633      1  0.5830     0.4765 0.620 0.000 0.332 0.048
#> SRR925713      4  0.2255     0.7287 0.068 0.000 0.012 0.920
#> SRR925714      4  0.1792     0.7335 0.068 0.000 0.000 0.932
#> SRR925715      4  0.4764     0.6766 0.088 0.000 0.124 0.788
#> SRR925716      1  0.2469     0.6305 0.892 0.000 0.108 0.000
#> SRR925717      4  0.1716     0.7338 0.064 0.000 0.000 0.936
#> SRR925718      2  0.0000     0.8372 0.000 1.000 0.000 0.000
#> SRR925719      1  0.1302     0.6544 0.956 0.000 0.044 0.000
#> SRR925720      1  0.3439     0.5748 0.868 0.000 0.048 0.084
#> SRR925721      1  0.1022     0.6606 0.968 0.000 0.032 0.000
#> SRR934634      2  0.4609     0.7717 0.024 0.752 0.224 0.000
#> SRR934635      2  0.6278     0.6727 0.060 0.532 0.408 0.000
#> SRR925723      3  0.7387     0.8088 0.224 0.000 0.520 0.256
#> SRR925724      4  0.4382     0.4391 0.000 0.000 0.296 0.704
#> SRR925725      4  0.2281     0.7022 0.000 0.000 0.096 0.904
#> SRR925726      4  0.3695     0.6661 0.156 0.000 0.016 0.828
#> SRR925727      4  0.2216     0.7042 0.000 0.000 0.092 0.908
#> SRR925728      1  0.2281     0.6477 0.904 0.000 0.096 0.000
#> SRR934636      2  0.2589     0.8145 0.000 0.884 0.116 0.000
#> SRR934637      1  0.5360     0.3058 0.552 0.012 0.436 0.000
#> SRR925729      1  0.5865     0.4380 0.612 0.000 0.340 0.048
#> SRR934638      2  0.5691     0.6921 0.028 0.564 0.408 0.000
#> SRR934639      1  0.1211     0.6563 0.960 0.000 0.040 0.000
#> SRR934640      2  0.0817     0.8325 0.000 0.976 0.024 0.000
#> SRR934641      2  0.0817     0.8325 0.000 0.976 0.024 0.000
#> SRR925734      2  0.6278     0.6727 0.060 0.532 0.408 0.000
#> SRR925735      1  0.6134     0.1896 0.508 0.000 0.444 0.048
#> SRR925736      1  0.5712     0.4675 0.644 0.000 0.308 0.048
#> SRR925737      1  0.5712     0.4675 0.644 0.000 0.308 0.048
#> SRR934642      2  0.0000     0.8372 0.000 1.000 0.000 0.000
#> SRR934643      2  0.0000     0.8372 0.000 1.000 0.000 0.000
#> SRR934644      2  0.0000     0.8372 0.000 1.000 0.000 0.000
#> SRR934645      2  0.2921     0.8030 0.000 0.860 0.140 0.000
#> SRR925740      1  0.5812     0.4763 0.624 0.000 0.328 0.048
#> SRR925741      4  0.5498    -0.0316 0.020 0.000 0.404 0.576
#> SRR925742      1  0.5535     0.5179 0.656 0.000 0.304 0.040
#> SRR1283038     1  0.6114     0.2204 0.524 0.000 0.428 0.048

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>            class entropy silhouette    p1    p2    p3    p4    p5
#> SRR925687      4  0.6385     0.6079 0.252 0.000 0.232 0.516 0.000
#> SRR925688      4  0.6656     0.5367 0.308 0.000 0.252 0.440 0.000
#> SRR925689      2  0.4560    -0.2324 0.484 0.508 0.000 0.008 0.000
#> SRR925690      1  0.3766     0.6250 0.728 0.268 0.000 0.004 0.000
#> SRR925691      1  0.3766     0.6250 0.728 0.268 0.000 0.004 0.000
#> SRR925692      1  0.4084     0.5912 0.668 0.328 0.000 0.004 0.000
#> SRR925693      5  0.0798     0.6886 0.000 0.000 0.008 0.016 0.976
#> SRR925694      2  0.0703     0.8577 0.000 0.976 0.000 0.024 0.000
#> SRR925695      5  0.1357     0.6787 0.004 0.000 0.048 0.000 0.948
#> SRR925697      4  0.4304    -0.5174 0.000 0.000 0.000 0.516 0.484
#> SRR925696      3  0.3243     0.5188 0.004 0.000 0.812 0.004 0.180
#> SRR925698      5  0.1892     0.6589 0.004 0.000 0.080 0.000 0.916
#> SRR925699      2  0.0000     0.8555 0.000 1.000 0.000 0.000 0.000
#> SRR925700      2  0.0000     0.8555 0.000 1.000 0.000 0.000 0.000
#> SRR925701      2  0.0703     0.8577 0.000 0.976 0.000 0.024 0.000
#> SRR925702      4  0.6323     0.6022 0.252 0.000 0.220 0.528 0.000
#> SRR925703      5  0.4088     0.6101 0.000 0.000 0.000 0.368 0.632
#> SRR925704      3  0.4449     0.0987 0.004 0.000 0.604 0.004 0.388
#> SRR925705      3  0.2540     0.7047 0.024 0.000 0.888 0.088 0.000
#> SRR925706      5  0.6032     0.5471 0.000 0.000 0.116 0.424 0.460
#> SRR925708      4  0.6387     0.6063 0.248 0.000 0.236 0.516 0.000
#> SRR925707      1  0.4798     0.4166 0.772 0.060 0.116 0.052 0.000
#> SRR925709      4  0.6443     0.5892 0.276 0.000 0.224 0.500 0.000
#> SRR925710      4  0.6172    -0.3728 0.004 0.000 0.152 0.556 0.288
#> SRR925711      5  0.5488     0.3155 0.032 0.000 0.396 0.020 0.552
#> SRR934631      2  0.0703     0.8577 0.000 0.976 0.000 0.024 0.000
#> SRR934632      2  0.0703     0.8577 0.000 0.976 0.000 0.024 0.000
#> SRR934633      3  0.4559     0.6776 0.100 0.000 0.748 0.152 0.000
#> SRR925713      5  0.4150     0.5986 0.000 0.000 0.000 0.388 0.612
#> SRR925714      5  0.4088     0.6101 0.000 0.000 0.000 0.368 0.632
#> SRR925715      5  0.6274     0.5304 0.000 0.000 0.148 0.424 0.428
#> SRR925716      4  0.6497     0.5165 0.392 0.000 0.188 0.420 0.000
#> SRR925717      5  0.4015     0.6141 0.000 0.000 0.000 0.348 0.652
#> SRR925718      2  0.0000     0.8555 0.000 1.000 0.000 0.000 0.000
#> SRR925719      4  0.6387     0.6063 0.248 0.000 0.236 0.516 0.000
#> SRR925720      4  0.5892     0.5323 0.204 0.000 0.160 0.628 0.008
#> SRR925721      4  0.6613     0.5488 0.332 0.000 0.228 0.440 0.000
#> SRR934634      2  0.4310     0.1247 0.392 0.604 0.000 0.004 0.000
#> SRR934635      1  0.3932     0.5920 0.672 0.328 0.000 0.000 0.000
#> SRR925723      3  0.3317     0.5036 0.004 0.000 0.804 0.004 0.188
#> SRR925724      5  0.4200     0.4680 0.004 0.000 0.320 0.004 0.672
#> SRR925725      5  0.0912     0.6886 0.000 0.000 0.016 0.012 0.972
#> SRR925726      4  0.4304    -0.5174 0.000 0.000 0.000 0.516 0.484
#> SRR925727      5  0.1018     0.6890 0.000 0.000 0.016 0.016 0.968
#> SRR925728      1  0.6662    -0.5692 0.420 0.000 0.236 0.344 0.000
#> SRR934636      2  0.4238     0.5636 0.228 0.740 0.000 0.028 0.004
#> SRR934637      1  0.2609     0.4109 0.896 0.000 0.052 0.048 0.004
#> SRR925729      3  0.4170     0.6427 0.048 0.000 0.760 0.192 0.000
#> SRR934638      1  0.3999     0.5574 0.656 0.344 0.000 0.000 0.000
#> SRR934639      4  0.6405     0.6064 0.252 0.000 0.236 0.512 0.000
#> SRR934640      2  0.2419     0.8049 0.028 0.904 0.000 0.064 0.004
#> SRR934641      2  0.2419     0.8049 0.028 0.904 0.000 0.064 0.004
#> SRR925734      1  0.3932     0.5920 0.672 0.328 0.000 0.000 0.000
#> SRR925735      3  0.2466     0.6606 0.012 0.000 0.900 0.076 0.012
#> SRR925736      3  0.4334     0.6837 0.080 0.000 0.764 0.156 0.000
#> SRR925737      3  0.4412     0.6760 0.080 0.000 0.756 0.164 0.000
#> SRR934642      2  0.0703     0.8577 0.000 0.976 0.000 0.024 0.000
#> SRR934643      2  0.0000     0.8555 0.000 1.000 0.000 0.000 0.000
#> SRR934644      2  0.0703     0.8577 0.000 0.976 0.000 0.024 0.000
#> SRR934645      2  0.2852     0.6786 0.172 0.828 0.000 0.000 0.000
#> SRR925740      3  0.4469     0.6802 0.096 0.000 0.756 0.148 0.000
#> SRR925741      5  0.4580     0.1954 0.004 0.000 0.460 0.004 0.532
#> SRR925742      3  0.4675     0.6576 0.100 0.000 0.736 0.164 0.000
#> SRR1283038     3  0.0290     0.6834 0.000 0.000 0.992 0.008 0.000

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>            class entropy silhouette    p1    p2    p3    p4    p5    p6
#> SRR925687      4  0.1710      0.879 0.000 0.000 0.016 0.936 0.020 0.028
#> SRR925688      4  0.3031      0.832 0.016 0.000 0.032 0.852 0.000 0.100
#> SRR925689      1  0.4917      0.589 0.616 0.328 0.012 0.004 0.004 0.036
#> SRR925690      1  0.3486      0.820 0.840 0.092 0.008 0.036 0.004 0.020
#> SRR925691      1  0.3486      0.820 0.840 0.092 0.008 0.036 0.004 0.020
#> SRR925692      1  0.3504      0.820 0.828 0.120 0.008 0.020 0.004 0.020
#> SRR925693      3  0.4886      0.529 0.060 0.000 0.508 0.000 0.432 0.000
#> SRR925694      2  0.1049      0.888 0.000 0.960 0.032 0.000 0.000 0.008
#> SRR925695      3  0.4909      0.592 0.056 0.000 0.588 0.000 0.348 0.008
#> SRR925697      5  0.1501      0.802 0.000 0.000 0.000 0.076 0.924 0.000
#> SRR925696      6  0.4402      0.553 0.000 0.000 0.244 0.040 0.016 0.700
#> SRR925698      3  0.4090      0.605 0.004 0.000 0.652 0.000 0.328 0.016
#> SRR925699      2  0.0603      0.883 0.000 0.980 0.004 0.000 0.000 0.016
#> SRR925700      2  0.0458      0.884 0.000 0.984 0.000 0.000 0.000 0.016
#> SRR925701      2  0.0935      0.888 0.000 0.964 0.032 0.000 0.000 0.004
#> SRR925702      4  0.1059      0.884 0.000 0.000 0.004 0.964 0.016 0.016
#> SRR925703      5  0.2164      0.778 0.008 0.000 0.056 0.028 0.908 0.000
#> SRR925704      3  0.4907      0.300 0.000 0.000 0.556 0.016 0.036 0.392
#> SRR925705      6  0.3150      0.787 0.000 0.000 0.052 0.120 0.000 0.828
#> SRR925706      5  0.4685      0.702 0.020 0.000 0.104 0.068 0.764 0.044
#> SRR925708      4  0.1257      0.881 0.000 0.000 0.000 0.952 0.020 0.028
#> SRR925707      1  0.5545      0.606 0.672 0.012 0.060 0.180 0.000 0.076
#> SRR925709      4  0.1364      0.874 0.004 0.000 0.004 0.944 0.000 0.048
#> SRR925710      5  0.6053      0.555 0.020 0.000 0.072 0.216 0.620 0.072
#> SRR925711      3  0.5916      0.560 0.032 0.000 0.612 0.020 0.100 0.236
#> SRR934631      2  0.1409      0.886 0.000 0.948 0.032 0.000 0.008 0.012
#> SRR934632      2  0.1409      0.886 0.000 0.948 0.032 0.000 0.008 0.012
#> SRR934633      6  0.4006      0.753 0.016 0.000 0.032 0.204 0.000 0.748
#> SRR925713      5  0.1464      0.798 0.004 0.000 0.016 0.036 0.944 0.000
#> SRR925714      5  0.2164      0.778 0.008 0.000 0.056 0.028 0.908 0.000
#> SRR925715      5  0.4964      0.681 0.020 0.000 0.108 0.072 0.744 0.056
#> SRR925716      4  0.3565      0.806 0.064 0.000 0.024 0.824 0.000 0.088
#> SRR925717      5  0.2663      0.747 0.012 0.000 0.084 0.028 0.876 0.000
#> SRR925718      2  0.0603      0.883 0.000 0.980 0.004 0.000 0.000 0.016
#> SRR925719      4  0.1710      0.879 0.000 0.000 0.016 0.936 0.020 0.028
#> SRR925720      4  0.2680      0.836 0.004 0.000 0.016 0.884 0.068 0.028
#> SRR925721      4  0.3101      0.834 0.024 0.000 0.032 0.852 0.000 0.092
#> SRR934634      1  0.4721      0.223 0.488 0.480 0.008 0.008 0.000 0.016
#> SRR934635      1  0.2581      0.823 0.860 0.120 0.000 0.020 0.000 0.000
#> SRR925723      6  0.4402      0.553 0.000 0.000 0.244 0.040 0.016 0.700
#> SRR925724      3  0.4923      0.607 0.000 0.000 0.656 0.000 0.176 0.168
#> SRR925725      3  0.5013      0.537 0.060 0.000 0.508 0.000 0.428 0.004
#> SRR925726      5  0.1501      0.802 0.000 0.000 0.000 0.076 0.924 0.000
#> SRR925727      3  0.5013      0.537 0.060 0.000 0.508 0.000 0.428 0.004
#> SRR925728      4  0.4548      0.737 0.072 0.000 0.060 0.756 0.000 0.112
#> SRR934636      2  0.4798      0.288 0.324 0.620 0.044 0.000 0.004 0.008
#> SRR934637      1  0.5161      0.619 0.696 0.000 0.060 0.176 0.004 0.064
#> SRR925729      6  0.3429      0.761 0.004 0.000 0.000 0.252 0.004 0.740
#> SRR934638      1  0.2573      0.815 0.856 0.132 0.004 0.008 0.000 0.000
#> SRR934639      4  0.1257      0.881 0.000 0.000 0.000 0.952 0.020 0.028
#> SRR934640      2  0.3875      0.778 0.028 0.800 0.136 0.000 0.020 0.016
#> SRR934641      2  0.3875      0.778 0.028 0.800 0.136 0.000 0.020 0.016
#> SRR925734      1  0.2581      0.823 0.860 0.120 0.000 0.020 0.000 0.000
#> SRR925735      6  0.4860      0.698 0.020 0.000 0.104 0.160 0.004 0.712
#> SRR925736      6  0.3183      0.787 0.008 0.000 0.000 0.200 0.004 0.788
#> SRR925737      6  0.3183      0.787 0.008 0.000 0.000 0.200 0.004 0.788
#> SRR934642      2  0.0935      0.888 0.000 0.964 0.032 0.000 0.000 0.004
#> SRR934643      2  0.0603      0.883 0.000 0.980 0.004 0.000 0.000 0.016
#> SRR934644      2  0.1049      0.888 0.000 0.960 0.032 0.000 0.000 0.008
#> SRR934645      2  0.3836      0.573 0.248 0.728 0.004 0.000 0.004 0.016
#> SRR925740      6  0.3977      0.756 0.016 0.000 0.032 0.200 0.000 0.752
#> SRR925741      3  0.5269      0.538 0.016 0.000 0.612 0.004 0.076 0.292
#> SRR925742      6  0.4091      0.740 0.016 0.000 0.032 0.216 0.000 0.736
#> SRR1283038     6  0.3068      0.754 0.000 0.000 0.072 0.088 0.000 0.840

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

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

collect_plots(res)

plot of chunk ATC-skmeans-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 1.000           0.977       0.990         0.5032 0.497   0.497
#> 3 3 0.774           0.882       0.913         0.2974 0.805   0.619
#> 4 4 0.754           0.672       0.831         0.1006 0.851   0.613
#> 5 5 0.751           0.605       0.811         0.0574 0.878   0.632
#> 6 6 0.730           0.625       0.804         0.0369 0.926   0.716

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
#> SRR925687      1  0.0000      0.994 1.000 0.000
#> SRR925688      1  0.0000      0.994 1.000 0.000
#> SRR925689      2  0.0000      0.984 0.000 1.000
#> SRR925690      2  0.0000      0.984 0.000 1.000
#> SRR925691      2  0.0000      0.984 0.000 1.000
#> SRR925692      2  0.0000      0.984 0.000 1.000
#> SRR925693      1  0.0000      0.994 1.000 0.000
#> SRR925694      2  0.0000      0.984 0.000 1.000
#> SRR925695      1  0.0000      0.994 1.000 0.000
#> SRR925697      1  0.0000      0.994 1.000 0.000
#> SRR925696      1  0.0000      0.994 1.000 0.000
#> SRR925698      1  0.0000      0.994 1.000 0.000
#> SRR925699      2  0.0000      0.984 0.000 1.000
#> SRR925700      2  0.0000      0.984 0.000 1.000
#> SRR925701      2  0.0000      0.984 0.000 1.000
#> SRR925702      1  0.0000      0.994 1.000 0.000
#> SRR925703      1  0.0000      0.994 1.000 0.000
#> SRR925704      1  0.0000      0.994 1.000 0.000
#> SRR925705      1  0.0000      0.994 1.000 0.000
#> SRR925706      1  0.0000      0.994 1.000 0.000
#> SRR925708      1  0.0000      0.994 1.000 0.000
#> SRR925707      2  0.0000      0.984 0.000 1.000
#> SRR925709      1  0.0000      0.994 1.000 0.000
#> SRR925710      1  0.0000      0.994 1.000 0.000
#> SRR925711      1  0.0000      0.994 1.000 0.000
#> SRR934631      2  0.0000      0.984 0.000 1.000
#> SRR934632      2  0.0000      0.984 0.000 1.000
#> SRR934633      2  0.0000      0.984 0.000 1.000
#> SRR925713      1  0.0000      0.994 1.000 0.000
#> SRR925714      1  0.0000      0.994 1.000 0.000
#> SRR925715      1  0.0000      0.994 1.000 0.000
#> SRR925716      2  0.7219      0.750 0.200 0.800
#> SRR925717      1  0.0000      0.994 1.000 0.000
#> SRR925718      2  0.0000      0.984 0.000 1.000
#> SRR925719      1  0.0000      0.994 1.000 0.000
#> SRR925720      1  0.0000      0.994 1.000 0.000
#> SRR925721      2  0.7745      0.708 0.228 0.772
#> SRR934634      2  0.0000      0.984 0.000 1.000
#> SRR934635      2  0.0000      0.984 0.000 1.000
#> SRR925723      1  0.0000      0.994 1.000 0.000
#> SRR925724      1  0.0000      0.994 1.000 0.000
#> SRR925725      1  0.0000      0.994 1.000 0.000
#> SRR925726      1  0.0000      0.994 1.000 0.000
#> SRR925727      1  0.0000      0.994 1.000 0.000
#> SRR925728      2  0.0000      0.984 0.000 1.000
#> SRR934636      2  0.0000      0.984 0.000 1.000
#> SRR934637      2  0.0000      0.984 0.000 1.000
#> SRR925729      1  0.0000      0.994 1.000 0.000
#> SRR934638      2  0.0000      0.984 0.000 1.000
#> SRR934639      1  0.0000      0.994 1.000 0.000
#> SRR934640      2  0.0000      0.984 0.000 1.000
#> SRR934641      2  0.0000      0.984 0.000 1.000
#> SRR925734      2  0.0000      0.984 0.000 1.000
#> SRR925735      1  0.0000      0.994 1.000 0.000
#> SRR925736      1  0.0000      0.994 1.000 0.000
#> SRR925737      1  0.0000      0.994 1.000 0.000
#> SRR934642      2  0.0000      0.984 0.000 1.000
#> SRR934643      2  0.0000      0.984 0.000 1.000
#> SRR934644      2  0.0000      0.984 0.000 1.000
#> SRR934645      2  0.0000      0.984 0.000 1.000
#> SRR925740      1  0.7453      0.724 0.788 0.212
#> SRR925741      1  0.0000      0.994 1.000 0.000
#> SRR925742      2  0.0672      0.977 0.008 0.992
#> SRR1283038     1  0.0000      0.994 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
#> SRR925687      1  0.0000      0.819 1.000 0.000 0.000
#> SRR925688      1  0.2878      0.751 0.904 0.000 0.096
#> SRR925689      2  0.0000      0.964 0.000 1.000 0.000
#> SRR925690      2  0.0000      0.964 0.000 1.000 0.000
#> SRR925691      2  0.0000      0.964 0.000 1.000 0.000
#> SRR925692      2  0.0000      0.964 0.000 1.000 0.000
#> SRR925693      3  0.3038      0.973 0.104 0.000 0.896
#> SRR925694      2  0.0000      0.964 0.000 1.000 0.000
#> SRR925695      3  0.3038      0.973 0.104 0.000 0.896
#> SRR925697      1  0.4399      0.772 0.812 0.000 0.188
#> SRR925696      3  0.2959      0.971 0.100 0.000 0.900
#> SRR925698      3  0.3038      0.973 0.104 0.000 0.896
#> SRR925699      2  0.0000      0.964 0.000 1.000 0.000
#> SRR925700      2  0.0000      0.964 0.000 1.000 0.000
#> SRR925701      2  0.0000      0.964 0.000 1.000 0.000
#> SRR925702      1  0.0000      0.819 1.000 0.000 0.000
#> SRR925703      1  0.5560      0.698 0.700 0.000 0.300
#> SRR925704      3  0.3038      0.973 0.104 0.000 0.896
#> SRR925705      3  0.2711      0.961 0.088 0.000 0.912
#> SRR925706      1  0.5560      0.698 0.700 0.000 0.300
#> SRR925708      1  0.0000      0.819 1.000 0.000 0.000
#> SRR925707      2  0.0000      0.964 0.000 1.000 0.000
#> SRR925709      1  0.0000      0.819 1.000 0.000 0.000
#> SRR925710      1  0.5363      0.718 0.724 0.000 0.276
#> SRR925711      3  0.3038      0.973 0.104 0.000 0.896
#> SRR934631      2  0.0000      0.964 0.000 1.000 0.000
#> SRR934632      2  0.0000      0.964 0.000 1.000 0.000
#> SRR934633      2  0.6291      0.282 0.000 0.532 0.468
#> SRR925713      1  0.5560      0.698 0.700 0.000 0.300
#> SRR925714      1  0.5560      0.698 0.700 0.000 0.300
#> SRR925715      1  0.5650      0.678 0.688 0.000 0.312
#> SRR925716      1  0.0661      0.812 0.988 0.004 0.008
#> SRR925717      1  0.5560      0.698 0.700 0.000 0.300
#> SRR925718      2  0.0000      0.964 0.000 1.000 0.000
#> SRR925719      1  0.0000      0.819 1.000 0.000 0.000
#> SRR925720      1  0.0000      0.819 1.000 0.000 0.000
#> SRR925721      1  0.3587      0.743 0.892 0.020 0.088
#> SRR934634      2  0.0000      0.964 0.000 1.000 0.000
#> SRR934635      2  0.0000      0.964 0.000 1.000 0.000
#> SRR925723      3  0.3038      0.973 0.104 0.000 0.896
#> SRR925724      3  0.3038      0.973 0.104 0.000 0.896
#> SRR925725      3  0.3038      0.973 0.104 0.000 0.896
#> SRR925726      1  0.4399      0.772 0.812 0.000 0.188
#> SRR925727      3  0.3038      0.973 0.104 0.000 0.896
#> SRR925728      2  0.3482      0.844 0.128 0.872 0.000
#> SRR934636      2  0.0000      0.964 0.000 1.000 0.000
#> SRR934637      2  0.0000      0.964 0.000 1.000 0.000
#> SRR925729      3  0.3038      0.973 0.104 0.000 0.896
#> SRR934638      2  0.0000      0.964 0.000 1.000 0.000
#> SRR934639      1  0.0000      0.819 1.000 0.000 0.000
#> SRR934640      2  0.0000      0.964 0.000 1.000 0.000
#> SRR934641      2  0.0000      0.964 0.000 1.000 0.000
#> SRR925734      2  0.0000      0.964 0.000 1.000 0.000
#> SRR925735      3  0.3038      0.973 0.104 0.000 0.896
#> SRR925736      3  0.0000      0.875 0.000 0.000 1.000
#> SRR925737      3  0.0237      0.879 0.004 0.000 0.996
#> SRR934642      2  0.0000      0.964 0.000 1.000 0.000
#> SRR934643      2  0.0000      0.964 0.000 1.000 0.000
#> SRR934644      2  0.0000      0.964 0.000 1.000 0.000
#> SRR934645      2  0.0000      0.964 0.000 1.000 0.000
#> SRR925740      3  0.0000      0.875 0.000 0.000 1.000
#> SRR925741      3  0.3038      0.973 0.104 0.000 0.896
#> SRR925742      2  0.7044      0.517 0.032 0.620 0.348
#> SRR1283038     3  0.2959      0.971 0.100 0.000 0.900

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> SRR925687      1  0.0188     0.8397 0.996 0.000 0.004 0.000
#> SRR925688      1  0.1940     0.8047 0.924 0.000 0.000 0.076
#> SRR925689      2  0.4647     0.8003 0.000 0.704 0.288 0.008
#> SRR925690      2  0.4647     0.8003 0.000 0.704 0.288 0.008
#> SRR925691      2  0.4647     0.8003 0.000 0.704 0.288 0.008
#> SRR925692      2  0.4647     0.8003 0.000 0.704 0.288 0.008
#> SRR925693      3  0.4356     0.7048 0.000 0.000 0.708 0.292
#> SRR925694      2  0.0000     0.8458 0.000 1.000 0.000 0.000
#> SRR925695      3  0.4356     0.7048 0.000 0.000 0.708 0.292
#> SRR925697      1  0.4925     0.0165 0.572 0.000 0.428 0.000
#> SRR925696      3  0.4356     0.7048 0.000 0.000 0.708 0.292
#> SRR925698      3  0.4356     0.7048 0.000 0.000 0.708 0.292
#> SRR925699      2  0.0000     0.8458 0.000 1.000 0.000 0.000
#> SRR925700      2  0.0000     0.8458 0.000 1.000 0.000 0.000
#> SRR925701      2  0.0000     0.8458 0.000 1.000 0.000 0.000
#> SRR925702      1  0.0376     0.8396 0.992 0.000 0.004 0.004
#> SRR925703      3  0.4830     0.4568 0.392 0.000 0.608 0.000
#> SRR925704      3  0.4356     0.7048 0.000 0.000 0.708 0.292
#> SRR925705      4  0.4643     0.1445 0.000 0.000 0.344 0.656
#> SRR925706      3  0.4830     0.4568 0.392 0.000 0.608 0.000
#> SRR925708      1  0.0779     0.8376 0.980 0.000 0.016 0.004
#> SRR925707      2  0.0188     0.8453 0.000 0.996 0.004 0.000
#> SRR925709      1  0.0376     0.8396 0.992 0.000 0.004 0.004
#> SRR925710      3  0.4898     0.4028 0.416 0.000 0.584 0.000
#> SRR925711      3  0.4356     0.7048 0.000 0.000 0.708 0.292
#> SRR934631      2  0.0000     0.8458 0.000 1.000 0.000 0.000
#> SRR934632      2  0.0000     0.8458 0.000 1.000 0.000 0.000
#> SRR934633      4  0.4477     0.4804 0.000 0.312 0.000 0.688
#> SRR925713      3  0.4830     0.4568 0.392 0.000 0.608 0.000
#> SRR925714      3  0.4830     0.4568 0.392 0.000 0.608 0.000
#> SRR925715      3  0.4991     0.4622 0.388 0.000 0.608 0.004
#> SRR925716      1  0.4770     0.4867 0.700 0.000 0.288 0.012
#> SRR925717      3  0.4830     0.4568 0.392 0.000 0.608 0.000
#> SRR925718      2  0.0000     0.8458 0.000 1.000 0.000 0.000
#> SRR925719      1  0.0336     0.8396 0.992 0.000 0.008 0.000
#> SRR925720      1  0.0707     0.8355 0.980 0.000 0.020 0.000
#> SRR925721      1  0.2198     0.8028 0.920 0.000 0.008 0.072
#> SRR934634      2  0.4647     0.8003 0.000 0.704 0.288 0.008
#> SRR934635      2  0.4647     0.8003 0.000 0.704 0.288 0.008
#> SRR925723      3  0.4356     0.7048 0.000 0.000 0.708 0.292
#> SRR925724      3  0.4356     0.7048 0.000 0.000 0.708 0.292
#> SRR925725      3  0.4356     0.7048 0.000 0.000 0.708 0.292
#> SRR925726      1  0.4925     0.0165 0.572 0.000 0.428 0.000
#> SRR925727      3  0.4356     0.7048 0.000 0.000 0.708 0.292
#> SRR925728      2  0.7502     0.6509 0.140 0.552 0.288 0.020
#> SRR934636      2  0.4647     0.8003 0.000 0.704 0.288 0.008
#> SRR934637      2  0.4988     0.7919 0.000 0.692 0.288 0.020
#> SRR925729      4  0.5503    -0.3923 0.016 0.000 0.468 0.516
#> SRR934638      2  0.4647     0.8003 0.000 0.704 0.288 0.008
#> SRR934639      1  0.0376     0.8396 0.992 0.000 0.004 0.004
#> SRR934640      2  0.0000     0.8458 0.000 1.000 0.000 0.000
#> SRR934641      2  0.0000     0.8458 0.000 1.000 0.000 0.000
#> SRR925734      2  0.4647     0.8003 0.000 0.704 0.288 0.008
#> SRR925735      3  0.4509     0.7014 0.004 0.000 0.708 0.288
#> SRR925736      4  0.1302     0.6199 0.000 0.000 0.044 0.956
#> SRR925737      4  0.1474     0.6159 0.000 0.000 0.052 0.948
#> SRR934642      2  0.0000     0.8458 0.000 1.000 0.000 0.000
#> SRR934643      2  0.0000     0.8458 0.000 1.000 0.000 0.000
#> SRR934644      2  0.0000     0.8458 0.000 1.000 0.000 0.000
#> SRR934645      2  0.0000     0.8458 0.000 1.000 0.000 0.000
#> SRR925740      4  0.0804     0.6230 0.000 0.008 0.012 0.980
#> SRR925741      3  0.4356     0.7048 0.000 0.000 0.708 0.292
#> SRR925742      4  0.4632     0.4869 0.000 0.308 0.004 0.688
#> SRR1283038     3  0.4992     0.3271 0.000 0.000 0.524 0.476

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>            class entropy silhouette    p1    p2    p3    p4    p5
#> SRR925687      4  0.1670    0.58032 0.012 0.000 0.000 0.936 0.052
#> SRR925688      4  0.4822    0.33836 0.032 0.000 0.000 0.616 0.352
#> SRR925689      2  0.4287    0.26312 0.000 0.540 0.000 0.000 0.460
#> SRR925690      2  0.4294    0.24503 0.000 0.532 0.000 0.000 0.468
#> SRR925691      2  0.4294    0.24503 0.000 0.532 0.000 0.000 0.468
#> SRR925692      2  0.4294    0.24503 0.000 0.532 0.000 0.000 0.468
#> SRR925693      3  0.0000    0.93705 0.000 0.000 1.000 0.000 0.000
#> SRR925694      2  0.0000    0.72347 0.000 1.000 0.000 0.000 0.000
#> SRR925695      3  0.0000    0.93705 0.000 0.000 1.000 0.000 0.000
#> SRR925697      4  0.5007    0.63149 0.028 0.000 0.232 0.704 0.036
#> SRR925696      3  0.0579    0.92841 0.008 0.000 0.984 0.000 0.008
#> SRR925698      3  0.0000    0.93705 0.000 0.000 1.000 0.000 0.000
#> SRR925699      2  0.0000    0.72347 0.000 1.000 0.000 0.000 0.000
#> SRR925700      2  0.0000    0.72347 0.000 1.000 0.000 0.000 0.000
#> SRR925701      2  0.0000    0.72347 0.000 1.000 0.000 0.000 0.000
#> SRR925702      4  0.1571    0.58447 0.004 0.000 0.000 0.936 0.060
#> SRR925703      4  0.5764    0.48280 0.028 0.000 0.432 0.504 0.036
#> SRR925704      3  0.0290    0.93453 0.000 0.000 0.992 0.000 0.008
#> SRR925705      3  0.3999    0.57728 0.240 0.000 0.740 0.000 0.020
#> SRR925706      4  0.5764    0.48280 0.028 0.000 0.432 0.504 0.036
#> SRR925708      4  0.1282    0.58863 0.004 0.000 0.000 0.952 0.044
#> SRR925707      2  0.1270    0.69481 0.000 0.948 0.000 0.000 0.052
#> SRR925709      4  0.1704    0.57974 0.004 0.000 0.000 0.928 0.068
#> SRR925710      4  0.5648    0.54265 0.028 0.000 0.368 0.568 0.036
#> SRR925711      3  0.0000    0.93705 0.000 0.000 1.000 0.000 0.000
#> SRR934631      2  0.0000    0.72347 0.000 1.000 0.000 0.000 0.000
#> SRR934632      2  0.0000    0.72347 0.000 1.000 0.000 0.000 0.000
#> SRR934633      1  0.3112    0.73415 0.856 0.100 0.000 0.000 0.044
#> SRR925713      4  0.5764    0.48280 0.028 0.000 0.432 0.504 0.036
#> SRR925714      4  0.5764    0.48280 0.028 0.000 0.432 0.504 0.036
#> SRR925715      4  0.5776    0.45114 0.028 0.000 0.448 0.488 0.036
#> SRR925716      5  0.4522    0.12122 0.008 0.000 0.000 0.440 0.552
#> SRR925717      4  0.5764    0.48280 0.028 0.000 0.432 0.504 0.036
#> SRR925718      2  0.0000    0.72347 0.000 1.000 0.000 0.000 0.000
#> SRR925719      4  0.0807    0.59698 0.012 0.000 0.000 0.976 0.012
#> SRR925720      4  0.1278    0.59933 0.016 0.000 0.004 0.960 0.020
#> SRR925721      4  0.4620    0.28838 0.016 0.000 0.000 0.592 0.392
#> SRR934634      2  0.4249    0.30929 0.000 0.568 0.000 0.000 0.432
#> SRR934635      2  0.4291    0.25388 0.000 0.536 0.000 0.000 0.464
#> SRR925723      3  0.0162    0.93603 0.000 0.000 0.996 0.000 0.004
#> SRR925724      3  0.0000    0.93705 0.000 0.000 1.000 0.000 0.000
#> SRR925725      3  0.0000    0.93705 0.000 0.000 1.000 0.000 0.000
#> SRR925726      4  0.4951    0.63490 0.028 0.000 0.224 0.712 0.036
#> SRR925727      3  0.0000    0.93705 0.000 0.000 1.000 0.000 0.000
#> SRR925728      5  0.4513    0.42216 0.008 0.192 0.000 0.052 0.748
#> SRR934636      2  0.4192    0.34529 0.000 0.596 0.000 0.000 0.404
#> SRR934637      5  0.4331   -0.07632 0.000 0.400 0.000 0.004 0.596
#> SRR925729      1  0.6712   -0.00227 0.428 0.000 0.420 0.128 0.024
#> SRR934638      2  0.4262    0.29726 0.000 0.560 0.000 0.000 0.440
#> SRR934639      4  0.1408    0.58575 0.008 0.000 0.000 0.948 0.044
#> SRR934640      2  0.0000    0.72347 0.000 1.000 0.000 0.000 0.000
#> SRR934641      2  0.0000    0.72347 0.000 1.000 0.000 0.000 0.000
#> SRR925734      2  0.4287    0.26312 0.000 0.540 0.000 0.000 0.460
#> SRR925735      3  0.3293    0.74005 0.012 0.000 0.852 0.108 0.028
#> SRR925736      1  0.2592    0.80800 0.892 0.000 0.052 0.000 0.056
#> SRR925737      1  0.2592    0.80800 0.892 0.000 0.052 0.000 0.056
#> SRR934642      2  0.0000    0.72347 0.000 1.000 0.000 0.000 0.000
#> SRR934643      2  0.0000    0.72347 0.000 1.000 0.000 0.000 0.000
#> SRR934644      2  0.0000    0.72347 0.000 1.000 0.000 0.000 0.000
#> SRR934645      2  0.0000    0.72347 0.000 1.000 0.000 0.000 0.000
#> SRR925740      1  0.1282    0.80651 0.952 0.000 0.044 0.000 0.004
#> SRR925741      3  0.0290    0.93453 0.000 0.000 0.992 0.000 0.008
#> SRR925742      1  0.1408    0.78471 0.948 0.044 0.000 0.000 0.008
#> SRR1283038     3  0.3318    0.70829 0.180 0.000 0.808 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
#> SRR925687      4  0.4165    -0.0398 0.008 0.000 0.004 0.568 0.420 0.000
#> SRR925688      5  0.3411     0.6322 0.004 0.000 0.000 0.232 0.756 0.008
#> SRR925689      1  0.3747     0.8142 0.604 0.396 0.000 0.000 0.000 0.000
#> SRR925690      1  0.3684     0.8264 0.628 0.372 0.000 0.000 0.000 0.000
#> SRR925691      1  0.3684     0.8264 0.628 0.372 0.000 0.000 0.000 0.000
#> SRR925692      1  0.3684     0.8264 0.628 0.372 0.000 0.000 0.000 0.000
#> SRR925693      3  0.0363     0.9273 0.000 0.000 0.988 0.012 0.000 0.000
#> SRR925694      2  0.0000     0.8424 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR925695      3  0.0260     0.9298 0.000 0.000 0.992 0.008 0.000 0.000
#> SRR925697      4  0.2520     0.6206 0.000 0.000 0.152 0.844 0.004 0.000
#> SRR925696      3  0.0951     0.9097 0.004 0.000 0.968 0.000 0.008 0.020
#> SRR925698      3  0.0260     0.9298 0.000 0.000 0.992 0.008 0.000 0.000
#> SRR925699      2  0.0000     0.8424 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR925700      2  0.0000     0.8424 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR925701      2  0.0000     0.8424 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR925702      4  0.5089     0.1408 0.084 0.000 0.000 0.624 0.280 0.012
#> SRR925703      4  0.3266     0.6361 0.000 0.000 0.272 0.728 0.000 0.000
#> SRR925704      3  0.0260     0.9265 0.000 0.000 0.992 0.000 0.000 0.008
#> SRR925705      3  0.3663     0.6958 0.040 0.000 0.792 0.000 0.012 0.156
#> SRR925706      4  0.3266     0.6361 0.000 0.000 0.272 0.728 0.000 0.000
#> SRR925708      4  0.4667     0.2679 0.044 0.000 0.008 0.684 0.252 0.012
#> SRR925707      2  0.2393     0.7095 0.092 0.884 0.000 0.000 0.020 0.004
#> SRR925709      4  0.5315     0.0369 0.096 0.000 0.000 0.588 0.304 0.012
#> SRR925710      4  0.2883     0.6364 0.000 0.000 0.212 0.788 0.000 0.000
#> SRR925711      3  0.0000     0.9297 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR934631      2  0.0000     0.8424 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR934632      2  0.0000     0.8424 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR934633      6  0.4137     0.4725 0.012 0.216 0.000 0.000 0.040 0.732
#> SRR925713      4  0.3221     0.6375 0.000 0.000 0.264 0.736 0.000 0.000
#> SRR925714      4  0.3266     0.6361 0.000 0.000 0.272 0.728 0.000 0.000
#> SRR925715      4  0.3446     0.6002 0.000 0.000 0.308 0.692 0.000 0.000
#> SRR925716      5  0.5984     0.5041 0.296 0.000 0.000 0.204 0.492 0.008
#> SRR925717      4  0.3266     0.6361 0.000 0.000 0.272 0.728 0.000 0.000
#> SRR925718      2  0.0000     0.8424 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR925719      4  0.3219     0.3931 0.004 0.000 0.012 0.792 0.192 0.000
#> SRR925720      4  0.3494     0.3156 0.000 0.000 0.012 0.736 0.252 0.000
#> SRR925721      5  0.2613     0.6951 0.012 0.000 0.000 0.140 0.848 0.000
#> SRR934634      2  0.3996    -0.6101 0.484 0.512 0.000 0.000 0.004 0.000
#> SRR934635      1  0.3890     0.8087 0.596 0.400 0.000 0.000 0.004 0.000
#> SRR925723      3  0.0551     0.9263 0.000 0.000 0.984 0.004 0.004 0.008
#> SRR925724      3  0.0146     0.9300 0.000 0.000 0.996 0.004 0.000 0.000
#> SRR925725      3  0.0260     0.9298 0.000 0.000 0.992 0.008 0.000 0.000
#> SRR925726      4  0.2482     0.6187 0.000 0.000 0.148 0.848 0.004 0.000
#> SRR925727      3  0.0260     0.9298 0.000 0.000 0.992 0.008 0.000 0.000
#> SRR925728      1  0.5211     0.1433 0.680 0.060 0.000 0.044 0.208 0.008
#> SRR934636      2  0.4147    -0.4974 0.436 0.552 0.000 0.000 0.012 0.000
#> SRR934637      1  0.5625     0.6802 0.504 0.332 0.000 0.000 0.164 0.000
#> SRR925729      6  0.7343     0.1467 0.048 0.000 0.328 0.208 0.032 0.384
#> SRR934638      2  0.3993    -0.5886 0.476 0.520 0.000 0.000 0.004 0.000
#> SRR934639      4  0.4769     0.2254 0.040 0.000 0.008 0.656 0.284 0.012
#> SRR934640      2  0.0000     0.8424 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR934641      2  0.0000     0.8424 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR925734      1  0.3937     0.7698 0.572 0.424 0.000 0.000 0.004 0.000
#> SRR925735      3  0.3925     0.4596 0.004 0.000 0.700 0.280 0.004 0.012
#> SRR925736      6  0.4128     0.6764 0.164 0.000 0.028 0.000 0.044 0.764
#> SRR925737      6  0.4128     0.6764 0.164 0.000 0.028 0.000 0.044 0.764
#> SRR934642      2  0.0000     0.8424 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR934643      2  0.0000     0.8424 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR934644      2  0.0000     0.8424 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR934645      2  0.0000     0.8424 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR925740      6  0.0508     0.6833 0.000 0.000 0.012 0.000 0.004 0.984
#> SRR925741      3  0.0000     0.9297 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR925742      6  0.0363     0.6806 0.000 0.012 0.000 0.000 0.000 0.988
#> SRR1283038     3  0.2531     0.8011 0.004 0.000 0.860 0.000 0.008 0.128

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

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

collect_plots(res)

plot of chunk ATC-pam-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 1.000           0.974       0.988         0.4741 0.532   0.532
#> 3 3 0.824           0.926       0.937         0.3933 0.795   0.614
#> 4 4 0.684           0.788       0.790         0.1118 0.905   0.717
#> 5 5 0.901           0.891       0.940         0.0750 0.939   0.765
#> 6 6 0.892           0.857       0.932         0.0287 0.989   0.946

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

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

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
#> SRR925687      1  0.0000      0.981 1.000 0.000
#> SRR925688      1  0.0000      0.981 1.000 0.000
#> SRR925689      2  0.0000      1.000 0.000 1.000
#> SRR925690      2  0.0000      1.000 0.000 1.000
#> SRR925691      2  0.0000      1.000 0.000 1.000
#> SRR925692      2  0.0000      1.000 0.000 1.000
#> SRR925693      1  0.0000      0.981 1.000 0.000
#> SRR925694      2  0.0000      1.000 0.000 1.000
#> SRR925695      1  0.0000      0.981 1.000 0.000
#> SRR925697      1  0.0000      0.981 1.000 0.000
#> SRR925696      1  0.0000      0.981 1.000 0.000
#> SRR925698      1  0.0000      0.981 1.000 0.000
#> SRR925699      2  0.0000      1.000 0.000 1.000
#> SRR925700      2  0.0000      1.000 0.000 1.000
#> SRR925701      2  0.0000      1.000 0.000 1.000
#> SRR925702      1  0.0000      0.981 1.000 0.000
#> SRR925703      1  0.0000      0.981 1.000 0.000
#> SRR925704      1  0.0000      0.981 1.000 0.000
#> SRR925705      1  0.0000      0.981 1.000 0.000
#> SRR925706      1  0.0000      0.981 1.000 0.000
#> SRR925708      1  0.0000      0.981 1.000 0.000
#> SRR925707      2  0.0376      0.996 0.004 0.996
#> SRR925709      1  0.0000      0.981 1.000 0.000
#> SRR925710      1  0.0000      0.981 1.000 0.000
#> SRR925711      1  0.0000      0.981 1.000 0.000
#> SRR934631      2  0.0000      1.000 0.000 1.000
#> SRR934632      2  0.0000      1.000 0.000 1.000
#> SRR934633      1  0.8555      0.631 0.720 0.280
#> SRR925713      1  0.0000      0.981 1.000 0.000
#> SRR925714      1  0.0000      0.981 1.000 0.000
#> SRR925715      1  0.0000      0.981 1.000 0.000
#> SRR925716      1  0.0000      0.981 1.000 0.000
#> SRR925717      1  0.0000      0.981 1.000 0.000
#> SRR925718      2  0.0000      1.000 0.000 1.000
#> SRR925719      1  0.0000      0.981 1.000 0.000
#> SRR925720      1  0.0000      0.981 1.000 0.000
#> SRR925721      1  0.0000      0.981 1.000 0.000
#> SRR934634      2  0.0000      1.000 0.000 1.000
#> SRR934635      2  0.0000      1.000 0.000 1.000
#> SRR925723      1  0.0000      0.981 1.000 0.000
#> SRR925724      1  0.0000      0.981 1.000 0.000
#> SRR925725      1  0.0000      0.981 1.000 0.000
#> SRR925726      1  0.0000      0.981 1.000 0.000
#> SRR925727      1  0.0000      0.981 1.000 0.000
#> SRR925728      1  0.0000      0.981 1.000 0.000
#> SRR934636      2  0.0000      1.000 0.000 1.000
#> SRR934637      1  0.5519      0.852 0.872 0.128
#> SRR925729      1  0.0000      0.981 1.000 0.000
#> SRR934638      2  0.0000      1.000 0.000 1.000
#> SRR934639      1  0.0000      0.981 1.000 0.000
#> SRR934640      2  0.0000      1.000 0.000 1.000
#> SRR934641      2  0.0000      1.000 0.000 1.000
#> SRR925734      2  0.0000      1.000 0.000 1.000
#> SRR925735      1  0.0000      0.981 1.000 0.000
#> SRR925736      1  0.0000      0.981 1.000 0.000
#> SRR925737      1  0.0000      0.981 1.000 0.000
#> SRR934642      2  0.0000      1.000 0.000 1.000
#> SRR934643      2  0.0000      1.000 0.000 1.000
#> SRR934644      2  0.0000      1.000 0.000 1.000
#> SRR934645      2  0.0000      1.000 0.000 1.000
#> SRR925740      1  0.6247      0.820 0.844 0.156
#> SRR925741      1  0.0000      0.981 1.000 0.000
#> SRR925742      1  0.7139      0.767 0.804 0.196
#> SRR1283038     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
#> SRR925687      1  0.0000      0.940 1.000 0.000 0.000
#> SRR925688      1  0.0747      0.932 0.984 0.000 0.016
#> SRR925689      2  0.0424      0.995 0.000 0.992 0.008
#> SRR925690      2  0.0424      0.995 0.000 0.992 0.008
#> SRR925691      2  0.0424      0.995 0.000 0.992 0.008
#> SRR925692      2  0.0424      0.995 0.000 0.992 0.008
#> SRR925693      3  0.1031      0.819 0.024 0.000 0.976
#> SRR925694      2  0.0000      0.996 0.000 1.000 0.000
#> SRR925695      3  0.1031      0.819 0.024 0.000 0.976
#> SRR925697      1  0.0237      0.939 0.996 0.000 0.004
#> SRR925696      3  0.4796      0.894 0.220 0.000 0.780
#> SRR925698      3  0.1031      0.819 0.024 0.000 0.976
#> SRR925699      2  0.0000      0.996 0.000 1.000 0.000
#> SRR925700      2  0.0000      0.996 0.000 1.000 0.000
#> SRR925701      2  0.0000      0.996 0.000 1.000 0.000
#> SRR925702      1  0.0000      0.940 1.000 0.000 0.000
#> SRR925703      1  0.4750      0.753 0.784 0.000 0.216
#> SRR925704      3  0.4974      0.891 0.236 0.000 0.764
#> SRR925705      3  0.4842      0.894 0.224 0.000 0.776
#> SRR925706      1  0.0237      0.939 0.996 0.000 0.004
#> SRR925708      1  0.0000      0.940 1.000 0.000 0.000
#> SRR925707      2  0.1453      0.974 0.008 0.968 0.024
#> SRR925709      1  0.0000      0.940 1.000 0.000 0.000
#> SRR925710      1  0.0000      0.940 1.000 0.000 0.000
#> SRR925711      3  0.4974      0.891 0.236 0.000 0.764
#> SRR934631      2  0.0000      0.996 0.000 1.000 0.000
#> SRR934632      2  0.0000      0.996 0.000 1.000 0.000
#> SRR934633      3  0.4842      0.894 0.224 0.000 0.776
#> SRR925713      1  0.2878      0.870 0.904 0.000 0.096
#> SRR925714      1  0.4750      0.753 0.784 0.000 0.216
#> SRR925715      1  0.0237      0.939 0.996 0.000 0.004
#> SRR925716      1  0.0747      0.932 0.984 0.000 0.016
#> SRR925717      1  0.4750      0.753 0.784 0.000 0.216
#> SRR925718      2  0.0000      0.996 0.000 1.000 0.000
#> SRR925719      1  0.0000      0.940 1.000 0.000 0.000
#> SRR925720      1  0.0000      0.940 1.000 0.000 0.000
#> SRR925721      1  0.0747      0.932 0.984 0.000 0.016
#> SRR934634      2  0.0237      0.996 0.000 0.996 0.004
#> SRR934635      2  0.0424      0.995 0.000 0.992 0.008
#> SRR925723      3  0.4974      0.891 0.236 0.000 0.764
#> SRR925724      3  0.1031      0.819 0.024 0.000 0.976
#> SRR925725      3  0.1031      0.819 0.024 0.000 0.976
#> SRR925726      1  0.0237      0.939 0.996 0.000 0.004
#> SRR925727      3  0.1031      0.819 0.024 0.000 0.976
#> SRR925728      1  0.0747      0.932 0.984 0.000 0.016
#> SRR934636      2  0.0000      0.996 0.000 1.000 0.000
#> SRR934637      1  0.4483      0.796 0.848 0.128 0.024
#> SRR925729      1  0.2448      0.873 0.924 0.000 0.076
#> SRR934638      2  0.0424      0.995 0.000 0.992 0.008
#> SRR934639      1  0.0000      0.940 1.000 0.000 0.000
#> SRR934640      2  0.0000      0.996 0.000 1.000 0.000
#> SRR934641      2  0.0000      0.996 0.000 1.000 0.000
#> SRR925734      2  0.0424      0.995 0.000 0.992 0.008
#> SRR925735      1  0.0747      0.929 0.984 0.000 0.016
#> SRR925736      3  0.4842      0.894 0.224 0.000 0.776
#> SRR925737      3  0.4842      0.894 0.224 0.000 0.776
#> SRR934642      2  0.0000      0.996 0.000 1.000 0.000
#> SRR934643      2  0.0000      0.996 0.000 1.000 0.000
#> SRR934644      2  0.0000      0.996 0.000 1.000 0.000
#> SRR934645      2  0.0424      0.995 0.000 0.992 0.008
#> SRR925740      3  0.4842      0.894 0.224 0.000 0.776
#> SRR925741      3  0.4887      0.891 0.228 0.000 0.772
#> SRR925742      3  0.4842      0.894 0.224 0.000 0.776
#> SRR1283038     3  0.4842      0.894 0.224 0.000 0.776

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> SRR925687      4   0.000     0.9039 0.000 0.000 0.000 1.000
#> SRR925688      4   0.000     0.9039 0.000 0.000 0.000 1.000
#> SRR925689      1   0.000     0.8016 1.000 0.000 0.000 0.000
#> SRR925690      1   0.000     0.8016 1.000 0.000 0.000 0.000
#> SRR925691      1   0.000     0.8016 1.000 0.000 0.000 0.000
#> SRR925692      1   0.000     0.8016 1.000 0.000 0.000 0.000
#> SRR925693      3   0.000     0.6821 0.000 0.000 1.000 0.000
#> SRR925694      2   0.361     0.9558 0.200 0.800 0.000 0.000
#> SRR925695      3   0.000     0.6821 0.000 0.000 1.000 0.000
#> SRR925697      4   0.000     0.9039 0.000 0.000 0.000 1.000
#> SRR925696      3   0.700     0.7996 0.000 0.200 0.580 0.220
#> SRR925698      3   0.000     0.6821 0.000 0.000 1.000 0.000
#> SRR925699      2   0.361     0.9558 0.200 0.800 0.000 0.000
#> SRR925700      2   0.361     0.9558 0.200 0.800 0.000 0.000
#> SRR925701      2   0.361     0.9558 0.200 0.800 0.000 0.000
#> SRR925702      4   0.000     0.9039 0.000 0.000 0.000 1.000
#> SRR925703      4   0.491     0.4826 0.000 0.000 0.420 0.580
#> SRR925704      3   0.700     0.7996 0.000 0.200 0.580 0.220
#> SRR925705      3   0.700     0.7996 0.000 0.200 0.580 0.220
#> SRR925706      4   0.000     0.9039 0.000 0.000 0.000 1.000
#> SRR925708      4   0.000     0.9039 0.000 0.000 0.000 1.000
#> SRR925707      1   0.361     0.6601 0.800 0.200 0.000 0.000
#> SRR925709      4   0.000     0.9039 0.000 0.000 0.000 1.000
#> SRR925710      4   0.000     0.9039 0.000 0.000 0.000 1.000
#> SRR925711      3   0.376     0.7459 0.000 0.000 0.784 0.216
#> SRR934631      2   0.361     0.9558 0.200 0.800 0.000 0.000
#> SRR934632      2   0.361     0.9558 0.200 0.800 0.000 0.000
#> SRR934633      3   0.700     0.7996 0.000 0.200 0.580 0.220
#> SRR925713      4   0.228     0.8185 0.000 0.000 0.096 0.904
#> SRR925714      4   0.491     0.4826 0.000 0.000 0.420 0.580
#> SRR925715      4   0.000     0.9039 0.000 0.000 0.000 1.000
#> SRR925716      4   0.000     0.9039 0.000 0.000 0.000 1.000
#> SRR925717      4   0.491     0.4826 0.000 0.000 0.420 0.580
#> SRR925718      2   0.361     0.9558 0.200 0.800 0.000 0.000
#> SRR925719      4   0.000     0.9039 0.000 0.000 0.000 1.000
#> SRR925720      4   0.000     0.9039 0.000 0.000 0.000 1.000
#> SRR925721      4   0.000     0.9039 0.000 0.000 0.000 1.000
#> SRR934634      1   0.369     0.5125 0.792 0.208 0.000 0.000
#> SRR934635      1   0.000     0.8016 1.000 0.000 0.000 0.000
#> SRR925723      3   0.700     0.7996 0.000 0.200 0.580 0.220
#> SRR925724      3   0.000     0.6821 0.000 0.000 1.000 0.000
#> SRR925725      3   0.000     0.6821 0.000 0.000 1.000 0.000
#> SRR925726      4   0.000     0.9039 0.000 0.000 0.000 1.000
#> SRR925727      3   0.000     0.6821 0.000 0.000 1.000 0.000
#> SRR925728      1   0.761     0.0289 0.404 0.200 0.000 0.396
#> SRR934636      2   0.484     0.6563 0.396 0.604 0.000 0.000
#> SRR934637      1   0.461     0.6755 0.800 0.100 0.000 0.100
#> SRR925729      4   0.522     0.5597 0.000 0.200 0.064 0.736
#> SRR934638      1   0.000     0.8016 1.000 0.000 0.000 0.000
#> SRR934639      4   0.000     0.9039 0.000 0.000 0.000 1.000
#> SRR934640      2   0.361     0.9558 0.200 0.800 0.000 0.000
#> SRR934641      2   0.483     0.6761 0.392 0.608 0.000 0.000
#> SRR925734      1   0.000     0.8016 1.000 0.000 0.000 0.000
#> SRR925735      4   0.118     0.8766 0.000 0.016 0.016 0.968
#> SRR925736      3   0.700     0.7996 0.000 0.200 0.580 0.220
#> SRR925737      3   0.700     0.7996 0.000 0.200 0.580 0.220
#> SRR934642      2   0.361     0.9558 0.200 0.800 0.000 0.000
#> SRR934643      2   0.361     0.9558 0.200 0.800 0.000 0.000
#> SRR934644      2   0.361     0.9558 0.200 0.800 0.000 0.000
#> SRR934645      1   0.436     0.2662 0.708 0.292 0.000 0.000
#> SRR925740      3   0.700     0.7996 0.000 0.200 0.580 0.220
#> SRR925741      3   0.369     0.7460 0.000 0.000 0.792 0.208
#> SRR925742      3   0.700     0.7996 0.000 0.200 0.580 0.220
#> SRR1283038     3   0.700     0.7996 0.000 0.200 0.580 0.220

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>            class entropy silhouette    p1    p2    p3    p4    p5
#> SRR925687      4  0.0000      0.982 0.000 0.000 0.000 1.000 0.000
#> SRR925688      4  0.0000      0.982 0.000 0.000 0.000 1.000 0.000
#> SRR925689      1  0.0000      0.888 1.000 0.000 0.000 0.000 0.000
#> SRR925690      1  0.0000      0.888 1.000 0.000 0.000 0.000 0.000
#> SRR925691      1  0.0000      0.888 1.000 0.000 0.000 0.000 0.000
#> SRR925692      1  0.0000      0.888 1.000 0.000 0.000 0.000 0.000
#> SRR925693      5  0.3109      0.820 0.000 0.000 0.200 0.000 0.800
#> SRR925694      2  0.0000      0.940 0.000 1.000 0.000 0.000 0.000
#> SRR925695      5  0.3109      0.820 0.000 0.000 0.200 0.000 0.800
#> SRR925697      4  0.0000      0.982 0.000 0.000 0.000 1.000 0.000
#> SRR925696      3  0.0000      0.967 0.000 0.000 1.000 0.000 0.000
#> SRR925698      3  0.3274      0.686 0.000 0.000 0.780 0.000 0.220
#> SRR925699      2  0.0000      0.940 0.000 1.000 0.000 0.000 0.000
#> SRR925700      2  0.0000      0.940 0.000 1.000 0.000 0.000 0.000
#> SRR925701      2  0.0000      0.940 0.000 1.000 0.000 0.000 0.000
#> SRR925702      4  0.0000      0.982 0.000 0.000 0.000 1.000 0.000
#> SRR925703      5  0.3177      0.781 0.000 0.000 0.000 0.208 0.792
#> SRR925704      3  0.0290      0.963 0.000 0.000 0.992 0.008 0.000
#> SRR925705      3  0.0000      0.967 0.000 0.000 1.000 0.000 0.000
#> SRR925706      4  0.0000      0.982 0.000 0.000 0.000 1.000 0.000
#> SRR925708      4  0.0000      0.982 0.000 0.000 0.000 1.000 0.000
#> SRR925707      1  0.0162      0.885 0.996 0.000 0.004 0.000 0.000
#> SRR925709      4  0.0000      0.982 0.000 0.000 0.000 1.000 0.000
#> SRR925710      4  0.0000      0.982 0.000 0.000 0.000 1.000 0.000
#> SRR925711      3  0.1168      0.947 0.000 0.000 0.960 0.008 0.032
#> SRR934631      2  0.0000      0.940 0.000 1.000 0.000 0.000 0.000
#> SRR934632      2  0.0000      0.940 0.000 1.000 0.000 0.000 0.000
#> SRR934633      3  0.0000      0.967 0.000 0.000 1.000 0.000 0.000
#> SRR925713      4  0.1965      0.878 0.000 0.000 0.000 0.904 0.096
#> SRR925714      5  0.3109      0.789 0.000 0.000 0.000 0.200 0.800
#> SRR925715      4  0.1121      0.940 0.000 0.000 0.044 0.956 0.000
#> SRR925716      4  0.0000      0.982 0.000 0.000 0.000 1.000 0.000
#> SRR925717      5  0.3109      0.789 0.000 0.000 0.000 0.200 0.800
#> SRR925718      2  0.0000      0.940 0.000 1.000 0.000 0.000 0.000
#> SRR925719      4  0.0000      0.982 0.000 0.000 0.000 1.000 0.000
#> SRR925720      4  0.0000      0.982 0.000 0.000 0.000 1.000 0.000
#> SRR925721      4  0.0000      0.982 0.000 0.000 0.000 1.000 0.000
#> SRR934634      1  0.3177      0.682 0.792 0.208 0.000 0.000 0.000
#> SRR934635      1  0.0000      0.888 1.000 0.000 0.000 0.000 0.000
#> SRR925723      3  0.0290      0.963 0.000 0.000 0.992 0.008 0.000
#> SRR925724      3  0.1043      0.943 0.000 0.000 0.960 0.000 0.040
#> SRR925725      5  0.3109      0.820 0.000 0.000 0.200 0.000 0.800
#> SRR925726      4  0.0000      0.982 0.000 0.000 0.000 1.000 0.000
#> SRR925727      5  0.3109      0.820 0.000 0.000 0.200 0.000 0.800
#> SRR925728      1  0.5068      0.316 0.572 0.000 0.040 0.388 0.000
#> SRR934636      2  0.3074      0.739 0.196 0.804 0.000 0.000 0.000
#> SRR934637      1  0.0000      0.888 1.000 0.000 0.000 0.000 0.000
#> SRR925729      4  0.1965      0.870 0.000 0.000 0.096 0.904 0.000
#> SRR934638      1  0.0000      0.888 1.000 0.000 0.000 0.000 0.000
#> SRR934639      4  0.0000      0.982 0.000 0.000 0.000 1.000 0.000
#> SRR934640      2  0.3109      0.811 0.000 0.800 0.000 0.000 0.200
#> SRR934641      2  0.5848      0.581 0.192 0.608 0.000 0.000 0.200
#> SRR925734      1  0.0000      0.888 1.000 0.000 0.000 0.000 0.000
#> SRR925735      4  0.0510      0.967 0.000 0.000 0.016 0.984 0.000
#> SRR925736      3  0.0000      0.967 0.000 0.000 1.000 0.000 0.000
#> SRR925737      3  0.0510      0.955 0.000 0.000 0.984 0.016 0.000
#> SRR934642      2  0.0000      0.940 0.000 1.000 0.000 0.000 0.000
#> SRR934643      2  0.0000      0.940 0.000 1.000 0.000 0.000 0.000
#> SRR934644      2  0.0000      0.940 0.000 1.000 0.000 0.000 0.000
#> SRR934645      1  0.4161      0.319 0.608 0.392 0.000 0.000 0.000
#> SRR925740      3  0.0000      0.967 0.000 0.000 1.000 0.000 0.000
#> SRR925741      3  0.1168      0.947 0.000 0.000 0.960 0.008 0.032
#> SRR925742      3  0.0000      0.967 0.000 0.000 1.000 0.000 0.000
#> SRR1283038     3  0.0000      0.967 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
#> SRR925687      4  0.0000      0.967 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR925688      4  0.0146      0.965 0.000 0.000 0.000 0.996 0.000 0.004
#> SRR925689      1  0.0146      0.860 0.996 0.000 0.000 0.000 0.000 0.004
#> SRR925690      1  0.0000      0.863 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR925691      1  0.0000      0.863 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR925692      1  0.0000      0.863 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR925693      5  0.0000      0.929 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR925694      2  0.0000      0.961 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR925695      5  0.0260      0.923 0.000 0.000 0.008 0.000 0.992 0.000
#> SRR925697      4  0.0000      0.967 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR925696      3  0.0000      0.847 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR925698      3  0.3547      0.612 0.000 0.000 0.668 0.000 0.332 0.000
#> SRR925699      2  0.0458      0.957 0.000 0.984 0.000 0.000 0.000 0.016
#> SRR925700      2  0.0458      0.957 0.000 0.984 0.000 0.000 0.000 0.016
#> SRR925701      2  0.0000      0.961 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR925702      4  0.0000      0.967 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR925703      5  0.2854      0.646 0.000 0.000 0.000 0.208 0.792 0.000
#> SRR925704      3  0.0146      0.846 0.000 0.000 0.996 0.004 0.000 0.000
#> SRR925705      3  0.0260      0.847 0.000 0.000 0.992 0.000 0.000 0.008
#> SRR925706      4  0.0000      0.967 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR925708      4  0.0000      0.967 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR925707      1  0.1075      0.827 0.952 0.000 0.000 0.000 0.000 0.048
#> SRR925709      4  0.0000      0.967 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR925710      4  0.0000      0.967 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR925711      3  0.2520      0.774 0.000 0.000 0.844 0.004 0.152 0.000
#> SRR934631      2  0.0000      0.961 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR934632      2  0.0000      0.961 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR934633      3  0.2762      0.818 0.000 0.000 0.804 0.000 0.000 0.196
#> SRR925713      4  0.1765      0.875 0.000 0.000 0.000 0.904 0.096 0.000
#> SRR925714      5  0.1007      0.891 0.000 0.000 0.000 0.044 0.956 0.000
#> SRR925715      4  0.1141      0.925 0.000 0.000 0.052 0.948 0.000 0.000
#> SRR925716      4  0.0000      0.967 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR925717      5  0.0000      0.929 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR925718      2  0.0458      0.957 0.000 0.984 0.000 0.000 0.000 0.016
#> SRR925719      4  0.0000      0.967 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR925720      4  0.0000      0.967 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR925721      4  0.0260      0.962 0.000 0.000 0.000 0.992 0.000 0.008
#> SRR934634      1  0.3168      0.614 0.792 0.192 0.000 0.000 0.000 0.016
#> SRR934635      1  0.0000      0.863 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR925723      3  0.0146      0.846 0.000 0.000 0.996 0.004 0.000 0.000
#> SRR925724      3  0.2416      0.773 0.000 0.000 0.844 0.000 0.156 0.000
#> SRR925725      5  0.0000      0.929 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR925726      4  0.0000      0.967 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR925727      5  0.0000      0.929 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR925728      1  0.6135      0.302 0.564 0.000 0.044 0.196 0.000 0.196
#> SRR934636      2  0.2762      0.648 0.196 0.804 0.000 0.000 0.000 0.000
#> SRR934637      1  0.0000      0.863 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR925729      4  0.3104      0.739 0.000 0.000 0.184 0.800 0.000 0.016
#> SRR934638      1  0.0000      0.863 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR934639      4  0.0000      0.967 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR934640      6  0.2762      0.701 0.000 0.196 0.000 0.000 0.000 0.804
#> SRR934641      6  0.3168      0.702 0.172 0.024 0.000 0.000 0.000 0.804
#> SRR925734      1  0.0000      0.863 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR925735      4  0.2003      0.851 0.000 0.000 0.116 0.884 0.000 0.000
#> SRR925736      3  0.2762      0.818 0.000 0.000 0.804 0.000 0.000 0.196
#> SRR925737      3  0.2762      0.818 0.000 0.000 0.804 0.000 0.000 0.196
#> SRR934642      2  0.0000      0.961 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR934643      2  0.0713      0.948 0.000 0.972 0.000 0.000 0.000 0.028
#> SRR934644      2  0.0000      0.961 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR934645      1  0.3881      0.231 0.600 0.396 0.000 0.000 0.000 0.004
#> SRR925740      3  0.2762      0.818 0.000 0.000 0.804 0.000 0.000 0.196
#> SRR925741      3  0.2520      0.774 0.000 0.000 0.844 0.004 0.152 0.000
#> SRR925742      3  0.2762      0.818 0.000 0.000 0.804 0.000 0.000 0.196
#> SRR1283038     3  0.0632      0.847 0.000 0.000 0.976 0.000 0.000 0.024

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

consensus_heatmap(res, k = 2)

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

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

collect_plots(res)

plot of chunk ATC-mclust-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.492           0.820       0.846         0.4225 0.493   0.493
#> 3 3 0.607           0.855       0.898         0.4844 0.842   0.684
#> 4 4 0.676           0.721       0.826         0.1554 0.826   0.573
#> 5 5 0.779           0.680       0.846         0.0830 0.870   0.591
#> 6 6 0.773           0.597       0.769         0.0458 0.872   0.527

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
#> SRR925687      1  0.0000      0.960 1.000 0.000
#> SRR925688      1  0.0000      0.960 1.000 0.000
#> SRR925689      1  0.1843      0.950 0.972 0.028
#> SRR925690      1  0.1843      0.950 0.972 0.028
#> SRR925691      1  0.1843      0.950 0.972 0.028
#> SRR925692      1  0.1843      0.950 0.972 0.028
#> SRR925693      2  0.9754      0.771 0.408 0.592
#> SRR925694      2  0.0000      0.652 0.000 1.000
#> SRR925695      2  0.9754      0.771 0.408 0.592
#> SRR925697      1  0.0000      0.960 1.000 0.000
#> SRR925696      2  0.9754      0.771 0.408 0.592
#> SRR925698      2  0.9754      0.771 0.408 0.592
#> SRR925699      2  0.0672      0.656 0.008 0.992
#> SRR925700      2  0.0672      0.656 0.008 0.992
#> SRR925701      2  0.0000      0.652 0.000 1.000
#> SRR925702      1  0.0938      0.961 0.988 0.012
#> SRR925703      1  0.0000      0.960 1.000 0.000
#> SRR925704      2  0.9754      0.771 0.408 0.592
#> SRR925705      2  0.9754      0.771 0.408 0.592
#> SRR925706      1  0.0000      0.960 1.000 0.000
#> SRR925708      1  0.0376      0.960 0.996 0.004
#> SRR925707      1  0.9833     -0.307 0.576 0.424
#> SRR925709      1  0.0938      0.961 0.988 0.012
#> SRR925710      1  0.0000      0.960 1.000 0.000
#> SRR925711      2  0.9754      0.771 0.408 0.592
#> SRR934631      2  0.0000      0.652 0.000 1.000
#> SRR934632      2  0.0000      0.652 0.000 1.000
#> SRR934633      2  0.9754      0.771 0.408 0.592
#> SRR925713      1  0.0000      0.960 1.000 0.000
#> SRR925714      1  0.0000      0.960 1.000 0.000
#> SRR925715      1  0.0672      0.953 0.992 0.008
#> SRR925716      1  0.0938      0.961 0.988 0.012
#> SRR925717      1  0.0000      0.960 1.000 0.000
#> SRR925718      2  0.0672      0.656 0.008 0.992
#> SRR925719      1  0.0938      0.961 0.988 0.012
#> SRR925720      1  0.0000      0.960 1.000 0.000
#> SRR925721      1  0.0000      0.960 1.000 0.000
#> SRR934634      1  0.1414      0.957 0.980 0.020
#> SRR934635      1  0.1414      0.957 0.980 0.020
#> SRR925723      2  0.9754      0.771 0.408 0.592
#> SRR925724      2  0.9754      0.771 0.408 0.592
#> SRR925725      2  0.9754      0.771 0.408 0.592
#> SRR925726      1  0.0000      0.960 1.000 0.000
#> SRR925727      2  0.9754      0.771 0.408 0.592
#> SRR925728      1  0.1184      0.959 0.984 0.016
#> SRR934636      1  0.5178      0.825 0.884 0.116
#> SRR934637      1  0.1184      0.959 0.984 0.016
#> SRR925729      2  0.9775      0.765 0.412 0.588
#> SRR934638      1  0.1414      0.957 0.980 0.020
#> SRR934639      1  0.0938      0.961 0.988 0.012
#> SRR934640      2  0.8016      0.726 0.244 0.756
#> SRR934641      2  0.8144      0.729 0.252 0.748
#> SRR925734      1  0.1414      0.957 0.980 0.020
#> SRR925735      2  0.9775      0.765 0.412 0.588
#> SRR925736      2  0.9754      0.771 0.408 0.592
#> SRR925737      2  0.9754      0.771 0.408 0.592
#> SRR934642      2  0.0000      0.652 0.000 1.000
#> SRR934643      2  0.0672      0.656 0.008 0.992
#> SRR934644      2  0.0000      0.652 0.000 1.000
#> SRR934645      2  0.9286      0.752 0.344 0.656
#> SRR925740      2  0.9754      0.771 0.408 0.592
#> SRR925741      2  0.9754      0.771 0.408 0.592
#> SRR925742      2  0.9754      0.771 0.408 0.592
#> SRR1283038     2  0.9754      0.771 0.408 0.592

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>            class entropy silhouette    p1    p2    p3
#> SRR925687      1  0.3686      0.906 0.860 0.000 0.140
#> SRR925688      1  0.4291      0.872 0.820 0.000 0.180
#> SRR925689      1  0.1643      0.869 0.956 0.044 0.000
#> SRR925690      1  0.1643      0.869 0.956 0.044 0.000
#> SRR925691      1  0.1643      0.869 0.956 0.044 0.000
#> SRR925692      1  0.1643      0.869 0.956 0.044 0.000
#> SRR925693      3  0.0000      0.965 0.000 0.000 1.000
#> SRR925694      2  0.0237      0.841 0.000 0.996 0.004
#> SRR925695      3  0.0000      0.965 0.000 0.000 1.000
#> SRR925697      1  0.3551      0.909 0.868 0.000 0.132
#> SRR925696      3  0.0000      0.965 0.000 0.000 1.000
#> SRR925698      3  0.0000      0.965 0.000 0.000 1.000
#> SRR925699      2  0.0237      0.841 0.000 0.996 0.004
#> SRR925700      2  0.0237      0.841 0.000 0.996 0.004
#> SRR925701      2  0.0237      0.841 0.000 0.996 0.004
#> SRR925702      1  0.4413      0.912 0.860 0.036 0.104
#> SRR925703      1  0.3752      0.906 0.856 0.000 0.144
#> SRR925704      3  0.0000      0.965 0.000 0.000 1.000
#> SRR925705      3  0.0000      0.965 0.000 0.000 1.000
#> SRR925706      1  0.3816      0.904 0.852 0.000 0.148
#> SRR925708      1  0.4413      0.912 0.860 0.036 0.104
#> SRR925707      2  0.7749      0.542 0.300 0.624 0.076
#> SRR925709      1  0.4526      0.912 0.856 0.040 0.104
#> SRR925710      1  0.3686      0.906 0.860 0.000 0.140
#> SRR925711      3  0.1031      0.938 0.024 0.000 0.976
#> SRR934631      2  0.0237      0.841 0.000 0.996 0.004
#> SRR934632      2  0.0237      0.841 0.000 0.996 0.004
#> SRR934633      3  0.0424      0.960 0.008 0.000 0.992
#> SRR925713      1  0.3686      0.906 0.860 0.000 0.140
#> SRR925714      1  0.3752      0.906 0.856 0.000 0.144
#> SRR925715      1  0.4062      0.891 0.836 0.000 0.164
#> SRR925716      1  0.4413      0.912 0.860 0.036 0.104
#> SRR925717      1  0.3752      0.906 0.856 0.000 0.144
#> SRR925718      2  0.0237      0.841 0.000 0.996 0.004
#> SRR925719      1  0.4489      0.912 0.856 0.036 0.108
#> SRR925720      1  0.3816      0.902 0.852 0.000 0.148
#> SRR925721      1  0.4062      0.889 0.836 0.000 0.164
#> SRR934634      1  0.1950      0.875 0.952 0.040 0.008
#> SRR934635      1  0.1529      0.870 0.960 0.040 0.000
#> SRR925723      3  0.0424      0.959 0.008 0.000 0.992
#> SRR925724      3  0.0000      0.965 0.000 0.000 1.000
#> SRR925725      3  0.0000      0.965 0.000 0.000 1.000
#> SRR925726      1  0.3551      0.909 0.868 0.000 0.132
#> SRR925727      3  0.0000      0.965 0.000 0.000 1.000
#> SRR925728      1  0.4676      0.912 0.848 0.040 0.112
#> SRR934636      1  0.3752      0.801 0.856 0.144 0.000
#> SRR934637      1  0.1950      0.875 0.952 0.040 0.008
#> SRR925729      2  0.9001      0.487 0.172 0.548 0.280
#> SRR934638      1  0.1878      0.871 0.952 0.044 0.004
#> SRR934639      1  0.4413      0.912 0.860 0.036 0.104
#> SRR934640      2  0.4485      0.768 0.020 0.844 0.136
#> SRR934641      2  0.4485      0.768 0.020 0.844 0.136
#> SRR925734      1  0.1643      0.869 0.956 0.044 0.000
#> SRR925735      2  0.9018      0.489 0.176 0.548 0.276
#> SRR925736      3  0.8067      0.336 0.100 0.284 0.616
#> SRR925737      2  0.9100      0.492 0.204 0.548 0.248
#> SRR934642      2  0.0237      0.841 0.000 0.996 0.004
#> SRR934643      2  0.0237      0.841 0.000 0.996 0.004
#> SRR934644      2  0.0237      0.841 0.000 0.996 0.004
#> SRR934645      2  0.3043      0.807 0.084 0.908 0.008
#> SRR925740      3  0.1643      0.925 0.044 0.000 0.956
#> SRR925741      3  0.0000      0.965 0.000 0.000 1.000
#> SRR925742      2  0.8625      0.476 0.124 0.560 0.316
#> SRR1283038     3  0.0000      0.965 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
#> SRR925687      4  0.4193      0.687 0.268 0.000 0.000 0.732
#> SRR925688      4  0.2623      0.644 0.064 0.000 0.028 0.908
#> SRR925689      1  0.3245      0.833 0.880 0.064 0.000 0.056
#> SRR925690      1  0.2926      0.844 0.896 0.048 0.000 0.056
#> SRR925691      1  0.3009      0.843 0.892 0.052 0.000 0.056
#> SRR925692      1  0.2926      0.844 0.896 0.048 0.000 0.056
#> SRR925693      3  0.0707      0.800 0.000 0.000 0.980 0.020
#> SRR925694      2  0.0188      0.994 0.000 0.996 0.004 0.000
#> SRR925695      3  0.0336      0.802 0.000 0.000 0.992 0.008
#> SRR925697      4  0.2149      0.723 0.088 0.000 0.000 0.912
#> SRR925696      3  0.0188      0.801 0.000 0.000 0.996 0.004
#> SRR925698      3  0.0336      0.802 0.000 0.000 0.992 0.008
#> SRR925699      2  0.0000      0.996 0.000 1.000 0.000 0.000
#> SRR925700      2  0.0188      0.994 0.000 0.996 0.004 0.000
#> SRR925701      2  0.0000      0.996 0.000 1.000 0.000 0.000
#> SRR925702      4  0.4605      0.637 0.336 0.000 0.000 0.664
#> SRR925703      4  0.1489      0.709 0.044 0.000 0.004 0.952
#> SRR925704      3  0.0000      0.800 0.000 0.000 1.000 0.000
#> SRR925705      3  0.0000      0.800 0.000 0.000 1.000 0.000
#> SRR925706      4  0.0657      0.698 0.012 0.000 0.004 0.984
#> SRR925708      4  0.4605      0.637 0.336 0.000 0.000 0.664
#> SRR925707      3  0.8785      0.393 0.164 0.272 0.476 0.088
#> SRR925709      4  0.4994      0.374 0.480 0.000 0.000 0.520
#> SRR925710      4  0.0336      0.702 0.008 0.000 0.000 0.992
#> SRR925711      3  0.0469      0.798 0.012 0.000 0.988 0.000
#> SRR934631      2  0.0000      0.996 0.000 1.000 0.000 0.000
#> SRR934632      2  0.0000      0.996 0.000 1.000 0.000 0.000
#> SRR934633      3  0.4567      0.757 0.032 0.008 0.792 0.168
#> SRR925713      4  0.0336      0.702 0.008 0.000 0.000 0.992
#> SRR925714      4  0.1209      0.709 0.032 0.000 0.004 0.964
#> SRR925715      4  0.0657      0.698 0.012 0.000 0.004 0.984
#> SRR925716      4  0.4564      0.638 0.328 0.000 0.000 0.672
#> SRR925717      4  0.0524      0.700 0.008 0.000 0.004 0.988
#> SRR925718      2  0.0188      0.994 0.000 0.996 0.004 0.000
#> SRR925719      4  0.4564      0.638 0.328 0.000 0.000 0.672
#> SRR925720      4  0.3444      0.714 0.184 0.000 0.000 0.816
#> SRR925721      4  0.3801      0.706 0.220 0.000 0.000 0.780
#> SRR934634      4  0.4933      0.491 0.432 0.000 0.000 0.568
#> SRR934635      4  0.4985      0.405 0.468 0.000 0.000 0.532
#> SRR925723      3  0.3873      0.741 0.000 0.000 0.772 0.228
#> SRR925724      3  0.0000      0.800 0.000 0.000 1.000 0.000
#> SRR925725      3  0.0469      0.799 0.000 0.000 0.988 0.012
#> SRR925726      4  0.2149      0.723 0.088 0.000 0.000 0.912
#> SRR925727      3  0.0336      0.802 0.000 0.000 0.992 0.008
#> SRR925728      1  0.7384     -0.062 0.436 0.140 0.004 0.420
#> SRR934636      4  0.7476      0.268 0.260 0.236 0.000 0.504
#> SRR934637      4  0.6055      0.497 0.372 0.052 0.000 0.576
#> SRR925729      3  0.7144      0.633 0.044 0.056 0.560 0.340
#> SRR934638      1  0.2647      0.781 0.880 0.000 0.000 0.120
#> SRR934639      4  0.4605      0.637 0.336 0.000 0.000 0.664
#> SRR934640      3  0.6152      0.278 0.008 0.464 0.496 0.032
#> SRR934641      3  0.6152      0.278 0.008 0.464 0.496 0.032
#> SRR925734      1  0.2469      0.793 0.892 0.000 0.000 0.108
#> SRR925735      3  0.7144      0.633 0.044 0.056 0.560 0.340
#> SRR925736      3  0.6865      0.662 0.040 0.052 0.600 0.308
#> SRR925737      3  0.7830      0.649 0.052 0.128 0.568 0.252
#> SRR934642      2  0.0000      0.996 0.000 1.000 0.000 0.000
#> SRR934643      2  0.0188      0.993 0.000 0.996 0.004 0.000
#> SRR934644      2  0.0000      0.996 0.000 1.000 0.000 0.000
#> SRR934645      2  0.0779      0.978 0.016 0.980 0.004 0.000
#> SRR925740      3  0.5684      0.715 0.032 0.020 0.696 0.252
#> SRR925741      3  0.0657      0.798 0.000 0.004 0.984 0.012
#> SRR925742      3  0.7956      0.651 0.060 0.156 0.576 0.208
#> SRR1283038     3  0.0000      0.800 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
#> SRR925687      4  0.1243     0.8604 0.008 0.000 0.004 0.960 0.028
#> SRR925688      4  0.4443     0.3664 0.000 0.000 0.004 0.524 0.472
#> SRR925689      1  0.1082     0.7006 0.964 0.008 0.000 0.000 0.028
#> SRR925690      1  0.1082     0.7006 0.964 0.008 0.000 0.000 0.028
#> SRR925691      1  0.1082     0.7006 0.964 0.008 0.000 0.000 0.028
#> SRR925692      1  0.1082     0.7006 0.964 0.008 0.000 0.000 0.028
#> SRR925693      3  0.4059     0.5052 0.004 0.000 0.700 0.004 0.292
#> SRR925694      2  0.0000     0.9155 0.000 1.000 0.000 0.000 0.000
#> SRR925695      3  0.3766     0.5435 0.000 0.000 0.728 0.004 0.268
#> SRR925697      4  0.0451     0.8626 0.000 0.000 0.004 0.988 0.008
#> SRR925696      3  0.0324     0.7788 0.004 0.000 0.992 0.000 0.004
#> SRR925698      3  0.0324     0.7791 0.004 0.000 0.992 0.004 0.000
#> SRR925699      2  0.0000     0.9155 0.000 1.000 0.000 0.000 0.000
#> SRR925700      2  0.0000     0.9155 0.000 1.000 0.000 0.000 0.000
#> SRR925701      2  0.0000     0.9155 0.000 1.000 0.000 0.000 0.000
#> SRR925702      4  0.2879     0.7946 0.100 0.000 0.000 0.868 0.032
#> SRR925703      4  0.0693     0.8610 0.000 0.000 0.008 0.980 0.012
#> SRR925704      3  0.0290     0.7773 0.000 0.000 0.992 0.000 0.008
#> SRR925705      3  0.0162     0.7782 0.000 0.000 0.996 0.000 0.004
#> SRR925706      4  0.1942     0.8349 0.000 0.000 0.012 0.920 0.068
#> SRR925708      4  0.2879     0.7946 0.100 0.000 0.000 0.868 0.032
#> SRR925707      1  0.5966     0.1768 0.532 0.016 0.060 0.004 0.388
#> SRR925709      1  0.5178     0.0271 0.484 0.000 0.000 0.476 0.040
#> SRR925710      4  0.0671     0.8622 0.000 0.000 0.004 0.980 0.016
#> SRR925711      3  0.0566     0.7735 0.000 0.012 0.984 0.000 0.004
#> SRR934631      2  0.0000     0.9155 0.000 1.000 0.000 0.000 0.000
#> SRR934632      2  0.0000     0.9155 0.000 1.000 0.000 0.000 0.000
#> SRR934633      3  0.3840     0.5986 0.000 0.116 0.808 0.000 0.076
#> SRR925713      4  0.0798     0.8619 0.000 0.000 0.008 0.976 0.016
#> SRR925714      4  0.0807     0.8618 0.000 0.000 0.012 0.976 0.012
#> SRR925715      4  0.2864     0.7783 0.000 0.000 0.012 0.852 0.136
#> SRR925716      4  0.3301     0.7929 0.080 0.000 0.000 0.848 0.072
#> SRR925717      4  0.0807     0.8618 0.000 0.000 0.012 0.976 0.012
#> SRR925718      2  0.0000     0.9155 0.000 1.000 0.000 0.000 0.000
#> SRR925719      4  0.1661     0.8406 0.036 0.000 0.000 0.940 0.024
#> SRR925720      4  0.0955     0.8604 0.000 0.000 0.004 0.968 0.028
#> SRR925721      4  0.2890     0.7736 0.000 0.000 0.004 0.836 0.160
#> SRR934634      1  0.6315     0.2123 0.468 0.000 0.000 0.372 0.160
#> SRR934635      1  0.5730     0.3909 0.576 0.000 0.000 0.316 0.108
#> SRR925723      3  0.1012     0.7603 0.000 0.000 0.968 0.020 0.012
#> SRR925724      3  0.0000     0.7787 0.000 0.000 1.000 0.000 0.000
#> SRR925725      3  0.4037     0.5209 0.004 0.000 0.704 0.004 0.288
#> SRR925726      4  0.0451     0.8626 0.000 0.000 0.004 0.988 0.008
#> SRR925727      3  0.1732     0.7438 0.000 0.000 0.920 0.000 0.080
#> SRR925728      1  0.3975     0.6544 0.792 0.000 0.000 0.144 0.064
#> SRR934636      1  0.8360     0.1987 0.328 0.192 0.000 0.312 0.168
#> SRR934637      4  0.6637    -0.2083 0.392 0.004 0.000 0.416 0.188
#> SRR925729      5  0.4180     0.7782 0.000 0.000 0.220 0.036 0.744
#> SRR934638      1  0.0771     0.6971 0.976 0.000 0.000 0.004 0.020
#> SRR934639      4  0.2769     0.8009 0.092 0.000 0.000 0.876 0.032
#> SRR934640      2  0.5431     0.2344 0.000 0.516 0.060 0.000 0.424
#> SRR934641      2  0.5431     0.2344 0.000 0.516 0.060 0.000 0.424
#> SRR925734      1  0.0404     0.6982 0.988 0.000 0.000 0.000 0.012
#> SRR925735      5  0.4180     0.7782 0.000 0.000 0.220 0.036 0.744
#> SRR925736      3  0.4900    -0.5536 0.000 0.000 0.512 0.024 0.464
#> SRR925737      5  0.4798     0.7382 0.000 0.000 0.396 0.024 0.580
#> SRR934642      2  0.0000     0.9155 0.000 1.000 0.000 0.000 0.000
#> SRR934643      2  0.0000     0.9155 0.000 1.000 0.000 0.000 0.000
#> SRR934644      2  0.0000     0.9155 0.000 1.000 0.000 0.000 0.000
#> SRR934645      2  0.0162     0.9120 0.004 0.996 0.000 0.000 0.000
#> SRR925740      3  0.2079     0.7242 0.000 0.000 0.916 0.020 0.064
#> SRR925741      3  0.4162     0.4900 0.004 0.000 0.680 0.004 0.312
#> SRR925742      5  0.4817     0.7254 0.000 0.000 0.404 0.024 0.572
#> SRR1283038     3  0.0162     0.7782 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
#> SRR925687      4  0.3888     0.7228 0.032 0.000 0.000 0.716 0.252 0.000
#> SRR925688      5  0.4595     0.3881 0.000 0.000 0.000 0.248 0.668 0.084
#> SRR925689      1  0.0922     0.6252 0.968 0.024 0.000 0.000 0.004 0.004
#> SRR925690      1  0.0520     0.6307 0.984 0.008 0.000 0.000 0.000 0.008
#> SRR925691      1  0.0520     0.6307 0.984 0.008 0.000 0.000 0.000 0.008
#> SRR925692      1  0.0520     0.6307 0.984 0.008 0.000 0.000 0.000 0.008
#> SRR925693      6  0.3620     0.8580 0.000 0.000 0.352 0.000 0.000 0.648
#> SRR925694      2  0.0146     0.9303 0.000 0.996 0.000 0.000 0.004 0.000
#> SRR925695      6  0.3833     0.8841 0.000 0.000 0.444 0.000 0.000 0.556
#> SRR925697      4  0.2941     0.7651 0.000 0.000 0.000 0.780 0.220 0.000
#> SRR925696      3  0.0865     0.5357 0.000 0.000 0.964 0.000 0.000 0.036
#> SRR925698      3  0.0937     0.5349 0.000 0.000 0.960 0.000 0.000 0.040
#> SRR925699      2  0.0146     0.9303 0.000 0.996 0.000 0.000 0.004 0.000
#> SRR925700      2  0.0146     0.9303 0.000 0.996 0.000 0.000 0.004 0.000
#> SRR925701      2  0.0000     0.9305 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR925702      1  0.5826     0.2865 0.436 0.000 0.000 0.376 0.188 0.000
#> SRR925703      4  0.1890     0.7855 0.000 0.000 0.000 0.916 0.024 0.060
#> SRR925704      3  0.1501     0.4817 0.000 0.000 0.924 0.000 0.000 0.076
#> SRR925705      3  0.0458     0.5409 0.000 0.000 0.984 0.000 0.000 0.016
#> SRR925706      4  0.1838     0.7593 0.000 0.000 0.000 0.916 0.068 0.016
#> SRR925708      1  0.5832     0.2655 0.428 0.000 0.000 0.384 0.188 0.000
#> SRR925707      1  0.6414     0.3260 0.616 0.068 0.012 0.012 0.144 0.148
#> SRR925709      1  0.4516     0.4706 0.668 0.000 0.000 0.260 0.072 0.000
#> SRR925710      4  0.1863     0.7985 0.000 0.000 0.000 0.896 0.104 0.000
#> SRR925711      3  0.2631     0.4876 0.000 0.000 0.820 0.000 0.000 0.180
#> SRR934631      2  0.0000     0.9305 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR934632      2  0.0000     0.9305 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR934633      3  0.4050     0.5257 0.000 0.040 0.812 0.020 0.052 0.076
#> SRR925713      4  0.1152     0.7994 0.000 0.000 0.000 0.952 0.044 0.004
#> SRR925714      4  0.1524     0.7876 0.000 0.000 0.000 0.932 0.008 0.060
#> SRR925715      4  0.2966     0.7045 0.000 0.000 0.000 0.848 0.076 0.076
#> SRR925716      1  0.5916     0.2987 0.444 0.000 0.000 0.336 0.220 0.000
#> SRR925717      4  0.1267     0.7853 0.000 0.000 0.000 0.940 0.000 0.060
#> SRR925718      2  0.0146     0.9303 0.000 0.996 0.000 0.000 0.004 0.000
#> SRR925719      4  0.4244     0.6189 0.080 0.000 0.000 0.720 0.200 0.000
#> SRR925720      4  0.3175     0.7447 0.000 0.000 0.000 0.744 0.256 0.000
#> SRR925721      5  0.3482     0.2371 0.000 0.000 0.000 0.316 0.684 0.000
#> SRR934634      1  0.4735    -0.0503 0.520 0.000 0.000 0.048 0.432 0.000
#> SRR934635      1  0.2485     0.5961 0.892 0.000 0.000 0.040 0.056 0.012
#> SRR925723      3  0.1635     0.5590 0.000 0.000 0.940 0.020 0.020 0.020
#> SRR925724      3  0.0790     0.5357 0.000 0.000 0.968 0.000 0.000 0.032
#> SRR925725      6  0.3774     0.9039 0.000 0.000 0.408 0.000 0.000 0.592
#> SRR925726      4  0.2912     0.7624 0.000 0.000 0.000 0.784 0.216 0.000
#> SRR925727      3  0.3854    -0.6115 0.000 0.000 0.536 0.000 0.000 0.464
#> SRR925728      1  0.2335     0.6173 0.904 0.000 0.000 0.044 0.024 0.028
#> SRR934636      5  0.6781     0.0318 0.356 0.188 0.000 0.040 0.408 0.008
#> SRR934637      1  0.4882    -0.0230 0.512 0.000 0.000 0.060 0.428 0.000
#> SRR925729      3  0.6674     0.4237 0.000 0.000 0.396 0.040 0.344 0.220
#> SRR934638      1  0.0146     0.6304 0.996 0.000 0.000 0.004 0.000 0.000
#> SRR934639      1  0.5841     0.2874 0.436 0.000 0.000 0.372 0.192 0.000
#> SRR934640      2  0.5237     0.4975 0.000 0.600 0.004 0.000 0.276 0.120
#> SRR934641      2  0.5237     0.4975 0.000 0.600 0.004 0.000 0.276 0.120
#> SRR925734      1  0.0000     0.6295 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR925735      3  0.6644     0.4243 0.000 0.000 0.396 0.036 0.340 0.228
#> SRR925736      3  0.6289     0.4681 0.000 0.000 0.480 0.024 0.288 0.208
#> SRR925737      3  0.6905     0.4454 0.000 0.020 0.424 0.032 0.328 0.196
#> SRR934642      2  0.0000     0.9305 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR934643      2  0.0000     0.9305 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR934644      2  0.0000     0.9305 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR934645      2  0.0146     0.9303 0.000 0.996 0.000 0.000 0.004 0.000
#> SRR925740      3  0.3693     0.5506 0.000 0.000 0.812 0.020 0.072 0.096
#> SRR925741      6  0.3862     0.8884 0.000 0.000 0.388 0.000 0.004 0.608
#> SRR925742      3  0.6817     0.4462 0.000 0.020 0.424 0.024 0.328 0.204
#> SRR1283038     3  0.0547     0.5398 0.000 0.000 0.980 0.000 0.000 0.020

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 15949 rows and 64 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.967           0.950       0.974         0.4515 0.542   0.542
#> 3 3 0.901           0.906       0.959         0.4303 0.694   0.488
#> 4 4 0.546           0.552       0.730         0.1156 0.911   0.767
#> 5 5 0.551           0.431       0.708         0.0675 0.853   0.589
#> 6 6 0.595           0.544       0.763         0.0359 0.876   0.573

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
#> SRR925687      1  0.1184      0.983 0.984 0.016
#> SRR925688      1  0.0938      0.985 0.988 0.012
#> SRR925689      2  0.0000      0.948 0.000 1.000
#> SRR925690      2  0.7219      0.764 0.200 0.800
#> SRR925691      2  0.8443      0.653 0.272 0.728
#> SRR925692      2  0.0000      0.948 0.000 1.000
#> SRR925693      1  0.0000      0.985 1.000 0.000
#> SRR925694      2  0.0000      0.948 0.000 1.000
#> SRR925695      1  0.0000      0.985 1.000 0.000
#> SRR925697      1  0.0938      0.985 0.988 0.012
#> SRR925696      1  0.0000      0.985 1.000 0.000
#> SRR925698      1  0.0000      0.985 1.000 0.000
#> SRR925699      2  0.0376      0.947 0.004 0.996
#> SRR925700      2  0.0000      0.948 0.000 1.000
#> SRR925701      2  0.0938      0.945 0.012 0.988
#> SRR925702      1  0.1184      0.983 0.984 0.016
#> SRR925703      1  0.0938      0.985 0.988 0.012
#> SRR925704      1  0.0000      0.985 1.000 0.000
#> SRR925705      1  0.0000      0.985 1.000 0.000
#> SRR925706      1  0.0672      0.985 0.992 0.008
#> SRR925708      1  0.1184      0.983 0.984 0.016
#> SRR925707      1  0.8661      0.577 0.712 0.288
#> SRR925709      1  0.1184      0.983 0.984 0.016
#> SRR925710      1  0.0938      0.985 0.988 0.012
#> SRR925711      1  0.0000      0.985 1.000 0.000
#> SRR934631      2  0.0938      0.945 0.012 0.988
#> SRR934632      2  0.0938      0.945 0.012 0.988
#> SRR934633      1  0.2043      0.959 0.968 0.032
#> SRR925713      1  0.0938      0.985 0.988 0.012
#> SRR925714      1  0.0938      0.985 0.988 0.012
#> SRR925715      1  0.0376      0.985 0.996 0.004
#> SRR925716      1  0.1184      0.983 0.984 0.016
#> SRR925717      1  0.0938      0.985 0.988 0.012
#> SRR925718      2  0.0000      0.948 0.000 1.000
#> SRR925719      1  0.0938      0.985 0.988 0.012
#> SRR925720      1  0.0938      0.985 0.988 0.012
#> SRR925721      1  0.1184      0.983 0.984 0.016
#> SRR934634      2  0.0000      0.948 0.000 1.000
#> SRR934635      2  0.1414      0.939 0.020 0.980
#> SRR925723      1  0.0000      0.985 1.000 0.000
#> SRR925724      1  0.0000      0.985 1.000 0.000
#> SRR925725      1  0.0000      0.985 1.000 0.000
#> SRR925726      1  0.0938      0.985 0.988 0.012
#> SRR925727      1  0.0000      0.985 1.000 0.000
#> SRR925728      1  0.1184      0.983 0.984 0.016
#> SRR934636      2  0.0000      0.948 0.000 1.000
#> SRR934637      1  0.1414      0.981 0.980 0.020
#> SRR925729      1  0.0376      0.985 0.996 0.004
#> SRR934638      2  0.0000      0.948 0.000 1.000
#> SRR934639      1  0.1184      0.983 0.984 0.016
#> SRR934640      2  0.7299      0.770 0.204 0.796
#> SRR934641      2  0.8608      0.656 0.284 0.716
#> SRR925734      2  0.1843      0.934 0.028 0.972
#> SRR925735      1  0.0000      0.985 1.000 0.000
#> SRR925736      1  0.0000      0.985 1.000 0.000
#> SRR925737      1  0.0376      0.985 0.996 0.004
#> SRR934642      2  0.0000      0.948 0.000 1.000
#> SRR934643      2  0.1184      0.943 0.016 0.984
#> SRR934644      2  0.0672      0.946 0.008 0.992
#> SRR934645      2  0.0000      0.948 0.000 1.000
#> SRR925740      1  0.0000      0.985 1.000 0.000
#> SRR925741      1  0.0000      0.985 1.000 0.000
#> SRR925742      1  0.1184      0.979 0.984 0.016
#> SRR1283038     1  0.0000      0.985 1.000 0.000

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>            class entropy silhouette    p1    p2    p3
#> SRR925687      1  0.0000      0.961 1.000 0.000 0.000
#> SRR925688      3  0.2448      0.922 0.076 0.000 0.924
#> SRR925689      1  0.0592      0.951 0.988 0.012 0.000
#> SRR925690      1  0.0000      0.961 1.000 0.000 0.000
#> SRR925691      1  0.0000      0.961 1.000 0.000 0.000
#> SRR925692      1  0.0000      0.961 1.000 0.000 0.000
#> SRR925693      3  0.0000      0.970 0.000 0.000 1.000
#> SRR925694      2  0.0000      0.897 0.000 1.000 0.000
#> SRR925695      3  0.0000      0.970 0.000 0.000 1.000
#> SRR925697      1  0.3816      0.804 0.852 0.000 0.148
#> SRR925696      3  0.0000      0.970 0.000 0.000 1.000
#> SRR925698      3  0.0000      0.970 0.000 0.000 1.000
#> SRR925699      2  0.0000      0.897 0.000 1.000 0.000
#> SRR925700      2  0.0000      0.897 0.000 1.000 0.000
#> SRR925701      2  0.0000      0.897 0.000 1.000 0.000
#> SRR925702      1  0.0000      0.961 1.000 0.000 0.000
#> SRR925703      3  0.1860      0.941 0.052 0.000 0.948
#> SRR925704      3  0.0000      0.970 0.000 0.000 1.000
#> SRR925705      3  0.0000      0.970 0.000 0.000 1.000
#> SRR925706      3  0.1289      0.956 0.032 0.000 0.968
#> SRR925708      1  0.0000      0.961 1.000 0.000 0.000
#> SRR925707      1  0.8521      0.431 0.608 0.228 0.164
#> SRR925709      1  0.0000      0.961 1.000 0.000 0.000
#> SRR925710      3  0.3619      0.846 0.136 0.000 0.864
#> SRR925711      3  0.0000      0.970 0.000 0.000 1.000
#> SRR934631      2  0.0000      0.897 0.000 1.000 0.000
#> SRR934632      2  0.0000      0.897 0.000 1.000 0.000
#> SRR934633      3  0.3412      0.848 0.000 0.124 0.876
#> SRR925713      3  0.2356      0.925 0.072 0.000 0.928
#> SRR925714      3  0.2261      0.928 0.068 0.000 0.932
#> SRR925715      3  0.0892      0.963 0.020 0.000 0.980
#> SRR925716      1  0.0000      0.961 1.000 0.000 0.000
#> SRR925717      3  0.1163      0.958 0.028 0.000 0.972
#> SRR925718      2  0.0000      0.897 0.000 1.000 0.000
#> SRR925719      1  0.0000      0.961 1.000 0.000 0.000
#> SRR925720      1  0.0592      0.952 0.988 0.000 0.012
#> SRR925721      1  0.0000      0.961 1.000 0.000 0.000
#> SRR934634      1  0.0000      0.961 1.000 0.000 0.000
#> SRR934635      1  0.0000      0.961 1.000 0.000 0.000
#> SRR925723      3  0.0000      0.970 0.000 0.000 1.000
#> SRR925724      3  0.0000      0.970 0.000 0.000 1.000
#> SRR925725      3  0.0000      0.970 0.000 0.000 1.000
#> SRR925726      1  0.2625      0.882 0.916 0.000 0.084
#> SRR925727      3  0.0000      0.970 0.000 0.000 1.000
#> SRR925728      1  0.2356      0.893 0.928 0.000 0.072
#> SRR934636      2  0.6095      0.314 0.392 0.608 0.000
#> SRR934637      1  0.0000      0.961 1.000 0.000 0.000
#> SRR925729      3  0.0237      0.969 0.004 0.000 0.996
#> SRR934638      1  0.0000      0.961 1.000 0.000 0.000
#> SRR934639      1  0.0000      0.961 1.000 0.000 0.000
#> SRR934640      2  0.5363      0.621 0.000 0.724 0.276
#> SRR934641      2  0.6026      0.420 0.000 0.624 0.376
#> SRR925734      1  0.0000      0.961 1.000 0.000 0.000
#> SRR925735      3  0.0237      0.969 0.004 0.000 0.996
#> SRR925736      3  0.0000      0.970 0.000 0.000 1.000
#> SRR925737      3  0.0592      0.966 0.012 0.000 0.988
#> SRR934642      2  0.0000      0.897 0.000 1.000 0.000
#> SRR934643      2  0.0000      0.897 0.000 1.000 0.000
#> SRR934644      2  0.0000      0.897 0.000 1.000 0.000
#> SRR934645      2  0.4645      0.735 0.176 0.816 0.008
#> SRR925740      3  0.0424      0.966 0.000 0.008 0.992
#> SRR925741      3  0.0000      0.970 0.000 0.000 1.000
#> SRR925742      3  0.2584      0.918 0.008 0.064 0.928
#> SRR1283038     3  0.0000      0.970 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
#> SRR925687      1  0.5077     0.6468 0.760 0.000 0.160 0.080
#> SRR925688      1  0.7837     0.0499 0.408 0.000 0.300 0.292
#> SRR925689      1  0.5157     0.6772 0.688 0.028 0.000 0.284
#> SRR925690      1  0.4584     0.6814 0.696 0.004 0.000 0.300
#> SRR925691      1  0.4608     0.6806 0.692 0.004 0.000 0.304
#> SRR925692      1  0.4608     0.6806 0.692 0.004 0.000 0.304
#> SRR925693      3  0.3123     0.4240 0.000 0.000 0.844 0.156
#> SRR925694      2  0.0000     0.9408 0.000 1.000 0.000 0.000
#> SRR925695      3  0.3610     0.3367 0.000 0.000 0.800 0.200
#> SRR925697      1  0.6466     0.3967 0.588 0.000 0.320 0.092
#> SRR925696      3  0.3649     0.3290 0.000 0.000 0.796 0.204
#> SRR925698      3  0.1118     0.5187 0.000 0.000 0.964 0.036
#> SRR925699      2  0.2131     0.9149 0.016 0.936 0.008 0.040
#> SRR925700      2  0.1471     0.9265 0.012 0.960 0.004 0.024
#> SRR925701      2  0.0000     0.9408 0.000 1.000 0.000 0.000
#> SRR925702      1  0.5374     0.5629 0.704 0.000 0.244 0.052
#> SRR925703      3  0.6546     0.4292 0.172 0.000 0.636 0.192
#> SRR925704      3  0.4134     0.1863 0.000 0.000 0.740 0.260
#> SRR925705      3  0.2234     0.5251 0.008 0.004 0.924 0.064
#> SRR925706      3  0.6844     0.3553 0.152 0.000 0.588 0.260
#> SRR925708      1  0.4791     0.6839 0.784 0.000 0.136 0.080
#> SRR925707      3  0.9842    -0.0298 0.216 0.288 0.312 0.184
#> SRR925709      1  0.5700     0.6717 0.716 0.000 0.120 0.164
#> SRR925710      3  0.6928     0.3276 0.308 0.000 0.556 0.136
#> SRR925711      3  0.4193     0.1916 0.000 0.000 0.732 0.268
#> SRR934631      2  0.0336     0.9396 0.000 0.992 0.000 0.008
#> SRR934632      2  0.0336     0.9396 0.000 0.992 0.000 0.008
#> SRR934633      3  0.6722    -0.0851 0.000 0.200 0.616 0.184
#> SRR925713      3  0.6602     0.4076 0.208 0.000 0.628 0.164
#> SRR925714      3  0.6473     0.4405 0.188 0.000 0.644 0.168
#> SRR925715      3  0.6112     0.3791 0.096 0.000 0.656 0.248
#> SRR925716      1  0.1474     0.7368 0.948 0.000 0.000 0.052
#> SRR925717      3  0.5326     0.4985 0.136 0.000 0.748 0.116
#> SRR925718      2  0.0927     0.9351 0.000 0.976 0.008 0.016
#> SRR925719      1  0.3239     0.7242 0.880 0.000 0.068 0.052
#> SRR925720      1  0.5548     0.6027 0.716 0.000 0.200 0.084
#> SRR925721      1  0.2197     0.7277 0.916 0.000 0.004 0.080
#> SRR934634      1  0.3569     0.7113 0.804 0.000 0.000 0.196
#> SRR934635      1  0.3610     0.7111 0.800 0.000 0.000 0.200
#> SRR925723      3  0.1118     0.5283 0.000 0.000 0.964 0.036
#> SRR925724      3  0.2921     0.4236 0.000 0.000 0.860 0.140
#> SRR925725      3  0.4933    -0.2981 0.000 0.000 0.568 0.432
#> SRR925726      1  0.6242     0.4314 0.612 0.000 0.308 0.080
#> SRR925727      3  0.4250     0.1456 0.000 0.000 0.724 0.276
#> SRR925728      1  0.3820     0.7210 0.848 0.000 0.088 0.064
#> SRR934636      1  0.7390     0.3725 0.512 0.284 0.000 0.204
#> SRR934637      1  0.3311     0.7198 0.828 0.000 0.000 0.172
#> SRR925729      3  0.4700     0.5278 0.124 0.000 0.792 0.084
#> SRR934638      1  0.3400     0.7130 0.820 0.000 0.000 0.180
#> SRR934639      1  0.1356     0.7405 0.960 0.000 0.008 0.032
#> SRR934640      4  0.7437     0.6993 0.000 0.248 0.240 0.512
#> SRR934641      4  0.7387     0.7140 0.000 0.224 0.256 0.520
#> SRR925734      1  0.3907     0.7064 0.768 0.000 0.000 0.232
#> SRR925735      3  0.4549     0.5296 0.100 0.000 0.804 0.096
#> SRR925736      3  0.4134     0.5376 0.060 0.012 0.844 0.084
#> SRR925737      3  0.5601     0.5102 0.132 0.020 0.756 0.092
#> SRR934642      2  0.0188     0.9404 0.000 0.996 0.000 0.004
#> SRR934643      2  0.2759     0.8721 0.000 0.904 0.052 0.044
#> SRR934644      2  0.0188     0.9403 0.000 0.996 0.000 0.004
#> SRR934645      2  0.6764     0.6351 0.068 0.696 0.104 0.132
#> SRR925740      3  0.3725     0.4725 0.004 0.076 0.860 0.060
#> SRR925741      4  0.4999     0.2744 0.000 0.000 0.492 0.508
#> SRR925742      3  0.6017     0.3665 0.020 0.180 0.716 0.084
#> SRR1283038     3  0.3355     0.4118 0.000 0.004 0.836 0.160

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>            class entropy silhouette    p1    p2    p3    p4    p5
#> SRR925687      4  0.1800   0.588425 0.048 0.000 0.020 0.932 0.000
#> SRR925688      4  0.4419   0.528074 0.020 0.000 0.032 0.760 0.188
#> SRR925689      1  0.1408   0.817691 0.948 0.008 0.000 0.044 0.000
#> SRR925690      1  0.1830   0.815824 0.932 0.000 0.000 0.040 0.028
#> SRR925691      1  0.1648   0.818178 0.940 0.000 0.000 0.040 0.020
#> SRR925692      1  0.1725   0.819559 0.936 0.000 0.000 0.044 0.020
#> SRR925693      3  0.4129   0.290140 0.000 0.000 0.756 0.040 0.204
#> SRR925694      2  0.0162   0.841098 0.004 0.996 0.000 0.000 0.000
#> SRR925695      3  0.2605   0.321041 0.000 0.000 0.852 0.000 0.148
#> SRR925697      4  0.2811   0.593108 0.012 0.000 0.100 0.876 0.012
#> SRR925696      3  0.1704   0.418556 0.000 0.000 0.928 0.004 0.068
#> SRR925698      3  0.2561   0.483068 0.000 0.000 0.884 0.096 0.020
#> SRR925699      2  0.2548   0.802829 0.116 0.876 0.004 0.004 0.000
#> SRR925700      2  0.2338   0.805525 0.112 0.884 0.000 0.000 0.004
#> SRR925701      2  0.0000   0.840438 0.000 1.000 0.000 0.000 0.000
#> SRR925702      4  0.3926   0.576133 0.052 0.000 0.132 0.808 0.008
#> SRR925703      3  0.6485   0.243531 0.048 0.000 0.496 0.388 0.068
#> SRR925704      3  0.2424   0.328910 0.000 0.000 0.868 0.000 0.132
#> SRR925705      3  0.3953   0.484665 0.004 0.016 0.828 0.076 0.076
#> SRR925706      4  0.6615   0.048488 0.008 0.000 0.276 0.508 0.208
#> SRR925708      4  0.5636   0.088290 0.444 0.000 0.048 0.496 0.012
#> SRR925707      2  0.8780  -0.138147 0.064 0.340 0.328 0.200 0.068
#> SRR925709      1  0.4994   0.159601 0.576 0.000 0.012 0.396 0.016
#> SRR925710      4  0.6251  -0.087895 0.032 0.000 0.400 0.500 0.068
#> SRR925711      3  0.3578   0.252998 0.008 0.000 0.784 0.004 0.204
#> SRR934631      2  0.1074   0.834092 0.004 0.968 0.000 0.016 0.012
#> SRR934632      2  0.1074   0.834092 0.004 0.968 0.000 0.016 0.012
#> SRR934633      3  0.6434   0.181981 0.004 0.232 0.616 0.048 0.100
#> SRR925713      4  0.5940  -0.068657 0.004 0.000 0.384 0.516 0.096
#> SRR925714      3  0.6162   0.277602 0.028 0.000 0.516 0.388 0.068
#> SRR925715      5  0.6910   0.062720 0.008 0.000 0.284 0.272 0.436
#> SRR925716      4  0.4994   0.384359 0.184 0.000 0.000 0.704 0.112
#> SRR925717      3  0.5289   0.388877 0.004 0.000 0.620 0.316 0.060
#> SRR925718      2  0.1446   0.835772 0.036 0.952 0.004 0.004 0.004
#> SRR925719      4  0.4856   0.489264 0.228 0.000 0.056 0.708 0.008
#> SRR925720      4  0.2054   0.595935 0.028 0.000 0.052 0.920 0.000
#> SRR925721      4  0.3579   0.529625 0.072 0.000 0.000 0.828 0.100
#> SRR934634      1  0.4730   0.584229 0.688 0.000 0.000 0.260 0.052
#> SRR934635      1  0.3695   0.733414 0.800 0.000 0.000 0.164 0.036
#> SRR925723      3  0.3442   0.492952 0.000 0.000 0.836 0.104 0.060
#> SRR925724      3  0.2488   0.360668 0.000 0.000 0.872 0.004 0.124
#> SRR925725      3  0.4367  -0.336052 0.000 0.000 0.580 0.004 0.416
#> SRR925726      4  0.3433   0.574542 0.032 0.000 0.132 0.832 0.004
#> SRR925727      3  0.3730  -0.000155 0.000 0.000 0.712 0.000 0.288
#> SRR925728      4  0.5541   0.510967 0.164 0.000 0.040 0.704 0.092
#> SRR934636      4  0.8015  -0.084513 0.308 0.104 0.000 0.384 0.204
#> SRR934637      4  0.6402   0.102284 0.288 0.000 0.000 0.504 0.208
#> SRR925729      3  0.6136   0.265380 0.008 0.008 0.488 0.420 0.076
#> SRR934638      4  0.5694  -0.211901 0.456 0.000 0.000 0.464 0.080
#> SRR934639      4  0.4813   0.228957 0.376 0.000 0.004 0.600 0.020
#> SRR934640      5  0.5387   0.620010 0.004 0.096 0.220 0.004 0.676
#> SRR934641      5  0.5183   0.627636 0.004 0.072 0.236 0.004 0.684
#> SRR925734      1  0.2293   0.809521 0.900 0.000 0.000 0.084 0.016
#> SRR925735      3  0.5819   0.351281 0.004 0.000 0.540 0.368 0.088
#> SRR925736      3  0.6484   0.407847 0.008 0.024 0.556 0.316 0.096
#> SRR925737      3  0.7288   0.221276 0.016 0.068 0.436 0.404 0.076
#> SRR934642      2  0.0324   0.839645 0.004 0.992 0.000 0.000 0.004
#> SRR934643      2  0.3762   0.726964 0.008 0.832 0.100 0.004 0.056
#> SRR934644      2  0.0324   0.840200 0.004 0.992 0.000 0.000 0.004
#> SRR934645      2  0.5447   0.394444 0.396 0.552 0.040 0.000 0.012
#> SRR925740      3  0.6540   0.392664 0.008 0.140 0.652 0.092 0.108
#> SRR925741      5  0.4446   0.376587 0.000 0.000 0.476 0.004 0.520
#> SRR925742      3  0.7790   0.299258 0.012 0.232 0.480 0.208 0.068
#> SRR1283038     3  0.2880   0.389533 0.004 0.000 0.868 0.020 0.108

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>            class entropy silhouette    p1    p2    p3    p4    p5    p6
#> SRR925687      4  0.2944   5.96e-01 0.020 0.000 0.000 0.860 0.092 0.028
#> SRR925688      4  0.5043   4.27e-01 0.000 0.000 0.008 0.664 0.164 0.164
#> SRR925689      1  0.0603   7.28e-01 0.980 0.000 0.000 0.000 0.016 0.004
#> SRR925690      1  0.0291   7.31e-01 0.992 0.000 0.000 0.000 0.004 0.004
#> SRR925691      1  0.0291   7.31e-01 0.992 0.000 0.000 0.000 0.004 0.004
#> SRR925692      1  0.0000   7.31e-01 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR925693      3  0.2170   7.08e-01 0.000 0.000 0.908 0.016 0.016 0.060
#> SRR925694      2  0.0653   8.48e-01 0.012 0.980 0.000 0.000 0.004 0.004
#> SRR925695      3  0.1327   7.04e-01 0.000 0.000 0.936 0.000 0.000 0.064
#> SRR925697      4  0.3311   5.97e-01 0.016 0.000 0.032 0.836 0.112 0.004
#> SRR925696      3  0.2159   6.98e-01 0.000 0.000 0.904 0.012 0.012 0.072
#> SRR925698      3  0.1176   7.16e-01 0.000 0.000 0.956 0.024 0.000 0.020
#> SRR925699      2  0.3719   7.86e-01 0.120 0.820 0.020 0.008 0.016 0.016
#> SRR925700      2  0.3428   7.68e-01 0.148 0.816 0.004 0.008 0.016 0.008
#> SRR925701      2  0.0717   8.47e-01 0.016 0.976 0.000 0.000 0.008 0.000
#> SRR925702      4  0.3221   6.19e-01 0.040 0.000 0.032 0.864 0.048 0.016
#> SRR925703      3  0.6127   2.50e-01 0.020 0.000 0.528 0.340 0.076 0.036
#> SRR925704      3  0.1728   7.06e-01 0.000 0.000 0.924 0.008 0.004 0.064
#> SRR925705      3  0.2383   6.97e-01 0.000 0.016 0.908 0.016 0.020 0.040
#> SRR925706      4  0.5986   4.89e-01 0.000 0.000 0.176 0.616 0.088 0.120
#> SRR925708      4  0.4466   5.41e-01 0.236 0.000 0.016 0.708 0.032 0.008
#> SRR925707      2  0.7909  -3.95e-02 0.016 0.332 0.272 0.288 0.068 0.024
#> SRR925709      4  0.5695   2.77e-01 0.420 0.000 0.020 0.492 0.040 0.028
#> SRR925710      4  0.4495   6.09e-01 0.028 0.000 0.132 0.768 0.048 0.024
#> SRR925711      3  0.3013   6.68e-01 0.000 0.000 0.864 0.028 0.064 0.044
#> SRR934631      2  0.1074   8.39e-01 0.000 0.960 0.000 0.000 0.028 0.012
#> SRR934632      2  0.0972   8.40e-01 0.000 0.964 0.000 0.000 0.028 0.008
#> SRR934633      3  0.6549   3.77e-01 0.000 0.180 0.604 0.072 0.048 0.096
#> SRR925713      4  0.4789   5.78e-01 0.016 0.000 0.148 0.728 0.012 0.096
#> SRR925714      3  0.5852   1.17e-01 0.016 0.000 0.500 0.396 0.060 0.028
#> SRR925715      6  0.4933   3.16e-01 0.000 0.000 0.104 0.272 0.000 0.624
#> SRR925716      4  0.5144   6.88e-03 0.092 0.000 0.000 0.536 0.372 0.000
#> SRR925717      3  0.4983   2.84e-01 0.000 0.000 0.580 0.360 0.036 0.024
#> SRR925718      2  0.2663   8.29e-01 0.064 0.888 0.012 0.000 0.024 0.012
#> SRR925719      4  0.3803   5.68e-01 0.172 0.000 0.000 0.776 0.040 0.012
#> SRR925720      4  0.2780   5.98e-01 0.016 0.000 0.000 0.868 0.092 0.024
#> SRR925721      4  0.4359   4.59e-01 0.028 0.000 0.000 0.712 0.232 0.028
#> SRR934634      1  0.5635   1.26e-01 0.576 0.000 0.000 0.208 0.208 0.008
#> SRR934635      1  0.4601   4.71e-01 0.716 0.000 0.000 0.140 0.136 0.008
#> SRR925723      3  0.2629   6.89e-01 0.000 0.000 0.888 0.048 0.028 0.036
#> SRR925724      3  0.1262   7.12e-01 0.000 0.000 0.956 0.008 0.016 0.020
#> SRR925725      3  0.3163   5.64e-01 0.000 0.000 0.780 0.004 0.004 0.212
#> SRR925726      4  0.2677   6.19e-01 0.032 0.000 0.028 0.892 0.040 0.008
#> SRR925727      3  0.2196   6.75e-01 0.000 0.000 0.884 0.004 0.004 0.108
#> SRR925728      4  0.5784   2.98e-01 0.040 0.000 0.040 0.540 0.360 0.020
#> SRR934636      5  0.4301   7.48e-01 0.124 0.036 0.000 0.072 0.768 0.000
#> SRR934637      5  0.3885   7.70e-01 0.100 0.000 0.000 0.116 0.780 0.004
#> SRR925729      4  0.4932   5.61e-01 0.000 0.000 0.176 0.704 0.080 0.040
#> SRR934638      5  0.5982   5.92e-01 0.208 0.004 0.000 0.252 0.528 0.008
#> SRR934639      4  0.4731   4.92e-01 0.208 0.000 0.004 0.696 0.084 0.008
#> SRR934640      6  0.2255   6.00e-01 0.000 0.028 0.080 0.000 0.000 0.892
#> SRR934641      6  0.2176   6.00e-01 0.000 0.024 0.080 0.000 0.000 0.896
#> SRR925734      1  0.2333   6.92e-01 0.896 0.000 0.000 0.040 0.060 0.004
#> SRR925735      4  0.5467   4.67e-01 0.000 0.000 0.256 0.624 0.068 0.052
#> SRR925736      4  0.6771   2.07e-01 0.000 0.044 0.332 0.488 0.088 0.048
#> SRR925737      4  0.5627   5.44e-01 0.000 0.092 0.080 0.704 0.080 0.044
#> SRR934642      2  0.0748   8.46e-01 0.004 0.976 0.000 0.000 0.016 0.004
#> SRR934643      2  0.4479   7.18e-01 0.004 0.784 0.100 0.036 0.056 0.020
#> SRR934644      2  0.0748   8.45e-01 0.004 0.976 0.000 0.000 0.016 0.004
#> SRR934645      1  0.5745  -3.52e-02 0.504 0.404 0.044 0.004 0.036 0.008
#> SRR925740      3  0.8143  -4.07e-02 0.000 0.152 0.388 0.140 0.068 0.252
#> SRR925741      6  0.4413  -9.27e-06 0.000 0.000 0.488 0.008 0.012 0.492
#> SRR925742      4  0.7700   1.03e-01 0.000 0.268 0.252 0.372 0.068 0.040
#> SRR1283038     3  0.0858   7.15e-01 0.000 0.000 0.968 0.004 0.000 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-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