cola Report for recount2:SRP043108

Date: 2019-12-26 00:18:48 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 13890 rows and 80 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] 13890    80

Density distribution

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

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

plot of chunk density-heatmap

Suggest the best k

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

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

suggest_best_k(res_list)
The best k 1-PAC Mean silhouette Concordance Optional k
SD:hclust 2 1.000 1.000 1.000 **
SD:pam 6 1.000 1.000 1.000 ** 2,3,4,5
SD:NMF 2 1.000 0.984 0.988 **
CV:hclust 2 1.000 1.000 1.000 **
CV:pam 5 1.000 0.999 1.000 ** 2,4
MAD:hclust 2 1.000 1.000 1.000 **
ATC:hclust 6 1.000 0.962 1.000 ** 2
ATC:kmeans 2 1.000 1.000 1.000 **
ATC:pam 4 1.000 0.985 0.994 ** 2,3
MAD:skmeans 6 0.982 0.957 0.962 ** 5
SD:skmeans 6 0.977 0.978 0.973 **
MAD:mclust 6 0.972 0.940 0.968 ** 4
CV:mclust 6 0.969 0.960 0.976 ** 4,5
MAD:pam 6 0.963 0.972 0.983 ** 3,4,5
ATC:NMF 2 0.948 0.903 0.959 *
CV:skmeans 6 0.915 0.909 0.934 *
ATC:skmeans 4 0.905 0.951 0.959 *
MAD:NMF 5 0.733 0.825 0.810
SD:mclust 4 0.729 0.851 0.888
CV:NMF 3 0.646 0.902 0.890
ATC:mclust 5 0.546 0.634 0.783
CV:kmeans 5 0.468 0.773 0.739
MAD:kmeans 5 0.461 0.821 0.681
SD:kmeans 5 0.363 0.704 0.579

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

CDF of consensus matrices

Cumulative distribution function curves of consensus matrix for all methods.

collect_plots(res_list, fun = plot_ecdf)

plot of chunk collect-plots

Consensus heatmap

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

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

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

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

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

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

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

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

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

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

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

Membership heatmap

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

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

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

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

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

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

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

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

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

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

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

Signature heatmap

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

Note in following heatmaps, rows are scaled.

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

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

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

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

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

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

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

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

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

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

Statistics table

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

get_stats(res_list, k = 2)
#>             k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> SD:NMF      2 1.000           0.984       0.988          0.148 0.859   0.859
#> CV:NMF      2 0.282           0.599       0.692          0.372 0.502   0.502
#> MAD:NMF     2 0.443           0.771       0.839          0.274 0.859   0.859
#> ATC:NMF     2 0.948           0.903       0.959          0.103 0.904   0.904
#> SD:skmeans  2 0.505           0.849       0.908          0.473 0.547   0.547
#> CV:skmeans  2 0.739           0.782       0.910          0.481 0.502   0.502
#> MAD:skmeans 2 0.792           0.948       0.969          0.504 0.494   0.494
#> ATC:skmeans 2 0.875           0.933       0.964          0.356 0.608   0.608
#> SD:mclust   2 0.394           0.553       0.746          0.390 0.647   0.647
#> CV:mclust   2 0.432           0.534       0.803          0.429 0.585   0.585
#> MAD:mclust  2 0.342           0.695       0.837          0.448 0.596   0.596
#> ATC:mclust  2 0.859           0.965       0.984          0.167 0.859   0.859
#> SD:kmeans   2 0.383           0.862       0.896          0.212 0.859   0.859
#> CV:kmeans   2 0.277           0.752       0.838          0.256 0.859   0.859
#> MAD:kmeans  2 0.168           0.483       0.588          0.345 0.499   0.499
#> ATC:kmeans  2 1.000           1.000       1.000          0.141 0.859   0.859
#> SD:pam      2 1.000           1.000       1.000          0.141 0.859   0.859
#> CV:pam      2 1.000           0.995       0.995          0.145 0.859   0.859
#> MAD:pam     2 0.764           0.901       0.950          0.370 0.676   0.676
#> ATC:pam     2 1.000           1.000       1.000          0.141 0.859   0.859
#> SD:hclust   2 1.000           1.000       1.000          0.141 0.859   0.859
#> CV:hclust   2 1.000           1.000       1.000          0.141 0.859   0.859
#> MAD:hclust  2 1.000           1.000       1.000          0.141 0.859   0.859
#> ATC:hclust  2 1.000           1.000       1.000          0.141 0.859   0.859
get_stats(res_list, k = 3)
#>             k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> SD:NMF      3 0.370           0.723       0.854         2.1775 0.620   0.558
#> CV:NMF      3 0.646           0.902       0.890         0.6350 0.803   0.622
#> MAD:NMF     3 0.666           0.781       0.885         1.0461 0.572   0.502
#> ATC:NMF     3 0.455           0.793       0.884         1.1374 0.951   0.945
#> SD:skmeans  3 0.674           0.798       0.876         0.4123 0.538   0.310
#> CV:skmeans  3 0.711           0.670       0.840         0.3759 0.795   0.613
#> MAD:skmeans 3 0.806           0.954       0.966         0.3280 0.728   0.504
#> ATC:skmeans 3 0.634           0.791       0.835         0.5578 0.848   0.757
#> SD:mclust   3 0.619           0.755       0.868         0.6111 0.500   0.324
#> CV:mclust   3 0.573           0.847       0.879         0.4271 0.618   0.432
#> MAD:mclust  3 0.714           0.866       0.888         0.3452 0.772   0.632
#> ATC:mclust  3 0.418           0.778       0.773         1.7012 0.871   0.850
#> SD:kmeans   3 0.232           0.616       0.666         1.2136 0.706   0.658
#> CV:kmeans   3 0.204           0.698       0.771         0.8210 0.706   0.658
#> MAD:kmeans  3 0.180           0.466       0.622         0.5709 0.555   0.396
#> ATC:kmeans  3 0.499           0.898       0.900         2.2879 0.638   0.579
#> SD:pam      3 1.000           0.994       0.997         2.0955 0.706   0.658
#> CV:pam      3 0.577           0.919       0.933         2.0363 0.706   0.658
#> MAD:pam     3 0.950           0.949       0.959         0.6615 0.708   0.567
#> ATC:pam     3 1.000           0.985       0.994         2.1209 0.706   0.658
#> SD:hclust   3 1.000           0.986       0.999         0.0112 0.998   0.998
#> CV:hclust   3 0.323           0.553       0.757         2.1259 0.744   0.709
#> MAD:hclust  3 1.000           0.961       0.985         0.0132 0.997   0.997
#> ATC:hclust  3 1.000           0.981       0.995         0.0112 0.998   0.998
get_stats(res_list, k = 4)
#>             k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> SD:NMF      4 0.457           0.791       0.793        0.29470 0.720   0.492
#> CV:NMF      4 0.737           0.768       0.772        0.16161 0.977   0.934
#> MAD:NMF     4 0.644           0.797       0.876        0.20306 0.781   0.548
#> ATC:NMF     4 0.353           0.664       0.811        0.62055 0.763   0.724
#> SD:skmeans  4 0.729           0.805       0.781        0.09974 0.939   0.816
#> CV:skmeans  4 0.725           0.828       0.877        0.11847 0.894   0.706
#> MAD:skmeans 4 0.781           0.874       0.868        0.09876 0.939   0.816
#> ATC:skmeans 4 0.905           0.951       0.959        0.26739 0.813   0.618
#> SD:mclust   4 0.729           0.851       0.888        0.16339 0.896   0.699
#> CV:mclust   4 0.958           0.955       0.979        0.10532 0.943   0.849
#> MAD:mclust  4 0.947           0.900       0.945        0.20768 0.824   0.593
#> ATC:mclust  4 0.350           0.620       0.757        0.33662 0.637   0.503
#> SD:kmeans   4 0.309           0.623       0.617        0.31453 0.734   0.530
#> CV:kmeans   4 0.323           0.711       0.727        0.30953 0.825   0.691
#> MAD:kmeans  4 0.372           0.560       0.613        0.22547 0.709   0.480
#> ATC:kmeans  4 0.617           0.729       0.787        0.34073 1.000   1.000
#> SD:pam      4 1.000           0.987       0.986        0.39861 0.825   0.691
#> CV:pam      4 1.000           0.995       0.995        0.38510 0.825   0.691
#> MAD:pam     4 1.000           0.983       0.992        0.18567 0.886   0.703
#> ATC:pam     4 1.000           0.985       0.994        0.22146 0.901   0.826
#> SD:hclust   4 1.000           0.967       0.994        0.00885 0.999   0.999
#> CV:hclust   4 0.315           0.748       0.770        0.31504 0.747   0.606
#> MAD:hclust  4 1.000           0.958       0.989        0.00752 1.000   1.000
#> ATC:hclust  4 1.000           0.975       1.000        0.00885 0.999   0.999
get_stats(res_list, k = 5)
#>             k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> SD:NMF      5 0.715           0.808       0.852        0.12175 0.961   0.889
#> CV:NMF      5 0.736           0.679       0.768        0.09402 0.795   0.451
#> MAD:NMF     5 0.733           0.825       0.810        0.10308 0.919   0.747
#> ATC:NMF     5 0.274           0.614       0.792        0.36992 0.931   0.891
#> SD:skmeans  5 0.793           0.896       0.895        0.07637 0.932   0.746
#> CV:skmeans  5 0.859           0.866       0.915        0.08082 0.882   0.592
#> MAD:skmeans 5 0.913           0.896       0.949        0.08441 0.867   0.562
#> ATC:skmeans 5 0.863           0.950       0.910        0.09537 0.905   0.687
#> SD:mclust   5 0.876           0.894       0.917        0.05798 0.972   0.888
#> CV:mclust   5 0.945           0.920       0.952        0.11298 0.932   0.787
#> MAD:mclust  5 0.776           0.800       0.889        0.04629 0.918   0.720
#> ATC:mclust  5 0.546           0.634       0.783        0.16180 0.704   0.395
#> SD:kmeans   5 0.363           0.704       0.579        0.14570 0.810   0.474
#> CV:kmeans   5 0.468           0.773       0.739        0.16173 0.871   0.670
#> MAD:kmeans  5 0.461           0.821       0.681        0.11233 0.821   0.466
#> ATC:kmeans  5 0.630           0.658       0.763        0.13353 0.813   0.624
#> SD:pam      5 1.000           1.000       1.000        0.24340 0.848   0.612
#> CV:pam      5 1.000           0.999       1.000        0.24619 0.848   0.612
#> MAD:pam     5 0.913           0.874       0.895        0.07416 0.902   0.652
#> ATC:pam     5 0.908           0.914       0.960        0.05382 0.998   0.997
#> SD:hclust   5 1.000           0.963       1.000        0.00658 0.999   0.999
#> CV:hclust   5 0.481           0.856       0.823        0.12048 0.871   0.670
#> MAD:hclust  5 1.000           0.963       1.000        0.00591 0.999   0.999
#> ATC:hclust  5 0.861           0.932       0.983        0.18360 0.999   0.999
get_stats(res_list, k = 6)
#>             k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> SD:NMF      6 0.709           0.777       0.748        0.08911 0.919   0.748
#> CV:NMF      6 0.885           0.954       0.913        0.05243 0.914   0.640
#> MAD:NMF     6 0.853           0.949       0.890        0.07348 0.932   0.714
#> ATC:NMF     6 0.306           0.608       0.757        0.30843 0.758   0.580
#> SD:skmeans  6 0.977           0.978       0.973        0.04737 0.970   0.849
#> CV:skmeans  6 0.915           0.909       0.934        0.03957 0.932   0.684
#> MAD:skmeans 6 0.982           0.957       0.962        0.04056 0.966   0.833
#> ATC:skmeans 6 0.848           0.880       0.861        0.04990 1.000   1.000
#> SD:mclust   6 0.899           0.903       0.943        0.07282 0.943   0.747
#> CV:mclust   6 0.969           0.960       0.976        0.10054 0.919   0.678
#> MAD:mclust  6 0.972           0.940       0.968        0.08439 0.883   0.554
#> ATC:mclust  6 0.595           0.585       0.795        0.00257 0.910   0.755
#> SD:kmeans   6 0.695           0.891       0.804        0.10173 0.939   0.738
#> CV:kmeans   6 0.631           0.750       0.728        0.06570 0.841   0.517
#> MAD:kmeans  6 0.670           0.911       0.814        0.06459 0.977   0.882
#> ATC:kmeans  6 0.638           0.780       0.769        0.07829 0.905   0.700
#> SD:pam      6 1.000           1.000       1.000        0.08973 0.932   0.714
#> CV:pam      6 0.885           0.855       0.905        0.05851 0.974   0.893
#> MAD:pam     6 0.963           0.972       0.983        0.06173 0.971   0.851
#> ATC:pam     6 0.894           0.864       0.941        0.04140 0.999   0.997
#> SD:hclust   6 1.000           0.926       0.978        0.08143 1.000   1.000
#> CV:hclust   6 0.493           0.885       0.834        0.07880 0.962   0.855
#> MAD:hclust  6 1.000           0.935       0.992        0.03805 0.999   0.999
#> ATC:hclust  6 1.000           0.963       1.000        0.60609 0.871   0.849

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

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

collect_plots(res)

plot of chunk SD-hclust-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2     1           1.000       1.000        0.14137 0.859   0.859
#> 3 3     1           0.986       0.999        0.01118 0.998   0.998
#> 4 4     1           0.967       0.994        0.00885 0.999   0.999
#> 5 5     1           0.963       1.000        0.00658 0.999   0.999
#> 6 6     1           0.926       0.978        0.08143 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] 2

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

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

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>            class entropy silhouette p1 p2
#> SRR1377145     2       0          1  0  1
#> SRR1377146     2       0          1  0  1
#> SRR1377147     2       0          1  0  1
#> SRR1377148     2       0          1  0  1
#> SRR1377153     2       0          1  0  1
#> SRR1377154     2       0          1  0  1
#> SRR1377155     2       0          1  0  1
#> SRR1377156     2       0          1  0  1
#> SRR1377149     2       0          1  0  1
#> SRR1377150     2       0          1  0  1
#> SRR1377151     2       0          1  0  1
#> SRR1377152     2       0          1  0  1
#> SRR1377157     2       0          1  0  1
#> SRR1377158     2       0          1  0  1
#> SRR1377159     2       0          1  0  1
#> SRR1377160     2       0          1  0  1
#> SRR1377161     2       0          1  0  1
#> SRR1377162     2       0          1  0  1
#> SRR1377163     2       0          1  0  1
#> SRR1377164     2       0          1  0  1
#> SRR1377169     2       0          1  0  1
#> SRR1377170     2       0          1  0  1
#> SRR1377171     2       0          1  0  1
#> SRR1377172     2       0          1  0  1
#> SRR1377165     2       0          1  0  1
#> SRR1377166     2       0          1  0  1
#> SRR1377167     2       0          1  0  1
#> SRR1377168     2       0          1  0  1
#> SRR1377173     2       0          1  0  1
#> SRR1377174     2       0          1  0  1
#> SRR1377175     2       0          1  0  1
#> SRR1377176     2       0          1  0  1
#> SRR1377177     2       0          1  0  1
#> SRR1377178     2       0          1  0  1
#> SRR1377179     2       0          1  0  1
#> SRR1377180     2       0          1  0  1
#> SRR1377181     2       0          1  0  1
#> SRR1377182     2       0          1  0  1
#> SRR1377183     2       0          1  0  1
#> SRR1377184     2       0          1  0  1
#> SRR1377185     2       0          1  0  1
#> SRR1377186     2       0          1  0  1
#> SRR1377187     2       0          1  0  1
#> SRR1377188     2       0          1  0  1
#> SRR1377189     2       0          1  0  1
#> SRR1377190     2       0          1  0  1
#> SRR1377191     2       0          1  0  1
#> SRR1377192     2       0          1  0  1
#> SRR1377193     2       0          1  0  1
#> SRR1377194     2       0          1  0  1
#> SRR1377195     1       0          1  1  0
#> SRR1377196     1       0          1  1  0
#> SRR1377197     1       0          1  1  0
#> SRR1377198     1       0          1  1  0
#> SRR1377199     1       0          1  1  0
#> SRR1377200     1       0          1  1  0
#> SRR1377201     2       0          1  0  1
#> SRR1377202     2       0          1  0  1
#> SRR1377203     2       0          1  0  1
#> SRR1377204     2       0          1  0  1
#> SRR1377205     2       0          1  0  1
#> SRR1377206     2       0          1  0  1
#> SRR1377207     2       0          1  0  1
#> SRR1377208     2       0          1  0  1
#> SRR1377209     2       0          1  0  1
#> SRR1377210     2       0          1  0  1
#> SRR1377211     2       0          1  0  1
#> SRR1377212     2       0          1  0  1
#> SRR1377213     2       0          1  0  1
#> SRR1377214     2       0          1  0  1
#> SRR1377215     2       0          1  0  1
#> SRR1377216     2       0          1  0  1
#> SRR1377217     2       0          1  0  1
#> SRR1377218     2       0          1  0  1
#> SRR1377219     2       0          1  0  1
#> SRR1377220     2       0          1  0  1
#> SRR1377221     2       0          1  0  1
#> SRR1377222     2       0          1  0  1
#> SRR1377223     2       0          1  0  1
#> SRR1377224     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
#> SRR1377145     2  0.0000      1.000 0.000  1 0.000
#> SRR1377146     2  0.0000      1.000 0.000  1 0.000
#> SRR1377147     2  0.0000      1.000 0.000  1 0.000
#> SRR1377148     2  0.0000      1.000 0.000  1 0.000
#> SRR1377153     2  0.0000      1.000 0.000  1 0.000
#> SRR1377154     2  0.0000      1.000 0.000  1 0.000
#> SRR1377155     2  0.0000      1.000 0.000  1 0.000
#> SRR1377156     2  0.0000      1.000 0.000  1 0.000
#> SRR1377149     2  0.0000      1.000 0.000  1 0.000
#> SRR1377150     2  0.0000      1.000 0.000  1 0.000
#> SRR1377151     2  0.0000      1.000 0.000  1 0.000
#> SRR1377152     2  0.0000      1.000 0.000  1 0.000
#> SRR1377157     2  0.0000      1.000 0.000  1 0.000
#> SRR1377158     2  0.0000      1.000 0.000  1 0.000
#> SRR1377159     2  0.0000      1.000 0.000  1 0.000
#> SRR1377160     2  0.0000      1.000 0.000  1 0.000
#> SRR1377161     2  0.0000      1.000 0.000  1 0.000
#> SRR1377162     2  0.0000      1.000 0.000  1 0.000
#> SRR1377163     2  0.0000      1.000 0.000  1 0.000
#> SRR1377164     2  0.0000      1.000 0.000  1 0.000
#> SRR1377169     2  0.0000      1.000 0.000  1 0.000
#> SRR1377170     2  0.0000      1.000 0.000  1 0.000
#> SRR1377171     2  0.0000      1.000 0.000  1 0.000
#> SRR1377172     2  0.0000      1.000 0.000  1 0.000
#> SRR1377165     2  0.0000      1.000 0.000  1 0.000
#> SRR1377166     2  0.0000      1.000 0.000  1 0.000
#> SRR1377167     2  0.0000      1.000 0.000  1 0.000
#> SRR1377168     2  0.0000      1.000 0.000  1 0.000
#> SRR1377173     2  0.0000      1.000 0.000  1 0.000
#> SRR1377174     2  0.0000      1.000 0.000  1 0.000
#> SRR1377175     2  0.0000      1.000 0.000  1 0.000
#> SRR1377176     2  0.0000      1.000 0.000  1 0.000
#> SRR1377177     2  0.0000      1.000 0.000  1 0.000
#> SRR1377178     2  0.0000      1.000 0.000  1 0.000
#> SRR1377179     2  0.0000      1.000 0.000  1 0.000
#> SRR1377180     2  0.0000      1.000 0.000  1 0.000
#> SRR1377181     2  0.0000      1.000 0.000  1 0.000
#> SRR1377182     2  0.0000      1.000 0.000  1 0.000
#> SRR1377183     2  0.0000      1.000 0.000  1 0.000
#> SRR1377184     2  0.0000      1.000 0.000  1 0.000
#> SRR1377185     2  0.0000      1.000 0.000  1 0.000
#> SRR1377186     2  0.0000      1.000 0.000  1 0.000
#> SRR1377187     2  0.0000      1.000 0.000  1 0.000
#> SRR1377188     2  0.0000      1.000 0.000  1 0.000
#> SRR1377189     2  0.0000      1.000 0.000  1 0.000
#> SRR1377190     2  0.0000      1.000 0.000  1 0.000
#> SRR1377191     2  0.0000      1.000 0.000  1 0.000
#> SRR1377192     2  0.0000      1.000 0.000  1 0.000
#> SRR1377193     2  0.0000      1.000 0.000  1 0.000
#> SRR1377194     2  0.0000      1.000 0.000  1 0.000
#> SRR1377195     1  0.0000      0.987 1.000  0 0.000
#> SRR1377196     1  0.0000      0.987 1.000  0 0.000
#> SRR1377197     1  0.0000      0.987 1.000  0 0.000
#> SRR1377198     1  0.0424      0.984 0.992  0 0.008
#> SRR1377199     1  0.1529      0.958 0.960  0 0.040
#> SRR1377200     3  0.1753      0.000 0.048  0 0.952
#> SRR1377201     2  0.0000      1.000 0.000  1 0.000
#> SRR1377202     2  0.0000      1.000 0.000  1 0.000
#> SRR1377203     2  0.0000      1.000 0.000  1 0.000
#> SRR1377204     2  0.0000      1.000 0.000  1 0.000
#> SRR1377205     2  0.0000      1.000 0.000  1 0.000
#> SRR1377206     2  0.0000      1.000 0.000  1 0.000
#> SRR1377207     2  0.0000      1.000 0.000  1 0.000
#> SRR1377208     2  0.0000      1.000 0.000  1 0.000
#> SRR1377209     2  0.0000      1.000 0.000  1 0.000
#> SRR1377210     2  0.0000      1.000 0.000  1 0.000
#> SRR1377211     2  0.0000      1.000 0.000  1 0.000
#> SRR1377212     2  0.0000      1.000 0.000  1 0.000
#> SRR1377213     2  0.0000      1.000 0.000  1 0.000
#> SRR1377214     2  0.0000      1.000 0.000  1 0.000
#> SRR1377215     2  0.0000      1.000 0.000  1 0.000
#> SRR1377216     2  0.0000      1.000 0.000  1 0.000
#> SRR1377217     2  0.0000      1.000 0.000  1 0.000
#> SRR1377218     2  0.0000      1.000 0.000  1 0.000
#> SRR1377219     2  0.0000      1.000 0.000  1 0.000
#> SRR1377220     2  0.0000      1.000 0.000  1 0.000
#> SRR1377221     2  0.0000      1.000 0.000  1 0.000
#> SRR1377222     2  0.0000      1.000 0.000  1 0.000
#> SRR1377223     2  0.0000      1.000 0.000  1 0.000
#> SRR1377224     2  0.0000      1.000 0.000  1 0.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette   p1 p2 p3   p4
#> SRR1377145     2   0.000      1.000 0.00  1  0 0.00
#> SRR1377146     2   0.000      1.000 0.00  1  0 0.00
#> SRR1377147     2   0.000      1.000 0.00  1  0 0.00
#> SRR1377148     2   0.000      1.000 0.00  1  0 0.00
#> SRR1377153     2   0.000      1.000 0.00  1  0 0.00
#> SRR1377154     2   0.000      1.000 0.00  1  0 0.00
#> SRR1377155     2   0.000      1.000 0.00  1  0 0.00
#> SRR1377156     2   0.000      1.000 0.00  1  0 0.00
#> SRR1377149     2   0.000      1.000 0.00  1  0 0.00
#> SRR1377150     2   0.000      1.000 0.00  1  0 0.00
#> SRR1377151     2   0.000      1.000 0.00  1  0 0.00
#> SRR1377152     2   0.000      1.000 0.00  1  0 0.00
#> SRR1377157     2   0.000      1.000 0.00  1  0 0.00
#> SRR1377158     2   0.000      1.000 0.00  1  0 0.00
#> SRR1377159     2   0.000      1.000 0.00  1  0 0.00
#> SRR1377160     2   0.000      1.000 0.00  1  0 0.00
#> SRR1377161     2   0.000      1.000 0.00  1  0 0.00
#> SRR1377162     2   0.000      1.000 0.00  1  0 0.00
#> SRR1377163     2   0.000      1.000 0.00  1  0 0.00
#> SRR1377164     2   0.000      1.000 0.00  1  0 0.00
#> SRR1377169     2   0.000      1.000 0.00  1  0 0.00
#> SRR1377170     2   0.000      1.000 0.00  1  0 0.00
#> SRR1377171     2   0.000      1.000 0.00  1  0 0.00
#> SRR1377172     2   0.000      1.000 0.00  1  0 0.00
#> SRR1377165     2   0.000      1.000 0.00  1  0 0.00
#> SRR1377166     2   0.000      1.000 0.00  1  0 0.00
#> SRR1377167     2   0.000      1.000 0.00  1  0 0.00
#> SRR1377168     2   0.000      1.000 0.00  1  0 0.00
#> SRR1377173     2   0.000      1.000 0.00  1  0 0.00
#> SRR1377174     2   0.000      1.000 0.00  1  0 0.00
#> SRR1377175     2   0.000      1.000 0.00  1  0 0.00
#> SRR1377176     2   0.000      1.000 0.00  1  0 0.00
#> SRR1377177     2   0.000      1.000 0.00  1  0 0.00
#> SRR1377178     2   0.000      1.000 0.00  1  0 0.00
#> SRR1377179     2   0.000      1.000 0.00  1  0 0.00
#> SRR1377180     2   0.000      1.000 0.00  1  0 0.00
#> SRR1377181     2   0.000      1.000 0.00  1  0 0.00
#> SRR1377182     2   0.000      1.000 0.00  1  0 0.00
#> SRR1377183     2   0.000      1.000 0.00  1  0 0.00
#> SRR1377184     2   0.000      1.000 0.00  1  0 0.00
#> SRR1377185     2   0.000      1.000 0.00  1  0 0.00
#> SRR1377186     2   0.000      1.000 0.00  1  0 0.00
#> SRR1377187     2   0.000      1.000 0.00  1  0 0.00
#> SRR1377188     2   0.000      1.000 0.00  1  0 0.00
#> SRR1377189     2   0.000      1.000 0.00  1  0 0.00
#> SRR1377190     2   0.000      1.000 0.00  1  0 0.00
#> SRR1377191     2   0.000      1.000 0.00  1  0 0.00
#> SRR1377192     2   0.000      1.000 0.00  1  0 0.00
#> SRR1377193     2   0.000      1.000 0.00  1  0 0.00
#> SRR1377194     2   0.000      1.000 0.00  1  0 0.00
#> SRR1377195     1   0.398      0.895 0.76  0  0 0.24
#> SRR1377196     1   0.398      0.895 0.76  0  0 0.24
#> SRR1377197     1   0.398      0.895 0.76  0  0 0.24
#> SRR1377198     1   0.000      0.680 1.00  0  0 0.00
#> SRR1377199     4   0.000      0.000 0.00  0  0 1.00
#> SRR1377200     3   0.000      0.000 0.00  0  1 0.00
#> SRR1377201     2   0.000      1.000 0.00  1  0 0.00
#> SRR1377202     2   0.000      1.000 0.00  1  0 0.00
#> SRR1377203     2   0.000      1.000 0.00  1  0 0.00
#> SRR1377204     2   0.000      1.000 0.00  1  0 0.00
#> SRR1377205     2   0.000      1.000 0.00  1  0 0.00
#> SRR1377206     2   0.000      1.000 0.00  1  0 0.00
#> SRR1377207     2   0.000      1.000 0.00  1  0 0.00
#> SRR1377208     2   0.000      1.000 0.00  1  0 0.00
#> SRR1377209     2   0.000      1.000 0.00  1  0 0.00
#> SRR1377210     2   0.000      1.000 0.00  1  0 0.00
#> SRR1377211     2   0.000      1.000 0.00  1  0 0.00
#> SRR1377212     2   0.000      1.000 0.00  1  0 0.00
#> SRR1377213     2   0.000      1.000 0.00  1  0 0.00
#> SRR1377214     2   0.000      1.000 0.00  1  0 0.00
#> SRR1377215     2   0.000      1.000 0.00  1  0 0.00
#> SRR1377216     2   0.000      1.000 0.00  1  0 0.00
#> SRR1377217     2   0.000      1.000 0.00  1  0 0.00
#> SRR1377218     2   0.000      1.000 0.00  1  0 0.00
#> SRR1377219     2   0.000      1.000 0.00  1  0 0.00
#> SRR1377220     2   0.000      1.000 0.00  1  0 0.00
#> SRR1377221     2   0.000      1.000 0.00  1  0 0.00
#> SRR1377222     2   0.000      1.000 0.00  1  0 0.00
#> SRR1377223     2   0.000      1.000 0.00  1  0 0.00
#> SRR1377224     2   0.000      1.000 0.00  1  0 0.00

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>            class entropy silhouette p1 p2 p3 p4 p5
#> SRR1377145     2       0          1  0  1  0  0  0
#> SRR1377146     2       0          1  0  1  0  0  0
#> SRR1377147     2       0          1  0  1  0  0  0
#> SRR1377148     2       0          1  0  1  0  0  0
#> SRR1377153     2       0          1  0  1  0  0  0
#> SRR1377154     2       0          1  0  1  0  0  0
#> SRR1377155     2       0          1  0  1  0  0  0
#> SRR1377156     2       0          1  0  1  0  0  0
#> SRR1377149     2       0          1  0  1  0  0  0
#> SRR1377150     2       0          1  0  1  0  0  0
#> SRR1377151     2       0          1  0  1  0  0  0
#> SRR1377152     2       0          1  0  1  0  0  0
#> SRR1377157     2       0          1  0  1  0  0  0
#> SRR1377158     2       0          1  0  1  0  0  0
#> SRR1377159     2       0          1  0  1  0  0  0
#> SRR1377160     2       0          1  0  1  0  0  0
#> SRR1377161     2       0          1  0  1  0  0  0
#> SRR1377162     2       0          1  0  1  0  0  0
#> SRR1377163     2       0          1  0  1  0  0  0
#> SRR1377164     2       0          1  0  1  0  0  0
#> SRR1377169     2       0          1  0  1  0  0  0
#> SRR1377170     2       0          1  0  1  0  0  0
#> SRR1377171     2       0          1  0  1  0  0  0
#> SRR1377172     2       0          1  0  1  0  0  0
#> SRR1377165     2       0          1  0  1  0  0  0
#> SRR1377166     2       0          1  0  1  0  0  0
#> SRR1377167     2       0          1  0  1  0  0  0
#> SRR1377168     2       0          1  0  1  0  0  0
#> SRR1377173     2       0          1  0  1  0  0  0
#> SRR1377174     2       0          1  0  1  0  0  0
#> SRR1377175     2       0          1  0  1  0  0  0
#> SRR1377176     2       0          1  0  1  0  0  0
#> SRR1377177     2       0          1  0  1  0  0  0
#> SRR1377178     2       0          1  0  1  0  0  0
#> SRR1377179     2       0          1  0  1  0  0  0
#> SRR1377180     2       0          1  0  1  0  0  0
#> SRR1377181     2       0          1  0  1  0  0  0
#> SRR1377182     2       0          1  0  1  0  0  0
#> SRR1377183     2       0          1  0  1  0  0  0
#> SRR1377184     2       0          1  0  1  0  0  0
#> SRR1377185     2       0          1  0  1  0  0  0
#> SRR1377186     2       0          1  0  1  0  0  0
#> SRR1377187     2       0          1  0  1  0  0  0
#> SRR1377188     2       0          1  0  1  0  0  0
#> SRR1377189     2       0          1  0  1  0  0  0
#> SRR1377190     2       0          1  0  1  0  0  0
#> SRR1377191     2       0          1  0  1  0  0  0
#> SRR1377192     2       0          1  0  1  0  0  0
#> SRR1377193     2       0          1  0  1  0  0  0
#> SRR1377194     2       0          1  0  1  0  0  0
#> SRR1377195     1       0          1  1  0  0  0  0
#> SRR1377196     1       0          1  1  0  0  0  0
#> SRR1377197     1       0          1  1  0  0  0  0
#> SRR1377198     5       0          0  0  0  0  0  1
#> SRR1377199     4       0          0  0  0  0  1  0
#> SRR1377200     3       0          0  0  0  1  0  0
#> SRR1377201     2       0          1  0  1  0  0  0
#> SRR1377202     2       0          1  0  1  0  0  0
#> SRR1377203     2       0          1  0  1  0  0  0
#> SRR1377204     2       0          1  0  1  0  0  0
#> SRR1377205     2       0          1  0  1  0  0  0
#> SRR1377206     2       0          1  0  1  0  0  0
#> SRR1377207     2       0          1  0  1  0  0  0
#> SRR1377208     2       0          1  0  1  0  0  0
#> SRR1377209     2       0          1  0  1  0  0  0
#> SRR1377210     2       0          1  0  1  0  0  0
#> SRR1377211     2       0          1  0  1  0  0  0
#> SRR1377212     2       0          1  0  1  0  0  0
#> SRR1377213     2       0          1  0  1  0  0  0
#> SRR1377214     2       0          1  0  1  0  0  0
#> SRR1377215     2       0          1  0  1  0  0  0
#> SRR1377216     2       0          1  0  1  0  0  0
#> SRR1377217     2       0          1  0  1  0  0  0
#> SRR1377218     2       0          1  0  1  0  0  0
#> SRR1377219     2       0          1  0  1  0  0  0
#> SRR1377220     2       0          1  0  1  0  0  0
#> SRR1377221     2       0          1  0  1  0  0  0
#> SRR1377222     2       0          1  0  1  0  0  0
#> SRR1377223     2       0          1  0  1  0  0  0
#> SRR1377224     2       0          1  0  1  0  0  0

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>            class entropy silhouette p1    p2 p3 p4    p5 p6
#> SRR1377145     2   0.000      0.993 NA 1.000  0  0 0.000  0
#> SRR1377146     2   0.000      0.993 NA 1.000  0  0 0.000  0
#> SRR1377147     2   0.000      0.993 NA 1.000  0  0 0.000  0
#> SRR1377148     2   0.000      0.993 NA 1.000  0  0 0.000  0
#> SRR1377153     2   0.000      0.993 NA 1.000  0  0 0.000  0
#> SRR1377154     2   0.000      0.993 NA 1.000  0  0 0.000  0
#> SRR1377155     2   0.000      0.993 NA 1.000  0  0 0.000  0
#> SRR1377156     2   0.000      0.993 NA 1.000  0  0 0.000  0
#> SRR1377149     2   0.000      0.993 NA 1.000  0  0 0.000  0
#> SRR1377150     2   0.000      0.993 NA 1.000  0  0 0.000  0
#> SRR1377151     2   0.000      0.993 NA 1.000  0  0 0.000  0
#> SRR1377152     2   0.000      0.993 NA 1.000  0  0 0.000  0
#> SRR1377157     2   0.000      0.993 NA 1.000  0  0 0.000  0
#> SRR1377158     2   0.000      0.993 NA 1.000  0  0 0.000  0
#> SRR1377159     2   0.000      0.993 NA 1.000  0  0 0.000  0
#> SRR1377160     2   0.000      0.993 NA 1.000  0  0 0.000  0
#> SRR1377161     2   0.000      0.993 NA 1.000  0  0 0.000  0
#> SRR1377162     2   0.000      0.993 NA 1.000  0  0 0.000  0
#> SRR1377163     2   0.000      0.993 NA 1.000  0  0 0.000  0
#> SRR1377164     2   0.000      0.993 NA 1.000  0  0 0.000  0
#> SRR1377169     2   0.000      0.993 NA 1.000  0  0 0.000  0
#> SRR1377170     2   0.000      0.993 NA 1.000  0  0 0.000  0
#> SRR1377171     2   0.000      0.993 NA 1.000  0  0 0.000  0
#> SRR1377172     2   0.000      0.993 NA 1.000  0  0 0.000  0
#> SRR1377165     2   0.000      0.993 NA 1.000  0  0 0.000  0
#> SRR1377166     2   0.000      0.993 NA 1.000  0  0 0.000  0
#> SRR1377167     2   0.000      0.993 NA 1.000  0  0 0.000  0
#> SRR1377168     2   0.000      0.993 NA 1.000  0  0 0.000  0
#> SRR1377173     2   0.000      0.993 NA 1.000  0  0 0.000  0
#> SRR1377174     2   0.000      0.993 NA 1.000  0  0 0.000  0
#> SRR1377175     2   0.000      0.993 NA 1.000  0  0 0.000  0
#> SRR1377176     2   0.000      0.993 NA 1.000  0  0 0.000  0
#> SRR1377177     2   0.000      0.993 NA 1.000  0  0 0.000  0
#> SRR1377178     2   0.000      0.993 NA 1.000  0  0 0.000  0
#> SRR1377179     2   0.000      0.993 NA 1.000  0  0 0.000  0
#> SRR1377180     2   0.000      0.993 NA 1.000  0  0 0.000  0
#> SRR1377181     2   0.000      0.993 NA 1.000  0  0 0.000  0
#> SRR1377182     2   0.000      0.993 NA 1.000  0  0 0.000  0
#> SRR1377183     2   0.000      0.993 NA 1.000  0  0 0.000  0
#> SRR1377184     2   0.000      0.993 NA 1.000  0  0 0.000  0
#> SRR1377185     2   0.000      0.993 NA 1.000  0  0 0.000  0
#> SRR1377186     2   0.000      0.993 NA 1.000  0  0 0.000  0
#> SRR1377187     2   0.000      0.993 NA 1.000  0  0 0.000  0
#> SRR1377188     2   0.000      0.993 NA 1.000  0  0 0.000  0
#> SRR1377189     2   0.000      0.993 NA 1.000  0  0 0.000  0
#> SRR1377190     2   0.000      0.993 NA 1.000  0  0 0.000  0
#> SRR1377191     2   0.000      0.993 NA 1.000  0  0 0.000  0
#> SRR1377192     2   0.000      0.993 NA 1.000  0  0 0.000  0
#> SRR1377193     2   0.000      0.993 NA 1.000  0  0 0.000  0
#> SRR1377194     2   0.000      0.993 NA 1.000  0  0 0.000  0
#> SRR1377195     5   0.384      0.321 NA 0.000  0  0 0.552  0
#> SRR1377196     5   0.385      0.309 NA 0.000  0  0 0.536  0
#> SRR1377197     5   0.000      0.509 NA 0.000  0  0 1.000  0
#> SRR1377198     4   0.000      0.000 NA 0.000  0  1 0.000  0
#> SRR1377199     3   0.000      0.000 NA 0.000  1  0 0.000  0
#> SRR1377200     6   0.000      0.000 NA 0.000  0  0 0.000  1
#> SRR1377201     2   0.000      0.993 NA 1.000  0  0 0.000  0
#> SRR1377202     2   0.000      0.993 NA 1.000  0  0 0.000  0
#> SRR1377203     2   0.000      0.993 NA 1.000  0  0 0.000  0
#> SRR1377204     2   0.166      0.912 NA 0.912  0  0 0.000  0
#> SRR1377205     2   0.166      0.912 NA 0.912  0  0 0.000  0
#> SRR1377206     2   0.166      0.912 NA 0.912  0  0 0.000  0
#> SRR1377207     2   0.000      0.993 NA 1.000  0  0 0.000  0
#> SRR1377208     2   0.000      0.993 NA 1.000  0  0 0.000  0
#> SRR1377209     2   0.000      0.993 NA 1.000  0  0 0.000  0
#> SRR1377210     2   0.000      0.993 NA 1.000  0  0 0.000  0
#> SRR1377211     2   0.000      0.993 NA 1.000  0  0 0.000  0
#> SRR1377212     2   0.000      0.993 NA 1.000  0  0 0.000  0
#> SRR1377213     2   0.000      0.993 NA 1.000  0  0 0.000  0
#> SRR1377214     2   0.000      0.993 NA 1.000  0  0 0.000  0
#> SRR1377215     2   0.000      0.993 NA 1.000  0  0 0.000  0
#> SRR1377216     2   0.000      0.993 NA 1.000  0  0 0.000  0
#> SRR1377217     2   0.000      0.993 NA 1.000  0  0 0.000  0
#> SRR1377218     2   0.000      0.993 NA 1.000  0  0 0.000  0
#> SRR1377219     2   0.000      0.993 NA 1.000  0  0 0.000  0
#> SRR1377220     2   0.000      0.993 NA 1.000  0  0 0.000  0
#> SRR1377221     2   0.000      0.993 NA 1.000  0  0 0.000  0
#> SRR1377222     2   0.166      0.912 NA 0.912  0  0 0.000  0
#> SRR1377223     2   0.166      0.912 NA 0.912  0  0 0.000  0
#> SRR1377224     2   0.166      0.912 NA 0.912  0  0 0.000  0

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

consensus_heatmap(res, k = 2)

plot of chunk tab-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 13890 rows and 80 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.383           0.862       0.896          0.212 0.859   0.859
#> 3 3 0.232           0.616       0.666          1.214 0.706   0.658
#> 4 4 0.309           0.623       0.617          0.315 0.734   0.530
#> 5 5 0.363           0.704       0.579          0.146 0.810   0.474
#> 6 6 0.695           0.891       0.804          0.102 0.939   0.738

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
#> SRR1377145     2  0.2778      0.866 0.048 0.952
#> SRR1377146     2  0.2778      0.866 0.048 0.952
#> SRR1377147     2  0.2778      0.866 0.048 0.952
#> SRR1377148     2  0.2778      0.866 0.048 0.952
#> SRR1377153     2  0.2778      0.866 0.048 0.952
#> SRR1377154     2  0.2778      0.866 0.048 0.952
#> SRR1377155     2  0.2778      0.866 0.048 0.952
#> SRR1377156     2  0.2778      0.866 0.048 0.952
#> SRR1377149     2  0.2778      0.866 0.048 0.952
#> SRR1377150     2  0.2778      0.866 0.048 0.952
#> SRR1377151     2  0.2778      0.866 0.048 0.952
#> SRR1377152     2  0.2778      0.866 0.048 0.952
#> SRR1377157     2  0.6887      0.809 0.184 0.816
#> SRR1377158     2  0.6887      0.809 0.184 0.816
#> SRR1377159     2  0.6887      0.809 0.184 0.816
#> SRR1377160     2  0.6887      0.809 0.184 0.816
#> SRR1377161     2  0.6887      0.809 0.184 0.816
#> SRR1377162     2  0.6887      0.809 0.184 0.816
#> SRR1377163     2  0.6887      0.809 0.184 0.816
#> SRR1377164     2  0.6887      0.809 0.184 0.816
#> SRR1377169     2  0.6887      0.809 0.184 0.816
#> SRR1377170     2  0.6887      0.809 0.184 0.816
#> SRR1377171     2  0.6887      0.809 0.184 0.816
#> SRR1377172     2  0.6887      0.809 0.184 0.816
#> SRR1377165     2  0.6887      0.809 0.184 0.816
#> SRR1377166     2  0.6887      0.809 0.184 0.816
#> SRR1377167     2  0.6887      0.809 0.184 0.816
#> SRR1377168     2  0.6887      0.809 0.184 0.816
#> SRR1377173     2  0.0672      0.885 0.008 0.992
#> SRR1377174     2  0.0672      0.885 0.008 0.992
#> SRR1377175     2  0.0672      0.885 0.008 0.992
#> SRR1377176     2  0.0672      0.885 0.008 0.992
#> SRR1377177     2  0.0672      0.885 0.008 0.992
#> SRR1377178     2  0.0672      0.885 0.008 0.992
#> SRR1377179     2  0.0672      0.885 0.008 0.992
#> SRR1377180     2  0.0672      0.885 0.008 0.992
#> SRR1377181     2  0.0938      0.886 0.012 0.988
#> SRR1377182     2  0.0938      0.886 0.012 0.988
#> SRR1377183     2  0.0672      0.885 0.008 0.992
#> SRR1377184     2  0.0938      0.886 0.012 0.988
#> SRR1377185     2  0.0672      0.885 0.008 0.992
#> SRR1377186     2  0.0672      0.885 0.008 0.992
#> SRR1377187     2  0.0938      0.886 0.012 0.988
#> SRR1377188     2  0.0672      0.885 0.008 0.992
#> SRR1377189     2  0.0938      0.886 0.012 0.988
#> SRR1377190     2  0.0938      0.886 0.012 0.988
#> SRR1377191     2  0.0938      0.886 0.012 0.988
#> SRR1377192     2  0.0938      0.886 0.012 0.988
#> SRR1377193     2  0.0938      0.886 0.012 0.988
#> SRR1377194     2  0.0938      0.886 0.012 0.988
#> SRR1377195     1  0.9087      1.000 0.676 0.324
#> SRR1377196     1  0.9087      1.000 0.676 0.324
#> SRR1377197     1  0.9087      1.000 0.676 0.324
#> SRR1377198     1  0.9087      1.000 0.676 0.324
#> SRR1377199     1  0.9087      1.000 0.676 0.324
#> SRR1377200     1  0.9087      1.000 0.676 0.324
#> SRR1377201     2  0.0938      0.886 0.012 0.988
#> SRR1377202     2  0.0938      0.886 0.012 0.988
#> SRR1377203     2  0.0938      0.886 0.012 0.988
#> SRR1377204     2  0.3431      0.863 0.064 0.936
#> SRR1377205     2  0.3431      0.863 0.064 0.936
#> SRR1377206     2  0.3431      0.863 0.064 0.936
#> SRR1377207     2  0.0938      0.886 0.012 0.988
#> SRR1377208     2  0.0938      0.886 0.012 0.988
#> SRR1377209     2  0.0938      0.886 0.012 0.988
#> SRR1377210     2  0.0938      0.886 0.012 0.988
#> SRR1377211     2  0.0938      0.886 0.012 0.988
#> SRR1377212     2  0.0938      0.886 0.012 0.988
#> SRR1377213     2  0.7453      0.790 0.212 0.788
#> SRR1377214     2  0.7453      0.790 0.212 0.788
#> SRR1377215     2  0.7453      0.790 0.212 0.788
#> SRR1377216     2  0.7376      0.794 0.208 0.792
#> SRR1377217     2  0.7376      0.794 0.208 0.792
#> SRR1377218     2  0.7376      0.794 0.208 0.792
#> SRR1377219     2  0.7453      0.790 0.212 0.788
#> SRR1377220     2  0.7453      0.790 0.212 0.788
#> SRR1377221     2  0.7453      0.790 0.212 0.788
#> SRR1377222     2  0.5737      0.832 0.136 0.864
#> SRR1377223     2  0.5737      0.832 0.136 0.864
#> SRR1377224     2  0.5737      0.832 0.136 0.864

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>            class entropy silhouette    p1    p2    p3
#> SRR1377145     2  0.6796     0.5082 0.056 0.708 0.236
#> SRR1377146     2  0.6796     0.5082 0.056 0.708 0.236
#> SRR1377147     2  0.6796     0.5082 0.056 0.708 0.236
#> SRR1377148     2  0.6796     0.5082 0.056 0.708 0.236
#> SRR1377153     2  0.6796     0.5082 0.056 0.708 0.236
#> SRR1377154     2  0.6796     0.5082 0.056 0.708 0.236
#> SRR1377155     2  0.6796     0.5082 0.056 0.708 0.236
#> SRR1377156     2  0.6796     0.5082 0.056 0.708 0.236
#> SRR1377149     2  0.6796     0.5082 0.056 0.708 0.236
#> SRR1377150     2  0.6796     0.5082 0.056 0.708 0.236
#> SRR1377151     2  0.6796     0.5082 0.056 0.708 0.236
#> SRR1377152     2  0.6796     0.5082 0.056 0.708 0.236
#> SRR1377157     3  0.6008     1.0000 0.000 0.372 0.628
#> SRR1377158     3  0.6008     1.0000 0.000 0.372 0.628
#> SRR1377159     3  0.6008     1.0000 0.000 0.372 0.628
#> SRR1377160     3  0.6008     1.0000 0.000 0.372 0.628
#> SRR1377161     3  0.6008     1.0000 0.000 0.372 0.628
#> SRR1377162     3  0.6008     1.0000 0.000 0.372 0.628
#> SRR1377163     3  0.6008     1.0000 0.000 0.372 0.628
#> SRR1377164     3  0.6008     1.0000 0.000 0.372 0.628
#> SRR1377169     3  0.6008     1.0000 0.000 0.372 0.628
#> SRR1377170     3  0.6008     1.0000 0.000 0.372 0.628
#> SRR1377171     3  0.6008     1.0000 0.000 0.372 0.628
#> SRR1377172     3  0.6008     1.0000 0.000 0.372 0.628
#> SRR1377165     3  0.6008     1.0000 0.000 0.372 0.628
#> SRR1377166     3  0.6008     1.0000 0.000 0.372 0.628
#> SRR1377167     3  0.6008     1.0000 0.000 0.372 0.628
#> SRR1377168     3  0.6008     1.0000 0.000 0.372 0.628
#> SRR1377173     2  0.5536     0.4736 0.012 0.752 0.236
#> SRR1377174     2  0.5536     0.4736 0.012 0.752 0.236
#> SRR1377175     2  0.5536     0.4736 0.012 0.752 0.236
#> SRR1377176     2  0.5536     0.4736 0.012 0.752 0.236
#> SRR1377177     2  0.5536     0.4736 0.012 0.752 0.236
#> SRR1377178     2  0.5536     0.4736 0.012 0.752 0.236
#> SRR1377179     2  0.5536     0.4736 0.012 0.752 0.236
#> SRR1377180     2  0.5536     0.4736 0.012 0.752 0.236
#> SRR1377181     2  0.5536     0.4736 0.012 0.752 0.236
#> SRR1377182     2  0.5536     0.4736 0.012 0.752 0.236
#> SRR1377183     2  0.5268     0.5062 0.012 0.776 0.212
#> SRR1377184     2  0.5536     0.4736 0.012 0.752 0.236
#> SRR1377185     2  0.5268     0.5062 0.012 0.776 0.212
#> SRR1377186     2  0.5268     0.5062 0.012 0.776 0.212
#> SRR1377187     2  0.5536     0.4736 0.012 0.752 0.236
#> SRR1377188     2  0.5268     0.5062 0.012 0.776 0.212
#> SRR1377189     2  0.0237     0.6260 0.000 0.996 0.004
#> SRR1377190     2  0.0237     0.6260 0.000 0.996 0.004
#> SRR1377191     2  0.0237     0.6260 0.000 0.996 0.004
#> SRR1377192     2  0.0237     0.6260 0.000 0.996 0.004
#> SRR1377193     2  0.0237     0.6260 0.000 0.996 0.004
#> SRR1377194     2  0.0237     0.6260 0.000 0.996 0.004
#> SRR1377195     1  0.3983     0.9985 0.852 0.144 0.004
#> SRR1377196     1  0.3983     0.9985 0.852 0.144 0.004
#> SRR1377197     1  0.3983     0.9985 0.852 0.144 0.004
#> SRR1377198     1  0.4164     0.9977 0.848 0.144 0.008
#> SRR1377199     1  0.4164     0.9977 0.848 0.144 0.008
#> SRR1377200     1  0.4326     0.9963 0.844 0.144 0.012
#> SRR1377201     2  0.0000     0.6268 0.000 1.000 0.000
#> SRR1377202     2  0.0000     0.6268 0.000 1.000 0.000
#> SRR1377203     2  0.0000     0.6268 0.000 1.000 0.000
#> SRR1377204     2  0.5060     0.5290 0.028 0.816 0.156
#> SRR1377205     2  0.5060     0.5290 0.028 0.816 0.156
#> SRR1377206     2  0.5060     0.5290 0.028 0.816 0.156
#> SRR1377207     2  0.0000     0.6268 0.000 1.000 0.000
#> SRR1377208     2  0.0000     0.6268 0.000 1.000 0.000
#> SRR1377209     2  0.0000     0.6268 0.000 1.000 0.000
#> SRR1377210     2  0.0000     0.6268 0.000 1.000 0.000
#> SRR1377211     2  0.0000     0.6268 0.000 1.000 0.000
#> SRR1377212     2  0.0000     0.6268 0.000 1.000 0.000
#> SRR1377213     2  0.8173     0.2260 0.080 0.552 0.368
#> SRR1377214     2  0.8173     0.2260 0.080 0.552 0.368
#> SRR1377215     2  0.8173     0.2260 0.080 0.552 0.368
#> SRR1377216     2  0.8058     0.0776 0.072 0.552 0.376
#> SRR1377217     2  0.8058     0.0776 0.072 0.552 0.376
#> SRR1377218     2  0.8058     0.0776 0.072 0.552 0.376
#> SRR1377219     2  0.8202     0.2028 0.080 0.544 0.376
#> SRR1377220     2  0.8202     0.2028 0.080 0.544 0.376
#> SRR1377221     2  0.8202     0.2028 0.080 0.544 0.376
#> SRR1377222     2  0.7901     0.3266 0.080 0.608 0.312
#> SRR1377223     2  0.7901     0.3266 0.080 0.608 0.312
#> SRR1377224     2  0.7901     0.3266 0.080 0.608 0.312

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> SRR1377145     4  0.5647      0.399 0.000 0.116 0.164 0.720
#> SRR1377146     4  0.5647      0.399 0.000 0.116 0.164 0.720
#> SRR1377147     4  0.5647      0.399 0.000 0.116 0.164 0.720
#> SRR1377148     4  0.5647      0.399 0.000 0.116 0.164 0.720
#> SRR1377153     4  0.5686      0.403 0.004 0.112 0.156 0.728
#> SRR1377154     4  0.5686      0.403 0.004 0.112 0.156 0.728
#> SRR1377155     4  0.5686      0.403 0.004 0.112 0.156 0.728
#> SRR1377156     4  0.5686      0.403 0.004 0.112 0.156 0.728
#> SRR1377149     4  0.6408      0.396 0.020 0.124 0.164 0.692
#> SRR1377150     4  0.6408      0.396 0.020 0.124 0.164 0.692
#> SRR1377151     4  0.6408      0.396 0.020 0.124 0.164 0.692
#> SRR1377152     4  0.6408      0.396 0.020 0.124 0.164 0.692
#> SRR1377157     3  0.1958      0.981 0.008 0.020 0.944 0.028
#> SRR1377158     3  0.1958      0.981 0.008 0.020 0.944 0.028
#> SRR1377159     3  0.1958      0.981 0.008 0.020 0.944 0.028
#> SRR1377160     3  0.1958      0.981 0.008 0.020 0.944 0.028
#> SRR1377161     3  0.1640      0.984 0.012 0.020 0.956 0.012
#> SRR1377162     3  0.1640      0.984 0.012 0.020 0.956 0.012
#> SRR1377163     3  0.1640      0.984 0.012 0.020 0.956 0.012
#> SRR1377164     3  0.1640      0.984 0.012 0.020 0.956 0.012
#> SRR1377169     3  0.0895      0.984 0.000 0.020 0.976 0.004
#> SRR1377170     3  0.0895      0.984 0.000 0.020 0.976 0.004
#> SRR1377171     3  0.0895      0.984 0.000 0.020 0.976 0.004
#> SRR1377172     3  0.0895      0.984 0.000 0.020 0.976 0.004
#> SRR1377165     3  0.0895      0.985 0.000 0.020 0.976 0.004
#> SRR1377166     3  0.0895      0.985 0.000 0.020 0.976 0.004
#> SRR1377167     3  0.0895      0.985 0.000 0.020 0.976 0.004
#> SRR1377168     3  0.0895      0.985 0.000 0.020 0.976 0.004
#> SRR1377173     4  0.8514      0.568 0.040 0.196 0.348 0.416
#> SRR1377174     4  0.8514      0.568 0.040 0.196 0.348 0.416
#> SRR1377175     4  0.8514      0.568 0.040 0.196 0.348 0.416
#> SRR1377176     4  0.8514      0.568 0.040 0.196 0.348 0.416
#> SRR1377177     4  0.8492      0.568 0.040 0.192 0.348 0.420
#> SRR1377178     4  0.8492      0.568 0.040 0.192 0.348 0.420
#> SRR1377179     4  0.8492      0.568 0.040 0.192 0.348 0.420
#> SRR1377180     4  0.8492      0.568 0.040 0.192 0.348 0.420
#> SRR1377181     4  0.8556      0.566 0.040 0.204 0.348 0.408
#> SRR1377182     4  0.8556      0.566 0.040 0.204 0.348 0.408
#> SRR1377183     4  0.8487      0.567 0.040 0.192 0.344 0.424
#> SRR1377184     4  0.8556      0.566 0.040 0.204 0.348 0.408
#> SRR1377185     4  0.8487      0.567 0.040 0.192 0.344 0.424
#> SRR1377186     4  0.8487      0.567 0.040 0.192 0.344 0.424
#> SRR1377187     4  0.8556      0.566 0.040 0.204 0.348 0.408
#> SRR1377188     4  0.8487      0.567 0.040 0.192 0.344 0.424
#> SRR1377189     2  0.8256      0.457 0.032 0.424 0.172 0.372
#> SRR1377190     2  0.8256      0.457 0.032 0.424 0.172 0.372
#> SRR1377191     2  0.8256      0.457 0.032 0.424 0.172 0.372
#> SRR1377192     2  0.8256      0.457 0.032 0.424 0.172 0.372
#> SRR1377193     2  0.8256      0.457 0.032 0.424 0.172 0.372
#> SRR1377194     2  0.8256      0.457 0.032 0.424 0.172 0.372
#> SRR1377195     1  0.1629      0.998 0.952 0.024 0.000 0.024
#> SRR1377196     1  0.1629      0.998 0.952 0.024 0.000 0.024
#> SRR1377197     1  0.1629      0.998 0.952 0.024 0.000 0.024
#> SRR1377198     1  0.1629      0.998 0.952 0.024 0.000 0.024
#> SRR1377199     1  0.1629      0.998 0.952 0.024 0.000 0.024
#> SRR1377200     1  0.2111      0.990 0.932 0.024 0.000 0.044
#> SRR1377201     2  0.8198      0.468 0.032 0.436 0.164 0.368
#> SRR1377202     2  0.8198      0.468 0.032 0.436 0.164 0.368
#> SRR1377203     2  0.8198      0.468 0.032 0.436 0.164 0.368
#> SRR1377204     2  0.6238      0.496 0.032 0.676 0.048 0.244
#> SRR1377205     2  0.6238      0.496 0.032 0.676 0.048 0.244
#> SRR1377206     2  0.6238      0.496 0.032 0.676 0.048 0.244
#> SRR1377207     2  0.8169      0.465 0.032 0.440 0.160 0.368
#> SRR1377208     2  0.8169      0.465 0.032 0.440 0.160 0.368
#> SRR1377209     2  0.8169      0.465 0.032 0.440 0.160 0.368
#> SRR1377210     2  0.8193      0.469 0.032 0.440 0.164 0.364
#> SRR1377211     2  0.8193      0.469 0.032 0.440 0.164 0.364
#> SRR1377212     2  0.8193      0.469 0.032 0.440 0.164 0.364
#> SRR1377213     2  0.3900      0.502 0.000 0.816 0.164 0.020
#> SRR1377214     2  0.3900      0.502 0.000 0.816 0.164 0.020
#> SRR1377215     2  0.3900      0.502 0.000 0.816 0.164 0.020
#> SRR1377216     2  0.5557      0.420 0.000 0.652 0.308 0.040
#> SRR1377217     2  0.5557      0.420 0.000 0.652 0.308 0.040
#> SRR1377218     2  0.5557      0.420 0.000 0.652 0.308 0.040
#> SRR1377219     2  0.4095      0.505 0.000 0.804 0.172 0.024
#> SRR1377220     2  0.4095      0.505 0.000 0.804 0.172 0.024
#> SRR1377221     2  0.4095      0.505 0.000 0.804 0.172 0.024
#> SRR1377222     2  0.3200      0.498 0.004 0.880 0.092 0.024
#> SRR1377223     2  0.3200      0.498 0.004 0.880 0.092 0.024
#> SRR1377224     2  0.3200      0.498 0.004 0.880 0.092 0.024

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>            class entropy silhouette    p1    p2    p3    p4    p5
#> SRR1377145     4   0.638     0.9659 0.072 0.308 0.052 0.568 0.000
#> SRR1377146     4   0.638     0.9659 0.072 0.308 0.052 0.568 0.000
#> SRR1377147     4   0.638     0.9659 0.072 0.308 0.052 0.568 0.000
#> SRR1377148     4   0.638     0.9659 0.072 0.308 0.052 0.568 0.000
#> SRR1377153     4   0.678     0.9623 0.088 0.308 0.056 0.544 0.004
#> SRR1377154     4   0.678     0.9623 0.088 0.308 0.056 0.544 0.004
#> SRR1377155     4   0.678     0.9623 0.088 0.308 0.056 0.544 0.004
#> SRR1377156     4   0.678     0.9623 0.088 0.308 0.056 0.544 0.004
#> SRR1377149     4   0.730     0.9441 0.136 0.308 0.052 0.496 0.008
#> SRR1377150     4   0.730     0.9441 0.136 0.308 0.052 0.496 0.008
#> SRR1377151     4   0.730     0.9441 0.136 0.308 0.052 0.496 0.008
#> SRR1377152     4   0.730     0.9441 0.136 0.308 0.052 0.496 0.008
#> SRR1377157     3   0.305     0.9488 0.020 0.024 0.884 0.064 0.008
#> SRR1377158     3   0.305     0.9488 0.020 0.024 0.884 0.064 0.008
#> SRR1377159     3   0.305     0.9488 0.020 0.024 0.884 0.064 0.008
#> SRR1377160     3   0.305     0.9488 0.020 0.024 0.884 0.064 0.008
#> SRR1377161     3   0.282     0.9500 0.020 0.024 0.900 0.044 0.012
#> SRR1377162     3   0.282     0.9500 0.020 0.024 0.900 0.044 0.012
#> SRR1377163     3   0.282     0.9500 0.020 0.024 0.900 0.044 0.012
#> SRR1377164     3   0.282     0.9500 0.020 0.024 0.900 0.044 0.012
#> SRR1377169     3   0.160     0.9494 0.008 0.024 0.948 0.020 0.000
#> SRR1377170     3   0.160     0.9494 0.008 0.024 0.948 0.020 0.000
#> SRR1377171     3   0.160     0.9494 0.008 0.024 0.948 0.020 0.000
#> SRR1377172     3   0.160     0.9494 0.008 0.024 0.948 0.020 0.000
#> SRR1377165     3   0.127     0.9568 0.000 0.024 0.960 0.012 0.004
#> SRR1377166     3   0.127     0.9568 0.000 0.024 0.960 0.012 0.004
#> SRR1377167     3   0.127     0.9568 0.000 0.024 0.960 0.012 0.004
#> SRR1377168     3   0.127     0.9568 0.000 0.024 0.960 0.012 0.004
#> SRR1377173     1   0.651     0.4666 0.472 0.316 0.212 0.000 0.000
#> SRR1377174     1   0.651     0.4666 0.472 0.316 0.212 0.000 0.000
#> SRR1377175     1   0.651     0.4666 0.472 0.316 0.212 0.000 0.000
#> SRR1377176     1   0.651     0.4666 0.472 0.316 0.212 0.000 0.000
#> SRR1377177     1   0.651     0.4666 0.472 0.316 0.212 0.000 0.000
#> SRR1377178     1   0.651     0.4666 0.472 0.316 0.212 0.000 0.000
#> SRR1377179     1   0.651     0.4666 0.472 0.316 0.212 0.000 0.000
#> SRR1377180     1   0.651     0.4666 0.472 0.316 0.212 0.000 0.000
#> SRR1377181     1   0.678     0.4656 0.460 0.316 0.216 0.008 0.000
#> SRR1377182     1   0.678     0.4656 0.460 0.316 0.216 0.008 0.000
#> SRR1377183     1   0.676     0.4665 0.464 0.316 0.212 0.008 0.000
#> SRR1377184     1   0.678     0.4656 0.460 0.316 0.216 0.008 0.000
#> SRR1377185     1   0.676     0.4665 0.464 0.316 0.212 0.008 0.000
#> SRR1377186     1   0.676     0.4665 0.464 0.316 0.212 0.008 0.000
#> SRR1377187     1   0.678     0.4656 0.460 0.316 0.216 0.008 0.000
#> SRR1377188     1   0.676     0.4665 0.464 0.316 0.212 0.008 0.000
#> SRR1377189     2   0.392     0.8219 0.024 0.828 0.080 0.068 0.000
#> SRR1377190     2   0.392     0.8219 0.024 0.828 0.080 0.068 0.000
#> SRR1377191     2   0.392     0.8219 0.024 0.828 0.080 0.068 0.000
#> SRR1377192     2   0.392     0.8219 0.024 0.828 0.080 0.068 0.000
#> SRR1377193     2   0.392     0.8219 0.024 0.828 0.080 0.068 0.000
#> SRR1377194     2   0.392     0.8219 0.024 0.828 0.080 0.068 0.000
#> SRR1377195     5   0.104     0.9947 0.000 0.040 0.000 0.000 0.960
#> SRR1377196     5   0.104     0.9947 0.000 0.040 0.000 0.000 0.960
#> SRR1377197     5   0.104     0.9947 0.000 0.040 0.000 0.000 0.960
#> SRR1377198     5   0.137     0.9931 0.004 0.040 0.004 0.000 0.952
#> SRR1377199     5   0.137     0.9928 0.000 0.040 0.004 0.004 0.952
#> SRR1377200     5   0.212     0.9825 0.008 0.040 0.008 0.016 0.928
#> SRR1377201     2   0.173     0.8603 0.000 0.920 0.080 0.000 0.000
#> SRR1377202     2   0.173     0.8603 0.000 0.920 0.080 0.000 0.000
#> SRR1377203     2   0.173     0.8603 0.000 0.920 0.080 0.000 0.000
#> SRR1377204     2   0.478     0.5304 0.168 0.744 0.000 0.076 0.012
#> SRR1377205     2   0.478     0.5304 0.168 0.744 0.000 0.076 0.012
#> SRR1377206     2   0.478     0.5304 0.168 0.744 0.000 0.076 0.012
#> SRR1377207     2   0.173     0.8603 0.000 0.920 0.080 0.000 0.000
#> SRR1377208     2   0.173     0.8603 0.000 0.920 0.080 0.000 0.000
#> SRR1377209     2   0.173     0.8603 0.000 0.920 0.080 0.000 0.000
#> SRR1377210     2   0.173     0.8603 0.000 0.920 0.080 0.000 0.000
#> SRR1377211     2   0.173     0.8603 0.000 0.920 0.080 0.000 0.000
#> SRR1377212     2   0.173     0.8603 0.000 0.920 0.080 0.000 0.000
#> SRR1377213     1   0.805     0.1768 0.340 0.272 0.088 0.300 0.000
#> SRR1377214     1   0.805     0.1768 0.340 0.272 0.088 0.300 0.000
#> SRR1377215     1   0.805     0.1768 0.340 0.272 0.088 0.300 0.000
#> SRR1377216     1   0.851     0.1888 0.300 0.228 0.188 0.284 0.000
#> SRR1377217     1   0.851     0.1888 0.300 0.228 0.188 0.284 0.000
#> SRR1377218     1   0.851     0.1888 0.300 0.228 0.188 0.284 0.000
#> SRR1377219     1   0.820     0.1731 0.328 0.272 0.108 0.292 0.000
#> SRR1377220     1   0.820     0.1731 0.328 0.272 0.108 0.292 0.000
#> SRR1377221     1   0.820     0.1731 0.328 0.272 0.108 0.292 0.000
#> SRR1377222     1   0.750     0.0933 0.400 0.324 0.020 0.244 0.012
#> SRR1377223     1   0.750     0.0933 0.400 0.324 0.020 0.244 0.012
#> SRR1377224     1   0.750     0.0933 0.400 0.324 0.020 0.244 0.012

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>            class entropy silhouette    p1    p2    p3    p4    p5    p6
#> SRR1377145     6  0.4660      0.955 0.028 0.236 0.016 0.020 0.000 0.700
#> SRR1377146     6  0.4660      0.955 0.028 0.236 0.016 0.020 0.000 0.700
#> SRR1377147     6  0.4660      0.955 0.028 0.236 0.016 0.020 0.000 0.700
#> SRR1377148     6  0.4660      0.955 0.028 0.236 0.016 0.020 0.000 0.700
#> SRR1377153     6  0.5181      0.949 0.032 0.236 0.032 0.028 0.000 0.672
#> SRR1377154     6  0.5181      0.949 0.032 0.236 0.032 0.028 0.000 0.672
#> SRR1377155     6  0.5181      0.949 0.032 0.236 0.032 0.028 0.000 0.672
#> SRR1377156     6  0.5181      0.949 0.032 0.236 0.032 0.028 0.000 0.672
#> SRR1377149     6  0.5619      0.940 0.040 0.236 0.052 0.028 0.000 0.644
#> SRR1377150     6  0.5619      0.940 0.040 0.236 0.052 0.028 0.000 0.644
#> SRR1377151     6  0.5619      0.940 0.040 0.236 0.052 0.028 0.000 0.644
#> SRR1377152     6  0.5619      0.940 0.040 0.236 0.052 0.028 0.000 0.644
#> SRR1377157     3  0.4353      0.918 0.132 0.020 0.776 0.028 0.000 0.044
#> SRR1377158     3  0.4353      0.918 0.132 0.020 0.776 0.028 0.000 0.044
#> SRR1377159     3  0.4353      0.918 0.132 0.020 0.776 0.028 0.000 0.044
#> SRR1377160     3  0.4353      0.918 0.132 0.020 0.776 0.028 0.000 0.044
#> SRR1377161     3  0.4003      0.931 0.116 0.020 0.796 0.008 0.000 0.060
#> SRR1377162     3  0.4003      0.931 0.116 0.020 0.796 0.008 0.000 0.060
#> SRR1377163     3  0.4003      0.931 0.116 0.020 0.796 0.008 0.000 0.060
#> SRR1377164     3  0.4003      0.931 0.116 0.020 0.796 0.008 0.000 0.060
#> SRR1377169     3  0.4003      0.912 0.108 0.024 0.804 0.016 0.000 0.048
#> SRR1377170     3  0.4003      0.912 0.108 0.024 0.804 0.016 0.000 0.048
#> SRR1377171     3  0.4003      0.912 0.108 0.024 0.804 0.016 0.000 0.048
#> SRR1377172     3  0.4003      0.912 0.108 0.024 0.804 0.016 0.000 0.048
#> SRR1377165     3  0.2290      0.935 0.084 0.020 0.892 0.004 0.000 0.000
#> SRR1377166     3  0.2290      0.935 0.084 0.020 0.892 0.004 0.000 0.000
#> SRR1377167     3  0.2290      0.935 0.084 0.020 0.892 0.004 0.000 0.000
#> SRR1377168     3  0.2290      0.935 0.084 0.020 0.892 0.004 0.000 0.000
#> SRR1377173     1  0.2948      0.979 0.804 0.188 0.000 0.000 0.000 0.008
#> SRR1377174     1  0.2948      0.979 0.804 0.188 0.000 0.000 0.000 0.008
#> SRR1377175     1  0.2948      0.979 0.804 0.188 0.000 0.000 0.000 0.008
#> SRR1377176     1  0.2948      0.979 0.804 0.188 0.000 0.000 0.000 0.008
#> SRR1377177     1  0.2838      0.981 0.808 0.188 0.000 0.004 0.000 0.000
#> SRR1377178     1  0.2838      0.981 0.808 0.188 0.000 0.004 0.000 0.000
#> SRR1377179     1  0.2838      0.981 0.808 0.188 0.000 0.004 0.000 0.000
#> SRR1377180     1  0.2838      0.981 0.808 0.188 0.000 0.004 0.000 0.000
#> SRR1377181     1  0.4262      0.958 0.748 0.188 0.004 0.032 0.000 0.028
#> SRR1377182     1  0.4262      0.958 0.748 0.188 0.004 0.032 0.000 0.028
#> SRR1377183     1  0.3089      0.980 0.800 0.188 0.000 0.004 0.000 0.008
#> SRR1377184     1  0.4262      0.958 0.748 0.188 0.004 0.032 0.000 0.028
#> SRR1377185     1  0.3089      0.980 0.800 0.188 0.000 0.004 0.000 0.008
#> SRR1377186     1  0.3089      0.980 0.800 0.188 0.000 0.004 0.000 0.008
#> SRR1377187     1  0.4262      0.958 0.748 0.188 0.004 0.032 0.000 0.028
#> SRR1377188     1  0.3089      0.980 0.800 0.188 0.000 0.004 0.000 0.008
#> SRR1377189     2  0.2934      0.805 0.024 0.868 0.000 0.064 0.000 0.044
#> SRR1377190     2  0.2934      0.805 0.024 0.868 0.000 0.064 0.000 0.044
#> SRR1377191     2  0.2934      0.805 0.024 0.868 0.000 0.064 0.000 0.044
#> SRR1377192     2  0.2934      0.805 0.024 0.868 0.000 0.064 0.000 0.044
#> SRR1377193     2  0.2934      0.805 0.024 0.868 0.000 0.064 0.000 0.044
#> SRR1377194     2  0.2934      0.805 0.024 0.868 0.000 0.064 0.000 0.044
#> SRR1377195     5  0.0146      0.990 0.000 0.004 0.000 0.000 0.996 0.000
#> SRR1377196     5  0.0146      0.990 0.000 0.004 0.000 0.000 0.996 0.000
#> SRR1377197     5  0.0146      0.990 0.000 0.004 0.000 0.000 0.996 0.000
#> SRR1377198     5  0.0405      0.989 0.000 0.004 0.000 0.008 0.988 0.000
#> SRR1377199     5  0.0582      0.987 0.000 0.004 0.004 0.004 0.984 0.004
#> SRR1377200     5  0.1699      0.963 0.000 0.004 0.008 0.012 0.936 0.040
#> SRR1377201     2  0.0806      0.850 0.020 0.972 0.008 0.000 0.000 0.000
#> SRR1377202     2  0.0806      0.850 0.020 0.972 0.008 0.000 0.000 0.000
#> SRR1377203     2  0.0806      0.850 0.020 0.972 0.008 0.000 0.000 0.000
#> SRR1377204     2  0.5846      0.469 0.060 0.632 0.016 0.232 0.004 0.056
#> SRR1377205     2  0.5846      0.469 0.060 0.632 0.016 0.232 0.004 0.056
#> SRR1377206     2  0.5846      0.469 0.060 0.632 0.016 0.232 0.004 0.056
#> SRR1377207     2  0.0806      0.850 0.020 0.972 0.008 0.000 0.000 0.000
#> SRR1377208     2  0.0806      0.850 0.020 0.972 0.008 0.000 0.000 0.000
#> SRR1377209     2  0.0806      0.850 0.020 0.972 0.008 0.000 0.000 0.000
#> SRR1377210     2  0.0806      0.850 0.020 0.972 0.008 0.000 0.000 0.000
#> SRR1377211     2  0.0806      0.850 0.020 0.972 0.008 0.000 0.000 0.000
#> SRR1377212     2  0.0806      0.850 0.020 0.972 0.008 0.000 0.000 0.000
#> SRR1377213     4  0.4447      0.864 0.024 0.180 0.052 0.740 0.000 0.004
#> SRR1377214     4  0.4447      0.864 0.024 0.180 0.052 0.740 0.000 0.004
#> SRR1377215     4  0.4447      0.864 0.024 0.180 0.052 0.740 0.000 0.004
#> SRR1377216     4  0.5775      0.806 0.052 0.204 0.100 0.636 0.000 0.008
#> SRR1377217     4  0.5775      0.806 0.052 0.204 0.100 0.636 0.000 0.008
#> SRR1377218     4  0.5775      0.806 0.052 0.204 0.100 0.636 0.000 0.008
#> SRR1377219     4  0.4732      0.864 0.024 0.188 0.068 0.716 0.000 0.004
#> SRR1377220     4  0.4732      0.864 0.024 0.188 0.068 0.716 0.000 0.004
#> SRR1377221     4  0.4732      0.864 0.024 0.188 0.068 0.716 0.000 0.004
#> SRR1377222     4  0.5568      0.710 0.060 0.108 0.040 0.712 0.004 0.076
#> SRR1377223     4  0.5568      0.710 0.060 0.108 0.040 0.712 0.004 0.076
#> SRR1377224     4  0.5568      0.710 0.060 0.108 0.040 0.712 0.004 0.076

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 13890 rows and 80 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 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-skmeans-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.505           0.849       0.908         0.4729 0.547   0.547
#> 3 3 0.674           0.798       0.876         0.4123 0.538   0.310
#> 4 4 0.729           0.805       0.781         0.0997 0.939   0.816
#> 5 5 0.793           0.896       0.895         0.0764 0.932   0.746
#> 6 6 0.977           0.978       0.973         0.0474 0.970   0.849

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
#> SRR1377145     2   0.574      0.834 0.136 0.864
#> SRR1377146     2   0.574      0.834 0.136 0.864
#> SRR1377147     2   0.574      0.834 0.136 0.864
#> SRR1377148     2   0.574      0.834 0.136 0.864
#> SRR1377153     2   0.574      0.834 0.136 0.864
#> SRR1377154     2   0.574      0.834 0.136 0.864
#> SRR1377155     2   0.574      0.834 0.136 0.864
#> SRR1377156     2   0.574      0.834 0.136 0.864
#> SRR1377149     2   0.574      0.834 0.136 0.864
#> SRR1377150     2   0.574      0.834 0.136 0.864
#> SRR1377151     2   0.574      0.834 0.136 0.864
#> SRR1377152     2   0.574      0.834 0.136 0.864
#> SRR1377157     2   0.000      0.884 0.000 1.000
#> SRR1377158     2   0.000      0.884 0.000 1.000
#> SRR1377159     2   0.000      0.884 0.000 1.000
#> SRR1377160     2   0.000      0.884 0.000 1.000
#> SRR1377161     2   0.000      0.884 0.000 1.000
#> SRR1377162     2   0.000      0.884 0.000 1.000
#> SRR1377163     2   0.000      0.884 0.000 1.000
#> SRR1377164     2   0.000      0.884 0.000 1.000
#> SRR1377169     2   0.000      0.884 0.000 1.000
#> SRR1377170     2   0.000      0.884 0.000 1.000
#> SRR1377171     2   0.000      0.884 0.000 1.000
#> SRR1377172     2   0.000      0.884 0.000 1.000
#> SRR1377165     2   0.000      0.884 0.000 1.000
#> SRR1377166     2   0.000      0.884 0.000 1.000
#> SRR1377167     2   0.000      0.884 0.000 1.000
#> SRR1377168     2   0.000      0.884 0.000 1.000
#> SRR1377173     2   0.295      0.873 0.052 0.948
#> SRR1377174     2   0.295      0.873 0.052 0.948
#> SRR1377175     2   0.295      0.873 0.052 0.948
#> SRR1377176     2   0.295      0.873 0.052 0.948
#> SRR1377177     2   0.295      0.873 0.052 0.948
#> SRR1377178     2   0.295      0.873 0.052 0.948
#> SRR1377179     2   0.295      0.873 0.052 0.948
#> SRR1377180     2   0.295      0.873 0.052 0.948
#> SRR1377181     2   0.295      0.873 0.052 0.948
#> SRR1377182     2   0.295      0.873 0.052 0.948
#> SRR1377183     2   0.295      0.873 0.052 0.948
#> SRR1377184     2   0.295      0.873 0.052 0.948
#> SRR1377185     2   0.295      0.873 0.052 0.948
#> SRR1377186     2   0.295      0.873 0.052 0.948
#> SRR1377187     2   0.295      0.873 0.052 0.948
#> SRR1377188     2   0.295      0.873 0.052 0.948
#> SRR1377189     1   0.295      0.964 0.948 0.052
#> SRR1377190     1   0.295      0.964 0.948 0.052
#> SRR1377191     1   0.295      0.964 0.948 0.052
#> SRR1377192     1   0.295      0.964 0.948 0.052
#> SRR1377193     1   0.295      0.964 0.948 0.052
#> SRR1377194     1   0.295      0.964 0.948 0.052
#> SRR1377195     1   0.295      0.903 0.948 0.052
#> SRR1377196     1   0.295      0.903 0.948 0.052
#> SRR1377197     1   0.295      0.903 0.948 0.052
#> SRR1377198     1   0.295      0.903 0.948 0.052
#> SRR1377199     1   0.295      0.903 0.948 0.052
#> SRR1377200     1   0.295      0.903 0.948 0.052
#> SRR1377201     1   0.295      0.964 0.948 0.052
#> SRR1377202     1   0.295      0.964 0.948 0.052
#> SRR1377203     1   0.295      0.964 0.948 0.052
#> SRR1377204     1   0.295      0.964 0.948 0.052
#> SRR1377205     1   0.295      0.964 0.948 0.052
#> SRR1377206     1   0.295      0.964 0.948 0.052
#> SRR1377207     1   0.295      0.964 0.948 0.052
#> SRR1377208     1   0.295      0.964 0.948 0.052
#> SRR1377209     1   0.295      0.964 0.948 0.052
#> SRR1377210     1   0.295      0.964 0.948 0.052
#> SRR1377211     1   0.295      0.964 0.948 0.052
#> SRR1377212     1   0.295      0.964 0.948 0.052
#> SRR1377213     2   0.983      0.310 0.424 0.576
#> SRR1377214     2   0.983      0.310 0.424 0.576
#> SRR1377215     2   0.983      0.310 0.424 0.576
#> SRR1377216     2   0.634      0.793 0.160 0.840
#> SRR1377217     2   0.634      0.793 0.160 0.840
#> SRR1377218     2   0.634      0.793 0.160 0.840
#> SRR1377219     2   0.983      0.310 0.424 0.576
#> SRR1377220     2   0.983      0.310 0.424 0.576
#> SRR1377221     2   0.983      0.310 0.424 0.576
#> SRR1377222     1   0.506      0.918 0.888 0.112
#> SRR1377223     1   0.506      0.918 0.888 0.112
#> SRR1377224     1   0.506      0.918 0.888 0.112

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>            class entropy silhouette    p1    p2    p3
#> SRR1377145     2  0.8105      0.639 0.084 0.580 0.336
#> SRR1377146     2  0.8105      0.639 0.084 0.580 0.336
#> SRR1377147     2  0.8105      0.639 0.084 0.580 0.336
#> SRR1377148     2  0.8105      0.639 0.084 0.580 0.336
#> SRR1377153     2  0.8105      0.639 0.084 0.580 0.336
#> SRR1377154     2  0.8105      0.639 0.084 0.580 0.336
#> SRR1377155     2  0.8105      0.639 0.084 0.580 0.336
#> SRR1377156     2  0.8105      0.639 0.084 0.580 0.336
#> SRR1377149     2  0.8105      0.639 0.084 0.580 0.336
#> SRR1377150     2  0.8105      0.639 0.084 0.580 0.336
#> SRR1377151     2  0.8105      0.639 0.084 0.580 0.336
#> SRR1377152     2  0.8105      0.639 0.084 0.580 0.336
#> SRR1377157     3  0.0892      0.821 0.020 0.000 0.980
#> SRR1377158     3  0.0892      0.821 0.020 0.000 0.980
#> SRR1377159     3  0.0892      0.821 0.020 0.000 0.980
#> SRR1377160     3  0.0892      0.821 0.020 0.000 0.980
#> SRR1377161     3  0.0892      0.821 0.020 0.000 0.980
#> SRR1377162     3  0.0892      0.821 0.020 0.000 0.980
#> SRR1377163     3  0.0892      0.821 0.020 0.000 0.980
#> SRR1377164     3  0.0892      0.821 0.020 0.000 0.980
#> SRR1377169     3  0.0892      0.821 0.020 0.000 0.980
#> SRR1377170     3  0.0892      0.821 0.020 0.000 0.980
#> SRR1377171     3  0.0892      0.821 0.020 0.000 0.980
#> SRR1377172     3  0.0892      0.821 0.020 0.000 0.980
#> SRR1377165     3  0.0892      0.821 0.020 0.000 0.980
#> SRR1377166     3  0.0892      0.821 0.020 0.000 0.980
#> SRR1377167     3  0.0892      0.821 0.020 0.000 0.980
#> SRR1377168     3  0.0892      0.821 0.020 0.000 0.980
#> SRR1377173     1  0.0237      0.958 0.996 0.000 0.004
#> SRR1377174     1  0.0237      0.958 0.996 0.000 0.004
#> SRR1377175     1  0.0237      0.958 0.996 0.000 0.004
#> SRR1377176     1  0.0237      0.958 0.996 0.000 0.004
#> SRR1377177     1  0.0237      0.958 0.996 0.000 0.004
#> SRR1377178     1  0.0237      0.958 0.996 0.000 0.004
#> SRR1377179     1  0.0237      0.958 0.996 0.000 0.004
#> SRR1377180     1  0.0237      0.958 0.996 0.000 0.004
#> SRR1377181     1  0.0237      0.958 0.996 0.000 0.004
#> SRR1377182     1  0.0237      0.958 0.996 0.000 0.004
#> SRR1377183     1  0.0237      0.958 0.996 0.000 0.004
#> SRR1377184     1  0.0237      0.958 0.996 0.000 0.004
#> SRR1377185     1  0.0237      0.958 0.996 0.000 0.004
#> SRR1377186     1  0.0237      0.958 0.996 0.000 0.004
#> SRR1377187     1  0.0237      0.958 0.996 0.000 0.004
#> SRR1377188     1  0.0237      0.958 0.996 0.000 0.004
#> SRR1377189     2  0.0424      0.789 0.000 0.992 0.008
#> SRR1377190     2  0.0424      0.789 0.000 0.992 0.008
#> SRR1377191     2  0.0424      0.789 0.000 0.992 0.008
#> SRR1377192     2  0.0424      0.789 0.000 0.992 0.008
#> SRR1377193     2  0.0424      0.789 0.000 0.992 0.008
#> SRR1377194     2  0.0424      0.789 0.000 0.992 0.008
#> SRR1377195     1  0.3551      0.882 0.868 0.132 0.000
#> SRR1377196     1  0.3551      0.882 0.868 0.132 0.000
#> SRR1377197     1  0.3551      0.882 0.868 0.132 0.000
#> SRR1377198     1  0.3551      0.882 0.868 0.132 0.000
#> SRR1377199     1  0.3551      0.882 0.868 0.132 0.000
#> SRR1377200     1  0.3551      0.882 0.868 0.132 0.000
#> SRR1377201     2  0.0000      0.790 0.000 1.000 0.000
#> SRR1377202     2  0.0000      0.790 0.000 1.000 0.000
#> SRR1377203     2  0.0000      0.790 0.000 1.000 0.000
#> SRR1377204     2  0.0000      0.790 0.000 1.000 0.000
#> SRR1377205     2  0.0000      0.790 0.000 1.000 0.000
#> SRR1377206     2  0.0000      0.790 0.000 1.000 0.000
#> SRR1377207     2  0.0000      0.790 0.000 1.000 0.000
#> SRR1377208     2  0.0000      0.790 0.000 1.000 0.000
#> SRR1377209     2  0.0000      0.790 0.000 1.000 0.000
#> SRR1377210     2  0.0000      0.790 0.000 1.000 0.000
#> SRR1377211     2  0.0000      0.790 0.000 1.000 0.000
#> SRR1377212     2  0.0000      0.790 0.000 1.000 0.000
#> SRR1377213     3  0.5763      0.718 0.008 0.276 0.716
#> SRR1377214     3  0.5763      0.718 0.008 0.276 0.716
#> SRR1377215     3  0.5763      0.718 0.008 0.276 0.716
#> SRR1377216     3  0.5420      0.740 0.008 0.240 0.752
#> SRR1377217     3  0.5420      0.740 0.008 0.240 0.752
#> SRR1377218     3  0.5420      0.740 0.008 0.240 0.752
#> SRR1377219     3  0.5728      0.721 0.008 0.272 0.720
#> SRR1377220     3  0.5728      0.721 0.008 0.272 0.720
#> SRR1377221     3  0.5728      0.721 0.008 0.272 0.720
#> SRR1377222     3  0.6527      0.555 0.008 0.404 0.588
#> SRR1377223     3  0.6527      0.555 0.008 0.404 0.588
#> SRR1377224     3  0.6527      0.555 0.008 0.404 0.588

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> SRR1377145     2  0.4286      0.599 0.028 0.812 0.152 0.008
#> SRR1377146     2  0.4286      0.599 0.028 0.812 0.152 0.008
#> SRR1377147     2  0.4286      0.599 0.028 0.812 0.152 0.008
#> SRR1377148     2  0.4286      0.599 0.028 0.812 0.152 0.008
#> SRR1377153     2  0.4286      0.599 0.028 0.812 0.152 0.008
#> SRR1377154     2  0.4286      0.599 0.028 0.812 0.152 0.008
#> SRR1377155     2  0.4286      0.599 0.028 0.812 0.152 0.008
#> SRR1377156     2  0.4286      0.599 0.028 0.812 0.152 0.008
#> SRR1377149     2  0.4286      0.599 0.028 0.812 0.152 0.008
#> SRR1377150     2  0.4286      0.599 0.028 0.812 0.152 0.008
#> SRR1377151     2  0.4286      0.599 0.028 0.812 0.152 0.008
#> SRR1377152     2  0.4286      0.599 0.028 0.812 0.152 0.008
#> SRR1377157     3  0.0000      1.000 0.000 0.000 1.000 0.000
#> SRR1377158     3  0.0000      1.000 0.000 0.000 1.000 0.000
#> SRR1377159     3  0.0000      1.000 0.000 0.000 1.000 0.000
#> SRR1377160     3  0.0000      1.000 0.000 0.000 1.000 0.000
#> SRR1377161     3  0.0000      1.000 0.000 0.000 1.000 0.000
#> SRR1377162     3  0.0000      1.000 0.000 0.000 1.000 0.000
#> SRR1377163     3  0.0000      1.000 0.000 0.000 1.000 0.000
#> SRR1377164     3  0.0000      1.000 0.000 0.000 1.000 0.000
#> SRR1377169     3  0.0000      1.000 0.000 0.000 1.000 0.000
#> SRR1377170     3  0.0000      1.000 0.000 0.000 1.000 0.000
#> SRR1377171     3  0.0000      1.000 0.000 0.000 1.000 0.000
#> SRR1377172     3  0.0000      1.000 0.000 0.000 1.000 0.000
#> SRR1377165     3  0.0000      1.000 0.000 0.000 1.000 0.000
#> SRR1377166     3  0.0000      1.000 0.000 0.000 1.000 0.000
#> SRR1377167     3  0.0000      1.000 0.000 0.000 1.000 0.000
#> SRR1377168     3  0.0000      1.000 0.000 0.000 1.000 0.000
#> SRR1377173     1  0.0188      0.930 0.996 0.000 0.004 0.000
#> SRR1377174     1  0.0188      0.930 0.996 0.000 0.004 0.000
#> SRR1377175     1  0.0188      0.930 0.996 0.000 0.004 0.000
#> SRR1377176     1  0.0188      0.930 0.996 0.000 0.004 0.000
#> SRR1377177     1  0.0188      0.930 0.996 0.000 0.004 0.000
#> SRR1377178     1  0.0188      0.930 0.996 0.000 0.004 0.000
#> SRR1377179     1  0.0188      0.930 0.996 0.000 0.004 0.000
#> SRR1377180     1  0.0188      0.930 0.996 0.000 0.004 0.000
#> SRR1377181     1  0.0188      0.930 0.996 0.000 0.004 0.000
#> SRR1377182     1  0.0188      0.930 0.996 0.000 0.004 0.000
#> SRR1377183     1  0.0188      0.930 0.996 0.000 0.004 0.000
#> SRR1377184     1  0.0188      0.930 0.996 0.000 0.004 0.000
#> SRR1377185     1  0.0188      0.930 0.996 0.000 0.004 0.000
#> SRR1377186     1  0.0188      0.930 0.996 0.000 0.004 0.000
#> SRR1377187     1  0.0188      0.930 0.996 0.000 0.004 0.000
#> SRR1377188     1  0.0188      0.930 0.996 0.000 0.004 0.000
#> SRR1377189     2  0.4804      0.715 0.000 0.616 0.000 0.384
#> SRR1377190     2  0.4804      0.715 0.000 0.616 0.000 0.384
#> SRR1377191     2  0.4804      0.715 0.000 0.616 0.000 0.384
#> SRR1377192     2  0.4804      0.715 0.000 0.616 0.000 0.384
#> SRR1377193     2  0.4804      0.715 0.000 0.616 0.000 0.384
#> SRR1377194     2  0.4804      0.715 0.000 0.616 0.000 0.384
#> SRR1377195     1  0.5226      0.793 0.744 0.076 0.000 0.180
#> SRR1377196     1  0.5226      0.793 0.744 0.076 0.000 0.180
#> SRR1377197     1  0.5226      0.793 0.744 0.076 0.000 0.180
#> SRR1377198     1  0.5226      0.793 0.744 0.076 0.000 0.180
#> SRR1377199     1  0.5226      0.793 0.744 0.076 0.000 0.180
#> SRR1377200     1  0.5226      0.793 0.744 0.076 0.000 0.180
#> SRR1377201     2  0.4790      0.719 0.000 0.620 0.000 0.380
#> SRR1377202     2  0.4790      0.719 0.000 0.620 0.000 0.380
#> SRR1377203     2  0.4790      0.719 0.000 0.620 0.000 0.380
#> SRR1377204     2  0.4961      0.670 0.000 0.552 0.000 0.448
#> SRR1377205     2  0.4961      0.670 0.000 0.552 0.000 0.448
#> SRR1377206     2  0.4961      0.670 0.000 0.552 0.000 0.448
#> SRR1377207     2  0.4790      0.719 0.000 0.620 0.000 0.380
#> SRR1377208     2  0.4790      0.719 0.000 0.620 0.000 0.380
#> SRR1377209     2  0.4790      0.719 0.000 0.620 0.000 0.380
#> SRR1377210     2  0.4790      0.719 0.000 0.620 0.000 0.380
#> SRR1377211     2  0.4790      0.719 0.000 0.620 0.000 0.380
#> SRR1377212     2  0.4790      0.719 0.000 0.620 0.000 0.380
#> SRR1377213     4  0.5028      0.807 0.000 0.004 0.400 0.596
#> SRR1377214     4  0.5028      0.807 0.000 0.004 0.400 0.596
#> SRR1377215     4  0.5028      0.807 0.000 0.004 0.400 0.596
#> SRR1377216     4  0.5112      0.760 0.000 0.004 0.436 0.560
#> SRR1377217     4  0.5112      0.760 0.000 0.004 0.436 0.560
#> SRR1377218     4  0.5112      0.760 0.000 0.004 0.436 0.560
#> SRR1377219     4  0.5028      0.807 0.000 0.004 0.400 0.596
#> SRR1377220     4  0.5028      0.807 0.000 0.004 0.400 0.596
#> SRR1377221     4  0.5028      0.807 0.000 0.004 0.400 0.596
#> SRR1377222     4  0.2334      0.568 0.000 0.004 0.088 0.908
#> SRR1377223     4  0.2334      0.568 0.000 0.004 0.088 0.908
#> SRR1377224     4  0.2334      0.568 0.000 0.004 0.088 0.908

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>            class entropy silhouette    p1    p2    p3    p4    p5
#> SRR1377145     5   0.423      1.000 0.004 0.100 0.072 0.016 0.808
#> SRR1377146     5   0.423      1.000 0.004 0.100 0.072 0.016 0.808
#> SRR1377147     5   0.423      1.000 0.004 0.100 0.072 0.016 0.808
#> SRR1377148     5   0.423      1.000 0.004 0.100 0.072 0.016 0.808
#> SRR1377153     5   0.423      1.000 0.004 0.100 0.072 0.016 0.808
#> SRR1377154     5   0.423      1.000 0.004 0.100 0.072 0.016 0.808
#> SRR1377155     5   0.423      1.000 0.004 0.100 0.072 0.016 0.808
#> SRR1377156     5   0.423      1.000 0.004 0.100 0.072 0.016 0.808
#> SRR1377149     5   0.423      1.000 0.004 0.100 0.072 0.016 0.808
#> SRR1377150     5   0.423      1.000 0.004 0.100 0.072 0.016 0.808
#> SRR1377151     5   0.423      1.000 0.004 0.100 0.072 0.016 0.808
#> SRR1377152     5   0.423      1.000 0.004 0.100 0.072 0.016 0.808
#> SRR1377157     3   0.000      1.000 0.000 0.000 1.000 0.000 0.000
#> SRR1377158     3   0.000      1.000 0.000 0.000 1.000 0.000 0.000
#> SRR1377159     3   0.000      1.000 0.000 0.000 1.000 0.000 0.000
#> SRR1377160     3   0.000      1.000 0.000 0.000 1.000 0.000 0.000
#> SRR1377161     3   0.000      1.000 0.000 0.000 1.000 0.000 0.000
#> SRR1377162     3   0.000      1.000 0.000 0.000 1.000 0.000 0.000
#> SRR1377163     3   0.000      1.000 0.000 0.000 1.000 0.000 0.000
#> SRR1377164     3   0.000      1.000 0.000 0.000 1.000 0.000 0.000
#> SRR1377169     3   0.000      1.000 0.000 0.000 1.000 0.000 0.000
#> SRR1377170     3   0.000      1.000 0.000 0.000 1.000 0.000 0.000
#> SRR1377171     3   0.000      1.000 0.000 0.000 1.000 0.000 0.000
#> SRR1377172     3   0.000      1.000 0.000 0.000 1.000 0.000 0.000
#> SRR1377165     3   0.000      1.000 0.000 0.000 1.000 0.000 0.000
#> SRR1377166     3   0.000      1.000 0.000 0.000 1.000 0.000 0.000
#> SRR1377167     3   0.000      1.000 0.000 0.000 1.000 0.000 0.000
#> SRR1377168     3   0.000      1.000 0.000 0.000 1.000 0.000 0.000
#> SRR1377173     1   0.000      0.842 1.000 0.000 0.000 0.000 0.000
#> SRR1377174     1   0.000      0.842 1.000 0.000 0.000 0.000 0.000
#> SRR1377175     1   0.000      0.842 1.000 0.000 0.000 0.000 0.000
#> SRR1377176     1   0.000      0.842 1.000 0.000 0.000 0.000 0.000
#> SRR1377177     1   0.000      0.842 1.000 0.000 0.000 0.000 0.000
#> SRR1377178     1   0.000      0.842 1.000 0.000 0.000 0.000 0.000
#> SRR1377179     1   0.000      0.842 1.000 0.000 0.000 0.000 0.000
#> SRR1377180     1   0.000      0.842 1.000 0.000 0.000 0.000 0.000
#> SRR1377181     1   0.000      0.842 1.000 0.000 0.000 0.000 0.000
#> SRR1377182     1   0.000      0.842 1.000 0.000 0.000 0.000 0.000
#> SRR1377183     1   0.000      0.842 1.000 0.000 0.000 0.000 0.000
#> SRR1377184     1   0.000      0.842 1.000 0.000 0.000 0.000 0.000
#> SRR1377185     1   0.000      0.842 1.000 0.000 0.000 0.000 0.000
#> SRR1377186     1   0.000      0.842 1.000 0.000 0.000 0.000 0.000
#> SRR1377187     1   0.000      0.842 1.000 0.000 0.000 0.000 0.000
#> SRR1377188     1   0.000      0.842 1.000 0.000 0.000 0.000 0.000
#> SRR1377189     2   0.323      0.871 0.000 0.852 0.000 0.060 0.088
#> SRR1377190     2   0.323      0.871 0.000 0.852 0.000 0.060 0.088
#> SRR1377191     2   0.323      0.871 0.000 0.852 0.000 0.060 0.088
#> SRR1377192     2   0.323      0.871 0.000 0.852 0.000 0.060 0.088
#> SRR1377193     2   0.323      0.871 0.000 0.852 0.000 0.060 0.088
#> SRR1377194     2   0.323      0.871 0.000 0.852 0.000 0.060 0.088
#> SRR1377195     1   0.810      0.425 0.412 0.260 0.000 0.136 0.192
#> SRR1377196     1   0.810      0.425 0.412 0.260 0.000 0.136 0.192
#> SRR1377197     1   0.810      0.425 0.412 0.260 0.000 0.136 0.192
#> SRR1377198     1   0.810      0.425 0.412 0.260 0.000 0.136 0.192
#> SRR1377199     1   0.810      0.425 0.412 0.260 0.000 0.136 0.192
#> SRR1377200     1   0.810      0.425 0.412 0.260 0.000 0.136 0.192
#> SRR1377201     2   0.000      0.934 0.000 1.000 0.000 0.000 0.000
#> SRR1377202     2   0.000      0.934 0.000 1.000 0.000 0.000 0.000
#> SRR1377203     2   0.000      0.934 0.000 1.000 0.000 0.000 0.000
#> SRR1377204     2   0.130      0.911 0.000 0.956 0.000 0.028 0.016
#> SRR1377205     2   0.130      0.911 0.000 0.956 0.000 0.028 0.016
#> SRR1377206     2   0.130      0.911 0.000 0.956 0.000 0.028 0.016
#> SRR1377207     2   0.000      0.934 0.000 1.000 0.000 0.000 0.000
#> SRR1377208     2   0.000      0.934 0.000 1.000 0.000 0.000 0.000
#> SRR1377209     2   0.000      0.934 0.000 1.000 0.000 0.000 0.000
#> SRR1377210     2   0.000      0.934 0.000 1.000 0.000 0.000 0.000
#> SRR1377211     2   0.000      0.934 0.000 1.000 0.000 0.000 0.000
#> SRR1377212     2   0.000      0.934 0.000 1.000 0.000 0.000 0.000
#> SRR1377213     4   0.282      0.959 0.000 0.020 0.116 0.864 0.000
#> SRR1377214     4   0.282      0.959 0.000 0.020 0.116 0.864 0.000
#> SRR1377215     4   0.282      0.959 0.000 0.020 0.116 0.864 0.000
#> SRR1377216     4   0.258      0.947 0.000 0.004 0.132 0.864 0.000
#> SRR1377217     4   0.258      0.947 0.000 0.004 0.132 0.864 0.000
#> SRR1377218     4   0.258      0.947 0.000 0.004 0.132 0.864 0.000
#> SRR1377219     4   0.282      0.959 0.000 0.020 0.116 0.864 0.000
#> SRR1377220     4   0.282      0.959 0.000 0.020 0.116 0.864 0.000
#> SRR1377221     4   0.282      0.959 0.000 0.020 0.116 0.864 0.000
#> SRR1377222     4   0.217      0.891 0.000 0.076 0.016 0.908 0.000
#> SRR1377223     4   0.217      0.891 0.000 0.076 0.016 0.908 0.000
#> SRR1377224     4   0.217      0.891 0.000 0.076 0.016 0.908 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
#> SRR1377145     6  0.0508      1.000 0.000 0.004 0.012 0.000 0.000 0.984
#> SRR1377146     6  0.0508      1.000 0.000 0.004 0.012 0.000 0.000 0.984
#> SRR1377147     6  0.0508      1.000 0.000 0.004 0.012 0.000 0.000 0.984
#> SRR1377148     6  0.0508      1.000 0.000 0.004 0.012 0.000 0.000 0.984
#> SRR1377153     6  0.0508      1.000 0.000 0.004 0.012 0.000 0.000 0.984
#> SRR1377154     6  0.0508      1.000 0.000 0.004 0.012 0.000 0.000 0.984
#> SRR1377155     6  0.0508      1.000 0.000 0.004 0.012 0.000 0.000 0.984
#> SRR1377156     6  0.0508      1.000 0.000 0.004 0.012 0.000 0.000 0.984
#> SRR1377149     6  0.0508      1.000 0.000 0.004 0.012 0.000 0.000 0.984
#> SRR1377150     6  0.0508      1.000 0.000 0.004 0.012 0.000 0.000 0.984
#> SRR1377151     6  0.0508      1.000 0.000 0.004 0.012 0.000 0.000 0.984
#> SRR1377152     6  0.0508      1.000 0.000 0.004 0.012 0.000 0.000 0.984
#> SRR1377157     3  0.0000      0.999 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1377158     3  0.0000      0.999 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1377159     3  0.0000      0.999 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1377160     3  0.0000      0.999 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1377161     3  0.0000      0.999 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1377162     3  0.0000      0.999 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1377163     3  0.0000      0.999 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1377164     3  0.0000      0.999 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1377169     3  0.0146      0.997 0.000 0.000 0.996 0.000 0.004 0.000
#> SRR1377170     3  0.0146      0.997 0.000 0.000 0.996 0.000 0.004 0.000
#> SRR1377171     3  0.0146      0.997 0.000 0.000 0.996 0.000 0.004 0.000
#> SRR1377172     3  0.0146      0.997 0.000 0.000 0.996 0.000 0.004 0.000
#> SRR1377165     3  0.0000      0.999 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1377166     3  0.0000      0.999 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1377167     3  0.0000      0.999 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1377168     3  0.0000      0.999 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1377173     1  0.0260      0.997 0.992 0.000 0.008 0.000 0.000 0.000
#> SRR1377174     1  0.0260      0.997 0.992 0.000 0.008 0.000 0.000 0.000
#> SRR1377175     1  0.0260      0.997 0.992 0.000 0.008 0.000 0.000 0.000
#> SRR1377176     1  0.0260      0.997 0.992 0.000 0.008 0.000 0.000 0.000
#> SRR1377177     1  0.0260      0.997 0.992 0.000 0.008 0.000 0.000 0.000
#> SRR1377178     1  0.0260      0.997 0.992 0.000 0.008 0.000 0.000 0.000
#> SRR1377179     1  0.0260      0.997 0.992 0.000 0.008 0.000 0.000 0.000
#> SRR1377180     1  0.0260      0.997 0.992 0.000 0.008 0.000 0.000 0.000
#> SRR1377181     1  0.0405      0.997 0.988 0.000 0.008 0.000 0.000 0.004
#> SRR1377182     1  0.0405      0.997 0.988 0.000 0.008 0.000 0.000 0.004
#> SRR1377183     1  0.0551      0.996 0.984 0.000 0.008 0.000 0.004 0.004
#> SRR1377184     1  0.0405      0.997 0.988 0.000 0.008 0.000 0.000 0.004
#> SRR1377185     1  0.0551      0.996 0.984 0.000 0.008 0.000 0.004 0.004
#> SRR1377186     1  0.0551      0.996 0.984 0.000 0.008 0.000 0.004 0.004
#> SRR1377187     1  0.0405      0.997 0.988 0.000 0.008 0.000 0.000 0.004
#> SRR1377188     1  0.0551      0.996 0.984 0.000 0.008 0.000 0.004 0.004
#> SRR1377189     2  0.3744      0.875 0.008 0.828 0.000 0.048 0.060 0.056
#> SRR1377190     2  0.3744      0.875 0.008 0.828 0.000 0.048 0.060 0.056
#> SRR1377191     2  0.3744      0.875 0.008 0.828 0.000 0.048 0.060 0.056
#> SRR1377192     2  0.3744      0.875 0.008 0.828 0.000 0.048 0.060 0.056
#> SRR1377193     2  0.3744      0.875 0.008 0.828 0.000 0.048 0.060 0.056
#> SRR1377194     2  0.3744      0.875 0.008 0.828 0.000 0.048 0.060 0.056
#> SRR1377195     5  0.1334      1.000 0.032 0.020 0.000 0.000 0.948 0.000
#> SRR1377196     5  0.1334      1.000 0.032 0.020 0.000 0.000 0.948 0.000
#> SRR1377197     5  0.1334      1.000 0.032 0.020 0.000 0.000 0.948 0.000
#> SRR1377198     5  0.1334      1.000 0.032 0.020 0.000 0.000 0.948 0.000
#> SRR1377199     5  0.1334      1.000 0.032 0.020 0.000 0.000 0.948 0.000
#> SRR1377200     5  0.1334      1.000 0.032 0.020 0.000 0.000 0.948 0.000
#> SRR1377201     2  0.0622      0.931 0.000 0.980 0.000 0.000 0.008 0.012
#> SRR1377202     2  0.0622      0.931 0.000 0.980 0.000 0.000 0.008 0.012
#> SRR1377203     2  0.0622      0.931 0.000 0.980 0.000 0.000 0.008 0.012
#> SRR1377204     2  0.0858      0.925 0.000 0.968 0.000 0.004 0.028 0.000
#> SRR1377205     2  0.0858      0.925 0.000 0.968 0.000 0.004 0.028 0.000
#> SRR1377206     2  0.0858      0.925 0.000 0.968 0.000 0.004 0.028 0.000
#> SRR1377207     2  0.0622      0.931 0.000 0.980 0.000 0.000 0.008 0.012
#> SRR1377208     2  0.0622      0.931 0.000 0.980 0.000 0.000 0.008 0.012
#> SRR1377209     2  0.0622      0.931 0.000 0.980 0.000 0.000 0.008 0.012
#> SRR1377210     2  0.0363      0.931 0.000 0.988 0.000 0.000 0.000 0.012
#> SRR1377211     2  0.0363      0.931 0.000 0.988 0.000 0.000 0.000 0.012
#> SRR1377212     2  0.0363      0.931 0.000 0.988 0.000 0.000 0.000 0.012
#> SRR1377213     4  0.0363      0.993 0.000 0.000 0.012 0.988 0.000 0.000
#> SRR1377214     4  0.0363      0.993 0.000 0.000 0.012 0.988 0.000 0.000
#> SRR1377215     4  0.0363      0.993 0.000 0.000 0.012 0.988 0.000 0.000
#> SRR1377216     4  0.0458      0.990 0.000 0.000 0.016 0.984 0.000 0.000
#> SRR1377217     4  0.0458      0.990 0.000 0.000 0.016 0.984 0.000 0.000
#> SRR1377218     4  0.0458      0.990 0.000 0.000 0.016 0.984 0.000 0.000
#> SRR1377219     4  0.0363      0.993 0.000 0.000 0.012 0.988 0.000 0.000
#> SRR1377220     4  0.0363      0.993 0.000 0.000 0.012 0.988 0.000 0.000
#> SRR1377221     4  0.0363      0.993 0.000 0.000 0.012 0.988 0.000 0.000
#> SRR1377222     4  0.0767      0.982 0.000 0.012 0.004 0.976 0.008 0.000
#> SRR1377223     4  0.0767      0.982 0.000 0.012 0.004 0.976 0.008 0.000
#> SRR1377224     4  0.0767      0.982 0.000 0.012 0.004 0.976 0.008 0.000

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

consensus_heatmap(res, k = 2)

plot of chunk tab-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 13890 rows and 80 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           1.000       1.000         0.1414 0.859   0.859
#> 3 3     1           0.994       0.997         2.0955 0.706   0.658
#> 4 4     1           0.987       0.986         0.3986 0.825   0.691
#> 5 5     1           1.000       1.000         0.2434 0.848   0.612
#> 6 6     1           1.000       1.000         0.0897 0.932   0.714

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
#> SRR1377145     2       0          1  0  1
#> SRR1377146     2       0          1  0  1
#> SRR1377147     2       0          1  0  1
#> SRR1377148     2       0          1  0  1
#> SRR1377153     2       0          1  0  1
#> SRR1377154     2       0          1  0  1
#> SRR1377155     2       0          1  0  1
#> SRR1377156     2       0          1  0  1
#> SRR1377149     2       0          1  0  1
#> SRR1377150     2       0          1  0  1
#> SRR1377151     2       0          1  0  1
#> SRR1377152     2       0          1  0  1
#> SRR1377157     2       0          1  0  1
#> SRR1377158     2       0          1  0  1
#> SRR1377159     2       0          1  0  1
#> SRR1377160     2       0          1  0  1
#> SRR1377161     2       0          1  0  1
#> SRR1377162     2       0          1  0  1
#> SRR1377163     2       0          1  0  1
#> SRR1377164     2       0          1  0  1
#> SRR1377169     2       0          1  0  1
#> SRR1377170     2       0          1  0  1
#> SRR1377171     2       0          1  0  1
#> SRR1377172     2       0          1  0  1
#> SRR1377165     2       0          1  0  1
#> SRR1377166     2       0          1  0  1
#> SRR1377167     2       0          1  0  1
#> SRR1377168     2       0          1  0  1
#> SRR1377173     2       0          1  0  1
#> SRR1377174     2       0          1  0  1
#> SRR1377175     2       0          1  0  1
#> SRR1377176     2       0          1  0  1
#> SRR1377177     2       0          1  0  1
#> SRR1377178     2       0          1  0  1
#> SRR1377179     2       0          1  0  1
#> SRR1377180     2       0          1  0  1
#> SRR1377181     2       0          1  0  1
#> SRR1377182     2       0          1  0  1
#> SRR1377183     2       0          1  0  1
#> SRR1377184     2       0          1  0  1
#> SRR1377185     2       0          1  0  1
#> SRR1377186     2       0          1  0  1
#> SRR1377187     2       0          1  0  1
#> SRR1377188     2       0          1  0  1
#> SRR1377189     2       0          1  0  1
#> SRR1377190     2       0          1  0  1
#> SRR1377191     2       0          1  0  1
#> SRR1377192     2       0          1  0  1
#> SRR1377193     2       0          1  0  1
#> SRR1377194     2       0          1  0  1
#> SRR1377195     1       0          1  1  0
#> SRR1377196     1       0          1  1  0
#> SRR1377197     1       0          1  1  0
#> SRR1377198     1       0          1  1  0
#> SRR1377199     1       0          1  1  0
#> SRR1377200     1       0          1  1  0
#> SRR1377201     2       0          1  0  1
#> SRR1377202     2       0          1  0  1
#> SRR1377203     2       0          1  0  1
#> SRR1377204     2       0          1  0  1
#> SRR1377205     2       0          1  0  1
#> SRR1377206     2       0          1  0  1
#> SRR1377207     2       0          1  0  1
#> SRR1377208     2       0          1  0  1
#> SRR1377209     2       0          1  0  1
#> SRR1377210     2       0          1  0  1
#> SRR1377211     2       0          1  0  1
#> SRR1377212     2       0          1  0  1
#> SRR1377213     2       0          1  0  1
#> SRR1377214     2       0          1  0  1
#> SRR1377215     2       0          1  0  1
#> SRR1377216     2       0          1  0  1
#> SRR1377217     2       0          1  0  1
#> SRR1377218     2       0          1  0  1
#> SRR1377219     2       0          1  0  1
#> SRR1377220     2       0          1  0  1
#> SRR1377221     2       0          1  0  1
#> SRR1377222     2       0          1  0  1
#> SRR1377223     2       0          1  0  1
#> SRR1377224     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
#> SRR1377145     2  0.0000      0.996  0 1.000 0.000
#> SRR1377146     2  0.0000      0.996  0 1.000 0.000
#> SRR1377147     2  0.0000      0.996  0 1.000 0.000
#> SRR1377148     2  0.0000      0.996  0 1.000 0.000
#> SRR1377153     2  0.0000      0.996  0 1.000 0.000
#> SRR1377154     2  0.0000      0.996  0 1.000 0.000
#> SRR1377155     2  0.0000      0.996  0 1.000 0.000
#> SRR1377156     2  0.0000      0.996  0 1.000 0.000
#> SRR1377149     2  0.0000      0.996  0 1.000 0.000
#> SRR1377150     2  0.0000      0.996  0 1.000 0.000
#> SRR1377151     2  0.0000      0.996  0 1.000 0.000
#> SRR1377152     2  0.0000      0.996  0 1.000 0.000
#> SRR1377157     3  0.0000      1.000  0 0.000 1.000
#> SRR1377158     3  0.0000      1.000  0 0.000 1.000
#> SRR1377159     3  0.0000      1.000  0 0.000 1.000
#> SRR1377160     3  0.0000      1.000  0 0.000 1.000
#> SRR1377161     3  0.0000      1.000  0 0.000 1.000
#> SRR1377162     3  0.0000      1.000  0 0.000 1.000
#> SRR1377163     3  0.0000      1.000  0 0.000 1.000
#> SRR1377164     3  0.0000      1.000  0 0.000 1.000
#> SRR1377169     3  0.0000      1.000  0 0.000 1.000
#> SRR1377170     3  0.0000      1.000  0 0.000 1.000
#> SRR1377171     3  0.0000      1.000  0 0.000 1.000
#> SRR1377172     3  0.0000      1.000  0 0.000 1.000
#> SRR1377165     3  0.0000      1.000  0 0.000 1.000
#> SRR1377166     3  0.0000      1.000  0 0.000 1.000
#> SRR1377167     3  0.0000      1.000  0 0.000 1.000
#> SRR1377168     3  0.0000      1.000  0 0.000 1.000
#> SRR1377173     2  0.0000      0.996  0 1.000 0.000
#> SRR1377174     2  0.0592      0.985  0 0.988 0.012
#> SRR1377175     2  0.2711      0.903  0 0.912 0.088
#> SRR1377176     2  0.0237      0.992  0 0.996 0.004
#> SRR1377177     2  0.0237      0.992  0 0.996 0.004
#> SRR1377178     2  0.1753      0.950  0 0.952 0.048
#> SRR1377179     2  0.1643      0.954  0 0.956 0.044
#> SRR1377180     2  0.1411      0.962  0 0.964 0.036
#> SRR1377181     2  0.0000      0.996  0 1.000 0.000
#> SRR1377182     2  0.0000      0.996  0 1.000 0.000
#> SRR1377183     2  0.0000      0.996  0 1.000 0.000
#> SRR1377184     2  0.0000      0.996  0 1.000 0.000
#> SRR1377185     2  0.0000      0.996  0 1.000 0.000
#> SRR1377186     2  0.0237      0.992  0 0.996 0.004
#> SRR1377187     2  0.0000      0.996  0 1.000 0.000
#> SRR1377188     2  0.0000      0.996  0 1.000 0.000
#> SRR1377189     2  0.0000      0.996  0 1.000 0.000
#> SRR1377190     2  0.0000      0.996  0 1.000 0.000
#> SRR1377191     2  0.0000      0.996  0 1.000 0.000
#> SRR1377192     2  0.0000      0.996  0 1.000 0.000
#> SRR1377193     2  0.0000      0.996  0 1.000 0.000
#> SRR1377194     2  0.0000      0.996  0 1.000 0.000
#> SRR1377195     1  0.0000      1.000  1 0.000 0.000
#> SRR1377196     1  0.0000      1.000  1 0.000 0.000
#> SRR1377197     1  0.0000      1.000  1 0.000 0.000
#> SRR1377198     1  0.0000      1.000  1 0.000 0.000
#> SRR1377199     1  0.0000      1.000  1 0.000 0.000
#> SRR1377200     1  0.0000      1.000  1 0.000 0.000
#> SRR1377201     2  0.0000      0.996  0 1.000 0.000
#> SRR1377202     2  0.0000      0.996  0 1.000 0.000
#> SRR1377203     2  0.0000      0.996  0 1.000 0.000
#> SRR1377204     2  0.0000      0.996  0 1.000 0.000
#> SRR1377205     2  0.0000      0.996  0 1.000 0.000
#> SRR1377206     2  0.0000      0.996  0 1.000 0.000
#> SRR1377207     2  0.0000      0.996  0 1.000 0.000
#> SRR1377208     2  0.0000      0.996  0 1.000 0.000
#> SRR1377209     2  0.0000      0.996  0 1.000 0.000
#> SRR1377210     2  0.0000      0.996  0 1.000 0.000
#> SRR1377211     2  0.0000      0.996  0 1.000 0.000
#> SRR1377212     2  0.0000      0.996  0 1.000 0.000
#> SRR1377213     2  0.0000      0.996  0 1.000 0.000
#> SRR1377214     2  0.0000      0.996  0 1.000 0.000
#> SRR1377215     2  0.0000      0.996  0 1.000 0.000
#> SRR1377216     2  0.0000      0.996  0 1.000 0.000
#> SRR1377217     2  0.0000      0.996  0 1.000 0.000
#> SRR1377218     2  0.0000      0.996  0 1.000 0.000
#> SRR1377219     2  0.0000      0.996  0 1.000 0.000
#> SRR1377220     2  0.0000      0.996  0 1.000 0.000
#> SRR1377221     2  0.0000      0.996  0 1.000 0.000
#> SRR1377222     2  0.0000      0.996  0 1.000 0.000
#> SRR1377223     2  0.0000      0.996  0 1.000 0.000
#> SRR1377224     2  0.0000      0.996  0 1.000 0.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette p1    p2    p3    p4
#> SRR1377145     2  0.0000      0.985  0 1.000 0.000 0.000
#> SRR1377146     2  0.0000      0.985  0 1.000 0.000 0.000
#> SRR1377147     2  0.0000      0.985  0 1.000 0.000 0.000
#> SRR1377148     2  0.0000      0.985  0 1.000 0.000 0.000
#> SRR1377153     2  0.0000      0.985  0 1.000 0.000 0.000
#> SRR1377154     2  0.0000      0.985  0 1.000 0.000 0.000
#> SRR1377155     2  0.0000      0.985  0 1.000 0.000 0.000
#> SRR1377156     2  0.0000      0.985  0 1.000 0.000 0.000
#> SRR1377149     2  0.0000      0.985  0 1.000 0.000 0.000
#> SRR1377150     2  0.0188      0.983  0 0.996 0.000 0.004
#> SRR1377151     2  0.0000      0.985  0 1.000 0.000 0.000
#> SRR1377152     2  0.0000      0.985  0 1.000 0.000 0.000
#> SRR1377157     3  0.0000      1.000  0 0.000 1.000 0.000
#> SRR1377158     3  0.0000      1.000  0 0.000 1.000 0.000
#> SRR1377159     3  0.0000      1.000  0 0.000 1.000 0.000
#> SRR1377160     3  0.0000      1.000  0 0.000 1.000 0.000
#> SRR1377161     3  0.0000      1.000  0 0.000 1.000 0.000
#> SRR1377162     3  0.0000      1.000  0 0.000 1.000 0.000
#> SRR1377163     3  0.0000      1.000  0 0.000 1.000 0.000
#> SRR1377164     3  0.0000      1.000  0 0.000 1.000 0.000
#> SRR1377169     3  0.0000      1.000  0 0.000 1.000 0.000
#> SRR1377170     3  0.0000      1.000  0 0.000 1.000 0.000
#> SRR1377171     3  0.0000      1.000  0 0.000 1.000 0.000
#> SRR1377172     3  0.0000      1.000  0 0.000 1.000 0.000
#> SRR1377165     3  0.0000      1.000  0 0.000 1.000 0.000
#> SRR1377166     3  0.0000      1.000  0 0.000 1.000 0.000
#> SRR1377167     3  0.0000      1.000  0 0.000 1.000 0.000
#> SRR1377168     3  0.0000      1.000  0 0.000 1.000 0.000
#> SRR1377173     2  0.1022      0.973  0 0.968 0.000 0.032
#> SRR1377174     2  0.1356      0.969  0 0.960 0.008 0.032
#> SRR1377175     2  0.2871      0.908  0 0.896 0.072 0.032
#> SRR1377176     2  0.1209      0.971  0 0.964 0.004 0.032
#> SRR1377177     2  0.1022      0.973  0 0.968 0.000 0.032
#> SRR1377178     2  0.2036      0.951  0 0.936 0.032 0.032
#> SRR1377179     2  0.2036      0.951  0 0.936 0.032 0.032
#> SRR1377180     2  0.2036      0.951  0 0.936 0.032 0.032
#> SRR1377181     2  0.1022      0.973  0 0.968 0.000 0.032
#> SRR1377182     2  0.1022      0.973  0 0.968 0.000 0.032
#> SRR1377183     2  0.1022      0.973  0 0.968 0.000 0.032
#> SRR1377184     2  0.1022      0.973  0 0.968 0.000 0.032
#> SRR1377185     2  0.1022      0.973  0 0.968 0.000 0.032
#> SRR1377186     2  0.1209      0.971  0 0.964 0.004 0.032
#> SRR1377187     2  0.1022      0.973  0 0.968 0.000 0.032
#> SRR1377188     2  0.1022      0.973  0 0.968 0.000 0.032
#> SRR1377189     2  0.0000      0.985  0 1.000 0.000 0.000
#> SRR1377190     2  0.0000      0.985  0 1.000 0.000 0.000
#> SRR1377191     2  0.0000      0.985  0 1.000 0.000 0.000
#> SRR1377192     2  0.0000      0.985  0 1.000 0.000 0.000
#> SRR1377193     2  0.0000      0.985  0 1.000 0.000 0.000
#> SRR1377194     2  0.0000      0.985  0 1.000 0.000 0.000
#> SRR1377195     1  0.0000      1.000  1 0.000 0.000 0.000
#> SRR1377196     1  0.0000      1.000  1 0.000 0.000 0.000
#> SRR1377197     1  0.0000      1.000  1 0.000 0.000 0.000
#> SRR1377198     1  0.0000      1.000  1 0.000 0.000 0.000
#> SRR1377199     1  0.0000      1.000  1 0.000 0.000 0.000
#> SRR1377200     1  0.0000      1.000  1 0.000 0.000 0.000
#> SRR1377201     2  0.0000      0.985  0 1.000 0.000 0.000
#> SRR1377202     2  0.0000      0.985  0 1.000 0.000 0.000
#> SRR1377203     2  0.0000      0.985  0 1.000 0.000 0.000
#> SRR1377204     2  0.0000      0.985  0 1.000 0.000 0.000
#> SRR1377205     2  0.0000      0.985  0 1.000 0.000 0.000
#> SRR1377206     2  0.0000      0.985  0 1.000 0.000 0.000
#> SRR1377207     2  0.0000      0.985  0 1.000 0.000 0.000
#> SRR1377208     2  0.0000      0.985  0 1.000 0.000 0.000
#> SRR1377209     2  0.0000      0.985  0 1.000 0.000 0.000
#> SRR1377210     2  0.0000      0.985  0 1.000 0.000 0.000
#> SRR1377211     2  0.0000      0.985  0 1.000 0.000 0.000
#> SRR1377212     2  0.0000      0.985  0 1.000 0.000 0.000
#> SRR1377213     4  0.1022      1.000  0 0.032 0.000 0.968
#> SRR1377214     4  0.1022      1.000  0 0.032 0.000 0.968
#> SRR1377215     4  0.1022      1.000  0 0.032 0.000 0.968
#> SRR1377216     4  0.1022      1.000  0 0.032 0.000 0.968
#> SRR1377217     4  0.1022      1.000  0 0.032 0.000 0.968
#> SRR1377218     4  0.1022      1.000  0 0.032 0.000 0.968
#> SRR1377219     4  0.1022      1.000  0 0.032 0.000 0.968
#> SRR1377220     4  0.1022      1.000  0 0.032 0.000 0.968
#> SRR1377221     4  0.1022      1.000  0 0.032 0.000 0.968
#> SRR1377222     4  0.1022      1.000  0 0.032 0.000 0.968
#> SRR1377223     4  0.1022      1.000  0 0.032 0.000 0.968
#> SRR1377224     4  0.1022      1.000  0 0.032 0.000 0.968

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>            class entropy silhouette p1 p2 p3 p4 p5
#> SRR1377145     2       0          1  0  1  0  0  0
#> SRR1377146     2       0          1  0  1  0  0  0
#> SRR1377147     2       0          1  0  1  0  0  0
#> SRR1377148     2       0          1  0  1  0  0  0
#> SRR1377153     2       0          1  0  1  0  0  0
#> SRR1377154     2       0          1  0  1  0  0  0
#> SRR1377155     2       0          1  0  1  0  0  0
#> SRR1377156     2       0          1  0  1  0  0  0
#> SRR1377149     2       0          1  0  1  0  0  0
#> SRR1377150     2       0          1  0  1  0  0  0
#> SRR1377151     2       0          1  0  1  0  0  0
#> SRR1377152     2       0          1  0  1  0  0  0
#> SRR1377157     3       0          1  0  0  1  0  0
#> SRR1377158     3       0          1  0  0  1  0  0
#> SRR1377159     3       0          1  0  0  1  0  0
#> SRR1377160     3       0          1  0  0  1  0  0
#> SRR1377161     3       0          1  0  0  1  0  0
#> SRR1377162     3       0          1  0  0  1  0  0
#> SRR1377163     3       0          1  0  0  1  0  0
#> SRR1377164     3       0          1  0  0  1  0  0
#> SRR1377169     3       0          1  0  0  1  0  0
#> SRR1377170     3       0          1  0  0  1  0  0
#> SRR1377171     3       0          1  0  0  1  0  0
#> SRR1377172     3       0          1  0  0  1  0  0
#> SRR1377165     3       0          1  0  0  1  0  0
#> SRR1377166     3       0          1  0  0  1  0  0
#> SRR1377167     3       0          1  0  0  1  0  0
#> SRR1377168     3       0          1  0  0  1  0  0
#> SRR1377173     1       0          1  1  0  0  0  0
#> SRR1377174     1       0          1  1  0  0  0  0
#> SRR1377175     1       0          1  1  0  0  0  0
#> SRR1377176     1       0          1  1  0  0  0  0
#> SRR1377177     1       0          1  1  0  0  0  0
#> SRR1377178     1       0          1  1  0  0  0  0
#> SRR1377179     1       0          1  1  0  0  0  0
#> SRR1377180     1       0          1  1  0  0  0  0
#> SRR1377181     1       0          1  1  0  0  0  0
#> SRR1377182     1       0          1  1  0  0  0  0
#> SRR1377183     1       0          1  1  0  0  0  0
#> SRR1377184     1       0          1  1  0  0  0  0
#> SRR1377185     1       0          1  1  0  0  0  0
#> SRR1377186     1       0          1  1  0  0  0  0
#> SRR1377187     1       0          1  1  0  0  0  0
#> SRR1377188     1       0          1  1  0  0  0  0
#> SRR1377189     2       0          1  0  1  0  0  0
#> SRR1377190     2       0          1  0  1  0  0  0
#> SRR1377191     2       0          1  0  1  0  0  0
#> SRR1377192     2       0          1  0  1  0  0  0
#> SRR1377193     2       0          1  0  1  0  0  0
#> SRR1377194     2       0          1  0  1  0  0  0
#> SRR1377195     5       0          1  0  0  0  0  1
#> SRR1377196     5       0          1  0  0  0  0  1
#> SRR1377197     5       0          1  0  0  0  0  1
#> SRR1377198     5       0          1  0  0  0  0  1
#> SRR1377199     5       0          1  0  0  0  0  1
#> SRR1377200     5       0          1  0  0  0  0  1
#> SRR1377201     2       0          1  0  1  0  0  0
#> SRR1377202     2       0          1  0  1  0  0  0
#> SRR1377203     2       0          1  0  1  0  0  0
#> SRR1377204     2       0          1  0  1  0  0  0
#> SRR1377205     2       0          1  0  1  0  0  0
#> SRR1377206     2       0          1  0  1  0  0  0
#> SRR1377207     2       0          1  0  1  0  0  0
#> SRR1377208     2       0          1  0  1  0  0  0
#> SRR1377209     2       0          1  0  1  0  0  0
#> SRR1377210     2       0          1  0  1  0  0  0
#> SRR1377211     2       0          1  0  1  0  0  0
#> SRR1377212     2       0          1  0  1  0  0  0
#> SRR1377213     4       0          1  0  0  0  1  0
#> SRR1377214     4       0          1  0  0  0  1  0
#> SRR1377215     4       0          1  0  0  0  1  0
#> SRR1377216     4       0          1  0  0  0  1  0
#> SRR1377217     4       0          1  0  0  0  1  0
#> SRR1377218     4       0          1  0  0  0  1  0
#> SRR1377219     4       0          1  0  0  0  1  0
#> SRR1377220     4       0          1  0  0  0  1  0
#> SRR1377221     4       0          1  0  0  0  1  0
#> SRR1377222     4       0          1  0  0  0  1  0
#> SRR1377223     4       0          1  0  0  0  1  0
#> SRR1377224     4       0          1  0  0  0  1  0

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>            class entropy silhouette p1 p2 p3 p4 p5 p6
#> SRR1377145     6       0          1  0  0  0  0  0  1
#> SRR1377146     6       0          1  0  0  0  0  0  1
#> SRR1377147     6       0          1  0  0  0  0  0  1
#> SRR1377148     6       0          1  0  0  0  0  0  1
#> SRR1377153     6       0          1  0  0  0  0  0  1
#> SRR1377154     6       0          1  0  0  0  0  0  1
#> SRR1377155     6       0          1  0  0  0  0  0  1
#> SRR1377156     6       0          1  0  0  0  0  0  1
#> SRR1377149     6       0          1  0  0  0  0  0  1
#> SRR1377150     6       0          1  0  0  0  0  0  1
#> SRR1377151     6       0          1  0  0  0  0  0  1
#> SRR1377152     6       0          1  0  0  0  0  0  1
#> SRR1377157     3       0          1  0  0  1  0  0  0
#> SRR1377158     3       0          1  0  0  1  0  0  0
#> SRR1377159     3       0          1  0  0  1  0  0  0
#> SRR1377160     3       0          1  0  0  1  0  0  0
#> SRR1377161     3       0          1  0  0  1  0  0  0
#> SRR1377162     3       0          1  0  0  1  0  0  0
#> SRR1377163     3       0          1  0  0  1  0  0  0
#> SRR1377164     3       0          1  0  0  1  0  0  0
#> SRR1377169     3       0          1  0  0  1  0  0  0
#> SRR1377170     3       0          1  0  0  1  0  0  0
#> SRR1377171     3       0          1  0  0  1  0  0  0
#> SRR1377172     3       0          1  0  0  1  0  0  0
#> SRR1377165     3       0          1  0  0  1  0  0  0
#> SRR1377166     3       0          1  0  0  1  0  0  0
#> SRR1377167     3       0          1  0  0  1  0  0  0
#> SRR1377168     3       0          1  0  0  1  0  0  0
#> SRR1377173     1       0          1  1  0  0  0  0  0
#> SRR1377174     1       0          1  1  0  0  0  0  0
#> SRR1377175     1       0          1  1  0  0  0  0  0
#> SRR1377176     1       0          1  1  0  0  0  0  0
#> SRR1377177     1       0          1  1  0  0  0  0  0
#> SRR1377178     1       0          1  1  0  0  0  0  0
#> SRR1377179     1       0          1  1  0  0  0  0  0
#> SRR1377180     1       0          1  1  0  0  0  0  0
#> SRR1377181     1       0          1  1  0  0  0  0  0
#> SRR1377182     1       0          1  1  0  0  0  0  0
#> SRR1377183     1       0          1  1  0  0  0  0  0
#> SRR1377184     1       0          1  1  0  0  0  0  0
#> SRR1377185     1       0          1  1  0  0  0  0  0
#> SRR1377186     1       0          1  1  0  0  0  0  0
#> SRR1377187     1       0          1  1  0  0  0  0  0
#> SRR1377188     1       0          1  1  0  0  0  0  0
#> SRR1377189     2       0          1  0  1  0  0  0  0
#> SRR1377190     2       0          1  0  1  0  0  0  0
#> SRR1377191     2       0          1  0  1  0  0  0  0
#> SRR1377192     2       0          1  0  1  0  0  0  0
#> SRR1377193     2       0          1  0  1  0  0  0  0
#> SRR1377194     2       0          1  0  1  0  0  0  0
#> SRR1377195     5       0          1  0  0  0  0  1  0
#> SRR1377196     5       0          1  0  0  0  0  1  0
#> SRR1377197     5       0          1  0  0  0  0  1  0
#> SRR1377198     5       0          1  0  0  0  0  1  0
#> SRR1377199     5       0          1  0  0  0  0  1  0
#> SRR1377200     5       0          1  0  0  0  0  1  0
#> SRR1377201     2       0          1  0  1  0  0  0  0
#> SRR1377202     2       0          1  0  1  0  0  0  0
#> SRR1377203     2       0          1  0  1  0  0  0  0
#> SRR1377204     2       0          1  0  1  0  0  0  0
#> SRR1377205     2       0          1  0  1  0  0  0  0
#> SRR1377206     2       0          1  0  1  0  0  0  0
#> SRR1377207     2       0          1  0  1  0  0  0  0
#> SRR1377208     2       0          1  0  1  0  0  0  0
#> SRR1377209     2       0          1  0  1  0  0  0  0
#> SRR1377210     2       0          1  0  1  0  0  0  0
#> SRR1377211     2       0          1  0  1  0  0  0  0
#> SRR1377212     2       0          1  0  1  0  0  0  0
#> SRR1377213     4       0          1  0  0  0  1  0  0
#> SRR1377214     4       0          1  0  0  0  1  0  0
#> SRR1377215     4       0          1  0  0  0  1  0  0
#> SRR1377216     4       0          1  0  0  0  1  0  0
#> SRR1377217     4       0          1  0  0  0  1  0  0
#> SRR1377218     4       0          1  0  0  0  1  0  0
#> SRR1377219     4       0          1  0  0  0  1  0  0
#> SRR1377220     4       0          1  0  0  0  1  0  0
#> SRR1377221     4       0          1  0  0  0  1  0  0
#> SRR1377222     4       0          1  0  0  0  1  0  0
#> SRR1377223     4       0          1  0  0  0  1  0  0
#> SRR1377224     4       0          1  0  0  0  1  0  0

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

consensus_heatmap(res, k = 2)

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

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

collect_plots(res)

plot of chunk SD-mclust-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.394           0.553       0.746         0.3897 0.647   0.647
#> 3 3 0.619           0.755       0.868         0.6111 0.500   0.324
#> 4 4 0.729           0.851       0.888         0.1634 0.896   0.699
#> 5 5 0.876           0.894       0.917         0.0580 0.972   0.888
#> 6 6 0.899           0.903       0.943         0.0728 0.943   0.747

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
#> SRR1377145     2  0.9460      0.404 0.364 0.636
#> SRR1377146     2  0.9460      0.404 0.364 0.636
#> SRR1377147     2  0.9460      0.404 0.364 0.636
#> SRR1377148     2  0.9460      0.404 0.364 0.636
#> SRR1377153     2  0.9460      0.404 0.364 0.636
#> SRR1377154     2  0.9460      0.404 0.364 0.636
#> SRR1377155     2  0.9460      0.404 0.364 0.636
#> SRR1377156     2  0.9460      0.404 0.364 0.636
#> SRR1377149     2  0.9460      0.404 0.364 0.636
#> SRR1377150     2  0.9460      0.404 0.364 0.636
#> SRR1377151     2  0.9460      0.404 0.364 0.636
#> SRR1377152     2  0.9460      0.404 0.364 0.636
#> SRR1377157     1  0.9866      0.657 0.568 0.432
#> SRR1377158     1  0.9866      0.657 0.568 0.432
#> SRR1377159     1  0.9881      0.655 0.564 0.436
#> SRR1377160     1  0.9866      0.657 0.568 0.432
#> SRR1377161     1  0.9881      0.655 0.564 0.436
#> SRR1377162     1  0.9881      0.655 0.564 0.436
#> SRR1377163     1  0.9866      0.657 0.568 0.432
#> SRR1377164     1  0.9881      0.655 0.564 0.436
#> SRR1377169     2  0.9922     -0.331 0.448 0.552
#> SRR1377170     2  0.9944     -0.360 0.456 0.544
#> SRR1377171     2  0.9922     -0.331 0.448 0.552
#> SRR1377172     2  0.9944     -0.360 0.456 0.544
#> SRR1377165     1  0.9909      0.643 0.556 0.444
#> SRR1377166     1  0.9909      0.643 0.556 0.444
#> SRR1377167     1  0.9909      0.643 0.556 0.444
#> SRR1377168     1  0.9909      0.643 0.556 0.444
#> SRR1377173     2  0.8016      0.452 0.244 0.756
#> SRR1377174     2  0.8016      0.452 0.244 0.756
#> SRR1377175     2  0.8016      0.452 0.244 0.756
#> SRR1377176     2  0.8016      0.452 0.244 0.756
#> SRR1377177     2  0.8016      0.452 0.244 0.756
#> SRR1377178     2  0.8016      0.452 0.244 0.756
#> SRR1377179     2  0.8016      0.452 0.244 0.756
#> SRR1377180     2  0.8016      0.452 0.244 0.756
#> SRR1377181     2  0.8016      0.452 0.244 0.756
#> SRR1377182     2  0.8016      0.452 0.244 0.756
#> SRR1377183     2  0.2043      0.711 0.032 0.968
#> SRR1377184     2  0.8016      0.452 0.244 0.756
#> SRR1377185     2  0.2043      0.711 0.032 0.968
#> SRR1377186     2  0.2043      0.711 0.032 0.968
#> SRR1377187     2  0.8016      0.452 0.244 0.756
#> SRR1377188     2  0.2043      0.711 0.032 0.968
#> SRR1377189     2  0.0000      0.727 0.000 1.000
#> SRR1377190     2  0.0000      0.727 0.000 1.000
#> SRR1377191     2  0.0000      0.727 0.000 1.000
#> SRR1377192     2  0.0000      0.727 0.000 1.000
#> SRR1377193     2  0.0000      0.727 0.000 1.000
#> SRR1377194     2  0.0000      0.727 0.000 1.000
#> SRR1377195     1  0.2043      0.529 0.968 0.032
#> SRR1377196     1  0.2043      0.529 0.968 0.032
#> SRR1377197     1  0.2043      0.529 0.968 0.032
#> SRR1377198     1  0.2043      0.529 0.968 0.032
#> SRR1377199     1  0.2043      0.529 0.968 0.032
#> SRR1377200     1  0.2043      0.529 0.968 0.032
#> SRR1377201     2  0.0000      0.727 0.000 1.000
#> SRR1377202     2  0.0000      0.727 0.000 1.000
#> SRR1377203     2  0.0000      0.727 0.000 1.000
#> SRR1377204     2  0.0000      0.727 0.000 1.000
#> SRR1377205     2  0.0000      0.727 0.000 1.000
#> SRR1377206     2  0.0000      0.727 0.000 1.000
#> SRR1377207     2  0.0000      0.727 0.000 1.000
#> SRR1377208     2  0.0000      0.727 0.000 1.000
#> SRR1377209     2  0.0000      0.727 0.000 1.000
#> SRR1377210     2  0.0000      0.727 0.000 1.000
#> SRR1377211     2  0.0000      0.727 0.000 1.000
#> SRR1377212     2  0.0000      0.727 0.000 1.000
#> SRR1377213     2  0.2948      0.700 0.052 0.948
#> SRR1377214     2  0.2948      0.700 0.052 0.948
#> SRR1377215     2  0.2948      0.700 0.052 0.948
#> SRR1377216     2  0.2948      0.700 0.052 0.948
#> SRR1377217     2  0.2948      0.700 0.052 0.948
#> SRR1377218     2  0.2948      0.700 0.052 0.948
#> SRR1377219     2  0.2948      0.700 0.052 0.948
#> SRR1377220     2  0.2948      0.700 0.052 0.948
#> SRR1377221     2  0.2948      0.700 0.052 0.948
#> SRR1377222     2  0.0938      0.723 0.012 0.988
#> SRR1377223     2  0.0938      0.723 0.012 0.988
#> SRR1377224     2  0.0938      0.723 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
#> SRR1377145     2  0.0000      0.933 0.000 1.000 0.000
#> SRR1377146     2  0.0000      0.933 0.000 1.000 0.000
#> SRR1377147     2  0.0000      0.933 0.000 1.000 0.000
#> SRR1377148     2  0.0000      0.933 0.000 1.000 0.000
#> SRR1377153     2  0.0000      0.933 0.000 1.000 0.000
#> SRR1377154     2  0.0000      0.933 0.000 1.000 0.000
#> SRR1377155     2  0.0000      0.933 0.000 1.000 0.000
#> SRR1377156     2  0.0000      0.933 0.000 1.000 0.000
#> SRR1377149     2  0.0000      0.933 0.000 1.000 0.000
#> SRR1377150     2  0.0000      0.933 0.000 1.000 0.000
#> SRR1377151     2  0.0000      0.933 0.000 1.000 0.000
#> SRR1377152     2  0.0000      0.933 0.000 1.000 0.000
#> SRR1377157     3  0.0000      0.794 0.000 0.000 1.000
#> SRR1377158     3  0.0000      0.794 0.000 0.000 1.000
#> SRR1377159     3  0.0000      0.794 0.000 0.000 1.000
#> SRR1377160     3  0.0000      0.794 0.000 0.000 1.000
#> SRR1377161     3  0.0000      0.794 0.000 0.000 1.000
#> SRR1377162     3  0.0000      0.794 0.000 0.000 1.000
#> SRR1377163     3  0.0000      0.794 0.000 0.000 1.000
#> SRR1377164     3  0.0000      0.794 0.000 0.000 1.000
#> SRR1377169     3  0.0000      0.794 0.000 0.000 1.000
#> SRR1377170     3  0.0000      0.794 0.000 0.000 1.000
#> SRR1377171     3  0.0000      0.794 0.000 0.000 1.000
#> SRR1377172     3  0.0000      0.794 0.000 0.000 1.000
#> SRR1377165     3  0.0000      0.794 0.000 0.000 1.000
#> SRR1377166     3  0.0000      0.794 0.000 0.000 1.000
#> SRR1377167     3  0.0000      0.794 0.000 0.000 1.000
#> SRR1377168     3  0.0000      0.794 0.000 0.000 1.000
#> SRR1377173     3  0.5325      0.758 0.004 0.248 0.748
#> SRR1377174     3  0.5325      0.758 0.004 0.248 0.748
#> SRR1377175     3  0.5325      0.758 0.004 0.248 0.748
#> SRR1377176     3  0.5325      0.758 0.004 0.248 0.748
#> SRR1377177     3  0.5325      0.758 0.004 0.248 0.748
#> SRR1377178     3  0.5325      0.758 0.004 0.248 0.748
#> SRR1377179     3  0.5325      0.758 0.004 0.248 0.748
#> SRR1377180     3  0.5325      0.758 0.004 0.248 0.748
#> SRR1377181     3  0.5325      0.758 0.004 0.248 0.748
#> SRR1377182     3  0.5325      0.758 0.004 0.248 0.748
#> SRR1377183     3  0.8637      0.164 0.100 0.448 0.452
#> SRR1377184     3  0.5325      0.758 0.004 0.248 0.748
#> SRR1377185     2  0.8635     -0.174 0.100 0.460 0.440
#> SRR1377186     2  0.8635     -0.174 0.100 0.460 0.440
#> SRR1377187     3  0.5325      0.758 0.004 0.248 0.748
#> SRR1377188     2  0.8635     -0.174 0.100 0.460 0.440
#> SRR1377189     2  0.0237      0.932 0.000 0.996 0.004
#> SRR1377190     2  0.0237      0.932 0.000 0.996 0.004
#> SRR1377191     2  0.0237      0.932 0.000 0.996 0.004
#> SRR1377192     2  0.0237      0.932 0.000 0.996 0.004
#> SRR1377193     2  0.0237      0.932 0.000 0.996 0.004
#> SRR1377194     2  0.0237      0.932 0.000 0.996 0.004
#> SRR1377195     1  0.0000      0.720 1.000 0.000 0.000
#> SRR1377196     1  0.0000      0.720 1.000 0.000 0.000
#> SRR1377197     1  0.0000      0.720 1.000 0.000 0.000
#> SRR1377198     1  0.0000      0.720 1.000 0.000 0.000
#> SRR1377199     1  0.0000      0.720 1.000 0.000 0.000
#> SRR1377200     1  0.0000      0.720 1.000 0.000 0.000
#> SRR1377201     2  0.0000      0.933 0.000 1.000 0.000
#> SRR1377202     2  0.0000      0.933 0.000 1.000 0.000
#> SRR1377203     2  0.0000      0.933 0.000 1.000 0.000
#> SRR1377204     1  0.6442      0.287 0.564 0.432 0.004
#> SRR1377205     1  0.6442      0.287 0.564 0.432 0.004
#> SRR1377206     1  0.6442      0.287 0.564 0.432 0.004
#> SRR1377207     2  0.0237      0.932 0.000 0.996 0.004
#> SRR1377208     2  0.0237      0.932 0.000 0.996 0.004
#> SRR1377209     2  0.0237      0.932 0.000 0.996 0.004
#> SRR1377210     2  0.0000      0.933 0.000 1.000 0.000
#> SRR1377211     2  0.0000      0.933 0.000 1.000 0.000
#> SRR1377212     2  0.0000      0.933 0.000 1.000 0.000
#> SRR1377213     1  0.6247      0.712 0.620 0.004 0.376
#> SRR1377214     1  0.6247      0.712 0.620 0.004 0.376
#> SRR1377215     1  0.6247      0.712 0.620 0.004 0.376
#> SRR1377216     1  0.6045      0.708 0.620 0.000 0.380
#> SRR1377217     1  0.6045      0.708 0.620 0.000 0.380
#> SRR1377218     1  0.6045      0.708 0.620 0.000 0.380
#> SRR1377219     1  0.6247      0.712 0.620 0.004 0.376
#> SRR1377220     1  0.6247      0.712 0.620 0.004 0.376
#> SRR1377221     1  0.6247      0.712 0.620 0.004 0.376
#> SRR1377222     1  0.4963      0.746 0.792 0.008 0.200
#> SRR1377223     1  0.4963      0.746 0.792 0.008 0.200
#> SRR1377224     1  0.4963      0.746 0.792 0.008 0.200

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> SRR1377145     2  0.0921      0.937 0.000 0.972 0.000 0.028
#> SRR1377146     2  0.0921      0.937 0.000 0.972 0.000 0.028
#> SRR1377147     2  0.0921      0.937 0.000 0.972 0.000 0.028
#> SRR1377148     2  0.0921      0.937 0.000 0.972 0.000 0.028
#> SRR1377153     2  0.0921      0.937 0.000 0.972 0.000 0.028
#> SRR1377154     2  0.0921      0.937 0.000 0.972 0.000 0.028
#> SRR1377155     2  0.0921      0.937 0.000 0.972 0.000 0.028
#> SRR1377156     2  0.0921      0.937 0.000 0.972 0.000 0.028
#> SRR1377149     2  0.0921      0.937 0.000 0.972 0.000 0.028
#> SRR1377150     2  0.0921      0.937 0.000 0.972 0.000 0.028
#> SRR1377151     2  0.0921      0.937 0.000 0.972 0.000 0.028
#> SRR1377152     2  0.0921      0.937 0.000 0.972 0.000 0.028
#> SRR1377157     3  0.1557      0.942 0.056 0.000 0.944 0.000
#> SRR1377158     3  0.1557      0.942 0.056 0.000 0.944 0.000
#> SRR1377159     3  0.1557      0.942 0.056 0.000 0.944 0.000
#> SRR1377160     3  0.1557      0.942 0.056 0.000 0.944 0.000
#> SRR1377161     3  0.0921      0.963 0.028 0.000 0.972 0.000
#> SRR1377162     3  0.0921      0.963 0.028 0.000 0.972 0.000
#> SRR1377163     3  0.0921      0.963 0.028 0.000 0.972 0.000
#> SRR1377164     3  0.0921      0.963 0.028 0.000 0.972 0.000
#> SRR1377169     3  0.0336      0.964 0.000 0.000 0.992 0.008
#> SRR1377170     3  0.0336      0.964 0.000 0.000 0.992 0.008
#> SRR1377171     3  0.0336      0.964 0.000 0.000 0.992 0.008
#> SRR1377172     3  0.0336      0.964 0.000 0.000 0.992 0.008
#> SRR1377165     3  0.0000      0.968 0.000 0.000 1.000 0.000
#> SRR1377166     3  0.0000      0.968 0.000 0.000 1.000 0.000
#> SRR1377167     3  0.0000      0.968 0.000 0.000 1.000 0.000
#> SRR1377168     3  0.0000      0.968 0.000 0.000 1.000 0.000
#> SRR1377173     4  0.2589      0.868 0.000 0.000 0.116 0.884
#> SRR1377174     4  0.2589      0.868 0.000 0.000 0.116 0.884
#> SRR1377175     4  0.2589      0.868 0.000 0.000 0.116 0.884
#> SRR1377176     4  0.2589      0.868 0.000 0.000 0.116 0.884
#> SRR1377177     4  0.2589      0.868 0.000 0.000 0.116 0.884
#> SRR1377178     4  0.2589      0.868 0.000 0.000 0.116 0.884
#> SRR1377179     4  0.2589      0.868 0.000 0.000 0.116 0.884
#> SRR1377180     4  0.2589      0.868 0.000 0.000 0.116 0.884
#> SRR1377181     4  0.2589      0.868 0.000 0.000 0.116 0.884
#> SRR1377182     4  0.2589      0.868 0.000 0.000 0.116 0.884
#> SRR1377183     4  0.7527      0.498 0.108 0.312 0.032 0.548
#> SRR1377184     4  0.2589      0.868 0.000 0.000 0.116 0.884
#> SRR1377185     4  0.7527      0.498 0.108 0.312 0.032 0.548
#> SRR1377186     4  0.7527      0.498 0.108 0.312 0.032 0.548
#> SRR1377187     4  0.2589      0.868 0.000 0.000 0.116 0.884
#> SRR1377188     4  0.7527      0.498 0.108 0.312 0.032 0.548
#> SRR1377189     2  0.3356      0.782 0.000 0.824 0.000 0.176
#> SRR1377190     2  0.3356      0.782 0.000 0.824 0.000 0.176
#> SRR1377191     2  0.3356      0.782 0.000 0.824 0.000 0.176
#> SRR1377192     2  0.3356      0.782 0.000 0.824 0.000 0.176
#> SRR1377193     2  0.3356      0.782 0.000 0.824 0.000 0.176
#> SRR1377194     2  0.3356      0.782 0.000 0.824 0.000 0.176
#> SRR1377195     1  0.2149      0.790 0.912 0.000 0.000 0.088
#> SRR1377196     1  0.2149      0.790 0.912 0.000 0.000 0.088
#> SRR1377197     1  0.2149      0.790 0.912 0.000 0.000 0.088
#> SRR1377198     1  0.2149      0.790 0.912 0.000 0.000 0.088
#> SRR1377199     1  0.2149      0.790 0.912 0.000 0.000 0.088
#> SRR1377200     1  0.2149      0.790 0.912 0.000 0.000 0.088
#> SRR1377201     2  0.0000      0.935 0.000 1.000 0.000 0.000
#> SRR1377202     2  0.0000      0.935 0.000 1.000 0.000 0.000
#> SRR1377203     2  0.0000      0.935 0.000 1.000 0.000 0.000
#> SRR1377204     1  0.5772      0.646 0.708 0.116 0.000 0.176
#> SRR1377205     1  0.5772      0.646 0.708 0.116 0.000 0.176
#> SRR1377206     1  0.5772      0.646 0.708 0.116 0.000 0.176
#> SRR1377207     2  0.0000      0.935 0.000 1.000 0.000 0.000
#> SRR1377208     2  0.0000      0.935 0.000 1.000 0.000 0.000
#> SRR1377209     2  0.0000      0.935 0.000 1.000 0.000 0.000
#> SRR1377210     2  0.0188      0.934 0.000 0.996 0.000 0.004
#> SRR1377211     2  0.0188      0.934 0.000 0.996 0.000 0.004
#> SRR1377212     2  0.0188      0.934 0.000 0.996 0.000 0.004
#> SRR1377213     1  0.3444      0.801 0.816 0.000 0.184 0.000
#> SRR1377214     1  0.3444      0.801 0.816 0.000 0.184 0.000
#> SRR1377215     1  0.3444      0.801 0.816 0.000 0.184 0.000
#> SRR1377216     1  0.4072      0.741 0.748 0.000 0.252 0.000
#> SRR1377217     1  0.4072      0.741 0.748 0.000 0.252 0.000
#> SRR1377218     1  0.4072      0.741 0.748 0.000 0.252 0.000
#> SRR1377219     1  0.3444      0.801 0.816 0.000 0.184 0.000
#> SRR1377220     1  0.3444      0.801 0.816 0.000 0.184 0.000
#> SRR1377221     1  0.3444      0.801 0.816 0.000 0.184 0.000
#> SRR1377222     1  0.3681      0.768 0.816 0.176 0.008 0.000
#> SRR1377223     1  0.3681      0.768 0.816 0.176 0.008 0.000
#> SRR1377224     1  0.3681      0.768 0.816 0.176 0.008 0.000

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>            class entropy silhouette    p1    p2    p3    p4    p5
#> SRR1377145     2  0.3399      0.892 0.020 0.812 0.000 0.000 0.168
#> SRR1377146     2  0.3399      0.892 0.020 0.812 0.000 0.000 0.168
#> SRR1377147     2  0.3399      0.892 0.020 0.812 0.000 0.000 0.168
#> SRR1377148     2  0.3399      0.892 0.020 0.812 0.000 0.000 0.168
#> SRR1377153     2  0.3399      0.892 0.020 0.812 0.000 0.000 0.168
#> SRR1377154     2  0.3399      0.892 0.020 0.812 0.000 0.000 0.168
#> SRR1377155     2  0.3399      0.892 0.020 0.812 0.000 0.000 0.168
#> SRR1377156     2  0.3399      0.892 0.020 0.812 0.000 0.000 0.168
#> SRR1377149     2  0.3399      0.892 0.020 0.812 0.000 0.000 0.168
#> SRR1377150     2  0.3399      0.892 0.020 0.812 0.000 0.000 0.168
#> SRR1377151     2  0.3399      0.892 0.020 0.812 0.000 0.000 0.168
#> SRR1377152     2  0.3399      0.892 0.020 0.812 0.000 0.000 0.168
#> SRR1377157     3  0.0000      0.998 0.000 0.000 1.000 0.000 0.000
#> SRR1377158     3  0.0000      0.998 0.000 0.000 1.000 0.000 0.000
#> SRR1377159     3  0.0000      0.998 0.000 0.000 1.000 0.000 0.000
#> SRR1377160     3  0.0162      0.996 0.000 0.000 0.996 0.004 0.000
#> SRR1377161     3  0.0000      0.998 0.000 0.000 1.000 0.000 0.000
#> SRR1377162     3  0.0000      0.998 0.000 0.000 1.000 0.000 0.000
#> SRR1377163     3  0.0000      0.998 0.000 0.000 1.000 0.000 0.000
#> SRR1377164     3  0.0000      0.998 0.000 0.000 1.000 0.000 0.000
#> SRR1377169     3  0.0000      0.998 0.000 0.000 1.000 0.000 0.000
#> SRR1377170     3  0.0000      0.998 0.000 0.000 1.000 0.000 0.000
#> SRR1377171     3  0.0000      0.998 0.000 0.000 1.000 0.000 0.000
#> SRR1377172     3  0.0000      0.998 0.000 0.000 1.000 0.000 0.000
#> SRR1377165     3  0.0162      0.996 0.000 0.000 0.996 0.004 0.000
#> SRR1377166     3  0.0162      0.996 0.000 0.000 0.996 0.004 0.000
#> SRR1377167     3  0.0162      0.996 0.000 0.000 0.996 0.004 0.000
#> SRR1377168     3  0.0162      0.996 0.000 0.000 0.996 0.004 0.000
#> SRR1377173     1  0.0794      0.852 0.972 0.000 0.028 0.000 0.000
#> SRR1377174     1  0.0794      0.852 0.972 0.000 0.028 0.000 0.000
#> SRR1377175     1  0.0794      0.852 0.972 0.000 0.028 0.000 0.000
#> SRR1377176     1  0.0794      0.852 0.972 0.000 0.028 0.000 0.000
#> SRR1377177     1  0.0794      0.852 0.972 0.000 0.028 0.000 0.000
#> SRR1377178     1  0.0794      0.852 0.972 0.000 0.028 0.000 0.000
#> SRR1377179     1  0.0794      0.852 0.972 0.000 0.028 0.000 0.000
#> SRR1377180     1  0.0794      0.852 0.972 0.000 0.028 0.000 0.000
#> SRR1377181     1  0.0794      0.852 0.972 0.000 0.028 0.000 0.000
#> SRR1377182     1  0.0794      0.852 0.972 0.000 0.028 0.000 0.000
#> SRR1377183     1  0.6462      0.496 0.552 0.304 0.028 0.116 0.000
#> SRR1377184     1  0.0794      0.852 0.972 0.000 0.028 0.000 0.000
#> SRR1377185     1  0.6462      0.496 0.552 0.304 0.028 0.116 0.000
#> SRR1377186     1  0.6462      0.496 0.552 0.304 0.028 0.116 0.000
#> SRR1377187     1  0.0794      0.852 0.972 0.000 0.028 0.000 0.000
#> SRR1377188     1  0.6462      0.496 0.552 0.304 0.028 0.116 0.000
#> SRR1377189     2  0.0833      0.904 0.004 0.976 0.004 0.016 0.000
#> SRR1377190     2  0.0833      0.904 0.004 0.976 0.004 0.016 0.000
#> SRR1377191     2  0.1153      0.899 0.004 0.964 0.008 0.024 0.000
#> SRR1377192     2  0.0566      0.906 0.004 0.984 0.000 0.012 0.000
#> SRR1377193     2  0.0451      0.907 0.004 0.988 0.000 0.008 0.000
#> SRR1377194     2  0.0451      0.907 0.004 0.988 0.000 0.008 0.000
#> SRR1377195     5  0.2813      1.000 0.000 0.000 0.000 0.168 0.832
#> SRR1377196     5  0.2813      1.000 0.000 0.000 0.000 0.168 0.832
#> SRR1377197     5  0.2813      1.000 0.000 0.000 0.000 0.168 0.832
#> SRR1377198     5  0.2813      1.000 0.000 0.000 0.000 0.168 0.832
#> SRR1377199     5  0.2813      1.000 0.000 0.000 0.000 0.168 0.832
#> SRR1377200     5  0.2813      1.000 0.000 0.000 0.000 0.168 0.832
#> SRR1377201     2  0.0613      0.908 0.004 0.984 0.008 0.004 0.000
#> SRR1377202     2  0.0613      0.908 0.004 0.984 0.008 0.004 0.000
#> SRR1377203     2  0.0451      0.908 0.004 0.988 0.008 0.000 0.000
#> SRR1377204     4  0.1568      0.890 0.020 0.036 0.000 0.944 0.000
#> SRR1377205     4  0.1568      0.890 0.020 0.036 0.000 0.944 0.000
#> SRR1377206     4  0.1568      0.890 0.020 0.036 0.000 0.944 0.000
#> SRR1377207     2  0.0854      0.905 0.012 0.976 0.004 0.008 0.000
#> SRR1377208     2  0.0854      0.905 0.012 0.976 0.004 0.008 0.000
#> SRR1377209     2  0.0854      0.905 0.012 0.976 0.004 0.008 0.000
#> SRR1377210     2  0.0290      0.909 0.000 0.992 0.008 0.000 0.000
#> SRR1377211     2  0.0290      0.909 0.000 0.992 0.008 0.000 0.000
#> SRR1377212     2  0.0290      0.909 0.000 0.992 0.008 0.000 0.000
#> SRR1377213     4  0.0290      0.914 0.000 0.008 0.000 0.992 0.000
#> SRR1377214     4  0.0290      0.914 0.000 0.008 0.000 0.992 0.000
#> SRR1377215     4  0.0290      0.914 0.000 0.008 0.000 0.992 0.000
#> SRR1377216     4  0.4557      0.718 0.028 0.044 0.160 0.768 0.000
#> SRR1377217     4  0.4557      0.718 0.028 0.044 0.160 0.768 0.000
#> SRR1377218     4  0.4557      0.718 0.028 0.044 0.160 0.768 0.000
#> SRR1377219     4  0.0290      0.914 0.000 0.008 0.000 0.992 0.000
#> SRR1377220     4  0.0290      0.914 0.000 0.008 0.000 0.992 0.000
#> SRR1377221     4  0.0290      0.914 0.000 0.008 0.000 0.992 0.000
#> SRR1377222     4  0.0671      0.908 0.016 0.004 0.000 0.980 0.000
#> SRR1377223     4  0.0671      0.908 0.016 0.004 0.000 0.980 0.000
#> SRR1377224     4  0.0671      0.908 0.016 0.004 0.000 0.980 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
#> SRR1377145     6  0.0000      1.000 0.000 0.000 0.000 0.000  0 1.000
#> SRR1377146     6  0.0000      1.000 0.000 0.000 0.000 0.000  0 1.000
#> SRR1377147     6  0.0000      1.000 0.000 0.000 0.000 0.000  0 1.000
#> SRR1377148     6  0.0000      1.000 0.000 0.000 0.000 0.000  0 1.000
#> SRR1377153     6  0.0000      1.000 0.000 0.000 0.000 0.000  0 1.000
#> SRR1377154     6  0.0000      1.000 0.000 0.000 0.000 0.000  0 1.000
#> SRR1377155     6  0.0000      1.000 0.000 0.000 0.000 0.000  0 1.000
#> SRR1377156     6  0.0000      1.000 0.000 0.000 0.000 0.000  0 1.000
#> SRR1377149     6  0.0000      1.000 0.000 0.000 0.000 0.000  0 1.000
#> SRR1377150     6  0.0000      1.000 0.000 0.000 0.000 0.000  0 1.000
#> SRR1377151     6  0.0000      1.000 0.000 0.000 0.000 0.000  0 1.000
#> SRR1377152     6  0.0000      1.000 0.000 0.000 0.000 0.000  0 1.000
#> SRR1377157     3  0.0000      0.944 0.000 0.000 1.000 0.000  0 0.000
#> SRR1377158     3  0.0000      0.944 0.000 0.000 1.000 0.000  0 0.000
#> SRR1377159     3  0.0000      0.944 0.000 0.000 1.000 0.000  0 0.000
#> SRR1377160     3  0.0000      0.944 0.000 0.000 1.000 0.000  0 0.000
#> SRR1377161     3  0.1556      0.944 0.080 0.000 0.920 0.000  0 0.000
#> SRR1377162     3  0.1556      0.944 0.080 0.000 0.920 0.000  0 0.000
#> SRR1377163     3  0.1556      0.944 0.080 0.000 0.920 0.000  0 0.000
#> SRR1377164     3  0.1556      0.944 0.080 0.000 0.920 0.000  0 0.000
#> SRR1377169     3  0.1765      0.936 0.096 0.000 0.904 0.000  0 0.000
#> SRR1377170     3  0.1765      0.936 0.096 0.000 0.904 0.000  0 0.000
#> SRR1377171     3  0.1863      0.929 0.104 0.000 0.896 0.000  0 0.000
#> SRR1377172     3  0.1663      0.941 0.088 0.000 0.912 0.000  0 0.000
#> SRR1377165     3  0.0146      0.945 0.004 0.000 0.996 0.000  0 0.000
#> SRR1377166     3  0.0146      0.945 0.004 0.000 0.996 0.000  0 0.000
#> SRR1377167     3  0.0146      0.945 0.004 0.000 0.996 0.000  0 0.000
#> SRR1377168     3  0.0146      0.945 0.004 0.000 0.996 0.000  0 0.000
#> SRR1377173     1  0.0000      0.877 1.000 0.000 0.000 0.000  0 0.000
#> SRR1377174     1  0.0000      0.877 1.000 0.000 0.000 0.000  0 0.000
#> SRR1377175     1  0.0000      0.877 1.000 0.000 0.000 0.000  0 0.000
#> SRR1377176     1  0.0000      0.877 1.000 0.000 0.000 0.000  0 0.000
#> SRR1377177     1  0.0000      0.877 1.000 0.000 0.000 0.000  0 0.000
#> SRR1377178     1  0.0000      0.877 1.000 0.000 0.000 0.000  0 0.000
#> SRR1377179     1  0.0000      0.877 1.000 0.000 0.000 0.000  0 0.000
#> SRR1377180     1  0.0000      0.877 1.000 0.000 0.000 0.000  0 0.000
#> SRR1377181     1  0.0000      0.877 1.000 0.000 0.000 0.000  0 0.000
#> SRR1377182     1  0.0000      0.877 1.000 0.000 0.000 0.000  0 0.000
#> SRR1377183     1  0.5629      0.558 0.580 0.304 0.020 0.088  0 0.008
#> SRR1377184     1  0.0000      0.877 1.000 0.000 0.000 0.000  0 0.000
#> SRR1377185     1  0.5629      0.558 0.580 0.304 0.020 0.088  0 0.008
#> SRR1377186     1  0.5629      0.558 0.580 0.304 0.020 0.088  0 0.008
#> SRR1377187     1  0.0000      0.877 1.000 0.000 0.000 0.000  0 0.000
#> SRR1377188     1  0.5629      0.558 0.580 0.304 0.020 0.088  0 0.008
#> SRR1377189     2  0.0000      0.913 0.000 1.000 0.000 0.000  0 0.000
#> SRR1377190     2  0.0000      0.913 0.000 1.000 0.000 0.000  0 0.000
#> SRR1377191     2  0.0146      0.912 0.000 0.996 0.000 0.004  0 0.000
#> SRR1377192     2  0.0748      0.915 0.004 0.976 0.000 0.004  0 0.016
#> SRR1377193     2  0.0748      0.915 0.004 0.976 0.000 0.004  0 0.016
#> SRR1377194     2  0.0748      0.915 0.004 0.976 0.000 0.004  0 0.016
#> SRR1377195     5  0.0000      1.000 0.000 0.000 0.000 0.000  1 0.000
#> SRR1377196     5  0.0000      1.000 0.000 0.000 0.000 0.000  1 0.000
#> SRR1377197     5  0.0000      1.000 0.000 0.000 0.000 0.000  1 0.000
#> SRR1377198     5  0.0000      1.000 0.000 0.000 0.000 0.000  1 0.000
#> SRR1377199     5  0.0000      1.000 0.000 0.000 0.000 0.000  1 0.000
#> SRR1377200     5  0.0000      1.000 0.000 0.000 0.000 0.000  1 0.000
#> SRR1377201     2  0.2260      0.882 0.000 0.860 0.000 0.000  0 0.140
#> SRR1377202     2  0.2260      0.882 0.000 0.860 0.000 0.000  0 0.140
#> SRR1377203     2  0.2260      0.882 0.000 0.860 0.000 0.000  0 0.140
#> SRR1377204     4  0.2178      0.845 0.000 0.132 0.000 0.868  0 0.000
#> SRR1377205     4  0.2178      0.845 0.000 0.132 0.000 0.868  0 0.000
#> SRR1377206     4  0.2178      0.845 0.000 0.132 0.000 0.868  0 0.000
#> SRR1377207     2  0.2260      0.882 0.000 0.860 0.000 0.000  0 0.140
#> SRR1377208     2  0.2260      0.882 0.000 0.860 0.000 0.000  0 0.140
#> SRR1377209     2  0.2260      0.882 0.000 0.860 0.000 0.000  0 0.140
#> SRR1377210     2  0.0458      0.917 0.000 0.984 0.000 0.000  0 0.016
#> SRR1377211     2  0.0458      0.917 0.000 0.984 0.000 0.000  0 0.016
#> SRR1377212     2  0.0458      0.917 0.000 0.984 0.000 0.000  0 0.016
#> SRR1377213     4  0.0000      0.907 0.000 0.000 0.000 1.000  0 0.000
#> SRR1377214     4  0.0000      0.907 0.000 0.000 0.000 1.000  0 0.000
#> SRR1377215     4  0.0000      0.907 0.000 0.000 0.000 1.000  0 0.000
#> SRR1377216     4  0.4522      0.741 0.008 0.104 0.168 0.720  0 0.000
#> SRR1377217     4  0.4522      0.741 0.008 0.104 0.168 0.720  0 0.000
#> SRR1377218     4  0.4522      0.741 0.008 0.104 0.168 0.720  0 0.000
#> SRR1377219     4  0.0000      0.907 0.000 0.000 0.000 1.000  0 0.000
#> SRR1377220     4  0.0000      0.907 0.000 0.000 0.000 1.000  0 0.000
#> SRR1377221     4  0.0000      0.907 0.000 0.000 0.000 1.000  0 0.000
#> SRR1377222     4  0.0000      0.907 0.000 0.000 0.000 1.000  0 0.000
#> SRR1377223     4  0.0000      0.907 0.000 0.000 0.000 1.000  0 0.000
#> SRR1377224     4  0.0000      0.907 0.000 0.000 0.000 1.000  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-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 13890 rows and 80 columns.
#>   Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'SD' method.
#>   Subgroups are detected by 'NMF' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 2.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

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

collect_plots(res)

plot of chunk SD-NMF-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 1.000           0.984       0.988         0.1480 0.859   0.859
#> 3 3 0.370           0.723       0.854         2.1775 0.620   0.558
#> 4 4 0.457           0.791       0.793         0.2947 0.720   0.492
#> 5 5 0.715           0.808       0.852         0.1218 0.961   0.889
#> 6 6 0.709           0.777       0.748         0.0891 0.919   0.748

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

suggest_best_k(res)
#> [1] 2

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

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

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>            class entropy silhouette    p1    p2
#> SRR1377145     2  0.0000      0.990 0.000 1.000
#> SRR1377146     2  0.0000      0.990 0.000 1.000
#> SRR1377147     2  0.0000      0.990 0.000 1.000
#> SRR1377148     2  0.0000      0.990 0.000 1.000
#> SRR1377153     2  0.0000      0.990 0.000 1.000
#> SRR1377154     2  0.0000      0.990 0.000 1.000
#> SRR1377155     2  0.0000      0.990 0.000 1.000
#> SRR1377156     2  0.0000      0.990 0.000 1.000
#> SRR1377149     2  0.0000      0.990 0.000 1.000
#> SRR1377150     2  0.0000      0.990 0.000 1.000
#> SRR1377151     2  0.0000      0.990 0.000 1.000
#> SRR1377152     2  0.0000      0.990 0.000 1.000
#> SRR1377157     2  0.0000      0.990 0.000 1.000
#> SRR1377158     2  0.0000      0.990 0.000 1.000
#> SRR1377159     2  0.0000      0.990 0.000 1.000
#> SRR1377160     2  0.0000      0.990 0.000 1.000
#> SRR1377161     2  0.0000      0.990 0.000 1.000
#> SRR1377162     2  0.0000      0.990 0.000 1.000
#> SRR1377163     2  0.0000      0.990 0.000 1.000
#> SRR1377164     2  0.0000      0.990 0.000 1.000
#> SRR1377169     2  0.0000      0.990 0.000 1.000
#> SRR1377170     2  0.0000      0.990 0.000 1.000
#> SRR1377171     2  0.0000      0.990 0.000 1.000
#> SRR1377172     2  0.0000      0.990 0.000 1.000
#> SRR1377165     2  0.0000      0.990 0.000 1.000
#> SRR1377166     2  0.0000      0.990 0.000 1.000
#> SRR1377167     2  0.0000      0.990 0.000 1.000
#> SRR1377168     2  0.0000      0.990 0.000 1.000
#> SRR1377173     2  0.0000      0.990 0.000 1.000
#> SRR1377174     2  0.0000      0.990 0.000 1.000
#> SRR1377175     2  0.0000      0.990 0.000 1.000
#> SRR1377176     2  0.0000      0.990 0.000 1.000
#> SRR1377177     2  0.0000      0.990 0.000 1.000
#> SRR1377178     2  0.0000      0.990 0.000 1.000
#> SRR1377179     2  0.0000      0.990 0.000 1.000
#> SRR1377180     2  0.0000      0.990 0.000 1.000
#> SRR1377181     2  0.0000      0.990 0.000 1.000
#> SRR1377182     2  0.0000      0.990 0.000 1.000
#> SRR1377183     2  0.0000      0.990 0.000 1.000
#> SRR1377184     2  0.0000      0.990 0.000 1.000
#> SRR1377185     2  0.0000      0.990 0.000 1.000
#> SRR1377186     2  0.0000      0.990 0.000 1.000
#> SRR1377187     2  0.0000      0.990 0.000 1.000
#> SRR1377188     2  0.0000      0.990 0.000 1.000
#> SRR1377189     2  0.0376      0.989 0.004 0.996
#> SRR1377190     2  0.0376      0.989 0.004 0.996
#> SRR1377191     2  0.0376      0.989 0.004 0.996
#> SRR1377192     2  0.2423      0.969 0.040 0.960
#> SRR1377193     2  0.2423      0.969 0.040 0.960
#> SRR1377194     2  0.2423      0.969 0.040 0.960
#> SRR1377195     1  0.2043      0.977 0.968 0.032
#> SRR1377196     1  0.1184      0.966 0.984 0.016
#> SRR1377197     1  0.2423      0.978 0.960 0.040
#> SRR1377198     1  0.3114      0.979 0.944 0.056
#> SRR1377199     1  0.3431      0.975 0.936 0.064
#> SRR1377200     1  0.3733      0.968 0.928 0.072
#> SRR1377201     2  0.1414      0.981 0.020 0.980
#> SRR1377202     2  0.1414      0.981 0.020 0.980
#> SRR1377203     2  0.1414      0.981 0.020 0.980
#> SRR1377204     2  0.2423      0.969 0.040 0.960
#> SRR1377205     2  0.2423      0.969 0.040 0.960
#> SRR1377206     2  0.2423      0.969 0.040 0.960
#> SRR1377207     2  0.0376      0.989 0.004 0.996
#> SRR1377208     2  0.0376      0.989 0.004 0.996
#> SRR1377209     2  0.0376      0.989 0.004 0.996
#> SRR1377210     2  0.0376      0.989 0.004 0.996
#> SRR1377211     2  0.0376      0.989 0.004 0.996
#> SRR1377212     2  0.0376      0.989 0.004 0.996
#> SRR1377213     2  0.2423      0.969 0.040 0.960
#> SRR1377214     2  0.2423      0.969 0.040 0.960
#> SRR1377215     2  0.2423      0.969 0.040 0.960
#> SRR1377216     2  0.0376      0.989 0.004 0.996
#> SRR1377217     2  0.0376      0.989 0.004 0.996
#> SRR1377218     2  0.0376      0.989 0.004 0.996
#> SRR1377219     2  0.2423      0.969 0.040 0.960
#> SRR1377220     2  0.2423      0.969 0.040 0.960
#> SRR1377221     2  0.2423      0.969 0.040 0.960
#> SRR1377222     2  0.2423      0.969 0.040 0.960
#> SRR1377223     2  0.2423      0.969 0.040 0.960
#> SRR1377224     2  0.2423      0.969 0.040 0.960

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>            class entropy silhouette    p1    p2    p3
#> SRR1377145     3  0.5254      0.635 0.000 0.264 0.736
#> SRR1377146     3  0.5216      0.642 0.000 0.260 0.740
#> SRR1377147     3  0.5216      0.642 0.000 0.260 0.740
#> SRR1377148     3  0.5254      0.635 0.000 0.264 0.736
#> SRR1377153     3  0.4931      0.677 0.000 0.232 0.768
#> SRR1377154     3  0.4887      0.681 0.000 0.228 0.772
#> SRR1377155     3  0.4887      0.681 0.000 0.228 0.772
#> SRR1377156     3  0.4931      0.677 0.000 0.232 0.768
#> SRR1377149     3  0.5138      0.653 0.000 0.252 0.748
#> SRR1377150     3  0.5138      0.653 0.000 0.252 0.748
#> SRR1377151     3  0.5058      0.663 0.000 0.244 0.756
#> SRR1377152     3  0.5138      0.653 0.000 0.252 0.748
#> SRR1377157     3  0.0000      0.850 0.000 0.000 1.000
#> SRR1377158     3  0.0000      0.850 0.000 0.000 1.000
#> SRR1377159     3  0.0000      0.850 0.000 0.000 1.000
#> SRR1377160     3  0.0000      0.850 0.000 0.000 1.000
#> SRR1377161     3  0.0000      0.850 0.000 0.000 1.000
#> SRR1377162     3  0.0000      0.850 0.000 0.000 1.000
#> SRR1377163     3  0.0000      0.850 0.000 0.000 1.000
#> SRR1377164     3  0.0000      0.850 0.000 0.000 1.000
#> SRR1377169     3  0.0000      0.850 0.000 0.000 1.000
#> SRR1377170     3  0.0000      0.850 0.000 0.000 1.000
#> SRR1377171     3  0.0000      0.850 0.000 0.000 1.000
#> SRR1377172     3  0.0000      0.850 0.000 0.000 1.000
#> SRR1377165     3  0.0000      0.850 0.000 0.000 1.000
#> SRR1377166     3  0.0000      0.850 0.000 0.000 1.000
#> SRR1377167     3  0.0000      0.850 0.000 0.000 1.000
#> SRR1377168     3  0.0000      0.850 0.000 0.000 1.000
#> SRR1377173     3  0.0237      0.850 0.000 0.004 0.996
#> SRR1377174     3  0.0237      0.850 0.000 0.004 0.996
#> SRR1377175     3  0.0237      0.850 0.000 0.004 0.996
#> SRR1377176     3  0.0237      0.850 0.000 0.004 0.996
#> SRR1377177     3  0.0237      0.850 0.000 0.004 0.996
#> SRR1377178     3  0.0237      0.850 0.000 0.004 0.996
#> SRR1377179     3  0.0237      0.850 0.000 0.004 0.996
#> SRR1377180     3  0.0237      0.850 0.000 0.004 0.996
#> SRR1377181     3  0.0000      0.850 0.000 0.000 1.000
#> SRR1377182     3  0.0000      0.850 0.000 0.000 1.000
#> SRR1377183     3  0.0747      0.845 0.000 0.016 0.984
#> SRR1377184     3  0.0237      0.850 0.000 0.004 0.996
#> SRR1377185     3  0.0747      0.845 0.000 0.016 0.984
#> SRR1377186     3  0.0747      0.845 0.000 0.016 0.984
#> SRR1377187     3  0.0000      0.850 0.000 0.000 1.000
#> SRR1377188     3  0.0747      0.845 0.000 0.016 0.984
#> SRR1377189     2  0.5859      0.583 0.000 0.656 0.344
#> SRR1377190     2  0.6008      0.529 0.000 0.628 0.372
#> SRR1377191     2  0.6235      0.369 0.000 0.564 0.436
#> SRR1377192     2  0.3038      0.719 0.000 0.896 0.104
#> SRR1377193     2  0.3038      0.719 0.000 0.896 0.104
#> SRR1377194     2  0.3038      0.719 0.000 0.896 0.104
#> SRR1377195     1  0.0237      0.955 0.996 0.004 0.000
#> SRR1377196     1  0.0237      0.956 0.996 0.004 0.000
#> SRR1377197     1  0.0424      0.956 0.992 0.008 0.000
#> SRR1377198     1  0.3983      0.920 0.884 0.068 0.048
#> SRR1377199     1  0.3031      0.945 0.912 0.076 0.012
#> SRR1377200     1  0.3755      0.905 0.872 0.120 0.008
#> SRR1377201     2  0.5591      0.643 0.000 0.696 0.304
#> SRR1377202     2  0.5621      0.638 0.000 0.692 0.308
#> SRR1377203     2  0.5591      0.643 0.000 0.696 0.304
#> SRR1377204     2  0.2959      0.716 0.000 0.900 0.100
#> SRR1377205     2  0.2959      0.716 0.000 0.900 0.100
#> SRR1377206     2  0.2959      0.716 0.000 0.900 0.100
#> SRR1377207     3  0.6180      0.220 0.000 0.416 0.584
#> SRR1377208     3  0.6140      0.267 0.000 0.404 0.596
#> SRR1377209     3  0.6154      0.252 0.000 0.408 0.592
#> SRR1377210     2  0.6307      0.189 0.000 0.512 0.488
#> SRR1377211     2  0.6305      0.205 0.000 0.516 0.484
#> SRR1377212     2  0.6309      0.136 0.000 0.500 0.500
#> SRR1377213     2  0.4931      0.735 0.000 0.768 0.232
#> SRR1377214     2  0.4931      0.735 0.000 0.768 0.232
#> SRR1377215     2  0.4931      0.735 0.000 0.768 0.232
#> SRR1377216     3  0.5327      0.495 0.000 0.272 0.728
#> SRR1377217     3  0.5291      0.506 0.000 0.268 0.732
#> SRR1377218     3  0.5254      0.515 0.000 0.264 0.736
#> SRR1377219     2  0.4931      0.735 0.000 0.768 0.232
#> SRR1377220     2  0.4931      0.735 0.000 0.768 0.232
#> SRR1377221     2  0.4931      0.735 0.000 0.768 0.232
#> SRR1377222     2  0.4887      0.736 0.000 0.772 0.228
#> SRR1377223     2  0.4887      0.736 0.000 0.772 0.228
#> SRR1377224     2  0.4887      0.736 0.000 0.772 0.228

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> SRR1377145     2  0.4372     0.8139 0.000 0.728 0.268 0.004
#> SRR1377146     2  0.4372     0.8139 0.000 0.728 0.268 0.004
#> SRR1377147     2  0.4401     0.8122 0.000 0.724 0.272 0.004
#> SRR1377148     2  0.4401     0.8122 0.000 0.724 0.272 0.004
#> SRR1377153     2  0.4456     0.8052 0.000 0.716 0.280 0.004
#> SRR1377154     2  0.4456     0.8052 0.000 0.716 0.280 0.004
#> SRR1377155     2  0.4483     0.8001 0.000 0.712 0.284 0.004
#> SRR1377156     2  0.4456     0.8052 0.000 0.716 0.280 0.004
#> SRR1377149     2  0.4428     0.8088 0.000 0.720 0.276 0.004
#> SRR1377150     2  0.4401     0.8122 0.000 0.724 0.272 0.004
#> SRR1377151     2  0.4401     0.8122 0.000 0.724 0.272 0.004
#> SRR1377152     2  0.4428     0.8088 0.000 0.720 0.276 0.004
#> SRR1377157     3  0.0779     0.8735 0.000 0.004 0.980 0.016
#> SRR1377158     3  0.0657     0.8744 0.000 0.004 0.984 0.012
#> SRR1377159     3  0.0657     0.8744 0.000 0.004 0.984 0.012
#> SRR1377160     3  0.0657     0.8744 0.000 0.004 0.984 0.012
#> SRR1377161     3  0.0895     0.8727 0.000 0.004 0.976 0.020
#> SRR1377162     3  0.1004     0.8709 0.000 0.004 0.972 0.024
#> SRR1377163     3  0.0779     0.8735 0.000 0.004 0.980 0.016
#> SRR1377164     3  0.0895     0.8727 0.000 0.004 0.976 0.020
#> SRR1377169     3  0.0895     0.8728 0.000 0.004 0.976 0.020
#> SRR1377170     3  0.1004     0.8712 0.000 0.004 0.972 0.024
#> SRR1377171     3  0.0657     0.8744 0.000 0.004 0.984 0.012
#> SRR1377172     3  0.1109     0.8686 0.000 0.004 0.968 0.028
#> SRR1377165     3  0.0895     0.8726 0.000 0.004 0.976 0.020
#> SRR1377166     3  0.1004     0.8709 0.000 0.004 0.972 0.024
#> SRR1377167     3  0.0895     0.8726 0.000 0.004 0.976 0.020
#> SRR1377168     3  0.1004     0.8709 0.000 0.004 0.972 0.024
#> SRR1377173     3  0.2542     0.8567 0.000 0.084 0.904 0.012
#> SRR1377174     3  0.2402     0.8606 0.000 0.076 0.912 0.012
#> SRR1377175     3  0.2473     0.8590 0.000 0.080 0.908 0.012
#> SRR1377176     3  0.2473     0.8590 0.000 0.080 0.908 0.012
#> SRR1377177     3  0.2867     0.8422 0.000 0.104 0.884 0.012
#> SRR1377178     3  0.2928     0.8390 0.000 0.108 0.880 0.012
#> SRR1377179     3  0.2867     0.8426 0.000 0.104 0.884 0.012
#> SRR1377180     3  0.2805     0.8453 0.000 0.100 0.888 0.012
#> SRR1377181     3  0.2101     0.8660 0.000 0.060 0.928 0.012
#> SRR1377182     3  0.2300     0.8665 0.000 0.064 0.920 0.016
#> SRR1377183     3  0.3024     0.7977 0.000 0.148 0.852 0.000
#> SRR1377184     3  0.2255     0.8636 0.000 0.068 0.920 0.012
#> SRR1377185     3  0.3123     0.7873 0.000 0.156 0.844 0.000
#> SRR1377186     3  0.3172     0.7816 0.000 0.160 0.840 0.000
#> SRR1377187     3  0.2179     0.8647 0.000 0.064 0.924 0.012
#> SRR1377188     3  0.3172     0.7816 0.000 0.160 0.840 0.000
#> SRR1377189     2  0.2530     0.7966 0.000 0.888 0.112 0.000
#> SRR1377190     2  0.2647     0.8049 0.000 0.880 0.120 0.000
#> SRR1377191     2  0.3074     0.8282 0.000 0.848 0.152 0.000
#> SRR1377192     2  0.1975     0.6584 0.000 0.936 0.016 0.048
#> SRR1377193     2  0.1888     0.6628 0.000 0.940 0.016 0.044
#> SRR1377194     2  0.1975     0.6584 0.000 0.936 0.016 0.048
#> SRR1377195     1  0.1209     0.9263 0.964 0.004 0.000 0.032
#> SRR1377196     1  0.1109     0.9261 0.968 0.004 0.000 0.028
#> SRR1377197     1  0.0779     0.9269 0.980 0.004 0.000 0.016
#> SRR1377198     1  0.4037     0.9049 0.828 0.024 0.008 0.140
#> SRR1377199     1  0.4707     0.8851 0.760 0.036 0.000 0.204
#> SRR1377200     1  0.5288     0.8616 0.740 0.060 0.004 0.196
#> SRR1377201     2  0.2814     0.8158 0.000 0.868 0.132 0.000
#> SRR1377202     2  0.2921     0.8218 0.000 0.860 0.140 0.000
#> SRR1377203     2  0.2921     0.8220 0.000 0.860 0.140 0.000
#> SRR1377204     2  0.5069     0.0780 0.000 0.664 0.016 0.320
#> SRR1377205     2  0.5069     0.0780 0.000 0.664 0.016 0.320
#> SRR1377206     2  0.5069     0.0780 0.000 0.664 0.016 0.320
#> SRR1377207     2  0.3486     0.8356 0.000 0.812 0.188 0.000
#> SRR1377208     2  0.3610     0.8357 0.000 0.800 0.200 0.000
#> SRR1377209     2  0.3528     0.8358 0.000 0.808 0.192 0.000
#> SRR1377210     2  0.3074     0.8282 0.000 0.848 0.152 0.000
#> SRR1377211     2  0.3123     0.8298 0.000 0.844 0.156 0.000
#> SRR1377212     2  0.3172     0.8308 0.000 0.840 0.160 0.000
#> SRR1377213     4  0.6703     0.9899 0.000 0.232 0.156 0.612
#> SRR1377214     4  0.6703     0.9899 0.000 0.232 0.156 0.612
#> SRR1377215     4  0.6703     0.9899 0.000 0.232 0.156 0.612
#> SRR1377216     3  0.6806    -0.0691 0.000 0.112 0.544 0.344
#> SRR1377217     3  0.6759    -0.0515 0.000 0.108 0.548 0.344
#> SRR1377218     3  0.6806    -0.0691 0.000 0.112 0.544 0.344
#> SRR1377219     4  0.6742     0.9861 0.000 0.232 0.160 0.608
#> SRR1377220     4  0.6742     0.9861 0.000 0.232 0.160 0.608
#> SRR1377221     4  0.6703     0.9899 0.000 0.232 0.156 0.612
#> SRR1377222     4  0.6705     0.9820 0.000 0.244 0.148 0.608
#> SRR1377223     4  0.6705     0.9820 0.000 0.244 0.148 0.608
#> SRR1377224     4  0.6705     0.9820 0.000 0.244 0.148 0.608

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>            class entropy silhouette p1    p2    p3    p4    p5
#> SRR1377145     2  0.3827      0.833 NA 0.816 0.068 0.004 0.000
#> SRR1377146     2  0.3827      0.833 NA 0.816 0.068 0.004 0.000
#> SRR1377147     2  0.3731      0.832 NA 0.816 0.072 0.000 0.000
#> SRR1377148     2  0.3827      0.833 NA 0.816 0.068 0.004 0.000
#> SRR1377153     2  0.3955      0.823 NA 0.800 0.084 0.000 0.000
#> SRR1377154     2  0.3955      0.823 NA 0.800 0.084 0.000 0.000
#> SRR1377155     2  0.3906      0.824 NA 0.804 0.084 0.000 0.000
#> SRR1377156     2  0.3955      0.823 NA 0.800 0.084 0.000 0.000
#> SRR1377149     2  0.3791      0.830 NA 0.812 0.076 0.000 0.000
#> SRR1377150     2  0.3791      0.830 NA 0.812 0.076 0.000 0.000
#> SRR1377151     2  0.3849      0.827 NA 0.808 0.080 0.000 0.000
#> SRR1377152     2  0.3791      0.830 NA 0.812 0.076 0.000 0.000
#> SRR1377157     3  0.0451      0.846 NA 0.008 0.988 0.004 0.000
#> SRR1377158     3  0.0451      0.846 NA 0.008 0.988 0.004 0.000
#> SRR1377159     3  0.0451      0.846 NA 0.008 0.988 0.004 0.000
#> SRR1377160     3  0.0451      0.846 NA 0.008 0.988 0.004 0.000
#> SRR1377161     3  0.0740      0.844 NA 0.008 0.980 0.008 0.000
#> SRR1377162     3  0.0727      0.844 NA 0.012 0.980 0.004 0.000
#> SRR1377163     3  0.0854      0.842 NA 0.012 0.976 0.008 0.000
#> SRR1377164     3  0.0727      0.844 NA 0.012 0.980 0.004 0.000
#> SRR1377169     3  0.0727      0.844 NA 0.012 0.980 0.004 0.000
#> SRR1377170     3  0.0854      0.842 NA 0.012 0.976 0.008 0.000
#> SRR1377171     3  0.0727      0.844 NA 0.012 0.980 0.004 0.000
#> SRR1377172     3  0.0854      0.842 NA 0.012 0.976 0.008 0.000
#> SRR1377165     3  0.0613      0.845 NA 0.008 0.984 0.004 0.000
#> SRR1377166     3  0.0613      0.845 NA 0.008 0.984 0.004 0.000
#> SRR1377167     3  0.0613      0.845 NA 0.008 0.984 0.004 0.000
#> SRR1377168     3  0.0613      0.845 NA 0.008 0.984 0.004 0.000
#> SRR1377173     3  0.4326      0.839 NA 0.056 0.772 0.008 0.000
#> SRR1377174     3  0.4293      0.839 NA 0.064 0.772 0.004 0.000
#> SRR1377175     3  0.4181      0.841 NA 0.052 0.784 0.008 0.000
#> SRR1377176     3  0.4166      0.841 NA 0.056 0.780 0.004 0.000
#> SRR1377177     3  0.4564      0.828 NA 0.072 0.748 0.004 0.000
#> SRR1377178     3  0.4625      0.828 NA 0.068 0.748 0.008 0.000
#> SRR1377179     3  0.4370      0.836 NA 0.064 0.764 0.004 0.000
#> SRR1377180     3  0.4505      0.830 NA 0.068 0.752 0.004 0.000
#> SRR1377181     3  0.4326      0.839 NA 0.056 0.772 0.008 0.000
#> SRR1377182     3  0.4326      0.839 NA 0.056 0.772 0.008 0.000
#> SRR1377183     3  0.5173      0.792 NA 0.104 0.704 0.008 0.000
#> SRR1377184     3  0.4429      0.836 NA 0.060 0.764 0.008 0.000
#> SRR1377185     3  0.5220      0.789 NA 0.108 0.700 0.008 0.000
#> SRR1377186     3  0.5253      0.785 NA 0.108 0.696 0.008 0.000
#> SRR1377187     3  0.4298      0.839 NA 0.052 0.772 0.008 0.000
#> SRR1377188     3  0.5206      0.789 NA 0.104 0.700 0.008 0.000
#> SRR1377189     2  0.1216      0.855 NA 0.960 0.020 0.020 0.000
#> SRR1377190     2  0.1012      0.857 NA 0.968 0.020 0.012 0.000
#> SRR1377191     2  0.1059      0.857 NA 0.968 0.020 0.008 0.000
#> SRR1377192     2  0.1341      0.829 NA 0.944 0.000 0.056 0.000
#> SRR1377193     2  0.1662      0.832 NA 0.936 0.004 0.056 0.000
#> SRR1377194     2  0.1717      0.835 NA 0.936 0.004 0.052 0.000
#> SRR1377195     5  0.1768      0.870 NA 0.000 0.000 0.004 0.924
#> SRR1377196     5  0.1864      0.870 NA 0.004 0.000 0.004 0.924
#> SRR1377197     5  0.0955      0.871 NA 0.000 0.000 0.004 0.968
#> SRR1377198     5  0.4777      0.825 NA 0.016 0.000 0.028 0.696
#> SRR1377199     5  0.4656      0.788 NA 0.004 0.004 0.004 0.576
#> SRR1377200     5  0.5429      0.777 NA 0.020 0.000 0.036 0.596
#> SRR1377201     2  0.1498      0.856 NA 0.952 0.024 0.016 0.000
#> SRR1377202     2  0.1483      0.858 NA 0.952 0.028 0.012 0.000
#> SRR1377203     2  0.1483      0.858 NA 0.952 0.028 0.012 0.000
#> SRR1377204     2  0.4536      0.439 NA 0.640 0.008 0.344 0.000
#> SRR1377205     2  0.4536      0.439 NA 0.640 0.008 0.344 0.000
#> SRR1377206     2  0.4536      0.439 NA 0.640 0.008 0.344 0.000
#> SRR1377207     2  0.1651      0.858 NA 0.944 0.036 0.012 0.000
#> SRR1377208     2  0.1651      0.858 NA 0.944 0.036 0.012 0.000
#> SRR1377209     2  0.1651      0.858 NA 0.944 0.036 0.012 0.000
#> SRR1377210     2  0.1569      0.857 NA 0.948 0.032 0.012 0.000
#> SRR1377211     2  0.1569      0.857 NA 0.948 0.032 0.012 0.000
#> SRR1377212     2  0.1569      0.857 NA 0.948 0.032 0.012 0.000
#> SRR1377213     4  0.1818      0.824 NA 0.044 0.024 0.932 0.000
#> SRR1377214     4  0.1818      0.824 NA 0.044 0.024 0.932 0.000
#> SRR1377215     4  0.1818      0.824 NA 0.044 0.024 0.932 0.000
#> SRR1377216     4  0.5925      0.510 NA 0.032 0.332 0.580 0.000
#> SRR1377217     4  0.5977      0.493 NA 0.032 0.348 0.564 0.000
#> SRR1377218     4  0.5977      0.493 NA 0.032 0.348 0.564 0.000
#> SRR1377219     4  0.1911      0.822 NA 0.036 0.028 0.932 0.000
#> SRR1377220     4  0.1996      0.821 NA 0.036 0.032 0.928 0.000
#> SRR1377221     4  0.2078      0.819 NA 0.036 0.036 0.924 0.000
#> SRR1377222     4  0.1893      0.820 NA 0.048 0.024 0.928 0.000
#> SRR1377223     4  0.1893      0.820 NA 0.048 0.024 0.928 0.000
#> SRR1377224     4  0.1893      0.820 NA 0.048 0.024 0.928 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
#> SRR1377145     2  0.4423      0.635 0.000 0.552 0.028 0.000 0.000 NA
#> SRR1377146     2  0.4423      0.635 0.000 0.552 0.028 0.000 0.000 NA
#> SRR1377147     2  0.4561      0.632 0.004 0.544 0.028 0.000 0.000 NA
#> SRR1377148     2  0.4423      0.635 0.000 0.552 0.028 0.000 0.000 NA
#> SRR1377153     2  0.4765      0.625 0.016 0.536 0.024 0.000 0.000 NA
#> SRR1377154     2  0.4594      0.631 0.008 0.544 0.024 0.000 0.000 NA
#> SRR1377155     2  0.5043      0.609 0.024 0.520 0.032 0.000 0.000 NA
#> SRR1377156     2  0.4908      0.618 0.020 0.528 0.028 0.000 0.000 NA
#> SRR1377149     2  0.4683      0.628 0.012 0.540 0.024 0.000 0.000 NA
#> SRR1377150     2  0.4361      0.635 0.000 0.552 0.024 0.000 0.000 NA
#> SRR1377151     2  0.4594      0.631 0.008 0.544 0.024 0.000 0.000 NA
#> SRR1377152     2  0.4594      0.631 0.008 0.544 0.024 0.000 0.000 NA
#> SRR1377157     3  0.0665      0.923 0.008 0.008 0.980 0.004 0.000 NA
#> SRR1377158     3  0.0665      0.923 0.008 0.008 0.980 0.004 0.000 NA
#> SRR1377159     3  0.0520      0.923 0.008 0.008 0.984 0.000 0.000 NA
#> SRR1377160     3  0.0520      0.923 0.008 0.008 0.984 0.000 0.000 NA
#> SRR1377161     3  0.0622      0.924 0.000 0.012 0.980 0.008 0.000 NA
#> SRR1377162     3  0.0665      0.925 0.004 0.008 0.980 0.008 0.000 NA
#> SRR1377163     3  0.0820      0.918 0.000 0.012 0.972 0.016 0.000 NA
#> SRR1377164     3  0.0551      0.926 0.004 0.008 0.984 0.004 0.000 NA
#> SRR1377169     3  0.1078      0.920 0.008 0.016 0.964 0.012 0.000 NA
#> SRR1377170     3  0.1078      0.920 0.008 0.016 0.964 0.012 0.000 NA
#> SRR1377171     3  0.0748      0.924 0.004 0.016 0.976 0.004 0.000 NA
#> SRR1377172     3  0.0862      0.922 0.008 0.016 0.972 0.004 0.000 NA
#> SRR1377165     3  0.0665      0.926 0.008 0.008 0.980 0.004 0.000 NA
#> SRR1377166     3  0.0551      0.926 0.004 0.008 0.984 0.004 0.000 NA
#> SRR1377167     3  0.0551      0.926 0.004 0.008 0.984 0.004 0.000 NA
#> SRR1377168     3  0.0551      0.926 0.004 0.008 0.984 0.004 0.000 NA
#> SRR1377173     1  0.6802      0.937 0.396 0.064 0.384 0.004 0.000 NA
#> SRR1377174     1  0.6760      0.935 0.400 0.060 0.384 0.004 0.000 NA
#> SRR1377175     3  0.6697     -0.924 0.392 0.056 0.400 0.004 0.000 NA
#> SRR1377176     1  0.6760      0.936 0.400 0.060 0.384 0.004 0.000 NA
#> SRR1377177     1  0.6854      0.949 0.400 0.060 0.364 0.004 0.000 NA
#> SRR1377178     1  0.6795      0.948 0.400 0.056 0.372 0.004 0.000 NA
#> SRR1377179     1  0.6795      0.948 0.400 0.056 0.372 0.004 0.000 NA
#> SRR1377180     1  0.6795      0.947 0.400 0.056 0.372 0.004 0.000 NA
#> SRR1377181     1  0.6949      0.949 0.392 0.060 0.368 0.008 0.000 NA
#> SRR1377182     1  0.7016      0.946 0.392 0.064 0.372 0.012 0.000 NA
#> SRR1377183     1  0.7402      0.906 0.380 0.092 0.316 0.012 0.000 NA
#> SRR1377184     1  0.6964      0.949 0.396 0.060 0.360 0.008 0.000 NA
#> SRR1377185     1  0.7429      0.902 0.380 0.096 0.312 0.012 0.000 NA
#> SRR1377186     1  0.7438      0.897 0.380 0.096 0.308 0.012 0.000 NA
#> SRR1377187     1  0.6966      0.949 0.392 0.060 0.364 0.008 0.000 NA
#> SRR1377188     1  0.7438      0.899 0.380 0.096 0.308 0.012 0.000 NA
#> SRR1377189     2  0.1856      0.725 0.008 0.932 0.024 0.008 0.000 NA
#> SRR1377190     2  0.1776      0.725 0.008 0.936 0.024 0.008 0.000 NA
#> SRR1377191     2  0.1881      0.725 0.008 0.928 0.020 0.004 0.000 NA
#> SRR1377192     2  0.2085      0.710 0.000 0.912 0.008 0.056 0.000 NA
#> SRR1377193     2  0.2101      0.712 0.000 0.912 0.008 0.052 0.000 NA
#> SRR1377194     2  0.2022      0.712 0.000 0.916 0.008 0.052 0.000 NA
#> SRR1377195     5  0.2136      0.829 0.048 0.000 0.000 0.000 0.904 NA
#> SRR1377196     5  0.1980      0.829 0.036 0.000 0.008 0.000 0.920 NA
#> SRR1377197     5  0.2001      0.829 0.048 0.000 0.000 0.000 0.912 NA
#> SRR1377198     5  0.5689      0.751 0.236 0.000 0.000 0.008 0.564 NA
#> SRR1377199     5  0.5693      0.738 0.172 0.000 0.000 0.004 0.532 NA
#> SRR1377200     5  0.5910      0.718 0.344 0.004 0.000 0.004 0.484 NA
#> SRR1377201     2  0.1370      0.720 0.012 0.948 0.036 0.004 0.000 NA
#> SRR1377202     2  0.1370      0.720 0.012 0.948 0.036 0.004 0.000 NA
#> SRR1377203     2  0.1442      0.718 0.012 0.944 0.040 0.004 0.000 NA
#> SRR1377204     2  0.3323      0.577 0.004 0.784 0.008 0.200 0.000 NA
#> SRR1377205     2  0.3293      0.582 0.004 0.788 0.008 0.196 0.000 NA
#> SRR1377206     2  0.3323      0.577 0.004 0.784 0.008 0.200 0.000 NA
#> SRR1377207     2  0.1713      0.714 0.028 0.928 0.044 0.000 0.000 NA
#> SRR1377208     2  0.1713      0.714 0.028 0.928 0.044 0.000 0.000 NA
#> SRR1377209     2  0.1780      0.712 0.028 0.924 0.048 0.000 0.000 NA
#> SRR1377210     2  0.1666      0.718 0.020 0.936 0.036 0.008 0.000 NA
#> SRR1377211     2  0.1666      0.718 0.020 0.936 0.036 0.008 0.000 NA
#> SRR1377212     2  0.1552      0.719 0.020 0.940 0.036 0.004 0.000 NA
#> SRR1377213     4  0.1269      0.864 0.012 0.020 0.012 0.956 0.000 NA
#> SRR1377214     4  0.1269      0.864 0.012 0.020 0.012 0.956 0.000 NA
#> SRR1377215     4  0.1269      0.864 0.012 0.020 0.012 0.956 0.000 NA
#> SRR1377216     4  0.5666      0.602 0.152 0.016 0.180 0.636 0.000 NA
#> SRR1377217     4  0.5633      0.606 0.148 0.016 0.180 0.640 0.000 NA
#> SRR1377218     4  0.5719      0.595 0.156 0.020 0.184 0.628 0.000 NA
#> SRR1377219     4  0.1452      0.865 0.012 0.020 0.020 0.948 0.000 NA
#> SRR1377220     4  0.1452      0.865 0.012 0.020 0.020 0.948 0.000 NA
#> SRR1377221     4  0.1452      0.865 0.012 0.020 0.020 0.948 0.000 NA
#> SRR1377222     4  0.1036      0.850 0.000 0.024 0.008 0.964 0.000 NA
#> SRR1377223     4  0.1036      0.850 0.000 0.024 0.008 0.964 0.000 NA
#> SRR1377224     4  0.1036      0.850 0.000 0.024 0.008 0.964 0.000 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-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 13890 rows and 80 columns.
#>   Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'CV' method.
#>   Subgroups are detected by 'hclust' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 2.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

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

collect_plots(res)

plot of chunk CV-hclust-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 1.000           1.000       1.000         0.1414 0.859   0.859
#> 3 3 0.323           0.553       0.757         2.1259 0.744   0.709
#> 4 4 0.315           0.748       0.770         0.3150 0.747   0.606
#> 5 5 0.481           0.856       0.823         0.1205 0.871   0.670
#> 6 6 0.493           0.885       0.834         0.0788 0.962   0.855

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

suggest_best_k(res)
#> [1] 2

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

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

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>            class entropy silhouette p1 p2
#> SRR1377145     2       0          1  0  1
#> SRR1377146     2       0          1  0  1
#> SRR1377147     2       0          1  0  1
#> SRR1377148     2       0          1  0  1
#> SRR1377153     2       0          1  0  1
#> SRR1377154     2       0          1  0  1
#> SRR1377155     2       0          1  0  1
#> SRR1377156     2       0          1  0  1
#> SRR1377149     2       0          1  0  1
#> SRR1377150     2       0          1  0  1
#> SRR1377151     2       0          1  0  1
#> SRR1377152     2       0          1  0  1
#> SRR1377157     2       0          1  0  1
#> SRR1377158     2       0          1  0  1
#> SRR1377159     2       0          1  0  1
#> SRR1377160     2       0          1  0  1
#> SRR1377161     2       0          1  0  1
#> SRR1377162     2       0          1  0  1
#> SRR1377163     2       0          1  0  1
#> SRR1377164     2       0          1  0  1
#> SRR1377169     2       0          1  0  1
#> SRR1377170     2       0          1  0  1
#> SRR1377171     2       0          1  0  1
#> SRR1377172     2       0          1  0  1
#> SRR1377165     2       0          1  0  1
#> SRR1377166     2       0          1  0  1
#> SRR1377167     2       0          1  0  1
#> SRR1377168     2       0          1  0  1
#> SRR1377173     2       0          1  0  1
#> SRR1377174     2       0          1  0  1
#> SRR1377175     2       0          1  0  1
#> SRR1377176     2       0          1  0  1
#> SRR1377177     2       0          1  0  1
#> SRR1377178     2       0          1  0  1
#> SRR1377179     2       0          1  0  1
#> SRR1377180     2       0          1  0  1
#> SRR1377181     2       0          1  0  1
#> SRR1377182     2       0          1  0  1
#> SRR1377183     2       0          1  0  1
#> SRR1377184     2       0          1  0  1
#> SRR1377185     2       0          1  0  1
#> SRR1377186     2       0          1  0  1
#> SRR1377187     2       0          1  0  1
#> SRR1377188     2       0          1  0  1
#> SRR1377189     2       0          1  0  1
#> SRR1377190     2       0          1  0  1
#> SRR1377191     2       0          1  0  1
#> SRR1377192     2       0          1  0  1
#> SRR1377193     2       0          1  0  1
#> SRR1377194     2       0          1  0  1
#> SRR1377195     1       0          1  1  0
#> SRR1377196     1       0          1  1  0
#> SRR1377197     1       0          1  1  0
#> SRR1377198     1       0          1  1  0
#> SRR1377199     1       0          1  1  0
#> SRR1377200     1       0          1  1  0
#> SRR1377201     2       0          1  0  1
#> SRR1377202     2       0          1  0  1
#> SRR1377203     2       0          1  0  1
#> SRR1377204     2       0          1  0  1
#> SRR1377205     2       0          1  0  1
#> SRR1377206     2       0          1  0  1
#> SRR1377207     2       0          1  0  1
#> SRR1377208     2       0          1  0  1
#> SRR1377209     2       0          1  0  1
#> SRR1377210     2       0          1  0  1
#> SRR1377211     2       0          1  0  1
#> SRR1377212     2       0          1  0  1
#> SRR1377213     2       0          1  0  1
#> SRR1377214     2       0          1  0  1
#> SRR1377215     2       0          1  0  1
#> SRR1377216     2       0          1  0  1
#> SRR1377217     2       0          1  0  1
#> SRR1377218     2       0          1  0  1
#> SRR1377219     2       0          1  0  1
#> SRR1377220     2       0          1  0  1
#> SRR1377221     2       0          1  0  1
#> SRR1377222     2       0          1  0  1
#> SRR1377223     2       0          1  0  1
#> SRR1377224     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
#> SRR1377145     1  0.9616      0.656 0.420 0.376 0.204
#> SRR1377146     1  0.9616      0.656 0.420 0.376 0.204
#> SRR1377147     1  0.9616      0.656 0.420 0.376 0.204
#> SRR1377148     1  0.9616      0.656 0.420 0.376 0.204
#> SRR1377153     1  0.9616      0.656 0.420 0.376 0.204
#> SRR1377154     1  0.9616      0.656 0.420 0.376 0.204
#> SRR1377155     1  0.9616      0.656 0.420 0.376 0.204
#> SRR1377156     1  0.9616      0.656 0.420 0.376 0.204
#> SRR1377149     1  0.9616      0.656 0.420 0.376 0.204
#> SRR1377150     1  0.9616      0.656 0.420 0.376 0.204
#> SRR1377151     1  0.9616      0.656 0.420 0.376 0.204
#> SRR1377152     1  0.9616      0.656 0.420 0.376 0.204
#> SRR1377157     2  0.6309      0.411 0.000 0.504 0.496
#> SRR1377158     2  0.6309      0.411 0.000 0.504 0.496
#> SRR1377159     2  0.6309      0.411 0.000 0.504 0.496
#> SRR1377160     2  0.6309      0.411 0.000 0.504 0.496
#> SRR1377161     2  0.6309      0.411 0.000 0.504 0.496
#> SRR1377162     2  0.6309      0.411 0.000 0.504 0.496
#> SRR1377163     2  0.6309      0.411 0.000 0.504 0.496
#> SRR1377164     2  0.6309      0.411 0.000 0.504 0.496
#> SRR1377169     2  0.6111      0.507 0.000 0.604 0.396
#> SRR1377170     2  0.6111      0.507 0.000 0.604 0.396
#> SRR1377171     2  0.6111      0.507 0.000 0.604 0.396
#> SRR1377172     2  0.6111      0.507 0.000 0.604 0.396
#> SRR1377165     2  0.6308      0.416 0.000 0.508 0.492
#> SRR1377166     2  0.6308      0.416 0.000 0.508 0.492
#> SRR1377167     2  0.6308      0.416 0.000 0.508 0.492
#> SRR1377168     2  0.6308      0.416 0.000 0.508 0.492
#> SRR1377173     2  0.0747      0.764 0.016 0.984 0.000
#> SRR1377174     2  0.0747      0.764 0.016 0.984 0.000
#> SRR1377175     2  0.0747      0.764 0.016 0.984 0.000
#> SRR1377176     2  0.0747      0.764 0.016 0.984 0.000
#> SRR1377177     2  0.0000      0.771 0.000 1.000 0.000
#> SRR1377178     2  0.0000      0.771 0.000 1.000 0.000
#> SRR1377179     2  0.0000      0.771 0.000 1.000 0.000
#> SRR1377180     2  0.0000      0.771 0.000 1.000 0.000
#> SRR1377181     2  0.5178      0.629 0.000 0.744 0.256
#> SRR1377182     2  0.5178      0.629 0.000 0.744 0.256
#> SRR1377183     2  0.0000      0.771 0.000 1.000 0.000
#> SRR1377184     2  0.5178      0.629 0.000 0.744 0.256
#> SRR1377185     2  0.0000      0.771 0.000 1.000 0.000
#> SRR1377186     2  0.0000      0.771 0.000 1.000 0.000
#> SRR1377187     2  0.5178      0.629 0.000 0.744 0.256
#> SRR1377188     2  0.0000      0.771 0.000 1.000 0.000
#> SRR1377189     2  0.1031      0.774 0.000 0.976 0.024
#> SRR1377190     2  0.1031      0.774 0.000 0.976 0.024
#> SRR1377191     2  0.1031      0.774 0.000 0.976 0.024
#> SRR1377192     2  0.1031      0.774 0.000 0.976 0.024
#> SRR1377193     2  0.1031      0.774 0.000 0.976 0.024
#> SRR1377194     2  0.1031      0.774 0.000 0.976 0.024
#> SRR1377195     1  0.6309     -1.000 0.500 0.000 0.500
#> SRR1377196     1  0.6309     -1.000 0.500 0.000 0.500
#> SRR1377197     3  0.6309      0.000 0.500 0.000 0.500
#> SRR1377198     1  0.6309     -1.000 0.500 0.000 0.500
#> SRR1377199     1  0.6309     -1.000 0.500 0.000 0.500
#> SRR1377200     1  0.6308     -0.995 0.508 0.000 0.492
#> SRR1377201     2  0.2448      0.742 0.076 0.924 0.000
#> SRR1377202     2  0.2448      0.742 0.076 0.924 0.000
#> SRR1377203     2  0.2448      0.742 0.076 0.924 0.000
#> SRR1377204     2  0.2796      0.730 0.092 0.908 0.000
#> SRR1377205     2  0.2796      0.730 0.092 0.908 0.000
#> SRR1377206     2  0.2796      0.730 0.092 0.908 0.000
#> SRR1377207     2  0.2448      0.742 0.076 0.924 0.000
#> SRR1377208     2  0.2448      0.742 0.076 0.924 0.000
#> SRR1377209     2  0.2448      0.742 0.076 0.924 0.000
#> SRR1377210     2  0.2448      0.742 0.076 0.924 0.000
#> SRR1377211     2  0.2448      0.742 0.076 0.924 0.000
#> SRR1377212     2  0.2448      0.742 0.076 0.924 0.000
#> SRR1377213     2  0.1399      0.773 0.004 0.968 0.028
#> SRR1377214     2  0.1399      0.773 0.004 0.968 0.028
#> SRR1377215     2  0.1399      0.773 0.004 0.968 0.028
#> SRR1377216     2  0.1399      0.773 0.004 0.968 0.028
#> SRR1377217     2  0.1399      0.773 0.004 0.968 0.028
#> SRR1377218     2  0.1399      0.773 0.004 0.968 0.028
#> SRR1377219     2  0.1399      0.773 0.004 0.968 0.028
#> SRR1377220     2  0.1399      0.773 0.004 0.968 0.028
#> SRR1377221     2  0.1399      0.773 0.004 0.968 0.028
#> SRR1377222     2  0.3112      0.727 0.096 0.900 0.004
#> SRR1377223     2  0.3112      0.727 0.096 0.900 0.004
#> SRR1377224     2  0.3112      0.727 0.096 0.900 0.004

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> SRR1377145     4  0.6243      1.000 0.000 0.392 0.060 0.548
#> SRR1377146     4  0.6243      1.000 0.000 0.392 0.060 0.548
#> SRR1377147     4  0.6243      1.000 0.000 0.392 0.060 0.548
#> SRR1377148     4  0.6243      1.000 0.000 0.392 0.060 0.548
#> SRR1377153     4  0.6243      1.000 0.000 0.392 0.060 0.548
#> SRR1377154     4  0.6243      1.000 0.000 0.392 0.060 0.548
#> SRR1377155     4  0.6243      1.000 0.000 0.392 0.060 0.548
#> SRR1377156     4  0.6243      1.000 0.000 0.392 0.060 0.548
#> SRR1377149     4  0.6243      1.000 0.000 0.392 0.060 0.548
#> SRR1377150     4  0.6243      1.000 0.000 0.392 0.060 0.548
#> SRR1377151     4  0.6243      1.000 0.000 0.392 0.060 0.548
#> SRR1377152     4  0.6243      1.000 0.000 0.392 0.060 0.548
#> SRR1377157     3  0.3649      0.952 0.000 0.204 0.796 0.000
#> SRR1377158     3  0.3649      0.952 0.000 0.204 0.796 0.000
#> SRR1377159     3  0.3649      0.952 0.000 0.204 0.796 0.000
#> SRR1377160     3  0.3649      0.952 0.000 0.204 0.796 0.000
#> SRR1377161     3  0.3649      0.952 0.000 0.204 0.796 0.000
#> SRR1377162     3  0.3649      0.952 0.000 0.204 0.796 0.000
#> SRR1377163     3  0.3649      0.952 0.000 0.204 0.796 0.000
#> SRR1377164     3  0.3649      0.952 0.000 0.204 0.796 0.000
#> SRR1377169     3  0.4477      0.846 0.000 0.312 0.688 0.000
#> SRR1377170     3  0.4477      0.846 0.000 0.312 0.688 0.000
#> SRR1377171     3  0.4477      0.846 0.000 0.312 0.688 0.000
#> SRR1377172     3  0.4477      0.846 0.000 0.312 0.688 0.000
#> SRR1377165     3  0.3688      0.951 0.000 0.208 0.792 0.000
#> SRR1377166     3  0.3688      0.951 0.000 0.208 0.792 0.000
#> SRR1377167     3  0.3688      0.951 0.000 0.208 0.792 0.000
#> SRR1377168     3  0.3688      0.951 0.000 0.208 0.792 0.000
#> SRR1377173     2  0.0188      0.705 0.000 0.996 0.004 0.000
#> SRR1377174     2  0.0188      0.705 0.000 0.996 0.004 0.000
#> SRR1377175     2  0.0188      0.705 0.000 0.996 0.004 0.000
#> SRR1377176     2  0.0188      0.705 0.000 0.996 0.004 0.000
#> SRR1377177     2  0.0707      0.711 0.000 0.980 0.020 0.000
#> SRR1377178     2  0.0707      0.711 0.000 0.980 0.020 0.000
#> SRR1377179     2  0.0707      0.711 0.000 0.980 0.020 0.000
#> SRR1377180     2  0.0707      0.711 0.000 0.980 0.020 0.000
#> SRR1377181     2  0.4746      0.167 0.000 0.632 0.368 0.000
#> SRR1377182     2  0.4746      0.167 0.000 0.632 0.368 0.000
#> SRR1377183     2  0.0707      0.711 0.000 0.980 0.020 0.000
#> SRR1377184     2  0.4746      0.167 0.000 0.632 0.368 0.000
#> SRR1377185     2  0.0707      0.711 0.000 0.980 0.020 0.000
#> SRR1377186     2  0.0707      0.711 0.000 0.980 0.020 0.000
#> SRR1377187     2  0.4746      0.167 0.000 0.632 0.368 0.000
#> SRR1377188     2  0.0707      0.711 0.000 0.980 0.020 0.000
#> SRR1377189     2  0.3176      0.705 0.000 0.880 0.036 0.084
#> SRR1377190     2  0.3176      0.705 0.000 0.880 0.036 0.084
#> SRR1377191     2  0.3176      0.705 0.000 0.880 0.036 0.084
#> SRR1377192     2  0.3176      0.705 0.000 0.880 0.036 0.084
#> SRR1377193     2  0.3176      0.705 0.000 0.880 0.036 0.084
#> SRR1377194     2  0.3176      0.705 0.000 0.880 0.036 0.084
#> SRR1377195     1  0.0000      0.977 1.000 0.000 0.000 0.000
#> SRR1377196     1  0.0000      0.977 1.000 0.000 0.000 0.000
#> SRR1377197     1  0.0000      0.977 1.000 0.000 0.000 0.000
#> SRR1377198     1  0.0817      0.975 0.976 0.000 0.000 0.024
#> SRR1377199     1  0.1118      0.971 0.964 0.000 0.000 0.036
#> SRR1377200     1  0.3355      0.913 0.836 0.000 0.004 0.160
#> SRR1377201     2  0.1743      0.697 0.000 0.940 0.056 0.004
#> SRR1377202     2  0.1743      0.697 0.000 0.940 0.056 0.004
#> SRR1377203     2  0.1743      0.697 0.000 0.940 0.056 0.004
#> SRR1377204     2  0.2053      0.684 0.000 0.924 0.072 0.004
#> SRR1377205     2  0.2053      0.684 0.000 0.924 0.072 0.004
#> SRR1377206     2  0.2053      0.684 0.000 0.924 0.072 0.004
#> SRR1377207     2  0.1743      0.697 0.000 0.940 0.056 0.004
#> SRR1377208     2  0.1743      0.697 0.000 0.940 0.056 0.004
#> SRR1377209     2  0.1743      0.697 0.000 0.940 0.056 0.004
#> SRR1377210     2  0.1743      0.697 0.000 0.940 0.056 0.004
#> SRR1377211     2  0.1743      0.697 0.000 0.940 0.056 0.004
#> SRR1377212     2  0.1743      0.697 0.000 0.940 0.056 0.004
#> SRR1377213     2  0.6836      0.505 0.000 0.580 0.280 0.140
#> SRR1377214     2  0.6836      0.505 0.000 0.580 0.280 0.140
#> SRR1377215     2  0.6836      0.505 0.000 0.580 0.280 0.140
#> SRR1377216     2  0.6836      0.505 0.000 0.580 0.280 0.140
#> SRR1377217     2  0.6836      0.505 0.000 0.580 0.280 0.140
#> SRR1377218     2  0.6836      0.505 0.000 0.580 0.280 0.140
#> SRR1377219     2  0.6836      0.505 0.000 0.580 0.280 0.140
#> SRR1377220     2  0.6836      0.505 0.000 0.580 0.280 0.140
#> SRR1377221     2  0.6836      0.505 0.000 0.580 0.280 0.140
#> SRR1377222     2  0.7768      0.327 0.000 0.428 0.312 0.260
#> SRR1377223     2  0.7768      0.327 0.000 0.428 0.312 0.260
#> SRR1377224     2  0.7768      0.327 0.000 0.428 0.312 0.260

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>            class entropy silhouette    p1    p2    p3    p4    p5
#> SRR1377145     2  0.5086      1.000 0.304 0.636 0.060 0.000 0.000
#> SRR1377146     2  0.5086      1.000 0.304 0.636 0.060 0.000 0.000
#> SRR1377147     2  0.5086      1.000 0.304 0.636 0.060 0.000 0.000
#> SRR1377148     2  0.5086      1.000 0.304 0.636 0.060 0.000 0.000
#> SRR1377153     2  0.5086      1.000 0.304 0.636 0.060 0.000 0.000
#> SRR1377154     2  0.5086      1.000 0.304 0.636 0.060 0.000 0.000
#> SRR1377155     2  0.5086      1.000 0.304 0.636 0.060 0.000 0.000
#> SRR1377156     2  0.5086      1.000 0.304 0.636 0.060 0.000 0.000
#> SRR1377149     2  0.5086      1.000 0.304 0.636 0.060 0.000 0.000
#> SRR1377150     2  0.5086      1.000 0.304 0.636 0.060 0.000 0.000
#> SRR1377151     2  0.5086      1.000 0.304 0.636 0.060 0.000 0.000
#> SRR1377152     2  0.5086      1.000 0.304 0.636 0.060 0.000 0.000
#> SRR1377157     3  0.0510      0.950 0.016 0.000 0.984 0.000 0.000
#> SRR1377158     3  0.0510      0.950 0.016 0.000 0.984 0.000 0.000
#> SRR1377159     3  0.0510      0.950 0.016 0.000 0.984 0.000 0.000
#> SRR1377160     3  0.0510      0.950 0.016 0.000 0.984 0.000 0.000
#> SRR1377161     3  0.0510      0.950 0.016 0.000 0.984 0.000 0.000
#> SRR1377162     3  0.0510      0.950 0.016 0.000 0.984 0.000 0.000
#> SRR1377163     3  0.0510      0.950 0.016 0.000 0.984 0.000 0.000
#> SRR1377164     3  0.0510      0.950 0.016 0.000 0.984 0.000 0.000
#> SRR1377169     3  0.2329      0.848 0.124 0.000 0.876 0.000 0.000
#> SRR1377170     3  0.2329      0.848 0.124 0.000 0.876 0.000 0.000
#> SRR1377171     3  0.2329      0.848 0.124 0.000 0.876 0.000 0.000
#> SRR1377172     3  0.2329      0.848 0.124 0.000 0.876 0.000 0.000
#> SRR1377165     3  0.0609      0.949 0.020 0.000 0.980 0.000 0.000
#> SRR1377166     3  0.0609      0.949 0.020 0.000 0.980 0.000 0.000
#> SRR1377167     3  0.0609      0.949 0.020 0.000 0.980 0.000 0.000
#> SRR1377168     3  0.0609      0.949 0.020 0.000 0.980 0.000 0.000
#> SRR1377173     1  0.1410      0.834 0.940 0.000 0.060 0.000 0.000
#> SRR1377174     1  0.1410      0.834 0.940 0.000 0.060 0.000 0.000
#> SRR1377175     1  0.1410      0.834 0.940 0.000 0.060 0.000 0.000
#> SRR1377176     1  0.1410      0.834 0.940 0.000 0.060 0.000 0.000
#> SRR1377177     1  0.1671      0.835 0.924 0.000 0.076 0.000 0.000
#> SRR1377178     1  0.1671      0.835 0.924 0.000 0.076 0.000 0.000
#> SRR1377179     1  0.1671      0.835 0.924 0.000 0.076 0.000 0.000
#> SRR1377180     1  0.1671      0.835 0.924 0.000 0.076 0.000 0.000
#> SRR1377181     1  0.6162      0.410 0.572 0.028 0.316 0.084 0.000
#> SRR1377182     1  0.6162      0.410 0.572 0.028 0.316 0.084 0.000
#> SRR1377183     1  0.1671      0.835 0.924 0.000 0.076 0.000 0.000
#> SRR1377184     1  0.6162      0.410 0.572 0.028 0.316 0.084 0.000
#> SRR1377185     1  0.1671      0.835 0.924 0.000 0.076 0.000 0.000
#> SRR1377186     1  0.1671      0.835 0.924 0.000 0.076 0.000 0.000
#> SRR1377187     1  0.6162      0.410 0.572 0.028 0.316 0.084 0.000
#> SRR1377188     1  0.1671      0.835 0.924 0.000 0.076 0.000 0.000
#> SRR1377189     1  0.3812      0.738 0.812 0.000 0.096 0.092 0.000
#> SRR1377190     1  0.3812      0.738 0.812 0.000 0.096 0.092 0.000
#> SRR1377191     1  0.3812      0.738 0.812 0.000 0.096 0.092 0.000
#> SRR1377192     1  0.3812      0.738 0.812 0.000 0.096 0.092 0.000
#> SRR1377193     1  0.3812      0.738 0.812 0.000 0.096 0.092 0.000
#> SRR1377194     1  0.3812      0.738 0.812 0.000 0.096 0.092 0.000
#> SRR1377195     5  0.0000      0.947 0.000 0.000 0.000 0.000 1.000
#> SRR1377196     5  0.0000      0.947 0.000 0.000 0.000 0.000 1.000
#> SRR1377197     5  0.0000      0.947 0.000 0.000 0.000 0.000 1.000
#> SRR1377198     5  0.2758      0.926 0.000 0.024 0.012 0.076 0.888
#> SRR1377199     5  0.2233      0.927 0.000 0.000 0.004 0.104 0.892
#> SRR1377200     5  0.3857      0.843 0.000 0.312 0.000 0.000 0.688
#> SRR1377201     1  0.0162      0.824 0.996 0.000 0.000 0.004 0.000
#> SRR1377202     1  0.0162      0.824 0.996 0.000 0.000 0.004 0.000
#> SRR1377203     1  0.0162      0.824 0.996 0.000 0.000 0.004 0.000
#> SRR1377204     1  0.0609      0.805 0.980 0.000 0.000 0.020 0.000
#> SRR1377205     1  0.0609      0.805 0.980 0.000 0.000 0.020 0.000
#> SRR1377206     1  0.0609      0.805 0.980 0.000 0.000 0.020 0.000
#> SRR1377207     1  0.0162      0.824 0.996 0.000 0.000 0.004 0.000
#> SRR1377208     1  0.0162      0.824 0.996 0.000 0.000 0.004 0.000
#> SRR1377209     1  0.0162      0.824 0.996 0.000 0.000 0.004 0.000
#> SRR1377210     1  0.0162      0.824 0.996 0.000 0.000 0.004 0.000
#> SRR1377211     1  0.0162      0.824 0.996 0.000 0.000 0.004 0.000
#> SRR1377212     1  0.0162      0.824 0.996 0.000 0.000 0.004 0.000
#> SRR1377213     4  0.5579      0.903 0.300 0.000 0.100 0.600 0.000
#> SRR1377214     4  0.5579      0.903 0.300 0.000 0.100 0.600 0.000
#> SRR1377215     4  0.5579      0.903 0.300 0.000 0.100 0.600 0.000
#> SRR1377216     4  0.5579      0.903 0.300 0.000 0.100 0.600 0.000
#> SRR1377217     4  0.5579      0.903 0.300 0.000 0.100 0.600 0.000
#> SRR1377218     4  0.5579      0.903 0.300 0.000 0.100 0.600 0.000
#> SRR1377219     4  0.5579      0.903 0.300 0.000 0.100 0.600 0.000
#> SRR1377220     4  0.5579      0.903 0.300 0.000 0.100 0.600 0.000
#> SRR1377221     4  0.5579      0.903 0.300 0.000 0.100 0.600 0.000
#> SRR1377222     4  0.3586      0.709 0.264 0.000 0.000 0.736 0.000
#> SRR1377223     4  0.3586      0.709 0.264 0.000 0.000 0.736 0.000
#> SRR1377224     4  0.3586      0.709 0.264 0.000 0.000 0.736 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
#> SRR1377145     6  0.3288      0.982 0.000 0.276 0.000 0.000 0.000 0.724
#> SRR1377146     6  0.3288      0.982 0.000 0.276 0.000 0.000 0.000 0.724
#> SRR1377147     6  0.3288      0.982 0.000 0.276 0.000 0.000 0.000 0.724
#> SRR1377148     6  0.3288      0.982 0.000 0.276 0.000 0.000 0.000 0.724
#> SRR1377153     6  0.3351      0.976 0.000 0.288 0.000 0.000 0.000 0.712
#> SRR1377154     6  0.3351      0.976 0.000 0.288 0.000 0.000 0.000 0.712
#> SRR1377155     6  0.3351      0.976 0.000 0.288 0.000 0.000 0.000 0.712
#> SRR1377156     6  0.3351      0.976 0.000 0.288 0.000 0.000 0.000 0.712
#> SRR1377149     6  0.3583      0.971 0.008 0.260 0.000 0.004 0.000 0.728
#> SRR1377150     6  0.3583      0.971 0.008 0.260 0.000 0.004 0.000 0.728
#> SRR1377151     6  0.3583      0.971 0.008 0.260 0.000 0.004 0.000 0.728
#> SRR1377152     6  0.3583      0.971 0.008 0.260 0.000 0.004 0.000 0.728
#> SRR1377157     3  0.0458      0.934 0.000 0.016 0.984 0.000 0.000 0.000
#> SRR1377158     3  0.0458      0.934 0.000 0.016 0.984 0.000 0.000 0.000
#> SRR1377159     3  0.0458      0.934 0.000 0.016 0.984 0.000 0.000 0.000
#> SRR1377160     3  0.0458      0.934 0.000 0.016 0.984 0.000 0.000 0.000
#> SRR1377161     3  0.0458      0.934 0.000 0.016 0.984 0.000 0.000 0.000
#> SRR1377162     3  0.0458      0.934 0.000 0.016 0.984 0.000 0.000 0.000
#> SRR1377163     3  0.0458      0.934 0.000 0.016 0.984 0.000 0.000 0.000
#> SRR1377164     3  0.0458      0.934 0.000 0.016 0.984 0.000 0.000 0.000
#> SRR1377169     3  0.2092      0.798 0.000 0.124 0.876 0.000 0.000 0.000
#> SRR1377170     3  0.2092      0.798 0.000 0.124 0.876 0.000 0.000 0.000
#> SRR1377171     3  0.2092      0.798 0.000 0.124 0.876 0.000 0.000 0.000
#> SRR1377172     3  0.2092      0.798 0.000 0.124 0.876 0.000 0.000 0.000
#> SRR1377165     3  0.0547      0.933 0.000 0.020 0.980 0.000 0.000 0.000
#> SRR1377166     3  0.0547      0.933 0.000 0.020 0.980 0.000 0.000 0.000
#> SRR1377167     3  0.0547      0.933 0.000 0.020 0.980 0.000 0.000 0.000
#> SRR1377168     3  0.0547      0.933 0.000 0.020 0.980 0.000 0.000 0.000
#> SRR1377173     2  0.1411      0.906 0.004 0.936 0.060 0.000 0.000 0.000
#> SRR1377174     2  0.1411      0.906 0.004 0.936 0.060 0.000 0.000 0.000
#> SRR1377175     2  0.1411      0.906 0.004 0.936 0.060 0.000 0.000 0.000
#> SRR1377176     2  0.1411      0.906 0.004 0.936 0.060 0.000 0.000 0.000
#> SRR1377177     2  0.1644      0.905 0.004 0.920 0.076 0.000 0.000 0.000
#> SRR1377178     2  0.1644      0.905 0.004 0.920 0.076 0.000 0.000 0.000
#> SRR1377179     2  0.1644      0.905 0.004 0.920 0.076 0.000 0.000 0.000
#> SRR1377180     2  0.1644      0.905 0.004 0.920 0.076 0.000 0.000 0.000
#> SRR1377181     1  0.4486      1.000 0.696 0.096 0.208 0.000 0.000 0.000
#> SRR1377182     1  0.4486      1.000 0.696 0.096 0.208 0.000 0.000 0.000
#> SRR1377183     2  0.1644      0.905 0.004 0.920 0.076 0.000 0.000 0.000
#> SRR1377184     1  0.4486      1.000 0.696 0.096 0.208 0.000 0.000 0.000
#> SRR1377185     2  0.1644      0.905 0.004 0.920 0.076 0.000 0.000 0.000
#> SRR1377186     2  0.1644      0.905 0.004 0.920 0.076 0.000 0.000 0.000
#> SRR1377187     1  0.4486      1.000 0.696 0.096 0.208 0.000 0.000 0.000
#> SRR1377188     2  0.1644      0.905 0.004 0.920 0.076 0.000 0.000 0.000
#> SRR1377189     2  0.3424      0.800 0.000 0.812 0.096 0.092 0.000 0.000
#> SRR1377190     2  0.3424      0.800 0.000 0.812 0.096 0.092 0.000 0.000
#> SRR1377191     2  0.3424      0.800 0.000 0.812 0.096 0.092 0.000 0.000
#> SRR1377192     2  0.3424      0.800 0.000 0.812 0.096 0.092 0.000 0.000
#> SRR1377193     2  0.3424      0.800 0.000 0.812 0.096 0.092 0.000 0.000
#> SRR1377194     2  0.3424      0.800 0.000 0.812 0.096 0.092 0.000 0.000
#> SRR1377195     5  0.0000      0.915 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR1377196     5  0.0000      0.915 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR1377197     5  0.0000      0.915 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR1377198     5  0.3250      0.873 0.028 0.000 0.012 0.028 0.856 0.076
#> SRR1377199     5  0.2344      0.888 0.000 0.000 0.004 0.028 0.892 0.076
#> SRR1377200     5  0.4953      0.726 0.268 0.000 0.000 0.000 0.624 0.108
#> SRR1377201     2  0.0000      0.893 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR1377202     2  0.0000      0.893 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR1377203     2  0.0000      0.893 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR1377204     2  0.0458      0.875 0.000 0.984 0.000 0.016 0.000 0.000
#> SRR1377205     2  0.0458      0.875 0.000 0.984 0.000 0.016 0.000 0.000
#> SRR1377206     2  0.0458      0.875 0.000 0.984 0.000 0.016 0.000 0.000
#> SRR1377207     2  0.0000      0.893 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR1377208     2  0.0000      0.893 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR1377209     2  0.0000      0.893 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR1377210     2  0.0000      0.893 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR1377211     2  0.0000      0.893 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR1377212     2  0.0000      0.893 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR1377213     4  0.4582      0.845 0.000 0.216 0.100 0.684 0.000 0.000
#> SRR1377214     4  0.4582      0.845 0.000 0.216 0.100 0.684 0.000 0.000
#> SRR1377215     4  0.4582      0.845 0.000 0.216 0.100 0.684 0.000 0.000
#> SRR1377216     4  0.4582      0.845 0.000 0.216 0.100 0.684 0.000 0.000
#> SRR1377217     4  0.4582      0.845 0.000 0.216 0.100 0.684 0.000 0.000
#> SRR1377218     4  0.4582      0.845 0.000 0.216 0.100 0.684 0.000 0.000
#> SRR1377219     4  0.4582      0.845 0.000 0.216 0.100 0.684 0.000 0.000
#> SRR1377220     4  0.4582      0.845 0.000 0.216 0.100 0.684 0.000 0.000
#> SRR1377221     4  0.4582      0.845 0.000 0.216 0.100 0.684 0.000 0.000
#> SRR1377222     4  0.1267      0.519 0.000 0.060 0.000 0.940 0.000 0.000
#> SRR1377223     4  0.1267      0.519 0.000 0.060 0.000 0.940 0.000 0.000
#> SRR1377224     4  0.1267      0.519 0.000 0.060 0.000 0.940 0.000 0.000

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

consensus_heatmap(res, k = 2)

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

consensus_heatmap(res, k = 3)

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

consensus_heatmap(res, k = 4)

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

consensus_heatmap(res, k = 5)

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

consensus_heatmap(res, k = 6)

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

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

membership_heatmap(res, k = 2)

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

membership_heatmap(res, k = 3)

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

membership_heatmap(res, k = 4)

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

membership_heatmap(res, k = 5)

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

membership_heatmap(res, k = 6)

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

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

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

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

get_signatures(res, k = 3)

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

get_signatures(res, k = 4)

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

get_signatures(res, k = 5)

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

get_signatures(res, k = 6)

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

Signature heatmaps where rows are not scaled:

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

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

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

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

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

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

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

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

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

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

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk CV-hclust-signature_compare

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

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

An example of the output of tb is:

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

The columns in tb are:

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

UMAP plot which shows how samples are separated.

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

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

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

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

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

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

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

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

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

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

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk CV-hclust-collect-classes

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


CV:kmeans

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

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

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

res
#> A 'ConsensusPartition' object with k = 2, 3, 4, 5, 6.
#>   On a matrix with 13890 rows and 80 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 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-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.277           0.752       0.838         0.2555 0.859   0.859
#> 3 3 0.204           0.698       0.771         0.8210 0.706   0.658
#> 4 4 0.323           0.711       0.727         0.3095 0.825   0.691
#> 5 5 0.468           0.773       0.739         0.1617 0.871   0.670
#> 6 6 0.631           0.750       0.728         0.0657 0.841   0.517

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
#> SRR1377145     2   0.850      0.653 0.276 0.724
#> SRR1377146     2   0.850      0.653 0.276 0.724
#> SRR1377147     2   0.850      0.653 0.276 0.724
#> SRR1377148     2   0.850      0.653 0.276 0.724
#> SRR1377153     2   0.671      0.657 0.176 0.824
#> SRR1377154     2   0.671      0.657 0.176 0.824
#> SRR1377155     2   0.671      0.657 0.176 0.824
#> SRR1377156     2   0.671      0.657 0.176 0.824
#> SRR1377149     2   0.671      0.657 0.176 0.824
#> SRR1377150     2   0.671      0.657 0.176 0.824
#> SRR1377151     2   0.671      0.657 0.176 0.824
#> SRR1377152     2   0.671      0.657 0.176 0.824
#> SRR1377157     2   0.861      0.680 0.284 0.716
#> SRR1377158     2   0.861      0.680 0.284 0.716
#> SRR1377159     2   0.861      0.680 0.284 0.716
#> SRR1377160     2   0.861      0.680 0.284 0.716
#> SRR1377161     2   0.861      0.680 0.284 0.716
#> SRR1377162     2   0.861      0.680 0.284 0.716
#> SRR1377163     2   0.861      0.680 0.284 0.716
#> SRR1377164     2   0.861      0.680 0.284 0.716
#> SRR1377169     2   0.861      0.680 0.284 0.716
#> SRR1377170     2   0.861      0.680 0.284 0.716
#> SRR1377171     2   0.861      0.680 0.284 0.716
#> SRR1377172     2   0.861      0.680 0.284 0.716
#> SRR1377165     2   0.861      0.680 0.284 0.716
#> SRR1377166     2   0.861      0.680 0.284 0.716
#> SRR1377167     2   0.861      0.680 0.284 0.716
#> SRR1377168     2   0.861      0.680 0.284 0.716
#> SRR1377173     2   0.118      0.783 0.016 0.984
#> SRR1377174     2   0.118      0.783 0.016 0.984
#> SRR1377175     2   0.118      0.783 0.016 0.984
#> SRR1377176     2   0.118      0.783 0.016 0.984
#> SRR1377177     2   0.118      0.783 0.016 0.984
#> SRR1377178     2   0.118      0.783 0.016 0.984
#> SRR1377179     2   0.118      0.783 0.016 0.984
#> SRR1377180     2   0.118      0.783 0.016 0.984
#> SRR1377181     2   0.204      0.785 0.032 0.968
#> SRR1377182     2   0.204      0.785 0.032 0.968
#> SRR1377183     2   0.163      0.784 0.024 0.976
#> SRR1377184     2   0.204      0.785 0.032 0.968
#> SRR1377185     2   0.163      0.784 0.024 0.976
#> SRR1377186     2   0.163      0.784 0.024 0.976
#> SRR1377187     2   0.204      0.785 0.032 0.968
#> SRR1377188     2   0.163      0.784 0.024 0.976
#> SRR1377189     2   0.204      0.775 0.032 0.968
#> SRR1377190     2   0.204      0.775 0.032 0.968
#> SRR1377191     2   0.204      0.775 0.032 0.968
#> SRR1377192     2   0.204      0.775 0.032 0.968
#> SRR1377193     2   0.204      0.775 0.032 0.968
#> SRR1377194     2   0.204      0.775 0.032 0.968
#> SRR1377195     1   0.983      1.000 0.576 0.424
#> SRR1377196     1   0.983      1.000 0.576 0.424
#> SRR1377197     1   0.983      1.000 0.576 0.424
#> SRR1377198     1   0.983      1.000 0.576 0.424
#> SRR1377199     1   0.983      1.000 0.576 0.424
#> SRR1377200     1   0.983      1.000 0.576 0.424
#> SRR1377201     2   0.260      0.768 0.044 0.956
#> SRR1377202     2   0.260      0.768 0.044 0.956
#> SRR1377203     2   0.260      0.768 0.044 0.956
#> SRR1377204     2   0.260      0.768 0.044 0.956
#> SRR1377205     2   0.260      0.768 0.044 0.956
#> SRR1377206     2   0.260      0.768 0.044 0.956
#> SRR1377207     2   0.260      0.768 0.044 0.956
#> SRR1377208     2   0.260      0.768 0.044 0.956
#> SRR1377209     2   0.260      0.768 0.044 0.956
#> SRR1377210     2   0.204      0.775 0.032 0.968
#> SRR1377211     2   0.204      0.775 0.032 0.968
#> SRR1377212     2   0.204      0.775 0.032 0.968
#> SRR1377213     2   0.722      0.740 0.200 0.800
#> SRR1377214     2   0.722      0.740 0.200 0.800
#> SRR1377215     2   0.722      0.740 0.200 0.800
#> SRR1377216     2   0.722      0.740 0.200 0.800
#> SRR1377217     2   0.722      0.740 0.200 0.800
#> SRR1377218     2   0.722      0.740 0.200 0.800
#> SRR1377219     2   0.722      0.740 0.200 0.800
#> SRR1377220     2   0.722      0.740 0.200 0.800
#> SRR1377221     2   0.722      0.740 0.200 0.800
#> SRR1377222     2   0.541      0.767 0.124 0.876
#> SRR1377223     2   0.541      0.767 0.124 0.876
#> SRR1377224     2   0.541      0.767 0.124 0.876

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>            class entropy silhouette    p1    p2    p3
#> SRR1377145     2  0.8703      0.409 0.160 0.584 0.256
#> SRR1377146     2  0.8703      0.409 0.160 0.584 0.256
#> SRR1377147     2  0.8703      0.409 0.160 0.584 0.256
#> SRR1377148     2  0.8703      0.409 0.160 0.584 0.256
#> SRR1377153     2  0.8544      0.414 0.152 0.600 0.248
#> SRR1377154     2  0.8544      0.414 0.152 0.600 0.248
#> SRR1377155     2  0.8544      0.414 0.152 0.600 0.248
#> SRR1377156     2  0.8544      0.414 0.152 0.600 0.248
#> SRR1377149     2  0.8561      0.414 0.156 0.600 0.244
#> SRR1377150     2  0.8561      0.414 0.156 0.600 0.244
#> SRR1377151     2  0.8561      0.414 0.156 0.600 0.244
#> SRR1377152     2  0.8561      0.414 0.156 0.600 0.244
#> SRR1377157     3  0.6047      0.994 0.008 0.312 0.680
#> SRR1377158     3  0.6047      0.994 0.008 0.312 0.680
#> SRR1377159     3  0.6047      0.994 0.008 0.312 0.680
#> SRR1377160     3  0.6047      0.994 0.008 0.312 0.680
#> SRR1377161     3  0.5650      0.997 0.000 0.312 0.688
#> SRR1377162     3  0.5650      0.997 0.000 0.312 0.688
#> SRR1377163     3  0.5650      0.997 0.000 0.312 0.688
#> SRR1377164     3  0.5650      0.997 0.000 0.312 0.688
#> SRR1377169     3  0.5873      0.996 0.004 0.312 0.684
#> SRR1377170     3  0.5873      0.996 0.004 0.312 0.684
#> SRR1377171     3  0.5873      0.996 0.004 0.312 0.684
#> SRR1377172     3  0.5873      0.996 0.004 0.312 0.684
#> SRR1377165     3  0.5650      0.997 0.000 0.312 0.688
#> SRR1377166     3  0.5650      0.997 0.000 0.312 0.688
#> SRR1377167     3  0.5650      0.997 0.000 0.312 0.688
#> SRR1377168     3  0.5650      0.997 0.000 0.312 0.688
#> SRR1377173     2  0.5295      0.663 0.036 0.808 0.156
#> SRR1377174     2  0.5295      0.663 0.036 0.808 0.156
#> SRR1377175     2  0.5295      0.663 0.036 0.808 0.156
#> SRR1377176     2  0.5295      0.663 0.036 0.808 0.156
#> SRR1377177     2  0.5295      0.663 0.036 0.808 0.156
#> SRR1377178     2  0.5295      0.663 0.036 0.808 0.156
#> SRR1377179     2  0.5295      0.663 0.036 0.808 0.156
#> SRR1377180     2  0.5295      0.663 0.036 0.808 0.156
#> SRR1377181     2  0.6297      0.630 0.060 0.756 0.184
#> SRR1377182     2  0.6297      0.630 0.060 0.756 0.184
#> SRR1377183     2  0.5295      0.663 0.036 0.808 0.156
#> SRR1377184     2  0.6297      0.630 0.060 0.756 0.184
#> SRR1377185     2  0.5295      0.663 0.036 0.808 0.156
#> SRR1377186     2  0.5295      0.663 0.036 0.808 0.156
#> SRR1377187     2  0.6297      0.630 0.060 0.756 0.184
#> SRR1377188     2  0.5295      0.663 0.036 0.808 0.156
#> SRR1377189     2  0.0475      0.710 0.004 0.992 0.004
#> SRR1377190     2  0.0475      0.710 0.004 0.992 0.004
#> SRR1377191     2  0.0475      0.710 0.004 0.992 0.004
#> SRR1377192     2  0.0661      0.711 0.004 0.988 0.008
#> SRR1377193     2  0.0661      0.711 0.004 0.988 0.008
#> SRR1377194     2  0.0661      0.711 0.004 0.988 0.008
#> SRR1377195     1  0.5254      0.999 0.736 0.264 0.000
#> SRR1377196     1  0.5254      0.999 0.736 0.264 0.000
#> SRR1377197     1  0.5254      0.999 0.736 0.264 0.000
#> SRR1377198     1  0.5812      0.994 0.724 0.264 0.012
#> SRR1377199     1  0.5254      0.999 0.736 0.264 0.000
#> SRR1377200     1  0.5254      0.999 0.736 0.264 0.000
#> SRR1377201     2  0.0747      0.711 0.016 0.984 0.000
#> SRR1377202     2  0.0747      0.711 0.016 0.984 0.000
#> SRR1377203     2  0.0747      0.711 0.016 0.984 0.000
#> SRR1377204     2  0.1774      0.706 0.016 0.960 0.024
#> SRR1377205     2  0.1774      0.706 0.016 0.960 0.024
#> SRR1377206     2  0.1774      0.706 0.016 0.960 0.024
#> SRR1377207     2  0.0747      0.711 0.016 0.984 0.000
#> SRR1377208     2  0.0747      0.711 0.016 0.984 0.000
#> SRR1377209     2  0.0747      0.711 0.016 0.984 0.000
#> SRR1377210     2  0.0237      0.711 0.004 0.996 0.000
#> SRR1377211     2  0.0237      0.711 0.004 0.996 0.000
#> SRR1377212     2  0.0237      0.711 0.004 0.996 0.000
#> SRR1377213     2  0.6796      0.467 0.056 0.708 0.236
#> SRR1377214     2  0.6796      0.467 0.056 0.708 0.236
#> SRR1377215     2  0.6796      0.467 0.056 0.708 0.236
#> SRR1377216     2  0.7057      0.413 0.056 0.680 0.264
#> SRR1377217     2  0.7057      0.413 0.056 0.680 0.264
#> SRR1377218     2  0.7057      0.413 0.056 0.680 0.264
#> SRR1377219     2  0.6875      0.448 0.056 0.700 0.244
#> SRR1377220     2  0.6875      0.448 0.056 0.700 0.244
#> SRR1377221     2  0.6875      0.448 0.056 0.700 0.244
#> SRR1377222     2  0.5757      0.581 0.056 0.792 0.152
#> SRR1377223     2  0.5757      0.581 0.056 0.792 0.152
#> SRR1377224     2  0.5757      0.581 0.056 0.792 0.152

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> SRR1377145     4   0.603      0.964 0.012 0.412 0.024 0.552
#> SRR1377146     4   0.603      0.964 0.012 0.412 0.024 0.552
#> SRR1377147     4   0.603      0.964 0.012 0.412 0.024 0.552
#> SRR1377148     4   0.603      0.964 0.012 0.412 0.024 0.552
#> SRR1377153     4   0.597      0.969 0.016 0.424 0.016 0.544
#> SRR1377154     4   0.597      0.969 0.016 0.424 0.016 0.544
#> SRR1377155     4   0.597      0.969 0.016 0.424 0.016 0.544
#> SRR1377156     4   0.597      0.969 0.016 0.424 0.016 0.544
#> SRR1377149     4   0.605      0.968 0.024 0.424 0.012 0.540
#> SRR1377150     4   0.605      0.968 0.024 0.424 0.012 0.540
#> SRR1377151     4   0.605      0.968 0.024 0.424 0.012 0.540
#> SRR1377152     4   0.605      0.968 0.024 0.424 0.012 0.540
#> SRR1377157     3   0.411      0.969 0.016 0.120 0.836 0.028
#> SRR1377158     3   0.411      0.969 0.016 0.120 0.836 0.028
#> SRR1377159     3   0.411      0.969 0.016 0.120 0.836 0.028
#> SRR1377160     3   0.411      0.969 0.016 0.120 0.836 0.028
#> SRR1377161     3   0.341      0.978 0.016 0.120 0.860 0.004
#> SRR1377162     3   0.341      0.978 0.016 0.120 0.860 0.004
#> SRR1377163     3   0.341      0.978 0.016 0.120 0.860 0.004
#> SRR1377164     3   0.341      0.978 0.016 0.120 0.860 0.004
#> SRR1377169     3   0.356      0.975 0.012 0.120 0.856 0.012
#> SRR1377170     3   0.356      0.975 0.012 0.120 0.856 0.012
#> SRR1377171     3   0.356      0.975 0.012 0.120 0.856 0.012
#> SRR1377172     3   0.356      0.975 0.012 0.120 0.856 0.012
#> SRR1377165     3   0.265      0.980 0.000 0.120 0.880 0.000
#> SRR1377166     3   0.265      0.980 0.000 0.120 0.880 0.000
#> SRR1377167     3   0.265      0.980 0.000 0.120 0.880 0.000
#> SRR1377168     3   0.265      0.980 0.000 0.120 0.880 0.000
#> SRR1377173     2   0.581      0.563 0.016 0.716 0.064 0.204
#> SRR1377174     2   0.581      0.563 0.016 0.716 0.064 0.204
#> SRR1377175     2   0.581      0.563 0.016 0.716 0.064 0.204
#> SRR1377176     2   0.581      0.563 0.016 0.716 0.064 0.204
#> SRR1377177     2   0.573      0.563 0.012 0.716 0.064 0.208
#> SRR1377178     2   0.573      0.563 0.012 0.716 0.064 0.208
#> SRR1377179     2   0.573      0.563 0.012 0.716 0.064 0.208
#> SRR1377180     2   0.573      0.563 0.012 0.716 0.064 0.208
#> SRR1377181     2   0.695      0.514 0.040 0.636 0.080 0.244
#> SRR1377182     2   0.695      0.514 0.040 0.636 0.080 0.244
#> SRR1377183     2   0.580      0.563 0.012 0.708 0.064 0.216
#> SRR1377184     2   0.695      0.514 0.040 0.636 0.080 0.244
#> SRR1377185     2   0.580      0.563 0.012 0.708 0.064 0.216
#> SRR1377186     2   0.580      0.563 0.012 0.708 0.064 0.216
#> SRR1377187     2   0.695      0.514 0.040 0.636 0.080 0.244
#> SRR1377188     2   0.580      0.563 0.012 0.708 0.064 0.216
#> SRR1377189     2   0.212      0.573 0.004 0.936 0.032 0.028
#> SRR1377190     2   0.212      0.573 0.004 0.936 0.032 0.028
#> SRR1377191     2   0.212      0.573 0.004 0.936 0.032 0.028
#> SRR1377192     2   0.212      0.573 0.004 0.936 0.032 0.028
#> SRR1377193     2   0.212      0.573 0.004 0.936 0.032 0.028
#> SRR1377194     2   0.212      0.573 0.004 0.936 0.032 0.028
#> SRR1377195     1   0.419      0.996 0.780 0.208 0.008 0.004
#> SRR1377196     1   0.419      0.996 0.780 0.208 0.008 0.004
#> SRR1377197     1   0.419      0.996 0.780 0.208 0.008 0.004
#> SRR1377198     1   0.446      0.994 0.772 0.208 0.012 0.008
#> SRR1377199     1   0.458      0.992 0.768 0.208 0.012 0.012
#> SRR1377200     1   0.457      0.992 0.768 0.208 0.008 0.016
#> SRR1377201     2   0.177      0.574 0.012 0.948 0.036 0.004
#> SRR1377202     2   0.177      0.574 0.012 0.948 0.036 0.004
#> SRR1377203     2   0.177      0.574 0.012 0.948 0.036 0.004
#> SRR1377204     2   0.356      0.527 0.016 0.872 0.084 0.028
#> SRR1377205     2   0.356      0.527 0.016 0.872 0.084 0.028
#> SRR1377206     2   0.356      0.527 0.016 0.872 0.084 0.028
#> SRR1377207     2   0.177      0.574 0.012 0.948 0.036 0.004
#> SRR1377208     2   0.177      0.574 0.012 0.948 0.036 0.004
#> SRR1377209     2   0.177      0.574 0.012 0.948 0.036 0.004
#> SRR1377210     2   0.121      0.576 0.000 0.960 0.040 0.000
#> SRR1377211     2   0.121      0.576 0.000 0.960 0.040 0.000
#> SRR1377212     2   0.121      0.576 0.000 0.960 0.040 0.000
#> SRR1377213     2   0.884      0.389 0.096 0.464 0.288 0.152
#> SRR1377214     2   0.884      0.389 0.096 0.464 0.288 0.152
#> SRR1377215     2   0.884      0.389 0.096 0.464 0.288 0.152
#> SRR1377216     2   0.880      0.384 0.096 0.472 0.284 0.148
#> SRR1377217     2   0.880      0.384 0.096 0.472 0.284 0.148
#> SRR1377218     2   0.880      0.384 0.096 0.472 0.284 0.148
#> SRR1377219     2   0.883      0.386 0.096 0.468 0.284 0.152
#> SRR1377220     2   0.883      0.386 0.096 0.468 0.284 0.152
#> SRR1377221     2   0.883      0.386 0.096 0.468 0.284 0.152
#> SRR1377222     2   0.826      0.409 0.096 0.568 0.180 0.156
#> SRR1377223     2   0.826      0.409 0.096 0.568 0.180 0.156
#> SRR1377224     2   0.826      0.409 0.096 0.568 0.180 0.156

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>            class entropy silhouette    p1    p2    p3    p4    p5
#> SRR1377145     2  0.5745      0.935 0.164 0.692 0.024 0.112 0.008
#> SRR1377146     2  0.5745      0.935 0.164 0.692 0.024 0.112 0.008
#> SRR1377147     2  0.5745      0.935 0.164 0.692 0.024 0.112 0.008
#> SRR1377148     2  0.5745      0.935 0.164 0.692 0.024 0.112 0.008
#> SRR1377153     2  0.5347      0.940 0.164 0.724 0.024 0.080 0.008
#> SRR1377154     2  0.5347      0.940 0.164 0.724 0.024 0.080 0.008
#> SRR1377155     2  0.5347      0.940 0.164 0.724 0.024 0.080 0.008
#> SRR1377156     2  0.5347      0.940 0.164 0.724 0.024 0.080 0.008
#> SRR1377149     2  0.6049      0.935 0.164 0.688 0.028 0.092 0.028
#> SRR1377150     2  0.6049      0.935 0.164 0.688 0.028 0.092 0.028
#> SRR1377151     2  0.6049      0.935 0.164 0.688 0.028 0.092 0.028
#> SRR1377152     2  0.6049      0.935 0.164 0.688 0.028 0.092 0.028
#> SRR1377157     3  0.3006      0.930 0.008 0.056 0.888 0.028 0.020
#> SRR1377158     3  0.3006      0.930 0.008 0.056 0.888 0.028 0.020
#> SRR1377159     3  0.3006      0.930 0.008 0.056 0.888 0.028 0.020
#> SRR1377160     3  0.3006      0.930 0.008 0.056 0.888 0.028 0.020
#> SRR1377161     3  0.1441      0.957 0.008 0.024 0.956 0.004 0.008
#> SRR1377162     3  0.1441      0.957 0.008 0.024 0.956 0.004 0.008
#> SRR1377163     3  0.1441      0.957 0.008 0.024 0.956 0.004 0.008
#> SRR1377164     3  0.1441      0.957 0.008 0.024 0.956 0.004 0.008
#> SRR1377169     3  0.1473      0.955 0.008 0.008 0.956 0.020 0.008
#> SRR1377170     3  0.1473      0.955 0.008 0.008 0.956 0.020 0.008
#> SRR1377171     3  0.1473      0.955 0.008 0.008 0.956 0.020 0.008
#> SRR1377172     3  0.1473      0.955 0.008 0.008 0.956 0.020 0.008
#> SRR1377165     3  0.0451      0.961 0.008 0.000 0.988 0.000 0.004
#> SRR1377166     3  0.0451      0.961 0.008 0.000 0.988 0.000 0.004
#> SRR1377167     3  0.0451      0.961 0.008 0.000 0.988 0.000 0.004
#> SRR1377168     3  0.0451      0.961 0.008 0.000 0.988 0.000 0.004
#> SRR1377173     1  0.2032      0.597 0.924 0.020 0.052 0.004 0.000
#> SRR1377174     1  0.2032      0.597 0.924 0.020 0.052 0.004 0.000
#> SRR1377175     1  0.2032      0.597 0.924 0.020 0.052 0.004 0.000
#> SRR1377176     1  0.2032      0.597 0.924 0.020 0.052 0.004 0.000
#> SRR1377177     1  0.1502      0.597 0.940 0.004 0.056 0.000 0.000
#> SRR1377178     1  0.1502      0.597 0.940 0.004 0.056 0.000 0.000
#> SRR1377179     1  0.1502      0.597 0.940 0.004 0.056 0.000 0.000
#> SRR1377180     1  0.1502      0.597 0.940 0.004 0.056 0.000 0.000
#> SRR1377181     1  0.4755      0.497 0.800 0.080 0.048 0.032 0.040
#> SRR1377182     1  0.4755      0.497 0.800 0.080 0.048 0.032 0.040
#> SRR1377183     1  0.1901      0.593 0.928 0.004 0.056 0.012 0.000
#> SRR1377184     1  0.4755      0.497 0.800 0.080 0.048 0.032 0.040
#> SRR1377185     1  0.1901      0.593 0.928 0.004 0.056 0.012 0.000
#> SRR1377186     1  0.1901      0.593 0.928 0.004 0.056 0.012 0.000
#> SRR1377187     1  0.4755      0.497 0.800 0.080 0.048 0.032 0.040
#> SRR1377188     1  0.1901      0.593 0.928 0.004 0.056 0.012 0.000
#> SRR1377189     1  0.7626      0.472 0.472 0.144 0.036 0.316 0.032
#> SRR1377190     1  0.7626      0.472 0.472 0.144 0.036 0.316 0.032
#> SRR1377191     1  0.7626      0.472 0.472 0.144 0.036 0.316 0.032
#> SRR1377192     1  0.7626      0.472 0.472 0.144 0.036 0.316 0.032
#> SRR1377193     1  0.7626      0.472 0.472 0.144 0.036 0.316 0.032
#> SRR1377194     1  0.7626      0.472 0.472 0.144 0.036 0.316 0.032
#> SRR1377195     5  0.3332      0.998 0.120 0.028 0.000 0.008 0.844
#> SRR1377196     5  0.3332      0.998 0.120 0.028 0.000 0.008 0.844
#> SRR1377197     5  0.3332      0.998 0.120 0.028 0.000 0.008 0.844
#> SRR1377198     5  0.3544      0.995 0.120 0.028 0.000 0.016 0.836
#> SRR1377199     5  0.3415      0.997 0.120 0.032 0.000 0.008 0.840
#> SRR1377200     5  0.3415      0.997 0.120 0.032 0.000 0.008 0.840
#> SRR1377201     1  0.7525      0.578 0.556 0.128 0.036 0.220 0.060
#> SRR1377202     1  0.7525      0.578 0.556 0.128 0.036 0.220 0.060
#> SRR1377203     1  0.7525      0.578 0.556 0.128 0.036 0.220 0.060
#> SRR1377204     1  0.7654      0.523 0.496 0.132 0.024 0.288 0.060
#> SRR1377205     1  0.7654      0.523 0.496 0.132 0.024 0.288 0.060
#> SRR1377206     1  0.7654      0.523 0.496 0.132 0.024 0.288 0.060
#> SRR1377207     1  0.7525      0.578 0.556 0.128 0.036 0.220 0.060
#> SRR1377208     1  0.7525      0.578 0.556 0.128 0.036 0.220 0.060
#> SRR1377209     1  0.7525      0.578 0.556 0.128 0.036 0.220 0.060
#> SRR1377210     1  0.7365      0.569 0.552 0.144 0.036 0.232 0.036
#> SRR1377211     1  0.7365      0.569 0.552 0.144 0.036 0.232 0.036
#> SRR1377212     1  0.7365      0.569 0.552 0.144 0.036 0.232 0.036
#> SRR1377213     4  0.5460      0.930 0.140 0.012 0.160 0.688 0.000
#> SRR1377214     4  0.5460      0.930 0.140 0.012 0.160 0.688 0.000
#> SRR1377215     4  0.5460      0.930 0.140 0.012 0.160 0.688 0.000
#> SRR1377216     4  0.5560      0.923 0.136 0.012 0.176 0.676 0.000
#> SRR1377217     4  0.5560      0.923 0.136 0.012 0.176 0.676 0.000
#> SRR1377218     4  0.5560      0.923 0.136 0.012 0.176 0.676 0.000
#> SRR1377219     4  0.5609      0.930 0.136 0.012 0.164 0.684 0.004
#> SRR1377220     4  0.5609      0.930 0.136 0.012 0.164 0.684 0.004
#> SRR1377221     4  0.5609      0.930 0.136 0.012 0.164 0.684 0.004
#> SRR1377222     4  0.5644      0.791 0.168 0.044 0.052 0.716 0.020
#> SRR1377223     4  0.5644      0.791 0.168 0.044 0.052 0.716 0.020
#> SRR1377224     4  0.5644      0.791 0.168 0.044 0.052 0.716 0.020

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>            class entropy silhouette    p1    p2    p3 p4    p5    p6
#> SRR1377145     6   0.391      0.919 0.048 0.044 0.012 NA 0.004 0.824
#> SRR1377146     6   0.391      0.919 0.048 0.044 0.012 NA 0.004 0.824
#> SRR1377147     6   0.391      0.919 0.048 0.044 0.012 NA 0.004 0.824
#> SRR1377148     6   0.391      0.919 0.048 0.044 0.012 NA 0.004 0.824
#> SRR1377153     6   0.348      0.920 0.028 0.036 0.012 NA 0.004 0.848
#> SRR1377154     6   0.348      0.920 0.028 0.036 0.012 NA 0.004 0.848
#> SRR1377155     6   0.348      0.920 0.028 0.036 0.012 NA 0.004 0.848
#> SRR1377156     6   0.348      0.920 0.028 0.036 0.012 NA 0.004 0.848
#> SRR1377149     6   0.346      0.925 0.040 0.040 0.016 NA 0.016 0.860
#> SRR1377150     6   0.342      0.925 0.044 0.040 0.012 NA 0.012 0.860
#> SRR1377151     6   0.342      0.925 0.044 0.040 0.012 NA 0.012 0.860
#> SRR1377152     6   0.343      0.925 0.044 0.040 0.012 NA 0.016 0.860
#> SRR1377157     3   0.307      0.857 0.000 0.008 0.788 NA 0.000 0.000
#> SRR1377158     3   0.318      0.857 0.000 0.008 0.788 NA 0.000 0.004
#> SRR1377159     3   0.318      0.857 0.000 0.008 0.788 NA 0.000 0.004
#> SRR1377160     3   0.318      0.857 0.000 0.008 0.788 NA 0.000 0.004
#> SRR1377161     3   0.186      0.924 0.000 0.012 0.932 NA 0.008 0.016
#> SRR1377162     3   0.186      0.924 0.000 0.012 0.932 NA 0.008 0.016
#> SRR1377163     3   0.186      0.924 0.000 0.012 0.932 NA 0.008 0.016
#> SRR1377164     3   0.186      0.924 0.000 0.012 0.932 NA 0.008 0.016
#> SRR1377169     3   0.206      0.916 0.012 0.008 0.924 NA 0.012 0.004
#> SRR1377170     3   0.206      0.916 0.012 0.008 0.924 NA 0.012 0.004
#> SRR1377171     3   0.206      0.916 0.012 0.008 0.924 NA 0.012 0.004
#> SRR1377172     3   0.206      0.916 0.012 0.008 0.924 NA 0.012 0.004
#> SRR1377165     3   0.026      0.928 0.000 0.008 0.992 NA 0.000 0.000
#> SRR1377166     3   0.026      0.928 0.000 0.008 0.992 NA 0.000 0.000
#> SRR1377167     3   0.026      0.928 0.000 0.008 0.992 NA 0.000 0.000
#> SRR1377168     3   0.026      0.928 0.000 0.008 0.992 NA 0.000 0.000
#> SRR1377173     1   0.412      0.886 0.808 0.084 0.028 NA 0.000 0.044
#> SRR1377174     1   0.412      0.886 0.808 0.084 0.028 NA 0.000 0.044
#> SRR1377175     1   0.412      0.886 0.808 0.084 0.028 NA 0.000 0.044
#> SRR1377176     1   0.412      0.886 0.808 0.084 0.028 NA 0.000 0.044
#> SRR1377177     1   0.343      0.893 0.840 0.084 0.028 NA 0.004 0.044
#> SRR1377178     1   0.343      0.893 0.840 0.084 0.028 NA 0.004 0.044
#> SRR1377179     1   0.343      0.893 0.840 0.084 0.028 NA 0.004 0.044
#> SRR1377180     1   0.343      0.893 0.840 0.084 0.028 NA 0.004 0.044
#> SRR1377181     1   0.447      0.733 0.756 0.048 0.024 NA 0.004 0.008
#> SRR1377182     1   0.465      0.733 0.748 0.048 0.024 NA 0.004 0.016
#> SRR1377183     1   0.386      0.890 0.820 0.088 0.028 NA 0.000 0.044
#> SRR1377184     1   0.447      0.733 0.756 0.048 0.024 NA 0.004 0.008
#> SRR1377185     1   0.386      0.890 0.820 0.088 0.028 NA 0.000 0.044
#> SRR1377186     1   0.386      0.890 0.820 0.088 0.028 NA 0.000 0.044
#> SRR1377187     1   0.449      0.733 0.756 0.052 0.024 NA 0.004 0.008
#> SRR1377188     1   0.386      0.890 0.820 0.088 0.028 NA 0.000 0.044
#> SRR1377189     2   0.772      0.535 0.248 0.420 0.008 NA 0.016 0.188
#> SRR1377190     2   0.772      0.535 0.248 0.420 0.008 NA 0.016 0.188
#> SRR1377191     2   0.772      0.535 0.248 0.420 0.008 NA 0.016 0.188
#> SRR1377192     2   0.772      0.535 0.248 0.420 0.008 NA 0.016 0.188
#> SRR1377193     2   0.772      0.535 0.248 0.420 0.008 NA 0.016 0.188
#> SRR1377194     2   0.772      0.535 0.248 0.420 0.008 NA 0.016 0.188
#> SRR1377195     5   0.148      0.987 0.036 0.008 0.000 NA 0.944 0.012
#> SRR1377196     5   0.148      0.987 0.036 0.008 0.000 NA 0.944 0.012
#> SRR1377197     5   0.148      0.987 0.036 0.008 0.000 NA 0.944 0.012
#> SRR1377198     5   0.201      0.983 0.040 0.008 0.000 NA 0.924 0.016
#> SRR1377199     5   0.245      0.975 0.036 0.008 0.000 NA 0.904 0.024
#> SRR1377200     5   0.258      0.973 0.040 0.012 0.004 NA 0.900 0.012
#> SRR1377201     2   0.800      0.518 0.276 0.388 0.012 NA 0.024 0.164
#> SRR1377202     2   0.800      0.518 0.276 0.388 0.012 NA 0.024 0.164
#> SRR1377203     2   0.800      0.518 0.276 0.388 0.012 NA 0.024 0.164
#> SRR1377204     2   0.776      0.519 0.228 0.412 0.000 NA 0.024 0.152
#> SRR1377205     2   0.776      0.519 0.228 0.412 0.000 NA 0.024 0.152
#> SRR1377206     2   0.776      0.519 0.228 0.412 0.000 NA 0.024 0.152
#> SRR1377207     2   0.802      0.518 0.276 0.384 0.012 NA 0.024 0.164
#> SRR1377208     2   0.802      0.518 0.276 0.384 0.012 NA 0.024 0.164
#> SRR1377209     2   0.802      0.518 0.276 0.384 0.012 NA 0.024 0.164
#> SRR1377210     2   0.790      0.514 0.284 0.384 0.012 NA 0.016 0.168
#> SRR1377211     2   0.790      0.514 0.284 0.384 0.012 NA 0.016 0.168
#> SRR1377212     2   0.790      0.514 0.284 0.384 0.012 NA 0.016 0.168
#> SRR1377213     2   0.319      0.474 0.056 0.844 0.088 NA 0.000 0.012
#> SRR1377214     2   0.319      0.474 0.056 0.844 0.088 NA 0.000 0.012
#> SRR1377215     2   0.319      0.474 0.056 0.844 0.088 NA 0.000 0.012
#> SRR1377216     2   0.363      0.463 0.060 0.816 0.108 NA 0.000 0.012
#> SRR1377217     2   0.363      0.463 0.060 0.816 0.108 NA 0.000 0.012
#> SRR1377218     2   0.363      0.463 0.060 0.816 0.108 NA 0.000 0.012
#> SRR1377219     2   0.319      0.474 0.056 0.844 0.088 NA 0.000 0.012
#> SRR1377220     2   0.319      0.474 0.056 0.844 0.088 NA 0.000 0.012
#> SRR1377221     2   0.319      0.474 0.056 0.844 0.088 NA 0.000 0.012
#> SRR1377222     2   0.411      0.444 0.028 0.804 0.036 NA 0.004 0.020
#> SRR1377223     2   0.411      0.444 0.028 0.804 0.036 NA 0.004 0.020
#> SRR1377224     2   0.411      0.444 0.028 0.804 0.036 NA 0.004 0.020

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

consensus_heatmap(res, k = 2)

plot of chunk tab-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 13890 rows and 80 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.739           0.782       0.910         0.4810 0.502   0.502
#> 3 3 0.711           0.670       0.840         0.3759 0.795   0.613
#> 4 4 0.725           0.828       0.877         0.1185 0.894   0.706
#> 5 5 0.859           0.866       0.915         0.0808 0.882   0.592
#> 6 6 0.915           0.909       0.934         0.0396 0.932   0.684

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
#> SRR1377145     2  0.9393      0.323 0.356 0.644
#> SRR1377146     2  0.9393      0.323 0.356 0.644
#> SRR1377147     2  0.9393      0.323 0.356 0.644
#> SRR1377148     2  0.9393      0.323 0.356 0.644
#> SRR1377153     1  0.9944      0.289 0.544 0.456
#> SRR1377154     1  0.9954      0.279 0.540 0.460
#> SRR1377155     1  0.9944      0.289 0.544 0.456
#> SRR1377156     1  0.9944      0.289 0.544 0.456
#> SRR1377149     1  0.9993      0.212 0.516 0.484
#> SRR1377150     1  0.9988      0.224 0.520 0.480
#> SRR1377151     1  0.9993      0.212 0.516 0.484
#> SRR1377152     1  0.9993      0.212 0.516 0.484
#> SRR1377157     2  0.0000      0.937 0.000 1.000
#> SRR1377158     2  0.0000      0.937 0.000 1.000
#> SRR1377159     2  0.0000      0.937 0.000 1.000
#> SRR1377160     2  0.0000      0.937 0.000 1.000
#> SRR1377161     2  0.0000      0.937 0.000 1.000
#> SRR1377162     2  0.0000      0.937 0.000 1.000
#> SRR1377163     2  0.0000      0.937 0.000 1.000
#> SRR1377164     2  0.0000      0.937 0.000 1.000
#> SRR1377169     2  0.0000      0.937 0.000 1.000
#> SRR1377170     2  0.0000      0.937 0.000 1.000
#> SRR1377171     2  0.0000      0.937 0.000 1.000
#> SRR1377172     2  0.0000      0.937 0.000 1.000
#> SRR1377165     2  0.0000      0.937 0.000 1.000
#> SRR1377166     2  0.0000      0.937 0.000 1.000
#> SRR1377167     2  0.0000      0.937 0.000 1.000
#> SRR1377168     2  0.0000      0.937 0.000 1.000
#> SRR1377173     2  0.3431      0.910 0.064 0.936
#> SRR1377174     2  0.3431      0.910 0.064 0.936
#> SRR1377175     2  0.3274      0.912 0.060 0.940
#> SRR1377176     2  0.3274      0.913 0.060 0.940
#> SRR1377177     2  0.2948      0.918 0.052 0.948
#> SRR1377178     2  0.2948      0.918 0.052 0.948
#> SRR1377179     2  0.2948      0.918 0.052 0.948
#> SRR1377180     2  0.2948      0.918 0.052 0.948
#> SRR1377181     2  0.2423      0.925 0.040 0.960
#> SRR1377182     2  0.2423      0.925 0.040 0.960
#> SRR1377183     2  0.2423      0.925 0.040 0.960
#> SRR1377184     2  0.2423      0.925 0.040 0.960
#> SRR1377185     2  0.2423      0.925 0.040 0.960
#> SRR1377186     2  0.2423      0.925 0.040 0.960
#> SRR1377187     2  0.2423      0.925 0.040 0.960
#> SRR1377188     2  0.2423      0.925 0.040 0.960
#> SRR1377189     1  0.0376      0.834 0.996 0.004
#> SRR1377190     1  0.0376      0.834 0.996 0.004
#> SRR1377191     1  0.0376      0.834 0.996 0.004
#> SRR1377192     1  0.0376      0.834 0.996 0.004
#> SRR1377193     1  0.0376      0.834 0.996 0.004
#> SRR1377194     1  0.0376      0.834 0.996 0.004
#> SRR1377195     1  0.0000      0.836 1.000 0.000
#> SRR1377196     1  0.0000      0.836 1.000 0.000
#> SRR1377197     1  0.0000      0.836 1.000 0.000
#> SRR1377198     1  0.0000      0.836 1.000 0.000
#> SRR1377199     1  0.0000      0.836 1.000 0.000
#> SRR1377200     1  0.0000      0.836 1.000 0.000
#> SRR1377201     1  0.0000      0.836 1.000 0.000
#> SRR1377202     1  0.0000      0.836 1.000 0.000
#> SRR1377203     1  0.0000      0.836 1.000 0.000
#> SRR1377204     1  0.0000      0.836 1.000 0.000
#> SRR1377205     1  0.0000      0.836 1.000 0.000
#> SRR1377206     1  0.0000      0.836 1.000 0.000
#> SRR1377207     1  0.0000      0.836 1.000 0.000
#> SRR1377208     1  0.0000      0.836 1.000 0.000
#> SRR1377209     1  0.0000      0.836 1.000 0.000
#> SRR1377210     1  0.0000      0.836 1.000 0.000
#> SRR1377211     1  0.0000      0.836 1.000 0.000
#> SRR1377212     1  0.0000      0.836 1.000 0.000
#> SRR1377213     2  0.0000      0.937 0.000 1.000
#> SRR1377214     2  0.0000      0.937 0.000 1.000
#> SRR1377215     2  0.0000      0.937 0.000 1.000
#> SRR1377216     2  0.0000      0.937 0.000 1.000
#> SRR1377217     2  0.0000      0.937 0.000 1.000
#> SRR1377218     2  0.0000      0.937 0.000 1.000
#> SRR1377219     2  0.0000      0.937 0.000 1.000
#> SRR1377220     2  0.0000      0.937 0.000 1.000
#> SRR1377221     2  0.0000      0.937 0.000 1.000
#> SRR1377222     1  0.9732      0.371 0.596 0.404
#> SRR1377223     1  0.9732      0.371 0.596 0.404
#> SRR1377224     1  0.9732      0.371 0.596 0.404

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>            class entropy silhouette    p1    p2    p3
#> SRR1377145     3  0.9934    -0.0908 0.292 0.320 0.388
#> SRR1377146     3  0.9934    -0.0908 0.292 0.320 0.388
#> SRR1377147     3  0.9934    -0.0908 0.292 0.320 0.388
#> SRR1377148     3  0.9934    -0.0908 0.292 0.320 0.388
#> SRR1377153     2  0.9908     0.1927 0.360 0.372 0.268
#> SRR1377154     2  0.9908     0.1927 0.360 0.372 0.268
#> SRR1377155     2  0.9908     0.1927 0.360 0.372 0.268
#> SRR1377156     2  0.9908     0.1927 0.360 0.372 0.268
#> SRR1377149     2  0.9975     0.1895 0.312 0.368 0.320
#> SRR1377150     2  0.9975     0.1895 0.312 0.368 0.320
#> SRR1377151     2  0.9975     0.1895 0.312 0.368 0.320
#> SRR1377152     2  0.9975     0.1895 0.312 0.368 0.320
#> SRR1377157     3  0.1163     0.8308 0.028 0.000 0.972
#> SRR1377158     3  0.1163     0.8308 0.028 0.000 0.972
#> SRR1377159     3  0.1163     0.8308 0.028 0.000 0.972
#> SRR1377160     3  0.1163     0.8308 0.028 0.000 0.972
#> SRR1377161     3  0.1163     0.8308 0.028 0.000 0.972
#> SRR1377162     3  0.1163     0.8308 0.028 0.000 0.972
#> SRR1377163     3  0.1163     0.8308 0.028 0.000 0.972
#> SRR1377164     3  0.1163     0.8308 0.028 0.000 0.972
#> SRR1377169     3  0.1163     0.8308 0.028 0.000 0.972
#> SRR1377170     3  0.1163     0.8308 0.028 0.000 0.972
#> SRR1377171     3  0.1163     0.8308 0.028 0.000 0.972
#> SRR1377172     3  0.1163     0.8308 0.028 0.000 0.972
#> SRR1377165     3  0.1163     0.8308 0.028 0.000 0.972
#> SRR1377166     3  0.1163     0.8308 0.028 0.000 0.972
#> SRR1377167     3  0.1163     0.8308 0.028 0.000 0.972
#> SRR1377168     3  0.1163     0.8308 0.028 0.000 0.972
#> SRR1377173     1  0.0829     0.9924 0.984 0.004 0.012
#> SRR1377174     1  0.0829     0.9924 0.984 0.004 0.012
#> SRR1377175     1  0.0829     0.9924 0.984 0.004 0.012
#> SRR1377176     1  0.0829     0.9924 0.984 0.004 0.012
#> SRR1377177     1  0.0592     0.9951 0.988 0.000 0.012
#> SRR1377178     1  0.0592     0.9951 0.988 0.000 0.012
#> SRR1377179     1  0.0592     0.9951 0.988 0.000 0.012
#> SRR1377180     1  0.0592     0.9951 0.988 0.000 0.012
#> SRR1377181     1  0.0747     0.9954 0.984 0.000 0.016
#> SRR1377182     1  0.0747     0.9954 0.984 0.000 0.016
#> SRR1377183     1  0.0747     0.9954 0.984 0.000 0.016
#> SRR1377184     1  0.0747     0.9954 0.984 0.000 0.016
#> SRR1377185     1  0.0747     0.9954 0.984 0.000 0.016
#> SRR1377186     1  0.0747     0.9954 0.984 0.000 0.016
#> SRR1377187     1  0.0747     0.9954 0.984 0.000 0.016
#> SRR1377188     1  0.0747     0.9954 0.984 0.000 0.016
#> SRR1377189     2  0.1315     0.7230 0.008 0.972 0.020
#> SRR1377190     2  0.1170     0.7233 0.008 0.976 0.016
#> SRR1377191     2  0.1315     0.7230 0.008 0.972 0.020
#> SRR1377192     2  0.1170     0.7233 0.008 0.976 0.016
#> SRR1377193     2  0.1170     0.7233 0.008 0.976 0.016
#> SRR1377194     2  0.1170     0.7233 0.008 0.976 0.016
#> SRR1377195     2  0.5810     0.4371 0.336 0.664 0.000
#> SRR1377196     2  0.5810     0.4371 0.336 0.664 0.000
#> SRR1377197     2  0.5810     0.4371 0.336 0.664 0.000
#> SRR1377198     2  0.5810     0.4371 0.336 0.664 0.000
#> SRR1377199     2  0.5810     0.4371 0.336 0.664 0.000
#> SRR1377200     2  0.5810     0.4371 0.336 0.664 0.000
#> SRR1377201     2  0.0892     0.7241 0.020 0.980 0.000
#> SRR1377202     2  0.0892     0.7241 0.020 0.980 0.000
#> SRR1377203     2  0.0892     0.7241 0.020 0.980 0.000
#> SRR1377204     2  0.0892     0.7241 0.020 0.980 0.000
#> SRR1377205     2  0.0892     0.7241 0.020 0.980 0.000
#> SRR1377206     2  0.0892     0.7241 0.020 0.980 0.000
#> SRR1377207     2  0.0892     0.7241 0.020 0.980 0.000
#> SRR1377208     2  0.0892     0.7241 0.020 0.980 0.000
#> SRR1377209     2  0.0892     0.7241 0.020 0.980 0.000
#> SRR1377210     2  0.2680     0.7004 0.008 0.924 0.068
#> SRR1377211     2  0.2680     0.7004 0.008 0.924 0.068
#> SRR1377212     2  0.2680     0.7004 0.008 0.924 0.068
#> SRR1377213     3  0.2187     0.8137 0.024 0.028 0.948
#> SRR1377214     3  0.2187     0.8137 0.024 0.028 0.948
#> SRR1377215     3  0.2187     0.8137 0.024 0.028 0.948
#> SRR1377216     3  0.2187     0.8137 0.024 0.028 0.948
#> SRR1377217     3  0.2187     0.8137 0.024 0.028 0.948
#> SRR1377218     3  0.2187     0.8137 0.024 0.028 0.948
#> SRR1377219     3  0.2187     0.8137 0.024 0.028 0.948
#> SRR1377220     3  0.2187     0.8137 0.024 0.028 0.948
#> SRR1377221     3  0.2187     0.8137 0.024 0.028 0.948
#> SRR1377222     3  0.7187     0.1071 0.024 0.480 0.496
#> SRR1377223     3  0.7187     0.1071 0.024 0.480 0.496
#> SRR1377224     3  0.7187     0.1071 0.024 0.480 0.496

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> SRR1377145     4  0.0524      1.000 0.008 0.004 0.000 0.988
#> SRR1377146     4  0.0524      1.000 0.008 0.004 0.000 0.988
#> SRR1377147     4  0.0524      1.000 0.008 0.004 0.000 0.988
#> SRR1377148     4  0.0524      1.000 0.008 0.004 0.000 0.988
#> SRR1377153     4  0.0524      1.000 0.008 0.004 0.000 0.988
#> SRR1377154     4  0.0524      1.000 0.008 0.004 0.000 0.988
#> SRR1377155     4  0.0524      1.000 0.008 0.004 0.000 0.988
#> SRR1377156     4  0.0524      1.000 0.008 0.004 0.000 0.988
#> SRR1377149     4  0.0524      1.000 0.008 0.004 0.000 0.988
#> SRR1377150     4  0.0524      1.000 0.008 0.004 0.000 0.988
#> SRR1377151     4  0.0524      1.000 0.008 0.004 0.000 0.988
#> SRR1377152     4  0.0524      1.000 0.008 0.004 0.000 0.988
#> SRR1377157     3  0.5267      0.792 0.000 0.048 0.712 0.240
#> SRR1377158     3  0.5267      0.792 0.000 0.048 0.712 0.240
#> SRR1377159     3  0.5267      0.792 0.000 0.048 0.712 0.240
#> SRR1377160     3  0.5267      0.792 0.000 0.048 0.712 0.240
#> SRR1377161     3  0.5267      0.792 0.000 0.048 0.712 0.240
#> SRR1377162     3  0.5267      0.792 0.000 0.048 0.712 0.240
#> SRR1377163     3  0.5267      0.792 0.000 0.048 0.712 0.240
#> SRR1377164     3  0.5267      0.792 0.000 0.048 0.712 0.240
#> SRR1377169     3  0.5267      0.792 0.000 0.048 0.712 0.240
#> SRR1377170     3  0.5267      0.792 0.000 0.048 0.712 0.240
#> SRR1377171     3  0.5267      0.792 0.000 0.048 0.712 0.240
#> SRR1377172     3  0.5267      0.792 0.000 0.048 0.712 0.240
#> SRR1377165     3  0.5267      0.792 0.000 0.048 0.712 0.240
#> SRR1377166     3  0.5267      0.792 0.000 0.048 0.712 0.240
#> SRR1377167     3  0.5267      0.792 0.000 0.048 0.712 0.240
#> SRR1377168     3  0.5267      0.792 0.000 0.048 0.712 0.240
#> SRR1377173     2  0.0336      0.990 0.008 0.992 0.000 0.000
#> SRR1377174     2  0.0336      0.990 0.008 0.992 0.000 0.000
#> SRR1377175     2  0.0336      0.990 0.008 0.992 0.000 0.000
#> SRR1377176     2  0.0336      0.990 0.008 0.992 0.000 0.000
#> SRR1377177     2  0.0000      0.995 0.000 1.000 0.000 0.000
#> SRR1377178     2  0.0000      0.995 0.000 1.000 0.000 0.000
#> SRR1377179     2  0.0000      0.995 0.000 1.000 0.000 0.000
#> SRR1377180     2  0.0000      0.995 0.000 1.000 0.000 0.000
#> SRR1377181     2  0.0000      0.995 0.000 1.000 0.000 0.000
#> SRR1377182     2  0.0000      0.995 0.000 1.000 0.000 0.000
#> SRR1377183     2  0.0336      0.991 0.000 0.992 0.008 0.000
#> SRR1377184     2  0.0000      0.995 0.000 1.000 0.000 0.000
#> SRR1377185     2  0.0336      0.991 0.000 0.992 0.008 0.000
#> SRR1377186     2  0.0336      0.991 0.000 0.992 0.008 0.000
#> SRR1377187     2  0.0000      0.995 0.000 1.000 0.000 0.000
#> SRR1377188     2  0.0336      0.991 0.000 0.992 0.008 0.000
#> SRR1377189     1  0.7058      0.612 0.572 0.000 0.200 0.228
#> SRR1377190     1  0.7058      0.612 0.572 0.000 0.200 0.228
#> SRR1377191     1  0.7058      0.612 0.572 0.000 0.200 0.228
#> SRR1377192     1  0.6946      0.626 0.588 0.000 0.200 0.212
#> SRR1377193     1  0.6975      0.622 0.584 0.000 0.200 0.216
#> SRR1377194     1  0.6946      0.626 0.588 0.000 0.200 0.212
#> SRR1377195     1  0.2593      0.795 0.892 0.104 0.000 0.004
#> SRR1377196     1  0.2593      0.795 0.892 0.104 0.000 0.004
#> SRR1377197     1  0.2593      0.795 0.892 0.104 0.000 0.004
#> SRR1377198     1  0.2593      0.795 0.892 0.104 0.000 0.004
#> SRR1377199     1  0.2593      0.795 0.892 0.104 0.000 0.004
#> SRR1377200     1  0.2593      0.795 0.892 0.104 0.000 0.004
#> SRR1377201     1  0.0707      0.829 0.980 0.000 0.000 0.020
#> SRR1377202     1  0.0707      0.829 0.980 0.000 0.000 0.020
#> SRR1377203     1  0.0707      0.829 0.980 0.000 0.000 0.020
#> SRR1377204     1  0.0000      0.827 1.000 0.000 0.000 0.000
#> SRR1377205     1  0.0000      0.827 1.000 0.000 0.000 0.000
#> SRR1377206     1  0.0000      0.827 1.000 0.000 0.000 0.000
#> SRR1377207     1  0.0707      0.829 0.980 0.000 0.000 0.020
#> SRR1377208     1  0.0707      0.829 0.980 0.000 0.000 0.020
#> SRR1377209     1  0.0707      0.829 0.980 0.000 0.000 0.020
#> SRR1377210     1  0.5171      0.754 0.760 0.000 0.112 0.128
#> SRR1377211     1  0.5171      0.754 0.760 0.000 0.112 0.128
#> SRR1377212     1  0.5171      0.754 0.760 0.000 0.112 0.128
#> SRR1377213     3  0.0469      0.737 0.000 0.000 0.988 0.012
#> SRR1377214     3  0.0469      0.737 0.000 0.000 0.988 0.012
#> SRR1377215     3  0.0469      0.737 0.000 0.000 0.988 0.012
#> SRR1377216     3  0.0469      0.737 0.000 0.000 0.988 0.012
#> SRR1377217     3  0.0469      0.737 0.000 0.000 0.988 0.012
#> SRR1377218     3  0.0469      0.737 0.000 0.000 0.988 0.012
#> SRR1377219     3  0.0469      0.737 0.000 0.000 0.988 0.012
#> SRR1377220     3  0.0469      0.737 0.000 0.000 0.988 0.012
#> SRR1377221     3  0.0469      0.737 0.000 0.000 0.988 0.012
#> SRR1377222     3  0.4836      0.276 0.320 0.000 0.672 0.008
#> SRR1377223     3  0.4836      0.276 0.320 0.000 0.672 0.008
#> SRR1377224     3  0.4836      0.276 0.320 0.000 0.672 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
#> SRR1377145     2  0.0671      0.993 0.004 0.980 0.016 0.000 0.000
#> SRR1377146     2  0.0671      0.993 0.004 0.980 0.016 0.000 0.000
#> SRR1377147     2  0.0671      0.993 0.004 0.980 0.016 0.000 0.000
#> SRR1377148     2  0.0671      0.993 0.004 0.980 0.016 0.000 0.000
#> SRR1377153     2  0.0451      0.996 0.004 0.988 0.008 0.000 0.000
#> SRR1377154     2  0.0451      0.996 0.004 0.988 0.008 0.000 0.000
#> SRR1377155     2  0.0451      0.996 0.004 0.988 0.008 0.000 0.000
#> SRR1377156     2  0.0451      0.996 0.004 0.988 0.008 0.000 0.000
#> SRR1377149     2  0.0451      0.996 0.004 0.988 0.008 0.000 0.000
#> SRR1377150     2  0.0451      0.996 0.004 0.988 0.008 0.000 0.000
#> SRR1377151     2  0.0451      0.996 0.004 0.988 0.008 0.000 0.000
#> SRR1377152     2  0.0451      0.996 0.004 0.988 0.008 0.000 0.000
#> SRR1377157     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000
#> SRR1377158     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000
#> SRR1377159     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000
#> SRR1377160     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000
#> SRR1377161     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000
#> SRR1377162     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000
#> SRR1377163     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000
#> SRR1377164     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000
#> SRR1377169     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000
#> SRR1377170     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000
#> SRR1377171     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000
#> SRR1377172     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000
#> SRR1377165     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000
#> SRR1377166     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000
#> SRR1377167     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000
#> SRR1377168     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000
#> SRR1377173     1  0.0324      0.994 0.992 0.000 0.004 0.004 0.000
#> SRR1377174     1  0.0162      0.992 0.996 0.000 0.000 0.004 0.000
#> SRR1377175     1  0.0324      0.994 0.992 0.000 0.004 0.004 0.000
#> SRR1377176     1  0.0324      0.994 0.992 0.000 0.004 0.004 0.000
#> SRR1377177     1  0.0162      0.995 0.996 0.000 0.004 0.000 0.000
#> SRR1377178     1  0.0162      0.995 0.996 0.000 0.004 0.000 0.000
#> SRR1377179     1  0.0162      0.995 0.996 0.000 0.004 0.000 0.000
#> SRR1377180     1  0.0162      0.995 0.996 0.000 0.004 0.000 0.000
#> SRR1377181     1  0.0290      0.994 0.992 0.000 0.008 0.000 0.000
#> SRR1377182     1  0.0290      0.994 0.992 0.000 0.008 0.000 0.000
#> SRR1377183     1  0.0290      0.993 0.992 0.000 0.000 0.008 0.000
#> SRR1377184     1  0.0290      0.994 0.992 0.000 0.008 0.000 0.000
#> SRR1377185     1  0.0290      0.993 0.992 0.000 0.000 0.008 0.000
#> SRR1377186     1  0.0290      0.993 0.992 0.000 0.000 0.008 0.000
#> SRR1377187     1  0.0290      0.994 0.992 0.000 0.008 0.000 0.000
#> SRR1377188     1  0.0290      0.993 0.992 0.000 0.000 0.008 0.000
#> SRR1377189     4  0.6188      0.306 0.000 0.136 0.000 0.448 0.416
#> SRR1377190     4  0.6188      0.306 0.000 0.136 0.000 0.448 0.416
#> SRR1377191     4  0.6188      0.306 0.000 0.136 0.000 0.448 0.416
#> SRR1377192     4  0.6160      0.302 0.000 0.132 0.000 0.448 0.420
#> SRR1377193     4  0.6160      0.302 0.000 0.132 0.000 0.448 0.420
#> SRR1377194     4  0.6160      0.302 0.000 0.132 0.000 0.448 0.420
#> SRR1377195     5  0.4229      0.828 0.080 0.020 0.000 0.096 0.804
#> SRR1377196     5  0.4229      0.828 0.080 0.020 0.000 0.096 0.804
#> SRR1377197     5  0.4229      0.828 0.080 0.020 0.000 0.096 0.804
#> SRR1377198     5  0.4229      0.828 0.080 0.020 0.000 0.096 0.804
#> SRR1377199     5  0.4229      0.828 0.080 0.020 0.000 0.096 0.804
#> SRR1377200     5  0.4229      0.828 0.080 0.020 0.000 0.096 0.804
#> SRR1377201     5  0.0000      0.861 0.000 0.000 0.000 0.000 1.000
#> SRR1377202     5  0.0000      0.861 0.000 0.000 0.000 0.000 1.000
#> SRR1377203     5  0.0000      0.861 0.000 0.000 0.000 0.000 1.000
#> SRR1377204     5  0.1502      0.861 0.004 0.000 0.000 0.056 0.940
#> SRR1377205     5  0.1502      0.861 0.004 0.000 0.000 0.056 0.940
#> SRR1377206     5  0.1502      0.861 0.004 0.000 0.000 0.056 0.940
#> SRR1377207     5  0.0000      0.861 0.000 0.000 0.000 0.000 1.000
#> SRR1377208     5  0.0000      0.861 0.000 0.000 0.000 0.000 1.000
#> SRR1377209     5  0.0000      0.861 0.000 0.000 0.000 0.000 1.000
#> SRR1377210     5  0.4333      0.606 0.000 0.060 0.000 0.188 0.752
#> SRR1377211     5  0.4333      0.606 0.000 0.060 0.000 0.188 0.752
#> SRR1377212     5  0.4333      0.606 0.000 0.060 0.000 0.188 0.752
#> SRR1377213     4  0.2230      0.764 0.000 0.000 0.116 0.884 0.000
#> SRR1377214     4  0.2230      0.764 0.000 0.000 0.116 0.884 0.000
#> SRR1377215     4  0.2230      0.764 0.000 0.000 0.116 0.884 0.000
#> SRR1377216     4  0.2280      0.761 0.000 0.000 0.120 0.880 0.000
#> SRR1377217     4  0.2280      0.761 0.000 0.000 0.120 0.880 0.000
#> SRR1377218     4  0.2280      0.761 0.000 0.000 0.120 0.880 0.000
#> SRR1377219     4  0.2230      0.764 0.000 0.000 0.116 0.884 0.000
#> SRR1377220     4  0.2230      0.764 0.000 0.000 0.116 0.884 0.000
#> SRR1377221     4  0.2230      0.764 0.000 0.000 0.116 0.884 0.000
#> SRR1377222     4  0.1310      0.730 0.000 0.000 0.020 0.956 0.024
#> SRR1377223     4  0.1310      0.730 0.000 0.000 0.020 0.956 0.024
#> SRR1377224     4  0.1310      0.730 0.000 0.000 0.020 0.956 0.024

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>            class entropy silhouette    p1    p2    p3    p4    p5    p6
#> SRR1377145     6  0.0000      0.997 0.000 0.000 0.000 0.000 0.000 1.000
#> SRR1377146     6  0.0000      0.997 0.000 0.000 0.000 0.000 0.000 1.000
#> SRR1377147     6  0.0000      0.997 0.000 0.000 0.000 0.000 0.000 1.000
#> SRR1377148     6  0.0000      0.997 0.000 0.000 0.000 0.000 0.000 1.000
#> SRR1377153     6  0.0291      0.995 0.000 0.004 0.000 0.000 0.004 0.992
#> SRR1377154     6  0.0291      0.995 0.000 0.004 0.000 0.000 0.004 0.992
#> SRR1377155     6  0.0291      0.995 0.000 0.004 0.000 0.000 0.004 0.992
#> SRR1377156     6  0.0291      0.995 0.000 0.004 0.000 0.000 0.004 0.992
#> SRR1377149     6  0.0000      0.997 0.000 0.000 0.000 0.000 0.000 1.000
#> SRR1377150     6  0.0000      0.997 0.000 0.000 0.000 0.000 0.000 1.000
#> SRR1377151     6  0.0000      0.997 0.000 0.000 0.000 0.000 0.000 1.000
#> SRR1377152     6  0.0000      0.997 0.000 0.000 0.000 0.000 0.000 1.000
#> SRR1377157     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1377158     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1377159     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1377160     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1377161     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1377162     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1377163     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1377164     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1377169     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1377170     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1377171     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1377172     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1377165     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1377166     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1377167     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1377168     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1377173     1  0.0458      0.987 0.984 0.000 0.000 0.000 0.016 0.000
#> SRR1377174     1  0.0458      0.987 0.984 0.000 0.000 0.000 0.016 0.000
#> SRR1377175     1  0.0363      0.988 0.988 0.000 0.000 0.000 0.012 0.000
#> SRR1377176     1  0.0458      0.987 0.984 0.000 0.000 0.000 0.016 0.000
#> SRR1377177     1  0.0291      0.990 0.992 0.000 0.004 0.000 0.004 0.000
#> SRR1377178     1  0.0291      0.990 0.992 0.000 0.004 0.000 0.004 0.000
#> SRR1377179     1  0.0291      0.990 0.992 0.000 0.004 0.000 0.004 0.000
#> SRR1377180     1  0.0291      0.990 0.992 0.000 0.004 0.000 0.004 0.000
#> SRR1377181     1  0.0653      0.988 0.980 0.004 0.004 0.000 0.012 0.000
#> SRR1377182     1  0.0653      0.988 0.980 0.004 0.004 0.000 0.012 0.000
#> SRR1377183     1  0.0653      0.989 0.980 0.004 0.004 0.000 0.012 0.000
#> SRR1377184     1  0.0653      0.988 0.980 0.004 0.004 0.000 0.012 0.000
#> SRR1377185     1  0.0653      0.989 0.980 0.004 0.004 0.000 0.012 0.000
#> SRR1377186     1  0.0653      0.989 0.980 0.004 0.004 0.000 0.012 0.000
#> SRR1377187     1  0.0653      0.988 0.980 0.004 0.004 0.000 0.012 0.000
#> SRR1377188     1  0.0653      0.989 0.980 0.004 0.004 0.000 0.012 0.000
#> SRR1377189     2  0.5223      0.566 0.004 0.688 0.000 0.172 0.096 0.040
#> SRR1377190     2  0.5223      0.566 0.004 0.688 0.000 0.172 0.096 0.040
#> SRR1377191     2  0.5223      0.566 0.004 0.688 0.000 0.172 0.096 0.040
#> SRR1377192     2  0.5223      0.566 0.004 0.688 0.000 0.172 0.096 0.040
#> SRR1377193     2  0.5223      0.566 0.004 0.688 0.000 0.172 0.096 0.040
#> SRR1377194     2  0.5223      0.566 0.004 0.688 0.000 0.172 0.096 0.040
#> SRR1377195     5  0.1088      1.000 0.016 0.024 0.000 0.000 0.960 0.000
#> SRR1377196     5  0.1088      1.000 0.016 0.024 0.000 0.000 0.960 0.000
#> SRR1377197     5  0.1088      1.000 0.016 0.024 0.000 0.000 0.960 0.000
#> SRR1377198     5  0.1088      1.000 0.016 0.024 0.000 0.000 0.960 0.000
#> SRR1377199     5  0.1088      1.000 0.016 0.024 0.000 0.000 0.960 0.000
#> SRR1377200     5  0.1088      1.000 0.016 0.024 0.000 0.000 0.960 0.000
#> SRR1377201     2  0.3101      0.664 0.000 0.756 0.000 0.000 0.244 0.000
#> SRR1377202     2  0.3101      0.664 0.000 0.756 0.000 0.000 0.244 0.000
#> SRR1377203     2  0.3101      0.664 0.000 0.756 0.000 0.000 0.244 0.000
#> SRR1377204     2  0.3789      0.587 0.000 0.660 0.000 0.008 0.332 0.000
#> SRR1377205     2  0.3789      0.587 0.000 0.660 0.000 0.008 0.332 0.000
#> SRR1377206     2  0.3789      0.587 0.000 0.660 0.000 0.008 0.332 0.000
#> SRR1377207     2  0.3126      0.662 0.000 0.752 0.000 0.000 0.248 0.000
#> SRR1377208     2  0.3126      0.662 0.000 0.752 0.000 0.000 0.248 0.000
#> SRR1377209     2  0.3126      0.662 0.000 0.752 0.000 0.000 0.248 0.000
#> SRR1377210     2  0.1620      0.670 0.000 0.940 0.000 0.024 0.024 0.012
#> SRR1377211     2  0.1620      0.670 0.000 0.940 0.000 0.024 0.024 0.012
#> SRR1377212     2  0.1620      0.670 0.000 0.940 0.000 0.024 0.024 0.012
#> SRR1377213     4  0.0603      0.989 0.000 0.000 0.016 0.980 0.000 0.004
#> SRR1377214     4  0.0603      0.989 0.000 0.000 0.016 0.980 0.000 0.004
#> SRR1377215     4  0.0603      0.989 0.000 0.000 0.016 0.980 0.000 0.004
#> SRR1377216     4  0.0777      0.984 0.000 0.000 0.024 0.972 0.000 0.004
#> SRR1377217     4  0.0777      0.984 0.000 0.000 0.024 0.972 0.000 0.004
#> SRR1377218     4  0.0777      0.984 0.000 0.000 0.024 0.972 0.000 0.004
#> SRR1377219     4  0.0603      0.989 0.000 0.000 0.016 0.980 0.000 0.004
#> SRR1377220     4  0.0603      0.989 0.000 0.000 0.016 0.980 0.000 0.004
#> SRR1377221     4  0.0603      0.989 0.000 0.000 0.016 0.980 0.000 0.004
#> SRR1377222     4  0.0405      0.974 0.000 0.004 0.000 0.988 0.008 0.000
#> SRR1377223     4  0.0405      0.974 0.000 0.004 0.000 0.988 0.008 0.000
#> SRR1377224     4  0.0405      0.974 0.000 0.004 0.000 0.988 0.008 0.000

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

consensus_heatmap(res, k = 2)

plot of chunk tab-CV-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 13890 rows and 80 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 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-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.995       0.995         0.1452 0.859   0.859
#> 3 3 0.577           0.919       0.933         2.0363 0.706   0.658
#> 4 4 1.000           0.995       0.995         0.3851 0.825   0.691
#> 5 5 1.000           0.999       1.000         0.2462 0.848   0.612
#> 6 6 0.885           0.855       0.905         0.0585 0.974   0.893

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
#> SRR1377145     2  0.0938      0.994 0.012 0.988
#> SRR1377146     2  0.0672      0.994 0.008 0.992
#> SRR1377147     2  0.0672      0.994 0.008 0.992
#> SRR1377148     2  0.0672      0.994 0.008 0.992
#> SRR1377153     2  0.0938      0.994 0.012 0.988
#> SRR1377154     2  0.0938      0.994 0.012 0.988
#> SRR1377155     2  0.0938      0.994 0.012 0.988
#> SRR1377156     2  0.0938      0.994 0.012 0.988
#> SRR1377149     2  0.0938      0.994 0.012 0.988
#> SRR1377150     2  0.0938      0.994 0.012 0.988
#> SRR1377151     2  0.0938      0.994 0.012 0.988
#> SRR1377152     2  0.0938      0.994 0.012 0.988
#> SRR1377157     2  0.0000      0.994 0.000 1.000
#> SRR1377158     2  0.0000      0.994 0.000 1.000
#> SRR1377159     2  0.0000      0.994 0.000 1.000
#> SRR1377160     2  0.0000      0.994 0.000 1.000
#> SRR1377161     2  0.0000      0.994 0.000 1.000
#> SRR1377162     2  0.0000      0.994 0.000 1.000
#> SRR1377163     2  0.0000      0.994 0.000 1.000
#> SRR1377164     2  0.0000      0.994 0.000 1.000
#> SRR1377169     2  0.0672      0.994 0.008 0.992
#> SRR1377170     2  0.0000      0.994 0.000 1.000
#> SRR1377171     2  0.0000      0.994 0.000 1.000
#> SRR1377172     2  0.0000      0.994 0.000 1.000
#> SRR1377165     2  0.0000      0.994 0.000 1.000
#> SRR1377166     2  0.0000      0.994 0.000 1.000
#> SRR1377167     2  0.0000      0.994 0.000 1.000
#> SRR1377168     2  0.0000      0.994 0.000 1.000
#> SRR1377173     2  0.0938      0.994 0.012 0.988
#> SRR1377174     2  0.0938      0.994 0.012 0.988
#> SRR1377175     2  0.0938      0.994 0.012 0.988
#> SRR1377176     2  0.0938      0.994 0.012 0.988
#> SRR1377177     2  0.0672      0.994 0.008 0.992
#> SRR1377178     2  0.0672      0.994 0.008 0.992
#> SRR1377179     2  0.0672      0.994 0.008 0.992
#> SRR1377180     2  0.0672      0.994 0.008 0.992
#> SRR1377181     2  0.0000      0.994 0.000 1.000
#> SRR1377182     2  0.0000      0.994 0.000 1.000
#> SRR1377183     2  0.0000      0.994 0.000 1.000
#> SRR1377184     2  0.0000      0.994 0.000 1.000
#> SRR1377185     2  0.0000      0.994 0.000 1.000
#> SRR1377186     2  0.0376      0.994 0.004 0.996
#> SRR1377187     2  0.0000      0.994 0.000 1.000
#> SRR1377188     2  0.0000      0.994 0.000 1.000
#> SRR1377189     2  0.0938      0.994 0.012 0.988
#> SRR1377190     2  0.0938      0.994 0.012 0.988
#> SRR1377191     2  0.0938      0.994 0.012 0.988
#> SRR1377192     2  0.0938      0.994 0.012 0.988
#> SRR1377193     2  0.0938      0.994 0.012 0.988
#> SRR1377194     2  0.0938      0.994 0.012 0.988
#> SRR1377195     1  0.0000      1.000 1.000 0.000
#> SRR1377196     1  0.0000      1.000 1.000 0.000
#> SRR1377197     1  0.0000      1.000 1.000 0.000
#> SRR1377198     1  0.0000      1.000 1.000 0.000
#> SRR1377199     1  0.0000      1.000 1.000 0.000
#> SRR1377200     1  0.0000      1.000 1.000 0.000
#> SRR1377201     2  0.0938      0.994 0.012 0.988
#> SRR1377202     2  0.0938      0.994 0.012 0.988
#> SRR1377203     2  0.0938      0.994 0.012 0.988
#> SRR1377204     2  0.0938      0.994 0.012 0.988
#> SRR1377205     2  0.0938      0.994 0.012 0.988
#> SRR1377206     2  0.0938      0.994 0.012 0.988
#> SRR1377207     2  0.0938      0.994 0.012 0.988
#> SRR1377208     2  0.0938      0.994 0.012 0.988
#> SRR1377209     2  0.0938      0.994 0.012 0.988
#> SRR1377210     2  0.0938      0.994 0.012 0.988
#> SRR1377211     2  0.0938      0.994 0.012 0.988
#> SRR1377212     2  0.0938      0.994 0.012 0.988
#> SRR1377213     2  0.0000      0.994 0.000 1.000
#> SRR1377214     2  0.0000      0.994 0.000 1.000
#> SRR1377215     2  0.0000      0.994 0.000 1.000
#> SRR1377216     2  0.0000      0.994 0.000 1.000
#> SRR1377217     2  0.0000      0.994 0.000 1.000
#> SRR1377218     2  0.0000      0.994 0.000 1.000
#> SRR1377219     2  0.0000      0.994 0.000 1.000
#> SRR1377220     2  0.0000      0.994 0.000 1.000
#> SRR1377221     2  0.0000      0.994 0.000 1.000
#> SRR1377222     2  0.0000      0.994 0.000 1.000
#> SRR1377223     2  0.0000      0.994 0.000 1.000
#> SRR1377224     2  0.0000      0.994 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
#> SRR1377145     2  0.0000      0.941  0 1.000 0.000
#> SRR1377146     2  0.0000      0.941  0 1.000 0.000
#> SRR1377147     2  0.0000      0.941  0 1.000 0.000
#> SRR1377148     2  0.0000      0.941  0 1.000 0.000
#> SRR1377153     2  0.0000      0.941  0 1.000 0.000
#> SRR1377154     2  0.0000      0.941  0 1.000 0.000
#> SRR1377155     2  0.0000      0.941  0 1.000 0.000
#> SRR1377156     2  0.0000      0.941  0 1.000 0.000
#> SRR1377149     2  0.0000      0.941  0 1.000 0.000
#> SRR1377150     2  0.0000      0.941  0 1.000 0.000
#> SRR1377151     2  0.0000      0.941  0 1.000 0.000
#> SRR1377152     2  0.0000      0.941  0 1.000 0.000
#> SRR1377157     3  0.3619      0.954  0 0.136 0.864
#> SRR1377158     3  0.2796      0.914  0 0.092 0.908
#> SRR1377159     3  0.3340      0.948  0 0.120 0.880
#> SRR1377160     3  0.3340      0.948  0 0.120 0.880
#> SRR1377161     3  0.2959      0.924  0 0.100 0.900
#> SRR1377162     3  0.3482      0.952  0 0.128 0.872
#> SRR1377163     3  0.3267      0.945  0 0.116 0.884
#> SRR1377164     3  0.2959      0.924  0 0.100 0.900
#> SRR1377169     3  0.4750      0.862  0 0.216 0.784
#> SRR1377170     3  0.4002      0.944  0 0.160 0.840
#> SRR1377171     3  0.4062      0.940  0 0.164 0.836
#> SRR1377172     3  0.3941      0.949  0 0.156 0.844
#> SRR1377165     3  0.3686      0.954  0 0.140 0.860
#> SRR1377166     3  0.3941      0.948  0 0.156 0.844
#> SRR1377167     3  0.4062      0.939  0 0.164 0.836
#> SRR1377168     3  0.3879      0.951  0 0.152 0.848
#> SRR1377173     2  0.0000      0.941  0 1.000 0.000
#> SRR1377174     2  0.0000      0.941  0 1.000 0.000
#> SRR1377175     2  0.0237      0.939  0 0.996 0.004
#> SRR1377176     2  0.0000      0.941  0 1.000 0.000
#> SRR1377177     2  0.0000      0.941  0 1.000 0.000
#> SRR1377178     2  0.0000      0.941  0 1.000 0.000
#> SRR1377179     2  0.0000      0.941  0 1.000 0.000
#> SRR1377180     2  0.0000      0.941  0 1.000 0.000
#> SRR1377181     2  0.2878      0.882  0 0.904 0.096
#> SRR1377182     2  0.1860      0.913  0 0.948 0.052
#> SRR1377183     2  0.1163      0.926  0 0.972 0.028
#> SRR1377184     2  0.1753      0.914  0 0.952 0.048
#> SRR1377185     2  0.1753      0.915  0 0.952 0.048
#> SRR1377186     2  0.0747      0.933  0 0.984 0.016
#> SRR1377187     2  0.1964      0.909  0 0.944 0.056
#> SRR1377188     2  0.0892      0.931  0 0.980 0.020
#> SRR1377189     2  0.0000      0.941  0 1.000 0.000
#> SRR1377190     2  0.0000      0.941  0 1.000 0.000
#> SRR1377191     2  0.0000      0.941  0 1.000 0.000
#> SRR1377192     2  0.0000      0.941  0 1.000 0.000
#> SRR1377193     2  0.0000      0.941  0 1.000 0.000
#> SRR1377194     2  0.0000      0.941  0 1.000 0.000
#> SRR1377195     1  0.0000      1.000  1 0.000 0.000
#> SRR1377196     1  0.0000      1.000  1 0.000 0.000
#> SRR1377197     1  0.0000      1.000  1 0.000 0.000
#> SRR1377198     1  0.0000      1.000  1 0.000 0.000
#> SRR1377199     1  0.0000      1.000  1 0.000 0.000
#> SRR1377200     1  0.0000      1.000  1 0.000 0.000
#> SRR1377201     2  0.0000      0.941  0 1.000 0.000
#> SRR1377202     2  0.0000      0.941  0 1.000 0.000
#> SRR1377203     2  0.0000      0.941  0 1.000 0.000
#> SRR1377204     2  0.0000      0.941  0 1.000 0.000
#> SRR1377205     2  0.0000      0.941  0 1.000 0.000
#> SRR1377206     2  0.0000      0.941  0 1.000 0.000
#> SRR1377207     2  0.0000      0.941  0 1.000 0.000
#> SRR1377208     2  0.0000      0.941  0 1.000 0.000
#> SRR1377209     2  0.0000      0.941  0 1.000 0.000
#> SRR1377210     2  0.0000      0.941  0 1.000 0.000
#> SRR1377211     2  0.0000      0.941  0 1.000 0.000
#> SRR1377212     2  0.0000      0.941  0 1.000 0.000
#> SRR1377213     2  0.4931      0.787  0 0.768 0.232
#> SRR1377214     2  0.4931      0.787  0 0.768 0.232
#> SRR1377215     2  0.4931      0.787  0 0.768 0.232
#> SRR1377216     2  0.4931      0.787  0 0.768 0.232
#> SRR1377217     2  0.4931      0.787  0 0.768 0.232
#> SRR1377218     2  0.4931      0.787  0 0.768 0.232
#> SRR1377219     2  0.4931      0.787  0 0.768 0.232
#> SRR1377220     2  0.4931      0.787  0 0.768 0.232
#> SRR1377221     2  0.4931      0.787  0 0.768 0.232
#> SRR1377222     2  0.4931      0.787  0 0.768 0.232
#> SRR1377223     2  0.4931      0.787  0 0.768 0.232
#> SRR1377224     2  0.4931      0.787  0 0.768 0.232

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette p1    p2    p3    p4
#> SRR1377145     2  0.0000      0.995  0 1.000 0.000 0.000
#> SRR1377146     2  0.0000      0.995  0 1.000 0.000 0.000
#> SRR1377147     2  0.0000      0.995  0 1.000 0.000 0.000
#> SRR1377148     2  0.0000      0.995  0 1.000 0.000 0.000
#> SRR1377153     2  0.0000      0.995  0 1.000 0.000 0.000
#> SRR1377154     2  0.0000      0.995  0 1.000 0.000 0.000
#> SRR1377155     2  0.0000      0.995  0 1.000 0.000 0.000
#> SRR1377156     2  0.0000      0.995  0 1.000 0.000 0.000
#> SRR1377149     2  0.0000      0.995  0 1.000 0.000 0.000
#> SRR1377150     2  0.0000      0.995  0 1.000 0.000 0.000
#> SRR1377151     2  0.0000      0.995  0 1.000 0.000 0.000
#> SRR1377152     2  0.0000      0.995  0 1.000 0.000 0.000
#> SRR1377157     3  0.0000      0.997  0 0.000 1.000 0.000
#> SRR1377158     3  0.0000      0.997  0 0.000 1.000 0.000
#> SRR1377159     3  0.0000      0.997  0 0.000 1.000 0.000
#> SRR1377160     3  0.0000      0.997  0 0.000 1.000 0.000
#> SRR1377161     3  0.0000      0.997  0 0.000 1.000 0.000
#> SRR1377162     3  0.0000      0.997  0 0.000 1.000 0.000
#> SRR1377163     3  0.0000      0.997  0 0.000 1.000 0.000
#> SRR1377164     3  0.0000      0.997  0 0.000 1.000 0.000
#> SRR1377169     3  0.0524      0.985  0 0.008 0.988 0.004
#> SRR1377170     3  0.0188      0.994  0 0.004 0.996 0.000
#> SRR1377171     3  0.0188      0.994  0 0.004 0.996 0.000
#> SRR1377172     3  0.0188      0.994  0 0.004 0.996 0.000
#> SRR1377165     3  0.0000      0.997  0 0.000 1.000 0.000
#> SRR1377166     3  0.0000      0.997  0 0.000 1.000 0.000
#> SRR1377167     3  0.0188      0.994  0 0.004 0.996 0.000
#> SRR1377168     3  0.0000      0.997  0 0.000 1.000 0.000
#> SRR1377173     2  0.0469      0.991  0 0.988 0.000 0.012
#> SRR1377174     2  0.0469      0.991  0 0.988 0.000 0.012
#> SRR1377175     2  0.0469      0.991  0 0.988 0.000 0.012
#> SRR1377176     2  0.0469      0.991  0 0.988 0.000 0.012
#> SRR1377177     2  0.0469      0.991  0 0.988 0.000 0.012
#> SRR1377178     2  0.0469      0.991  0 0.988 0.000 0.012
#> SRR1377179     2  0.0469      0.991  0 0.988 0.000 0.012
#> SRR1377180     2  0.0469      0.991  0 0.988 0.000 0.012
#> SRR1377181     2  0.1022      0.975  0 0.968 0.000 0.032
#> SRR1377182     2  0.0937      0.983  0 0.976 0.012 0.012
#> SRR1377183     2  0.0469      0.991  0 0.988 0.000 0.012
#> SRR1377184     2  0.0657      0.989  0 0.984 0.004 0.012
#> SRR1377185     2  0.0817      0.983  0 0.976 0.000 0.024
#> SRR1377186     2  0.0469      0.991  0 0.988 0.000 0.012
#> SRR1377187     2  0.0469      0.991  0 0.988 0.000 0.012
#> SRR1377188     2  0.0592      0.989  0 0.984 0.000 0.016
#> SRR1377189     2  0.0000      0.995  0 1.000 0.000 0.000
#> SRR1377190     2  0.0000      0.995  0 1.000 0.000 0.000
#> SRR1377191     2  0.0000      0.995  0 1.000 0.000 0.000
#> SRR1377192     2  0.0000      0.995  0 1.000 0.000 0.000
#> SRR1377193     2  0.0000      0.995  0 1.000 0.000 0.000
#> SRR1377194     2  0.0000      0.995  0 1.000 0.000 0.000
#> SRR1377195     1  0.0000      1.000  1 0.000 0.000 0.000
#> SRR1377196     1  0.0000      1.000  1 0.000 0.000 0.000
#> SRR1377197     1  0.0000      1.000  1 0.000 0.000 0.000
#> SRR1377198     1  0.0000      1.000  1 0.000 0.000 0.000
#> SRR1377199     1  0.0000      1.000  1 0.000 0.000 0.000
#> SRR1377200     1  0.0000      1.000  1 0.000 0.000 0.000
#> SRR1377201     2  0.0000      0.995  0 1.000 0.000 0.000
#> SRR1377202     2  0.0000      0.995  0 1.000 0.000 0.000
#> SRR1377203     2  0.0000      0.995  0 1.000 0.000 0.000
#> SRR1377204     2  0.0000      0.995  0 1.000 0.000 0.000
#> SRR1377205     2  0.0000      0.995  0 1.000 0.000 0.000
#> SRR1377206     2  0.0000      0.995  0 1.000 0.000 0.000
#> SRR1377207     2  0.0000      0.995  0 1.000 0.000 0.000
#> SRR1377208     2  0.0000      0.995  0 1.000 0.000 0.000
#> SRR1377209     2  0.0000      0.995  0 1.000 0.000 0.000
#> SRR1377210     2  0.0000      0.995  0 1.000 0.000 0.000
#> SRR1377211     2  0.0000      0.995  0 1.000 0.000 0.000
#> SRR1377212     2  0.0000      0.995  0 1.000 0.000 0.000
#> SRR1377213     4  0.0469      1.000  0 0.000 0.012 0.988
#> SRR1377214     4  0.0469      1.000  0 0.000 0.012 0.988
#> SRR1377215     4  0.0469      1.000  0 0.000 0.012 0.988
#> SRR1377216     4  0.0469      1.000  0 0.000 0.012 0.988
#> SRR1377217     4  0.0469      1.000  0 0.000 0.012 0.988
#> SRR1377218     4  0.0469      1.000  0 0.000 0.012 0.988
#> SRR1377219     4  0.0469      1.000  0 0.000 0.012 0.988
#> SRR1377220     4  0.0469      1.000  0 0.000 0.012 0.988
#> SRR1377221     4  0.0469      1.000  0 0.000 0.012 0.988
#> SRR1377222     4  0.0469      1.000  0 0.000 0.012 0.988
#> SRR1377223     4  0.0469      1.000  0 0.000 0.012 0.988
#> SRR1377224     4  0.0469      1.000  0 0.000 0.012 0.988

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>            class entropy silhouette    p1    p2    p3 p4 p5
#> SRR1377145     2  0.0000      0.999 0.000 1.000 0.000  0  0
#> SRR1377146     2  0.0162      0.995 0.000 0.996 0.004  0  0
#> SRR1377147     2  0.0693      0.980 0.008 0.980 0.012  0  0
#> SRR1377148     2  0.0000      0.999 0.000 1.000 0.000  0  0
#> SRR1377153     2  0.0000      0.999 0.000 1.000 0.000  0  0
#> SRR1377154     2  0.0000      0.999 0.000 1.000 0.000  0  0
#> SRR1377155     2  0.0290      0.991 0.008 0.992 0.000  0  0
#> SRR1377156     2  0.0000      0.999 0.000 1.000 0.000  0  0
#> SRR1377149     2  0.0000      0.999 0.000 1.000 0.000  0  0
#> SRR1377150     2  0.0000      0.999 0.000 1.000 0.000  0  0
#> SRR1377151     2  0.0000      0.999 0.000 1.000 0.000  0  0
#> SRR1377152     2  0.0000      0.999 0.000 1.000 0.000  0  0
#> SRR1377157     3  0.0000      1.000 0.000 0.000 1.000  0  0
#> SRR1377158     3  0.0000      1.000 0.000 0.000 1.000  0  0
#> SRR1377159     3  0.0000      1.000 0.000 0.000 1.000  0  0
#> SRR1377160     3  0.0000      1.000 0.000 0.000 1.000  0  0
#> SRR1377161     3  0.0000      1.000 0.000 0.000 1.000  0  0
#> SRR1377162     3  0.0000      1.000 0.000 0.000 1.000  0  0
#> SRR1377163     3  0.0000      1.000 0.000 0.000 1.000  0  0
#> SRR1377164     3  0.0000      1.000 0.000 0.000 1.000  0  0
#> SRR1377169     3  0.0000      1.000 0.000 0.000 1.000  0  0
#> SRR1377170     3  0.0000      1.000 0.000 0.000 1.000  0  0
#> SRR1377171     3  0.0000      1.000 0.000 0.000 1.000  0  0
#> SRR1377172     3  0.0000      1.000 0.000 0.000 1.000  0  0
#> SRR1377165     3  0.0000      1.000 0.000 0.000 1.000  0  0
#> SRR1377166     3  0.0000      1.000 0.000 0.000 1.000  0  0
#> SRR1377167     3  0.0000      1.000 0.000 0.000 1.000  0  0
#> SRR1377168     3  0.0000      1.000 0.000 0.000 1.000  0  0
#> SRR1377173     1  0.0000      1.000 1.000 0.000 0.000  0  0
#> SRR1377174     1  0.0000      1.000 1.000 0.000 0.000  0  0
#> SRR1377175     1  0.0000      1.000 1.000 0.000 0.000  0  0
#> SRR1377176     1  0.0000      1.000 1.000 0.000 0.000  0  0
#> SRR1377177     1  0.0000      1.000 1.000 0.000 0.000  0  0
#> SRR1377178     1  0.0000      1.000 1.000 0.000 0.000  0  0
#> SRR1377179     1  0.0000      1.000 1.000 0.000 0.000  0  0
#> SRR1377180     1  0.0000      1.000 1.000 0.000 0.000  0  0
#> SRR1377181     1  0.0000      1.000 1.000 0.000 0.000  0  0
#> SRR1377182     1  0.0000      1.000 1.000 0.000 0.000  0  0
#> SRR1377183     1  0.0000      1.000 1.000 0.000 0.000  0  0
#> SRR1377184     1  0.0000      1.000 1.000 0.000 0.000  0  0
#> SRR1377185     1  0.0000      1.000 1.000 0.000 0.000  0  0
#> SRR1377186     1  0.0000      1.000 1.000 0.000 0.000  0  0
#> SRR1377187     1  0.0000      1.000 1.000 0.000 0.000  0  0
#> SRR1377188     1  0.0000      1.000 1.000 0.000 0.000  0  0
#> SRR1377189     2  0.0000      0.999 0.000 1.000 0.000  0  0
#> SRR1377190     2  0.0000      0.999 0.000 1.000 0.000  0  0
#> SRR1377191     2  0.0000      0.999 0.000 1.000 0.000  0  0
#> SRR1377192     2  0.0000      0.999 0.000 1.000 0.000  0  0
#> SRR1377193     2  0.0000      0.999 0.000 1.000 0.000  0  0
#> SRR1377194     2  0.0000      0.999 0.000 1.000 0.000  0  0
#> SRR1377195     5  0.0000      1.000 0.000 0.000 0.000  0  1
#> SRR1377196     5  0.0000      1.000 0.000 0.000 0.000  0  1
#> SRR1377197     5  0.0000      1.000 0.000 0.000 0.000  0  1
#> SRR1377198     5  0.0000      1.000 0.000 0.000 0.000  0  1
#> SRR1377199     5  0.0000      1.000 0.000 0.000 0.000  0  1
#> SRR1377200     5  0.0000      1.000 0.000 0.000 0.000  0  1
#> SRR1377201     2  0.0000      0.999 0.000 1.000 0.000  0  0
#> SRR1377202     2  0.0000      0.999 0.000 1.000 0.000  0  0
#> SRR1377203     2  0.0000      0.999 0.000 1.000 0.000  0  0
#> SRR1377204     2  0.0000      0.999 0.000 1.000 0.000  0  0
#> SRR1377205     2  0.0000      0.999 0.000 1.000 0.000  0  0
#> SRR1377206     2  0.0000      0.999 0.000 1.000 0.000  0  0
#> SRR1377207     2  0.0000      0.999 0.000 1.000 0.000  0  0
#> SRR1377208     2  0.0000      0.999 0.000 1.000 0.000  0  0
#> SRR1377209     2  0.0000      0.999 0.000 1.000 0.000  0  0
#> SRR1377210     2  0.0000      0.999 0.000 1.000 0.000  0  0
#> SRR1377211     2  0.0000      0.999 0.000 1.000 0.000  0  0
#> SRR1377212     2  0.0000      0.999 0.000 1.000 0.000  0  0
#> SRR1377213     4  0.0000      1.000 0.000 0.000 0.000  1  0
#> SRR1377214     4  0.0000      1.000 0.000 0.000 0.000  1  0
#> SRR1377215     4  0.0000      1.000 0.000 0.000 0.000  1  0
#> SRR1377216     4  0.0000      1.000 0.000 0.000 0.000  1  0
#> SRR1377217     4  0.0000      1.000 0.000 0.000 0.000  1  0
#> SRR1377218     4  0.0000      1.000 0.000 0.000 0.000  1  0
#> SRR1377219     4  0.0000      1.000 0.000 0.000 0.000  1  0
#> SRR1377220     4  0.0000      1.000 0.000 0.000 0.000  1  0
#> SRR1377221     4  0.0000      1.000 0.000 0.000 0.000  1  0
#> SRR1377222     4  0.0000      1.000 0.000 0.000 0.000  1  0
#> SRR1377223     4  0.0000      1.000 0.000 0.000 0.000  1  0
#> SRR1377224     4  0.0000      1.000 0.000 0.000 0.000  1  0

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>            class entropy silhouette p1    p2 p3 p4 p5    p6
#> SRR1377145     2  0.2003      0.570  0 0.884  0  0  0 0.116
#> SRR1377146     2  0.2135      0.570  0 0.872  0  0  0 0.128
#> SRR1377147     2  0.2003      0.570  0 0.884  0  0  0 0.116
#> SRR1377148     2  0.2003      0.570  0 0.884  0  0  0 0.116
#> SRR1377153     2  0.2260      0.641  0 0.860  0  0  0 0.140
#> SRR1377154     2  0.2135      0.628  0 0.872  0  0  0 0.128
#> SRR1377155     2  0.1204      0.640  0 0.944  0  0  0 0.056
#> SRR1377156     2  0.2178      0.629  0 0.868  0  0  0 0.132
#> SRR1377149     2  0.0937      0.656  0 0.960  0  0  0 0.040
#> SRR1377150     2  0.1007      0.647  0 0.956  0  0  0 0.044
#> SRR1377151     2  0.1501      0.633  0 0.924  0  0  0 0.076
#> SRR1377152     2  0.1075      0.654  0 0.952  0  0  0 0.048
#> SRR1377157     3  0.0000      1.000  0 0.000  1  0  0 0.000
#> SRR1377158     3  0.0000      1.000  0 0.000  1  0  0 0.000
#> SRR1377159     3  0.0000      1.000  0 0.000  1  0  0 0.000
#> SRR1377160     3  0.0000      1.000  0 0.000  1  0  0 0.000
#> SRR1377161     3  0.0000      1.000  0 0.000  1  0  0 0.000
#> SRR1377162     3  0.0000      1.000  0 0.000  1  0  0 0.000
#> SRR1377163     3  0.0000      1.000  0 0.000  1  0  0 0.000
#> SRR1377164     3  0.0000      1.000  0 0.000  1  0  0 0.000
#> SRR1377169     3  0.0000      1.000  0 0.000  1  0  0 0.000
#> SRR1377170     3  0.0000      1.000  0 0.000  1  0  0 0.000
#> SRR1377171     3  0.0000      1.000  0 0.000  1  0  0 0.000
#> SRR1377172     3  0.0000      1.000  0 0.000  1  0  0 0.000
#> SRR1377165     3  0.0000      1.000  0 0.000  1  0  0 0.000
#> SRR1377166     3  0.0000      1.000  0 0.000  1  0  0 0.000
#> SRR1377167     3  0.0000      1.000  0 0.000  1  0  0 0.000
#> SRR1377168     3  0.0000      1.000  0 0.000  1  0  0 0.000
#> SRR1377173     1  0.0000      1.000  1 0.000  0  0  0 0.000
#> SRR1377174     1  0.0000      1.000  1 0.000  0  0  0 0.000
#> SRR1377175     1  0.0000      1.000  1 0.000  0  0  0 0.000
#> SRR1377176     1  0.0000      1.000  1 0.000  0  0  0 0.000
#> SRR1377177     1  0.0000      1.000  1 0.000  0  0  0 0.000
#> SRR1377178     1  0.0000      1.000  1 0.000  0  0  0 0.000
#> SRR1377179     1  0.0000      1.000  1 0.000  0  0  0 0.000
#> SRR1377180     1  0.0000      1.000  1 0.000  0  0  0 0.000
#> SRR1377181     1  0.0000      1.000  1 0.000  0  0  0 0.000
#> SRR1377182     1  0.0000      1.000  1 0.000  0  0  0 0.000
#> SRR1377183     1  0.0000      1.000  1 0.000  0  0  0 0.000
#> SRR1377184     1  0.0000      1.000  1 0.000  0  0  0 0.000
#> SRR1377185     1  0.0000      1.000  1 0.000  0  0  0 0.000
#> SRR1377186     1  0.0000      1.000  1 0.000  0  0  0 0.000
#> SRR1377187     1  0.0000      1.000  1 0.000  0  0  0 0.000
#> SRR1377188     1  0.0000      1.000  1 0.000  0  0  0 0.000
#> SRR1377189     2  0.3428      0.559  0 0.696  0  0  0 0.304
#> SRR1377190     2  0.3428      0.559  0 0.696  0  0  0 0.304
#> SRR1377191     2  0.3428      0.559  0 0.696  0  0  0 0.304
#> SRR1377192     2  0.3428      0.559  0 0.696  0  0  0 0.304
#> SRR1377193     2  0.3428      0.559  0 0.696  0  0  0 0.304
#> SRR1377194     2  0.3428      0.559  0 0.696  0  0  0 0.304
#> SRR1377195     5  0.0000      1.000  0 0.000  0  0  1 0.000
#> SRR1377196     5  0.0000      1.000  0 0.000  0  0  1 0.000
#> SRR1377197     5  0.0000      1.000  0 0.000  0  0  1 0.000
#> SRR1377198     5  0.0000      1.000  0 0.000  0  0  1 0.000
#> SRR1377199     5  0.0000      1.000  0 0.000  0  0  1 0.000
#> SRR1377200     5  0.0000      1.000  0 0.000  0  0  1 0.000
#> SRR1377201     2  0.3531      0.513  0 0.672  0  0  0 0.328
#> SRR1377202     2  0.3531      0.513  0 0.672  0  0  0 0.328
#> SRR1377203     2  0.3531      0.513  0 0.672  0  0  0 0.328
#> SRR1377204     6  0.3330      1.000  0 0.284  0  0  0 0.716
#> SRR1377205     6  0.3330      1.000  0 0.284  0  0  0 0.716
#> SRR1377206     6  0.3330      1.000  0 0.284  0  0  0 0.716
#> SRR1377207     2  0.3531      0.513  0 0.672  0  0  0 0.328
#> SRR1377208     2  0.3531      0.513  0 0.672  0  0  0 0.328
#> SRR1377209     2  0.3531      0.513  0 0.672  0  0  0 0.328
#> SRR1377210     2  0.3531      0.513  0 0.672  0  0  0 0.328
#> SRR1377211     2  0.3531      0.513  0 0.672  0  0  0 0.328
#> SRR1377212     2  0.3531      0.513  0 0.672  0  0  0 0.328
#> SRR1377213     4  0.0000      1.000  0 0.000  0  1  0 0.000
#> SRR1377214     4  0.0000      1.000  0 0.000  0  1  0 0.000
#> SRR1377215     4  0.0000      1.000  0 0.000  0  1  0 0.000
#> SRR1377216     4  0.0000      1.000  0 0.000  0  1  0 0.000
#> SRR1377217     4  0.0000      1.000  0 0.000  0  1  0 0.000
#> SRR1377218     4  0.0000      1.000  0 0.000  0  1  0 0.000
#> SRR1377219     4  0.0000      1.000  0 0.000  0  1  0 0.000
#> SRR1377220     4  0.0000      1.000  0 0.000  0  1  0 0.000
#> SRR1377221     4  0.0000      1.000  0 0.000  0  1  0 0.000
#> SRR1377222     4  0.0000      1.000  0 0.000  0  1  0 0.000
#> SRR1377223     4  0.0000      1.000  0 0.000  0  1  0 0.000
#> SRR1377224     4  0.0000      1.000  0 0.000  0  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-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 13890 rows and 80 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.432           0.534       0.803          0.429 0.585   0.585
#> 3 3 0.573           0.847       0.879          0.427 0.618   0.432
#> 4 4 0.958           0.955       0.979          0.105 0.943   0.849
#> 5 5 0.945           0.920       0.952          0.113 0.932   0.787
#> 6 6 0.969           0.960       0.976          0.101 0.919   0.678

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

There is also optional best \(k\) = 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
#> SRR1377145     1  0.0000      0.665 1.000 0.000
#> SRR1377146     1  0.0000      0.665 1.000 0.000
#> SRR1377147     1  0.0000      0.665 1.000 0.000
#> SRR1377148     1  0.0000      0.665 1.000 0.000
#> SRR1377153     1  0.0000      0.665 1.000 0.000
#> SRR1377154     1  0.0000      0.665 1.000 0.000
#> SRR1377155     1  0.0000      0.665 1.000 0.000
#> SRR1377156     1  0.0000      0.665 1.000 0.000
#> SRR1377149     1  0.0000      0.665 1.000 0.000
#> SRR1377150     1  0.0000      0.665 1.000 0.000
#> SRR1377151     1  0.0000      0.665 1.000 0.000
#> SRR1377152     1  0.0000      0.665 1.000 0.000
#> SRR1377157     2  0.0000      0.710 0.000 1.000
#> SRR1377158     2  0.0000      0.710 0.000 1.000
#> SRR1377159     2  0.0000      0.710 0.000 1.000
#> SRR1377160     2  0.0000      0.710 0.000 1.000
#> SRR1377161     2  0.0000      0.710 0.000 1.000
#> SRR1377162     2  0.0000      0.710 0.000 1.000
#> SRR1377163     2  0.0000      0.710 0.000 1.000
#> SRR1377164     2  0.0000      0.710 0.000 1.000
#> SRR1377169     2  0.0000      0.710 0.000 1.000
#> SRR1377170     2  0.0000      0.710 0.000 1.000
#> SRR1377171     2  0.0000      0.710 0.000 1.000
#> SRR1377172     2  0.0000      0.710 0.000 1.000
#> SRR1377165     2  0.0000      0.710 0.000 1.000
#> SRR1377166     2  0.0000      0.710 0.000 1.000
#> SRR1377167     2  0.0000      0.710 0.000 1.000
#> SRR1377168     2  0.0000      0.710 0.000 1.000
#> SRR1377173     2  0.0000      0.710 0.000 1.000
#> SRR1377174     2  0.0000      0.710 0.000 1.000
#> SRR1377175     2  0.0000      0.710 0.000 1.000
#> SRR1377176     2  0.0000      0.710 0.000 1.000
#> SRR1377177     2  0.0000      0.710 0.000 1.000
#> SRR1377178     2  0.0000      0.710 0.000 1.000
#> SRR1377179     2  0.0000      0.710 0.000 1.000
#> SRR1377180     2  0.0000      0.710 0.000 1.000
#> SRR1377181     2  0.0000      0.710 0.000 1.000
#> SRR1377182     2  0.0000      0.710 0.000 1.000
#> SRR1377183     2  0.0376      0.709 0.004 0.996
#> SRR1377184     2  0.0000      0.710 0.000 1.000
#> SRR1377185     2  0.0376      0.709 0.004 0.996
#> SRR1377186     2  0.0376      0.709 0.004 0.996
#> SRR1377187     2  0.0000      0.710 0.000 1.000
#> SRR1377188     2  0.0376      0.709 0.004 0.996
#> SRR1377189     1  0.9996     -0.327 0.512 0.488
#> SRR1377190     2  1.0000      0.325 0.496 0.504
#> SRR1377191     1  1.0000     -0.356 0.500 0.500
#> SRR1377192     2  0.9850      0.468 0.428 0.572
#> SRR1377193     2  0.9850      0.468 0.428 0.572
#> SRR1377194     2  0.9850      0.468 0.428 0.572
#> SRR1377195     1  0.9775      0.392 0.588 0.412
#> SRR1377196     1  0.9775      0.392 0.588 0.412
#> SRR1377197     1  0.9775      0.392 0.588 0.412
#> SRR1377198     1  0.9775      0.392 0.588 0.412
#> SRR1377199     1  0.9775      0.392 0.588 0.412
#> SRR1377200     1  0.9775      0.392 0.588 0.412
#> SRR1377201     2  0.9998      0.316 0.492 0.508
#> SRR1377202     2  1.0000      0.309 0.496 0.504
#> SRR1377203     2  0.9983      0.341 0.476 0.524
#> SRR1377204     2  0.9795      0.487 0.416 0.584
#> SRR1377205     2  0.9795      0.487 0.416 0.584
#> SRR1377206     2  0.9795      0.487 0.416 0.584
#> SRR1377207     2  0.9933      0.384 0.452 0.548
#> SRR1377208     2  0.9754      0.459 0.408 0.592
#> SRR1377209     2  0.9933      0.381 0.452 0.548
#> SRR1377210     1  0.9983     -0.298 0.524 0.476
#> SRR1377211     1  0.9983     -0.298 0.524 0.476
#> SRR1377212     1  0.9983     -0.298 0.524 0.476
#> SRR1377213     2  0.9795      0.487 0.416 0.584
#> SRR1377214     2  0.9795      0.487 0.416 0.584
#> SRR1377215     2  0.9795      0.487 0.416 0.584
#> SRR1377216     2  0.9795      0.487 0.416 0.584
#> SRR1377217     2  0.9795      0.487 0.416 0.584
#> SRR1377218     2  0.9795      0.487 0.416 0.584
#> SRR1377219     2  0.9795      0.487 0.416 0.584
#> SRR1377220     2  0.9795      0.487 0.416 0.584
#> SRR1377221     2  0.9795      0.487 0.416 0.584
#> SRR1377222     2  0.9795      0.487 0.416 0.584
#> SRR1377223     2  0.9795      0.487 0.416 0.584
#> SRR1377224     2  0.9795      0.487 0.416 0.584

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>            class entropy silhouette    p1    p2    p3
#> SRR1377145     1   0.000      1.000 1.000 0.000 0.000
#> SRR1377146     1   0.000      1.000 1.000 0.000 0.000
#> SRR1377147     1   0.000      1.000 1.000 0.000 0.000
#> SRR1377148     1   0.000      1.000 1.000 0.000 0.000
#> SRR1377153     1   0.000      1.000 1.000 0.000 0.000
#> SRR1377154     1   0.000      1.000 1.000 0.000 0.000
#> SRR1377155     1   0.000      1.000 1.000 0.000 0.000
#> SRR1377156     1   0.000      1.000 1.000 0.000 0.000
#> SRR1377149     1   0.000      1.000 1.000 0.000 0.000
#> SRR1377150     1   0.000      1.000 1.000 0.000 0.000
#> SRR1377151     1   0.000      1.000 1.000 0.000 0.000
#> SRR1377152     1   0.000      1.000 1.000 0.000 0.000
#> SRR1377157     3   0.000      0.973 0.000 0.000 1.000
#> SRR1377158     3   0.000      0.973 0.000 0.000 1.000
#> SRR1377159     3   0.000      0.973 0.000 0.000 1.000
#> SRR1377160     3   0.000      0.973 0.000 0.000 1.000
#> SRR1377161     3   0.000      0.973 0.000 0.000 1.000
#> SRR1377162     3   0.000      0.973 0.000 0.000 1.000
#> SRR1377163     3   0.000      0.973 0.000 0.000 1.000
#> SRR1377164     3   0.000      0.973 0.000 0.000 1.000
#> SRR1377169     3   0.000      0.973 0.000 0.000 1.000
#> SRR1377170     3   0.000      0.973 0.000 0.000 1.000
#> SRR1377171     3   0.000      0.973 0.000 0.000 1.000
#> SRR1377172     3   0.000      0.973 0.000 0.000 1.000
#> SRR1377165     3   0.000      0.973 0.000 0.000 1.000
#> SRR1377166     3   0.000      0.973 0.000 0.000 1.000
#> SRR1377167     3   0.000      0.973 0.000 0.000 1.000
#> SRR1377168     3   0.000      0.973 0.000 0.000 1.000
#> SRR1377173     3   0.000      0.973 0.000 0.000 1.000
#> SRR1377174     3   0.000      0.973 0.000 0.000 1.000
#> SRR1377175     3   0.000      0.973 0.000 0.000 1.000
#> SRR1377176     3   0.000      0.973 0.000 0.000 1.000
#> SRR1377177     3   0.000      0.973 0.000 0.000 1.000
#> SRR1377178     3   0.000      0.973 0.000 0.000 1.000
#> SRR1377179     3   0.000      0.973 0.000 0.000 1.000
#> SRR1377180     3   0.000      0.973 0.000 0.000 1.000
#> SRR1377181     3   0.000      0.973 0.000 0.000 1.000
#> SRR1377182     3   0.000      0.973 0.000 0.000 1.000
#> SRR1377183     3   0.400      0.771 0.000 0.160 0.840
#> SRR1377184     3   0.000      0.973 0.000 0.000 1.000
#> SRR1377185     3   0.400      0.771 0.000 0.160 0.840
#> SRR1377186     3   0.400      0.771 0.000 0.160 0.840
#> SRR1377187     3   0.000      0.973 0.000 0.000 1.000
#> SRR1377188     3   0.406      0.764 0.000 0.164 0.836
#> SRR1377189     2   0.661      0.771 0.236 0.716 0.048
#> SRR1377190     2   0.661      0.771 0.236 0.716 0.048
#> SRR1377191     2   0.661      0.771 0.236 0.716 0.048
#> SRR1377192     2   0.676      0.773 0.224 0.716 0.060
#> SRR1377193     2   0.676      0.773 0.224 0.716 0.060
#> SRR1377194     2   0.703      0.774 0.196 0.716 0.088
#> SRR1377195     2   0.574      0.512 0.012 0.732 0.256
#> SRR1377196     2   0.574      0.512 0.012 0.732 0.256
#> SRR1377197     2   0.574      0.512 0.012 0.732 0.256
#> SRR1377198     2   0.574      0.512 0.012 0.732 0.256
#> SRR1377199     2   0.574      0.512 0.012 0.732 0.256
#> SRR1377200     2   0.574      0.512 0.012 0.732 0.256
#> SRR1377201     2   0.661      0.771 0.236 0.716 0.048
#> SRR1377202     2   0.661      0.771 0.236 0.716 0.048
#> SRR1377203     2   0.661      0.771 0.236 0.716 0.048
#> SRR1377204     2   0.678      0.697 0.052 0.704 0.244
#> SRR1377205     2   0.678      0.697 0.052 0.704 0.244
#> SRR1377206     2   0.678      0.697 0.052 0.704 0.244
#> SRR1377207     2   0.722      0.763 0.140 0.716 0.144
#> SRR1377208     2   0.715      0.751 0.108 0.716 0.176
#> SRR1377209     2   0.722      0.766 0.152 0.716 0.132
#> SRR1377210     2   0.661      0.771 0.236 0.716 0.048
#> SRR1377211     2   0.661      0.771 0.236 0.716 0.048
#> SRR1377212     2   0.661      0.771 0.236 0.716 0.048
#> SRR1377213     2   0.531      0.759 0.216 0.772 0.012
#> SRR1377214     2   0.531      0.759 0.216 0.772 0.012
#> SRR1377215     2   0.531      0.759 0.216 0.772 0.012
#> SRR1377216     2   0.518      0.702 0.000 0.744 0.256
#> SRR1377217     2   0.518      0.702 0.000 0.744 0.256
#> SRR1377218     2   0.518      0.702 0.000 0.744 0.256
#> SRR1377219     2   0.541      0.757 0.224 0.764 0.012
#> SRR1377220     2   0.541      0.757 0.224 0.764 0.012
#> SRR1377221     2   0.541      0.757 0.224 0.764 0.012
#> SRR1377222     2   0.176      0.690 0.040 0.956 0.004
#> SRR1377223     2   0.176      0.690 0.040 0.956 0.004
#> SRR1377224     2   0.176      0.690 0.040 0.956 0.004

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette p1    p2    p3 p4
#> SRR1377145     4  0.0000      1.000  0 0.000 0.000  1
#> SRR1377146     4  0.0000      1.000  0 0.000 0.000  1
#> SRR1377147     4  0.0000      1.000  0 0.000 0.000  1
#> SRR1377148     4  0.0000      1.000  0 0.000 0.000  1
#> SRR1377153     4  0.0000      1.000  0 0.000 0.000  1
#> SRR1377154     4  0.0000      1.000  0 0.000 0.000  1
#> SRR1377155     4  0.0000      1.000  0 0.000 0.000  1
#> SRR1377156     4  0.0000      1.000  0 0.000 0.000  1
#> SRR1377149     4  0.0000      1.000  0 0.000 0.000  1
#> SRR1377150     4  0.0000      1.000  0 0.000 0.000  1
#> SRR1377151     4  0.0000      1.000  0 0.000 0.000  1
#> SRR1377152     4  0.0000      1.000  0 0.000 0.000  1
#> SRR1377157     3  0.0000      0.960  0 0.000 1.000  0
#> SRR1377158     3  0.0000      0.960  0 0.000 1.000  0
#> SRR1377159     3  0.0000      0.960  0 0.000 1.000  0
#> SRR1377160     3  0.0000      0.960  0 0.000 1.000  0
#> SRR1377161     3  0.0000      0.960  0 0.000 1.000  0
#> SRR1377162     3  0.0000      0.960  0 0.000 1.000  0
#> SRR1377163     3  0.0000      0.960  0 0.000 1.000  0
#> SRR1377164     3  0.0000      0.960  0 0.000 1.000  0
#> SRR1377169     3  0.0000      0.960  0 0.000 1.000  0
#> SRR1377170     3  0.0000      0.960  0 0.000 1.000  0
#> SRR1377171     3  0.0000      0.960  0 0.000 1.000  0
#> SRR1377172     3  0.0000      0.960  0 0.000 1.000  0
#> SRR1377165     3  0.0000      0.960  0 0.000 1.000  0
#> SRR1377166     3  0.0000      0.960  0 0.000 1.000  0
#> SRR1377167     3  0.0000      0.960  0 0.000 1.000  0
#> SRR1377168     3  0.0000      0.960  0 0.000 1.000  0
#> SRR1377173     3  0.0000      0.960  0 0.000 1.000  0
#> SRR1377174     3  0.0000      0.960  0 0.000 1.000  0
#> SRR1377175     3  0.0000      0.960  0 0.000 1.000  0
#> SRR1377176     3  0.0000      0.960  0 0.000 1.000  0
#> SRR1377177     3  0.0000      0.960  0 0.000 1.000  0
#> SRR1377178     3  0.0000      0.960  0 0.000 1.000  0
#> SRR1377179     3  0.0000      0.960  0 0.000 1.000  0
#> SRR1377180     3  0.0000      0.960  0 0.000 1.000  0
#> SRR1377181     3  0.0000      0.960  0 0.000 1.000  0
#> SRR1377182     3  0.0000      0.960  0 0.000 1.000  0
#> SRR1377183     3  0.3942      0.685  0 0.236 0.764  0
#> SRR1377184     3  0.0000      0.960  0 0.000 1.000  0
#> SRR1377185     3  0.3942      0.685  0 0.236 0.764  0
#> SRR1377186     3  0.3942      0.685  0 0.236 0.764  0
#> SRR1377187     3  0.0000      0.960  0 0.000 1.000  0
#> SRR1377188     3  0.3942      0.685  0 0.236 0.764  0
#> SRR1377189     2  0.1118      0.966  0 0.964 0.036  0
#> SRR1377190     2  0.1118      0.966  0 0.964 0.036  0
#> SRR1377191     2  0.1118      0.966  0 0.964 0.036  0
#> SRR1377192     2  0.1118      0.966  0 0.964 0.036  0
#> SRR1377193     2  0.1118      0.966  0 0.964 0.036  0
#> SRR1377194     2  0.0921      0.967  0 0.972 0.028  0
#> SRR1377195     1  0.0000      1.000  1 0.000 0.000  0
#> SRR1377196     1  0.0000      1.000  1 0.000 0.000  0
#> SRR1377197     1  0.0000      1.000  1 0.000 0.000  0
#> SRR1377198     1  0.0000      1.000  1 0.000 0.000  0
#> SRR1377199     1  0.0000      1.000  1 0.000 0.000  0
#> SRR1377200     1  0.0000      1.000  1 0.000 0.000  0
#> SRR1377201     2  0.1118      0.966  0 0.964 0.036  0
#> SRR1377202     2  0.1118      0.966  0 0.964 0.036  0
#> SRR1377203     2  0.1118      0.966  0 0.964 0.036  0
#> SRR1377204     2  0.0000      0.968  0 1.000 0.000  0
#> SRR1377205     2  0.0000      0.968  0 1.000 0.000  0
#> SRR1377206     2  0.0000      0.968  0 1.000 0.000  0
#> SRR1377207     2  0.2345      0.899  0 0.900 0.100  0
#> SRR1377208     2  0.2345      0.899  0 0.900 0.100  0
#> SRR1377209     2  0.2345      0.899  0 0.900 0.100  0
#> SRR1377210     2  0.1118      0.966  0 0.964 0.036  0
#> SRR1377211     2  0.1118      0.966  0 0.964 0.036  0
#> SRR1377212     2  0.1118      0.966  0 0.964 0.036  0
#> SRR1377213     2  0.0000      0.968  0 1.000 0.000  0
#> SRR1377214     2  0.0000      0.968  0 1.000 0.000  0
#> SRR1377215     2  0.0000      0.968  0 1.000 0.000  0
#> SRR1377216     2  0.0188      0.967  0 0.996 0.004  0
#> SRR1377217     2  0.0188      0.967  0 0.996 0.004  0
#> SRR1377218     2  0.0188      0.967  0 0.996 0.004  0
#> SRR1377219     2  0.0000      0.968  0 1.000 0.000  0
#> SRR1377220     2  0.0000      0.968  0 1.000 0.000  0
#> SRR1377221     2  0.0000      0.968  0 1.000 0.000  0
#> SRR1377222     2  0.0000      0.968  0 1.000 0.000  0
#> SRR1377223     2  0.0000      0.968  0 1.000 0.000  0
#> SRR1377224     2  0.0000      0.968  0 1.000 0.000  0

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>            class entropy silhouette p1    p2    p3    p4 p5
#> SRR1377145     1  0.0000      1.000  1 0.000 0.000 0.000  0
#> SRR1377146     1  0.0000      1.000  1 0.000 0.000 0.000  0
#> SRR1377147     1  0.0000      1.000  1 0.000 0.000 0.000  0
#> SRR1377148     1  0.0000      1.000  1 0.000 0.000 0.000  0
#> SRR1377153     1  0.0000      1.000  1 0.000 0.000 0.000  0
#> SRR1377154     1  0.0000      1.000  1 0.000 0.000 0.000  0
#> SRR1377155     1  0.0000      1.000  1 0.000 0.000 0.000  0
#> SRR1377156     1  0.0000      1.000  1 0.000 0.000 0.000  0
#> SRR1377149     1  0.0000      1.000  1 0.000 0.000 0.000  0
#> SRR1377150     1  0.0000      1.000  1 0.000 0.000 0.000  0
#> SRR1377151     1  0.0000      1.000  1 0.000 0.000 0.000  0
#> SRR1377152     1  0.0000      1.000  1 0.000 0.000 0.000  0
#> SRR1377157     3  0.1197      0.932  0 0.000 0.952 0.048  0
#> SRR1377158     3  0.1197      0.932  0 0.000 0.952 0.048  0
#> SRR1377159     3  0.1197      0.932  0 0.000 0.952 0.048  0
#> SRR1377160     3  0.1197      0.932  0 0.000 0.952 0.048  0
#> SRR1377161     3  0.1121      0.935  0 0.000 0.956 0.044  0
#> SRR1377162     3  0.1121      0.935  0 0.000 0.956 0.044  0
#> SRR1377163     3  0.1121      0.935  0 0.000 0.956 0.044  0
#> SRR1377164     3  0.1121      0.935  0 0.000 0.956 0.044  0
#> SRR1377169     3  0.0000      0.947  0 0.000 1.000 0.000  0
#> SRR1377170     3  0.0000      0.947  0 0.000 1.000 0.000  0
#> SRR1377171     3  0.0000      0.947  0 0.000 1.000 0.000  0
#> SRR1377172     3  0.0000      0.947  0 0.000 1.000 0.000  0
#> SRR1377165     3  0.0000      0.947  0 0.000 1.000 0.000  0
#> SRR1377166     3  0.0000      0.947  0 0.000 1.000 0.000  0
#> SRR1377167     3  0.0000      0.947  0 0.000 1.000 0.000  0
#> SRR1377168     3  0.0000      0.947  0 0.000 1.000 0.000  0
#> SRR1377173     3  0.0963      0.949  0 0.000 0.964 0.036  0
#> SRR1377174     3  0.0963      0.949  0 0.000 0.964 0.036  0
#> SRR1377175     3  0.0963      0.949  0 0.000 0.964 0.036  0
#> SRR1377176     3  0.0963      0.949  0 0.000 0.964 0.036  0
#> SRR1377177     3  0.0963      0.949  0 0.000 0.964 0.036  0
#> SRR1377178     3  0.0963      0.949  0 0.000 0.964 0.036  0
#> SRR1377179     3  0.0963      0.949  0 0.000 0.964 0.036  0
#> SRR1377180     3  0.0963      0.949  0 0.000 0.964 0.036  0
#> SRR1377181     3  0.0963      0.949  0 0.000 0.964 0.036  0
#> SRR1377182     3  0.0963      0.949  0 0.000 0.964 0.036  0
#> SRR1377183     3  0.3975      0.809  0 0.064 0.792 0.144  0
#> SRR1377184     3  0.0963      0.949  0 0.000 0.964 0.036  0
#> SRR1377185     3  0.3975      0.809  0 0.064 0.792 0.144  0
#> SRR1377186     3  0.3975      0.809  0 0.064 0.792 0.144  0
#> SRR1377187     3  0.0963      0.949  0 0.000 0.964 0.036  0
#> SRR1377188     3  0.3975      0.809  0 0.064 0.792 0.144  0
#> SRR1377189     2  0.0510      0.894  0 0.984 0.000 0.016  0
#> SRR1377190     2  0.0703      0.893  0 0.976 0.000 0.024  0
#> SRR1377191     2  0.0510      0.894  0 0.984 0.000 0.016  0
#> SRR1377192     2  0.0703      0.893  0 0.976 0.000 0.024  0
#> SRR1377193     2  0.0609      0.894  0 0.980 0.000 0.020  0
#> SRR1377194     2  0.0963      0.883  0 0.964 0.000 0.036  0
#> SRR1377195     5  0.0000      1.000  0 0.000 0.000 0.000  1
#> SRR1377196     5  0.0000      1.000  0 0.000 0.000 0.000  1
#> SRR1377197     5  0.0000      1.000  0 0.000 0.000 0.000  1
#> SRR1377198     5  0.0000      1.000  0 0.000 0.000 0.000  1
#> SRR1377199     5  0.0000      1.000  0 0.000 0.000 0.000  1
#> SRR1377200     5  0.0000      1.000  0 0.000 0.000 0.000  1
#> SRR1377201     2  0.0000      0.895  0 1.000 0.000 0.000  0
#> SRR1377202     2  0.0000      0.895  0 1.000 0.000 0.000  0
#> SRR1377203     2  0.0000      0.895  0 1.000 0.000 0.000  0
#> SRR1377204     2  0.4291      0.209  0 0.536 0.000 0.464  0
#> SRR1377205     2  0.4291      0.209  0 0.536 0.000 0.464  0
#> SRR1377206     2  0.4291      0.209  0 0.536 0.000 0.464  0
#> SRR1377207     2  0.0000      0.895  0 1.000 0.000 0.000  0
#> SRR1377208     2  0.0000      0.895  0 1.000 0.000 0.000  0
#> SRR1377209     2  0.0000      0.895  0 1.000 0.000 0.000  0
#> SRR1377210     2  0.0290      0.895  0 0.992 0.000 0.008  0
#> SRR1377211     2  0.0290      0.895  0 0.992 0.000 0.008  0
#> SRR1377212     2  0.0290      0.895  0 0.992 0.000 0.008  0
#> SRR1377213     4  0.0963      0.996  0 0.036 0.000 0.964  0
#> SRR1377214     4  0.0963      0.996  0 0.036 0.000 0.964  0
#> SRR1377215     4  0.0963      0.996  0 0.036 0.000 0.964  0
#> SRR1377216     4  0.1282      0.988  0 0.044 0.004 0.952  0
#> SRR1377217     4  0.1282      0.988  0 0.044 0.004 0.952  0
#> SRR1377218     4  0.1282      0.988  0 0.044 0.004 0.952  0
#> SRR1377219     4  0.0963      0.996  0 0.036 0.000 0.964  0
#> SRR1377220     4  0.0963      0.996  0 0.036 0.000 0.964  0
#> SRR1377221     4  0.0963      0.996  0 0.036 0.000 0.964  0
#> SRR1377222     4  0.0963      0.996  0 0.036 0.000 0.964  0
#> SRR1377223     4  0.0963      0.996  0 0.036 0.000 0.964  0
#> SRR1377224     4  0.0963      0.996  0 0.036 0.000 0.964  0

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>            class entropy silhouette    p1    p2    p3    p4 p5 p6
#> SRR1377145     6  0.0000      1.000 0.000 0.000 0.000 0.000  0  1
#> SRR1377146     6  0.0000      1.000 0.000 0.000 0.000 0.000  0  1
#> SRR1377147     6  0.0000      1.000 0.000 0.000 0.000 0.000  0  1
#> SRR1377148     6  0.0000      1.000 0.000 0.000 0.000 0.000  0  1
#> SRR1377153     6  0.0000      1.000 0.000 0.000 0.000 0.000  0  1
#> SRR1377154     6  0.0000      1.000 0.000 0.000 0.000 0.000  0  1
#> SRR1377155     6  0.0000      1.000 0.000 0.000 0.000 0.000  0  1
#> SRR1377156     6  0.0000      1.000 0.000 0.000 0.000 0.000  0  1
#> SRR1377149     6  0.0000      1.000 0.000 0.000 0.000 0.000  0  1
#> SRR1377150     6  0.0000      1.000 0.000 0.000 0.000 0.000  0  1
#> SRR1377151     6  0.0000      1.000 0.000 0.000 0.000 0.000  0  1
#> SRR1377152     6  0.0000      1.000 0.000 0.000 0.000 0.000  0  1
#> SRR1377157     3  0.0000      0.980 0.000 0.000 1.000 0.000  0  0
#> SRR1377158     3  0.0000      0.980 0.000 0.000 1.000 0.000  0  0
#> SRR1377159     3  0.0000      0.980 0.000 0.000 1.000 0.000  0  0
#> SRR1377160     3  0.0000      0.980 0.000 0.000 1.000 0.000  0  0
#> SRR1377161     3  0.0000      0.980 0.000 0.000 1.000 0.000  0  0
#> SRR1377162     3  0.0000      0.980 0.000 0.000 1.000 0.000  0  0
#> SRR1377163     3  0.0000      0.980 0.000 0.000 1.000 0.000  0  0
#> SRR1377164     3  0.0000      0.980 0.000 0.000 1.000 0.000  0  0
#> SRR1377169     3  0.1327      0.938 0.064 0.000 0.936 0.000  0  0
#> SRR1377170     3  0.1327      0.938 0.064 0.000 0.936 0.000  0  0
#> SRR1377171     3  0.1327      0.938 0.064 0.000 0.936 0.000  0  0
#> SRR1377172     3  0.1267      0.940 0.060 0.000 0.940 0.000  0  0
#> SRR1377165     3  0.0000      0.980 0.000 0.000 1.000 0.000  0  0
#> SRR1377166     3  0.0000      0.980 0.000 0.000 1.000 0.000  0  0
#> SRR1377167     3  0.0000      0.980 0.000 0.000 1.000 0.000  0  0
#> SRR1377168     3  0.0000      0.980 0.000 0.000 1.000 0.000  0  0
#> SRR1377173     1  0.0000      0.932 1.000 0.000 0.000 0.000  0  0
#> SRR1377174     1  0.0000      0.932 1.000 0.000 0.000 0.000  0  0
#> SRR1377175     1  0.0000      0.932 1.000 0.000 0.000 0.000  0  0
#> SRR1377176     1  0.0000      0.932 1.000 0.000 0.000 0.000  0  0
#> SRR1377177     1  0.0000      0.932 1.000 0.000 0.000 0.000  0  0
#> SRR1377178     1  0.0000      0.932 1.000 0.000 0.000 0.000  0  0
#> SRR1377179     1  0.0000      0.932 1.000 0.000 0.000 0.000  0  0
#> SRR1377180     1  0.0000      0.932 1.000 0.000 0.000 0.000  0  0
#> SRR1377181     1  0.1267      0.898 0.940 0.000 0.060 0.000  0  0
#> SRR1377182     1  0.1204      0.901 0.944 0.000 0.056 0.000  0  0
#> SRR1377183     1  0.3951      0.822 0.796 0.036 0.112 0.056  0  0
#> SRR1377184     1  0.0363      0.928 0.988 0.000 0.012 0.000  0  0
#> SRR1377185     1  0.3951      0.822 0.796 0.036 0.112 0.056  0  0
#> SRR1377186     1  0.3951      0.822 0.796 0.036 0.112 0.056  0  0
#> SRR1377187     1  0.0260      0.930 0.992 0.000 0.008 0.000  0  0
#> SRR1377188     1  0.3951      0.822 0.796 0.036 0.112 0.056  0  0
#> SRR1377189     2  0.0547      0.960 0.000 0.980 0.000 0.020  0  0
#> SRR1377190     2  0.0713      0.958 0.000 0.972 0.000 0.028  0  0
#> SRR1377191     2  0.0458      0.960 0.000 0.984 0.000 0.016  0  0
#> SRR1377192     2  0.0713      0.958 0.000 0.972 0.000 0.028  0  0
#> SRR1377193     2  0.0632      0.959 0.000 0.976 0.000 0.024  0  0
#> SRR1377194     2  0.0713      0.955 0.000 0.972 0.000 0.028  0  0
#> SRR1377195     5  0.0000      1.000 0.000 0.000 0.000 0.000  1  0
#> SRR1377196     5  0.0000      1.000 0.000 0.000 0.000 0.000  1  0
#> SRR1377197     5  0.0000      1.000 0.000 0.000 0.000 0.000  1  0
#> SRR1377198     5  0.0000      1.000 0.000 0.000 0.000 0.000  1  0
#> SRR1377199     5  0.0000      1.000 0.000 0.000 0.000 0.000  1  0
#> SRR1377200     5  0.0000      1.000 0.000 0.000 0.000 0.000  1  0
#> SRR1377201     2  0.0000      0.959 0.000 1.000 0.000 0.000  0  0
#> SRR1377202     2  0.0000      0.959 0.000 1.000 0.000 0.000  0  0
#> SRR1377203     2  0.0000      0.959 0.000 1.000 0.000 0.000  0  0
#> SRR1377204     2  0.2416      0.854 0.000 0.844 0.000 0.156  0  0
#> SRR1377205     2  0.2416      0.854 0.000 0.844 0.000 0.156  0  0
#> SRR1377206     2  0.2416      0.854 0.000 0.844 0.000 0.156  0  0
#> SRR1377207     2  0.0000      0.959 0.000 1.000 0.000 0.000  0  0
#> SRR1377208     2  0.0000      0.959 0.000 1.000 0.000 0.000  0  0
#> SRR1377209     2  0.0000      0.959 0.000 1.000 0.000 0.000  0  0
#> SRR1377210     2  0.0363      0.960 0.000 0.988 0.000 0.012  0  0
#> SRR1377211     2  0.0363      0.960 0.000 0.988 0.000 0.012  0  0
#> SRR1377212     2  0.0363      0.960 0.000 0.988 0.000 0.012  0  0
#> SRR1377213     4  0.0000      0.995 0.000 0.000 0.000 1.000  0  0
#> SRR1377214     4  0.0000      0.995 0.000 0.000 0.000 1.000  0  0
#> SRR1377215     4  0.0000      0.995 0.000 0.000 0.000 1.000  0  0
#> SRR1377216     4  0.0508      0.984 0.004 0.012 0.000 0.984  0  0
#> SRR1377217     4  0.0508      0.984 0.004 0.012 0.000 0.984  0  0
#> SRR1377218     4  0.0508      0.984 0.004 0.012 0.000 0.984  0  0
#> SRR1377219     4  0.0000      0.995 0.000 0.000 0.000 1.000  0  0
#> SRR1377220     4  0.0000      0.995 0.000 0.000 0.000 1.000  0  0
#> SRR1377221     4  0.0000      0.995 0.000 0.000 0.000 1.000  0  0
#> SRR1377222     4  0.0000      0.995 0.000 0.000 0.000 1.000  0  0
#> SRR1377223     4  0.0000      0.995 0.000 0.000 0.000 1.000  0  0
#> SRR1377224     4  0.0000      0.995 0.000 0.000 0.000 1.000  0  0

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

consensus_heatmap(res, k = 2)

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

consensus_heatmap(res, k = 3)

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

consensus_heatmap(res, k = 4)

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

consensus_heatmap(res, k = 5)

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

consensus_heatmap(res, k = 6)

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

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

membership_heatmap(res, k = 2)

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

membership_heatmap(res, k = 3)

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

membership_heatmap(res, k = 4)

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

membership_heatmap(res, k = 5)

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

membership_heatmap(res, k = 6)

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

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

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

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

get_signatures(res, k = 3)

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

get_signatures(res, k = 4)

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

get_signatures(res, k = 5)

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

get_signatures(res, k = 6)

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

Signature heatmaps where rows are not scaled:

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

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

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

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

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

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

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

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

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

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

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk CV-mclust-signature_compare

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

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

An example of the output of tb is:

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

The columns in tb are:

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

UMAP plot which shows how samples are separated.

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

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

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

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

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

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

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

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

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

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

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk CV-mclust-collect-classes

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


CV:NMF

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

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

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

res
#> A 'ConsensusPartition' object with k = 2, 3, 4, 5, 6.
#>   On a matrix with 13890 rows and 80 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 3.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

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

collect_plots(res)

plot of chunk CV-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.282           0.599       0.692         0.3716 0.502   0.502
#> 3 3 0.646           0.902       0.890         0.6350 0.803   0.622
#> 4 4 0.737           0.768       0.772         0.1616 0.977   0.934
#> 5 5 0.736           0.679       0.768         0.0940 0.795   0.451
#> 6 6 0.885           0.954       0.913         0.0524 0.914   0.640

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
#> SRR1377145     2   0.416     0.6572 0.084 0.916
#> SRR1377146     2   0.469     0.6460 0.100 0.900
#> SRR1377147     2   0.469     0.6428 0.100 0.900
#> SRR1377148     2   0.416     0.6583 0.084 0.916
#> SRR1377153     2   0.563     0.6173 0.132 0.868
#> SRR1377154     2   0.605     0.5952 0.148 0.852
#> SRR1377155     2   0.552     0.6224 0.128 0.872
#> SRR1377156     2   0.541     0.6270 0.124 0.876
#> SRR1377149     2   0.416     0.6568 0.084 0.916
#> SRR1377150     2   0.343     0.6672 0.064 0.936
#> SRR1377151     2   0.358     0.6657 0.068 0.932
#> SRR1377152     2   0.373     0.6638 0.072 0.928
#> SRR1377157     1   0.929     0.8933 0.656 0.344
#> SRR1377158     1   0.936     0.9001 0.648 0.352
#> SRR1377159     1   0.929     0.8933 0.656 0.344
#> SRR1377160     1   0.932     0.8969 0.652 0.348
#> SRR1377161     1   0.943     0.8995 0.640 0.360
#> SRR1377162     1   0.943     0.8995 0.640 0.360
#> SRR1377163     1   0.939     0.9008 0.644 0.356
#> SRR1377164     1   0.943     0.8995 0.640 0.360
#> SRR1377169     1   0.943     0.8995 0.640 0.360
#> SRR1377170     1   0.939     0.9008 0.644 0.356
#> SRR1377171     1   0.943     0.8995 0.640 0.360
#> SRR1377172     1   0.943     0.8995 0.640 0.360
#> SRR1377165     1   0.943     0.8995 0.640 0.360
#> SRR1377166     1   0.946     0.8946 0.636 0.364
#> SRR1377167     1   0.943     0.8995 0.640 0.360
#> SRR1377168     1   0.943     0.8995 0.640 0.360
#> SRR1377173     1   0.936     0.9001 0.648 0.352
#> SRR1377174     1   0.936     0.9001 0.648 0.352
#> SRR1377175     1   0.936     0.9001 0.648 0.352
#> SRR1377176     1   0.936     0.9001 0.648 0.352
#> SRR1377177     1   0.936     0.9001 0.648 0.352
#> SRR1377178     1   0.939     0.9008 0.644 0.356
#> SRR1377179     1   0.929     0.8933 0.656 0.344
#> SRR1377180     1   0.939     0.9008 0.644 0.356
#> SRR1377181     1   0.929     0.8933 0.656 0.344
#> SRR1377182     1   0.929     0.8933 0.656 0.344
#> SRR1377183     1   0.961     0.8640 0.616 0.384
#> SRR1377184     1   0.925     0.8870 0.660 0.340
#> SRR1377185     1   0.958     0.8707 0.620 0.380
#> SRR1377186     1   0.961     0.8640 0.616 0.384
#> SRR1377187     1   0.929     0.8933 0.656 0.344
#> SRR1377188     1   0.961     0.8640 0.616 0.384
#> SRR1377189     2   0.388     0.6740 0.076 0.924
#> SRR1377190     2   0.358     0.6813 0.068 0.932
#> SRR1377191     2   0.388     0.6740 0.076 0.924
#> SRR1377192     2   0.295     0.6846 0.052 0.948
#> SRR1377193     2   0.260     0.6833 0.044 0.956
#> SRR1377194     2   0.311     0.6848 0.056 0.944
#> SRR1377195     1   0.900    -0.1566 0.684 0.316
#> SRR1377196     2   1.000     0.3263 0.488 0.512
#> SRR1377197     1   0.978    -0.2711 0.588 0.412
#> SRR1377198     2   1.000     0.3234 0.496 0.504
#> SRR1377199     2   0.990     0.3604 0.440 0.560
#> SRR1377200     2   0.987     0.3601 0.432 0.568
#> SRR1377201     2   0.278     0.6860 0.048 0.952
#> SRR1377202     2   0.311     0.6855 0.056 0.944
#> SRR1377203     2   0.295     0.6861 0.052 0.948
#> SRR1377204     2   0.358     0.6727 0.068 0.932
#> SRR1377205     2   0.373     0.6738 0.072 0.928
#> SRR1377206     2   0.358     0.6727 0.068 0.932
#> SRR1377207     2   0.388     0.6778 0.076 0.924
#> SRR1377208     2   0.343     0.6838 0.064 0.936
#> SRR1377209     2   0.311     0.6856 0.056 0.944
#> SRR1377210     2   0.506     0.6438 0.112 0.888
#> SRR1377211     2   0.416     0.6733 0.084 0.916
#> SRR1377212     2   0.416     0.6733 0.084 0.916
#> SRR1377213     2   0.966    -0.1888 0.392 0.608
#> SRR1377214     2   0.966    -0.1888 0.392 0.608
#> SRR1377215     2   0.963    -0.1721 0.388 0.612
#> SRR1377216     2   0.998    -0.5110 0.476 0.524
#> SRR1377217     2   0.999    -0.5248 0.480 0.520
#> SRR1377218     1   1.000     0.5688 0.500 0.500
#> SRR1377219     2   0.966    -0.2142 0.392 0.608
#> SRR1377220     2   0.978    -0.2894 0.412 0.588
#> SRR1377221     2   0.966    -0.2058 0.392 0.608
#> SRR1377222     2   0.958     0.0511 0.380 0.620
#> SRR1377223     2   0.958     0.0511 0.380 0.620
#> SRR1377224     2   0.958     0.0511 0.380 0.620

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>            class entropy silhouette    p1    p2    p3
#> SRR1377145     1  0.9018      0.792 0.548 0.176 0.276
#> SRR1377146     1  0.9042      0.789 0.544 0.176 0.280
#> SRR1377147     1  0.8985      0.783 0.544 0.164 0.292
#> SRR1377148     1  0.9087      0.792 0.544 0.188 0.268
#> SRR1377153     1  0.8842      0.770 0.548 0.144 0.308
#> SRR1377154     1  0.8646      0.753 0.556 0.124 0.320
#> SRR1377155     1  0.8742      0.769 0.556 0.136 0.308
#> SRR1377156     1  0.8749      0.776 0.560 0.140 0.300
#> SRR1377149     1  0.9120      0.791 0.544 0.200 0.256
#> SRR1377150     1  0.9150      0.780 0.544 0.224 0.232
#> SRR1377151     1  0.9135      0.789 0.544 0.208 0.248
#> SRR1377152     1  0.9141      0.788 0.544 0.212 0.244
#> SRR1377157     3  0.0475      0.986 0.004 0.004 0.992
#> SRR1377158     3  0.0237      0.988 0.000 0.004 0.996
#> SRR1377159     3  0.0661      0.983 0.004 0.008 0.988
#> SRR1377160     3  0.0237      0.988 0.000 0.004 0.996
#> SRR1377161     3  0.0592      0.987 0.000 0.012 0.988
#> SRR1377162     3  0.0592      0.987 0.000 0.012 0.988
#> SRR1377163     3  0.0424      0.987 0.000 0.008 0.992
#> SRR1377164     3  0.0237      0.988 0.000 0.004 0.996
#> SRR1377169     3  0.0747      0.986 0.000 0.016 0.984
#> SRR1377170     3  0.0592      0.986 0.000 0.012 0.988
#> SRR1377171     3  0.0747      0.985 0.000 0.016 0.984
#> SRR1377172     3  0.0747      0.985 0.000 0.016 0.984
#> SRR1377165     3  0.0424      0.988 0.000 0.008 0.992
#> SRR1377166     3  0.0892      0.983 0.000 0.020 0.980
#> SRR1377167     3  0.0747      0.985 0.000 0.016 0.984
#> SRR1377168     3  0.0892      0.983 0.000 0.020 0.980
#> SRR1377173     3  0.0237      0.988 0.000 0.004 0.996
#> SRR1377174     3  0.0237      0.988 0.000 0.004 0.996
#> SRR1377175     3  0.0000      0.986 0.000 0.000 1.000
#> SRR1377176     3  0.0237      0.985 0.004 0.000 0.996
#> SRR1377177     3  0.0237      0.988 0.000 0.004 0.996
#> SRR1377178     3  0.0237      0.988 0.000 0.004 0.996
#> SRR1377179     3  0.0237      0.985 0.004 0.000 0.996
#> SRR1377180     3  0.0424      0.987 0.000 0.008 0.992
#> SRR1377181     3  0.0237      0.985 0.004 0.000 0.996
#> SRR1377182     3  0.0237      0.985 0.004 0.000 0.996
#> SRR1377183     3  0.0892      0.980 0.000 0.020 0.980
#> SRR1377184     3  0.0424      0.982 0.008 0.000 0.992
#> SRR1377185     3  0.0892      0.980 0.000 0.020 0.980
#> SRR1377186     3  0.1031      0.976 0.000 0.024 0.976
#> SRR1377187     3  0.0424      0.982 0.008 0.000 0.992
#> SRR1377188     3  0.1031      0.976 0.000 0.024 0.976
#> SRR1377189     2  0.2116      0.933 0.012 0.948 0.040
#> SRR1377190     2  0.1774      0.925 0.024 0.960 0.016
#> SRR1377191     2  0.2031      0.933 0.016 0.952 0.032
#> SRR1377192     2  0.2269      0.917 0.040 0.944 0.016
#> SRR1377193     2  0.2031      0.922 0.032 0.952 0.016
#> SRR1377194     2  0.1453      0.931 0.008 0.968 0.024
#> SRR1377195     1  0.6621      0.554 0.720 0.052 0.228
#> SRR1377196     1  0.2492      0.647 0.936 0.048 0.016
#> SRR1377197     1  0.4920      0.650 0.840 0.052 0.108
#> SRR1377198     1  0.2550      0.664 0.936 0.040 0.024
#> SRR1377199     1  0.2187      0.659 0.948 0.028 0.024
#> SRR1377200     1  0.3112      0.668 0.916 0.056 0.028
#> SRR1377201     2  0.1999      0.911 0.036 0.952 0.012
#> SRR1377202     2  0.1999      0.911 0.036 0.952 0.012
#> SRR1377203     2  0.2152      0.915 0.036 0.948 0.016
#> SRR1377204     2  0.1399      0.932 0.004 0.968 0.028
#> SRR1377205     2  0.1399      0.932 0.004 0.968 0.028
#> SRR1377206     2  0.1525      0.932 0.004 0.964 0.032
#> SRR1377207     2  0.1905      0.920 0.028 0.956 0.016
#> SRR1377208     2  0.1905      0.920 0.028 0.956 0.016
#> SRR1377209     2  0.1905      0.920 0.028 0.956 0.016
#> SRR1377210     2  0.2636      0.931 0.020 0.932 0.048
#> SRR1377211     2  0.2313      0.930 0.024 0.944 0.032
#> SRR1377212     2  0.2056      0.926 0.024 0.952 0.024
#> SRR1377213     2  0.3207      0.915 0.012 0.904 0.084
#> SRR1377214     2  0.3207      0.915 0.012 0.904 0.084
#> SRR1377215     2  0.3207      0.915 0.012 0.904 0.084
#> SRR1377216     2  0.3918      0.863 0.004 0.856 0.140
#> SRR1377217     2  0.4047      0.855 0.004 0.848 0.148
#> SRR1377218     2  0.4172      0.844 0.004 0.840 0.156
#> SRR1377219     2  0.3207      0.915 0.012 0.904 0.084
#> SRR1377220     2  0.3293      0.912 0.012 0.900 0.088
#> SRR1377221     2  0.3207      0.915 0.012 0.904 0.084
#> SRR1377222     2  0.3120      0.916 0.012 0.908 0.080
#> SRR1377223     2  0.3120      0.916 0.012 0.908 0.080
#> SRR1377224     2  0.3120      0.916 0.012 0.908 0.080

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> SRR1377145     4  0.6324      0.976 0.396 0.040 0.012 0.552
#> SRR1377146     4  0.6246      0.983 0.396 0.036 0.012 0.556
#> SRR1377147     4  0.6049      0.987 0.396 0.032 0.008 0.564
#> SRR1377148     4  0.6049      0.987 0.396 0.032 0.008 0.564
#> SRR1377153     4  0.5975      0.984 0.400 0.028 0.008 0.564
#> SRR1377154     4  0.6081      0.981 0.396 0.028 0.012 0.564
#> SRR1377155     4  0.5975      0.984 0.400 0.028 0.008 0.564
#> SRR1377156     4  0.5975      0.984 0.400 0.028 0.008 0.564
#> SRR1377149     4  0.6130      0.986 0.396 0.036 0.008 0.560
#> SRR1377150     4  0.6246      0.984 0.396 0.036 0.012 0.556
#> SRR1377151     4  0.6246      0.984 0.396 0.036 0.012 0.556
#> SRR1377152     4  0.6130      0.986 0.396 0.036 0.008 0.560
#> SRR1377157     3  0.0336      0.746 0.000 0.000 0.992 0.008
#> SRR1377158     3  0.0336      0.746 0.000 0.000 0.992 0.008
#> SRR1377159     3  0.0376      0.743 0.004 0.000 0.992 0.004
#> SRR1377160     3  0.0336      0.746 0.000 0.000 0.992 0.008
#> SRR1377161     3  0.0188      0.743 0.000 0.004 0.996 0.000
#> SRR1377162     3  0.0000      0.743 0.000 0.000 1.000 0.000
#> SRR1377163     3  0.0000      0.743 0.000 0.000 1.000 0.000
#> SRR1377164     3  0.0000      0.743 0.000 0.000 1.000 0.000
#> SRR1377169     3  0.0336      0.742 0.000 0.008 0.992 0.000
#> SRR1377170     3  0.0188      0.743 0.000 0.004 0.996 0.000
#> SRR1377171     3  0.0336      0.742 0.000 0.008 0.992 0.000
#> SRR1377172     3  0.0336      0.742 0.000 0.008 0.992 0.000
#> SRR1377165     3  0.0524      0.744 0.000 0.008 0.988 0.004
#> SRR1377166     3  0.0336      0.742 0.000 0.008 0.992 0.000
#> SRR1377167     3  0.0336      0.742 0.000 0.008 0.992 0.000
#> SRR1377168     3  0.0524      0.744 0.000 0.008 0.988 0.004
#> SRR1377173     3  0.5080      0.733 0.000 0.004 0.576 0.420
#> SRR1377174     3  0.5060      0.736 0.000 0.004 0.584 0.412
#> SRR1377175     3  0.5070      0.735 0.000 0.004 0.580 0.416
#> SRR1377176     3  0.5070      0.735 0.000 0.004 0.580 0.416
#> SRR1377177     3  0.5080      0.733 0.000 0.004 0.576 0.420
#> SRR1377178     3  0.5070      0.734 0.000 0.004 0.580 0.416
#> SRR1377179     3  0.5070      0.735 0.000 0.004 0.580 0.416
#> SRR1377180     3  0.5080      0.733 0.000 0.004 0.576 0.420
#> SRR1377181     3  0.5243      0.733 0.004 0.004 0.576 0.416
#> SRR1377182     3  0.5060      0.736 0.000 0.004 0.584 0.412
#> SRR1377183     3  0.5444      0.725 0.000 0.016 0.560 0.424
#> SRR1377184     3  0.5252      0.730 0.004 0.004 0.572 0.420
#> SRR1377185     3  0.5408      0.734 0.000 0.016 0.576 0.408
#> SRR1377186     3  0.5628      0.721 0.000 0.024 0.556 0.420
#> SRR1377187     3  0.5243      0.733 0.004 0.004 0.576 0.416
#> SRR1377188     3  0.5444      0.725 0.000 0.016 0.560 0.424
#> SRR1377189     2  0.4018      0.785 0.016 0.812 0.004 0.168
#> SRR1377190     2  0.4630      0.748 0.016 0.732 0.000 0.252
#> SRR1377191     2  0.4068      0.788 0.016 0.816 0.008 0.160
#> SRR1377192     2  0.4744      0.751 0.024 0.736 0.000 0.240
#> SRR1377193     2  0.4502      0.756 0.016 0.748 0.000 0.236
#> SRR1377194     2  0.2941      0.797 0.008 0.888 0.008 0.096
#> SRR1377195     1  0.6332      0.626 0.664 0.008 0.100 0.228
#> SRR1377196     1  0.2803      0.753 0.900 0.008 0.012 0.080
#> SRR1377197     1  0.4986      0.711 0.760 0.012 0.032 0.196
#> SRR1377198     1  0.4365      0.730 0.828 0.016 0.044 0.112
#> SRR1377199     1  0.3657      0.689 0.864 0.016 0.024 0.096
#> SRR1377200     1  0.4121      0.638 0.844 0.020 0.036 0.100
#> SRR1377201     2  0.6270      0.493 0.040 0.524 0.008 0.428
#> SRR1377202     2  0.6133      0.534 0.028 0.540 0.012 0.420
#> SRR1377203     2  0.6145      0.584 0.032 0.568 0.012 0.388
#> SRR1377204     2  0.2631      0.795 0.016 0.912 0.008 0.064
#> SRR1377205     2  0.2510      0.796 0.012 0.916 0.008 0.064
#> SRR1377206     2  0.2485      0.795 0.016 0.916 0.004 0.064
#> SRR1377207     2  0.5872      0.613 0.016 0.584 0.016 0.384
#> SRR1377208     2  0.5970      0.598 0.024 0.576 0.012 0.388
#> SRR1377209     2  0.5812      0.630 0.020 0.600 0.012 0.368
#> SRR1377210     2  0.5171      0.732 0.020 0.704 0.008 0.268
#> SRR1377211     2  0.5443      0.694 0.020 0.660 0.008 0.312
#> SRR1377212     2  0.5581      0.666 0.020 0.632 0.008 0.340
#> SRR1377213     2  0.1022      0.784 0.000 0.968 0.032 0.000
#> SRR1377214     2  0.1022      0.784 0.000 0.968 0.032 0.000
#> SRR1377215     2  0.1022      0.784 0.000 0.968 0.032 0.000
#> SRR1377216     2  0.1867      0.760 0.000 0.928 0.072 0.000
#> SRR1377217     2  0.2011      0.752 0.000 0.920 0.080 0.000
#> SRR1377218     2  0.2469      0.726 0.000 0.892 0.108 0.000
#> SRR1377219     2  0.1118      0.783 0.000 0.964 0.036 0.000
#> SRR1377220     2  0.1118      0.783 0.000 0.964 0.036 0.000
#> SRR1377221     2  0.1022      0.784 0.000 0.968 0.032 0.000
#> SRR1377222     2  0.1004      0.783 0.004 0.972 0.024 0.000
#> SRR1377223     2  0.1004      0.783 0.004 0.972 0.024 0.000
#> SRR1377224     2  0.1004      0.783 0.004 0.972 0.024 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
#> SRR1377145     2  0.4658    0.32731 0.008 0.556 0.004 0.000 0.432
#> SRR1377146     2  0.4658    0.32731 0.008 0.556 0.004 0.000 0.432
#> SRR1377147     2  0.4758    0.33167 0.012 0.552 0.004 0.000 0.432
#> SRR1377148     2  0.4758    0.33167 0.012 0.552 0.004 0.000 0.432
#> SRR1377153     2  0.4928    0.32632 0.020 0.548 0.004 0.000 0.428
#> SRR1377154     2  0.4928    0.32632 0.020 0.548 0.004 0.000 0.428
#> SRR1377155     2  0.4843    0.33175 0.016 0.552 0.004 0.000 0.428
#> SRR1377156     2  0.4758    0.33167 0.012 0.552 0.004 0.000 0.432
#> SRR1377149     2  0.4843    0.33175 0.016 0.552 0.004 0.000 0.428
#> SRR1377150     2  0.4758    0.33167 0.012 0.552 0.004 0.000 0.432
#> SRR1377151     2  0.4758    0.33167 0.012 0.552 0.004 0.000 0.432
#> SRR1377152     2  0.4843    0.33175 0.016 0.552 0.004 0.000 0.428
#> SRR1377157     3  0.0404    0.98625 0.012 0.000 0.988 0.000 0.000
#> SRR1377158     3  0.0290    0.98987 0.008 0.000 0.992 0.000 0.000
#> SRR1377159     3  0.0162    0.99306 0.004 0.000 0.996 0.000 0.000
#> SRR1377160     3  0.0510    0.98174 0.016 0.000 0.984 0.000 0.000
#> SRR1377161     3  0.0000    0.99544 0.000 0.000 1.000 0.000 0.000
#> SRR1377162     3  0.0000    0.99544 0.000 0.000 1.000 0.000 0.000
#> SRR1377163     3  0.0000    0.99544 0.000 0.000 1.000 0.000 0.000
#> SRR1377164     3  0.0000    0.99544 0.000 0.000 1.000 0.000 0.000
#> SRR1377169     3  0.0290    0.99198 0.008 0.000 0.992 0.000 0.000
#> SRR1377170     3  0.0000    0.99544 0.000 0.000 1.000 0.000 0.000
#> SRR1377171     3  0.0162    0.99251 0.004 0.000 0.996 0.000 0.000
#> SRR1377172     3  0.0000    0.99544 0.000 0.000 1.000 0.000 0.000
#> SRR1377165     3  0.0000    0.99544 0.000 0.000 1.000 0.000 0.000
#> SRR1377166     3  0.0162    0.99251 0.004 0.000 0.996 0.000 0.000
#> SRR1377167     3  0.0000    0.99544 0.000 0.000 1.000 0.000 0.000
#> SRR1377168     3  0.0000    0.99544 0.000 0.000 1.000 0.000 0.000
#> SRR1377173     1  0.3456    0.98456 0.800 0.016 0.184 0.000 0.000
#> SRR1377174     1  0.3353    0.98132 0.796 0.008 0.196 0.000 0.000
#> SRR1377175     1  0.3318    0.98378 0.800 0.008 0.192 0.000 0.000
#> SRR1377176     1  0.3391    0.98513 0.800 0.012 0.188 0.000 0.000
#> SRR1377177     1  0.3391    0.98496 0.800 0.012 0.188 0.000 0.000
#> SRR1377178     1  0.3456    0.98453 0.800 0.016 0.184 0.000 0.000
#> SRR1377179     1  0.3353    0.98003 0.796 0.008 0.196 0.000 0.000
#> SRR1377180     1  0.3318    0.98378 0.800 0.008 0.192 0.000 0.000
#> SRR1377181     1  0.3355    0.98433 0.804 0.012 0.184 0.000 0.000
#> SRR1377182     1  0.3282    0.98454 0.804 0.008 0.188 0.000 0.000
#> SRR1377183     1  0.4023    0.96461 0.792 0.028 0.164 0.016 0.000
#> SRR1377184     1  0.3355    0.98460 0.804 0.012 0.184 0.000 0.000
#> SRR1377185     1  0.3870    0.97396 0.792 0.016 0.176 0.016 0.000
#> SRR1377186     1  0.3977    0.96827 0.792 0.024 0.168 0.016 0.000
#> SRR1377187     1  0.3456    0.98365 0.800 0.016 0.184 0.000 0.000
#> SRR1377188     1  0.3926    0.97068 0.792 0.020 0.172 0.016 0.000
#> SRR1377189     2  0.4451   -0.21126 0.004 0.504 0.000 0.492 0.000
#> SRR1377190     2  0.4499    0.00075 0.004 0.584 0.000 0.408 0.004
#> SRR1377191     2  0.4448   -0.18214 0.004 0.516 0.000 0.480 0.000
#> SRR1377192     2  0.4680   -0.09372 0.004 0.540 0.000 0.448 0.008
#> SRR1377193     2  0.4698   -0.14291 0.004 0.520 0.000 0.468 0.008
#> SRR1377194     4  0.4383    0.35747 0.004 0.424 0.000 0.572 0.000
#> SRR1377195     5  0.7008    0.77820 0.268 0.116 0.048 0.012 0.556
#> SRR1377196     5  0.5579    0.81933 0.144 0.152 0.004 0.012 0.688
#> SRR1377197     5  0.6238    0.78077 0.216 0.160 0.008 0.008 0.608
#> SRR1377198     5  0.6724    0.77558 0.136 0.108 0.080 0.024 0.652
#> SRR1377199     5  0.6210    0.79050 0.176 0.124 0.036 0.008 0.656
#> SRR1377200     5  0.6210    0.78420 0.124 0.192 0.024 0.012 0.648
#> SRR1377201     2  0.3252    0.43030 0.008 0.828 0.008 0.156 0.000
#> SRR1377202     2  0.3170    0.43202 0.008 0.828 0.004 0.160 0.000
#> SRR1377203     2  0.3525    0.42048 0.008 0.800 0.008 0.184 0.000
#> SRR1377204     4  0.4430    0.33154 0.004 0.456 0.000 0.540 0.000
#> SRR1377205     4  0.4430    0.33154 0.004 0.456 0.000 0.540 0.000
#> SRR1377206     4  0.4430    0.33154 0.004 0.456 0.000 0.540 0.000
#> SRR1377207     2  0.3561    0.41671 0.008 0.796 0.008 0.188 0.000
#> SRR1377208     2  0.3559    0.42494 0.008 0.804 0.012 0.176 0.000
#> SRR1377209     2  0.3525    0.42035 0.008 0.800 0.008 0.184 0.000
#> SRR1377210     2  0.4318    0.25019 0.008 0.688 0.008 0.296 0.000
#> SRR1377211     2  0.3918    0.36199 0.008 0.752 0.008 0.232 0.000
#> SRR1377212     2  0.3828    0.37873 0.008 0.764 0.008 0.220 0.000
#> SRR1377213     4  0.0000    0.82670 0.000 0.000 0.000 1.000 0.000
#> SRR1377214     4  0.0000    0.82670 0.000 0.000 0.000 1.000 0.000
#> SRR1377215     4  0.0000    0.82670 0.000 0.000 0.000 1.000 0.000
#> SRR1377216     4  0.1282    0.78864 0.004 0.000 0.044 0.952 0.000
#> SRR1377217     4  0.1282    0.78864 0.004 0.000 0.044 0.952 0.000
#> SRR1377218     4  0.1697    0.76646 0.008 0.000 0.060 0.932 0.000
#> SRR1377219     4  0.0000    0.82670 0.000 0.000 0.000 1.000 0.000
#> SRR1377220     4  0.0000    0.82670 0.000 0.000 0.000 1.000 0.000
#> SRR1377221     4  0.0000    0.82670 0.000 0.000 0.000 1.000 0.000
#> SRR1377222     4  0.0162    0.82388 0.004 0.000 0.000 0.996 0.000
#> SRR1377223     4  0.0000    0.82670 0.000 0.000 0.000 1.000 0.000
#> SRR1377224     4  0.0000    0.82670 0.000 0.000 0.000 1.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
#> SRR1377145     6  0.2402      0.991 0.004 0.140 0.000 0.000 0.000 0.856
#> SRR1377146     6  0.2504      0.987 0.004 0.136 0.000 0.000 0.004 0.856
#> SRR1377147     6  0.2504      0.987 0.004 0.136 0.000 0.000 0.004 0.856
#> SRR1377148     6  0.2442      0.992 0.004 0.144 0.000 0.000 0.000 0.852
#> SRR1377153     6  0.2482      0.992 0.004 0.148 0.000 0.000 0.000 0.848
#> SRR1377154     6  0.2482      0.992 0.004 0.148 0.000 0.000 0.000 0.848
#> SRR1377155     6  0.2482      0.992 0.004 0.148 0.000 0.000 0.000 0.848
#> SRR1377156     6  0.2442      0.993 0.004 0.144 0.000 0.000 0.000 0.852
#> SRR1377149     6  0.2442      0.993 0.004 0.144 0.000 0.000 0.000 0.852
#> SRR1377150     6  0.2695      0.990 0.004 0.144 0.000 0.000 0.008 0.844
#> SRR1377151     6  0.2584      0.992 0.004 0.144 0.000 0.000 0.004 0.848
#> SRR1377152     6  0.2584      0.992 0.004 0.144 0.000 0.000 0.004 0.848
#> SRR1377157     3  0.0146      0.996 0.000 0.000 0.996 0.000 0.000 0.004
#> SRR1377158     3  0.0146      0.996 0.000 0.000 0.996 0.000 0.000 0.004
#> SRR1377159     3  0.0000      0.999 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1377160     3  0.0146      0.996 0.000 0.000 0.996 0.000 0.000 0.004
#> SRR1377161     3  0.0000      0.999 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1377162     3  0.0000      0.999 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1377163     3  0.0000      0.999 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1377164     3  0.0000      0.999 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1377169     3  0.0000      0.999 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1377170     3  0.0000      0.999 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1377171     3  0.0000      0.999 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1377172     3  0.0000      0.999 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1377165     3  0.0000      0.999 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1377166     3  0.0000      0.999 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1377167     3  0.0000      0.999 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1377168     3  0.0000      0.999 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR1377173     1  0.1007      0.991 0.956 0.000 0.044 0.000 0.000 0.000
#> SRR1377174     1  0.1219      0.988 0.948 0.000 0.048 0.000 0.004 0.000
#> SRR1377175     1  0.1152      0.991 0.952 0.000 0.044 0.000 0.004 0.000
#> SRR1377176     1  0.1152      0.991 0.952 0.000 0.044 0.000 0.004 0.000
#> SRR1377177     1  0.1007      0.991 0.956 0.000 0.044 0.000 0.000 0.000
#> SRR1377178     1  0.1007      0.991 0.956 0.000 0.044 0.000 0.000 0.000
#> SRR1377179     1  0.1007      0.991 0.956 0.000 0.044 0.000 0.000 0.000
#> SRR1377180     1  0.1007      0.991 0.956 0.000 0.044 0.000 0.000 0.000
#> SRR1377181     1  0.1633      0.981 0.932 0.000 0.044 0.000 0.024 0.000
#> SRR1377182     1  0.1633      0.981 0.932 0.000 0.044 0.000 0.024 0.000
#> SRR1377183     1  0.1152      0.991 0.952 0.000 0.044 0.000 0.004 0.000
#> SRR1377184     1  0.1633      0.981 0.932 0.000 0.044 0.000 0.024 0.000
#> SRR1377185     1  0.1007      0.991 0.956 0.000 0.044 0.000 0.000 0.000
#> SRR1377186     1  0.1296      0.989 0.948 0.000 0.044 0.004 0.004 0.000
#> SRR1377187     1  0.1633      0.981 0.932 0.000 0.044 0.000 0.024 0.000
#> SRR1377188     1  0.1296      0.989 0.948 0.000 0.044 0.004 0.004 0.000
#> SRR1377189     2  0.3208      0.892 0.000 0.852 0.008 0.088 0.036 0.016
#> SRR1377190     2  0.2450      0.904 0.000 0.900 0.004 0.048 0.032 0.016
#> SRR1377191     2  0.2954      0.896 0.000 0.864 0.004 0.084 0.036 0.012
#> SRR1377192     2  0.2828      0.899 0.000 0.872 0.004 0.080 0.032 0.012
#> SRR1377193     2  0.2959      0.888 0.000 0.852 0.000 0.104 0.036 0.008
#> SRR1377194     2  0.3425      0.839 0.000 0.800 0.000 0.164 0.028 0.008
#> SRR1377195     5  0.4444      0.849 0.052 0.028 0.012 0.016 0.788 0.104
#> SRR1377196     5  0.3156      0.860 0.012 0.048 0.004 0.000 0.852 0.084
#> SRR1377197     5  0.3885      0.856 0.040 0.040 0.012 0.000 0.816 0.092
#> SRR1377198     5  0.6207      0.801 0.036 0.080 0.044 0.016 0.648 0.176
#> SRR1377199     5  0.5269      0.823 0.008 0.052 0.020 0.024 0.688 0.208
#> SRR1377200     5  0.6745      0.782 0.040 0.092 0.032 0.040 0.604 0.192
#> SRR1377201     2  0.1036      0.902 0.000 0.964 0.008 0.004 0.000 0.024
#> SRR1377202     2  0.1036      0.902 0.000 0.964 0.008 0.004 0.000 0.024
#> SRR1377203     2  0.0951      0.904 0.000 0.968 0.008 0.004 0.000 0.020
#> SRR1377204     2  0.2491      0.840 0.000 0.836 0.000 0.164 0.000 0.000
#> SRR1377205     2  0.2491      0.840 0.000 0.836 0.000 0.164 0.000 0.000
#> SRR1377206     2  0.2491      0.840 0.000 0.836 0.000 0.164 0.000 0.000
#> SRR1377207     2  0.1109      0.904 0.004 0.964 0.012 0.004 0.000 0.016
#> SRR1377208     2  0.1053      0.900 0.004 0.964 0.012 0.000 0.000 0.020
#> SRR1377209     2  0.1109      0.904 0.004 0.964 0.012 0.004 0.000 0.016
#> SRR1377210     2  0.0972      0.912 0.000 0.964 0.008 0.028 0.000 0.000
#> SRR1377211     2  0.0951      0.911 0.000 0.968 0.008 0.020 0.000 0.004
#> SRR1377212     2  0.0951      0.911 0.000 0.968 0.004 0.020 0.000 0.008
#> SRR1377213     4  0.0865      0.982 0.000 0.036 0.000 0.964 0.000 0.000
#> SRR1377214     4  0.0865      0.982 0.000 0.036 0.000 0.964 0.000 0.000
#> SRR1377215     4  0.0865      0.982 0.000 0.036 0.000 0.964 0.000 0.000
#> SRR1377216     4  0.1515      0.952 0.008 0.020 0.028 0.944 0.000 0.000
#> SRR1377217     4  0.1767      0.941 0.012 0.020 0.036 0.932 0.000 0.000
#> SRR1377218     4  0.1767      0.941 0.012 0.020 0.036 0.932 0.000 0.000
#> SRR1377219     4  0.0865      0.982 0.000 0.036 0.000 0.964 0.000 0.000
#> SRR1377220     4  0.0865      0.982 0.000 0.036 0.000 0.964 0.000 0.000
#> SRR1377221     4  0.0865      0.982 0.000 0.036 0.000 0.964 0.000 0.000
#> SRR1377222     4  0.1010      0.981 0.000 0.036 0.000 0.960 0.004 0.000
#> SRR1377223     4  0.1010      0.981 0.000 0.036 0.000 0.960 0.004 0.000
#> SRR1377224     4  0.1010      0.981 0.000 0.036 0.000 0.960 0.004 0.000

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

consensus_heatmap(res, k = 2)

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

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

collect_plots(res)

plot of chunk MAD-hclust-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2     1           1.000       1.000        0.14137 0.859   0.859
#> 3 3     1           0.961       0.985        0.01318 0.997   0.997
#> 4 4     1           0.958       0.989        0.00752 1.000   1.000
#> 5 5     1           0.963       1.000        0.00591 0.999   0.999
#> 6 6     1           0.935       0.992        0.03805 0.999   0.999

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

suggest_best_k(res)
#> [1] 2

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

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

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>            class entropy silhouette p1 p2
#> SRR1377145     2       0          1  0  1
#> SRR1377146     2       0          1  0  1
#> SRR1377147     2       0          1  0  1
#> SRR1377148     2       0          1  0  1
#> SRR1377153     2       0          1  0  1
#> SRR1377154     2       0          1  0  1
#> SRR1377155     2       0          1  0  1
#> SRR1377156     2       0          1  0  1
#> SRR1377149     2       0          1  0  1
#> SRR1377150     2       0          1  0  1
#> SRR1377151     2       0          1  0  1
#> SRR1377152     2       0          1  0  1
#> SRR1377157     2       0          1  0  1
#> SRR1377158     2       0          1  0  1
#> SRR1377159     2       0          1  0  1
#> SRR1377160     2       0          1  0  1
#> SRR1377161     2       0          1  0  1
#> SRR1377162     2       0          1  0  1
#> SRR1377163     2       0          1  0  1
#> SRR1377164     2       0          1  0  1
#> SRR1377169     2       0          1  0  1
#> SRR1377170     2       0          1  0  1
#> SRR1377171     2       0          1  0  1
#> SRR1377172     2       0          1  0  1
#> SRR1377165     2       0          1  0  1
#> SRR1377166     2       0          1  0  1
#> SRR1377167     2       0          1  0  1
#> SRR1377168     2       0          1  0  1
#> SRR1377173     2       0          1  0  1
#> SRR1377174     2       0          1  0  1
#> SRR1377175     2       0          1  0  1
#> SRR1377176     2       0          1  0  1
#> SRR1377177     2       0          1  0  1
#> SRR1377178     2       0          1  0  1
#> SRR1377179     2       0          1  0  1
#> SRR1377180     2       0          1  0  1
#> SRR1377181     2       0          1  0  1
#> SRR1377182     2       0          1  0  1
#> SRR1377183     2       0          1  0  1
#> SRR1377184     2       0          1  0  1
#> SRR1377185     2       0          1  0  1
#> SRR1377186     2       0          1  0  1
#> SRR1377187     2       0          1  0  1
#> SRR1377188     2       0          1  0  1
#> SRR1377189     2       0          1  0  1
#> SRR1377190     2       0          1  0  1
#> SRR1377191     2       0          1  0  1
#> SRR1377192     2       0          1  0  1
#> SRR1377193     2       0          1  0  1
#> SRR1377194     2       0          1  0  1
#> SRR1377195     1       0          1  1  0
#> SRR1377196     1       0          1  1  0
#> SRR1377197     1       0          1  1  0
#> SRR1377198     1       0          1  1  0
#> SRR1377199     1       0          1  1  0
#> SRR1377200     1       0          1  1  0
#> SRR1377201     2       0          1  0  1
#> SRR1377202     2       0          1  0  1
#> SRR1377203     2       0          1  0  1
#> SRR1377204     2       0          1  0  1
#> SRR1377205     2       0          1  0  1
#> SRR1377206     2       0          1  0  1
#> SRR1377207     2       0          1  0  1
#> SRR1377208     2       0          1  0  1
#> SRR1377209     2       0          1  0  1
#> SRR1377210     2       0          1  0  1
#> SRR1377211     2       0          1  0  1
#> SRR1377212     2       0          1  0  1
#> SRR1377213     2       0          1  0  1
#> SRR1377214     2       0          1  0  1
#> SRR1377215     2       0          1  0  1
#> SRR1377216     2       0          1  0  1
#> SRR1377217     2       0          1  0  1
#> SRR1377218     2       0          1  0  1
#> SRR1377219     2       0          1  0  1
#> SRR1377220     2       0          1  0  1
#> SRR1377221     2       0          1  0  1
#> SRR1377222     2       0          1  0  1
#> SRR1377223     2       0          1  0  1
#> SRR1377224     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
#> SRR1377145     2   0.000     1.0000 0.000  1 0.000
#> SRR1377146     2   0.000     1.0000 0.000  1 0.000
#> SRR1377147     2   0.000     1.0000 0.000  1 0.000
#> SRR1377148     2   0.000     1.0000 0.000  1 0.000
#> SRR1377153     2   0.000     1.0000 0.000  1 0.000
#> SRR1377154     2   0.000     1.0000 0.000  1 0.000
#> SRR1377155     2   0.000     1.0000 0.000  1 0.000
#> SRR1377156     2   0.000     1.0000 0.000  1 0.000
#> SRR1377149     2   0.000     1.0000 0.000  1 0.000
#> SRR1377150     2   0.000     1.0000 0.000  1 0.000
#> SRR1377151     2   0.000     1.0000 0.000  1 0.000
#> SRR1377152     2   0.000     1.0000 0.000  1 0.000
#> SRR1377157     2   0.000     1.0000 0.000  1 0.000
#> SRR1377158     2   0.000     1.0000 0.000  1 0.000
#> SRR1377159     2   0.000     1.0000 0.000  1 0.000
#> SRR1377160     2   0.000     1.0000 0.000  1 0.000
#> SRR1377161     2   0.000     1.0000 0.000  1 0.000
#> SRR1377162     2   0.000     1.0000 0.000  1 0.000
#> SRR1377163     2   0.000     1.0000 0.000  1 0.000
#> SRR1377164     2   0.000     1.0000 0.000  1 0.000
#> SRR1377169     2   0.000     1.0000 0.000  1 0.000
#> SRR1377170     2   0.000     1.0000 0.000  1 0.000
#> SRR1377171     2   0.000     1.0000 0.000  1 0.000
#> SRR1377172     2   0.000     1.0000 0.000  1 0.000
#> SRR1377165     2   0.000     1.0000 0.000  1 0.000
#> SRR1377166     2   0.000     1.0000 0.000  1 0.000
#> SRR1377167     2   0.000     1.0000 0.000  1 0.000
#> SRR1377168     2   0.000     1.0000 0.000  1 0.000
#> SRR1377173     2   0.000     1.0000 0.000  1 0.000
#> SRR1377174     2   0.000     1.0000 0.000  1 0.000
#> SRR1377175     2   0.000     1.0000 0.000  1 0.000
#> SRR1377176     2   0.000     1.0000 0.000  1 0.000
#> SRR1377177     2   0.000     1.0000 0.000  1 0.000
#> SRR1377178     2   0.000     1.0000 0.000  1 0.000
#> SRR1377179     2   0.000     1.0000 0.000  1 0.000
#> SRR1377180     2   0.000     1.0000 0.000  1 0.000
#> SRR1377181     2   0.000     1.0000 0.000  1 0.000
#> SRR1377182     2   0.000     1.0000 0.000  1 0.000
#> SRR1377183     2   0.000     1.0000 0.000  1 0.000
#> SRR1377184     2   0.000     1.0000 0.000  1 0.000
#> SRR1377185     2   0.000     1.0000 0.000  1 0.000
#> SRR1377186     2   0.000     1.0000 0.000  1 0.000
#> SRR1377187     2   0.000     1.0000 0.000  1 0.000
#> SRR1377188     2   0.000     1.0000 0.000  1 0.000
#> SRR1377189     2   0.000     1.0000 0.000  1 0.000
#> SRR1377190     2   0.000     1.0000 0.000  1 0.000
#> SRR1377191     2   0.000     1.0000 0.000  1 0.000
#> SRR1377192     2   0.000     1.0000 0.000  1 0.000
#> SRR1377193     2   0.000     1.0000 0.000  1 0.000
#> SRR1377194     2   0.000     1.0000 0.000  1 0.000
#> SRR1377195     1   0.000     0.8369 1.000  0 0.000
#> SRR1377196     1   0.000     0.8369 1.000  0 0.000
#> SRR1377197     1   0.000     0.8369 1.000  0 0.000
#> SRR1377198     1   0.522     0.4235 0.740  0 0.260
#> SRR1377199     3   0.631    -0.0305 0.496  0 0.504
#> SRR1377200     3   0.625    -0.0603 0.444  0 0.556
#> SRR1377201     2   0.000     1.0000 0.000  1 0.000
#> SRR1377202     2   0.000     1.0000 0.000  1 0.000
#> SRR1377203     2   0.000     1.0000 0.000  1 0.000
#> SRR1377204     2   0.000     1.0000 0.000  1 0.000
#> SRR1377205     2   0.000     1.0000 0.000  1 0.000
#> SRR1377206     2   0.000     1.0000 0.000  1 0.000
#> SRR1377207     2   0.000     1.0000 0.000  1 0.000
#> SRR1377208     2   0.000     1.0000 0.000  1 0.000
#> SRR1377209     2   0.000     1.0000 0.000  1 0.000
#> SRR1377210     2   0.000     1.0000 0.000  1 0.000
#> SRR1377211     2   0.000     1.0000 0.000  1 0.000
#> SRR1377212     2   0.000     1.0000 0.000  1 0.000
#> SRR1377213     2   0.000     1.0000 0.000  1 0.000
#> SRR1377214     2   0.000     1.0000 0.000  1 0.000
#> SRR1377215     2   0.000     1.0000 0.000  1 0.000
#> SRR1377216     2   0.000     1.0000 0.000  1 0.000
#> SRR1377217     2   0.000     1.0000 0.000  1 0.000
#> SRR1377218     2   0.000     1.0000 0.000  1 0.000
#> SRR1377219     2   0.000     1.0000 0.000  1 0.000
#> SRR1377220     2   0.000     1.0000 0.000  1 0.000
#> SRR1377221     2   0.000     1.0000 0.000  1 0.000
#> SRR1377222     2   0.000     1.0000 0.000  1 0.000
#> SRR1377223     2   0.000     1.0000 0.000  1 0.000
#> SRR1377224     2   0.000     1.0000 0.000  1 0.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1 p2   p3    p4
#> SRR1377145     2   0.000      1.000 0.000  1 0.00 0.000
#> SRR1377146     2   0.000      1.000 0.000  1 0.00 0.000
#> SRR1377147     2   0.000      1.000 0.000  1 0.00 0.000
#> SRR1377148     2   0.000      1.000 0.000  1 0.00 0.000
#> SRR1377153     2   0.000      1.000 0.000  1 0.00 0.000
#> SRR1377154     2   0.000      1.000 0.000  1 0.00 0.000
#> SRR1377155     2   0.000      1.000 0.000  1 0.00 0.000
#> SRR1377156     2   0.000      1.000 0.000  1 0.00 0.000
#> SRR1377149     2   0.000      1.000 0.000  1 0.00 0.000
#> SRR1377150     2   0.000      1.000 0.000  1 0.00 0.000
#> SRR1377151     2   0.000      1.000 0.000  1 0.00 0.000
#> SRR1377152     2   0.000      1.000 0.000  1 0.00 0.000
#> SRR1377157     2   0.000      1.000 0.000  1 0.00 0.000
#> SRR1377158     2   0.000      1.000 0.000  1 0.00 0.000
#> SRR1377159     2   0.000      1.000 0.000  1 0.00 0.000
#> SRR1377160     2   0.000      1.000 0.000  1 0.00 0.000
#> SRR1377161     2   0.000      1.000 0.000  1 0.00 0.000
#> SRR1377162     2   0.000      1.000 0.000  1 0.00 0.000
#> SRR1377163     2   0.000      1.000 0.000  1 0.00 0.000
#> SRR1377164     2   0.000      1.000 0.000  1 0.00 0.000
#> SRR1377169     2   0.000      1.000 0.000  1 0.00 0.000
#> SRR1377170     2   0.000      1.000 0.000  1 0.00 0.000
#> SRR1377171     2   0.000      1.000 0.000  1 0.00 0.000
#> SRR1377172     2   0.000      1.000 0.000  1 0.00 0.000
#> SRR1377165     2   0.000      1.000 0.000  1 0.00 0.000
#> SRR1377166     2   0.000      1.000 0.000  1 0.00 0.000
#> SRR1377167     2   0.000      1.000 0.000  1 0.00 0.000
#> SRR1377168     2   0.000      1.000 0.000  1 0.00 0.000
#> SRR1377173     2   0.000      1.000 0.000  1 0.00 0.000
#> SRR1377174     2   0.000      1.000 0.000  1 0.00 0.000
#> SRR1377175     2   0.000      1.000 0.000  1 0.00 0.000
#> SRR1377176     2   0.000      1.000 0.000  1 0.00 0.000
#> SRR1377177     2   0.000      1.000 0.000  1 0.00 0.000
#> SRR1377178     2   0.000      1.000 0.000  1 0.00 0.000
#> SRR1377179     2   0.000      1.000 0.000  1 0.00 0.000
#> SRR1377180     2   0.000      1.000 0.000  1 0.00 0.000
#> SRR1377181     2   0.000      1.000 0.000  1 0.00 0.000
#> SRR1377182     2   0.000      1.000 0.000  1 0.00 0.000
#> SRR1377183     2   0.000      1.000 0.000  1 0.00 0.000
#> SRR1377184     2   0.000      1.000 0.000  1 0.00 0.000
#> SRR1377185     2   0.000      1.000 0.000  1 0.00 0.000
#> SRR1377186     2   0.000      1.000 0.000  1 0.00 0.000
#> SRR1377187     2   0.000      1.000 0.000  1 0.00 0.000
#> SRR1377188     2   0.000      1.000 0.000  1 0.00 0.000
#> SRR1377189     2   0.000      1.000 0.000  1 0.00 0.000
#> SRR1377190     2   0.000      1.000 0.000  1 0.00 0.000
#> SRR1377191     2   0.000      1.000 0.000  1 0.00 0.000
#> SRR1377192     2   0.000      1.000 0.000  1 0.00 0.000
#> SRR1377193     2   0.000      1.000 0.000  1 0.00 0.000
#> SRR1377194     2   0.000      1.000 0.000  1 0.00 0.000
#> SRR1377195     1   0.000      0.787 1.000  0 0.00 0.000
#> SRR1377196     1   0.000      0.787 1.000  0 0.00 0.000
#> SRR1377197     1   0.000      0.787 1.000  0 0.00 0.000
#> SRR1377198     1   0.741      0.295 0.516  0 0.26 0.224
#> SRR1377199     3   0.413      0.000 0.260  0 0.74 0.000
#> SRR1377200     4   0.194      0.000 0.076  0 0.00 0.924
#> SRR1377201     2   0.000      1.000 0.000  1 0.00 0.000
#> SRR1377202     2   0.000      1.000 0.000  1 0.00 0.000
#> SRR1377203     2   0.000      1.000 0.000  1 0.00 0.000
#> SRR1377204     2   0.000      1.000 0.000  1 0.00 0.000
#> SRR1377205     2   0.000      1.000 0.000  1 0.00 0.000
#> SRR1377206     2   0.000      1.000 0.000  1 0.00 0.000
#> SRR1377207     2   0.000      1.000 0.000  1 0.00 0.000
#> SRR1377208     2   0.000      1.000 0.000  1 0.00 0.000
#> SRR1377209     2   0.000      1.000 0.000  1 0.00 0.000
#> SRR1377210     2   0.000      1.000 0.000  1 0.00 0.000
#> SRR1377211     2   0.000      1.000 0.000  1 0.00 0.000
#> SRR1377212     2   0.000      1.000 0.000  1 0.00 0.000
#> SRR1377213     2   0.000      1.000 0.000  1 0.00 0.000
#> SRR1377214     2   0.000      1.000 0.000  1 0.00 0.000
#> SRR1377215     2   0.000      1.000 0.000  1 0.00 0.000
#> SRR1377216     2   0.000      1.000 0.000  1 0.00 0.000
#> SRR1377217     2   0.000      1.000 0.000  1 0.00 0.000
#> SRR1377218     2   0.000      1.000 0.000  1 0.00 0.000
#> SRR1377219     2   0.000      1.000 0.000  1 0.00 0.000
#> SRR1377220     2   0.000      1.000 0.000  1 0.00 0.000
#> SRR1377221     2   0.000      1.000 0.000  1 0.00 0.000
#> SRR1377222     2   0.000      1.000 0.000  1 0.00 0.000
#> SRR1377223     2   0.000      1.000 0.000  1 0.00 0.000
#> SRR1377224     2   0.000      1.000 0.000  1 0.00 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
#> SRR1377145     2       0          1  0  1  0  0  0
#> SRR1377146     2       0          1  0  1  0  0  0
#> SRR1377147     2       0          1  0  1  0  0  0
#> SRR1377148     2       0          1  0  1  0  0  0
#> SRR1377153     2       0          1  0  1  0  0  0
#> SRR1377154     2       0          1  0  1  0  0  0
#> SRR1377155     2       0          1  0  1  0  0  0
#> SRR1377156     2       0          1  0  1  0  0  0
#> SRR1377149     2       0          1  0  1  0  0  0
#> SRR1377150     2       0          1  0  1  0  0  0
#> SRR1377151     2       0          1  0  1  0  0  0
#> SRR1377152     2       0          1  0  1  0  0  0
#> SRR1377157     2       0          1  0  1  0  0  0
#> SRR1377158     2       0          1  0  1  0  0  0
#> SRR1377159     2       0          1  0  1  0  0  0
#> SRR1377160     2       0          1  0  1  0  0  0
#> SRR1377161     2       0          1  0  1  0  0  0
#> SRR1377162     2       0          1  0  1  0  0  0
#> SRR1377163     2       0          1  0  1  0  0  0
#> SRR1377164     2       0          1  0  1  0  0  0
#> SRR1377169     2       0          1  0  1  0  0  0
#> SRR1377170     2       0          1  0  1  0  0  0
#> SRR1377171     2       0          1  0  1  0  0  0
#> SRR1377172     2       0          1  0  1  0  0  0
#> SRR1377165     2       0          1  0  1  0  0  0
#> SRR1377166     2       0          1  0  1  0  0  0
#> SRR1377167     2       0          1  0  1  0  0  0
#> SRR1377168     2       0          1  0  1  0  0  0
#> SRR1377173     2       0          1  0  1  0  0  0
#> SRR1377174     2       0          1  0  1  0  0  0
#> SRR1377175     2       0          1  0  1  0  0  0
#> SRR1377176     2       0          1  0  1  0  0  0
#> SRR1377177     2       0          1  0  1  0  0  0
#> SRR1377178     2       0          1  0  1  0  0  0
#> SRR1377179     2       0          1  0  1  0  0  0
#> SRR1377180     2       0          1  0  1  0  0  0
#> SRR1377181     2       0          1  0  1  0  0  0
#> SRR1377182     2       0          1  0  1  0  0  0
#> SRR1377183     2       0          1  0  1  0  0  0
#> SRR1377184     2       0          1  0  1  0  0  0
#> SRR1377185     2       0          1  0  1  0  0  0
#> SRR1377186     2       0          1  0  1  0  0  0
#> SRR1377187     2       0          1  0  1  0  0  0
#> SRR1377188     2       0          1  0  1  0  0  0
#> SRR1377189     2       0          1  0  1  0  0  0
#> SRR1377190     2       0          1  0  1  0  0  0
#> SRR1377191     2       0          1  0  1  0  0  0
#> SRR1377192     2       0          1  0  1  0  0  0
#> SRR1377193     2       0          1  0  1  0  0  0
#> SRR1377194     2       0          1  0  1  0  0  0
#> SRR1377195     1       0          1  1  0  0  0  0
#> SRR1377196     1       0          1  1  0  0  0  0
#> SRR1377197     1       0          1  1  0  0  0  0
#> SRR1377198     5       0          0  0  0  0  0  1
#> SRR1377199     3       0          0  0  0  1  0  0
#> SRR1377200     4       0          0  0  0  0  1  0
#> SRR1377201     2       0          1  0  1  0  0  0
#> SRR1377202     2       0          1  0  1  0  0  0
#> SRR1377203     2       0          1  0  1  0  0  0
#> SRR1377204     2       0          1  0  1  0  0  0
#> SRR1377205     2       0          1  0  1  0  0  0
#> SRR1377206     2       0          1  0  1  0  0  0
#> SRR1377207     2       0          1  0  1  0  0  0
#> SRR1377208     2       0          1  0  1  0  0  0
#> SRR1377209     2       0          1  0  1  0  0  0
#> SRR1377210     2       0          1  0  1  0  0  0
#> SRR1377211     2       0          1  0  1  0  0  0
#> SRR1377212     2       0          1  0  1  0  0  0
#> SRR1377213     2       0          1  0  1  0  0  0
#> SRR1377214     2       0          1  0  1  0  0  0
#> SRR1377215     2       0          1  0  1  0  0  0
#> SRR1377216     2       0          1  0  1  0  0  0
#> SRR1377217     2       0          1  0  1  0  0  0
#> SRR1377218     2       0          1  0  1  0  0  0
#> SRR1377219     2       0          1  0  1  0  0  0
#> SRR1377220     2       0          1  0  1  0  0  0
#> SRR1377221     2       0          1  0  1  0  0  0
#> SRR1377222     2       0          1  0  1  0  0  0
#> SRR1377223     2       0          1  0  1  0  0  0
#> SRR1377224     2       0          1  0  1  0  0  0

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>            class entropy silhouette    p1    p2 p3 p4    p5 p6
#> SRR1377145     2  0.0146      0.995 0.004 0.996  0  0 0.000  0
#> SRR1377146     2  0.0146      0.995 0.004 0.996  0  0 0.000  0
#> SRR1377147     2  0.0146      0.995 0.004 0.996  0  0 0.000  0
#> SRR1377148     2  0.0146      0.995 0.004 0.996  0  0 0.000  0
#> SRR1377153     2  0.0146      0.995 0.004 0.996  0  0 0.000  0
#> SRR1377154     2  0.0146      0.995 0.004 0.996  0  0 0.000  0
#> SRR1377155     2  0.0146      0.995 0.004 0.996  0  0 0.000  0
#> SRR1377156     2  0.0146      0.995 0.004 0.996  0  0 0.000  0
#> SRR1377149     2  0.0146      0.995 0.004 0.996  0  0 0.000  0
#> SRR1377150     2  0.0146      0.995 0.004 0.996  0  0 0.000  0
#> SRR1377151     2  0.0146      0.995 0.004 0.996  0  0 0.000  0
#> SRR1377152     2  0.0146      0.995 0.004 0.996  0  0 0.000  0
#> SRR1377157     2  0.0000      0.996 0.000 1.000  0  0 0.000  0
#> SRR1377158     2  0.0000      0.996 0.000 1.000  0  0 0.000  0
#> SRR1377159     2  0.0000      0.996 0.000 1.000  0  0 0.000  0
#> SRR1377160     2  0.0000      0.996 0.000 1.000  0  0 0.000  0
#> SRR1377161     2  0.0000      0.996 0.000 1.000  0  0 0.000  0
#> SRR1377162     2  0.0000      0.996 0.000 1.000  0  0 0.000  0
#> SRR1377163     2  0.0000      0.996 0.000 1.000  0  0 0.000  0
#> SRR1377164     2  0.0000      0.996 0.000 1.000  0  0 0.000  0
#> SRR1377169     2  0.0000      0.996 0.000 1.000  0  0 0.000  0
#> SRR1377170     2  0.0000      0.996 0.000 1.000  0  0 0.000  0
#> SRR1377171     2  0.0000      0.996 0.000 1.000  0  0 0.000  0
#> SRR1377172     2  0.0000      0.996 0.000 1.000  0  0 0.000  0
#> SRR1377165     2  0.0000      0.996 0.000 1.000  0  0 0.000  0
#> SRR1377166     2  0.0000      0.996 0.000 1.000  0  0 0.000  0
#> SRR1377167     2  0.0000      0.996 0.000 1.000  0  0 0.000  0
#> SRR1377168     2  0.0000      0.996 0.000 1.000  0  0 0.000  0
#> SRR1377173     2  0.0000      0.996 0.000 1.000  0  0 0.000  0
#> SRR1377174     2  0.0000      0.996 0.000 1.000  0  0 0.000  0
#> SRR1377175     2  0.0000      0.996 0.000 1.000  0  0 0.000  0
#> SRR1377176     2  0.0000      0.996 0.000 1.000  0  0 0.000  0
#> SRR1377177     2  0.0000      0.996 0.000 1.000  0  0 0.000  0
#> SRR1377178     2  0.0000      0.996 0.000 1.000  0  0 0.000  0
#> SRR1377179     2  0.0000      0.996 0.000 1.000  0  0 0.000  0
#> SRR1377180     2  0.0000      0.996 0.000 1.000  0  0 0.000  0
#> SRR1377181     2  0.0000      0.996 0.000 1.000  0  0 0.000  0
#> SRR1377182     2  0.0000      0.996 0.000 1.000  0  0 0.000  0
#> SRR1377183     2  0.0000      0.996 0.000 1.000  0  0 0.000  0
#> SRR1377184     2  0.0000      0.996 0.000 1.000  0  0 0.000  0
#> SRR1377185     2  0.0000      0.996 0.000 1.000  0  0 0.000  0
#> SRR1377186     2  0.0000      0.996 0.000 1.000  0  0 0.000  0
#> SRR1377187     2  0.0000      0.996 0.000 1.000  0  0 0.000  0
#> SRR1377188     2  0.0000      0.996 0.000 1.000  0  0 0.000  0
#> SRR1377189     2  0.0146      0.995 0.004 0.996  0  0 0.000  0
#> SRR1377190     2  0.0146      0.995 0.004 0.996  0  0 0.000  0
#> SRR1377191     2  0.0146      0.995 0.004 0.996  0  0 0.000  0
#> SRR1377192     2  0.0146      0.995 0.004 0.996  0  0 0.000  0
#> SRR1377193     2  0.0146      0.995 0.004 0.996  0  0 0.000  0
#> SRR1377194     2  0.0146      0.995 0.004 0.996  0  0 0.000  0
#> SRR1377195     1  0.0547      0.000 0.980 0.000  0  0 0.020  0
#> SRR1377196     5  0.0632      0.639 0.024 0.000  0  0 0.976  0
#> SRR1377197     5  0.3330      0.570 0.284 0.000  0  0 0.716  0
#> SRR1377198     6  0.0000      0.000 0.000 0.000  0  0 0.000  1
#> SRR1377199     3  0.0000      0.000 0.000 0.000  1  0 0.000  0
#> SRR1377200     4  0.0000      0.000 0.000 0.000  0  1 0.000  0
#> SRR1377201     2  0.0146      0.995 0.004 0.996  0  0 0.000  0
#> SRR1377202     2  0.0146      0.995 0.004 0.996  0  0 0.000  0
#> SRR1377203     2  0.0146      0.995 0.004 0.996  0  0 0.000  0
#> SRR1377204     2  0.0146      0.995 0.004 0.996  0  0 0.000  0
#> SRR1377205     2  0.0146      0.995 0.004 0.996  0  0 0.000  0
#> SRR1377206     2  0.0146      0.995 0.004 0.996  0  0 0.000  0
#> SRR1377207     2  0.0146      0.995 0.004 0.996  0  0 0.000  0
#> SRR1377208     2  0.0146      0.995 0.004 0.996  0  0 0.000  0
#> SRR1377209     2  0.0146      0.995 0.004 0.996  0  0 0.000  0
#> SRR1377210     2  0.0146      0.995 0.004 0.996  0  0 0.000  0
#> SRR1377211     2  0.0146      0.995 0.004 0.996  0  0 0.000  0
#> SRR1377212     2  0.0146      0.995 0.004 0.996  0  0 0.000  0
#> SRR1377213     2  0.0458      0.986 0.016 0.984  0  0 0.000  0
#> SRR1377214     2  0.0458      0.986 0.016 0.984  0  0 0.000  0
#> SRR1377215     2  0.0458      0.986 0.016 0.984  0  0 0.000  0
#> SRR1377216     2  0.0458      0.986 0.016 0.984  0  0 0.000  0
#> SRR1377217     2  0.0458      0.986 0.016 0.984  0  0 0.000  0
#> SRR1377218     2  0.0458      0.986 0.016 0.984  0  0 0.000  0
#> SRR1377219     2  0.0458      0.986 0.016 0.984  0  0 0.000  0
#> SRR1377220     2  0.0458      0.986 0.016 0.984  0  0 0.000  0
#> SRR1377221     2  0.0458      0.986 0.016 0.984  0  0 0.000  0
#> SRR1377222     2  0.0458      0.986 0.016 0.984  0  0 0.000  0
#> SRR1377223     2  0.0458      0.986 0.016 0.984  0  0 0.000  0
#> SRR1377224     2  0.0458      0.986 0.016 0.984  0  0 0.000  0

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

consensus_heatmap(res, k = 2)

plot of chunk tab-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 13890 rows and 80 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 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-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.168           0.483       0.588         0.3451 0.499   0.499
#> 3 3 0.180           0.466       0.622         0.5709 0.555   0.396
#> 4 4 0.372           0.560       0.613         0.2255 0.709   0.480
#> 5 5 0.461           0.821       0.681         0.1123 0.821   0.466
#> 6 6 0.670           0.911       0.814         0.0646 0.977   0.882

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
#> SRR1377145     1  0.9998      0.553 0.508 0.492
#> SRR1377146     1  0.9998      0.553 0.508 0.492
#> SRR1377147     1  0.9998      0.553 0.508 0.492
#> SRR1377148     1  0.9998      0.553 0.508 0.492
#> SRR1377153     1  0.9996      0.558 0.512 0.488
#> SRR1377154     1  0.9996      0.558 0.512 0.488
#> SRR1377155     1  0.9996      0.558 0.512 0.488
#> SRR1377156     1  0.9996      0.558 0.512 0.488
#> SRR1377149     1  0.9998      0.553 0.508 0.492
#> SRR1377150     1  0.9998      0.553 0.508 0.492
#> SRR1377151     1  0.9998      0.553 0.508 0.492
#> SRR1377152     1  0.9998      0.553 0.508 0.492
#> SRR1377157     2  0.0000      0.607 0.000 1.000
#> SRR1377158     2  0.0000      0.607 0.000 1.000
#> SRR1377159     2  0.0000      0.607 0.000 1.000
#> SRR1377160     2  0.0000      0.607 0.000 1.000
#> SRR1377161     2  0.0672      0.604 0.008 0.992
#> SRR1377162     2  0.0672      0.604 0.008 0.992
#> SRR1377163     2  0.0672      0.604 0.008 0.992
#> SRR1377164     2  0.0672      0.604 0.008 0.992
#> SRR1377169     2  0.0000      0.607 0.000 1.000
#> SRR1377170     2  0.0000      0.607 0.000 1.000
#> SRR1377171     2  0.0000      0.607 0.000 1.000
#> SRR1377172     2  0.0000      0.607 0.000 1.000
#> SRR1377165     2  0.0000      0.607 0.000 1.000
#> SRR1377166     2  0.0000      0.607 0.000 1.000
#> SRR1377167     2  0.0000      0.607 0.000 1.000
#> SRR1377168     2  0.0000      0.607 0.000 1.000
#> SRR1377173     2  0.8909      0.333 0.308 0.692
#> SRR1377174     2  0.8909      0.333 0.308 0.692
#> SRR1377175     2  0.8909      0.333 0.308 0.692
#> SRR1377176     2  0.8909      0.333 0.308 0.692
#> SRR1377177     2  0.8909      0.333 0.308 0.692
#> SRR1377178     2  0.8909      0.333 0.308 0.692
#> SRR1377179     2  0.8909      0.333 0.308 0.692
#> SRR1377180     2  0.8909      0.333 0.308 0.692
#> SRR1377181     2  0.8861      0.338 0.304 0.696
#> SRR1377182     2  0.8861      0.338 0.304 0.696
#> SRR1377183     2  0.8499      0.330 0.276 0.724
#> SRR1377184     2  0.8861      0.338 0.304 0.696
#> SRR1377185     2  0.8499      0.330 0.276 0.724
#> SRR1377186     2  0.8499      0.330 0.276 0.724
#> SRR1377187     2  0.8861      0.338 0.304 0.696
#> SRR1377188     2  0.8499      0.330 0.276 0.724
#> SRR1377189     1  0.9983      0.626 0.524 0.476
#> SRR1377190     1  0.9983      0.626 0.524 0.476
#> SRR1377191     1  0.9983      0.626 0.524 0.476
#> SRR1377192     1  0.9977      0.629 0.528 0.472
#> SRR1377193     1  0.9977      0.629 0.528 0.472
#> SRR1377194     1  0.9977      0.629 0.528 0.472
#> SRR1377195     1  0.8207      0.313 0.744 0.256
#> SRR1377196     1  0.8207      0.313 0.744 0.256
#> SRR1377197     1  0.8207      0.313 0.744 0.256
#> SRR1377198     1  0.8207      0.313 0.744 0.256
#> SRR1377199     1  0.8207      0.313 0.744 0.256
#> SRR1377200     1  0.8207      0.313 0.744 0.256
#> SRR1377201     1  0.9954      0.634 0.540 0.460
#> SRR1377202     1  0.9954      0.634 0.540 0.460
#> SRR1377203     1  0.9954      0.634 0.540 0.460
#> SRR1377204     1  0.9661      0.570 0.608 0.392
#> SRR1377205     1  0.9661      0.570 0.608 0.392
#> SRR1377206     1  0.9661      0.570 0.608 0.392
#> SRR1377207     1  0.9933      0.634 0.548 0.452
#> SRR1377208     1  0.9933      0.634 0.548 0.452
#> SRR1377209     1  0.9933      0.634 0.548 0.452
#> SRR1377210     1  0.9977      0.633 0.528 0.472
#> SRR1377211     1  0.9977      0.633 0.528 0.472
#> SRR1377212     1  0.9977      0.633 0.528 0.472
#> SRR1377213     2  0.9248      0.305 0.340 0.660
#> SRR1377214     2  0.9248      0.305 0.340 0.660
#> SRR1377215     2  0.9248      0.305 0.340 0.660
#> SRR1377216     2  0.6887      0.518 0.184 0.816
#> SRR1377217     2  0.6887      0.518 0.184 0.816
#> SRR1377218     2  0.6887      0.518 0.184 0.816
#> SRR1377219     2  0.9248      0.305 0.340 0.660
#> SRR1377220     2  0.9248      0.305 0.340 0.660
#> SRR1377221     2  0.9248      0.305 0.340 0.660
#> SRR1377222     2  0.9661      0.171 0.392 0.608
#> SRR1377223     2  0.9661      0.171 0.392 0.608
#> SRR1377224     2  0.9661      0.171 0.392 0.608

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>            class entropy silhouette    p1    p2    p3
#> SRR1377145     2  0.8290      0.390 0.204 0.632 0.164
#> SRR1377146     2  0.8290      0.390 0.204 0.632 0.164
#> SRR1377147     2  0.8290      0.390 0.204 0.632 0.164
#> SRR1377148     2  0.8290      0.390 0.204 0.632 0.164
#> SRR1377153     2  0.8339      0.387 0.204 0.628 0.168
#> SRR1377154     2  0.8339      0.387 0.204 0.628 0.168
#> SRR1377155     2  0.8339      0.387 0.204 0.628 0.168
#> SRR1377156     2  0.8339      0.387 0.204 0.628 0.168
#> SRR1377149     2  0.8290      0.390 0.204 0.632 0.164
#> SRR1377150     2  0.8290      0.390 0.204 0.632 0.164
#> SRR1377151     2  0.8290      0.390 0.204 0.632 0.164
#> SRR1377152     2  0.8290      0.390 0.204 0.632 0.164
#> SRR1377157     3  0.5058      0.907 0.000 0.244 0.756
#> SRR1377158     3  0.5058      0.907 0.000 0.244 0.756
#> SRR1377159     3  0.5058      0.907 0.000 0.244 0.756
#> SRR1377160     3  0.5058      0.907 0.000 0.244 0.756
#> SRR1377161     3  0.5058      0.907 0.000 0.244 0.756
#> SRR1377162     3  0.5058      0.907 0.000 0.244 0.756
#> SRR1377163     3  0.5058      0.907 0.000 0.244 0.756
#> SRR1377164     3  0.5058      0.907 0.000 0.244 0.756
#> SRR1377169     3  0.5058      0.907 0.000 0.244 0.756
#> SRR1377170     3  0.5058      0.907 0.000 0.244 0.756
#> SRR1377171     3  0.5058      0.907 0.000 0.244 0.756
#> SRR1377172     3  0.5058      0.907 0.000 0.244 0.756
#> SRR1377165     3  0.5058      0.907 0.000 0.244 0.756
#> SRR1377166     3  0.5058      0.907 0.000 0.244 0.756
#> SRR1377167     3  0.5058      0.907 0.000 0.244 0.756
#> SRR1377168     3  0.5058      0.907 0.000 0.244 0.756
#> SRR1377173     2  0.9959      0.112 0.292 0.368 0.340
#> SRR1377174     2  0.9959      0.112 0.292 0.368 0.340
#> SRR1377175     2  0.9959      0.112 0.292 0.368 0.340
#> SRR1377176     2  0.9959      0.112 0.292 0.368 0.340
#> SRR1377177     2  0.9959      0.112 0.292 0.368 0.340
#> SRR1377178     2  0.9959      0.112 0.292 0.368 0.340
#> SRR1377179     2  0.9959      0.112 0.292 0.368 0.340
#> SRR1377180     2  0.9959      0.112 0.292 0.368 0.340
#> SRR1377181     2  0.9962      0.105 0.292 0.364 0.344
#> SRR1377182     2  0.9962      0.105 0.292 0.364 0.344
#> SRR1377183     2  0.9355      0.159 0.180 0.480 0.340
#> SRR1377184     2  0.9962      0.105 0.292 0.364 0.344
#> SRR1377185     2  0.9355      0.159 0.180 0.480 0.340
#> SRR1377186     2  0.9355      0.159 0.180 0.480 0.340
#> SRR1377187     2  0.9962      0.105 0.292 0.364 0.344
#> SRR1377188     2  0.9355      0.159 0.180 0.480 0.340
#> SRR1377189     2  0.0848      0.450 0.008 0.984 0.008
#> SRR1377190     2  0.0848      0.450 0.008 0.984 0.008
#> SRR1377191     2  0.0848      0.450 0.008 0.984 0.008
#> SRR1377192     2  0.0848      0.450 0.008 0.984 0.008
#> SRR1377193     2  0.0848      0.450 0.008 0.984 0.008
#> SRR1377194     2  0.0848      0.450 0.008 0.984 0.008
#> SRR1377195     1  0.7676      0.994 0.584 0.360 0.056
#> SRR1377196     1  0.7676      0.994 0.584 0.360 0.056
#> SRR1377197     1  0.7676      0.994 0.584 0.360 0.056
#> SRR1377198     1  0.7310      0.994 0.600 0.360 0.040
#> SRR1377199     1  0.7310      0.994 0.600 0.360 0.040
#> SRR1377200     1  0.7310      0.994 0.600 0.360 0.040
#> SRR1377201     2  0.0848      0.445 0.008 0.984 0.008
#> SRR1377202     2  0.0848      0.445 0.008 0.984 0.008
#> SRR1377203     2  0.0848      0.445 0.008 0.984 0.008
#> SRR1377204     2  0.4269      0.359 0.052 0.872 0.076
#> SRR1377205     2  0.4269      0.359 0.052 0.872 0.076
#> SRR1377206     2  0.4269      0.359 0.052 0.872 0.076
#> SRR1377207     2  0.1015      0.443 0.008 0.980 0.012
#> SRR1377208     2  0.1015      0.443 0.008 0.980 0.012
#> SRR1377209     2  0.1015      0.443 0.008 0.980 0.012
#> SRR1377210     2  0.0848      0.445 0.008 0.984 0.008
#> SRR1377211     2  0.0848      0.445 0.008 0.984 0.008
#> SRR1377212     2  0.0848      0.445 0.008 0.984 0.008
#> SRR1377213     2  0.9268      0.108 0.172 0.492 0.336
#> SRR1377214     2  0.9268      0.108 0.172 0.492 0.336
#> SRR1377215     2  0.9268      0.108 0.172 0.492 0.336
#> SRR1377216     3  0.9136      0.335 0.144 0.400 0.456
#> SRR1377217     3  0.9136      0.335 0.144 0.400 0.456
#> SRR1377218     3  0.9136      0.335 0.144 0.400 0.456
#> SRR1377219     2  0.9268      0.108 0.172 0.492 0.336
#> SRR1377220     2  0.9268      0.108 0.172 0.492 0.336
#> SRR1377221     2  0.9268      0.108 0.172 0.492 0.336
#> SRR1377222     2  0.8762      0.252 0.160 0.576 0.264
#> SRR1377223     2  0.8762      0.252 0.160 0.576 0.264
#> SRR1377224     2  0.8762      0.252 0.160 0.576 0.264

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> SRR1377145     2  0.7662      0.494 0.080 0.452 0.044 0.424
#> SRR1377146     2  0.7662      0.494 0.080 0.452 0.044 0.424
#> SRR1377147     2  0.7662      0.494 0.080 0.452 0.044 0.424
#> SRR1377148     2  0.7662      0.494 0.080 0.452 0.044 0.424
#> SRR1377153     2  0.7724      0.493 0.080 0.456 0.048 0.416
#> SRR1377154     2  0.7724      0.493 0.080 0.456 0.048 0.416
#> SRR1377155     2  0.7724      0.493 0.080 0.456 0.048 0.416
#> SRR1377156     2  0.7724      0.493 0.080 0.456 0.048 0.416
#> SRR1377149     2  0.7726      0.493 0.080 0.452 0.048 0.420
#> SRR1377150     2  0.7726      0.493 0.080 0.452 0.048 0.420
#> SRR1377151     2  0.7726      0.493 0.080 0.452 0.048 0.420
#> SRR1377152     2  0.7726      0.493 0.080 0.452 0.048 0.420
#> SRR1377157     3  0.2706      0.851 0.004 0.064 0.908 0.024
#> SRR1377158     3  0.2706      0.851 0.004 0.064 0.908 0.024
#> SRR1377159     3  0.2706      0.851 0.004 0.064 0.908 0.024
#> SRR1377160     3  0.2706      0.851 0.004 0.064 0.908 0.024
#> SRR1377161     3  0.2234      0.857 0.004 0.064 0.924 0.008
#> SRR1377162     3  0.2234      0.857 0.004 0.064 0.924 0.008
#> SRR1377163     3  0.2234      0.857 0.004 0.064 0.924 0.008
#> SRR1377164     3  0.2234      0.857 0.004 0.064 0.924 0.008
#> SRR1377169     3  0.2088      0.860 0.004 0.064 0.928 0.004
#> SRR1377170     3  0.2088      0.860 0.004 0.064 0.928 0.004
#> SRR1377171     3  0.2088      0.860 0.004 0.064 0.928 0.004
#> SRR1377172     3  0.2088      0.860 0.004 0.064 0.928 0.004
#> SRR1377165     3  0.1902      0.860 0.000 0.064 0.932 0.004
#> SRR1377166     3  0.1902      0.860 0.000 0.064 0.932 0.004
#> SRR1377167     3  0.1902      0.860 0.000 0.064 0.932 0.004
#> SRR1377168     3  0.1902      0.860 0.000 0.064 0.932 0.004
#> SRR1377173     1  0.7536      0.727 0.492 0.264 0.244 0.000
#> SRR1377174     1  0.7536      0.727 0.492 0.264 0.244 0.000
#> SRR1377175     1  0.7536      0.727 0.492 0.264 0.244 0.000
#> SRR1377176     1  0.7536      0.727 0.492 0.264 0.244 0.000
#> SRR1377177     1  0.7536      0.727 0.492 0.264 0.244 0.000
#> SRR1377178     1  0.7536      0.727 0.492 0.264 0.244 0.000
#> SRR1377179     1  0.7536      0.727 0.492 0.264 0.244 0.000
#> SRR1377180     1  0.7536      0.727 0.492 0.264 0.244 0.000
#> SRR1377181     1  0.7518      0.725 0.496 0.260 0.244 0.000
#> SRR1377182     1  0.7518      0.725 0.496 0.260 0.244 0.000
#> SRR1377183     1  0.7653      0.697 0.460 0.300 0.240 0.000
#> SRR1377184     1  0.7518      0.725 0.496 0.260 0.244 0.000
#> SRR1377185     1  0.7653      0.697 0.460 0.300 0.240 0.000
#> SRR1377186     1  0.7653      0.697 0.460 0.300 0.240 0.000
#> SRR1377187     1  0.7518      0.725 0.496 0.260 0.244 0.000
#> SRR1377188     1  0.7653      0.697 0.460 0.300 0.240 0.000
#> SRR1377189     2  0.2186      0.579 0.008 0.932 0.012 0.048
#> SRR1377190     2  0.2186      0.579 0.008 0.932 0.012 0.048
#> SRR1377191     2  0.2186      0.579 0.008 0.932 0.012 0.048
#> SRR1377192     2  0.2186      0.579 0.008 0.932 0.012 0.048
#> SRR1377193     2  0.2186      0.579 0.008 0.932 0.012 0.048
#> SRR1377194     2  0.2186      0.579 0.008 0.932 0.012 0.048
#> SRR1377195     1  0.8398      0.248 0.516 0.240 0.060 0.184
#> SRR1377196     1  0.8398      0.248 0.516 0.240 0.060 0.184
#> SRR1377197     1  0.8398      0.248 0.516 0.240 0.060 0.184
#> SRR1377198     1  0.8207      0.248 0.532 0.240 0.052 0.176
#> SRR1377199     1  0.8241      0.248 0.532 0.240 0.056 0.172
#> SRR1377200     1  0.8207      0.248 0.532 0.240 0.052 0.176
#> SRR1377201     2  0.0992      0.590 0.008 0.976 0.012 0.004
#> SRR1377202     2  0.0992      0.590 0.008 0.976 0.012 0.004
#> SRR1377203     2  0.0992      0.590 0.008 0.976 0.012 0.004
#> SRR1377204     2  0.2412      0.496 0.008 0.908 0.000 0.084
#> SRR1377205     2  0.2412      0.496 0.008 0.908 0.000 0.084
#> SRR1377206     2  0.2412      0.496 0.008 0.908 0.000 0.084
#> SRR1377207     2  0.0927      0.589 0.008 0.976 0.016 0.000
#> SRR1377208     2  0.0927      0.589 0.008 0.976 0.016 0.000
#> SRR1377209     2  0.0927      0.589 0.008 0.976 0.016 0.000
#> SRR1377210     2  0.0779      0.588 0.004 0.980 0.016 0.000
#> SRR1377211     2  0.0779      0.588 0.004 0.980 0.016 0.000
#> SRR1377212     2  0.0779      0.588 0.004 0.980 0.016 0.000
#> SRR1377213     4  0.9496      1.000 0.120 0.312 0.216 0.352
#> SRR1377214     4  0.9496      1.000 0.120 0.312 0.216 0.352
#> SRR1377215     4  0.9496      1.000 0.120 0.312 0.216 0.352
#> SRR1377216     3  0.9593     -0.580 0.144 0.212 0.372 0.272
#> SRR1377217     3  0.9593     -0.580 0.144 0.212 0.372 0.272
#> SRR1377218     3  0.9593     -0.580 0.144 0.212 0.372 0.272
#> SRR1377219     4  0.9496      1.000 0.120 0.312 0.216 0.352
#> SRR1377220     4  0.9496      1.000 0.120 0.312 0.216 0.352
#> SRR1377221     4  0.9496      1.000 0.120 0.312 0.216 0.352
#> SRR1377222     2  0.8959     -0.784 0.132 0.400 0.108 0.360
#> SRR1377223     2  0.8959     -0.784 0.132 0.400 0.108 0.360
#> SRR1377224     2  0.8959     -0.784 0.132 0.400 0.108 0.360

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>            class entropy silhouette    p1    p2    p3    p4    p5
#> SRR1377145     5  0.5629      0.956 0.092 0.216 0.016 0.004 0.672
#> SRR1377146     5  0.5629      0.956 0.092 0.216 0.016 0.004 0.672
#> SRR1377147     5  0.5629      0.956 0.092 0.216 0.016 0.004 0.672
#> SRR1377148     5  0.5629      0.956 0.092 0.216 0.016 0.004 0.672
#> SRR1377153     5  0.6242      0.950 0.100 0.220 0.024 0.016 0.640
#> SRR1377154     5  0.6242      0.950 0.100 0.220 0.024 0.016 0.640
#> SRR1377155     5  0.6242      0.950 0.100 0.220 0.024 0.016 0.640
#> SRR1377156     5  0.6242      0.950 0.100 0.220 0.024 0.016 0.640
#> SRR1377149     5  0.6605      0.943 0.088 0.224 0.028 0.036 0.624
#> SRR1377150     5  0.6605      0.943 0.088 0.224 0.028 0.036 0.624
#> SRR1377151     5  0.6605      0.943 0.088 0.224 0.028 0.036 0.624
#> SRR1377152     5  0.6605      0.943 0.088 0.224 0.028 0.036 0.624
#> SRR1377157     3  0.4568      0.952 0.140 0.016 0.780 0.008 0.056
#> SRR1377158     3  0.4568      0.952 0.140 0.016 0.780 0.008 0.056
#> SRR1377159     3  0.4568      0.952 0.140 0.016 0.780 0.008 0.056
#> SRR1377160     3  0.4568      0.952 0.140 0.016 0.780 0.008 0.056
#> SRR1377161     3  0.3114      0.966 0.140 0.008 0.844 0.004 0.004
#> SRR1377162     3  0.3114      0.966 0.140 0.008 0.844 0.004 0.004
#> SRR1377163     3  0.3114      0.966 0.140 0.008 0.844 0.004 0.004
#> SRR1377164     3  0.3114      0.966 0.140 0.008 0.844 0.004 0.004
#> SRR1377169     3  0.3944      0.956 0.136 0.012 0.816 0.020 0.016
#> SRR1377170     3  0.3944      0.956 0.136 0.012 0.816 0.020 0.016
#> SRR1377171     3  0.3944      0.956 0.136 0.012 0.816 0.020 0.016
#> SRR1377172     3  0.3944      0.956 0.136 0.012 0.816 0.020 0.016
#> SRR1377165     3  0.3691      0.966 0.140 0.012 0.824 0.012 0.012
#> SRR1377166     3  0.3691      0.966 0.140 0.012 0.824 0.012 0.012
#> SRR1377167     3  0.3691      0.966 0.140 0.012 0.824 0.012 0.012
#> SRR1377168     3  0.3691      0.966 0.140 0.012 0.824 0.012 0.012
#> SRR1377173     1  0.0798      0.967 0.976 0.016 0.000 0.000 0.008
#> SRR1377174     1  0.0798      0.967 0.976 0.016 0.000 0.000 0.008
#> SRR1377175     1  0.0798      0.967 0.976 0.016 0.000 0.000 0.008
#> SRR1377176     1  0.0798      0.967 0.976 0.016 0.000 0.000 0.008
#> SRR1377177     1  0.0510      0.968 0.984 0.016 0.000 0.000 0.000
#> SRR1377178     1  0.0510      0.968 0.984 0.016 0.000 0.000 0.000
#> SRR1377179     1  0.0510      0.968 0.984 0.016 0.000 0.000 0.000
#> SRR1377180     1  0.0510      0.968 0.984 0.016 0.000 0.000 0.000
#> SRR1377181     1  0.1235      0.965 0.964 0.012 0.004 0.004 0.016
#> SRR1377182     1  0.1235      0.965 0.964 0.012 0.004 0.004 0.016
#> SRR1377183     1  0.2264      0.926 0.920 0.044 0.004 0.008 0.024
#> SRR1377184     1  0.1235      0.965 0.964 0.012 0.004 0.004 0.016
#> SRR1377185     1  0.2264      0.926 0.920 0.044 0.004 0.008 0.024
#> SRR1377186     1  0.2264      0.926 0.920 0.044 0.004 0.008 0.024
#> SRR1377187     1  0.1235      0.965 0.964 0.012 0.004 0.004 0.016
#> SRR1377188     1  0.2264      0.926 0.920 0.044 0.004 0.008 0.024
#> SRR1377189     2  0.5325      0.863 0.136 0.748 0.032 0.024 0.060
#> SRR1377190     2  0.5325      0.863 0.136 0.748 0.032 0.024 0.060
#> SRR1377191     2  0.5325      0.863 0.136 0.748 0.032 0.024 0.060
#> SRR1377192     2  0.5325      0.863 0.136 0.748 0.032 0.024 0.060
#> SRR1377193     2  0.5325      0.863 0.136 0.748 0.032 0.024 0.060
#> SRR1377194     2  0.5325      0.863 0.136 0.748 0.032 0.024 0.060
#> SRR1377195     4  0.9320      0.252 0.184 0.208 0.068 0.356 0.184
#> SRR1377196     4  0.9320      0.252 0.184 0.208 0.068 0.356 0.184
#> SRR1377197     4  0.9320      0.252 0.184 0.208 0.068 0.356 0.184
#> SRR1377198     4  0.9547      0.252 0.184 0.208 0.088 0.324 0.196
#> SRR1377199     4  0.9547      0.252 0.184 0.208 0.088 0.324 0.196
#> SRR1377200     4  0.9547      0.252 0.184 0.208 0.088 0.324 0.196
#> SRR1377201     2  0.3310      0.913 0.136 0.836 0.024 0.000 0.004
#> SRR1377202     2  0.3310      0.913 0.136 0.836 0.024 0.000 0.004
#> SRR1377203     2  0.3310      0.913 0.136 0.836 0.024 0.000 0.004
#> SRR1377204     2  0.2813      0.836 0.084 0.876 0.000 0.040 0.000
#> SRR1377205     2  0.2813      0.836 0.084 0.876 0.000 0.040 0.000
#> SRR1377206     2  0.2813      0.836 0.084 0.876 0.000 0.040 0.000
#> SRR1377207     2  0.3310      0.913 0.136 0.836 0.024 0.000 0.004
#> SRR1377208     2  0.3310      0.913 0.136 0.836 0.024 0.000 0.004
#> SRR1377209     2  0.3310      0.913 0.136 0.836 0.024 0.000 0.004
#> SRR1377210     2  0.3354      0.912 0.140 0.832 0.024 0.000 0.004
#> SRR1377211     2  0.3354      0.912 0.140 0.832 0.024 0.000 0.004
#> SRR1377212     2  0.3354      0.912 0.140 0.832 0.024 0.000 0.004
#> SRR1377213     4  0.7887      0.555 0.060 0.232 0.148 0.516 0.044
#> SRR1377214     4  0.7887      0.555 0.060 0.232 0.148 0.516 0.044
#> SRR1377215     4  0.7887      0.555 0.060 0.232 0.148 0.516 0.044
#> SRR1377216     4  0.8516      0.500 0.112 0.168 0.216 0.460 0.044
#> SRR1377217     4  0.8516      0.500 0.112 0.168 0.216 0.460 0.044
#> SRR1377218     4  0.8516      0.500 0.112 0.168 0.216 0.460 0.044
#> SRR1377219     4  0.7887      0.555 0.060 0.232 0.148 0.516 0.044
#> SRR1377220     4  0.7887      0.555 0.060 0.232 0.148 0.516 0.044
#> SRR1377221     4  0.7887      0.555 0.060 0.232 0.148 0.516 0.044
#> SRR1377222     4  0.7552      0.466 0.044 0.328 0.080 0.492 0.056
#> SRR1377223     4  0.7552      0.466 0.044 0.328 0.080 0.492 0.056
#> SRR1377224     4  0.7552      0.466 0.044 0.328 0.080 0.492 0.056

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>            class entropy silhouette    p1    p2    p3    p4    p5    p6
#> SRR1377145     6  0.4807      0.930 0.052 0.156 0.012 0.036 0.004 0.740
#> SRR1377146     6  0.4807      0.930 0.052 0.156 0.012 0.036 0.004 0.740
#> SRR1377147     6  0.4807      0.930 0.052 0.156 0.012 0.036 0.004 0.740
#> SRR1377148     6  0.4807      0.930 0.052 0.156 0.012 0.036 0.004 0.740
#> SRR1377153     6  0.5863      0.915 0.100 0.164 0.012 0.048 0.012 0.664
#> SRR1377154     6  0.5863      0.915 0.100 0.164 0.012 0.048 0.012 0.664
#> SRR1377155     6  0.5863      0.915 0.100 0.164 0.012 0.048 0.012 0.664
#> SRR1377156     6  0.5863      0.915 0.100 0.164 0.012 0.048 0.012 0.664
#> SRR1377149     6  0.6100      0.917 0.056 0.160 0.012 0.064 0.044 0.664
#> SRR1377150     6  0.6100      0.917 0.056 0.160 0.012 0.064 0.044 0.664
#> SRR1377151     6  0.6100      0.917 0.056 0.160 0.012 0.064 0.044 0.664
#> SRR1377152     6  0.6100      0.917 0.056 0.160 0.012 0.064 0.044 0.664
#> SRR1377157     3  0.2725      0.914 0.000 0.004 0.884 0.032 0.020 0.060
#> SRR1377158     3  0.2725      0.914 0.000 0.004 0.884 0.032 0.020 0.060
#> SRR1377159     3  0.2807      0.914 0.004 0.004 0.884 0.032 0.020 0.056
#> SRR1377160     3  0.2807      0.914 0.004 0.004 0.884 0.032 0.020 0.056
#> SRR1377161     3  0.2583      0.934 0.000 0.008 0.896 0.020 0.044 0.032
#> SRR1377162     3  0.2583      0.934 0.000 0.008 0.896 0.020 0.044 0.032
#> SRR1377163     3  0.2583      0.934 0.000 0.008 0.896 0.020 0.044 0.032
#> SRR1377164     3  0.2583      0.934 0.000 0.008 0.896 0.020 0.044 0.032
#> SRR1377169     3  0.2193      0.925 0.008 0.004 0.916 0.004 0.032 0.036
#> SRR1377170     3  0.2193      0.925 0.008 0.004 0.916 0.004 0.032 0.036
#> SRR1377171     3  0.2193      0.925 0.008 0.004 0.916 0.004 0.032 0.036
#> SRR1377172     3  0.2193      0.925 0.008 0.004 0.916 0.004 0.032 0.036
#> SRR1377165     3  0.0146      0.939 0.000 0.000 0.996 0.004 0.000 0.000
#> SRR1377166     3  0.0146      0.939 0.000 0.000 0.996 0.004 0.000 0.000
#> SRR1377167     3  0.0146      0.939 0.000 0.000 0.996 0.004 0.000 0.000
#> SRR1377168     3  0.0146      0.939 0.000 0.000 0.996 0.004 0.000 0.000
#> SRR1377173     1  0.3922      0.970 0.816 0.040 0.100 0.024 0.004 0.016
#> SRR1377174     1  0.3922      0.970 0.816 0.040 0.100 0.024 0.004 0.016
#> SRR1377175     1  0.3922      0.970 0.816 0.040 0.100 0.024 0.004 0.016
#> SRR1377176     1  0.3922      0.970 0.816 0.040 0.100 0.024 0.004 0.016
#> SRR1377177     1  0.3665      0.972 0.828 0.040 0.100 0.016 0.004 0.012
#> SRR1377178     1  0.3665      0.972 0.828 0.040 0.100 0.016 0.004 0.012
#> SRR1377179     1  0.3665      0.972 0.828 0.040 0.100 0.016 0.004 0.012
#> SRR1377180     1  0.3665      0.972 0.828 0.040 0.100 0.016 0.004 0.012
#> SRR1377181     1  0.3566      0.964 0.832 0.040 0.100 0.008 0.004 0.016
#> SRR1377182     1  0.3566      0.964 0.832 0.040 0.100 0.008 0.004 0.016
#> SRR1377183     1  0.3142      0.965 0.848 0.044 0.096 0.004 0.008 0.000
#> SRR1377184     1  0.3566      0.964 0.832 0.040 0.100 0.008 0.004 0.016
#> SRR1377185     1  0.3142      0.965 0.848 0.044 0.096 0.004 0.008 0.000
#> SRR1377186     1  0.3142      0.965 0.848 0.044 0.096 0.004 0.008 0.000
#> SRR1377187     1  0.3566      0.964 0.832 0.040 0.100 0.008 0.004 0.016
#> SRR1377188     1  0.3142      0.965 0.848 0.044 0.096 0.004 0.008 0.000
#> SRR1377189     2  0.5393      0.783 0.044 0.728 0.028 0.092 0.012 0.096
#> SRR1377190     2  0.5393      0.783 0.044 0.728 0.028 0.092 0.012 0.096
#> SRR1377191     2  0.5393      0.783 0.044 0.728 0.028 0.092 0.012 0.096
#> SRR1377192     2  0.5393      0.783 0.044 0.728 0.028 0.092 0.012 0.096
#> SRR1377193     2  0.5393      0.783 0.044 0.728 0.028 0.092 0.012 0.096
#> SRR1377194     2  0.5393      0.783 0.044 0.728 0.028 0.092 0.012 0.096
#> SRR1377195     5  0.5214      0.973 0.112 0.096 0.000 0.016 0.720 0.056
#> SRR1377196     5  0.5214      0.973 0.112 0.096 0.000 0.016 0.720 0.056
#> SRR1377197     5  0.5214      0.973 0.112 0.096 0.000 0.016 0.720 0.056
#> SRR1377198     5  0.4075      0.972 0.096 0.096 0.000 0.000 0.784 0.024
#> SRR1377199     5  0.4104      0.972 0.092 0.096 0.000 0.000 0.784 0.028
#> SRR1377200     5  0.4075      0.972 0.096 0.096 0.000 0.000 0.784 0.024
#> SRR1377201     2  0.1562      0.879 0.032 0.940 0.024 0.000 0.000 0.004
#> SRR1377202     2  0.1562      0.879 0.032 0.940 0.024 0.000 0.000 0.004
#> SRR1377203     2  0.1562      0.879 0.032 0.940 0.024 0.000 0.000 0.004
#> SRR1377204     2  0.2414      0.814 0.008 0.896 0.012 0.072 0.000 0.012
#> SRR1377205     2  0.2414      0.814 0.008 0.896 0.012 0.072 0.000 0.012
#> SRR1377206     2  0.2414      0.814 0.008 0.896 0.012 0.072 0.000 0.012
#> SRR1377207     2  0.1642      0.881 0.032 0.936 0.028 0.000 0.000 0.004
#> SRR1377208     2  0.1642      0.881 0.032 0.936 0.028 0.000 0.000 0.004
#> SRR1377209     2  0.1642      0.881 0.032 0.936 0.028 0.000 0.000 0.004
#> SRR1377210     2  0.1642      0.881 0.032 0.936 0.028 0.000 0.000 0.004
#> SRR1377211     2  0.1642      0.881 0.032 0.936 0.028 0.000 0.000 0.004
#> SRR1377212     2  0.1642      0.881 0.032 0.936 0.028 0.000 0.000 0.004
#> SRR1377213     4  0.4333      0.916 0.024 0.140 0.048 0.772 0.000 0.016
#> SRR1377214     4  0.4333      0.916 0.024 0.140 0.048 0.772 0.000 0.016
#> SRR1377215     4  0.4333      0.916 0.024 0.140 0.048 0.772 0.000 0.016
#> SRR1377216     4  0.6065      0.859 0.048 0.124 0.112 0.668 0.008 0.040
#> SRR1377217     4  0.6065      0.859 0.048 0.124 0.112 0.668 0.008 0.040
#> SRR1377218     4  0.6065      0.859 0.048 0.124 0.112 0.668 0.008 0.040
#> SRR1377219     4  0.4473      0.916 0.024 0.140 0.048 0.768 0.004 0.016
#> SRR1377220     4  0.4473      0.916 0.024 0.140 0.048 0.768 0.004 0.016
#> SRR1377221     4  0.4473      0.916 0.024 0.140 0.048 0.768 0.004 0.016
#> SRR1377222     4  0.5670      0.837 0.028 0.156 0.032 0.700 0.044 0.040
#> SRR1377223     4  0.5670      0.837 0.028 0.156 0.032 0.700 0.044 0.040
#> SRR1377224     4  0.5670      0.837 0.028 0.156 0.032 0.700 0.044 0.040

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

consensus_heatmap(res, k = 2)

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

consensus_heatmap(res, k = 3)

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

consensus_heatmap(res, k = 4)

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

consensus_heatmap(res, k = 5)

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

consensus_heatmap(res, k = 6)

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

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

membership_heatmap(res, k = 2)

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

membership_heatmap(res, k = 3)

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

membership_heatmap(res, k = 4)

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

membership_heatmap(res, k = 5)

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

membership_heatmap(res, k = 6)

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

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

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

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

get_signatures(res, k = 3)

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

get_signatures(res, k = 4)

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

get_signatures(res, k = 5)

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

get_signatures(res, k = 6)

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

Signature heatmaps where rows are not scaled:

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

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

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

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

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

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

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

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

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

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

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk MAD-kmeans-signature_compare

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

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

An example of the output of tb is:

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

The columns in tb are:

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

UMAP plot which shows how samples are separated.

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

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

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

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

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

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

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

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

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

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

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk MAD-kmeans-collect-classes

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


MAD:skmeans**

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

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

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

res
#> A 'ConsensusPartition' object with k = 2, 3, 4, 5, 6.
#>   On a matrix with 13890 rows and 80 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 0.792           0.948       0.969         0.5040 0.494   0.494
#> 3 3 0.806           0.954       0.966         0.3280 0.728   0.504
#> 4 4 0.781           0.874       0.868         0.0988 0.939   0.816
#> 5 5 0.913           0.896       0.949         0.0844 0.867   0.562
#> 6 6 0.982           0.957       0.962         0.0406 0.966   0.833

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
#> SRR1377145     1  0.2778      0.960 0.952 0.048
#> SRR1377146     1  0.2778      0.960 0.952 0.048
#> SRR1377147     1  0.2778      0.960 0.952 0.048
#> SRR1377148     1  0.2778      0.960 0.952 0.048
#> SRR1377153     1  0.2778      0.960 0.952 0.048
#> SRR1377154     1  0.2778      0.960 0.952 0.048
#> SRR1377155     1  0.2778      0.960 0.952 0.048
#> SRR1377156     1  0.2778      0.960 0.952 0.048
#> SRR1377149     1  0.2778      0.960 0.952 0.048
#> SRR1377150     1  0.2778      0.960 0.952 0.048
#> SRR1377151     1  0.2778      0.960 0.952 0.048
#> SRR1377152     1  0.2778      0.960 0.952 0.048
#> SRR1377157     2  0.0000      0.962 0.000 1.000
#> SRR1377158     2  0.0000      0.962 0.000 1.000
#> SRR1377159     2  0.0000      0.962 0.000 1.000
#> SRR1377160     2  0.0000      0.962 0.000 1.000
#> SRR1377161     2  0.0000      0.962 0.000 1.000
#> SRR1377162     2  0.0000      0.962 0.000 1.000
#> SRR1377163     2  0.0000      0.962 0.000 1.000
#> SRR1377164     2  0.0000      0.962 0.000 1.000
#> SRR1377169     2  0.0000      0.962 0.000 1.000
#> SRR1377170     2  0.0000      0.962 0.000 1.000
#> SRR1377171     2  0.0000      0.962 0.000 1.000
#> SRR1377172     2  0.0000      0.962 0.000 1.000
#> SRR1377165     2  0.0000      0.962 0.000 1.000
#> SRR1377166     2  0.0000      0.962 0.000 1.000
#> SRR1377167     2  0.0000      0.962 0.000 1.000
#> SRR1377168     2  0.0000      0.962 0.000 1.000
#> SRR1377173     2  0.0938      0.962 0.012 0.988
#> SRR1377174     2  0.0938      0.962 0.012 0.988
#> SRR1377175     2  0.0938      0.962 0.012 0.988
#> SRR1377176     2  0.0938      0.962 0.012 0.988
#> SRR1377177     2  0.0938      0.962 0.012 0.988
#> SRR1377178     2  0.0938      0.962 0.012 0.988
#> SRR1377179     2  0.0938      0.962 0.012 0.988
#> SRR1377180     2  0.0938      0.962 0.012 0.988
#> SRR1377181     2  0.0938      0.962 0.012 0.988
#> SRR1377182     2  0.0938      0.962 0.012 0.988
#> SRR1377183     2  0.0938      0.962 0.012 0.988
#> SRR1377184     2  0.0938      0.962 0.012 0.988
#> SRR1377185     2  0.0938      0.962 0.012 0.988
#> SRR1377186     2  0.0938      0.962 0.012 0.988
#> SRR1377187     2  0.0938      0.962 0.012 0.988
#> SRR1377188     2  0.0938      0.962 0.012 0.988
#> SRR1377189     1  0.0000      0.974 1.000 0.000
#> SRR1377190     1  0.0000      0.974 1.000 0.000
#> SRR1377191     1  0.0000      0.974 1.000 0.000
#> SRR1377192     1  0.0000      0.974 1.000 0.000
#> SRR1377193     1  0.0000      0.974 1.000 0.000
#> SRR1377194     1  0.0000      0.974 1.000 0.000
#> SRR1377195     1  0.0376      0.974 0.996 0.004
#> SRR1377196     1  0.0376      0.974 0.996 0.004
#> SRR1377197     1  0.0376      0.974 0.996 0.004
#> SRR1377198     1  0.0376      0.974 0.996 0.004
#> SRR1377199     1  0.0376      0.974 0.996 0.004
#> SRR1377200     1  0.0376      0.974 0.996 0.004
#> SRR1377201     1  0.0000      0.974 1.000 0.000
#> SRR1377202     1  0.0000      0.974 1.000 0.000
#> SRR1377203     1  0.0000      0.974 1.000 0.000
#> SRR1377204     1  0.0000      0.974 1.000 0.000
#> SRR1377205     1  0.0000      0.974 1.000 0.000
#> SRR1377206     1  0.0000      0.974 1.000 0.000
#> SRR1377207     1  0.0000      0.974 1.000 0.000
#> SRR1377208     1  0.0000      0.974 1.000 0.000
#> SRR1377209     1  0.0000      0.974 1.000 0.000
#> SRR1377210     1  0.0000      0.974 1.000 0.000
#> SRR1377211     1  0.0000      0.974 1.000 0.000
#> SRR1377212     1  0.0000      0.974 1.000 0.000
#> SRR1377213     2  0.7376      0.780 0.208 0.792
#> SRR1377214     2  0.7376      0.780 0.208 0.792
#> SRR1377215     2  0.7376      0.780 0.208 0.792
#> SRR1377216     2  0.1633      0.951 0.024 0.976
#> SRR1377217     2  0.1633      0.951 0.024 0.976
#> SRR1377218     2  0.1633      0.951 0.024 0.976
#> SRR1377219     2  0.7376      0.780 0.208 0.792
#> SRR1377220     2  0.7376      0.780 0.208 0.792
#> SRR1377221     2  0.7376      0.780 0.208 0.792
#> SRR1377222     1  0.5178      0.877 0.884 0.116
#> SRR1377223     1  0.5178      0.877 0.884 0.116
#> SRR1377224     1  0.5178      0.877 0.884 0.116

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>            class entropy silhouette    p1    p2    p3
#> SRR1377145     2  0.3695      0.918 0.108 0.880 0.012
#> SRR1377146     2  0.3695      0.918 0.108 0.880 0.012
#> SRR1377147     2  0.3695      0.918 0.108 0.880 0.012
#> SRR1377148     2  0.3695      0.918 0.108 0.880 0.012
#> SRR1377153     2  0.3695      0.918 0.108 0.880 0.012
#> SRR1377154     2  0.3695      0.918 0.108 0.880 0.012
#> SRR1377155     2  0.3695      0.918 0.108 0.880 0.012
#> SRR1377156     2  0.3695      0.918 0.108 0.880 0.012
#> SRR1377149     2  0.3695      0.918 0.108 0.880 0.012
#> SRR1377150     2  0.3695      0.918 0.108 0.880 0.012
#> SRR1377151     2  0.3695      0.918 0.108 0.880 0.012
#> SRR1377152     2  0.3695      0.918 0.108 0.880 0.012
#> SRR1377157     3  0.0892      0.985 0.020 0.000 0.980
#> SRR1377158     3  0.0892      0.985 0.020 0.000 0.980
#> SRR1377159     3  0.0892      0.985 0.020 0.000 0.980
#> SRR1377160     3  0.0892      0.985 0.020 0.000 0.980
#> SRR1377161     3  0.0892      0.985 0.020 0.000 0.980
#> SRR1377162     3  0.0892      0.985 0.020 0.000 0.980
#> SRR1377163     3  0.0892      0.985 0.020 0.000 0.980
#> SRR1377164     3  0.0892      0.985 0.020 0.000 0.980
#> SRR1377169     3  0.0892      0.985 0.020 0.000 0.980
#> SRR1377170     3  0.0892      0.985 0.020 0.000 0.980
#> SRR1377171     3  0.0892      0.985 0.020 0.000 0.980
#> SRR1377172     3  0.0892      0.985 0.020 0.000 0.980
#> SRR1377165     3  0.0892      0.985 0.020 0.000 0.980
#> SRR1377166     3  0.0892      0.985 0.020 0.000 0.980
#> SRR1377167     3  0.0892      0.985 0.020 0.000 0.980
#> SRR1377168     3  0.0892      0.985 0.020 0.000 0.980
#> SRR1377173     1  0.0000      0.962 1.000 0.000 0.000
#> SRR1377174     1  0.0000      0.962 1.000 0.000 0.000
#> SRR1377175     1  0.0000      0.962 1.000 0.000 0.000
#> SRR1377176     1  0.0000      0.962 1.000 0.000 0.000
#> SRR1377177     1  0.0000      0.962 1.000 0.000 0.000
#> SRR1377178     1  0.0000      0.962 1.000 0.000 0.000
#> SRR1377179     1  0.0000      0.962 1.000 0.000 0.000
#> SRR1377180     1  0.0000      0.962 1.000 0.000 0.000
#> SRR1377181     1  0.0000      0.962 1.000 0.000 0.000
#> SRR1377182     1  0.0000      0.962 1.000 0.000 0.000
#> SRR1377183     1  0.0000      0.962 1.000 0.000 0.000
#> SRR1377184     1  0.0000      0.962 1.000 0.000 0.000
#> SRR1377185     1  0.0000      0.962 1.000 0.000 0.000
#> SRR1377186     1  0.0000      0.962 1.000 0.000 0.000
#> SRR1377187     1  0.0000      0.962 1.000 0.000 0.000
#> SRR1377188     1  0.0000      0.962 1.000 0.000 0.000
#> SRR1377189     2  0.0000      0.948 0.000 1.000 0.000
#> SRR1377190     2  0.0000      0.948 0.000 1.000 0.000
#> SRR1377191     2  0.0000      0.948 0.000 1.000 0.000
#> SRR1377192     2  0.0000      0.948 0.000 1.000 0.000
#> SRR1377193     2  0.0000      0.948 0.000 1.000 0.000
#> SRR1377194     2  0.0000      0.948 0.000 1.000 0.000
#> SRR1377195     1  0.3482      0.894 0.872 0.128 0.000
#> SRR1377196     1  0.3482      0.894 0.872 0.128 0.000
#> SRR1377197     1  0.3482      0.894 0.872 0.128 0.000
#> SRR1377198     1  0.3482      0.894 0.872 0.128 0.000
#> SRR1377199     1  0.3482      0.894 0.872 0.128 0.000
#> SRR1377200     1  0.3482      0.894 0.872 0.128 0.000
#> SRR1377201     2  0.0000      0.948 0.000 1.000 0.000
#> SRR1377202     2  0.0000      0.948 0.000 1.000 0.000
#> SRR1377203     2  0.0000      0.948 0.000 1.000 0.000
#> SRR1377204     2  0.0000      0.948 0.000 1.000 0.000
#> SRR1377205     2  0.0000      0.948 0.000 1.000 0.000
#> SRR1377206     2  0.0000      0.948 0.000 1.000 0.000
#> SRR1377207     2  0.0000      0.948 0.000 1.000 0.000
#> SRR1377208     2  0.0000      0.948 0.000 1.000 0.000
#> SRR1377209     2  0.0000      0.948 0.000 1.000 0.000
#> SRR1377210     2  0.0000      0.948 0.000 1.000 0.000
#> SRR1377211     2  0.0000      0.948 0.000 1.000 0.000
#> SRR1377212     2  0.0000      0.948 0.000 1.000 0.000
#> SRR1377213     3  0.0747      0.979 0.000 0.016 0.984
#> SRR1377214     3  0.0747      0.979 0.000 0.016 0.984
#> SRR1377215     3  0.0747      0.979 0.000 0.016 0.984
#> SRR1377216     3  0.0747      0.979 0.000 0.016 0.984
#> SRR1377217     3  0.0747      0.979 0.000 0.016 0.984
#> SRR1377218     3  0.0747      0.979 0.000 0.016 0.984
#> SRR1377219     3  0.0747      0.979 0.000 0.016 0.984
#> SRR1377220     3  0.0747      0.979 0.000 0.016 0.984
#> SRR1377221     3  0.0747      0.979 0.000 0.016 0.984
#> SRR1377222     3  0.1163      0.972 0.000 0.028 0.972
#> SRR1377223     3  0.1163      0.972 0.000 0.028 0.972
#> SRR1377224     3  0.1163      0.972 0.000 0.028 0.972

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> SRR1377145     2  0.6192      0.730 0.020 0.588 0.364 0.028
#> SRR1377146     2  0.6192      0.730 0.020 0.588 0.364 0.028
#> SRR1377147     2  0.6192      0.730 0.020 0.588 0.364 0.028
#> SRR1377148     2  0.6192      0.730 0.020 0.588 0.364 0.028
#> SRR1377153     2  0.6192      0.730 0.020 0.588 0.364 0.028
#> SRR1377154     2  0.6192      0.730 0.020 0.588 0.364 0.028
#> SRR1377155     2  0.6192      0.730 0.020 0.588 0.364 0.028
#> SRR1377156     2  0.6192      0.730 0.020 0.588 0.364 0.028
#> SRR1377149     2  0.6192      0.730 0.020 0.588 0.364 0.028
#> SRR1377150     2  0.6192      0.730 0.020 0.588 0.364 0.028
#> SRR1377151     2  0.6192      0.730 0.020 0.588 0.364 0.028
#> SRR1377152     2  0.6192      0.730 0.020 0.588 0.364 0.028
#> SRR1377157     3  0.5075      1.000 0.012 0.000 0.644 0.344
#> SRR1377158     3  0.5075      1.000 0.012 0.000 0.644 0.344
#> SRR1377159     3  0.5075      1.000 0.012 0.000 0.644 0.344
#> SRR1377160     3  0.5075      1.000 0.012 0.000 0.644 0.344
#> SRR1377161     3  0.5075      1.000 0.012 0.000 0.644 0.344
#> SRR1377162     3  0.5075      1.000 0.012 0.000 0.644 0.344
#> SRR1377163     3  0.5075      1.000 0.012 0.000 0.644 0.344
#> SRR1377164     3  0.5075      1.000 0.012 0.000 0.644 0.344
#> SRR1377169     3  0.5075      1.000 0.012 0.000 0.644 0.344
#> SRR1377170     3  0.5075      1.000 0.012 0.000 0.644 0.344
#> SRR1377171     3  0.5075      1.000 0.012 0.000 0.644 0.344
#> SRR1377172     3  0.5075      1.000 0.012 0.000 0.644 0.344
#> SRR1377165     3  0.5075      1.000 0.012 0.000 0.644 0.344
#> SRR1377166     3  0.5075      1.000 0.012 0.000 0.644 0.344
#> SRR1377167     3  0.5075      1.000 0.012 0.000 0.644 0.344
#> SRR1377168     3  0.5075      1.000 0.012 0.000 0.644 0.344
#> SRR1377173     1  0.0000      0.951 1.000 0.000 0.000 0.000
#> SRR1377174     1  0.0000      0.951 1.000 0.000 0.000 0.000
#> SRR1377175     1  0.0000      0.951 1.000 0.000 0.000 0.000
#> SRR1377176     1  0.0000      0.951 1.000 0.000 0.000 0.000
#> SRR1377177     1  0.0000      0.951 1.000 0.000 0.000 0.000
#> SRR1377178     1  0.0000      0.951 1.000 0.000 0.000 0.000
#> SRR1377179     1  0.0000      0.951 1.000 0.000 0.000 0.000
#> SRR1377180     1  0.0000      0.951 1.000 0.000 0.000 0.000
#> SRR1377181     1  0.0000      0.951 1.000 0.000 0.000 0.000
#> SRR1377182     1  0.0000      0.951 1.000 0.000 0.000 0.000
#> SRR1377183     1  0.0000      0.951 1.000 0.000 0.000 0.000
#> SRR1377184     1  0.0000      0.951 1.000 0.000 0.000 0.000
#> SRR1377185     1  0.0000      0.951 1.000 0.000 0.000 0.000
#> SRR1377186     1  0.0000      0.951 1.000 0.000 0.000 0.000
#> SRR1377187     1  0.0000      0.951 1.000 0.000 0.000 0.000
#> SRR1377188     1  0.0000      0.951 1.000 0.000 0.000 0.000
#> SRR1377189     2  0.1510      0.807 0.000 0.956 0.016 0.028
#> SRR1377190     2  0.1510      0.807 0.000 0.956 0.016 0.028
#> SRR1377191     2  0.1510      0.807 0.000 0.956 0.016 0.028
#> SRR1377192     2  0.1510      0.807 0.000 0.956 0.016 0.028
#> SRR1377193     2  0.1510      0.807 0.000 0.956 0.016 0.028
#> SRR1377194     2  0.1510      0.807 0.000 0.956 0.016 0.028
#> SRR1377195     1  0.3123      0.862 0.844 0.156 0.000 0.000
#> SRR1377196     1  0.3123      0.862 0.844 0.156 0.000 0.000
#> SRR1377197     1  0.3123      0.862 0.844 0.156 0.000 0.000
#> SRR1377198     1  0.3123      0.862 0.844 0.156 0.000 0.000
#> SRR1377199     1  0.3123      0.862 0.844 0.156 0.000 0.000
#> SRR1377200     1  0.3123      0.862 0.844 0.156 0.000 0.000
#> SRR1377201     2  0.0000      0.817 0.000 1.000 0.000 0.000
#> SRR1377202     2  0.0000      0.817 0.000 1.000 0.000 0.000
#> SRR1377203     2  0.0000      0.817 0.000 1.000 0.000 0.000
#> SRR1377204     2  0.0188      0.816 0.000 0.996 0.000 0.004
#> SRR1377205     2  0.0188      0.816 0.000 0.996 0.000 0.004
#> SRR1377206     2  0.0188      0.816 0.000 0.996 0.000 0.004
#> SRR1377207     2  0.0000      0.817 0.000 1.000 0.000 0.000
#> SRR1377208     2  0.0000      0.817 0.000 1.000 0.000 0.000
#> SRR1377209     2  0.0000      0.817 0.000 1.000 0.000 0.000
#> SRR1377210     2  0.0000      0.817 0.000 1.000 0.000 0.000
#> SRR1377211     2  0.0000      0.817 0.000 1.000 0.000 0.000
#> SRR1377212     2  0.0000      0.817 0.000 1.000 0.000 0.000
#> SRR1377213     4  0.0817      0.887 0.000 0.024 0.000 0.976
#> SRR1377214     4  0.0817      0.887 0.000 0.024 0.000 0.976
#> SRR1377215     4  0.0817      0.887 0.000 0.024 0.000 0.976
#> SRR1377216     4  0.0657      0.856 0.000 0.004 0.012 0.984
#> SRR1377217     4  0.0657      0.856 0.000 0.004 0.012 0.984
#> SRR1377218     4  0.0657      0.856 0.000 0.004 0.012 0.984
#> SRR1377219     4  0.0817      0.887 0.000 0.024 0.000 0.976
#> SRR1377220     4  0.0817      0.887 0.000 0.024 0.000 0.976
#> SRR1377221     4  0.0817      0.887 0.000 0.024 0.000 0.976
#> SRR1377222     4  0.3726      0.739 0.000 0.212 0.000 0.788
#> SRR1377223     4  0.3726      0.739 0.000 0.212 0.000 0.788
#> SRR1377224     4  0.3726      0.739 0.000 0.212 0.000 0.788

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>            class entropy silhouette   p1    p2    p3    p4    p5
#> SRR1377145     5  0.0404      1.000 0.00 0.012 0.000 0.000 0.988
#> SRR1377146     5  0.0404      1.000 0.00 0.012 0.000 0.000 0.988
#> SRR1377147     5  0.0404      1.000 0.00 0.012 0.000 0.000 0.988
#> SRR1377148     5  0.0404      1.000 0.00 0.012 0.000 0.000 0.988
#> SRR1377153     5  0.0404      1.000 0.00 0.012 0.000 0.000 0.988
#> SRR1377154     5  0.0404      1.000 0.00 0.012 0.000 0.000 0.988
#> SRR1377155     5  0.0404      1.000 0.00 0.012 0.000 0.000 0.988
#> SRR1377156     5  0.0404      1.000 0.00 0.012 0.000 0.000 0.988
#> SRR1377149     5  0.0404      1.000 0.00 0.012 0.000 0.000 0.988
#> SRR1377150     5  0.0404      1.000 0.00 0.012 0.000 0.000 0.988
#> SRR1377151     5  0.0404      1.000 0.00 0.012 0.000 0.000 0.988
#> SRR1377152     5  0.0404      1.000 0.00 0.012 0.000 0.000 0.988
#> SRR1377157     3  0.0000      1.000 0.00 0.000 1.000 0.000 0.000
#> SRR1377158     3  0.0000      1.000 0.00 0.000 1.000 0.000 0.000
#> SRR1377159     3  0.0000      1.000 0.00 0.000 1.000 0.000 0.000
#> SRR1377160     3  0.0000      1.000 0.00 0.000 1.000 0.000 0.000
#> SRR1377161     3  0.0000      1.000 0.00 0.000 1.000 0.000 0.000
#> SRR1377162     3  0.0000      1.000 0.00 0.000 1.000 0.000 0.000
#> SRR1377163     3  0.0000      1.000 0.00 0.000 1.000 0.000 0.000
#> SRR1377164     3  0.0000      1.000 0.00 0.000 1.000 0.000 0.000
#> SRR1377169     3  0.0000      1.000 0.00 0.000 1.000 0.000 0.000
#> SRR1377170     3  0.0000      1.000 0.00 0.000 1.000 0.000 0.000
#> SRR1377171     3  0.0000      1.000 0.00 0.000 1.000 0.000 0.000
#> SRR1377172     3  0.0000      1.000 0.00 0.000 1.000 0.000 0.000
#> SRR1377165     3  0.0000      1.000 0.00 0.000 1.000 0.000 0.000
#> SRR1377166     3  0.0000      1.000 0.00 0.000 1.000 0.000 0.000
#> SRR1377167     3  0.0000      1.000 0.00 0.000 1.000 0.000 0.000
#> SRR1377168     3  0.0000      1.000 0.00 0.000 1.000 0.000 0.000
#> SRR1377173     1  0.0000      1.000 1.00 0.000 0.000 0.000 0.000
#> SRR1377174     1  0.0000      1.000 1.00 0.000 0.000 0.000 0.000
#> SRR1377175     1  0.0000      1.000 1.00 0.000 0.000 0.000 0.000
#> SRR1377176     1  0.0000      1.000 1.00 0.000 0.000 0.000 0.000
#> SRR1377177     1  0.0000      1.000 1.00 0.000 0.000 0.000 0.000
#> SRR1377178     1  0.0000      1.000 1.00 0.000 0.000 0.000 0.000
#> SRR1377179     1  0.0000      1.000 1.00 0.000 0.000 0.000 0.000
#> SRR1377180     1  0.0000      1.000 1.00 0.000 0.000 0.000 0.000
#> SRR1377181     1  0.0000      1.000 1.00 0.000 0.000 0.000 0.000
#> SRR1377182     1  0.0000      1.000 1.00 0.000 0.000 0.000 0.000
#> SRR1377183     1  0.0000      1.000 1.00 0.000 0.000 0.000 0.000
#> SRR1377184     1  0.0000      1.000 1.00 0.000 0.000 0.000 0.000
#> SRR1377185     1  0.0000      1.000 1.00 0.000 0.000 0.000 0.000
#> SRR1377186     1  0.0000      1.000 1.00 0.000 0.000 0.000 0.000
#> SRR1377187     1  0.0000      1.000 1.00 0.000 0.000 0.000 0.000
#> SRR1377188     1  0.0000      1.000 1.00 0.000 0.000 0.000 0.000
#> SRR1377189     2  0.2676      0.768 0.00 0.884 0.000 0.036 0.080
#> SRR1377190     2  0.2676      0.768 0.00 0.884 0.000 0.036 0.080
#> SRR1377191     2  0.2676      0.768 0.00 0.884 0.000 0.036 0.080
#> SRR1377192     2  0.2676      0.768 0.00 0.884 0.000 0.036 0.080
#> SRR1377193     2  0.2676      0.768 0.00 0.884 0.000 0.036 0.080
#> SRR1377194     2  0.2676      0.768 0.00 0.884 0.000 0.036 0.080
#> SRR1377195     2  0.5009      0.216 0.48 0.496 0.000 0.012 0.012
#> SRR1377196     2  0.5009      0.216 0.48 0.496 0.000 0.012 0.012
#> SRR1377197     2  0.5009      0.216 0.48 0.496 0.000 0.012 0.012
#> SRR1377198     2  0.5009      0.216 0.48 0.496 0.000 0.012 0.012
#> SRR1377199     2  0.5009      0.216 0.48 0.496 0.000 0.012 0.012
#> SRR1377200     2  0.5009      0.216 0.48 0.496 0.000 0.012 0.012
#> SRR1377201     2  0.0162      0.816 0.00 0.996 0.000 0.000 0.004
#> SRR1377202     2  0.0162      0.816 0.00 0.996 0.000 0.000 0.004
#> SRR1377203     2  0.0162      0.816 0.00 0.996 0.000 0.000 0.004
#> SRR1377204     2  0.0162      0.816 0.00 0.996 0.000 0.000 0.004
#> SRR1377205     2  0.0162      0.816 0.00 0.996 0.000 0.000 0.004
#> SRR1377206     2  0.0162      0.816 0.00 0.996 0.000 0.000 0.004
#> SRR1377207     2  0.0162      0.816 0.00 0.996 0.000 0.000 0.004
#> SRR1377208     2  0.0162      0.816 0.00 0.996 0.000 0.000 0.004
#> SRR1377209     2  0.0162      0.816 0.00 0.996 0.000 0.000 0.004
#> SRR1377210     2  0.0162      0.816 0.00 0.996 0.000 0.000 0.004
#> SRR1377211     2  0.0162      0.816 0.00 0.996 0.000 0.000 0.004
#> SRR1377212     2  0.0162      0.816 0.00 0.996 0.000 0.000 0.004
#> SRR1377213     4  0.0404      0.997 0.00 0.000 0.012 0.988 0.000
#> SRR1377214     4  0.0404      0.997 0.00 0.000 0.012 0.988 0.000
#> SRR1377215     4  0.0404      0.997 0.00 0.000 0.012 0.988 0.000
#> SRR1377216     4  0.0404      0.997 0.00 0.000 0.012 0.988 0.000
#> SRR1377217     4  0.0404      0.997 0.00 0.000 0.012 0.988 0.000
#> SRR1377218     4  0.0404      0.997 0.00 0.000 0.012 0.988 0.000
#> SRR1377219     4  0.0404      0.997 0.00 0.000 0.012 0.988 0.000
#> SRR1377220     4  0.0404      0.997 0.00 0.000 0.012 0.988 0.000
#> SRR1377221     4  0.0404      0.997 0.00 0.000 0.012 0.988 0.000
#> SRR1377222     4  0.0451      0.991 0.00 0.008 0.004 0.988 0.000
#> SRR1377223     4  0.0451      0.991 0.00 0.008 0.004 0.988 0.000
#> SRR1377224     4  0.0451      0.991 0.00 0.008 0.004 0.988 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
#> SRR1377145     6  0.0146      0.998 0.000 0.000  0 0.000 0.004 0.996
#> SRR1377146     6  0.0146      0.998 0.000 0.000  0 0.000 0.004 0.996
#> SRR1377147     6  0.0146      0.998 0.000 0.000  0 0.000 0.004 0.996
#> SRR1377148     6  0.0146      0.998 0.000 0.000  0 0.000 0.004 0.996
#> SRR1377153     6  0.0000      0.999 0.000 0.000  0 0.000 0.000 1.000
#> SRR1377154     6  0.0000      0.999 0.000 0.000  0 0.000 0.000 1.000
#> SRR1377155     6  0.0000      0.999 0.000 0.000  0 0.000 0.000 1.000
#> SRR1377156     6  0.0000      0.999 0.000 0.000  0 0.000 0.000 1.000
#> SRR1377149     6  0.0000      0.999 0.000 0.000  0 0.000 0.000 1.000
#> SRR1377150     6  0.0000      0.999 0.000 0.000  0 0.000 0.000 1.000
#> SRR1377151     6  0.0000      0.999 0.000 0.000  0 0.000 0.000 1.000
#> SRR1377152     6  0.0000      0.999 0.000 0.000  0 0.000 0.000 1.000
#> SRR1377157     3  0.0000      1.000 0.000 0.000  1 0.000 0.000 0.000
#> SRR1377158     3  0.0000      1.000 0.000 0.000  1 0.000 0.000 0.000
#> SRR1377159     3  0.0000      1.000 0.000 0.000  1 0.000 0.000 0.000
#> SRR1377160     3  0.0000      1.000 0.000 0.000  1 0.000 0.000 0.000
#> SRR1377161     3  0.0000      1.000 0.000 0.000  1 0.000 0.000 0.000
#> SRR1377162     3  0.0000      1.000 0.000 0.000  1 0.000 0.000 0.000
#> SRR1377163     3  0.0000      1.000 0.000 0.000  1 0.000 0.000 0.000
#> SRR1377164     3  0.0000      1.000 0.000 0.000  1 0.000 0.000 0.000
#> SRR1377169     3  0.0000      1.000 0.000 0.000  1 0.000 0.000 0.000
#> SRR1377170     3  0.0000      1.000 0.000 0.000  1 0.000 0.000 0.000
#> SRR1377171     3  0.0000      1.000 0.000 0.000  1 0.000 0.000 0.000
#> SRR1377172     3  0.0000      1.000 0.000 0.000  1 0.000 0.000 0.000
#> SRR1377165     3  0.0000      1.000 0.000 0.000  1 0.000 0.000 0.000
#> SRR1377166     3  0.0000      1.000 0.000 0.000  1 0.000 0.000 0.000
#> SRR1377167     3  0.0000      1.000 0.000 0.000  1 0.000 0.000 0.000
#> SRR1377168     3  0.0000      1.000 0.000 0.000  1 0.000 0.000 0.000
#> SRR1377173     1  0.0000      0.994 1.000 0.000  0 0.000 0.000 0.000
#> SRR1377174     1  0.0000      0.994 1.000 0.000  0 0.000 0.000 0.000
#> SRR1377175     1  0.0000      0.994 1.000 0.000  0 0.000 0.000 0.000
#> SRR1377176     1  0.0000      0.994 1.000 0.000  0 0.000 0.000 0.000
#> SRR1377177     1  0.0000      0.994 1.000 0.000  0 0.000 0.000 0.000
#> SRR1377178     1  0.0000      0.994 1.000 0.000  0 0.000 0.000 0.000
#> SRR1377179     1  0.0000      0.994 1.000 0.000  0 0.000 0.000 0.000
#> SRR1377180     1  0.0000      0.994 1.000 0.000  0 0.000 0.000 0.000
#> SRR1377181     1  0.0000      0.994 1.000 0.000  0 0.000 0.000 0.000
#> SRR1377182     1  0.0000      0.994 1.000 0.000  0 0.000 0.000 0.000
#> SRR1377183     1  0.0632      0.982 0.976 0.000  0 0.000 0.024 0.000
#> SRR1377184     1  0.0000      0.994 1.000 0.000  0 0.000 0.000 0.000
#> SRR1377185     1  0.0632      0.982 0.976 0.000  0 0.000 0.024 0.000
#> SRR1377186     1  0.0632      0.982 0.976 0.000  0 0.000 0.024 0.000
#> SRR1377187     1  0.0000      0.994 1.000 0.000  0 0.000 0.000 0.000
#> SRR1377188     1  0.0632      0.982 0.976 0.000  0 0.000 0.024 0.000
#> SRR1377189     2  0.5253      0.718 0.000 0.664  0 0.040 0.208 0.088
#> SRR1377190     2  0.5253      0.718 0.000 0.664  0 0.040 0.208 0.088
#> SRR1377191     2  0.5253      0.718 0.000 0.664  0 0.040 0.208 0.088
#> SRR1377192     2  0.5278      0.717 0.000 0.660  0 0.040 0.212 0.088
#> SRR1377193     2  0.5278      0.717 0.000 0.660  0 0.040 0.212 0.088
#> SRR1377194     2  0.5278      0.717 0.000 0.660  0 0.040 0.212 0.088
#> SRR1377195     5  0.2733      1.000 0.056 0.080  0 0.000 0.864 0.000
#> SRR1377196     5  0.2733      1.000 0.056 0.080  0 0.000 0.864 0.000
#> SRR1377197     5  0.2733      1.000 0.056 0.080  0 0.000 0.864 0.000
#> SRR1377198     5  0.2733      1.000 0.056 0.080  0 0.000 0.864 0.000
#> SRR1377199     5  0.2733      1.000 0.056 0.080  0 0.000 0.864 0.000
#> SRR1377200     5  0.2733      1.000 0.056 0.080  0 0.000 0.864 0.000
#> SRR1377201     2  0.0000      0.873 0.000 1.000  0 0.000 0.000 0.000
#> SRR1377202     2  0.0000      0.873 0.000 1.000  0 0.000 0.000 0.000
#> SRR1377203     2  0.0000      0.873 0.000 1.000  0 0.000 0.000 0.000
#> SRR1377204     2  0.0260      0.870 0.000 0.992  0 0.000 0.008 0.000
#> SRR1377205     2  0.0260      0.870 0.000 0.992  0 0.000 0.008 0.000
#> SRR1377206     2  0.0260      0.870 0.000 0.992  0 0.000 0.008 0.000
#> SRR1377207     2  0.0000      0.873 0.000 1.000  0 0.000 0.000 0.000
#> SRR1377208     2  0.0000      0.873 0.000 1.000  0 0.000 0.000 0.000
#> SRR1377209     2  0.0000      0.873 0.000 1.000  0 0.000 0.000 0.000
#> SRR1377210     2  0.0000      0.873 0.000 1.000  0 0.000 0.000 0.000
#> SRR1377211     2  0.0000      0.873 0.000 1.000  0 0.000 0.000 0.000
#> SRR1377212     2  0.0000      0.873 0.000 1.000  0 0.000 0.000 0.000
#> SRR1377213     4  0.0000      0.997 0.000 0.000  0 1.000 0.000 0.000
#> SRR1377214     4  0.0000      0.997 0.000 0.000  0 1.000 0.000 0.000
#> SRR1377215     4  0.0000      0.997 0.000 0.000  0 1.000 0.000 0.000
#> SRR1377216     4  0.0146      0.996 0.000 0.000  0 0.996 0.004 0.000
#> SRR1377217     4  0.0146      0.996 0.000 0.000  0 0.996 0.004 0.000
#> SRR1377218     4  0.0146      0.996 0.000 0.000  0 0.996 0.004 0.000
#> SRR1377219     4  0.0000      0.997 0.000 0.000  0 1.000 0.000 0.000
#> SRR1377220     4  0.0000      0.997 0.000 0.000  0 1.000 0.000 0.000
#> SRR1377221     4  0.0000      0.997 0.000 0.000  0 1.000 0.000 0.000
#> SRR1377222     4  0.0260      0.994 0.000 0.000  0 0.992 0.008 0.000
#> SRR1377223     4  0.0260      0.994 0.000 0.000  0 0.992 0.008 0.000
#> SRR1377224     4  0.0260      0.994 0.000 0.000  0 0.992 0.008 0.000

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

consensus_heatmap(res, k = 2)

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

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

collect_plots(res)

plot of chunk MAD-pam-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.764           0.901       0.950         0.3698 0.676   0.676
#> 3 3 0.950           0.949       0.959         0.6615 0.708   0.567
#> 4 4 1.000           0.983       0.992         0.1857 0.886   0.703
#> 5 5 0.913           0.874       0.895         0.0742 0.902   0.652
#> 6 6 0.963           0.972       0.983         0.0617 0.971   0.851

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
#> SRR1377145     2   0.000      0.935 0.000 1.000
#> SRR1377146     2   0.000      0.935 0.000 1.000
#> SRR1377147     2   0.000      0.935 0.000 1.000
#> SRR1377148     2   0.000      0.935 0.000 1.000
#> SRR1377153     2   0.000      0.935 0.000 1.000
#> SRR1377154     2   0.000      0.935 0.000 1.000
#> SRR1377155     2   0.000      0.935 0.000 1.000
#> SRR1377156     2   0.000      0.935 0.000 1.000
#> SRR1377149     2   0.000      0.935 0.000 1.000
#> SRR1377150     2   0.000      0.935 0.000 1.000
#> SRR1377151     2   0.000      0.935 0.000 1.000
#> SRR1377152     2   0.000      0.935 0.000 1.000
#> SRR1377157     1   0.000      1.000 1.000 0.000
#> SRR1377158     1   0.000      1.000 1.000 0.000
#> SRR1377159     1   0.000      1.000 1.000 0.000
#> SRR1377160     1   0.000      1.000 1.000 0.000
#> SRR1377161     1   0.000      1.000 1.000 0.000
#> SRR1377162     1   0.000      1.000 1.000 0.000
#> SRR1377163     1   0.000      1.000 1.000 0.000
#> SRR1377164     1   0.000      1.000 1.000 0.000
#> SRR1377169     1   0.000      1.000 1.000 0.000
#> SRR1377170     1   0.000      1.000 1.000 0.000
#> SRR1377171     1   0.000      1.000 1.000 0.000
#> SRR1377172     1   0.000      1.000 1.000 0.000
#> SRR1377165     1   0.000      1.000 1.000 0.000
#> SRR1377166     1   0.000      1.000 1.000 0.000
#> SRR1377167     1   0.000      1.000 1.000 0.000
#> SRR1377168     1   0.000      1.000 1.000 0.000
#> SRR1377173     2   0.925      0.591 0.340 0.660
#> SRR1377174     2   0.917      0.604 0.332 0.668
#> SRR1377175     2   0.925      0.590 0.340 0.660
#> SRR1377176     2   0.943      0.553 0.360 0.640
#> SRR1377177     2   0.814      0.720 0.252 0.748
#> SRR1377178     2   0.839      0.701 0.268 0.732
#> SRR1377179     2   0.844      0.695 0.272 0.728
#> SRR1377180     2   0.969      0.476 0.396 0.604
#> SRR1377181     2   0.795      0.734 0.240 0.760
#> SRR1377182     2   0.827      0.710 0.260 0.740
#> SRR1377183     2   0.000      0.935 0.000 1.000
#> SRR1377184     2   0.808      0.725 0.248 0.752
#> SRR1377185     2   0.000      0.935 0.000 1.000
#> SRR1377186     2   0.000      0.935 0.000 1.000
#> SRR1377187     2   0.839      0.700 0.268 0.732
#> SRR1377188     2   0.000      0.935 0.000 1.000
#> SRR1377189     2   0.000      0.935 0.000 1.000
#> SRR1377190     2   0.000      0.935 0.000 1.000
#> SRR1377191     2   0.000      0.935 0.000 1.000
#> SRR1377192     2   0.000      0.935 0.000 1.000
#> SRR1377193     2   0.000      0.935 0.000 1.000
#> SRR1377194     2   0.000      0.935 0.000 1.000
#> SRR1377195     2   0.000      0.935 0.000 1.000
#> SRR1377196     2   0.000      0.935 0.000 1.000
#> SRR1377197     2   0.000      0.935 0.000 1.000
#> SRR1377198     2   0.000      0.935 0.000 1.000
#> SRR1377199     2   0.000      0.935 0.000 1.000
#> SRR1377200     2   0.000      0.935 0.000 1.000
#> SRR1377201     2   0.000      0.935 0.000 1.000
#> SRR1377202     2   0.000      0.935 0.000 1.000
#> SRR1377203     2   0.000      0.935 0.000 1.000
#> SRR1377204     2   0.000      0.935 0.000 1.000
#> SRR1377205     2   0.000      0.935 0.000 1.000
#> SRR1377206     2   0.000      0.935 0.000 1.000
#> SRR1377207     2   0.000      0.935 0.000 1.000
#> SRR1377208     2   0.000      0.935 0.000 1.000
#> SRR1377209     2   0.000      0.935 0.000 1.000
#> SRR1377210     2   0.000      0.935 0.000 1.000
#> SRR1377211     2   0.000      0.935 0.000 1.000
#> SRR1377212     2   0.000      0.935 0.000 1.000
#> SRR1377213     2   0.000      0.935 0.000 1.000
#> SRR1377214     2   0.000      0.935 0.000 1.000
#> SRR1377215     2   0.000      0.935 0.000 1.000
#> SRR1377216     2   0.416      0.877 0.084 0.916
#> SRR1377217     2   0.634      0.814 0.160 0.840
#> SRR1377218     2   0.653      0.807 0.168 0.832
#> SRR1377219     2   0.000      0.935 0.000 1.000
#> SRR1377220     2   0.000      0.935 0.000 1.000
#> SRR1377221     2   0.000      0.935 0.000 1.000
#> SRR1377222     2   0.000      0.935 0.000 1.000
#> SRR1377223     2   0.000      0.935 0.000 1.000
#> SRR1377224     2   0.000      0.935 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
#> SRR1377145     2  0.2878      0.943 0.096 0.904 0.000
#> SRR1377146     2  0.2878      0.943 0.096 0.904 0.000
#> SRR1377147     2  0.2878      0.943 0.096 0.904 0.000
#> SRR1377148     2  0.2878      0.943 0.096 0.904 0.000
#> SRR1377153     2  0.0747      0.953 0.016 0.984 0.000
#> SRR1377154     2  0.1163      0.953 0.028 0.972 0.000
#> SRR1377155     2  0.0747      0.953 0.016 0.984 0.000
#> SRR1377156     2  0.1163      0.952 0.028 0.972 0.000
#> SRR1377149     2  0.2878      0.943 0.096 0.904 0.000
#> SRR1377150     2  0.2878      0.943 0.096 0.904 0.000
#> SRR1377151     2  0.2878      0.943 0.096 0.904 0.000
#> SRR1377152     2  0.2878      0.943 0.096 0.904 0.000
#> SRR1377157     3  0.0000      1.000 0.000 0.000 1.000
#> SRR1377158     3  0.0000      1.000 0.000 0.000 1.000
#> SRR1377159     3  0.0000      1.000 0.000 0.000 1.000
#> SRR1377160     3  0.0000      1.000 0.000 0.000 1.000
#> SRR1377161     3  0.0000      1.000 0.000 0.000 1.000
#> SRR1377162     3  0.0000      1.000 0.000 0.000 1.000
#> SRR1377163     3  0.0000      1.000 0.000 0.000 1.000
#> SRR1377164     3  0.0000      1.000 0.000 0.000 1.000
#> SRR1377169     3  0.0000      1.000 0.000 0.000 1.000
#> SRR1377170     3  0.0000      1.000 0.000 0.000 1.000
#> SRR1377171     3  0.0000      1.000 0.000 0.000 1.000
#> SRR1377172     3  0.0000      1.000 0.000 0.000 1.000
#> SRR1377165     3  0.0000      1.000 0.000 0.000 1.000
#> SRR1377166     3  0.0000      1.000 0.000 0.000 1.000
#> SRR1377167     3  0.0000      1.000 0.000 0.000 1.000
#> SRR1377168     3  0.0000      1.000 0.000 0.000 1.000
#> SRR1377173     1  0.0000      0.948 1.000 0.000 0.000
#> SRR1377174     1  0.0000      0.948 1.000 0.000 0.000
#> SRR1377175     1  0.0000      0.948 1.000 0.000 0.000
#> SRR1377176     1  0.0000      0.948 1.000 0.000 0.000
#> SRR1377177     1  0.0000      0.948 1.000 0.000 0.000
#> SRR1377178     1  0.0000      0.948 1.000 0.000 0.000
#> SRR1377179     1  0.0000      0.948 1.000 0.000 0.000
#> SRR1377180     1  0.0000      0.948 1.000 0.000 0.000
#> SRR1377181     1  0.0000      0.948 1.000 0.000 0.000
#> SRR1377182     1  0.0000      0.948 1.000 0.000 0.000
#> SRR1377183     1  0.0000      0.948 1.000 0.000 0.000
#> SRR1377184     1  0.0000      0.948 1.000 0.000 0.000
#> SRR1377185     1  0.0000      0.948 1.000 0.000 0.000
#> SRR1377186     1  0.0000      0.948 1.000 0.000 0.000
#> SRR1377187     1  0.0000      0.948 1.000 0.000 0.000
#> SRR1377188     1  0.0000      0.948 1.000 0.000 0.000
#> SRR1377189     2  0.0747      0.953 0.016 0.984 0.000
#> SRR1377190     2  0.0747      0.953 0.016 0.984 0.000
#> SRR1377191     2  0.0747      0.953 0.016 0.984 0.000
#> SRR1377192     2  0.0747      0.953 0.016 0.984 0.000
#> SRR1377193     2  0.0747      0.953 0.016 0.984 0.000
#> SRR1377194     2  0.0747      0.953 0.016 0.984 0.000
#> SRR1377195     1  0.3192      0.879 0.888 0.112 0.000
#> SRR1377196     1  0.4002      0.849 0.840 0.160 0.000
#> SRR1377197     1  0.3267      0.878 0.884 0.116 0.000
#> SRR1377198     1  0.4750      0.796 0.784 0.216 0.000
#> SRR1377199     1  0.4452      0.821 0.808 0.192 0.000
#> SRR1377200     1  0.4605      0.803 0.796 0.204 0.000
#> SRR1377201     2  0.0747      0.953 0.016 0.984 0.000
#> SRR1377202     2  0.0747      0.953 0.016 0.984 0.000
#> SRR1377203     2  0.0747      0.953 0.016 0.984 0.000
#> SRR1377204     2  0.0747      0.953 0.016 0.984 0.000
#> SRR1377205     2  0.0747      0.953 0.016 0.984 0.000
#> SRR1377206     2  0.0747      0.953 0.016 0.984 0.000
#> SRR1377207     2  0.0747      0.953 0.016 0.984 0.000
#> SRR1377208     2  0.0747      0.953 0.016 0.984 0.000
#> SRR1377209     2  0.0747      0.953 0.016 0.984 0.000
#> SRR1377210     2  0.0747      0.953 0.016 0.984 0.000
#> SRR1377211     2  0.0747      0.953 0.016 0.984 0.000
#> SRR1377212     2  0.0747      0.953 0.016 0.984 0.000
#> SRR1377213     2  0.2537      0.941 0.080 0.920 0.000
#> SRR1377214     2  0.2537      0.941 0.080 0.920 0.000
#> SRR1377215     2  0.2537      0.941 0.080 0.920 0.000
#> SRR1377216     2  0.3856      0.920 0.072 0.888 0.040
#> SRR1377217     2  0.4281      0.906 0.072 0.872 0.056
#> SRR1377218     2  0.4281      0.907 0.072 0.872 0.056
#> SRR1377219     2  0.2537      0.941 0.080 0.920 0.000
#> SRR1377220     2  0.2537      0.941 0.080 0.920 0.000
#> SRR1377221     2  0.2537      0.941 0.080 0.920 0.000
#> SRR1377222     2  0.2537      0.941 0.080 0.920 0.000
#> SRR1377223     2  0.2537      0.941 0.080 0.920 0.000
#> SRR1377224     2  0.2537      0.941 0.080 0.920 0.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2 p3 p4
#> SRR1377145     2  0.0000      0.999 0.000 1.000  0  0
#> SRR1377146     2  0.0000      0.999 0.000 1.000  0  0
#> SRR1377147     2  0.0000      0.999 0.000 1.000  0  0
#> SRR1377148     2  0.0000      0.999 0.000 1.000  0  0
#> SRR1377153     2  0.0000      0.999 0.000 1.000  0  0
#> SRR1377154     2  0.0000      0.999 0.000 1.000  0  0
#> SRR1377155     2  0.0336      0.991 0.008 0.992  0  0
#> SRR1377156     2  0.0336      0.991 0.008 0.992  0  0
#> SRR1377149     2  0.0000      0.999 0.000 1.000  0  0
#> SRR1377150     2  0.0000      0.999 0.000 1.000  0  0
#> SRR1377151     2  0.0000      0.999 0.000 1.000  0  0
#> SRR1377152     2  0.0000      0.999 0.000 1.000  0  0
#> SRR1377157     3  0.0000      1.000 0.000 0.000  1  0
#> SRR1377158     3  0.0000      1.000 0.000 0.000  1  0
#> SRR1377159     3  0.0000      1.000 0.000 0.000  1  0
#> SRR1377160     3  0.0000      1.000 0.000 0.000  1  0
#> SRR1377161     3  0.0000      1.000 0.000 0.000  1  0
#> SRR1377162     3  0.0000      1.000 0.000 0.000  1  0
#> SRR1377163     3  0.0000      1.000 0.000 0.000  1  0
#> SRR1377164     3  0.0000      1.000 0.000 0.000  1  0
#> SRR1377169     3  0.0000      1.000 0.000 0.000  1  0
#> SRR1377170     3  0.0000      1.000 0.000 0.000  1  0
#> SRR1377171     3  0.0000      1.000 0.000 0.000  1  0
#> SRR1377172     3  0.0000      1.000 0.000 0.000  1  0
#> SRR1377165     3  0.0000      1.000 0.000 0.000  1  0
#> SRR1377166     3  0.0000      1.000 0.000 0.000  1  0
#> SRR1377167     3  0.0000      1.000 0.000 0.000  1  0
#> SRR1377168     3  0.0000      1.000 0.000 0.000  1  0
#> SRR1377173     1  0.0000      0.966 1.000 0.000  0  0
#> SRR1377174     1  0.0000      0.966 1.000 0.000  0  0
#> SRR1377175     1  0.0000      0.966 1.000 0.000  0  0
#> SRR1377176     1  0.0000      0.966 1.000 0.000  0  0
#> SRR1377177     1  0.0000      0.966 1.000 0.000  0  0
#> SRR1377178     1  0.0000      0.966 1.000 0.000  0  0
#> SRR1377179     1  0.0000      0.966 1.000 0.000  0  0
#> SRR1377180     1  0.0000      0.966 1.000 0.000  0  0
#> SRR1377181     1  0.0000      0.966 1.000 0.000  0  0
#> SRR1377182     1  0.0000      0.966 1.000 0.000  0  0
#> SRR1377183     1  0.0000      0.966 1.000 0.000  0  0
#> SRR1377184     1  0.0000      0.966 1.000 0.000  0  0
#> SRR1377185     1  0.0000      0.966 1.000 0.000  0  0
#> SRR1377186     1  0.0000      0.966 1.000 0.000  0  0
#> SRR1377187     1  0.0000      0.966 1.000 0.000  0  0
#> SRR1377188     1  0.0000      0.966 1.000 0.000  0  0
#> SRR1377189     2  0.0000      0.999 0.000 1.000  0  0
#> SRR1377190     2  0.0000      0.999 0.000 1.000  0  0
#> SRR1377191     2  0.0000      0.999 0.000 1.000  0  0
#> SRR1377192     2  0.0000      0.999 0.000 1.000  0  0
#> SRR1377193     2  0.0000      0.999 0.000 1.000  0  0
#> SRR1377194     2  0.0000      0.999 0.000 1.000  0  0
#> SRR1377195     1  0.0921      0.947 0.972 0.028  0  0
#> SRR1377196     1  0.1867      0.910 0.928 0.072  0  0
#> SRR1377197     1  0.0707      0.953 0.980 0.020  0  0
#> SRR1377198     1  0.3569      0.768 0.804 0.196  0  0
#> SRR1377199     1  0.2469      0.874 0.892 0.108  0  0
#> SRR1377200     1  0.3266      0.805 0.832 0.168  0  0
#> SRR1377201     2  0.0000      0.999 0.000 1.000  0  0
#> SRR1377202     2  0.0000      0.999 0.000 1.000  0  0
#> SRR1377203     2  0.0000      0.999 0.000 1.000  0  0
#> SRR1377204     2  0.0000      0.999 0.000 1.000  0  0
#> SRR1377205     2  0.0000      0.999 0.000 1.000  0  0
#> SRR1377206     2  0.0000      0.999 0.000 1.000  0  0
#> SRR1377207     2  0.0000      0.999 0.000 1.000  0  0
#> SRR1377208     2  0.0000      0.999 0.000 1.000  0  0
#> SRR1377209     2  0.0000      0.999 0.000 1.000  0  0
#> SRR1377210     2  0.0000      0.999 0.000 1.000  0  0
#> SRR1377211     2  0.0000      0.999 0.000 1.000  0  0
#> SRR1377212     2  0.0000      0.999 0.000 1.000  0  0
#> SRR1377213     4  0.0000      1.000 0.000 0.000  0  1
#> SRR1377214     4  0.0000      1.000 0.000 0.000  0  1
#> SRR1377215     4  0.0000      1.000 0.000 0.000  0  1
#> SRR1377216     4  0.0000      1.000 0.000 0.000  0  1
#> SRR1377217     4  0.0000      1.000 0.000 0.000  0  1
#> SRR1377218     4  0.0000      1.000 0.000 0.000  0  1
#> SRR1377219     4  0.0000      1.000 0.000 0.000  0  1
#> SRR1377220     4  0.0000      1.000 0.000 0.000  0  1
#> SRR1377221     4  0.0000      1.000 0.000 0.000  0  1
#> SRR1377222     4  0.0000      1.000 0.000 0.000  0  1
#> SRR1377223     4  0.0000      1.000 0.000 0.000  0  1
#> SRR1377224     4  0.0000      1.000 0.000 0.000  0  1

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>            class entropy silhouette    p1    p2 p3 p4   p5
#> SRR1377145     5   0.426     0.6997 0.000 0.440  0  0 0.56
#> SRR1377146     5   0.426     0.6997 0.000 0.440  0  0 0.56
#> SRR1377147     5   0.426     0.6997 0.000 0.440  0  0 0.56
#> SRR1377148     5   0.426     0.6997 0.000 0.440  0  0 0.56
#> SRR1377153     5   0.426     0.6997 0.000 0.440  0  0 0.56
#> SRR1377154     5   0.426     0.6997 0.000 0.440  0  0 0.56
#> SRR1377155     5   0.426     0.6997 0.000 0.440  0  0 0.56
#> SRR1377156     5   0.426     0.6997 0.000 0.440  0  0 0.56
#> SRR1377149     5   0.426     0.6997 0.000 0.440  0  0 0.56
#> SRR1377150     5   0.426     0.6997 0.000 0.440  0  0 0.56
#> SRR1377151     5   0.426     0.6997 0.000 0.440  0  0 0.56
#> SRR1377152     5   0.426     0.6997 0.000 0.440  0  0 0.56
#> SRR1377157     3   0.000     1.0000 0.000 0.000  1  0 0.00
#> SRR1377158     3   0.000     1.0000 0.000 0.000  1  0 0.00
#> SRR1377159     3   0.000     1.0000 0.000 0.000  1  0 0.00
#> SRR1377160     3   0.000     1.0000 0.000 0.000  1  0 0.00
#> SRR1377161     3   0.000     1.0000 0.000 0.000  1  0 0.00
#> SRR1377162     3   0.000     1.0000 0.000 0.000  1  0 0.00
#> SRR1377163     3   0.000     1.0000 0.000 0.000  1  0 0.00
#> SRR1377164     3   0.000     1.0000 0.000 0.000  1  0 0.00
#> SRR1377169     3   0.000     1.0000 0.000 0.000  1  0 0.00
#> SRR1377170     3   0.000     1.0000 0.000 0.000  1  0 0.00
#> SRR1377171     3   0.000     1.0000 0.000 0.000  1  0 0.00
#> SRR1377172     3   0.000     1.0000 0.000 0.000  1  0 0.00
#> SRR1377165     3   0.000     1.0000 0.000 0.000  1  0 0.00
#> SRR1377166     3   0.000     1.0000 0.000 0.000  1  0 0.00
#> SRR1377167     3   0.000     1.0000 0.000 0.000  1  0 0.00
#> SRR1377168     3   0.000     1.0000 0.000 0.000  1  0 0.00
#> SRR1377173     1   0.000     0.9276 1.000 0.000  0  0 0.00
#> SRR1377174     1   0.000     0.9276 1.000 0.000  0  0 0.00
#> SRR1377175     1   0.000     0.9276 1.000 0.000  0  0 0.00
#> SRR1377176     1   0.000     0.9276 1.000 0.000  0  0 0.00
#> SRR1377177     1   0.000     0.9276 1.000 0.000  0  0 0.00
#> SRR1377178     1   0.000     0.9276 1.000 0.000  0  0 0.00
#> SRR1377179     1   0.000     0.9276 1.000 0.000  0  0 0.00
#> SRR1377180     1   0.000     0.9276 1.000 0.000  0  0 0.00
#> SRR1377181     1   0.000     0.9276 1.000 0.000  0  0 0.00
#> SRR1377182     1   0.000     0.9276 1.000 0.000  0  0 0.00
#> SRR1377183     1   0.000     0.9276 1.000 0.000  0  0 0.00
#> SRR1377184     1   0.000     0.9276 1.000 0.000  0  0 0.00
#> SRR1377185     1   0.000     0.9276 1.000 0.000  0  0 0.00
#> SRR1377186     1   0.000     0.9276 1.000 0.000  0  0 0.00
#> SRR1377187     1   0.000     0.9276 1.000 0.000  0  0 0.00
#> SRR1377188     1   0.000     0.9276 1.000 0.000  0  0 0.00
#> SRR1377189     2   0.000     1.0000 0.000 1.000  0  0 0.00
#> SRR1377190     2   0.000     1.0000 0.000 1.000  0  0 0.00
#> SRR1377191     2   0.000     1.0000 0.000 1.000  0  0 0.00
#> SRR1377192     2   0.000     1.0000 0.000 1.000  0  0 0.00
#> SRR1377193     2   0.000     1.0000 0.000 1.000  0  0 0.00
#> SRR1377194     2   0.000     1.0000 0.000 1.000  0  0 0.00
#> SRR1377195     1   0.502     0.5269 0.528 0.032  0  0 0.44
#> SRR1377196     1   0.569     0.4584 0.480 0.080  0  0 0.44
#> SRR1377197     1   0.480     0.5410 0.540 0.020  0  0 0.44
#> SRR1377198     5   0.646    -0.0399 0.184 0.376  0  0 0.44
#> SRR1377199     5   0.622    -0.4271 0.420 0.140  0  0 0.44
#> SRR1377200     5   0.651    -0.3374 0.364 0.196  0  0 0.44
#> SRR1377201     2   0.000     1.0000 0.000 1.000  0  0 0.00
#> SRR1377202     2   0.000     1.0000 0.000 1.000  0  0 0.00
#> SRR1377203     2   0.000     1.0000 0.000 1.000  0  0 0.00
#> SRR1377204     2   0.000     1.0000 0.000 1.000  0  0 0.00
#> SRR1377205     2   0.000     1.0000 0.000 1.000  0  0 0.00
#> SRR1377206     2   0.000     1.0000 0.000 1.000  0  0 0.00
#> SRR1377207     2   0.000     1.0000 0.000 1.000  0  0 0.00
#> SRR1377208     2   0.000     1.0000 0.000 1.000  0  0 0.00
#> SRR1377209     2   0.000     1.0000 0.000 1.000  0  0 0.00
#> SRR1377210     2   0.000     1.0000 0.000 1.000  0  0 0.00
#> SRR1377211     2   0.000     1.0000 0.000 1.000  0  0 0.00
#> SRR1377212     2   0.000     1.0000 0.000 1.000  0  0 0.00
#> SRR1377213     4   0.000     1.0000 0.000 0.000  0  1 0.00
#> SRR1377214     4   0.000     1.0000 0.000 0.000  0  1 0.00
#> SRR1377215     4   0.000     1.0000 0.000 0.000  0  1 0.00
#> SRR1377216     4   0.000     1.0000 0.000 0.000  0  1 0.00
#> SRR1377217     4   0.000     1.0000 0.000 0.000  0  1 0.00
#> SRR1377218     4   0.000     1.0000 0.000 0.000  0  1 0.00
#> SRR1377219     4   0.000     1.0000 0.000 0.000  0  1 0.00
#> SRR1377220     4   0.000     1.0000 0.000 0.000  0  1 0.00
#> SRR1377221     4   0.000     1.0000 0.000 0.000  0  1 0.00
#> SRR1377222     4   0.000     1.0000 0.000 0.000  0  1 0.00
#> SRR1377223     4   0.000     1.0000 0.000 0.000  0  1 0.00
#> SRR1377224     4   0.000     1.0000 0.000 0.000  0  1 0.00

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>            class entropy silhouette    p1    p2 p3 p4    p5 p6
#> SRR1377145     6   0.000      1.000 0.000 0.000  0  0 0.000  1
#> SRR1377146     6   0.000      1.000 0.000 0.000  0  0 0.000  1
#> SRR1377147     6   0.000      1.000 0.000 0.000  0  0 0.000  1
#> SRR1377148     6   0.000      1.000 0.000 0.000  0  0 0.000  1
#> SRR1377153     6   0.000      1.000 0.000 0.000  0  0 0.000  1
#> SRR1377154     6   0.000      1.000 0.000 0.000  0  0 0.000  1
#> SRR1377155     6   0.000      1.000 0.000 0.000  0  0 0.000  1
#> SRR1377156     6   0.000      1.000 0.000 0.000  0  0 0.000  1
#> SRR1377149     6   0.000      1.000 0.000 0.000  0  0 0.000  1
#> SRR1377150     6   0.000      1.000 0.000 0.000  0  0 0.000  1
#> SRR1377151     6   0.000      1.000 0.000 0.000  0  0 0.000  1
#> SRR1377152     6   0.000      1.000 0.000 0.000  0  0 0.000  1
#> SRR1377157     3   0.000      1.000 0.000 0.000  1  0 0.000  0
#> SRR1377158     3   0.000      1.000 0.000 0.000  1  0 0.000  0
#> SRR1377159     3   0.000      1.000 0.000 0.000  1  0 0.000  0
#> SRR1377160     3   0.000      1.000 0.000 0.000  1  0 0.000  0
#> SRR1377161     3   0.000      1.000 0.000 0.000  1  0 0.000  0
#> SRR1377162     3   0.000      1.000 0.000 0.000  1  0 0.000  0
#> SRR1377163     3   0.000      1.000 0.000 0.000  1  0 0.000  0
#> SRR1377164     3   0.000      1.000 0.000 0.000  1  0 0.000  0
#> SRR1377169     3   0.000      1.000 0.000 0.000  1  0 0.000  0
#> SRR1377170     3   0.000      1.000 0.000 0.000  1  0 0.000  0
#> SRR1377171     3   0.000      1.000 0.000 0.000  1  0 0.000  0
#> SRR1377172     3   0.000      1.000 0.000 0.000  1  0 0.000  0
#> SRR1377165     3   0.000      1.000 0.000 0.000  1  0 0.000  0
#> SRR1377166     3   0.000      1.000 0.000 0.000  1  0 0.000  0
#> SRR1377167     3   0.000      1.000 0.000 0.000  1  0 0.000  0
#> SRR1377168     3   0.000      1.000 0.000 0.000  1  0 0.000  0
#> SRR1377173     1   0.000      1.000 1.000 0.000  0  0 0.000  0
#> SRR1377174     1   0.000      1.000 1.000 0.000  0  0 0.000  0
#> SRR1377175     1   0.000      1.000 1.000 0.000  0  0 0.000  0
#> SRR1377176     1   0.000      1.000 1.000 0.000  0  0 0.000  0
#> SRR1377177     1   0.000      1.000 1.000 0.000  0  0 0.000  0
#> SRR1377178     1   0.000      1.000 1.000 0.000  0  0 0.000  0
#> SRR1377179     1   0.000      1.000 1.000 0.000  0  0 0.000  0
#> SRR1377180     1   0.000      1.000 1.000 0.000  0  0 0.000  0
#> SRR1377181     1   0.000      1.000 1.000 0.000  0  0 0.000  0
#> SRR1377182     1   0.000      1.000 1.000 0.000  0  0 0.000  0
#> SRR1377183     1   0.000      1.000 1.000 0.000  0  0 0.000  0
#> SRR1377184     1   0.000      1.000 1.000 0.000  0  0 0.000  0
#> SRR1377185     1   0.000      1.000 1.000 0.000  0  0 0.000  0
#> SRR1377186     1   0.000      1.000 1.000 0.000  0  0 0.000  0
#> SRR1377187     1   0.000      1.000 1.000 0.000  0  0 0.000  0
#> SRR1377188     1   0.000      1.000 1.000 0.000  0  0 0.000  0
#> SRR1377189     2   0.266      0.851 0.000 0.816  0  0 0.184  0
#> SRR1377190     2   0.266      0.851 0.000 0.816  0  0 0.184  0
#> SRR1377191     2   0.266      0.851 0.000 0.816  0  0 0.184  0
#> SRR1377192     2   0.266      0.851 0.000 0.816  0  0 0.184  0
#> SRR1377193     2   0.266      0.851 0.000 0.816  0  0 0.184  0
#> SRR1377194     2   0.266      0.851 0.000 0.816  0  0 0.184  0
#> SRR1377195     5   0.221      0.899 0.096 0.016  0  0 0.888  0
#> SRR1377196     5   0.123      0.931 0.036 0.012  0  0 0.952  0
#> SRR1377197     5   0.235      0.874 0.124 0.008  0  0 0.868  0
#> SRR1377198     5   0.000      0.933 0.000 0.000  0  0 1.000  0
#> SRR1377199     5   0.000      0.933 0.000 0.000  0  0 1.000  0
#> SRR1377200     5   0.000      0.933 0.000 0.000  0  0 1.000  0
#> SRR1377201     2   0.000      0.932 0.000 1.000  0  0 0.000  0
#> SRR1377202     2   0.000      0.932 0.000 1.000  0  0 0.000  0
#> SRR1377203     2   0.000      0.932 0.000 1.000  0  0 0.000  0
#> SRR1377204     2   0.000      0.932 0.000 1.000  0  0 0.000  0
#> SRR1377205     2   0.000      0.932 0.000 1.000  0  0 0.000  0
#> SRR1377206     2   0.000      0.932 0.000 1.000  0  0 0.000  0
#> SRR1377207     2   0.000      0.932 0.000 1.000  0  0 0.000  0
#> SRR1377208     2   0.000      0.932 0.000 1.000  0  0 0.000  0
#> SRR1377209     2   0.000      0.932 0.000 1.000  0  0 0.000  0
#> SRR1377210     2   0.000      0.932 0.000 1.000  0  0 0.000  0
#> SRR1377211     2   0.000      0.932 0.000 1.000  0  0 0.000  0
#> SRR1377212     2   0.000      0.932 0.000 1.000  0  0 0.000  0
#> SRR1377213     4   0.000      1.000 0.000 0.000  0  1 0.000  0
#> SRR1377214     4   0.000      1.000 0.000 0.000  0  1 0.000  0
#> SRR1377215     4   0.000      1.000 0.000 0.000  0  1 0.000  0
#> SRR1377216     4   0.000      1.000 0.000 0.000  0  1 0.000  0
#> SRR1377217     4   0.000      1.000 0.000 0.000  0  1 0.000  0
#> SRR1377218     4   0.000      1.000 0.000 0.000  0  1 0.000  0
#> SRR1377219     4   0.000      1.000 0.000 0.000  0  1 0.000  0
#> SRR1377220     4   0.000      1.000 0.000 0.000  0  1 0.000  0
#> SRR1377221     4   0.000      1.000 0.000 0.000  0  1 0.000  0
#> SRR1377222     4   0.000      1.000 0.000 0.000  0  1 0.000  0
#> SRR1377223     4   0.000      1.000 0.000 0.000  0  1 0.000  0
#> SRR1377224     4   0.000      1.000 0.000 0.000  0  1 0.000  0

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

consensus_heatmap(res, k = 2)

plot of chunk tab-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 13890 rows and 80 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 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-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.342           0.695       0.837         0.4479 0.596   0.596
#> 3 3 0.714           0.866       0.888         0.3452 0.772   0.632
#> 4 4 0.947           0.900       0.945         0.2077 0.824   0.593
#> 5 5 0.776           0.800       0.889         0.0463 0.918   0.720
#> 6 6 0.972           0.940       0.968         0.0844 0.883   0.554

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

There is also optional best \(k\) = 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
#> SRR1377145     2  0.3274      0.742 0.060 0.940
#> SRR1377146     2  0.3274      0.742 0.060 0.940
#> SRR1377147     2  0.3274      0.742 0.060 0.940
#> SRR1377148     2  0.3274      0.742 0.060 0.940
#> SRR1377153     2  0.3274      0.742 0.060 0.940
#> SRR1377154     2  0.3274      0.742 0.060 0.940
#> SRR1377155     2  0.3274      0.742 0.060 0.940
#> SRR1377156     2  0.3274      0.742 0.060 0.940
#> SRR1377149     2  0.3274      0.742 0.060 0.940
#> SRR1377150     2  0.3274      0.742 0.060 0.940
#> SRR1377151     2  0.3274      0.742 0.060 0.940
#> SRR1377152     2  0.3274      0.742 0.060 0.940
#> SRR1377157     1  0.4298      0.872 0.912 0.088
#> SRR1377158     1  0.4298      0.872 0.912 0.088
#> SRR1377159     1  0.4298      0.872 0.912 0.088
#> SRR1377160     1  0.4298      0.872 0.912 0.088
#> SRR1377161     1  0.4298      0.872 0.912 0.088
#> SRR1377162     1  0.4298      0.872 0.912 0.088
#> SRR1377163     1  0.4298      0.872 0.912 0.088
#> SRR1377164     1  0.4298      0.872 0.912 0.088
#> SRR1377169     1  0.4298      0.872 0.912 0.088
#> SRR1377170     1  0.4298      0.872 0.912 0.088
#> SRR1377171     1  0.4298      0.872 0.912 0.088
#> SRR1377172     1  0.4298      0.872 0.912 0.088
#> SRR1377165     1  0.4298      0.872 0.912 0.088
#> SRR1377166     1  0.4298      0.872 0.912 0.088
#> SRR1377167     1  0.4298      0.872 0.912 0.088
#> SRR1377168     1  0.4298      0.872 0.912 0.088
#> SRR1377173     2  0.9044      0.596 0.320 0.680
#> SRR1377174     2  0.9044      0.596 0.320 0.680
#> SRR1377175     2  0.9044      0.596 0.320 0.680
#> SRR1377176     2  0.9044      0.596 0.320 0.680
#> SRR1377177     2  0.9044      0.596 0.320 0.680
#> SRR1377178     2  0.9044      0.596 0.320 0.680
#> SRR1377179     2  0.9044      0.596 0.320 0.680
#> SRR1377180     2  0.9044      0.596 0.320 0.680
#> SRR1377181     2  0.9044      0.596 0.320 0.680
#> SRR1377182     2  0.9044      0.596 0.320 0.680
#> SRR1377183     2  0.7815      0.676 0.232 0.768
#> SRR1377184     2  0.9044      0.596 0.320 0.680
#> SRR1377185     2  0.7745      0.679 0.228 0.772
#> SRR1377186     2  0.7745      0.679 0.228 0.772
#> SRR1377187     2  0.9044      0.596 0.320 0.680
#> SRR1377188     2  0.7745      0.679 0.228 0.772
#> SRR1377189     2  0.3274      0.765 0.060 0.940
#> SRR1377190     2  0.3274      0.765 0.060 0.940
#> SRR1377191     2  0.3274      0.765 0.060 0.940
#> SRR1377192     2  0.3274      0.765 0.060 0.940
#> SRR1377193     2  0.3274      0.765 0.060 0.940
#> SRR1377194     2  0.3274      0.765 0.060 0.940
#> SRR1377195     1  0.8386      0.616 0.732 0.268
#> SRR1377196     1  0.8386      0.616 0.732 0.268
#> SRR1377197     1  0.8386      0.616 0.732 0.268
#> SRR1377198     1  0.8386      0.616 0.732 0.268
#> SRR1377199     1  0.8386      0.616 0.732 0.268
#> SRR1377200     1  0.8386      0.616 0.732 0.268
#> SRR1377201     2  0.0376      0.766 0.004 0.996
#> SRR1377202     2  0.0000      0.766 0.000 1.000
#> SRR1377203     2  0.0000      0.766 0.000 1.000
#> SRR1377204     2  0.3114      0.766 0.056 0.944
#> SRR1377205     2  0.3114      0.766 0.056 0.944
#> SRR1377206     2  0.3114      0.766 0.056 0.944
#> SRR1377207     2  0.0000      0.766 0.000 1.000
#> SRR1377208     2  0.0000      0.766 0.000 1.000
#> SRR1377209     2  0.0000      0.766 0.000 1.000
#> SRR1377210     2  0.0376      0.764 0.004 0.996
#> SRR1377211     2  0.0672      0.766 0.008 0.992
#> SRR1377212     2  0.0376      0.766 0.004 0.996
#> SRR1377213     2  0.9491      0.446 0.368 0.632
#> SRR1377214     2  0.9491      0.446 0.368 0.632
#> SRR1377215     2  0.9491      0.446 0.368 0.632
#> SRR1377216     2  0.9286      0.468 0.344 0.656
#> SRR1377217     2  0.9286      0.468 0.344 0.656
#> SRR1377218     2  0.9286      0.468 0.344 0.656
#> SRR1377219     2  0.9491      0.446 0.368 0.632
#> SRR1377220     2  0.9491      0.446 0.368 0.632
#> SRR1377221     2  0.9491      0.446 0.368 0.632
#> SRR1377222     2  0.9522      0.451 0.372 0.628
#> SRR1377223     2  0.9522      0.451 0.372 0.628
#> SRR1377224     2  0.9522      0.451 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
#> SRR1377145     2  0.0661      0.869 0.004 0.988 0.008
#> SRR1377146     2  0.0661      0.869 0.004 0.988 0.008
#> SRR1377147     2  0.0661      0.869 0.004 0.988 0.008
#> SRR1377148     2  0.0661      0.869 0.004 0.988 0.008
#> SRR1377153     2  0.0661      0.869 0.004 0.988 0.008
#> SRR1377154     2  0.0661      0.869 0.004 0.988 0.008
#> SRR1377155     2  0.0661      0.869 0.004 0.988 0.008
#> SRR1377156     2  0.0661      0.869 0.004 0.988 0.008
#> SRR1377149     2  0.0661      0.869 0.004 0.988 0.008
#> SRR1377150     2  0.0661      0.869 0.004 0.988 0.008
#> SRR1377151     2  0.0661      0.869 0.004 0.988 0.008
#> SRR1377152     2  0.0661      0.869 0.004 0.988 0.008
#> SRR1377157     3  0.0000      1.000 0.000 0.000 1.000
#> SRR1377158     3  0.0000      1.000 0.000 0.000 1.000
#> SRR1377159     3  0.0000      1.000 0.000 0.000 1.000
#> SRR1377160     3  0.0000      1.000 0.000 0.000 1.000
#> SRR1377161     3  0.0000      1.000 0.000 0.000 1.000
#> SRR1377162     3  0.0000      1.000 0.000 0.000 1.000
#> SRR1377163     3  0.0000      1.000 0.000 0.000 1.000
#> SRR1377164     3  0.0000      1.000 0.000 0.000 1.000
#> SRR1377169     3  0.0000      1.000 0.000 0.000 1.000
#> SRR1377170     3  0.0000      1.000 0.000 0.000 1.000
#> SRR1377171     3  0.0000      1.000 0.000 0.000 1.000
#> SRR1377172     3  0.0000      1.000 0.000 0.000 1.000
#> SRR1377165     3  0.0000      1.000 0.000 0.000 1.000
#> SRR1377166     3  0.0000      1.000 0.000 0.000 1.000
#> SRR1377167     3  0.0000      1.000 0.000 0.000 1.000
#> SRR1377168     3  0.0000      1.000 0.000 0.000 1.000
#> SRR1377173     2  0.6126      0.743 0.020 0.712 0.268
#> SRR1377174     2  0.6126      0.743 0.020 0.712 0.268
#> SRR1377175     2  0.6126      0.743 0.020 0.712 0.268
#> SRR1377176     2  0.6126      0.743 0.020 0.712 0.268
#> SRR1377177     2  0.6126      0.743 0.020 0.712 0.268
#> SRR1377178     2  0.6126      0.743 0.020 0.712 0.268
#> SRR1377179     2  0.6126      0.743 0.020 0.712 0.268
#> SRR1377180     2  0.6126      0.743 0.020 0.712 0.268
#> SRR1377181     2  0.6126      0.743 0.020 0.712 0.268
#> SRR1377182     2  0.6126      0.743 0.020 0.712 0.268
#> SRR1377183     2  0.6195      0.739 0.020 0.704 0.276
#> SRR1377184     2  0.6126      0.743 0.020 0.712 0.268
#> SRR1377185     2  0.6195      0.739 0.020 0.704 0.276
#> SRR1377186     2  0.6195      0.739 0.020 0.704 0.276
#> SRR1377187     2  0.6126      0.743 0.020 0.712 0.268
#> SRR1377188     2  0.6195      0.739 0.020 0.704 0.276
#> SRR1377189     2  0.2434      0.869 0.036 0.940 0.024
#> SRR1377190     2  0.2152      0.870 0.036 0.948 0.016
#> SRR1377191     2  0.2297      0.870 0.036 0.944 0.020
#> SRR1377192     2  0.2152      0.870 0.036 0.948 0.016
#> SRR1377193     2  0.2152      0.870 0.036 0.948 0.016
#> SRR1377194     2  0.2152      0.870 0.036 0.948 0.016
#> SRR1377195     1  0.1832      0.814 0.956 0.036 0.008
#> SRR1377196     1  0.1832      0.814 0.956 0.036 0.008
#> SRR1377197     1  0.1832      0.814 0.956 0.036 0.008
#> SRR1377198     1  0.1832      0.814 0.956 0.036 0.008
#> SRR1377199     1  0.1832      0.814 0.956 0.036 0.008
#> SRR1377200     1  0.1832      0.814 0.956 0.036 0.008
#> SRR1377201     2  0.2152      0.870 0.036 0.948 0.016
#> SRR1377202     2  0.2152      0.870 0.036 0.948 0.016
#> SRR1377203     2  0.2152      0.870 0.036 0.948 0.016
#> SRR1377204     2  0.2492      0.868 0.048 0.936 0.016
#> SRR1377205     2  0.2492      0.868 0.048 0.936 0.016
#> SRR1377206     2  0.2492      0.868 0.048 0.936 0.016
#> SRR1377207     2  0.2902      0.854 0.016 0.920 0.064
#> SRR1377208     2  0.2902      0.854 0.016 0.920 0.064
#> SRR1377209     2  0.2902      0.854 0.016 0.920 0.064
#> SRR1377210     2  0.2152      0.870 0.036 0.948 0.016
#> SRR1377211     2  0.2152      0.870 0.036 0.948 0.016
#> SRR1377212     2  0.2152      0.870 0.036 0.948 0.016
#> SRR1377213     1  0.4963      0.887 0.792 0.008 0.200
#> SRR1377214     1  0.4963      0.887 0.792 0.008 0.200
#> SRR1377215     1  0.4963      0.887 0.792 0.008 0.200
#> SRR1377216     1  0.6016      0.833 0.724 0.020 0.256
#> SRR1377217     1  0.6016      0.833 0.724 0.020 0.256
#> SRR1377218     1  0.6016      0.833 0.724 0.020 0.256
#> SRR1377219     1  0.4963      0.887 0.792 0.008 0.200
#> SRR1377220     1  0.4963      0.887 0.792 0.008 0.200
#> SRR1377221     1  0.4963      0.887 0.792 0.008 0.200
#> SRR1377222     1  0.4963      0.887 0.792 0.008 0.200
#> SRR1377223     1  0.4963      0.887 0.792 0.008 0.200
#> SRR1377224     1  0.4963      0.887 0.792 0.008 0.200

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> SRR1377145     2  0.0000      0.949 0.000 1.000 0.000 0.000
#> SRR1377146     2  0.0000      0.949 0.000 1.000 0.000 0.000
#> SRR1377147     2  0.0000      0.949 0.000 1.000 0.000 0.000
#> SRR1377148     2  0.0000      0.949 0.000 1.000 0.000 0.000
#> SRR1377153     2  0.0000      0.949 0.000 1.000 0.000 0.000
#> SRR1377154     2  0.0000      0.949 0.000 1.000 0.000 0.000
#> SRR1377155     2  0.0000      0.949 0.000 1.000 0.000 0.000
#> SRR1377156     2  0.0000      0.949 0.000 1.000 0.000 0.000
#> SRR1377149     2  0.0000      0.949 0.000 1.000 0.000 0.000
#> SRR1377150     2  0.0000      0.949 0.000 1.000 0.000 0.000
#> SRR1377151     2  0.0000      0.949 0.000 1.000 0.000 0.000
#> SRR1377152     2  0.0000      0.949 0.000 1.000 0.000 0.000
#> SRR1377157     3  0.0592      0.950 0.016 0.000 0.984 0.000
#> SRR1377158     3  0.0592      0.950 0.016 0.000 0.984 0.000
#> SRR1377159     3  0.0592      0.950 0.016 0.000 0.984 0.000
#> SRR1377160     3  0.0592      0.950 0.016 0.000 0.984 0.000
#> SRR1377161     3  0.1716      0.968 0.000 0.000 0.936 0.064
#> SRR1377162     3  0.1716      0.968 0.000 0.000 0.936 0.064
#> SRR1377163     3  0.1716      0.968 0.000 0.000 0.936 0.064
#> SRR1377164     3  0.1716      0.968 0.000 0.000 0.936 0.064
#> SRR1377169     3  0.1716      0.968 0.000 0.000 0.936 0.064
#> SRR1377170     3  0.1716      0.968 0.000 0.000 0.936 0.064
#> SRR1377171     3  0.1716      0.968 0.000 0.000 0.936 0.064
#> SRR1377172     3  0.1716      0.968 0.000 0.000 0.936 0.064
#> SRR1377165     3  0.0707      0.961 0.000 0.000 0.980 0.020
#> SRR1377166     3  0.1474      0.968 0.000 0.000 0.948 0.052
#> SRR1377167     3  0.0779      0.959 0.004 0.000 0.980 0.016
#> SRR1377168     3  0.1022      0.965 0.000 0.000 0.968 0.032
#> SRR1377173     4  0.0336      1.000 0.000 0.000 0.008 0.992
#> SRR1377174     4  0.0336      1.000 0.000 0.000 0.008 0.992
#> SRR1377175     4  0.0336      1.000 0.000 0.000 0.008 0.992
#> SRR1377176     4  0.0336      1.000 0.000 0.000 0.008 0.992
#> SRR1377177     4  0.0336      1.000 0.000 0.000 0.008 0.992
#> SRR1377178     4  0.0336      1.000 0.000 0.000 0.008 0.992
#> SRR1377179     4  0.0336      1.000 0.000 0.000 0.008 0.992
#> SRR1377180     4  0.0336      1.000 0.000 0.000 0.008 0.992
#> SRR1377181     4  0.0336      1.000 0.000 0.000 0.008 0.992
#> SRR1377182     4  0.0336      1.000 0.000 0.000 0.008 0.992
#> SRR1377183     2  0.5334      0.591 0.000 0.680 0.036 0.284
#> SRR1377184     4  0.0336      1.000 0.000 0.000 0.008 0.992
#> SRR1377185     2  0.5334      0.591 0.000 0.680 0.036 0.284
#> SRR1377186     2  0.5334      0.591 0.000 0.680 0.036 0.284
#> SRR1377187     4  0.0336      1.000 0.000 0.000 0.008 0.992
#> SRR1377188     2  0.5334      0.591 0.000 0.680 0.036 0.284
#> SRR1377189     2  0.0336      0.949 0.008 0.992 0.000 0.000
#> SRR1377190     2  0.0336      0.949 0.008 0.992 0.000 0.000
#> SRR1377191     2  0.0336      0.949 0.008 0.992 0.000 0.000
#> SRR1377192     2  0.0336      0.949 0.008 0.992 0.000 0.000
#> SRR1377193     2  0.0336      0.949 0.008 0.992 0.000 0.000
#> SRR1377194     2  0.0336      0.949 0.008 0.992 0.000 0.000
#> SRR1377195     1  0.0927      0.878 0.976 0.000 0.016 0.008
#> SRR1377196     1  0.0927      0.878 0.976 0.000 0.016 0.008
#> SRR1377197     1  0.0927      0.878 0.976 0.000 0.016 0.008
#> SRR1377198     1  0.0927      0.878 0.976 0.000 0.016 0.008
#> SRR1377199     1  0.0927      0.878 0.976 0.000 0.016 0.008
#> SRR1377200     1  0.0927      0.878 0.976 0.000 0.016 0.008
#> SRR1377201     2  0.0336      0.949 0.008 0.992 0.000 0.000
#> SRR1377202     2  0.0336      0.949 0.008 0.992 0.000 0.000
#> SRR1377203     2  0.0336      0.949 0.008 0.992 0.000 0.000
#> SRR1377204     1  0.4985      0.242 0.532 0.468 0.000 0.000
#> SRR1377205     1  0.4985      0.242 0.532 0.468 0.000 0.000
#> SRR1377206     1  0.4985      0.242 0.532 0.468 0.000 0.000
#> SRR1377207     2  0.1256      0.932 0.008 0.964 0.028 0.000
#> SRR1377208     2  0.1256      0.932 0.008 0.964 0.028 0.000
#> SRR1377209     2  0.1256      0.932 0.008 0.964 0.028 0.000
#> SRR1377210     2  0.0336      0.949 0.008 0.992 0.000 0.000
#> SRR1377211     2  0.0336      0.949 0.008 0.992 0.000 0.000
#> SRR1377212     2  0.0336      0.949 0.008 0.992 0.000 0.000
#> SRR1377213     1  0.1389      0.889 0.952 0.000 0.048 0.000
#> SRR1377214     1  0.1389      0.889 0.952 0.000 0.048 0.000
#> SRR1377215     1  0.1389      0.889 0.952 0.000 0.048 0.000
#> SRR1377216     1  0.2214      0.879 0.928 0.000 0.044 0.028
#> SRR1377217     1  0.2214      0.879 0.928 0.000 0.044 0.028
#> SRR1377218     1  0.2214      0.879 0.928 0.000 0.044 0.028
#> SRR1377219     1  0.1389      0.889 0.952 0.000 0.048 0.000
#> SRR1377220     1  0.1389      0.889 0.952 0.000 0.048 0.000
#> SRR1377221     1  0.1389      0.889 0.952 0.000 0.048 0.000
#> SRR1377222     1  0.1118      0.890 0.964 0.000 0.036 0.000
#> SRR1377223     1  0.1118      0.890 0.964 0.000 0.036 0.000
#> SRR1377224     1  0.1118      0.890 0.964 0.000 0.036 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
#> SRR1377145     2  0.1121      0.787 0.000 0.956 0.000 0.000 0.044
#> SRR1377146     2  0.1121      0.787 0.000 0.956 0.000 0.000 0.044
#> SRR1377147     2  0.1121      0.787 0.000 0.956 0.000 0.000 0.044
#> SRR1377148     2  0.1121      0.787 0.000 0.956 0.000 0.000 0.044
#> SRR1377153     2  0.1121      0.787 0.000 0.956 0.000 0.000 0.044
#> SRR1377154     2  0.1121      0.787 0.000 0.956 0.000 0.000 0.044
#> SRR1377155     2  0.1121      0.787 0.000 0.956 0.000 0.000 0.044
#> SRR1377156     2  0.1121      0.787 0.000 0.956 0.000 0.000 0.044
#> SRR1377149     2  0.1121      0.787 0.000 0.956 0.000 0.000 0.044
#> SRR1377150     2  0.1121      0.787 0.000 0.956 0.000 0.000 0.044
#> SRR1377151     2  0.1121      0.787 0.000 0.956 0.000 0.000 0.044
#> SRR1377152     2  0.1121      0.787 0.000 0.956 0.000 0.000 0.044
#> SRR1377157     3  0.0000      0.986 0.000 0.000 1.000 0.000 0.000
#> SRR1377158     3  0.0000      0.986 0.000 0.000 1.000 0.000 0.000
#> SRR1377159     3  0.0000      0.986 0.000 0.000 1.000 0.000 0.000
#> SRR1377160     3  0.0000      0.986 0.000 0.000 1.000 0.000 0.000
#> SRR1377161     3  0.0404      0.985 0.012 0.000 0.988 0.000 0.000
#> SRR1377162     3  0.0404      0.985 0.012 0.000 0.988 0.000 0.000
#> SRR1377163     3  0.0404      0.985 0.012 0.000 0.988 0.000 0.000
#> SRR1377164     3  0.0404      0.985 0.012 0.000 0.988 0.000 0.000
#> SRR1377169     3  0.1041      0.970 0.032 0.000 0.964 0.004 0.000
#> SRR1377170     3  0.1041      0.970 0.032 0.000 0.964 0.004 0.000
#> SRR1377171     3  0.1386      0.961 0.032 0.000 0.952 0.016 0.000
#> SRR1377172     3  0.0865      0.976 0.024 0.000 0.972 0.004 0.000
#> SRR1377165     3  0.0000      0.986 0.000 0.000 1.000 0.000 0.000
#> SRR1377166     3  0.0000      0.986 0.000 0.000 1.000 0.000 0.000
#> SRR1377167     3  0.0000      0.986 0.000 0.000 1.000 0.000 0.000
#> SRR1377168     3  0.0000      0.986 0.000 0.000 1.000 0.000 0.000
#> SRR1377173     1  0.0000      1.000 1.000 0.000 0.000 0.000 0.000
#> SRR1377174     1  0.0000      1.000 1.000 0.000 0.000 0.000 0.000
#> SRR1377175     1  0.0000      1.000 1.000 0.000 0.000 0.000 0.000
#> SRR1377176     1  0.0000      1.000 1.000 0.000 0.000 0.000 0.000
#> SRR1377177     1  0.0000      1.000 1.000 0.000 0.000 0.000 0.000
#> SRR1377178     1  0.0000      1.000 1.000 0.000 0.000 0.000 0.000
#> SRR1377179     1  0.0000      1.000 1.000 0.000 0.000 0.000 0.000
#> SRR1377180     1  0.0000      1.000 1.000 0.000 0.000 0.000 0.000
#> SRR1377181     1  0.0000      1.000 1.000 0.000 0.000 0.000 0.000
#> SRR1377182     1  0.0000      1.000 1.000 0.000 0.000 0.000 0.000
#> SRR1377183     4  0.7916      0.365 0.292 0.212 0.092 0.404 0.000
#> SRR1377184     1  0.0000      1.000 1.000 0.000 0.000 0.000 0.000
#> SRR1377185     4  0.7916      0.365 0.292 0.212 0.092 0.404 0.000
#> SRR1377186     4  0.7916      0.365 0.292 0.212 0.092 0.404 0.000
#> SRR1377187     1  0.0000      1.000 1.000 0.000 0.000 0.000 0.000
#> SRR1377188     4  0.7916      0.365 0.292 0.212 0.092 0.404 0.000
#> SRR1377189     2  0.3790      0.678 0.004 0.724 0.000 0.272 0.000
#> SRR1377190     2  0.3333      0.746 0.004 0.788 0.000 0.208 0.000
#> SRR1377191     2  0.3662      0.705 0.004 0.744 0.000 0.252 0.000
#> SRR1377192     2  0.3662      0.706 0.004 0.744 0.000 0.252 0.000
#> SRR1377193     2  0.3491      0.731 0.004 0.768 0.000 0.228 0.000
#> SRR1377194     2  0.3430      0.737 0.004 0.776 0.000 0.220 0.000
#> SRR1377195     5  0.1121      1.000 0.000 0.000 0.000 0.044 0.956
#> SRR1377196     5  0.1121      1.000 0.000 0.000 0.000 0.044 0.956
#> SRR1377197     5  0.1121      1.000 0.000 0.000 0.000 0.044 0.956
#> SRR1377198     5  0.1121      1.000 0.000 0.000 0.000 0.044 0.956
#> SRR1377199     5  0.1121      1.000 0.000 0.000 0.000 0.044 0.956
#> SRR1377200     5  0.1121      1.000 0.000 0.000 0.000 0.044 0.956
#> SRR1377201     2  0.4045      0.527 0.000 0.644 0.000 0.356 0.000
#> SRR1377202     2  0.4045      0.527 0.000 0.644 0.000 0.356 0.000
#> SRR1377203     2  0.4045      0.527 0.000 0.644 0.000 0.356 0.000
#> SRR1377204     4  0.4192      0.167 0.000 0.404 0.000 0.596 0.000
#> SRR1377205     4  0.4192      0.167 0.000 0.404 0.000 0.596 0.000
#> SRR1377206     4  0.4192      0.167 0.000 0.404 0.000 0.596 0.000
#> SRR1377207     2  0.4610      0.711 0.000 0.740 0.092 0.168 0.000
#> SRR1377208     2  0.4610      0.711 0.000 0.740 0.092 0.168 0.000
#> SRR1377209     2  0.4610      0.711 0.000 0.740 0.092 0.168 0.000
#> SRR1377210     2  0.2848      0.772 0.004 0.840 0.000 0.156 0.000
#> SRR1377211     2  0.2848      0.772 0.004 0.840 0.000 0.156 0.000
#> SRR1377212     2  0.2848      0.772 0.004 0.840 0.000 0.156 0.000
#> SRR1377213     4  0.0000      0.728 0.000 0.000 0.000 1.000 0.000
#> SRR1377214     4  0.0000      0.728 0.000 0.000 0.000 1.000 0.000
#> SRR1377215     4  0.0000      0.728 0.000 0.000 0.000 1.000 0.000
#> SRR1377216     4  0.3677      0.664 0.048 0.000 0.060 0.848 0.044
#> SRR1377217     4  0.3677      0.664 0.048 0.000 0.060 0.848 0.044
#> SRR1377218     4  0.3677      0.664 0.048 0.000 0.060 0.848 0.044
#> SRR1377219     4  0.0000      0.728 0.000 0.000 0.000 1.000 0.000
#> SRR1377220     4  0.0000      0.728 0.000 0.000 0.000 1.000 0.000
#> SRR1377221     4  0.0000      0.728 0.000 0.000 0.000 1.000 0.000
#> SRR1377222     4  0.0000      0.728 0.000 0.000 0.000 1.000 0.000
#> SRR1377223     4  0.0000      0.728 0.000 0.000 0.000 1.000 0.000
#> SRR1377224     4  0.0000      0.728 0.000 0.000 0.000 1.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
#> SRR1377145     6  0.0000      1.000 0.000 0.000 0.000 0.000  0 1.000
#> SRR1377146     6  0.0000      1.000 0.000 0.000 0.000 0.000  0 1.000
#> SRR1377147     6  0.0000      1.000 0.000 0.000 0.000 0.000  0 1.000
#> SRR1377148     6  0.0000      1.000 0.000 0.000 0.000 0.000  0 1.000
#> SRR1377153     6  0.0000      1.000 0.000 0.000 0.000 0.000  0 1.000
#> SRR1377154     6  0.0000      1.000 0.000 0.000 0.000 0.000  0 1.000
#> SRR1377155     6  0.0000      1.000 0.000 0.000 0.000 0.000  0 1.000
#> SRR1377156     6  0.0000      1.000 0.000 0.000 0.000 0.000  0 1.000
#> SRR1377149     6  0.0000      1.000 0.000 0.000 0.000 0.000  0 1.000
#> SRR1377150     6  0.0000      1.000 0.000 0.000 0.000 0.000  0 1.000
#> SRR1377151     6  0.0000      1.000 0.000 0.000 0.000 0.000  0 1.000
#> SRR1377152     6  0.0000      1.000 0.000 0.000 0.000 0.000  0 1.000
#> SRR1377157     3  0.0000      0.990 0.000 0.000 1.000 0.000  0 0.000
#> SRR1377158     3  0.0000      0.990 0.000 0.000 1.000 0.000  0 0.000
#> SRR1377159     3  0.0000      0.990 0.000 0.000 1.000 0.000  0 0.000
#> SRR1377160     3  0.0000      0.990 0.000 0.000 1.000 0.000  0 0.000
#> SRR1377161     3  0.0363      0.991 0.012 0.000 0.988 0.000  0 0.000
#> SRR1377162     3  0.0363      0.991 0.012 0.000 0.988 0.000  0 0.000
#> SRR1377163     3  0.0363      0.991 0.012 0.000 0.988 0.000  0 0.000
#> SRR1377164     3  0.0363      0.991 0.012 0.000 0.988 0.000  0 0.000
#> SRR1377169     3  0.0458      0.989 0.016 0.000 0.984 0.000  0 0.000
#> SRR1377170     3  0.0458      0.989 0.016 0.000 0.984 0.000  0 0.000
#> SRR1377171     3  0.0458      0.989 0.016 0.000 0.984 0.000  0 0.000
#> SRR1377172     3  0.0458      0.989 0.016 0.000 0.984 0.000  0 0.000
#> SRR1377165     3  0.0000      0.990 0.000 0.000 1.000 0.000  0 0.000
#> SRR1377166     3  0.0146      0.989 0.000 0.000 0.996 0.004  0 0.000
#> SRR1377167     3  0.0000      0.990 0.000 0.000 1.000 0.000  0 0.000
#> SRR1377168     3  0.0146      0.989 0.000 0.000 0.996 0.004  0 0.000
#> SRR1377173     1  0.0000      1.000 1.000 0.000 0.000 0.000  0 0.000
#> SRR1377174     1  0.0000      1.000 1.000 0.000 0.000 0.000  0 0.000
#> SRR1377175     1  0.0000      1.000 1.000 0.000 0.000 0.000  0 0.000
#> SRR1377176     1  0.0000      1.000 1.000 0.000 0.000 0.000  0 0.000
#> SRR1377177     1  0.0000      1.000 1.000 0.000 0.000 0.000  0 0.000
#> SRR1377178     1  0.0000      1.000 1.000 0.000 0.000 0.000  0 0.000
#> SRR1377179     1  0.0000      1.000 1.000 0.000 0.000 0.000  0 0.000
#> SRR1377180     1  0.0000      1.000 1.000 0.000 0.000 0.000  0 0.000
#> SRR1377181     1  0.0000      1.000 1.000 0.000 0.000 0.000  0 0.000
#> SRR1377182     1  0.0146      0.995 0.996 0.004 0.000 0.000  0 0.000
#> SRR1377183     2  0.3797      0.622 0.292 0.692 0.016 0.000  0 0.000
#> SRR1377184     1  0.0000      1.000 1.000 0.000 0.000 0.000  0 0.000
#> SRR1377185     2  0.3797      0.622 0.292 0.692 0.016 0.000  0 0.000
#> SRR1377186     2  0.3797      0.622 0.292 0.692 0.016 0.000  0 0.000
#> SRR1377187     1  0.0000      1.000 1.000 0.000 0.000 0.000  0 0.000
#> SRR1377188     2  0.3797      0.622 0.292 0.692 0.016 0.000  0 0.000
#> SRR1377189     2  0.0260      0.884 0.000 0.992 0.000 0.000  0 0.008
#> SRR1377190     2  0.0000      0.884 0.000 1.000 0.000 0.000  0 0.000
#> SRR1377191     2  0.0260      0.884 0.000 0.992 0.000 0.000  0 0.008
#> SRR1377192     2  0.0000      0.884 0.000 1.000 0.000 0.000  0 0.000
#> SRR1377193     2  0.0000      0.884 0.000 1.000 0.000 0.000  0 0.000
#> SRR1377194     2  0.0000      0.884 0.000 1.000 0.000 0.000  0 0.000
#> SRR1377195     5  0.0000      1.000 0.000 0.000 0.000 0.000  1 0.000
#> SRR1377196     5  0.0000      1.000 0.000 0.000 0.000 0.000  1 0.000
#> SRR1377197     5  0.0000      1.000 0.000 0.000 0.000 0.000  1 0.000
#> SRR1377198     5  0.0000      1.000 0.000 0.000 0.000 0.000  1 0.000
#> SRR1377199     5  0.0000      1.000 0.000 0.000 0.000 0.000  1 0.000
#> SRR1377200     5  0.0000      1.000 0.000 0.000 0.000 0.000  1 0.000
#> SRR1377201     2  0.0547      0.881 0.000 0.980 0.000 0.000  0 0.020
#> SRR1377202     2  0.0547      0.881 0.000 0.980 0.000 0.000  0 0.020
#> SRR1377203     2  0.0547      0.881 0.000 0.980 0.000 0.000  0 0.020
#> SRR1377204     2  0.3101      0.684 0.000 0.756 0.000 0.244  0 0.000
#> SRR1377205     2  0.3101      0.684 0.000 0.756 0.000 0.244  0 0.000
#> SRR1377206     2  0.3101      0.684 0.000 0.756 0.000 0.244  0 0.000
#> SRR1377207     2  0.1003      0.880 0.000 0.964 0.016 0.000  0 0.020
#> SRR1377208     2  0.1003      0.880 0.000 0.964 0.016 0.000  0 0.020
#> SRR1377209     2  0.1003      0.880 0.000 0.964 0.016 0.000  0 0.020
#> SRR1377210     2  0.0363      0.884 0.000 0.988 0.000 0.000  0 0.012
#> SRR1377211     2  0.0363      0.884 0.000 0.988 0.000 0.000  0 0.012
#> SRR1377212     2  0.0363      0.884 0.000 0.988 0.000 0.000  0 0.012
#> SRR1377213     4  0.0000      0.976 0.000 0.000 0.000 1.000  0 0.000
#> SRR1377214     4  0.0000      0.976 0.000 0.000 0.000 1.000  0 0.000
#> SRR1377215     4  0.0000      0.976 0.000 0.000 0.000 1.000  0 0.000
#> SRR1377216     4  0.1668      0.927 0.004 0.008 0.060 0.928  0 0.000
#> SRR1377217     4  0.1668      0.927 0.004 0.008 0.060 0.928  0 0.000
#> SRR1377218     4  0.1668      0.927 0.004 0.008 0.060 0.928  0 0.000
#> SRR1377219     4  0.0000      0.976 0.000 0.000 0.000 1.000  0 0.000
#> SRR1377220     4  0.0000      0.976 0.000 0.000 0.000 1.000  0 0.000
#> SRR1377221     4  0.0000      0.976 0.000 0.000 0.000 1.000  0 0.000
#> SRR1377222     4  0.0000      0.976 0.000 0.000 0.000 1.000  0 0.000
#> SRR1377223     4  0.0000      0.976 0.000 0.000 0.000 1.000  0 0.000
#> SRR1377224     4  0.0000      0.976 0.000 0.000 0.000 1.000  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-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 13890 rows and 80 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 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-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.443           0.771       0.839         0.2737 0.859   0.859
#> 3 3 0.666           0.781       0.885         1.0461 0.572   0.502
#> 4 4 0.644           0.797       0.876         0.2031 0.781   0.548
#> 5 5 0.733           0.825       0.810         0.1031 0.919   0.747
#> 6 6 0.853           0.949       0.890         0.0735 0.932   0.714

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
#> SRR1377145     2  0.0938      0.737 0.012 0.988
#> SRR1377146     2  0.0938      0.737 0.012 0.988
#> SRR1377147     2  0.2236      0.746 0.036 0.964
#> SRR1377148     2  0.0938      0.737 0.012 0.988
#> SRR1377153     2  0.5178      0.764 0.116 0.884
#> SRR1377154     2  0.5842      0.767 0.140 0.860
#> SRR1377155     2  0.5737      0.767 0.136 0.864
#> SRR1377156     2  0.5842      0.767 0.140 0.860
#> SRR1377149     2  0.3733      0.756 0.072 0.928
#> SRR1377150     2  0.1843      0.743 0.028 0.972
#> SRR1377151     2  0.3114      0.752 0.056 0.944
#> SRR1377152     2  0.3274      0.753 0.060 0.940
#> SRR1377157     2  0.9248      0.783 0.340 0.660
#> SRR1377158     2  0.9248      0.783 0.340 0.660
#> SRR1377159     2  0.9248      0.783 0.340 0.660
#> SRR1377160     2  0.9248      0.783 0.340 0.660
#> SRR1377161     2  0.9248      0.783 0.340 0.660
#> SRR1377162     2  0.9248      0.783 0.340 0.660
#> SRR1377163     2  0.9248      0.783 0.340 0.660
#> SRR1377164     2  0.9248      0.783 0.340 0.660
#> SRR1377169     2  0.9248      0.783 0.340 0.660
#> SRR1377170     2  0.9248      0.783 0.340 0.660
#> SRR1377171     2  0.9248      0.783 0.340 0.660
#> SRR1377172     2  0.9248      0.783 0.340 0.660
#> SRR1377165     2  0.9248      0.783 0.340 0.660
#> SRR1377166     2  0.9248      0.783 0.340 0.660
#> SRR1377167     2  0.9248      0.783 0.340 0.660
#> SRR1377168     2  0.9248      0.783 0.340 0.660
#> SRR1377173     2  0.9248      0.783 0.340 0.660
#> SRR1377174     2  0.9248      0.783 0.340 0.660
#> SRR1377175     2  0.9248      0.783 0.340 0.660
#> SRR1377176     2  0.9248      0.783 0.340 0.660
#> SRR1377177     2  0.9248      0.783 0.340 0.660
#> SRR1377178     2  0.9248      0.783 0.340 0.660
#> SRR1377179     2  0.9248      0.783 0.340 0.660
#> SRR1377180     2  0.9248      0.783 0.340 0.660
#> SRR1377181     2  0.9248      0.783 0.340 0.660
#> SRR1377182     2  0.9248      0.783 0.340 0.660
#> SRR1377183     2  0.9248      0.783 0.340 0.660
#> SRR1377184     2  0.9248      0.783 0.340 0.660
#> SRR1377185     2  0.9248      0.783 0.340 0.660
#> SRR1377186     2  0.9248      0.783 0.340 0.660
#> SRR1377187     2  0.9248      0.783 0.340 0.660
#> SRR1377188     2  0.9248      0.783 0.340 0.660
#> SRR1377189     2  0.1843      0.711 0.028 0.972
#> SRR1377190     2  0.1843      0.711 0.028 0.972
#> SRR1377191     2  0.1843      0.711 0.028 0.972
#> SRR1377192     2  0.1843      0.711 0.028 0.972
#> SRR1377193     2  0.1843      0.711 0.028 0.972
#> SRR1377194     2  0.1843      0.711 0.028 0.972
#> SRR1377195     1  0.9248      0.988 0.660 0.340
#> SRR1377196     1  0.9129      0.988 0.672 0.328
#> SRR1377197     1  0.9044      0.980 0.680 0.320
#> SRR1377198     1  0.9209      0.990 0.664 0.336
#> SRR1377199     1  0.9170      0.990 0.668 0.332
#> SRR1377200     1  0.9248      0.988 0.660 0.340
#> SRR1377201     2  0.1843      0.711 0.028 0.972
#> SRR1377202     2  0.1843      0.711 0.028 0.972
#> SRR1377203     2  0.1843      0.711 0.028 0.972
#> SRR1377204     2  0.2603      0.693 0.044 0.956
#> SRR1377205     2  0.2423      0.698 0.040 0.960
#> SRR1377206     2  0.2423      0.698 0.040 0.960
#> SRR1377207     2  0.0000      0.730 0.000 1.000
#> SRR1377208     2  0.0000      0.730 0.000 1.000
#> SRR1377209     2  0.0376      0.728 0.004 0.996
#> SRR1377210     2  0.1633      0.714 0.024 0.976
#> SRR1377211     2  0.1414      0.717 0.020 0.980
#> SRR1377212     2  0.1184      0.720 0.016 0.984
#> SRR1377213     2  0.3733      0.734 0.072 0.928
#> SRR1377214     2  0.3733      0.734 0.072 0.928
#> SRR1377215     2  0.3584      0.732 0.068 0.932
#> SRR1377216     2  0.9209      0.783 0.336 0.664
#> SRR1377217     2  0.9209      0.783 0.336 0.664
#> SRR1377218     2  0.9209      0.783 0.336 0.664
#> SRR1377219     2  0.3879      0.735 0.076 0.924
#> SRR1377220     2  0.4161      0.738 0.084 0.916
#> SRR1377221     2  0.3733      0.734 0.072 0.928
#> SRR1377222     2  0.1843      0.711 0.028 0.972
#> SRR1377223     2  0.1843      0.711 0.028 0.972
#> SRR1377224     2  0.1843      0.711 0.028 0.972

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>            class entropy silhouette    p1    p2    p3
#> SRR1377145     2  0.6396     0.5245 0.016 0.664 0.320
#> SRR1377146     2  0.6422     0.5159 0.016 0.660 0.324
#> SRR1377147     2  0.6675     0.3235 0.012 0.584 0.404
#> SRR1377148     2  0.6333     0.5028 0.012 0.656 0.332
#> SRR1377153     3  0.6969     0.3372 0.024 0.380 0.596
#> SRR1377154     3  0.6758     0.3949 0.020 0.360 0.620
#> SRR1377155     3  0.6510     0.3976 0.012 0.364 0.624
#> SRR1377156     3  0.6667     0.3811 0.016 0.368 0.616
#> SRR1377149     3  0.7063     0.0568 0.020 0.464 0.516
#> SRR1377150     2  0.7203     0.2703 0.028 0.556 0.416
#> SRR1377151     3  0.7069     0.0239 0.020 0.472 0.508
#> SRR1377152     2  0.7069     0.0773 0.020 0.508 0.472
#> SRR1377157     3  0.0661     0.8902 0.004 0.008 0.988
#> SRR1377158     3  0.0661     0.8902 0.004 0.008 0.988
#> SRR1377159     3  0.0661     0.8902 0.004 0.008 0.988
#> SRR1377160     3  0.0661     0.8902 0.004 0.008 0.988
#> SRR1377161     3  0.0237     0.8981 0.004 0.000 0.996
#> SRR1377162     3  0.0424     0.8968 0.008 0.000 0.992
#> SRR1377163     3  0.0000     0.8988 0.000 0.000 1.000
#> SRR1377164     3  0.0000     0.8988 0.000 0.000 1.000
#> SRR1377169     3  0.0237     0.8999 0.000 0.004 0.996
#> SRR1377170     3  0.0237     0.8999 0.000 0.004 0.996
#> SRR1377171     3  0.0000     0.8988 0.000 0.000 1.000
#> SRR1377172     3  0.0237     0.8999 0.000 0.004 0.996
#> SRR1377165     3  0.0000     0.8988 0.000 0.000 1.000
#> SRR1377166     3  0.0000     0.8988 0.000 0.000 1.000
#> SRR1377167     3  0.0237     0.8999 0.000 0.004 0.996
#> SRR1377168     3  0.0000     0.8988 0.000 0.000 1.000
#> SRR1377173     3  0.0829     0.8997 0.004 0.012 0.984
#> SRR1377174     3  0.0829     0.8997 0.004 0.012 0.984
#> SRR1377175     3  0.0661     0.9004 0.004 0.008 0.988
#> SRR1377176     3  0.0661     0.9004 0.004 0.008 0.988
#> SRR1377177     3  0.0829     0.8997 0.004 0.012 0.984
#> SRR1377178     3  0.0661     0.9004 0.004 0.008 0.988
#> SRR1377179     3  0.0661     0.9004 0.004 0.008 0.988
#> SRR1377180     3  0.0661     0.9004 0.004 0.008 0.988
#> SRR1377181     3  0.0661     0.9004 0.004 0.008 0.988
#> SRR1377182     3  0.0661     0.9004 0.004 0.008 0.988
#> SRR1377183     3  0.0829     0.8997 0.004 0.012 0.984
#> SRR1377184     3  0.0661     0.9004 0.004 0.008 0.988
#> SRR1377185     3  0.0983     0.8976 0.004 0.016 0.980
#> SRR1377186     3  0.0983     0.8976 0.004 0.016 0.980
#> SRR1377187     3  0.0661     0.9004 0.004 0.008 0.988
#> SRR1377188     3  0.0829     0.8997 0.004 0.012 0.984
#> SRR1377189     2  0.1289     0.8339 0.000 0.968 0.032
#> SRR1377190     2  0.1289     0.8339 0.000 0.968 0.032
#> SRR1377191     2  0.1289     0.8339 0.000 0.968 0.032
#> SRR1377192     2  0.1163     0.8324 0.000 0.972 0.028
#> SRR1377193     2  0.1399     0.8325 0.004 0.968 0.028
#> SRR1377194     2  0.1399     0.8325 0.004 0.968 0.028
#> SRR1377195     1  0.2796     0.9521 0.908 0.092 0.000
#> SRR1377196     1  0.3412     0.9715 0.876 0.124 0.000
#> SRR1377197     1  0.2860     0.9566 0.912 0.084 0.004
#> SRR1377198     1  0.3340     0.9714 0.880 0.120 0.000
#> SRR1377199     1  0.3644     0.9666 0.872 0.124 0.004
#> SRR1377200     1  0.3482     0.9681 0.872 0.128 0.000
#> SRR1377201     2  0.1525     0.8335 0.004 0.964 0.032
#> SRR1377202     2  0.1525     0.8335 0.004 0.964 0.032
#> SRR1377203     2  0.1525     0.8335 0.004 0.964 0.032
#> SRR1377204     2  0.1015     0.8149 0.012 0.980 0.008
#> SRR1377205     2  0.1015     0.8149 0.012 0.980 0.008
#> SRR1377206     2  0.1015     0.8149 0.012 0.980 0.008
#> SRR1377207     2  0.2400     0.8199 0.004 0.932 0.064
#> SRR1377208     2  0.2496     0.8173 0.004 0.928 0.068
#> SRR1377209     2  0.2496     0.8173 0.004 0.928 0.068
#> SRR1377210     2  0.1411     0.8339 0.000 0.964 0.036
#> SRR1377211     2  0.1411     0.8339 0.000 0.964 0.036
#> SRR1377212     2  0.1529     0.8328 0.000 0.960 0.040
#> SRR1377213     2  0.4818     0.7837 0.108 0.844 0.048
#> SRR1377214     2  0.5020     0.7789 0.108 0.836 0.056
#> SRR1377215     2  0.4818     0.7837 0.108 0.844 0.048
#> SRR1377216     3  0.5811     0.7408 0.108 0.092 0.800
#> SRR1377217     3  0.5650     0.7498 0.108 0.084 0.808
#> SRR1377218     3  0.5650     0.7498 0.108 0.084 0.808
#> SRR1377219     2  0.5020     0.7789 0.108 0.836 0.056
#> SRR1377220     2  0.5117     0.7803 0.108 0.832 0.060
#> SRR1377221     2  0.5117     0.7803 0.108 0.832 0.060
#> SRR1377222     2  0.4063     0.7687 0.112 0.868 0.020
#> SRR1377223     2  0.4063     0.7687 0.112 0.868 0.020
#> SRR1377224     2  0.4063     0.7687 0.112 0.868 0.020

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> SRR1377145     2  0.1940      0.804 0.000 0.924 0.076 0.000
#> SRR1377146     2  0.2053      0.803 0.004 0.924 0.072 0.000
#> SRR1377147     2  0.2401      0.801 0.004 0.904 0.092 0.000
#> SRR1377148     2  0.2011      0.803 0.000 0.920 0.080 0.000
#> SRR1377153     2  0.2704      0.787 0.000 0.876 0.124 0.000
#> SRR1377154     2  0.2868      0.779 0.000 0.864 0.136 0.000
#> SRR1377155     2  0.3024      0.771 0.000 0.852 0.148 0.000
#> SRR1377156     2  0.2921      0.777 0.000 0.860 0.140 0.000
#> SRR1377149     2  0.2530      0.795 0.000 0.888 0.112 0.000
#> SRR1377150     2  0.2382      0.801 0.004 0.912 0.080 0.004
#> SRR1377151     2  0.2466      0.799 0.004 0.900 0.096 0.000
#> SRR1377152     2  0.2466      0.800 0.004 0.900 0.096 0.000
#> SRR1377157     3  0.1970      0.879 0.008 0.000 0.932 0.060
#> SRR1377158     3  0.1890      0.881 0.008 0.000 0.936 0.056
#> SRR1377159     3  0.1807      0.883 0.008 0.000 0.940 0.052
#> SRR1377160     3  0.1970      0.879 0.008 0.000 0.932 0.060
#> SRR1377161     3  0.1854      0.884 0.012 0.000 0.940 0.048
#> SRR1377162     3  0.1938      0.883 0.012 0.000 0.936 0.052
#> SRR1377163     3  0.1938      0.882 0.012 0.000 0.936 0.052
#> SRR1377164     3  0.1767      0.885 0.012 0.000 0.944 0.044
#> SRR1377169     3  0.1767      0.885 0.012 0.000 0.944 0.044
#> SRR1377170     3  0.1767      0.885 0.012 0.000 0.944 0.044
#> SRR1377171     3  0.1635      0.885 0.008 0.000 0.948 0.044
#> SRR1377172     3  0.1635      0.885 0.008 0.000 0.948 0.044
#> SRR1377165     3  0.2048      0.877 0.008 0.000 0.928 0.064
#> SRR1377166     3  0.2048      0.877 0.008 0.000 0.928 0.064
#> SRR1377167     3  0.1970      0.879 0.008 0.000 0.932 0.060
#> SRR1377168     3  0.2048      0.877 0.008 0.000 0.928 0.064
#> SRR1377173     3  0.1474      0.879 0.000 0.052 0.948 0.000
#> SRR1377174     3  0.1389      0.881 0.000 0.048 0.952 0.000
#> SRR1377175     3  0.1302      0.882 0.000 0.044 0.956 0.000
#> SRR1377176     3  0.1302      0.882 0.000 0.044 0.956 0.000
#> SRR1377177     3  0.1940      0.866 0.000 0.076 0.924 0.000
#> SRR1377178     3  0.2081      0.860 0.000 0.084 0.916 0.000
#> SRR1377179     3  0.1867      0.869 0.000 0.072 0.928 0.000
#> SRR1377180     3  0.1940      0.866 0.000 0.076 0.924 0.000
#> SRR1377181     3  0.1489      0.881 0.000 0.044 0.952 0.004
#> SRR1377182     3  0.1302      0.882 0.000 0.044 0.956 0.000
#> SRR1377183     3  0.4134      0.659 0.000 0.260 0.740 0.000
#> SRR1377184     3  0.1637      0.875 0.000 0.060 0.940 0.000
#> SRR1377185     3  0.4277      0.631 0.000 0.280 0.720 0.000
#> SRR1377186     3  0.4331      0.620 0.000 0.288 0.712 0.000
#> SRR1377187     3  0.1389      0.881 0.000 0.048 0.952 0.000
#> SRR1377188     3  0.4331      0.621 0.000 0.288 0.712 0.000
#> SRR1377189     2  0.3208      0.809 0.004 0.848 0.000 0.148
#> SRR1377190     2  0.2944      0.821 0.004 0.868 0.000 0.128
#> SRR1377191     2  0.2773      0.827 0.004 0.880 0.000 0.116
#> SRR1377192     2  0.4088      0.734 0.004 0.764 0.000 0.232
#> SRR1377193     2  0.3908      0.755 0.004 0.784 0.000 0.212
#> SRR1377194     2  0.3945      0.751 0.004 0.780 0.000 0.216
#> SRR1377195     1  0.0779      0.965 0.980 0.016 0.000 0.004
#> SRR1377196     1  0.0672      0.965 0.984 0.008 0.000 0.008
#> SRR1377197     1  0.0672      0.965 0.984 0.008 0.000 0.008
#> SRR1377198     1  0.2546      0.961 0.912 0.060 0.000 0.028
#> SRR1377199     1  0.2908      0.955 0.896 0.064 0.000 0.040
#> SRR1377200     1  0.2466      0.963 0.916 0.056 0.000 0.028
#> SRR1377201     2  0.2469      0.829 0.000 0.892 0.000 0.108
#> SRR1377202     2  0.2469      0.829 0.000 0.892 0.000 0.108
#> SRR1377203     2  0.2469      0.829 0.000 0.892 0.000 0.108
#> SRR1377204     2  0.4994      0.293 0.000 0.520 0.000 0.480
#> SRR1377205     2  0.4996      0.282 0.000 0.516 0.000 0.484
#> SRR1377206     2  0.4996      0.282 0.000 0.516 0.000 0.484
#> SRR1377207     2  0.2334      0.832 0.000 0.908 0.004 0.088
#> SRR1377208     2  0.2334      0.832 0.000 0.908 0.004 0.088
#> SRR1377209     2  0.2334      0.832 0.000 0.908 0.004 0.088
#> SRR1377210     2  0.2704      0.825 0.000 0.876 0.000 0.124
#> SRR1377211     2  0.2704      0.825 0.000 0.876 0.000 0.124
#> SRR1377212     2  0.2647      0.826 0.000 0.880 0.000 0.120
#> SRR1377213     4  0.2214      0.808 0.000 0.044 0.028 0.928
#> SRR1377214     4  0.2214      0.808 0.000 0.044 0.028 0.928
#> SRR1377215     4  0.2313      0.808 0.000 0.044 0.032 0.924
#> SRR1377216     4  0.5337      0.386 0.000 0.012 0.424 0.564
#> SRR1377217     4  0.5345      0.377 0.000 0.012 0.428 0.560
#> SRR1377218     4  0.5345      0.377 0.000 0.012 0.428 0.560
#> SRR1377219     4  0.2408      0.808 0.000 0.044 0.036 0.920
#> SRR1377220     4  0.2408      0.808 0.000 0.044 0.036 0.920
#> SRR1377221     4  0.2408      0.808 0.000 0.044 0.036 0.920
#> SRR1377222     4  0.2845      0.785 0.000 0.076 0.028 0.896
#> SRR1377223     4  0.2845      0.785 0.000 0.076 0.028 0.896
#> SRR1377224     4  0.2845      0.785 0.000 0.076 0.028 0.896

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>            class entropy silhouette    p1    p2    p3    p4    p5
#> SRR1377145     2  0.5302      0.573 0.388 0.572 0.016 0.020 0.004
#> SRR1377146     2  0.5312      0.569 0.392 0.568 0.016 0.020 0.004
#> SRR1377147     2  0.5366      0.542 0.420 0.540 0.016 0.020 0.004
#> SRR1377148     2  0.5302      0.573 0.388 0.572 0.016 0.020 0.004
#> SRR1377153     2  0.5208      0.531 0.432 0.536 0.016 0.012 0.004
#> SRR1377154     2  0.5114      0.529 0.436 0.536 0.016 0.008 0.004
#> SRR1377155     2  0.5233      0.492 0.456 0.512 0.016 0.012 0.004
#> SRR1377156     2  0.5222      0.513 0.444 0.524 0.016 0.012 0.004
#> SRR1377149     2  0.5131      0.507 0.452 0.520 0.016 0.008 0.004
#> SRR1377150     2  0.5218      0.544 0.424 0.544 0.012 0.012 0.008
#> SRR1377151     2  0.5254      0.496 0.456 0.512 0.012 0.012 0.008
#> SRR1377152     2  0.5208      0.534 0.432 0.536 0.016 0.012 0.004
#> SRR1377157     3  0.0451      0.994 0.004 0.008 0.988 0.000 0.000
#> SRR1377158     3  0.0451      0.994 0.004 0.008 0.988 0.000 0.000
#> SRR1377159     3  0.0451      0.994 0.004 0.008 0.988 0.000 0.000
#> SRR1377160     3  0.0451      0.994 0.004 0.008 0.988 0.000 0.000
#> SRR1377161     3  0.0451      0.991 0.000 0.008 0.988 0.000 0.004
#> SRR1377162     3  0.0867      0.979 0.008 0.008 0.976 0.000 0.008
#> SRR1377163     3  0.0613      0.988 0.004 0.008 0.984 0.000 0.004
#> SRR1377164     3  0.0740      0.984 0.004 0.008 0.980 0.000 0.008
#> SRR1377169     3  0.0290      0.993 0.000 0.008 0.992 0.000 0.000
#> SRR1377170     3  0.0290      0.993 0.000 0.008 0.992 0.000 0.000
#> SRR1377171     3  0.0290      0.993 0.000 0.008 0.992 0.000 0.000
#> SRR1377172     3  0.0290      0.993 0.000 0.008 0.992 0.000 0.000
#> SRR1377165     3  0.0451      0.994 0.004 0.008 0.988 0.000 0.000
#> SRR1377166     3  0.0451      0.994 0.004 0.008 0.988 0.000 0.000
#> SRR1377167     3  0.0451      0.994 0.004 0.008 0.988 0.000 0.000
#> SRR1377168     3  0.0451      0.994 0.004 0.008 0.988 0.000 0.000
#> SRR1377173     1  0.3980      0.935 0.708 0.008 0.284 0.000 0.000
#> SRR1377174     1  0.3884      0.930 0.708 0.004 0.288 0.000 0.000
#> SRR1377175     1  0.3928      0.920 0.700 0.004 0.296 0.000 0.000
#> SRR1377176     1  0.3884      0.931 0.708 0.004 0.288 0.000 0.000
#> SRR1377177     1  0.3756      0.954 0.744 0.008 0.248 0.000 0.000
#> SRR1377178     1  0.3756      0.954 0.744 0.008 0.248 0.000 0.000
#> SRR1377179     1  0.3635      0.954 0.748 0.004 0.248 0.000 0.000
#> SRR1377180     1  0.3756      0.954 0.744 0.008 0.248 0.000 0.000
#> SRR1377181     1  0.3870      0.951 0.732 0.004 0.260 0.004 0.000
#> SRR1377182     1  0.3895      0.949 0.728 0.004 0.264 0.004 0.000
#> SRR1377183     1  0.4261      0.916 0.764 0.032 0.192 0.012 0.000
#> SRR1377184     1  0.3635      0.954 0.748 0.004 0.248 0.000 0.000
#> SRR1377185     1  0.4303      0.912 0.764 0.036 0.188 0.012 0.000
#> SRR1377186     1  0.4226      0.913 0.768 0.032 0.188 0.012 0.000
#> SRR1377187     1  0.3844      0.952 0.736 0.004 0.256 0.004 0.000
#> SRR1377188     1  0.4268      0.908 0.768 0.036 0.184 0.012 0.000
#> SRR1377189     2  0.1059      0.737 0.000 0.968 0.020 0.008 0.004
#> SRR1377190     2  0.1059      0.737 0.000 0.968 0.020 0.008 0.004
#> SRR1377191     2  0.1220      0.738 0.004 0.964 0.020 0.004 0.008
#> SRR1377192     2  0.1412      0.727 0.000 0.952 0.004 0.036 0.008
#> SRR1377193     2  0.1329      0.728 0.000 0.956 0.004 0.032 0.008
#> SRR1377194     2  0.1329      0.728 0.000 0.956 0.004 0.032 0.008
#> SRR1377195     5  0.1012      0.926 0.020 0.000 0.000 0.012 0.968
#> SRR1377196     5  0.1828      0.929 0.032 0.004 0.000 0.028 0.936
#> SRR1377197     5  0.1441      0.929 0.024 0.004 0.008 0.008 0.956
#> SRR1377198     5  0.3582      0.924 0.112 0.004 0.004 0.044 0.836
#> SRR1377199     5  0.5177      0.902 0.172 0.016 0.012 0.068 0.732
#> SRR1377200     5  0.4459      0.909 0.136 0.016 0.008 0.052 0.788
#> SRR1377201     2  0.1202      0.739 0.004 0.960 0.032 0.004 0.000
#> SRR1377202     2  0.1202      0.739 0.004 0.960 0.032 0.004 0.000
#> SRR1377203     2  0.1202      0.739 0.004 0.960 0.032 0.004 0.000
#> SRR1377204     2  0.2756      0.660 0.004 0.868 0.004 0.120 0.004
#> SRR1377205     2  0.2756      0.660 0.004 0.868 0.004 0.120 0.004
#> SRR1377206     2  0.2706      0.662 0.004 0.872 0.004 0.116 0.004
#> SRR1377207     2  0.1444      0.737 0.012 0.948 0.040 0.000 0.000
#> SRR1377208     2  0.1605      0.737 0.012 0.944 0.040 0.004 0.000
#> SRR1377209     2  0.1605      0.737 0.012 0.944 0.040 0.004 0.000
#> SRR1377210     2  0.1243      0.739 0.004 0.960 0.028 0.008 0.000
#> SRR1377211     2  0.1412      0.738 0.004 0.952 0.036 0.008 0.000
#> SRR1377212     2  0.1412      0.738 0.004 0.952 0.036 0.008 0.000
#> SRR1377213     4  0.2674      0.902 0.012 0.060 0.032 0.896 0.000
#> SRR1377214     4  0.2674      0.902 0.012 0.060 0.032 0.896 0.000
#> SRR1377215     4  0.2674      0.902 0.012 0.060 0.032 0.896 0.000
#> SRR1377216     4  0.4876      0.718 0.056 0.012 0.216 0.716 0.000
#> SRR1377217     4  0.4905      0.714 0.056 0.012 0.220 0.712 0.000
#> SRR1377218     4  0.4890      0.703 0.060 0.008 0.224 0.708 0.000
#> SRR1377219     4  0.2741      0.902 0.012 0.064 0.032 0.892 0.000
#> SRR1377220     4  0.2741      0.902 0.012 0.064 0.032 0.892 0.000
#> SRR1377221     4  0.2741      0.902 0.012 0.064 0.032 0.892 0.000
#> SRR1377222     4  0.2832      0.893 0.004 0.072 0.028 0.888 0.008
#> SRR1377223     4  0.2832      0.893 0.004 0.072 0.028 0.888 0.008
#> SRR1377224     4  0.2832      0.893 0.004 0.072 0.028 0.888 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
#> SRR1377145     6  0.4862      0.968 0.128 0.148 0.020 0.000 0.000 0.704
#> SRR1377146     6  0.4862      0.968 0.128 0.148 0.020 0.000 0.000 0.704
#> SRR1377147     6  0.4866      0.971 0.136 0.140 0.020 0.000 0.000 0.704
#> SRR1377148     6  0.4858      0.964 0.124 0.152 0.020 0.000 0.000 0.704
#> SRR1377153     6  0.5741      0.957 0.156 0.132 0.040 0.016 0.000 0.656
#> SRR1377154     6  0.5711      0.959 0.148 0.136 0.040 0.016 0.000 0.660
#> SRR1377155     6  0.5705      0.956 0.156 0.128 0.040 0.016 0.000 0.660
#> SRR1377156     6  0.5741      0.957 0.156 0.132 0.040 0.016 0.000 0.656
#> SRR1377149     6  0.4865      0.969 0.144 0.132 0.020 0.000 0.000 0.704
#> SRR1377150     6  0.4791      0.968 0.128 0.140 0.020 0.000 0.000 0.712
#> SRR1377151     6  0.4862      0.967 0.148 0.128 0.020 0.000 0.000 0.704
#> SRR1377152     6  0.4902      0.971 0.136 0.144 0.020 0.000 0.000 0.700
#> SRR1377157     3  0.0777      0.980 0.004 0.000 0.972 0.024 0.000 0.000
#> SRR1377158     3  0.0777      0.980 0.004 0.000 0.972 0.024 0.000 0.000
#> SRR1377159     3  0.0806      0.981 0.008 0.000 0.972 0.020 0.000 0.000
#> SRR1377160     3  0.0777      0.980 0.004 0.000 0.972 0.024 0.000 0.000
#> SRR1377161     3  0.0291      0.981 0.000 0.000 0.992 0.004 0.000 0.004
#> SRR1377162     3  0.0291      0.981 0.004 0.000 0.992 0.000 0.000 0.004
#> SRR1377163     3  0.0146      0.983 0.000 0.000 0.996 0.000 0.000 0.004
#> SRR1377164     3  0.0291      0.981 0.000 0.000 0.992 0.004 0.000 0.004
#> SRR1377169     3  0.0551      0.986 0.004 0.000 0.984 0.008 0.000 0.004
#> SRR1377170     3  0.0582      0.984 0.004 0.004 0.984 0.004 0.000 0.004
#> SRR1377171     3  0.0436      0.982 0.004 0.000 0.988 0.004 0.000 0.004
#> SRR1377172     3  0.0436      0.985 0.004 0.000 0.988 0.004 0.000 0.004
#> SRR1377165     3  0.0508      0.986 0.004 0.000 0.984 0.012 0.000 0.000
#> SRR1377166     3  0.0508      0.986 0.004 0.000 0.984 0.012 0.000 0.000
#> SRR1377167     3  0.0508      0.986 0.004 0.000 0.984 0.012 0.000 0.000
#> SRR1377168     3  0.0508      0.986 0.004 0.000 0.984 0.012 0.000 0.000
#> SRR1377173     1  0.1753      0.978 0.912 0.004 0.084 0.000 0.000 0.000
#> SRR1377174     1  0.1806      0.974 0.908 0.004 0.088 0.000 0.000 0.000
#> SRR1377175     1  0.1806      0.974 0.908 0.004 0.088 0.000 0.000 0.000
#> SRR1377176     1  0.1753      0.978 0.912 0.004 0.084 0.000 0.000 0.000
#> SRR1377177     1  0.1588      0.981 0.924 0.004 0.072 0.000 0.000 0.000
#> SRR1377178     1  0.1588      0.981 0.924 0.004 0.072 0.000 0.000 0.000
#> SRR1377179     1  0.1588      0.981 0.924 0.004 0.072 0.000 0.000 0.000
#> SRR1377180     1  0.1588      0.981 0.924 0.004 0.072 0.000 0.000 0.000
#> SRR1377181     1  0.1700      0.981 0.916 0.004 0.080 0.000 0.000 0.000
#> SRR1377182     1  0.1700      0.981 0.916 0.004 0.080 0.000 0.000 0.000
#> SRR1377183     1  0.2052      0.961 0.912 0.004 0.056 0.000 0.000 0.028
#> SRR1377184     1  0.1700      0.981 0.916 0.004 0.080 0.000 0.000 0.000
#> SRR1377185     1  0.2113      0.962 0.908 0.004 0.060 0.000 0.000 0.028
#> SRR1377186     1  0.2217      0.949 0.908 0.004 0.048 0.000 0.004 0.036
#> SRR1377187     1  0.1700      0.981 0.916 0.004 0.080 0.000 0.000 0.000
#> SRR1377188     1  0.2128      0.958 0.908 0.004 0.056 0.000 0.000 0.032
#> SRR1377189     2  0.0665      0.980 0.000 0.980 0.008 0.000 0.004 0.008
#> SRR1377190     2  0.0551      0.980 0.000 0.984 0.008 0.000 0.004 0.004
#> SRR1377191     2  0.0551      0.980 0.000 0.984 0.008 0.000 0.004 0.004
#> SRR1377192     2  0.0508      0.976 0.000 0.984 0.000 0.004 0.000 0.012
#> SRR1377193     2  0.0508      0.976 0.000 0.984 0.000 0.004 0.000 0.012
#> SRR1377194     2  0.0508      0.976 0.000 0.984 0.000 0.004 0.000 0.012
#> SRR1377195     5  0.1065      0.902 0.008 0.000 0.000 0.020 0.964 0.008
#> SRR1377196     5  0.1974      0.903 0.012 0.000 0.000 0.020 0.920 0.048
#> SRR1377197     5  0.1218      0.902 0.012 0.000 0.000 0.004 0.956 0.028
#> SRR1377198     5  0.5025      0.878 0.044 0.008 0.000 0.068 0.712 0.168
#> SRR1377199     5  0.4918      0.867 0.040 0.008 0.004 0.024 0.684 0.240
#> SRR1377200     5  0.4852      0.877 0.052 0.004 0.000 0.048 0.716 0.180
#> SRR1377201     2  0.0363      0.982 0.000 0.988 0.012 0.000 0.000 0.000
#> SRR1377202     2  0.0363      0.982 0.000 0.988 0.012 0.000 0.000 0.000
#> SRR1377203     2  0.0363      0.982 0.000 0.988 0.012 0.000 0.000 0.000
#> SRR1377204     2  0.1010      0.960 0.000 0.960 0.000 0.036 0.000 0.004
#> SRR1377205     2  0.1010      0.960 0.000 0.960 0.000 0.036 0.000 0.004
#> SRR1377206     2  0.1010      0.960 0.000 0.960 0.000 0.036 0.000 0.004
#> SRR1377207     2  0.0692      0.979 0.004 0.976 0.020 0.000 0.000 0.000
#> SRR1377208     2  0.0692      0.979 0.004 0.976 0.020 0.000 0.000 0.000
#> SRR1377209     2  0.0692      0.979 0.004 0.976 0.020 0.000 0.000 0.000
#> SRR1377210     2  0.0632      0.978 0.000 0.976 0.024 0.000 0.000 0.000
#> SRR1377211     2  0.0632      0.978 0.000 0.976 0.024 0.000 0.000 0.000
#> SRR1377212     2  0.0632      0.978 0.000 0.976 0.024 0.000 0.000 0.000
#> SRR1377213     4  0.2688      0.894 0.024 0.048 0.044 0.884 0.000 0.000
#> SRR1377214     4  0.2688      0.894 0.024 0.048 0.044 0.884 0.000 0.000
#> SRR1377215     4  0.2688      0.894 0.024 0.048 0.044 0.884 0.000 0.000
#> SRR1377216     4  0.5136      0.746 0.108 0.020 0.176 0.688 0.000 0.008
#> SRR1377217     4  0.5013      0.746 0.104 0.016 0.176 0.696 0.000 0.008
#> SRR1377218     4  0.5272      0.738 0.108 0.024 0.184 0.676 0.000 0.008
#> SRR1377219     4  0.2961      0.894 0.024 0.048 0.052 0.872 0.000 0.004
#> SRR1377220     4  0.2957      0.892 0.024 0.044 0.056 0.872 0.000 0.004
#> SRR1377221     4  0.2961      0.894 0.024 0.048 0.052 0.872 0.000 0.004
#> SRR1377222     4  0.3066      0.855 0.008 0.072 0.016 0.864 0.000 0.040
#> SRR1377223     4  0.3066      0.855 0.008 0.072 0.016 0.864 0.000 0.040
#> SRR1377224     4  0.3096      0.859 0.008 0.068 0.020 0.864 0.000 0.040

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

consensus_heatmap(res, k = 2)

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

consensus_heatmap(res, k = 3)

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

consensus_heatmap(res, k = 4)

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

consensus_heatmap(res, k = 5)

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

consensus_heatmap(res, k = 6)

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

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

membership_heatmap(res, k = 2)

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

membership_heatmap(res, k = 3)

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

membership_heatmap(res, k = 4)

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

membership_heatmap(res, k = 5)

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

membership_heatmap(res, k = 6)

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

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

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

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

get_signatures(res, k = 3)

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

get_signatures(res, k = 4)

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

get_signatures(res, k = 5)

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

get_signatures(res, k = 6)

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

Signature heatmaps where rows are not scaled:

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

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

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

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

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

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

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

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

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

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

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk MAD-NMF-signature_compare

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

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

An example of the output of tb is:

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

The columns in tb are:

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

UMAP plot which shows how samples are separated.

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

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

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

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

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

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

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

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

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

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

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk MAD-NMF-collect-classes

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


ATC:hclust**

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

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

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

res
#> A 'ConsensusPartition' object with k = 2, 3, 4, 5, 6.
#>   On a matrix with 13890 rows and 80 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 1.000           1.000       1.000        0.14137 0.859   0.859
#> 3 3 1.000           0.981       0.995        0.01118 0.998   0.998
#> 4 4 1.000           0.975       1.000        0.00885 0.999   0.999
#> 5 5 0.861           0.932       0.983        0.18360 0.999   0.999
#> 6 6 1.000           0.963       1.000        0.60609 0.871   0.849

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

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

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

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

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

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>            class entropy silhouette p1 p2
#> SRR1377145     2       0          1  0  1
#> SRR1377146     2       0          1  0  1
#> SRR1377147     2       0          1  0  1
#> SRR1377148     2       0          1  0  1
#> SRR1377153     2       0          1  0  1
#> SRR1377154     2       0          1  0  1
#> SRR1377155     2       0          1  0  1
#> SRR1377156     2       0          1  0  1
#> SRR1377149     2       0          1  0  1
#> SRR1377150     2       0          1  0  1
#> SRR1377151     2       0          1  0  1
#> SRR1377152     2       0          1  0  1
#> SRR1377157     2       0          1  0  1
#> SRR1377158     2       0          1  0  1
#> SRR1377159     2       0          1  0  1
#> SRR1377160     2       0          1  0  1
#> SRR1377161     2       0          1  0  1
#> SRR1377162     2       0          1  0  1
#> SRR1377163     2       0          1  0  1
#> SRR1377164     2       0          1  0  1
#> SRR1377169     2       0          1  0  1
#> SRR1377170     2       0          1  0  1
#> SRR1377171     2       0          1  0  1
#> SRR1377172     2       0          1  0  1
#> SRR1377165     2       0          1  0  1
#> SRR1377166     2       0          1  0  1
#> SRR1377167     2       0          1  0  1
#> SRR1377168     2       0          1  0  1
#> SRR1377173     2       0          1  0  1
#> SRR1377174     2       0          1  0  1
#> SRR1377175     2       0          1  0  1
#> SRR1377176     2       0          1  0  1
#> SRR1377177     2       0          1  0  1
#> SRR1377178     2       0          1  0  1
#> SRR1377179     2       0          1  0  1
#> SRR1377180     2       0          1  0  1
#> SRR1377181     2       0          1  0  1
#> SRR1377182     2       0          1  0  1
#> SRR1377183     2       0          1  0  1
#> SRR1377184     2       0          1  0  1
#> SRR1377185     2       0          1  0  1
#> SRR1377186     2       0          1  0  1
#> SRR1377187     2       0          1  0  1
#> SRR1377188     2       0          1  0  1
#> SRR1377189     2       0          1  0  1
#> SRR1377190     2       0          1  0  1
#> SRR1377191     2       0          1  0  1
#> SRR1377192     2       0          1  0  1
#> SRR1377193     2       0          1  0  1
#> SRR1377194     2       0          1  0  1
#> SRR1377195     1       0          1  1  0
#> SRR1377196     1       0          1  1  0
#> SRR1377197     1       0          1  1  0
#> SRR1377198     1       0          1  1  0
#> SRR1377199     1       0          1  1  0
#> SRR1377200     1       0          1  1  0
#> SRR1377201     2       0          1  0  1
#> SRR1377202     2       0          1  0  1
#> SRR1377203     2       0          1  0  1
#> SRR1377204     2       0          1  0  1
#> SRR1377205     2       0          1  0  1
#> SRR1377206     2       0          1  0  1
#> SRR1377207     2       0          1  0  1
#> SRR1377208     2       0          1  0  1
#> SRR1377209     2       0          1  0  1
#> SRR1377210     2       0          1  0  1
#> SRR1377211     2       0          1  0  1
#> SRR1377212     2       0          1  0  1
#> SRR1377213     2       0          1  0  1
#> SRR1377214     2       0          1  0  1
#> SRR1377215     2       0          1  0  1
#> SRR1377216     2       0          1  0  1
#> SRR1377217     2       0          1  0  1
#> SRR1377218     2       0          1  0  1
#> SRR1377219     2       0          1  0  1
#> SRR1377220     2       0          1  0  1
#> SRR1377221     2       0          1  0  1
#> SRR1377222     2       0          1  0  1
#> SRR1377223     2       0          1  0  1
#> SRR1377224     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
#> SRR1377145     2   0.000      1.000 0.000  1 0.000
#> SRR1377146     2   0.000      1.000 0.000  1 0.000
#> SRR1377147     2   0.000      1.000 0.000  1 0.000
#> SRR1377148     2   0.000      1.000 0.000  1 0.000
#> SRR1377153     2   0.000      1.000 0.000  1 0.000
#> SRR1377154     2   0.000      1.000 0.000  1 0.000
#> SRR1377155     2   0.000      1.000 0.000  1 0.000
#> SRR1377156     2   0.000      1.000 0.000  1 0.000
#> SRR1377149     2   0.000      1.000 0.000  1 0.000
#> SRR1377150     2   0.000      1.000 0.000  1 0.000
#> SRR1377151     2   0.000      1.000 0.000  1 0.000
#> SRR1377152     2   0.000      1.000 0.000  1 0.000
#> SRR1377157     2   0.000      1.000 0.000  1 0.000
#> SRR1377158     2   0.000      1.000 0.000  1 0.000
#> SRR1377159     2   0.000      1.000 0.000  1 0.000
#> SRR1377160     2   0.000      1.000 0.000  1 0.000
#> SRR1377161     2   0.000      1.000 0.000  1 0.000
#> SRR1377162     2   0.000      1.000 0.000  1 0.000
#> SRR1377163     2   0.000      1.000 0.000  1 0.000
#> SRR1377164     2   0.000      1.000 0.000  1 0.000
#> SRR1377169     2   0.000      1.000 0.000  1 0.000
#> SRR1377170     2   0.000      1.000 0.000  1 0.000
#> SRR1377171     2   0.000      1.000 0.000  1 0.000
#> SRR1377172     2   0.000      1.000 0.000  1 0.000
#> SRR1377165     2   0.000      1.000 0.000  1 0.000
#> SRR1377166     2   0.000      1.000 0.000  1 0.000
#> SRR1377167     2   0.000      1.000 0.000  1 0.000
#> SRR1377168     2   0.000      1.000 0.000  1 0.000
#> SRR1377173     2   0.000      1.000 0.000  1 0.000
#> SRR1377174     2   0.000      1.000 0.000  1 0.000
#> SRR1377175     2   0.000      1.000 0.000  1 0.000
#> SRR1377176     2   0.000      1.000 0.000  1 0.000
#> SRR1377177     2   0.000      1.000 0.000  1 0.000
#> SRR1377178     2   0.000      1.000 0.000  1 0.000
#> SRR1377179     2   0.000      1.000 0.000  1 0.000
#> SRR1377180     2   0.000      1.000 0.000  1 0.000
#> SRR1377181     2   0.000      1.000 0.000  1 0.000
#> SRR1377182     2   0.000      1.000 0.000  1 0.000
#> SRR1377183     2   0.000      1.000 0.000  1 0.000
#> SRR1377184     2   0.000      1.000 0.000  1 0.000
#> SRR1377185     2   0.000      1.000 0.000  1 0.000
#> SRR1377186     2   0.000      1.000 0.000  1 0.000
#> SRR1377187     2   0.000      1.000 0.000  1 0.000
#> SRR1377188     2   0.000      1.000 0.000  1 0.000
#> SRR1377189     2   0.000      1.000 0.000  1 0.000
#> SRR1377190     2   0.000      1.000 0.000  1 0.000
#> SRR1377191     2   0.000      1.000 0.000  1 0.000
#> SRR1377192     2   0.000      1.000 0.000  1 0.000
#> SRR1377193     2   0.000      1.000 0.000  1 0.000
#> SRR1377194     2   0.000      1.000 0.000  1 0.000
#> SRR1377195     1   0.000      0.941 1.000  0 0.000
#> SRR1377196     1   0.000      0.941 1.000  0 0.000
#> SRR1377197     1   0.000      0.941 1.000  0 0.000
#> SRR1377198     1   0.000      0.941 1.000  0 0.000
#> SRR1377199     1   0.445      0.749 0.808  0 0.192
#> SRR1377200     3   0.445      0.000 0.192  0 0.808
#> SRR1377201     2   0.000      1.000 0.000  1 0.000
#> SRR1377202     2   0.000      1.000 0.000  1 0.000
#> SRR1377203     2   0.000      1.000 0.000  1 0.000
#> SRR1377204     2   0.000      1.000 0.000  1 0.000
#> SRR1377205     2   0.000      1.000 0.000  1 0.000
#> SRR1377206     2   0.000      1.000 0.000  1 0.000
#> SRR1377207     2   0.000      1.000 0.000  1 0.000
#> SRR1377208     2   0.000      1.000 0.000  1 0.000
#> SRR1377209     2   0.000      1.000 0.000  1 0.000
#> SRR1377210     2   0.000      1.000 0.000  1 0.000
#> SRR1377211     2   0.000      1.000 0.000  1 0.000
#> SRR1377212     2   0.000      1.000 0.000  1 0.000
#> SRR1377213     2   0.000      1.000 0.000  1 0.000
#> SRR1377214     2   0.000      1.000 0.000  1 0.000
#> SRR1377215     2   0.000      1.000 0.000  1 0.000
#> SRR1377216     2   0.000      1.000 0.000  1 0.000
#> SRR1377217     2   0.000      1.000 0.000  1 0.000
#> SRR1377218     2   0.000      1.000 0.000  1 0.000
#> SRR1377219     2   0.000      1.000 0.000  1 0.000
#> SRR1377220     2   0.000      1.000 0.000  1 0.000
#> SRR1377221     2   0.000      1.000 0.000  1 0.000
#> SRR1377222     2   0.000      1.000 0.000  1 0.000
#> SRR1377223     2   0.000      1.000 0.000  1 0.000
#> SRR1377224     2   0.000      1.000 0.000  1 0.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1 p2    p3    p4
#> SRR1377145     2  0.0000      1.000 0.000  1 0.000 0.000
#> SRR1377146     2  0.0000      1.000 0.000  1 0.000 0.000
#> SRR1377147     2  0.0000      1.000 0.000  1 0.000 0.000
#> SRR1377148     2  0.0000      1.000 0.000  1 0.000 0.000
#> SRR1377153     2  0.0000      1.000 0.000  1 0.000 0.000
#> SRR1377154     2  0.0000      1.000 0.000  1 0.000 0.000
#> SRR1377155     2  0.0000      1.000 0.000  1 0.000 0.000
#> SRR1377156     2  0.0000      1.000 0.000  1 0.000 0.000
#> SRR1377149     2  0.0000      1.000 0.000  1 0.000 0.000
#> SRR1377150     2  0.0000      1.000 0.000  1 0.000 0.000
#> SRR1377151     2  0.0000      1.000 0.000  1 0.000 0.000
#> SRR1377152     2  0.0000      1.000 0.000  1 0.000 0.000
#> SRR1377157     2  0.0000      1.000 0.000  1 0.000 0.000
#> SRR1377158     2  0.0000      1.000 0.000  1 0.000 0.000
#> SRR1377159     2  0.0000      1.000 0.000  1 0.000 0.000
#> SRR1377160     2  0.0000      1.000 0.000  1 0.000 0.000
#> SRR1377161     2  0.0000      1.000 0.000  1 0.000 0.000
#> SRR1377162     2  0.0000      1.000 0.000  1 0.000 0.000
#> SRR1377163     2  0.0000      1.000 0.000  1 0.000 0.000
#> SRR1377164     2  0.0000      1.000 0.000  1 0.000 0.000
#> SRR1377169     2  0.0000      1.000 0.000  1 0.000 0.000
#> SRR1377170     2  0.0000      1.000 0.000  1 0.000 0.000
#> SRR1377171     2  0.0000      1.000 0.000  1 0.000 0.000
#> SRR1377172     2  0.0000      1.000 0.000  1 0.000 0.000
#> SRR1377165     2  0.0000      1.000 0.000  1 0.000 0.000
#> SRR1377166     2  0.0000      1.000 0.000  1 0.000 0.000
#> SRR1377167     2  0.0000      1.000 0.000  1 0.000 0.000
#> SRR1377168     2  0.0000      1.000 0.000  1 0.000 0.000
#> SRR1377173     2  0.0000      1.000 0.000  1 0.000 0.000
#> SRR1377174     2  0.0000      1.000 0.000  1 0.000 0.000
#> SRR1377175     2  0.0000      1.000 0.000  1 0.000 0.000
#> SRR1377176     2  0.0000      1.000 0.000  1 0.000 0.000
#> SRR1377177     2  0.0000      1.000 0.000  1 0.000 0.000
#> SRR1377178     2  0.0000      1.000 0.000  1 0.000 0.000
#> SRR1377179     2  0.0000      1.000 0.000  1 0.000 0.000
#> SRR1377180     2  0.0000      1.000 0.000  1 0.000 0.000
#> SRR1377181     2  0.0000      1.000 0.000  1 0.000 0.000
#> SRR1377182     2  0.0000      1.000 0.000  1 0.000 0.000
#> SRR1377183     2  0.0000      1.000 0.000  1 0.000 0.000
#> SRR1377184     2  0.0000      1.000 0.000  1 0.000 0.000
#> SRR1377185     2  0.0000      1.000 0.000  1 0.000 0.000
#> SRR1377186     2  0.0000      1.000 0.000  1 0.000 0.000
#> SRR1377187     2  0.0000      1.000 0.000  1 0.000 0.000
#> SRR1377188     2  0.0000      1.000 0.000  1 0.000 0.000
#> SRR1377189     2  0.0000      1.000 0.000  1 0.000 0.000
#> SRR1377190     2  0.0000      1.000 0.000  1 0.000 0.000
#> SRR1377191     2  0.0000      1.000 0.000  1 0.000 0.000
#> SRR1377192     2  0.0000      1.000 0.000  1 0.000 0.000
#> SRR1377193     2  0.0000      1.000 0.000  1 0.000 0.000
#> SRR1377194     2  0.0000      1.000 0.000  1 0.000 0.000
#> SRR1377195     1  0.0000      0.996 1.000  0 0.000 0.000
#> SRR1377196     1  0.0000      0.996 1.000  0 0.000 0.000
#> SRR1377197     1  0.0000      0.996 1.000  0 0.000 0.000
#> SRR1377198     1  0.0524      0.988 0.988  0 0.004 0.008
#> SRR1377199     4  0.0336      0.000 0.008  0 0.000 0.992
#> SRR1377200     3  0.0188      0.000 0.004  0 0.996 0.000
#> SRR1377201     2  0.0000      1.000 0.000  1 0.000 0.000
#> SRR1377202     2  0.0000      1.000 0.000  1 0.000 0.000
#> SRR1377203     2  0.0000      1.000 0.000  1 0.000 0.000
#> SRR1377204     2  0.0000      1.000 0.000  1 0.000 0.000
#> SRR1377205     2  0.0000      1.000 0.000  1 0.000 0.000
#> SRR1377206     2  0.0000      1.000 0.000  1 0.000 0.000
#> SRR1377207     2  0.0000      1.000 0.000  1 0.000 0.000
#> SRR1377208     2  0.0000      1.000 0.000  1 0.000 0.000
#> SRR1377209     2  0.0000      1.000 0.000  1 0.000 0.000
#> SRR1377210     2  0.0000      1.000 0.000  1 0.000 0.000
#> SRR1377211     2  0.0000      1.000 0.000  1 0.000 0.000
#> SRR1377212     2  0.0000      1.000 0.000  1 0.000 0.000
#> SRR1377213     2  0.0000      1.000 0.000  1 0.000 0.000
#> SRR1377214     2  0.0000      1.000 0.000  1 0.000 0.000
#> SRR1377215     2  0.0000      1.000 0.000  1 0.000 0.000
#> SRR1377216     2  0.0000      1.000 0.000  1 0.000 0.000
#> SRR1377217     2  0.0000      1.000 0.000  1 0.000 0.000
#> SRR1377218     2  0.0000      1.000 0.000  1 0.000 0.000
#> SRR1377219     2  0.0000      1.000 0.000  1 0.000 0.000
#> SRR1377220     2  0.0000      1.000 0.000  1 0.000 0.000
#> SRR1377221     2  0.0000      1.000 0.000  1 0.000 0.000
#> SRR1377222     2  0.0000      1.000 0.000  1 0.000 0.000
#> SRR1377223     2  0.0000      1.000 0.000  1 0.000 0.000
#> SRR1377224     2  0.0000      1.000 0.000  1 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
#> SRR1377145     2   0.000      0.983 0.0 1.0  0 0.0 0.0
#> SRR1377146     2   0.000      0.983 0.0 1.0  0 0.0 0.0
#> SRR1377147     2   0.000      0.983 0.0 1.0  0 0.0 0.0
#> SRR1377148     2   0.000      0.983 0.0 1.0  0 0.0 0.0
#> SRR1377153     2   0.000      0.983 0.0 1.0  0 0.0 0.0
#> SRR1377154     2   0.000      0.983 0.0 1.0  0 0.0 0.0
#> SRR1377155     2   0.000      0.983 0.0 1.0  0 0.0 0.0
#> SRR1377156     2   0.000      0.983 0.0 1.0  0 0.0 0.0
#> SRR1377149     2   0.000      0.983 0.0 1.0  0 0.0 0.0
#> SRR1377150     2   0.000      0.983 0.0 1.0  0 0.0 0.0
#> SRR1377151     2   0.000      0.983 0.0 1.0  0 0.0 0.0
#> SRR1377152     2   0.000      0.983 0.0 1.0  0 0.0 0.0
#> SRR1377157     2   0.000      0.983 0.0 1.0  0 0.0 0.0
#> SRR1377158     2   0.000      0.983 0.0 1.0  0 0.0 0.0
#> SRR1377159     2   0.000      0.983 0.0 1.0  0 0.0 0.0
#> SRR1377160     2   0.000      0.983 0.0 1.0  0 0.0 0.0
#> SRR1377161     2   0.000      0.983 0.0 1.0  0 0.0 0.0
#> SRR1377162     2   0.000      0.983 0.0 1.0  0 0.0 0.0
#> SRR1377163     2   0.000      0.983 0.0 1.0  0 0.0 0.0
#> SRR1377164     2   0.000      0.983 0.0 1.0  0 0.0 0.0
#> SRR1377169     2   0.000      0.983 0.0 1.0  0 0.0 0.0
#> SRR1377170     2   0.000      0.983 0.0 1.0  0 0.0 0.0
#> SRR1377171     2   0.000      0.983 0.0 1.0  0 0.0 0.0
#> SRR1377172     2   0.000      0.983 0.0 1.0  0 0.0 0.0
#> SRR1377165     2   0.000      0.983 0.0 1.0  0 0.0 0.0
#> SRR1377166     2   0.000      0.983 0.0 1.0  0 0.0 0.0
#> SRR1377167     2   0.000      0.983 0.0 1.0  0 0.0 0.0
#> SRR1377168     2   0.000      0.983 0.0 1.0  0 0.0 0.0
#> SRR1377173     2   0.000      0.983 0.0 1.0  0 0.0 0.0
#> SRR1377174     2   0.000      0.983 0.0 1.0  0 0.0 0.0
#> SRR1377175     2   0.000      0.983 0.0 1.0  0 0.0 0.0
#> SRR1377176     2   0.000      0.983 0.0 1.0  0 0.0 0.0
#> SRR1377177     2   0.000      0.983 0.0 1.0  0 0.0 0.0
#> SRR1377178     2   0.000      0.983 0.0 1.0  0 0.0 0.0
#> SRR1377179     2   0.000      0.983 0.0 1.0  0 0.0 0.0
#> SRR1377180     2   0.000      0.983 0.0 1.0  0 0.0 0.0
#> SRR1377181     2   0.000      0.983 0.0 1.0  0 0.0 0.0
#> SRR1377182     2   0.000      0.983 0.0 1.0  0 0.0 0.0
#> SRR1377183     2   0.000      0.983 0.0 1.0  0 0.0 0.0
#> SRR1377184     2   0.000      0.983 0.0 1.0  0 0.0 0.0
#> SRR1377185     2   0.000      0.983 0.0 1.0  0 0.0 0.0
#> SRR1377186     2   0.000      0.983 0.0 1.0  0 0.0 0.0
#> SRR1377187     2   0.000      0.983 0.0 1.0  0 0.0 0.0
#> SRR1377188     2   0.000      0.983 0.0 1.0  0 0.0 0.0
#> SRR1377189     2   0.000      0.983 0.0 1.0  0 0.0 0.0
#> SRR1377190     2   0.000      0.983 0.0 1.0  0 0.0 0.0
#> SRR1377191     2   0.000      0.983 0.0 1.0  0 0.0 0.0
#> SRR1377192     2   0.000      0.983 0.0 1.0  0 0.0 0.0
#> SRR1377193     2   0.000      0.983 0.0 1.0  0 0.0 0.0
#> SRR1377194     2   0.000      0.983 0.0 1.0  0 0.0 0.0
#> SRR1377195     1   0.000      1.000 1.0 0.0  0 0.0 0.0
#> SRR1377196     1   0.000      1.000 1.0 0.0  0 0.0 0.0
#> SRR1377197     1   0.000      1.000 1.0 0.0  0 0.0 0.0
#> SRR1377198     5   0.311      0.000 0.2 0.0  0 0.0 0.8
#> SRR1377199     4   0.311      0.000 0.0 0.0  0 0.8 0.2
#> SRR1377200     3   0.000      0.000 0.0 0.0  1 0.0 0.0
#> SRR1377201     2   0.000      0.983 0.0 1.0  0 0.0 0.0
#> SRR1377202     2   0.000      0.983 0.0 1.0  0 0.0 0.0
#> SRR1377203     2   0.000      0.983 0.0 1.0  0 0.0 0.0
#> SRR1377204     2   0.311      0.775 0.0 0.8  0 0.2 0.0
#> SRR1377205     2   0.311      0.775 0.0 0.8  0 0.2 0.0
#> SRR1377206     2   0.311      0.775 0.0 0.8  0 0.2 0.0
#> SRR1377207     2   0.000      0.983 0.0 1.0  0 0.0 0.0
#> SRR1377208     2   0.000      0.983 0.0 1.0  0 0.0 0.0
#> SRR1377209     2   0.000      0.983 0.0 1.0  0 0.0 0.0
#> SRR1377210     2   0.000      0.983 0.0 1.0  0 0.0 0.0
#> SRR1377211     2   0.000      0.983 0.0 1.0  0 0.0 0.0
#> SRR1377212     2   0.000      0.983 0.0 1.0  0 0.0 0.0
#> SRR1377213     2   0.000      0.983 0.0 1.0  0 0.0 0.0
#> SRR1377214     2   0.000      0.983 0.0 1.0  0 0.0 0.0
#> SRR1377215     2   0.000      0.983 0.0 1.0  0 0.0 0.0
#> SRR1377216     2   0.000      0.983 0.0 1.0  0 0.0 0.0
#> SRR1377217     2   0.000      0.983 0.0 1.0  0 0.0 0.0
#> SRR1377218     2   0.000      0.983 0.0 1.0  0 0.0 0.0
#> SRR1377219     2   0.000      0.983 0.0 1.0  0 0.0 0.0
#> SRR1377220     2   0.000      0.983 0.0 1.0  0 0.0 0.0
#> SRR1377221     2   0.000      0.983 0.0 1.0  0 0.0 0.0
#> SRR1377222     2   0.311      0.775 0.0 0.8  0 0.2 0.0
#> SRR1377223     2   0.311      0.775 0.0 0.8  0 0.2 0.0
#> SRR1377224     2   0.311      0.775 0.0 0.8  0 0.2 0.0

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>            class entropy silhouette p1 p2 p3 p4 p5 p6
#> SRR1377145     1       0          1  1  0  0  0  0  0
#> SRR1377146     1       0          1  1  0  0  0  0  0
#> SRR1377147     1       0          1  1  0  0  0  0  0
#> SRR1377148     1       0          1  1  0  0  0  0  0
#> SRR1377153     1       0          1  1  0  0  0  0  0
#> SRR1377154     1       0          1  1  0  0  0  0  0
#> SRR1377155     1       0          1  1  0  0  0  0  0
#> SRR1377156     1       0          1  1  0  0  0  0  0
#> SRR1377149     1       0          1  1  0  0  0  0  0
#> SRR1377150     1       0          1  1  0  0  0  0  0
#> SRR1377151     1       0          1  1  0  0  0  0  0
#> SRR1377152     1       0          1  1  0  0  0  0  0
#> SRR1377157     1       0          1  1  0  0  0  0  0
#> SRR1377158     1       0          1  1  0  0  0  0  0
#> SRR1377159     1       0          1  1  0  0  0  0  0
#> SRR1377160     1       0          1  1  0  0  0  0  0
#> SRR1377161     1       0          1  1  0  0  0  0  0
#> SRR1377162     1       0          1  1  0  0  0  0  0
#> SRR1377163     1       0          1  1  0  0  0  0  0
#> SRR1377164     1       0          1  1  0  0  0  0  0
#> SRR1377169     1       0          1  1  0  0  0  0  0
#> SRR1377170     1       0          1  1  0  0  0  0  0
#> SRR1377171     1       0          1  1  0  0  0  0  0
#> SRR1377172     1       0          1  1  0  0  0  0  0
#> SRR1377165     1       0          1  1  0  0  0  0  0
#> SRR1377166     1       0          1  1  0  0  0  0  0
#> SRR1377167     1       0          1  1  0  0  0  0  0
#> SRR1377168     1       0          1  1  0  0  0  0  0
#> SRR1377173     1       0          1  1  0  0  0  0  0
#> SRR1377174     1       0          1  1  0  0  0  0  0
#> SRR1377175     1       0          1  1  0  0  0  0  0
#> SRR1377176     1       0          1  1  0  0  0  0  0
#> SRR1377177     1       0          1  1  0  0  0  0  0
#> SRR1377178     1       0          1  1  0  0  0  0  0
#> SRR1377179     1       0          1  1  0  0  0  0  0
#> SRR1377180     1       0          1  1  0  0  0  0  0
#> SRR1377181     1       0          1  1  0  0  0  0  0
#> SRR1377182     1       0          1  1  0  0  0  0  0
#> SRR1377183     1       0          1  1  0  0  0  0  0
#> SRR1377184     1       0          1  1  0  0  0  0  0
#> SRR1377185     1       0          1  1  0  0  0  0  0
#> SRR1377186     1       0          1  1  0  0  0  0  0
#> SRR1377187     1       0          1  1  0  0  0  0  0
#> SRR1377188     1       0          1  1  0  0  0  0  0
#> SRR1377189     1       0          1  1  0  0  0  0  0
#> SRR1377190     1       0          1  1  0  0  0  0  0
#> SRR1377191     1       0          1  1  0  0  0  0  0
#> SRR1377192     1       0          1  1  0  0  0  0  0
#> SRR1377193     1       0          1  1  0  0  0  0  0
#> SRR1377194     1       0          1  1  0  0  0  0  0
#> SRR1377195     5       0          1  0  0  0  0  1  0
#> SRR1377196     5       0          1  0  0  0  0  1  0
#> SRR1377197     5       0          1  0  0  0  0  1  0
#> SRR1377198     6       0          0  0  0  0  0  0  1
#> SRR1377199     4       0          0  0  0  0  1  0  0
#> SRR1377200     3       0          0  0  0  1  0  0  0
#> SRR1377201     1       0          1  1  0  0  0  0  0
#> SRR1377202     1       0          1  1  0  0  0  0  0
#> SRR1377203     1       0          1  1  0  0  0  0  0
#> SRR1377204     2       0          1  0  1  0  0  0  0
#> SRR1377205     2       0          1  0  1  0  0  0  0
#> SRR1377206     2       0          1  0  1  0  0  0  0
#> SRR1377207     1       0          1  1  0  0  0  0  0
#> SRR1377208     1       0          1  1  0  0  0  0  0
#> SRR1377209     1       0          1  1  0  0  0  0  0
#> SRR1377210     1       0          1  1  0  0  0  0  0
#> SRR1377211     1       0          1  1  0  0  0  0  0
#> SRR1377212     1       0          1  1  0  0  0  0  0
#> SRR1377213     1       0          1  1  0  0  0  0  0
#> SRR1377214     1       0          1  1  0  0  0  0  0
#> SRR1377215     1       0          1  1  0  0  0  0  0
#> SRR1377216     1       0          1  1  0  0  0  0  0
#> SRR1377217     1       0          1  1  0  0  0  0  0
#> SRR1377218     1       0          1  1  0  0  0  0  0
#> SRR1377219     1       0          1  1  0  0  0  0  0
#> SRR1377220     1       0          1  1  0  0  0  0  0
#> SRR1377221     1       0          1  1  0  0  0  0  0
#> SRR1377222     2       0          1  0  1  0  0  0  0
#> SRR1377223     2       0          1  0  1  0  0  0  0
#> SRR1377224     2       0          1  0  1  0  0  0  0

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

consensus_heatmap(res, k = 2)

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

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

collect_plots(res)

plot of chunk ATC-kmeans-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 1.000           1.000       1.000         0.1414 0.859   0.859
#> 3 3 0.499           0.898       0.900         2.2879 0.638   0.579
#> 4 4 0.617           0.729       0.787         0.3407 1.000   1.000
#> 5 5 0.630           0.658       0.763         0.1335 0.813   0.624
#> 6 6 0.638           0.780       0.769         0.0783 0.905   0.700

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

suggest_best_k(res)
#> [1] 2

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

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

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>            class entropy silhouette p1 p2
#> SRR1377145     2       0          1  0  1
#> SRR1377146     2       0          1  0  1
#> SRR1377147     2       0          1  0  1
#> SRR1377148     2       0          1  0  1
#> SRR1377153     2       0          1  0  1
#> SRR1377154     2       0          1  0  1
#> SRR1377155     2       0          1  0  1
#> SRR1377156     2       0          1  0  1
#> SRR1377149     2       0          1  0  1
#> SRR1377150     2       0          1  0  1
#> SRR1377151     2       0          1  0  1
#> SRR1377152     2       0          1  0  1
#> SRR1377157     2       0          1  0  1
#> SRR1377158     2       0          1  0  1
#> SRR1377159     2       0          1  0  1
#> SRR1377160     2       0          1  0  1
#> SRR1377161     2       0          1  0  1
#> SRR1377162     2       0          1  0  1
#> SRR1377163     2       0          1  0  1
#> SRR1377164     2       0          1  0  1
#> SRR1377169     2       0          1  0  1
#> SRR1377170     2       0          1  0  1
#> SRR1377171     2       0          1  0  1
#> SRR1377172     2       0          1  0  1
#> SRR1377165     2       0          1  0  1
#> SRR1377166     2       0          1  0  1
#> SRR1377167     2       0          1  0  1
#> SRR1377168     2       0          1  0  1
#> SRR1377173     2       0          1  0  1
#> SRR1377174     2       0          1  0  1
#> SRR1377175     2       0          1  0  1
#> SRR1377176     2       0          1  0  1
#> SRR1377177     2       0          1  0  1
#> SRR1377178     2       0          1  0  1
#> SRR1377179     2       0          1  0  1
#> SRR1377180     2       0          1  0  1
#> SRR1377181     2       0          1  0  1
#> SRR1377182     2       0          1  0  1
#> SRR1377183     2       0          1  0  1
#> SRR1377184     2       0          1  0  1
#> SRR1377185     2       0          1  0  1
#> SRR1377186     2       0          1  0  1
#> SRR1377187     2       0          1  0  1
#> SRR1377188     2       0          1  0  1
#> SRR1377189     2       0          1  0  1
#> SRR1377190     2       0          1  0  1
#> SRR1377191     2       0          1  0  1
#> SRR1377192     2       0          1  0  1
#> SRR1377193     2       0          1  0  1
#> SRR1377194     2       0          1  0  1
#> SRR1377195     1       0          1  1  0
#> SRR1377196     1       0          1  1  0
#> SRR1377197     1       0          1  1  0
#> SRR1377198     1       0          1  1  0
#> SRR1377199     1       0          1  1  0
#> SRR1377200     1       0          1  1  0
#> SRR1377201     2       0          1  0  1
#> SRR1377202     2       0          1  0  1
#> SRR1377203     2       0          1  0  1
#> SRR1377204     2       0          1  0  1
#> SRR1377205     2       0          1  0  1
#> SRR1377206     2       0          1  0  1
#> SRR1377207     2       0          1  0  1
#> SRR1377208     2       0          1  0  1
#> SRR1377209     2       0          1  0  1
#> SRR1377210     2       0          1  0  1
#> SRR1377211     2       0          1  0  1
#> SRR1377212     2       0          1  0  1
#> SRR1377213     2       0          1  0  1
#> SRR1377214     2       0          1  0  1
#> SRR1377215     2       0          1  0  1
#> SRR1377216     2       0          1  0  1
#> SRR1377217     2       0          1  0  1
#> SRR1377218     2       0          1  0  1
#> SRR1377219     2       0          1  0  1
#> SRR1377220     2       0          1  0  1
#> SRR1377221     2       0          1  0  1
#> SRR1377222     2       0          1  0  1
#> SRR1377223     2       0          1  0  1
#> SRR1377224     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
#> SRR1377145     2  0.3619      0.856 0.000 0.864 0.136
#> SRR1377146     2  0.3619      0.856 0.000 0.864 0.136
#> SRR1377147     2  0.3619      0.856 0.000 0.864 0.136
#> SRR1377148     2  0.3619      0.856 0.000 0.864 0.136
#> SRR1377153     2  0.2356      0.902 0.000 0.928 0.072
#> SRR1377154     2  0.2537      0.899 0.000 0.920 0.080
#> SRR1377155     2  0.2537      0.899 0.000 0.920 0.080
#> SRR1377156     2  0.2448      0.901 0.000 0.924 0.076
#> SRR1377149     2  0.3116      0.882 0.000 0.892 0.108
#> SRR1377150     2  0.2711      0.895 0.000 0.912 0.088
#> SRR1377151     2  0.2711      0.895 0.000 0.912 0.088
#> SRR1377152     2  0.3038      0.885 0.000 0.896 0.104
#> SRR1377157     3  0.4504      0.943 0.000 0.196 0.804
#> SRR1377158     3  0.4504      0.943 0.000 0.196 0.804
#> SRR1377159     3  0.4504      0.943 0.000 0.196 0.804
#> SRR1377160     3  0.4504      0.943 0.000 0.196 0.804
#> SRR1377161     3  0.4504      0.943 0.000 0.196 0.804
#> SRR1377162     3  0.4504      0.943 0.000 0.196 0.804
#> SRR1377163     3  0.4504      0.943 0.000 0.196 0.804
#> SRR1377164     3  0.4504      0.943 0.000 0.196 0.804
#> SRR1377169     3  0.4504      0.943 0.000 0.196 0.804
#> SRR1377170     3  0.4504      0.943 0.000 0.196 0.804
#> SRR1377171     3  0.4504      0.943 0.000 0.196 0.804
#> SRR1377172     3  0.4504      0.943 0.000 0.196 0.804
#> SRR1377165     3  0.4504      0.943 0.000 0.196 0.804
#> SRR1377166     3  0.4504      0.943 0.000 0.196 0.804
#> SRR1377167     3  0.4504      0.943 0.000 0.196 0.804
#> SRR1377168     3  0.4504      0.943 0.000 0.196 0.804
#> SRR1377173     2  0.0237      0.932 0.000 0.996 0.004
#> SRR1377174     2  0.0237      0.932 0.000 0.996 0.004
#> SRR1377175     2  0.0237      0.932 0.000 0.996 0.004
#> SRR1377176     2  0.0237      0.932 0.000 0.996 0.004
#> SRR1377177     2  0.0592      0.930 0.000 0.988 0.012
#> SRR1377178     2  0.0592      0.930 0.000 0.988 0.012
#> SRR1377179     2  0.0592      0.930 0.000 0.988 0.012
#> SRR1377180     2  0.0592      0.930 0.000 0.988 0.012
#> SRR1377181     2  0.0592      0.930 0.000 0.988 0.012
#> SRR1377182     2  0.0592      0.930 0.000 0.988 0.012
#> SRR1377183     2  0.0237      0.932 0.000 0.996 0.004
#> SRR1377184     2  0.0592      0.930 0.000 0.988 0.012
#> SRR1377185     2  0.0237      0.932 0.000 0.996 0.004
#> SRR1377186     2  0.0237      0.932 0.000 0.996 0.004
#> SRR1377187     2  0.0592      0.930 0.000 0.988 0.012
#> SRR1377188     2  0.0237      0.932 0.000 0.996 0.004
#> SRR1377189     2  0.0000      0.931 0.000 1.000 0.000
#> SRR1377190     2  0.0000      0.931 0.000 1.000 0.000
#> SRR1377191     2  0.0000      0.931 0.000 1.000 0.000
#> SRR1377192     2  0.0424      0.930 0.000 0.992 0.008
#> SRR1377193     2  0.0424      0.930 0.000 0.992 0.008
#> SRR1377194     2  0.0424      0.930 0.000 0.992 0.008
#> SRR1377195     1  0.0000      0.999 1.000 0.000 0.000
#> SRR1377196     1  0.0000      0.999 1.000 0.000 0.000
#> SRR1377197     1  0.0000      0.999 1.000 0.000 0.000
#> SRR1377198     1  0.0000      0.999 1.000 0.000 0.000
#> SRR1377199     1  0.0237      0.998 0.996 0.000 0.004
#> SRR1377200     1  0.0237      0.998 0.996 0.000 0.004
#> SRR1377201     2  0.0424      0.930 0.000 0.992 0.008
#> SRR1377202     2  0.0424      0.930 0.000 0.992 0.008
#> SRR1377203     2  0.0424      0.930 0.000 0.992 0.008
#> SRR1377204     2  0.3551      0.826 0.000 0.868 0.132
#> SRR1377205     2  0.3551      0.826 0.000 0.868 0.132
#> SRR1377206     2  0.3551      0.826 0.000 0.868 0.132
#> SRR1377207     2  0.0424      0.930 0.000 0.992 0.008
#> SRR1377208     2  0.0424      0.930 0.000 0.992 0.008
#> SRR1377209     2  0.0424      0.930 0.000 0.992 0.008
#> SRR1377210     2  0.0000      0.931 0.000 1.000 0.000
#> SRR1377211     2  0.0000      0.931 0.000 1.000 0.000
#> SRR1377212     2  0.0000      0.931 0.000 1.000 0.000
#> SRR1377213     2  0.4842      0.623 0.000 0.776 0.224
#> SRR1377214     2  0.4842      0.623 0.000 0.776 0.224
#> SRR1377215     2  0.4842      0.623 0.000 0.776 0.224
#> SRR1377216     3  0.4504      0.943 0.000 0.196 0.804
#> SRR1377217     3  0.4504      0.943 0.000 0.196 0.804
#> SRR1377218     3  0.4504      0.943 0.000 0.196 0.804
#> SRR1377219     3  0.6252      0.557 0.000 0.444 0.556
#> SRR1377220     3  0.6252      0.557 0.000 0.444 0.556
#> SRR1377221     3  0.6252      0.557 0.000 0.444 0.556
#> SRR1377222     2  0.3551      0.826 0.000 0.868 0.132
#> SRR1377223     2  0.3551      0.826 0.000 0.868 0.132
#> SRR1377224     2  0.3551      0.826 0.000 0.868 0.132

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> SRR1377145     2  0.5417      0.555 0.000 0.572 0.016 0.412
#> SRR1377146     2  0.5417      0.555 0.000 0.572 0.016 0.412
#> SRR1377147     2  0.5417      0.555 0.000 0.572 0.016 0.412
#> SRR1377148     2  0.5417      0.555 0.000 0.572 0.016 0.412
#> SRR1377153     2  0.5498      0.558 0.000 0.576 0.020 0.404
#> SRR1377154     2  0.5498      0.558 0.000 0.576 0.020 0.404
#> SRR1377155     2  0.5498      0.558 0.000 0.576 0.020 0.404
#> SRR1377156     2  0.5498      0.558 0.000 0.576 0.020 0.404
#> SRR1377149     2  0.5310      0.557 0.000 0.576 0.012 0.412
#> SRR1377150     2  0.5310      0.557 0.000 0.576 0.012 0.412
#> SRR1377151     2  0.5310      0.557 0.000 0.576 0.012 0.412
#> SRR1377152     2  0.5310      0.557 0.000 0.576 0.012 0.412
#> SRR1377157     3  0.1305      0.918 0.000 0.036 0.960 0.004
#> SRR1377158     3  0.1305      0.918 0.000 0.036 0.960 0.004
#> SRR1377159     3  0.1305      0.918 0.000 0.036 0.960 0.004
#> SRR1377160     3  0.1305      0.918 0.000 0.036 0.960 0.004
#> SRR1377161     3  0.1118      0.919 0.000 0.036 0.964 0.000
#> SRR1377162     3  0.1118      0.919 0.000 0.036 0.964 0.000
#> SRR1377163     3  0.1118      0.919 0.000 0.036 0.964 0.000
#> SRR1377164     3  0.1118      0.919 0.000 0.036 0.964 0.000
#> SRR1377169     3  0.1584      0.916 0.000 0.036 0.952 0.012
#> SRR1377170     3  0.1584      0.916 0.000 0.036 0.952 0.012
#> SRR1377171     3  0.1584      0.916 0.000 0.036 0.952 0.012
#> SRR1377172     3  0.1584      0.916 0.000 0.036 0.952 0.012
#> SRR1377165     3  0.1118      0.919 0.000 0.036 0.964 0.000
#> SRR1377166     3  0.1118      0.919 0.000 0.036 0.964 0.000
#> SRR1377167     3  0.1118      0.919 0.000 0.036 0.964 0.000
#> SRR1377168     3  0.1118      0.919 0.000 0.036 0.964 0.000
#> SRR1377173     2  0.3636      0.737 0.000 0.820 0.008 0.172
#> SRR1377174     2  0.3636      0.737 0.000 0.820 0.008 0.172
#> SRR1377175     2  0.3636      0.737 0.000 0.820 0.008 0.172
#> SRR1377176     2  0.3636      0.737 0.000 0.820 0.008 0.172
#> SRR1377177     2  0.3636      0.737 0.000 0.820 0.008 0.172
#> SRR1377178     2  0.3636      0.737 0.000 0.820 0.008 0.172
#> SRR1377179     2  0.3636      0.737 0.000 0.820 0.008 0.172
#> SRR1377180     2  0.3636      0.737 0.000 0.820 0.008 0.172
#> SRR1377181     2  0.3768      0.736 0.000 0.808 0.008 0.184
#> SRR1377182     2  0.3768      0.736 0.000 0.808 0.008 0.184
#> SRR1377183     2  0.3591      0.737 0.000 0.824 0.008 0.168
#> SRR1377184     2  0.3768      0.736 0.000 0.808 0.008 0.184
#> SRR1377185     2  0.3591      0.737 0.000 0.824 0.008 0.168
#> SRR1377186     2  0.3591      0.737 0.000 0.824 0.008 0.168
#> SRR1377187     2  0.3768      0.736 0.000 0.808 0.008 0.184
#> SRR1377188     2  0.3591      0.737 0.000 0.824 0.008 0.168
#> SRR1377189     2  0.0376      0.758 0.000 0.992 0.004 0.004
#> SRR1377190     2  0.0376      0.758 0.000 0.992 0.004 0.004
#> SRR1377191     2  0.0376      0.758 0.000 0.992 0.004 0.004
#> SRR1377192     2  0.0376      0.757 0.000 0.992 0.004 0.004
#> SRR1377193     2  0.0376      0.757 0.000 0.992 0.004 0.004
#> SRR1377194     2  0.0376      0.757 0.000 0.992 0.004 0.004
#> SRR1377195     1  0.0000      0.998 1.000 0.000 0.000 0.000
#> SRR1377196     1  0.0000      0.998 1.000 0.000 0.000 0.000
#> SRR1377197     1  0.0000      0.998 1.000 0.000 0.000 0.000
#> SRR1377198     1  0.0188      0.997 0.996 0.000 0.004 0.000
#> SRR1377199     1  0.0000      0.998 1.000 0.000 0.000 0.000
#> SRR1377200     1  0.0592      0.993 0.984 0.000 0.000 0.016
#> SRR1377201     2  0.0524      0.757 0.000 0.988 0.004 0.008
#> SRR1377202     2  0.0524      0.757 0.000 0.988 0.004 0.008
#> SRR1377203     2  0.0524      0.757 0.000 0.988 0.004 0.008
#> SRR1377204     2  0.5349      0.488 0.000 0.640 0.024 0.336
#> SRR1377205     2  0.5349      0.488 0.000 0.640 0.024 0.336
#> SRR1377206     2  0.5349      0.488 0.000 0.640 0.024 0.336
#> SRR1377207     2  0.0524      0.757 0.000 0.988 0.004 0.008
#> SRR1377208     2  0.0524      0.757 0.000 0.988 0.004 0.008
#> SRR1377209     2  0.0524      0.757 0.000 0.988 0.004 0.008
#> SRR1377210     2  0.0376      0.758 0.000 0.992 0.004 0.004
#> SRR1377211     2  0.0376      0.758 0.000 0.992 0.004 0.004
#> SRR1377212     2  0.0376      0.758 0.000 0.992 0.004 0.004
#> SRR1377213     2  0.7016      0.185 0.000 0.540 0.320 0.140
#> SRR1377214     2  0.7016      0.185 0.000 0.540 0.320 0.140
#> SRR1377215     2  0.7016      0.185 0.000 0.540 0.320 0.140
#> SRR1377216     3  0.4072      0.844 0.000 0.052 0.828 0.120
#> SRR1377217     3  0.4072      0.844 0.000 0.052 0.828 0.120
#> SRR1377218     3  0.4072      0.844 0.000 0.052 0.828 0.120
#> SRR1377219     3  0.6656      0.607 0.000 0.256 0.608 0.136
#> SRR1377220     3  0.6656      0.607 0.000 0.256 0.608 0.136
#> SRR1377221     3  0.6656      0.607 0.000 0.256 0.608 0.136
#> SRR1377222     2  0.5404      0.490 0.000 0.644 0.028 0.328
#> SRR1377223     2  0.5404      0.490 0.000 0.644 0.028 0.328
#> SRR1377224     2  0.5404      0.490 0.000 0.644 0.028 0.328

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>            class entropy silhouette    p1    p2    p3    p4    p5
#> SRR1377145     2  0.3732      0.970 0.208 0.776 0.008 0.008 0.000
#> SRR1377146     2  0.3732      0.970 0.208 0.776 0.008 0.008 0.000
#> SRR1377147     2  0.3840      0.967 0.208 0.772 0.012 0.008 0.000
#> SRR1377148     2  0.3732      0.970 0.208 0.776 0.008 0.008 0.000
#> SRR1377153     2  0.4348      0.962 0.216 0.744 0.008 0.032 0.000
#> SRR1377154     2  0.4348      0.962 0.216 0.744 0.008 0.032 0.000
#> SRR1377155     2  0.4348      0.962 0.216 0.744 0.008 0.032 0.000
#> SRR1377156     2  0.4348      0.962 0.216 0.744 0.008 0.032 0.000
#> SRR1377149     2  0.4205      0.966 0.208 0.756 0.008 0.028 0.000
#> SRR1377150     2  0.4205      0.966 0.208 0.756 0.008 0.028 0.000
#> SRR1377151     2  0.4205      0.966 0.208 0.756 0.008 0.028 0.000
#> SRR1377152     2  0.4205      0.966 0.208 0.756 0.008 0.028 0.000
#> SRR1377157     3  0.1074      0.780 0.012 0.016 0.968 0.004 0.000
#> SRR1377158     3  0.1074      0.780 0.012 0.016 0.968 0.004 0.000
#> SRR1377159     3  0.1074      0.780 0.012 0.016 0.968 0.004 0.000
#> SRR1377160     3  0.1074      0.780 0.012 0.016 0.968 0.004 0.000
#> SRR1377161     3  0.0727      0.784 0.012 0.004 0.980 0.004 0.000
#> SRR1377162     3  0.0727      0.784 0.012 0.004 0.980 0.004 0.000
#> SRR1377163     3  0.0727      0.784 0.012 0.004 0.980 0.004 0.000
#> SRR1377164     3  0.0727      0.784 0.012 0.004 0.980 0.004 0.000
#> SRR1377169     3  0.2060      0.770 0.012 0.036 0.928 0.024 0.000
#> SRR1377170     3  0.2060      0.770 0.012 0.036 0.928 0.024 0.000
#> SRR1377171     3  0.2060      0.770 0.012 0.036 0.928 0.024 0.000
#> SRR1377172     3  0.2060      0.770 0.012 0.036 0.928 0.024 0.000
#> SRR1377165     3  0.0981      0.783 0.012 0.008 0.972 0.008 0.000
#> SRR1377166     3  0.0981      0.783 0.012 0.008 0.972 0.008 0.000
#> SRR1377167     3  0.0981      0.783 0.012 0.008 0.972 0.008 0.000
#> SRR1377168     3  0.0981      0.783 0.012 0.008 0.972 0.008 0.000
#> SRR1377173     1  0.4113      0.643 0.788 0.048 0.008 0.156 0.000
#> SRR1377174     1  0.4113      0.643 0.788 0.048 0.008 0.156 0.000
#> SRR1377175     1  0.4113      0.643 0.788 0.048 0.008 0.156 0.000
#> SRR1377176     1  0.4113      0.643 0.788 0.048 0.008 0.156 0.000
#> SRR1377177     1  0.4181      0.641 0.784 0.052 0.008 0.156 0.000
#> SRR1377178     1  0.4181      0.641 0.784 0.052 0.008 0.156 0.000
#> SRR1377179     1  0.4181      0.641 0.784 0.052 0.008 0.156 0.000
#> SRR1377180     1  0.4181      0.641 0.784 0.052 0.008 0.156 0.000
#> SRR1377181     1  0.4642      0.625 0.740 0.060 0.008 0.192 0.000
#> SRR1377182     1  0.4642      0.625 0.740 0.060 0.008 0.192 0.000
#> SRR1377183     1  0.4113      0.643 0.788 0.048 0.008 0.156 0.000
#> SRR1377184     1  0.4642      0.625 0.740 0.060 0.008 0.192 0.000
#> SRR1377185     1  0.4113      0.643 0.788 0.048 0.008 0.156 0.000
#> SRR1377186     1  0.4113      0.643 0.788 0.048 0.008 0.156 0.000
#> SRR1377187     1  0.4642      0.625 0.740 0.060 0.008 0.192 0.000
#> SRR1377188     1  0.4113      0.643 0.788 0.048 0.008 0.156 0.000
#> SRR1377189     1  0.2563      0.637 0.872 0.120 0.008 0.000 0.000
#> SRR1377190     1  0.2563      0.637 0.872 0.120 0.008 0.000 0.000
#> SRR1377191     1  0.2563      0.637 0.872 0.120 0.008 0.000 0.000
#> SRR1377192     1  0.2646      0.633 0.868 0.124 0.004 0.004 0.000
#> SRR1377193     1  0.2646      0.633 0.868 0.124 0.004 0.004 0.000
#> SRR1377194     1  0.2646      0.633 0.868 0.124 0.004 0.004 0.000
#> SRR1377195     5  0.0000      0.996 0.000 0.000 0.000 0.000 1.000
#> SRR1377196     5  0.0000      0.996 0.000 0.000 0.000 0.000 1.000
#> SRR1377197     5  0.0000      0.996 0.000 0.000 0.000 0.000 1.000
#> SRR1377198     5  0.0290      0.993 0.000 0.000 0.000 0.008 0.992
#> SRR1377199     5  0.0162      0.995 0.000 0.000 0.000 0.004 0.996
#> SRR1377200     5  0.0771      0.986 0.000 0.020 0.000 0.004 0.976
#> SRR1377201     1  0.2741      0.630 0.860 0.132 0.004 0.004 0.000
#> SRR1377202     1  0.2741      0.630 0.860 0.132 0.004 0.004 0.000
#> SRR1377203     1  0.2741      0.630 0.860 0.132 0.004 0.004 0.000
#> SRR1377204     1  0.6598      0.184 0.444 0.184 0.004 0.368 0.000
#> SRR1377205     1  0.6598      0.184 0.444 0.184 0.004 0.368 0.000
#> SRR1377206     1  0.6598      0.184 0.444 0.184 0.004 0.368 0.000
#> SRR1377207     1  0.2694      0.633 0.864 0.128 0.004 0.004 0.000
#> SRR1377208     1  0.2694      0.633 0.864 0.128 0.004 0.004 0.000
#> SRR1377209     1  0.2694      0.633 0.864 0.128 0.004 0.004 0.000
#> SRR1377210     1  0.2865      0.629 0.856 0.132 0.008 0.004 0.000
#> SRR1377211     1  0.2865      0.629 0.856 0.132 0.008 0.004 0.000
#> SRR1377212     1  0.2865      0.629 0.856 0.132 0.008 0.004 0.000
#> SRR1377213     4  0.8329      1.000 0.252 0.136 0.276 0.336 0.000
#> SRR1377214     4  0.8329      1.000 0.252 0.136 0.276 0.336 0.000
#> SRR1377215     4  0.8329      1.000 0.252 0.136 0.276 0.336 0.000
#> SRR1377216     3  0.5968      0.133 0.032 0.060 0.580 0.328 0.000
#> SRR1377217     3  0.5968      0.133 0.032 0.060 0.580 0.328 0.000
#> SRR1377218     3  0.5968      0.133 0.032 0.060 0.580 0.328 0.000
#> SRR1377219     3  0.7635     -0.510 0.116 0.116 0.432 0.336 0.000
#> SRR1377220     3  0.7635     -0.510 0.116 0.116 0.432 0.336 0.000
#> SRR1377221     3  0.7635     -0.510 0.116 0.116 0.432 0.336 0.000
#> SRR1377222     1  0.6592      0.168 0.432 0.180 0.004 0.384 0.000
#> SRR1377223     1  0.6592      0.168 0.432 0.180 0.004 0.384 0.000
#> SRR1377224     1  0.6592      0.168 0.432 0.180 0.004 0.384 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
#> SRR1377145     6  0.2837      0.935 0.144 0.004 0.004 0.008 0.000 0.840
#> SRR1377146     6  0.2837      0.935 0.144 0.004 0.004 0.008 0.000 0.840
#> SRR1377147     6  0.2837      0.935 0.144 0.004 0.004 0.008 0.000 0.840
#> SRR1377148     6  0.2837      0.935 0.144 0.004 0.004 0.008 0.000 0.840
#> SRR1377153     6  0.4461      0.912 0.152 0.004 0.004 0.108 0.000 0.732
#> SRR1377154     6  0.4461      0.912 0.152 0.004 0.004 0.108 0.000 0.732
#> SRR1377155     6  0.4461      0.912 0.152 0.004 0.004 0.108 0.000 0.732
#> SRR1377156     6  0.4461      0.912 0.152 0.004 0.004 0.108 0.000 0.732
#> SRR1377149     6  0.4335      0.923 0.148 0.040 0.004 0.044 0.000 0.764
#> SRR1377150     6  0.4335      0.923 0.148 0.040 0.004 0.044 0.000 0.764
#> SRR1377151     6  0.4335      0.923 0.148 0.040 0.004 0.044 0.000 0.764
#> SRR1377152     6  0.4335      0.923 0.148 0.040 0.004 0.044 0.000 0.764
#> SRR1377157     3  0.1340      0.903 0.000 0.008 0.948 0.004 0.000 0.040
#> SRR1377158     3  0.1340      0.903 0.000 0.008 0.948 0.004 0.000 0.040
#> SRR1377159     3  0.1340      0.903 0.000 0.008 0.948 0.004 0.000 0.040
#> SRR1377160     3  0.1340      0.903 0.000 0.008 0.948 0.004 0.000 0.040
#> SRR1377161     3  0.0260      0.922 0.000 0.008 0.992 0.000 0.000 0.000
#> SRR1377162     3  0.0260      0.922 0.000 0.008 0.992 0.000 0.000 0.000
#> SRR1377163     3  0.0260      0.922 0.000 0.008 0.992 0.000 0.000 0.000
#> SRR1377164     3  0.0260      0.922 0.000 0.008 0.992 0.000 0.000 0.000
#> SRR1377169     3  0.2685      0.900 0.000 0.068 0.880 0.016 0.000 0.036
#> SRR1377170     3  0.2685      0.900 0.000 0.068 0.880 0.016 0.000 0.036
#> SRR1377171     3  0.2685      0.900 0.000 0.068 0.880 0.016 0.000 0.036
#> SRR1377172     3  0.2685      0.900 0.000 0.068 0.880 0.016 0.000 0.036
#> SRR1377165     3  0.1644      0.923 0.000 0.052 0.932 0.004 0.000 0.012
#> SRR1377166     3  0.1644      0.923 0.000 0.052 0.932 0.004 0.000 0.012
#> SRR1377167     3  0.1644      0.923 0.000 0.052 0.932 0.004 0.000 0.012
#> SRR1377168     3  0.1644      0.923 0.000 0.052 0.932 0.004 0.000 0.012
#> SRR1377173     1  0.0291      0.654 0.992 0.000 0.004 0.000 0.000 0.004
#> SRR1377174     1  0.0291      0.654 0.992 0.000 0.004 0.000 0.000 0.004
#> SRR1377175     1  0.0291      0.654 0.992 0.000 0.004 0.000 0.000 0.004
#> SRR1377176     1  0.0291      0.654 0.992 0.000 0.004 0.000 0.000 0.004
#> SRR1377177     1  0.0436      0.654 0.988 0.000 0.004 0.004 0.000 0.004
#> SRR1377178     1  0.0436      0.654 0.988 0.000 0.004 0.004 0.000 0.004
#> SRR1377179     1  0.0436      0.654 0.988 0.000 0.004 0.004 0.000 0.004
#> SRR1377180     1  0.0436      0.654 0.988 0.000 0.004 0.004 0.000 0.004
#> SRR1377181     1  0.2293      0.602 0.896 0.004 0.004 0.080 0.000 0.016
#> SRR1377182     1  0.2293      0.602 0.896 0.004 0.004 0.080 0.000 0.016
#> SRR1377183     1  0.0551      0.655 0.984 0.000 0.004 0.008 0.000 0.004
#> SRR1377184     1  0.2293      0.602 0.896 0.004 0.004 0.080 0.000 0.016
#> SRR1377185     1  0.0551      0.655 0.984 0.000 0.004 0.008 0.000 0.004
#> SRR1377186     1  0.0551      0.655 0.984 0.000 0.004 0.008 0.000 0.004
#> SRR1377187     1  0.2293      0.602 0.896 0.004 0.004 0.080 0.000 0.016
#> SRR1377188     1  0.0551      0.655 0.984 0.000 0.004 0.008 0.000 0.004
#> SRR1377189     1  0.6816      0.549 0.520 0.212 0.004 0.156 0.000 0.108
#> SRR1377190     1  0.6816      0.549 0.520 0.212 0.004 0.156 0.000 0.108
#> SRR1377191     1  0.6816      0.549 0.520 0.212 0.004 0.156 0.000 0.108
#> SRR1377192     1  0.6827      0.545 0.516 0.220 0.004 0.152 0.000 0.108
#> SRR1377193     1  0.6827      0.545 0.516 0.220 0.004 0.152 0.000 0.108
#> SRR1377194     1  0.6827      0.545 0.516 0.220 0.004 0.152 0.000 0.108
#> SRR1377195     5  0.0000      0.992 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR1377196     5  0.0000      0.992 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR1377197     5  0.0000      0.992 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR1377198     5  0.0551      0.988 0.000 0.004 0.000 0.008 0.984 0.004
#> SRR1377199     5  0.0806      0.982 0.000 0.000 0.000 0.020 0.972 0.008
#> SRR1377200     5  0.0665      0.985 0.000 0.008 0.000 0.004 0.980 0.008
#> SRR1377201     1  0.6715      0.556 0.524 0.236 0.004 0.136 0.000 0.100
#> SRR1377202     1  0.6715      0.556 0.524 0.236 0.004 0.136 0.000 0.100
#> SRR1377203     1  0.6715      0.556 0.524 0.236 0.004 0.136 0.000 0.100
#> SRR1377204     2  0.2723      0.958 0.128 0.852 0.004 0.000 0.000 0.016
#> SRR1377205     2  0.2723      0.958 0.128 0.852 0.004 0.000 0.000 0.016
#> SRR1377206     2  0.2723      0.958 0.128 0.852 0.004 0.000 0.000 0.016
#> SRR1377207     1  0.6715      0.556 0.524 0.236 0.004 0.136 0.000 0.100
#> SRR1377208     1  0.6715      0.556 0.524 0.236 0.004 0.136 0.000 0.100
#> SRR1377209     1  0.6715      0.556 0.524 0.236 0.004 0.136 0.000 0.100
#> SRR1377210     1  0.6726      0.561 0.528 0.224 0.004 0.140 0.000 0.104
#> SRR1377211     1  0.6726      0.561 0.528 0.224 0.004 0.140 0.000 0.104
#> SRR1377212     1  0.6726      0.561 0.528 0.224 0.004 0.140 0.000 0.104
#> SRR1377213     4  0.6505      0.734 0.080 0.072 0.168 0.616 0.000 0.064
#> SRR1377214     4  0.6505      0.734 0.080 0.072 0.168 0.616 0.000 0.064
#> SRR1377215     4  0.6505      0.734 0.080 0.072 0.168 0.616 0.000 0.064
#> SRR1377216     4  0.5052      0.634 0.008 0.004 0.444 0.500 0.000 0.044
#> SRR1377217     4  0.5052      0.634 0.008 0.004 0.444 0.500 0.000 0.044
#> SRR1377218     4  0.5052      0.634 0.008 0.004 0.444 0.500 0.000 0.044
#> SRR1377219     4  0.6032      0.806 0.028 0.044 0.288 0.580 0.000 0.060
#> SRR1377220     4  0.6032      0.806 0.028 0.044 0.288 0.580 0.000 0.060
#> SRR1377221     4  0.6032      0.806 0.028 0.044 0.288 0.580 0.000 0.060
#> SRR1377222     2  0.4130      0.958 0.128 0.780 0.004 0.068 0.000 0.020
#> SRR1377223     2  0.4130      0.958 0.128 0.780 0.004 0.068 0.000 0.020
#> SRR1377224     2  0.4130      0.958 0.128 0.780 0.004 0.068 0.000 0.020

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

consensus_heatmap(res, k = 2)

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

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

collect_plots(res)

plot of chunk ATC-skmeans-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.875           0.933       0.964         0.3563 0.608   0.608
#> 3 3 0.634           0.791       0.835         0.5578 0.848   0.757
#> 4 4 0.905           0.951       0.959         0.2674 0.813   0.618
#> 5 5 0.863           0.950       0.910         0.0954 0.905   0.687
#> 6 6 0.848           0.880       0.861         0.0499 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] 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
#> SRR1377145     2   0.000      0.996 0.000 1.000
#> SRR1377146     2   0.000      0.996 0.000 1.000
#> SRR1377147     2   0.000      0.996 0.000 1.000
#> SRR1377148     2   0.000      0.996 0.000 1.000
#> SRR1377153     2   0.000      0.996 0.000 1.000
#> SRR1377154     2   0.000      0.996 0.000 1.000
#> SRR1377155     2   0.000      0.996 0.000 1.000
#> SRR1377156     2   0.000      0.996 0.000 1.000
#> SRR1377149     2   0.000      0.996 0.000 1.000
#> SRR1377150     2   0.000      0.996 0.000 1.000
#> SRR1377151     2   0.000      0.996 0.000 1.000
#> SRR1377152     2   0.000      0.996 0.000 1.000
#> SRR1377157     2   0.000      0.996 0.000 1.000
#> SRR1377158     2   0.000      0.996 0.000 1.000
#> SRR1377159     2   0.000      0.996 0.000 1.000
#> SRR1377160     2   0.000      0.996 0.000 1.000
#> SRR1377161     2   0.000      0.996 0.000 1.000
#> SRR1377162     2   0.000      0.996 0.000 1.000
#> SRR1377163     2   0.000      0.996 0.000 1.000
#> SRR1377164     2   0.000      0.996 0.000 1.000
#> SRR1377169     2   0.000      0.996 0.000 1.000
#> SRR1377170     2   0.000      0.996 0.000 1.000
#> SRR1377171     2   0.000      0.996 0.000 1.000
#> SRR1377172     2   0.000      0.996 0.000 1.000
#> SRR1377165     2   0.000      0.996 0.000 1.000
#> SRR1377166     2   0.000      0.996 0.000 1.000
#> SRR1377167     2   0.000      0.996 0.000 1.000
#> SRR1377168     2   0.000      0.996 0.000 1.000
#> SRR1377173     2   0.000      0.996 0.000 1.000
#> SRR1377174     2   0.000      0.996 0.000 1.000
#> SRR1377175     2   0.000      0.996 0.000 1.000
#> SRR1377176     2   0.000      0.996 0.000 1.000
#> SRR1377177     2   0.000      0.996 0.000 1.000
#> SRR1377178     2   0.000      0.996 0.000 1.000
#> SRR1377179     2   0.000      0.996 0.000 1.000
#> SRR1377180     2   0.000      0.996 0.000 1.000
#> SRR1377181     2   0.000      0.996 0.000 1.000
#> SRR1377182     2   0.000      0.996 0.000 1.000
#> SRR1377183     2   0.000      0.996 0.000 1.000
#> SRR1377184     2   0.000      0.996 0.000 1.000
#> SRR1377185     2   0.000      0.996 0.000 1.000
#> SRR1377186     2   0.000      0.996 0.000 1.000
#> SRR1377187     2   0.000      0.996 0.000 1.000
#> SRR1377188     2   0.000      0.996 0.000 1.000
#> SRR1377189     2   0.343      0.921 0.064 0.936
#> SRR1377190     2   0.343      0.921 0.064 0.936
#> SRR1377191     2   0.343      0.921 0.064 0.936
#> SRR1377192     1   0.775      0.770 0.772 0.228
#> SRR1377193     1   0.767      0.775 0.776 0.224
#> SRR1377194     1   0.760      0.778 0.780 0.220
#> SRR1377195     1   0.000      0.861 1.000 0.000
#> SRR1377196     1   0.000      0.861 1.000 0.000
#> SRR1377197     1   0.000      0.861 1.000 0.000
#> SRR1377198     1   0.000      0.861 1.000 0.000
#> SRR1377199     1   0.000      0.861 1.000 0.000
#> SRR1377200     1   0.000      0.861 1.000 0.000
#> SRR1377201     1   0.994      0.378 0.544 0.456
#> SRR1377202     1   0.994      0.378 0.544 0.456
#> SRR1377203     1   0.994      0.378 0.544 0.456
#> SRR1377204     1   0.000      0.861 1.000 0.000
#> SRR1377205     1   0.000      0.861 1.000 0.000
#> SRR1377206     1   0.000      0.861 1.000 0.000
#> SRR1377207     1   0.753      0.782 0.784 0.216
#> SRR1377208     1   0.753      0.782 0.784 0.216
#> SRR1377209     1   0.753      0.782 0.784 0.216
#> SRR1377210     2   0.000      0.996 0.000 1.000
#> SRR1377211     2   0.000      0.996 0.000 1.000
#> SRR1377212     2   0.000      0.996 0.000 1.000
#> SRR1377213     2   0.000      0.996 0.000 1.000
#> SRR1377214     2   0.000      0.996 0.000 1.000
#> SRR1377215     2   0.000      0.996 0.000 1.000
#> SRR1377216     2   0.000      0.996 0.000 1.000
#> SRR1377217     2   0.000      0.996 0.000 1.000
#> SRR1377218     2   0.000      0.996 0.000 1.000
#> SRR1377219     2   0.000      0.996 0.000 1.000
#> SRR1377220     2   0.000      0.996 0.000 1.000
#> SRR1377221     2   0.000      0.996 0.000 1.000
#> SRR1377222     1   0.000      0.861 1.000 0.000
#> SRR1377223     1   0.000      0.861 1.000 0.000
#> SRR1377224     1   0.000      0.861 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
#> SRR1377145     2  0.3183      0.800 0.016 0.908 0.076
#> SRR1377146     2  0.3183      0.800 0.016 0.908 0.076
#> SRR1377147     2  0.3183      0.800 0.016 0.908 0.076
#> SRR1377148     2  0.3183      0.800 0.016 0.908 0.076
#> SRR1377153     2  0.3670      0.786 0.020 0.888 0.092
#> SRR1377154     2  0.3587      0.790 0.020 0.892 0.088
#> SRR1377155     2  0.3670      0.786 0.020 0.888 0.092
#> SRR1377156     2  0.3670      0.786 0.020 0.888 0.092
#> SRR1377149     2  0.3325      0.800 0.020 0.904 0.076
#> SRR1377150     2  0.3325      0.800 0.020 0.904 0.076
#> SRR1377151     2  0.3325      0.800 0.020 0.904 0.076
#> SRR1377152     2  0.3325      0.800 0.020 0.904 0.076
#> SRR1377157     2  0.0000      0.841 0.000 1.000 0.000
#> SRR1377158     2  0.0000      0.841 0.000 1.000 0.000
#> SRR1377159     2  0.0000      0.841 0.000 1.000 0.000
#> SRR1377160     2  0.0000      0.841 0.000 1.000 0.000
#> SRR1377161     2  0.0000      0.841 0.000 1.000 0.000
#> SRR1377162     2  0.0000      0.841 0.000 1.000 0.000
#> SRR1377163     2  0.0000      0.841 0.000 1.000 0.000
#> SRR1377164     2  0.0000      0.841 0.000 1.000 0.000
#> SRR1377169     2  0.0000      0.841 0.000 1.000 0.000
#> SRR1377170     2  0.0000      0.841 0.000 1.000 0.000
#> SRR1377171     2  0.0000      0.841 0.000 1.000 0.000
#> SRR1377172     2  0.0000      0.841 0.000 1.000 0.000
#> SRR1377165     2  0.0000      0.841 0.000 1.000 0.000
#> SRR1377166     2  0.0000      0.841 0.000 1.000 0.000
#> SRR1377167     2  0.0000      0.841 0.000 1.000 0.000
#> SRR1377168     2  0.0000      0.841 0.000 1.000 0.000
#> SRR1377173     2  0.6818      0.662 0.348 0.628 0.024
#> SRR1377174     2  0.6818      0.662 0.348 0.628 0.024
#> SRR1377175     2  0.6818      0.662 0.348 0.628 0.024
#> SRR1377176     2  0.6818      0.662 0.348 0.628 0.024
#> SRR1377177     2  0.6696      0.666 0.348 0.632 0.020
#> SRR1377178     2  0.6696      0.666 0.348 0.632 0.020
#> SRR1377179     2  0.6696      0.666 0.348 0.632 0.020
#> SRR1377180     2  0.6696      0.666 0.348 0.632 0.020
#> SRR1377181     2  0.6497      0.677 0.336 0.648 0.016
#> SRR1377182     2  0.6497      0.677 0.336 0.648 0.016
#> SRR1377183     2  0.6357      0.680 0.336 0.652 0.012
#> SRR1377184     2  0.6497      0.677 0.336 0.648 0.016
#> SRR1377185     2  0.6357      0.680 0.336 0.652 0.012
#> SRR1377186     2  0.6357      0.680 0.336 0.652 0.012
#> SRR1377187     2  0.6497      0.677 0.336 0.648 0.016
#> SRR1377188     2  0.6357      0.680 0.336 0.652 0.012
#> SRR1377189     3  0.5810      0.674 0.000 0.336 0.664
#> SRR1377190     3  0.5810      0.674 0.000 0.336 0.664
#> SRR1377191     3  0.5810      0.674 0.000 0.336 0.664
#> SRR1377192     3  0.0983      0.666 0.004 0.016 0.980
#> SRR1377193     3  0.0829      0.661 0.004 0.012 0.984
#> SRR1377194     3  0.0829      0.661 0.004 0.012 0.984
#> SRR1377195     1  0.5785      0.987 0.668 0.000 0.332
#> SRR1377196     1  0.5785      0.987 0.668 0.000 0.332
#> SRR1377197     1  0.5785      0.987 0.668 0.000 0.332
#> SRR1377198     1  0.5785      0.987 0.668 0.000 0.332
#> SRR1377199     1  0.5785      0.987 0.668 0.000 0.332
#> SRR1377200     1  0.5785      0.987 0.668 0.000 0.332
#> SRR1377201     3  0.1753      0.693 0.000 0.048 0.952
#> SRR1377202     3  0.1753      0.693 0.000 0.048 0.952
#> SRR1377203     3  0.1753      0.693 0.000 0.048 0.952
#> SRR1377204     1  0.5882      0.987 0.652 0.000 0.348
#> SRR1377205     1  0.5882      0.987 0.652 0.000 0.348
#> SRR1377206     1  0.5882      0.987 0.652 0.000 0.348
#> SRR1377207     3  0.0424      0.660 0.000 0.008 0.992
#> SRR1377208     3  0.0424      0.660 0.000 0.008 0.992
#> SRR1377209     3  0.0424      0.660 0.000 0.008 0.992
#> SRR1377210     3  0.5810      0.674 0.000 0.336 0.664
#> SRR1377211     3  0.5810      0.674 0.000 0.336 0.664
#> SRR1377212     3  0.5810      0.674 0.000 0.336 0.664
#> SRR1377213     2  0.0424      0.839 0.000 0.992 0.008
#> SRR1377214     2  0.0424      0.839 0.000 0.992 0.008
#> SRR1377215     2  0.0424      0.839 0.000 0.992 0.008
#> SRR1377216     2  0.0000      0.841 0.000 1.000 0.000
#> SRR1377217     2  0.0000      0.841 0.000 1.000 0.000
#> SRR1377218     2  0.0000      0.841 0.000 1.000 0.000
#> SRR1377219     2  0.0424      0.839 0.000 0.992 0.008
#> SRR1377220     2  0.0424      0.839 0.000 0.992 0.008
#> SRR1377221     2  0.0424      0.839 0.000 0.992 0.008
#> SRR1377222     1  0.5882      0.987 0.652 0.000 0.348
#> SRR1377223     1  0.5882      0.987 0.652 0.000 0.348
#> SRR1377224     1  0.5882      0.987 0.652 0.000 0.348

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> SRR1377145     3  0.4483      0.841 0.000 0.088 0.808 0.104
#> SRR1377146     3  0.4483      0.841 0.000 0.088 0.808 0.104
#> SRR1377147     3  0.4483      0.841 0.000 0.088 0.808 0.104
#> SRR1377148     3  0.4483      0.841 0.000 0.088 0.808 0.104
#> SRR1377153     3  0.4599      0.834 0.000 0.088 0.800 0.112
#> SRR1377154     3  0.4599      0.834 0.000 0.088 0.800 0.112
#> SRR1377155     3  0.4599      0.834 0.000 0.088 0.800 0.112
#> SRR1377156     3  0.4599      0.834 0.000 0.088 0.800 0.112
#> SRR1377149     3  0.4419      0.842 0.000 0.084 0.812 0.104
#> SRR1377150     3  0.4483      0.841 0.000 0.088 0.808 0.104
#> SRR1377151     3  0.4483      0.841 0.000 0.088 0.808 0.104
#> SRR1377152     3  0.4483      0.841 0.000 0.088 0.808 0.104
#> SRR1377157     3  0.1022      0.928 0.000 0.032 0.968 0.000
#> SRR1377158     3  0.1022      0.928 0.000 0.032 0.968 0.000
#> SRR1377159     3  0.1022      0.928 0.000 0.032 0.968 0.000
#> SRR1377160     3  0.1022      0.928 0.000 0.032 0.968 0.000
#> SRR1377161     3  0.1022      0.928 0.000 0.032 0.968 0.000
#> SRR1377162     3  0.1022      0.928 0.000 0.032 0.968 0.000
#> SRR1377163     3  0.1022      0.928 0.000 0.032 0.968 0.000
#> SRR1377164     3  0.1022      0.928 0.000 0.032 0.968 0.000
#> SRR1377169     3  0.1022      0.928 0.000 0.032 0.968 0.000
#> SRR1377170     3  0.1022      0.928 0.000 0.032 0.968 0.000
#> SRR1377171     3  0.1022      0.928 0.000 0.032 0.968 0.000
#> SRR1377172     3  0.1022      0.928 0.000 0.032 0.968 0.000
#> SRR1377165     3  0.1022      0.928 0.000 0.032 0.968 0.000
#> SRR1377166     3  0.1022      0.928 0.000 0.032 0.968 0.000
#> SRR1377167     3  0.1022      0.928 0.000 0.032 0.968 0.000
#> SRR1377168     3  0.1022      0.928 0.000 0.032 0.968 0.000
#> SRR1377173     2  0.0188      0.997 0.000 0.996 0.004 0.000
#> SRR1377174     2  0.0188      0.997 0.000 0.996 0.004 0.000
#> SRR1377175     2  0.0188      0.997 0.000 0.996 0.004 0.000
#> SRR1377176     2  0.0188      0.997 0.000 0.996 0.004 0.000
#> SRR1377177     2  0.0188      0.997 0.000 0.996 0.004 0.000
#> SRR1377178     2  0.0188      0.997 0.000 0.996 0.004 0.000
#> SRR1377179     2  0.0188      0.997 0.000 0.996 0.004 0.000
#> SRR1377180     2  0.0188      0.997 0.000 0.996 0.004 0.000
#> SRR1377181     2  0.0336      0.996 0.000 0.992 0.008 0.000
#> SRR1377182     2  0.0336      0.996 0.000 0.992 0.008 0.000
#> SRR1377183     2  0.0188      0.995 0.000 0.996 0.004 0.000
#> SRR1377184     2  0.0336      0.996 0.000 0.992 0.008 0.000
#> SRR1377185     2  0.0188      0.995 0.000 0.996 0.004 0.000
#> SRR1377186     2  0.0188      0.995 0.000 0.996 0.004 0.000
#> SRR1377187     2  0.0336      0.996 0.000 0.992 0.008 0.000
#> SRR1377188     2  0.0188      0.995 0.000 0.996 0.004 0.000
#> SRR1377189     4  0.0000      0.995 0.000 0.000 0.000 1.000
#> SRR1377190     4  0.0000      0.995 0.000 0.000 0.000 1.000
#> SRR1377191     4  0.0000      0.995 0.000 0.000 0.000 1.000
#> SRR1377192     4  0.0000      0.995 0.000 0.000 0.000 1.000
#> SRR1377193     4  0.0000      0.995 0.000 0.000 0.000 1.000
#> SRR1377194     4  0.0000      0.995 0.000 0.000 0.000 1.000
#> SRR1377195     1  0.0000      0.998 1.000 0.000 0.000 0.000
#> SRR1377196     1  0.0000      0.998 1.000 0.000 0.000 0.000
#> SRR1377197     1  0.0000      0.998 1.000 0.000 0.000 0.000
#> SRR1377198     1  0.0000      0.998 1.000 0.000 0.000 0.000
#> SRR1377199     1  0.0000      0.998 1.000 0.000 0.000 0.000
#> SRR1377200     1  0.0000      0.998 1.000 0.000 0.000 0.000
#> SRR1377201     4  0.0376      0.994 0.004 0.004 0.000 0.992
#> SRR1377202     4  0.0376      0.994 0.004 0.004 0.000 0.992
#> SRR1377203     4  0.0376      0.994 0.004 0.004 0.000 0.992
#> SRR1377204     1  0.0188      0.998 0.996 0.000 0.000 0.004
#> SRR1377205     1  0.0188      0.998 0.996 0.000 0.000 0.004
#> SRR1377206     1  0.0188      0.998 0.996 0.000 0.000 0.004
#> SRR1377207     4  0.0376      0.994 0.004 0.004 0.000 0.992
#> SRR1377208     4  0.0376      0.994 0.004 0.004 0.000 0.992
#> SRR1377209     4  0.0376      0.994 0.004 0.004 0.000 0.992
#> SRR1377210     4  0.0376      0.993 0.000 0.004 0.004 0.992
#> SRR1377211     4  0.0376      0.993 0.000 0.004 0.004 0.992
#> SRR1377212     4  0.0376      0.993 0.000 0.004 0.004 0.992
#> SRR1377213     3  0.1109      0.926 0.000 0.028 0.968 0.004
#> SRR1377214     3  0.1109      0.926 0.000 0.028 0.968 0.004
#> SRR1377215     3  0.1109      0.926 0.000 0.028 0.968 0.004
#> SRR1377216     3  0.1109      0.926 0.000 0.028 0.968 0.004
#> SRR1377217     3  0.1109      0.926 0.000 0.028 0.968 0.004
#> SRR1377218     3  0.1109      0.926 0.000 0.028 0.968 0.004
#> SRR1377219     3  0.1109      0.926 0.000 0.028 0.968 0.004
#> SRR1377220     3  0.1109      0.926 0.000 0.028 0.968 0.004
#> SRR1377221     3  0.1109      0.926 0.000 0.028 0.968 0.004
#> SRR1377222     1  0.0188      0.998 0.996 0.000 0.000 0.004
#> SRR1377223     1  0.0188      0.998 0.996 0.000 0.000 0.004
#> SRR1377224     1  0.0188      0.998 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
#> SRR1377145     4  0.4553      0.993 0.004 0.016 0.328 0.652 0.000
#> SRR1377146     4  0.4553      0.993 0.004 0.016 0.328 0.652 0.000
#> SRR1377147     4  0.4553      0.993 0.004 0.016 0.328 0.652 0.000
#> SRR1377148     4  0.4553      0.993 0.004 0.016 0.328 0.652 0.000
#> SRR1377153     4  0.4589      0.987 0.004 0.020 0.316 0.660 0.000
#> SRR1377154     4  0.4589      0.987 0.004 0.020 0.316 0.660 0.000
#> SRR1377155     4  0.4589      0.987 0.004 0.020 0.316 0.660 0.000
#> SRR1377156     4  0.4589      0.987 0.004 0.020 0.316 0.660 0.000
#> SRR1377149     4  0.4553      0.993 0.004 0.016 0.328 0.652 0.000
#> SRR1377150     4  0.4553      0.993 0.004 0.016 0.328 0.652 0.000
#> SRR1377151     4  0.4536      0.991 0.004 0.016 0.324 0.656 0.000
#> SRR1377152     4  0.4553      0.993 0.004 0.016 0.328 0.652 0.000
#> SRR1377157     3  0.0000      0.946 0.000 0.000 1.000 0.000 0.000
#> SRR1377158     3  0.0000      0.946 0.000 0.000 1.000 0.000 0.000
#> SRR1377159     3  0.0000      0.946 0.000 0.000 1.000 0.000 0.000
#> SRR1377160     3  0.0000      0.946 0.000 0.000 1.000 0.000 0.000
#> SRR1377161     3  0.0000      0.946 0.000 0.000 1.000 0.000 0.000
#> SRR1377162     3  0.0000      0.946 0.000 0.000 1.000 0.000 0.000
#> SRR1377163     3  0.0000      0.946 0.000 0.000 1.000 0.000 0.000
#> SRR1377164     3  0.0000      0.946 0.000 0.000 1.000 0.000 0.000
#> SRR1377169     3  0.0000      0.946 0.000 0.000 1.000 0.000 0.000
#> SRR1377170     3  0.0000      0.946 0.000 0.000 1.000 0.000 0.000
#> SRR1377171     3  0.0000      0.946 0.000 0.000 1.000 0.000 0.000
#> SRR1377172     3  0.0000      0.946 0.000 0.000 1.000 0.000 0.000
#> SRR1377165     3  0.0000      0.946 0.000 0.000 1.000 0.000 0.000
#> SRR1377166     3  0.0000      0.946 0.000 0.000 1.000 0.000 0.000
#> SRR1377167     3  0.0000      0.946 0.000 0.000 1.000 0.000 0.000
#> SRR1377168     3  0.0000      0.946 0.000 0.000 1.000 0.000 0.000
#> SRR1377173     1  0.0162      0.985 0.996 0.000 0.004 0.000 0.000
#> SRR1377174     1  0.0162      0.985 0.996 0.000 0.004 0.000 0.000
#> SRR1377175     1  0.0162      0.985 0.996 0.000 0.004 0.000 0.000
#> SRR1377176     1  0.0162      0.985 0.996 0.000 0.004 0.000 0.000
#> SRR1377177     1  0.0162      0.985 0.996 0.000 0.004 0.000 0.000
#> SRR1377178     1  0.0162      0.985 0.996 0.000 0.004 0.000 0.000
#> SRR1377179     1  0.0162      0.985 0.996 0.000 0.004 0.000 0.000
#> SRR1377180     1  0.0162      0.985 0.996 0.000 0.004 0.000 0.000
#> SRR1377181     1  0.0955      0.983 0.968 0.000 0.004 0.028 0.000
#> SRR1377182     1  0.0955      0.983 0.968 0.000 0.004 0.028 0.000
#> SRR1377183     1  0.1121      0.976 0.956 0.000 0.000 0.044 0.000
#> SRR1377184     1  0.0955      0.983 0.968 0.000 0.004 0.028 0.000
#> SRR1377185     1  0.1121      0.976 0.956 0.000 0.000 0.044 0.000
#> SRR1377186     1  0.1121      0.976 0.956 0.000 0.000 0.044 0.000
#> SRR1377187     1  0.0955      0.983 0.968 0.000 0.004 0.028 0.000
#> SRR1377188     1  0.1121      0.976 0.956 0.000 0.000 0.044 0.000
#> SRR1377189     2  0.1965      0.932 0.000 0.904 0.000 0.096 0.000
#> SRR1377190     2  0.1965      0.932 0.000 0.904 0.000 0.096 0.000
#> SRR1377191     2  0.1965      0.932 0.000 0.904 0.000 0.096 0.000
#> SRR1377192     2  0.2740      0.919 0.000 0.876 0.000 0.096 0.028
#> SRR1377193     2  0.2740      0.919 0.000 0.876 0.000 0.096 0.028
#> SRR1377194     2  0.2740      0.919 0.000 0.876 0.000 0.096 0.028
#> SRR1377195     5  0.2813      0.925 0.000 0.000 0.000 0.168 0.832
#> SRR1377196     5  0.2813      0.925 0.000 0.000 0.000 0.168 0.832
#> SRR1377197     5  0.2813      0.925 0.000 0.000 0.000 0.168 0.832
#> SRR1377198     5  0.2813      0.925 0.000 0.000 0.000 0.168 0.832
#> SRR1377199     5  0.2813      0.925 0.000 0.000 0.000 0.168 0.832
#> SRR1377200     5  0.2813      0.925 0.000 0.000 0.000 0.168 0.832
#> SRR1377201     2  0.0609      0.956 0.000 0.980 0.000 0.020 0.000
#> SRR1377202     2  0.0609      0.956 0.000 0.980 0.000 0.020 0.000
#> SRR1377203     2  0.0609      0.956 0.000 0.980 0.000 0.020 0.000
#> SRR1377204     5  0.0609      0.924 0.000 0.020 0.000 0.000 0.980
#> SRR1377205     5  0.0609      0.924 0.000 0.020 0.000 0.000 0.980
#> SRR1377206     5  0.0609      0.924 0.000 0.020 0.000 0.000 0.980
#> SRR1377207     2  0.0609      0.956 0.000 0.980 0.000 0.020 0.000
#> SRR1377208     2  0.0609      0.956 0.000 0.980 0.000 0.020 0.000
#> SRR1377209     2  0.0609      0.956 0.000 0.980 0.000 0.020 0.000
#> SRR1377210     2  0.0609      0.956 0.000 0.980 0.000 0.020 0.000
#> SRR1377211     2  0.0609      0.956 0.000 0.980 0.000 0.020 0.000
#> SRR1377212     2  0.0609      0.956 0.000 0.980 0.000 0.020 0.000
#> SRR1377213     3  0.2942      0.879 0.004 0.004 0.864 0.116 0.012
#> SRR1377214     3  0.2942      0.879 0.004 0.004 0.864 0.116 0.012
#> SRR1377215     3  0.2942      0.879 0.004 0.004 0.864 0.116 0.012
#> SRR1377216     3  0.2011      0.907 0.000 0.004 0.908 0.088 0.000
#> SRR1377217     3  0.2011      0.907 0.000 0.004 0.908 0.088 0.000
#> SRR1377218     3  0.2011      0.907 0.000 0.004 0.908 0.088 0.000
#> SRR1377219     3  0.2548      0.889 0.004 0.004 0.876 0.116 0.000
#> SRR1377220     3  0.2548      0.889 0.004 0.004 0.876 0.116 0.000
#> SRR1377221     3  0.2548      0.889 0.004 0.004 0.876 0.116 0.000
#> SRR1377222     5  0.0609      0.924 0.000 0.020 0.000 0.000 0.980
#> SRR1377223     5  0.0609      0.924 0.000 0.020 0.000 0.000 0.980
#> SRR1377224     5  0.0609      0.924 0.000 0.020 0.000 0.000 0.980

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>            class entropy silhouette    p1    p2    p3 p4    p5    p6
#> SRR1377145     6  0.1588      0.999 0.004 0.000 0.072 NA 0.000 0.924
#> SRR1377146     6  0.1588      0.999 0.004 0.000 0.072 NA 0.000 0.924
#> SRR1377147     6  0.1588      0.999 0.004 0.000 0.072 NA 0.000 0.924
#> SRR1377148     6  0.1588      0.999 0.004 0.000 0.072 NA 0.000 0.924
#> SRR1377153     6  0.1732      0.998 0.004 0.000 0.072 NA 0.000 0.920
#> SRR1377154     6  0.1732      0.998 0.004 0.000 0.072 NA 0.000 0.920
#> SRR1377155     6  0.1732      0.998 0.004 0.000 0.072 NA 0.000 0.920
#> SRR1377156     6  0.1732      0.998 0.004 0.000 0.072 NA 0.000 0.920
#> SRR1377149     6  0.1588      0.999 0.004 0.000 0.072 NA 0.000 0.924
#> SRR1377150     6  0.1588      0.999 0.004 0.000 0.072 NA 0.000 0.924
#> SRR1377151     6  0.1732      0.998 0.004 0.000 0.072 NA 0.000 0.920
#> SRR1377152     6  0.1588      0.999 0.004 0.000 0.072 NA 0.000 0.924
#> SRR1377157     3  0.0937      0.889 0.000 0.000 0.960 NA 0.000 0.040
#> SRR1377158     3  0.0937      0.889 0.000 0.000 0.960 NA 0.000 0.040
#> SRR1377159     3  0.0937      0.889 0.000 0.000 0.960 NA 0.000 0.040
#> SRR1377160     3  0.0937      0.889 0.000 0.000 0.960 NA 0.000 0.040
#> SRR1377161     3  0.0937      0.889 0.000 0.000 0.960 NA 0.000 0.040
#> SRR1377162     3  0.0937      0.889 0.000 0.000 0.960 NA 0.000 0.040
#> SRR1377163     3  0.0937      0.889 0.000 0.000 0.960 NA 0.000 0.040
#> SRR1377164     3  0.0937      0.889 0.000 0.000 0.960 NA 0.000 0.040
#> SRR1377169     3  0.0937      0.889 0.000 0.000 0.960 NA 0.000 0.040
#> SRR1377170     3  0.0937      0.889 0.000 0.000 0.960 NA 0.000 0.040
#> SRR1377171     3  0.0937      0.889 0.000 0.000 0.960 NA 0.000 0.040
#> SRR1377172     3  0.0937      0.889 0.000 0.000 0.960 NA 0.000 0.040
#> SRR1377165     3  0.0937      0.889 0.000 0.000 0.960 NA 0.000 0.040
#> SRR1377166     3  0.0937      0.889 0.000 0.000 0.960 NA 0.000 0.040
#> SRR1377167     3  0.0937      0.889 0.000 0.000 0.960 NA 0.000 0.040
#> SRR1377168     3  0.0937      0.889 0.000 0.000 0.960 NA 0.000 0.040
#> SRR1377173     1  0.0146      0.971 0.996 0.000 0.000 NA 0.000 0.000
#> SRR1377174     1  0.0146      0.971 0.996 0.000 0.000 NA 0.000 0.000
#> SRR1377175     1  0.0146      0.971 0.996 0.000 0.000 NA 0.000 0.000
#> SRR1377176     1  0.0146      0.971 0.996 0.000 0.000 NA 0.000 0.000
#> SRR1377177     1  0.0146      0.971 0.996 0.000 0.000 NA 0.000 0.000
#> SRR1377178     1  0.0146      0.971 0.996 0.000 0.000 NA 0.000 0.000
#> SRR1377179     1  0.0146      0.971 0.996 0.000 0.000 NA 0.000 0.000
#> SRR1377180     1  0.0146      0.971 0.996 0.000 0.000 NA 0.000 0.000
#> SRR1377181     1  0.0858      0.968 0.968 0.000 0.000 NA 0.000 0.004
#> SRR1377182     1  0.0777      0.968 0.972 0.000 0.000 NA 0.000 0.004
#> SRR1377183     1  0.2112      0.936 0.896 0.000 0.000 NA 0.000 0.016
#> SRR1377184     1  0.0777      0.968 0.972 0.000 0.000 NA 0.000 0.004
#> SRR1377185     1  0.2112      0.936 0.896 0.000 0.000 NA 0.000 0.016
#> SRR1377186     1  0.2199      0.934 0.892 0.000 0.000 NA 0.000 0.020
#> SRR1377187     1  0.0777      0.968 0.972 0.000 0.000 NA 0.000 0.004
#> SRR1377188     1  0.2199      0.934 0.892 0.000 0.000 NA 0.000 0.020
#> SRR1377189     2  0.4545      0.787 0.000 0.688 0.000 NA 0.008 0.064
#> SRR1377190     2  0.4545      0.787 0.000 0.688 0.000 NA 0.008 0.064
#> SRR1377191     2  0.4545      0.787 0.000 0.688 0.000 NA 0.008 0.064
#> SRR1377192     2  0.5900      0.731 0.000 0.596 0.000 NA 0.100 0.064
#> SRR1377193     2  0.5939      0.728 0.000 0.592 0.000 NA 0.104 0.064
#> SRR1377194     2  0.6015      0.720 0.000 0.584 0.000 NA 0.112 0.064
#> SRR1377195     5  0.3833      0.798 0.000 0.000 0.000 NA 0.556 0.000
#> SRR1377196     5  0.3833      0.798 0.000 0.000 0.000 NA 0.556 0.000
#> SRR1377197     5  0.3833      0.798 0.000 0.000 0.000 NA 0.556 0.000
#> SRR1377198     5  0.3833      0.798 0.000 0.000 0.000 NA 0.556 0.000
#> SRR1377199     5  0.3833      0.798 0.000 0.000 0.000 NA 0.556 0.000
#> SRR1377200     5  0.3833      0.798 0.000 0.000 0.000 NA 0.556 0.000
#> SRR1377201     2  0.0000      0.867 0.000 1.000 0.000 NA 0.000 0.000
#> SRR1377202     2  0.0000      0.867 0.000 1.000 0.000 NA 0.000 0.000
#> SRR1377203     2  0.0000      0.867 0.000 1.000 0.000 NA 0.000 0.000
#> SRR1377204     5  0.0000      0.790 0.000 0.000 0.000 NA 1.000 0.000
#> SRR1377205     5  0.0000      0.790 0.000 0.000 0.000 NA 1.000 0.000
#> SRR1377206     5  0.0000      0.790 0.000 0.000 0.000 NA 1.000 0.000
#> SRR1377207     2  0.0000      0.867 0.000 1.000 0.000 NA 0.000 0.000
#> SRR1377208     2  0.0000      0.867 0.000 1.000 0.000 NA 0.000 0.000
#> SRR1377209     2  0.0000      0.867 0.000 1.000 0.000 NA 0.000 0.000
#> SRR1377210     2  0.0000      0.867 0.000 1.000 0.000 NA 0.000 0.000
#> SRR1377211     2  0.0000      0.867 0.000 1.000 0.000 NA 0.000 0.000
#> SRR1377212     2  0.0000      0.867 0.000 1.000 0.000 NA 0.000 0.000
#> SRR1377213     3  0.4108      0.761 0.000 0.000 0.704 NA 0.008 0.028
#> SRR1377214     3  0.4108      0.761 0.000 0.000 0.704 NA 0.008 0.028
#> SRR1377215     3  0.4108      0.761 0.000 0.000 0.704 NA 0.008 0.028
#> SRR1377216     3  0.3261      0.800 0.000 0.000 0.780 NA 0.000 0.016
#> SRR1377217     3  0.3261      0.800 0.000 0.000 0.780 NA 0.000 0.016
#> SRR1377218     3  0.3261      0.800 0.000 0.000 0.780 NA 0.000 0.016
#> SRR1377219     3  0.3789      0.768 0.000 0.000 0.716 NA 0.000 0.024
#> SRR1377220     3  0.3789      0.768 0.000 0.000 0.716 NA 0.000 0.024
#> SRR1377221     3  0.3789      0.768 0.000 0.000 0.716 NA 0.000 0.024
#> SRR1377222     5  0.0713      0.781 0.000 0.000 0.000 NA 0.972 0.000
#> SRR1377223     5  0.0713      0.781 0.000 0.000 0.000 NA 0.972 0.000
#> SRR1377224     5  0.0713      0.781 0.000 0.000 0.000 NA 0.972 0.000

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

consensus_heatmap(res, k = 2)

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

consensus_heatmap(res, k = 3)

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

consensus_heatmap(res, k = 4)

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

consensus_heatmap(res, k = 5)

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

consensus_heatmap(res, k = 6)

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

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

membership_heatmap(res, k = 2)

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

membership_heatmap(res, k = 3)

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

membership_heatmap(res, k = 4)

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

membership_heatmap(res, k = 5)

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

membership_heatmap(res, k = 6)

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

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

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

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

get_signatures(res, k = 3)

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

get_signatures(res, k = 4)

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

get_signatures(res, k = 5)

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

get_signatures(res, k = 6)

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

Signature heatmaps where rows are not scaled:

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

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

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

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

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

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

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

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

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

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

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk ATC-skmeans-signature_compare

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

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

An example of the output of tb is:

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

The columns in tb are:

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

UMAP plot which shows how samples are separated.

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

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

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

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

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

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

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

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

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

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

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk ATC-skmeans-collect-classes

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


ATC:pam**

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

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

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

res
#> A 'ConsensusPartition' object with k = 2, 3, 4, 5, 6.
#>   On a matrix with 13890 rows and 80 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 4.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

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

collect_plots(res)

plot of chunk ATC-pam-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 1.000           1.000       1.000         0.1414 0.859   0.859
#> 3 3 1.000           0.985       0.994         2.1209 0.706   0.658
#> 4 4 1.000           0.985       0.994         0.2215 0.901   0.826
#> 5 5 0.908           0.914       0.960         0.0538 0.998   0.997
#> 6 6 0.894           0.864       0.941         0.0414 0.999   0.997

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

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

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

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

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

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>            class entropy silhouette p1 p2
#> SRR1377145     2       0          1  0  1
#> SRR1377146     2       0          1  0  1
#> SRR1377147     2       0          1  0  1
#> SRR1377148     2       0          1  0  1
#> SRR1377153     2       0          1  0  1
#> SRR1377154     2       0          1  0  1
#> SRR1377155     2       0          1  0  1
#> SRR1377156     2       0          1  0  1
#> SRR1377149     2       0          1  0  1
#> SRR1377150     2       0          1  0  1
#> SRR1377151     2       0          1  0  1
#> SRR1377152     2       0          1  0  1
#> SRR1377157     2       0          1  0  1
#> SRR1377158     2       0          1  0  1
#> SRR1377159     2       0          1  0  1
#> SRR1377160     2       0          1  0  1
#> SRR1377161     2       0          1  0  1
#> SRR1377162     2       0          1  0  1
#> SRR1377163     2       0          1  0  1
#> SRR1377164     2       0          1  0  1
#> SRR1377169     2       0          1  0  1
#> SRR1377170     2       0          1  0  1
#> SRR1377171     2       0          1  0  1
#> SRR1377172     2       0          1  0  1
#> SRR1377165     2       0          1  0  1
#> SRR1377166     2       0          1  0  1
#> SRR1377167     2       0          1  0  1
#> SRR1377168     2       0          1  0  1
#> SRR1377173     2       0          1  0  1
#> SRR1377174     2       0          1  0  1
#> SRR1377175     2       0          1  0  1
#> SRR1377176     2       0          1  0  1
#> SRR1377177     2       0          1  0  1
#> SRR1377178     2       0          1  0  1
#> SRR1377179     2       0          1  0  1
#> SRR1377180     2       0          1  0  1
#> SRR1377181     2       0          1  0  1
#> SRR1377182     2       0          1  0  1
#> SRR1377183     2       0          1  0  1
#> SRR1377184     2       0          1  0  1
#> SRR1377185     2       0          1  0  1
#> SRR1377186     2       0          1  0  1
#> SRR1377187     2       0          1  0  1
#> SRR1377188     2       0          1  0  1
#> SRR1377189     2       0          1  0  1
#> SRR1377190     2       0          1  0  1
#> SRR1377191     2       0          1  0  1
#> SRR1377192     2       0          1  0  1
#> SRR1377193     2       0          1  0  1
#> SRR1377194     2       0          1  0  1
#> SRR1377195     1       0          1  1  0
#> SRR1377196     1       0          1  1  0
#> SRR1377197     1       0          1  1  0
#> SRR1377198     1       0          1  1  0
#> SRR1377199     1       0          1  1  0
#> SRR1377200     1       0          1  1  0
#> SRR1377201     2       0          1  0  1
#> SRR1377202     2       0          1  0  1
#> SRR1377203     2       0          1  0  1
#> SRR1377204     2       0          1  0  1
#> SRR1377205     2       0          1  0  1
#> SRR1377206     2       0          1  0  1
#> SRR1377207     2       0          1  0  1
#> SRR1377208     2       0          1  0  1
#> SRR1377209     2       0          1  0  1
#> SRR1377210     2       0          1  0  1
#> SRR1377211     2       0          1  0  1
#> SRR1377212     2       0          1  0  1
#> SRR1377213     2       0          1  0  1
#> SRR1377214     2       0          1  0  1
#> SRR1377215     2       0          1  0  1
#> SRR1377216     2       0          1  0  1
#> SRR1377217     2       0          1  0  1
#> SRR1377218     2       0          1  0  1
#> SRR1377219     2       0          1  0  1
#> SRR1377220     2       0          1  0  1
#> SRR1377221     2       0          1  0  1
#> SRR1377222     2       0          1  0  1
#> SRR1377223     2       0          1  0  1
#> SRR1377224     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
#> SRR1377145     2   0.000      0.990  0 1.000 0.000
#> SRR1377146     2   0.000      0.990  0 1.000 0.000
#> SRR1377147     2   0.000      0.990  0 1.000 0.000
#> SRR1377148     2   0.000      0.990  0 1.000 0.000
#> SRR1377153     2   0.000      0.990  0 1.000 0.000
#> SRR1377154     2   0.000      0.990  0 1.000 0.000
#> SRR1377155     2   0.000      0.990  0 1.000 0.000
#> SRR1377156     2   0.000      0.990  0 1.000 0.000
#> SRR1377149     2   0.000      0.990  0 1.000 0.000
#> SRR1377150     2   0.000      0.990  0 1.000 0.000
#> SRR1377151     2   0.000      0.990  0 1.000 0.000
#> SRR1377152     2   0.000      0.990  0 1.000 0.000
#> SRR1377157     3   0.000      1.000  0 0.000 1.000
#> SRR1377158     3   0.000      1.000  0 0.000 1.000
#> SRR1377159     3   0.000      1.000  0 0.000 1.000
#> SRR1377160     3   0.000      1.000  0 0.000 1.000
#> SRR1377161     3   0.000      1.000  0 0.000 1.000
#> SRR1377162     3   0.000      1.000  0 0.000 1.000
#> SRR1377163     3   0.000      1.000  0 0.000 1.000
#> SRR1377164     3   0.000      1.000  0 0.000 1.000
#> SRR1377169     3   0.000      1.000  0 0.000 1.000
#> SRR1377170     3   0.000      1.000  0 0.000 1.000
#> SRR1377171     3   0.000      1.000  0 0.000 1.000
#> SRR1377172     3   0.000      1.000  0 0.000 1.000
#> SRR1377165     3   0.000      1.000  0 0.000 1.000
#> SRR1377166     3   0.000      1.000  0 0.000 1.000
#> SRR1377167     3   0.000      1.000  0 0.000 1.000
#> SRR1377168     3   0.000      1.000  0 0.000 1.000
#> SRR1377173     2   0.000      0.990  0 1.000 0.000
#> SRR1377174     2   0.000      0.990  0 1.000 0.000
#> SRR1377175     2   0.000      0.990  0 1.000 0.000
#> SRR1377176     2   0.000      0.990  0 1.000 0.000
#> SRR1377177     2   0.000      0.990  0 1.000 0.000
#> SRR1377178     2   0.000      0.990  0 1.000 0.000
#> SRR1377179     2   0.000      0.990  0 1.000 0.000
#> SRR1377180     2   0.000      0.990  0 1.000 0.000
#> SRR1377181     2   0.000      0.990  0 1.000 0.000
#> SRR1377182     2   0.000      0.990  0 1.000 0.000
#> SRR1377183     2   0.000      0.990  0 1.000 0.000
#> SRR1377184     2   0.000      0.990  0 1.000 0.000
#> SRR1377185     2   0.000      0.990  0 1.000 0.000
#> SRR1377186     2   0.000      0.990  0 1.000 0.000
#> SRR1377187     2   0.000      0.990  0 1.000 0.000
#> SRR1377188     2   0.000      0.990  0 1.000 0.000
#> SRR1377189     2   0.000      0.990  0 1.000 0.000
#> SRR1377190     2   0.000      0.990  0 1.000 0.000
#> SRR1377191     2   0.000      0.990  0 1.000 0.000
#> SRR1377192     2   0.000      0.990  0 1.000 0.000
#> SRR1377193     2   0.000      0.990  0 1.000 0.000
#> SRR1377194     2   0.000      0.990  0 1.000 0.000
#> SRR1377195     1   0.000      1.000  1 0.000 0.000
#> SRR1377196     1   0.000      1.000  1 0.000 0.000
#> SRR1377197     1   0.000      1.000  1 0.000 0.000
#> SRR1377198     1   0.000      1.000  1 0.000 0.000
#> SRR1377199     1   0.000      1.000  1 0.000 0.000
#> SRR1377200     1   0.000      1.000  1 0.000 0.000
#> SRR1377201     2   0.000      0.990  0 1.000 0.000
#> SRR1377202     2   0.000      0.990  0 1.000 0.000
#> SRR1377203     2   0.000      0.990  0 1.000 0.000
#> SRR1377204     2   0.000      0.990  0 1.000 0.000
#> SRR1377205     2   0.000      0.990  0 1.000 0.000
#> SRR1377206     2   0.000      0.990  0 1.000 0.000
#> SRR1377207     2   0.000      0.990  0 1.000 0.000
#> SRR1377208     2   0.000      0.990  0 1.000 0.000
#> SRR1377209     2   0.000      0.990  0 1.000 0.000
#> SRR1377210     2   0.000      0.990  0 1.000 0.000
#> SRR1377211     2   0.000      0.990  0 1.000 0.000
#> SRR1377212     2   0.000      0.990  0 1.000 0.000
#> SRR1377213     2   0.000      0.990  0 1.000 0.000
#> SRR1377214     2   0.000      0.990  0 1.000 0.000
#> SRR1377215     2   0.000      0.990  0 1.000 0.000
#> SRR1377216     2   0.236      0.915  0 0.928 0.072
#> SRR1377217     2   0.435      0.772  0 0.816 0.184
#> SRR1377218     2   0.518      0.662  0 0.744 0.256
#> SRR1377219     2   0.000      0.990  0 1.000 0.000
#> SRR1377220     2   0.000      0.990  0 1.000 0.000
#> SRR1377221     2   0.000      0.990  0 1.000 0.000
#> SRR1377222     2   0.000      0.990  0 1.000 0.000
#> SRR1377223     2   0.000      0.990  0 1.000 0.000
#> SRR1377224     2   0.000      0.990  0 1.000 0.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette p1    p2    p3 p4
#> SRR1377145     2   0.000      0.989  0 1.000 0.000  0
#> SRR1377146     2   0.000      0.989  0 1.000 0.000  0
#> SRR1377147     2   0.000      0.989  0 1.000 0.000  0
#> SRR1377148     2   0.000      0.989  0 1.000 0.000  0
#> SRR1377153     2   0.000      0.989  0 1.000 0.000  0
#> SRR1377154     2   0.000      0.989  0 1.000 0.000  0
#> SRR1377155     2   0.000      0.989  0 1.000 0.000  0
#> SRR1377156     2   0.000      0.989  0 1.000 0.000  0
#> SRR1377149     2   0.000      0.989  0 1.000 0.000  0
#> SRR1377150     2   0.000      0.989  0 1.000 0.000  0
#> SRR1377151     2   0.000      0.989  0 1.000 0.000  0
#> SRR1377152     2   0.000      0.989  0 1.000 0.000  0
#> SRR1377157     3   0.000      1.000  0 0.000 1.000  0
#> SRR1377158     3   0.000      1.000  0 0.000 1.000  0
#> SRR1377159     3   0.000      1.000  0 0.000 1.000  0
#> SRR1377160     3   0.000      1.000  0 0.000 1.000  0
#> SRR1377161     3   0.000      1.000  0 0.000 1.000  0
#> SRR1377162     3   0.000      1.000  0 0.000 1.000  0
#> SRR1377163     3   0.000      1.000  0 0.000 1.000  0
#> SRR1377164     3   0.000      1.000  0 0.000 1.000  0
#> SRR1377169     3   0.000      1.000  0 0.000 1.000  0
#> SRR1377170     3   0.000      1.000  0 0.000 1.000  0
#> SRR1377171     3   0.000      1.000  0 0.000 1.000  0
#> SRR1377172     3   0.000      1.000  0 0.000 1.000  0
#> SRR1377165     3   0.000      1.000  0 0.000 1.000  0
#> SRR1377166     3   0.000      1.000  0 0.000 1.000  0
#> SRR1377167     3   0.000      1.000  0 0.000 1.000  0
#> SRR1377168     3   0.000      1.000  0 0.000 1.000  0
#> SRR1377173     2   0.000      0.989  0 1.000 0.000  0
#> SRR1377174     2   0.000      0.989  0 1.000 0.000  0
#> SRR1377175     2   0.000      0.989  0 1.000 0.000  0
#> SRR1377176     2   0.000      0.989  0 1.000 0.000  0
#> SRR1377177     2   0.000      0.989  0 1.000 0.000  0
#> SRR1377178     2   0.000      0.989  0 1.000 0.000  0
#> SRR1377179     2   0.000      0.989  0 1.000 0.000  0
#> SRR1377180     2   0.000      0.989  0 1.000 0.000  0
#> SRR1377181     2   0.000      0.989  0 1.000 0.000  0
#> SRR1377182     2   0.000      0.989  0 1.000 0.000  0
#> SRR1377183     2   0.000      0.989  0 1.000 0.000  0
#> SRR1377184     2   0.000      0.989  0 1.000 0.000  0
#> SRR1377185     2   0.000      0.989  0 1.000 0.000  0
#> SRR1377186     2   0.000      0.989  0 1.000 0.000  0
#> SRR1377187     2   0.000      0.989  0 1.000 0.000  0
#> SRR1377188     2   0.000      0.989  0 1.000 0.000  0
#> SRR1377189     2   0.000      0.989  0 1.000 0.000  0
#> SRR1377190     2   0.000      0.989  0 1.000 0.000  0
#> SRR1377191     2   0.000      0.989  0 1.000 0.000  0
#> SRR1377192     2   0.000      0.989  0 1.000 0.000  0
#> SRR1377193     2   0.000      0.989  0 1.000 0.000  0
#> SRR1377194     2   0.000      0.989  0 1.000 0.000  0
#> SRR1377195     1   0.000      1.000  1 0.000 0.000  0
#> SRR1377196     1   0.000      1.000  1 0.000 0.000  0
#> SRR1377197     1   0.000      1.000  1 0.000 0.000  0
#> SRR1377198     1   0.000      1.000  1 0.000 0.000  0
#> SRR1377199     1   0.000      1.000  1 0.000 0.000  0
#> SRR1377200     1   0.000      1.000  1 0.000 0.000  0
#> SRR1377201     2   0.000      0.989  0 1.000 0.000  0
#> SRR1377202     2   0.000      0.989  0 1.000 0.000  0
#> SRR1377203     2   0.000      0.989  0 1.000 0.000  0
#> SRR1377204     4   0.000      1.000  0 0.000 0.000  1
#> SRR1377205     4   0.000      1.000  0 0.000 0.000  1
#> SRR1377206     4   0.000      1.000  0 0.000 0.000  1
#> SRR1377207     2   0.000      0.989  0 1.000 0.000  0
#> SRR1377208     2   0.000      0.989  0 1.000 0.000  0
#> SRR1377209     2   0.000      0.989  0 1.000 0.000  0
#> SRR1377210     2   0.000      0.989  0 1.000 0.000  0
#> SRR1377211     2   0.000      0.989  0 1.000 0.000  0
#> SRR1377212     2   0.000      0.989  0 1.000 0.000  0
#> SRR1377213     2   0.000      0.989  0 1.000 0.000  0
#> SRR1377214     2   0.000      0.989  0 1.000 0.000  0
#> SRR1377215     2   0.000      0.989  0 1.000 0.000  0
#> SRR1377216     2   0.194      0.909  0 0.924 0.076  0
#> SRR1377217     2   0.344      0.772  0 0.816 0.184  0
#> SRR1377218     2   0.410      0.662  0 0.744 0.256  0
#> SRR1377219     2   0.000      0.989  0 1.000 0.000  0
#> SRR1377220     2   0.000      0.989  0 1.000 0.000  0
#> SRR1377221     2   0.000      0.989  0 1.000 0.000  0
#> SRR1377222     4   0.000      1.000  0 0.000 0.000  1
#> SRR1377223     4   0.000      1.000  0 0.000 0.000  1
#> SRR1377224     4   0.000      1.000  0 0.000 0.000  1

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>            class entropy silhouette    p1    p2    p3 p4    p5
#> SRR1377145     2   0.000      0.949 0.000 1.000 0.000  0 0.000
#> SRR1377146     2   0.000      0.949 0.000 1.000 0.000  0 0.000
#> SRR1377147     2   0.000      0.949 0.000 1.000 0.000  0 0.000
#> SRR1377148     2   0.000      0.949 0.000 1.000 0.000  0 0.000
#> SRR1377153     2   0.000      0.949 0.000 1.000 0.000  0 0.000
#> SRR1377154     2   0.000      0.949 0.000 1.000 0.000  0 0.000
#> SRR1377155     2   0.000      0.949 0.000 1.000 0.000  0 0.000
#> SRR1377156     2   0.000      0.949 0.000 1.000 0.000  0 0.000
#> SRR1377149     2   0.000      0.949 0.000 1.000 0.000  0 0.000
#> SRR1377150     2   0.000      0.949 0.000 1.000 0.000  0 0.000
#> SRR1377151     2   0.000      0.949 0.000 1.000 0.000  0 0.000
#> SRR1377152     2   0.000      0.949 0.000 1.000 0.000  0 0.000
#> SRR1377157     3   0.000      1.000 0.000 0.000 1.000  0 0.000
#> SRR1377158     3   0.000      1.000 0.000 0.000 1.000  0 0.000
#> SRR1377159     3   0.000      1.000 0.000 0.000 1.000  0 0.000
#> SRR1377160     3   0.000      1.000 0.000 0.000 1.000  0 0.000
#> SRR1377161     3   0.000      1.000 0.000 0.000 1.000  0 0.000
#> SRR1377162     3   0.000      1.000 0.000 0.000 1.000  0 0.000
#> SRR1377163     3   0.000      1.000 0.000 0.000 1.000  0 0.000
#> SRR1377164     3   0.000      1.000 0.000 0.000 1.000  0 0.000
#> SRR1377169     3   0.000      1.000 0.000 0.000 1.000  0 0.000
#> SRR1377170     3   0.000      1.000 0.000 0.000 1.000  0 0.000
#> SRR1377171     3   0.000      1.000 0.000 0.000 1.000  0 0.000
#> SRR1377172     3   0.000      1.000 0.000 0.000 1.000  0 0.000
#> SRR1377165     3   0.000      1.000 0.000 0.000 1.000  0 0.000
#> SRR1377166     3   0.000      1.000 0.000 0.000 1.000  0 0.000
#> SRR1377167     3   0.000      1.000 0.000 0.000 1.000  0 0.000
#> SRR1377168     3   0.000      1.000 0.000 0.000 1.000  0 0.000
#> SRR1377173     2   0.000      0.949 0.000 1.000 0.000  0 0.000
#> SRR1377174     2   0.000      0.949 0.000 1.000 0.000  0 0.000
#> SRR1377175     2   0.000      0.949 0.000 1.000 0.000  0 0.000
#> SRR1377176     2   0.000      0.949 0.000 1.000 0.000  0 0.000
#> SRR1377177     2   0.000      0.949 0.000 1.000 0.000  0 0.000
#> SRR1377178     2   0.000      0.949 0.000 1.000 0.000  0 0.000
#> SRR1377179     2   0.000      0.949 0.000 1.000 0.000  0 0.000
#> SRR1377180     2   0.000      0.949 0.000 1.000 0.000  0 0.000
#> SRR1377181     2   0.000      0.949 0.000 1.000 0.000  0 0.000
#> SRR1377182     2   0.000      0.949 0.000 1.000 0.000  0 0.000
#> SRR1377183     2   0.000      0.949 0.000 1.000 0.000  0 0.000
#> SRR1377184     2   0.000      0.949 0.000 1.000 0.000  0 0.000
#> SRR1377185     2   0.000      0.949 0.000 1.000 0.000  0 0.000
#> SRR1377186     2   0.000      0.949 0.000 1.000 0.000  0 0.000
#> SRR1377187     2   0.000      0.949 0.000 1.000 0.000  0 0.000
#> SRR1377188     2   0.000      0.949 0.000 1.000 0.000  0 0.000
#> SRR1377189     2   0.000      0.949 0.000 1.000 0.000  0 0.000
#> SRR1377190     2   0.000      0.949 0.000 1.000 0.000  0 0.000
#> SRR1377191     2   0.000      0.949 0.000 1.000 0.000  0 0.000
#> SRR1377192     2   0.000      0.949 0.000 1.000 0.000  0 0.000
#> SRR1377193     2   0.000      0.949 0.000 1.000 0.000  0 0.000
#> SRR1377194     2   0.000      0.949 0.000 1.000 0.000  0 0.000
#> SRR1377195     1   0.334      0.920 0.772 0.000 0.000  0 0.228
#> SRR1377196     1   0.334      0.920 0.772 0.000 0.000  0 0.228
#> SRR1377197     1   0.334      0.920 0.772 0.000 0.000  0 0.228
#> SRR1377198     1   0.334      0.920 0.772 0.000 0.000  0 0.228
#> SRR1377199     1   0.422      0.659 0.584 0.000 0.000  0 0.416
#> SRR1377200     5   0.300      0.000 0.188 0.000 0.000  0 0.812
#> SRR1377201     2   0.000      0.949 0.000 1.000 0.000  0 0.000
#> SRR1377202     2   0.000      0.949 0.000 1.000 0.000  0 0.000
#> SRR1377203     2   0.000      0.949 0.000 1.000 0.000  0 0.000
#> SRR1377204     4   0.000      1.000 0.000 0.000 0.000  1 0.000
#> SRR1377205     4   0.000      1.000 0.000 0.000 0.000  1 0.000
#> SRR1377206     4   0.000      1.000 0.000 0.000 0.000  1 0.000
#> SRR1377207     2   0.000      0.949 0.000 1.000 0.000  0 0.000
#> SRR1377208     2   0.000      0.949 0.000 1.000 0.000  0 0.000
#> SRR1377209     2   0.000      0.949 0.000 1.000 0.000  0 0.000
#> SRR1377210     2   0.000      0.949 0.000 1.000 0.000  0 0.000
#> SRR1377211     2   0.000      0.949 0.000 1.000 0.000  0 0.000
#> SRR1377212     2   0.000      0.949 0.000 1.000 0.000  0 0.000
#> SRR1377213     2   0.334      0.754 0.228 0.772 0.000  0 0.000
#> SRR1377214     2   0.334      0.754 0.228 0.772 0.000  0 0.000
#> SRR1377215     2   0.334      0.754 0.228 0.772 0.000  0 0.000
#> SRR1377216     2   0.488      0.655 0.228 0.696 0.076  0 0.000
#> SRR1377217     2   0.594      0.470 0.228 0.592 0.180  0 0.000
#> SRR1377218     2   0.637      0.308 0.228 0.520 0.252  0 0.000
#> SRR1377219     2   0.334      0.754 0.228 0.772 0.000  0 0.000
#> SRR1377220     2   0.334      0.754 0.228 0.772 0.000  0 0.000
#> SRR1377221     2   0.334      0.754 0.228 0.772 0.000  0 0.000
#> SRR1377222     4   0.000      1.000 0.000 0.000 0.000  1 0.000
#> SRR1377223     4   0.000      1.000 0.000 0.000 0.000  1 0.000
#> SRR1377224     4   0.000      1.000 0.000 0.000 0.000  1 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
#> SRR1377145     1  0.0000      0.914 1.000  0 0.000 0.000 0.000 0.000
#> SRR1377146     1  0.0000      0.914 1.000  0 0.000 0.000 0.000 0.000
#> SRR1377147     1  0.0000      0.914 1.000  0 0.000 0.000 0.000 0.000
#> SRR1377148     1  0.0000      0.914 1.000  0 0.000 0.000 0.000 0.000
#> SRR1377153     1  0.0000      0.914 1.000  0 0.000 0.000 0.000 0.000
#> SRR1377154     1  0.0000      0.914 1.000  0 0.000 0.000 0.000 0.000
#> SRR1377155     1  0.0000      0.914 1.000  0 0.000 0.000 0.000 0.000
#> SRR1377156     1  0.0000      0.914 1.000  0 0.000 0.000 0.000 0.000
#> SRR1377149     1  0.0363      0.908 0.988  0 0.000 0.000 0.012 0.000
#> SRR1377150     1  0.0000      0.914 1.000  0 0.000 0.000 0.000 0.000
#> SRR1377151     1  0.0000      0.914 1.000  0 0.000 0.000 0.000 0.000
#> SRR1377152     1  0.0000      0.914 1.000  0 0.000 0.000 0.000 0.000
#> SRR1377157     3  0.0000      1.000 0.000  0 1.000 0.000 0.000 0.000
#> SRR1377158     3  0.0000      1.000 0.000  0 1.000 0.000 0.000 0.000
#> SRR1377159     3  0.0000      1.000 0.000  0 1.000 0.000 0.000 0.000
#> SRR1377160     3  0.0000      1.000 0.000  0 1.000 0.000 0.000 0.000
#> SRR1377161     3  0.0000      1.000 0.000  0 1.000 0.000 0.000 0.000
#> SRR1377162     3  0.0000      1.000 0.000  0 1.000 0.000 0.000 0.000
#> SRR1377163     3  0.0000      1.000 0.000  0 1.000 0.000 0.000 0.000
#> SRR1377164     3  0.0000      1.000 0.000  0 1.000 0.000 0.000 0.000
#> SRR1377169     3  0.0000      1.000 0.000  0 1.000 0.000 0.000 0.000
#> SRR1377170     3  0.0000      1.000 0.000  0 1.000 0.000 0.000 0.000
#> SRR1377171     3  0.0000      1.000 0.000  0 1.000 0.000 0.000 0.000
#> SRR1377172     3  0.0000      1.000 0.000  0 1.000 0.000 0.000 0.000
#> SRR1377165     3  0.0000      1.000 0.000  0 1.000 0.000 0.000 0.000
#> SRR1377166     3  0.0000      1.000 0.000  0 1.000 0.000 0.000 0.000
#> SRR1377167     3  0.0000      1.000 0.000  0 1.000 0.000 0.000 0.000
#> SRR1377168     3  0.0000      1.000 0.000  0 1.000 0.000 0.000 0.000
#> SRR1377173     1  0.0622      0.910 0.980  0 0.000 0.012 0.008 0.000
#> SRR1377174     1  0.0622      0.910 0.980  0 0.000 0.012 0.008 0.000
#> SRR1377175     1  0.0622      0.910 0.980  0 0.000 0.012 0.008 0.000
#> SRR1377176     1  0.0622      0.910 0.980  0 0.000 0.012 0.008 0.000
#> SRR1377177     1  0.0622      0.910 0.980  0 0.000 0.012 0.008 0.000
#> SRR1377178     1  0.0622      0.910 0.980  0 0.000 0.012 0.008 0.000
#> SRR1377179     1  0.0622      0.910 0.980  0 0.000 0.012 0.008 0.000
#> SRR1377180     1  0.0622      0.910 0.980  0 0.000 0.012 0.008 0.000
#> SRR1377181     1  0.0622      0.910 0.980  0 0.000 0.012 0.008 0.000
#> SRR1377182     1  0.0622      0.910 0.980  0 0.000 0.012 0.008 0.000
#> SRR1377183     1  0.0622      0.910 0.980  0 0.000 0.012 0.008 0.000
#> SRR1377184     1  0.0622      0.910 0.980  0 0.000 0.012 0.008 0.000
#> SRR1377185     1  0.0622      0.910 0.980  0 0.000 0.012 0.008 0.000
#> SRR1377186     1  0.0260      0.912 0.992  0 0.000 0.008 0.000 0.000
#> SRR1377187     1  0.0622      0.910 0.980  0 0.000 0.012 0.008 0.000
#> SRR1377188     1  0.0622      0.910 0.980  0 0.000 0.012 0.008 0.000
#> SRR1377189     1  0.0000      0.914 1.000  0 0.000 0.000 0.000 0.000
#> SRR1377190     1  0.0000      0.914 1.000  0 0.000 0.000 0.000 0.000
#> SRR1377191     1  0.0000      0.914 1.000  0 0.000 0.000 0.000 0.000
#> SRR1377192     1  0.0000      0.914 1.000  0 0.000 0.000 0.000 0.000
#> SRR1377193     1  0.0000      0.914 1.000  0 0.000 0.000 0.000 0.000
#> SRR1377194     1  0.0000      0.914 1.000  0 0.000 0.000 0.000 0.000
#> SRR1377195     5  0.4228      1.000 0.000  0 0.000 0.020 0.588 0.392
#> SRR1377196     5  0.4228      1.000 0.000  0 0.000 0.020 0.588 0.392
#> SRR1377197     5  0.4228      1.000 0.000  0 0.000 0.020 0.588 0.392
#> SRR1377198     5  0.4228      1.000 0.000  0 0.000 0.020 0.588 0.392
#> SRR1377199     6  0.0000      0.000 0.000  0 0.000 0.000 0.000 1.000
#> SRR1377200     4  0.0363      0.000 0.000  0 0.000 0.988 0.000 0.012
#> SRR1377201     1  0.0000      0.914 1.000  0 0.000 0.000 0.000 0.000
#> SRR1377202     1  0.0000      0.914 1.000  0 0.000 0.000 0.000 0.000
#> SRR1377203     1  0.0000      0.914 1.000  0 0.000 0.000 0.000 0.000
#> SRR1377204     2  0.0000      1.000 0.000  1 0.000 0.000 0.000 0.000
#> SRR1377205     2  0.0000      1.000 0.000  1 0.000 0.000 0.000 0.000
#> SRR1377206     2  0.0000      1.000 0.000  1 0.000 0.000 0.000 0.000
#> SRR1377207     1  0.0000      0.914 1.000  0 0.000 0.000 0.000 0.000
#> SRR1377208     1  0.0000      0.914 1.000  0 0.000 0.000 0.000 0.000
#> SRR1377209     1  0.0000      0.914 1.000  0 0.000 0.000 0.000 0.000
#> SRR1377210     1  0.0000      0.914 1.000  0 0.000 0.000 0.000 0.000
#> SRR1377211     1  0.0000      0.914 1.000  0 0.000 0.000 0.000 0.000
#> SRR1377212     1  0.0000      0.914 1.000  0 0.000 0.000 0.000 0.000
#> SRR1377213     1  0.3765      0.501 0.596  0 0.000 0.000 0.404 0.000
#> SRR1377214     1  0.3765      0.501 0.596  0 0.000 0.000 0.404 0.000
#> SRR1377215     1  0.3765      0.501 0.596  0 0.000 0.000 0.404 0.000
#> SRR1377216     1  0.4584      0.435 0.556  0 0.040 0.000 0.404 0.000
#> SRR1377217     1  0.5466      0.250 0.472  0 0.124 0.000 0.404 0.000
#> SRR1377218     1  0.5629      0.195 0.448  0 0.148 0.000 0.404 0.000
#> SRR1377219     1  0.3765      0.501 0.596  0 0.000 0.000 0.404 0.000
#> SRR1377220     1  0.3765      0.501 0.596  0 0.000 0.000 0.404 0.000
#> SRR1377221     1  0.3765      0.501 0.596  0 0.000 0.000 0.404 0.000
#> SRR1377222     2  0.0000      1.000 0.000  1 0.000 0.000 0.000 0.000
#> SRR1377223     2  0.0000      1.000 0.000  1 0.000 0.000 0.000 0.000
#> SRR1377224     2  0.0000      1.000 0.000  1 0.000 0.000 0.000 0.000

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

consensus_heatmap(res, k = 2)

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

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

collect_plots(res)

plot of chunk ATC-mclust-collect-plots

The plots are:

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

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

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

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

select_partition_number(res)

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

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

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.859           0.965       0.984        0.16717 0.859   0.859
#> 3 3 0.418           0.778       0.773        1.70121 0.871   0.850
#> 4 4 0.350           0.620       0.757        0.33662 0.637   0.503
#> 5 5 0.546           0.634       0.783        0.16180 0.704   0.395
#> 6 6 0.595           0.585       0.795        0.00257 0.910   0.755

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
#> SRR1377145     2    0.00      0.981 0.00 1.00
#> SRR1377146     2    0.00      0.981 0.00 1.00
#> SRR1377147     2    0.00      0.981 0.00 1.00
#> SRR1377148     2    0.00      0.981 0.00 1.00
#> SRR1377153     2    0.00      0.981 0.00 1.00
#> SRR1377154     2    0.00      0.981 0.00 1.00
#> SRR1377155     2    0.00      0.981 0.00 1.00
#> SRR1377156     2    0.00      0.981 0.00 1.00
#> SRR1377149     2    0.00      0.981 0.00 1.00
#> SRR1377150     2    0.00      0.981 0.00 1.00
#> SRR1377151     2    0.00      0.981 0.00 1.00
#> SRR1377152     2    0.00      0.981 0.00 1.00
#> SRR1377157     2    0.00      0.981 0.00 1.00
#> SRR1377158     2    0.00      0.981 0.00 1.00
#> SRR1377159     2    0.00      0.981 0.00 1.00
#> SRR1377160     2    0.00      0.981 0.00 1.00
#> SRR1377161     2    0.00      0.981 0.00 1.00
#> SRR1377162     2    0.00      0.981 0.00 1.00
#> SRR1377163     2    0.00      0.981 0.00 1.00
#> SRR1377164     2    0.00      0.981 0.00 1.00
#> SRR1377169     2    0.00      0.981 0.00 1.00
#> SRR1377170     2    0.00      0.981 0.00 1.00
#> SRR1377171     2    0.00      0.981 0.00 1.00
#> SRR1377172     2    0.00      0.981 0.00 1.00
#> SRR1377165     2    0.00      0.981 0.00 1.00
#> SRR1377166     2    0.00      0.981 0.00 1.00
#> SRR1377167     2    0.00      0.981 0.00 1.00
#> SRR1377168     2    0.00      0.981 0.00 1.00
#> SRR1377173     2    0.00      0.981 0.00 1.00
#> SRR1377174     2    0.00      0.981 0.00 1.00
#> SRR1377175     2    0.00      0.981 0.00 1.00
#> SRR1377176     2    0.00      0.981 0.00 1.00
#> SRR1377177     2    0.00      0.981 0.00 1.00
#> SRR1377178     2    0.00      0.981 0.00 1.00
#> SRR1377179     2    0.00      0.981 0.00 1.00
#> SRR1377180     2    0.00      0.981 0.00 1.00
#> SRR1377181     2    0.00      0.981 0.00 1.00
#> SRR1377182     2    0.00      0.981 0.00 1.00
#> SRR1377183     2    0.00      0.981 0.00 1.00
#> SRR1377184     2    0.00      0.981 0.00 1.00
#> SRR1377185     2    0.00      0.981 0.00 1.00
#> SRR1377186     2    0.00      0.981 0.00 1.00
#> SRR1377187     2    0.00      0.981 0.00 1.00
#> SRR1377188     2    0.00      0.981 0.00 1.00
#> SRR1377189     2    0.00      0.981 0.00 1.00
#> SRR1377190     2    0.00      0.981 0.00 1.00
#> SRR1377191     2    0.00      0.981 0.00 1.00
#> SRR1377192     2    0.00      0.981 0.00 1.00
#> SRR1377193     2    0.00      0.981 0.00 1.00
#> SRR1377194     2    0.00      0.981 0.00 1.00
#> SRR1377195     1    0.00      1.000 1.00 0.00
#> SRR1377196     1    0.00      1.000 1.00 0.00
#> SRR1377197     1    0.00      1.000 1.00 0.00
#> SRR1377198     1    0.00      1.000 1.00 0.00
#> SRR1377199     1    0.00      1.000 1.00 0.00
#> SRR1377200     1    0.00      1.000 1.00 0.00
#> SRR1377201     2    0.00      0.981 0.00 1.00
#> SRR1377202     2    0.00      0.981 0.00 1.00
#> SRR1377203     2    0.00      0.981 0.00 1.00
#> SRR1377204     2    0.76      0.737 0.22 0.78
#> SRR1377205     2    0.76      0.737 0.22 0.78
#> SRR1377206     2    0.76      0.737 0.22 0.78
#> SRR1377207     2    0.00      0.981 0.00 1.00
#> SRR1377208     2    0.00      0.981 0.00 1.00
#> SRR1377209     2    0.00      0.981 0.00 1.00
#> SRR1377210     2    0.00      0.981 0.00 1.00
#> SRR1377211     2    0.00      0.981 0.00 1.00
#> SRR1377212     2    0.00      0.981 0.00 1.00
#> SRR1377213     2    0.00      0.981 0.00 1.00
#> SRR1377214     2    0.00      0.981 0.00 1.00
#> SRR1377215     2    0.00      0.981 0.00 1.00
#> SRR1377216     2    0.00      0.981 0.00 1.00
#> SRR1377217     2    0.00      0.981 0.00 1.00
#> SRR1377218     2    0.00      0.981 0.00 1.00
#> SRR1377219     2    0.00      0.981 0.00 1.00
#> SRR1377220     2    0.00      0.981 0.00 1.00
#> SRR1377221     2    0.00      0.981 0.00 1.00
#> SRR1377222     2    0.76      0.737 0.22 0.78
#> SRR1377223     2    0.76      0.737 0.22 0.78
#> SRR1377224     2    0.76      0.737 0.22 0.78

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>            class entropy silhouette    p1    p2    p3
#> SRR1377145     2  0.6126      0.759 0.352 0.644 0.004
#> SRR1377146     2  0.6275      0.760 0.348 0.644 0.008
#> SRR1377147     2  0.6252      0.762 0.344 0.648 0.008
#> SRR1377148     2  0.6608      0.757 0.356 0.628 0.016
#> SRR1377153     2  0.3295      0.795 0.096 0.896 0.008
#> SRR1377154     2  0.4531      0.802 0.168 0.824 0.008
#> SRR1377155     2  0.5247      0.795 0.224 0.768 0.008
#> SRR1377156     2  0.4589      0.802 0.172 0.820 0.008
#> SRR1377149     2  0.3918      0.798 0.140 0.856 0.004
#> SRR1377150     2  0.5201      0.792 0.236 0.760 0.004
#> SRR1377151     2  0.5201      0.792 0.236 0.760 0.004
#> SRR1377152     2  0.5690      0.780 0.288 0.708 0.004
#> SRR1377157     2  0.6252      0.725 0.444 0.556 0.000
#> SRR1377158     2  0.6252      0.725 0.444 0.556 0.000
#> SRR1377159     2  0.6252      0.725 0.444 0.556 0.000
#> SRR1377160     2  0.6252      0.725 0.444 0.556 0.000
#> SRR1377161     2  0.6252      0.725 0.444 0.556 0.000
#> SRR1377162     2  0.6252      0.725 0.444 0.556 0.000
#> SRR1377163     2  0.6252      0.725 0.444 0.556 0.000
#> SRR1377164     2  0.6252      0.725 0.444 0.556 0.000
#> SRR1377169     2  0.6244      0.728 0.440 0.560 0.000
#> SRR1377170     2  0.6244      0.728 0.440 0.560 0.000
#> SRR1377171     2  0.6244      0.728 0.440 0.560 0.000
#> SRR1377172     2  0.6244      0.728 0.440 0.560 0.000
#> SRR1377165     2  0.6252      0.725 0.444 0.556 0.000
#> SRR1377166     2  0.6252      0.725 0.444 0.556 0.000
#> SRR1377167     2  0.6252      0.725 0.444 0.556 0.000
#> SRR1377168     2  0.6252      0.725 0.444 0.556 0.000
#> SRR1377173     2  0.0424      0.768 0.008 0.992 0.000
#> SRR1377174     2  0.0424      0.768 0.008 0.992 0.000
#> SRR1377175     2  0.0424      0.768 0.008 0.992 0.000
#> SRR1377176     2  0.0424      0.768 0.008 0.992 0.000
#> SRR1377177     2  0.0424      0.768 0.008 0.992 0.000
#> SRR1377178     2  0.0424      0.768 0.008 0.992 0.000
#> SRR1377179     2  0.0424      0.768 0.008 0.992 0.000
#> SRR1377180     2  0.0424      0.768 0.008 0.992 0.000
#> SRR1377181     2  0.0424      0.768 0.008 0.992 0.000
#> SRR1377182     2  0.0424      0.768 0.008 0.992 0.000
#> SRR1377183     2  0.1860      0.783 0.052 0.948 0.000
#> SRR1377184     2  0.0424      0.768 0.008 0.992 0.000
#> SRR1377185     2  0.3116      0.797 0.108 0.892 0.000
#> SRR1377186     2  0.3482      0.799 0.128 0.872 0.000
#> SRR1377187     2  0.0424      0.768 0.008 0.992 0.000
#> SRR1377188     2  0.4062      0.802 0.164 0.836 0.000
#> SRR1377189     2  0.4915      0.801 0.184 0.804 0.012
#> SRR1377190     2  0.4531      0.802 0.168 0.824 0.008
#> SRR1377191     2  0.2682      0.792 0.076 0.920 0.004
#> SRR1377192     2  0.3826      0.678 0.008 0.868 0.124
#> SRR1377193     2  0.3784      0.669 0.004 0.864 0.132
#> SRR1377194     2  0.4409      0.620 0.004 0.824 0.172
#> SRR1377195     1  0.6260      1.000 0.552 0.000 0.448
#> SRR1377196     1  0.6260      1.000 0.552 0.000 0.448
#> SRR1377197     1  0.6260      1.000 0.552 0.000 0.448
#> SRR1377198     1  0.6260      1.000 0.552 0.000 0.448
#> SRR1377199     1  0.6260      1.000 0.552 0.000 0.448
#> SRR1377200     1  0.6260      1.000 0.552 0.000 0.448
#> SRR1377201     2  0.2860      0.794 0.084 0.912 0.004
#> SRR1377202     2  0.4531      0.801 0.168 0.824 0.008
#> SRR1377203     2  0.4233      0.802 0.160 0.836 0.004
#> SRR1377204     3  0.0237      1.000 0.000 0.004 0.996
#> SRR1377205     3  0.0237      1.000 0.000 0.004 0.996
#> SRR1377206     3  0.0237      1.000 0.000 0.004 0.996
#> SRR1377207     2  0.0000      0.769 0.000 1.000 0.000
#> SRR1377208     2  0.0000      0.769 0.000 1.000 0.000
#> SRR1377209     2  0.0000      0.769 0.000 1.000 0.000
#> SRR1377210     2  0.4575      0.800 0.184 0.812 0.004
#> SRR1377211     2  0.3644      0.800 0.124 0.872 0.004
#> SRR1377212     2  0.4409      0.801 0.172 0.824 0.004
#> SRR1377213     2  0.6211      0.529 0.036 0.736 0.228
#> SRR1377214     2  0.6211      0.529 0.036 0.736 0.228
#> SRR1377215     2  0.6211      0.529 0.036 0.736 0.228
#> SRR1377216     2  0.7430      0.718 0.424 0.540 0.036
#> SRR1377217     2  0.7430      0.718 0.424 0.540 0.036
#> SRR1377218     2  0.7430      0.718 0.424 0.540 0.036
#> SRR1377219     2  0.6168      0.534 0.036 0.740 0.224
#> SRR1377220     2  0.6168      0.534 0.036 0.740 0.224
#> SRR1377221     2  0.6211      0.529 0.036 0.736 0.228
#> SRR1377222     3  0.0237      1.000 0.000 0.004 0.996
#> SRR1377223     3  0.0237      1.000 0.000 0.004 0.996
#> SRR1377224     3  0.0237      1.000 0.000 0.004 0.996

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> SRR1377145     3  0.4122    0.66330 0.000 0.236 0.760 0.004
#> SRR1377146     3  0.4155    0.66103 0.000 0.240 0.756 0.004
#> SRR1377147     3  0.3945    0.67455 0.000 0.216 0.780 0.004
#> SRR1377148     3  0.4188    0.65865 0.000 0.244 0.752 0.004
#> SRR1377153     2  0.4994   -0.08623 0.000 0.520 0.480 0.000
#> SRR1377154     3  0.4991    0.46632 0.000 0.388 0.608 0.004
#> SRR1377155     3  0.4936    0.49846 0.000 0.372 0.624 0.004
#> SRR1377156     3  0.4889    0.52261 0.000 0.360 0.636 0.004
#> SRR1377149     3  0.5085    0.45990 0.000 0.376 0.616 0.008
#> SRR1377150     3  0.5112    0.46750 0.000 0.384 0.608 0.008
#> SRR1377151     3  0.4781    0.56085 0.000 0.336 0.660 0.004
#> SRR1377152     3  0.4567    0.62711 0.000 0.276 0.716 0.008
#> SRR1377157     3  0.1109    0.71297 0.000 0.028 0.968 0.004
#> SRR1377158     3  0.0895    0.71836 0.000 0.020 0.976 0.004
#> SRR1377159     3  0.1305    0.70867 0.000 0.036 0.960 0.004
#> SRR1377160     3  0.1209    0.71206 0.000 0.032 0.964 0.004
#> SRR1377161     3  0.0657    0.72156 0.000 0.012 0.984 0.004
#> SRR1377162     3  0.0376    0.72443 0.000 0.004 0.992 0.004
#> SRR1377163     3  0.0524    0.72259 0.000 0.008 0.988 0.004
#> SRR1377164     3  0.0657    0.72156 0.000 0.012 0.984 0.004
#> SRR1377169     3  0.1389    0.73151 0.000 0.048 0.952 0.000
#> SRR1377170     3  0.1389    0.73212 0.000 0.048 0.952 0.000
#> SRR1377171     3  0.1211    0.73309 0.000 0.040 0.960 0.000
#> SRR1377172     3  0.1716    0.72919 0.000 0.064 0.936 0.000
#> SRR1377165     3  0.0336    0.72866 0.000 0.008 0.992 0.000
#> SRR1377166     3  0.0921    0.73085 0.000 0.028 0.972 0.000
#> SRR1377167     3  0.0469    0.72962 0.000 0.012 0.988 0.000
#> SRR1377168     3  0.0592    0.72756 0.000 0.016 0.984 0.000
#> SRR1377173     2  0.3355    0.70870 0.000 0.836 0.160 0.004
#> SRR1377174     2  0.3355    0.70975 0.000 0.836 0.160 0.004
#> SRR1377175     2  0.3355    0.70870 0.000 0.836 0.160 0.004
#> SRR1377176     2  0.3402    0.70840 0.000 0.832 0.164 0.004
#> SRR1377177     2  0.3498    0.70798 0.000 0.832 0.160 0.008
#> SRR1377178     2  0.3545    0.70772 0.000 0.828 0.164 0.008
#> SRR1377179     2  0.3545    0.70772 0.000 0.828 0.164 0.008
#> SRR1377180     2  0.3545    0.70772 0.000 0.828 0.164 0.008
#> SRR1377181     2  0.3725    0.70100 0.000 0.812 0.180 0.008
#> SRR1377182     2  0.3933    0.68644 0.000 0.792 0.200 0.008
#> SRR1377183     2  0.6200    0.47159 0.000 0.580 0.356 0.064
#> SRR1377184     2  0.3933    0.68644 0.000 0.792 0.200 0.008
#> SRR1377185     2  0.6020    0.40277 0.000 0.568 0.384 0.048
#> SRR1377186     2  0.6197    0.23183 0.000 0.508 0.440 0.052
#> SRR1377187     2  0.3893    0.68966 0.000 0.796 0.196 0.008
#> SRR1377188     3  0.6147   -0.07483 0.000 0.464 0.488 0.048
#> SRR1377189     3  0.5984    0.33041 0.000 0.372 0.580 0.048
#> SRR1377190     3  0.6430    0.04496 0.000 0.428 0.504 0.068
#> SRR1377191     2  0.6487    0.23096 0.000 0.500 0.428 0.072
#> SRR1377192     2  0.7315    0.59227 0.000 0.532 0.252 0.216
#> SRR1377193     2  0.7297    0.59913 0.000 0.536 0.244 0.220
#> SRR1377194     2  0.7421    0.56418 0.000 0.512 0.268 0.220
#> SRR1377195     1  0.2197    0.94927 0.916 0.080 0.004 0.000
#> SRR1377196     1  0.2197    0.94927 0.916 0.080 0.004 0.000
#> SRR1377197     1  0.2197    0.94927 0.916 0.080 0.004 0.000
#> SRR1377198     1  0.0188    0.94480 0.996 0.004 0.000 0.000
#> SRR1377199     1  0.0817    0.93880 0.976 0.024 0.000 0.000
#> SRR1377200     1  0.1545    0.92665 0.952 0.040 0.000 0.008
#> SRR1377201     2  0.6223    0.38841 0.000 0.556 0.384 0.060
#> SRR1377202     2  0.6425    0.26916 0.000 0.508 0.424 0.068
#> SRR1377203     3  0.6336   -0.10334 0.000 0.460 0.480 0.060
#> SRR1377204     4  0.2973    0.99626 0.144 0.000 0.000 0.856
#> SRR1377205     4  0.2973    0.99626 0.144 0.000 0.000 0.856
#> SRR1377206     4  0.2973    0.99626 0.144 0.000 0.000 0.856
#> SRR1377207     2  0.5280    0.68263 0.000 0.748 0.156 0.096
#> SRR1377208     2  0.5188    0.68573 0.000 0.756 0.148 0.096
#> SRR1377209     2  0.5293    0.68497 0.000 0.748 0.152 0.100
#> SRR1377210     3  0.5982    0.10331 0.000 0.436 0.524 0.040
#> SRR1377211     3  0.6080   -0.06345 0.000 0.468 0.488 0.044
#> SRR1377212     3  0.6005    0.00654 0.000 0.460 0.500 0.040
#> SRR1377213     2  0.6878    0.56666 0.000 0.472 0.104 0.424
#> SRR1377214     2  0.6844    0.59744 0.000 0.500 0.104 0.396
#> SRR1377215     2  0.6884    0.55636 0.000 0.464 0.104 0.432
#> SRR1377216     3  0.2522    0.72476 0.000 0.076 0.908 0.016
#> SRR1377217     3  0.2402    0.72590 0.000 0.076 0.912 0.012
#> SRR1377218     3  0.2402    0.72590 0.000 0.076 0.912 0.012
#> SRR1377219     2  0.6844    0.59757 0.000 0.500 0.104 0.396
#> SRR1377220     2  0.6830    0.60632 0.000 0.508 0.104 0.388
#> SRR1377221     2  0.6844    0.59727 0.000 0.500 0.104 0.396
#> SRR1377222     4  0.3024    0.99625 0.148 0.000 0.000 0.852
#> SRR1377223     4  0.3024    0.99625 0.148 0.000 0.000 0.852
#> SRR1377224     4  0.3024    0.99625 0.148 0.000 0.000 0.852

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>            class entropy silhouette    p1    p2    p3    p4    p5
#> SRR1377145     2  0.0992     0.7099 0.024 0.968 0.000 0.008 0.000
#> SRR1377146     2  0.1117     0.7121 0.020 0.964 0.000 0.016 0.000
#> SRR1377147     2  0.1522     0.7054 0.044 0.944 0.000 0.012 0.000
#> SRR1377148     2  0.0880     0.7075 0.032 0.968 0.000 0.000 0.000
#> SRR1377153     2  0.1728     0.7133 0.020 0.940 0.004 0.036 0.000
#> SRR1377154     2  0.1461     0.7139 0.028 0.952 0.004 0.016 0.000
#> SRR1377155     2  0.1377     0.7153 0.020 0.956 0.004 0.020 0.000
#> SRR1377156     2  0.1278     0.7143 0.020 0.960 0.004 0.016 0.000
#> SRR1377149     2  0.2278     0.7104 0.032 0.908 0.000 0.060 0.000
#> SRR1377150     2  0.2362     0.6987 0.024 0.900 0.000 0.076 0.000
#> SRR1377151     2  0.1179     0.7146 0.016 0.964 0.004 0.016 0.000
#> SRR1377152     2  0.1211     0.7154 0.024 0.960 0.000 0.016 0.000
#> SRR1377157     1  0.7009     0.4698 0.552 0.260 0.004 0.060 0.124
#> SRR1377158     1  0.7062     0.4574 0.540 0.272 0.004 0.060 0.124
#> SRR1377159     1  0.6950     0.4834 0.564 0.248 0.004 0.060 0.124
#> SRR1377160     1  0.6950     0.4834 0.564 0.248 0.004 0.060 0.124
#> SRR1377161     1  0.7155     0.4115 0.516 0.296 0.004 0.060 0.124
#> SRR1377162     1  0.7206     0.3788 0.500 0.312 0.004 0.060 0.124
#> SRR1377163     1  0.7283     0.2907 0.468 0.344 0.004 0.060 0.124
#> SRR1377164     1  0.7155     0.4115 0.516 0.296 0.004 0.060 0.124
#> SRR1377169     2  0.6966     0.0868 0.308 0.520 0.004 0.044 0.124
#> SRR1377170     2  0.7063    -0.0224 0.344 0.484 0.004 0.044 0.124
#> SRR1377171     2  0.7025     0.0309 0.328 0.500 0.004 0.044 0.124
#> SRR1377172     2  0.7025     0.0274 0.328 0.500 0.004 0.044 0.124
#> SRR1377165     2  0.7079    -0.0307 0.352 0.476 0.004 0.044 0.124
#> SRR1377166     2  0.7079    -0.0307 0.352 0.476 0.004 0.044 0.124
#> SRR1377167     2  0.7099    -0.0727 0.364 0.464 0.004 0.044 0.124
#> SRR1377168     2  0.7086    -0.0437 0.356 0.472 0.004 0.044 0.124
#> SRR1377173     1  0.2520     0.7204 0.896 0.056 0.000 0.048 0.000
#> SRR1377174     1  0.3033     0.6910 0.864 0.052 0.000 0.084 0.000
#> SRR1377175     1  0.2661     0.7154 0.888 0.056 0.000 0.056 0.000
#> SRR1377176     1  0.2592     0.7181 0.892 0.056 0.000 0.052 0.000
#> SRR1377177     1  0.2359     0.7234 0.904 0.060 0.000 0.036 0.000
#> SRR1377178     1  0.2359     0.7234 0.904 0.060 0.000 0.036 0.000
#> SRR1377179     1  0.2359     0.7234 0.904 0.060 0.000 0.036 0.000
#> SRR1377180     1  0.2359     0.7234 0.904 0.060 0.000 0.036 0.000
#> SRR1377181     1  0.2300     0.7231 0.908 0.052 0.000 0.040 0.000
#> SRR1377182     1  0.2300     0.7231 0.908 0.052 0.000 0.040 0.000
#> SRR1377183     2  0.3093     0.6605 0.008 0.824 0.000 0.168 0.000
#> SRR1377184     1  0.2300     0.7231 0.908 0.052 0.000 0.040 0.000
#> SRR1377185     2  0.3053     0.6643 0.008 0.828 0.000 0.164 0.000
#> SRR1377186     2  0.2971     0.6697 0.008 0.836 0.000 0.156 0.000
#> SRR1377187     1  0.2300     0.7231 0.908 0.052 0.000 0.040 0.000
#> SRR1377188     2  0.2753     0.6825 0.008 0.856 0.000 0.136 0.000
#> SRR1377189     2  0.2389     0.6944 0.004 0.880 0.000 0.116 0.000
#> SRR1377190     2  0.2848     0.6764 0.004 0.840 0.000 0.156 0.000
#> SRR1377191     2  0.3427     0.6207 0.012 0.796 0.000 0.192 0.000
#> SRR1377192     4  0.2732     0.8626 0.000 0.160 0.000 0.840 0.000
#> SRR1377193     4  0.2561     0.8763 0.000 0.144 0.000 0.856 0.000
#> SRR1377194     4  0.2732     0.8641 0.000 0.160 0.000 0.840 0.000
#> SRR1377195     5  0.2329     0.9859 0.000 0.000 0.124 0.000 0.876
#> SRR1377196     5  0.2329     0.9859 0.000 0.000 0.124 0.000 0.876
#> SRR1377197     5  0.2329     0.9859 0.000 0.000 0.124 0.000 0.876
#> SRR1377198     5  0.2921     0.9843 0.000 0.000 0.124 0.020 0.856
#> SRR1377199     5  0.3012     0.9833 0.000 0.000 0.124 0.024 0.852
#> SRR1377200     5  0.3506     0.9680 0.000 0.000 0.132 0.044 0.824
#> SRR1377201     2  0.2773     0.6669 0.000 0.836 0.000 0.164 0.000
#> SRR1377202     2  0.3210     0.6256 0.000 0.788 0.000 0.212 0.000
#> SRR1377203     2  0.2561     0.6842 0.000 0.856 0.000 0.144 0.000
#> SRR1377204     3  0.0404     0.9958 0.000 0.000 0.988 0.012 0.000
#> SRR1377205     3  0.0404     0.9958 0.000 0.000 0.988 0.012 0.000
#> SRR1377206     3  0.0404     0.9958 0.000 0.000 0.988 0.012 0.000
#> SRR1377207     2  0.4862     0.2896 0.032 0.604 0.000 0.364 0.000
#> SRR1377208     2  0.4874     0.2815 0.032 0.600 0.000 0.368 0.000
#> SRR1377209     2  0.4898     0.2732 0.032 0.592 0.000 0.376 0.000
#> SRR1377210     2  0.1908     0.7021 0.000 0.908 0.000 0.092 0.000
#> SRR1377211     2  0.2230     0.6970 0.000 0.884 0.000 0.116 0.000
#> SRR1377212     2  0.2179     0.6985 0.000 0.888 0.000 0.112 0.000
#> SRR1377213     4  0.2774     0.9324 0.012 0.048 0.048 0.892 0.000
#> SRR1377214     4  0.2774     0.9324 0.012 0.048 0.048 0.892 0.000
#> SRR1377215     4  0.2774     0.9324 0.012 0.048 0.048 0.892 0.000
#> SRR1377216     2  0.6597     0.1995 0.320 0.548 0.004 0.044 0.084
#> SRR1377217     2  0.6570     0.2184 0.312 0.556 0.004 0.044 0.084
#> SRR1377218     2  0.6623     0.1783 0.328 0.540 0.004 0.044 0.084
#> SRR1377219     4  0.2701     0.9329 0.012 0.048 0.044 0.896 0.000
#> SRR1377220     4  0.2701     0.9329 0.012 0.048 0.044 0.896 0.000
#> SRR1377221     4  0.2701     0.9329 0.012 0.048 0.044 0.896 0.000
#> SRR1377222     3  0.0290     0.9958 0.000 0.000 0.992 0.008 0.000
#> SRR1377223     3  0.0290     0.9958 0.000 0.000 0.992 0.008 0.000
#> SRR1377224     3  0.0290     0.9958 0.000 0.000 0.992 0.008 0.000

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>            class entropy silhouette    p1    p2    p3    p4    p5    p6
#> SRR1377145     6  0.1552     0.6792 0.036 0.000 0.004 0.020 0.000 0.940
#> SRR1377146     6  0.1503     0.6792 0.032 0.000 0.008 0.016 0.000 0.944
#> SRR1377147     6  0.2036     0.6719 0.048 0.000 0.008 0.028 0.000 0.916
#> SRR1377148     6  0.1461     0.6784 0.044 0.000 0.000 0.016 0.000 0.940
#> SRR1377153     6  0.0837     0.6825 0.020 0.000 0.004 0.004 0.000 0.972
#> SRR1377154     6  0.1080     0.6819 0.032 0.000 0.004 0.004 0.000 0.960
#> SRR1377155     6  0.0951     0.6838 0.020 0.000 0.004 0.008 0.000 0.968
#> SRR1377156     6  0.0692     0.6821 0.020 0.000 0.004 0.000 0.000 0.976
#> SRR1377149     6  0.1421     0.6828 0.028 0.000 0.000 0.028 0.000 0.944
#> SRR1377150     6  0.1401     0.6830 0.028 0.000 0.004 0.020 0.000 0.948
#> SRR1377151     6  0.1341     0.6843 0.028 0.000 0.000 0.024 0.000 0.948
#> SRR1377152     6  0.1074     0.6827 0.028 0.000 0.000 0.012 0.000 0.960
#> SRR1377157     6  0.6131    -0.4723 0.328 0.000 0.336 0.000 0.000 0.336
#> SRR1377158     6  0.6129    -0.4509 0.320 0.000 0.336 0.000 0.000 0.344
#> SRR1377159     3  0.6131     0.3517 0.328 0.000 0.336 0.000 0.000 0.336
#> SRR1377160     3  0.6252     0.3530 0.328 0.000 0.336 0.004 0.000 0.332
#> SRR1377161     3  0.6131     0.3517 0.328 0.000 0.336 0.000 0.000 0.336
#> SRR1377162     6  0.6127    -0.4336 0.316 0.000 0.336 0.000 0.000 0.348
#> SRR1377163     6  0.6118    -0.4016 0.304 0.000 0.336 0.000 0.000 0.360
#> SRR1377164     3  0.6131     0.3517 0.328 0.000 0.336 0.000 0.000 0.336
#> SRR1377169     6  0.6226     0.1178 0.268 0.000 0.208 0.024 0.000 0.500
#> SRR1377170     6  0.6209    -0.0752 0.348 0.000 0.212 0.012 0.000 0.428
#> SRR1377171     6  0.6374    -0.0133 0.316 0.000 0.212 0.024 0.000 0.448
#> SRR1377172     6  0.6389    -0.0373 0.324 0.000 0.212 0.024 0.000 0.440
#> SRR1377165     6  0.6053    -0.0905 0.356 0.000 0.216 0.004 0.000 0.424
#> SRR1377166     6  0.6140    -0.0808 0.348 0.000 0.216 0.008 0.000 0.428
#> SRR1377167     6  0.5934    -0.1083 0.364 0.000 0.216 0.000 0.000 0.420
#> SRR1377168     6  0.5931    -0.0970 0.360 0.000 0.216 0.000 0.000 0.424
#> SRR1377173     1  0.1204     0.9907 0.944 0.000 0.000 0.000 0.000 0.056
#> SRR1377174     1  0.1471     0.9756 0.932 0.000 0.000 0.004 0.000 0.064
#> SRR1377175     1  0.1204     0.9907 0.944 0.000 0.000 0.000 0.000 0.056
#> SRR1377176     1  0.1204     0.9907 0.944 0.000 0.000 0.000 0.000 0.056
#> SRR1377177     1  0.1141     0.9924 0.948 0.000 0.000 0.000 0.000 0.052
#> SRR1377178     1  0.1141     0.9924 0.948 0.000 0.000 0.000 0.000 0.052
#> SRR1377179     1  0.1141     0.9924 0.948 0.000 0.000 0.000 0.000 0.052
#> SRR1377180     1  0.1141     0.9924 0.948 0.000 0.000 0.000 0.000 0.052
#> SRR1377181     1  0.1141     0.9924 0.948 0.000 0.000 0.000 0.000 0.052
#> SRR1377182     1  0.1285     0.9846 0.944 0.000 0.000 0.004 0.000 0.052
#> SRR1377183     6  0.1845     0.6677 0.008 0.000 0.004 0.072 0.000 0.916
#> SRR1377184     1  0.1285     0.9903 0.944 0.000 0.000 0.004 0.000 0.052
#> SRR1377185     6  0.1787     0.6691 0.008 0.000 0.004 0.068 0.000 0.920
#> SRR1377186     6  0.1787     0.6691 0.008 0.000 0.004 0.068 0.000 0.920
#> SRR1377187     1  0.1265     0.9828 0.948 0.000 0.000 0.008 0.000 0.044
#> SRR1377188     6  0.1787     0.6691 0.008 0.000 0.004 0.068 0.000 0.920
#> SRR1377189     6  0.1204     0.6804 0.000 0.000 0.000 0.056 0.000 0.944
#> SRR1377190     6  0.1444     0.6743 0.000 0.000 0.000 0.072 0.000 0.928
#> SRR1377191     6  0.1757     0.6810 0.012 0.000 0.008 0.052 0.000 0.928
#> SRR1377192     4  0.2454     0.8448 0.000 0.000 0.000 0.840 0.000 0.160
#> SRR1377193     4  0.2416     0.8487 0.000 0.000 0.000 0.844 0.000 0.156
#> SRR1377194     4  0.2454     0.8442 0.000 0.000 0.000 0.840 0.000 0.160
#> SRR1377195     5  0.0000     0.9199 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR1377196     5  0.0000     0.9199 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR1377197     5  0.0000     0.9199 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR1377198     5  0.3797     0.7543 0.000 0.000 0.292 0.016 0.692 0.000
#> SRR1377199     3  0.4263    -0.6634 0.000 0.000 0.600 0.024 0.376 0.000
#> SRR1377200     3  0.4224    -0.6464 0.000 0.000 0.632 0.028 0.340 0.000
#> SRR1377201     6  0.1387     0.6757 0.000 0.000 0.000 0.068 0.000 0.932
#> SRR1377202     6  0.1610     0.6704 0.000 0.000 0.000 0.084 0.000 0.916
#> SRR1377203     6  0.1444     0.6746 0.000 0.000 0.000 0.072 0.000 0.928
#> SRR1377204     2  0.0000     1.0000 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR1377205     2  0.0000     1.0000 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR1377206     2  0.0000     1.0000 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR1377207     6  0.2058     0.6681 0.012 0.000 0.008 0.072 0.000 0.908
#> SRR1377208     6  0.2114     0.6664 0.012 0.000 0.008 0.076 0.000 0.904
#> SRR1377209     6  0.2418     0.6604 0.016 0.000 0.008 0.092 0.000 0.884
#> SRR1377210     6  0.1219     0.6800 0.000 0.000 0.004 0.048 0.000 0.948
#> SRR1377211     6  0.1219     0.6800 0.000 0.000 0.004 0.048 0.000 0.948
#> SRR1377212     6  0.1219     0.6800 0.000 0.000 0.004 0.048 0.000 0.948
#> SRR1377213     4  0.1003     0.9121 0.004 0.004 0.000 0.964 0.000 0.028
#> SRR1377214     4  0.1003     0.9121 0.004 0.004 0.000 0.964 0.000 0.028
#> SRR1377215     4  0.1003     0.9121 0.004 0.004 0.000 0.964 0.000 0.028
#> SRR1377216     6  0.5845     0.1538 0.352 0.000 0.156 0.008 0.000 0.484
#> SRR1377217     6  0.5813     0.1887 0.336 0.000 0.156 0.008 0.000 0.500
#> SRR1377218     6  0.5852     0.1442 0.356 0.000 0.156 0.008 0.000 0.480
#> SRR1377219     4  0.1226     0.9187 0.004 0.004 0.000 0.952 0.000 0.040
#> SRR1377220     4  0.1226     0.9187 0.004 0.004 0.000 0.952 0.000 0.040
#> SRR1377221     4  0.1226     0.9187 0.004 0.004 0.000 0.952 0.000 0.040
#> SRR1377222     2  0.0000     1.0000 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR1377223     2  0.0000     1.0000 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR1377224     2  0.0000     1.0000 0.000 1.000 0.000 0.000 0.000 0.000

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

consensus_heatmap(res, k = 2)

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

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

collect_plots(res)

plot of chunk ATC-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.948           0.903       0.959          0.103 0.904   0.904
#> 3 3 0.455           0.793       0.884          1.137 0.951   0.945
#> 4 4 0.353           0.664       0.811          0.621 0.763   0.724
#> 5 5 0.274           0.614       0.792          0.370 0.931   0.891
#> 6 6 0.306           0.608       0.757          0.308 0.758   0.580

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

suggest_best_k(res)
#> [1] 2

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

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

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>            class entropy silhouette    p1    p2
#> SRR1377145     2  0.0000      0.963 0.000 1.000
#> SRR1377146     2  0.0000      0.963 0.000 1.000
#> SRR1377147     2  0.0000      0.963 0.000 1.000
#> SRR1377148     2  0.0000      0.963 0.000 1.000
#> SRR1377153     2  0.0000      0.963 0.000 1.000
#> SRR1377154     2  0.0000      0.963 0.000 1.000
#> SRR1377155     2  0.0000      0.963 0.000 1.000
#> SRR1377156     2  0.0376      0.961 0.004 0.996
#> SRR1377149     2  0.0938      0.957 0.012 0.988
#> SRR1377150     2  0.0672      0.960 0.008 0.992
#> SRR1377151     2  0.0000      0.963 0.000 1.000
#> SRR1377152     2  0.0376      0.961 0.004 0.996
#> SRR1377157     2  0.0376      0.960 0.004 0.996
#> SRR1377158     2  0.0376      0.960 0.004 0.996
#> SRR1377159     2  0.0376      0.960 0.004 0.996
#> SRR1377160     2  0.0376      0.960 0.004 0.996
#> SRR1377161     2  0.0376      0.960 0.004 0.996
#> SRR1377162     2  0.0376      0.960 0.004 0.996
#> SRR1377163     2  0.0000      0.963 0.000 1.000
#> SRR1377164     2  0.0376      0.960 0.004 0.996
#> SRR1377169     2  0.0000      0.963 0.000 1.000
#> SRR1377170     2  0.0000      0.963 0.000 1.000
#> SRR1377171     2  0.0000      0.963 0.000 1.000
#> SRR1377172     2  0.0000      0.963 0.000 1.000
#> SRR1377165     2  0.0000      0.963 0.000 1.000
#> SRR1377166     2  0.0000      0.963 0.000 1.000
#> SRR1377167     2  0.0000      0.963 0.000 1.000
#> SRR1377168     2  0.0000      0.963 0.000 1.000
#> SRR1377173     2  0.0000      0.963 0.000 1.000
#> SRR1377174     2  0.0000      0.963 0.000 1.000
#> SRR1377175     2  0.0000      0.963 0.000 1.000
#> SRR1377176     2  0.0000      0.963 0.000 1.000
#> SRR1377177     2  0.0000      0.963 0.000 1.000
#> SRR1377178     2  0.0000      0.963 0.000 1.000
#> SRR1377179     2  0.0000      0.963 0.000 1.000
#> SRR1377180     2  0.0000      0.963 0.000 1.000
#> SRR1377181     2  0.0000      0.963 0.000 1.000
#> SRR1377182     2  0.0376      0.960 0.004 0.996
#> SRR1377183     2  0.0672      0.960 0.008 0.992
#> SRR1377184     2  0.0000      0.963 0.000 1.000
#> SRR1377185     2  0.0376      0.961 0.004 0.996
#> SRR1377186     2  0.0376      0.961 0.004 0.996
#> SRR1377187     2  0.0376      0.960 0.004 0.996
#> SRR1377188     2  0.0672      0.960 0.008 0.992
#> SRR1377189     2  0.0938      0.957 0.012 0.988
#> SRR1377190     2  0.0672      0.960 0.008 0.992
#> SRR1377191     2  0.0672      0.960 0.008 0.992
#> SRR1377192     2  0.1414      0.951 0.020 0.980
#> SRR1377193     2  0.1633      0.947 0.024 0.976
#> SRR1377194     2  0.1633      0.947 0.024 0.976
#> SRR1377195     2  0.9998     -0.644 0.492 0.508
#> SRR1377196     2  0.9988     -0.599 0.480 0.520
#> SRR1377197     1  0.9954      0.686 0.540 0.460
#> SRR1377198     1  0.8813      0.799 0.700 0.300
#> SRR1377199     1  0.8443      0.787 0.728 0.272
#> SRR1377200     1  0.9608      0.768 0.616 0.384
#> SRR1377201     2  0.1184      0.954 0.016 0.984
#> SRR1377202     2  0.1184      0.954 0.016 0.984
#> SRR1377203     2  0.1184      0.954 0.016 0.984
#> SRR1377204     2  0.4022      0.871 0.080 0.920
#> SRR1377205     2  0.4161      0.865 0.084 0.916
#> SRR1377206     2  0.4022      0.871 0.080 0.920
#> SRR1377207     2  0.0672      0.960 0.008 0.992
#> SRR1377208     2  0.0376      0.961 0.004 0.996
#> SRR1377209     2  0.0672      0.960 0.008 0.992
#> SRR1377210     2  0.0000      0.963 0.000 1.000
#> SRR1377211     2  0.0000      0.963 0.000 1.000
#> SRR1377212     2  0.0000      0.963 0.000 1.000
#> SRR1377213     2  0.1633      0.947 0.024 0.976
#> SRR1377214     2  0.1633      0.947 0.024 0.976
#> SRR1377215     2  0.1633      0.947 0.024 0.976
#> SRR1377216     2  0.0000      0.963 0.000 1.000
#> SRR1377217     2  0.0000      0.963 0.000 1.000
#> SRR1377218     2  0.0000      0.963 0.000 1.000
#> SRR1377219     2  0.1414      0.951 0.020 0.980
#> SRR1377220     2  0.1184      0.954 0.016 0.984
#> SRR1377221     2  0.1414      0.951 0.020 0.980
#> SRR1377222     2  0.4298      0.859 0.088 0.912
#> SRR1377223     2  0.4298      0.859 0.088 0.912
#> SRR1377224     2  0.4298      0.859 0.088 0.912

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>            class entropy silhouette    p1    p2    p3
#> SRR1377145     2  0.0000      0.892 0.000 1.000 0.000
#> SRR1377146     2  0.0000      0.892 0.000 1.000 0.000
#> SRR1377147     2  0.0237      0.892 0.000 0.996 0.004
#> SRR1377148     2  0.0237      0.892 0.000 0.996 0.004
#> SRR1377153     2  0.0747      0.891 0.000 0.984 0.016
#> SRR1377154     2  0.0000      0.892 0.000 1.000 0.000
#> SRR1377155     2  0.0424      0.891 0.000 0.992 0.008
#> SRR1377156     2  0.1163      0.890 0.000 0.972 0.028
#> SRR1377149     2  0.1163      0.890 0.000 0.972 0.028
#> SRR1377150     2  0.0892      0.891 0.000 0.980 0.020
#> SRR1377151     2  0.0237      0.892 0.000 0.996 0.004
#> SRR1377152     2  0.1031      0.891 0.000 0.976 0.024
#> SRR1377157     2  0.3349      0.851 0.004 0.888 0.108
#> SRR1377158     2  0.3771      0.840 0.012 0.876 0.112
#> SRR1377159     2  0.3845      0.836 0.012 0.872 0.116
#> SRR1377160     2  0.3682      0.840 0.008 0.876 0.116
#> SRR1377161     2  0.3272      0.854 0.004 0.892 0.104
#> SRR1377162     2  0.3272      0.854 0.004 0.892 0.104
#> SRR1377163     2  0.3112      0.861 0.004 0.900 0.096
#> SRR1377164     2  0.3349      0.851 0.004 0.888 0.108
#> SRR1377169     2  0.1529      0.887 0.000 0.960 0.040
#> SRR1377170     2  0.1643      0.887 0.000 0.956 0.044
#> SRR1377171     2  0.1643      0.887 0.000 0.956 0.044
#> SRR1377172     2  0.1289      0.889 0.000 0.968 0.032
#> SRR1377165     2  0.2448      0.875 0.000 0.924 0.076
#> SRR1377166     2  0.2066      0.883 0.000 0.940 0.060
#> SRR1377167     2  0.2448      0.875 0.000 0.924 0.076
#> SRR1377168     2  0.2356      0.877 0.000 0.928 0.072
#> SRR1377173     2  0.1529      0.887 0.000 0.960 0.040
#> SRR1377174     2  0.2165      0.881 0.000 0.936 0.064
#> SRR1377175     2  0.2261      0.879 0.000 0.932 0.068
#> SRR1377176     2  0.1964      0.884 0.000 0.944 0.056
#> SRR1377177     2  0.2711      0.868 0.000 0.912 0.088
#> SRR1377178     2  0.2625      0.871 0.000 0.916 0.084
#> SRR1377179     2  0.2796      0.866 0.000 0.908 0.092
#> SRR1377180     2  0.2860      0.869 0.004 0.912 0.084
#> SRR1377181     2  0.2625      0.871 0.000 0.916 0.084
#> SRR1377182     2  0.2796      0.866 0.000 0.908 0.092
#> SRR1377183     2  0.1753      0.885 0.000 0.952 0.048
#> SRR1377184     2  0.2796      0.866 0.000 0.908 0.092
#> SRR1377185     2  0.1964      0.882 0.000 0.944 0.056
#> SRR1377186     2  0.2261      0.877 0.000 0.932 0.068
#> SRR1377187     2  0.2711      0.869 0.000 0.912 0.088
#> SRR1377188     2  0.2261      0.877 0.000 0.932 0.068
#> SRR1377189     2  0.2625      0.869 0.000 0.916 0.084
#> SRR1377190     2  0.2537      0.871 0.000 0.920 0.080
#> SRR1377191     2  0.1753      0.885 0.000 0.952 0.048
#> SRR1377192     2  0.3686      0.826 0.000 0.860 0.140
#> SRR1377193     2  0.3752      0.823 0.000 0.856 0.144
#> SRR1377194     2  0.3686      0.826 0.000 0.860 0.140
#> SRR1377195     1  0.9258      0.217 0.528 0.216 0.256
#> SRR1377196     3  0.9982     -0.278 0.344 0.304 0.352
#> SRR1377197     1  0.9653      0.174 0.448 0.224 0.328
#> SRR1377198     1  0.8918      0.230 0.548 0.156 0.296
#> SRR1377199     1  0.7843      0.181 0.664 0.128 0.208
#> SRR1377200     3  0.7717     -0.336 0.220 0.112 0.668
#> SRR1377201     2  0.2625      0.869 0.000 0.916 0.084
#> SRR1377202     2  0.2796      0.864 0.000 0.908 0.092
#> SRR1377203     2  0.2796      0.864 0.000 0.908 0.092
#> SRR1377204     2  0.5058      0.693 0.000 0.756 0.244
#> SRR1377205     2  0.5058      0.693 0.000 0.756 0.244
#> SRR1377206     2  0.5058      0.693 0.000 0.756 0.244
#> SRR1377207     2  0.1753      0.885 0.000 0.952 0.048
#> SRR1377208     2  0.1411      0.888 0.000 0.964 0.036
#> SRR1377209     2  0.1643      0.886 0.000 0.956 0.044
#> SRR1377210     2  0.1860      0.884 0.000 0.948 0.052
#> SRR1377211     2  0.1860      0.884 0.000 0.948 0.052
#> SRR1377212     2  0.2066      0.881 0.000 0.940 0.060
#> SRR1377213     2  0.4178      0.793 0.000 0.828 0.172
#> SRR1377214     2  0.4121      0.798 0.000 0.832 0.168
#> SRR1377215     2  0.4178      0.793 0.000 0.828 0.172
#> SRR1377216     2  0.1964      0.884 0.000 0.944 0.056
#> SRR1377217     2  0.1964      0.884 0.000 0.944 0.056
#> SRR1377218     2  0.2165      0.881 0.000 0.936 0.064
#> SRR1377219     2  0.3412      0.841 0.000 0.876 0.124
#> SRR1377220     2  0.3412      0.840 0.000 0.876 0.124
#> SRR1377221     2  0.3340      0.844 0.000 0.880 0.120
#> SRR1377222     2  0.5138      0.679 0.000 0.748 0.252
#> SRR1377223     2  0.5138      0.679 0.000 0.748 0.252
#> SRR1377224     2  0.5138      0.679 0.000 0.748 0.252

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> SRR1377145     2  0.2530     0.7840 0.004 0.896 0.100 0.000
#> SRR1377146     2  0.2466     0.7859 0.004 0.900 0.096 0.000
#> SRR1377147     2  0.2401     0.7871 0.004 0.904 0.092 0.000
#> SRR1377148     2  0.2334     0.7886 0.004 0.908 0.088 0.000
#> SRR1377153     2  0.2888     0.7697 0.004 0.872 0.124 0.000
#> SRR1377154     2  0.2593     0.7821 0.004 0.892 0.104 0.000
#> SRR1377155     2  0.2999     0.7644 0.004 0.864 0.132 0.000
#> SRR1377156     2  0.3306     0.7443 0.004 0.840 0.156 0.000
#> SRR1377149     2  0.3052     0.7613 0.004 0.860 0.136 0.000
#> SRR1377150     2  0.3105     0.7594 0.004 0.856 0.140 0.000
#> SRR1377151     2  0.2593     0.7818 0.004 0.892 0.104 0.000
#> SRR1377152     2  0.2831     0.7723 0.004 0.876 0.120 0.000
#> SRR1377157     2  0.2553     0.7331 0.016 0.916 0.060 0.008
#> SRR1377158     2  0.2761     0.7230 0.016 0.908 0.064 0.012
#> SRR1377159     2  0.3321     0.6951 0.024 0.888 0.064 0.024
#> SRR1377160     2  0.2995     0.7123 0.016 0.900 0.064 0.020
#> SRR1377161     2  0.2076     0.7517 0.004 0.932 0.056 0.008
#> SRR1377162     2  0.1847     0.7602 0.004 0.940 0.052 0.004
#> SRR1377163     2  0.1576     0.7683 0.004 0.948 0.048 0.000
#> SRR1377164     2  0.2076     0.7517 0.004 0.932 0.056 0.008
#> SRR1377169     2  0.0921     0.8016 0.000 0.972 0.028 0.000
#> SRR1377170     2  0.0469     0.8021 0.000 0.988 0.012 0.000
#> SRR1377171     2  0.0817     0.8019 0.000 0.976 0.024 0.000
#> SRR1377172     2  0.0817     0.8027 0.000 0.976 0.024 0.000
#> SRR1377165     2  0.0469     0.7963 0.000 0.988 0.012 0.000
#> SRR1377166     2  0.0000     0.8005 0.000 1.000 0.000 0.000
#> SRR1377167     2  0.0592     0.7940 0.000 0.984 0.016 0.000
#> SRR1377168     2  0.0336     0.7980 0.000 0.992 0.008 0.000
#> SRR1377173     2  0.0592     0.8007 0.000 0.984 0.016 0.000
#> SRR1377174     2  0.0817     0.8024 0.000 0.976 0.024 0.000
#> SRR1377175     2  0.0469     0.7993 0.000 0.988 0.012 0.000
#> SRR1377176     2  0.0592     0.8007 0.000 0.984 0.016 0.000
#> SRR1377177     2  0.1004     0.7876 0.000 0.972 0.024 0.004
#> SRR1377178     2  0.1004     0.7928 0.000 0.972 0.024 0.004
#> SRR1377179     2  0.1151     0.7850 0.000 0.968 0.024 0.008
#> SRR1377180     2  0.1042     0.7878 0.000 0.972 0.020 0.008
#> SRR1377181     2  0.0895     0.7900 0.000 0.976 0.020 0.004
#> SRR1377182     2  0.1256     0.7821 0.000 0.964 0.028 0.008
#> SRR1377183     2  0.3751     0.6979 0.004 0.800 0.196 0.000
#> SRR1377184     2  0.1452     0.7759 0.000 0.956 0.036 0.008
#> SRR1377185     2  0.3710     0.7034 0.004 0.804 0.192 0.000
#> SRR1377186     2  0.4053     0.6427 0.004 0.768 0.228 0.000
#> SRR1377187     2  0.1022     0.7853 0.000 0.968 0.032 0.000
#> SRR1377188     2  0.4018     0.6505 0.004 0.772 0.224 0.000
#> SRR1377189     2  0.4343     0.5578 0.004 0.732 0.264 0.000
#> SRR1377190     2  0.4155     0.6166 0.004 0.756 0.240 0.000
#> SRR1377191     2  0.3831     0.6859 0.004 0.792 0.204 0.000
#> SRR1377192     3  0.5080     0.7863 0.004 0.420 0.576 0.000
#> SRR1377193     3  0.5080     0.7864 0.004 0.420 0.576 0.000
#> SRR1377194     3  0.5050     0.8115 0.004 0.408 0.588 0.000
#> SRR1377195     1  0.9864     0.1769 0.308 0.236 0.180 0.276
#> SRR1377196     4  0.9991    -0.3706 0.256 0.240 0.236 0.268
#> SRR1377197     1  0.9866     0.1835 0.320 0.248 0.184 0.248
#> SRR1377198     4  0.5442     0.0753 0.128 0.016 0.092 0.764
#> SRR1377199     1  0.3505    -0.1855 0.864 0.048 0.088 0.000
#> SRR1377200     4  0.8502     0.0649 0.304 0.024 0.292 0.380
#> SRR1377201     2  0.4188     0.6076 0.004 0.752 0.244 0.000
#> SRR1377202     2  0.4456     0.5129 0.004 0.716 0.280 0.000
#> SRR1377203     2  0.4535     0.4750 0.004 0.704 0.292 0.000
#> SRR1377204     3  0.4356     0.8762 0.000 0.292 0.708 0.000
#> SRR1377205     3  0.4356     0.8762 0.000 0.292 0.708 0.000
#> SRR1377206     3  0.4356     0.8762 0.000 0.292 0.708 0.000
#> SRR1377207     2  0.3626     0.7137 0.004 0.812 0.184 0.000
#> SRR1377208     2  0.3448     0.7316 0.004 0.828 0.168 0.000
#> SRR1377209     2  0.3710     0.7031 0.004 0.804 0.192 0.000
#> SRR1377210     2  0.3710     0.7031 0.004 0.804 0.192 0.000
#> SRR1377211     2  0.3626     0.7134 0.004 0.812 0.184 0.000
#> SRR1377212     2  0.3668     0.7084 0.004 0.808 0.188 0.000
#> SRR1377213     3  0.4905     0.8811 0.000 0.364 0.632 0.004
#> SRR1377214     3  0.4730     0.8791 0.000 0.364 0.636 0.000
#> SRR1377215     3  0.4905     0.8811 0.000 0.364 0.632 0.004
#> SRR1377216     2  0.0469     0.8017 0.000 0.988 0.012 0.000
#> SRR1377217     2  0.0188     0.8013 0.000 0.996 0.004 0.000
#> SRR1377218     2  0.0469     0.7999 0.000 0.988 0.012 0.000
#> SRR1377219     2  0.4989    -0.4335 0.000 0.528 0.472 0.000
#> SRR1377220     2  0.4948    -0.2782 0.000 0.560 0.440 0.000
#> SRR1377221     2  0.4955    -0.2986 0.000 0.556 0.444 0.000
#> SRR1377222     3  0.4535     0.8731 0.000 0.292 0.704 0.004
#> SRR1377223     3  0.4535     0.8731 0.000 0.292 0.704 0.004
#> SRR1377224     3  0.4535     0.8731 0.000 0.292 0.704 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
#> SRR1377145     2  0.4094     0.7272 0.000 0.788 0.084 0.128 0.000
#> SRR1377146     2  0.4054     0.7263 0.000 0.788 0.072 0.140 0.000
#> SRR1377147     2  0.3921     0.7312 0.000 0.800 0.072 0.128 0.000
#> SRR1377148     2  0.4083     0.7273 0.000 0.788 0.080 0.132 0.000
#> SRR1377153     2  0.4869     0.6868 0.000 0.712 0.096 0.192 0.000
#> SRR1377154     2  0.4573     0.7079 0.000 0.744 0.092 0.164 0.000
#> SRR1377155     2  0.4836     0.6888 0.000 0.716 0.096 0.188 0.000
#> SRR1377156     2  0.5024     0.6690 0.000 0.692 0.096 0.212 0.000
#> SRR1377149     2  0.4462     0.6992 0.000 0.740 0.064 0.196 0.000
#> SRR1377150     2  0.4587     0.6943 0.000 0.728 0.068 0.204 0.000
#> SRR1377151     2  0.4197     0.7213 0.000 0.776 0.076 0.148 0.000
#> SRR1377152     2  0.4571     0.7018 0.000 0.736 0.076 0.188 0.000
#> SRR1377157     2  0.2660     0.6797 0.000 0.864 0.128 0.008 0.000
#> SRR1377158     2  0.2583     0.6813 0.000 0.864 0.132 0.004 0.000
#> SRR1377159     2  0.2660     0.6797 0.000 0.864 0.128 0.008 0.000
#> SRR1377160     2  0.2612     0.6830 0.000 0.868 0.124 0.008 0.000
#> SRR1377161     2  0.2439     0.6905 0.000 0.876 0.120 0.004 0.000
#> SRR1377162     2  0.2389     0.6936 0.000 0.880 0.116 0.004 0.000
#> SRR1377163     2  0.2439     0.6905 0.000 0.876 0.120 0.004 0.000
#> SRR1377164     2  0.2439     0.6905 0.000 0.876 0.120 0.004 0.000
#> SRR1377169     2  0.3237     0.7290 0.000 0.848 0.104 0.048 0.000
#> SRR1377170     2  0.3058     0.7320 0.000 0.860 0.096 0.044 0.000
#> SRR1377171     2  0.3164     0.7273 0.000 0.852 0.104 0.044 0.000
#> SRR1377172     2  0.3184     0.7312 0.000 0.852 0.100 0.048 0.000
#> SRR1377165     2  0.2915     0.7105 0.000 0.860 0.116 0.024 0.000
#> SRR1377166     2  0.3085     0.7147 0.000 0.852 0.116 0.032 0.000
#> SRR1377167     2  0.2824     0.7076 0.000 0.864 0.116 0.020 0.000
#> SRR1377168     2  0.3002     0.7128 0.000 0.856 0.116 0.028 0.000
#> SRR1377173     2  0.1012     0.7482 0.000 0.968 0.012 0.020 0.000
#> SRR1377174     2  0.1568     0.7512 0.000 0.944 0.020 0.036 0.000
#> SRR1377175     2  0.1211     0.7491 0.000 0.960 0.016 0.024 0.000
#> SRR1377176     2  0.1310     0.7492 0.000 0.956 0.020 0.024 0.000
#> SRR1377177     2  0.0794     0.7387 0.000 0.972 0.028 0.000 0.000
#> SRR1377178     2  0.0671     0.7441 0.000 0.980 0.016 0.004 0.000
#> SRR1377179     2  0.0609     0.7383 0.000 0.980 0.020 0.000 0.000
#> SRR1377180     2  0.0880     0.7363 0.000 0.968 0.032 0.000 0.000
#> SRR1377181     2  0.0771     0.7418 0.000 0.976 0.020 0.004 0.000
#> SRR1377182     2  0.0794     0.7369 0.000 0.972 0.028 0.000 0.000
#> SRR1377183     2  0.3814     0.6612 0.000 0.720 0.004 0.276 0.000
#> SRR1377184     2  0.1043     0.7345 0.000 0.960 0.040 0.000 0.000
#> SRR1377185     2  0.3838     0.6496 0.000 0.716 0.004 0.280 0.000
#> SRR1377186     2  0.4356     0.5717 0.000 0.648 0.012 0.340 0.000
#> SRR1377187     2  0.0963     0.7350 0.000 0.964 0.036 0.000 0.000
#> SRR1377188     2  0.4165     0.6014 0.000 0.672 0.008 0.320 0.000
#> SRR1377189     2  0.5529     0.3132 0.000 0.512 0.068 0.420 0.000
#> SRR1377190     2  0.5458     0.4259 0.000 0.552 0.068 0.380 0.000
#> SRR1377191     2  0.5199     0.5924 0.000 0.636 0.072 0.292 0.000
#> SRR1377192     4  0.3958     0.6921 0.000 0.176 0.044 0.780 0.000
#> SRR1377193     4  0.3835     0.7097 0.000 0.156 0.048 0.796 0.000
#> SRR1377194     4  0.3681     0.7194 0.000 0.148 0.044 0.808 0.000
#> SRR1377195     1  0.9955    -0.0173 0.220 0.212 0.216 0.156 0.196
#> SRR1377196     1  0.9891    -0.0124 0.236 0.220 0.224 0.136 0.184
#> SRR1377197     3  0.9542    -0.3176 0.224 0.204 0.328 0.104 0.140
#> SRR1377198     5  0.0867     0.0000 0.008 0.008 0.000 0.008 0.976
#> SRR1377199     3  0.5103    -0.3594 0.128 0.000 0.724 0.012 0.136
#> SRR1377200     1  0.1768    -0.3532 0.924 0.000 0.000 0.004 0.072
#> SRR1377201     2  0.5598     0.4223 0.000 0.544 0.080 0.376 0.000
#> SRR1377202     2  0.5689     0.2285 0.000 0.480 0.080 0.440 0.000
#> SRR1377203     2  0.5638     0.2582 0.000 0.492 0.076 0.432 0.000
#> SRR1377204     4  0.0794     0.8017 0.000 0.028 0.000 0.972 0.000
#> SRR1377205     4  0.0794     0.8017 0.000 0.028 0.000 0.972 0.000
#> SRR1377206     4  0.0794     0.8017 0.000 0.028 0.000 0.972 0.000
#> SRR1377207     2  0.5391     0.5744 0.000 0.616 0.084 0.300 0.000
#> SRR1377208     2  0.5275     0.6071 0.000 0.640 0.084 0.276 0.000
#> SRR1377209     2  0.5355     0.5868 0.000 0.624 0.084 0.292 0.000
#> SRR1377210     2  0.5218     0.5859 0.000 0.632 0.072 0.296 0.000
#> SRR1377211     2  0.5083     0.6124 0.000 0.652 0.068 0.280 0.000
#> SRR1377212     2  0.5237     0.5798 0.000 0.628 0.072 0.300 0.000
#> SRR1377213     4  0.1695     0.8017 0.008 0.044 0.008 0.940 0.000
#> SRR1377214     4  0.1618     0.8036 0.008 0.040 0.008 0.944 0.000
#> SRR1377215     4  0.1618     0.8036 0.008 0.040 0.008 0.944 0.000
#> SRR1377216     2  0.2209     0.7444 0.000 0.912 0.056 0.032 0.000
#> SRR1377217     2  0.2278     0.7410 0.000 0.908 0.060 0.032 0.000
#> SRR1377218     2  0.2171     0.7368 0.000 0.912 0.064 0.024 0.000
#> SRR1377219     4  0.4106     0.6059 0.000 0.256 0.020 0.724 0.000
#> SRR1377220     4  0.4464     0.5505 0.000 0.288 0.028 0.684 0.000
#> SRR1377221     4  0.4315     0.5762 0.000 0.276 0.024 0.700 0.000
#> SRR1377222     4  0.1243     0.7986 0.008 0.028 0.004 0.960 0.000
#> SRR1377223     4  0.1243     0.7986 0.008 0.028 0.004 0.960 0.000
#> SRR1377224     4  0.1243     0.7986 0.008 0.028 0.004 0.960 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
#> SRR1377145     1   0.307      0.699 0.856 0.028 0.096 0.008 0.012 0.000
#> SRR1377146     1   0.321      0.696 0.844 0.028 0.108 0.008 0.012 0.000
#> SRR1377147     1   0.321      0.695 0.844 0.028 0.108 0.008 0.012 0.000
#> SRR1377148     1   0.305      0.695 0.848 0.028 0.112 0.004 0.008 0.000
#> SRR1377153     1   0.229      0.679 0.912 0.028 0.020 0.032 0.008 0.000
#> SRR1377154     1   0.204      0.687 0.924 0.028 0.028 0.012 0.008 0.000
#> SRR1377155     1   0.197      0.686 0.928 0.028 0.020 0.016 0.008 0.000
#> SRR1377156     1   0.214      0.683 0.920 0.028 0.020 0.024 0.008 0.000
#> SRR1377149     1   0.338      0.705 0.848 0.028 0.080 0.032 0.012 0.000
#> SRR1377150     1   0.337      0.706 0.844 0.032 0.092 0.020 0.012 0.000
#> SRR1377151     1   0.287      0.704 0.876 0.032 0.068 0.012 0.012 0.000
#> SRR1377152     1   0.308      0.704 0.864 0.032 0.076 0.016 0.012 0.000
#> SRR1377157     3   0.210      0.886 0.112 0.000 0.884 0.004 0.000 0.000
#> SRR1377158     3   0.215      0.890 0.116 0.000 0.880 0.004 0.000 0.000
#> SRR1377159     3   0.235      0.887 0.112 0.004 0.876 0.008 0.000 0.000
#> SRR1377160     3   0.219      0.893 0.120 0.000 0.876 0.004 0.000 0.000
#> SRR1377161     3   0.266      0.897 0.152 0.000 0.840 0.004 0.004 0.000
#> SRR1377162     3   0.270      0.895 0.156 0.000 0.836 0.004 0.004 0.000
#> SRR1377163     3   0.270      0.896 0.156 0.000 0.836 0.004 0.004 0.000
#> SRR1377164     3   0.260      0.892 0.160 0.000 0.836 0.000 0.004 0.000
#> SRR1377169     3   0.378      0.886 0.168 0.008 0.784 0.032 0.008 0.000
#> SRR1377170     3   0.356      0.883 0.172 0.008 0.792 0.024 0.004 0.000
#> SRR1377171     3   0.332      0.889 0.164 0.000 0.804 0.028 0.004 0.000
#> SRR1377172     3   0.359      0.881 0.164 0.004 0.788 0.044 0.000 0.000
#> SRR1377165     3   0.284      0.886 0.116 0.004 0.852 0.028 0.000 0.000
#> SRR1377166     3   0.312      0.880 0.116 0.004 0.836 0.044 0.000 0.000
#> SRR1377167     3   0.262      0.889 0.116 0.000 0.860 0.024 0.000 0.000
#> SRR1377168     3   0.277      0.887 0.116 0.000 0.852 0.032 0.000 0.000
#> SRR1377173     1   0.441      0.494 0.664 0.012 0.300 0.008 0.016 0.000
#> SRR1377174     1   0.438      0.481 0.652 0.012 0.316 0.004 0.016 0.000
#> SRR1377175     1   0.468      0.436 0.624 0.020 0.332 0.004 0.020 0.000
#> SRR1377176     1   0.408      0.564 0.716 0.012 0.252 0.008 0.012 0.000
#> SRR1377177     1   0.435      0.461 0.640 0.012 0.332 0.004 0.012 0.000
#> SRR1377178     1   0.422      0.506 0.672 0.012 0.300 0.004 0.012 0.000
#> SRR1377179     1   0.475      0.450 0.628 0.024 0.324 0.008 0.016 0.000
#> SRR1377180     1   0.466      0.346 0.588 0.016 0.376 0.004 0.016 0.000
#> SRR1377181     1   0.482      0.389 0.608 0.024 0.344 0.008 0.016 0.000
#> SRR1377182     1   0.490      0.334 0.588 0.020 0.364 0.012 0.016 0.000
#> SRR1377183     1   0.618      0.420 0.540 0.016 0.276 0.152 0.016 0.000
#> SRR1377184     1   0.505      0.218 0.548 0.024 0.400 0.012 0.016 0.000
#> SRR1377185     1   0.566      0.537 0.612 0.016 0.244 0.116 0.012 0.000
#> SRR1377186     1   0.618      0.476 0.528 0.016 0.188 0.260 0.008 0.000
#> SRR1377187     1   0.480      0.212 0.552 0.020 0.408 0.004 0.016 0.000
#> SRR1377188     1   0.624      0.474 0.532 0.016 0.196 0.244 0.012 0.000
#> SRR1377189     1   0.417      0.571 0.748 0.036 0.012 0.196 0.008 0.000
#> SRR1377190     1   0.406      0.639 0.784 0.036 0.028 0.144 0.008 0.000
#> SRR1377191     1   0.395      0.673 0.804 0.036 0.040 0.112 0.008 0.000
#> SRR1377192     4   0.475      0.317 0.452 0.024 0.004 0.512 0.008 0.000
#> SRR1377193     4   0.475      0.324 0.448 0.024 0.004 0.516 0.008 0.000
#> SRR1377194     4   0.457      0.367 0.436 0.020 0.004 0.536 0.004 0.000
#> SRR1377195     5   0.987      0.222 0.180 0.180 0.140 0.116 0.232 0.152
#> SRR1377196     5   0.994      0.194 0.136 0.176 0.192 0.132 0.196 0.168
#> SRR1377197     5   0.960      0.217 0.144 0.172 0.156 0.092 0.304 0.132
#> SRR1377198     6   0.000      0.000 0.000 0.000 0.000 0.000 0.000 1.000
#> SRR1377199     5   0.259     -0.137 0.000 0.032 0.000 0.000 0.868 0.100
#> SRR1377200     2   0.278      0.000 0.000 0.860 0.000 0.000 0.052 0.088
#> SRR1377201     1   0.347      0.636 0.816 0.032 0.012 0.136 0.004 0.000
#> SRR1377202     1   0.377      0.598 0.788 0.028 0.012 0.164 0.008 0.000
#> SRR1377203     1   0.374      0.595 0.784 0.028 0.008 0.172 0.008 0.000
#> SRR1377204     4   0.201      0.721 0.104 0.004 0.000 0.892 0.000 0.000
#> SRR1377205     4   0.196      0.722 0.100 0.004 0.000 0.896 0.000 0.000
#> SRR1377206     4   0.205      0.719 0.108 0.004 0.000 0.888 0.000 0.000
#> SRR1377207     1   0.281      0.668 0.880 0.044 0.012 0.056 0.008 0.000
#> SRR1377208     1   0.277      0.675 0.884 0.040 0.016 0.052 0.008 0.000
#> SRR1377209     1   0.274      0.670 0.884 0.040 0.012 0.056 0.008 0.000
#> SRR1377210     1   0.356      0.674 0.824 0.028 0.032 0.112 0.004 0.000
#> SRR1377211     1   0.367      0.687 0.820 0.028 0.044 0.104 0.004 0.000
#> SRR1377212     1   0.360      0.669 0.820 0.032 0.028 0.116 0.004 0.000
#> SRR1377213     4   0.165      0.722 0.040 0.008 0.016 0.936 0.000 0.000
#> SRR1377214     4   0.156      0.725 0.040 0.008 0.012 0.940 0.000 0.000
#> SRR1377215     4   0.165      0.722 0.040 0.008 0.016 0.936 0.000 0.000
#> SRR1377216     3   0.483      0.563 0.352 0.028 0.600 0.008 0.012 0.000
#> SRR1377217     3   0.481      0.587 0.344 0.028 0.608 0.008 0.012 0.000
#> SRR1377218     3   0.479      0.597 0.340 0.028 0.612 0.008 0.012 0.000
#> SRR1377219     4   0.406      0.616 0.076 0.012 0.128 0.780 0.004 0.000
#> SRR1377220     4   0.453      0.560 0.084 0.012 0.168 0.732 0.004 0.000
#> SRR1377221     4   0.446      0.568 0.084 0.012 0.160 0.740 0.004 0.000
#> SRR1377222     4   0.101      0.728 0.044 0.000 0.000 0.956 0.000 0.000
#> SRR1377223     4   0.101      0.728 0.044 0.000 0.000 0.956 0.000 0.000
#> SRR1377224     4   0.101      0.728 0.044 0.000 0.000 0.956 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-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