Date: 2019-12-25 23:11:18 CET, cola version: 1.3.2
Document is loading...
All available functions which can be applied to this res_list
object:
res_list
#> A 'ConsensusPartitionList' object with 24 methods.
#> On a matrix with 10869 rows and 66 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] 10869 66
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)
Folowing table shows the best k
(number of partitions) for each combination
of top-value methods and partition methods. Clicking on the method name in
the table goes to the section for a single combination of methods.
The cola vignette explains the definition of the metrics used for determining the best number of partitions.
suggest_best_k(res_list)
The best k | 1-PAC | Mean silhouette | Concordance | Optional k | ||
---|---|---|---|---|---|---|
SD:hclust | 2 | 1.000 | 0.948 | 0.975 | ** | |
CV:kmeans | 2 | 1.000 | 0.993 | 0.997 | ** | |
CV:mclust | 2 | 1.000 | 0.981 | 0.991 | ** | |
MAD:skmeans | 2 | 1.000 | 0.974 | 0.988 | ** | |
MAD:mclust | 3 | 1.000 | 0.950 | 0.966 | ** | |
ATC:hclust | 2 | 1.000 | 0.993 | 0.997 | ** | |
ATC:kmeans | 2 | 1.000 | 1.000 | 1.000 | ** | |
ATC:skmeans | 2 | 1.000 | 0.967 | 0.987 | ** | |
ATC:mclust | 2 | 1.000 | 0.981 | 0.991 | ** | |
CV:skmeans | 2 | 0.968 | 0.941 | 0.975 | ** | |
CV:hclust | 2 | 0.968 | 0.954 | 0.977 | ** | |
ATC:NMF | 2 | 0.944 | 0.939 | 0.962 | * | |
SD:mclust | 3 | 0.944 | 0.920 | 0.966 | * | |
SD:skmeans | 2 | 0.936 | 0.919 | 0.968 | * | |
SD:NMF | 3 | 0.921 | 0.904 | 0.953 | * | |
ATC:pam | 3 | 0.919 | 0.934 | 0.976 | * | 2 |
MAD:NMF | 3 | 0.758 | 0.866 | 0.922 | ||
MAD:hclust | 2 | 0.613 | 0.890 | 0.942 | ||
MAD:kmeans | 3 | 0.577 | 0.912 | 0.912 | ||
SD:pam | 4 | 0.566 | 0.692 | 0.835 | ||
CV:pam | 5 | 0.520 | 0.774 | 0.829 | ||
CV:NMF | 3 | 0.502 | 0.625 | 0.855 | ||
SD:kmeans | 3 | 0.481 | 0.889 | 0.885 | ||
MAD:pam | NA | NA | NA | NA |
**: 1-PAC > 0.95, *: 1-PAC > 0.9
Cumulative distribution function curves of consensus matrix for all methods.
collect_plots(res_list, fun = plot_ecdf)
Consensus heatmaps for all methods. (What is a consensus heatmap?)
collect_plots(res_list, k = 2, fun = consensus_heatmap, mc.cores = 4)
collect_plots(res_list, k = 3, fun = consensus_heatmap, mc.cores = 4)
collect_plots(res_list, k = 4, fun = consensus_heatmap, mc.cores = 4)
collect_plots(res_list, k = 5, fun = consensus_heatmap, mc.cores = 4)
collect_plots(res_list, k = 6, fun = consensus_heatmap, mc.cores = 4)
Membership heatmaps for all methods. (What is a membership heatmap?)
collect_plots(res_list, k = 2, fun = membership_heatmap, mc.cores = 4)
collect_plots(res_list, k = 3, fun = membership_heatmap, mc.cores = 4)
collect_plots(res_list, k = 4, fun = membership_heatmap, mc.cores = 4)
collect_plots(res_list, k = 5, fun = membership_heatmap, mc.cores = 4)
collect_plots(res_list, k = 6, fun = membership_heatmap, mc.cores = 4)
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)
collect_plots(res_list, k = 3, fun = get_signatures, mc.cores = 4)
collect_plots(res_list, k = 4, fun = get_signatures, mc.cores = 4)
collect_plots(res_list, k = 5, fun = get_signatures, mc.cores = 4)
collect_plots(res_list, k = 6, fun = get_signatures, mc.cores = 4)
The statistics used for measuring the stability of consensus partitioning. (How are they defined?)
get_stats(res_list, k = 2)
#> k 1-PAC mean_silhouette concordance area_increased Rand Jaccard
#> SD:NMF 2 0.416 0.766 0.799 0.384 0.549 0.549
#> CV:NMF 2 0.396 0.808 0.878 0.289 0.761 0.761
#> MAD:NMF 2 0.329 0.761 0.801 0.378 0.549 0.549
#> ATC:NMF 2 0.944 0.939 0.962 0.103 0.940 0.940
#> SD:skmeans 2 0.936 0.919 0.968 0.506 0.493 0.493
#> CV:skmeans 2 0.968 0.941 0.975 0.488 0.515 0.515
#> MAD:skmeans 2 1.000 0.974 0.988 0.507 0.493 0.493
#> ATC:skmeans 2 1.000 0.967 0.987 0.492 0.509 0.509
#> SD:mclust 2 0.533 0.870 0.921 0.289 0.761 0.761
#> CV:mclust 2 1.000 0.981 0.991 0.273 0.718 0.718
#> MAD:mclust 2 0.530 0.799 0.896 0.322 0.739 0.739
#> ATC:mclust 2 1.000 0.981 0.991 0.252 0.761 0.761
#> SD:kmeans 2 0.576 0.890 0.936 0.284 0.784 0.784
#> CV:kmeans 2 1.000 0.993 0.997 0.213 0.784 0.784
#> MAD:kmeans 2 0.524 0.702 0.869 0.372 0.559 0.559
#> ATC:kmeans 2 1.000 1.000 1.000 0.217 0.784 0.784
#> SD:pam 2 0.387 0.819 0.886 0.318 0.784 0.784
#> CV:pam 2 0.538 0.864 0.926 0.139 0.912 0.912
#> MAD:pam 2 0.657 0.841 0.903 0.354 0.571 0.571
#> ATC:pam 2 1.000 0.988 0.994 0.208 0.784 0.784
#> SD:hclust 2 1.000 0.948 0.975 0.233 0.784 0.784
#> CV:hclust 2 0.968 0.954 0.977 0.214 0.761 0.761
#> MAD:hclust 2 0.613 0.890 0.942 0.256 0.784 0.784
#> ATC:hclust 2 1.000 0.993 0.997 0.235 0.761 0.761
get_stats(res_list, k = 3)
#> k 1-PAC mean_silhouette concordance area_increased Rand Jaccard
#> SD:NMF 3 0.921 0.904 0.953 0.4446 0.789 0.645
#> CV:NMF 3 0.502 0.625 0.855 0.4705 0.810 0.757
#> MAD:NMF 3 0.758 0.866 0.922 0.4651 0.828 0.707
#> ATC:NMF 3 0.825 0.870 0.937 0.6087 0.942 0.939
#> SD:skmeans 3 0.586 0.683 0.847 0.2753 0.846 0.695
#> CV:skmeans 3 0.510 0.637 0.815 0.3138 0.823 0.672
#> MAD:skmeans 3 0.664 0.835 0.905 0.2662 0.807 0.631
#> ATC:skmeans 3 0.830 0.855 0.926 0.2239 0.884 0.776
#> SD:mclust 3 0.944 0.920 0.966 1.0147 0.663 0.558
#> CV:mclust 3 0.524 0.834 0.909 1.2457 0.667 0.536
#> MAD:mclust 3 1.000 0.950 0.966 0.7938 0.669 0.556
#> ATC:mclust 3 0.586 0.835 0.900 1.0454 0.709 0.620
#> SD:kmeans 3 0.481 0.889 0.885 0.9293 0.615 0.509
#> CV:kmeans 3 0.385 0.553 0.682 1.0525 0.664 0.572
#> MAD:kmeans 3 0.577 0.912 0.912 0.5356 0.679 0.497
#> ATC:kmeans 3 0.613 0.961 0.904 1.4677 0.610 0.502
#> SD:pam 3 0.314 0.735 0.802 0.5734 0.675 0.585
#> CV:pam 3 0.510 0.788 0.896 0.4169 0.999 0.999
#> MAD:pam 3 0.647 0.768 0.878 0.6919 0.760 0.585
#> ATC:pam 3 0.919 0.934 0.976 1.5077 0.687 0.600
#> SD:hclust 3 0.516 0.818 0.877 0.3374 0.997 0.996
#> CV:hclust 3 0.876 0.890 0.959 0.0861 0.996 0.995
#> MAD:hclust 3 0.295 0.746 0.854 0.3745 0.997 0.996
#> ATC:hclust 3 1.000 0.953 0.988 0.0200 0.996 0.995
get_stats(res_list, k = 4)
#> k 1-PAC mean_silhouette concordance area_increased Rand Jaccard
#> SD:NMF 4 0.744 0.838 0.924 0.0619 0.997 0.992
#> CV:NMF 4 0.470 0.606 0.829 0.1527 0.869 0.793
#> MAD:NMF 4 0.520 0.776 0.884 0.0579 0.976 0.948
#> ATC:NMF 4 0.440 0.770 0.883 0.5757 0.970 0.966
#> SD:skmeans 4 0.570 0.572 0.735 0.1246 0.895 0.723
#> CV:skmeans 4 0.635 0.720 0.861 0.1248 0.851 0.634
#> MAD:skmeans 4 0.574 0.450 0.650 0.1296 0.779 0.464
#> ATC:skmeans 4 0.782 0.724 0.880 0.1013 0.918 0.805
#> SD:mclust 4 0.765 0.812 0.889 0.2373 0.772 0.498
#> CV:mclust 4 0.563 0.715 0.793 0.1597 0.866 0.651
#> MAD:mclust 4 0.802 0.870 0.910 0.2526 0.758 0.477
#> ATC:mclust 4 0.337 0.473 0.651 0.1640 0.752 0.518
#> SD:kmeans 4 0.595 0.737 0.825 0.1945 0.985 0.964
#> CV:kmeans 4 0.346 0.681 0.759 0.2524 0.776 0.582
#> MAD:kmeans 4 0.576 0.762 0.831 0.1506 1.000 1.000
#> ATC:kmeans 4 0.733 0.717 0.851 0.2256 0.973 0.931
#> SD:pam 4 0.566 0.692 0.835 0.1992 0.920 0.837
#> CV:pam 4 0.508 0.795 0.894 0.0877 1.000 0.999
#> MAD:pam 4 0.577 0.693 0.849 0.0407 0.984 0.954
#> ATC:pam 4 0.677 0.693 0.866 0.1423 0.994 0.988
#> SD:hclust 4 0.485 0.807 0.882 0.0633 0.995 0.994
#> CV:hclust 4 0.876 0.848 0.946 0.0190 0.997 0.996
#> MAD:hclust 4 0.265 0.744 0.850 0.0398 0.995 0.994
#> ATC:hclust 4 0.690 0.866 0.927 0.3052 0.993 0.990
get_stats(res_list, k = 5)
#> k 1-PAC mean_silhouette concordance area_increased Rand Jaccard
#> SD:NMF 5 0.535 0.753 0.843 0.07230 1.000 1.000
#> CV:NMF 5 0.424 0.557 0.810 0.05932 0.949 0.905
#> MAD:NMF 5 0.415 0.701 0.816 0.07291 1.000 1.000
#> ATC:NMF 5 0.287 0.579 0.795 0.53883 0.776 0.739
#> SD:skmeans 5 0.629 0.504 0.722 0.06502 0.799 0.424
#> CV:skmeans 5 0.609 0.524 0.765 0.06218 0.978 0.922
#> MAD:skmeans 5 0.638 0.594 0.712 0.06617 0.860 0.535
#> ATC:skmeans 5 0.759 0.712 0.853 0.05804 0.925 0.795
#> SD:mclust 5 0.688 0.760 0.854 0.05100 0.904 0.667
#> CV:mclust 5 0.718 0.766 0.859 0.08997 0.933 0.743
#> MAD:mclust 5 0.679 0.778 0.856 0.04681 0.908 0.685
#> ATC:mclust 5 0.320 0.561 0.699 0.16316 0.800 0.470
#> SD:kmeans 5 0.624 0.647 0.748 0.09311 0.830 0.582
#> CV:kmeans 5 0.397 0.530 0.717 0.11735 0.946 0.871
#> MAD:kmeans 5 0.602 0.640 0.729 0.08838 0.824 0.562
#> ATC:kmeans 5 0.653 0.687 0.735 0.07672 0.846 0.611
#> SD:pam 5 0.516 0.640 0.818 0.03193 0.997 0.994
#> CV:pam 5 0.520 0.774 0.829 0.47925 0.622 0.585
#> MAD:pam 5 0.601 0.692 0.850 0.01376 0.993 0.977
#> ATC:pam 5 0.713 0.751 0.892 0.01349 0.995 0.989
#> SD:hclust 5 0.475 0.754 0.862 0.07411 0.973 0.966
#> CV:hclust 5 0.878 0.875 0.953 0.00844 0.994 0.993
#> MAD:hclust 5 0.263 0.684 0.812 0.04774 0.973 0.966
#> ATC:hclust 5 0.672 0.747 0.895 0.17734 0.974 0.965
get_stats(res_list, k = 6)
#> k 1-PAC mean_silhouette concordance area_increased Rand Jaccard
#> SD:NMF 6 0.541 0.632 0.810 0.05389 0.962 0.910
#> CV:NMF 6 0.416 0.609 0.802 0.08003 0.802 0.636
#> MAD:NMF 6 0.407 0.538 0.770 0.04684 0.942 0.867
#> ATC:NMF 6 0.377 0.575 0.798 0.23116 0.840 0.759
#> SD:skmeans 6 0.655 0.594 0.741 0.04205 0.931 0.702
#> CV:skmeans 6 0.605 0.468 0.703 0.03614 0.990 0.962
#> MAD:skmeans 6 0.623 0.564 0.703 0.03926 0.911 0.636
#> ATC:skmeans 6 0.740 0.699 0.833 0.03555 0.975 0.918
#> SD:mclust 6 0.686 0.665 0.793 0.04933 1.000 1.000
#> CV:mclust 6 0.513 0.569 0.634 -0.02396 0.858 0.580
#> MAD:mclust 6 0.695 0.700 0.790 0.05723 0.920 0.699
#> ATC:mclust 6 0.483 0.675 0.767 0.08481 0.929 0.725
#> SD:kmeans 6 0.667 0.742 0.752 0.04254 0.923 0.710
#> CV:kmeans 6 0.499 0.667 0.787 0.06665 0.851 0.648
#> MAD:kmeans 6 0.626 0.669 0.751 0.04745 0.927 0.725
#> ATC:kmeans 6 0.662 0.645 0.799 0.06516 0.963 0.863
#> SD:pam 6 0.505 0.662 0.842 0.05024 0.812 0.600
#> CV:pam 6 0.476 0.759 0.764 0.24300 0.783 0.633
#> MAD:pam 6 0.602 0.731 0.878 0.03606 0.993 0.978
#> ATC:pam 6 0.685 0.649 0.798 0.03872 0.770 0.541
#> SD:hclust 6 0.447 0.719 0.849 0.03820 0.998 0.998
#> CV:hclust 6 0.879 0.886 0.966 0.00496 0.998 0.998
#> MAD:hclust 6 0.260 0.702 0.855 0.02798 0.998 0.998
#> ATC:hclust 6 0.647 0.562 0.891 0.01951 0.974 0.965
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)
collect_stats(res_list, k = 3)
collect_stats(res_list, k = 4)
collect_stats(res_list, k = 5)
collect_stats(res_list, k = 6)
Collect partitions from all methods:
collect_classes(res_list, k = 2)
collect_classes(res_list, k = 3)
collect_classes(res_list, k = 4)
collect_classes(res_list, k = 5)
collect_classes(res_list, k = 6)
Overlap of top rows from different top-row methods:
top_rows_overlap(res_list, top_n = 1000, method = "euler")
top_rows_overlap(res_list, top_n = 2000, method = "euler")
top_rows_overlap(res_list, top_n = 3000, method = "euler")
top_rows_overlap(res_list, top_n = 4000, method = "euler")
top_rows_overlap(res_list, top_n = 5000, method = "euler")
Also visualize the correspondance of rankings between different top-row methods:
top_rows_overlap(res_list, top_n = 1000, method = "correspondance")
top_rows_overlap(res_list, top_n = 2000, method = "correspondance")
top_rows_overlap(res_list, top_n = 3000, method = "correspondance")
top_rows_overlap(res_list, top_n = 4000, method = "correspondance")
top_rows_overlap(res_list, top_n = 5000, method = "correspondance")
Heatmaps of the top rows:
top_rows_heatmap(res_list, top_n = 1000)
top_rows_heatmap(res_list, top_n = 2000)
top_rows_heatmap(res_list, top_n = 3000)
top_rows_heatmap(res_list, top_n = 4000)
top_rows_heatmap(res_list, top_n = 5000)
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 10869 rows and 66 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)
The plots are:
k
and the heatmap of
predicted classes for each k
.k
.k
.k
.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:
k
;k
, the area increased is defined as \(A_k - A_{k-1}\).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)
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.948 0.975 0.2331 0.784 0.784
#> 3 3 0.516 0.818 0.877 0.3374 0.997 0.996
#> 4 4 0.485 0.807 0.882 0.0633 0.995 0.994
#> 5 5 0.475 0.754 0.862 0.0741 0.973 0.966
#> 6 6 0.447 0.719 0.849 0.0382 0.998 0.998
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.
cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#> class entropy silhouette p1 p2
#> SRR330857 1 0.0000 0.976 1.000 0.000
#> SRR330858 1 0.0000 0.976 1.000 0.000
#> SRR330859 1 0.0000 0.976 1.000 0.000
#> SRR330860 2 0.0000 0.947 0.000 1.000
#> SRR330861 1 0.0000 0.976 1.000 0.000
#> SRR330862 1 0.1414 0.969 0.980 0.020
#> SRR330863 1 0.0000 0.976 1.000 0.000
#> SRR330864 1 0.1414 0.969 0.980 0.020
#> SRR330865 1 0.0000 0.976 1.000 0.000
#> SRR330866 1 0.3431 0.940 0.936 0.064
#> SRR330867 1 0.0000 0.976 1.000 0.000
#> SRR330868 1 0.1414 0.969 0.980 0.020
#> SRR330869 1 0.0376 0.975 0.996 0.004
#> SRR330870 1 0.0000 0.976 1.000 0.000
#> SRR330871 1 0.0000 0.976 1.000 0.000
#> SRR330872 1 0.1414 0.969 0.980 0.020
#> SRR330873 1 0.0000 0.976 1.000 0.000
#> SRR330874 2 0.0000 0.947 0.000 1.000
#> SRR330875 1 0.0000 0.976 1.000 0.000
#> SRR330876 1 0.0000 0.976 1.000 0.000
#> SRR330877 1 0.0000 0.976 1.000 0.000
#> SRR330878 1 0.0000 0.976 1.000 0.000
#> SRR330879 1 0.0000 0.976 1.000 0.000
#> SRR330880 1 0.1414 0.969 0.980 0.020
#> SRR330881 1 0.0000 0.976 1.000 0.000
#> SRR330882 1 0.0000 0.976 1.000 0.000
#> SRR330883 2 0.0000 0.947 0.000 1.000
#> SRR330884 1 0.0376 0.975 0.996 0.004
#> SRR330885 1 0.2778 0.952 0.952 0.048
#> SRR330886 1 0.0000 0.976 1.000 0.000
#> SRR330887 1 0.0000 0.976 1.000 0.000
#> SRR330888 1 0.0000 0.976 1.000 0.000
#> SRR330889 1 0.2603 0.954 0.956 0.044
#> SRR330890 1 0.3431 0.940 0.936 0.064
#> SRR330891 1 0.3431 0.940 0.936 0.064
#> SRR330892 2 0.0000 0.947 0.000 1.000
#> SRR330893 1 0.3431 0.940 0.936 0.064
#> SRR330894 1 0.3431 0.940 0.936 0.064
#> SRR330895 2 0.3584 0.899 0.068 0.932
#> SRR330896 1 0.1843 0.964 0.972 0.028
#> SRR330897 2 0.0000 0.947 0.000 1.000
#> SRR330898 2 0.0000 0.947 0.000 1.000
#> SRR330899 1 0.0000 0.976 1.000 0.000
#> SRR330900 1 0.0000 0.976 1.000 0.000
#> SRR330901 1 0.0000 0.976 1.000 0.000
#> SRR330902 1 0.0000 0.976 1.000 0.000
#> SRR330903 1 0.2043 0.961 0.968 0.032
#> SRR330904 2 0.8555 0.600 0.280 0.720
#> SRR330906 1 0.9815 0.217 0.580 0.420
#> SRR330907 1 0.0000 0.976 1.000 0.000
#> SRR330908 1 0.3431 0.940 0.936 0.064
#> SRR330909 1 0.0000 0.976 1.000 0.000
#> SRR330910 1 0.0938 0.972 0.988 0.012
#> SRR330911 1 0.3431 0.940 0.936 0.064
#> SRR330912 1 0.4690 0.905 0.900 0.100
#> SRR330913 1 0.0000 0.976 1.000 0.000
#> SRR330914 1 0.0376 0.975 0.996 0.004
#> SRR330915 1 0.0000 0.976 1.000 0.000
#> SRR330916 1 0.3431 0.940 0.936 0.064
#> SRR330917 1 0.0000 0.976 1.000 0.000
#> SRR330918 1 0.0000 0.976 1.000 0.000
#> SRR330919 1 0.0000 0.976 1.000 0.000
#> SRR330920 1 0.0000 0.976 1.000 0.000
#> SRR330921 1 0.0000 0.976 1.000 0.000
#> SRR330922 1 0.0000 0.976 1.000 0.000
#> SRR330923 1 0.0000 0.976 1.000 0.000
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> SRR330857 1 0.1860 0.906 0.948 0.000 0.052
#> SRR330858 1 0.1860 0.906 0.948 0.000 0.052
#> SRR330859 1 0.3192 0.904 0.888 0.000 0.112
#> SRR330860 3 0.6045 0.000 0.000 0.380 0.620
#> SRR330861 1 0.3192 0.904 0.888 0.000 0.112
#> SRR330862 1 0.4351 0.870 0.828 0.004 0.168
#> SRR330863 1 0.2537 0.906 0.920 0.000 0.080
#> SRR330864 1 0.4351 0.870 0.828 0.004 0.168
#> SRR330865 1 0.2796 0.905 0.908 0.000 0.092
#> SRR330866 1 0.4634 0.863 0.824 0.012 0.164
#> SRR330867 1 0.2796 0.905 0.908 0.000 0.092
#> SRR330868 1 0.4351 0.870 0.828 0.004 0.168
#> SRR330869 1 0.0892 0.918 0.980 0.000 0.020
#> SRR330870 1 0.1860 0.906 0.948 0.000 0.052
#> SRR330871 1 0.3192 0.903 0.888 0.000 0.112
#> SRR330872 1 0.4351 0.870 0.828 0.004 0.168
#> SRR330873 1 0.1860 0.906 0.948 0.000 0.052
#> SRR330874 2 0.0424 0.445 0.000 0.992 0.008
#> SRR330875 1 0.1860 0.906 0.948 0.000 0.052
#> SRR330876 1 0.1860 0.906 0.948 0.000 0.052
#> SRR330877 1 0.3192 0.904 0.888 0.000 0.112
#> SRR330878 1 0.1860 0.906 0.948 0.000 0.052
#> SRR330879 1 0.1964 0.916 0.944 0.000 0.056
#> SRR330880 1 0.4293 0.873 0.832 0.004 0.164
#> SRR330881 1 0.1860 0.906 0.948 0.000 0.052
#> SRR330882 1 0.3752 0.892 0.856 0.000 0.144
#> SRR330883 2 0.4887 0.445 0.000 0.772 0.228
#> SRR330884 1 0.0892 0.918 0.980 0.000 0.020
#> SRR330885 1 0.4575 0.861 0.812 0.004 0.184
#> SRR330886 1 0.1753 0.907 0.952 0.000 0.048
#> SRR330887 1 0.0000 0.918 1.000 0.000 0.000
#> SRR330888 1 0.0000 0.918 1.000 0.000 0.000
#> SRR330889 1 0.4033 0.885 0.856 0.008 0.136
#> SRR330890 1 0.3377 0.895 0.896 0.012 0.092
#> SRR330891 1 0.4634 0.863 0.824 0.012 0.164
#> SRR330892 2 0.0424 0.445 0.000 0.992 0.008
#> SRR330893 1 0.4634 0.863 0.824 0.012 0.164
#> SRR330894 1 0.4634 0.863 0.824 0.012 0.164
#> SRR330895 2 0.6869 0.355 0.048 0.688 0.264
#> SRR330896 1 0.2261 0.910 0.932 0.000 0.068
#> SRR330897 2 0.4974 0.438 0.000 0.764 0.236
#> SRR330898 2 0.1289 0.479 0.000 0.968 0.032
#> SRR330899 1 0.0000 0.918 1.000 0.000 0.000
#> SRR330900 1 0.0237 0.918 0.996 0.000 0.004
#> SRR330901 1 0.0000 0.918 1.000 0.000 0.000
#> SRR330902 1 0.0000 0.918 1.000 0.000 0.000
#> SRR330903 1 0.3038 0.900 0.896 0.000 0.104
#> SRR330904 2 0.8951 0.104 0.128 0.476 0.396
#> SRR330906 1 0.8984 0.201 0.564 0.212 0.224
#> SRR330907 1 0.1860 0.906 0.948 0.000 0.052
#> SRR330908 1 0.3989 0.883 0.864 0.012 0.124
#> SRR330909 1 0.1753 0.907 0.952 0.000 0.048
#> SRR330910 1 0.1753 0.914 0.952 0.000 0.048
#> SRR330911 1 0.4634 0.863 0.824 0.012 0.164
#> SRR330912 1 0.6255 0.802 0.748 0.048 0.204
#> SRR330913 1 0.0747 0.918 0.984 0.000 0.016
#> SRR330914 1 0.0892 0.918 0.980 0.000 0.020
#> SRR330915 1 0.0000 0.918 1.000 0.000 0.000
#> SRR330916 1 0.4634 0.863 0.824 0.012 0.164
#> SRR330917 1 0.0747 0.918 0.984 0.000 0.016
#> SRR330918 1 0.4555 0.798 0.800 0.000 0.200
#> SRR330919 1 0.0000 0.918 1.000 0.000 0.000
#> SRR330920 1 0.0000 0.918 1.000 0.000 0.000
#> SRR330921 1 0.0000 0.918 1.000 0.000 0.000
#> SRR330922 1 0.0000 0.918 1.000 0.000 0.000
#> SRR330923 1 0.0000 0.918 1.000 0.000 0.000
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> SRR330857 1 0.1716 0.887 0.936 0.000 0.000 0.064
#> SRR330858 1 0.1716 0.887 0.936 0.000 0.000 0.064
#> SRR330859 1 0.2589 0.887 0.884 0.000 0.000 0.116
#> SRR330860 3 0.2918 0.000 0.000 0.116 0.876 0.008
#> SRR330861 1 0.2589 0.886 0.884 0.000 0.000 0.116
#> SRR330862 1 0.3725 0.847 0.812 0.008 0.000 0.180
#> SRR330863 1 0.2216 0.886 0.908 0.000 0.000 0.092
#> SRR330864 1 0.3725 0.847 0.812 0.008 0.000 0.180
#> SRR330865 1 0.2281 0.887 0.904 0.000 0.000 0.096
#> SRR330866 1 0.4364 0.838 0.808 0.056 0.000 0.136
#> SRR330867 1 0.2281 0.887 0.904 0.000 0.000 0.096
#> SRR330868 1 0.3725 0.847 0.812 0.008 0.000 0.180
#> SRR330869 1 0.0895 0.901 0.976 0.004 0.000 0.020
#> SRR330870 1 0.1716 0.887 0.936 0.000 0.000 0.064
#> SRR330871 1 0.2647 0.886 0.880 0.000 0.000 0.120
#> SRR330872 1 0.3725 0.847 0.812 0.008 0.000 0.180
#> SRR330873 1 0.1716 0.887 0.936 0.000 0.000 0.064
#> SRR330874 4 0.7679 1.000 0.000 0.316 0.236 0.448
#> SRR330875 1 0.1716 0.887 0.936 0.000 0.000 0.064
#> SRR330876 1 0.1716 0.887 0.936 0.000 0.000 0.064
#> SRR330877 1 0.2647 0.886 0.880 0.000 0.000 0.120
#> SRR330878 1 0.1716 0.887 0.936 0.000 0.000 0.064
#> SRR330879 1 0.1716 0.898 0.936 0.000 0.000 0.064
#> SRR330880 1 0.3764 0.850 0.816 0.012 0.000 0.172
#> SRR330881 1 0.1716 0.887 0.936 0.000 0.000 0.064
#> SRR330882 1 0.3547 0.871 0.840 0.000 0.016 0.144
#> SRR330883 2 0.0895 0.527 0.000 0.976 0.004 0.020
#> SRR330884 1 0.0895 0.901 0.976 0.004 0.000 0.020
#> SRR330885 1 0.4335 0.837 0.796 0.036 0.000 0.168
#> SRR330886 1 0.1637 0.889 0.940 0.000 0.000 0.060
#> SRR330887 1 0.0188 0.902 0.996 0.000 0.000 0.004
#> SRR330888 1 0.0188 0.902 0.996 0.000 0.000 0.004
#> SRR330889 1 0.3821 0.862 0.840 0.040 0.000 0.120
#> SRR330890 1 0.3245 0.873 0.880 0.056 0.000 0.064
#> SRR330891 1 0.4364 0.838 0.808 0.056 0.000 0.136
#> SRR330892 4 0.7679 1.000 0.000 0.316 0.236 0.448
#> SRR330893 1 0.4364 0.838 0.808 0.056 0.000 0.136
#> SRR330894 1 0.4364 0.838 0.808 0.056 0.000 0.136
#> SRR330895 2 0.2313 0.550 0.032 0.924 0.000 0.044
#> SRR330896 1 0.2282 0.892 0.924 0.024 0.000 0.052
#> SRR330897 2 0.0000 0.537 0.000 1.000 0.000 0.000
#> SRR330898 2 0.4907 -0.520 0.000 0.580 0.000 0.420
#> SRR330899 1 0.0188 0.902 0.996 0.000 0.000 0.004
#> SRR330900 1 0.0336 0.902 0.992 0.000 0.000 0.008
#> SRR330901 1 0.0188 0.902 0.996 0.000 0.000 0.004
#> SRR330902 1 0.0188 0.902 0.996 0.000 0.000 0.004
#> SRR330903 1 0.3117 0.878 0.880 0.028 0.000 0.092
#> SRR330904 2 0.5759 0.349 0.112 0.708 0.000 0.180
#> SRR330906 1 0.5708 0.160 0.556 0.416 0.000 0.028
#> SRR330907 1 0.1716 0.887 0.936 0.000 0.000 0.064
#> SRR330908 1 0.3796 0.860 0.848 0.056 0.000 0.096
#> SRR330909 1 0.1637 0.889 0.940 0.000 0.000 0.060
#> SRR330910 1 0.1807 0.897 0.940 0.008 0.000 0.052
#> SRR330911 1 0.4364 0.838 0.808 0.056 0.000 0.136
#> SRR330912 1 0.5417 0.775 0.732 0.088 0.000 0.180
#> SRR330913 1 0.0707 0.901 0.980 0.000 0.000 0.020
#> SRR330914 1 0.0895 0.901 0.976 0.004 0.000 0.020
#> SRR330915 1 0.0188 0.902 0.996 0.000 0.000 0.004
#> SRR330916 1 0.4364 0.838 0.808 0.056 0.000 0.136
#> SRR330917 1 0.0592 0.901 0.984 0.000 0.000 0.016
#> SRR330918 1 0.5728 0.438 0.600 0.000 0.036 0.364
#> SRR330919 1 0.0188 0.902 0.996 0.000 0.000 0.004
#> SRR330920 1 0.0188 0.902 0.996 0.000 0.000 0.004
#> SRR330921 1 0.0188 0.902 0.996 0.000 0.000 0.004
#> SRR330922 1 0.0188 0.902 0.996 0.000 0.000 0.004
#> SRR330923 1 0.0188 0.902 0.996 0.000 0.000 0.004
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> SRR330857 1 0.1800 0.836 0.932 0.000 0.020 0.000 0.048
#> SRR330858 1 0.1800 0.836 0.932 0.000 0.020 0.000 0.048
#> SRR330859 1 0.2740 0.837 0.876 0.000 0.096 0.000 0.028
#> SRR330860 3 0.4583 0.000 0.000 0.084 0.776 0.120 0.020
#> SRR330861 1 0.2769 0.835 0.876 0.000 0.092 0.000 0.032
#> SRR330862 1 0.3914 0.776 0.788 0.048 0.164 0.000 0.000
#> SRR330863 1 0.2450 0.836 0.900 0.000 0.052 0.000 0.048
#> SRR330864 1 0.3914 0.776 0.788 0.048 0.164 0.000 0.000
#> SRR330865 1 0.2426 0.835 0.900 0.000 0.064 0.000 0.036
#> SRR330866 1 0.4117 0.769 0.788 0.096 0.116 0.000 0.000
#> SRR330867 1 0.2426 0.835 0.900 0.000 0.064 0.000 0.036
#> SRR330868 1 0.3914 0.776 0.788 0.048 0.164 0.000 0.000
#> SRR330869 1 0.1018 0.860 0.968 0.016 0.016 0.000 0.000
#> SRR330870 1 0.1800 0.836 0.932 0.000 0.020 0.000 0.048
#> SRR330871 1 0.2677 0.837 0.872 0.000 0.112 0.000 0.016
#> SRR330872 1 0.3914 0.776 0.788 0.048 0.164 0.000 0.000
#> SRR330873 1 0.1800 0.836 0.932 0.000 0.020 0.000 0.048
#> SRR330874 4 0.0000 1.000 0.000 0.000 0.000 1.000 0.000
#> SRR330875 1 0.1800 0.836 0.932 0.000 0.020 0.000 0.048
#> SRR330876 1 0.1800 0.836 0.932 0.000 0.020 0.000 0.048
#> SRR330877 1 0.2795 0.836 0.872 0.000 0.100 0.000 0.028
#> SRR330878 1 0.1800 0.836 0.932 0.000 0.020 0.000 0.048
#> SRR330879 1 0.1697 0.856 0.932 0.008 0.060 0.000 0.000
#> SRR330880 1 0.3904 0.780 0.792 0.052 0.156 0.000 0.000
#> SRR330881 1 0.1800 0.836 0.932 0.000 0.020 0.000 0.048
#> SRR330882 1 0.5465 0.464 0.664 0.012 0.088 0.000 0.236
#> SRR330883 2 0.1704 0.615 0.000 0.928 0.004 0.068 0.000
#> SRR330884 1 0.1018 0.860 0.968 0.016 0.016 0.000 0.000
#> SRR330885 1 0.4237 0.761 0.772 0.076 0.152 0.000 0.000
#> SRR330886 1 0.1885 0.841 0.932 0.004 0.020 0.000 0.044
#> SRR330887 1 0.0162 0.860 0.996 0.000 0.000 0.000 0.004
#> SRR330888 1 0.0162 0.860 0.996 0.000 0.000 0.000 0.004
#> SRR330889 1 0.3697 0.800 0.820 0.080 0.100 0.000 0.000
#> SRR330890 1 0.3058 0.815 0.860 0.096 0.044 0.000 0.000
#> SRR330891 1 0.4117 0.769 0.788 0.096 0.116 0.000 0.000
#> SRR330892 4 0.0000 1.000 0.000 0.000 0.000 1.000 0.000
#> SRR330893 1 0.4117 0.769 0.788 0.096 0.116 0.000 0.000
#> SRR330894 1 0.4117 0.769 0.788 0.096 0.116 0.000 0.000
#> SRR330895 2 0.1372 0.616 0.016 0.956 0.024 0.004 0.000
#> SRR330896 1 0.2153 0.847 0.916 0.044 0.040 0.000 0.000
#> SRR330897 2 0.1195 0.619 0.000 0.960 0.000 0.028 0.012
#> SRR330898 2 0.4658 -0.123 0.000 0.504 0.000 0.484 0.012
#> SRR330899 1 0.0162 0.860 0.996 0.000 0.000 0.000 0.004
#> SRR330900 1 0.0324 0.861 0.992 0.000 0.004 0.000 0.004
#> SRR330901 1 0.0162 0.860 0.996 0.000 0.000 0.000 0.004
#> SRR330902 1 0.0162 0.860 0.996 0.000 0.000 0.000 0.004
#> SRR330903 1 0.2989 0.827 0.868 0.060 0.072 0.000 0.000
#> SRR330904 2 0.4521 0.395 0.088 0.748 0.164 0.000 0.000
#> SRR330906 1 0.4723 -0.198 0.536 0.448 0.016 0.000 0.000
#> SRR330907 1 0.1800 0.836 0.932 0.000 0.020 0.000 0.048
#> SRR330908 1 0.3586 0.798 0.828 0.096 0.076 0.000 0.000
#> SRR330909 1 0.1725 0.838 0.936 0.000 0.020 0.000 0.044
#> SRR330910 1 0.2157 0.850 0.920 0.040 0.036 0.000 0.004
#> SRR330911 1 0.4117 0.769 0.788 0.096 0.116 0.000 0.000
#> SRR330912 1 0.4996 0.676 0.708 0.128 0.164 0.000 0.000
#> SRR330913 1 0.0912 0.860 0.972 0.012 0.016 0.000 0.000
#> SRR330914 1 0.1018 0.860 0.968 0.016 0.016 0.000 0.000
#> SRR330915 1 0.0162 0.860 0.996 0.000 0.000 0.000 0.004
#> SRR330916 1 0.4117 0.769 0.788 0.096 0.116 0.000 0.000
#> SRR330917 1 0.0807 0.860 0.976 0.012 0.012 0.000 0.000
#> SRR330918 5 0.3612 0.000 0.268 0.000 0.000 0.000 0.732
#> SRR330919 1 0.0162 0.860 0.996 0.000 0.000 0.000 0.004
#> SRR330920 1 0.0162 0.860 0.996 0.000 0.000 0.000 0.004
#> SRR330921 1 0.0162 0.860 0.996 0.000 0.000 0.000 0.004
#> SRR330922 1 0.0162 0.860 0.996 0.000 0.000 0.000 0.004
#> SRR330923 1 0.0162 0.860 0.996 0.000 0.000 0.000 0.004
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> SRR330857 4 0.1327 0.8334 0.064 0.000 0.000 0.936 0.000 0.0
#> SRR330858 4 0.1327 0.8334 0.064 0.000 0.000 0.936 0.000 0.0
#> SRR330859 4 0.2135 0.8336 0.128 0.000 0.000 0.872 0.000 0.0
#> SRR330860 6 0.2263 0.0000 0.004 0.036 0.000 0.000 0.060 0.9
#> SRR330861 4 0.2135 0.8318 0.128 0.000 0.000 0.872 0.000 0.0
#> SRR330862 4 0.3023 0.7678 0.232 0.000 0.000 0.768 0.000 0.0
#> SRR330863 4 0.1765 0.8334 0.096 0.000 0.000 0.904 0.000 0.0
#> SRR330864 4 0.3023 0.7678 0.232 0.000 0.000 0.768 0.000 0.0
#> SRR330865 4 0.1863 0.8321 0.104 0.000 0.000 0.896 0.000 0.0
#> SRR330866 4 0.3314 0.7587 0.224 0.012 0.000 0.764 0.000 0.0
#> SRR330867 4 0.1863 0.8321 0.104 0.000 0.000 0.896 0.000 0.0
#> SRR330868 4 0.3023 0.7678 0.232 0.000 0.000 0.768 0.000 0.0
#> SRR330869 4 0.1007 0.8542 0.044 0.000 0.000 0.956 0.000 0.0
#> SRR330870 4 0.1327 0.8334 0.064 0.000 0.000 0.936 0.000 0.0
#> SRR330871 4 0.2178 0.8337 0.132 0.000 0.000 0.868 0.000 0.0
#> SRR330872 4 0.3023 0.7678 0.232 0.000 0.000 0.768 0.000 0.0
#> SRR330873 4 0.1327 0.8334 0.064 0.000 0.000 0.936 0.000 0.0
#> SRR330874 5 0.0000 1.0000 0.000 0.000 0.000 0.000 1.000 0.0
#> SRR330875 4 0.1327 0.8334 0.064 0.000 0.000 0.936 0.000 0.0
#> SRR330876 4 0.1327 0.8334 0.064 0.000 0.000 0.936 0.000 0.0
#> SRR330877 4 0.2178 0.8330 0.132 0.000 0.000 0.868 0.000 0.0
#> SRR330878 4 0.1327 0.8334 0.064 0.000 0.000 0.936 0.000 0.0
#> SRR330879 4 0.1501 0.8520 0.076 0.000 0.000 0.924 0.000 0.0
#> SRR330880 4 0.2996 0.7718 0.228 0.000 0.000 0.772 0.000 0.0
#> SRR330881 4 0.1327 0.8334 0.064 0.000 0.000 0.936 0.000 0.0
#> SRR330882 4 0.5454 0.0603 0.152 0.000 0.300 0.548 0.000 0.0
#> SRR330883 3 0.4854 0.0000 0.036 0.368 0.580 0.000 0.016 0.0
#> SRR330884 4 0.1075 0.8537 0.048 0.000 0.000 0.952 0.000 0.0
#> SRR330885 4 0.3151 0.7510 0.252 0.000 0.000 0.748 0.000 0.0
#> SRR330886 4 0.1327 0.8376 0.064 0.000 0.000 0.936 0.000 0.0
#> SRR330887 4 0.0000 0.8558 0.000 0.000 0.000 1.000 0.000 0.0
#> SRR330888 4 0.0000 0.8558 0.000 0.000 0.000 1.000 0.000 0.0
#> SRR330889 4 0.3078 0.7884 0.192 0.012 0.000 0.796 0.000 0.0
#> SRR330890 4 0.2730 0.8040 0.152 0.012 0.000 0.836 0.000 0.0
#> SRR330891 4 0.3314 0.7587 0.224 0.012 0.000 0.764 0.000 0.0
#> SRR330892 5 0.0000 1.0000 0.000 0.000 0.000 0.000 1.000 0.0
#> SRR330893 4 0.3314 0.7587 0.224 0.012 0.000 0.764 0.000 0.0
#> SRR330894 4 0.3314 0.7587 0.224 0.012 0.000 0.764 0.000 0.0
#> SRR330895 2 0.2146 0.3013 0.116 0.880 0.000 0.004 0.000 0.0
#> SRR330896 4 0.1908 0.8393 0.096 0.004 0.000 0.900 0.000 0.0
#> SRR330897 2 0.0291 0.1761 0.004 0.992 0.004 0.000 0.000 0.0
#> SRR330898 2 0.3847 -0.2537 0.000 0.544 0.000 0.000 0.456 0.0
#> SRR330899 4 0.0000 0.8558 0.000 0.000 0.000 1.000 0.000 0.0
#> SRR330900 4 0.0146 0.8559 0.004 0.000 0.000 0.996 0.000 0.0
#> SRR330901 4 0.0000 0.8558 0.000 0.000 0.000 1.000 0.000 0.0
#> SRR330902 4 0.0000 0.8558 0.000 0.000 0.000 1.000 0.000 0.0
#> SRR330903 4 0.2442 0.8198 0.144 0.004 0.000 0.852 0.000 0.0
#> SRR330904 2 0.4476 0.2292 0.272 0.664 0.000 0.064 0.000 0.0
#> SRR330906 4 0.5152 -0.1572 0.088 0.400 0.000 0.512 0.000 0.0
#> SRR330907 4 0.1327 0.8334 0.064 0.000 0.000 0.936 0.000 0.0
#> SRR330908 4 0.3014 0.7866 0.184 0.012 0.000 0.804 0.000 0.0
#> SRR330909 4 0.1267 0.8354 0.060 0.000 0.000 0.940 0.000 0.0
#> SRR330910 4 0.1765 0.8396 0.096 0.000 0.000 0.904 0.000 0.0
#> SRR330911 4 0.3314 0.7587 0.224 0.012 0.000 0.764 0.000 0.0
#> SRR330912 4 0.4193 0.6693 0.272 0.044 0.000 0.684 0.000 0.0
#> SRR330913 4 0.0937 0.8543 0.040 0.000 0.000 0.960 0.000 0.0
#> SRR330914 4 0.1007 0.8541 0.044 0.000 0.000 0.956 0.000 0.0
#> SRR330915 4 0.0000 0.8558 0.000 0.000 0.000 1.000 0.000 0.0
#> SRR330916 4 0.3314 0.7587 0.224 0.012 0.000 0.764 0.000 0.0
#> SRR330917 4 0.0865 0.8548 0.036 0.000 0.000 0.964 0.000 0.0
#> SRR330918 1 0.6474 0.0000 0.560 0.004 0.116 0.220 0.000 0.1
#> SRR330919 4 0.0000 0.8558 0.000 0.000 0.000 1.000 0.000 0.0
#> SRR330920 4 0.0000 0.8558 0.000 0.000 0.000 1.000 0.000 0.0
#> SRR330921 4 0.0000 0.8558 0.000 0.000 0.000 1.000 0.000 0.0
#> SRR330922 4 0.0000 0.8558 0.000 0.000 0.000 1.000 0.000 0.0
#> SRR330923 4 0.0000 0.8558 0.000 0.000 0.000 1.000 0.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)
consensus_heatmap(res, k = 3)
consensus_heatmap(res, k = 4)
consensus_heatmap(res, k = 5)
consensus_heatmap(res, k = 6)
Heatmaps for the membership of samples in all partitions to see how consistent they are:
membership_heatmap(res, k = 2)
membership_heatmap(res, k = 3)
membership_heatmap(res, k = 4)
membership_heatmap(res, k = 5)
membership_heatmap(res, k = 6)
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)
get_signatures(res, k = 3)
get_signatures(res, k = 4)
get_signatures(res, k = 5)
get_signatures(res, k = 6)
Signature heatmaps where rows are not scaled:
get_signatures(res, k = 2, scale_rows = FALSE)
get_signatures(res, k = 3, scale_rows = FALSE)
get_signatures(res, k = 4, scale_rows = FALSE)
get_signatures(res, k = 5, scale_rows = FALSE)
get_signatures(res, k = 6, scale_rows = FALSE)
#> Error in mat[ceiling(1:nr/h_ratio), ceiling(1:nc/w_ratio), drop = FALSE]: subscript out of bounds
Compare the overlap of signatures from different k:
compare_signatures(res)
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:
which_row
: row indices corresponding to the input matrix.fdr
: FDR for the differential test. mean_x
: The mean value in group x.scaled_mean_x
: The mean value in group x after rows are scaled.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")
dimension_reduction(res, k = 3, method = "UMAP")
dimension_reduction(res, k = 4, method = "UMAP")
dimension_reduction(res, k = 5, method = "UMAP")
dimension_reduction(res, k = 6, method = "UMAP")
Following heatmap shows how subgroups are split when increasing k
:
collect_classes(res)
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.
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 10869 rows and 66 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 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)
The plots are:
k
and the heatmap of
predicted classes for each k
.k
.k
.k
.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:
k
;k
, the area increased is defined as \(A_k - A_{k-1}\).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)
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.576 0.890 0.936 0.2837 0.784 0.784
#> 3 3 0.481 0.889 0.885 0.9293 0.615 0.509
#> 4 4 0.595 0.737 0.825 0.1945 0.985 0.964
#> 5 5 0.624 0.647 0.748 0.0931 0.830 0.582
#> 6 6 0.667 0.742 0.752 0.0425 0.923 0.710
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.
cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#> class entropy silhouette p1 p2
#> SRR330857 1 0.0000 0.920 1.000 0.000
#> SRR330858 1 0.0000 0.920 1.000 0.000
#> SRR330859 1 0.0000 0.920 1.000 0.000
#> SRR330860 2 0.0000 1.000 0.000 1.000
#> SRR330861 1 0.0000 0.920 1.000 0.000
#> SRR330862 1 0.8327 0.748 0.736 0.264
#> SRR330863 1 0.0000 0.920 1.000 0.000
#> SRR330864 1 0.8327 0.748 0.736 0.264
#> SRR330865 1 0.0000 0.920 1.000 0.000
#> SRR330866 1 0.8327 0.748 0.736 0.264
#> SRR330867 1 0.0000 0.920 1.000 0.000
#> SRR330868 1 0.8327 0.748 0.736 0.264
#> SRR330869 1 0.0376 0.919 0.996 0.004
#> SRR330870 1 0.0000 0.920 1.000 0.000
#> SRR330871 1 0.0000 0.920 1.000 0.000
#> SRR330872 1 0.7815 0.777 0.768 0.232
#> SRR330873 1 0.0000 0.920 1.000 0.000
#> SRR330874 2 0.0000 1.000 0.000 1.000
#> SRR330875 1 0.0000 0.920 1.000 0.000
#> SRR330876 1 0.0000 0.920 1.000 0.000
#> SRR330877 1 0.0000 0.920 1.000 0.000
#> SRR330878 1 0.0000 0.920 1.000 0.000
#> SRR330879 1 0.0000 0.920 1.000 0.000
#> SRR330880 1 0.7376 0.797 0.792 0.208
#> SRR330881 1 0.0000 0.920 1.000 0.000
#> SRR330882 1 0.4815 0.868 0.896 0.104
#> SRR330883 2 0.0000 1.000 0.000 1.000
#> SRR330884 1 0.0000 0.920 1.000 0.000
#> SRR330885 1 0.8327 0.748 0.736 0.264
#> SRR330886 1 0.0000 0.920 1.000 0.000
#> SRR330887 1 0.0000 0.920 1.000 0.000
#> SRR330888 1 0.0000 0.920 1.000 0.000
#> SRR330889 1 0.7745 0.782 0.772 0.228
#> SRR330890 1 0.5178 0.861 0.884 0.116
#> SRR330891 1 0.8327 0.748 0.736 0.264
#> SRR330892 2 0.0000 1.000 0.000 1.000
#> SRR330893 1 0.8327 0.748 0.736 0.264
#> SRR330894 1 0.8327 0.748 0.736 0.264
#> SRR330895 2 0.0000 1.000 0.000 1.000
#> SRR330896 1 0.0000 0.920 1.000 0.000
#> SRR330897 2 0.0000 1.000 0.000 1.000
#> SRR330898 2 0.0000 1.000 0.000 1.000
#> SRR330899 1 0.0000 0.920 1.000 0.000
#> SRR330900 1 0.0000 0.920 1.000 0.000
#> SRR330901 1 0.0000 0.920 1.000 0.000
#> SRR330902 1 0.0000 0.920 1.000 0.000
#> SRR330903 1 0.4431 0.876 0.908 0.092
#> SRR330904 2 0.0000 1.000 0.000 1.000
#> SRR330906 1 0.4815 0.868 0.896 0.104
#> SRR330907 1 0.0000 0.920 1.000 0.000
#> SRR330908 1 0.7950 0.771 0.760 0.240
#> SRR330909 1 0.0000 0.920 1.000 0.000
#> SRR330910 1 0.0000 0.920 1.000 0.000
#> SRR330911 1 0.8327 0.748 0.736 0.264
#> SRR330912 1 0.8327 0.748 0.736 0.264
#> SRR330913 1 0.0376 0.919 0.996 0.004
#> SRR330914 1 0.1184 0.914 0.984 0.016
#> SRR330915 1 0.0000 0.920 1.000 0.000
#> SRR330916 1 0.8327 0.748 0.736 0.264
#> SRR330917 1 0.0000 0.920 1.000 0.000
#> SRR330918 1 0.0000 0.920 1.000 0.000
#> SRR330919 1 0.0000 0.920 1.000 0.000
#> SRR330920 1 0.0000 0.920 1.000 0.000
#> SRR330921 1 0.0000 0.920 1.000 0.000
#> SRR330922 1 0.0000 0.920 1.000 0.000
#> SRR330923 1 0.0000 0.920 1.000 0.000
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> SRR330857 3 0.0000 0.909 0.000 0.000 1.000
#> SRR330858 3 0.0000 0.909 0.000 0.000 1.000
#> SRR330859 3 0.0424 0.906 0.008 0.000 0.992
#> SRR330860 2 0.2066 0.912 0.060 0.940 0.000
#> SRR330861 3 0.0424 0.906 0.008 0.000 0.992
#> SRR330862 1 0.5070 0.886 0.772 0.004 0.224
#> SRR330863 3 0.1163 0.898 0.028 0.000 0.972
#> SRR330864 1 0.5070 0.886 0.772 0.004 0.224
#> SRR330865 3 0.0000 0.909 0.000 0.000 1.000
#> SRR330866 1 0.4099 0.966 0.852 0.008 0.140
#> SRR330867 3 0.0000 0.909 0.000 0.000 1.000
#> SRR330868 1 0.5070 0.886 0.772 0.004 0.224
#> SRR330869 1 0.3879 0.966 0.848 0.000 0.152
#> SRR330870 3 0.0000 0.909 0.000 0.000 1.000
#> SRR330871 3 0.0424 0.906 0.008 0.000 0.992
#> SRR330872 1 0.5070 0.886 0.772 0.004 0.224
#> SRR330873 3 0.0000 0.909 0.000 0.000 1.000
#> SRR330874 2 0.1411 0.924 0.036 0.964 0.000
#> SRR330875 3 0.0000 0.909 0.000 0.000 1.000
#> SRR330876 3 0.0000 0.909 0.000 0.000 1.000
#> SRR330877 3 0.0424 0.906 0.008 0.000 0.992
#> SRR330878 3 0.0000 0.909 0.000 0.000 1.000
#> SRR330879 3 0.2261 0.899 0.068 0.000 0.932
#> SRR330880 1 0.4887 0.890 0.772 0.000 0.228
#> SRR330881 3 0.0000 0.909 0.000 0.000 1.000
#> SRR330882 3 0.6647 0.284 0.452 0.008 0.540
#> SRR330883 2 0.0237 0.925 0.004 0.996 0.000
#> SRR330884 1 0.3879 0.966 0.848 0.000 0.152
#> SRR330885 1 0.4099 0.966 0.852 0.008 0.140
#> SRR330886 3 0.6095 0.258 0.392 0.000 0.608
#> SRR330887 3 0.3267 0.883 0.116 0.000 0.884
#> SRR330888 3 0.3267 0.883 0.116 0.000 0.884
#> SRR330889 1 0.3686 0.965 0.860 0.000 0.140
#> SRR330890 1 0.3879 0.966 0.848 0.000 0.152
#> SRR330891 1 0.4099 0.966 0.852 0.008 0.140
#> SRR330892 2 0.1411 0.924 0.036 0.964 0.000
#> SRR330893 1 0.4099 0.966 0.852 0.008 0.140
#> SRR330894 1 0.4099 0.966 0.852 0.008 0.140
#> SRR330895 2 0.0424 0.925 0.008 0.992 0.000
#> SRR330896 1 0.3879 0.966 0.848 0.000 0.152
#> SRR330897 2 0.0424 0.925 0.008 0.992 0.000
#> SRR330898 2 0.1289 0.924 0.032 0.968 0.000
#> SRR330899 3 0.3267 0.883 0.116 0.000 0.884
#> SRR330900 3 0.3340 0.880 0.120 0.000 0.880
#> SRR330901 3 0.3267 0.883 0.116 0.000 0.884
#> SRR330902 3 0.2356 0.900 0.072 0.000 0.928
#> SRR330903 1 0.3816 0.967 0.852 0.000 0.148
#> SRR330904 2 0.6252 0.219 0.444 0.556 0.000
#> SRR330906 1 0.3879 0.966 0.848 0.000 0.152
#> SRR330907 3 0.0000 0.909 0.000 0.000 1.000
#> SRR330908 1 0.3816 0.967 0.852 0.000 0.148
#> SRR330909 3 0.2261 0.901 0.068 0.000 0.932
#> SRR330910 1 0.3879 0.966 0.848 0.000 0.152
#> SRR330911 1 0.4099 0.966 0.852 0.008 0.140
#> SRR330912 1 0.4099 0.966 0.852 0.008 0.140
#> SRR330913 1 0.3879 0.966 0.848 0.000 0.152
#> SRR330914 1 0.3879 0.966 0.848 0.000 0.152
#> SRR330915 3 0.3267 0.883 0.116 0.000 0.884
#> SRR330916 1 0.4099 0.966 0.852 0.008 0.140
#> SRR330917 1 0.3879 0.966 0.848 0.000 0.152
#> SRR330918 3 0.5443 0.754 0.260 0.004 0.736
#> SRR330919 3 0.3340 0.880 0.120 0.000 0.880
#> SRR330920 3 0.2356 0.900 0.072 0.000 0.928
#> SRR330921 3 0.3340 0.880 0.120 0.000 0.880
#> SRR330922 3 0.3340 0.880 0.120 0.000 0.880
#> SRR330923 3 0.1860 0.905 0.052 0.000 0.948
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> SRR330857 1 0.3400 0.779 0.820 0.000 NA 0.000
#> SRR330858 1 0.3172 0.780 0.840 0.000 NA 0.000
#> SRR330859 1 0.4855 0.658 0.600 0.000 NA 0.000
#> SRR330860 2 0.3219 0.903 0.000 0.836 NA 0.000
#> SRR330861 1 0.4972 0.617 0.544 0.000 NA 0.000
#> SRR330862 4 0.5905 0.527 0.040 0.000 NA 0.564
#> SRR330863 1 0.5038 0.707 0.684 0.000 NA 0.020
#> SRR330864 4 0.5905 0.527 0.040 0.000 NA 0.564
#> SRR330865 1 0.3400 0.779 0.820 0.000 NA 0.000
#> SRR330866 4 0.0895 0.829 0.020 0.000 NA 0.976
#> SRR330867 1 0.3400 0.779 0.820 0.000 NA 0.000
#> SRR330868 4 0.5905 0.527 0.040 0.000 NA 0.564
#> SRR330869 4 0.3583 0.780 0.180 0.000 NA 0.816
#> SRR330870 1 0.3400 0.779 0.820 0.000 NA 0.000
#> SRR330871 1 0.4977 0.615 0.540 0.000 NA 0.000
#> SRR330872 4 0.5905 0.527 0.040 0.000 NA 0.564
#> SRR330873 1 0.3400 0.779 0.820 0.000 NA 0.000
#> SRR330874 2 0.2345 0.956 0.000 0.900 NA 0.000
#> SRR330875 1 0.3400 0.779 0.820 0.000 NA 0.000
#> SRR330876 1 0.3400 0.779 0.820 0.000 NA 0.000
#> SRR330877 1 0.4977 0.615 0.540 0.000 NA 0.000
#> SRR330878 1 0.3400 0.779 0.820 0.000 NA 0.000
#> SRR330879 1 0.5375 0.697 0.744 0.000 NA 0.116
#> SRR330880 4 0.5905 0.527 0.040 0.000 NA 0.564
#> SRR330881 1 0.3123 0.781 0.844 0.000 NA 0.000
#> SRR330882 1 0.7568 0.130 0.456 0.000 NA 0.340
#> SRR330883 2 0.0000 0.960 0.000 1.000 NA 0.000
#> SRR330884 4 0.3583 0.780 0.180 0.000 NA 0.816
#> SRR330885 4 0.1174 0.828 0.020 0.000 NA 0.968
#> SRR330886 1 0.5543 0.021 0.556 0.000 NA 0.424
#> SRR330887 1 0.2469 0.757 0.892 0.000 NA 0.108
#> SRR330888 1 0.2345 0.761 0.900 0.000 NA 0.100
#> SRR330889 4 0.1174 0.828 0.020 0.000 NA 0.968
#> SRR330890 4 0.2216 0.817 0.092 0.000 NA 0.908
#> SRR330891 4 0.0895 0.829 0.020 0.000 NA 0.976
#> SRR330892 2 0.2345 0.956 0.000 0.900 NA 0.000
#> SRR330893 4 0.0707 0.829 0.020 0.000 NA 0.980
#> SRR330894 4 0.0895 0.829 0.020 0.000 NA 0.976
#> SRR330895 2 0.0000 0.960 0.000 1.000 NA 0.000
#> SRR330896 4 0.3266 0.788 0.168 0.000 NA 0.832
#> SRR330897 2 0.0000 0.960 0.000 1.000 NA 0.000
#> SRR330898 2 0.2081 0.956 0.000 0.916 NA 0.000
#> SRR330899 1 0.2469 0.757 0.892 0.000 NA 0.108
#> SRR330900 1 0.2647 0.749 0.880 0.000 NA 0.120
#> SRR330901 1 0.2469 0.757 0.892 0.000 NA 0.108
#> SRR330902 1 0.0469 0.777 0.988 0.000 NA 0.012
#> SRR330903 4 0.1118 0.828 0.036 0.000 NA 0.964
#> SRR330904 4 0.5212 0.219 0.000 0.420 NA 0.572
#> SRR330906 4 0.2654 0.813 0.108 0.000 NA 0.888
#> SRR330907 1 0.3123 0.781 0.844 0.000 NA 0.000
#> SRR330908 4 0.0707 0.829 0.020 0.000 NA 0.980
#> SRR330909 1 0.0657 0.778 0.984 0.000 NA 0.012
#> SRR330910 4 0.3448 0.787 0.168 0.000 NA 0.828
#> SRR330911 4 0.0895 0.829 0.020 0.000 NA 0.976
#> SRR330912 4 0.1042 0.828 0.020 0.000 NA 0.972
#> SRR330913 4 0.3583 0.780 0.180 0.000 NA 0.816
#> SRR330914 4 0.3448 0.787 0.168 0.000 NA 0.828
#> SRR330915 1 0.2469 0.757 0.892 0.000 NA 0.108
#> SRR330916 4 0.1042 0.828 0.020 0.000 NA 0.972
#> SRR330917 4 0.3583 0.780 0.180 0.000 NA 0.816
#> SRR330918 1 0.7145 0.383 0.556 0.000 NA 0.252
#> SRR330919 1 0.2647 0.749 0.880 0.000 NA 0.120
#> SRR330920 1 0.1174 0.780 0.968 0.000 NA 0.012
#> SRR330921 1 0.2469 0.757 0.892 0.000 NA 0.108
#> SRR330922 1 0.2814 0.739 0.868 0.000 NA 0.132
#> SRR330923 1 0.2928 0.785 0.880 0.000 NA 0.012
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> SRR330857 1 0.0404 0.691 0.988 0.000 0.000 0.000 0.012
#> SRR330858 1 0.0703 0.683 0.976 0.000 0.000 0.000 0.024
#> SRR330859 1 0.4329 0.504 0.672 0.000 0.312 0.000 0.016
#> SRR330860 2 0.5420 0.768 0.000 0.676 0.148 0.004 0.172
#> SRR330861 1 0.4151 0.488 0.652 0.000 0.344 0.000 0.004
#> SRR330862 3 0.4482 0.997 0.016 0.000 0.636 0.348 0.000
#> SRR330863 1 0.4552 0.543 0.744 0.000 0.204 0.020 0.032
#> SRR330864 3 0.4482 0.997 0.016 0.000 0.636 0.348 0.000
#> SRR330865 1 0.0290 0.690 0.992 0.000 0.008 0.000 0.000
#> SRR330866 4 0.0162 0.779 0.004 0.000 0.000 0.996 0.000
#> SRR330867 1 0.0162 0.691 0.996 0.000 0.004 0.000 0.000
#> SRR330868 3 0.4482 0.997 0.016 0.000 0.636 0.348 0.000
#> SRR330869 4 0.4283 0.631 0.004 0.000 0.012 0.692 0.292
#> SRR330870 1 0.0404 0.691 0.988 0.000 0.000 0.000 0.012
#> SRR330871 1 0.4251 0.466 0.624 0.000 0.372 0.000 0.004
#> SRR330872 3 0.4467 0.992 0.016 0.000 0.640 0.344 0.000
#> SRR330873 1 0.0404 0.691 0.988 0.000 0.000 0.000 0.012
#> SRR330874 2 0.3647 0.898 0.000 0.816 0.132 0.000 0.052
#> SRR330875 1 0.0324 0.690 0.992 0.000 0.004 0.000 0.004
#> SRR330876 1 0.0566 0.691 0.984 0.000 0.004 0.000 0.012
#> SRR330877 1 0.4182 0.482 0.644 0.000 0.352 0.000 0.004
#> SRR330878 1 0.0162 0.691 0.996 0.000 0.004 0.000 0.000
#> SRR330879 5 0.6939 0.548 0.408 0.000 0.104 0.052 0.436
#> SRR330880 3 0.4497 0.992 0.016 0.000 0.632 0.352 0.000
#> SRR330881 1 0.1478 0.647 0.936 0.000 0.000 0.000 0.064
#> SRR330882 5 0.6594 0.318 0.112 0.000 0.124 0.132 0.632
#> SRR330883 2 0.0162 0.907 0.000 0.996 0.000 0.000 0.004
#> SRR330884 4 0.3962 0.682 0.004 0.000 0.012 0.744 0.240
#> SRR330885 4 0.0566 0.778 0.004 0.000 0.012 0.984 0.000
#> SRR330886 5 0.6914 0.253 0.164 0.000 0.024 0.360 0.452
#> SRR330887 5 0.5658 0.737 0.460 0.000 0.008 0.056 0.476
#> SRR330888 5 0.5549 0.720 0.468 0.000 0.008 0.048 0.476
#> SRR330889 4 0.0451 0.775 0.004 0.000 0.008 0.988 0.000
#> SRR330890 4 0.1662 0.772 0.004 0.000 0.004 0.936 0.056
#> SRR330891 4 0.0162 0.779 0.004 0.000 0.000 0.996 0.000
#> SRR330892 2 0.3647 0.898 0.000 0.816 0.132 0.000 0.052
#> SRR330893 4 0.0162 0.779 0.004 0.000 0.000 0.996 0.000
#> SRR330894 4 0.0162 0.779 0.004 0.000 0.000 0.996 0.000
#> SRR330895 2 0.0162 0.907 0.000 0.996 0.000 0.004 0.000
#> SRR330896 4 0.3963 0.671 0.004 0.000 0.008 0.732 0.256
#> SRR330897 2 0.0000 0.908 0.000 1.000 0.000 0.000 0.000
#> SRR330898 2 0.2848 0.903 0.000 0.868 0.104 0.000 0.028
#> SRR330899 5 0.5658 0.737 0.460 0.000 0.008 0.056 0.476
#> SRR330900 5 0.5759 0.737 0.452 0.000 0.008 0.064 0.476
#> SRR330901 5 0.5658 0.737 0.460 0.000 0.008 0.056 0.476
#> SRR330902 1 0.4450 -0.620 0.508 0.000 0.004 0.000 0.488
#> SRR330903 4 0.1026 0.779 0.004 0.000 0.004 0.968 0.024
#> SRR330904 4 0.3752 0.350 0.000 0.292 0.000 0.708 0.000
#> SRR330906 4 0.2770 0.742 0.004 0.000 0.008 0.864 0.124
#> SRR330907 1 0.1792 0.623 0.916 0.000 0.000 0.000 0.084
#> SRR330908 4 0.0162 0.779 0.004 0.000 0.000 0.996 0.000
#> SRR330909 1 0.4287 -0.546 0.540 0.000 0.000 0.000 0.460
#> SRR330910 4 0.4015 0.663 0.004 0.000 0.008 0.724 0.264
#> SRR330911 4 0.0162 0.779 0.004 0.000 0.000 0.996 0.000
#> SRR330912 4 0.0162 0.779 0.004 0.000 0.000 0.996 0.000
#> SRR330913 4 0.4217 0.645 0.004 0.000 0.012 0.704 0.280
#> SRR330914 4 0.3719 0.702 0.004 0.000 0.012 0.776 0.208
#> SRR330915 5 0.5658 0.737 0.460 0.000 0.008 0.056 0.476
#> SRR330916 4 0.0162 0.779 0.004 0.000 0.000 0.996 0.000
#> SRR330917 4 0.4705 0.443 0.004 0.000 0.012 0.580 0.404
#> SRR330918 5 0.5890 0.378 0.152 0.000 0.108 0.056 0.684
#> SRR330919 5 0.5806 0.735 0.448 0.000 0.008 0.068 0.476
#> SRR330920 1 0.4287 -0.546 0.540 0.000 0.000 0.000 0.460
#> SRR330921 5 0.5658 0.737 0.460 0.000 0.008 0.056 0.476
#> SRR330922 5 0.5940 0.725 0.436 0.000 0.008 0.080 0.476
#> SRR330923 1 0.3274 0.344 0.780 0.000 0.000 0.000 0.220
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> SRR330857 1 0.3852 0.8191 0.612 0.000 0.000 0.000 0.384 0.004
#> SRR330858 1 0.4118 0.8067 0.592 0.000 0.004 0.000 0.396 0.008
#> SRR330859 1 0.5995 0.5818 0.428 0.000 0.324 0.000 0.248 0.000
#> SRR330860 2 0.6717 0.5449 0.180 0.544 0.124 0.000 0.004 0.148
#> SRR330861 1 0.5870 0.5853 0.460 0.000 0.328 0.000 0.212 0.000
#> SRR330862 3 0.3481 0.9981 0.012 0.000 0.756 0.228 0.004 0.000
#> SRR330863 1 0.6119 0.6667 0.464 0.000 0.200 0.012 0.324 0.000
#> SRR330864 3 0.3481 0.9981 0.012 0.000 0.756 0.228 0.004 0.000
#> SRR330865 1 0.3872 0.8154 0.604 0.000 0.004 0.000 0.392 0.000
#> SRR330866 4 0.0260 0.7944 0.008 0.000 0.000 0.992 0.000 0.000
#> SRR330867 1 0.3737 0.8176 0.608 0.000 0.000 0.000 0.392 0.000
#> SRR330868 3 0.3481 0.9981 0.012 0.000 0.756 0.228 0.004 0.000
#> SRR330869 4 0.4367 0.5439 0.000 0.000 0.000 0.604 0.364 0.032
#> SRR330870 1 0.3862 0.8177 0.608 0.000 0.000 0.000 0.388 0.004
#> SRR330871 1 0.5932 0.4929 0.396 0.000 0.392 0.000 0.212 0.000
#> SRR330872 3 0.3543 0.9923 0.016 0.000 0.756 0.224 0.004 0.000
#> SRR330873 1 0.3862 0.8177 0.608 0.000 0.000 0.000 0.388 0.004
#> SRR330874 2 0.5556 0.7516 0.216 0.640 0.072 0.000 0.000 0.072
#> SRR330875 1 0.3830 0.8183 0.620 0.000 0.004 0.000 0.376 0.000
#> SRR330876 1 0.3852 0.8191 0.612 0.000 0.000 0.000 0.384 0.004
#> SRR330877 1 0.5896 0.5652 0.444 0.000 0.344 0.000 0.212 0.000
#> SRR330878 1 0.3841 0.8191 0.616 0.000 0.004 0.000 0.380 0.000
#> SRR330879 5 0.3219 0.7197 0.028 0.000 0.084 0.040 0.848 0.000
#> SRR330880 3 0.3481 0.9981 0.012 0.000 0.756 0.228 0.004 0.000
#> SRR330881 1 0.4274 0.7730 0.560 0.000 0.008 0.000 0.424 0.008
#> SRR330882 6 0.3337 0.9027 0.004 0.000 0.008 0.020 0.156 0.812
#> SRR330883 2 0.0881 0.7946 0.008 0.972 0.008 0.000 0.000 0.012
#> SRR330884 4 0.4203 0.6093 0.000 0.000 0.000 0.652 0.316 0.032
#> SRR330885 4 0.0713 0.7918 0.000 0.000 0.000 0.972 0.000 0.028
#> SRR330886 5 0.4830 0.3813 0.028 0.000 0.020 0.284 0.656 0.012
#> SRR330887 5 0.0865 0.8397 0.000 0.000 0.000 0.036 0.964 0.000
#> SRR330888 5 0.0865 0.8397 0.000 0.000 0.000 0.036 0.964 0.000
#> SRR330889 4 0.0363 0.7909 0.000 0.000 0.012 0.988 0.000 0.000
#> SRR330890 4 0.2230 0.7746 0.000 0.000 0.000 0.892 0.084 0.024
#> SRR330891 4 0.0405 0.7962 0.008 0.000 0.000 0.988 0.004 0.000
#> SRR330892 2 0.5556 0.7516 0.216 0.640 0.072 0.000 0.000 0.072
#> SRR330893 4 0.0405 0.7962 0.008 0.000 0.000 0.988 0.004 0.000
#> SRR330894 4 0.0260 0.7944 0.008 0.000 0.000 0.992 0.000 0.000
#> SRR330895 2 0.0405 0.7928 0.004 0.988 0.000 0.008 0.000 0.000
#> SRR330896 4 0.4134 0.6131 0.000 0.000 0.000 0.656 0.316 0.028
#> SRR330897 2 0.0000 0.7965 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR330898 2 0.3795 0.7799 0.136 0.796 0.044 0.000 0.000 0.024
#> SRR330899 5 0.0865 0.8397 0.000 0.000 0.000 0.036 0.964 0.000
#> SRR330900 5 0.1196 0.8346 0.000 0.000 0.000 0.040 0.952 0.008
#> SRR330901 5 0.0865 0.8397 0.000 0.000 0.000 0.036 0.964 0.000
#> SRR330902 5 0.0291 0.8015 0.000 0.000 0.004 0.004 0.992 0.000
#> SRR330903 4 0.1285 0.7915 0.000 0.000 0.000 0.944 0.052 0.004
#> SRR330904 4 0.3073 0.5742 0.008 0.204 0.000 0.788 0.000 0.000
#> SRR330906 4 0.3102 0.7387 0.000 0.000 0.000 0.816 0.156 0.028
#> SRR330907 1 0.4315 0.7191 0.524 0.000 0.008 0.000 0.460 0.008
#> SRR330908 4 0.0291 0.7965 0.004 0.000 0.000 0.992 0.004 0.000
#> SRR330909 5 0.1526 0.7477 0.036 0.000 0.008 0.004 0.944 0.008
#> SRR330910 4 0.3707 0.6288 0.000 0.000 0.000 0.680 0.312 0.008
#> SRR330911 4 0.0260 0.7944 0.008 0.000 0.000 0.992 0.000 0.000
#> SRR330912 4 0.0260 0.7944 0.008 0.000 0.000 0.992 0.000 0.000
#> SRR330913 4 0.4344 0.5557 0.000 0.000 0.000 0.612 0.356 0.032
#> SRR330914 4 0.3791 0.6827 0.000 0.000 0.000 0.732 0.236 0.032
#> SRR330915 5 0.0865 0.8397 0.000 0.000 0.000 0.036 0.964 0.000
#> SRR330916 4 0.0260 0.7944 0.008 0.000 0.000 0.992 0.000 0.000
#> SRR330917 5 0.4499 -0.1242 0.000 0.000 0.000 0.428 0.540 0.032
#> SRR330918 6 0.4858 0.9043 0.036 0.000 0.048 0.008 0.200 0.708
#> SRR330919 5 0.1204 0.8261 0.000 0.000 0.000 0.056 0.944 0.000
#> SRR330920 5 0.1194 0.7616 0.032 0.000 0.008 0.004 0.956 0.000
#> SRR330921 5 0.0865 0.8397 0.000 0.000 0.000 0.036 0.964 0.000
#> SRR330922 5 0.0937 0.8378 0.000 0.000 0.000 0.040 0.960 0.000
#> SRR330923 5 0.3840 -0.0548 0.288 0.000 0.008 0.000 0.696 0.008
Heatmaps for the consensus matrix. It visualizes the probability of two samples to be in a same group.
consensus_heatmap(res, k = 2)
consensus_heatmap(res, k = 3)
consensus_heatmap(res, k = 4)
consensus_heatmap(res, k = 5)
consensus_heatmap(res, k = 6)
Heatmaps for the membership of samples in all partitions to see how consistent they are:
membership_heatmap(res, k = 2)
membership_heatmap(res, k = 3)
membership_heatmap(res, k = 4)
membership_heatmap(res, k = 5)
membership_heatmap(res, k = 6)
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)
get_signatures(res, k = 3)
get_signatures(res, k = 4)
get_signatures(res, k = 5)
get_signatures(res, k = 6)
Signature heatmaps where rows are not scaled:
get_signatures(res, k = 2, scale_rows = FALSE)
get_signatures(res, k = 3, scale_rows = FALSE)
get_signatures(res, k = 4, scale_rows = FALSE)
get_signatures(res, k = 5, scale_rows = FALSE)
get_signatures(res, k = 6, scale_rows = FALSE)
Compare the overlap of signatures from different k:
compare_signatures(res)
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:
which_row
: row indices corresponding to the input matrix.fdr
: FDR for the differential test. mean_x
: The mean value in group x.scaled_mean_x
: The mean value in group x after rows are scaled.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")
dimension_reduction(res, k = 3, method = "UMAP")
dimension_reduction(res, k = 4, method = "UMAP")
dimension_reduction(res, k = 5, method = "UMAP")
dimension_reduction(res, k = 6, method = "UMAP")
Following heatmap shows how subgroups are split when increasing k
:
collect_classes(res)
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.
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 10869 rows and 66 columns.
#> Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'SD' method.
#> Subgroups are detected by 'skmeans' method.
#> Performed in total 1250 partitions by row resampling.
#> Best k for subgroups seems to be 2.
#>
#> Following methods can be applied to this 'ConsensusPartition' object:
#> [1] "cola_report" "collect_classes" "collect_plots"
#> [4] "collect_stats" "colnames" "compare_signatures"
#> [7] "consensus_heatmap" "dimension_reduction" "functional_enrichment"
#> [10] "get_anno_col" "get_anno" "get_classes"
#> [13] "get_consensus" "get_matrix" "get_membership"
#> [16] "get_param" "get_signatures" "get_stats"
#> [19] "is_best_k" "is_stable_k" "membership_heatmap"
#> [22] "ncol" "nrow" "plot_ecdf"
#> [25] "rownames" "select_partition_number" "show"
#> [28] "suggest_best_k" "test_to_known_factors"
collect_plots()
function collects all the plots made from res
for all k
(number of partitions)
into one single page to provide an easy and fast comparison between different k
.
collect_plots(res)
The plots are:
k
and the heatmap of
predicted classes for each k
.k
.k
.k
.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:
k
;k
, the area increased is defined as \(A_k - A_{k-1}\).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)
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.936 0.919 0.968 0.5057 0.493 0.493
#> 3 3 0.586 0.683 0.847 0.2753 0.846 0.695
#> 4 4 0.570 0.572 0.735 0.1246 0.895 0.723
#> 5 5 0.629 0.504 0.722 0.0650 0.799 0.424
#> 6 6 0.655 0.594 0.741 0.0421 0.931 0.702
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.
cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#> class entropy silhouette p1 p2
#> SRR330857 1 0.0000 0.9845 1.000 0.000
#> SRR330858 1 0.0000 0.9845 1.000 0.000
#> SRR330859 1 0.0000 0.9845 1.000 0.000
#> SRR330860 2 0.0000 0.9465 0.000 1.000
#> SRR330861 1 0.0000 0.9845 1.000 0.000
#> SRR330862 2 0.0000 0.9465 0.000 1.000
#> SRR330863 1 0.0000 0.9845 1.000 0.000
#> SRR330864 2 0.0000 0.9465 0.000 1.000
#> SRR330865 1 0.0000 0.9845 1.000 0.000
#> SRR330866 2 0.0000 0.9465 0.000 1.000
#> SRR330867 1 0.0000 0.9845 1.000 0.000
#> SRR330868 2 0.0000 0.9465 0.000 1.000
#> SRR330869 2 0.9993 0.0768 0.484 0.516
#> SRR330870 1 0.0000 0.9845 1.000 0.000
#> SRR330871 1 0.0000 0.9845 1.000 0.000
#> SRR330872 2 0.0000 0.9465 0.000 1.000
#> SRR330873 1 0.0000 0.9845 1.000 0.000
#> SRR330874 2 0.0000 0.9465 0.000 1.000
#> SRR330875 1 0.0000 0.9845 1.000 0.000
#> SRR330876 1 0.0000 0.9845 1.000 0.000
#> SRR330877 1 0.0000 0.9845 1.000 0.000
#> SRR330878 1 0.0000 0.9845 1.000 0.000
#> SRR330879 1 0.0000 0.9845 1.000 0.000
#> SRR330880 2 0.0000 0.9465 0.000 1.000
#> SRR330881 1 0.0000 0.9845 1.000 0.000
#> SRR330882 1 0.8327 0.6238 0.736 0.264
#> SRR330883 2 0.0000 0.9465 0.000 1.000
#> SRR330884 2 0.9754 0.3379 0.408 0.592
#> SRR330885 2 0.0000 0.9465 0.000 1.000
#> SRR330886 1 0.2043 0.9532 0.968 0.032
#> SRR330887 1 0.0000 0.9845 1.000 0.000
#> SRR330888 1 0.0000 0.9845 1.000 0.000
#> SRR330889 2 0.0000 0.9465 0.000 1.000
#> SRR330890 2 0.0000 0.9465 0.000 1.000
#> SRR330891 2 0.0000 0.9465 0.000 1.000
#> SRR330892 2 0.0000 0.9465 0.000 1.000
#> SRR330893 2 0.0000 0.9465 0.000 1.000
#> SRR330894 2 0.0000 0.9465 0.000 1.000
#> SRR330895 2 0.0000 0.9465 0.000 1.000
#> SRR330896 2 0.0672 0.9404 0.008 0.992
#> SRR330897 2 0.0000 0.9465 0.000 1.000
#> SRR330898 2 0.0000 0.9465 0.000 1.000
#> SRR330899 1 0.0000 0.9845 1.000 0.000
#> SRR330900 1 0.0000 0.9845 1.000 0.000
#> SRR330901 1 0.0000 0.9845 1.000 0.000
#> SRR330902 1 0.0000 0.9845 1.000 0.000
#> SRR330903 2 0.0000 0.9465 0.000 1.000
#> SRR330904 2 0.0000 0.9465 0.000 1.000
#> SRR330906 2 0.7219 0.7342 0.200 0.800
#> SRR330907 1 0.0000 0.9845 1.000 0.000
#> SRR330908 2 0.0000 0.9465 0.000 1.000
#> SRR330909 1 0.0000 0.9845 1.000 0.000
#> SRR330910 2 0.9977 0.1500 0.472 0.528
#> SRR330911 2 0.0000 0.9465 0.000 1.000
#> SRR330912 2 0.0000 0.9465 0.000 1.000
#> SRR330913 2 0.2236 0.9169 0.036 0.964
#> SRR330914 2 0.0000 0.9465 0.000 1.000
#> SRR330915 1 0.0000 0.9845 1.000 0.000
#> SRR330916 2 0.0000 0.9465 0.000 1.000
#> SRR330917 1 0.6801 0.7683 0.820 0.180
#> SRR330918 1 0.0000 0.9845 1.000 0.000
#> SRR330919 1 0.0000 0.9845 1.000 0.000
#> SRR330920 1 0.0000 0.9845 1.000 0.000
#> SRR330921 1 0.0000 0.9845 1.000 0.000
#> SRR330922 1 0.0000 0.9845 1.000 0.000
#> SRR330923 1 0.0000 0.9845 1.000 0.000
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> SRR330857 1 0.4452 0.7149 0.808 0.000 0.192
#> SRR330858 1 0.4235 0.7281 0.824 0.000 0.176
#> SRR330859 3 0.5760 0.5245 0.328 0.000 0.672
#> SRR330860 2 0.5733 0.7058 0.000 0.676 0.324
#> SRR330861 3 0.5733 0.5301 0.324 0.000 0.676
#> SRR330862 3 0.0424 0.6874 0.000 0.008 0.992
#> SRR330863 3 0.5859 0.4960 0.344 0.000 0.656
#> SRR330864 3 0.0424 0.6874 0.000 0.008 0.992
#> SRR330865 1 0.5431 0.5809 0.716 0.000 0.284
#> SRR330866 2 0.2625 0.8116 0.000 0.916 0.084
#> SRR330867 1 0.4399 0.7190 0.812 0.000 0.188
#> SRR330868 3 0.0424 0.6874 0.000 0.008 0.992
#> SRR330869 2 0.5812 0.5362 0.264 0.724 0.012
#> SRR330870 1 0.4399 0.7190 0.812 0.000 0.188
#> SRR330871 3 0.6244 0.2369 0.440 0.000 0.560
#> SRR330872 3 0.0424 0.6874 0.000 0.008 0.992
#> SRR330873 1 0.4399 0.7190 0.812 0.000 0.188
#> SRR330874 2 0.5650 0.7175 0.000 0.688 0.312
#> SRR330875 1 0.4931 0.6677 0.768 0.000 0.232
#> SRR330876 1 0.4555 0.7064 0.800 0.000 0.200
#> SRR330877 3 0.5733 0.5301 0.324 0.000 0.676
#> SRR330878 1 0.4842 0.6776 0.776 0.000 0.224
#> SRR330879 1 0.6295 0.0147 0.528 0.000 0.472
#> SRR330880 3 0.0592 0.6862 0.000 0.012 0.988
#> SRR330881 1 0.0237 0.8229 0.996 0.000 0.004
#> SRR330882 1 0.9334 0.1157 0.508 0.292 0.200
#> SRR330883 2 0.5650 0.7175 0.000 0.688 0.312
#> SRR330884 2 0.5517 0.5890 0.268 0.728 0.004
#> SRR330885 2 0.3879 0.7937 0.000 0.848 0.152
#> SRR330886 1 0.5951 0.5525 0.764 0.040 0.196
#> SRR330887 1 0.0000 0.8240 1.000 0.000 0.000
#> SRR330888 1 0.0000 0.8240 1.000 0.000 0.000
#> SRR330889 3 0.6168 -0.0667 0.000 0.412 0.588
#> SRR330890 2 0.1525 0.8165 0.004 0.964 0.032
#> SRR330891 2 0.1753 0.8169 0.000 0.952 0.048
#> SRR330892 2 0.5650 0.7175 0.000 0.688 0.312
#> SRR330893 2 0.0592 0.8132 0.000 0.988 0.012
#> SRR330894 2 0.1163 0.8158 0.000 0.972 0.028
#> SRR330895 2 0.5650 0.7175 0.000 0.688 0.312
#> SRR330896 2 0.3784 0.7349 0.132 0.864 0.004
#> SRR330897 2 0.5650 0.7175 0.000 0.688 0.312
#> SRR330898 2 0.5650 0.7175 0.000 0.688 0.312
#> SRR330899 1 0.0000 0.8240 1.000 0.000 0.000
#> SRR330900 1 0.0237 0.8221 0.996 0.000 0.004
#> SRR330901 1 0.0000 0.8240 1.000 0.000 0.000
#> SRR330902 1 0.0000 0.8240 1.000 0.000 0.000
#> SRR330903 2 0.0475 0.8077 0.004 0.992 0.004
#> SRR330904 2 0.4750 0.7694 0.000 0.784 0.216
#> SRR330906 2 0.8249 0.6497 0.200 0.636 0.164
#> SRR330907 1 0.0237 0.8229 0.996 0.000 0.004
#> SRR330908 2 0.0000 0.8102 0.000 1.000 0.000
#> SRR330909 1 0.0000 0.8240 1.000 0.000 0.000
#> SRR330910 2 0.5623 0.5710 0.280 0.716 0.004
#> SRR330911 2 0.0592 0.8132 0.000 0.988 0.012
#> SRR330912 2 0.1860 0.8167 0.000 0.948 0.052
#> SRR330913 2 0.4172 0.7151 0.156 0.840 0.004
#> SRR330914 2 0.0475 0.8077 0.004 0.992 0.004
#> SRR330915 1 0.0000 0.8240 1.000 0.000 0.000
#> SRR330916 2 0.0237 0.8113 0.000 0.996 0.004
#> SRR330917 1 0.6505 0.0201 0.528 0.468 0.004
#> SRR330918 1 0.0475 0.8199 0.992 0.004 0.004
#> SRR330919 1 0.0475 0.8199 0.992 0.004 0.004
#> SRR330920 1 0.0000 0.8240 1.000 0.000 0.000
#> SRR330921 1 0.0000 0.8240 1.000 0.000 0.000
#> SRR330922 1 0.0475 0.8199 0.992 0.004 0.004
#> SRR330923 1 0.0000 0.8240 1.000 0.000 0.000
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> SRR330857 1 0.5489 0.6739 0.664 0.296 0.040 0.000
#> SRR330858 1 0.5137 0.6855 0.680 0.296 0.024 0.000
#> SRR330859 3 0.6750 0.6015 0.128 0.288 0.584 0.000
#> SRR330860 2 0.7744 0.6743 0.000 0.440 0.268 0.292
#> SRR330861 3 0.6522 0.6233 0.112 0.280 0.608 0.000
#> SRR330862 3 0.1151 0.6395 0.000 0.008 0.968 0.024
#> SRR330863 3 0.7068 0.5530 0.156 0.296 0.548 0.000
#> SRR330864 3 0.0817 0.6468 0.000 0.000 0.976 0.024
#> SRR330865 1 0.6508 0.5914 0.600 0.296 0.104 0.000
#> SRR330866 4 0.2844 0.4903 0.000 0.052 0.048 0.900
#> SRR330867 1 0.5321 0.6806 0.672 0.296 0.032 0.000
#> SRR330868 3 0.0817 0.6468 0.000 0.000 0.976 0.024
#> SRR330869 4 0.7215 0.4990 0.164 0.252 0.008 0.576
#> SRR330870 1 0.5321 0.6806 0.672 0.296 0.032 0.000
#> SRR330871 3 0.7415 0.4344 0.248 0.236 0.516 0.000
#> SRR330872 3 0.0469 0.6484 0.000 0.012 0.988 0.000
#> SRR330873 1 0.5321 0.6806 0.672 0.296 0.032 0.000
#> SRR330874 2 0.7674 0.7115 0.000 0.436 0.224 0.340
#> SRR330875 1 0.5861 0.6561 0.644 0.296 0.060 0.000
#> SRR330876 1 0.5489 0.6739 0.664 0.296 0.040 0.000
#> SRR330877 3 0.6450 0.6284 0.108 0.276 0.616 0.000
#> SRR330878 1 0.5646 0.6660 0.656 0.296 0.048 0.000
#> SRR330879 1 0.7859 -0.0365 0.376 0.272 0.352 0.000
#> SRR330880 3 0.0817 0.6495 0.000 0.000 0.976 0.024
#> SRR330881 1 0.2589 0.7728 0.884 0.116 0.000 0.000
#> SRR330882 2 0.9231 0.2851 0.232 0.452 0.144 0.172
#> SRR330883 2 0.7084 0.7683 0.000 0.440 0.124 0.436
#> SRR330884 4 0.7338 0.4870 0.184 0.244 0.008 0.564
#> SRR330885 4 0.6491 -0.4552 0.000 0.396 0.076 0.528
#> SRR330886 1 0.7585 0.4161 0.560 0.276 0.136 0.028
#> SRR330887 1 0.0188 0.7899 0.996 0.004 0.000 0.000
#> SRR330888 1 0.0188 0.7899 0.996 0.004 0.000 0.000
#> SRR330889 3 0.5636 0.0127 0.000 0.024 0.552 0.424
#> SRR330890 4 0.5044 0.4224 0.012 0.212 0.028 0.748
#> SRR330891 4 0.3893 0.2630 0.000 0.196 0.008 0.796
#> SRR330892 2 0.7084 0.7683 0.000 0.440 0.124 0.436
#> SRR330893 4 0.0804 0.5523 0.000 0.012 0.008 0.980
#> SRR330894 4 0.1284 0.5624 0.000 0.024 0.012 0.964
#> SRR330895 2 0.7084 0.7683 0.000 0.440 0.124 0.436
#> SRR330896 4 0.5664 0.5632 0.076 0.192 0.008 0.724
#> SRR330897 2 0.7084 0.7683 0.000 0.440 0.124 0.436
#> SRR330898 2 0.7084 0.7683 0.000 0.440 0.124 0.436
#> SRR330899 1 0.0524 0.7872 0.988 0.008 0.004 0.000
#> SRR330900 1 0.1902 0.7548 0.932 0.064 0.000 0.004
#> SRR330901 1 0.0188 0.7899 0.996 0.004 0.000 0.000
#> SRR330902 1 0.0336 0.7911 0.992 0.008 0.000 0.000
#> SRR330903 4 0.3172 0.5862 0.004 0.112 0.012 0.872
#> SRR330904 4 0.6050 -0.6293 0.000 0.432 0.044 0.524
#> SRR330906 2 0.8179 0.4339 0.188 0.488 0.032 0.292
#> SRR330907 1 0.2345 0.7772 0.900 0.100 0.000 0.000
#> SRR330908 4 0.1722 0.5806 0.000 0.048 0.008 0.944
#> SRR330909 1 0.1389 0.7880 0.952 0.048 0.000 0.000
#> SRR330910 4 0.6892 0.4664 0.240 0.152 0.004 0.604
#> SRR330911 4 0.1042 0.5626 0.000 0.008 0.020 0.972
#> SRR330912 4 0.4741 0.0974 0.000 0.228 0.028 0.744
#> SRR330913 4 0.7378 0.4656 0.136 0.352 0.008 0.504
#> SRR330914 4 0.4997 0.5649 0.024 0.232 0.008 0.736
#> SRR330915 1 0.0188 0.7899 0.996 0.004 0.000 0.000
#> SRR330916 4 0.0927 0.5700 0.000 0.016 0.008 0.976
#> SRR330917 4 0.8184 0.3116 0.336 0.304 0.008 0.352
#> SRR330918 1 0.3781 0.6834 0.844 0.124 0.004 0.028
#> SRR330919 1 0.1938 0.7569 0.936 0.052 0.000 0.012
#> SRR330920 1 0.0000 0.7905 1.000 0.000 0.000 0.000
#> SRR330921 1 0.0336 0.7886 0.992 0.008 0.000 0.000
#> SRR330922 1 0.1305 0.7729 0.960 0.036 0.000 0.004
#> SRR330923 1 0.0000 0.7905 1.000 0.000 0.000 0.000
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> SRR330857 1 0.0162 0.5949 0.996 0.000 0.004 0.000 0.000
#> SRR330858 1 0.0290 0.5860 0.992 0.000 0.000 0.000 0.008
#> SRR330859 1 0.5240 0.2878 0.584 0.000 0.360 0.000 0.056
#> SRR330860 2 0.1430 0.7482 0.000 0.944 0.052 0.000 0.004
#> SRR330861 1 0.4866 0.2639 0.580 0.000 0.392 0.000 0.028
#> SRR330862 3 0.1124 0.9145 0.004 0.036 0.960 0.000 0.000
#> SRR330863 1 0.5171 0.4034 0.648 0.000 0.276 0.000 0.076
#> SRR330864 3 0.0955 0.9169 0.004 0.028 0.968 0.000 0.000
#> SRR330865 1 0.1571 0.5989 0.936 0.000 0.060 0.000 0.004
#> SRR330866 4 0.5398 0.5921 0.000 0.280 0.064 0.644 0.012
#> SRR330867 1 0.0162 0.5904 0.996 0.000 0.000 0.000 0.004
#> SRR330868 3 0.1041 0.9164 0.004 0.032 0.964 0.000 0.000
#> SRR330869 4 0.6564 0.3581 0.024 0.040 0.036 0.460 0.440
#> SRR330870 1 0.0162 0.5904 0.996 0.000 0.000 0.000 0.004
#> SRR330871 1 0.4457 0.3867 0.620 0.000 0.368 0.000 0.012
#> SRR330872 3 0.1153 0.9151 0.008 0.024 0.964 0.000 0.004
#> SRR330873 1 0.0324 0.5931 0.992 0.000 0.004 0.000 0.004
#> SRR330874 2 0.0880 0.7644 0.000 0.968 0.032 0.000 0.000
#> SRR330875 1 0.2152 0.5953 0.920 0.000 0.044 0.004 0.032
#> SRR330876 1 0.0451 0.5974 0.988 0.000 0.004 0.000 0.008
#> SRR330877 1 0.4825 0.2316 0.568 0.000 0.408 0.000 0.024
#> SRR330878 1 0.0510 0.5991 0.984 0.000 0.016 0.000 0.000
#> SRR330879 1 0.4826 0.5400 0.736 0.000 0.180 0.012 0.072
#> SRR330880 3 0.1153 0.9150 0.008 0.024 0.964 0.000 0.004
#> SRR330881 1 0.3857 -0.1808 0.688 0.000 0.000 0.000 0.312
#> SRR330882 2 0.7930 0.3561 0.104 0.528 0.060 0.076 0.232
#> SRR330883 2 0.0000 0.7747 0.000 1.000 0.000 0.000 0.000
#> SRR330884 4 0.4597 0.5305 0.000 0.004 0.024 0.672 0.300
#> SRR330885 2 0.5162 0.5305 0.000 0.692 0.024 0.236 0.048
#> SRR330886 1 0.7819 -0.0228 0.408 0.056 0.060 0.076 0.400
#> SRR330887 5 0.4300 0.6910 0.476 0.000 0.000 0.000 0.524
#> SRR330888 5 0.4291 0.7012 0.464 0.000 0.000 0.000 0.536
#> SRR330889 3 0.5857 0.4511 0.000 0.076 0.636 0.256 0.032
#> SRR330890 4 0.6514 0.4135 0.000 0.308 0.028 0.544 0.120
#> SRR330891 2 0.4911 -0.1924 0.000 0.504 0.008 0.476 0.012
#> SRR330892 2 0.0000 0.7747 0.000 1.000 0.000 0.000 0.000
#> SRR330893 4 0.4146 0.6283 0.000 0.268 0.012 0.716 0.004
#> SRR330894 4 0.4851 0.6173 0.000 0.276 0.032 0.680 0.012
#> SRR330895 2 0.0000 0.7747 0.000 1.000 0.000 0.000 0.000
#> SRR330896 4 0.4625 0.6279 0.000 0.028 0.032 0.748 0.192
#> SRR330897 2 0.0000 0.7747 0.000 1.000 0.000 0.000 0.000
#> SRR330898 2 0.0000 0.7747 0.000 1.000 0.000 0.000 0.000
#> SRR330899 5 0.4262 0.7013 0.440 0.000 0.000 0.000 0.560
#> SRR330900 5 0.4781 0.6528 0.388 0.000 0.008 0.012 0.592
#> SRR330901 5 0.4294 0.6983 0.468 0.000 0.000 0.000 0.532
#> SRR330902 1 0.4287 -0.6059 0.540 0.000 0.000 0.000 0.460
#> SRR330903 4 0.3350 0.6845 0.000 0.112 0.004 0.844 0.040
#> SRR330904 2 0.1732 0.7266 0.000 0.920 0.000 0.080 0.000
#> SRR330906 2 0.6061 0.5030 0.004 0.656 0.032 0.116 0.192
#> SRR330907 1 0.3966 -0.2605 0.664 0.000 0.000 0.000 0.336
#> SRR330908 4 0.3402 0.6775 0.000 0.184 0.008 0.804 0.004
#> SRR330909 1 0.4440 -0.5849 0.528 0.000 0.000 0.004 0.468
#> SRR330910 4 0.4329 0.6043 0.000 0.028 0.008 0.740 0.224
#> SRR330911 4 0.4799 0.6523 0.000 0.220 0.056 0.716 0.008
#> SRR330912 2 0.4819 0.0984 0.000 0.576 0.008 0.404 0.012
#> SRR330913 5 0.6582 -0.4621 0.004 0.096 0.024 0.424 0.452
#> SRR330914 4 0.4866 0.5789 0.000 0.044 0.020 0.720 0.216
#> SRR330915 5 0.4291 0.7007 0.464 0.000 0.000 0.000 0.536
#> SRR330916 4 0.3388 0.6721 0.000 0.200 0.008 0.792 0.000
#> SRR330917 5 0.5853 -0.1580 0.012 0.048 0.028 0.276 0.636
#> SRR330918 5 0.6510 0.3973 0.252 0.028 0.020 0.092 0.608
#> SRR330919 5 0.4798 0.6694 0.396 0.000 0.000 0.024 0.580
#> SRR330920 5 0.4302 0.6856 0.480 0.000 0.000 0.000 0.520
#> SRR330921 5 0.4291 0.7012 0.464 0.000 0.000 0.000 0.536
#> SRR330922 5 0.4375 0.6940 0.420 0.000 0.000 0.004 0.576
#> SRR330923 5 0.4302 0.6856 0.480 0.000 0.000 0.000 0.520
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> SRR330857 1 0.0935 0.71682 0.964 0.000 0.000 0.032 0.004 0.000
#> SRR330858 1 0.0713 0.72072 0.972 0.000 0.000 0.028 0.000 0.000
#> SRR330859 1 0.5118 0.52567 0.660 0.000 0.256 0.044 0.020 0.020
#> SRR330860 2 0.0935 0.73416 0.000 0.964 0.032 0.000 0.004 0.000
#> SRR330861 1 0.4202 0.56619 0.704 0.000 0.260 0.020 0.008 0.008
#> SRR330862 3 0.0653 0.89904 0.004 0.012 0.980 0.004 0.000 0.000
#> SRR330863 1 0.5280 0.59247 0.716 0.000 0.132 0.080 0.028 0.044
#> SRR330864 3 0.0260 0.90340 0.000 0.008 0.992 0.000 0.000 0.000
#> SRR330865 1 0.0964 0.72636 0.968 0.000 0.012 0.016 0.000 0.004
#> SRR330866 5 0.4992 0.67363 0.000 0.252 0.040 0.008 0.668 0.032
#> SRR330867 1 0.0935 0.71886 0.964 0.000 0.000 0.032 0.000 0.004
#> SRR330868 3 0.0260 0.90340 0.000 0.008 0.992 0.000 0.000 0.000
#> SRR330869 6 0.5543 0.66866 0.004 0.012 0.012 0.152 0.168 0.652
#> SRR330870 1 0.0937 0.71231 0.960 0.000 0.000 0.040 0.000 0.000
#> SRR330871 1 0.4155 0.50576 0.648 0.000 0.332 0.012 0.004 0.004
#> SRR330872 3 0.0436 0.90003 0.000 0.004 0.988 0.004 0.000 0.004
#> SRR330873 1 0.0790 0.71749 0.968 0.000 0.000 0.032 0.000 0.000
#> SRR330874 2 0.0363 0.74803 0.000 0.988 0.012 0.000 0.000 0.000
#> SRR330875 1 0.2752 0.69950 0.888 0.000 0.020 0.052 0.016 0.024
#> SRR330876 1 0.0260 0.72564 0.992 0.000 0.000 0.008 0.000 0.000
#> SRR330877 1 0.4097 0.55762 0.700 0.000 0.272 0.012 0.008 0.008
#> SRR330878 1 0.0363 0.72513 0.988 0.000 0.000 0.012 0.000 0.000
#> SRR330879 1 0.5545 0.60017 0.680 0.000 0.156 0.092 0.012 0.060
#> SRR330880 3 0.0291 0.90112 0.000 0.004 0.992 0.004 0.000 0.000
#> SRR330881 1 0.3937 -0.37950 0.572 0.000 0.000 0.424 0.004 0.000
#> SRR330882 2 0.8016 0.18152 0.096 0.464 0.016 0.176 0.060 0.188
#> SRR330883 2 0.0000 0.75118 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR330884 6 0.5563 0.58059 0.000 0.000 0.004 0.136 0.332 0.528
#> SRR330885 2 0.6726 0.36355 0.000 0.536 0.036 0.032 0.192 0.204
#> SRR330886 4 0.8192 0.07307 0.280 0.056 0.024 0.408 0.092 0.140
#> SRR330887 4 0.3721 0.81805 0.308 0.000 0.000 0.684 0.004 0.004
#> SRR330888 4 0.3584 0.81706 0.308 0.000 0.000 0.688 0.000 0.004
#> SRR330889 3 0.5939 0.39212 0.000 0.052 0.600 0.024 0.268 0.056
#> SRR330890 5 0.6838 0.19950 0.000 0.256 0.020 0.016 0.388 0.320
#> SRR330891 2 0.5563 -0.08883 0.000 0.504 0.008 0.020 0.408 0.060
#> SRR330892 2 0.0000 0.75118 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR330893 5 0.3683 0.71481 0.000 0.212 0.004 0.004 0.760 0.020
#> SRR330894 5 0.4371 0.70543 0.000 0.228 0.020 0.012 0.720 0.020
#> SRR330895 2 0.0000 0.75118 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR330896 5 0.6337 0.20756 0.000 0.032 0.028 0.128 0.572 0.240
#> SRR330897 2 0.0000 0.75118 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR330898 2 0.0000 0.75118 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR330899 4 0.4178 0.80283 0.248 0.000 0.000 0.708 0.008 0.036
#> SRR330900 4 0.4979 0.75972 0.232 0.000 0.000 0.648 0.004 0.116
#> SRR330901 4 0.3684 0.81831 0.300 0.000 0.000 0.692 0.004 0.004
#> SRR330902 4 0.4079 0.74871 0.380 0.000 0.000 0.608 0.004 0.008
#> SRR330903 5 0.3814 0.66066 0.000 0.096 0.000 0.032 0.808 0.064
#> SRR330904 2 0.2100 0.66968 0.000 0.884 0.000 0.000 0.112 0.004
#> SRR330906 2 0.5552 0.28544 0.000 0.548 0.000 0.060 0.040 0.352
#> SRR330907 1 0.3996 -0.53525 0.512 0.000 0.000 0.484 0.004 0.000
#> SRR330908 5 0.3236 0.66955 0.000 0.104 0.000 0.020 0.840 0.036
#> SRR330909 4 0.4636 0.70587 0.336 0.000 0.000 0.620 0.024 0.020
#> SRR330910 5 0.5420 0.20181 0.000 0.016 0.004 0.236 0.628 0.116
#> SRR330911 5 0.4250 0.71589 0.000 0.180 0.032 0.012 0.756 0.020
#> SRR330912 2 0.4682 -0.00378 0.000 0.540 0.000 0.004 0.420 0.036
#> SRR330913 6 0.4289 0.68032 0.000 0.028 0.000 0.104 0.100 0.768
#> SRR330914 6 0.5151 0.32262 0.000 0.044 0.000 0.020 0.428 0.508
#> SRR330915 4 0.3446 0.81763 0.308 0.000 0.000 0.692 0.000 0.000
#> SRR330916 5 0.3156 0.71299 0.000 0.180 0.000 0.000 0.800 0.020
#> SRR330917 6 0.3956 0.64788 0.008 0.000 0.000 0.204 0.040 0.748
#> SRR330918 4 0.7571 0.11331 0.144 0.008 0.020 0.472 0.140 0.216
#> SRR330919 4 0.4698 0.74755 0.188 0.000 0.004 0.720 0.028 0.060
#> SRR330920 4 0.3515 0.80989 0.324 0.000 0.000 0.676 0.000 0.000
#> SRR330921 4 0.3371 0.81876 0.292 0.000 0.000 0.708 0.000 0.000
#> SRR330922 4 0.4284 0.77974 0.216 0.000 0.000 0.720 0.008 0.056
#> SRR330923 4 0.3563 0.80072 0.336 0.000 0.000 0.664 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)
consensus_heatmap(res, k = 3)
consensus_heatmap(res, k = 4)
consensus_heatmap(res, k = 5)
consensus_heatmap(res, k = 6)
Heatmaps for the membership of samples in all partitions to see how consistent they are:
membership_heatmap(res, k = 2)
membership_heatmap(res, k = 3)
membership_heatmap(res, k = 4)
membership_heatmap(res, k = 5)
membership_heatmap(res, k = 6)
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)
get_signatures(res, k = 3)
get_signatures(res, k = 4)
get_signatures(res, k = 5)
get_signatures(res, k = 6)
Signature heatmaps where rows are not scaled:
get_signatures(res, k = 2, scale_rows = FALSE)
get_signatures(res, k = 3, scale_rows = FALSE)
get_signatures(res, k = 4, scale_rows = FALSE)
#> Error in mat[ceiling(1:nr/h_ratio), ceiling(1:nc/w_ratio), drop = FALSE]: subscript out of bounds
get_signatures(res, k = 5, scale_rows = FALSE)
get_signatures(res, k = 6, scale_rows = FALSE)
Compare the overlap of signatures from different k:
compare_signatures(res)
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:
which_row
: row indices corresponding to the input matrix.fdr
: FDR for the differential test. mean_x
: The mean value in group x.scaled_mean_x
: The mean value in group x after rows are scaled.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")
dimension_reduction(res, k = 3, method = "UMAP")
dimension_reduction(res, k = 4, method = "UMAP")
dimension_reduction(res, k = 5, method = "UMAP")
dimension_reduction(res, k = 6, method = "UMAP")
Following heatmap shows how subgroups are split when increasing k
:
collect_classes(res)
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.
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 10869 rows and 66 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 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)
The plots are:
k
and the heatmap of
predicted classes for each k
.k
.k
.k
.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:
k
;k
, the area increased is defined as \(A_k - A_{k-1}\).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)
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.387 0.819 0.886 0.3175 0.784 0.784
#> 3 3 0.314 0.735 0.802 0.5734 0.675 0.585
#> 4 4 0.566 0.692 0.835 0.1992 0.920 0.837
#> 5 5 0.516 0.640 0.818 0.0319 0.997 0.994
#> 6 6 0.505 0.662 0.842 0.0502 0.812 0.600
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.
cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#> class entropy silhouette p1 p2
#> SRR330857 1 0.0000 0.858 1.000 0.000
#> SRR330858 1 0.0000 0.858 1.000 0.000
#> SRR330859 1 0.0000 0.858 1.000 0.000
#> SRR330860 2 0.0000 1.000 0.000 1.000
#> SRR330861 1 0.0000 0.858 1.000 0.000
#> SRR330862 1 0.9209 0.635 0.664 0.336
#> SRR330863 1 0.0000 0.858 1.000 0.000
#> SRR330864 1 0.8608 0.649 0.716 0.284
#> SRR330865 1 0.0000 0.858 1.000 0.000
#> SRR330866 1 0.9661 0.608 0.608 0.392
#> SRR330867 1 0.0000 0.858 1.000 0.000
#> SRR330868 1 0.8608 0.649 0.716 0.284
#> SRR330869 1 0.5059 0.848 0.888 0.112
#> SRR330870 1 0.0000 0.858 1.000 0.000
#> SRR330871 1 0.0000 0.858 1.000 0.000
#> SRR330872 1 0.8661 0.649 0.712 0.288
#> SRR330873 1 0.0000 0.858 1.000 0.000
#> SRR330874 2 0.0000 1.000 0.000 1.000
#> SRR330875 1 0.0000 0.858 1.000 0.000
#> SRR330876 1 0.0000 0.858 1.000 0.000
#> SRR330877 1 0.0000 0.858 1.000 0.000
#> SRR330878 1 0.0000 0.858 1.000 0.000
#> SRR330879 1 0.0000 0.858 1.000 0.000
#> SRR330880 1 0.9358 0.651 0.648 0.352
#> SRR330881 1 0.0000 0.858 1.000 0.000
#> SRR330882 1 0.4939 0.849 0.892 0.108
#> SRR330883 2 0.0000 1.000 0.000 1.000
#> SRR330884 1 0.5059 0.848 0.888 0.112
#> SRR330885 1 0.9608 0.619 0.616 0.384
#> SRR330886 1 0.0376 0.858 0.996 0.004
#> SRR330887 1 0.1184 0.858 0.984 0.016
#> SRR330888 1 0.0000 0.858 1.000 0.000
#> SRR330889 1 0.9661 0.608 0.608 0.392
#> SRR330890 1 0.9427 0.650 0.640 0.360
#> SRR330891 1 0.9661 0.608 0.608 0.392
#> SRR330892 2 0.0000 1.000 0.000 1.000
#> SRR330893 1 0.9661 0.608 0.608 0.392
#> SRR330894 1 0.9661 0.608 0.608 0.392
#> SRR330895 2 0.0000 1.000 0.000 1.000
#> SRR330896 1 0.5059 0.848 0.888 0.112
#> SRR330897 2 0.0000 1.000 0.000 1.000
#> SRR330898 2 0.0000 1.000 0.000 1.000
#> SRR330899 1 0.4939 0.849 0.892 0.108
#> SRR330900 1 0.0672 0.858 0.992 0.008
#> SRR330901 1 0.3879 0.854 0.924 0.076
#> SRR330902 1 0.0000 0.858 1.000 0.000
#> SRR330903 1 0.6801 0.815 0.820 0.180
#> SRR330904 2 0.0000 1.000 0.000 1.000
#> SRR330906 1 0.5408 0.845 0.876 0.124
#> SRR330907 1 0.0000 0.858 1.000 0.000
#> SRR330908 1 0.6531 0.822 0.832 0.168
#> SRR330909 1 0.0000 0.858 1.000 0.000
#> SRR330910 1 0.5059 0.848 0.888 0.112
#> SRR330911 1 0.9661 0.608 0.608 0.392
#> SRR330912 1 0.9661 0.608 0.608 0.392
#> SRR330913 1 0.5059 0.848 0.888 0.112
#> SRR330914 1 0.5059 0.848 0.888 0.112
#> SRR330915 1 0.4815 0.850 0.896 0.104
#> SRR330916 1 0.9661 0.608 0.608 0.392
#> SRR330917 1 0.5059 0.848 0.888 0.112
#> SRR330918 1 0.5059 0.848 0.888 0.112
#> SRR330919 1 0.4022 0.854 0.920 0.080
#> SRR330920 1 0.0000 0.858 1.000 0.000
#> SRR330921 1 0.4939 0.849 0.892 0.108
#> SRR330922 1 0.5059 0.848 0.888 0.112
#> SRR330923 1 0.0000 0.858 1.000 0.000
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> SRR330857 3 0.5465 0.902 0.288 0.000 0.712
#> SRR330858 3 0.5948 0.862 0.360 0.000 0.640
#> SRR330859 3 0.5882 0.846 0.348 0.000 0.652
#> SRR330860 2 0.5497 0.808 0.000 0.708 0.292
#> SRR330861 3 0.5431 0.903 0.284 0.000 0.716
#> SRR330862 1 0.8304 0.404 0.624 0.144 0.232
#> SRR330863 3 0.6225 0.691 0.432 0.000 0.568
#> SRR330864 3 0.9062 0.479 0.412 0.136 0.452
#> SRR330865 3 0.5431 0.903 0.284 0.000 0.716
#> SRR330866 1 0.5810 0.675 0.664 0.336 0.000
#> SRR330867 3 0.5882 0.872 0.348 0.000 0.652
#> SRR330868 3 0.8969 0.636 0.348 0.140 0.512
#> SRR330869 1 0.4452 0.753 0.808 0.192 0.000
#> SRR330870 3 0.5968 0.858 0.364 0.000 0.636
#> SRR330871 3 0.5431 0.903 0.284 0.000 0.716
#> SRR330872 3 0.6526 0.870 0.260 0.036 0.704
#> SRR330873 3 0.5859 0.874 0.344 0.000 0.656
#> SRR330874 2 0.1289 0.957 0.000 0.968 0.032
#> SRR330875 3 0.5431 0.903 0.284 0.000 0.716
#> SRR330876 3 0.5431 0.903 0.284 0.000 0.716
#> SRR330877 3 0.5431 0.903 0.284 0.000 0.716
#> SRR330878 3 0.5431 0.903 0.284 0.000 0.716
#> SRR330879 1 0.3686 0.666 0.860 0.000 0.140
#> SRR330880 1 0.7945 0.447 0.652 0.124 0.224
#> SRR330881 1 0.6305 -0.626 0.516 0.000 0.484
#> SRR330882 1 0.3116 0.768 0.892 0.108 0.000
#> SRR330883 2 0.0000 0.962 0.000 1.000 0.000
#> SRR330884 1 0.3192 0.767 0.888 0.112 0.000
#> SRR330885 1 0.5810 0.675 0.664 0.336 0.000
#> SRR330886 1 0.0237 0.748 0.996 0.000 0.004
#> SRR330887 1 0.0000 0.748 1.000 0.000 0.000
#> SRR330888 1 0.0000 0.748 1.000 0.000 0.000
#> SRR330889 1 0.5810 0.675 0.664 0.336 0.000
#> SRR330890 1 0.5760 0.680 0.672 0.328 0.000
#> SRR330891 1 0.5810 0.675 0.664 0.336 0.000
#> SRR330892 2 0.1289 0.957 0.000 0.968 0.032
#> SRR330893 1 0.5810 0.675 0.664 0.336 0.000
#> SRR330894 1 0.5810 0.675 0.664 0.336 0.000
#> SRR330895 2 0.0000 0.962 0.000 1.000 0.000
#> SRR330896 1 0.2066 0.765 0.940 0.060 0.000
#> SRR330897 2 0.0000 0.962 0.000 1.000 0.000
#> SRR330898 2 0.1289 0.957 0.000 0.968 0.032
#> SRR330899 1 0.0000 0.748 1.000 0.000 0.000
#> SRR330900 1 0.0000 0.748 1.000 0.000 0.000
#> SRR330901 1 0.0000 0.748 1.000 0.000 0.000
#> SRR330902 1 0.0000 0.748 1.000 0.000 0.000
#> SRR330903 1 0.4605 0.749 0.796 0.204 0.000
#> SRR330904 2 0.0000 0.962 0.000 1.000 0.000
#> SRR330906 1 0.3752 0.760 0.856 0.144 0.000
#> SRR330907 1 0.6126 -0.433 0.600 0.000 0.400
#> SRR330908 1 0.4555 0.751 0.800 0.200 0.000
#> SRR330909 1 0.0000 0.748 1.000 0.000 0.000
#> SRR330910 1 0.2066 0.765 0.940 0.060 0.000
#> SRR330911 1 0.5810 0.675 0.664 0.336 0.000
#> SRR330912 1 0.5810 0.675 0.664 0.336 0.000
#> SRR330913 1 0.4504 0.752 0.804 0.196 0.000
#> SRR330914 1 0.4504 0.752 0.804 0.196 0.000
#> SRR330915 1 0.0000 0.748 1.000 0.000 0.000
#> SRR330916 1 0.5810 0.675 0.664 0.336 0.000
#> SRR330917 1 0.4504 0.752 0.804 0.196 0.000
#> SRR330918 1 0.2066 0.765 0.940 0.060 0.000
#> SRR330919 1 0.1860 0.763 0.948 0.052 0.000
#> SRR330920 1 0.0000 0.748 1.000 0.000 0.000
#> SRR330921 1 0.0000 0.748 1.000 0.000 0.000
#> SRR330922 1 0.0000 0.748 1.000 0.000 0.000
#> SRR330923 1 0.0237 0.745 0.996 0.000 0.004
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> SRR330857 3 0.0469 0.805 0.012 0.000 0.988 0.000
#> SRR330858 3 0.2081 0.783 0.084 0.000 0.916 0.000
#> SRR330859 3 0.4072 0.526 0.252 0.000 0.748 0.000
#> SRR330860 4 0.3751 0.000 0.000 0.196 0.004 0.800
#> SRR330861 3 0.0336 0.805 0.008 0.000 0.992 0.000
#> SRR330862 1 0.6790 0.594 0.608 0.000 0.196 0.196
#> SRR330863 3 0.4855 0.252 0.400 0.000 0.600 0.000
#> SRR330864 1 0.7523 0.106 0.412 0.000 0.404 0.184
#> SRR330865 3 0.0336 0.805 0.008 0.000 0.992 0.000
#> SRR330866 1 0.4830 0.689 0.608 0.000 0.000 0.392
#> SRR330867 3 0.1867 0.790 0.072 0.000 0.928 0.000
#> SRR330868 3 0.7421 0.129 0.332 0.000 0.484 0.184
#> SRR330869 1 0.3610 0.795 0.800 0.000 0.000 0.200
#> SRR330870 3 0.2149 0.781 0.088 0.000 0.912 0.000
#> SRR330871 3 0.0336 0.805 0.008 0.000 0.992 0.000
#> SRR330872 3 0.2530 0.731 0.100 0.000 0.896 0.004
#> SRR330873 3 0.1792 0.790 0.068 0.000 0.932 0.000
#> SRR330874 2 0.0000 0.416 0.000 1.000 0.000 0.000
#> SRR330875 3 0.0336 0.805 0.008 0.000 0.992 0.000
#> SRR330876 3 0.0336 0.805 0.008 0.000 0.992 0.000
#> SRR330877 3 0.0336 0.805 0.008 0.000 0.992 0.000
#> SRR330878 3 0.0336 0.805 0.008 0.000 0.992 0.000
#> SRR330879 1 0.2921 0.754 0.860 0.000 0.140 0.000
#> SRR330880 1 0.6546 0.625 0.636 0.000 0.192 0.172
#> SRR330881 3 0.3649 0.657 0.204 0.000 0.796 0.000
#> SRR330882 1 0.2469 0.810 0.892 0.000 0.000 0.108
#> SRR330883 2 0.4804 0.576 0.000 0.616 0.000 0.384
#> SRR330884 1 0.2530 0.809 0.888 0.000 0.000 0.112
#> SRR330885 1 0.4804 0.696 0.616 0.000 0.000 0.384
#> SRR330886 1 0.0188 0.798 0.996 0.000 0.004 0.000
#> SRR330887 1 0.0000 0.798 1.000 0.000 0.000 0.000
#> SRR330888 1 0.0000 0.798 1.000 0.000 0.000 0.000
#> SRR330889 1 0.4817 0.692 0.612 0.000 0.000 0.388
#> SRR330890 1 0.4761 0.704 0.628 0.000 0.000 0.372
#> SRR330891 1 0.4830 0.689 0.608 0.000 0.000 0.392
#> SRR330892 2 0.0000 0.416 0.000 1.000 0.000 0.000
#> SRR330893 1 0.4830 0.689 0.608 0.000 0.000 0.392
#> SRR330894 1 0.4830 0.689 0.608 0.000 0.000 0.392
#> SRR330895 2 0.4830 0.573 0.000 0.608 0.000 0.392
#> SRR330896 1 0.1637 0.808 0.940 0.000 0.000 0.060
#> SRR330897 2 0.4730 0.572 0.000 0.636 0.000 0.364
#> SRR330898 2 0.0524 0.413 0.000 0.988 0.008 0.004
#> SRR330899 1 0.0000 0.798 1.000 0.000 0.000 0.000
#> SRR330900 1 0.0000 0.798 1.000 0.000 0.000 0.000
#> SRR330901 1 0.0000 0.798 1.000 0.000 0.000 0.000
#> SRR330902 1 0.0000 0.798 1.000 0.000 0.000 0.000
#> SRR330903 1 0.3726 0.791 0.788 0.000 0.000 0.212
#> SRR330904 2 0.4830 0.573 0.000 0.608 0.000 0.392
#> SRR330906 1 0.3123 0.802 0.844 0.000 0.000 0.156
#> SRR330907 3 0.4564 0.496 0.328 0.000 0.672 0.000
#> SRR330908 1 0.3688 0.792 0.792 0.000 0.000 0.208
#> SRR330909 1 0.0000 0.798 1.000 0.000 0.000 0.000
#> SRR330910 1 0.1637 0.808 0.940 0.000 0.000 0.060
#> SRR330911 1 0.4830 0.689 0.608 0.000 0.000 0.392
#> SRR330912 1 0.4830 0.689 0.608 0.000 0.000 0.392
#> SRR330913 1 0.3688 0.792 0.792 0.000 0.000 0.208
#> SRR330914 1 0.3649 0.793 0.796 0.000 0.000 0.204
#> SRR330915 1 0.0000 0.798 1.000 0.000 0.000 0.000
#> SRR330916 1 0.4830 0.689 0.608 0.000 0.000 0.392
#> SRR330917 1 0.3610 0.794 0.800 0.000 0.000 0.200
#> SRR330918 1 0.1637 0.808 0.940 0.000 0.000 0.060
#> SRR330919 1 0.1474 0.807 0.948 0.000 0.000 0.052
#> SRR330920 1 0.0000 0.798 1.000 0.000 0.000 0.000
#> SRR330921 1 0.0000 0.798 1.000 0.000 0.000 0.000
#> SRR330922 1 0.0000 0.798 1.000 0.000 0.000 0.000
#> SRR330923 1 0.0188 0.795 0.996 0.000 0.004 0.000
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> SRR330857 1 0.0290 0.7973 0.992 0.000 0.000 0.008 0.000
#> SRR330858 1 0.1671 0.7772 0.924 0.000 0.000 0.076 0.000
#> SRR330859 1 0.3508 0.5332 0.748 0.000 0.000 0.252 0.000
#> SRR330860 3 0.0162 0.0000 0.000 0.000 0.996 0.000 0.004
#> SRR330861 1 0.0290 0.7973 0.992 0.000 0.000 0.008 0.000
#> SRR330862 4 0.6797 0.4696 0.188 0.284 0.020 0.508 0.000
#> SRR330863 1 0.4182 0.2207 0.600 0.000 0.000 0.400 0.000
#> SRR330864 4 0.7188 0.2347 0.324 0.252 0.020 0.404 0.000
#> SRR330865 1 0.0290 0.7973 0.992 0.000 0.000 0.008 0.000
#> SRR330866 4 0.4306 0.5629 0.000 0.492 0.000 0.508 0.000
#> SRR330867 1 0.1544 0.7816 0.932 0.000 0.000 0.068 0.000
#> SRR330868 1 0.7229 -0.0814 0.384 0.264 0.020 0.332 0.000
#> SRR330869 4 0.3242 0.7582 0.000 0.216 0.000 0.784 0.000
#> SRR330870 1 0.1732 0.7744 0.920 0.000 0.000 0.080 0.000
#> SRR330871 1 0.0290 0.7973 0.992 0.000 0.000 0.008 0.000
#> SRR330872 1 0.3209 0.7018 0.860 0.020 0.020 0.100 0.000
#> SRR330873 1 0.1478 0.7822 0.936 0.000 0.000 0.064 0.000
#> SRR330874 2 0.5227 -0.0934 0.000 0.508 0.044 0.000 0.448
#> SRR330875 1 0.0290 0.7973 0.992 0.000 0.000 0.008 0.000
#> SRR330876 1 0.0290 0.7973 0.992 0.000 0.000 0.008 0.000
#> SRR330877 1 0.0290 0.7973 0.992 0.000 0.000 0.008 0.000
#> SRR330878 1 0.0290 0.7973 0.992 0.000 0.000 0.008 0.000
#> SRR330879 4 0.2424 0.7370 0.132 0.000 0.000 0.868 0.000
#> SRR330880 4 0.6163 0.6052 0.180 0.180 0.020 0.620 0.000
#> SRR330881 1 0.3143 0.6409 0.796 0.000 0.000 0.204 0.000
#> SRR330882 4 0.2074 0.7808 0.000 0.104 0.000 0.896 0.000
#> SRR330883 2 0.2359 0.6615 0.000 0.904 0.036 0.000 0.060
#> SRR330884 4 0.2127 0.7803 0.000 0.108 0.000 0.892 0.000
#> SRR330885 4 0.4161 0.6557 0.000 0.392 0.000 0.608 0.000
#> SRR330886 4 0.0162 0.7751 0.004 0.000 0.000 0.996 0.000
#> SRR330887 4 0.0000 0.7752 0.000 0.000 0.000 1.000 0.000
#> SRR330888 4 0.0000 0.7752 0.000 0.000 0.000 1.000 0.000
#> SRR330889 4 0.4300 0.5768 0.000 0.476 0.000 0.524 0.000
#> SRR330890 4 0.4249 0.6207 0.000 0.432 0.000 0.568 0.000
#> SRR330891 4 0.4306 0.5629 0.000 0.492 0.000 0.508 0.000
#> SRR330892 2 0.5364 -0.1054 0.008 0.496 0.036 0.000 0.460
#> SRR330893 4 0.4306 0.5629 0.000 0.492 0.000 0.508 0.000
#> SRR330894 4 0.4306 0.5629 0.000 0.492 0.000 0.508 0.000
#> SRR330895 2 0.2221 0.6600 0.000 0.912 0.036 0.000 0.052
#> SRR330896 4 0.1341 0.7812 0.000 0.056 0.000 0.944 0.000
#> SRR330897 2 0.2491 0.6569 0.000 0.896 0.036 0.000 0.068
#> SRR330898 5 0.1251 0.0000 0.000 0.008 0.036 0.000 0.956
#> SRR330899 4 0.0000 0.7752 0.000 0.000 0.000 1.000 0.000
#> SRR330900 4 0.0000 0.7752 0.000 0.000 0.000 1.000 0.000
#> SRR330901 4 0.0000 0.7752 0.000 0.000 0.000 1.000 0.000
#> SRR330902 4 0.0000 0.7752 0.000 0.000 0.000 1.000 0.000
#> SRR330903 4 0.3452 0.7472 0.000 0.244 0.000 0.756 0.000
#> SRR330904 2 0.0290 0.5897 0.000 0.992 0.000 0.000 0.008
#> SRR330906 4 0.3074 0.7609 0.000 0.196 0.000 0.804 0.000
#> SRR330907 1 0.3932 0.4750 0.672 0.000 0.000 0.328 0.000
#> SRR330908 4 0.3424 0.7488 0.000 0.240 0.000 0.760 0.000
#> SRR330909 4 0.0000 0.7752 0.000 0.000 0.000 1.000 0.000
#> SRR330910 4 0.1341 0.7812 0.000 0.056 0.000 0.944 0.000
#> SRR330911 4 0.4306 0.5629 0.000 0.492 0.000 0.508 0.000
#> SRR330912 4 0.4306 0.5629 0.000 0.492 0.000 0.508 0.000
#> SRR330913 4 0.3210 0.7596 0.000 0.212 0.000 0.788 0.000
#> SRR330914 4 0.3305 0.7552 0.000 0.224 0.000 0.776 0.000
#> SRR330915 4 0.0000 0.7752 0.000 0.000 0.000 1.000 0.000
#> SRR330916 4 0.4306 0.5629 0.000 0.492 0.000 0.508 0.000
#> SRR330917 4 0.3143 0.7614 0.000 0.204 0.000 0.796 0.000
#> SRR330918 4 0.1341 0.7812 0.000 0.056 0.000 0.944 0.000
#> SRR330919 4 0.1197 0.7808 0.000 0.048 0.000 0.952 0.000
#> SRR330920 4 0.0000 0.7752 0.000 0.000 0.000 1.000 0.000
#> SRR330921 4 0.0000 0.7752 0.000 0.000 0.000 1.000 0.000
#> SRR330922 4 0.0000 0.7752 0.000 0.000 0.000 1.000 0.000
#> SRR330923 4 0.0162 0.7728 0.004 0.000 0.000 0.996 0.000
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> SRR330857 1 0.0146 0.8435 0.996 0.000 0.000 0.004 0.000 0.000
#> SRR330858 1 0.1444 0.8228 0.928 0.000 0.000 0.072 0.000 0.000
#> SRR330859 1 0.3151 0.5375 0.748 0.000 0.000 0.252 0.000 0.000
#> SRR330860 6 0.0000 0.0000 0.000 0.000 0.000 0.000 0.000 1.000
#> SRR330861 1 0.0146 0.8435 0.996 0.000 0.000 0.004 0.000 0.000
#> SRR330862 3 0.6309 0.5708 0.184 0.008 0.472 0.324 0.004 0.008
#> SRR330863 1 0.3756 0.2248 0.600 0.000 0.000 0.400 0.000 0.000
#> SRR330864 3 0.6516 0.5324 0.264 0.008 0.440 0.276 0.004 0.008
#> SRR330865 1 0.0146 0.8435 0.996 0.000 0.000 0.004 0.000 0.000
#> SRR330866 3 0.3515 0.6724 0.000 0.000 0.676 0.324 0.000 0.000
#> SRR330867 1 0.1327 0.8274 0.936 0.000 0.000 0.064 0.000 0.000
#> SRR330868 3 0.6482 0.5246 0.268 0.008 0.452 0.260 0.004 0.008
#> SRR330869 4 0.2883 0.7319 0.000 0.000 0.212 0.788 0.000 0.000
#> SRR330870 1 0.1501 0.8199 0.924 0.000 0.000 0.076 0.000 0.000
#> SRR330871 1 0.0146 0.8435 0.996 0.000 0.000 0.004 0.000 0.000
#> SRR330872 1 0.3137 0.7275 0.856 0.008 0.032 0.092 0.004 0.008
#> SRR330873 1 0.1267 0.8281 0.940 0.000 0.000 0.060 0.000 0.000
#> SRR330874 2 0.3175 0.5996 0.000 0.744 0.256 0.000 0.000 0.000
#> SRR330875 1 0.0146 0.8435 0.996 0.000 0.000 0.004 0.000 0.000
#> SRR330876 1 0.0146 0.8435 0.996 0.000 0.000 0.004 0.000 0.000
#> SRR330877 1 0.0146 0.8435 0.996 0.000 0.000 0.004 0.000 0.000
#> SRR330878 1 0.0146 0.8435 0.996 0.000 0.000 0.004 0.000 0.000
#> SRR330879 4 0.2178 0.7551 0.132 0.000 0.000 0.868 0.000 0.000
#> SRR330880 4 0.5681 0.2797 0.180 0.008 0.184 0.616 0.004 0.008
#> SRR330881 1 0.2762 0.6845 0.804 0.000 0.000 0.196 0.000 0.000
#> SRR330882 4 0.1863 0.8248 0.000 0.000 0.104 0.896 0.000 0.000
#> SRR330883 3 0.4390 -0.0675 0.004 0.064 0.700 0.000 0.232 0.000
#> SRR330884 4 0.1910 0.8221 0.000 0.000 0.108 0.892 0.000 0.000
#> SRR330885 4 0.3747 0.2679 0.000 0.000 0.396 0.604 0.000 0.000
#> SRR330886 4 0.0146 0.8544 0.004 0.000 0.000 0.996 0.000 0.000
#> SRR330887 4 0.0000 0.8554 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR330888 4 0.0000 0.8554 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR330889 3 0.3578 0.6531 0.000 0.000 0.660 0.340 0.000 0.000
#> SRR330890 3 0.3854 0.3206 0.000 0.000 0.536 0.464 0.000 0.000
#> SRR330891 3 0.3515 0.6724 0.000 0.000 0.676 0.324 0.000 0.000
#> SRR330892 2 0.0260 0.5954 0.000 0.992 0.000 0.000 0.008 0.000
#> SRR330893 3 0.3515 0.6724 0.000 0.000 0.676 0.324 0.000 0.000
#> SRR330894 3 0.3515 0.6724 0.000 0.000 0.676 0.324 0.000 0.000
#> SRR330895 3 0.4117 0.0210 0.000 0.064 0.740 0.004 0.192 0.000
#> SRR330896 4 0.1204 0.8466 0.000 0.000 0.056 0.944 0.000 0.000
#> SRR330897 3 0.3288 -0.1919 0.000 0.000 0.724 0.000 0.276 0.000
#> SRR330898 5 0.1007 0.0000 0.000 0.044 0.000 0.000 0.956 0.000
#> SRR330899 4 0.0000 0.8554 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR330900 4 0.0000 0.8554 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR330901 4 0.0000 0.8554 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR330902 4 0.0000 0.8554 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR330903 4 0.3076 0.6930 0.000 0.000 0.240 0.760 0.000 0.000
#> SRR330904 3 0.1471 0.2938 0.000 0.064 0.932 0.004 0.000 0.000
#> SRR330906 4 0.3050 0.6587 0.000 0.000 0.236 0.764 0.000 0.000
#> SRR330907 1 0.3515 0.4999 0.676 0.000 0.000 0.324 0.000 0.000
#> SRR330908 4 0.3050 0.6993 0.000 0.000 0.236 0.764 0.000 0.000
#> SRR330909 4 0.0000 0.8554 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR330910 4 0.1204 0.8466 0.000 0.000 0.056 0.944 0.000 0.000
#> SRR330911 3 0.3515 0.6724 0.000 0.000 0.676 0.324 0.000 0.000
#> SRR330912 3 0.3515 0.6724 0.000 0.000 0.676 0.324 0.000 0.000
#> SRR330913 4 0.2883 0.7316 0.000 0.000 0.212 0.788 0.000 0.000
#> SRR330914 4 0.2941 0.7215 0.000 0.000 0.220 0.780 0.000 0.000
#> SRR330915 4 0.0000 0.8554 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR330916 3 0.3515 0.6724 0.000 0.000 0.676 0.324 0.000 0.000
#> SRR330917 4 0.2823 0.7397 0.000 0.000 0.204 0.796 0.000 0.000
#> SRR330918 4 0.1204 0.8466 0.000 0.000 0.056 0.944 0.000 0.000
#> SRR330919 4 0.1075 0.8487 0.000 0.000 0.048 0.952 0.000 0.000
#> SRR330920 4 0.0000 0.8554 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR330921 4 0.0000 0.8554 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR330922 4 0.0000 0.8554 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR330923 4 0.0146 0.8517 0.004 0.000 0.000 0.996 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)
consensus_heatmap(res, k = 3)
consensus_heatmap(res, k = 4)
consensus_heatmap(res, k = 5)
consensus_heatmap(res, k = 6)
Heatmaps for the membership of samples in all partitions to see how consistent they are:
membership_heatmap(res, k = 2)
membership_heatmap(res, k = 3)
membership_heatmap(res, k = 4)
membership_heatmap(res, k = 5)
membership_heatmap(res, k = 6)
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)
get_signatures(res, k = 3)
get_signatures(res, k = 4)
get_signatures(res, k = 5)
get_signatures(res, k = 6)
Signature heatmaps where rows are not scaled:
get_signatures(res, k = 2, scale_rows = FALSE)
get_signatures(res, k = 3, scale_rows = FALSE)
get_signatures(res, k = 4, scale_rows = FALSE)
get_signatures(res, k = 5, scale_rows = FALSE)
get_signatures(res, k = 6, scale_rows = FALSE)
Compare the overlap of signatures from different k:
compare_signatures(res)
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:
which_row
: row indices corresponding to the input matrix.fdr
: FDR for the differential test. mean_x
: The mean value in group x.scaled_mean_x
: The mean value in group x after rows are scaled.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")
dimension_reduction(res, k = 3, method = "UMAP")
dimension_reduction(res, k = 4, method = "UMAP")
dimension_reduction(res, k = 5, method = "UMAP")
dimension_reduction(res, k = 6, method = "UMAP")
Following heatmap shows how subgroups are split when increasing k
:
collect_classes(res)
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.
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 10869 rows and 66 columns.
#> Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'SD' method.
#> Subgroups are detected by 'mclust' method.
#> Performed in total 1250 partitions by row resampling.
#> Best k for subgroups seems to be 3.
#>
#> Following methods can be applied to this 'ConsensusPartition' object:
#> [1] "cola_report" "collect_classes" "collect_plots"
#> [4] "collect_stats" "colnames" "compare_signatures"
#> [7] "consensus_heatmap" "dimension_reduction" "functional_enrichment"
#> [10] "get_anno_col" "get_anno" "get_classes"
#> [13] "get_consensus" "get_matrix" "get_membership"
#> [16] "get_param" "get_signatures" "get_stats"
#> [19] "is_best_k" "is_stable_k" "membership_heatmap"
#> [22] "ncol" "nrow" "plot_ecdf"
#> [25] "rownames" "select_partition_number" "show"
#> [28] "suggest_best_k" "test_to_known_factors"
collect_plots()
function collects all the plots made from res
for all k
(number of partitions)
into one single page to provide an easy and fast comparison between different k
.
collect_plots(res)
The plots are:
k
and the heatmap of
predicted classes for each k
.k
.k
.k
.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:
k
;k
, the area increased is defined as \(A_k - A_{k-1}\).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)
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.533 0.870 0.921 0.2887 0.761 0.761
#> 3 3 0.944 0.920 0.966 1.0147 0.663 0.558
#> 4 4 0.765 0.812 0.889 0.2373 0.772 0.498
#> 5 5 0.688 0.760 0.854 0.0510 0.904 0.667
#> 6 6 0.686 0.665 0.793 0.0493 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] 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.
cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#> class entropy silhouette p1 p2
#> SRR330857 1 0.7299 0.835 0.796 0.204
#> SRR330858 1 0.7299 0.835 0.796 0.204
#> SRR330859 1 0.7299 0.835 0.796 0.204
#> SRR330860 2 0.0000 0.938 0.000 1.000
#> SRR330861 1 0.7299 0.835 0.796 0.204
#> SRR330862 1 0.7453 0.828 0.788 0.212
#> SRR330863 1 0.7299 0.835 0.796 0.204
#> SRR330864 1 0.7453 0.828 0.788 0.212
#> SRR330865 1 0.7299 0.835 0.796 0.204
#> SRR330866 1 0.0000 0.902 1.000 0.000
#> SRR330867 1 0.7299 0.835 0.796 0.204
#> SRR330868 1 0.8555 0.745 0.720 0.280
#> SRR330869 1 0.0000 0.902 1.000 0.000
#> SRR330870 1 0.7299 0.835 0.796 0.204
#> SRR330871 1 0.7299 0.835 0.796 0.204
#> SRR330872 1 0.7453 0.828 0.788 0.212
#> SRR330873 1 0.7299 0.835 0.796 0.204
#> SRR330874 2 0.0000 0.938 0.000 1.000
#> SRR330875 1 0.7299 0.835 0.796 0.204
#> SRR330876 1 0.7299 0.835 0.796 0.204
#> SRR330877 1 0.7299 0.835 0.796 0.204
#> SRR330878 1 0.7299 0.835 0.796 0.204
#> SRR330879 1 0.7299 0.835 0.796 0.204
#> SRR330880 1 0.7299 0.835 0.796 0.204
#> SRR330881 1 0.4815 0.874 0.896 0.104
#> SRR330882 2 0.0000 0.938 0.000 1.000
#> SRR330883 2 0.0000 0.938 0.000 1.000
#> SRR330884 1 0.0000 0.902 1.000 0.000
#> SRR330885 1 0.5178 0.870 0.884 0.116
#> SRR330886 1 0.4431 0.878 0.908 0.092
#> SRR330887 1 0.0000 0.902 1.000 0.000
#> SRR330888 1 0.0000 0.902 1.000 0.000
#> SRR330889 1 0.7299 0.835 0.796 0.204
#> SRR330890 1 0.0000 0.902 1.000 0.000
#> SRR330891 1 0.0000 0.902 1.000 0.000
#> SRR330892 2 0.0000 0.938 0.000 1.000
#> SRR330893 1 0.0000 0.902 1.000 0.000
#> SRR330894 1 0.0000 0.902 1.000 0.000
#> SRR330895 2 0.0000 0.938 0.000 1.000
#> SRR330896 1 0.0000 0.902 1.000 0.000
#> SRR330897 2 0.0000 0.938 0.000 1.000
#> SRR330898 2 0.0000 0.938 0.000 1.000
#> SRR330899 1 0.0000 0.902 1.000 0.000
#> SRR330900 1 0.0000 0.902 1.000 0.000
#> SRR330901 1 0.0000 0.902 1.000 0.000
#> SRR330902 1 0.0000 0.902 1.000 0.000
#> SRR330903 1 0.0000 0.902 1.000 0.000
#> SRR330904 1 0.0938 0.897 0.988 0.012
#> SRR330906 1 0.0376 0.901 0.996 0.004
#> SRR330907 1 0.0000 0.902 1.000 0.000
#> SRR330908 1 0.0000 0.902 1.000 0.000
#> SRR330909 1 0.0000 0.902 1.000 0.000
#> SRR330910 1 0.0000 0.902 1.000 0.000
#> SRR330911 1 0.0000 0.902 1.000 0.000
#> SRR330912 1 0.0000 0.902 1.000 0.000
#> SRR330913 1 0.0000 0.902 1.000 0.000
#> SRR330914 1 0.0000 0.902 1.000 0.000
#> SRR330915 1 0.0000 0.902 1.000 0.000
#> SRR330916 1 0.0000 0.902 1.000 0.000
#> SRR330917 1 0.0000 0.902 1.000 0.000
#> SRR330918 2 1.0000 0.113 0.496 0.504
#> SRR330919 1 0.0000 0.902 1.000 0.000
#> SRR330920 1 0.0000 0.902 1.000 0.000
#> SRR330921 1 0.0000 0.902 1.000 0.000
#> SRR330922 1 0.0000 0.902 1.000 0.000
#> SRR330923 1 0.0000 0.902 1.000 0.000
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> SRR330857 3 0.0237 0.999 0.004 0.000 0.996
#> SRR330858 3 0.0237 0.999 0.004 0.000 0.996
#> SRR330859 3 0.0237 0.999 0.004 0.000 0.996
#> SRR330860 2 0.0237 0.924 0.000 0.996 0.004
#> SRR330861 3 0.0237 0.999 0.004 0.000 0.996
#> SRR330862 3 0.0237 0.999 0.004 0.000 0.996
#> SRR330863 3 0.0237 0.999 0.004 0.000 0.996
#> SRR330864 3 0.0237 0.999 0.004 0.000 0.996
#> SRR330865 3 0.0237 0.999 0.004 0.000 0.996
#> SRR330866 1 0.0000 0.949 1.000 0.000 0.000
#> SRR330867 3 0.0237 0.999 0.004 0.000 0.996
#> SRR330868 3 0.0237 0.999 0.004 0.000 0.996
#> SRR330869 1 0.0000 0.949 1.000 0.000 0.000
#> SRR330870 3 0.0237 0.999 0.004 0.000 0.996
#> SRR330871 3 0.0237 0.999 0.004 0.000 0.996
#> SRR330872 3 0.0661 0.991 0.004 0.008 0.988
#> SRR330873 3 0.0237 0.999 0.004 0.000 0.996
#> SRR330874 2 0.2625 0.857 0.000 0.916 0.084
#> SRR330875 3 0.0475 0.996 0.004 0.004 0.992
#> SRR330876 3 0.0237 0.999 0.004 0.000 0.996
#> SRR330877 3 0.0237 0.999 0.004 0.000 0.996
#> SRR330878 3 0.0237 0.999 0.004 0.000 0.996
#> SRR330879 1 0.5988 0.467 0.632 0.000 0.368
#> SRR330880 3 0.0237 0.999 0.004 0.000 0.996
#> SRR330881 1 0.6095 0.412 0.608 0.000 0.392
#> SRR330882 2 0.0237 0.923 0.004 0.996 0.000
#> SRR330883 2 0.0000 0.926 0.000 1.000 0.000
#> SRR330884 1 0.0000 0.949 1.000 0.000 0.000
#> SRR330885 1 0.0000 0.949 1.000 0.000 0.000
#> SRR330886 1 0.4291 0.761 0.820 0.000 0.180
#> SRR330887 1 0.0000 0.949 1.000 0.000 0.000
#> SRR330888 1 0.0000 0.949 1.000 0.000 0.000
#> SRR330889 1 0.5905 0.501 0.648 0.000 0.352
#> SRR330890 1 0.0000 0.949 1.000 0.000 0.000
#> SRR330891 1 0.0237 0.946 0.996 0.004 0.000
#> SRR330892 2 0.0000 0.926 0.000 1.000 0.000
#> SRR330893 1 0.0000 0.949 1.000 0.000 0.000
#> SRR330894 1 0.0000 0.949 1.000 0.000 0.000
#> SRR330895 2 0.0000 0.926 0.000 1.000 0.000
#> SRR330896 1 0.0000 0.949 1.000 0.000 0.000
#> SRR330897 2 0.0000 0.926 0.000 1.000 0.000
#> SRR330898 2 0.0000 0.926 0.000 1.000 0.000
#> SRR330899 1 0.0000 0.949 1.000 0.000 0.000
#> SRR330900 1 0.0000 0.949 1.000 0.000 0.000
#> SRR330901 1 0.0000 0.949 1.000 0.000 0.000
#> SRR330902 1 0.0000 0.949 1.000 0.000 0.000
#> SRR330903 1 0.0000 0.949 1.000 0.000 0.000
#> SRR330904 1 0.2878 0.854 0.904 0.096 0.000
#> SRR330906 1 0.0237 0.946 0.996 0.004 0.000
#> SRR330907 1 0.4452 0.747 0.808 0.000 0.192
#> SRR330908 1 0.0000 0.949 1.000 0.000 0.000
#> SRR330909 1 0.0000 0.949 1.000 0.000 0.000
#> SRR330910 1 0.0000 0.949 1.000 0.000 0.000
#> SRR330911 1 0.0000 0.949 1.000 0.000 0.000
#> SRR330912 1 0.0237 0.946 0.996 0.004 0.000
#> SRR330913 1 0.0237 0.946 0.996 0.004 0.000
#> SRR330914 1 0.0237 0.946 0.996 0.004 0.000
#> SRR330915 1 0.0000 0.949 1.000 0.000 0.000
#> SRR330916 1 0.0000 0.949 1.000 0.000 0.000
#> SRR330917 1 0.0237 0.946 0.996 0.004 0.000
#> SRR330918 2 0.6154 0.320 0.408 0.592 0.000
#> SRR330919 1 0.0000 0.949 1.000 0.000 0.000
#> SRR330920 1 0.0000 0.949 1.000 0.000 0.000
#> SRR330921 1 0.0000 0.949 1.000 0.000 0.000
#> SRR330922 1 0.0000 0.949 1.000 0.000 0.000
#> SRR330923 1 0.0000 0.949 1.000 0.000 0.000
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> SRR330857 3 0.0000 0.943 0.000 0.000 1.000 0.000
#> SRR330858 3 0.0000 0.943 0.000 0.000 1.000 0.000
#> SRR330859 3 0.0000 0.943 0.000 0.000 1.000 0.000
#> SRR330860 2 0.0469 0.908 0.012 0.988 0.000 0.000
#> SRR330861 3 0.0000 0.943 0.000 0.000 1.000 0.000
#> SRR330862 3 0.1488 0.926 0.032 0.012 0.956 0.000
#> SRR330863 3 0.0000 0.943 0.000 0.000 1.000 0.000
#> SRR330864 3 0.1488 0.926 0.032 0.012 0.956 0.000
#> SRR330865 3 0.0000 0.943 0.000 0.000 1.000 0.000
#> SRR330866 4 0.0592 0.785 0.016 0.000 0.000 0.984
#> SRR330867 3 0.0000 0.943 0.000 0.000 1.000 0.000
#> SRR330868 3 0.1488 0.926 0.032 0.012 0.956 0.000
#> SRR330869 4 0.4661 0.627 0.348 0.000 0.000 0.652
#> SRR330870 3 0.0000 0.943 0.000 0.000 1.000 0.000
#> SRR330871 3 0.0000 0.943 0.000 0.000 1.000 0.000
#> SRR330872 3 0.1610 0.923 0.032 0.016 0.952 0.000
#> SRR330873 3 0.0000 0.943 0.000 0.000 1.000 0.000
#> SRR330874 2 0.1545 0.893 0.040 0.952 0.008 0.000
#> SRR330875 3 0.0000 0.943 0.000 0.000 1.000 0.000
#> SRR330876 3 0.0000 0.943 0.000 0.000 1.000 0.000
#> SRR330877 3 0.0188 0.942 0.004 0.000 0.996 0.000
#> SRR330878 3 0.0000 0.943 0.000 0.000 1.000 0.000
#> SRR330879 3 0.5614 0.224 0.412 0.012 0.568 0.008
#> SRR330880 3 0.0469 0.938 0.000 0.012 0.988 0.000
#> SRR330881 3 0.3981 0.798 0.100 0.012 0.848 0.040
#> SRR330882 2 0.0188 0.909 0.004 0.996 0.000 0.000
#> SRR330883 2 0.0000 0.910 0.000 1.000 0.000 0.000
#> SRR330884 4 0.3688 0.784 0.208 0.000 0.000 0.792
#> SRR330885 4 0.4755 0.748 0.260 0.004 0.012 0.724
#> SRR330886 1 0.6894 0.342 0.536 0.000 0.120 0.344
#> SRR330887 1 0.1302 0.858 0.956 0.000 0.000 0.044
#> SRR330888 1 0.1302 0.858 0.956 0.000 0.000 0.044
#> SRR330889 1 0.8140 0.238 0.424 0.012 0.308 0.256
#> SRR330890 4 0.4277 0.745 0.280 0.000 0.000 0.720
#> SRR330891 4 0.2704 0.802 0.124 0.000 0.000 0.876
#> SRR330892 2 0.0336 0.909 0.008 0.992 0.000 0.000
#> SRR330893 4 0.0469 0.785 0.012 0.000 0.000 0.988
#> SRR330894 4 0.0336 0.782 0.008 0.000 0.000 0.992
#> SRR330895 2 0.0188 0.909 0.000 0.996 0.000 0.004
#> SRR330896 4 0.4522 0.684 0.320 0.000 0.000 0.680
#> SRR330897 2 0.0000 0.910 0.000 1.000 0.000 0.000
#> SRR330898 2 0.0000 0.910 0.000 1.000 0.000 0.000
#> SRR330899 1 0.3400 0.799 0.820 0.000 0.000 0.180
#> SRR330900 1 0.3266 0.813 0.832 0.000 0.000 0.168
#> SRR330901 1 0.1302 0.858 0.956 0.000 0.000 0.044
#> SRR330902 1 0.3266 0.813 0.832 0.000 0.000 0.168
#> SRR330903 4 0.1867 0.798 0.072 0.000 0.000 0.928
#> SRR330904 2 0.5323 0.572 0.020 0.628 0.000 0.352
#> SRR330906 4 0.4277 0.745 0.280 0.000 0.000 0.720
#> SRR330907 3 0.5227 0.533 0.256 0.000 0.704 0.040
#> SRR330908 4 0.0707 0.788 0.020 0.000 0.000 0.980
#> SRR330909 1 0.3024 0.829 0.852 0.000 0.000 0.148
#> SRR330910 4 0.3024 0.800 0.148 0.000 0.000 0.852
#> SRR330911 4 0.0469 0.783 0.012 0.000 0.000 0.988
#> SRR330912 4 0.0592 0.789 0.016 0.000 0.000 0.984
#> SRR330913 4 0.4222 0.751 0.272 0.000 0.000 0.728
#> SRR330914 4 0.4222 0.751 0.272 0.000 0.000 0.728
#> SRR330915 1 0.1302 0.858 0.956 0.000 0.000 0.044
#> SRR330916 4 0.0336 0.783 0.008 0.000 0.000 0.992
#> SRR330917 4 0.4222 0.751 0.272 0.000 0.000 0.728
#> SRR330918 2 0.6426 0.366 0.256 0.628 0.000 0.116
#> SRR330919 1 0.2589 0.845 0.884 0.000 0.000 0.116
#> SRR330920 1 0.1389 0.856 0.952 0.000 0.000 0.048
#> SRR330921 1 0.1302 0.858 0.956 0.000 0.000 0.044
#> SRR330922 1 0.2704 0.842 0.876 0.000 0.000 0.124
#> SRR330923 1 0.1302 0.858 0.956 0.000 0.000 0.044
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> SRR330857 1 0.0000 0.877 1.000 0.000 0.000 0.000 0.000
#> SRR330858 1 0.0000 0.877 1.000 0.000 0.000 0.000 0.000
#> SRR330859 1 0.2230 0.839 0.884 0.000 0.116 0.000 0.000
#> SRR330860 2 0.0162 0.856 0.000 0.996 0.004 0.000 0.000
#> SRR330861 1 0.2377 0.832 0.872 0.000 0.128 0.000 0.000
#> SRR330862 3 0.1082 0.863 0.028 0.008 0.964 0.000 0.000
#> SRR330863 1 0.3074 0.753 0.804 0.000 0.196 0.000 0.000
#> SRR330864 3 0.1082 0.863 0.028 0.008 0.964 0.000 0.000
#> SRR330865 1 0.0000 0.877 1.000 0.000 0.000 0.000 0.000
#> SRR330866 4 0.1410 0.768 0.000 0.000 0.000 0.940 0.060
#> SRR330867 1 0.0000 0.877 1.000 0.000 0.000 0.000 0.000
#> SRR330868 3 0.0992 0.860 0.024 0.008 0.968 0.000 0.000
#> SRR330869 4 0.4047 0.731 0.000 0.000 0.004 0.676 0.320
#> SRR330870 1 0.0000 0.877 1.000 0.000 0.000 0.000 0.000
#> SRR330871 1 0.2179 0.842 0.888 0.000 0.112 0.000 0.000
#> SRR330872 3 0.1300 0.858 0.028 0.016 0.956 0.000 0.000
#> SRR330873 1 0.0000 0.877 1.000 0.000 0.000 0.000 0.000
#> SRR330874 2 0.2020 0.790 0.000 0.900 0.100 0.000 0.000
#> SRR330875 1 0.2074 0.846 0.896 0.000 0.104 0.000 0.000
#> SRR330876 1 0.0000 0.877 1.000 0.000 0.000 0.000 0.000
#> SRR330877 1 0.3210 0.739 0.788 0.000 0.212 0.000 0.000
#> SRR330878 1 0.0000 0.877 1.000 0.000 0.000 0.000 0.000
#> SRR330879 1 0.5938 0.088 0.492 0.008 0.068 0.004 0.428
#> SRR330880 3 0.4510 0.119 0.432 0.008 0.560 0.000 0.000
#> SRR330881 5 0.4819 0.429 0.352 0.008 0.012 0.004 0.624
#> SRR330882 2 0.0290 0.855 0.000 0.992 0.008 0.000 0.000
#> SRR330883 2 0.0000 0.856 0.000 1.000 0.000 0.000 0.000
#> SRR330884 4 0.3790 0.761 0.000 0.000 0.004 0.724 0.272
#> SRR330885 4 0.4449 0.717 0.000 0.008 0.004 0.636 0.352
#> SRR330886 4 0.4473 0.635 0.000 0.000 0.008 0.580 0.412
#> SRR330887 5 0.1341 0.868 0.000 0.000 0.000 0.056 0.944
#> SRR330888 5 0.1697 0.867 0.000 0.000 0.008 0.060 0.932
#> SRR330889 4 0.7185 0.498 0.200 0.016 0.020 0.512 0.252
#> SRR330890 4 0.4108 0.735 0.000 0.000 0.008 0.684 0.308
#> SRR330891 4 0.1638 0.775 0.000 0.000 0.004 0.932 0.064
#> SRR330892 2 0.0000 0.856 0.000 1.000 0.000 0.000 0.000
#> SRR330893 4 0.0963 0.765 0.000 0.000 0.000 0.964 0.036
#> SRR330894 4 0.1270 0.764 0.000 0.000 0.000 0.948 0.052
#> SRR330895 2 0.0992 0.847 0.000 0.968 0.000 0.024 0.008
#> SRR330896 4 0.4047 0.727 0.000 0.000 0.004 0.676 0.320
#> SRR330897 2 0.0324 0.855 0.000 0.992 0.000 0.004 0.004
#> SRR330898 2 0.0162 0.856 0.000 0.996 0.000 0.000 0.004
#> SRR330899 5 0.3353 0.737 0.000 0.000 0.008 0.196 0.796
#> SRR330900 5 0.3039 0.709 0.000 0.000 0.000 0.192 0.808
#> SRR330901 5 0.1341 0.868 0.000 0.000 0.000 0.056 0.944
#> SRR330902 5 0.2864 0.756 0.000 0.000 0.012 0.136 0.852
#> SRR330903 4 0.1502 0.773 0.000 0.000 0.004 0.940 0.056
#> SRR330904 2 0.5036 0.379 0.000 0.520 0.004 0.452 0.024
#> SRR330906 4 0.3967 0.752 0.000 0.000 0.012 0.724 0.264
#> SRR330907 5 0.4742 0.478 0.332 0.004 0.012 0.008 0.644
#> SRR330908 4 0.0880 0.764 0.000 0.000 0.000 0.968 0.032
#> SRR330909 5 0.2077 0.857 0.000 0.000 0.008 0.084 0.908
#> SRR330910 4 0.3398 0.776 0.000 0.000 0.004 0.780 0.216
#> SRR330911 4 0.0880 0.764 0.000 0.000 0.000 0.968 0.032
#> SRR330912 4 0.0955 0.763 0.000 0.000 0.004 0.968 0.028
#> SRR330913 4 0.3910 0.751 0.000 0.000 0.008 0.720 0.272
#> SRR330914 4 0.3885 0.757 0.000 0.000 0.008 0.724 0.268
#> SRR330915 5 0.1697 0.867 0.000 0.000 0.008 0.060 0.932
#> SRR330916 4 0.0963 0.765 0.000 0.000 0.000 0.964 0.036
#> SRR330917 4 0.3967 0.752 0.000 0.000 0.012 0.724 0.264
#> SRR330918 2 0.6061 0.298 0.000 0.600 0.020 0.104 0.276
#> SRR330919 5 0.2077 0.861 0.000 0.000 0.008 0.084 0.908
#> SRR330920 5 0.1628 0.866 0.000 0.000 0.008 0.056 0.936
#> SRR330921 5 0.1697 0.867 0.000 0.000 0.008 0.060 0.932
#> SRR330922 5 0.1768 0.865 0.000 0.000 0.004 0.072 0.924
#> SRR330923 5 0.3012 0.834 0.060 0.000 0.008 0.056 0.876
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> SRR330857 1 0.0436 0.8177 0.988 0.000 0.004 0.000 0.004 NA
#> SRR330858 1 0.0547 0.8155 0.980 0.000 0.000 0.000 0.000 NA
#> SRR330859 1 0.3928 0.7595 0.760 0.000 0.080 0.000 0.000 NA
#> SRR330860 2 0.2300 0.7797 0.000 0.856 0.000 0.000 0.000 NA
#> SRR330861 1 0.4061 0.7535 0.748 0.000 0.088 0.000 0.000 NA
#> SRR330862 3 0.0508 0.8061 0.012 0.000 0.984 0.000 0.000 NA
#> SRR330863 1 0.4074 0.7517 0.748 0.000 0.092 0.000 0.000 NA
#> SRR330864 3 0.0508 0.8061 0.012 0.000 0.984 0.000 0.000 NA
#> SRR330865 1 0.2462 0.8076 0.876 0.000 0.028 0.000 0.000 NA
#> SRR330866 4 0.3774 0.6150 0.000 0.000 0.000 0.664 0.008 NA
#> SRR330867 1 0.0717 0.8173 0.976 0.000 0.008 0.000 0.000 NA
#> SRR330868 3 0.0363 0.8045 0.012 0.000 0.988 0.000 0.000 NA
#> SRR330869 4 0.3394 0.6408 0.000 0.000 0.000 0.752 0.236 NA
#> SRR330870 1 0.0692 0.8139 0.976 0.000 0.000 0.000 0.004 NA
#> SRR330871 1 0.4026 0.7564 0.752 0.000 0.088 0.000 0.000 NA
#> SRR330872 3 0.3194 0.7581 0.044 0.012 0.840 0.000 0.000 NA
#> SRR330873 1 0.0692 0.8139 0.976 0.000 0.000 0.000 0.004 NA
#> SRR330874 2 0.2750 0.7721 0.000 0.844 0.020 0.000 0.000 NA
#> SRR330875 1 0.2451 0.8094 0.876 0.000 0.008 0.004 0.004 NA
#> SRR330876 1 0.0436 0.8177 0.988 0.000 0.004 0.000 0.004 NA
#> SRR330877 1 0.4703 0.6846 0.684 0.000 0.152 0.000 0.000 NA
#> SRR330878 1 0.0260 0.8195 0.992 0.000 0.008 0.000 0.000 NA
#> SRR330879 1 0.7982 0.1977 0.404 0.000 0.072 0.104 0.268 NA
#> SRR330880 3 0.5598 -0.0445 0.396 0.000 0.460 0.000 0.000 NA
#> SRR330881 5 0.7075 0.1957 0.344 0.000 0.000 0.100 0.384 NA
#> SRR330882 2 0.0993 0.8138 0.000 0.964 0.012 0.000 0.000 NA
#> SRR330883 2 0.1204 0.8197 0.000 0.944 0.000 0.000 0.000 NA
#> SRR330884 4 0.4596 0.6783 0.000 0.000 0.000 0.692 0.188 NA
#> SRR330885 4 0.3003 0.6753 0.000 0.000 0.000 0.812 0.172 NA
#> SRR330886 4 0.4436 0.5123 0.000 0.000 0.000 0.640 0.312 NA
#> SRR330887 5 0.0260 0.7882 0.000 0.000 0.000 0.008 0.992 NA
#> SRR330888 5 0.0405 0.7876 0.000 0.000 0.000 0.004 0.988 NA
#> SRR330889 4 0.8486 0.1923 0.232 0.012 0.088 0.380 0.184 NA
#> SRR330890 4 0.2631 0.6730 0.000 0.000 0.000 0.820 0.180 NA
#> SRR330891 4 0.1176 0.6865 0.000 0.000 0.000 0.956 0.024 NA
#> SRR330892 2 0.1327 0.8204 0.000 0.936 0.000 0.000 0.000 NA
#> SRR330893 4 0.4379 0.5827 0.000 0.000 0.000 0.576 0.028 NA
#> SRR330894 4 0.4131 0.5911 0.000 0.000 0.000 0.600 0.016 NA
#> SRR330895 2 0.0520 0.8180 0.000 0.984 0.000 0.008 0.000 NA
#> SRR330896 4 0.3711 0.6230 0.000 0.000 0.000 0.720 0.260 NA
#> SRR330897 2 0.1267 0.8194 0.000 0.940 0.000 0.000 0.000 NA
#> SRR330898 2 0.1204 0.8197 0.000 0.944 0.000 0.000 0.000 NA
#> SRR330899 5 0.3871 0.4948 0.000 0.000 0.000 0.308 0.676 NA
#> SRR330900 5 0.3690 0.4705 0.000 0.000 0.000 0.308 0.684 NA
#> SRR330901 5 0.0405 0.7877 0.000 0.000 0.000 0.008 0.988 NA
#> SRR330902 5 0.4403 0.4768 0.000 0.000 0.000 0.304 0.648 NA
#> SRR330903 4 0.3587 0.6636 0.000 0.000 0.000 0.772 0.040 NA
#> SRR330904 2 0.4653 0.1894 0.000 0.484 0.000 0.484 0.012 NA
#> SRR330906 4 0.3417 0.6671 0.000 0.000 0.000 0.796 0.160 NA
#> SRR330907 5 0.7061 0.2415 0.328 0.000 0.000 0.100 0.400 NA
#> SRR330908 4 0.4388 0.5813 0.000 0.000 0.000 0.572 0.028 NA
#> SRR330909 5 0.3201 0.6952 0.008 0.000 0.000 0.148 0.820 NA
#> SRR330910 4 0.5191 0.6522 0.000 0.000 0.000 0.616 0.212 NA
#> SRR330911 4 0.3872 0.5807 0.000 0.000 0.000 0.604 0.004 NA
#> SRR330912 4 0.1320 0.6835 0.000 0.000 0.000 0.948 0.016 NA
#> SRR330913 4 0.3122 0.6712 0.000 0.000 0.000 0.804 0.176 NA
#> SRR330914 4 0.2814 0.6759 0.000 0.000 0.000 0.820 0.172 NA
#> SRR330915 5 0.0405 0.7876 0.000 0.000 0.000 0.004 0.988 NA
#> SRR330916 4 0.4379 0.5827 0.000 0.000 0.000 0.576 0.028 NA
#> SRR330917 4 0.3672 0.6605 0.000 0.000 0.000 0.776 0.168 NA
#> SRR330918 2 0.6344 0.4054 0.000 0.576 0.012 0.184 0.180 NA
#> SRR330919 5 0.1124 0.7801 0.000 0.000 0.000 0.036 0.956 NA
#> SRR330920 5 0.0951 0.7828 0.004 0.000 0.000 0.008 0.968 NA
#> SRR330921 5 0.0405 0.7876 0.000 0.000 0.000 0.004 0.988 NA
#> SRR330922 5 0.1267 0.7707 0.000 0.000 0.000 0.060 0.940 NA
#> SRR330923 5 0.2555 0.7393 0.096 0.000 0.000 0.008 0.876 NA
Heatmaps for the consensus matrix. It visualizes the probability of two samples to be in a same group.
consensus_heatmap(res, k = 2)
consensus_heatmap(res, k = 3)
consensus_heatmap(res, k = 4)
consensus_heatmap(res, k = 5)
consensus_heatmap(res, k = 6)
Heatmaps for the membership of samples in all partitions to see how consistent they are:
membership_heatmap(res, k = 2)
membership_heatmap(res, k = 3)
membership_heatmap(res, k = 4)
membership_heatmap(res, k = 5)
membership_heatmap(res, k = 6)
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)
get_signatures(res, k = 3)
get_signatures(res, k = 4)
get_signatures(res, k = 5)
get_signatures(res, k = 6)
Signature heatmaps where rows are not scaled:
get_signatures(res, k = 2, scale_rows = FALSE)
get_signatures(res, k = 3, scale_rows = FALSE)
get_signatures(res, k = 4, scale_rows = FALSE)
get_signatures(res, k = 5, scale_rows = FALSE)
get_signatures(res, k = 6, scale_rows = FALSE)
Compare the overlap of signatures from different k:
compare_signatures(res)
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:
which_row
: row indices corresponding to the input matrix.fdr
: FDR for the differential test. mean_x
: The mean value in group x.scaled_mean_x
: The mean value in group x after rows are scaled.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")
dimension_reduction(res, k = 3, method = "UMAP")
dimension_reduction(res, k = 4, method = "UMAP")
dimension_reduction(res, k = 5, method = "UMAP")
dimension_reduction(res, k = 6, method = "UMAP")
Following heatmap shows how subgroups are split when increasing k
:
collect_classes(res)
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.
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 10869 rows and 66 columns.
#> Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'SD' method.
#> Subgroups are detected by 'NMF' method.
#> Performed in total 1250 partitions by row resampling.
#> Best k for subgroups seems to be 3.
#>
#> Following methods can be applied to this 'ConsensusPartition' object:
#> [1] "cola_report" "collect_classes" "collect_plots"
#> [4] "collect_stats" "colnames" "compare_signatures"
#> [7] "consensus_heatmap" "dimension_reduction" "functional_enrichment"
#> [10] "get_anno_col" "get_anno" "get_classes"
#> [13] "get_consensus" "get_matrix" "get_membership"
#> [16] "get_param" "get_signatures" "get_stats"
#> [19] "is_best_k" "is_stable_k" "membership_heatmap"
#> [22] "ncol" "nrow" "plot_ecdf"
#> [25] "rownames" "select_partition_number" "show"
#> [28] "suggest_best_k" "test_to_known_factors"
collect_plots()
function collects all the plots made from res
for all k
(number of partitions)
into one single page to provide an easy and fast comparison between different k
.
collect_plots(res)
The plots are:
k
and the heatmap of
predicted classes for each k
.k
.k
.k
.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:
k
;k
, the area increased is defined as \(A_k - A_{k-1}\).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)
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.416 0.766 0.799 0.3842 0.549 0.549
#> 3 3 0.921 0.904 0.953 0.4446 0.789 0.645
#> 4 4 0.744 0.838 0.924 0.0619 0.997 0.992
#> 5 5 0.535 0.753 0.843 0.0723 1.000 1.000
#> 6 6 0.541 0.632 0.810 0.0539 0.962 0.910
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.
cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#> class entropy silhouette p1 p2
#> SRR330857 2 0.9393 0.9195 0.356 0.644
#> SRR330858 2 0.9608 0.9235 0.384 0.616
#> SRR330859 2 0.9608 0.9237 0.384 0.616
#> SRR330860 2 0.9427 -0.1543 0.360 0.640
#> SRR330861 2 0.9522 0.9259 0.372 0.628
#> SRR330862 2 0.9427 0.9236 0.360 0.640
#> SRR330863 2 0.9710 0.9129 0.400 0.600
#> SRR330864 2 0.9460 0.9257 0.364 0.636
#> SRR330865 2 0.9661 0.9193 0.392 0.608
#> SRR330866 1 0.3733 0.7594 0.928 0.072
#> SRR330867 2 0.9775 0.8979 0.412 0.588
#> SRR330868 2 0.9460 0.9257 0.364 0.636
#> SRR330869 1 0.2043 0.7997 0.968 0.032
#> SRR330870 2 0.9635 0.9217 0.388 0.612
#> SRR330871 2 0.9491 0.9262 0.368 0.632
#> SRR330872 2 0.9460 0.9257 0.364 0.636
#> SRR330873 2 0.9710 0.9128 0.400 0.600
#> SRR330874 1 0.7950 0.3299 0.760 0.240
#> SRR330875 2 0.9393 0.9195 0.356 0.644
#> SRR330876 2 0.9427 0.9236 0.360 0.640
#> SRR330877 2 0.9427 0.9236 0.360 0.640
#> SRR330878 2 0.9427 0.9236 0.360 0.640
#> SRR330879 2 0.9881 0.8607 0.436 0.564
#> SRR330880 2 0.9686 0.9163 0.396 0.604
#> SRR330881 2 0.9909 0.8467 0.444 0.556
#> SRR330882 1 0.9795 0.4906 0.584 0.416
#> SRR330883 1 0.9552 0.5287 0.624 0.376
#> SRR330884 1 0.0376 0.8126 0.996 0.004
#> SRR330885 1 0.1633 0.8098 0.976 0.024
#> SRR330886 1 0.1633 0.8052 0.976 0.024
#> SRR330887 1 0.4298 0.7369 0.912 0.088
#> SRR330888 1 0.4298 0.7369 0.912 0.088
#> SRR330889 1 0.9000 -0.0404 0.684 0.316
#> SRR330890 1 0.0376 0.8135 0.996 0.004
#> SRR330891 1 0.2043 0.8073 0.968 0.032
#> SRR330892 1 0.9580 0.5252 0.620 0.380
#> SRR330893 1 0.0376 0.8135 0.996 0.004
#> SRR330894 1 0.0376 0.8126 0.996 0.004
#> SRR330895 1 0.8955 0.5838 0.688 0.312
#> SRR330896 1 0.1843 0.8023 0.972 0.028
#> SRR330897 1 0.9427 0.5420 0.640 0.360
#> SRR330898 1 0.9427 0.5420 0.640 0.360
#> SRR330899 1 0.0376 0.8135 0.996 0.004
#> SRR330900 1 0.2423 0.7938 0.960 0.040
#> SRR330901 1 0.2236 0.7970 0.964 0.036
#> SRR330902 1 0.0000 0.8132 1.000 0.000
#> SRR330903 1 0.0376 0.8135 0.996 0.004
#> SRR330904 1 0.4690 0.7716 0.900 0.100
#> SRR330906 1 0.4022 0.7868 0.920 0.080
#> SRR330907 1 0.4939 0.7020 0.892 0.108
#> SRR330908 1 0.0000 0.8132 1.000 0.000
#> SRR330909 1 0.7528 0.6690 0.784 0.216
#> SRR330910 1 0.3584 0.7934 0.932 0.068
#> SRR330911 1 0.3584 0.7643 0.932 0.068
#> SRR330912 1 0.3879 0.7892 0.924 0.076
#> SRR330913 1 0.3879 0.7892 0.924 0.076
#> SRR330914 1 0.3733 0.7912 0.928 0.072
#> SRR330915 1 0.3733 0.7594 0.928 0.072
#> SRR330916 1 0.0938 0.8100 0.988 0.012
#> SRR330917 1 0.3879 0.7892 0.924 0.076
#> SRR330918 1 0.9686 0.5112 0.604 0.396
#> SRR330919 1 0.1414 0.8065 0.980 0.020
#> SRR330920 1 0.2236 0.7969 0.964 0.036
#> SRR330921 1 0.2948 0.7820 0.948 0.052
#> SRR330922 1 0.0376 0.8126 0.996 0.004
#> SRR330923 1 0.4431 0.7303 0.908 0.092
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> SRR330857 3 0.0661 0.9163 0.008 0.004 0.988
#> SRR330858 3 0.1964 0.9141 0.056 0.000 0.944
#> SRR330859 3 0.1525 0.9225 0.032 0.004 0.964
#> SRR330860 2 0.3482 0.7670 0.000 0.872 0.128
#> SRR330861 3 0.1163 0.9229 0.028 0.000 0.972
#> SRR330862 3 0.0829 0.9196 0.012 0.004 0.984
#> SRR330863 3 0.2537 0.8957 0.080 0.000 0.920
#> SRR330864 3 0.1129 0.9225 0.020 0.004 0.976
#> SRR330865 3 0.2448 0.9003 0.076 0.000 0.924
#> SRR330866 1 0.0592 0.9705 0.988 0.000 0.012
#> SRR330867 3 0.3267 0.8537 0.116 0.000 0.884
#> SRR330868 3 0.0829 0.9196 0.012 0.004 0.984
#> SRR330869 1 0.0237 0.9734 0.996 0.000 0.004
#> SRR330870 3 0.1964 0.9134 0.056 0.000 0.944
#> SRR330871 3 0.1399 0.9230 0.028 0.004 0.968
#> SRR330872 3 0.0983 0.9214 0.016 0.004 0.980
#> SRR330873 3 0.2878 0.8802 0.096 0.000 0.904
#> SRR330874 3 0.9191 0.0931 0.424 0.148 0.428
#> SRR330875 3 0.0475 0.9116 0.004 0.004 0.992
#> SRR330876 3 0.0829 0.9196 0.012 0.004 0.984
#> SRR330877 3 0.0829 0.9196 0.012 0.004 0.984
#> SRR330878 3 0.0592 0.9200 0.012 0.000 0.988
#> SRR330879 1 0.5431 0.5773 0.716 0.000 0.284
#> SRR330880 3 0.2448 0.8997 0.076 0.000 0.924
#> SRR330881 1 0.3267 0.8482 0.884 0.000 0.116
#> SRR330882 2 0.0424 0.8506 0.000 0.992 0.008
#> SRR330883 2 0.0848 0.8578 0.008 0.984 0.008
#> SRR330884 1 0.0000 0.9737 1.000 0.000 0.000
#> SRR330885 1 0.2356 0.9118 0.928 0.072 0.000
#> SRR330886 1 0.0848 0.9716 0.984 0.008 0.008
#> SRR330887 1 0.0592 0.9705 0.988 0.000 0.012
#> SRR330888 1 0.0592 0.9705 0.988 0.000 0.012
#> SRR330889 1 0.1411 0.9497 0.964 0.000 0.036
#> SRR330890 1 0.0237 0.9732 0.996 0.004 0.000
#> SRR330891 1 0.0424 0.9715 0.992 0.008 0.000
#> SRR330892 2 0.0848 0.8578 0.008 0.984 0.008
#> SRR330893 1 0.0237 0.9732 0.996 0.004 0.000
#> SRR330894 1 0.0000 0.9737 1.000 0.000 0.000
#> SRR330895 2 0.6295 0.1257 0.472 0.528 0.000
#> SRR330896 1 0.0237 0.9734 0.996 0.000 0.004
#> SRR330897 2 0.1643 0.8575 0.044 0.956 0.000
#> SRR330898 2 0.1411 0.8599 0.036 0.964 0.000
#> SRR330899 1 0.0237 0.9732 0.996 0.004 0.000
#> SRR330900 1 0.0424 0.9721 0.992 0.000 0.008
#> SRR330901 1 0.0237 0.9734 0.996 0.000 0.004
#> SRR330902 1 0.0661 0.9728 0.988 0.008 0.004
#> SRR330903 1 0.0237 0.9732 0.996 0.004 0.000
#> SRR330904 1 0.1129 0.9624 0.976 0.020 0.004
#> SRR330906 1 0.1289 0.9561 0.968 0.032 0.000
#> SRR330907 1 0.0747 0.9676 0.984 0.000 0.016
#> SRR330908 1 0.0000 0.9737 1.000 0.000 0.000
#> SRR330909 1 0.1711 0.9496 0.960 0.032 0.008
#> SRR330910 1 0.0829 0.9680 0.984 0.012 0.004
#> SRR330911 1 0.0592 0.9705 0.988 0.000 0.012
#> SRR330912 1 0.0829 0.9680 0.984 0.012 0.004
#> SRR330913 1 0.0892 0.9656 0.980 0.020 0.000
#> SRR330914 1 0.0829 0.9680 0.984 0.012 0.004
#> SRR330915 1 0.0424 0.9721 0.992 0.000 0.008
#> SRR330916 1 0.0000 0.9737 1.000 0.000 0.000
#> SRR330917 1 0.0747 0.9689 0.984 0.016 0.000
#> SRR330918 2 0.4371 0.8034 0.108 0.860 0.032
#> SRR330919 1 0.0000 0.9737 1.000 0.000 0.000
#> SRR330920 1 0.0237 0.9734 0.996 0.000 0.004
#> SRR330921 1 0.0000 0.9737 1.000 0.000 0.000
#> SRR330922 1 0.0000 0.9737 1.000 0.000 0.000
#> SRR330923 1 0.0592 0.9705 0.988 0.000 0.012
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> SRR330857 3 0.0592 0.8846 0.000 0.000 0.984 0.016
#> SRR330858 3 0.1994 0.8866 0.052 0.008 0.936 0.004
#> SRR330859 3 0.0895 0.9000 0.020 0.000 0.976 0.004
#> SRR330860 2 0.4017 0.6005 0.000 0.828 0.128 0.044
#> SRR330861 3 0.1042 0.8987 0.020 0.008 0.972 0.000
#> SRR330862 3 0.0336 0.8975 0.008 0.000 0.992 0.000
#> SRR330863 3 0.2197 0.8638 0.080 0.000 0.916 0.004
#> SRR330864 3 0.0707 0.8997 0.020 0.000 0.980 0.000
#> SRR330865 3 0.1970 0.8825 0.060 0.008 0.932 0.000
#> SRR330866 1 0.1256 0.9346 0.964 0.008 0.000 0.028
#> SRR330867 3 0.4158 0.6556 0.224 0.008 0.768 0.000
#> SRR330868 3 0.0469 0.8988 0.012 0.000 0.988 0.000
#> SRR330869 1 0.0000 0.9378 1.000 0.000 0.000 0.000
#> SRR330870 3 0.1970 0.8821 0.060 0.008 0.932 0.000
#> SRR330871 3 0.0336 0.8975 0.008 0.000 0.992 0.000
#> SRR330872 3 0.0188 0.8939 0.004 0.000 0.996 0.000
#> SRR330873 3 0.3142 0.8043 0.132 0.008 0.860 0.000
#> SRR330874 3 0.8432 0.0352 0.304 0.264 0.408 0.024
#> SRR330875 3 0.1557 0.8611 0.000 0.000 0.944 0.056
#> SRR330876 3 0.0469 0.8991 0.012 0.000 0.988 0.000
#> SRR330877 3 0.0336 0.8975 0.008 0.000 0.992 0.000
#> SRR330878 3 0.0336 0.8975 0.008 0.000 0.992 0.000
#> SRR330879 1 0.4621 0.5729 0.708 0.008 0.284 0.000
#> SRR330880 3 0.2593 0.8388 0.104 0.004 0.892 0.000
#> SRR330881 1 0.2055 0.9031 0.936 0.008 0.048 0.008
#> SRR330882 2 0.5138 0.2525 0.000 0.600 0.008 0.392
#> SRR330883 2 0.1356 0.7659 0.008 0.960 0.000 0.032
#> SRR330884 1 0.1151 0.9361 0.968 0.008 0.000 0.024
#> SRR330885 1 0.3858 0.8660 0.844 0.056 0.000 0.100
#> SRR330886 1 0.4669 0.8144 0.796 0.100 0.000 0.104
#> SRR330887 1 0.0524 0.9365 0.988 0.008 0.000 0.004
#> SRR330888 1 0.0524 0.9365 0.988 0.008 0.000 0.004
#> SRR330889 1 0.3547 0.8354 0.860 0.008 0.112 0.020
#> SRR330890 1 0.1042 0.9343 0.972 0.020 0.000 0.008
#> SRR330891 1 0.1489 0.9272 0.952 0.044 0.000 0.004
#> SRR330892 2 0.0672 0.7698 0.008 0.984 0.000 0.008
#> SRR330893 1 0.0707 0.9366 0.980 0.000 0.000 0.020
#> SRR330894 1 0.0895 0.9368 0.976 0.004 0.000 0.020
#> SRR330895 2 0.3808 0.4831 0.176 0.812 0.000 0.012
#> SRR330896 1 0.0000 0.9378 1.000 0.000 0.000 0.000
#> SRR330897 2 0.1724 0.7678 0.020 0.948 0.000 0.032
#> SRR330898 2 0.1042 0.7709 0.020 0.972 0.000 0.008
#> SRR330899 1 0.1256 0.9309 0.964 0.028 0.000 0.008
#> SRR330900 1 0.0336 0.9373 0.992 0.000 0.000 0.008
#> SRR330901 1 0.0592 0.9373 0.984 0.000 0.000 0.016
#> SRR330902 1 0.2271 0.9086 0.916 0.076 0.000 0.008
#> SRR330903 1 0.0000 0.9378 1.000 0.000 0.000 0.000
#> SRR330904 1 0.3367 0.8809 0.864 0.108 0.000 0.028
#> SRR330906 1 0.3808 0.8069 0.812 0.176 0.000 0.012
#> SRR330907 1 0.0844 0.9378 0.980 0.004 0.004 0.012
#> SRR330908 1 0.1118 0.9339 0.964 0.000 0.000 0.036
#> SRR330909 1 0.5690 0.6904 0.708 0.096 0.000 0.196
#> SRR330910 1 0.2048 0.9218 0.928 0.008 0.000 0.064
#> SRR330911 1 0.1256 0.9348 0.964 0.008 0.000 0.028
#> SRR330912 1 0.2644 0.9151 0.908 0.060 0.000 0.032
#> SRR330913 1 0.2473 0.9029 0.908 0.080 0.000 0.012
#> SRR330914 1 0.2282 0.9217 0.924 0.052 0.000 0.024
#> SRR330915 1 0.0376 0.9379 0.992 0.004 0.000 0.004
#> SRR330916 1 0.0921 0.9356 0.972 0.000 0.000 0.028
#> SRR330917 1 0.2402 0.9060 0.912 0.076 0.000 0.012
#> SRR330918 4 0.2988 0.0000 0.012 0.112 0.000 0.876
#> SRR330919 1 0.0188 0.9374 0.996 0.000 0.000 0.004
#> SRR330920 1 0.0524 0.9370 0.988 0.004 0.000 0.008
#> SRR330921 1 0.0188 0.9376 0.996 0.004 0.000 0.000
#> SRR330922 1 0.0188 0.9374 0.996 0.000 0.000 0.004
#> SRR330923 1 0.0524 0.9365 0.988 0.008 0.000 0.004
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> SRR330857 1 0.2124 0.7953 0.900 0.000 NA 0.000 0.004
#> SRR330858 1 0.2529 0.8449 0.900 0.000 NA 0.056 0.004
#> SRR330859 1 0.2193 0.8419 0.900 0.000 NA 0.092 0.000
#> SRR330860 2 0.6347 0.4299 0.080 0.540 NA 0.000 0.036
#> SRR330861 1 0.1270 0.8552 0.948 0.000 NA 0.052 0.000
#> SRR330862 1 0.0566 0.8459 0.984 0.000 NA 0.012 0.000
#> SRR330863 1 0.4058 0.7498 0.784 0.000 NA 0.152 0.000
#> SRR330864 1 0.1331 0.8548 0.952 0.000 NA 0.040 0.000
#> SRR330865 1 0.2625 0.8336 0.876 0.000 NA 0.108 0.000
#> SRR330866 4 0.2439 0.8509 0.000 0.000 NA 0.876 0.004
#> SRR330867 1 0.4503 0.5579 0.664 0.000 NA 0.312 0.000
#> SRR330868 1 0.0510 0.8477 0.984 0.000 NA 0.016 0.000
#> SRR330869 4 0.1216 0.8668 0.000 0.020 NA 0.960 0.000
#> SRR330870 1 0.2616 0.8382 0.880 0.000 NA 0.100 0.000
#> SRR330871 1 0.1484 0.8555 0.944 0.000 NA 0.048 0.000
#> SRR330872 1 0.0566 0.8400 0.984 0.000 NA 0.004 0.000
#> SRR330873 1 0.3513 0.7568 0.800 0.000 NA 0.180 0.000
#> SRR330874 1 0.8661 0.0243 0.344 0.180 NA 0.240 0.008
#> SRR330875 1 0.3570 0.7393 0.828 0.000 NA 0.004 0.044
#> SRR330876 1 0.1117 0.8447 0.964 0.000 NA 0.016 0.000
#> SRR330877 1 0.0290 0.8422 0.992 0.000 NA 0.008 0.000
#> SRR330878 1 0.0290 0.8422 0.992 0.000 NA 0.008 0.000
#> SRR330879 4 0.4275 0.5759 0.284 0.000 NA 0.696 0.000
#> SRR330880 1 0.2966 0.8027 0.848 0.000 NA 0.136 0.000
#> SRR330881 4 0.2899 0.8377 0.028 0.000 NA 0.872 0.004
#> SRR330882 2 0.6671 0.1549 0.000 0.440 NA 0.000 0.268
#> SRR330883 2 0.4161 0.6111 0.000 0.704 NA 0.000 0.016
#> SRR330884 4 0.2011 0.8678 0.000 0.004 NA 0.908 0.000
#> SRR330885 4 0.5024 0.7598 0.004 0.052 NA 0.708 0.012
#> SRR330886 4 0.5995 0.4605 0.000 0.100 NA 0.504 0.004
#> SRR330887 4 0.0510 0.8663 0.000 0.000 NA 0.984 0.000
#> SRR330888 4 0.0609 0.8642 0.000 0.000 NA 0.980 0.000
#> SRR330889 4 0.4262 0.7694 0.124 0.000 NA 0.776 0.000
#> SRR330890 4 0.1992 0.8553 0.000 0.044 NA 0.924 0.000
#> SRR330891 4 0.2679 0.8628 0.000 0.056 NA 0.892 0.004
#> SRR330892 2 0.0833 0.7135 0.000 0.976 NA 0.004 0.004
#> SRR330893 4 0.1991 0.8646 0.000 0.004 NA 0.916 0.004
#> SRR330894 4 0.2407 0.8623 0.000 0.012 NA 0.896 0.004
#> SRR330895 2 0.2569 0.6423 0.000 0.892 NA 0.068 0.000
#> SRR330896 4 0.1300 0.8689 0.000 0.016 NA 0.956 0.000
#> SRR330897 2 0.1891 0.6994 0.000 0.936 NA 0.016 0.016
#> SRR330898 2 0.1538 0.7106 0.000 0.948 NA 0.008 0.008
#> SRR330899 4 0.2645 0.8422 0.000 0.068 NA 0.888 0.000
#> SRR330900 4 0.2074 0.8514 0.000 0.036 NA 0.920 0.000
#> SRR330901 4 0.1638 0.8650 0.000 0.000 NA 0.932 0.004
#> SRR330902 4 0.3216 0.8170 0.000 0.108 NA 0.848 0.000
#> SRR330903 4 0.0960 0.8684 0.000 0.008 NA 0.972 0.004
#> SRR330904 4 0.5003 0.7435 0.000 0.072 NA 0.692 0.004
#> SRR330906 4 0.5279 0.6893 0.000 0.124 NA 0.688 0.004
#> SRR330907 4 0.2074 0.8635 0.000 0.000 NA 0.896 0.000
#> SRR330908 4 0.2488 0.8512 0.000 0.000 NA 0.872 0.004
#> SRR330909 4 0.7477 0.2666 0.000 0.096 NA 0.440 0.116
#> SRR330910 4 0.3815 0.7997 0.000 0.012 NA 0.764 0.004
#> SRR330911 4 0.2233 0.8556 0.000 0.000 NA 0.892 0.004
#> SRR330912 4 0.4019 0.8242 0.000 0.052 NA 0.792 0.004
#> SRR330913 4 0.4100 0.7320 0.000 0.192 NA 0.764 0.000
#> SRR330914 4 0.3142 0.8566 0.000 0.076 NA 0.864 0.004
#> SRR330915 4 0.1732 0.8671 0.000 0.000 NA 0.920 0.000
#> SRR330916 4 0.2763 0.8426 0.000 0.000 NA 0.848 0.004
#> SRR330917 4 0.4927 0.5611 0.000 0.296 NA 0.652 0.000
#> SRR330918 5 0.1282 0.0000 0.004 0.044 NA 0.000 0.952
#> SRR330919 4 0.0992 0.8682 0.000 0.000 NA 0.968 0.008
#> SRR330920 4 0.1043 0.8612 0.000 0.000 NA 0.960 0.000
#> SRR330921 4 0.0794 0.8671 0.000 0.000 NA 0.972 0.000
#> SRR330922 4 0.1205 0.8603 0.000 0.004 NA 0.956 0.000
#> SRR330923 4 0.1043 0.8643 0.000 0.000 NA 0.960 0.000
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> SRR330857 1 0.4492 0.65714 0.732 0.000 0.016 0.000 0.088 0.164
#> SRR330858 1 0.3192 0.80673 0.836 0.000 0.000 0.020 0.024 0.120
#> SRR330859 1 0.1760 0.86015 0.928 0.000 0.000 0.048 0.020 0.004
#> SRR330860 6 0.5678 0.12862 0.036 0.400 0.020 0.000 0.032 0.512
#> SRR330861 1 0.0865 0.86362 0.964 0.000 0.000 0.036 0.000 0.000
#> SRR330862 1 0.0725 0.85619 0.976 0.000 0.000 0.012 0.000 0.012
#> SRR330863 1 0.3088 0.83327 0.860 0.000 0.000 0.064 0.044 0.032
#> SRR330864 1 0.1003 0.86282 0.964 0.000 0.000 0.028 0.004 0.004
#> SRR330865 1 0.2452 0.84562 0.884 0.000 0.000 0.084 0.004 0.028
#> SRR330866 4 0.2846 0.70524 0.016 0.000 0.000 0.840 0.140 0.004
#> SRR330867 1 0.3974 0.66251 0.744 0.000 0.000 0.212 0.012 0.032
#> SRR330868 1 0.0405 0.85632 0.988 0.000 0.000 0.008 0.000 0.004
#> SRR330869 4 0.1477 0.74497 0.004 0.048 0.000 0.940 0.008 0.000
#> SRR330870 1 0.2350 0.85150 0.888 0.000 0.000 0.076 0.000 0.036
#> SRR330871 1 0.1364 0.86244 0.944 0.000 0.000 0.048 0.004 0.004
#> SRR330872 1 0.0820 0.85842 0.972 0.000 0.000 0.016 0.000 0.012
#> SRR330873 1 0.2726 0.82220 0.856 0.000 0.000 0.112 0.000 0.032
#> SRR330874 1 0.8091 0.13288 0.448 0.132 0.000 0.132 0.164 0.124
#> SRR330875 1 0.5938 0.46536 0.600 0.004 0.040 0.004 0.108 0.244
#> SRR330876 1 0.1493 0.84167 0.936 0.000 0.000 0.004 0.004 0.056
#> SRR330877 1 0.0260 0.85301 0.992 0.000 0.000 0.000 0.000 0.008
#> SRR330878 1 0.0260 0.85256 0.992 0.000 0.000 0.000 0.000 0.008
#> SRR330879 4 0.4899 -0.00535 0.448 0.000 0.000 0.504 0.036 0.012
#> SRR330880 1 0.2101 0.83261 0.892 0.000 0.000 0.100 0.004 0.004
#> SRR330881 4 0.4954 0.49901 0.052 0.000 0.000 0.716 0.092 0.140
#> SRR330882 6 0.7487 0.17106 0.000 0.256 0.136 0.000 0.276 0.332
#> SRR330883 2 0.5640 0.16946 0.000 0.604 0.012 0.004 0.196 0.184
#> SRR330884 4 0.2848 0.71161 0.000 0.004 0.000 0.856 0.104 0.036
#> SRR330885 4 0.4984 0.32784 0.012 0.040 0.000 0.640 0.292 0.016
#> SRR330886 5 0.6373 0.64291 0.004 0.088 0.004 0.348 0.496 0.060
#> SRR330887 4 0.1370 0.75067 0.012 0.000 0.000 0.948 0.036 0.004
#> SRR330888 4 0.1296 0.74828 0.012 0.000 0.000 0.952 0.032 0.004
#> SRR330889 4 0.5026 0.39458 0.204 0.000 0.000 0.652 0.140 0.004
#> SRR330890 4 0.2520 0.72404 0.008 0.076 0.000 0.888 0.024 0.004
#> SRR330891 4 0.2737 0.73555 0.000 0.084 0.000 0.868 0.044 0.004
#> SRR330892 2 0.1764 0.69371 0.000 0.936 0.004 0.012 0.024 0.024
#> SRR330893 4 0.2053 0.72527 0.000 0.004 0.000 0.888 0.108 0.000
#> SRR330894 4 0.2597 0.72979 0.004 0.012 0.000 0.868 0.112 0.004
#> SRR330895 2 0.2225 0.61006 0.000 0.892 0.000 0.092 0.008 0.008
#> SRR330896 4 0.1973 0.75222 0.008 0.028 0.000 0.924 0.036 0.004
#> SRR330897 2 0.1476 0.69900 0.000 0.948 0.012 0.028 0.004 0.008
#> SRR330898 2 0.2630 0.69846 0.000 0.888 0.008 0.016 0.068 0.020
#> SRR330899 4 0.2568 0.71125 0.004 0.088 0.000 0.880 0.024 0.004
#> SRR330900 4 0.2730 0.70293 0.008 0.092 0.000 0.872 0.024 0.004
#> SRR330901 4 0.1699 0.74683 0.004 0.004 0.000 0.928 0.060 0.004
#> SRR330902 4 0.3421 0.63591 0.004 0.160 0.000 0.804 0.028 0.004
#> SRR330903 4 0.0820 0.75273 0.000 0.016 0.000 0.972 0.012 0.000
#> SRR330904 4 0.4685 0.31875 0.000 0.040 0.000 0.644 0.300 0.016
#> SRR330906 4 0.6252 -0.15429 0.000 0.120 0.000 0.564 0.236 0.080
#> SRR330907 4 0.3798 0.66096 0.012 0.000 0.000 0.796 0.116 0.076
#> SRR330908 4 0.2558 0.69221 0.000 0.000 0.000 0.840 0.156 0.004
#> SRR330909 5 0.7463 0.60428 0.004 0.088 0.072 0.280 0.476 0.080
#> SRR330910 4 0.3636 0.41182 0.000 0.004 0.000 0.676 0.320 0.000
#> SRR330911 4 0.2806 0.70962 0.016 0.000 0.000 0.844 0.136 0.004
#> SRR330912 4 0.3825 0.59488 0.000 0.032 0.000 0.744 0.220 0.004
#> SRR330913 4 0.3932 0.46598 0.000 0.248 0.000 0.720 0.028 0.004
#> SRR330914 4 0.3068 0.72112 0.000 0.088 0.000 0.840 0.072 0.000
#> SRR330915 4 0.2007 0.73754 0.004 0.000 0.000 0.916 0.044 0.036
#> SRR330916 4 0.2883 0.63212 0.000 0.000 0.000 0.788 0.212 0.000
#> SRR330917 4 0.4414 0.23314 0.000 0.336 0.000 0.628 0.032 0.004
#> SRR330918 3 0.0363 0.00000 0.000 0.012 0.988 0.000 0.000 0.000
#> SRR330919 4 0.1484 0.75424 0.004 0.008 0.000 0.944 0.040 0.004
#> SRR330920 4 0.1490 0.74335 0.008 0.016 0.000 0.948 0.024 0.004
#> SRR330921 4 0.0891 0.75118 0.000 0.000 0.000 0.968 0.024 0.008
#> SRR330922 4 0.1534 0.74393 0.004 0.016 0.000 0.944 0.032 0.004
#> SRR330923 4 0.2002 0.73839 0.008 0.000 0.000 0.916 0.056 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)
consensus_heatmap(res, k = 3)
consensus_heatmap(res, k = 4)
consensus_heatmap(res, k = 5)
consensus_heatmap(res, k = 6)
Heatmaps for the membership of samples in all partitions to see how consistent they are:
membership_heatmap(res, k = 2)
membership_heatmap(res, k = 3)
membership_heatmap(res, k = 4)
membership_heatmap(res, k = 5)
membership_heatmap(res, k = 6)
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)
get_signatures(res, k = 3)
get_signatures(res, k = 4)
get_signatures(res, k = 5)
get_signatures(res, k = 6)
Signature heatmaps where rows are not scaled:
get_signatures(res, k = 2, scale_rows = FALSE)
get_signatures(res, k = 3, scale_rows = FALSE)
get_signatures(res, k = 4, scale_rows = FALSE)
get_signatures(res, k = 5, scale_rows = FALSE)
get_signatures(res, k = 6, scale_rows = FALSE)
Compare the overlap of signatures from different k:
compare_signatures(res)
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:
which_row
: row indices corresponding to the input matrix.fdr
: FDR for the differential test. mean_x
: The mean value in group x.scaled_mean_x
: The mean value in group x after rows are scaled.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")
dimension_reduction(res, k = 3, method = "UMAP")
dimension_reduction(res, k = 4, method = "UMAP")
dimension_reduction(res, k = 5, method = "UMAP")
dimension_reduction(res, k = 6, method = "UMAP")
Following heatmap shows how subgroups are split when increasing k
:
collect_classes(res)
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.
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 10869 rows and 66 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)
The plots are:
k
and the heatmap of
predicted classes for each k
.k
.k
.k
.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:
k
;k
, the area increased is defined as \(A_k - A_{k-1}\).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)
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.968 0.954 0.977 0.21429 0.761 0.761
#> 3 3 0.876 0.890 0.959 0.08614 0.996 0.995
#> 4 4 0.876 0.848 0.946 0.01899 0.997 0.996
#> 5 5 0.878 0.875 0.953 0.00844 0.994 0.993
#> 6 6 0.879 0.886 0.966 0.00496 0.998 0.998
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.
cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#> class entropy silhouette p1 p2
#> SRR330857 1 0.000 0.995 1.000 0.000
#> SRR330858 1 0.000 0.995 1.000 0.000
#> SRR330859 1 0.000 0.995 1.000 0.000
#> SRR330860 2 0.990 0.349 0.440 0.560
#> SRR330861 1 0.000 0.995 1.000 0.000
#> SRR330862 1 0.000 0.995 1.000 0.000
#> SRR330863 1 0.000 0.995 1.000 0.000
#> SRR330864 1 0.000 0.995 1.000 0.000
#> SRR330865 1 0.000 0.995 1.000 0.000
#> SRR330866 1 0.000 0.995 1.000 0.000
#> SRR330867 1 0.000 0.995 1.000 0.000
#> SRR330868 1 0.000 0.995 1.000 0.000
#> SRR330869 1 0.000 0.995 1.000 0.000
#> SRR330870 1 0.000 0.995 1.000 0.000
#> SRR330871 1 0.000 0.995 1.000 0.000
#> SRR330872 1 0.000 0.995 1.000 0.000
#> SRR330873 1 0.000 0.995 1.000 0.000
#> SRR330874 2 0.000 0.832 0.000 1.000
#> SRR330875 1 0.000 0.995 1.000 0.000
#> SRR330876 1 0.000 0.995 1.000 0.000
#> SRR330877 1 0.000 0.995 1.000 0.000
#> SRR330878 1 0.000 0.995 1.000 0.000
#> SRR330879 1 0.000 0.995 1.000 0.000
#> SRR330880 1 0.000 0.995 1.000 0.000
#> SRR330881 1 0.000 0.995 1.000 0.000
#> SRR330882 1 0.000 0.995 1.000 0.000
#> SRR330883 2 0.242 0.829 0.040 0.960
#> SRR330884 1 0.000 0.995 1.000 0.000
#> SRR330885 1 0.000 0.995 1.000 0.000
#> SRR330886 1 0.781 0.620 0.768 0.232
#> SRR330887 1 0.000 0.995 1.000 0.000
#> SRR330888 1 0.000 0.995 1.000 0.000
#> SRR330889 1 0.000 0.995 1.000 0.000
#> SRR330890 1 0.000 0.995 1.000 0.000
#> SRR330891 1 0.000 0.995 1.000 0.000
#> SRR330892 2 0.000 0.832 0.000 1.000
#> SRR330893 1 0.000 0.995 1.000 0.000
#> SRR330894 1 0.000 0.995 1.000 0.000
#> SRR330895 2 0.802 0.744 0.244 0.756
#> SRR330896 1 0.000 0.995 1.000 0.000
#> SRR330897 2 0.000 0.832 0.000 1.000
#> SRR330898 2 0.000 0.832 0.000 1.000
#> SRR330899 1 0.000 0.995 1.000 0.000
#> SRR330900 1 0.000 0.995 1.000 0.000
#> SRR330901 1 0.000 0.995 1.000 0.000
#> SRR330902 1 0.000 0.995 1.000 0.000
#> SRR330903 1 0.000 0.995 1.000 0.000
#> SRR330904 2 0.871 0.699 0.292 0.708
#> SRR330906 2 0.871 0.699 0.292 0.708
#> SRR330907 1 0.000 0.995 1.000 0.000
#> SRR330908 1 0.000 0.995 1.000 0.000
#> SRR330909 1 0.000 0.995 1.000 0.000
#> SRR330910 1 0.000 0.995 1.000 0.000
#> SRR330911 1 0.000 0.995 1.000 0.000
#> SRR330912 1 0.000 0.995 1.000 0.000
#> SRR330913 1 0.000 0.995 1.000 0.000
#> SRR330914 1 0.000 0.995 1.000 0.000
#> SRR330915 1 0.000 0.995 1.000 0.000
#> SRR330916 1 0.000 0.995 1.000 0.000
#> SRR330917 1 0.000 0.995 1.000 0.000
#> SRR330918 1 0.000 0.995 1.000 0.000
#> SRR330919 1 0.000 0.995 1.000 0.000
#> SRR330920 1 0.000 0.995 1.000 0.000
#> SRR330921 1 0.000 0.995 1.000 0.000
#> SRR330922 1 0.000 0.995 1.000 0.000
#> SRR330923 1 0.000 0.995 1.000 0.000
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> SRR330857 1 0.0000 0.9949 1.000 0.000 0.000
#> SRR330858 1 0.0000 0.9949 1.000 0.000 0.000
#> SRR330859 1 0.0000 0.9949 1.000 0.000 0.000
#> SRR330860 3 0.0592 0.0000 0.000 0.012 0.988
#> SRR330861 1 0.0000 0.9949 1.000 0.000 0.000
#> SRR330862 1 0.0000 0.9949 1.000 0.000 0.000
#> SRR330863 1 0.0000 0.9949 1.000 0.000 0.000
#> SRR330864 1 0.0000 0.9949 1.000 0.000 0.000
#> SRR330865 1 0.0000 0.9949 1.000 0.000 0.000
#> SRR330866 1 0.0000 0.9949 1.000 0.000 0.000
#> SRR330867 1 0.0000 0.9949 1.000 0.000 0.000
#> SRR330868 1 0.0000 0.9949 1.000 0.000 0.000
#> SRR330869 1 0.0000 0.9949 1.000 0.000 0.000
#> SRR330870 1 0.0000 0.9949 1.000 0.000 0.000
#> SRR330871 1 0.0000 0.9949 1.000 0.000 0.000
#> SRR330872 1 0.0000 0.9949 1.000 0.000 0.000
#> SRR330873 1 0.0000 0.9949 1.000 0.000 0.000
#> SRR330874 2 0.3192 0.2601 0.000 0.888 0.112
#> SRR330875 1 0.0000 0.9949 1.000 0.000 0.000
#> SRR330876 1 0.0000 0.9949 1.000 0.000 0.000
#> SRR330877 1 0.0000 0.9949 1.000 0.000 0.000
#> SRR330878 1 0.0000 0.9949 1.000 0.000 0.000
#> SRR330879 1 0.0000 0.9949 1.000 0.000 0.000
#> SRR330880 1 0.0000 0.9949 1.000 0.000 0.000
#> SRR330881 1 0.0000 0.9949 1.000 0.000 0.000
#> SRR330882 1 0.0000 0.9949 1.000 0.000 0.000
#> SRR330883 2 0.6682 0.0352 0.008 0.504 0.488
#> SRR330884 1 0.0000 0.9949 1.000 0.000 0.000
#> SRR330885 1 0.0000 0.9949 1.000 0.000 0.000
#> SRR330886 1 0.6447 0.6050 0.744 0.060 0.196
#> SRR330887 1 0.0000 0.9949 1.000 0.000 0.000
#> SRR330888 1 0.0000 0.9949 1.000 0.000 0.000
#> SRR330889 1 0.0000 0.9949 1.000 0.000 0.000
#> SRR330890 1 0.0000 0.9949 1.000 0.000 0.000
#> SRR330891 1 0.0000 0.9949 1.000 0.000 0.000
#> SRR330892 2 0.4974 0.3279 0.000 0.764 0.236
#> SRR330893 1 0.0000 0.9949 1.000 0.000 0.000
#> SRR330894 1 0.0000 0.9949 1.000 0.000 0.000
#> SRR330895 2 0.9053 0.4057 0.220 0.556 0.224
#> SRR330896 1 0.0000 0.9949 1.000 0.000 0.000
#> SRR330897 2 0.4974 0.3296 0.000 0.764 0.236
#> SRR330898 2 0.0424 0.3093 0.000 0.992 0.008
#> SRR330899 1 0.0000 0.9949 1.000 0.000 0.000
#> SRR330900 1 0.0000 0.9949 1.000 0.000 0.000
#> SRR330901 1 0.0000 0.9949 1.000 0.000 0.000
#> SRR330902 1 0.0000 0.9949 1.000 0.000 0.000
#> SRR330903 1 0.0000 0.9949 1.000 0.000 0.000
#> SRR330904 2 0.9233 0.3912 0.268 0.528 0.204
#> SRR330906 2 0.9233 0.3912 0.268 0.528 0.204
#> SRR330907 1 0.0000 0.9949 1.000 0.000 0.000
#> SRR330908 1 0.0000 0.9949 1.000 0.000 0.000
#> SRR330909 1 0.0000 0.9949 1.000 0.000 0.000
#> SRR330910 1 0.0000 0.9949 1.000 0.000 0.000
#> SRR330911 1 0.0000 0.9949 1.000 0.000 0.000
#> SRR330912 1 0.0000 0.9949 1.000 0.000 0.000
#> SRR330913 1 0.0000 0.9949 1.000 0.000 0.000
#> SRR330914 1 0.0000 0.9949 1.000 0.000 0.000
#> SRR330915 1 0.0000 0.9949 1.000 0.000 0.000
#> SRR330916 1 0.0000 0.9949 1.000 0.000 0.000
#> SRR330917 1 0.0000 0.9949 1.000 0.000 0.000
#> SRR330918 1 0.0000 0.9949 1.000 0.000 0.000
#> SRR330919 1 0.0000 0.9949 1.000 0.000 0.000
#> SRR330920 1 0.0000 0.9949 1.000 0.000 0.000
#> SRR330921 1 0.0000 0.9949 1.000 0.000 0.000
#> SRR330922 1 0.0000 0.9949 1.000 0.000 0.000
#> SRR330923 1 0.0000 0.9949 1.000 0.000 0.000
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> SRR330857 1 0.000 0.995 1.000 0.000 0.000 0.000
#> SRR330858 1 0.000 0.995 1.000 0.000 0.000 0.000
#> SRR330859 1 0.000 0.995 1.000 0.000 0.000 0.000
#> SRR330860 3 0.312 0.000 0.000 0.156 0.844 0.000
#> SRR330861 1 0.000 0.995 1.000 0.000 0.000 0.000
#> SRR330862 1 0.000 0.995 1.000 0.000 0.000 0.000
#> SRR330863 1 0.000 0.995 1.000 0.000 0.000 0.000
#> SRR330864 1 0.000 0.995 1.000 0.000 0.000 0.000
#> SRR330865 1 0.000 0.995 1.000 0.000 0.000 0.000
#> SRR330866 1 0.000 0.995 1.000 0.000 0.000 0.000
#> SRR330867 1 0.000 0.995 1.000 0.000 0.000 0.000
#> SRR330868 1 0.000 0.995 1.000 0.000 0.000 0.000
#> SRR330869 1 0.000 0.995 1.000 0.000 0.000 0.000
#> SRR330870 1 0.000 0.995 1.000 0.000 0.000 0.000
#> SRR330871 1 0.000 0.995 1.000 0.000 0.000 0.000
#> SRR330872 1 0.000 0.995 1.000 0.000 0.000 0.000
#> SRR330873 1 0.000 0.995 1.000 0.000 0.000 0.000
#> SRR330874 4 0.366 0.000 0.000 0.144 0.020 0.836
#> SRR330875 1 0.000 0.995 1.000 0.000 0.000 0.000
#> SRR330876 1 0.000 0.995 1.000 0.000 0.000 0.000
#> SRR330877 1 0.000 0.995 1.000 0.000 0.000 0.000
#> SRR330878 1 0.000 0.995 1.000 0.000 0.000 0.000
#> SRR330879 1 0.000 0.995 1.000 0.000 0.000 0.000
#> SRR330880 1 0.000 0.995 1.000 0.000 0.000 0.000
#> SRR330881 1 0.000 0.995 1.000 0.000 0.000 0.000
#> SRR330882 1 0.000 0.995 1.000 0.000 0.000 0.000
#> SRR330883 2 0.712 -0.361 0.000 0.556 0.180 0.264
#> SRR330884 1 0.000 0.995 1.000 0.000 0.000 0.000
#> SRR330885 1 0.000 0.995 1.000 0.000 0.000 0.000
#> SRR330886 1 0.413 0.588 0.740 0.260 0.000 0.000
#> SRR330887 1 0.000 0.995 1.000 0.000 0.000 0.000
#> SRR330888 1 0.000 0.995 1.000 0.000 0.000 0.000
#> SRR330889 1 0.000 0.995 1.000 0.000 0.000 0.000
#> SRR330890 1 0.000 0.995 1.000 0.000 0.000 0.000
#> SRR330891 1 0.000 0.995 1.000 0.000 0.000 0.000
#> SRR330892 2 0.744 -0.494 0.000 0.444 0.172 0.384
#> SRR330893 1 0.000 0.995 1.000 0.000 0.000 0.000
#> SRR330894 1 0.000 0.995 1.000 0.000 0.000 0.000
#> SRR330895 2 0.376 0.380 0.216 0.784 0.000 0.000
#> SRR330896 1 0.000 0.995 1.000 0.000 0.000 0.000
#> SRR330897 2 0.553 -0.163 0.000 0.708 0.220 0.072
#> SRR330898 2 0.620 -0.481 0.000 0.500 0.052 0.448
#> SRR330899 1 0.000 0.995 1.000 0.000 0.000 0.000
#> SRR330900 1 0.000 0.995 1.000 0.000 0.000 0.000
#> SRR330901 1 0.000 0.995 1.000 0.000 0.000 0.000
#> SRR330902 1 0.000 0.995 1.000 0.000 0.000 0.000
#> SRR330903 1 0.000 0.995 1.000 0.000 0.000 0.000
#> SRR330904 2 0.416 0.384 0.264 0.736 0.000 0.000
#> SRR330906 2 0.416 0.384 0.264 0.736 0.000 0.000
#> SRR330907 1 0.000 0.995 1.000 0.000 0.000 0.000
#> SRR330908 1 0.000 0.995 1.000 0.000 0.000 0.000
#> SRR330909 1 0.000 0.995 1.000 0.000 0.000 0.000
#> SRR330910 1 0.000 0.995 1.000 0.000 0.000 0.000
#> SRR330911 1 0.000 0.995 1.000 0.000 0.000 0.000
#> SRR330912 1 0.000 0.995 1.000 0.000 0.000 0.000
#> SRR330913 1 0.000 0.995 1.000 0.000 0.000 0.000
#> SRR330914 1 0.000 0.995 1.000 0.000 0.000 0.000
#> SRR330915 1 0.000 0.995 1.000 0.000 0.000 0.000
#> SRR330916 1 0.000 0.995 1.000 0.000 0.000 0.000
#> SRR330917 1 0.000 0.995 1.000 0.000 0.000 0.000
#> SRR330918 1 0.000 0.995 1.000 0.000 0.000 0.000
#> SRR330919 1 0.000 0.995 1.000 0.000 0.000 0.000
#> SRR330920 1 0.000 0.995 1.000 0.000 0.000 0.000
#> SRR330921 1 0.000 0.995 1.000 0.000 0.000 0.000
#> SRR330922 1 0.000 0.995 1.000 0.000 0.000 0.000
#> SRR330923 1 0.000 0.995 1.000 0.000 0.000 0.000
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> SRR330857 1 0.0000 0.994 1.000 0.000 0.000 0.000 0.000
#> SRR330858 1 0.0000 0.994 1.000 0.000 0.000 0.000 0.000
#> SRR330859 1 0.0000 0.994 1.000 0.000 0.000 0.000 0.000
#> SRR330860 3 0.0000 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR330861 1 0.0000 0.994 1.000 0.000 0.000 0.000 0.000
#> SRR330862 1 0.0000 0.994 1.000 0.000 0.000 0.000 0.000
#> SRR330863 1 0.0000 0.994 1.000 0.000 0.000 0.000 0.000
#> SRR330864 1 0.0000 0.994 1.000 0.000 0.000 0.000 0.000
#> SRR330865 1 0.0000 0.994 1.000 0.000 0.000 0.000 0.000
#> SRR330866 1 0.0000 0.994 1.000 0.000 0.000 0.000 0.000
#> SRR330867 1 0.0000 0.994 1.000 0.000 0.000 0.000 0.000
#> SRR330868 1 0.0000 0.994 1.000 0.000 0.000 0.000 0.000
#> SRR330869 1 0.0000 0.994 1.000 0.000 0.000 0.000 0.000
#> SRR330870 1 0.0000 0.994 1.000 0.000 0.000 0.000 0.000
#> SRR330871 1 0.0000 0.994 1.000 0.000 0.000 0.000 0.000
#> SRR330872 1 0.0000 0.994 1.000 0.000 0.000 0.000 0.000
#> SRR330873 1 0.0000 0.994 1.000 0.000 0.000 0.000 0.000
#> SRR330874 5 0.4390 0.341 0.000 0.428 0.000 0.004 0.568
#> SRR330875 1 0.0000 0.994 1.000 0.000 0.000 0.000 0.000
#> SRR330876 1 0.0000 0.994 1.000 0.000 0.000 0.000 0.000
#> SRR330877 1 0.0000 0.994 1.000 0.000 0.000 0.000 0.000
#> SRR330878 1 0.0000 0.994 1.000 0.000 0.000 0.000 0.000
#> SRR330879 1 0.0000 0.994 1.000 0.000 0.000 0.000 0.000
#> SRR330880 1 0.0000 0.994 1.000 0.000 0.000 0.000 0.000
#> SRR330881 1 0.0000 0.994 1.000 0.000 0.000 0.000 0.000
#> SRR330882 1 0.0000 0.994 1.000 0.000 0.000 0.000 0.000
#> SRR330883 4 0.0162 0.000 0.000 0.000 0.004 0.996 0.000
#> SRR330884 1 0.0000 0.994 1.000 0.000 0.000 0.000 0.000
#> SRR330885 1 0.0000 0.994 1.000 0.000 0.000 0.000 0.000
#> SRR330886 1 0.3561 0.560 0.740 0.000 0.000 0.260 0.000
#> SRR330887 1 0.0000 0.994 1.000 0.000 0.000 0.000 0.000
#> SRR330888 1 0.0000 0.994 1.000 0.000 0.000 0.000 0.000
#> SRR330889 1 0.0000 0.994 1.000 0.000 0.000 0.000 0.000
#> SRR330890 1 0.0000 0.994 1.000 0.000 0.000 0.000 0.000
#> SRR330891 1 0.0000 0.994 1.000 0.000 0.000 0.000 0.000
#> SRR330892 5 0.2020 0.367 0.000 0.100 0.000 0.000 0.900
#> SRR330893 1 0.0000 0.994 1.000 0.000 0.000 0.000 0.000
#> SRR330894 1 0.0000 0.994 1.000 0.000 0.000 0.000 0.000
#> SRR330895 2 0.8417 0.452 0.216 0.340 0.000 0.272 0.172
#> SRR330896 1 0.0000 0.994 1.000 0.000 0.000 0.000 0.000
#> SRR330897 2 0.4702 -0.274 0.000 0.552 0.000 0.016 0.432
#> SRR330898 2 0.0404 -0.383 0.000 0.988 0.000 0.012 0.000
#> SRR330899 1 0.0000 0.994 1.000 0.000 0.000 0.000 0.000
#> SRR330900 1 0.0000 0.994 1.000 0.000 0.000 0.000 0.000
#> SRR330901 1 0.0000 0.994 1.000 0.000 0.000 0.000 0.000
#> SRR330902 1 0.0000 0.994 1.000 0.000 0.000 0.000 0.000
#> SRR330903 1 0.0000 0.994 1.000 0.000 0.000 0.000 0.000
#> SRR330904 2 0.8422 0.484 0.264 0.312 0.000 0.272 0.152
#> SRR330906 2 0.8422 0.484 0.264 0.312 0.000 0.272 0.152
#> SRR330907 1 0.0000 0.994 1.000 0.000 0.000 0.000 0.000
#> SRR330908 1 0.0000 0.994 1.000 0.000 0.000 0.000 0.000
#> SRR330909 1 0.0000 0.994 1.000 0.000 0.000 0.000 0.000
#> SRR330910 1 0.0000 0.994 1.000 0.000 0.000 0.000 0.000
#> SRR330911 1 0.0000 0.994 1.000 0.000 0.000 0.000 0.000
#> SRR330912 1 0.0000 0.994 1.000 0.000 0.000 0.000 0.000
#> SRR330913 1 0.0000 0.994 1.000 0.000 0.000 0.000 0.000
#> SRR330914 1 0.0000 0.994 1.000 0.000 0.000 0.000 0.000
#> SRR330915 1 0.0000 0.994 1.000 0.000 0.000 0.000 0.000
#> SRR330916 1 0.0000 0.994 1.000 0.000 0.000 0.000 0.000
#> SRR330917 1 0.0000 0.994 1.000 0.000 0.000 0.000 0.000
#> SRR330918 1 0.0000 0.994 1.000 0.000 0.000 0.000 0.000
#> SRR330919 1 0.0000 0.994 1.000 0.000 0.000 0.000 0.000
#> SRR330920 1 0.0000 0.994 1.000 0.000 0.000 0.000 0.000
#> SRR330921 1 0.0000 0.994 1.000 0.000 0.000 0.000 0.000
#> SRR330922 1 0.0000 0.994 1.000 0.000 0.000 0.000 0.000
#> SRR330923 1 0.0000 0.994 1.000 0.000 0.000 0.000 0.000
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> SRR330857 4 0.000 0.994 0.000 0.000 0.000 1.000 0.000 0
#> SRR330858 4 0.000 0.994 0.000 0.000 0.000 1.000 0.000 0
#> SRR330859 4 0.000 0.994 0.000 0.000 0.000 1.000 0.000 0
#> SRR330860 6 0.000 0.000 0.000 0.000 0.000 0.000 0.000 1
#> SRR330861 4 0.000 0.994 0.000 0.000 0.000 1.000 0.000 0
#> SRR330862 4 0.000 0.994 0.000 0.000 0.000 1.000 0.000 0
#> SRR330863 4 0.000 0.994 0.000 0.000 0.000 1.000 0.000 0
#> SRR330864 4 0.000 0.994 0.000 0.000 0.000 1.000 0.000 0
#> SRR330865 4 0.000 0.994 0.000 0.000 0.000 1.000 0.000 0
#> SRR330866 4 0.000 0.994 0.000 0.000 0.000 1.000 0.000 0
#> SRR330867 4 0.000 0.994 0.000 0.000 0.000 1.000 0.000 0
#> SRR330868 4 0.000 0.994 0.000 0.000 0.000 1.000 0.000 0
#> SRR330869 4 0.000 0.994 0.000 0.000 0.000 1.000 0.000 0
#> SRR330870 4 0.000 0.994 0.000 0.000 0.000 1.000 0.000 0
#> SRR330871 4 0.000 0.994 0.000 0.000 0.000 1.000 0.000 0
#> SRR330872 4 0.000 0.994 0.000 0.000 0.000 1.000 0.000 0
#> SRR330873 4 0.000 0.994 0.000 0.000 0.000 1.000 0.000 0
#> SRR330874 5 0.552 0.333 0.320 0.000 0.152 0.000 0.528 0
#> SRR330875 4 0.000 0.994 0.000 0.000 0.000 1.000 0.000 0
#> SRR330876 4 0.000 0.994 0.000 0.000 0.000 1.000 0.000 0
#> SRR330877 4 0.000 0.994 0.000 0.000 0.000 1.000 0.000 0
#> SRR330878 4 0.000 0.994 0.000 0.000 0.000 1.000 0.000 0
#> SRR330879 4 0.000 0.994 0.000 0.000 0.000 1.000 0.000 0
#> SRR330880 4 0.000 0.994 0.000 0.000 0.000 1.000 0.000 0
#> SRR330881 4 0.000 0.994 0.000 0.000 0.000 1.000 0.000 0
#> SRR330882 4 0.000 0.994 0.000 0.000 0.000 1.000 0.000 0
#> SRR330883 1 0.385 0.000 0.536 0.464 0.000 0.000 0.000 0
#> SRR330884 4 0.000 0.994 0.000 0.000 0.000 1.000 0.000 0
#> SRR330885 4 0.000 0.994 0.000 0.000 0.000 1.000 0.000 0
#> SRR330886 4 0.320 0.529 0.000 0.260 0.000 0.740 0.000 0
#> SRR330887 4 0.000 0.994 0.000 0.000 0.000 1.000 0.000 0
#> SRR330888 4 0.000 0.994 0.000 0.000 0.000 1.000 0.000 0
#> SRR330889 4 0.000 0.994 0.000 0.000 0.000 1.000 0.000 0
#> SRR330890 4 0.000 0.994 0.000 0.000 0.000 1.000 0.000 0
#> SRR330891 4 0.000 0.994 0.000 0.000 0.000 1.000 0.000 0
#> SRR330892 5 0.127 0.427 0.000 0.060 0.000 0.000 0.940 0
#> SRR330893 4 0.000 0.994 0.000 0.000 0.000 1.000 0.000 0
#> SRR330894 4 0.000 0.994 0.000 0.000 0.000 1.000 0.000 0
#> SRR330895 2 0.291 0.592 0.000 0.784 0.000 0.216 0.000 0
#> SRR330896 4 0.000 0.994 0.000 0.000 0.000 1.000 0.000 0
#> SRR330897 2 0.546 -0.334 0.144 0.536 0.000 0.000 0.320 0
#> SRR330898 3 0.000 0.000 0.000 0.000 1.000 0.000 0.000 0
#> SRR330899 4 0.000 0.994 0.000 0.000 0.000 1.000 0.000 0
#> SRR330900 4 0.000 0.994 0.000 0.000 0.000 1.000 0.000 0
#> SRR330901 4 0.000 0.994 0.000 0.000 0.000 1.000 0.000 0
#> SRR330902 4 0.000 0.994 0.000 0.000 0.000 1.000 0.000 0
#> SRR330903 4 0.000 0.994 0.000 0.000 0.000 1.000 0.000 0
#> SRR330904 2 0.322 0.642 0.000 0.736 0.000 0.264 0.000 0
#> SRR330906 2 0.322 0.642 0.000 0.736 0.000 0.264 0.000 0
#> SRR330907 4 0.000 0.994 0.000 0.000 0.000 1.000 0.000 0
#> SRR330908 4 0.000 0.994 0.000 0.000 0.000 1.000 0.000 0
#> SRR330909 4 0.000 0.994 0.000 0.000 0.000 1.000 0.000 0
#> SRR330910 4 0.000 0.994 0.000 0.000 0.000 1.000 0.000 0
#> SRR330911 4 0.000 0.994 0.000 0.000 0.000 1.000 0.000 0
#> SRR330912 4 0.000 0.994 0.000 0.000 0.000 1.000 0.000 0
#> SRR330913 4 0.000 0.994 0.000 0.000 0.000 1.000 0.000 0
#> SRR330914 4 0.000 0.994 0.000 0.000 0.000 1.000 0.000 0
#> SRR330915 4 0.000 0.994 0.000 0.000 0.000 1.000 0.000 0
#> SRR330916 4 0.000 0.994 0.000 0.000 0.000 1.000 0.000 0
#> SRR330917 4 0.000 0.994 0.000 0.000 0.000 1.000 0.000 0
#> SRR330918 4 0.000 0.994 0.000 0.000 0.000 1.000 0.000 0
#> SRR330919 4 0.000 0.994 0.000 0.000 0.000 1.000 0.000 0
#> SRR330920 4 0.000 0.994 0.000 0.000 0.000 1.000 0.000 0
#> SRR330921 4 0.000 0.994 0.000 0.000 0.000 1.000 0.000 0
#> SRR330922 4 0.000 0.994 0.000 0.000 0.000 1.000 0.000 0
#> SRR330923 4 0.000 0.994 0.000 0.000 0.000 1.000 0.000 0
Heatmaps for the consensus matrix. It visualizes the probability of two samples to be in a same group.
consensus_heatmap(res, k = 2)
consensus_heatmap(res, k = 3)
consensus_heatmap(res, k = 4)
consensus_heatmap(res, k = 5)
consensus_heatmap(res, k = 6)
Heatmaps for the membership of samples in all partitions to see how consistent they are:
membership_heatmap(res, k = 2)
membership_heatmap(res, k = 3)
membership_heatmap(res, k = 4)
membership_heatmap(res, k = 5)
membership_heatmap(res, k = 6)
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)
get_signatures(res, k = 3)
get_signatures(res, k = 4)
get_signatures(res, k = 5)
get_signatures(res, k = 6)
Signature heatmaps where rows are not scaled:
get_signatures(res, k = 2, scale_rows = FALSE)
get_signatures(res, k = 3, scale_rows = FALSE)
get_signatures(res, k = 4, scale_rows = FALSE)
get_signatures(res, k = 5, scale_rows = FALSE)
get_signatures(res, k = 6, scale_rows = FALSE)
#> Error in mat[ceiling(1:nr/h_ratio), ceiling(1:nc/w_ratio), drop = FALSE]: subscript out of bounds
Compare the overlap of signatures from different k:
compare_signatures(res)
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:
which_row
: row indices corresponding to the input matrix.fdr
: FDR for the differential test. mean_x
: The mean value in group x.scaled_mean_x
: The mean value in group x after rows are scaled.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")
dimension_reduction(res, k = 3, method = "UMAP")
dimension_reduction(res, k = 4, method = "UMAP")
dimension_reduction(res, k = 5, method = "UMAP")
dimension_reduction(res, k = 6, method = "UMAP")
Following heatmap shows how subgroups are split when increasing k
:
collect_classes(res)
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.
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 10869 rows and 66 columns.
#> Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'CV' method.
#> Subgroups are detected by 'kmeans' method.
#> Performed in total 1250 partitions by row resampling.
#> Best k for subgroups seems to be 2.
#>
#> Following methods can be applied to this 'ConsensusPartition' object:
#> [1] "cola_report" "collect_classes" "collect_plots"
#> [4] "collect_stats" "colnames" "compare_signatures"
#> [7] "consensus_heatmap" "dimension_reduction" "functional_enrichment"
#> [10] "get_anno_col" "get_anno" "get_classes"
#> [13] "get_consensus" "get_matrix" "get_membership"
#> [16] "get_param" "get_signatures" "get_stats"
#> [19] "is_best_k" "is_stable_k" "membership_heatmap"
#> [22] "ncol" "nrow" "plot_ecdf"
#> [25] "rownames" "select_partition_number" "show"
#> [28] "suggest_best_k" "test_to_known_factors"
collect_plots()
function collects all the plots made from res
for all k
(number of partitions)
into one single page to provide an easy and fast comparison between different k
.
collect_plots(res)
The plots are:
k
and the heatmap of
predicted classes for each k
.k
.k
.k
.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:
k
;k
, the area increased is defined as \(A_k - A_{k-1}\).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)
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.993 0.997 0.2127 0.784 0.784
#> 3 3 0.385 0.553 0.682 1.0525 0.664 0.572
#> 4 4 0.346 0.681 0.759 0.2524 0.776 0.582
#> 5 5 0.397 0.530 0.717 0.1174 0.946 0.871
#> 6 6 0.499 0.667 0.787 0.0667 0.851 0.648
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.
cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#> class entropy silhouette p1 p2
#> SRR330857 1 0.000 1.000 1.000 0.000
#> SRR330858 1 0.000 1.000 1.000 0.000
#> SRR330859 1 0.000 1.000 1.000 0.000
#> SRR330860 2 0.000 0.971 0.000 1.000
#> SRR330861 1 0.000 1.000 1.000 0.000
#> SRR330862 1 0.000 1.000 1.000 0.000
#> SRR330863 1 0.000 1.000 1.000 0.000
#> SRR330864 1 0.000 1.000 1.000 0.000
#> SRR330865 1 0.000 1.000 1.000 0.000
#> SRR330866 1 0.000 1.000 1.000 0.000
#> SRR330867 1 0.000 1.000 1.000 0.000
#> SRR330868 1 0.000 1.000 1.000 0.000
#> SRR330869 1 0.000 1.000 1.000 0.000
#> SRR330870 1 0.000 1.000 1.000 0.000
#> SRR330871 1 0.000 1.000 1.000 0.000
#> SRR330872 1 0.000 1.000 1.000 0.000
#> SRR330873 1 0.000 1.000 1.000 0.000
#> SRR330874 2 0.000 0.971 0.000 1.000
#> SRR330875 1 0.000 1.000 1.000 0.000
#> SRR330876 1 0.000 1.000 1.000 0.000
#> SRR330877 1 0.000 1.000 1.000 0.000
#> SRR330878 1 0.000 1.000 1.000 0.000
#> SRR330879 1 0.000 1.000 1.000 0.000
#> SRR330880 1 0.000 1.000 1.000 0.000
#> SRR330881 1 0.000 1.000 1.000 0.000
#> SRR330882 1 0.000 1.000 1.000 0.000
#> SRR330883 2 0.000 0.971 0.000 1.000
#> SRR330884 1 0.000 1.000 1.000 0.000
#> SRR330885 1 0.000 1.000 1.000 0.000
#> SRR330886 1 0.000 1.000 1.000 0.000
#> SRR330887 1 0.000 1.000 1.000 0.000
#> SRR330888 1 0.000 1.000 1.000 0.000
#> SRR330889 1 0.000 1.000 1.000 0.000
#> SRR330890 1 0.000 1.000 1.000 0.000
#> SRR330891 1 0.000 1.000 1.000 0.000
#> SRR330892 2 0.000 0.971 0.000 1.000
#> SRR330893 1 0.000 1.000 1.000 0.000
#> SRR330894 1 0.000 1.000 1.000 0.000
#> SRR330895 2 0.000 0.971 0.000 1.000
#> SRR330896 1 0.000 1.000 1.000 0.000
#> SRR330897 2 0.000 0.971 0.000 1.000
#> SRR330898 2 0.000 0.971 0.000 1.000
#> SRR330899 1 0.000 1.000 1.000 0.000
#> SRR330900 1 0.000 1.000 1.000 0.000
#> SRR330901 1 0.000 1.000 1.000 0.000
#> SRR330902 1 0.000 1.000 1.000 0.000
#> SRR330903 1 0.000 1.000 1.000 0.000
#> SRR330904 2 0.722 0.750 0.200 0.800
#> SRR330906 1 0.118 0.983 0.984 0.016
#> SRR330907 1 0.000 1.000 1.000 0.000
#> SRR330908 1 0.000 1.000 1.000 0.000
#> SRR330909 1 0.000 1.000 1.000 0.000
#> SRR330910 1 0.000 1.000 1.000 0.000
#> SRR330911 1 0.000 1.000 1.000 0.000
#> SRR330912 1 0.000 1.000 1.000 0.000
#> SRR330913 1 0.000 1.000 1.000 0.000
#> SRR330914 1 0.000 1.000 1.000 0.000
#> SRR330915 1 0.000 1.000 1.000 0.000
#> SRR330916 1 0.000 1.000 1.000 0.000
#> SRR330917 1 0.000 1.000 1.000 0.000
#> SRR330918 1 0.000 1.000 1.000 0.000
#> SRR330919 1 0.000 1.000 1.000 0.000
#> SRR330920 1 0.000 1.000 1.000 0.000
#> SRR330921 1 0.000 1.000 1.000 0.000
#> SRR330922 1 0.000 1.000 1.000 0.000
#> SRR330923 1 0.000 1.000 1.000 0.000
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> SRR330857 3 0.0747 0.628 0.016 0.000 0.984
#> SRR330858 3 0.0237 0.635 0.004 0.000 0.996
#> SRR330859 3 0.5706 -0.257 0.320 0.000 0.680
#> SRR330860 2 0.5968 0.853 0.364 0.636 0.000
#> SRR330861 3 0.0892 0.624 0.020 0.000 0.980
#> SRR330862 3 0.6026 -0.394 0.376 0.000 0.624
#> SRR330863 3 0.6192 -0.530 0.420 0.000 0.580
#> SRR330864 3 0.6026 -0.394 0.376 0.000 0.624
#> SRR330865 3 0.0000 0.637 0.000 0.000 1.000
#> SRR330866 1 0.6252 0.946 0.556 0.000 0.444
#> SRR330867 3 0.0000 0.637 0.000 0.000 1.000
#> SRR330868 3 0.6026 -0.394 0.376 0.000 0.624
#> SRR330869 3 0.6079 -0.360 0.388 0.000 0.612
#> SRR330870 3 0.0000 0.637 0.000 0.000 1.000
#> SRR330871 3 0.0424 0.632 0.008 0.000 0.992
#> SRR330872 3 0.6026 -0.394 0.376 0.000 0.624
#> SRR330873 3 0.0000 0.637 0.000 0.000 1.000
#> SRR330874 2 0.0892 0.916 0.020 0.980 0.000
#> SRR330875 3 0.0747 0.628 0.016 0.000 0.984
#> SRR330876 3 0.0000 0.637 0.000 0.000 1.000
#> SRR330877 3 0.0892 0.624 0.020 0.000 0.980
#> SRR330878 3 0.0424 0.632 0.008 0.000 0.992
#> SRR330879 3 0.0000 0.637 0.000 0.000 1.000
#> SRR330880 3 0.6008 -0.386 0.372 0.000 0.628
#> SRR330881 3 0.3340 0.624 0.120 0.000 0.880
#> SRR330882 3 0.4654 0.566 0.208 0.000 0.792
#> SRR330883 2 0.3412 0.917 0.124 0.876 0.000
#> SRR330884 1 0.6299 0.899 0.524 0.000 0.476
#> SRR330885 1 0.6244 0.941 0.560 0.000 0.440
#> SRR330886 1 0.6180 0.896 0.584 0.000 0.416
#> SRR330887 3 0.3752 0.607 0.144 0.000 0.856
#> SRR330888 3 0.3752 0.607 0.144 0.000 0.856
#> SRR330889 3 0.6204 -0.564 0.424 0.000 0.576
#> SRR330890 1 0.6244 0.943 0.560 0.000 0.440
#> SRR330891 1 0.6244 0.943 0.560 0.000 0.440
#> SRR330892 2 0.0592 0.916 0.012 0.988 0.000
#> SRR330893 1 0.6252 0.946 0.556 0.000 0.444
#> SRR330894 1 0.6252 0.946 0.556 0.000 0.444
#> SRR330895 2 0.2959 0.919 0.100 0.900 0.000
#> SRR330896 1 0.6302 0.890 0.520 0.000 0.480
#> SRR330897 2 0.2959 0.919 0.100 0.900 0.000
#> SRR330898 2 0.0000 0.917 0.000 1.000 0.000
#> SRR330899 3 0.4002 0.591 0.160 0.000 0.840
#> SRR330900 3 0.4002 0.591 0.160 0.000 0.840
#> SRR330901 3 0.4002 0.591 0.160 0.000 0.840
#> SRR330902 3 0.6079 -0.348 0.388 0.000 0.612
#> SRR330903 1 0.6274 0.939 0.544 0.000 0.456
#> SRR330904 2 0.7451 0.603 0.396 0.564 0.040
#> SRR330906 1 0.5678 0.649 0.684 0.000 0.316
#> SRR330907 3 0.3267 0.623 0.116 0.000 0.884
#> SRR330908 1 0.6274 0.939 0.544 0.000 0.456
#> SRR330909 3 0.3941 0.610 0.156 0.000 0.844
#> SRR330910 3 0.6302 -0.758 0.480 0.000 0.520
#> SRR330911 1 0.6252 0.946 0.556 0.000 0.444
#> SRR330912 1 0.6244 0.943 0.560 0.000 0.440
#> SRR330913 1 0.6274 0.939 0.544 0.000 0.456
#> SRR330914 1 0.6274 0.939 0.544 0.000 0.456
#> SRR330915 3 0.4002 0.591 0.160 0.000 0.840
#> SRR330916 1 0.6252 0.946 0.556 0.000 0.444
#> SRR330917 1 0.6299 0.897 0.524 0.000 0.476
#> SRR330918 3 0.3941 0.610 0.156 0.000 0.844
#> SRR330919 3 0.4002 0.591 0.160 0.000 0.840
#> SRR330920 3 0.3551 0.616 0.132 0.000 0.868
#> SRR330921 3 0.4002 0.591 0.160 0.000 0.840
#> SRR330922 3 0.4002 0.591 0.160 0.000 0.840
#> SRR330923 3 0.3482 0.618 0.128 0.000 0.872
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> SRR330857 1 0.3351 0.782 0.844 0.000 0.008 0.148
#> SRR330858 1 0.3088 0.791 0.864 0.000 0.008 0.128
#> SRR330859 4 0.6808 0.491 0.320 0.000 0.120 0.560
#> SRR330860 3 0.3311 0.000 0.000 0.172 0.828 0.000
#> SRR330861 1 0.5792 0.644 0.708 0.000 0.124 0.168
#> SRR330862 4 0.6673 0.582 0.252 0.000 0.140 0.608
#> SRR330863 4 0.6248 0.627 0.224 0.000 0.120 0.656
#> SRR330864 4 0.6673 0.582 0.252 0.000 0.140 0.608
#> SRR330865 1 0.3377 0.780 0.848 0.000 0.012 0.140
#> SRR330866 4 0.4605 0.805 0.336 0.000 0.000 0.664
#> SRR330867 1 0.2868 0.790 0.864 0.000 0.000 0.136
#> SRR330868 4 0.6673 0.582 0.252 0.000 0.140 0.608
#> SRR330869 1 0.4790 -0.266 0.620 0.000 0.000 0.380
#> SRR330870 1 0.2868 0.790 0.864 0.000 0.000 0.136
#> SRR330871 1 0.5515 0.674 0.732 0.000 0.116 0.152
#> SRR330872 4 0.6673 0.582 0.252 0.000 0.140 0.608
#> SRR330873 1 0.2868 0.790 0.864 0.000 0.000 0.136
#> SRR330874 2 0.3166 0.587 0.000 0.868 0.116 0.016
#> SRR330875 1 0.3351 0.782 0.844 0.000 0.008 0.148
#> SRR330876 1 0.2921 0.787 0.860 0.000 0.000 0.140
#> SRR330877 1 0.5751 0.650 0.712 0.000 0.124 0.164
#> SRR330878 1 0.3547 0.774 0.840 0.000 0.016 0.144
#> SRR330879 1 0.2868 0.790 0.864 0.000 0.000 0.136
#> SRR330880 4 0.6630 0.585 0.252 0.000 0.136 0.612
#> SRR330881 1 0.0672 0.809 0.984 0.000 0.008 0.008
#> SRR330882 1 0.3117 0.761 0.880 0.000 0.028 0.092
#> SRR330883 2 0.6378 0.486 0.000 0.628 0.264 0.108
#> SRR330884 4 0.4830 0.770 0.392 0.000 0.000 0.608
#> SRR330885 4 0.4624 0.805 0.340 0.000 0.000 0.660
#> SRR330886 4 0.4999 0.801 0.328 0.000 0.012 0.660
#> SRR330887 1 0.0921 0.799 0.972 0.000 0.000 0.028
#> SRR330888 1 0.0921 0.799 0.972 0.000 0.000 0.028
#> SRR330889 4 0.5593 0.668 0.212 0.000 0.080 0.708
#> SRR330890 4 0.4605 0.805 0.336 0.000 0.000 0.664
#> SRR330891 4 0.4643 0.806 0.344 0.000 0.000 0.656
#> SRR330892 2 0.2949 0.607 0.000 0.888 0.088 0.024
#> SRR330893 4 0.4643 0.806 0.344 0.000 0.000 0.656
#> SRR330894 4 0.4661 0.804 0.348 0.000 0.000 0.652
#> SRR330895 2 0.5396 0.637 0.000 0.740 0.156 0.104
#> SRR330896 4 0.4830 0.774 0.392 0.000 0.000 0.608
#> SRR330897 2 0.5396 0.640 0.000 0.740 0.156 0.104
#> SRR330898 2 0.0000 0.653 0.000 1.000 0.000 0.000
#> SRR330899 1 0.1118 0.795 0.964 0.000 0.000 0.036
#> SRR330900 1 0.1118 0.795 0.964 0.000 0.000 0.036
#> SRR330901 1 0.1118 0.795 0.964 0.000 0.000 0.036
#> SRR330902 1 0.4817 -0.281 0.612 0.000 0.000 0.388
#> SRR330903 4 0.4697 0.800 0.356 0.000 0.000 0.644
#> SRR330904 4 0.8443 -0.195 0.120 0.356 0.072 0.452
#> SRR330906 4 0.4877 0.677 0.204 0.000 0.044 0.752
#> SRR330907 1 0.0000 0.808 1.000 0.000 0.000 0.000
#> SRR330908 4 0.4697 0.800 0.356 0.000 0.000 0.644
#> SRR330909 1 0.1545 0.801 0.952 0.000 0.008 0.040
#> SRR330910 4 0.4994 0.623 0.480 0.000 0.000 0.520
#> SRR330911 4 0.4643 0.806 0.344 0.000 0.000 0.656
#> SRR330912 4 0.4605 0.805 0.336 0.000 0.000 0.664
#> SRR330913 4 0.4713 0.798 0.360 0.000 0.000 0.640
#> SRR330914 4 0.4713 0.798 0.360 0.000 0.000 0.640
#> SRR330915 1 0.1118 0.795 0.964 0.000 0.000 0.036
#> SRR330916 4 0.4643 0.806 0.344 0.000 0.000 0.656
#> SRR330917 4 0.4843 0.762 0.396 0.000 0.000 0.604
#> SRR330918 1 0.2124 0.789 0.932 0.000 0.028 0.040
#> SRR330919 1 0.1940 0.749 0.924 0.000 0.000 0.076
#> SRR330920 1 0.0817 0.801 0.976 0.000 0.000 0.024
#> SRR330921 1 0.1118 0.795 0.964 0.000 0.000 0.036
#> SRR330922 1 0.1118 0.795 0.964 0.000 0.000 0.036
#> SRR330923 1 0.0469 0.805 0.988 0.000 0.000 0.012
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> SRR330857 1 0.3365 0.735 0.808 0.000 0.004 0.180 0.008
#> SRR330858 1 0.3129 0.749 0.832 0.000 0.004 0.156 0.008
#> SRR330859 4 0.3480 0.239 0.248 0.000 0.000 0.752 0.000
#> SRR330860 3 0.1012 0.000 0.000 0.020 0.968 0.000 0.012
#> SRR330861 1 0.4262 0.487 0.560 0.000 0.000 0.440 0.000
#> SRR330862 4 0.2563 0.290 0.120 0.000 0.008 0.872 0.000
#> SRR330863 4 0.3130 0.324 0.096 0.000 0.000 0.856 0.048
#> SRR330864 4 0.2563 0.290 0.120 0.000 0.008 0.872 0.000
#> SRR330865 1 0.2929 0.742 0.820 0.000 0.000 0.180 0.000
#> SRR330866 4 0.6749 0.669 0.272 0.000 0.000 0.400 0.328
#> SRR330867 1 0.2930 0.748 0.832 0.000 0.004 0.164 0.000
#> SRR330868 4 0.2563 0.290 0.120 0.000 0.008 0.872 0.000
#> SRR330869 1 0.5941 -0.195 0.584 0.000 0.000 0.256 0.160
#> SRR330870 1 0.3010 0.744 0.824 0.000 0.004 0.172 0.000
#> SRR330871 1 0.4171 0.545 0.604 0.000 0.000 0.396 0.000
#> SRR330872 4 0.2563 0.290 0.120 0.000 0.008 0.872 0.000
#> SRR330873 1 0.3010 0.744 0.824 0.000 0.004 0.172 0.000
#> SRR330874 2 0.2796 0.532 0.000 0.868 0.116 0.008 0.008
#> SRR330875 1 0.3365 0.735 0.808 0.000 0.004 0.180 0.008
#> SRR330876 1 0.3010 0.744 0.824 0.000 0.004 0.172 0.000
#> SRR330877 1 0.4262 0.487 0.560 0.000 0.000 0.440 0.000
#> SRR330878 1 0.3305 0.710 0.776 0.000 0.000 0.224 0.000
#> SRR330879 1 0.3343 0.750 0.812 0.000 0.000 0.172 0.016
#> SRR330880 4 0.3170 0.306 0.124 0.000 0.004 0.848 0.024
#> SRR330881 1 0.1492 0.767 0.948 0.000 0.004 0.040 0.008
#> SRR330882 1 0.4496 0.627 0.756 0.000 0.020 0.036 0.188
#> SRR330883 5 0.6881 -0.700 0.000 0.364 0.184 0.016 0.436
#> SRR330884 4 0.6788 0.626 0.320 0.000 0.000 0.384 0.296
#> SRR330885 4 0.6749 0.669 0.272 0.000 0.000 0.400 0.328
#> SRR330886 4 0.6561 0.550 0.216 0.000 0.000 0.452 0.332
#> SRR330887 1 0.0992 0.750 0.968 0.000 0.000 0.008 0.024
#> SRR330888 1 0.0992 0.750 0.968 0.000 0.000 0.008 0.024
#> SRR330889 4 0.4364 0.383 0.120 0.000 0.000 0.768 0.112
#> SRR330890 4 0.6749 0.669 0.272 0.000 0.000 0.400 0.328
#> SRR330891 4 0.6749 0.669 0.272 0.000 0.000 0.400 0.328
#> SRR330892 2 0.3780 0.588 0.000 0.828 0.100 0.012 0.060
#> SRR330893 4 0.6749 0.669 0.272 0.000 0.000 0.400 0.328
#> SRR330894 4 0.6749 0.669 0.272 0.000 0.000 0.400 0.328
#> SRR330895 2 0.5708 0.528 0.000 0.528 0.088 0.000 0.384
#> SRR330896 4 0.6776 0.635 0.316 0.000 0.000 0.392 0.292
#> SRR330897 2 0.6108 0.540 0.000 0.528 0.096 0.012 0.364
#> SRR330898 2 0.1843 0.622 0.000 0.932 0.008 0.008 0.052
#> SRR330899 1 0.1195 0.746 0.960 0.000 0.000 0.012 0.028
#> SRR330900 1 0.1195 0.746 0.960 0.000 0.000 0.012 0.028
#> SRR330901 1 0.1195 0.746 0.960 0.000 0.000 0.012 0.028
#> SRR330902 1 0.6193 -0.311 0.544 0.000 0.000 0.272 0.184
#> SRR330903 4 0.6759 0.666 0.276 0.000 0.000 0.396 0.328
#> SRR330904 5 0.7774 0.181 0.068 0.216 0.012 0.220 0.484
#> SRR330906 5 0.5925 -0.420 0.104 0.000 0.000 0.424 0.472
#> SRR330907 1 0.1026 0.766 0.968 0.000 0.004 0.024 0.004
#> SRR330908 4 0.6760 0.665 0.284 0.000 0.000 0.400 0.316
#> SRR330909 1 0.1278 0.761 0.960 0.000 0.004 0.020 0.016
#> SRR330910 1 0.6744 -0.635 0.400 0.000 0.000 0.332 0.268
#> SRR330911 4 0.6749 0.669 0.272 0.000 0.000 0.400 0.328
#> SRR330912 4 0.6749 0.669 0.272 0.000 0.000 0.400 0.328
#> SRR330913 4 0.6754 0.667 0.272 0.000 0.000 0.396 0.332
#> SRR330914 4 0.6763 0.664 0.276 0.000 0.000 0.392 0.332
#> SRR330915 1 0.1195 0.746 0.960 0.000 0.000 0.012 0.028
#> SRR330916 4 0.6749 0.669 0.272 0.000 0.000 0.400 0.328
#> SRR330917 4 0.6787 0.654 0.288 0.000 0.000 0.380 0.332
#> SRR330918 1 0.2973 0.740 0.884 0.000 0.020 0.052 0.044
#> SRR330919 1 0.2574 0.649 0.876 0.000 0.000 0.012 0.112
#> SRR330920 1 0.0671 0.758 0.980 0.000 0.000 0.004 0.016
#> SRR330921 1 0.1195 0.746 0.960 0.000 0.000 0.012 0.028
#> SRR330922 1 0.1195 0.746 0.960 0.000 0.000 0.012 0.028
#> SRR330923 1 0.0451 0.763 0.988 0.000 0.004 0.008 0.000
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> SRR330857 1 0.0713 0.7398 0.972 0.000 0.000 0.028 0.000 0.000
#> SRR330858 1 0.1267 0.7566 0.940 0.000 0.000 0.060 0.000 0.000
#> SRR330859 3 0.5915 0.8058 0.264 0.000 0.468 0.268 0.000 0.000
#> SRR330860 6 0.1152 0.0000 0.000 0.044 0.000 0.000 0.004 0.952
#> SRR330861 1 0.4768 -0.0694 0.532 0.000 0.416 0.052 0.000 0.000
#> SRR330862 3 0.5351 0.9329 0.148 0.000 0.572 0.280 0.000 0.000
#> SRR330863 3 0.5727 0.8351 0.148 0.000 0.476 0.372 0.000 0.004
#> SRR330864 3 0.5351 0.9329 0.148 0.000 0.572 0.280 0.000 0.000
#> SRR330865 1 0.2119 0.7388 0.904 0.000 0.036 0.060 0.000 0.000
#> SRR330866 4 0.0260 0.8195 0.000 0.000 0.008 0.992 0.000 0.000
#> SRR330867 1 0.1524 0.7551 0.932 0.000 0.008 0.060 0.000 0.000
#> SRR330868 3 0.5351 0.9329 0.148 0.000 0.572 0.280 0.000 0.000
#> SRR330869 4 0.3747 0.0660 0.396 0.000 0.000 0.604 0.000 0.000
#> SRR330870 1 0.1524 0.7551 0.932 0.000 0.008 0.060 0.000 0.000
#> SRR330871 1 0.4609 0.1283 0.588 0.000 0.364 0.048 0.000 0.000
#> SRR330872 3 0.5351 0.9329 0.148 0.000 0.572 0.280 0.000 0.000
#> SRR330873 1 0.1524 0.7551 0.932 0.000 0.008 0.060 0.000 0.000
#> SRR330874 2 0.0767 0.7214 0.000 0.976 0.004 0.000 0.008 0.012
#> SRR330875 1 0.0713 0.7398 0.972 0.000 0.000 0.028 0.000 0.000
#> SRR330876 1 0.1807 0.7476 0.920 0.000 0.020 0.060 0.000 0.000
#> SRR330877 1 0.4660 -0.0364 0.540 0.000 0.416 0.044 0.000 0.000
#> SRR330878 1 0.2971 0.6659 0.844 0.000 0.104 0.052 0.000 0.000
#> SRR330879 1 0.2311 0.7557 0.880 0.000 0.016 0.104 0.000 0.000
#> SRR330880 3 0.5515 0.9041 0.152 0.000 0.528 0.320 0.000 0.000
#> SRR330881 1 0.2664 0.7874 0.816 0.000 0.000 0.184 0.000 0.000
#> SRR330882 1 0.6967 0.2023 0.500 0.000 0.272 0.092 0.116 0.020
#> SRR330883 5 0.4727 0.6327 0.000 0.124 0.072 0.000 0.740 0.064
#> SRR330884 4 0.1204 0.7799 0.056 0.000 0.000 0.944 0.000 0.000
#> SRR330885 4 0.0405 0.8210 0.004 0.000 0.008 0.988 0.000 0.000
#> SRR330886 4 0.2812 0.6652 0.000 0.000 0.104 0.860 0.008 0.028
#> SRR330887 1 0.3151 0.7750 0.748 0.000 0.000 0.252 0.000 0.000
#> SRR330888 1 0.3151 0.7750 0.748 0.000 0.000 0.252 0.000 0.000
#> SRR330889 4 0.5380 -0.6134 0.116 0.000 0.384 0.500 0.000 0.000
#> SRR330890 4 0.0260 0.8195 0.000 0.000 0.008 0.992 0.000 0.000
#> SRR330891 4 0.0260 0.8195 0.000 0.000 0.008 0.992 0.000 0.000
#> SRR330892 2 0.2901 0.6807 0.000 0.840 0.032 0.000 0.128 0.000
#> SRR330893 4 0.0260 0.8195 0.000 0.000 0.008 0.992 0.000 0.000
#> SRR330894 4 0.0405 0.8210 0.004 0.000 0.008 0.988 0.000 0.000
#> SRR330895 5 0.3288 0.7548 0.000 0.276 0.000 0.000 0.724 0.000
#> SRR330896 4 0.1204 0.7797 0.056 0.000 0.000 0.944 0.000 0.000
#> SRR330897 5 0.4020 0.7292 0.000 0.276 0.032 0.000 0.692 0.000
#> SRR330898 2 0.3772 0.5957 0.000 0.772 0.040 0.000 0.180 0.008
#> SRR330899 1 0.3309 0.7581 0.720 0.000 0.000 0.280 0.000 0.000
#> SRR330900 1 0.3309 0.7581 0.720 0.000 0.000 0.280 0.000 0.000
#> SRR330901 1 0.3309 0.7581 0.720 0.000 0.000 0.280 0.000 0.000
#> SRR330902 4 0.3499 0.3442 0.320 0.000 0.000 0.680 0.000 0.000
#> SRR330903 4 0.0146 0.8202 0.004 0.000 0.000 0.996 0.000 0.000
#> SRR330904 4 0.6964 -0.0378 0.000 0.116 0.068 0.480 0.308 0.028
#> SRR330906 4 0.4819 0.4310 0.000 0.000 0.080 0.704 0.188 0.028
#> SRR330907 1 0.2730 0.7875 0.808 0.000 0.000 0.192 0.000 0.000
#> SRR330908 4 0.0603 0.8161 0.016 0.000 0.004 0.980 0.000 0.000
#> SRR330909 1 0.2631 0.7816 0.820 0.000 0.000 0.180 0.000 0.000
#> SRR330910 4 0.2048 0.6988 0.120 0.000 0.000 0.880 0.000 0.000
#> SRR330911 4 0.0405 0.8210 0.004 0.000 0.008 0.988 0.000 0.000
#> SRR330912 4 0.0260 0.8195 0.000 0.000 0.008 0.992 0.000 0.000
#> SRR330913 4 0.0146 0.8202 0.004 0.000 0.000 0.996 0.000 0.000
#> SRR330914 4 0.0146 0.8202 0.004 0.000 0.000 0.996 0.000 0.000
#> SRR330915 1 0.3309 0.7581 0.720 0.000 0.000 0.280 0.000 0.000
#> SRR330916 4 0.0405 0.8210 0.004 0.000 0.008 0.988 0.000 0.000
#> SRR330917 4 0.0458 0.8133 0.016 0.000 0.000 0.984 0.000 0.000
#> SRR330918 1 0.3536 0.7458 0.828 0.000 0.036 0.104 0.028 0.004
#> SRR330919 1 0.3684 0.6243 0.628 0.000 0.000 0.372 0.000 0.000
#> SRR330920 1 0.3126 0.7769 0.752 0.000 0.000 0.248 0.000 0.000
#> SRR330921 1 0.3309 0.7581 0.720 0.000 0.000 0.280 0.000 0.000
#> SRR330922 1 0.3309 0.7581 0.720 0.000 0.000 0.280 0.000 0.000
#> SRR330923 1 0.2883 0.7857 0.788 0.000 0.000 0.212 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)
consensus_heatmap(res, k = 3)
consensus_heatmap(res, k = 4)
consensus_heatmap(res, k = 5)
consensus_heatmap(res, k = 6)
Heatmaps for the membership of samples in all partitions to see how consistent they are:
membership_heatmap(res, k = 2)
membership_heatmap(res, k = 3)
membership_heatmap(res, k = 4)
membership_heatmap(res, k = 5)
membership_heatmap(res, k = 6)
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)
get_signatures(res, k = 3)
get_signatures(res, k = 4)
get_signatures(res, k = 5)
get_signatures(res, k = 6)
Signature heatmaps where rows are not scaled:
get_signatures(res, k = 2, scale_rows = FALSE)
get_signatures(res, k = 3, scale_rows = FALSE)
get_signatures(res, k = 4, scale_rows = FALSE)
get_signatures(res, k = 5, scale_rows = FALSE)
get_signatures(res, k = 6, scale_rows = FALSE)
Compare the overlap of signatures from different k:
compare_signatures(res)
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:
which_row
: row indices corresponding to the input matrix.fdr
: FDR for the differential test. mean_x
: The mean value in group x.scaled_mean_x
: The mean value in group x after rows are scaled.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")
dimension_reduction(res, k = 3, method = "UMAP")
dimension_reduction(res, k = 4, method = "UMAP")
dimension_reduction(res, k = 5, method = "UMAP")
dimension_reduction(res, k = 6, method = "UMAP")
Following heatmap shows how subgroups are split when increasing k
:
collect_classes(res)
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.
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 10869 rows and 66 columns.
#> Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'CV' method.
#> Subgroups are detected by 'skmeans' method.
#> Performed in total 1250 partitions by row resampling.
#> Best k for subgroups seems to be 2.
#>
#> Following methods can be applied to this 'ConsensusPartition' object:
#> [1] "cola_report" "collect_classes" "collect_plots"
#> [4] "collect_stats" "colnames" "compare_signatures"
#> [7] "consensus_heatmap" "dimension_reduction" "functional_enrichment"
#> [10] "get_anno_col" "get_anno" "get_classes"
#> [13] "get_consensus" "get_matrix" "get_membership"
#> [16] "get_param" "get_signatures" "get_stats"
#> [19] "is_best_k" "is_stable_k" "membership_heatmap"
#> [22] "ncol" "nrow" "plot_ecdf"
#> [25] "rownames" "select_partition_number" "show"
#> [28] "suggest_best_k" "test_to_known_factors"
collect_plots()
function collects all the plots made from res
for all k
(number of partitions)
into one single page to provide an easy and fast comparison between different k
.
collect_plots(res)
The plots are:
k
and the heatmap of
predicted classes for each k
.k
.k
.k
.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:
k
;k
, the area increased is defined as \(A_k - A_{k-1}\).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)
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.968 0.941 0.975 0.4881 0.515 0.515
#> 3 3 0.510 0.637 0.815 0.3138 0.823 0.672
#> 4 4 0.635 0.720 0.861 0.1248 0.851 0.634
#> 5 5 0.609 0.524 0.765 0.0622 0.978 0.922
#> 6 6 0.605 0.468 0.703 0.0361 0.990 0.962
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.
cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#> class entropy silhouette p1 p2
#> SRR330857 1 0.0000 0.9703 1.000 0.000
#> SRR330858 1 0.0000 0.9703 1.000 0.000
#> SRR330859 1 0.0672 0.9643 0.992 0.008
#> SRR330860 2 0.0000 0.9773 0.000 1.000
#> SRR330861 1 0.0000 0.9703 1.000 0.000
#> SRR330862 2 0.1633 0.9711 0.024 0.976
#> SRR330863 2 0.1414 0.9725 0.020 0.980
#> SRR330864 2 0.1633 0.9711 0.024 0.976
#> SRR330865 1 0.0000 0.9703 1.000 0.000
#> SRR330866 2 0.0000 0.9773 0.000 1.000
#> SRR330867 1 0.0000 0.9703 1.000 0.000
#> SRR330868 2 0.1633 0.9711 0.024 0.976
#> SRR330869 1 0.0000 0.9703 1.000 0.000
#> SRR330870 1 0.0000 0.9703 1.000 0.000
#> SRR330871 1 0.0000 0.9703 1.000 0.000
#> SRR330872 2 0.1633 0.9711 0.024 0.976
#> SRR330873 1 0.0000 0.9703 1.000 0.000
#> SRR330874 2 0.0000 0.9773 0.000 1.000
#> SRR330875 1 0.0000 0.9703 1.000 0.000
#> SRR330876 1 0.0000 0.9703 1.000 0.000
#> SRR330877 1 0.0000 0.9703 1.000 0.000
#> SRR330878 1 0.0000 0.9703 1.000 0.000
#> SRR330879 1 0.0000 0.9703 1.000 0.000
#> SRR330880 1 0.4815 0.8713 0.896 0.104
#> SRR330881 1 0.0000 0.9703 1.000 0.000
#> SRR330882 1 0.2423 0.9415 0.960 0.040
#> SRR330883 2 0.0000 0.9773 0.000 1.000
#> SRR330884 1 0.0000 0.9703 1.000 0.000
#> SRR330885 2 0.2236 0.9632 0.036 0.964
#> SRR330886 2 0.0000 0.9773 0.000 1.000
#> SRR330887 1 0.0000 0.9703 1.000 0.000
#> SRR330888 1 0.0000 0.9703 1.000 0.000
#> SRR330889 2 0.1633 0.9711 0.024 0.976
#> SRR330890 2 0.0000 0.9773 0.000 1.000
#> SRR330891 2 0.0000 0.9773 0.000 1.000
#> SRR330892 2 0.0000 0.9773 0.000 1.000
#> SRR330893 2 0.1843 0.9658 0.028 0.972
#> SRR330894 2 0.5178 0.8803 0.116 0.884
#> SRR330895 2 0.0000 0.9773 0.000 1.000
#> SRR330896 1 0.0000 0.9703 1.000 0.000
#> SRR330897 2 0.0000 0.9773 0.000 1.000
#> SRR330898 2 0.0000 0.9773 0.000 1.000
#> SRR330899 1 0.0000 0.9703 1.000 0.000
#> SRR330900 1 0.0000 0.9703 1.000 0.000
#> SRR330901 1 0.0000 0.9703 1.000 0.000
#> SRR330902 1 0.0000 0.9703 1.000 0.000
#> SRR330903 1 0.9635 0.3627 0.612 0.388
#> SRR330904 2 0.0000 0.9773 0.000 1.000
#> SRR330906 2 0.0000 0.9773 0.000 1.000
#> SRR330907 1 0.0000 0.9703 1.000 0.000
#> SRR330908 1 0.9988 0.0474 0.520 0.480
#> SRR330909 1 0.0000 0.9703 1.000 0.000
#> SRR330910 1 0.0672 0.9646 0.992 0.008
#> SRR330911 2 0.3114 0.9440 0.056 0.944
#> SRR330912 2 0.0000 0.9773 0.000 1.000
#> SRR330913 2 0.5842 0.8469 0.140 0.860
#> SRR330914 1 0.3584 0.9139 0.932 0.068
#> SRR330915 1 0.0000 0.9703 1.000 0.000
#> SRR330916 2 0.2236 0.9608 0.036 0.964
#> SRR330917 1 0.1843 0.9491 0.972 0.028
#> SRR330918 1 0.0000 0.9703 1.000 0.000
#> SRR330919 1 0.0000 0.9703 1.000 0.000
#> SRR330920 1 0.0000 0.9703 1.000 0.000
#> SRR330921 1 0.0000 0.9703 1.000 0.000
#> SRR330922 1 0.0000 0.9703 1.000 0.000
#> SRR330923 1 0.0000 0.9703 1.000 0.000
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> SRR330857 1 0.5859 0.4107 0.656 0.000 0.344
#> SRR330858 1 0.5098 0.5567 0.752 0.000 0.248
#> SRR330859 3 0.4796 0.7278 0.220 0.000 0.780
#> SRR330860 2 0.4931 0.7660 0.000 0.768 0.232
#> SRR330861 3 0.5058 0.7010 0.244 0.000 0.756
#> SRR330862 3 0.0000 0.7860 0.000 0.000 1.000
#> SRR330863 3 0.2066 0.7190 0.000 0.060 0.940
#> SRR330864 3 0.0000 0.7860 0.000 0.000 1.000
#> SRR330865 1 0.6302 0.0216 0.520 0.000 0.480
#> SRR330866 2 0.4540 0.6930 0.124 0.848 0.028
#> SRR330867 1 0.5591 0.4803 0.696 0.000 0.304
#> SRR330868 3 0.0000 0.7860 0.000 0.000 1.000
#> SRR330869 1 0.3134 0.7416 0.916 0.052 0.032
#> SRR330870 1 0.5733 0.4469 0.676 0.000 0.324
#> SRR330871 3 0.5835 0.5136 0.340 0.000 0.660
#> SRR330872 3 0.0000 0.7860 0.000 0.000 1.000
#> SRR330873 1 0.5621 0.4739 0.692 0.000 0.308
#> SRR330874 2 0.4887 0.7688 0.000 0.772 0.228
#> SRR330875 1 0.5905 0.3942 0.648 0.000 0.352
#> SRR330876 1 0.6168 0.2485 0.588 0.000 0.412
#> SRR330877 3 0.5016 0.7061 0.240 0.000 0.760
#> SRR330878 1 0.6286 0.0827 0.536 0.000 0.464
#> SRR330879 1 0.6295 0.0534 0.528 0.000 0.472
#> SRR330880 3 0.4861 0.7540 0.180 0.012 0.808
#> SRR330881 1 0.0000 0.7688 1.000 0.000 0.000
#> SRR330882 1 0.4805 0.6349 0.812 0.176 0.012
#> SRR330883 2 0.4887 0.7688 0.000 0.772 0.228
#> SRR330884 1 0.5595 0.6006 0.756 0.228 0.016
#> SRR330885 2 0.7190 0.4505 0.036 0.608 0.356
#> SRR330886 2 0.5431 0.7221 0.000 0.716 0.284
#> SRR330887 1 0.0000 0.7688 1.000 0.000 0.000
#> SRR330888 1 0.0000 0.7688 1.000 0.000 0.000
#> SRR330889 3 0.2945 0.7551 0.004 0.088 0.908
#> SRR330890 2 0.4178 0.7668 0.000 0.828 0.172
#> SRR330891 2 0.0892 0.7341 0.000 0.980 0.020
#> SRR330892 2 0.4887 0.7688 0.000 0.772 0.228
#> SRR330893 2 0.4465 0.6588 0.176 0.820 0.004
#> SRR330894 2 0.5202 0.6285 0.220 0.772 0.008
#> SRR330895 2 0.4887 0.7688 0.000 0.772 0.228
#> SRR330896 1 0.5247 0.6106 0.768 0.224 0.008
#> SRR330897 2 0.4887 0.7688 0.000 0.772 0.228
#> SRR330898 2 0.4887 0.7688 0.000 0.772 0.228
#> SRR330899 1 0.0000 0.7688 1.000 0.000 0.000
#> SRR330900 1 0.0000 0.7688 1.000 0.000 0.000
#> SRR330901 1 0.0000 0.7688 1.000 0.000 0.000
#> SRR330902 1 0.1031 0.7597 0.976 0.024 0.000
#> SRR330903 1 0.6912 0.1308 0.540 0.444 0.016
#> SRR330904 2 0.4887 0.7688 0.000 0.772 0.228
#> SRR330906 2 0.4887 0.7688 0.000 0.772 0.228
#> SRR330907 1 0.0000 0.7688 1.000 0.000 0.000
#> SRR330908 2 0.6919 0.1306 0.448 0.536 0.016
#> SRR330909 1 0.0237 0.7671 0.996 0.000 0.004
#> SRR330910 1 0.5723 0.5841 0.744 0.240 0.016
#> SRR330911 2 0.5986 0.5962 0.240 0.736 0.024
#> SRR330912 2 0.2066 0.7464 0.000 0.940 0.060
#> SRR330913 2 0.4235 0.6556 0.176 0.824 0.000
#> SRR330914 1 0.6209 0.3614 0.628 0.368 0.004
#> SRR330915 1 0.0000 0.7688 1.000 0.000 0.000
#> SRR330916 2 0.5158 0.6118 0.232 0.764 0.004
#> SRR330917 1 0.5016 0.6039 0.760 0.240 0.000
#> SRR330918 1 0.0000 0.7688 1.000 0.000 0.000
#> SRR330919 1 0.1163 0.7574 0.972 0.028 0.000
#> SRR330920 1 0.0000 0.7688 1.000 0.000 0.000
#> SRR330921 1 0.0000 0.7688 1.000 0.000 0.000
#> SRR330922 1 0.0000 0.7688 1.000 0.000 0.000
#> SRR330923 1 0.0000 0.7688 1.000 0.000 0.000
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> SRR330857 1 0.3402 0.7730 0.832 0.000 0.164 0.004
#> SRR330858 1 0.1305 0.8456 0.960 0.000 0.036 0.004
#> SRR330859 3 0.2081 0.8538 0.084 0.000 0.916 0.000
#> SRR330860 2 0.0592 0.8590 0.000 0.984 0.016 0.000
#> SRR330861 3 0.2593 0.8398 0.104 0.000 0.892 0.004
#> SRR330862 3 0.0524 0.8777 0.000 0.004 0.988 0.008
#> SRR330863 3 0.4290 0.6783 0.000 0.212 0.772 0.016
#> SRR330864 3 0.0524 0.8777 0.000 0.004 0.988 0.008
#> SRR330865 1 0.4978 0.4349 0.612 0.000 0.384 0.004
#> SRR330866 4 0.5052 0.5457 0.000 0.244 0.036 0.720
#> SRR330867 1 0.2197 0.8297 0.916 0.000 0.080 0.004
#> SRR330868 3 0.0672 0.8759 0.000 0.008 0.984 0.008
#> SRR330869 1 0.6004 0.4599 0.648 0.000 0.076 0.276
#> SRR330870 1 0.3052 0.7952 0.860 0.000 0.136 0.004
#> SRR330871 3 0.4800 0.4261 0.340 0.000 0.656 0.004
#> SRR330872 3 0.0524 0.8777 0.000 0.004 0.988 0.008
#> SRR330873 1 0.2593 0.8171 0.892 0.000 0.104 0.004
#> SRR330874 2 0.0000 0.8690 0.000 1.000 0.000 0.000
#> SRR330875 1 0.3751 0.7450 0.800 0.000 0.196 0.004
#> SRR330876 1 0.4372 0.6499 0.728 0.000 0.268 0.004
#> SRR330877 3 0.2714 0.8332 0.112 0.000 0.884 0.004
#> SRR330878 1 0.4872 0.4971 0.640 0.000 0.356 0.004
#> SRR330879 1 0.4991 0.4404 0.608 0.000 0.388 0.004
#> SRR330880 3 0.0336 0.8765 0.000 0.000 0.992 0.008
#> SRR330881 1 0.0188 0.8539 0.996 0.000 0.000 0.004
#> SRR330882 1 0.6258 0.5013 0.648 0.284 0.028 0.040
#> SRR330883 2 0.0000 0.8690 0.000 1.000 0.000 0.000
#> SRR330884 4 0.4564 0.5478 0.328 0.000 0.000 0.672
#> SRR330885 2 0.8635 0.1457 0.048 0.440 0.212 0.300
#> SRR330886 2 0.3370 0.7927 0.000 0.872 0.048 0.080
#> SRR330887 1 0.0592 0.8539 0.984 0.000 0.000 0.016
#> SRR330888 1 0.0921 0.8519 0.972 0.000 0.000 0.028
#> SRR330889 3 0.2773 0.8268 0.000 0.028 0.900 0.072
#> SRR330890 2 0.5130 0.4658 0.000 0.652 0.016 0.332
#> SRR330891 4 0.5409 -0.0545 0.000 0.492 0.012 0.496
#> SRR330892 2 0.0000 0.8690 0.000 1.000 0.000 0.000
#> SRR330893 4 0.3448 0.6545 0.000 0.168 0.004 0.828
#> SRR330894 4 0.2918 0.6862 0.000 0.116 0.008 0.876
#> SRR330895 2 0.0000 0.8690 0.000 1.000 0.000 0.000
#> SRR330896 4 0.5244 0.4000 0.388 0.000 0.012 0.600
#> SRR330897 2 0.0000 0.8690 0.000 1.000 0.000 0.000
#> SRR330898 2 0.0000 0.8690 0.000 1.000 0.000 0.000
#> SRR330899 1 0.1022 0.8517 0.968 0.000 0.000 0.032
#> SRR330900 1 0.1637 0.8412 0.940 0.000 0.000 0.060
#> SRR330901 1 0.1022 0.8519 0.968 0.000 0.000 0.032
#> SRR330902 1 0.3172 0.7482 0.840 0.000 0.000 0.160
#> SRR330903 4 0.1356 0.7140 0.032 0.008 0.000 0.960
#> SRR330904 2 0.0336 0.8665 0.000 0.992 0.000 0.008
#> SRR330906 2 0.0336 0.8665 0.000 0.992 0.000 0.008
#> SRR330907 1 0.0188 0.8539 0.996 0.000 0.000 0.004
#> SRR330908 4 0.3943 0.7052 0.112 0.036 0.008 0.844
#> SRR330909 1 0.1022 0.8521 0.968 0.000 0.000 0.032
#> SRR330910 4 0.5706 0.3267 0.420 0.004 0.020 0.556
#> SRR330911 4 0.2413 0.7008 0.000 0.064 0.020 0.916
#> SRR330912 2 0.5217 0.3209 0.000 0.608 0.012 0.380
#> SRR330913 4 0.4303 0.6398 0.020 0.184 0.004 0.792
#> SRR330914 4 0.2238 0.7179 0.072 0.004 0.004 0.920
#> SRR330915 1 0.1022 0.8518 0.968 0.000 0.000 0.032
#> SRR330916 4 0.2053 0.7032 0.004 0.072 0.000 0.924
#> SRR330917 4 0.5076 0.6178 0.260 0.024 0.004 0.712
#> SRR330918 1 0.0376 0.8536 0.992 0.000 0.004 0.004
#> SRR330919 1 0.2408 0.8026 0.896 0.000 0.000 0.104
#> SRR330920 1 0.0707 0.8539 0.980 0.000 0.000 0.020
#> SRR330921 1 0.1022 0.8515 0.968 0.000 0.000 0.032
#> SRR330922 1 0.1211 0.8483 0.960 0.000 0.000 0.040
#> SRR330923 1 0.0469 0.8541 0.988 0.000 0.000 0.012
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> SRR330857 1 0.4747 0.67617 0.720 0.000 0.084 0.000 0.196
#> SRR330858 1 0.3876 0.69921 0.776 0.000 0.032 0.000 0.192
#> SRR330859 3 0.4619 0.71146 0.064 0.000 0.720 0.000 0.216
#> SRR330860 2 0.0404 0.77612 0.000 0.988 0.000 0.000 0.012
#> SRR330861 3 0.3970 0.72518 0.104 0.000 0.800 0.000 0.096
#> SRR330862 3 0.0609 0.79692 0.000 0.000 0.980 0.000 0.020
#> SRR330863 3 0.6221 0.48628 0.000 0.200 0.604 0.016 0.180
#> SRR330864 3 0.0579 0.79481 0.000 0.000 0.984 0.008 0.008
#> SRR330865 1 0.6380 0.40509 0.508 0.000 0.288 0.000 0.204
#> SRR330866 4 0.5204 0.29761 0.000 0.132 0.036 0.736 0.096
#> SRR330867 1 0.4269 0.69277 0.756 0.000 0.056 0.000 0.188
#> SRR330868 3 0.0486 0.79539 0.000 0.004 0.988 0.004 0.004
#> SRR330869 1 0.7174 0.06415 0.488 0.000 0.072 0.116 0.324
#> SRR330870 1 0.4670 0.67598 0.724 0.000 0.076 0.000 0.200
#> SRR330871 3 0.6220 0.33385 0.272 0.000 0.540 0.000 0.188
#> SRR330872 3 0.0404 0.79866 0.000 0.000 0.988 0.000 0.012
#> SRR330873 1 0.4298 0.69213 0.756 0.000 0.060 0.000 0.184
#> SRR330874 2 0.0451 0.77753 0.000 0.988 0.004 0.000 0.008
#> SRR330875 1 0.5327 0.64136 0.664 0.000 0.120 0.000 0.216
#> SRR330876 1 0.5902 0.57146 0.600 0.000 0.192 0.000 0.208
#> SRR330877 3 0.4269 0.71038 0.108 0.000 0.776 0.000 0.116
#> SRR330878 1 0.6287 0.43925 0.528 0.000 0.276 0.000 0.196
#> SRR330879 1 0.6506 0.34659 0.476 0.000 0.308 0.000 0.216
#> SRR330880 3 0.0510 0.79770 0.000 0.000 0.984 0.000 0.016
#> SRR330881 1 0.1341 0.73694 0.944 0.000 0.000 0.000 0.056
#> SRR330882 1 0.7725 -0.10678 0.424 0.260 0.016 0.032 0.268
#> SRR330883 2 0.0000 0.77917 0.000 1.000 0.000 0.000 0.000
#> SRR330884 4 0.7180 -0.26988 0.324 0.004 0.008 0.360 0.304
#> SRR330885 2 0.9285 -0.14467 0.048 0.284 0.164 0.256 0.248
#> SRR330886 2 0.6839 0.47835 0.000 0.564 0.060 0.128 0.248
#> SRR330887 1 0.0404 0.73112 0.988 0.000 0.000 0.000 0.012
#> SRR330888 1 0.0609 0.73166 0.980 0.000 0.000 0.000 0.020
#> SRR330889 3 0.4123 0.69592 0.000 0.028 0.816 0.084 0.072
#> SRR330890 2 0.6338 0.42558 0.000 0.572 0.016 0.264 0.148
#> SRR330891 2 0.6179 0.14830 0.000 0.460 0.008 0.428 0.104
#> SRR330892 2 0.0000 0.77917 0.000 1.000 0.000 0.000 0.000
#> SRR330893 4 0.2588 0.39959 0.000 0.048 0.000 0.892 0.060
#> SRR330894 4 0.3470 0.41163 0.016 0.044 0.020 0.868 0.052
#> SRR330895 2 0.0000 0.77917 0.000 1.000 0.000 0.000 0.000
#> SRR330896 4 0.7253 -0.20194 0.356 0.000 0.024 0.380 0.240
#> SRR330897 2 0.0000 0.77917 0.000 1.000 0.000 0.000 0.000
#> SRR330898 2 0.0000 0.77917 0.000 1.000 0.000 0.000 0.000
#> SRR330899 1 0.2304 0.69288 0.892 0.000 0.000 0.008 0.100
#> SRR330900 1 0.3132 0.66693 0.820 0.000 0.000 0.008 0.172
#> SRR330901 1 0.1410 0.71856 0.940 0.000 0.000 0.000 0.060
#> SRR330902 1 0.5039 0.41967 0.676 0.000 0.000 0.080 0.244
#> SRR330903 4 0.3971 0.36697 0.064 0.004 0.004 0.812 0.116
#> SRR330904 2 0.1549 0.76659 0.000 0.944 0.000 0.016 0.040
#> SRR330906 2 0.2036 0.75856 0.000 0.920 0.000 0.024 0.056
#> SRR330907 1 0.0963 0.73726 0.964 0.000 0.000 0.000 0.036
#> SRR330908 4 0.5199 0.31006 0.108 0.004 0.008 0.716 0.164
#> SRR330909 1 0.3639 0.66542 0.792 0.000 0.000 0.024 0.184
#> SRR330910 4 0.6996 -0.12022 0.340 0.000 0.012 0.412 0.236
#> SRR330911 4 0.3059 0.41906 0.004 0.020 0.012 0.872 0.092
#> SRR330912 2 0.6381 0.18879 0.000 0.472 0.004 0.376 0.148
#> SRR330913 5 0.7290 -0.00179 0.036 0.148 0.008 0.396 0.412
#> SRR330914 4 0.6447 -0.15163 0.116 0.008 0.008 0.512 0.356
#> SRR330915 1 0.1408 0.72364 0.948 0.000 0.000 0.008 0.044
#> SRR330916 4 0.2835 0.40720 0.004 0.016 0.000 0.868 0.112
#> SRR330917 5 0.7287 0.15345 0.312 0.020 0.000 0.312 0.356
#> SRR330918 1 0.2074 0.72823 0.896 0.000 0.000 0.000 0.104
#> SRR330919 1 0.3437 0.62506 0.832 0.000 0.000 0.048 0.120
#> SRR330920 1 0.0609 0.72879 0.980 0.000 0.000 0.000 0.020
#> SRR330921 1 0.1211 0.72837 0.960 0.000 0.000 0.016 0.024
#> SRR330922 1 0.1764 0.71404 0.928 0.000 0.000 0.008 0.064
#> SRR330923 1 0.0404 0.73272 0.988 0.000 0.000 0.000 0.012
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> SRR330857 1 0.4741 0.6139 0.624 0.000 0.044 0.000 NA 0.012
#> SRR330858 1 0.3595 0.6432 0.704 0.000 0.008 0.000 NA 0.000
#> SRR330859 3 0.6469 0.4692 0.108 0.000 0.480 0.012 NA 0.048
#> SRR330860 2 0.1180 0.7329 0.000 0.960 0.008 0.004 NA 0.004
#> SRR330861 3 0.4937 0.5830 0.124 0.000 0.676 0.004 NA 0.004
#> SRR330862 3 0.1109 0.6745 0.000 0.004 0.964 0.004 NA 0.012
#> SRR330863 3 0.7844 0.1553 0.000 0.216 0.376 0.044 NA 0.088
#> SRR330864 3 0.0260 0.6776 0.000 0.000 0.992 0.000 NA 0.000
#> SRR330865 1 0.5491 0.4934 0.524 0.000 0.144 0.000 NA 0.000
#> SRR330866 4 0.4967 0.3739 0.000 0.112 0.016 0.740 NA 0.052
#> SRR330867 1 0.3952 0.6339 0.672 0.000 0.020 0.000 NA 0.000
#> SRR330868 3 0.0551 0.6773 0.000 0.004 0.984 0.000 NA 0.008
#> SRR330869 1 0.7245 -0.1409 0.424 0.000 0.032 0.060 NA 0.328
#> SRR330870 1 0.4282 0.6227 0.656 0.000 0.040 0.000 NA 0.000
#> SRR330871 3 0.6429 0.0865 0.292 0.000 0.380 0.004 NA 0.008
#> SRR330872 3 0.1149 0.6751 0.000 0.008 0.960 0.000 NA 0.008
#> SRR330873 1 0.4147 0.6314 0.668 0.000 0.024 0.000 NA 0.004
#> SRR330874 2 0.0146 0.7414 0.000 0.996 0.000 0.000 NA 0.004
#> SRR330875 1 0.4920 0.5801 0.568 0.000 0.052 0.000 NA 0.008
#> SRR330876 1 0.5245 0.5356 0.560 0.000 0.116 0.000 NA 0.000
#> SRR330877 3 0.4999 0.5553 0.128 0.000 0.632 0.000 NA 0.000
#> SRR330878 1 0.5612 0.4722 0.520 0.000 0.172 0.000 NA 0.000
#> SRR330879 1 0.6749 0.3649 0.448 0.000 0.196 0.008 NA 0.040
#> SRR330880 3 0.1349 0.6794 0.004 0.000 0.940 0.000 NA 0.000
#> SRR330881 1 0.1556 0.6793 0.920 0.000 0.000 0.000 NA 0.000
#> SRR330882 1 0.8304 -0.1236 0.356 0.188 0.020 0.020 NA 0.180
#> SRR330883 2 0.0260 0.7412 0.000 0.992 0.000 0.000 NA 0.000
#> SRR330884 6 0.7360 0.1955 0.276 0.000 0.000 0.248 NA 0.360
#> SRR330885 2 0.9382 -0.1001 0.036 0.260 0.124 0.188 NA 0.184
#> SRR330886 2 0.7695 0.3220 0.000 0.408 0.028 0.116 NA 0.184
#> SRR330887 1 0.1151 0.6705 0.956 0.000 0.000 0.000 NA 0.012
#> SRR330888 1 0.0622 0.6697 0.980 0.000 0.000 0.000 NA 0.008
#> SRR330889 3 0.5989 0.4753 0.000 0.036 0.668 0.108 NA 0.084
#> SRR330890 2 0.7456 0.2466 0.000 0.424 0.016 0.280 NA 0.152
#> SRR330891 2 0.7439 0.0705 0.000 0.396 0.012 0.288 NA 0.204
#> SRR330892 2 0.0260 0.7404 0.000 0.992 0.000 0.000 NA 0.000
#> SRR330893 4 0.4329 0.4121 0.004 0.060 0.000 0.764 NA 0.144
#> SRR330894 4 0.4646 0.4214 0.016 0.056 0.012 0.776 NA 0.104
#> SRR330895 2 0.0000 0.7412 0.000 1.000 0.000 0.000 NA 0.000
#> SRR330896 4 0.7798 -0.1388 0.292 0.008 0.012 0.368 NA 0.196
#> SRR330897 2 0.0146 0.7408 0.000 0.996 0.000 0.000 NA 0.004
#> SRR330898 2 0.0000 0.7412 0.000 1.000 0.000 0.000 NA 0.000
#> SRR330899 1 0.2932 0.6208 0.860 0.000 0.000 0.012 NA 0.088
#> SRR330900 1 0.5252 0.4764 0.668 0.000 0.000 0.032 NA 0.184
#> SRR330901 1 0.2316 0.6389 0.904 0.000 0.000 0.016 NA 0.040
#> SRR330902 1 0.5815 0.2673 0.612 0.000 0.000 0.052 NA 0.212
#> SRR330903 4 0.5682 0.2636 0.080 0.000 0.004 0.632 NA 0.224
#> SRR330904 2 0.2683 0.7144 0.000 0.888 0.004 0.020 NA 0.044
#> SRR330906 2 0.4086 0.6704 0.000 0.788 0.004 0.024 NA 0.068
#> SRR330907 1 0.1152 0.6777 0.952 0.000 0.000 0.000 NA 0.004
#> SRR330908 4 0.6955 0.1459 0.100 0.008 0.004 0.492 NA 0.280
#> SRR330909 1 0.5348 0.5010 0.664 0.000 0.004 0.028 NA 0.116
#> SRR330910 4 0.7647 -0.1474 0.280 0.000 0.016 0.384 NA 0.192
#> SRR330911 4 0.3749 0.4410 0.008 0.016 0.016 0.832 NA 0.080
#> SRR330912 2 0.7506 0.1261 0.000 0.400 0.016 0.208 NA 0.276
#> SRR330913 6 0.6541 0.1765 0.032 0.136 0.004 0.216 NA 0.576
#> SRR330914 6 0.6389 0.2349 0.112 0.008 0.004 0.308 NA 0.524
#> SRR330915 1 0.2036 0.6485 0.912 0.000 0.000 0.008 NA 0.064
#> SRR330916 4 0.5554 0.3483 0.008 0.032 0.004 0.648 NA 0.224
#> SRR330917 6 0.6344 0.3670 0.240 0.012 0.000 0.144 NA 0.560
#> SRR330918 1 0.3494 0.6462 0.792 0.000 0.000 0.004 NA 0.036
#> SRR330919 1 0.5050 0.4112 0.712 0.000 0.000 0.076 NA 0.136
#> SRR330920 1 0.0725 0.6699 0.976 0.000 0.000 0.000 NA 0.012
#> SRR330921 1 0.2187 0.6484 0.912 0.000 0.000 0.024 NA 0.040
#> SRR330922 1 0.2649 0.6317 0.880 0.000 0.000 0.016 NA 0.076
#> SRR330923 1 0.0725 0.6724 0.976 0.000 0.000 0.000 NA 0.012
Heatmaps for the consensus matrix. It visualizes the probability of two samples to be in a same group.
consensus_heatmap(res, k = 2)
consensus_heatmap(res, k = 3)
consensus_heatmap(res, k = 4)
consensus_heatmap(res, k = 5)
consensus_heatmap(res, k = 6)
Heatmaps for the membership of samples in all partitions to see how consistent they are:
membership_heatmap(res, k = 2)
membership_heatmap(res, k = 3)
membership_heatmap(res, k = 4)
membership_heatmap(res, k = 5)
membership_heatmap(res, k = 6)
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)
get_signatures(res, k = 3)
get_signatures(res, k = 4)
get_signatures(res, k = 5)
get_signatures(res, k = 6)
Signature heatmaps where rows are not scaled:
get_signatures(res, k = 2, scale_rows = FALSE)
get_signatures(res, k = 3, scale_rows = FALSE)
get_signatures(res, k = 4, scale_rows = FALSE)
#> Error in mat[ceiling(1:nr/h_ratio), ceiling(1:nc/w_ratio), drop = FALSE]: subscript out of bounds
get_signatures(res, k = 5, scale_rows = FALSE)
get_signatures(res, k = 6, scale_rows = FALSE)
Compare the overlap of signatures from different k:
compare_signatures(res)
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:
which_row
: row indices corresponding to the input matrix.fdr
: FDR for the differential test. mean_x
: The mean value in group x.scaled_mean_x
: The mean value in group x after rows are scaled.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")
dimension_reduction(res, k = 3, method = "UMAP")
dimension_reduction(res, k = 4, method = "UMAP")
dimension_reduction(res, k = 5, method = "UMAP")
dimension_reduction(res, k = 6, method = "UMAP")
Following heatmap shows how subgroups are split when increasing k
:
collect_classes(res)
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.
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 10869 rows and 66 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)
The plots are:
k
and the heatmap of
predicted classes for each k
.k
.k
.k
.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:
k
;k
, the area increased is defined as \(A_k - A_{k-1}\).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)
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.538 0.864 0.926 0.1389 0.912 0.912
#> 3 3 0.510 0.788 0.896 0.4169 0.999 0.999
#> 4 4 0.508 0.795 0.894 0.0877 1.000 0.999
#> 5 5 0.520 0.774 0.829 0.4792 0.622 0.585
#> 6 6 0.476 0.759 0.764 0.2430 0.783 0.633
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.
cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#> class entropy silhouette p1 p2
#> SRR330857 1 0.671 0.814 0.824 0.176
#> SRR330858 1 0.671 0.814 0.824 0.176
#> SRR330859 1 0.671 0.814 0.824 0.176
#> SRR330860 1 0.615 0.830 0.848 0.152
#> SRR330861 1 0.671 0.814 0.824 0.176
#> SRR330862 1 0.671 0.814 0.824 0.176
#> SRR330863 1 0.584 0.837 0.860 0.140
#> SRR330864 1 0.671 0.814 0.824 0.176
#> SRR330865 1 0.671 0.814 0.824 0.176
#> SRR330866 1 0.000 0.905 1.000 0.000
#> SRR330867 1 0.671 0.814 0.824 0.176
#> SRR330868 1 0.671 0.814 0.824 0.176
#> SRR330869 1 0.000 0.905 1.000 0.000
#> SRR330870 1 0.671 0.814 0.824 0.176
#> SRR330871 1 0.671 0.814 0.824 0.176
#> SRR330872 1 0.671 0.814 0.824 0.176
#> SRR330873 1 0.671 0.814 0.824 0.176
#> SRR330874 2 0.634 0.666 0.160 0.840
#> SRR330875 1 0.671 0.814 0.824 0.176
#> SRR330876 1 0.671 0.814 0.824 0.176
#> SRR330877 1 0.671 0.814 0.824 0.176
#> SRR330878 1 0.671 0.814 0.824 0.176
#> SRR330879 1 0.595 0.835 0.856 0.144
#> SRR330880 1 0.671 0.814 0.824 0.176
#> SRR330881 1 0.260 0.886 0.956 0.044
#> SRR330882 1 0.000 0.905 1.000 0.000
#> SRR330883 1 0.242 0.862 0.960 0.040
#> SRR330884 1 0.000 0.905 1.000 0.000
#> SRR330885 1 0.000 0.905 1.000 0.000
#> SRR330886 1 0.000 0.905 1.000 0.000
#> SRR330887 1 0.000 0.905 1.000 0.000
#> SRR330888 1 0.000 0.905 1.000 0.000
#> SRR330889 1 0.584 0.837 0.860 0.140
#> SRR330890 1 0.000 0.905 1.000 0.000
#> SRR330891 1 0.000 0.905 1.000 0.000
#> SRR330892 2 0.993 0.666 0.452 0.548
#> SRR330893 1 0.000 0.905 1.000 0.000
#> SRR330894 1 0.000 0.905 1.000 0.000
#> SRR330895 1 0.000 0.905 1.000 0.000
#> SRR330896 1 0.000 0.905 1.000 0.000
#> SRR330897 1 0.000 0.905 1.000 0.000
#> SRR330898 2 0.985 0.701 0.428 0.572
#> SRR330899 1 0.000 0.905 1.000 0.000
#> SRR330900 1 0.000 0.905 1.000 0.000
#> SRR330901 1 0.000 0.905 1.000 0.000
#> SRR330902 1 0.000 0.905 1.000 0.000
#> SRR330903 1 0.000 0.905 1.000 0.000
#> SRR330904 1 0.242 0.862 0.960 0.040
#> SRR330906 1 0.000 0.905 1.000 0.000
#> SRR330907 1 0.000 0.905 1.000 0.000
#> SRR330908 1 0.000 0.905 1.000 0.000
#> SRR330909 1 0.000 0.905 1.000 0.000
#> SRR330910 1 0.000 0.905 1.000 0.000
#> SRR330911 1 0.000 0.905 1.000 0.000
#> SRR330912 1 0.000 0.905 1.000 0.000
#> SRR330913 1 0.000 0.905 1.000 0.000
#> SRR330914 1 0.000 0.905 1.000 0.000
#> SRR330915 1 0.000 0.905 1.000 0.000
#> SRR330916 1 0.000 0.905 1.000 0.000
#> SRR330917 1 0.000 0.905 1.000 0.000
#> SRR330918 1 0.000 0.905 1.000 0.000
#> SRR330919 1 0.000 0.905 1.000 0.000
#> SRR330920 1 0.000 0.905 1.000 0.000
#> SRR330921 1 0.000 0.905 1.000 0.000
#> SRR330922 1 0.000 0.905 1.000 0.000
#> SRR330923 1 0.000 0.905 1.000 0.000
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> SRR330857 1 0.543 0.7444 0.716 0.000 0.284
#> SRR330858 1 0.543 0.7444 0.716 0.000 0.284
#> SRR330859 1 0.543 0.7444 0.716 0.000 0.284
#> SRR330860 1 0.455 0.7886 0.800 0.000 0.200
#> SRR330861 1 0.543 0.7444 0.716 0.000 0.284
#> SRR330862 1 0.543 0.7444 0.716 0.000 0.284
#> SRR330863 1 0.445 0.7934 0.808 0.000 0.192
#> SRR330864 1 0.543 0.7444 0.716 0.000 0.284
#> SRR330865 1 0.543 0.7444 0.716 0.000 0.284
#> SRR330866 1 0.000 0.8717 1.000 0.000 0.000
#> SRR330867 1 0.540 0.7469 0.720 0.000 0.280
#> SRR330868 1 0.543 0.7444 0.716 0.000 0.284
#> SRR330869 1 0.000 0.8717 1.000 0.000 0.000
#> SRR330870 1 0.543 0.7444 0.716 0.000 0.284
#> SRR330871 1 0.543 0.7444 0.716 0.000 0.284
#> SRR330872 1 0.543 0.7444 0.716 0.000 0.284
#> SRR330873 1 0.543 0.7444 0.716 0.000 0.284
#> SRR330874 2 0.254 -0.0199 0.000 0.920 0.080
#> SRR330875 1 0.543 0.7444 0.716 0.000 0.284
#> SRR330876 1 0.543 0.7444 0.716 0.000 0.284
#> SRR330877 1 0.543 0.7444 0.716 0.000 0.284
#> SRR330878 1 0.543 0.7444 0.716 0.000 0.284
#> SRR330879 1 0.455 0.7896 0.800 0.000 0.200
#> SRR330880 1 0.543 0.7444 0.716 0.000 0.284
#> SRR330881 1 0.355 0.8241 0.868 0.000 0.132
#> SRR330882 1 0.103 0.8648 0.976 0.000 0.024
#> SRR330883 1 0.103 0.8618 0.976 0.024 0.000
#> SRR330884 1 0.000 0.8717 1.000 0.000 0.000
#> SRR330885 1 0.000 0.8717 1.000 0.000 0.000
#> SRR330886 1 0.000 0.8717 1.000 0.000 0.000
#> SRR330887 1 0.000 0.8717 1.000 0.000 0.000
#> SRR330888 1 0.000 0.8717 1.000 0.000 0.000
#> SRR330889 1 0.429 0.7991 0.820 0.000 0.180
#> SRR330890 1 0.000 0.8717 1.000 0.000 0.000
#> SRR330891 1 0.000 0.8717 1.000 0.000 0.000
#> SRR330892 2 0.581 -0.1546 0.264 0.724 0.012
#> SRR330893 1 0.000 0.8717 1.000 0.000 0.000
#> SRR330894 1 0.000 0.8717 1.000 0.000 0.000
#> SRR330895 1 0.000 0.8717 1.000 0.000 0.000
#> SRR330896 1 0.000 0.8717 1.000 0.000 0.000
#> SRR330897 1 0.000 0.8717 1.000 0.000 0.000
#> SRR330898 3 0.684 0.0000 0.240 0.056 0.704
#> SRR330899 1 0.000 0.8717 1.000 0.000 0.000
#> SRR330900 1 0.000 0.8717 1.000 0.000 0.000
#> SRR330901 1 0.000 0.8717 1.000 0.000 0.000
#> SRR330902 1 0.000 0.8717 1.000 0.000 0.000
#> SRR330903 1 0.000 0.8717 1.000 0.000 0.000
#> SRR330904 1 0.103 0.8618 0.976 0.024 0.000
#> SRR330906 1 0.000 0.8717 1.000 0.000 0.000
#> SRR330907 1 0.196 0.8539 0.944 0.000 0.056
#> SRR330908 1 0.000 0.8717 1.000 0.000 0.000
#> SRR330909 1 0.000 0.8717 1.000 0.000 0.000
#> SRR330910 1 0.000 0.8717 1.000 0.000 0.000
#> SRR330911 1 0.000 0.8717 1.000 0.000 0.000
#> SRR330912 1 0.000 0.8717 1.000 0.000 0.000
#> SRR330913 1 0.000 0.8717 1.000 0.000 0.000
#> SRR330914 1 0.000 0.8717 1.000 0.000 0.000
#> SRR330915 1 0.000 0.8717 1.000 0.000 0.000
#> SRR330916 1 0.000 0.8717 1.000 0.000 0.000
#> SRR330917 1 0.000 0.8717 1.000 0.000 0.000
#> SRR330918 1 0.153 0.8589 0.960 0.000 0.040
#> SRR330919 1 0.000 0.8717 1.000 0.000 0.000
#> SRR330920 1 0.000 0.8717 1.000 0.000 0.000
#> SRR330921 1 0.000 0.8717 1.000 0.000 0.000
#> SRR330922 1 0.000 0.8717 1.000 0.000 0.000
#> SRR330923 1 0.153 0.8589 0.960 0.000 0.040
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> SRR330857 1 0.4431 0.746 0.696 0.304 0.000 0.000
#> SRR330858 1 0.4431 0.746 0.696 0.304 0.000 0.000
#> SRR330859 1 0.4431 0.746 0.696 0.304 0.000 0.000
#> SRR330860 1 0.3726 0.793 0.788 0.212 0.000 0.000
#> SRR330861 1 0.4431 0.746 0.696 0.304 0.000 0.000
#> SRR330862 1 0.4431 0.746 0.696 0.304 0.000 0.000
#> SRR330863 1 0.3764 0.792 0.784 0.216 0.000 0.000
#> SRR330864 1 0.4431 0.746 0.696 0.304 0.000 0.000
#> SRR330865 1 0.4431 0.746 0.696 0.304 0.000 0.000
#> SRR330866 1 0.0000 0.877 1.000 0.000 0.000 0.000
#> SRR330867 1 0.4406 0.748 0.700 0.300 0.000 0.000
#> SRR330868 1 0.4431 0.746 0.696 0.304 0.000 0.000
#> SRR330869 1 0.0000 0.877 1.000 0.000 0.000 0.000
#> SRR330870 1 0.4431 0.746 0.696 0.304 0.000 0.000
#> SRR330871 1 0.4431 0.746 0.696 0.304 0.000 0.000
#> SRR330872 1 0.4431 0.746 0.696 0.304 0.000 0.000
#> SRR330873 1 0.4431 0.746 0.696 0.304 0.000 0.000
#> SRR330874 2 0.5902 0.000 0.000 0.696 0.120 0.184
#> SRR330875 1 0.4431 0.746 0.696 0.304 0.000 0.000
#> SRR330876 1 0.4431 0.746 0.696 0.304 0.000 0.000
#> SRR330877 1 0.4431 0.746 0.696 0.304 0.000 0.000
#> SRR330878 1 0.4431 0.746 0.696 0.304 0.000 0.000
#> SRR330879 1 0.3837 0.788 0.776 0.224 0.000 0.000
#> SRR330880 1 0.4431 0.746 0.696 0.304 0.000 0.000
#> SRR330881 1 0.2973 0.826 0.856 0.144 0.000 0.000
#> SRR330882 1 0.0707 0.871 0.980 0.020 0.000 0.000
#> SRR330883 1 0.0000 0.877 1.000 0.000 0.000 0.000
#> SRR330884 1 0.0000 0.877 1.000 0.000 0.000 0.000
#> SRR330885 1 0.0000 0.877 1.000 0.000 0.000 0.000
#> SRR330886 1 0.0000 0.877 1.000 0.000 0.000 0.000
#> SRR330887 1 0.0000 0.877 1.000 0.000 0.000 0.000
#> SRR330888 1 0.0000 0.877 1.000 0.000 0.000 0.000
#> SRR330889 1 0.3528 0.803 0.808 0.192 0.000 0.000
#> SRR330890 1 0.0000 0.877 1.000 0.000 0.000 0.000
#> SRR330891 1 0.0000 0.877 1.000 0.000 0.000 0.000
#> SRR330892 4 0.1022 0.000 0.032 0.000 0.000 0.968
#> SRR330893 1 0.0000 0.877 1.000 0.000 0.000 0.000
#> SRR330894 1 0.0000 0.877 1.000 0.000 0.000 0.000
#> SRR330895 1 0.0000 0.877 1.000 0.000 0.000 0.000
#> SRR330896 1 0.0000 0.877 1.000 0.000 0.000 0.000
#> SRR330897 1 0.0000 0.877 1.000 0.000 0.000 0.000
#> SRR330898 3 0.2589 0.000 0.116 0.000 0.884 0.000
#> SRR330899 1 0.0000 0.877 1.000 0.000 0.000 0.000
#> SRR330900 1 0.0000 0.877 1.000 0.000 0.000 0.000
#> SRR330901 1 0.0000 0.877 1.000 0.000 0.000 0.000
#> SRR330902 1 0.0000 0.877 1.000 0.000 0.000 0.000
#> SRR330903 1 0.0000 0.877 1.000 0.000 0.000 0.000
#> SRR330904 1 0.0000 0.877 1.000 0.000 0.000 0.000
#> SRR330906 1 0.0000 0.877 1.000 0.000 0.000 0.000
#> SRR330907 1 0.1557 0.859 0.944 0.056 0.000 0.000
#> SRR330908 1 0.0000 0.877 1.000 0.000 0.000 0.000
#> SRR330909 1 0.0000 0.877 1.000 0.000 0.000 0.000
#> SRR330910 1 0.0000 0.877 1.000 0.000 0.000 0.000
#> SRR330911 1 0.0000 0.877 1.000 0.000 0.000 0.000
#> SRR330912 1 0.0000 0.877 1.000 0.000 0.000 0.000
#> SRR330913 1 0.0000 0.877 1.000 0.000 0.000 0.000
#> SRR330914 1 0.0000 0.877 1.000 0.000 0.000 0.000
#> SRR330915 1 0.0000 0.877 1.000 0.000 0.000 0.000
#> SRR330916 1 0.0000 0.877 1.000 0.000 0.000 0.000
#> SRR330917 1 0.0000 0.877 1.000 0.000 0.000 0.000
#> SRR330918 1 0.1118 0.865 0.964 0.036 0.000 0.000
#> SRR330919 1 0.0000 0.877 1.000 0.000 0.000 0.000
#> SRR330920 1 0.0000 0.877 1.000 0.000 0.000 0.000
#> SRR330921 1 0.0000 0.877 1.000 0.000 0.000 0.000
#> SRR330922 1 0.0000 0.877 1.000 0.000 0.000 0.000
#> SRR330923 1 0.1118 0.865 0.964 0.036 0.000 0.000
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> SRR330857 1 0.431 0.9995 0.508 0 0 0.492 0.00
#> SRR330858 1 0.431 0.9995 0.508 0 0 0.492 0.00
#> SRR330859 1 0.431 0.9995 0.508 0 0 0.492 0.00
#> SRR330860 4 0.380 -0.0268 0.300 0 0 0.700 0.00
#> SRR330861 1 0.431 0.9995 0.508 0 0 0.492 0.00
#> SRR330862 1 0.431 0.9995 0.508 0 0 0.492 0.00
#> SRR330863 4 0.382 -0.2761 0.304 0 0 0.696 0.00
#> SRR330864 1 0.431 0.9995 0.508 0 0 0.492 0.00
#> SRR330865 1 0.431 0.9995 0.508 0 0 0.492 0.00
#> SRR330866 4 0.000 0.8893 0.000 0 0 1.000 0.00
#> SRR330867 1 0.431 0.9908 0.504 0 0 0.496 0.00
#> SRR330868 1 0.431 0.9995 0.508 0 0 0.492 0.00
#> SRR330869 4 0.000 0.8893 0.000 0 0 1.000 0.00
#> SRR330870 1 0.431 0.9995 0.508 0 0 0.492 0.00
#> SRR330871 1 0.431 0.9995 0.508 0 0 0.492 0.00
#> SRR330872 1 0.431 0.9995 0.508 0 0 0.492 0.00
#> SRR330873 1 0.431 0.9995 0.508 0 0 0.492 0.00
#> SRR330874 5 0.426 0.0000 0.440 0 0 0.000 0.56
#> SRR330875 1 0.431 0.9995 0.508 0 0 0.492 0.00
#> SRR330876 1 0.431 0.9995 0.508 0 0 0.492 0.00
#> SRR330877 1 0.431 0.9995 0.508 0 0 0.492 0.00
#> SRR330878 1 0.431 0.9995 0.508 0 0 0.492 0.00
#> SRR330879 4 0.359 -0.0138 0.264 0 0 0.736 0.00
#> SRR330880 1 0.431 0.9995 0.508 0 0 0.492 0.00
#> SRR330881 4 0.397 -0.4229 0.336 0 0 0.664 0.00
#> SRR330882 4 0.120 0.8106 0.048 0 0 0.952 0.00
#> SRR330883 4 0.426 0.0741 0.000 0 0 0.560 0.44
#> SRR330884 4 0.000 0.8893 0.000 0 0 1.000 0.00
#> SRR330885 4 0.000 0.8893 0.000 0 0 1.000 0.00
#> SRR330886 4 0.000 0.8893 0.000 0 0 1.000 0.00
#> SRR330887 4 0.000 0.8893 0.000 0 0 1.000 0.00
#> SRR330888 4 0.000 0.8893 0.000 0 0 1.000 0.00
#> SRR330889 4 0.324 0.2829 0.216 0 0 0.784 0.00
#> SRR330890 4 0.000 0.8893 0.000 0 0 1.000 0.00
#> SRR330891 4 0.000 0.8893 0.000 0 0 1.000 0.00
#> SRR330892 2 0.000 0.0000 0.000 1 0 0.000 0.00
#> SRR330893 4 0.000 0.8893 0.000 0 0 1.000 0.00
#> SRR330894 4 0.000 0.8893 0.000 0 0 1.000 0.00
#> SRR330895 4 0.000 0.8893 0.000 0 0 1.000 0.00
#> SRR330896 4 0.000 0.8893 0.000 0 0 1.000 0.00
#> SRR330897 4 0.000 0.8893 0.000 0 0 1.000 0.00
#> SRR330898 3 0.000 0.0000 0.000 0 1 0.000 0.00
#> SRR330899 4 0.000 0.8893 0.000 0 0 1.000 0.00
#> SRR330900 4 0.000 0.8893 0.000 0 0 1.000 0.00
#> SRR330901 4 0.000 0.8893 0.000 0 0 1.000 0.00
#> SRR330902 4 0.000 0.8893 0.000 0 0 1.000 0.00
#> SRR330903 4 0.000 0.8893 0.000 0 0 1.000 0.00
#> SRR330904 4 0.000 0.8893 0.000 0 0 1.000 0.00
#> SRR330906 4 0.000 0.8893 0.000 0 0 1.000 0.00
#> SRR330907 4 0.304 0.4150 0.192 0 0 0.808 0.00
#> SRR330908 4 0.000 0.8893 0.000 0 0 1.000 0.00
#> SRR330909 4 0.000 0.8893 0.000 0 0 1.000 0.00
#> SRR330910 4 0.000 0.8893 0.000 0 0 1.000 0.00
#> SRR330911 4 0.000 0.8893 0.000 0 0 1.000 0.00
#> SRR330912 4 0.000 0.8893 0.000 0 0 1.000 0.00
#> SRR330913 4 0.000 0.8893 0.000 0 0 1.000 0.00
#> SRR330914 4 0.000 0.8893 0.000 0 0 1.000 0.00
#> SRR330915 4 0.000 0.8893 0.000 0 0 1.000 0.00
#> SRR330916 4 0.000 0.8893 0.000 0 0 1.000 0.00
#> SRR330917 4 0.000 0.8893 0.000 0 0 1.000 0.00
#> SRR330918 4 0.265 0.5584 0.152 0 0 0.848 0.00
#> SRR330919 4 0.000 0.8893 0.000 0 0 1.000 0.00
#> SRR330920 4 0.000 0.8893 0.000 0 0 1.000 0.00
#> SRR330921 4 0.000 0.8893 0.000 0 0 1.000 0.00
#> SRR330922 4 0.000 0.8893 0.000 0 0 1.000 0.00
#> SRR330923 4 0.265 0.5584 0.152 0 0 0.848 0.00
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> SRR330857 1 0.0000 0.837 1.000 0 0 0.000 0.000 0.000
#> SRR330858 1 0.0000 0.837 1.000 0 0 0.000 0.000 0.000
#> SRR330859 1 0.0000 0.837 1.000 0 0 0.000 0.000 0.000
#> SRR330860 6 0.5077 -0.326 0.092 0 0 0.344 0.000 0.564
#> SRR330861 1 0.0000 0.837 1.000 0 0 0.000 0.000 0.000
#> SRR330862 1 0.0000 0.837 1.000 0 0 0.000 0.000 0.000
#> SRR330863 1 0.3499 0.160 0.680 0 0 0.320 0.000 0.000
#> SRR330864 1 0.0000 0.837 1.000 0 0 0.000 0.000 0.000
#> SRR330865 1 0.0000 0.837 1.000 0 0 0.000 0.000 0.000
#> SRR330866 4 0.3607 0.997 0.348 0 0 0.652 0.000 0.000
#> SRR330867 1 0.0146 0.834 0.996 0 0 0.004 0.000 0.000
#> SRR330868 1 0.0000 0.837 1.000 0 0 0.000 0.000 0.000
#> SRR330869 4 0.3607 0.997 0.348 0 0 0.652 0.000 0.000
#> SRR330870 1 0.0000 0.837 1.000 0 0 0.000 0.000 0.000
#> SRR330871 1 0.0000 0.837 1.000 0 0 0.000 0.000 0.000
#> SRR330872 1 0.0000 0.837 1.000 0 0 0.000 0.000 0.000
#> SRR330873 1 0.0000 0.837 1.000 0 0 0.000 0.000 0.000
#> SRR330874 6 0.5918 -0.457 0.000 0 0 0.348 0.216 0.436
#> SRR330875 1 0.0000 0.837 1.000 0 0 0.000 0.000 0.000
#> SRR330876 1 0.0000 0.837 1.000 0 0 0.000 0.000 0.000
#> SRR330877 1 0.0000 0.837 1.000 0 0 0.000 0.000 0.000
#> SRR330878 1 0.0000 0.837 1.000 0 0 0.000 0.000 0.000
#> SRR330879 1 0.3695 -0.127 0.624 0 0 0.376 0.000 0.000
#> SRR330880 1 0.0000 0.837 1.000 0 0 0.000 0.000 0.000
#> SRR330881 1 0.2562 0.606 0.828 0 0 0.172 0.000 0.000
#> SRR330882 4 0.3774 0.873 0.408 0 0 0.592 0.000 0.000
#> SRR330883 5 0.2912 0.000 0.000 0 0 0.216 0.784 0.000
#> SRR330884 4 0.3607 0.997 0.348 0 0 0.652 0.000 0.000
#> SRR330885 4 0.3607 0.997 0.348 0 0 0.652 0.000 0.000
#> SRR330886 4 0.3607 0.997 0.348 0 0 0.652 0.000 0.000
#> SRR330887 4 0.3607 0.997 0.348 0 0 0.652 0.000 0.000
#> SRR330888 4 0.3607 0.997 0.348 0 0 0.652 0.000 0.000
#> SRR330889 1 0.3817 -0.385 0.568 0 0 0.432 0.000 0.000
#> SRR330890 4 0.3607 0.997 0.348 0 0 0.652 0.000 0.000
#> SRR330891 4 0.3607 0.997 0.348 0 0 0.652 0.000 0.000
#> SRR330892 2 0.0000 0.000 0.000 1 0 0.000 0.000 0.000
#> SRR330893 4 0.3607 0.997 0.348 0 0 0.652 0.000 0.000
#> SRR330894 4 0.3607 0.997 0.348 0 0 0.652 0.000 0.000
#> SRR330895 4 0.3607 0.997 0.348 0 0 0.652 0.000 0.000
#> SRR330896 4 0.3607 0.997 0.348 0 0 0.652 0.000 0.000
#> SRR330897 4 0.3607 0.997 0.348 0 0 0.652 0.000 0.000
#> SRR330898 3 0.0000 0.000 0.000 0 1 0.000 0.000 0.000
#> SRR330899 4 0.3607 0.997 0.348 0 0 0.652 0.000 0.000
#> SRR330900 4 0.3607 0.997 0.348 0 0 0.652 0.000 0.000
#> SRR330901 4 0.3607 0.997 0.348 0 0 0.652 0.000 0.000
#> SRR330902 4 0.3607 0.997 0.348 0 0 0.652 0.000 0.000
#> SRR330903 4 0.3607 0.997 0.348 0 0 0.652 0.000 0.000
#> SRR330904 4 0.3607 0.997 0.348 0 0 0.652 0.000 0.000
#> SRR330906 4 0.3607 0.997 0.348 0 0 0.652 0.000 0.000
#> SRR330907 1 0.3515 0.159 0.676 0 0 0.324 0.000 0.000
#> SRR330908 4 0.3607 0.997 0.348 0 0 0.652 0.000 0.000
#> SRR330909 4 0.3607 0.997 0.348 0 0 0.652 0.000 0.000
#> SRR330910 4 0.3607 0.997 0.348 0 0 0.652 0.000 0.000
#> SRR330911 4 0.3607 0.997 0.348 0 0 0.652 0.000 0.000
#> SRR330912 4 0.3607 0.997 0.348 0 0 0.652 0.000 0.000
#> SRR330913 4 0.3607 0.997 0.348 0 0 0.652 0.000 0.000
#> SRR330914 4 0.3607 0.997 0.348 0 0 0.652 0.000 0.000
#> SRR330915 4 0.3607 0.997 0.348 0 0 0.652 0.000 0.000
#> SRR330916 4 0.3607 0.997 0.348 0 0 0.652 0.000 0.000
#> SRR330917 4 0.3607 0.997 0.348 0 0 0.652 0.000 0.000
#> SRR330918 1 0.3727 -0.164 0.612 0 0 0.388 0.000 0.000
#> SRR330919 4 0.3607 0.997 0.348 0 0 0.652 0.000 0.000
#> SRR330920 4 0.3607 0.997 0.348 0 0 0.652 0.000 0.000
#> SRR330921 4 0.3607 0.997 0.348 0 0 0.652 0.000 0.000
#> SRR330922 4 0.3607 0.997 0.348 0 0 0.652 0.000 0.000
#> SRR330923 1 0.3727 -0.164 0.612 0 0 0.388 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)
consensus_heatmap(res, k = 3)
consensus_heatmap(res, k = 4)
consensus_heatmap(res, k = 5)
consensus_heatmap(res, k = 6)
Heatmaps for the membership of samples in all partitions to see how consistent they are:
membership_heatmap(res, k = 2)
membership_heatmap(res, k = 3)
membership_heatmap(res, k = 4)
membership_heatmap(res, k = 5)
membership_heatmap(res, k = 6)
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)
get_signatures(res, k = 3)
get_signatures(res, k = 4)
get_signatures(res, k = 5)
get_signatures(res, k = 6)
Signature heatmaps where rows are not scaled:
get_signatures(res, k = 2, scale_rows = FALSE)
#> Error in mat[ceiling(1:nr/h_ratio), ceiling(1:nc/w_ratio), drop = FALSE]: subscript out of bounds
get_signatures(res, k = 3, scale_rows = FALSE)
get_signatures(res, k = 4, scale_rows = FALSE)
get_signatures(res, k = 5, scale_rows = FALSE)
get_signatures(res, k = 6, scale_rows = FALSE)
Compare the overlap of signatures from different k:
compare_signatures(res)
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:
which_row
: row indices corresponding to the input matrix.fdr
: FDR for the differential test. mean_x
: The mean value in group x.scaled_mean_x
: The mean value in group x after rows are scaled.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")
dimension_reduction(res, k = 3, method = "UMAP")
dimension_reduction(res, k = 4, method = "UMAP")
dimension_reduction(res, k = 5, method = "UMAP")
dimension_reduction(res, k = 6, method = "UMAP")
Following heatmap shows how subgroups are split when increasing k
:
collect_classes(res)
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.
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 10869 rows and 66 columns.
#> Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'CV' method.
#> Subgroups are detected by 'mclust' method.
#> Performed in total 1250 partitions by row resampling.
#> Best k for subgroups seems to be 2.
#>
#> Following methods can be applied to this 'ConsensusPartition' object:
#> [1] "cola_report" "collect_classes" "collect_plots"
#> [4] "collect_stats" "colnames" "compare_signatures"
#> [7] "consensus_heatmap" "dimension_reduction" "functional_enrichment"
#> [10] "get_anno_col" "get_anno" "get_classes"
#> [13] "get_consensus" "get_matrix" "get_membership"
#> [16] "get_param" "get_signatures" "get_stats"
#> [19] "is_best_k" "is_stable_k" "membership_heatmap"
#> [22] "ncol" "nrow" "plot_ecdf"
#> [25] "rownames" "select_partition_number" "show"
#> [28] "suggest_best_k" "test_to_known_factors"
collect_plots()
function collects all the plots made from res
for all k
(number of partitions)
into one single page to provide an easy and fast comparison between different k
.
collect_plots(res)
The plots are:
k
and the heatmap of
predicted classes for each k
.k
.k
.k
.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:
k
;k
, the area increased is defined as \(A_k - A_{k-1}\).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)
The numeric values for all these statistics can be obtained by get_stats()
.
get_stats(res)
#> k 1-PAC mean_silhouette concordance area_increased Rand Jaccard
#> 2 2 1.000 0.981 0.991 0.273 0.718 0.718
#> 3 3 0.524 0.834 0.909 1.246 0.667 0.536
#> 4 4 0.563 0.715 0.793 0.160 0.866 0.651
#> 5 5 0.718 0.766 0.859 0.090 0.933 0.743
#> 6 6 0.513 0.569 0.634 -0.024 0.858 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.
cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#> class entropy silhouette p1 p2
#> SRR330857 1 0.0000 0.999 1.000 0.000
#> SRR330858 1 0.0000 0.999 1.000 0.000
#> SRR330859 1 0.0000 0.999 1.000 0.000
#> SRR330860 2 0.0000 0.948 0.000 1.000
#> SRR330861 1 0.0000 0.999 1.000 0.000
#> SRR330862 1 0.0672 0.992 0.992 0.008
#> SRR330863 1 0.0000 0.999 1.000 0.000
#> SRR330864 1 0.0672 0.992 0.992 0.008
#> SRR330865 1 0.0000 0.999 1.000 0.000
#> SRR330866 1 0.0000 0.999 1.000 0.000
#> SRR330867 1 0.0000 0.999 1.000 0.000
#> SRR330868 1 0.0672 0.992 0.992 0.008
#> SRR330869 1 0.0000 0.999 1.000 0.000
#> SRR330870 1 0.0000 0.999 1.000 0.000
#> SRR330871 1 0.0000 0.999 1.000 0.000
#> SRR330872 1 0.0000 0.999 1.000 0.000
#> SRR330873 1 0.0000 0.999 1.000 0.000
#> SRR330874 2 0.0000 0.948 0.000 1.000
#> SRR330875 1 0.0000 0.999 1.000 0.000
#> SRR330876 1 0.0000 0.999 1.000 0.000
#> SRR330877 1 0.0000 0.999 1.000 0.000
#> SRR330878 1 0.0000 0.999 1.000 0.000
#> SRR330879 1 0.0000 0.999 1.000 0.000
#> SRR330880 1 0.0000 0.999 1.000 0.000
#> SRR330881 1 0.0000 0.999 1.000 0.000
#> SRR330882 2 0.0000 0.948 0.000 1.000
#> SRR330883 2 0.0000 0.948 0.000 1.000
#> SRR330884 1 0.0000 0.999 1.000 0.000
#> SRR330885 1 0.0000 0.999 1.000 0.000
#> SRR330886 1 0.1184 0.984 0.984 0.016
#> SRR330887 1 0.0000 0.999 1.000 0.000
#> SRR330888 1 0.0000 0.999 1.000 0.000
#> SRR330889 1 0.0000 0.999 1.000 0.000
#> SRR330890 1 0.0000 0.999 1.000 0.000
#> SRR330891 1 0.0000 0.999 1.000 0.000
#> SRR330892 2 0.0000 0.948 0.000 1.000
#> SRR330893 1 0.0000 0.999 1.000 0.000
#> SRR330894 1 0.0000 0.999 1.000 0.000
#> SRR330895 2 0.0000 0.948 0.000 1.000
#> SRR330896 1 0.0000 0.999 1.000 0.000
#> SRR330897 2 0.0000 0.948 0.000 1.000
#> SRR330898 2 0.0000 0.948 0.000 1.000
#> SRR330899 1 0.0000 0.999 1.000 0.000
#> SRR330900 1 0.0000 0.999 1.000 0.000
#> SRR330901 1 0.0000 0.999 1.000 0.000
#> SRR330902 1 0.0000 0.999 1.000 0.000
#> SRR330903 1 0.0000 0.999 1.000 0.000
#> SRR330904 2 0.3274 0.912 0.060 0.940
#> SRR330906 2 0.9170 0.536 0.332 0.668
#> SRR330907 1 0.0000 0.999 1.000 0.000
#> SRR330908 1 0.0000 0.999 1.000 0.000
#> SRR330909 1 0.0000 0.999 1.000 0.000
#> SRR330910 1 0.0000 0.999 1.000 0.000
#> SRR330911 1 0.0000 0.999 1.000 0.000
#> SRR330912 1 0.0000 0.999 1.000 0.000
#> SRR330913 1 0.0376 0.995 0.996 0.004
#> SRR330914 1 0.0000 0.999 1.000 0.000
#> SRR330915 1 0.0000 0.999 1.000 0.000
#> SRR330916 1 0.0000 0.999 1.000 0.000
#> SRR330917 1 0.1414 0.979 0.980 0.020
#> SRR330918 2 0.5519 0.852 0.128 0.872
#> SRR330919 1 0.0000 0.999 1.000 0.000
#> SRR330920 1 0.0000 0.999 1.000 0.000
#> SRR330921 1 0.0000 0.999 1.000 0.000
#> SRR330922 1 0.0000 0.999 1.000 0.000
#> SRR330923 1 0.0000 0.999 1.000 0.000
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> SRR330857 3 0.0000 0.923 0.000 0.000 1.000
#> SRR330858 3 0.0000 0.923 0.000 0.000 1.000
#> SRR330859 3 0.3192 0.892 0.112 0.000 0.888
#> SRR330860 2 0.0000 0.886 0.000 1.000 0.000
#> SRR330861 3 0.0592 0.921 0.012 0.000 0.988
#> SRR330862 3 0.3192 0.892 0.112 0.000 0.888
#> SRR330863 3 0.3851 0.874 0.136 0.004 0.860
#> SRR330864 3 0.3192 0.892 0.112 0.000 0.888
#> SRR330865 3 0.0000 0.923 0.000 0.000 1.000
#> SRR330866 1 0.1163 0.869 0.972 0.000 0.028
#> SRR330867 3 0.0000 0.923 0.000 0.000 1.000
#> SRR330868 3 0.3192 0.892 0.112 0.000 0.888
#> SRR330869 1 0.5363 0.642 0.724 0.000 0.276
#> SRR330870 3 0.0000 0.923 0.000 0.000 1.000
#> SRR330871 3 0.0000 0.923 0.000 0.000 1.000
#> SRR330872 3 0.6325 0.802 0.112 0.116 0.772
#> SRR330873 3 0.0000 0.923 0.000 0.000 1.000
#> SRR330874 2 0.0000 0.886 0.000 1.000 0.000
#> SRR330875 3 0.0000 0.923 0.000 0.000 1.000
#> SRR330876 3 0.0000 0.923 0.000 0.000 1.000
#> SRR330877 3 0.0237 0.922 0.004 0.000 0.996
#> SRR330878 3 0.0000 0.923 0.000 0.000 1.000
#> SRR330879 3 0.4654 0.773 0.208 0.000 0.792
#> SRR330880 3 0.3192 0.892 0.112 0.000 0.888
#> SRR330881 1 0.5650 0.676 0.688 0.000 0.312
#> SRR330882 2 0.0000 0.886 0.000 1.000 0.000
#> SRR330883 2 0.0000 0.886 0.000 1.000 0.000
#> SRR330884 1 0.0000 0.868 1.000 0.000 0.000
#> SRR330885 1 0.6111 0.388 0.604 0.000 0.396
#> SRR330886 1 0.3325 0.851 0.904 0.020 0.076
#> SRR330887 1 0.3412 0.834 0.876 0.000 0.124
#> SRR330888 1 0.3340 0.835 0.880 0.000 0.120
#> SRR330889 3 0.3267 0.890 0.116 0.000 0.884
#> SRR330890 1 0.1753 0.864 0.952 0.000 0.048
#> SRR330891 1 0.1753 0.864 0.952 0.000 0.048
#> SRR330892 2 0.0000 0.886 0.000 1.000 0.000
#> SRR330893 1 0.0000 0.868 1.000 0.000 0.000
#> SRR330894 1 0.0000 0.868 1.000 0.000 0.000
#> SRR330895 2 0.0000 0.886 0.000 1.000 0.000
#> SRR330896 1 0.0237 0.869 0.996 0.000 0.004
#> SRR330897 2 0.0000 0.886 0.000 1.000 0.000
#> SRR330898 2 0.0000 0.886 0.000 1.000 0.000
#> SRR330899 1 0.4750 0.809 0.784 0.000 0.216
#> SRR330900 1 0.5785 0.555 0.668 0.000 0.332
#> SRR330901 1 0.1411 0.868 0.964 0.000 0.036
#> SRR330902 1 0.3340 0.834 0.880 0.000 0.120
#> SRR330903 1 0.0000 0.868 1.000 0.000 0.000
#> SRR330904 2 0.5560 0.603 0.300 0.700 0.000
#> SRR330906 2 0.7945 0.329 0.388 0.548 0.064
#> SRR330907 1 0.6045 0.575 0.620 0.000 0.380
#> SRR330908 1 0.0000 0.868 1.000 0.000 0.000
#> SRR330909 1 0.4842 0.806 0.776 0.000 0.224
#> SRR330910 1 0.0237 0.868 0.996 0.000 0.004
#> SRR330911 1 0.0892 0.869 0.980 0.000 0.020
#> SRR330912 1 0.0237 0.868 0.996 0.000 0.004
#> SRR330913 1 0.4136 0.823 0.864 0.020 0.116
#> SRR330914 1 0.2959 0.846 0.900 0.000 0.100
#> SRR330915 1 0.3267 0.835 0.884 0.000 0.116
#> SRR330916 1 0.0000 0.868 1.000 0.000 0.000
#> SRR330917 1 0.4342 0.822 0.856 0.024 0.120
#> SRR330918 2 0.5619 0.686 0.244 0.744 0.012
#> SRR330919 1 0.0747 0.868 0.984 0.000 0.016
#> SRR330920 1 0.3340 0.835 0.880 0.000 0.120
#> SRR330921 1 0.3267 0.835 0.884 0.000 0.116
#> SRR330922 1 0.3192 0.835 0.888 0.000 0.112
#> SRR330923 1 0.3340 0.835 0.880 0.000 0.120
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> SRR330857 3 0.2053 0.905 0.072 0.000 0.924 0.004
#> SRR330858 3 0.2198 0.905 0.072 0.000 0.920 0.008
#> SRR330859 3 0.1975 0.876 0.016 0.000 0.936 0.048
#> SRR330860 2 0.1004 0.935 0.024 0.972 0.000 0.004
#> SRR330861 3 0.2563 0.903 0.072 0.000 0.908 0.020
#> SRR330862 3 0.3105 0.835 0.000 0.004 0.856 0.140
#> SRR330863 3 0.3852 0.788 0.012 0.000 0.808 0.180
#> SRR330864 3 0.3105 0.835 0.000 0.004 0.856 0.140
#> SRR330865 3 0.2198 0.905 0.072 0.000 0.920 0.008
#> SRR330866 4 0.2868 0.667 0.136 0.000 0.000 0.864
#> SRR330867 3 0.2675 0.887 0.100 0.000 0.892 0.008
#> SRR330868 3 0.3105 0.835 0.000 0.004 0.856 0.140
#> SRR330869 1 0.6879 0.401 0.596 0.000 0.216 0.188
#> SRR330870 3 0.2198 0.905 0.072 0.000 0.920 0.008
#> SRR330871 3 0.1867 0.905 0.072 0.000 0.928 0.000
#> SRR330872 3 0.4786 0.768 0.000 0.104 0.788 0.108
#> SRR330873 3 0.2198 0.905 0.072 0.000 0.920 0.008
#> SRR330874 2 0.1593 0.930 0.024 0.956 0.016 0.004
#> SRR330875 3 0.2053 0.905 0.072 0.000 0.924 0.004
#> SRR330876 3 0.2198 0.905 0.072 0.000 0.920 0.008
#> SRR330877 3 0.2871 0.902 0.072 0.000 0.896 0.032
#> SRR330878 3 0.2198 0.905 0.072 0.000 0.920 0.008
#> SRR330879 3 0.4049 0.746 0.212 0.000 0.780 0.008
#> SRR330880 3 0.1474 0.873 0.000 0.000 0.948 0.052
#> SRR330881 1 0.4730 0.419 0.636 0.000 0.364 0.000
#> SRR330882 2 0.0817 0.936 0.000 0.976 0.000 0.024
#> SRR330883 2 0.0188 0.937 0.000 0.996 0.000 0.004
#> SRR330884 4 0.5126 0.560 0.444 0.000 0.004 0.552
#> SRR330885 4 0.7667 0.199 0.336 0.000 0.224 0.440
#> SRR330886 4 0.5446 0.628 0.280 0.008 0.028 0.684
#> SRR330887 1 0.0817 0.726 0.976 0.000 0.024 0.000
#> SRR330888 1 0.0895 0.724 0.976 0.000 0.020 0.004
#> SRR330889 3 0.4907 0.755 0.060 0.000 0.764 0.176
#> SRR330890 4 0.5149 0.632 0.336 0.000 0.016 0.648
#> SRR330891 4 0.4988 0.666 0.288 0.000 0.020 0.692
#> SRR330892 2 0.1004 0.935 0.024 0.972 0.000 0.004
#> SRR330893 4 0.3528 0.684 0.192 0.000 0.000 0.808
#> SRR330894 4 0.4313 0.687 0.260 0.000 0.004 0.736
#> SRR330895 2 0.0592 0.936 0.000 0.984 0.000 0.016
#> SRR330896 1 0.5396 -0.451 0.524 0.000 0.012 0.464
#> SRR330897 2 0.0188 0.937 0.000 0.996 0.000 0.004
#> SRR330898 2 0.0188 0.937 0.000 0.996 0.000 0.004
#> SRR330899 1 0.5664 0.572 0.720 0.000 0.156 0.124
#> SRR330900 1 0.6448 0.511 0.628 0.000 0.252 0.120
#> SRR330901 1 0.3176 0.672 0.880 0.000 0.036 0.084
#> SRR330902 4 0.7184 0.337 0.416 0.000 0.136 0.448
#> SRR330903 4 0.4277 0.683 0.280 0.000 0.000 0.720
#> SRR330904 2 0.2965 0.876 0.036 0.892 0.000 0.072
#> SRR330906 2 0.6405 0.682 0.092 0.724 0.072 0.112
#> SRR330907 1 0.4164 0.553 0.736 0.000 0.264 0.000
#> SRR330908 4 0.4722 0.673 0.300 0.000 0.008 0.692
#> SRR330909 1 0.4685 0.645 0.784 0.000 0.156 0.060
#> SRR330910 4 0.5636 0.562 0.424 0.000 0.024 0.552
#> SRR330911 4 0.3545 0.682 0.164 0.000 0.008 0.828
#> SRR330912 4 0.3972 0.695 0.204 0.000 0.008 0.788
#> SRR330913 4 0.7133 0.419 0.392 0.008 0.104 0.496
#> SRR330914 4 0.6938 0.449 0.400 0.000 0.112 0.488
#> SRR330915 1 0.1042 0.723 0.972 0.000 0.020 0.008
#> SRR330916 4 0.3486 0.684 0.188 0.000 0.000 0.812
#> SRR330917 4 0.7507 0.321 0.416 0.008 0.140 0.436
#> SRR330918 2 0.4750 0.826 0.096 0.804 0.008 0.092
#> SRR330919 1 0.3708 0.541 0.832 0.000 0.020 0.148
#> SRR330920 1 0.0921 0.726 0.972 0.000 0.028 0.000
#> SRR330921 1 0.1042 0.724 0.972 0.000 0.020 0.008
#> SRR330922 1 0.1798 0.708 0.944 0.000 0.016 0.040
#> SRR330923 1 0.0921 0.726 0.972 0.000 0.028 0.000
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> SRR330857 1 0.0807 0.8852 0.976 0.000 0.012 0.000 0.012
#> SRR330858 1 0.0932 0.8842 0.972 0.000 0.004 0.004 0.020
#> SRR330859 3 0.4262 0.7356 0.252 0.000 0.724 0.008 0.016
#> SRR330860 2 0.0807 0.9404 0.012 0.976 0.012 0.000 0.000
#> SRR330861 3 0.4268 0.6222 0.344 0.000 0.648 0.000 0.008
#> SRR330862 3 0.1195 0.8236 0.028 0.000 0.960 0.000 0.012
#> SRR330863 3 0.4513 0.7676 0.128 0.000 0.764 0.104 0.004
#> SRR330864 3 0.1082 0.8230 0.028 0.000 0.964 0.000 0.008
#> SRR330865 1 0.0798 0.8852 0.976 0.000 0.016 0.000 0.008
#> SRR330866 4 0.0854 0.7764 0.008 0.000 0.012 0.976 0.004
#> SRR330867 1 0.0912 0.8859 0.972 0.000 0.012 0.000 0.016
#> SRR330868 3 0.1082 0.8230 0.028 0.000 0.964 0.000 0.008
#> SRR330869 5 0.4903 0.1232 0.016 0.000 0.008 0.400 0.576
#> SRR330870 1 0.0566 0.8891 0.984 0.000 0.004 0.000 0.012
#> SRR330871 1 0.3909 0.5906 0.760 0.000 0.216 0.000 0.024
#> SRR330872 3 0.2285 0.8277 0.052 0.004 0.916 0.004 0.024
#> SRR330873 1 0.0566 0.8891 0.984 0.000 0.004 0.000 0.012
#> SRR330874 2 0.1364 0.9383 0.012 0.952 0.036 0.000 0.000
#> SRR330875 1 0.1251 0.8708 0.956 0.000 0.036 0.000 0.008
#> SRR330876 1 0.0566 0.8890 0.984 0.000 0.004 0.000 0.012
#> SRR330877 3 0.3957 0.6775 0.280 0.000 0.712 0.000 0.008
#> SRR330878 1 0.0671 0.8863 0.980 0.000 0.016 0.000 0.004
#> SRR330879 1 0.6160 0.0571 0.468 0.000 0.076 0.020 0.436
#> SRR330880 3 0.2574 0.8237 0.112 0.000 0.876 0.000 0.012
#> SRR330881 5 0.5154 0.4047 0.372 0.000 0.000 0.048 0.580
#> SRR330882 2 0.1106 0.9399 0.000 0.964 0.000 0.012 0.024
#> SRR330883 2 0.0162 0.9422 0.000 0.996 0.000 0.000 0.004
#> SRR330884 4 0.3918 0.7156 0.008 0.000 0.008 0.752 0.232
#> SRR330885 4 0.5958 0.6278 0.080 0.000 0.040 0.640 0.240
#> SRR330886 4 0.2869 0.7707 0.008 0.008 0.052 0.892 0.040
#> SRR330887 5 0.1124 0.8395 0.004 0.000 0.000 0.036 0.960
#> SRR330888 5 0.1764 0.8386 0.012 0.000 0.012 0.036 0.940
#> SRR330889 3 0.5926 0.6848 0.136 0.000 0.668 0.160 0.036
#> SRR330890 4 0.2338 0.7852 0.000 0.000 0.004 0.884 0.112
#> SRR330891 4 0.2006 0.7917 0.000 0.000 0.012 0.916 0.072
#> SRR330892 2 0.0807 0.9404 0.012 0.976 0.012 0.000 0.000
#> SRR330893 4 0.0579 0.7794 0.008 0.000 0.000 0.984 0.008
#> SRR330894 4 0.0794 0.7836 0.000 0.000 0.000 0.972 0.028
#> SRR330895 2 0.0703 0.9408 0.000 0.976 0.000 0.000 0.024
#> SRR330896 4 0.3932 0.6348 0.000 0.000 0.000 0.672 0.328
#> SRR330897 2 0.0162 0.9422 0.000 0.996 0.000 0.000 0.004
#> SRR330898 2 0.0404 0.9420 0.000 0.988 0.000 0.000 0.012
#> SRR330899 5 0.3289 0.7737 0.004 0.000 0.008 0.172 0.816
#> SRR330900 5 0.4372 0.7020 0.040 0.000 0.008 0.200 0.752
#> SRR330901 5 0.2377 0.8102 0.000 0.000 0.000 0.128 0.872
#> SRR330902 4 0.4505 0.5093 0.000 0.000 0.012 0.604 0.384
#> SRR330903 4 0.1608 0.7912 0.000 0.000 0.000 0.928 0.072
#> SRR330904 2 0.2305 0.8914 0.000 0.896 0.000 0.092 0.012
#> SRR330906 2 0.3646 0.8269 0.000 0.820 0.008 0.140 0.032
#> SRR330907 5 0.4639 0.6664 0.236 0.000 0.000 0.056 0.708
#> SRR330908 4 0.1991 0.7908 0.004 0.000 0.004 0.916 0.076
#> SRR330909 5 0.2783 0.8178 0.012 0.000 0.004 0.116 0.868
#> SRR330910 4 0.4568 0.6294 0.012 0.000 0.012 0.672 0.304
#> SRR330911 4 0.0854 0.7764 0.008 0.000 0.012 0.976 0.004
#> SRR330912 4 0.0963 0.7863 0.000 0.000 0.000 0.964 0.036
#> SRR330913 4 0.4527 0.5107 0.000 0.000 0.012 0.596 0.392
#> SRR330914 4 0.4517 0.5103 0.000 0.000 0.012 0.600 0.388
#> SRR330915 5 0.1764 0.8386 0.012 0.000 0.012 0.036 0.940
#> SRR330916 4 0.0579 0.7793 0.008 0.000 0.000 0.984 0.008
#> SRR330917 4 0.4517 0.5105 0.000 0.000 0.012 0.600 0.388
#> SRR330918 2 0.4621 0.8086 0.052 0.788 0.000 0.068 0.092
#> SRR330919 5 0.2233 0.8252 0.004 0.000 0.000 0.104 0.892
#> SRR330920 5 0.1285 0.8395 0.004 0.000 0.004 0.036 0.956
#> SRR330921 5 0.1764 0.8386 0.012 0.000 0.012 0.036 0.940
#> SRR330922 5 0.1341 0.8407 0.000 0.000 0.000 0.056 0.944
#> SRR330923 5 0.2157 0.8310 0.040 0.000 0.004 0.036 0.920
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> SRR330857 1 0.3253 0.7610 0.832 0.000 0.096 0.068 NA NA
#> SRR330858 1 0.2604 0.8317 0.880 0.000 0.036 0.076 NA NA
#> SRR330859 3 0.4788 0.5798 0.288 0.000 0.636 0.072 NA NA
#> SRR330860 2 0.4226 0.6440 0.008 0.504 0.004 0.000 NA NA
#> SRR330861 3 0.4735 0.3147 0.432 0.000 0.520 0.048 NA NA
#> SRR330862 3 0.5012 0.6303 0.104 0.000 0.700 0.036 NA NA
#> SRR330863 3 0.5410 0.6161 0.212 0.000 0.632 0.140 NA NA
#> SRR330864 3 0.5118 0.6288 0.108 0.000 0.692 0.040 NA NA
#> SRR330865 1 0.3672 0.7052 0.776 0.000 0.168 0.056 NA NA
#> SRR330866 4 0.5547 0.4892 0.040 0.004 0.012 0.540 NA NA
#> SRR330867 1 0.2712 0.8240 0.864 0.000 0.048 0.088 NA NA
#> SRR330868 3 0.5012 0.6303 0.104 0.000 0.700 0.036 NA NA
#> SRR330869 4 0.5426 0.5400 0.052 0.000 0.104 0.692 NA NA
#> SRR330870 1 0.1802 0.8359 0.916 0.000 0.012 0.072 NA NA
#> SRR330871 1 0.4773 0.1836 0.572 0.000 0.376 0.048 NA NA
#> SRR330872 3 0.3381 0.6643 0.088 0.000 0.840 0.052 NA NA
#> SRR330873 1 0.2230 0.8243 0.892 0.000 0.024 0.084 NA NA
#> SRR330874 2 0.4617 0.6746 0.004 0.624 0.020 0.000 NA NA
#> SRR330875 1 0.3301 0.7629 0.828 0.000 0.100 0.068 NA NA
#> SRR330876 1 0.2325 0.8280 0.892 0.000 0.048 0.060 NA NA
#> SRR330877 3 0.4506 0.4629 0.348 0.000 0.608 0.044 NA NA
#> SRR330878 1 0.2511 0.8322 0.880 0.000 0.056 0.064 NA NA
#> SRR330879 3 0.6466 0.2056 0.396 0.000 0.400 0.164 NA NA
#> SRR330880 3 0.3695 0.6627 0.176 0.000 0.776 0.044 NA NA
#> SRR330881 4 0.6920 0.2193 0.272 0.000 0.048 0.456 NA NA
#> SRR330882 2 0.4579 0.7153 0.008 0.736 0.008 0.004 NA NA
#> SRR330883 2 0.1196 0.7330 0.000 0.952 0.000 0.000 NA NA
#> SRR330884 4 0.3367 0.5896 0.020 0.000 0.000 0.804 NA NA
#> SRR330885 4 0.7599 0.0893 0.136 0.000 0.284 0.396 NA NA
#> SRR330886 4 0.7408 0.3591 0.068 0.000 0.116 0.408 NA NA
#> SRR330887 4 0.5451 0.4935 0.084 0.000 0.012 0.556 NA NA
#> SRR330888 4 0.4753 0.5188 0.052 0.000 0.000 0.596 NA NA
#> SRR330889 3 0.5821 0.5385 0.240 0.000 0.576 0.160 NA NA
#> SRR330890 4 0.5089 0.5214 0.004 0.000 0.048 0.564 NA NA
#> SRR330891 4 0.4631 0.5216 0.004 0.000 0.012 0.596 NA NA
#> SRR330892 2 0.2730 0.7137 0.000 0.808 0.000 0.000 NA NA
#> SRR330893 4 0.5004 0.5122 0.036 0.000 0.000 0.572 NA NA
#> SRR330894 4 0.4530 0.5189 0.012 0.000 0.004 0.608 NA NA
#> SRR330895 2 0.6347 0.6775 0.000 0.612 0.028 0.060 NA NA
#> SRR330896 4 0.3875 0.5814 0.016 0.000 0.020 0.772 NA NA
#> SRR330897 2 0.0146 0.7345 0.000 0.996 0.000 0.000 NA NA
#> SRR330898 2 0.0922 0.7347 0.000 0.968 0.004 0.000 NA NA
#> SRR330899 4 0.4748 0.5439 0.020 0.000 0.008 0.668 NA NA
#> SRR330900 4 0.6319 0.5256 0.060 0.000 0.100 0.584 NA NA
#> SRR330901 4 0.4260 0.5675 0.016 0.000 0.024 0.692 NA NA
#> SRR330902 4 0.4033 0.5772 0.000 0.000 0.068 0.792 NA NA
#> SRR330903 4 0.4184 0.5516 0.016 0.000 0.000 0.684 NA NA
#> SRR330904 2 0.6680 0.4767 0.000 0.436 0.000 0.232 NA NA
#> SRR330906 2 0.7300 0.4613 0.000 0.396 0.012 0.216 NA NA
#> SRR330907 4 0.6858 0.3642 0.196 0.000 0.048 0.488 NA NA
#> SRR330908 4 0.4407 0.5415 0.020 0.000 0.000 0.648 NA NA
#> SRR330909 4 0.5512 0.5286 0.028 0.000 0.044 0.596 NA NA
#> SRR330910 4 0.3694 0.5938 0.056 0.000 0.000 0.804 NA NA
#> SRR330911 4 0.5011 0.5086 0.040 0.000 0.000 0.564 NA NA
#> SRR330912 4 0.4461 0.5207 0.004 0.000 0.008 0.604 NA NA
#> SRR330913 4 0.3942 0.5583 0.000 0.000 0.040 0.800 NA NA
#> SRR330914 4 0.3147 0.5908 0.008 0.000 0.032 0.860 NA NA
#> SRR330915 4 0.4753 0.5186 0.052 0.000 0.000 0.596 NA NA
#> SRR330916 4 0.5074 0.5014 0.040 0.000 0.000 0.564 NA NA
#> SRR330917 4 0.4295 0.5514 0.000 0.000 0.064 0.776 NA NA
#> SRR330918 2 0.8257 0.5570 0.084 0.424 0.012 0.108 NA NA
#> SRR330919 4 0.4283 0.5597 0.036 0.000 0.004 0.672 NA NA
#> SRR330920 4 0.5205 0.5057 0.052 0.000 0.012 0.572 NA NA
#> SRR330921 4 0.4721 0.5170 0.048 0.000 0.000 0.592 NA NA
#> SRR330922 4 0.4720 0.5399 0.028 0.000 0.016 0.628 NA NA
#> SRR330923 4 0.5605 0.4972 0.096 0.000 0.008 0.564 NA NA
Heatmaps for the consensus matrix. It visualizes the probability of two samples to be in a same group.
consensus_heatmap(res, k = 2)
consensus_heatmap(res, k = 3)
consensus_heatmap(res, k = 4)
consensus_heatmap(res, k = 5)
consensus_heatmap(res, k = 6)
Heatmaps for the membership of samples in all partitions to see how consistent they are:
membership_heatmap(res, k = 2)
membership_heatmap(res, k = 3)
membership_heatmap(res, k = 4)
membership_heatmap(res, k = 5)
membership_heatmap(res, k = 6)
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)
get_signatures(res, k = 3)
get_signatures(res, k = 4)
get_signatures(res, k = 5)
get_signatures(res, k = 6)
Signature heatmaps where rows are not scaled:
get_signatures(res, k = 2, scale_rows = FALSE)
get_signatures(res, k = 3, scale_rows = FALSE)
get_signatures(res, k = 4, scale_rows = FALSE)
get_signatures(res, k = 5, scale_rows = FALSE)
get_signatures(res, k = 6, scale_rows = FALSE)
Compare the overlap of signatures from different k:
compare_signatures(res)
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:
which_row
: row indices corresponding to the input matrix.fdr
: FDR for the differential test. mean_x
: The mean value in group x.scaled_mean_x
: The mean value in group x after rows are scaled.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")
dimension_reduction(res, k = 3, method = "UMAP")
dimension_reduction(res, k = 4, method = "UMAP")
dimension_reduction(res, k = 5, method = "UMAP")
dimension_reduction(res, k = 6, method = "UMAP")
Following heatmap shows how subgroups are split when increasing k
:
collect_classes(res)
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.
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 10869 rows and 66 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)
The plots are:
k
and the heatmap of
predicted classes for each k
.k
.k
.k
.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:
k
;k
, the area increased is defined as \(A_k - A_{k-1}\).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)
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.396 0.808 0.878 0.2891 0.761 0.761
#> 3 3 0.502 0.625 0.855 0.4705 0.810 0.757
#> 4 4 0.470 0.606 0.829 0.1527 0.869 0.793
#> 5 5 0.424 0.557 0.810 0.0593 0.949 0.905
#> 6 6 0.416 0.609 0.802 0.0800 0.802 0.636
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.
cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#> class entropy silhouette p1 p2
#> SRR330857 1 0.8763 0.634 0.704 0.296
#> SRR330858 1 0.5178 0.846 0.884 0.116
#> SRR330859 1 0.4939 0.854 0.892 0.108
#> SRR330860 2 0.3584 0.783 0.068 0.932
#> SRR330861 1 0.5178 0.846 0.884 0.116
#> SRR330862 1 0.5946 0.828 0.856 0.144
#> SRR330863 1 0.4022 0.865 0.920 0.080
#> SRR330864 1 0.5408 0.842 0.876 0.124
#> SRR330865 1 0.4690 0.855 0.900 0.100
#> SRR330866 1 0.0000 0.879 1.000 0.000
#> SRR330867 1 0.4298 0.860 0.912 0.088
#> SRR330868 1 0.5737 0.833 0.864 0.136
#> SRR330869 1 0.0000 0.879 1.000 0.000
#> SRR330870 1 0.5059 0.849 0.888 0.112
#> SRR330871 1 0.5408 0.842 0.876 0.124
#> SRR330872 1 0.6048 0.826 0.852 0.148
#> SRR330873 1 0.4939 0.851 0.892 0.108
#> SRR330874 1 0.3431 0.870 0.936 0.064
#> SRR330875 1 0.8713 0.641 0.708 0.292
#> SRR330876 1 0.5737 0.833 0.864 0.136
#> SRR330877 1 0.7219 0.772 0.800 0.200
#> SRR330878 1 0.7139 0.777 0.804 0.196
#> SRR330879 1 0.4022 0.863 0.920 0.080
#> SRR330880 1 0.5294 0.844 0.880 0.120
#> SRR330881 1 0.0376 0.879 0.996 0.004
#> SRR330882 2 0.5178 0.815 0.116 0.884
#> SRR330883 2 0.7528 0.845 0.216 0.784
#> SRR330884 1 0.0376 0.878 0.996 0.004
#> SRR330885 1 0.0938 0.879 0.988 0.012
#> SRR330886 1 0.5059 0.802 0.888 0.112
#> SRR330887 1 0.0000 0.879 1.000 0.000
#> SRR330888 1 0.0000 0.879 1.000 0.000
#> SRR330889 1 0.3431 0.868 0.936 0.064
#> SRR330890 1 0.2948 0.858 0.948 0.052
#> SRR330891 1 0.3114 0.857 0.944 0.056
#> SRR330892 2 0.7219 0.844 0.200 0.800
#> SRR330893 1 0.0938 0.877 0.988 0.012
#> SRR330894 1 0.0000 0.879 1.000 0.000
#> SRR330895 2 0.9815 0.564 0.420 0.580
#> SRR330896 1 0.0938 0.877 0.988 0.012
#> SRR330897 2 0.7815 0.838 0.232 0.768
#> SRR330898 2 0.7745 0.841 0.228 0.772
#> SRR330899 1 0.5059 0.805 0.888 0.112
#> SRR330900 1 0.0672 0.879 0.992 0.008
#> SRR330901 1 0.3584 0.847 0.932 0.068
#> SRR330902 1 0.8016 0.577 0.756 0.244
#> SRR330903 1 0.0000 0.879 1.000 0.000
#> SRR330904 1 0.5519 0.785 0.872 0.128
#> SRR330906 1 0.9580 0.119 0.620 0.380
#> SRR330907 1 0.0672 0.879 0.992 0.008
#> SRR330908 1 0.2236 0.867 0.964 0.036
#> SRR330909 2 1.0000 0.326 0.500 0.500
#> SRR330910 1 0.4022 0.836 0.920 0.080
#> SRR330911 1 0.0000 0.879 1.000 0.000
#> SRR330912 1 0.2948 0.859 0.948 0.052
#> SRR330913 1 0.7815 0.603 0.768 0.232
#> SRR330914 1 0.5294 0.795 0.880 0.120
#> SRR330915 1 0.0000 0.879 1.000 0.000
#> SRR330916 1 0.0000 0.879 1.000 0.000
#> SRR330917 1 0.7883 0.595 0.764 0.236
#> SRR330918 2 0.5519 0.818 0.128 0.872
#> SRR330919 1 0.4022 0.836 0.920 0.080
#> SRR330920 1 0.2948 0.859 0.948 0.052
#> SRR330921 1 0.0672 0.878 0.992 0.008
#> SRR330922 1 0.4690 0.817 0.900 0.100
#> SRR330923 1 0.1414 0.874 0.980 0.020
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> SRR330857 3 0.2860 0.3713 0.084 0.004 0.912
#> SRR330858 1 0.6204 -0.2734 0.576 0.000 0.424
#> SRR330859 1 0.5254 0.4207 0.736 0.000 0.264
#> SRR330860 2 0.5926 0.6753 0.000 0.644 0.356
#> SRR330861 1 0.5785 0.1725 0.668 0.000 0.332
#> SRR330862 3 0.6274 0.5842 0.456 0.000 0.544
#> SRR330863 1 0.1989 0.7916 0.948 0.004 0.048
#> SRR330864 1 0.6267 -0.3831 0.548 0.000 0.452
#> SRR330865 1 0.5431 0.3467 0.716 0.000 0.284
#> SRR330866 1 0.0424 0.8157 0.992 0.000 0.008
#> SRR330867 1 0.3482 0.6882 0.872 0.000 0.128
#> SRR330868 3 0.6295 0.5520 0.472 0.000 0.528
#> SRR330869 1 0.0237 0.8163 0.996 0.000 0.004
#> SRR330870 1 0.5497 0.3234 0.708 0.000 0.292
#> SRR330871 1 0.6026 -0.0427 0.624 0.000 0.376
#> SRR330872 3 0.6308 0.4844 0.492 0.000 0.508
#> SRR330873 1 0.5327 0.3865 0.728 0.000 0.272
#> SRR330874 1 0.1964 0.7854 0.944 0.000 0.056
#> SRR330875 3 0.4810 0.4852 0.140 0.028 0.832
#> SRR330876 1 0.6308 -0.5233 0.508 0.000 0.492
#> SRR330877 3 0.5465 0.7059 0.288 0.000 0.712
#> SRR330878 3 0.5560 0.7132 0.300 0.000 0.700
#> SRR330879 1 0.1411 0.7981 0.964 0.000 0.036
#> SRR330880 1 0.5835 0.1434 0.660 0.000 0.340
#> SRR330881 1 0.0424 0.8157 0.992 0.000 0.008
#> SRR330882 2 0.5315 0.7759 0.012 0.772 0.216
#> SRR330883 2 0.2384 0.8179 0.008 0.936 0.056
#> SRR330884 1 0.0237 0.8160 0.996 0.000 0.004
#> SRR330885 1 0.0424 0.8159 0.992 0.000 0.008
#> SRR330886 1 0.5159 0.6483 0.820 0.140 0.040
#> SRR330887 1 0.0424 0.8157 0.992 0.000 0.008
#> SRR330888 1 0.0424 0.8157 0.992 0.000 0.008
#> SRR330889 1 0.0892 0.8096 0.980 0.000 0.020
#> SRR330890 1 0.0983 0.8109 0.980 0.016 0.004
#> SRR330891 1 0.1031 0.8073 0.976 0.024 0.000
#> SRR330892 2 0.1015 0.8203 0.008 0.980 0.012
#> SRR330893 1 0.0000 0.8164 1.000 0.000 0.000
#> SRR330894 1 0.0424 0.8157 0.992 0.000 0.008
#> SRR330895 2 0.6255 0.3070 0.320 0.668 0.012
#> SRR330896 1 0.0237 0.8164 0.996 0.000 0.004
#> SRR330897 2 0.1170 0.8195 0.008 0.976 0.016
#> SRR330898 2 0.1399 0.8138 0.028 0.968 0.004
#> SRR330899 1 0.2486 0.7754 0.932 0.060 0.008
#> SRR330900 1 0.0475 0.8168 0.992 0.004 0.004
#> SRR330901 1 0.0424 0.8146 0.992 0.008 0.000
#> SRR330902 1 0.5115 0.6236 0.796 0.188 0.016
#> SRR330903 1 0.0237 0.8164 0.996 0.000 0.004
#> SRR330904 1 0.3359 0.7443 0.900 0.084 0.016
#> SRR330906 1 0.6211 0.5121 0.736 0.228 0.036
#> SRR330907 1 0.0592 0.8134 0.988 0.012 0.000
#> SRR330908 1 0.0000 0.8164 1.000 0.000 0.000
#> SRR330909 1 0.9471 -0.1794 0.440 0.376 0.184
#> SRR330910 1 0.2152 0.7895 0.948 0.036 0.016
#> SRR330911 1 0.0424 0.8157 0.992 0.000 0.008
#> SRR330912 1 0.1525 0.8001 0.964 0.032 0.004
#> SRR330913 1 0.4277 0.6901 0.852 0.132 0.016
#> SRR330914 1 0.2280 0.7826 0.940 0.052 0.008
#> SRR330915 1 0.0424 0.8157 0.992 0.000 0.008
#> SRR330916 1 0.0424 0.8157 0.992 0.000 0.008
#> SRR330917 1 0.4749 0.6476 0.816 0.172 0.012
#> SRR330918 2 0.7402 0.6932 0.052 0.624 0.324
#> SRR330919 1 0.0848 0.8123 0.984 0.008 0.008
#> SRR330920 1 0.0475 0.8167 0.992 0.004 0.004
#> SRR330921 1 0.0000 0.8164 1.000 0.000 0.000
#> SRR330922 1 0.0661 0.8136 0.988 0.008 0.004
#> SRR330923 1 0.0000 0.8164 1.000 0.000 0.000
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> SRR330857 3 0.2384 0.2029 0.008 0.004 0.916 0.072
#> SRR330858 3 0.5119 0.5383 0.440 0.000 0.556 0.004
#> SRR330859 1 0.5577 0.2431 0.636 0.000 0.328 0.036
#> SRR330860 4 0.7859 0.0210 0.000 0.352 0.272 0.376
#> SRR330861 1 0.4967 -0.2349 0.548 0.000 0.452 0.000
#> SRR330862 3 0.4543 0.7046 0.324 0.000 0.676 0.000
#> SRR330863 1 0.5102 0.6496 0.764 0.000 0.100 0.136
#> SRR330864 3 0.4843 0.6322 0.396 0.000 0.604 0.000
#> SRR330865 1 0.4679 0.2160 0.648 0.000 0.352 0.000
#> SRR330866 1 0.0336 0.8541 0.992 0.000 0.000 0.008
#> SRR330867 1 0.3591 0.6790 0.824 0.000 0.168 0.008
#> SRR330868 3 0.4643 0.7013 0.344 0.000 0.656 0.000
#> SRR330869 1 0.0657 0.8536 0.984 0.004 0.000 0.012
#> SRR330870 1 0.4936 0.1251 0.624 0.000 0.372 0.004
#> SRR330871 3 0.4999 0.3880 0.492 0.000 0.508 0.000
#> SRR330872 3 0.4584 0.6926 0.300 0.000 0.696 0.004
#> SRR330873 1 0.4800 0.2497 0.656 0.000 0.340 0.004
#> SRR330874 1 0.2924 0.7704 0.884 0.000 0.100 0.016
#> SRR330875 3 0.3712 0.1177 0.012 0.004 0.832 0.152
#> SRR330876 3 0.4522 0.7038 0.320 0.000 0.680 0.000
#> SRR330877 3 0.2345 0.4800 0.100 0.000 0.900 0.000
#> SRR330878 3 0.2647 0.5133 0.120 0.000 0.880 0.000
#> SRR330879 1 0.1978 0.8090 0.928 0.000 0.068 0.004
#> SRR330880 1 0.4972 -0.2453 0.544 0.000 0.456 0.000
#> SRR330881 1 0.0707 0.8525 0.980 0.000 0.000 0.020
#> SRR330882 4 0.6276 -0.0384 0.000 0.464 0.056 0.480
#> SRR330883 2 0.5375 0.2267 0.004 0.572 0.008 0.416
#> SRR330884 1 0.0469 0.8543 0.988 0.000 0.000 0.012
#> SRR330885 1 0.1871 0.8426 0.948 0.016 0.024 0.012
#> SRR330886 1 0.6834 0.3287 0.588 0.104 0.008 0.300
#> SRR330887 1 0.0188 0.8542 0.996 0.000 0.000 0.004
#> SRR330888 1 0.0000 0.8540 1.000 0.000 0.000 0.000
#> SRR330889 1 0.1722 0.8243 0.944 0.000 0.048 0.008
#> SRR330890 1 0.0592 0.8544 0.984 0.000 0.000 0.016
#> SRR330891 1 0.0524 0.8543 0.988 0.004 0.000 0.008
#> SRR330892 2 0.1396 0.5062 0.004 0.960 0.004 0.032
#> SRR330893 1 0.0336 0.8536 0.992 0.000 0.000 0.008
#> SRR330894 1 0.0188 0.8538 0.996 0.000 0.000 0.004
#> SRR330895 2 0.4838 0.1228 0.252 0.724 0.000 0.024
#> SRR330896 1 0.0188 0.8538 0.996 0.000 0.000 0.004
#> SRR330897 2 0.1985 0.5105 0.016 0.940 0.004 0.040
#> SRR330898 2 0.3545 0.4980 0.008 0.828 0.000 0.164
#> SRR330899 1 0.2101 0.8207 0.928 0.060 0.000 0.012
#> SRR330900 1 0.1114 0.8503 0.972 0.016 0.004 0.008
#> SRR330901 1 0.0469 0.8538 0.988 0.000 0.000 0.012
#> SRR330902 1 0.4663 0.6835 0.788 0.148 0.000 0.064
#> SRR330903 1 0.0000 0.8540 1.000 0.000 0.000 0.000
#> SRR330904 1 0.3266 0.7718 0.868 0.024 0.000 0.108
#> SRR330906 1 0.6152 0.4871 0.668 0.120 0.000 0.212
#> SRR330907 1 0.0469 0.8543 0.988 0.000 0.000 0.012
#> SRR330908 1 0.0469 0.8538 0.988 0.000 0.000 0.012
#> SRR330909 4 0.8577 -0.0325 0.280 0.192 0.056 0.472
#> SRR330910 1 0.1389 0.8379 0.952 0.000 0.000 0.048
#> SRR330911 1 0.0000 0.8540 1.000 0.000 0.000 0.000
#> SRR330912 1 0.0895 0.8514 0.976 0.004 0.000 0.020
#> SRR330913 1 0.3806 0.7114 0.824 0.156 0.000 0.020
#> SRR330914 1 0.0927 0.8502 0.976 0.008 0.000 0.016
#> SRR330915 1 0.0188 0.8539 0.996 0.000 0.000 0.004
#> SRR330916 1 0.0188 0.8544 0.996 0.000 0.000 0.004
#> SRR330917 1 0.4327 0.6316 0.768 0.216 0.000 0.016
#> SRR330918 4 0.8102 0.1113 0.040 0.340 0.140 0.480
#> SRR330919 1 0.0657 0.8529 0.984 0.004 0.000 0.012
#> SRR330920 1 0.0376 0.8534 0.992 0.004 0.000 0.004
#> SRR330921 1 0.0336 0.8536 0.992 0.000 0.000 0.008
#> SRR330922 1 0.0524 0.8536 0.988 0.004 0.000 0.008
#> SRR330923 1 0.0336 0.8541 0.992 0.000 0.000 0.008
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> SRR330857 3 0.4988 -0.0704 0.004 0.004 0.732 0.136 0.124
#> SRR330858 3 0.4597 0.4624 0.424 0.000 0.564 0.000 0.012
#> SRR330859 1 0.5663 -0.0342 0.532 0.000 0.384 0.000 0.084
#> SRR330860 4 0.8102 0.2828 0.000 0.172 0.244 0.424 0.160
#> SRR330861 1 0.4437 -0.1352 0.532 0.000 0.464 0.000 0.004
#> SRR330862 3 0.3730 0.6867 0.288 0.000 0.712 0.000 0.000
#> SRR330863 1 0.5740 0.3005 0.580 0.000 0.112 0.000 0.308
#> SRR330864 3 0.4150 0.5647 0.388 0.000 0.612 0.000 0.000
#> SRR330865 1 0.4341 0.1244 0.592 0.000 0.404 0.000 0.004
#> SRR330866 1 0.0324 0.8243 0.992 0.000 0.000 0.004 0.004
#> SRR330867 1 0.3835 0.5179 0.732 0.000 0.260 0.000 0.008
#> SRR330868 3 0.3913 0.6783 0.324 0.000 0.676 0.000 0.000
#> SRR330869 1 0.0404 0.8242 0.988 0.000 0.000 0.000 0.012
#> SRR330870 1 0.4375 0.0564 0.576 0.000 0.420 0.000 0.004
#> SRR330871 1 0.4306 -0.2441 0.508 0.000 0.492 0.000 0.000
#> SRR330872 3 0.3838 0.6814 0.280 0.000 0.716 0.004 0.000
#> SRR330873 1 0.4425 0.1594 0.600 0.000 0.392 0.000 0.008
#> SRR330874 1 0.3656 0.6206 0.784 0.000 0.196 0.000 0.020
#> SRR330875 3 0.5815 -0.2355 0.004 0.016 0.664 0.192 0.124
#> SRR330876 3 0.3857 0.6836 0.312 0.000 0.688 0.000 0.000
#> SRR330877 3 0.2280 0.5523 0.120 0.000 0.880 0.000 0.000
#> SRR330878 3 0.2424 0.5708 0.132 0.000 0.868 0.000 0.000
#> SRR330879 1 0.3132 0.6646 0.820 0.000 0.172 0.000 0.008
#> SRR330880 1 0.4300 -0.1745 0.524 0.000 0.476 0.000 0.000
#> SRR330881 1 0.0771 0.8220 0.976 0.000 0.004 0.000 0.020
#> SRR330882 4 0.6078 0.2977 0.000 0.272 0.008 0.584 0.136
#> SRR330883 5 0.5822 -0.3654 0.004 0.324 0.000 0.100 0.572
#> SRR330884 1 0.0451 0.8242 0.988 0.004 0.000 0.000 0.008
#> SRR330885 1 0.1692 0.8113 0.948 0.008 0.020 0.008 0.016
#> SRR330886 5 0.5252 0.2677 0.364 0.056 0.000 0.000 0.580
#> SRR330887 1 0.0404 0.8241 0.988 0.000 0.000 0.000 0.012
#> SRR330888 1 0.0510 0.8242 0.984 0.000 0.000 0.000 0.016
#> SRR330889 1 0.2674 0.7278 0.868 0.000 0.120 0.000 0.012
#> SRR330890 1 0.0955 0.8213 0.968 0.004 0.000 0.000 0.028
#> SRR330891 1 0.0290 0.8233 0.992 0.008 0.000 0.000 0.000
#> SRR330892 2 0.3294 0.5959 0.000 0.868 0.028 0.048 0.056
#> SRR330893 1 0.0162 0.8243 0.996 0.000 0.000 0.004 0.000
#> SRR330894 1 0.0162 0.8235 0.996 0.004 0.000 0.000 0.000
#> SRR330895 2 0.3895 0.4926 0.132 0.812 0.000 0.012 0.044
#> SRR330896 1 0.0324 0.8238 0.992 0.004 0.000 0.000 0.004
#> SRR330897 2 0.1743 0.6412 0.004 0.940 0.000 0.028 0.028
#> SRR330898 2 0.4608 0.5586 0.004 0.748 0.004 0.060 0.184
#> SRR330899 1 0.1830 0.7918 0.924 0.068 0.000 0.000 0.008
#> SRR330900 1 0.1525 0.8108 0.948 0.036 0.004 0.000 0.012
#> SRR330901 1 0.0613 0.8240 0.984 0.008 0.000 0.004 0.004
#> SRR330902 1 0.3495 0.7140 0.836 0.120 0.000 0.008 0.036
#> SRR330903 1 0.0324 0.8241 0.992 0.004 0.000 0.000 0.004
#> SRR330904 1 0.3171 0.6879 0.816 0.008 0.000 0.000 0.176
#> SRR330906 1 0.5236 -0.0434 0.544 0.048 0.000 0.000 0.408
#> SRR330907 1 0.0290 0.8240 0.992 0.008 0.000 0.000 0.000
#> SRR330908 1 0.0451 0.8241 0.988 0.000 0.000 0.004 0.008
#> SRR330909 5 0.8681 0.0751 0.176 0.140 0.048 0.184 0.452
#> SRR330910 1 0.2270 0.7756 0.908 0.004 0.000 0.016 0.072
#> SRR330911 1 0.0162 0.8239 0.996 0.000 0.000 0.000 0.004
#> SRR330912 1 0.0451 0.8236 0.988 0.004 0.000 0.000 0.008
#> SRR330913 1 0.2733 0.7400 0.872 0.112 0.000 0.004 0.012
#> SRR330914 1 0.0579 0.8226 0.984 0.008 0.000 0.000 0.008
#> SRR330915 1 0.0290 0.8242 0.992 0.000 0.000 0.000 0.008
#> SRR330916 1 0.0290 0.8243 0.992 0.000 0.000 0.000 0.008
#> SRR330917 1 0.3883 0.5680 0.744 0.244 0.000 0.008 0.004
#> SRR330918 4 0.7546 0.3213 0.024 0.196 0.056 0.540 0.184
#> SRR330919 1 0.0451 0.8243 0.988 0.004 0.000 0.000 0.008
#> SRR330920 1 0.0162 0.8240 0.996 0.000 0.000 0.000 0.004
#> SRR330921 1 0.0290 0.8240 0.992 0.000 0.000 0.000 0.008
#> SRR330922 1 0.0324 0.8241 0.992 0.004 0.000 0.000 0.004
#> SRR330923 1 0.0290 0.8238 0.992 0.000 0.000 0.000 0.008
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> SRR330857 1 0.6346 -0.2837 0.620 0.008 0.148 0.008 0.112 0.104
#> SRR330858 1 0.3878 0.7133 0.644 0.000 0.004 0.348 0.000 0.004
#> SRR330859 1 0.5585 0.5516 0.488 0.000 0.000 0.364 0.148 0.000
#> SRR330860 6 0.6337 0.1747 0.136 0.088 0.076 0.000 0.060 0.640
#> SRR330861 1 0.3706 0.6938 0.620 0.000 0.000 0.380 0.000 0.000
#> SRR330862 1 0.3126 0.7059 0.752 0.000 0.000 0.248 0.000 0.000
#> SRR330863 5 0.6146 0.1384 0.188 0.004 0.000 0.348 0.452 0.008
#> SRR330864 1 0.3464 0.7219 0.688 0.000 0.000 0.312 0.000 0.000
#> SRR330865 1 0.3971 0.6073 0.548 0.004 0.000 0.448 0.000 0.000
#> SRR330866 4 0.0146 0.8994 0.000 0.000 0.000 0.996 0.004 0.000
#> SRR330867 4 0.4277 -0.2272 0.408 0.004 0.004 0.576 0.008 0.000
#> SRR330868 1 0.3198 0.7115 0.740 0.000 0.000 0.260 0.000 0.000
#> SRR330869 4 0.0436 0.8999 0.004 0.004 0.004 0.988 0.000 0.000
#> SRR330870 1 0.3937 0.6477 0.572 0.004 0.000 0.424 0.000 0.000
#> SRR330871 1 0.3742 0.7140 0.648 0.004 0.000 0.348 0.000 0.000
#> SRR330872 1 0.3052 0.6787 0.780 0.000 0.000 0.216 0.000 0.004
#> SRR330873 1 0.3991 0.5466 0.524 0.004 0.000 0.472 0.000 0.000
#> SRR330874 4 0.3714 0.1376 0.340 0.000 0.000 0.656 0.004 0.000
#> SRR330875 1 0.7303 -0.3976 0.512 0.016 0.232 0.024 0.076 0.140
#> SRR330876 1 0.3050 0.6965 0.764 0.000 0.000 0.236 0.000 0.000
#> SRR330877 1 0.1910 0.5332 0.892 0.000 0.000 0.108 0.000 0.000
#> SRR330878 1 0.2219 0.5778 0.864 0.000 0.000 0.136 0.000 0.000
#> SRR330879 4 0.3448 0.3743 0.280 0.000 0.000 0.716 0.004 0.000
#> SRR330880 1 0.3699 0.7191 0.660 0.004 0.000 0.336 0.000 0.000
#> SRR330881 4 0.0837 0.8918 0.004 0.000 0.004 0.972 0.020 0.000
#> SRR330882 6 0.7156 -0.0455 0.004 0.156 0.320 0.000 0.108 0.412
#> SRR330883 5 0.6593 -0.3738 0.004 0.160 0.124 0.004 0.576 0.132
#> SRR330884 4 0.0291 0.9002 0.000 0.004 0.004 0.992 0.000 0.000
#> SRR330885 4 0.2413 0.8463 0.020 0.012 0.008 0.912 0.028 0.020
#> SRR330886 5 0.3722 0.2531 0.024 0.008 0.004 0.192 0.772 0.000
#> SRR330887 4 0.0000 0.9002 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR330888 4 0.0436 0.8999 0.000 0.004 0.004 0.988 0.004 0.000
#> SRR330889 4 0.3136 0.5228 0.228 0.000 0.000 0.768 0.004 0.000
#> SRR330890 4 0.0713 0.8880 0.000 0.000 0.000 0.972 0.028 0.000
#> SRR330891 4 0.0291 0.9001 0.000 0.004 0.004 0.992 0.000 0.000
#> SRR330892 2 0.4810 0.3949 0.068 0.760 0.092 0.000 0.024 0.056
#> SRR330893 4 0.0291 0.8999 0.000 0.000 0.004 0.992 0.004 0.000
#> SRR330894 4 0.0291 0.9002 0.000 0.004 0.004 0.992 0.000 0.000
#> SRR330895 2 0.4492 0.3305 0.000 0.720 0.004 0.204 0.060 0.012
#> SRR330896 4 0.0146 0.9001 0.000 0.000 0.000 0.996 0.004 0.000
#> SRR330897 2 0.2926 0.4445 0.004 0.880 0.040 0.004 0.032 0.040
#> SRR330898 2 0.6339 0.3191 0.008 0.584 0.084 0.004 0.232 0.088
#> SRR330899 4 0.1411 0.8606 0.000 0.060 0.000 0.936 0.004 0.000
#> SRR330900 4 0.1586 0.8725 0.004 0.040 0.012 0.940 0.004 0.000
#> SRR330901 4 0.0291 0.8995 0.000 0.004 0.000 0.992 0.004 0.000
#> SRR330902 4 0.3478 0.7308 0.000 0.100 0.004 0.828 0.056 0.012
#> SRR330903 4 0.0146 0.9001 0.000 0.000 0.000 0.996 0.004 0.000
#> SRR330904 4 0.2664 0.6771 0.000 0.000 0.000 0.816 0.184 0.000
#> SRR330906 5 0.4306 0.3134 0.000 0.012 0.004 0.464 0.520 0.000
#> SRR330907 4 0.0291 0.9003 0.000 0.004 0.000 0.992 0.004 0.000
#> SRR330908 4 0.0405 0.8996 0.000 0.000 0.004 0.988 0.008 0.000
#> SRR330909 5 0.8839 -0.2079 0.036 0.076 0.244 0.128 0.356 0.160
#> SRR330910 4 0.3803 0.7211 0.004 0.008 0.060 0.828 0.064 0.036
#> SRR330911 4 0.0000 0.9002 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR330912 4 0.0582 0.8993 0.000 0.004 0.004 0.984 0.004 0.004
#> SRR330913 4 0.2053 0.8041 0.000 0.108 0.004 0.888 0.000 0.000
#> SRR330914 4 0.0508 0.8951 0.000 0.012 0.004 0.984 0.000 0.000
#> SRR330915 4 0.0000 0.9002 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR330916 4 0.0000 0.9002 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR330917 4 0.3869 0.5373 0.000 0.240 0.020 0.732 0.004 0.004
#> SRR330918 3 0.3834 0.0000 0.032 0.108 0.812 0.008 0.040 0.000
#> SRR330919 4 0.0291 0.9002 0.000 0.004 0.004 0.992 0.000 0.000
#> SRR330920 4 0.0405 0.9002 0.000 0.000 0.008 0.988 0.004 0.000
#> SRR330921 4 0.0000 0.9002 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR330922 4 0.0291 0.8999 0.000 0.000 0.004 0.992 0.004 0.000
#> SRR330923 4 0.0405 0.9002 0.000 0.000 0.008 0.988 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)
consensus_heatmap(res, k = 3)
consensus_heatmap(res, k = 4)
consensus_heatmap(res, k = 5)
consensus_heatmap(res, k = 6)
Heatmaps for the membership of samples in all partitions to see how consistent they are:
membership_heatmap(res, k = 2)
membership_heatmap(res, k = 3)
membership_heatmap(res, k = 4)
membership_heatmap(res, k = 5)
membership_heatmap(res, k = 6)
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)
get_signatures(res, k = 3)
get_signatures(res, k = 4)
get_signatures(res, k = 5)
get_signatures(res, k = 6)
Signature heatmaps where rows are not scaled:
get_signatures(res, k = 2, scale_rows = FALSE)
get_signatures(res, k = 3, scale_rows = FALSE)
get_signatures(res, k = 4, scale_rows = FALSE)
get_signatures(res, k = 5, scale_rows = FALSE)
get_signatures(res, k = 6, scale_rows = FALSE)
Compare the overlap of signatures from different k:
compare_signatures(res)
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:
which_row
: row indices corresponding to the input matrix.fdr
: FDR for the differential test. mean_x
: The mean value in group x.scaled_mean_x
: The mean value in group x after rows are scaled.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")
dimension_reduction(res, k = 3, method = "UMAP")
dimension_reduction(res, k = 4, method = "UMAP")
dimension_reduction(res, k = 5, method = "UMAP")
dimension_reduction(res, k = 6, method = "UMAP")
Following heatmap shows how subgroups are split when increasing k
:
collect_classes(res)
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.
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 10869 rows and 66 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)
The plots are:
k
and the heatmap of
predicted classes for each k
.k
.k
.k
.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:
k
;k
, the area increased is defined as \(A_k - A_{k-1}\).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)
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.613 0.890 0.942 0.2561 0.784 0.784
#> 3 3 0.295 0.746 0.854 0.3745 0.997 0.996
#> 4 4 0.265 0.744 0.850 0.0398 0.995 0.994
#> 5 5 0.263 0.684 0.812 0.0477 0.973 0.966
#> 6 6 0.260 0.702 0.855 0.0280 0.998 0.998
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.
cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#> class entropy silhouette p1 p2
#> SRR330857 1 0.0000 0.938 1.000 0.000
#> SRR330858 1 0.0000 0.938 1.000 0.000
#> SRR330859 1 0.0938 0.934 0.988 0.012
#> SRR330860 2 0.5408 0.852 0.124 0.876
#> SRR330861 1 0.0938 0.934 0.988 0.012
#> SRR330862 1 0.3114 0.913 0.944 0.056
#> SRR330863 1 0.0938 0.934 0.988 0.012
#> SRR330864 1 0.3114 0.913 0.944 0.056
#> SRR330865 1 0.0000 0.938 1.000 0.000
#> SRR330866 1 0.7745 0.753 0.772 0.228
#> SRR330867 1 0.0000 0.938 1.000 0.000
#> SRR330868 1 0.3114 0.913 0.944 0.056
#> SRR330869 1 0.0000 0.938 1.000 0.000
#> SRR330870 1 0.0000 0.938 1.000 0.000
#> SRR330871 1 0.0938 0.934 0.988 0.012
#> SRR330872 1 0.3114 0.913 0.944 0.056
#> SRR330873 1 0.0000 0.938 1.000 0.000
#> SRR330874 2 0.0000 0.899 0.000 1.000
#> SRR330875 1 0.0000 0.938 1.000 0.000
#> SRR330876 1 0.0000 0.938 1.000 0.000
#> SRR330877 1 0.0938 0.934 0.988 0.012
#> SRR330878 1 0.0000 0.938 1.000 0.000
#> SRR330879 1 0.0938 0.934 0.988 0.012
#> SRR330880 1 0.3114 0.913 0.944 0.056
#> SRR330881 1 0.0000 0.938 1.000 0.000
#> SRR330882 1 0.0000 0.938 1.000 0.000
#> SRR330883 2 0.0000 0.899 0.000 1.000
#> SRR330884 1 0.0000 0.938 1.000 0.000
#> SRR330885 1 0.6148 0.837 0.848 0.152
#> SRR330886 1 0.0000 0.938 1.000 0.000
#> SRR330887 1 0.0000 0.938 1.000 0.000
#> SRR330888 1 0.0000 0.938 1.000 0.000
#> SRR330889 1 0.7745 0.753 0.772 0.228
#> SRR330890 1 0.6438 0.822 0.836 0.164
#> SRR330891 1 0.7674 0.756 0.776 0.224
#> SRR330892 2 0.0000 0.899 0.000 1.000
#> SRR330893 1 0.7745 0.753 0.772 0.228
#> SRR330894 1 0.7745 0.753 0.772 0.228
#> SRR330895 2 0.6438 0.813 0.164 0.836
#> SRR330896 1 0.4815 0.875 0.896 0.104
#> SRR330897 2 0.2423 0.894 0.040 0.960
#> SRR330898 2 0.0000 0.899 0.000 1.000
#> SRR330899 1 0.0000 0.938 1.000 0.000
#> SRR330900 1 0.0000 0.938 1.000 0.000
#> SRR330901 1 0.0000 0.938 1.000 0.000
#> SRR330902 1 0.0000 0.938 1.000 0.000
#> SRR330903 1 0.5737 0.851 0.864 0.136
#> SRR330904 2 0.8713 0.595 0.292 0.708
#> SRR330906 1 0.6531 0.782 0.832 0.168
#> SRR330907 1 0.0000 0.938 1.000 0.000
#> SRR330908 1 0.7745 0.753 0.772 0.228
#> SRR330909 1 0.0000 0.938 1.000 0.000
#> SRR330910 1 0.0938 0.933 0.988 0.012
#> SRR330911 1 0.7745 0.753 0.772 0.228
#> SRR330912 1 0.8608 0.664 0.716 0.284
#> SRR330913 1 0.0000 0.938 1.000 0.000
#> SRR330914 1 0.0000 0.938 1.000 0.000
#> SRR330915 1 0.0000 0.938 1.000 0.000
#> SRR330916 1 0.7745 0.753 0.772 0.228
#> SRR330917 1 0.0000 0.938 1.000 0.000
#> SRR330918 1 0.0000 0.938 1.000 0.000
#> SRR330919 1 0.0000 0.938 1.000 0.000
#> SRR330920 1 0.0000 0.938 1.000 0.000
#> SRR330921 1 0.0000 0.938 1.000 0.000
#> SRR330922 1 0.0000 0.938 1.000 0.000
#> SRR330923 1 0.0000 0.938 1.000 0.000
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> SRR330857 1 0.4702 0.745 0.788 0.000 0.212
#> SRR330858 1 0.4702 0.745 0.788 0.000 0.212
#> SRR330859 1 0.3482 0.831 0.872 0.000 0.128
#> SRR330860 3 0.8094 0.000 0.124 0.240 0.636
#> SRR330861 1 0.3482 0.831 0.872 0.000 0.128
#> SRR330862 1 0.3947 0.816 0.884 0.040 0.076
#> SRR330863 1 0.3482 0.831 0.872 0.000 0.128
#> SRR330864 1 0.3947 0.816 0.884 0.040 0.076
#> SRR330865 1 0.4555 0.789 0.800 0.000 0.200
#> SRR330866 1 0.6810 0.664 0.720 0.212 0.068
#> SRR330867 1 0.4555 0.789 0.800 0.000 0.200
#> SRR330868 1 0.3947 0.816 0.884 0.040 0.076
#> SRR330869 1 0.0000 0.845 1.000 0.000 0.000
#> SRR330870 1 0.4702 0.745 0.788 0.000 0.212
#> SRR330871 1 0.3551 0.830 0.868 0.000 0.132
#> SRR330872 1 0.3947 0.816 0.884 0.040 0.076
#> SRR330873 1 0.4702 0.745 0.788 0.000 0.212
#> SRR330874 2 0.1964 0.669 0.000 0.944 0.056
#> SRR330875 1 0.4702 0.745 0.788 0.000 0.212
#> SRR330876 1 0.4702 0.745 0.788 0.000 0.212
#> SRR330877 1 0.3482 0.831 0.872 0.000 0.128
#> SRR330878 1 0.4702 0.745 0.788 0.000 0.212
#> SRR330879 1 0.2625 0.841 0.916 0.000 0.084
#> SRR330880 1 0.3947 0.816 0.884 0.040 0.076
#> SRR330881 1 0.4702 0.745 0.788 0.000 0.212
#> SRR330882 1 0.4842 0.784 0.776 0.000 0.224
#> SRR330883 2 0.0237 0.678 0.000 0.996 0.004
#> SRR330884 1 0.0237 0.845 0.996 0.000 0.004
#> SRR330885 1 0.5961 0.746 0.788 0.136 0.076
#> SRR330886 1 0.2878 0.818 0.904 0.000 0.096
#> SRR330887 1 0.0237 0.845 0.996 0.000 0.004
#> SRR330888 1 0.0237 0.845 0.996 0.000 0.004
#> SRR330889 1 0.6810 0.664 0.720 0.212 0.068
#> SRR330890 1 0.4741 0.758 0.828 0.152 0.020
#> SRR330891 1 0.6446 0.675 0.736 0.212 0.052
#> SRR330892 2 0.1964 0.669 0.000 0.944 0.056
#> SRR330893 1 0.6723 0.667 0.724 0.212 0.064
#> SRR330894 1 0.6633 0.669 0.728 0.212 0.060
#> SRR330895 2 0.4634 0.383 0.164 0.824 0.012
#> SRR330896 1 0.3670 0.805 0.888 0.092 0.020
#> SRR330897 2 0.1765 0.650 0.040 0.956 0.004
#> SRR330898 2 0.1411 0.681 0.000 0.964 0.036
#> SRR330899 1 0.0237 0.845 0.996 0.000 0.004
#> SRR330900 1 0.0237 0.845 0.996 0.000 0.004
#> SRR330901 1 0.0237 0.845 0.996 0.000 0.004
#> SRR330902 1 0.0237 0.845 0.996 0.000 0.004
#> SRR330903 1 0.5237 0.770 0.824 0.120 0.056
#> SRR330904 2 0.7187 0.154 0.232 0.692 0.076
#> SRR330906 1 0.4293 0.726 0.832 0.164 0.004
#> SRR330907 1 0.4702 0.745 0.788 0.000 0.212
#> SRR330908 1 0.6541 0.672 0.732 0.212 0.056
#> SRR330909 1 0.4605 0.752 0.796 0.000 0.204
#> SRR330910 1 0.1182 0.843 0.976 0.012 0.012
#> SRR330911 1 0.6810 0.664 0.720 0.212 0.068
#> SRR330912 1 0.7512 0.564 0.656 0.268 0.076
#> SRR330913 1 0.0000 0.845 1.000 0.000 0.000
#> SRR330914 1 0.0237 0.845 0.996 0.000 0.004
#> SRR330915 1 0.0237 0.845 0.996 0.000 0.004
#> SRR330916 1 0.6810 0.664 0.720 0.212 0.068
#> SRR330917 1 0.0000 0.845 1.000 0.000 0.000
#> SRR330918 1 0.4702 0.748 0.788 0.000 0.212
#> SRR330919 1 0.0000 0.845 1.000 0.000 0.000
#> SRR330920 1 0.0237 0.845 0.996 0.000 0.004
#> SRR330921 1 0.0237 0.845 0.996 0.000 0.004
#> SRR330922 1 0.0237 0.845 0.996 0.000 0.004
#> SRR330923 1 0.0237 0.845 0.996 0.000 0.004
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> SRR330857 1 0.3907 0.732 0.768 0.000 0.232 0.000
#> SRR330858 1 0.3907 0.732 0.768 0.000 0.232 0.000
#> SRR330859 1 0.2760 0.830 0.872 0.000 0.128 0.000
#> SRR330860 3 0.7940 0.000 0.080 0.336 0.512 0.072
#> SRR330861 1 0.2760 0.830 0.872 0.000 0.128 0.000
#> SRR330862 1 0.2589 0.816 0.884 0.000 0.116 0.000
#> SRR330863 1 0.2760 0.830 0.872 0.000 0.128 0.000
#> SRR330864 1 0.2589 0.816 0.884 0.000 0.116 0.000
#> SRR330865 1 0.3801 0.778 0.780 0.000 0.220 0.000
#> SRR330866 1 0.4277 0.665 0.720 0.000 0.280 0.000
#> SRR330867 1 0.3801 0.778 0.780 0.000 0.220 0.000
#> SRR330868 1 0.2589 0.816 0.884 0.000 0.116 0.000
#> SRR330869 1 0.0000 0.844 1.000 0.000 0.000 0.000
#> SRR330870 1 0.3907 0.732 0.768 0.000 0.232 0.000
#> SRR330871 1 0.2814 0.830 0.868 0.000 0.132 0.000
#> SRR330872 1 0.2589 0.816 0.884 0.000 0.116 0.000
#> SRR330873 1 0.3907 0.732 0.768 0.000 0.232 0.000
#> SRR330874 4 0.1059 1.000 0.000 0.016 0.012 0.972
#> SRR330875 1 0.3907 0.732 0.768 0.000 0.232 0.000
#> SRR330876 1 0.3907 0.732 0.768 0.000 0.232 0.000
#> SRR330877 1 0.2760 0.830 0.872 0.000 0.128 0.000
#> SRR330878 1 0.3907 0.732 0.768 0.000 0.232 0.000
#> SRR330879 1 0.2081 0.840 0.916 0.000 0.084 0.000
#> SRR330880 1 0.2589 0.816 0.884 0.000 0.116 0.000
#> SRR330881 1 0.3907 0.732 0.768 0.000 0.232 0.000
#> SRR330882 1 0.4546 0.786 0.772 0.012 0.204 0.012
#> SRR330883 2 0.6722 0.404 0.000 0.616 0.200 0.184
#> SRR330884 1 0.0188 0.844 0.996 0.000 0.004 0.000
#> SRR330885 1 0.3726 0.747 0.788 0.000 0.212 0.000
#> SRR330886 1 0.2281 0.819 0.904 0.000 0.096 0.000
#> SRR330887 1 0.0188 0.844 0.996 0.000 0.004 0.000
#> SRR330888 1 0.0188 0.844 0.996 0.000 0.004 0.000
#> SRR330889 1 0.4277 0.665 0.720 0.000 0.280 0.000
#> SRR330890 1 0.3311 0.758 0.828 0.000 0.172 0.000
#> SRR330891 1 0.4164 0.675 0.736 0.000 0.264 0.000
#> SRR330892 4 0.1059 1.000 0.000 0.016 0.012 0.972
#> SRR330893 1 0.4250 0.667 0.724 0.000 0.276 0.000
#> SRR330894 1 0.4222 0.670 0.728 0.000 0.272 0.000
#> SRR330895 2 0.6839 0.454 0.164 0.616 0.216 0.004
#> SRR330896 1 0.2530 0.805 0.888 0.000 0.112 0.000
#> SRR330897 2 0.5524 0.494 0.040 0.736 0.200 0.024
#> SRR330898 2 0.7013 0.270 0.000 0.556 0.152 0.292
#> SRR330899 1 0.0188 0.844 0.996 0.000 0.004 0.000
#> SRR330900 1 0.0188 0.844 0.996 0.000 0.004 0.000
#> SRR330901 1 0.0188 0.844 0.996 0.000 0.004 0.000
#> SRR330902 1 0.0188 0.844 0.996 0.000 0.004 0.000
#> SRR330903 1 0.3356 0.770 0.824 0.000 0.176 0.000
#> SRR330904 2 0.7739 0.315 0.232 0.476 0.288 0.004
#> SRR330906 1 0.3812 0.733 0.832 0.140 0.028 0.000
#> SRR330907 1 0.3907 0.732 0.768 0.000 0.232 0.000
#> SRR330908 1 0.4193 0.673 0.732 0.000 0.268 0.000
#> SRR330909 1 0.3837 0.739 0.776 0.000 0.224 0.000
#> SRR330910 1 0.0817 0.841 0.976 0.000 0.024 0.000
#> SRR330911 1 0.4277 0.665 0.720 0.000 0.280 0.000
#> SRR330912 1 0.5745 0.566 0.656 0.056 0.288 0.000
#> SRR330913 1 0.0000 0.844 1.000 0.000 0.000 0.000
#> SRR330914 1 0.0188 0.844 0.996 0.000 0.004 0.000
#> SRR330915 1 0.0188 0.844 0.996 0.000 0.004 0.000
#> SRR330916 1 0.4277 0.665 0.720 0.000 0.280 0.000
#> SRR330917 1 0.0000 0.844 1.000 0.000 0.000 0.000
#> SRR330918 1 0.4788 0.715 0.744 0.008 0.232 0.016
#> SRR330919 1 0.0000 0.844 1.000 0.000 0.000 0.000
#> SRR330920 1 0.0188 0.844 0.996 0.000 0.004 0.000
#> SRR330921 1 0.0188 0.844 0.996 0.000 0.004 0.000
#> SRR330922 1 0.0188 0.844 0.996 0.000 0.004 0.000
#> SRR330923 1 0.0188 0.844 0.996 0.000 0.004 0.000
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> SRR330857 1 0.3366 0.613 0.768 0.000 0.000 0.000 0.232
#> SRR330858 1 0.3366 0.613 0.768 0.000 0.000 0.000 0.232
#> SRR330859 1 0.2796 0.782 0.868 0.008 0.008 0.000 0.116
#> SRR330860 3 0.3149 0.000 0.012 0.080 0.868 0.040 0.000
#> SRR330861 1 0.2796 0.782 0.868 0.008 0.008 0.000 0.116
#> SRR330862 1 0.3064 0.778 0.880 0.044 0.024 0.000 0.052
#> SRR330863 1 0.2796 0.782 0.868 0.008 0.008 0.000 0.116
#> SRR330864 1 0.3064 0.778 0.880 0.044 0.024 0.000 0.052
#> SRR330865 1 0.3430 0.690 0.776 0.000 0.004 0.000 0.220
#> SRR330866 1 0.4866 0.623 0.720 0.216 0.020 0.000 0.044
#> SRR330867 1 0.3430 0.690 0.776 0.000 0.004 0.000 0.220
#> SRR330868 1 0.3064 0.778 0.880 0.044 0.024 0.000 0.052
#> SRR330869 1 0.0000 0.807 1.000 0.000 0.000 0.000 0.000
#> SRR330870 1 0.3366 0.613 0.768 0.000 0.000 0.000 0.232
#> SRR330871 1 0.2907 0.782 0.864 0.012 0.008 0.000 0.116
#> SRR330872 1 0.3064 0.778 0.880 0.044 0.024 0.000 0.052
#> SRR330873 1 0.3366 0.613 0.768 0.000 0.000 0.000 0.232
#> SRR330874 4 0.0000 1.000 0.000 0.000 0.000 1.000 0.000
#> SRR330875 1 0.3366 0.613 0.768 0.000 0.000 0.000 0.232
#> SRR330876 1 0.3366 0.613 0.768 0.000 0.000 0.000 0.232
#> SRR330877 1 0.2796 0.782 0.868 0.008 0.008 0.000 0.116
#> SRR330878 1 0.3366 0.613 0.768 0.000 0.000 0.000 0.232
#> SRR330879 1 0.2102 0.799 0.916 0.012 0.004 0.000 0.068
#> SRR330880 1 0.3064 0.778 0.880 0.044 0.024 0.000 0.052
#> SRR330881 1 0.3366 0.613 0.768 0.000 0.000 0.000 0.232
#> SRR330882 1 0.4701 0.616 0.720 0.000 0.076 0.000 0.204
#> SRR330883 2 0.4937 0.332 0.000 0.752 0.040 0.060 0.148
#> SRR330884 1 0.0162 0.807 0.996 0.004 0.000 0.000 0.000
#> SRR330885 1 0.4407 0.705 0.784 0.140 0.024 0.000 0.052
#> SRR330886 1 0.1965 0.761 0.904 0.000 0.000 0.000 0.096
#> SRR330887 1 0.0162 0.807 0.996 0.000 0.000 0.000 0.004
#> SRR330888 1 0.0162 0.807 0.996 0.000 0.000 0.000 0.004
#> SRR330889 1 0.4866 0.623 0.720 0.216 0.020 0.000 0.044
#> SRR330890 1 0.3053 0.715 0.828 0.164 0.000 0.000 0.008
#> SRR330891 1 0.4554 0.633 0.736 0.216 0.016 0.000 0.032
#> SRR330892 4 0.0000 1.000 0.000 0.000 0.000 1.000 0.000
#> SRR330893 1 0.4796 0.626 0.724 0.216 0.020 0.000 0.040
#> SRR330894 1 0.4722 0.628 0.728 0.216 0.020 0.000 0.036
#> SRR330895 2 0.3211 0.520 0.164 0.824 0.008 0.004 0.000
#> SRR330896 1 0.2358 0.765 0.888 0.104 0.000 0.000 0.008
#> SRR330897 2 0.1830 0.508 0.040 0.932 0.028 0.000 0.000
#> SRR330898 2 0.4374 0.270 0.000 0.700 0.028 0.272 0.000
#> SRR330899 1 0.0162 0.807 0.996 0.000 0.000 0.000 0.004
#> SRR330900 1 0.0162 0.807 0.996 0.000 0.000 0.000 0.004
#> SRR330901 1 0.0162 0.807 0.996 0.000 0.000 0.000 0.004
#> SRR330902 1 0.0162 0.807 0.996 0.000 0.000 0.000 0.004
#> SRR330903 1 0.3770 0.730 0.824 0.124 0.020 0.000 0.032
#> SRR330904 2 0.5326 0.401 0.228 0.692 0.024 0.004 0.052
#> SRR330906 1 0.2813 0.666 0.832 0.168 0.000 0.000 0.000
#> SRR330907 1 0.3366 0.613 0.768 0.000 0.000 0.000 0.232
#> SRR330908 1 0.4646 0.630 0.732 0.216 0.020 0.000 0.032
#> SRR330909 1 0.3305 0.623 0.776 0.000 0.000 0.000 0.224
#> SRR330910 1 0.0771 0.805 0.976 0.020 0.000 0.000 0.004
#> SRR330911 1 0.4866 0.623 0.720 0.216 0.020 0.000 0.044
#> SRR330912 1 0.5444 0.516 0.652 0.272 0.024 0.000 0.052
#> SRR330913 1 0.0000 0.807 1.000 0.000 0.000 0.000 0.000
#> SRR330914 1 0.0162 0.807 0.996 0.004 0.000 0.000 0.000
#> SRR330915 1 0.0162 0.807 0.996 0.000 0.000 0.000 0.004
#> SRR330916 1 0.4866 0.623 0.720 0.216 0.020 0.000 0.044
#> SRR330917 1 0.0000 0.807 1.000 0.000 0.000 0.000 0.000
#> SRR330918 5 0.4141 0.000 0.236 0.000 0.028 0.000 0.736
#> SRR330919 1 0.0000 0.807 1.000 0.000 0.000 0.000 0.000
#> SRR330920 1 0.0162 0.807 0.996 0.000 0.000 0.000 0.004
#> SRR330921 1 0.0162 0.807 0.996 0.000 0.000 0.000 0.004
#> SRR330922 1 0.0162 0.807 0.996 0.000 0.000 0.000 0.004
#> SRR330923 1 0.0162 0.807 0.996 0.000 0.000 0.000 0.004
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> SRR330857 4 0.3050 0.693 0.236 0.000 0.000 0.764 0.000 0.000
#> SRR330858 4 0.3050 0.693 0.236 0.000 0.000 0.764 0.000 0.000
#> SRR330859 4 0.2744 0.820 0.064 0.072 0.000 0.864 0.000 0.000
#> SRR330860 6 0.0458 0.000 0.000 0.016 0.000 0.000 0.000 0.984
#> SRR330861 4 0.2744 0.820 0.064 0.072 0.000 0.864 0.000 0.000
#> SRR330862 4 0.2092 0.810 0.000 0.124 0.000 0.876 0.000 0.000
#> SRR330863 4 0.2744 0.820 0.064 0.072 0.000 0.864 0.000 0.000
#> SRR330864 4 0.2092 0.810 0.000 0.124 0.000 0.876 0.000 0.000
#> SRR330865 4 0.3730 0.751 0.168 0.060 0.000 0.772 0.000 0.000
#> SRR330866 4 0.3309 0.667 0.000 0.280 0.000 0.720 0.000 0.000
#> SRR330867 4 0.3730 0.751 0.168 0.060 0.000 0.772 0.000 0.000
#> SRR330868 4 0.2092 0.810 0.000 0.124 0.000 0.876 0.000 0.000
#> SRR330869 4 0.0000 0.839 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR330870 4 0.3050 0.693 0.236 0.000 0.000 0.764 0.000 0.000
#> SRR330871 4 0.2799 0.820 0.064 0.076 0.000 0.860 0.000 0.000
#> SRR330872 4 0.2092 0.810 0.000 0.124 0.000 0.876 0.000 0.000
#> SRR330873 4 0.3050 0.693 0.236 0.000 0.000 0.764 0.000 0.000
#> SRR330874 5 0.0000 1.000 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR330875 4 0.3050 0.693 0.236 0.000 0.000 0.764 0.000 0.000
#> SRR330876 4 0.3050 0.693 0.236 0.000 0.000 0.764 0.000 0.000
#> SRR330877 4 0.2744 0.820 0.064 0.072 0.000 0.864 0.000 0.000
#> SRR330878 4 0.3050 0.693 0.236 0.000 0.000 0.764 0.000 0.000
#> SRR330879 4 0.1934 0.834 0.040 0.044 0.000 0.916 0.000 0.000
#> SRR330880 4 0.2092 0.810 0.000 0.124 0.000 0.876 0.000 0.000
#> SRR330881 4 0.3050 0.693 0.236 0.000 0.000 0.764 0.000 0.000
#> SRR330882 4 0.5486 0.587 0.168 0.036 0.132 0.660 0.000 0.004
#> SRR330883 3 0.3686 0.000 0.000 0.228 0.748 0.000 0.012 0.012
#> SRR330884 4 0.0146 0.839 0.000 0.004 0.000 0.996 0.000 0.000
#> SRR330885 4 0.2941 0.744 0.000 0.220 0.000 0.780 0.000 0.000
#> SRR330886 4 0.1814 0.803 0.100 0.000 0.000 0.900 0.000 0.000
#> SRR330887 4 0.0146 0.839 0.004 0.000 0.000 0.996 0.000 0.000
#> SRR330888 4 0.0146 0.839 0.004 0.000 0.000 0.996 0.000 0.000
#> SRR330889 4 0.3309 0.667 0.000 0.280 0.000 0.720 0.000 0.000
#> SRR330890 4 0.2562 0.758 0.000 0.172 0.000 0.828 0.000 0.000
#> SRR330891 4 0.3221 0.678 0.000 0.264 0.000 0.736 0.000 0.000
#> SRR330892 5 0.0000 1.000 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR330893 4 0.3288 0.669 0.000 0.276 0.000 0.724 0.000 0.000
#> SRR330894 4 0.3266 0.672 0.000 0.272 0.000 0.728 0.000 0.000
#> SRR330895 2 0.4247 0.391 0.000 0.740 0.092 0.164 0.004 0.000
#> SRR330896 4 0.1957 0.802 0.000 0.112 0.000 0.888 0.000 0.000
#> SRR330897 2 0.3769 0.142 0.000 0.776 0.176 0.036 0.000 0.012
#> SRR330898 2 0.5836 -0.146 0.000 0.540 0.176 0.000 0.272 0.012
#> SRR330899 4 0.0146 0.839 0.004 0.000 0.000 0.996 0.000 0.000
#> SRR330900 4 0.0146 0.839 0.004 0.000 0.000 0.996 0.000 0.000
#> SRR330901 4 0.0146 0.839 0.004 0.000 0.000 0.996 0.000 0.000
#> SRR330902 4 0.0146 0.839 0.004 0.000 0.000 0.996 0.000 0.000
#> SRR330903 4 0.2597 0.769 0.000 0.176 0.000 0.824 0.000 0.000
#> SRR330904 2 0.3109 0.335 0.000 0.772 0.000 0.224 0.004 0.000
#> SRR330906 4 0.2527 0.729 0.000 0.168 0.000 0.832 0.000 0.000
#> SRR330907 4 0.3050 0.693 0.236 0.000 0.000 0.764 0.000 0.000
#> SRR330908 4 0.3244 0.675 0.000 0.268 0.000 0.732 0.000 0.000
#> SRR330909 4 0.2996 0.699 0.228 0.000 0.000 0.772 0.000 0.000
#> SRR330910 4 0.0632 0.836 0.000 0.024 0.000 0.976 0.000 0.000
#> SRR330911 4 0.3309 0.667 0.000 0.280 0.000 0.720 0.000 0.000
#> SRR330912 4 0.3620 0.565 0.000 0.352 0.000 0.648 0.000 0.000
#> SRR330913 4 0.0000 0.839 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR330914 4 0.0146 0.839 0.000 0.004 0.000 0.996 0.000 0.000
#> SRR330915 4 0.0146 0.839 0.004 0.000 0.000 0.996 0.000 0.000
#> SRR330916 4 0.3309 0.667 0.000 0.280 0.000 0.720 0.000 0.000
#> SRR330917 4 0.0000 0.839 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR330918 1 0.2412 0.000 0.880 0.000 0.028 0.092 0.000 0.000
#> SRR330919 4 0.0000 0.839 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR330920 4 0.0146 0.839 0.004 0.000 0.000 0.996 0.000 0.000
#> SRR330921 4 0.0146 0.839 0.004 0.000 0.000 0.996 0.000 0.000
#> SRR330922 4 0.0146 0.839 0.004 0.000 0.000 0.996 0.000 0.000
#> SRR330923 4 0.0146 0.839 0.004 0.000 0.000 0.996 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)
consensus_heatmap(res, k = 3)
consensus_heatmap(res, k = 4)
consensus_heatmap(res, k = 5)
consensus_heatmap(res, k = 6)
Heatmaps for the membership of samples in all partitions to see how consistent they are:
membership_heatmap(res, k = 2)
membership_heatmap(res, k = 3)
membership_heatmap(res, k = 4)
membership_heatmap(res, k = 5)
membership_heatmap(res, k = 6)
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)
get_signatures(res, k = 3)
get_signatures(res, k = 4)
get_signatures(res, k = 5)
get_signatures(res, k = 6)
Signature heatmaps where rows are not scaled:
get_signatures(res, k = 2, scale_rows = FALSE)
get_signatures(res, k = 3, scale_rows = FALSE)
get_signatures(res, k = 4, scale_rows = FALSE)
get_signatures(res, k = 5, scale_rows = FALSE)
get_signatures(res, k = 6, scale_rows = FALSE)
Compare the overlap of signatures from different k:
compare_signatures(res)
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:
which_row
: row indices corresponding to the input matrix.fdr
: FDR for the differential test. mean_x
: The mean value in group x.scaled_mean_x
: The mean value in group x after rows are scaled.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")
dimension_reduction(res, k = 3, method = "UMAP")
dimension_reduction(res, k = 4, method = "UMAP")
dimension_reduction(res, k = 5, method = "UMAP")
dimension_reduction(res, k = 6, method = "UMAP")
Following heatmap shows how subgroups are split when increasing k
:
collect_classes(res)
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.
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 10869 rows and 66 columns.
#> Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'MAD' method.
#> Subgroups are detected by 'kmeans' method.
#> Performed in total 1250 partitions by row resampling.
#> Best k for subgroups seems to be 3.
#>
#> Following methods can be applied to this 'ConsensusPartition' object:
#> [1] "cola_report" "collect_classes" "collect_plots"
#> [4] "collect_stats" "colnames" "compare_signatures"
#> [7] "consensus_heatmap" "dimension_reduction" "functional_enrichment"
#> [10] "get_anno_col" "get_anno" "get_classes"
#> [13] "get_consensus" "get_matrix" "get_membership"
#> [16] "get_param" "get_signatures" "get_stats"
#> [19] "is_best_k" "is_stable_k" "membership_heatmap"
#> [22] "ncol" "nrow" "plot_ecdf"
#> [25] "rownames" "select_partition_number" "show"
#> [28] "suggest_best_k" "test_to_known_factors"
collect_plots()
function collects all the plots made from res
for all k
(number of partitions)
into one single page to provide an easy and fast comparison between different k
.
collect_plots(res)
The plots are:
k
and the heatmap of
predicted classes for each k
.k
.k
.k
.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:
k
;k
, the area increased is defined as \(A_k - A_{k-1}\).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)
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.524 0.702 0.869 0.3721 0.559 0.559
#> 3 3 0.577 0.912 0.912 0.5356 0.679 0.497
#> 4 4 0.576 0.762 0.831 0.1506 1.000 1.000
#> 5 5 0.602 0.640 0.729 0.0884 0.824 0.562
#> 6 6 0.626 0.669 0.751 0.0474 0.927 0.725
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.
cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#> class entropy silhouette p1 p2
#> SRR330857 1 0.0000 0.894 1.000 0.000
#> SRR330858 1 0.0000 0.894 1.000 0.000
#> SRR330859 1 0.0000 0.894 1.000 0.000
#> SRR330860 2 0.0000 0.651 0.000 1.000
#> SRR330861 1 0.0000 0.894 1.000 0.000
#> SRR330862 2 0.9881 0.611 0.436 0.564
#> SRR330863 1 0.0000 0.894 1.000 0.000
#> SRR330864 2 0.9881 0.611 0.436 0.564
#> SRR330865 1 0.0000 0.894 1.000 0.000
#> SRR330866 2 0.9815 0.633 0.420 0.580
#> SRR330867 1 0.0000 0.894 1.000 0.000
#> SRR330868 2 0.9881 0.611 0.436 0.564
#> SRR330869 1 0.6148 0.707 0.848 0.152
#> SRR330870 1 0.0000 0.894 1.000 0.000
#> SRR330871 1 0.0000 0.894 1.000 0.000
#> SRR330872 1 0.9988 -0.393 0.520 0.480
#> SRR330873 1 0.0000 0.894 1.000 0.000
#> SRR330874 2 0.0000 0.651 0.000 1.000
#> SRR330875 1 0.0000 0.894 1.000 0.000
#> SRR330876 1 0.0000 0.894 1.000 0.000
#> SRR330877 1 0.0000 0.894 1.000 0.000
#> SRR330878 1 0.0000 0.894 1.000 0.000
#> SRR330879 1 0.0000 0.894 1.000 0.000
#> SRR330880 1 0.9988 -0.393 0.520 0.480
#> SRR330881 1 0.0000 0.894 1.000 0.000
#> SRR330882 1 0.0376 0.890 0.996 0.004
#> SRR330883 2 0.0000 0.651 0.000 1.000
#> SRR330884 1 0.5294 0.755 0.880 0.120
#> SRR330885 2 0.9881 0.611 0.436 0.564
#> SRR330886 1 0.0000 0.894 1.000 0.000
#> SRR330887 1 0.0000 0.894 1.000 0.000
#> SRR330888 1 0.0000 0.894 1.000 0.000
#> SRR330889 2 0.9881 0.611 0.436 0.564
#> SRR330890 1 0.9977 -0.365 0.528 0.472
#> SRR330891 2 0.9815 0.633 0.420 0.580
#> SRR330892 2 0.0000 0.651 0.000 1.000
#> SRR330893 2 0.9815 0.633 0.420 0.580
#> SRR330894 2 0.9815 0.633 0.420 0.580
#> SRR330895 2 0.0000 0.651 0.000 1.000
#> SRR330896 1 0.5946 0.720 0.856 0.144
#> SRR330897 2 0.0000 0.651 0.000 1.000
#> SRR330898 2 0.0000 0.651 0.000 1.000
#> SRR330899 1 0.0000 0.894 1.000 0.000
#> SRR330900 1 0.0000 0.894 1.000 0.000
#> SRR330901 1 0.0000 0.894 1.000 0.000
#> SRR330902 1 0.0000 0.894 1.000 0.000
#> SRR330903 1 0.9954 -0.323 0.540 0.460
#> SRR330904 2 0.0000 0.651 0.000 1.000
#> SRR330906 1 0.9732 -0.102 0.596 0.404
#> SRR330907 1 0.0000 0.894 1.000 0.000
#> SRR330908 2 0.9881 0.611 0.436 0.564
#> SRR330909 1 0.0000 0.894 1.000 0.000
#> SRR330910 1 0.3114 0.837 0.944 0.056
#> SRR330911 2 0.9815 0.633 0.420 0.580
#> SRR330912 2 0.9323 0.641 0.348 0.652
#> SRR330913 1 0.6148 0.707 0.848 0.152
#> SRR330914 1 0.8144 0.489 0.748 0.252
#> SRR330915 1 0.0000 0.894 1.000 0.000
#> SRR330916 2 0.9815 0.633 0.420 0.580
#> SRR330917 1 0.0000 0.894 1.000 0.000
#> SRR330918 1 0.0000 0.894 1.000 0.000
#> SRR330919 1 0.0000 0.894 1.000 0.000
#> SRR330920 1 0.0000 0.894 1.000 0.000
#> SRR330921 1 0.0000 0.894 1.000 0.000
#> SRR330922 1 0.0000 0.894 1.000 0.000
#> SRR330923 1 0.0000 0.894 1.000 0.000
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> SRR330857 3 0.0000 0.931 0.000 0.000 1.000
#> SRR330858 3 0.0000 0.931 0.000 0.000 1.000
#> SRR330859 3 0.0475 0.928 0.004 0.004 0.992
#> SRR330860 2 0.2537 0.955 0.080 0.920 0.000
#> SRR330861 3 0.0475 0.928 0.004 0.004 0.992
#> SRR330862 1 0.5212 0.885 0.828 0.064 0.108
#> SRR330863 3 0.3551 0.814 0.132 0.000 0.868
#> SRR330864 1 0.5285 0.881 0.824 0.064 0.112
#> SRR330865 3 0.0000 0.931 0.000 0.000 1.000
#> SRR330866 1 0.3120 0.943 0.908 0.012 0.080
#> SRR330867 3 0.0000 0.931 0.000 0.000 1.000
#> SRR330868 1 0.5285 0.881 0.824 0.064 0.112
#> SRR330869 1 0.3267 0.937 0.884 0.000 0.116
#> SRR330870 3 0.0000 0.931 0.000 0.000 1.000
#> SRR330871 3 0.0475 0.928 0.004 0.004 0.992
#> SRR330872 1 0.5428 0.883 0.816 0.064 0.120
#> SRR330873 3 0.0000 0.931 0.000 0.000 1.000
#> SRR330874 2 0.1529 0.974 0.040 0.960 0.000
#> SRR330875 3 0.0000 0.931 0.000 0.000 1.000
#> SRR330876 3 0.0000 0.931 0.000 0.000 1.000
#> SRR330877 3 0.0475 0.928 0.004 0.004 0.992
#> SRR330878 3 0.0000 0.931 0.000 0.000 1.000
#> SRR330879 1 0.6154 0.444 0.592 0.000 0.408
#> SRR330880 1 0.3845 0.927 0.872 0.012 0.116
#> SRR330881 3 0.0000 0.931 0.000 0.000 1.000
#> SRR330882 3 0.5058 0.863 0.148 0.032 0.820
#> SRR330883 2 0.1289 0.973 0.032 0.968 0.000
#> SRR330884 1 0.3340 0.934 0.880 0.000 0.120
#> SRR330885 1 0.2772 0.944 0.916 0.004 0.080
#> SRR330886 3 0.5621 0.501 0.308 0.000 0.692
#> SRR330887 3 0.3116 0.903 0.108 0.000 0.892
#> SRR330888 3 0.3116 0.903 0.108 0.000 0.892
#> SRR330889 1 0.2955 0.943 0.912 0.008 0.080
#> SRR330890 1 0.2796 0.944 0.908 0.000 0.092
#> SRR330891 1 0.3120 0.943 0.908 0.012 0.080
#> SRR330892 2 0.1529 0.974 0.040 0.960 0.000
#> SRR330893 1 0.3120 0.943 0.908 0.012 0.080
#> SRR330894 1 0.3120 0.943 0.908 0.012 0.080
#> SRR330895 2 0.1529 0.974 0.040 0.960 0.000
#> SRR330896 1 0.3267 0.937 0.884 0.000 0.116
#> SRR330897 2 0.1529 0.974 0.040 0.960 0.000
#> SRR330898 2 0.1753 0.973 0.048 0.952 0.000
#> SRR330899 3 0.3116 0.903 0.108 0.000 0.892
#> SRR330900 3 0.3267 0.897 0.116 0.000 0.884
#> SRR330901 3 0.3116 0.903 0.108 0.000 0.892
#> SRR330902 3 0.1031 0.930 0.024 0.000 0.976
#> SRR330903 1 0.2959 0.943 0.900 0.000 0.100
#> SRR330904 2 0.4002 0.847 0.160 0.840 0.000
#> SRR330906 1 0.3116 0.940 0.892 0.000 0.108
#> SRR330907 3 0.0000 0.931 0.000 0.000 1.000
#> SRR330908 1 0.2955 0.943 0.912 0.008 0.080
#> SRR330909 3 0.1031 0.930 0.024 0.000 0.976
#> SRR330910 1 0.3340 0.934 0.880 0.000 0.120
#> SRR330911 1 0.3120 0.943 0.908 0.012 0.080
#> SRR330912 1 0.3370 0.935 0.904 0.024 0.072
#> SRR330913 1 0.3267 0.937 0.884 0.000 0.116
#> SRR330914 1 0.3267 0.937 0.884 0.000 0.116
#> SRR330915 3 0.3116 0.903 0.108 0.000 0.892
#> SRR330916 1 0.3120 0.943 0.908 0.012 0.080
#> SRR330917 1 0.3340 0.934 0.880 0.000 0.120
#> SRR330918 3 0.4677 0.879 0.132 0.028 0.840
#> SRR330919 3 0.3267 0.897 0.116 0.000 0.884
#> SRR330920 3 0.1163 0.929 0.028 0.000 0.972
#> SRR330921 3 0.3116 0.903 0.108 0.000 0.892
#> SRR330922 3 0.3267 0.897 0.116 0.000 0.884
#> SRR330923 3 0.1031 0.930 0.024 0.000 0.976
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> SRR330857 1 0.0707 0.7955 0.980 0.000 NA 0.000
#> SRR330858 1 0.0592 0.7960 0.984 0.000 NA 0.000
#> SRR330859 1 0.4134 0.6856 0.740 0.000 NA 0.000
#> SRR330860 2 0.4040 0.8288 0.000 0.752 NA 0.000
#> SRR330861 1 0.4008 0.6863 0.756 0.000 NA 0.000
#> SRR330862 4 0.5831 0.5833 0.024 0.012 NA 0.616
#> SRR330863 1 0.5160 0.6859 0.760 0.000 NA 0.104
#> SRR330864 4 0.5922 0.5799 0.028 0.012 NA 0.612
#> SRR330865 1 0.1118 0.7959 0.964 0.000 NA 0.000
#> SRR330866 4 0.0592 0.8403 0.016 0.000 NA 0.984
#> SRR330867 1 0.0188 0.7968 0.996 0.000 NA 0.000
#> SRR330868 4 0.5922 0.5799 0.028 0.012 NA 0.612
#> SRR330869 4 0.3495 0.8041 0.016 0.000 NA 0.844
#> SRR330870 1 0.0707 0.7955 0.980 0.000 NA 0.000
#> SRR330871 1 0.4040 0.6842 0.752 0.000 NA 0.000
#> SRR330872 4 0.6009 0.5758 0.032 0.012 NA 0.608
#> SRR330873 1 0.0707 0.7955 0.980 0.000 NA 0.000
#> SRR330874 2 0.1970 0.9229 0.000 0.932 NA 0.008
#> SRR330875 1 0.0707 0.7955 0.980 0.000 NA 0.000
#> SRR330876 1 0.0707 0.7955 0.980 0.000 NA 0.000
#> SRR330877 1 0.4008 0.6863 0.756 0.000 NA 0.000
#> SRR330878 1 0.0707 0.7955 0.980 0.000 NA 0.000
#> SRR330879 4 0.7862 -0.0498 0.332 0.000 NA 0.388
#> SRR330880 4 0.5403 0.5965 0.024 0.000 NA 0.628
#> SRR330881 1 0.0817 0.7971 0.976 0.000 NA 0.000
#> SRR330882 1 0.6811 0.6081 0.496 0.000 NA 0.100
#> SRR330883 2 0.0188 0.9244 0.000 0.996 NA 0.004
#> SRR330884 4 0.3443 0.8046 0.016 0.000 NA 0.848
#> SRR330885 4 0.0779 0.8401 0.016 0.000 NA 0.980
#> SRR330886 1 0.7576 0.3648 0.472 0.000 NA 0.308
#> SRR330887 1 0.5740 0.7752 0.700 0.000 NA 0.092
#> SRR330888 1 0.5494 0.7803 0.716 0.000 NA 0.076
#> SRR330889 4 0.0927 0.8397 0.016 0.000 NA 0.976
#> SRR330890 4 0.1975 0.8343 0.016 0.000 NA 0.936
#> SRR330891 4 0.0592 0.8403 0.016 0.000 NA 0.984
#> SRR330892 2 0.1970 0.9229 0.000 0.932 NA 0.008
#> SRR330893 4 0.0592 0.8403 0.016 0.000 NA 0.984
#> SRR330894 4 0.0592 0.8403 0.016 0.000 NA 0.984
#> SRR330895 2 0.0336 0.9242 0.000 0.992 NA 0.008
#> SRR330896 4 0.3224 0.8132 0.016 0.000 NA 0.864
#> SRR330897 2 0.0188 0.9244 0.000 0.996 NA 0.004
#> SRR330898 2 0.1890 0.9236 0.000 0.936 NA 0.008
#> SRR330899 1 0.5740 0.7752 0.700 0.000 NA 0.092
#> SRR330900 1 0.5964 0.7652 0.684 0.000 NA 0.108
#> SRR330901 1 0.5740 0.7752 0.700 0.000 NA 0.092
#> SRR330902 1 0.3933 0.7939 0.792 0.000 NA 0.008
#> SRR330903 4 0.1297 0.8399 0.016 0.000 NA 0.964
#> SRR330904 2 0.4250 0.6442 0.000 0.724 NA 0.276
#> SRR330906 4 0.2909 0.8223 0.020 0.000 NA 0.888
#> SRR330907 1 0.0817 0.7971 0.976 0.000 NA 0.000
#> SRR330908 4 0.0592 0.8403 0.016 0.000 NA 0.984
#> SRR330909 1 0.3681 0.7963 0.816 0.000 NA 0.008
#> SRR330910 4 0.3335 0.8095 0.016 0.000 NA 0.856
#> SRR330911 4 0.0592 0.8403 0.016 0.000 NA 0.984
#> SRR330912 4 0.0657 0.8376 0.012 0.004 NA 0.984
#> SRR330913 4 0.3695 0.7896 0.016 0.000 NA 0.828
#> SRR330914 4 0.3280 0.8114 0.016 0.000 NA 0.860
#> SRR330915 1 0.5740 0.7752 0.700 0.000 NA 0.092
#> SRR330916 4 0.0592 0.8403 0.016 0.000 NA 0.984
#> SRR330917 4 0.4121 0.7620 0.020 0.000 NA 0.796
#> SRR330918 1 0.6666 0.6206 0.508 0.000 NA 0.088
#> SRR330919 1 0.6215 0.7499 0.664 0.000 NA 0.128
#> SRR330920 1 0.3591 0.7962 0.824 0.000 NA 0.008
#> SRR330921 1 0.5740 0.7752 0.700 0.000 NA 0.092
#> SRR330922 1 0.6068 0.7594 0.676 0.000 NA 0.116
#> SRR330923 1 0.2737 0.8022 0.888 0.000 NA 0.008
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> SRR330857 1 0.0000 0.702 1.000 0.000 0.000 0.000 0.000
#> SRR330858 1 0.0000 0.702 1.000 0.000 0.000 0.000 0.000
#> SRR330859 1 0.4747 0.477 0.636 0.000 0.332 0.000 0.032
#> SRR330860 2 0.5940 0.577 0.000 0.568 0.292 0.000 0.140
#> SRR330861 1 0.4118 0.497 0.660 0.000 0.336 0.000 0.004
#> SRR330862 3 0.4530 0.996 0.004 0.008 0.612 0.376 0.000
#> SRR330863 1 0.5435 0.489 0.692 0.000 0.212 0.052 0.044
#> SRR330864 3 0.4530 0.996 0.004 0.008 0.612 0.376 0.000
#> SRR330865 1 0.0865 0.691 0.972 0.000 0.024 0.000 0.004
#> SRR330866 4 0.0451 0.760 0.000 0.004 0.008 0.988 0.000
#> SRR330867 1 0.0000 0.702 1.000 0.000 0.000 0.000 0.000
#> SRR330868 3 0.4530 0.996 0.004 0.008 0.612 0.376 0.000
#> SRR330869 4 0.3957 0.660 0.000 0.000 0.008 0.712 0.280
#> SRR330870 1 0.0000 0.702 1.000 0.000 0.000 0.000 0.000
#> SRR330871 1 0.4288 0.456 0.612 0.000 0.384 0.000 0.004
#> SRR330872 3 0.4530 0.996 0.004 0.008 0.612 0.376 0.000
#> SRR330873 1 0.0000 0.702 1.000 0.000 0.000 0.000 0.000
#> SRR330874 2 0.4057 0.794 0.000 0.792 0.088 0.000 0.120
#> SRR330875 1 0.0162 0.702 0.996 0.000 0.004 0.000 0.000
#> SRR330876 1 0.0000 0.702 1.000 0.000 0.000 0.000 0.000
#> SRR330877 1 0.4118 0.497 0.660 0.000 0.336 0.000 0.004
#> SRR330878 1 0.0162 0.702 0.996 0.000 0.004 0.000 0.000
#> SRR330879 5 0.8058 0.512 0.268 0.000 0.160 0.152 0.420
#> SRR330880 3 0.4288 0.986 0.004 0.000 0.612 0.384 0.000
#> SRR330881 1 0.0290 0.697 0.992 0.000 0.000 0.000 0.008
#> SRR330882 5 0.5983 0.414 0.196 0.012 0.108 0.020 0.664
#> SRR330883 2 0.1774 0.795 0.000 0.932 0.016 0.000 0.052
#> SRR330884 4 0.3728 0.696 0.000 0.000 0.008 0.748 0.244
#> SRR330885 4 0.0404 0.764 0.000 0.000 0.012 0.988 0.000
#> SRR330886 5 0.7204 0.517 0.264 0.000 0.028 0.256 0.452
#> SRR330887 5 0.5753 0.762 0.456 0.000 0.012 0.056 0.476
#> SRR330888 5 0.5527 0.728 0.472 0.000 0.012 0.040 0.476
#> SRR330889 4 0.0510 0.756 0.000 0.000 0.016 0.984 0.000
#> SRR330890 4 0.2124 0.751 0.000 0.000 0.004 0.900 0.096
#> SRR330891 4 0.0324 0.763 0.000 0.004 0.004 0.992 0.000
#> SRR330892 2 0.3955 0.795 0.000 0.800 0.084 0.000 0.116
#> SRR330893 4 0.0324 0.763 0.000 0.004 0.004 0.992 0.000
#> SRR330894 4 0.0451 0.760 0.000 0.004 0.008 0.988 0.000
#> SRR330895 2 0.0290 0.805 0.000 0.992 0.000 0.008 0.000
#> SRR330896 4 0.3579 0.701 0.000 0.000 0.004 0.756 0.240
#> SRR330897 2 0.0000 0.806 0.000 1.000 0.000 0.000 0.000
#> SRR330898 2 0.3180 0.802 0.000 0.856 0.068 0.000 0.076
#> SRR330899 5 0.5753 0.762 0.456 0.000 0.012 0.056 0.476
#> SRR330900 5 0.5899 0.763 0.440 0.000 0.012 0.068 0.480
#> SRR330901 5 0.5753 0.762 0.456 0.000 0.012 0.056 0.476
#> SRR330902 1 0.4704 -0.673 0.508 0.000 0.004 0.008 0.480
#> SRR330903 4 0.0963 0.766 0.000 0.000 0.000 0.964 0.036
#> SRR330904 2 0.4593 0.152 0.000 0.512 0.004 0.480 0.004
#> SRR330906 4 0.3282 0.714 0.000 0.000 0.008 0.804 0.188
#> SRR330907 1 0.0794 0.679 0.972 0.000 0.000 0.000 0.028
#> SRR330908 4 0.0000 0.765 0.000 0.000 0.000 1.000 0.000
#> SRR330909 1 0.4504 -0.539 0.564 0.000 0.000 0.008 0.428
#> SRR330910 4 0.3662 0.692 0.000 0.000 0.004 0.744 0.252
#> SRR330911 4 0.0451 0.760 0.000 0.004 0.008 0.988 0.000
#> SRR330912 4 0.0579 0.755 0.000 0.008 0.008 0.984 0.000
#> SRR330913 4 0.3980 0.656 0.000 0.000 0.008 0.708 0.284
#> SRR330914 4 0.3612 0.707 0.000 0.000 0.008 0.764 0.228
#> SRR330915 5 0.5753 0.762 0.456 0.000 0.012 0.056 0.476
#> SRR330916 4 0.0451 0.760 0.000 0.004 0.008 0.988 0.000
#> SRR330917 4 0.4497 0.429 0.000 0.000 0.008 0.568 0.424
#> SRR330918 5 0.5755 0.453 0.224 0.000 0.096 0.024 0.656
#> SRR330919 5 0.6222 0.739 0.408 0.000 0.012 0.100 0.480
#> SRR330920 1 0.4517 -0.561 0.556 0.000 0.000 0.008 0.436
#> SRR330921 5 0.5753 0.762 0.456 0.000 0.012 0.056 0.476
#> SRR330922 5 0.5899 0.762 0.440 0.000 0.012 0.068 0.480
#> SRR330923 1 0.3318 0.350 0.800 0.000 0.000 0.008 0.192
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> SRR330857 1 0.0000 0.8039 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR330858 1 0.0000 0.8039 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR330859 1 0.5485 0.5266 0.560 0.000 0.320 0.000 0.108 0.012
#> SRR330860 6 0.4463 0.0000 0.000 0.292 0.056 0.000 0.000 0.652
#> SRR330861 1 0.4799 0.5738 0.620 0.000 0.320 0.000 0.048 0.012
#> SRR330862 3 0.3271 1.0000 0.000 0.000 0.760 0.232 0.008 0.000
#> SRR330863 1 0.5426 0.5920 0.652 0.000 0.204 0.016 0.116 0.012
#> SRR330864 3 0.3271 1.0000 0.000 0.000 0.760 0.232 0.008 0.000
#> SRR330865 1 0.1511 0.7765 0.940 0.000 0.004 0.000 0.044 0.012
#> SRR330866 4 0.0146 0.7744 0.000 0.000 0.004 0.996 0.000 0.000
#> SRR330867 1 0.0520 0.8015 0.984 0.000 0.000 0.000 0.008 0.008
#> SRR330868 3 0.3271 1.0000 0.000 0.000 0.760 0.232 0.008 0.000
#> SRR330869 4 0.4511 0.6033 0.000 0.000 0.000 0.620 0.332 0.048
#> SRR330870 1 0.0000 0.8039 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR330871 1 0.5019 0.4529 0.536 0.000 0.404 0.000 0.048 0.012
#> SRR330872 3 0.3271 1.0000 0.000 0.000 0.760 0.232 0.008 0.000
#> SRR330873 1 0.0000 0.8039 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR330874 2 0.2078 0.7181 0.000 0.916 0.032 0.000 0.012 0.040
#> SRR330875 1 0.0508 0.8020 0.984 0.000 0.000 0.000 0.004 0.012
#> SRR330876 1 0.0000 0.8039 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR330877 1 0.4799 0.5738 0.620 0.000 0.320 0.000 0.048 0.012
#> SRR330878 1 0.0146 0.8038 0.996 0.000 0.000 0.000 0.000 0.004
#> SRR330879 5 0.6283 0.5720 0.192 0.000 0.156 0.052 0.588 0.012
#> SRR330880 3 0.3271 1.0000 0.000 0.000 0.760 0.232 0.008 0.000
#> SRR330881 1 0.0363 0.7969 0.988 0.000 0.000 0.000 0.012 0.000
#> SRR330882 5 0.6727 -0.2478 0.060 0.000 0.156 0.004 0.452 0.328
#> SRR330883 2 0.4292 0.6102 0.000 0.744 0.044 0.000 0.028 0.184
#> SRR330884 4 0.4313 0.6627 0.000 0.000 0.000 0.668 0.284 0.048
#> SRR330885 4 0.1434 0.7655 0.000 0.000 0.000 0.940 0.012 0.048
#> SRR330886 5 0.5303 0.6105 0.168 0.000 0.012 0.164 0.652 0.004
#> SRR330887 5 0.3938 0.7548 0.324 0.000 0.000 0.016 0.660 0.000
#> SRR330888 5 0.3867 0.7510 0.328 0.000 0.000 0.012 0.660 0.000
#> SRR330889 4 0.0891 0.7662 0.000 0.000 0.024 0.968 0.008 0.000
#> SRR330890 4 0.2795 0.7472 0.000 0.000 0.000 0.856 0.100 0.044
#> SRR330891 4 0.0146 0.7744 0.000 0.000 0.004 0.996 0.000 0.000
#> SRR330892 2 0.2078 0.7181 0.000 0.916 0.032 0.000 0.012 0.040
#> SRR330893 4 0.0146 0.7744 0.000 0.000 0.004 0.996 0.000 0.000
#> SRR330894 4 0.0146 0.7744 0.000 0.000 0.004 0.996 0.000 0.000
#> SRR330895 2 0.4619 0.6244 0.000 0.768 0.036 0.080 0.020 0.096
#> SRR330896 4 0.4309 0.6545 0.000 0.000 0.000 0.660 0.296 0.044
#> SRR330897 2 0.3210 0.7147 0.000 0.844 0.040 0.000 0.020 0.096
#> SRR330898 2 0.0260 0.7442 0.000 0.992 0.008 0.000 0.000 0.000
#> SRR330899 5 0.3938 0.7548 0.324 0.000 0.000 0.016 0.660 0.000
#> SRR330900 5 0.3952 0.7513 0.308 0.000 0.000 0.020 0.672 0.000
#> SRR330901 5 0.3938 0.7548 0.324 0.000 0.000 0.016 0.660 0.000
#> SRR330902 5 0.3578 0.7366 0.340 0.000 0.000 0.000 0.660 0.000
#> SRR330903 4 0.0937 0.7766 0.000 0.000 0.000 0.960 0.040 0.000
#> SRR330904 4 0.4963 0.1613 0.000 0.352 0.036 0.592 0.012 0.008
#> SRR330906 4 0.3835 0.6939 0.000 0.000 0.000 0.748 0.204 0.048
#> SRR330907 1 0.1267 0.7494 0.940 0.000 0.000 0.000 0.060 0.000
#> SRR330908 4 0.0508 0.7749 0.000 0.000 0.004 0.984 0.012 0.000
#> SRR330909 5 0.3797 0.6283 0.420 0.000 0.000 0.000 0.580 0.000
#> SRR330910 4 0.3482 0.6538 0.000 0.000 0.000 0.684 0.316 0.000
#> SRR330911 4 0.0146 0.7744 0.000 0.000 0.004 0.996 0.000 0.000
#> SRR330912 4 0.0146 0.7744 0.000 0.000 0.004 0.996 0.000 0.000
#> SRR330913 4 0.4511 0.6022 0.000 0.000 0.000 0.620 0.332 0.048
#> SRR330914 4 0.4233 0.6735 0.000 0.000 0.000 0.684 0.268 0.048
#> SRR330915 5 0.3938 0.7548 0.324 0.000 0.000 0.016 0.660 0.000
#> SRR330916 4 0.0146 0.7744 0.000 0.000 0.004 0.996 0.000 0.000
#> SRR330917 5 0.4690 -0.0894 0.000 0.000 0.000 0.400 0.552 0.048
#> SRR330918 5 0.6320 -0.1831 0.060 0.000 0.144 0.000 0.536 0.260
#> SRR330919 5 0.4435 0.7227 0.264 0.000 0.000 0.064 0.672 0.000
#> SRR330920 5 0.3817 0.5987 0.432 0.000 0.000 0.000 0.568 0.000
#> SRR330921 5 0.3938 0.7548 0.324 0.000 0.000 0.016 0.660 0.000
#> SRR330922 5 0.4045 0.7528 0.312 0.000 0.000 0.024 0.664 0.000
#> SRR330923 1 0.3409 0.2165 0.700 0.000 0.000 0.000 0.300 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)
consensus_heatmap(res, k = 3)
consensus_heatmap(res, k = 4)
consensus_heatmap(res, k = 5)
consensus_heatmap(res, k = 6)
Heatmaps for the membership of samples in all partitions to see how consistent they are:
membership_heatmap(res, k = 2)
membership_heatmap(res, k = 3)
membership_heatmap(res, k = 4)
membership_heatmap(res, k = 5)
membership_heatmap(res, k = 6)
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)
get_signatures(res, k = 3)
get_signatures(res, k = 4)
get_signatures(res, k = 5)
get_signatures(res, k = 6)
Signature heatmaps where rows are not scaled:
get_signatures(res, k = 2, scale_rows = FALSE)
get_signatures(res, k = 3, scale_rows = FALSE)
get_signatures(res, k = 4, scale_rows = FALSE)
get_signatures(res, k = 5, scale_rows = FALSE)
get_signatures(res, k = 6, scale_rows = FALSE)
Compare the overlap of signatures from different k:
compare_signatures(res)
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:
which_row
: row indices corresponding to the input matrix.fdr
: FDR for the differential test. mean_x
: The mean value in group x.scaled_mean_x
: The mean value in group x after rows are scaled.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")
dimension_reduction(res, k = 3, method = "UMAP")
dimension_reduction(res, k = 4, method = "UMAP")
dimension_reduction(res, k = 5, method = "UMAP")
dimension_reduction(res, k = 6, method = "UMAP")
Following heatmap shows how subgroups are split when increasing k
:
collect_classes(res)
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.
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 10869 rows and 66 columns.
#> Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'MAD' method.
#> Subgroups are detected by 'skmeans' method.
#> Performed in total 1250 partitions by row resampling.
#> Best k for subgroups seems to be 2.
#>
#> Following methods can be applied to this 'ConsensusPartition' object:
#> [1] "cola_report" "collect_classes" "collect_plots"
#> [4] "collect_stats" "colnames" "compare_signatures"
#> [7] "consensus_heatmap" "dimension_reduction" "functional_enrichment"
#> [10] "get_anno_col" "get_anno" "get_classes"
#> [13] "get_consensus" "get_matrix" "get_membership"
#> [16] "get_param" "get_signatures" "get_stats"
#> [19] "is_best_k" "is_stable_k" "membership_heatmap"
#> [22] "ncol" "nrow" "plot_ecdf"
#> [25] "rownames" "select_partition_number" "show"
#> [28] "suggest_best_k" "test_to_known_factors"
collect_plots()
function collects all the plots made from res
for all k
(number of partitions)
into one single page to provide an easy and fast comparison between different k
.
collect_plots(res)
The plots are:
k
and the heatmap of
predicted classes for each k
.k
.k
.k
.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:
k
;k
, the area increased is defined as \(A_k - A_{k-1}\).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)
The numeric values for all these statistics can be obtained by get_stats()
.
get_stats(res)
#> k 1-PAC mean_silhouette concordance area_increased Rand Jaccard
#> 2 2 1.000 0.974 0.988 0.5073 0.493 0.493
#> 3 3 0.664 0.835 0.905 0.2662 0.807 0.631
#> 4 4 0.574 0.450 0.650 0.1296 0.779 0.464
#> 5 5 0.638 0.594 0.712 0.0662 0.860 0.535
#> 6 6 0.623 0.564 0.703 0.0393 0.911 0.636
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.
cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#> class entropy silhouette p1 p2
#> SRR330857 1 0.000 0.991 1.000 0.000
#> SRR330858 1 0.000 0.991 1.000 0.000
#> SRR330859 1 0.000 0.991 1.000 0.000
#> SRR330860 2 0.000 0.984 0.000 1.000
#> SRR330861 1 0.000 0.991 1.000 0.000
#> SRR330862 2 0.000 0.984 0.000 1.000
#> SRR330863 1 0.000 0.991 1.000 0.000
#> SRR330864 2 0.000 0.984 0.000 1.000
#> SRR330865 1 0.000 0.991 1.000 0.000
#> SRR330866 2 0.000 0.984 0.000 1.000
#> SRR330867 1 0.000 0.991 1.000 0.000
#> SRR330868 2 0.000 0.984 0.000 1.000
#> SRR330869 2 0.738 0.740 0.208 0.792
#> SRR330870 1 0.000 0.991 1.000 0.000
#> SRR330871 1 0.000 0.991 1.000 0.000
#> SRR330872 2 0.000 0.984 0.000 1.000
#> SRR330873 1 0.000 0.991 1.000 0.000
#> SRR330874 2 0.000 0.984 0.000 1.000
#> SRR330875 1 0.000 0.991 1.000 0.000
#> SRR330876 1 0.000 0.991 1.000 0.000
#> SRR330877 1 0.000 0.991 1.000 0.000
#> SRR330878 1 0.000 0.991 1.000 0.000
#> SRR330879 1 0.000 0.991 1.000 0.000
#> SRR330880 2 0.000 0.984 0.000 1.000
#> SRR330881 1 0.000 0.991 1.000 0.000
#> SRR330882 1 0.141 0.972 0.980 0.020
#> SRR330883 2 0.000 0.984 0.000 1.000
#> SRR330884 2 0.000 0.984 0.000 1.000
#> SRR330885 2 0.000 0.984 0.000 1.000
#> SRR330886 1 0.000 0.991 1.000 0.000
#> SRR330887 1 0.000 0.991 1.000 0.000
#> SRR330888 1 0.000 0.991 1.000 0.000
#> SRR330889 2 0.000 0.984 0.000 1.000
#> SRR330890 2 0.000 0.984 0.000 1.000
#> SRR330891 2 0.000 0.984 0.000 1.000
#> SRR330892 2 0.000 0.984 0.000 1.000
#> SRR330893 2 0.000 0.984 0.000 1.000
#> SRR330894 2 0.000 0.984 0.000 1.000
#> SRR330895 2 0.000 0.984 0.000 1.000
#> SRR330896 2 0.000 0.984 0.000 1.000
#> SRR330897 2 0.000 0.984 0.000 1.000
#> SRR330898 2 0.000 0.984 0.000 1.000
#> SRR330899 1 0.000 0.991 1.000 0.000
#> SRR330900 1 0.000 0.991 1.000 0.000
#> SRR330901 1 0.000 0.991 1.000 0.000
#> SRR330902 1 0.000 0.991 1.000 0.000
#> SRR330903 2 0.000 0.984 0.000 1.000
#> SRR330904 2 0.000 0.984 0.000 1.000
#> SRR330906 2 0.722 0.757 0.200 0.800
#> SRR330907 1 0.000 0.991 1.000 0.000
#> SRR330908 2 0.000 0.984 0.000 1.000
#> SRR330909 1 0.000 0.991 1.000 0.000
#> SRR330910 2 0.388 0.913 0.076 0.924
#> SRR330911 2 0.000 0.984 0.000 1.000
#> SRR330912 2 0.000 0.984 0.000 1.000
#> SRR330913 2 0.000 0.984 0.000 1.000
#> SRR330914 2 0.000 0.984 0.000 1.000
#> SRR330915 1 0.000 0.991 1.000 0.000
#> SRR330916 2 0.000 0.984 0.000 1.000
#> SRR330917 1 0.821 0.652 0.744 0.256
#> SRR330918 1 0.000 0.991 1.000 0.000
#> SRR330919 1 0.000 0.991 1.000 0.000
#> SRR330920 1 0.000 0.991 1.000 0.000
#> SRR330921 1 0.000 0.991 1.000 0.000
#> SRR330922 1 0.000 0.991 1.000 0.000
#> SRR330923 1 0.000 0.991 1.000 0.000
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> SRR330857 1 0.3340 0.881 0.880 0.000 0.120
#> SRR330858 1 0.3340 0.881 0.880 0.000 0.120
#> SRR330859 3 0.4178 0.771 0.172 0.000 0.828
#> SRR330860 2 0.5529 0.675 0.000 0.704 0.296
#> SRR330861 3 0.4291 0.768 0.180 0.000 0.820
#> SRR330862 3 0.1411 0.795 0.000 0.036 0.964
#> SRR330863 3 0.5016 0.705 0.240 0.000 0.760
#> SRR330864 3 0.1411 0.795 0.000 0.036 0.964
#> SRR330865 1 0.4702 0.768 0.788 0.000 0.212
#> SRR330866 2 0.1860 0.887 0.000 0.948 0.052
#> SRR330867 1 0.3340 0.881 0.880 0.000 0.120
#> SRR330868 3 0.1411 0.795 0.000 0.036 0.964
#> SRR330869 2 0.4915 0.720 0.184 0.804 0.012
#> SRR330870 1 0.3340 0.881 0.880 0.000 0.120
#> SRR330871 3 0.5363 0.662 0.276 0.000 0.724
#> SRR330872 3 0.1411 0.795 0.000 0.036 0.964
#> SRR330873 1 0.3340 0.881 0.880 0.000 0.120
#> SRR330874 2 0.3619 0.859 0.000 0.864 0.136
#> SRR330875 1 0.3619 0.867 0.864 0.000 0.136
#> SRR330876 1 0.3340 0.881 0.880 0.000 0.120
#> SRR330877 3 0.4346 0.765 0.184 0.000 0.816
#> SRR330878 1 0.3686 0.863 0.860 0.000 0.140
#> SRR330879 3 0.5560 0.627 0.300 0.000 0.700
#> SRR330880 3 0.1411 0.795 0.000 0.036 0.964
#> SRR330881 1 0.1031 0.923 0.976 0.000 0.024
#> SRR330882 1 0.1999 0.902 0.952 0.036 0.012
#> SRR330883 2 0.3619 0.859 0.000 0.864 0.136
#> SRR330884 2 0.3618 0.830 0.104 0.884 0.012
#> SRR330885 2 0.2537 0.883 0.000 0.920 0.080
#> SRR330886 1 0.5698 0.620 0.736 0.012 0.252
#> SRR330887 1 0.0000 0.927 1.000 0.000 0.000
#> SRR330888 1 0.0000 0.927 1.000 0.000 0.000
#> SRR330889 3 0.6111 0.183 0.000 0.396 0.604
#> SRR330890 2 0.1170 0.892 0.008 0.976 0.016
#> SRR330891 2 0.0892 0.891 0.000 0.980 0.020
#> SRR330892 2 0.3619 0.859 0.000 0.864 0.136
#> SRR330893 2 0.0237 0.890 0.000 0.996 0.004
#> SRR330894 2 0.0592 0.891 0.000 0.988 0.012
#> SRR330895 2 0.3619 0.859 0.000 0.864 0.136
#> SRR330896 2 0.1751 0.878 0.028 0.960 0.012
#> SRR330897 2 0.3619 0.859 0.000 0.864 0.136
#> SRR330898 2 0.3619 0.859 0.000 0.864 0.136
#> SRR330899 1 0.0000 0.927 1.000 0.000 0.000
#> SRR330900 1 0.0000 0.927 1.000 0.000 0.000
#> SRR330901 1 0.0000 0.927 1.000 0.000 0.000
#> SRR330902 1 0.0237 0.927 0.996 0.000 0.004
#> SRR330903 2 0.0592 0.886 0.000 0.988 0.012
#> SRR330904 2 0.2796 0.877 0.000 0.908 0.092
#> SRR330906 2 0.5932 0.769 0.164 0.780 0.056
#> SRR330907 1 0.1031 0.923 0.976 0.000 0.024
#> SRR330908 2 0.0237 0.888 0.000 0.996 0.004
#> SRR330909 1 0.0592 0.926 0.988 0.000 0.012
#> SRR330910 2 0.4128 0.805 0.132 0.856 0.012
#> SRR330911 2 0.0592 0.891 0.000 0.988 0.012
#> SRR330912 2 0.1031 0.892 0.000 0.976 0.024
#> SRR330913 2 0.3207 0.846 0.084 0.904 0.012
#> SRR330914 2 0.1482 0.879 0.020 0.968 0.012
#> SRR330915 1 0.0000 0.927 1.000 0.000 0.000
#> SRR330916 2 0.0000 0.889 0.000 1.000 0.000
#> SRR330917 2 0.6754 0.299 0.432 0.556 0.012
#> SRR330918 1 0.0592 0.927 0.988 0.000 0.012
#> SRR330919 1 0.0424 0.922 0.992 0.000 0.008
#> SRR330920 1 0.0000 0.927 1.000 0.000 0.000
#> SRR330921 1 0.0000 0.927 1.000 0.000 0.000
#> SRR330922 1 0.0000 0.927 1.000 0.000 0.000
#> SRR330923 1 0.0237 0.927 0.996 0.000 0.004
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> SRR330857 3 0.4999 0.5236 0.492 0.000 0.508 0.000
#> SRR330858 3 0.5000 0.5096 0.500 0.000 0.500 0.000
#> SRR330859 3 0.2644 0.5243 0.060 0.032 0.908 0.000
#> SRR330860 2 0.2494 0.2548 0.000 0.916 0.036 0.048
#> SRR330861 3 0.2282 0.5220 0.052 0.024 0.924 0.000
#> SRR330862 2 0.4992 0.3745 0.000 0.524 0.476 0.000
#> SRR330863 3 0.2611 0.5523 0.096 0.008 0.896 0.000
#> SRR330864 2 0.4992 0.3745 0.000 0.524 0.476 0.000
#> SRR330865 3 0.4985 0.5410 0.468 0.000 0.532 0.000
#> SRR330866 4 0.5112 0.5634 0.000 0.384 0.008 0.608
#> SRR330867 1 0.5000 -0.5674 0.500 0.000 0.500 0.000
#> SRR330868 2 0.4992 0.3745 0.000 0.524 0.476 0.000
#> SRR330869 4 0.4160 0.4716 0.132 0.028 0.012 0.828
#> SRR330870 3 0.5000 0.5096 0.500 0.000 0.500 0.000
#> SRR330871 3 0.5218 0.5528 0.200 0.064 0.736 0.000
#> SRR330872 2 0.4992 0.3745 0.000 0.524 0.476 0.000
#> SRR330873 3 0.5000 0.5175 0.496 0.000 0.504 0.000
#> SRR330874 2 0.4008 0.0532 0.000 0.756 0.000 0.244
#> SRR330875 3 0.5151 0.5421 0.464 0.004 0.532 0.000
#> SRR330876 3 0.4998 0.5281 0.488 0.000 0.512 0.000
#> SRR330877 3 0.2282 0.5210 0.052 0.024 0.924 0.000
#> SRR330878 3 0.4998 0.5293 0.488 0.000 0.512 0.000
#> SRR330879 3 0.6384 0.5266 0.232 0.072 0.672 0.024
#> SRR330880 2 0.5161 0.3736 0.000 0.520 0.476 0.004
#> SRR330881 1 0.4103 0.3757 0.744 0.000 0.256 0.000
#> SRR330882 1 0.7626 0.2569 0.608 0.092 0.220 0.080
#> SRR330883 2 0.4697 -0.0907 0.000 0.644 0.000 0.356
#> SRR330884 4 0.3828 0.4910 0.132 0.020 0.008 0.840
#> SRR330885 4 0.5388 0.4295 0.000 0.456 0.012 0.532
#> SRR330886 1 0.7286 -0.0270 0.508 0.056 0.392 0.044
#> SRR330887 1 0.0188 0.7665 0.996 0.000 0.004 0.000
#> SRR330888 1 0.0188 0.7665 0.996 0.000 0.004 0.000
#> SRR330889 2 0.6811 0.2613 0.000 0.604 0.216 0.180
#> SRR330890 4 0.5247 0.5876 0.008 0.340 0.008 0.644
#> SRR330891 4 0.4925 0.5203 0.000 0.428 0.000 0.572
#> SRR330892 2 0.4661 -0.0783 0.000 0.652 0.000 0.348
#> SRR330893 4 0.4454 0.6291 0.000 0.308 0.000 0.692
#> SRR330894 4 0.4624 0.6098 0.000 0.340 0.000 0.660
#> SRR330895 2 0.4713 -0.1003 0.000 0.640 0.000 0.360
#> SRR330896 4 0.3875 0.5714 0.068 0.076 0.004 0.852
#> SRR330897 2 0.4713 -0.1003 0.000 0.640 0.000 0.360
#> SRR330898 2 0.4697 -0.0907 0.000 0.644 0.000 0.356
#> SRR330899 1 0.0376 0.7663 0.992 0.000 0.004 0.004
#> SRR330900 1 0.2164 0.7204 0.924 0.004 0.004 0.068
#> SRR330901 1 0.0188 0.7665 0.996 0.000 0.004 0.000
#> SRR330902 1 0.1474 0.7380 0.948 0.000 0.052 0.000
#> SRR330903 4 0.3219 0.6334 0.000 0.164 0.000 0.836
#> SRR330904 2 0.4981 -0.3882 0.000 0.536 0.000 0.464
#> SRR330906 4 0.7815 0.3516 0.168 0.396 0.012 0.424
#> SRR330907 1 0.3873 0.4517 0.772 0.000 0.228 0.000
#> SRR330908 4 0.4040 0.6400 0.000 0.248 0.000 0.752
#> SRR330909 1 0.2530 0.6718 0.888 0.000 0.112 0.000
#> SRR330910 4 0.6696 0.4289 0.256 0.124 0.004 0.616
#> SRR330911 4 0.4522 0.6221 0.000 0.320 0.000 0.680
#> SRR330912 4 0.4941 0.5053 0.000 0.436 0.000 0.564
#> SRR330913 4 0.6031 0.4082 0.212 0.088 0.008 0.692
#> SRR330914 4 0.2234 0.5921 0.008 0.064 0.004 0.924
#> SRR330915 1 0.0188 0.7653 0.996 0.000 0.000 0.004
#> SRR330916 4 0.4304 0.6352 0.000 0.284 0.000 0.716
#> SRR330917 1 0.6493 0.1113 0.500 0.052 0.008 0.440
#> SRR330918 1 0.3582 0.7169 0.868 0.004 0.068 0.060
#> SRR330919 1 0.2081 0.7104 0.916 0.000 0.000 0.084
#> SRR330920 1 0.0469 0.7644 0.988 0.000 0.012 0.000
#> SRR330921 1 0.0188 0.7653 0.996 0.000 0.000 0.004
#> SRR330922 1 0.1474 0.7403 0.948 0.000 0.000 0.052
#> SRR330923 1 0.0592 0.7627 0.984 0.000 0.016 0.000
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> SRR330857 1 0.3857 0.7339 0.688 0.000 0.000 0.000 0.312
#> SRR330858 1 0.3932 0.7252 0.672 0.000 0.000 0.000 0.328
#> SRR330859 1 0.5235 0.5612 0.644 0.000 0.296 0.012 0.048
#> SRR330860 2 0.4588 0.3403 0.012 0.668 0.308 0.012 0.000
#> SRR330861 1 0.4974 0.5854 0.660 0.000 0.288 0.004 0.048
#> SRR330862 3 0.0510 0.9031 0.000 0.016 0.984 0.000 0.000
#> SRR330863 1 0.5125 0.5955 0.672 0.000 0.260 0.008 0.060
#> SRR330864 3 0.0510 0.9044 0.000 0.016 0.984 0.000 0.000
#> SRR330865 1 0.4162 0.7350 0.680 0.000 0.004 0.004 0.312
#> SRR330866 2 0.5656 0.5011 0.060 0.648 0.032 0.260 0.000
#> SRR330867 1 0.3949 0.7222 0.668 0.000 0.000 0.000 0.332
#> SRR330868 3 0.0510 0.9044 0.000 0.016 0.984 0.000 0.000
#> SRR330869 4 0.5337 0.5717 0.092 0.084 0.016 0.756 0.052
#> SRR330870 1 0.3949 0.7222 0.668 0.000 0.000 0.000 0.332
#> SRR330871 1 0.6212 0.5724 0.516 0.000 0.324 0.000 0.160
#> SRR330872 3 0.0566 0.9027 0.004 0.012 0.984 0.000 0.000
#> SRR330873 1 0.3966 0.7172 0.664 0.000 0.000 0.000 0.336
#> SRR330874 2 0.2179 0.6032 0.000 0.888 0.112 0.000 0.000
#> SRR330875 1 0.4217 0.7304 0.704 0.000 0.012 0.004 0.280
#> SRR330876 1 0.3876 0.7332 0.684 0.000 0.000 0.000 0.316
#> SRR330877 1 0.4968 0.5713 0.652 0.000 0.300 0.004 0.044
#> SRR330878 1 0.3876 0.7332 0.684 0.000 0.000 0.000 0.316
#> SRR330879 1 0.6679 0.6090 0.516 0.000 0.252 0.012 0.220
#> SRR330880 3 0.0404 0.9036 0.000 0.012 0.988 0.000 0.000
#> SRR330881 5 0.3876 0.3638 0.316 0.000 0.000 0.000 0.684
#> SRR330882 5 0.8896 0.1417 0.268 0.148 0.052 0.140 0.392
#> SRR330883 2 0.1197 0.6340 0.000 0.952 0.048 0.000 0.000
#> SRR330884 4 0.3643 0.5746 0.044 0.072 0.000 0.848 0.036
#> SRR330885 2 0.5800 0.4062 0.032 0.628 0.064 0.276 0.000
#> SRR330886 1 0.8354 -0.1043 0.376 0.052 0.096 0.100 0.376
#> SRR330887 5 0.0451 0.8387 0.008 0.000 0.000 0.004 0.988
#> SRR330888 5 0.0609 0.8373 0.020 0.000 0.000 0.000 0.980
#> SRR330889 3 0.6432 0.3653 0.048 0.228 0.608 0.116 0.000
#> SRR330890 2 0.5798 0.1499 0.044 0.516 0.024 0.416 0.000
#> SRR330891 2 0.4501 0.5701 0.036 0.740 0.012 0.212 0.000
#> SRR330892 2 0.1341 0.6329 0.000 0.944 0.056 0.000 0.000
#> SRR330893 2 0.5346 0.4523 0.056 0.620 0.008 0.316 0.000
#> SRR330894 2 0.5050 0.4898 0.036 0.652 0.012 0.300 0.000
#> SRR330895 2 0.1197 0.6357 0.000 0.952 0.048 0.000 0.000
#> SRR330896 4 0.6803 0.2884 0.096 0.288 0.032 0.564 0.020
#> SRR330897 2 0.1282 0.6341 0.004 0.952 0.044 0.000 0.000
#> SRR330898 2 0.1197 0.6357 0.000 0.952 0.048 0.000 0.000
#> SRR330899 5 0.1216 0.8291 0.020 0.000 0.000 0.020 0.960
#> SRR330900 5 0.3593 0.7388 0.060 0.000 0.000 0.116 0.824
#> SRR330901 5 0.0404 0.8368 0.012 0.000 0.000 0.000 0.988
#> SRR330902 5 0.2068 0.8015 0.092 0.000 0.000 0.004 0.904
#> SRR330903 4 0.6171 -0.2274 0.088 0.448 0.008 0.452 0.004
#> SRR330904 2 0.1568 0.6347 0.000 0.944 0.020 0.036 0.000
#> SRR330906 2 0.6367 0.0939 0.040 0.548 0.012 0.352 0.048
#> SRR330907 5 0.3480 0.5442 0.248 0.000 0.000 0.000 0.752
#> SRR330908 2 0.5770 0.2778 0.068 0.516 0.008 0.408 0.000
#> SRR330909 5 0.3163 0.7484 0.164 0.000 0.000 0.012 0.824
#> SRR330910 4 0.7994 0.3736 0.136 0.180 0.012 0.496 0.176
#> SRR330911 2 0.6008 0.3937 0.060 0.568 0.032 0.340 0.000
#> SRR330912 2 0.4235 0.5758 0.040 0.768 0.008 0.184 0.000
#> SRR330913 4 0.5540 0.5336 0.100 0.092 0.000 0.724 0.084
#> SRR330914 4 0.4195 0.4964 0.036 0.188 0.000 0.768 0.008
#> SRR330915 5 0.0703 0.8370 0.024 0.000 0.000 0.000 0.976
#> SRR330916 2 0.5571 0.3797 0.060 0.568 0.008 0.364 0.000
#> SRR330917 4 0.6086 0.4078 0.092 0.028 0.000 0.604 0.276
#> SRR330918 5 0.4640 0.7094 0.148 0.008 0.000 0.088 0.756
#> SRR330919 5 0.2903 0.7736 0.048 0.000 0.000 0.080 0.872
#> SRR330920 5 0.0794 0.8364 0.028 0.000 0.000 0.000 0.972
#> SRR330921 5 0.0609 0.8382 0.020 0.000 0.000 0.000 0.980
#> SRR330922 5 0.1117 0.8275 0.016 0.000 0.000 0.020 0.964
#> SRR330923 5 0.1043 0.8316 0.040 0.000 0.000 0.000 0.960
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> SRR330857 1 0.3175 0.7671 0.744 0.000 0.000 0.256 0.000 0.000
#> SRR330858 1 0.3515 0.7108 0.676 0.000 0.000 0.324 0.000 0.000
#> SRR330859 1 0.5560 0.5849 0.672 0.052 0.196 0.032 0.048 0.000
#> SRR330860 2 0.5465 0.4185 0.008 0.612 0.232 0.000 0.004 0.144
#> SRR330861 1 0.4418 0.6733 0.744 0.020 0.184 0.040 0.012 0.000
#> SRR330862 3 0.0291 0.8735 0.000 0.004 0.992 0.000 0.000 0.004
#> SRR330863 1 0.4474 0.6272 0.760 0.052 0.148 0.020 0.020 0.000
#> SRR330864 3 0.0551 0.8783 0.008 0.004 0.984 0.000 0.000 0.004
#> SRR330865 1 0.3831 0.7755 0.732 0.004 0.012 0.244 0.008 0.000
#> SRR330866 6 0.3500 0.5345 0.004 0.116 0.052 0.000 0.008 0.820
#> SRR330867 1 0.3547 0.7377 0.696 0.000 0.000 0.300 0.004 0.000
#> SRR330868 3 0.0551 0.8783 0.008 0.004 0.984 0.000 0.000 0.004
#> SRR330869 5 0.6745 0.6173 0.044 0.084 0.032 0.060 0.624 0.156
#> SRR330870 1 0.3499 0.7157 0.680 0.000 0.000 0.320 0.000 0.000
#> SRR330871 1 0.6025 0.6302 0.576 0.016 0.264 0.120 0.024 0.000
#> SRR330872 3 0.0806 0.8736 0.020 0.008 0.972 0.000 0.000 0.000
#> SRR330873 1 0.3619 0.7184 0.680 0.004 0.000 0.316 0.000 0.000
#> SRR330874 2 0.4945 0.5481 0.000 0.588 0.084 0.000 0.000 0.328
#> SRR330875 1 0.4314 0.7667 0.736 0.024 0.012 0.208 0.020 0.000
#> SRR330876 1 0.2912 0.7765 0.784 0.000 0.000 0.216 0.000 0.000
#> SRR330877 1 0.4551 0.6795 0.728 0.016 0.196 0.048 0.012 0.000
#> SRR330878 1 0.3101 0.7720 0.756 0.000 0.000 0.244 0.000 0.000
#> SRR330879 1 0.6471 0.6519 0.612 0.040 0.140 0.144 0.064 0.000
#> SRR330880 3 0.0520 0.8757 0.008 0.008 0.984 0.000 0.000 0.000
#> SRR330881 4 0.3766 0.4453 0.304 0.012 0.000 0.684 0.000 0.000
#> SRR330882 2 0.8687 -0.2479 0.216 0.300 0.044 0.248 0.172 0.020
#> SRR330883 2 0.4479 0.5732 0.004 0.624 0.036 0.000 0.000 0.336
#> SRR330884 5 0.6414 0.5411 0.036 0.064 0.004 0.048 0.556 0.292
#> SRR330885 2 0.7179 0.0731 0.020 0.412 0.068 0.000 0.160 0.340
#> SRR330886 4 0.8642 0.0707 0.296 0.168 0.048 0.324 0.132 0.032
#> SRR330887 4 0.1346 0.8128 0.024 0.016 0.000 0.952 0.008 0.000
#> SRR330888 4 0.1053 0.8114 0.020 0.012 0.000 0.964 0.004 0.000
#> SRR330889 3 0.5654 0.2054 0.012 0.052 0.524 0.000 0.028 0.384
#> SRR330890 6 0.6326 0.1326 0.008 0.212 0.008 0.000 0.332 0.440
#> SRR330891 6 0.4986 0.2735 0.012 0.292 0.004 0.000 0.060 0.632
#> SRR330892 2 0.4344 0.5749 0.000 0.628 0.036 0.000 0.000 0.336
#> SRR330893 6 0.2266 0.5781 0.000 0.108 0.000 0.000 0.012 0.880
#> SRR330894 6 0.2581 0.5694 0.000 0.120 0.000 0.000 0.020 0.860
#> SRR330895 2 0.4224 0.5704 0.000 0.632 0.028 0.000 0.000 0.340
#> SRR330896 6 0.7163 -0.1138 0.032 0.128 0.024 0.032 0.296 0.488
#> SRR330897 2 0.4249 0.5760 0.000 0.640 0.032 0.000 0.000 0.328
#> SRR330898 2 0.4330 0.5770 0.000 0.632 0.036 0.000 0.000 0.332
#> SRR330899 4 0.2340 0.7928 0.016 0.024 0.000 0.900 0.060 0.000
#> SRR330900 4 0.4370 0.6424 0.052 0.024 0.000 0.736 0.188 0.000
#> SRR330901 4 0.1269 0.8102 0.012 0.020 0.000 0.956 0.012 0.000
#> SRR330902 4 0.2723 0.7551 0.120 0.020 0.000 0.856 0.004 0.000
#> SRR330903 6 0.4000 0.4950 0.020 0.056 0.004 0.000 0.132 0.788
#> SRR330904 6 0.4413 -0.3262 0.000 0.488 0.012 0.000 0.008 0.492
#> SRR330906 2 0.6919 -0.1413 0.024 0.404 0.000 0.044 0.384 0.144
#> SRR330907 4 0.3509 0.5827 0.240 0.016 0.000 0.744 0.000 0.000
#> SRR330908 6 0.2885 0.5614 0.008 0.044 0.004 0.000 0.076 0.868
#> SRR330909 4 0.4087 0.7108 0.168 0.044 0.000 0.764 0.024 0.000
#> SRR330910 6 0.7197 -0.0229 0.016 0.116 0.012 0.124 0.204 0.528
#> SRR330911 6 0.2280 0.5994 0.008 0.036 0.028 0.000 0.016 0.912
#> SRR330912 6 0.4684 0.2177 0.008 0.316 0.008 0.000 0.032 0.636
#> SRR330913 5 0.4681 0.6439 0.012 0.080 0.000 0.064 0.764 0.080
#> SRR330914 5 0.5727 0.3294 0.016 0.096 0.000 0.004 0.504 0.380
#> SRR330915 4 0.1151 0.8119 0.032 0.000 0.000 0.956 0.012 0.000
#> SRR330916 6 0.1457 0.6018 0.004 0.028 0.004 0.000 0.016 0.948
#> SRR330917 5 0.5337 0.6043 0.020 0.048 0.000 0.204 0.680 0.048
#> SRR330918 4 0.6355 0.5677 0.144 0.112 0.000 0.608 0.124 0.012
#> SRR330919 4 0.3821 0.7095 0.016 0.056 0.000 0.816 0.096 0.016
#> SRR330920 4 0.0865 0.8055 0.036 0.000 0.000 0.964 0.000 0.000
#> SRR330921 4 0.1003 0.8122 0.020 0.000 0.000 0.964 0.016 0.000
#> SRR330922 4 0.2323 0.7695 0.012 0.012 0.000 0.892 0.084 0.000
#> SRR330923 4 0.1204 0.7979 0.056 0.000 0.000 0.944 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)
consensus_heatmap(res, k = 3)
consensus_heatmap(res, k = 4)
consensus_heatmap(res, k = 5)
consensus_heatmap(res, k = 6)
Heatmaps for the membership of samples in all partitions to see how consistent they are:
membership_heatmap(res, k = 2)
membership_heatmap(res, k = 3)
membership_heatmap(res, k = 4)
membership_heatmap(res, k = 5)
membership_heatmap(res, k = 6)
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)
get_signatures(res, k = 3)
get_signatures(res, k = 4)
get_signatures(res, k = 5)
get_signatures(res, k = 6)
Signature heatmaps where rows are not scaled:
get_signatures(res, k = 2, scale_rows = FALSE)
get_signatures(res, k = 3, scale_rows = FALSE)
get_signatures(res, k = 4, scale_rows = FALSE)
get_signatures(res, k = 5, scale_rows = FALSE)
get_signatures(res, k = 6, scale_rows = FALSE)
Compare the overlap of signatures from different k:
compare_signatures(res)
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:
which_row
: row indices corresponding to the input matrix.fdr
: FDR for the differential test. mean_x
: The mean value in group x.scaled_mean_x
: The mean value in group x after rows are scaled.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")
dimension_reduction(res, k = 3, method = "UMAP")
dimension_reduction(res, k = 4, method = "UMAP")
dimension_reduction(res, k = 5, method = "UMAP")
dimension_reduction(res, k = 6, method = "UMAP")
Following heatmap shows how subgroups are split when increasing k
:
collect_classes(res)
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.
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 10869 rows and 66 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.
#> There is no best k.
#>
#> 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)
The plots are:
k
and the heatmap of
predicted classes for each k
.k
.k
.k
.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:
k
;k
, the area increased is defined as \(A_k - A_{k-1}\).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)
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.657 0.841 0.903 0.3542 0.571 0.571
#> 3 3 0.647 0.768 0.878 0.6919 0.760 0.585
#> 4 4 0.577 0.693 0.849 0.0407 0.984 0.954
#> 5 5 0.601 0.692 0.850 0.0138 0.993 0.977
#> 6 6 0.602 0.731 0.878 0.0361 0.993 0.978
suggest_best_k()
suggests the best \(k\) based on these statistics. The rules are as follows:
suggest_best_k(res)
#> [1] NA
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.
cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#> class entropy silhouette p1 p2
#> SRR330857 1 0.0000 0.956 1.000 0.000
#> SRR330858 1 0.0000 0.956 1.000 0.000
#> SRR330859 1 0.0000 0.956 1.000 0.000
#> SRR330860 2 0.9427 0.747 0.360 0.640
#> SRR330861 1 0.0000 0.956 1.000 0.000
#> SRR330862 2 0.9580 0.744 0.380 0.620
#> SRR330863 1 0.0000 0.956 1.000 0.000
#> SRR330864 2 0.9635 0.737 0.388 0.612
#> SRR330865 1 0.0000 0.956 1.000 0.000
#> SRR330866 2 0.9552 0.747 0.376 0.624
#> SRR330867 1 0.0000 0.956 1.000 0.000
#> SRR330868 2 0.9635 0.737 0.388 0.612
#> SRR330869 1 0.1184 0.948 0.984 0.016
#> SRR330870 1 0.0000 0.956 1.000 0.000
#> SRR330871 1 0.0000 0.956 1.000 0.000
#> SRR330872 2 0.9922 0.617 0.448 0.552
#> SRR330873 1 0.0000 0.956 1.000 0.000
#> SRR330874 2 0.0000 0.693 0.000 1.000
#> SRR330875 1 0.0000 0.956 1.000 0.000
#> SRR330876 1 0.0000 0.956 1.000 0.000
#> SRR330877 1 0.0000 0.956 1.000 0.000
#> SRR330878 1 0.0000 0.956 1.000 0.000
#> SRR330879 1 0.0000 0.956 1.000 0.000
#> SRR330880 1 0.9129 0.249 0.672 0.328
#> SRR330881 1 0.0000 0.956 1.000 0.000
#> SRR330882 1 0.0938 0.951 0.988 0.012
#> SRR330883 2 0.0000 0.693 0.000 1.000
#> SRR330884 1 0.1184 0.948 0.984 0.016
#> SRR330885 1 0.9129 0.249 0.672 0.328
#> SRR330886 1 0.0000 0.956 1.000 0.000
#> SRR330887 1 0.0000 0.956 1.000 0.000
#> SRR330888 1 0.0000 0.956 1.000 0.000
#> SRR330889 2 0.9552 0.747 0.376 0.624
#> SRR330890 1 0.9795 -0.186 0.584 0.416
#> SRR330891 2 0.9552 0.747 0.376 0.624
#> SRR330892 2 0.0000 0.693 0.000 1.000
#> SRR330893 2 0.9552 0.747 0.376 0.624
#> SRR330894 2 0.9552 0.747 0.376 0.624
#> SRR330895 2 0.0000 0.693 0.000 1.000
#> SRR330896 1 0.0938 0.951 0.988 0.012
#> SRR330897 2 0.0000 0.693 0.000 1.000
#> SRR330898 2 0.0000 0.693 0.000 1.000
#> SRR330899 1 0.0938 0.951 0.988 0.012
#> SRR330900 1 0.0000 0.956 1.000 0.000
#> SRR330901 1 0.0000 0.956 1.000 0.000
#> SRR330902 1 0.0000 0.956 1.000 0.000
#> SRR330903 1 0.3114 0.900 0.944 0.056
#> SRR330904 2 0.0000 0.693 0.000 1.000
#> SRR330906 1 0.0938 0.951 0.988 0.012
#> SRR330907 1 0.0000 0.956 1.000 0.000
#> SRR330908 1 0.5737 0.771 0.864 0.136
#> SRR330909 1 0.0000 0.956 1.000 0.000
#> SRR330910 1 0.0938 0.951 0.988 0.012
#> SRR330911 2 0.9552 0.747 0.376 0.624
#> SRR330912 2 0.9552 0.747 0.376 0.624
#> SRR330913 1 0.0938 0.951 0.988 0.012
#> SRR330914 1 0.1184 0.948 0.984 0.016
#> SRR330915 1 0.0938 0.951 0.988 0.012
#> SRR330916 2 0.9552 0.747 0.376 0.624
#> SRR330917 1 0.1184 0.948 0.984 0.016
#> SRR330918 1 0.0938 0.951 0.988 0.012
#> SRR330919 1 0.0000 0.956 1.000 0.000
#> SRR330920 1 0.0000 0.956 1.000 0.000
#> SRR330921 1 0.0376 0.954 0.996 0.004
#> SRR330922 1 0.0938 0.951 0.988 0.012
#> SRR330923 1 0.0000 0.956 1.000 0.000
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> SRR330857 3 0.0237 0.894 0.004 0.000 0.996
#> SRR330858 3 0.0592 0.891 0.012 0.000 0.988
#> SRR330859 3 0.5760 0.501 0.328 0.000 0.672
#> SRR330860 2 0.6318 0.697 0.356 0.636 0.008
#> SRR330861 3 0.0237 0.894 0.004 0.000 0.996
#> SRR330862 2 0.8058 0.646 0.376 0.552 0.072
#> SRR330863 3 0.6204 0.217 0.424 0.000 0.576
#> SRR330864 2 0.8643 0.610 0.376 0.516 0.108
#> SRR330865 3 0.0237 0.894 0.004 0.000 0.996
#> SRR330866 2 0.6026 0.692 0.376 0.624 0.000
#> SRR330867 3 0.0424 0.893 0.008 0.000 0.992
#> SRR330868 2 0.8586 0.614 0.376 0.520 0.104
#> SRR330869 1 0.2356 0.870 0.928 0.072 0.000
#> SRR330870 3 0.0424 0.893 0.008 0.000 0.992
#> SRR330871 3 0.0237 0.894 0.004 0.000 0.996
#> SRR330872 3 0.6940 0.561 0.224 0.068 0.708
#> SRR330873 3 0.0424 0.893 0.008 0.000 0.992
#> SRR330874 2 0.0000 0.640 0.000 1.000 0.000
#> SRR330875 3 0.0237 0.894 0.004 0.000 0.996
#> SRR330876 3 0.0237 0.894 0.004 0.000 0.996
#> SRR330877 3 0.0237 0.894 0.004 0.000 0.996
#> SRR330878 3 0.0237 0.894 0.004 0.000 0.996
#> SRR330879 1 0.2796 0.832 0.908 0.000 0.092
#> SRR330880 1 0.7002 0.376 0.672 0.280 0.048
#> SRR330881 3 0.3116 0.823 0.108 0.000 0.892
#> SRR330882 1 0.0000 0.912 1.000 0.000 0.000
#> SRR330883 2 0.0000 0.640 0.000 1.000 0.000
#> SRR330884 1 0.1289 0.900 0.968 0.032 0.000
#> SRR330885 1 0.5760 0.328 0.672 0.328 0.000
#> SRR330886 1 0.0000 0.912 1.000 0.000 0.000
#> SRR330887 1 0.0000 0.912 1.000 0.000 0.000
#> SRR330888 1 0.0000 0.912 1.000 0.000 0.000
#> SRR330889 2 0.6026 0.692 0.376 0.624 0.000
#> SRR330890 1 0.6244 -0.236 0.560 0.440 0.000
#> SRR330891 2 0.6026 0.692 0.376 0.624 0.000
#> SRR330892 2 0.0000 0.640 0.000 1.000 0.000
#> SRR330893 2 0.6026 0.692 0.376 0.624 0.000
#> SRR330894 2 0.6026 0.692 0.376 0.624 0.000
#> SRR330895 2 0.0000 0.640 0.000 1.000 0.000
#> SRR330896 1 0.0592 0.909 0.988 0.012 0.000
#> SRR330897 2 0.0000 0.640 0.000 1.000 0.000
#> SRR330898 2 0.0000 0.640 0.000 1.000 0.000
#> SRR330899 1 0.0000 0.912 1.000 0.000 0.000
#> SRR330900 1 0.0000 0.912 1.000 0.000 0.000
#> SRR330901 1 0.0000 0.912 1.000 0.000 0.000
#> SRR330902 1 0.0000 0.912 1.000 0.000 0.000
#> SRR330903 1 0.2796 0.848 0.908 0.092 0.000
#> SRR330904 2 0.0000 0.640 0.000 1.000 0.000
#> SRR330906 1 0.1753 0.889 0.952 0.048 0.000
#> SRR330907 3 0.4504 0.744 0.196 0.000 0.804
#> SRR330908 1 0.4002 0.750 0.840 0.160 0.000
#> SRR330909 1 0.0000 0.912 1.000 0.000 0.000
#> SRR330910 1 0.0237 0.911 0.996 0.004 0.000
#> SRR330911 2 0.6026 0.692 0.376 0.624 0.000
#> SRR330912 2 0.6026 0.692 0.376 0.624 0.000
#> SRR330913 1 0.1289 0.900 0.968 0.032 0.000
#> SRR330914 1 0.2356 0.870 0.928 0.072 0.000
#> SRR330915 1 0.0000 0.912 1.000 0.000 0.000
#> SRR330916 2 0.6026 0.692 0.376 0.624 0.000
#> SRR330917 1 0.2066 0.880 0.940 0.060 0.000
#> SRR330918 1 0.0424 0.911 0.992 0.008 0.000
#> SRR330919 1 0.0000 0.912 1.000 0.000 0.000
#> SRR330920 1 0.0000 0.912 1.000 0.000 0.000
#> SRR330921 1 0.0000 0.912 1.000 0.000 0.000
#> SRR330922 1 0.0000 0.912 1.000 0.000 0.000
#> SRR330923 1 0.2165 0.839 0.936 0.000 0.064
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> SRR330857 3 0.0000 0.8583 0.000 0.000 1.000 0.000
#> SRR330858 3 0.0336 0.8552 0.008 0.000 0.992 0.000
#> SRR330859 3 0.4564 0.4501 0.328 0.000 0.672 0.000
#> SRR330860 4 0.5147 0.0719 0.000 0.460 0.004 0.536
#> SRR330861 3 0.0000 0.8583 0.000 0.000 1.000 0.000
#> SRR330862 4 0.8421 0.5567 0.376 0.084 0.100 0.440
#> SRR330863 3 0.4916 0.1891 0.424 0.000 0.576 0.000
#> SRR330864 4 0.8463 0.5533 0.376 0.084 0.104 0.436
#> SRR330865 3 0.0000 0.8583 0.000 0.000 1.000 0.000
#> SRR330866 4 0.4776 0.6445 0.376 0.000 0.000 0.624
#> SRR330867 3 0.0188 0.8574 0.004 0.000 0.996 0.000
#> SRR330868 4 0.8421 0.5567 0.376 0.084 0.100 0.440
#> SRR330869 1 0.3486 0.7325 0.812 0.000 0.000 0.188
#> SRR330870 3 0.0188 0.8574 0.004 0.000 0.996 0.000
#> SRR330871 3 0.0188 0.8562 0.000 0.004 0.996 0.000
#> SRR330872 3 0.7360 0.4195 0.224 0.084 0.624 0.068
#> SRR330873 3 0.0188 0.8572 0.004 0.000 0.996 0.000
#> SRR330874 2 0.4776 0.8823 0.000 0.624 0.000 0.376
#> SRR330875 3 0.0000 0.8583 0.000 0.000 1.000 0.000
#> SRR330876 3 0.0000 0.8583 0.000 0.000 1.000 0.000
#> SRR330877 3 0.0000 0.8583 0.000 0.000 1.000 0.000
#> SRR330878 3 0.0000 0.8583 0.000 0.000 1.000 0.000
#> SRR330879 1 0.2216 0.8070 0.908 0.000 0.092 0.000
#> SRR330880 1 0.6476 0.4410 0.672 0.084 0.024 0.220
#> SRR330881 3 0.2345 0.7661 0.100 0.000 0.900 0.000
#> SRR330882 1 0.0000 0.8822 1.000 0.000 0.000 0.000
#> SRR330883 4 0.0000 0.2066 0.000 0.000 0.000 1.000
#> SRR330884 1 0.1867 0.8478 0.928 0.000 0.000 0.072
#> SRR330885 1 0.4543 0.4188 0.676 0.000 0.000 0.324
#> SRR330886 1 0.0000 0.8822 1.000 0.000 0.000 0.000
#> SRR330887 1 0.0000 0.8822 1.000 0.000 0.000 0.000
#> SRR330888 1 0.0000 0.8822 1.000 0.000 0.000 0.000
#> SRR330889 4 0.5769 0.6328 0.376 0.036 0.000 0.588
#> SRR330890 1 0.4948 -0.2082 0.560 0.000 0.000 0.440
#> SRR330891 4 0.4776 0.6445 0.376 0.000 0.000 0.624
#> SRR330892 2 0.4981 0.8758 0.000 0.536 0.000 0.464
#> SRR330893 4 0.4776 0.6445 0.376 0.000 0.000 0.624
#> SRR330894 4 0.4776 0.6445 0.376 0.000 0.000 0.624
#> SRR330895 4 0.0000 0.2066 0.000 0.000 0.000 1.000
#> SRR330896 1 0.0707 0.8751 0.980 0.000 0.000 0.020
#> SRR330897 4 0.0000 0.2066 0.000 0.000 0.000 1.000
#> SRR330898 4 0.1867 0.0252 0.000 0.072 0.000 0.928
#> SRR330899 1 0.0000 0.8822 1.000 0.000 0.000 0.000
#> SRR330900 1 0.0000 0.8822 1.000 0.000 0.000 0.000
#> SRR330901 1 0.0000 0.8822 1.000 0.000 0.000 0.000
#> SRR330902 1 0.0000 0.8822 1.000 0.000 0.000 0.000
#> SRR330903 1 0.3528 0.7267 0.808 0.000 0.000 0.192
#> SRR330904 4 0.0000 0.2066 0.000 0.000 0.000 1.000
#> SRR330906 1 0.2469 0.8190 0.892 0.000 0.000 0.108
#> SRR330907 3 0.3486 0.6681 0.188 0.000 0.812 0.000
#> SRR330908 1 0.3610 0.7141 0.800 0.000 0.000 0.200
#> SRR330909 1 0.0000 0.8822 1.000 0.000 0.000 0.000
#> SRR330910 1 0.0188 0.8811 0.996 0.000 0.000 0.004
#> SRR330911 4 0.4776 0.6445 0.376 0.000 0.000 0.624
#> SRR330912 4 0.4776 0.6445 0.376 0.000 0.000 0.624
#> SRR330913 1 0.1940 0.8455 0.924 0.000 0.000 0.076
#> SRR330914 1 0.3311 0.7536 0.828 0.000 0.000 0.172
#> SRR330915 1 0.0000 0.8822 1.000 0.000 0.000 0.000
#> SRR330916 4 0.4776 0.6445 0.376 0.000 0.000 0.624
#> SRR330917 1 0.3123 0.7716 0.844 0.000 0.000 0.156
#> SRR330918 1 0.0336 0.8800 0.992 0.000 0.000 0.008
#> SRR330919 1 0.0000 0.8822 1.000 0.000 0.000 0.000
#> SRR330920 1 0.0000 0.8822 1.000 0.000 0.000 0.000
#> SRR330921 1 0.0000 0.8822 1.000 0.000 0.000 0.000
#> SRR330922 1 0.0000 0.8822 1.000 0.000 0.000 0.000
#> SRR330923 1 0.1716 0.8094 0.936 0.000 0.064 0.000
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> SRR330857 1 0.0000 0.8490 1.000 0.000 0.000 0.000 0.000
#> SRR330858 1 0.0162 0.8474 0.996 0.000 0.000 0.000 0.004
#> SRR330859 1 0.4084 0.4100 0.668 0.000 0.004 0.000 0.328
#> SRR330860 3 0.0000 0.0000 0.000 0.000 1.000 0.000 0.000
#> SRR330861 1 0.0162 0.8485 0.996 0.000 0.004 0.000 0.000
#> SRR330862 4 0.7365 0.5776 0.092 0.000 0.104 0.432 0.372
#> SRR330863 1 0.4383 0.1783 0.572 0.000 0.004 0.000 0.424
#> SRR330864 4 0.7365 0.5776 0.092 0.000 0.104 0.432 0.372
#> SRR330865 1 0.0162 0.8485 0.996 0.000 0.004 0.000 0.000
#> SRR330866 4 0.4101 0.6722 0.000 0.000 0.000 0.628 0.372
#> SRR330867 1 0.0000 0.8490 1.000 0.000 0.000 0.000 0.000
#> SRR330868 4 0.7365 0.5776 0.092 0.000 0.104 0.432 0.372
#> SRR330869 5 0.3074 0.7165 0.000 0.000 0.000 0.196 0.804
#> SRR330870 1 0.0000 0.8490 1.000 0.000 0.000 0.000 0.000
#> SRR330871 1 0.0510 0.8411 0.984 0.000 0.016 0.000 0.000
#> SRR330872 1 0.6573 0.3557 0.604 0.000 0.104 0.068 0.224
#> SRR330873 1 0.0162 0.8474 0.996 0.000 0.000 0.000 0.004
#> SRR330874 2 0.4101 0.9735 0.000 0.628 0.000 0.372 0.000
#> SRR330875 1 0.0162 0.8485 0.996 0.000 0.004 0.000 0.000
#> SRR330876 1 0.0000 0.8490 1.000 0.000 0.000 0.000 0.000
#> SRR330877 1 0.0162 0.8485 0.996 0.000 0.004 0.000 0.000
#> SRR330878 1 0.0000 0.8490 1.000 0.000 0.000 0.000 0.000
#> SRR330879 5 0.1851 0.8058 0.088 0.000 0.000 0.000 0.912
#> SRR330880 5 0.5623 0.4366 0.020 0.000 0.104 0.204 0.672
#> SRR330881 1 0.1908 0.7567 0.908 0.000 0.000 0.000 0.092
#> SRR330882 5 0.0000 0.8789 0.000 0.000 0.000 0.000 1.000
#> SRR330883 4 0.0000 0.2283 0.000 0.000 0.000 1.000 0.000
#> SRR330884 5 0.1671 0.8410 0.000 0.000 0.000 0.076 0.924
#> SRR330885 5 0.3913 0.4097 0.000 0.000 0.000 0.324 0.676
#> SRR330886 5 0.0000 0.8789 0.000 0.000 0.000 0.000 1.000
#> SRR330887 5 0.0000 0.8789 0.000 0.000 0.000 0.000 1.000
#> SRR330888 5 0.0000 0.8789 0.000 0.000 0.000 0.000 1.000
#> SRR330889 4 0.5154 0.6556 0.000 0.000 0.048 0.580 0.372
#> SRR330890 5 0.4268 -0.2515 0.000 0.000 0.000 0.444 0.556
#> SRR330891 4 0.4101 0.6722 0.000 0.000 0.000 0.628 0.372
#> SRR330892 2 0.4114 0.9735 0.000 0.624 0.000 0.376 0.000
#> SRR330893 4 0.4101 0.6722 0.000 0.000 0.000 0.628 0.372
#> SRR330894 4 0.4101 0.6722 0.000 0.000 0.000 0.628 0.372
#> SRR330895 4 0.0000 0.2283 0.000 0.000 0.000 1.000 0.000
#> SRR330896 5 0.0609 0.8716 0.000 0.000 0.000 0.020 0.980
#> SRR330897 4 0.0000 0.2283 0.000 0.000 0.000 1.000 0.000
#> SRR330898 4 0.4306 -0.0538 0.000 0.492 0.000 0.508 0.000
#> SRR330899 5 0.0000 0.8789 0.000 0.000 0.000 0.000 1.000
#> SRR330900 5 0.0000 0.8789 0.000 0.000 0.000 0.000 1.000
#> SRR330901 5 0.0000 0.8789 0.000 0.000 0.000 0.000 1.000
#> SRR330902 5 0.0000 0.8789 0.000 0.000 0.000 0.000 1.000
#> SRR330903 5 0.3074 0.7165 0.000 0.000 0.000 0.196 0.804
#> SRR330904 4 0.0000 0.2283 0.000 0.000 0.000 1.000 0.000
#> SRR330906 5 0.2179 0.8110 0.000 0.000 0.000 0.112 0.888
#> SRR330907 1 0.2966 0.6464 0.816 0.000 0.000 0.000 0.184
#> SRR330908 5 0.3109 0.7103 0.000 0.000 0.000 0.200 0.800
#> SRR330909 5 0.0000 0.8789 0.000 0.000 0.000 0.000 1.000
#> SRR330910 5 0.0162 0.8778 0.000 0.000 0.000 0.004 0.996
#> SRR330911 4 0.4101 0.6722 0.000 0.000 0.000 0.628 0.372
#> SRR330912 4 0.4101 0.6722 0.000 0.000 0.000 0.628 0.372
#> SRR330913 5 0.1671 0.8414 0.000 0.000 0.000 0.076 0.924
#> SRR330914 5 0.2891 0.7436 0.000 0.000 0.000 0.176 0.824
#> SRR330915 5 0.0000 0.8789 0.000 0.000 0.000 0.000 1.000
#> SRR330916 4 0.4101 0.6722 0.000 0.000 0.000 0.628 0.372
#> SRR330917 5 0.2773 0.7576 0.000 0.000 0.000 0.164 0.836
#> SRR330918 5 0.0290 0.8767 0.000 0.000 0.000 0.008 0.992
#> SRR330919 5 0.0000 0.8789 0.000 0.000 0.000 0.000 1.000
#> SRR330920 5 0.0000 0.8789 0.000 0.000 0.000 0.000 1.000
#> SRR330921 5 0.0000 0.8789 0.000 0.000 0.000 0.000 1.000
#> SRR330922 5 0.0000 0.8789 0.000 0.000 0.000 0.000 1.000
#> SRR330923 5 0.1478 0.8045 0.064 0.000 0.000 0.000 0.936
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> SRR330857 1 0.0000 0.854 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR330858 1 0.0146 0.853 0.996 0.000 0.000 0.004 0.000 0.000
#> SRR330859 1 0.3668 0.421 0.668 0.000 0.000 0.328 0.004 0.000
#> SRR330860 6 0.0000 0.000 0.000 0.000 0.000 0.000 0.000 1.000
#> SRR330861 1 0.0146 0.854 0.996 0.000 0.000 0.000 0.004 0.000
#> SRR330862 3 0.6557 0.658 0.088 0.000 0.560 0.244 0.020 0.088
#> SRR330863 1 0.3937 0.226 0.572 0.000 0.000 0.424 0.004 0.000
#> SRR330864 3 0.6557 0.658 0.088 0.000 0.560 0.244 0.020 0.088
#> SRR330865 1 0.0146 0.854 0.996 0.000 0.000 0.000 0.004 0.000
#> SRR330866 3 0.3101 0.798 0.000 0.000 0.756 0.244 0.000 0.000
#> SRR330867 1 0.0000 0.854 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR330868 3 0.6557 0.658 0.088 0.000 0.560 0.244 0.020 0.088
#> SRR330869 4 0.2762 0.754 0.000 0.000 0.196 0.804 0.000 0.000
#> SRR330870 1 0.0000 0.854 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR330871 1 0.0508 0.847 0.984 0.000 0.000 0.000 0.004 0.012
#> SRR330872 1 0.6232 0.365 0.600 0.000 0.068 0.224 0.020 0.088
#> SRR330873 1 0.0146 0.853 0.996 0.000 0.000 0.004 0.000 0.000
#> SRR330874 2 0.5279 0.640 0.000 0.596 0.244 0.000 0.160 0.000
#> SRR330875 1 0.0146 0.854 0.996 0.000 0.000 0.000 0.004 0.000
#> SRR330876 1 0.0000 0.854 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR330877 1 0.0146 0.854 0.996 0.000 0.000 0.000 0.004 0.000
#> SRR330878 1 0.0000 0.854 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR330879 4 0.1610 0.833 0.084 0.000 0.000 0.916 0.000 0.000
#> SRR330880 4 0.5354 0.528 0.020 0.000 0.200 0.672 0.020 0.088
#> SRR330881 1 0.1663 0.768 0.912 0.000 0.000 0.088 0.000 0.000
#> SRR330882 4 0.0000 0.892 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR330883 3 0.0260 0.482 0.000 0.000 0.992 0.000 0.008 0.000
#> SRR330884 4 0.1501 0.860 0.000 0.000 0.076 0.924 0.000 0.000
#> SRR330885 4 0.3515 0.505 0.000 0.000 0.324 0.676 0.000 0.000
#> SRR330886 4 0.0000 0.892 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR330887 4 0.0000 0.892 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR330888 4 0.0000 0.892 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR330889 3 0.4038 0.778 0.000 0.000 0.712 0.244 0.000 0.044
#> SRR330890 4 0.3860 -0.192 0.000 0.000 0.472 0.528 0.000 0.000
#> SRR330891 3 0.3101 0.798 0.000 0.000 0.756 0.244 0.000 0.000
#> SRR330892 2 0.1610 0.630 0.000 0.916 0.084 0.000 0.000 0.000
#> SRR330893 3 0.3101 0.798 0.000 0.000 0.756 0.244 0.000 0.000
#> SRR330894 3 0.3101 0.798 0.000 0.000 0.756 0.244 0.000 0.000
#> SRR330895 3 0.0000 0.493 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR330896 4 0.0547 0.886 0.000 0.000 0.020 0.980 0.000 0.000
#> SRR330897 3 0.1588 0.480 0.000 0.072 0.924 0.000 0.004 0.000
#> SRR330898 5 0.3098 0.000 0.000 0.024 0.164 0.000 0.812 0.000
#> SRR330899 4 0.0000 0.892 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR330900 4 0.0000 0.892 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR330901 4 0.0000 0.892 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR330902 4 0.0000 0.892 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR330903 4 0.2762 0.754 0.000 0.000 0.196 0.804 0.000 0.000
#> SRR330904 3 0.0000 0.493 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR330906 4 0.1957 0.834 0.000 0.000 0.112 0.888 0.000 0.000
#> SRR330907 1 0.2664 0.654 0.816 0.000 0.000 0.184 0.000 0.000
#> SRR330908 4 0.2793 0.748 0.000 0.000 0.200 0.800 0.000 0.000
#> SRR330909 4 0.0000 0.892 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR330910 4 0.0146 0.891 0.000 0.000 0.004 0.996 0.000 0.000
#> SRR330911 3 0.3101 0.798 0.000 0.000 0.756 0.244 0.000 0.000
#> SRR330912 3 0.3101 0.798 0.000 0.000 0.756 0.244 0.000 0.000
#> SRR330913 4 0.1501 0.860 0.000 0.000 0.076 0.924 0.000 0.000
#> SRR330914 4 0.2597 0.776 0.000 0.000 0.176 0.824 0.000 0.000
#> SRR330915 4 0.0000 0.892 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR330916 3 0.3101 0.798 0.000 0.000 0.756 0.244 0.000 0.000
#> SRR330917 4 0.2491 0.788 0.000 0.000 0.164 0.836 0.000 0.000
#> SRR330918 4 0.0260 0.890 0.000 0.000 0.008 0.992 0.000 0.000
#> SRR330919 4 0.0000 0.892 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR330920 4 0.0000 0.892 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR330921 4 0.0000 0.892 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR330922 4 0.0000 0.892 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR330923 4 0.1327 0.828 0.064 0.000 0.000 0.936 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)
consensus_heatmap(res, k = 3)
consensus_heatmap(res, k = 4)
consensus_heatmap(res, k = 5)
consensus_heatmap(res, k = 6)
Heatmaps for the membership of samples in all partitions to see how consistent they are:
membership_heatmap(res, k = 2)
membership_heatmap(res, k = 3)
membership_heatmap(res, k = 4)
membership_heatmap(res, k = 5)
membership_heatmap(res, k = 6)
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)
get_signatures(res, k = 3)
get_signatures(res, k = 4)
get_signatures(res, k = 5)
get_signatures(res, k = 6)
Signature heatmaps where rows are not scaled:
get_signatures(res, k = 2, scale_rows = FALSE)
get_signatures(res, k = 3, scale_rows = FALSE)
get_signatures(res, k = 4, scale_rows = FALSE)
get_signatures(res, k = 5, scale_rows = FALSE)
get_signatures(res, k = 6, scale_rows = FALSE)
Compare the overlap of signatures from different k:
compare_signatures(res)
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:
which_row
: row indices corresponding to the input matrix.fdr
: FDR for the differential test. mean_x
: The mean value in group x.scaled_mean_x
: The mean value in group x after rows are scaled.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")
dimension_reduction(res, k = 3, method = "UMAP")
dimension_reduction(res, k = 4, method = "UMAP")
dimension_reduction(res, k = 5, method = "UMAP")
dimension_reduction(res, k = 6, method = "UMAP")
Following heatmap shows how subgroups are split when increasing k
:
collect_classes(res)
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.
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 10869 rows and 66 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 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)
The plots are:
k
and the heatmap of
predicted classes for each k
.k
.k
.k
.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:
k
;k
, the area increased is defined as \(A_k - A_{k-1}\).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)
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.530 0.799 0.896 0.3224 0.739 0.739
#> 3 3 1.000 0.950 0.966 0.7938 0.669 0.556
#> 4 4 0.802 0.870 0.910 0.2526 0.758 0.477
#> 5 5 0.679 0.778 0.856 0.0468 0.908 0.685
#> 6 6 0.695 0.700 0.790 0.0572 0.920 0.699
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.
cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#> class entropy silhouette p1 p2
#> SRR330857 1 0.8267 0.746 0.740 0.260
#> SRR330858 1 0.8267 0.746 0.740 0.260
#> SRR330859 1 0.8267 0.746 0.740 0.260
#> SRR330860 2 0.0000 0.902 0.000 1.000
#> SRR330861 1 0.8267 0.746 0.740 0.260
#> SRR330862 1 0.9608 0.553 0.616 0.384
#> SRR330863 1 0.8267 0.746 0.740 0.260
#> SRR330864 1 0.9491 0.584 0.632 0.368
#> SRR330865 1 0.8267 0.746 0.740 0.260
#> SRR330866 1 0.0672 0.865 0.992 0.008
#> SRR330867 1 0.8267 0.746 0.740 0.260
#> SRR330868 2 0.9983 -0.235 0.476 0.524
#> SRR330869 1 0.0000 0.867 1.000 0.000
#> SRR330870 1 0.8267 0.746 0.740 0.260
#> SRR330871 1 0.8267 0.746 0.740 0.260
#> SRR330872 1 0.9710 0.519 0.600 0.400
#> SRR330873 1 0.8267 0.746 0.740 0.260
#> SRR330874 2 0.0000 0.902 0.000 1.000
#> SRR330875 1 0.9754 0.501 0.592 0.408
#> SRR330876 1 0.8267 0.746 0.740 0.260
#> SRR330877 1 0.8267 0.746 0.740 0.260
#> SRR330878 1 0.8267 0.746 0.740 0.260
#> SRR330879 1 0.8267 0.746 0.740 0.260
#> SRR330880 1 0.8267 0.746 0.740 0.260
#> SRR330881 1 0.4690 0.831 0.900 0.100
#> SRR330882 2 0.0000 0.902 0.000 1.000
#> SRR330883 2 0.0000 0.902 0.000 1.000
#> SRR330884 1 0.0000 0.867 1.000 0.000
#> SRR330885 1 0.6623 0.796 0.828 0.172
#> SRR330886 1 0.4562 0.833 0.904 0.096
#> SRR330887 1 0.0000 0.867 1.000 0.000
#> SRR330888 1 0.0000 0.867 1.000 0.000
#> SRR330889 1 0.8267 0.746 0.740 0.260
#> SRR330890 1 0.0000 0.867 1.000 0.000
#> SRR330891 1 0.0000 0.867 1.000 0.000
#> SRR330892 2 0.0000 0.902 0.000 1.000
#> SRR330893 1 0.0000 0.867 1.000 0.000
#> SRR330894 1 0.0000 0.867 1.000 0.000
#> SRR330895 2 0.0000 0.902 0.000 1.000
#> SRR330896 1 0.0000 0.867 1.000 0.000
#> SRR330897 2 0.0000 0.902 0.000 1.000
#> SRR330898 2 0.0000 0.902 0.000 1.000
#> SRR330899 1 0.0000 0.867 1.000 0.000
#> SRR330900 1 0.0000 0.867 1.000 0.000
#> SRR330901 1 0.0000 0.867 1.000 0.000
#> SRR330902 1 0.0000 0.867 1.000 0.000
#> SRR330903 1 0.0000 0.867 1.000 0.000
#> SRR330904 1 0.0000 0.867 1.000 0.000
#> SRR330906 1 0.0000 0.867 1.000 0.000
#> SRR330907 1 0.0672 0.865 0.992 0.008
#> SRR330908 1 0.0000 0.867 1.000 0.000
#> SRR330909 1 0.0000 0.867 1.000 0.000
#> SRR330910 1 0.0000 0.867 1.000 0.000
#> SRR330911 1 0.0376 0.866 0.996 0.004
#> SRR330912 1 0.0000 0.867 1.000 0.000
#> SRR330913 1 0.0000 0.867 1.000 0.000
#> SRR330914 1 0.0000 0.867 1.000 0.000
#> SRR330915 1 0.0000 0.867 1.000 0.000
#> SRR330916 1 0.0000 0.867 1.000 0.000
#> SRR330917 1 0.0000 0.867 1.000 0.000
#> SRR330918 2 0.8443 0.622 0.272 0.728
#> SRR330919 1 0.0000 0.867 1.000 0.000
#> SRR330920 1 0.0000 0.867 1.000 0.000
#> SRR330921 1 0.0000 0.867 1.000 0.000
#> SRR330922 1 0.0000 0.867 1.000 0.000
#> SRR330923 1 0.0000 0.867 1.000 0.000
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> SRR330857 3 0.0237 0.997 0.004 0.000 0.996
#> SRR330858 3 0.0237 0.997 0.004 0.000 0.996
#> SRR330859 3 0.0237 0.997 0.004 0.000 0.996
#> SRR330860 2 0.1163 0.948 0.000 0.972 0.028
#> SRR330861 3 0.0237 0.997 0.004 0.000 0.996
#> SRR330862 3 0.0829 0.985 0.004 0.012 0.984
#> SRR330863 3 0.0237 0.997 0.004 0.000 0.996
#> SRR330864 3 0.0237 0.997 0.004 0.000 0.996
#> SRR330865 3 0.0237 0.997 0.004 0.000 0.996
#> SRR330866 1 0.1919 0.955 0.956 0.024 0.020
#> SRR330867 3 0.0237 0.997 0.004 0.000 0.996
#> SRR330868 3 0.0237 0.997 0.004 0.000 0.996
#> SRR330869 1 0.0424 0.958 0.992 0.000 0.008
#> SRR330870 3 0.0237 0.997 0.004 0.000 0.996
#> SRR330871 3 0.0237 0.997 0.004 0.000 0.996
#> SRR330872 3 0.0892 0.970 0.000 0.020 0.980
#> SRR330873 3 0.0237 0.997 0.004 0.000 0.996
#> SRR330874 2 0.1643 0.941 0.000 0.956 0.044
#> SRR330875 3 0.0475 0.994 0.004 0.004 0.992
#> SRR330876 3 0.0237 0.997 0.004 0.000 0.996
#> SRR330877 3 0.0237 0.997 0.004 0.000 0.996
#> SRR330878 3 0.0237 0.997 0.004 0.000 0.996
#> SRR330879 1 0.5988 0.481 0.632 0.000 0.368
#> SRR330880 3 0.0237 0.997 0.004 0.000 0.996
#> SRR330881 1 0.4974 0.725 0.764 0.000 0.236
#> SRR330882 2 0.1919 0.960 0.020 0.956 0.024
#> SRR330883 2 0.1919 0.960 0.020 0.956 0.024
#> SRR330884 1 0.0892 0.960 0.980 0.000 0.020
#> SRR330885 1 0.1163 0.949 0.972 0.000 0.028
#> SRR330886 1 0.1860 0.939 0.948 0.000 0.052
#> SRR330887 1 0.0892 0.960 0.980 0.000 0.020
#> SRR330888 1 0.0892 0.960 0.980 0.000 0.020
#> SRR330889 1 0.4702 0.758 0.788 0.000 0.212
#> SRR330890 1 0.0000 0.956 1.000 0.000 0.000
#> SRR330891 1 0.1031 0.952 0.976 0.024 0.000
#> SRR330892 2 0.1919 0.960 0.020 0.956 0.024
#> SRR330893 1 0.1031 0.952 0.976 0.024 0.000
#> SRR330894 1 0.1031 0.952 0.976 0.024 0.000
#> SRR330895 2 0.2056 0.958 0.024 0.952 0.024
#> SRR330896 1 0.0892 0.960 0.980 0.000 0.020
#> SRR330897 2 0.1919 0.960 0.020 0.956 0.024
#> SRR330898 2 0.1919 0.960 0.020 0.956 0.024
#> SRR330899 1 0.0892 0.960 0.980 0.000 0.020
#> SRR330900 1 0.0892 0.960 0.980 0.000 0.020
#> SRR330901 1 0.0892 0.960 0.980 0.000 0.020
#> SRR330902 1 0.0892 0.960 0.980 0.000 0.020
#> SRR330903 1 0.1031 0.952 0.976 0.024 0.000
#> SRR330904 1 0.1031 0.952 0.976 0.024 0.000
#> SRR330906 1 0.0000 0.956 1.000 0.000 0.000
#> SRR330907 1 0.2261 0.927 0.932 0.000 0.068
#> SRR330908 1 0.1031 0.952 0.976 0.024 0.000
#> SRR330909 1 0.0892 0.960 0.980 0.000 0.020
#> SRR330910 1 0.0848 0.958 0.984 0.008 0.008
#> SRR330911 1 0.1031 0.952 0.976 0.024 0.000
#> SRR330912 1 0.1031 0.952 0.976 0.024 0.000
#> SRR330913 1 0.0000 0.956 1.000 0.000 0.000
#> SRR330914 1 0.0000 0.956 1.000 0.000 0.000
#> SRR330915 1 0.0892 0.960 0.980 0.000 0.020
#> SRR330916 1 0.1031 0.952 0.976 0.024 0.000
#> SRR330917 1 0.0000 0.956 1.000 0.000 0.000
#> SRR330918 2 0.5315 0.731 0.216 0.772 0.012
#> SRR330919 1 0.0892 0.960 0.980 0.000 0.020
#> SRR330920 1 0.0892 0.960 0.980 0.000 0.020
#> SRR330921 1 0.0892 0.960 0.980 0.000 0.020
#> SRR330922 1 0.0892 0.960 0.980 0.000 0.020
#> SRR330923 1 0.0892 0.960 0.980 0.000 0.020
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> SRR330857 3 0.0000 0.923 0.000 0.000 1.000 0.000
#> SRR330858 3 0.0000 0.923 0.000 0.000 1.000 0.000
#> SRR330859 3 0.0000 0.923 0.000 0.000 1.000 0.000
#> SRR330860 2 0.0336 0.916 0.000 0.992 0.000 0.008
#> SRR330861 3 0.0000 0.923 0.000 0.000 1.000 0.000
#> SRR330862 3 0.1624 0.904 0.000 0.020 0.952 0.028
#> SRR330863 3 0.0000 0.923 0.000 0.000 1.000 0.000
#> SRR330864 3 0.1624 0.904 0.000 0.020 0.952 0.028
#> SRR330865 3 0.0000 0.923 0.000 0.000 1.000 0.000
#> SRR330866 4 0.1940 0.869 0.076 0.000 0.000 0.924
#> SRR330867 3 0.0000 0.923 0.000 0.000 1.000 0.000
#> SRR330868 3 0.1624 0.904 0.000 0.020 0.952 0.028
#> SRR330869 4 0.4624 0.744 0.340 0.000 0.000 0.660
#> SRR330870 3 0.0000 0.923 0.000 0.000 1.000 0.000
#> SRR330871 3 0.0000 0.923 0.000 0.000 1.000 0.000
#> SRR330872 3 0.1624 0.904 0.000 0.020 0.952 0.028
#> SRR330873 3 0.0000 0.923 0.000 0.000 1.000 0.000
#> SRR330874 2 0.1913 0.895 0.000 0.940 0.020 0.040
#> SRR330875 3 0.0000 0.923 0.000 0.000 1.000 0.000
#> SRR330876 3 0.0000 0.923 0.000 0.000 1.000 0.000
#> SRR330877 3 0.0000 0.923 0.000 0.000 1.000 0.000
#> SRR330878 3 0.0000 0.923 0.000 0.000 1.000 0.000
#> SRR330879 3 0.5075 0.489 0.344 0.012 0.644 0.000
#> SRR330880 3 0.0592 0.916 0.000 0.016 0.984 0.000
#> SRR330881 3 0.3829 0.778 0.152 0.016 0.828 0.004
#> SRR330882 2 0.0000 0.917 0.000 1.000 0.000 0.000
#> SRR330883 2 0.0000 0.917 0.000 1.000 0.000 0.000
#> SRR330884 4 0.3942 0.876 0.236 0.000 0.000 0.764
#> SRR330885 4 0.4284 0.879 0.224 0.012 0.000 0.764
#> SRR330886 1 0.2670 0.905 0.908 0.000 0.040 0.052
#> SRR330887 1 0.0188 0.970 0.996 0.000 0.000 0.004
#> SRR330888 1 0.0000 0.970 1.000 0.000 0.000 0.000
#> SRR330889 3 0.6692 0.281 0.388 0.016 0.540 0.056
#> SRR330890 4 0.3942 0.876 0.236 0.000 0.000 0.764
#> SRR330891 4 0.2868 0.885 0.136 0.000 0.000 0.864
#> SRR330892 2 0.0336 0.916 0.000 0.992 0.000 0.008
#> SRR330893 4 0.1792 0.864 0.068 0.000 0.000 0.932
#> SRR330894 4 0.1940 0.870 0.076 0.000 0.000 0.924
#> SRR330895 2 0.0657 0.913 0.004 0.984 0.000 0.012
#> SRR330896 4 0.4431 0.801 0.304 0.000 0.000 0.696
#> SRR330897 2 0.0000 0.917 0.000 1.000 0.000 0.000
#> SRR330898 2 0.0000 0.917 0.000 1.000 0.000 0.000
#> SRR330899 1 0.2530 0.856 0.888 0.000 0.000 0.112
#> SRR330900 1 0.0707 0.962 0.980 0.000 0.000 0.020
#> SRR330901 1 0.0000 0.970 1.000 0.000 0.000 0.000
#> SRR330902 1 0.0469 0.967 0.988 0.000 0.000 0.012
#> SRR330903 4 0.2760 0.883 0.128 0.000 0.000 0.872
#> SRR330904 2 0.6432 0.349 0.076 0.552 0.000 0.372
#> SRR330906 4 0.3873 0.880 0.228 0.000 0.000 0.772
#> SRR330907 3 0.5004 0.374 0.392 0.000 0.604 0.004
#> SRR330908 4 0.1940 0.870 0.076 0.000 0.000 0.924
#> SRR330909 1 0.0188 0.970 0.996 0.000 0.000 0.004
#> SRR330910 4 0.4008 0.872 0.244 0.000 0.000 0.756
#> SRR330911 4 0.1867 0.867 0.072 0.000 0.000 0.928
#> SRR330912 4 0.1940 0.871 0.076 0.000 0.000 0.924
#> SRR330913 4 0.3873 0.880 0.228 0.000 0.000 0.772
#> SRR330914 4 0.3873 0.880 0.228 0.000 0.000 0.772
#> SRR330915 1 0.0000 0.970 1.000 0.000 0.000 0.000
#> SRR330916 4 0.1792 0.864 0.068 0.000 0.000 0.932
#> SRR330917 4 0.3873 0.880 0.228 0.000 0.000 0.772
#> SRR330918 2 0.4820 0.687 0.168 0.772 0.000 0.060
#> SRR330919 1 0.0188 0.968 0.996 0.000 0.000 0.004
#> SRR330920 1 0.0000 0.970 1.000 0.000 0.000 0.000
#> SRR330921 1 0.0000 0.970 1.000 0.000 0.000 0.000
#> SRR330922 1 0.1867 0.906 0.928 0.000 0.000 0.072
#> SRR330923 1 0.0336 0.966 0.992 0.000 0.008 0.000
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> SRR330857 1 0.0000 0.811 1.000 0.000 0.000 0.000 0.000
#> SRR330858 1 0.0000 0.811 1.000 0.000 0.000 0.000 0.000
#> SRR330859 1 0.2773 0.773 0.836 0.000 0.164 0.000 0.000
#> SRR330860 2 0.0566 0.925 0.000 0.984 0.012 0.000 0.004
#> SRR330861 1 0.3039 0.760 0.808 0.000 0.192 0.000 0.000
#> SRR330862 3 0.1768 0.998 0.072 0.000 0.924 0.004 0.000
#> SRR330863 1 0.3143 0.744 0.796 0.000 0.204 0.000 0.000
#> SRR330864 3 0.1768 0.998 0.072 0.000 0.924 0.004 0.000
#> SRR330865 1 0.0290 0.810 0.992 0.000 0.008 0.000 0.000
#> SRR330866 4 0.1117 0.841 0.000 0.000 0.020 0.964 0.016
#> SRR330867 1 0.0000 0.811 1.000 0.000 0.000 0.000 0.000
#> SRR330868 3 0.1768 0.998 0.072 0.000 0.924 0.004 0.000
#> SRR330869 4 0.3013 0.842 0.000 0.000 0.008 0.832 0.160
#> SRR330870 1 0.0000 0.811 1.000 0.000 0.000 0.000 0.000
#> SRR330871 1 0.3003 0.763 0.812 0.000 0.188 0.000 0.000
#> SRR330872 3 0.1608 0.995 0.072 0.000 0.928 0.000 0.000
#> SRR330873 1 0.0000 0.811 1.000 0.000 0.000 0.000 0.000
#> SRR330874 2 0.2763 0.831 0.004 0.848 0.148 0.000 0.000
#> SRR330875 1 0.2929 0.769 0.820 0.000 0.180 0.000 0.000
#> SRR330876 1 0.0000 0.811 1.000 0.000 0.000 0.000 0.000
#> SRR330877 1 0.3395 0.721 0.764 0.000 0.236 0.000 0.000
#> SRR330878 1 0.0000 0.811 1.000 0.000 0.000 0.000 0.000
#> SRR330879 1 0.6060 0.495 0.624 0.008 0.112 0.012 0.244
#> SRR330880 1 0.4448 0.210 0.516 0.000 0.480 0.004 0.000
#> SRR330881 5 0.7086 0.377 0.376 0.040 0.024 0.080 0.480
#> SRR330882 2 0.0290 0.926 0.000 0.992 0.000 0.000 0.008
#> SRR330883 2 0.0290 0.926 0.000 0.992 0.000 0.000 0.008
#> SRR330884 4 0.2997 0.848 0.000 0.000 0.012 0.840 0.148
#> SRR330885 4 0.3599 0.846 0.000 0.024 0.016 0.828 0.132
#> SRR330886 4 0.5225 0.198 0.012 0.000 0.024 0.532 0.432
#> SRR330887 5 0.1792 0.858 0.000 0.000 0.000 0.084 0.916
#> SRR330888 5 0.2011 0.859 0.000 0.000 0.004 0.088 0.908
#> SRR330889 1 0.7875 0.173 0.440 0.040 0.088 0.356 0.076
#> SRR330890 4 0.2886 0.847 0.000 0.000 0.008 0.844 0.148
#> SRR330891 4 0.1628 0.856 0.000 0.000 0.008 0.936 0.056
#> SRR330892 2 0.0324 0.926 0.000 0.992 0.004 0.000 0.004
#> SRR330893 4 0.1012 0.842 0.000 0.000 0.020 0.968 0.012
#> SRR330894 4 0.1117 0.844 0.000 0.000 0.020 0.964 0.016
#> SRR330895 2 0.2102 0.902 0.000 0.916 0.004 0.012 0.068
#> SRR330896 4 0.2886 0.847 0.000 0.000 0.008 0.844 0.148
#> SRR330897 2 0.0794 0.924 0.000 0.972 0.000 0.000 0.028
#> SRR330898 2 0.0451 0.926 0.000 0.988 0.004 0.000 0.008
#> SRR330899 5 0.3661 0.648 0.000 0.000 0.000 0.276 0.724
#> SRR330900 5 0.4201 0.292 0.000 0.000 0.000 0.408 0.592
#> SRR330901 5 0.2011 0.859 0.000 0.000 0.004 0.088 0.908
#> SRR330902 5 0.2929 0.816 0.000 0.000 0.008 0.152 0.840
#> SRR330903 4 0.1568 0.852 0.000 0.000 0.020 0.944 0.036
#> SRR330904 4 0.5247 0.145 0.000 0.400 0.012 0.560 0.028
#> SRR330906 4 0.2920 0.850 0.000 0.000 0.016 0.852 0.132
#> SRR330907 5 0.6254 0.509 0.336 0.004 0.024 0.080 0.556
#> SRR330908 4 0.1216 0.844 0.000 0.000 0.020 0.960 0.020
#> SRR330909 5 0.2411 0.849 0.000 0.000 0.008 0.108 0.884
#> SRR330910 4 0.3098 0.846 0.000 0.000 0.016 0.836 0.148
#> SRR330911 4 0.1117 0.841 0.000 0.000 0.020 0.964 0.016
#> SRR330912 4 0.0404 0.846 0.000 0.000 0.000 0.988 0.012
#> SRR330913 4 0.2753 0.850 0.000 0.000 0.008 0.856 0.136
#> SRR330914 4 0.2753 0.850 0.000 0.000 0.008 0.856 0.136
#> SRR330915 5 0.2011 0.859 0.000 0.000 0.004 0.088 0.908
#> SRR330916 4 0.1117 0.841 0.000 0.000 0.020 0.964 0.016
#> SRR330917 4 0.2753 0.850 0.000 0.000 0.008 0.856 0.136
#> SRR330918 2 0.5035 0.629 0.000 0.724 0.008 0.124 0.144
#> SRR330919 5 0.2011 0.859 0.000 0.000 0.004 0.088 0.908
#> SRR330920 5 0.1792 0.858 0.000 0.000 0.000 0.084 0.916
#> SRR330921 5 0.2011 0.859 0.000 0.000 0.004 0.088 0.908
#> SRR330922 5 0.2561 0.828 0.000 0.000 0.000 0.144 0.856
#> SRR330923 5 0.3857 0.794 0.108 0.000 0.000 0.084 0.808
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> SRR330857 1 0.0363 0.746 0.988 0.000 0.000 0.000 0.000 NA
#> SRR330858 1 0.0632 0.744 0.976 0.000 0.000 0.000 0.000 NA
#> SRR330859 1 0.4772 0.601 0.668 0.000 0.208 0.000 0.000 NA
#> SRR330860 2 0.0622 0.813 0.000 0.980 0.008 0.000 0.000 NA
#> SRR330861 1 0.4750 0.631 0.688 0.000 0.180 0.004 0.000 NA
#> SRR330862 3 0.0405 0.889 0.008 0.000 0.988 0.004 0.000 NA
#> SRR330863 1 0.4823 0.578 0.660 0.000 0.216 0.000 0.000 NA
#> SRR330864 3 0.0405 0.889 0.008 0.000 0.988 0.004 0.000 NA
#> SRR330865 1 0.2680 0.722 0.868 0.000 0.076 0.000 0.000 NA
#> SRR330866 4 0.2512 0.598 0.000 0.000 0.000 0.880 0.060 NA
#> SRR330867 1 0.0603 0.747 0.980 0.000 0.004 0.000 0.000 NA
#> SRR330868 3 0.0405 0.889 0.008 0.000 0.988 0.004 0.000 NA
#> SRR330869 4 0.5822 0.707 0.000 0.000 0.000 0.492 0.232 NA
#> SRR330870 1 0.0632 0.744 0.976 0.000 0.000 0.000 0.000 NA
#> SRR330871 1 0.4745 0.611 0.672 0.000 0.204 0.000 0.000 NA
#> SRR330872 3 0.0870 0.879 0.012 0.004 0.972 0.000 0.000 NA
#> SRR330873 1 0.0777 0.745 0.972 0.000 0.000 0.004 0.000 NA
#> SRR330874 2 0.2346 0.759 0.000 0.868 0.124 0.000 0.000 NA
#> SRR330875 1 0.2888 0.717 0.852 0.000 0.092 0.000 0.000 NA
#> SRR330876 1 0.0146 0.747 0.996 0.000 0.000 0.000 0.000 NA
#> SRR330877 1 0.4855 0.616 0.672 0.000 0.200 0.004 0.000 NA
#> SRR330878 1 0.0508 0.747 0.984 0.000 0.000 0.004 0.000 NA
#> SRR330879 1 0.7681 0.201 0.412 0.000 0.168 0.040 0.284 NA
#> SRR330880 3 0.4651 0.406 0.280 0.000 0.652 0.004 0.000 NA
#> SRR330881 1 0.5999 0.302 0.496 0.008 0.000 0.000 0.276 NA
#> SRR330882 2 0.0405 0.814 0.000 0.988 0.000 0.004 0.000 NA
#> SRR330883 2 0.2762 0.806 0.000 0.804 0.000 0.000 0.000 NA
#> SRR330884 4 0.5507 0.723 0.000 0.000 0.000 0.564 0.208 NA
#> SRR330885 4 0.6434 0.708 0.000 0.044 0.000 0.488 0.176 NA
#> SRR330886 5 0.5875 0.312 0.016 0.000 0.012 0.260 0.580 NA
#> SRR330887 5 0.0260 0.885 0.000 0.000 0.000 0.000 0.992 NA
#> SRR330888 5 0.0622 0.886 0.000 0.000 0.000 0.008 0.980 NA
#> SRR330889 4 0.8978 0.012 0.172 0.036 0.220 0.352 0.112 NA
#> SRR330890 4 0.5770 0.714 0.000 0.000 0.000 0.500 0.212 NA
#> SRR330891 4 0.4969 0.734 0.000 0.000 0.000 0.616 0.104 NA
#> SRR330892 2 0.2664 0.807 0.000 0.816 0.000 0.000 0.000 NA
#> SRR330893 4 0.1245 0.635 0.000 0.000 0.000 0.952 0.032 NA
#> SRR330894 4 0.1245 0.650 0.000 0.000 0.000 0.952 0.032 NA
#> SRR330895 2 0.1701 0.804 0.000 0.920 0.000 0.008 0.000 NA
#> SRR330896 4 0.5839 0.678 0.000 0.000 0.000 0.488 0.276 NA
#> SRR330897 2 0.2823 0.806 0.000 0.796 0.000 0.000 0.000 NA
#> SRR330898 2 0.2730 0.807 0.000 0.808 0.000 0.000 0.000 NA
#> SRR330899 5 0.2088 0.844 0.000 0.000 0.000 0.068 0.904 NA
#> SRR330900 5 0.2662 0.757 0.000 0.000 0.000 0.120 0.856 NA
#> SRR330901 5 0.0405 0.886 0.000 0.000 0.000 0.004 0.988 NA
#> SRR330902 5 0.2462 0.855 0.000 0.000 0.000 0.028 0.876 NA
#> SRR330903 4 0.4516 0.728 0.000 0.000 0.000 0.700 0.112 NA
#> SRR330904 2 0.5474 0.425 0.000 0.540 0.000 0.360 0.020 NA
#> SRR330906 4 0.5705 0.717 0.000 0.000 0.000 0.504 0.188 NA
#> SRR330907 1 0.5851 0.247 0.476 0.000 0.000 0.000 0.304 NA
#> SRR330908 4 0.1657 0.628 0.000 0.000 0.000 0.928 0.056 NA
#> SRR330909 5 0.2264 0.847 0.004 0.000 0.000 0.012 0.888 NA
#> SRR330910 4 0.5298 0.696 0.000 0.000 0.000 0.592 0.248 NA
#> SRR330911 4 0.2328 0.602 0.000 0.000 0.000 0.892 0.056 NA
#> SRR330912 4 0.3432 0.706 0.000 0.000 0.000 0.764 0.020 NA
#> SRR330913 4 0.5726 0.717 0.000 0.000 0.000 0.504 0.196 NA
#> SRR330914 4 0.5726 0.717 0.000 0.000 0.000 0.504 0.196 NA
#> SRR330915 5 0.0622 0.886 0.000 0.000 0.000 0.008 0.980 NA
#> SRR330916 4 0.1984 0.614 0.000 0.000 0.000 0.912 0.056 NA
#> SRR330917 4 0.5716 0.717 0.000 0.000 0.000 0.504 0.192 NA
#> SRR330918 2 0.4945 0.640 0.004 0.740 0.004 0.068 0.108 NA
#> SRR330919 5 0.0914 0.883 0.000 0.000 0.000 0.016 0.968 NA
#> SRR330920 5 0.2110 0.859 0.004 0.000 0.000 0.012 0.900 NA
#> SRR330921 5 0.0622 0.886 0.000 0.000 0.000 0.008 0.980 NA
#> SRR330922 5 0.0972 0.878 0.000 0.000 0.000 0.028 0.964 NA
#> SRR330923 5 0.4682 0.620 0.192 0.000 0.000 0.004 0.692 NA
Heatmaps for the consensus matrix. It visualizes the probability of two samples to be in a same group.
consensus_heatmap(res, k = 2)
consensus_heatmap(res, k = 3)
consensus_heatmap(res, k = 4)
consensus_heatmap(res, k = 5)
consensus_heatmap(res, k = 6)
Heatmaps for the membership of samples in all partitions to see how consistent they are:
membership_heatmap(res, k = 2)
membership_heatmap(res, k = 3)
membership_heatmap(res, k = 4)
membership_heatmap(res, k = 5)
membership_heatmap(res, k = 6)
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)
get_signatures(res, k = 3)
get_signatures(res, k = 4)
get_signatures(res, k = 5)
get_signatures(res, k = 6)
Signature heatmaps where rows are not scaled:
get_signatures(res, k = 2, scale_rows = FALSE)
get_signatures(res, k = 3, scale_rows = FALSE)
get_signatures(res, k = 4, scale_rows = FALSE)
get_signatures(res, k = 5, scale_rows = FALSE)
get_signatures(res, k = 6, scale_rows = FALSE)
Compare the overlap of signatures from different k:
compare_signatures(res)
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:
which_row
: row indices corresponding to the input matrix.fdr
: FDR for the differential test. mean_x
: The mean value in group x.scaled_mean_x
: The mean value in group x after rows are scaled.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")
dimension_reduction(res, k = 3, method = "UMAP")
dimension_reduction(res, k = 4, method = "UMAP")
dimension_reduction(res, k = 5, method = "UMAP")
dimension_reduction(res, k = 6, method = "UMAP")
Following heatmap shows how subgroups are split when increasing k
:
collect_classes(res)
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.
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 10869 rows and 66 columns.
#> Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'MAD' method.
#> Subgroups are detected by 'NMF' method.
#> Performed in total 1250 partitions by row resampling.
#> Best k for subgroups seems to be 3.
#>
#> Following methods can be applied to this 'ConsensusPartition' object:
#> [1] "cola_report" "collect_classes" "collect_plots"
#> [4] "collect_stats" "colnames" "compare_signatures"
#> [7] "consensus_heatmap" "dimension_reduction" "functional_enrichment"
#> [10] "get_anno_col" "get_anno" "get_classes"
#> [13] "get_consensus" "get_matrix" "get_membership"
#> [16] "get_param" "get_signatures" "get_stats"
#> [19] "is_best_k" "is_stable_k" "membership_heatmap"
#> [22] "ncol" "nrow" "plot_ecdf"
#> [25] "rownames" "select_partition_number" "show"
#> [28] "suggest_best_k" "test_to_known_factors"
collect_plots()
function collects all the plots made from res
for all k
(number of partitions)
into one single page to provide an easy and fast comparison between different k
.
collect_plots(res)
The plots are:
k
and the heatmap of
predicted classes for each k
.k
.k
.k
.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:
k
;k
, the area increased is defined as \(A_k - A_{k-1}\).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)
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.329 0.761 0.801 0.3783 0.549 0.549
#> 3 3 0.758 0.866 0.922 0.4651 0.828 0.707
#> 4 4 0.520 0.776 0.884 0.0579 0.976 0.948
#> 5 5 0.415 0.701 0.816 0.0729 1.000 1.000
#> 6 6 0.407 0.538 0.770 0.0468 0.942 0.867
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.
cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#> class entropy silhouette p1 p2
#> SRR330857 2 0.8555 0.823 0.280 0.720
#> SRR330858 2 0.9815 0.857 0.420 0.580
#> SRR330859 2 0.9795 0.860 0.416 0.584
#> SRR330860 2 0.7528 0.278 0.216 0.784
#> SRR330861 2 0.9710 0.865 0.400 0.600
#> SRR330862 2 0.8813 0.841 0.300 0.700
#> SRR330863 2 0.9815 0.857 0.420 0.580
#> SRR330864 2 0.9491 0.867 0.368 0.632
#> SRR330865 2 0.9833 0.853 0.424 0.576
#> SRR330866 1 0.4562 0.764 0.904 0.096
#> SRR330867 2 0.9881 0.837 0.436 0.564
#> SRR330868 2 0.9087 0.856 0.324 0.676
#> SRR330869 1 0.1414 0.818 0.980 0.020
#> SRR330870 2 0.9775 0.862 0.412 0.588
#> SRR330871 2 0.9522 0.868 0.372 0.628
#> SRR330872 2 0.9129 0.857 0.328 0.672
#> SRR330873 2 0.9866 0.843 0.432 0.568
#> SRR330874 1 0.8267 0.300 0.740 0.260
#> SRR330875 2 0.8443 0.813 0.272 0.728
#> SRR330876 2 0.9000 0.852 0.316 0.684
#> SRR330877 2 0.8661 0.831 0.288 0.712
#> SRR330878 2 0.8713 0.835 0.292 0.708
#> SRR330879 2 0.9922 0.818 0.448 0.552
#> SRR330880 2 0.9775 0.862 0.412 0.588
#> SRR330881 2 0.9933 0.810 0.452 0.548
#> SRR330882 1 0.9881 0.398 0.564 0.436
#> SRR330883 1 0.9358 0.502 0.648 0.352
#> SRR330884 1 0.0376 0.820 0.996 0.004
#> SRR330885 1 0.1414 0.819 0.980 0.020
#> SRR330886 1 0.4690 0.759 0.900 0.100
#> SRR330887 1 0.4939 0.748 0.892 0.108
#> SRR330888 1 0.4939 0.748 0.892 0.108
#> SRR330889 1 0.7602 0.483 0.780 0.220
#> SRR330890 1 0.0672 0.820 0.992 0.008
#> SRR330891 1 0.1414 0.816 0.980 0.020
#> SRR330892 1 0.9286 0.512 0.656 0.344
#> SRR330893 1 0.0938 0.819 0.988 0.012
#> SRR330894 1 0.0000 0.821 1.000 0.000
#> SRR330895 1 0.7528 0.644 0.784 0.216
#> SRR330896 1 0.2423 0.810 0.960 0.040
#> SRR330897 1 0.8443 0.585 0.728 0.272
#> SRR330898 1 0.8443 0.585 0.728 0.272
#> SRR330899 1 0.0672 0.820 0.992 0.008
#> SRR330900 1 0.3114 0.800 0.944 0.056
#> SRR330901 1 0.4690 0.759 0.900 0.100
#> SRR330902 1 0.4022 0.781 0.920 0.080
#> SRR330903 1 0.0000 0.821 1.000 0.000
#> SRR330904 1 0.2778 0.802 0.952 0.048
#> SRR330906 1 0.1414 0.820 0.980 0.020
#> SRR330907 1 0.5294 0.728 0.880 0.120
#> SRR330908 1 0.0000 0.821 1.000 0.000
#> SRR330909 1 0.5629 0.729 0.868 0.132
#> SRR330910 1 0.3584 0.788 0.932 0.068
#> SRR330911 1 0.3879 0.785 0.924 0.076
#> SRR330912 1 0.4022 0.778 0.920 0.080
#> SRR330913 1 0.2043 0.811 0.968 0.032
#> SRR330914 1 0.2948 0.800 0.948 0.052
#> SRR330915 1 0.4690 0.759 0.900 0.100
#> SRR330916 1 0.1414 0.818 0.980 0.020
#> SRR330917 1 0.2778 0.802 0.952 0.048
#> SRR330918 1 0.9850 0.409 0.572 0.428
#> SRR330919 1 0.2778 0.806 0.952 0.048
#> SRR330920 1 0.4022 0.782 0.920 0.080
#> SRR330921 1 0.2603 0.808 0.956 0.044
#> SRR330922 1 0.1843 0.815 0.972 0.028
#> SRR330923 1 0.4939 0.748 0.892 0.108
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> SRR330857 3 0.1337 0.9093 0.016 0.012 0.972
#> SRR330858 3 0.2866 0.9080 0.076 0.008 0.916
#> SRR330859 3 0.2356 0.9112 0.072 0.000 0.928
#> SRR330860 2 0.6282 0.5091 0.012 0.664 0.324
#> SRR330861 3 0.2096 0.9158 0.052 0.004 0.944
#> SRR330862 3 0.1877 0.8928 0.012 0.032 0.956
#> SRR330863 3 0.3983 0.8344 0.144 0.004 0.852
#> SRR330864 3 0.1129 0.9158 0.020 0.004 0.976
#> SRR330865 3 0.3129 0.9004 0.088 0.008 0.904
#> SRR330866 1 0.1878 0.9131 0.952 0.004 0.044
#> SRR330867 3 0.5156 0.7273 0.216 0.008 0.776
#> SRR330868 3 0.0829 0.9116 0.012 0.004 0.984
#> SRR330869 1 0.1453 0.9209 0.968 0.008 0.024
#> SRR330870 3 0.3129 0.8995 0.088 0.008 0.904
#> SRR330871 3 0.1289 0.9179 0.032 0.000 0.968
#> SRR330872 3 0.2152 0.8937 0.016 0.036 0.948
#> SRR330873 3 0.4589 0.7960 0.172 0.008 0.820
#> SRR330874 1 0.8408 0.3096 0.556 0.100 0.344
#> SRR330875 3 0.2229 0.8811 0.012 0.044 0.944
#> SRR330876 3 0.1129 0.9153 0.020 0.004 0.976
#> SRR330877 3 0.0829 0.9116 0.012 0.004 0.984
#> SRR330878 3 0.0747 0.9141 0.016 0.000 0.984
#> SRR330879 1 0.5928 0.5838 0.696 0.008 0.296
#> SRR330880 3 0.2625 0.9049 0.084 0.000 0.916
#> SRR330881 1 0.3682 0.8503 0.876 0.008 0.116
#> SRR330882 2 0.1289 0.8650 0.000 0.968 0.032
#> SRR330883 2 0.2066 0.9064 0.060 0.940 0.000
#> SRR330884 1 0.1031 0.9145 0.976 0.024 0.000
#> SRR330885 1 0.5070 0.7079 0.772 0.224 0.004
#> SRR330886 1 0.1877 0.9179 0.956 0.012 0.032
#> SRR330887 1 0.1878 0.9131 0.952 0.004 0.044
#> SRR330888 1 0.2063 0.9112 0.948 0.008 0.044
#> SRR330889 1 0.3375 0.8691 0.892 0.008 0.100
#> SRR330890 1 0.1129 0.9175 0.976 0.020 0.004
#> SRR330891 1 0.2711 0.8773 0.912 0.088 0.000
#> SRR330892 2 0.2165 0.9073 0.064 0.936 0.000
#> SRR330893 1 0.1267 0.9163 0.972 0.024 0.004
#> SRR330894 1 0.0892 0.9161 0.980 0.020 0.000
#> SRR330895 1 0.6299 0.0861 0.524 0.476 0.000
#> SRR330896 1 0.1453 0.9209 0.968 0.008 0.024
#> SRR330897 2 0.2796 0.8947 0.092 0.908 0.000
#> SRR330898 2 0.2537 0.9035 0.080 0.920 0.000
#> SRR330899 1 0.1031 0.9145 0.976 0.024 0.000
#> SRR330900 1 0.0983 0.9204 0.980 0.004 0.016
#> SRR330901 1 0.1878 0.9131 0.952 0.004 0.044
#> SRR330902 1 0.1585 0.9176 0.964 0.008 0.028
#> SRR330903 1 0.1453 0.9175 0.968 0.024 0.008
#> SRR330904 1 0.2400 0.8929 0.932 0.064 0.004
#> SRR330906 1 0.0892 0.9165 0.980 0.020 0.000
#> SRR330907 1 0.2384 0.9036 0.936 0.008 0.056
#> SRR330908 1 0.0747 0.9173 0.984 0.016 0.000
#> SRR330909 1 0.2116 0.9016 0.948 0.040 0.012
#> SRR330910 1 0.1877 0.9053 0.956 0.032 0.012
#> SRR330911 1 0.1765 0.9145 0.956 0.004 0.040
#> SRR330912 1 0.2400 0.8927 0.932 0.064 0.004
#> SRR330913 1 0.1525 0.9095 0.964 0.032 0.004
#> SRR330914 1 0.1950 0.9042 0.952 0.040 0.008
#> SRR330915 1 0.2063 0.9112 0.948 0.008 0.044
#> SRR330916 1 0.0829 0.9203 0.984 0.004 0.012
#> SRR330917 1 0.1525 0.9095 0.964 0.032 0.004
#> SRR330918 2 0.3856 0.8906 0.072 0.888 0.040
#> SRR330919 1 0.0747 0.9205 0.984 0.000 0.016
#> SRR330920 1 0.1950 0.9133 0.952 0.008 0.040
#> SRR330921 1 0.1267 0.9190 0.972 0.004 0.024
#> SRR330922 1 0.0892 0.9202 0.980 0.000 0.020
#> SRR330923 1 0.2173 0.9089 0.944 0.008 0.048
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> SRR330857 3 0.1356 0.816 0.000 0.008 0.960 0.032
#> SRR330858 3 0.3680 0.825 0.120 0.012 0.852 0.016
#> SRR330859 3 0.3208 0.815 0.148 0.004 0.848 0.000
#> SRR330860 2 0.5594 0.310 0.000 0.716 0.192 0.092
#> SRR330861 3 0.2053 0.846 0.072 0.004 0.924 0.000
#> SRR330862 3 0.1229 0.822 0.004 0.020 0.968 0.008
#> SRR330863 3 0.3863 0.789 0.176 0.004 0.812 0.008
#> SRR330864 3 0.1305 0.849 0.036 0.000 0.960 0.004
#> SRR330865 3 0.3774 0.796 0.168 0.008 0.820 0.004
#> SRR330866 1 0.1871 0.891 0.948 0.012 0.024 0.016
#> SRR330867 3 0.5230 0.495 0.368 0.008 0.620 0.004
#> SRR330868 3 0.0524 0.840 0.008 0.000 0.988 0.004
#> SRR330869 1 0.1362 0.897 0.964 0.012 0.004 0.020
#> SRR330870 3 0.3855 0.798 0.164 0.012 0.820 0.004
#> SRR330871 3 0.1356 0.848 0.032 0.008 0.960 0.000
#> SRR330872 3 0.1377 0.829 0.008 0.020 0.964 0.008
#> SRR330873 3 0.4508 0.693 0.244 0.008 0.744 0.004
#> SRR330874 1 0.7271 0.150 0.512 0.084 0.380 0.024
#> SRR330875 3 0.2542 0.778 0.000 0.012 0.904 0.084
#> SRR330876 3 0.0779 0.844 0.016 0.000 0.980 0.004
#> SRR330877 3 0.0712 0.833 0.004 0.004 0.984 0.008
#> SRR330878 3 0.0188 0.838 0.004 0.000 0.996 0.000
#> SRR330879 1 0.4546 0.627 0.732 0.012 0.256 0.000
#> SRR330880 3 0.3128 0.827 0.128 0.004 0.864 0.004
#> SRR330881 1 0.2874 0.864 0.904 0.012 0.064 0.020
#> SRR330882 2 0.5055 0.116 0.000 0.624 0.008 0.368
#> SRR330883 2 0.3266 0.643 0.040 0.876 0.000 0.084
#> SRR330884 1 0.1820 0.894 0.944 0.036 0.000 0.020
#> SRR330885 1 0.5111 0.733 0.740 0.204 0.000 0.056
#> SRR330886 1 0.4337 0.846 0.836 0.076 0.016 0.072
#> SRR330887 1 0.1471 0.891 0.960 0.012 0.024 0.004
#> SRR330888 1 0.1617 0.889 0.956 0.012 0.024 0.008
#> SRR330889 1 0.3949 0.789 0.832 0.016 0.140 0.012
#> SRR330890 1 0.2174 0.890 0.928 0.052 0.000 0.020
#> SRR330891 1 0.2730 0.876 0.896 0.088 0.000 0.016
#> SRR330892 2 0.1820 0.660 0.036 0.944 0.000 0.020
#> SRR330893 1 0.1584 0.894 0.952 0.036 0.000 0.012
#> SRR330894 1 0.1724 0.896 0.948 0.032 0.000 0.020
#> SRR330895 2 0.5337 0.339 0.260 0.696 0.000 0.044
#> SRR330896 1 0.1297 0.896 0.964 0.016 0.000 0.020
#> SRR330897 2 0.3009 0.655 0.052 0.892 0.000 0.056
#> SRR330898 2 0.2844 0.658 0.048 0.900 0.000 0.052
#> SRR330899 1 0.2623 0.880 0.908 0.064 0.000 0.028
#> SRR330900 1 0.1697 0.896 0.952 0.028 0.004 0.016
#> SRR330901 1 0.1486 0.892 0.960 0.008 0.024 0.008
#> SRR330902 1 0.1624 0.897 0.952 0.028 0.000 0.020
#> SRR330903 1 0.0804 0.897 0.980 0.012 0.000 0.008
#> SRR330904 1 0.3984 0.832 0.828 0.132 0.000 0.040
#> SRR330906 1 0.2271 0.881 0.916 0.076 0.000 0.008
#> SRR330907 1 0.1853 0.889 0.948 0.012 0.028 0.012
#> SRR330908 1 0.1677 0.896 0.948 0.012 0.000 0.040
#> SRR330909 1 0.6621 0.462 0.588 0.092 0.004 0.316
#> SRR330910 1 0.3873 0.844 0.844 0.060 0.000 0.096
#> SRR330911 1 0.2107 0.889 0.940 0.016 0.024 0.020
#> SRR330912 1 0.3999 0.823 0.824 0.140 0.000 0.036
#> SRR330913 1 0.3485 0.845 0.856 0.116 0.000 0.028
#> SRR330914 1 0.3606 0.837 0.844 0.132 0.000 0.024
#> SRR330915 1 0.1377 0.892 0.964 0.008 0.020 0.008
#> SRR330916 1 0.1543 0.897 0.956 0.008 0.004 0.032
#> SRR330917 1 0.4197 0.803 0.808 0.156 0.000 0.036
#> SRR330918 4 0.2918 0.000 0.000 0.116 0.008 0.876
#> SRR330919 1 0.0937 0.897 0.976 0.000 0.012 0.012
#> SRR330920 1 0.1509 0.894 0.960 0.008 0.020 0.012
#> SRR330921 1 0.0804 0.896 0.980 0.000 0.012 0.008
#> SRR330922 1 0.0992 0.896 0.976 0.004 0.008 0.012
#> SRR330923 1 0.1749 0.889 0.952 0.012 0.024 0.012
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> SRR330857 1 0.2238 0.7398 0.912 0.004 NA 0.000 0.020
#> SRR330858 1 0.3051 0.8165 0.852 0.000 NA 0.120 0.000
#> SRR330859 1 0.4299 0.7556 0.744 0.000 NA 0.220 0.008
#> SRR330860 2 0.6478 0.3089 0.076 0.516 NA 0.000 0.044
#> SRR330861 1 0.2074 0.8243 0.896 0.000 NA 0.104 0.000
#> SRR330862 1 0.1267 0.7987 0.960 0.000 NA 0.012 0.004
#> SRR330863 1 0.3696 0.7689 0.772 0.000 NA 0.212 0.000
#> SRR330864 1 0.1857 0.8236 0.928 0.000 NA 0.060 0.004
#> SRR330865 1 0.3976 0.7685 0.760 0.000 NA 0.216 0.004
#> SRR330866 4 0.2806 0.8066 0.004 0.000 NA 0.844 0.000
#> SRR330867 1 0.4592 0.6022 0.644 0.000 NA 0.332 0.000
#> SRR330868 1 0.0771 0.8067 0.976 0.000 NA 0.020 0.000
#> SRR330869 4 0.1830 0.8236 0.000 0.040 NA 0.932 0.000
#> SRR330870 1 0.4096 0.7537 0.744 0.000 NA 0.232 0.004
#> SRR330871 1 0.2241 0.8254 0.908 0.000 NA 0.076 0.008
#> SRR330872 1 0.1597 0.8108 0.948 0.000 NA 0.024 0.008
#> SRR330873 1 0.4351 0.7320 0.724 0.000 NA 0.244 0.004
#> SRR330874 4 0.7857 0.0424 0.300 0.052 NA 0.396 0.008
#> SRR330875 1 0.3838 0.6673 0.820 0.008 NA 0.000 0.064
#> SRR330876 1 0.1074 0.7996 0.968 0.000 NA 0.012 0.004
#> SRR330877 1 0.0290 0.7978 0.992 0.000 NA 0.008 0.000
#> SRR330878 1 0.0404 0.8013 0.988 0.000 NA 0.012 0.000
#> SRR330879 4 0.4708 0.4885 0.292 0.000 NA 0.668 0.000
#> SRR330880 1 0.3550 0.7916 0.796 0.000 NA 0.184 0.000
#> SRR330881 4 0.2869 0.8109 0.036 0.004 NA 0.888 0.008
#> SRR330882 2 0.7058 -0.0894 0.008 0.344 NA 0.000 0.324
#> SRR330883 2 0.4938 0.4987 0.000 0.636 NA 0.004 0.036
#> SRR330884 4 0.2522 0.8276 0.000 0.012 NA 0.880 0.000
#> SRR330885 4 0.5739 0.6432 0.004 0.080 NA 0.612 0.008
#> SRR330886 4 0.5551 0.5408 0.004 0.036 NA 0.540 0.012
#> SRR330887 4 0.0771 0.8273 0.004 0.000 NA 0.976 0.000
#> SRR330888 4 0.0833 0.8275 0.004 0.000 NA 0.976 0.004
#> SRR330889 4 0.4686 0.7363 0.104 0.000 NA 0.736 0.000
#> SRR330890 4 0.2351 0.8060 0.000 0.088 NA 0.896 0.000
#> SRR330891 4 0.3857 0.7959 0.000 0.108 NA 0.808 0.000
#> SRR330892 2 0.1970 0.6079 0.000 0.924 NA 0.012 0.004
#> SRR330893 4 0.1914 0.8307 0.000 0.016 NA 0.924 0.000
#> SRR330894 4 0.2624 0.8212 0.000 0.012 NA 0.872 0.000
#> SRR330895 2 0.3573 0.4863 0.000 0.812 NA 0.152 0.000
#> SRR330896 4 0.1648 0.8261 0.000 0.040 NA 0.940 0.000
#> SRR330897 2 0.2005 0.5979 0.000 0.924 NA 0.056 0.004
#> SRR330898 2 0.3620 0.6043 0.000 0.828 NA 0.032 0.012
#> SRR330899 4 0.3174 0.7800 0.000 0.132 NA 0.844 0.004
#> SRR330900 4 0.3396 0.7680 0.000 0.136 NA 0.832 0.004
#> SRR330901 4 0.1357 0.8308 0.004 0.000 NA 0.948 0.000
#> SRR330902 4 0.2642 0.8063 0.000 0.084 NA 0.888 0.004
#> SRR330903 4 0.0912 0.8284 0.000 0.016 NA 0.972 0.000
#> SRR330904 4 0.4830 0.7106 0.000 0.060 NA 0.684 0.000
#> SRR330906 4 0.2659 0.8174 0.000 0.060 NA 0.888 0.000
#> SRR330907 4 0.2193 0.8273 0.008 0.000 NA 0.900 0.000
#> SRR330908 4 0.2929 0.7969 0.000 0.000 NA 0.820 0.000
#> SRR330909 4 0.7612 0.1796 0.004 0.072 NA 0.392 0.144
#> SRR330910 4 0.5300 0.6524 0.000 0.032 NA 0.632 0.024
#> SRR330911 4 0.2806 0.8076 0.004 0.000 NA 0.844 0.000
#> SRR330912 4 0.4933 0.7168 0.000 0.076 NA 0.688 0.000
#> SRR330913 4 0.4335 0.6232 0.000 0.268 NA 0.708 0.004
#> SRR330914 4 0.4522 0.7328 0.000 0.176 NA 0.744 0.000
#> SRR330915 4 0.1282 0.8306 0.004 0.000 NA 0.952 0.000
#> SRR330916 4 0.2966 0.7932 0.000 0.000 NA 0.816 0.000
#> SRR330917 4 0.5016 0.4711 0.000 0.344 NA 0.616 0.004
#> SRR330918 5 0.1571 0.0000 0.000 0.060 NA 0.000 0.936
#> SRR330919 4 0.1282 0.8318 0.000 0.004 NA 0.952 0.000
#> SRR330920 4 0.0960 0.8276 0.000 0.008 NA 0.972 0.004
#> SRR330921 4 0.0955 0.8306 0.004 0.000 NA 0.968 0.000
#> SRR330922 4 0.0854 0.8277 0.000 0.012 NA 0.976 0.004
#> SRR330923 4 0.1490 0.8278 0.004 0.008 NA 0.952 0.004
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> SRR330857 1 0.3860 0.5982 0.796 0.004 0.008 0.000 0.104 0.088
#> SRR330858 1 0.4145 0.7603 0.772 0.000 0.000 0.144 0.032 0.052
#> SRR330859 1 0.4138 0.6586 0.692 0.000 0.000 0.276 0.020 0.012
#> SRR330860 6 0.7016 0.3812 0.064 0.240 0.020 0.000 0.184 0.492
#> SRR330861 1 0.2146 0.7825 0.880 0.000 0.000 0.116 0.000 0.004
#> SRR330862 1 0.0692 0.7418 0.976 0.000 0.000 0.000 0.004 0.020
#> SRR330863 1 0.3883 0.7253 0.744 0.000 0.000 0.220 0.024 0.012
#> SRR330864 1 0.2465 0.7776 0.892 0.004 0.000 0.072 0.008 0.024
#> SRR330865 1 0.3692 0.7204 0.736 0.000 0.000 0.244 0.008 0.012
#> SRR330866 4 0.3172 0.6412 0.000 0.016 0.000 0.820 0.152 0.012
#> SRR330867 1 0.4323 0.5051 0.612 0.000 0.000 0.364 0.012 0.012
#> SRR330868 1 0.1167 0.7527 0.960 0.000 0.000 0.012 0.008 0.020
#> SRR330869 4 0.2454 0.6888 0.000 0.104 0.000 0.876 0.016 0.004
#> SRR330870 1 0.3764 0.7066 0.724 0.000 0.000 0.256 0.012 0.008
#> SRR330871 1 0.2747 0.7803 0.868 0.000 0.000 0.096 0.016 0.020
#> SRR330872 1 0.1508 0.7536 0.948 0.004 0.000 0.016 0.012 0.020
#> SRR330873 1 0.3831 0.6901 0.712 0.000 0.000 0.268 0.008 0.012
#> SRR330874 4 0.7764 -0.1885 0.336 0.032 0.004 0.352 0.192 0.084
#> SRR330875 1 0.5515 0.4486 0.680 0.008 0.064 0.000 0.152 0.096
#> SRR330876 1 0.1409 0.7413 0.948 0.000 0.000 0.008 0.012 0.032
#> SRR330877 1 0.0291 0.7473 0.992 0.000 0.000 0.004 0.000 0.004
#> SRR330878 1 0.0291 0.7482 0.992 0.000 0.000 0.004 0.004 0.000
#> SRR330879 4 0.4484 0.2795 0.320 0.000 0.000 0.640 0.028 0.012
#> SRR330880 1 0.3977 0.7370 0.748 0.004 0.000 0.212 0.016 0.020
#> SRR330881 4 0.4507 0.5675 0.056 0.008 0.004 0.780 0.076 0.076
#> SRR330882 6 0.5743 0.2626 0.000 0.188 0.192 0.000 0.024 0.596
#> SRR330883 2 0.6725 -0.3516 0.000 0.420 0.020 0.012 0.268 0.280
#> SRR330884 4 0.3516 0.6386 0.000 0.028 0.000 0.812 0.136 0.024
#> SRR330885 4 0.5997 -0.0224 0.004 0.068 0.000 0.548 0.316 0.064
#> SRR330886 5 0.5513 0.3931 0.000 0.048 0.004 0.408 0.508 0.032
#> SRR330887 4 0.0862 0.7055 0.004 0.000 0.000 0.972 0.016 0.008
#> SRR330888 4 0.1078 0.7022 0.000 0.008 0.000 0.964 0.012 0.016
#> SRR330889 4 0.5172 0.4299 0.164 0.004 0.000 0.684 0.124 0.024
#> SRR330890 4 0.3073 0.6522 0.000 0.152 0.000 0.824 0.016 0.008
#> SRR330891 4 0.3875 0.6390 0.000 0.144 0.000 0.780 0.068 0.008
#> SRR330892 2 0.2586 0.3332 0.000 0.880 0.000 0.008 0.032 0.080
#> SRR330893 4 0.2294 0.6992 0.000 0.036 0.000 0.892 0.072 0.000
#> SRR330894 4 0.3462 0.6745 0.000 0.068 0.000 0.824 0.096 0.012
#> SRR330895 2 0.2113 0.4642 0.000 0.896 0.000 0.092 0.004 0.008
#> SRR330896 4 0.2342 0.7034 0.000 0.088 0.000 0.888 0.020 0.004
#> SRR330897 2 0.2486 0.4511 0.000 0.900 0.008 0.048 0.028 0.016
#> SRR330898 2 0.3650 0.3791 0.000 0.808 0.004 0.020 0.136 0.032
#> SRR330899 4 0.3855 0.5512 0.000 0.216 0.000 0.748 0.024 0.012
#> SRR330900 4 0.4075 0.5408 0.004 0.228 0.000 0.732 0.024 0.012
#> SRR330901 4 0.1801 0.6990 0.000 0.016 0.000 0.924 0.056 0.004
#> SRR330902 4 0.3075 0.6627 0.004 0.120 0.000 0.844 0.020 0.012
#> SRR330903 4 0.1434 0.7067 0.000 0.048 0.000 0.940 0.012 0.000
#> SRR330904 4 0.4365 0.3858 0.000 0.028 0.000 0.668 0.292 0.012
#> SRR330906 4 0.3590 0.6499 0.000 0.044 0.000 0.828 0.076 0.052
#> SRR330907 4 0.3275 0.6379 0.008 0.000 0.000 0.828 0.120 0.044
#> SRR330908 4 0.3323 0.5846 0.000 0.008 0.000 0.780 0.204 0.008
#> SRR330909 5 0.7610 0.3841 0.004 0.084 0.112 0.228 0.492 0.080
#> SRR330910 4 0.4814 -0.1580 0.000 0.020 0.012 0.556 0.404 0.008
#> SRR330911 4 0.2810 0.6389 0.000 0.004 0.000 0.832 0.156 0.008
#> SRR330912 4 0.5038 0.2495 0.000 0.084 0.000 0.596 0.316 0.004
#> SRR330913 4 0.4637 0.2886 0.000 0.344 0.000 0.612 0.032 0.012
#> SRR330914 4 0.4518 0.5295 0.000 0.220 0.000 0.696 0.080 0.004
#> SRR330915 4 0.1498 0.6951 0.000 0.000 0.000 0.940 0.032 0.028
#> SRR330916 4 0.3081 0.5769 0.000 0.000 0.000 0.776 0.220 0.004
#> SRR330917 2 0.4908 -0.1161 0.000 0.480 0.000 0.472 0.036 0.012
#> SRR330918 3 0.0713 0.0000 0.000 0.028 0.972 0.000 0.000 0.000
#> SRR330919 4 0.1713 0.7058 0.000 0.028 0.000 0.928 0.044 0.000
#> SRR330920 4 0.1921 0.6953 0.004 0.032 0.000 0.928 0.024 0.012
#> SRR330921 4 0.0993 0.7021 0.000 0.000 0.000 0.964 0.024 0.012
#> SRR330922 4 0.2224 0.6906 0.000 0.064 0.000 0.904 0.020 0.012
#> SRR330923 4 0.2315 0.6902 0.004 0.016 0.000 0.908 0.032 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)
consensus_heatmap(res, k = 3)
consensus_heatmap(res, k = 4)
consensus_heatmap(res, k = 5)
consensus_heatmap(res, k = 6)
Heatmaps for the membership of samples in all partitions to see how consistent they are:
membership_heatmap(res, k = 2)
membership_heatmap(res, k = 3)
membership_heatmap(res, k = 4)
membership_heatmap(res, k = 5)
membership_heatmap(res, k = 6)
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)
get_signatures(res, k = 3)
get_signatures(res, k = 4)
get_signatures(res, k = 5)
get_signatures(res, k = 6)
Signature heatmaps where rows are not scaled:
get_signatures(res, k = 2, scale_rows = FALSE)
get_signatures(res, k = 3, scale_rows = FALSE)
get_signatures(res, k = 4, scale_rows = FALSE)
get_signatures(res, k = 5, scale_rows = FALSE)
get_signatures(res, k = 6, scale_rows = FALSE)
Compare the overlap of signatures from different k:
compare_signatures(res)
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:
which_row
: row indices corresponding to the input matrix.fdr
: FDR for the differential test. mean_x
: The mean value in group x.scaled_mean_x
: The mean value in group x after rows are scaled.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")
dimension_reduction(res, k = 3, method = "UMAP")
dimension_reduction(res, k = 4, method = "UMAP")
dimension_reduction(res, k = 5, method = "UMAP")
dimension_reduction(res, k = 6, method = "UMAP")
Following heatmap shows how subgroups are split when increasing k
:
collect_classes(res)
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.
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 10869 rows and 66 columns.
#> Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'ATC' method.
#> Subgroups are detected by 'hclust' method.
#> Performed in total 1250 partitions by row resampling.
#> Best k for subgroups seems to be 2.
#>
#> Following methods can be applied to this 'ConsensusPartition' object:
#> [1] "cola_report" "collect_classes" "collect_plots"
#> [4] "collect_stats" "colnames" "compare_signatures"
#> [7] "consensus_heatmap" "dimension_reduction" "functional_enrichment"
#> [10] "get_anno_col" "get_anno" "get_classes"
#> [13] "get_consensus" "get_matrix" "get_membership"
#> [16] "get_param" "get_signatures" "get_stats"
#> [19] "is_best_k" "is_stable_k" "membership_heatmap"
#> [22] "ncol" "nrow" "plot_ecdf"
#> [25] "rownames" "select_partition_number" "show"
#> [28] "suggest_best_k" "test_to_known_factors"
collect_plots()
function collects all the plots made from res
for all k
(number of partitions)
into one single page to provide an easy and fast comparison between different k
.
collect_plots(res)
The plots are:
k
and the heatmap of
predicted classes for each k
.k
.k
.k
.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:
k
;k
, the area increased is defined as \(A_k - A_{k-1}\).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)
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.993 0.997 0.2350 0.761 0.761
#> 3 3 1.000 0.953 0.988 0.0200 0.996 0.995
#> 4 4 0.690 0.866 0.927 0.3052 0.993 0.990
#> 5 5 0.672 0.747 0.895 0.1773 0.974 0.965
#> 6 6 0.647 0.562 0.891 0.0195 0.974 0.965
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.
cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#> class entropy silhouette p1 p2
#> SRR330857 1 0.000 1.000 1.000 0.000
#> SRR330858 1 0.000 1.000 1.000 0.000
#> SRR330859 1 0.000 1.000 1.000 0.000
#> SRR330860 2 0.000 0.973 0.000 1.000
#> SRR330861 1 0.000 1.000 1.000 0.000
#> SRR330862 1 0.000 1.000 1.000 0.000
#> SRR330863 1 0.000 1.000 1.000 0.000
#> SRR330864 1 0.000 1.000 1.000 0.000
#> SRR330865 1 0.000 1.000 1.000 0.000
#> SRR330866 1 0.000 1.000 1.000 0.000
#> SRR330867 1 0.000 1.000 1.000 0.000
#> SRR330868 1 0.000 1.000 1.000 0.000
#> SRR330869 1 0.000 1.000 1.000 0.000
#> SRR330870 1 0.000 1.000 1.000 0.000
#> SRR330871 1 0.000 1.000 1.000 0.000
#> SRR330872 1 0.000 1.000 1.000 0.000
#> SRR330873 1 0.000 1.000 1.000 0.000
#> SRR330874 2 0.000 0.973 0.000 1.000
#> SRR330875 1 0.000 1.000 1.000 0.000
#> SRR330876 1 0.000 1.000 1.000 0.000
#> SRR330877 1 0.000 1.000 1.000 0.000
#> SRR330878 1 0.000 1.000 1.000 0.000
#> SRR330879 1 0.000 1.000 1.000 0.000
#> SRR330880 1 0.000 1.000 1.000 0.000
#> SRR330881 1 0.000 1.000 1.000 0.000
#> SRR330882 1 0.000 1.000 1.000 0.000
#> SRR330883 2 0.000 0.973 0.000 1.000
#> SRR330884 1 0.000 1.000 1.000 0.000
#> SRR330885 1 0.000 1.000 1.000 0.000
#> SRR330886 1 0.000 1.000 1.000 0.000
#> SRR330887 1 0.000 1.000 1.000 0.000
#> SRR330888 1 0.000 1.000 1.000 0.000
#> SRR330889 1 0.000 1.000 1.000 0.000
#> SRR330890 1 0.000 1.000 1.000 0.000
#> SRR330891 1 0.000 1.000 1.000 0.000
#> SRR330892 2 0.000 0.973 0.000 1.000
#> SRR330893 1 0.000 1.000 1.000 0.000
#> SRR330894 1 0.000 1.000 1.000 0.000
#> SRR330895 2 0.000 0.973 0.000 1.000
#> SRR330896 1 0.000 1.000 1.000 0.000
#> SRR330897 2 0.000 0.973 0.000 1.000
#> SRR330898 2 0.000 0.973 0.000 1.000
#> SRR330899 1 0.000 1.000 1.000 0.000
#> SRR330900 1 0.000 1.000 1.000 0.000
#> SRR330901 1 0.000 1.000 1.000 0.000
#> SRR330902 1 0.000 1.000 1.000 0.000
#> SRR330903 1 0.000 1.000 1.000 0.000
#> SRR330904 2 0.000 0.973 0.000 1.000
#> SRR330906 2 0.753 0.724 0.216 0.784
#> SRR330907 1 0.000 1.000 1.000 0.000
#> SRR330908 1 0.000 1.000 1.000 0.000
#> SRR330909 1 0.000 1.000 1.000 0.000
#> SRR330910 1 0.000 1.000 1.000 0.000
#> SRR330911 1 0.000 1.000 1.000 0.000
#> SRR330912 1 0.000 1.000 1.000 0.000
#> SRR330913 1 0.000 1.000 1.000 0.000
#> SRR330914 1 0.000 1.000 1.000 0.000
#> SRR330915 1 0.000 1.000 1.000 0.000
#> SRR330916 1 0.000 1.000 1.000 0.000
#> SRR330917 1 0.000 1.000 1.000 0.000
#> SRR330918 1 0.000 1.000 1.000 0.000
#> SRR330919 1 0.000 1.000 1.000 0.000
#> SRR330920 1 0.000 1.000 1.000 0.000
#> SRR330921 1 0.000 1.000 1.000 0.000
#> SRR330922 1 0.000 1.000 1.000 0.000
#> SRR330923 1 0.000 1.000 1.000 0.000
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> SRR330857 1 0.000 1.000 1.000 0.000 0.000
#> SRR330858 1 0.000 1.000 1.000 0.000 0.000
#> SRR330859 1 0.000 1.000 1.000 0.000 0.000
#> SRR330860 3 0.000 0.000 0.000 0.000 1.000
#> SRR330861 1 0.000 1.000 1.000 0.000 0.000
#> SRR330862 1 0.000 1.000 1.000 0.000 0.000
#> SRR330863 1 0.000 1.000 1.000 0.000 0.000
#> SRR330864 1 0.000 1.000 1.000 0.000 0.000
#> SRR330865 1 0.000 1.000 1.000 0.000 0.000
#> SRR330866 1 0.000 1.000 1.000 0.000 0.000
#> SRR330867 1 0.000 1.000 1.000 0.000 0.000
#> SRR330868 1 0.000 1.000 1.000 0.000 0.000
#> SRR330869 1 0.000 1.000 1.000 0.000 0.000
#> SRR330870 1 0.000 1.000 1.000 0.000 0.000
#> SRR330871 1 0.000 1.000 1.000 0.000 0.000
#> SRR330872 1 0.000 1.000 1.000 0.000 0.000
#> SRR330873 1 0.000 1.000 1.000 0.000 0.000
#> SRR330874 2 0.000 0.833 0.000 1.000 0.000
#> SRR330875 1 0.000 1.000 1.000 0.000 0.000
#> SRR330876 1 0.000 1.000 1.000 0.000 0.000
#> SRR330877 1 0.000 1.000 1.000 0.000 0.000
#> SRR330878 1 0.000 1.000 1.000 0.000 0.000
#> SRR330879 1 0.000 1.000 1.000 0.000 0.000
#> SRR330880 1 0.000 1.000 1.000 0.000 0.000
#> SRR330881 1 0.000 1.000 1.000 0.000 0.000
#> SRR330882 1 0.000 1.000 1.000 0.000 0.000
#> SRR330883 2 0.000 0.833 0.000 1.000 0.000
#> SRR330884 1 0.000 1.000 1.000 0.000 0.000
#> SRR330885 1 0.000 1.000 1.000 0.000 0.000
#> SRR330886 1 0.000 1.000 1.000 0.000 0.000
#> SRR330887 1 0.000 1.000 1.000 0.000 0.000
#> SRR330888 1 0.000 1.000 1.000 0.000 0.000
#> SRR330889 1 0.000 1.000 1.000 0.000 0.000
#> SRR330890 1 0.000 1.000 1.000 0.000 0.000
#> SRR330891 1 0.000 1.000 1.000 0.000 0.000
#> SRR330892 2 0.000 0.833 0.000 1.000 0.000
#> SRR330893 1 0.000 1.000 1.000 0.000 0.000
#> SRR330894 1 0.000 1.000 1.000 0.000 0.000
#> SRR330895 2 0.445 0.720 0.000 0.808 0.192
#> SRR330896 1 0.000 1.000 1.000 0.000 0.000
#> SRR330897 2 0.000 0.833 0.000 1.000 0.000
#> SRR330898 2 0.000 0.833 0.000 1.000 0.000
#> SRR330899 1 0.000 1.000 1.000 0.000 0.000
#> SRR330900 1 0.000 1.000 1.000 0.000 0.000
#> SRR330901 1 0.000 1.000 1.000 0.000 0.000
#> SRR330902 1 0.000 1.000 1.000 0.000 0.000
#> SRR330903 1 0.000 1.000 1.000 0.000 0.000
#> SRR330904 2 0.445 0.720 0.000 0.808 0.192
#> SRR330906 2 0.872 0.262 0.216 0.592 0.192
#> SRR330907 1 0.000 1.000 1.000 0.000 0.000
#> SRR330908 1 0.000 1.000 1.000 0.000 0.000
#> SRR330909 1 0.000 1.000 1.000 0.000 0.000
#> SRR330910 1 0.000 1.000 1.000 0.000 0.000
#> SRR330911 1 0.000 1.000 1.000 0.000 0.000
#> SRR330912 1 0.000 1.000 1.000 0.000 0.000
#> SRR330913 1 0.000 1.000 1.000 0.000 0.000
#> SRR330914 1 0.000 1.000 1.000 0.000 0.000
#> SRR330915 1 0.000 1.000 1.000 0.000 0.000
#> SRR330916 1 0.000 1.000 1.000 0.000 0.000
#> SRR330917 1 0.000 1.000 1.000 0.000 0.000
#> SRR330918 1 0.000 1.000 1.000 0.000 0.000
#> SRR330919 1 0.000 1.000 1.000 0.000 0.000
#> SRR330920 1 0.000 1.000 1.000 0.000 0.000
#> SRR330921 1 0.000 1.000 1.000 0.000 0.000
#> SRR330922 1 0.000 1.000 1.000 0.000 0.000
#> SRR330923 1 0.000 1.000 1.000 0.000 0.000
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> SRR330857 1 0.3801 0.808 0.780 0.000 0.000 0.220
#> SRR330858 1 0.3801 0.808 0.780 0.000 0.000 0.220
#> SRR330859 1 0.0188 0.936 0.996 0.000 0.000 0.004
#> SRR330860 3 0.0592 0.000 0.000 0.000 0.984 0.016
#> SRR330861 1 0.2081 0.900 0.916 0.000 0.000 0.084
#> SRR330862 1 0.0469 0.935 0.988 0.000 0.000 0.012
#> SRR330863 1 0.0000 0.936 1.000 0.000 0.000 0.000
#> SRR330864 1 0.0000 0.936 1.000 0.000 0.000 0.000
#> SRR330865 1 0.2704 0.877 0.876 0.000 0.000 0.124
#> SRR330866 1 0.0469 0.935 0.988 0.000 0.000 0.012
#> SRR330867 1 0.2704 0.877 0.876 0.000 0.000 0.124
#> SRR330868 1 0.0000 0.936 1.000 0.000 0.000 0.000
#> SRR330869 1 0.0336 0.936 0.992 0.000 0.000 0.008
#> SRR330870 1 0.3801 0.808 0.780 0.000 0.000 0.220
#> SRR330871 1 0.0921 0.928 0.972 0.000 0.000 0.028
#> SRR330872 1 0.0000 0.936 1.000 0.000 0.000 0.000
#> SRR330873 1 0.3801 0.808 0.780 0.000 0.000 0.220
#> SRR330874 2 0.0000 0.967 0.000 1.000 0.000 0.000
#> SRR330875 1 0.3801 0.808 0.780 0.000 0.000 0.220
#> SRR330876 1 0.3801 0.808 0.780 0.000 0.000 0.220
#> SRR330877 1 0.2081 0.900 0.916 0.000 0.000 0.084
#> SRR330878 1 0.3801 0.808 0.780 0.000 0.000 0.220
#> SRR330879 1 0.0188 0.936 0.996 0.000 0.000 0.004
#> SRR330880 1 0.0000 0.936 1.000 0.000 0.000 0.000
#> SRR330881 1 0.3801 0.808 0.780 0.000 0.000 0.220
#> SRR330882 1 0.1256 0.926 0.964 0.000 0.008 0.028
#> SRR330883 2 0.1867 0.895 0.000 0.928 0.000 0.072
#> SRR330884 1 0.0336 0.936 0.992 0.000 0.000 0.008
#> SRR330885 1 0.0469 0.935 0.988 0.000 0.000 0.012
#> SRR330886 1 0.0000 0.936 1.000 0.000 0.000 0.000
#> SRR330887 1 0.0188 0.936 0.996 0.000 0.000 0.004
#> SRR330888 1 0.0188 0.936 0.996 0.000 0.000 0.004
#> SRR330889 1 0.0469 0.935 0.988 0.000 0.000 0.012
#> SRR330890 1 0.0469 0.935 0.988 0.000 0.000 0.012
#> SRR330891 1 0.0469 0.935 0.988 0.000 0.000 0.012
#> SRR330892 2 0.0000 0.967 0.000 1.000 0.000 0.000
#> SRR330893 1 0.0469 0.935 0.988 0.000 0.000 0.012
#> SRR330894 1 0.0469 0.935 0.988 0.000 0.000 0.012
#> SRR330895 4 0.4635 0.638 0.000 0.216 0.028 0.756
#> SRR330896 1 0.0336 0.936 0.992 0.000 0.000 0.008
#> SRR330897 4 0.4994 0.270 0.000 0.480 0.000 0.520
#> SRR330898 2 0.0000 0.967 0.000 1.000 0.000 0.000
#> SRR330899 1 0.0188 0.936 0.996 0.000 0.000 0.004
#> SRR330900 1 0.0188 0.936 0.996 0.000 0.000 0.004
#> SRR330901 1 0.0188 0.936 0.996 0.000 0.000 0.004
#> SRR330902 1 0.0000 0.936 1.000 0.000 0.000 0.000
#> SRR330903 1 0.0336 0.936 0.992 0.000 0.000 0.008
#> SRR330904 4 0.4635 0.638 0.000 0.216 0.028 0.756
#> SRR330906 4 0.4524 0.299 0.204 0.000 0.028 0.768
#> SRR330907 1 0.3801 0.808 0.780 0.000 0.000 0.220
#> SRR330908 1 0.0469 0.935 0.988 0.000 0.000 0.012
#> SRR330909 1 0.3801 0.808 0.780 0.000 0.000 0.220
#> SRR330910 1 0.0469 0.935 0.988 0.000 0.000 0.012
#> SRR330911 1 0.0469 0.935 0.988 0.000 0.000 0.012
#> SRR330912 1 0.0469 0.935 0.988 0.000 0.000 0.012
#> SRR330913 1 0.0336 0.936 0.992 0.000 0.000 0.008
#> SRR330914 1 0.0469 0.935 0.988 0.000 0.000 0.012
#> SRR330915 1 0.0188 0.936 0.996 0.000 0.000 0.004
#> SRR330916 1 0.0469 0.935 0.988 0.000 0.000 0.012
#> SRR330917 1 0.0336 0.936 0.992 0.000 0.000 0.008
#> SRR330918 1 0.4228 0.788 0.760 0.000 0.008 0.232
#> SRR330919 1 0.0336 0.936 0.992 0.000 0.000 0.008
#> SRR330920 1 0.2081 0.901 0.916 0.000 0.000 0.084
#> SRR330921 1 0.0188 0.936 0.996 0.000 0.000 0.004
#> SRR330922 1 0.0188 0.936 0.996 0.000 0.000 0.004
#> SRR330923 1 0.3801 0.808 0.780 0.000 0.000 0.220
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> SRR330857 1 0.3966 0.551 0.664 0.000 0.336 0.000 0.000
#> SRR330858 1 0.3966 0.551 0.664 0.000 0.336 0.000 0.000
#> SRR330859 1 0.0162 0.864 0.996 0.000 0.004 0.000 0.000
#> SRR330860 3 0.5392 0.000 0.000 0.192 0.664 0.000 0.144
#> SRR330861 1 0.1792 0.813 0.916 0.000 0.084 0.000 0.000
#> SRR330862 1 0.0703 0.858 0.976 0.000 0.000 0.024 0.000
#> SRR330863 1 0.0000 0.865 1.000 0.000 0.000 0.000 0.000
#> SRR330864 1 0.0000 0.865 1.000 0.000 0.000 0.000 0.000
#> SRR330865 1 0.3305 0.681 0.776 0.000 0.224 0.000 0.000
#> SRR330866 1 0.0703 0.858 0.976 0.000 0.000 0.024 0.000
#> SRR330867 1 0.3305 0.681 0.776 0.000 0.224 0.000 0.000
#> SRR330868 1 0.0000 0.865 1.000 0.000 0.000 0.000 0.000
#> SRR330869 1 0.0290 0.864 0.992 0.000 0.000 0.008 0.000
#> SRR330870 1 0.3966 0.551 0.664 0.000 0.336 0.000 0.000
#> SRR330871 1 0.0794 0.853 0.972 0.000 0.028 0.000 0.000
#> SRR330872 1 0.0000 0.865 1.000 0.000 0.000 0.000 0.000
#> SRR330873 1 0.3966 0.551 0.664 0.000 0.336 0.000 0.000
#> SRR330874 2 0.3039 0.967 0.000 0.808 0.000 0.192 0.000
#> SRR330875 1 0.3966 0.551 0.664 0.000 0.336 0.000 0.000
#> SRR330876 1 0.3966 0.551 0.664 0.000 0.336 0.000 0.000
#> SRR330877 1 0.1792 0.813 0.916 0.000 0.084 0.000 0.000
#> SRR330878 1 0.3966 0.551 0.664 0.000 0.336 0.000 0.000
#> SRR330879 1 0.0162 0.864 0.996 0.000 0.004 0.000 0.000
#> SRR330880 1 0.0000 0.865 1.000 0.000 0.000 0.000 0.000
#> SRR330881 1 0.3966 0.551 0.664 0.000 0.336 0.000 0.000
#> SRR330882 5 0.3684 0.000 0.280 0.000 0.000 0.000 0.720
#> SRR330883 2 0.3586 0.895 0.000 0.736 0.000 0.264 0.000
#> SRR330884 1 0.0290 0.864 0.992 0.000 0.000 0.008 0.000
#> SRR330885 1 0.0703 0.858 0.976 0.000 0.000 0.024 0.000
#> SRR330886 1 0.0000 0.865 1.000 0.000 0.000 0.000 0.000
#> SRR330887 1 0.0162 0.864 0.996 0.000 0.004 0.000 0.000
#> SRR330888 1 0.0162 0.864 0.996 0.000 0.004 0.000 0.000
#> SRR330889 1 0.0703 0.858 0.976 0.000 0.000 0.024 0.000
#> SRR330890 1 0.0703 0.858 0.976 0.000 0.000 0.024 0.000
#> SRR330891 1 0.0703 0.858 0.976 0.000 0.000 0.024 0.000
#> SRR330892 2 0.3039 0.967 0.000 0.808 0.000 0.192 0.000
#> SRR330893 1 0.0703 0.858 0.976 0.000 0.000 0.024 0.000
#> SRR330894 1 0.0703 0.858 0.976 0.000 0.000 0.024 0.000
#> SRR330895 4 0.0703 0.648 0.000 0.024 0.000 0.976 0.000
#> SRR330896 1 0.0290 0.864 0.992 0.000 0.000 0.008 0.000
#> SRR330897 4 0.3730 0.282 0.000 0.288 0.000 0.712 0.000
#> SRR330898 2 0.3039 0.967 0.000 0.808 0.000 0.192 0.000
#> SRR330899 1 0.0162 0.864 0.996 0.000 0.004 0.000 0.000
#> SRR330900 1 0.0162 0.864 0.996 0.000 0.004 0.000 0.000
#> SRR330901 1 0.0162 0.864 0.996 0.000 0.004 0.000 0.000
#> SRR330902 1 0.0000 0.865 1.000 0.000 0.000 0.000 0.000
#> SRR330903 1 0.0290 0.864 0.992 0.000 0.000 0.008 0.000
#> SRR330904 4 0.0703 0.648 0.000 0.024 0.000 0.976 0.000
#> SRR330906 4 0.3039 0.247 0.192 0.000 0.000 0.808 0.000
#> SRR330907 1 0.3966 0.551 0.664 0.000 0.336 0.000 0.000
#> SRR330908 1 0.0703 0.858 0.976 0.000 0.000 0.024 0.000
#> SRR330909 1 0.3966 0.551 0.664 0.000 0.336 0.000 0.000
#> SRR330910 1 0.0703 0.858 0.976 0.000 0.000 0.024 0.000
#> SRR330911 1 0.0703 0.858 0.976 0.000 0.000 0.024 0.000
#> SRR330912 1 0.0703 0.858 0.976 0.000 0.000 0.024 0.000
#> SRR330913 1 0.0290 0.864 0.992 0.000 0.000 0.008 0.000
#> SRR330914 1 0.0404 0.862 0.988 0.000 0.000 0.012 0.000
#> SRR330915 1 0.0162 0.864 0.996 0.000 0.004 0.000 0.000
#> SRR330916 1 0.0703 0.858 0.976 0.000 0.000 0.024 0.000
#> SRR330917 1 0.0290 0.864 0.992 0.000 0.000 0.008 0.000
#> SRR330918 1 0.6058 0.246 0.528 0.000 0.336 0.000 0.136
#> SRR330919 1 0.0290 0.864 0.992 0.000 0.000 0.008 0.000
#> SRR330920 1 0.1792 0.813 0.916 0.000 0.084 0.000 0.000
#> SRR330921 1 0.0162 0.864 0.996 0.000 0.004 0.000 0.000
#> SRR330922 1 0.0162 0.864 0.996 0.000 0.004 0.000 0.000
#> SRR330923 1 0.3966 0.551 0.664 0.000 0.336 0.000 0.000
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> SRR330857 4 0.3563 -0.201 0.336 0.000 0.000 0.664 0.000 0
#> SRR330858 4 0.3563 -0.201 0.336 0.000 0.000 0.664 0.000 0
#> SRR330859 4 0.0146 0.811 0.004 0.000 0.000 0.996 0.000 0
#> SRR330860 6 0.0000 0.000 0.000 0.000 0.000 0.000 0.000 1
#> SRR330861 4 0.1610 0.705 0.084 0.000 0.000 0.916 0.000 0
#> SRR330862 4 0.0632 0.803 0.000 0.000 0.000 0.976 0.024 0
#> SRR330863 4 0.0000 0.812 0.000 0.000 0.000 1.000 0.000 0
#> SRR330864 4 0.0000 0.812 0.000 0.000 0.000 1.000 0.000 0
#> SRR330865 4 0.2969 0.333 0.224 0.000 0.000 0.776 0.000 0
#> SRR330866 4 0.0632 0.803 0.000 0.000 0.000 0.976 0.024 0
#> SRR330867 4 0.2969 0.333 0.224 0.000 0.000 0.776 0.000 0
#> SRR330868 4 0.0000 0.812 0.000 0.000 0.000 1.000 0.000 0
#> SRR330869 4 0.0260 0.812 0.000 0.000 0.000 0.992 0.008 0
#> SRR330870 4 0.3563 -0.201 0.336 0.000 0.000 0.664 0.000 0
#> SRR330871 4 0.0713 0.788 0.028 0.000 0.000 0.972 0.000 0
#> SRR330872 4 0.0000 0.812 0.000 0.000 0.000 1.000 0.000 0
#> SRR330873 4 0.3563 -0.201 0.336 0.000 0.000 0.664 0.000 0
#> SRR330874 2 0.0000 0.890 0.000 1.000 0.000 0.000 0.000 0
#> SRR330875 4 0.3563 -0.201 0.336 0.000 0.000 0.664 0.000 0
#> SRR330876 4 0.3563 -0.201 0.336 0.000 0.000 0.664 0.000 0
#> SRR330877 4 0.1610 0.705 0.084 0.000 0.000 0.916 0.000 0
#> SRR330878 4 0.3563 -0.201 0.336 0.000 0.000 0.664 0.000 0
#> SRR330879 4 0.0146 0.811 0.004 0.000 0.000 0.996 0.000 0
#> SRR330880 4 0.0000 0.812 0.000 0.000 0.000 1.000 0.000 0
#> SRR330881 4 0.3563 -0.201 0.336 0.000 0.000 0.664 0.000 0
#> SRR330882 3 0.1910 0.000 0.000 0.000 0.892 0.108 0.000 0
#> SRR330883 2 0.3898 0.615 0.336 0.652 0.012 0.000 0.000 0
#> SRR330884 4 0.0260 0.812 0.000 0.000 0.000 0.992 0.008 0
#> SRR330885 4 0.0632 0.803 0.000 0.000 0.000 0.976 0.024 0
#> SRR330886 4 0.0000 0.812 0.000 0.000 0.000 1.000 0.000 0
#> SRR330887 4 0.0146 0.811 0.004 0.000 0.000 0.996 0.000 0
#> SRR330888 4 0.0146 0.811 0.004 0.000 0.000 0.996 0.000 0
#> SRR330889 4 0.0632 0.803 0.000 0.000 0.000 0.976 0.024 0
#> SRR330890 4 0.0632 0.803 0.000 0.000 0.000 0.976 0.024 0
#> SRR330891 4 0.0632 0.803 0.000 0.000 0.000 0.976 0.024 0
#> SRR330892 2 0.0000 0.890 0.000 1.000 0.000 0.000 0.000 0
#> SRR330893 4 0.0632 0.803 0.000 0.000 0.000 0.976 0.024 0
#> SRR330894 4 0.0632 0.803 0.000 0.000 0.000 0.976 0.024 0
#> SRR330895 5 0.0790 0.605 0.000 0.032 0.000 0.000 0.968 0
#> SRR330896 4 0.0260 0.812 0.000 0.000 0.000 0.992 0.008 0
#> SRR330897 5 0.6568 0.274 0.124 0.264 0.096 0.000 0.516 0
#> SRR330898 2 0.0000 0.890 0.000 1.000 0.000 0.000 0.000 0
#> SRR330899 4 0.0146 0.811 0.004 0.000 0.000 0.996 0.000 0
#> SRR330900 4 0.0146 0.811 0.004 0.000 0.000 0.996 0.000 0
#> SRR330901 4 0.0146 0.811 0.004 0.000 0.000 0.996 0.000 0
#> SRR330902 4 0.0000 0.812 0.000 0.000 0.000 1.000 0.000 0
#> SRR330903 4 0.0260 0.812 0.000 0.000 0.000 0.992 0.008 0
#> SRR330904 5 0.0790 0.605 0.000 0.032 0.000 0.000 0.968 0
#> SRR330906 5 0.2730 0.244 0.000 0.000 0.000 0.192 0.808 0
#> SRR330907 4 0.3563 -0.201 0.336 0.000 0.000 0.664 0.000 0
#> SRR330908 4 0.0632 0.803 0.000 0.000 0.000 0.976 0.024 0
#> SRR330909 4 0.3563 -0.201 0.336 0.000 0.000 0.664 0.000 0
#> SRR330910 4 0.0632 0.803 0.000 0.000 0.000 0.976 0.024 0
#> SRR330911 4 0.0632 0.803 0.000 0.000 0.000 0.976 0.024 0
#> SRR330912 4 0.0632 0.803 0.000 0.000 0.000 0.976 0.024 0
#> SRR330913 4 0.0260 0.812 0.000 0.000 0.000 0.992 0.008 0
#> SRR330914 4 0.0363 0.810 0.000 0.000 0.000 0.988 0.012 0
#> SRR330915 4 0.0146 0.811 0.004 0.000 0.000 0.996 0.000 0
#> SRR330916 4 0.0632 0.803 0.000 0.000 0.000 0.976 0.024 0
#> SRR330917 4 0.0260 0.812 0.000 0.000 0.000 0.992 0.008 0
#> SRR330918 1 0.4083 0.000 0.532 0.000 0.000 0.460 0.008 0
#> SRR330919 4 0.0260 0.812 0.000 0.000 0.000 0.992 0.008 0
#> SRR330920 4 0.1610 0.705 0.084 0.000 0.000 0.916 0.000 0
#> SRR330921 4 0.0146 0.811 0.004 0.000 0.000 0.996 0.000 0
#> SRR330922 4 0.0146 0.811 0.004 0.000 0.000 0.996 0.000 0
#> SRR330923 4 0.3563 -0.201 0.336 0.000 0.000 0.664 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)
consensus_heatmap(res, k = 3)
consensus_heatmap(res, k = 4)
consensus_heatmap(res, k = 5)
consensus_heatmap(res, k = 6)
Heatmaps for the membership of samples in all partitions to see how consistent they are:
membership_heatmap(res, k = 2)
membership_heatmap(res, k = 3)
membership_heatmap(res, k = 4)
membership_heatmap(res, k = 5)
membership_heatmap(res, k = 6)
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)
get_signatures(res, k = 3)
get_signatures(res, k = 4)
get_signatures(res, k = 5)
get_signatures(res, k = 6)
Signature heatmaps where rows are not scaled:
get_signatures(res, k = 2, scale_rows = FALSE)
get_signatures(res, k = 3, scale_rows = FALSE)
get_signatures(res, k = 4, scale_rows = FALSE)
#> Error in mat[ceiling(1:nr/h_ratio), ceiling(1:nc/w_ratio), drop = FALSE]: subscript out of bounds
get_signatures(res, k = 5, scale_rows = FALSE)
#> Error in mat[ceiling(1:nr/h_ratio), ceiling(1:nc/w_ratio), drop = FALSE]: subscript out of bounds
get_signatures(res, k = 6, scale_rows = FALSE)
#> Error in mat[ceiling(1:nr/h_ratio), ceiling(1:nc/w_ratio), drop = FALSE]: subscript out of bounds
Compare the overlap of signatures from different k:
compare_signatures(res)
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:
which_row
: row indices corresponding to the input matrix.fdr
: FDR for the differential test. mean_x
: The mean value in group x.scaled_mean_x
: The mean value in group x after rows are scaled.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")
dimension_reduction(res, k = 3, method = "UMAP")
dimension_reduction(res, k = 4, method = "UMAP")
dimension_reduction(res, k = 5, method = "UMAP")
dimension_reduction(res, k = 6, method = "UMAP")
Following heatmap shows how subgroups are split when increasing k
:
collect_classes(res)
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.
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 10869 rows and 66 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)
The plots are:
k
and the heatmap of
predicted classes for each k
.k
.k
.k
.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:
k
;k
, the area increased is defined as \(A_k - A_{k-1}\).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)
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.2171 0.784 0.784
#> 3 3 0.613 0.961 0.904 1.4677 0.610 0.502
#> 4 4 0.733 0.717 0.851 0.2256 0.973 0.931
#> 5 5 0.653 0.687 0.735 0.0767 0.846 0.611
#> 6 6 0.662 0.645 0.799 0.0652 0.963 0.863
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.
cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#> class entropy silhouette p1 p2
#> SRR330857 1 0 1 1 0
#> SRR330858 1 0 1 1 0
#> SRR330859 1 0 1 1 0
#> SRR330860 2 0 1 0 1
#> SRR330861 1 0 1 1 0
#> SRR330862 1 0 1 1 0
#> SRR330863 1 0 1 1 0
#> SRR330864 1 0 1 1 0
#> SRR330865 1 0 1 1 0
#> SRR330866 1 0 1 1 0
#> SRR330867 1 0 1 1 0
#> SRR330868 1 0 1 1 0
#> SRR330869 1 0 1 1 0
#> SRR330870 1 0 1 1 0
#> SRR330871 1 0 1 1 0
#> SRR330872 1 0 1 1 0
#> SRR330873 1 0 1 1 0
#> SRR330874 2 0 1 0 1
#> SRR330875 1 0 1 1 0
#> SRR330876 1 0 1 1 0
#> SRR330877 1 0 1 1 0
#> SRR330878 1 0 1 1 0
#> SRR330879 1 0 1 1 0
#> SRR330880 1 0 1 1 0
#> SRR330881 1 0 1 1 0
#> SRR330882 1 0 1 1 0
#> SRR330883 2 0 1 0 1
#> SRR330884 1 0 1 1 0
#> SRR330885 1 0 1 1 0
#> SRR330886 1 0 1 1 0
#> SRR330887 1 0 1 1 0
#> SRR330888 1 0 1 1 0
#> SRR330889 1 0 1 1 0
#> SRR330890 1 0 1 1 0
#> SRR330891 1 0 1 1 0
#> SRR330892 2 0 1 0 1
#> SRR330893 1 0 1 1 0
#> SRR330894 1 0 1 1 0
#> SRR330895 2 0 1 0 1
#> SRR330896 1 0 1 1 0
#> SRR330897 2 0 1 0 1
#> SRR330898 2 0 1 0 1
#> SRR330899 1 0 1 1 0
#> SRR330900 1 0 1 1 0
#> SRR330901 1 0 1 1 0
#> SRR330902 1 0 1 1 0
#> SRR330903 1 0 1 1 0
#> SRR330904 2 0 1 0 1
#> SRR330906 1 0 1 1 0
#> SRR330907 1 0 1 1 0
#> SRR330908 1 0 1 1 0
#> SRR330909 1 0 1 1 0
#> SRR330910 1 0 1 1 0
#> SRR330911 1 0 1 1 0
#> SRR330912 1 0 1 1 0
#> SRR330913 1 0 1 1 0
#> SRR330914 1 0 1 1 0
#> SRR330915 1 0 1 1 0
#> SRR330916 1 0 1 1 0
#> SRR330917 1 0 1 1 0
#> SRR330918 1 0 1 1 0
#> SRR330919 1 0 1 1 0
#> SRR330920 1 0 1 1 0
#> SRR330921 1 0 1 1 0
#> SRR330922 1 0 1 1 0
#> SRR330923 1 0 1 1 0
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> SRR330857 3 0.0000 0.972 0.000 0.000 1.000
#> SRR330858 3 0.0000 0.972 0.000 0.000 1.000
#> SRR330859 3 0.0424 0.966 0.008 0.000 0.992
#> SRR330860 2 0.3267 0.960 0.116 0.884 0.000
#> SRR330861 3 0.0000 0.972 0.000 0.000 1.000
#> SRR330862 1 0.4555 0.998 0.800 0.000 0.200
#> SRR330863 1 0.4555 0.998 0.800 0.000 0.200
#> SRR330864 1 0.4555 0.998 0.800 0.000 0.200
#> SRR330865 3 0.0000 0.972 0.000 0.000 1.000
#> SRR330866 1 0.4555 0.998 0.800 0.000 0.200
#> SRR330867 3 0.0000 0.972 0.000 0.000 1.000
#> SRR330868 1 0.4555 0.998 0.800 0.000 0.200
#> SRR330869 1 0.4555 0.998 0.800 0.000 0.200
#> SRR330870 3 0.0000 0.972 0.000 0.000 1.000
#> SRR330871 3 0.0000 0.972 0.000 0.000 1.000
#> SRR330872 1 0.4555 0.998 0.800 0.000 0.200
#> SRR330873 3 0.0000 0.972 0.000 0.000 1.000
#> SRR330874 2 0.0000 0.984 0.000 1.000 0.000
#> SRR330875 3 0.0000 0.972 0.000 0.000 1.000
#> SRR330876 3 0.0000 0.972 0.000 0.000 1.000
#> SRR330877 3 0.0000 0.972 0.000 0.000 1.000
#> SRR330878 3 0.0000 0.972 0.000 0.000 1.000
#> SRR330879 3 0.0424 0.966 0.008 0.000 0.992
#> SRR330880 1 0.4555 0.998 0.800 0.000 0.200
#> SRR330881 3 0.0000 0.972 0.000 0.000 1.000
#> SRR330882 3 0.3686 0.851 0.140 0.000 0.860
#> SRR330883 2 0.0000 0.984 0.000 1.000 0.000
#> SRR330884 1 0.4555 0.998 0.800 0.000 0.200
#> SRR330885 1 0.4555 0.998 0.800 0.000 0.200
#> SRR330886 1 0.4555 0.998 0.800 0.000 0.200
#> SRR330887 3 0.0000 0.972 0.000 0.000 1.000
#> SRR330888 3 0.0000 0.972 0.000 0.000 1.000
#> SRR330889 1 0.4555 0.998 0.800 0.000 0.200
#> SRR330890 1 0.4555 0.998 0.800 0.000 0.200
#> SRR330891 1 0.4555 0.998 0.800 0.000 0.200
#> SRR330892 2 0.0000 0.984 0.000 1.000 0.000
#> SRR330893 1 0.4555 0.998 0.800 0.000 0.200
#> SRR330894 1 0.4555 0.998 0.800 0.000 0.200
#> SRR330895 2 0.1860 0.980 0.052 0.948 0.000
#> SRR330896 1 0.4555 0.998 0.800 0.000 0.200
#> SRR330897 2 0.1289 0.983 0.032 0.968 0.000
#> SRR330898 2 0.0000 0.984 0.000 1.000 0.000
#> SRR330899 3 0.0000 0.972 0.000 0.000 1.000
#> SRR330900 3 0.0424 0.966 0.008 0.000 0.992
#> SRR330901 3 0.0424 0.966 0.008 0.000 0.992
#> SRR330902 3 0.0424 0.966 0.008 0.000 0.992
#> SRR330903 1 0.4555 0.998 0.800 0.000 0.200
#> SRR330904 2 0.1860 0.980 0.052 0.948 0.000
#> SRR330906 1 0.3941 0.940 0.844 0.000 0.156
#> SRR330907 3 0.0000 0.972 0.000 0.000 1.000
#> SRR330908 1 0.4555 0.998 0.800 0.000 0.200
#> SRR330909 3 0.0000 0.972 0.000 0.000 1.000
#> SRR330910 1 0.4555 0.998 0.800 0.000 0.200
#> SRR330911 1 0.4555 0.998 0.800 0.000 0.200
#> SRR330912 1 0.4555 0.998 0.800 0.000 0.200
#> SRR330913 1 0.4555 0.998 0.800 0.000 0.200
#> SRR330914 1 0.4555 0.998 0.800 0.000 0.200
#> SRR330915 3 0.0000 0.972 0.000 0.000 1.000
#> SRR330916 1 0.4555 0.998 0.800 0.000 0.200
#> SRR330917 1 0.4555 0.998 0.800 0.000 0.200
#> SRR330918 3 0.2625 0.874 0.084 0.000 0.916
#> SRR330919 3 0.6260 -0.204 0.448 0.000 0.552
#> SRR330920 3 0.0000 0.972 0.000 0.000 1.000
#> SRR330921 3 0.0000 0.972 0.000 0.000 1.000
#> SRR330922 3 0.0000 0.972 0.000 0.000 1.000
#> SRR330923 3 0.0000 0.972 0.000 0.000 1.000
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> SRR330857 1 0.0188 0.6803 0.996 0.000 0.000 0.004
#> SRR330858 1 0.0188 0.6803 0.996 0.000 0.000 0.004
#> SRR330859 1 0.5028 0.4445 0.596 0.000 0.400 0.004
#> SRR330860 2 0.4697 0.8374 0.000 0.696 0.296 0.008
#> SRR330861 1 0.4252 0.6295 0.744 0.000 0.252 0.004
#> SRR330862 4 0.2060 0.8822 0.016 0.000 0.052 0.932
#> SRR330863 4 0.4364 0.7309 0.016 0.000 0.220 0.764
#> SRR330864 4 0.3597 0.8260 0.016 0.000 0.148 0.836
#> SRR330865 1 0.0188 0.6803 0.996 0.000 0.000 0.004
#> SRR330866 4 0.0592 0.8941 0.016 0.000 0.000 0.984
#> SRR330867 1 0.0188 0.6803 0.996 0.000 0.000 0.004
#> SRR330868 4 0.3390 0.8393 0.016 0.000 0.132 0.852
#> SRR330869 4 0.5339 0.2748 0.016 0.000 0.384 0.600
#> SRR330870 1 0.0188 0.6803 0.996 0.000 0.000 0.004
#> SRR330871 1 0.4677 0.5929 0.680 0.000 0.316 0.004
#> SRR330872 4 0.4327 0.7378 0.016 0.000 0.216 0.768
#> SRR330873 1 0.0188 0.6803 0.996 0.000 0.000 0.004
#> SRR330874 2 0.0817 0.9399 0.000 0.976 0.024 0.000
#> SRR330875 1 0.0188 0.6803 0.996 0.000 0.000 0.004
#> SRR330876 1 0.0188 0.6803 0.996 0.000 0.000 0.004
#> SRR330877 1 0.4252 0.6295 0.744 0.000 0.252 0.004
#> SRR330878 1 0.0188 0.6803 0.996 0.000 0.000 0.004
#> SRR330879 1 0.4978 0.4819 0.612 0.000 0.384 0.004
#> SRR330880 4 0.3647 0.8207 0.016 0.000 0.152 0.832
#> SRR330881 1 0.0188 0.6803 0.996 0.000 0.000 0.004
#> SRR330882 3 0.5272 0.1717 0.288 0.000 0.680 0.032
#> SRR330883 2 0.0376 0.9416 0.004 0.992 0.000 0.004
#> SRR330884 4 0.3547 0.8237 0.016 0.000 0.144 0.840
#> SRR330885 4 0.0592 0.8941 0.016 0.000 0.000 0.984
#> SRR330886 4 0.1297 0.8893 0.016 0.000 0.020 0.964
#> SRR330887 1 0.4761 0.5804 0.664 0.000 0.332 0.004
#> SRR330888 1 0.4313 0.6255 0.736 0.000 0.260 0.004
#> SRR330889 4 0.0779 0.8939 0.016 0.000 0.004 0.980
#> SRR330890 4 0.0592 0.8941 0.016 0.000 0.000 0.984
#> SRR330891 4 0.0592 0.8941 0.016 0.000 0.000 0.984
#> SRR330892 2 0.0817 0.9399 0.000 0.976 0.024 0.000
#> SRR330893 4 0.0592 0.8941 0.016 0.000 0.000 0.984
#> SRR330894 4 0.0592 0.8941 0.016 0.000 0.000 0.984
#> SRR330895 2 0.2861 0.9338 0.000 0.888 0.096 0.016
#> SRR330896 4 0.3647 0.8154 0.016 0.000 0.152 0.832
#> SRR330897 2 0.2329 0.9382 0.000 0.916 0.072 0.012
#> SRR330898 2 0.0817 0.9399 0.000 0.976 0.024 0.000
#> SRR330899 1 0.4761 0.5804 0.664 0.000 0.332 0.004
#> SRR330900 1 0.4978 0.4819 0.612 0.000 0.384 0.004
#> SRR330901 1 0.4978 0.4819 0.612 0.000 0.384 0.004
#> SRR330902 1 0.4978 0.4819 0.612 0.000 0.384 0.004
#> SRR330903 4 0.1406 0.8902 0.016 0.000 0.024 0.960
#> SRR330904 2 0.2861 0.9338 0.000 0.888 0.096 0.016
#> SRR330906 4 0.0000 0.8790 0.000 0.000 0.000 1.000
#> SRR330907 1 0.0188 0.6803 0.996 0.000 0.000 0.004
#> SRR330908 4 0.0592 0.8941 0.016 0.000 0.000 0.984
#> SRR330909 1 0.4761 0.5804 0.664 0.000 0.332 0.004
#> SRR330910 4 0.0592 0.8941 0.016 0.000 0.000 0.984
#> SRR330911 4 0.0592 0.8941 0.016 0.000 0.000 0.984
#> SRR330912 4 0.0592 0.8941 0.016 0.000 0.000 0.984
#> SRR330913 4 0.3166 0.8464 0.016 0.000 0.116 0.868
#> SRR330914 4 0.1610 0.8879 0.016 0.000 0.032 0.952
#> SRR330915 1 0.4761 0.5804 0.664 0.000 0.332 0.004
#> SRR330916 4 0.0592 0.8941 0.016 0.000 0.000 0.984
#> SRR330917 4 0.5339 0.2748 0.016 0.000 0.384 0.600
#> SRR330918 1 0.5165 0.0366 0.512 0.000 0.484 0.004
#> SRR330919 3 0.7810 0.4102 0.252 0.000 0.384 0.364
#> SRR330920 1 0.0188 0.6803 0.996 0.000 0.000 0.004
#> SRR330921 1 0.4761 0.5804 0.664 0.000 0.332 0.004
#> SRR330922 1 0.4761 0.5804 0.664 0.000 0.332 0.004
#> SRR330923 1 0.0188 0.6803 0.996 0.000 0.000 0.004
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> SRR330857 1 0.4287 0.92528 0.540 0.000 0.000 0.000 0.460
#> SRR330858 1 0.4287 0.92528 0.540 0.000 0.000 0.000 0.460
#> SRR330859 5 0.3196 0.61597 0.000 0.000 0.192 0.004 0.804
#> SRR330860 3 0.5484 0.00000 0.068 0.392 0.540 0.000 0.000
#> SRR330861 5 0.2813 0.29915 0.168 0.000 0.000 0.000 0.832
#> SRR330862 4 0.3756 0.77516 0.000 0.000 0.248 0.744 0.008
#> SRR330863 4 0.6403 0.55782 0.000 0.000 0.256 0.512 0.232
#> SRR330864 4 0.5678 0.69474 0.000 0.000 0.260 0.612 0.128
#> SRR330865 1 0.4291 0.92262 0.536 0.000 0.000 0.000 0.464
#> SRR330866 4 0.0290 0.84302 0.000 0.000 0.000 0.992 0.008
#> SRR330867 1 0.4291 0.92262 0.536 0.000 0.000 0.000 0.464
#> SRR330868 4 0.5187 0.72738 0.000 0.000 0.260 0.656 0.084
#> SRR330869 5 0.6058 -0.00852 0.000 0.000 0.128 0.364 0.508
#> SRR330870 1 0.4287 0.92528 0.540 0.000 0.000 0.000 0.460
#> SRR330871 5 0.1270 0.59042 0.052 0.000 0.000 0.000 0.948
#> SRR330872 4 0.6400 0.56573 0.000 0.000 0.260 0.512 0.228
#> SRR330873 1 0.4287 0.92528 0.540 0.000 0.000 0.000 0.460
#> SRR330874 2 0.0290 0.70789 0.008 0.992 0.000 0.000 0.000
#> SRR330875 1 0.4291 0.92262 0.536 0.000 0.000 0.000 0.464
#> SRR330876 1 0.4287 0.92528 0.540 0.000 0.000 0.000 0.460
#> SRR330877 5 0.2929 0.25384 0.180 0.000 0.000 0.000 0.820
#> SRR330878 1 0.4287 0.92528 0.540 0.000 0.000 0.000 0.460
#> SRR330879 5 0.2124 0.67524 0.000 0.000 0.096 0.004 0.900
#> SRR330880 4 0.5618 0.70611 0.000 0.000 0.236 0.628 0.136
#> SRR330881 1 0.4287 0.92528 0.540 0.000 0.000 0.000 0.460
#> SRR330882 5 0.6865 0.08822 0.292 0.000 0.288 0.004 0.416
#> SRR330883 2 0.1996 0.70419 0.036 0.928 0.032 0.004 0.000
#> SRR330884 4 0.5243 0.71091 0.000 0.000 0.132 0.680 0.188
#> SRR330885 4 0.0451 0.84235 0.000 0.000 0.004 0.988 0.008
#> SRR330886 4 0.3203 0.79266 0.000 0.000 0.168 0.820 0.012
#> SRR330887 5 0.0000 0.66554 0.000 0.000 0.000 0.000 1.000
#> SRR330888 5 0.2377 0.41333 0.128 0.000 0.000 0.000 0.872
#> SRR330889 4 0.1697 0.83663 0.000 0.000 0.060 0.932 0.008
#> SRR330890 4 0.0290 0.84302 0.000 0.000 0.000 0.992 0.008
#> SRR330891 4 0.0290 0.84302 0.000 0.000 0.000 0.992 0.008
#> SRR330892 2 0.0290 0.70789 0.008 0.992 0.000 0.000 0.000
#> SRR330893 4 0.0451 0.84235 0.000 0.000 0.004 0.988 0.008
#> SRR330894 4 0.0290 0.84302 0.000 0.000 0.000 0.992 0.008
#> SRR330895 2 0.4863 0.53445 0.064 0.716 0.212 0.008 0.000
#> SRR330896 4 0.5354 0.70452 0.000 0.000 0.140 0.668 0.192
#> SRR330897 2 0.4625 0.58256 0.068 0.748 0.176 0.008 0.000
#> SRR330898 2 0.0290 0.70789 0.008 0.992 0.000 0.000 0.000
#> SRR330899 5 0.0000 0.66554 0.000 0.000 0.000 0.000 1.000
#> SRR330900 5 0.2068 0.67650 0.000 0.000 0.092 0.004 0.904
#> SRR330901 5 0.2011 0.67708 0.000 0.000 0.088 0.004 0.908
#> SRR330902 5 0.2124 0.67524 0.000 0.000 0.096 0.004 0.900
#> SRR330903 4 0.2193 0.82991 0.000 0.000 0.092 0.900 0.008
#> SRR330904 2 0.4863 0.53445 0.064 0.716 0.212 0.008 0.000
#> SRR330906 4 0.0609 0.83249 0.000 0.000 0.020 0.980 0.000
#> SRR330907 1 0.4287 0.92528 0.540 0.000 0.000 0.000 0.460
#> SRR330908 4 0.0451 0.84235 0.000 0.000 0.004 0.988 0.008
#> SRR330909 5 0.0162 0.66090 0.004 0.000 0.000 0.000 0.996
#> SRR330910 4 0.0451 0.84235 0.000 0.000 0.004 0.988 0.008
#> SRR330911 4 0.0290 0.84302 0.000 0.000 0.000 0.992 0.008
#> SRR330912 4 0.0451 0.84235 0.000 0.000 0.004 0.988 0.008
#> SRR330913 4 0.4959 0.73575 0.000 0.000 0.128 0.712 0.160
#> SRR330914 4 0.2964 0.81699 0.000 0.000 0.120 0.856 0.024
#> SRR330915 5 0.0000 0.66554 0.000 0.000 0.000 0.000 1.000
#> SRR330916 4 0.0451 0.84235 0.000 0.000 0.004 0.988 0.008
#> SRR330917 5 0.6066 -0.02025 0.000 0.000 0.128 0.368 0.504
#> SRR330918 1 0.6274 -0.20007 0.432 0.000 0.148 0.000 0.420
#> SRR330919 5 0.4675 0.54134 0.000 0.000 0.100 0.164 0.736
#> SRR330920 1 0.4291 0.92262 0.536 0.000 0.000 0.000 0.464
#> SRR330921 5 0.0000 0.66554 0.000 0.000 0.000 0.000 1.000
#> SRR330922 5 0.0000 0.66554 0.000 0.000 0.000 0.000 1.000
#> SRR330923 1 0.4287 0.92528 0.540 0.000 0.000 0.000 0.460
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> SRR330857 1 0.2454 0.9933 0.840 0.000 0.000 0.000 0.160 0.000
#> SRR330858 1 0.2454 0.9933 0.840 0.000 0.000 0.000 0.160 0.000
#> SRR330859 5 0.2994 0.5104 0.000 0.000 0.208 0.000 0.788 0.004
#> SRR330860 3 0.7166 -0.6013 0.100 0.268 0.408 0.000 0.000 0.224
#> SRR330861 5 0.3429 0.5966 0.252 0.000 0.004 0.000 0.740 0.004
#> SRR330862 4 0.5118 0.1566 0.000 0.000 0.404 0.512 0.084 0.000
#> SRR330863 3 0.6196 0.1589 0.000 0.000 0.392 0.328 0.276 0.004
#> SRR330864 4 0.5821 -0.1707 0.000 0.000 0.404 0.412 0.184 0.000
#> SRR330865 1 0.2668 0.9857 0.828 0.000 0.004 0.000 0.168 0.000
#> SRR330866 4 0.0000 0.7129 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR330867 1 0.2632 0.9889 0.832 0.000 0.004 0.000 0.164 0.000
#> SRR330868 4 0.5802 -0.0815 0.000 0.000 0.400 0.440 0.156 0.004
#> SRR330869 5 0.4286 0.3613 0.000 0.000 0.108 0.164 0.728 0.000
#> SRR330870 1 0.2454 0.9933 0.840 0.000 0.000 0.000 0.160 0.000
#> SRR330871 5 0.2700 0.7138 0.156 0.000 0.004 0.000 0.836 0.004
#> SRR330872 3 0.6067 0.1675 0.000 0.000 0.404 0.312 0.284 0.000
#> SRR330873 1 0.2454 0.9933 0.840 0.000 0.000 0.000 0.160 0.000
#> SRR330874 2 0.0000 0.8062 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR330875 1 0.2668 0.9861 0.828 0.000 0.004 0.000 0.168 0.000
#> SRR330876 1 0.2454 0.9933 0.840 0.000 0.000 0.000 0.160 0.000
#> SRR330877 5 0.3452 0.5908 0.256 0.000 0.004 0.000 0.736 0.004
#> SRR330878 1 0.2454 0.9933 0.840 0.000 0.000 0.000 0.160 0.000
#> SRR330879 5 0.0260 0.7420 0.000 0.000 0.008 0.000 0.992 0.000
#> SRR330880 4 0.5854 -0.1642 0.000 0.000 0.392 0.416 0.192 0.000
#> SRR330881 1 0.2454 0.9933 0.840 0.000 0.000 0.000 0.160 0.000
#> SRR330882 6 0.3217 0.7959 0.000 0.000 0.008 0.000 0.224 0.768
#> SRR330883 2 0.2151 0.8104 0.016 0.904 0.072 0.000 0.000 0.008
#> SRR330884 4 0.5327 0.1370 0.000 0.000 0.112 0.516 0.372 0.000
#> SRR330885 4 0.0260 0.7116 0.000 0.000 0.008 0.992 0.000 0.000
#> SRR330886 4 0.4362 0.2839 0.000 0.000 0.392 0.584 0.020 0.004
#> SRR330887 5 0.1663 0.7713 0.088 0.000 0.000 0.000 0.912 0.000
#> SRR330888 5 0.3023 0.6444 0.212 0.000 0.004 0.000 0.784 0.000
#> SRR330889 4 0.3037 0.6092 0.000 0.000 0.176 0.808 0.016 0.000
#> SRR330890 4 0.0000 0.7129 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR330891 4 0.0146 0.7115 0.000 0.000 0.004 0.996 0.000 0.000
#> SRR330892 2 0.0146 0.8059 0.004 0.996 0.000 0.000 0.000 0.000
#> SRR330893 4 0.0146 0.7115 0.000 0.000 0.004 0.996 0.000 0.000
#> SRR330894 4 0.0000 0.7129 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR330895 2 0.5391 0.7465 0.032 0.592 0.308 0.000 0.000 0.068
#> SRR330896 4 0.5474 0.0791 0.000 0.000 0.128 0.488 0.384 0.000
#> SRR330897 2 0.4853 0.7712 0.032 0.656 0.272 0.000 0.000 0.040
#> SRR330898 2 0.0000 0.8062 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR330899 5 0.1663 0.7713 0.088 0.000 0.000 0.000 0.912 0.000
#> SRR330900 5 0.0260 0.7420 0.000 0.000 0.008 0.000 0.992 0.000
#> SRR330901 5 0.0260 0.7420 0.000 0.000 0.008 0.000 0.992 0.000
#> SRR330902 5 0.0405 0.7414 0.000 0.000 0.008 0.000 0.988 0.004
#> SRR330903 4 0.3118 0.6258 0.000 0.000 0.092 0.836 0.072 0.000
#> SRR330904 2 0.5391 0.7465 0.032 0.592 0.308 0.000 0.000 0.068
#> SRR330906 4 0.0937 0.6872 0.000 0.000 0.040 0.960 0.000 0.000
#> SRR330907 1 0.2454 0.9933 0.840 0.000 0.000 0.000 0.160 0.000
#> SRR330908 4 0.0000 0.7129 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR330909 5 0.1765 0.7688 0.096 0.000 0.000 0.000 0.904 0.000
#> SRR330910 4 0.0146 0.7122 0.000 0.000 0.004 0.996 0.000 0.000
#> SRR330911 4 0.0000 0.7129 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR330912 4 0.0146 0.7115 0.000 0.000 0.004 0.996 0.000 0.000
#> SRR330913 4 0.5156 0.2680 0.000 0.000 0.112 0.580 0.308 0.000
#> SRR330914 4 0.3473 0.6047 0.000 0.000 0.096 0.808 0.096 0.000
#> SRR330915 5 0.1663 0.7713 0.088 0.000 0.000 0.000 0.912 0.000
#> SRR330916 4 0.0000 0.7129 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR330917 5 0.4295 0.3623 0.000 0.000 0.112 0.160 0.728 0.000
#> SRR330918 6 0.6137 0.8041 0.108 0.000 0.064 0.000 0.276 0.552
#> SRR330919 5 0.1913 0.6262 0.000 0.000 0.012 0.080 0.908 0.000
#> SRR330920 1 0.2838 0.9605 0.808 0.000 0.004 0.000 0.188 0.000
#> SRR330921 5 0.1714 0.7689 0.092 0.000 0.000 0.000 0.908 0.000
#> SRR330922 5 0.1663 0.7713 0.088 0.000 0.000 0.000 0.912 0.000
#> SRR330923 1 0.2454 0.9933 0.840 0.000 0.000 0.000 0.160 0.000
Heatmaps for the consensus matrix. It visualizes the probability of two samples to be in a same group.
consensus_heatmap(res, k = 2)
consensus_heatmap(res, k = 3)
consensus_heatmap(res, k = 4)
consensus_heatmap(res, k = 5)
consensus_heatmap(res, k = 6)
Heatmaps for the membership of samples in all partitions to see how consistent they are:
membership_heatmap(res, k = 2)
membership_heatmap(res, k = 3)
membership_heatmap(res, k = 4)
membership_heatmap(res, k = 5)
membership_heatmap(res, k = 6)
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)
get_signatures(res, k = 3)
get_signatures(res, k = 4)
get_signatures(res, k = 5)
get_signatures(res, k = 6)
Signature heatmaps where rows are not scaled:
get_signatures(res, k = 2, scale_rows = FALSE)
get_signatures(res, k = 3, scale_rows = FALSE)
get_signatures(res, k = 4, scale_rows = FALSE)
get_signatures(res, k = 5, scale_rows = FALSE)
get_signatures(res, k = 6, scale_rows = FALSE)
Compare the overlap of signatures from different k:
compare_signatures(res)
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:
which_row
: row indices corresponding to the input matrix.fdr
: FDR for the differential test. mean_x
: The mean value in group x.scaled_mean_x
: The mean value in group x after rows are scaled.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")
dimension_reduction(res, k = 3, method = "UMAP")
dimension_reduction(res, k = 4, method = "UMAP")
dimension_reduction(res, k = 5, method = "UMAP")
dimension_reduction(res, k = 6, method = "UMAP")
Following heatmap shows how subgroups are split when increasing k
:
collect_classes(res)
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.
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 10869 rows and 66 columns.
#> Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'ATC' method.
#> Subgroups are detected by 'skmeans' method.
#> Performed in total 1250 partitions by row resampling.
#> Best k for subgroups seems to be 2.
#>
#> Following methods can be applied to this 'ConsensusPartition' object:
#> [1] "cola_report" "collect_classes" "collect_plots"
#> [4] "collect_stats" "colnames" "compare_signatures"
#> [7] "consensus_heatmap" "dimension_reduction" "functional_enrichment"
#> [10] "get_anno_col" "get_anno" "get_classes"
#> [13] "get_consensus" "get_matrix" "get_membership"
#> [16] "get_param" "get_signatures" "get_stats"
#> [19] "is_best_k" "is_stable_k" "membership_heatmap"
#> [22] "ncol" "nrow" "plot_ecdf"
#> [25] "rownames" "select_partition_number" "show"
#> [28] "suggest_best_k" "test_to_known_factors"
collect_plots()
function collects all the plots made from res
for all k
(number of partitions)
into one single page to provide an easy and fast comparison between different k
.
collect_plots(res)
The plots are:
k
and the heatmap of
predicted classes for each k
.k
.k
.k
.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:
k
;k
, the area increased is defined as \(A_k - A_{k-1}\).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)
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.967 0.987 0.4919 0.509 0.509
#> 3 3 0.830 0.855 0.926 0.2239 0.884 0.776
#> 4 4 0.782 0.724 0.880 0.1013 0.918 0.805
#> 5 5 0.759 0.712 0.853 0.0580 0.925 0.795
#> 6 6 0.740 0.699 0.833 0.0356 0.975 0.918
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.
cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#> class entropy silhouette p1 p2
#> SRR330857 1 0.000 0.986 1.000 0.000
#> SRR330858 1 0.000 0.986 1.000 0.000
#> SRR330859 1 0.000 0.986 1.000 0.000
#> SRR330860 2 0.000 0.986 0.000 1.000
#> SRR330861 1 0.000 0.986 1.000 0.000
#> SRR330862 2 0.000 0.986 0.000 1.000
#> SRR330863 1 0.000 0.986 1.000 0.000
#> SRR330864 1 0.985 0.239 0.572 0.428
#> SRR330865 1 0.000 0.986 1.000 0.000
#> SRR330866 2 0.000 0.986 0.000 1.000
#> SRR330867 1 0.000 0.986 1.000 0.000
#> SRR330868 2 0.827 0.642 0.260 0.740
#> SRR330869 1 0.000 0.986 1.000 0.000
#> SRR330870 1 0.000 0.986 1.000 0.000
#> SRR330871 1 0.000 0.986 1.000 0.000
#> SRR330872 1 0.295 0.936 0.948 0.052
#> SRR330873 1 0.000 0.986 1.000 0.000
#> SRR330874 2 0.000 0.986 0.000 1.000
#> SRR330875 1 0.000 0.986 1.000 0.000
#> SRR330876 1 0.000 0.986 1.000 0.000
#> SRR330877 1 0.000 0.986 1.000 0.000
#> SRR330878 1 0.000 0.986 1.000 0.000
#> SRR330879 1 0.000 0.986 1.000 0.000
#> SRR330880 1 0.163 0.964 0.976 0.024
#> SRR330881 1 0.000 0.986 1.000 0.000
#> SRR330882 1 0.000 0.986 1.000 0.000
#> SRR330883 2 0.000 0.986 0.000 1.000
#> SRR330884 1 0.000 0.986 1.000 0.000
#> SRR330885 2 0.000 0.986 0.000 1.000
#> SRR330886 2 0.000 0.986 0.000 1.000
#> SRR330887 1 0.000 0.986 1.000 0.000
#> SRR330888 1 0.000 0.986 1.000 0.000
#> SRR330889 2 0.000 0.986 0.000 1.000
#> SRR330890 2 0.000 0.986 0.000 1.000
#> SRR330891 2 0.000 0.986 0.000 1.000
#> SRR330892 2 0.000 0.986 0.000 1.000
#> SRR330893 2 0.000 0.986 0.000 1.000
#> SRR330894 2 0.000 0.986 0.000 1.000
#> SRR330895 2 0.000 0.986 0.000 1.000
#> SRR330896 1 0.000 0.986 1.000 0.000
#> SRR330897 2 0.000 0.986 0.000 1.000
#> SRR330898 2 0.000 0.986 0.000 1.000
#> SRR330899 1 0.000 0.986 1.000 0.000
#> SRR330900 1 0.000 0.986 1.000 0.000
#> SRR330901 1 0.000 0.986 1.000 0.000
#> SRR330902 1 0.000 0.986 1.000 0.000
#> SRR330903 2 0.000 0.986 0.000 1.000
#> SRR330904 2 0.000 0.986 0.000 1.000
#> SRR330906 2 0.000 0.986 0.000 1.000
#> SRR330907 1 0.000 0.986 1.000 0.000
#> SRR330908 2 0.000 0.986 0.000 1.000
#> SRR330909 1 0.000 0.986 1.000 0.000
#> SRR330910 2 0.000 0.986 0.000 1.000
#> SRR330911 2 0.000 0.986 0.000 1.000
#> SRR330912 2 0.000 0.986 0.000 1.000
#> SRR330913 2 0.456 0.889 0.096 0.904
#> SRR330914 2 0.000 0.986 0.000 1.000
#> SRR330915 1 0.000 0.986 1.000 0.000
#> SRR330916 2 0.000 0.986 0.000 1.000
#> SRR330917 1 0.000 0.986 1.000 0.000
#> SRR330918 1 0.000 0.986 1.000 0.000
#> SRR330919 1 0.000 0.986 1.000 0.000
#> SRR330920 1 0.000 0.986 1.000 0.000
#> SRR330921 1 0.000 0.986 1.000 0.000
#> SRR330922 1 0.000 0.986 1.000 0.000
#> SRR330923 1 0.000 0.986 1.000 0.000
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> SRR330857 1 0.0000 0.9689 1.000 0.000 0.000
#> SRR330858 1 0.0000 0.9689 1.000 0.000 0.000
#> SRR330859 1 0.3879 0.7915 0.848 0.000 0.152
#> SRR330860 2 0.0237 0.8688 0.000 0.996 0.004
#> SRR330861 1 0.0000 0.9689 1.000 0.000 0.000
#> SRR330862 3 0.1031 0.7765 0.000 0.024 0.976
#> SRR330863 3 0.7768 0.4613 0.344 0.064 0.592
#> SRR330864 3 0.1950 0.7902 0.040 0.008 0.952
#> SRR330865 1 0.0000 0.9689 1.000 0.000 0.000
#> SRR330866 2 0.4346 0.8094 0.000 0.816 0.184
#> SRR330867 1 0.0000 0.9689 1.000 0.000 0.000
#> SRR330868 3 0.2318 0.7910 0.028 0.028 0.944
#> SRR330869 1 0.1289 0.9423 0.968 0.000 0.032
#> SRR330870 1 0.0000 0.9689 1.000 0.000 0.000
#> SRR330871 1 0.0000 0.9689 1.000 0.000 0.000
#> SRR330872 3 0.4353 0.7244 0.156 0.008 0.836
#> SRR330873 1 0.0000 0.9689 1.000 0.000 0.000
#> SRR330874 2 0.0237 0.8688 0.000 0.996 0.004
#> SRR330875 1 0.0000 0.9689 1.000 0.000 0.000
#> SRR330876 1 0.0000 0.9689 1.000 0.000 0.000
#> SRR330877 1 0.0000 0.9689 1.000 0.000 0.000
#> SRR330878 1 0.0000 0.9689 1.000 0.000 0.000
#> SRR330879 1 0.0000 0.9689 1.000 0.000 0.000
#> SRR330880 3 0.0237 0.7746 0.000 0.004 0.996
#> SRR330881 1 0.0000 0.9689 1.000 0.000 0.000
#> SRR330882 1 0.0424 0.9625 0.992 0.000 0.008
#> SRR330883 2 0.0237 0.8688 0.000 0.996 0.004
#> SRR330884 1 0.5551 0.6612 0.760 0.016 0.224
#> SRR330885 2 0.1753 0.8661 0.000 0.952 0.048
#> SRR330886 3 0.6154 0.3805 0.000 0.408 0.592
#> SRR330887 1 0.0000 0.9689 1.000 0.000 0.000
#> SRR330888 1 0.0000 0.9689 1.000 0.000 0.000
#> SRR330889 3 0.4235 0.6343 0.000 0.176 0.824
#> SRR330890 2 0.0237 0.8688 0.000 0.996 0.004
#> SRR330891 2 0.1529 0.8671 0.000 0.960 0.040
#> SRR330892 2 0.0237 0.8688 0.000 0.996 0.004
#> SRR330893 2 0.3267 0.8426 0.000 0.884 0.116
#> SRR330894 2 0.4702 0.7918 0.000 0.788 0.212
#> SRR330895 2 0.0237 0.8688 0.000 0.996 0.004
#> SRR330896 1 0.6518 0.0118 0.512 0.004 0.484
#> SRR330897 2 0.0237 0.8688 0.000 0.996 0.004
#> SRR330898 2 0.0237 0.8688 0.000 0.996 0.004
#> SRR330899 1 0.0000 0.9689 1.000 0.000 0.000
#> SRR330900 1 0.0000 0.9689 1.000 0.000 0.000
#> SRR330901 1 0.0000 0.9689 1.000 0.000 0.000
#> SRR330902 1 0.0000 0.9689 1.000 0.000 0.000
#> SRR330903 2 0.5785 0.6724 0.000 0.668 0.332
#> SRR330904 2 0.0237 0.8688 0.000 0.996 0.004
#> SRR330906 2 0.0237 0.8688 0.000 0.996 0.004
#> SRR330907 1 0.0000 0.9689 1.000 0.000 0.000
#> SRR330908 2 0.4842 0.7843 0.000 0.776 0.224
#> SRR330909 1 0.0000 0.9689 1.000 0.000 0.000
#> SRR330910 2 0.6140 0.5376 0.000 0.596 0.404
#> SRR330911 2 0.5291 0.7437 0.000 0.732 0.268
#> SRR330912 2 0.1643 0.8661 0.000 0.956 0.044
#> SRR330913 2 0.4121 0.7591 0.084 0.876 0.040
#> SRR330914 2 0.5785 0.6716 0.000 0.668 0.332
#> SRR330915 1 0.0000 0.9689 1.000 0.000 0.000
#> SRR330916 2 0.4887 0.7808 0.000 0.772 0.228
#> SRR330917 1 0.1753 0.9278 0.952 0.000 0.048
#> SRR330918 1 0.0000 0.9689 1.000 0.000 0.000
#> SRR330919 1 0.0000 0.9689 1.000 0.000 0.000
#> SRR330920 1 0.0000 0.9689 1.000 0.000 0.000
#> SRR330921 1 0.0000 0.9689 1.000 0.000 0.000
#> SRR330922 1 0.0000 0.9689 1.000 0.000 0.000
#> SRR330923 1 0.0000 0.9689 1.000 0.000 0.000
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> SRR330857 1 0.0000 0.955 1.000 0.000 0.000 0.000
#> SRR330858 1 0.0000 0.955 1.000 0.000 0.000 0.000
#> SRR330859 1 0.3583 0.751 0.816 0.000 0.180 0.004
#> SRR330860 2 0.0000 0.760 0.000 1.000 0.000 0.000
#> SRR330861 1 0.0000 0.955 1.000 0.000 0.000 0.000
#> SRR330862 3 0.2214 0.681 0.000 0.028 0.928 0.044
#> SRR330863 3 0.6753 0.203 0.380 0.032 0.548 0.040
#> SRR330864 3 0.0469 0.699 0.000 0.000 0.988 0.012
#> SRR330865 1 0.0000 0.955 1.000 0.000 0.000 0.000
#> SRR330866 2 0.5491 0.563 0.000 0.688 0.052 0.260
#> SRR330867 1 0.0000 0.955 1.000 0.000 0.000 0.000
#> SRR330868 3 0.0672 0.700 0.000 0.008 0.984 0.008
#> SRR330869 1 0.6264 0.276 0.560 0.000 0.064 0.376
#> SRR330870 1 0.0000 0.955 1.000 0.000 0.000 0.000
#> SRR330871 1 0.0000 0.955 1.000 0.000 0.000 0.000
#> SRR330872 3 0.1833 0.678 0.032 0.000 0.944 0.024
#> SRR330873 1 0.0000 0.955 1.000 0.000 0.000 0.000
#> SRR330874 2 0.0000 0.760 0.000 1.000 0.000 0.000
#> SRR330875 1 0.0000 0.955 1.000 0.000 0.000 0.000
#> SRR330876 1 0.0000 0.955 1.000 0.000 0.000 0.000
#> SRR330877 1 0.0000 0.955 1.000 0.000 0.000 0.000
#> SRR330878 1 0.0000 0.955 1.000 0.000 0.000 0.000
#> SRR330879 1 0.0188 0.953 0.996 0.000 0.004 0.000
#> SRR330880 3 0.1474 0.685 0.000 0.000 0.948 0.052
#> SRR330881 1 0.0000 0.955 1.000 0.000 0.000 0.000
#> SRR330882 1 0.4050 0.780 0.820 0.000 0.036 0.144
#> SRR330883 2 0.0000 0.760 0.000 1.000 0.000 0.000
#> SRR330884 4 0.4332 0.480 0.160 0.000 0.040 0.800
#> SRR330885 2 0.4782 0.637 0.000 0.780 0.068 0.152
#> SRR330886 2 0.7253 0.187 0.008 0.528 0.336 0.128
#> SRR330887 1 0.0000 0.955 1.000 0.000 0.000 0.000
#> SRR330888 1 0.0000 0.955 1.000 0.000 0.000 0.000
#> SRR330889 3 0.7834 -0.245 0.000 0.276 0.404 0.320
#> SRR330890 2 0.1488 0.751 0.000 0.956 0.012 0.032
#> SRR330891 2 0.3311 0.690 0.000 0.828 0.000 0.172
#> SRR330892 2 0.0000 0.760 0.000 1.000 0.000 0.000
#> SRR330893 2 0.5237 0.481 0.000 0.628 0.016 0.356
#> SRR330894 2 0.6000 0.431 0.000 0.592 0.052 0.356
#> SRR330895 2 0.0000 0.760 0.000 1.000 0.000 0.000
#> SRR330896 4 0.6198 0.414 0.176 0.000 0.152 0.672
#> SRR330897 2 0.0000 0.760 0.000 1.000 0.000 0.000
#> SRR330898 2 0.0000 0.760 0.000 1.000 0.000 0.000
#> SRR330899 1 0.0000 0.955 1.000 0.000 0.000 0.000
#> SRR330900 1 0.0817 0.938 0.976 0.000 0.000 0.024
#> SRR330901 1 0.0000 0.955 1.000 0.000 0.000 0.000
#> SRR330902 1 0.0000 0.955 1.000 0.000 0.000 0.000
#> SRR330903 4 0.5448 0.430 0.000 0.244 0.056 0.700
#> SRR330904 2 0.0000 0.760 0.000 1.000 0.000 0.000
#> SRR330906 2 0.0188 0.758 0.000 0.996 0.000 0.004
#> SRR330907 1 0.0000 0.955 1.000 0.000 0.000 0.000
#> SRR330908 2 0.5838 0.298 0.000 0.524 0.032 0.444
#> SRR330909 1 0.0188 0.953 0.996 0.000 0.004 0.000
#> SRR330910 4 0.6326 0.351 0.000 0.264 0.104 0.632
#> SRR330911 2 0.6452 0.173 0.000 0.472 0.068 0.460
#> SRR330912 2 0.3351 0.703 0.000 0.844 0.008 0.148
#> SRR330913 4 0.5484 0.456 0.008 0.272 0.032 0.688
#> SRR330914 4 0.3013 0.587 0.000 0.080 0.032 0.888
#> SRR330915 1 0.0000 0.955 1.000 0.000 0.000 0.000
#> SRR330916 2 0.5933 0.245 0.000 0.500 0.036 0.464
#> SRR330917 1 0.6347 0.247 0.548 0.000 0.068 0.384
#> SRR330918 1 0.1211 0.927 0.960 0.000 0.000 0.040
#> SRR330919 1 0.1557 0.911 0.944 0.000 0.000 0.056
#> SRR330920 1 0.0000 0.955 1.000 0.000 0.000 0.000
#> SRR330921 1 0.0000 0.955 1.000 0.000 0.000 0.000
#> SRR330922 1 0.0000 0.955 1.000 0.000 0.000 0.000
#> SRR330923 1 0.0000 0.955 1.000 0.000 0.000 0.000
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> SRR330857 1 0.0000 0.9350 1.000 0.000 0.000 0.000 0.000
#> SRR330858 1 0.0000 0.9350 1.000 0.000 0.000 0.000 0.000
#> SRR330859 1 0.4834 0.6173 0.748 0.000 0.160 0.020 0.072
#> SRR330860 2 0.0000 0.8384 0.000 1.000 0.000 0.000 0.000
#> SRR330861 1 0.0000 0.9350 1.000 0.000 0.000 0.000 0.000
#> SRR330862 3 0.4111 0.6821 0.000 0.036 0.816 0.100 0.048
#> SRR330863 3 0.8486 0.0560 0.264 0.040 0.436 0.100 0.160
#> SRR330864 3 0.0693 0.7492 0.000 0.000 0.980 0.012 0.008
#> SRR330865 1 0.0000 0.9350 1.000 0.000 0.000 0.000 0.000
#> SRR330866 4 0.5344 0.3432 0.000 0.472 0.024 0.488 0.016
#> SRR330867 1 0.0000 0.9350 1.000 0.000 0.000 0.000 0.000
#> SRR330868 3 0.1074 0.7480 0.000 0.004 0.968 0.012 0.016
#> SRR330869 1 0.6371 -0.2582 0.460 0.000 0.044 0.060 0.436
#> SRR330870 1 0.0000 0.9350 1.000 0.000 0.000 0.000 0.000
#> SRR330871 1 0.0162 0.9340 0.996 0.000 0.000 0.004 0.000
#> SRR330872 3 0.3610 0.6877 0.004 0.012 0.828 0.020 0.136
#> SRR330873 1 0.0000 0.9350 1.000 0.000 0.000 0.000 0.000
#> SRR330874 2 0.0000 0.8384 0.000 1.000 0.000 0.000 0.000
#> SRR330875 1 0.0162 0.9340 0.996 0.000 0.000 0.000 0.004
#> SRR330876 1 0.0000 0.9350 1.000 0.000 0.000 0.000 0.000
#> SRR330877 1 0.0000 0.9350 1.000 0.000 0.000 0.000 0.000
#> SRR330878 1 0.0000 0.9350 1.000 0.000 0.000 0.000 0.000
#> SRR330879 1 0.1205 0.9104 0.956 0.000 0.004 0.000 0.040
#> SRR330880 3 0.2962 0.7049 0.000 0.000 0.868 0.084 0.048
#> SRR330881 1 0.0000 0.9350 1.000 0.000 0.000 0.000 0.000
#> SRR330882 1 0.5905 0.4057 0.644 0.000 0.056 0.056 0.244
#> SRR330883 2 0.0000 0.8384 0.000 1.000 0.000 0.000 0.000
#> SRR330884 5 0.6341 0.4443 0.100 0.000 0.036 0.280 0.584
#> SRR330885 2 0.6500 0.3476 0.000 0.608 0.052 0.216 0.124
#> SRR330886 2 0.8428 -0.0922 0.000 0.356 0.240 0.200 0.204
#> SRR330887 1 0.0404 0.9324 0.988 0.000 0.000 0.000 0.012
#> SRR330888 1 0.0162 0.9342 0.996 0.000 0.000 0.000 0.004
#> SRR330889 4 0.6479 0.3844 0.000 0.096 0.308 0.556 0.040
#> SRR330890 2 0.2936 0.7429 0.000 0.872 0.008 0.096 0.024
#> SRR330891 2 0.4365 0.5473 0.000 0.736 0.004 0.224 0.036
#> SRR330892 2 0.0000 0.8384 0.000 1.000 0.000 0.000 0.000
#> SRR330893 4 0.4507 0.4815 0.000 0.412 0.004 0.580 0.004
#> SRR330894 4 0.5212 0.4735 0.000 0.416 0.020 0.548 0.016
#> SRR330895 2 0.0000 0.8384 0.000 1.000 0.000 0.000 0.000
#> SRR330896 5 0.7982 0.3769 0.144 0.000 0.148 0.288 0.420
#> SRR330897 2 0.0000 0.8384 0.000 1.000 0.000 0.000 0.000
#> SRR330898 2 0.0000 0.8384 0.000 1.000 0.000 0.000 0.000
#> SRR330899 1 0.0404 0.9324 0.988 0.000 0.000 0.000 0.012
#> SRR330900 1 0.1544 0.8912 0.932 0.000 0.000 0.000 0.068
#> SRR330901 1 0.0510 0.9308 0.984 0.000 0.000 0.000 0.016
#> SRR330902 1 0.0609 0.9266 0.980 0.000 0.000 0.000 0.020
#> SRR330903 4 0.4353 0.4837 0.000 0.044 0.028 0.788 0.140
#> SRR330904 2 0.0000 0.8384 0.000 1.000 0.000 0.000 0.000
#> SRR330906 2 0.0404 0.8320 0.000 0.988 0.000 0.000 0.012
#> SRR330907 1 0.0000 0.9350 1.000 0.000 0.000 0.000 0.000
#> SRR330908 4 0.4271 0.6711 0.000 0.224 0.016 0.744 0.016
#> SRR330909 1 0.2144 0.8743 0.912 0.000 0.000 0.020 0.068
#> SRR330910 4 0.4184 0.4876 0.000 0.048 0.032 0.808 0.112
#> SRR330911 4 0.4751 0.6631 0.000 0.188 0.056 0.740 0.016
#> SRR330912 2 0.3989 0.5097 0.000 0.728 0.004 0.260 0.008
#> SRR330913 5 0.5617 0.3115 0.008 0.216 0.004 0.108 0.664
#> SRR330914 4 0.5141 0.1558 0.000 0.012 0.028 0.600 0.360
#> SRR330915 1 0.0290 0.9336 0.992 0.000 0.000 0.000 0.008
#> SRR330916 4 0.3873 0.6707 0.000 0.212 0.008 0.768 0.012
#> SRR330917 5 0.5901 0.3810 0.304 0.000 0.044 0.048 0.604
#> SRR330918 1 0.3264 0.7951 0.840 0.000 0.004 0.024 0.132
#> SRR330919 1 0.3396 0.7813 0.832 0.000 0.004 0.028 0.136
#> SRR330920 1 0.0290 0.9336 0.992 0.000 0.000 0.000 0.008
#> SRR330921 1 0.0290 0.9336 0.992 0.000 0.000 0.000 0.008
#> SRR330922 1 0.0510 0.9312 0.984 0.000 0.000 0.000 0.016
#> SRR330923 1 0.0162 0.9342 0.996 0.000 0.000 0.000 0.004
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> SRR330857 1 0.0000 0.9164 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR330858 1 0.0000 0.9164 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR330859 1 0.5256 0.4110 0.648 0.000 0.120 0.004 0.012 0.216
#> SRR330860 2 0.0000 0.8510 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR330861 1 0.0000 0.9164 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR330862 3 0.4703 0.7130 0.000 0.016 0.744 0.116 0.016 0.108
#> SRR330863 6 0.6926 0.0241 0.236 0.028 0.220 0.008 0.020 0.488
#> SRR330864 3 0.1053 0.8291 0.000 0.000 0.964 0.012 0.004 0.020
#> SRR330865 1 0.0000 0.9164 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR330866 4 0.5437 0.4434 0.000 0.400 0.012 0.520 0.012 0.056
#> SRR330867 1 0.0000 0.9164 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR330868 3 0.1857 0.8233 0.000 0.000 0.924 0.028 0.004 0.044
#> SRR330869 5 0.6851 0.2130 0.376 0.000 0.040 0.040 0.436 0.108
#> SRR330870 1 0.0000 0.9164 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR330871 1 0.0363 0.9133 0.988 0.000 0.000 0.000 0.000 0.012
#> SRR330872 3 0.3618 0.7556 0.000 0.000 0.808 0.008 0.104 0.080
#> SRR330873 1 0.0000 0.9164 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR330874 2 0.0000 0.8510 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR330875 1 0.0260 0.9153 0.992 0.000 0.000 0.000 0.000 0.008
#> SRR330876 1 0.0000 0.9164 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR330877 1 0.0000 0.9164 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR330878 1 0.0000 0.9164 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR330879 1 0.2364 0.8669 0.904 0.000 0.004 0.012 0.044 0.036
#> SRR330880 3 0.3557 0.7870 0.000 0.000 0.832 0.056 0.056 0.056
#> SRR330881 1 0.0000 0.9164 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR330882 1 0.7180 -0.1593 0.472 0.000 0.052 0.032 0.224 0.220
#> SRR330883 2 0.0000 0.8510 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR330884 5 0.6728 0.3350 0.072 0.000 0.020 0.172 0.556 0.180
#> SRR330885 2 0.7488 0.1777 0.000 0.500 0.076 0.216 0.088 0.120
#> SRR330886 6 0.7439 0.1287 0.004 0.284 0.112 0.116 0.028 0.456
#> SRR330887 1 0.1053 0.9081 0.964 0.000 0.000 0.004 0.020 0.012
#> SRR330888 1 0.0520 0.9137 0.984 0.000 0.000 0.000 0.008 0.008
#> SRR330889 4 0.6528 0.4891 0.000 0.088 0.208 0.576 0.016 0.112
#> SRR330890 2 0.4702 0.6348 0.000 0.740 0.000 0.120 0.048 0.092
#> SRR330891 2 0.5824 0.3514 0.000 0.612 0.020 0.260 0.048 0.060
#> SRR330892 2 0.0000 0.8510 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR330893 4 0.4265 0.5013 0.000 0.384 0.004 0.596 0.016 0.000
#> SRR330894 4 0.5411 0.6122 0.000 0.304 0.016 0.608 0.032 0.040
#> SRR330895 2 0.0000 0.8510 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR330896 5 0.8504 0.2633 0.132 0.000 0.108 0.204 0.352 0.204
#> SRR330897 2 0.0000 0.8510 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR330898 2 0.0000 0.8510 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR330899 1 0.1857 0.8901 0.924 0.000 0.000 0.004 0.044 0.028
#> SRR330900 1 0.3138 0.8029 0.840 0.000 0.000 0.004 0.096 0.060
#> SRR330901 1 0.1257 0.9049 0.952 0.000 0.000 0.000 0.020 0.028
#> SRR330902 1 0.2237 0.8534 0.896 0.000 0.000 0.004 0.020 0.080
#> SRR330903 4 0.4579 0.5618 0.000 0.036 0.012 0.760 0.128 0.064
#> SRR330904 2 0.0000 0.8510 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR330906 2 0.1367 0.8139 0.000 0.944 0.000 0.000 0.012 0.044
#> SRR330907 1 0.0000 0.9164 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR330908 4 0.3708 0.6977 0.000 0.188 0.004 0.776 0.012 0.020
#> SRR330909 1 0.3401 0.7840 0.824 0.000 0.000 0.008 0.064 0.104
#> SRR330910 4 0.4583 0.5850 0.000 0.036 0.040 0.776 0.048 0.100
#> SRR330911 4 0.4440 0.6924 0.000 0.148 0.028 0.764 0.020 0.040
#> SRR330912 2 0.5155 0.3869 0.000 0.644 0.008 0.272 0.044 0.032
#> SRR330913 5 0.5289 0.2090 0.004 0.116 0.008 0.076 0.716 0.080
#> SRR330914 4 0.5395 0.3429 0.000 0.008 0.012 0.600 0.296 0.084
#> SRR330915 1 0.1059 0.9087 0.964 0.000 0.000 0.004 0.016 0.016
#> SRR330916 4 0.3315 0.7001 0.000 0.172 0.008 0.804 0.008 0.008
#> SRR330917 5 0.5122 0.3545 0.180 0.000 0.032 0.008 0.696 0.084
#> SRR330918 1 0.4284 0.6642 0.752 0.000 0.012 0.000 0.096 0.140
#> SRR330919 1 0.4151 0.6925 0.760 0.000 0.000 0.012 0.152 0.076
#> SRR330920 1 0.0622 0.9126 0.980 0.000 0.000 0.000 0.012 0.008
#> SRR330921 1 0.1176 0.9050 0.956 0.000 0.000 0.000 0.024 0.020
#> SRR330922 1 0.1498 0.8990 0.940 0.000 0.000 0.000 0.032 0.028
#> SRR330923 1 0.0291 0.9152 0.992 0.000 0.000 0.000 0.004 0.004
Heatmaps for the consensus matrix. It visualizes the probability of two samples to be in a same group.
consensus_heatmap(res, k = 2)
consensus_heatmap(res, k = 3)
consensus_heatmap(res, k = 4)
consensus_heatmap(res, k = 5)
consensus_heatmap(res, k = 6)
Heatmaps for the membership of samples in all partitions to see how consistent they are:
membership_heatmap(res, k = 2)
membership_heatmap(res, k = 3)
membership_heatmap(res, k = 4)
membership_heatmap(res, k = 5)
membership_heatmap(res, k = 6)
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)
get_signatures(res, k = 3)
get_signatures(res, k = 4)
get_signatures(res, k = 5)
get_signatures(res, k = 6)
Signature heatmaps where rows are not scaled:
get_signatures(res, k = 2, scale_rows = FALSE)
get_signatures(res, k = 3, scale_rows = FALSE)
get_signatures(res, k = 4, scale_rows = FALSE)
get_signatures(res, k = 5, scale_rows = FALSE)
get_signatures(res, k = 6, scale_rows = FALSE)
Compare the overlap of signatures from different k:
compare_signatures(res)
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:
which_row
: row indices corresponding to the input matrix.fdr
: FDR for the differential test. mean_x
: The mean value in group x.scaled_mean_x
: The mean value in group x after rows are scaled.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")
dimension_reduction(res, k = 3, method = "UMAP")
dimension_reduction(res, k = 4, method = "UMAP")
dimension_reduction(res, k = 5, method = "UMAP")
dimension_reduction(res, k = 6, method = "UMAP")
Following heatmap shows how subgroups are split when increasing k
:
collect_classes(res)
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.
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 10869 rows and 66 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 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)
The plots are:
k
and the heatmap of
predicted classes for each k
.k
.k
.k
.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:
k
;k
, the area increased is defined as \(A_k - A_{k-1}\).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)
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.988 0.994 0.2081 0.784 0.784
#> 3 3 0.919 0.934 0.976 1.5077 0.687 0.600
#> 4 4 0.677 0.693 0.866 0.1423 0.994 0.988
#> 5 5 0.713 0.751 0.892 0.0135 0.995 0.989
#> 6 6 0.685 0.649 0.798 0.0387 0.770 0.541
suggest_best_k()
suggests the best \(k\) based on these statistics. The rules are as follows:
suggest_best_k(res)
#> [1] 3
#> attr(,"optional")
#> [1] 2
There is also optional best \(k\) = 2 that is worth to check.
Following shows the table of the partitions (You need to click the show/hide
code output link to see it). The membership matrix (columns with name p*
)
is inferred by
clue::cl_consensus()
function with the SE
method. Basically the value in the membership matrix
represents the probability to belong to a certain group. The finall class
label for an item is determined with the group with highest probability it
belongs to.
In get_classes()
function, the entropy is calculated from the membership
matrix and the silhouette score is calculated from the consensus matrix.
cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#> class entropy silhouette p1 p2
#> SRR330857 1 0.000 1.000 1.000 0.000
#> SRR330858 1 0.000 1.000 1.000 0.000
#> SRR330859 1 0.000 1.000 1.000 0.000
#> SRR330860 2 0.506 0.867 0.112 0.888
#> SRR330861 1 0.000 1.000 1.000 0.000
#> SRR330862 1 0.000 1.000 1.000 0.000
#> SRR330863 1 0.000 1.000 1.000 0.000
#> SRR330864 1 0.000 1.000 1.000 0.000
#> SRR330865 1 0.000 1.000 1.000 0.000
#> SRR330866 1 0.000 1.000 1.000 0.000
#> SRR330867 1 0.000 1.000 1.000 0.000
#> SRR330868 1 0.000 1.000 1.000 0.000
#> SRR330869 1 0.000 1.000 1.000 0.000
#> SRR330870 1 0.000 1.000 1.000 0.000
#> SRR330871 1 0.000 1.000 1.000 0.000
#> SRR330872 1 0.000 1.000 1.000 0.000
#> SRR330873 1 0.000 1.000 1.000 0.000
#> SRR330874 2 0.000 0.946 0.000 1.000
#> SRR330875 1 0.000 1.000 1.000 0.000
#> SRR330876 1 0.000 1.000 1.000 0.000
#> SRR330877 1 0.000 1.000 1.000 0.000
#> SRR330878 1 0.000 1.000 1.000 0.000
#> SRR330879 1 0.000 1.000 1.000 0.000
#> SRR330880 1 0.000 1.000 1.000 0.000
#> SRR330881 1 0.000 1.000 1.000 0.000
#> SRR330882 1 0.000 1.000 1.000 0.000
#> SRR330883 2 0.000 0.946 0.000 1.000
#> SRR330884 1 0.000 1.000 1.000 0.000
#> SRR330885 1 0.000 1.000 1.000 0.000
#> SRR330886 1 0.000 1.000 1.000 0.000
#> SRR330887 1 0.000 1.000 1.000 0.000
#> SRR330888 1 0.000 1.000 1.000 0.000
#> SRR330889 1 0.000 1.000 1.000 0.000
#> SRR330890 1 0.000 1.000 1.000 0.000
#> SRR330891 1 0.000 1.000 1.000 0.000
#> SRR330892 2 0.000 0.946 0.000 1.000
#> SRR330893 1 0.000 1.000 1.000 0.000
#> SRR330894 1 0.000 1.000 1.000 0.000
#> SRR330895 2 0.833 0.665 0.264 0.736
#> SRR330896 1 0.000 1.000 1.000 0.000
#> SRR330897 2 0.000 0.946 0.000 1.000
#> SRR330898 2 0.000 0.946 0.000 1.000
#> SRR330899 1 0.000 1.000 1.000 0.000
#> SRR330900 1 0.000 1.000 1.000 0.000
#> SRR330901 1 0.000 1.000 1.000 0.000
#> SRR330902 1 0.000 1.000 1.000 0.000
#> SRR330903 1 0.000 1.000 1.000 0.000
#> SRR330904 2 0.000 0.946 0.000 1.000
#> SRR330906 1 0.000 1.000 1.000 0.000
#> SRR330907 1 0.000 1.000 1.000 0.000
#> SRR330908 1 0.000 1.000 1.000 0.000
#> SRR330909 1 0.000 1.000 1.000 0.000
#> SRR330910 1 0.000 1.000 1.000 0.000
#> SRR330911 1 0.000 1.000 1.000 0.000
#> SRR330912 1 0.000 1.000 1.000 0.000
#> SRR330913 1 0.000 1.000 1.000 0.000
#> SRR330914 1 0.000 1.000 1.000 0.000
#> SRR330915 1 0.000 1.000 1.000 0.000
#> SRR330916 1 0.000 1.000 1.000 0.000
#> SRR330917 1 0.000 1.000 1.000 0.000
#> SRR330918 1 0.000 1.000 1.000 0.000
#> SRR330919 1 0.000 1.000 1.000 0.000
#> SRR330920 1 0.000 1.000 1.000 0.000
#> SRR330921 1 0.000 1.000 1.000 0.000
#> SRR330922 1 0.000 1.000 1.000 0.000
#> SRR330923 1 0.000 1.000 1.000 0.000
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> SRR330857 3 0.0000 0.929 0.000 0.000 1.000
#> SRR330858 3 0.0000 0.929 0.000 0.000 1.000
#> SRR330859 1 0.0000 0.985 1.000 0.000 0.000
#> SRR330860 2 0.3192 0.819 0.112 0.888 0.000
#> SRR330861 3 0.4399 0.705 0.188 0.000 0.812
#> SRR330862 1 0.0000 0.985 1.000 0.000 0.000
#> SRR330863 1 0.0000 0.985 1.000 0.000 0.000
#> SRR330864 1 0.0000 0.985 1.000 0.000 0.000
#> SRR330865 3 0.0000 0.929 0.000 0.000 1.000
#> SRR330866 1 0.0000 0.985 1.000 0.000 0.000
#> SRR330867 3 0.0000 0.929 0.000 0.000 1.000
#> SRR330868 1 0.0000 0.985 1.000 0.000 0.000
#> SRR330869 1 0.0000 0.985 1.000 0.000 0.000
#> SRR330870 3 0.0000 0.929 0.000 0.000 1.000
#> SRR330871 3 0.5621 0.512 0.308 0.000 0.692
#> SRR330872 1 0.0000 0.985 1.000 0.000 0.000
#> SRR330873 3 0.0000 0.929 0.000 0.000 1.000
#> SRR330874 2 0.0000 0.920 0.000 1.000 0.000
#> SRR330875 3 0.0000 0.929 0.000 0.000 1.000
#> SRR330876 3 0.0000 0.929 0.000 0.000 1.000
#> SRR330877 3 0.4291 0.716 0.180 0.000 0.820
#> SRR330878 3 0.0000 0.929 0.000 0.000 1.000
#> SRR330879 1 0.0000 0.985 1.000 0.000 0.000
#> SRR330880 1 0.0000 0.985 1.000 0.000 0.000
#> SRR330881 3 0.0000 0.929 0.000 0.000 1.000
#> SRR330882 1 0.0000 0.985 1.000 0.000 0.000
#> SRR330883 2 0.0000 0.920 0.000 1.000 0.000
#> SRR330884 1 0.0000 0.985 1.000 0.000 0.000
#> SRR330885 1 0.0000 0.985 1.000 0.000 0.000
#> SRR330886 1 0.0000 0.985 1.000 0.000 0.000
#> SRR330887 1 0.0000 0.985 1.000 0.000 0.000
#> SRR330888 1 0.4452 0.745 0.808 0.000 0.192
#> SRR330889 1 0.0000 0.985 1.000 0.000 0.000
#> SRR330890 1 0.0000 0.985 1.000 0.000 0.000
#> SRR330891 1 0.0000 0.985 1.000 0.000 0.000
#> SRR330892 2 0.0000 0.920 0.000 1.000 0.000
#> SRR330893 1 0.0000 0.985 1.000 0.000 0.000
#> SRR330894 1 0.0000 0.985 1.000 0.000 0.000
#> SRR330895 2 0.5254 0.622 0.264 0.736 0.000
#> SRR330896 1 0.0000 0.985 1.000 0.000 0.000
#> SRR330897 2 0.0000 0.920 0.000 1.000 0.000
#> SRR330898 2 0.0000 0.920 0.000 1.000 0.000
#> SRR330899 1 0.0000 0.985 1.000 0.000 0.000
#> SRR330900 1 0.0000 0.985 1.000 0.000 0.000
#> SRR330901 1 0.0000 0.985 1.000 0.000 0.000
#> SRR330902 1 0.0000 0.985 1.000 0.000 0.000
#> SRR330903 1 0.0000 0.985 1.000 0.000 0.000
#> SRR330904 2 0.0000 0.920 0.000 1.000 0.000
#> SRR330906 1 0.0000 0.985 1.000 0.000 0.000
#> SRR330907 3 0.0000 0.929 0.000 0.000 1.000
#> SRR330908 1 0.0000 0.985 1.000 0.000 0.000
#> SRR330909 1 0.0000 0.985 1.000 0.000 0.000
#> SRR330910 1 0.0000 0.985 1.000 0.000 0.000
#> SRR330911 1 0.0000 0.985 1.000 0.000 0.000
#> SRR330912 1 0.0000 0.985 1.000 0.000 0.000
#> SRR330913 1 0.0000 0.985 1.000 0.000 0.000
#> SRR330914 1 0.0000 0.985 1.000 0.000 0.000
#> SRR330915 1 0.0000 0.985 1.000 0.000 0.000
#> SRR330916 1 0.0000 0.985 1.000 0.000 0.000
#> SRR330917 1 0.0000 0.985 1.000 0.000 0.000
#> SRR330918 1 0.5810 0.485 0.664 0.000 0.336
#> SRR330919 1 0.0000 0.985 1.000 0.000 0.000
#> SRR330920 3 0.0000 0.929 0.000 0.000 1.000
#> SRR330921 1 0.0237 0.981 0.996 0.000 0.004
#> SRR330922 1 0.0000 0.985 1.000 0.000 0.000
#> SRR330923 3 0.0000 0.929 0.000 0.000 1.000
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> SRR330857 3 0.0000 0.9318 0.000 0.000 1.000 0.000
#> SRR330858 3 0.0000 0.9318 0.000 0.000 1.000 0.000
#> SRR330859 1 0.0000 0.8351 1.000 0.000 0.000 0.000
#> SRR330860 4 0.4761 -0.0488 0.000 0.372 0.000 0.628
#> SRR330861 3 0.3486 0.7105 0.188 0.000 0.812 0.000
#> SRR330862 1 0.4661 0.6375 0.652 0.348 0.000 0.000
#> SRR330863 1 0.0000 0.8351 1.000 0.000 0.000 0.000
#> SRR330864 1 0.0000 0.8351 1.000 0.000 0.000 0.000
#> SRR330865 3 0.0000 0.9318 0.000 0.000 1.000 0.000
#> SRR330866 1 0.4866 0.5970 0.596 0.404 0.000 0.000
#> SRR330867 3 0.0000 0.9318 0.000 0.000 1.000 0.000
#> SRR330868 1 0.0000 0.8351 1.000 0.000 0.000 0.000
#> SRR330869 1 0.0000 0.8351 1.000 0.000 0.000 0.000
#> SRR330870 3 0.0000 0.9318 0.000 0.000 1.000 0.000
#> SRR330871 3 0.4454 0.5238 0.308 0.000 0.692 0.000
#> SRR330872 1 0.0000 0.8351 1.000 0.000 0.000 0.000
#> SRR330873 3 0.0000 0.9318 0.000 0.000 1.000 0.000
#> SRR330874 2 0.4888 0.3249 0.000 0.588 0.000 0.412
#> SRR330875 3 0.0000 0.9318 0.000 0.000 1.000 0.000
#> SRR330876 3 0.0000 0.9318 0.000 0.000 1.000 0.000
#> SRR330877 3 0.3400 0.7212 0.180 0.000 0.820 0.000
#> SRR330878 3 0.0000 0.9318 0.000 0.000 1.000 0.000
#> SRR330879 1 0.0000 0.8351 1.000 0.000 0.000 0.000
#> SRR330880 1 0.0000 0.8351 1.000 0.000 0.000 0.000
#> SRR330881 3 0.0000 0.9318 0.000 0.000 1.000 0.000
#> SRR330882 1 0.0000 0.8351 1.000 0.000 0.000 0.000
#> SRR330883 2 0.4866 0.3158 0.000 0.596 0.000 0.404
#> SRR330884 1 0.0000 0.8351 1.000 0.000 0.000 0.000
#> SRR330885 1 0.4866 0.5970 0.596 0.404 0.000 0.000
#> SRR330886 1 0.0000 0.8351 1.000 0.000 0.000 0.000
#> SRR330887 1 0.0000 0.8351 1.000 0.000 0.000 0.000
#> SRR330888 1 0.3528 0.6762 0.808 0.000 0.192 0.000
#> SRR330889 1 0.4866 0.5970 0.596 0.404 0.000 0.000
#> SRR330890 1 0.4866 0.5970 0.596 0.404 0.000 0.000
#> SRR330891 1 0.4866 0.5970 0.596 0.404 0.000 0.000
#> SRR330892 2 0.4888 0.3249 0.000 0.588 0.000 0.412
#> SRR330893 1 0.4866 0.5970 0.596 0.404 0.000 0.000
#> SRR330894 1 0.4866 0.5970 0.596 0.404 0.000 0.000
#> SRR330895 2 0.6819 -0.1948 0.208 0.604 0.000 0.188
#> SRR330896 1 0.0000 0.8351 1.000 0.000 0.000 0.000
#> SRR330897 4 0.4877 -0.4953 0.000 0.408 0.000 0.592
#> SRR330898 2 0.4888 0.3249 0.000 0.588 0.000 0.412
#> SRR330899 1 0.0000 0.8351 1.000 0.000 0.000 0.000
#> SRR330900 1 0.0000 0.8351 1.000 0.000 0.000 0.000
#> SRR330901 1 0.0000 0.8351 1.000 0.000 0.000 0.000
#> SRR330902 1 0.0000 0.8351 1.000 0.000 0.000 0.000
#> SRR330903 1 0.0000 0.8351 1.000 0.000 0.000 0.000
#> SRR330904 2 0.3486 -0.2771 0.000 0.812 0.000 0.188
#> SRR330906 1 0.4866 0.5970 0.596 0.404 0.000 0.000
#> SRR330907 3 0.0000 0.9318 0.000 0.000 1.000 0.000
#> SRR330908 1 0.4866 0.5970 0.596 0.404 0.000 0.000
#> SRR330909 1 0.0000 0.8351 1.000 0.000 0.000 0.000
#> SRR330910 1 0.3311 0.7498 0.828 0.172 0.000 0.000
#> SRR330911 1 0.4866 0.5970 0.596 0.404 0.000 0.000
#> SRR330912 1 0.4866 0.5970 0.596 0.404 0.000 0.000
#> SRR330913 1 0.0000 0.8351 1.000 0.000 0.000 0.000
#> SRR330914 1 0.0000 0.8351 1.000 0.000 0.000 0.000
#> SRR330915 1 0.0000 0.8351 1.000 0.000 0.000 0.000
#> SRR330916 1 0.4866 0.5970 0.596 0.404 0.000 0.000
#> SRR330917 1 0.0000 0.8351 1.000 0.000 0.000 0.000
#> SRR330918 1 0.4605 0.4496 0.664 0.000 0.336 0.000
#> SRR330919 1 0.0000 0.8351 1.000 0.000 0.000 0.000
#> SRR330920 3 0.0000 0.9318 0.000 0.000 1.000 0.000
#> SRR330921 1 0.0188 0.8320 0.996 0.000 0.004 0.000
#> SRR330922 1 0.0000 0.8351 1.000 0.000 0.000 0.000
#> SRR330923 3 0.0000 0.9318 0.000 0.000 1.000 0.000
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> SRR330857 1 0.4182 0.926 0.600 0.000 0 0.000 0.400
#> SRR330858 1 0.4182 0.926 0.600 0.000 0 0.000 0.400
#> SRR330859 4 0.0000 0.836 0.000 0.000 0 1.000 0.000
#> SRR330860 3 0.0000 0.000 0.000 0.000 1 0.000 0.000
#> SRR330861 1 0.6185 0.685 0.548 0.000 0 0.188 0.264
#> SRR330862 4 0.4015 0.624 0.348 0.000 0 0.652 0.000
#> SRR330863 4 0.0000 0.836 0.000 0.000 0 1.000 0.000
#> SRR330864 4 0.0000 0.836 0.000 0.000 0 1.000 0.000
#> SRR330865 1 0.4182 0.926 0.600 0.000 0 0.000 0.400
#> SRR330866 4 0.4182 0.583 0.400 0.000 0 0.600 0.000
#> SRR330867 1 0.4182 0.926 0.600 0.000 0 0.000 0.400
#> SRR330868 4 0.0000 0.836 0.000 0.000 0 1.000 0.000
#> SRR330869 4 0.0000 0.836 0.000 0.000 0 1.000 0.000
#> SRR330870 1 0.4182 0.926 0.600 0.000 0 0.000 0.400
#> SRR330871 1 0.6100 0.479 0.540 0.000 0 0.308 0.152
#> SRR330872 4 0.0000 0.836 0.000 0.000 0 1.000 0.000
#> SRR330873 1 0.4182 0.926 0.600 0.000 0 0.000 0.400
#> SRR330874 2 0.0000 0.916 0.000 1.000 0 0.000 0.000
#> SRR330875 1 0.4182 0.926 0.600 0.000 0 0.000 0.400
#> SRR330876 1 0.4182 0.926 0.600 0.000 0 0.000 0.400
#> SRR330877 1 0.6148 0.696 0.552 0.000 0 0.180 0.268
#> SRR330878 1 0.4182 0.926 0.600 0.000 0 0.000 0.400
#> SRR330879 4 0.0000 0.836 0.000 0.000 0 1.000 0.000
#> SRR330880 4 0.0000 0.836 0.000 0.000 0 1.000 0.000
#> SRR330881 1 0.4182 0.926 0.600 0.000 0 0.000 0.400
#> SRR330882 4 0.0000 0.836 0.000 0.000 0 1.000 0.000
#> SRR330883 2 0.3177 0.719 0.000 0.792 0 0.000 0.208
#> SRR330884 4 0.0000 0.836 0.000 0.000 0 1.000 0.000
#> SRR330885 4 0.4182 0.583 0.400 0.000 0 0.600 0.000
#> SRR330886 4 0.0000 0.836 0.000 0.000 0 1.000 0.000
#> SRR330887 4 0.0000 0.836 0.000 0.000 0 1.000 0.000
#> SRR330888 4 0.3780 0.673 0.060 0.000 0 0.808 0.132
#> SRR330889 4 0.4182 0.583 0.400 0.000 0 0.600 0.000
#> SRR330890 4 0.4182 0.583 0.400 0.000 0 0.600 0.000
#> SRR330891 4 0.4182 0.583 0.400 0.000 0 0.600 0.000
#> SRR330892 2 0.0000 0.916 0.000 1.000 0 0.000 0.000
#> SRR330893 4 0.4182 0.583 0.400 0.000 0 0.600 0.000
#> SRR330894 4 0.4182 0.583 0.400 0.000 0 0.600 0.000
#> SRR330895 5 0.4182 0.618 0.400 0.000 0 0.000 0.600
#> SRR330896 4 0.0000 0.836 0.000 0.000 0 1.000 0.000
#> SRR330897 5 0.4182 -0.233 0.000 0.400 0 0.000 0.600
#> SRR330898 2 0.0000 0.916 0.000 1.000 0 0.000 0.000
#> SRR330899 4 0.0000 0.836 0.000 0.000 0 1.000 0.000
#> SRR330900 4 0.0000 0.836 0.000 0.000 0 1.000 0.000
#> SRR330901 4 0.0000 0.836 0.000 0.000 0 1.000 0.000
#> SRR330902 4 0.0000 0.836 0.000 0.000 0 1.000 0.000
#> SRR330903 4 0.0000 0.836 0.000 0.000 0 1.000 0.000
#> SRR330904 5 0.4182 0.618 0.400 0.000 0 0.000 0.600
#> SRR330906 4 0.4182 0.583 0.400 0.000 0 0.600 0.000
#> SRR330907 1 0.4182 0.926 0.600 0.000 0 0.000 0.400
#> SRR330908 4 0.4182 0.583 0.400 0.000 0 0.600 0.000
#> SRR330909 4 0.0000 0.836 0.000 0.000 0 1.000 0.000
#> SRR330910 4 0.2852 0.746 0.172 0.000 0 0.828 0.000
#> SRR330911 4 0.4182 0.583 0.400 0.000 0 0.600 0.000
#> SRR330912 4 0.4182 0.583 0.400 0.000 0 0.600 0.000
#> SRR330913 4 0.0000 0.836 0.000 0.000 0 1.000 0.000
#> SRR330914 4 0.0000 0.836 0.000 0.000 0 1.000 0.000
#> SRR330915 4 0.0000 0.836 0.000 0.000 0 1.000 0.000
#> SRR330916 4 0.4182 0.583 0.400 0.000 0 0.600 0.000
#> SRR330917 4 0.0000 0.836 0.000 0.000 0 1.000 0.000
#> SRR330918 4 0.5365 0.443 0.204 0.000 0 0.664 0.132
#> SRR330919 4 0.0000 0.836 0.000 0.000 0 1.000 0.000
#> SRR330920 1 0.4182 0.926 0.600 0.000 0 0.000 0.400
#> SRR330921 4 0.0162 0.833 0.004 0.000 0 0.996 0.000
#> SRR330922 4 0.0000 0.836 0.000 0.000 0 1.000 0.000
#> SRR330923 1 0.4182 0.926 0.600 0.000 0 0.000 0.400
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> SRR330857 1 0.000 0.926 1.000 0.000 0.000 0.000 0.0 0
#> SRR330858 1 0.000 0.926 1.000 0.000 0.000 0.000 0.0 0
#> SRR330859 4 0.386 0.768 0.000 0.000 0.472 0.528 0.0 0
#> SRR330860 6 0.000 0.000 0.000 0.000 0.000 0.000 0.0 1
#> SRR330861 1 0.324 0.686 0.812 0.000 0.040 0.148 0.0 0
#> SRR330862 3 0.263 0.524 0.000 0.000 0.820 0.180 0.0 0
#> SRR330863 4 0.386 0.768 0.000 0.000 0.472 0.528 0.0 0
#> SRR330864 4 0.386 0.768 0.000 0.000 0.472 0.528 0.0 0
#> SRR330865 1 0.000 0.926 1.000 0.000 0.000 0.000 0.0 0
#> SRR330866 3 0.000 0.863 0.000 0.000 1.000 0.000 0.0 0
#> SRR330867 1 0.000 0.926 1.000 0.000 0.000 0.000 0.0 0
#> SRR330868 4 0.386 0.768 0.000 0.000 0.472 0.528 0.0 0
#> SRR330869 4 0.386 0.768 0.000 0.000 0.472 0.528 0.0 0
#> SRR330870 1 0.000 0.926 1.000 0.000 0.000 0.000 0.0 0
#> SRR330871 1 0.411 0.480 0.692 0.000 0.040 0.268 0.0 0
#> SRR330872 4 0.386 0.768 0.000 0.000 0.472 0.528 0.0 0
#> SRR330873 1 0.000 0.926 1.000 0.000 0.000 0.000 0.0 0
#> SRR330874 4 0.581 -0.691 0.000 0.328 0.000 0.472 0.2 0
#> SRR330875 1 0.000 0.926 1.000 0.000 0.000 0.000 0.0 0
#> SRR330876 1 0.000 0.926 1.000 0.000 0.000 0.000 0.0 0
#> SRR330877 1 0.313 0.697 0.820 0.000 0.036 0.144 0.0 0
#> SRR330878 1 0.000 0.926 1.000 0.000 0.000 0.000 0.0 0
#> SRR330879 4 0.386 0.768 0.000 0.000 0.472 0.528 0.0 0
#> SRR330880 4 0.386 0.768 0.000 0.000 0.472 0.528 0.0 0
#> SRR330881 1 0.000 0.926 1.000 0.000 0.000 0.000 0.0 0
#> SRR330882 4 0.386 0.768 0.000 0.000 0.472 0.528 0.0 0
#> SRR330883 2 0.512 -0.280 0.000 0.628 0.000 0.172 0.2 0
#> SRR330884 4 0.386 0.768 0.000 0.000 0.472 0.528 0.0 0
#> SRR330885 3 0.114 0.795 0.000 0.000 0.948 0.052 0.0 0
#> SRR330886 4 0.386 0.768 0.000 0.000 0.472 0.528 0.0 0
#> SRR330887 4 0.386 0.768 0.000 0.000 0.472 0.528 0.0 0
#> SRR330888 3 0.585 -0.380 0.192 0.000 0.424 0.384 0.0 0
#> SRR330889 3 0.000 0.863 0.000 0.000 1.000 0.000 0.0 0
#> SRR330890 3 0.000 0.863 0.000 0.000 1.000 0.000 0.0 0
#> SRR330891 3 0.000 0.863 0.000 0.000 1.000 0.000 0.0 0
#> SRR330892 4 0.581 -0.691 0.000 0.328 0.000 0.472 0.2 0
#> SRR330893 3 0.000 0.863 0.000 0.000 1.000 0.000 0.0 0
#> SRR330894 3 0.000 0.863 0.000 0.000 1.000 0.000 0.0 0
#> SRR330895 2 0.353 0.506 0.000 0.672 0.328 0.000 0.0 0
#> SRR330896 4 0.386 0.768 0.000 0.000 0.472 0.528 0.0 0
#> SRR330897 5 0.000 0.000 0.000 0.000 0.000 0.000 1.0 0
#> SRR330898 4 0.581 -0.691 0.000 0.328 0.000 0.472 0.2 0
#> SRR330899 4 0.386 0.768 0.000 0.000 0.472 0.528 0.0 0
#> SRR330900 4 0.386 0.768 0.000 0.000 0.472 0.528 0.0 0
#> SRR330901 4 0.386 0.768 0.000 0.000 0.472 0.528 0.0 0
#> SRR330902 4 0.386 0.768 0.000 0.000 0.472 0.528 0.0 0
#> SRR330903 4 0.386 0.768 0.000 0.000 0.472 0.528 0.0 0
#> SRR330904 2 0.353 0.506 0.000 0.672 0.328 0.000 0.0 0
#> SRR330906 3 0.000 0.863 0.000 0.000 1.000 0.000 0.0 0
#> SRR330907 1 0.000 0.926 1.000 0.000 0.000 0.000 0.0 0
#> SRR330908 3 0.000 0.863 0.000 0.000 1.000 0.000 0.0 0
#> SRR330909 4 0.386 0.768 0.000 0.000 0.472 0.528 0.0 0
#> SRR330910 3 0.363 -0.255 0.000 0.000 0.644 0.356 0.0 0
#> SRR330911 3 0.000 0.863 0.000 0.000 1.000 0.000 0.0 0
#> SRR330912 3 0.000 0.863 0.000 0.000 1.000 0.000 0.0 0
#> SRR330913 4 0.386 0.768 0.000 0.000 0.472 0.528 0.0 0
#> SRR330914 4 0.386 0.768 0.000 0.000 0.472 0.528 0.0 0
#> SRR330915 4 0.386 0.768 0.000 0.000 0.472 0.528 0.0 0
#> SRR330916 3 0.000 0.863 0.000 0.000 1.000 0.000 0.0 0
#> SRR330917 4 0.386 0.768 0.000 0.000 0.472 0.528 0.0 0
#> SRR330918 4 0.609 0.129 0.336 0.000 0.284 0.380 0.0 0
#> SRR330919 4 0.386 0.768 0.000 0.000 0.472 0.528 0.0 0
#> SRR330920 1 0.000 0.926 1.000 0.000 0.000 0.000 0.0 0
#> SRR330921 4 0.399 0.760 0.004 0.000 0.468 0.528 0.0 0
#> SRR330922 4 0.386 0.768 0.000 0.000 0.472 0.528 0.0 0
#> SRR330923 1 0.000 0.926 1.000 0.000 0.000 0.000 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)
consensus_heatmap(res, k = 3)
consensus_heatmap(res, k = 4)
consensus_heatmap(res, k = 5)
consensus_heatmap(res, k = 6)
Heatmaps for the membership of samples in all partitions to see how consistent they are:
membership_heatmap(res, k = 2)
membership_heatmap(res, k = 3)
membership_heatmap(res, k = 4)
membership_heatmap(res, k = 5)
membership_heatmap(res, k = 6)
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)
get_signatures(res, k = 3)
get_signatures(res, k = 4)
get_signatures(res, k = 5)
get_signatures(res, k = 6)
Signature heatmaps where rows are not scaled:
get_signatures(res, k = 2, scale_rows = FALSE)
get_signatures(res, k = 3, scale_rows = FALSE)
get_signatures(res, k = 4, scale_rows = FALSE)
get_signatures(res, k = 5, scale_rows = FALSE)
get_signatures(res, k = 6, scale_rows = FALSE)
#> Error in mat[ceiling(1:nr/h_ratio), ceiling(1:nc/w_ratio), drop = FALSE]: subscript out of bounds
Compare the overlap of signatures from different k:
compare_signatures(res)
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:
which_row
: row indices corresponding to the input matrix.fdr
: FDR for the differential test. mean_x
: The mean value in group x.scaled_mean_x
: The mean value in group x after rows are scaled.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")
dimension_reduction(res, k = 3, method = "UMAP")
dimension_reduction(res, k = 4, method = "UMAP")
dimension_reduction(res, k = 5, method = "UMAP")
dimension_reduction(res, k = 6, method = "UMAP")
Following heatmap shows how subgroups are split when increasing k
:
collect_classes(res)
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.
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 10869 rows and 66 columns.
#> Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'ATC' method.
#> Subgroups are detected by 'mclust' method.
#> Performed in total 1250 partitions by row resampling.
#> Best k for subgroups seems to be 2.
#>
#> Following methods can be applied to this 'ConsensusPartition' object:
#> [1] "cola_report" "collect_classes" "collect_plots"
#> [4] "collect_stats" "colnames" "compare_signatures"
#> [7] "consensus_heatmap" "dimension_reduction" "functional_enrichment"
#> [10] "get_anno_col" "get_anno" "get_classes"
#> [13] "get_consensus" "get_matrix" "get_membership"
#> [16] "get_param" "get_signatures" "get_stats"
#> [19] "is_best_k" "is_stable_k" "membership_heatmap"
#> [22] "ncol" "nrow" "plot_ecdf"
#> [25] "rownames" "select_partition_number" "show"
#> [28] "suggest_best_k" "test_to_known_factors"
collect_plots()
function collects all the plots made from res
for all k
(number of partitions)
into one single page to provide an easy and fast comparison between different k
.
collect_plots(res)
The plots are:
k
and the heatmap of
predicted classes for each k
.k
.k
.k
.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:
k
;k
, the area increased is defined as \(A_k - A_{k-1}\).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)
The numeric values for all these statistics can be obtained by get_stats()
.
get_stats(res)
#> k 1-PAC mean_silhouette concordance area_increased Rand Jaccard
#> 2 2 1.000 0.981 0.991 0.2517 0.761 0.761
#> 3 3 0.586 0.835 0.900 1.0454 0.709 0.620
#> 4 4 0.337 0.473 0.651 0.1640 0.752 0.518
#> 5 5 0.320 0.561 0.699 0.1632 0.800 0.470
#> 6 6 0.483 0.675 0.767 0.0848 0.929 0.725
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.
cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#> class entropy silhouette p1 p2
#> SRR330857 1 0.000 0.990 1.000 0.000
#> SRR330858 1 0.000 0.990 1.000 0.000
#> SRR330859 1 0.000 0.990 1.000 0.000
#> SRR330860 2 0.000 1.000 0.000 1.000
#> SRR330861 1 0.000 0.990 1.000 0.000
#> SRR330862 1 0.000 0.990 1.000 0.000
#> SRR330863 1 0.295 0.942 0.948 0.052
#> SRR330864 1 0.000 0.990 1.000 0.000
#> SRR330865 1 0.000 0.990 1.000 0.000
#> SRR330866 1 0.000 0.990 1.000 0.000
#> SRR330867 1 0.000 0.990 1.000 0.000
#> SRR330868 1 0.000 0.990 1.000 0.000
#> SRR330869 1 0.000 0.990 1.000 0.000
#> SRR330870 1 0.000 0.990 1.000 0.000
#> SRR330871 1 0.000 0.990 1.000 0.000
#> SRR330872 1 0.118 0.976 0.984 0.016
#> SRR330873 1 0.000 0.990 1.000 0.000
#> SRR330874 2 0.000 1.000 0.000 1.000
#> SRR330875 1 0.000 0.990 1.000 0.000
#> SRR330876 1 0.000 0.990 1.000 0.000
#> SRR330877 1 0.000 0.990 1.000 0.000
#> SRR330878 1 0.000 0.990 1.000 0.000
#> SRR330879 1 0.000 0.990 1.000 0.000
#> SRR330880 1 0.000 0.990 1.000 0.000
#> SRR330881 1 0.000 0.990 1.000 0.000
#> SRR330882 2 0.000 1.000 0.000 1.000
#> SRR330883 2 0.000 1.000 0.000 1.000
#> SRR330884 1 0.000 0.990 1.000 0.000
#> SRR330885 1 0.000 0.990 1.000 0.000
#> SRR330886 1 0.295 0.942 0.948 0.052
#> SRR330887 1 0.000 0.990 1.000 0.000
#> SRR330888 1 0.000 0.990 1.000 0.000
#> SRR330889 1 0.000 0.990 1.000 0.000
#> SRR330890 1 0.000 0.990 1.000 0.000
#> SRR330891 1 0.000 0.990 1.000 0.000
#> SRR330892 2 0.000 1.000 0.000 1.000
#> SRR330893 1 0.000 0.990 1.000 0.000
#> SRR330894 1 0.000 0.990 1.000 0.000
#> SRR330895 2 0.000 1.000 0.000 1.000
#> SRR330896 1 0.000 0.990 1.000 0.000
#> SRR330897 2 0.000 1.000 0.000 1.000
#> SRR330898 2 0.000 1.000 0.000 1.000
#> SRR330899 1 0.000 0.990 1.000 0.000
#> SRR330900 1 0.000 0.990 1.000 0.000
#> SRR330901 1 0.000 0.990 1.000 0.000
#> SRR330902 1 0.000 0.990 1.000 0.000
#> SRR330903 1 0.000 0.990 1.000 0.000
#> SRR330904 1 0.839 0.647 0.732 0.268
#> SRR330906 1 0.671 0.793 0.824 0.176
#> SRR330907 1 0.000 0.990 1.000 0.000
#> SRR330908 1 0.000 0.990 1.000 0.000
#> SRR330909 1 0.000 0.990 1.000 0.000
#> SRR330910 1 0.000 0.990 1.000 0.000
#> SRR330911 1 0.000 0.990 1.000 0.000
#> SRR330912 1 0.000 0.990 1.000 0.000
#> SRR330913 1 0.000 0.990 1.000 0.000
#> SRR330914 1 0.000 0.990 1.000 0.000
#> SRR330915 1 0.000 0.990 1.000 0.000
#> SRR330916 1 0.000 0.990 1.000 0.000
#> SRR330917 1 0.000 0.990 1.000 0.000
#> SRR330918 2 0.000 1.000 0.000 1.000
#> SRR330919 1 0.000 0.990 1.000 0.000
#> SRR330920 1 0.000 0.990 1.000 0.000
#> SRR330921 1 0.000 0.990 1.000 0.000
#> SRR330922 1 0.000 0.990 1.000 0.000
#> SRR330923 1 0.000 0.990 1.000 0.000
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> SRR330857 3 0.5058 0.84643 0.244 0.000 0.756
#> SRR330858 3 0.3816 0.92727 0.148 0.000 0.852
#> SRR330859 1 0.2356 0.87650 0.928 0.000 0.072
#> SRR330860 2 0.3038 0.92579 0.000 0.896 0.104
#> SRR330861 1 0.6302 -0.18697 0.520 0.000 0.480
#> SRR330862 1 0.1832 0.89199 0.956 0.008 0.036
#> SRR330863 1 0.3237 0.86154 0.912 0.032 0.056
#> SRR330864 1 0.1585 0.89514 0.964 0.008 0.028
#> SRR330865 3 0.3816 0.92002 0.148 0.000 0.852
#> SRR330866 1 0.0424 0.90576 0.992 0.000 0.008
#> SRR330867 3 0.3816 0.92803 0.148 0.000 0.852
#> SRR330868 1 0.2066 0.88216 0.940 0.000 0.060
#> SRR330869 1 0.1163 0.90260 0.972 0.000 0.028
#> SRR330870 3 0.3816 0.92803 0.148 0.000 0.852
#> SRR330871 1 0.2955 0.88161 0.912 0.008 0.080
#> SRR330872 1 0.2903 0.86331 0.924 0.028 0.048
#> SRR330873 3 0.3941 0.92774 0.156 0.000 0.844
#> SRR330874 2 0.0475 0.94749 0.004 0.992 0.004
#> SRR330875 1 0.4784 0.74200 0.796 0.004 0.200
#> SRR330876 3 0.3941 0.92657 0.156 0.000 0.844
#> SRR330877 1 0.6079 0.25453 0.612 0.000 0.388
#> SRR330878 3 0.3816 0.92803 0.148 0.000 0.852
#> SRR330879 1 0.1411 0.90086 0.964 0.000 0.036
#> SRR330880 1 0.0424 0.90576 0.992 0.000 0.008
#> SRR330881 3 0.3752 0.92500 0.144 0.000 0.856
#> SRR330882 2 0.3038 0.92579 0.000 0.896 0.104
#> SRR330883 2 0.0237 0.94750 0.004 0.996 0.000
#> SRR330884 1 0.0892 0.90528 0.980 0.000 0.020
#> SRR330885 1 0.1170 0.89512 0.976 0.008 0.016
#> SRR330886 1 0.3472 0.85439 0.904 0.040 0.056
#> SRR330887 1 0.6235 -0.00565 0.564 0.000 0.436
#> SRR330888 3 0.6286 0.35057 0.464 0.000 0.536
#> SRR330889 1 0.0237 0.90534 0.996 0.000 0.004
#> SRR330890 1 0.0237 0.90310 0.996 0.000 0.004
#> SRR330891 1 0.0237 0.90534 0.996 0.000 0.004
#> SRR330892 2 0.0661 0.94712 0.004 0.988 0.008
#> SRR330893 1 0.0592 0.90560 0.988 0.000 0.012
#> SRR330894 1 0.0424 0.90576 0.992 0.000 0.008
#> SRR330895 2 0.0475 0.94749 0.004 0.992 0.004
#> SRR330896 1 0.1031 0.90349 0.976 0.000 0.024
#> SRR330897 2 0.0829 0.94716 0.004 0.984 0.012
#> SRR330898 2 0.0475 0.94749 0.004 0.992 0.004
#> SRR330899 1 0.1163 0.90260 0.972 0.000 0.028
#> SRR330900 1 0.1163 0.90260 0.972 0.000 0.028
#> SRR330901 1 0.1529 0.89892 0.960 0.000 0.040
#> SRR330902 1 0.2356 0.88803 0.928 0.000 0.072
#> SRR330903 1 0.0424 0.90576 0.992 0.000 0.008
#> SRR330904 2 0.4521 0.68879 0.180 0.816 0.004
#> SRR330906 1 0.4892 0.77627 0.840 0.112 0.048
#> SRR330907 3 0.3816 0.92727 0.148 0.000 0.852
#> SRR330908 1 0.0424 0.90576 0.992 0.000 0.008
#> SRR330909 1 0.2261 0.87416 0.932 0.000 0.068
#> SRR330910 1 0.0592 0.90560 0.988 0.000 0.012
#> SRR330911 1 0.0592 0.90560 0.988 0.000 0.012
#> SRR330912 1 0.0424 0.90576 0.992 0.000 0.008
#> SRR330913 1 0.1031 0.90400 0.976 0.000 0.024
#> SRR330914 1 0.1163 0.90260 0.972 0.000 0.028
#> SRR330915 1 0.4654 0.68841 0.792 0.000 0.208
#> SRR330916 1 0.0592 0.90560 0.988 0.000 0.012
#> SRR330917 1 0.1999 0.89766 0.952 0.012 0.036
#> SRR330918 2 0.2796 0.92760 0.000 0.908 0.092
#> SRR330919 1 0.1289 0.90166 0.968 0.000 0.032
#> SRR330920 3 0.4931 0.86768 0.232 0.000 0.768
#> SRR330921 1 0.6140 0.13439 0.596 0.000 0.404
#> SRR330922 1 0.1411 0.89931 0.964 0.000 0.036
#> SRR330923 3 0.4399 0.90829 0.188 0.000 0.812
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> SRR330857 1 0.1389 0.5576 0.952 0.000 0.000 0.048
#> SRR330858 1 0.0817 0.5726 0.976 0.000 0.000 0.024
#> SRR330859 4 0.6049 0.4285 0.132 0.000 0.184 0.684
#> SRR330860 2 0.5277 0.7683 0.000 0.532 0.460 0.008
#> SRR330861 1 0.7626 -0.4640 0.448 0.000 0.336 0.216
#> SRR330862 4 0.6758 0.5434 0.240 0.000 0.156 0.604
#> SRR330863 4 0.5030 0.3651 0.028 0.032 0.160 0.780
#> SRR330864 4 0.6892 0.5461 0.240 0.004 0.152 0.604
#> SRR330865 1 0.5900 0.3820 0.684 0.000 0.220 0.096
#> SRR330866 4 0.4382 0.6588 0.296 0.000 0.000 0.704
#> SRR330867 1 0.4746 0.4606 0.776 0.000 0.168 0.056
#> SRR330868 4 0.6181 0.4523 0.120 0.012 0.168 0.700
#> SRR330869 4 0.7137 0.3621 0.304 0.000 0.160 0.536
#> SRR330870 1 0.0817 0.5726 0.976 0.000 0.000 0.024
#> SRR330871 1 0.7951 -0.6967 0.396 0.004 0.352 0.248
#> SRR330872 4 0.7708 0.5374 0.296 0.040 0.116 0.548
#> SRR330873 1 0.0376 0.5687 0.992 0.000 0.004 0.004
#> SRR330874 2 0.0336 0.8607 0.000 0.992 0.008 0.000
#> SRR330875 1 0.7977 -0.3165 0.412 0.004 0.304 0.280
#> SRR330876 1 0.0188 0.5666 0.996 0.000 0.000 0.004
#> SRR330877 1 0.7626 -0.4335 0.448 0.000 0.336 0.216
#> SRR330878 1 0.1557 0.5570 0.944 0.000 0.000 0.056
#> SRR330879 3 0.7835 0.7676 0.336 0.000 0.396 0.268
#> SRR330880 4 0.6004 0.6175 0.276 0.000 0.076 0.648
#> SRR330881 1 0.0707 0.5726 0.980 0.000 0.000 0.020
#> SRR330882 2 0.5155 0.7674 0.000 0.528 0.468 0.004
#> SRR330883 2 0.0188 0.8596 0.000 0.996 0.000 0.004
#> SRR330884 4 0.6764 0.4698 0.332 0.000 0.112 0.556
#> SRR330885 4 0.5350 0.6619 0.260 0.004 0.036 0.700
#> SRR330886 4 0.5158 0.3525 0.016 0.044 0.176 0.764
#> SRR330887 1 0.6752 -0.4798 0.468 0.000 0.440 0.092
#> SRR330888 1 0.6650 -0.4336 0.484 0.000 0.432 0.084
#> SRR330889 4 0.5365 0.6500 0.264 0.000 0.044 0.692
#> SRR330890 4 0.4466 0.6183 0.180 0.000 0.036 0.784
#> SRR330891 4 0.4630 0.6580 0.252 0.000 0.016 0.732
#> SRR330892 2 0.0921 0.8613 0.000 0.972 0.028 0.000
#> SRR330893 4 0.4543 0.6376 0.324 0.000 0.000 0.676
#> SRR330894 4 0.4356 0.6586 0.292 0.000 0.000 0.708
#> SRR330895 2 0.0779 0.8533 0.016 0.980 0.004 0.000
#> SRR330896 4 0.6750 0.4555 0.288 0.000 0.128 0.584
#> SRR330897 2 0.2156 0.8589 0.004 0.928 0.060 0.008
#> SRR330898 2 0.0592 0.8615 0.000 0.984 0.016 0.000
#> SRR330899 3 0.7875 0.7059 0.288 0.000 0.384 0.328
#> SRR330900 3 0.7883 0.6973 0.292 0.000 0.380 0.328
#> SRR330901 3 0.7414 0.7191 0.368 0.000 0.460 0.172
#> SRR330902 4 0.7096 -0.2366 0.140 0.000 0.344 0.516
#> SRR330903 4 0.4814 0.6463 0.316 0.000 0.008 0.676
#> SRR330904 2 0.6437 0.5354 0.052 0.576 0.012 0.360
#> SRR330906 4 0.5241 0.3897 0.040 0.068 0.100 0.792
#> SRR330907 1 0.1022 0.5694 0.968 0.000 0.000 0.032
#> SRR330908 4 0.4564 0.6379 0.328 0.000 0.000 0.672
#> SRR330909 3 0.7520 0.6678 0.340 0.000 0.464 0.196
#> SRR330910 4 0.4857 0.6376 0.324 0.000 0.008 0.668
#> SRR330911 4 0.4564 0.6379 0.328 0.000 0.000 0.672
#> SRR330912 4 0.4277 0.6589 0.280 0.000 0.000 0.720
#> SRR330913 4 0.6519 0.4847 0.224 0.004 0.128 0.644
#> SRR330914 4 0.6206 0.5222 0.280 0.000 0.088 0.632
#> SRR330915 3 0.6929 0.5018 0.440 0.000 0.452 0.108
#> SRR330916 4 0.4564 0.6379 0.328 0.000 0.000 0.672
#> SRR330917 4 0.6920 0.4380 0.204 0.012 0.156 0.628
#> SRR330918 2 0.5756 0.7763 0.000 0.568 0.400 0.032
#> SRR330919 3 0.7665 0.7659 0.360 0.000 0.424 0.216
#> SRR330920 1 0.6171 -0.0793 0.588 0.000 0.348 0.064
#> SRR330921 1 0.6800 -0.5198 0.460 0.000 0.444 0.096
#> SRR330922 3 0.7808 0.7771 0.312 0.000 0.416 0.272
#> SRR330923 1 0.1637 0.5313 0.940 0.000 0.000 0.060
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> SRR330857 1 0.3318 0.7684 0.800 0.000 0.000 0.008 0.192
#> SRR330858 1 0.3209 0.7841 0.812 0.000 0.000 0.008 0.180
#> SRR330859 4 0.8168 0.1674 0.192 0.000 0.140 0.392 0.276
#> SRR330860 3 0.3081 0.9751 0.012 0.156 0.832 0.000 0.000
#> SRR330861 1 0.5768 0.3592 0.484 0.000 0.000 0.088 0.428
#> SRR330862 4 0.7862 0.3127 0.128 0.000 0.152 0.444 0.276
#> SRR330863 4 0.7887 0.3129 0.148 0.032 0.152 0.544 0.124
#> SRR330864 4 0.7775 0.3065 0.116 0.000 0.144 0.440 0.300
#> SRR330865 1 0.4748 0.6490 0.660 0.000 0.000 0.040 0.300
#> SRR330866 4 0.4551 0.5510 0.016 0.000 0.000 0.616 0.368
#> SRR330867 1 0.4219 0.7184 0.716 0.000 0.000 0.024 0.260
#> SRR330868 4 0.7770 0.3106 0.156 0.000 0.152 0.488 0.204
#> SRR330869 5 0.3779 0.5673 0.024 0.000 0.000 0.200 0.776
#> SRR330870 1 0.3160 0.7831 0.808 0.000 0.000 0.004 0.188
#> SRR330871 1 0.6173 0.2764 0.468 0.000 0.000 0.136 0.396
#> SRR330872 5 0.8046 -0.0544 0.152 0.016 0.084 0.352 0.396
#> SRR330873 1 0.3527 0.7771 0.792 0.000 0.000 0.016 0.192
#> SRR330874 2 0.0000 0.8680 0.000 1.000 0.000 0.000 0.000
#> SRR330875 1 0.5690 0.5698 0.624 0.000 0.000 0.152 0.224
#> SRR330876 1 0.3427 0.7733 0.796 0.000 0.000 0.012 0.192
#> SRR330877 1 0.6170 0.3678 0.492 0.000 0.004 0.120 0.384
#> SRR330878 1 0.3488 0.7730 0.808 0.000 0.000 0.024 0.168
#> SRR330879 5 0.3201 0.6456 0.052 0.000 0.000 0.096 0.852
#> SRR330880 5 0.5526 -0.0858 0.044 0.000 0.012 0.404 0.540
#> SRR330881 1 0.3123 0.7764 0.828 0.000 0.000 0.012 0.160
#> SRR330882 3 0.2648 0.9779 0.000 0.152 0.848 0.000 0.000
#> SRR330883 2 0.0162 0.8675 0.000 0.996 0.004 0.000 0.000
#> SRR330884 5 0.3783 0.4434 0.008 0.000 0.000 0.252 0.740
#> SRR330885 4 0.5119 0.5153 0.048 0.000 0.000 0.592 0.360
#> SRR330886 4 0.7621 0.3297 0.088 0.088 0.152 0.592 0.080
#> SRR330887 5 0.2616 0.6531 0.100 0.000 0.000 0.020 0.880
#> SRR330888 5 0.2522 0.6284 0.108 0.000 0.000 0.012 0.880
#> SRR330889 4 0.5250 0.4706 0.040 0.000 0.004 0.552 0.404
#> SRR330890 4 0.4908 0.5308 0.044 0.000 0.000 0.636 0.320
#> SRR330891 4 0.4836 0.5479 0.036 0.000 0.000 0.628 0.336
#> SRR330892 2 0.0000 0.8680 0.000 1.000 0.000 0.000 0.000
#> SRR330893 4 0.4464 0.5455 0.008 0.004 0.000 0.632 0.356
#> SRR330894 4 0.4794 0.5543 0.032 0.000 0.000 0.624 0.344
#> SRR330895 2 0.0693 0.8607 0.012 0.980 0.000 0.008 0.000
#> SRR330896 5 0.4141 0.5291 0.028 0.000 0.000 0.236 0.736
#> SRR330897 2 0.3352 0.6366 0.004 0.800 0.192 0.004 0.000
#> SRR330898 2 0.0162 0.8676 0.004 0.996 0.000 0.000 0.000
#> SRR330899 5 0.3622 0.6412 0.048 0.000 0.000 0.136 0.816
#> SRR330900 5 0.2905 0.6587 0.036 0.000 0.000 0.096 0.868
#> SRR330901 5 0.1725 0.6680 0.044 0.000 0.000 0.020 0.936
#> SRR330902 5 0.6025 0.3004 0.116 0.004 0.000 0.336 0.544
#> SRR330903 4 0.4774 0.4883 0.020 0.000 0.000 0.556 0.424
#> SRR330904 2 0.5525 0.4313 0.024 0.656 0.024 0.276 0.020
#> SRR330906 4 0.7256 0.3674 0.076 0.112 0.112 0.628 0.072
#> SRR330907 1 0.3513 0.7830 0.800 0.000 0.000 0.020 0.180
#> SRR330908 4 0.4101 0.5507 0.000 0.000 0.000 0.628 0.372
#> SRR330909 5 0.3234 0.6610 0.084 0.000 0.000 0.064 0.852
#> SRR330910 4 0.4402 0.5450 0.012 0.000 0.000 0.636 0.352
#> SRR330911 4 0.4402 0.5494 0.012 0.000 0.000 0.636 0.352
#> SRR330912 4 0.4675 0.5474 0.016 0.004 0.000 0.620 0.360
#> SRR330913 5 0.4973 0.5394 0.060 0.008 0.000 0.236 0.696
#> SRR330914 5 0.4445 0.4314 0.024 0.000 0.000 0.300 0.676
#> SRR330915 5 0.1597 0.6648 0.048 0.000 0.000 0.012 0.940
#> SRR330916 4 0.4387 0.5476 0.012 0.000 0.000 0.640 0.348
#> SRR330917 5 0.5725 0.4702 0.080 0.012 0.004 0.272 0.632
#> SRR330918 3 0.3626 0.9652 0.020 0.152 0.816 0.012 0.000
#> SRR330919 5 0.1800 0.6678 0.020 0.000 0.000 0.048 0.932
#> SRR330920 5 0.3642 0.4507 0.232 0.000 0.000 0.008 0.760
#> SRR330921 5 0.1877 0.6623 0.064 0.000 0.000 0.012 0.924
#> SRR330922 5 0.2992 0.6625 0.064 0.000 0.000 0.068 0.868
#> SRR330923 5 0.5049 -0.3021 0.484 0.000 0.000 0.032 0.484
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> SRR330857 1 0.2883 0.745 0.864 0.000 0.016 0.088 0.032 0.000
#> SRR330858 1 0.1858 0.760 0.904 0.000 0.000 0.092 0.004 0.000
#> SRR330859 3 0.6012 0.543 0.300 0.000 0.508 0.176 0.016 0.000
#> SRR330860 6 0.3818 0.849 0.020 0.000 0.180 0.004 0.020 0.776
#> SRR330861 1 0.5032 0.523 0.632 0.000 0.064 0.284 0.020 0.000
#> SRR330862 3 0.6271 0.676 0.148 0.000 0.588 0.160 0.104 0.000
#> SRR330863 3 0.3833 0.633 0.180 0.000 0.772 0.020 0.028 0.000
#> SRR330864 3 0.6669 0.646 0.180 0.000 0.516 0.216 0.088 0.000
#> SRR330865 1 0.3479 0.654 0.768 0.000 0.008 0.212 0.012 0.000
#> SRR330866 5 0.3559 0.798 0.012 0.000 0.004 0.240 0.744 0.000
#> SRR330867 1 0.3197 0.703 0.804 0.000 0.008 0.176 0.012 0.000
#> SRR330868 3 0.4839 0.679 0.220 0.000 0.684 0.076 0.020 0.000
#> SRR330869 4 0.3450 0.679 0.032 0.000 0.000 0.780 0.188 0.000
#> SRR330870 1 0.1918 0.760 0.904 0.000 0.000 0.088 0.008 0.000
#> SRR330871 1 0.6290 0.386 0.532 0.000 0.124 0.280 0.064 0.000
#> SRR330872 3 0.7405 0.390 0.188 0.000 0.360 0.304 0.148 0.000
#> SRR330873 1 0.3187 0.746 0.836 0.000 0.008 0.112 0.044 0.000
#> SRR330874 2 0.0000 0.872 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR330875 1 0.4826 0.596 0.732 0.000 0.116 0.096 0.056 0.000
#> SRR330876 1 0.2393 0.749 0.884 0.000 0.004 0.092 0.020 0.000
#> SRR330877 1 0.5541 0.440 0.604 0.000 0.116 0.256 0.024 0.000
#> SRR330878 1 0.1942 0.737 0.916 0.000 0.008 0.064 0.012 0.000
#> SRR330879 4 0.3054 0.695 0.036 0.000 0.000 0.828 0.136 0.000
#> SRR330880 4 0.4633 0.415 0.036 0.000 0.012 0.628 0.324 0.000
#> SRR330881 1 0.2101 0.761 0.892 0.000 0.004 0.100 0.004 0.000
#> SRR330882 6 0.0000 0.922 0.000 0.000 0.000 0.000 0.000 1.000
#> SRR330883 2 0.0260 0.871 0.000 0.992 0.008 0.000 0.000 0.000
#> SRR330884 4 0.4029 0.516 0.028 0.000 0.000 0.680 0.292 0.000
#> SRR330885 5 0.4693 0.655 0.024 0.000 0.028 0.312 0.636 0.000
#> SRR330886 3 0.4254 0.614 0.084 0.008 0.788 0.084 0.036 0.000
#> SRR330887 4 0.1408 0.748 0.036 0.000 0.000 0.944 0.020 0.000
#> SRR330888 4 0.1644 0.744 0.040 0.000 0.000 0.932 0.028 0.000
#> SRR330889 5 0.4504 0.649 0.032 0.000 0.008 0.332 0.628 0.000
#> SRR330890 5 0.4540 0.696 0.032 0.000 0.024 0.264 0.680 0.000
#> SRR330891 5 0.4037 0.750 0.032 0.000 0.008 0.236 0.724 0.000
#> SRR330892 2 0.0000 0.872 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR330893 5 0.3020 0.779 0.012 0.008 0.000 0.156 0.824 0.000
#> SRR330894 5 0.3668 0.787 0.028 0.000 0.000 0.228 0.744 0.000
#> SRR330895 2 0.0984 0.860 0.000 0.968 0.012 0.012 0.008 0.000
#> SRR330896 4 0.4122 0.585 0.020 0.000 0.008 0.680 0.292 0.000
#> SRR330897 2 0.3244 0.592 0.000 0.732 0.000 0.000 0.000 0.268
#> SRR330898 2 0.0000 0.872 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR330899 4 0.3174 0.730 0.040 0.000 0.012 0.840 0.108 0.000
#> SRR330900 4 0.2706 0.742 0.024 0.000 0.000 0.852 0.124 0.000
#> SRR330901 4 0.1723 0.744 0.036 0.000 0.000 0.928 0.036 0.000
#> SRR330902 4 0.7057 0.184 0.188 0.000 0.188 0.476 0.148 0.000
#> SRR330903 5 0.4289 0.617 0.028 0.000 0.000 0.360 0.612 0.000
#> SRR330904 2 0.5902 0.491 0.008 0.596 0.156 0.024 0.216 0.000
#> SRR330906 3 0.7588 0.452 0.096 0.128 0.492 0.076 0.208 0.000
#> SRR330907 1 0.2420 0.758 0.864 0.000 0.004 0.128 0.004 0.000
#> SRR330908 5 0.3610 0.803 0.028 0.000 0.004 0.200 0.768 0.000
#> SRR330909 4 0.2476 0.751 0.024 0.000 0.004 0.880 0.092 0.000
#> SRR330910 5 0.3352 0.779 0.016 0.012 0.000 0.172 0.800 0.000
#> SRR330911 5 0.3073 0.784 0.016 0.000 0.004 0.164 0.816 0.000
#> SRR330912 5 0.3126 0.782 0.000 0.000 0.000 0.248 0.752 0.000
#> SRR330913 4 0.4217 0.633 0.024 0.000 0.016 0.700 0.260 0.000
#> SRR330914 4 0.4408 0.249 0.020 0.000 0.004 0.560 0.416 0.000
#> SRR330915 4 0.1720 0.746 0.032 0.000 0.000 0.928 0.040 0.000
#> SRR330916 5 0.2892 0.780 0.020 0.000 0.004 0.136 0.840 0.000
#> SRR330917 4 0.4570 0.635 0.032 0.000 0.028 0.684 0.256 0.000
#> SRR330918 6 0.0405 0.920 0.000 0.004 0.008 0.000 0.000 0.988
#> SRR330919 4 0.2309 0.746 0.028 0.000 0.000 0.888 0.084 0.000
#> SRR330920 4 0.3969 0.433 0.276 0.000 0.012 0.700 0.012 0.000
#> SRR330921 4 0.1225 0.747 0.036 0.000 0.000 0.952 0.012 0.000
#> SRR330922 4 0.2608 0.744 0.048 0.000 0.000 0.872 0.080 0.000
#> SRR330923 1 0.4663 0.379 0.552 0.000 0.004 0.408 0.036 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)
consensus_heatmap(res, k = 3)
consensus_heatmap(res, k = 4)
consensus_heatmap(res, k = 5)
consensus_heatmap(res, k = 6)
Heatmaps for the membership of samples in all partitions to see how consistent they are:
membership_heatmap(res, k = 2)
membership_heatmap(res, k = 3)
membership_heatmap(res, k = 4)
membership_heatmap(res, k = 5)
membership_heatmap(res, k = 6)
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)
get_signatures(res, k = 3)
get_signatures(res, k = 4)
get_signatures(res, k = 5)
get_signatures(res, k = 6)
Signature heatmaps where rows are not scaled:
get_signatures(res, k = 2, scale_rows = FALSE)
get_signatures(res, k = 3, scale_rows = FALSE)
get_signatures(res, k = 4, scale_rows = FALSE)
get_signatures(res, k = 5, scale_rows = FALSE)
get_signatures(res, k = 6, scale_rows = FALSE)
Compare the overlap of signatures from different k:
compare_signatures(res)
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:
which_row
: row indices corresponding to the input matrix.fdr
: FDR for the differential test. mean_x
: The mean value in group x.scaled_mean_x
: The mean value in group x after rows are scaled.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")
dimension_reduction(res, k = 3, method = "UMAP")
dimension_reduction(res, k = 4, method = "UMAP")
dimension_reduction(res, k = 5, method = "UMAP")
dimension_reduction(res, k = 6, method = "UMAP")
Following heatmap shows how subgroups are split when increasing k
:
collect_classes(res)
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.
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 10869 rows and 66 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)
The plots are:
k
and the heatmap of
predicted classes for each k
.k
.k
.k
.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:
k
;k
, the area increased is defined as \(A_k - A_{k-1}\).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)
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.944 0.939 0.962 0.103 0.940 0.940
#> 3 3 0.825 0.870 0.937 0.609 0.942 0.939
#> 4 4 0.440 0.770 0.883 0.576 0.970 0.966
#> 5 5 0.287 0.579 0.795 0.539 0.776 0.739
#> 6 6 0.377 0.575 0.798 0.231 0.840 0.759
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.
cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#> class entropy silhouette p1 p2
#> SRR330857 1 0.7219 0.748 0.800 0.200
#> SRR330858 1 0.2043 0.957 0.968 0.032
#> SRR330859 1 0.1633 0.960 0.976 0.024
#> SRR330860 1 0.9795 0.226 0.584 0.416
#> SRR330861 1 0.1414 0.962 0.980 0.020
#> SRR330862 1 0.1414 0.963 0.980 0.020
#> SRR330863 1 0.0376 0.965 0.996 0.004
#> SRR330864 1 0.1414 0.962 0.980 0.020
#> SRR330865 1 0.1414 0.962 0.980 0.020
#> SRR330866 1 0.1184 0.964 0.984 0.016
#> SRR330867 1 0.1414 0.962 0.980 0.020
#> SRR330868 1 0.1414 0.962 0.980 0.020
#> SRR330869 1 0.0672 0.964 0.992 0.008
#> SRR330870 1 0.2778 0.949 0.952 0.048
#> SRR330871 1 0.2603 0.952 0.956 0.044
#> SRR330872 1 0.2423 0.954 0.960 0.040
#> SRR330873 1 0.2236 0.955 0.964 0.036
#> SRR330874 1 0.2423 0.955 0.960 0.040
#> SRR330875 1 0.6887 0.792 0.816 0.184
#> SRR330876 1 0.2603 0.953 0.956 0.044
#> SRR330877 1 0.1414 0.962 0.980 0.020
#> SRR330878 1 0.2043 0.957 0.968 0.032
#> SRR330879 1 0.0672 0.964 0.992 0.008
#> SRR330880 1 0.0376 0.965 0.996 0.004
#> SRR330881 1 0.2043 0.957 0.968 0.032
#> SRR330882 2 0.4431 0.893 0.092 0.908
#> SRR330883 1 0.2948 0.947 0.948 0.052
#> SRR330884 1 0.0938 0.963 0.988 0.012
#> SRR330885 1 0.1414 0.965 0.980 0.020
#> SRR330886 1 0.1184 0.962 0.984 0.016
#> SRR330887 1 0.0672 0.964 0.992 0.008
#> SRR330888 1 0.0376 0.965 0.996 0.004
#> SRR330889 1 0.0672 0.965 0.992 0.008
#> SRR330890 1 0.0376 0.965 0.996 0.004
#> SRR330891 1 0.0672 0.965 0.992 0.008
#> SRR330892 1 0.4431 0.910 0.908 0.092
#> SRR330893 1 0.1414 0.960 0.980 0.020
#> SRR330894 1 0.0376 0.965 0.996 0.004
#> SRR330895 1 0.3274 0.941 0.940 0.060
#> SRR330896 1 0.0000 0.965 1.000 0.000
#> SRR330897 1 0.4939 0.888 0.892 0.108
#> SRR330898 1 0.2948 0.947 0.948 0.052
#> SRR330899 1 0.0938 0.965 0.988 0.012
#> SRR330900 1 0.0938 0.964 0.988 0.012
#> SRR330901 1 0.0938 0.963 0.988 0.012
#> SRR330902 1 0.0672 0.965 0.992 0.008
#> SRR330903 1 0.0938 0.963 0.988 0.012
#> SRR330904 1 0.0376 0.965 0.996 0.004
#> SRR330906 1 0.0672 0.965 0.992 0.008
#> SRR330907 1 0.1414 0.963 0.980 0.020
#> SRR330908 1 0.1184 0.962 0.984 0.016
#> SRR330909 1 0.4161 0.902 0.916 0.084
#> SRR330910 1 0.1843 0.956 0.972 0.028
#> SRR330911 1 0.1414 0.960 0.980 0.020
#> SRR330912 1 0.0938 0.963 0.988 0.012
#> SRR330913 1 0.0376 0.965 0.996 0.004
#> SRR330914 1 0.0938 0.965 0.988 0.012
#> SRR330915 1 0.0938 0.963 0.988 0.012
#> SRR330916 1 0.1633 0.958 0.976 0.024
#> SRR330917 1 0.1633 0.962 0.976 0.024
#> SRR330918 2 0.6531 0.884 0.168 0.832
#> SRR330919 1 0.0938 0.963 0.988 0.012
#> SRR330920 1 0.1633 0.965 0.976 0.024
#> SRR330921 1 0.0938 0.963 0.988 0.012
#> SRR330922 1 0.0938 0.963 0.988 0.012
#> SRR330923 1 0.0938 0.963 0.988 0.012
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> SRR330857 3 0.8180 0.43936 0.392 0.076 0.532
#> SRR330858 1 0.2165 0.92062 0.936 0.000 0.064
#> SRR330859 1 0.1753 0.92922 0.952 0.000 0.048
#> SRR330860 3 0.5696 0.00496 0.148 0.056 0.796
#> SRR330861 1 0.1529 0.93297 0.960 0.000 0.040
#> SRR330862 1 0.1289 0.93706 0.968 0.000 0.032
#> SRR330863 1 0.1860 0.92746 0.948 0.000 0.052
#> SRR330864 1 0.1163 0.93682 0.972 0.000 0.028
#> SRR330865 1 0.1643 0.93092 0.956 0.000 0.044
#> SRR330866 1 0.0424 0.93736 0.992 0.000 0.008
#> SRR330867 1 0.1964 0.92469 0.944 0.000 0.056
#> SRR330868 1 0.1411 0.93458 0.964 0.000 0.036
#> SRR330869 1 0.0661 0.93525 0.988 0.004 0.008
#> SRR330870 1 0.2711 0.90020 0.912 0.000 0.088
#> SRR330871 1 0.2537 0.90794 0.920 0.000 0.080
#> SRR330872 1 0.3038 0.88635 0.896 0.000 0.104
#> SRR330873 1 0.2448 0.91009 0.924 0.000 0.076
#> SRR330874 1 0.2165 0.91912 0.936 0.000 0.064
#> SRR330875 1 0.8731 -0.42988 0.516 0.116 0.368
#> SRR330876 1 0.3267 0.87170 0.884 0.000 0.116
#> SRR330877 1 0.2066 0.92180 0.940 0.000 0.060
#> SRR330878 1 0.2878 0.89347 0.904 0.000 0.096
#> SRR330879 1 0.0000 0.93888 1.000 0.000 0.000
#> SRR330880 1 0.0237 0.93960 0.996 0.000 0.004
#> SRR330881 1 0.1753 0.92823 0.952 0.000 0.048
#> SRR330882 2 0.6095 0.74583 0.000 0.608 0.392
#> SRR330883 1 0.3482 0.85294 0.872 0.000 0.128
#> SRR330884 1 0.0237 0.93838 0.996 0.000 0.004
#> SRR330885 1 0.0000 0.93888 1.000 0.000 0.000
#> SRR330886 1 0.1031 0.93910 0.976 0.000 0.024
#> SRR330887 1 0.0000 0.93888 1.000 0.000 0.000
#> SRR330888 1 0.0237 0.93838 0.996 0.000 0.004
#> SRR330889 1 0.0424 0.93985 0.992 0.000 0.008
#> SRR330890 1 0.0424 0.93970 0.992 0.000 0.008
#> SRR330891 1 0.0000 0.93888 1.000 0.000 0.000
#> SRR330892 1 0.4293 0.79185 0.832 0.004 0.164
#> SRR330893 1 0.0983 0.93082 0.980 0.004 0.016
#> SRR330894 1 0.0000 0.93888 1.000 0.000 0.000
#> SRR330895 1 0.4178 0.78098 0.828 0.000 0.172
#> SRR330896 1 0.0000 0.93888 1.000 0.000 0.000
#> SRR330897 1 0.4521 0.76256 0.816 0.004 0.180
#> SRR330898 1 0.3116 0.87786 0.892 0.000 0.108
#> SRR330899 1 0.0661 0.94026 0.988 0.004 0.008
#> SRR330900 1 0.0237 0.93956 0.996 0.000 0.004
#> SRR330901 1 0.0237 0.93863 0.996 0.000 0.004
#> SRR330902 1 0.1411 0.93377 0.964 0.000 0.036
#> SRR330903 1 0.0237 0.93838 0.996 0.000 0.004
#> SRR330904 1 0.0892 0.93994 0.980 0.000 0.020
#> SRR330906 1 0.1643 0.93122 0.956 0.000 0.044
#> SRR330907 1 0.1411 0.93410 0.964 0.000 0.036
#> SRR330908 1 0.0661 0.93591 0.988 0.004 0.008
#> SRR330909 1 0.5094 0.70250 0.824 0.136 0.040
#> SRR330910 1 0.1774 0.91383 0.960 0.016 0.024
#> SRR330911 1 0.0592 0.93591 0.988 0.000 0.012
#> SRR330912 1 0.0475 0.93727 0.992 0.004 0.004
#> SRR330913 1 0.0424 0.94003 0.992 0.000 0.008
#> SRR330914 1 0.0848 0.93328 0.984 0.008 0.008
#> SRR330915 1 0.0237 0.93863 0.996 0.000 0.004
#> SRR330916 1 0.1337 0.92471 0.972 0.012 0.016
#> SRR330917 1 0.0592 0.93995 0.988 0.000 0.012
#> SRR330918 2 0.2599 0.74694 0.016 0.932 0.052
#> SRR330919 1 0.0000 0.93888 1.000 0.000 0.000
#> SRR330920 1 0.0424 0.93990 0.992 0.000 0.008
#> SRR330921 1 0.0237 0.93865 0.996 0.004 0.000
#> SRR330922 1 0.0475 0.93727 0.992 0.004 0.004
#> SRR330923 1 0.0237 0.93956 0.996 0.000 0.004
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> SRR330857 2 0.8082 0.289 0.144 0.512 0.044 0.300
#> SRR330858 1 0.2124 0.886 0.924 0.068 0.000 0.008
#> SRR330859 1 0.2984 0.870 0.888 0.084 0.000 0.028
#> SRR330860 2 0.5706 -0.236 0.004 0.724 0.104 0.168
#> SRR330861 1 0.1488 0.895 0.956 0.032 0.000 0.012
#> SRR330862 1 0.1520 0.890 0.956 0.024 0.000 0.020
#> SRR330863 1 0.4485 0.791 0.796 0.152 0.000 0.052
#> SRR330864 1 0.1174 0.895 0.968 0.012 0.000 0.020
#> SRR330865 1 0.1545 0.894 0.952 0.040 0.000 0.008
#> SRR330866 1 0.1004 0.893 0.972 0.004 0.000 0.024
#> SRR330867 1 0.1635 0.891 0.948 0.044 0.000 0.008
#> SRR330868 1 0.1520 0.896 0.956 0.024 0.000 0.020
#> SRR330869 1 0.0524 0.897 0.988 0.004 0.000 0.008
#> SRR330870 1 0.2988 0.859 0.876 0.112 0.000 0.012
#> SRR330871 1 0.1913 0.892 0.940 0.040 0.000 0.020
#> SRR330872 1 0.3143 0.862 0.876 0.100 0.000 0.024
#> SRR330873 1 0.2611 0.872 0.896 0.096 0.000 0.008
#> SRR330874 1 0.4163 0.783 0.792 0.188 0.000 0.020
#> SRR330875 2 0.9019 0.295 0.304 0.372 0.060 0.264
#> SRR330876 1 0.4361 0.771 0.772 0.208 0.000 0.020
#> SRR330877 1 0.2282 0.889 0.924 0.052 0.000 0.024
#> SRR330878 1 0.3808 0.808 0.812 0.176 0.000 0.012
#> SRR330879 1 0.0336 0.896 0.992 0.000 0.000 0.008
#> SRR330880 1 0.1174 0.893 0.968 0.012 0.000 0.020
#> SRR330881 1 0.2610 0.872 0.900 0.088 0.000 0.012
#> SRR330882 3 0.0921 0.000 0.000 0.028 0.972 0.000
#> SRR330883 1 0.5314 0.625 0.676 0.296 0.004 0.024
#> SRR330884 1 0.0376 0.897 0.992 0.004 0.000 0.004
#> SRR330885 1 0.0592 0.897 0.984 0.000 0.000 0.016
#> SRR330886 1 0.5265 0.724 0.748 0.160 0.000 0.092
#> SRR330887 1 0.0592 0.895 0.984 0.000 0.000 0.016
#> SRR330888 1 0.0779 0.895 0.980 0.004 0.000 0.016
#> SRR330889 1 0.0779 0.895 0.980 0.004 0.000 0.016
#> SRR330890 1 0.1209 0.896 0.964 0.032 0.000 0.004
#> SRR330891 1 0.0188 0.897 0.996 0.004 0.000 0.000
#> SRR330892 1 0.5913 0.503 0.620 0.340 0.020 0.020
#> SRR330893 1 0.0895 0.894 0.976 0.004 0.000 0.020
#> SRR330894 1 0.0592 0.895 0.984 0.000 0.000 0.016
#> SRR330895 1 0.5409 0.556 0.644 0.332 0.004 0.020
#> SRR330896 1 0.0469 0.896 0.988 0.000 0.000 0.012
#> SRR330897 1 0.6025 0.461 0.604 0.352 0.032 0.012
#> SRR330898 1 0.4718 0.674 0.708 0.280 0.000 0.012
#> SRR330899 1 0.1398 0.895 0.956 0.040 0.000 0.004
#> SRR330900 1 0.1004 0.897 0.972 0.024 0.000 0.004
#> SRR330901 1 0.0672 0.898 0.984 0.008 0.000 0.008
#> SRR330902 1 0.4123 0.811 0.820 0.136 0.000 0.044
#> SRR330903 1 0.0524 0.896 0.988 0.004 0.000 0.008
#> SRR330904 1 0.3525 0.846 0.860 0.100 0.000 0.040
#> SRR330906 1 0.5076 0.747 0.756 0.172 0.000 0.072
#> SRR330907 1 0.2796 0.868 0.892 0.092 0.000 0.016
#> SRR330908 1 0.1356 0.891 0.960 0.008 0.000 0.032
#> SRR330909 1 0.8489 -0.424 0.384 0.200 0.036 0.380
#> SRR330910 1 0.1767 0.881 0.944 0.012 0.000 0.044
#> SRR330911 1 0.1256 0.891 0.964 0.008 0.000 0.028
#> SRR330912 1 0.0779 0.895 0.980 0.004 0.000 0.016
#> SRR330913 1 0.3015 0.865 0.884 0.092 0.000 0.024
#> SRR330914 1 0.0469 0.897 0.988 0.000 0.000 0.012
#> SRR330915 1 0.0657 0.897 0.984 0.004 0.000 0.012
#> SRR330916 1 0.1356 0.891 0.960 0.008 0.000 0.032
#> SRR330917 1 0.1978 0.883 0.928 0.068 0.000 0.004
#> SRR330918 4 0.5387 0.000 0.000 0.016 0.400 0.584
#> SRR330919 1 0.0524 0.896 0.988 0.004 0.000 0.008
#> SRR330920 1 0.0707 0.897 0.980 0.020 0.000 0.000
#> SRR330921 1 0.0895 0.895 0.976 0.004 0.000 0.020
#> SRR330922 1 0.0336 0.897 0.992 0.008 0.000 0.000
#> SRR330923 1 0.1209 0.896 0.964 0.032 0.000 0.004
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> SRR330857 2 0.8288 -0.4686 0.064 0.452 0.188 0.044 0.252
#> SRR330858 1 0.3719 0.6601 0.776 0.208 0.012 0.000 0.004
#> SRR330859 1 0.4638 0.5884 0.728 0.216 0.048 0.000 0.008
#> SRR330860 3 0.1026 0.0000 0.004 0.004 0.968 0.024 0.000
#> SRR330861 1 0.2037 0.8066 0.920 0.064 0.012 0.000 0.004
#> SRR330862 1 0.2199 0.7941 0.916 0.060 0.008 0.000 0.016
#> SRR330863 2 0.5257 0.2913 0.476 0.488 0.012 0.000 0.024
#> SRR330864 1 0.1956 0.8101 0.928 0.052 0.008 0.000 0.012
#> SRR330865 1 0.2289 0.7948 0.904 0.080 0.012 0.000 0.004
#> SRR330866 1 0.1285 0.8075 0.956 0.036 0.004 0.000 0.004
#> SRR330867 1 0.3236 0.7232 0.828 0.152 0.020 0.000 0.000
#> SRR330868 1 0.2139 0.8068 0.920 0.056 0.012 0.000 0.012
#> SRR330869 1 0.0451 0.8180 0.988 0.008 0.000 0.000 0.004
#> SRR330870 1 0.5171 0.4253 0.664 0.268 0.060 0.000 0.008
#> SRR330871 1 0.2584 0.7966 0.900 0.040 0.052 0.000 0.008
#> SRR330872 1 0.4866 0.6184 0.740 0.120 0.132 0.000 0.008
#> SRR330873 1 0.4934 0.5658 0.720 0.192 0.080 0.000 0.008
#> SRR330874 1 0.5953 -0.2647 0.504 0.384 0.112 0.000 0.000
#> SRR330875 5 0.9339 -0.0862 0.220 0.276 0.152 0.060 0.292
#> SRR330876 1 0.6624 -0.0224 0.540 0.284 0.152 0.000 0.024
#> SRR330877 1 0.3547 0.7502 0.836 0.100 0.060 0.000 0.004
#> SRR330878 1 0.5656 0.2625 0.612 0.284 0.100 0.000 0.004
#> SRR330879 1 0.0451 0.8173 0.988 0.008 0.000 0.000 0.004
#> SRR330880 1 0.1442 0.8116 0.952 0.032 0.004 0.000 0.012
#> SRR330881 1 0.4301 0.5302 0.712 0.260 0.028 0.000 0.000
#> SRR330882 5 0.4883 -0.5085 0.000 0.000 0.048 0.300 0.652
#> SRR330883 2 0.6710 0.6322 0.324 0.492 0.168 0.000 0.016
#> SRR330884 1 0.0510 0.8176 0.984 0.016 0.000 0.000 0.000
#> SRR330885 1 0.1041 0.8195 0.964 0.032 0.000 0.000 0.004
#> SRR330886 2 0.5457 0.5605 0.364 0.572 0.004 0.000 0.060
#> SRR330887 1 0.0404 0.8169 0.988 0.012 0.000 0.000 0.000
#> SRR330888 1 0.0771 0.8142 0.976 0.020 0.000 0.000 0.004
#> SRR330889 1 0.1116 0.8102 0.964 0.028 0.004 0.000 0.004
#> SRR330890 1 0.2304 0.7779 0.892 0.100 0.008 0.000 0.000
#> SRR330891 1 0.0510 0.8169 0.984 0.016 0.000 0.000 0.000
#> SRR330892 2 0.7057 0.5982 0.296 0.436 0.252 0.000 0.016
#> SRR330893 1 0.0955 0.8111 0.968 0.028 0.004 0.000 0.000
#> SRR330894 1 0.0833 0.8143 0.976 0.016 0.004 0.000 0.004
#> SRR330895 2 0.6980 0.6132 0.324 0.456 0.200 0.000 0.020
#> SRR330896 1 0.0290 0.8170 0.992 0.008 0.000 0.000 0.000
#> SRR330897 2 0.6881 0.5736 0.264 0.500 0.216 0.000 0.020
#> SRR330898 2 0.6403 0.6340 0.312 0.524 0.156 0.000 0.008
#> SRR330899 1 0.3031 0.7475 0.852 0.128 0.004 0.000 0.016
#> SRR330900 1 0.2733 0.7652 0.872 0.112 0.004 0.000 0.012
#> SRR330901 1 0.1408 0.8143 0.948 0.044 0.008 0.000 0.000
#> SRR330902 1 0.4804 -0.2118 0.524 0.460 0.008 0.000 0.008
#> SRR330903 1 0.0290 0.8172 0.992 0.008 0.000 0.000 0.000
#> SRR330904 1 0.4403 0.2135 0.608 0.384 0.000 0.000 0.008
#> SRR330906 2 0.4798 0.5330 0.396 0.580 0.000 0.000 0.024
#> SRR330907 1 0.3582 0.6234 0.768 0.224 0.008 0.000 0.000
#> SRR330908 1 0.1492 0.8027 0.948 0.040 0.004 0.000 0.008
#> SRR330909 2 0.7541 -0.3766 0.140 0.524 0.024 0.056 0.256
#> SRR330910 1 0.2199 0.7815 0.916 0.060 0.008 0.000 0.016
#> SRR330911 1 0.1492 0.8027 0.948 0.040 0.004 0.000 0.008
#> SRR330912 1 0.0880 0.8132 0.968 0.032 0.000 0.000 0.000
#> SRR330913 1 0.4948 0.2223 0.612 0.356 0.008 0.000 0.024
#> SRR330914 1 0.0771 0.8155 0.976 0.020 0.000 0.000 0.004
#> SRR330915 1 0.0771 0.8173 0.976 0.020 0.000 0.000 0.004
#> SRR330916 1 0.1901 0.7891 0.928 0.056 0.004 0.000 0.012
#> SRR330917 1 0.4241 0.5739 0.748 0.220 0.016 0.000 0.016
#> SRR330918 4 0.0404 0.0000 0.000 0.000 0.012 0.988 0.000
#> SRR330919 1 0.0404 0.8173 0.988 0.012 0.000 0.000 0.000
#> SRR330920 1 0.1571 0.8015 0.936 0.060 0.004 0.000 0.000
#> SRR330921 1 0.0771 0.8169 0.976 0.020 0.000 0.000 0.004
#> SRR330922 1 0.1124 0.8154 0.960 0.036 0.000 0.000 0.004
#> SRR330923 1 0.2646 0.7610 0.868 0.124 0.004 0.000 0.004
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> SRR330857 1 0.8617 0.2092 0.416 0.228 0.064 0.068 0.084 0.140
#> SRR330858 4 0.4564 0.2686 0.008 0.368 0.000 0.600 0.008 0.016
#> SRR330859 4 0.5828 -0.0443 0.028 0.384 0.000 0.516 0.024 0.048
#> SRR330860 6 0.1861 0.0000 0.000 0.036 0.016 0.000 0.020 0.928
#> SRR330861 4 0.3160 0.7357 0.004 0.128 0.000 0.836 0.012 0.020
#> SRR330862 4 0.2773 0.7742 0.016 0.092 0.000 0.872 0.008 0.012
#> SRR330863 2 0.5894 0.5356 0.108 0.580 0.000 0.276 0.020 0.016
#> SRR330864 4 0.2417 0.7819 0.004 0.088 0.000 0.888 0.008 0.012
#> SRR330865 4 0.3387 0.7035 0.004 0.160 0.000 0.808 0.012 0.016
#> SRR330866 4 0.0777 0.8234 0.004 0.024 0.000 0.972 0.000 0.000
#> SRR330867 4 0.3946 0.6099 0.004 0.228 0.000 0.736 0.004 0.028
#> SRR330868 4 0.3199 0.7420 0.012 0.120 0.000 0.840 0.012 0.016
#> SRR330869 4 0.1282 0.8199 0.012 0.024 0.000 0.956 0.004 0.004
#> SRR330870 4 0.4541 -0.1494 0.008 0.476 0.000 0.500 0.004 0.012
#> SRR330871 4 0.2737 0.7786 0.004 0.084 0.000 0.868 0.000 0.044
#> SRR330872 4 0.5366 0.4858 0.012 0.208 0.000 0.652 0.012 0.116
#> SRR330873 4 0.4860 0.2115 0.012 0.376 0.000 0.576 0.004 0.032
#> SRR330874 2 0.5095 0.5812 0.036 0.612 0.000 0.320 0.008 0.024
#> SRR330875 1 0.8820 0.1653 0.396 0.100 0.040 0.124 0.204 0.136
#> SRR330876 2 0.6342 0.4679 0.028 0.488 0.000 0.368 0.032 0.084
#> SRR330877 4 0.4813 0.5402 0.008 0.220 0.000 0.692 0.012 0.068
#> SRR330878 2 0.5257 0.3814 0.012 0.524 0.000 0.408 0.008 0.048
#> SRR330879 4 0.0692 0.8245 0.000 0.020 0.000 0.976 0.000 0.004
#> SRR330880 4 0.1333 0.8141 0.000 0.048 0.000 0.944 0.000 0.008
#> SRR330881 4 0.4432 -0.0504 0.008 0.444 0.000 0.536 0.004 0.008
#> SRR330882 3 0.0000 0.0000 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR330883 2 0.5271 0.4441 0.092 0.720 0.000 0.112 0.024 0.052
#> SRR330884 4 0.0436 0.8256 0.004 0.004 0.000 0.988 0.000 0.004
#> SRR330885 4 0.0909 0.8271 0.012 0.020 0.000 0.968 0.000 0.000
#> SRR330886 2 0.6073 0.3830 0.232 0.568 0.000 0.168 0.024 0.008
#> SRR330887 4 0.0405 0.8250 0.000 0.008 0.000 0.988 0.000 0.004
#> SRR330888 4 0.0436 0.8258 0.004 0.004 0.000 0.988 0.000 0.004
#> SRR330889 4 0.1307 0.8185 0.008 0.032 0.000 0.952 0.000 0.008
#> SRR330890 4 0.2144 0.7821 0.004 0.092 0.000 0.896 0.004 0.004
#> SRR330891 4 0.0405 0.8262 0.000 0.008 0.000 0.988 0.000 0.004
#> SRR330892 2 0.5553 0.3501 0.048 0.696 0.000 0.092 0.032 0.132
#> SRR330893 4 0.0767 0.8235 0.008 0.012 0.000 0.976 0.000 0.004
#> SRR330894 4 0.0508 0.8252 0.004 0.012 0.000 0.984 0.000 0.000
#> SRR330895 2 0.5428 0.3318 0.056 0.712 0.000 0.088 0.032 0.112
#> SRR330896 4 0.0146 0.8265 0.000 0.004 0.000 0.996 0.000 0.000
#> SRR330897 2 0.5287 0.3152 0.076 0.728 0.000 0.080 0.032 0.084
#> SRR330898 2 0.3988 0.4259 0.048 0.812 0.000 0.088 0.016 0.036
#> SRR330899 4 0.3304 0.6721 0.012 0.172 0.000 0.804 0.008 0.004
#> SRR330900 4 0.3077 0.7222 0.012 0.136 0.000 0.836 0.008 0.008
#> SRR330901 4 0.0405 0.8263 0.004 0.008 0.000 0.988 0.000 0.000
#> SRR330902 2 0.4999 0.5737 0.056 0.656 0.000 0.264 0.012 0.012
#> SRR330903 4 0.0436 0.8260 0.004 0.004 0.000 0.988 0.000 0.004
#> SRR330904 2 0.5671 0.4910 0.096 0.500 0.000 0.388 0.008 0.008
#> SRR330906 2 0.5290 0.4848 0.152 0.672 0.000 0.148 0.024 0.004
#> SRR330907 4 0.4603 0.2976 0.020 0.332 0.000 0.628 0.004 0.016
#> SRR330908 4 0.0725 0.8217 0.012 0.012 0.000 0.976 0.000 0.000
#> SRR330909 1 0.3973 0.2456 0.808 0.108 0.004 0.048 0.020 0.012
#> SRR330910 4 0.1390 0.8104 0.032 0.016 0.000 0.948 0.000 0.004
#> SRR330911 4 0.0820 0.8217 0.012 0.016 0.000 0.972 0.000 0.000
#> SRR330912 4 0.0653 0.8259 0.012 0.004 0.000 0.980 0.000 0.004
#> SRR330913 2 0.5978 0.2875 0.056 0.456 0.000 0.436 0.028 0.024
#> SRR330914 4 0.1096 0.8238 0.008 0.020 0.000 0.964 0.004 0.004
#> SRR330915 4 0.0405 0.8266 0.008 0.004 0.000 0.988 0.000 0.000
#> SRR330916 4 0.0909 0.8211 0.020 0.012 0.000 0.968 0.000 0.000
#> SRR330917 4 0.5417 0.2750 0.044 0.288 0.000 0.620 0.028 0.020
#> SRR330918 5 0.2527 0.0000 0.000 0.000 0.168 0.000 0.832 0.000
#> SRR330919 4 0.0436 0.8256 0.004 0.004 0.000 0.988 0.000 0.004
#> SRR330920 4 0.1812 0.7996 0.008 0.060 0.000 0.924 0.004 0.004
#> SRR330921 4 0.0508 0.8267 0.012 0.000 0.000 0.984 0.000 0.004
#> SRR330922 4 0.1121 0.8202 0.008 0.016 0.000 0.964 0.008 0.004
#> SRR330923 4 0.2798 0.7441 0.012 0.120 0.000 0.856 0.008 0.004
Heatmaps for the consensus matrix. It visualizes the probability of two samples to be in a same group.
consensus_heatmap(res, k = 2)
consensus_heatmap(res, k = 3)
consensus_heatmap(res, k = 4)
consensus_heatmap(res, k = 5)
consensus_heatmap(res, k = 6)
Heatmaps for the membership of samples in all partitions to see how consistent they are:
membership_heatmap(res, k = 2)
membership_heatmap(res, k = 3)
membership_heatmap(res, k = 4)
membership_heatmap(res, k = 5)
membership_heatmap(res, k = 6)
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)
get_signatures(res, k = 3)
get_signatures(res, k = 4)
get_signatures(res, k = 5)
get_signatures(res, k = 6)
Signature heatmaps where rows are not scaled:
get_signatures(res, k = 2, scale_rows = FALSE)
get_signatures(res, k = 3, scale_rows = FALSE)
get_signatures(res, k = 4, scale_rows = FALSE)
get_signatures(res, k = 5, scale_rows = FALSE)
get_signatures(res, k = 6, scale_rows = FALSE)
Compare the overlap of signatures from different k:
compare_signatures(res)
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:
which_row
: row indices corresponding to the input matrix.fdr
: FDR for the differential test. mean_x
: The mean value in group x.scaled_mean_x
: The mean value in group x after rows are scaled.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")
dimension_reduction(res, k = 3, method = "UMAP")
dimension_reduction(res, k = 4, method = "UMAP")
dimension_reduction(res, k = 5, method = "UMAP")
dimension_reduction(res, k = 6, method = "UMAP")
Following heatmap shows how subgroups are split when increasing k
:
collect_classes(res)
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.
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