cola Report for recount2:SRP059057

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

The call of run_all_consensus_partition_methods() was:

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

Dimension of the input matrix:

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

Density distribution

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

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

plot of chunk density-heatmap

Suggest the best k

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

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

suggest_best_k(res_list)
The best k 1-PAC Mean silhouette Concordance Optional k
SD:skmeans 5 1.000 0.997 0.999 ** 2,4
SD:NMF 3 1.000 0.975 0.988 **
CV:pam 6 1.000 0.955 0.983 ** 2,3,4,5
MAD:NMF 3 1.000 0.970 0.986 **
ATC:kmeans 3 1.000 0.994 0.997 **
ATC:pam 6 1.000 0.960 0.987 ** 2,3,4,5
ATC:NMF 3 0.997 0.980 0.990 ** 2
SD:mclust 5 0.992 0.946 0.975 ** 2,4
SD:pam 6 0.988 0.952 0.979 ** 2,3,4,5
MAD:pam 6 0.975 0.962 0.981 ** 2,4,5
MAD:skmeans 6 0.971 0.908 0.938 ** 2,4,5
MAD:hclust 6 0.945 0.797 0.907 *
CV:skmeans 6 0.931 0.914 0.927 * 3,4,5
MAD:mclust 5 0.928 0.918 0.954 * 3,4
ATC:mclust 6 0.926 0.918 0.913 * 2,5
CV:mclust 6 0.926 0.913 0.934 * 5
SD:hclust 6 0.920 0.864 0.942 *
ATC:hclust 6 0.919 0.877 0.916 * 5
CV:NMF 5 0.918 0.855 0.942 * 2
MAD:kmeans 6 0.915 0.847 0.887 *
ATC:skmeans 6 0.907 0.848 0.909 * 2,4
SD:kmeans 5 0.906 0.965 0.938 *
CV:kmeans 6 0.903 0.713 0.851 *
CV:hclust 4 0.843 0.801 0.890

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

CDF of consensus matrices

Cumulative distribution function curves of consensus matrix for all methods.

collect_plots(res_list, fun = plot_ecdf)

plot of chunk collect-plots

Consensus heatmap

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

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

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

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

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

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

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

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

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

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

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

Membership heatmap

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

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

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

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

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

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

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

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

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

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

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

Signature heatmap

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

Note in following heatmaps, rows are scaled.

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

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

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

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

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

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

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

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

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

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

Statistics table

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

get_stats(res_list, k = 2)
#>             k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> SD:NMF      2 0.861           0.935       0.969          0.486 0.521   0.521
#> CV:NMF      2 0.942           0.898       0.962          0.490 0.514   0.514
#> MAD:NMF     2 0.860           0.915       0.965          0.498 0.498   0.498
#> ATC:NMF     2 0.971           0.955       0.980          0.452 0.543   0.543
#> SD:skmeans  2 1.000           0.977       0.990          0.507 0.493   0.493
#> CV:skmeans  2 0.861           0.920       0.968          0.479 0.521   0.521
#> MAD:skmeans 2 1.000           0.979       0.991          0.507 0.493   0.493
#> ATC:skmeans 2 1.000           0.929       0.974          0.507 0.493   0.493
#> SD:mclust   2 1.000           0.978       0.990          0.384 0.610   0.610
#> CV:mclust   2 0.503           0.785       0.835          0.400 0.638   0.638
#> MAD:mclust  2 0.888           0.902       0.961          0.409 0.573   0.573
#> ATC:mclust  2 1.000           1.000       1.000          0.348 0.653   0.653
#> SD:kmeans   2 0.370           0.586       0.769          0.428 0.653   0.653
#> CV:kmeans   2 0.766           0.946       0.944          0.419 0.584   0.584
#> MAD:kmeans  2 0.427           0.767       0.888          0.465 0.493   0.493
#> ATC:kmeans  2 0.597           0.804       0.893          0.478 0.501   0.501
#> SD:pam      2 1.000           1.000       1.000          0.348 0.653   0.653
#> CV:pam      2 1.000           0.983       0.993          0.410 0.597   0.597
#> MAD:pam     2 1.000           0.971       0.965          0.353 0.653   0.653
#> ATC:pam     2 1.000           0.965       0.982          0.406 0.597   0.597
#> SD:hclust   2 0.529           0.828       0.917          0.476 0.509   0.509
#> CV:hclust   2 0.888           0.919       0.967          0.384 0.610   0.610
#> MAD:hclust  2 0.571           0.752       0.895          0.486 0.505   0.505
#> ATC:hclust  2 0.550           0.748       0.850          0.455 0.521   0.521
get_stats(res_list, k = 3)
#>             k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> SD:NMF      3 1.000           0.975       0.988          0.330 0.734   0.535
#> CV:NMF      3 0.892           0.869       0.925          0.344 0.779   0.587
#> MAD:NMF     3 1.000           0.970       0.986          0.297 0.780   0.590
#> ATC:NMF     3 0.997           0.980       0.990          0.428 0.716   0.520
#> SD:skmeans  3 0.888           0.897       0.956          0.295 0.830   0.664
#> CV:skmeans  3 1.000           0.965       0.986          0.384 0.782   0.594
#> MAD:skmeans 3 0.890           0.955       0.971          0.286 0.830   0.664
#> ATC:skmeans 3 0.743           0.740       0.823          0.275 0.750   0.533
#> SD:mclust   3 0.848           0.884       0.948          0.630 0.670   0.489
#> CV:mclust   3 0.827           0.931       0.948          0.646 0.655   0.475
#> MAD:mclust  3 1.000           0.973       0.989          0.467 0.670   0.495
#> ATC:mclust  3 0.733           0.938       0.960          0.803 0.712   0.559
#> SD:kmeans   3 0.611           0.853       0.903          0.478 0.699   0.538
#> CV:kmeans   3 0.637           0.784       0.857          0.503 0.737   0.556
#> MAD:kmeans  3 0.831           0.861       0.918          0.365 0.654   0.421
#> ATC:kmeans  3 1.000           0.994       0.997          0.319 0.615   0.387
#> SD:pam      3 0.918           0.965       0.983          0.839 0.712   0.559
#> CV:pam      3 1.000           0.976       0.983          0.543 0.775   0.622
#> MAD:pam     3 0.898           0.948       0.976          0.813 0.712   0.559
#> ATC:pam     3 1.000           0.987       0.994          0.558 0.674   0.496
#> SD:hclust   3 0.656           0.833       0.918          0.360 0.836   0.677
#> CV:hclust   3 0.555           0.673       0.806          0.460 0.890   0.821
#> MAD:hclust  3 0.625           0.748       0.876          0.334 0.842   0.686
#> ATC:hclust  3 0.780           0.810       0.911          0.425 0.812   0.639
get_stats(res_list, k = 4)
#>             k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> SD:NMF      4 0.787           0.842       0.905         0.1244 0.916   0.768
#> CV:NMF      4 0.809           0.857       0.931         0.1324 0.821   0.535
#> MAD:NMF     4 0.788           0.773       0.872         0.1360 0.916   0.768
#> ATC:NMF     4 0.793           0.809       0.887         0.1507 0.848   0.594
#> SD:skmeans  4 1.000           0.993       0.997         0.1400 0.877   0.660
#> CV:skmeans  4 1.000           0.984       0.989         0.1297 0.898   0.704
#> MAD:skmeans 4 1.000           0.984       0.994         0.1456 0.877   0.660
#> ATC:skmeans 4 0.983           0.944       0.975         0.1399 0.882   0.664
#> SD:mclust   4 0.981           0.910       0.959         0.1346 0.955   0.871
#> CV:mclust   4 0.779           0.747       0.863         0.0848 0.917   0.773
#> MAD:mclust  4 1.000           0.996       0.996         0.1616 0.883   0.715
#> ATC:mclust  4 0.850           0.936       0.892         0.1763 0.835   0.576
#> SD:kmeans   4 0.762           0.765       0.869         0.1634 0.901   0.726
#> CV:kmeans   4 0.676           0.679       0.799         0.1589 0.960   0.884
#> MAD:kmeans  4 0.737           0.786       0.837         0.1632 0.862   0.625
#> ATC:kmeans  4 0.817           0.802       0.868         0.1632 0.870   0.650
#> SD:pam      4 1.000           0.966       0.984         0.1834 0.877   0.664
#> CV:pam      4 0.985           0.948       0.977         0.1975 0.871   0.652
#> MAD:pam     4 0.965           0.932       0.968         0.1771 0.867   0.644
#> ATC:pam     4 0.938           0.909       0.962         0.1879 0.877   0.670
#> SD:hclust   4 0.750           0.841       0.925         0.1025 0.935   0.812
#> CV:hclust   4 0.843           0.801       0.890         0.2877 0.760   0.548
#> MAD:hclust  4 0.755           0.684       0.863         0.0973 0.847   0.624
#> ATC:hclust  4 0.881           0.852       0.927         0.1472 0.875   0.644
get_stats(res_list, k = 5)
#>             k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> SD:NMF      5 0.845           0.774       0.877         0.0839 0.821   0.467
#> CV:NMF      5 0.918           0.855       0.942         0.0758 0.893   0.617
#> MAD:NMF     5 0.889           0.866       0.918         0.0691 0.829   0.499
#> ATC:NMF     5 0.818           0.736       0.867         0.0590 0.853   0.507
#> SD:skmeans  5 1.000           0.997       0.999         0.0666 0.919   0.696
#> CV:skmeans  5 0.965           0.927       0.963         0.0636 0.955   0.820
#> MAD:skmeans 5 1.000           0.987       0.993         0.0659 0.919   0.696
#> ATC:skmeans 5 0.891           0.889       0.923         0.0483 0.959   0.844
#> SD:mclust   5 0.992           0.946       0.975         0.1335 0.859   0.561
#> CV:mclust   5 0.940           0.920       0.944         0.1170 0.879   0.620
#> MAD:mclust  5 0.928           0.918       0.954         0.1398 0.858   0.559
#> ATC:mclust  5 0.973           0.973       0.980         0.0824 0.949   0.793
#> SD:kmeans   5 0.906           0.965       0.938         0.0717 0.919   0.707
#> CV:kmeans   5 0.792           0.873       0.851         0.0678 0.865   0.589
#> MAD:kmeans  5 0.887           0.947       0.931         0.0719 0.931   0.727
#> ATC:kmeans  5 0.772           0.804       0.862         0.0685 0.917   0.691
#> SD:pam      5 1.000           0.986       0.994         0.0617 0.933   0.736
#> CV:pam      5 0.922           0.930       0.953         0.0452 0.951   0.803
#> MAD:pam     5 0.919           0.951       0.956         0.0634 0.930   0.728
#> ATC:pam     5 1.000           0.968       0.981         0.0582 0.937   0.755
#> SD:hclust   5 0.798           0.798       0.882         0.0517 0.992   0.971
#> CV:hclust   5 0.838           0.852       0.864         0.0676 0.881   0.627
#> MAD:hclust  5 0.863           0.828       0.905         0.1122 0.884   0.630
#> ATC:hclust  5 0.922           0.817       0.920         0.0578 0.953   0.811
get_stats(res_list, k = 6)
#>             k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> SD:NMF      6 0.835           0.750       0.856         0.0215 0.961   0.839
#> CV:NMF      6 0.895           0.845       0.906         0.0326 0.952   0.769
#> MAD:NMF     6 0.859           0.780       0.869         0.0248 0.971   0.880
#> ATC:NMF     6 0.894           0.838       0.908         0.0212 0.960   0.825
#> SD:skmeans  6 0.951           0.892       0.886         0.0236 0.992   0.962
#> CV:skmeans  6 0.931           0.914       0.927         0.0359 0.970   0.852
#> MAD:skmeans 6 0.971           0.908       0.938         0.0273 0.968   0.844
#> ATC:skmeans 6 0.907           0.848       0.909         0.0329 0.971   0.875
#> SD:mclust   6 0.908           0.865       0.915         0.0175 1.000   1.000
#> CV:mclust   6 0.926           0.913       0.934         0.0325 0.975   0.876
#> MAD:mclust  6 0.886           0.803       0.863         0.0123 0.942   0.744
#> ATC:mclust  6 0.926           0.918       0.913         0.0209 0.936   0.718
#> SD:kmeans   6 0.942           0.885       0.897         0.0337 1.000   1.000
#> CV:kmeans   6 0.903           0.713       0.851         0.0538 0.977   0.887
#> MAD:kmeans  6 0.915           0.847       0.887         0.0367 0.983   0.913
#> ATC:kmeans  6 0.798           0.754       0.822         0.0388 0.970   0.863
#> SD:pam      6 0.988           0.952       0.979         0.0292 0.976   0.878
#> CV:pam      6 1.000           0.955       0.983         0.0472 0.945   0.745
#> MAD:pam     6 0.975           0.962       0.981         0.0327 0.976   0.878
#> ATC:pam     6 1.000           0.960       0.987         0.0323 0.968   0.845
#> SD:hclust   6 0.920           0.864       0.942         0.0784 0.868   0.556
#> CV:hclust   6 0.781           0.845       0.849         0.0410 0.970   0.854
#> MAD:hclust  6 0.945           0.797       0.907         0.0235 0.952   0.780
#> ATC:hclust  6 0.919           0.877       0.916         0.0286 0.960   0.810

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

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

collect_plots(res)

plot of chunk SD-hclust-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.529           0.828       0.917         0.4764 0.509   0.509
#> 3 3 0.656           0.833       0.918         0.3603 0.836   0.677
#> 4 4 0.750           0.841       0.925         0.1025 0.935   0.812
#> 5 5 0.798           0.798       0.882         0.0517 0.992   0.971
#> 6 6 0.920           0.864       0.942         0.0784 0.868   0.556

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

suggest_best_k(res)
#> [1] 6

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

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

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>            class entropy silhouette    p1    p2
#> SRR2050410     2  0.0000      0.862 0.000 1.000
#> SRR2050427     1  0.0376      0.928 0.996 0.004
#> SRR2050426     1  0.0376      0.928 0.996 0.004
#> SRR2050425     2  0.0000      0.862 0.000 1.000
#> SRR2050424     1  0.0000      0.928 1.000 0.000
#> SRR2050423     2  0.9580      0.541 0.380 0.620
#> SRR2050422     1  0.7602      0.723 0.780 0.220
#> SRR2050421     1  0.0376      0.928 0.996 0.004
#> SRR2050420     1  0.0376      0.928 0.996 0.004
#> SRR2050419     2  0.0000      0.862 0.000 1.000
#> SRR2050418     1  0.0376      0.928 0.996 0.004
#> SRR2050417     1  0.6712      0.751 0.824 0.176
#> SRR2050416     2  0.0672      0.860 0.008 0.992
#> SRR2050415     1  0.0000      0.928 1.000 0.000
#> SRR2050414     2  0.9580      0.541 0.380 0.620
#> SRR2050413     1  0.7602      0.723 0.780 0.220
#> SRR2050412     1  0.0376      0.928 0.996 0.004
#> SRR2050411     1  0.6712      0.751 0.824 0.176
#> SRR2050409     2  0.0000      0.862 0.000 1.000
#> SRR2050408     1  0.6712      0.751 0.824 0.176
#> SRR2050407     2  0.0000      0.862 0.000 1.000
#> SRR2050406     1  0.0000      0.928 1.000 0.000
#> SRR2050405     2  0.9580      0.541 0.380 0.620
#> SRR2050404     2  0.0000      0.862 0.000 1.000
#> SRR2050403     1  0.6712      0.751 0.824 0.176
#> SRR2050402     2  0.0000      0.862 0.000 1.000
#> SRR2050401     1  0.0376      0.928 0.996 0.004
#> SRR2050400     1  0.0376      0.928 0.996 0.004
#> SRR2050399     1  0.8861      0.584 0.696 0.304
#> SRR2050398     1  0.0376      0.928 0.996 0.004
#> SRR2050397     1  0.6712      0.751 0.824 0.176
#> SRR2050396     1  0.0000      0.928 1.000 0.000
#> SRR2050395     2  0.9580      0.541 0.380 0.620
#> SRR2050394     2  0.0000      0.862 0.000 1.000
#> SRR2050393     1  0.0000      0.928 1.000 0.000
#> SRR2050392     2  0.1843      0.853 0.028 0.972
#> SRR2050465     2  0.0000      0.862 0.000 1.000
#> SRR2050464     1  0.0000      0.928 1.000 0.000
#> SRR2050463     2  0.9580      0.541 0.380 0.620
#> SRR2050462     2  0.0000      0.862 0.000 1.000
#> SRR2050461     1  0.0000      0.928 1.000 0.000
#> SRR2050460     2  0.9580      0.541 0.380 0.620
#> SRR2050459     2  0.0000      0.862 0.000 1.000
#> SRR2050458     1  0.0000      0.928 1.000 0.000
#> SRR2050457     2  0.1184      0.857 0.016 0.984
#> SRR2050456     2  0.0000      0.862 0.000 1.000
#> SRR2050455     1  0.0000      0.928 1.000 0.000
#> SRR2050454     2  0.1843      0.853 0.028 0.972
#> SRR2050453     2  0.0000      0.862 0.000 1.000
#> SRR2050452     1  0.0000      0.928 1.000 0.000
#> SRR2050451     2  0.9580      0.541 0.380 0.620
#> SRR2050450     2  0.0000      0.862 0.000 1.000
#> SRR2050449     1  0.0000      0.928 1.000 0.000
#> SRR2050448     2  0.9580      0.541 0.380 0.620
#> SRR2050447     1  0.0000      0.928 1.000 0.000
#> SRR2050446     2  0.9580      0.541 0.380 0.620
#> SRR2050445     2  0.0000      0.862 0.000 1.000
#> SRR2050444     1  0.0000      0.928 1.000 0.000
#> SRR2050443     2  0.1843      0.853 0.028 0.972
#> SRR2050442     1  0.7299      0.741 0.796 0.204
#> SRR2050441     1  0.0000      0.928 1.000 0.000
#> SRR2050440     1  0.0376      0.928 0.996 0.004
#> SRR2050439     1  0.7299      0.741 0.796 0.204
#> SRR2050438     1  0.0000      0.928 1.000 0.000
#> SRR2050437     1  0.0376      0.928 0.996 0.004
#> SRR2050436     1  0.7299      0.741 0.796 0.204
#> SRR2050435     1  0.0000      0.928 1.000 0.000
#> SRR2050434     1  0.7299      0.741 0.796 0.204
#> SRR2050433     2  0.0000      0.862 0.000 1.000
#> SRR2050432     1  0.0376      0.928 0.996 0.004
#> SRR2050431     1  0.0376      0.928 0.996 0.004
#> SRR2050430     1  0.0376      0.928 0.996 0.004
#> SRR2050429     1  0.0376      0.928 0.996 0.004

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>            class entropy silhouette    p1    p2 p3
#> SRR2050410     2  0.0000      0.854 0.000 1.000  0
#> SRR2050427     1  0.0000      0.884 1.000 0.000  0
#> SRR2050426     1  0.0000      0.884 1.000 0.000  0
#> SRR2050425     2  0.0000      0.854 0.000 1.000  0
#> SRR2050424     3  0.0000      1.000 0.000 0.000  1
#> SRR2050423     2  0.6062      0.528 0.384 0.616  0
#> SRR2050422     1  0.4750      0.743 0.784 0.216  0
#> SRR2050421     1  0.0000      0.884 1.000 0.000  0
#> SRR2050420     1  0.0000      0.884 1.000 0.000  0
#> SRR2050419     2  0.0000      0.854 0.000 1.000  0
#> SRR2050418     1  0.0000      0.884 1.000 0.000  0
#> SRR2050417     1  0.4178      0.747 0.828 0.172  0
#> SRR2050416     2  0.0424      0.851 0.008 0.992  0
#> SRR2050415     3  0.0000      1.000 0.000 0.000  1
#> SRR2050414     2  0.6062      0.528 0.384 0.616  0
#> SRR2050413     1  0.4750      0.743 0.784 0.216  0
#> SRR2050412     1  0.0000      0.884 1.000 0.000  0
#> SRR2050411     1  0.4178      0.747 0.828 0.172  0
#> SRR2050409     2  0.0000      0.854 0.000 1.000  0
#> SRR2050408     1  0.4178      0.747 0.828 0.172  0
#> SRR2050407     2  0.0000      0.854 0.000 1.000  0
#> SRR2050406     3  0.0000      1.000 0.000 0.000  1
#> SRR2050405     2  0.6062      0.528 0.384 0.616  0
#> SRR2050404     2  0.0000      0.854 0.000 1.000  0
#> SRR2050403     1  0.4178      0.747 0.828 0.172  0
#> SRR2050402     2  0.0000      0.854 0.000 1.000  0
#> SRR2050401     1  0.0000      0.884 1.000 0.000  0
#> SRR2050400     1  0.0000      0.884 1.000 0.000  0
#> SRR2050399     1  0.5560      0.622 0.700 0.300  0
#> SRR2050398     1  0.0000      0.884 1.000 0.000  0
#> SRR2050397     1  0.4178      0.747 0.828 0.172  0
#> SRR2050396     3  0.0000      1.000 0.000 0.000  1
#> SRR2050395     2  0.6062      0.528 0.384 0.616  0
#> SRR2050394     2  0.0000      0.854 0.000 1.000  0
#> SRR2050393     3  0.0000      1.000 0.000 0.000  1
#> SRR2050392     2  0.1163      0.845 0.028 0.972  0
#> SRR2050465     2  0.0000      0.854 0.000 1.000  0
#> SRR2050464     3  0.0000      1.000 0.000 0.000  1
#> SRR2050463     2  0.6062      0.528 0.384 0.616  0
#> SRR2050462     2  0.0000      0.854 0.000 1.000  0
#> SRR2050461     3  0.0000      1.000 0.000 0.000  1
#> SRR2050460     2  0.6062      0.528 0.384 0.616  0
#> SRR2050459     2  0.0000      0.854 0.000 1.000  0
#> SRR2050458     3  0.0000      1.000 0.000 0.000  1
#> SRR2050457     2  0.0747      0.848 0.016 0.984  0
#> SRR2050456     2  0.0000      0.854 0.000 1.000  0
#> SRR2050455     3  0.0000      1.000 0.000 0.000  1
#> SRR2050454     2  0.1163      0.845 0.028 0.972  0
#> SRR2050453     2  0.0000      0.854 0.000 1.000  0
#> SRR2050452     3  0.0000      1.000 0.000 0.000  1
#> SRR2050451     2  0.6062      0.528 0.384 0.616  0
#> SRR2050450     2  0.0000      0.854 0.000 1.000  0
#> SRR2050449     3  0.0000      1.000 0.000 0.000  1
#> SRR2050448     2  0.6062      0.528 0.384 0.616  0
#> SRR2050447     3  0.0000      1.000 0.000 0.000  1
#> SRR2050446     2  0.6062      0.528 0.384 0.616  0
#> SRR2050445     2  0.0000      0.854 0.000 1.000  0
#> SRR2050444     3  0.0000      1.000 0.000 0.000  1
#> SRR2050443     2  0.1163      0.845 0.028 0.972  0
#> SRR2050442     1  0.4555      0.757 0.800 0.200  0
#> SRR2050441     3  0.0000      1.000 0.000 0.000  1
#> SRR2050440     1  0.0000      0.884 1.000 0.000  0
#> SRR2050439     1  0.4555      0.757 0.800 0.200  0
#> SRR2050438     3  0.0000      1.000 0.000 0.000  1
#> SRR2050437     1  0.0000      0.884 1.000 0.000  0
#> SRR2050436     1  0.4555      0.757 0.800 0.200  0
#> SRR2050435     3  0.0000      1.000 0.000 0.000  1
#> SRR2050434     1  0.4555      0.757 0.800 0.200  0
#> SRR2050433     2  0.0000      0.854 0.000 1.000  0
#> SRR2050432     1  0.0000      0.884 1.000 0.000  0
#> SRR2050431     1  0.0000      0.884 1.000 0.000  0
#> SRR2050430     1  0.0000      0.884 1.000 0.000  0
#> SRR2050429     1  0.0000      0.884 1.000 0.000  0

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2 p3    p4
#> SRR2050410     2  0.0000      0.847 0.000 1.000  0 0.000
#> SRR2050427     1  0.0000      0.908 1.000 0.000  0 0.000
#> SRR2050426     1  0.0000      0.908 1.000 0.000  0 0.000
#> SRR2050425     2  0.0000      0.847 0.000 1.000  0 0.000
#> SRR2050424     3  0.0000      1.000 0.000 0.000  1 0.000
#> SRR2050423     2  0.4978      0.490 0.384 0.612  0 0.004
#> SRR2050422     4  0.1520      0.892 0.024 0.020  0 0.956
#> SRR2050421     1  0.0000      0.908 1.000 0.000  0 0.000
#> SRR2050420     1  0.0000      0.908 1.000 0.000  0 0.000
#> SRR2050419     2  0.0000      0.847 0.000 1.000  0 0.000
#> SRR2050418     1  0.0000      0.908 1.000 0.000  0 0.000
#> SRR2050417     1  0.3311      0.798 0.828 0.172  0 0.000
#> SRR2050416     2  0.0336      0.843 0.000 0.992  0 0.008
#> SRR2050415     3  0.0000      1.000 0.000 0.000  1 0.000
#> SRR2050414     2  0.4978      0.490 0.384 0.612  0 0.004
#> SRR2050413     4  0.1520      0.892 0.024 0.020  0 0.956
#> SRR2050412     1  0.0000      0.908 1.000 0.000  0 0.000
#> SRR2050411     1  0.3311      0.798 0.828 0.172  0 0.000
#> SRR2050409     2  0.0000      0.847 0.000 1.000  0 0.000
#> SRR2050408     1  0.3311      0.798 0.828 0.172  0 0.000
#> SRR2050407     2  0.0000      0.847 0.000 1.000  0 0.000
#> SRR2050406     3  0.0000      1.000 0.000 0.000  1 0.000
#> SRR2050405     2  0.4978      0.490 0.384 0.612  0 0.004
#> SRR2050404     2  0.0000      0.847 0.000 1.000  0 0.000
#> SRR2050403     1  0.3311      0.798 0.828 0.172  0 0.000
#> SRR2050402     2  0.0188      0.846 0.000 0.996  0 0.004
#> SRR2050401     1  0.0000      0.908 1.000 0.000  0 0.000
#> SRR2050400     1  0.0000      0.908 1.000 0.000  0 0.000
#> SRR2050399     4  0.2408      0.830 0.000 0.104  0 0.896
#> SRR2050398     1  0.0000      0.908 1.000 0.000  0 0.000
#> SRR2050397     1  0.3311      0.798 0.828 0.172  0 0.000
#> SRR2050396     3  0.0000      1.000 0.000 0.000  1 0.000
#> SRR2050395     2  0.4978      0.490 0.384 0.612  0 0.004
#> SRR2050394     2  0.0000      0.847 0.000 1.000  0 0.000
#> SRR2050393     3  0.0000      1.000 0.000 0.000  1 0.000
#> SRR2050392     2  0.1109      0.839 0.028 0.968  0 0.004
#> SRR2050465     2  0.0000      0.847 0.000 1.000  0 0.000
#> SRR2050464     3  0.0000      1.000 0.000 0.000  1 0.000
#> SRR2050463     2  0.4978      0.490 0.384 0.612  0 0.004
#> SRR2050462     2  0.0000      0.847 0.000 1.000  0 0.000
#> SRR2050461     3  0.0000      1.000 0.000 0.000  1 0.000
#> SRR2050460     2  0.4978      0.490 0.384 0.612  0 0.004
#> SRR2050459     2  0.0000      0.847 0.000 1.000  0 0.000
#> SRR2050458     3  0.0000      1.000 0.000 0.000  1 0.000
#> SRR2050457     2  0.0779      0.843 0.016 0.980  0 0.004
#> SRR2050456     2  0.0000      0.847 0.000 1.000  0 0.000
#> SRR2050455     3  0.0000      1.000 0.000 0.000  1 0.000
#> SRR2050454     2  0.1109      0.839 0.028 0.968  0 0.004
#> SRR2050453     2  0.0000      0.847 0.000 1.000  0 0.000
#> SRR2050452     3  0.0000      1.000 0.000 0.000  1 0.000
#> SRR2050451     2  0.4978      0.490 0.384 0.612  0 0.004
#> SRR2050450     2  0.0000      0.847 0.000 1.000  0 0.000
#> SRR2050449     3  0.0000      1.000 0.000 0.000  1 0.000
#> SRR2050448     2  0.4978      0.490 0.384 0.612  0 0.004
#> SRR2050447     3  0.0000      1.000 0.000 0.000  1 0.000
#> SRR2050446     2  0.4978      0.490 0.384 0.612  0 0.004
#> SRR2050445     2  0.0000      0.847 0.000 1.000  0 0.000
#> SRR2050444     3  0.0000      1.000 0.000 0.000  1 0.000
#> SRR2050443     2  0.1109      0.839 0.028 0.968  0 0.004
#> SRR2050442     4  0.0188      0.896 0.000 0.004  0 0.996
#> SRR2050441     3  0.0000      1.000 0.000 0.000  1 0.000
#> SRR2050440     4  0.3610      0.768 0.200 0.000  0 0.800
#> SRR2050439     4  0.0188      0.896 0.000 0.004  0 0.996
#> SRR2050438     3  0.0000      1.000 0.000 0.000  1 0.000
#> SRR2050437     4  0.3610      0.768 0.200 0.000  0 0.800
#> SRR2050436     4  0.0188      0.896 0.000 0.004  0 0.996
#> SRR2050435     3  0.0000      1.000 0.000 0.000  1 0.000
#> SRR2050434     4  0.0188      0.896 0.000 0.004  0 0.996
#> SRR2050433     2  0.0000      0.847 0.000 1.000  0 0.000
#> SRR2050432     1  0.0000      0.908 1.000 0.000  0 0.000
#> SRR2050431     1  0.0000      0.908 1.000 0.000  0 0.000
#> SRR2050430     1  0.3219      0.739 0.836 0.000  0 0.164
#> SRR2050429     4  0.3610      0.768 0.200 0.000  0 0.800

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>            class entropy silhouette    p1    p2 p3    p4    p5
#> SRR2050410     2  0.0000      0.740 0.000 1.000  0 0.000 0.000
#> SRR2050427     1  0.0000      0.910 1.000 0.000  0 0.000 0.000
#> SRR2050426     1  0.0000      0.910 1.000 0.000  0 0.000 0.000
#> SRR2050425     2  0.0000      0.740 0.000 1.000  0 0.000 0.000
#> SRR2050424     3  0.0000      1.000 0.000 0.000  1 0.000 0.000
#> SRR2050423     2  0.6694      0.311 0.348 0.408  0 0.244 0.000
#> SRR2050422     5  0.0798      0.933 0.008 0.000  0 0.016 0.976
#> SRR2050421     1  0.0000      0.910 1.000 0.000  0 0.000 0.000
#> SRR2050420     1  0.0000      0.910 1.000 0.000  0 0.000 0.000
#> SRR2050419     2  0.0000      0.740 0.000 1.000  0 0.000 0.000
#> SRR2050418     1  0.0162      0.909 0.996 0.000  0 0.004 0.000
#> SRR2050417     1  0.3074      0.810 0.804 0.000  0 0.196 0.000
#> SRR2050416     2  0.0703      0.724 0.000 0.976  0 0.000 0.024
#> SRR2050415     3  0.0000      1.000 0.000 0.000  1 0.000 0.000
#> SRR2050414     2  0.6694      0.311 0.348 0.408  0 0.244 0.000
#> SRR2050413     5  0.0798      0.933 0.008 0.000  0 0.016 0.976
#> SRR2050412     1  0.0000      0.910 1.000 0.000  0 0.000 0.000
#> SRR2050411     1  0.3003      0.815 0.812 0.000  0 0.188 0.000
#> SRR2050409     2  0.0000      0.740 0.000 1.000  0 0.000 0.000
#> SRR2050408     1  0.3074      0.810 0.804 0.000  0 0.196 0.000
#> SRR2050407     2  0.0000      0.740 0.000 1.000  0 0.000 0.000
#> SRR2050406     3  0.0000      1.000 0.000 0.000  1 0.000 0.000
#> SRR2050405     2  0.6694      0.311 0.348 0.408  0 0.244 0.000
#> SRR2050404     2  0.0000      0.740 0.000 1.000  0 0.000 0.000
#> SRR2050403     1  0.3074      0.810 0.804 0.000  0 0.196 0.000
#> SRR2050402     2  0.0609      0.727 0.000 0.980  0 0.000 0.020
#> SRR2050401     1  0.0000      0.910 1.000 0.000  0 0.000 0.000
#> SRR2050400     1  0.0162      0.910 0.996 0.000  0 0.004 0.000
#> SRR2050399     5  0.1792      0.799 0.000 0.084  0 0.000 0.916
#> SRR2050398     1  0.0000      0.910 1.000 0.000  0 0.000 0.000
#> SRR2050397     1  0.3003      0.815 0.812 0.000  0 0.188 0.000
#> SRR2050396     3  0.0000      1.000 0.000 0.000  1 0.000 0.000
#> SRR2050395     2  0.6694      0.311 0.348 0.408  0 0.244 0.000
#> SRR2050394     2  0.0000      0.740 0.000 1.000  0 0.000 0.000
#> SRR2050393     3  0.0000      1.000 0.000 0.000  1 0.000 0.000
#> SRR2050392     2  0.3395      0.661 0.000 0.764  0 0.236 0.000
#> SRR2050465     2  0.0000      0.740 0.000 1.000  0 0.000 0.000
#> SRR2050464     3  0.0000      1.000 0.000 0.000  1 0.000 0.000
#> SRR2050463     2  0.6694      0.311 0.348 0.408  0 0.244 0.000
#> SRR2050462     2  0.0000      0.740 0.000 1.000  0 0.000 0.000
#> SRR2050461     3  0.0000      1.000 0.000 0.000  1 0.000 0.000
#> SRR2050460     2  0.6694      0.311 0.348 0.408  0 0.244 0.000
#> SRR2050459     2  0.0000      0.740 0.000 1.000  0 0.000 0.000
#> SRR2050458     3  0.0000      1.000 0.000 0.000  1 0.000 0.000
#> SRR2050457     2  0.3305      0.666 0.000 0.776  0 0.224 0.000
#> SRR2050456     2  0.0000      0.740 0.000 1.000  0 0.000 0.000
#> SRR2050455     3  0.0000      1.000 0.000 0.000  1 0.000 0.000
#> SRR2050454     2  0.3395      0.661 0.000 0.764  0 0.236 0.000
#> SRR2050453     2  0.0000      0.740 0.000 1.000  0 0.000 0.000
#> SRR2050452     3  0.0000      1.000 0.000 0.000  1 0.000 0.000
#> SRR2050451     2  0.6694      0.311 0.348 0.408  0 0.244 0.000
#> SRR2050450     2  0.0000      0.740 0.000 1.000  0 0.000 0.000
#> SRR2050449     3  0.0000      1.000 0.000 0.000  1 0.000 0.000
#> SRR2050448     2  0.6694      0.311 0.348 0.408  0 0.244 0.000
#> SRR2050447     3  0.0000      1.000 0.000 0.000  1 0.000 0.000
#> SRR2050446     2  0.6694      0.311 0.348 0.408  0 0.244 0.000
#> SRR2050445     2  0.0000      0.740 0.000 1.000  0 0.000 0.000
#> SRR2050444     3  0.0000      1.000 0.000 0.000  1 0.000 0.000
#> SRR2050443     2  0.3395      0.661 0.000 0.764  0 0.236 0.000
#> SRR2050442     5  0.0510      0.948 0.000 0.000  0 0.016 0.984
#> SRR2050441     3  0.0000      1.000 0.000 0.000  1 0.000 0.000
#> SRR2050440     4  0.3912      1.000 0.020 0.000  0 0.752 0.228
#> SRR2050439     5  0.0510      0.948 0.000 0.000  0 0.016 0.984
#> SRR2050438     3  0.0000      1.000 0.000 0.000  1 0.000 0.000
#> SRR2050437     4  0.3912      1.000 0.020 0.000  0 0.752 0.228
#> SRR2050436     5  0.0510      0.948 0.000 0.000  0 0.016 0.984
#> SRR2050435     3  0.0000      1.000 0.000 0.000  1 0.000 0.000
#> SRR2050434     5  0.0510      0.948 0.000 0.000  0 0.016 0.984
#> SRR2050433     2  0.0000      0.740 0.000 1.000  0 0.000 0.000
#> SRR2050432     1  0.0000      0.910 1.000 0.000  0 0.000 0.000
#> SRR2050431     1  0.0794      0.901 0.972 0.000  0 0.028 0.000
#> SRR2050430     1  0.3241      0.760 0.832 0.000  0 0.144 0.024
#> SRR2050429     4  0.3912      1.000 0.020 0.000  0 0.752 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
#> SRR2050410     2  0.0000      0.997 0.000 1.000  0 0.000 0.000 0.000
#> SRR2050427     1  0.0000      0.978 1.000 0.000  0 0.000 0.000 0.000
#> SRR2050426     1  0.0000      0.978 1.000 0.000  0 0.000 0.000 0.000
#> SRR2050425     2  0.0000      0.997 0.000 1.000  0 0.000 0.000 0.000
#> SRR2050424     3  0.0000      1.000 0.000 0.000  1 0.000 0.000 0.000
#> SRR2050423     4  0.0000      0.685 0.000 0.000  0 1.000 0.000 0.000
#> SRR2050422     5  0.0000      0.951 0.000 0.000  0 0.000 1.000 0.000
#> SRR2050421     1  0.0000      0.978 1.000 0.000  0 0.000 0.000 0.000
#> SRR2050420     1  0.0000      0.978 1.000 0.000  0 0.000 0.000 0.000
#> SRR2050419     2  0.0000      0.997 0.000 1.000  0 0.000 0.000 0.000
#> SRR2050418     1  0.0146      0.975 0.996 0.000  0 0.004 0.000 0.000
#> SRR2050417     4  0.3847      0.255 0.456 0.000  0 0.544 0.000 0.000
#> SRR2050416     2  0.0632      0.977 0.000 0.976  0 0.000 0.024 0.000
#> SRR2050415     3  0.0000      1.000 0.000 0.000  1 0.000 0.000 0.000
#> SRR2050414     4  0.0000      0.685 0.000 0.000  0 1.000 0.000 0.000
#> SRR2050413     5  0.0000      0.951 0.000 0.000  0 0.000 1.000 0.000
#> SRR2050412     1  0.0000      0.978 1.000 0.000  0 0.000 0.000 0.000
#> SRR2050411     4  0.3854      0.237 0.464 0.000  0 0.536 0.000 0.000
#> SRR2050409     2  0.0000      0.997 0.000 1.000  0 0.000 0.000 0.000
#> SRR2050408     4  0.3847      0.255 0.456 0.000  0 0.544 0.000 0.000
#> SRR2050407     2  0.0000      0.997 0.000 1.000  0 0.000 0.000 0.000
#> SRR2050406     3  0.0000      1.000 0.000 0.000  1 0.000 0.000 0.000
#> SRR2050405     4  0.0000      0.685 0.000 0.000  0 1.000 0.000 0.000
#> SRR2050404     2  0.0000      0.997 0.000 1.000  0 0.000 0.000 0.000
#> SRR2050403     4  0.3847      0.255 0.456 0.000  0 0.544 0.000 0.000
#> SRR2050402     2  0.0547      0.981 0.000 0.980  0 0.000 0.020 0.000
#> SRR2050401     1  0.0000      0.978 1.000 0.000  0 0.000 0.000 0.000
#> SRR2050400     1  0.0146      0.975 0.996 0.000  0 0.004 0.000 0.000
#> SRR2050399     5  0.1610      0.859 0.000 0.084  0 0.000 0.916 0.000
#> SRR2050398     1  0.0000      0.978 1.000 0.000  0 0.000 0.000 0.000
#> SRR2050397     4  0.3854      0.237 0.464 0.000  0 0.536 0.000 0.000
#> SRR2050396     3  0.0000      1.000 0.000 0.000  1 0.000 0.000 0.000
#> SRR2050395     4  0.0000      0.685 0.000 0.000  0 1.000 0.000 0.000
#> SRR2050394     2  0.0000      0.997 0.000 1.000  0 0.000 0.000 0.000
#> SRR2050393     3  0.0000      1.000 0.000 0.000  1 0.000 0.000 0.000
#> SRR2050392     4  0.3634      0.416 0.000 0.356  0 0.644 0.000 0.000
#> SRR2050465     2  0.0000      0.997 0.000 1.000  0 0.000 0.000 0.000
#> SRR2050464     3  0.0000      1.000 0.000 0.000  1 0.000 0.000 0.000
#> SRR2050463     4  0.0000      0.685 0.000 0.000  0 1.000 0.000 0.000
#> SRR2050462     2  0.0000      0.997 0.000 1.000  0 0.000 0.000 0.000
#> SRR2050461     3  0.0000      1.000 0.000 0.000  1 0.000 0.000 0.000
#> SRR2050460     4  0.0000      0.685 0.000 0.000  0 1.000 0.000 0.000
#> SRR2050459     2  0.0000      0.997 0.000 1.000  0 0.000 0.000 0.000
#> SRR2050458     3  0.0000      1.000 0.000 0.000  1 0.000 0.000 0.000
#> SRR2050457     4  0.3672      0.393 0.000 0.368  0 0.632 0.000 0.000
#> SRR2050456     2  0.0000      0.997 0.000 1.000  0 0.000 0.000 0.000
#> SRR2050455     3  0.0000      1.000 0.000 0.000  1 0.000 0.000 0.000
#> SRR2050454     4  0.3634      0.416 0.000 0.356  0 0.644 0.000 0.000
#> SRR2050453     2  0.0000      0.997 0.000 1.000  0 0.000 0.000 0.000
#> SRR2050452     3  0.0000      1.000 0.000 0.000  1 0.000 0.000 0.000
#> SRR2050451     4  0.0000      0.685 0.000 0.000  0 1.000 0.000 0.000
#> SRR2050450     2  0.0000      0.997 0.000 1.000  0 0.000 0.000 0.000
#> SRR2050449     3  0.0000      1.000 0.000 0.000  1 0.000 0.000 0.000
#> SRR2050448     4  0.0000      0.685 0.000 0.000  0 1.000 0.000 0.000
#> SRR2050447     3  0.0000      1.000 0.000 0.000  1 0.000 0.000 0.000
#> SRR2050446     4  0.0000      0.685 0.000 0.000  0 1.000 0.000 0.000
#> SRR2050445     2  0.0000      0.997 0.000 1.000  0 0.000 0.000 0.000
#> SRR2050444     3  0.0000      1.000 0.000 0.000  1 0.000 0.000 0.000
#> SRR2050443     4  0.3634      0.416 0.000 0.356  0 0.644 0.000 0.000
#> SRR2050442     5  0.0937      0.962 0.000 0.000  0 0.000 0.960 0.040
#> SRR2050441     3  0.0000      1.000 0.000 0.000  1 0.000 0.000 0.000
#> SRR2050440     6  0.0000      1.000 0.000 0.000  0 0.000 0.000 1.000
#> SRR2050439     5  0.0937      0.962 0.000 0.000  0 0.000 0.960 0.040
#> SRR2050438     3  0.0000      1.000 0.000 0.000  1 0.000 0.000 0.000
#> SRR2050437     6  0.0000      1.000 0.000 0.000  0 0.000 0.000 1.000
#> SRR2050436     5  0.0937      0.962 0.000 0.000  0 0.000 0.960 0.040
#> SRR2050435     3  0.0000      1.000 0.000 0.000  1 0.000 0.000 0.000
#> SRR2050434     5  0.0937      0.962 0.000 0.000  0 0.000 0.960 0.040
#> SRR2050433     2  0.0000      0.997 0.000 1.000  0 0.000 0.000 0.000
#> SRR2050432     1  0.0000      0.978 1.000 0.000  0 0.000 0.000 0.000
#> SRR2050431     1  0.0993      0.952 0.964 0.000  0 0.012 0.024 0.000
#> SRR2050430     1  0.2632      0.776 0.832 0.000  0 0.004 0.000 0.164
#> SRR2050429     6  0.0000      1.000 0.000 0.000  0 0.000 0.000 1.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 15040 rows and 73 columns.
#>   Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'SD' method.
#>   Subgroups are detected by 'kmeans' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 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 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.370           0.586       0.769         0.4278 0.653   0.653
#> 3 3 0.611           0.853       0.903         0.4778 0.699   0.538
#> 4 4 0.762           0.765       0.869         0.1634 0.901   0.726
#> 5 5 0.906           0.965       0.938         0.0717 0.919   0.707
#> 6 6 0.942           0.885       0.897         0.0337 1.000   1.000

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

suggest_best_k(res)
#> [1] 5

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

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

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>            class entropy silhouette    p1    p2
#> SRR2050410     2  0.9635      0.660 0.388 0.612
#> SRR2050427     2  0.8267      0.085 0.260 0.740
#> SRR2050426     2  0.7950      0.151 0.240 0.760
#> SRR2050425     2  0.9635      0.660 0.388 0.612
#> SRR2050424     1  0.9129      0.998 0.672 0.328
#> SRR2050423     2  0.8608      0.203 0.284 0.716
#> SRR2050422     2  0.9323      0.659 0.348 0.652
#> SRR2050421     2  0.8267      0.085 0.260 0.740
#> SRR2050420     2  0.7950      0.151 0.240 0.760
#> SRR2050419     2  0.9635      0.660 0.388 0.612
#> SRR2050418     2  0.0000      0.561 0.000 1.000
#> SRR2050417     2  0.0000      0.561 0.000 1.000
#> SRR2050416     2  0.9635      0.660 0.388 0.612
#> SRR2050415     1  0.9129      0.998 0.672 0.328
#> SRR2050414     2  0.3274      0.577 0.060 0.940
#> SRR2050413     2  0.9635      0.660 0.388 0.612
#> SRR2050412     2  0.8267      0.085 0.260 0.740
#> SRR2050411     2  0.4431      0.461 0.092 0.908
#> SRR2050409     2  0.9635      0.660 0.388 0.612
#> SRR2050408     2  0.0672      0.555 0.008 0.992
#> SRR2050407     2  0.9635      0.660 0.388 0.612
#> SRR2050406     1  0.9129      0.998 0.672 0.328
#> SRR2050405     2  0.3274      0.577 0.060 0.940
#> SRR2050404     2  0.9635      0.660 0.388 0.612
#> SRR2050403     2  0.4431      0.461 0.092 0.908
#> SRR2050402     2  0.9635      0.660 0.388 0.612
#> SRR2050401     2  0.8267      0.085 0.260 0.740
#> SRR2050400     2  0.5059      0.430 0.112 0.888
#> SRR2050399     2  0.9635      0.660 0.388 0.612
#> SRR2050398     2  0.8267      0.085 0.260 0.740
#> SRR2050397     2  0.4431      0.461 0.092 0.908
#> SRR2050396     1  0.9129      0.998 0.672 0.328
#> SRR2050395     2  0.5408      0.517 0.124 0.876
#> SRR2050394     2  0.9635      0.660 0.388 0.612
#> SRR2050393     1  0.9129      0.998 0.672 0.328
#> SRR2050392     2  0.8713      0.649 0.292 0.708
#> SRR2050465     2  0.9635      0.660 0.388 0.612
#> SRR2050464     1  0.9129      0.998 0.672 0.328
#> SRR2050463     2  0.3274      0.577 0.060 0.940
#> SRR2050462     2  0.9635      0.660 0.388 0.612
#> SRR2050461     1  0.9129      0.998 0.672 0.328
#> SRR2050460     2  0.6148      0.481 0.152 0.848
#> SRR2050459     2  0.9635      0.660 0.388 0.612
#> SRR2050458     1  0.9129      0.998 0.672 0.328
#> SRR2050457     2  0.8608      0.649 0.284 0.716
#> SRR2050456     2  0.9635      0.660 0.388 0.612
#> SRR2050455     1  0.9129      0.998 0.672 0.328
#> SRR2050454     2  0.3274      0.577 0.060 0.940
#> SRR2050453     2  0.9635      0.660 0.388 0.612
#> SRR2050452     1  0.9129      0.998 0.672 0.328
#> SRR2050451     2  0.3274      0.577 0.060 0.940
#> SRR2050450     2  0.9635      0.660 0.388 0.612
#> SRR2050449     1  0.9129      0.998 0.672 0.328
#> SRR2050448     2  0.3274      0.577 0.060 0.940
#> SRR2050447     1  0.9129      0.998 0.672 0.328
#> SRR2050446     2  0.3274      0.577 0.060 0.940
#> SRR2050445     2  0.9635      0.660 0.388 0.612
#> SRR2050444     1  0.9129      0.998 0.672 0.328
#> SRR2050443     2  0.3274      0.577 0.060 0.940
#> SRR2050442     2  0.9635      0.660 0.388 0.612
#> SRR2050441     1  0.9129      0.998 0.672 0.328
#> SRR2050440     2  0.9850     -0.431 0.428 0.572
#> SRR2050439     2  0.9635      0.660 0.388 0.612
#> SRR2050438     1  0.9323      0.965 0.652 0.348
#> SRR2050437     2  0.9850     -0.431 0.428 0.572
#> SRR2050436     2  0.9323      0.659 0.348 0.652
#> SRR2050435     1  0.9129      0.998 0.672 0.328
#> SRR2050434     2  0.9323      0.659 0.348 0.652
#> SRR2050433     2  0.9635      0.660 0.388 0.612
#> SRR2050432     2  0.8267      0.085 0.260 0.740
#> SRR2050431     2  0.7745      0.184 0.228 0.772
#> SRR2050430     2  0.8016      0.139 0.244 0.756
#> SRR2050429     2  0.7950      0.151 0.240 0.760

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>            class entropy silhouette    p1    p2    p3
#> SRR2050410     2  0.0747      0.939 0.016 0.984 0.000
#> SRR2050427     1  0.0000      0.863 1.000 0.000 0.000
#> SRR2050426     1  0.0000      0.863 1.000 0.000 0.000
#> SRR2050425     2  0.0747      0.939 0.016 0.984 0.000
#> SRR2050424     3  0.3482      0.983 0.128 0.000 0.872
#> SRR2050423     1  0.0000      0.863 1.000 0.000 0.000
#> SRR2050422     2  0.8153      0.504 0.240 0.632 0.128
#> SRR2050421     1  0.0000      0.863 1.000 0.000 0.000
#> SRR2050420     1  0.0000      0.863 1.000 0.000 0.000
#> SRR2050419     2  0.0747      0.939 0.016 0.984 0.000
#> SRR2050418     1  0.0000      0.863 1.000 0.000 0.000
#> SRR2050417     1  0.0000      0.863 1.000 0.000 0.000
#> SRR2050416     2  0.0747      0.939 0.016 0.984 0.000
#> SRR2050415     3  0.3482      0.983 0.128 0.000 0.872
#> SRR2050414     1  0.5254      0.688 0.736 0.264 0.000
#> SRR2050413     2  0.1636      0.930 0.016 0.964 0.020
#> SRR2050412     1  0.0000      0.863 1.000 0.000 0.000
#> SRR2050411     1  0.0000      0.863 1.000 0.000 0.000
#> SRR2050409     2  0.0747      0.939 0.016 0.984 0.000
#> SRR2050408     1  0.0000      0.863 1.000 0.000 0.000
#> SRR2050407     2  0.0747      0.939 0.016 0.984 0.000
#> SRR2050406     3  0.3482      0.983 0.128 0.000 0.872
#> SRR2050405     1  0.5254      0.688 0.736 0.264 0.000
#> SRR2050404     2  0.0747      0.939 0.016 0.984 0.000
#> SRR2050403     1  0.0000      0.863 1.000 0.000 0.000
#> SRR2050402     2  0.0747      0.939 0.016 0.984 0.000
#> SRR2050401     1  0.0000      0.863 1.000 0.000 0.000
#> SRR2050400     1  0.0000      0.863 1.000 0.000 0.000
#> SRR2050399     2  0.1636      0.930 0.016 0.964 0.020
#> SRR2050398     1  0.0000      0.863 1.000 0.000 0.000
#> SRR2050397     1  0.0000      0.863 1.000 0.000 0.000
#> SRR2050396     3  0.3482      0.983 0.128 0.000 0.872
#> SRR2050395     1  0.0000      0.863 1.000 0.000 0.000
#> SRR2050394     2  0.0747      0.939 0.016 0.984 0.000
#> SRR2050393     3  0.3482      0.983 0.128 0.000 0.872
#> SRR2050392     1  0.6235      0.336 0.564 0.436 0.000
#> SRR2050465     2  0.0747      0.939 0.016 0.984 0.000
#> SRR2050464     3  0.3482      0.983 0.128 0.000 0.872
#> SRR2050463     1  0.5254      0.688 0.736 0.264 0.000
#> SRR2050462     2  0.0747      0.939 0.016 0.984 0.000
#> SRR2050461     3  0.3482      0.983 0.128 0.000 0.872
#> SRR2050460     1  0.0000      0.863 1.000 0.000 0.000
#> SRR2050459     2  0.0747      0.939 0.016 0.984 0.000
#> SRR2050458     3  0.3482      0.983 0.128 0.000 0.872
#> SRR2050457     2  0.5835      0.442 0.340 0.660 0.000
#> SRR2050456     2  0.0747      0.939 0.016 0.984 0.000
#> SRR2050455     3  0.3482      0.983 0.128 0.000 0.872
#> SRR2050454     1  0.5254      0.688 0.736 0.264 0.000
#> SRR2050453     2  0.0747      0.939 0.016 0.984 0.000
#> SRR2050452     3  0.3482      0.983 0.128 0.000 0.872
#> SRR2050451     1  0.5254      0.688 0.736 0.264 0.000
#> SRR2050450     2  0.0747      0.939 0.016 0.984 0.000
#> SRR2050449     3  0.3482      0.983 0.128 0.000 0.872
#> SRR2050448     1  0.5254      0.688 0.736 0.264 0.000
#> SRR2050447     3  0.3482      0.983 0.128 0.000 0.872
#> SRR2050446     1  0.5254      0.688 0.736 0.264 0.000
#> SRR2050445     2  0.0747      0.939 0.016 0.984 0.000
#> SRR2050444     3  0.3482      0.983 0.128 0.000 0.872
#> SRR2050443     1  0.5254      0.688 0.736 0.264 0.000
#> SRR2050442     2  0.3482      0.850 0.000 0.872 0.128
#> SRR2050441     3  0.3482      0.983 0.128 0.000 0.872
#> SRR2050440     1  0.3846      0.788 0.876 0.016 0.108
#> SRR2050439     2  0.3482      0.850 0.000 0.872 0.128
#> SRR2050438     3  0.1289      0.886 0.032 0.000 0.968
#> SRR2050437     1  0.3846      0.788 0.876 0.016 0.108
#> SRR2050436     2  0.8117      0.513 0.236 0.636 0.128
#> SRR2050435     3  0.1289      0.886 0.032 0.000 0.968
#> SRR2050434     1  0.8850      0.383 0.516 0.356 0.128
#> SRR2050433     2  0.0747      0.939 0.016 0.984 0.000
#> SRR2050432     1  0.0000      0.863 1.000 0.000 0.000
#> SRR2050431     1  0.0000      0.863 1.000 0.000 0.000
#> SRR2050430     1  0.3846      0.788 0.876 0.016 0.108
#> SRR2050429     1  0.3846      0.788 0.876 0.016 0.108

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> SRR2050410     2  0.0188      0.993 0.004 0.996 0.000 0.000
#> SRR2050427     1  0.1474      0.662 0.948 0.000 0.000 0.052
#> SRR2050426     1  0.1474      0.662 0.948 0.000 0.000 0.052
#> SRR2050425     2  0.0188      0.993 0.004 0.996 0.000 0.000
#> SRR2050424     3  0.0000      0.998 0.000 0.000 1.000 0.000
#> SRR2050423     1  0.5256      0.506 0.596 0.000 0.012 0.392
#> SRR2050422     4  0.3249      0.698 0.008 0.140 0.000 0.852
#> SRR2050421     1  0.1474      0.662 0.948 0.000 0.000 0.052
#> SRR2050420     1  0.1474      0.662 0.948 0.000 0.000 0.052
#> SRR2050419     2  0.0188      0.993 0.004 0.996 0.000 0.000
#> SRR2050418     1  0.0000      0.675 1.000 0.000 0.000 0.000
#> SRR2050417     1  0.1022      0.668 0.968 0.000 0.000 0.032
#> SRR2050416     2  0.0188      0.993 0.004 0.996 0.000 0.000
#> SRR2050415     3  0.0000      0.998 0.000 0.000 1.000 0.000
#> SRR2050414     1  0.7565      0.440 0.460 0.136 0.012 0.392
#> SRR2050413     2  0.2266      0.888 0.004 0.912 0.000 0.084
#> SRR2050412     1  0.1302      0.667 0.956 0.000 0.000 0.044
#> SRR2050411     1  0.0000      0.675 1.000 0.000 0.000 0.000
#> SRR2050409     2  0.0188      0.993 0.004 0.996 0.000 0.000
#> SRR2050408     1  0.0000      0.675 1.000 0.000 0.000 0.000
#> SRR2050407     2  0.0188      0.993 0.004 0.996 0.000 0.000
#> SRR2050406     3  0.0000      0.998 0.000 0.000 1.000 0.000
#> SRR2050405     1  0.7565      0.440 0.460 0.136 0.012 0.392
#> SRR2050404     2  0.0188      0.993 0.004 0.996 0.000 0.000
#> SRR2050403     1  0.0000      0.675 1.000 0.000 0.000 0.000
#> SRR2050402     2  0.0188      0.993 0.004 0.996 0.000 0.000
#> SRR2050401     1  0.1302      0.667 0.956 0.000 0.000 0.044
#> SRR2050400     1  0.1474      0.662 0.948 0.000 0.000 0.052
#> SRR2050399     2  0.1004      0.969 0.004 0.972 0.000 0.024
#> SRR2050398     1  0.1302      0.667 0.956 0.000 0.000 0.044
#> SRR2050397     1  0.0000      0.675 1.000 0.000 0.000 0.000
#> SRR2050396     3  0.0000      0.998 0.000 0.000 1.000 0.000
#> SRR2050395     1  0.6596      0.483 0.540 0.056 0.012 0.392
#> SRR2050394     2  0.0188      0.993 0.004 0.996 0.000 0.000
#> SRR2050393     3  0.0000      0.998 0.000 0.000 1.000 0.000
#> SRR2050392     1  0.7264      0.429 0.460 0.148 0.000 0.392
#> SRR2050465     2  0.0188      0.993 0.004 0.996 0.000 0.000
#> SRR2050464     3  0.0000      0.998 0.000 0.000 1.000 0.000
#> SRR2050463     1  0.7565      0.440 0.460 0.136 0.012 0.392
#> SRR2050462     2  0.0188      0.993 0.004 0.996 0.000 0.000
#> SRR2050461     3  0.0000      0.998 0.000 0.000 1.000 0.000
#> SRR2050460     1  0.5256      0.506 0.596 0.000 0.012 0.392
#> SRR2050459     2  0.0188      0.993 0.004 0.996 0.000 0.000
#> SRR2050458     3  0.0000      0.998 0.000 0.000 1.000 0.000
#> SRR2050457     4  0.8219     -0.293 0.344 0.264 0.012 0.380
#> SRR2050456     2  0.0188      0.993 0.004 0.996 0.000 0.000
#> SRR2050455     3  0.0000      0.998 0.000 0.000 1.000 0.000
#> SRR2050454     1  0.7565      0.440 0.460 0.136 0.012 0.392
#> SRR2050453     2  0.0188      0.993 0.004 0.996 0.000 0.000
#> SRR2050452     3  0.0000      0.998 0.000 0.000 1.000 0.000
#> SRR2050451     1  0.7565      0.440 0.460 0.136 0.012 0.392
#> SRR2050450     2  0.0188      0.993 0.004 0.996 0.000 0.000
#> SRR2050449     3  0.0000      0.998 0.000 0.000 1.000 0.000
#> SRR2050448     1  0.7565      0.440 0.460 0.136 0.012 0.392
#> SRR2050447     3  0.0000      0.998 0.000 0.000 1.000 0.000
#> SRR2050446     1  0.7565      0.440 0.460 0.136 0.012 0.392
#> SRR2050445     2  0.0188      0.993 0.004 0.996 0.000 0.000
#> SRR2050444     3  0.0000      0.998 0.000 0.000 1.000 0.000
#> SRR2050443     1  0.7565      0.440 0.460 0.136 0.012 0.392
#> SRR2050442     4  0.4661      0.470 0.000 0.348 0.000 0.652
#> SRR2050441     3  0.0188      0.996 0.000 0.004 0.996 0.000
#> SRR2050440     4  0.2704      0.645 0.124 0.000 0.000 0.876
#> SRR2050439     4  0.4661      0.470 0.000 0.348 0.000 0.652
#> SRR2050438     3  0.0524      0.989 0.000 0.004 0.988 0.008
#> SRR2050437     4  0.2704      0.645 0.124 0.000 0.000 0.876
#> SRR2050436     4  0.3249      0.698 0.008 0.140 0.000 0.852
#> SRR2050435     3  0.0524      0.989 0.000 0.004 0.988 0.008
#> SRR2050434     4  0.1807      0.667 0.008 0.052 0.000 0.940
#> SRR2050433     2  0.0188      0.993 0.004 0.996 0.000 0.000
#> SRR2050432     1  0.1302      0.667 0.956 0.000 0.000 0.044
#> SRR2050431     1  0.1867      0.660 0.928 0.000 0.000 0.072
#> SRR2050430     4  0.4304      0.547 0.284 0.000 0.000 0.716
#> SRR2050429     4  0.4564      0.493 0.328 0.000 0.000 0.672

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>            class entropy silhouette    p1    p2    p3    p4    p5
#> SRR2050410     2  0.0609      0.977 0.000 0.980 0.000 0.020 0.000
#> SRR2050427     1  0.3608      0.971 0.812 0.000 0.000 0.148 0.040
#> SRR2050426     1  0.2763      0.976 0.848 0.000 0.000 0.148 0.004
#> SRR2050425     2  0.0000      0.977 0.000 1.000 0.000 0.000 0.000
#> SRR2050424     3  0.0404      0.981 0.000 0.000 0.988 0.012 0.000
#> SRR2050423     4  0.1522      0.957 0.044 0.000 0.012 0.944 0.000
#> SRR2050422     5  0.2338      0.936 0.032 0.016 0.000 0.036 0.916
#> SRR2050421     1  0.3608      0.971 0.812 0.000 0.000 0.148 0.040
#> SRR2050420     1  0.2763      0.976 0.848 0.000 0.000 0.148 0.004
#> SRR2050419     2  0.0609      0.977 0.000 0.980 0.000 0.020 0.000
#> SRR2050418     1  0.3608      0.969 0.812 0.000 0.000 0.148 0.040
#> SRR2050417     1  0.2890      0.964 0.836 0.000 0.000 0.160 0.004
#> SRR2050416     2  0.0510      0.971 0.016 0.984 0.000 0.000 0.000
#> SRR2050415     3  0.0404      0.981 0.000 0.000 0.988 0.012 0.000
#> SRR2050414     4  0.1710      0.980 0.020 0.024 0.012 0.944 0.000
#> SRR2050413     2  0.3052      0.873 0.032 0.868 0.000 0.008 0.092
#> SRR2050412     1  0.3521      0.972 0.820 0.000 0.000 0.140 0.040
#> SRR2050411     1  0.2798      0.975 0.852 0.000 0.000 0.140 0.008
#> SRR2050409     2  0.0609      0.977 0.000 0.980 0.000 0.020 0.000
#> SRR2050408     1  0.2843      0.974 0.848 0.000 0.000 0.144 0.008
#> SRR2050407     2  0.0609      0.977 0.000 0.980 0.000 0.020 0.000
#> SRR2050406     3  0.0290      0.983 0.000 0.000 0.992 0.008 0.000
#> SRR2050405     4  0.1710      0.980 0.020 0.024 0.012 0.944 0.000
#> SRR2050404     2  0.0000      0.977 0.000 1.000 0.000 0.000 0.000
#> SRR2050403     1  0.2798      0.975 0.852 0.000 0.000 0.140 0.008
#> SRR2050402     2  0.0703      0.966 0.024 0.976 0.000 0.000 0.000
#> SRR2050401     1  0.3521      0.972 0.820 0.000 0.000 0.140 0.040
#> SRR2050400     1  0.2763      0.976 0.848 0.000 0.000 0.148 0.004
#> SRR2050399     2  0.2654      0.890 0.032 0.884 0.000 0.000 0.084
#> SRR2050398     1  0.3521      0.972 0.820 0.000 0.000 0.140 0.040
#> SRR2050397     1  0.2798      0.975 0.852 0.000 0.000 0.140 0.008
#> SRR2050396     3  0.0290      0.983 0.000 0.000 0.992 0.008 0.000
#> SRR2050395     4  0.1651      0.967 0.036 0.008 0.012 0.944 0.000
#> SRR2050394     2  0.0609      0.977 0.000 0.980 0.000 0.020 0.000
#> SRR2050393     3  0.0290      0.983 0.000 0.000 0.992 0.008 0.000
#> SRR2050392     4  0.1041      0.956 0.000 0.032 0.004 0.964 0.000
#> SRR2050465     2  0.0000      0.977 0.000 1.000 0.000 0.000 0.000
#> SRR2050464     3  0.0290      0.983 0.000 0.000 0.992 0.008 0.000
#> SRR2050463     4  0.1710      0.980 0.020 0.024 0.012 0.944 0.000
#> SRR2050462     2  0.0000      0.977 0.000 1.000 0.000 0.000 0.000
#> SRR2050461     3  0.0290      0.983 0.000 0.000 0.992 0.008 0.000
#> SRR2050460     4  0.1522      0.957 0.044 0.000 0.012 0.944 0.000
#> SRR2050459     2  0.0609      0.977 0.000 0.980 0.000 0.020 0.000
#> SRR2050458     3  0.0290      0.983 0.000 0.000 0.992 0.008 0.000
#> SRR2050457     4  0.2414      0.894 0.008 0.080 0.012 0.900 0.000
#> SRR2050456     2  0.0609      0.977 0.000 0.980 0.000 0.020 0.000
#> SRR2050455     3  0.0290      0.983 0.000 0.000 0.992 0.008 0.000
#> SRR2050454     4  0.1710      0.980 0.020 0.024 0.012 0.944 0.000
#> SRR2050453     2  0.0000      0.977 0.000 1.000 0.000 0.000 0.000
#> SRR2050452     3  0.0290      0.983 0.000 0.000 0.992 0.008 0.000
#> SRR2050451     4  0.1710      0.980 0.020 0.024 0.012 0.944 0.000
#> SRR2050450     2  0.0000      0.977 0.000 1.000 0.000 0.000 0.000
#> SRR2050449     3  0.0290      0.983 0.000 0.000 0.992 0.008 0.000
#> SRR2050448     4  0.1710      0.980 0.020 0.024 0.012 0.944 0.000
#> SRR2050447     3  0.0290      0.983 0.000 0.000 0.992 0.008 0.000
#> SRR2050446     4  0.1710      0.980 0.020 0.024 0.012 0.944 0.000
#> SRR2050445     2  0.0609      0.977 0.000 0.980 0.000 0.020 0.000
#> SRR2050444     3  0.0290      0.983 0.000 0.000 0.992 0.008 0.000
#> SRR2050443     4  0.1710      0.980 0.020 0.024 0.012 0.944 0.000
#> SRR2050442     5  0.1549      0.938 0.000 0.040 0.000 0.016 0.944
#> SRR2050441     3  0.2036      0.932 0.056 0.000 0.920 0.024 0.000
#> SRR2050440     5  0.3065      0.938 0.072 0.000 0.008 0.048 0.872
#> SRR2050439     5  0.1549      0.938 0.000 0.040 0.000 0.016 0.944
#> SRR2050438     3  0.2673      0.911 0.072 0.000 0.892 0.028 0.008
#> SRR2050437     5  0.3065      0.938 0.072 0.000 0.008 0.048 0.872
#> SRR2050436     5  0.1300      0.946 0.000 0.016 0.000 0.028 0.956
#> SRR2050435     3  0.2409      0.923 0.056 0.000 0.908 0.028 0.008
#> SRR2050434     5  0.1121      0.942 0.000 0.000 0.000 0.044 0.956
#> SRR2050433     2  0.0290      0.978 0.000 0.992 0.000 0.008 0.000
#> SRR2050432     1  0.3521      0.972 0.820 0.000 0.000 0.140 0.040
#> SRR2050431     1  0.2763      0.976 0.848 0.000 0.000 0.148 0.004
#> SRR2050430     5  0.2673      0.935 0.072 0.000 0.008 0.028 0.892
#> SRR2050429     5  0.2746      0.922 0.112 0.000 0.008 0.008 0.872

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>            class entropy silhouette    p1    p2    p3    p4    p5    p6
#> SRR2050410     2  0.0146     0.9117 0.000 0.996 0.000 0.004 0.000 0.000
#> SRR2050427     1  0.2491     0.9197 0.836 0.000 0.000 0.000 0.000 0.164
#> SRR2050426     1  0.1714     0.9291 0.908 0.000 0.000 0.000 0.000 0.092
#> SRR2050425     2  0.0508     0.9102 0.000 0.984 0.000 0.004 0.000 0.012
#> SRR2050424     3  0.0260     0.9427 0.000 0.000 0.992 0.000 0.000 0.008
#> SRR2050423     4  0.1700     0.9700 0.080 0.000 0.000 0.916 0.000 0.004
#> SRR2050422     5  0.3518     0.6984 0.000 0.000 0.000 0.012 0.732 0.256
#> SRR2050421     1  0.2491     0.9197 0.836 0.000 0.000 0.000 0.000 0.164
#> SRR2050420     1  0.1714     0.9291 0.908 0.000 0.000 0.000 0.000 0.092
#> SRR2050419     2  0.0146     0.9117 0.000 0.996 0.000 0.004 0.000 0.000
#> SRR2050418     1  0.1753     0.9246 0.912 0.000 0.000 0.004 0.000 0.084
#> SRR2050417     1  0.0717     0.9219 0.976 0.000 0.000 0.008 0.000 0.016
#> SRR2050416     2  0.2333     0.8363 0.000 0.872 0.000 0.004 0.004 0.120
#> SRR2050415     3  0.0260     0.9427 0.000 0.000 0.992 0.000 0.000 0.008
#> SRR2050414     4  0.2011     0.9844 0.064 0.020 0.000 0.912 0.000 0.004
#> SRR2050413     2  0.6342     0.0948 0.000 0.388 0.000 0.012 0.344 0.256
#> SRR2050412     1  0.2300     0.9213 0.856 0.000 0.000 0.000 0.000 0.144
#> SRR2050411     1  0.0508     0.9250 0.984 0.000 0.000 0.004 0.000 0.012
#> SRR2050409     2  0.0146     0.9117 0.000 0.996 0.000 0.004 0.000 0.000
#> SRR2050408     1  0.0603     0.9237 0.980 0.000 0.000 0.004 0.000 0.016
#> SRR2050407     2  0.0146     0.9117 0.000 0.996 0.000 0.004 0.000 0.000
#> SRR2050406     3  0.0260     0.9434 0.000 0.000 0.992 0.008 0.000 0.000
#> SRR2050405     4  0.2123     0.9845 0.064 0.020 0.000 0.908 0.000 0.008
#> SRR2050404     2  0.0508     0.9102 0.000 0.984 0.000 0.004 0.000 0.012
#> SRR2050403     1  0.0508     0.9250 0.984 0.000 0.000 0.004 0.000 0.012
#> SRR2050402     2  0.3431     0.7314 0.000 0.756 0.000 0.016 0.000 0.228
#> SRR2050401     1  0.2300     0.9213 0.856 0.000 0.000 0.000 0.000 0.144
#> SRR2050400     1  0.0632     0.9281 0.976 0.000 0.000 0.000 0.000 0.024
#> SRR2050399     2  0.6336     0.1132 0.000 0.396 0.000 0.012 0.336 0.256
#> SRR2050398     1  0.2491     0.9197 0.836 0.000 0.000 0.000 0.000 0.164
#> SRR2050397     1  0.0508     0.9250 0.984 0.000 0.000 0.004 0.000 0.012
#> SRR2050396     3  0.0725     0.9355 0.000 0.000 0.976 0.012 0.000 0.012
#> SRR2050395     4  0.1843     0.9730 0.080 0.004 0.000 0.912 0.000 0.004
#> SRR2050394     2  0.0146     0.9117 0.000 0.996 0.000 0.004 0.000 0.000
#> SRR2050393     3  0.0260     0.9434 0.000 0.000 0.992 0.008 0.000 0.000
#> SRR2050392     4  0.2247     0.9807 0.060 0.024 0.000 0.904 0.000 0.012
#> SRR2050465     2  0.0508     0.9102 0.000 0.984 0.000 0.004 0.000 0.012
#> SRR2050464     3  0.0000     0.9448 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2050463     4  0.2011     0.9850 0.064 0.020 0.000 0.912 0.000 0.004
#> SRR2050462     2  0.0508     0.9102 0.000 0.984 0.000 0.004 0.000 0.012
#> SRR2050461     3  0.0000     0.9448 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2050460     4  0.1700     0.9706 0.080 0.000 0.000 0.916 0.000 0.004
#> SRR2050459     2  0.0000     0.9117 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2050458     3  0.0000     0.9448 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2050457     4  0.2316     0.9549 0.040 0.040 0.000 0.904 0.000 0.016
#> SRR2050456     2  0.0146     0.9117 0.000 0.996 0.000 0.004 0.000 0.000
#> SRR2050455     3  0.0260     0.9434 0.000 0.000 0.992 0.008 0.000 0.000
#> SRR2050454     4  0.2224     0.9831 0.064 0.020 0.000 0.904 0.000 0.012
#> SRR2050453     2  0.0508     0.9102 0.000 0.984 0.000 0.004 0.000 0.012
#> SRR2050452     3  0.0000     0.9448 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2050451     4  0.2011     0.9850 0.064 0.020 0.000 0.912 0.000 0.004
#> SRR2050450     2  0.0508     0.9102 0.000 0.984 0.000 0.004 0.000 0.012
#> SRR2050449     3  0.0000     0.9448 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2050448     4  0.2011     0.9850 0.064 0.020 0.000 0.912 0.000 0.004
#> SRR2050447     3  0.0000     0.9448 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2050446     4  0.2011     0.9850 0.064 0.020 0.000 0.912 0.000 0.004
#> SRR2050445     2  0.0146     0.9117 0.000 0.996 0.000 0.004 0.000 0.000
#> SRR2050444     3  0.0000     0.9448 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2050443     4  0.2224     0.9831 0.064 0.020 0.000 0.904 0.000 0.012
#> SRR2050442     5  0.0937     0.8258 0.000 0.000 0.000 0.000 0.960 0.040
#> SRR2050441     3  0.3806     0.7774 0.000 0.000 0.752 0.048 0.000 0.200
#> SRR2050440     5  0.4214     0.8095 0.024 0.000 0.000 0.004 0.652 0.320
#> SRR2050439     5  0.0937     0.8258 0.000 0.000 0.000 0.000 0.960 0.040
#> SRR2050438     3  0.4575     0.5973 0.000 0.000 0.600 0.048 0.000 0.352
#> SRR2050437     5  0.4214     0.8095 0.024 0.000 0.000 0.004 0.652 0.320
#> SRR2050436     5  0.0000     0.8335 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR2050435     3  0.3835     0.7740 0.000 0.000 0.748 0.048 0.000 0.204
#> SRR2050434     5  0.0000     0.8335 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR2050433     2  0.0000     0.9117 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2050432     1  0.2491     0.9197 0.836 0.000 0.000 0.000 0.000 0.164
#> SRR2050431     1  0.0777     0.9274 0.972 0.000 0.000 0.004 0.000 0.024
#> SRR2050430     5  0.4198     0.8099 0.024 0.000 0.000 0.004 0.656 0.316
#> SRR2050429     5  0.4405     0.8052 0.036 0.000 0.000 0.004 0.644 0.316

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

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 1.000           0.977       0.990         0.5067 0.493   0.493
#> 3 3 0.888           0.897       0.956         0.2951 0.830   0.664
#> 4 4 1.000           0.993       0.997         0.1400 0.877   0.660
#> 5 5 1.000           0.997       0.999         0.0666 0.919   0.696
#> 6 6 0.951           0.892       0.886         0.0236 0.992   0.962

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 4

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

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

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

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>            class entropy silhouette    p1    p2
#> SRR2050410     2   0.000      0.986 0.000 1.000
#> SRR2050427     1   0.000      0.992 1.000 0.000
#> SRR2050426     1   0.000      0.992 1.000 0.000
#> SRR2050425     2   0.000      0.986 0.000 1.000
#> SRR2050424     1   0.000      0.992 1.000 0.000
#> SRR2050423     1   0.000      0.992 1.000 0.000
#> SRR2050422     2   0.000      0.986 0.000 1.000
#> SRR2050421     1   0.000      0.992 1.000 0.000
#> SRR2050420     1   0.000      0.992 1.000 0.000
#> SRR2050419     2   0.000      0.986 0.000 1.000
#> SRR2050418     2   0.775      0.715 0.228 0.772
#> SRR2050417     2   0.615      0.825 0.152 0.848
#> SRR2050416     2   0.000      0.986 0.000 1.000
#> SRR2050415     1   0.000      0.992 1.000 0.000
#> SRR2050414     2   0.000      0.986 0.000 1.000
#> SRR2050413     2   0.000      0.986 0.000 1.000
#> SRR2050412     1   0.000      0.992 1.000 0.000
#> SRR2050411     1   0.000      0.992 1.000 0.000
#> SRR2050409     2   0.000      0.986 0.000 1.000
#> SRR2050408     1   0.163      0.969 0.976 0.024
#> SRR2050407     2   0.000      0.986 0.000 1.000
#> SRR2050406     1   0.000      0.992 1.000 0.000
#> SRR2050405     2   0.482      0.883 0.104 0.896
#> SRR2050404     2   0.000      0.986 0.000 1.000
#> SRR2050403     1   0.000      0.992 1.000 0.000
#> SRR2050402     2   0.000      0.986 0.000 1.000
#> SRR2050401     1   0.000      0.992 1.000 0.000
#> SRR2050400     1   0.000      0.992 1.000 0.000
#> SRR2050399     2   0.000      0.986 0.000 1.000
#> SRR2050398     1   0.000      0.992 1.000 0.000
#> SRR2050397     1   0.000      0.992 1.000 0.000
#> SRR2050396     1   0.000      0.992 1.000 0.000
#> SRR2050395     1   0.802      0.669 0.756 0.244
#> SRR2050394     2   0.000      0.986 0.000 1.000
#> SRR2050393     1   0.000      0.992 1.000 0.000
#> SRR2050392     2   0.000      0.986 0.000 1.000
#> SRR2050465     2   0.000      0.986 0.000 1.000
#> SRR2050464     1   0.000      0.992 1.000 0.000
#> SRR2050463     2   0.000      0.986 0.000 1.000
#> SRR2050462     2   0.000      0.986 0.000 1.000
#> SRR2050461     1   0.000      0.992 1.000 0.000
#> SRR2050460     1   0.000      0.992 1.000 0.000
#> SRR2050459     2   0.000      0.986 0.000 1.000
#> SRR2050458     1   0.000      0.992 1.000 0.000
#> SRR2050457     2   0.000      0.986 0.000 1.000
#> SRR2050456     2   0.000      0.986 0.000 1.000
#> SRR2050455     1   0.000      0.992 1.000 0.000
#> SRR2050454     2   0.000      0.986 0.000 1.000
#> SRR2050453     2   0.000      0.986 0.000 1.000
#> SRR2050452     1   0.000      0.992 1.000 0.000
#> SRR2050451     2   0.000      0.986 0.000 1.000
#> SRR2050450     2   0.000      0.986 0.000 1.000
#> SRR2050449     1   0.000      0.992 1.000 0.000
#> SRR2050448     2   0.000      0.986 0.000 1.000
#> SRR2050447     1   0.000      0.992 1.000 0.000
#> SRR2050446     2   0.000      0.986 0.000 1.000
#> SRR2050445     2   0.000      0.986 0.000 1.000
#> SRR2050444     1   0.000      0.992 1.000 0.000
#> SRR2050443     2   0.000      0.986 0.000 1.000
#> SRR2050442     2   0.000      0.986 0.000 1.000
#> SRR2050441     1   0.000      0.992 1.000 0.000
#> SRR2050440     1   0.000      0.992 1.000 0.000
#> SRR2050439     2   0.000      0.986 0.000 1.000
#> SRR2050438     1   0.000      0.992 1.000 0.000
#> SRR2050437     1   0.000      0.992 1.000 0.000
#> SRR2050436     2   0.000      0.986 0.000 1.000
#> SRR2050435     1   0.000      0.992 1.000 0.000
#> SRR2050434     2   0.000      0.986 0.000 1.000
#> SRR2050433     2   0.000      0.986 0.000 1.000
#> SRR2050432     1   0.000      0.992 1.000 0.000
#> SRR2050431     1   0.000      0.992 1.000 0.000
#> SRR2050430     1   0.000      0.992 1.000 0.000
#> SRR2050429     1   0.000      0.992 1.000 0.000

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>            class entropy silhouette    p1    p2    p3
#> SRR2050410     2  0.0000      0.900 0.000 1.000 0.000
#> SRR2050427     1  0.0000      0.992 1.000 0.000 0.000
#> SRR2050426     1  0.0000      0.992 1.000 0.000 0.000
#> SRR2050425     2  0.0000      0.900 0.000 1.000 0.000
#> SRR2050424     3  0.0000      1.000 0.000 0.000 1.000
#> SRR2050423     1  0.0000      0.992 1.000 0.000 0.000
#> SRR2050422     2  0.0000      0.900 0.000 1.000 0.000
#> SRR2050421     1  0.0000      0.992 1.000 0.000 0.000
#> SRR2050420     1  0.0000      0.992 1.000 0.000 0.000
#> SRR2050419     2  0.0000      0.900 0.000 1.000 0.000
#> SRR2050418     1  0.0000      0.992 1.000 0.000 0.000
#> SRR2050417     1  0.0000      0.992 1.000 0.000 0.000
#> SRR2050416     2  0.0000      0.900 0.000 1.000 0.000
#> SRR2050415     3  0.0000      1.000 0.000 0.000 1.000
#> SRR2050414     2  0.6244      0.361 0.440 0.560 0.000
#> SRR2050413     2  0.0000      0.900 0.000 1.000 0.000
#> SRR2050412     1  0.0000      0.992 1.000 0.000 0.000
#> SRR2050411     1  0.0000      0.992 1.000 0.000 0.000
#> SRR2050409     2  0.0000      0.900 0.000 1.000 0.000
#> SRR2050408     1  0.0000      0.992 1.000 0.000 0.000
#> SRR2050407     2  0.0000      0.900 0.000 1.000 0.000
#> SRR2050406     3  0.0000      1.000 0.000 0.000 1.000
#> SRR2050405     2  0.6244      0.361 0.440 0.560 0.000
#> SRR2050404     2  0.0000      0.900 0.000 1.000 0.000
#> SRR2050403     1  0.0000      0.992 1.000 0.000 0.000
#> SRR2050402     2  0.0000      0.900 0.000 1.000 0.000
#> SRR2050401     1  0.0000      0.992 1.000 0.000 0.000
#> SRR2050400     1  0.0000      0.992 1.000 0.000 0.000
#> SRR2050399     2  0.0000      0.900 0.000 1.000 0.000
#> SRR2050398     1  0.0000      0.992 1.000 0.000 0.000
#> SRR2050397     1  0.0000      0.992 1.000 0.000 0.000
#> SRR2050396     3  0.0000      1.000 0.000 0.000 1.000
#> SRR2050395     1  0.0000      0.992 1.000 0.000 0.000
#> SRR2050394     2  0.0000      0.900 0.000 1.000 0.000
#> SRR2050393     3  0.0000      1.000 0.000 0.000 1.000
#> SRR2050392     2  0.0000      0.900 0.000 1.000 0.000
#> SRR2050465     2  0.0000      0.900 0.000 1.000 0.000
#> SRR2050464     3  0.0000      1.000 0.000 0.000 1.000
#> SRR2050463     2  0.6235      0.371 0.436 0.564 0.000
#> SRR2050462     2  0.0000      0.900 0.000 1.000 0.000
#> SRR2050461     3  0.0000      1.000 0.000 0.000 1.000
#> SRR2050460     1  0.0000      0.992 1.000 0.000 0.000
#> SRR2050459     2  0.0000      0.900 0.000 1.000 0.000
#> SRR2050458     3  0.0000      1.000 0.000 0.000 1.000
#> SRR2050457     2  0.0000      0.900 0.000 1.000 0.000
#> SRR2050456     2  0.0000      0.900 0.000 1.000 0.000
#> SRR2050455     3  0.0000      1.000 0.000 0.000 1.000
#> SRR2050454     2  0.6235      0.371 0.436 0.564 0.000
#> SRR2050453     2  0.0000      0.900 0.000 1.000 0.000
#> SRR2050452     3  0.0000      1.000 0.000 0.000 1.000
#> SRR2050451     2  0.6235      0.371 0.436 0.564 0.000
#> SRR2050450     2  0.0000      0.900 0.000 1.000 0.000
#> SRR2050449     3  0.0000      1.000 0.000 0.000 1.000
#> SRR2050448     2  0.6235      0.371 0.436 0.564 0.000
#> SRR2050447     3  0.0000      1.000 0.000 0.000 1.000
#> SRR2050446     2  0.6235      0.371 0.436 0.564 0.000
#> SRR2050445     2  0.0000      0.900 0.000 1.000 0.000
#> SRR2050444     3  0.0000      1.000 0.000 0.000 1.000
#> SRR2050443     2  0.0747      0.889 0.016 0.984 0.000
#> SRR2050442     2  0.0000      0.900 0.000 1.000 0.000
#> SRR2050441     3  0.0000      1.000 0.000 0.000 1.000
#> SRR2050440     3  0.0000      1.000 0.000 0.000 1.000
#> SRR2050439     2  0.0000      0.900 0.000 1.000 0.000
#> SRR2050438     3  0.0000      1.000 0.000 0.000 1.000
#> SRR2050437     3  0.0000      1.000 0.000 0.000 1.000
#> SRR2050436     2  0.0000      0.900 0.000 1.000 0.000
#> SRR2050435     3  0.0000      1.000 0.000 0.000 1.000
#> SRR2050434     2  0.0000      0.900 0.000 1.000 0.000
#> SRR2050433     2  0.0000      0.900 0.000 1.000 0.000
#> SRR2050432     1  0.0000      0.992 1.000 0.000 0.000
#> SRR2050431     1  0.0000      0.992 1.000 0.000 0.000
#> SRR2050430     1  0.3941      0.801 0.844 0.000 0.156
#> SRR2050429     1  0.0000      0.992 1.000 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette p1    p2 p3    p4
#> SRR2050410     2   0.000      1.000  0 1.000  0 0.000
#> SRR2050427     1   0.000      1.000  1 0.000  0 0.000
#> SRR2050426     1   0.000      1.000  1 0.000  0 0.000
#> SRR2050425     2   0.000      1.000  0 1.000  0 0.000
#> SRR2050424     3   0.000      1.000  0 0.000  1 0.000
#> SRR2050423     4   0.000      0.981  0 0.000  0 1.000
#> SRR2050422     2   0.000      1.000  0 1.000  0 0.000
#> SRR2050421     1   0.000      1.000  1 0.000  0 0.000
#> SRR2050420     1   0.000      1.000  1 0.000  0 0.000
#> SRR2050419     2   0.000      1.000  0 1.000  0 0.000
#> SRR2050418     1   0.000      1.000  1 0.000  0 0.000
#> SRR2050417     1   0.000      1.000  1 0.000  0 0.000
#> SRR2050416     2   0.000      1.000  0 1.000  0 0.000
#> SRR2050415     3   0.000      1.000  0 0.000  1 0.000
#> SRR2050414     4   0.000      0.981  0 0.000  0 1.000
#> SRR2050413     2   0.000      1.000  0 1.000  0 0.000
#> SRR2050412     1   0.000      1.000  1 0.000  0 0.000
#> SRR2050411     1   0.000      1.000  1 0.000  0 0.000
#> SRR2050409     2   0.000      1.000  0 1.000  0 0.000
#> SRR2050408     1   0.000      1.000  1 0.000  0 0.000
#> SRR2050407     2   0.000      1.000  0 1.000  0 0.000
#> SRR2050406     3   0.000      1.000  0 0.000  1 0.000
#> SRR2050405     4   0.000      0.981  0 0.000  0 1.000
#> SRR2050404     2   0.000      1.000  0 1.000  0 0.000
#> SRR2050403     1   0.000      1.000  1 0.000  0 0.000
#> SRR2050402     2   0.000      1.000  0 1.000  0 0.000
#> SRR2050401     1   0.000      1.000  1 0.000  0 0.000
#> SRR2050400     1   0.000      1.000  1 0.000  0 0.000
#> SRR2050399     2   0.000      1.000  0 1.000  0 0.000
#> SRR2050398     1   0.000      1.000  1 0.000  0 0.000
#> SRR2050397     1   0.000      1.000  1 0.000  0 0.000
#> SRR2050396     3   0.000      1.000  0 0.000  1 0.000
#> SRR2050395     4   0.000      0.981  0 0.000  0 1.000
#> SRR2050394     2   0.000      1.000  0 1.000  0 0.000
#> SRR2050393     3   0.000      1.000  0 0.000  1 0.000
#> SRR2050392     4   0.000      0.981  0 0.000  0 1.000
#> SRR2050465     2   0.000      1.000  0 1.000  0 0.000
#> SRR2050464     3   0.000      1.000  0 0.000  1 0.000
#> SRR2050463     4   0.000      0.981  0 0.000  0 1.000
#> SRR2050462     2   0.000      1.000  0 1.000  0 0.000
#> SRR2050461     3   0.000      1.000  0 0.000  1 0.000
#> SRR2050460     4   0.000      0.981  0 0.000  0 1.000
#> SRR2050459     2   0.000      1.000  0 1.000  0 0.000
#> SRR2050458     3   0.000      1.000  0 0.000  1 0.000
#> SRR2050457     4   0.369      0.737  0 0.208  0 0.792
#> SRR2050456     2   0.000      1.000  0 1.000  0 0.000
#> SRR2050455     3   0.000      1.000  0 0.000  1 0.000
#> SRR2050454     4   0.000      0.981  0 0.000  0 1.000
#> SRR2050453     2   0.000      1.000  0 1.000  0 0.000
#> SRR2050452     3   0.000      1.000  0 0.000  1 0.000
#> SRR2050451     4   0.000      0.981  0 0.000  0 1.000
#> SRR2050450     2   0.000      1.000  0 1.000  0 0.000
#> SRR2050449     3   0.000      1.000  0 0.000  1 0.000
#> SRR2050448     4   0.000      0.981  0 0.000  0 1.000
#> SRR2050447     3   0.000      1.000  0 0.000  1 0.000
#> SRR2050446     4   0.000      0.981  0 0.000  0 1.000
#> SRR2050445     2   0.000      1.000  0 1.000  0 0.000
#> SRR2050444     3   0.000      1.000  0 0.000  1 0.000
#> SRR2050443     4   0.000      0.981  0 0.000  0 1.000
#> SRR2050442     2   0.000      1.000  0 1.000  0 0.000
#> SRR2050441     3   0.000      1.000  0 0.000  1 0.000
#> SRR2050440     3   0.000      1.000  0 0.000  1 0.000
#> SRR2050439     2   0.000      1.000  0 1.000  0 0.000
#> SRR2050438     3   0.000      1.000  0 0.000  1 0.000
#> SRR2050437     3   0.000      1.000  0 0.000  1 0.000
#> SRR2050436     2   0.000      1.000  0 1.000  0 0.000
#> SRR2050435     3   0.000      1.000  0 0.000  1 0.000
#> SRR2050434     2   0.000      1.000  0 1.000  0 0.000
#> SRR2050433     2   0.000      1.000  0 1.000  0 0.000
#> SRR2050432     1   0.000      1.000  1 0.000  0 0.000
#> SRR2050431     1   0.000      1.000  1 0.000  0 0.000
#> SRR2050430     1   0.000      1.000  1 0.000  0 0.000
#> SRR2050429     1   0.000      1.000  1 0.000  0 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
#> SRR2050410     2   0.000      0.995  0 1.000  0 0.000  0
#> SRR2050427     1   0.000      1.000  1 0.000  0 0.000  0
#> SRR2050426     1   0.000      1.000  1 0.000  0 0.000  0
#> SRR2050425     2   0.000      0.995  0 1.000  0 0.000  0
#> SRR2050424     3   0.000      1.000  0 0.000  1 0.000  0
#> SRR2050423     4   0.000      1.000  0 0.000  0 1.000  0
#> SRR2050422     5   0.000      1.000  0 0.000  0 0.000  1
#> SRR2050421     1   0.000      1.000  1 0.000  0 0.000  0
#> SRR2050420     1   0.000      1.000  1 0.000  0 0.000  0
#> SRR2050419     2   0.000      0.995  0 1.000  0 0.000  0
#> SRR2050418     1   0.000      1.000  1 0.000  0 0.000  0
#> SRR2050417     1   0.000      1.000  1 0.000  0 0.000  0
#> SRR2050416     2   0.000      0.995  0 1.000  0 0.000  0
#> SRR2050415     3   0.000      1.000  0 0.000  1 0.000  0
#> SRR2050414     4   0.000      1.000  0 0.000  0 1.000  0
#> SRR2050413     2   0.000      0.995  0 1.000  0 0.000  0
#> SRR2050412     1   0.000      1.000  1 0.000  0 0.000  0
#> SRR2050411     1   0.000      1.000  1 0.000  0 0.000  0
#> SRR2050409     2   0.000      0.995  0 1.000  0 0.000  0
#> SRR2050408     1   0.000      1.000  1 0.000  0 0.000  0
#> SRR2050407     2   0.000      0.995  0 1.000  0 0.000  0
#> SRR2050406     3   0.000      1.000  0 0.000  1 0.000  0
#> SRR2050405     4   0.000      1.000  0 0.000  0 1.000  0
#> SRR2050404     2   0.000      0.995  0 1.000  0 0.000  0
#> SRR2050403     1   0.000      1.000  1 0.000  0 0.000  0
#> SRR2050402     2   0.000      0.995  0 1.000  0 0.000  0
#> SRR2050401     1   0.000      1.000  1 0.000  0 0.000  0
#> SRR2050400     1   0.000      1.000  1 0.000  0 0.000  0
#> SRR2050399     2   0.000      0.995  0 1.000  0 0.000  0
#> SRR2050398     1   0.000      1.000  1 0.000  0 0.000  0
#> SRR2050397     1   0.000      1.000  1 0.000  0 0.000  0
#> SRR2050396     3   0.000      1.000  0 0.000  1 0.000  0
#> SRR2050395     4   0.000      1.000  0 0.000  0 1.000  0
#> SRR2050394     2   0.000      0.995  0 1.000  0 0.000  0
#> SRR2050393     3   0.000      1.000  0 0.000  1 0.000  0
#> SRR2050392     4   0.000      1.000  0 0.000  0 1.000  0
#> SRR2050465     2   0.000      0.995  0 1.000  0 0.000  0
#> SRR2050464     3   0.000      1.000  0 0.000  1 0.000  0
#> SRR2050463     4   0.000      1.000  0 0.000  0 1.000  0
#> SRR2050462     2   0.000      0.995  0 1.000  0 0.000  0
#> SRR2050461     3   0.000      1.000  0 0.000  1 0.000  0
#> SRR2050460     4   0.000      1.000  0 0.000  0 1.000  0
#> SRR2050459     2   0.000      0.995  0 1.000  0 0.000  0
#> SRR2050458     3   0.000      1.000  0 0.000  1 0.000  0
#> SRR2050457     2   0.185      0.902  0 0.912  0 0.088  0
#> SRR2050456     2   0.000      0.995  0 1.000  0 0.000  0
#> SRR2050455     3   0.000      1.000  0 0.000  1 0.000  0
#> SRR2050454     4   0.000      1.000  0 0.000  0 1.000  0
#> SRR2050453     2   0.000      0.995  0 1.000  0 0.000  0
#> SRR2050452     3   0.000      1.000  0 0.000  1 0.000  0
#> SRR2050451     4   0.000      1.000  0 0.000  0 1.000  0
#> SRR2050450     2   0.000      0.995  0 1.000  0 0.000  0
#> SRR2050449     3   0.000      1.000  0 0.000  1 0.000  0
#> SRR2050448     4   0.000      1.000  0 0.000  0 1.000  0
#> SRR2050447     3   0.000      1.000  0 0.000  1 0.000  0
#> SRR2050446     4   0.000      1.000  0 0.000  0 1.000  0
#> SRR2050445     2   0.000      0.995  0 1.000  0 0.000  0
#> SRR2050444     3   0.000      1.000  0 0.000  1 0.000  0
#> SRR2050443     4   0.000      1.000  0 0.000  0 1.000  0
#> SRR2050442     5   0.000      1.000  0 0.000  0 0.000  1
#> SRR2050441     3   0.000      1.000  0 0.000  1 0.000  0
#> SRR2050440     5   0.000      1.000  0 0.000  0 0.000  1
#> SRR2050439     5   0.000      1.000  0 0.000  0 0.000  1
#> SRR2050438     3   0.000      1.000  0 0.000  1 0.000  0
#> SRR2050437     5   0.000      1.000  0 0.000  0 0.000  1
#> SRR2050436     5   0.000      1.000  0 0.000  0 0.000  1
#> SRR2050435     3   0.000      1.000  0 0.000  1 0.000  0
#> SRR2050434     5   0.000      1.000  0 0.000  0 0.000  1
#> SRR2050433     2   0.000      0.995  0 1.000  0 0.000  0
#> SRR2050432     1   0.000      1.000  1 0.000  0 0.000  0
#> SRR2050431     1   0.000      1.000  1 0.000  0 0.000  0
#> SRR2050430     5   0.000      1.000  0 0.000  0 0.000  1
#> SRR2050429     5   0.000      1.000  0 0.000  0 0.000  1

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>            class entropy silhouette    p1    p2    p3    p4    p5    p6
#> SRR2050410     2  0.0000      0.950 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2050427     1  0.3266      0.847 0.728 0.000 0.000 0.000 0.272 0.000
#> SRR2050426     1  0.0146      0.880 0.996 0.000 0.000 0.000 0.004 0.000
#> SRR2050425     2  0.0000      0.950 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2050424     3  0.0000      0.999 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2050423     4  0.0632      0.834 0.000 0.000 0.000 0.976 0.000 0.024
#> SRR2050422     5  0.3266      0.673 0.000 0.000 0.000 0.000 0.728 0.272
#> SRR2050421     1  0.3266      0.847 0.728 0.000 0.000 0.000 0.272 0.000
#> SRR2050420     1  0.0146      0.880 0.996 0.000 0.000 0.000 0.004 0.000
#> SRR2050419     2  0.0000      0.950 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2050418     1  0.3244      0.847 0.732 0.000 0.000 0.000 0.268 0.000
#> SRR2050417     1  0.0000      0.880 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2050416     2  0.0000      0.950 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2050415     3  0.0000      0.999 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2050414     4  0.0547      0.834 0.000 0.000 0.000 0.980 0.000 0.020
#> SRR2050413     2  0.3515      0.604 0.000 0.676 0.000 0.000 0.324 0.000
#> SRR2050412     1  0.3244      0.847 0.732 0.000 0.000 0.000 0.268 0.000
#> SRR2050411     1  0.0000      0.880 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2050409     2  0.0000      0.950 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2050408     1  0.0000      0.880 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2050407     2  0.0000      0.950 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2050406     3  0.0000      0.999 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2050405     4  0.0000      0.831 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR2050404     2  0.0000      0.950 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2050403     1  0.0000      0.880 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2050402     2  0.0458      0.939 0.000 0.984 0.000 0.000 0.016 0.000
#> SRR2050401     1  0.3244      0.847 0.732 0.000 0.000 0.000 0.268 0.000
#> SRR2050400     1  0.0146      0.880 0.996 0.000 0.000 0.000 0.004 0.000
#> SRR2050399     2  0.3126      0.714 0.000 0.752 0.000 0.000 0.248 0.000
#> SRR2050398     1  0.3266      0.847 0.728 0.000 0.000 0.000 0.272 0.000
#> SRR2050397     1  0.0000      0.880 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2050396     3  0.0000      0.999 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2050395     4  0.0458      0.833 0.000 0.000 0.000 0.984 0.000 0.016
#> SRR2050394     2  0.0000      0.950 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2050393     3  0.0000      0.999 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2050392     4  0.0000      0.831 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR2050465     2  0.0000      0.950 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2050464     3  0.0000      0.999 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2050463     4  0.3765      0.763 0.000 0.000 0.000 0.596 0.000 0.404
#> SRR2050462     2  0.0000      0.950 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2050461     3  0.0000      0.999 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2050460     4  0.3765      0.763 0.000 0.000 0.000 0.596 0.000 0.404
#> SRR2050459     2  0.0000      0.950 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2050458     3  0.0000      0.999 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2050457     2  0.3717      0.440 0.000 0.616 0.000 0.384 0.000 0.000
#> SRR2050456     2  0.0000      0.950 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2050455     3  0.0000      0.999 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2050454     4  0.0000      0.831 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR2050453     2  0.0000      0.950 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2050452     3  0.0000      0.999 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2050451     4  0.3765      0.763 0.000 0.000 0.000 0.596 0.000 0.404
#> SRR2050450     2  0.0000      0.950 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2050449     3  0.0000      0.999 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2050448     4  0.3765      0.763 0.000 0.000 0.000 0.596 0.000 0.404
#> SRR2050447     3  0.0000      0.999 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2050446     4  0.3765      0.763 0.000 0.000 0.000 0.596 0.000 0.404
#> SRR2050445     2  0.0000      0.950 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2050444     3  0.0000      0.999 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2050443     4  0.0000      0.831 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR2050442     5  0.3647      0.907 0.000 0.000 0.000 0.000 0.640 0.360
#> SRR2050441     3  0.0000      0.999 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2050440     6  0.3765      0.914 0.000 0.000 0.000 0.000 0.404 0.596
#> SRR2050439     5  0.3647      0.907 0.000 0.000 0.000 0.000 0.640 0.360
#> SRR2050438     3  0.0260      0.992 0.000 0.000 0.992 0.000 0.000 0.008
#> SRR2050437     6  0.3765      0.914 0.000 0.000 0.000 0.000 0.404 0.596
#> SRR2050436     5  0.3647      0.907 0.000 0.000 0.000 0.000 0.640 0.360
#> SRR2050435     3  0.0000      0.999 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2050434     5  0.3647      0.907 0.000 0.000 0.000 0.000 0.640 0.360
#> SRR2050433     2  0.0000      0.950 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2050432     1  0.3266      0.847 0.728 0.000 0.000 0.000 0.272 0.000
#> SRR2050431     1  0.1219      0.849 0.948 0.000 0.000 0.000 0.004 0.048
#> SRR2050430     6  0.3765      0.914 0.000 0.000 0.000 0.000 0.404 0.596
#> SRR2050429     6  0.4697      0.761 0.048 0.000 0.000 0.000 0.404 0.548

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

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

collect_plots(res)

plot of chunk SD-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           1.000       1.000         0.3477 0.653   0.653
#> 3 3 0.918           0.965       0.983         0.8390 0.712   0.559
#> 4 4 1.000           0.966       0.984         0.1834 0.877   0.664
#> 5 5 1.000           0.986       0.994         0.0617 0.933   0.736
#> 6 6 0.988           0.952       0.979         0.0292 0.976   0.878

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

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

There is also optional best \(k\) = 2 3 4 5 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
#> SRR2050410     2       0          1  0  1
#> SRR2050427     2       0          1  0  1
#> SRR2050426     2       0          1  0  1
#> SRR2050425     2       0          1  0  1
#> SRR2050424     1       0          1  1  0
#> SRR2050423     2       0          1  0  1
#> SRR2050422     2       0          1  0  1
#> SRR2050421     2       0          1  0  1
#> SRR2050420     2       0          1  0  1
#> SRR2050419     2       0          1  0  1
#> SRR2050418     2       0          1  0  1
#> SRR2050417     2       0          1  0  1
#> SRR2050416     2       0          1  0  1
#> SRR2050415     1       0          1  1  0
#> SRR2050414     2       0          1  0  1
#> SRR2050413     2       0          1  0  1
#> SRR2050412     2       0          1  0  1
#> SRR2050411     2       0          1  0  1
#> SRR2050409     2       0          1  0  1
#> SRR2050408     2       0          1  0  1
#> SRR2050407     2       0          1  0  1
#> SRR2050406     1       0          1  1  0
#> SRR2050405     2       0          1  0  1
#> SRR2050404     2       0          1  0  1
#> SRR2050403     2       0          1  0  1
#> SRR2050402     2       0          1  0  1
#> SRR2050401     2       0          1  0  1
#> SRR2050400     2       0          1  0  1
#> SRR2050399     2       0          1  0  1
#> SRR2050398     2       0          1  0  1
#> SRR2050397     2       0          1  0  1
#> SRR2050396     1       0          1  1  0
#> SRR2050395     2       0          1  0  1
#> SRR2050394     2       0          1  0  1
#> SRR2050393     1       0          1  1  0
#> SRR2050392     2       0          1  0  1
#> SRR2050465     2       0          1  0  1
#> SRR2050464     1       0          1  1  0
#> SRR2050463     2       0          1  0  1
#> SRR2050462     2       0          1  0  1
#> SRR2050461     1       0          1  1  0
#> SRR2050460     2       0          1  0  1
#> SRR2050459     2       0          1  0  1
#> SRR2050458     1       0          1  1  0
#> SRR2050457     2       0          1  0  1
#> SRR2050456     2       0          1  0  1
#> SRR2050455     1       0          1  1  0
#> SRR2050454     2       0          1  0  1
#> SRR2050453     2       0          1  0  1
#> SRR2050452     1       0          1  1  0
#> SRR2050451     2       0          1  0  1
#> SRR2050450     2       0          1  0  1
#> SRR2050449     1       0          1  1  0
#> SRR2050448     2       0          1  0  1
#> SRR2050447     1       0          1  1  0
#> SRR2050446     2       0          1  0  1
#> SRR2050445     2       0          1  0  1
#> SRR2050444     1       0          1  1  0
#> SRR2050443     2       0          1  0  1
#> SRR2050442     2       0          1  0  1
#> SRR2050441     1       0          1  1  0
#> SRR2050440     2       0          1  0  1
#> SRR2050439     2       0          1  0  1
#> SRR2050438     1       0          1  1  0
#> SRR2050437     2       0          1  0  1
#> SRR2050436     2       0          1  0  1
#> SRR2050435     1       0          1  1  0
#> SRR2050434     2       0          1  0  1
#> SRR2050433     2       0          1  0  1
#> SRR2050432     2       0          1  0  1
#> SRR2050431     2       0          1  0  1
#> SRR2050430     2       0          1  0  1
#> SRR2050429     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
#> SRR2050410     2   0.000      0.993 0.000 1.000  0
#> SRR2050427     1   0.000      0.966 1.000 0.000  0
#> SRR2050426     1   0.000      0.966 1.000 0.000  0
#> SRR2050425     2   0.000      0.993 0.000 1.000  0
#> SRR2050424     3   0.000      1.000 0.000 0.000  1
#> SRR2050423     1   0.000      0.966 1.000 0.000  0
#> SRR2050422     1   0.254      0.905 0.920 0.080  0
#> SRR2050421     1   0.000      0.966 1.000 0.000  0
#> SRR2050420     1   0.000      0.966 1.000 0.000  0
#> SRR2050419     2   0.000      0.993 0.000 1.000  0
#> SRR2050418     1   0.000      0.966 1.000 0.000  0
#> SRR2050417     1   0.000      0.966 1.000 0.000  0
#> SRR2050416     2   0.000      0.993 0.000 1.000  0
#> SRR2050415     3   0.000      1.000 0.000 0.000  1
#> SRR2050414     1   0.000      0.966 1.000 0.000  0
#> SRR2050413     2   0.319      0.854 0.112 0.888  0
#> SRR2050412     1   0.000      0.966 1.000 0.000  0
#> SRR2050411     1   0.000      0.966 1.000 0.000  0
#> SRR2050409     2   0.000      0.993 0.000 1.000  0
#> SRR2050408     1   0.000      0.966 1.000 0.000  0
#> SRR2050407     2   0.000      0.993 0.000 1.000  0
#> SRR2050406     3   0.000      1.000 0.000 0.000  1
#> SRR2050405     1   0.319      0.883 0.888 0.112  0
#> SRR2050404     2   0.000      0.993 0.000 1.000  0
#> SRR2050403     1   0.000      0.966 1.000 0.000  0
#> SRR2050402     2   0.000      0.993 0.000 1.000  0
#> SRR2050401     1   0.000      0.966 1.000 0.000  0
#> SRR2050400     1   0.000      0.966 1.000 0.000  0
#> SRR2050399     2   0.000      0.993 0.000 1.000  0
#> SRR2050398     1   0.000      0.966 1.000 0.000  0
#> SRR2050397     1   0.000      0.966 1.000 0.000  0
#> SRR2050396     3   0.000      1.000 0.000 0.000  1
#> SRR2050395     1   0.000      0.966 1.000 0.000  0
#> SRR2050394     2   0.000      0.993 0.000 1.000  0
#> SRR2050393     3   0.000      1.000 0.000 0.000  1
#> SRR2050392     1   0.319      0.883 0.888 0.112  0
#> SRR2050465     2   0.000      0.993 0.000 1.000  0
#> SRR2050464     3   0.000      1.000 0.000 0.000  1
#> SRR2050463     1   0.271      0.904 0.912 0.088  0
#> SRR2050462     2   0.000      0.993 0.000 1.000  0
#> SRR2050461     3   0.000      1.000 0.000 0.000  1
#> SRR2050460     1   0.000      0.966 1.000 0.000  0
#> SRR2050459     2   0.000      0.993 0.000 1.000  0
#> SRR2050458     3   0.000      1.000 0.000 0.000  1
#> SRR2050457     1   0.565      0.602 0.688 0.312  0
#> SRR2050456     2   0.000      0.993 0.000 1.000  0
#> SRR2050455     3   0.000      1.000 0.000 0.000  1
#> SRR2050454     1   0.319      0.883 0.888 0.112  0
#> SRR2050453     2   0.000      0.993 0.000 1.000  0
#> SRR2050452     3   0.000      1.000 0.000 0.000  1
#> SRR2050451     1   0.000      0.966 1.000 0.000  0
#> SRR2050450     2   0.000      0.993 0.000 1.000  0
#> SRR2050449     3   0.000      1.000 0.000 0.000  1
#> SRR2050448     1   0.000      0.966 1.000 0.000  0
#> SRR2050447     3   0.000      1.000 0.000 0.000  1
#> SRR2050446     1   0.000      0.966 1.000 0.000  0
#> SRR2050445     2   0.000      0.993 0.000 1.000  0
#> SRR2050444     3   0.000      1.000 0.000 0.000  1
#> SRR2050443     1   0.319      0.883 0.888 0.112  0
#> SRR2050442     2   0.000      0.993 0.000 1.000  0
#> SRR2050441     3   0.000      1.000 0.000 0.000  1
#> SRR2050440     1   0.000      0.966 1.000 0.000  0
#> SRR2050439     2   0.000      0.993 0.000 1.000  0
#> SRR2050438     3   0.000      1.000 0.000 0.000  1
#> SRR2050437     1   0.000      0.966 1.000 0.000  0
#> SRR2050436     1   0.455      0.761 0.800 0.200  0
#> SRR2050435     3   0.000      1.000 0.000 0.000  1
#> SRR2050434     1   0.000      0.966 1.000 0.000  0
#> SRR2050433     2   0.000      0.993 0.000 1.000  0
#> SRR2050432     1   0.000      0.966 1.000 0.000  0
#> SRR2050431     1   0.000      0.966 1.000 0.000  0
#> SRR2050430     1   0.000      0.966 1.000 0.000  0
#> SRR2050429     1   0.000      0.966 1.000 0.000  0

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2 p3    p4
#> SRR2050410     2  0.0000      0.996 0.000 1.000  0 0.000
#> SRR2050427     1  0.0000      0.988 1.000 0.000  0 0.000
#> SRR2050426     1  0.0000      0.988 1.000 0.000  0 0.000
#> SRR2050425     2  0.0000      0.996 0.000 1.000  0 0.000
#> SRR2050424     3  0.0000      1.000 0.000 0.000  1 0.000
#> SRR2050423     4  0.0000      0.952 0.000 0.000  0 1.000
#> SRR2050422     4  0.6350      0.381 0.072 0.364  0 0.564
#> SRR2050421     1  0.0000      0.988 1.000 0.000  0 0.000
#> SRR2050420     1  0.0000      0.988 1.000 0.000  0 0.000
#> SRR2050419     2  0.0000      0.996 0.000 1.000  0 0.000
#> SRR2050418     1  0.3528      0.757 0.808 0.000  0 0.192
#> SRR2050417     1  0.0000      0.988 1.000 0.000  0 0.000
#> SRR2050416     2  0.0000      0.996 0.000 1.000  0 0.000
#> SRR2050415     3  0.0000      1.000 0.000 0.000  1 0.000
#> SRR2050414     4  0.0000      0.952 0.000 0.000  0 1.000
#> SRR2050413     2  0.1867      0.918 0.072 0.928  0 0.000
#> SRR2050412     1  0.0000      0.988 1.000 0.000  0 0.000
#> SRR2050411     1  0.0000      0.988 1.000 0.000  0 0.000
#> SRR2050409     2  0.0000      0.996 0.000 1.000  0 0.000
#> SRR2050408     1  0.0000      0.988 1.000 0.000  0 0.000
#> SRR2050407     2  0.0000      0.996 0.000 1.000  0 0.000
#> SRR2050406     3  0.0000      1.000 0.000 0.000  1 0.000
#> SRR2050405     4  0.0000      0.952 0.000 0.000  0 1.000
#> SRR2050404     2  0.0000      0.996 0.000 1.000  0 0.000
#> SRR2050403     1  0.0000      0.988 1.000 0.000  0 0.000
#> SRR2050402     2  0.0000      0.996 0.000 1.000  0 0.000
#> SRR2050401     1  0.0000      0.988 1.000 0.000  0 0.000
#> SRR2050400     1  0.0000      0.988 1.000 0.000  0 0.000
#> SRR2050399     2  0.0000      0.996 0.000 1.000  0 0.000
#> SRR2050398     1  0.0000      0.988 1.000 0.000  0 0.000
#> SRR2050397     1  0.0000      0.988 1.000 0.000  0 0.000
#> SRR2050396     3  0.0000      1.000 0.000 0.000  1 0.000
#> SRR2050395     4  0.0000      0.952 0.000 0.000  0 1.000
#> SRR2050394     2  0.0000      0.996 0.000 1.000  0 0.000
#> SRR2050393     3  0.0000      1.000 0.000 0.000  1 0.000
#> SRR2050392     4  0.0000      0.952 0.000 0.000  0 1.000
#> SRR2050465     2  0.0000      0.996 0.000 1.000  0 0.000
#> SRR2050464     3  0.0000      1.000 0.000 0.000  1 0.000
#> SRR2050463     4  0.0000      0.952 0.000 0.000  0 1.000
#> SRR2050462     2  0.0000      0.996 0.000 1.000  0 0.000
#> SRR2050461     3  0.0000      1.000 0.000 0.000  1 0.000
#> SRR2050460     4  0.0000      0.952 0.000 0.000  0 1.000
#> SRR2050459     2  0.0000      0.996 0.000 1.000  0 0.000
#> SRR2050458     3  0.0000      1.000 0.000 0.000  1 0.000
#> SRR2050457     4  0.0000      0.952 0.000 0.000  0 1.000
#> SRR2050456     2  0.0000      0.996 0.000 1.000  0 0.000
#> SRR2050455     3  0.0000      1.000 0.000 0.000  1 0.000
#> SRR2050454     4  0.0000      0.952 0.000 0.000  0 1.000
#> SRR2050453     2  0.0000      0.996 0.000 1.000  0 0.000
#> SRR2050452     3  0.0000      1.000 0.000 0.000  1 0.000
#> SRR2050451     4  0.0000      0.952 0.000 0.000  0 1.000
#> SRR2050450     2  0.0000      0.996 0.000 1.000  0 0.000
#> SRR2050449     3  0.0000      1.000 0.000 0.000  1 0.000
#> SRR2050448     4  0.0000      0.952 0.000 0.000  0 1.000
#> SRR2050447     3  0.0000      1.000 0.000 0.000  1 0.000
#> SRR2050446     4  0.0000      0.952 0.000 0.000  0 1.000
#> SRR2050445     2  0.0000      0.996 0.000 1.000  0 0.000
#> SRR2050444     3  0.0000      1.000 0.000 0.000  1 0.000
#> SRR2050443     4  0.0000      0.952 0.000 0.000  0 1.000
#> SRR2050442     2  0.0000      0.996 0.000 1.000  0 0.000
#> SRR2050441     3  0.0000      1.000 0.000 0.000  1 0.000
#> SRR2050440     4  0.0188      0.949 0.004 0.000  0 0.996
#> SRR2050439     2  0.0000      0.996 0.000 1.000  0 0.000
#> SRR2050438     3  0.0000      1.000 0.000 0.000  1 0.000
#> SRR2050437     4  0.1867      0.895 0.072 0.000  0 0.928
#> SRR2050436     4  0.5464      0.682 0.072 0.212  0 0.716
#> SRR2050435     3  0.0000      1.000 0.000 0.000  1 0.000
#> SRR2050434     4  0.0000      0.952 0.000 0.000  0 1.000
#> SRR2050433     2  0.0000      0.996 0.000 1.000  0 0.000
#> SRR2050432     1  0.0000      0.988 1.000 0.000  0 0.000
#> SRR2050431     1  0.0000      0.988 1.000 0.000  0 0.000
#> SRR2050430     4  0.1867      0.895 0.072 0.000  0 0.928
#> SRR2050429     1  0.0000      0.988 1.000 0.000  0 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
#> SRR2050410     2  0.0000      1.000 0.000 1.0  0 0.000 0.000
#> SRR2050427     1  0.0000      0.984 1.000 0.0  0 0.000 0.000
#> SRR2050426     1  0.0000      0.984 1.000 0.0  0 0.000 0.000
#> SRR2050425     2  0.0000      1.000 0.000 1.0  0 0.000 0.000
#> SRR2050424     3  0.0000      1.000 0.000 0.0  1 0.000 0.000
#> SRR2050423     4  0.0000      1.000 0.000 0.0  0 1.000 0.000
#> SRR2050422     5  0.0000      0.975 0.000 0.0  0 0.000 1.000
#> SRR2050421     1  0.0000      0.984 1.000 0.0  0 0.000 0.000
#> SRR2050420     1  0.0000      0.984 1.000 0.0  0 0.000 0.000
#> SRR2050419     2  0.0000      1.000 0.000 1.0  0 0.000 0.000
#> SRR2050418     1  0.3039      0.763 0.808 0.0  0 0.192 0.000
#> SRR2050417     1  0.0000      0.984 1.000 0.0  0 0.000 0.000
#> SRR2050416     2  0.0000      1.000 0.000 1.0  0 0.000 0.000
#> SRR2050415     3  0.0000      1.000 0.000 0.0  1 0.000 0.000
#> SRR2050414     4  0.0000      1.000 0.000 0.0  0 1.000 0.000
#> SRR2050413     5  0.3109      0.750 0.000 0.2  0 0.000 0.800
#> SRR2050412     1  0.0000      0.984 1.000 0.0  0 0.000 0.000
#> SRR2050411     1  0.0000      0.984 1.000 0.0  0 0.000 0.000
#> SRR2050409     2  0.0000      1.000 0.000 1.0  0 0.000 0.000
#> SRR2050408     1  0.0000      0.984 1.000 0.0  0 0.000 0.000
#> SRR2050407     2  0.0000      1.000 0.000 1.0  0 0.000 0.000
#> SRR2050406     3  0.0000      1.000 0.000 0.0  1 0.000 0.000
#> SRR2050405     4  0.0000      1.000 0.000 0.0  0 1.000 0.000
#> SRR2050404     2  0.0000      1.000 0.000 1.0  0 0.000 0.000
#> SRR2050403     1  0.0000      0.984 1.000 0.0  0 0.000 0.000
#> SRR2050402     2  0.0000      1.000 0.000 1.0  0 0.000 0.000
#> SRR2050401     1  0.0000      0.984 1.000 0.0  0 0.000 0.000
#> SRR2050400     1  0.0000      0.984 1.000 0.0  0 0.000 0.000
#> SRR2050399     2  0.0000      1.000 0.000 1.0  0 0.000 0.000
#> SRR2050398     1  0.0000      0.984 1.000 0.0  0 0.000 0.000
#> SRR2050397     1  0.0000      0.984 1.000 0.0  0 0.000 0.000
#> SRR2050396     3  0.0000      1.000 0.000 0.0  1 0.000 0.000
#> SRR2050395     4  0.0000      1.000 0.000 0.0  0 1.000 0.000
#> SRR2050394     2  0.0000      1.000 0.000 1.0  0 0.000 0.000
#> SRR2050393     3  0.0000      1.000 0.000 0.0  1 0.000 0.000
#> SRR2050392     4  0.0000      1.000 0.000 0.0  0 1.000 0.000
#> SRR2050465     2  0.0000      1.000 0.000 1.0  0 0.000 0.000
#> SRR2050464     3  0.0000      1.000 0.000 0.0  1 0.000 0.000
#> SRR2050463     4  0.0000      1.000 0.000 0.0  0 1.000 0.000
#> SRR2050462     2  0.0000      1.000 0.000 1.0  0 0.000 0.000
#> SRR2050461     3  0.0000      1.000 0.000 0.0  1 0.000 0.000
#> SRR2050460     4  0.0000      1.000 0.000 0.0  0 1.000 0.000
#> SRR2050459     2  0.0000      1.000 0.000 1.0  0 0.000 0.000
#> SRR2050458     3  0.0000      1.000 0.000 0.0  1 0.000 0.000
#> SRR2050457     4  0.0000      1.000 0.000 0.0  0 1.000 0.000
#> SRR2050456     2  0.0000      1.000 0.000 1.0  0 0.000 0.000
#> SRR2050455     3  0.0000      1.000 0.000 0.0  1 0.000 0.000
#> SRR2050454     4  0.0000      1.000 0.000 0.0  0 1.000 0.000
#> SRR2050453     2  0.0000      1.000 0.000 1.0  0 0.000 0.000
#> SRR2050452     3  0.0000      1.000 0.000 0.0  1 0.000 0.000
#> SRR2050451     4  0.0000      1.000 0.000 0.0  0 1.000 0.000
#> SRR2050450     2  0.0000      1.000 0.000 1.0  0 0.000 0.000
#> SRR2050449     3  0.0000      1.000 0.000 0.0  1 0.000 0.000
#> SRR2050448     4  0.0000      1.000 0.000 0.0  0 1.000 0.000
#> SRR2050447     3  0.0000      1.000 0.000 0.0  1 0.000 0.000
#> SRR2050446     4  0.0000      1.000 0.000 0.0  0 1.000 0.000
#> SRR2050445     2  0.0000      1.000 0.000 1.0  0 0.000 0.000
#> SRR2050444     3  0.0000      1.000 0.000 0.0  1 0.000 0.000
#> SRR2050443     4  0.0000      1.000 0.000 0.0  0 1.000 0.000
#> SRR2050442     5  0.0000      0.975 0.000 0.0  0 0.000 1.000
#> SRR2050441     3  0.0000      1.000 0.000 0.0  1 0.000 0.000
#> SRR2050440     5  0.0000      0.975 0.000 0.0  0 0.000 1.000
#> SRR2050439     5  0.0000      0.975 0.000 0.0  0 0.000 1.000
#> SRR2050438     3  0.0000      1.000 0.000 0.0  1 0.000 0.000
#> SRR2050437     5  0.0000      0.975 0.000 0.0  0 0.000 1.000
#> SRR2050436     5  0.0000      0.975 0.000 0.0  0 0.000 1.000
#> SRR2050435     3  0.0000      1.000 0.000 0.0  1 0.000 0.000
#> SRR2050434     5  0.0000      0.975 0.000 0.0  0 0.000 1.000
#> SRR2050433     2  0.0000      1.000 0.000 1.0  0 0.000 0.000
#> SRR2050432     1  0.0000      0.984 1.000 0.0  0 0.000 0.000
#> SRR2050431     1  0.0963      0.951 0.964 0.0  0 0.000 0.036
#> SRR2050430     5  0.0000      0.975 0.000 0.0  0 0.000 1.000
#> SRR2050429     5  0.0000      0.975 0.000 0.0  0 0.000 1.000

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>            class entropy silhouette    p1  p2 p3    p4  p5    p6
#> SRR2050410     2   0.000      1.000 0.000 1.0  0 0.000 0.0 0.000
#> SRR2050427     6   0.000      0.888 0.000 0.0  0 0.000 0.0 1.000
#> SRR2050426     1   0.359      0.536 0.656 0.0  0 0.000 0.0 0.344
#> SRR2050425     2   0.000      1.000 0.000 1.0  0 0.000 0.0 0.000
#> SRR2050424     3   0.000      1.000 0.000 0.0  1 0.000 0.0 0.000
#> SRR2050423     4   0.000      1.000 0.000 0.0  0 1.000 0.0 0.000
#> SRR2050422     5   0.000      0.970 0.000 0.0  0 0.000 1.0 0.000
#> SRR2050421     6   0.000      0.888 0.000 0.0  0 0.000 0.0 1.000
#> SRR2050420     1   0.359      0.536 0.656 0.0  0 0.000 0.0 0.344
#> SRR2050419     2   0.000      1.000 0.000 1.0  0 0.000 0.0 0.000
#> SRR2050418     6   0.480      0.610 0.212 0.0  0 0.124 0.0 0.664
#> SRR2050417     1   0.000      0.902 1.000 0.0  0 0.000 0.0 0.000
#> SRR2050416     2   0.000      1.000 0.000 1.0  0 0.000 0.0 0.000
#> SRR2050415     3   0.000      1.000 0.000 0.0  1 0.000 0.0 0.000
#> SRR2050414     4   0.000      1.000 0.000 0.0  0 1.000 0.0 0.000
#> SRR2050413     5   0.279      0.708 0.000 0.2  0 0.000 0.8 0.000
#> SRR2050412     6   0.000      0.888 0.000 0.0  0 0.000 0.0 1.000
#> SRR2050411     1   0.000      0.902 1.000 0.0  0 0.000 0.0 0.000
#> SRR2050409     2   0.000      1.000 0.000 1.0  0 0.000 0.0 0.000
#> SRR2050408     1   0.000      0.902 1.000 0.0  0 0.000 0.0 0.000
#> SRR2050407     2   0.000      1.000 0.000 1.0  0 0.000 0.0 0.000
#> SRR2050406     3   0.000      1.000 0.000 0.0  1 0.000 0.0 0.000
#> SRR2050405     4   0.000      1.000 0.000 0.0  0 1.000 0.0 0.000
#> SRR2050404     2   0.000      1.000 0.000 1.0  0 0.000 0.0 0.000
#> SRR2050403     1   0.000      0.902 1.000 0.0  0 0.000 0.0 0.000
#> SRR2050402     2   0.000      1.000 0.000 1.0  0 0.000 0.0 0.000
#> SRR2050401     6   0.335      0.602 0.288 0.0  0 0.000 0.0 0.712
#> SRR2050400     1   0.000      0.902 1.000 0.0  0 0.000 0.0 0.000
#> SRR2050399     2   0.000      1.000 0.000 1.0  0 0.000 0.0 0.000
#> SRR2050398     6   0.000      0.888 0.000 0.0  0 0.000 0.0 1.000
#> SRR2050397     1   0.000      0.902 1.000 0.0  0 0.000 0.0 0.000
#> SRR2050396     3   0.000      1.000 0.000 0.0  1 0.000 0.0 0.000
#> SRR2050395     4   0.000      1.000 0.000 0.0  0 1.000 0.0 0.000
#> SRR2050394     2   0.000      1.000 0.000 1.0  0 0.000 0.0 0.000
#> SRR2050393     3   0.000      1.000 0.000 0.0  1 0.000 0.0 0.000
#> SRR2050392     4   0.000      1.000 0.000 0.0  0 1.000 0.0 0.000
#> SRR2050465     2   0.000      1.000 0.000 1.0  0 0.000 0.0 0.000
#> SRR2050464     3   0.000      1.000 0.000 0.0  1 0.000 0.0 0.000
#> SRR2050463     4   0.000      1.000 0.000 0.0  0 1.000 0.0 0.000
#> SRR2050462     2   0.000      1.000 0.000 1.0  0 0.000 0.0 0.000
#> SRR2050461     3   0.000      1.000 0.000 0.0  1 0.000 0.0 0.000
#> SRR2050460     4   0.000      1.000 0.000 0.0  0 1.000 0.0 0.000
#> SRR2050459     2   0.000      1.000 0.000 1.0  0 0.000 0.0 0.000
#> SRR2050458     3   0.000      1.000 0.000 0.0  1 0.000 0.0 0.000
#> SRR2050457     4   0.000      1.000 0.000 0.0  0 1.000 0.0 0.000
#> SRR2050456     2   0.000      1.000 0.000 1.0  0 0.000 0.0 0.000
#> SRR2050455     3   0.000      1.000 0.000 0.0  1 0.000 0.0 0.000
#> SRR2050454     4   0.000      1.000 0.000 0.0  0 1.000 0.0 0.000
#> SRR2050453     2   0.000      1.000 0.000 1.0  0 0.000 0.0 0.000
#> SRR2050452     3   0.000      1.000 0.000 0.0  1 0.000 0.0 0.000
#> SRR2050451     4   0.000      1.000 0.000 0.0  0 1.000 0.0 0.000
#> SRR2050450     2   0.000      1.000 0.000 1.0  0 0.000 0.0 0.000
#> SRR2050449     3   0.000      1.000 0.000 0.0  1 0.000 0.0 0.000
#> SRR2050448     4   0.000      1.000 0.000 0.0  0 1.000 0.0 0.000
#> SRR2050447     3   0.000      1.000 0.000 0.0  1 0.000 0.0 0.000
#> SRR2050446     4   0.000      1.000 0.000 0.0  0 1.000 0.0 0.000
#> SRR2050445     2   0.000      1.000 0.000 1.0  0 0.000 0.0 0.000
#> SRR2050444     3   0.000      1.000 0.000 0.0  1 0.000 0.0 0.000
#> SRR2050443     4   0.000      1.000 0.000 0.0  0 1.000 0.0 0.000
#> SRR2050442     5   0.000      0.970 0.000 0.0  0 0.000 1.0 0.000
#> SRR2050441     3   0.000      1.000 0.000 0.0  1 0.000 0.0 0.000
#> SRR2050440     5   0.000      0.970 0.000 0.0  0 0.000 1.0 0.000
#> SRR2050439     5   0.000      0.970 0.000 0.0  0 0.000 1.0 0.000
#> SRR2050438     3   0.000      1.000 0.000 0.0  1 0.000 0.0 0.000
#> SRR2050437     5   0.000      0.970 0.000 0.0  0 0.000 1.0 0.000
#> SRR2050436     5   0.000      0.970 0.000 0.0  0 0.000 1.0 0.000
#> SRR2050435     3   0.000      1.000 0.000 0.0  1 0.000 0.0 0.000
#> SRR2050434     5   0.000      0.970 0.000 0.0  0 0.000 1.0 0.000
#> SRR2050433     2   0.000      1.000 0.000 1.0  0 0.000 0.0 0.000
#> SRR2050432     6   0.000      0.888 0.000 0.0  0 0.000 0.0 1.000
#> SRR2050431     1   0.000      0.902 1.000 0.0  0 0.000 0.0 0.000
#> SRR2050430     5   0.000      0.970 0.000 0.0  0 0.000 1.0 0.000
#> SRR2050429     5   0.000      0.970 0.000 0.0  0 0.000 1.0 0.000

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

consensus_heatmap(res, k = 2)

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

consensus_heatmap(res, k = 3)

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

consensus_heatmap(res, k = 4)

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

consensus_heatmap(res, k = 5)

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

consensus_heatmap(res, k = 6)

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

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

membership_heatmap(res, k = 2)

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

membership_heatmap(res, k = 3)

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

membership_heatmap(res, k = 4)

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

membership_heatmap(res, k = 5)

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

membership_heatmap(res, k = 6)

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

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

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

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

get_signatures(res, k = 3)

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

get_signatures(res, k = 4)

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

get_signatures(res, k = 5)

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

get_signatures(res, k = 6)

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

Signature heatmaps where rows are not scaled:

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

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

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

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

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

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

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

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

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

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

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk SD-pam-signature_compare

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

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

An example of the output of tb is:

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

The columns in tb are:

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

UMAP plot which shows how samples are separated.

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

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

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

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

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

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

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

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

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

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

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk SD-pam-collect-classes

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


SD:mclust**

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

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

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

res
#> A 'ConsensusPartition' object with k = 2, 3, 4, 5, 6.
#>   On a matrix with 15040 rows and 73 columns.
#>   Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'SD' method.
#>   Subgroups are detected by 'mclust' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 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 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.978       0.990         0.3836 0.610   0.610
#> 3 3 0.848           0.884       0.948         0.6303 0.670   0.489
#> 4 4 0.981           0.910       0.959         0.1346 0.955   0.871
#> 5 5 0.992           0.946       0.975         0.1335 0.859   0.561
#> 6 6 0.908           0.865       0.915         0.0175 1.000   1.000

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 4

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

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

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

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>            class entropy silhouette    p1    p2
#> SRR2050410     2  0.0000      0.967 0.000 1.000
#> SRR2050427     1  0.0376      0.997 0.996 0.004
#> SRR2050426     1  0.0376      0.997 0.996 0.004
#> SRR2050425     2  0.0000      0.967 0.000 1.000
#> SRR2050424     1  0.0000      0.997 1.000 0.000
#> SRR2050423     1  0.0000      0.997 1.000 0.000
#> SRR2050422     1  0.2603      0.955 0.956 0.044
#> SRR2050421     1  0.0376      0.997 0.996 0.004
#> SRR2050420     1  0.0376      0.997 0.996 0.004
#> SRR2050419     2  0.0000      0.967 0.000 1.000
#> SRR2050418     1  0.0376      0.997 0.996 0.004
#> SRR2050417     1  0.0376      0.997 0.996 0.004
#> SRR2050416     2  0.9635      0.383 0.388 0.612
#> SRR2050415     1  0.0000      0.997 1.000 0.000
#> SRR2050414     1  0.0000      0.997 1.000 0.000
#> SRR2050413     2  0.5737      0.839 0.136 0.864
#> SRR2050412     1  0.0376      0.997 0.996 0.004
#> SRR2050411     1  0.0376      0.997 0.996 0.004
#> SRR2050409     2  0.0000      0.967 0.000 1.000
#> SRR2050408     1  0.0376      0.997 0.996 0.004
#> SRR2050407     2  0.0000      0.967 0.000 1.000
#> SRR2050406     1  0.0000      0.997 1.000 0.000
#> SRR2050405     1  0.0000      0.997 1.000 0.000
#> SRR2050404     2  0.0000      0.967 0.000 1.000
#> SRR2050403     1  0.0376      0.997 0.996 0.004
#> SRR2050402     2  0.2043      0.945 0.032 0.968
#> SRR2050401     1  0.0376      0.997 0.996 0.004
#> SRR2050400     1  0.0376      0.997 0.996 0.004
#> SRR2050399     2  0.2043      0.945 0.032 0.968
#> SRR2050398     1  0.0376      0.997 0.996 0.004
#> SRR2050397     1  0.0376      0.997 0.996 0.004
#> SRR2050396     1  0.0000      0.997 1.000 0.000
#> SRR2050395     1  0.0000      0.997 1.000 0.000
#> SRR2050394     2  0.0000      0.967 0.000 1.000
#> SRR2050393     1  0.0000      0.997 1.000 0.000
#> SRR2050392     1  0.0000      0.997 1.000 0.000
#> SRR2050465     2  0.0000      0.967 0.000 1.000
#> SRR2050464     1  0.0000      0.997 1.000 0.000
#> SRR2050463     1  0.0000      0.997 1.000 0.000
#> SRR2050462     2  0.0000      0.967 0.000 1.000
#> SRR2050461     1  0.0000      0.997 1.000 0.000
#> SRR2050460     1  0.0000      0.997 1.000 0.000
#> SRR2050459     2  0.0000      0.967 0.000 1.000
#> SRR2050458     1  0.0000      0.997 1.000 0.000
#> SRR2050457     1  0.0000      0.997 1.000 0.000
#> SRR2050456     2  0.0000      0.967 0.000 1.000
#> SRR2050455     1  0.0000      0.997 1.000 0.000
#> SRR2050454     1  0.0000      0.997 1.000 0.000
#> SRR2050453     2  0.0000      0.967 0.000 1.000
#> SRR2050452     1  0.0000      0.997 1.000 0.000
#> SRR2050451     1  0.0000      0.997 1.000 0.000
#> SRR2050450     2  0.0000      0.967 0.000 1.000
#> SRR2050449     1  0.0000      0.997 1.000 0.000
#> SRR2050448     1  0.0000      0.997 1.000 0.000
#> SRR2050447     1  0.0000      0.997 1.000 0.000
#> SRR2050446     1  0.0000      0.997 1.000 0.000
#> SRR2050445     2  0.0000      0.967 0.000 1.000
#> SRR2050444     1  0.0000      0.997 1.000 0.000
#> SRR2050443     1  0.0000      0.997 1.000 0.000
#> SRR2050442     1  0.0376      0.997 0.996 0.004
#> SRR2050441     1  0.0000      0.997 1.000 0.000
#> SRR2050440     1  0.0000      0.997 1.000 0.000
#> SRR2050439     1  0.0376      0.997 0.996 0.004
#> SRR2050438     1  0.0000      0.997 1.000 0.000
#> SRR2050437     1  0.0000      0.997 1.000 0.000
#> SRR2050436     1  0.0376      0.997 0.996 0.004
#> SRR2050435     1  0.0000      0.997 1.000 0.000
#> SRR2050434     1  0.0376      0.997 0.996 0.004
#> SRR2050433     2  0.0000      0.967 0.000 1.000
#> SRR2050432     1  0.0376      0.997 0.996 0.004
#> SRR2050431     1  0.0376      0.997 0.996 0.004
#> SRR2050430     1  0.0376      0.997 0.996 0.004
#> SRR2050429     1  0.0376      0.997 0.996 0.004

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>            class entropy silhouette    p1    p2    p3
#> SRR2050410     2  0.0000      0.795 0.000 1.000 0.000
#> SRR2050427     1  0.0000      0.998 1.000 0.000 0.000
#> SRR2050426     1  0.0000      0.998 1.000 0.000 0.000
#> SRR2050425     2  0.0000      0.795 0.000 1.000 0.000
#> SRR2050424     3  0.0000      0.996 0.000 0.000 1.000
#> SRR2050423     1  0.0000      0.998 1.000 0.000 0.000
#> SRR2050422     2  0.6819      0.344 0.476 0.512 0.012
#> SRR2050421     1  0.0000      0.998 1.000 0.000 0.000
#> SRR2050420     1  0.0000      0.998 1.000 0.000 0.000
#> SRR2050419     2  0.0000      0.795 0.000 1.000 0.000
#> SRR2050418     1  0.0000      0.998 1.000 0.000 0.000
#> SRR2050417     1  0.0000      0.998 1.000 0.000 0.000
#> SRR2050416     2  0.0000      0.795 0.000 1.000 0.000
#> SRR2050415     3  0.0000      0.996 0.000 0.000 1.000
#> SRR2050414     1  0.0000      0.998 1.000 0.000 0.000
#> SRR2050413     2  0.6676      0.347 0.476 0.516 0.008
#> SRR2050412     1  0.0000      0.998 1.000 0.000 0.000
#> SRR2050411     1  0.0000      0.998 1.000 0.000 0.000
#> SRR2050409     2  0.0000      0.795 0.000 1.000 0.000
#> SRR2050408     1  0.0000      0.998 1.000 0.000 0.000
#> SRR2050407     2  0.0000      0.795 0.000 1.000 0.000
#> SRR2050406     3  0.0000      0.996 0.000 0.000 1.000
#> SRR2050405     1  0.0000      0.998 1.000 0.000 0.000
#> SRR2050404     2  0.0000      0.795 0.000 1.000 0.000
#> SRR2050403     1  0.0000      0.998 1.000 0.000 0.000
#> SRR2050402     2  0.5678      0.585 0.316 0.684 0.000
#> SRR2050401     1  0.0000      0.998 1.000 0.000 0.000
#> SRR2050400     1  0.0000      0.998 1.000 0.000 0.000
#> SRR2050399     2  0.6299      0.352 0.476 0.524 0.000
#> SRR2050398     1  0.0000      0.998 1.000 0.000 0.000
#> SRR2050397     1  0.0000      0.998 1.000 0.000 0.000
#> SRR2050396     3  0.1643      0.942 0.044 0.000 0.956
#> SRR2050395     1  0.0000      0.998 1.000 0.000 0.000
#> SRR2050394     2  0.0000      0.795 0.000 1.000 0.000
#> SRR2050393     3  0.0000      0.996 0.000 0.000 1.000
#> SRR2050392     1  0.0000      0.998 1.000 0.000 0.000
#> SRR2050465     2  0.0000      0.795 0.000 1.000 0.000
#> SRR2050464     3  0.0000      0.996 0.000 0.000 1.000
#> SRR2050463     1  0.0000      0.998 1.000 0.000 0.000
#> SRR2050462     2  0.0000      0.795 0.000 1.000 0.000
#> SRR2050461     3  0.0000      0.996 0.000 0.000 1.000
#> SRR2050460     1  0.0000      0.998 1.000 0.000 0.000
#> SRR2050459     2  0.0000      0.795 0.000 1.000 0.000
#> SRR2050458     3  0.0000      0.996 0.000 0.000 1.000
#> SRR2050457     1  0.0000      0.998 1.000 0.000 0.000
#> SRR2050456     2  0.0000      0.795 0.000 1.000 0.000
#> SRR2050455     3  0.0000      0.996 0.000 0.000 1.000
#> SRR2050454     1  0.0000      0.998 1.000 0.000 0.000
#> SRR2050453     2  0.0000      0.795 0.000 1.000 0.000
#> SRR2050452     3  0.0000      0.996 0.000 0.000 1.000
#> SRR2050451     1  0.0000      0.998 1.000 0.000 0.000
#> SRR2050450     2  0.0000      0.795 0.000 1.000 0.000
#> SRR2050449     3  0.0000      0.996 0.000 0.000 1.000
#> SRR2050448     1  0.0000      0.998 1.000 0.000 0.000
#> SRR2050447     3  0.0000      0.996 0.000 0.000 1.000
#> SRR2050446     1  0.0000      0.998 1.000 0.000 0.000
#> SRR2050445     2  0.0000      0.795 0.000 1.000 0.000
#> SRR2050444     3  0.0000      0.996 0.000 0.000 1.000
#> SRR2050443     1  0.0000      0.998 1.000 0.000 0.000
#> SRR2050442     2  0.6819      0.344 0.476 0.512 0.012
#> SRR2050441     3  0.0000      0.996 0.000 0.000 1.000
#> SRR2050440     1  0.0592      0.987 0.988 0.000 0.012
#> SRR2050439     2  0.6819      0.344 0.476 0.512 0.012
#> SRR2050438     3  0.0000      0.996 0.000 0.000 1.000
#> SRR2050437     1  0.0592      0.987 0.988 0.000 0.012
#> SRR2050436     2  0.6819      0.344 0.476 0.512 0.012
#> SRR2050435     3  0.0000      0.996 0.000 0.000 1.000
#> SRR2050434     2  0.6819      0.344 0.476 0.512 0.012
#> SRR2050433     2  0.0000      0.795 0.000 1.000 0.000
#> SRR2050432     1  0.0000      0.998 1.000 0.000 0.000
#> SRR2050431     1  0.0000      0.998 1.000 0.000 0.000
#> SRR2050430     1  0.0592      0.987 0.988 0.000 0.012
#> SRR2050429     1  0.0424      0.991 0.992 0.000 0.008

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> SRR2050410     2  0.0000      0.981 0.000 1.000 0.000 0.000
#> SRR2050427     1  0.0000      0.926 1.000 0.000 0.000 0.000
#> SRR2050426     1  0.0000      0.926 1.000 0.000 0.000 0.000
#> SRR2050425     2  0.0000      0.981 0.000 1.000 0.000 0.000
#> SRR2050424     3  0.0000      0.993 0.000 0.000 1.000 0.000
#> SRR2050423     1  0.0921      0.926 0.972 0.000 0.000 0.028
#> SRR2050422     4  0.0336      0.942 0.000 0.008 0.000 0.992
#> SRR2050421     1  0.0000      0.926 1.000 0.000 0.000 0.000
#> SRR2050420     1  0.0000      0.926 1.000 0.000 0.000 0.000
#> SRR2050419     2  0.0000      0.981 0.000 1.000 0.000 0.000
#> SRR2050418     1  0.1211      0.924 0.960 0.000 0.000 0.040
#> SRR2050417     1  0.0336      0.925 0.992 0.000 0.000 0.008
#> SRR2050416     2  0.3356      0.770 0.000 0.824 0.000 0.176
#> SRR2050415     3  0.0000      0.993 0.000 0.000 1.000 0.000
#> SRR2050414     1  0.1022      0.926 0.968 0.000 0.000 0.032
#> SRR2050413     4  0.0336      0.942 0.000 0.008 0.000 0.992
#> SRR2050412     1  0.0000      0.926 1.000 0.000 0.000 0.000
#> SRR2050411     1  0.0336      0.925 0.992 0.000 0.000 0.008
#> SRR2050409     2  0.0000      0.981 0.000 1.000 0.000 0.000
#> SRR2050408     1  0.0336      0.925 0.992 0.000 0.000 0.008
#> SRR2050407     2  0.0000      0.981 0.000 1.000 0.000 0.000
#> SRR2050406     3  0.0000      0.993 0.000 0.000 1.000 0.000
#> SRR2050405     1  0.1022      0.926 0.968 0.000 0.000 0.032
#> SRR2050404     2  0.0000      0.981 0.000 1.000 0.000 0.000
#> SRR2050403     1  0.0336      0.925 0.992 0.000 0.000 0.008
#> SRR2050402     2  0.2081      0.895 0.000 0.916 0.000 0.084
#> SRR2050401     1  0.0000      0.926 1.000 0.000 0.000 0.000
#> SRR2050400     1  0.0336      0.925 0.992 0.000 0.000 0.008
#> SRR2050399     4  0.4522      0.492 0.000 0.320 0.000 0.680
#> SRR2050398     1  0.0000      0.926 1.000 0.000 0.000 0.000
#> SRR2050397     1  0.0336      0.925 0.992 0.000 0.000 0.008
#> SRR2050396     3  0.2124      0.917 0.028 0.000 0.932 0.040
#> SRR2050395     1  0.0921      0.926 0.972 0.000 0.000 0.028
#> SRR2050394     2  0.0000      0.981 0.000 1.000 0.000 0.000
#> SRR2050393     3  0.0000      0.993 0.000 0.000 1.000 0.000
#> SRR2050392     1  0.1022      0.926 0.968 0.000 0.000 0.032
#> SRR2050465     2  0.0000      0.981 0.000 1.000 0.000 0.000
#> SRR2050464     3  0.0000      0.993 0.000 0.000 1.000 0.000
#> SRR2050463     1  0.1022      0.926 0.968 0.000 0.000 0.032
#> SRR2050462     2  0.0000      0.981 0.000 1.000 0.000 0.000
#> SRR2050461     3  0.0000      0.993 0.000 0.000 1.000 0.000
#> SRR2050460     1  0.1022      0.926 0.968 0.000 0.000 0.032
#> SRR2050459     2  0.0469      0.972 0.000 0.988 0.000 0.012
#> SRR2050458     3  0.0000      0.993 0.000 0.000 1.000 0.000
#> SRR2050457     1  0.1211      0.921 0.960 0.000 0.000 0.040
#> SRR2050456     2  0.0000      0.981 0.000 1.000 0.000 0.000
#> SRR2050455     3  0.0000      0.993 0.000 0.000 1.000 0.000
#> SRR2050454     1  0.1022      0.926 0.968 0.000 0.000 0.032
#> SRR2050453     2  0.0000      0.981 0.000 1.000 0.000 0.000
#> SRR2050452     3  0.0000      0.993 0.000 0.000 1.000 0.000
#> SRR2050451     1  0.1022      0.926 0.968 0.000 0.000 0.032
#> SRR2050450     2  0.0000      0.981 0.000 1.000 0.000 0.000
#> SRR2050449     3  0.0000      0.993 0.000 0.000 1.000 0.000
#> SRR2050448     1  0.1022      0.926 0.968 0.000 0.000 0.032
#> SRR2050447     3  0.0000      0.993 0.000 0.000 1.000 0.000
#> SRR2050446     1  0.1022      0.926 0.968 0.000 0.000 0.032
#> SRR2050445     2  0.0000      0.981 0.000 1.000 0.000 0.000
#> SRR2050444     3  0.0000      0.993 0.000 0.000 1.000 0.000
#> SRR2050443     1  0.1022      0.926 0.968 0.000 0.000 0.032
#> SRR2050442     4  0.0336      0.942 0.000 0.008 0.000 0.992
#> SRR2050441     3  0.0000      0.993 0.000 0.000 1.000 0.000
#> SRR2050440     1  0.4972      0.315 0.544 0.000 0.000 0.456
#> SRR2050439     4  0.0336      0.942 0.000 0.008 0.000 0.992
#> SRR2050438     3  0.0592      0.979 0.000 0.000 0.984 0.016
#> SRR2050437     1  0.4972      0.315 0.544 0.000 0.000 0.456
#> SRR2050436     4  0.0336      0.942 0.000 0.008 0.000 0.992
#> SRR2050435     3  0.0336      0.987 0.000 0.000 0.992 0.008
#> SRR2050434     4  0.0336      0.942 0.000 0.008 0.000 0.992
#> SRR2050433     2  0.0000      0.981 0.000 1.000 0.000 0.000
#> SRR2050432     1  0.0000      0.926 1.000 0.000 0.000 0.000
#> SRR2050431     1  0.0336      0.925 0.992 0.000 0.000 0.008
#> SRR2050430     1  0.4972      0.315 0.544 0.000 0.000 0.456
#> SRR2050429     1  0.4888      0.359 0.588 0.000 0.000 0.412

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>            class entropy silhouette    p1    p2    p3    p4    p5
#> SRR2050410     2  0.0000      0.979 0.000 1.000 0.000 0.000 0.000
#> SRR2050427     1  0.0162      0.947 0.996 0.000 0.000 0.004 0.000
#> SRR2050426     1  0.0880      0.931 0.968 0.000 0.000 0.032 0.000
#> SRR2050425     2  0.0000      0.979 0.000 1.000 0.000 0.000 0.000
#> SRR2050424     3  0.0000      0.993 0.000 0.000 1.000 0.000 0.000
#> SRR2050423     4  0.0162      0.989 0.004 0.000 0.000 0.996 0.000
#> SRR2050422     5  0.0162      0.942 0.000 0.004 0.000 0.000 0.996
#> SRR2050421     1  0.0162      0.947 0.996 0.000 0.000 0.004 0.000
#> SRR2050420     1  0.0880      0.931 0.968 0.000 0.000 0.032 0.000
#> SRR2050419     2  0.0000      0.979 0.000 1.000 0.000 0.000 0.000
#> SRR2050418     1  0.3109      0.758 0.800 0.000 0.000 0.200 0.000
#> SRR2050417     1  0.0000      0.946 1.000 0.000 0.000 0.000 0.000
#> SRR2050416     2  0.1270      0.932 0.000 0.948 0.000 0.000 0.052
#> SRR2050415     3  0.0000      0.993 0.000 0.000 1.000 0.000 0.000
#> SRR2050414     4  0.0000      0.991 0.000 0.000 0.000 1.000 0.000
#> SRR2050413     5  0.0162      0.942 0.000 0.004 0.000 0.000 0.996
#> SRR2050412     1  0.0162      0.947 0.996 0.000 0.000 0.004 0.000
#> SRR2050411     1  0.0000      0.946 1.000 0.000 0.000 0.000 0.000
#> SRR2050409     2  0.0000      0.979 0.000 1.000 0.000 0.000 0.000
#> SRR2050408     1  0.0000      0.946 1.000 0.000 0.000 0.000 0.000
#> SRR2050407     2  0.0000      0.979 0.000 1.000 0.000 0.000 0.000
#> SRR2050406     3  0.0000      0.993 0.000 0.000 1.000 0.000 0.000
#> SRR2050405     4  0.0000      0.991 0.000 0.000 0.000 1.000 0.000
#> SRR2050404     2  0.0000      0.979 0.000 1.000 0.000 0.000 0.000
#> SRR2050403     1  0.0000      0.946 1.000 0.000 0.000 0.000 0.000
#> SRR2050402     2  0.0000      0.979 0.000 1.000 0.000 0.000 0.000
#> SRR2050401     1  0.0162      0.947 0.996 0.000 0.000 0.004 0.000
#> SRR2050400     1  0.1197      0.918 0.952 0.000 0.000 0.048 0.000
#> SRR2050399     2  0.3816      0.578 0.000 0.696 0.000 0.000 0.304
#> SRR2050398     1  0.0162      0.947 0.996 0.000 0.000 0.004 0.000
#> SRR2050397     1  0.0000      0.946 1.000 0.000 0.000 0.000 0.000
#> SRR2050396     3  0.2659      0.877 0.000 0.000 0.888 0.060 0.052
#> SRR2050395     4  0.0510      0.979 0.016 0.000 0.000 0.984 0.000
#> SRR2050394     2  0.0000      0.979 0.000 1.000 0.000 0.000 0.000
#> SRR2050393     3  0.0000      0.993 0.000 0.000 1.000 0.000 0.000
#> SRR2050392     4  0.0794      0.974 0.000 0.000 0.000 0.972 0.028
#> SRR2050465     2  0.0000      0.979 0.000 1.000 0.000 0.000 0.000
#> SRR2050464     3  0.0000      0.993 0.000 0.000 1.000 0.000 0.000
#> SRR2050463     4  0.0000      0.991 0.000 0.000 0.000 1.000 0.000
#> SRR2050462     2  0.0000      0.979 0.000 1.000 0.000 0.000 0.000
#> SRR2050461     3  0.0000      0.993 0.000 0.000 1.000 0.000 0.000
#> SRR2050460     4  0.0000      0.991 0.000 0.000 0.000 1.000 0.000
#> SRR2050459     2  0.0000      0.979 0.000 1.000 0.000 0.000 0.000
#> SRR2050458     3  0.0000      0.993 0.000 0.000 1.000 0.000 0.000
#> SRR2050457     4  0.0794      0.974 0.000 0.000 0.000 0.972 0.028
#> SRR2050456     2  0.0000      0.979 0.000 1.000 0.000 0.000 0.000
#> SRR2050455     3  0.0000      0.993 0.000 0.000 1.000 0.000 0.000
#> SRR2050454     4  0.0000      0.991 0.000 0.000 0.000 1.000 0.000
#> SRR2050453     2  0.0000      0.979 0.000 1.000 0.000 0.000 0.000
#> SRR2050452     3  0.0000      0.993 0.000 0.000 1.000 0.000 0.000
#> SRR2050451     4  0.0000      0.991 0.000 0.000 0.000 1.000 0.000
#> SRR2050450     2  0.0000      0.979 0.000 1.000 0.000 0.000 0.000
#> SRR2050449     3  0.0000      0.993 0.000 0.000 1.000 0.000 0.000
#> SRR2050448     4  0.0000      0.991 0.000 0.000 0.000 1.000 0.000
#> SRR2050447     3  0.0000      0.993 0.000 0.000 1.000 0.000 0.000
#> SRR2050446     4  0.0000      0.991 0.000 0.000 0.000 1.000 0.000
#> SRR2050445     2  0.0000      0.979 0.000 1.000 0.000 0.000 0.000
#> SRR2050444     3  0.0000      0.993 0.000 0.000 1.000 0.000 0.000
#> SRR2050443     4  0.0794      0.974 0.000 0.000 0.000 0.972 0.028
#> SRR2050442     5  0.0703      0.939 0.000 0.024 0.000 0.000 0.976
#> SRR2050441     3  0.0000      0.993 0.000 0.000 1.000 0.000 0.000
#> SRR2050440     5  0.1410      0.923 0.000 0.000 0.000 0.060 0.940
#> SRR2050439     5  0.0703      0.939 0.000 0.024 0.000 0.000 0.976
#> SRR2050438     3  0.0000      0.993 0.000 0.000 1.000 0.000 0.000
#> SRR2050437     5  0.1410      0.923 0.000 0.000 0.000 0.060 0.940
#> SRR2050436     5  0.0703      0.939 0.000 0.024 0.000 0.000 0.976
#> SRR2050435     3  0.0000      0.993 0.000 0.000 1.000 0.000 0.000
#> SRR2050434     5  0.0000      0.941 0.000 0.000 0.000 0.000 1.000
#> SRR2050433     2  0.0000      0.979 0.000 1.000 0.000 0.000 0.000
#> SRR2050432     1  0.0162      0.947 0.996 0.000 0.000 0.004 0.000
#> SRR2050431     1  0.5185      0.273 0.568 0.000 0.000 0.048 0.384
#> SRR2050430     5  0.1410      0.923 0.000 0.000 0.000 0.060 0.940
#> SRR2050429     5  0.3521      0.688 0.232 0.000 0.000 0.004 0.764

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>            class entropy silhouette    p1    p2    p3    p4    p5 p6
#> SRR2050410     2  0.0000     0.9302 0.000 1.000 0.000 0.000 0.000 NA
#> SRR2050427     1  0.3766     0.8334 0.748 0.000 0.000 0.040 0.000 NA
#> SRR2050426     1  0.2258     0.8501 0.896 0.000 0.000 0.044 0.000 NA
#> SRR2050425     2  0.0790     0.9161 0.000 0.968 0.000 0.000 0.000 NA
#> SRR2050424     3  0.1075     0.9136 0.000 0.000 0.952 0.000 0.000 NA
#> SRR2050423     4  0.0363     0.9885 0.012 0.000 0.000 0.988 0.000 NA
#> SRR2050422     5  0.2092     0.8499 0.000 0.124 0.000 0.000 0.876 NA
#> SRR2050421     1  0.3766     0.8334 0.748 0.000 0.000 0.040 0.000 NA
#> SRR2050420     1  0.2112     0.8205 0.896 0.000 0.000 0.088 0.000 NA
#> SRR2050419     2  0.0000     0.9302 0.000 1.000 0.000 0.000 0.000 NA
#> SRR2050418     1  0.3043     0.7542 0.792 0.000 0.000 0.200 0.000 NA
#> SRR2050417     1  0.0000     0.8531 1.000 0.000 0.000 0.000 0.000 NA
#> SRR2050416     2  0.4523     0.0787 0.000 0.516 0.000 0.000 0.452 NA
#> SRR2050415     3  0.0146     0.9222 0.000 0.000 0.996 0.000 0.000 NA
#> SRR2050414     4  0.0000     0.9948 0.000 0.000 0.000 1.000 0.000 NA
#> SRR2050413     5  0.2706     0.8383 0.000 0.124 0.000 0.000 0.852 NA
#> SRR2050412     1  0.3679     0.8344 0.760 0.000 0.000 0.040 0.000 NA
#> SRR2050411     1  0.0000     0.8531 1.000 0.000 0.000 0.000 0.000 NA
#> SRR2050409     2  0.0000     0.9302 0.000 1.000 0.000 0.000 0.000 NA
#> SRR2050408     1  0.0000     0.8531 1.000 0.000 0.000 0.000 0.000 NA
#> SRR2050407     2  0.0000     0.9302 0.000 1.000 0.000 0.000 0.000 NA
#> SRR2050406     3  0.0547     0.9203 0.000 0.000 0.980 0.000 0.000 NA
#> SRR2050405     4  0.0000     0.9948 0.000 0.000 0.000 1.000 0.000 NA
#> SRR2050404     2  0.0146     0.9289 0.000 0.996 0.000 0.000 0.000 NA
#> SRR2050403     1  0.0000     0.8531 1.000 0.000 0.000 0.000 0.000 NA
#> SRR2050402     2  0.1049     0.9118 0.000 0.960 0.000 0.000 0.008 NA
#> SRR2050401     1  0.3679     0.8344 0.760 0.000 0.000 0.040 0.000 NA
#> SRR2050400     1  0.2432     0.8065 0.876 0.000 0.000 0.100 0.000 NA
#> SRR2050399     2  0.4529     0.0518 0.000 0.508 0.000 0.000 0.460 NA
#> SRR2050398     1  0.3679     0.8344 0.760 0.000 0.000 0.040 0.000 NA
#> SRR2050397     1  0.0000     0.8531 1.000 0.000 0.000 0.000 0.000 NA
#> SRR2050396     3  0.2699     0.8743 0.000 0.000 0.856 0.008 0.012 NA
#> SRR2050395     4  0.0260     0.9919 0.008 0.000 0.000 0.992 0.000 NA
#> SRR2050394     2  0.0000     0.9302 0.000 1.000 0.000 0.000 0.000 NA
#> SRR2050393     3  0.1501     0.8927 0.000 0.000 0.924 0.000 0.000 NA
#> SRR2050392     4  0.0260     0.9916 0.000 0.000 0.000 0.992 0.008 NA
#> SRR2050465     2  0.0000     0.9302 0.000 1.000 0.000 0.000 0.000 NA
#> SRR2050464     3  0.0000     0.9223 0.000 0.000 1.000 0.000 0.000 NA
#> SRR2050463     4  0.0000     0.9948 0.000 0.000 0.000 1.000 0.000 NA
#> SRR2050462     2  0.0000     0.9302 0.000 1.000 0.000 0.000 0.000 NA
#> SRR2050461     3  0.0146     0.9222 0.000 0.000 0.996 0.000 0.000 NA
#> SRR2050460     4  0.0260     0.9915 0.008 0.000 0.000 0.992 0.000 NA
#> SRR2050459     2  0.0865     0.9072 0.000 0.964 0.000 0.000 0.036 NA
#> SRR2050458     3  0.1501     0.8927 0.000 0.000 0.924 0.000 0.000 NA
#> SRR2050457     4  0.0363     0.9887 0.000 0.000 0.000 0.988 0.012 NA
#> SRR2050456     2  0.0000     0.9302 0.000 1.000 0.000 0.000 0.000 NA
#> SRR2050455     3  0.0000     0.9223 0.000 0.000 1.000 0.000 0.000 NA
#> SRR2050454     4  0.0000     0.9948 0.000 0.000 0.000 1.000 0.000 NA
#> SRR2050453     2  0.0000     0.9302 0.000 1.000 0.000 0.000 0.000 NA
#> SRR2050452     3  0.0000     0.9223 0.000 0.000 1.000 0.000 0.000 NA
#> SRR2050451     4  0.0000     0.9948 0.000 0.000 0.000 1.000 0.000 NA
#> SRR2050450     2  0.0000     0.9302 0.000 1.000 0.000 0.000 0.000 NA
#> SRR2050449     3  0.0000     0.9223 0.000 0.000 1.000 0.000 0.000 NA
#> SRR2050448     4  0.0000     0.9948 0.000 0.000 0.000 1.000 0.000 NA
#> SRR2050447     3  0.1075     0.9136 0.000 0.000 0.952 0.000 0.000 NA
#> SRR2050446     4  0.0146     0.9935 0.000 0.000 0.000 0.996 0.004 NA
#> SRR2050445     2  0.0000     0.9302 0.000 1.000 0.000 0.000 0.000 NA
#> SRR2050444     3  0.0000     0.9223 0.000 0.000 1.000 0.000 0.000 NA
#> SRR2050443     4  0.0260     0.9916 0.000 0.000 0.000 0.992 0.008 NA
#> SRR2050442     5  0.0000     0.9001 0.000 0.000 0.000 0.000 1.000 NA
#> SRR2050441     3  0.1007     0.9152 0.000 0.000 0.956 0.000 0.000 NA
#> SRR2050440     5  0.1267     0.8933 0.000 0.000 0.000 0.000 0.940 NA
#> SRR2050439     5  0.0000     0.9001 0.000 0.000 0.000 0.000 1.000 NA
#> SRR2050438     3  0.3998     0.5343 0.000 0.000 0.504 0.000 0.004 NA
#> SRR2050437     5  0.1267     0.8933 0.000 0.000 0.000 0.000 0.940 NA
#> SRR2050436     5  0.0000     0.9001 0.000 0.000 0.000 0.000 1.000 NA
#> SRR2050435     3  0.3999     0.5323 0.000 0.000 0.500 0.000 0.004 NA
#> SRR2050434     5  0.1957     0.8597 0.000 0.112 0.000 0.000 0.888 NA
#> SRR2050433     2  0.0790     0.9161 0.000 0.968 0.000 0.000 0.000 NA
#> SRR2050432     1  0.3679     0.8344 0.760 0.000 0.000 0.040 0.000 NA
#> SRR2050431     1  0.6848     0.3501 0.484 0.000 0.000 0.100 0.248 NA
#> SRR2050430     5  0.2597     0.8494 0.000 0.000 0.000 0.000 0.824 NA
#> SRR2050429     5  0.5556     0.7231 0.092 0.000 0.000 0.080 0.660 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-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 15040 rows and 73 columns.
#>   Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'SD' method.
#>   Subgroups are detected by 'NMF' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 3.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

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

collect_plots(res)

plot of chunk SD-NMF-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.861           0.935       0.969         0.4860 0.521   0.521
#> 3 3 1.000           0.975       0.988         0.3301 0.734   0.535
#> 4 4 0.787           0.842       0.905         0.1244 0.916   0.768
#> 5 5 0.845           0.774       0.877         0.0839 0.821   0.467
#> 6 6 0.835           0.750       0.856         0.0215 0.961   0.839

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
#> SRR2050410     2  0.0000      0.954 0.000 1.000
#> SRR2050427     1  0.0000      0.990 1.000 0.000
#> SRR2050426     1  0.1633      0.967 0.976 0.024
#> SRR2050425     2  0.0000      0.954 0.000 1.000
#> SRR2050424     1  0.0000      0.990 1.000 0.000
#> SRR2050423     1  0.0000      0.990 1.000 0.000
#> SRR2050422     2  0.0000      0.954 0.000 1.000
#> SRR2050421     1  0.0000      0.990 1.000 0.000
#> SRR2050420     1  0.3584      0.921 0.932 0.068
#> SRR2050419     2  0.0000      0.954 0.000 1.000
#> SRR2050418     2  0.0000      0.954 0.000 1.000
#> SRR2050417     2  0.0000      0.954 0.000 1.000
#> SRR2050416     2  0.0000      0.954 0.000 1.000
#> SRR2050415     1  0.0000      0.990 1.000 0.000
#> SRR2050414     2  0.1184      0.943 0.016 0.984
#> SRR2050413     2  0.0000      0.954 0.000 1.000
#> SRR2050412     1  0.0000      0.990 1.000 0.000
#> SRR2050411     2  0.9170      0.563 0.332 0.668
#> SRR2050409     2  0.0000      0.954 0.000 1.000
#> SRR2050408     2  0.0000      0.954 0.000 1.000
#> SRR2050407     2  0.0000      0.954 0.000 1.000
#> SRR2050406     1  0.0000      0.990 1.000 0.000
#> SRR2050405     2  0.8608      0.650 0.284 0.716
#> SRR2050404     2  0.0000      0.954 0.000 1.000
#> SRR2050403     2  0.5737      0.844 0.136 0.864
#> SRR2050402     2  0.0000      0.954 0.000 1.000
#> SRR2050401     1  0.0000      0.990 1.000 0.000
#> SRR2050400     2  0.4022      0.895 0.080 0.920
#> SRR2050399     2  0.0000      0.954 0.000 1.000
#> SRR2050398     1  0.0000      0.990 1.000 0.000
#> SRR2050397     2  0.8909      0.608 0.308 0.692
#> SRR2050396     1  0.0000      0.990 1.000 0.000
#> SRR2050395     1  0.6438      0.790 0.836 0.164
#> SRR2050394     2  0.0000      0.954 0.000 1.000
#> SRR2050393     1  0.0000      0.990 1.000 0.000
#> SRR2050392     2  0.0000      0.954 0.000 1.000
#> SRR2050465     2  0.0000      0.954 0.000 1.000
#> SRR2050464     1  0.0000      0.990 1.000 0.000
#> SRR2050463     2  0.0376      0.951 0.004 0.996
#> SRR2050462     2  0.0000      0.954 0.000 1.000
#> SRR2050461     1  0.0000      0.990 1.000 0.000
#> SRR2050460     2  0.7674      0.740 0.224 0.776
#> SRR2050459     2  0.0000      0.954 0.000 1.000
#> SRR2050458     1  0.0000      0.990 1.000 0.000
#> SRR2050457     2  0.0000      0.954 0.000 1.000
#> SRR2050456     2  0.0000      0.954 0.000 1.000
#> SRR2050455     1  0.0000      0.990 1.000 0.000
#> SRR2050454     2  0.0000      0.954 0.000 1.000
#> SRR2050453     2  0.0000      0.954 0.000 1.000
#> SRR2050452     1  0.0000      0.990 1.000 0.000
#> SRR2050451     2  0.0000      0.954 0.000 1.000
#> SRR2050450     2  0.0000      0.954 0.000 1.000
#> SRR2050449     1  0.0000      0.990 1.000 0.000
#> SRR2050448     2  0.0000      0.954 0.000 1.000
#> SRR2050447     1  0.0000      0.990 1.000 0.000
#> SRR2050446     2  0.0000      0.954 0.000 1.000
#> SRR2050445     2  0.0000      0.954 0.000 1.000
#> SRR2050444     1  0.0000      0.990 1.000 0.000
#> SRR2050443     2  0.0000      0.954 0.000 1.000
#> SRR2050442     2  0.0000      0.954 0.000 1.000
#> SRR2050441     1  0.0000      0.990 1.000 0.000
#> SRR2050440     1  0.0000      0.990 1.000 0.000
#> SRR2050439     2  0.0000      0.954 0.000 1.000
#> SRR2050438     1  0.0000      0.990 1.000 0.000
#> SRR2050437     1  0.0000      0.990 1.000 0.000
#> SRR2050436     2  0.0000      0.954 0.000 1.000
#> SRR2050435     1  0.0000      0.990 1.000 0.000
#> SRR2050434     2  0.0000      0.954 0.000 1.000
#> SRR2050433     2  0.0000      0.954 0.000 1.000
#> SRR2050432     1  0.0000      0.990 1.000 0.000
#> SRR2050431     2  0.5178      0.864 0.116 0.884
#> SRR2050430     2  0.5294      0.861 0.120 0.880
#> SRR2050429     2  0.9522      0.476 0.372 0.628

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>            class entropy silhouette    p1    p2    p3
#> SRR2050410     2  0.0000      0.979 0.000 1.000 0.000
#> SRR2050427     1  0.0000      0.991 1.000 0.000 0.000
#> SRR2050426     1  0.0000      0.991 1.000 0.000 0.000
#> SRR2050425     2  0.0000      0.979 0.000 1.000 0.000
#> SRR2050424     3  0.0000      1.000 0.000 0.000 1.000
#> SRR2050423     1  0.0000      0.991 1.000 0.000 0.000
#> SRR2050422     2  0.1964      0.931 0.056 0.944 0.000
#> SRR2050421     1  0.0000      0.991 1.000 0.000 0.000
#> SRR2050420     1  0.0000      0.991 1.000 0.000 0.000
#> SRR2050419     2  0.0000      0.979 0.000 1.000 0.000
#> SRR2050418     1  0.0000      0.991 1.000 0.000 0.000
#> SRR2050417     1  0.0000      0.991 1.000 0.000 0.000
#> SRR2050416     2  0.0000      0.979 0.000 1.000 0.000
#> SRR2050415     3  0.0000      1.000 0.000 0.000 1.000
#> SRR2050414     2  0.4605      0.759 0.204 0.796 0.000
#> SRR2050413     2  0.0000      0.979 0.000 1.000 0.000
#> SRR2050412     1  0.0000      0.991 1.000 0.000 0.000
#> SRR2050411     1  0.0000      0.991 1.000 0.000 0.000
#> SRR2050409     2  0.0000      0.979 0.000 1.000 0.000
#> SRR2050408     1  0.0000      0.991 1.000 0.000 0.000
#> SRR2050407     2  0.0000      0.979 0.000 1.000 0.000
#> SRR2050406     3  0.0000      1.000 0.000 0.000 1.000
#> SRR2050405     2  0.5053      0.795 0.164 0.812 0.024
#> SRR2050404     2  0.0000      0.979 0.000 1.000 0.000
#> SRR2050403     1  0.0000      0.991 1.000 0.000 0.000
#> SRR2050402     2  0.0000      0.979 0.000 1.000 0.000
#> SRR2050401     1  0.0000      0.991 1.000 0.000 0.000
#> SRR2050400     1  0.0000      0.991 1.000 0.000 0.000
#> SRR2050399     2  0.0000      0.979 0.000 1.000 0.000
#> SRR2050398     1  0.0000      0.991 1.000 0.000 0.000
#> SRR2050397     1  0.0000      0.991 1.000 0.000 0.000
#> SRR2050396     3  0.0000      1.000 0.000 0.000 1.000
#> SRR2050395     1  0.5180      0.771 0.812 0.156 0.032
#> SRR2050394     2  0.0000      0.979 0.000 1.000 0.000
#> SRR2050393     3  0.0000      1.000 0.000 0.000 1.000
#> SRR2050392     2  0.0000      0.979 0.000 1.000 0.000
#> SRR2050465     2  0.0000      0.979 0.000 1.000 0.000
#> SRR2050464     3  0.0000      1.000 0.000 0.000 1.000
#> SRR2050463     2  0.1031      0.960 0.024 0.976 0.000
#> SRR2050462     2  0.0000      0.979 0.000 1.000 0.000
#> SRR2050461     3  0.0000      1.000 0.000 0.000 1.000
#> SRR2050460     1  0.0000      0.991 1.000 0.000 0.000
#> SRR2050459     2  0.0000      0.979 0.000 1.000 0.000
#> SRR2050458     3  0.0000      1.000 0.000 0.000 1.000
#> SRR2050457     2  0.0000      0.979 0.000 1.000 0.000
#> SRR2050456     2  0.0000      0.979 0.000 1.000 0.000
#> SRR2050455     3  0.0000      1.000 0.000 0.000 1.000
#> SRR2050454     2  0.0000      0.979 0.000 1.000 0.000
#> SRR2050453     2  0.0000      0.979 0.000 1.000 0.000
#> SRR2050452     3  0.0000      1.000 0.000 0.000 1.000
#> SRR2050451     2  0.0424      0.973 0.008 0.992 0.000
#> SRR2050450     2  0.0000      0.979 0.000 1.000 0.000
#> SRR2050449     3  0.0000      1.000 0.000 0.000 1.000
#> SRR2050448     2  0.0000      0.979 0.000 1.000 0.000
#> SRR2050447     3  0.0000      1.000 0.000 0.000 1.000
#> SRR2050446     2  0.4235      0.800 0.176 0.824 0.000
#> SRR2050445     2  0.0000      0.979 0.000 1.000 0.000
#> SRR2050444     3  0.0000      1.000 0.000 0.000 1.000
#> SRR2050443     2  0.0000      0.979 0.000 1.000 0.000
#> SRR2050442     2  0.0000      0.979 0.000 1.000 0.000
#> SRR2050441     3  0.0000      1.000 0.000 0.000 1.000
#> SRR2050440     1  0.0000      0.991 1.000 0.000 0.000
#> SRR2050439     2  0.0000      0.979 0.000 1.000 0.000
#> SRR2050438     3  0.0000      1.000 0.000 0.000 1.000
#> SRR2050437     1  0.0000      0.991 1.000 0.000 0.000
#> SRR2050436     2  0.0000      0.979 0.000 1.000 0.000
#> SRR2050435     3  0.0000      1.000 0.000 0.000 1.000
#> SRR2050434     2  0.0000      0.979 0.000 1.000 0.000
#> SRR2050433     2  0.0000      0.979 0.000 1.000 0.000
#> SRR2050432     1  0.0000      0.991 1.000 0.000 0.000
#> SRR2050431     1  0.0000      0.991 1.000 0.000 0.000
#> SRR2050430     1  0.0000      0.991 1.000 0.000 0.000
#> SRR2050429     1  0.0000      0.991 1.000 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> SRR2050410     2  0.2647      0.819 0.000 0.880 0.000 0.120
#> SRR2050427     1  0.0000      0.954 1.000 0.000 0.000 0.000
#> SRR2050426     1  0.0000      0.954 1.000 0.000 0.000 0.000
#> SRR2050425     2  0.3074      0.796 0.000 0.848 0.000 0.152
#> SRR2050424     3  0.0000      0.992 0.000 0.000 1.000 0.000
#> SRR2050423     1  0.1022      0.941 0.968 0.000 0.000 0.032
#> SRR2050422     4  0.4019      0.808 0.012 0.196 0.000 0.792
#> SRR2050421     1  0.0000      0.954 1.000 0.000 0.000 0.000
#> SRR2050420     1  0.0000      0.954 1.000 0.000 0.000 0.000
#> SRR2050419     2  0.0707      0.823 0.000 0.980 0.000 0.020
#> SRR2050418     1  0.0000      0.954 1.000 0.000 0.000 0.000
#> SRR2050417     1  0.0921      0.943 0.972 0.000 0.000 0.028
#> SRR2050416     2  0.3400      0.771 0.000 0.820 0.000 0.180
#> SRR2050415     3  0.0000      0.992 0.000 0.000 1.000 0.000
#> SRR2050414     2  0.5397      0.600 0.212 0.720 0.000 0.068
#> SRR2050413     2  0.4941      0.241 0.000 0.564 0.000 0.436
#> SRR2050412     1  0.0000      0.954 1.000 0.000 0.000 0.000
#> SRR2050411     1  0.0188      0.953 0.996 0.000 0.000 0.004
#> SRR2050409     2  0.2530      0.821 0.000 0.888 0.000 0.112
#> SRR2050408     1  0.0817      0.944 0.976 0.000 0.000 0.024
#> SRR2050407     2  0.0188      0.827 0.000 0.996 0.000 0.004
#> SRR2050406     3  0.0000      0.992 0.000 0.000 1.000 0.000
#> SRR2050405     2  0.5793      0.639 0.096 0.712 0.004 0.188
#> SRR2050404     2  0.2647      0.819 0.000 0.880 0.000 0.120
#> SRR2050403     1  0.0707      0.947 0.980 0.000 0.000 0.020
#> SRR2050402     2  0.2647      0.819 0.000 0.880 0.000 0.120
#> SRR2050401     1  0.0000      0.954 1.000 0.000 0.000 0.000
#> SRR2050400     1  0.0000      0.954 1.000 0.000 0.000 0.000
#> SRR2050399     2  0.4164      0.662 0.000 0.736 0.000 0.264
#> SRR2050398     1  0.0000      0.954 1.000 0.000 0.000 0.000
#> SRR2050397     1  0.0000      0.954 1.000 0.000 0.000 0.000
#> SRR2050396     3  0.0000      0.992 0.000 0.000 1.000 0.000
#> SRR2050395     1  0.4784      0.729 0.788 0.112 0.000 0.100
#> SRR2050394     2  0.2281      0.826 0.000 0.904 0.000 0.096
#> SRR2050393     3  0.0000      0.992 0.000 0.000 1.000 0.000
#> SRR2050392     2  0.2647      0.783 0.000 0.880 0.000 0.120
#> SRR2050465     2  0.2647      0.819 0.000 0.880 0.000 0.120
#> SRR2050464     3  0.0000      0.992 0.000 0.000 1.000 0.000
#> SRR2050463     2  0.3372      0.780 0.036 0.868 0.000 0.096
#> SRR2050462     2  0.2647      0.819 0.000 0.880 0.000 0.120
#> SRR2050461     3  0.0000      0.992 0.000 0.000 1.000 0.000
#> SRR2050460     1  0.1022      0.941 0.968 0.000 0.000 0.032
#> SRR2050459     2  0.0469      0.828 0.000 0.988 0.000 0.012
#> SRR2050458     3  0.0000      0.992 0.000 0.000 1.000 0.000
#> SRR2050457     2  0.3400      0.741 0.000 0.820 0.000 0.180
#> SRR2050456     2  0.0188      0.826 0.000 0.996 0.000 0.004
#> SRR2050455     3  0.0000      0.992 0.000 0.000 1.000 0.000
#> SRR2050454     2  0.3486      0.736 0.000 0.812 0.000 0.188
#> SRR2050453     2  0.2081      0.828 0.000 0.916 0.000 0.084
#> SRR2050452     3  0.0000      0.992 0.000 0.000 1.000 0.000
#> SRR2050451     2  0.3667      0.775 0.056 0.856 0.000 0.088
#> SRR2050450     2  0.2216      0.827 0.000 0.908 0.000 0.092
#> SRR2050449     3  0.0000      0.992 0.000 0.000 1.000 0.000
#> SRR2050448     2  0.2021      0.807 0.012 0.932 0.000 0.056
#> SRR2050447     3  0.0000      0.992 0.000 0.000 1.000 0.000
#> SRR2050446     2  0.5830      0.459 0.332 0.620 0.000 0.048
#> SRR2050445     2  0.0592      0.824 0.000 0.984 0.000 0.016
#> SRR2050444     3  0.0000      0.992 0.000 0.000 1.000 0.000
#> SRR2050443     2  0.3219      0.755 0.000 0.836 0.000 0.164
#> SRR2050442     4  0.3610      0.810 0.000 0.200 0.000 0.800
#> SRR2050441     3  0.0000      0.992 0.000 0.000 1.000 0.000
#> SRR2050440     4  0.5628      0.654 0.144 0.000 0.132 0.724
#> SRR2050439     4  0.3688      0.801 0.000 0.208 0.000 0.792
#> SRR2050438     3  0.2530      0.869 0.000 0.000 0.888 0.112
#> SRR2050437     4  0.4604      0.710 0.180 0.028 0.008 0.784
#> SRR2050436     4  0.3610      0.810 0.000 0.200 0.000 0.800
#> SRR2050435     3  0.0000      0.992 0.000 0.000 1.000 0.000
#> SRR2050434     4  0.3610      0.810 0.000 0.200 0.000 0.800
#> SRR2050433     2  0.2647      0.819 0.000 0.880 0.000 0.120
#> SRR2050432     1  0.0000      0.954 1.000 0.000 0.000 0.000
#> SRR2050431     1  0.0469      0.950 0.988 0.000 0.000 0.012
#> SRR2050430     4  0.4697      0.422 0.356 0.000 0.000 0.644
#> SRR2050429     1  0.4933      0.194 0.568 0.000 0.000 0.432

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>            class entropy silhouette    p1    p2    p3    p4    p5
#> SRR2050410     2  0.3424     0.6777 0.000 0.760 0.000 0.000 0.240
#> SRR2050427     1  0.0162     0.9471 0.996 0.000 0.000 0.004 0.000
#> SRR2050426     1  0.0290     0.9472 0.992 0.000 0.000 0.008 0.000
#> SRR2050425     2  0.2424     0.6978 0.000 0.868 0.000 0.000 0.132
#> SRR2050424     3  0.0000     0.9934 0.000 0.000 1.000 0.000 0.000
#> SRR2050423     4  0.0932     0.9103 0.020 0.000 0.004 0.972 0.004
#> SRR2050422     2  0.3038     0.5769 0.040 0.872 0.000 0.008 0.080
#> SRR2050421     1  0.0000     0.9469 1.000 0.000 0.000 0.000 0.000
#> SRR2050420     1  0.0290     0.9469 0.992 0.000 0.000 0.008 0.000
#> SRR2050419     5  0.4262     0.1349 0.000 0.440 0.000 0.000 0.560
#> SRR2050418     1  0.0324     0.9464 0.992 0.000 0.000 0.004 0.004
#> SRR2050417     1  0.3916     0.6782 0.732 0.000 0.000 0.256 0.012
#> SRR2050416     2  0.1197     0.6763 0.000 0.952 0.000 0.000 0.048
#> SRR2050415     3  0.0162     0.9915 0.000 0.000 0.996 0.004 0.000
#> SRR2050414     4  0.1329     0.9168 0.000 0.008 0.004 0.956 0.032
#> SRR2050413     2  0.0290     0.6549 0.000 0.992 0.000 0.000 0.008
#> SRR2050412     1  0.0000     0.9469 1.000 0.000 0.000 0.000 0.000
#> SRR2050411     1  0.0404     0.9459 0.988 0.000 0.000 0.012 0.000
#> SRR2050409     2  0.3816     0.6002 0.000 0.696 0.000 0.000 0.304
#> SRR2050408     1  0.3336     0.7336 0.772 0.000 0.000 0.228 0.000
#> SRR2050407     2  0.4283     0.1573 0.000 0.544 0.000 0.000 0.456
#> SRR2050406     3  0.0290     0.9904 0.000 0.000 0.992 0.000 0.008
#> SRR2050405     4  0.2911     0.8734 0.004 0.000 0.008 0.852 0.136
#> SRR2050404     2  0.3274     0.6898 0.000 0.780 0.000 0.000 0.220
#> SRR2050403     1  0.0671     0.9437 0.980 0.000 0.000 0.016 0.004
#> SRR2050402     2  0.2813     0.6999 0.000 0.832 0.000 0.000 0.168
#> SRR2050401     1  0.0000     0.9469 1.000 0.000 0.000 0.000 0.000
#> SRR2050400     1  0.0290     0.9472 0.992 0.000 0.000 0.008 0.000
#> SRR2050399     2  0.0404     0.6652 0.000 0.988 0.000 0.000 0.012
#> SRR2050398     1  0.0162     0.9471 0.996 0.000 0.000 0.004 0.000
#> SRR2050397     1  0.0404     0.9459 0.988 0.000 0.000 0.012 0.000
#> SRR2050396     3  0.0290     0.9904 0.000 0.000 0.992 0.000 0.008
#> SRR2050395     4  0.1934     0.9116 0.016 0.000 0.004 0.928 0.052
#> SRR2050394     2  0.3561     0.6668 0.000 0.740 0.000 0.000 0.260
#> SRR2050393     3  0.0162     0.9924 0.000 0.000 0.996 0.000 0.004
#> SRR2050392     5  0.2623     0.5902 0.000 0.016 0.004 0.096 0.884
#> SRR2050465     2  0.3480     0.6726 0.000 0.752 0.000 0.000 0.248
#> SRR2050464     3  0.0000     0.9934 0.000 0.000 1.000 0.000 0.000
#> SRR2050463     4  0.1864     0.9107 0.000 0.004 0.004 0.924 0.068
#> SRR2050462     2  0.3109     0.6963 0.000 0.800 0.000 0.000 0.200
#> SRR2050461     3  0.0000     0.9934 0.000 0.000 1.000 0.000 0.000
#> SRR2050460     4  0.0833     0.9119 0.016 0.004 0.004 0.976 0.000
#> SRR2050459     2  0.4242     0.2720 0.000 0.572 0.000 0.000 0.428
#> SRR2050458     3  0.0000     0.9934 0.000 0.000 1.000 0.000 0.000
#> SRR2050457     5  0.2248     0.5656 0.000 0.088 0.000 0.012 0.900
#> SRR2050456     5  0.4273     0.1009 0.000 0.448 0.000 0.000 0.552
#> SRR2050455     3  0.0290     0.9904 0.000 0.000 0.992 0.000 0.008
#> SRR2050454     5  0.4240     0.2948 0.004 0.000 0.008 0.304 0.684
#> SRR2050453     2  0.3837     0.5928 0.000 0.692 0.000 0.000 0.308
#> SRR2050452     3  0.0162     0.9924 0.000 0.000 0.996 0.000 0.004
#> SRR2050451     4  0.2706     0.8767 0.004 0.004 0.004 0.872 0.116
#> SRR2050450     2  0.3612     0.6522 0.000 0.732 0.000 0.000 0.268
#> SRR2050449     3  0.0000     0.9934 0.000 0.000 1.000 0.000 0.000
#> SRR2050448     4  0.2392     0.8881 0.000 0.004 0.004 0.888 0.104
#> SRR2050447     3  0.0000     0.9934 0.000 0.000 1.000 0.000 0.000
#> SRR2050446     4  0.1877     0.9145 0.008 0.004 0.004 0.932 0.052
#> SRR2050445     5  0.4304    -0.0446 0.000 0.484 0.000 0.000 0.516
#> SRR2050444     3  0.0000     0.9934 0.000 0.000 1.000 0.000 0.000
#> SRR2050443     5  0.3053     0.5757 0.000 0.008 0.012 0.128 0.852
#> SRR2050442     2  0.2595     0.5885 0.000 0.888 0.000 0.032 0.080
#> SRR2050441     3  0.0162     0.9915 0.000 0.000 0.996 0.004 0.000
#> SRR2050440     4  0.2289     0.8699 0.012 0.004 0.000 0.904 0.080
#> SRR2050439     2  0.2595     0.5885 0.000 0.888 0.000 0.032 0.080
#> SRR2050438     3  0.1731     0.9438 0.008 0.000 0.940 0.012 0.040
#> SRR2050437     4  0.2689     0.8597 0.016 0.012 0.000 0.888 0.084
#> SRR2050436     2  0.3110     0.5599 0.000 0.860 0.000 0.060 0.080
#> SRR2050435     3  0.0162     0.9915 0.000 0.000 0.996 0.004 0.000
#> SRR2050434     2  0.4818     0.3389 0.000 0.708 0.000 0.212 0.080
#> SRR2050433     2  0.3366     0.6839 0.000 0.768 0.000 0.000 0.232
#> SRR2050432     1  0.0162     0.9471 0.996 0.000 0.000 0.004 0.000
#> SRR2050431     1  0.0609     0.9447 0.980 0.000 0.000 0.020 0.000
#> SRR2050430     1  0.5538     0.6952 0.716 0.140 0.000 0.060 0.084
#> SRR2050429     4  0.2535     0.8657 0.032 0.000 0.000 0.892 0.076

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>            class entropy silhouette    p1    p2    p3    p4 p5    p6
#> SRR2050410     2  0.2595     0.6273 0.000 0.836 0.000 0.000 NA 0.160
#> SRR2050427     1  0.0717     0.9263 0.976 0.000 0.000 0.000 NA 0.016
#> SRR2050426     1  0.1088     0.9198 0.960 0.000 0.000 0.000 NA 0.016
#> SRR2050425     2  0.0937     0.7078 0.000 0.960 0.000 0.000 NA 0.000
#> SRR2050424     3  0.0146     0.9738 0.000 0.000 0.996 0.000 NA 0.004
#> SRR2050423     4  0.0547     0.7990 0.000 0.000 0.000 0.980 NA 0.000
#> SRR2050422     2  0.4245     0.5665 0.024 0.644 0.000 0.000 NA 0.004
#> SRR2050421     1  0.0146     0.9306 0.996 0.000 0.000 0.000 NA 0.004
#> SRR2050420     1  0.0000     0.9303 1.000 0.000 0.000 0.000 NA 0.000
#> SRR2050419     2  0.3989     0.0881 0.000 0.528 0.000 0.000 NA 0.468
#> SRR2050418     1  0.0717     0.9263 0.976 0.000 0.000 0.000 NA 0.016
#> SRR2050417     1  0.4089     0.6806 0.744 0.000 0.000 0.204 NA 0.032
#> SRR2050416     2  0.1866     0.6977 0.000 0.908 0.000 0.000 NA 0.008
#> SRR2050415     3  0.0260     0.9731 0.000 0.000 0.992 0.000 NA 0.008
#> SRR2050414     4  0.0458     0.7997 0.000 0.000 0.000 0.984 NA 0.000
#> SRR2050413     2  0.3512     0.6183 0.000 0.720 0.000 0.000 NA 0.008
#> SRR2050412     1  0.0146     0.9306 0.996 0.000 0.000 0.000 NA 0.004
#> SRR2050411     1  0.0000     0.9303 1.000 0.000 0.000 0.000 NA 0.000
#> SRR2050409     2  0.2941     0.5677 0.000 0.780 0.000 0.000 NA 0.220
#> SRR2050408     1  0.4184     0.6402 0.720 0.000 0.000 0.228 NA 0.008
#> SRR2050407     2  0.3607     0.3795 0.000 0.652 0.000 0.000 NA 0.348
#> SRR2050406     3  0.0000     0.9744 0.000 0.000 1.000 0.000 NA 0.000
#> SRR2050405     4  0.1053     0.8001 0.000 0.000 0.004 0.964 NA 0.020
#> SRR2050404     2  0.0405     0.7061 0.000 0.988 0.000 0.000 NA 0.008
#> SRR2050403     1  0.0520     0.9274 0.984 0.000 0.000 0.000 NA 0.008
#> SRR2050402     2  0.1858     0.6995 0.000 0.912 0.000 0.000 NA 0.012
#> SRR2050401     1  0.0260     0.9288 0.992 0.000 0.000 0.000 NA 0.000
#> SRR2050400     1  0.1908     0.8929 0.916 0.000 0.000 0.000 NA 0.028
#> SRR2050399     2  0.3490     0.6197 0.000 0.724 0.000 0.000 NA 0.008
#> SRR2050398     1  0.0146     0.9306 0.996 0.000 0.000 0.000 NA 0.004
#> SRR2050397     1  0.0146     0.9296 0.996 0.000 0.000 0.000 NA 0.004
#> SRR2050396     3  0.1620     0.9397 0.000 0.000 0.940 0.012 NA 0.024
#> SRR2050395     4  0.0260     0.8015 0.000 0.000 0.000 0.992 NA 0.008
#> SRR2050394     2  0.4570     0.5244 0.000 0.668 0.000 0.000 NA 0.252
#> SRR2050393     3  0.1327     0.9364 0.000 0.000 0.936 0.000 NA 0.064
#> SRR2050392     6  0.4056     0.7165 0.000 0.064 0.004 0.184 NA 0.748
#> SRR2050465     2  0.0520     0.7065 0.000 0.984 0.000 0.000 NA 0.008
#> SRR2050464     3  0.0000     0.9744 0.000 0.000 1.000 0.000 NA 0.000
#> SRR2050463     4  0.2320     0.7763 0.000 0.000 0.004 0.864 NA 0.000
#> SRR2050462     2  0.0458     0.7081 0.000 0.984 0.000 0.000 NA 0.000
#> SRR2050461     3  0.0000     0.9744 0.000 0.000 1.000 0.000 NA 0.000
#> SRR2050460     4  0.1765     0.7920 0.000 0.000 0.000 0.904 NA 0.000
#> SRR2050459     2  0.2358     0.6559 0.000 0.876 0.000 0.000 NA 0.108
#> SRR2050458     3  0.0000     0.9744 0.000 0.000 1.000 0.000 NA 0.000
#> SRR2050457     6  0.5362     0.7398 0.000 0.148 0.004 0.028 NA 0.668
#> SRR2050456     2  0.3869     0.0191 0.000 0.500 0.000 0.000 NA 0.500
#> SRR2050455     3  0.0363     0.9698 0.000 0.000 0.988 0.000 NA 0.012
#> SRR2050454     4  0.2257     0.7714 0.000 0.012 0.004 0.900 NA 0.076
#> SRR2050453     2  0.1408     0.6959 0.000 0.944 0.000 0.000 NA 0.020
#> SRR2050452     3  0.0146     0.9737 0.000 0.000 0.996 0.000 NA 0.000
#> SRR2050451     4  0.4512     0.6449 0.000 0.028 0.004 0.676 NA 0.016
#> SRR2050450     2  0.0363     0.7059 0.000 0.988 0.000 0.000 NA 0.012
#> SRR2050449     3  0.0000     0.9744 0.000 0.000 1.000 0.000 NA 0.000
#> SRR2050448     4  0.4151     0.6869 0.000 0.024 0.004 0.720 NA 0.012
#> SRR2050447     3  0.0291     0.9737 0.000 0.000 0.992 0.000 NA 0.004
#> SRR2050446     4  0.3406     0.7401 0.000 0.020 0.000 0.792 NA 0.008
#> SRR2050445     2  0.3966     0.1549 0.000 0.552 0.000 0.000 NA 0.444
#> SRR2050444     3  0.0146     0.9738 0.000 0.000 0.996 0.000 NA 0.004
#> SRR2050443     4  0.6914     0.1901 0.000 0.132 0.004 0.516 NA 0.184
#> SRR2050442     2  0.3717     0.5364 0.000 0.616 0.000 0.000 NA 0.000
#> SRR2050441     3  0.1333     0.9481 0.000 0.000 0.944 0.000 NA 0.008
#> SRR2050440     4  0.3331     0.7087 0.020 0.000 0.000 0.808 NA 0.012
#> SRR2050439     2  0.3578     0.5751 0.000 0.660 0.000 0.000 NA 0.000
#> SRR2050438     3  0.2402     0.8813 0.000 0.000 0.868 0.000 NA 0.012
#> SRR2050437     4  0.3375     0.7087 0.024 0.000 0.000 0.808 NA 0.012
#> SRR2050436     2  0.4002     0.5087 0.000 0.588 0.000 0.008 NA 0.000
#> SRR2050435     3  0.1462     0.9428 0.000 0.000 0.936 0.000 NA 0.008
#> SRR2050434     2  0.5791     0.3378 0.000 0.472 0.000 0.160 NA 0.004
#> SRR2050433     2  0.1088     0.7073 0.000 0.960 0.000 0.000 NA 0.024
#> SRR2050432     1  0.0260     0.9300 0.992 0.000 0.000 0.000 NA 0.008
#> SRR2050431     1  0.1173     0.9189 0.960 0.000 0.000 0.016 NA 0.008
#> SRR2050430     1  0.4042     0.6496 0.708 0.004 0.000 0.012 NA 0.012
#> SRR2050429     4  0.4081     0.6627 0.092 0.000 0.000 0.772 NA 0.012

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

consensus_heatmap(res, k = 2)

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

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

collect_plots(res)

plot of chunk CV-hclust-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.888           0.919       0.967         0.3835 0.610   0.610
#> 3 3 0.555           0.673       0.806         0.4604 0.890   0.821
#> 4 4 0.843           0.801       0.890         0.2877 0.760   0.548
#> 5 5 0.838           0.852       0.864         0.0676 0.881   0.627
#> 6 6 0.781           0.845       0.849         0.0410 0.970   0.854

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
#> SRR2050410     2   0.000      0.919 0.000 1.000
#> SRR2050427     1   0.000      0.978 1.000 0.000
#> SRR2050426     1   0.000      0.978 1.000 0.000
#> SRR2050425     2   0.000      0.919 0.000 1.000
#> SRR2050424     1   0.000      0.978 1.000 0.000
#> SRR2050423     1   0.000      0.978 1.000 0.000
#> SRR2050422     1   0.745      0.712 0.788 0.212
#> SRR2050421     1   0.000      0.978 1.000 0.000
#> SRR2050420     1   0.000      0.978 1.000 0.000
#> SRR2050419     2   0.000      0.919 0.000 1.000
#> SRR2050418     1   0.000      0.978 1.000 0.000
#> SRR2050417     1   0.000      0.978 1.000 0.000
#> SRR2050416     2   0.000      0.919 0.000 1.000
#> SRR2050415     1   0.000      0.978 1.000 0.000
#> SRR2050414     1   0.000      0.978 1.000 0.000
#> SRR2050413     1   0.753      0.705 0.784 0.216
#> SRR2050412     1   0.000      0.978 1.000 0.000
#> SRR2050411     1   0.000      0.978 1.000 0.000
#> SRR2050409     2   0.000      0.919 0.000 1.000
#> SRR2050408     1   0.000      0.978 1.000 0.000
#> SRR2050407     2   0.000      0.919 0.000 1.000
#> SRR2050406     1   0.000      0.978 1.000 0.000
#> SRR2050405     1   0.000      0.978 1.000 0.000
#> SRR2050404     2   0.000      0.919 0.000 1.000
#> SRR2050403     1   0.000      0.978 1.000 0.000
#> SRR2050402     2   0.917      0.539 0.332 0.668
#> SRR2050401     1   0.000      0.978 1.000 0.000
#> SRR2050400     1   0.000      0.978 1.000 0.000
#> SRR2050399     1   0.952      0.355 0.628 0.372
#> SRR2050398     1   0.000      0.978 1.000 0.000
#> SRR2050397     1   0.000      0.978 1.000 0.000
#> SRR2050396     1   0.000      0.978 1.000 0.000
#> SRR2050395     1   0.000      0.978 1.000 0.000
#> SRR2050394     2   0.000      0.919 0.000 1.000
#> SRR2050393     1   0.000      0.978 1.000 0.000
#> SRR2050392     1   0.000      0.978 1.000 0.000
#> SRR2050465     2   0.000      0.919 0.000 1.000
#> SRR2050464     1   0.000      0.978 1.000 0.000
#> SRR2050463     1   0.000      0.978 1.000 0.000
#> SRR2050462     2   0.000      0.919 0.000 1.000
#> SRR2050461     1   0.000      0.978 1.000 0.000
#> SRR2050460     1   0.000      0.978 1.000 0.000
#> SRR2050459     2   0.000      0.919 0.000 1.000
#> SRR2050458     1   0.000      0.978 1.000 0.000
#> SRR2050457     1   0.000      0.978 1.000 0.000
#> SRR2050456     2   0.000      0.919 0.000 1.000
#> SRR2050455     1   0.000      0.978 1.000 0.000
#> SRR2050454     1   0.000      0.978 1.000 0.000
#> SRR2050453     2   0.000      0.919 0.000 1.000
#> SRR2050452     1   0.000      0.978 1.000 0.000
#> SRR2050451     1   0.000      0.978 1.000 0.000
#> SRR2050450     2   0.000      0.919 0.000 1.000
#> SRR2050449     1   0.000      0.978 1.000 0.000
#> SRR2050448     1   0.000      0.978 1.000 0.000
#> SRR2050447     1   0.000      0.978 1.000 0.000
#> SRR2050446     1   0.000      0.978 1.000 0.000
#> SRR2050445     2   0.000      0.919 0.000 1.000
#> SRR2050444     1   0.000      0.978 1.000 0.000
#> SRR2050443     1   0.000      0.978 1.000 0.000
#> SRR2050442     2   0.975      0.370 0.408 0.592
#> SRR2050441     1   0.000      0.978 1.000 0.000
#> SRR2050440     1   0.000      0.978 1.000 0.000
#> SRR2050439     2   0.975      0.370 0.408 0.592
#> SRR2050438     1   0.000      0.978 1.000 0.000
#> SRR2050437     1   0.000      0.978 1.000 0.000
#> SRR2050436     1   0.680      0.763 0.820 0.180
#> SRR2050435     1   0.000      0.978 1.000 0.000
#> SRR2050434     1   0.416      0.889 0.916 0.084
#> SRR2050433     2   0.767      0.707 0.224 0.776
#> SRR2050432     1   0.000      0.978 1.000 0.000
#> SRR2050431     1   0.000      0.978 1.000 0.000
#> SRR2050430     1   0.000      0.978 1.000 0.000
#> SRR2050429     1   0.000      0.978 1.000 0.000

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>            class entropy silhouette    p1    p2    p3
#> SRR2050410     2  0.0000     0.9431 0.000 1.000 0.000
#> SRR2050427     1  0.0000     0.6383 1.000 0.000 0.000
#> SRR2050426     1  0.0000     0.6383 1.000 0.000 0.000
#> SRR2050425     2  0.0592     0.9359 0.000 0.988 0.012
#> SRR2050424     1  0.6286     0.6604 0.536 0.000 0.464
#> SRR2050423     1  0.5327     0.7160 0.728 0.000 0.272
#> SRR2050422     3  0.5497     0.5948 0.292 0.000 0.708
#> SRR2050421     1  0.0000     0.6383 1.000 0.000 0.000
#> SRR2050420     1  0.0000     0.6383 1.000 0.000 0.000
#> SRR2050419     2  0.0000     0.9431 0.000 1.000 0.000
#> SRR2050418     1  0.0000     0.6383 1.000 0.000 0.000
#> SRR2050417     1  0.0000     0.6383 1.000 0.000 0.000
#> SRR2050416     2  0.0592     0.9359 0.000 0.988 0.012
#> SRR2050415     1  0.6286     0.6604 0.536 0.000 0.464
#> SRR2050414     1  0.5327     0.7160 0.728 0.000 0.272
#> SRR2050413     3  0.5722     0.5978 0.292 0.004 0.704
#> SRR2050412     1  0.0000     0.6383 1.000 0.000 0.000
#> SRR2050411     1  0.0000     0.6383 1.000 0.000 0.000
#> SRR2050409     2  0.0000     0.9431 0.000 1.000 0.000
#> SRR2050408     1  0.0000     0.6383 1.000 0.000 0.000
#> SRR2050407     2  0.0000     0.9431 0.000 1.000 0.000
#> SRR2050406     1  0.6286     0.6604 0.536 0.000 0.464
#> SRR2050405     1  0.5327     0.7160 0.728 0.000 0.272
#> SRR2050404     2  0.0000     0.9431 0.000 1.000 0.000
#> SRR2050403     1  0.0000     0.6383 1.000 0.000 0.000
#> SRR2050402     2  0.8628     0.2213 0.116 0.544 0.340
#> SRR2050401     1  0.0000     0.6383 1.000 0.000 0.000
#> SRR2050400     1  0.0000     0.6383 1.000 0.000 0.000
#> SRR2050399     3  0.8322     0.5292 0.212 0.160 0.628
#> SRR2050398     1  0.0000     0.6383 1.000 0.000 0.000
#> SRR2050397     1  0.0000     0.6383 1.000 0.000 0.000
#> SRR2050396     1  0.6286     0.6604 0.536 0.000 0.464
#> SRR2050395     1  0.5327     0.7160 0.728 0.000 0.272
#> SRR2050394     2  0.1289     0.9184 0.000 0.968 0.032
#> SRR2050393     1  0.6286     0.6604 0.536 0.000 0.464
#> SRR2050392     1  0.5327     0.7160 0.728 0.000 0.272
#> SRR2050465     2  0.0000     0.9431 0.000 1.000 0.000
#> SRR2050464     1  0.6286     0.6604 0.536 0.000 0.464
#> SRR2050463     1  0.5327     0.7160 0.728 0.000 0.272
#> SRR2050462     2  0.0000     0.9431 0.000 1.000 0.000
#> SRR2050461     1  0.6286     0.6604 0.536 0.000 0.464
#> SRR2050460     1  0.5327     0.7160 0.728 0.000 0.272
#> SRR2050459     2  0.0000     0.9431 0.000 1.000 0.000
#> SRR2050458     1  0.6286     0.6604 0.536 0.000 0.464
#> SRR2050457     1  0.5327     0.7160 0.728 0.000 0.272
#> SRR2050456     2  0.0000     0.9431 0.000 1.000 0.000
#> SRR2050455     1  0.6286     0.6604 0.536 0.000 0.464
#> SRR2050454     1  0.5327     0.7160 0.728 0.000 0.272
#> SRR2050453     2  0.0000     0.9431 0.000 1.000 0.000
#> SRR2050452     1  0.6286     0.6604 0.536 0.000 0.464
#> SRR2050451     1  0.5327     0.7160 0.728 0.000 0.272
#> SRR2050450     2  0.0000     0.9431 0.000 1.000 0.000
#> SRR2050449     1  0.6286     0.6604 0.536 0.000 0.464
#> SRR2050448     1  0.5327     0.7160 0.728 0.000 0.272
#> SRR2050447     1  0.6286     0.6604 0.536 0.000 0.464
#> SRR2050446     1  0.5327     0.7160 0.728 0.000 0.272
#> SRR2050445     2  0.0000     0.9431 0.000 1.000 0.000
#> SRR2050444     1  0.6286     0.6604 0.536 0.000 0.464
#> SRR2050443     1  0.5327     0.7160 0.728 0.000 0.272
#> SRR2050442     3  0.8283     0.0772 0.084 0.380 0.536
#> SRR2050441     1  0.6286     0.6604 0.536 0.000 0.464
#> SRR2050440     1  0.6225     0.4763 0.568 0.000 0.432
#> SRR2050439     3  0.8283     0.0772 0.084 0.380 0.536
#> SRR2050438     1  0.6286     0.6604 0.536 0.000 0.464
#> SRR2050437     1  0.6225     0.4763 0.568 0.000 0.432
#> SRR2050436     3  0.5810     0.2482 0.336 0.000 0.664
#> SRR2050435     1  0.6286     0.6604 0.536 0.000 0.464
#> SRR2050434     3  0.6235    -0.1445 0.436 0.000 0.564
#> SRR2050433     2  0.6075     0.5319 0.008 0.676 0.316
#> SRR2050432     1  0.0000     0.6383 1.000 0.000 0.000
#> SRR2050431     1  0.0000     0.6383 1.000 0.000 0.000
#> SRR2050430     1  0.0000     0.6383 1.000 0.000 0.000
#> SRR2050429     1  0.0000     0.6383 1.000 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> SRR2050410     2  0.0000     0.9337 0.000 1.000 0.000 0.000
#> SRR2050427     1  0.0000     1.0000 1.000 0.000 0.000 0.000
#> SRR2050426     1  0.0000     1.0000 1.000 0.000 0.000 0.000
#> SRR2050425     2  0.0469     0.9251 0.000 0.988 0.000 0.012
#> SRR2050424     3  0.4304     0.7914 0.000 0.000 0.716 0.284
#> SRR2050423     3  0.0000     0.7661 0.000 0.000 1.000 0.000
#> SRR2050422     4  0.4748     0.6979 0.016 0.000 0.268 0.716
#> SRR2050421     1  0.0000     1.0000 1.000 0.000 0.000 0.000
#> SRR2050420     1  0.0000     1.0000 1.000 0.000 0.000 0.000
#> SRR2050419     2  0.0000     0.9337 0.000 1.000 0.000 0.000
#> SRR2050418     1  0.0000     1.0000 1.000 0.000 0.000 0.000
#> SRR2050417     1  0.0000     1.0000 1.000 0.000 0.000 0.000
#> SRR2050416     2  0.0469     0.9251 0.000 0.988 0.000 0.012
#> SRR2050415     3  0.4304     0.7914 0.000 0.000 0.716 0.284
#> SRR2050414     3  0.0000     0.7661 0.000 0.000 1.000 0.000
#> SRR2050413     4  0.4898     0.7024 0.016 0.004 0.264 0.716
#> SRR2050412     1  0.0000     1.0000 1.000 0.000 0.000 0.000
#> SRR2050411     1  0.0000     1.0000 1.000 0.000 0.000 0.000
#> SRR2050409     2  0.0000     0.9337 0.000 1.000 0.000 0.000
#> SRR2050408     1  0.0000     1.0000 1.000 0.000 0.000 0.000
#> SRR2050407     2  0.0000     0.9337 0.000 1.000 0.000 0.000
#> SRR2050406     3  0.4304     0.7914 0.000 0.000 0.716 0.284
#> SRR2050405     3  0.0000     0.7661 0.000 0.000 1.000 0.000
#> SRR2050404     2  0.0000     0.9337 0.000 1.000 0.000 0.000
#> SRR2050403     1  0.0000     1.0000 1.000 0.000 0.000 0.000
#> SRR2050402     2  0.5968    -0.0860 0.016 0.544 0.016 0.424
#> SRR2050401     1  0.0000     1.0000 1.000 0.000 0.000 0.000
#> SRR2050400     1  0.0000     1.0000 1.000 0.000 0.000 0.000
#> SRR2050399     4  0.6669     0.6996 0.016 0.160 0.160 0.664
#> SRR2050398     1  0.0000     1.0000 1.000 0.000 0.000 0.000
#> SRR2050397     1  0.0000     1.0000 1.000 0.000 0.000 0.000
#> SRR2050396     3  0.4304     0.7914 0.000 0.000 0.716 0.284
#> SRR2050395     3  0.0000     0.7661 0.000 0.000 1.000 0.000
#> SRR2050394     2  0.1022     0.9039 0.000 0.968 0.000 0.032
#> SRR2050393     3  0.4304     0.7914 0.000 0.000 0.716 0.284
#> SRR2050392     3  0.0000     0.7661 0.000 0.000 1.000 0.000
#> SRR2050465     2  0.0000     0.9337 0.000 1.000 0.000 0.000
#> SRR2050464     3  0.4304     0.7914 0.000 0.000 0.716 0.284
#> SRR2050463     3  0.0000     0.7661 0.000 0.000 1.000 0.000
#> SRR2050462     2  0.0000     0.9337 0.000 1.000 0.000 0.000
#> SRR2050461     3  0.4304     0.7914 0.000 0.000 0.716 0.284
#> SRR2050460     3  0.0000     0.7661 0.000 0.000 1.000 0.000
#> SRR2050459     2  0.0000     0.9337 0.000 1.000 0.000 0.000
#> SRR2050458     3  0.4304     0.7914 0.000 0.000 0.716 0.284
#> SRR2050457     3  0.0000     0.7661 0.000 0.000 1.000 0.000
#> SRR2050456     2  0.0000     0.9337 0.000 1.000 0.000 0.000
#> SRR2050455     3  0.4304     0.7914 0.000 0.000 0.716 0.284
#> SRR2050454     3  0.0000     0.7661 0.000 0.000 1.000 0.000
#> SRR2050453     2  0.0000     0.9337 0.000 1.000 0.000 0.000
#> SRR2050452     3  0.4304     0.7914 0.000 0.000 0.716 0.284
#> SRR2050451     3  0.0000     0.7661 0.000 0.000 1.000 0.000
#> SRR2050450     2  0.0000     0.9337 0.000 1.000 0.000 0.000
#> SRR2050449     3  0.4304     0.7914 0.000 0.000 0.716 0.284
#> SRR2050448     3  0.0000     0.7661 0.000 0.000 1.000 0.000
#> SRR2050447     3  0.4304     0.7914 0.000 0.000 0.716 0.284
#> SRR2050446     3  0.0000     0.7661 0.000 0.000 1.000 0.000
#> SRR2050445     2  0.0000     0.9337 0.000 1.000 0.000 0.000
#> SRR2050444     3  0.4304     0.7914 0.000 0.000 0.716 0.284
#> SRR2050443     3  0.0000     0.7661 0.000 0.000 1.000 0.000
#> SRR2050442     4  0.4790     0.4760 0.000 0.380 0.000 0.620
#> SRR2050441     3  0.4304     0.7914 0.000 0.000 0.716 0.284
#> SRR2050440     3  0.4164     0.4065 0.000 0.000 0.736 0.264
#> SRR2050439     4  0.4790     0.4760 0.000 0.380 0.000 0.620
#> SRR2050438     3  0.4304     0.7914 0.000 0.000 0.716 0.284
#> SRR2050437     3  0.4164     0.4065 0.000 0.000 0.736 0.264
#> SRR2050436     3  0.5000    -0.3042 0.000 0.000 0.504 0.496
#> SRR2050435     3  0.4304     0.7914 0.000 0.000 0.716 0.284
#> SRR2050434     3  0.4843     0.0313 0.000 0.000 0.604 0.396
#> SRR2050433     2  0.4543     0.3662 0.000 0.676 0.000 0.324
#> SRR2050432     1  0.0000     1.0000 1.000 0.000 0.000 0.000
#> SRR2050431     1  0.0000     1.0000 1.000 0.000 0.000 0.000
#> SRR2050430     1  0.0000     1.0000 1.000 0.000 0.000 0.000
#> SRR2050429     1  0.0000     1.0000 1.000 0.000 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>            class entropy silhouette    p1    p2    p3    p4    p5
#> SRR2050410     2  0.0000     0.9314 0.000 1.000 0.000 0.000 0.000
#> SRR2050427     1  0.2561     0.9211 0.856 0.000 0.000 0.144 0.000
#> SRR2050426     1  0.0000     0.9377 1.000 0.000 0.000 0.000 0.000
#> SRR2050425     2  0.0510     0.9240 0.000 0.984 0.000 0.000 0.016
#> SRR2050424     3  0.0000     1.0000 0.000 0.000 1.000 0.000 0.000
#> SRR2050423     4  0.4088     0.9022 0.000 0.000 0.368 0.632 0.000
#> SRR2050422     5  0.0162     0.6665 0.000 0.000 0.000 0.004 0.996
#> SRR2050421     1  0.2561     0.9211 0.856 0.000 0.000 0.144 0.000
#> SRR2050420     1  0.0000     0.9377 1.000 0.000 0.000 0.000 0.000
#> SRR2050419     2  0.0000     0.9314 0.000 1.000 0.000 0.000 0.000
#> SRR2050418     1  0.2561     0.9211 0.856 0.000 0.000 0.144 0.000
#> SRR2050417     1  0.0000     0.9377 1.000 0.000 0.000 0.000 0.000
#> SRR2050416     2  0.0510     0.9240 0.000 0.984 0.000 0.000 0.016
#> SRR2050415     3  0.0000     1.0000 0.000 0.000 1.000 0.000 0.000
#> SRR2050414     4  0.4088     0.9022 0.000 0.000 0.368 0.632 0.000
#> SRR2050413     5  0.0000     0.6660 0.000 0.000 0.000 0.000 1.000
#> SRR2050412     1  0.2561     0.9211 0.856 0.000 0.000 0.144 0.000
#> SRR2050411     1  0.0000     0.9377 1.000 0.000 0.000 0.000 0.000
#> SRR2050409     2  0.0000     0.9314 0.000 1.000 0.000 0.000 0.000
#> SRR2050408     1  0.0000     0.9377 1.000 0.000 0.000 0.000 0.000
#> SRR2050407     2  0.0000     0.9314 0.000 1.000 0.000 0.000 0.000
#> SRR2050406     3  0.0000     1.0000 0.000 0.000 1.000 0.000 0.000
#> SRR2050405     4  0.4088     0.9022 0.000 0.000 0.368 0.632 0.000
#> SRR2050404     2  0.0162     0.9312 0.000 0.996 0.000 0.000 0.004
#> SRR2050403     1  0.0000     0.9377 1.000 0.000 0.000 0.000 0.000
#> SRR2050402     2  0.4965     0.0518 0.000 0.520 0.000 0.028 0.452
#> SRR2050401     1  0.2561     0.9211 0.856 0.000 0.000 0.144 0.000
#> SRR2050400     1  0.0000     0.9377 1.000 0.000 0.000 0.000 0.000
#> SRR2050399     5  0.2690     0.6030 0.000 0.156 0.000 0.000 0.844
#> SRR2050398     1  0.2561     0.9211 0.856 0.000 0.000 0.144 0.000
#> SRR2050397     1  0.0000     0.9377 1.000 0.000 0.000 0.000 0.000
#> SRR2050396     3  0.0000     1.0000 0.000 0.000 1.000 0.000 0.000
#> SRR2050395     4  0.4088     0.9022 0.000 0.000 0.368 0.632 0.000
#> SRR2050394     2  0.1809     0.8755 0.000 0.928 0.000 0.060 0.012
#> SRR2050393     3  0.0000     1.0000 0.000 0.000 1.000 0.000 0.000
#> SRR2050392     4  0.4088     0.9022 0.000 0.000 0.368 0.632 0.000
#> SRR2050465     2  0.0162     0.9312 0.000 0.996 0.000 0.000 0.004
#> SRR2050464     3  0.0000     1.0000 0.000 0.000 1.000 0.000 0.000
#> SRR2050463     4  0.4088     0.9022 0.000 0.000 0.368 0.632 0.000
#> SRR2050462     2  0.0162     0.9312 0.000 0.996 0.000 0.000 0.004
#> SRR2050461     3  0.0000     1.0000 0.000 0.000 1.000 0.000 0.000
#> SRR2050460     4  0.4088     0.9022 0.000 0.000 0.368 0.632 0.000
#> SRR2050459     2  0.0000     0.9314 0.000 1.000 0.000 0.000 0.000
#> SRR2050458     3  0.0000     1.0000 0.000 0.000 1.000 0.000 0.000
#> SRR2050457     4  0.4088     0.9022 0.000 0.000 0.368 0.632 0.000
#> SRR2050456     2  0.0000     0.9314 0.000 1.000 0.000 0.000 0.000
#> SRR2050455     3  0.0000     1.0000 0.000 0.000 1.000 0.000 0.000
#> SRR2050454     4  0.4088     0.9022 0.000 0.000 0.368 0.632 0.000
#> SRR2050453     2  0.0162     0.9312 0.000 0.996 0.000 0.000 0.004
#> SRR2050452     3  0.0000     1.0000 0.000 0.000 1.000 0.000 0.000
#> SRR2050451     4  0.4088     0.9022 0.000 0.000 0.368 0.632 0.000
#> SRR2050450     2  0.0162     0.9312 0.000 0.996 0.000 0.000 0.004
#> SRR2050449     3  0.0000     1.0000 0.000 0.000 1.000 0.000 0.000
#> SRR2050448     4  0.4088     0.9022 0.000 0.000 0.368 0.632 0.000
#> SRR2050447     3  0.0000     1.0000 0.000 0.000 1.000 0.000 0.000
#> SRR2050446     4  0.4088     0.9022 0.000 0.000 0.368 0.632 0.000
#> SRR2050445     2  0.0000     0.9314 0.000 1.000 0.000 0.000 0.000
#> SRR2050444     3  0.0000     1.0000 0.000 0.000 1.000 0.000 0.000
#> SRR2050443     4  0.4088     0.9022 0.000 0.000 0.368 0.632 0.000
#> SRR2050442     5  0.4470     0.3105 0.000 0.372 0.000 0.012 0.616
#> SRR2050441     3  0.0000     1.0000 0.000 0.000 1.000 0.000 0.000
#> SRR2050440     4  0.6652     0.1106 0.000 0.000 0.232 0.420 0.348
#> SRR2050439     5  0.4251     0.3139 0.000 0.372 0.000 0.004 0.624
#> SRR2050438     3  0.0000     1.0000 0.000 0.000 1.000 0.000 0.000
#> SRR2050437     4  0.6652     0.1106 0.000 0.000 0.232 0.420 0.348
#> SRR2050436     5  0.4227     0.3983 0.000 0.000 0.000 0.420 0.580
#> SRR2050435     3  0.0000     1.0000 0.000 0.000 1.000 0.000 0.000
#> SRR2050434     5  0.5884     0.1545 0.000 0.000 0.100 0.420 0.480
#> SRR2050433     2  0.4620     0.4176 0.000 0.652 0.000 0.028 0.320
#> SRR2050432     1  0.2561     0.9211 0.856 0.000 0.000 0.144 0.000
#> SRR2050431     1  0.0000     0.9377 1.000 0.000 0.000 0.000 0.000
#> SRR2050430     1  0.2561     0.9211 0.856 0.000 0.000 0.144 0.000
#> SRR2050429     1  0.0000     0.9377 1.000 0.000 0.000 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>            class entropy silhouette    p1    p2    p3    p4    p5    p6
#> SRR2050410     2  0.0000      0.896 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2050427     1  0.5236      0.771 0.660 0.000 0.000 0.220 0.080 0.040
#> SRR2050426     1  0.0000      0.804 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2050425     2  0.2219      0.878 0.000 0.864 0.000 0.000 0.136 0.000
#> SRR2050424     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2050423     4  0.2996      0.998 0.000 0.000 0.228 0.772 0.000 0.000
#> SRR2050422     5  0.3620      0.221 0.000 0.000 0.000 0.000 0.648 0.352
#> SRR2050421     1  0.5236      0.771 0.660 0.000 0.000 0.220 0.080 0.040
#> SRR2050420     1  0.0000      0.804 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2050419     2  0.0000      0.896 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2050418     1  0.5236      0.771 0.660 0.000 0.000 0.220 0.080 0.040
#> SRR2050417     1  0.2003      0.762 0.884 0.000 0.000 0.000 0.116 0.000
#> SRR2050416     2  0.2219      0.878 0.000 0.864 0.000 0.000 0.136 0.000
#> SRR2050415     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2050414     4  0.2996      0.998 0.000 0.000 0.228 0.772 0.000 0.000
#> SRR2050413     5  0.3592      0.237 0.000 0.000 0.000 0.000 0.656 0.344
#> SRR2050412     1  0.5236      0.771 0.660 0.000 0.000 0.220 0.080 0.040
#> SRR2050411     1  0.0547      0.800 0.980 0.000 0.000 0.000 0.020 0.000
#> SRR2050409     2  0.0000      0.896 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2050408     1  0.2003      0.762 0.884 0.000 0.000 0.000 0.116 0.000
#> SRR2050407     2  0.0000      0.896 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2050406     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2050405     4  0.2996      0.998 0.000 0.000 0.228 0.772 0.000 0.000
#> SRR2050404     2  0.2092      0.886 0.000 0.876 0.000 0.000 0.124 0.000
#> SRR2050403     1  0.2003      0.762 0.884 0.000 0.000 0.000 0.116 0.000
#> SRR2050402     5  0.5208      0.513 0.000 0.296 0.000 0.004 0.592 0.108
#> SRR2050401     1  0.5236      0.771 0.660 0.000 0.000 0.220 0.080 0.040
#> SRR2050400     1  0.0000      0.804 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2050399     5  0.4420      0.494 0.000 0.088 0.000 0.004 0.716 0.192
#> SRR2050398     1  0.5236      0.771 0.660 0.000 0.000 0.220 0.080 0.040
#> SRR2050397     1  0.0547      0.800 0.980 0.000 0.000 0.000 0.020 0.000
#> SRR2050396     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2050395     4  0.2996      0.998 0.000 0.000 0.228 0.772 0.000 0.000
#> SRR2050394     2  0.3393      0.644 0.000 0.784 0.000 0.004 0.020 0.192
#> SRR2050393     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2050392     4  0.2969      0.995 0.000 0.000 0.224 0.776 0.000 0.000
#> SRR2050465     2  0.2092      0.886 0.000 0.876 0.000 0.000 0.124 0.000
#> SRR2050464     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2050463     4  0.2996      0.998 0.000 0.000 0.228 0.772 0.000 0.000
#> SRR2050462     2  0.2092      0.886 0.000 0.876 0.000 0.000 0.124 0.000
#> SRR2050461     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2050460     4  0.2996      0.998 0.000 0.000 0.228 0.772 0.000 0.000
#> SRR2050459     2  0.0000      0.896 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2050458     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2050457     4  0.2969      0.995 0.000 0.000 0.224 0.776 0.000 0.000
#> SRR2050456     2  0.0000      0.896 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2050455     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2050454     4  0.2969      0.995 0.000 0.000 0.224 0.776 0.000 0.000
#> SRR2050453     2  0.2092      0.886 0.000 0.876 0.000 0.000 0.124 0.000
#> SRR2050452     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2050451     4  0.2996      0.998 0.000 0.000 0.228 0.772 0.000 0.000
#> SRR2050450     2  0.2092      0.886 0.000 0.876 0.000 0.000 0.124 0.000
#> SRR2050449     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2050448     4  0.2996      0.998 0.000 0.000 0.228 0.772 0.000 0.000
#> SRR2050447     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2050446     4  0.2996      0.998 0.000 0.000 0.228 0.772 0.000 0.000
#> SRR2050445     2  0.0000      0.896 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2050444     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2050443     4  0.2969      0.995 0.000 0.000 0.224 0.776 0.000 0.000
#> SRR2050442     5  0.3245      0.638 0.000 0.228 0.000 0.000 0.764 0.008
#> SRR2050441     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2050440     6  0.3023      0.747 0.000 0.000 0.232 0.000 0.000 0.768
#> SRR2050439     5  0.2996      0.639 0.000 0.228 0.000 0.000 0.772 0.000
#> SRR2050438     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2050437     6  0.3023      0.747 0.000 0.000 0.232 0.000 0.000 0.768
#> SRR2050436     6  0.3023      0.473 0.000 0.000 0.000 0.000 0.232 0.768
#> SRR2050435     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2050434     6  0.3908      0.700 0.000 0.000 0.100 0.000 0.132 0.768
#> SRR2050433     5  0.5486      0.191 0.000 0.428 0.000 0.004 0.460 0.108
#> SRR2050432     1  0.5236      0.771 0.660 0.000 0.000 0.220 0.080 0.040
#> SRR2050431     1  0.1075      0.791 0.952 0.000 0.000 0.000 0.048 0.000
#> SRR2050430     1  0.5236      0.771 0.660 0.000 0.000 0.220 0.080 0.040
#> SRR2050429     1  0.2003      0.762 0.884 0.000 0.000 0.000 0.116 0.000

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

consensus_heatmap(res, k = 2)

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

consensus_heatmap(res, k = 3)

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

consensus_heatmap(res, k = 4)

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

consensus_heatmap(res, k = 5)

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

consensus_heatmap(res, k = 6)

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

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

membership_heatmap(res, k = 2)

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

membership_heatmap(res, k = 3)

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

membership_heatmap(res, k = 4)

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

membership_heatmap(res, k = 5)

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

membership_heatmap(res, k = 6)

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

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

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

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

get_signatures(res, k = 3)

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

get_signatures(res, k = 4)

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

get_signatures(res, k = 5)

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

get_signatures(res, k = 6)

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

Signature heatmaps where rows are not scaled:

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

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

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

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

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

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

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

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

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

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

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk CV-hclust-signature_compare

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

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

An example of the output of tb is:

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

The columns in tb are:

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

UMAP plot which shows how samples are separated.

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

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

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

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

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

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

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

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

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

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

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk CV-hclust-collect-classes

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


CV:kmeans*

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

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

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

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

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

collect_plots(res)

plot of chunk CV-kmeans-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.766           0.946       0.944         0.4192 0.584   0.584
#> 3 3 0.637           0.784       0.857         0.5028 0.737   0.556
#> 4 4 0.676           0.679       0.799         0.1589 0.960   0.884
#> 5 5 0.792           0.873       0.851         0.0678 0.865   0.589
#> 6 6 0.903           0.713       0.851         0.0538 0.977   0.887

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

suggest_best_k(res)
#> [1] 6

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

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

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>            class entropy silhouette    p1    p2
#> SRR2050410     2   0.000      0.999 0.000 1.000
#> SRR2050427     1   0.224      0.937 0.964 0.036
#> SRR2050426     1   0.224      0.937 0.964 0.036
#> SRR2050425     2   0.000      0.999 0.000 1.000
#> SRR2050424     1   0.358      0.944 0.932 0.068
#> SRR2050423     1   0.482      0.945 0.896 0.104
#> SRR2050422     1   0.963      0.530 0.612 0.388
#> SRR2050421     1   0.224      0.937 0.964 0.036
#> SRR2050420     1   0.224      0.937 0.964 0.036
#> SRR2050419     2   0.000      0.999 0.000 1.000
#> SRR2050418     1   0.224      0.937 0.964 0.036
#> SRR2050417     1   0.224      0.937 0.964 0.036
#> SRR2050416     2   0.000      0.999 0.000 1.000
#> SRR2050415     1   0.358      0.944 0.932 0.068
#> SRR2050414     1   0.482      0.945 0.896 0.104
#> SRR2050413     2   0.141      0.977 0.020 0.980
#> SRR2050412     1   0.224      0.937 0.964 0.036
#> SRR2050411     1   0.224      0.937 0.964 0.036
#> SRR2050409     2   0.000      0.999 0.000 1.000
#> SRR2050408     1   0.224      0.937 0.964 0.036
#> SRR2050407     2   0.000      0.999 0.000 1.000
#> SRR2050406     1   0.358      0.944 0.932 0.068
#> SRR2050405     1   0.482      0.945 0.896 0.104
#> SRR2050404     2   0.000      0.999 0.000 1.000
#> SRR2050403     1   0.224      0.937 0.964 0.036
#> SRR2050402     2   0.000      0.999 0.000 1.000
#> SRR2050401     1   0.224      0.937 0.964 0.036
#> SRR2050400     1   0.224      0.937 0.964 0.036
#> SRR2050399     2   0.000      0.999 0.000 1.000
#> SRR2050398     1   0.224      0.937 0.964 0.036
#> SRR2050397     1   0.224      0.937 0.964 0.036
#> SRR2050396     1   0.358      0.944 0.932 0.068
#> SRR2050395     1   0.482      0.945 0.896 0.104
#> SRR2050394     2   0.000      0.999 0.000 1.000
#> SRR2050393     1   0.358      0.944 0.932 0.068
#> SRR2050392     1   0.482      0.945 0.896 0.104
#> SRR2050465     2   0.000      0.999 0.000 1.000
#> SRR2050464     1   0.358      0.944 0.932 0.068
#> SRR2050463     1   0.482      0.945 0.896 0.104
#> SRR2050462     2   0.000      0.999 0.000 1.000
#> SRR2050461     1   0.358      0.944 0.932 0.068
#> SRR2050460     1   0.482      0.945 0.896 0.104
#> SRR2050459     2   0.000      0.999 0.000 1.000
#> SRR2050458     1   0.358      0.944 0.932 0.068
#> SRR2050457     1   0.482      0.945 0.896 0.104
#> SRR2050456     2   0.000      0.999 0.000 1.000
#> SRR2050455     1   0.358      0.944 0.932 0.068
#> SRR2050454     1   0.482      0.945 0.896 0.104
#> SRR2050453     2   0.000      0.999 0.000 1.000
#> SRR2050452     1   0.358      0.944 0.932 0.068
#> SRR2050451     1   0.482      0.945 0.896 0.104
#> SRR2050450     2   0.000      0.999 0.000 1.000
#> SRR2050449     1   0.358      0.944 0.932 0.068
#> SRR2050448     1   0.482      0.945 0.896 0.104
#> SRR2050447     1   0.358      0.944 0.932 0.068
#> SRR2050446     1   0.482      0.945 0.896 0.104
#> SRR2050445     2   0.000      0.999 0.000 1.000
#> SRR2050444     1   0.358      0.944 0.932 0.068
#> SRR2050443     1   0.482      0.945 0.896 0.104
#> SRR2050442     2   0.000      0.999 0.000 1.000
#> SRR2050441     1   0.358      0.944 0.932 0.068
#> SRR2050440     1   0.373      0.945 0.928 0.072
#> SRR2050439     2   0.000      0.999 0.000 1.000
#> SRR2050438     1   0.242      0.941 0.960 0.040
#> SRR2050437     1   0.242      0.942 0.960 0.040
#> SRR2050436     1   0.975      0.482 0.592 0.408
#> SRR2050435     1   0.358      0.944 0.932 0.068
#> SRR2050434     1   0.518      0.939 0.884 0.116
#> SRR2050433     2   0.000      0.999 0.000 1.000
#> SRR2050432     1   0.224      0.937 0.964 0.036
#> SRR2050431     1   0.224      0.937 0.964 0.036
#> SRR2050430     1   0.224      0.937 0.964 0.036
#> SRR2050429     1   0.224      0.937 0.964 0.036

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>            class entropy silhouette    p1    p2    p3
#> SRR2050410     2   0.000      0.968 0.000 1.000 0.000
#> SRR2050427     1   0.400      0.851 0.840 0.000 0.160
#> SRR2050426     1   0.362      0.857 0.864 0.000 0.136
#> SRR2050425     2   0.000      0.968 0.000 1.000 0.000
#> SRR2050424     3   0.000      0.757 0.000 0.000 1.000
#> SRR2050423     3   0.586      0.646 0.344 0.000 0.656
#> SRR2050422     1   0.546      0.419 0.712 0.288 0.000
#> SRR2050421     1   0.400      0.851 0.840 0.000 0.160
#> SRR2050420     1   0.362      0.857 0.864 0.000 0.136
#> SRR2050419     2   0.000      0.968 0.000 1.000 0.000
#> SRR2050418     1   0.394      0.852 0.844 0.000 0.156
#> SRR2050417     1   0.362      0.857 0.864 0.000 0.136
#> SRR2050416     2   0.288      0.934 0.096 0.904 0.000
#> SRR2050415     3   0.000      0.757 0.000 0.000 1.000
#> SRR2050414     3   0.586      0.646 0.344 0.000 0.656
#> SRR2050413     1   0.615      0.129 0.592 0.408 0.000
#> SRR2050412     1   0.400      0.851 0.840 0.000 0.160
#> SRR2050411     1   0.362      0.857 0.864 0.000 0.136
#> SRR2050409     2   0.000      0.968 0.000 1.000 0.000
#> SRR2050408     1   0.362      0.857 0.864 0.000 0.136
#> SRR2050407     2   0.000      0.968 0.000 1.000 0.000
#> SRR2050406     3   0.000      0.757 0.000 0.000 1.000
#> SRR2050405     3   0.586      0.646 0.344 0.000 0.656
#> SRR2050404     2   0.000      0.968 0.000 1.000 0.000
#> SRR2050403     1   0.362      0.857 0.864 0.000 0.136
#> SRR2050402     2   0.355      0.918 0.132 0.868 0.000
#> SRR2050401     1   0.400      0.851 0.840 0.000 0.160
#> SRR2050400     1   0.362      0.857 0.864 0.000 0.136
#> SRR2050399     2   0.355      0.918 0.132 0.868 0.000
#> SRR2050398     1   0.400      0.851 0.840 0.000 0.160
#> SRR2050397     1   0.362      0.857 0.864 0.000 0.136
#> SRR2050396     3   0.000      0.757 0.000 0.000 1.000
#> SRR2050395     3   0.586      0.646 0.344 0.000 0.656
#> SRR2050394     2   0.141      0.957 0.036 0.964 0.000
#> SRR2050393     3   0.000      0.757 0.000 0.000 1.000
#> SRR2050392     3   0.680      0.615 0.344 0.024 0.632
#> SRR2050465     2   0.000      0.968 0.000 1.000 0.000
#> SRR2050464     3   0.000      0.757 0.000 0.000 1.000
#> SRR2050463     3   0.586      0.646 0.344 0.000 0.656
#> SRR2050462     2   0.000      0.968 0.000 1.000 0.000
#> SRR2050461     3   0.000      0.757 0.000 0.000 1.000
#> SRR2050460     3   0.588      0.641 0.348 0.000 0.652
#> SRR2050459     2   0.000      0.968 0.000 1.000 0.000
#> SRR2050458     3   0.000      0.757 0.000 0.000 1.000
#> SRR2050457     3   0.586      0.646 0.344 0.000 0.656
#> SRR2050456     2   0.000      0.968 0.000 1.000 0.000
#> SRR2050455     3   0.000      0.757 0.000 0.000 1.000
#> SRR2050454     3   0.670      0.614 0.348 0.020 0.632
#> SRR2050453     2   0.000      0.968 0.000 1.000 0.000
#> SRR2050452     3   0.000      0.757 0.000 0.000 1.000
#> SRR2050451     3   0.586      0.646 0.344 0.000 0.656
#> SRR2050450     2   0.000      0.968 0.000 1.000 0.000
#> SRR2050449     3   0.000      0.757 0.000 0.000 1.000
#> SRR2050448     3   0.586      0.646 0.344 0.000 0.656
#> SRR2050447     3   0.000      0.757 0.000 0.000 1.000
#> SRR2050446     3   0.588      0.641 0.348 0.000 0.652
#> SRR2050445     2   0.000      0.968 0.000 1.000 0.000
#> SRR2050444     3   0.000      0.757 0.000 0.000 1.000
#> SRR2050443     3   0.586      0.646 0.344 0.000 0.656
#> SRR2050442     2   0.355      0.918 0.132 0.868 0.000
#> SRR2050441     3   0.000      0.757 0.000 0.000 1.000
#> SRR2050440     3   0.588      0.641 0.348 0.000 0.652
#> SRR2050439     2   0.355      0.918 0.132 0.868 0.000
#> SRR2050438     3   0.000      0.757 0.000 0.000 1.000
#> SRR2050437     3   0.588      0.641 0.348 0.000 0.652
#> SRR2050436     1   0.784      0.174 0.560 0.380 0.060
#> SRR2050435     3   0.000      0.757 0.000 0.000 1.000
#> SRR2050434     1   0.835      0.330 0.628 0.184 0.188
#> SRR2050433     2   0.280      0.938 0.092 0.908 0.000
#> SRR2050432     1   0.400      0.851 0.840 0.000 0.160
#> SRR2050431     1   0.362      0.857 0.864 0.000 0.136
#> SRR2050430     1   0.418      0.842 0.828 0.000 0.172
#> SRR2050429     1   0.362      0.857 0.864 0.000 0.136

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> SRR2050410     2  0.0000      0.842 0.000 1.000 0.000 0.000
#> SRR2050427     1  0.2376      0.940 0.916 0.000 0.016 0.068
#> SRR2050426     1  0.0707      0.949 0.980 0.000 0.020 0.000
#> SRR2050425     2  0.0336      0.841 0.008 0.992 0.000 0.000
#> SRR2050424     3  0.5292      0.599 0.008 0.000 0.512 0.480
#> SRR2050423     3  0.2868      0.460 0.136 0.000 0.864 0.000
#> SRR2050422     4  0.9296      0.895 0.176 0.140 0.248 0.436
#> SRR2050421     1  0.2376      0.940 0.916 0.000 0.016 0.068
#> SRR2050420     1  0.0707      0.949 0.980 0.000 0.020 0.000
#> SRR2050419     2  0.0000      0.842 0.000 1.000 0.000 0.000
#> SRR2050418     1  0.2255      0.940 0.920 0.000 0.012 0.068
#> SRR2050417     1  0.1297      0.948 0.964 0.000 0.020 0.016
#> SRR2050416     2  0.4697      0.569 0.008 0.696 0.000 0.296
#> SRR2050415     3  0.5292      0.599 0.008 0.000 0.512 0.480
#> SRR2050414     3  0.2868      0.460 0.136 0.000 0.864 0.000
#> SRR2050413     4  0.9340      0.887 0.176 0.152 0.236 0.436
#> SRR2050412     1  0.2376      0.940 0.916 0.000 0.016 0.068
#> SRR2050411     1  0.1297      0.948 0.964 0.000 0.020 0.016
#> SRR2050409     2  0.0000      0.842 0.000 1.000 0.000 0.000
#> SRR2050408     1  0.1297      0.948 0.964 0.000 0.020 0.016
#> SRR2050407     2  0.0000      0.842 0.000 1.000 0.000 0.000
#> SRR2050406     3  0.5292      0.599 0.008 0.000 0.512 0.480
#> SRR2050405     3  0.2868      0.460 0.136 0.000 0.864 0.000
#> SRR2050404     2  0.0336      0.841 0.008 0.992 0.000 0.000
#> SRR2050403     1  0.1297      0.948 0.964 0.000 0.020 0.016
#> SRR2050402     2  0.4907      0.390 0.000 0.580 0.000 0.420
#> SRR2050401     1  0.2376      0.940 0.916 0.000 0.016 0.068
#> SRR2050400     1  0.0707      0.949 0.980 0.000 0.020 0.000
#> SRR2050399     2  0.4941      0.356 0.000 0.564 0.000 0.436
#> SRR2050398     1  0.2376      0.940 0.916 0.000 0.016 0.068
#> SRR2050397     1  0.1297      0.948 0.964 0.000 0.020 0.016
#> SRR2050396     3  0.5292      0.599 0.008 0.000 0.512 0.480
#> SRR2050395     3  0.2868      0.460 0.136 0.000 0.864 0.000
#> SRR2050394     2  0.2345      0.776 0.000 0.900 0.000 0.100
#> SRR2050393     3  0.5292      0.599 0.008 0.000 0.512 0.480
#> SRR2050392     3  0.3052      0.455 0.136 0.004 0.860 0.000
#> SRR2050465     2  0.0336      0.841 0.008 0.992 0.000 0.000
#> SRR2050464     3  0.5292      0.599 0.008 0.000 0.512 0.480
#> SRR2050463     3  0.2868      0.460 0.136 0.000 0.864 0.000
#> SRR2050462     2  0.0336      0.841 0.008 0.992 0.000 0.000
#> SRR2050461     3  0.5292      0.599 0.008 0.000 0.512 0.480
#> SRR2050460     3  0.2868      0.460 0.136 0.000 0.864 0.000
#> SRR2050459     2  0.0000      0.842 0.000 1.000 0.000 0.000
#> SRR2050458     3  0.5292      0.599 0.008 0.000 0.512 0.480
#> SRR2050457     3  0.2868      0.460 0.136 0.000 0.864 0.000
#> SRR2050456     2  0.0000      0.842 0.000 1.000 0.000 0.000
#> SRR2050455     3  0.5292      0.599 0.008 0.000 0.512 0.480
#> SRR2050454     3  0.3647      0.416 0.152 0.000 0.832 0.016
#> SRR2050453     2  0.0336      0.841 0.008 0.992 0.000 0.000
#> SRR2050452     3  0.5292      0.599 0.008 0.000 0.512 0.480
#> SRR2050451     3  0.2868      0.460 0.136 0.000 0.864 0.000
#> SRR2050450     2  0.0336      0.841 0.008 0.992 0.000 0.000
#> SRR2050449     3  0.5292      0.599 0.008 0.000 0.512 0.480
#> SRR2050448     3  0.2868      0.460 0.136 0.000 0.864 0.000
#> SRR2050447     3  0.5292      0.599 0.008 0.000 0.512 0.480
#> SRR2050446     3  0.2868      0.460 0.136 0.000 0.864 0.000
#> SRR2050445     2  0.0000      0.842 0.000 1.000 0.000 0.000
#> SRR2050444     3  0.5292      0.599 0.008 0.000 0.512 0.480
#> SRR2050443     3  0.2868      0.460 0.136 0.000 0.864 0.000
#> SRR2050442     2  0.4941      0.356 0.000 0.564 0.000 0.436
#> SRR2050441     3  0.5292      0.599 0.008 0.000 0.512 0.480
#> SRR2050440     3  0.3881      0.408 0.172 0.000 0.812 0.016
#> SRR2050439     2  0.4941      0.356 0.000 0.564 0.000 0.436
#> SRR2050438     3  0.5292      0.599 0.008 0.000 0.512 0.480
#> SRR2050437     3  0.3925      0.401 0.176 0.000 0.808 0.016
#> SRR2050436     4  0.8614      0.812 0.072 0.140 0.352 0.436
#> SRR2050435     3  0.5292      0.599 0.008 0.000 0.512 0.480
#> SRR2050434     3  0.7270     -0.724 0.072 0.028 0.464 0.436
#> SRR2050433     2  0.4250      0.612 0.000 0.724 0.000 0.276
#> SRR2050432     1  0.2376      0.940 0.916 0.000 0.016 0.068
#> SRR2050431     1  0.1297      0.948 0.964 0.000 0.020 0.016
#> SRR2050430     1  0.2635      0.932 0.904 0.000 0.020 0.076
#> SRR2050429     1  0.1297      0.948 0.964 0.000 0.020 0.016

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>            class entropy silhouette    p1    p2    p3    p4    p5
#> SRR2050410     2  0.0703      0.858 0.024 0.976 0.000 0.000 0.000
#> SRR2050427     1  0.2522      0.844 0.896 0.000 0.024 0.076 0.004
#> SRR2050426     1  0.6017      0.874 0.684 0.000 0.100 0.092 0.124
#> SRR2050425     2  0.2913      0.849 0.040 0.876 0.080 0.000 0.004
#> SRR2050424     3  0.3944      0.981 0.000 0.000 0.768 0.200 0.032
#> SRR2050423     4  0.0162      0.966 0.004 0.000 0.000 0.996 0.000
#> SRR2050422     5  0.3935      0.834 0.040 0.060 0.000 0.068 0.832
#> SRR2050421     1  0.2522      0.844 0.896 0.000 0.024 0.076 0.004
#> SRR2050420     1  0.6017      0.874 0.684 0.000 0.100 0.092 0.124
#> SRR2050419     2  0.0703      0.858 0.024 0.976 0.000 0.000 0.000
#> SRR2050418     1  0.2490      0.844 0.896 0.000 0.020 0.080 0.004
#> SRR2050417     1  0.6292      0.871 0.656 0.000 0.100 0.092 0.152
#> SRR2050416     2  0.6471      0.139 0.040 0.512 0.080 0.000 0.368
#> SRR2050415     3  0.3944      0.981 0.000 0.000 0.768 0.200 0.032
#> SRR2050414     4  0.0162      0.966 0.004 0.000 0.000 0.996 0.000
#> SRR2050413     5  0.4093      0.835 0.040 0.060 0.004 0.068 0.828
#> SRR2050412     1  0.2522      0.844 0.896 0.000 0.024 0.076 0.004
#> SRR2050411     1  0.6292      0.871 0.656 0.000 0.100 0.092 0.152
#> SRR2050409     2  0.0703      0.858 0.024 0.976 0.000 0.000 0.000
#> SRR2050408     1  0.6292      0.871 0.656 0.000 0.100 0.092 0.152
#> SRR2050407     2  0.0290      0.859 0.000 0.992 0.008 0.000 0.000
#> SRR2050406     3  0.3109      0.986 0.000 0.000 0.800 0.200 0.000
#> SRR2050405     4  0.0162      0.966 0.004 0.000 0.000 0.996 0.000
#> SRR2050404     2  0.2913      0.849 0.040 0.876 0.080 0.000 0.004
#> SRR2050403     1  0.6292      0.871 0.656 0.000 0.100 0.092 0.152
#> SRR2050402     5  0.4774      0.557 0.012 0.328 0.016 0.000 0.644
#> SRR2050401     1  0.2522      0.844 0.896 0.000 0.024 0.076 0.004
#> SRR2050400     1  0.6017      0.874 0.684 0.000 0.100 0.092 0.124
#> SRR2050399     5  0.3778      0.807 0.012 0.188 0.012 0.000 0.788
#> SRR2050398     1  0.2522      0.844 0.896 0.000 0.024 0.076 0.004
#> SRR2050397     1  0.6292      0.871 0.656 0.000 0.100 0.092 0.152
#> SRR2050396     3  0.3109      0.986 0.000 0.000 0.800 0.200 0.000
#> SRR2050395     4  0.0162      0.966 0.004 0.000 0.000 0.996 0.000
#> SRR2050394     2  0.3001      0.724 0.004 0.844 0.008 0.000 0.144
#> SRR2050393     3  0.3109      0.986 0.000 0.000 0.800 0.200 0.000
#> SRR2050392     4  0.0794      0.937 0.000 0.028 0.000 0.972 0.000
#> SRR2050465     2  0.2913      0.849 0.040 0.876 0.080 0.000 0.004
#> SRR2050464     3  0.3109      0.986 0.000 0.000 0.800 0.200 0.000
#> SRR2050463     4  0.0162      0.966 0.004 0.000 0.000 0.996 0.000
#> SRR2050462     2  0.2913      0.849 0.040 0.876 0.080 0.000 0.004
#> SRR2050461     3  0.3944      0.981 0.000 0.000 0.768 0.200 0.032
#> SRR2050460     4  0.0162      0.966 0.004 0.000 0.000 0.996 0.000
#> SRR2050459     2  0.0865      0.857 0.024 0.972 0.000 0.004 0.000
#> SRR2050458     3  0.3109      0.986 0.000 0.000 0.800 0.200 0.000
#> SRR2050457     4  0.0000      0.962 0.000 0.000 0.000 1.000 0.000
#> SRR2050456     2  0.0865      0.857 0.024 0.972 0.000 0.004 0.000
#> SRR2050455     3  0.3109      0.986 0.000 0.000 0.800 0.200 0.000
#> SRR2050454     4  0.0727      0.952 0.004 0.004 0.012 0.980 0.000
#> SRR2050453     2  0.2913      0.849 0.040 0.876 0.080 0.000 0.004
#> SRR2050452     3  0.3109      0.986 0.000 0.000 0.800 0.200 0.000
#> SRR2050451     4  0.0162      0.966 0.004 0.000 0.000 0.996 0.000
#> SRR2050450     2  0.2913      0.849 0.040 0.876 0.080 0.000 0.004
#> SRR2050449     3  0.3109      0.986 0.000 0.000 0.800 0.200 0.000
#> SRR2050448     4  0.0162      0.966 0.004 0.000 0.000 0.996 0.000
#> SRR2050447     3  0.3863      0.982 0.000 0.000 0.772 0.200 0.028
#> SRR2050446     4  0.0162      0.966 0.004 0.000 0.000 0.996 0.000
#> SRR2050445     2  0.0865      0.857 0.024 0.972 0.000 0.004 0.000
#> SRR2050444     3  0.3109      0.986 0.000 0.000 0.800 0.200 0.000
#> SRR2050443     4  0.0162      0.966 0.004 0.000 0.000 0.996 0.000
#> SRR2050442     5  0.3972      0.811 0.012 0.188 0.020 0.000 0.780
#> SRR2050441     3  0.3910      0.979 0.000 0.000 0.772 0.196 0.032
#> SRR2050440     4  0.3769      0.777 0.028 0.000 0.004 0.796 0.172
#> SRR2050439     5  0.3670      0.815 0.008 0.188 0.012 0.000 0.792
#> SRR2050438     3  0.3910      0.979 0.000 0.000 0.772 0.196 0.032
#> SRR2050437     4  0.3769      0.777 0.028 0.000 0.004 0.796 0.172
#> SRR2050436     5  0.4294      0.826 0.024 0.060 0.008 0.096 0.812
#> SRR2050435     3  0.3910      0.979 0.000 0.000 0.772 0.196 0.032
#> SRR2050434     5  0.3757      0.761 0.024 0.000 0.012 0.156 0.808
#> SRR2050433     2  0.5045      0.319 0.020 0.628 0.012 0.004 0.336
#> SRR2050432     1  0.2522      0.844 0.896 0.000 0.024 0.076 0.004
#> SRR2050431     1  0.6292      0.871 0.656 0.000 0.100 0.092 0.152
#> SRR2050430     1  0.3201      0.808 0.872 0.000 0.028 0.064 0.036
#> SRR2050429     1  0.6140      0.865 0.668 0.000 0.100 0.080 0.152

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>            class entropy silhouette    p1    p2    p3    p4    p5    p6
#> SRR2050410     2  0.3110     0.8491 0.000 0.792 0.000 0.012 0.000 0.196
#> SRR2050427     1  0.4255    -0.1720 0.512 0.000 0.004 0.004 0.004 0.476
#> SRR2050426     1  0.1148     0.6116 0.960 0.000 0.000 0.016 0.004 0.020
#> SRR2050425     2  0.1511     0.8222 0.000 0.940 0.000 0.012 0.044 0.004
#> SRR2050424     3  0.0520     0.9860 0.000 0.000 0.984 0.000 0.008 0.008
#> SRR2050423     4  0.2939     0.9238 0.008 0.000 0.080 0.864 0.004 0.044
#> SRR2050422     5  0.1536     0.8035 0.000 0.016 0.000 0.004 0.940 0.040
#> SRR2050421     1  0.4255    -0.1720 0.512 0.000 0.004 0.004 0.004 0.476
#> SRR2050420     1  0.1148     0.6116 0.960 0.000 0.000 0.016 0.004 0.020
#> SRR2050419     2  0.3078     0.8491 0.000 0.796 0.000 0.012 0.000 0.192
#> SRR2050418     1  0.4534    -0.1955 0.516 0.000 0.004 0.012 0.008 0.460
#> SRR2050417     1  0.0547     0.6141 0.980 0.000 0.000 0.020 0.000 0.000
#> SRR2050416     5  0.4312     0.2509 0.000 0.476 0.000 0.012 0.508 0.004
#> SRR2050415     3  0.0520     0.9860 0.000 0.000 0.984 0.000 0.008 0.008
#> SRR2050414     4  0.2200     0.9232 0.012 0.000 0.080 0.900 0.004 0.004
#> SRR2050413     5  0.1785     0.8039 0.000 0.016 0.000 0.008 0.928 0.048
#> SRR2050412     1  0.4122    -0.1619 0.520 0.000 0.004 0.004 0.000 0.472
#> SRR2050411     1  0.0363     0.6153 0.988 0.000 0.000 0.012 0.000 0.000
#> SRR2050409     2  0.3110     0.8491 0.000 0.792 0.000 0.012 0.000 0.196
#> SRR2050408     1  0.0547     0.6141 0.980 0.000 0.000 0.020 0.000 0.000
#> SRR2050407     2  0.2300     0.8508 0.000 0.856 0.000 0.000 0.000 0.144
#> SRR2050406     3  0.0000     0.9884 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2050405     4  0.2312     0.9222 0.012 0.000 0.080 0.896 0.004 0.008
#> SRR2050404     2  0.1265     0.8261 0.000 0.948 0.000 0.008 0.044 0.000
#> SRR2050403     1  0.0547     0.6141 0.980 0.000 0.000 0.020 0.000 0.000
#> SRR2050402     5  0.3002     0.7415 0.000 0.136 0.000 0.008 0.836 0.020
#> SRR2050401     1  0.4122    -0.1619 0.520 0.000 0.004 0.004 0.000 0.472
#> SRR2050400     1  0.1148     0.6116 0.960 0.000 0.000 0.016 0.004 0.020
#> SRR2050399     5  0.1138     0.8072 0.000 0.024 0.000 0.004 0.960 0.012
#> SRR2050398     1  0.4122    -0.1619 0.520 0.000 0.004 0.004 0.000 0.472
#> SRR2050397     1  0.0260     0.6152 0.992 0.000 0.000 0.008 0.000 0.000
#> SRR2050396     3  0.0291     0.9844 0.000 0.000 0.992 0.000 0.004 0.004
#> SRR2050395     4  0.2200     0.9232 0.012 0.000 0.080 0.900 0.004 0.004
#> SRR2050394     2  0.5082     0.6590 0.000 0.648 0.000 0.004 0.160 0.188
#> SRR2050393     3  0.0000     0.9884 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2050392     4  0.2001     0.9193 0.012 0.000 0.068 0.912 0.000 0.008
#> SRR2050465     2  0.1265     0.8261 0.000 0.948 0.000 0.008 0.044 0.000
#> SRR2050464     3  0.0000     0.9884 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2050463     4  0.2925     0.9228 0.008 0.000 0.080 0.860 0.000 0.052
#> SRR2050462     2  0.1265     0.8261 0.000 0.948 0.000 0.008 0.044 0.000
#> SRR2050461     3  0.0520     0.9860 0.000 0.000 0.984 0.000 0.008 0.008
#> SRR2050460     4  0.2987     0.9221 0.008 0.000 0.080 0.856 0.000 0.056
#> SRR2050459     2  0.3345     0.8436 0.000 0.776 0.000 0.020 0.000 0.204
#> SRR2050458     3  0.0000     0.9884 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2050457     4  0.1946     0.9212 0.012 0.000 0.072 0.912 0.000 0.004
#> SRR2050456     2  0.3345     0.8436 0.000 0.776 0.000 0.020 0.000 0.204
#> SRR2050455     3  0.0000     0.9884 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2050454     4  0.2011     0.9169 0.020 0.000 0.064 0.912 0.000 0.004
#> SRR2050453     2  0.1265     0.8261 0.000 0.948 0.000 0.008 0.044 0.000
#> SRR2050452     3  0.0000     0.9884 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2050451     4  0.2987     0.9221 0.008 0.000 0.080 0.856 0.000 0.056
#> SRR2050450     2  0.1265     0.8261 0.000 0.948 0.000 0.008 0.044 0.000
#> SRR2050449     3  0.0000     0.9884 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2050448     4  0.2987     0.9221 0.008 0.000 0.080 0.856 0.000 0.056
#> SRR2050447     3  0.0520     0.9860 0.000 0.000 0.984 0.000 0.008 0.008
#> SRR2050446     4  0.2987     0.9221 0.008 0.000 0.080 0.856 0.000 0.056
#> SRR2050445     2  0.3345     0.8436 0.000 0.776 0.000 0.020 0.000 0.204
#> SRR2050444     3  0.0000     0.9884 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2050443     4  0.2056     0.9232 0.012 0.000 0.080 0.904 0.000 0.004
#> SRR2050442     5  0.2084     0.8106 0.000 0.024 0.000 0.016 0.916 0.044
#> SRR2050441     3  0.0767     0.9822 0.000 0.000 0.976 0.004 0.008 0.012
#> SRR2050440     4  0.6217     0.6229 0.004 0.000 0.068 0.568 0.108 0.252
#> SRR2050439     5  0.1959     0.8114 0.000 0.024 0.000 0.020 0.924 0.032
#> SRR2050438     3  0.1901     0.9277 0.000 0.000 0.912 0.004 0.008 0.076
#> SRR2050437     4  0.6217     0.6229 0.004 0.000 0.068 0.568 0.108 0.252
#> SRR2050436     5  0.3050     0.7824 0.000 0.016 0.000 0.028 0.848 0.108
#> SRR2050435     3  0.0767     0.9822 0.000 0.000 0.976 0.004 0.008 0.012
#> SRR2050434     5  0.3395     0.7463 0.000 0.000 0.004 0.056 0.816 0.124
#> SRR2050433     5  0.6339     0.0913 0.000 0.304 0.000 0.028 0.472 0.196
#> SRR2050432     1  0.4124    -0.1657 0.516 0.000 0.004 0.004 0.000 0.476
#> SRR2050431     1  0.0622     0.6131 0.980 0.000 0.000 0.012 0.000 0.008
#> SRR2050430     6  0.4214     0.0000 0.280 0.000 0.004 0.016 0.012 0.688
#> SRR2050429     1  0.1970     0.5479 0.912 0.000 0.000 0.028 0.000 0.060

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

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

collect_plots(res)

plot of chunk CV-skmeans-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.861           0.920       0.968         0.4792 0.521   0.521
#> 3 3 1.000           0.965       0.986         0.3835 0.782   0.594
#> 4 4 1.000           0.984       0.989         0.1297 0.898   0.704
#> 5 5 0.965           0.927       0.963         0.0636 0.955   0.820
#> 6 6 0.931           0.914       0.927         0.0359 0.970   0.852

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

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

There is also optional best \(k\) = 3 4 5 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
#> SRR2050410     2   0.000      0.961 0.000 1.000
#> SRR2050427     1   0.000      0.967 1.000 0.000
#> SRR2050426     1   0.000      0.967 1.000 0.000
#> SRR2050425     2   0.000      0.961 0.000 1.000
#> SRR2050424     1   0.000      0.967 1.000 0.000
#> SRR2050423     1   0.000      0.967 1.000 0.000
#> SRR2050422     2   0.000      0.961 0.000 1.000
#> SRR2050421     1   0.000      0.967 1.000 0.000
#> SRR2050420     1   0.000      0.967 1.000 0.000
#> SRR2050419     2   0.000      0.961 0.000 1.000
#> SRR2050418     1   0.697      0.760 0.812 0.188
#> SRR2050417     2   0.971      0.329 0.400 0.600
#> SRR2050416     2   0.000      0.961 0.000 1.000
#> SRR2050415     1   0.000      0.967 1.000 0.000
#> SRR2050414     1   0.000      0.967 1.000 0.000
#> SRR2050413     2   0.000      0.961 0.000 1.000
#> SRR2050412     1   0.000      0.967 1.000 0.000
#> SRR2050411     1   0.697      0.760 0.812 0.188
#> SRR2050409     2   0.000      0.961 0.000 1.000
#> SRR2050408     1   0.996      0.117 0.536 0.464
#> SRR2050407     2   0.000      0.961 0.000 1.000
#> SRR2050406     1   0.000      0.967 1.000 0.000
#> SRR2050405     1   0.000      0.967 1.000 0.000
#> SRR2050404     2   0.000      0.961 0.000 1.000
#> SRR2050403     1   0.929      0.471 0.656 0.344
#> SRR2050402     2   0.000      0.961 0.000 1.000
#> SRR2050401     1   0.000      0.967 1.000 0.000
#> SRR2050400     1   0.000      0.967 1.000 0.000
#> SRR2050399     2   0.000      0.961 0.000 1.000
#> SRR2050398     1   0.000      0.967 1.000 0.000
#> SRR2050397     1   0.697      0.760 0.812 0.188
#> SRR2050396     1   0.000      0.967 1.000 0.000
#> SRR2050395     1   0.000      0.967 1.000 0.000
#> SRR2050394     2   0.000      0.961 0.000 1.000
#> SRR2050393     1   0.000      0.967 1.000 0.000
#> SRR2050392     2   0.605      0.815 0.148 0.852
#> SRR2050465     2   0.000      0.961 0.000 1.000
#> SRR2050464     1   0.000      0.967 1.000 0.000
#> SRR2050463     1   0.000      0.967 1.000 0.000
#> SRR2050462     2   0.000      0.961 0.000 1.000
#> SRR2050461     1   0.000      0.967 1.000 0.000
#> SRR2050460     1   0.000      0.967 1.000 0.000
#> SRR2050459     2   0.000      0.961 0.000 1.000
#> SRR2050458     1   0.000      0.967 1.000 0.000
#> SRR2050457     2   0.644      0.797 0.164 0.836
#> SRR2050456     2   0.000      0.961 0.000 1.000
#> SRR2050455     1   0.000      0.967 1.000 0.000
#> SRR2050454     2   0.861      0.604 0.284 0.716
#> SRR2050453     2   0.000      0.961 0.000 1.000
#> SRR2050452     1   0.000      0.967 1.000 0.000
#> SRR2050451     1   0.000      0.967 1.000 0.000
#> SRR2050450     2   0.000      0.961 0.000 1.000
#> SRR2050449     1   0.000      0.967 1.000 0.000
#> SRR2050448     1   0.000      0.967 1.000 0.000
#> SRR2050447     1   0.000      0.967 1.000 0.000
#> SRR2050446     1   0.000      0.967 1.000 0.000
#> SRR2050445     2   0.000      0.961 0.000 1.000
#> SRR2050444     1   0.000      0.967 1.000 0.000
#> SRR2050443     1   0.000      0.967 1.000 0.000
#> SRR2050442     2   0.000      0.961 0.000 1.000
#> SRR2050441     1   0.000      0.967 1.000 0.000
#> SRR2050440     1   0.000      0.967 1.000 0.000
#> SRR2050439     2   0.000      0.961 0.000 1.000
#> SRR2050438     1   0.000      0.967 1.000 0.000
#> SRR2050437     1   0.000      0.967 1.000 0.000
#> SRR2050436     2   0.000      0.961 0.000 1.000
#> SRR2050435     1   0.000      0.967 1.000 0.000
#> SRR2050434     2   0.000      0.961 0.000 1.000
#> SRR2050433     2   0.000      0.961 0.000 1.000
#> SRR2050432     1   0.000      0.967 1.000 0.000
#> SRR2050431     1   0.000      0.967 1.000 0.000
#> SRR2050430     1   0.000      0.967 1.000 0.000
#> SRR2050429     1   0.000      0.967 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
#> SRR2050410     2   0.000      0.955 0.000 1.000 0.000
#> SRR2050427     1   0.000      1.000 1.000 0.000 0.000
#> SRR2050426     1   0.000      1.000 1.000 0.000 0.000
#> SRR2050425     2   0.000      0.955 0.000 1.000 0.000
#> SRR2050424     3   0.000      1.000 0.000 0.000 1.000
#> SRR2050423     3   0.000      1.000 0.000 0.000 1.000
#> SRR2050422     2   0.465      0.712 0.208 0.792 0.000
#> SRR2050421     1   0.000      1.000 1.000 0.000 0.000
#> SRR2050420     1   0.000      1.000 1.000 0.000 0.000
#> SRR2050419     2   0.000      0.955 0.000 1.000 0.000
#> SRR2050418     1   0.000      1.000 1.000 0.000 0.000
#> SRR2050417     1   0.000      1.000 1.000 0.000 0.000
#> SRR2050416     2   0.000      0.955 0.000 1.000 0.000
#> SRR2050415     3   0.000      1.000 0.000 0.000 1.000
#> SRR2050414     3   0.000      1.000 0.000 0.000 1.000
#> SRR2050413     2   0.000      0.955 0.000 1.000 0.000
#> SRR2050412     1   0.000      1.000 1.000 0.000 0.000
#> SRR2050411     1   0.000      1.000 1.000 0.000 0.000
#> SRR2050409     2   0.000      0.955 0.000 1.000 0.000
#> SRR2050408     1   0.000      1.000 1.000 0.000 0.000
#> SRR2050407     2   0.000      0.955 0.000 1.000 0.000
#> SRR2050406     3   0.000      1.000 0.000 0.000 1.000
#> SRR2050405     3   0.000      1.000 0.000 0.000 1.000
#> SRR2050404     2   0.000      0.955 0.000 1.000 0.000
#> SRR2050403     1   0.000      1.000 1.000 0.000 0.000
#> SRR2050402     2   0.000      0.955 0.000 1.000 0.000
#> SRR2050401     1   0.000      1.000 1.000 0.000 0.000
#> SRR2050400     1   0.000      1.000 1.000 0.000 0.000
#> SRR2050399     2   0.000      0.955 0.000 1.000 0.000
#> SRR2050398     1   0.000      1.000 1.000 0.000 0.000
#> SRR2050397     1   0.000      1.000 1.000 0.000 0.000
#> SRR2050396     3   0.000      1.000 0.000 0.000 1.000
#> SRR2050395     3   0.000      1.000 0.000 0.000 1.000
#> SRR2050394     2   0.000      0.955 0.000 1.000 0.000
#> SRR2050393     3   0.000      1.000 0.000 0.000 1.000
#> SRR2050392     2   0.611      0.370 0.000 0.604 0.396
#> SRR2050465     2   0.000      0.955 0.000 1.000 0.000
#> SRR2050464     3   0.000      1.000 0.000 0.000 1.000
#> SRR2050463     3   0.000      1.000 0.000 0.000 1.000
#> SRR2050462     2   0.000      0.955 0.000 1.000 0.000
#> SRR2050461     3   0.000      1.000 0.000 0.000 1.000
#> SRR2050460     3   0.000      1.000 0.000 0.000 1.000
#> SRR2050459     2   0.000      0.955 0.000 1.000 0.000
#> SRR2050458     3   0.000      1.000 0.000 0.000 1.000
#> SRR2050457     3   0.000      1.000 0.000 0.000 1.000
#> SRR2050456     2   0.000      0.955 0.000 1.000 0.000
#> SRR2050455     3   0.000      1.000 0.000 0.000 1.000
#> SRR2050454     2   0.611      0.370 0.000 0.604 0.396
#> SRR2050453     2   0.000      0.955 0.000 1.000 0.000
#> SRR2050452     3   0.000      1.000 0.000 0.000 1.000
#> SRR2050451     3   0.000      1.000 0.000 0.000 1.000
#> SRR2050450     2   0.000      0.955 0.000 1.000 0.000
#> SRR2050449     3   0.000      1.000 0.000 0.000 1.000
#> SRR2050448     3   0.000      1.000 0.000 0.000 1.000
#> SRR2050447     3   0.000      1.000 0.000 0.000 1.000
#> SRR2050446     3   0.000      1.000 0.000 0.000 1.000
#> SRR2050445     2   0.000      0.955 0.000 1.000 0.000
#> SRR2050444     3   0.000      1.000 0.000 0.000 1.000
#> SRR2050443     3   0.000      1.000 0.000 0.000 1.000
#> SRR2050442     2   0.000      0.955 0.000 1.000 0.000
#> SRR2050441     3   0.000      1.000 0.000 0.000 1.000
#> SRR2050440     3   0.000      1.000 0.000 0.000 1.000
#> SRR2050439     2   0.000      0.955 0.000 1.000 0.000
#> SRR2050438     3   0.000      1.000 0.000 0.000 1.000
#> SRR2050437     3   0.000      1.000 0.000 0.000 1.000
#> SRR2050436     2   0.000      0.955 0.000 1.000 0.000
#> SRR2050435     3   0.000      1.000 0.000 0.000 1.000
#> SRR2050434     2   0.000      0.955 0.000 1.000 0.000
#> SRR2050433     2   0.000      0.955 0.000 1.000 0.000
#> SRR2050432     1   0.000      1.000 1.000 0.000 0.000
#> SRR2050431     1   0.000      1.000 1.000 0.000 0.000
#> SRR2050430     1   0.000      1.000 1.000 0.000 0.000
#> SRR2050429     1   0.000      1.000 1.000 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette p1    p2    p3    p4
#> SRR2050410     2  0.0000      0.994  0 1.000 0.000 0.000
#> SRR2050427     1  0.0000      1.000  1 0.000 0.000 0.000
#> SRR2050426     1  0.0000      1.000  1 0.000 0.000 0.000
#> SRR2050425     2  0.0000      0.994  0 1.000 0.000 0.000
#> SRR2050424     3  0.0000      0.976  0 0.000 1.000 0.000
#> SRR2050423     4  0.0707      0.995  0 0.000 0.020 0.980
#> SRR2050422     2  0.0707      0.989  0 0.980 0.000 0.020
#> SRR2050421     1  0.0000      1.000  1 0.000 0.000 0.000
#> SRR2050420     1  0.0000      1.000  1 0.000 0.000 0.000
#> SRR2050419     2  0.0000      0.994  0 1.000 0.000 0.000
#> SRR2050418     1  0.0000      1.000  1 0.000 0.000 0.000
#> SRR2050417     1  0.0000      1.000  1 0.000 0.000 0.000
#> SRR2050416     2  0.0336      0.993  0 0.992 0.000 0.008
#> SRR2050415     3  0.0000      0.976  0 0.000 1.000 0.000
#> SRR2050414     4  0.0707      0.995  0 0.000 0.020 0.980
#> SRR2050413     2  0.0707      0.989  0 0.980 0.000 0.020
#> SRR2050412     1  0.0000      1.000  1 0.000 0.000 0.000
#> SRR2050411     1  0.0000      1.000  1 0.000 0.000 0.000
#> SRR2050409     2  0.0000      0.994  0 1.000 0.000 0.000
#> SRR2050408     1  0.0000      1.000  1 0.000 0.000 0.000
#> SRR2050407     2  0.0000      0.994  0 1.000 0.000 0.000
#> SRR2050406     3  0.0000      0.976  0 0.000 1.000 0.000
#> SRR2050405     4  0.0707      0.995  0 0.000 0.020 0.980
#> SRR2050404     2  0.0000      0.994  0 1.000 0.000 0.000
#> SRR2050403     1  0.0000      1.000  1 0.000 0.000 0.000
#> SRR2050402     2  0.0336      0.993  0 0.992 0.000 0.008
#> SRR2050401     1  0.0000      1.000  1 0.000 0.000 0.000
#> SRR2050400     1  0.0000      1.000  1 0.000 0.000 0.000
#> SRR2050399     2  0.0707      0.989  0 0.980 0.000 0.020
#> SRR2050398     1  0.0000      1.000  1 0.000 0.000 0.000
#> SRR2050397     1  0.0000      1.000  1 0.000 0.000 0.000
#> SRR2050396     3  0.0000      0.976  0 0.000 1.000 0.000
#> SRR2050395     4  0.0707      0.995  0 0.000 0.020 0.980
#> SRR2050394     2  0.0188      0.994  0 0.996 0.000 0.004
#> SRR2050393     3  0.0000      0.976  0 0.000 1.000 0.000
#> SRR2050392     4  0.0779      0.983  0 0.016 0.004 0.980
#> SRR2050465     2  0.0000      0.994  0 1.000 0.000 0.000
#> SRR2050464     3  0.0000      0.976  0 0.000 1.000 0.000
#> SRR2050463     4  0.0707      0.995  0 0.000 0.020 0.980
#> SRR2050462     2  0.0000      0.994  0 1.000 0.000 0.000
#> SRR2050461     3  0.0000      0.976  0 0.000 1.000 0.000
#> SRR2050460     4  0.0707      0.995  0 0.000 0.020 0.980
#> SRR2050459     2  0.0000      0.994  0 1.000 0.000 0.000
#> SRR2050458     3  0.0000      0.976  0 0.000 1.000 0.000
#> SRR2050457     4  0.0779      0.983  0 0.016 0.004 0.980
#> SRR2050456     2  0.0000      0.994  0 1.000 0.000 0.000
#> SRR2050455     3  0.0000      0.976  0 0.000 1.000 0.000
#> SRR2050454     4  0.0779      0.983  0 0.016 0.004 0.980
#> SRR2050453     2  0.0000      0.994  0 1.000 0.000 0.000
#> SRR2050452     3  0.0000      0.976  0 0.000 1.000 0.000
#> SRR2050451     4  0.0707      0.995  0 0.000 0.020 0.980
#> SRR2050450     2  0.0000      0.994  0 1.000 0.000 0.000
#> SRR2050449     3  0.0000      0.976  0 0.000 1.000 0.000
#> SRR2050448     4  0.0707      0.995  0 0.000 0.020 0.980
#> SRR2050447     3  0.0000      0.976  0 0.000 1.000 0.000
#> SRR2050446     4  0.0707      0.995  0 0.000 0.020 0.980
#> SRR2050445     2  0.0000      0.994  0 1.000 0.000 0.000
#> SRR2050444     3  0.0000      0.976  0 0.000 1.000 0.000
#> SRR2050443     4  0.0707      0.995  0 0.000 0.020 0.980
#> SRR2050442     2  0.0707      0.989  0 0.980 0.000 0.020
#> SRR2050441     3  0.0000      0.976  0 0.000 1.000 0.000
#> SRR2050440     3  0.3569      0.765  0 0.000 0.804 0.196
#> SRR2050439     2  0.0707      0.989  0 0.980 0.000 0.020
#> SRR2050438     3  0.0000      0.976  0 0.000 1.000 0.000
#> SRR2050437     3  0.3569      0.765  0 0.000 0.804 0.196
#> SRR2050436     2  0.0707      0.989  0 0.980 0.000 0.020
#> SRR2050435     3  0.0000      0.976  0 0.000 1.000 0.000
#> SRR2050434     2  0.0707      0.989  0 0.980 0.000 0.020
#> SRR2050433     2  0.0000      0.994  0 1.000 0.000 0.000
#> SRR2050432     1  0.0000      1.000  1 0.000 0.000 0.000
#> SRR2050431     1  0.0000      1.000  1 0.000 0.000 0.000
#> SRR2050430     1  0.0000      1.000  1 0.000 0.000 0.000
#> SRR2050429     1  0.0000      1.000  1 0.000 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>            class entropy silhouette    p1    p2    p3    p4    p5
#> SRR2050410     2  0.0000      0.975 0.000 1.000 0.000 0.000 0.000
#> SRR2050427     1  0.0963      0.967 0.964 0.000 0.000 0.000 0.036
#> SRR2050426     1  0.0000      0.973 1.000 0.000 0.000 0.000 0.000
#> SRR2050425     2  0.0162      0.974 0.000 0.996 0.000 0.000 0.004
#> SRR2050424     3  0.0000      0.938 0.000 0.000 1.000 0.000 0.000
#> SRR2050423     4  0.0000      0.998 0.000 0.000 0.000 1.000 0.000
#> SRR2050422     5  0.0963      0.906 0.000 0.036 0.000 0.000 0.964
#> SRR2050421     1  0.0963      0.967 0.964 0.000 0.000 0.000 0.036
#> SRR2050420     1  0.0000      0.973 1.000 0.000 0.000 0.000 0.000
#> SRR2050419     2  0.0000      0.975 0.000 1.000 0.000 0.000 0.000
#> SRR2050418     1  0.0963      0.967 0.964 0.000 0.000 0.000 0.036
#> SRR2050417     1  0.0000      0.973 1.000 0.000 0.000 0.000 0.000
#> SRR2050416     2  0.0290      0.971 0.000 0.992 0.000 0.000 0.008
#> SRR2050415     3  0.0000      0.938 0.000 0.000 1.000 0.000 0.000
#> SRR2050414     4  0.0000      0.998 0.000 0.000 0.000 1.000 0.000
#> SRR2050413     5  0.0963      0.906 0.000 0.036 0.000 0.000 0.964
#> SRR2050412     1  0.0963      0.967 0.964 0.000 0.000 0.000 0.036
#> SRR2050411     1  0.0000      0.973 1.000 0.000 0.000 0.000 0.000
#> SRR2050409     2  0.0000      0.975 0.000 1.000 0.000 0.000 0.000
#> SRR2050408     1  0.0000      0.973 1.000 0.000 0.000 0.000 0.000
#> SRR2050407     2  0.0000      0.975 0.000 1.000 0.000 0.000 0.000
#> SRR2050406     3  0.0000      0.938 0.000 0.000 1.000 0.000 0.000
#> SRR2050405     4  0.0000      0.998 0.000 0.000 0.000 1.000 0.000
#> SRR2050404     2  0.0162      0.974 0.000 0.996 0.000 0.000 0.004
#> SRR2050403     1  0.0000      0.973 1.000 0.000 0.000 0.000 0.000
#> SRR2050402     2  0.3210      0.704 0.000 0.788 0.000 0.000 0.212
#> SRR2050401     1  0.0963      0.967 0.964 0.000 0.000 0.000 0.036
#> SRR2050400     1  0.0000      0.973 1.000 0.000 0.000 0.000 0.000
#> SRR2050399     5  0.3636      0.700 0.000 0.272 0.000 0.000 0.728
#> SRR2050398     1  0.0963      0.967 0.964 0.000 0.000 0.000 0.036
#> SRR2050397     1  0.0000      0.973 1.000 0.000 0.000 0.000 0.000
#> SRR2050396     3  0.0000      0.938 0.000 0.000 1.000 0.000 0.000
#> SRR2050395     4  0.0000      0.998 0.000 0.000 0.000 1.000 0.000
#> SRR2050394     2  0.2230      0.851 0.000 0.884 0.000 0.000 0.116
#> SRR2050393     3  0.0000      0.938 0.000 0.000 1.000 0.000 0.000
#> SRR2050392     4  0.0162      0.995 0.000 0.004 0.000 0.996 0.000
#> SRR2050465     2  0.0000      0.975 0.000 1.000 0.000 0.000 0.000
#> SRR2050464     3  0.0000      0.938 0.000 0.000 1.000 0.000 0.000
#> SRR2050463     4  0.0000      0.998 0.000 0.000 0.000 1.000 0.000
#> SRR2050462     2  0.0162      0.974 0.000 0.996 0.000 0.000 0.004
#> SRR2050461     3  0.0000      0.938 0.000 0.000 1.000 0.000 0.000
#> SRR2050460     4  0.0000      0.998 0.000 0.000 0.000 1.000 0.000
#> SRR2050459     2  0.0000      0.975 0.000 1.000 0.000 0.000 0.000
#> SRR2050458     3  0.0000      0.938 0.000 0.000 1.000 0.000 0.000
#> SRR2050457     4  0.0290      0.992 0.000 0.008 0.000 0.992 0.000
#> SRR2050456     2  0.0000      0.975 0.000 1.000 0.000 0.000 0.000
#> SRR2050455     3  0.0000      0.938 0.000 0.000 1.000 0.000 0.000
#> SRR2050454     4  0.0162      0.995 0.000 0.004 0.000 0.996 0.000
#> SRR2050453     2  0.0000      0.975 0.000 1.000 0.000 0.000 0.000
#> SRR2050452     3  0.0000      0.938 0.000 0.000 1.000 0.000 0.000
#> SRR2050451     4  0.0000      0.998 0.000 0.000 0.000 1.000 0.000
#> SRR2050450     2  0.0162      0.974 0.000 0.996 0.000 0.000 0.004
#> SRR2050449     3  0.0000      0.938 0.000 0.000 1.000 0.000 0.000
#> SRR2050448     4  0.0000      0.998 0.000 0.000 0.000 1.000 0.000
#> SRR2050447     3  0.0000      0.938 0.000 0.000 1.000 0.000 0.000
#> SRR2050446     4  0.0000      0.998 0.000 0.000 0.000 1.000 0.000
#> SRR2050445     2  0.0000      0.975 0.000 1.000 0.000 0.000 0.000
#> SRR2050444     3  0.0000      0.938 0.000 0.000 1.000 0.000 0.000
#> SRR2050443     4  0.0000      0.998 0.000 0.000 0.000 1.000 0.000
#> SRR2050442     5  0.3636      0.700 0.000 0.272 0.000 0.000 0.728
#> SRR2050441     3  0.0000      0.938 0.000 0.000 1.000 0.000 0.000
#> SRR2050440     3  0.6503      0.191 0.000 0.000 0.464 0.204 0.332
#> SRR2050439     5  0.1121      0.903 0.000 0.044 0.000 0.000 0.956
#> SRR2050438     3  0.0000      0.938 0.000 0.000 1.000 0.000 0.000
#> SRR2050437     3  0.6503      0.191 0.000 0.000 0.464 0.204 0.332
#> SRR2050436     5  0.0963      0.906 0.000 0.036 0.000 0.000 0.964
#> SRR2050435     3  0.0000      0.938 0.000 0.000 1.000 0.000 0.000
#> SRR2050434     5  0.0963      0.906 0.000 0.036 0.000 0.000 0.964
#> SRR2050433     2  0.0000      0.975 0.000 1.000 0.000 0.000 0.000
#> SRR2050432     1  0.0963      0.967 0.964 0.000 0.000 0.000 0.036
#> SRR2050431     1  0.0000      0.973 1.000 0.000 0.000 0.000 0.000
#> SRR2050430     1  0.3586      0.698 0.736 0.000 0.000 0.000 0.264
#> SRR2050429     1  0.0000      0.973 1.000 0.000 0.000 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>            class entropy silhouette    p1    p2    p3    p4    p5    p6
#> SRR2050410     2  0.0146     0.9724 0.000 0.996 0.000 0.000 0.000 0.004
#> SRR2050427     6  0.3244     0.9860 0.268 0.000 0.000 0.000 0.000 0.732
#> SRR2050426     1  0.0260     0.9867 0.992 0.000 0.000 0.000 0.000 0.008
#> SRR2050425     2  0.0000     0.9726 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2050424     3  0.0000     0.9255 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2050423     4  0.2300     0.8995 0.000 0.000 0.000 0.856 0.000 0.144
#> SRR2050422     5  0.0000     0.9464 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR2050421     6  0.3244     0.9860 0.268 0.000 0.000 0.000 0.000 0.732
#> SRR2050420     1  0.0260     0.9867 0.992 0.000 0.000 0.000 0.000 0.008
#> SRR2050419     2  0.0146     0.9724 0.000 0.996 0.000 0.000 0.000 0.004
#> SRR2050418     6  0.3244     0.9860 0.268 0.000 0.000 0.000 0.000 0.732
#> SRR2050417     1  0.0000     0.9918 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2050416     2  0.0000     0.9726 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2050415     3  0.0000     0.9255 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2050414     4  0.0000     0.9099 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR2050413     5  0.0000     0.9464 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR2050412     6  0.3244     0.9860 0.268 0.000 0.000 0.000 0.000 0.732
#> SRR2050411     1  0.0000     0.9918 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2050409     2  0.0146     0.9724 0.000 0.996 0.000 0.000 0.000 0.004
#> SRR2050408     1  0.0000     0.9918 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2050407     2  0.0000     0.9726 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2050406     3  0.0000     0.9255 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2050405     4  0.0713     0.9060 0.000 0.000 0.000 0.972 0.000 0.028
#> SRR2050404     2  0.0000     0.9726 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2050403     1  0.0000     0.9918 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2050402     2  0.3266     0.6307 0.000 0.728 0.000 0.000 0.272 0.000
#> SRR2050401     6  0.3244     0.9860 0.268 0.000 0.000 0.000 0.000 0.732
#> SRR2050400     1  0.0146     0.9898 0.996 0.000 0.000 0.000 0.000 0.004
#> SRR2050399     5  0.1863     0.8820 0.000 0.104 0.000 0.000 0.896 0.000
#> SRR2050398     6  0.3244     0.9860 0.268 0.000 0.000 0.000 0.000 0.732
#> SRR2050397     1  0.0000     0.9918 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2050396     3  0.0000     0.9255 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2050395     4  0.0146     0.9101 0.000 0.000 0.000 0.996 0.000 0.004
#> SRR2050394     2  0.2092     0.8492 0.000 0.876 0.000 0.000 0.124 0.000
#> SRR2050393     3  0.0000     0.9255 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2050392     4  0.0713     0.9060 0.000 0.000 0.000 0.972 0.000 0.028
#> SRR2050465     2  0.0000     0.9726 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2050464     3  0.0000     0.9255 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2050463     4  0.2631     0.8930 0.000 0.000 0.000 0.820 0.000 0.180
#> SRR2050462     2  0.0000     0.9726 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2050461     3  0.0000     0.9255 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2050460     4  0.2664     0.8909 0.000 0.000 0.000 0.816 0.000 0.184
#> SRR2050459     2  0.0146     0.9724 0.000 0.996 0.000 0.000 0.000 0.004
#> SRR2050458     3  0.0000     0.9255 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2050457     4  0.0790     0.9039 0.000 0.000 0.000 0.968 0.000 0.032
#> SRR2050456     2  0.0146     0.9724 0.000 0.996 0.000 0.000 0.000 0.004
#> SRR2050455     3  0.0000     0.9255 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2050454     4  0.0713     0.9060 0.000 0.000 0.000 0.972 0.000 0.028
#> SRR2050453     2  0.0000     0.9726 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2050452     3  0.0000     0.9255 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2050451     4  0.2631     0.8930 0.000 0.000 0.000 0.820 0.000 0.180
#> SRR2050450     2  0.0000     0.9726 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2050449     3  0.0000     0.9255 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2050448     4  0.2631     0.8930 0.000 0.000 0.000 0.820 0.000 0.180
#> SRR2050447     3  0.0000     0.9255 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2050446     4  0.2631     0.8930 0.000 0.000 0.000 0.820 0.000 0.180
#> SRR2050445     2  0.0146     0.9724 0.000 0.996 0.000 0.000 0.000 0.004
#> SRR2050444     3  0.0000     0.9255 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2050443     4  0.0713     0.9060 0.000 0.000 0.000 0.972 0.000 0.028
#> SRR2050442     5  0.1910     0.8805 0.000 0.108 0.000 0.000 0.892 0.000
#> SRR2050441     3  0.0000     0.9255 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2050440     3  0.7582     0.0102 0.000 0.000 0.348 0.184 0.236 0.232
#> SRR2050439     5  0.0146     0.9467 0.000 0.004 0.000 0.000 0.996 0.000
#> SRR2050438     3  0.0260     0.9198 0.000 0.000 0.992 0.000 0.000 0.008
#> SRR2050437     3  0.7582     0.0102 0.000 0.000 0.348 0.184 0.236 0.232
#> SRR2050436     5  0.0632     0.9415 0.000 0.000 0.000 0.000 0.976 0.024
#> SRR2050435     3  0.0000     0.9255 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2050434     5  0.0713     0.9398 0.000 0.000 0.000 0.000 0.972 0.028
#> SRR2050433     2  0.0146     0.9724 0.000 0.996 0.000 0.000 0.000 0.004
#> SRR2050432     6  0.3244     0.9860 0.268 0.000 0.000 0.000 0.000 0.732
#> SRR2050431     1  0.0000     0.9918 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2050430     6  0.3141     0.9041 0.200 0.000 0.000 0.000 0.012 0.788
#> SRR2050429     1  0.0790     0.9523 0.968 0.000 0.000 0.000 0.000 0.032

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

consensus_heatmap(res, k = 2)

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

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

collect_plots(res)

plot of chunk CV-pam-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 1.000           0.983       0.993         0.4102 0.597   0.597
#> 3 3 1.000           0.976       0.983         0.5428 0.775   0.622
#> 4 4 0.985           0.948       0.977         0.1975 0.871   0.652
#> 5 5 0.922           0.930       0.953         0.0452 0.951   0.803
#> 6 6 1.000           0.955       0.983         0.0472 0.945   0.745

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

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

There is also optional best \(k\) = 2 3 4 5 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
#> SRR2050410     2  0.0000      1.000 0.000 1.000
#> SRR2050427     1  0.0000      0.990 1.000 0.000
#> SRR2050426     1  0.0000      0.990 1.000 0.000
#> SRR2050425     2  0.0000      1.000 0.000 1.000
#> SRR2050424     1  0.0000      0.990 1.000 0.000
#> SRR2050423     1  0.0000      0.990 1.000 0.000
#> SRR2050422     1  0.2236      0.956 0.964 0.036
#> SRR2050421     1  0.0000      0.990 1.000 0.000
#> SRR2050420     1  0.0000      0.990 1.000 0.000
#> SRR2050419     2  0.0000      1.000 0.000 1.000
#> SRR2050418     1  0.0000      0.990 1.000 0.000
#> SRR2050417     1  0.0000      0.990 1.000 0.000
#> SRR2050416     2  0.0000      1.000 0.000 1.000
#> SRR2050415     1  0.0000      0.990 1.000 0.000
#> SRR2050414     1  0.0000      0.990 1.000 0.000
#> SRR2050413     1  0.9170      0.513 0.668 0.332
#> SRR2050412     1  0.0000      0.990 1.000 0.000
#> SRR2050411     1  0.0000      0.990 1.000 0.000
#> SRR2050409     2  0.0000      1.000 0.000 1.000
#> SRR2050408     1  0.0000      0.990 1.000 0.000
#> SRR2050407     2  0.0000      1.000 0.000 1.000
#> SRR2050406     1  0.0000      0.990 1.000 0.000
#> SRR2050405     1  0.0000      0.990 1.000 0.000
#> SRR2050404     2  0.0000      1.000 0.000 1.000
#> SRR2050403     1  0.0000      0.990 1.000 0.000
#> SRR2050402     2  0.0000      1.000 0.000 1.000
#> SRR2050401     1  0.0000      0.990 1.000 0.000
#> SRR2050400     1  0.0000      0.990 1.000 0.000
#> SRR2050399     2  0.0000      1.000 0.000 1.000
#> SRR2050398     1  0.0000      0.990 1.000 0.000
#> SRR2050397     1  0.0000      0.990 1.000 0.000
#> SRR2050396     1  0.0000      0.990 1.000 0.000
#> SRR2050395     1  0.0000      0.990 1.000 0.000
#> SRR2050394     2  0.0000      1.000 0.000 1.000
#> SRR2050393     1  0.0000      0.990 1.000 0.000
#> SRR2050392     1  0.0000      0.990 1.000 0.000
#> SRR2050465     2  0.0000      1.000 0.000 1.000
#> SRR2050464     1  0.0000      0.990 1.000 0.000
#> SRR2050463     1  0.0000      0.990 1.000 0.000
#> SRR2050462     2  0.0000      1.000 0.000 1.000
#> SRR2050461     1  0.0000      0.990 1.000 0.000
#> SRR2050460     1  0.0000      0.990 1.000 0.000
#> SRR2050459     2  0.0000      1.000 0.000 1.000
#> SRR2050458     1  0.0000      0.990 1.000 0.000
#> SRR2050457     1  0.0000      0.990 1.000 0.000
#> SRR2050456     2  0.0000      1.000 0.000 1.000
#> SRR2050455     1  0.0000      0.990 1.000 0.000
#> SRR2050454     1  0.0000      0.990 1.000 0.000
#> SRR2050453     2  0.0000      1.000 0.000 1.000
#> SRR2050452     1  0.0000      0.990 1.000 0.000
#> SRR2050451     1  0.0000      0.990 1.000 0.000
#> SRR2050450     2  0.0000      1.000 0.000 1.000
#> SRR2050449     1  0.0000      0.990 1.000 0.000
#> SRR2050448     1  0.0000      0.990 1.000 0.000
#> SRR2050447     1  0.0000      0.990 1.000 0.000
#> SRR2050446     1  0.0000      0.990 1.000 0.000
#> SRR2050445     2  0.0000      1.000 0.000 1.000
#> SRR2050444     1  0.0000      0.990 1.000 0.000
#> SRR2050443     1  0.0000      0.990 1.000 0.000
#> SRR2050442     2  0.0000      1.000 0.000 1.000
#> SRR2050441     1  0.0000      0.990 1.000 0.000
#> SRR2050440     1  0.0000      0.990 1.000 0.000
#> SRR2050439     2  0.0000      1.000 0.000 1.000
#> SRR2050438     1  0.0000      0.990 1.000 0.000
#> SRR2050437     1  0.0000      0.990 1.000 0.000
#> SRR2050436     1  0.6247      0.816 0.844 0.156
#> SRR2050435     1  0.0000      0.990 1.000 0.000
#> SRR2050434     1  0.0376      0.986 0.996 0.004
#> SRR2050433     2  0.0000      1.000 0.000 1.000
#> SRR2050432     1  0.0000      0.990 1.000 0.000
#> SRR2050431     1  0.0000      0.990 1.000 0.000
#> SRR2050430     1  0.0000      0.990 1.000 0.000
#> SRR2050429     1  0.0000      0.990 1.000 0.000

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>            class entropy silhouette    p1    p2    p3
#> SRR2050410     2   0.000      1.000 0.000 1.000 0.000
#> SRR2050427     1   0.000      0.966 1.000 0.000 0.000
#> SRR2050426     1   0.000      0.966 1.000 0.000 0.000
#> SRR2050425     2   0.000      1.000 0.000 1.000 0.000
#> SRR2050424     3   0.000      1.000 0.000 0.000 1.000
#> SRR2050423     1   0.153      0.965 0.960 0.000 0.040
#> SRR2050422     1   0.207      0.937 0.940 0.060 0.000
#> SRR2050421     1   0.000      0.966 1.000 0.000 0.000
#> SRR2050420     1   0.000      0.966 1.000 0.000 0.000
#> SRR2050419     2   0.000      1.000 0.000 1.000 0.000
#> SRR2050418     1   0.129      0.966 0.968 0.000 0.032
#> SRR2050417     1   0.000      0.966 1.000 0.000 0.000
#> SRR2050416     2   0.000      1.000 0.000 1.000 0.000
#> SRR2050415     3   0.000      1.000 0.000 0.000 1.000
#> SRR2050414     1   0.153      0.965 0.960 0.000 0.040
#> SRR2050413     1   0.489      0.735 0.772 0.228 0.000
#> SRR2050412     1   0.000      0.966 1.000 0.000 0.000
#> SRR2050411     1   0.000      0.966 1.000 0.000 0.000
#> SRR2050409     2   0.000      1.000 0.000 1.000 0.000
#> SRR2050408     1   0.000      0.966 1.000 0.000 0.000
#> SRR2050407     2   0.000      1.000 0.000 1.000 0.000
#> SRR2050406     3   0.000      1.000 0.000 0.000 1.000
#> SRR2050405     1   0.153      0.965 0.960 0.000 0.040
#> SRR2050404     2   0.000      1.000 0.000 1.000 0.000
#> SRR2050403     1   0.000      0.966 1.000 0.000 0.000
#> SRR2050402     2   0.000      1.000 0.000 1.000 0.000
#> SRR2050401     1   0.000      0.966 1.000 0.000 0.000
#> SRR2050400     1   0.000      0.966 1.000 0.000 0.000
#> SRR2050399     2   0.000      1.000 0.000 1.000 0.000
#> SRR2050398     1   0.263      0.906 0.916 0.000 0.084
#> SRR2050397     1   0.000      0.966 1.000 0.000 0.000
#> SRR2050396     3   0.000      1.000 0.000 0.000 1.000
#> SRR2050395     1   0.153      0.965 0.960 0.000 0.040
#> SRR2050394     2   0.000      1.000 0.000 1.000 0.000
#> SRR2050393     3   0.000      1.000 0.000 0.000 1.000
#> SRR2050392     1   0.153      0.965 0.960 0.000 0.040
#> SRR2050465     2   0.000      1.000 0.000 1.000 0.000
#> SRR2050464     3   0.000      1.000 0.000 0.000 1.000
#> SRR2050463     1   0.153      0.965 0.960 0.000 0.040
#> SRR2050462     2   0.000      1.000 0.000 1.000 0.000
#> SRR2050461     3   0.000      1.000 0.000 0.000 1.000
#> SRR2050460     1   0.153      0.965 0.960 0.000 0.040
#> SRR2050459     2   0.000      1.000 0.000 1.000 0.000
#> SRR2050458     3   0.000      1.000 0.000 0.000 1.000
#> SRR2050457     1   0.153      0.965 0.960 0.000 0.040
#> SRR2050456     2   0.000      1.000 0.000 1.000 0.000
#> SRR2050455     3   0.000      1.000 0.000 0.000 1.000
#> SRR2050454     1   0.000      0.966 1.000 0.000 0.000
#> SRR2050453     2   0.000      1.000 0.000 1.000 0.000
#> SRR2050452     3   0.000      1.000 0.000 0.000 1.000
#> SRR2050451     1   0.153      0.965 0.960 0.000 0.040
#> SRR2050450     2   0.000      1.000 0.000 1.000 0.000
#> SRR2050449     3   0.000      1.000 0.000 0.000 1.000
#> SRR2050448     1   0.153      0.965 0.960 0.000 0.040
#> SRR2050447     3   0.000      1.000 0.000 0.000 1.000
#> SRR2050446     1   0.153      0.965 0.960 0.000 0.040
#> SRR2050445     2   0.000      1.000 0.000 1.000 0.000
#> SRR2050444     3   0.000      1.000 0.000 0.000 1.000
#> SRR2050443     1   0.153      0.965 0.960 0.000 0.040
#> SRR2050442     2   0.000      1.000 0.000 1.000 0.000
#> SRR2050441     3   0.000      1.000 0.000 0.000 1.000
#> SRR2050440     1   0.153      0.965 0.960 0.000 0.040
#> SRR2050439     2   0.000      1.000 0.000 1.000 0.000
#> SRR2050438     3   0.000      1.000 0.000 0.000 1.000
#> SRR2050437     1   0.153      0.965 0.960 0.000 0.040
#> SRR2050436     1   0.400      0.832 0.840 0.160 0.000
#> SRR2050435     3   0.000      1.000 0.000 0.000 1.000
#> SRR2050434     1   0.153      0.952 0.960 0.040 0.000
#> SRR2050433     2   0.000      1.000 0.000 1.000 0.000
#> SRR2050432     1   0.000      0.966 1.000 0.000 0.000
#> SRR2050431     1   0.000      0.966 1.000 0.000 0.000
#> SRR2050430     1   0.254      0.936 0.920 0.000 0.080
#> SRR2050429     1   0.000      0.966 1.000 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> SRR2050410     2   0.000      1.000 0.000 1.000 0.000 0.000
#> SRR2050427     1   0.000      0.922 1.000 0.000 0.000 0.000
#> SRR2050426     1   0.000      0.922 1.000 0.000 0.000 0.000
#> SRR2050425     2   0.000      1.000 0.000 1.000 0.000 0.000
#> SRR2050424     3   0.000      1.000 0.000 0.000 1.000 0.000
#> SRR2050423     4   0.000      0.990 0.000 0.000 0.000 1.000
#> SRR2050422     1   0.609      0.369 0.564 0.052 0.000 0.384
#> SRR2050421     1   0.000      0.922 1.000 0.000 0.000 0.000
#> SRR2050420     1   0.000      0.922 1.000 0.000 0.000 0.000
#> SRR2050419     2   0.000      1.000 0.000 1.000 0.000 0.000
#> SRR2050418     1   0.353      0.746 0.808 0.000 0.000 0.192
#> SRR2050417     1   0.000      0.922 1.000 0.000 0.000 0.000
#> SRR2050416     2   0.000      1.000 0.000 1.000 0.000 0.000
#> SRR2050415     3   0.000      1.000 0.000 0.000 1.000 0.000
#> SRR2050414     4   0.000      0.990 0.000 0.000 0.000 1.000
#> SRR2050413     1   0.670      0.422 0.564 0.328 0.000 0.108
#> SRR2050412     1   0.000      0.922 1.000 0.000 0.000 0.000
#> SRR2050411     1   0.000      0.922 1.000 0.000 0.000 0.000
#> SRR2050409     2   0.000      1.000 0.000 1.000 0.000 0.000
#> SRR2050408     1   0.000      0.922 1.000 0.000 0.000 0.000
#> SRR2050407     2   0.000      1.000 0.000 1.000 0.000 0.000
#> SRR2050406     3   0.000      1.000 0.000 0.000 1.000 0.000
#> SRR2050405     4   0.000      0.990 0.000 0.000 0.000 1.000
#> SRR2050404     2   0.000      1.000 0.000 1.000 0.000 0.000
#> SRR2050403     1   0.000      0.922 1.000 0.000 0.000 0.000
#> SRR2050402     2   0.000      1.000 0.000 1.000 0.000 0.000
#> SRR2050401     1   0.000      0.922 1.000 0.000 0.000 0.000
#> SRR2050400     1   0.000      0.922 1.000 0.000 0.000 0.000
#> SRR2050399     2   0.000      1.000 0.000 1.000 0.000 0.000
#> SRR2050398     1   0.000      0.922 1.000 0.000 0.000 0.000
#> SRR2050397     1   0.000      0.922 1.000 0.000 0.000 0.000
#> SRR2050396     3   0.000      1.000 0.000 0.000 1.000 0.000
#> SRR2050395     4   0.000      0.990 0.000 0.000 0.000 1.000
#> SRR2050394     2   0.000      1.000 0.000 1.000 0.000 0.000
#> SRR2050393     3   0.000      1.000 0.000 0.000 1.000 0.000
#> SRR2050392     4   0.000      0.990 0.000 0.000 0.000 1.000
#> SRR2050465     2   0.000      1.000 0.000 1.000 0.000 0.000
#> SRR2050464     3   0.000      1.000 0.000 0.000 1.000 0.000
#> SRR2050463     4   0.000      0.990 0.000 0.000 0.000 1.000
#> SRR2050462     2   0.000      1.000 0.000 1.000 0.000 0.000
#> SRR2050461     3   0.000      1.000 0.000 0.000 1.000 0.000
#> SRR2050460     4   0.000      0.990 0.000 0.000 0.000 1.000
#> SRR2050459     2   0.000      1.000 0.000 1.000 0.000 0.000
#> SRR2050458     3   0.000      1.000 0.000 0.000 1.000 0.000
#> SRR2050457     4   0.000      0.990 0.000 0.000 0.000 1.000
#> SRR2050456     2   0.000      1.000 0.000 1.000 0.000 0.000
#> SRR2050455     3   0.000      1.000 0.000 0.000 1.000 0.000
#> SRR2050454     4   0.000      0.990 0.000 0.000 0.000 1.000
#> SRR2050453     2   0.000      1.000 0.000 1.000 0.000 0.000
#> SRR2050452     3   0.000      1.000 0.000 0.000 1.000 0.000
#> SRR2050451     4   0.000      0.990 0.000 0.000 0.000 1.000
#> SRR2050450     2   0.000      1.000 0.000 1.000 0.000 0.000
#> SRR2050449     3   0.000      1.000 0.000 0.000 1.000 0.000
#> SRR2050448     4   0.000      0.990 0.000 0.000 0.000 1.000
#> SRR2050447     3   0.000      1.000 0.000 0.000 1.000 0.000
#> SRR2050446     4   0.000      0.990 0.000 0.000 0.000 1.000
#> SRR2050445     2   0.000      1.000 0.000 1.000 0.000 0.000
#> SRR2050444     3   0.000      1.000 0.000 0.000 1.000 0.000
#> SRR2050443     4   0.000      0.990 0.000 0.000 0.000 1.000
#> SRR2050442     2   0.000      1.000 0.000 1.000 0.000 0.000
#> SRR2050441     3   0.000      1.000 0.000 0.000 1.000 0.000
#> SRR2050440     4   0.000      0.990 0.000 0.000 0.000 1.000
#> SRR2050439     2   0.000      1.000 0.000 1.000 0.000 0.000
#> SRR2050438     3   0.000      1.000 0.000 0.000 1.000 0.000
#> SRR2050437     4   0.000      0.990 0.000 0.000 0.000 1.000
#> SRR2050436     4   0.292      0.830 0.000 0.140 0.000 0.860
#> SRR2050435     3   0.000      1.000 0.000 0.000 1.000 0.000
#> SRR2050434     4   0.000      0.990 0.000 0.000 0.000 1.000
#> SRR2050433     2   0.000      1.000 0.000 1.000 0.000 0.000
#> SRR2050432     1   0.000      0.922 1.000 0.000 0.000 0.000
#> SRR2050431     1   0.000      0.922 1.000 0.000 0.000 0.000
#> SRR2050430     1   0.666      0.274 0.512 0.000 0.088 0.400
#> SRR2050429     1   0.000      0.922 1.000 0.000 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>            class entropy silhouette    p1    p2    p3    p4    p5
#> SRR2050410     2   0.000      0.948 0.000 1.000 0.000 0.000 0.000
#> SRR2050427     5   0.000      0.837 0.000 0.000 0.000 0.000 1.000
#> SRR2050426     1   0.311      0.919 0.800 0.000 0.000 0.000 0.200
#> SRR2050425     2   0.000      0.948 0.000 1.000 0.000 0.000 0.000
#> SRR2050424     3   0.000      1.000 0.000 0.000 1.000 0.000 0.000
#> SRR2050423     4   0.000      0.986 0.000 0.000 0.000 1.000 0.000
#> SRR2050422     5   0.697      0.384 0.140 0.044 0.000 0.312 0.504
#> SRR2050421     5   0.000      0.837 0.000 0.000 0.000 0.000 1.000
#> SRR2050420     5   0.407      0.204 0.364 0.000 0.000 0.000 0.636
#> SRR2050419     2   0.000      0.948 0.000 1.000 0.000 0.000 0.000
#> SRR2050418     5   0.233      0.757 0.000 0.000 0.000 0.124 0.876
#> SRR2050417     1   0.252      0.991 0.860 0.000 0.000 0.000 0.140
#> SRR2050416     2   0.000      0.948 0.000 1.000 0.000 0.000 0.000
#> SRR2050415     3   0.000      1.000 0.000 0.000 1.000 0.000 0.000
#> SRR2050414     4   0.000      0.986 0.000 0.000 0.000 1.000 0.000
#> SRR2050413     2   0.485      0.746 0.140 0.724 0.000 0.136 0.000
#> SRR2050412     5   0.000      0.837 0.000 0.000 0.000 0.000 1.000
#> SRR2050411     1   0.252      0.991 0.860 0.000 0.000 0.000 0.140
#> SRR2050409     2   0.000      0.948 0.000 1.000 0.000 0.000 0.000
#> SRR2050408     1   0.252      0.991 0.860 0.000 0.000 0.000 0.140
#> SRR2050407     2   0.000      0.948 0.000 1.000 0.000 0.000 0.000
#> SRR2050406     3   0.000      1.000 0.000 0.000 1.000 0.000 0.000
#> SRR2050405     4   0.000      0.986 0.000 0.000 0.000 1.000 0.000
#> SRR2050404     2   0.000      0.948 0.000 1.000 0.000 0.000 0.000
#> SRR2050403     1   0.252      0.991 0.860 0.000 0.000 0.000 0.140
#> SRR2050402     2   0.252      0.896 0.140 0.860 0.000 0.000 0.000
#> SRR2050401     5   0.000      0.837 0.000 0.000 0.000 0.000 1.000
#> SRR2050400     1   0.252      0.991 0.860 0.000 0.000 0.000 0.140
#> SRR2050399     2   0.252      0.896 0.140 0.860 0.000 0.000 0.000
#> SRR2050398     5   0.000      0.837 0.000 0.000 0.000 0.000 1.000
#> SRR2050397     1   0.252      0.991 0.860 0.000 0.000 0.000 0.140
#> SRR2050396     3   0.000      1.000 0.000 0.000 1.000 0.000 0.000
#> SRR2050395     4   0.000      0.986 0.000 0.000 0.000 1.000 0.000
#> SRR2050394     2   0.252      0.896 0.140 0.860 0.000 0.000 0.000
#> SRR2050393     3   0.000      1.000 0.000 0.000 1.000 0.000 0.000
#> SRR2050392     4   0.000      0.986 0.000 0.000 0.000 1.000 0.000
#> SRR2050465     2   0.000      0.948 0.000 1.000 0.000 0.000 0.000
#> SRR2050464     3   0.000      1.000 0.000 0.000 1.000 0.000 0.000
#> SRR2050463     4   0.000      0.986 0.000 0.000 0.000 1.000 0.000
#> SRR2050462     2   0.000      0.948 0.000 1.000 0.000 0.000 0.000
#> SRR2050461     3   0.000      1.000 0.000 0.000 1.000 0.000 0.000
#> SRR2050460     4   0.000      0.986 0.000 0.000 0.000 1.000 0.000
#> SRR2050459     2   0.000      0.948 0.000 1.000 0.000 0.000 0.000
#> SRR2050458     3   0.000      1.000 0.000 0.000 1.000 0.000 0.000
#> SRR2050457     4   0.000      0.986 0.000 0.000 0.000 1.000 0.000
#> SRR2050456     2   0.000      0.948 0.000 1.000 0.000 0.000 0.000
#> SRR2050455     3   0.000      1.000 0.000 0.000 1.000 0.000 0.000
#> SRR2050454     4   0.000      0.986 0.000 0.000 0.000 1.000 0.000
#> SRR2050453     2   0.000      0.948 0.000 1.000 0.000 0.000 0.000
#> SRR2050452     3   0.000      1.000 0.000 0.000 1.000 0.000 0.000
#> SRR2050451     4   0.000      0.986 0.000 0.000 0.000 1.000 0.000
#> SRR2050450     2   0.000      0.948 0.000 1.000 0.000 0.000 0.000
#> SRR2050449     3   0.000      1.000 0.000 0.000 1.000 0.000 0.000
#> SRR2050448     4   0.000      0.986 0.000 0.000 0.000 1.000 0.000
#> SRR2050447     3   0.000      1.000 0.000 0.000 1.000 0.000 0.000
#> SRR2050446     4   0.000      0.986 0.000 0.000 0.000 1.000 0.000
#> SRR2050445     2   0.000      0.948 0.000 1.000 0.000 0.000 0.000
#> SRR2050444     3   0.000      1.000 0.000 0.000 1.000 0.000 0.000
#> SRR2050443     4   0.000      0.986 0.000 0.000 0.000 1.000 0.000
#> SRR2050442     2   0.252      0.896 0.140 0.860 0.000 0.000 0.000
#> SRR2050441     3   0.000      1.000 0.000 0.000 1.000 0.000 0.000
#> SRR2050440     4   0.000      0.986 0.000 0.000 0.000 1.000 0.000
#> SRR2050439     2   0.252      0.896 0.140 0.860 0.000 0.000 0.000
#> SRR2050438     3   0.000      1.000 0.000 0.000 1.000 0.000 0.000
#> SRR2050437     4   0.000      0.986 0.000 0.000 0.000 1.000 0.000
#> SRR2050436     4   0.387      0.750 0.140 0.060 0.000 0.800 0.000
#> SRR2050435     3   0.000      1.000 0.000 0.000 1.000 0.000 0.000
#> SRR2050434     4   0.000      0.986 0.000 0.000 0.000 1.000 0.000
#> SRR2050433     2   0.252      0.896 0.140 0.860 0.000 0.000 0.000
#> SRR2050432     5   0.000      0.837 0.000 0.000 0.000 0.000 1.000
#> SRR2050431     1   0.252      0.991 0.860 0.000 0.000 0.000 0.140
#> SRR2050430     5   0.379      0.731 0.000 0.000 0.076 0.112 0.812
#> SRR2050429     1   0.252      0.991 0.860 0.000 0.000 0.000 0.140

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>            class entropy silhouette    p1    p2   p3  p4    p5    p6
#> SRR2050410     2   0.000      0.981 0.000 1.000 0.00 0.0 0.000 0.000
#> SRR2050427     6   0.000      0.976 0.000 0.000 0.00 0.0 0.000 1.000
#> SRR2050426     1   0.127      0.898 0.940 0.000 0.00 0.0 0.000 0.060
#> SRR2050425     2   0.000      0.981 0.000 1.000 0.00 0.0 0.000 0.000
#> SRR2050424     3   0.000      1.000 0.000 0.000 1.00 0.0 0.000 0.000
#> SRR2050423     4   0.000      1.000 0.000 0.000 0.00 1.0 0.000 0.000
#> SRR2050422     5   0.000      0.931 0.000 0.000 0.00 0.0 1.000 0.000
#> SRR2050421     6   0.000      0.976 0.000 0.000 0.00 0.0 0.000 1.000
#> SRR2050420     1   0.377      0.328 0.596 0.000 0.00 0.0 0.000 0.404
#> SRR2050419     2   0.000      0.981 0.000 1.000 0.00 0.0 0.000 0.000
#> SRR2050418     6   0.000      0.976 0.000 0.000 0.00 0.0 0.000 1.000
#> SRR2050417     1   0.000      0.947 1.000 0.000 0.00 0.0 0.000 0.000
#> SRR2050416     2   0.000      0.981 0.000 1.000 0.00 0.0 0.000 0.000
#> SRR2050415     3   0.000      1.000 0.000 0.000 1.00 0.0 0.000 0.000
#> SRR2050414     4   0.000      1.000 0.000 0.000 0.00 1.0 0.000 0.000
#> SRR2050413     5   0.000      0.931 0.000 0.000 0.00 0.0 1.000 0.000
#> SRR2050412     6   0.000      0.976 0.000 0.000 0.00 0.0 0.000 1.000
#> SRR2050411     1   0.000      0.947 1.000 0.000 0.00 0.0 0.000 0.000
#> SRR2050409     2   0.000      0.981 0.000 1.000 0.00 0.0 0.000 0.000
#> SRR2050408     1   0.000      0.947 1.000 0.000 0.00 0.0 0.000 0.000
#> SRR2050407     2   0.000      0.981 0.000 1.000 0.00 0.0 0.000 0.000
#> SRR2050406     3   0.000      1.000 0.000 0.000 1.00 0.0 0.000 0.000
#> SRR2050405     4   0.000      1.000 0.000 0.000 0.00 1.0 0.000 0.000
#> SRR2050404     2   0.000      0.981 0.000 1.000 0.00 0.0 0.000 0.000
#> SRR2050403     1   0.000      0.947 1.000 0.000 0.00 0.0 0.000 0.000
#> SRR2050402     5   0.000      0.931 0.000 0.000 0.00 0.0 1.000 0.000
#> SRR2050401     6   0.000      0.976 0.000 0.000 0.00 0.0 0.000 1.000
#> SRR2050400     1   0.000      0.947 1.000 0.000 0.00 0.0 0.000 0.000
#> SRR2050399     5   0.000      0.931 0.000 0.000 0.00 0.0 1.000 0.000
#> SRR2050398     6   0.000      0.976 0.000 0.000 0.00 0.0 0.000 1.000
#> SRR2050397     1   0.000      0.947 1.000 0.000 0.00 0.0 0.000 0.000
#> SRR2050396     3   0.000      1.000 0.000 0.000 1.00 0.0 0.000 0.000
#> SRR2050395     4   0.000      1.000 0.000 0.000 0.00 1.0 0.000 0.000
#> SRR2050394     2   0.308      0.655 0.000 0.760 0.00 0.0 0.240 0.000
#> SRR2050393     3   0.000      1.000 0.000 0.000 1.00 0.0 0.000 0.000
#> SRR2050392     4   0.000      1.000 0.000 0.000 0.00 1.0 0.000 0.000
#> SRR2050465     2   0.000      0.981 0.000 1.000 0.00 0.0 0.000 0.000
#> SRR2050464     3   0.000      1.000 0.000 0.000 1.00 0.0 0.000 0.000
#> SRR2050463     4   0.000      1.000 0.000 0.000 0.00 1.0 0.000 0.000
#> SRR2050462     2   0.000      0.981 0.000 1.000 0.00 0.0 0.000 0.000
#> SRR2050461     3   0.000      1.000 0.000 0.000 1.00 0.0 0.000 0.000
#> SRR2050460     4   0.000      1.000 0.000 0.000 0.00 1.0 0.000 0.000
#> SRR2050459     2   0.000      0.981 0.000 1.000 0.00 0.0 0.000 0.000
#> SRR2050458     3   0.000      1.000 0.000 0.000 1.00 0.0 0.000 0.000
#> SRR2050457     4   0.000      1.000 0.000 0.000 0.00 1.0 0.000 0.000
#> SRR2050456     2   0.000      0.981 0.000 1.000 0.00 0.0 0.000 0.000
#> SRR2050455     3   0.000      1.000 0.000 0.000 1.00 0.0 0.000 0.000
#> SRR2050454     4   0.000      1.000 0.000 0.000 0.00 1.0 0.000 0.000
#> SRR2050453     2   0.000      0.981 0.000 1.000 0.00 0.0 0.000 0.000
#> SRR2050452     3   0.000      1.000 0.000 0.000 1.00 0.0 0.000 0.000
#> SRR2050451     4   0.000      1.000 0.000 0.000 0.00 1.0 0.000 0.000
#> SRR2050450     2   0.000      0.981 0.000 1.000 0.00 0.0 0.000 0.000
#> SRR2050449     3   0.000      1.000 0.000 0.000 1.00 0.0 0.000 0.000
#> SRR2050448     4   0.000      1.000 0.000 0.000 0.00 1.0 0.000 0.000
#> SRR2050447     3   0.000      1.000 0.000 0.000 1.00 0.0 0.000 0.000
#> SRR2050446     4   0.000      1.000 0.000 0.000 0.00 1.0 0.000 0.000
#> SRR2050445     2   0.000      0.981 0.000 1.000 0.00 0.0 0.000 0.000
#> SRR2050444     3   0.000      1.000 0.000 0.000 1.00 0.0 0.000 0.000
#> SRR2050443     4   0.000      1.000 0.000 0.000 0.00 1.0 0.000 0.000
#> SRR2050442     5   0.374      0.324 0.000 0.392 0.00 0.0 0.608 0.000
#> SRR2050441     3   0.000      1.000 0.000 0.000 1.00 0.0 0.000 0.000
#> SRR2050440     4   0.000      1.000 0.000 0.000 0.00 1.0 0.000 0.000
#> SRR2050439     5   0.000      0.931 0.000 0.000 0.00 0.0 1.000 0.000
#> SRR2050438     3   0.000      1.000 0.000 0.000 1.00 0.0 0.000 0.000
#> SRR2050437     4   0.000      1.000 0.000 0.000 0.00 1.0 0.000 0.000
#> SRR2050436     5   0.000      0.931 0.000 0.000 0.00 0.0 1.000 0.000
#> SRR2050435     3   0.000      1.000 0.000 0.000 1.00 0.0 0.000 0.000
#> SRR2050434     4   0.000      1.000 0.000 0.000 0.00 1.0 0.000 0.000
#> SRR2050433     5   0.000      0.931 0.000 0.000 0.00 0.0 1.000 0.000
#> SRR2050432     6   0.000      0.976 0.000 0.000 0.00 0.0 0.000 1.000
#> SRR2050431     1   0.000      0.947 1.000 0.000 0.00 0.0 0.000 0.000
#> SRR2050430     6   0.304      0.824 0.000 0.000 0.06 0.1 0.000 0.840
#> SRR2050429     1   0.000      0.947 1.000 0.000 0.00 0.0 0.000 0.000

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

consensus_heatmap(res, k = 2)

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

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

collect_plots(res)

plot of chunk CV-mclust-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.503           0.785       0.835         0.3995 0.638   0.638
#> 3 3 0.827           0.931       0.948         0.6464 0.655   0.475
#> 4 4 0.779           0.747       0.863         0.0848 0.917   0.773
#> 5 5 0.940           0.920       0.944         0.1170 0.879   0.620
#> 6 6 0.926           0.913       0.934         0.0325 0.975   0.876

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

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

There is also optional best \(k\) = 5 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
#> SRR2050410     2   0.000      0.723 0.000 1.000
#> SRR2050427     1   0.000      1.000 1.000 0.000
#> SRR2050426     1   0.000      1.000 1.000 0.000
#> SRR2050425     2   0.000      0.723 0.000 1.000
#> SRR2050424     2   0.936      0.734 0.352 0.648
#> SRR2050423     2   0.971      0.700 0.400 0.600
#> SRR2050422     2   0.000      0.723 0.000 1.000
#> SRR2050421     1   0.000      1.000 1.000 0.000
#> SRR2050420     1   0.000      1.000 1.000 0.000
#> SRR2050419     2   0.000      0.723 0.000 1.000
#> SRR2050418     1   0.000      1.000 1.000 0.000
#> SRR2050417     1   0.000      1.000 1.000 0.000
#> SRR2050416     2   0.000      0.723 0.000 1.000
#> SRR2050415     2   0.936      0.734 0.352 0.648
#> SRR2050414     2   0.971      0.700 0.400 0.600
#> SRR2050413     2   0.000      0.723 0.000 1.000
#> SRR2050412     1   0.000      1.000 1.000 0.000
#> SRR2050411     1   0.000      1.000 1.000 0.000
#> SRR2050409     2   0.000      0.723 0.000 1.000
#> SRR2050408     1   0.000      1.000 1.000 0.000
#> SRR2050407     2   0.000      0.723 0.000 1.000
#> SRR2050406     2   0.936      0.734 0.352 0.648
#> SRR2050405     2   0.971      0.700 0.400 0.600
#> SRR2050404     2   0.000      0.723 0.000 1.000
#> SRR2050403     1   0.000      1.000 1.000 0.000
#> SRR2050402     2   0.000      0.723 0.000 1.000
#> SRR2050401     1   0.000      1.000 1.000 0.000
#> SRR2050400     1   0.000      1.000 1.000 0.000
#> SRR2050399     2   0.000      0.723 0.000 1.000
#> SRR2050398     1   0.000      1.000 1.000 0.000
#> SRR2050397     1   0.000      1.000 1.000 0.000
#> SRR2050396     2   0.939      0.731 0.356 0.644
#> SRR2050395     2   0.971      0.700 0.400 0.600
#> SRR2050394     2   0.000      0.723 0.000 1.000
#> SRR2050393     2   0.936      0.734 0.352 0.648
#> SRR2050392     2   0.969      0.702 0.396 0.604
#> SRR2050465     2   0.000      0.723 0.000 1.000
#> SRR2050464     2   0.936      0.734 0.352 0.648
#> SRR2050463     2   0.971      0.700 0.400 0.600
#> SRR2050462     2   0.000      0.723 0.000 1.000
#> SRR2050461     2   0.936      0.734 0.352 0.648
#> SRR2050460     2   0.971      0.700 0.400 0.600
#> SRR2050459     2   0.000      0.723 0.000 1.000
#> SRR2050458     2   0.936      0.734 0.352 0.648
#> SRR2050457     2   0.971      0.700 0.400 0.600
#> SRR2050456     2   0.000      0.723 0.000 1.000
#> SRR2050455     2   0.936      0.734 0.352 0.648
#> SRR2050454     2   0.971      0.700 0.400 0.600
#> SRR2050453     2   0.000      0.723 0.000 1.000
#> SRR2050452     2   0.936      0.734 0.352 0.648
#> SRR2050451     2   0.971      0.700 0.400 0.600
#> SRR2050450     2   0.000      0.723 0.000 1.000
#> SRR2050449     2   0.936      0.734 0.352 0.648
#> SRR2050448     2   0.971      0.700 0.400 0.600
#> SRR2050447     2   0.936      0.734 0.352 0.648
#> SRR2050446     2   0.971      0.700 0.400 0.600
#> SRR2050445     2   0.000      0.723 0.000 1.000
#> SRR2050444     2   0.936      0.734 0.352 0.648
#> SRR2050443     2   0.971      0.700 0.400 0.600
#> SRR2050442     2   0.000      0.723 0.000 1.000
#> SRR2050441     2   0.936      0.734 0.352 0.648
#> SRR2050440     2   0.966      0.706 0.392 0.608
#> SRR2050439     2   0.000      0.723 0.000 1.000
#> SRR2050438     2   0.936      0.734 0.352 0.648
#> SRR2050437     2   0.971      0.700 0.400 0.600
#> SRR2050436     2   0.000      0.723 0.000 1.000
#> SRR2050435     2   0.936      0.734 0.352 0.648
#> SRR2050434     2   0.000      0.723 0.000 1.000
#> SRR2050433     2   0.000      0.723 0.000 1.000
#> SRR2050432     1   0.000      1.000 1.000 0.000
#> SRR2050431     1   0.000      1.000 1.000 0.000
#> SRR2050430     2   0.973      0.694 0.404 0.596
#> SRR2050429     1   0.000      1.000 1.000 0.000

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>            class entropy silhouette    p1    p2    p3
#> SRR2050410     2  0.0000      1.000 0.000 1.000 0.000
#> SRR2050427     1  0.0000      0.926 1.000 0.000 0.000
#> SRR2050426     1  0.0000      0.926 1.000 0.000 0.000
#> SRR2050425     2  0.0000      1.000 0.000 1.000 0.000
#> SRR2050424     3  0.0424      0.917 0.008 0.000 0.992
#> SRR2050423     3  0.3989      0.924 0.124 0.012 0.864
#> SRR2050422     2  0.0000      1.000 0.000 1.000 0.000
#> SRR2050421     1  0.0000      0.926 1.000 0.000 0.000
#> SRR2050420     1  0.0000      0.926 1.000 0.000 0.000
#> SRR2050419     2  0.0000      1.000 0.000 1.000 0.000
#> SRR2050418     1  0.3816      0.812 0.852 0.000 0.148
#> SRR2050417     1  0.0892      0.924 0.980 0.000 0.020
#> SRR2050416     2  0.0000      1.000 0.000 1.000 0.000
#> SRR2050415     3  0.0424      0.917 0.008 0.000 0.992
#> SRR2050414     3  0.3845      0.927 0.116 0.012 0.872
#> SRR2050413     2  0.0000      1.000 0.000 1.000 0.000
#> SRR2050412     1  0.0000      0.926 1.000 0.000 0.000
#> SRR2050411     1  0.0000      0.926 1.000 0.000 0.000
#> SRR2050409     2  0.0000      1.000 0.000 1.000 0.000
#> SRR2050408     1  0.0892      0.924 0.980 0.000 0.020
#> SRR2050407     2  0.0000      1.000 0.000 1.000 0.000
#> SRR2050406     3  0.0424      0.917 0.008 0.000 0.992
#> SRR2050405     3  0.3845      0.927 0.116 0.012 0.872
#> SRR2050404     2  0.0000      1.000 0.000 1.000 0.000
#> SRR2050403     1  0.0892      0.924 0.980 0.000 0.020
#> SRR2050402     2  0.0000      1.000 0.000 1.000 0.000
#> SRR2050401     1  0.0000      0.926 1.000 0.000 0.000
#> SRR2050400     1  0.1031      0.917 0.976 0.000 0.024
#> SRR2050399     2  0.0000      1.000 0.000 1.000 0.000
#> SRR2050398     1  0.0000      0.926 1.000 0.000 0.000
#> SRR2050397     1  0.0892      0.924 0.980 0.000 0.020
#> SRR2050396     3  0.3377      0.930 0.092 0.012 0.896
#> SRR2050395     3  0.3989      0.924 0.124 0.012 0.864
#> SRR2050394     2  0.0000      1.000 0.000 1.000 0.000
#> SRR2050393     3  0.2448      0.927 0.076 0.000 0.924
#> SRR2050392     3  0.3845      0.927 0.116 0.012 0.872
#> SRR2050465     2  0.0000      1.000 0.000 1.000 0.000
#> SRR2050464     3  0.0424      0.917 0.008 0.000 0.992
#> SRR2050463     3  0.3845      0.927 0.116 0.012 0.872
#> SRR2050462     2  0.0000      1.000 0.000 1.000 0.000
#> SRR2050461     3  0.2066      0.923 0.060 0.000 0.940
#> SRR2050460     3  0.3918      0.924 0.120 0.012 0.868
#> SRR2050459     2  0.0000      1.000 0.000 1.000 0.000
#> SRR2050458     3  0.0747      0.920 0.016 0.000 0.984
#> SRR2050457     3  0.3845      0.927 0.116 0.012 0.872
#> SRR2050456     2  0.0000      1.000 0.000 1.000 0.000
#> SRR2050455     3  0.0424      0.917 0.008 0.000 0.992
#> SRR2050454     3  0.3845      0.927 0.116 0.012 0.872
#> SRR2050453     2  0.0000      1.000 0.000 1.000 0.000
#> SRR2050452     3  0.0424      0.917 0.008 0.000 0.992
#> SRR2050451     3  0.3845      0.927 0.116 0.012 0.872
#> SRR2050450     2  0.0000      1.000 0.000 1.000 0.000
#> SRR2050449     3  0.0424      0.917 0.008 0.000 0.992
#> SRR2050448     3  0.3845      0.927 0.116 0.012 0.872
#> SRR2050447     3  0.0424      0.917 0.008 0.000 0.992
#> SRR2050446     3  0.3845      0.927 0.116 0.012 0.872
#> SRR2050445     2  0.0000      1.000 0.000 1.000 0.000
#> SRR2050444     3  0.0424      0.917 0.008 0.000 0.992
#> SRR2050443     3  0.3845      0.927 0.116 0.012 0.872
#> SRR2050442     2  0.0000      1.000 0.000 1.000 0.000
#> SRR2050441     3  0.2165      0.924 0.064 0.000 0.936
#> SRR2050440     1  0.6172      0.543 0.680 0.012 0.308
#> SRR2050439     2  0.0000      1.000 0.000 1.000 0.000
#> SRR2050438     3  0.3038      0.925 0.104 0.000 0.896
#> SRR2050437     1  0.6172      0.543 0.680 0.012 0.308
#> SRR2050436     2  0.0000      1.000 0.000 1.000 0.000
#> SRR2050435     3  0.1964      0.921 0.056 0.000 0.944
#> SRR2050434     2  0.0000      1.000 0.000 1.000 0.000
#> SRR2050433     2  0.0000      1.000 0.000 1.000 0.000
#> SRR2050432     1  0.0424      0.926 0.992 0.000 0.008
#> SRR2050431     1  0.0892      0.924 0.980 0.000 0.020
#> SRR2050430     1  0.6172      0.543 0.680 0.012 0.308
#> SRR2050429     1  0.0892      0.924 0.980 0.000 0.020

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> SRR2050410     2  0.2704      0.560 0.000 0.876 0.000 0.124
#> SRR2050427     1  0.0000      0.977 1.000 0.000 0.000 0.000
#> SRR2050426     1  0.0000      0.977 1.000 0.000 0.000 0.000
#> SRR2050425     2  0.4164      0.422 0.000 0.736 0.000 0.264
#> SRR2050424     3  0.3569      0.888 0.000 0.000 0.804 0.196
#> SRR2050423     3  0.0000      0.887 0.000 0.000 1.000 0.000
#> SRR2050422     4  0.4522      1.000 0.000 0.320 0.000 0.680
#> SRR2050421     1  0.0000      0.977 1.000 0.000 0.000 0.000
#> SRR2050420     1  0.0000      0.977 1.000 0.000 0.000 0.000
#> SRR2050419     2  0.2704      0.560 0.000 0.876 0.000 0.124
#> SRR2050418     1  0.4250      0.583 0.724 0.000 0.276 0.000
#> SRR2050417     1  0.0000      0.977 1.000 0.000 0.000 0.000
#> SRR2050416     2  0.4981     -0.202 0.000 0.536 0.000 0.464
#> SRR2050415     3  0.3569      0.888 0.000 0.000 0.804 0.196
#> SRR2050414     3  0.0000      0.887 0.000 0.000 1.000 0.000
#> SRR2050413     4  0.4522      1.000 0.000 0.320 0.000 0.680
#> SRR2050412     1  0.0000      0.977 1.000 0.000 0.000 0.000
#> SRR2050411     1  0.0000      0.977 1.000 0.000 0.000 0.000
#> SRR2050409     2  0.2704      0.560 0.000 0.876 0.000 0.124
#> SRR2050408     1  0.0000      0.977 1.000 0.000 0.000 0.000
#> SRR2050407     2  0.0000      0.577 0.000 1.000 0.000 0.000
#> SRR2050406     3  0.3569      0.888 0.000 0.000 0.804 0.196
#> SRR2050405     3  0.0000      0.887 0.000 0.000 1.000 0.000
#> SRR2050404     2  0.4564      0.288 0.000 0.672 0.000 0.328
#> SRR2050403     1  0.0000      0.977 1.000 0.000 0.000 0.000
#> SRR2050402     2  0.4994     -0.266 0.000 0.520 0.000 0.480
#> SRR2050401     1  0.0000      0.977 1.000 0.000 0.000 0.000
#> SRR2050400     1  0.0000      0.977 1.000 0.000 0.000 0.000
#> SRR2050399     2  0.4994     -0.266 0.000 0.520 0.000 0.480
#> SRR2050398     1  0.0000      0.977 1.000 0.000 0.000 0.000
#> SRR2050397     1  0.0000      0.977 1.000 0.000 0.000 0.000
#> SRR2050396     3  0.1938      0.890 0.012 0.000 0.936 0.052
#> SRR2050395     3  0.0000      0.887 0.000 0.000 1.000 0.000
#> SRR2050394     2  0.1940      0.577 0.000 0.924 0.000 0.076
#> SRR2050393     3  0.3569      0.888 0.000 0.000 0.804 0.196
#> SRR2050392     3  0.0336      0.884 0.000 0.008 0.992 0.000
#> SRR2050465     2  0.1940      0.577 0.000 0.924 0.000 0.076
#> SRR2050464     3  0.3569      0.888 0.000 0.000 0.804 0.196
#> SRR2050463     3  0.0000      0.887 0.000 0.000 1.000 0.000
#> SRR2050462     2  0.3764      0.486 0.000 0.784 0.000 0.216
#> SRR2050461     3  0.3569      0.888 0.000 0.000 0.804 0.196
#> SRR2050460     3  0.0000      0.887 0.000 0.000 1.000 0.000
#> SRR2050459     2  0.2704      0.560 0.000 0.876 0.000 0.124
#> SRR2050458     3  0.3569      0.888 0.000 0.000 0.804 0.196
#> SRR2050457     3  0.0336      0.884 0.000 0.008 0.992 0.000
#> SRR2050456     2  0.2704      0.560 0.000 0.876 0.000 0.124
#> SRR2050455     3  0.3569      0.888 0.000 0.000 0.804 0.196
#> SRR2050454     3  0.0000      0.887 0.000 0.000 1.000 0.000
#> SRR2050453     2  0.2081      0.574 0.000 0.916 0.000 0.084
#> SRR2050452     3  0.3569      0.888 0.000 0.000 0.804 0.196
#> SRR2050451     3  0.0000      0.887 0.000 0.000 1.000 0.000
#> SRR2050450     2  0.3764      0.486 0.000 0.784 0.000 0.216
#> SRR2050449     3  0.3569      0.888 0.000 0.000 0.804 0.196
#> SRR2050448     3  0.0000      0.887 0.000 0.000 1.000 0.000
#> SRR2050447     3  0.3569      0.888 0.000 0.000 0.804 0.196
#> SRR2050446     3  0.0000      0.887 0.000 0.000 1.000 0.000
#> SRR2050445     2  0.2704      0.560 0.000 0.876 0.000 0.124
#> SRR2050444     3  0.3569      0.888 0.000 0.000 0.804 0.196
#> SRR2050443     3  0.0000      0.887 0.000 0.000 1.000 0.000
#> SRR2050442     2  0.4981     -0.202 0.000 0.536 0.000 0.464
#> SRR2050441     3  0.3569      0.888 0.000 0.000 0.804 0.196
#> SRR2050440     3  0.5548      0.679 0.084 0.000 0.716 0.200
#> SRR2050439     2  0.4981     -0.202 0.000 0.536 0.000 0.464
#> SRR2050438     3  0.4344      0.870 0.076 0.000 0.816 0.108
#> SRR2050437     3  0.5548      0.679 0.084 0.000 0.716 0.200
#> SRR2050436     4  0.4522      1.000 0.000 0.320 0.000 0.680
#> SRR2050435     3  0.3569      0.888 0.000 0.000 0.804 0.196
#> SRR2050434     4  0.4522      1.000 0.000 0.320 0.000 0.680
#> SRR2050433     2  0.4406      0.359 0.000 0.700 0.000 0.300
#> SRR2050432     1  0.0000      0.977 1.000 0.000 0.000 0.000
#> SRR2050431     1  0.0000      0.977 1.000 0.000 0.000 0.000
#> SRR2050430     3  0.5548      0.679 0.084 0.000 0.716 0.200
#> SRR2050429     1  0.0000      0.977 1.000 0.000 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>            class entropy silhouette    p1    p2    p3    p4    p5
#> SRR2050410     2  0.2020      0.766 0.000 0.900 0.000 0.000 0.100
#> SRR2050427     1  0.0000      0.995 1.000 0.000 0.000 0.000 0.000
#> SRR2050426     1  0.0000      0.995 1.000 0.000 0.000 0.000 0.000
#> SRR2050425     2  0.2516      0.856 0.000 0.860 0.000 0.000 0.140
#> SRR2050424     3  0.0000      0.988 0.000 0.000 1.000 0.000 0.000
#> SRR2050423     4  0.0000      0.987 0.000 0.000 0.000 1.000 0.000
#> SRR2050422     5  0.1965      0.873 0.000 0.096 0.000 0.000 0.904
#> SRR2050421     1  0.0000      0.995 1.000 0.000 0.000 0.000 0.000
#> SRR2050420     1  0.0000      0.995 1.000 0.000 0.000 0.000 0.000
#> SRR2050419     2  0.1121      0.803 0.000 0.956 0.000 0.000 0.044
#> SRR2050418     1  0.1704      0.913 0.928 0.000 0.000 0.068 0.004
#> SRR2050417     1  0.0000      0.995 1.000 0.000 0.000 0.000 0.000
#> SRR2050416     2  0.2561      0.854 0.000 0.856 0.000 0.000 0.144
#> SRR2050415     3  0.0000      0.988 0.000 0.000 1.000 0.000 0.000
#> SRR2050414     4  0.0000      0.987 0.000 0.000 0.000 1.000 0.000
#> SRR2050413     5  0.1544      0.871 0.000 0.068 0.000 0.000 0.932
#> SRR2050412     1  0.0000      0.995 1.000 0.000 0.000 0.000 0.000
#> SRR2050411     1  0.0000      0.995 1.000 0.000 0.000 0.000 0.000
#> SRR2050409     2  0.2020      0.766 0.000 0.900 0.000 0.000 0.100
#> SRR2050408     1  0.0000      0.995 1.000 0.000 0.000 0.000 0.000
#> SRR2050407     2  0.2280      0.855 0.000 0.880 0.000 0.000 0.120
#> SRR2050406     3  0.0000      0.988 0.000 0.000 1.000 0.000 0.000
#> SRR2050405     4  0.0000      0.987 0.000 0.000 0.000 1.000 0.000
#> SRR2050404     2  0.2516      0.856 0.000 0.860 0.000 0.000 0.140
#> SRR2050403     1  0.0000      0.995 1.000 0.000 0.000 0.000 0.000
#> SRR2050402     5  0.2127      0.855 0.000 0.108 0.000 0.000 0.892
#> SRR2050401     1  0.0000      0.995 1.000 0.000 0.000 0.000 0.000
#> SRR2050400     1  0.0000      0.995 1.000 0.000 0.000 0.000 0.000
#> SRR2050399     5  0.2020      0.872 0.000 0.100 0.000 0.000 0.900
#> SRR2050398     1  0.0000      0.995 1.000 0.000 0.000 0.000 0.000
#> SRR2050397     1  0.0000      0.995 1.000 0.000 0.000 0.000 0.000
#> SRR2050396     3  0.2583      0.834 0.000 0.000 0.864 0.132 0.004
#> SRR2050395     4  0.0000      0.987 0.000 0.000 0.000 1.000 0.000
#> SRR2050394     2  0.2732      0.842 0.000 0.840 0.000 0.000 0.160
#> SRR2050393     3  0.0324      0.984 0.000 0.000 0.992 0.004 0.004
#> SRR2050392     4  0.0000      0.987 0.000 0.000 0.000 1.000 0.000
#> SRR2050465     2  0.1908      0.851 0.000 0.908 0.000 0.000 0.092
#> SRR2050464     3  0.0000      0.988 0.000 0.000 1.000 0.000 0.000
#> SRR2050463     4  0.0000      0.987 0.000 0.000 0.000 1.000 0.000
#> SRR2050462     2  0.2516      0.856 0.000 0.860 0.000 0.000 0.140
#> SRR2050461     3  0.0162      0.986 0.000 0.000 0.996 0.000 0.004
#> SRR2050460     4  0.0000      0.987 0.000 0.000 0.000 1.000 0.000
#> SRR2050459     2  0.0880      0.808 0.000 0.968 0.000 0.000 0.032
#> SRR2050458     3  0.0000      0.988 0.000 0.000 1.000 0.000 0.000
#> SRR2050457     4  0.0000      0.987 0.000 0.000 0.000 1.000 0.000
#> SRR2050456     2  0.2020      0.766 0.000 0.900 0.000 0.000 0.100
#> SRR2050455     3  0.0000      0.988 0.000 0.000 1.000 0.000 0.000
#> SRR2050454     4  0.0000      0.987 0.000 0.000 0.000 1.000 0.000
#> SRR2050453     2  0.2516      0.856 0.000 0.860 0.000 0.000 0.140
#> SRR2050452     3  0.0000      0.988 0.000 0.000 1.000 0.000 0.000
#> SRR2050451     4  0.0000      0.987 0.000 0.000 0.000 1.000 0.000
#> SRR2050450     2  0.2516      0.856 0.000 0.860 0.000 0.000 0.140
#> SRR2050449     3  0.0000      0.988 0.000 0.000 1.000 0.000 0.000
#> SRR2050448     4  0.0000      0.987 0.000 0.000 0.000 1.000 0.000
#> SRR2050447     3  0.0000      0.988 0.000 0.000 1.000 0.000 0.000
#> SRR2050446     4  0.0000      0.987 0.000 0.000 0.000 1.000 0.000
#> SRR2050445     2  0.0880      0.808 0.000 0.968 0.000 0.000 0.032
#> SRR2050444     3  0.0000      0.988 0.000 0.000 1.000 0.000 0.000
#> SRR2050443     4  0.0000      0.987 0.000 0.000 0.000 1.000 0.000
#> SRR2050442     2  0.3752      0.678 0.000 0.708 0.000 0.000 0.292
#> SRR2050441     3  0.0162      0.986 0.000 0.000 0.996 0.000 0.004
#> SRR2050440     4  0.1741      0.943 0.024 0.000 0.000 0.936 0.040
#> SRR2050439     2  0.4138      0.481 0.000 0.616 0.000 0.000 0.384
#> SRR2050438     3  0.0451      0.979 0.008 0.000 0.988 0.000 0.004
#> SRR2050437     4  0.1741      0.943 0.024 0.000 0.000 0.936 0.040
#> SRR2050436     5  0.2074      0.869 0.000 0.104 0.000 0.000 0.896
#> SRR2050435     3  0.0162      0.986 0.000 0.000 0.996 0.000 0.004
#> SRR2050434     5  0.2929      0.787 0.000 0.180 0.000 0.000 0.820
#> SRR2050433     5  0.4291      0.365 0.000 0.464 0.000 0.000 0.536
#> SRR2050432     1  0.0000      0.995 1.000 0.000 0.000 0.000 0.000
#> SRR2050431     1  0.0000      0.995 1.000 0.000 0.000 0.000 0.000
#> SRR2050430     4  0.1741      0.943 0.024 0.000 0.000 0.936 0.040
#> SRR2050429     1  0.0000      0.995 1.000 0.000 0.000 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>            class entropy silhouette    p1    p2    p3    p4    p5    p6
#> SRR2050410     6  0.2092    0.99868 0.000 0.124 0.000 0.000 0.000 0.876
#> SRR2050427     1  0.0520    0.94028 0.984 0.000 0.000 0.000 0.008 0.008
#> SRR2050426     1  0.1528    0.93765 0.936 0.000 0.000 0.000 0.016 0.048
#> SRR2050425     2  0.0547    0.83238 0.000 0.980 0.000 0.000 0.000 0.020
#> SRR2050424     3  0.0000    0.98164 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2050423     4  0.0000    0.99618 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR2050422     5  0.1204    0.90723 0.000 0.056 0.000 0.000 0.944 0.000
#> SRR2050421     1  0.0717    0.93812 0.976 0.000 0.000 0.000 0.016 0.008
#> SRR2050420     1  0.1633    0.93803 0.932 0.000 0.000 0.000 0.024 0.044
#> SRR2050419     6  0.2092    0.99868 0.000 0.124 0.000 0.000 0.000 0.876
#> SRR2050418     1  0.2389    0.81895 0.864 0.000 0.000 0.128 0.000 0.008
#> SRR2050417     1  0.2358    0.92172 0.876 0.000 0.000 0.000 0.016 0.108
#> SRR2050416     2  0.1858    0.79643 0.000 0.904 0.000 0.000 0.004 0.092
#> SRR2050415     3  0.0000    0.98164 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2050414     4  0.0000    0.99618 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR2050413     5  0.1204    0.90723 0.000 0.056 0.000 0.000 0.944 0.000
#> SRR2050412     1  0.0520    0.94028 0.984 0.000 0.000 0.000 0.008 0.008
#> SRR2050411     1  0.2358    0.92172 0.876 0.000 0.000 0.000 0.016 0.108
#> SRR2050409     6  0.2092    0.99868 0.000 0.124 0.000 0.000 0.000 0.876
#> SRR2050408     1  0.2358    0.92172 0.876 0.000 0.000 0.000 0.016 0.108
#> SRR2050407     2  0.2416    0.73209 0.000 0.844 0.000 0.000 0.000 0.156
#> SRR2050406     3  0.0000    0.98164 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2050405     4  0.0000    0.99618 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR2050404     2  0.0000    0.83483 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2050403     1  0.2358    0.92172 0.876 0.000 0.000 0.000 0.016 0.108
#> SRR2050402     5  0.1957    0.87666 0.000 0.112 0.000 0.000 0.888 0.000
#> SRR2050401     1  0.0520    0.94028 0.984 0.000 0.000 0.000 0.008 0.008
#> SRR2050400     1  0.0914    0.93528 0.968 0.000 0.000 0.000 0.016 0.016
#> SRR2050399     5  0.1663    0.89736 0.000 0.088 0.000 0.000 0.912 0.000
#> SRR2050398     1  0.0520    0.94028 0.984 0.000 0.000 0.000 0.008 0.008
#> SRR2050397     1  0.2358    0.92172 0.876 0.000 0.000 0.000 0.016 0.108
#> SRR2050396     3  0.2706    0.77849 0.000 0.000 0.832 0.160 0.000 0.008
#> SRR2050395     4  0.0000    0.99618 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR2050394     2  0.1957    0.77695 0.000 0.888 0.000 0.000 0.000 0.112
#> SRR2050393     3  0.0260    0.97924 0.000 0.000 0.992 0.000 0.008 0.000
#> SRR2050392     4  0.0146    0.99497 0.000 0.000 0.000 0.996 0.000 0.004
#> SRR2050465     2  0.3862    0.00543 0.000 0.524 0.000 0.000 0.000 0.476
#> SRR2050464     3  0.0000    0.98164 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2050463     4  0.0000    0.99618 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR2050462     2  0.0000    0.83483 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2050461     3  0.0547    0.97480 0.000 0.000 0.980 0.000 0.020 0.000
#> SRR2050460     4  0.0000    0.99618 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR2050459     6  0.2135    0.99339 0.000 0.128 0.000 0.000 0.000 0.872
#> SRR2050458     3  0.0000    0.98164 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2050457     4  0.0146    0.99497 0.000 0.000 0.000 0.996 0.000 0.004
#> SRR2050456     6  0.2092    0.99868 0.000 0.124 0.000 0.000 0.000 0.876
#> SRR2050455     3  0.0000    0.98164 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2050454     4  0.0146    0.99497 0.000 0.000 0.000 0.996 0.000 0.004
#> SRR2050453     2  0.0260    0.83450 0.000 0.992 0.000 0.000 0.000 0.008
#> SRR2050452     3  0.0000    0.98164 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2050451     4  0.0000    0.99618 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR2050450     2  0.0000    0.83483 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2050449     3  0.0000    0.98164 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2050448     4  0.0000    0.99618 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR2050447     3  0.0000    0.98164 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2050446     4  0.0000    0.99618 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR2050445     6  0.2092    0.99868 0.000 0.124 0.000 0.000 0.000 0.876
#> SRR2050444     3  0.0000    0.98164 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2050443     4  0.0146    0.99497 0.000 0.000 0.000 0.996 0.000 0.004
#> SRR2050442     2  0.2597    0.70257 0.000 0.824 0.000 0.000 0.176 0.000
#> SRR2050441     3  0.0547    0.97480 0.000 0.000 0.980 0.000 0.020 0.000
#> SRR2050440     4  0.0508    0.98771 0.000 0.000 0.000 0.984 0.012 0.004
#> SRR2050439     2  0.3592    0.42247 0.000 0.656 0.000 0.000 0.344 0.000
#> SRR2050438     3  0.0547    0.97480 0.000 0.000 0.980 0.000 0.020 0.000
#> SRR2050437     4  0.0508    0.98771 0.000 0.000 0.000 0.984 0.012 0.004
#> SRR2050436     5  0.1204    0.90723 0.000 0.056 0.000 0.000 0.944 0.000
#> SRR2050435     3  0.0547    0.97480 0.000 0.000 0.980 0.000 0.020 0.000
#> SRR2050434     5  0.1333    0.87973 0.000 0.008 0.000 0.000 0.944 0.048
#> SRR2050433     5  0.4597    0.53303 0.000 0.072 0.000 0.000 0.652 0.276
#> SRR2050432     1  0.0520    0.94028 0.984 0.000 0.000 0.000 0.008 0.008
#> SRR2050431     1  0.0000    0.94132 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2050430     4  0.0508    0.98771 0.000 0.000 0.000 0.984 0.012 0.004
#> SRR2050429     1  0.1528    0.93765 0.936 0.000 0.000 0.000 0.016 0.048

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

consensus_heatmap(res, k = 2)

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

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

collect_plots(res)

plot of chunk CV-NMF-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.942           0.898       0.962         0.4902 0.514   0.514
#> 3 3 0.892           0.869       0.925         0.3442 0.779   0.587
#> 4 4 0.809           0.857       0.931         0.1324 0.821   0.535
#> 5 5 0.918           0.855       0.942         0.0758 0.893   0.617
#> 6 6 0.895           0.845       0.906         0.0326 0.952   0.769

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
#> SRR2050410     2  0.0000      0.974 0.000 1.000
#> SRR2050427     1  0.0000      0.949 1.000 0.000
#> SRR2050426     1  0.0000      0.949 1.000 0.000
#> SRR2050425     2  0.0000      0.974 0.000 1.000
#> SRR2050424     1  0.0000      0.949 1.000 0.000
#> SRR2050423     1  0.0000      0.949 1.000 0.000
#> SRR2050422     2  0.0000      0.974 0.000 1.000
#> SRR2050421     1  0.0000      0.949 1.000 0.000
#> SRR2050420     1  0.0000      0.949 1.000 0.000
#> SRR2050419     2  0.0000      0.974 0.000 1.000
#> SRR2050418     1  0.2948      0.905 0.948 0.052
#> SRR2050417     1  0.4022      0.878 0.920 0.080
#> SRR2050416     2  0.0000      0.974 0.000 1.000
#> SRR2050415     1  0.0000      0.949 1.000 0.000
#> SRR2050414     1  0.9977      0.135 0.528 0.472
#> SRR2050413     2  0.0000      0.974 0.000 1.000
#> SRR2050412     1  0.0000      0.949 1.000 0.000
#> SRR2050411     1  0.0000      0.949 1.000 0.000
#> SRR2050409     2  0.0000      0.974 0.000 1.000
#> SRR2050408     1  0.3431      0.894 0.936 0.064
#> SRR2050407     2  0.0000      0.974 0.000 1.000
#> SRR2050406     1  0.0000      0.949 1.000 0.000
#> SRR2050405     1  0.0376      0.946 0.996 0.004
#> SRR2050404     2  0.0000      0.974 0.000 1.000
#> SRR2050403     1  0.0000      0.949 1.000 0.000
#> SRR2050402     2  0.0000      0.974 0.000 1.000
#> SRR2050401     1  0.0000      0.949 1.000 0.000
#> SRR2050400     1  0.0000      0.949 1.000 0.000
#> SRR2050399     2  0.0000      0.974 0.000 1.000
#> SRR2050398     1  0.0000      0.949 1.000 0.000
#> SRR2050397     1  0.0000      0.949 1.000 0.000
#> SRR2050396     1  0.0000      0.949 1.000 0.000
#> SRR2050395     1  0.0000      0.949 1.000 0.000
#> SRR2050394     2  0.0000      0.974 0.000 1.000
#> SRR2050393     1  0.0000      0.949 1.000 0.000
#> SRR2050392     2  0.0376      0.971 0.004 0.996
#> SRR2050465     2  0.0000      0.974 0.000 1.000
#> SRR2050464     1  0.0000      0.949 1.000 0.000
#> SRR2050463     1  0.9988      0.106 0.520 0.480
#> SRR2050462     2  0.0000      0.974 0.000 1.000
#> SRR2050461     1  0.0000      0.949 1.000 0.000
#> SRR2050460     1  0.0000      0.949 1.000 0.000
#> SRR2050459     2  0.0000      0.974 0.000 1.000
#> SRR2050458     1  0.0000      0.949 1.000 0.000
#> SRR2050457     2  0.0000      0.974 0.000 1.000
#> SRR2050456     2  0.0000      0.974 0.000 1.000
#> SRR2050455     1  0.0000      0.949 1.000 0.000
#> SRR2050454     1  0.9933      0.199 0.548 0.452
#> SRR2050453     2  0.0000      0.974 0.000 1.000
#> SRR2050452     1  0.0000      0.949 1.000 0.000
#> SRR2050451     2  0.9881      0.162 0.436 0.564
#> SRR2050450     2  0.0000      0.974 0.000 1.000
#> SRR2050449     1  0.0000      0.949 1.000 0.000
#> SRR2050448     2  0.5737      0.825 0.136 0.864
#> SRR2050447     1  0.0000      0.949 1.000 0.000
#> SRR2050446     1  0.9988      0.107 0.520 0.480
#> SRR2050445     2  0.0000      0.974 0.000 1.000
#> SRR2050444     1  0.0000      0.949 1.000 0.000
#> SRR2050443     2  0.4431      0.881 0.092 0.908
#> SRR2050442     2  0.0000      0.974 0.000 1.000
#> SRR2050441     1  0.0000      0.949 1.000 0.000
#> SRR2050440     1  0.0000      0.949 1.000 0.000
#> SRR2050439     2  0.0000      0.974 0.000 1.000
#> SRR2050438     1  0.0000      0.949 1.000 0.000
#> SRR2050437     1  0.0000      0.949 1.000 0.000
#> SRR2050436     2  0.0000      0.974 0.000 1.000
#> SRR2050435     1  0.0000      0.949 1.000 0.000
#> SRR2050434     2  0.0000      0.974 0.000 1.000
#> SRR2050433     2  0.0000      0.974 0.000 1.000
#> SRR2050432     1  0.0000      0.949 1.000 0.000
#> SRR2050431     1  0.0000      0.949 1.000 0.000
#> SRR2050430     1  0.0000      0.949 1.000 0.000
#> SRR2050429     1  0.0000      0.949 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
#> SRR2050410     2  0.0747    0.91434 0.000 0.984 0.016
#> SRR2050427     1  0.0000    0.96266 1.000 0.000 0.000
#> SRR2050426     1  0.0000    0.96266 1.000 0.000 0.000
#> SRR2050425     2  0.0000    0.91534 0.000 1.000 0.000
#> SRR2050424     3  0.2448    0.94498 0.076 0.000 0.924
#> SRR2050423     3  0.6235    0.35939 0.436 0.000 0.564
#> SRR2050422     2  0.4887    0.82553 0.096 0.844 0.060
#> SRR2050421     1  0.0000    0.96266 1.000 0.000 0.000
#> SRR2050420     1  0.0000    0.96266 1.000 0.000 0.000
#> SRR2050419     2  0.0747    0.91434 0.000 0.984 0.016
#> SRR2050418     1  0.0000    0.96266 1.000 0.000 0.000
#> SRR2050417     1  0.0000    0.96266 1.000 0.000 0.000
#> SRR2050416     2  0.0237    0.91507 0.000 0.996 0.004
#> SRR2050415     3  0.2448    0.94498 0.076 0.000 0.924
#> SRR2050414     2  0.8196    0.34538 0.084 0.560 0.356
#> SRR2050413     2  0.2066    0.90315 0.000 0.940 0.060
#> SRR2050412     1  0.0000    0.96266 1.000 0.000 0.000
#> SRR2050411     1  0.0000    0.96266 1.000 0.000 0.000
#> SRR2050409     2  0.0747    0.91434 0.000 0.984 0.016
#> SRR2050408     1  0.0000    0.96266 1.000 0.000 0.000
#> SRR2050407     2  0.0747    0.91434 0.000 0.984 0.016
#> SRR2050406     3  0.2448    0.94498 0.076 0.000 0.924
#> SRR2050405     3  0.2280    0.92602 0.052 0.008 0.940
#> SRR2050404     2  0.0237    0.91507 0.000 0.996 0.004
#> SRR2050403     1  0.0000    0.96266 1.000 0.000 0.000
#> SRR2050402     2  0.2066    0.90315 0.000 0.940 0.060
#> SRR2050401     1  0.0000    0.96266 1.000 0.000 0.000
#> SRR2050400     1  0.0000    0.96266 1.000 0.000 0.000
#> SRR2050399     2  0.2066    0.90315 0.000 0.940 0.060
#> SRR2050398     1  0.0000    0.96266 1.000 0.000 0.000
#> SRR2050397     1  0.0000    0.96266 1.000 0.000 0.000
#> SRR2050396     3  0.2448    0.94498 0.076 0.000 0.924
#> SRR2050395     3  0.2711    0.92828 0.088 0.000 0.912
#> SRR2050394     2  0.1860    0.90542 0.000 0.948 0.052
#> SRR2050393     3  0.2066    0.93360 0.060 0.000 0.940
#> SRR2050392     2  0.5138    0.68730 0.000 0.748 0.252
#> SRR2050465     2  0.0424    0.91514 0.000 0.992 0.008
#> SRR2050464     3  0.2448    0.94498 0.076 0.000 0.924
#> SRR2050463     3  0.7054   -0.00875 0.020 0.456 0.524
#> SRR2050462     2  0.0000    0.91534 0.000 1.000 0.000
#> SRR2050461     3  0.2448    0.94498 0.076 0.000 0.924
#> SRR2050460     1  0.1031    0.93760 0.976 0.000 0.024
#> SRR2050459     2  0.0747    0.91434 0.000 0.984 0.016
#> SRR2050458     3  0.2066    0.93360 0.060 0.000 0.940
#> SRR2050457     2  0.1031    0.91148 0.000 0.976 0.024
#> SRR2050456     2  0.0747    0.91434 0.000 0.984 0.016
#> SRR2050455     3  0.2448    0.94498 0.076 0.000 0.924
#> SRR2050454     2  0.5497    0.78997 0.064 0.812 0.124
#> SRR2050453     2  0.0000    0.91534 0.000 1.000 0.000
#> SRR2050452     3  0.2448    0.94498 0.076 0.000 0.924
#> SRR2050451     2  0.5896    0.61341 0.008 0.700 0.292
#> SRR2050450     2  0.0000    0.91534 0.000 1.000 0.000
#> SRR2050449     3  0.2448    0.94498 0.076 0.000 0.924
#> SRR2050448     2  0.3983    0.81647 0.004 0.852 0.144
#> SRR2050447     3  0.2448    0.94498 0.076 0.000 0.924
#> SRR2050446     1  0.7752    0.01364 0.496 0.456 0.048
#> SRR2050445     2  0.0747    0.91434 0.000 0.984 0.016
#> SRR2050444     3  0.2448    0.94498 0.076 0.000 0.924
#> SRR2050443     2  0.6308    0.11789 0.000 0.508 0.492
#> SRR2050442     2  0.2066    0.90315 0.000 0.940 0.060
#> SRR2050441     3  0.2448    0.94498 0.076 0.000 0.924
#> SRR2050440     1  0.2804    0.88958 0.924 0.016 0.060
#> SRR2050439     2  0.2066    0.90315 0.000 0.940 0.060
#> SRR2050438     3  0.2448    0.94498 0.076 0.000 0.924
#> SRR2050437     1  0.1964    0.90934 0.944 0.000 0.056
#> SRR2050436     2  0.2066    0.90315 0.000 0.940 0.060
#> SRR2050435     3  0.2448    0.94498 0.076 0.000 0.924
#> SRR2050434     2  0.2066    0.90315 0.000 0.940 0.060
#> SRR2050433     2  0.0237    0.91534 0.000 0.996 0.004
#> SRR2050432     1  0.0000    0.96266 1.000 0.000 0.000
#> SRR2050431     1  0.0000    0.96266 1.000 0.000 0.000
#> SRR2050430     1  0.0000    0.96266 1.000 0.000 0.000
#> SRR2050429     1  0.0000    0.96266 1.000 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> SRR2050410     2  0.2345     0.8457 0.000 0.900 0.000 0.100
#> SRR2050427     1  0.0000     0.9768 1.000 0.000 0.000 0.000
#> SRR2050426     1  0.0000     0.9768 1.000 0.000 0.000 0.000
#> SRR2050425     4  0.4605     0.4603 0.000 0.336 0.000 0.664
#> SRR2050424     3  0.0000     1.0000 0.000 0.000 1.000 0.000
#> SRR2050423     1  0.2345     0.9039 0.900 0.100 0.000 0.000
#> SRR2050422     4  0.0469     0.8417 0.012 0.000 0.000 0.988
#> SRR2050421     1  0.0000     0.9768 1.000 0.000 0.000 0.000
#> SRR2050420     1  0.0000     0.9768 1.000 0.000 0.000 0.000
#> SRR2050419     2  0.2345     0.8457 0.000 0.900 0.000 0.100
#> SRR2050418     1  0.0000     0.9768 1.000 0.000 0.000 0.000
#> SRR2050417     1  0.2345     0.9039 0.900 0.100 0.000 0.000
#> SRR2050416     4  0.3444     0.7102 0.000 0.184 0.000 0.816
#> SRR2050415     3  0.0000     1.0000 0.000 0.000 1.000 0.000
#> SRR2050414     2  0.3123     0.7187 0.156 0.844 0.000 0.000
#> SRR2050413     4  0.0000     0.8476 0.000 0.000 0.000 1.000
#> SRR2050412     1  0.0000     0.9768 1.000 0.000 0.000 0.000
#> SRR2050411     1  0.0000     0.9768 1.000 0.000 0.000 0.000
#> SRR2050409     2  0.2345     0.8457 0.000 0.900 0.000 0.100
#> SRR2050408     1  0.2281     0.9072 0.904 0.096 0.000 0.000
#> SRR2050407     2  0.2345     0.8457 0.000 0.900 0.000 0.100
#> SRR2050406     3  0.0000     1.0000 0.000 0.000 1.000 0.000
#> SRR2050405     2  0.3015     0.7699 0.024 0.884 0.092 0.000
#> SRR2050404     4  0.4564     0.4798 0.000 0.328 0.000 0.672
#> SRR2050403     1  0.0000     0.9768 1.000 0.000 0.000 0.000
#> SRR2050402     4  0.2216     0.7840 0.000 0.092 0.000 0.908
#> SRR2050401     1  0.0000     0.9768 1.000 0.000 0.000 0.000
#> SRR2050400     1  0.0000     0.9768 1.000 0.000 0.000 0.000
#> SRR2050399     4  0.0000     0.8476 0.000 0.000 0.000 1.000
#> SRR2050398     1  0.0000     0.9768 1.000 0.000 0.000 0.000
#> SRR2050397     1  0.0000     0.9768 1.000 0.000 0.000 0.000
#> SRR2050396     3  0.0000     1.0000 0.000 0.000 1.000 0.000
#> SRR2050395     2  0.5558     0.4335 0.324 0.640 0.036 0.000
#> SRR2050394     2  0.4522     0.6301 0.000 0.680 0.000 0.320
#> SRR2050393     3  0.0000     1.0000 0.000 0.000 1.000 0.000
#> SRR2050392     2  0.0000     0.8363 0.000 1.000 0.000 0.000
#> SRR2050465     2  0.2408     0.8437 0.000 0.896 0.000 0.104
#> SRR2050464     3  0.0000     1.0000 0.000 0.000 1.000 0.000
#> SRR2050463     2  0.0707     0.8310 0.000 0.980 0.020 0.000
#> SRR2050462     2  0.4989     0.1226 0.000 0.528 0.000 0.472
#> SRR2050461     3  0.0000     1.0000 0.000 0.000 1.000 0.000
#> SRR2050460     1  0.2345     0.9039 0.900 0.100 0.000 0.000
#> SRR2050459     2  0.2345     0.8457 0.000 0.900 0.000 0.100
#> SRR2050458     3  0.0000     1.0000 0.000 0.000 1.000 0.000
#> SRR2050457     2  0.0000     0.8363 0.000 1.000 0.000 0.000
#> SRR2050456     2  0.2345     0.8457 0.000 0.900 0.000 0.100
#> SRR2050455     3  0.0000     1.0000 0.000 0.000 1.000 0.000
#> SRR2050454     2  0.2081     0.7879 0.084 0.916 0.000 0.000
#> SRR2050453     2  0.2408     0.8437 0.000 0.896 0.000 0.104
#> SRR2050452     3  0.0000     1.0000 0.000 0.000 1.000 0.000
#> SRR2050451     2  0.0000     0.8363 0.000 1.000 0.000 0.000
#> SRR2050450     2  0.4697     0.4777 0.000 0.644 0.000 0.356
#> SRR2050449     3  0.0000     1.0000 0.000 0.000 1.000 0.000
#> SRR2050448     2  0.0000     0.8363 0.000 1.000 0.000 0.000
#> SRR2050447     3  0.0000     1.0000 0.000 0.000 1.000 0.000
#> SRR2050446     2  0.3172     0.7169 0.160 0.840 0.000 0.000
#> SRR2050445     2  0.2345     0.8457 0.000 0.900 0.000 0.100
#> SRR2050444     3  0.0000     1.0000 0.000 0.000 1.000 0.000
#> SRR2050443     2  0.0707     0.8309 0.000 0.980 0.020 0.000
#> SRR2050442     4  0.0000     0.8476 0.000 0.000 0.000 1.000
#> SRR2050441     3  0.0000     1.0000 0.000 0.000 1.000 0.000
#> SRR2050440     4  0.2345     0.7735 0.100 0.000 0.000 0.900
#> SRR2050439     4  0.0000     0.8476 0.000 0.000 0.000 1.000
#> SRR2050438     3  0.0000     1.0000 0.000 0.000 1.000 0.000
#> SRR2050437     4  0.4996     0.0746 0.484 0.000 0.000 0.516
#> SRR2050436     4  0.0000     0.8476 0.000 0.000 0.000 1.000
#> SRR2050435     3  0.0000     1.0000 0.000 0.000 1.000 0.000
#> SRR2050434     4  0.0000     0.8476 0.000 0.000 0.000 1.000
#> SRR2050433     2  0.2408     0.8437 0.000 0.896 0.000 0.104
#> SRR2050432     1  0.0000     0.9768 1.000 0.000 0.000 0.000
#> SRR2050431     1  0.0000     0.9768 1.000 0.000 0.000 0.000
#> SRR2050430     1  0.0188     0.9737 0.996 0.000 0.000 0.004
#> SRR2050429     1  0.0000     0.9768 1.000 0.000 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>            class entropy silhouette    p1    p2 p3    p4    p5
#> SRR2050410     2  0.0162     0.8266 0.000 0.996  0 0.004 0.000
#> SRR2050427     1  0.0000     0.9802 1.000 0.000  0 0.000 0.000
#> SRR2050426     1  0.0000     0.9802 1.000 0.000  0 0.000 0.000
#> SRR2050425     2  0.4161     0.3115 0.000 0.608  0 0.000 0.392
#> SRR2050424     3  0.0000     1.0000 0.000 0.000  1 0.000 0.000
#> SRR2050423     4  0.0290     0.9172 0.008 0.000  0 0.992 0.000
#> SRR2050422     5  0.0000     0.8745 0.000 0.000  0 0.000 1.000
#> SRR2050421     1  0.0000     0.9802 1.000 0.000  0 0.000 0.000
#> SRR2050420     1  0.0000     0.9802 1.000 0.000  0 0.000 0.000
#> SRR2050419     2  0.0162     0.8266 0.000 0.996  0 0.004 0.000
#> SRR2050418     1  0.0000     0.9802 1.000 0.000  0 0.000 0.000
#> SRR2050417     1  0.2020     0.8925 0.900 0.000  0 0.100 0.000
#> SRR2050416     5  0.4150     0.3191 0.000 0.388  0 0.000 0.612
#> SRR2050415     3  0.0000     1.0000 0.000 0.000  1 0.000 0.000
#> SRR2050414     4  0.0000     0.9216 0.000 0.000  0 1.000 0.000
#> SRR2050413     5  0.0404     0.8708 0.000 0.012  0 0.000 0.988
#> SRR2050412     1  0.0000     0.9802 1.000 0.000  0 0.000 0.000
#> SRR2050411     1  0.0000     0.9802 1.000 0.000  0 0.000 0.000
#> SRR2050409     2  0.0162     0.8266 0.000 0.996  0 0.004 0.000
#> SRR2050408     1  0.1792     0.9093 0.916 0.000  0 0.084 0.000
#> SRR2050407     2  0.0000     0.8255 0.000 1.000  0 0.000 0.000
#> SRR2050406     3  0.0000     1.0000 0.000 0.000  1 0.000 0.000
#> SRR2050405     4  0.0290     0.9182 0.000 0.008  0 0.992 0.000
#> SRR2050404     2  0.4126     0.3409 0.000 0.620  0 0.000 0.380
#> SRR2050403     1  0.0000     0.9802 1.000 0.000  0 0.000 0.000
#> SRR2050402     5  0.4227     0.2199 0.000 0.420  0 0.000 0.580
#> SRR2050401     1  0.0000     0.9802 1.000 0.000  0 0.000 0.000
#> SRR2050400     1  0.0000     0.9802 1.000 0.000  0 0.000 0.000
#> SRR2050399     5  0.0609     0.8660 0.000 0.020  0 0.000 0.980
#> SRR2050398     1  0.0000     0.9802 1.000 0.000  0 0.000 0.000
#> SRR2050397     1  0.0000     0.9802 1.000 0.000  0 0.000 0.000
#> SRR2050396     3  0.0000     1.0000 0.000 0.000  1 0.000 0.000
#> SRR2050395     4  0.0000     0.9216 0.000 0.000  0 1.000 0.000
#> SRR2050394     2  0.1597     0.8071 0.000 0.940  0 0.012 0.048
#> SRR2050393     3  0.0000     1.0000 0.000 0.000  1 0.000 0.000
#> SRR2050392     2  0.4305    -0.0625 0.000 0.512  0 0.488 0.000
#> SRR2050465     2  0.0290     0.8235 0.000 0.992  0 0.000 0.008
#> SRR2050464     3  0.0000     1.0000 0.000 0.000  1 0.000 0.000
#> SRR2050463     4  0.0000     0.9216 0.000 0.000  0 1.000 0.000
#> SRR2050462     2  0.3876     0.4786 0.000 0.684  0 0.000 0.316
#> SRR2050461     3  0.0000     1.0000 0.000 0.000  1 0.000 0.000
#> SRR2050460     4  0.0404     0.9146 0.012 0.000  0 0.988 0.000
#> SRR2050459     2  0.0290     0.8263 0.000 0.992  0 0.008 0.000
#> SRR2050458     3  0.0000     1.0000 0.000 0.000  1 0.000 0.000
#> SRR2050457     2  0.3336     0.6147 0.000 0.772  0 0.228 0.000
#> SRR2050456     2  0.0404     0.8244 0.000 0.988  0 0.012 0.000
#> SRR2050455     3  0.0000     1.0000 0.000 0.000  1 0.000 0.000
#> SRR2050454     4  0.1792     0.8623 0.000 0.084  0 0.916 0.000
#> SRR2050453     2  0.0794     0.8139 0.000 0.972  0 0.000 0.028
#> SRR2050452     3  0.0000     1.0000 0.000 0.000  1 0.000 0.000
#> SRR2050451     4  0.0000     0.9216 0.000 0.000  0 1.000 0.000
#> SRR2050450     2  0.3586     0.5649 0.000 0.736  0 0.000 0.264
#> SRR2050449     3  0.0000     1.0000 0.000 0.000  1 0.000 0.000
#> SRR2050448     4  0.0000     0.9216 0.000 0.000  0 1.000 0.000
#> SRR2050447     3  0.0000     1.0000 0.000 0.000  1 0.000 0.000
#> SRR2050446     4  0.0000     0.9216 0.000 0.000  0 1.000 0.000
#> SRR2050445     2  0.0290     0.8263 0.000 0.992  0 0.008 0.000
#> SRR2050444     3  0.0000     1.0000 0.000 0.000  1 0.000 0.000
#> SRR2050443     4  0.3684     0.5980 0.000 0.280  0 0.720 0.000
#> SRR2050442     5  0.0000     0.8745 0.000 0.000  0 0.000 1.000
#> SRR2050441     3  0.0000     1.0000 0.000 0.000  1 0.000 0.000
#> SRR2050440     4  0.3730     0.6253 0.000 0.000  0 0.712 0.288
#> SRR2050439     5  0.0000     0.8745 0.000 0.000  0 0.000 1.000
#> SRR2050438     3  0.0000     1.0000 0.000 0.000  1 0.000 0.000
#> SRR2050437     4  0.3003     0.7639 0.000 0.000  0 0.812 0.188
#> SRR2050436     5  0.0000     0.8745 0.000 0.000  0 0.000 1.000
#> SRR2050435     3  0.0000     1.0000 0.000 0.000  1 0.000 0.000
#> SRR2050434     5  0.0000     0.8745 0.000 0.000  0 0.000 1.000
#> SRR2050433     2  0.0290     0.8263 0.000 0.992  0 0.008 0.000
#> SRR2050432     1  0.0000     0.9802 1.000 0.000  0 0.000 0.000
#> SRR2050431     1  0.0000     0.9802 1.000 0.000  0 0.000 0.000
#> SRR2050430     1  0.0404     0.9722 0.988 0.000  0 0.000 0.012
#> SRR2050429     1  0.2230     0.8721 0.884 0.000  0 0.116 0.000

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>            class entropy silhouette    p1    p2    p3    p4    p5    p6
#> SRR2050410     6  0.3634      0.657 0.000 0.356 0.000 0.000 0.000 0.644
#> SRR2050427     1  0.3374      0.888 0.836 0.036 0.000 0.000 0.032 0.096
#> SRR2050426     1  0.0260      0.908 0.992 0.000 0.000 0.008 0.000 0.000
#> SRR2050425     2  0.1225      0.836 0.000 0.952 0.000 0.000 0.036 0.012
#> SRR2050424     3  0.0000      0.999 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2050423     4  0.0000      0.951 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR2050422     5  0.2793      0.668 0.000 0.200 0.000 0.000 0.800 0.000
#> SRR2050421     1  0.3374      0.888 0.836 0.036 0.000 0.000 0.032 0.096
#> SRR2050420     1  0.0363      0.907 0.988 0.000 0.000 0.012 0.000 0.000
#> SRR2050419     6  0.2996      0.819 0.000 0.228 0.000 0.000 0.000 0.772
#> SRR2050418     1  0.3374      0.888 0.836 0.036 0.000 0.000 0.032 0.096
#> SRR2050417     1  0.0909      0.903 0.968 0.000 0.000 0.012 0.020 0.000
#> SRR2050416     2  0.1663      0.788 0.000 0.912 0.000 0.000 0.088 0.000
#> SRR2050415     3  0.0000      0.999 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2050414     4  0.0000      0.951 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR2050413     5  0.3847      0.087 0.000 0.456 0.000 0.000 0.544 0.000
#> SRR2050412     1  0.3374      0.888 0.836 0.036 0.000 0.000 0.032 0.096
#> SRR2050411     1  0.0363      0.907 0.988 0.000 0.000 0.012 0.000 0.000
#> SRR2050409     6  0.3351      0.764 0.000 0.288 0.000 0.000 0.000 0.712
#> SRR2050408     1  0.0909      0.903 0.968 0.000 0.000 0.012 0.020 0.000
#> SRR2050407     2  0.2562      0.688 0.000 0.828 0.000 0.000 0.000 0.172
#> SRR2050406     3  0.0000      0.999 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2050405     4  0.0260      0.946 0.000 0.000 0.000 0.992 0.000 0.008
#> SRR2050404     2  0.1151      0.838 0.000 0.956 0.000 0.000 0.032 0.012
#> SRR2050403     1  0.0820      0.904 0.972 0.000 0.000 0.012 0.016 0.000
#> SRR2050402     2  0.2378      0.721 0.000 0.848 0.000 0.000 0.152 0.000
#> SRR2050401     1  0.3374      0.888 0.836 0.036 0.000 0.000 0.032 0.096
#> SRR2050400     1  0.0363      0.907 0.988 0.000 0.000 0.012 0.000 0.000
#> SRR2050399     2  0.3868     -0.130 0.000 0.504 0.000 0.000 0.496 0.000
#> SRR2050398     1  0.3374      0.888 0.836 0.036 0.000 0.000 0.032 0.096
#> SRR2050397     1  0.0508      0.907 0.984 0.000 0.000 0.012 0.004 0.000
#> SRR2050396     3  0.0146      0.995 0.000 0.000 0.996 0.004 0.000 0.000
#> SRR2050395     4  0.0000      0.951 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR2050394     6  0.4663      0.631 0.000 0.092 0.000 0.000 0.244 0.664
#> SRR2050393     3  0.0146      0.996 0.000 0.000 0.996 0.000 0.000 0.004
#> SRR2050392     6  0.2301      0.766 0.000 0.020 0.000 0.096 0.000 0.884
#> SRR2050465     2  0.1714      0.808 0.000 0.908 0.000 0.000 0.000 0.092
#> SRR2050464     3  0.0000      0.999 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2050463     4  0.0000      0.951 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR2050462     2  0.1007      0.840 0.000 0.956 0.000 0.000 0.000 0.044
#> SRR2050461     3  0.0000      0.999 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2050460     4  0.0000      0.951 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR2050459     6  0.2300      0.847 0.000 0.144 0.000 0.000 0.000 0.856
#> SRR2050458     3  0.0000      0.999 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2050457     6  0.2258      0.813 0.000 0.060 0.000 0.044 0.000 0.896
#> SRR2050456     6  0.2003      0.843 0.000 0.116 0.000 0.000 0.000 0.884
#> SRR2050455     3  0.0000      0.999 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2050454     4  0.1075      0.917 0.000 0.000 0.000 0.952 0.000 0.048
#> SRR2050453     2  0.1714      0.808 0.000 0.908 0.000 0.000 0.000 0.092
#> SRR2050452     3  0.0000      0.999 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2050451     4  0.0000      0.951 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR2050450     2  0.1285      0.837 0.000 0.944 0.000 0.000 0.004 0.052
#> SRR2050449     3  0.0000      0.999 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2050448     4  0.0000      0.951 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR2050447     3  0.0000      0.999 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2050446     4  0.0000      0.951 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR2050445     6  0.2178      0.847 0.000 0.132 0.000 0.000 0.000 0.868
#> SRR2050444     3  0.0000      0.999 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2050443     4  0.1267      0.905 0.000 0.000 0.000 0.940 0.000 0.060
#> SRR2050442     5  0.1610      0.783 0.000 0.084 0.000 0.000 0.916 0.000
#> SRR2050441     3  0.0000      0.999 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2050440     5  0.3659      0.262 0.000 0.000 0.000 0.364 0.636 0.000
#> SRR2050439     5  0.1610      0.783 0.000 0.084 0.000 0.000 0.916 0.000
#> SRR2050438     3  0.0146      0.996 0.000 0.000 0.996 0.000 0.004 0.000
#> SRR2050437     4  0.3852      0.365 0.004 0.000 0.000 0.612 0.384 0.000
#> SRR2050436     5  0.1204      0.774 0.000 0.056 0.000 0.000 0.944 0.000
#> SRR2050435     3  0.0000      0.999 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2050434     5  0.1806      0.778 0.000 0.088 0.000 0.004 0.908 0.000
#> SRR2050433     6  0.3050      0.807 0.000 0.236 0.000 0.000 0.000 0.764
#> SRR2050432     1  0.3374      0.888 0.836 0.036 0.000 0.000 0.032 0.096
#> SRR2050431     1  0.0909      0.903 0.968 0.000 0.000 0.012 0.020 0.000
#> SRR2050430     1  0.5278      0.750 0.676 0.036 0.000 0.004 0.188 0.096
#> SRR2050429     1  0.2197      0.859 0.900 0.000 0.000 0.044 0.056 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 15040 rows and 73 columns.
#>   Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'MAD' method.
#>   Subgroups are detected by 'hclust' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 6.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

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

collect_plots(res)

plot of chunk MAD-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.571           0.752       0.895         0.4861 0.505   0.505
#> 3 3 0.625           0.748       0.876         0.3337 0.842   0.686
#> 4 4 0.755           0.684       0.863         0.0973 0.847   0.624
#> 5 5 0.863           0.828       0.905         0.1122 0.884   0.630
#> 6 6 0.945           0.797       0.907         0.0235 0.952   0.780

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

suggest_best_k(res)
#> [1] 6

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

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

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>            class entropy silhouette    p1    p2
#> SRR2050410     2   0.000     0.8327 0.000 1.000
#> SRR2050427     1   0.000     0.8926 1.000 0.000
#> SRR2050426     1   0.000     0.8926 1.000 0.000
#> SRR2050425     2   0.000     0.8327 0.000 1.000
#> SRR2050424     1   0.000     0.8926 1.000 0.000
#> SRR2050423     2   0.963     0.4941 0.388 0.612
#> SRR2050422     1   0.992     0.2541 0.552 0.448
#> SRR2050421     1   0.000     0.8926 1.000 0.000
#> SRR2050420     1   0.000     0.8926 1.000 0.000
#> SRR2050419     2   0.000     0.8327 0.000 1.000
#> SRR2050418     1   0.000     0.8926 1.000 0.000
#> SRR2050417     1   0.706     0.6942 0.808 0.192
#> SRR2050416     2   0.163     0.8196 0.024 0.976
#> SRR2050415     1   0.000     0.8926 1.000 0.000
#> SRR2050414     2   0.963     0.4941 0.388 0.612
#> SRR2050413     1   0.992     0.2541 0.552 0.448
#> SRR2050412     1   0.000     0.8926 1.000 0.000
#> SRR2050411     1   0.706     0.6942 0.808 0.192
#> SRR2050409     2   0.000     0.8327 0.000 1.000
#> SRR2050408     1   0.706     0.6942 0.808 0.192
#> SRR2050407     2   0.000     0.8327 0.000 1.000
#> SRR2050406     1   0.000     0.8926 1.000 0.000
#> SRR2050405     2   0.963     0.4941 0.388 0.612
#> SRR2050404     2   0.000     0.8327 0.000 1.000
#> SRR2050403     1   0.706     0.6942 0.808 0.192
#> SRR2050402     2   0.000     0.8327 0.000 1.000
#> SRR2050401     1   0.000     0.8926 1.000 0.000
#> SRR2050400     1   0.000     0.8926 1.000 0.000
#> SRR2050399     2   0.988     0.0962 0.436 0.564
#> SRR2050398     1   0.000     0.8926 1.000 0.000
#> SRR2050397     1   0.706     0.6942 0.808 0.192
#> SRR2050396     1   0.000     0.8926 1.000 0.000
#> SRR2050395     2   0.963     0.4941 0.388 0.612
#> SRR2050394     2   0.000     0.8327 0.000 1.000
#> SRR2050393     1   0.000     0.8926 1.000 0.000
#> SRR2050392     2   0.260     0.8172 0.044 0.956
#> SRR2050465     2   0.000     0.8327 0.000 1.000
#> SRR2050464     1   0.000     0.8926 1.000 0.000
#> SRR2050463     2   0.963     0.4941 0.388 0.612
#> SRR2050462     2   0.000     0.8327 0.000 1.000
#> SRR2050461     1   0.000     0.8926 1.000 0.000
#> SRR2050460     2   0.963     0.4941 0.388 0.612
#> SRR2050459     2   0.000     0.8327 0.000 1.000
#> SRR2050458     1   0.000     0.8926 1.000 0.000
#> SRR2050457     2   0.163     0.8238 0.024 0.976
#> SRR2050456     2   0.000     0.8327 0.000 1.000
#> SRR2050455     1   0.000     0.8926 1.000 0.000
#> SRR2050454     2   0.260     0.8172 0.044 0.956
#> SRR2050453     2   0.000     0.8327 0.000 1.000
#> SRR2050452     1   0.000     0.8926 1.000 0.000
#> SRR2050451     2   0.963     0.4941 0.388 0.612
#> SRR2050450     2   0.000     0.8327 0.000 1.000
#> SRR2050449     1   0.000     0.8926 1.000 0.000
#> SRR2050448     2   0.963     0.4941 0.388 0.612
#> SRR2050447     1   0.000     0.8926 1.000 0.000
#> SRR2050446     2   0.963     0.4941 0.388 0.612
#> SRR2050445     2   0.000     0.8327 0.000 1.000
#> SRR2050444     1   0.000     0.8926 1.000 0.000
#> SRR2050443     2   0.260     0.8172 0.044 0.956
#> SRR2050442     1   0.983     0.3141 0.576 0.424
#> SRR2050441     1   0.000     0.8926 1.000 0.000
#> SRR2050440     1   0.000     0.8926 1.000 0.000
#> SRR2050439     1   0.983     0.3141 0.576 0.424
#> SRR2050438     1   0.000     0.8926 1.000 0.000
#> SRR2050437     1   0.000     0.8926 1.000 0.000
#> SRR2050436     1   0.983     0.3141 0.576 0.424
#> SRR2050435     1   0.000     0.8926 1.000 0.000
#> SRR2050434     1   0.983     0.3141 0.576 0.424
#> SRR2050433     2   0.000     0.8327 0.000 1.000
#> SRR2050432     1   0.000     0.8926 1.000 0.000
#> SRR2050431     1   0.000     0.8926 1.000 0.000
#> SRR2050430     1   0.000     0.8926 1.000 0.000
#> SRR2050429     1   0.000     0.8926 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
#> SRR2050410     2   0.000     0.8082 0.000 1.000 0.000
#> SRR2050427     1   0.296     0.8076 0.900 0.000 0.100
#> SRR2050426     1   0.296     0.8076 0.900 0.000 0.100
#> SRR2050425     2   0.000     0.8082 0.000 1.000 0.000
#> SRR2050424     3   0.000     1.0000 0.000 0.000 1.000
#> SRR2050423     2   0.617     0.4596 0.412 0.588 0.000
#> SRR2050422     1   0.618     0.3443 0.584 0.416 0.000
#> SRR2050421     1   0.296     0.8076 0.900 0.000 0.100
#> SRR2050420     1   0.296     0.8076 0.900 0.000 0.100
#> SRR2050419     2   0.000     0.8082 0.000 1.000 0.000
#> SRR2050418     1   0.296     0.8076 0.900 0.000 0.100
#> SRR2050417     1   0.412     0.6680 0.832 0.168 0.000
#> SRR2050416     2   0.103     0.7909 0.024 0.976 0.000
#> SRR2050415     3   0.000     1.0000 0.000 0.000 1.000
#> SRR2050414     2   0.617     0.4596 0.412 0.588 0.000
#> SRR2050413     1   0.618     0.3443 0.584 0.416 0.000
#> SRR2050412     1   0.296     0.8076 0.900 0.000 0.100
#> SRR2050411     1   0.412     0.6680 0.832 0.168 0.000
#> SRR2050409     2   0.000     0.8082 0.000 1.000 0.000
#> SRR2050408     1   0.412     0.6680 0.832 0.168 0.000
#> SRR2050407     2   0.000     0.8082 0.000 1.000 0.000
#> SRR2050406     3   0.000     1.0000 0.000 0.000 1.000
#> SRR2050405     2   0.617     0.4596 0.412 0.588 0.000
#> SRR2050404     2   0.000     0.8082 0.000 1.000 0.000
#> SRR2050403     1   0.412     0.6680 0.832 0.168 0.000
#> SRR2050402     2   0.000     0.8082 0.000 1.000 0.000
#> SRR2050401     1   0.296     0.8076 0.900 0.000 0.100
#> SRR2050400     1   0.296     0.8076 0.900 0.000 0.100
#> SRR2050399     2   0.629    -0.0672 0.468 0.532 0.000
#> SRR2050398     1   0.296     0.8076 0.900 0.000 0.100
#> SRR2050397     1   0.412     0.6680 0.832 0.168 0.000
#> SRR2050396     3   0.000     1.0000 0.000 0.000 1.000
#> SRR2050395     2   0.617     0.4596 0.412 0.588 0.000
#> SRR2050394     2   0.000     0.8082 0.000 1.000 0.000
#> SRR2050393     3   0.000     1.0000 0.000 0.000 1.000
#> SRR2050392     2   0.226     0.7845 0.068 0.932 0.000
#> SRR2050465     2   0.000     0.8082 0.000 1.000 0.000
#> SRR2050464     3   0.000     1.0000 0.000 0.000 1.000
#> SRR2050463     2   0.617     0.4596 0.412 0.588 0.000
#> SRR2050462     2   0.000     0.8082 0.000 1.000 0.000
#> SRR2050461     3   0.000     1.0000 0.000 0.000 1.000
#> SRR2050460     2   0.617     0.4596 0.412 0.588 0.000
#> SRR2050459     2   0.000     0.8082 0.000 1.000 0.000
#> SRR2050458     3   0.000     1.0000 0.000 0.000 1.000
#> SRR2050457     2   0.175     0.7927 0.048 0.952 0.000
#> SRR2050456     2   0.000     0.8082 0.000 1.000 0.000
#> SRR2050455     3   0.000     1.0000 0.000 0.000 1.000
#> SRR2050454     2   0.226     0.7845 0.068 0.932 0.000
#> SRR2050453     2   0.000     0.8082 0.000 1.000 0.000
#> SRR2050452     3   0.000     1.0000 0.000 0.000 1.000
#> SRR2050451     2   0.617     0.4596 0.412 0.588 0.000
#> SRR2050450     2   0.000     0.8082 0.000 1.000 0.000
#> SRR2050449     3   0.000     1.0000 0.000 0.000 1.000
#> SRR2050448     2   0.617     0.4596 0.412 0.588 0.000
#> SRR2050447     3   0.000     1.0000 0.000 0.000 1.000
#> SRR2050446     2   0.617     0.4596 0.412 0.588 0.000
#> SRR2050445     2   0.000     0.8082 0.000 1.000 0.000
#> SRR2050444     3   0.000     1.0000 0.000 0.000 1.000
#> SRR2050443     2   0.226     0.7845 0.068 0.932 0.000
#> SRR2050442     1   0.610     0.3901 0.608 0.392 0.000
#> SRR2050441     3   0.000     1.0000 0.000 0.000 1.000
#> SRR2050440     1   0.196     0.7956 0.944 0.000 0.056
#> SRR2050439     1   0.610     0.3901 0.608 0.392 0.000
#> SRR2050438     3   0.000     1.0000 0.000 0.000 1.000
#> SRR2050437     1   0.196     0.7956 0.944 0.000 0.056
#> SRR2050436     1   0.610     0.3901 0.608 0.392 0.000
#> SRR2050435     3   0.000     1.0000 0.000 0.000 1.000
#> SRR2050434     1   0.610     0.3901 0.608 0.392 0.000
#> SRR2050433     2   0.000     0.8082 0.000 1.000 0.000
#> SRR2050432     1   0.296     0.8076 0.900 0.000 0.100
#> SRR2050431     1   0.296     0.8076 0.900 0.000 0.100
#> SRR2050430     1   0.296     0.8076 0.900 0.000 0.100
#> SRR2050429     1   0.196     0.7956 0.944 0.000 0.056

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2 p3    p4
#> SRR2050410     2  0.5699      0.712 0.380 0.588  0 0.032
#> SRR2050427     1  0.4790      0.986 0.620 0.380  0 0.000
#> SRR2050426     1  0.4790      0.986 0.620 0.380  0 0.000
#> SRR2050425     2  0.5699      0.712 0.380 0.588  0 0.032
#> SRR2050424     3  0.0000      1.000 0.000 0.000  1 0.000
#> SRR2050423     2  0.0000      0.467 0.000 1.000  0 0.000
#> SRR2050422     4  0.0817      0.798 0.000 0.024  0 0.976
#> SRR2050421     1  0.4790      0.986 0.620 0.380  0 0.000
#> SRR2050420     1  0.4790      0.986 0.620 0.380  0 0.000
#> SRR2050419     2  0.5699      0.712 0.380 0.588  0 0.032
#> SRR2050418     1  0.4790      0.986 0.620 0.380  0 0.000
#> SRR2050417     2  0.4907     -0.658 0.420 0.580  0 0.000
#> SRR2050416     2  0.6147      0.695 0.380 0.564  0 0.056
#> SRR2050415     3  0.0000      1.000 0.000 0.000  1 0.000
#> SRR2050414     2  0.0000      0.467 0.000 1.000  0 0.000
#> SRR2050413     4  0.0817      0.798 0.000 0.024  0 0.976
#> SRR2050412     1  0.4790      0.986 0.620 0.380  0 0.000
#> SRR2050411     2  0.4907     -0.658 0.420 0.580  0 0.000
#> SRR2050409     2  0.5699      0.712 0.380 0.588  0 0.032
#> SRR2050408     2  0.4907     -0.658 0.420 0.580  0 0.000
#> SRR2050407     2  0.5699      0.712 0.380 0.588  0 0.032
#> SRR2050406     3  0.0000      1.000 0.000 0.000  1 0.000
#> SRR2050405     2  0.0000      0.467 0.000 1.000  0 0.000
#> SRR2050404     2  0.5699      0.712 0.380 0.588  0 0.032
#> SRR2050403     2  0.4907     -0.658 0.420 0.580  0 0.000
#> SRR2050402     2  0.5699      0.712 0.380 0.588  0 0.032
#> SRR2050401     1  0.4790      0.986 0.620 0.380  0 0.000
#> SRR2050400     1  0.4790      0.986 0.620 0.380  0 0.000
#> SRR2050399     4  0.2921      0.702 0.000 0.140  0 0.860
#> SRR2050398     1  0.4790      0.986 0.620 0.380  0 0.000
#> SRR2050397     2  0.4907     -0.658 0.420 0.580  0 0.000
#> SRR2050396     3  0.0000      1.000 0.000 0.000  1 0.000
#> SRR2050395     2  0.0000      0.467 0.000 1.000  0 0.000
#> SRR2050394     2  0.5699      0.712 0.380 0.588  0 0.032
#> SRR2050393     3  0.0000      1.000 0.000 0.000  1 0.000
#> SRR2050392     2  0.4643      0.701 0.344 0.656  0 0.000
#> SRR2050465     2  0.5699      0.712 0.380 0.588  0 0.032
#> SRR2050464     3  0.0000      1.000 0.000 0.000  1 0.000
#> SRR2050463     2  0.0000      0.467 0.000 1.000  0 0.000
#> SRR2050462     2  0.5699      0.712 0.380 0.588  0 0.032
#> SRR2050461     3  0.0000      1.000 0.000 0.000  1 0.000
#> SRR2050460     2  0.0000      0.467 0.000 1.000  0 0.000
#> SRR2050459     2  0.5699      0.712 0.380 0.588  0 0.032
#> SRR2050458     3  0.0000      1.000 0.000 0.000  1 0.000
#> SRR2050457     2  0.5007      0.705 0.356 0.636  0 0.008
#> SRR2050456     2  0.5699      0.712 0.380 0.588  0 0.032
#> SRR2050455     3  0.0000      1.000 0.000 0.000  1 0.000
#> SRR2050454     2  0.4643      0.701 0.344 0.656  0 0.000
#> SRR2050453     2  0.5699      0.712 0.380 0.588  0 0.032
#> SRR2050452     3  0.0000      1.000 0.000 0.000  1 0.000
#> SRR2050451     2  0.0000      0.467 0.000 1.000  0 0.000
#> SRR2050450     2  0.5699      0.712 0.380 0.588  0 0.032
#> SRR2050449     3  0.0000      1.000 0.000 0.000  1 0.000
#> SRR2050448     2  0.0000      0.467 0.000 1.000  0 0.000
#> SRR2050447     3  0.0000      1.000 0.000 0.000  1 0.000
#> SRR2050446     2  0.0000      0.467 0.000 1.000  0 0.000
#> SRR2050445     2  0.5699      0.712 0.380 0.588  0 0.032
#> SRR2050444     3  0.0000      1.000 0.000 0.000  1 0.000
#> SRR2050443     2  0.4643      0.701 0.344 0.656  0 0.000
#> SRR2050442     4  0.0000      0.802 0.000 0.000  0 1.000
#> SRR2050441     3  0.0000      1.000 0.000 0.000  1 0.000
#> SRR2050440     4  0.6468      0.312 0.084 0.348  0 0.568
#> SRR2050439     4  0.0000      0.802 0.000 0.000  0 1.000
#> SRR2050438     3  0.0000      1.000 0.000 0.000  1 0.000
#> SRR2050437     4  0.6468      0.312 0.084 0.348  0 0.568
#> SRR2050436     4  0.0000      0.802 0.000 0.000  0 1.000
#> SRR2050435     3  0.0000      1.000 0.000 0.000  1 0.000
#> SRR2050434     4  0.0000      0.802 0.000 0.000  0 1.000
#> SRR2050433     2  0.5699      0.712 0.380 0.588  0 0.032
#> SRR2050432     1  0.4790      0.986 0.620 0.380  0 0.000
#> SRR2050431     1  0.6079      0.935 0.568 0.380  0 0.052
#> SRR2050430     1  0.6454      0.903 0.544 0.380  0 0.076
#> SRR2050429     4  0.6468      0.312 0.084 0.348  0 0.568

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>            class entropy silhouette    p1    p2 p3    p4    p5
#> SRR2050410     2  0.0000      0.994 0.000 1.000  0 0.000 0.000
#> SRR2050427     1  0.0000      0.981 1.000 0.000  0 0.000 0.000
#> SRR2050426     1  0.0000      0.981 1.000 0.000  0 0.000 0.000
#> SRR2050425     2  0.0000      0.994 0.000 1.000  0 0.000 0.000
#> SRR2050424     3  0.0000      1.000 0.000 0.000  1 0.000 0.000
#> SRR2050423     4  0.2179      0.735 0.000 0.112  0 0.888 0.000
#> SRR2050422     5  0.0703      0.802 0.000 0.000  0 0.024 0.976
#> SRR2050421     1  0.0000      0.981 1.000 0.000  0 0.000 0.000
#> SRR2050420     1  0.0000      0.981 1.000 0.000  0 0.000 0.000
#> SRR2050419     2  0.0000      0.994 0.000 1.000  0 0.000 0.000
#> SRR2050418     1  0.0000      0.981 1.000 0.000  0 0.000 0.000
#> SRR2050417     4  0.4227      0.340 0.420 0.000  0 0.580 0.000
#> SRR2050416     2  0.1403      0.939 0.000 0.952  0 0.024 0.024
#> SRR2050415     3  0.0000      1.000 0.000 0.000  1 0.000 0.000
#> SRR2050414     4  0.2179      0.735 0.000 0.112  0 0.888 0.000
#> SRR2050413     5  0.0703      0.802 0.000 0.000  0 0.024 0.976
#> SRR2050412     1  0.0000      0.981 1.000 0.000  0 0.000 0.000
#> SRR2050411     4  0.4227      0.340 0.420 0.000  0 0.580 0.000
#> SRR2050409     2  0.0000      0.994 0.000 1.000  0 0.000 0.000
#> SRR2050408     4  0.4227      0.340 0.420 0.000  0 0.580 0.000
#> SRR2050407     2  0.0000      0.994 0.000 1.000  0 0.000 0.000
#> SRR2050406     3  0.0000      1.000 0.000 0.000  1 0.000 0.000
#> SRR2050405     4  0.2179      0.735 0.000 0.112  0 0.888 0.000
#> SRR2050404     2  0.0000      0.994 0.000 1.000  0 0.000 0.000
#> SRR2050403     4  0.4227      0.340 0.420 0.000  0 0.580 0.000
#> SRR2050402     2  0.0703      0.969 0.000 0.976  0 0.024 0.000
#> SRR2050401     1  0.0000      0.981 1.000 0.000  0 0.000 0.000
#> SRR2050400     1  0.0703      0.957 0.976 0.000  0 0.024 0.000
#> SRR2050399     5  0.2915      0.714 0.000 0.116  0 0.024 0.860
#> SRR2050398     1  0.0000      0.981 1.000 0.000  0 0.000 0.000
#> SRR2050397     4  0.4227      0.340 0.420 0.000  0 0.580 0.000
#> SRR2050396     3  0.0000      1.000 0.000 0.000  1 0.000 0.000
#> SRR2050395     4  0.2179      0.735 0.000 0.112  0 0.888 0.000
#> SRR2050394     2  0.0000      0.994 0.000 1.000  0 0.000 0.000
#> SRR2050393     3  0.0000      1.000 0.000 0.000  1 0.000 0.000
#> SRR2050392     4  0.4287      0.310 0.000 0.460  0 0.540 0.000
#> SRR2050465     2  0.0000      0.994 0.000 1.000  0 0.000 0.000
#> SRR2050464     3  0.0000      1.000 0.000 0.000  1 0.000 0.000
#> SRR2050463     4  0.2179      0.735 0.000 0.112  0 0.888 0.000
#> SRR2050462     2  0.0000      0.994 0.000 1.000  0 0.000 0.000
#> SRR2050461     3  0.0000      1.000 0.000 0.000  1 0.000 0.000
#> SRR2050460     4  0.2179      0.735 0.000 0.112  0 0.888 0.000
#> SRR2050459     2  0.0000      0.994 0.000 1.000  0 0.000 0.000
#> SRR2050458     3  0.0000      1.000 0.000 0.000  1 0.000 0.000
#> SRR2050457     4  0.4302      0.256 0.000 0.480  0 0.520 0.000
#> SRR2050456     2  0.0000      0.994 0.000 1.000  0 0.000 0.000
#> SRR2050455     3  0.0000      1.000 0.000 0.000  1 0.000 0.000
#> SRR2050454     4  0.4287      0.310 0.000 0.460  0 0.540 0.000
#> SRR2050453     2  0.0000      0.994 0.000 1.000  0 0.000 0.000
#> SRR2050452     3  0.0000      1.000 0.000 0.000  1 0.000 0.000
#> SRR2050451     4  0.2179      0.735 0.000 0.112  0 0.888 0.000
#> SRR2050450     2  0.0000      0.994 0.000 1.000  0 0.000 0.000
#> SRR2050449     3  0.0000      1.000 0.000 0.000  1 0.000 0.000
#> SRR2050448     4  0.2179      0.735 0.000 0.112  0 0.888 0.000
#> SRR2050447     3  0.0000      1.000 0.000 0.000  1 0.000 0.000
#> SRR2050446     4  0.2179      0.735 0.000 0.112  0 0.888 0.000
#> SRR2050445     2  0.0000      0.994 0.000 1.000  0 0.000 0.000
#> SRR2050444     3  0.0000      1.000 0.000 0.000  1 0.000 0.000
#> SRR2050443     4  0.4287      0.310 0.000 0.460  0 0.540 0.000
#> SRR2050442     5  0.0000      0.807 0.000 0.000  0 0.000 1.000
#> SRR2050441     3  0.0000      1.000 0.000 0.000  1 0.000 0.000
#> SRR2050440     5  0.5771      0.322 0.432 0.000  0 0.088 0.480
#> SRR2050439     5  0.0000      0.807 0.000 0.000  0 0.000 1.000
#> SRR2050438     3  0.0000      1.000 0.000 0.000  1 0.000 0.000
#> SRR2050437     5  0.5771      0.322 0.432 0.000  0 0.088 0.480
#> SRR2050436     5  0.0000      0.807 0.000 0.000  0 0.000 1.000
#> SRR2050435     3  0.0000      1.000 0.000 0.000  1 0.000 0.000
#> SRR2050434     5  0.0000      0.807 0.000 0.000  0 0.000 1.000
#> SRR2050433     2  0.0000      0.994 0.000 1.000  0 0.000 0.000
#> SRR2050432     1  0.0000      0.981 1.000 0.000  0 0.000 0.000
#> SRR2050431     1  0.1965      0.916 0.924 0.000  0 0.024 0.052
#> SRR2050430     1  0.1981      0.902 0.924 0.000  0 0.028 0.048
#> SRR2050429     5  0.5771      0.322 0.432 0.000  0 0.088 0.480

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>            class entropy silhouette    p1    p2 p3    p4    p5    p6
#> SRR2050410     2  0.0000      0.996 0.000 1.000  0 0.000 0.000 0.000
#> SRR2050427     1  0.3797      0.672 0.580 0.000  0 0.420 0.000 0.000
#> SRR2050426     1  0.3797      0.672 0.580 0.000  0 0.420 0.000 0.000
#> SRR2050425     2  0.0000      0.996 0.000 1.000  0 0.000 0.000 0.000
#> SRR2050424     3  0.0000      1.000 0.000 0.000  1 0.000 0.000 0.000
#> SRR2050423     4  0.3797      0.777 0.420 0.000  0 0.580 0.000 0.000
#> SRR2050422     5  0.0000      0.916 0.000 0.000  0 0.000 1.000 0.000
#> SRR2050421     1  0.3797      0.672 0.580 0.000  0 0.420 0.000 0.000
#> SRR2050420     1  0.3797      0.672 0.580 0.000  0 0.420 0.000 0.000
#> SRR2050419     2  0.0000      0.996 0.000 1.000  0 0.000 0.000 0.000
#> SRR2050418     1  0.3797      0.672 0.580 0.000  0 0.420 0.000 0.000
#> SRR2050417     4  0.0000      0.471 0.000 0.000  0 1.000 0.000 0.000
#> SRR2050416     2  0.1075      0.952 0.000 0.952  0 0.000 0.048 0.000
#> SRR2050415     3  0.0000      1.000 0.000 0.000  1 0.000 0.000 0.000
#> SRR2050414     4  0.3797      0.777 0.420 0.000  0 0.580 0.000 0.000
#> SRR2050413     5  0.0000      0.916 0.000 0.000  0 0.000 1.000 0.000
#> SRR2050412     1  0.3797      0.672 0.580 0.000  0 0.420 0.000 0.000
#> SRR2050411     4  0.0000      0.471 0.000 0.000  0 1.000 0.000 0.000
#> SRR2050409     2  0.0000      0.996 0.000 1.000  0 0.000 0.000 0.000
#> SRR2050408     4  0.0000      0.471 0.000 0.000  0 1.000 0.000 0.000
#> SRR2050407     2  0.0000      0.996 0.000 1.000  0 0.000 0.000 0.000
#> SRR2050406     3  0.0000      1.000 0.000 0.000  1 0.000 0.000 0.000
#> SRR2050405     4  0.3797      0.777 0.420 0.000  0 0.580 0.000 0.000
#> SRR2050404     2  0.0000      0.996 0.000 1.000  0 0.000 0.000 0.000
#> SRR2050403     4  0.0000      0.471 0.000 0.000  0 1.000 0.000 0.000
#> SRR2050402     2  0.0632      0.976 0.000 0.976  0 0.000 0.024 0.000
#> SRR2050401     1  0.3797      0.672 0.580 0.000  0 0.420 0.000 0.000
#> SRR2050400     1  0.3833      0.658 0.556 0.000  0 0.444 0.000 0.000
#> SRR2050399     5  0.2003      0.799 0.000 0.116  0 0.000 0.884 0.000
#> SRR2050398     1  0.3797      0.672 0.580 0.000  0 0.420 0.000 0.000
#> SRR2050397     4  0.0000      0.471 0.000 0.000  0 1.000 0.000 0.000
#> SRR2050396     3  0.0000      1.000 0.000 0.000  1 0.000 0.000 0.000
#> SRR2050395     4  0.3797      0.777 0.420 0.000  0 0.580 0.000 0.000
#> SRR2050394     2  0.0000      0.996 0.000 1.000  0 0.000 0.000 0.000
#> SRR2050393     3  0.0000      1.000 0.000 0.000  1 0.000 0.000 0.000
#> SRR2050392     1  0.5975     -0.345 0.420 0.348  0 0.232 0.000 0.000
#> SRR2050465     2  0.0000      0.996 0.000 1.000  0 0.000 0.000 0.000
#> SRR2050464     3  0.0000      1.000 0.000 0.000  1 0.000 0.000 0.000
#> SRR2050463     4  0.3797      0.777 0.420 0.000  0 0.580 0.000 0.000
#> SRR2050462     2  0.0000      0.996 0.000 1.000  0 0.000 0.000 0.000
#> SRR2050461     3  0.0000      1.000 0.000 0.000  1 0.000 0.000 0.000
#> SRR2050460     4  0.3797      0.777 0.420 0.000  0 0.580 0.000 0.000
#> SRR2050459     2  0.0000      0.996 0.000 1.000  0 0.000 0.000 0.000
#> SRR2050458     3  0.0000      1.000 0.000 0.000  1 0.000 0.000 0.000
#> SRR2050457     1  0.5922     -0.325 0.420 0.368  0 0.212 0.000 0.000
#> SRR2050456     2  0.0000      0.996 0.000 1.000  0 0.000 0.000 0.000
#> SRR2050455     3  0.0000      1.000 0.000 0.000  1 0.000 0.000 0.000
#> SRR2050454     1  0.5975     -0.345 0.420 0.348  0 0.232 0.000 0.000
#> SRR2050453     2  0.0000      0.996 0.000 1.000  0 0.000 0.000 0.000
#> SRR2050452     3  0.0000      1.000 0.000 0.000  1 0.000 0.000 0.000
#> SRR2050451     4  0.3797      0.777 0.420 0.000  0 0.580 0.000 0.000
#> SRR2050450     2  0.0000      0.996 0.000 1.000  0 0.000 0.000 0.000
#> SRR2050449     3  0.0000      1.000 0.000 0.000  1 0.000 0.000 0.000
#> SRR2050448     4  0.3797      0.777 0.420 0.000  0 0.580 0.000 0.000
#> SRR2050447     3  0.0000      1.000 0.000 0.000  1 0.000 0.000 0.000
#> SRR2050446     4  0.3797      0.777 0.420 0.000  0 0.580 0.000 0.000
#> SRR2050445     2  0.0000      0.996 0.000 1.000  0 0.000 0.000 0.000
#> SRR2050444     3  0.0000      1.000 0.000 0.000  1 0.000 0.000 0.000
#> SRR2050443     1  0.5975     -0.345 0.420 0.348  0 0.232 0.000 0.000
#> SRR2050442     5  0.1501      0.938 0.000 0.000  0 0.000 0.924 0.076
#> SRR2050441     3  0.0000      1.000 0.000 0.000  1 0.000 0.000 0.000
#> SRR2050440     6  0.0000      1.000 0.000 0.000  0 0.000 0.000 1.000
#> SRR2050439     5  0.1501      0.938 0.000 0.000  0 0.000 0.924 0.076
#> SRR2050438     3  0.0000      1.000 0.000 0.000  1 0.000 0.000 0.000
#> SRR2050437     6  0.0000      1.000 0.000 0.000  0 0.000 0.000 1.000
#> SRR2050436     5  0.1501      0.938 0.000 0.000  0 0.000 0.924 0.076
#> SRR2050435     3  0.0000      1.000 0.000 0.000  1 0.000 0.000 0.000
#> SRR2050434     5  0.1501      0.938 0.000 0.000  0 0.000 0.924 0.076
#> SRR2050433     2  0.0000      0.996 0.000 1.000  0 0.000 0.000 0.000
#> SRR2050432     1  0.3797      0.672 0.580 0.000  0 0.420 0.000 0.000
#> SRR2050431     1  0.4728      0.629 0.556 0.000  0 0.392 0.052 0.000
#> SRR2050430     1  0.4905      0.604 0.580 0.000  0 0.344 0.000 0.076
#> SRR2050429     6  0.0000      1.000 0.000 0.000  0 0.000 0.000 1.000

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

consensus_heatmap(res, k = 2)

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

consensus_heatmap(res, k = 3)

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

consensus_heatmap(res, k = 4)

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

consensus_heatmap(res, k = 5)

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

consensus_heatmap(res, k = 6)

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

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

membership_heatmap(res, k = 2)

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

membership_heatmap(res, k = 3)

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

membership_heatmap(res, k = 4)

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

membership_heatmap(res, k = 5)

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

membership_heatmap(res, k = 6)

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

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

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

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

get_signatures(res, k = 3)

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

get_signatures(res, k = 4)

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

get_signatures(res, k = 5)

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

get_signatures(res, k = 6)

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

Signature heatmaps where rows are not scaled:

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

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

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

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

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

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

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

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

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

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

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk MAD-hclust-signature_compare

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

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

An example of the output of tb is:

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

The columns in tb are:

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

UMAP plot which shows how samples are separated.

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

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

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

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

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

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

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

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

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

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

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk MAD-hclust-collect-classes

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


MAD:kmeans*

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

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

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

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

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

collect_plots(res)

plot of chunk MAD-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.427           0.767       0.888         0.4652 0.493   0.493
#> 3 3 0.831           0.861       0.918         0.3649 0.654   0.421
#> 4 4 0.737           0.786       0.837         0.1632 0.862   0.625
#> 5 5 0.887           0.947       0.931         0.0719 0.931   0.727
#> 6 6 0.915           0.847       0.887         0.0367 0.983   0.913

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

suggest_best_k(res)
#> [1] 6

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

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

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>            class entropy silhouette    p1    p2
#> SRR2050410     2  0.0000      0.836 0.000 1.000
#> SRR2050427     1  0.6048      0.864 0.852 0.148
#> SRR2050426     1  0.6048      0.864 0.852 0.148
#> SRR2050425     2  0.0000      0.836 0.000 1.000
#> SRR2050424     1  0.0376      0.873 0.996 0.004
#> SRR2050423     1  0.6148      0.862 0.848 0.152
#> SRR2050422     2  0.3584      0.800 0.068 0.932
#> SRR2050421     1  0.6048      0.864 0.852 0.148
#> SRR2050420     1  0.6048      0.864 0.852 0.148
#> SRR2050419     2  0.0000      0.836 0.000 1.000
#> SRR2050418     2  0.9896      0.274 0.440 0.560
#> SRR2050417     2  0.9815      0.339 0.420 0.580
#> SRR2050416     2  0.0000      0.836 0.000 1.000
#> SRR2050415     1  0.0376      0.873 0.996 0.004
#> SRR2050414     2  0.9795      0.345 0.416 0.584
#> SRR2050413     2  0.0000      0.836 0.000 1.000
#> SRR2050412     1  0.6048      0.864 0.852 0.148
#> SRR2050411     1  0.7602      0.780 0.780 0.220
#> SRR2050409     2  0.0000      0.836 0.000 1.000
#> SRR2050408     1  0.9522      0.445 0.628 0.372
#> SRR2050407     2  0.0000      0.836 0.000 1.000
#> SRR2050406     1  0.0376      0.873 0.996 0.004
#> SRR2050405     2  0.9795      0.345 0.416 0.584
#> SRR2050404     2  0.0000      0.836 0.000 1.000
#> SRR2050403     1  0.7602      0.780 0.780 0.220
#> SRR2050402     2  0.0000      0.836 0.000 1.000
#> SRR2050401     1  0.6048      0.864 0.852 0.148
#> SRR2050400     1  0.6048      0.864 0.852 0.148
#> SRR2050399     2  0.0000      0.836 0.000 1.000
#> SRR2050398     1  0.6048      0.864 0.852 0.148
#> SRR2050397     1  0.7602      0.780 0.780 0.220
#> SRR2050396     1  0.0376      0.873 0.996 0.004
#> SRR2050395     1  0.9129      0.572 0.672 0.328
#> SRR2050394     2  0.0000      0.836 0.000 1.000
#> SRR2050393     1  0.0376      0.873 0.996 0.004
#> SRR2050392     2  0.0000      0.836 0.000 1.000
#> SRR2050465     2  0.0000      0.836 0.000 1.000
#> SRR2050464     1  0.0376      0.873 0.996 0.004
#> SRR2050463     2  0.9795      0.345 0.416 0.584
#> SRR2050462     2  0.0000      0.836 0.000 1.000
#> SRR2050461     1  0.0376      0.873 0.996 0.004
#> SRR2050460     1  0.6973      0.825 0.812 0.188
#> SRR2050459     2  0.0000      0.836 0.000 1.000
#> SRR2050458     1  0.0376      0.873 0.996 0.004
#> SRR2050457     2  0.6887      0.697 0.184 0.816
#> SRR2050456     2  0.0000      0.836 0.000 1.000
#> SRR2050455     1  0.0376      0.873 0.996 0.004
#> SRR2050454     2  0.9795      0.345 0.416 0.584
#> SRR2050453     2  0.0000      0.836 0.000 1.000
#> SRR2050452     1  0.0376      0.873 0.996 0.004
#> SRR2050451     2  0.9795      0.345 0.416 0.584
#> SRR2050450     2  0.0000      0.836 0.000 1.000
#> SRR2050449     1  0.0376      0.873 0.996 0.004
#> SRR2050448     2  0.9795      0.345 0.416 0.584
#> SRR2050447     1  0.0376      0.873 0.996 0.004
#> SRR2050446     2  0.9795      0.345 0.416 0.584
#> SRR2050445     2  0.0000      0.836 0.000 1.000
#> SRR2050444     1  0.0376      0.873 0.996 0.004
#> SRR2050443     2  0.9795      0.345 0.416 0.584
#> SRR2050442     2  0.0000      0.836 0.000 1.000
#> SRR2050441     1  0.0376      0.873 0.996 0.004
#> SRR2050440     1  0.2043      0.875 0.968 0.032
#> SRR2050439     2  0.0000      0.836 0.000 1.000
#> SRR2050438     1  0.0000      0.871 1.000 0.000
#> SRR2050437     1  0.2043      0.875 0.968 0.032
#> SRR2050436     2  0.3584      0.800 0.068 0.932
#> SRR2050435     1  0.0376      0.873 0.996 0.004
#> SRR2050434     2  0.3584      0.800 0.068 0.932
#> SRR2050433     2  0.0000      0.836 0.000 1.000
#> SRR2050432     1  0.6048      0.864 0.852 0.148
#> SRR2050431     1  0.6048      0.864 0.852 0.148
#> SRR2050430     1  0.6048      0.864 0.852 0.148
#> SRR2050429     1  0.6048      0.864 0.852 0.148

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>            class entropy silhouette    p1    p2    p3
#> SRR2050410     2  0.0000    0.94540 0.000 1.000 0.000
#> SRR2050427     1  0.0424    0.87760 0.992 0.008 0.000
#> SRR2050426     1  0.0424    0.87760 0.992 0.008 0.000
#> SRR2050425     2  0.0000    0.94540 0.000 1.000 0.000
#> SRR2050424     3  0.2261    0.99937 0.068 0.000 0.932
#> SRR2050423     1  0.0892    0.86715 0.980 0.000 0.020
#> SRR2050422     1  0.8138    0.18881 0.480 0.452 0.068
#> SRR2050421     1  0.0424    0.87760 0.992 0.008 0.000
#> SRR2050420     1  0.0424    0.87760 0.992 0.008 0.000
#> SRR2050419     2  0.0000    0.94540 0.000 1.000 0.000
#> SRR2050418     1  0.0592    0.87705 0.988 0.012 0.000
#> SRR2050417     1  0.0592    0.87705 0.988 0.012 0.000
#> SRR2050416     2  0.1163    0.93380 0.000 0.972 0.028
#> SRR2050415     3  0.2261    0.99937 0.068 0.000 0.932
#> SRR2050414     1  0.5858    0.72423 0.740 0.240 0.020
#> SRR2050413     2  0.2066    0.91876 0.000 0.940 0.060
#> SRR2050412     1  0.0424    0.87760 0.992 0.008 0.000
#> SRR2050411     1  0.0424    0.87760 0.992 0.008 0.000
#> SRR2050409     2  0.0000    0.94540 0.000 1.000 0.000
#> SRR2050408     1  0.0424    0.87760 0.992 0.008 0.000
#> SRR2050407     2  0.0000    0.94540 0.000 1.000 0.000
#> SRR2050406     3  0.2261    0.99937 0.068 0.000 0.932
#> SRR2050405     1  0.5858    0.72423 0.740 0.240 0.020
#> SRR2050404     2  0.0000    0.94540 0.000 1.000 0.000
#> SRR2050403     1  0.0424    0.87760 0.992 0.008 0.000
#> SRR2050402     2  0.0000    0.94540 0.000 1.000 0.000
#> SRR2050401     1  0.0424    0.87760 0.992 0.008 0.000
#> SRR2050400     1  0.0424    0.87760 0.992 0.008 0.000
#> SRR2050399     2  0.1964    0.92082 0.000 0.944 0.056
#> SRR2050398     1  0.0424    0.87760 0.992 0.008 0.000
#> SRR2050397     1  0.0424    0.87760 0.992 0.008 0.000
#> SRR2050396     3  0.2261    0.99937 0.068 0.000 0.932
#> SRR2050395     1  0.1781    0.86488 0.960 0.020 0.020
#> SRR2050394     2  0.0000    0.94540 0.000 1.000 0.000
#> SRR2050393     3  0.2261    0.99937 0.068 0.000 0.932
#> SRR2050392     2  0.6079    0.23193 0.388 0.612 0.000
#> SRR2050465     2  0.0000    0.94540 0.000 1.000 0.000
#> SRR2050464     3  0.2261    0.99937 0.068 0.000 0.932
#> SRR2050463     1  0.5858    0.72423 0.740 0.240 0.020
#> SRR2050462     2  0.0000    0.94540 0.000 1.000 0.000
#> SRR2050461     3  0.2261    0.99937 0.068 0.000 0.932
#> SRR2050460     1  0.0892    0.86715 0.980 0.000 0.020
#> SRR2050459     2  0.0000    0.94540 0.000 1.000 0.000
#> SRR2050458     3  0.2261    0.99937 0.068 0.000 0.932
#> SRR2050457     2  0.6625   -0.00334 0.440 0.552 0.008
#> SRR2050456     2  0.0000    0.94540 0.000 1.000 0.000
#> SRR2050455     3  0.2261    0.99937 0.068 0.000 0.932
#> SRR2050454     1  0.5659    0.71769 0.740 0.248 0.012
#> SRR2050453     2  0.0000    0.94540 0.000 1.000 0.000
#> SRR2050452     3  0.2261    0.99937 0.068 0.000 0.932
#> SRR2050451     1  0.5858    0.72423 0.740 0.240 0.020
#> SRR2050450     2  0.0000    0.94540 0.000 1.000 0.000
#> SRR2050449     3  0.2261    0.99937 0.068 0.000 0.932
#> SRR2050448     1  0.5858    0.72423 0.740 0.240 0.020
#> SRR2050447     3  0.2261    0.99937 0.068 0.000 0.932
#> SRR2050446     1  0.5858    0.72423 0.740 0.240 0.020
#> SRR2050445     2  0.0000    0.94540 0.000 1.000 0.000
#> SRR2050444     3  0.2261    0.99937 0.068 0.000 0.932
#> SRR2050443     1  0.5858    0.72423 0.740 0.240 0.020
#> SRR2050442     2  0.2165    0.91661 0.000 0.936 0.064
#> SRR2050441     3  0.2261    0.99937 0.068 0.000 0.932
#> SRR2050440     1  0.1529    0.86612 0.960 0.000 0.040
#> SRR2050439     2  0.2165    0.91661 0.000 0.936 0.064
#> SRR2050438     3  0.2165    0.99558 0.064 0.000 0.936
#> SRR2050437     1  0.1529    0.86612 0.960 0.000 0.040
#> SRR2050436     1  0.8138    0.18881 0.480 0.452 0.068
#> SRR2050435     3  0.2165    0.99558 0.064 0.000 0.936
#> SRR2050434     1  0.7318    0.64328 0.668 0.264 0.068
#> SRR2050433     2  0.0000    0.94540 0.000 1.000 0.000
#> SRR2050432     1  0.0424    0.87760 0.992 0.008 0.000
#> SRR2050431     1  0.0424    0.87760 0.992 0.008 0.000
#> SRR2050430     1  0.1015    0.87272 0.980 0.008 0.012
#> SRR2050429     1  0.1015    0.87272 0.980 0.008 0.012

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> SRR2050410     2  0.0000     0.9393 0.000 1.000 0.000 0.000
#> SRR2050427     1  0.0000     0.8601 1.000 0.000 0.000 0.000
#> SRR2050426     1  0.0000     0.8601 1.000 0.000 0.000 0.000
#> SRR2050425     2  0.0188     0.9388 0.000 0.996 0.004 0.000
#> SRR2050424     3  0.0779     0.9878 0.004 0.000 0.980 0.016
#> SRR2050423     4  0.6147     0.5539 0.380 0.000 0.056 0.564
#> SRR2050422     4  0.6695     0.1841 0.220 0.164 0.000 0.616
#> SRR2050421     1  0.0000     0.8601 1.000 0.000 0.000 0.000
#> SRR2050420     1  0.0000     0.8601 1.000 0.000 0.000 0.000
#> SRR2050419     2  0.0000     0.9393 0.000 1.000 0.000 0.000
#> SRR2050418     1  0.3219     0.6887 0.836 0.000 0.000 0.164
#> SRR2050417     1  0.4624     0.2284 0.660 0.000 0.000 0.340
#> SRR2050416     2  0.0376     0.9371 0.000 0.992 0.004 0.004
#> SRR2050415     3  0.0779     0.9878 0.004 0.000 0.980 0.016
#> SRR2050414     4  0.7809     0.7000 0.268 0.112 0.056 0.564
#> SRR2050413     2  0.4406     0.6790 0.000 0.700 0.000 0.300
#> SRR2050412     1  0.0000     0.8601 1.000 0.000 0.000 0.000
#> SRR2050411     1  0.2149     0.8011 0.912 0.000 0.000 0.088
#> SRR2050409     2  0.0000     0.9393 0.000 1.000 0.000 0.000
#> SRR2050408     1  0.2408     0.7827 0.896 0.000 0.000 0.104
#> SRR2050407     2  0.0000     0.9393 0.000 1.000 0.000 0.000
#> SRR2050406     3  0.0188     0.9920 0.004 0.000 0.996 0.000
#> SRR2050405     4  0.7809     0.7000 0.268 0.112 0.056 0.564
#> SRR2050404     2  0.0188     0.9388 0.000 0.996 0.004 0.000
#> SRR2050403     1  0.2149     0.8011 0.912 0.000 0.000 0.088
#> SRR2050402     2  0.0000     0.9393 0.000 1.000 0.000 0.000
#> SRR2050401     1  0.0000     0.8601 1.000 0.000 0.000 0.000
#> SRR2050400     1  0.0000     0.8601 1.000 0.000 0.000 0.000
#> SRR2050399     2  0.2345     0.8697 0.000 0.900 0.000 0.100
#> SRR2050398     1  0.0000     0.8601 1.000 0.000 0.000 0.000
#> SRR2050397     1  0.2149     0.8011 0.912 0.000 0.000 0.088
#> SRR2050396     3  0.0188     0.9920 0.004 0.000 0.996 0.000
#> SRR2050395     4  0.6939     0.6071 0.348 0.032 0.056 0.564
#> SRR2050394     2  0.0000     0.9393 0.000 1.000 0.000 0.000
#> SRR2050393     3  0.0188     0.9920 0.004 0.000 0.996 0.000
#> SRR2050392     4  0.7596     0.6658 0.252 0.160 0.024 0.564
#> SRR2050465     2  0.0188     0.9388 0.000 0.996 0.004 0.000
#> SRR2050464     3  0.0188     0.9920 0.004 0.000 0.996 0.000
#> SRR2050463     4  0.7809     0.7000 0.268 0.112 0.056 0.564
#> SRR2050462     2  0.0188     0.9388 0.000 0.996 0.004 0.000
#> SRR2050461     3  0.0779     0.9878 0.004 0.000 0.980 0.016
#> SRR2050460     4  0.6110     0.5661 0.368 0.000 0.056 0.576
#> SRR2050459     2  0.0000     0.9393 0.000 1.000 0.000 0.000
#> SRR2050458     3  0.0188     0.9920 0.004 0.000 0.996 0.000
#> SRR2050457     4  0.7867     0.6167 0.176 0.220 0.040 0.564
#> SRR2050456     2  0.0000     0.9393 0.000 1.000 0.000 0.000
#> SRR2050455     3  0.0188     0.9920 0.004 0.000 0.996 0.000
#> SRR2050454     4  0.7809     0.7000 0.268 0.112 0.056 0.564
#> SRR2050453     2  0.0188     0.9388 0.000 0.996 0.004 0.000
#> SRR2050452     3  0.0188     0.9920 0.004 0.000 0.996 0.000
#> SRR2050451     4  0.7809     0.7000 0.268 0.112 0.056 0.564
#> SRR2050450     2  0.0188     0.9388 0.000 0.996 0.004 0.000
#> SRR2050449     3  0.0188     0.9920 0.004 0.000 0.996 0.000
#> SRR2050448     4  0.7809     0.7000 0.268 0.112 0.056 0.564
#> SRR2050447     3  0.0188     0.9920 0.004 0.000 0.996 0.000
#> SRR2050446     4  0.7809     0.7000 0.268 0.112 0.056 0.564
#> SRR2050445     2  0.0000     0.9393 0.000 1.000 0.000 0.000
#> SRR2050444     3  0.0188     0.9920 0.004 0.000 0.996 0.000
#> SRR2050443     4  0.7809     0.7000 0.268 0.112 0.056 0.564
#> SRR2050442     2  0.4843     0.5700 0.000 0.604 0.000 0.396
#> SRR2050441     3  0.0779     0.9878 0.004 0.000 0.980 0.016
#> SRR2050440     4  0.5497    -0.0538 0.460 0.000 0.016 0.524
#> SRR2050439     2  0.4843     0.5700 0.000 0.604 0.000 0.396
#> SRR2050438     3  0.1398     0.9692 0.004 0.000 0.956 0.040
#> SRR2050437     4  0.5497    -0.0538 0.460 0.000 0.016 0.524
#> SRR2050436     4  0.6709     0.1891 0.212 0.172 0.000 0.616
#> SRR2050435     3  0.1398     0.9692 0.004 0.000 0.956 0.040
#> SRR2050434     4  0.2408     0.3922 0.104 0.000 0.000 0.896
#> SRR2050433     2  0.0000     0.9393 0.000 1.000 0.000 0.000
#> SRR2050432     1  0.0000     0.8601 1.000 0.000 0.000 0.000
#> SRR2050431     1  0.0000     0.8601 1.000 0.000 0.000 0.000
#> SRR2050430     1  0.4522     0.4563 0.680 0.000 0.000 0.320
#> SRR2050429     1  0.4500     0.4621 0.684 0.000 0.000 0.316

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>            class entropy silhouette    p1    p2    p3    p4    p5
#> SRR2050410     2  0.0404      0.974 0.000 0.988 0.000 0.012 0.000
#> SRR2050427     1  0.0404      0.967 0.988 0.000 0.000 0.000 0.012
#> SRR2050426     1  0.0162      0.968 0.996 0.000 0.000 0.000 0.004
#> SRR2050425     2  0.0000      0.974 0.000 1.000 0.000 0.000 0.000
#> SRR2050424     3  0.1668      0.960 0.000 0.000 0.940 0.032 0.028
#> SRR2050423     4  0.3163      0.969 0.164 0.000 0.012 0.824 0.000
#> SRR2050422     5  0.2476      0.878 0.020 0.012 0.000 0.064 0.904
#> SRR2050421     1  0.0404      0.967 0.988 0.000 0.000 0.000 0.012
#> SRR2050420     1  0.0162      0.968 0.996 0.000 0.000 0.000 0.004
#> SRR2050419     2  0.0404      0.974 0.000 0.988 0.000 0.012 0.000
#> SRR2050418     1  0.2136      0.891 0.904 0.000 0.000 0.088 0.008
#> SRR2050417     1  0.2773      0.775 0.836 0.000 0.000 0.164 0.000
#> SRR2050416     2  0.2376      0.902 0.000 0.904 0.000 0.052 0.044
#> SRR2050415     3  0.1668      0.960 0.000 0.000 0.940 0.032 0.028
#> SRR2050414     4  0.3541      0.987 0.144 0.020 0.012 0.824 0.000
#> SRR2050413     5  0.3043      0.844 0.000 0.080 0.000 0.056 0.864
#> SRR2050412     1  0.0290      0.968 0.992 0.000 0.000 0.000 0.008
#> SRR2050411     1  0.0609      0.961 0.980 0.000 0.000 0.020 0.000
#> SRR2050409     2  0.0404      0.974 0.000 0.988 0.000 0.012 0.000
#> SRR2050408     1  0.0880      0.952 0.968 0.000 0.000 0.032 0.000
#> SRR2050407     2  0.0404      0.974 0.000 0.988 0.000 0.012 0.000
#> SRR2050406     3  0.0000      0.979 0.000 0.000 1.000 0.000 0.000
#> SRR2050405     4  0.3541      0.987 0.144 0.020 0.012 0.824 0.000
#> SRR2050404     2  0.0000      0.974 0.000 1.000 0.000 0.000 0.000
#> SRR2050403     1  0.0609      0.961 0.980 0.000 0.000 0.020 0.000
#> SRR2050402     2  0.1341      0.937 0.000 0.944 0.000 0.056 0.000
#> SRR2050401     1  0.0290      0.968 0.992 0.000 0.000 0.000 0.008
#> SRR2050400     1  0.0162      0.968 0.996 0.000 0.000 0.000 0.004
#> SRR2050399     2  0.4199      0.739 0.000 0.764 0.000 0.056 0.180
#> SRR2050398     1  0.0290      0.968 0.992 0.000 0.000 0.000 0.008
#> SRR2050397     1  0.0609      0.961 0.980 0.000 0.000 0.020 0.000
#> SRR2050396     3  0.0000      0.979 0.000 0.000 1.000 0.000 0.000
#> SRR2050395     4  0.3163      0.969 0.164 0.000 0.012 0.824 0.000
#> SRR2050394     2  0.0404      0.974 0.000 0.988 0.000 0.012 0.000
#> SRR2050393     3  0.0000      0.979 0.000 0.000 1.000 0.000 0.000
#> SRR2050392     4  0.3400      0.969 0.136 0.036 0.000 0.828 0.000
#> SRR2050465     2  0.0000      0.974 0.000 1.000 0.000 0.000 0.000
#> SRR2050464     3  0.0000      0.979 0.000 0.000 1.000 0.000 0.000
#> SRR2050463     4  0.3541      0.987 0.144 0.020 0.012 0.824 0.000
#> SRR2050462     2  0.0000      0.974 0.000 1.000 0.000 0.000 0.000
#> SRR2050461     3  0.0671      0.974 0.000 0.000 0.980 0.004 0.016
#> SRR2050460     4  0.3163      0.969 0.164 0.000 0.012 0.824 0.000
#> SRR2050459     2  0.0162      0.974 0.000 0.996 0.000 0.004 0.000
#> SRR2050458     3  0.0000      0.979 0.000 0.000 1.000 0.000 0.000
#> SRR2050457     4  0.3633      0.957 0.116 0.040 0.012 0.832 0.000
#> SRR2050456     2  0.0404      0.974 0.000 0.988 0.000 0.012 0.000
#> SRR2050455     3  0.0000      0.979 0.000 0.000 1.000 0.000 0.000
#> SRR2050454     4  0.3541      0.987 0.144 0.020 0.012 0.824 0.000
#> SRR2050453     2  0.0000      0.974 0.000 1.000 0.000 0.000 0.000
#> SRR2050452     3  0.0000      0.979 0.000 0.000 1.000 0.000 0.000
#> SRR2050451     4  0.3541      0.987 0.144 0.020 0.012 0.824 0.000
#> SRR2050450     2  0.0000      0.974 0.000 1.000 0.000 0.000 0.000
#> SRR2050449     3  0.0000      0.979 0.000 0.000 1.000 0.000 0.000
#> SRR2050448     4  0.3541      0.987 0.144 0.020 0.012 0.824 0.000
#> SRR2050447     3  0.0000      0.979 0.000 0.000 1.000 0.000 0.000
#> SRR2050446     4  0.3541      0.987 0.144 0.020 0.012 0.824 0.000
#> SRR2050445     2  0.0404      0.974 0.000 0.988 0.000 0.012 0.000
#> SRR2050444     3  0.0000      0.979 0.000 0.000 1.000 0.000 0.000
#> SRR2050443     4  0.3541      0.987 0.144 0.020 0.012 0.824 0.000
#> SRR2050442     5  0.2230      0.872 0.000 0.044 0.000 0.044 0.912
#> SRR2050441     3  0.1830      0.956 0.000 0.000 0.932 0.040 0.028
#> SRR2050440     5  0.4155      0.842 0.144 0.000 0.000 0.076 0.780
#> SRR2050439     5  0.2230      0.872 0.000 0.044 0.000 0.044 0.912
#> SRR2050438     3  0.2511      0.929 0.000 0.000 0.892 0.080 0.028
#> SRR2050437     5  0.4155      0.842 0.144 0.000 0.000 0.076 0.780
#> SRR2050436     5  0.1299      0.882 0.020 0.012 0.000 0.008 0.960
#> SRR2050435     3  0.2054      0.949 0.000 0.000 0.920 0.052 0.028
#> SRR2050434     5  0.1195      0.876 0.012 0.000 0.000 0.028 0.960
#> SRR2050433     2  0.0000      0.974 0.000 1.000 0.000 0.000 0.000
#> SRR2050432     1  0.0404      0.967 0.988 0.000 0.000 0.000 0.012
#> SRR2050431     1  0.0290      0.966 0.992 0.000 0.000 0.000 0.008
#> SRR2050430     5  0.4036      0.840 0.144 0.000 0.000 0.068 0.788
#> SRR2050429     5  0.4618      0.783 0.208 0.000 0.000 0.068 0.724

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>            class entropy silhouette    p1    p2    p3    p4    p5    p6
#> SRR2050410     2  0.1546      0.935 0.000 0.944 0.000 0.020 0.020 0.016
#> SRR2050427     1  0.1700      0.903 0.928 0.000 0.000 0.000 0.024 0.048
#> SRR2050426     1  0.1327      0.907 0.936 0.000 0.000 0.000 0.000 0.064
#> SRR2050425     2  0.0951      0.935 0.000 0.968 0.000 0.004 0.020 0.008
#> SRR2050424     3  0.3166      0.868 0.000 0.000 0.816 0.024 0.156 0.004
#> SRR2050423     4  0.1075      0.986 0.048 0.000 0.000 0.952 0.000 0.000
#> SRR2050422     5  0.3672      0.612 0.000 0.000 0.000 0.000 0.632 0.368
#> SRR2050421     1  0.1700      0.903 0.928 0.000 0.000 0.000 0.024 0.048
#> SRR2050420     1  0.1327      0.907 0.936 0.000 0.000 0.000 0.000 0.064
#> SRR2050419     2  0.0820      0.941 0.000 0.972 0.000 0.016 0.000 0.012
#> SRR2050418     1  0.3316      0.874 0.812 0.000 0.000 0.052 0.136 0.000
#> SRR2050417     1  0.3852      0.834 0.788 0.000 0.000 0.088 0.116 0.008
#> SRR2050416     2  0.3861      0.461 0.000 0.640 0.000 0.000 0.352 0.008
#> SRR2050415     3  0.3166      0.868 0.000 0.000 0.816 0.024 0.156 0.004
#> SRR2050414     4  0.1152      0.987 0.044 0.004 0.000 0.952 0.000 0.000
#> SRR2050413     5  0.4034      0.605 0.000 0.020 0.000 0.000 0.652 0.328
#> SRR2050412     1  0.1141      0.913 0.948 0.000 0.000 0.000 0.052 0.000
#> SRR2050411     1  0.2404      0.903 0.872 0.000 0.000 0.000 0.112 0.016
#> SRR2050409     2  0.1546      0.935 0.000 0.944 0.000 0.020 0.020 0.016
#> SRR2050408     1  0.2547      0.902 0.868 0.000 0.000 0.004 0.112 0.016
#> SRR2050407     2  0.0820      0.941 0.000 0.972 0.000 0.016 0.000 0.012
#> SRR2050406     3  0.0000      0.932 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2050405     4  0.1511      0.986 0.044 0.004 0.000 0.940 0.012 0.000
#> SRR2050404     2  0.0260      0.942 0.000 0.992 0.000 0.000 0.000 0.008
#> SRR2050403     1  0.2404      0.903 0.872 0.000 0.000 0.000 0.112 0.016
#> SRR2050402     2  0.3357      0.708 0.000 0.764 0.000 0.004 0.224 0.008
#> SRR2050401     1  0.1204      0.912 0.944 0.000 0.000 0.000 0.056 0.000
#> SRR2050400     1  0.2384      0.908 0.888 0.000 0.000 0.000 0.048 0.064
#> SRR2050399     5  0.3634      0.271 0.000 0.356 0.000 0.000 0.644 0.000
#> SRR2050398     1  0.0632      0.912 0.976 0.000 0.000 0.000 0.024 0.000
#> SRR2050397     1  0.2404      0.903 0.872 0.000 0.000 0.000 0.112 0.016
#> SRR2050396     3  0.0146      0.931 0.000 0.000 0.996 0.000 0.004 0.000
#> SRR2050395     4  0.1219      0.986 0.048 0.000 0.000 0.948 0.004 0.000
#> SRR2050394     2  0.0909      0.941 0.000 0.968 0.000 0.020 0.000 0.012
#> SRR2050393     3  0.0000      0.932 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2050392     4  0.1370      0.981 0.036 0.004 0.000 0.948 0.012 0.000
#> SRR2050465     2  0.0146      0.942 0.000 0.996 0.000 0.000 0.000 0.004
#> SRR2050464     3  0.0000      0.932 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2050463     4  0.1511      0.986 0.044 0.004 0.000 0.940 0.012 0.000
#> SRR2050462     2  0.0146      0.942 0.000 0.996 0.000 0.000 0.000 0.004
#> SRR2050461     3  0.1956      0.905 0.000 0.000 0.908 0.008 0.080 0.004
#> SRR2050460     4  0.1434      0.984 0.048 0.000 0.000 0.940 0.012 0.000
#> SRR2050459     2  0.0146      0.943 0.000 0.996 0.000 0.004 0.000 0.000
#> SRR2050458     3  0.0000      0.932 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2050457     4  0.1882      0.957 0.024 0.020 0.000 0.928 0.028 0.000
#> SRR2050456     2  0.0820      0.941 0.000 0.972 0.000 0.016 0.000 0.012
#> SRR2050455     3  0.0000      0.932 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2050454     4  0.1511      0.986 0.044 0.004 0.000 0.940 0.012 0.000
#> SRR2050453     2  0.0146      0.942 0.000 0.996 0.000 0.000 0.000 0.004
#> SRR2050452     3  0.0000      0.932 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2050451     4  0.1511      0.986 0.044 0.004 0.000 0.940 0.012 0.000
#> SRR2050450     2  0.0146      0.942 0.000 0.996 0.000 0.000 0.000 0.004
#> SRR2050449     3  0.0000      0.932 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2050448     4  0.1511      0.986 0.044 0.004 0.000 0.940 0.012 0.000
#> SRR2050447     3  0.0000      0.932 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2050446     4  0.1511      0.986 0.044 0.004 0.000 0.940 0.012 0.000
#> SRR2050445     2  0.0820      0.941 0.000 0.972 0.000 0.016 0.000 0.012
#> SRR2050444     3  0.0000      0.932 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2050443     4  0.1511      0.986 0.044 0.004 0.000 0.940 0.012 0.000
#> SRR2050442     5  0.3907      0.589 0.000 0.000 0.000 0.004 0.588 0.408
#> SRR2050441     3  0.3274      0.862 0.000 0.000 0.804 0.024 0.168 0.004
#> SRR2050440     6  0.1124      0.670 0.036 0.000 0.000 0.000 0.008 0.956
#> SRR2050439     5  0.3907      0.589 0.000 0.000 0.000 0.004 0.588 0.408
#> SRR2050438     3  0.4989      0.763 0.000 0.000 0.692 0.024 0.168 0.116
#> SRR2050437     6  0.1124      0.670 0.036 0.000 0.000 0.000 0.008 0.956
#> SRR2050436     6  0.3930     -0.163 0.000 0.000 0.000 0.004 0.420 0.576
#> SRR2050435     3  0.3812      0.847 0.000 0.000 0.780 0.024 0.168 0.028
#> SRR2050434     6  0.3930     -0.163 0.000 0.000 0.000 0.004 0.420 0.576
#> SRR2050433     2  0.0951      0.937 0.000 0.968 0.000 0.008 0.020 0.004
#> SRR2050432     1  0.1176      0.910 0.956 0.000 0.000 0.000 0.024 0.020
#> SRR2050431     1  0.2384      0.908 0.888 0.000 0.000 0.000 0.048 0.064
#> SRR2050430     6  0.1327      0.664 0.064 0.000 0.000 0.000 0.000 0.936
#> SRR2050429     6  0.2573      0.595 0.112 0.000 0.000 0.000 0.024 0.864

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

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

collect_plots(res)

plot of chunk MAD-skmeans-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 1.000           0.979       0.991         0.5071 0.493   0.493
#> 3 3 0.890           0.955       0.971         0.2862 0.830   0.664
#> 4 4 1.000           0.984       0.994         0.1456 0.877   0.660
#> 5 5 1.000           0.987       0.993         0.0659 0.919   0.696
#> 6 6 0.971           0.908       0.938         0.0273 0.968   0.844

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

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

There is also optional best \(k\) = 2 4 5 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
#> SRR2050410     2   0.000      0.992 0.000 1.000
#> SRR2050427     1   0.000      0.989 1.000 0.000
#> SRR2050426     1   0.000      0.989 1.000 0.000
#> SRR2050425     2   0.000      0.992 0.000 1.000
#> SRR2050424     1   0.000      0.989 1.000 0.000
#> SRR2050423     1   0.000      0.989 1.000 0.000
#> SRR2050422     2   0.000      0.992 0.000 1.000
#> SRR2050421     1   0.000      0.989 1.000 0.000
#> SRR2050420     1   0.000      0.989 1.000 0.000
#> SRR2050419     2   0.000      0.992 0.000 1.000
#> SRR2050418     2   0.697      0.769 0.188 0.812
#> SRR2050417     2   0.373      0.919 0.072 0.928
#> SRR2050416     2   0.000      0.992 0.000 1.000
#> SRR2050415     1   0.000      0.989 1.000 0.000
#> SRR2050414     2   0.000      0.992 0.000 1.000
#> SRR2050413     2   0.000      0.992 0.000 1.000
#> SRR2050412     1   0.000      0.989 1.000 0.000
#> SRR2050411     1   0.000      0.989 1.000 0.000
#> SRR2050409     2   0.000      0.992 0.000 1.000
#> SRR2050408     1   0.000      0.989 1.000 0.000
#> SRR2050407     2   0.000      0.992 0.000 1.000
#> SRR2050406     1   0.000      0.989 1.000 0.000
#> SRR2050405     2   0.000      0.992 0.000 1.000
#> SRR2050404     2   0.000      0.992 0.000 1.000
#> SRR2050403     1   0.000      0.989 1.000 0.000
#> SRR2050402     2   0.000      0.992 0.000 1.000
#> SRR2050401     1   0.000      0.989 1.000 0.000
#> SRR2050400     1   0.000      0.989 1.000 0.000
#> SRR2050399     2   0.000      0.992 0.000 1.000
#> SRR2050398     1   0.000      0.989 1.000 0.000
#> SRR2050397     1   0.000      0.989 1.000 0.000
#> SRR2050396     1   0.000      0.989 1.000 0.000
#> SRR2050395     1   0.952      0.397 0.628 0.372
#> SRR2050394     2   0.000      0.992 0.000 1.000
#> SRR2050393     1   0.000      0.989 1.000 0.000
#> SRR2050392     2   0.000      0.992 0.000 1.000
#> SRR2050465     2   0.000      0.992 0.000 1.000
#> SRR2050464     1   0.000      0.989 1.000 0.000
#> SRR2050463     2   0.000      0.992 0.000 1.000
#> SRR2050462     2   0.000      0.992 0.000 1.000
#> SRR2050461     1   0.000      0.989 1.000 0.000
#> SRR2050460     1   0.000      0.989 1.000 0.000
#> SRR2050459     2   0.000      0.992 0.000 1.000
#> SRR2050458     1   0.000      0.989 1.000 0.000
#> SRR2050457     2   0.000      0.992 0.000 1.000
#> SRR2050456     2   0.000      0.992 0.000 1.000
#> SRR2050455     1   0.000      0.989 1.000 0.000
#> SRR2050454     2   0.000      0.992 0.000 1.000
#> SRR2050453     2   0.000      0.992 0.000 1.000
#> SRR2050452     1   0.000      0.989 1.000 0.000
#> SRR2050451     2   0.000      0.992 0.000 1.000
#> SRR2050450     2   0.000      0.992 0.000 1.000
#> SRR2050449     1   0.000      0.989 1.000 0.000
#> SRR2050448     2   0.000      0.992 0.000 1.000
#> SRR2050447     1   0.000      0.989 1.000 0.000
#> SRR2050446     2   0.000      0.992 0.000 1.000
#> SRR2050445     2   0.000      0.992 0.000 1.000
#> SRR2050444     1   0.000      0.989 1.000 0.000
#> SRR2050443     2   0.000      0.992 0.000 1.000
#> SRR2050442     2   0.000      0.992 0.000 1.000
#> SRR2050441     1   0.000      0.989 1.000 0.000
#> SRR2050440     1   0.000      0.989 1.000 0.000
#> SRR2050439     2   0.000      0.992 0.000 1.000
#> SRR2050438     1   0.000      0.989 1.000 0.000
#> SRR2050437     1   0.000      0.989 1.000 0.000
#> SRR2050436     2   0.000      0.992 0.000 1.000
#> SRR2050435     1   0.000      0.989 1.000 0.000
#> SRR2050434     2   0.000      0.992 0.000 1.000
#> SRR2050433     2   0.000      0.992 0.000 1.000
#> SRR2050432     1   0.000      0.989 1.000 0.000
#> SRR2050431     1   0.000      0.989 1.000 0.000
#> SRR2050430     1   0.000      0.989 1.000 0.000
#> SRR2050429     1   0.000      0.989 1.000 0.000

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>            class entropy silhouette    p1    p2    p3
#> SRR2050410     2  0.0000      0.957 0.000 1.000 0.000
#> SRR2050427     1  0.1753      0.968 0.952 0.000 0.048
#> SRR2050426     1  0.1753      0.968 0.952 0.000 0.048
#> SRR2050425     2  0.0000      0.957 0.000 1.000 0.000
#> SRR2050424     3  0.0000      1.000 0.000 0.000 1.000
#> SRR2050423     1  0.0000      0.963 1.000 0.000 0.000
#> SRR2050422     2  0.0237      0.955 0.004 0.996 0.000
#> SRR2050421     1  0.1753      0.968 0.952 0.000 0.048
#> SRR2050420     1  0.1753      0.968 0.952 0.000 0.048
#> SRR2050419     2  0.0000      0.957 0.000 1.000 0.000
#> SRR2050418     1  0.0000      0.963 1.000 0.000 0.000
#> SRR2050417     1  0.0000      0.963 1.000 0.000 0.000
#> SRR2050416     2  0.0000      0.957 0.000 1.000 0.000
#> SRR2050415     3  0.0000      1.000 0.000 0.000 1.000
#> SRR2050414     2  0.4654      0.803 0.208 0.792 0.000
#> SRR2050413     2  0.0000      0.957 0.000 1.000 0.000
#> SRR2050412     1  0.1753      0.968 0.952 0.000 0.048
#> SRR2050411     1  0.0000      0.963 1.000 0.000 0.000
#> SRR2050409     2  0.0000      0.957 0.000 1.000 0.000
#> SRR2050408     1  0.0000      0.963 1.000 0.000 0.000
#> SRR2050407     2  0.0000      0.957 0.000 1.000 0.000
#> SRR2050406     3  0.0000      1.000 0.000 0.000 1.000
#> SRR2050405     2  0.4654      0.803 0.208 0.792 0.000
#> SRR2050404     2  0.0000      0.957 0.000 1.000 0.000
#> SRR2050403     1  0.0000      0.963 1.000 0.000 0.000
#> SRR2050402     2  0.0000      0.957 0.000 1.000 0.000
#> SRR2050401     1  0.1753      0.968 0.952 0.000 0.048
#> SRR2050400     1  0.1163      0.967 0.972 0.000 0.028
#> SRR2050399     2  0.0000      0.957 0.000 1.000 0.000
#> SRR2050398     1  0.1753      0.968 0.952 0.000 0.048
#> SRR2050397     1  0.0000      0.963 1.000 0.000 0.000
#> SRR2050396     3  0.0000      1.000 0.000 0.000 1.000
#> SRR2050395     1  0.0237      0.961 0.996 0.004 0.000
#> SRR2050394     2  0.0000      0.957 0.000 1.000 0.000
#> SRR2050393     3  0.0000      1.000 0.000 0.000 1.000
#> SRR2050392     2  0.1753      0.933 0.048 0.952 0.000
#> SRR2050465     2  0.0000      0.957 0.000 1.000 0.000
#> SRR2050464     3  0.0000      1.000 0.000 0.000 1.000
#> SRR2050463     2  0.4346      0.830 0.184 0.816 0.000
#> SRR2050462     2  0.0000      0.957 0.000 1.000 0.000
#> SRR2050461     3  0.0000      1.000 0.000 0.000 1.000
#> SRR2050460     1  0.0000      0.963 1.000 0.000 0.000
#> SRR2050459     2  0.0000      0.957 0.000 1.000 0.000
#> SRR2050458     3  0.0000      1.000 0.000 0.000 1.000
#> SRR2050457     2  0.0000      0.957 0.000 1.000 0.000
#> SRR2050456     2  0.0000      0.957 0.000 1.000 0.000
#> SRR2050455     3  0.0000      1.000 0.000 0.000 1.000
#> SRR2050454     2  0.4346      0.830 0.184 0.816 0.000
#> SRR2050453     2  0.0000      0.957 0.000 1.000 0.000
#> SRR2050452     3  0.0000      1.000 0.000 0.000 1.000
#> SRR2050451     2  0.4346      0.830 0.184 0.816 0.000
#> SRR2050450     2  0.0000      0.957 0.000 1.000 0.000
#> SRR2050449     3  0.0000      1.000 0.000 0.000 1.000
#> SRR2050448     2  0.4346      0.830 0.184 0.816 0.000
#> SRR2050447     3  0.0000      1.000 0.000 0.000 1.000
#> SRR2050446     2  0.4346      0.830 0.184 0.816 0.000
#> SRR2050445     2  0.0000      0.957 0.000 1.000 0.000
#> SRR2050444     3  0.0000      1.000 0.000 0.000 1.000
#> SRR2050443     2  0.1860      0.931 0.052 0.948 0.000
#> SRR2050442     2  0.0000      0.957 0.000 1.000 0.000
#> SRR2050441     3  0.0000      1.000 0.000 0.000 1.000
#> SRR2050440     3  0.0000      1.000 0.000 0.000 1.000
#> SRR2050439     2  0.0000      0.957 0.000 1.000 0.000
#> SRR2050438     3  0.0000      1.000 0.000 0.000 1.000
#> SRR2050437     3  0.0000      1.000 0.000 0.000 1.000
#> SRR2050436     2  0.0000      0.957 0.000 1.000 0.000
#> SRR2050435     3  0.0000      1.000 0.000 0.000 1.000
#> SRR2050434     2  0.0000      0.957 0.000 1.000 0.000
#> SRR2050433     2  0.0000      0.957 0.000 1.000 0.000
#> SRR2050432     1  0.1753      0.968 0.952 0.000 0.048
#> SRR2050431     1  0.1753      0.968 0.952 0.000 0.048
#> SRR2050430     1  0.3941      0.842 0.844 0.000 0.156
#> SRR2050429     1  0.1753      0.968 0.952 0.000 0.048

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette p1    p2 p3    p4
#> SRR2050410     2   0.000      1.000  0 1.000  0 0.000
#> SRR2050427     1   0.000      1.000  1 0.000  0 0.000
#> SRR2050426     1   0.000      1.000  1 0.000  0 0.000
#> SRR2050425     2   0.000      1.000  0 1.000  0 0.000
#> SRR2050424     3   0.000      1.000  0 0.000  1 0.000
#> SRR2050423     4   0.000      0.962  0 0.000  0 1.000
#> SRR2050422     2   0.000      1.000  0 1.000  0 0.000
#> SRR2050421     1   0.000      1.000  1 0.000  0 0.000
#> SRR2050420     1   0.000      1.000  1 0.000  0 0.000
#> SRR2050419     2   0.000      1.000  0 1.000  0 0.000
#> SRR2050418     1   0.000      1.000  1 0.000  0 0.000
#> SRR2050417     1   0.000      1.000  1 0.000  0 0.000
#> SRR2050416     2   0.000      1.000  0 1.000  0 0.000
#> SRR2050415     3   0.000      1.000  0 0.000  1 0.000
#> SRR2050414     4   0.000      0.962  0 0.000  0 1.000
#> SRR2050413     2   0.000      1.000  0 1.000  0 0.000
#> SRR2050412     1   0.000      1.000  1 0.000  0 0.000
#> SRR2050411     1   0.000      1.000  1 0.000  0 0.000
#> SRR2050409     2   0.000      1.000  0 1.000  0 0.000
#> SRR2050408     1   0.000      1.000  1 0.000  0 0.000
#> SRR2050407     2   0.000      1.000  0 1.000  0 0.000
#> SRR2050406     3   0.000      1.000  0 0.000  1 0.000
#> SRR2050405     4   0.000      0.962  0 0.000  0 1.000
#> SRR2050404     2   0.000      1.000  0 1.000  0 0.000
#> SRR2050403     1   0.000      1.000  1 0.000  0 0.000
#> SRR2050402     2   0.000      1.000  0 1.000  0 0.000
#> SRR2050401     1   0.000      1.000  1 0.000  0 0.000
#> SRR2050400     1   0.000      1.000  1 0.000  0 0.000
#> SRR2050399     2   0.000      1.000  0 1.000  0 0.000
#> SRR2050398     1   0.000      1.000  1 0.000  0 0.000
#> SRR2050397     1   0.000      1.000  1 0.000  0 0.000
#> SRR2050396     3   0.000      1.000  0 0.000  1 0.000
#> SRR2050395     4   0.000      0.962  0 0.000  0 1.000
#> SRR2050394     2   0.000      1.000  0 1.000  0 0.000
#> SRR2050393     3   0.000      1.000  0 0.000  1 0.000
#> SRR2050392     4   0.000      0.962  0 0.000  0 1.000
#> SRR2050465     2   0.000      1.000  0 1.000  0 0.000
#> SRR2050464     3   0.000      1.000  0 0.000  1 0.000
#> SRR2050463     4   0.000      0.962  0 0.000  0 1.000
#> SRR2050462     2   0.000      1.000  0 1.000  0 0.000
#> SRR2050461     3   0.000      1.000  0 0.000  1 0.000
#> SRR2050460     4   0.000      0.962  0 0.000  0 1.000
#> SRR2050459     2   0.000      1.000  0 1.000  0 0.000
#> SRR2050458     3   0.000      1.000  0 0.000  1 0.000
#> SRR2050457     4   0.489      0.299  0 0.412  0 0.588
#> SRR2050456     2   0.000      1.000  0 1.000  0 0.000
#> SRR2050455     3   0.000      1.000  0 0.000  1 0.000
#> SRR2050454     4   0.000      0.962  0 0.000  0 1.000
#> SRR2050453     2   0.000      1.000  0 1.000  0 0.000
#> SRR2050452     3   0.000      1.000  0 0.000  1 0.000
#> SRR2050451     4   0.000      0.962  0 0.000  0 1.000
#> SRR2050450     2   0.000      1.000  0 1.000  0 0.000
#> SRR2050449     3   0.000      1.000  0 0.000  1 0.000
#> SRR2050448     4   0.000      0.962  0 0.000  0 1.000
#> SRR2050447     3   0.000      1.000  0 0.000  1 0.000
#> SRR2050446     4   0.000      0.962  0 0.000  0 1.000
#> SRR2050445     2   0.000      1.000  0 1.000  0 0.000
#> SRR2050444     3   0.000      1.000  0 0.000  1 0.000
#> SRR2050443     4   0.000      0.962  0 0.000  0 1.000
#> SRR2050442     2   0.000      1.000  0 1.000  0 0.000
#> SRR2050441     3   0.000      1.000  0 0.000  1 0.000
#> SRR2050440     3   0.000      1.000  0 0.000  1 0.000
#> SRR2050439     2   0.000      1.000  0 1.000  0 0.000
#> SRR2050438     3   0.000      1.000  0 0.000  1 0.000
#> SRR2050437     3   0.000      1.000  0 0.000  1 0.000
#> SRR2050436     2   0.000      1.000  0 1.000  0 0.000
#> SRR2050435     3   0.000      1.000  0 0.000  1 0.000
#> SRR2050434     2   0.000      1.000  0 1.000  0 0.000
#> SRR2050433     2   0.000      1.000  0 1.000  0 0.000
#> SRR2050432     1   0.000      1.000  1 0.000  0 0.000
#> SRR2050431     1   0.000      1.000  1 0.000  0 0.000
#> SRR2050430     1   0.000      1.000  1 0.000  0 0.000
#> SRR2050429     1   0.000      1.000  1 0.000  0 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
#> SRR2050410     2  0.0000      0.994 0.000 1.000 0.00 0.000 0.000
#> SRR2050427     1  0.0000      0.999 1.000 0.000 0.00 0.000 0.000
#> SRR2050426     1  0.0000      0.999 1.000 0.000 0.00 0.000 0.000
#> SRR2050425     2  0.0000      0.994 0.000 1.000 0.00 0.000 0.000
#> SRR2050424     3  0.0000      1.000 0.000 0.000 1.00 0.000 0.000
#> SRR2050423     4  0.0000      1.000 0.000 0.000 0.00 1.000 0.000
#> SRR2050422     5  0.0510      0.943 0.000 0.016 0.00 0.000 0.984
#> SRR2050421     1  0.0000      0.999 1.000 0.000 0.00 0.000 0.000
#> SRR2050420     1  0.0000      0.999 1.000 0.000 0.00 0.000 0.000
#> SRR2050419     2  0.0000      0.994 0.000 1.000 0.00 0.000 0.000
#> SRR2050418     1  0.0000      0.999 1.000 0.000 0.00 0.000 0.000
#> SRR2050417     1  0.0000      0.999 1.000 0.000 0.00 0.000 0.000
#> SRR2050416     2  0.0000      0.994 0.000 1.000 0.00 0.000 0.000
#> SRR2050415     3  0.0000      1.000 0.000 0.000 1.00 0.000 0.000
#> SRR2050414     4  0.0000      1.000 0.000 0.000 0.00 1.000 0.000
#> SRR2050413     2  0.0609      0.978 0.000 0.980 0.00 0.000 0.020
#> SRR2050412     1  0.0000      0.999 1.000 0.000 0.00 0.000 0.000
#> SRR2050411     1  0.0000      0.999 1.000 0.000 0.00 0.000 0.000
#> SRR2050409     2  0.0000      0.994 0.000 1.000 0.00 0.000 0.000
#> SRR2050408     1  0.0000      0.999 1.000 0.000 0.00 0.000 0.000
#> SRR2050407     2  0.0000      0.994 0.000 1.000 0.00 0.000 0.000
#> SRR2050406     3  0.0000      1.000 0.000 0.000 1.00 0.000 0.000
#> SRR2050405     4  0.0000      1.000 0.000 0.000 0.00 1.000 0.000
#> SRR2050404     2  0.0000      0.994 0.000 1.000 0.00 0.000 0.000
#> SRR2050403     1  0.0000      0.999 1.000 0.000 0.00 0.000 0.000
#> SRR2050402     2  0.0000      0.994 0.000 1.000 0.00 0.000 0.000
#> SRR2050401     1  0.0000      0.999 1.000 0.000 0.00 0.000 0.000
#> SRR2050400     1  0.0000      0.999 1.000 0.000 0.00 0.000 0.000
#> SRR2050399     2  0.0609      0.978 0.000 0.980 0.00 0.000 0.020
#> SRR2050398     1  0.0000      0.999 1.000 0.000 0.00 0.000 0.000
#> SRR2050397     1  0.0000      0.999 1.000 0.000 0.00 0.000 0.000
#> SRR2050396     3  0.0000      1.000 0.000 0.000 1.00 0.000 0.000
#> SRR2050395     4  0.0000      1.000 0.000 0.000 0.00 1.000 0.000
#> SRR2050394     2  0.0000      0.994 0.000 1.000 0.00 0.000 0.000
#> SRR2050393     3  0.0000      1.000 0.000 0.000 1.00 0.000 0.000
#> SRR2050392     4  0.0000      1.000 0.000 0.000 0.00 1.000 0.000
#> SRR2050465     2  0.0000      0.994 0.000 1.000 0.00 0.000 0.000
#> SRR2050464     3  0.0000      1.000 0.000 0.000 1.00 0.000 0.000
#> SRR2050463     4  0.0000      1.000 0.000 0.000 0.00 1.000 0.000
#> SRR2050462     2  0.0000      0.994 0.000 1.000 0.00 0.000 0.000
#> SRR2050461     3  0.0000      1.000 0.000 0.000 1.00 0.000 0.000
#> SRR2050460     4  0.0000      1.000 0.000 0.000 0.00 1.000 0.000
#> SRR2050459     2  0.0000      0.994 0.000 1.000 0.00 0.000 0.000
#> SRR2050458     3  0.0000      1.000 0.000 0.000 1.00 0.000 0.000
#> SRR2050457     2  0.1671      0.912 0.000 0.924 0.00 0.076 0.000
#> SRR2050456     2  0.0000      0.994 0.000 1.000 0.00 0.000 0.000
#> SRR2050455     3  0.0000      1.000 0.000 0.000 1.00 0.000 0.000
#> SRR2050454     4  0.0000      1.000 0.000 0.000 0.00 1.000 0.000
#> SRR2050453     2  0.0000      0.994 0.000 1.000 0.00 0.000 0.000
#> SRR2050452     3  0.0000      1.000 0.000 0.000 1.00 0.000 0.000
#> SRR2050451     4  0.0000      1.000 0.000 0.000 0.00 1.000 0.000
#> SRR2050450     2  0.0000      0.994 0.000 1.000 0.00 0.000 0.000
#> SRR2050449     3  0.0000      1.000 0.000 0.000 1.00 0.000 0.000
#> SRR2050448     4  0.0000      1.000 0.000 0.000 0.00 1.000 0.000
#> SRR2050447     3  0.0000      1.000 0.000 0.000 1.00 0.000 0.000
#> SRR2050446     4  0.0000      1.000 0.000 0.000 0.00 1.000 0.000
#> SRR2050445     2  0.0000      0.994 0.000 1.000 0.00 0.000 0.000
#> SRR2050444     3  0.0000      1.000 0.000 0.000 1.00 0.000 0.000
#> SRR2050443     4  0.0000      1.000 0.000 0.000 0.00 1.000 0.000
#> SRR2050442     5  0.2329      0.869 0.000 0.124 0.00 0.000 0.876
#> SRR2050441     3  0.0000      1.000 0.000 0.000 1.00 0.000 0.000
#> SRR2050440     5  0.0609      0.942 0.000 0.000 0.02 0.000 0.980
#> SRR2050439     5  0.2329      0.869 0.000 0.124 0.00 0.000 0.876
#> SRR2050438     3  0.0000      1.000 0.000 0.000 1.00 0.000 0.000
#> SRR2050437     5  0.0609      0.942 0.000 0.000 0.02 0.000 0.980
#> SRR2050436     5  0.0000      0.945 0.000 0.000 0.00 0.000 1.000
#> SRR2050435     3  0.0000      1.000 0.000 0.000 1.00 0.000 0.000
#> SRR2050434     5  0.0000      0.945 0.000 0.000 0.00 0.000 1.000
#> SRR2050433     2  0.0000      0.994 0.000 1.000 0.00 0.000 0.000
#> SRR2050432     1  0.0000      0.999 1.000 0.000 0.00 0.000 0.000
#> SRR2050431     1  0.0404      0.988 0.988 0.000 0.00 0.000 0.012
#> SRR2050430     5  0.0609      0.941 0.020 0.000 0.00 0.000 0.980
#> SRR2050429     5  0.1341      0.917 0.056 0.000 0.00 0.000 0.944

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>            class entropy silhouette    p1    p2    p3    p4    p5    p6
#> SRR2050410     2  0.0000     0.9801 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2050427     1  0.1714     0.9408 0.908 0.000 0.000 0.000 0.000 0.092
#> SRR2050426     1  0.1141     0.9427 0.948 0.000 0.000 0.000 0.000 0.052
#> SRR2050425     2  0.0000     0.9801 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2050424     3  0.0000     0.9992 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2050423     4  0.0000     0.8966 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR2050422     5  0.0000     0.7891 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR2050421     1  0.1714     0.9408 0.908 0.000 0.000 0.000 0.000 0.092
#> SRR2050420     1  0.1141     0.9427 0.948 0.000 0.000 0.000 0.000 0.052
#> SRR2050419     2  0.0000     0.9801 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2050418     1  0.1007     0.9532 0.956 0.000 0.000 0.000 0.000 0.044
#> SRR2050417     1  0.0363     0.9548 0.988 0.000 0.000 0.000 0.000 0.012
#> SRR2050416     2  0.1501     0.8996 0.000 0.924 0.000 0.000 0.076 0.000
#> SRR2050415     3  0.0000     0.9992 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2050414     4  0.0000     0.8966 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR2050413     5  0.3266     0.6135 0.000 0.272 0.000 0.000 0.728 0.000
#> SRR2050412     1  0.0937     0.9537 0.960 0.000 0.000 0.000 0.000 0.040
#> SRR2050411     1  0.0363     0.9548 0.988 0.000 0.000 0.000 0.000 0.012
#> SRR2050409     2  0.0000     0.9801 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2050408     1  0.0363     0.9548 0.988 0.000 0.000 0.000 0.000 0.012
#> SRR2050407     2  0.0000     0.9801 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2050406     3  0.0000     0.9992 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2050405     4  0.0000     0.8966 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR2050404     2  0.0000     0.9801 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2050403     1  0.0363     0.9548 0.988 0.000 0.000 0.000 0.000 0.012
#> SRR2050402     2  0.0146     0.9769 0.000 0.996 0.000 0.000 0.004 0.000
#> SRR2050401     1  0.0937     0.9537 0.960 0.000 0.000 0.000 0.000 0.040
#> SRR2050400     1  0.1141     0.9427 0.948 0.000 0.000 0.000 0.000 0.052
#> SRR2050399     5  0.3351     0.5963 0.000 0.288 0.000 0.000 0.712 0.000
#> SRR2050398     1  0.1007     0.9541 0.956 0.000 0.000 0.000 0.000 0.044
#> SRR2050397     1  0.0363     0.9548 0.988 0.000 0.000 0.000 0.000 0.012
#> SRR2050396     3  0.0000     0.9992 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2050395     4  0.0000     0.8966 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR2050394     2  0.0000     0.9801 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2050393     3  0.0000     0.9992 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2050392     4  0.0000     0.8966 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR2050465     2  0.0000     0.9801 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2050464     3  0.0000     0.9992 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2050463     4  0.3101     0.8506 0.000 0.000 0.000 0.756 0.000 0.244
#> SRR2050462     2  0.0000     0.9801 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2050461     3  0.0000     0.9992 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2050460     4  0.3101     0.8506 0.000 0.000 0.000 0.756 0.000 0.244
#> SRR2050459     2  0.0000     0.9801 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2050458     3  0.0000     0.9992 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2050457     2  0.2994     0.7179 0.000 0.788 0.000 0.208 0.000 0.004
#> SRR2050456     2  0.0000     0.9801 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2050455     3  0.0000     0.9992 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2050454     4  0.0000     0.8966 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR2050453     2  0.0000     0.9801 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2050452     3  0.0000     0.9992 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2050451     4  0.3101     0.8506 0.000 0.000 0.000 0.756 0.000 0.244
#> SRR2050450     2  0.0000     0.9801 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2050449     3  0.0000     0.9992 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2050448     4  0.3101     0.8506 0.000 0.000 0.000 0.756 0.000 0.244
#> SRR2050447     3  0.0000     0.9992 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2050446     4  0.3101     0.8506 0.000 0.000 0.000 0.756 0.000 0.244
#> SRR2050445     2  0.0000     0.9801 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2050444     3  0.0000     0.9992 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2050443     4  0.0000     0.8966 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR2050442     5  0.0858     0.8007 0.000 0.028 0.000 0.000 0.968 0.004
#> SRR2050441     3  0.0000     0.9992 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2050440     6  0.3738     0.7666 0.000 0.000 0.016 0.000 0.280 0.704
#> SRR2050439     5  0.0858     0.8007 0.000 0.028 0.000 0.000 0.968 0.004
#> SRR2050438     3  0.0363     0.9880 0.000 0.000 0.988 0.000 0.000 0.012
#> SRR2050437     6  0.3738     0.7666 0.000 0.000 0.016 0.000 0.280 0.704
#> SRR2050436     5  0.0363     0.7850 0.000 0.000 0.000 0.000 0.988 0.012
#> SRR2050435     3  0.0000     0.9992 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2050434     5  0.0363     0.7850 0.000 0.000 0.000 0.000 0.988 0.012
#> SRR2050433     2  0.0000     0.9801 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2050432     1  0.1387     0.9511 0.932 0.000 0.000 0.000 0.000 0.068
#> SRR2050431     6  0.4263     0.0311 0.480 0.000 0.000 0.000 0.016 0.504
#> SRR2050430     6  0.3244     0.7625 0.000 0.000 0.000 0.000 0.268 0.732
#> SRR2050429     6  0.4002     0.7610 0.036 0.000 0.000 0.000 0.260 0.704

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

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

collect_plots(res)

plot of chunk MAD-pam-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 1.000           0.971       0.965         0.3531 0.653   0.653
#> 3 3 0.898           0.948       0.976         0.8132 0.712   0.559
#> 4 4 0.965           0.932       0.968         0.1771 0.867   0.644
#> 5 5 0.919           0.951       0.956         0.0634 0.930   0.728
#> 6 6 0.975           0.962       0.981         0.0327 0.976   0.878

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

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

There is also optional best \(k\) = 2 4 5 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
#> SRR2050410     2  0.3733      0.952 0.072 0.928
#> SRR2050427     2  0.0000      0.970 0.000 1.000
#> SRR2050426     2  0.0000      0.970 0.000 1.000
#> SRR2050425     2  0.3733      0.952 0.072 0.928
#> SRR2050424     1  0.3733      1.000 0.928 0.072
#> SRR2050423     2  0.0000      0.970 0.000 1.000
#> SRR2050422     2  0.1414      0.966 0.020 0.980
#> SRR2050421     2  0.0000      0.970 0.000 1.000
#> SRR2050420     2  0.0000      0.970 0.000 1.000
#> SRR2050419     2  0.3733      0.952 0.072 0.928
#> SRR2050418     2  0.0000      0.970 0.000 1.000
#> SRR2050417     2  0.0000      0.970 0.000 1.000
#> SRR2050416     2  0.3733      0.952 0.072 0.928
#> SRR2050415     1  0.3733      1.000 0.928 0.072
#> SRR2050414     2  0.0000      0.970 0.000 1.000
#> SRR2050413     2  0.3733      0.952 0.072 0.928
#> SRR2050412     2  0.0000      0.970 0.000 1.000
#> SRR2050411     2  0.0000      0.970 0.000 1.000
#> SRR2050409     2  0.3733      0.952 0.072 0.928
#> SRR2050408     2  0.0000      0.970 0.000 1.000
#> SRR2050407     2  0.3733      0.952 0.072 0.928
#> SRR2050406     1  0.3733      1.000 0.928 0.072
#> SRR2050405     2  0.0000      0.970 0.000 1.000
#> SRR2050404     2  0.3733      0.952 0.072 0.928
#> SRR2050403     2  0.0000      0.970 0.000 1.000
#> SRR2050402     2  0.3733      0.952 0.072 0.928
#> SRR2050401     2  0.0000      0.970 0.000 1.000
#> SRR2050400     2  0.0000      0.970 0.000 1.000
#> SRR2050399     2  0.3733      0.952 0.072 0.928
#> SRR2050398     2  0.0376      0.968 0.004 0.996
#> SRR2050397     2  0.0000      0.970 0.000 1.000
#> SRR2050396     1  0.3733      1.000 0.928 0.072
#> SRR2050395     2  0.0000      0.970 0.000 1.000
#> SRR2050394     2  0.3733      0.952 0.072 0.928
#> SRR2050393     1  0.3733      1.000 0.928 0.072
#> SRR2050392     2  0.0000      0.970 0.000 1.000
#> SRR2050465     2  0.3733      0.952 0.072 0.928
#> SRR2050464     1  0.3733      1.000 0.928 0.072
#> SRR2050463     2  0.0000      0.970 0.000 1.000
#> SRR2050462     2  0.3733      0.952 0.072 0.928
#> SRR2050461     1  0.3733      1.000 0.928 0.072
#> SRR2050460     2  0.0000      0.970 0.000 1.000
#> SRR2050459     2  0.3733      0.952 0.072 0.928
#> SRR2050458     1  0.3733      1.000 0.928 0.072
#> SRR2050457     2  0.0000      0.970 0.000 1.000
#> SRR2050456     2  0.3733      0.952 0.072 0.928
#> SRR2050455     1  0.3733      1.000 0.928 0.072
#> SRR2050454     2  0.0000      0.970 0.000 1.000
#> SRR2050453     2  0.3733      0.952 0.072 0.928
#> SRR2050452     1  0.3733      1.000 0.928 0.072
#> SRR2050451     2  0.0000      0.970 0.000 1.000
#> SRR2050450     2  0.3733      0.952 0.072 0.928
#> SRR2050449     1  0.3733      1.000 0.928 0.072
#> SRR2050448     2  0.0000      0.970 0.000 1.000
#> SRR2050447     1  0.3733      1.000 0.928 0.072
#> SRR2050446     2  0.0000      0.970 0.000 1.000
#> SRR2050445     2  0.3733      0.952 0.072 0.928
#> SRR2050444     1  0.3733      1.000 0.928 0.072
#> SRR2050443     2  0.0000      0.970 0.000 1.000
#> SRR2050442     2  0.3733      0.952 0.072 0.928
#> SRR2050441     1  0.3733      1.000 0.928 0.072
#> SRR2050440     2  0.0000      0.970 0.000 1.000
#> SRR2050439     2  0.3733      0.952 0.072 0.928
#> SRR2050438     1  0.3733      1.000 0.928 0.072
#> SRR2050437     2  0.0000      0.970 0.000 1.000
#> SRR2050436     2  0.1633      0.965 0.024 0.976
#> SRR2050435     1  0.3733      1.000 0.928 0.072
#> SRR2050434     2  0.0000      0.970 0.000 1.000
#> SRR2050433     2  0.3733      0.952 0.072 0.928
#> SRR2050432     2  0.0000      0.970 0.000 1.000
#> SRR2050431     2  0.0000      0.970 0.000 1.000
#> SRR2050430     2  0.0000      0.970 0.000 1.000
#> SRR2050429     2  0.0000      0.970 0.000 1.000

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>            class entropy silhouette    p1    p2 p3
#> SRR2050410     2  0.0000      0.985 0.000 1.000  0
#> SRR2050427     1  0.0000      0.956 1.000 0.000  0
#> SRR2050426     1  0.0000      0.956 1.000 0.000  0
#> SRR2050425     2  0.0000      0.985 0.000 1.000  0
#> SRR2050424     3  0.0000      1.000 0.000 0.000  1
#> SRR2050423     1  0.0000      0.956 1.000 0.000  0
#> SRR2050422     1  0.0424      0.950 0.992 0.008  0
#> SRR2050421     1  0.0000      0.956 1.000 0.000  0
#> SRR2050420     1  0.0000      0.956 1.000 0.000  0
#> SRR2050419     2  0.0000      0.985 0.000 1.000  0
#> SRR2050418     1  0.0000      0.956 1.000 0.000  0
#> SRR2050417     1  0.0000      0.956 1.000 0.000  0
#> SRR2050416     2  0.0000      0.985 0.000 1.000  0
#> SRR2050415     3  0.0000      1.000 0.000 0.000  1
#> SRR2050414     1  0.0000      0.956 1.000 0.000  0
#> SRR2050413     2  0.5016      0.674 0.240 0.760  0
#> SRR2050412     1  0.0000      0.956 1.000 0.000  0
#> SRR2050411     1  0.0000      0.956 1.000 0.000  0
#> SRR2050409     2  0.0000      0.985 0.000 1.000  0
#> SRR2050408     1  0.0000      0.956 1.000 0.000  0
#> SRR2050407     2  0.0000      0.985 0.000 1.000  0
#> SRR2050406     3  0.0000      1.000 0.000 0.000  1
#> SRR2050405     1  0.4399      0.783 0.812 0.188  0
#> SRR2050404     2  0.0000      0.985 0.000 1.000  0
#> SRR2050403     1  0.0000      0.956 1.000 0.000  0
#> SRR2050402     2  0.0000      0.985 0.000 1.000  0
#> SRR2050401     1  0.0000      0.956 1.000 0.000  0
#> SRR2050400     1  0.0000      0.956 1.000 0.000  0
#> SRR2050399     2  0.0000      0.985 0.000 1.000  0
#> SRR2050398     1  0.0000      0.956 1.000 0.000  0
#> SRR2050397     1  0.0000      0.956 1.000 0.000  0
#> SRR2050396     3  0.0000      1.000 0.000 0.000  1
#> SRR2050395     1  0.0000      0.956 1.000 0.000  0
#> SRR2050394     2  0.0000      0.985 0.000 1.000  0
#> SRR2050393     3  0.0000      1.000 0.000 0.000  1
#> SRR2050392     1  0.5058      0.712 0.756 0.244  0
#> SRR2050465     2  0.0000      0.985 0.000 1.000  0
#> SRR2050464     3  0.0000      1.000 0.000 0.000  1
#> SRR2050463     1  0.3551      0.844 0.868 0.132  0
#> SRR2050462     2  0.0000      0.985 0.000 1.000  0
#> SRR2050461     3  0.0000      1.000 0.000 0.000  1
#> SRR2050460     1  0.0000      0.956 1.000 0.000  0
#> SRR2050459     2  0.0000      0.985 0.000 1.000  0
#> SRR2050458     3  0.0000      1.000 0.000 0.000  1
#> SRR2050457     1  0.6140      0.397 0.596 0.404  0
#> SRR2050456     2  0.0000      0.985 0.000 1.000  0
#> SRR2050455     3  0.0000      1.000 0.000 0.000  1
#> SRR2050454     1  0.5058      0.712 0.756 0.244  0
#> SRR2050453     2  0.0000      0.985 0.000 1.000  0
#> SRR2050452     3  0.0000      1.000 0.000 0.000  1
#> SRR2050451     1  0.0000      0.956 1.000 0.000  0
#> SRR2050450     2  0.0000      0.985 0.000 1.000  0
#> SRR2050449     3  0.0000      1.000 0.000 0.000  1
#> SRR2050448     1  0.0592      0.948 0.988 0.012  0
#> SRR2050447     3  0.0000      1.000 0.000 0.000  1
#> SRR2050446     1  0.0000      0.956 1.000 0.000  0
#> SRR2050445     2  0.0000      0.985 0.000 1.000  0
#> SRR2050444     3  0.0000      1.000 0.000 0.000  1
#> SRR2050443     1  0.5058      0.712 0.756 0.244  0
#> SRR2050442     2  0.0000      0.985 0.000 1.000  0
#> SRR2050441     3  0.0000      1.000 0.000 0.000  1
#> SRR2050440     1  0.0000      0.956 1.000 0.000  0
#> SRR2050439     2  0.0000      0.985 0.000 1.000  0
#> SRR2050438     3  0.0000      1.000 0.000 0.000  1
#> SRR2050437     1  0.0000      0.956 1.000 0.000  0
#> SRR2050436     1  0.0000      0.956 1.000 0.000  0
#> SRR2050435     3  0.0000      1.000 0.000 0.000  1
#> SRR2050434     1  0.0000      0.956 1.000 0.000  0
#> SRR2050433     2  0.0000      0.985 0.000 1.000  0
#> SRR2050432     1  0.0000      0.956 1.000 0.000  0
#> SRR2050431     1  0.0000      0.956 1.000 0.000  0
#> SRR2050430     1  0.0000      0.956 1.000 0.000  0
#> SRR2050429     1  0.0000      0.956 1.000 0.000  0

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2 p3    p4
#> SRR2050410     2   0.000      1.000 0.000 1.000  0 0.000
#> SRR2050427     1   0.000      0.889 1.000 0.000  0 0.000
#> SRR2050426     1   0.000      0.889 1.000 0.000  0 0.000
#> SRR2050425     2   0.000      1.000 0.000 1.000  0 0.000
#> SRR2050424     3   0.000      1.000 0.000 0.000  1 0.000
#> SRR2050423     4   0.000      1.000 0.000 0.000  0 1.000
#> SRR2050422     1   0.659      0.592 0.628 0.212  0 0.160
#> SRR2050421     1   0.000      0.889 1.000 0.000  0 0.000
#> SRR2050420     1   0.000      0.889 1.000 0.000  0 0.000
#> SRR2050419     2   0.000      1.000 0.000 1.000  0 0.000
#> SRR2050418     1   0.194      0.842 0.924 0.000  0 0.076
#> SRR2050417     1   0.000      0.889 1.000 0.000  0 0.000
#> SRR2050416     2   0.000      1.000 0.000 1.000  0 0.000
#> SRR2050415     3   0.000      1.000 0.000 0.000  1 0.000
#> SRR2050414     4   0.000      1.000 0.000 0.000  0 1.000
#> SRR2050413     1   0.492      0.322 0.572 0.428  0 0.000
#> SRR2050412     1   0.000      0.889 1.000 0.000  0 0.000
#> SRR2050411     1   0.000      0.889 1.000 0.000  0 0.000
#> SRR2050409     2   0.000      1.000 0.000 1.000  0 0.000
#> SRR2050408     1   0.000      0.889 1.000 0.000  0 0.000
#> SRR2050407     2   0.000      1.000 0.000 1.000  0 0.000
#> SRR2050406     3   0.000      1.000 0.000 0.000  1 0.000
#> SRR2050405     4   0.000      1.000 0.000 0.000  0 1.000
#> SRR2050404     2   0.000      1.000 0.000 1.000  0 0.000
#> SRR2050403     1   0.000      0.889 1.000 0.000  0 0.000
#> SRR2050402     2   0.000      1.000 0.000 1.000  0 0.000
#> SRR2050401     1   0.000      0.889 1.000 0.000  0 0.000
#> SRR2050400     1   0.000      0.889 1.000 0.000  0 0.000
#> SRR2050399     2   0.000      1.000 0.000 1.000  0 0.000
#> SRR2050398     1   0.000      0.889 1.000 0.000  0 0.000
#> SRR2050397     1   0.000      0.889 1.000 0.000  0 0.000
#> SRR2050396     3   0.000      1.000 0.000 0.000  1 0.000
#> SRR2050395     4   0.000      1.000 0.000 0.000  0 1.000
#> SRR2050394     2   0.000      1.000 0.000 1.000  0 0.000
#> SRR2050393     3   0.000      1.000 0.000 0.000  1 0.000
#> SRR2050392     4   0.000      1.000 0.000 0.000  0 1.000
#> SRR2050465     2   0.000      1.000 0.000 1.000  0 0.000
#> SRR2050464     3   0.000      1.000 0.000 0.000  1 0.000
#> SRR2050463     4   0.000      1.000 0.000 0.000  0 1.000
#> SRR2050462     2   0.000      1.000 0.000 1.000  0 0.000
#> SRR2050461     3   0.000      1.000 0.000 0.000  1 0.000
#> SRR2050460     4   0.000      1.000 0.000 0.000  0 1.000
#> SRR2050459     2   0.000      1.000 0.000 1.000  0 0.000
#> SRR2050458     3   0.000      1.000 0.000 0.000  1 0.000
#> SRR2050457     4   0.000      1.000 0.000 0.000  0 1.000
#> SRR2050456     2   0.000      1.000 0.000 1.000  0 0.000
#> SRR2050455     3   0.000      1.000 0.000 0.000  1 0.000
#> SRR2050454     4   0.000      1.000 0.000 0.000  0 1.000
#> SRR2050453     2   0.000      1.000 0.000 1.000  0 0.000
#> SRR2050452     3   0.000      1.000 0.000 0.000  1 0.000
#> SRR2050451     4   0.000      1.000 0.000 0.000  0 1.000
#> SRR2050450     2   0.000      1.000 0.000 1.000  0 0.000
#> SRR2050449     3   0.000      1.000 0.000 0.000  1 0.000
#> SRR2050448     4   0.000      1.000 0.000 0.000  0 1.000
#> SRR2050447     3   0.000      1.000 0.000 0.000  1 0.000
#> SRR2050446     4   0.000      1.000 0.000 0.000  0 1.000
#> SRR2050445     2   0.000      1.000 0.000 1.000  0 0.000
#> SRR2050444     3   0.000      1.000 0.000 0.000  1 0.000
#> SRR2050443     4   0.000      1.000 0.000 0.000  0 1.000
#> SRR2050442     2   0.000      1.000 0.000 1.000  0 0.000
#> SRR2050441     3   0.000      1.000 0.000 0.000  1 0.000
#> SRR2050440     1   0.478      0.505 0.624 0.000  0 0.376
#> SRR2050439     2   0.000      1.000 0.000 1.000  0 0.000
#> SRR2050438     3   0.000      1.000 0.000 0.000  1 0.000
#> SRR2050437     1   0.476      0.512 0.628 0.000  0 0.372
#> SRR2050436     1   0.548      0.534 0.628 0.028  0 0.344
#> SRR2050435     3   0.000      1.000 0.000 0.000  1 0.000
#> SRR2050434     4   0.000      1.000 0.000 0.000  0 1.000
#> SRR2050433     2   0.000      1.000 0.000 1.000  0 0.000
#> SRR2050432     1   0.000      0.889 1.000 0.000  0 0.000
#> SRR2050431     1   0.000      0.889 1.000 0.000  0 0.000
#> SRR2050430     1   0.476      0.512 0.628 0.000  0 0.372
#> SRR2050429     1   0.000      0.889 1.000 0.000  0 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
#> SRR2050410     2  0.0000      1.000 0.000 1.000  0 0.000 0.000
#> SRR2050427     1  0.0000      0.907 1.000 0.000  0 0.000 0.000
#> SRR2050426     1  0.0000      0.907 1.000 0.000  0 0.000 0.000
#> SRR2050425     2  0.0000      1.000 0.000 1.000  0 0.000 0.000
#> SRR2050424     3  0.0000      1.000 0.000 0.000  1 0.000 0.000
#> SRR2050423     4  0.0000      1.000 0.000 0.000  0 1.000 0.000
#> SRR2050422     5  0.2813      0.852 0.000 0.168  0 0.000 0.832
#> SRR2050421     1  0.0000      0.907 1.000 0.000  0 0.000 0.000
#> SRR2050420     1  0.0000      0.907 1.000 0.000  0 0.000 0.000
#> SRR2050419     2  0.0000      1.000 0.000 1.000  0 0.000 0.000
#> SRR2050418     1  0.3593      0.873 0.824 0.000  0 0.060 0.116
#> SRR2050417     1  0.2813      0.895 0.832 0.000  0 0.000 0.168
#> SRR2050416     2  0.0000      1.000 0.000 1.000  0 0.000 0.000
#> SRR2050415     3  0.0000      1.000 0.000 0.000  1 0.000 0.000
#> SRR2050414     4  0.0000      1.000 0.000 0.000  0 1.000 0.000
#> SRR2050413     5  0.2813      0.852 0.000 0.168  0 0.000 0.832
#> SRR2050412     1  0.0000      0.907 1.000 0.000  0 0.000 0.000
#> SRR2050411     1  0.2813      0.895 0.832 0.000  0 0.000 0.168
#> SRR2050409     2  0.0000      1.000 0.000 1.000  0 0.000 0.000
#> SRR2050408     1  0.2813      0.895 0.832 0.000  0 0.000 0.168
#> SRR2050407     2  0.0000      1.000 0.000 1.000  0 0.000 0.000
#> SRR2050406     3  0.0000      1.000 0.000 0.000  1 0.000 0.000
#> SRR2050405     4  0.0000      1.000 0.000 0.000  0 1.000 0.000
#> SRR2050404     2  0.0000      1.000 0.000 1.000  0 0.000 0.000
#> SRR2050403     1  0.2813      0.895 0.832 0.000  0 0.000 0.168
#> SRR2050402     2  0.0000      1.000 0.000 1.000  0 0.000 0.000
#> SRR2050401     1  0.0000      0.907 1.000 0.000  0 0.000 0.000
#> SRR2050400     1  0.2813      0.895 0.832 0.000  0 0.000 0.168
#> SRR2050399     2  0.0000      1.000 0.000 1.000  0 0.000 0.000
#> SRR2050398     1  0.0000      0.907 1.000 0.000  0 0.000 0.000
#> SRR2050397     1  0.2813      0.895 0.832 0.000  0 0.000 0.168
#> SRR2050396     3  0.0000      1.000 0.000 0.000  1 0.000 0.000
#> SRR2050395     4  0.0000      1.000 0.000 0.000  0 1.000 0.000
#> SRR2050394     2  0.0000      1.000 0.000 1.000  0 0.000 0.000
#> SRR2050393     3  0.0000      1.000 0.000 0.000  1 0.000 0.000
#> SRR2050392     4  0.0000      1.000 0.000 0.000  0 1.000 0.000
#> SRR2050465     2  0.0000      1.000 0.000 1.000  0 0.000 0.000
#> SRR2050464     3  0.0000      1.000 0.000 0.000  1 0.000 0.000
#> SRR2050463     4  0.0000      1.000 0.000 0.000  0 1.000 0.000
#> SRR2050462     2  0.0000      1.000 0.000 1.000  0 0.000 0.000
#> SRR2050461     3  0.0000      1.000 0.000 0.000  1 0.000 0.000
#> SRR2050460     4  0.0000      1.000 0.000 0.000  0 1.000 0.000
#> SRR2050459     2  0.0000      1.000 0.000 1.000  0 0.000 0.000
#> SRR2050458     3  0.0000      1.000 0.000 0.000  1 0.000 0.000
#> SRR2050457     4  0.0000      1.000 0.000 0.000  0 1.000 0.000
#> SRR2050456     2  0.0000      1.000 0.000 1.000  0 0.000 0.000
#> SRR2050455     3  0.0000      1.000 0.000 0.000  1 0.000 0.000
#> SRR2050454     4  0.0000      1.000 0.000 0.000  0 1.000 0.000
#> SRR2050453     2  0.0000      1.000 0.000 1.000  0 0.000 0.000
#> SRR2050452     3  0.0000      1.000 0.000 0.000  1 0.000 0.000
#> SRR2050451     4  0.0000      1.000 0.000 0.000  0 1.000 0.000
#> SRR2050450     2  0.0000      1.000 0.000 1.000  0 0.000 0.000
#> SRR2050449     3  0.0000      1.000 0.000 0.000  1 0.000 0.000
#> SRR2050448     4  0.0000      1.000 0.000 0.000  0 1.000 0.000
#> SRR2050447     3  0.0000      1.000 0.000 0.000  1 0.000 0.000
#> SRR2050446     4  0.0000      1.000 0.000 0.000  0 1.000 0.000
#> SRR2050445     2  0.0000      1.000 0.000 1.000  0 0.000 0.000
#> SRR2050444     3  0.0000      1.000 0.000 0.000  1 0.000 0.000
#> SRR2050443     4  0.0000      1.000 0.000 0.000  0 1.000 0.000
#> SRR2050442     5  0.2813      0.852 0.000 0.168  0 0.000 0.832
#> SRR2050441     3  0.0000      1.000 0.000 0.000  1 0.000 0.000
#> SRR2050440     5  0.2813      0.832 0.000 0.000  0 0.168 0.832
#> SRR2050439     5  0.2813      0.852 0.000 0.168  0 0.000 0.832
#> SRR2050438     3  0.0000      1.000 0.000 0.000  1 0.000 0.000
#> SRR2050437     5  0.2813      0.832 0.000 0.000  0 0.168 0.832
#> SRR2050436     5  0.3283      0.848 0.000 0.028  0 0.140 0.832
#> SRR2050435     3  0.0000      1.000 0.000 0.000  1 0.000 0.000
#> SRR2050434     5  0.2813      0.832 0.000 0.000  0 0.168 0.832
#> SRR2050433     2  0.0000      1.000 0.000 1.000  0 0.000 0.000
#> SRR2050432     1  0.0000      0.907 1.000 0.000  0 0.000 0.000
#> SRR2050431     1  0.4171      0.622 0.604 0.000  0 0.000 0.396
#> SRR2050430     5  0.2813      0.790 0.168 0.000  0 0.000 0.832
#> SRR2050429     5  0.0162      0.791 0.004 0.000  0 0.000 0.996

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>            class entropy silhouette    p1    p2 p3   p4    p5    p6
#> SRR2050410     2   0.000      0.990 0.000 1.000  0 0.00 0.000 0.000
#> SRR2050427     6   0.000      0.978 0.000 0.000  0 0.00 0.000 1.000
#> SRR2050426     6   0.127      0.944 0.060 0.000  0 0.00 0.000 0.940
#> SRR2050425     2   0.000      0.990 0.000 1.000  0 0.00 0.000 0.000
#> SRR2050424     3   0.000      1.000 0.000 0.000  1 0.00 0.000 0.000
#> SRR2050423     4   0.000      1.000 0.000 0.000  0 1.00 0.000 0.000
#> SRR2050422     5   0.000      0.910 0.000 0.000  0 0.00 1.000 0.000
#> SRR2050421     6   0.000      0.978 0.000 0.000  0 0.00 0.000 1.000
#> SRR2050420     6   0.127      0.944 0.060 0.000  0 0.00 0.000 0.940
#> SRR2050419     2   0.000      0.990 0.000 1.000  0 0.00 0.000 0.000
#> SRR2050418     1   0.152      0.893 0.932 0.000  0 0.06 0.000 0.008
#> SRR2050417     1   0.000      0.954 1.000 0.000  0 0.00 0.000 0.000
#> SRR2050416     2   0.000      0.990 0.000 1.000  0 0.00 0.000 0.000
#> SRR2050415     3   0.000      1.000 0.000 0.000  1 0.00 0.000 0.000
#> SRR2050414     4   0.000      1.000 0.000 0.000  0 1.00 0.000 0.000
#> SRR2050413     5   0.000      0.910 0.000 0.000  0 0.00 1.000 0.000
#> SRR2050412     6   0.000      0.978 0.000 0.000  0 0.00 0.000 1.000
#> SRR2050411     1   0.000      0.954 1.000 0.000  0 0.00 0.000 0.000
#> SRR2050409     2   0.000      0.990 0.000 1.000  0 0.00 0.000 0.000
#> SRR2050408     1   0.000      0.954 1.000 0.000  0 0.00 0.000 0.000
#> SRR2050407     2   0.000      0.990 0.000 1.000  0 0.00 0.000 0.000
#> SRR2050406     3   0.000      1.000 0.000 0.000  1 0.00 0.000 0.000
#> SRR2050405     4   0.000      1.000 0.000 0.000  0 1.00 0.000 0.000
#> SRR2050404     2   0.000      0.990 0.000 1.000  0 0.00 0.000 0.000
#> SRR2050403     1   0.000      0.954 1.000 0.000  0 0.00 0.000 0.000
#> SRR2050402     2   0.000      0.990 0.000 1.000  0 0.00 0.000 0.000
#> SRR2050401     1   0.329      0.628 0.724 0.000  0 0.00 0.000 0.276
#> SRR2050400     1   0.000      0.954 1.000 0.000  0 0.00 0.000 0.000
#> SRR2050399     2   0.260      0.801 0.000 0.824  0 0.00 0.176 0.000
#> SRR2050398     6   0.000      0.978 0.000 0.000  0 0.00 0.000 1.000
#> SRR2050397     1   0.000      0.954 1.000 0.000  0 0.00 0.000 0.000
#> SRR2050396     3   0.000      1.000 0.000 0.000  1 0.00 0.000 0.000
#> SRR2050395     4   0.000      1.000 0.000 0.000  0 1.00 0.000 0.000
#> SRR2050394     2   0.000      0.990 0.000 1.000  0 0.00 0.000 0.000
#> SRR2050393     3   0.000      1.000 0.000 0.000  1 0.00 0.000 0.000
#> SRR2050392     4   0.000      1.000 0.000 0.000  0 1.00 0.000 0.000
#> SRR2050465     2   0.000      0.990 0.000 1.000  0 0.00 0.000 0.000
#> SRR2050464     3   0.000      1.000 0.000 0.000  1 0.00 0.000 0.000
#> SRR2050463     4   0.000      1.000 0.000 0.000  0 1.00 0.000 0.000
#> SRR2050462     2   0.000      0.990 0.000 1.000  0 0.00 0.000 0.000
#> SRR2050461     3   0.000      1.000 0.000 0.000  1 0.00 0.000 0.000
#> SRR2050460     4   0.000      1.000 0.000 0.000  0 1.00 0.000 0.000
#> SRR2050459     2   0.000      0.990 0.000 1.000  0 0.00 0.000 0.000
#> SRR2050458     3   0.000      1.000 0.000 0.000  1 0.00 0.000 0.000
#> SRR2050457     4   0.000      1.000 0.000 0.000  0 1.00 0.000 0.000
#> SRR2050456     2   0.000      0.990 0.000 1.000  0 0.00 0.000 0.000
#> SRR2050455     3   0.000      1.000 0.000 0.000  1 0.00 0.000 0.000
#> SRR2050454     4   0.000      1.000 0.000 0.000  0 1.00 0.000 0.000
#> SRR2050453     2   0.000      0.990 0.000 1.000  0 0.00 0.000 0.000
#> SRR2050452     3   0.000      1.000 0.000 0.000  1 0.00 0.000 0.000
#> SRR2050451     4   0.000      1.000 0.000 0.000  0 1.00 0.000 0.000
#> SRR2050450     2   0.000      0.990 0.000 1.000  0 0.00 0.000 0.000
#> SRR2050449     3   0.000      1.000 0.000 0.000  1 0.00 0.000 0.000
#> SRR2050448     4   0.000      1.000 0.000 0.000  0 1.00 0.000 0.000
#> SRR2050447     3   0.000      1.000 0.000 0.000  1 0.00 0.000 0.000
#> SRR2050446     4   0.000      1.000 0.000 0.000  0 1.00 0.000 0.000
#> SRR2050445     2   0.000      0.990 0.000 1.000  0 0.00 0.000 0.000
#> SRR2050444     3   0.000      1.000 0.000 0.000  1 0.00 0.000 0.000
#> SRR2050443     4   0.000      1.000 0.000 0.000  0 1.00 0.000 0.000
#> SRR2050442     5   0.000      0.910 0.000 0.000  0 0.00 1.000 0.000
#> SRR2050441     3   0.000      1.000 0.000 0.000  1 0.00 0.000 0.000
#> SRR2050440     5   0.263      0.799 0.000 0.000  0 0.18 0.820 0.000
#> SRR2050439     5   0.000      0.910 0.000 0.000  0 0.00 1.000 0.000
#> SRR2050438     3   0.000      1.000 0.000 0.000  1 0.00 0.000 0.000
#> SRR2050437     5   0.263      0.799 0.000 0.000  0 0.18 0.820 0.000
#> SRR2050436     5   0.000      0.910 0.000 0.000  0 0.00 1.000 0.000
#> SRR2050435     3   0.000      1.000 0.000 0.000  1 0.00 0.000 0.000
#> SRR2050434     5   0.000      0.910 0.000 0.000  0 0.00 1.000 0.000
#> SRR2050433     2   0.000      0.990 0.000 1.000  0 0.00 0.000 0.000
#> SRR2050432     6   0.000      0.978 0.000 0.000  0 0.00 0.000 1.000
#> SRR2050431     1   0.000      0.954 1.000 0.000  0 0.00 0.000 0.000
#> SRR2050430     5   0.263      0.773 0.000 0.000  0 0.00 0.820 0.180
#> SRR2050429     5   0.270      0.778 0.188 0.000  0 0.00 0.812 0.000

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

consensus_heatmap(res, k = 2)

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

consensus_heatmap(res, k = 3)

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

consensus_heatmap(res, k = 4)

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

consensus_heatmap(res, k = 5)

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

consensus_heatmap(res, k = 6)

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

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

membership_heatmap(res, k = 2)

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

membership_heatmap(res, k = 3)

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

membership_heatmap(res, k = 4)

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

membership_heatmap(res, k = 5)

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

membership_heatmap(res, k = 6)

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

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

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

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

get_signatures(res, k = 3)

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

get_signatures(res, k = 4)

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

get_signatures(res, k = 5)

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

get_signatures(res, k = 6)

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

Signature heatmaps where rows are not scaled:

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

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

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

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

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

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

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

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

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

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

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk MAD-pam-signature_compare

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

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

An example of the output of tb is:

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

The columns in tb are:

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

UMAP plot which shows how samples are separated.

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

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

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

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

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

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

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

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

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

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

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk MAD-pam-collect-classes

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


MAD:mclust*

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

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

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

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

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

collect_plots(res)

plot of chunk MAD-mclust-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.888           0.902       0.961         0.4095 0.573   0.573
#> 3 3 1.000           0.973       0.989         0.4668 0.670   0.495
#> 4 4 1.000           0.996       0.996         0.1616 0.883   0.715
#> 5 5 0.928           0.918       0.954         0.1398 0.858   0.559
#> 6 6 0.886           0.803       0.863         0.0123 0.942   0.744

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] 3 4

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

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

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

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>            class entropy silhouette    p1    p2
#> SRR2050410     2   0.000      0.898 0.000 1.000
#> SRR2050427     1   0.000      0.981 1.000 0.000
#> SRR2050426     1   0.000      0.981 1.000 0.000
#> SRR2050425     2   0.000      0.898 0.000 1.000
#> SRR2050424     1   0.000      0.981 1.000 0.000
#> SRR2050423     1   0.000      0.981 1.000 0.000
#> SRR2050422     1   1.000     -0.195 0.500 0.500
#> SRR2050421     1   0.000      0.981 1.000 0.000
#> SRR2050420     1   0.000      0.981 1.000 0.000
#> SRR2050419     2   0.000      0.898 0.000 1.000
#> SRR2050418     1   0.000      0.981 1.000 0.000
#> SRR2050417     1   0.000      0.981 1.000 0.000
#> SRR2050416     2   0.295      0.870 0.052 0.948
#> SRR2050415     1   0.000      0.981 1.000 0.000
#> SRR2050414     1   0.000      0.981 1.000 0.000
#> SRR2050413     2   0.821      0.688 0.256 0.744
#> SRR2050412     1   0.000      0.981 1.000 0.000
#> SRR2050411     1   0.000      0.981 1.000 0.000
#> SRR2050409     2   0.000      0.898 0.000 1.000
#> SRR2050408     1   0.000      0.981 1.000 0.000
#> SRR2050407     2   0.000      0.898 0.000 1.000
#> SRR2050406     1   0.000      0.981 1.000 0.000
#> SRR2050405     1   0.000      0.981 1.000 0.000
#> SRR2050404     2   0.000      0.898 0.000 1.000
#> SRR2050403     1   0.000      0.981 1.000 0.000
#> SRR2050402     2   0.714      0.758 0.196 0.804
#> SRR2050401     1   0.000      0.981 1.000 0.000
#> SRR2050400     1   0.000      0.981 1.000 0.000
#> SRR2050399     2   0.760      0.733 0.220 0.780
#> SRR2050398     1   0.000      0.981 1.000 0.000
#> SRR2050397     1   0.000      0.981 1.000 0.000
#> SRR2050396     1   0.000      0.981 1.000 0.000
#> SRR2050395     1   0.000      0.981 1.000 0.000
#> SRR2050394     2   0.000      0.898 0.000 1.000
#> SRR2050393     1   0.000      0.981 1.000 0.000
#> SRR2050392     1   0.000      0.981 1.000 0.000
#> SRR2050465     2   0.000      0.898 0.000 1.000
#> SRR2050464     1   0.000      0.981 1.000 0.000
#> SRR2050463     1   0.000      0.981 1.000 0.000
#> SRR2050462     2   0.000      0.898 0.000 1.000
#> SRR2050461     1   0.000      0.981 1.000 0.000
#> SRR2050460     1   0.000      0.981 1.000 0.000
#> SRR2050459     2   0.000      0.898 0.000 1.000
#> SRR2050458     1   0.000      0.981 1.000 0.000
#> SRR2050457     1   0.000      0.981 1.000 0.000
#> SRR2050456     2   0.000      0.898 0.000 1.000
#> SRR2050455     1   0.000      0.981 1.000 0.000
#> SRR2050454     1   0.000      0.981 1.000 0.000
#> SRR2050453     2   0.000      0.898 0.000 1.000
#> SRR2050452     1   0.000      0.981 1.000 0.000
#> SRR2050451     1   0.000      0.981 1.000 0.000
#> SRR2050450     2   0.000      0.898 0.000 1.000
#> SRR2050449     1   0.000      0.981 1.000 0.000
#> SRR2050448     1   0.000      0.981 1.000 0.000
#> SRR2050447     1   0.000      0.981 1.000 0.000
#> SRR2050446     1   0.000      0.981 1.000 0.000
#> SRR2050445     2   0.000      0.898 0.000 1.000
#> SRR2050444     1   0.000      0.981 1.000 0.000
#> SRR2050443     1   0.000      0.981 1.000 0.000
#> SRR2050442     2   0.987      0.356 0.432 0.568
#> SRR2050441     1   0.000      0.981 1.000 0.000
#> SRR2050440     1   0.000      0.981 1.000 0.000
#> SRR2050439     2   0.987      0.356 0.432 0.568
#> SRR2050438     1   0.000      0.981 1.000 0.000
#> SRR2050437     1   0.000      0.981 1.000 0.000
#> SRR2050436     2   0.995      0.276 0.460 0.540
#> SRR2050435     1   0.000      0.981 1.000 0.000
#> SRR2050434     1   0.891      0.467 0.692 0.308
#> SRR2050433     2   0.000      0.898 0.000 1.000
#> SRR2050432     1   0.000      0.981 1.000 0.000
#> SRR2050431     1   0.000      0.981 1.000 0.000
#> SRR2050430     1   0.000      0.981 1.000 0.000
#> SRR2050429     1   0.000      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
#> SRR2050410     2   0.000      1.000 0.000 1.000 0.000
#> SRR2050427     1   0.000      0.984 1.000 0.000 0.000
#> SRR2050426     1   0.000      0.984 1.000 0.000 0.000
#> SRR2050425     2   0.000      1.000 0.000 1.000 0.000
#> SRR2050424     3   0.000      0.985 0.000 0.000 1.000
#> SRR2050423     1   0.000      0.984 1.000 0.000 0.000
#> SRR2050422     1   0.129      0.962 0.968 0.032 0.000
#> SRR2050421     1   0.000      0.984 1.000 0.000 0.000
#> SRR2050420     1   0.000      0.984 1.000 0.000 0.000
#> SRR2050419     2   0.000      1.000 0.000 1.000 0.000
#> SRR2050418     1   0.000      0.984 1.000 0.000 0.000
#> SRR2050417     1   0.000      0.984 1.000 0.000 0.000
#> SRR2050416     2   0.000      1.000 0.000 1.000 0.000
#> SRR2050415     3   0.000      0.985 0.000 0.000 1.000
#> SRR2050414     1   0.000      0.984 1.000 0.000 0.000
#> SRR2050413     1   0.129      0.962 0.968 0.032 0.000
#> SRR2050412     1   0.000      0.984 1.000 0.000 0.000
#> SRR2050411     1   0.000      0.984 1.000 0.000 0.000
#> SRR2050409     2   0.000      1.000 0.000 1.000 0.000
#> SRR2050408     1   0.000      0.984 1.000 0.000 0.000
#> SRR2050407     2   0.000      1.000 0.000 1.000 0.000
#> SRR2050406     3   0.000      0.985 0.000 0.000 1.000
#> SRR2050405     1   0.000      0.984 1.000 0.000 0.000
#> SRR2050404     2   0.000      1.000 0.000 1.000 0.000
#> SRR2050403     1   0.000      0.984 1.000 0.000 0.000
#> SRR2050402     1   0.618      0.307 0.584 0.416 0.000
#> SRR2050401     1   0.000      0.984 1.000 0.000 0.000
#> SRR2050400     1   0.000      0.984 1.000 0.000 0.000
#> SRR2050399     1   0.153      0.955 0.960 0.040 0.000
#> SRR2050398     1   0.000      0.984 1.000 0.000 0.000
#> SRR2050397     1   0.000      0.984 1.000 0.000 0.000
#> SRR2050396     3   0.412      0.765 0.168 0.000 0.832
#> SRR2050395     1   0.000      0.984 1.000 0.000 0.000
#> SRR2050394     2   0.000      1.000 0.000 1.000 0.000
#> SRR2050393     3   0.000      0.985 0.000 0.000 1.000
#> SRR2050392     1   0.000      0.984 1.000 0.000 0.000
#> SRR2050465     2   0.000      1.000 0.000 1.000 0.000
#> SRR2050464     3   0.000      0.985 0.000 0.000 1.000
#> SRR2050463     1   0.000      0.984 1.000 0.000 0.000
#> SRR2050462     2   0.000      1.000 0.000 1.000 0.000
#> SRR2050461     3   0.000      0.985 0.000 0.000 1.000
#> SRR2050460     1   0.000      0.984 1.000 0.000 0.000
#> SRR2050459     2   0.000      1.000 0.000 1.000 0.000
#> SRR2050458     3   0.000      0.985 0.000 0.000 1.000
#> SRR2050457     1   0.000      0.984 1.000 0.000 0.000
#> SRR2050456     2   0.000      1.000 0.000 1.000 0.000
#> SRR2050455     3   0.000      0.985 0.000 0.000 1.000
#> SRR2050454     1   0.000      0.984 1.000 0.000 0.000
#> SRR2050453     2   0.000      1.000 0.000 1.000 0.000
#> SRR2050452     3   0.000      0.985 0.000 0.000 1.000
#> SRR2050451     1   0.000      0.984 1.000 0.000 0.000
#> SRR2050450     2   0.000      1.000 0.000 1.000 0.000
#> SRR2050449     3   0.000      0.985 0.000 0.000 1.000
#> SRR2050448     1   0.000      0.984 1.000 0.000 0.000
#> SRR2050447     3   0.000      0.985 0.000 0.000 1.000
#> SRR2050446     1   0.000      0.984 1.000 0.000 0.000
#> SRR2050445     2   0.000      1.000 0.000 1.000 0.000
#> SRR2050444     3   0.000      0.985 0.000 0.000 1.000
#> SRR2050443     1   0.000      0.984 1.000 0.000 0.000
#> SRR2050442     1   0.129      0.962 0.968 0.032 0.000
#> SRR2050441     3   0.000      0.985 0.000 0.000 1.000
#> SRR2050440     1   0.000      0.984 1.000 0.000 0.000
#> SRR2050439     1   0.129      0.962 0.968 0.032 0.000
#> SRR2050438     3   0.000      0.985 0.000 0.000 1.000
#> SRR2050437     1   0.000      0.984 1.000 0.000 0.000
#> SRR2050436     1   0.129      0.962 0.968 0.032 0.000
#> SRR2050435     3   0.000      0.985 0.000 0.000 1.000
#> SRR2050434     1   0.129      0.962 0.968 0.032 0.000
#> SRR2050433     2   0.000      1.000 0.000 1.000 0.000
#> SRR2050432     1   0.000      0.984 1.000 0.000 0.000
#> SRR2050431     1   0.000      0.984 1.000 0.000 0.000
#> SRR2050430     1   0.000      0.984 1.000 0.000 0.000
#> SRR2050429     1   0.000      0.984 1.000 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> SRR2050410     2  0.0000      1.000 0.000 1.000 0.000 0.000
#> SRR2050427     1  0.0336      0.995 0.992 0.000 0.000 0.008
#> SRR2050426     1  0.0469      0.994 0.988 0.000 0.000 0.012
#> SRR2050425     2  0.0000      1.000 0.000 1.000 0.000 0.000
#> SRR2050424     3  0.0000      0.998 0.000 0.000 1.000 0.000
#> SRR2050423     1  0.0000      0.995 1.000 0.000 0.000 0.000
#> SRR2050422     4  0.0469      0.995 0.000 0.012 0.000 0.988
#> SRR2050421     1  0.0336      0.995 0.992 0.000 0.000 0.008
#> SRR2050420     1  0.0469      0.994 0.988 0.000 0.000 0.012
#> SRR2050419     2  0.0000      1.000 0.000 1.000 0.000 0.000
#> SRR2050418     1  0.0188      0.995 0.996 0.000 0.000 0.004
#> SRR2050417     1  0.0469      0.994 0.988 0.000 0.000 0.012
#> SRR2050416     4  0.1389      0.962 0.000 0.048 0.000 0.952
#> SRR2050415     3  0.0000      0.998 0.000 0.000 1.000 0.000
#> SRR2050414     1  0.0000      0.995 1.000 0.000 0.000 0.000
#> SRR2050413     4  0.0469      0.995 0.000 0.012 0.000 0.988
#> SRR2050412     1  0.0336      0.995 0.992 0.000 0.000 0.008
#> SRR2050411     1  0.0469      0.994 0.988 0.000 0.000 0.012
#> SRR2050409     2  0.0000      1.000 0.000 1.000 0.000 0.000
#> SRR2050408     1  0.0469      0.994 0.988 0.000 0.000 0.012
#> SRR2050407     2  0.0000      1.000 0.000 1.000 0.000 0.000
#> SRR2050406     3  0.0000      0.998 0.000 0.000 1.000 0.000
#> SRR2050405     1  0.0000      0.995 1.000 0.000 0.000 0.000
#> SRR2050404     2  0.0000      1.000 0.000 1.000 0.000 0.000
#> SRR2050403     1  0.0469      0.994 0.988 0.000 0.000 0.012
#> SRR2050402     2  0.0000      1.000 0.000 1.000 0.000 0.000
#> SRR2050401     1  0.0336      0.995 0.992 0.000 0.000 0.008
#> SRR2050400     1  0.0469      0.994 0.988 0.000 0.000 0.012
#> SRR2050399     4  0.0469      0.995 0.000 0.012 0.000 0.988
#> SRR2050398     1  0.0336      0.995 0.992 0.000 0.000 0.008
#> SRR2050397     1  0.0469      0.994 0.988 0.000 0.000 0.012
#> SRR2050396     3  0.0592      0.977 0.016 0.000 0.984 0.000
#> SRR2050395     1  0.0000      0.995 1.000 0.000 0.000 0.000
#> SRR2050394     2  0.0000      1.000 0.000 1.000 0.000 0.000
#> SRR2050393     3  0.0000      0.998 0.000 0.000 1.000 0.000
#> SRR2050392     1  0.0000      0.995 1.000 0.000 0.000 0.000
#> SRR2050465     2  0.0000      1.000 0.000 1.000 0.000 0.000
#> SRR2050464     3  0.0000      0.998 0.000 0.000 1.000 0.000
#> SRR2050463     1  0.0000      0.995 1.000 0.000 0.000 0.000
#> SRR2050462     2  0.0000      1.000 0.000 1.000 0.000 0.000
#> SRR2050461     3  0.0000      0.998 0.000 0.000 1.000 0.000
#> SRR2050460     1  0.0000      0.995 1.000 0.000 0.000 0.000
#> SRR2050459     2  0.0000      1.000 0.000 1.000 0.000 0.000
#> SRR2050458     3  0.0000      0.998 0.000 0.000 1.000 0.000
#> SRR2050457     1  0.0000      0.995 1.000 0.000 0.000 0.000
#> SRR2050456     2  0.0000      1.000 0.000 1.000 0.000 0.000
#> SRR2050455     3  0.0000      0.998 0.000 0.000 1.000 0.000
#> SRR2050454     1  0.0000      0.995 1.000 0.000 0.000 0.000
#> SRR2050453     2  0.0000      1.000 0.000 1.000 0.000 0.000
#> SRR2050452     3  0.0000      0.998 0.000 0.000 1.000 0.000
#> SRR2050451     1  0.0000      0.995 1.000 0.000 0.000 0.000
#> SRR2050450     2  0.0000      1.000 0.000 1.000 0.000 0.000
#> SRR2050449     3  0.0000      0.998 0.000 0.000 1.000 0.000
#> SRR2050448     1  0.0000      0.995 1.000 0.000 0.000 0.000
#> SRR2050447     3  0.0000      0.998 0.000 0.000 1.000 0.000
#> SRR2050446     1  0.0188      0.995 0.996 0.000 0.000 0.004
#> SRR2050445     2  0.0000      1.000 0.000 1.000 0.000 0.000
#> SRR2050444     3  0.0000      0.998 0.000 0.000 1.000 0.000
#> SRR2050443     1  0.0000      0.995 1.000 0.000 0.000 0.000
#> SRR2050442     4  0.0469      0.995 0.000 0.012 0.000 0.988
#> SRR2050441     3  0.0000      0.998 0.000 0.000 1.000 0.000
#> SRR2050440     1  0.0000      0.995 1.000 0.000 0.000 0.000
#> SRR2050439     4  0.0469      0.995 0.000 0.012 0.000 0.988
#> SRR2050438     3  0.0000      0.998 0.000 0.000 1.000 0.000
#> SRR2050437     1  0.0000      0.995 1.000 0.000 0.000 0.000
#> SRR2050436     4  0.0469      0.995 0.000 0.012 0.000 0.988
#> SRR2050435     3  0.0000      0.998 0.000 0.000 1.000 0.000
#> SRR2050434     4  0.0469      0.995 0.000 0.012 0.000 0.988
#> SRR2050433     2  0.0000      1.000 0.000 1.000 0.000 0.000
#> SRR2050432     1  0.0336      0.995 0.992 0.000 0.000 0.008
#> SRR2050431     1  0.0469      0.994 0.988 0.000 0.000 0.012
#> SRR2050430     1  0.0000      0.995 1.000 0.000 0.000 0.000
#> SRR2050429     1  0.0469      0.994 0.988 0.000 0.000 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
#> SRR2050410     2  0.0000      0.975 0.000 1.000 0.00 0.000 0.000
#> SRR2050427     1  0.0880      0.956 0.968 0.000 0.00 0.032 0.000
#> SRR2050426     1  0.0162      0.937 0.996 0.000 0.00 0.004 0.000
#> SRR2050425     2  0.0000      0.975 0.000 1.000 0.00 0.000 0.000
#> SRR2050424     3  0.0000      0.990 0.000 0.000 1.00 0.000 0.000
#> SRR2050423     4  0.0162      0.994 0.004 0.000 0.00 0.996 0.000
#> SRR2050422     5  0.0162      0.754 0.000 0.004 0.00 0.000 0.996
#> SRR2050421     1  0.0880      0.956 0.968 0.000 0.00 0.032 0.000
#> SRR2050420     1  0.0162      0.937 0.996 0.000 0.00 0.004 0.000
#> SRR2050419     2  0.0000      0.975 0.000 1.000 0.00 0.000 0.000
#> SRR2050418     1  0.3109      0.773 0.800 0.000 0.00 0.200 0.000
#> SRR2050417     1  0.1121      0.954 0.956 0.000 0.00 0.044 0.000
#> SRR2050416     2  0.2561      0.842 0.000 0.856 0.00 0.000 0.144
#> SRR2050415     3  0.0000      0.990 0.000 0.000 1.00 0.000 0.000
#> SRR2050414     4  0.0000      0.999 0.000 0.000 0.00 1.000 0.000
#> SRR2050413     5  0.2891      0.692 0.000 0.176 0.00 0.000 0.824
#> SRR2050412     1  0.0880      0.956 0.968 0.000 0.00 0.032 0.000
#> SRR2050411     1  0.1121      0.954 0.956 0.000 0.00 0.044 0.000
#> SRR2050409     2  0.0000      0.975 0.000 1.000 0.00 0.000 0.000
#> SRR2050408     1  0.1121      0.954 0.956 0.000 0.00 0.044 0.000
#> SRR2050407     2  0.0000      0.975 0.000 1.000 0.00 0.000 0.000
#> SRR2050406     3  0.0000      0.990 0.000 0.000 1.00 0.000 0.000
#> SRR2050405     4  0.0000      0.999 0.000 0.000 0.00 1.000 0.000
#> SRR2050404     2  0.0000      0.975 0.000 1.000 0.00 0.000 0.000
#> SRR2050403     1  0.1121      0.954 0.956 0.000 0.00 0.044 0.000
#> SRR2050402     2  0.1671      0.912 0.000 0.924 0.00 0.000 0.076
#> SRR2050401     1  0.0880      0.956 0.968 0.000 0.00 0.032 0.000
#> SRR2050400     1  0.0794      0.952 0.972 0.000 0.00 0.028 0.000
#> SRR2050399     2  0.2929      0.796 0.000 0.820 0.00 0.000 0.180
#> SRR2050398     1  0.0880      0.956 0.968 0.000 0.00 0.032 0.000
#> SRR2050397     1  0.1121      0.954 0.956 0.000 0.00 0.044 0.000
#> SRR2050396     3  0.2951      0.824 0.000 0.000 0.86 0.112 0.028
#> SRR2050395     4  0.0000      0.999 0.000 0.000 0.00 1.000 0.000
#> SRR2050394     2  0.0000      0.975 0.000 1.000 0.00 0.000 0.000
#> SRR2050393     3  0.0000      0.990 0.000 0.000 1.00 0.000 0.000
#> SRR2050392     4  0.0000      0.999 0.000 0.000 0.00 1.000 0.000
#> SRR2050465     2  0.0000      0.975 0.000 1.000 0.00 0.000 0.000
#> SRR2050464     3  0.0000      0.990 0.000 0.000 1.00 0.000 0.000
#> SRR2050463     4  0.0000      0.999 0.000 0.000 0.00 1.000 0.000
#> SRR2050462     2  0.0000      0.975 0.000 1.000 0.00 0.000 0.000
#> SRR2050461     3  0.0000      0.990 0.000 0.000 1.00 0.000 0.000
#> SRR2050460     4  0.0000      0.999 0.000 0.000 0.00 1.000 0.000
#> SRR2050459     2  0.0000      0.975 0.000 1.000 0.00 0.000 0.000
#> SRR2050458     3  0.0000      0.990 0.000 0.000 1.00 0.000 0.000
#> SRR2050457     4  0.0000      0.999 0.000 0.000 0.00 1.000 0.000
#> SRR2050456     2  0.0000      0.975 0.000 1.000 0.00 0.000 0.000
#> SRR2050455     3  0.0000      0.990 0.000 0.000 1.00 0.000 0.000
#> SRR2050454     4  0.0000      0.999 0.000 0.000 0.00 1.000 0.000
#> SRR2050453     2  0.0000      0.975 0.000 1.000 0.00 0.000 0.000
#> SRR2050452     3  0.0000      0.990 0.000 0.000 1.00 0.000 0.000
#> SRR2050451     4  0.0000      0.999 0.000 0.000 0.00 1.000 0.000
#> SRR2050450     2  0.0000      0.975 0.000 1.000 0.00 0.000 0.000
#> SRR2050449     3  0.0000      0.990 0.000 0.000 1.00 0.000 0.000
#> SRR2050448     4  0.0000      0.999 0.000 0.000 0.00 1.000 0.000
#> SRR2050447     3  0.0000      0.990 0.000 0.000 1.00 0.000 0.000
#> SRR2050446     4  0.0000      0.999 0.000 0.000 0.00 1.000 0.000
#> SRR2050445     2  0.0000      0.975 0.000 1.000 0.00 0.000 0.000
#> SRR2050444     3  0.0000      0.990 0.000 0.000 1.00 0.000 0.000
#> SRR2050443     4  0.0000      0.999 0.000 0.000 0.00 1.000 0.000
#> SRR2050442     5  0.2424      0.735 0.000 0.132 0.00 0.000 0.868
#> SRR2050441     3  0.0000      0.990 0.000 0.000 1.00 0.000 0.000
#> SRR2050440     5  0.4425      0.359 0.004 0.000 0.00 0.452 0.544
#> SRR2050439     5  0.2074      0.751 0.000 0.104 0.00 0.000 0.896
#> SRR2050438     3  0.0000      0.990 0.000 0.000 1.00 0.000 0.000
#> SRR2050437     5  0.4425      0.359 0.004 0.000 0.00 0.452 0.544
#> SRR2050436     5  0.1121      0.760 0.000 0.044 0.00 0.000 0.956
#> SRR2050435     3  0.0000      0.990 0.000 0.000 1.00 0.000 0.000
#> SRR2050434     5  0.0000      0.753 0.000 0.000 0.00 0.000 1.000
#> SRR2050433     2  0.0000      0.975 0.000 1.000 0.00 0.000 0.000
#> SRR2050432     1  0.0880      0.956 0.968 0.000 0.00 0.032 0.000
#> SRR2050431     1  0.4000      0.687 0.748 0.000 0.00 0.024 0.228
#> SRR2050430     5  0.4425      0.359 0.004 0.000 0.00 0.452 0.544
#> SRR2050429     1  0.1768      0.885 0.924 0.000 0.00 0.004 0.072

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>            class entropy silhouette    p1    p2    p3    p4    p5    p6
#> SRR2050410     2  0.0000     0.9298 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2050427     1  0.0000     0.6714 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2050426     1  0.2805     0.6165 0.812 0.000 0.000 0.004 0.000 0.184
#> SRR2050425     2  0.0000     0.9298 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2050424     3  0.0000     0.9773 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2050423     4  0.0405     0.8905 0.004 0.000 0.000 0.988 0.000 0.008
#> SRR2050422     5  0.3175     0.8481 0.000 0.256 0.000 0.000 0.744 0.000
#> SRR2050421     1  0.0000     0.6714 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2050420     1  0.3383     0.5776 0.728 0.000 0.000 0.004 0.000 0.268
#> SRR2050419     2  0.0000     0.9298 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2050418     6  0.5034     0.5768 0.144 0.000 0.000 0.200 0.004 0.652
#> SRR2050417     1  0.3843     0.5541 0.548 0.000 0.000 0.000 0.000 0.452
#> SRR2050416     2  0.1556     0.8478 0.000 0.920 0.000 0.000 0.080 0.000
#> SRR2050415     3  0.0000     0.9773 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2050414     4  0.0000     0.8961 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR2050413     5  0.3727     0.7598 0.000 0.388 0.000 0.000 0.612 0.000
#> SRR2050412     1  0.0000     0.6714 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2050411     1  0.3843     0.5541 0.548 0.000 0.000 0.000 0.000 0.452
#> SRR2050409     2  0.0000     0.9298 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2050408     1  0.3843     0.5541 0.548 0.000 0.000 0.000 0.000 0.452
#> SRR2050407     2  0.0000     0.9298 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2050406     3  0.0000     0.9773 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2050405     4  0.0146     0.8948 0.000 0.000 0.000 0.996 0.000 0.004
#> SRR2050404     2  0.0000     0.9298 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2050403     1  0.3843     0.5541 0.548 0.000 0.000 0.000 0.000 0.452
#> SRR2050402     2  0.1267     0.8711 0.000 0.940 0.000 0.000 0.060 0.000
#> SRR2050401     1  0.0000     0.6714 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2050400     6  0.3565     0.6841 0.276 0.000 0.000 0.004 0.004 0.716
#> SRR2050399     2  0.1556     0.8478 0.000 0.920 0.000 0.000 0.080 0.000
#> SRR2050398     1  0.0000     0.6714 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2050397     1  0.3843     0.5541 0.548 0.000 0.000 0.000 0.000 0.452
#> SRR2050396     3  0.3795     0.7457 0.000 0.000 0.784 0.076 0.136 0.004
#> SRR2050395     4  0.0291     0.8932 0.004 0.000 0.000 0.992 0.000 0.004
#> SRR2050394     2  0.0000     0.9298 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2050393     3  0.0000     0.9773 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2050392     4  0.0000     0.8961 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR2050465     2  0.0000     0.9298 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2050464     3  0.0000     0.9773 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2050463     4  0.0000     0.8961 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR2050462     2  0.0000     0.9298 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2050461     3  0.0000     0.9773 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2050460     4  0.0260     0.8923 0.000 0.000 0.000 0.992 0.000 0.008
#> SRR2050459     2  0.0000     0.9298 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2050458     3  0.0000     0.9773 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2050457     4  0.0000     0.8961 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR2050456     2  0.0000     0.9298 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2050455     3  0.0000     0.9773 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2050454     4  0.0146     0.8948 0.000 0.000 0.000 0.996 0.000 0.004
#> SRR2050453     2  0.0000     0.9298 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2050452     3  0.0000     0.9773 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2050451     4  0.0000     0.8961 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR2050450     2  0.0000     0.9298 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2050449     3  0.0000     0.9773 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2050448     4  0.0000     0.8961 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR2050447     3  0.0000     0.9773 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2050446     4  0.0000     0.8961 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR2050445     2  0.0000     0.9298 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2050444     3  0.0000     0.9773 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2050443     4  0.0000     0.8961 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR2050442     2  0.3482     0.2653 0.000 0.684 0.000 0.000 0.316 0.000
#> SRR2050441     3  0.0000     0.9773 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2050440     4  0.3857     0.4314 0.000 0.000 0.000 0.532 0.468 0.000
#> SRR2050439     2  0.3672     0.0310 0.000 0.632 0.000 0.000 0.368 0.000
#> SRR2050438     3  0.2178     0.8683 0.000 0.000 0.868 0.000 0.000 0.132
#> SRR2050437     4  0.3857     0.4314 0.000 0.000 0.000 0.532 0.468 0.000
#> SRR2050436     5  0.3531     0.8372 0.000 0.328 0.000 0.000 0.672 0.000
#> SRR2050435     3  0.0146     0.9747 0.000 0.000 0.996 0.000 0.000 0.004
#> SRR2050434     5  0.2664     0.7573 0.000 0.184 0.000 0.000 0.816 0.000
#> SRR2050433     2  0.0000     0.9298 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2050432     1  0.0000     0.6714 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2050431     6  0.5272     0.7671 0.276 0.000 0.000 0.004 0.124 0.596
#> SRR2050430     4  0.6077     0.0202 0.000 0.000 0.000 0.400 0.300 0.300
#> SRR2050429     6  0.5272     0.7671 0.276 0.000 0.000 0.004 0.124 0.596

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

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

collect_plots(res)

plot of chunk MAD-NMF-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.860           0.915       0.965         0.4980 0.498   0.498
#> 3 3 1.000           0.970       0.986         0.2967 0.780   0.590
#> 4 4 0.788           0.773       0.872         0.1360 0.916   0.768
#> 5 5 0.889           0.866       0.918         0.0691 0.829   0.499
#> 6 6 0.859           0.780       0.869         0.0248 0.971   0.880

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
#> SRR2050410     2  0.0000      0.970 0.000 1.000
#> SRR2050427     1  0.0000      0.951 1.000 0.000
#> SRR2050426     1  0.0000      0.951 1.000 0.000
#> SRR2050425     2  0.0000      0.970 0.000 1.000
#> SRR2050424     1  0.0000      0.951 1.000 0.000
#> SRR2050423     1  0.0000      0.951 1.000 0.000
#> SRR2050422     2  0.0000      0.970 0.000 1.000
#> SRR2050421     1  0.0000      0.951 1.000 0.000
#> SRR2050420     1  0.0000      0.951 1.000 0.000
#> SRR2050419     2  0.0000      0.970 0.000 1.000
#> SRR2050418     2  0.0376      0.967 0.004 0.996
#> SRR2050417     2  0.0376      0.967 0.004 0.996
#> SRR2050416     2  0.0000      0.970 0.000 1.000
#> SRR2050415     1  0.0000      0.951 1.000 0.000
#> SRR2050414     2  0.0672      0.964 0.008 0.992
#> SRR2050413     2  0.0000      0.970 0.000 1.000
#> SRR2050412     1  0.0000      0.951 1.000 0.000
#> SRR2050411     1  0.9522      0.427 0.628 0.372
#> SRR2050409     2  0.0000      0.970 0.000 1.000
#> SRR2050408     2  0.0376      0.967 0.004 0.996
#> SRR2050407     2  0.0000      0.970 0.000 1.000
#> SRR2050406     1  0.0000      0.951 1.000 0.000
#> SRR2050405     2  0.8443      0.621 0.272 0.728
#> SRR2050404     2  0.0000      0.970 0.000 1.000
#> SRR2050403     2  0.8443      0.621 0.272 0.728
#> SRR2050402     2  0.0000      0.970 0.000 1.000
#> SRR2050401     1  0.0000      0.951 1.000 0.000
#> SRR2050400     2  0.8955      0.538 0.312 0.688
#> SRR2050399     2  0.0000      0.970 0.000 1.000
#> SRR2050398     1  0.0000      0.951 1.000 0.000
#> SRR2050397     1  0.8763      0.590 0.704 0.296
#> SRR2050396     1  0.0000      0.951 1.000 0.000
#> SRR2050395     1  0.5059      0.848 0.888 0.112
#> SRR2050394     2  0.0000      0.970 0.000 1.000
#> SRR2050393     1  0.0000      0.951 1.000 0.000
#> SRR2050392     2  0.0000      0.970 0.000 1.000
#> SRR2050465     2  0.0000      0.970 0.000 1.000
#> SRR2050464     1  0.0000      0.951 1.000 0.000
#> SRR2050463     2  0.0376      0.967 0.004 0.996
#> SRR2050462     2  0.0000      0.970 0.000 1.000
#> SRR2050461     1  0.0000      0.951 1.000 0.000
#> SRR2050460     1  0.9815      0.295 0.580 0.420
#> SRR2050459     2  0.0000      0.970 0.000 1.000
#> SRR2050458     1  0.0000      0.951 1.000 0.000
#> SRR2050457     2  0.0000      0.970 0.000 1.000
#> SRR2050456     2  0.0000      0.970 0.000 1.000
#> SRR2050455     1  0.0000      0.951 1.000 0.000
#> SRR2050454     2  0.0376      0.967 0.004 0.996
#> SRR2050453     2  0.0000      0.970 0.000 1.000
#> SRR2050452     1  0.0000      0.951 1.000 0.000
#> SRR2050451     2  0.0000      0.970 0.000 1.000
#> SRR2050450     2  0.0000      0.970 0.000 1.000
#> SRR2050449     1  0.0000      0.951 1.000 0.000
#> SRR2050448     2  0.0000      0.970 0.000 1.000
#> SRR2050447     1  0.0000      0.951 1.000 0.000
#> SRR2050446     2  0.0000      0.970 0.000 1.000
#> SRR2050445     2  0.0000      0.970 0.000 1.000
#> SRR2050444     1  0.0000      0.951 1.000 0.000
#> SRR2050443     2  0.0000      0.970 0.000 1.000
#> SRR2050442     2  0.0000      0.970 0.000 1.000
#> SRR2050441     1  0.0000      0.951 1.000 0.000
#> SRR2050440     1  0.0000      0.951 1.000 0.000
#> SRR2050439     2  0.0000      0.970 0.000 1.000
#> SRR2050438     1  0.0000      0.951 1.000 0.000
#> SRR2050437     1  0.0000      0.951 1.000 0.000
#> SRR2050436     2  0.0000      0.970 0.000 1.000
#> SRR2050435     1  0.0000      0.951 1.000 0.000
#> SRR2050434     2  0.0000      0.970 0.000 1.000
#> SRR2050433     2  0.0000      0.970 0.000 1.000
#> SRR2050432     1  0.0000      0.951 1.000 0.000
#> SRR2050431     2  0.7219      0.741 0.200 0.800
#> SRR2050430     1  0.8443      0.633 0.728 0.272
#> SRR2050429     1  0.0938      0.941 0.988 0.012

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>            class entropy silhouette    p1    p2    p3
#> SRR2050410     2  0.0000      0.988 0.000 1.000 0.000
#> SRR2050427     1  0.0237      0.971 0.996 0.000 0.004
#> SRR2050426     1  0.0000      0.972 1.000 0.000 0.000
#> SRR2050425     2  0.0000      0.988 0.000 1.000 0.000
#> SRR2050424     3  0.0237      0.999 0.004 0.000 0.996
#> SRR2050423     1  0.0592      0.965 0.988 0.000 0.012
#> SRR2050422     2  0.4291      0.781 0.180 0.820 0.000
#> SRR2050421     1  0.0237      0.971 0.996 0.000 0.004
#> SRR2050420     1  0.0000      0.972 1.000 0.000 0.000
#> SRR2050419     2  0.0237      0.988 0.000 0.996 0.004
#> SRR2050418     1  0.0424      0.969 0.992 0.008 0.000
#> SRR2050417     1  0.0237      0.972 0.996 0.004 0.000
#> SRR2050416     2  0.0000      0.988 0.000 1.000 0.000
#> SRR2050415     3  0.0237      0.999 0.004 0.000 0.996
#> SRR2050414     2  0.1129      0.973 0.020 0.976 0.004
#> SRR2050413     2  0.0424      0.984 0.008 0.992 0.000
#> SRR2050412     1  0.0237      0.971 0.996 0.000 0.004
#> SRR2050411     1  0.0237      0.972 0.996 0.004 0.000
#> SRR2050409     2  0.0000      0.988 0.000 1.000 0.000
#> SRR2050408     1  0.0237      0.972 0.996 0.004 0.000
#> SRR2050407     2  0.0237      0.988 0.000 0.996 0.004
#> SRR2050406     3  0.0000      0.997 0.000 0.000 1.000
#> SRR2050405     2  0.2261      0.928 0.000 0.932 0.068
#> SRR2050404     2  0.0000      0.988 0.000 1.000 0.000
#> SRR2050403     1  0.0237      0.972 0.996 0.004 0.000
#> SRR2050402     2  0.0000      0.988 0.000 1.000 0.000
#> SRR2050401     1  0.0237      0.971 0.996 0.000 0.004
#> SRR2050400     1  0.0237      0.972 0.996 0.004 0.000
#> SRR2050399     2  0.0237      0.987 0.004 0.996 0.000
#> SRR2050398     1  0.0237      0.971 0.996 0.000 0.004
#> SRR2050397     1  0.0237      0.972 0.996 0.004 0.000
#> SRR2050396     3  0.0237      0.999 0.004 0.000 0.996
#> SRR2050395     1  0.9663      0.226 0.464 0.280 0.256
#> SRR2050394     2  0.0237      0.988 0.000 0.996 0.004
#> SRR2050393     3  0.0000      0.997 0.000 0.000 1.000
#> SRR2050392     2  0.0237      0.988 0.000 0.996 0.004
#> SRR2050465     2  0.0000      0.988 0.000 1.000 0.000
#> SRR2050464     3  0.0237      0.999 0.004 0.000 0.996
#> SRR2050463     2  0.0237      0.988 0.000 0.996 0.004
#> SRR2050462     2  0.0000      0.988 0.000 1.000 0.000
#> SRR2050461     3  0.0237      0.999 0.004 0.000 0.996
#> SRR2050460     1  0.0237      0.972 0.996 0.004 0.000
#> SRR2050459     2  0.0237      0.988 0.000 0.996 0.004
#> SRR2050458     3  0.0000      0.997 0.000 0.000 1.000
#> SRR2050457     2  0.0237      0.988 0.000 0.996 0.004
#> SRR2050456     2  0.0237      0.988 0.000 0.996 0.004
#> SRR2050455     3  0.0000      0.997 0.000 0.000 1.000
#> SRR2050454     2  0.0237      0.988 0.000 0.996 0.004
#> SRR2050453     2  0.0000      0.988 0.000 1.000 0.000
#> SRR2050452     3  0.0000      0.997 0.000 0.000 1.000
#> SRR2050451     2  0.0237      0.987 0.004 0.996 0.000
#> SRR2050450     2  0.0000      0.988 0.000 1.000 0.000
#> SRR2050449     3  0.0237      0.999 0.004 0.000 0.996
#> SRR2050448     2  0.0000      0.988 0.000 1.000 0.000
#> SRR2050447     3  0.0237      0.999 0.004 0.000 0.996
#> SRR2050446     2  0.1289      0.964 0.032 0.968 0.000
#> SRR2050445     2  0.0237      0.988 0.000 0.996 0.004
#> SRR2050444     3  0.0237      0.999 0.004 0.000 0.996
#> SRR2050443     2  0.0237      0.988 0.000 0.996 0.004
#> SRR2050442     2  0.0000      0.988 0.000 1.000 0.000
#> SRR2050441     3  0.0237      0.999 0.004 0.000 0.996
#> SRR2050440     1  0.0237      0.971 0.996 0.000 0.004
#> SRR2050439     2  0.0237      0.987 0.004 0.996 0.000
#> SRR2050438     3  0.0237      0.999 0.004 0.000 0.996
#> SRR2050437     1  0.0000      0.972 1.000 0.000 0.000
#> SRR2050436     2  0.0237      0.987 0.004 0.996 0.000
#> SRR2050435     3  0.0237      0.999 0.004 0.000 0.996
#> SRR2050434     2  0.0424      0.984 0.008 0.992 0.000
#> SRR2050433     2  0.0000      0.988 0.000 1.000 0.000
#> SRR2050432     1  0.0237      0.971 0.996 0.000 0.004
#> SRR2050431     1  0.0237      0.972 0.996 0.004 0.000
#> SRR2050430     1  0.0237      0.972 0.996 0.004 0.000
#> SRR2050429     1  0.0000      0.972 1.000 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> SRR2050410     2  0.1474     0.7327 0.000 0.948 0.000 0.052
#> SRR2050427     1  0.0000     0.9258 1.000 0.000 0.000 0.000
#> SRR2050426     1  0.0000     0.9258 1.000 0.000 0.000 0.000
#> SRR2050425     2  0.3356     0.5972 0.000 0.824 0.000 0.176
#> SRR2050424     3  0.0000     0.9935 0.000 0.000 1.000 0.000
#> SRR2050423     1  0.2011     0.8690 0.920 0.000 0.000 0.080
#> SRR2050422     4  0.4936     0.7226 0.008 0.340 0.000 0.652
#> SRR2050421     1  0.0000     0.9258 1.000 0.000 0.000 0.000
#> SRR2050420     1  0.0000     0.9258 1.000 0.000 0.000 0.000
#> SRR2050419     2  0.3764     0.7397 0.000 0.784 0.000 0.216
#> SRR2050418     1  0.0188     0.9238 0.996 0.000 0.000 0.004
#> SRR2050417     1  0.1302     0.9009 0.956 0.000 0.000 0.044
#> SRR2050416     2  0.4134     0.4366 0.000 0.740 0.000 0.260
#> SRR2050415     3  0.0000     0.9935 0.000 0.000 1.000 0.000
#> SRR2050414     2  0.5890     0.6569 0.072 0.660 0.000 0.268
#> SRR2050413     2  0.4941    -0.2048 0.000 0.564 0.000 0.436
#> SRR2050412     1  0.0000     0.9258 1.000 0.000 0.000 0.000
#> SRR2050411     1  0.0000     0.9258 1.000 0.000 0.000 0.000
#> SRR2050409     2  0.1022     0.7414 0.000 0.968 0.000 0.032
#> SRR2050408     1  0.0921     0.9093 0.972 0.000 0.000 0.028
#> SRR2050407     2  0.3356     0.7522 0.000 0.824 0.000 0.176
#> SRR2050406     3  0.0000     0.9935 0.000 0.000 1.000 0.000
#> SRR2050405     2  0.4936     0.6645 0.000 0.652 0.008 0.340
#> SRR2050404     2  0.1637     0.7285 0.000 0.940 0.000 0.060
#> SRR2050403     1  0.0336     0.9227 0.992 0.000 0.000 0.008
#> SRR2050402     2  0.2149     0.7071 0.000 0.912 0.000 0.088
#> SRR2050401     1  0.0000     0.9258 1.000 0.000 0.000 0.000
#> SRR2050400     1  0.0000     0.9258 1.000 0.000 0.000 0.000
#> SRR2050399     2  0.4072     0.4551 0.000 0.748 0.000 0.252
#> SRR2050398     1  0.0000     0.9258 1.000 0.000 0.000 0.000
#> SRR2050397     1  0.0000     0.9258 1.000 0.000 0.000 0.000
#> SRR2050396     3  0.0000     0.9935 0.000 0.000 1.000 0.000
#> SRR2050395     1  0.7640    -0.0578 0.432 0.356 0.000 0.212
#> SRR2050394     2  0.0707     0.7510 0.000 0.980 0.000 0.020
#> SRR2050393     3  0.0000     0.9935 0.000 0.000 1.000 0.000
#> SRR2050392     2  0.4331     0.7078 0.000 0.712 0.000 0.288
#> SRR2050465     2  0.1716     0.7261 0.000 0.936 0.000 0.064
#> SRR2050464     3  0.0000     0.9935 0.000 0.000 1.000 0.000
#> SRR2050463     2  0.5131     0.6912 0.028 0.692 0.000 0.280
#> SRR2050462     2  0.1792     0.7235 0.000 0.932 0.000 0.068
#> SRR2050461     3  0.0000     0.9935 0.000 0.000 1.000 0.000
#> SRR2050460     1  0.2081     0.8663 0.916 0.000 0.000 0.084
#> SRR2050459     2  0.2345     0.7600 0.000 0.900 0.000 0.100
#> SRR2050458     3  0.0000     0.9935 0.000 0.000 1.000 0.000
#> SRR2050457     2  0.4193     0.7149 0.000 0.732 0.000 0.268
#> SRR2050456     2  0.3486     0.7495 0.000 0.812 0.000 0.188
#> SRR2050455     3  0.0000     0.9935 0.000 0.000 1.000 0.000
#> SRR2050454     2  0.4431     0.6979 0.000 0.696 0.000 0.304
#> SRR2050453     2  0.0336     0.7499 0.000 0.992 0.000 0.008
#> SRR2050452     3  0.0000     0.9935 0.000 0.000 1.000 0.000
#> SRR2050451     2  0.4149     0.7310 0.028 0.804 0.000 0.168
#> SRR2050450     2  0.0592     0.7479 0.000 0.984 0.000 0.016
#> SRR2050449     3  0.0000     0.9935 0.000 0.000 1.000 0.000
#> SRR2050448     2  0.3123     0.7437 0.000 0.844 0.000 0.156
#> SRR2050447     3  0.0000     0.9935 0.000 0.000 1.000 0.000
#> SRR2050446     2  0.6180     0.4182 0.296 0.624 0.000 0.080
#> SRR2050445     2  0.3528     0.7487 0.000 0.808 0.000 0.192
#> SRR2050444     3  0.0000     0.9935 0.000 0.000 1.000 0.000
#> SRR2050443     2  0.4535     0.7030 0.000 0.704 0.004 0.292
#> SRR2050442     4  0.4697     0.7108 0.000 0.356 0.000 0.644
#> SRR2050441     3  0.0000     0.9935 0.000 0.000 1.000 0.000
#> SRR2050440     4  0.5945     0.3955 0.056 0.004 0.292 0.648
#> SRR2050439     4  0.4697     0.7108 0.000 0.356 0.000 0.644
#> SRR2050438     3  0.2216     0.8937 0.000 0.000 0.908 0.092
#> SRR2050437     4  0.7074     0.6200 0.172 0.116 0.052 0.660
#> SRR2050436     4  0.4643     0.7208 0.000 0.344 0.000 0.656
#> SRR2050435     3  0.0000     0.9935 0.000 0.000 1.000 0.000
#> SRR2050434     4  0.4382     0.7170 0.000 0.296 0.000 0.704
#> SRR2050433     2  0.1867     0.7205 0.000 0.928 0.000 0.072
#> SRR2050432     1  0.0000     0.9258 1.000 0.000 0.000 0.000
#> SRR2050431     1  0.0000     0.9258 1.000 0.000 0.000 0.000
#> SRR2050430     4  0.4877     0.1930 0.408 0.000 0.000 0.592
#> SRR2050429     1  0.4888     0.3072 0.588 0.000 0.000 0.412

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>            class entropy silhouette    p1    p2    p3    p4    p5
#> SRR2050410     2  0.1544      0.837 0.000 0.932 0.000 0.000 0.068
#> SRR2050427     1  0.0162      0.969 0.996 0.000 0.000 0.000 0.004
#> SRR2050426     1  0.0290      0.970 0.992 0.000 0.000 0.008 0.000
#> SRR2050425     2  0.0963      0.827 0.000 0.964 0.000 0.000 0.036
#> SRR2050424     3  0.0000      0.996 0.000 0.000 1.000 0.000 0.000
#> SRR2050423     4  0.0609      0.899 0.020 0.000 0.000 0.980 0.000
#> SRR2050422     2  0.2389      0.785 0.004 0.880 0.000 0.000 0.116
#> SRR2050421     1  0.0451      0.966 0.988 0.000 0.000 0.004 0.008
#> SRR2050420     1  0.0579      0.970 0.984 0.000 0.000 0.008 0.008
#> SRR2050419     2  0.4192      0.427 0.000 0.596 0.000 0.000 0.404
#> SRR2050418     1  0.0162      0.968 0.996 0.004 0.000 0.000 0.000
#> SRR2050417     1  0.2362      0.890 0.900 0.008 0.000 0.084 0.008
#> SRR2050416     2  0.1270      0.819 0.000 0.948 0.000 0.000 0.052
#> SRR2050415     3  0.0000      0.996 0.000 0.000 1.000 0.000 0.000
#> SRR2050414     4  0.1179      0.903 0.004 0.016 0.000 0.964 0.016
#> SRR2050413     2  0.1792      0.805 0.000 0.916 0.000 0.000 0.084
#> SRR2050412     1  0.0162      0.968 0.996 0.000 0.000 0.004 0.000
#> SRR2050411     1  0.0404      0.969 0.988 0.000 0.000 0.012 0.000
#> SRR2050409     2  0.1908      0.831 0.000 0.908 0.000 0.000 0.092
#> SRR2050408     1  0.1732      0.917 0.920 0.000 0.000 0.080 0.000
#> SRR2050407     2  0.3210      0.739 0.000 0.788 0.000 0.000 0.212
#> SRR2050406     3  0.0162      0.993 0.000 0.000 0.996 0.004 0.000
#> SRR2050405     4  0.3367      0.768 0.008 0.008 0.004 0.828 0.152
#> SRR2050404     2  0.1732      0.834 0.000 0.920 0.000 0.000 0.080
#> SRR2050403     1  0.0404      0.969 0.988 0.000 0.000 0.012 0.000
#> SRR2050402     2  0.0162      0.833 0.000 0.996 0.000 0.000 0.004
#> SRR2050401     1  0.0404      0.963 0.988 0.000 0.000 0.012 0.000
#> SRR2050400     1  0.0451      0.970 0.988 0.000 0.000 0.008 0.004
#> SRR2050399     2  0.1270      0.819 0.000 0.948 0.000 0.000 0.052
#> SRR2050398     1  0.0000      0.969 1.000 0.000 0.000 0.000 0.000
#> SRR2050397     1  0.0404      0.969 0.988 0.000 0.000 0.012 0.000
#> SRR2050396     3  0.0404      0.985 0.000 0.000 0.988 0.012 0.000
#> SRR2050395     4  0.2518      0.864 0.016 0.008 0.000 0.896 0.080
#> SRR2050394     2  0.2074      0.827 0.000 0.896 0.000 0.000 0.104
#> SRR2050393     3  0.0000      0.996 0.000 0.000 1.000 0.000 0.000
#> SRR2050392     5  0.3670      0.819 0.000 0.068 0.000 0.112 0.820
#> SRR2050465     2  0.1270      0.838 0.000 0.948 0.000 0.000 0.052
#> SRR2050464     3  0.0000      0.996 0.000 0.000 1.000 0.000 0.000
#> SRR2050463     4  0.1682      0.900 0.012 0.012 0.000 0.944 0.032
#> SRR2050462     2  0.0963      0.838 0.000 0.964 0.000 0.000 0.036
#> SRR2050461     3  0.0000      0.996 0.000 0.000 1.000 0.000 0.000
#> SRR2050460     4  0.0703      0.898 0.024 0.000 0.000 0.976 0.000
#> SRR2050459     2  0.2377      0.812 0.000 0.872 0.000 0.000 0.128
#> SRR2050458     3  0.0000      0.996 0.000 0.000 1.000 0.000 0.000
#> SRR2050457     5  0.3497      0.781 0.004 0.112 0.000 0.048 0.836
#> SRR2050456     2  0.4138      0.473 0.000 0.616 0.000 0.000 0.384
#> SRR2050455     3  0.0162      0.993 0.000 0.000 0.996 0.004 0.000
#> SRR2050454     5  0.5219      0.467 0.008 0.032 0.000 0.400 0.560
#> SRR2050453     2  0.2020      0.827 0.000 0.900 0.000 0.000 0.100
#> SRR2050452     3  0.0000      0.996 0.000 0.000 1.000 0.000 0.000
#> SRR2050451     4  0.1787      0.899 0.012 0.016 0.000 0.940 0.032
#> SRR2050450     2  0.2020      0.827 0.000 0.900 0.000 0.000 0.100
#> SRR2050449     3  0.0000      0.996 0.000 0.000 1.000 0.000 0.000
#> SRR2050448     4  0.1869      0.897 0.012 0.016 0.000 0.936 0.036
#> SRR2050447     3  0.0000      0.996 0.000 0.000 1.000 0.000 0.000
#> SRR2050446     4  0.1074      0.903 0.012 0.016 0.000 0.968 0.004
#> SRR2050445     2  0.3612      0.673 0.000 0.732 0.000 0.000 0.268
#> SRR2050444     3  0.0000      0.996 0.000 0.000 1.000 0.000 0.000
#> SRR2050443     5  0.4546      0.807 0.000 0.056 0.012 0.176 0.756
#> SRR2050442     2  0.2909      0.762 0.000 0.848 0.000 0.012 0.140
#> SRR2050441     3  0.0000      0.996 0.000 0.000 1.000 0.000 0.000
#> SRR2050440     4  0.2629      0.819 0.012 0.000 0.004 0.880 0.104
#> SRR2050439     2  0.3236      0.746 0.000 0.828 0.000 0.020 0.152
#> SRR2050438     3  0.1306      0.959 0.008 0.000 0.960 0.016 0.016
#> SRR2050437     4  0.2753      0.814 0.012 0.008 0.000 0.876 0.104
#> SRR2050436     2  0.4138      0.693 0.000 0.776 0.000 0.064 0.160
#> SRR2050435     3  0.0000      0.996 0.000 0.000 1.000 0.000 0.000
#> SRR2050434     2  0.6215      0.210 0.000 0.508 0.000 0.336 0.156
#> SRR2050433     2  0.1121      0.839 0.000 0.956 0.000 0.000 0.044
#> SRR2050432     1  0.0162      0.970 0.996 0.000 0.000 0.004 0.000
#> SRR2050431     1  0.0510      0.968 0.984 0.000 0.000 0.016 0.000
#> SRR2050430     1  0.3758      0.807 0.824 0.008 0.000 0.056 0.112
#> SRR2050429     4  0.2769      0.819 0.032 0.000 0.000 0.876 0.092

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>            class entropy silhouette    p1    p2    p3    p4    p5    p6
#> SRR2050410     2  0.1349      0.791 0.000 0.940 0.000 0.000 0.004 0.056
#> SRR2050427     1  0.0909      0.932 0.968 0.000 0.000 0.000 0.020 0.012
#> SRR2050426     1  0.0993      0.930 0.964 0.000 0.000 0.000 0.024 0.012
#> SRR2050425     2  0.0935      0.802 0.000 0.964 0.000 0.000 0.032 0.004
#> SRR2050424     3  0.0000      0.978 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2050423     4  0.3314      0.587 0.004 0.000 0.000 0.740 0.256 0.000
#> SRR2050422     2  0.3483      0.697 0.000 0.764 0.000 0.000 0.212 0.024
#> SRR2050421     1  0.0363      0.936 0.988 0.000 0.000 0.000 0.012 0.000
#> SRR2050420     1  0.0291      0.937 0.992 0.000 0.000 0.000 0.004 0.004
#> SRR2050419     2  0.3695      0.430 0.000 0.624 0.000 0.000 0.000 0.376
#> SRR2050418     1  0.0993      0.930 0.964 0.000 0.000 0.000 0.024 0.012
#> SRR2050417     1  0.2330      0.892 0.908 0.004 0.000 0.040 0.024 0.024
#> SRR2050416     2  0.1616      0.792 0.000 0.932 0.000 0.000 0.048 0.020
#> SRR2050415     3  0.0146      0.977 0.000 0.000 0.996 0.000 0.000 0.004
#> SRR2050414     4  0.2823      0.677 0.000 0.000 0.000 0.796 0.204 0.000
#> SRR2050413     2  0.2872      0.748 0.000 0.836 0.000 0.000 0.140 0.024
#> SRR2050412     1  0.0363      0.936 0.988 0.000 0.000 0.000 0.012 0.000
#> SRR2050411     1  0.0405      0.936 0.988 0.000 0.000 0.000 0.008 0.004
#> SRR2050409     2  0.1863      0.769 0.000 0.896 0.000 0.000 0.000 0.104
#> SRR2050408     1  0.3050      0.813 0.832 0.000 0.000 0.028 0.136 0.004
#> SRR2050407     2  0.2562      0.719 0.000 0.828 0.000 0.000 0.000 0.172
#> SRR2050406     3  0.0146      0.978 0.000 0.000 0.996 0.000 0.000 0.004
#> SRR2050405     4  0.2871      0.695 0.000 0.000 0.000 0.804 0.192 0.004
#> SRR2050404     2  0.0520      0.800 0.000 0.984 0.000 0.008 0.000 0.008
#> SRR2050403     1  0.0692      0.936 0.976 0.000 0.000 0.000 0.020 0.004
#> SRR2050402     2  0.0935      0.801 0.000 0.964 0.000 0.000 0.032 0.004
#> SRR2050401     1  0.0865      0.925 0.964 0.000 0.000 0.000 0.036 0.000
#> SRR2050400     1  0.1320      0.923 0.948 0.000 0.000 0.000 0.036 0.016
#> SRR2050399     2  0.2748      0.755 0.000 0.848 0.000 0.000 0.128 0.024
#> SRR2050398     1  0.0260      0.936 0.992 0.000 0.000 0.000 0.008 0.000
#> SRR2050397     1  0.0291      0.936 0.992 0.000 0.000 0.000 0.004 0.004
#> SRR2050396     3  0.2377      0.872 0.000 0.000 0.892 0.076 0.024 0.008
#> SRR2050395     4  0.2845      0.714 0.004 0.000 0.000 0.820 0.172 0.004
#> SRR2050394     2  0.4205      0.691 0.000 0.728 0.000 0.000 0.084 0.188
#> SRR2050393     3  0.0458      0.971 0.000 0.000 0.984 0.000 0.000 0.016
#> SRR2050392     6  0.4386      0.589 0.000 0.040 0.000 0.228 0.020 0.712
#> SRR2050465     2  0.0665      0.801 0.000 0.980 0.000 0.008 0.008 0.004
#> SRR2050464     3  0.0000      0.978 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2050463     4  0.1065      0.791 0.000 0.008 0.000 0.964 0.020 0.008
#> SRR2050462     2  0.0291      0.801 0.000 0.992 0.000 0.000 0.004 0.004
#> SRR2050461     3  0.0000      0.978 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2050460     4  0.1010      0.791 0.000 0.004 0.000 0.960 0.036 0.000
#> SRR2050459     2  0.0922      0.798 0.000 0.968 0.000 0.004 0.004 0.024
#> SRR2050458     3  0.0000      0.978 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2050457     6  0.5773      0.630 0.008 0.156 0.000 0.184 0.028 0.624
#> SRR2050456     2  0.3907      0.357 0.000 0.588 0.000 0.000 0.004 0.408
#> SRR2050455     3  0.0146      0.978 0.000 0.000 0.996 0.000 0.000 0.004
#> SRR2050454     4  0.1933      0.786 0.004 0.000 0.000 0.920 0.044 0.032
#> SRR2050453     2  0.1707      0.775 0.000 0.928 0.000 0.056 0.004 0.012
#> SRR2050452     3  0.0146      0.978 0.000 0.000 0.996 0.000 0.000 0.004
#> SRR2050451     4  0.2394      0.761 0.000 0.032 0.000 0.900 0.048 0.020
#> SRR2050450     2  0.0717      0.799 0.000 0.976 0.000 0.008 0.000 0.016
#> SRR2050449     3  0.0000      0.978 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2050448     4  0.2672      0.740 0.000 0.048 0.000 0.884 0.048 0.020
#> SRR2050447     3  0.0146      0.977 0.000 0.000 0.996 0.004 0.000 0.000
#> SRR2050446     4  0.1364      0.789 0.000 0.020 0.000 0.952 0.016 0.012
#> SRR2050445     2  0.3499      0.537 0.000 0.680 0.000 0.000 0.000 0.320
#> SRR2050444     3  0.0000      0.978 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2050443     4  0.3504      0.664 0.000 0.076 0.000 0.832 0.032 0.060
#> SRR2050442     2  0.4370      0.359 0.000 0.536 0.000 0.004 0.444 0.016
#> SRR2050441     3  0.0405      0.973 0.000 0.000 0.988 0.000 0.008 0.004
#> SRR2050440     5  0.4025      0.461 0.008 0.000 0.000 0.416 0.576 0.000
#> SRR2050439     2  0.4174      0.523 0.000 0.628 0.000 0.004 0.352 0.016
#> SRR2050438     3  0.2431      0.850 0.000 0.000 0.860 0.000 0.132 0.008
#> SRR2050437     5  0.4150      0.529 0.012 0.000 0.000 0.372 0.612 0.004
#> SRR2050436     2  0.4471      0.351 0.000 0.532 0.000 0.008 0.444 0.016
#> SRR2050435     3  0.0717      0.966 0.000 0.000 0.976 0.000 0.016 0.008
#> SRR2050434     5  0.5146      0.104 0.000 0.320 0.000 0.068 0.596 0.016
#> SRR2050433     2  0.1367      0.801 0.000 0.944 0.000 0.000 0.044 0.012
#> SRR2050432     1  0.0146      0.937 0.996 0.000 0.000 0.000 0.004 0.000
#> SRR2050431     1  0.0993      0.931 0.964 0.000 0.000 0.012 0.024 0.000
#> SRR2050430     1  0.4496      0.243 0.508 0.012 0.000 0.000 0.468 0.012
#> SRR2050429     5  0.4539      0.535 0.048 0.000 0.000 0.304 0.644 0.004

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

consensus_heatmap(res, k = 2)

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

consensus_heatmap(res, k = 3)

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

consensus_heatmap(res, k = 4)

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

consensus_heatmap(res, k = 5)

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

consensus_heatmap(res, k = 6)

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

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

membership_heatmap(res, k = 2)

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

membership_heatmap(res, k = 3)

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

membership_heatmap(res, k = 4)

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

membership_heatmap(res, k = 5)

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

membership_heatmap(res, k = 6)

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

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

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

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

get_signatures(res, k = 3)

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

get_signatures(res, k = 4)

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

get_signatures(res, k = 5)

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

get_signatures(res, k = 6)

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

Signature heatmaps where rows are not scaled:

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

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

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

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

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

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

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

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

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

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

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk MAD-NMF-signature_compare

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

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

An example of the output of tb is:

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

The columns in tb are:

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

UMAP plot which shows how samples are separated.

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

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

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

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

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

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

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

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

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

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

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk MAD-NMF-collect-classes

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


ATC:hclust*

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

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

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

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

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

collect_plots(res)

plot of chunk ATC-hclust-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.550           0.748       0.850         0.4554 0.521   0.521
#> 3 3 0.780           0.810       0.911         0.4252 0.812   0.639
#> 4 4 0.881           0.852       0.927         0.1472 0.875   0.644
#> 5 5 0.922           0.817       0.920         0.0578 0.953   0.811
#> 6 6 0.919           0.877       0.916         0.0286 0.960   0.810

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

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

There is also optional best \(k\) = 5 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
#> SRR2050410     2  0.9522    0.71350 0.372 0.628
#> SRR2050427     1  0.9522    0.98452 0.628 0.372
#> SRR2050426     1  0.9522    0.98452 0.628 0.372
#> SRR2050425     2  0.9522    0.71350 0.372 0.628
#> SRR2050424     1  0.9522    0.98452 0.628 0.372
#> SRR2050423     2  0.2603    0.60830 0.044 0.956
#> SRR2050422     2  0.0376    0.66159 0.004 0.996
#> SRR2050421     1  0.9522    0.98452 0.628 0.372
#> SRR2050420     1  0.9522    0.98452 0.628 0.372
#> SRR2050419     2  0.9522    0.71350 0.372 0.628
#> SRR2050418     2  0.0000    0.65977 0.000 1.000
#> SRR2050417     2  0.0000    0.65977 0.000 1.000
#> SRR2050416     2  0.9522    0.71350 0.372 0.628
#> SRR2050415     1  0.9522    0.98452 0.628 0.372
#> SRR2050414     2  0.0000    0.65977 0.000 1.000
#> SRR2050413     2  0.1184    0.66470 0.016 0.984
#> SRR2050412     2  0.8763   -0.18624 0.296 0.704
#> SRR2050411     2  0.8144    0.00913 0.252 0.748
#> SRR2050409     2  0.9522    0.71350 0.372 0.628
#> SRR2050408     2  0.0000    0.65977 0.000 1.000
#> SRR2050407     2  0.9522    0.71350 0.372 0.628
#> SRR2050406     1  0.9522    0.98452 0.628 0.372
#> SRR2050405     2  0.0000    0.65977 0.000 1.000
#> SRR2050404     2  0.9522    0.71350 0.372 0.628
#> SRR2050403     2  0.0000    0.65977 0.000 1.000
#> SRR2050402     2  0.9522    0.71350 0.372 0.628
#> SRR2050401     2  0.8763   -0.18624 0.296 0.704
#> SRR2050400     1  0.9954    0.85886 0.540 0.460
#> SRR2050399     2  0.9358    0.71181 0.352 0.648
#> SRR2050398     1  0.9522    0.98452 0.628 0.372
#> SRR2050397     2  0.8144    0.00913 0.252 0.748
#> SRR2050396     1  0.9522    0.98452 0.628 0.372
#> SRR2050395     2  0.2603    0.60830 0.044 0.956
#> SRR2050394     2  0.9522    0.71350 0.372 0.628
#> SRR2050393     1  0.9522    0.98452 0.628 0.372
#> SRR2050392     2  0.0000    0.65977 0.000 1.000
#> SRR2050465     2  0.9522    0.71350 0.372 0.628
#> SRR2050464     1  0.9522    0.98452 0.628 0.372
#> SRR2050463     2  0.2236    0.61869 0.036 0.964
#> SRR2050462     2  0.9522    0.71350 0.372 0.628
#> SRR2050461     1  0.9522    0.98452 0.628 0.372
#> SRR2050460     2  0.2603    0.60830 0.044 0.956
#> SRR2050459     2  0.9522    0.71350 0.372 0.628
#> SRR2050458     1  0.9522    0.98452 0.628 0.372
#> SRR2050457     2  0.0000    0.65977 0.000 1.000
#> SRR2050456     2  0.9522    0.71350 0.372 0.628
#> SRR2050455     1  0.9522    0.98452 0.628 0.372
#> SRR2050454     2  0.0000    0.65977 0.000 1.000
#> SRR2050453     2  0.9522    0.71350 0.372 0.628
#> SRR2050452     1  0.9522    0.98452 0.628 0.372
#> SRR2050451     2  0.2603    0.60830 0.044 0.956
#> SRR2050450     2  0.9522    0.71350 0.372 0.628
#> SRR2050449     1  0.9522    0.98452 0.628 0.372
#> SRR2050448     2  0.2603    0.60830 0.044 0.956
#> SRR2050447     1  0.9522    0.98452 0.628 0.372
#> SRR2050446     2  0.2603    0.60830 0.044 0.956
#> SRR2050445     2  0.9522    0.71350 0.372 0.628
#> SRR2050444     1  0.9522    0.98452 0.628 0.372
#> SRR2050443     2  0.0000    0.65977 0.000 1.000
#> SRR2050442     2  0.9522    0.71350 0.372 0.628
#> SRR2050441     1  0.9522    0.98452 0.628 0.372
#> SRR2050440     1  0.9522    0.98452 0.628 0.372
#> SRR2050439     2  0.9522    0.71350 0.372 0.628
#> SRR2050438     1  0.9522    0.98452 0.628 0.372
#> SRR2050437     1  0.9522    0.98452 0.628 0.372
#> SRR2050436     2  0.0376    0.66159 0.004 0.996
#> SRR2050435     1  0.9522    0.98452 0.628 0.372
#> SRR2050434     2  0.0376    0.66159 0.004 0.996
#> SRR2050433     2  0.9522    0.71350 0.372 0.628
#> SRR2050432     1  0.9522    0.98452 0.628 0.372
#> SRR2050431     1  0.9993    0.81502 0.516 0.484
#> SRR2050430     1  0.9922    0.87865 0.552 0.448
#> SRR2050429     1  0.9552    0.97993 0.624 0.376

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>            class entropy silhouette    p1    p2    p3
#> SRR2050410     2  0.0000      1.000 0.000 1.000 0.000
#> SRR2050427     3  0.6008      0.578 0.372 0.000 0.628
#> SRR2050426     3  0.6008      0.578 0.372 0.000 0.628
#> SRR2050425     2  0.0000      1.000 0.000 1.000 0.000
#> SRR2050424     3  0.0000      0.785 0.000 0.000 1.000
#> SRR2050423     1  0.1643      0.889 0.956 0.000 0.044
#> SRR2050422     1  0.0237      0.901 0.996 0.004 0.000
#> SRR2050421     3  0.6008      0.578 0.372 0.000 0.628
#> SRR2050420     3  0.6008      0.578 0.372 0.000 0.628
#> SRR2050419     2  0.0000      1.000 0.000 1.000 0.000
#> SRR2050418     1  0.0000      0.903 1.000 0.000 0.000
#> SRR2050417     1  0.0000      0.903 1.000 0.000 0.000
#> SRR2050416     2  0.0000      1.000 0.000 1.000 0.000
#> SRR2050415     3  0.0000      0.785 0.000 0.000 1.000
#> SRR2050414     1  0.0000      0.903 1.000 0.000 0.000
#> SRR2050413     1  0.0747      0.891 0.984 0.016 0.000
#> SRR2050412     1  0.5529      0.480 0.704 0.000 0.296
#> SRR2050411     1  0.5138      0.585 0.748 0.000 0.252
#> SRR2050409     2  0.0000      1.000 0.000 1.000 0.000
#> SRR2050408     1  0.0000      0.903 1.000 0.000 0.000
#> SRR2050407     2  0.0000      1.000 0.000 1.000 0.000
#> SRR2050406     3  0.0000      0.785 0.000 0.000 1.000
#> SRR2050405     1  0.0000      0.903 1.000 0.000 0.000
#> SRR2050404     2  0.0000      1.000 0.000 1.000 0.000
#> SRR2050403     1  0.0000      0.903 1.000 0.000 0.000
#> SRR2050402     2  0.0000      1.000 0.000 1.000 0.000
#> SRR2050401     1  0.5529      0.480 0.704 0.000 0.296
#> SRR2050400     3  0.6280      0.384 0.460 0.000 0.540
#> SRR2050399     1  0.5968      0.311 0.636 0.364 0.000
#> SRR2050398     3  0.6008      0.578 0.372 0.000 0.628
#> SRR2050397     1  0.5138      0.585 0.748 0.000 0.252
#> SRR2050396     3  0.0000      0.785 0.000 0.000 1.000
#> SRR2050395     1  0.1643      0.889 0.956 0.000 0.044
#> SRR2050394     2  0.0000      1.000 0.000 1.000 0.000
#> SRR2050393     3  0.0000      0.785 0.000 0.000 1.000
#> SRR2050392     1  0.0000      0.903 1.000 0.000 0.000
#> SRR2050465     2  0.0000      1.000 0.000 1.000 0.000
#> SRR2050464     3  0.0000      0.785 0.000 0.000 1.000
#> SRR2050463     1  0.1411      0.892 0.964 0.000 0.036
#> SRR2050462     2  0.0000      1.000 0.000 1.000 0.000
#> SRR2050461     3  0.0000      0.785 0.000 0.000 1.000
#> SRR2050460     1  0.1643      0.889 0.956 0.000 0.044
#> SRR2050459     2  0.0000      1.000 0.000 1.000 0.000
#> SRR2050458     3  0.0000      0.785 0.000 0.000 1.000
#> SRR2050457     1  0.0000      0.903 1.000 0.000 0.000
#> SRR2050456     2  0.0000      1.000 0.000 1.000 0.000
#> SRR2050455     3  0.0000      0.785 0.000 0.000 1.000
#> SRR2050454     1  0.0000      0.903 1.000 0.000 0.000
#> SRR2050453     2  0.0000      1.000 0.000 1.000 0.000
#> SRR2050452     3  0.0000      0.785 0.000 0.000 1.000
#> SRR2050451     1  0.1643      0.889 0.956 0.000 0.044
#> SRR2050450     2  0.0000      1.000 0.000 1.000 0.000
#> SRR2050449     3  0.0000      0.785 0.000 0.000 1.000
#> SRR2050448     1  0.1643      0.889 0.956 0.000 0.044
#> SRR2050447     3  0.0000      0.785 0.000 0.000 1.000
#> SRR2050446     1  0.1643      0.889 0.956 0.000 0.044
#> SRR2050445     2  0.0000      1.000 0.000 1.000 0.000
#> SRR2050444     3  0.0000      0.785 0.000 0.000 1.000
#> SRR2050443     1  0.0000      0.903 1.000 0.000 0.000
#> SRR2050442     2  0.0000      1.000 0.000 1.000 0.000
#> SRR2050441     3  0.0000      0.785 0.000 0.000 1.000
#> SRR2050440     3  0.6008      0.578 0.372 0.000 0.628
#> SRR2050439     2  0.0000      1.000 0.000 1.000 0.000
#> SRR2050438     3  0.0000      0.785 0.000 0.000 1.000
#> SRR2050437     3  0.6008      0.578 0.372 0.000 0.628
#> SRR2050436     1  0.0237      0.901 0.996 0.004 0.000
#> SRR2050435     3  0.0000      0.785 0.000 0.000 1.000
#> SRR2050434     1  0.0237      0.901 0.996 0.004 0.000
#> SRR2050433     2  0.0000      1.000 0.000 1.000 0.000
#> SRR2050432     3  0.6008      0.578 0.372 0.000 0.628
#> SRR2050431     3  0.6305      0.312 0.484 0.000 0.516
#> SRR2050430     3  0.6260      0.416 0.448 0.000 0.552
#> SRR2050429     3  0.6026      0.571 0.376 0.000 0.624

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> SRR2050410     2  0.0000      0.999 0.000 1.000 0.000 0.000
#> SRR2050427     1  0.0188      0.843 0.996 0.000 0.004 0.000
#> SRR2050426     1  0.0188      0.843 0.996 0.000 0.004 0.000
#> SRR2050425     2  0.0188      0.997 0.000 0.996 0.000 0.004
#> SRR2050424     3  0.0000      1.000 0.000 0.000 1.000 0.000
#> SRR2050423     4  0.2216      0.790 0.092 0.000 0.000 0.908
#> SRR2050422     4  0.4454      0.635 0.308 0.000 0.000 0.692
#> SRR2050421     1  0.0188      0.843 0.996 0.000 0.004 0.000
#> SRR2050420     1  0.0188      0.843 0.996 0.000 0.004 0.000
#> SRR2050419     2  0.0000      0.999 0.000 1.000 0.000 0.000
#> SRR2050418     4  0.4543      0.613 0.324 0.000 0.000 0.676
#> SRR2050417     4  0.4522      0.620 0.320 0.000 0.000 0.680
#> SRR2050416     2  0.0000      0.999 0.000 1.000 0.000 0.000
#> SRR2050415     3  0.0000      1.000 0.000 0.000 1.000 0.000
#> SRR2050414     4  0.0188      0.785 0.004 0.000 0.000 0.996
#> SRR2050413     4  0.4891      0.628 0.308 0.012 0.000 0.680
#> SRR2050412     1  0.4624      0.437 0.660 0.000 0.000 0.340
#> SRR2050411     1  0.4804      0.312 0.616 0.000 0.000 0.384
#> SRR2050409     2  0.0000      0.999 0.000 1.000 0.000 0.000
#> SRR2050408     4  0.4522      0.620 0.320 0.000 0.000 0.680
#> SRR2050407     2  0.0000      0.999 0.000 1.000 0.000 0.000
#> SRR2050406     3  0.0000      1.000 0.000 0.000 1.000 0.000
#> SRR2050405     4  0.0188      0.785 0.004 0.000 0.000 0.996
#> SRR2050404     2  0.0000      0.999 0.000 1.000 0.000 0.000
#> SRR2050403     4  0.4522      0.620 0.320 0.000 0.000 0.680
#> SRR2050402     2  0.0000      0.999 0.000 1.000 0.000 0.000
#> SRR2050401     1  0.4624      0.437 0.660 0.000 0.000 0.340
#> SRR2050400     1  0.2149      0.801 0.912 0.000 0.000 0.088
#> SRR2050399     4  0.4889      0.467 0.004 0.360 0.000 0.636
#> SRR2050398     1  0.0188      0.843 0.996 0.000 0.004 0.000
#> SRR2050397     1  0.4804      0.312 0.616 0.000 0.000 0.384
#> SRR2050396     3  0.0000      1.000 0.000 0.000 1.000 0.000
#> SRR2050395     4  0.2216      0.790 0.092 0.000 0.000 0.908
#> SRR2050394     2  0.0000      0.999 0.000 1.000 0.000 0.000
#> SRR2050393     3  0.0000      1.000 0.000 0.000 1.000 0.000
#> SRR2050392     4  0.0188      0.785 0.004 0.000 0.000 0.996
#> SRR2050465     2  0.0000      0.999 0.000 1.000 0.000 0.000
#> SRR2050464     3  0.0000      1.000 0.000 0.000 1.000 0.000
#> SRR2050463     4  0.1940      0.792 0.076 0.000 0.000 0.924
#> SRR2050462     2  0.0000      0.999 0.000 1.000 0.000 0.000
#> SRR2050461     3  0.0000      1.000 0.000 0.000 1.000 0.000
#> SRR2050460     4  0.2216      0.790 0.092 0.000 0.000 0.908
#> SRR2050459     2  0.0000      0.999 0.000 1.000 0.000 0.000
#> SRR2050458     3  0.0000      1.000 0.000 0.000 1.000 0.000
#> SRR2050457     4  0.0188      0.785 0.004 0.000 0.000 0.996
#> SRR2050456     2  0.0000      0.999 0.000 1.000 0.000 0.000
#> SRR2050455     3  0.0000      1.000 0.000 0.000 1.000 0.000
#> SRR2050454     4  0.0188      0.785 0.004 0.000 0.000 0.996
#> SRR2050453     2  0.0000      0.999 0.000 1.000 0.000 0.000
#> SRR2050452     3  0.0000      1.000 0.000 0.000 1.000 0.000
#> SRR2050451     4  0.2216      0.790 0.092 0.000 0.000 0.908
#> SRR2050450     2  0.0000      0.999 0.000 1.000 0.000 0.000
#> SRR2050449     3  0.0000      1.000 0.000 0.000 1.000 0.000
#> SRR2050448     4  0.2216      0.790 0.092 0.000 0.000 0.908
#> SRR2050447     3  0.0000      1.000 0.000 0.000 1.000 0.000
#> SRR2050446     4  0.2216      0.790 0.092 0.000 0.000 0.908
#> SRR2050445     2  0.0000      0.999 0.000 1.000 0.000 0.000
#> SRR2050444     3  0.0000      1.000 0.000 0.000 1.000 0.000
#> SRR2050443     4  0.0188      0.785 0.004 0.000 0.000 0.996
#> SRR2050442     2  0.0188      0.997 0.000 0.996 0.000 0.004
#> SRR2050441     3  0.0000      1.000 0.000 0.000 1.000 0.000
#> SRR2050440     1  0.0188      0.843 0.996 0.000 0.004 0.000
#> SRR2050439     2  0.0188      0.997 0.000 0.996 0.000 0.004
#> SRR2050438     3  0.0000      1.000 0.000 0.000 1.000 0.000
#> SRR2050437     1  0.0188      0.843 0.996 0.000 0.004 0.000
#> SRR2050436     4  0.4454      0.635 0.308 0.000 0.000 0.692
#> SRR2050435     3  0.0000      1.000 0.000 0.000 1.000 0.000
#> SRR2050434     4  0.4454      0.635 0.308 0.000 0.000 0.692
#> SRR2050433     2  0.0000      0.999 0.000 1.000 0.000 0.000
#> SRR2050432     1  0.0188      0.843 0.996 0.000 0.004 0.000
#> SRR2050431     1  0.2530      0.781 0.888 0.000 0.000 0.112
#> SRR2050430     1  0.1940      0.807 0.924 0.000 0.000 0.076
#> SRR2050429     1  0.0188      0.842 0.996 0.000 0.000 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
#> SRR2050410     2  0.0000      0.999 0.000 1.000 0.000 0.000 0.000
#> SRR2050427     1  0.0162      0.824 0.996 0.000 0.004 0.000 0.000
#> SRR2050426     1  0.0162      0.824 0.996 0.000 0.004 0.000 0.000
#> SRR2050425     2  0.0162      0.996 0.000 0.996 0.000 0.000 0.004
#> SRR2050424     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000
#> SRR2050423     4  0.2588      0.828 0.060 0.000 0.000 0.892 0.048
#> SRR2050422     5  0.0000      0.668 0.000 0.000 0.000 0.000 1.000
#> SRR2050421     1  0.0451      0.825 0.988 0.000 0.004 0.000 0.008
#> SRR2050420     1  0.0451      0.825 0.988 0.000 0.004 0.000 0.008
#> SRR2050419     2  0.0000      0.999 0.000 1.000 0.000 0.000 0.000
#> SRR2050418     4  0.4862      0.452 0.032 0.000 0.000 0.604 0.364
#> SRR2050417     4  0.4787      0.460 0.028 0.000 0.000 0.608 0.364
#> SRR2050416     2  0.0000      0.999 0.000 1.000 0.000 0.000 0.000
#> SRR2050415     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000
#> SRR2050414     4  0.0000      0.818 0.000 0.000 0.000 1.000 0.000
#> SRR2050413     5  0.0404      0.665 0.000 0.012 0.000 0.000 0.988
#> SRR2050412     1  0.6756     -0.194 0.372 0.000 0.000 0.264 0.364
#> SRR2050411     5  0.6811      0.083 0.328 0.000 0.000 0.308 0.364
#> SRR2050409     2  0.0000      0.999 0.000 1.000 0.000 0.000 0.000
#> SRR2050408     4  0.4787      0.460 0.028 0.000 0.000 0.608 0.364
#> SRR2050407     2  0.0000      0.999 0.000 1.000 0.000 0.000 0.000
#> SRR2050406     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000
#> SRR2050405     4  0.0000      0.818 0.000 0.000 0.000 1.000 0.000
#> SRR2050404     2  0.0000      0.999 0.000 1.000 0.000 0.000 0.000
#> SRR2050403     4  0.4787      0.460 0.028 0.000 0.000 0.608 0.364
#> SRR2050402     2  0.0000      0.999 0.000 1.000 0.000 0.000 0.000
#> SRR2050401     1  0.6756     -0.194 0.372 0.000 0.000 0.264 0.364
#> SRR2050400     1  0.2136      0.760 0.904 0.000 0.000 0.088 0.008
#> SRR2050399     5  0.4060      0.224 0.000 0.360 0.000 0.000 0.640
#> SRR2050398     1  0.0451      0.825 0.988 0.000 0.004 0.000 0.008
#> SRR2050397     5  0.6811      0.083 0.328 0.000 0.000 0.308 0.364
#> SRR2050396     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000
#> SRR2050395     4  0.2588      0.828 0.060 0.000 0.000 0.892 0.048
#> SRR2050394     2  0.0000      0.999 0.000 1.000 0.000 0.000 0.000
#> SRR2050393     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000
#> SRR2050392     4  0.0000      0.818 0.000 0.000 0.000 1.000 0.000
#> SRR2050465     2  0.0000      0.999 0.000 1.000 0.000 0.000 0.000
#> SRR2050464     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000
#> SRR2050463     4  0.2304      0.829 0.044 0.000 0.000 0.908 0.048
#> SRR2050462     2  0.0000      0.999 0.000 1.000 0.000 0.000 0.000
#> SRR2050461     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000
#> SRR2050460     4  0.2588      0.828 0.060 0.000 0.000 0.892 0.048
#> SRR2050459     2  0.0000      0.999 0.000 1.000 0.000 0.000 0.000
#> SRR2050458     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000
#> SRR2050457     4  0.0162      0.815 0.004 0.000 0.000 0.996 0.000
#> SRR2050456     2  0.0000      0.999 0.000 1.000 0.000 0.000 0.000
#> SRR2050455     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000
#> SRR2050454     4  0.0000      0.818 0.000 0.000 0.000 1.000 0.000
#> SRR2050453     2  0.0000      0.999 0.000 1.000 0.000 0.000 0.000
#> SRR2050452     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000
#> SRR2050451     4  0.2588      0.828 0.060 0.000 0.000 0.892 0.048
#> SRR2050450     2  0.0000      0.999 0.000 1.000 0.000 0.000 0.000
#> SRR2050449     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000
#> SRR2050448     4  0.2588      0.828 0.060 0.000 0.000 0.892 0.048
#> SRR2050447     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000
#> SRR2050446     4  0.2588      0.828 0.060 0.000 0.000 0.892 0.048
#> SRR2050445     2  0.0000      0.999 0.000 1.000 0.000 0.000 0.000
#> SRR2050444     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000
#> SRR2050443     4  0.0000      0.818 0.000 0.000 0.000 1.000 0.000
#> SRR2050442     2  0.0162      0.996 0.000 0.996 0.000 0.000 0.004
#> SRR2050441     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000
#> SRR2050440     1  0.0162      0.824 0.996 0.000 0.004 0.000 0.000
#> SRR2050439     2  0.0162      0.996 0.000 0.996 0.000 0.000 0.004
#> SRR2050438     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000
#> SRR2050437     1  0.0162      0.824 0.996 0.000 0.004 0.000 0.000
#> SRR2050436     5  0.0000      0.668 0.000 0.000 0.000 0.000 1.000
#> SRR2050435     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000
#> SRR2050434     5  0.0000      0.668 0.000 0.000 0.000 0.000 1.000
#> SRR2050433     2  0.0000      0.999 0.000 1.000 0.000 0.000 0.000
#> SRR2050432     1  0.0451      0.825 0.988 0.000 0.004 0.000 0.008
#> SRR2050431     1  0.3146      0.713 0.856 0.000 0.000 0.092 0.052
#> SRR2050430     1  0.3942      0.563 0.748 0.000 0.000 0.020 0.232
#> SRR2050429     1  0.0162      0.823 0.996 0.000 0.000 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
#> SRR2050410     2  0.0000      0.997 0.000 1.000  0 0.000 0.000 0.000
#> SRR2050427     1  0.0000      0.874 1.000 0.000  0 0.000 0.000 0.000
#> SRR2050426     1  0.0000      0.874 1.000 0.000  0 0.000 0.000 0.000
#> SRR2050425     2  0.0458      0.985 0.000 0.984  0 0.000 0.000 0.016
#> SRR2050424     3  0.0000      1.000 0.000 0.000  1 0.000 0.000 0.000
#> SRR2050423     4  0.0260      0.849 0.008 0.000  0 0.992 0.000 0.000
#> SRR2050422     5  0.0000      0.870 0.000 0.000  0 0.000 1.000 0.000
#> SRR2050421     1  0.0972      0.882 0.964 0.000  0 0.008 0.000 0.028
#> SRR2050420     1  0.0858      0.882 0.968 0.000  0 0.004 0.000 0.028
#> SRR2050419     2  0.0000      0.997 0.000 1.000  0 0.000 0.000 0.000
#> SRR2050418     6  0.3807      0.590 0.004 0.000  0 0.368 0.000 0.628
#> SRR2050417     6  0.3684      0.586 0.000 0.000  0 0.372 0.000 0.628
#> SRR2050416     2  0.0000      0.997 0.000 1.000  0 0.000 0.000 0.000
#> SRR2050415     3  0.0000      1.000 0.000 0.000  1 0.000 0.000 0.000
#> SRR2050414     4  0.2631      0.815 0.000 0.000  0 0.820 0.000 0.180
#> SRR2050413     5  0.0458      0.865 0.000 0.000  0 0.000 0.984 0.016
#> SRR2050412     6  0.5492      0.561 0.244 0.000  0 0.192 0.000 0.564
#> SRR2050411     6  0.5501      0.630 0.200 0.000  0 0.236 0.000 0.564
#> SRR2050409     2  0.0000      0.997 0.000 1.000  0 0.000 0.000 0.000
#> SRR2050408     6  0.3684      0.586 0.000 0.000  0 0.372 0.000 0.628
#> SRR2050407     2  0.0000      0.997 0.000 1.000  0 0.000 0.000 0.000
#> SRR2050406     3  0.0000      1.000 0.000 0.000  1 0.000 0.000 0.000
#> SRR2050405     4  0.1863      0.839 0.000 0.000  0 0.896 0.000 0.104
#> SRR2050404     2  0.0000      0.997 0.000 1.000  0 0.000 0.000 0.000
#> SRR2050403     6  0.3684      0.586 0.000 0.000  0 0.372 0.000 0.628
#> SRR2050402     2  0.0000      0.997 0.000 1.000  0 0.000 0.000 0.000
#> SRR2050401     6  0.5492      0.561 0.244 0.000  0 0.192 0.000 0.564
#> SRR2050400     1  0.3796      0.772 0.776 0.000  0 0.140 0.000 0.084
#> SRR2050399     5  0.4026      0.455 0.000 0.348  0 0.000 0.636 0.016
#> SRR2050398     1  0.0972      0.882 0.964 0.000  0 0.008 0.000 0.028
#> SRR2050397     6  0.5501      0.630 0.200 0.000  0 0.236 0.000 0.564
#> SRR2050396     3  0.0000      1.000 0.000 0.000  1 0.000 0.000 0.000
#> SRR2050395     4  0.0260      0.849 0.008 0.000  0 0.992 0.000 0.000
#> SRR2050394     2  0.0000      0.997 0.000 1.000  0 0.000 0.000 0.000
#> SRR2050393     3  0.0000      1.000 0.000 0.000  1 0.000 0.000 0.000
#> SRR2050392     4  0.2631      0.815 0.000 0.000  0 0.820 0.000 0.180
#> SRR2050465     2  0.0000      0.997 0.000 1.000  0 0.000 0.000 0.000
#> SRR2050464     3  0.0000      1.000 0.000 0.000  1 0.000 0.000 0.000
#> SRR2050463     4  0.1007      0.845 0.000 0.000  0 0.956 0.000 0.044
#> SRR2050462     2  0.0000      0.997 0.000 1.000  0 0.000 0.000 0.000
#> SRR2050461     3  0.0000      1.000 0.000 0.000  1 0.000 0.000 0.000
#> SRR2050460     4  0.0260      0.849 0.008 0.000  0 0.992 0.000 0.000
#> SRR2050459     2  0.0000      0.997 0.000 1.000  0 0.000 0.000 0.000
#> SRR2050458     3  0.0000      1.000 0.000 0.000  1 0.000 0.000 0.000
#> SRR2050457     4  0.3797      0.570 0.000 0.000  0 0.580 0.000 0.420
#> SRR2050456     2  0.0000      0.997 0.000 1.000  0 0.000 0.000 0.000
#> SRR2050455     3  0.0000      1.000 0.000 0.000  1 0.000 0.000 0.000
#> SRR2050454     4  0.2631      0.815 0.000 0.000  0 0.820 0.000 0.180
#> SRR2050453     2  0.0000      0.997 0.000 1.000  0 0.000 0.000 0.000
#> SRR2050452     3  0.0000      1.000 0.000 0.000  1 0.000 0.000 0.000
#> SRR2050451     4  0.0260      0.849 0.008 0.000  0 0.992 0.000 0.000
#> SRR2050450     2  0.0000      0.997 0.000 1.000  0 0.000 0.000 0.000
#> SRR2050449     3  0.0000      1.000 0.000 0.000  1 0.000 0.000 0.000
#> SRR2050448     4  0.0260      0.849 0.008 0.000  0 0.992 0.000 0.000
#> SRR2050447     3  0.0000      1.000 0.000 0.000  1 0.000 0.000 0.000
#> SRR2050446     4  0.0260      0.849 0.008 0.000  0 0.992 0.000 0.000
#> SRR2050445     2  0.0000      0.997 0.000 1.000  0 0.000 0.000 0.000
#> SRR2050444     3  0.0000      1.000 0.000 0.000  1 0.000 0.000 0.000
#> SRR2050443     4  0.2631      0.815 0.000 0.000  0 0.820 0.000 0.180
#> SRR2050442     2  0.0458      0.985 0.000 0.984  0 0.000 0.000 0.016
#> SRR2050441     3  0.0000      1.000 0.000 0.000  1 0.000 0.000 0.000
#> SRR2050440     1  0.1713      0.874 0.928 0.000  0 0.028 0.000 0.044
#> SRR2050439     2  0.0458      0.985 0.000 0.984  0 0.000 0.000 0.016
#> SRR2050438     3  0.0000      1.000 0.000 0.000  1 0.000 0.000 0.000
#> SRR2050437     1  0.1713      0.874 0.928 0.000  0 0.028 0.000 0.044
#> SRR2050436     5  0.0000      0.870 0.000 0.000  0 0.000 1.000 0.000
#> SRR2050435     3  0.0000      1.000 0.000 0.000  1 0.000 0.000 0.000
#> SRR2050434     5  0.0000      0.870 0.000 0.000  0 0.000 1.000 0.000
#> SRR2050433     2  0.0000      0.997 0.000 1.000  0 0.000 0.000 0.000
#> SRR2050432     1  0.0972      0.882 0.964 0.000  0 0.008 0.000 0.028
#> SRR2050431     1  0.3978      0.702 0.744 0.000  0 0.192 0.000 0.064
#> SRR2050430     1  0.4810      0.477 0.624 0.000  0 0.084 0.000 0.292
#> SRR2050429     1  0.2197      0.862 0.900 0.000  0 0.044 0.000 0.056

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

consensus_heatmap(res, k = 2)

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

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

collect_plots(res)

plot of chunk ATC-kmeans-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.597           0.804       0.893         0.4778 0.501   0.501
#> 3 3 1.000           0.994       0.997         0.3193 0.615   0.387
#> 4 4 0.817           0.802       0.868         0.1632 0.870   0.650
#> 5 5 0.772           0.804       0.862         0.0685 0.917   0.691
#> 6 6 0.798           0.754       0.822         0.0388 0.970   0.863

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
#> SRR2050410     2   0.991      0.784 0.444 0.556
#> SRR2050427     1   0.991      1.000 0.556 0.444
#> SRR2050426     1   0.991      1.000 0.556 0.444
#> SRR2050425     2   0.991      0.784 0.444 0.556
#> SRR2050424     1   0.991      1.000 0.556 0.444
#> SRR2050423     1   0.991      1.000 0.556 0.444
#> SRR2050422     2   0.000      0.512 0.000 1.000
#> SRR2050421     1   0.991      1.000 0.556 0.444
#> SRR2050420     1   0.991      1.000 0.556 0.444
#> SRR2050419     2   0.991      0.784 0.444 0.556
#> SRR2050418     2   0.000      0.512 0.000 1.000
#> SRR2050417     2   0.714      0.680 0.196 0.804
#> SRR2050416     2   0.991      0.784 0.444 0.556
#> SRR2050415     1   0.991      1.000 0.556 0.444
#> SRR2050414     2   0.000      0.512 0.000 1.000
#> SRR2050413     2   0.991      0.784 0.444 0.556
#> SRR2050412     1   0.991      1.000 0.556 0.444
#> SRR2050411     2   0.000      0.512 0.000 1.000
#> SRR2050409     2   0.991      0.784 0.444 0.556
#> SRR2050408     2   0.000      0.512 0.000 1.000
#> SRR2050407     2   0.991      0.784 0.444 0.556
#> SRR2050406     1   0.991      1.000 0.556 0.444
#> SRR2050405     2   0.000      0.512 0.000 1.000
#> SRR2050404     2   0.991      0.784 0.444 0.556
#> SRR2050403     2   0.000      0.512 0.000 1.000
#> SRR2050402     2   0.991      0.784 0.444 0.556
#> SRR2050401     1   0.991      1.000 0.556 0.444
#> SRR2050400     1   0.991      1.000 0.556 0.444
#> SRR2050399     2   0.991      0.784 0.444 0.556
#> SRR2050398     1   0.991      1.000 0.556 0.444
#> SRR2050397     2   0.000      0.512 0.000 1.000
#> SRR2050396     1   0.991      1.000 0.556 0.444
#> SRR2050395     2   0.904     -0.555 0.320 0.680
#> SRR2050394     2   0.991      0.784 0.444 0.556
#> SRR2050393     1   0.991      1.000 0.556 0.444
#> SRR2050392     2   0.991      0.784 0.444 0.556
#> SRR2050465     2   0.991      0.784 0.444 0.556
#> SRR2050464     1   0.991      1.000 0.556 0.444
#> SRR2050463     2   0.000      0.512 0.000 1.000
#> SRR2050462     2   0.991      0.784 0.444 0.556
#> SRR2050461     1   0.991      1.000 0.556 0.444
#> SRR2050460     1   0.991      1.000 0.556 0.444
#> SRR2050459     2   0.991      0.784 0.444 0.556
#> SRR2050458     1   0.991      1.000 0.556 0.444
#> SRR2050457     2   0.000      0.512 0.000 1.000
#> SRR2050456     2   0.991      0.784 0.444 0.556
#> SRR2050455     1   0.991      1.000 0.556 0.444
#> SRR2050454     2   0.634      0.655 0.160 0.840
#> SRR2050453     2   0.991      0.784 0.444 0.556
#> SRR2050452     1   0.991      1.000 0.556 0.444
#> SRR2050451     2   0.000      0.512 0.000 1.000
#> SRR2050450     2   0.991      0.784 0.444 0.556
#> SRR2050449     1   0.991      1.000 0.556 0.444
#> SRR2050448     2   0.000      0.512 0.000 1.000
#> SRR2050447     1   0.991      1.000 0.556 0.444
#> SRR2050446     2   0.000      0.512 0.000 1.000
#> SRR2050445     2   0.991      0.784 0.444 0.556
#> SRR2050444     1   0.991      1.000 0.556 0.444
#> SRR2050443     2   0.000      0.512 0.000 1.000
#> SRR2050442     2   0.991      0.784 0.444 0.556
#> SRR2050441     1   0.991      1.000 0.556 0.444
#> SRR2050440     1   0.991      1.000 0.556 0.444
#> SRR2050439     2   0.991      0.784 0.444 0.556
#> SRR2050438     1   0.991      1.000 0.556 0.444
#> SRR2050437     1   0.991      1.000 0.556 0.444
#> SRR2050436     2   0.808      0.709 0.248 0.752
#> SRR2050435     1   0.991      1.000 0.556 0.444
#> SRR2050434     2   0.921      0.748 0.336 0.664
#> SRR2050433     2   0.991      0.784 0.444 0.556
#> SRR2050432     1   0.991      1.000 0.556 0.444
#> SRR2050431     1   0.991      1.000 0.556 0.444
#> SRR2050430     1   0.991      1.000 0.556 0.444
#> SRR2050429     1   0.991      1.000 0.556 0.444

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>            class entropy silhouette    p1    p2    p3
#> SRR2050410     2   0.000      1.000 0.000 1.000 0.000
#> SRR2050427     1   0.263      0.908 0.916 0.000 0.084
#> SRR2050426     1   0.000      0.994 1.000 0.000 0.000
#> SRR2050425     2   0.000      1.000 0.000 1.000 0.000
#> SRR2050424     3   0.000      1.000 0.000 0.000 1.000
#> SRR2050423     1   0.000      0.994 1.000 0.000 0.000
#> SRR2050422     1   0.000      0.994 1.000 0.000 0.000
#> SRR2050421     1   0.000      0.994 1.000 0.000 0.000
#> SRR2050420     1   0.000      0.994 1.000 0.000 0.000
#> SRR2050419     2   0.000      1.000 0.000 1.000 0.000
#> SRR2050418     1   0.000      0.994 1.000 0.000 0.000
#> SRR2050417     1   0.000      0.994 1.000 0.000 0.000
#> SRR2050416     2   0.000      1.000 0.000 1.000 0.000
#> SRR2050415     3   0.000      1.000 0.000 0.000 1.000
#> SRR2050414     1   0.000      0.994 1.000 0.000 0.000
#> SRR2050413     1   0.348      0.854 0.872 0.128 0.000
#> SRR2050412     1   0.000      0.994 1.000 0.000 0.000
#> SRR2050411     1   0.000      0.994 1.000 0.000 0.000
#> SRR2050409     2   0.000      1.000 0.000 1.000 0.000
#> SRR2050408     1   0.000      0.994 1.000 0.000 0.000
#> SRR2050407     2   0.000      1.000 0.000 1.000 0.000
#> SRR2050406     3   0.000      1.000 0.000 0.000 1.000
#> SRR2050405     1   0.000      0.994 1.000 0.000 0.000
#> SRR2050404     2   0.000      1.000 0.000 1.000 0.000
#> SRR2050403     1   0.000      0.994 1.000 0.000 0.000
#> SRR2050402     2   0.000      1.000 0.000 1.000 0.000
#> SRR2050401     1   0.000      0.994 1.000 0.000 0.000
#> SRR2050400     1   0.000      0.994 1.000 0.000 0.000
#> SRR2050399     2   0.000      1.000 0.000 1.000 0.000
#> SRR2050398     1   0.000      0.994 1.000 0.000 0.000
#> SRR2050397     1   0.000      0.994 1.000 0.000 0.000
#> SRR2050396     3   0.000      1.000 0.000 0.000 1.000
#> SRR2050395     1   0.000      0.994 1.000 0.000 0.000
#> SRR2050394     2   0.000      1.000 0.000 1.000 0.000
#> SRR2050393     3   0.000      1.000 0.000 0.000 1.000
#> SRR2050392     1   0.000      0.994 1.000 0.000 0.000
#> SRR2050465     2   0.000      1.000 0.000 1.000 0.000
#> SRR2050464     3   0.000      1.000 0.000 0.000 1.000
#> SRR2050463     1   0.000      0.994 1.000 0.000 0.000
#> SRR2050462     2   0.000      1.000 0.000 1.000 0.000
#> SRR2050461     3   0.000      1.000 0.000 0.000 1.000
#> SRR2050460     1   0.000      0.994 1.000 0.000 0.000
#> SRR2050459     2   0.000      1.000 0.000 1.000 0.000
#> SRR2050458     3   0.000      1.000 0.000 0.000 1.000
#> SRR2050457     1   0.000      0.994 1.000 0.000 0.000
#> SRR2050456     2   0.000      1.000 0.000 1.000 0.000
#> SRR2050455     3   0.000      1.000 0.000 0.000 1.000
#> SRR2050454     1   0.000      0.994 1.000 0.000 0.000
#> SRR2050453     2   0.000      1.000 0.000 1.000 0.000
#> SRR2050452     3   0.000      1.000 0.000 0.000 1.000
#> SRR2050451     1   0.000      0.994 1.000 0.000 0.000
#> SRR2050450     2   0.000      1.000 0.000 1.000 0.000
#> SRR2050449     3   0.000      1.000 0.000 0.000 1.000
#> SRR2050448     1   0.000      0.994 1.000 0.000 0.000
#> SRR2050447     3   0.000      1.000 0.000 0.000 1.000
#> SRR2050446     1   0.000      0.994 1.000 0.000 0.000
#> SRR2050445     2   0.000      1.000 0.000 1.000 0.000
#> SRR2050444     3   0.000      1.000 0.000 0.000 1.000
#> SRR2050443     1   0.000      0.994 1.000 0.000 0.000
#> SRR2050442     2   0.000      1.000 0.000 1.000 0.000
#> SRR2050441     3   0.000      1.000 0.000 0.000 1.000
#> SRR2050440     1   0.000      0.994 1.000 0.000 0.000
#> SRR2050439     2   0.000      1.000 0.000 1.000 0.000
#> SRR2050438     3   0.000      1.000 0.000 0.000 1.000
#> SRR2050437     1   0.000      0.994 1.000 0.000 0.000
#> SRR2050436     1   0.000      0.994 1.000 0.000 0.000
#> SRR2050435     3   0.000      1.000 0.000 0.000 1.000
#> SRR2050434     1   0.000      0.994 1.000 0.000 0.000
#> SRR2050433     2   0.000      1.000 0.000 1.000 0.000
#> SRR2050432     1   0.000      0.994 1.000 0.000 0.000
#> SRR2050431     1   0.000      0.994 1.000 0.000 0.000
#> SRR2050430     1   0.000      0.994 1.000 0.000 0.000
#> SRR2050429     1   0.000      0.994 1.000 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> SRR2050410     2  0.0000      0.946 0.000 1.000 0.000 0.000
#> SRR2050427     1  0.0000      0.816 1.000 0.000 0.000 0.000
#> SRR2050426     1  0.0000      0.816 1.000 0.000 0.000 0.000
#> SRR2050425     2  0.0000      0.946 0.000 1.000 0.000 0.000
#> SRR2050424     3  0.1211      0.979 0.000 0.000 0.960 0.040
#> SRR2050423     4  0.4643      0.835 0.344 0.000 0.000 0.656
#> SRR2050422     4  0.3610      0.726 0.200 0.000 0.000 0.800
#> SRR2050421     1  0.0000      0.816 1.000 0.000 0.000 0.000
#> SRR2050420     1  0.0000      0.816 1.000 0.000 0.000 0.000
#> SRR2050419     2  0.0000      0.946 0.000 1.000 0.000 0.000
#> SRR2050418     1  0.4955     -0.289 0.556 0.000 0.000 0.444
#> SRR2050417     4  0.4985      0.555 0.468 0.000 0.000 0.532
#> SRR2050416     2  0.3649      0.845 0.000 0.796 0.000 0.204
#> SRR2050415     3  0.1211      0.979 0.000 0.000 0.960 0.040
#> SRR2050414     4  0.4643      0.835 0.344 0.000 0.000 0.656
#> SRR2050413     4  0.1890      0.616 0.056 0.008 0.000 0.936
#> SRR2050412     1  0.0000      0.816 1.000 0.000 0.000 0.000
#> SRR2050411     1  0.4877     -0.140 0.592 0.000 0.000 0.408
#> SRR2050409     2  0.0000      0.946 0.000 1.000 0.000 0.000
#> SRR2050408     1  0.4955     -0.289 0.556 0.000 0.000 0.444
#> SRR2050407     2  0.0000      0.946 0.000 1.000 0.000 0.000
#> SRR2050406     3  0.0817      0.978 0.000 0.000 0.976 0.024
#> SRR2050405     4  0.4643      0.835 0.344 0.000 0.000 0.656
#> SRR2050404     2  0.0000      0.946 0.000 1.000 0.000 0.000
#> SRR2050403     1  0.4730      0.060 0.636 0.000 0.000 0.364
#> SRR2050402     2  0.3726      0.840 0.000 0.788 0.000 0.212
#> SRR2050401     1  0.0000      0.816 1.000 0.000 0.000 0.000
#> SRR2050400     1  0.0000      0.816 1.000 0.000 0.000 0.000
#> SRR2050399     2  0.4250      0.798 0.000 0.724 0.000 0.276
#> SRR2050398     1  0.0000      0.816 1.000 0.000 0.000 0.000
#> SRR2050397     1  0.4730      0.060 0.636 0.000 0.000 0.364
#> SRR2050396     3  0.0592      0.980 0.000 0.000 0.984 0.016
#> SRR2050395     4  0.4643      0.835 0.344 0.000 0.000 0.656
#> SRR2050394     2  0.0000      0.946 0.000 1.000 0.000 0.000
#> SRR2050393     3  0.0817      0.978 0.000 0.000 0.976 0.024
#> SRR2050392     4  0.2011      0.636 0.080 0.000 0.000 0.920
#> SRR2050465     2  0.0000      0.946 0.000 1.000 0.000 0.000
#> SRR2050464     3  0.0000      0.982 0.000 0.000 1.000 0.000
#> SRR2050463     4  0.4643      0.835 0.344 0.000 0.000 0.656
#> SRR2050462     2  0.0000      0.946 0.000 1.000 0.000 0.000
#> SRR2050461     3  0.1118      0.979 0.000 0.000 0.964 0.036
#> SRR2050460     4  0.4643      0.835 0.344 0.000 0.000 0.656
#> SRR2050459     2  0.0000      0.946 0.000 1.000 0.000 0.000
#> SRR2050458     3  0.0592      0.980 0.000 0.000 0.984 0.016
#> SRR2050457     4  0.4643      0.835 0.344 0.000 0.000 0.656
#> SRR2050456     2  0.0000      0.946 0.000 1.000 0.000 0.000
#> SRR2050455     3  0.0817      0.978 0.000 0.000 0.976 0.024
#> SRR2050454     4  0.4643      0.835 0.344 0.000 0.000 0.656
#> SRR2050453     2  0.0000      0.946 0.000 1.000 0.000 0.000
#> SRR2050452     3  0.0592      0.980 0.000 0.000 0.984 0.016
#> SRR2050451     4  0.4643      0.835 0.344 0.000 0.000 0.656
#> SRR2050450     2  0.0000      0.946 0.000 1.000 0.000 0.000
#> SRR2050449     3  0.0000      0.982 0.000 0.000 1.000 0.000
#> SRR2050448     4  0.4643      0.835 0.344 0.000 0.000 0.656
#> SRR2050447     3  0.1118      0.979 0.000 0.000 0.964 0.036
#> SRR2050446     4  0.4643      0.835 0.344 0.000 0.000 0.656
#> SRR2050445     2  0.0000      0.946 0.000 1.000 0.000 0.000
#> SRR2050444     3  0.0469      0.981 0.000 0.000 0.988 0.012
#> SRR2050443     4  0.4643      0.835 0.344 0.000 0.000 0.656
#> SRR2050442     2  0.4103      0.812 0.000 0.744 0.000 0.256
#> SRR2050441     3  0.1211      0.979 0.000 0.000 0.960 0.040
#> SRR2050440     1  0.0707      0.804 0.980 0.000 0.000 0.020
#> SRR2050439     2  0.4164      0.807 0.000 0.736 0.000 0.264
#> SRR2050438     3  0.1211      0.979 0.000 0.000 0.960 0.040
#> SRR2050437     1  0.0707      0.804 0.980 0.000 0.000 0.020
#> SRR2050436     4  0.1716      0.625 0.064 0.000 0.000 0.936
#> SRR2050435     3  0.1211      0.979 0.000 0.000 0.960 0.040
#> SRR2050434     4  0.1716      0.625 0.064 0.000 0.000 0.936
#> SRR2050433     2  0.0000      0.946 0.000 1.000 0.000 0.000
#> SRR2050432     1  0.0000      0.816 1.000 0.000 0.000 0.000
#> SRR2050431     1  0.0592      0.805 0.984 0.000 0.000 0.016
#> SRR2050430     1  0.0188      0.813 0.996 0.000 0.000 0.004
#> SRR2050429     1  0.0188      0.813 0.996 0.000 0.000 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
#> SRR2050410     2  0.0794      0.879 0.028 0.972 0.000 0.000 0.000
#> SRR2050427     1  0.2389      0.931 0.880 0.000 0.004 0.116 0.000
#> SRR2050426     1  0.2280      0.934 0.880 0.000 0.000 0.120 0.000
#> SRR2050425     2  0.2054      0.848 0.052 0.920 0.000 0.000 0.028
#> SRR2050424     3  0.2563      0.925 0.008 0.000 0.872 0.000 0.120
#> SRR2050423     4  0.0510      0.802 0.000 0.000 0.000 0.984 0.016
#> SRR2050422     5  0.4974      0.547 0.032 0.000 0.000 0.408 0.560
#> SRR2050421     1  0.2280      0.934 0.880 0.000 0.000 0.120 0.000
#> SRR2050420     1  0.2280      0.934 0.880 0.000 0.000 0.120 0.000
#> SRR2050419     2  0.0510      0.881 0.016 0.984 0.000 0.000 0.000
#> SRR2050418     4  0.5233      0.611 0.192 0.000 0.000 0.680 0.128
#> SRR2050417     4  0.3921      0.699 0.072 0.000 0.000 0.800 0.128
#> SRR2050416     2  0.4963      0.481 0.040 0.608 0.000 0.000 0.352
#> SRR2050415     3  0.2563      0.925 0.008 0.000 0.872 0.000 0.120
#> SRR2050414     4  0.0000      0.807 0.000 0.000 0.000 1.000 0.000
#> SRR2050413     5  0.4173      0.694 0.012 0.000 0.000 0.300 0.688
#> SRR2050412     1  0.2674      0.929 0.868 0.000 0.000 0.120 0.012
#> SRR2050411     4  0.5295      0.603 0.200 0.000 0.000 0.672 0.128
#> SRR2050409     2  0.0794      0.879 0.028 0.972 0.000 0.000 0.000
#> SRR2050408     4  0.5233      0.611 0.192 0.000 0.000 0.680 0.128
#> SRR2050407     2  0.0510      0.881 0.016 0.984 0.000 0.000 0.000
#> SRR2050406     3  0.1502      0.920 0.004 0.000 0.940 0.000 0.056
#> SRR2050405     4  0.0000      0.807 0.000 0.000 0.000 1.000 0.000
#> SRR2050404     2  0.0290      0.882 0.008 0.992 0.000 0.000 0.000
#> SRR2050403     4  0.5720      0.500 0.268 0.000 0.000 0.604 0.128
#> SRR2050402     2  0.5002      0.487 0.044 0.612 0.000 0.000 0.344
#> SRR2050401     1  0.3888      0.892 0.804 0.000 0.000 0.120 0.076
#> SRR2050400     1  0.4002      0.917 0.796 0.000 0.000 0.120 0.084
#> SRR2050399     5  0.5232     -0.304 0.044 0.456 0.000 0.000 0.500
#> SRR2050398     1  0.2280      0.934 0.880 0.000 0.000 0.120 0.000
#> SRR2050397     4  0.5720      0.500 0.268 0.000 0.000 0.604 0.128
#> SRR2050396     3  0.0162      0.937 0.000 0.000 0.996 0.000 0.004
#> SRR2050395     4  0.0000      0.807 0.000 0.000 0.000 1.000 0.000
#> SRR2050394     2  0.0794      0.879 0.028 0.972 0.000 0.000 0.000
#> SRR2050393     3  0.1502      0.920 0.004 0.000 0.940 0.000 0.056
#> SRR2050392     4  0.1992      0.704 0.032 0.000 0.000 0.924 0.044
#> SRR2050465     2  0.0290      0.882 0.008 0.992 0.000 0.000 0.000
#> SRR2050464     3  0.0000      0.938 0.000 0.000 1.000 0.000 0.000
#> SRR2050463     4  0.0963      0.793 0.000 0.000 0.000 0.964 0.036
#> SRR2050462     2  0.0290      0.882 0.008 0.992 0.000 0.000 0.000
#> SRR2050461     3  0.2358      0.928 0.008 0.000 0.888 0.000 0.104
#> SRR2050460     4  0.1608      0.773 0.000 0.000 0.000 0.928 0.072
#> SRR2050459     2  0.0290      0.882 0.008 0.992 0.000 0.000 0.000
#> SRR2050458     3  0.0963      0.928 0.000 0.000 0.964 0.000 0.036
#> SRR2050457     4  0.0000      0.807 0.000 0.000 0.000 1.000 0.000
#> SRR2050456     2  0.0510      0.881 0.016 0.984 0.000 0.000 0.000
#> SRR2050455     3  0.1502      0.920 0.004 0.000 0.940 0.000 0.056
#> SRR2050454     4  0.0000      0.807 0.000 0.000 0.000 1.000 0.000
#> SRR2050453     2  0.0290      0.882 0.008 0.992 0.000 0.000 0.000
#> SRR2050452     3  0.0162      0.937 0.000 0.000 0.996 0.000 0.004
#> SRR2050451     4  0.1341      0.782 0.000 0.000 0.000 0.944 0.056
#> SRR2050450     2  0.0290      0.882 0.008 0.992 0.000 0.000 0.000
#> SRR2050449     3  0.0000      0.938 0.000 0.000 1.000 0.000 0.000
#> SRR2050448     4  0.1341      0.782 0.000 0.000 0.000 0.944 0.056
#> SRR2050447     3  0.2358      0.928 0.008 0.000 0.888 0.000 0.104
#> SRR2050446     4  0.1341      0.782 0.000 0.000 0.000 0.944 0.056
#> SRR2050445     2  0.0510      0.881 0.016 0.984 0.000 0.000 0.000
#> SRR2050444     3  0.0162      0.937 0.000 0.000 0.996 0.000 0.004
#> SRR2050443     4  0.0000      0.807 0.000 0.000 0.000 1.000 0.000
#> SRR2050442     2  0.4977      0.474 0.040 0.604 0.000 0.000 0.356
#> SRR2050441     3  0.2563      0.925 0.008 0.000 0.872 0.000 0.120
#> SRR2050440     1  0.4300      0.869 0.772 0.000 0.000 0.096 0.132
#> SRR2050439     2  0.5077      0.398 0.040 0.568 0.000 0.000 0.392
#> SRR2050438     3  0.2563      0.925 0.008 0.000 0.872 0.000 0.120
#> SRR2050437     1  0.4300      0.869 0.772 0.000 0.000 0.096 0.132
#> SRR2050436     5  0.4584      0.699 0.028 0.000 0.000 0.312 0.660
#> SRR2050435     3  0.2563      0.925 0.008 0.000 0.872 0.000 0.120
#> SRR2050434     5  0.4671      0.693 0.028 0.000 0.000 0.332 0.640
#> SRR2050433     2  0.1965      0.851 0.052 0.924 0.000 0.000 0.024
#> SRR2050432     1  0.2280      0.934 0.880 0.000 0.000 0.120 0.000
#> SRR2050431     1  0.4357      0.905 0.768 0.000 0.000 0.128 0.104
#> SRR2050430     1  0.4064      0.894 0.792 0.000 0.000 0.092 0.116
#> SRR2050429     1  0.4496      0.877 0.752 0.000 0.000 0.092 0.156

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>            class entropy silhouette    p1    p2    p3    p4    p5 p6
#> SRR2050410     2  0.2094      0.890 0.016 0.908 0.000 0.000 0.008 NA
#> SRR2050427     1  0.1296      0.896 0.948 0.000 0.000 0.044 0.004 NA
#> SRR2050426     1  0.1296      0.896 0.948 0.000 0.000 0.044 0.004 NA
#> SRR2050425     2  0.3535      0.635 0.012 0.760 0.000 0.000 0.220 NA
#> SRR2050424     3  0.1718      0.862 0.016 0.000 0.932 0.000 0.044 NA
#> SRR2050423     4  0.1765      0.760 0.000 0.000 0.000 0.924 0.024 NA
#> SRR2050422     5  0.5715      0.404 0.004 0.000 0.000 0.208 0.544 NA
#> SRR2050421     1  0.1007      0.896 0.956 0.000 0.000 0.044 0.000 NA
#> SRR2050420     1  0.1296      0.896 0.948 0.000 0.000 0.044 0.004 NA
#> SRR2050419     2  0.1411      0.896 0.004 0.936 0.000 0.000 0.000 NA
#> SRR2050418     4  0.5888      0.476 0.200 0.000 0.000 0.492 0.004 NA
#> SRR2050417     4  0.4704      0.603 0.060 0.000 0.000 0.632 0.004 NA
#> SRR2050416     5  0.3997      0.213 0.004 0.488 0.000 0.000 0.508 NA
#> SRR2050415     3  0.1718      0.862 0.016 0.000 0.932 0.000 0.044 NA
#> SRR2050414     4  0.0000      0.781 0.000 0.000 0.000 1.000 0.000 NA
#> SRR2050413     5  0.4849      0.503 0.000 0.000 0.000 0.148 0.664 NA
#> SRR2050412     1  0.1863      0.881 0.920 0.000 0.000 0.044 0.000 NA
#> SRR2050411     4  0.5898      0.472 0.200 0.000 0.000 0.488 0.004 NA
#> SRR2050409     2  0.2094      0.890 0.016 0.908 0.000 0.000 0.008 NA
#> SRR2050408     4  0.5857      0.480 0.192 0.000 0.000 0.496 0.004 NA
#> SRR2050407     2  0.1411      0.896 0.004 0.936 0.000 0.000 0.000 NA
#> SRR2050406     3  0.3840      0.839 0.000 0.000 0.696 0.000 0.020 NA
#> SRR2050405     4  0.0000      0.781 0.000 0.000 0.000 1.000 0.000 NA
#> SRR2050404     2  0.0881      0.897 0.008 0.972 0.000 0.000 0.012 NA
#> SRR2050403     4  0.6053      0.408 0.236 0.000 0.000 0.452 0.004 NA
#> SRR2050402     5  0.4602      0.214 0.004 0.484 0.000 0.000 0.484 NA
#> SRR2050401     1  0.3885      0.744 0.736 0.000 0.000 0.044 0.000 NA
#> SRR2050400     1  0.3710      0.878 0.820 0.000 0.000 0.044 0.060 NA
#> SRR2050399     5  0.4067      0.484 0.000 0.260 0.000 0.000 0.700 NA
#> SRR2050398     1  0.1007      0.896 0.956 0.000 0.000 0.044 0.000 NA
#> SRR2050397     4  0.6053      0.408 0.236 0.000 0.000 0.452 0.004 NA
#> SRR2050396     3  0.2778      0.882 0.000 0.000 0.824 0.000 0.008 NA
#> SRR2050395     4  0.0000      0.781 0.000 0.000 0.000 1.000 0.000 NA
#> SRR2050394     2  0.1838      0.892 0.016 0.916 0.000 0.000 0.000 NA
#> SRR2050393     3  0.3950      0.838 0.000 0.000 0.696 0.000 0.028 NA
#> SRR2050392     4  0.0935      0.759 0.000 0.000 0.000 0.964 0.032 NA
#> SRR2050465     2  0.0881      0.897 0.008 0.972 0.000 0.000 0.012 NA
#> SRR2050464     3  0.2416      0.885 0.000 0.000 0.844 0.000 0.000 NA
#> SRR2050463     4  0.1649      0.767 0.000 0.000 0.000 0.932 0.032 NA
#> SRR2050462     2  0.0881      0.897 0.008 0.972 0.000 0.000 0.012 NA
#> SRR2050461     3  0.0603      0.871 0.000 0.000 0.980 0.000 0.016 NA
#> SRR2050460     4  0.2629      0.739 0.000 0.000 0.000 0.872 0.068 NA
#> SRR2050459     2  0.0881      0.897 0.008 0.972 0.000 0.000 0.012 NA
#> SRR2050458     3  0.3231      0.871 0.000 0.000 0.784 0.000 0.016 NA
#> SRR2050457     4  0.1003      0.776 0.000 0.000 0.000 0.964 0.020 NA
#> SRR2050456     2  0.1411      0.896 0.004 0.936 0.000 0.000 0.000 NA
#> SRR2050455     3  0.3840      0.839 0.000 0.000 0.696 0.000 0.020 NA
#> SRR2050454     4  0.0146      0.781 0.000 0.000 0.000 0.996 0.000 NA
#> SRR2050453     2  0.0881      0.897 0.008 0.972 0.000 0.000 0.012 NA
#> SRR2050452     3  0.2814      0.882 0.000 0.000 0.820 0.000 0.008 NA
#> SRR2050451     4  0.1930      0.763 0.000 0.000 0.000 0.916 0.048 NA
#> SRR2050450     2  0.0665      0.898 0.008 0.980 0.000 0.000 0.004 NA
#> SRR2050449     3  0.2416      0.885 0.000 0.000 0.844 0.000 0.000 NA
#> SRR2050448     4  0.1930      0.763 0.000 0.000 0.000 0.916 0.048 NA
#> SRR2050447     3  0.0603      0.871 0.000 0.000 0.980 0.000 0.016 NA
#> SRR2050446     4  0.1930      0.763 0.000 0.000 0.000 0.916 0.048 NA
#> SRR2050445     2  0.1411      0.896 0.004 0.936 0.000 0.000 0.000 NA
#> SRR2050444     3  0.2841      0.884 0.000 0.000 0.824 0.000 0.012 NA
#> SRR2050443     4  0.0000      0.781 0.000 0.000 0.000 1.000 0.000 NA
#> SRR2050442     5  0.3851      0.259 0.000 0.460 0.000 0.000 0.540 NA
#> SRR2050441     3  0.1649      0.863 0.016 0.000 0.936 0.000 0.040 NA
#> SRR2050440     1  0.4775      0.831 0.732 0.000 0.000 0.044 0.104 NA
#> SRR2050439     5  0.3727      0.379 0.000 0.388 0.000 0.000 0.612 NA
#> SRR2050438     3  0.1718      0.862 0.016 0.000 0.932 0.000 0.044 NA
#> SRR2050437     1  0.4775      0.831 0.732 0.000 0.000 0.044 0.104 NA
#> SRR2050436     5  0.5243      0.465 0.004 0.000 0.000 0.164 0.624 NA
#> SRR2050435     3  0.1718      0.862 0.016 0.000 0.932 0.000 0.044 NA
#> SRR2050434     5  0.5461      0.446 0.004 0.000 0.000 0.196 0.592 NA
#> SRR2050433     2  0.3329      0.632 0.004 0.768 0.000 0.000 0.220 NA
#> SRR2050432     1  0.1007      0.896 0.956 0.000 0.000 0.044 0.000 NA
#> SRR2050431     1  0.4606      0.849 0.748 0.000 0.000 0.044 0.100 NA
#> SRR2050430     1  0.4528      0.850 0.752 0.000 0.000 0.040 0.088 NA
#> SRR2050429     1  0.5144      0.815 0.680 0.000 0.000 0.040 0.088 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-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 15040 rows and 73 columns.
#>   Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'ATC' method.
#>   Subgroups are detected by 'skmeans' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 6.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

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

collect_plots(res)

plot of chunk ATC-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.929       0.974         0.5071 0.493   0.493
#> 3 3 0.743           0.740       0.823         0.2751 0.750   0.533
#> 4 4 0.983           0.944       0.975         0.1399 0.882   0.664
#> 5 5 0.891           0.889       0.923         0.0483 0.959   0.844
#> 6 6 0.907           0.848       0.909         0.0329 0.971   0.875

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

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

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

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

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

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>            class entropy silhouette    p1    p2
#> SRR2050410     2   0.000     0.9884 0.000 1.000
#> SRR2050427     1   0.000     0.9571 1.000 0.000
#> SRR2050426     1   0.000     0.9571 1.000 0.000
#> SRR2050425     2   0.000     0.9884 0.000 1.000
#> SRR2050424     1   0.000     0.9571 1.000 0.000
#> SRR2050423     1   0.000     0.9571 1.000 0.000
#> SRR2050422     2   0.000     0.9884 0.000 1.000
#> SRR2050421     1   0.000     0.9571 1.000 0.000
#> SRR2050420     1   0.000     0.9571 1.000 0.000
#> SRR2050419     2   0.000     0.9884 0.000 1.000
#> SRR2050418     2   0.000     0.9884 0.000 1.000
#> SRR2050417     2   0.000     0.9884 0.000 1.000
#> SRR2050416     2   0.000     0.9884 0.000 1.000
#> SRR2050415     1   0.000     0.9571 1.000 0.000
#> SRR2050414     2   0.000     0.9884 0.000 1.000
#> SRR2050413     2   0.000     0.9884 0.000 1.000
#> SRR2050412     1   0.000     0.9571 1.000 0.000
#> SRR2050411     2   0.917     0.4657 0.332 0.668
#> SRR2050409     2   0.000     0.9884 0.000 1.000
#> SRR2050408     2   0.000     0.9884 0.000 1.000
#> SRR2050407     2   0.000     0.9884 0.000 1.000
#> SRR2050406     1   0.000     0.9571 1.000 0.000
#> SRR2050405     2   0.000     0.9884 0.000 1.000
#> SRR2050404     2   0.000     0.9884 0.000 1.000
#> SRR2050403     1   0.999     0.0911 0.520 0.480
#> SRR2050402     2   0.000     0.9884 0.000 1.000
#> SRR2050401     1   0.000     0.9571 1.000 0.000
#> SRR2050400     1   0.000     0.9571 1.000 0.000
#> SRR2050399     2   0.000     0.9884 0.000 1.000
#> SRR2050398     1   0.000     0.9571 1.000 0.000
#> SRR2050397     1   0.327     0.9010 0.940 0.060
#> SRR2050396     1   0.000     0.9571 1.000 0.000
#> SRR2050395     1   0.000     0.9571 1.000 0.000
#> SRR2050394     2   0.000     0.9884 0.000 1.000
#> SRR2050393     1   0.000     0.9571 1.000 0.000
#> SRR2050392     2   0.000     0.9884 0.000 1.000
#> SRR2050465     2   0.000     0.9884 0.000 1.000
#> SRR2050464     1   0.000     0.9571 1.000 0.000
#> SRR2050463     2   0.118     0.9742 0.016 0.984
#> SRR2050462     2   0.000     0.9884 0.000 1.000
#> SRR2050461     1   0.000     0.9571 1.000 0.000
#> SRR2050460     1   0.000     0.9571 1.000 0.000
#> SRR2050459     2   0.000     0.9884 0.000 1.000
#> SRR2050458     1   0.000     0.9571 1.000 0.000
#> SRR2050457     1   0.995     0.1711 0.540 0.460
#> SRR2050456     2   0.000     0.9884 0.000 1.000
#> SRR2050455     1   0.000     0.9571 1.000 0.000
#> SRR2050454     2   0.000     0.9884 0.000 1.000
#> SRR2050453     2   0.000     0.9884 0.000 1.000
#> SRR2050452     1   0.000     0.9571 1.000 0.000
#> SRR2050451     1   1.000     0.0307 0.500 0.500
#> SRR2050450     2   0.000     0.9884 0.000 1.000
#> SRR2050449     1   0.000     0.9571 1.000 0.000
#> SRR2050448     2   0.118     0.9742 0.016 0.984
#> SRR2050447     1   0.000     0.9571 1.000 0.000
#> SRR2050446     2   0.118     0.9742 0.016 0.984
#> SRR2050445     2   0.000     0.9884 0.000 1.000
#> SRR2050444     1   0.000     0.9571 1.000 0.000
#> SRR2050443     2   0.000     0.9884 0.000 1.000
#> SRR2050442     2   0.000     0.9884 0.000 1.000
#> SRR2050441     1   0.000     0.9571 1.000 0.000
#> SRR2050440     1   0.000     0.9571 1.000 0.000
#> SRR2050439     2   0.000     0.9884 0.000 1.000
#> SRR2050438     1   0.000     0.9571 1.000 0.000
#> SRR2050437     1   0.000     0.9571 1.000 0.000
#> SRR2050436     2   0.000     0.9884 0.000 1.000
#> SRR2050435     1   0.000     0.9571 1.000 0.000
#> SRR2050434     2   0.000     0.9884 0.000 1.000
#> SRR2050433     2   0.000     0.9884 0.000 1.000
#> SRR2050432     1   0.000     0.9571 1.000 0.000
#> SRR2050431     1   0.000     0.9571 1.000 0.000
#> SRR2050430     1   0.000     0.9571 1.000 0.000
#> SRR2050429     1   0.000     0.9571 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
#> SRR2050410     2  0.0000     0.9489 0.000 1.000 0.000
#> SRR2050427     1  0.6095     0.6020 0.608 0.000 0.392
#> SRR2050426     1  0.6095     0.6020 0.608 0.000 0.392
#> SRR2050425     2  0.0000     0.9489 0.000 1.000 0.000
#> SRR2050424     3  0.0000     0.8981 0.000 0.000 1.000
#> SRR2050423     3  0.0000     0.8981 0.000 0.000 1.000
#> SRR2050422     1  0.6286     0.2376 0.536 0.464 0.000
#> SRR2050421     1  0.6095     0.6020 0.608 0.000 0.392
#> SRR2050420     1  0.6095     0.6020 0.608 0.000 0.392
#> SRR2050419     2  0.0000     0.9489 0.000 1.000 0.000
#> SRR2050418     1  0.5948     0.4106 0.640 0.360 0.000
#> SRR2050417     1  0.6286     0.2036 0.536 0.464 0.000
#> SRR2050416     2  0.0000     0.9489 0.000 1.000 0.000
#> SRR2050415     3  0.0000     0.8981 0.000 0.000 1.000
#> SRR2050414     2  0.6095     0.5152 0.392 0.608 0.000
#> SRR2050413     2  0.0000     0.9489 0.000 1.000 0.000
#> SRR2050412     1  0.6095     0.6020 0.608 0.000 0.392
#> SRR2050411     1  0.5948     0.4106 0.640 0.360 0.000
#> SRR2050409     2  0.0000     0.9489 0.000 1.000 0.000
#> SRR2050408     1  0.5948     0.4106 0.640 0.360 0.000
#> SRR2050407     2  0.0000     0.9489 0.000 1.000 0.000
#> SRR2050406     3  0.0000     0.8981 0.000 0.000 1.000
#> SRR2050405     2  0.6095     0.5152 0.392 0.608 0.000
#> SRR2050404     2  0.0000     0.9489 0.000 1.000 0.000
#> SRR2050403     1  0.6148     0.4166 0.640 0.356 0.004
#> SRR2050402     2  0.0000     0.9489 0.000 1.000 0.000
#> SRR2050401     1  0.6095     0.6020 0.608 0.000 0.392
#> SRR2050400     1  0.6095     0.6020 0.608 0.000 0.392
#> SRR2050399     2  0.0000     0.9489 0.000 1.000 0.000
#> SRR2050398     1  0.6095     0.6020 0.608 0.000 0.392
#> SRR2050397     1  0.6931     0.5909 0.640 0.032 0.328
#> SRR2050396     3  0.0000     0.8981 0.000 0.000 1.000
#> SRR2050395     3  0.6095     0.5065 0.392 0.000 0.608
#> SRR2050394     2  0.0000     0.9489 0.000 1.000 0.000
#> SRR2050393     3  0.0000     0.8981 0.000 0.000 1.000
#> SRR2050392     2  0.0237     0.9455 0.004 0.996 0.000
#> SRR2050465     2  0.0000     0.9489 0.000 1.000 0.000
#> SRR2050464     3  0.0000     0.8981 0.000 0.000 1.000
#> SRR2050463     1  0.9919    -0.0737 0.392 0.324 0.284
#> SRR2050462     2  0.0000     0.9489 0.000 1.000 0.000
#> SRR2050461     3  0.0000     0.8981 0.000 0.000 1.000
#> SRR2050460     3  0.5948     0.5383 0.360 0.000 0.640
#> SRR2050459     2  0.0000     0.9489 0.000 1.000 0.000
#> SRR2050458     3  0.0000     0.8981 0.000 0.000 1.000
#> SRR2050457     3  0.6095     0.5065 0.392 0.000 0.608
#> SRR2050456     2  0.0000     0.9489 0.000 1.000 0.000
#> SRR2050455     3  0.0000     0.8981 0.000 0.000 1.000
#> SRR2050454     2  0.1411     0.9162 0.036 0.964 0.000
#> SRR2050453     2  0.0000     0.9489 0.000 1.000 0.000
#> SRR2050452     3  0.0000     0.8981 0.000 0.000 1.000
#> SRR2050451     3  0.6095     0.5065 0.392 0.000 0.608
#> SRR2050450     2  0.0000     0.9489 0.000 1.000 0.000
#> SRR2050449     3  0.0000     0.8981 0.000 0.000 1.000
#> SRR2050448     1  0.9919    -0.0737 0.392 0.324 0.284
#> SRR2050447     3  0.0000     0.8981 0.000 0.000 1.000
#> SRR2050446     1  0.9919    -0.0737 0.392 0.324 0.284
#> SRR2050445     2  0.0000     0.9489 0.000 1.000 0.000
#> SRR2050444     3  0.0000     0.8981 0.000 0.000 1.000
#> SRR2050443     2  0.6095     0.5152 0.392 0.608 0.000
#> SRR2050442     2  0.0000     0.9489 0.000 1.000 0.000
#> SRR2050441     3  0.0000     0.8981 0.000 0.000 1.000
#> SRR2050440     3  0.0000     0.8981 0.000 0.000 1.000
#> SRR2050439     2  0.0000     0.9489 0.000 1.000 0.000
#> SRR2050438     3  0.0000     0.8981 0.000 0.000 1.000
#> SRR2050437     3  0.0000     0.8981 0.000 0.000 1.000
#> SRR2050436     2  0.0000     0.9489 0.000 1.000 0.000
#> SRR2050435     3  0.0000     0.8981 0.000 0.000 1.000
#> SRR2050434     2  0.0000     0.9489 0.000 1.000 0.000
#> SRR2050433     2  0.0000     0.9489 0.000 1.000 0.000
#> SRR2050432     1  0.6095     0.6020 0.608 0.000 0.392
#> SRR2050431     1  0.6095     0.6020 0.608 0.000 0.392
#> SRR2050430     1  0.6095     0.6020 0.608 0.000 0.392
#> SRR2050429     1  0.6095     0.6020 0.608 0.000 0.392

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> SRR2050410     2  0.0000      0.986 0.000 1.000 0.000 0.000
#> SRR2050427     1  0.1716      0.920 0.936 0.000 0.064 0.000
#> SRR2050426     1  0.1716      0.920 0.936 0.000 0.064 0.000
#> SRR2050425     2  0.0000      0.986 0.000 1.000 0.000 0.000
#> SRR2050424     3  0.0000      0.998 0.000 0.000 1.000 0.000
#> SRR2050423     3  0.1022      0.967 0.000 0.000 0.968 0.032
#> SRR2050422     2  0.0817      0.961 0.024 0.976 0.000 0.000
#> SRR2050421     1  0.1557      0.924 0.944 0.000 0.056 0.000
#> SRR2050420     1  0.1557      0.924 0.944 0.000 0.056 0.000
#> SRR2050419     2  0.0000      0.986 0.000 1.000 0.000 0.000
#> SRR2050418     1  0.2973      0.799 0.856 0.144 0.000 0.000
#> SRR2050417     1  0.4643      0.483 0.656 0.344 0.000 0.000
#> SRR2050416     2  0.0000      0.986 0.000 1.000 0.000 0.000
#> SRR2050415     3  0.0000      0.998 0.000 0.000 1.000 0.000
#> SRR2050414     4  0.0000      0.953 0.000 0.000 0.000 1.000
#> SRR2050413     2  0.0000      0.986 0.000 1.000 0.000 0.000
#> SRR2050412     1  0.1118      0.926 0.964 0.000 0.036 0.000
#> SRR2050411     1  0.0000      0.921 1.000 0.000 0.000 0.000
#> SRR2050409     2  0.0000      0.986 0.000 1.000 0.000 0.000
#> SRR2050408     1  0.2760      0.816 0.872 0.128 0.000 0.000
#> SRR2050407     2  0.0000      0.986 0.000 1.000 0.000 0.000
#> SRR2050406     3  0.0000      0.998 0.000 0.000 1.000 0.000
#> SRR2050405     4  0.0000      0.953 0.000 0.000 0.000 1.000
#> SRR2050404     2  0.0000      0.986 0.000 1.000 0.000 0.000
#> SRR2050403     1  0.0000      0.921 1.000 0.000 0.000 0.000
#> SRR2050402     2  0.0000      0.986 0.000 1.000 0.000 0.000
#> SRR2050401     1  0.0000      0.921 1.000 0.000 0.000 0.000
#> SRR2050400     1  0.0000      0.921 1.000 0.000 0.000 0.000
#> SRR2050399     2  0.0000      0.986 0.000 1.000 0.000 0.000
#> SRR2050398     1  0.1557      0.924 0.944 0.000 0.056 0.000
#> SRR2050397     1  0.0000      0.921 1.000 0.000 0.000 0.000
#> SRR2050396     3  0.0000      0.998 0.000 0.000 1.000 0.000
#> SRR2050395     4  0.0000      0.953 0.000 0.000 0.000 1.000
#> SRR2050394     2  0.0000      0.986 0.000 1.000 0.000 0.000
#> SRR2050393     3  0.0000      0.998 0.000 0.000 1.000 0.000
#> SRR2050392     2  0.4331      0.571 0.000 0.712 0.000 0.288
#> SRR2050465     2  0.0000      0.986 0.000 1.000 0.000 0.000
#> SRR2050464     3  0.0000      0.998 0.000 0.000 1.000 0.000
#> SRR2050463     4  0.0000      0.953 0.000 0.000 0.000 1.000
#> SRR2050462     2  0.0000      0.986 0.000 1.000 0.000 0.000
#> SRR2050461     3  0.0000      0.998 0.000 0.000 1.000 0.000
#> SRR2050460     4  0.0000      0.953 0.000 0.000 0.000 1.000
#> SRR2050459     2  0.0000      0.986 0.000 1.000 0.000 0.000
#> SRR2050458     3  0.0000      0.998 0.000 0.000 1.000 0.000
#> SRR2050457     4  0.0000      0.953 0.000 0.000 0.000 1.000
#> SRR2050456     2  0.0000      0.986 0.000 1.000 0.000 0.000
#> SRR2050455     3  0.0000      0.998 0.000 0.000 1.000 0.000
#> SRR2050454     4  0.4830      0.323 0.000 0.392 0.000 0.608
#> SRR2050453     2  0.0000      0.986 0.000 1.000 0.000 0.000
#> SRR2050452     3  0.0000      0.998 0.000 0.000 1.000 0.000
#> SRR2050451     4  0.0000      0.953 0.000 0.000 0.000 1.000
#> SRR2050450     2  0.0000      0.986 0.000 1.000 0.000 0.000
#> SRR2050449     3  0.0000      0.998 0.000 0.000 1.000 0.000
#> SRR2050448     4  0.0000      0.953 0.000 0.000 0.000 1.000
#> SRR2050447     3  0.0000      0.998 0.000 0.000 1.000 0.000
#> SRR2050446     4  0.0000      0.953 0.000 0.000 0.000 1.000
#> SRR2050445     2  0.0000      0.986 0.000 1.000 0.000 0.000
#> SRR2050444     3  0.0000      0.998 0.000 0.000 1.000 0.000
#> SRR2050443     4  0.0000      0.953 0.000 0.000 0.000 1.000
#> SRR2050442     2  0.0000      0.986 0.000 1.000 0.000 0.000
#> SRR2050441     3  0.0000      0.998 0.000 0.000 1.000 0.000
#> SRR2050440     3  0.0000      0.998 0.000 0.000 1.000 0.000
#> SRR2050439     2  0.0000      0.986 0.000 1.000 0.000 0.000
#> SRR2050438     3  0.0000      0.998 0.000 0.000 1.000 0.000
#> SRR2050437     3  0.0000      0.998 0.000 0.000 1.000 0.000
#> SRR2050436     2  0.0000      0.986 0.000 1.000 0.000 0.000
#> SRR2050435     3  0.0000      0.998 0.000 0.000 1.000 0.000
#> SRR2050434     2  0.0000      0.986 0.000 1.000 0.000 0.000
#> SRR2050433     2  0.0000      0.986 0.000 1.000 0.000 0.000
#> SRR2050432     1  0.1557      0.924 0.944 0.000 0.056 0.000
#> SRR2050431     1  0.1637      0.922 0.940 0.000 0.060 0.000
#> SRR2050430     1  0.1211      0.926 0.960 0.000 0.040 0.000
#> SRR2050429     1  0.0000      0.921 1.000 0.000 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>            class entropy silhouette    p1    p2    p3    p4    p5
#> SRR2050410     2  0.0000     0.9718 0.000 1.000 0.000 0.000 0.000
#> SRR2050427     1  0.0162     0.8374 0.996 0.000 0.004 0.000 0.000
#> SRR2050426     1  0.0162     0.8374 0.996 0.000 0.004 0.000 0.000
#> SRR2050425     2  0.0000     0.9718 0.000 1.000 0.000 0.000 0.000
#> SRR2050424     3  0.0000     0.9689 0.000 0.000 1.000 0.000 0.000
#> SRR2050423     3  0.2773     0.7998 0.000 0.000 0.836 0.164 0.000
#> SRR2050422     1  0.7646     0.0927 0.372 0.336 0.000 0.052 0.240
#> SRR2050421     1  0.0162     0.8374 0.996 0.000 0.004 0.000 0.000
#> SRR2050420     1  0.0162     0.8374 0.996 0.000 0.004 0.000 0.000
#> SRR2050419     2  0.0000     0.9718 0.000 1.000 0.000 0.000 0.000
#> SRR2050418     5  0.4114     0.9442 0.272 0.016 0.000 0.000 0.712
#> SRR2050417     5  0.4411     0.8575 0.196 0.024 0.000 0.024 0.756
#> SRR2050416     2  0.0000     0.9718 0.000 1.000 0.000 0.000 0.000
#> SRR2050415     3  0.0000     0.9689 0.000 0.000 1.000 0.000 0.000
#> SRR2050414     4  0.1518     0.8996 0.004 0.004 0.000 0.944 0.048
#> SRR2050413     2  0.2813     0.8417 0.000 0.832 0.000 0.000 0.168
#> SRR2050412     1  0.2338     0.7051 0.884 0.000 0.004 0.000 0.112
#> SRR2050411     5  0.3730     0.9550 0.288 0.000 0.000 0.000 0.712
#> SRR2050409     2  0.0000     0.9718 0.000 1.000 0.000 0.000 0.000
#> SRR2050408     5  0.3636     0.9500 0.272 0.000 0.000 0.000 0.728
#> SRR2050407     2  0.0000     0.9718 0.000 1.000 0.000 0.000 0.000
#> SRR2050406     3  0.0000     0.9689 0.000 0.000 1.000 0.000 0.000
#> SRR2050405     4  0.1357     0.9013 0.004 0.000 0.000 0.948 0.048
#> SRR2050404     2  0.0000     0.9718 0.000 1.000 0.000 0.000 0.000
#> SRR2050403     5  0.3730     0.9550 0.288 0.000 0.000 0.000 0.712
#> SRR2050402     2  0.0000     0.9718 0.000 1.000 0.000 0.000 0.000
#> SRR2050401     1  0.3999     0.0708 0.656 0.000 0.000 0.000 0.344
#> SRR2050400     1  0.0162     0.8349 0.996 0.000 0.000 0.000 0.004
#> SRR2050399     2  0.0162     0.9694 0.000 0.996 0.000 0.000 0.004
#> SRR2050398     1  0.0865     0.8194 0.972 0.000 0.004 0.000 0.024
#> SRR2050397     5  0.3730     0.9550 0.288 0.000 0.000 0.000 0.712
#> SRR2050396     3  0.0000     0.9689 0.000 0.000 1.000 0.000 0.000
#> SRR2050395     4  0.1357     0.9013 0.004 0.000 0.000 0.948 0.048
#> SRR2050394     2  0.0000     0.9718 0.000 1.000 0.000 0.000 0.000
#> SRR2050393     3  0.0000     0.9689 0.000 0.000 1.000 0.000 0.000
#> SRR2050392     2  0.2747     0.8727 0.004 0.888 0.000 0.060 0.048
#> SRR2050465     2  0.0000     0.9718 0.000 1.000 0.000 0.000 0.000
#> SRR2050464     3  0.0000     0.9689 0.000 0.000 1.000 0.000 0.000
#> SRR2050463     4  0.1270     0.9099 0.000 0.000 0.000 0.948 0.052
#> SRR2050462     2  0.0000     0.9718 0.000 1.000 0.000 0.000 0.000
#> SRR2050461     3  0.0000     0.9689 0.000 0.000 1.000 0.000 0.000
#> SRR2050460     4  0.1270     0.9099 0.000 0.000 0.000 0.948 0.052
#> SRR2050459     2  0.0000     0.9718 0.000 1.000 0.000 0.000 0.000
#> SRR2050458     3  0.0000     0.9689 0.000 0.000 1.000 0.000 0.000
#> SRR2050457     4  0.0000     0.9091 0.000 0.000 0.000 1.000 0.000
#> SRR2050456     2  0.0000     0.9718 0.000 1.000 0.000 0.000 0.000
#> SRR2050455     3  0.0000     0.9689 0.000 0.000 1.000 0.000 0.000
#> SRR2050454     4  0.5124     0.4799 0.004 0.320 0.000 0.628 0.048
#> SRR2050453     2  0.0000     0.9718 0.000 1.000 0.000 0.000 0.000
#> SRR2050452     3  0.0000     0.9689 0.000 0.000 1.000 0.000 0.000
#> SRR2050451     4  0.1270     0.9099 0.000 0.000 0.000 0.948 0.052
#> SRR2050450     2  0.0000     0.9718 0.000 1.000 0.000 0.000 0.000
#> SRR2050449     3  0.0000     0.9689 0.000 0.000 1.000 0.000 0.000
#> SRR2050448     4  0.1270     0.9099 0.000 0.000 0.000 0.948 0.052
#> SRR2050447     3  0.0000     0.9689 0.000 0.000 1.000 0.000 0.000
#> SRR2050446     4  0.1270     0.9099 0.000 0.000 0.000 0.948 0.052
#> SRR2050445     2  0.0000     0.9718 0.000 1.000 0.000 0.000 0.000
#> SRR2050444     3  0.0000     0.9689 0.000 0.000 1.000 0.000 0.000
#> SRR2050443     4  0.1357     0.9013 0.004 0.000 0.000 0.948 0.048
#> SRR2050442     2  0.0000     0.9718 0.000 1.000 0.000 0.000 0.000
#> SRR2050441     3  0.0000     0.9689 0.000 0.000 1.000 0.000 0.000
#> SRR2050440     3  0.2773     0.8502 0.112 0.000 0.868 0.000 0.020
#> SRR2050439     2  0.0000     0.9718 0.000 1.000 0.000 0.000 0.000
#> SRR2050438     3  0.0000     0.9689 0.000 0.000 1.000 0.000 0.000
#> SRR2050437     3  0.3821     0.7177 0.216 0.000 0.764 0.000 0.020
#> SRR2050436     2  0.3994     0.7791 0.040 0.772 0.000 0.000 0.188
#> SRR2050435     3  0.0000     0.9689 0.000 0.000 1.000 0.000 0.000
#> SRR2050434     2  0.3003     0.8231 0.000 0.812 0.000 0.000 0.188
#> SRR2050433     2  0.0000     0.9718 0.000 1.000 0.000 0.000 0.000
#> SRR2050432     1  0.0162     0.8374 0.996 0.000 0.004 0.000 0.000
#> SRR2050431     1  0.0671     0.8279 0.980 0.000 0.004 0.000 0.016
#> SRR2050430     1  0.0771     0.8246 0.976 0.000 0.004 0.000 0.020
#> SRR2050429     1  0.2377     0.7207 0.872 0.000 0.000 0.000 0.128

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>            class entropy silhouette    p1    p2    p3    p4    p5    p6
#> SRR2050410     2  0.0000     0.9312 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2050427     1  0.0000     0.9451 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2050426     1  0.0000     0.9451 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2050425     2  0.0000     0.9312 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2050424     3  0.0000     0.9624 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2050423     3  0.3157     0.8194 0.016 0.000 0.848 0.048 0.088 0.000
#> SRR2050422     5  0.6892     0.2603 0.124 0.004 0.000 0.388 0.392 0.092
#> SRR2050421     1  0.0000     0.9451 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2050420     1  0.0000     0.9451 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2050419     2  0.0000     0.9312 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2050418     6  0.1714     0.9949 0.092 0.000 0.000 0.000 0.000 0.908
#> SRR2050417     6  0.2002     0.9745 0.076 0.012 0.000 0.004 0.000 0.908
#> SRR2050416     2  0.0000     0.9312 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2050415     3  0.0000     0.9624 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2050414     4  0.3945     0.6754 0.000 0.008 0.000 0.612 0.380 0.000
#> SRR2050413     2  0.5009     0.4081 0.000 0.536 0.000 0.388 0.000 0.076
#> SRR2050412     1  0.2260     0.8029 0.860 0.000 0.000 0.000 0.000 0.140
#> SRR2050411     6  0.1714     0.9949 0.092 0.000 0.000 0.000 0.000 0.908
#> SRR2050409     2  0.0000     0.9312 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2050408     6  0.1714     0.9949 0.092 0.000 0.000 0.000 0.000 0.908
#> SRR2050407     2  0.0000     0.9312 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2050406     3  0.0000     0.9624 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2050405     4  0.3727     0.6744 0.000 0.000 0.000 0.612 0.388 0.000
#> SRR2050404     2  0.0000     0.9312 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2050403     6  0.1714     0.9949 0.092 0.000 0.000 0.000 0.000 0.908
#> SRR2050402     2  0.0000     0.9312 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2050401     1  0.3409     0.5304 0.700 0.000 0.000 0.000 0.000 0.300
#> SRR2050400     1  0.0000     0.9451 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2050399     2  0.0000     0.9312 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2050398     1  0.0000     0.9451 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2050397     6  0.1714     0.9949 0.092 0.000 0.000 0.000 0.000 0.908
#> SRR2050396     3  0.0000     0.9624 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2050395     4  0.3727     0.6744 0.000 0.000 0.000 0.612 0.388 0.000
#> SRR2050394     2  0.0000     0.9312 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2050393     3  0.0000     0.9624 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2050392     4  0.3727     0.3570 0.000 0.388 0.000 0.612 0.000 0.000
#> SRR2050465     2  0.0000     0.9312 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2050464     3  0.0000     0.9624 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2050463     5  0.0000     0.7768 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR2050462     2  0.0000     0.9312 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2050461     3  0.0000     0.9624 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2050460     5  0.0000     0.7768 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR2050459     2  0.0000     0.9312 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2050458     3  0.0000     0.9624 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2050457     5  0.3515     0.0588 0.000 0.000 0.000 0.324 0.676 0.000
#> SRR2050456     2  0.0000     0.9312 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2050455     3  0.0000     0.9624 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2050454     4  0.5227     0.5510 0.000 0.188 0.000 0.612 0.200 0.000
#> SRR2050453     2  0.0000     0.9312 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2050452     3  0.0000     0.9624 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2050451     5  0.0000     0.7768 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR2050450     2  0.0000     0.9312 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2050449     3  0.0000     0.9624 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2050448     5  0.0000     0.7768 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR2050447     3  0.0000     0.9624 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2050446     5  0.0000     0.7768 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR2050445     2  0.0000     0.9312 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2050444     3  0.0000     0.9624 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2050443     4  0.3727     0.6744 0.000 0.000 0.000 0.612 0.388 0.000
#> SRR2050442     2  0.0000     0.9312 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2050441     3  0.0000     0.9624 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2050440     3  0.3071     0.7728 0.180 0.000 0.804 0.000 0.000 0.016
#> SRR2050439     2  0.0000     0.9312 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2050438     3  0.0000     0.9624 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2050437     3  0.3717     0.6336 0.276 0.000 0.708 0.000 0.000 0.016
#> SRR2050436     2  0.5173     0.3858 0.000 0.520 0.000 0.388 0.000 0.092
#> SRR2050435     3  0.0000     0.9624 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2050434     2  0.5173     0.3858 0.000 0.520 0.000 0.388 0.000 0.092
#> SRR2050433     2  0.0000     0.9312 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2050432     1  0.0000     0.9451 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2050431     1  0.0260     0.9401 0.992 0.000 0.000 0.000 0.000 0.008
#> SRR2050430     1  0.0458     0.9336 0.984 0.000 0.000 0.000 0.000 0.016
#> SRR2050429     1  0.1327     0.9072 0.936 0.000 0.000 0.000 0.000 0.064

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

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

collect_plots(res)

plot of chunk ATC-pam-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 1.000           0.965       0.982         0.4057 0.597   0.597
#> 3 3 1.000           0.987       0.994         0.5581 0.674   0.496
#> 4 4 0.938           0.909       0.962         0.1879 0.877   0.670
#> 5 5 1.000           0.968       0.981         0.0582 0.937   0.755
#> 6 6 1.000           0.960       0.987         0.0323 0.968   0.845

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

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

There is also optional best \(k\) = 2 3 4 5 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
#> SRR2050410     2  0.0000      0.982 0.000 1.000
#> SRR2050427     1  0.0000      0.980 1.000 0.000
#> SRR2050426     1  0.9491      0.387 0.632 0.368
#> SRR2050425     2  0.0000      0.982 0.000 1.000
#> SRR2050424     1  0.0000      0.980 1.000 0.000
#> SRR2050423     2  0.0938      0.984 0.012 0.988
#> SRR2050422     2  0.0938      0.984 0.012 0.988
#> SRR2050421     2  0.8207      0.672 0.256 0.744
#> SRR2050420     2  0.0938      0.984 0.012 0.988
#> SRR2050419     2  0.0000      0.982 0.000 1.000
#> SRR2050418     2  0.0938      0.984 0.012 0.988
#> SRR2050417     2  0.0938      0.984 0.012 0.988
#> SRR2050416     2  0.0000      0.982 0.000 1.000
#> SRR2050415     1  0.0000      0.980 1.000 0.000
#> SRR2050414     2  0.0938      0.984 0.012 0.988
#> SRR2050413     2  0.0000      0.982 0.000 1.000
#> SRR2050412     2  0.0938      0.984 0.012 0.988
#> SRR2050411     2  0.0938      0.984 0.012 0.988
#> SRR2050409     2  0.0000      0.982 0.000 1.000
#> SRR2050408     2  0.0938      0.984 0.012 0.988
#> SRR2050407     2  0.0000      0.982 0.000 1.000
#> SRR2050406     1  0.0000      0.980 1.000 0.000
#> SRR2050405     2  0.0938      0.984 0.012 0.988
#> SRR2050404     2  0.0000      0.982 0.000 1.000
#> SRR2050403     2  0.0938      0.984 0.012 0.988
#> SRR2050402     2  0.0000      0.982 0.000 1.000
#> SRR2050401     2  0.0938      0.984 0.012 0.988
#> SRR2050400     2  0.0938      0.984 0.012 0.988
#> SRR2050399     2  0.0000      0.982 0.000 1.000
#> SRR2050398     2  0.5946      0.842 0.144 0.856
#> SRR2050397     2  0.0938      0.984 0.012 0.988
#> SRR2050396     1  0.0000      0.980 1.000 0.000
#> SRR2050395     2  0.0938      0.984 0.012 0.988
#> SRR2050394     2  0.0000      0.982 0.000 1.000
#> SRR2050393     1  0.0000      0.980 1.000 0.000
#> SRR2050392     2  0.0938      0.984 0.012 0.988
#> SRR2050465     2  0.0000      0.982 0.000 1.000
#> SRR2050464     1  0.0000      0.980 1.000 0.000
#> SRR2050463     2  0.0938      0.984 0.012 0.988
#> SRR2050462     2  0.0000      0.982 0.000 1.000
#> SRR2050461     1  0.0000      0.980 1.000 0.000
#> SRR2050460     2  0.0938      0.984 0.012 0.988
#> SRR2050459     2  0.0000      0.982 0.000 1.000
#> SRR2050458     1  0.0000      0.980 1.000 0.000
#> SRR2050457     2  0.0938      0.984 0.012 0.988
#> SRR2050456     2  0.0000      0.982 0.000 1.000
#> SRR2050455     1  0.0000      0.980 1.000 0.000
#> SRR2050454     2  0.0938      0.984 0.012 0.988
#> SRR2050453     2  0.0000      0.982 0.000 1.000
#> SRR2050452     1  0.0000      0.980 1.000 0.000
#> SRR2050451     2  0.0938      0.984 0.012 0.988
#> SRR2050450     2  0.0000      0.982 0.000 1.000
#> SRR2050449     1  0.0000      0.980 1.000 0.000
#> SRR2050448     2  0.0938      0.984 0.012 0.988
#> SRR2050447     1  0.0000      0.980 1.000 0.000
#> SRR2050446     2  0.0938      0.984 0.012 0.988
#> SRR2050445     2  0.0000      0.982 0.000 1.000
#> SRR2050444     1  0.0000      0.980 1.000 0.000
#> SRR2050443     2  0.0938      0.984 0.012 0.988
#> SRR2050442     2  0.0000      0.982 0.000 1.000
#> SRR2050441     1  0.0000      0.980 1.000 0.000
#> SRR2050440     1  0.0000      0.980 1.000 0.000
#> SRR2050439     2  0.0000      0.982 0.000 1.000
#> SRR2050438     1  0.0000      0.980 1.000 0.000
#> SRR2050437     1  0.0000      0.980 1.000 0.000
#> SRR2050436     2  0.0938      0.984 0.012 0.988
#> SRR2050435     1  0.0000      0.980 1.000 0.000
#> SRR2050434     2  0.0938      0.984 0.012 0.988
#> SRR2050433     2  0.0000      0.982 0.000 1.000
#> SRR2050432     2  0.6973      0.782 0.188 0.812
#> SRR2050431     2  0.0938      0.984 0.012 0.988
#> SRR2050430     2  0.0938      0.984 0.012 0.988
#> SRR2050429     2  0.0938      0.984 0.012 0.988

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>            class entropy silhouette    p1   p2    p3
#> SRR2050410     2   0.000      1.000 0.000 1.00 0.000
#> SRR2050427     1   0.418      0.799 0.828 0.00 0.172
#> SRR2050426     1   0.341      0.861 0.876 0.00 0.124
#> SRR2050425     2   0.000      1.000 0.000 1.00 0.000
#> SRR2050424     3   0.000      1.000 0.000 0.00 1.000
#> SRR2050423     1   0.000      0.987 1.000 0.00 0.000
#> SRR2050422     1   0.000      0.987 1.000 0.00 0.000
#> SRR2050421     1   0.000      0.987 1.000 0.00 0.000
#> SRR2050420     1   0.000      0.987 1.000 0.00 0.000
#> SRR2050419     2   0.000      1.000 0.000 1.00 0.000
#> SRR2050418     1   0.000      0.987 1.000 0.00 0.000
#> SRR2050417     1   0.000      0.987 1.000 0.00 0.000
#> SRR2050416     2   0.000      1.000 0.000 1.00 0.000
#> SRR2050415     3   0.000      1.000 0.000 0.00 1.000
#> SRR2050414     1   0.000      0.987 1.000 0.00 0.000
#> SRR2050413     1   0.153      0.951 0.960 0.04 0.000
#> SRR2050412     1   0.000      0.987 1.000 0.00 0.000
#> SRR2050411     1   0.000      0.987 1.000 0.00 0.000
#> SRR2050409     2   0.000      1.000 0.000 1.00 0.000
#> SRR2050408     1   0.000      0.987 1.000 0.00 0.000
#> SRR2050407     2   0.000      1.000 0.000 1.00 0.000
#> SRR2050406     3   0.000      1.000 0.000 0.00 1.000
#> SRR2050405     1   0.000      0.987 1.000 0.00 0.000
#> SRR2050404     2   0.000      1.000 0.000 1.00 0.000
#> SRR2050403     1   0.000      0.987 1.000 0.00 0.000
#> SRR2050402     2   0.000      1.000 0.000 1.00 0.000
#> SRR2050401     1   0.000      0.987 1.000 0.00 0.000
#> SRR2050400     1   0.000      0.987 1.000 0.00 0.000
#> SRR2050399     2   0.000      1.000 0.000 1.00 0.000
#> SRR2050398     1   0.000      0.987 1.000 0.00 0.000
#> SRR2050397     1   0.000      0.987 1.000 0.00 0.000
#> SRR2050396     3   0.000      1.000 0.000 0.00 1.000
#> SRR2050395     1   0.000      0.987 1.000 0.00 0.000
#> SRR2050394     2   0.000      1.000 0.000 1.00 0.000
#> SRR2050393     3   0.000      1.000 0.000 0.00 1.000
#> SRR2050392     1   0.334      0.864 0.880 0.12 0.000
#> SRR2050465     2   0.000      1.000 0.000 1.00 0.000
#> SRR2050464     3   0.000      1.000 0.000 0.00 1.000
#> SRR2050463     1   0.000      0.987 1.000 0.00 0.000
#> SRR2050462     2   0.000      1.000 0.000 1.00 0.000
#> SRR2050461     3   0.000      1.000 0.000 0.00 1.000
#> SRR2050460     1   0.000      0.987 1.000 0.00 0.000
#> SRR2050459     2   0.000      1.000 0.000 1.00 0.000
#> SRR2050458     3   0.000      1.000 0.000 0.00 1.000
#> SRR2050457     1   0.000      0.987 1.000 0.00 0.000
#> SRR2050456     2   0.000      1.000 0.000 1.00 0.000
#> SRR2050455     3   0.000      1.000 0.000 0.00 1.000
#> SRR2050454     1   0.000      0.987 1.000 0.00 0.000
#> SRR2050453     2   0.000      1.000 0.000 1.00 0.000
#> SRR2050452     3   0.000      1.000 0.000 0.00 1.000
#> SRR2050451     1   0.000      0.987 1.000 0.00 0.000
#> SRR2050450     2   0.000      1.000 0.000 1.00 0.000
#> SRR2050449     3   0.000      1.000 0.000 0.00 1.000
#> SRR2050448     1   0.000      0.987 1.000 0.00 0.000
#> SRR2050447     3   0.000      1.000 0.000 0.00 1.000
#> SRR2050446     1   0.000      0.987 1.000 0.00 0.000
#> SRR2050445     2   0.000      1.000 0.000 1.00 0.000
#> SRR2050444     3   0.000      1.000 0.000 0.00 1.000
#> SRR2050443     1   0.000      0.987 1.000 0.00 0.000
#> SRR2050442     2   0.000      1.000 0.000 1.00 0.000
#> SRR2050441     3   0.000      1.000 0.000 0.00 1.000
#> SRR2050440     1   0.000      0.987 1.000 0.00 0.000
#> SRR2050439     2   0.000      1.000 0.000 1.00 0.000
#> SRR2050438     3   0.000      1.000 0.000 0.00 1.000
#> SRR2050437     1   0.000      0.987 1.000 0.00 0.000
#> SRR2050436     1   0.000      0.987 1.000 0.00 0.000
#> SRR2050435     3   0.000      1.000 0.000 0.00 1.000
#> SRR2050434     1   0.000      0.987 1.000 0.00 0.000
#> SRR2050433     2   0.000      1.000 0.000 1.00 0.000
#> SRR2050432     1   0.000      0.987 1.000 0.00 0.000
#> SRR2050431     1   0.000      0.987 1.000 0.00 0.000
#> SRR2050430     1   0.000      0.987 1.000 0.00 0.000
#> SRR2050429     1   0.000      0.987 1.000 0.00 0.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1 p2 p3    p4
#> SRR2050410     2  0.0000      1.000 0.000  1  0 0.000
#> SRR2050427     1  0.0000      0.893 1.000  0  0 0.000
#> SRR2050426     1  0.0000      0.893 1.000  0  0 0.000
#> SRR2050425     2  0.0000      1.000 0.000  1  0 0.000
#> SRR2050424     3  0.0000      1.000 0.000  0  1 0.000
#> SRR2050423     4  0.0000      0.917 0.000  0  0 1.000
#> SRR2050422     4  0.1118      0.900 0.036  0  0 0.964
#> SRR2050421     1  0.0000      0.893 1.000  0  0 0.000
#> SRR2050420     1  0.0000      0.893 1.000  0  0 0.000
#> SRR2050419     2  0.0000      1.000 0.000  1  0 0.000
#> SRR2050418     4  0.4605      0.529 0.336  0  0 0.664
#> SRR2050417     4  0.1022      0.903 0.032  0  0 0.968
#> SRR2050416     2  0.0000      1.000 0.000  1  0 0.000
#> SRR2050415     3  0.0000      1.000 0.000  0  1 0.000
#> SRR2050414     4  0.0000      0.917 0.000  0  0 1.000
#> SRR2050413     4  0.1118      0.900 0.036  0  0 0.964
#> SRR2050412     1  0.0000      0.893 1.000  0  0 0.000
#> SRR2050411     4  0.4605      0.529 0.336  0  0 0.664
#> SRR2050409     2  0.0000      1.000 0.000  1  0 0.000
#> SRR2050408     4  0.4605      0.529 0.336  0  0 0.664
#> SRR2050407     2  0.0000      1.000 0.000  1  0 0.000
#> SRR2050406     3  0.0000      1.000 0.000  0  1 0.000
#> SRR2050405     4  0.0000      0.917 0.000  0  0 1.000
#> SRR2050404     2  0.0000      1.000 0.000  1  0 0.000
#> SRR2050403     1  0.4790      0.299 0.620  0  0 0.380
#> SRR2050402     2  0.0000      1.000 0.000  1  0 0.000
#> SRR2050401     1  0.0000      0.893 1.000  0  0 0.000
#> SRR2050400     1  0.2589      0.794 0.884  0  0 0.116
#> SRR2050399     2  0.0000      1.000 0.000  1  0 0.000
#> SRR2050398     1  0.0000      0.893 1.000  0  0 0.000
#> SRR2050397     4  0.4679      0.496 0.352  0  0 0.648
#> SRR2050396     3  0.0000      1.000 0.000  0  1 0.000
#> SRR2050395     4  0.0000      0.917 0.000  0  0 1.000
#> SRR2050394     2  0.0000      1.000 0.000  1  0 0.000
#> SRR2050393     3  0.0000      1.000 0.000  0  1 0.000
#> SRR2050392     4  0.0000      0.917 0.000  0  0 1.000
#> SRR2050465     2  0.0000      1.000 0.000  1  0 0.000
#> SRR2050464     3  0.0000      1.000 0.000  0  1 0.000
#> SRR2050463     4  0.0000      0.917 0.000  0  0 1.000
#> SRR2050462     2  0.0000      1.000 0.000  1  0 0.000
#> SRR2050461     3  0.0000      1.000 0.000  0  1 0.000
#> SRR2050460     4  0.0000      0.917 0.000  0  0 1.000
#> SRR2050459     2  0.0000      1.000 0.000  1  0 0.000
#> SRR2050458     3  0.0000      1.000 0.000  0  1 0.000
#> SRR2050457     4  0.0000      0.917 0.000  0  0 1.000
#> SRR2050456     2  0.0000      1.000 0.000  1  0 0.000
#> SRR2050455     3  0.0000      1.000 0.000  0  1 0.000
#> SRR2050454     4  0.0000      0.917 0.000  0  0 1.000
#> SRR2050453     2  0.0000      1.000 0.000  1  0 0.000
#> SRR2050452     3  0.0000      1.000 0.000  0  1 0.000
#> SRR2050451     4  0.0000      0.917 0.000  0  0 1.000
#> SRR2050450     2  0.0000      1.000 0.000  1  0 0.000
#> SRR2050449     3  0.0000      1.000 0.000  0  1 0.000
#> SRR2050448     4  0.0000      0.917 0.000  0  0 1.000
#> SRR2050447     3  0.0000      1.000 0.000  0  1 0.000
#> SRR2050446     4  0.0000      0.917 0.000  0  0 1.000
#> SRR2050445     2  0.0000      1.000 0.000  1  0 0.000
#> SRR2050444     3  0.0000      1.000 0.000  0  1 0.000
#> SRR2050443     4  0.0000      0.917 0.000  0  0 1.000
#> SRR2050442     2  0.0000      1.000 0.000  1  0 0.000
#> SRR2050441     3  0.0000      1.000 0.000  0  1 0.000
#> SRR2050440     1  0.4855      0.358 0.600  0  0 0.400
#> SRR2050439     2  0.0000      1.000 0.000  1  0 0.000
#> SRR2050438     3  0.0000      1.000 0.000  0  1 0.000
#> SRR2050437     1  0.4406      0.551 0.700  0  0 0.300
#> SRR2050436     4  0.0921      0.905 0.028  0  0 0.972
#> SRR2050435     3  0.0000      1.000 0.000  0  1 0.000
#> SRR2050434     4  0.0000      0.917 0.000  0  0 1.000
#> SRR2050433     2  0.0000      1.000 0.000  1  0 0.000
#> SRR2050432     1  0.0000      0.893 1.000  0  0 0.000
#> SRR2050431     4  0.1792      0.876 0.068  0  0 0.932
#> SRR2050430     1  0.0000      0.893 1.000  0  0 0.000
#> SRR2050429     1  0.0000      0.893 1.000  0  0 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
#> SRR2050410     2   0.000      0.994 0.000 1.00  0 0.000 0.000
#> SRR2050427     5   0.000      0.931 0.000 0.00  0 0.000 1.000
#> SRR2050426     5   0.000      0.931 0.000 0.00  0 0.000 1.000
#> SRR2050425     2   0.000      0.994 0.000 1.00  0 0.000 0.000
#> SRR2050424     3   0.000      1.000 0.000 0.00  1 0.000 0.000
#> SRR2050423     4   0.000      0.989 0.000 0.00  0 1.000 0.000
#> SRR2050422     4   0.141      0.946 0.060 0.00  0 0.940 0.000
#> SRR2050421     5   0.000      0.931 0.000 0.00  0 0.000 1.000
#> SRR2050420     5   0.000      0.931 0.000 0.00  0 0.000 1.000
#> SRR2050419     2   0.000      0.994 0.000 1.00  0 0.000 0.000
#> SRR2050418     1   0.141      0.978 0.940 0.00  0 0.000 0.060
#> SRR2050417     1   0.141      0.922 0.940 0.00  0 0.060 0.000
#> SRR2050416     2   0.000      0.994 0.000 1.00  0 0.000 0.000
#> SRR2050415     3   0.000      1.000 0.000 0.00  1 0.000 0.000
#> SRR2050414     4   0.000      0.989 0.000 0.00  0 1.000 0.000
#> SRR2050413     4   0.141      0.946 0.060 0.00  0 0.940 0.000
#> SRR2050412     5   0.000      0.931 0.000 0.00  0 0.000 1.000
#> SRR2050411     1   0.141      0.978 0.940 0.00  0 0.000 0.060
#> SRR2050409     2   0.000      0.994 0.000 1.00  0 0.000 0.000
#> SRR2050408     1   0.141      0.978 0.940 0.00  0 0.000 0.060
#> SRR2050407     2   0.000      0.994 0.000 1.00  0 0.000 0.000
#> SRR2050406     3   0.000      1.000 0.000 0.00  1 0.000 0.000
#> SRR2050405     4   0.000      0.989 0.000 0.00  0 1.000 0.000
#> SRR2050404     2   0.000      0.994 0.000 1.00  0 0.000 0.000
#> SRR2050403     1   0.141      0.978 0.940 0.00  0 0.000 0.060
#> SRR2050402     2   0.141      0.947 0.060 0.94  0 0.000 0.000
#> SRR2050401     1   0.148      0.975 0.936 0.00  0 0.000 0.064
#> SRR2050400     1   0.141      0.978 0.940 0.00  0 0.000 0.060
#> SRR2050399     2   0.141      0.947 0.060 0.94  0 0.000 0.000
#> SRR2050398     5   0.000      0.931 0.000 0.00  0 0.000 1.000
#> SRR2050397     1   0.141      0.978 0.940 0.00  0 0.000 0.060
#> SRR2050396     3   0.000      1.000 0.000 0.00  1 0.000 0.000
#> SRR2050395     4   0.000      0.989 0.000 0.00  0 1.000 0.000
#> SRR2050394     2   0.000      0.994 0.000 1.00  0 0.000 0.000
#> SRR2050393     3   0.000      1.000 0.000 0.00  1 0.000 0.000
#> SRR2050392     4   0.000      0.989 0.000 0.00  0 1.000 0.000
#> SRR2050465     2   0.000      0.994 0.000 1.00  0 0.000 0.000
#> SRR2050464     3   0.000      1.000 0.000 0.00  1 0.000 0.000
#> SRR2050463     4   0.000      0.989 0.000 0.00  0 1.000 0.000
#> SRR2050462     2   0.000      0.994 0.000 1.00  0 0.000 0.000
#> SRR2050461     3   0.000      1.000 0.000 0.00  1 0.000 0.000
#> SRR2050460     4   0.000      0.989 0.000 0.00  0 1.000 0.000
#> SRR2050459     2   0.000      0.994 0.000 1.00  0 0.000 0.000
#> SRR2050458     3   0.000      1.000 0.000 0.00  1 0.000 0.000
#> SRR2050457     4   0.000      0.989 0.000 0.00  0 1.000 0.000
#> SRR2050456     2   0.000      0.994 0.000 1.00  0 0.000 0.000
#> SRR2050455     3   0.000      1.000 0.000 0.00  1 0.000 0.000
#> SRR2050454     4   0.000      0.989 0.000 0.00  0 1.000 0.000
#> SRR2050453     2   0.000      0.994 0.000 1.00  0 0.000 0.000
#> SRR2050452     3   0.000      1.000 0.000 0.00  1 0.000 0.000
#> SRR2050451     4   0.000      0.989 0.000 0.00  0 1.000 0.000
#> SRR2050450     2   0.000      0.994 0.000 1.00  0 0.000 0.000
#> SRR2050449     3   0.000      1.000 0.000 0.00  1 0.000 0.000
#> SRR2050448     4   0.000      0.989 0.000 0.00  0 1.000 0.000
#> SRR2050447     3   0.000      1.000 0.000 0.00  1 0.000 0.000
#> SRR2050446     4   0.000      0.989 0.000 0.00  0 1.000 0.000
#> SRR2050445     2   0.000      0.994 0.000 1.00  0 0.000 0.000
#> SRR2050444     3   0.000      1.000 0.000 0.00  1 0.000 0.000
#> SRR2050443     4   0.000      0.989 0.000 0.00  0 1.000 0.000
#> SRR2050442     2   0.000      0.994 0.000 1.00  0 0.000 0.000
#> SRR2050441     3   0.000      1.000 0.000 0.00  1 0.000 0.000
#> SRR2050440     5   0.426      0.248 0.000 0.00  0 0.436 0.564
#> SRR2050439     2   0.000      0.994 0.000 1.00  0 0.000 0.000
#> SRR2050438     3   0.000      1.000 0.000 0.00  1 0.000 0.000
#> SRR2050437     5   0.141      0.872 0.000 0.00  0 0.060 0.940
#> SRR2050436     4   0.141      0.946 0.060 0.00  0 0.940 0.000
#> SRR2050435     3   0.000      1.000 0.000 0.00  1 0.000 0.000
#> SRR2050434     4   0.000      0.989 0.000 0.00  0 1.000 0.000
#> SRR2050433     2   0.000      0.994 0.000 1.00  0 0.000 0.000
#> SRR2050432     5   0.000      0.931 0.000 0.00  0 0.000 1.000
#> SRR2050431     1   0.173      0.903 0.920 0.00  0 0.080 0.000
#> SRR2050430     5   0.000      0.931 0.000 0.00  0 0.000 1.000
#> SRR2050429     1   0.141      0.978 0.940 0.00  0 0.000 0.060

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>            class entropy silhouette    p1    p2 p3    p4    p5    p6
#> SRR2050410     2  0.0000     1.0000 0.000 1.000  0 0.000 0.000 0.000
#> SRR2050427     6  0.0000     0.9365 0.000 0.000  0 0.000 0.000 1.000
#> SRR2050426     6  0.0000     0.9365 0.000 0.000  0 0.000 0.000 1.000
#> SRR2050425     2  0.0000     1.0000 0.000 1.000  0 0.000 0.000 0.000
#> SRR2050424     3  0.0000     1.0000 0.000 0.000  1 0.000 0.000 0.000
#> SRR2050423     4  0.0000     1.0000 0.000 0.000  0 1.000 0.000 0.000
#> SRR2050422     5  0.0000     0.8435 0.000 0.000  0 0.000 1.000 0.000
#> SRR2050421     6  0.0000     0.9365 0.000 0.000  0 0.000 0.000 1.000
#> SRR2050420     6  0.0000     0.9365 0.000 0.000  0 0.000 0.000 1.000
#> SRR2050419     2  0.0000     1.0000 0.000 1.000  0 0.000 0.000 0.000
#> SRR2050418     1  0.0000     0.9966 1.000 0.000  0 0.000 0.000 0.000
#> SRR2050417     1  0.0000     0.9966 1.000 0.000  0 0.000 0.000 0.000
#> SRR2050416     2  0.0000     1.0000 0.000 1.000  0 0.000 0.000 0.000
#> SRR2050415     3  0.0000     1.0000 0.000 0.000  1 0.000 0.000 0.000
#> SRR2050414     4  0.0000     1.0000 0.000 0.000  0 1.000 0.000 0.000
#> SRR2050413     5  0.0000     0.8435 0.000 0.000  0 0.000 1.000 0.000
#> SRR2050412     6  0.0000     0.9365 0.000 0.000  0 0.000 0.000 1.000
#> SRR2050411     1  0.0000     0.9966 1.000 0.000  0 0.000 0.000 0.000
#> SRR2050409     2  0.0000     1.0000 0.000 1.000  0 0.000 0.000 0.000
#> SRR2050408     1  0.0000     0.9966 1.000 0.000  0 0.000 0.000 0.000
#> SRR2050407     2  0.0000     1.0000 0.000 1.000  0 0.000 0.000 0.000
#> SRR2050406     3  0.0000     1.0000 0.000 0.000  1 0.000 0.000 0.000
#> SRR2050405     4  0.0000     1.0000 0.000 0.000  0 1.000 0.000 0.000
#> SRR2050404     2  0.0000     1.0000 0.000 1.000  0 0.000 0.000 0.000
#> SRR2050403     1  0.0000     0.9966 1.000 0.000  0 0.000 0.000 0.000
#> SRR2050402     5  0.3862     0.0916 0.000 0.476  0 0.000 0.524 0.000
#> SRR2050401     1  0.0146     0.9931 0.996 0.000  0 0.000 0.000 0.004
#> SRR2050400     1  0.0000     0.9966 1.000 0.000  0 0.000 0.000 0.000
#> SRR2050399     5  0.0000     0.8435 0.000 0.000  0 0.000 1.000 0.000
#> SRR2050398     6  0.0000     0.9365 0.000 0.000  0 0.000 0.000 1.000
#> SRR2050397     1  0.0000     0.9966 1.000 0.000  0 0.000 0.000 0.000
#> SRR2050396     3  0.0000     1.0000 0.000 0.000  1 0.000 0.000 0.000
#> SRR2050395     4  0.0000     1.0000 0.000 0.000  0 1.000 0.000 0.000
#> SRR2050394     2  0.0000     1.0000 0.000 1.000  0 0.000 0.000 0.000
#> SRR2050393     3  0.0000     1.0000 0.000 0.000  1 0.000 0.000 0.000
#> SRR2050392     4  0.0000     1.0000 0.000 0.000  0 1.000 0.000 0.000
#> SRR2050465     2  0.0000     1.0000 0.000 1.000  0 0.000 0.000 0.000
#> SRR2050464     3  0.0000     1.0000 0.000 0.000  1 0.000 0.000 0.000
#> SRR2050463     4  0.0000     1.0000 0.000 0.000  0 1.000 0.000 0.000
#> SRR2050462     2  0.0000     1.0000 0.000 1.000  0 0.000 0.000 0.000
#> SRR2050461     3  0.0000     1.0000 0.000 0.000  1 0.000 0.000 0.000
#> SRR2050460     4  0.0000     1.0000 0.000 0.000  0 1.000 0.000 0.000
#> SRR2050459     2  0.0000     1.0000 0.000 1.000  0 0.000 0.000 0.000
#> SRR2050458     3  0.0000     1.0000 0.000 0.000  1 0.000 0.000 0.000
#> SRR2050457     4  0.0000     1.0000 0.000 0.000  0 1.000 0.000 0.000
#> SRR2050456     2  0.0000     1.0000 0.000 1.000  0 0.000 0.000 0.000
#> SRR2050455     3  0.0000     1.0000 0.000 0.000  1 0.000 0.000 0.000
#> SRR2050454     4  0.0000     1.0000 0.000 0.000  0 1.000 0.000 0.000
#> SRR2050453     2  0.0000     1.0000 0.000 1.000  0 0.000 0.000 0.000
#> SRR2050452     3  0.0000     1.0000 0.000 0.000  1 0.000 0.000 0.000
#> SRR2050451     4  0.0000     1.0000 0.000 0.000  0 1.000 0.000 0.000
#> SRR2050450     2  0.0000     1.0000 0.000 1.000  0 0.000 0.000 0.000
#> SRR2050449     3  0.0000     1.0000 0.000 0.000  1 0.000 0.000 0.000
#> SRR2050448     4  0.0000     1.0000 0.000 0.000  0 1.000 0.000 0.000
#> SRR2050447     3  0.0000     1.0000 0.000 0.000  1 0.000 0.000 0.000
#> SRR2050446     4  0.0000     1.0000 0.000 0.000  0 1.000 0.000 0.000
#> SRR2050445     2  0.0000     1.0000 0.000 1.000  0 0.000 0.000 0.000
#> SRR2050444     3  0.0000     1.0000 0.000 0.000  1 0.000 0.000 0.000
#> SRR2050443     4  0.0000     1.0000 0.000 0.000  0 1.000 0.000 0.000
#> SRR2050442     2  0.0000     1.0000 0.000 1.000  0 0.000 0.000 0.000
#> SRR2050441     3  0.0000     1.0000 0.000 0.000  1 0.000 0.000 0.000
#> SRR2050440     6  0.3823     0.2270 0.000 0.000  0 0.436 0.000 0.564
#> SRR2050439     2  0.0000     1.0000 0.000 1.000  0 0.000 0.000 0.000
#> SRR2050438     3  0.0000     1.0000 0.000 0.000  1 0.000 0.000 0.000
#> SRR2050437     6  0.0000     0.9365 0.000 0.000  0 0.000 0.000 1.000
#> SRR2050436     5  0.0000     0.8435 0.000 0.000  0 0.000 1.000 0.000
#> SRR2050435     3  0.0000     1.0000 0.000 0.000  1 0.000 0.000 0.000
#> SRR2050434     4  0.0000     1.0000 0.000 0.000  0 1.000 0.000 0.000
#> SRR2050433     2  0.0000     1.0000 0.000 1.000  0 0.000 0.000 0.000
#> SRR2050432     6  0.0000     0.9365 0.000 0.000  0 0.000 0.000 1.000
#> SRR2050431     1  0.0547     0.9742 0.980 0.000  0 0.020 0.000 0.000
#> SRR2050430     6  0.0000     0.9365 0.000 0.000  0 0.000 0.000 1.000
#> SRR2050429     1  0.0000     0.9966 1.000 0.000  0 0.000 0.000 0.000

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

consensus_heatmap(res, k = 2)

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

consensus_heatmap(res, k = 3)

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

consensus_heatmap(res, k = 4)

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

consensus_heatmap(res, k = 5)

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

consensus_heatmap(res, k = 6)

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

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

membership_heatmap(res, k = 2)

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

membership_heatmap(res, k = 3)

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

membership_heatmap(res, k = 4)

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

membership_heatmap(res, k = 5)

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

membership_heatmap(res, k = 6)

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

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

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

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

get_signatures(res, k = 3)

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

get_signatures(res, k = 4)

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

get_signatures(res, k = 5)

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

get_signatures(res, k = 6)

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

Signature heatmaps where rows are not scaled:

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

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

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

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

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

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

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

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

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

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

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk ATC-pam-signature_compare

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

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

An example of the output of tb is:

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

The columns in tb are:

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

UMAP plot which shows how samples are separated.

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

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

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

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

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

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

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

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

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

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

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk ATC-pam-collect-classes

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

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

collect_plots(res)

plot of chunk ATC-mclust-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 1.000           1.000       1.000         0.3477 0.653   0.653
#> 3 3 0.733           0.938       0.960         0.8029 0.712   0.559
#> 4 4 0.850           0.936       0.892         0.1763 0.835   0.576
#> 5 5 0.973           0.973       0.980         0.0824 0.949   0.793
#> 6 6 0.926           0.918       0.913         0.0209 0.936   0.718

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

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

There is also optional best \(k\) = 2 5 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
#> SRR2050410     2       0          1  0  1
#> SRR2050427     2       0          1  0  1
#> SRR2050426     2       0          1  0  1
#> SRR2050425     2       0          1  0  1
#> SRR2050424     1       0          1  1  0
#> SRR2050423     2       0          1  0  1
#> SRR2050422     2       0          1  0  1
#> SRR2050421     2       0          1  0  1
#> SRR2050420     2       0          1  0  1
#> SRR2050419     2       0          1  0  1
#> SRR2050418     2       0          1  0  1
#> SRR2050417     2       0          1  0  1
#> SRR2050416     2       0          1  0  1
#> SRR2050415     1       0          1  1  0
#> SRR2050414     2       0          1  0  1
#> SRR2050413     2       0          1  0  1
#> SRR2050412     2       0          1  0  1
#> SRR2050411     2       0          1  0  1
#> SRR2050409     2       0          1  0  1
#> SRR2050408     2       0          1  0  1
#> SRR2050407     2       0          1  0  1
#> SRR2050406     1       0          1  1  0
#> SRR2050405     2       0          1  0  1
#> SRR2050404     2       0          1  0  1
#> SRR2050403     2       0          1  0  1
#> SRR2050402     2       0          1  0  1
#> SRR2050401     2       0          1  0  1
#> SRR2050400     2       0          1  0  1
#> SRR2050399     2       0          1  0  1
#> SRR2050398     2       0          1  0  1
#> SRR2050397     2       0          1  0  1
#> SRR2050396     1       0          1  1  0
#> SRR2050395     2       0          1  0  1
#> SRR2050394     2       0          1  0  1
#> SRR2050393     1       0          1  1  0
#> SRR2050392     2       0          1  0  1
#> SRR2050465     2       0          1  0  1
#> SRR2050464     1       0          1  1  0
#> SRR2050463     2       0          1  0  1
#> SRR2050462     2       0          1  0  1
#> SRR2050461     1       0          1  1  0
#> SRR2050460     2       0          1  0  1
#> SRR2050459     2       0          1  0  1
#> SRR2050458     1       0          1  1  0
#> SRR2050457     2       0          1  0  1
#> SRR2050456     2       0          1  0  1
#> SRR2050455     1       0          1  1  0
#> SRR2050454     2       0          1  0  1
#> SRR2050453     2       0          1  0  1
#> SRR2050452     1       0          1  1  0
#> SRR2050451     2       0          1  0  1
#> SRR2050450     2       0          1  0  1
#> SRR2050449     1       0          1  1  0
#> SRR2050448     2       0          1  0  1
#> SRR2050447     1       0          1  1  0
#> SRR2050446     2       0          1  0  1
#> SRR2050445     2       0          1  0  1
#> SRR2050444     1       0          1  1  0
#> SRR2050443     2       0          1  0  1
#> SRR2050442     2       0          1  0  1
#> SRR2050441     1       0          1  1  0
#> SRR2050440     2       0          1  0  1
#> SRR2050439     2       0          1  0  1
#> SRR2050438     1       0          1  1  0
#> SRR2050437     2       0          1  0  1
#> SRR2050436     2       0          1  0  1
#> SRR2050435     1       0          1  1  0
#> SRR2050434     2       0          1  0  1
#> SRR2050433     2       0          1  0  1
#> SRR2050432     2       0          1  0  1
#> SRR2050431     2       0          1  0  1
#> SRR2050430     2       0          1  0  1
#> SRR2050429     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
#> SRR2050410     2  0.0000      0.947 0.000 1.000  0
#> SRR2050427     1  0.0000      0.935 1.000 0.000  0
#> SRR2050426     1  0.0000      0.935 1.000 0.000  0
#> SRR2050425     2  0.0000      0.947 0.000 1.000  0
#> SRR2050424     3  0.0000      1.000 0.000 0.000  1
#> SRR2050423     1  0.3192      0.932 0.888 0.112  0
#> SRR2050422     1  0.2959      0.932 0.900 0.100  0
#> SRR2050421     1  0.0000      0.935 1.000 0.000  0
#> SRR2050420     1  0.0000      0.935 1.000 0.000  0
#> SRR2050419     2  0.0000      0.947 0.000 1.000  0
#> SRR2050418     1  0.0000      0.935 1.000 0.000  0
#> SRR2050417     1  0.0000      0.935 1.000 0.000  0
#> SRR2050416     2  0.2711      0.893 0.088 0.912  0
#> SRR2050415     3  0.0000      1.000 0.000 0.000  1
#> SRR2050414     1  0.3192      0.932 0.888 0.112  0
#> SRR2050413     2  0.6204      0.223 0.424 0.576  0
#> SRR2050412     1  0.0000      0.935 1.000 0.000  0
#> SRR2050411     1  0.0000      0.935 1.000 0.000  0
#> SRR2050409     2  0.0000      0.947 0.000 1.000  0
#> SRR2050408     1  0.0000      0.935 1.000 0.000  0
#> SRR2050407     2  0.0000      0.947 0.000 1.000  0
#> SRR2050406     3  0.0000      1.000 0.000 0.000  1
#> SRR2050405     1  0.3192      0.932 0.888 0.112  0
#> SRR2050404     2  0.0000      0.947 0.000 1.000  0
#> SRR2050403     1  0.0000      0.935 1.000 0.000  0
#> SRR2050402     2  0.2448      0.904 0.076 0.924  0
#> SRR2050401     1  0.0000      0.935 1.000 0.000  0
#> SRR2050400     1  0.0000      0.935 1.000 0.000  0
#> SRR2050399     2  0.2959      0.885 0.100 0.900  0
#> SRR2050398     1  0.0000      0.935 1.000 0.000  0
#> SRR2050397     1  0.0000      0.935 1.000 0.000  0
#> SRR2050396     3  0.0000      1.000 0.000 0.000  1
#> SRR2050395     1  0.3192      0.932 0.888 0.112  0
#> SRR2050394     2  0.0000      0.947 0.000 1.000  0
#> SRR2050393     3  0.0000      1.000 0.000 0.000  1
#> SRR2050392     1  0.3192      0.932 0.888 0.112  0
#> SRR2050465     2  0.0000      0.947 0.000 1.000  0
#> SRR2050464     3  0.0000      1.000 0.000 0.000  1
#> SRR2050463     1  0.3192      0.932 0.888 0.112  0
#> SRR2050462     2  0.0000      0.947 0.000 1.000  0
#> SRR2050461     3  0.0000      1.000 0.000 0.000  1
#> SRR2050460     1  0.3192      0.932 0.888 0.112  0
#> SRR2050459     2  0.0000      0.947 0.000 1.000  0
#> SRR2050458     3  0.0000      1.000 0.000 0.000  1
#> SRR2050457     1  0.3192      0.932 0.888 0.112  0
#> SRR2050456     2  0.0000      0.947 0.000 1.000  0
#> SRR2050455     3  0.0000      1.000 0.000 0.000  1
#> SRR2050454     1  0.3192      0.932 0.888 0.112  0
#> SRR2050453     2  0.0000      0.947 0.000 1.000  0
#> SRR2050452     3  0.0000      1.000 0.000 0.000  1
#> SRR2050451     1  0.3192      0.932 0.888 0.112  0
#> SRR2050450     2  0.0000      0.947 0.000 1.000  0
#> SRR2050449     3  0.0000      1.000 0.000 0.000  1
#> SRR2050448     1  0.3192      0.932 0.888 0.112  0
#> SRR2050447     3  0.0000      1.000 0.000 0.000  1
#> SRR2050446     1  0.3192      0.932 0.888 0.112  0
#> SRR2050445     2  0.0000      0.947 0.000 1.000  0
#> SRR2050444     3  0.0000      1.000 0.000 0.000  1
#> SRR2050443     1  0.3192      0.932 0.888 0.112  0
#> SRR2050442     2  0.2711      0.893 0.088 0.912  0
#> SRR2050441     3  0.0000      1.000 0.000 0.000  1
#> SRR2050440     1  0.3192      0.932 0.888 0.112  0
#> SRR2050439     2  0.2711      0.893 0.088 0.912  0
#> SRR2050438     3  0.0000      1.000 0.000 0.000  1
#> SRR2050437     1  0.3192      0.932 0.888 0.112  0
#> SRR2050436     1  0.3192      0.932 0.888 0.112  0
#> SRR2050435     3  0.0000      1.000 0.000 0.000  1
#> SRR2050434     1  0.3192      0.932 0.888 0.112  0
#> SRR2050433     2  0.0000      0.947 0.000 1.000  0
#> SRR2050432     1  0.0000      0.935 1.000 0.000  0
#> SRR2050431     1  0.0424      0.935 0.992 0.008  0
#> SRR2050430     1  0.0424      0.935 0.992 0.008  0
#> SRR2050429     1  0.0000      0.935 1.000 0.000  0

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2 p3    p4
#> SRR2050410     2  0.0000      0.889 0.000 1.000  0 0.000
#> SRR2050427     1  0.0000      0.996 1.000 0.000  0 0.000
#> SRR2050426     1  0.0000      0.996 1.000 0.000  0 0.000
#> SRR2050425     2  0.0188      0.888 0.000 0.996  0 0.004
#> SRR2050424     3  0.0000      1.000 0.000 0.000  1 0.000
#> SRR2050423     4  0.5723      0.972 0.244 0.072  0 0.684
#> SRR2050422     2  0.5244      0.726 0.012 0.600  0 0.388
#> SRR2050421     1  0.0000      0.996 1.000 0.000  0 0.000
#> SRR2050420     1  0.0000      0.996 1.000 0.000  0 0.000
#> SRR2050419     2  0.0000      0.889 0.000 1.000  0 0.000
#> SRR2050418     1  0.0000      0.996 1.000 0.000  0 0.000
#> SRR2050417     1  0.0000      0.996 1.000 0.000  0 0.000
#> SRR2050416     2  0.4605      0.780 0.000 0.664  0 0.336
#> SRR2050415     3  0.0000      1.000 0.000 0.000  1 0.000
#> SRR2050414     4  0.5723      0.972 0.244 0.072  0 0.684
#> SRR2050413     2  0.4643      0.775 0.000 0.656  0 0.344
#> SRR2050412     1  0.0000      0.996 1.000 0.000  0 0.000
#> SRR2050411     1  0.0000      0.996 1.000 0.000  0 0.000
#> SRR2050409     2  0.0000      0.889 0.000 1.000  0 0.000
#> SRR2050408     1  0.0000      0.996 1.000 0.000  0 0.000
#> SRR2050407     2  0.0000      0.889 0.000 1.000  0 0.000
#> SRR2050406     3  0.0000      1.000 0.000 0.000  1 0.000
#> SRR2050405     4  0.5723      0.972 0.244 0.072  0 0.684
#> SRR2050404     2  0.0000      0.889 0.000 1.000  0 0.000
#> SRR2050403     1  0.0000      0.996 1.000 0.000  0 0.000
#> SRR2050402     2  0.2647      0.854 0.000 0.880  0 0.120
#> SRR2050401     1  0.0000      0.996 1.000 0.000  0 0.000
#> SRR2050400     1  0.0000      0.996 1.000 0.000  0 0.000
#> SRR2050399     2  0.4605      0.780 0.000 0.664  0 0.336
#> SRR2050398     1  0.0000      0.996 1.000 0.000  0 0.000
#> SRR2050397     1  0.0000      0.996 1.000 0.000  0 0.000
#> SRR2050396     3  0.0000      1.000 0.000 0.000  1 0.000
#> SRR2050395     4  0.5723      0.972 0.244 0.072  0 0.684
#> SRR2050394     2  0.0000      0.889 0.000 1.000  0 0.000
#> SRR2050393     3  0.0000      1.000 0.000 0.000  1 0.000
#> SRR2050392     4  0.5723      0.972 0.244 0.072  0 0.684
#> SRR2050465     2  0.0000      0.889 0.000 1.000  0 0.000
#> SRR2050464     3  0.0000      1.000 0.000 0.000  1 0.000
#> SRR2050463     4  0.5723      0.972 0.244 0.072  0 0.684
#> SRR2050462     2  0.0000      0.889 0.000 1.000  0 0.000
#> SRR2050461     3  0.0000      1.000 0.000 0.000  1 0.000
#> SRR2050460     4  0.5723      0.972 0.244 0.072  0 0.684
#> SRR2050459     2  0.0000      0.889 0.000 1.000  0 0.000
#> SRR2050458     3  0.0000      1.000 0.000 0.000  1 0.000
#> SRR2050457     4  0.5723      0.972 0.244 0.072  0 0.684
#> SRR2050456     2  0.0000      0.889 0.000 1.000  0 0.000
#> SRR2050455     3  0.0000      1.000 0.000 0.000  1 0.000
#> SRR2050454     4  0.5723      0.972 0.244 0.072  0 0.684
#> SRR2050453     2  0.0000      0.889 0.000 1.000  0 0.000
#> SRR2050452     3  0.0000      1.000 0.000 0.000  1 0.000
#> SRR2050451     4  0.5723      0.972 0.244 0.072  0 0.684
#> SRR2050450     2  0.0000      0.889 0.000 1.000  0 0.000
#> SRR2050449     3  0.0000      1.000 0.000 0.000  1 0.000
#> SRR2050448     4  0.5723      0.972 0.244 0.072  0 0.684
#> SRR2050447     3  0.0000      1.000 0.000 0.000  1 0.000
#> SRR2050446     4  0.5723      0.972 0.244 0.072  0 0.684
#> SRR2050445     2  0.0000      0.889 0.000 1.000  0 0.000
#> SRR2050444     3  0.0000      1.000 0.000 0.000  1 0.000
#> SRR2050443     4  0.5723      0.972 0.244 0.072  0 0.684
#> SRR2050442     2  0.4605      0.780 0.000 0.664  0 0.336
#> SRR2050441     3  0.0000      1.000 0.000 0.000  1 0.000
#> SRR2050440     4  0.4188      0.899 0.244 0.004  0 0.752
#> SRR2050439     2  0.4605      0.780 0.000 0.664  0 0.336
#> SRR2050438     3  0.0000      1.000 0.000 0.000  1 0.000
#> SRR2050437     4  0.4008      0.895 0.244 0.000  0 0.756
#> SRR2050436     2  0.4855      0.731 0.000 0.600  0 0.400
#> SRR2050435     3  0.0000      1.000 0.000 0.000  1 0.000
#> SRR2050434     2  0.4855      0.731 0.000 0.600  0 0.400
#> SRR2050433     2  0.0000      0.889 0.000 1.000  0 0.000
#> SRR2050432     1  0.0000      0.996 1.000 0.000  0 0.000
#> SRR2050431     4  0.4776      0.752 0.376 0.000  0 0.624
#> SRR2050430     1  0.1022      0.952 0.968 0.000  0 0.032
#> SRR2050429     1  0.0336      0.986 0.992 0.000  0 0.008

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>            class entropy silhouette    p1    p2 p3    p4    p5
#> SRR2050410     2  0.0000      0.994 0.000 1.000  0 0.000 0.000
#> SRR2050427     1  0.0000      0.998 1.000 0.000  0 0.000 0.000
#> SRR2050426     1  0.0000      0.998 1.000 0.000  0 0.000 0.000
#> SRR2050425     2  0.1410      0.921 0.000 0.940  0 0.000 0.060
#> SRR2050424     3  0.0000      1.000 0.000 0.000  1 0.000 0.000
#> SRR2050423     4  0.0000      0.997 0.000 0.000  0 1.000 0.000
#> SRR2050422     5  0.0000      0.814 0.000 0.000  0 0.000 1.000
#> SRR2050421     1  0.0000      0.998 1.000 0.000  0 0.000 0.000
#> SRR2050420     1  0.0162      0.996 0.996 0.000  0 0.000 0.004
#> SRR2050419     2  0.0000      0.994 0.000 1.000  0 0.000 0.000
#> SRR2050418     1  0.0000      0.998 1.000 0.000  0 0.000 0.000
#> SRR2050417     1  0.0000      0.998 1.000 0.000  0 0.000 0.000
#> SRR2050416     5  0.3612      0.814 0.000 0.268  0 0.000 0.732
#> SRR2050415     3  0.0000      1.000 0.000 0.000  1 0.000 0.000
#> SRR2050414     4  0.0000      0.997 0.000 0.000  0 1.000 0.000
#> SRR2050413     5  0.0162      0.815 0.000 0.004  0 0.000 0.996
#> SRR2050412     1  0.0000      0.998 1.000 0.000  0 0.000 0.000
#> SRR2050411     1  0.0000      0.998 1.000 0.000  0 0.000 0.000
#> SRR2050409     2  0.0000      0.994 0.000 1.000  0 0.000 0.000
#> SRR2050408     1  0.0000      0.998 1.000 0.000  0 0.000 0.000
#> SRR2050407     2  0.0000      0.994 0.000 1.000  0 0.000 0.000
#> SRR2050406     3  0.0000      1.000 0.000 0.000  1 0.000 0.000
#> SRR2050405     4  0.0000      0.997 0.000 0.000  0 1.000 0.000
#> SRR2050404     2  0.0000      0.994 0.000 1.000  0 0.000 0.000
#> SRR2050403     1  0.0000      0.998 1.000 0.000  0 0.000 0.000
#> SRR2050402     5  0.3636      0.809 0.000 0.272  0 0.000 0.728
#> SRR2050401     1  0.0000      0.998 1.000 0.000  0 0.000 0.000
#> SRR2050400     1  0.0162      0.996 0.996 0.000  0 0.000 0.004
#> SRR2050399     5  0.3612      0.814 0.000 0.268  0 0.000 0.732
#> SRR2050398     1  0.0000      0.998 1.000 0.000  0 0.000 0.000
#> SRR2050397     1  0.0000      0.998 1.000 0.000  0 0.000 0.000
#> SRR2050396     3  0.0000      1.000 0.000 0.000  1 0.000 0.000
#> SRR2050395     4  0.0000      0.997 0.000 0.000  0 1.000 0.000
#> SRR2050394     2  0.0000      0.994 0.000 1.000  0 0.000 0.000
#> SRR2050393     3  0.0000      1.000 0.000 0.000  1 0.000 0.000
#> SRR2050392     4  0.0000      0.997 0.000 0.000  0 1.000 0.000
#> SRR2050465     2  0.0000      0.994 0.000 1.000  0 0.000 0.000
#> SRR2050464     3  0.0000      1.000 0.000 0.000  1 0.000 0.000
#> SRR2050463     4  0.0000      0.997 0.000 0.000  0 1.000 0.000
#> SRR2050462     2  0.0000      0.994 0.000 1.000  0 0.000 0.000
#> SRR2050461     3  0.0000      1.000 0.000 0.000  1 0.000 0.000
#> SRR2050460     4  0.0000      0.997 0.000 0.000  0 1.000 0.000
#> SRR2050459     2  0.0404      0.981 0.000 0.988  0 0.000 0.012
#> SRR2050458     3  0.0000      1.000 0.000 0.000  1 0.000 0.000
#> SRR2050457     4  0.0000      0.997 0.000 0.000  0 1.000 0.000
#> SRR2050456     2  0.0000      0.994 0.000 1.000  0 0.000 0.000
#> SRR2050455     3  0.0000      1.000 0.000 0.000  1 0.000 0.000
#> SRR2050454     4  0.0000      0.997 0.000 0.000  0 1.000 0.000
#> SRR2050453     2  0.0000      0.994 0.000 1.000  0 0.000 0.000
#> SRR2050452     3  0.0000      1.000 0.000 0.000  1 0.000 0.000
#> SRR2050451     4  0.0000      0.997 0.000 0.000  0 1.000 0.000
#> SRR2050450     2  0.0000      0.994 0.000 1.000  0 0.000 0.000
#> SRR2050449     3  0.0000      1.000 0.000 0.000  1 0.000 0.000
#> SRR2050448     4  0.0000      0.997 0.000 0.000  0 1.000 0.000
#> SRR2050447     3  0.0000      1.000 0.000 0.000  1 0.000 0.000
#> SRR2050446     4  0.0162      0.995 0.000 0.000  0 0.996 0.004
#> SRR2050445     2  0.0000      0.994 0.000 1.000  0 0.000 0.000
#> SRR2050444     3  0.0000      1.000 0.000 0.000  1 0.000 0.000
#> SRR2050443     4  0.0000      0.997 0.000 0.000  0 1.000 0.000
#> SRR2050442     5  0.3612      0.814 0.000 0.268  0 0.000 0.732
#> SRR2050441     3  0.0000      1.000 0.000 0.000  1 0.000 0.000
#> SRR2050440     4  0.0290      0.992 0.000 0.000  0 0.992 0.008
#> SRR2050439     5  0.3612      0.814 0.000 0.268  0 0.000 0.732
#> SRR2050438     3  0.0000      1.000 0.000 0.000  1 0.000 0.000
#> SRR2050437     4  0.0290      0.992 0.000 0.000  0 0.992 0.008
#> SRR2050436     5  0.0000      0.814 0.000 0.000  0 0.000 1.000
#> SRR2050435     3  0.0000      1.000 0.000 0.000  1 0.000 0.000
#> SRR2050434     5  0.0000      0.814 0.000 0.000  0 0.000 1.000
#> SRR2050433     2  0.0000      0.994 0.000 1.000  0 0.000 0.000
#> SRR2050432     1  0.0000      0.998 1.000 0.000  0 0.000 0.000
#> SRR2050431     4  0.0671      0.980 0.016 0.000  0 0.980 0.004
#> SRR2050430     1  0.0404      0.990 0.988 0.000  0 0.000 0.012
#> SRR2050429     1  0.0290      0.993 0.992 0.000  0 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
#> SRR2050410     2  0.0000      0.907 0.000 1.000  0 0.000 0.000 0.000
#> SRR2050427     1  0.0000      1.000 1.000 0.000  0 0.000 0.000 0.000
#> SRR2050426     1  0.0000      1.000 1.000 0.000  0 0.000 0.000 0.000
#> SRR2050425     2  0.0000      0.907 0.000 1.000  0 0.000 0.000 0.000
#> SRR2050424     3  0.0000      1.000 0.000 0.000  1 0.000 0.000 0.000
#> SRR2050423     4  0.0458      0.896 0.000 0.000  0 0.984 0.000 0.016
#> SRR2050422     5  0.0000      1.000 0.000 0.000  0 0.000 1.000 0.000
#> SRR2050421     1  0.0000      1.000 1.000 0.000  0 0.000 0.000 0.000
#> SRR2050420     1  0.0000      1.000 1.000 0.000  0 0.000 0.000 0.000
#> SRR2050419     2  0.0000      0.907 0.000 1.000  0 0.000 0.000 0.000
#> SRR2050418     6  0.3515      0.976 0.324 0.000  0 0.000 0.000 0.676
#> SRR2050417     6  0.3515      0.976 0.324 0.000  0 0.000 0.000 0.676
#> SRR2050416     2  0.3695      0.512 0.000 0.624  0 0.000 0.376 0.000
#> SRR2050415     3  0.0000      1.000 0.000 0.000  1 0.000 0.000 0.000
#> SRR2050414     4  0.0937      0.893 0.000 0.000  0 0.960 0.000 0.040
#> SRR2050413     5  0.0000      1.000 0.000 0.000  0 0.000 1.000 0.000
#> SRR2050412     1  0.0000      1.000 1.000 0.000  0 0.000 0.000 0.000
#> SRR2050411     6  0.3515      0.976 0.324 0.000  0 0.000 0.000 0.676
#> SRR2050409     2  0.0000      0.907 0.000 1.000  0 0.000 0.000 0.000
#> SRR2050408     6  0.3515      0.976 0.324 0.000  0 0.000 0.000 0.676
#> SRR2050407     2  0.0000      0.907 0.000 1.000  0 0.000 0.000 0.000
#> SRR2050406     3  0.0000      1.000 0.000 0.000  1 0.000 0.000 0.000
#> SRR2050405     4  0.1501      0.887 0.000 0.000  0 0.924 0.000 0.076
#> SRR2050404     2  0.0000      0.907 0.000 1.000  0 0.000 0.000 0.000
#> SRR2050403     6  0.3531      0.972 0.328 0.000  0 0.000 0.000 0.672
#> SRR2050402     2  0.2092      0.815 0.000 0.876  0 0.000 0.124 0.000
#> SRR2050401     1  0.0000      1.000 1.000 0.000  0 0.000 0.000 0.000
#> SRR2050400     6  0.3515      0.976 0.324 0.000  0 0.000 0.000 0.676
#> SRR2050399     2  0.3695      0.512 0.000 0.624  0 0.000 0.376 0.000
#> SRR2050398     1  0.0000      1.000 1.000 0.000  0 0.000 0.000 0.000
#> SRR2050397     6  0.3515      0.976 0.324 0.000  0 0.000 0.000 0.676
#> SRR2050396     3  0.0000      1.000 0.000 0.000  1 0.000 0.000 0.000
#> SRR2050395     4  0.1501      0.887 0.000 0.000  0 0.924 0.000 0.076
#> SRR2050394     2  0.0000      0.907 0.000 1.000  0 0.000 0.000 0.000
#> SRR2050393     3  0.0000      1.000 0.000 0.000  1 0.000 0.000 0.000
#> SRR2050392     4  0.1387      0.890 0.000 0.000  0 0.932 0.000 0.068
#> SRR2050465     2  0.0000      0.907 0.000 1.000  0 0.000 0.000 0.000
#> SRR2050464     3  0.0000      1.000 0.000 0.000  1 0.000 0.000 0.000
#> SRR2050463     4  0.0937      0.893 0.000 0.000  0 0.960 0.000 0.040
#> SRR2050462     2  0.0000      0.907 0.000 1.000  0 0.000 0.000 0.000
#> SRR2050461     3  0.0000      1.000 0.000 0.000  1 0.000 0.000 0.000
#> SRR2050460     4  0.2664      0.850 0.000 0.000  0 0.816 0.000 0.184
#> SRR2050459     2  0.0260      0.902 0.000 0.992  0 0.000 0.008 0.000
#> SRR2050458     3  0.0000      1.000 0.000 0.000  1 0.000 0.000 0.000
#> SRR2050457     4  0.1501      0.887 0.000 0.000  0 0.924 0.000 0.076
#> SRR2050456     2  0.0000      0.907 0.000 1.000  0 0.000 0.000 0.000
#> SRR2050455     3  0.0000      1.000 0.000 0.000  1 0.000 0.000 0.000
#> SRR2050454     4  0.1387      0.890 0.000 0.000  0 0.932 0.000 0.068
#> SRR2050453     2  0.0000      0.907 0.000 1.000  0 0.000 0.000 0.000
#> SRR2050452     3  0.0000      1.000 0.000 0.000  1 0.000 0.000 0.000
#> SRR2050451     4  0.1327      0.890 0.000 0.000  0 0.936 0.000 0.064
#> SRR2050450     2  0.0000      0.907 0.000 1.000  0 0.000 0.000 0.000
#> SRR2050449     3  0.0000      1.000 0.000 0.000  1 0.000 0.000 0.000
#> SRR2050448     4  0.1556      0.887 0.000 0.000  0 0.920 0.000 0.080
#> SRR2050447     3  0.0000      1.000 0.000 0.000  1 0.000 0.000 0.000
#> SRR2050446     4  0.3470      0.834 0.000 0.000  0 0.796 0.052 0.152
#> SRR2050445     2  0.0000      0.907 0.000 1.000  0 0.000 0.000 0.000
#> SRR2050444     3  0.0000      1.000 0.000 0.000  1 0.000 0.000 0.000
#> SRR2050443     4  0.1387      0.890 0.000 0.000  0 0.932 0.000 0.068
#> SRR2050442     2  0.3684      0.518 0.000 0.628  0 0.000 0.372 0.000
#> SRR2050441     3  0.0000      1.000 0.000 0.000  1 0.000 0.000 0.000
#> SRR2050440     4  0.4095      0.794 0.000 0.000  0 0.728 0.064 0.208
#> SRR2050439     2  0.3695      0.512 0.000 0.624  0 0.000 0.376 0.000
#> SRR2050438     3  0.0000      1.000 0.000 0.000  1 0.000 0.000 0.000
#> SRR2050437     4  0.4095      0.794 0.000 0.000  0 0.728 0.064 0.208
#> SRR2050436     5  0.0000      1.000 0.000 0.000  0 0.000 1.000 0.000
#> SRR2050435     3  0.0000      1.000 0.000 0.000  1 0.000 0.000 0.000
#> SRR2050434     5  0.0000      1.000 0.000 0.000  0 0.000 1.000 0.000
#> SRR2050433     2  0.0000      0.907 0.000 1.000  0 0.000 0.000 0.000
#> SRR2050432     1  0.0000      1.000 1.000 0.000  0 0.000 0.000 0.000
#> SRR2050431     4  0.4008      0.802 0.000 0.000  0 0.740 0.064 0.196
#> SRR2050430     6  0.4414      0.888 0.260 0.000  0 0.000 0.064 0.676
#> SRR2050429     6  0.4098      0.939 0.292 0.000  0 0.000 0.032 0.676

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

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

collect_plots(res)

plot of chunk ATC-NMF-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.971           0.955       0.980         0.4517 0.543   0.543
#> 3 3 0.997           0.980       0.990         0.4277 0.716   0.520
#> 4 4 0.793           0.809       0.887         0.1507 0.848   0.594
#> 5 5 0.818           0.736       0.867         0.0590 0.853   0.507
#> 6 6 0.894           0.838       0.908         0.0212 0.960   0.825

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
#> SRR2050410     2  0.0000      0.989 0.000 1.000
#> SRR2050427     1  0.0000      0.960 1.000 0.000
#> SRR2050426     1  0.6531      0.799 0.832 0.168
#> SRR2050425     2  0.0000      0.989 0.000 1.000
#> SRR2050424     1  0.0000      0.960 1.000 0.000
#> SRR2050423     2  0.6343      0.798 0.160 0.840
#> SRR2050422     2  0.0000      0.989 0.000 1.000
#> SRR2050421     1  0.0938      0.954 0.988 0.012
#> SRR2050420     1  0.9358      0.488 0.648 0.352
#> SRR2050419     2  0.0000      0.989 0.000 1.000
#> SRR2050418     2  0.0000      0.989 0.000 1.000
#> SRR2050417     2  0.0000      0.989 0.000 1.000
#> SRR2050416     2  0.0000      0.989 0.000 1.000
#> SRR2050415     1  0.0000      0.960 1.000 0.000
#> SRR2050414     2  0.0000      0.989 0.000 1.000
#> SRR2050413     2  0.0000      0.989 0.000 1.000
#> SRR2050412     1  0.9000      0.565 0.684 0.316
#> SRR2050411     2  0.0000      0.989 0.000 1.000
#> SRR2050409     2  0.0000      0.989 0.000 1.000
#> SRR2050408     2  0.0000      0.989 0.000 1.000
#> SRR2050407     2  0.0000      0.989 0.000 1.000
#> SRR2050406     1  0.0000      0.960 1.000 0.000
#> SRR2050405     2  0.0000      0.989 0.000 1.000
#> SRR2050404     2  0.0000      0.989 0.000 1.000
#> SRR2050403     2  0.0000      0.989 0.000 1.000
#> SRR2050402     2  0.0000      0.989 0.000 1.000
#> SRR2050401     2  0.8861      0.539 0.304 0.696
#> SRR2050400     2  0.0000      0.989 0.000 1.000
#> SRR2050399     2  0.0000      0.989 0.000 1.000
#> SRR2050398     1  0.0938      0.954 0.988 0.012
#> SRR2050397     2  0.0000      0.989 0.000 1.000
#> SRR2050396     1  0.0000      0.960 1.000 0.000
#> SRR2050395     2  0.0000      0.989 0.000 1.000
#> SRR2050394     2  0.0000      0.989 0.000 1.000
#> SRR2050393     1  0.0000      0.960 1.000 0.000
#> SRR2050392     2  0.0000      0.989 0.000 1.000
#> SRR2050465     2  0.0000      0.989 0.000 1.000
#> SRR2050464     1  0.0000      0.960 1.000 0.000
#> SRR2050463     2  0.0000      0.989 0.000 1.000
#> SRR2050462     2  0.0000      0.989 0.000 1.000
#> SRR2050461     1  0.0000      0.960 1.000 0.000
#> SRR2050460     2  0.0000      0.989 0.000 1.000
#> SRR2050459     2  0.0000      0.989 0.000 1.000
#> SRR2050458     1  0.0000      0.960 1.000 0.000
#> SRR2050457     2  0.0000      0.989 0.000 1.000
#> SRR2050456     2  0.0000      0.989 0.000 1.000
#> SRR2050455     1  0.0000      0.960 1.000 0.000
#> SRR2050454     2  0.0000      0.989 0.000 1.000
#> SRR2050453     2  0.0000      0.989 0.000 1.000
#> SRR2050452     1  0.0000      0.960 1.000 0.000
#> SRR2050451     2  0.0000      0.989 0.000 1.000
#> SRR2050450     2  0.0000      0.989 0.000 1.000
#> SRR2050449     1  0.0000      0.960 1.000 0.000
#> SRR2050448     2  0.0000      0.989 0.000 1.000
#> SRR2050447     1  0.0000      0.960 1.000 0.000
#> SRR2050446     2  0.0000      0.989 0.000 1.000
#> SRR2050445     2  0.0000      0.989 0.000 1.000
#> SRR2050444     1  0.0000      0.960 1.000 0.000
#> SRR2050443     2  0.0000      0.989 0.000 1.000
#> SRR2050442     2  0.0000      0.989 0.000 1.000
#> SRR2050441     1  0.0000      0.960 1.000 0.000
#> SRR2050440     1  0.1633      0.946 0.976 0.024
#> SRR2050439     2  0.0000      0.989 0.000 1.000
#> SRR2050438     1  0.0000      0.960 1.000 0.000
#> SRR2050437     1  0.2603      0.930 0.956 0.044
#> SRR2050436     2  0.0000      0.989 0.000 1.000
#> SRR2050435     1  0.0000      0.960 1.000 0.000
#> SRR2050434     2  0.0000      0.989 0.000 1.000
#> SRR2050433     2  0.0000      0.989 0.000 1.000
#> SRR2050432     1  0.0938      0.954 0.988 0.012
#> SRR2050431     2  0.0000      0.989 0.000 1.000
#> SRR2050430     2  0.0938      0.978 0.012 0.988
#> SRR2050429     2  0.1184      0.974 0.016 0.984

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>            class entropy silhouette    p1    p2    p3
#> SRR2050410     2  0.0000      0.985 0.000 1.000 0.000
#> SRR2050427     1  0.0000      0.985 1.000 0.000 0.000
#> SRR2050426     1  0.0000      0.985 1.000 0.000 0.000
#> SRR2050425     2  0.0000      0.985 0.000 1.000 0.000
#> SRR2050424     3  0.0000      1.000 0.000 0.000 1.000
#> SRR2050423     1  0.3644      0.848 0.872 0.124 0.004
#> SRR2050422     1  0.1860      0.937 0.948 0.052 0.000
#> SRR2050421     1  0.0000      0.985 1.000 0.000 0.000
#> SRR2050420     1  0.0000      0.985 1.000 0.000 0.000
#> SRR2050419     2  0.0000      0.985 0.000 1.000 0.000
#> SRR2050418     1  0.0000      0.985 1.000 0.000 0.000
#> SRR2050417     1  0.1643      0.945 0.956 0.044 0.000
#> SRR2050416     2  0.0000      0.985 0.000 1.000 0.000
#> SRR2050415     3  0.0000      1.000 0.000 0.000 1.000
#> SRR2050414     2  0.0000      0.985 0.000 1.000 0.000
#> SRR2050413     2  0.2625      0.922 0.084 0.916 0.000
#> SRR2050412     1  0.0000      0.985 1.000 0.000 0.000
#> SRR2050411     1  0.0000      0.985 1.000 0.000 0.000
#> SRR2050409     2  0.0000      0.985 0.000 1.000 0.000
#> SRR2050408     1  0.0000      0.985 1.000 0.000 0.000
#> SRR2050407     2  0.0000      0.985 0.000 1.000 0.000
#> SRR2050406     3  0.0000      1.000 0.000 0.000 1.000
#> SRR2050405     2  0.0000      0.985 0.000 1.000 0.000
#> SRR2050404     2  0.0000      0.985 0.000 1.000 0.000
#> SRR2050403     1  0.0000      0.985 1.000 0.000 0.000
#> SRR2050402     2  0.0000      0.985 0.000 1.000 0.000
#> SRR2050401     1  0.0000      0.985 1.000 0.000 0.000
#> SRR2050400     1  0.0000      0.985 1.000 0.000 0.000
#> SRR2050399     2  0.0892      0.973 0.020 0.980 0.000
#> SRR2050398     1  0.0000      0.985 1.000 0.000 0.000
#> SRR2050397     1  0.0000      0.985 1.000 0.000 0.000
#> SRR2050396     3  0.0000      1.000 0.000 0.000 1.000
#> SRR2050395     2  0.0237      0.983 0.004 0.996 0.000
#> SRR2050394     2  0.0000      0.985 0.000 1.000 0.000
#> SRR2050393     3  0.0000      1.000 0.000 0.000 1.000
#> SRR2050392     2  0.0000      0.985 0.000 1.000 0.000
#> SRR2050465     2  0.0000      0.985 0.000 1.000 0.000
#> SRR2050464     3  0.0000      1.000 0.000 0.000 1.000
#> SRR2050463     2  0.0424      0.981 0.008 0.992 0.000
#> SRR2050462     2  0.0000      0.985 0.000 1.000 0.000
#> SRR2050461     3  0.0000      1.000 0.000 0.000 1.000
#> SRR2050460     1  0.0424      0.979 0.992 0.008 0.000
#> SRR2050459     2  0.0000      0.985 0.000 1.000 0.000
#> SRR2050458     3  0.0000      1.000 0.000 0.000 1.000
#> SRR2050457     2  0.0000      0.985 0.000 1.000 0.000
#> SRR2050456     2  0.0000      0.985 0.000 1.000 0.000
#> SRR2050455     3  0.0000      1.000 0.000 0.000 1.000
#> SRR2050454     2  0.0000      0.985 0.000 1.000 0.000
#> SRR2050453     2  0.0000      0.985 0.000 1.000 0.000
#> SRR2050452     3  0.0000      1.000 0.000 0.000 1.000
#> SRR2050451     2  0.2165      0.940 0.064 0.936 0.000
#> SRR2050450     2  0.0000      0.985 0.000 1.000 0.000
#> SRR2050449     3  0.0000      1.000 0.000 0.000 1.000
#> SRR2050448     2  0.2066      0.943 0.060 0.940 0.000
#> SRR2050447     3  0.0000      1.000 0.000 0.000 1.000
#> SRR2050446     2  0.2711      0.918 0.088 0.912 0.000
#> SRR2050445     2  0.0000      0.985 0.000 1.000 0.000
#> SRR2050444     3  0.0000      1.000 0.000 0.000 1.000
#> SRR2050443     2  0.0000      0.985 0.000 1.000 0.000
#> SRR2050442     2  0.0000      0.985 0.000 1.000 0.000
#> SRR2050441     3  0.0000      1.000 0.000 0.000 1.000
#> SRR2050440     1  0.1643      0.945 0.956 0.000 0.044
#> SRR2050439     2  0.0000      0.985 0.000 1.000 0.000
#> SRR2050438     3  0.0000      1.000 0.000 0.000 1.000
#> SRR2050437     1  0.0000      0.985 1.000 0.000 0.000
#> SRR2050436     2  0.2711      0.918 0.088 0.912 0.000
#> SRR2050435     3  0.0000      1.000 0.000 0.000 1.000
#> SRR2050434     2  0.1964      0.946 0.056 0.944 0.000
#> SRR2050433     2  0.0000      0.985 0.000 1.000 0.000
#> SRR2050432     1  0.0000      0.985 1.000 0.000 0.000
#> SRR2050431     1  0.0000      0.985 1.000 0.000 0.000
#> SRR2050430     1  0.0000      0.985 1.000 0.000 0.000
#> SRR2050429     1  0.0000      0.985 1.000 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> SRR2050410     4  0.4730     0.5934 0.000 0.364 0.000 0.636
#> SRR2050427     1  0.0000     0.9450 1.000 0.000 0.000 0.000
#> SRR2050426     1  0.0000     0.9450 1.000 0.000 0.000 0.000
#> SRR2050425     4  0.3942     0.7287 0.000 0.236 0.000 0.764
#> SRR2050424     3  0.0000     1.0000 0.000 0.000 1.000 0.000
#> SRR2050423     1  0.7396     0.4047 0.516 0.000 0.216 0.268
#> SRR2050422     4  0.0469     0.7091 0.012 0.000 0.000 0.988
#> SRR2050421     1  0.0000     0.9450 1.000 0.000 0.000 0.000
#> SRR2050420     1  0.0000     0.9450 1.000 0.000 0.000 0.000
#> SRR2050419     2  0.0707     0.8178 0.000 0.980 0.000 0.020
#> SRR2050418     1  0.0000     0.9450 1.000 0.000 0.000 0.000
#> SRR2050417     1  0.0000     0.9450 1.000 0.000 0.000 0.000
#> SRR2050416     4  0.3610     0.7360 0.000 0.200 0.000 0.800
#> SRR2050415     3  0.0000     1.0000 0.000 0.000 1.000 0.000
#> SRR2050414     4  0.4477     0.6769 0.000 0.312 0.000 0.688
#> SRR2050413     4  0.0188     0.7179 0.000 0.004 0.000 0.996
#> SRR2050412     1  0.0000     0.9450 1.000 0.000 0.000 0.000
#> SRR2050411     1  0.0000     0.9450 1.000 0.000 0.000 0.000
#> SRR2050409     2  0.4955     0.0375 0.000 0.556 0.000 0.444
#> SRR2050408     1  0.0000     0.9450 1.000 0.000 0.000 0.000
#> SRR2050407     2  0.0921     0.8181 0.000 0.972 0.000 0.028
#> SRR2050406     3  0.0000     1.0000 0.000 0.000 1.000 0.000
#> SRR2050405     2  0.0000     0.8128 0.000 1.000 0.000 0.000
#> SRR2050404     2  0.4477     0.5077 0.000 0.688 0.000 0.312
#> SRR2050403     1  0.0000     0.9450 1.000 0.000 0.000 0.000
#> SRR2050402     4  0.4222     0.7114 0.000 0.272 0.000 0.728
#> SRR2050401     1  0.0000     0.9450 1.000 0.000 0.000 0.000
#> SRR2050400     1  0.0000     0.9450 1.000 0.000 0.000 0.000
#> SRR2050399     4  0.3907     0.7302 0.000 0.232 0.000 0.768
#> SRR2050398     1  0.0000     0.9450 1.000 0.000 0.000 0.000
#> SRR2050397     1  0.0000     0.9450 1.000 0.000 0.000 0.000
#> SRR2050396     3  0.0000     1.0000 0.000 0.000 1.000 0.000
#> SRR2050395     2  0.0336     0.8106 0.008 0.992 0.000 0.000
#> SRR2050394     2  0.3266     0.7370 0.000 0.832 0.000 0.168
#> SRR2050393     3  0.0000     1.0000 0.000 0.000 1.000 0.000
#> SRR2050392     2  0.0000     0.8128 0.000 1.000 0.000 0.000
#> SRR2050465     4  0.4790     0.5622 0.000 0.380 0.000 0.620
#> SRR2050464     3  0.0000     1.0000 0.000 0.000 1.000 0.000
#> SRR2050463     4  0.4624     0.6393 0.000 0.340 0.000 0.660
#> SRR2050462     2  0.4830     0.2649 0.000 0.608 0.000 0.392
#> SRR2050461     3  0.0000     1.0000 0.000 0.000 1.000 0.000
#> SRR2050460     1  0.3975     0.7039 0.760 0.000 0.000 0.240
#> SRR2050459     2  0.3975     0.6521 0.000 0.760 0.000 0.240
#> SRR2050458     3  0.0000     1.0000 0.000 0.000 1.000 0.000
#> SRR2050457     2  0.0707     0.8060 0.020 0.980 0.000 0.000
#> SRR2050456     2  0.0921     0.8181 0.000 0.972 0.000 0.028
#> SRR2050455     3  0.0000     1.0000 0.000 0.000 1.000 0.000
#> SRR2050454     2  0.0000     0.8128 0.000 1.000 0.000 0.000
#> SRR2050453     2  0.3726     0.6941 0.000 0.788 0.000 0.212
#> SRR2050452     3  0.0000     1.0000 0.000 0.000 1.000 0.000
#> SRR2050451     4  0.4500     0.6724 0.000 0.316 0.000 0.684
#> SRR2050450     2  0.3649     0.7034 0.000 0.796 0.000 0.204
#> SRR2050449     3  0.0000     1.0000 0.000 0.000 1.000 0.000
#> SRR2050448     4  0.4304     0.7027 0.000 0.284 0.000 0.716
#> SRR2050447     3  0.0000     1.0000 0.000 0.000 1.000 0.000
#> SRR2050446     4  0.6127     0.6617 0.108 0.228 0.000 0.664
#> SRR2050445     2  0.1022     0.8171 0.000 0.968 0.000 0.032
#> SRR2050444     3  0.0000     1.0000 0.000 0.000 1.000 0.000
#> SRR2050443     2  0.0000     0.8128 0.000 1.000 0.000 0.000
#> SRR2050442     4  0.0817     0.7227 0.000 0.024 0.000 0.976
#> SRR2050441     3  0.0000     1.0000 0.000 0.000 1.000 0.000
#> SRR2050440     4  0.3975     0.4996 0.000 0.000 0.240 0.760
#> SRR2050439     4  0.0000     0.7162 0.000 0.000 0.000 1.000
#> SRR2050438     3  0.0000     1.0000 0.000 0.000 1.000 0.000
#> SRR2050437     4  0.0376     0.7113 0.004 0.000 0.004 0.992
#> SRR2050436     4  0.0000     0.7162 0.000 0.000 0.000 1.000
#> SRR2050435     3  0.0000     1.0000 0.000 0.000 1.000 0.000
#> SRR2050434     4  0.0000     0.7162 0.000 0.000 0.000 1.000
#> SRR2050433     4  0.4776     0.5724 0.000 0.376 0.000 0.624
#> SRR2050432     1  0.0000     0.9450 1.000 0.000 0.000 0.000
#> SRR2050431     1  0.0000     0.9450 1.000 0.000 0.000 0.000
#> SRR2050430     1  0.3688     0.7934 0.792 0.000 0.000 0.208
#> SRR2050429     1  0.3764     0.7861 0.784 0.000 0.000 0.216

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>            class entropy silhouette    p1    p2    p3    p4    p5
#> SRR2050410     2  0.2798     0.7928 0.000 0.852 0.000 0.008 0.140
#> SRR2050427     1  0.0566     0.9491 0.984 0.000 0.000 0.004 0.012
#> SRR2050426     1  0.1403     0.9258 0.952 0.000 0.000 0.024 0.024
#> SRR2050425     2  0.2929     0.7704 0.000 0.820 0.000 0.000 0.180
#> SRR2050424     3  0.0000     0.9997 0.000 0.000 1.000 0.000 0.000
#> SRR2050423     5  0.6441     0.2600 0.052 0.008 0.056 0.312 0.572
#> SRR2050422     2  0.5146     0.3317 0.020 0.536 0.000 0.012 0.432
#> SRR2050421     1  0.0000     0.9538 1.000 0.000 0.000 0.000 0.000
#> SRR2050420     1  0.0000     0.9538 1.000 0.000 0.000 0.000 0.000
#> SRR2050419     2  0.2068     0.7367 0.000 0.904 0.000 0.092 0.004
#> SRR2050418     1  0.0798     0.9454 0.976 0.000 0.000 0.008 0.016
#> SRR2050417     1  0.0613     0.9507 0.984 0.004 0.000 0.008 0.004
#> SRR2050416     2  0.3586     0.6991 0.000 0.736 0.000 0.000 0.264
#> SRR2050415     3  0.0000     0.9997 0.000 0.000 1.000 0.000 0.000
#> SRR2050414     5  0.5328     0.2537 0.000 0.064 0.000 0.352 0.584
#> SRR2050413     2  0.3838     0.6712 0.000 0.716 0.000 0.004 0.280
#> SRR2050412     1  0.0290     0.9517 0.992 0.000 0.000 0.000 0.008
#> SRR2050411     1  0.0162     0.9533 0.996 0.000 0.000 0.000 0.004
#> SRR2050409     2  0.1877     0.8052 0.000 0.924 0.000 0.012 0.064
#> SRR2050408     1  0.1410     0.9114 0.940 0.000 0.000 0.000 0.060
#> SRR2050407     2  0.1638     0.7573 0.000 0.932 0.000 0.064 0.004
#> SRR2050406     3  0.0000     0.9997 0.000 0.000 1.000 0.000 0.000
#> SRR2050405     4  0.2149     0.6378 0.000 0.048 0.000 0.916 0.036
#> SRR2050404     2  0.1357     0.8047 0.000 0.948 0.000 0.004 0.048
#> SRR2050403     1  0.0162     0.9533 0.996 0.000 0.000 0.000 0.004
#> SRR2050402     2  0.3123     0.7801 0.000 0.828 0.000 0.012 0.160
#> SRR2050401     1  0.0404     0.9499 0.988 0.000 0.000 0.000 0.012
#> SRR2050400     1  0.0798     0.9453 0.976 0.000 0.000 0.016 0.008
#> SRR2050399     2  0.3715     0.6955 0.000 0.736 0.000 0.004 0.260
#> SRR2050398     1  0.0000     0.9538 1.000 0.000 0.000 0.000 0.000
#> SRR2050397     1  0.0162     0.9533 0.996 0.000 0.000 0.000 0.004
#> SRR2050396     3  0.0000     0.9997 0.000 0.000 1.000 0.000 0.000
#> SRR2050395     4  0.1872     0.6291 0.000 0.020 0.000 0.928 0.052
#> SRR2050394     2  0.3789     0.5791 0.000 0.760 0.000 0.224 0.016
#> SRR2050393     3  0.0162     0.9957 0.000 0.000 0.996 0.004 0.000
#> SRR2050392     4  0.2873     0.6034 0.000 0.120 0.000 0.860 0.020
#> SRR2050465     2  0.2488     0.7950 0.000 0.872 0.000 0.004 0.124
#> SRR2050464     3  0.0000     0.9997 0.000 0.000 1.000 0.000 0.000
#> SRR2050463     4  0.6710     0.0721 0.000 0.252 0.000 0.408 0.340
#> SRR2050462     2  0.1768     0.8051 0.000 0.924 0.000 0.004 0.072
#> SRR2050461     3  0.0000     0.9997 0.000 0.000 1.000 0.000 0.000
#> SRR2050460     5  0.8268     0.0294 0.188 0.192 0.000 0.220 0.400
#> SRR2050459     2  0.0451     0.7925 0.000 0.988 0.000 0.008 0.004
#> SRR2050458     3  0.0000     0.9997 0.000 0.000 1.000 0.000 0.000
#> SRR2050457     4  0.5260     0.5668 0.076 0.136 0.000 0.736 0.052
#> SRR2050456     2  0.2890     0.6662 0.000 0.836 0.000 0.160 0.004
#> SRR2050455     3  0.0000     0.9997 0.000 0.000 1.000 0.000 0.000
#> SRR2050454     4  0.1732     0.6374 0.000 0.080 0.000 0.920 0.000
#> SRR2050453     2  0.0807     0.7941 0.000 0.976 0.000 0.012 0.012
#> SRR2050452     3  0.0000     0.9997 0.000 0.000 1.000 0.000 0.000
#> SRR2050451     4  0.6596     0.2104 0.008 0.416 0.000 0.416 0.160
#> SRR2050450     2  0.0451     0.7925 0.000 0.988 0.000 0.008 0.004
#> SRR2050449     3  0.0000     0.9997 0.000 0.000 1.000 0.000 0.000
#> SRR2050448     4  0.6536     0.2396 0.000 0.392 0.000 0.412 0.196
#> SRR2050447     3  0.0000     0.9997 0.000 0.000 1.000 0.000 0.000
#> SRR2050446     2  0.7348    -0.2171 0.028 0.400 0.000 0.288 0.284
#> SRR2050445     2  0.2124     0.7347 0.000 0.900 0.000 0.096 0.004
#> SRR2050444     3  0.0000     0.9997 0.000 0.000 1.000 0.000 0.000
#> SRR2050443     4  0.2632     0.6442 0.000 0.072 0.000 0.888 0.040
#> SRR2050442     5  0.4219     0.1314 0.000 0.416 0.000 0.000 0.584
#> SRR2050441     3  0.0000     0.9997 0.000 0.000 1.000 0.000 0.000
#> SRR2050440     5  0.2912     0.5873 0.040 0.020 0.032 0.012 0.896
#> SRR2050439     5  0.3707     0.4317 0.000 0.284 0.000 0.000 0.716
#> SRR2050438     3  0.0000     0.9997 0.000 0.000 1.000 0.000 0.000
#> SRR2050437     5  0.2243     0.5933 0.056 0.016 0.000 0.012 0.916
#> SRR2050436     5  0.2230     0.5949 0.000 0.116 0.000 0.000 0.884
#> SRR2050435     3  0.0000     0.9997 0.000 0.000 1.000 0.000 0.000
#> SRR2050434     5  0.2612     0.5849 0.000 0.124 0.000 0.008 0.868
#> SRR2050433     2  0.2719     0.7905 0.000 0.852 0.000 0.004 0.144
#> SRR2050432     1  0.0000     0.9538 1.000 0.000 0.000 0.000 0.000
#> SRR2050431     1  0.0671     0.9476 0.980 0.000 0.000 0.016 0.004
#> SRR2050430     1  0.4268     0.1661 0.556 0.000 0.000 0.000 0.444
#> SRR2050429     5  0.4467     0.3352 0.344 0.000 0.000 0.016 0.640

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>            class entropy silhouette    p1    p2    p3    p4    p5 p6
#> SRR2050410     2  0.2060     0.8711 0.000 0.900 0.000 0.000 0.016 NA
#> SRR2050427     1  0.0713     0.9436 0.972 0.000 0.000 0.000 0.000 NA
#> SRR2050426     1  0.1196     0.9314 0.952 0.000 0.000 0.000 0.008 NA
#> SRR2050425     2  0.1930     0.8777 0.000 0.916 0.000 0.000 0.036 NA
#> SRR2050424     3  0.0000     0.9994 0.000 0.000 1.000 0.000 0.000 NA
#> SRR2050423     4  0.4151     0.3196 0.004 0.000 0.000 0.576 0.412 NA
#> SRR2050422     2  0.5568     0.5752 0.004 0.664 0.000 0.064 0.096 NA
#> SRR2050421     1  0.0146     0.9498 0.996 0.000 0.000 0.000 0.004 NA
#> SRR2050420     1  0.0000     0.9508 1.000 0.000 0.000 0.000 0.000 NA
#> SRR2050419     2  0.0865     0.8844 0.000 0.964 0.000 0.000 0.000 NA
#> SRR2050418     1  0.0458     0.9476 0.984 0.000 0.000 0.000 0.000 NA
#> SRR2050417     1  0.0363     0.9487 0.988 0.000 0.000 0.000 0.000 NA
#> SRR2050416     2  0.2448     0.8455 0.000 0.884 0.000 0.000 0.064 NA
#> SRR2050415     3  0.0000     0.9994 0.000 0.000 1.000 0.000 0.000 NA
#> SRR2050414     4  0.3629     0.5985 0.000 0.000 0.000 0.712 0.276 NA
#> SRR2050413     2  0.4251     0.6988 0.000 0.744 0.000 0.012 0.068 NA
#> SRR2050412     1  0.0146     0.9498 0.996 0.000 0.000 0.000 0.004 NA
#> SRR2050411     1  0.0000     0.9508 1.000 0.000 0.000 0.000 0.000 NA
#> SRR2050409     2  0.1757     0.8741 0.000 0.916 0.000 0.000 0.008 NA
#> SRR2050408     1  0.2121     0.8685 0.892 0.000 0.000 0.000 0.096 NA
#> SRR2050407     2  0.1327     0.8786 0.000 0.936 0.000 0.000 0.000 NA
#> SRR2050406     3  0.0000     0.9994 0.000 0.000 1.000 0.000 0.000 NA
#> SRR2050405     4  0.2201     0.7808 0.000 0.000 0.000 0.896 0.028 NA
#> SRR2050404     2  0.0790     0.8823 0.000 0.968 0.000 0.000 0.000 NA
#> SRR2050403     1  0.0000     0.9508 1.000 0.000 0.000 0.000 0.000 NA
#> SRR2050402     2  0.1176     0.8799 0.000 0.956 0.000 0.000 0.024 NA
#> SRR2050401     1  0.0692     0.9395 0.976 0.000 0.000 0.000 0.020 NA
#> SRR2050400     1  0.0790     0.9416 0.968 0.000 0.000 0.000 0.000 NA
#> SRR2050399     2  0.3159     0.8032 0.000 0.836 0.000 0.004 0.052 NA
#> SRR2050398     1  0.0000     0.9508 1.000 0.000 0.000 0.000 0.000 NA
#> SRR2050397     1  0.0000     0.9508 1.000 0.000 0.000 0.000 0.000 NA
#> SRR2050396     3  0.0000     0.9994 0.000 0.000 1.000 0.000 0.000 NA
#> SRR2050395     4  0.0922     0.7963 0.004 0.000 0.000 0.968 0.004 NA
#> SRR2050394     2  0.2632     0.8241 0.000 0.832 0.000 0.000 0.004 NA
#> SRR2050393     3  0.0260     0.9915 0.000 0.000 0.992 0.008 0.000 NA
#> SRR2050392     4  0.3520     0.7247 0.000 0.000 0.000 0.776 0.036 NA
#> SRR2050465     2  0.0972     0.8823 0.000 0.964 0.000 0.000 0.008 NA
#> SRR2050464     3  0.0000     0.9994 0.000 0.000 1.000 0.000 0.000 NA
#> SRR2050463     4  0.2542     0.7979 0.000 0.000 0.000 0.876 0.044 NA
#> SRR2050462     2  0.0363     0.8858 0.000 0.988 0.000 0.000 0.000 NA
#> SRR2050461     3  0.0000     0.9994 0.000 0.000 1.000 0.000 0.000 NA
#> SRR2050460     4  0.4624     0.7286 0.004 0.004 0.000 0.716 0.124 NA
#> SRR2050459     2  0.0260     0.8862 0.000 0.992 0.000 0.000 0.000 NA
#> SRR2050458     3  0.0000     0.9994 0.000 0.000 1.000 0.000 0.000 NA
#> SRR2050457     4  0.4584     0.7136 0.036 0.044 0.000 0.740 0.008 NA
#> SRR2050456     2  0.2003     0.8587 0.000 0.884 0.000 0.000 0.000 NA
#> SRR2050455     3  0.0000     0.9994 0.000 0.000 1.000 0.000 0.000 NA
#> SRR2050454     4  0.2121     0.7787 0.000 0.000 0.000 0.892 0.012 NA
#> SRR2050453     2  0.0790     0.8823 0.000 0.968 0.000 0.000 0.000 NA
#> SRR2050452     3  0.0000     0.9994 0.000 0.000 1.000 0.000 0.000 NA
#> SRR2050451     4  0.3419     0.7775 0.000 0.004 0.000 0.804 0.040 NA
#> SRR2050450     2  0.0363     0.8855 0.000 0.988 0.000 0.000 0.000 NA
#> SRR2050449     3  0.0000     0.9994 0.000 0.000 1.000 0.000 0.000 NA
#> SRR2050448     4  0.3370     0.7786 0.000 0.004 0.000 0.812 0.044 NA
#> SRR2050447     3  0.0000     0.9994 0.000 0.000 1.000 0.000 0.000 NA
#> SRR2050446     4  0.4117     0.7487 0.000 0.004 0.000 0.752 0.084 NA
#> SRR2050445     2  0.1610     0.8729 0.000 0.916 0.000 0.000 0.000 NA
#> SRR2050444     3  0.0000     0.9994 0.000 0.000 1.000 0.000 0.000 NA
#> SRR2050443     4  0.0363     0.7993 0.000 0.000 0.000 0.988 0.000 NA
#> SRR2050442     2  0.5111     0.0163 0.000 0.492 0.000 0.004 0.436 NA
#> SRR2050441     3  0.0000     0.9994 0.000 0.000 1.000 0.000 0.000 NA
#> SRR2050440     5  0.2062     0.7376 0.004 0.000 0.008 0.088 0.900 NA
#> SRR2050439     5  0.4656     0.1372 0.000 0.420 0.000 0.008 0.544 NA
#> SRR2050438     3  0.0000     0.9994 0.000 0.000 1.000 0.000 0.000 NA
#> SRR2050437     5  0.1644     0.7441 0.004 0.000 0.000 0.076 0.920 NA
#> SRR2050436     5  0.2969     0.7409 0.000 0.088 0.000 0.020 0.860 NA
#> SRR2050435     3  0.0000     0.9994 0.000 0.000 1.000 0.000 0.000 NA
#> SRR2050434     5  0.3763     0.7258 0.000 0.044 0.000 0.080 0.816 NA
#> SRR2050433     2  0.1334     0.8842 0.000 0.948 0.000 0.000 0.020 NA
#> SRR2050432     1  0.0000     0.9508 1.000 0.000 0.000 0.000 0.000 NA
#> SRR2050431     1  0.0777     0.9436 0.972 0.000 0.000 0.000 0.004 NA
#> SRR2050430     1  0.3997     0.0799 0.508 0.000 0.000 0.004 0.488 NA
#> SRR2050429     5  0.2847     0.6672 0.120 0.000 0.000 0.016 0.852 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-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