Date: 2019-12-25 23:22:04 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 16804 rows and 59 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] 16804 59
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.993 | 0.993 | ** | |
CV:hclust | 2 | 1.000 | 0.980 | 0.989 | ** | |
CV:pam | 2 | 1.000 | 0.981 | 0.993 | ** | |
ATC:kmeans | 2 | 1.000 | 0.983 | 0.991 | ** | |
ATC:skmeans | 2 | 1.000 | 0.996 | 0.998 | ** | |
ATC:pam | 6 | 0.982 | 0.927 | 0.971 | ** | 4,5 |
CV:NMF | 5 | 0.929 | 0.914 | 0.959 | * | |
SD:mclust | 4 | 0.908 | 0.926 | 0.949 | * | |
ATC:NMF | 2 | 0.895 | 0.908 | 0.964 | ||
SD:NMF | 4 | 0.893 | 0.869 | 0.952 | ||
MAD:NMF | 4 | 0.845 | 0.844 | 0.936 | ||
MAD:pam | 4 | 0.781 | 0.836 | 0.923 | ||
CV:skmeans | 3 | 0.755 | 0.828 | 0.914 | ||
SD:skmeans | 4 | 0.753 | 0.824 | 0.911 | ||
ATC:hclust | 4 | 0.742 | 0.845 | 0.909 | ||
MAD:skmeans | 3 | 0.705 | 0.828 | 0.904 | ||
SD:pam | 4 | 0.683 | 0.747 | 0.878 | ||
SD:kmeans | 4 | 0.665 | 0.745 | 0.856 | ||
MAD:hclust | 5 | 0.654 | 0.750 | 0.838 | ||
MAD:kmeans | 4 | 0.610 | 0.719 | 0.838 | ||
CV:mclust | 3 | 0.563 | 0.765 | 0.885 | ||
CV:kmeans | 3 | 0.546 | 0.833 | 0.885 | ||
ATC:mclust | 3 | 0.494 | 0.838 | 0.867 | ||
MAD:mclust | 3 | 0.414 | 0.743 | 0.865 |
**: 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.533 0.863 0.917 0.299 0.762 0.762
#> CV:NMF 2 0.366 0.834 0.891 0.326 0.737 0.737
#> MAD:NMF 2 0.248 0.706 0.813 0.450 0.492 0.492
#> ATC:NMF 2 0.895 0.908 0.964 0.477 0.524 0.524
#> SD:skmeans 2 0.481 0.515 0.792 0.505 0.495 0.495
#> CV:skmeans 2 0.287 0.671 0.818 0.500 0.499 0.499
#> MAD:skmeans 2 0.574 0.736 0.868 0.506 0.492 0.492
#> ATC:skmeans 2 1.000 0.996 0.998 0.509 0.492 0.492
#> SD:mclust 2 0.592 0.808 0.908 0.317 0.737 0.737
#> CV:mclust 2 0.862 0.891 0.952 0.280 0.737 0.737
#> MAD:mclust 2 0.553 0.717 0.873 0.340 0.814 0.814
#> ATC:mclust 2 0.240 0.635 0.741 0.385 0.516 0.516
#> SD:kmeans 2 0.162 0.444 0.680 0.398 0.650 0.650
#> CV:kmeans 2 0.207 0.625 0.747 0.380 0.544 0.544
#> MAD:kmeans 2 0.138 0.597 0.746 0.444 0.492 0.492
#> ATC:kmeans 2 1.000 0.983 0.991 0.506 0.493 0.493
#> SD:pam 2 0.299 0.795 0.861 0.264 0.814 0.814
#> CV:pam 2 1.000 0.981 0.993 0.198 0.814 0.814
#> MAD:pam 2 0.260 0.452 0.808 0.317 0.787 0.787
#> ATC:pam 2 0.769 0.787 0.909 0.473 0.493 0.493
#> SD:hclust 2 1.000 0.993 0.993 0.192 0.814 0.814
#> CV:hclust 2 1.000 0.980 0.989 0.200 0.814 0.814
#> MAD:hclust 2 0.634 0.823 0.911 0.289 0.814 0.814
#> ATC:hclust 2 0.681 0.916 0.943 0.367 0.670 0.670
get_stats(res_list, k = 3)
#> k 1-PAC mean_silhouette concordance area_increased Rand Jaccard
#> SD:NMF 3 0.496 0.611 0.792 0.974 0.645 0.533
#> CV:NMF 3 0.882 0.910 0.964 0.834 0.627 0.506
#> MAD:NMF 3 0.451 0.514 0.789 0.344 0.735 0.531
#> ATC:NMF 3 0.645 0.796 0.884 0.226 0.861 0.745
#> SD:skmeans 3 0.654 0.597 0.842 0.309 0.709 0.479
#> CV:skmeans 3 0.755 0.828 0.914 0.300 0.761 0.564
#> MAD:skmeans 3 0.705 0.828 0.904 0.319 0.705 0.469
#> ATC:skmeans 3 0.847 0.957 0.945 0.228 0.861 0.721
#> SD:mclust 3 0.509 0.679 0.852 0.784 0.583 0.464
#> CV:mclust 3 0.563 0.765 0.885 1.069 0.580 0.463
#> MAD:mclust 3 0.414 0.743 0.865 0.630 0.590 0.496
#> ATC:mclust 3 0.494 0.838 0.867 0.554 0.534 0.329
#> SD:kmeans 3 0.437 0.666 0.819 0.397 0.656 0.514
#> CV:kmeans 3 0.546 0.833 0.885 0.438 0.951 0.910
#> MAD:kmeans 3 0.354 0.560 0.761 0.323 0.617 0.384
#> ATC:kmeans 3 0.899 0.877 0.936 0.275 0.688 0.459
#> SD:pam 3 0.471 0.530 0.797 1.063 0.612 0.531
#> CV:pam 3 0.800 0.857 0.942 1.894 0.614 0.526
#> MAD:pam 3 0.497 0.700 0.847 0.745 0.569 0.482
#> ATC:pam 3 0.782 0.926 0.959 0.342 0.835 0.678
#> SD:hclust 3 0.467 0.712 0.855 1.808 0.622 0.536
#> CV:hclust 3 0.440 0.807 0.877 1.574 0.681 0.608
#> MAD:hclust 3 0.502 0.748 0.882 0.728 0.712 0.647
#> ATC:hclust 3 0.618 0.825 0.916 0.708 0.695 0.545
get_stats(res_list, k = 4)
#> k 1-PAC mean_silhouette concordance area_increased Rand Jaccard
#> SD:NMF 4 0.893 0.869 0.952 0.229 0.781 0.510
#> CV:NMF 4 0.786 0.810 0.919 0.205 0.813 0.566
#> MAD:NMF 4 0.845 0.844 0.936 0.206 0.771 0.473
#> ATC:NMF 4 0.650 0.774 0.874 0.227 0.732 0.450
#> SD:skmeans 4 0.753 0.824 0.911 0.123 0.810 0.510
#> CV:skmeans 4 0.762 0.602 0.811 0.135 0.818 0.558
#> MAD:skmeans 4 0.751 0.825 0.919 0.114 0.845 0.575
#> ATC:skmeans 4 0.803 0.534 0.826 0.125 0.930 0.808
#> SD:mclust 4 0.908 0.926 0.949 0.150 0.795 0.576
#> CV:mclust 4 0.588 0.749 0.870 0.174 0.783 0.536
#> MAD:mclust 4 0.519 0.705 0.846 0.198 0.815 0.603
#> ATC:mclust 4 0.511 0.641 0.778 0.165 0.664 0.347
#> SD:kmeans 4 0.665 0.745 0.856 0.259 0.843 0.649
#> CV:kmeans 4 0.621 0.670 0.824 0.271 0.820 0.636
#> MAD:kmeans 4 0.610 0.719 0.838 0.206 0.838 0.607
#> ATC:kmeans 4 0.728 0.704 0.815 0.122 0.839 0.595
#> SD:pam 4 0.683 0.747 0.878 0.290 0.733 0.482
#> CV:pam 4 0.603 0.662 0.853 0.244 0.793 0.551
#> MAD:pam 4 0.781 0.836 0.923 0.278 0.712 0.435
#> ATC:pam 4 0.918 0.899 0.961 0.142 0.919 0.779
#> SD:hclust 4 0.528 0.658 0.806 0.248 0.854 0.682
#> CV:hclust 4 0.542 0.639 0.841 0.292 0.842 0.681
#> MAD:hclust 4 0.516 0.731 0.864 0.306 0.785 0.611
#> ATC:hclust 4 0.742 0.845 0.909 0.193 0.842 0.587
get_stats(res_list, k = 5)
#> k 1-PAC mean_silhouette concordance area_increased Rand Jaccard
#> SD:NMF 5 0.778 0.762 0.874 0.0877 0.852 0.524
#> CV:NMF 5 0.929 0.914 0.959 0.1029 0.808 0.427
#> MAD:NMF 5 0.657 0.707 0.843 0.0825 0.894 0.635
#> ATC:NMF 5 0.585 0.610 0.785 0.0907 0.880 0.613
#> SD:skmeans 5 0.723 0.675 0.827 0.0773 0.881 0.586
#> CV:skmeans 5 0.808 0.777 0.888 0.0885 0.853 0.528
#> MAD:skmeans 5 0.710 0.691 0.828 0.0712 0.942 0.775
#> ATC:skmeans 5 0.786 0.798 0.860 0.0589 0.860 0.582
#> SD:mclust 5 0.790 0.852 0.908 0.0835 0.960 0.889
#> CV:mclust 5 0.634 0.754 0.811 0.0790 0.973 0.915
#> MAD:mclust 5 0.719 0.764 0.861 0.0827 0.915 0.767
#> ATC:mclust 5 0.538 0.499 0.718 0.0857 0.853 0.576
#> SD:kmeans 5 0.663 0.598 0.783 0.1111 0.877 0.624
#> CV:kmeans 5 0.654 0.686 0.819 0.1161 0.863 0.595
#> MAD:kmeans 5 0.620 0.501 0.694 0.0978 0.852 0.568
#> ATC:kmeans 5 0.713 0.765 0.807 0.0823 0.865 0.567
#> SD:pam 5 0.672 0.651 0.803 0.1145 0.916 0.728
#> CV:pam 5 0.768 0.763 0.882 0.1093 0.859 0.552
#> MAD:pam 5 0.704 0.653 0.850 0.1257 0.865 0.567
#> ATC:pam 5 0.901 0.837 0.906 0.0824 0.921 0.730
#> SD:hclust 5 0.627 0.658 0.778 0.1257 0.881 0.666
#> CV:hclust 5 0.544 0.568 0.759 0.1167 0.897 0.695
#> MAD:hclust 5 0.654 0.750 0.838 0.1340 0.877 0.677
#> ATC:hclust 5 0.781 0.793 0.884 0.0502 0.974 0.893
get_stats(res_list, k = 6)
#> k 1-PAC mean_silhouette concordance area_increased Rand Jaccard
#> SD:NMF 6 0.762 0.578 0.783 0.0476 0.918 0.646
#> CV:NMF 6 0.791 0.749 0.867 0.0431 0.949 0.758
#> MAD:NMF 6 0.702 0.593 0.783 0.0493 0.951 0.780
#> ATC:NMF 6 0.709 0.623 0.795 0.0478 0.887 0.556
#> SD:skmeans 6 0.741 0.612 0.806 0.0463 0.918 0.625
#> CV:skmeans 6 0.749 0.602 0.802 0.0409 0.934 0.691
#> MAD:skmeans 6 0.760 0.722 0.850 0.0475 0.905 0.597
#> ATC:skmeans 6 0.759 0.822 0.886 0.0466 0.959 0.833
#> SD:mclust 6 0.829 0.843 0.906 0.1291 0.867 0.603
#> CV:mclust 6 0.645 0.722 0.831 0.0908 0.847 0.508
#> MAD:mclust 6 0.813 0.731 0.879 0.0999 0.867 0.590
#> ATC:mclust 6 0.695 0.674 0.793 0.0795 0.809 0.386
#> SD:kmeans 6 0.678 0.515 0.720 0.0578 0.836 0.397
#> CV:kmeans 6 0.677 0.613 0.755 0.0634 0.894 0.574
#> MAD:kmeans 6 0.689 0.587 0.769 0.0607 0.863 0.498
#> ATC:kmeans 6 0.744 0.720 0.791 0.0468 0.985 0.927
#> SD:pam 6 0.741 0.647 0.784 0.0539 0.928 0.706
#> CV:pam 6 0.779 0.721 0.824 0.0325 0.891 0.566
#> MAD:pam 6 0.769 0.729 0.827 0.0469 0.917 0.631
#> ATC:pam 6 0.982 0.927 0.971 0.0567 0.923 0.672
#> SD:hclust 6 0.668 0.479 0.658 0.0624 0.916 0.674
#> CV:hclust 6 0.613 0.557 0.741 0.0555 0.924 0.718
#> MAD:hclust 6 0.671 0.701 0.758 0.1046 0.884 0.586
#> ATC:hclust 6 0.821 0.733 0.841 0.0348 1.000 1.000
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 16804 rows and 59 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.993 0.993 0.1915 0.814 0.814
#> 3 3 0.467 0.712 0.855 1.8080 0.622 0.536
#> 4 4 0.528 0.658 0.806 0.2481 0.854 0.682
#> 5 5 0.627 0.658 0.778 0.1257 0.881 0.666
#> 6 6 0.668 0.479 0.658 0.0624 0.916 0.674
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
#> SRR542346 2 0.000 0.993 0.000 1.000
#> SRR542347 2 0.000 0.993 0.000 1.000
#> SRR542348 2 0.000 0.993 0.000 1.000
#> SRR542349 2 0.000 0.993 0.000 1.000
#> SRR542350 2 0.000 0.993 0.000 1.000
#> SRR542351 2 0.000 0.993 0.000 1.000
#> SRR542352 2 0.000 0.993 0.000 1.000
#> SRR542353 2 0.000 0.993 0.000 1.000
#> SRR542354 2 0.000 0.993 0.000 1.000
#> SRR542355 2 0.118 0.991 0.016 0.984
#> SRR542356 2 0.000 0.993 0.000 1.000
#> SRR542357 2 0.118 0.991 0.016 0.984
#> SRR542358 2 0.000 0.993 0.000 1.000
#> SRR542359 2 0.000 0.993 0.000 1.000
#> SRR542360 2 0.118 0.991 0.016 0.984
#> SRR542361 2 0.118 0.991 0.016 0.984
#> SRR542362 2 0.118 0.991 0.016 0.984
#> SRR542363 2 0.118 0.991 0.016 0.984
#> SRR542364 2 0.000 0.993 0.000 1.000
#> SRR542365 2 0.000 0.993 0.000 1.000
#> SRR542366 2 0.000 0.993 0.000 1.000
#> SRR542367 2 0.000 0.993 0.000 1.000
#> SRR542368 2 0.000 0.993 0.000 1.000
#> SRR542369 2 0.000 0.993 0.000 1.000
#> SRR542370 2 0.000 0.993 0.000 1.000
#> SRR542371 2 0.118 0.991 0.016 0.984
#> SRR542372 2 0.118 0.991 0.016 0.984
#> SRR542373 2 0.118 0.991 0.016 0.984
#> SRR542374 2 0.000 0.993 0.000 1.000
#> SRR542375 2 0.118 0.991 0.016 0.984
#> SRR542376 2 0.118 0.991 0.016 0.984
#> SRR542377 2 0.118 0.991 0.016 0.984
#> SRR542378 2 0.118 0.991 0.016 0.984
#> SRR542379 2 0.118 0.991 0.016 0.984
#> SRR542380 2 0.118 0.991 0.016 0.984
#> SRR542381 2 0.118 0.991 0.016 0.984
#> SRR542382 2 0.118 0.991 0.016 0.984
#> SRR542383 2 0.118 0.991 0.016 0.984
#> SRR542384 2 0.118 0.991 0.016 0.984
#> SRR542385 2 0.000 0.993 0.000 1.000
#> SRR542386 2 0.000 0.993 0.000 1.000
#> SRR542387 2 0.118 0.991 0.016 0.984
#> SRR542388 2 0.000 0.993 0.000 1.000
#> SRR542389 2 0.000 0.993 0.000 1.000
#> SRR542390 2 0.000 0.993 0.000 1.000
#> SRR542391 2 0.000 0.993 0.000 1.000
#> SRR542392 2 0.000 0.993 0.000 1.000
#> SRR542393 2 0.000 0.993 0.000 1.000
#> SRR542394 2 0.118 0.991 0.016 0.984
#> SRR542395 2 0.118 0.991 0.016 0.984
#> SRR542396 2 0.118 0.991 0.016 0.984
#> SRR542397 2 0.000 0.993 0.000 1.000
#> SRR542398 2 0.118 0.991 0.016 0.984
#> SRR542399 1 0.000 1.000 1.000 0.000
#> SRR542400 1 0.000 1.000 1.000 0.000
#> SRR542401 1 0.000 1.000 1.000 0.000
#> SRR542402 1 0.000 1.000 1.000 0.000
#> SRR542403 1 0.000 1.000 1.000 0.000
#> SRR542404 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
#> SRR542346 3 0.1964 0.615 0 0.056 0.944
#> SRR542347 3 0.1964 0.615 0 0.056 0.944
#> SRR542348 3 0.1964 0.615 0 0.056 0.944
#> SRR542349 3 0.1964 0.615 0 0.056 0.944
#> SRR542350 3 0.6286 0.332 0 0.464 0.536
#> SRR542351 3 0.4887 0.676 0 0.228 0.772
#> SRR542352 2 0.5465 0.402 0 0.712 0.288
#> SRR542353 3 0.6286 0.332 0 0.464 0.536
#> SRR542354 3 0.4887 0.676 0 0.228 0.772
#> SRR542355 3 0.5760 0.595 0 0.328 0.672
#> SRR542356 3 0.4887 0.676 0 0.228 0.772
#> SRR542357 3 0.6291 0.304 0 0.468 0.532
#> SRR542358 2 0.5465 0.402 0 0.712 0.288
#> SRR542359 3 0.4887 0.676 0 0.228 0.772
#> SRR542360 2 0.3267 0.802 0 0.884 0.116
#> SRR542361 3 0.5733 0.529 0 0.324 0.676
#> SRR542362 3 0.5733 0.529 0 0.324 0.676
#> SRR542363 3 0.5760 0.525 0 0.328 0.672
#> SRR542364 2 0.2356 0.819 0 0.928 0.072
#> SRR542365 2 0.0000 0.863 0 1.000 0.000
#> SRR542366 2 0.0592 0.862 0 0.988 0.012
#> SRR542367 2 0.0000 0.863 0 1.000 0.000
#> SRR542368 2 0.0592 0.861 0 0.988 0.012
#> SRR542369 2 0.0424 0.862 0 0.992 0.008
#> SRR542370 2 0.0424 0.862 0 0.992 0.008
#> SRR542371 2 0.0747 0.859 0 0.984 0.016
#> SRR542372 2 0.0747 0.859 0 0.984 0.016
#> SRR542373 2 0.3267 0.802 0 0.884 0.116
#> SRR542374 3 0.4887 0.676 0 0.228 0.772
#> SRR542375 2 0.2261 0.831 0 0.932 0.068
#> SRR542376 3 0.5760 0.525 0 0.328 0.672
#> SRR542377 3 0.5760 0.525 0 0.328 0.672
#> SRR542378 2 0.6140 0.228 0 0.596 0.404
#> SRR542379 3 0.5760 0.525 0 0.328 0.672
#> SRR542380 2 0.6140 0.228 0 0.596 0.404
#> SRR542381 2 0.2261 0.831 0 0.932 0.068
#> SRR542382 2 0.6140 0.228 0 0.596 0.404
#> SRR542383 2 0.6140 0.228 0 0.596 0.404
#> SRR542384 2 0.2261 0.831 0 0.932 0.068
#> SRR542385 2 0.0237 0.863 0 0.996 0.004
#> SRR542386 2 0.0000 0.863 0 1.000 0.000
#> SRR542387 2 0.2066 0.854 0 0.940 0.060
#> SRR542388 2 0.0000 0.863 0 1.000 0.000
#> SRR542389 2 0.1031 0.854 0 0.976 0.024
#> SRR542390 2 0.0237 0.863 0 0.996 0.004
#> SRR542391 2 0.1964 0.828 0 0.944 0.056
#> SRR542392 2 0.0000 0.863 0 1.000 0.000
#> SRR542393 2 0.1964 0.828 0 0.944 0.056
#> SRR542394 2 0.1860 0.856 0 0.948 0.052
#> SRR542395 2 0.2066 0.854 0 0.940 0.060
#> SRR542396 2 0.2261 0.831 0 0.932 0.068
#> SRR542397 2 0.0892 0.856 0 0.980 0.020
#> SRR542398 2 0.1964 0.834 0 0.944 0.056
#> SRR542399 1 0.0000 1.000 1 0.000 0.000
#> SRR542400 1 0.0000 1.000 1 0.000 0.000
#> SRR542401 1 0.0000 1.000 1 0.000 0.000
#> SRR542402 1 0.0000 1.000 1 0.000 0.000
#> SRR542403 1 0.0000 1.000 1 0.000 0.000
#> SRR542404 1 0.0000 1.000 1 0.000 0.000
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> SRR542346 4 0.499 0.129 0 0.000 0.480 0.520
#> SRR542347 4 0.499 0.129 0 0.000 0.480 0.520
#> SRR542348 4 0.499 0.129 0 0.000 0.480 0.520
#> SRR542349 4 0.499 0.129 0 0.000 0.480 0.520
#> SRR542350 3 0.540 0.465 0 0.372 0.608 0.020
#> SRR542351 3 0.202 0.698 0 0.040 0.936 0.024
#> SRR542352 2 0.533 0.352 0 0.644 0.332 0.024
#> SRR542353 3 0.540 0.465 0 0.372 0.608 0.020
#> SRR542354 3 0.429 0.629 0 0.052 0.812 0.136
#> SRR542355 3 0.645 0.600 0 0.204 0.644 0.152
#> SRR542356 3 0.236 0.698 0 0.056 0.920 0.024
#> SRR542357 3 0.571 0.505 0 0.340 0.620 0.040
#> SRR542358 2 0.531 0.329 0 0.632 0.348 0.020
#> SRR542359 3 0.202 0.698 0 0.040 0.936 0.024
#> SRR542360 2 0.453 0.738 0 0.800 0.132 0.068
#> SRR542361 4 0.172 0.659 0 0.020 0.032 0.948
#> SRR542362 4 0.172 0.659 0 0.020 0.032 0.948
#> SRR542363 4 0.183 0.660 0 0.024 0.032 0.944
#> SRR542364 2 0.373 0.757 0 0.844 0.120 0.036
#> SRR542365 2 0.177 0.808 0 0.944 0.012 0.044
#> SRR542366 2 0.267 0.805 0 0.908 0.052 0.040
#> SRR542367 2 0.211 0.809 0 0.932 0.024 0.044
#> SRR542368 2 0.317 0.789 0 0.884 0.060 0.056
#> SRR542369 2 0.212 0.809 0 0.932 0.028 0.040
#> SRR542370 2 0.202 0.809 0 0.936 0.024 0.040
#> SRR542371 2 0.244 0.808 0 0.916 0.024 0.060
#> SRR542372 2 0.244 0.808 0 0.916 0.024 0.060
#> SRR542373 2 0.453 0.738 0 0.800 0.132 0.068
#> SRR542374 3 0.202 0.698 0 0.040 0.936 0.024
#> SRR542375 2 0.677 0.422 0 0.516 0.100 0.384
#> SRR542376 4 0.183 0.660 0 0.024 0.032 0.944
#> SRR542377 4 0.183 0.660 0 0.024 0.032 0.944
#> SRR542378 4 0.454 0.457 0 0.272 0.008 0.720
#> SRR542379 4 0.183 0.660 0 0.024 0.032 0.944
#> SRR542380 4 0.454 0.457 0 0.272 0.008 0.720
#> SRR542381 2 0.677 0.422 0 0.516 0.100 0.384
#> SRR542382 4 0.454 0.457 0 0.272 0.008 0.720
#> SRR542383 4 0.454 0.457 0 0.272 0.008 0.720
#> SRR542384 2 0.677 0.422 0 0.516 0.100 0.384
#> SRR542385 2 0.258 0.807 0 0.912 0.036 0.052
#> SRR542386 2 0.236 0.810 0 0.920 0.024 0.056
#> SRR542387 2 0.419 0.768 0 0.824 0.112 0.064
#> SRR542388 2 0.236 0.810 0 0.920 0.024 0.056
#> SRR542389 2 0.348 0.764 0 0.856 0.116 0.028
#> SRR542390 2 0.301 0.804 0 0.892 0.056 0.052
#> SRR542391 2 0.376 0.741 0 0.844 0.116 0.040
#> SRR542392 2 0.226 0.810 0 0.924 0.020 0.056
#> SRR542393 2 0.292 0.775 0 0.896 0.060 0.044
#> SRR542394 2 0.308 0.801 0 0.888 0.048 0.064
#> SRR542395 2 0.430 0.764 0 0.816 0.120 0.064
#> SRR542396 2 0.646 0.434 0 0.540 0.076 0.384
#> SRR542397 2 0.264 0.789 0 0.908 0.060 0.032
#> SRR542398 2 0.569 0.583 0 0.648 0.048 0.304
#> SRR542399 1 0.000 1.000 1 0.000 0.000 0.000
#> SRR542400 1 0.000 1.000 1 0.000 0.000 0.000
#> SRR542401 1 0.000 1.000 1 0.000 0.000 0.000
#> SRR542402 1 0.000 1.000 1 0.000 0.000 0.000
#> SRR542403 1 0.000 1.000 1 0.000 0.000 0.000
#> SRR542404 1 0.000 1.000 1 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
#> SRR542346 4 0.000 0.486 0 0.000 0.000 1.000 0.000
#> SRR542347 4 0.000 0.486 0 0.000 0.000 1.000 0.000
#> SRR542348 4 0.000 0.486 0 0.000 0.000 1.000 0.000
#> SRR542349 4 0.000 0.486 0 0.000 0.000 1.000 0.000
#> SRR542350 3 0.725 0.479 0 0.316 0.436 0.216 0.032
#> SRR542351 3 0.560 0.619 0 0.000 0.520 0.404 0.076
#> SRR542352 2 0.649 0.264 0 0.588 0.208 0.176 0.028
#> SRR542353 3 0.725 0.479 0 0.316 0.436 0.216 0.032
#> SRR542354 4 0.563 -0.606 0 0.056 0.424 0.512 0.008
#> SRR542355 3 0.659 0.537 0 0.180 0.436 0.380 0.004
#> SRR542356 3 0.583 0.629 0 0.048 0.528 0.400 0.024
#> SRR542357 3 0.681 0.466 0 0.316 0.428 0.252 0.004
#> SRR542358 2 0.657 0.243 0 0.576 0.220 0.176 0.028
#> SRR542359 3 0.560 0.619 0 0.000 0.520 0.404 0.076
#> SRR542360 2 0.604 0.541 0 0.556 0.152 0.000 0.292
#> SRR542361 4 0.611 0.613 0 0.000 0.280 0.552 0.168
#> SRR542362 4 0.611 0.613 0 0.000 0.280 0.552 0.168
#> SRR542363 4 0.614 0.612 0 0.000 0.280 0.548 0.172
#> SRR542364 2 0.561 0.593 0 0.604 0.108 0.000 0.288
#> SRR542365 2 0.120 0.804 0 0.952 0.000 0.000 0.048
#> SRR542366 2 0.277 0.786 0 0.868 0.020 0.000 0.112
#> SRR542367 2 0.202 0.799 0 0.912 0.008 0.000 0.080
#> SRR542368 2 0.458 0.645 0 0.712 0.052 0.000 0.236
#> SRR542369 2 0.201 0.802 0 0.916 0.012 0.000 0.072
#> SRR542370 2 0.213 0.801 0 0.908 0.012 0.000 0.080
#> SRR542371 2 0.242 0.796 0 0.896 0.024 0.000 0.080
#> SRR542372 2 0.242 0.796 0 0.896 0.024 0.000 0.080
#> SRR542373 2 0.604 0.541 0 0.556 0.152 0.000 0.292
#> SRR542374 3 0.560 0.619 0 0.000 0.520 0.404 0.076
#> SRR542375 5 0.207 0.722 0 0.076 0.012 0.000 0.912
#> SRR542376 4 0.614 0.612 0 0.000 0.280 0.548 0.172
#> SRR542377 4 0.614 0.612 0 0.000 0.280 0.548 0.172
#> SRR542378 5 0.486 0.582 0 0.012 0.036 0.264 0.688
#> SRR542379 4 0.614 0.612 0 0.000 0.280 0.548 0.172
#> SRR542380 5 0.486 0.582 0 0.012 0.036 0.264 0.688
#> SRR542381 5 0.207 0.722 0 0.076 0.012 0.000 0.912
#> SRR542382 5 0.486 0.582 0 0.012 0.036 0.264 0.688
#> SRR542383 5 0.486 0.582 0 0.012 0.036 0.264 0.688
#> SRR542384 5 0.207 0.722 0 0.076 0.012 0.000 0.912
#> SRR542385 2 0.199 0.798 0 0.924 0.032 0.000 0.044
#> SRR542386 2 0.188 0.803 0 0.924 0.012 0.000 0.064
#> SRR542387 2 0.385 0.754 0 0.800 0.144 0.000 0.056
#> SRR542388 2 0.188 0.803 0 0.924 0.012 0.000 0.064
#> SRR542389 2 0.369 0.727 0 0.812 0.136 0.000 0.052
#> SRR542390 2 0.238 0.795 0 0.904 0.052 0.000 0.044
#> SRR542391 2 0.398 0.709 0 0.784 0.164 0.000 0.052
#> SRR542392 2 0.194 0.803 0 0.920 0.012 0.000 0.068
#> SRR542393 2 0.362 0.752 0 0.820 0.124 0.000 0.056
#> SRR542394 2 0.348 0.788 0 0.836 0.080 0.000 0.084
#> SRR542395 2 0.382 0.750 0 0.800 0.148 0.000 0.052
#> SRR542396 5 0.225 0.715 0 0.096 0.008 0.000 0.896
#> SRR542397 2 0.278 0.769 0 0.880 0.072 0.000 0.048
#> SRR542398 5 0.455 0.510 0 0.264 0.040 0.000 0.696
#> SRR542399 1 0.000 1.000 1 0.000 0.000 0.000 0.000
#> SRR542400 1 0.000 1.000 1 0.000 0.000 0.000 0.000
#> SRR542401 1 0.000 1.000 1 0.000 0.000 0.000 0.000
#> SRR542402 1 0.000 1.000 1 0.000 0.000 0.000 0.000
#> SRR542403 1 0.000 1.000 1 0.000 0.000 0.000 0.000
#> SRR542404 1 0.000 1.000 1 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
#> SRR542346 4 0.6910 0.4377 0 0.208 0.312 0.412 0.068 0.000
#> SRR542347 4 0.6910 0.4377 0 0.208 0.312 0.412 0.068 0.000
#> SRR542348 4 0.6910 0.4377 0 0.208 0.312 0.412 0.068 0.000
#> SRR542349 4 0.6910 0.4377 0 0.208 0.312 0.412 0.068 0.000
#> SRR542350 3 0.6375 0.2130 0 0.320 0.456 0.000 0.028 0.196
#> SRR542351 3 0.0547 0.6615 0 0.000 0.980 0.000 0.020 0.000
#> SRR542352 2 0.6396 0.4962 0 0.392 0.200 0.000 0.024 0.384
#> SRR542353 3 0.6375 0.2130 0 0.320 0.456 0.000 0.028 0.196
#> SRR542354 3 0.4067 0.6379 0 0.200 0.748 0.024 0.000 0.028
#> SRR542355 3 0.5246 0.5801 0 0.364 0.564 0.024 0.004 0.044
#> SRR542356 3 0.2034 0.6830 0 0.060 0.912 0.000 0.004 0.024
#> SRR542357 3 0.5746 0.3644 0 0.300 0.536 0.004 0.004 0.156
#> SRR542358 2 0.6433 0.4942 0 0.412 0.196 0.000 0.028 0.364
#> SRR542359 3 0.0547 0.6615 0 0.000 0.980 0.000 0.020 0.000
#> SRR542360 6 0.5683 0.2813 0 0.072 0.036 0.000 0.376 0.516
#> SRR542361 4 0.0000 0.6417 0 0.000 0.000 1.000 0.000 0.000
#> SRR542362 4 0.0000 0.6417 0 0.000 0.000 1.000 0.000 0.000
#> SRR542363 4 0.1074 0.6366 0 0.028 0.000 0.960 0.012 0.000
#> SRR542364 6 0.5463 0.3056 0 0.092 0.024 0.000 0.292 0.592
#> SRR542365 6 0.1349 0.4316 0 0.056 0.004 0.000 0.000 0.940
#> SRR542366 6 0.1346 0.4629 0 0.008 0.024 0.000 0.016 0.952
#> SRR542367 6 0.1232 0.4615 0 0.024 0.004 0.000 0.016 0.956
#> SRR542368 6 0.4213 0.3871 0 0.120 0.020 0.000 0.092 0.768
#> SRR542369 6 0.0972 0.4563 0 0.028 0.008 0.000 0.000 0.964
#> SRR542370 6 0.0806 0.4604 0 0.020 0.008 0.000 0.000 0.972
#> SRR542371 6 0.1738 0.4542 0 0.052 0.004 0.000 0.016 0.928
#> SRR542372 6 0.1738 0.4542 0 0.052 0.004 0.000 0.016 0.928
#> SRR542373 6 0.5683 0.2813 0 0.072 0.036 0.000 0.376 0.516
#> SRR542374 3 0.0547 0.6615 0 0.000 0.980 0.000 0.020 0.000
#> SRR542375 5 0.2934 0.7086 0 0.000 0.000 0.112 0.844 0.044
#> SRR542376 4 0.0260 0.6377 0 0.000 0.000 0.992 0.008 0.000
#> SRR542377 4 0.0820 0.6190 0 0.016 0.000 0.972 0.012 0.000
#> SRR542378 5 0.4212 0.6102 0 0.016 0.000 0.424 0.560 0.000
#> SRR542379 4 0.0260 0.6377 0 0.000 0.000 0.992 0.008 0.000
#> SRR542380 5 0.4212 0.6102 0 0.016 0.000 0.424 0.560 0.000
#> SRR542381 5 0.2934 0.7086 0 0.000 0.000 0.112 0.844 0.044
#> SRR542382 5 0.4212 0.6102 0 0.016 0.000 0.424 0.560 0.000
#> SRR542383 5 0.4212 0.6102 0 0.016 0.000 0.424 0.560 0.000
#> SRR542384 5 0.2934 0.7086 0 0.000 0.000 0.112 0.844 0.044
#> SRR542385 6 0.3756 -0.3226 0 0.400 0.000 0.000 0.000 0.600
#> SRR542386 6 0.3804 -0.0515 0 0.336 0.008 0.000 0.000 0.656
#> SRR542387 2 0.5193 0.5090 0 0.468 0.036 0.000 0.028 0.468
#> SRR542388 6 0.3789 -0.0556 0 0.332 0.008 0.000 0.000 0.660
#> SRR542389 2 0.3950 0.6151 0 0.564 0.000 0.000 0.004 0.432
#> SRR542390 6 0.3797 -0.3733 0 0.420 0.000 0.000 0.000 0.580
#> SRR542391 2 0.4403 0.6206 0 0.564 0.000 0.000 0.028 0.408
#> SRR542392 6 0.3789 -0.0439 0 0.332 0.008 0.000 0.000 0.660
#> SRR542393 2 0.4403 0.5728 0 0.508 0.000 0.000 0.024 0.468
#> SRR542394 6 0.4687 -0.4358 0 0.424 0.004 0.000 0.036 0.536
#> SRR542395 2 0.5192 0.5207 0 0.476 0.036 0.000 0.028 0.460
#> SRR542396 5 0.4376 0.6971 0 0.028 0.000 0.112 0.760 0.100
#> SRR542397 6 0.3998 -0.5843 0 0.492 0.004 0.000 0.000 0.504
#> SRR542398 5 0.5421 0.3755 0 0.124 0.004 0.000 0.556 0.316
#> SRR542399 1 0.0000 1.0000 1 0.000 0.000 0.000 0.000 0.000
#> SRR542400 1 0.0000 1.0000 1 0.000 0.000 0.000 0.000 0.000
#> SRR542401 1 0.0000 1.0000 1 0.000 0.000 0.000 0.000 0.000
#> SRR542402 1 0.0000 1.0000 1 0.000 0.000 0.000 0.000 0.000
#> SRR542403 1 0.0000 1.0000 1 0.000 0.000 0.000 0.000 0.000
#> SRR542404 1 0.0000 1.0000 1 0.000 0.000 0.000 0.000 0.000
Heatmaps for the consensus matrix. It visualizes the probability of two samples to be in a same group.
consensus_heatmap(res, k = 2)
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", "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 16804 rows and 59 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 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.162 0.444 0.680 0.3983 0.650 0.650
#> 3 3 0.437 0.666 0.819 0.3965 0.656 0.514
#> 4 4 0.665 0.745 0.856 0.2594 0.843 0.649
#> 5 5 0.663 0.598 0.783 0.1111 0.877 0.624
#> 6 6 0.678 0.515 0.720 0.0578 0.836 0.397
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
#> SRR542346 2 0.9286 -0.0310 0.344 0.656
#> SRR542347 2 0.9286 -0.0310 0.344 0.656
#> SRR542348 2 0.9286 -0.0310 0.344 0.656
#> SRR542349 2 0.9286 -0.0310 0.344 0.656
#> SRR542350 2 0.5842 0.5202 0.140 0.860
#> SRR542351 2 0.2603 0.4915 0.044 0.956
#> SRR542352 2 0.6148 0.5514 0.152 0.848
#> SRR542353 2 0.5842 0.5202 0.140 0.860
#> SRR542354 2 0.2603 0.4915 0.044 0.956
#> SRR542355 2 0.1633 0.4963 0.024 0.976
#> SRR542356 2 0.2043 0.5000 0.032 0.968
#> SRR542357 2 0.0000 0.5145 0.000 1.000
#> SRR542358 2 0.6531 0.5434 0.168 0.832
#> SRR542359 2 0.3584 0.5051 0.068 0.932
#> SRR542360 2 0.4431 0.4129 0.092 0.908
#> SRR542361 2 0.9970 -0.2905 0.468 0.532
#> SRR542362 2 0.9970 -0.2905 0.468 0.532
#> SRR542363 2 0.9000 -0.0246 0.316 0.684
#> SRR542364 2 0.3114 0.5414 0.056 0.944
#> SRR542365 2 0.9087 0.5707 0.324 0.676
#> SRR542366 2 0.8608 0.5823 0.284 0.716
#> SRR542367 2 0.8813 0.5776 0.300 0.700
#> SRR542368 2 0.9580 0.5453 0.380 0.620
#> SRR542369 2 0.8813 0.5785 0.300 0.700
#> SRR542370 2 0.8909 0.5773 0.308 0.692
#> SRR542371 2 0.9170 0.5041 0.332 0.668
#> SRR542372 2 0.8763 0.5793 0.296 0.704
#> SRR542373 2 0.0672 0.5137 0.008 0.992
#> SRR542374 2 0.2603 0.4915 0.044 0.956
#> SRR542375 2 0.9732 0.2622 0.404 0.596
#> SRR542376 1 0.9944 0.4277 0.544 0.456
#> SRR542377 1 0.9815 0.4909 0.580 0.420
#> SRR542378 1 0.9552 0.5195 0.624 0.376
#> SRR542379 1 0.9815 0.4909 0.580 0.420
#> SRR542380 1 0.9552 0.5195 0.624 0.376
#> SRR542381 2 0.9522 0.3501 0.372 0.628
#> SRR542382 1 0.9522 0.5160 0.628 0.372
#> SRR542383 1 0.9552 0.5195 0.624 0.376
#> SRR542384 2 0.9552 0.4449 0.376 0.624
#> SRR542385 2 0.9710 0.4975 0.400 0.600
#> SRR542386 2 0.9815 0.4681 0.420 0.580
#> SRR542387 2 0.9248 0.5001 0.340 0.660
#> SRR542388 2 0.9358 0.5529 0.352 0.648
#> SRR542389 2 0.8909 0.5773 0.308 0.692
#> SRR542390 2 0.9286 0.5598 0.344 0.656
#> SRR542391 2 0.9286 0.5598 0.344 0.656
#> SRR542392 2 0.9815 0.4681 0.420 0.580
#> SRR542393 2 0.8909 0.5773 0.308 0.692
#> SRR542394 2 0.9580 0.5030 0.380 0.620
#> SRR542395 2 0.9286 0.5013 0.344 0.656
#> SRR542396 2 0.9732 0.4567 0.404 0.596
#> SRR542397 2 0.9286 0.5598 0.344 0.656
#> SRR542398 2 0.9983 0.3659 0.476 0.524
#> SRR542399 1 0.4161 0.6030 0.916 0.084
#> SRR542400 1 0.4161 0.6030 0.916 0.084
#> SRR542401 1 0.4161 0.6030 0.916 0.084
#> SRR542402 1 0.4161 0.6030 0.916 0.084
#> SRR542403 1 0.4161 0.6030 0.916 0.084
#> SRR542404 1 0.4161 0.6030 0.916 0.084
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> SRR542346 3 0.2116 0.4741 0.040 0.012 0.948
#> SRR542347 3 0.1999 0.4758 0.036 0.012 0.952
#> SRR542348 3 0.2116 0.4741 0.040 0.012 0.948
#> SRR542349 3 0.1999 0.4758 0.036 0.012 0.952
#> SRR542350 2 0.6410 0.2071 0.004 0.576 0.420
#> SRR542351 3 0.6247 0.2635 0.004 0.376 0.620
#> SRR542352 2 0.4409 0.6722 0.004 0.824 0.172
#> SRR542353 2 0.6410 0.2071 0.004 0.576 0.420
#> SRR542354 3 0.6314 0.2306 0.004 0.392 0.604
#> SRR542355 3 0.6291 0.0860 0.000 0.468 0.532
#> SRR542356 3 0.6520 -0.0561 0.004 0.488 0.508
#> SRR542357 2 0.5497 0.5228 0.000 0.708 0.292
#> SRR542358 2 0.4861 0.6551 0.012 0.808 0.180
#> SRR542359 3 0.6247 0.2635 0.004 0.376 0.620
#> SRR542360 3 0.3038 0.4913 0.000 0.104 0.896
#> SRR542361 3 0.8287 0.5737 0.128 0.256 0.616
#> SRR542362 3 0.8287 0.5737 0.128 0.256 0.616
#> SRR542363 3 0.7256 0.5737 0.088 0.216 0.696
#> SRR542364 2 0.1860 0.8441 0.000 0.948 0.052
#> SRR542365 2 0.0592 0.8636 0.012 0.988 0.000
#> SRR542366 2 0.0000 0.8623 0.000 1.000 0.000
#> SRR542367 2 0.0000 0.8623 0.000 1.000 0.000
#> SRR542368 2 0.0747 0.8627 0.016 0.984 0.000
#> SRR542369 2 0.0592 0.8636 0.012 0.988 0.000
#> SRR542370 2 0.0592 0.8636 0.012 0.988 0.000
#> SRR542371 2 0.2492 0.8393 0.016 0.936 0.048
#> SRR542372 2 0.0424 0.8612 0.000 0.992 0.008
#> SRR542373 2 0.3192 0.7943 0.000 0.888 0.112
#> SRR542374 3 0.6247 0.2635 0.004 0.376 0.620
#> SRR542375 2 0.7778 0.3611 0.104 0.656 0.240
#> SRR542376 3 0.8334 0.5702 0.136 0.248 0.616
#> SRR542377 3 0.8388 0.5683 0.140 0.248 0.612
#> SRR542378 3 0.8982 0.5410 0.156 0.308 0.536
#> SRR542379 3 0.8652 0.5586 0.140 0.284 0.576
#> SRR542380 3 0.8982 0.5410 0.156 0.308 0.536
#> SRR542381 2 0.6955 0.5435 0.100 0.728 0.172
#> SRR542382 3 0.9147 0.4931 0.156 0.348 0.496
#> SRR542383 3 0.8982 0.5410 0.156 0.308 0.536
#> SRR542384 2 0.4995 0.7454 0.068 0.840 0.092
#> SRR542385 2 0.0829 0.8630 0.012 0.984 0.004
#> SRR542386 2 0.1751 0.8531 0.028 0.960 0.012
#> SRR542387 2 0.2446 0.8394 0.012 0.936 0.052
#> SRR542388 2 0.0592 0.8636 0.012 0.988 0.000
#> SRR542389 2 0.0592 0.8636 0.012 0.988 0.000
#> SRR542390 2 0.0592 0.8636 0.012 0.988 0.000
#> SRR542391 2 0.0592 0.8636 0.012 0.988 0.000
#> SRR542392 2 0.1751 0.8531 0.028 0.960 0.012
#> SRR542393 2 0.0592 0.8636 0.012 0.988 0.000
#> SRR542394 2 0.2116 0.8451 0.012 0.948 0.040
#> SRR542395 2 0.2339 0.8413 0.012 0.940 0.048
#> SRR542396 2 0.3780 0.8055 0.044 0.892 0.064
#> SRR542397 2 0.0592 0.8636 0.012 0.988 0.000
#> SRR542398 2 0.3921 0.7927 0.080 0.884 0.036
#> SRR542399 1 0.1860 1.0000 0.948 0.052 0.000
#> SRR542400 1 0.1860 1.0000 0.948 0.052 0.000
#> SRR542401 1 0.1860 1.0000 0.948 0.052 0.000
#> SRR542402 1 0.1860 1.0000 0.948 0.052 0.000
#> SRR542403 1 0.1860 1.0000 0.948 0.052 0.000
#> SRR542404 1 0.1860 1.0000 0.948 0.052 0.000
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> SRR542346 3 0.4933 0.454 0.000 0.000 0.568 0.432
#> SRR542347 3 0.4933 0.454 0.000 0.000 0.568 0.432
#> SRR542348 3 0.4933 0.454 0.000 0.000 0.568 0.432
#> SRR542349 3 0.4933 0.454 0.000 0.000 0.568 0.432
#> SRR542350 3 0.3907 0.633 0.000 0.232 0.768 0.000
#> SRR542351 3 0.1706 0.731 0.000 0.036 0.948 0.016
#> SRR542352 2 0.3172 0.733 0.000 0.840 0.160 0.000
#> SRR542353 3 0.3764 0.645 0.000 0.216 0.784 0.000
#> SRR542354 3 0.2433 0.727 0.012 0.060 0.920 0.008
#> SRR542355 3 0.5985 0.534 0.016 0.216 0.700 0.068
#> SRR542356 3 0.1938 0.725 0.012 0.052 0.936 0.000
#> SRR542357 2 0.5339 0.478 0.016 0.600 0.384 0.000
#> SRR542358 2 0.3266 0.725 0.000 0.832 0.168 0.000
#> SRR542359 3 0.1706 0.731 0.000 0.036 0.948 0.016
#> SRR542360 3 0.3196 0.692 0.008 0.012 0.876 0.104
#> SRR542361 4 0.0921 0.851 0.000 0.000 0.028 0.972
#> SRR542362 4 0.0921 0.851 0.000 0.000 0.028 0.972
#> SRR542363 4 0.0921 0.851 0.000 0.000 0.028 0.972
#> SRR542364 2 0.3764 0.765 0.012 0.816 0.172 0.000
#> SRR542365 2 0.0592 0.843 0.000 0.984 0.016 0.000
#> SRR542366 2 0.1004 0.843 0.004 0.972 0.024 0.000
#> SRR542367 2 0.1297 0.840 0.020 0.964 0.016 0.000
#> SRR542368 2 0.1109 0.842 0.004 0.968 0.028 0.000
#> SRR542369 2 0.0921 0.840 0.000 0.972 0.028 0.000
#> SRR542370 2 0.0921 0.842 0.000 0.972 0.028 0.000
#> SRR542371 2 0.6098 0.711 0.024 0.724 0.128 0.124
#> SRR542372 2 0.1520 0.838 0.020 0.956 0.024 0.000
#> SRR542373 2 0.5182 0.639 0.008 0.676 0.304 0.012
#> SRR542374 3 0.1706 0.731 0.000 0.036 0.948 0.016
#> SRR542375 4 0.7389 0.405 0.012 0.244 0.176 0.568
#> SRR542376 4 0.0921 0.851 0.000 0.000 0.028 0.972
#> SRR542377 4 0.0921 0.851 0.000 0.000 0.028 0.972
#> SRR542378 4 0.1182 0.848 0.000 0.016 0.016 0.968
#> SRR542379 4 0.0707 0.851 0.000 0.000 0.020 0.980
#> SRR542380 4 0.1182 0.848 0.000 0.016 0.016 0.968
#> SRR542381 4 0.7462 0.404 0.016 0.244 0.172 0.568
#> SRR542382 4 0.2002 0.824 0.000 0.044 0.020 0.936
#> SRR542383 4 0.1182 0.848 0.000 0.016 0.016 0.968
#> SRR542384 2 0.7860 0.117 0.012 0.428 0.176 0.384
#> SRR542385 2 0.1059 0.841 0.000 0.972 0.012 0.016
#> SRR542386 2 0.0967 0.840 0.004 0.976 0.004 0.016
#> SRR542387 2 0.5997 0.713 0.020 0.728 0.128 0.124
#> SRR542388 2 0.0817 0.841 0.000 0.976 0.024 0.000
#> SRR542389 2 0.0921 0.840 0.000 0.972 0.028 0.000
#> SRR542390 2 0.0707 0.842 0.000 0.980 0.020 0.000
#> SRR542391 2 0.0817 0.841 0.000 0.976 0.024 0.000
#> SRR542392 2 0.0967 0.840 0.004 0.976 0.004 0.016
#> SRR542393 2 0.0707 0.842 0.000 0.980 0.020 0.000
#> SRR542394 2 0.5309 0.748 0.020 0.776 0.080 0.124
#> SRR542395 2 0.5894 0.727 0.020 0.736 0.120 0.124
#> SRR542396 2 0.7681 0.356 0.012 0.508 0.176 0.304
#> SRR542397 2 0.0469 0.843 0.000 0.988 0.012 0.000
#> SRR542398 2 0.5629 0.510 0.004 0.656 0.036 0.304
#> SRR542399 1 0.0817 1.000 0.976 0.000 0.000 0.024
#> SRR542400 1 0.0817 1.000 0.976 0.000 0.000 0.024
#> SRR542401 1 0.0817 1.000 0.976 0.000 0.000 0.024
#> SRR542402 1 0.0817 1.000 0.976 0.000 0.000 0.024
#> SRR542403 1 0.0817 1.000 0.976 0.000 0.000 0.024
#> SRR542404 1 0.0817 1.000 0.976 0.000 0.000 0.024
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> SRR542346 3 0.5165 0.3301 0 0.000 0.512 0.448 0.040
#> SRR542347 3 0.5178 0.2889 0 0.000 0.484 0.476 0.040
#> SRR542348 3 0.5165 0.3301 0 0.000 0.512 0.448 0.040
#> SRR542349 3 0.5238 0.2864 0 0.000 0.480 0.476 0.044
#> SRR542350 3 0.5016 0.4053 0 0.348 0.608 0.000 0.044
#> SRR542351 3 0.0771 0.6780 0 0.000 0.976 0.004 0.020
#> SRR542352 2 0.2077 0.6767 0 0.920 0.040 0.000 0.040
#> SRR542353 3 0.4908 0.4553 0 0.320 0.636 0.000 0.044
#> SRR542354 3 0.1430 0.6716 0 0.004 0.944 0.000 0.052
#> SRR542355 3 0.6352 0.3140 0 0.172 0.552 0.008 0.268
#> SRR542356 3 0.1270 0.6720 0 0.000 0.948 0.000 0.052
#> SRR542357 2 0.6686 -0.0137 0 0.448 0.396 0.020 0.136
#> SRR542358 2 0.2077 0.6767 0 0.920 0.040 0.000 0.040
#> SRR542359 3 0.0771 0.6780 0 0.000 0.976 0.004 0.020
#> SRR542360 3 0.4300 0.6187 0 0.000 0.772 0.096 0.132
#> SRR542361 4 0.0324 0.7861 0 0.000 0.004 0.992 0.004
#> SRR542362 4 0.0324 0.7861 0 0.000 0.004 0.992 0.004
#> SRR542363 4 0.1522 0.7480 0 0.000 0.012 0.944 0.044
#> SRR542364 2 0.6136 0.1578 0 0.464 0.056 0.032 0.448
#> SRR542365 2 0.2969 0.7161 0 0.852 0.000 0.020 0.128
#> SRR542366 2 0.4986 0.4663 0 0.608 0.004 0.032 0.356
#> SRR542367 2 0.5161 0.3176 0 0.532 0.004 0.032 0.432
#> SRR542368 2 0.4428 0.5955 0 0.692 0.004 0.020 0.284
#> SRR542369 2 0.1701 0.7326 0 0.936 0.000 0.016 0.048
#> SRR542370 2 0.3151 0.7074 0 0.836 0.000 0.020 0.144
#> SRR542371 5 0.4375 0.5373 0 0.236 0.004 0.032 0.728
#> SRR542372 2 0.5174 0.2881 0 0.520 0.004 0.032 0.444
#> SRR542373 5 0.7374 0.0891 0 0.288 0.268 0.032 0.412
#> SRR542374 3 0.0771 0.6780 0 0.000 0.976 0.004 0.020
#> SRR542375 5 0.3961 0.4648 0 0.000 0.028 0.212 0.760
#> SRR542376 4 0.0963 0.8035 0 0.000 0.000 0.964 0.036
#> SRR542377 4 0.0963 0.8035 0 0.000 0.000 0.964 0.036
#> SRR542378 4 0.4074 0.5892 0 0.000 0.000 0.636 0.364
#> SRR542379 4 0.1478 0.8014 0 0.000 0.000 0.936 0.064
#> SRR542380 4 0.4060 0.5953 0 0.000 0.000 0.640 0.360
#> SRR542381 5 0.3696 0.4722 0 0.000 0.016 0.212 0.772
#> SRR542382 5 0.4300 -0.2854 0 0.000 0.000 0.476 0.524
#> SRR542383 4 0.4060 0.5953 0 0.000 0.000 0.640 0.360
#> SRR542384 5 0.3894 0.6562 0 0.080 0.032 0.056 0.832
#> SRR542385 2 0.1121 0.7369 0 0.956 0.000 0.000 0.044
#> SRR542386 2 0.3838 0.5944 0 0.716 0.000 0.004 0.280
#> SRR542387 5 0.3741 0.5601 0 0.264 0.004 0.000 0.732
#> SRR542388 2 0.1908 0.7298 0 0.908 0.000 0.000 0.092
#> SRR542389 2 0.1522 0.6989 0 0.944 0.012 0.000 0.044
#> SRR542390 2 0.0794 0.7360 0 0.972 0.000 0.000 0.028
#> SRR542391 2 0.0290 0.7288 0 0.992 0.000 0.000 0.008
#> SRR542392 2 0.3928 0.5755 0 0.700 0.000 0.004 0.296
#> SRR542393 2 0.0290 0.7324 0 0.992 0.000 0.000 0.008
#> SRR542394 5 0.3928 0.5187 0 0.296 0.004 0.000 0.700
#> SRR542395 5 0.4451 0.4707 0 0.340 0.016 0.000 0.644
#> SRR542396 5 0.3587 0.6679 0 0.096 0.024 0.036 0.844
#> SRR542397 2 0.0880 0.7367 0 0.968 0.000 0.000 0.032
#> SRR542398 5 0.4039 0.6313 0 0.184 0.004 0.036 0.776
#> SRR542399 1 0.0000 1.0000 1 0.000 0.000 0.000 0.000
#> SRR542400 1 0.0000 1.0000 1 0.000 0.000 0.000 0.000
#> SRR542401 1 0.0000 1.0000 1 0.000 0.000 0.000 0.000
#> SRR542402 1 0.0000 1.0000 1 0.000 0.000 0.000 0.000
#> SRR542403 1 0.0000 1.0000 1 0.000 0.000 0.000 0.000
#> SRR542404 1 0.0000 1.0000 1 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
#> SRR542346 4 0.5026 0.4445 0.000 0.000 0.356 0.568 0.004 0.072
#> SRR542347 4 0.4915 0.4892 0.000 0.000 0.320 0.604 0.004 0.072
#> SRR542348 4 0.5026 0.4445 0.000 0.000 0.356 0.568 0.004 0.072
#> SRR542349 4 0.4839 0.5067 0.000 0.000 0.300 0.624 0.004 0.072
#> SRR542350 3 0.4463 0.3127 0.000 0.468 0.508 0.000 0.020 0.004
#> SRR542351 3 0.0260 0.7171 0.000 0.000 0.992 0.000 0.008 0.000
#> SRR542352 2 0.1262 0.6468 0.000 0.956 0.008 0.000 0.016 0.020
#> SRR542353 3 0.4453 0.3472 0.000 0.452 0.524 0.000 0.020 0.004
#> SRR542354 3 0.3201 0.6973 0.000 0.028 0.848 0.000 0.088 0.036
#> SRR542355 2 0.7585 -0.2088 0.000 0.340 0.308 0.004 0.160 0.188
#> SRR542356 3 0.2463 0.7078 0.000 0.020 0.892 0.000 0.068 0.020
#> SRR542357 2 0.6980 0.0864 0.000 0.472 0.244 0.000 0.124 0.160
#> SRR542358 2 0.0976 0.6522 0.000 0.968 0.008 0.000 0.016 0.008
#> SRR542359 3 0.0790 0.7143 0.000 0.000 0.968 0.000 0.032 0.000
#> SRR542360 3 0.6369 0.3282 0.000 0.000 0.572 0.180 0.100 0.148
#> SRR542361 4 0.1753 0.6637 0.000 0.000 0.000 0.912 0.084 0.004
#> SRR542362 4 0.1753 0.6637 0.000 0.000 0.000 0.912 0.084 0.004
#> SRR542363 4 0.0000 0.6634 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR542364 6 0.5905 0.5154 0.000 0.164 0.068 0.008 0.120 0.640
#> SRR542365 6 0.3797 0.2720 0.000 0.420 0.000 0.000 0.000 0.580
#> SRR542366 6 0.3373 0.5378 0.000 0.248 0.000 0.008 0.000 0.744
#> SRR542367 6 0.3837 0.5639 0.000 0.180 0.000 0.008 0.044 0.768
#> SRR542368 6 0.3670 0.4924 0.000 0.284 0.000 0.000 0.012 0.704
#> SRR542369 2 0.3804 0.0912 0.000 0.576 0.000 0.000 0.000 0.424
#> SRR542370 6 0.3684 0.3888 0.000 0.372 0.000 0.000 0.000 0.628
#> SRR542371 6 0.4386 0.2226 0.000 0.028 0.000 0.004 0.348 0.620
#> SRR542372 6 0.4019 0.5636 0.000 0.180 0.000 0.008 0.056 0.756
#> SRR542373 6 0.6568 0.3838 0.000 0.080 0.176 0.008 0.176 0.560
#> SRR542374 3 0.0790 0.7143 0.000 0.000 0.968 0.000 0.032 0.000
#> SRR542375 5 0.4493 0.5848 0.000 0.008 0.040 0.052 0.760 0.140
#> SRR542376 4 0.2454 0.6254 0.000 0.000 0.000 0.840 0.160 0.000
#> SRR542377 4 0.2632 0.6206 0.000 0.000 0.000 0.832 0.164 0.004
#> SRR542378 5 0.3747 0.3465 0.000 0.000 0.000 0.396 0.604 0.000
#> SRR542379 4 0.2883 0.5584 0.000 0.000 0.000 0.788 0.212 0.000
#> SRR542380 5 0.3747 0.3465 0.000 0.000 0.000 0.396 0.604 0.000
#> SRR542381 5 0.4321 0.5847 0.000 0.008 0.028 0.052 0.768 0.144
#> SRR542382 5 0.3421 0.5041 0.000 0.000 0.000 0.256 0.736 0.008
#> SRR542383 5 0.3747 0.3465 0.000 0.000 0.000 0.396 0.604 0.000
#> SRR542384 5 0.4454 0.5018 0.000 0.016 0.044 0.004 0.716 0.220
#> SRR542385 2 0.2709 0.6483 0.000 0.848 0.000 0.000 0.020 0.132
#> SRR542386 6 0.4972 0.4000 0.000 0.352 0.000 0.000 0.080 0.568
#> SRR542387 6 0.5073 -0.0171 0.000 0.076 0.000 0.000 0.448 0.476
#> SRR542388 2 0.4153 0.3002 0.000 0.636 0.000 0.000 0.024 0.340
#> SRR542389 2 0.0291 0.6569 0.000 0.992 0.000 0.000 0.004 0.004
#> SRR542390 2 0.2527 0.6641 0.000 0.868 0.000 0.000 0.024 0.108
#> SRR542391 2 0.2112 0.6694 0.000 0.896 0.000 0.000 0.016 0.088
#> SRR542392 6 0.4950 0.4128 0.000 0.344 0.000 0.000 0.080 0.576
#> SRR542393 2 0.2178 0.6645 0.000 0.868 0.000 0.000 0.000 0.132
#> SRR542394 6 0.5069 0.0187 0.000 0.076 0.000 0.000 0.440 0.484
#> SRR542395 5 0.6505 0.0327 0.000 0.248 0.032 0.000 0.456 0.264
#> SRR542396 5 0.4692 0.4573 0.000 0.016 0.040 0.004 0.668 0.272
#> SRR542397 2 0.3025 0.6389 0.000 0.820 0.000 0.000 0.024 0.156
#> SRR542398 5 0.5064 0.2769 0.000 0.072 0.000 0.004 0.552 0.372
#> SRR542399 1 0.0000 0.9918 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR542400 1 0.0820 0.9834 0.972 0.000 0.000 0.000 0.016 0.012
#> SRR542401 1 0.0000 0.9918 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR542402 1 0.0000 0.9918 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR542403 1 0.0820 0.9834 0.972 0.000 0.000 0.000 0.016 0.012
#> SRR542404 1 0.0000 0.9918 1.000 0.000 0.000 0.000 0.000 0.000
Heatmaps for the consensus matrix. It visualizes the probability of two samples to be in a same group.
consensus_heatmap(res, k = 2)
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 16804 rows and 59 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 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.481 0.515 0.792 0.5055 0.495 0.495
#> 3 3 0.654 0.597 0.842 0.3092 0.709 0.479
#> 4 4 0.753 0.824 0.911 0.1225 0.810 0.510
#> 5 5 0.723 0.675 0.827 0.0773 0.881 0.586
#> 6 6 0.741 0.612 0.806 0.0463 0.918 0.625
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
#> SRR542346 1 0.0376 0.447 0.996 0.004
#> SRR542347 1 0.0376 0.447 0.996 0.004
#> SRR542348 1 0.0376 0.447 0.996 0.004
#> SRR542349 1 0.0376 0.447 0.996 0.004
#> SRR542350 2 0.9710 0.706 0.400 0.600
#> SRR542351 1 0.9866 -0.544 0.568 0.432
#> SRR542352 2 0.9710 0.706 0.400 0.600
#> SRR542353 2 0.9710 0.706 0.400 0.600
#> SRR542354 2 0.9977 0.653 0.472 0.528
#> SRR542355 2 0.9977 0.653 0.472 0.528
#> SRR542356 2 0.9922 0.674 0.448 0.552
#> SRR542357 2 0.9922 0.674 0.448 0.552
#> SRR542358 2 0.9710 0.706 0.400 0.600
#> SRR542359 1 0.8955 -0.320 0.688 0.312
#> SRR542360 1 0.3431 0.348 0.936 0.064
#> SRR542361 1 0.2948 0.495 0.948 0.052
#> SRR542362 1 0.2948 0.495 0.948 0.052
#> SRR542363 1 0.1184 0.466 0.984 0.016
#> SRR542364 2 0.9710 0.706 0.400 0.600
#> SRR542365 2 0.9710 0.706 0.400 0.600
#> SRR542366 2 0.9710 0.706 0.400 0.600
#> SRR542367 2 0.9710 0.706 0.400 0.600
#> SRR542368 2 0.9522 0.694 0.372 0.628
#> SRR542369 2 0.9710 0.706 0.400 0.600
#> SRR542370 2 0.9710 0.706 0.400 0.600
#> SRR542371 2 0.2948 0.441 0.052 0.948
#> SRR542372 2 0.9710 0.706 0.400 0.600
#> SRR542373 2 0.9922 0.674 0.448 0.552
#> SRR542374 1 0.9881 -0.550 0.564 0.436
#> SRR542375 1 0.9710 0.684 0.600 0.400
#> SRR542376 1 0.9710 0.684 0.600 0.400
#> SRR542377 1 0.9710 0.684 0.600 0.400
#> SRR542378 1 0.9710 0.684 0.600 0.400
#> SRR542379 1 0.9710 0.684 0.600 0.400
#> SRR542380 1 0.9710 0.684 0.600 0.400
#> SRR542381 1 0.9909 0.657 0.556 0.444
#> SRR542382 1 0.9710 0.684 0.600 0.400
#> SRR542383 1 0.9710 0.684 0.600 0.400
#> SRR542384 1 0.9850 0.670 0.572 0.428
#> SRR542385 2 0.0000 0.472 0.000 1.000
#> SRR542386 2 0.0376 0.468 0.004 0.996
#> SRR542387 2 0.2948 0.441 0.052 0.948
#> SRR542388 2 0.2603 0.517 0.044 0.956
#> SRR542389 2 0.9710 0.706 0.400 0.600
#> SRR542390 2 0.2948 0.523 0.052 0.948
#> SRR542391 2 0.2948 0.523 0.052 0.948
#> SRR542392 2 0.0376 0.468 0.004 0.996
#> SRR542393 2 0.9710 0.706 0.400 0.600
#> SRR542394 2 0.0376 0.468 0.004 0.996
#> SRR542395 2 0.2948 0.441 0.052 0.948
#> SRR542396 2 0.9866 -0.543 0.432 0.568
#> SRR542397 2 0.2948 0.523 0.052 0.948
#> SRR542398 2 0.9850 -0.537 0.428 0.572
#> SRR542399 1 0.9922 0.668 0.552 0.448
#> SRR542400 1 0.9922 0.668 0.552 0.448
#> SRR542401 1 0.9922 0.668 0.552 0.448
#> SRR542402 1 0.9922 0.668 0.552 0.448
#> SRR542403 1 0.9922 0.668 0.552 0.448
#> SRR542404 1 0.9922 0.668 0.552 0.448
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> SRR542346 3 0.0424 0.7252 0.008 0.000 0.992
#> SRR542347 3 0.0424 0.7252 0.008 0.000 0.992
#> SRR542348 3 0.0424 0.7252 0.008 0.000 0.992
#> SRR542349 3 0.0424 0.7252 0.008 0.000 0.992
#> SRR542350 2 0.6286 0.1787 0.000 0.536 0.464
#> SRR542351 3 0.1643 0.7175 0.000 0.044 0.956
#> SRR542352 2 0.0424 0.8785 0.000 0.992 0.008
#> SRR542353 2 0.6291 0.1679 0.000 0.532 0.468
#> SRR542354 3 0.5810 0.3485 0.000 0.336 0.664
#> SRR542355 3 0.5363 0.4742 0.000 0.276 0.724
#> SRR542356 3 0.6079 0.2085 0.000 0.388 0.612
#> SRR542357 2 0.6267 0.2132 0.000 0.548 0.452
#> SRR542358 2 0.0424 0.8785 0.000 0.992 0.008
#> SRR542359 3 0.6095 0.3288 0.392 0.000 0.608
#> SRR542360 3 0.0000 0.7240 0.000 0.000 1.000
#> SRR542361 3 0.2537 0.6754 0.080 0.000 0.920
#> SRR542362 3 0.2537 0.6754 0.080 0.000 0.920
#> SRR542363 3 0.0747 0.7218 0.016 0.000 0.984
#> SRR542364 2 0.0747 0.8750 0.000 0.984 0.016
#> SRR542365 2 0.0000 0.8810 0.000 1.000 0.000
#> SRR542366 2 0.0237 0.8800 0.000 0.996 0.004
#> SRR542367 2 0.0000 0.8810 0.000 1.000 0.000
#> SRR542368 1 0.6308 -0.0913 0.508 0.492 0.000
#> SRR542369 2 0.0000 0.8810 0.000 1.000 0.000
#> SRR542370 2 0.0000 0.8810 0.000 1.000 0.000
#> SRR542371 2 0.0661 0.8768 0.008 0.988 0.004
#> SRR542372 2 0.0000 0.8810 0.000 1.000 0.000
#> SRR542373 3 0.1753 0.7155 0.000 0.048 0.952
#> SRR542374 3 0.1643 0.7175 0.000 0.044 0.956
#> SRR542375 1 0.6126 0.4975 0.600 0.000 0.400
#> SRR542376 3 0.6235 -0.1331 0.436 0.000 0.564
#> SRR542377 3 0.6305 -0.2654 0.484 0.000 0.516
#> SRR542378 1 0.6095 0.4997 0.608 0.000 0.392
#> SRR542379 3 0.6308 -0.2860 0.492 0.000 0.508
#> SRR542380 1 0.6095 0.4997 0.608 0.000 0.392
#> SRR542381 1 0.6126 0.4975 0.600 0.000 0.400
#> SRR542382 1 0.6079 0.5042 0.612 0.000 0.388
#> SRR542383 1 0.6095 0.4997 0.608 0.000 0.392
#> SRR542384 1 0.5760 0.5538 0.672 0.000 0.328
#> SRR542385 2 0.0000 0.8810 0.000 1.000 0.000
#> SRR542386 2 0.1529 0.8515 0.040 0.960 0.000
#> SRR542387 2 0.6822 0.0362 0.480 0.508 0.012
#> SRR542388 2 0.1529 0.8515 0.040 0.960 0.000
#> SRR542389 2 0.0000 0.8810 0.000 1.000 0.000
#> SRR542390 2 0.0000 0.8810 0.000 1.000 0.000
#> SRR542391 2 0.0000 0.8810 0.000 1.000 0.000
#> SRR542392 1 0.6180 0.1216 0.584 0.416 0.000
#> SRR542393 2 0.0424 0.8785 0.000 0.992 0.008
#> SRR542394 2 0.1031 0.8694 0.024 0.976 0.000
#> SRR542395 2 0.5882 0.4072 0.348 0.652 0.000
#> SRR542396 1 0.3340 0.6541 0.880 0.000 0.120
#> SRR542397 2 0.0000 0.8810 0.000 1.000 0.000
#> SRR542398 1 0.0747 0.6794 0.984 0.016 0.000
#> SRR542399 1 0.0424 0.6841 0.992 0.008 0.000
#> SRR542400 1 0.0424 0.6841 0.992 0.008 0.000
#> SRR542401 1 0.0424 0.6841 0.992 0.008 0.000
#> SRR542402 1 0.0424 0.6841 0.992 0.008 0.000
#> SRR542403 1 0.0424 0.6841 0.992 0.008 0.000
#> SRR542404 1 0.0424 0.6841 0.992 0.008 0.000
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> SRR542346 3 0.4008 0.744 0.000 0.000 0.756 0.244
#> SRR542347 3 0.4008 0.744 0.000 0.000 0.756 0.244
#> SRR542348 3 0.4008 0.744 0.000 0.000 0.756 0.244
#> SRR542349 3 0.4008 0.744 0.000 0.000 0.756 0.244
#> SRR542350 3 0.3942 0.724 0.000 0.236 0.764 0.000
#> SRR542351 3 0.0188 0.839 0.000 0.000 0.996 0.004
#> SRR542352 2 0.1022 0.884 0.000 0.968 0.032 0.000
#> SRR542353 3 0.3873 0.733 0.000 0.228 0.772 0.000
#> SRR542354 3 0.1637 0.837 0.000 0.060 0.940 0.000
#> SRR542355 3 0.1637 0.837 0.000 0.060 0.940 0.000
#> SRR542356 3 0.0469 0.841 0.000 0.012 0.988 0.000
#> SRR542357 3 0.4522 0.552 0.000 0.320 0.680 0.000
#> SRR542358 2 0.1022 0.884 0.000 0.968 0.032 0.000
#> SRR542359 3 0.1940 0.813 0.076 0.000 0.924 0.000
#> SRR542360 3 0.0817 0.835 0.000 0.000 0.976 0.024
#> SRR542361 4 0.0336 0.885 0.000 0.000 0.008 0.992
#> SRR542362 4 0.2469 0.801 0.000 0.000 0.108 0.892
#> SRR542363 4 0.2704 0.782 0.000 0.000 0.124 0.876
#> SRR542364 2 0.3688 0.711 0.000 0.792 0.208 0.000
#> SRR542365 2 0.0000 0.905 0.000 1.000 0.000 0.000
#> SRR542366 2 0.0188 0.903 0.000 0.996 0.004 0.000
#> SRR542367 2 0.0336 0.902 0.000 0.992 0.008 0.000
#> SRR542368 1 0.0000 0.967 1.000 0.000 0.000 0.000
#> SRR542369 2 0.0000 0.905 0.000 1.000 0.000 0.000
#> SRR542370 2 0.0000 0.905 0.000 1.000 0.000 0.000
#> SRR542371 2 0.6813 0.210 0.000 0.516 0.104 0.380
#> SRR542372 2 0.0336 0.902 0.000 0.992 0.008 0.000
#> SRR542373 3 0.0188 0.837 0.000 0.004 0.996 0.000
#> SRR542374 3 0.0188 0.839 0.000 0.000 0.996 0.004
#> SRR542375 4 0.3356 0.813 0.000 0.000 0.176 0.824
#> SRR542376 4 0.0000 0.888 0.000 0.000 0.000 1.000
#> SRR542377 4 0.0188 0.887 0.000 0.000 0.004 0.996
#> SRR542378 4 0.0000 0.888 0.000 0.000 0.000 1.000
#> SRR542379 4 0.0000 0.888 0.000 0.000 0.000 1.000
#> SRR542380 4 0.0000 0.888 0.000 0.000 0.000 1.000
#> SRR542381 4 0.3583 0.808 0.000 0.004 0.180 0.816
#> SRR542382 4 0.0000 0.888 0.000 0.000 0.000 1.000
#> SRR542383 4 0.0000 0.888 0.000 0.000 0.000 1.000
#> SRR542384 4 0.4218 0.797 0.012 0.008 0.184 0.796
#> SRR542385 2 0.0000 0.905 0.000 1.000 0.000 0.000
#> SRR542386 2 0.0000 0.905 0.000 1.000 0.000 0.000
#> SRR542387 4 0.6313 0.592 0.000 0.220 0.128 0.652
#> SRR542388 2 0.0817 0.891 0.024 0.976 0.000 0.000
#> SRR542389 2 0.0188 0.903 0.000 0.996 0.004 0.000
#> SRR542390 2 0.0000 0.905 0.000 1.000 0.000 0.000
#> SRR542391 2 0.0000 0.905 0.000 1.000 0.000 0.000
#> SRR542392 1 0.2704 0.841 0.876 0.124 0.000 0.000
#> SRR542393 2 0.0000 0.905 0.000 1.000 0.000 0.000
#> SRR542394 2 0.5630 0.396 0.000 0.608 0.032 0.360
#> SRR542395 2 0.5837 0.287 0.000 0.564 0.036 0.400
#> SRR542396 4 0.5368 0.769 0.024 0.044 0.176 0.756
#> SRR542397 2 0.0000 0.905 0.000 1.000 0.000 0.000
#> SRR542398 1 0.2345 0.872 0.900 0.000 0.000 0.100
#> SRR542399 1 0.0000 0.967 1.000 0.000 0.000 0.000
#> SRR542400 1 0.0000 0.967 1.000 0.000 0.000 0.000
#> SRR542401 1 0.0000 0.967 1.000 0.000 0.000 0.000
#> SRR542402 1 0.0000 0.967 1.000 0.000 0.000 0.000
#> SRR542403 1 0.0000 0.967 1.000 0.000 0.000 0.000
#> SRR542404 1 0.0000 0.967 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
#> SRR542346 4 0.4291 0.2454 0.000 0.000 0.464 0.536 0.000
#> SRR542347 4 0.4235 0.3203 0.000 0.000 0.424 0.576 0.000
#> SRR542348 4 0.4294 0.2362 0.000 0.000 0.468 0.532 0.000
#> SRR542349 4 0.4138 0.3797 0.000 0.000 0.384 0.616 0.000
#> SRR542350 3 0.3752 0.6237 0.000 0.292 0.708 0.000 0.000
#> SRR542351 3 0.1965 0.7882 0.000 0.000 0.904 0.000 0.096
#> SRR542352 2 0.1851 0.8149 0.000 0.912 0.088 0.000 0.000
#> SRR542353 3 0.3636 0.6507 0.000 0.272 0.728 0.000 0.000
#> SRR542354 3 0.0880 0.7846 0.000 0.000 0.968 0.000 0.032
#> SRR542355 3 0.1041 0.7836 0.000 0.000 0.964 0.004 0.032
#> SRR542356 3 0.0703 0.7872 0.000 0.000 0.976 0.000 0.024
#> SRR542357 3 0.3110 0.7426 0.000 0.080 0.860 0.000 0.060
#> SRR542358 2 0.1732 0.8223 0.000 0.920 0.080 0.000 0.000
#> SRR542359 3 0.2522 0.7827 0.012 0.000 0.880 0.000 0.108
#> SRR542360 3 0.4158 0.7090 0.000 0.000 0.784 0.092 0.124
#> SRR542361 4 0.0000 0.6628 0.000 0.000 0.000 1.000 0.000
#> SRR542362 4 0.0162 0.6627 0.000 0.000 0.004 0.996 0.000
#> SRR542363 4 0.0000 0.6628 0.000 0.000 0.000 1.000 0.000
#> SRR542364 2 0.5907 0.3704 0.000 0.496 0.056 0.020 0.428
#> SRR542365 2 0.1956 0.8551 0.000 0.916 0.000 0.008 0.076
#> SRR542366 2 0.3474 0.8049 0.000 0.824 0.008 0.020 0.148
#> SRR542367 2 0.6156 0.4970 0.000 0.564 0.096 0.020 0.320
#> SRR542368 1 0.0000 0.9070 1.000 0.000 0.000 0.000 0.000
#> SRR542369 2 0.1697 0.8594 0.000 0.932 0.000 0.008 0.060
#> SRR542370 2 0.2358 0.8434 0.000 0.888 0.000 0.008 0.104
#> SRR542371 5 0.3113 0.7310 0.000 0.020 0.100 0.016 0.864
#> SRR542372 2 0.6107 0.4896 0.000 0.560 0.088 0.020 0.332
#> SRR542373 3 0.5190 0.3391 0.000 0.004 0.496 0.032 0.468
#> SRR542374 3 0.2127 0.7850 0.000 0.000 0.892 0.000 0.108
#> SRR542375 5 0.3409 0.7347 0.000 0.000 0.032 0.144 0.824
#> SRR542376 4 0.0703 0.6617 0.000 0.000 0.000 0.976 0.024
#> SRR542377 4 0.0794 0.6603 0.000 0.000 0.000 0.972 0.028
#> SRR542378 4 0.4138 0.1818 0.000 0.000 0.000 0.616 0.384
#> SRR542379 4 0.0880 0.6581 0.000 0.000 0.000 0.968 0.032
#> SRR542380 4 0.4138 0.1818 0.000 0.000 0.000 0.616 0.384
#> SRR542381 5 0.2329 0.7609 0.000 0.000 0.000 0.124 0.876
#> SRR542382 5 0.4307 0.0225 0.000 0.000 0.000 0.500 0.500
#> SRR542383 4 0.4138 0.1818 0.000 0.000 0.000 0.616 0.384
#> SRR542384 5 0.3035 0.7544 0.000 0.000 0.032 0.112 0.856
#> SRR542385 2 0.0404 0.8687 0.000 0.988 0.000 0.000 0.012
#> SRR542386 2 0.1792 0.8463 0.000 0.916 0.000 0.000 0.084
#> SRR542387 5 0.4410 0.7531 0.000 0.044 0.124 0.040 0.792
#> SRR542388 2 0.1124 0.8549 0.036 0.960 0.000 0.000 0.004
#> SRR542389 2 0.0451 0.8656 0.000 0.988 0.008 0.000 0.004
#> SRR542390 2 0.0290 0.8685 0.000 0.992 0.000 0.000 0.008
#> SRR542391 2 0.0162 0.8676 0.000 0.996 0.000 0.000 0.004
#> SRR542392 1 0.3282 0.7041 0.804 0.188 0.000 0.000 0.008
#> SRR542393 2 0.0000 0.8681 0.000 1.000 0.000 0.000 0.000
#> SRR542394 5 0.3806 0.7383 0.000 0.072 0.096 0.008 0.824
#> SRR542395 5 0.5636 0.6679 0.000 0.156 0.152 0.016 0.676
#> SRR542396 5 0.2344 0.7584 0.000 0.000 0.032 0.064 0.904
#> SRR542397 2 0.0290 0.8685 0.000 0.992 0.000 0.000 0.008
#> SRR542398 1 0.4249 0.1280 0.568 0.000 0.000 0.000 0.432
#> SRR542399 1 0.0000 0.9070 1.000 0.000 0.000 0.000 0.000
#> SRR542400 1 0.0000 0.9070 1.000 0.000 0.000 0.000 0.000
#> SRR542401 1 0.0000 0.9070 1.000 0.000 0.000 0.000 0.000
#> SRR542402 1 0.0000 0.9070 1.000 0.000 0.000 0.000 0.000
#> SRR542403 1 0.0000 0.9070 1.000 0.000 0.000 0.000 0.000
#> SRR542404 1 0.0000 0.9070 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
#> SRR542346 4 0.4331 0.2520 0.000 0.000 0.464 0.516 0.000 0.020
#> SRR542347 4 0.4276 0.3395 0.000 0.000 0.416 0.564 0.000 0.020
#> SRR542348 4 0.4335 0.2351 0.000 0.000 0.472 0.508 0.000 0.020
#> SRR542349 4 0.4167 0.4040 0.000 0.000 0.368 0.612 0.000 0.020
#> SRR542350 3 0.3915 0.4056 0.000 0.412 0.584 0.000 0.000 0.004
#> SRR542351 3 0.0935 0.7620 0.000 0.000 0.964 0.004 0.032 0.000
#> SRR542352 2 0.2355 0.7757 0.000 0.876 0.112 0.000 0.004 0.008
#> SRR542353 3 0.3852 0.4624 0.000 0.384 0.612 0.000 0.000 0.004
#> SRR542354 3 0.2015 0.7631 0.000 0.016 0.916 0.000 0.012 0.056
#> SRR542355 3 0.3755 0.7185 0.000 0.024 0.800 0.000 0.044 0.132
#> SRR542356 3 0.1729 0.7675 0.000 0.012 0.936 0.004 0.012 0.036
#> SRR542357 3 0.5502 0.5807 0.000 0.092 0.632 0.000 0.044 0.232
#> SRR542358 2 0.1501 0.8249 0.000 0.924 0.076 0.000 0.000 0.000
#> SRR542359 3 0.1536 0.7574 0.016 0.000 0.940 0.004 0.040 0.000
#> SRR542360 3 0.4786 0.5448 0.000 0.000 0.716 0.160 0.096 0.028
#> SRR542361 4 0.0260 0.6645 0.000 0.000 0.000 0.992 0.000 0.008
#> SRR542362 4 0.0146 0.6642 0.000 0.000 0.000 0.996 0.000 0.004
#> SRR542363 4 0.0363 0.6641 0.000 0.000 0.000 0.988 0.000 0.012
#> SRR542364 6 0.4902 0.5991 0.000 0.052 0.032 0.004 0.224 0.688
#> SRR542365 6 0.3695 0.4381 0.000 0.376 0.000 0.000 0.000 0.624
#> SRR542366 6 0.2662 0.6746 0.000 0.152 0.000 0.004 0.004 0.840
#> SRR542367 6 0.1850 0.6784 0.000 0.052 0.008 0.000 0.016 0.924
#> SRR542368 1 0.1267 0.8978 0.940 0.000 0.000 0.000 0.000 0.060
#> SRR542369 6 0.3804 0.3598 0.000 0.424 0.000 0.000 0.000 0.576
#> SRR542370 6 0.3390 0.5694 0.000 0.296 0.000 0.000 0.000 0.704
#> SRR542371 6 0.3955 0.2378 0.000 0.004 0.012 0.000 0.316 0.668
#> SRR542372 6 0.2022 0.6781 0.000 0.052 0.008 0.000 0.024 0.916
#> SRR542373 6 0.5865 0.4056 0.000 0.004 0.188 0.004 0.276 0.528
#> SRR542374 3 0.1349 0.7556 0.000 0.000 0.940 0.004 0.056 0.000
#> SRR542375 5 0.1320 0.6786 0.000 0.000 0.000 0.036 0.948 0.016
#> SRR542376 4 0.0405 0.6630 0.000 0.000 0.000 0.988 0.008 0.004
#> SRR542377 4 0.0405 0.6630 0.000 0.000 0.000 0.988 0.008 0.004
#> SRR542378 5 0.3999 0.0535 0.000 0.000 0.000 0.496 0.500 0.004
#> SRR542379 4 0.1082 0.6402 0.000 0.000 0.000 0.956 0.040 0.004
#> SRR542380 4 0.3996 -0.1803 0.000 0.000 0.000 0.512 0.484 0.004
#> SRR542381 5 0.1334 0.6789 0.000 0.000 0.000 0.020 0.948 0.032
#> SRR542382 5 0.3714 0.4005 0.000 0.000 0.000 0.340 0.656 0.004
#> SRR542383 4 0.3996 -0.1784 0.000 0.000 0.000 0.512 0.484 0.004
#> SRR542384 5 0.1577 0.6723 0.000 0.000 0.008 0.016 0.940 0.036
#> SRR542385 2 0.1584 0.8710 0.000 0.928 0.000 0.000 0.008 0.064
#> SRR542386 2 0.4360 0.5611 0.000 0.680 0.000 0.000 0.060 0.260
#> SRR542387 5 0.4545 0.5792 0.000 0.016 0.056 0.000 0.700 0.228
#> SRR542388 2 0.1563 0.8730 0.012 0.932 0.000 0.000 0.000 0.056
#> SRR542389 2 0.0000 0.8744 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR542390 2 0.1204 0.8752 0.000 0.944 0.000 0.000 0.000 0.056
#> SRR542391 2 0.0713 0.8810 0.000 0.972 0.000 0.000 0.000 0.028
#> SRR542392 1 0.5322 0.5025 0.628 0.236 0.000 0.000 0.016 0.120
#> SRR542393 2 0.0891 0.8812 0.000 0.968 0.008 0.000 0.000 0.024
#> SRR542394 5 0.4537 0.4306 0.000 0.020 0.012 0.000 0.584 0.384
#> SRR542395 5 0.5812 0.5145 0.000 0.108 0.056 0.000 0.608 0.228
#> SRR542396 5 0.2026 0.6617 0.000 0.004 0.008 0.012 0.916 0.060
#> SRR542397 2 0.2632 0.7844 0.000 0.832 0.004 0.000 0.000 0.164
#> SRR542398 5 0.4446 0.2045 0.444 0.004 0.000 0.000 0.532 0.020
#> SRR542399 1 0.0000 0.9356 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR542400 1 0.0000 0.9356 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR542401 1 0.0000 0.9356 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR542402 1 0.0000 0.9356 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR542403 1 0.0000 0.9356 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR542404 1 0.0000 0.9356 1.000 0.000 0.000 0.000 0.000 0.000
Heatmaps for the consensus matrix. It visualizes the probability of two samples to be in a same group.
consensus_heatmap(res, k = 2)
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", "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 16804 rows and 59 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.299 0.795 0.861 0.2643 0.814 0.814
#> 3 3 0.471 0.530 0.797 1.0626 0.612 0.531
#> 4 4 0.683 0.747 0.878 0.2904 0.733 0.482
#> 5 5 0.672 0.651 0.803 0.1145 0.916 0.728
#> 6 6 0.741 0.647 0.784 0.0539 0.928 0.706
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
#> SRR542346 2 0.9580 0.604 0.380 0.620
#> SRR542347 2 0.9580 0.604 0.380 0.620
#> SRR542348 2 0.9580 0.604 0.380 0.620
#> SRR542349 2 0.9580 0.604 0.380 0.620
#> SRR542350 2 0.0000 0.832 0.000 1.000
#> SRR542351 2 0.7528 0.683 0.216 0.784
#> SRR542352 2 0.0000 0.832 0.000 1.000
#> SRR542353 2 0.7453 0.686 0.212 0.788
#> SRR542354 2 0.7528 0.683 0.216 0.784
#> SRR542355 2 0.5294 0.805 0.120 0.880
#> SRR542356 2 0.7528 0.683 0.216 0.784
#> SRR542357 2 0.0000 0.832 0.000 1.000
#> SRR542358 2 0.0000 0.832 0.000 1.000
#> SRR542359 2 0.7528 0.683 0.216 0.784
#> SRR542360 2 0.9580 0.604 0.380 0.620
#> SRR542361 2 0.6531 0.771 0.168 0.832
#> SRR542362 2 0.6531 0.771 0.168 0.832
#> SRR542363 2 0.9580 0.604 0.380 0.620
#> SRR542364 2 0.0000 0.832 0.000 1.000
#> SRR542365 2 0.0000 0.832 0.000 1.000
#> SRR542366 2 0.0000 0.832 0.000 1.000
#> SRR542367 2 0.0000 0.832 0.000 1.000
#> SRR542368 2 0.0000 0.832 0.000 1.000
#> SRR542369 2 0.0000 0.832 0.000 1.000
#> SRR542370 2 0.0000 0.832 0.000 1.000
#> SRR542371 2 0.0000 0.832 0.000 1.000
#> SRR542372 2 0.0000 0.832 0.000 1.000
#> SRR542373 2 0.4815 0.802 0.104 0.896
#> SRR542374 2 0.7528 0.683 0.216 0.784
#> SRR542375 2 0.6343 0.776 0.160 0.840
#> SRR542376 2 0.9580 0.604 0.380 0.620
#> SRR542377 2 0.6438 0.773 0.164 0.836
#> SRR542378 2 0.6438 0.773 0.164 0.836
#> SRR542379 2 0.6438 0.773 0.164 0.836
#> SRR542380 2 0.6438 0.773 0.164 0.836
#> SRR542381 2 0.6343 0.776 0.160 0.840
#> SRR542382 2 0.6438 0.773 0.164 0.836
#> SRR542383 2 0.6438 0.773 0.164 0.836
#> SRR542384 2 0.5178 0.797 0.116 0.884
#> SRR542385 2 0.0000 0.832 0.000 1.000
#> SRR542386 2 0.0000 0.832 0.000 1.000
#> SRR542387 2 0.0000 0.832 0.000 1.000
#> SRR542388 2 0.0000 0.832 0.000 1.000
#> SRR542389 2 0.0000 0.832 0.000 1.000
#> SRR542390 2 0.0000 0.832 0.000 1.000
#> SRR542391 2 0.0000 0.832 0.000 1.000
#> SRR542392 2 0.0000 0.832 0.000 1.000
#> SRR542393 2 0.0000 0.832 0.000 1.000
#> SRR542394 2 0.0000 0.832 0.000 1.000
#> SRR542395 2 0.0376 0.831 0.004 0.996
#> SRR542396 2 0.0000 0.832 0.000 1.000
#> SRR542397 2 0.0000 0.832 0.000 1.000
#> SRR542398 2 0.0000 0.832 0.000 1.000
#> SRR542399 1 0.9580 1.000 0.620 0.380
#> SRR542400 1 0.9580 1.000 0.620 0.380
#> SRR542401 1 0.9580 1.000 0.620 0.380
#> SRR542402 1 0.9580 1.000 0.620 0.380
#> SRR542403 1 0.9580 1.000 0.620 0.380
#> SRR542404 1 0.9580 1.000 0.620 0.380
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> SRR542346 3 0.627 0.529 0.456 0.000 0.544
#> SRR542347 3 0.627 0.529 0.456 0.000 0.544
#> SRR542348 3 0.627 0.529 0.456 0.000 0.544
#> SRR542349 3 0.627 0.529 0.456 0.000 0.544
#> SRR542350 2 0.489 0.447 0.000 0.772 0.228
#> SRR542351 3 0.627 0.481 0.000 0.456 0.544
#> SRR542352 2 0.186 0.728 0.000 0.948 0.052
#> SRR542353 2 0.628 -0.320 0.000 0.540 0.460
#> SRR542354 3 0.627 0.481 0.000 0.456 0.544
#> SRR542355 3 0.927 0.564 0.232 0.240 0.528
#> SRR542356 3 0.628 0.473 0.000 0.460 0.540
#> SRR542357 2 0.435 0.535 0.000 0.816 0.184
#> SRR542358 2 0.484 0.455 0.000 0.776 0.224
#> SRR542359 3 0.627 0.481 0.000 0.456 0.544
#> SRR542360 3 0.856 0.555 0.352 0.108 0.540
#> SRR542361 1 0.939 -0.107 0.456 0.368 0.176
#> SRR542362 1 0.969 -0.176 0.456 0.296 0.248
#> SRR542363 3 0.649 0.526 0.456 0.004 0.540
#> SRR542364 2 0.000 0.778 0.000 1.000 0.000
#> SRR542365 2 0.000 0.778 0.000 1.000 0.000
#> SRR542366 2 0.000 0.778 0.000 1.000 0.000
#> SRR542367 2 0.000 0.778 0.000 1.000 0.000
#> SRR542368 2 0.000 0.778 0.000 1.000 0.000
#> SRR542369 2 0.000 0.778 0.000 1.000 0.000
#> SRR542370 2 0.000 0.778 0.000 1.000 0.000
#> SRR542371 2 0.000 0.778 0.000 1.000 0.000
#> SRR542372 2 0.000 0.778 0.000 1.000 0.000
#> SRR542373 2 0.719 0.378 0.080 0.696 0.224
#> SRR542374 3 0.664 0.488 0.008 0.448 0.544
#> SRR542375 2 0.610 0.415 0.392 0.608 0.000
#> SRR542376 1 0.964 -0.261 0.456 0.228 0.316
#> SRR542377 1 0.864 -0.198 0.456 0.444 0.100
#> SRR542378 2 0.627 0.314 0.456 0.544 0.000
#> SRR542379 2 0.627 0.314 0.456 0.544 0.000
#> SRR542380 2 0.627 0.314 0.456 0.544 0.000
#> SRR542381 2 0.613 0.407 0.400 0.600 0.000
#> SRR542382 2 0.627 0.314 0.456 0.544 0.000
#> SRR542383 2 0.627 0.314 0.456 0.544 0.000
#> SRR542384 2 0.597 0.449 0.364 0.636 0.000
#> SRR542385 2 0.000 0.778 0.000 1.000 0.000
#> SRR542386 2 0.000 0.778 0.000 1.000 0.000
#> SRR542387 2 0.000 0.778 0.000 1.000 0.000
#> SRR542388 2 0.000 0.778 0.000 1.000 0.000
#> SRR542389 2 0.000 0.778 0.000 1.000 0.000
#> SRR542390 2 0.000 0.778 0.000 1.000 0.000
#> SRR542391 2 0.000 0.778 0.000 1.000 0.000
#> SRR542392 2 0.000 0.778 0.000 1.000 0.000
#> SRR542393 2 0.000 0.778 0.000 1.000 0.000
#> SRR542394 2 0.000 0.778 0.000 1.000 0.000
#> SRR542395 2 0.460 0.619 0.204 0.796 0.000
#> SRR542396 2 0.334 0.700 0.120 0.880 0.000
#> SRR542397 2 0.000 0.778 0.000 1.000 0.000
#> SRR542398 2 0.355 0.690 0.132 0.868 0.000
#> SRR542399 1 0.627 0.539 0.544 0.000 0.456
#> SRR542400 1 0.627 0.539 0.544 0.000 0.456
#> SRR542401 1 0.627 0.539 0.544 0.000 0.456
#> SRR542402 1 0.627 0.539 0.544 0.000 0.456
#> SRR542403 1 0.627 0.539 0.544 0.000 0.456
#> SRR542404 1 0.627 0.539 0.544 0.000 0.456
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> SRR542346 3 0.4790 0.5295 0 0.000 0.620 0.380
#> SRR542347 3 0.4817 0.5176 0 0.000 0.612 0.388
#> SRR542348 3 0.4776 0.5329 0 0.000 0.624 0.376
#> SRR542349 4 0.2973 0.6684 0 0.000 0.144 0.856
#> SRR542350 2 0.4877 0.3097 0 0.592 0.408 0.000
#> SRR542351 3 0.0000 0.7549 0 0.000 1.000 0.000
#> SRR542352 2 0.0817 0.8646 0 0.976 0.024 0.000
#> SRR542353 3 0.4585 0.4204 0 0.332 0.668 0.000
#> SRR542354 3 0.0188 0.7549 0 0.004 0.996 0.000
#> SRR542355 4 0.5159 0.5235 0 0.012 0.364 0.624
#> SRR542356 3 0.0336 0.7533 0 0.008 0.992 0.000
#> SRR542357 2 0.4713 0.5663 0 0.640 0.360 0.000
#> SRR542358 2 0.1022 0.8607 0 0.968 0.032 0.000
#> SRR542359 3 0.0707 0.7509 0 0.020 0.980 0.000
#> SRR542360 4 0.4877 0.4742 0 0.000 0.408 0.592
#> SRR542361 4 0.0000 0.7895 0 0.000 0.000 1.000
#> SRR542362 4 0.0188 0.7876 0 0.004 0.000 0.996
#> SRR542363 4 0.2921 0.6735 0 0.000 0.140 0.860
#> SRR542364 2 0.1792 0.8542 0 0.932 0.068 0.000
#> SRR542365 2 0.0000 0.8716 0 1.000 0.000 0.000
#> SRR542366 2 0.0469 0.8722 0 0.988 0.012 0.000
#> SRR542367 2 0.1867 0.8525 0 0.928 0.072 0.000
#> SRR542368 2 0.0921 0.8700 0 0.972 0.028 0.000
#> SRR542369 2 0.0000 0.8716 0 1.000 0.000 0.000
#> SRR542370 2 0.0469 0.8717 0 0.988 0.012 0.000
#> SRR542371 2 0.3873 0.7417 0 0.772 0.228 0.000
#> SRR542372 2 0.1867 0.8525 0 0.928 0.072 0.000
#> SRR542373 2 0.4807 0.6732 0 0.728 0.248 0.024
#> SRR542374 3 0.0000 0.7549 0 0.000 1.000 0.000
#> SRR542375 4 0.3583 0.7258 0 0.004 0.180 0.816
#> SRR542376 4 0.0000 0.7895 0 0.000 0.000 1.000
#> SRR542377 4 0.0000 0.7895 0 0.000 0.000 1.000
#> SRR542378 4 0.0000 0.7895 0 0.000 0.000 1.000
#> SRR542379 4 0.0000 0.7895 0 0.000 0.000 1.000
#> SRR542380 4 0.0000 0.7895 0 0.000 0.000 1.000
#> SRR542381 4 0.5417 0.6780 0 0.088 0.180 0.732
#> SRR542382 4 0.3172 0.7387 0 0.000 0.160 0.840
#> SRR542383 4 0.0000 0.7895 0 0.000 0.000 1.000
#> SRR542384 4 0.5650 0.6639 0 0.104 0.180 0.716
#> SRR542385 2 0.0000 0.8716 0 1.000 0.000 0.000
#> SRR542386 2 0.0707 0.8710 0 0.980 0.020 0.000
#> SRR542387 2 0.4267 0.7418 0 0.788 0.188 0.024
#> SRR542388 2 0.0469 0.8722 0 0.988 0.012 0.000
#> SRR542389 2 0.0336 0.8697 0 0.992 0.008 0.000
#> SRR542390 2 0.0000 0.8716 0 1.000 0.000 0.000
#> SRR542391 2 0.0000 0.8716 0 1.000 0.000 0.000
#> SRR542392 2 0.2973 0.7958 0 0.856 0.144 0.000
#> SRR542393 2 0.0188 0.8723 0 0.996 0.004 0.000
#> SRR542394 2 0.6936 0.4494 0 0.588 0.188 0.224
#> SRR542395 4 0.6550 0.5726 0 0.184 0.180 0.636
#> SRR542396 2 0.7564 -0.0916 0 0.420 0.192 0.388
#> SRR542397 2 0.0000 0.8716 0 1.000 0.000 0.000
#> SRR542398 4 0.5913 0.4519 0 0.352 0.048 0.600
#> SRR542399 1 0.0000 1.0000 1 0.000 0.000 0.000
#> SRR542400 1 0.0000 1.0000 1 0.000 0.000 0.000
#> SRR542401 1 0.0000 1.0000 1 0.000 0.000 0.000
#> SRR542402 1 0.0000 1.0000 1 0.000 0.000 0.000
#> SRR542403 1 0.0000 1.0000 1 0.000 0.000 0.000
#> SRR542404 1 0.0000 1.0000 1 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
#> SRR542346 3 0.3534 0.6792 0 0.000 0.744 0.256 0.000
#> SRR542347 3 0.3857 0.6056 0 0.000 0.688 0.312 0.000
#> SRR542348 3 0.3143 0.7220 0 0.000 0.796 0.204 0.000
#> SRR542349 4 0.3684 0.4991 0 0.000 0.280 0.720 0.000
#> SRR542350 5 0.5656 0.5177 0 0.140 0.236 0.000 0.624
#> SRR542351 3 0.0880 0.8017 0 0.000 0.968 0.000 0.032
#> SRR542352 2 0.3957 0.4654 0 0.712 0.008 0.000 0.280
#> SRR542353 3 0.4878 0.1604 0 0.024 0.536 0.000 0.440
#> SRR542354 3 0.1522 0.7969 0 0.012 0.944 0.000 0.044
#> SRR542355 4 0.6356 0.6006 0 0.060 0.140 0.640 0.160
#> SRR542356 3 0.2153 0.7797 0 0.040 0.916 0.000 0.044
#> SRR542357 2 0.4386 0.5418 0 0.764 0.096 0.000 0.140
#> SRR542358 5 0.3957 0.5964 0 0.280 0.008 0.000 0.712
#> SRR542359 3 0.0290 0.7982 0 0.000 0.992 0.000 0.008
#> SRR542360 4 0.6123 0.3383 0 0.024 0.412 0.496 0.068
#> SRR542361 4 0.0000 0.7978 0 0.000 0.000 1.000 0.000
#> SRR542362 4 0.0324 0.7960 0 0.004 0.000 0.992 0.004
#> SRR542363 4 0.3661 0.5063 0 0.000 0.276 0.724 0.000
#> SRR542364 2 0.1582 0.6854 0 0.944 0.028 0.000 0.028
#> SRR542365 2 0.1671 0.6811 0 0.924 0.000 0.000 0.076
#> SRR542366 2 0.1851 0.6729 0 0.912 0.000 0.000 0.088
#> SRR542367 2 0.0162 0.6900 0 0.996 0.000 0.000 0.004
#> SRR542368 2 0.1908 0.6708 0 0.908 0.000 0.000 0.092
#> SRR542369 2 0.3480 0.5033 0 0.752 0.000 0.000 0.248
#> SRR542370 2 0.1341 0.6816 0 0.944 0.000 0.000 0.056
#> SRR542371 2 0.2228 0.6665 0 0.912 0.048 0.000 0.040
#> SRR542372 2 0.0000 0.6903 0 1.000 0.000 0.000 0.000
#> SRR542373 2 0.5328 0.4993 0 0.720 0.160 0.036 0.084
#> SRR542374 3 0.0609 0.8017 0 0.000 0.980 0.000 0.020
#> SRR542375 4 0.3255 0.7697 0 0.024 0.040 0.868 0.068
#> SRR542376 4 0.0000 0.7978 0 0.000 0.000 1.000 0.000
#> SRR542377 4 0.0000 0.7978 0 0.000 0.000 1.000 0.000
#> SRR542378 4 0.0162 0.7980 0 0.000 0.000 0.996 0.004
#> SRR542379 4 0.0000 0.7978 0 0.000 0.000 1.000 0.000
#> SRR542380 4 0.1121 0.7942 0 0.000 0.000 0.956 0.044
#> SRR542381 4 0.4409 0.7363 0 0.092 0.040 0.800 0.068
#> SRR542382 4 0.2036 0.7865 0 0.000 0.024 0.920 0.056
#> SRR542383 4 0.0000 0.7978 0 0.000 0.000 1.000 0.000
#> SRR542384 4 0.4806 0.7172 0 0.112 0.048 0.772 0.068
#> SRR542385 5 0.2179 0.7073 0 0.112 0.000 0.000 0.888
#> SRR542386 2 0.3837 0.5036 0 0.692 0.000 0.000 0.308
#> SRR542387 2 0.4839 0.4909 0 0.660 0.024 0.012 0.304
#> SRR542388 5 0.3796 0.5077 0 0.300 0.000 0.000 0.700
#> SRR542389 5 0.4046 0.5986 0 0.296 0.008 0.000 0.696
#> SRR542390 5 0.3143 0.7001 0 0.204 0.000 0.000 0.796
#> SRR542391 5 0.2179 0.7073 0 0.112 0.000 0.000 0.888
#> SRR542392 2 0.4639 0.4505 0 0.632 0.024 0.000 0.344
#> SRR542393 2 0.4235 -0.0130 0 0.576 0.000 0.000 0.424
#> SRR542394 2 0.5733 0.4458 0 0.656 0.024 0.092 0.228
#> SRR542395 4 0.5973 0.5733 0 0.100 0.024 0.624 0.252
#> SRR542396 2 0.7200 0.2586 0 0.480 0.044 0.180 0.296
#> SRR542397 5 0.3837 0.5206 0 0.308 0.000 0.000 0.692
#> SRR542398 4 0.6844 -0.0836 0 0.364 0.004 0.388 0.244
#> SRR542399 1 0.0000 1.0000 1 0.000 0.000 0.000 0.000
#> SRR542400 1 0.0000 1.0000 1 0.000 0.000 0.000 0.000
#> SRR542401 1 0.0000 1.0000 1 0.000 0.000 0.000 0.000
#> SRR542402 1 0.0000 1.0000 1 0.000 0.000 0.000 0.000
#> SRR542403 1 0.0000 1.0000 1 0.000 0.000 0.000 0.000
#> SRR542404 1 0.0000 1.0000 1 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
#> SRR542346 4 0.2179 0.76860 0 0.000 0.036 0.900 0.064 0.000
#> SRR542347 4 0.2260 0.81141 0 0.000 0.000 0.860 0.140 0.000
#> SRR542348 4 0.2537 0.68245 0 0.000 0.096 0.872 0.032 0.000
#> SRR542349 4 0.2454 0.80931 0 0.000 0.000 0.840 0.160 0.000
#> SRR542350 2 0.4334 0.62441 0 0.568 0.408 0.000 0.000 0.024
#> SRR542351 3 0.3706 0.57649 0 0.000 0.620 0.380 0.000 0.000
#> SRR542352 6 0.5990 -0.00788 0 0.264 0.296 0.000 0.000 0.440
#> SRR542353 3 0.3885 0.04995 0 0.192 0.756 0.048 0.000 0.004
#> SRR542354 3 0.3706 0.57649 0 0.000 0.620 0.380 0.000 0.000
#> SRR542355 3 0.5706 -0.22519 0 0.052 0.480 0.028 0.428 0.012
#> SRR542356 3 0.3695 0.57619 0 0.000 0.624 0.376 0.000 0.000
#> SRR542357 6 0.4949 0.53051 0 0.112 0.216 0.000 0.008 0.664
#> SRR542358 2 0.3634 0.71939 0 0.696 0.296 0.000 0.000 0.008
#> SRR542359 3 0.3866 0.38551 0 0.000 0.516 0.484 0.000 0.000
#> SRR542360 4 0.3679 0.49968 0 0.000 0.052 0.772 0.176 0.000
#> SRR542361 5 0.1714 0.86133 0 0.000 0.000 0.092 0.908 0.000
#> SRR542362 5 0.2001 0.85938 0 0.000 0.004 0.092 0.900 0.004
#> SRR542363 4 0.2454 0.80931 0 0.000 0.000 0.840 0.160 0.000
#> SRR542364 6 0.2585 0.66007 0 0.048 0.004 0.068 0.000 0.880
#> SRR542365 6 0.0937 0.68530 0 0.040 0.000 0.000 0.000 0.960
#> SRR542366 6 0.1007 0.67964 0 0.044 0.000 0.000 0.000 0.956
#> SRR542367 6 0.0291 0.68656 0 0.004 0.004 0.000 0.000 0.992
#> SRR542368 6 0.0508 0.68585 0 0.012 0.004 0.000 0.000 0.984
#> SRR542369 6 0.3175 0.50482 0 0.256 0.000 0.000 0.000 0.744
#> SRR542370 6 0.0363 0.68504 0 0.012 0.000 0.000 0.000 0.988
#> SRR542371 6 0.3389 0.65419 0 0.000 0.108 0.008 0.060 0.824
#> SRR542372 6 0.0146 0.68654 0 0.000 0.004 0.000 0.000 0.996
#> SRR542373 6 0.5648 0.50116 0 0.000 0.168 0.088 0.092 0.652
#> SRR542374 3 0.3717 0.57281 0 0.000 0.616 0.384 0.000 0.000
#> SRR542375 5 0.2747 0.77430 0 0.000 0.044 0.096 0.860 0.000
#> SRR542376 5 0.2003 0.84436 0 0.000 0.000 0.116 0.884 0.000
#> SRR542377 5 0.1714 0.86133 0 0.000 0.000 0.092 0.908 0.000
#> SRR542378 5 0.1663 0.86244 0 0.000 0.000 0.088 0.912 0.000
#> SRR542379 5 0.1714 0.86133 0 0.000 0.000 0.092 0.908 0.000
#> SRR542380 5 0.0713 0.85280 0 0.000 0.000 0.028 0.972 0.000
#> SRR542381 5 0.3167 0.75446 0 0.000 0.072 0.096 0.832 0.000
#> SRR542382 5 0.0713 0.83293 0 0.000 0.000 0.028 0.972 0.000
#> SRR542383 5 0.1663 0.86232 0 0.000 0.000 0.088 0.912 0.000
#> SRR542384 5 0.2889 0.77246 0 0.000 0.044 0.096 0.856 0.004
#> SRR542385 2 0.0260 0.59281 0 0.992 0.000 0.000 0.000 0.008
#> SRR542386 6 0.4203 0.55048 0 0.316 0.032 0.000 0.000 0.652
#> SRR542387 6 0.6913 0.46978 0 0.304 0.084 0.028 0.092 0.492
#> SRR542388 2 0.3290 0.25906 0 0.744 0.004 0.000 0.000 0.252
#> SRR542389 2 0.3634 0.71939 0 0.696 0.296 0.000 0.000 0.008
#> SRR542390 2 0.3508 0.72188 0 0.704 0.292 0.000 0.000 0.004
#> SRR542391 2 0.3390 0.72082 0 0.704 0.296 0.000 0.000 0.000
#> SRR542392 6 0.5117 0.51540 0 0.336 0.076 0.000 0.008 0.580
#> SRR542393 6 0.3547 0.44474 0 0.332 0.000 0.000 0.000 0.668
#> SRR542394 6 0.5607 0.51461 0 0.312 0.080 0.000 0.036 0.572
#> SRR542395 5 0.5545 0.52009 0 0.248 0.080 0.024 0.632 0.016
#> SRR542396 6 0.8143 0.34863 0 0.304 0.080 0.096 0.172 0.348
#> SRR542397 2 0.2902 0.36612 0 0.800 0.004 0.000 0.000 0.196
#> SRR542398 6 0.7305 0.25058 0 0.312 0.056 0.016 0.260 0.356
#> SRR542399 1 0.0000 1.00000 1 0.000 0.000 0.000 0.000 0.000
#> SRR542400 1 0.0000 1.00000 1 0.000 0.000 0.000 0.000 0.000
#> SRR542401 1 0.0000 1.00000 1 0.000 0.000 0.000 0.000 0.000
#> SRR542402 1 0.0000 1.00000 1 0.000 0.000 0.000 0.000 0.000
#> SRR542403 1 0.0000 1.00000 1 0.000 0.000 0.000 0.000 0.000
#> SRR542404 1 0.0000 1.00000 1 0.000 0.000 0.000 0.000 0.000
Heatmaps for the consensus matrix. It visualizes the probability of two samples to be in a same group.
consensus_heatmap(res, k = 2)
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 16804 rows and 59 columns.
#> Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'SD' method.
#> Subgroups are detected by 'mclust' method.
#> Performed in total 1250 partitions by row resampling.
#> Best k for subgroups seems to be 4.
#>
#> Following methods can be applied to this 'ConsensusPartition' object:
#> [1] "cola_report" "collect_classes" "collect_plots"
#> [4] "collect_stats" "colnames" "compare_signatures"
#> [7] "consensus_heatmap" "dimension_reduction" "functional_enrichment"
#> [10] "get_anno_col" "get_anno" "get_classes"
#> [13] "get_consensus" "get_matrix" "get_membership"
#> [16] "get_param" "get_signatures" "get_stats"
#> [19] "is_best_k" "is_stable_k" "membership_heatmap"
#> [22] "ncol" "nrow" "plot_ecdf"
#> [25] "rownames" "select_partition_number" "show"
#> [28] "suggest_best_k" "test_to_known_factors"
collect_plots()
function collects all the plots made from res
for all k
(number of partitions)
into one single page to provide an easy and fast comparison between different k
.
collect_plots(res)
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.592 0.808 0.908 0.3168 0.737 0.737
#> 3 3 0.509 0.679 0.852 0.7841 0.583 0.464
#> 4 4 0.908 0.926 0.949 0.1505 0.795 0.576
#> 5 5 0.790 0.852 0.908 0.0835 0.960 0.889
#> 6 6 0.829 0.843 0.906 0.1291 0.867 0.603
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
#> SRR542346 2 0.8608 0.679 0.284 0.716
#> SRR542347 2 0.8608 0.679 0.284 0.716
#> SRR542348 2 0.8608 0.679 0.284 0.716
#> SRR542349 2 0.8608 0.679 0.284 0.716
#> SRR542350 2 0.0000 0.888 0.000 1.000
#> SRR542351 2 0.1414 0.874 0.020 0.980
#> SRR542352 2 0.0000 0.888 0.000 1.000
#> SRR542353 2 0.0000 0.888 0.000 1.000
#> SRR542354 2 0.0000 0.888 0.000 1.000
#> SRR542355 2 0.0000 0.888 0.000 1.000
#> SRR542356 2 0.0000 0.888 0.000 1.000
#> SRR542357 2 0.0000 0.888 0.000 1.000
#> SRR542358 2 0.0000 0.888 0.000 1.000
#> SRR542359 2 0.2043 0.864 0.032 0.968
#> SRR542360 2 0.0000 0.888 0.000 1.000
#> SRR542361 2 0.8608 0.679 0.284 0.716
#> SRR542362 2 0.8608 0.679 0.284 0.716
#> SRR542363 2 0.8608 0.679 0.284 0.716
#> SRR542364 2 0.0000 0.888 0.000 1.000
#> SRR542365 2 0.0000 0.888 0.000 1.000
#> SRR542366 2 0.0000 0.888 0.000 1.000
#> SRR542367 2 0.0000 0.888 0.000 1.000
#> SRR542368 1 0.9000 0.609 0.684 0.316
#> SRR542369 2 0.0000 0.888 0.000 1.000
#> SRR542370 2 0.0000 0.888 0.000 1.000
#> SRR542371 2 0.0000 0.888 0.000 1.000
#> SRR542372 2 0.0000 0.888 0.000 1.000
#> SRR542373 2 0.0000 0.888 0.000 1.000
#> SRR542374 2 0.1414 0.874 0.020 0.980
#> SRR542375 2 0.0000 0.888 0.000 1.000
#> SRR542376 2 0.8608 0.679 0.284 0.716
#> SRR542377 2 0.8608 0.679 0.284 0.716
#> SRR542378 2 0.8608 0.679 0.284 0.716
#> SRR542379 2 0.8608 0.679 0.284 0.716
#> SRR542380 2 0.8608 0.679 0.284 0.716
#> SRR542381 2 0.0000 0.888 0.000 1.000
#> SRR542382 2 0.8608 0.679 0.284 0.716
#> SRR542383 2 0.8608 0.679 0.284 0.716
#> SRR542384 2 0.0000 0.888 0.000 1.000
#> SRR542385 2 0.0000 0.888 0.000 1.000
#> SRR542386 2 0.0938 0.879 0.012 0.988
#> SRR542387 2 0.0000 0.888 0.000 1.000
#> SRR542388 2 0.7139 0.634 0.196 0.804
#> SRR542389 2 0.0000 0.888 0.000 1.000
#> SRR542390 2 0.0000 0.888 0.000 1.000
#> SRR542391 2 0.0000 0.888 0.000 1.000
#> SRR542392 1 0.9922 0.410 0.552 0.448
#> SRR542393 2 0.0000 0.888 0.000 1.000
#> SRR542394 2 0.0000 0.888 0.000 1.000
#> SRR542395 2 0.0000 0.888 0.000 1.000
#> SRR542396 2 0.0000 0.888 0.000 1.000
#> SRR542397 2 0.0000 0.888 0.000 1.000
#> SRR542398 1 0.9775 0.487 0.588 0.412
#> SRR542399 1 0.0000 0.838 1.000 0.000
#> SRR542400 1 0.0000 0.838 1.000 0.000
#> SRR542401 1 0.0000 0.838 1.000 0.000
#> SRR542402 1 0.0000 0.838 1.000 0.000
#> SRR542403 1 0.0000 0.838 1.000 0.000
#> SRR542404 1 0.0000 0.838 1.000 0.000
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> SRR542346 3 0.0000 0.7485 0.000 0.000 1.000
#> SRR542347 3 0.0000 0.7485 0.000 0.000 1.000
#> SRR542348 3 0.0000 0.7485 0.000 0.000 1.000
#> SRR542349 3 0.0000 0.7485 0.000 0.000 1.000
#> SRR542350 3 0.6111 0.4540 0.000 0.396 0.604
#> SRR542351 3 0.6034 0.6546 0.036 0.212 0.752
#> SRR542352 2 0.0424 0.8088 0.000 0.992 0.008
#> SRR542353 3 0.6111 0.4540 0.000 0.396 0.604
#> SRR542354 3 0.7123 0.4869 0.032 0.364 0.604
#> SRR542355 3 0.6225 0.4163 0.000 0.432 0.568
#> SRR542356 3 0.6832 0.4759 0.020 0.376 0.604
#> SRR542357 2 0.1411 0.7922 0.000 0.964 0.036
#> SRR542358 2 0.5706 0.4770 0.000 0.680 0.320
#> SRR542359 3 0.6034 0.6546 0.036 0.212 0.752
#> SRR542360 3 0.5621 0.5979 0.000 0.308 0.692
#> SRR542361 3 0.1411 0.7574 0.000 0.036 0.964
#> SRR542362 3 0.0747 0.7545 0.000 0.016 0.984
#> SRR542363 3 0.1411 0.7574 0.000 0.036 0.964
#> SRR542364 2 0.0592 0.8071 0.000 0.988 0.012
#> SRR542365 2 0.0000 0.8090 0.000 1.000 0.000
#> SRR542366 2 0.0592 0.8071 0.000 0.988 0.012
#> SRR542367 2 0.0000 0.8090 0.000 1.000 0.000
#> SRR542368 2 0.9277 0.2887 0.176 0.496 0.328
#> SRR542369 2 0.0000 0.8090 0.000 1.000 0.000
#> SRR542370 2 0.0000 0.8090 0.000 1.000 0.000
#> SRR542371 2 0.0747 0.8059 0.000 0.984 0.016
#> SRR542372 2 0.0000 0.8090 0.000 1.000 0.000
#> SRR542373 2 0.3879 0.6600 0.000 0.848 0.152
#> SRR542374 3 0.6698 0.5957 0.036 0.280 0.684
#> SRR542375 3 0.6008 0.5274 0.000 0.372 0.628
#> SRR542376 3 0.1411 0.7574 0.000 0.036 0.964
#> SRR542377 3 0.0237 0.7507 0.000 0.004 0.996
#> SRR542378 3 0.1411 0.7574 0.000 0.036 0.964
#> SRR542379 3 0.1411 0.7574 0.000 0.036 0.964
#> SRR542380 3 0.1411 0.7574 0.000 0.036 0.964
#> SRR542381 3 0.6299 0.2900 0.000 0.476 0.524
#> SRR542382 3 0.2796 0.7440 0.000 0.092 0.908
#> SRR542383 3 0.1411 0.7574 0.000 0.036 0.964
#> SRR542384 2 0.6225 0.0505 0.000 0.568 0.432
#> SRR542385 2 0.0000 0.8090 0.000 1.000 0.000
#> SRR542386 2 0.7283 0.5092 0.068 0.672 0.260
#> SRR542387 3 0.6286 0.3271 0.000 0.464 0.536
#> SRR542388 2 0.9030 0.3263 0.152 0.520 0.328
#> SRR542389 2 0.1031 0.8031 0.000 0.976 0.024
#> SRR542390 2 0.0000 0.8090 0.000 1.000 0.000
#> SRR542391 2 0.0424 0.8083 0.000 0.992 0.008
#> SRR542392 2 0.9030 0.3263 0.152 0.520 0.328
#> SRR542393 2 0.0000 0.8090 0.000 1.000 0.000
#> SRR542394 2 0.0424 0.8085 0.000 0.992 0.008
#> SRR542395 2 0.5650 0.4503 0.000 0.688 0.312
#> SRR542396 2 0.5621 0.4592 0.000 0.692 0.308
#> SRR542397 2 0.0000 0.8090 0.000 1.000 0.000
#> SRR542398 2 0.9030 0.3263 0.152 0.520 0.328
#> SRR542399 1 0.0000 1.0000 1.000 0.000 0.000
#> SRR542400 1 0.0000 1.0000 1.000 0.000 0.000
#> SRR542401 1 0.0000 1.0000 1.000 0.000 0.000
#> SRR542402 1 0.0000 1.0000 1.000 0.000 0.000
#> SRR542403 1 0.0000 1.0000 1.000 0.000 0.000
#> SRR542404 1 0.0000 1.0000 1.000 0.000 0.000
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> SRR542346 3 0.3024 0.836 0.000 0.000 0.852 0.148
#> SRR542347 3 0.3024 0.836 0.000 0.000 0.852 0.148
#> SRR542348 3 0.3024 0.836 0.000 0.000 0.852 0.148
#> SRR542349 3 0.3486 0.795 0.000 0.000 0.812 0.188
#> SRR542350 3 0.1637 0.888 0.000 0.060 0.940 0.000
#> SRR542351 3 0.1389 0.901 0.000 0.048 0.952 0.000
#> SRR542352 2 0.0592 0.951 0.000 0.984 0.016 0.000
#> SRR542353 3 0.1557 0.891 0.000 0.056 0.944 0.000
#> SRR542354 3 0.1389 0.901 0.000 0.048 0.952 0.000
#> SRR542355 2 0.3837 0.746 0.000 0.776 0.224 0.000
#> SRR542356 3 0.1474 0.899 0.000 0.052 0.948 0.000
#> SRR542357 2 0.2973 0.850 0.000 0.856 0.144 0.000
#> SRR542358 2 0.0592 0.951 0.000 0.984 0.016 0.000
#> SRR542359 3 0.1474 0.899 0.000 0.052 0.948 0.000
#> SRR542360 2 0.5396 0.702 0.000 0.740 0.156 0.104
#> SRR542361 4 0.1302 0.943 0.000 0.044 0.000 0.956
#> SRR542362 4 0.1489 0.943 0.000 0.044 0.004 0.952
#> SRR542363 4 0.1888 0.938 0.000 0.044 0.016 0.940
#> SRR542364 2 0.0707 0.948 0.000 0.980 0.020 0.000
#> SRR542365 2 0.0469 0.951 0.000 0.988 0.012 0.000
#> SRR542366 2 0.0469 0.950 0.000 0.988 0.012 0.000
#> SRR542367 2 0.0336 0.953 0.000 0.992 0.000 0.008
#> SRR542368 2 0.0000 0.952 0.000 1.000 0.000 0.000
#> SRR542369 2 0.0469 0.951 0.000 0.988 0.012 0.000
#> SRR542370 2 0.0469 0.951 0.000 0.988 0.012 0.000
#> SRR542371 2 0.2002 0.941 0.000 0.936 0.020 0.044
#> SRR542372 2 0.0336 0.953 0.000 0.992 0.000 0.008
#> SRR542373 2 0.1792 0.921 0.000 0.932 0.068 0.000
#> SRR542374 3 0.1389 0.901 0.000 0.048 0.952 0.000
#> SRR542375 2 0.3606 0.864 0.000 0.840 0.020 0.140
#> SRR542376 4 0.0188 0.952 0.000 0.004 0.000 0.996
#> SRR542377 4 0.1489 0.943 0.000 0.044 0.004 0.952
#> SRR542378 4 0.0000 0.952 0.000 0.000 0.000 1.000
#> SRR542379 4 0.0000 0.952 0.000 0.000 0.000 1.000
#> SRR542380 4 0.0000 0.952 0.000 0.000 0.000 1.000
#> SRR542381 2 0.2256 0.936 0.000 0.924 0.020 0.056
#> SRR542382 4 0.2266 0.855 0.000 0.084 0.004 0.912
#> SRR542383 4 0.0000 0.952 0.000 0.000 0.000 1.000
#> SRR542384 2 0.2002 0.941 0.000 0.936 0.020 0.044
#> SRR542385 2 0.1489 0.944 0.000 0.952 0.004 0.044
#> SRR542386 2 0.1302 0.944 0.000 0.956 0.000 0.044
#> SRR542387 2 0.0707 0.948 0.000 0.980 0.020 0.000
#> SRR542388 2 0.0336 0.952 0.000 0.992 0.008 0.000
#> SRR542389 2 0.0592 0.951 0.000 0.984 0.016 0.000
#> SRR542390 2 0.1059 0.951 0.000 0.972 0.012 0.016
#> SRR542391 2 0.0592 0.951 0.000 0.984 0.016 0.000
#> SRR542392 2 0.0000 0.952 0.000 1.000 0.000 0.000
#> SRR542393 2 0.0469 0.951 0.000 0.988 0.012 0.000
#> SRR542394 2 0.1302 0.944 0.000 0.956 0.000 0.044
#> SRR542395 2 0.2002 0.941 0.000 0.936 0.020 0.044
#> SRR542396 2 0.2002 0.941 0.000 0.936 0.020 0.044
#> SRR542397 2 0.1677 0.944 0.000 0.948 0.012 0.040
#> SRR542398 2 0.1302 0.944 0.000 0.956 0.000 0.044
#> SRR542399 1 0.0000 0.997 1.000 0.000 0.000 0.000
#> SRR542400 1 0.0000 0.997 1.000 0.000 0.000 0.000
#> SRR542401 1 0.0000 0.997 1.000 0.000 0.000 0.000
#> SRR542402 1 0.0000 0.997 1.000 0.000 0.000 0.000
#> SRR542403 1 0.0336 0.986 0.992 0.008 0.000 0.000
#> SRR542404 1 0.0000 0.997 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
#> SRR542346 5 0.2852 1.000 0 0.000 0.172 0.000 0.828
#> SRR542347 5 0.2852 1.000 0 0.000 0.172 0.000 0.828
#> SRR542348 5 0.2852 1.000 0 0.000 0.172 0.000 0.828
#> SRR542349 5 0.2852 1.000 0 0.000 0.172 0.000 0.828
#> SRR542350 3 0.0404 0.987 0 0.000 0.988 0.000 0.012
#> SRR542351 3 0.0000 0.995 0 0.000 1.000 0.000 0.000
#> SRR542352 2 0.0290 0.882 0 0.992 0.008 0.000 0.000
#> SRR542353 3 0.0404 0.987 0 0.000 0.988 0.000 0.012
#> SRR542354 3 0.0000 0.995 0 0.000 1.000 0.000 0.000
#> SRR542355 2 0.7245 0.282 0 0.488 0.316 0.080 0.116
#> SRR542356 3 0.0000 0.995 0 0.000 1.000 0.000 0.000
#> SRR542357 2 0.5507 0.466 0 0.596 0.316 0.000 0.088
#> SRR542358 2 0.1012 0.873 0 0.968 0.020 0.000 0.012
#> SRR542359 3 0.0000 0.995 0 0.000 1.000 0.000 0.000
#> SRR542360 2 0.8259 0.127 0 0.400 0.200 0.176 0.224
#> SRR542361 4 0.2690 0.812 0 0.000 0.000 0.844 0.156
#> SRR542362 4 0.2813 0.806 0 0.000 0.000 0.832 0.168
#> SRR542363 4 0.3730 0.705 0 0.000 0.000 0.712 0.288
#> SRR542364 2 0.1478 0.869 0 0.936 0.000 0.000 0.064
#> SRR542365 2 0.0000 0.884 0 1.000 0.000 0.000 0.000
#> SRR542366 2 0.1851 0.859 0 0.912 0.000 0.000 0.088
#> SRR542367 2 0.0162 0.884 0 0.996 0.000 0.004 0.000
#> SRR542368 2 0.0000 0.884 0 1.000 0.000 0.000 0.000
#> SRR542369 2 0.0000 0.884 0 1.000 0.000 0.000 0.000
#> SRR542370 2 0.0000 0.884 0 1.000 0.000 0.000 0.000
#> SRR542371 2 0.2732 0.830 0 0.840 0.000 0.160 0.000
#> SRR542372 2 0.0000 0.884 0 1.000 0.000 0.000 0.000
#> SRR542373 2 0.3159 0.825 0 0.856 0.056 0.000 0.088
#> SRR542374 3 0.0000 0.995 0 0.000 1.000 0.000 0.000
#> SRR542375 4 0.3752 0.443 0 0.292 0.000 0.708 0.000
#> SRR542376 4 0.1608 0.842 0 0.000 0.000 0.928 0.072
#> SRR542377 4 0.2813 0.807 0 0.000 0.000 0.832 0.168
#> SRR542378 4 0.0000 0.853 0 0.000 0.000 1.000 0.000
#> SRR542379 4 0.0000 0.853 0 0.000 0.000 1.000 0.000
#> SRR542380 4 0.0000 0.853 0 0.000 0.000 1.000 0.000
#> SRR542381 2 0.4235 0.428 0 0.576 0.000 0.424 0.000
#> SRR542382 4 0.0000 0.853 0 0.000 0.000 1.000 0.000
#> SRR542383 4 0.0000 0.853 0 0.000 0.000 1.000 0.000
#> SRR542384 2 0.2852 0.821 0 0.828 0.000 0.172 0.000
#> SRR542385 2 0.1908 0.860 0 0.908 0.000 0.092 0.000
#> SRR542386 2 0.2377 0.846 0 0.872 0.000 0.128 0.000
#> SRR542387 2 0.1851 0.859 0 0.912 0.000 0.000 0.088
#> SRR542388 2 0.0000 0.884 0 1.000 0.000 0.000 0.000
#> SRR542389 2 0.0000 0.884 0 1.000 0.000 0.000 0.000
#> SRR542390 2 0.0162 0.884 0 0.996 0.000 0.004 0.000
#> SRR542391 2 0.0000 0.884 0 1.000 0.000 0.000 0.000
#> SRR542392 2 0.0510 0.883 0 0.984 0.000 0.016 0.000
#> SRR542393 2 0.0000 0.884 0 1.000 0.000 0.000 0.000
#> SRR542394 2 0.2732 0.830 0 0.840 0.000 0.160 0.000
#> SRR542395 2 0.2732 0.830 0 0.840 0.000 0.160 0.000
#> SRR542396 2 0.2732 0.830 0 0.840 0.000 0.160 0.000
#> SRR542397 2 0.0404 0.883 0 0.988 0.000 0.012 0.000
#> SRR542398 2 0.2813 0.824 0 0.832 0.000 0.168 0.000
#> SRR542399 1 0.0000 1.000 1 0.000 0.000 0.000 0.000
#> SRR542400 1 0.0000 1.000 1 0.000 0.000 0.000 0.000
#> SRR542401 1 0.0000 1.000 1 0.000 0.000 0.000 0.000
#> SRR542402 1 0.0000 1.000 1 0.000 0.000 0.000 0.000
#> SRR542403 1 0.0000 1.000 1 0.000 0.000 0.000 0.000
#> SRR542404 1 0.0000 1.000 1 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
#> SRR542346 6 0.0146 0.877 0 0.000 0.000 0.004 0.000 0.996
#> SRR542347 6 0.0146 0.877 0 0.000 0.000 0.004 0.000 0.996
#> SRR542348 6 0.0146 0.877 0 0.000 0.000 0.004 0.000 0.996
#> SRR542349 6 0.0146 0.877 0 0.000 0.000 0.004 0.000 0.996
#> SRR542350 3 0.1967 0.870 0 0.084 0.904 0.000 0.012 0.000
#> SRR542351 3 0.0458 0.943 0 0.000 0.984 0.000 0.016 0.000
#> SRR542352 2 0.1564 0.828 0 0.936 0.040 0.000 0.024 0.000
#> SRR542353 3 0.1967 0.870 0 0.084 0.904 0.000 0.012 0.000
#> SRR542354 3 0.0458 0.943 0 0.000 0.984 0.000 0.016 0.000
#> SRR542355 2 0.4322 0.498 0 0.600 0.372 0.000 0.028 0.000
#> SRR542356 3 0.0692 0.942 0 0.004 0.976 0.000 0.020 0.000
#> SRR542357 2 0.4378 0.500 0 0.600 0.368 0.000 0.032 0.000
#> SRR542358 2 0.1616 0.824 0 0.932 0.048 0.000 0.020 0.000
#> SRR542359 3 0.0837 0.941 0 0.004 0.972 0.000 0.020 0.004
#> SRR542360 6 0.7137 0.328 0 0.124 0.252 0.068 0.048 0.508
#> SRR542361 4 0.0000 0.947 0 0.000 0.000 1.000 0.000 0.000
#> SRR542362 4 0.0000 0.947 0 0.000 0.000 1.000 0.000 0.000
#> SRR542363 4 0.2697 0.757 0 0.000 0.000 0.812 0.000 0.188
#> SRR542364 2 0.3742 0.624 0 0.648 0.000 0.000 0.348 0.004
#> SRR542365 2 0.0146 0.821 0 0.996 0.000 0.000 0.004 0.000
#> SRR542366 2 0.3607 0.622 0 0.652 0.000 0.000 0.348 0.000
#> SRR542367 2 0.3482 0.660 0 0.684 0.000 0.000 0.316 0.000
#> SRR542368 2 0.1327 0.829 0 0.936 0.000 0.000 0.064 0.000
#> SRR542369 2 0.0622 0.828 0 0.980 0.008 0.000 0.012 0.000
#> SRR542370 2 0.0000 0.823 0 1.000 0.000 0.000 0.000 0.000
#> SRR542371 5 0.1219 0.928 0 0.048 0.000 0.000 0.948 0.004
#> SRR542372 2 0.3383 0.708 0 0.728 0.000 0.000 0.268 0.004
#> SRR542373 2 0.4713 0.619 0 0.620 0.056 0.000 0.320 0.004
#> SRR542374 3 0.0458 0.943 0 0.000 0.984 0.000 0.016 0.000
#> SRR542375 5 0.1434 0.899 0 0.012 0.000 0.048 0.940 0.000
#> SRR542376 4 0.0000 0.947 0 0.000 0.000 1.000 0.000 0.000
#> SRR542377 4 0.0260 0.944 0 0.000 0.000 0.992 0.000 0.008
#> SRR542378 4 0.0458 0.944 0 0.000 0.000 0.984 0.016 0.000
#> SRR542379 4 0.0000 0.947 0 0.000 0.000 1.000 0.000 0.000
#> SRR542380 4 0.0458 0.944 0 0.000 0.000 0.984 0.016 0.000
#> SRR542381 5 0.0458 0.933 0 0.016 0.000 0.000 0.984 0.000
#> SRR542382 4 0.2805 0.762 0 0.004 0.000 0.812 0.184 0.000
#> SRR542383 4 0.0458 0.944 0 0.000 0.000 0.984 0.016 0.000
#> SRR542384 5 0.0458 0.933 0 0.016 0.000 0.000 0.984 0.000
#> SRR542385 2 0.2491 0.783 0 0.836 0.000 0.000 0.164 0.000
#> SRR542386 5 0.2823 0.750 0 0.204 0.000 0.000 0.796 0.000
#> SRR542387 2 0.3804 0.488 0 0.576 0.000 0.000 0.424 0.000
#> SRR542388 2 0.1327 0.829 0 0.936 0.000 0.000 0.064 0.000
#> SRR542389 2 0.1492 0.831 0 0.940 0.024 0.000 0.036 0.000
#> SRR542390 2 0.0146 0.821 0 0.996 0.000 0.000 0.004 0.000
#> SRR542391 2 0.1528 0.830 0 0.936 0.016 0.000 0.048 0.000
#> SRR542392 2 0.2491 0.787 0 0.836 0.000 0.000 0.164 0.000
#> SRR542393 2 0.0547 0.829 0 0.980 0.000 0.000 0.020 0.000
#> SRR542394 5 0.1267 0.926 0 0.060 0.000 0.000 0.940 0.000
#> SRR542395 5 0.1501 0.909 0 0.076 0.000 0.000 0.924 0.000
#> SRR542396 5 0.0458 0.933 0 0.016 0.000 0.000 0.984 0.000
#> SRR542397 2 0.0260 0.823 0 0.992 0.000 0.000 0.008 0.000
#> SRR542398 5 0.0632 0.932 0 0.024 0.000 0.000 0.976 0.000
#> SRR542399 1 0.0000 1.000 1 0.000 0.000 0.000 0.000 0.000
#> SRR542400 1 0.0000 1.000 1 0.000 0.000 0.000 0.000 0.000
#> SRR542401 1 0.0000 1.000 1 0.000 0.000 0.000 0.000 0.000
#> SRR542402 1 0.0000 1.000 1 0.000 0.000 0.000 0.000 0.000
#> SRR542403 1 0.0000 1.000 1 0.000 0.000 0.000 0.000 0.000
#> SRR542404 1 0.0000 1.000 1 0.000 0.000 0.000 0.000 0.000
Heatmaps for the consensus matrix. It visualizes the probability of two samples to be in a same group.
consensus_heatmap(res, k = 2)
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 16804 rows and 59 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 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.533 0.863 0.917 0.2987 0.762 0.762
#> 3 3 0.496 0.611 0.792 0.9744 0.645 0.533
#> 4 4 0.893 0.869 0.952 0.2295 0.781 0.510
#> 5 5 0.778 0.762 0.874 0.0877 0.852 0.524
#> 6 6 0.762 0.578 0.783 0.0476 0.918 0.646
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
#> SRR542346 2 0.0000 0.896 0.000 1.000
#> SRR542347 2 0.0000 0.896 0.000 1.000
#> SRR542348 2 0.0000 0.896 0.000 1.000
#> SRR542349 2 0.0000 0.896 0.000 1.000
#> SRR542350 2 0.0000 0.896 0.000 1.000
#> SRR542351 2 0.0000 0.896 0.000 1.000
#> SRR542352 2 0.0000 0.896 0.000 1.000
#> SRR542353 2 0.0000 0.896 0.000 1.000
#> SRR542354 2 0.0000 0.896 0.000 1.000
#> SRR542355 2 0.0000 0.896 0.000 1.000
#> SRR542356 2 0.0000 0.896 0.000 1.000
#> SRR542357 2 0.0000 0.896 0.000 1.000
#> SRR542358 2 0.0000 0.896 0.000 1.000
#> SRR542359 2 0.0000 0.896 0.000 1.000
#> SRR542360 2 0.0000 0.896 0.000 1.000
#> SRR542361 2 0.0000 0.896 0.000 1.000
#> SRR542362 2 0.0000 0.896 0.000 1.000
#> SRR542363 2 0.0000 0.896 0.000 1.000
#> SRR542364 2 0.0000 0.896 0.000 1.000
#> SRR542365 2 0.1843 0.891 0.028 0.972
#> SRR542366 2 0.0000 0.896 0.000 1.000
#> SRR542367 2 0.3584 0.880 0.068 0.932
#> SRR542368 1 0.2948 0.915 0.948 0.052
#> SRR542369 2 0.0000 0.896 0.000 1.000
#> SRR542370 2 0.0000 0.896 0.000 1.000
#> SRR542371 2 0.6048 0.854 0.148 0.852
#> SRR542372 2 0.0376 0.895 0.004 0.996
#> SRR542373 2 0.0000 0.896 0.000 1.000
#> SRR542374 2 0.0000 0.896 0.000 1.000
#> SRR542375 2 0.7219 0.830 0.200 0.800
#> SRR542376 2 0.0938 0.894 0.012 0.988
#> SRR542377 2 0.6438 0.848 0.164 0.836
#> SRR542378 2 0.9170 0.658 0.332 0.668
#> SRR542379 2 0.7139 0.833 0.196 0.804
#> SRR542380 2 0.7219 0.830 0.200 0.800
#> SRR542381 2 0.7219 0.830 0.200 0.800
#> SRR542382 2 0.9833 0.466 0.424 0.576
#> SRR542383 2 0.7219 0.830 0.200 0.800
#> SRR542384 2 0.7219 0.830 0.200 0.800
#> SRR542385 2 0.7219 0.830 0.200 0.800
#> SRR542386 2 0.7299 0.827 0.204 0.796
#> SRR542387 2 0.5842 0.857 0.140 0.860
#> SRR542388 2 0.7299 0.827 0.204 0.796
#> SRR542389 2 0.0000 0.896 0.000 1.000
#> SRR542390 2 0.6887 0.839 0.184 0.816
#> SRR542391 2 0.7139 0.833 0.196 0.804
#> SRR542392 2 0.9522 0.583 0.372 0.628
#> SRR542393 2 0.0000 0.896 0.000 1.000
#> SRR542394 2 0.7219 0.830 0.200 0.800
#> SRR542395 2 0.7219 0.830 0.200 0.800
#> SRR542396 2 0.7219 0.830 0.200 0.800
#> SRR542397 2 0.7139 0.833 0.196 0.804
#> SRR542398 1 0.7139 0.701 0.804 0.196
#> SRR542399 1 0.0000 0.957 1.000 0.000
#> SRR542400 1 0.0000 0.957 1.000 0.000
#> SRR542401 1 0.0000 0.957 1.000 0.000
#> SRR542402 1 0.0000 0.957 1.000 0.000
#> SRR542403 1 0.0000 0.957 1.000 0.000
#> SRR542404 1 0.0000 0.957 1.000 0.000
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> SRR542346 3 0.6079 0.5306 0.000 0.388 0.612
#> SRR542347 3 0.6079 0.5306 0.000 0.388 0.612
#> SRR542348 3 0.6079 0.5306 0.000 0.388 0.612
#> SRR542349 3 0.6079 0.5306 0.000 0.388 0.612
#> SRR542350 2 0.0000 0.5621 0.000 1.000 0.000
#> SRR542351 2 0.4178 0.3514 0.000 0.828 0.172
#> SRR542352 2 0.0000 0.5621 0.000 1.000 0.000
#> SRR542353 2 0.0000 0.5621 0.000 1.000 0.000
#> SRR542354 2 0.1163 0.5395 0.000 0.972 0.028
#> SRR542355 2 0.4702 0.3262 0.000 0.788 0.212
#> SRR542356 2 0.0237 0.5592 0.000 0.996 0.004
#> SRR542357 2 0.0000 0.5621 0.000 1.000 0.000
#> SRR542358 2 0.0000 0.5621 0.000 1.000 0.000
#> SRR542359 2 0.5988 -0.1453 0.000 0.632 0.368
#> SRR542360 3 0.6079 0.5306 0.000 0.388 0.612
#> SRR542361 3 0.0000 0.7359 0.000 0.000 1.000
#> SRR542362 3 0.2356 0.7069 0.000 0.072 0.928
#> SRR542363 3 0.4974 0.6158 0.000 0.236 0.764
#> SRR542364 2 0.3619 0.6103 0.000 0.864 0.136
#> SRR542365 2 0.6079 0.6955 0.000 0.612 0.388
#> SRR542366 2 0.5882 0.6949 0.000 0.652 0.348
#> SRR542367 2 0.6079 0.6955 0.000 0.612 0.388
#> SRR542368 1 0.3752 0.7621 0.856 0.144 0.000
#> SRR542369 2 0.5650 0.6879 0.000 0.688 0.312
#> SRR542370 2 0.6062 0.6961 0.000 0.616 0.384
#> SRR542371 2 0.6079 0.6955 0.000 0.612 0.388
#> SRR542372 2 0.6079 0.6955 0.000 0.612 0.388
#> SRR542373 2 0.5706 0.1201 0.000 0.680 0.320
#> SRR542374 2 0.5859 -0.0767 0.000 0.656 0.344
#> SRR542375 3 0.0237 0.7357 0.004 0.000 0.996
#> SRR542376 3 0.0000 0.7359 0.000 0.000 1.000
#> SRR542377 3 0.0000 0.7359 0.000 0.000 1.000
#> SRR542378 3 0.0237 0.7357 0.004 0.000 0.996
#> SRR542379 3 0.0000 0.7359 0.000 0.000 1.000
#> SRR542380 3 0.0237 0.7357 0.004 0.000 0.996
#> SRR542381 3 0.0237 0.7357 0.004 0.000 0.996
#> SRR542382 3 0.0237 0.7357 0.004 0.000 0.996
#> SRR542383 3 0.0237 0.7357 0.004 0.000 0.996
#> SRR542384 3 0.3193 0.5852 0.004 0.100 0.896
#> SRR542385 2 0.6079 0.6955 0.000 0.612 0.388
#> SRR542386 2 0.6079 0.6955 0.000 0.612 0.388
#> SRR542387 2 0.6095 0.6924 0.000 0.608 0.392
#> SRR542388 2 0.6566 0.6942 0.012 0.612 0.376
#> SRR542389 2 0.5926 0.6957 0.000 0.644 0.356
#> SRR542390 2 0.6079 0.6955 0.000 0.612 0.388
#> SRR542391 2 0.6079 0.6955 0.000 0.612 0.388
#> SRR542392 2 0.7470 0.6823 0.052 0.612 0.336
#> SRR542393 2 0.5621 0.6868 0.000 0.692 0.308
#> SRR542394 2 0.6079 0.6955 0.000 0.612 0.388
#> SRR542395 2 0.6079 0.6955 0.000 0.612 0.388
#> SRR542396 3 0.6309 -0.5654 0.000 0.500 0.500
#> SRR542397 2 0.6079 0.6955 0.000 0.612 0.388
#> SRR542398 1 0.7114 0.2577 0.584 0.028 0.388
#> SRR542399 1 0.0000 0.8983 1.000 0.000 0.000
#> SRR542400 1 0.0000 0.8983 1.000 0.000 0.000
#> SRR542401 1 0.0000 0.8983 1.000 0.000 0.000
#> SRR542402 1 0.0000 0.8983 1.000 0.000 0.000
#> SRR542403 1 0.0000 0.8983 1.000 0.000 0.000
#> SRR542404 1 0.0000 0.8983 1.000 0.000 0.000
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> SRR542346 3 0.0000 0.9358 0.000 0.000 1.000 0.000
#> SRR542347 3 0.0469 0.9296 0.000 0.000 0.988 0.012
#> SRR542348 3 0.0188 0.9343 0.000 0.000 0.996 0.004
#> SRR542349 3 0.1557 0.8871 0.000 0.000 0.944 0.056
#> SRR542350 2 0.2345 0.8624 0.000 0.900 0.100 0.000
#> SRR542351 3 0.0000 0.9358 0.000 0.000 1.000 0.000
#> SRR542352 2 0.0000 0.9568 0.000 1.000 0.000 0.000
#> SRR542353 3 0.4999 -0.0106 0.000 0.492 0.508 0.000
#> SRR542354 3 0.0000 0.9358 0.000 0.000 1.000 0.000
#> SRR542355 3 0.0336 0.9317 0.000 0.000 0.992 0.008
#> SRR542356 3 0.0000 0.9358 0.000 0.000 1.000 0.000
#> SRR542357 2 0.3311 0.7693 0.000 0.828 0.172 0.000
#> SRR542358 2 0.0000 0.9568 0.000 1.000 0.000 0.000
#> SRR542359 3 0.0000 0.9358 0.000 0.000 1.000 0.000
#> SRR542360 3 0.0000 0.9358 0.000 0.000 1.000 0.000
#> SRR542361 4 0.0000 0.9197 0.000 0.000 0.000 1.000
#> SRR542362 4 0.0817 0.9003 0.000 0.000 0.024 0.976
#> SRR542363 4 0.1716 0.8608 0.000 0.000 0.064 0.936
#> SRR542364 2 0.0000 0.9568 0.000 1.000 0.000 0.000
#> SRR542365 2 0.0000 0.9568 0.000 1.000 0.000 0.000
#> SRR542366 2 0.0000 0.9568 0.000 1.000 0.000 0.000
#> SRR542367 2 0.0000 0.9568 0.000 1.000 0.000 0.000
#> SRR542368 1 0.0000 0.9178 1.000 0.000 0.000 0.000
#> SRR542369 2 0.0000 0.9568 0.000 1.000 0.000 0.000
#> SRR542370 2 0.0000 0.9568 0.000 1.000 0.000 0.000
#> SRR542371 4 0.4697 0.4450 0.000 0.356 0.000 0.644
#> SRR542372 2 0.0000 0.9568 0.000 1.000 0.000 0.000
#> SRR542373 3 0.0804 0.9234 0.000 0.012 0.980 0.008
#> SRR542374 3 0.0000 0.9358 0.000 0.000 1.000 0.000
#> SRR542375 4 0.0000 0.9197 0.000 0.000 0.000 1.000
#> SRR542376 4 0.0000 0.9197 0.000 0.000 0.000 1.000
#> SRR542377 4 0.0000 0.9197 0.000 0.000 0.000 1.000
#> SRR542378 4 0.0000 0.9197 0.000 0.000 0.000 1.000
#> SRR542379 4 0.0000 0.9197 0.000 0.000 0.000 1.000
#> SRR542380 4 0.0000 0.9197 0.000 0.000 0.000 1.000
#> SRR542381 4 0.0000 0.9197 0.000 0.000 0.000 1.000
#> SRR542382 4 0.0000 0.9197 0.000 0.000 0.000 1.000
#> SRR542383 4 0.0000 0.9197 0.000 0.000 0.000 1.000
#> SRR542384 4 0.0000 0.9197 0.000 0.000 0.000 1.000
#> SRR542385 2 0.0000 0.9568 0.000 1.000 0.000 0.000
#> SRR542386 2 0.0188 0.9536 0.000 0.996 0.000 0.004
#> SRR542387 4 0.4898 0.2880 0.000 0.416 0.000 0.584
#> SRR542388 2 0.0000 0.9568 0.000 1.000 0.000 0.000
#> SRR542389 2 0.0000 0.9568 0.000 1.000 0.000 0.000
#> SRR542390 2 0.0000 0.9568 0.000 1.000 0.000 0.000
#> SRR542391 2 0.0000 0.9568 0.000 1.000 0.000 0.000
#> SRR542392 2 0.0000 0.9568 0.000 1.000 0.000 0.000
#> SRR542393 2 0.0000 0.9568 0.000 1.000 0.000 0.000
#> SRR542394 2 0.3688 0.7168 0.000 0.792 0.000 0.208
#> SRR542395 2 0.4331 0.5711 0.000 0.712 0.000 0.288
#> SRR542396 4 0.0817 0.8993 0.000 0.024 0.000 0.976
#> SRR542397 2 0.0000 0.9568 0.000 1.000 0.000 0.000
#> SRR542398 1 0.7595 0.0690 0.428 0.200 0.000 0.372
#> SRR542399 1 0.0000 0.9178 1.000 0.000 0.000 0.000
#> SRR542400 1 0.0000 0.9178 1.000 0.000 0.000 0.000
#> SRR542401 1 0.0000 0.9178 1.000 0.000 0.000 0.000
#> SRR542402 1 0.0000 0.9178 1.000 0.000 0.000 0.000
#> SRR542403 1 0.0000 0.9178 1.000 0.000 0.000 0.000
#> SRR542404 1 0.0000 0.9178 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
#> SRR542346 4 0.3983 0.6124 0.000 0.000 0.340 0.660 0.000
#> SRR542347 4 0.2891 0.7894 0.000 0.000 0.176 0.824 0.000
#> SRR542348 4 0.3949 0.6214 0.000 0.000 0.332 0.668 0.000
#> SRR542349 4 0.2471 0.8122 0.000 0.000 0.136 0.864 0.000
#> SRR542350 3 0.4746 0.2040 0.000 0.480 0.504 0.000 0.016
#> SRR542351 3 0.0000 0.7340 0.000 0.000 1.000 0.000 0.000
#> SRR542352 2 0.0992 0.8934 0.000 0.968 0.008 0.000 0.024
#> SRR542353 3 0.3661 0.6276 0.000 0.276 0.724 0.000 0.000
#> SRR542354 3 0.1430 0.7074 0.000 0.000 0.944 0.052 0.004
#> SRR542355 3 0.6082 0.6233 0.000 0.076 0.668 0.088 0.168
#> SRR542356 3 0.0162 0.7330 0.000 0.000 0.996 0.004 0.000
#> SRR542357 3 0.5094 0.4596 0.000 0.352 0.600 0.000 0.048
#> SRR542358 2 0.0290 0.9029 0.000 0.992 0.008 0.000 0.000
#> SRR542359 3 0.1544 0.7392 0.000 0.000 0.932 0.000 0.068
#> SRR542360 3 0.2930 0.7074 0.000 0.000 0.832 0.004 0.164
#> SRR542361 4 0.0609 0.8504 0.000 0.000 0.000 0.980 0.020
#> SRR542362 4 0.0865 0.8502 0.000 0.000 0.004 0.972 0.024
#> SRR542363 4 0.0451 0.8526 0.000 0.000 0.008 0.988 0.004
#> SRR542364 2 0.6722 0.0282 0.000 0.428 0.212 0.004 0.356
#> SRR542365 2 0.0609 0.9014 0.000 0.980 0.000 0.000 0.020
#> SRR542366 2 0.0865 0.8989 0.000 0.972 0.000 0.004 0.024
#> SRR542367 2 0.3430 0.7103 0.000 0.776 0.000 0.004 0.220
#> SRR542368 1 0.1117 0.9623 0.964 0.020 0.016 0.000 0.000
#> SRR542369 2 0.0000 0.9060 0.000 1.000 0.000 0.000 0.000
#> SRR542370 2 0.0404 0.9038 0.000 0.988 0.000 0.000 0.012
#> SRR542371 5 0.2304 0.7842 0.000 0.044 0.000 0.048 0.908
#> SRR542372 2 0.4331 0.3661 0.000 0.596 0.000 0.004 0.400
#> SRR542373 3 0.4219 0.4551 0.000 0.000 0.584 0.000 0.416
#> SRR542374 3 0.1270 0.7401 0.000 0.000 0.948 0.000 0.052
#> SRR542375 5 0.1544 0.7876 0.000 0.000 0.000 0.068 0.932
#> SRR542376 4 0.0703 0.8469 0.000 0.000 0.000 0.976 0.024
#> SRR542377 4 0.0404 0.8513 0.000 0.000 0.000 0.988 0.012
#> SRR542378 5 0.4101 0.5689 0.000 0.000 0.000 0.372 0.628
#> SRR542379 4 0.2074 0.7596 0.000 0.000 0.000 0.896 0.104
#> SRR542380 5 0.4201 0.5111 0.000 0.000 0.000 0.408 0.592
#> SRR542381 5 0.1908 0.7918 0.000 0.000 0.000 0.092 0.908
#> SRR542382 5 0.2605 0.7776 0.000 0.000 0.000 0.148 0.852
#> SRR542383 5 0.4242 0.4763 0.000 0.000 0.000 0.428 0.572
#> SRR542384 5 0.0880 0.7742 0.000 0.000 0.000 0.032 0.968
#> SRR542385 2 0.0162 0.9056 0.000 0.996 0.000 0.000 0.004
#> SRR542386 2 0.0510 0.9023 0.000 0.984 0.000 0.000 0.016
#> SRR542387 5 0.2797 0.7807 0.000 0.060 0.000 0.060 0.880
#> SRR542388 2 0.0162 0.9053 0.000 0.996 0.000 0.000 0.004
#> SRR542389 2 0.0000 0.9060 0.000 1.000 0.000 0.000 0.000
#> SRR542390 2 0.0000 0.9060 0.000 1.000 0.000 0.000 0.000
#> SRR542391 2 0.0000 0.9060 0.000 1.000 0.000 0.000 0.000
#> SRR542392 2 0.2110 0.8472 0.072 0.912 0.000 0.000 0.016
#> SRR542393 2 0.0000 0.9060 0.000 1.000 0.000 0.000 0.000
#> SRR542394 5 0.3196 0.6672 0.000 0.192 0.000 0.004 0.804
#> SRR542395 5 0.3999 0.4487 0.000 0.344 0.000 0.000 0.656
#> SRR542396 5 0.0955 0.7732 0.000 0.004 0.000 0.028 0.968
#> SRR542397 2 0.0794 0.8944 0.000 0.972 0.000 0.000 0.028
#> SRR542398 5 0.4642 0.7031 0.136 0.064 0.000 0.028 0.772
#> SRR542399 1 0.0000 0.9939 1.000 0.000 0.000 0.000 0.000
#> SRR542400 1 0.0000 0.9939 1.000 0.000 0.000 0.000 0.000
#> SRR542401 1 0.0000 0.9939 1.000 0.000 0.000 0.000 0.000
#> SRR542402 1 0.0000 0.9939 1.000 0.000 0.000 0.000 0.000
#> SRR542403 1 0.0000 0.9939 1.000 0.000 0.000 0.000 0.000
#> SRR542404 1 0.0000 0.9939 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
#> SRR542346 4 0.4729 0.59497 0.000 0.000 0.096 0.656 0.000 0.248
#> SRR542347 4 0.2361 0.80922 0.000 0.000 0.028 0.884 0.000 0.088
#> SRR542348 4 0.4111 0.70509 0.000 0.000 0.108 0.748 0.000 0.144
#> SRR542349 4 0.0858 0.84238 0.000 0.000 0.004 0.968 0.000 0.028
#> SRR542350 2 0.3996 0.00419 0.000 0.512 0.484 0.000 0.000 0.004
#> SRR542351 3 0.2902 0.54111 0.000 0.000 0.800 0.004 0.000 0.196
#> SRR542352 2 0.2378 0.76590 0.000 0.848 0.000 0.000 0.000 0.152
#> SRR542353 3 0.4684 0.27744 0.000 0.352 0.592 0.000 0.000 0.056
#> SRR542354 6 0.3996 -0.38334 0.000 0.000 0.484 0.004 0.000 0.512
#> SRR542355 6 0.4834 -0.19202 0.000 0.004 0.044 0.000 0.472 0.480
#> SRR542356 3 0.3563 0.43227 0.000 0.000 0.664 0.000 0.000 0.336
#> SRR542357 6 0.6748 0.10694 0.000 0.220 0.132 0.000 0.132 0.516
#> SRR542358 2 0.0260 0.86392 0.000 0.992 0.000 0.000 0.000 0.008
#> SRR542359 3 0.0363 0.59561 0.000 0.000 0.988 0.000 0.000 0.012
#> SRR542360 3 0.4012 0.51956 0.000 0.000 0.752 0.000 0.084 0.164
#> SRR542361 4 0.0146 0.84373 0.000 0.000 0.000 0.996 0.004 0.000
#> SRR542362 4 0.0551 0.84378 0.000 0.000 0.004 0.984 0.004 0.008
#> SRR542363 4 0.0363 0.84446 0.000 0.000 0.000 0.988 0.000 0.012
#> SRR542364 3 0.6581 -0.04777 0.000 0.076 0.416 0.004 0.100 0.404
#> SRR542365 2 0.2170 0.82557 0.000 0.888 0.000 0.000 0.012 0.100
#> SRR542366 2 0.1908 0.83133 0.000 0.900 0.000 0.000 0.004 0.096
#> SRR542367 2 0.5953 0.05520 0.000 0.452 0.000 0.000 0.296 0.252
#> SRR542368 1 0.2394 0.89351 0.900 0.032 0.048 0.000 0.000 0.020
#> SRR542369 2 0.0000 0.86447 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR542370 2 0.1610 0.83913 0.000 0.916 0.000 0.000 0.000 0.084
#> SRR542371 5 0.3076 0.48533 0.000 0.000 0.000 0.000 0.760 0.240
#> SRR542372 6 0.6062 0.01674 0.000 0.288 0.000 0.000 0.304 0.408
#> SRR542373 3 0.4252 0.40258 0.000 0.000 0.728 0.000 0.096 0.176
#> SRR542374 3 0.0260 0.59333 0.000 0.000 0.992 0.000 0.000 0.008
#> SRR542375 5 0.4004 0.42360 0.000 0.000 0.120 0.000 0.760 0.120
#> SRR542376 4 0.0291 0.84315 0.000 0.000 0.000 0.992 0.004 0.004
#> SRR542377 4 0.1524 0.81720 0.000 0.000 0.000 0.932 0.060 0.008
#> SRR542378 5 0.3998 0.37977 0.000 0.000 0.000 0.340 0.644 0.016
#> SRR542379 4 0.1398 0.81485 0.000 0.000 0.000 0.940 0.052 0.008
#> SRR542380 5 0.4199 0.29918 0.000 0.000 0.000 0.380 0.600 0.020
#> SRR542381 5 0.2730 0.49124 0.000 0.000 0.012 0.000 0.836 0.152
#> SRR542382 5 0.1921 0.54817 0.000 0.000 0.000 0.052 0.916 0.032
#> SRR542383 4 0.5262 -0.19826 0.000 0.000 0.000 0.452 0.452 0.096
#> SRR542384 6 0.6204 -0.03480 0.000 0.000 0.272 0.004 0.352 0.372
#> SRR542385 2 0.0260 0.86415 0.000 0.992 0.000 0.000 0.000 0.008
#> SRR542386 2 0.1701 0.84000 0.000 0.920 0.000 0.000 0.008 0.072
#> SRR542387 5 0.2378 0.53261 0.000 0.000 0.000 0.000 0.848 0.152
#> SRR542388 2 0.0260 0.86415 0.000 0.992 0.000 0.000 0.000 0.008
#> SRR542389 2 0.0363 0.86340 0.000 0.988 0.000 0.000 0.000 0.012
#> SRR542390 2 0.0363 0.86340 0.000 0.988 0.000 0.000 0.000 0.012
#> SRR542391 2 0.0146 0.86433 0.000 0.996 0.000 0.000 0.000 0.004
#> SRR542392 2 0.3857 0.70184 0.148 0.776 0.004 0.000 0.000 0.072
#> SRR542393 2 0.0260 0.86478 0.000 0.992 0.000 0.000 0.000 0.008
#> SRR542394 5 0.3168 0.49676 0.000 0.016 0.000 0.000 0.792 0.192
#> SRR542395 5 0.2793 0.50125 0.000 0.000 0.000 0.000 0.800 0.200
#> SRR542396 6 0.6174 -0.00973 0.000 0.000 0.264 0.004 0.332 0.400
#> SRR542397 2 0.2046 0.81932 0.000 0.908 0.000 0.000 0.032 0.060
#> SRR542398 5 0.7711 -0.01019 0.164 0.036 0.104 0.000 0.388 0.308
#> SRR542399 1 0.0000 0.98327 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR542400 1 0.0000 0.98327 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR542401 1 0.0000 0.98327 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR542402 1 0.0000 0.98327 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR542403 1 0.0000 0.98327 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR542404 1 0.0000 0.98327 1.000 0.000 0.000 0.000 0.000 0.000
Heatmaps for the consensus matrix. It visualizes the probability of two samples to be in a same group.
consensus_heatmap(res, k = 2)
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 16804 rows and 59 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 1.000 0.980 0.989 0.2001 0.814 0.814
#> 3 3 0.440 0.807 0.877 1.5744 0.681 0.608
#> 4 4 0.542 0.639 0.841 0.2925 0.842 0.681
#> 5 5 0.544 0.568 0.759 0.1167 0.897 0.695
#> 6 6 0.613 0.557 0.741 0.0555 0.924 0.718
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
#> SRR542346 2 0.0672 0.987 0.008 0.992
#> SRR542347 2 0.0672 0.987 0.008 0.992
#> SRR542348 2 0.0672 0.987 0.008 0.992
#> SRR542349 2 0.0672 0.987 0.008 0.992
#> SRR542350 2 0.0672 0.987 0.008 0.992
#> SRR542351 2 0.0672 0.987 0.008 0.992
#> SRR542352 2 0.0672 0.987 0.008 0.992
#> SRR542353 2 0.0672 0.987 0.008 0.992
#> SRR542354 2 0.0672 0.987 0.008 0.992
#> SRR542355 2 0.0000 0.988 0.000 1.000
#> SRR542356 2 0.0672 0.987 0.008 0.992
#> SRR542357 2 0.0000 0.988 0.000 1.000
#> SRR542358 2 0.0672 0.987 0.008 0.992
#> SRR542359 2 0.0672 0.987 0.008 0.992
#> SRR542360 2 0.0000 0.988 0.000 1.000
#> SRR542361 2 0.0672 0.987 0.008 0.992
#> SRR542362 2 0.0672 0.987 0.008 0.992
#> SRR542363 2 0.0672 0.987 0.008 0.992
#> SRR542364 2 0.0672 0.987 0.008 0.992
#> SRR542365 2 0.0000 0.988 0.000 1.000
#> SRR542366 2 0.0672 0.987 0.008 0.992
#> SRR542367 2 0.0000 0.988 0.000 1.000
#> SRR542368 2 0.8661 0.613 0.288 0.712
#> SRR542369 2 0.0000 0.988 0.000 1.000
#> SRR542370 2 0.0000 0.988 0.000 1.000
#> SRR542371 2 0.0000 0.988 0.000 1.000
#> SRR542372 2 0.0000 0.988 0.000 1.000
#> SRR542373 2 0.0000 0.988 0.000 1.000
#> SRR542374 2 0.0672 0.987 0.008 0.992
#> SRR542375 2 0.0000 0.988 0.000 1.000
#> SRR542376 2 0.0672 0.987 0.008 0.992
#> SRR542377 2 0.0672 0.987 0.008 0.992
#> SRR542378 2 0.0000 0.988 0.000 1.000
#> SRR542379 2 0.0672 0.987 0.008 0.992
#> SRR542380 2 0.0000 0.988 0.000 1.000
#> SRR542381 2 0.0000 0.988 0.000 1.000
#> SRR542382 2 0.0000 0.988 0.000 1.000
#> SRR542383 2 0.0000 0.988 0.000 1.000
#> SRR542384 2 0.0000 0.988 0.000 1.000
#> SRR542385 2 0.0000 0.988 0.000 1.000
#> SRR542386 2 0.0000 0.988 0.000 1.000
#> SRR542387 2 0.0000 0.988 0.000 1.000
#> SRR542388 2 0.0000 0.988 0.000 1.000
#> SRR542389 2 0.0000 0.988 0.000 1.000
#> SRR542390 2 0.0000 0.988 0.000 1.000
#> SRR542391 2 0.0000 0.988 0.000 1.000
#> SRR542392 2 0.0000 0.988 0.000 1.000
#> SRR542393 2 0.0000 0.988 0.000 1.000
#> SRR542394 2 0.0000 0.988 0.000 1.000
#> SRR542395 2 0.0000 0.988 0.000 1.000
#> SRR542396 2 0.0000 0.988 0.000 1.000
#> SRR542397 2 0.0000 0.988 0.000 1.000
#> SRR542398 2 0.6148 0.819 0.152 0.848
#> SRR542399 1 0.0672 1.000 0.992 0.008
#> SRR542400 1 0.0672 1.000 0.992 0.008
#> SRR542401 1 0.0672 1.000 0.992 0.008
#> SRR542402 1 0.0672 1.000 0.992 0.008
#> SRR542403 1 0.0672 1.000 0.992 0.008
#> SRR542404 1 0.0672 1.000 0.992 0.008
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> SRR542346 3 0.2261 0.759 0.000 0.068 0.932
#> SRR542347 3 0.2261 0.759 0.000 0.068 0.932
#> SRR542348 3 0.2261 0.759 0.000 0.068 0.932
#> SRR542349 3 0.2261 0.759 0.000 0.068 0.932
#> SRR542350 2 0.4978 0.736 0.004 0.780 0.216
#> SRR542351 2 0.6104 0.637 0.004 0.648 0.348
#> SRR542352 2 0.4978 0.736 0.004 0.780 0.216
#> SRR542353 2 0.4978 0.736 0.004 0.780 0.216
#> SRR542354 2 0.5443 0.711 0.004 0.736 0.260
#> SRR542355 2 0.1529 0.857 0.000 0.960 0.040
#> SRR542356 2 0.5785 0.682 0.004 0.696 0.300
#> SRR542357 2 0.1289 0.858 0.000 0.968 0.032
#> SRR542358 2 0.4978 0.736 0.004 0.780 0.216
#> SRR542359 2 0.6104 0.637 0.004 0.648 0.348
#> SRR542360 2 0.3192 0.807 0.000 0.888 0.112
#> SRR542361 3 0.4002 0.832 0.000 0.160 0.840
#> SRR542362 3 0.4002 0.832 0.000 0.160 0.840
#> SRR542363 3 0.4002 0.832 0.000 0.160 0.840
#> SRR542364 2 0.2496 0.844 0.004 0.928 0.068
#> SRR542365 2 0.0000 0.863 0.000 1.000 0.000
#> SRR542366 2 0.0829 0.862 0.004 0.984 0.012
#> SRR542367 2 0.0237 0.862 0.000 0.996 0.004
#> SRR542368 2 0.6507 0.607 0.284 0.688 0.028
#> SRR542369 2 0.0237 0.863 0.000 0.996 0.004
#> SRR542370 2 0.0000 0.863 0.000 1.000 0.000
#> SRR542371 2 0.1031 0.858 0.000 0.976 0.024
#> SRR542372 2 0.0237 0.862 0.000 0.996 0.004
#> SRR542373 2 0.3192 0.807 0.000 0.888 0.112
#> SRR542374 2 0.6104 0.637 0.004 0.648 0.348
#> SRR542375 2 0.4887 0.644 0.000 0.772 0.228
#> SRR542376 3 0.4842 0.828 0.000 0.224 0.776
#> SRR542377 3 0.4002 0.832 0.000 0.160 0.840
#> SRR542378 3 0.5948 0.710 0.000 0.360 0.640
#> SRR542379 3 0.4842 0.828 0.000 0.224 0.776
#> SRR542380 3 0.5948 0.710 0.000 0.360 0.640
#> SRR542381 2 0.4887 0.644 0.000 0.772 0.228
#> SRR542382 3 0.5948 0.710 0.000 0.360 0.640
#> SRR542383 3 0.5948 0.710 0.000 0.360 0.640
#> SRR542384 2 0.4887 0.644 0.000 0.772 0.228
#> SRR542385 2 0.0000 0.863 0.000 1.000 0.000
#> SRR542386 2 0.0000 0.863 0.000 1.000 0.000
#> SRR542387 2 0.1031 0.858 0.000 0.976 0.024
#> SRR542388 2 0.0000 0.863 0.000 1.000 0.000
#> SRR542389 2 0.0000 0.863 0.000 1.000 0.000
#> SRR542390 2 0.0000 0.863 0.000 1.000 0.000
#> SRR542391 2 0.0000 0.863 0.000 1.000 0.000
#> SRR542392 2 0.0000 0.863 0.000 1.000 0.000
#> SRR542393 2 0.0000 0.863 0.000 1.000 0.000
#> SRR542394 2 0.1031 0.858 0.000 0.976 0.024
#> SRR542395 2 0.1163 0.857 0.000 0.972 0.028
#> SRR542396 2 0.4842 0.652 0.000 0.776 0.224
#> SRR542397 2 0.0000 0.863 0.000 1.000 0.000
#> SRR542398 2 0.5346 0.750 0.152 0.808 0.040
#> SRR542399 1 0.0237 1.000 0.996 0.004 0.000
#> SRR542400 1 0.0237 1.000 0.996 0.004 0.000
#> SRR542401 1 0.0237 1.000 0.996 0.004 0.000
#> SRR542402 1 0.0237 1.000 0.996 0.004 0.000
#> SRR542403 1 0.0237 1.000 0.996 0.004 0.000
#> SRR542404 1 0.0237 1.000 0.996 0.004 0.000
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> SRR542346 4 0.3649 0.713 0.000 0.000 0.204 0.796
#> SRR542347 4 0.3649 0.713 0.000 0.000 0.204 0.796
#> SRR542348 4 0.3649 0.713 0.000 0.000 0.204 0.796
#> SRR542349 4 0.3649 0.713 0.000 0.000 0.204 0.796
#> SRR542350 3 0.4994 0.304 0.000 0.480 0.520 0.000
#> SRR542351 3 0.0469 0.570 0.000 0.012 0.988 0.000
#> SRR542352 2 0.4994 -0.294 0.000 0.520 0.480 0.000
#> SRR542353 3 0.4994 0.304 0.000 0.480 0.520 0.000
#> SRR542354 3 0.4697 0.488 0.000 0.356 0.644 0.000
#> SRR542355 2 0.4655 0.368 0.000 0.684 0.312 0.004
#> SRR542356 3 0.2921 0.604 0.000 0.140 0.860 0.000
#> SRR542357 2 0.4543 0.335 0.000 0.676 0.324 0.000
#> SRR542358 2 0.4989 -0.271 0.000 0.528 0.472 0.000
#> SRR542359 3 0.0469 0.570 0.000 0.012 0.988 0.000
#> SRR542360 3 0.5708 0.158 0.000 0.416 0.556 0.028
#> SRR542361 4 0.0000 0.778 0.000 0.000 0.000 1.000
#> SRR542362 4 0.0000 0.778 0.000 0.000 0.000 1.000
#> SRR542363 4 0.0000 0.778 0.000 0.000 0.000 1.000
#> SRR542364 2 0.4585 0.491 0.000 0.668 0.332 0.000
#> SRR542365 2 0.0469 0.769 0.000 0.988 0.012 0.000
#> SRR542366 2 0.2149 0.739 0.000 0.912 0.088 0.000
#> SRR542367 2 0.1022 0.763 0.000 0.968 0.032 0.000
#> SRR542368 2 0.6791 0.319 0.280 0.596 0.120 0.004
#> SRR542369 2 0.1940 0.748 0.000 0.924 0.076 0.000
#> SRR542370 2 0.0592 0.770 0.000 0.984 0.016 0.000
#> SRR542371 2 0.2256 0.758 0.000 0.924 0.056 0.020
#> SRR542372 2 0.1118 0.763 0.000 0.964 0.036 0.000
#> SRR542373 3 0.5708 0.158 0.000 0.416 0.556 0.028
#> SRR542374 3 0.0469 0.570 0.000 0.012 0.988 0.000
#> SRR542375 2 0.6274 0.488 0.000 0.664 0.152 0.184
#> SRR542376 4 0.2530 0.771 0.000 0.100 0.004 0.896
#> SRR542377 4 0.0000 0.778 0.000 0.000 0.000 1.000
#> SRR542378 4 0.4831 0.638 0.000 0.280 0.016 0.704
#> SRR542379 4 0.2530 0.771 0.000 0.100 0.004 0.896
#> SRR542380 4 0.4831 0.638 0.000 0.280 0.016 0.704
#> SRR542381 2 0.6231 0.491 0.000 0.668 0.148 0.184
#> SRR542382 4 0.4831 0.638 0.000 0.280 0.016 0.704
#> SRR542383 4 0.4831 0.638 0.000 0.280 0.016 0.704
#> SRR542384 2 0.6274 0.488 0.000 0.664 0.152 0.184
#> SRR542385 2 0.0817 0.769 0.000 0.976 0.024 0.000
#> SRR542386 2 0.0592 0.770 0.000 0.984 0.016 0.000
#> SRR542387 2 0.1913 0.762 0.000 0.940 0.040 0.020
#> SRR542388 2 0.1211 0.762 0.000 0.960 0.040 0.000
#> SRR542389 2 0.0817 0.769 0.000 0.976 0.024 0.000
#> SRR542390 2 0.1302 0.760 0.000 0.956 0.044 0.000
#> SRR542391 2 0.1940 0.737 0.000 0.924 0.076 0.000
#> SRR542392 2 0.0592 0.770 0.000 0.984 0.016 0.000
#> SRR542393 2 0.0817 0.769 0.000 0.976 0.024 0.000
#> SRR542394 2 0.1913 0.762 0.000 0.940 0.040 0.020
#> SRR542395 2 0.2002 0.761 0.000 0.936 0.044 0.020
#> SRR542396 2 0.6236 0.493 0.000 0.668 0.152 0.180
#> SRR542397 2 0.0817 0.769 0.000 0.976 0.024 0.000
#> SRR542398 2 0.6110 0.528 0.152 0.708 0.128 0.012
#> SRR542399 1 0.0000 1.000 1.000 0.000 0.000 0.000
#> SRR542400 1 0.0000 1.000 1.000 0.000 0.000 0.000
#> SRR542401 1 0.0000 1.000 1.000 0.000 0.000 0.000
#> SRR542402 1 0.0000 1.000 1.000 0.000 0.000 0.000
#> SRR542403 1 0.0000 1.000 1.000 0.000 0.000 0.000
#> SRR542404 1 0.0000 1.000 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
#> SRR542346 4 0.3829 0.675 0.000 0.000 0.196 0.776 0.028
#> SRR542347 4 0.3829 0.675 0.000 0.000 0.196 0.776 0.028
#> SRR542348 4 0.3829 0.675 0.000 0.000 0.196 0.776 0.028
#> SRR542349 4 0.3829 0.675 0.000 0.000 0.196 0.776 0.028
#> SRR542350 3 0.4830 0.121 0.000 0.488 0.492 0.000 0.020
#> SRR542351 3 0.1732 0.545 0.000 0.000 0.920 0.000 0.080
#> SRR542352 2 0.4731 -0.131 0.000 0.528 0.456 0.000 0.016
#> SRR542353 3 0.4830 0.121 0.000 0.488 0.492 0.000 0.020
#> SRR542354 3 0.4570 0.376 0.000 0.348 0.632 0.000 0.020
#> SRR542355 2 0.5120 0.342 0.000 0.648 0.292 0.004 0.056
#> SRR542356 3 0.2230 0.557 0.000 0.116 0.884 0.000 0.000
#> SRR542357 2 0.5045 0.312 0.000 0.636 0.308 0.000 0.056
#> SRR542358 2 0.4803 -0.109 0.000 0.536 0.444 0.000 0.020
#> SRR542359 3 0.1732 0.545 0.000 0.000 0.920 0.000 0.080
#> SRR542360 3 0.6748 0.167 0.000 0.332 0.496 0.024 0.148
#> SRR542361 4 0.0000 0.757 0.000 0.000 0.000 1.000 0.000
#> SRR542362 4 0.0000 0.757 0.000 0.000 0.000 1.000 0.000
#> SRR542363 4 0.0162 0.756 0.000 0.000 0.000 0.996 0.004
#> SRR542364 5 0.5810 0.307 0.000 0.212 0.176 0.000 0.612
#> SRR542365 2 0.3074 0.566 0.000 0.804 0.000 0.000 0.196
#> SRR542366 5 0.4448 0.118 0.000 0.480 0.004 0.000 0.516
#> SRR542367 2 0.4114 0.204 0.000 0.624 0.000 0.000 0.376
#> SRR542368 5 0.6650 0.410 0.280 0.272 0.000 0.000 0.448
#> SRR542369 2 0.4617 0.542 0.000 0.716 0.060 0.000 0.224
#> SRR542370 2 0.3081 0.617 0.000 0.832 0.012 0.000 0.156
#> SRR542371 2 0.3907 0.625 0.000 0.812 0.032 0.020 0.136
#> SRR542372 2 0.4150 0.172 0.000 0.612 0.000 0.000 0.388
#> SRR542373 3 0.6748 0.167 0.000 0.332 0.496 0.024 0.148
#> SRR542374 3 0.1732 0.545 0.000 0.000 0.920 0.000 0.080
#> SRR542375 5 0.5849 0.602 0.000 0.392 0.000 0.100 0.508
#> SRR542376 4 0.3192 0.726 0.000 0.040 0.000 0.848 0.112
#> SRR542377 4 0.0510 0.756 0.000 0.000 0.000 0.984 0.016
#> SRR542378 4 0.5831 0.529 0.000 0.172 0.000 0.608 0.220
#> SRR542379 4 0.3192 0.726 0.000 0.040 0.000 0.848 0.112
#> SRR542380 4 0.5831 0.529 0.000 0.172 0.000 0.608 0.220
#> SRR542381 5 0.5856 0.599 0.000 0.396 0.000 0.100 0.504
#> SRR542382 4 0.5831 0.529 0.000 0.172 0.000 0.608 0.220
#> SRR542383 4 0.5779 0.533 0.000 0.172 0.000 0.616 0.212
#> SRR542384 5 0.5849 0.602 0.000 0.392 0.000 0.100 0.508
#> SRR542385 2 0.0000 0.706 0.000 1.000 0.000 0.000 0.000
#> SRR542386 2 0.1197 0.692 0.000 0.952 0.000 0.000 0.048
#> SRR542387 2 0.3453 0.634 0.000 0.832 0.012 0.020 0.136
#> SRR542388 2 0.0898 0.706 0.000 0.972 0.020 0.000 0.008
#> SRR542389 2 0.0000 0.706 0.000 1.000 0.000 0.000 0.000
#> SRR542390 2 0.0703 0.704 0.000 0.976 0.024 0.000 0.000
#> SRR542391 2 0.1597 0.690 0.000 0.940 0.048 0.000 0.012
#> SRR542392 2 0.1197 0.692 0.000 0.952 0.000 0.000 0.048
#> SRR542393 2 0.0404 0.701 0.000 0.988 0.000 0.000 0.012
#> SRR542394 2 0.3453 0.634 0.000 0.832 0.012 0.020 0.136
#> SRR542395 2 0.3554 0.631 0.000 0.828 0.016 0.020 0.136
#> SRR542396 5 0.5808 0.602 0.000 0.392 0.000 0.096 0.512
#> SRR542397 2 0.0000 0.706 0.000 1.000 0.000 0.000 0.000
#> SRR542398 5 0.6232 0.481 0.152 0.356 0.000 0.000 0.492
#> SRR542399 1 0.0000 1.000 1.000 0.000 0.000 0.000 0.000
#> SRR542400 1 0.0000 1.000 1.000 0.000 0.000 0.000 0.000
#> SRR542401 1 0.0000 1.000 1.000 0.000 0.000 0.000 0.000
#> SRR542402 1 0.0000 1.000 1.000 0.000 0.000 0.000 0.000
#> SRR542403 1 0.0000 1.000 1.000 0.000 0.000 0.000 0.000
#> SRR542404 1 0.0000 1.000 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
#> SRR542346 4 0.5117 0.7051 0.000 0.000 0.156 0.680 0.140 0.024
#> SRR542347 4 0.5117 0.7051 0.000 0.000 0.156 0.680 0.140 0.024
#> SRR542348 4 0.5117 0.7051 0.000 0.000 0.156 0.680 0.140 0.024
#> SRR542349 4 0.5117 0.7051 0.000 0.000 0.156 0.680 0.140 0.024
#> SRR542350 2 0.6404 0.1204 0.000 0.472 0.348 0.000 0.064 0.116
#> SRR542351 3 0.0405 0.6121 0.000 0.000 0.988 0.000 0.008 0.004
#> SRR542352 2 0.6229 0.2163 0.000 0.516 0.312 0.000 0.056 0.116
#> SRR542353 2 0.6404 0.1204 0.000 0.472 0.348 0.000 0.064 0.116
#> SRR542354 3 0.5907 0.1604 0.000 0.332 0.512 0.000 0.020 0.136
#> SRR542355 2 0.5423 0.4433 0.000 0.644 0.192 0.000 0.028 0.136
#> SRR542356 3 0.3842 0.5545 0.000 0.100 0.784 0.000 0.004 0.112
#> SRR542357 2 0.5464 0.4243 0.000 0.632 0.204 0.000 0.024 0.140
#> SRR542358 2 0.6268 0.2257 0.000 0.520 0.304 0.000 0.064 0.112
#> SRR542359 3 0.0405 0.6121 0.000 0.000 0.988 0.000 0.008 0.004
#> SRR542360 3 0.5985 0.3666 0.000 0.300 0.540 0.000 0.124 0.036
#> SRR542361 4 0.0146 0.7214 0.000 0.000 0.000 0.996 0.004 0.000
#> SRR542362 4 0.0000 0.7226 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR542363 4 0.1124 0.7260 0.000 0.000 0.000 0.956 0.036 0.008
#> SRR542364 6 0.5500 0.4365 0.000 0.076 0.224 0.000 0.060 0.640
#> SRR542365 2 0.3151 0.5089 0.000 0.748 0.000 0.000 0.000 0.252
#> SRR542366 6 0.3969 0.4393 0.000 0.332 0.000 0.000 0.016 0.652
#> SRR542367 2 0.4336 -0.0959 0.000 0.504 0.000 0.000 0.020 0.476
#> SRR542368 6 0.6057 0.5579 0.276 0.144 0.000 0.000 0.036 0.544
#> SRR542369 2 0.3925 0.4938 0.000 0.656 0.004 0.000 0.008 0.332
#> SRR542370 2 0.2823 0.5880 0.000 0.796 0.000 0.000 0.000 0.204
#> SRR542371 2 0.4082 0.6197 0.000 0.764 0.012 0.000 0.068 0.156
#> SRR542372 2 0.4469 -0.0954 0.000 0.504 0.000 0.000 0.028 0.468
#> SRR542373 3 0.5985 0.3666 0.000 0.300 0.540 0.000 0.124 0.036
#> SRR542374 3 0.0405 0.6121 0.000 0.000 0.988 0.000 0.008 0.004
#> SRR542375 5 0.4827 0.4739 0.000 0.236 0.000 0.000 0.652 0.112
#> SRR542376 4 0.3445 0.4605 0.000 0.008 0.000 0.732 0.260 0.000
#> SRR542377 4 0.2538 0.6470 0.000 0.000 0.000 0.860 0.124 0.016
#> SRR542378 5 0.5007 0.3821 0.000 0.072 0.000 0.416 0.512 0.000
#> SRR542379 4 0.3445 0.4605 0.000 0.008 0.000 0.732 0.260 0.000
#> SRR542380 5 0.5007 0.3821 0.000 0.072 0.000 0.416 0.512 0.000
#> SRR542381 5 0.4866 0.4724 0.000 0.236 0.000 0.000 0.648 0.116
#> SRR542382 5 0.5007 0.3821 0.000 0.072 0.000 0.416 0.512 0.000
#> SRR542383 5 0.5015 0.3674 0.000 0.072 0.000 0.424 0.504 0.000
#> SRR542384 5 0.4827 0.4739 0.000 0.236 0.000 0.000 0.652 0.112
#> SRR542385 2 0.0146 0.6872 0.000 0.996 0.000 0.000 0.000 0.004
#> SRR542386 2 0.1327 0.6705 0.000 0.936 0.000 0.000 0.000 0.064
#> SRR542387 2 0.3766 0.6253 0.000 0.784 0.004 0.000 0.068 0.144
#> SRR542388 2 0.1007 0.6872 0.000 0.956 0.000 0.000 0.000 0.044
#> SRR542389 2 0.0146 0.6872 0.000 0.996 0.000 0.000 0.000 0.004
#> SRR542390 2 0.0790 0.6855 0.000 0.968 0.000 0.000 0.000 0.032
#> SRR542391 2 0.1718 0.6791 0.000 0.932 0.008 0.000 0.016 0.044
#> SRR542392 2 0.1327 0.6705 0.000 0.936 0.000 0.000 0.000 0.064
#> SRR542393 2 0.0363 0.6834 0.000 0.988 0.000 0.000 0.000 0.012
#> SRR542394 2 0.3766 0.6253 0.000 0.784 0.004 0.000 0.068 0.144
#> SRR542395 2 0.3803 0.6232 0.000 0.780 0.004 0.000 0.068 0.148
#> SRR542396 5 0.5047 0.4606 0.000 0.236 0.000 0.000 0.628 0.136
#> SRR542397 2 0.0146 0.6872 0.000 0.996 0.000 0.000 0.000 0.004
#> SRR542398 6 0.6389 0.6344 0.148 0.196 0.000 0.000 0.092 0.564
#> SRR542399 1 0.0000 1.0000 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR542400 1 0.0000 1.0000 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR542401 1 0.0000 1.0000 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR542402 1 0.0000 1.0000 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR542403 1 0.0000 1.0000 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR542404 1 0.0000 1.0000 1.000 0.000 0.000 0.000 0.000 0.000
Heatmaps for the consensus matrix. It visualizes the probability of two samples to be in a same group.
consensus_heatmap(res, k = 2)
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", "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 16804 rows and 59 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 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.207 0.625 0.747 0.3797 0.544 0.544
#> 3 3 0.546 0.833 0.885 0.4381 0.951 0.910
#> 4 4 0.621 0.670 0.824 0.2708 0.820 0.636
#> 5 5 0.654 0.686 0.819 0.1161 0.863 0.595
#> 6 6 0.677 0.613 0.755 0.0634 0.894 0.574
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
#> SRR542346 1 0.8861 0.61121 0.696 0.304
#> SRR542347 1 0.8861 0.61121 0.696 0.304
#> SRR542348 1 0.8861 0.61121 0.696 0.304
#> SRR542349 1 0.8861 0.61121 0.696 0.304
#> SRR542350 2 0.5059 0.74066 0.112 0.888
#> SRR542351 2 0.9393 0.40258 0.356 0.644
#> SRR542352 2 0.2603 0.79242 0.044 0.956
#> SRR542353 2 0.5059 0.74066 0.112 0.888
#> SRR542354 2 0.9286 0.42366 0.344 0.656
#> SRR542355 2 0.6973 0.68708 0.188 0.812
#> SRR542356 2 0.9323 0.42031 0.348 0.652
#> SRR542357 2 0.7376 0.66462 0.208 0.792
#> SRR542358 2 0.2778 0.79049 0.048 0.952
#> SRR542359 2 0.9044 0.47594 0.320 0.680
#> SRR542360 2 0.9963 0.00747 0.464 0.536
#> SRR542361 1 0.9044 0.61316 0.680 0.320
#> SRR542362 1 0.9044 0.61316 0.680 0.320
#> SRR542363 1 0.8909 0.61029 0.692 0.308
#> SRR542364 2 0.5178 0.76455 0.116 0.884
#> SRR542365 2 0.1414 0.80024 0.020 0.980
#> SRR542366 2 0.1414 0.80024 0.020 0.980
#> SRR542367 2 0.1414 0.80024 0.020 0.980
#> SRR542368 2 0.2948 0.75387 0.052 0.948
#> SRR542369 2 0.1414 0.80024 0.020 0.980
#> SRR542370 2 0.1414 0.80024 0.020 0.980
#> SRR542371 2 0.5294 0.75057 0.120 0.880
#> SRR542372 2 0.1843 0.80170 0.028 0.972
#> SRR542373 2 0.9358 0.40621 0.352 0.648
#> SRR542374 2 0.9393 0.40258 0.356 0.644
#> SRR542375 2 0.6712 0.69153 0.176 0.824
#> SRR542376 1 0.8909 0.61713 0.692 0.308
#> SRR542377 1 0.8955 0.61711 0.688 0.312
#> SRR542378 1 0.9686 0.56500 0.604 0.396
#> SRR542379 1 0.9358 0.59972 0.648 0.352
#> SRR542380 1 0.9635 0.57421 0.612 0.388
#> SRR542381 2 0.6623 0.69342 0.172 0.828
#> SRR542382 1 0.9998 0.39068 0.508 0.492
#> SRR542383 1 0.9608 0.57603 0.616 0.384
#> SRR542384 2 0.6343 0.71086 0.160 0.840
#> SRR542385 2 0.0000 0.79445 0.000 1.000
#> SRR542386 2 0.1414 0.77917 0.020 0.980
#> SRR542387 2 0.5408 0.74528 0.124 0.876
#> SRR542388 2 0.0000 0.79445 0.000 1.000
#> SRR542389 2 0.0672 0.79744 0.008 0.992
#> SRR542390 2 0.0000 0.79445 0.000 1.000
#> SRR542391 2 0.0000 0.79445 0.000 1.000
#> SRR542392 2 0.1414 0.77917 0.020 0.980
#> SRR542393 2 0.1414 0.80024 0.020 0.980
#> SRR542394 2 0.1414 0.78520 0.020 0.980
#> SRR542395 2 0.2948 0.78732 0.052 0.948
#> SRR542396 2 0.4690 0.76388 0.100 0.900
#> SRR542397 2 0.0000 0.79445 0.000 1.000
#> SRR542398 2 0.3733 0.72668 0.072 0.928
#> SRR542399 1 0.9993 0.26487 0.516 0.484
#> SRR542400 1 0.9993 0.26487 0.516 0.484
#> SRR542401 1 0.9993 0.26487 0.516 0.484
#> SRR542402 1 0.9993 0.26487 0.516 0.484
#> SRR542403 1 0.9993 0.26487 0.516 0.484
#> SRR542404 1 0.9993 0.26487 0.516 0.484
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> SRR542346 3 0.1289 0.884 0.032 0.000 0.968
#> SRR542347 3 0.1289 0.884 0.032 0.000 0.968
#> SRR542348 3 0.1289 0.884 0.032 0.000 0.968
#> SRR542349 3 0.1289 0.884 0.032 0.000 0.968
#> SRR542350 2 0.5263 0.809 0.088 0.828 0.084
#> SRR542351 2 0.8666 0.502 0.120 0.544 0.336
#> SRR542352 2 0.2804 0.853 0.060 0.924 0.016
#> SRR542353 2 0.5426 0.803 0.088 0.820 0.092
#> SRR542354 2 0.7495 0.645 0.084 0.668 0.248
#> SRR542355 2 0.3678 0.853 0.080 0.892 0.028
#> SRR542356 2 0.8103 0.620 0.120 0.632 0.248
#> SRR542357 2 0.4007 0.839 0.084 0.880 0.036
#> SRR542358 2 0.2804 0.853 0.060 0.924 0.016
#> SRR542359 2 0.8666 0.502 0.120 0.544 0.336
#> SRR542360 2 0.8880 0.306 0.120 0.464 0.416
#> SRR542361 3 0.0983 0.901 0.004 0.016 0.980
#> SRR542362 3 0.0983 0.901 0.004 0.016 0.980
#> SRR542363 3 0.0237 0.894 0.004 0.000 0.996
#> SRR542364 2 0.5093 0.829 0.088 0.836 0.076
#> SRR542365 2 0.0237 0.871 0.004 0.996 0.000
#> SRR542366 2 0.0000 0.871 0.000 1.000 0.000
#> SRR542367 2 0.0000 0.871 0.000 1.000 0.000
#> SRR542368 2 0.0892 0.867 0.000 0.980 0.020
#> SRR542369 2 0.0237 0.871 0.004 0.996 0.000
#> SRR542370 2 0.0237 0.871 0.004 0.996 0.000
#> SRR542371 2 0.1919 0.865 0.020 0.956 0.024
#> SRR542372 2 0.0592 0.871 0.012 0.988 0.000
#> SRR542373 2 0.6383 0.789 0.104 0.768 0.128
#> SRR542374 2 0.8666 0.502 0.120 0.544 0.336
#> SRR542375 2 0.5519 0.797 0.068 0.812 0.120
#> SRR542376 3 0.1636 0.897 0.020 0.016 0.964
#> SRR542377 3 0.1774 0.898 0.024 0.016 0.960
#> SRR542378 3 0.3973 0.847 0.032 0.088 0.880
#> SRR542379 3 0.3434 0.870 0.032 0.064 0.904
#> SRR542380 3 0.3713 0.862 0.032 0.076 0.892
#> SRR542381 2 0.5449 0.800 0.068 0.816 0.116
#> SRR542382 3 0.6452 0.551 0.032 0.264 0.704
#> SRR542383 3 0.3713 0.862 0.032 0.076 0.892
#> SRR542384 2 0.5519 0.797 0.068 0.812 0.120
#> SRR542385 2 0.0237 0.871 0.004 0.996 0.000
#> SRR542386 2 0.0237 0.871 0.004 0.996 0.000
#> SRR542387 2 0.1919 0.865 0.020 0.956 0.024
#> SRR542388 2 0.0237 0.871 0.004 0.996 0.000
#> SRR542389 2 0.0237 0.871 0.004 0.996 0.000
#> SRR542390 2 0.0237 0.871 0.004 0.996 0.000
#> SRR542391 2 0.0237 0.871 0.004 0.996 0.000
#> SRR542392 2 0.0000 0.871 0.000 1.000 0.000
#> SRR542393 2 0.0424 0.871 0.008 0.992 0.000
#> SRR542394 2 0.1781 0.866 0.020 0.960 0.020
#> SRR542395 2 0.1919 0.865 0.020 0.956 0.024
#> SRR542396 2 0.5229 0.807 0.068 0.828 0.104
#> SRR542397 2 0.0237 0.871 0.004 0.996 0.000
#> SRR542398 2 0.2749 0.847 0.012 0.924 0.064
#> SRR542399 1 0.4558 1.000 0.856 0.100 0.044
#> SRR542400 1 0.4558 1.000 0.856 0.100 0.044
#> SRR542401 1 0.4558 1.000 0.856 0.100 0.044
#> SRR542402 1 0.4558 1.000 0.856 0.100 0.044
#> SRR542403 1 0.4558 1.000 0.856 0.100 0.044
#> SRR542404 1 0.4558 1.000 0.856 0.100 0.044
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> SRR542346 4 0.4477 0.724 0.000 0.000 0.312 0.688
#> SRR542347 4 0.4304 0.747 0.000 0.000 0.284 0.716
#> SRR542348 4 0.4477 0.724 0.000 0.000 0.312 0.688
#> SRR542349 4 0.4304 0.747 0.000 0.000 0.284 0.716
#> SRR542350 2 0.4973 0.373 0.008 0.644 0.348 0.000
#> SRR542351 3 0.2060 0.581 0.000 0.052 0.932 0.016
#> SRR542352 2 0.3852 0.629 0.008 0.800 0.192 0.000
#> SRR542353 2 0.5024 0.350 0.008 0.632 0.360 0.000
#> SRR542354 3 0.5194 0.268 0.012 0.332 0.652 0.004
#> SRR542355 2 0.7583 0.323 0.016 0.544 0.272 0.168
#> SRR542356 3 0.2329 0.584 0.012 0.072 0.916 0.000
#> SRR542357 2 0.4770 0.551 0.012 0.700 0.288 0.000
#> SRR542358 2 0.3852 0.629 0.008 0.800 0.192 0.000
#> SRR542359 3 0.2060 0.581 0.000 0.052 0.932 0.016
#> SRR542360 3 0.1975 0.535 0.000 0.016 0.936 0.048
#> SRR542361 4 0.2814 0.817 0.000 0.000 0.132 0.868
#> SRR542362 4 0.2814 0.817 0.000 0.000 0.132 0.868
#> SRR542363 4 0.3266 0.803 0.000 0.000 0.168 0.832
#> SRR542364 2 0.4916 0.109 0.000 0.576 0.424 0.000
#> SRR542365 2 0.0592 0.791 0.000 0.984 0.016 0.000
#> SRR542366 2 0.1474 0.785 0.000 0.948 0.052 0.000
#> SRR542367 2 0.1545 0.781 0.008 0.952 0.040 0.000
#> SRR542368 2 0.2376 0.779 0.020 0.928 0.040 0.012
#> SRR542369 2 0.0779 0.790 0.004 0.980 0.016 0.000
#> SRR542370 2 0.0592 0.791 0.000 0.984 0.016 0.000
#> SRR542371 2 0.6288 0.513 0.012 0.692 0.132 0.164
#> SRR542372 2 0.2101 0.765 0.012 0.928 0.060 0.000
#> SRR542373 3 0.5689 0.552 0.000 0.184 0.712 0.104
#> SRR542374 3 0.2060 0.581 0.000 0.052 0.932 0.016
#> SRR542375 3 0.8060 0.364 0.008 0.308 0.420 0.264
#> SRR542376 4 0.2011 0.814 0.000 0.000 0.080 0.920
#> SRR542377 4 0.2281 0.817 0.000 0.000 0.096 0.904
#> SRR542378 4 0.2246 0.744 0.004 0.016 0.052 0.928
#> SRR542379 4 0.0000 0.782 0.000 0.000 0.000 1.000
#> SRR542380 4 0.2246 0.744 0.004 0.016 0.052 0.928
#> SRR542381 3 0.8191 0.347 0.012 0.320 0.404 0.264
#> SRR542382 4 0.5069 0.510 0.004 0.124 0.096 0.776
#> SRR542383 4 0.2246 0.744 0.004 0.016 0.052 0.928
#> SRR542384 3 0.7698 0.277 0.004 0.380 0.428 0.188
#> SRR542385 2 0.0000 0.790 0.000 1.000 0.000 0.000
#> SRR542386 2 0.0524 0.788 0.004 0.988 0.008 0.000
#> SRR542387 2 0.6416 0.494 0.012 0.680 0.136 0.172
#> SRR542388 2 0.0592 0.791 0.000 0.984 0.016 0.000
#> SRR542389 2 0.0592 0.791 0.000 0.984 0.016 0.000
#> SRR542390 2 0.0000 0.790 0.000 1.000 0.000 0.000
#> SRR542391 2 0.0592 0.791 0.000 0.984 0.016 0.000
#> SRR542392 2 0.1209 0.783 0.004 0.964 0.032 0.000
#> SRR542393 2 0.0895 0.791 0.004 0.976 0.020 0.000
#> SRR542394 2 0.5869 0.557 0.012 0.724 0.100 0.164
#> SRR542395 2 0.5611 0.568 0.008 0.736 0.088 0.168
#> SRR542396 3 0.7759 0.241 0.008 0.396 0.420 0.176
#> SRR542397 2 0.0000 0.790 0.000 1.000 0.000 0.000
#> SRR542398 2 0.6712 0.412 0.008 0.644 0.176 0.172
#> SRR542399 1 0.0779 1.000 0.980 0.004 0.000 0.016
#> SRR542400 1 0.0779 1.000 0.980 0.004 0.000 0.016
#> SRR542401 1 0.0779 1.000 0.980 0.004 0.000 0.016
#> SRR542402 1 0.0779 1.000 0.980 0.004 0.000 0.016
#> SRR542403 1 0.0779 1.000 0.980 0.004 0.000 0.016
#> SRR542404 1 0.0779 1.000 0.980 0.004 0.000 0.016
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> SRR542346 4 0.4254 0.6996 0.00 0.000 0.220 0.740 0.040
#> SRR542347 4 0.4062 0.7191 0.00 0.000 0.196 0.764 0.040
#> SRR542348 4 0.4254 0.6996 0.00 0.000 0.220 0.740 0.040
#> SRR542349 4 0.4062 0.7191 0.00 0.000 0.196 0.764 0.040
#> SRR542350 2 0.4940 0.2453 0.00 0.576 0.392 0.000 0.032
#> SRR542351 3 0.1648 0.7853 0.00 0.000 0.940 0.020 0.040
#> SRR542352 2 0.3146 0.6935 0.00 0.856 0.092 0.000 0.052
#> SRR542353 2 0.4974 0.2031 0.00 0.560 0.408 0.000 0.032
#> SRR542354 3 0.5449 0.5211 0.00 0.200 0.688 0.020 0.092
#> SRR542355 5 0.5319 0.5965 0.00 0.240 0.092 0.004 0.664
#> SRR542356 3 0.2144 0.7458 0.00 0.000 0.912 0.020 0.068
#> SRR542357 2 0.5896 0.3405 0.00 0.564 0.308 0.000 0.128
#> SRR542358 2 0.2915 0.6913 0.00 0.860 0.116 0.000 0.024
#> SRR542359 3 0.1872 0.7833 0.00 0.000 0.928 0.020 0.052
#> SRR542360 3 0.1800 0.7841 0.00 0.000 0.932 0.020 0.048
#> SRR542361 4 0.0510 0.8069 0.00 0.000 0.016 0.984 0.000
#> SRR542362 4 0.0798 0.8064 0.00 0.000 0.016 0.976 0.008
#> SRR542363 4 0.1549 0.8010 0.00 0.000 0.016 0.944 0.040
#> SRR542364 3 0.6622 0.0919 0.00 0.328 0.440 0.000 0.232
#> SRR542365 2 0.1943 0.7454 0.00 0.924 0.020 0.000 0.056
#> SRR542366 2 0.4132 0.5813 0.00 0.720 0.020 0.000 0.260
#> SRR542367 2 0.4380 0.5135 0.00 0.676 0.020 0.000 0.304
#> SRR542368 2 0.4993 0.5404 0.02 0.680 0.032 0.000 0.268
#> SRR542369 2 0.1211 0.7496 0.00 0.960 0.024 0.000 0.016
#> SRR542370 2 0.2144 0.7379 0.00 0.912 0.020 0.000 0.068
#> SRR542371 5 0.3700 0.6963 0.00 0.240 0.008 0.000 0.752
#> SRR542372 2 0.4781 0.1933 0.00 0.552 0.020 0.000 0.428
#> SRR542373 3 0.4430 0.5245 0.00 0.036 0.708 0.000 0.256
#> SRR542374 3 0.1648 0.7853 0.00 0.000 0.940 0.020 0.040
#> SRR542375 5 0.3849 0.7086 0.00 0.036 0.124 0.020 0.820
#> SRR542376 4 0.0703 0.8047 0.00 0.000 0.000 0.976 0.024
#> SRR542377 4 0.0865 0.8060 0.00 0.000 0.004 0.972 0.024
#> SRR542378 4 0.3796 0.5815 0.00 0.000 0.000 0.700 0.300
#> SRR542379 4 0.1197 0.7974 0.00 0.000 0.000 0.952 0.048
#> SRR542380 4 0.3796 0.5815 0.00 0.000 0.000 0.700 0.300
#> SRR542381 5 0.3207 0.7397 0.00 0.048 0.056 0.024 0.872
#> SRR542382 5 0.3684 0.4820 0.00 0.000 0.000 0.280 0.720
#> SRR542383 4 0.3796 0.5815 0.00 0.000 0.000 0.700 0.300
#> SRR542384 5 0.4159 0.6777 0.00 0.036 0.172 0.012 0.780
#> SRR542385 2 0.1671 0.7528 0.00 0.924 0.000 0.000 0.076
#> SRR542386 2 0.3970 0.6442 0.00 0.744 0.020 0.000 0.236
#> SRR542387 5 0.3439 0.7372 0.00 0.188 0.008 0.004 0.800
#> SRR542388 2 0.1671 0.7525 0.00 0.924 0.000 0.000 0.076
#> SRR542389 2 0.1341 0.7494 0.00 0.944 0.000 0.000 0.056
#> SRR542390 2 0.1478 0.7527 0.00 0.936 0.000 0.000 0.064
#> SRR542391 2 0.1410 0.7519 0.00 0.940 0.000 0.000 0.060
#> SRR542392 2 0.4400 0.5526 0.00 0.672 0.020 0.000 0.308
#> SRR542393 2 0.2280 0.7451 0.00 0.880 0.000 0.000 0.120
#> SRR542394 5 0.3452 0.6847 0.00 0.244 0.000 0.000 0.756
#> SRR542395 5 0.4142 0.6169 0.00 0.308 0.004 0.004 0.684
#> SRR542396 5 0.4098 0.6889 0.00 0.048 0.144 0.012 0.796
#> SRR542397 2 0.1732 0.7526 0.00 0.920 0.000 0.000 0.080
#> SRR542398 5 0.4234 0.7318 0.00 0.172 0.040 0.012 0.776
#> SRR542399 1 0.0000 1.0000 1.00 0.000 0.000 0.000 0.000
#> SRR542400 1 0.0000 1.0000 1.00 0.000 0.000 0.000 0.000
#> SRR542401 1 0.0000 1.0000 1.00 0.000 0.000 0.000 0.000
#> SRR542402 1 0.0000 1.0000 1.00 0.000 0.000 0.000 0.000
#> SRR542403 1 0.0000 1.0000 1.00 0.000 0.000 0.000 0.000
#> SRR542404 1 0.0000 1.0000 1.00 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
#> SRR542346 4 0.3962 0.799 0.000 0.004 0.128 0.772 0.000 0.096
#> SRR542347 4 0.3565 0.820 0.000 0.004 0.092 0.808 0.000 0.096
#> SRR542348 4 0.3962 0.799 0.000 0.004 0.128 0.772 0.000 0.096
#> SRR542349 4 0.3565 0.820 0.000 0.004 0.092 0.808 0.000 0.096
#> SRR542350 2 0.4214 0.260 0.008 0.656 0.320 0.004 0.012 0.000
#> SRR542351 3 0.0146 0.853 0.000 0.000 0.996 0.004 0.000 0.000
#> SRR542352 2 0.1129 0.591 0.008 0.964 0.012 0.004 0.012 0.000
#> SRR542353 2 0.4214 0.260 0.008 0.656 0.320 0.004 0.012 0.000
#> SRR542354 3 0.6273 0.501 0.008 0.228 0.588 0.004 0.060 0.112
#> SRR542355 5 0.6665 0.379 0.008 0.244 0.036 0.004 0.504 0.204
#> SRR542356 3 0.3309 0.794 0.008 0.084 0.848 0.004 0.048 0.008
#> SRR542357 2 0.6799 0.198 0.008 0.528 0.180 0.004 0.068 0.212
#> SRR542358 2 0.1096 0.596 0.000 0.964 0.020 0.004 0.004 0.008
#> SRR542359 3 0.0551 0.852 0.000 0.000 0.984 0.004 0.008 0.004
#> SRR542360 3 0.1546 0.839 0.000 0.004 0.944 0.020 0.004 0.028
#> SRR542361 4 0.1285 0.835 0.000 0.000 0.004 0.944 0.052 0.000
#> SRR542362 4 0.1285 0.835 0.000 0.000 0.004 0.944 0.052 0.000
#> SRR542363 4 0.2009 0.835 0.000 0.004 0.008 0.904 0.000 0.084
#> SRR542364 6 0.5986 0.186 0.000 0.080 0.376 0.000 0.052 0.492
#> SRR542365 6 0.3659 0.526 0.000 0.364 0.000 0.000 0.000 0.636
#> SRR542366 6 0.2848 0.690 0.000 0.176 0.000 0.000 0.008 0.816
#> SRR542367 6 0.3736 0.658 0.000 0.156 0.000 0.000 0.068 0.776
#> SRR542368 6 0.4848 0.667 0.024 0.212 0.004 0.000 0.064 0.696
#> SRR542369 2 0.3695 0.186 0.000 0.624 0.000 0.000 0.000 0.376
#> SRR542370 6 0.3531 0.595 0.000 0.328 0.000 0.000 0.000 0.672
#> SRR542371 5 0.5117 0.389 0.000 0.076 0.004 0.000 0.544 0.376
#> SRR542372 6 0.3876 0.632 0.000 0.120 0.000 0.000 0.108 0.772
#> SRR542373 3 0.4249 0.666 0.000 0.008 0.752 0.000 0.112 0.128
#> SRR542374 3 0.0146 0.853 0.000 0.000 0.996 0.004 0.000 0.000
#> SRR542375 5 0.2620 0.601 0.000 0.012 0.076 0.004 0.884 0.024
#> SRR542376 4 0.2462 0.802 0.000 0.000 0.000 0.876 0.096 0.028
#> SRR542377 4 0.2609 0.803 0.000 0.000 0.000 0.868 0.096 0.036
#> SRR542378 5 0.4460 0.074 0.000 0.000 0.000 0.452 0.520 0.028
#> SRR542379 4 0.2784 0.778 0.000 0.000 0.000 0.848 0.124 0.028
#> SRR542380 5 0.4460 0.074 0.000 0.000 0.000 0.452 0.520 0.028
#> SRR542381 5 0.2077 0.615 0.000 0.012 0.032 0.004 0.920 0.032
#> SRR542382 5 0.2538 0.558 0.000 0.000 0.000 0.124 0.860 0.016
#> SRR542383 5 0.4460 0.074 0.000 0.000 0.000 0.452 0.520 0.028
#> SRR542384 5 0.3499 0.570 0.000 0.012 0.132 0.000 0.812 0.044
#> SRR542385 2 0.3259 0.563 0.000 0.772 0.000 0.000 0.012 0.216
#> SRR542386 6 0.4210 0.563 0.000 0.336 0.000 0.000 0.028 0.636
#> SRR542387 5 0.4871 0.470 0.000 0.060 0.004 0.004 0.620 0.312
#> SRR542388 2 0.3674 0.513 0.000 0.716 0.000 0.000 0.016 0.268
#> SRR542389 2 0.2118 0.620 0.000 0.888 0.000 0.000 0.008 0.104
#> SRR542390 2 0.2841 0.602 0.000 0.824 0.000 0.000 0.012 0.164
#> SRR542391 2 0.2730 0.611 0.000 0.836 0.000 0.000 0.012 0.152
#> SRR542392 6 0.4638 0.606 0.000 0.296 0.000 0.000 0.068 0.636
#> SRR542393 2 0.4079 0.415 0.000 0.680 0.000 0.000 0.032 0.288
#> SRR542394 5 0.5026 0.406 0.000 0.072 0.004 0.000 0.568 0.356
#> SRR542395 5 0.5694 0.400 0.000 0.176 0.004 0.004 0.564 0.252
#> SRR542396 5 0.4423 0.561 0.000 0.012 0.112 0.000 0.740 0.136
#> SRR542397 2 0.3494 0.526 0.000 0.736 0.000 0.000 0.012 0.252
#> SRR542398 5 0.3921 0.466 0.000 0.012 0.004 0.000 0.676 0.308
#> SRR542399 1 0.0260 1.000 0.992 0.000 0.000 0.008 0.000 0.000
#> SRR542400 1 0.0260 1.000 0.992 0.000 0.000 0.008 0.000 0.000
#> SRR542401 1 0.0260 1.000 0.992 0.000 0.000 0.008 0.000 0.000
#> SRR542402 1 0.0260 1.000 0.992 0.000 0.000 0.008 0.000 0.000
#> SRR542403 1 0.0260 1.000 0.992 0.000 0.000 0.008 0.000 0.000
#> SRR542404 1 0.0260 1.000 0.992 0.000 0.000 0.008 0.000 0.000
Heatmaps for the consensus matrix. It visualizes the probability of two samples to be in a same group.
consensus_heatmap(res, k = 2)
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 16804 rows and 59 columns.
#> Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'CV' method.
#> Subgroups are detected by 'skmeans' method.
#> Performed in total 1250 partitions by row resampling.
#> Best k for subgroups seems to be 3.
#>
#> Following methods can be applied to this 'ConsensusPartition' object:
#> [1] "cola_report" "collect_classes" "collect_plots"
#> [4] "collect_stats" "colnames" "compare_signatures"
#> [7] "consensus_heatmap" "dimension_reduction" "functional_enrichment"
#> [10] "get_anno_col" "get_anno" "get_classes"
#> [13] "get_consensus" "get_matrix" "get_membership"
#> [16] "get_param" "get_signatures" "get_stats"
#> [19] "is_best_k" "is_stable_k" "membership_heatmap"
#> [22] "ncol" "nrow" "plot_ecdf"
#> [25] "rownames" "select_partition_number" "show"
#> [28] "suggest_best_k" "test_to_known_factors"
collect_plots()
function collects all the plots made from res
for all k
(number of partitions)
into one single page to provide an easy and fast comparison between different k
.
collect_plots(res)
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.287 0.671 0.818 0.5002 0.499 0.499
#> 3 3 0.755 0.828 0.914 0.2998 0.761 0.564
#> 4 4 0.762 0.602 0.811 0.1354 0.818 0.558
#> 5 5 0.808 0.777 0.888 0.0885 0.853 0.528
#> 6 6 0.749 0.602 0.802 0.0409 0.934 0.691
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
#> SRR542346 1 0.9552 0.727 0.624 0.376
#> SRR542347 1 0.9552 0.727 0.624 0.376
#> SRR542348 1 0.9552 0.727 0.624 0.376
#> SRR542349 1 0.9552 0.727 0.624 0.376
#> SRR542350 2 0.7139 0.737 0.196 0.804
#> SRR542351 2 0.0672 0.619 0.008 0.992
#> SRR542352 2 0.7139 0.737 0.196 0.804
#> SRR542353 2 0.7139 0.737 0.196 0.804
#> SRR542354 2 0.0000 0.626 0.000 1.000
#> SRR542355 2 0.0000 0.626 0.000 1.000
#> SRR542356 2 0.0000 0.626 0.000 1.000
#> SRR542357 2 0.0000 0.626 0.000 1.000
#> SRR542358 2 0.7139 0.737 0.196 0.804
#> SRR542359 2 0.9963 -0.552 0.464 0.536
#> SRR542360 2 0.5737 0.395 0.136 0.864
#> SRR542361 1 0.9522 0.729 0.628 0.372
#> SRR542362 1 0.9522 0.729 0.628 0.372
#> SRR542363 1 0.9522 0.729 0.628 0.372
#> SRR542364 2 0.6343 0.726 0.160 0.840
#> SRR542365 2 0.9460 0.768 0.364 0.636
#> SRR542366 2 0.7602 0.746 0.220 0.780
#> SRR542367 2 0.9427 0.769 0.360 0.640
#> SRR542368 1 0.6623 0.369 0.828 0.172
#> SRR542369 2 0.9393 0.769 0.356 0.644
#> SRR542370 2 0.9393 0.769 0.356 0.644
#> SRR542371 2 0.6801 0.669 0.180 0.820
#> SRR542372 2 0.9491 0.766 0.368 0.632
#> SRR542373 2 0.0672 0.619 0.008 0.992
#> SRR542374 2 0.1184 0.610 0.016 0.984
#> SRR542375 1 0.9427 0.598 0.640 0.360
#> SRR542376 1 0.9522 0.729 0.628 0.372
#> SRR542377 1 0.9522 0.729 0.628 0.372
#> SRR542378 1 0.7139 0.741 0.804 0.196
#> SRR542379 1 0.9358 0.733 0.648 0.352
#> SRR542380 1 0.7139 0.741 0.804 0.196
#> SRR542381 1 0.9491 0.585 0.632 0.368
#> SRR542382 1 0.7139 0.741 0.804 0.196
#> SRR542383 1 0.7139 0.741 0.804 0.196
#> SRR542384 1 0.9427 0.591 0.640 0.360
#> SRR542385 2 0.9522 0.764 0.372 0.628
#> SRR542386 2 0.9552 0.762 0.376 0.624
#> SRR542387 2 0.6801 0.669 0.180 0.820
#> SRR542388 2 0.9522 0.764 0.372 0.628
#> SRR542389 2 0.9427 0.769 0.360 0.640
#> SRR542390 2 0.9522 0.764 0.372 0.628
#> SRR542391 2 0.9522 0.764 0.372 0.628
#> SRR542392 2 0.9552 0.762 0.376 0.624
#> SRR542393 2 0.9427 0.769 0.360 0.640
#> SRR542394 2 0.9552 0.762 0.376 0.624
#> SRR542395 2 0.7453 0.692 0.212 0.788
#> SRR542396 1 0.6531 0.397 0.832 0.168
#> SRR542397 2 0.9522 0.764 0.372 0.628
#> SRR542398 1 0.0000 0.667 1.000 0.000
#> SRR542399 1 0.0000 0.667 1.000 0.000
#> SRR542400 1 0.0000 0.667 1.000 0.000
#> SRR542401 1 0.0000 0.667 1.000 0.000
#> SRR542402 1 0.0000 0.667 1.000 0.000
#> SRR542403 1 0.0000 0.667 1.000 0.000
#> SRR542404 1 0.0000 0.667 1.000 0.000
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> SRR542346 3 0.0424 0.850 0.000 0.008 0.992
#> SRR542347 3 0.0424 0.850 0.000 0.008 0.992
#> SRR542348 3 0.0424 0.850 0.000 0.008 0.992
#> SRR542349 3 0.0424 0.850 0.000 0.008 0.992
#> SRR542350 2 0.0424 0.920 0.000 0.992 0.008
#> SRR542351 3 0.1989 0.826 0.004 0.048 0.948
#> SRR542352 2 0.0000 0.922 0.000 1.000 0.000
#> SRR542353 2 0.0592 0.919 0.000 0.988 0.012
#> SRR542354 2 0.5835 0.567 0.000 0.660 0.340
#> SRR542355 2 0.4178 0.806 0.000 0.828 0.172
#> SRR542356 2 0.6057 0.562 0.004 0.656 0.340
#> SRR542357 2 0.1031 0.913 0.000 0.976 0.024
#> SRR542358 2 0.0000 0.922 0.000 1.000 0.000
#> SRR542359 1 0.6422 0.469 0.660 0.016 0.324
#> SRR542360 3 0.0661 0.849 0.004 0.008 0.988
#> SRR542361 3 0.0000 0.852 0.000 0.000 1.000
#> SRR542362 3 0.0000 0.852 0.000 0.000 1.000
#> SRR542363 3 0.0000 0.852 0.000 0.000 1.000
#> SRR542364 2 0.4883 0.703 0.004 0.788 0.208
#> SRR542365 2 0.0424 0.924 0.008 0.992 0.000
#> SRR542366 2 0.0424 0.924 0.008 0.992 0.000
#> SRR542367 2 0.0424 0.924 0.008 0.992 0.000
#> SRR542368 1 0.2400 0.857 0.932 0.064 0.004
#> SRR542369 2 0.0424 0.924 0.008 0.992 0.000
#> SRR542370 2 0.0424 0.924 0.008 0.992 0.000
#> SRR542371 2 0.1182 0.916 0.012 0.976 0.012
#> SRR542372 2 0.0424 0.922 0.000 0.992 0.008
#> SRR542373 3 0.2200 0.819 0.004 0.056 0.940
#> SRR542374 3 0.1989 0.826 0.004 0.048 0.948
#> SRR542375 3 0.5760 0.627 0.328 0.000 0.672
#> SRR542376 3 0.0000 0.852 0.000 0.000 1.000
#> SRR542377 3 0.0000 0.852 0.000 0.000 1.000
#> SRR542378 3 0.5621 0.648 0.308 0.000 0.692
#> SRR542379 3 0.3038 0.809 0.104 0.000 0.896
#> SRR542380 3 0.5216 0.699 0.260 0.000 0.740
#> SRR542381 3 0.6570 0.629 0.308 0.024 0.668
#> SRR542382 3 0.5760 0.621 0.328 0.000 0.672
#> SRR542383 3 0.5016 0.717 0.240 0.000 0.760
#> SRR542384 3 0.6033 0.612 0.336 0.004 0.660
#> SRR542385 2 0.0424 0.924 0.008 0.992 0.000
#> SRR542386 2 0.1753 0.901 0.048 0.952 0.000
#> SRR542387 2 0.7091 0.566 0.268 0.676 0.056
#> SRR542388 2 0.1964 0.895 0.056 0.944 0.000
#> SRR542389 2 0.0424 0.924 0.008 0.992 0.000
#> SRR542390 2 0.0424 0.924 0.008 0.992 0.000
#> SRR542391 2 0.0424 0.924 0.008 0.992 0.000
#> SRR542392 1 0.0237 0.915 0.996 0.004 0.000
#> SRR542393 2 0.0237 0.923 0.004 0.996 0.000
#> SRR542394 2 0.3207 0.865 0.084 0.904 0.012
#> SRR542395 2 0.4068 0.827 0.120 0.864 0.016
#> SRR542396 1 0.5335 0.584 0.760 0.008 0.232
#> SRR542397 2 0.0424 0.924 0.008 0.992 0.000
#> SRR542398 1 0.0000 0.916 1.000 0.000 0.000
#> SRR542399 1 0.0237 0.918 0.996 0.000 0.004
#> SRR542400 1 0.0237 0.918 0.996 0.000 0.004
#> SRR542401 1 0.0237 0.918 0.996 0.000 0.004
#> SRR542402 1 0.0237 0.918 0.996 0.000 0.004
#> SRR542403 1 0.0237 0.918 0.996 0.000 0.004
#> SRR542404 1 0.0237 0.918 0.996 0.000 0.004
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> SRR542346 4 0.5000 0.2353 0.000 0.000 0.496 0.504
#> SRR542347 4 0.4999 0.2406 0.000 0.000 0.492 0.508
#> SRR542348 4 0.5000 0.2353 0.000 0.000 0.496 0.504
#> SRR542349 4 0.4998 0.2454 0.000 0.000 0.488 0.512
#> SRR542350 2 0.2647 0.8123 0.000 0.880 0.120 0.000
#> SRR542351 3 0.0657 0.7131 0.000 0.012 0.984 0.004
#> SRR542352 2 0.1474 0.8698 0.000 0.948 0.052 0.000
#> SRR542353 2 0.2704 0.8083 0.000 0.876 0.124 0.000
#> SRR542354 3 0.4964 0.2973 0.000 0.380 0.616 0.004
#> SRR542355 4 0.7603 -0.0322 0.000 0.360 0.204 0.436
#> SRR542356 3 0.0592 0.7128 0.000 0.016 0.984 0.000
#> SRR542357 2 0.3123 0.7896 0.000 0.844 0.156 0.000
#> SRR542358 2 0.1557 0.8673 0.000 0.944 0.056 0.000
#> SRR542359 3 0.2125 0.6564 0.076 0.004 0.920 0.000
#> SRR542360 3 0.1022 0.6822 0.000 0.000 0.968 0.032
#> SRR542361 4 0.4955 0.2888 0.000 0.000 0.444 0.556
#> SRR542362 4 0.4955 0.2888 0.000 0.000 0.444 0.556
#> SRR542363 4 0.4961 0.2857 0.000 0.000 0.448 0.552
#> SRR542364 3 0.5163 0.0269 0.000 0.480 0.516 0.004
#> SRR542365 2 0.0000 0.9009 0.000 1.000 0.000 0.000
#> SRR542366 2 0.0188 0.9002 0.000 0.996 0.004 0.000
#> SRR542367 2 0.0336 0.8993 0.000 0.992 0.008 0.000
#> SRR542368 1 0.0000 0.9924 1.000 0.000 0.000 0.000
#> SRR542369 2 0.0000 0.9009 0.000 1.000 0.000 0.000
#> SRR542370 2 0.0000 0.9009 0.000 1.000 0.000 0.000
#> SRR542371 4 0.7506 0.0219 0.000 0.376 0.184 0.440
#> SRR542372 2 0.2053 0.8485 0.000 0.924 0.072 0.004
#> SRR542373 3 0.1978 0.6436 0.000 0.004 0.928 0.068
#> SRR542374 3 0.0657 0.7131 0.000 0.012 0.984 0.004
#> SRR542375 4 0.5833 0.1064 0.000 0.032 0.440 0.528
#> SRR542376 4 0.4356 0.3619 0.000 0.000 0.292 0.708
#> SRR542377 4 0.4776 0.3262 0.000 0.000 0.376 0.624
#> SRR542378 4 0.0336 0.4419 0.000 0.000 0.008 0.992
#> SRR542379 4 0.1637 0.4352 0.000 0.000 0.060 0.940
#> SRR542380 4 0.0336 0.4419 0.000 0.000 0.008 0.992
#> SRR542381 4 0.6114 0.1122 0.000 0.048 0.428 0.524
#> SRR542382 4 0.0469 0.4351 0.000 0.000 0.012 0.988
#> SRR542383 4 0.0336 0.4419 0.000 0.000 0.008 0.992
#> SRR542384 4 0.6137 0.0900 0.000 0.048 0.448 0.504
#> SRR542385 2 0.0188 0.9003 0.000 0.996 0.004 0.000
#> SRR542386 2 0.0376 0.8989 0.004 0.992 0.004 0.000
#> SRR542387 4 0.7323 0.0937 0.000 0.164 0.352 0.484
#> SRR542388 2 0.0592 0.8941 0.016 0.984 0.000 0.000
#> SRR542389 2 0.0000 0.9009 0.000 1.000 0.000 0.000
#> SRR542390 2 0.0188 0.9003 0.000 0.996 0.004 0.000
#> SRR542391 2 0.0000 0.9009 0.000 1.000 0.000 0.000
#> SRR542392 1 0.0188 0.9887 0.996 0.004 0.000 0.000
#> SRR542393 2 0.0000 0.9009 0.000 1.000 0.000 0.000
#> SRR542394 2 0.6442 0.1646 0.000 0.492 0.068 0.440
#> SRR542395 2 0.6143 0.1648 0.000 0.496 0.048 0.456
#> SRR542396 4 0.6801 0.0884 0.020 0.052 0.436 0.492
#> SRR542397 2 0.0188 0.9003 0.000 0.996 0.004 0.000
#> SRR542398 1 0.1389 0.9436 0.952 0.000 0.000 0.048
#> SRR542399 1 0.0000 0.9924 1.000 0.000 0.000 0.000
#> SRR542400 1 0.0000 0.9924 1.000 0.000 0.000 0.000
#> SRR542401 1 0.0000 0.9924 1.000 0.000 0.000 0.000
#> SRR542402 1 0.0000 0.9924 1.000 0.000 0.000 0.000
#> SRR542403 1 0.0000 0.9924 1.000 0.000 0.000 0.000
#> SRR542404 1 0.0000 0.9924 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
#> SRR542346 4 0.1478 0.8817 0.000 0.000 0.064 0.936 0.000
#> SRR542347 4 0.0880 0.8992 0.000 0.000 0.032 0.968 0.000
#> SRR542348 4 0.1410 0.8841 0.000 0.000 0.060 0.940 0.000
#> SRR542349 4 0.0963 0.8977 0.000 0.000 0.036 0.964 0.000
#> SRR542350 3 0.5014 0.4427 0.000 0.368 0.592 0.000 0.040
#> SRR542351 3 0.0404 0.7448 0.000 0.000 0.988 0.012 0.000
#> SRR542352 2 0.3495 0.7373 0.000 0.812 0.160 0.000 0.028
#> SRR542353 3 0.4779 0.4075 0.000 0.388 0.588 0.000 0.024
#> SRR542354 3 0.4322 0.6201 0.000 0.012 0.716 0.012 0.260
#> SRR542355 5 0.3246 0.5781 0.000 0.008 0.184 0.000 0.808
#> SRR542356 3 0.2771 0.7149 0.000 0.000 0.860 0.012 0.128
#> SRR542357 3 0.5275 0.5715 0.000 0.084 0.640 0.000 0.276
#> SRR542358 2 0.3496 0.6865 0.000 0.788 0.200 0.000 0.012
#> SRR542359 3 0.0404 0.7448 0.000 0.000 0.988 0.012 0.000
#> SRR542360 3 0.1270 0.7275 0.000 0.000 0.948 0.052 0.000
#> SRR542361 4 0.0162 0.9063 0.000 0.000 0.004 0.996 0.000
#> SRR542362 4 0.0162 0.9063 0.000 0.000 0.004 0.996 0.000
#> SRR542363 4 0.0162 0.9063 0.000 0.000 0.004 0.996 0.000
#> SRR542364 3 0.4987 0.4806 0.000 0.236 0.684 0.000 0.080
#> SRR542365 2 0.0912 0.9200 0.000 0.972 0.012 0.000 0.016
#> SRR542366 2 0.1907 0.8949 0.000 0.928 0.028 0.000 0.044
#> SRR542367 2 0.4173 0.5581 0.000 0.688 0.012 0.000 0.300
#> SRR542368 1 0.0000 0.9696 1.000 0.000 0.000 0.000 0.000
#> SRR542369 2 0.0807 0.9211 0.000 0.976 0.012 0.000 0.012
#> SRR542370 2 0.1106 0.9196 0.000 0.964 0.012 0.000 0.024
#> SRR542371 5 0.0898 0.7317 0.000 0.020 0.008 0.000 0.972
#> SRR542372 5 0.4641 -0.0391 0.000 0.456 0.012 0.000 0.532
#> SRR542373 3 0.1942 0.7074 0.000 0.000 0.920 0.012 0.068
#> SRR542374 3 0.0404 0.7448 0.000 0.000 0.988 0.012 0.000
#> SRR542375 5 0.3835 0.6609 0.000 0.000 0.244 0.012 0.744
#> SRR542376 4 0.0162 0.9054 0.000 0.000 0.000 0.996 0.004
#> SRR542377 4 0.0162 0.9054 0.000 0.000 0.000 0.996 0.004
#> SRR542378 4 0.3636 0.6496 0.000 0.000 0.000 0.728 0.272
#> SRR542379 4 0.0404 0.9017 0.000 0.000 0.000 0.988 0.012
#> SRR542380 4 0.3480 0.6870 0.000 0.000 0.000 0.752 0.248
#> SRR542381 5 0.2522 0.7238 0.000 0.000 0.108 0.012 0.880
#> SRR542382 5 0.4074 0.3052 0.000 0.000 0.000 0.364 0.636
#> SRR542383 4 0.3395 0.7027 0.000 0.000 0.000 0.764 0.236
#> SRR542384 5 0.3992 0.6428 0.000 0.000 0.268 0.012 0.720
#> SRR542385 2 0.0000 0.9229 0.000 1.000 0.000 0.000 0.000
#> SRR542386 2 0.1082 0.9152 0.000 0.964 0.008 0.000 0.028
#> SRR542387 5 0.0404 0.7332 0.000 0.012 0.000 0.000 0.988
#> SRR542388 2 0.0000 0.9229 0.000 1.000 0.000 0.000 0.000
#> SRR542389 2 0.0162 0.9227 0.000 0.996 0.000 0.000 0.004
#> SRR542390 2 0.0162 0.9227 0.000 0.996 0.000 0.000 0.004
#> SRR542391 2 0.0162 0.9227 0.000 0.996 0.000 0.000 0.004
#> SRR542392 1 0.1981 0.9003 0.920 0.064 0.000 0.000 0.016
#> SRR542393 2 0.0794 0.9179 0.000 0.972 0.000 0.000 0.028
#> SRR542394 5 0.0963 0.7315 0.000 0.036 0.000 0.000 0.964
#> SRR542395 5 0.1908 0.7039 0.000 0.092 0.000 0.000 0.908
#> SRR542396 5 0.3992 0.6428 0.000 0.000 0.268 0.012 0.720
#> SRR542397 2 0.0510 0.9215 0.000 0.984 0.000 0.000 0.016
#> SRR542398 1 0.2471 0.8218 0.864 0.000 0.000 0.000 0.136
#> SRR542399 1 0.0000 0.9696 1.000 0.000 0.000 0.000 0.000
#> SRR542400 1 0.0000 0.9696 1.000 0.000 0.000 0.000 0.000
#> SRR542401 1 0.0000 0.9696 1.000 0.000 0.000 0.000 0.000
#> SRR542402 1 0.0000 0.9696 1.000 0.000 0.000 0.000 0.000
#> SRR542403 1 0.0000 0.9696 1.000 0.000 0.000 0.000 0.000
#> SRR542404 1 0.0000 0.9696 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
#> SRR542346 4 0.2772 0.7511 0.000 0.000 0.180 0.816 0.004 0.000
#> SRR542347 4 0.2053 0.8059 0.000 0.000 0.108 0.888 0.004 0.000
#> SRR542348 4 0.2668 0.7624 0.000 0.000 0.168 0.828 0.004 0.000
#> SRR542349 4 0.1958 0.8095 0.000 0.000 0.100 0.896 0.004 0.000
#> SRR542350 2 0.5805 0.1525 0.000 0.468 0.404 0.000 0.020 0.108
#> SRR542351 3 0.0405 0.7843 0.000 0.000 0.988 0.004 0.008 0.000
#> SRR542352 2 0.3771 0.6539 0.000 0.800 0.100 0.000 0.012 0.088
#> SRR542353 2 0.5691 0.1902 0.000 0.484 0.396 0.000 0.016 0.104
#> SRR542354 3 0.4637 0.4523 0.000 0.016 0.664 0.000 0.044 0.276
#> SRR542355 6 0.5569 -0.1538 0.000 0.020 0.080 0.000 0.428 0.472
#> SRR542356 3 0.2474 0.7226 0.000 0.000 0.884 0.004 0.032 0.080
#> SRR542357 6 0.6071 0.0618 0.000 0.064 0.344 0.000 0.080 0.512
#> SRR542358 2 0.3330 0.6697 0.000 0.828 0.108 0.000 0.008 0.056
#> SRR542359 3 0.0405 0.7843 0.000 0.000 0.988 0.004 0.008 0.000
#> SRR542360 3 0.1757 0.7461 0.000 0.000 0.916 0.076 0.008 0.000
#> SRR542361 4 0.0520 0.8375 0.000 0.000 0.000 0.984 0.008 0.008
#> SRR542362 4 0.0291 0.8370 0.000 0.000 0.004 0.992 0.000 0.004
#> SRR542363 4 0.0508 0.8362 0.000 0.000 0.012 0.984 0.004 0.000
#> SRR542364 3 0.6054 0.1473 0.000 0.028 0.452 0.000 0.124 0.396
#> SRR542365 2 0.3765 0.4323 0.000 0.596 0.000 0.000 0.000 0.404
#> SRR542366 6 0.4161 0.0262 0.000 0.348 0.004 0.000 0.016 0.632
#> SRR542367 6 0.3717 0.4621 0.000 0.160 0.000 0.000 0.064 0.776
#> SRR542368 1 0.0000 0.9508 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR542369 2 0.3536 0.6250 0.000 0.736 0.004 0.000 0.008 0.252
#> SRR542370 2 0.4147 0.3876 0.000 0.552 0.000 0.000 0.012 0.436
#> SRR542371 6 0.4183 -0.1310 0.000 0.012 0.000 0.000 0.480 0.508
#> SRR542372 6 0.3627 0.4329 0.000 0.080 0.000 0.000 0.128 0.792
#> SRR542373 3 0.4041 0.6443 0.000 0.000 0.764 0.004 0.136 0.096
#> SRR542374 3 0.0405 0.7843 0.000 0.000 0.988 0.004 0.008 0.000
#> SRR542375 5 0.2605 0.5927 0.000 0.000 0.108 0.028 0.864 0.000
#> SRR542376 4 0.1176 0.8324 0.000 0.000 0.000 0.956 0.024 0.020
#> SRR542377 4 0.1232 0.8361 0.000 0.000 0.004 0.956 0.024 0.016
#> SRR542378 4 0.4348 0.5218 0.000 0.000 0.000 0.640 0.320 0.040
#> SRR542379 4 0.1564 0.8254 0.000 0.000 0.000 0.936 0.040 0.024
#> SRR542380 4 0.4201 0.5611 0.000 0.000 0.000 0.664 0.300 0.036
#> SRR542381 5 0.1957 0.5889 0.000 0.000 0.048 0.024 0.920 0.008
#> SRR542382 5 0.4594 0.2182 0.000 0.000 0.000 0.340 0.608 0.052
#> SRR542383 4 0.4066 0.6012 0.000 0.000 0.000 0.692 0.272 0.036
#> SRR542384 5 0.3688 0.5721 0.000 0.000 0.140 0.020 0.800 0.040
#> SRR542385 2 0.1349 0.7277 0.000 0.940 0.000 0.000 0.004 0.056
#> SRR542386 2 0.3756 0.5716 0.000 0.712 0.000 0.000 0.020 0.268
#> SRR542387 5 0.3921 0.3200 0.000 0.012 0.004 0.000 0.676 0.308
#> SRR542388 2 0.0632 0.7334 0.000 0.976 0.000 0.000 0.000 0.024
#> SRR542389 2 0.0713 0.7278 0.000 0.972 0.000 0.000 0.000 0.028
#> SRR542390 2 0.0260 0.7331 0.000 0.992 0.000 0.000 0.000 0.008
#> SRR542391 2 0.0000 0.7318 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR542392 1 0.4051 0.7664 0.792 0.080 0.000 0.000 0.036 0.092
#> SRR542393 2 0.2775 0.6927 0.000 0.856 0.000 0.000 0.040 0.104
#> SRR542394 5 0.4437 0.0975 0.000 0.020 0.004 0.000 0.540 0.436
#> SRR542395 5 0.5301 0.0790 0.000 0.088 0.004 0.000 0.492 0.416
#> SRR542396 5 0.4013 0.5555 0.000 0.000 0.128 0.016 0.780 0.076
#> SRR542397 2 0.2191 0.7028 0.000 0.876 0.000 0.000 0.004 0.120
#> SRR542398 1 0.3073 0.7786 0.816 0.000 0.000 0.004 0.164 0.016
#> SRR542399 1 0.0000 0.9508 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR542400 1 0.0000 0.9508 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR542401 1 0.0000 0.9508 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR542402 1 0.0000 0.9508 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR542403 1 0.0000 0.9508 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR542404 1 0.0000 0.9508 1.000 0.000 0.000 0.000 0.000 0.000
Heatmaps for the consensus matrix. It visualizes the probability of two samples to be in a same group.
consensus_heatmap(res, k = 2)
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", "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 16804 rows and 59 columns.
#> Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'CV' method.
#> Subgroups are detected by 'pam' method.
#> Performed in total 1250 partitions by row resampling.
#> Best k for subgroups seems to be 2.
#>
#> Following methods can be applied to this 'ConsensusPartition' object:
#> [1] "cola_report" "collect_classes" "collect_plots"
#> [4] "collect_stats" "colnames" "compare_signatures"
#> [7] "consensus_heatmap" "dimension_reduction" "functional_enrichment"
#> [10] "get_anno_col" "get_anno" "get_classes"
#> [13] "get_consensus" "get_matrix" "get_membership"
#> [16] "get_param" "get_signatures" "get_stats"
#> [19] "is_best_k" "is_stable_k" "membership_heatmap"
#> [22] "ncol" "nrow" "plot_ecdf"
#> [25] "rownames" "select_partition_number" "show"
#> [28] "suggest_best_k" "test_to_known_factors"
collect_plots()
function collects all the plots made from res
for all k
(number of partitions)
into one single page to provide an easy and fast comparison between different k
.
collect_plots(res)
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.993 0.1976 0.814 0.814
#> 3 3 0.800 0.857 0.942 1.8945 0.614 0.526
#> 4 4 0.603 0.662 0.853 0.2445 0.793 0.551
#> 5 5 0.768 0.763 0.882 0.1093 0.859 0.552
#> 6 6 0.779 0.721 0.824 0.0325 0.891 0.566
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
#> SRR542346 2 0.000 0.992 0.000 1.000
#> SRR542347 2 0.000 0.992 0.000 1.000
#> SRR542348 2 0.000 0.992 0.000 1.000
#> SRR542349 2 0.000 0.992 0.000 1.000
#> SRR542350 2 0.000 0.992 0.000 1.000
#> SRR542351 2 0.000 0.992 0.000 1.000
#> SRR542352 2 0.000 0.992 0.000 1.000
#> SRR542353 2 0.000 0.992 0.000 1.000
#> SRR542354 2 0.000 0.992 0.000 1.000
#> SRR542355 2 0.000 0.992 0.000 1.000
#> SRR542356 2 0.000 0.992 0.000 1.000
#> SRR542357 2 0.000 0.992 0.000 1.000
#> SRR542358 2 0.000 0.992 0.000 1.000
#> SRR542359 2 0.000 0.992 0.000 1.000
#> SRR542360 2 0.000 0.992 0.000 1.000
#> SRR542361 2 0.000 0.992 0.000 1.000
#> SRR542362 2 0.000 0.992 0.000 1.000
#> SRR542363 2 0.000 0.992 0.000 1.000
#> SRR542364 2 0.000 0.992 0.000 1.000
#> SRR542365 2 0.000 0.992 0.000 1.000
#> SRR542366 2 0.000 0.992 0.000 1.000
#> SRR542367 2 0.000 0.992 0.000 1.000
#> SRR542368 2 0.975 0.311 0.408 0.592
#> SRR542369 2 0.000 0.992 0.000 1.000
#> SRR542370 2 0.000 0.992 0.000 1.000
#> SRR542371 2 0.000 0.992 0.000 1.000
#> SRR542372 2 0.000 0.992 0.000 1.000
#> SRR542373 2 0.000 0.992 0.000 1.000
#> SRR542374 2 0.000 0.992 0.000 1.000
#> SRR542375 2 0.000 0.992 0.000 1.000
#> SRR542376 2 0.000 0.992 0.000 1.000
#> SRR542377 2 0.000 0.992 0.000 1.000
#> SRR542378 2 0.000 0.992 0.000 1.000
#> SRR542379 2 0.000 0.992 0.000 1.000
#> SRR542380 2 0.000 0.992 0.000 1.000
#> SRR542381 2 0.000 0.992 0.000 1.000
#> SRR542382 2 0.000 0.992 0.000 1.000
#> SRR542383 2 0.000 0.992 0.000 1.000
#> SRR542384 2 0.000 0.992 0.000 1.000
#> SRR542385 2 0.000 0.992 0.000 1.000
#> SRR542386 2 0.000 0.992 0.000 1.000
#> SRR542387 2 0.000 0.992 0.000 1.000
#> SRR542388 2 0.000 0.992 0.000 1.000
#> SRR542389 2 0.000 0.992 0.000 1.000
#> SRR542390 2 0.000 0.992 0.000 1.000
#> SRR542391 2 0.000 0.992 0.000 1.000
#> SRR542392 2 0.000 0.992 0.000 1.000
#> SRR542393 2 0.000 0.992 0.000 1.000
#> SRR542394 2 0.000 0.992 0.000 1.000
#> SRR542395 2 0.000 0.992 0.000 1.000
#> SRR542396 2 0.000 0.992 0.000 1.000
#> SRR542397 2 0.000 0.992 0.000 1.000
#> SRR542398 2 0.000 0.992 0.000 1.000
#> SRR542399 1 0.000 1.000 1.000 0.000
#> SRR542400 1 0.000 1.000 1.000 0.000
#> SRR542401 1 0.000 1.000 1.000 0.000
#> SRR542402 1 0.000 1.000 1.000 0.000
#> SRR542403 1 0.000 1.000 1.000 0.000
#> SRR542404 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
#> SRR542346 3 0.0000 0.8813 0.000 0.000 1.000
#> SRR542347 3 0.0000 0.8813 0.000 0.000 1.000
#> SRR542348 3 0.0000 0.8813 0.000 0.000 1.000
#> SRR542349 3 0.0000 0.8813 0.000 0.000 1.000
#> SRR542350 2 0.0000 0.9348 0.000 1.000 0.000
#> SRR542351 2 0.1163 0.9228 0.000 0.972 0.028
#> SRR542352 2 0.0000 0.9348 0.000 1.000 0.000
#> SRR542353 2 0.1163 0.9228 0.000 0.972 0.028
#> SRR542354 2 0.1163 0.9228 0.000 0.972 0.028
#> SRR542355 3 0.6026 0.3880 0.000 0.376 0.624
#> SRR542356 2 0.1163 0.9228 0.000 0.972 0.028
#> SRR542357 2 0.1289 0.9215 0.000 0.968 0.032
#> SRR542358 2 0.0000 0.9348 0.000 1.000 0.000
#> SRR542359 2 0.1163 0.9228 0.000 0.972 0.028
#> SRR542360 3 0.3038 0.7972 0.000 0.104 0.896
#> SRR542361 3 0.0000 0.8813 0.000 0.000 1.000
#> SRR542362 3 0.1289 0.8837 0.000 0.032 0.968
#> SRR542363 3 0.0000 0.8813 0.000 0.000 1.000
#> SRR542364 2 0.1031 0.9249 0.000 0.976 0.024
#> SRR542365 2 0.0000 0.9348 0.000 1.000 0.000
#> SRR542366 2 0.0000 0.9348 0.000 1.000 0.000
#> SRR542367 2 0.0000 0.9348 0.000 1.000 0.000
#> SRR542368 2 0.4702 0.7282 0.212 0.788 0.000
#> SRR542369 2 0.0000 0.9348 0.000 1.000 0.000
#> SRR542370 2 0.0000 0.9348 0.000 1.000 0.000
#> SRR542371 2 0.0424 0.9310 0.000 0.992 0.008
#> SRR542372 2 0.0000 0.9348 0.000 1.000 0.000
#> SRR542373 3 0.6305 0.0957 0.000 0.484 0.516
#> SRR542374 2 0.1163 0.9228 0.000 0.972 0.028
#> SRR542375 3 0.1643 0.8780 0.000 0.044 0.956
#> SRR542376 3 0.0000 0.8813 0.000 0.000 1.000
#> SRR542377 3 0.1163 0.8847 0.000 0.028 0.972
#> SRR542378 3 0.1163 0.8847 0.000 0.028 0.972
#> SRR542379 3 0.1163 0.8847 0.000 0.028 0.972
#> SRR542380 3 0.1163 0.8847 0.000 0.028 0.972
#> SRR542381 3 0.2165 0.8629 0.000 0.064 0.936
#> SRR542382 3 0.1163 0.8847 0.000 0.028 0.972
#> SRR542383 3 0.0892 0.8849 0.000 0.020 0.980
#> SRR542384 2 0.6225 0.2138 0.000 0.568 0.432
#> SRR542385 2 0.0000 0.9348 0.000 1.000 0.000
#> SRR542386 2 0.0000 0.9348 0.000 1.000 0.000
#> SRR542387 2 0.5465 0.5848 0.000 0.712 0.288
#> SRR542388 2 0.0000 0.9348 0.000 1.000 0.000
#> SRR542389 2 0.0000 0.9348 0.000 1.000 0.000
#> SRR542390 2 0.0000 0.9348 0.000 1.000 0.000
#> SRR542391 2 0.0000 0.9348 0.000 1.000 0.000
#> SRR542392 2 0.0000 0.9348 0.000 1.000 0.000
#> SRR542393 2 0.0000 0.9348 0.000 1.000 0.000
#> SRR542394 2 0.5291 0.6219 0.000 0.732 0.268
#> SRR542395 3 0.5948 0.4554 0.000 0.360 0.640
#> SRR542396 2 0.2959 0.8504 0.000 0.900 0.100
#> SRR542397 2 0.0000 0.9348 0.000 1.000 0.000
#> SRR542398 2 0.5497 0.5776 0.000 0.708 0.292
#> SRR542399 1 0.0000 1.0000 1.000 0.000 0.000
#> SRR542400 1 0.0000 1.0000 1.000 0.000 0.000
#> SRR542401 1 0.0000 1.0000 1.000 0.000 0.000
#> SRR542402 1 0.0000 1.0000 1.000 0.000 0.000
#> SRR542403 1 0.0000 1.0000 1.000 0.000 0.000
#> SRR542404 1 0.0000 1.0000 1.000 0.000 0.000
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> SRR542346 3 0.4804 0.3463 0.000 0.000 0.616 0.384
#> SRR542347 4 0.4989 -0.1103 0.000 0.000 0.472 0.528
#> SRR542348 3 0.4790 0.3546 0.000 0.000 0.620 0.380
#> SRR542349 4 0.4830 0.1358 0.000 0.000 0.392 0.608
#> SRR542350 2 0.4164 0.5776 0.000 0.736 0.264 0.000
#> SRR542351 3 0.0000 0.6800 0.000 0.000 1.000 0.000
#> SRR542352 2 0.3837 0.6223 0.000 0.776 0.224 0.000
#> SRR542353 3 0.4981 0.1186 0.000 0.464 0.536 0.000
#> SRR542354 3 0.1022 0.6815 0.000 0.032 0.968 0.000
#> SRR542355 3 0.6568 0.1565 0.000 0.080 0.512 0.408
#> SRR542356 3 0.0000 0.6800 0.000 0.000 1.000 0.000
#> SRR542357 3 0.3649 0.5832 0.000 0.204 0.796 0.000
#> SRR542358 2 0.3528 0.6600 0.000 0.808 0.192 0.000
#> SRR542359 3 0.3837 0.5668 0.000 0.224 0.776 0.000
#> SRR542360 3 0.3907 0.5556 0.000 0.000 0.768 0.232
#> SRR542361 4 0.0000 0.8130 0.000 0.000 0.000 1.000
#> SRR542362 4 0.0707 0.8005 0.000 0.020 0.000 0.980
#> SRR542363 4 0.0707 0.7988 0.000 0.000 0.020 0.980
#> SRR542364 3 0.4907 0.1799 0.000 0.420 0.580 0.000
#> SRR542365 2 0.0188 0.8084 0.000 0.996 0.004 0.000
#> SRR542366 2 0.3726 0.6723 0.000 0.788 0.212 0.000
#> SRR542367 2 0.2589 0.7701 0.000 0.884 0.116 0.000
#> SRR542368 2 0.5719 0.6154 0.176 0.712 0.112 0.000
#> SRR542369 2 0.3444 0.6686 0.000 0.816 0.184 0.000
#> SRR542370 2 0.0817 0.8074 0.000 0.976 0.024 0.000
#> SRR542371 2 0.6742 0.5311 0.000 0.608 0.160 0.232
#> SRR542372 2 0.2589 0.7701 0.000 0.884 0.116 0.000
#> SRR542373 3 0.4713 0.6057 0.000 0.052 0.776 0.172
#> SRR542374 3 0.0000 0.6800 0.000 0.000 1.000 0.000
#> SRR542375 4 0.1398 0.7860 0.000 0.004 0.040 0.956
#> SRR542376 4 0.0000 0.8130 0.000 0.000 0.000 1.000
#> SRR542377 4 0.0000 0.8130 0.000 0.000 0.000 1.000
#> SRR542378 4 0.0000 0.8130 0.000 0.000 0.000 1.000
#> SRR542379 4 0.0000 0.8130 0.000 0.000 0.000 1.000
#> SRR542380 4 0.0000 0.8130 0.000 0.000 0.000 1.000
#> SRR542381 4 0.2542 0.7379 0.000 0.012 0.084 0.904
#> SRR542382 4 0.0376 0.8105 0.000 0.004 0.004 0.992
#> SRR542383 4 0.0000 0.8130 0.000 0.000 0.000 1.000
#> SRR542384 4 0.7273 -0.0784 0.000 0.400 0.148 0.452
#> SRR542385 2 0.0000 0.8081 0.000 1.000 0.000 0.000
#> SRR542386 2 0.0817 0.8074 0.000 0.976 0.024 0.000
#> SRR542387 2 0.6317 0.5693 0.000 0.644 0.116 0.240
#> SRR542388 2 0.0000 0.8081 0.000 1.000 0.000 0.000
#> SRR542389 2 0.1118 0.7942 0.000 0.964 0.036 0.000
#> SRR542390 2 0.0000 0.8081 0.000 1.000 0.000 0.000
#> SRR542391 2 0.0000 0.8081 0.000 1.000 0.000 0.000
#> SRR542392 2 0.1637 0.7966 0.000 0.940 0.060 0.000
#> SRR542393 2 0.0188 0.8086 0.000 0.996 0.004 0.000
#> SRR542394 2 0.6373 0.5586 0.000 0.636 0.116 0.248
#> SRR542395 4 0.6928 0.2537 0.000 0.308 0.136 0.556
#> SRR542396 2 0.6426 0.5496 0.000 0.628 0.116 0.256
#> SRR542397 2 0.0000 0.8081 0.000 1.000 0.000 0.000
#> SRR542398 2 0.5687 0.6044 0.000 0.684 0.068 0.248
#> SRR542399 1 0.0000 1.0000 1.000 0.000 0.000 0.000
#> SRR542400 1 0.0000 1.0000 1.000 0.000 0.000 0.000
#> SRR542401 1 0.0000 1.0000 1.000 0.000 0.000 0.000
#> SRR542402 1 0.0000 1.0000 1.000 0.000 0.000 0.000
#> SRR542403 1 0.0000 1.0000 1.000 0.000 0.000 0.000
#> SRR542404 1 0.0000 1.0000 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
#> SRR542346 3 0.3661 0.644 0 0.000 0.724 0.276 0.000
#> SRR542347 3 0.4150 0.466 0 0.000 0.612 0.388 0.000
#> SRR542348 3 0.3039 0.724 0 0.000 0.808 0.192 0.000
#> SRR542349 4 0.4291 -0.139 0 0.000 0.464 0.536 0.000
#> SRR542350 2 0.0579 0.831 0 0.984 0.008 0.000 0.008
#> SRR542351 3 0.0000 0.782 0 0.000 1.000 0.000 0.000
#> SRR542352 2 0.0290 0.832 0 0.992 0.000 0.000 0.008
#> SRR542353 2 0.0162 0.836 0 0.996 0.004 0.000 0.000
#> SRR542354 3 0.4734 0.755 0 0.176 0.728 0.000 0.096
#> SRR542355 4 0.8042 -0.218 0 0.164 0.340 0.368 0.128
#> SRR542356 3 0.4049 0.763 0 0.164 0.780 0.000 0.056
#> SRR542357 3 0.5841 0.690 0 0.180 0.608 0.000 0.212
#> SRR542358 2 0.1043 0.858 0 0.960 0.000 0.000 0.040
#> SRR542359 3 0.0703 0.784 0 0.000 0.976 0.000 0.024
#> SRR542360 3 0.2938 0.793 0 0.064 0.880 0.048 0.008
#> SRR542361 4 0.0000 0.851 0 0.000 0.000 1.000 0.000
#> SRR542362 4 0.1544 0.803 0 0.000 0.000 0.932 0.068
#> SRR542363 4 0.0609 0.839 0 0.000 0.020 0.980 0.000
#> SRR542364 3 0.3752 0.535 0 0.000 0.708 0.000 0.292
#> SRR542365 5 0.1908 0.822 0 0.092 0.000 0.000 0.908
#> SRR542366 5 0.0609 0.882 0 0.020 0.000 0.000 0.980
#> SRR542367 5 0.0162 0.881 0 0.004 0.000 0.000 0.996
#> SRR542368 5 0.2208 0.839 0 0.020 0.072 0.000 0.908
#> SRR542369 2 0.1043 0.858 0 0.960 0.000 0.000 0.040
#> SRR542370 5 0.0963 0.875 0 0.036 0.000 0.000 0.964
#> SRR542371 5 0.1043 0.857 0 0.040 0.000 0.000 0.960
#> SRR542372 5 0.0162 0.881 0 0.004 0.000 0.000 0.996
#> SRR542373 3 0.4043 0.750 0 0.012 0.788 0.032 0.168
#> SRR542374 3 0.0000 0.782 0 0.000 1.000 0.000 0.000
#> SRR542375 4 0.2236 0.799 0 0.000 0.068 0.908 0.024
#> SRR542376 4 0.0000 0.851 0 0.000 0.000 1.000 0.000
#> SRR542377 4 0.0000 0.851 0 0.000 0.000 1.000 0.000
#> SRR542378 4 0.0000 0.851 0 0.000 0.000 1.000 0.000
#> SRR542379 4 0.0000 0.851 0 0.000 0.000 1.000 0.000
#> SRR542380 4 0.0000 0.851 0 0.000 0.000 1.000 0.000
#> SRR542381 4 0.3085 0.769 0 0.004 0.068 0.868 0.060
#> SRR542382 4 0.0162 0.849 0 0.000 0.000 0.996 0.004
#> SRR542383 4 0.0000 0.851 0 0.000 0.000 1.000 0.000
#> SRR542384 5 0.6315 0.075 0 0.000 0.160 0.372 0.468
#> SRR542385 2 0.2891 0.868 0 0.824 0.000 0.000 0.176
#> SRR542386 5 0.0703 0.882 0 0.024 0.000 0.000 0.976
#> SRR542387 5 0.0162 0.881 0 0.004 0.000 0.000 0.996
#> SRR542388 5 0.4294 -0.109 0 0.468 0.000 0.000 0.532
#> SRR542389 2 0.2852 0.869 0 0.828 0.000 0.000 0.172
#> SRR542390 2 0.2891 0.868 0 0.824 0.000 0.000 0.176
#> SRR542391 2 0.2891 0.868 0 0.824 0.000 0.000 0.176
#> SRR542392 5 0.0703 0.882 0 0.024 0.000 0.000 0.976
#> SRR542393 2 0.3837 0.689 0 0.692 0.000 0.000 0.308
#> SRR542394 5 0.0290 0.882 0 0.008 0.000 0.000 0.992
#> SRR542395 4 0.4921 0.398 0 0.040 0.000 0.620 0.340
#> SRR542396 5 0.1544 0.839 0 0.000 0.068 0.000 0.932
#> SRR542397 2 0.2929 0.865 0 0.820 0.000 0.000 0.180
#> SRR542398 5 0.0671 0.883 0 0.016 0.000 0.004 0.980
#> SRR542399 1 0.0000 1.000 1 0.000 0.000 0.000 0.000
#> SRR542400 1 0.0000 1.000 1 0.000 0.000 0.000 0.000
#> SRR542401 1 0.0000 1.000 1 0.000 0.000 0.000 0.000
#> SRR542402 1 0.0000 1.000 1 0.000 0.000 0.000 0.000
#> SRR542403 1 0.0000 1.000 1 0.000 0.000 0.000 0.000
#> SRR542404 1 0.0000 1.000 1 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
#> SRR542346 4 0.4315 0.9029 0.000 0.000 0.036 0.636 0.328 0.000
#> SRR542347 4 0.4264 0.9040 0.000 0.000 0.032 0.636 0.332 0.000
#> SRR542348 4 0.5058 0.7443 0.000 0.000 0.164 0.636 0.200 0.000
#> SRR542349 4 0.4210 0.9021 0.000 0.000 0.028 0.636 0.336 0.000
#> SRR542350 2 0.2278 0.7642 0.000 0.868 0.004 0.128 0.000 0.000
#> SRR542351 3 0.0000 0.7943 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR542352 2 0.1957 0.7786 0.000 0.888 0.000 0.112 0.000 0.000
#> SRR542353 2 0.3123 0.7387 0.000 0.836 0.076 0.088 0.000 0.000
#> SRR542354 3 0.5131 0.5800 0.000 0.064 0.524 0.404 0.000 0.008
#> SRR542355 5 0.5655 0.3774 0.000 0.060 0.012 0.412 0.496 0.020
#> SRR542356 3 0.4091 0.7109 0.000 0.056 0.720 0.224 0.000 0.000
#> SRR542357 6 0.5527 0.4337 0.000 0.084 0.016 0.416 0.000 0.484
#> SRR542358 2 0.0146 0.8202 0.000 0.996 0.000 0.000 0.000 0.004
#> SRR542359 3 0.0632 0.7870 0.000 0.000 0.976 0.000 0.000 0.024
#> SRR542360 5 0.5828 0.3527 0.000 0.016 0.220 0.200 0.564 0.000
#> SRR542361 5 0.0000 0.7110 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR542362 5 0.2201 0.6085 0.000 0.000 0.000 0.028 0.896 0.076
#> SRR542363 4 0.3810 0.7779 0.000 0.000 0.000 0.572 0.428 0.000
#> SRR542364 6 0.4751 0.4731 0.000 0.000 0.312 0.072 0.000 0.616
#> SRR542365 6 0.0458 0.8009 0.000 0.016 0.000 0.000 0.000 0.984
#> SRR542366 6 0.0146 0.8065 0.000 0.004 0.000 0.000 0.000 0.996
#> SRR542367 6 0.0363 0.8063 0.000 0.000 0.000 0.012 0.000 0.988
#> SRR542368 6 0.0862 0.7993 0.008 0.004 0.016 0.000 0.000 0.972
#> SRR542369 2 0.0291 0.8198 0.000 0.992 0.000 0.004 0.000 0.004
#> SRR542370 6 0.0146 0.8065 0.000 0.004 0.000 0.000 0.000 0.996
#> SRR542371 6 0.3684 0.6597 0.000 0.004 0.000 0.332 0.000 0.664
#> SRR542372 6 0.2730 0.7627 0.000 0.000 0.000 0.192 0.000 0.808
#> SRR542373 6 0.7648 0.0778 0.000 0.000 0.208 0.284 0.204 0.304
#> SRR542374 3 0.0000 0.7943 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR542375 5 0.3493 0.6327 0.000 0.000 0.064 0.136 0.800 0.000
#> SRR542376 5 0.0260 0.7036 0.000 0.000 0.000 0.008 0.992 0.000
#> SRR542377 5 0.0000 0.7110 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR542378 5 0.0000 0.7110 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR542379 5 0.0000 0.7110 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR542380 5 0.0000 0.7110 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR542381 5 0.4490 0.5784 0.000 0.000 0.064 0.216 0.708 0.012
#> SRR542382 5 0.0405 0.7100 0.000 0.000 0.000 0.008 0.988 0.004
#> SRR542383 5 0.0000 0.7110 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR542384 5 0.7466 0.0138 0.000 0.000 0.156 0.196 0.348 0.300
#> SRR542385 2 0.2135 0.8168 0.000 0.872 0.000 0.000 0.000 0.128
#> SRR542386 6 0.0146 0.8065 0.000 0.004 0.000 0.000 0.000 0.996
#> SRR542387 6 0.2854 0.7569 0.000 0.000 0.000 0.208 0.000 0.792
#> SRR542388 2 0.3847 0.1552 0.000 0.544 0.000 0.000 0.000 0.456
#> SRR542389 2 0.1327 0.8384 0.000 0.936 0.000 0.000 0.000 0.064
#> SRR542390 2 0.1387 0.8381 0.000 0.932 0.000 0.000 0.000 0.068
#> SRR542391 2 0.1387 0.8381 0.000 0.932 0.000 0.000 0.000 0.068
#> SRR542392 6 0.0146 0.8065 0.000 0.004 0.000 0.000 0.000 0.996
#> SRR542393 2 0.3699 0.6173 0.000 0.660 0.000 0.004 0.000 0.336
#> SRR542394 6 0.2854 0.7569 0.000 0.000 0.000 0.208 0.000 0.792
#> SRR542395 5 0.5483 0.4548 0.000 0.004 0.000 0.296 0.560 0.140
#> SRR542396 6 0.3752 0.7427 0.000 0.000 0.064 0.164 0.000 0.772
#> SRR542397 2 0.1806 0.8337 0.000 0.908 0.000 0.004 0.000 0.088
#> SRR542398 6 0.0146 0.8065 0.000 0.004 0.000 0.000 0.000 0.996
#> SRR542399 1 0.0000 1.0000 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR542400 1 0.0000 1.0000 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR542401 1 0.0000 1.0000 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR542402 1 0.0000 1.0000 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR542403 1 0.0000 1.0000 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR542404 1 0.0000 1.0000 1.000 0.000 0.000 0.000 0.000 0.000
Heatmaps for the consensus matrix. It visualizes the probability of two samples to be in a same group.
consensus_heatmap(res, k = 2)
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", "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 16804 rows and 59 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 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.862 0.891 0.952 0.2800 0.737 0.737
#> 3 3 0.563 0.765 0.885 1.0688 0.580 0.463
#> 4 4 0.588 0.749 0.870 0.1736 0.783 0.536
#> 5 5 0.634 0.754 0.811 0.0790 0.973 0.915
#> 6 6 0.645 0.722 0.831 0.0908 0.847 0.508
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
#> SRR542346 2 0.2948 0.933 0.052 0.948
#> SRR542347 2 0.2948 0.933 0.052 0.948
#> SRR542348 2 0.3584 0.921 0.068 0.932
#> SRR542349 2 0.2948 0.933 0.052 0.948
#> SRR542350 2 0.0000 0.955 0.000 1.000
#> SRR542351 2 0.7815 0.654 0.232 0.768
#> SRR542352 2 0.0000 0.955 0.000 1.000
#> SRR542353 2 0.0000 0.955 0.000 1.000
#> SRR542354 2 0.0000 0.955 0.000 1.000
#> SRR542355 2 0.0000 0.955 0.000 1.000
#> SRR542356 2 0.1184 0.946 0.016 0.984
#> SRR542357 2 0.0000 0.955 0.000 1.000
#> SRR542358 2 0.0000 0.955 0.000 1.000
#> SRR542359 1 0.9087 0.597 0.676 0.324
#> SRR542360 2 0.0376 0.953 0.004 0.996
#> SRR542361 2 0.2948 0.933 0.052 0.948
#> SRR542362 2 0.2948 0.933 0.052 0.948
#> SRR542363 2 0.2948 0.933 0.052 0.948
#> SRR542364 2 0.0672 0.951 0.008 0.992
#> SRR542365 2 0.0000 0.955 0.000 1.000
#> SRR542366 2 0.0000 0.955 0.000 1.000
#> SRR542367 2 0.0000 0.955 0.000 1.000
#> SRR542368 1 0.7453 0.748 0.788 0.212
#> SRR542369 2 0.0000 0.955 0.000 1.000
#> SRR542370 2 0.0000 0.955 0.000 1.000
#> SRR542371 2 0.0000 0.955 0.000 1.000
#> SRR542372 2 0.0000 0.955 0.000 1.000
#> SRR542373 2 0.0672 0.951 0.008 0.992
#> SRR542374 2 0.6148 0.791 0.152 0.848
#> SRR542375 2 0.0000 0.955 0.000 1.000
#> SRR542376 2 0.2948 0.933 0.052 0.948
#> SRR542377 2 0.2948 0.933 0.052 0.948
#> SRR542378 2 0.2948 0.933 0.052 0.948
#> SRR542379 2 0.2948 0.933 0.052 0.948
#> SRR542380 2 0.2948 0.933 0.052 0.948
#> SRR542381 2 0.0000 0.955 0.000 1.000
#> SRR542382 2 0.2948 0.933 0.052 0.948
#> SRR542383 2 0.2948 0.933 0.052 0.948
#> SRR542384 2 0.0672 0.951 0.008 0.992
#> SRR542385 2 0.0000 0.955 0.000 1.000
#> SRR542386 2 0.0000 0.955 0.000 1.000
#> SRR542387 2 0.0000 0.955 0.000 1.000
#> SRR542388 2 0.7602 0.662 0.220 0.780
#> SRR542389 2 0.0000 0.955 0.000 1.000
#> SRR542390 2 0.0000 0.955 0.000 1.000
#> SRR542391 2 0.0000 0.955 0.000 1.000
#> SRR542392 2 0.9988 -0.161 0.480 0.520
#> SRR542393 2 0.0000 0.955 0.000 1.000
#> SRR542394 2 0.0000 0.955 0.000 1.000
#> SRR542395 2 0.0000 0.955 0.000 1.000
#> SRR542396 2 0.0672 0.951 0.008 0.992
#> SRR542397 2 0.0000 0.955 0.000 1.000
#> SRR542398 1 0.9795 0.404 0.584 0.416
#> SRR542399 1 0.0000 0.879 1.000 0.000
#> SRR542400 1 0.0000 0.879 1.000 0.000
#> SRR542401 1 0.0000 0.879 1.000 0.000
#> SRR542402 1 0.0000 0.879 1.000 0.000
#> SRR542403 1 0.0000 0.879 1.000 0.000
#> SRR542404 1 0.0000 0.879 1.000 0.000
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> SRR542346 3 0.0000 0.850 0.000 0.000 1.000
#> SRR542347 3 0.0000 0.850 0.000 0.000 1.000
#> SRR542348 3 0.0000 0.850 0.000 0.000 1.000
#> SRR542349 3 0.0000 0.850 0.000 0.000 1.000
#> SRR542350 3 0.5497 0.610 0.000 0.292 0.708
#> SRR542351 3 0.2066 0.830 0.000 0.060 0.940
#> SRR542352 2 0.3038 0.831 0.000 0.896 0.104
#> SRR542353 3 0.5327 0.639 0.000 0.272 0.728
#> SRR542354 3 0.5327 0.639 0.000 0.272 0.728
#> SRR542355 2 0.5291 0.673 0.000 0.732 0.268
#> SRR542356 3 0.4399 0.736 0.000 0.188 0.812
#> SRR542357 2 0.5058 0.704 0.000 0.756 0.244
#> SRR542358 3 0.6045 0.492 0.000 0.380 0.620
#> SRR542359 3 0.2280 0.832 0.008 0.052 0.940
#> SRR542360 3 0.2537 0.819 0.000 0.080 0.920
#> SRR542361 3 0.0000 0.850 0.000 0.000 1.000
#> SRR542362 3 0.0000 0.850 0.000 0.000 1.000
#> SRR542363 3 0.0000 0.850 0.000 0.000 1.000
#> SRR542364 2 0.5678 0.610 0.000 0.684 0.316
#> SRR542365 2 0.0000 0.838 0.000 1.000 0.000
#> SRR542366 2 0.1753 0.855 0.000 0.952 0.048
#> SRR542367 2 0.1411 0.855 0.000 0.964 0.036
#> SRR542368 3 0.5858 0.698 0.020 0.240 0.740
#> SRR542369 2 0.0592 0.847 0.000 0.988 0.012
#> SRR542370 2 0.0892 0.851 0.000 0.980 0.020
#> SRR542371 2 0.2356 0.850 0.000 0.928 0.072
#> SRR542372 2 0.1860 0.854 0.000 0.948 0.052
#> SRR542373 2 0.6235 0.369 0.000 0.564 0.436
#> SRR542374 3 0.2261 0.826 0.000 0.068 0.932
#> SRR542375 3 0.6302 -0.177 0.000 0.480 0.520
#> SRR542376 3 0.0000 0.850 0.000 0.000 1.000
#> SRR542377 3 0.0000 0.850 0.000 0.000 1.000
#> SRR542378 3 0.0000 0.850 0.000 0.000 1.000
#> SRR542379 3 0.0000 0.850 0.000 0.000 1.000
#> SRR542380 3 0.0000 0.850 0.000 0.000 1.000
#> SRR542381 2 0.6192 0.422 0.000 0.580 0.420
#> SRR542382 3 0.0000 0.850 0.000 0.000 1.000
#> SRR542383 3 0.0000 0.850 0.000 0.000 1.000
#> SRR542384 2 0.6244 0.364 0.000 0.560 0.440
#> SRR542385 2 0.0000 0.838 0.000 1.000 0.000
#> SRR542386 2 0.2165 0.842 0.000 0.936 0.064
#> SRR542387 2 0.4121 0.786 0.000 0.832 0.168
#> SRR542388 3 0.6822 0.265 0.012 0.480 0.508
#> SRR542389 2 0.0000 0.838 0.000 1.000 0.000
#> SRR542390 2 0.0424 0.844 0.000 0.992 0.008
#> SRR542391 2 0.1753 0.851 0.000 0.952 0.048
#> SRR542392 3 0.6307 0.581 0.012 0.328 0.660
#> SRR542393 2 0.1289 0.855 0.000 0.968 0.032
#> SRR542394 2 0.1411 0.855 0.000 0.964 0.036
#> SRR542395 2 0.2165 0.852 0.000 0.936 0.064
#> SRR542396 2 0.6140 0.440 0.000 0.596 0.404
#> SRR542397 2 0.0747 0.849 0.000 0.984 0.016
#> SRR542398 3 0.5858 0.698 0.020 0.240 0.740
#> SRR542399 1 0.0000 1.000 1.000 0.000 0.000
#> SRR542400 1 0.0000 1.000 1.000 0.000 0.000
#> SRR542401 1 0.0000 1.000 1.000 0.000 0.000
#> SRR542402 1 0.0000 1.000 1.000 0.000 0.000
#> SRR542403 1 0.0000 1.000 1.000 0.000 0.000
#> SRR542404 1 0.0000 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
#> SRR542346 3 0.4643 0.177 0 0.000 0.656 0.344
#> SRR542347 4 0.4999 0.228 0 0.000 0.492 0.508
#> SRR542348 3 0.3402 0.567 0 0.004 0.832 0.164
#> SRR542349 4 0.4999 0.228 0 0.000 0.492 0.508
#> SRR542350 3 0.3649 0.695 0 0.204 0.796 0.000
#> SRR542351 3 0.0927 0.711 0 0.016 0.976 0.008
#> SRR542352 2 0.2589 0.807 0 0.884 0.116 0.000
#> SRR542353 3 0.3444 0.702 0 0.184 0.816 0.000
#> SRR542354 3 0.3636 0.708 0 0.172 0.820 0.008
#> SRR542355 2 0.3074 0.787 0 0.848 0.152 0.000
#> SRR542356 3 0.1722 0.720 0 0.048 0.944 0.008
#> SRR542357 2 0.4040 0.630 0 0.752 0.248 0.000
#> SRR542358 3 0.4925 0.349 0 0.428 0.572 0.000
#> SRR542359 3 0.0927 0.711 0 0.016 0.976 0.008
#> SRR542360 3 0.1722 0.719 0 0.048 0.944 0.008
#> SRR542361 4 0.2530 0.828 0 0.000 0.112 0.888
#> SRR542362 4 0.2704 0.822 0 0.000 0.124 0.876
#> SRR542363 4 0.3569 0.764 0 0.000 0.196 0.804
#> SRR542364 2 0.4697 0.510 0 0.644 0.356 0.000
#> SRR542365 2 0.0188 0.871 0 0.996 0.000 0.004
#> SRR542366 2 0.0188 0.871 0 0.996 0.004 0.000
#> SRR542367 2 0.0000 0.871 0 1.000 0.000 0.000
#> SRR542368 3 0.4973 0.419 0 0.348 0.644 0.008
#> SRR542369 2 0.0188 0.871 0 0.996 0.004 0.000
#> SRR542370 2 0.0188 0.871 0 0.996 0.004 0.000
#> SRR542371 2 0.1510 0.871 0 0.956 0.016 0.028
#> SRR542372 2 0.0707 0.872 0 0.980 0.000 0.020
#> SRR542373 3 0.4948 0.152 0 0.440 0.560 0.000
#> SRR542374 3 0.0927 0.711 0 0.016 0.976 0.008
#> SRR542375 2 0.5384 0.718 0 0.728 0.196 0.076
#> SRR542376 4 0.2530 0.828 0 0.000 0.112 0.888
#> SRR542377 4 0.2589 0.826 0 0.000 0.116 0.884
#> SRR542378 4 0.0469 0.797 0 0.012 0.000 0.988
#> SRR542379 4 0.1854 0.820 0 0.012 0.048 0.940
#> SRR542380 4 0.1174 0.811 0 0.012 0.020 0.968
#> SRR542381 2 0.5172 0.735 0 0.744 0.188 0.068
#> SRR542382 4 0.3088 0.751 0 0.060 0.052 0.888
#> SRR542383 4 0.0469 0.797 0 0.012 0.000 0.988
#> SRR542384 2 0.5636 0.659 0 0.680 0.260 0.060
#> SRR542385 2 0.0817 0.872 0 0.976 0.000 0.024
#> SRR542386 2 0.1854 0.865 0 0.940 0.012 0.048
#> SRR542387 2 0.2345 0.845 0 0.900 0.100 0.000
#> SRR542388 2 0.3257 0.759 0 0.844 0.152 0.004
#> SRR542389 2 0.0188 0.871 0 0.996 0.004 0.000
#> SRR542390 2 0.1004 0.872 0 0.972 0.004 0.024
#> SRR542391 2 0.0927 0.872 0 0.976 0.008 0.016
#> SRR542392 2 0.4053 0.713 0 0.768 0.228 0.004
#> SRR542393 2 0.0188 0.871 0 0.996 0.004 0.000
#> SRR542394 2 0.0921 0.871 0 0.972 0.000 0.028
#> SRR542395 2 0.1767 0.863 0 0.944 0.012 0.044
#> SRR542396 2 0.5070 0.740 0 0.748 0.192 0.060
#> SRR542397 2 0.0817 0.872 0 0.976 0.000 0.024
#> SRR542398 2 0.5649 0.529 0 0.620 0.344 0.036
#> SRR542399 1 0.0000 1.000 1 0.000 0.000 0.000
#> SRR542400 1 0.0000 1.000 1 0.000 0.000 0.000
#> SRR542401 1 0.0000 1.000 1 0.000 0.000 0.000
#> SRR542402 1 0.0000 1.000 1 0.000 0.000 0.000
#> SRR542403 1 0.0000 1.000 1 0.000 0.000 0.000
#> SRR542404 1 0.0000 1.000 1 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
#> SRR542346 5 0.5673 0.9298 0.000 0.000 0.156 0.216 0.628
#> SRR542347 5 0.5535 0.9290 0.000 0.000 0.116 0.256 0.628
#> SRR542348 5 0.5731 0.8903 0.000 0.000 0.196 0.180 0.624
#> SRR542349 5 0.5535 0.9290 0.000 0.000 0.116 0.256 0.628
#> SRR542350 3 0.4743 0.6996 0.000 0.112 0.732 0.000 0.156
#> SRR542351 3 0.0609 0.6646 0.000 0.000 0.980 0.000 0.020
#> SRR542352 2 0.5107 0.5495 0.000 0.688 0.204 0.000 0.108
#> SRR542353 3 0.4665 0.7009 0.000 0.112 0.740 0.000 0.148
#> SRR542354 3 0.4376 0.7039 0.000 0.092 0.764 0.000 0.144
#> SRR542355 2 0.4197 0.7569 0.000 0.776 0.076 0.000 0.148
#> SRR542356 3 0.1764 0.7040 0.000 0.064 0.928 0.000 0.008
#> SRR542357 2 0.6113 0.1799 0.000 0.524 0.332 0.000 0.144
#> SRR542358 3 0.5184 0.6766 0.000 0.176 0.688 0.000 0.136
#> SRR542359 3 0.0794 0.6623 0.000 0.000 0.972 0.000 0.028
#> SRR542360 3 0.3323 0.6000 0.000 0.056 0.844 0.000 0.100
#> SRR542361 4 0.2074 0.8540 0.000 0.000 0.000 0.896 0.104
#> SRR542362 4 0.2074 0.8540 0.000 0.000 0.000 0.896 0.104
#> SRR542363 4 0.3521 0.6585 0.000 0.000 0.004 0.764 0.232
#> SRR542364 2 0.4182 0.5103 0.000 0.644 0.352 0.000 0.004
#> SRR542365 2 0.0290 0.7864 0.000 0.992 0.000 0.000 0.008
#> SRR542366 2 0.2423 0.8063 0.000 0.896 0.024 0.000 0.080
#> SRR542367 2 0.1845 0.7987 0.000 0.928 0.016 0.000 0.056
#> SRR542368 3 0.6649 0.2595 0.020 0.280 0.532 0.000 0.168
#> SRR542369 2 0.1211 0.7944 0.000 0.960 0.016 0.000 0.024
#> SRR542370 2 0.3106 0.7719 0.000 0.840 0.020 0.000 0.140
#> SRR542371 2 0.4424 0.7711 0.000 0.728 0.048 0.000 0.224
#> SRR542372 2 0.4010 0.7781 0.000 0.760 0.032 0.000 0.208
#> SRR542373 3 0.4811 0.0994 0.000 0.452 0.528 0.000 0.020
#> SRR542374 3 0.0609 0.6646 0.000 0.000 0.980 0.000 0.020
#> SRR542375 2 0.6330 0.7046 0.000 0.600 0.136 0.028 0.236
#> SRR542376 4 0.2074 0.8540 0.000 0.000 0.000 0.896 0.104
#> SRR542377 4 0.2074 0.8540 0.000 0.000 0.000 0.896 0.104
#> SRR542378 4 0.1484 0.8187 0.000 0.008 0.000 0.944 0.048
#> SRR542379 4 0.0290 0.8561 0.000 0.000 0.000 0.992 0.008
#> SRR542380 4 0.0693 0.8508 0.000 0.008 0.000 0.980 0.012
#> SRR542381 2 0.6254 0.7116 0.000 0.608 0.128 0.028 0.236
#> SRR542382 4 0.3439 0.7173 0.000 0.024 0.040 0.856 0.080
#> SRR542383 4 0.0566 0.8527 0.000 0.004 0.000 0.984 0.012
#> SRR542384 2 0.6224 0.6901 0.000 0.604 0.188 0.016 0.192
#> SRR542385 2 0.1197 0.7925 0.000 0.952 0.000 0.000 0.048
#> SRR542386 2 0.2577 0.7960 0.008 0.892 0.016 0.000 0.084
#> SRR542387 2 0.5064 0.7527 0.000 0.672 0.080 0.000 0.248
#> SRR542388 2 0.4643 0.7310 0.016 0.768 0.124 0.000 0.092
#> SRR542389 2 0.0290 0.7864 0.000 0.992 0.000 0.000 0.008
#> SRR542390 2 0.1197 0.7925 0.000 0.952 0.000 0.000 0.048
#> SRR542391 2 0.0798 0.7903 0.000 0.976 0.008 0.000 0.016
#> SRR542392 2 0.5905 0.6897 0.008 0.628 0.192 0.000 0.172
#> SRR542393 2 0.1478 0.7967 0.000 0.936 0.000 0.000 0.064
#> SRR542394 2 0.3236 0.7941 0.000 0.828 0.020 0.000 0.152
#> SRR542395 2 0.3656 0.7852 0.000 0.784 0.020 0.000 0.196
#> SRR542396 2 0.5970 0.7132 0.000 0.612 0.148 0.008 0.232
#> SRR542397 2 0.1197 0.7925 0.000 0.952 0.000 0.000 0.048
#> SRR542398 2 0.6691 0.6024 0.000 0.540 0.228 0.020 0.212
#> SRR542399 1 0.0000 1.0000 1.000 0.000 0.000 0.000 0.000
#> SRR542400 1 0.0000 1.0000 1.000 0.000 0.000 0.000 0.000
#> SRR542401 1 0.0000 1.0000 1.000 0.000 0.000 0.000 0.000
#> SRR542402 1 0.0000 1.0000 1.000 0.000 0.000 0.000 0.000
#> SRR542403 1 0.0000 1.0000 1.000 0.000 0.000 0.000 0.000
#> SRR542404 1 0.0000 1.0000 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
#> SRR542346 6 0.0937 0.955 0 0.000 0.000 0.040 0.000 0.960
#> SRR542347 6 0.1501 0.956 0 0.000 0.000 0.076 0.000 0.924
#> SRR542348 6 0.1151 0.943 0 0.000 0.012 0.032 0.000 0.956
#> SRR542349 6 0.1501 0.956 0 0.000 0.000 0.076 0.000 0.924
#> SRR542350 3 0.3487 0.730 0 0.044 0.788 0.000 0.168 0.000
#> SRR542351 3 0.1794 0.698 0 0.000 0.924 0.000 0.040 0.036
#> SRR542352 3 0.5462 0.390 0 0.400 0.476 0.000 0.124 0.000
#> SRR542353 3 0.3588 0.732 0 0.060 0.788 0.000 0.152 0.000
#> SRR542354 3 0.3221 0.725 0 0.020 0.792 0.000 0.188 0.000
#> SRR542355 5 0.5875 0.202 0 0.188 0.324 0.000 0.484 0.004
#> SRR542356 3 0.1391 0.739 0 0.016 0.944 0.000 0.040 0.000
#> SRR542357 3 0.5062 0.639 0 0.196 0.636 0.000 0.168 0.000
#> SRR542358 3 0.4986 0.656 0 0.188 0.660 0.000 0.148 0.004
#> SRR542359 3 0.1398 0.712 0 0.000 0.940 0.000 0.008 0.052
#> SRR542360 3 0.2529 0.718 0 0.012 0.892 0.004 0.028 0.064
#> SRR542361 4 0.2491 0.810 0 0.000 0.000 0.836 0.000 0.164
#> SRR542362 4 0.2491 0.810 0 0.000 0.000 0.836 0.000 0.164
#> SRR542363 4 0.3828 0.328 0 0.000 0.000 0.560 0.000 0.440
#> SRR542364 3 0.4247 0.624 0 0.240 0.700 0.000 0.060 0.000
#> SRR542365 2 0.0146 0.803 0 0.996 0.000 0.000 0.004 0.000
#> SRR542366 2 0.4425 0.658 0 0.716 0.132 0.000 0.152 0.000
#> SRR542367 2 0.3740 0.713 0 0.784 0.120 0.000 0.096 0.000
#> SRR542368 3 0.5706 0.622 0 0.132 0.636 0.000 0.176 0.056
#> SRR542369 2 0.1320 0.798 0 0.948 0.016 0.000 0.036 0.000
#> SRR542370 2 0.2988 0.685 0 0.824 0.024 0.000 0.152 0.000
#> SRR542371 5 0.4797 0.576 0 0.212 0.124 0.000 0.664 0.000
#> SRR542372 2 0.5046 0.502 0 0.620 0.124 0.000 0.256 0.000
#> SRR542373 3 0.3493 0.701 0 0.148 0.796 0.000 0.056 0.000
#> SRR542374 3 0.1794 0.698 0 0.000 0.924 0.000 0.040 0.036
#> SRR542375 5 0.2351 0.695 0 0.036 0.032 0.000 0.904 0.028
#> SRR542376 4 0.2491 0.810 0 0.000 0.000 0.836 0.000 0.164
#> SRR542377 4 0.2632 0.811 0 0.000 0.000 0.832 0.004 0.164
#> SRR542378 4 0.0458 0.813 0 0.000 0.000 0.984 0.016 0.000
#> SRR542379 4 0.1151 0.820 0 0.000 0.000 0.956 0.012 0.032
#> SRR542380 4 0.0458 0.813 0 0.000 0.000 0.984 0.016 0.000
#> SRR542381 5 0.2351 0.695 0 0.036 0.032 0.000 0.904 0.028
#> SRR542382 4 0.3485 0.594 0 0.000 0.004 0.772 0.204 0.020
#> SRR542383 4 0.0363 0.814 0 0.000 0.000 0.988 0.012 0.000
#> SRR542384 5 0.3111 0.672 0 0.040 0.088 0.000 0.852 0.020
#> SRR542385 2 0.0777 0.803 0 0.972 0.004 0.000 0.024 0.000
#> SRR542386 2 0.5103 0.455 0 0.636 0.132 0.000 0.228 0.004
#> SRR542387 5 0.2402 0.690 0 0.120 0.012 0.000 0.868 0.000
#> SRR542388 2 0.4818 0.579 0 0.672 0.212 0.000 0.112 0.004
#> SRR542389 2 0.0000 0.803 0 1.000 0.000 0.000 0.000 0.000
#> SRR542390 2 0.0000 0.803 0 1.000 0.000 0.000 0.000 0.000
#> SRR542391 2 0.1908 0.781 0 0.900 0.096 0.000 0.004 0.000
#> SRR542392 5 0.6183 0.461 0 0.208 0.240 0.000 0.524 0.028
#> SRR542393 2 0.1141 0.796 0 0.948 0.000 0.000 0.052 0.000
#> SRR542394 5 0.5260 0.257 0 0.396 0.100 0.000 0.504 0.000
#> SRR542395 5 0.3052 0.595 0 0.216 0.004 0.000 0.780 0.000
#> SRR542396 5 0.2670 0.697 0 0.044 0.052 0.000 0.884 0.020
#> SRR542397 2 0.0000 0.803 0 1.000 0.000 0.000 0.000 0.000
#> SRR542398 5 0.6399 0.466 0 0.160 0.252 0.000 0.528 0.060
#> SRR542399 1 0.0000 1.000 1 0.000 0.000 0.000 0.000 0.000
#> SRR542400 1 0.0000 1.000 1 0.000 0.000 0.000 0.000 0.000
#> SRR542401 1 0.0000 1.000 1 0.000 0.000 0.000 0.000 0.000
#> SRR542402 1 0.0000 1.000 1 0.000 0.000 0.000 0.000 0.000
#> SRR542403 1 0.0000 1.000 1 0.000 0.000 0.000 0.000 0.000
#> SRR542404 1 0.0000 1.000 1 0.000 0.000 0.000 0.000 0.000
Heatmaps for the consensus matrix. It visualizes the probability of two samples to be in a same group.
consensus_heatmap(res, k = 2)
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 16804 rows and 59 columns.
#> Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'CV' method.
#> Subgroups are detected by 'NMF' method.
#> Performed in total 1250 partitions by row resampling.
#> Best k for subgroups seems to be 5.
#>
#> Following methods can be applied to this 'ConsensusPartition' object:
#> [1] "cola_report" "collect_classes" "collect_plots"
#> [4] "collect_stats" "colnames" "compare_signatures"
#> [7] "consensus_heatmap" "dimension_reduction" "functional_enrichment"
#> [10] "get_anno_col" "get_anno" "get_classes"
#> [13] "get_consensus" "get_matrix" "get_membership"
#> [16] "get_param" "get_signatures" "get_stats"
#> [19] "is_best_k" "is_stable_k" "membership_heatmap"
#> [22] "ncol" "nrow" "plot_ecdf"
#> [25] "rownames" "select_partition_number" "show"
#> [28] "suggest_best_k" "test_to_known_factors"
collect_plots()
function collects all the plots made from res
for all k
(number of partitions)
into one single page to provide an easy and fast comparison between different k
.
collect_plots(res)
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.366 0.834 0.891 0.3265 0.737 0.737
#> 3 3 0.882 0.910 0.964 0.8336 0.627 0.506
#> 4 4 0.786 0.810 0.919 0.2054 0.813 0.566
#> 5 5 0.929 0.914 0.959 0.1029 0.808 0.427
#> 6 6 0.791 0.749 0.867 0.0431 0.949 0.758
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
#> SRR542346 2 0.6531 0.7919 0.168 0.832
#> SRR542347 2 0.6531 0.7919 0.168 0.832
#> SRR542348 2 0.6531 0.7919 0.168 0.832
#> SRR542349 2 0.6531 0.7919 0.168 0.832
#> SRR542350 2 0.3114 0.8710 0.056 0.944
#> SRR542351 2 0.0000 0.8761 0.000 1.000
#> SRR542352 2 0.5178 0.8554 0.116 0.884
#> SRR542353 2 0.4815 0.8594 0.104 0.896
#> SRR542354 2 0.0000 0.8761 0.000 1.000
#> SRR542355 2 0.0000 0.8761 0.000 1.000
#> SRR542356 2 0.0000 0.8761 0.000 1.000
#> SRR542357 2 0.0376 0.8766 0.004 0.996
#> SRR542358 2 0.5737 0.8452 0.136 0.864
#> SRR542359 2 0.0376 0.8755 0.004 0.996
#> SRR542360 2 0.0000 0.8761 0.000 1.000
#> SRR542361 2 0.6531 0.7919 0.168 0.832
#> SRR542362 2 0.6531 0.7919 0.168 0.832
#> SRR542363 2 0.6531 0.7919 0.168 0.832
#> SRR542364 2 0.0000 0.8761 0.000 1.000
#> SRR542365 2 0.5519 0.8499 0.128 0.872
#> SRR542366 2 0.5178 0.8554 0.116 0.884
#> SRR542367 2 0.5178 0.8554 0.116 0.884
#> SRR542368 1 0.0000 0.9261 1.000 0.000
#> SRR542369 2 0.5737 0.8452 0.136 0.864
#> SRR542370 2 0.5519 0.8499 0.128 0.872
#> SRR542371 2 0.0000 0.8761 0.000 1.000
#> SRR542372 2 0.0938 0.8765 0.012 0.988
#> SRR542373 2 0.0000 0.8761 0.000 1.000
#> SRR542374 2 0.0000 0.8761 0.000 1.000
#> SRR542375 2 0.0000 0.8761 0.000 1.000
#> SRR542376 2 0.6531 0.7919 0.168 0.832
#> SRR542377 2 0.6531 0.7919 0.168 0.832
#> SRR542378 2 0.6712 0.7839 0.176 0.824
#> SRR542379 2 0.6531 0.7919 0.168 0.832
#> SRR542380 2 0.6531 0.7919 0.168 0.832
#> SRR542381 2 0.0000 0.8761 0.000 1.000
#> SRR542382 2 0.9170 0.5309 0.332 0.668
#> SRR542383 2 0.6531 0.7919 0.168 0.832
#> SRR542384 2 0.0000 0.8761 0.000 1.000
#> SRR542385 2 0.5737 0.8452 0.136 0.864
#> SRR542386 2 0.5737 0.8452 0.136 0.864
#> SRR542387 2 0.1184 0.8762 0.016 0.984
#> SRR542388 2 0.5737 0.8452 0.136 0.864
#> SRR542389 2 0.5737 0.8452 0.136 0.864
#> SRR542390 2 0.5737 0.8452 0.136 0.864
#> SRR542391 2 0.5737 0.8452 0.136 0.864
#> SRR542392 1 0.9998 -0.0702 0.508 0.492
#> SRR542393 2 0.5408 0.8519 0.124 0.876
#> SRR542394 2 0.5408 0.8519 0.124 0.876
#> SRR542395 2 0.5408 0.8519 0.124 0.876
#> SRR542396 2 0.0672 0.8767 0.008 0.992
#> SRR542397 2 0.5737 0.8452 0.136 0.864
#> SRR542398 1 0.2043 0.8964 0.968 0.032
#> SRR542399 1 0.0000 0.9261 1.000 0.000
#> SRR542400 1 0.0000 0.9261 1.000 0.000
#> SRR542401 1 0.0000 0.9261 1.000 0.000
#> SRR542402 1 0.0000 0.9261 1.000 0.000
#> SRR542403 1 0.0000 0.9261 1.000 0.000
#> SRR542404 1 0.0000 0.9261 1.000 0.000
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> SRR542346 3 0.0000 0.916 0.000 0.000 1.000
#> SRR542347 3 0.0000 0.916 0.000 0.000 1.000
#> SRR542348 3 0.0000 0.916 0.000 0.000 1.000
#> SRR542349 3 0.0000 0.916 0.000 0.000 1.000
#> SRR542350 2 0.0000 0.967 0.000 1.000 0.000
#> SRR542351 3 0.6204 0.292 0.000 0.424 0.576
#> SRR542352 2 0.0000 0.967 0.000 1.000 0.000
#> SRR542353 2 0.0000 0.967 0.000 1.000 0.000
#> SRR542354 2 0.4887 0.684 0.000 0.772 0.228
#> SRR542355 2 0.1163 0.945 0.000 0.972 0.028
#> SRR542356 2 0.0592 0.958 0.000 0.988 0.012
#> SRR542357 2 0.0000 0.967 0.000 1.000 0.000
#> SRR542358 2 0.0000 0.967 0.000 1.000 0.000
#> SRR542359 3 0.6416 0.617 0.032 0.260 0.708
#> SRR542360 3 0.0000 0.916 0.000 0.000 1.000
#> SRR542361 3 0.0000 0.916 0.000 0.000 1.000
#> SRR542362 3 0.0000 0.916 0.000 0.000 1.000
#> SRR542363 3 0.0000 0.916 0.000 0.000 1.000
#> SRR542364 2 0.0000 0.967 0.000 1.000 0.000
#> SRR542365 2 0.0000 0.967 0.000 1.000 0.000
#> SRR542366 2 0.0000 0.967 0.000 1.000 0.000
#> SRR542367 2 0.0000 0.967 0.000 1.000 0.000
#> SRR542368 1 0.0000 1.000 1.000 0.000 0.000
#> SRR542369 2 0.0000 0.967 0.000 1.000 0.000
#> SRR542370 2 0.0000 0.967 0.000 1.000 0.000
#> SRR542371 2 0.0000 0.967 0.000 1.000 0.000
#> SRR542372 2 0.0000 0.967 0.000 1.000 0.000
#> SRR542373 2 0.3816 0.811 0.000 0.852 0.148
#> SRR542374 3 0.3482 0.797 0.000 0.128 0.872
#> SRR542375 3 0.0892 0.901 0.000 0.020 0.980
#> SRR542376 3 0.0000 0.916 0.000 0.000 1.000
#> SRR542377 3 0.0000 0.916 0.000 0.000 1.000
#> SRR542378 3 0.0000 0.916 0.000 0.000 1.000
#> SRR542379 3 0.0000 0.916 0.000 0.000 1.000
#> SRR542380 3 0.0000 0.916 0.000 0.000 1.000
#> SRR542381 3 0.5621 0.569 0.000 0.308 0.692
#> SRR542382 3 0.1753 0.879 0.048 0.000 0.952
#> SRR542383 3 0.0000 0.916 0.000 0.000 1.000
#> SRR542384 2 0.6008 0.370 0.000 0.628 0.372
#> SRR542385 2 0.0000 0.967 0.000 1.000 0.000
#> SRR542386 2 0.0000 0.967 0.000 1.000 0.000
#> SRR542387 2 0.0237 0.965 0.000 0.996 0.004
#> SRR542388 2 0.0000 0.967 0.000 1.000 0.000
#> SRR542389 2 0.0000 0.967 0.000 1.000 0.000
#> SRR542390 2 0.0000 0.967 0.000 1.000 0.000
#> SRR542391 2 0.0000 0.967 0.000 1.000 0.000
#> SRR542392 2 0.0892 0.953 0.020 0.980 0.000
#> SRR542393 2 0.0000 0.967 0.000 1.000 0.000
#> SRR542394 2 0.0000 0.967 0.000 1.000 0.000
#> SRR542395 2 0.0000 0.967 0.000 1.000 0.000
#> SRR542396 2 0.2165 0.910 0.000 0.936 0.064
#> SRR542397 2 0.0000 0.967 0.000 1.000 0.000
#> SRR542398 1 0.0000 1.000 1.000 0.000 0.000
#> SRR542399 1 0.0000 1.000 1.000 0.000 0.000
#> SRR542400 1 0.0000 1.000 1.000 0.000 0.000
#> SRR542401 1 0.0000 1.000 1.000 0.000 0.000
#> SRR542402 1 0.0000 1.000 1.000 0.000 0.000
#> SRR542403 1 0.0000 1.000 1.000 0.000 0.000
#> SRR542404 1 0.0000 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
#> SRR542346 3 0.3942 0.6117 0.000 0.000 0.764 0.236
#> SRR542347 3 0.4989 0.0835 0.000 0.000 0.528 0.472
#> SRR542348 3 0.4624 0.4418 0.000 0.000 0.660 0.340
#> SRR542349 4 0.4972 0.0524 0.000 0.000 0.456 0.544
#> SRR542350 3 0.3074 0.7191 0.000 0.152 0.848 0.000
#> SRR542351 3 0.0000 0.8006 0.000 0.000 1.000 0.000
#> SRR542352 2 0.0000 0.9313 0.000 1.000 0.000 0.000
#> SRR542353 3 0.3266 0.7115 0.000 0.168 0.832 0.000
#> SRR542354 3 0.1302 0.7897 0.000 0.044 0.956 0.000
#> SRR542355 3 0.6500 0.0062 0.000 0.444 0.484 0.072
#> SRR542356 3 0.0707 0.7973 0.000 0.020 0.980 0.000
#> SRR542357 2 0.3219 0.7680 0.000 0.836 0.164 0.000
#> SRR542358 2 0.0000 0.9313 0.000 1.000 0.000 0.000
#> SRR542359 3 0.0000 0.8006 0.000 0.000 1.000 0.000
#> SRR542360 3 0.0188 0.7999 0.000 0.000 0.996 0.004
#> SRR542361 4 0.1211 0.9025 0.000 0.000 0.040 0.960
#> SRR542362 4 0.1302 0.9001 0.000 0.000 0.044 0.956
#> SRR542363 4 0.2011 0.8679 0.000 0.000 0.080 0.920
#> SRR542364 2 0.4567 0.6679 0.000 0.740 0.244 0.016
#> SRR542365 2 0.0000 0.9313 0.000 1.000 0.000 0.000
#> SRR542366 2 0.0000 0.9313 0.000 1.000 0.000 0.000
#> SRR542367 2 0.0000 0.9313 0.000 1.000 0.000 0.000
#> SRR542368 1 0.0000 0.9410 1.000 0.000 0.000 0.000
#> SRR542369 2 0.0000 0.9313 0.000 1.000 0.000 0.000
#> SRR542370 2 0.0000 0.9313 0.000 1.000 0.000 0.000
#> SRR542371 2 0.3117 0.8570 0.000 0.880 0.028 0.092
#> SRR542372 2 0.1297 0.9148 0.000 0.964 0.020 0.016
#> SRR542373 3 0.0592 0.7954 0.000 0.000 0.984 0.016
#> SRR542374 3 0.0000 0.8006 0.000 0.000 1.000 0.000
#> SRR542375 4 0.1302 0.8859 0.000 0.000 0.044 0.956
#> SRR542376 4 0.0707 0.9094 0.000 0.000 0.020 0.980
#> SRR542377 4 0.1022 0.9061 0.000 0.000 0.032 0.968
#> SRR542378 4 0.0000 0.9090 0.000 0.000 0.000 1.000
#> SRR542379 4 0.0592 0.9096 0.000 0.000 0.016 0.984
#> SRR542380 4 0.0000 0.9090 0.000 0.000 0.000 1.000
#> SRR542381 4 0.1109 0.8939 0.000 0.004 0.028 0.968
#> SRR542382 4 0.0188 0.9079 0.000 0.000 0.004 0.996
#> SRR542383 4 0.0188 0.9099 0.000 0.000 0.004 0.996
#> SRR542384 4 0.5018 0.6678 0.000 0.088 0.144 0.768
#> SRR542385 2 0.0000 0.9313 0.000 1.000 0.000 0.000
#> SRR542386 2 0.0336 0.9283 0.000 0.992 0.000 0.008
#> SRR542387 2 0.5022 0.6561 0.000 0.708 0.028 0.264
#> SRR542388 2 0.0000 0.9313 0.000 1.000 0.000 0.000
#> SRR542389 2 0.0000 0.9313 0.000 1.000 0.000 0.000
#> SRR542390 2 0.0000 0.9313 0.000 1.000 0.000 0.000
#> SRR542391 2 0.0000 0.9313 0.000 1.000 0.000 0.000
#> SRR542392 2 0.1059 0.9209 0.016 0.972 0.000 0.012
#> SRR542393 2 0.0188 0.9299 0.000 0.996 0.004 0.000
#> SRR542394 2 0.1722 0.9036 0.000 0.944 0.008 0.048
#> SRR542395 2 0.2530 0.8552 0.000 0.888 0.000 0.112
#> SRR542396 2 0.6106 0.4516 0.000 0.592 0.060 0.348
#> SRR542397 2 0.0000 0.9313 0.000 1.000 0.000 0.000
#> SRR542398 1 0.6027 0.5365 0.656 0.272 0.004 0.068
#> SRR542399 1 0.0000 0.9410 1.000 0.000 0.000 0.000
#> SRR542400 1 0.0000 0.9410 1.000 0.000 0.000 0.000
#> SRR542401 1 0.0000 0.9410 1.000 0.000 0.000 0.000
#> SRR542402 1 0.0000 0.9410 1.000 0.000 0.000 0.000
#> SRR542403 1 0.0000 0.9410 1.000 0.000 0.000 0.000
#> SRR542404 1 0.0000 0.9410 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
#> SRR542346 4 0.1732 0.904 0.000 0.000 0.080 0.920 0.000
#> SRR542347 4 0.0162 0.965 0.000 0.000 0.004 0.996 0.000
#> SRR542348 4 0.0609 0.956 0.000 0.000 0.020 0.980 0.000
#> SRR542349 4 0.0162 0.965 0.000 0.000 0.004 0.996 0.000
#> SRR542350 3 0.1671 0.874 0.000 0.076 0.924 0.000 0.000
#> SRR542351 3 0.0000 0.914 0.000 0.000 1.000 0.000 0.000
#> SRR542352 2 0.0162 0.986 0.000 0.996 0.004 0.000 0.000
#> SRR542353 3 0.0703 0.910 0.000 0.024 0.976 0.000 0.000
#> SRR542354 3 0.0000 0.914 0.000 0.000 1.000 0.000 0.000
#> SRR542355 5 0.3990 0.577 0.000 0.000 0.308 0.004 0.688
#> SRR542356 3 0.0000 0.914 0.000 0.000 1.000 0.000 0.000
#> SRR542357 3 0.3612 0.644 0.000 0.268 0.732 0.000 0.000
#> SRR542358 2 0.0162 0.986 0.000 0.996 0.004 0.000 0.000
#> SRR542359 3 0.1851 0.878 0.000 0.000 0.912 0.000 0.088
#> SRR542360 3 0.0404 0.913 0.000 0.000 0.988 0.000 0.012
#> SRR542361 4 0.0000 0.966 0.000 0.000 0.000 1.000 0.000
#> SRR542362 4 0.0000 0.966 0.000 0.000 0.000 1.000 0.000
#> SRR542363 4 0.0000 0.966 0.000 0.000 0.000 1.000 0.000
#> SRR542364 5 0.2900 0.802 0.000 0.108 0.028 0.000 0.864
#> SRR542365 2 0.0000 0.989 0.000 1.000 0.000 0.000 0.000
#> SRR542366 2 0.0162 0.986 0.000 0.996 0.000 0.000 0.004
#> SRR542367 2 0.0162 0.986 0.000 0.996 0.000 0.000 0.004
#> SRR542368 1 0.0000 1.000 1.000 0.000 0.000 0.000 0.000
#> SRR542369 2 0.0000 0.989 0.000 1.000 0.000 0.000 0.000
#> SRR542370 2 0.0000 0.989 0.000 1.000 0.000 0.000 0.000
#> SRR542371 5 0.0000 0.886 0.000 0.000 0.000 0.000 1.000
#> SRR542372 5 0.0963 0.873 0.000 0.036 0.000 0.000 0.964
#> SRR542373 5 0.1965 0.826 0.000 0.000 0.096 0.000 0.904
#> SRR542374 3 0.1965 0.872 0.000 0.000 0.904 0.000 0.096
#> SRR542375 5 0.0000 0.886 0.000 0.000 0.000 0.000 1.000
#> SRR542376 4 0.0000 0.966 0.000 0.000 0.000 1.000 0.000
#> SRR542377 4 0.0000 0.966 0.000 0.000 0.000 1.000 0.000
#> SRR542378 4 0.3039 0.766 0.000 0.000 0.000 0.808 0.192
#> SRR542379 4 0.0000 0.966 0.000 0.000 0.000 1.000 0.000
#> SRR542380 4 0.0963 0.946 0.000 0.000 0.000 0.964 0.036
#> SRR542381 5 0.0000 0.886 0.000 0.000 0.000 0.000 1.000
#> SRR542382 5 0.2966 0.738 0.000 0.000 0.000 0.184 0.816
#> SRR542383 4 0.1121 0.940 0.000 0.000 0.000 0.956 0.044
#> SRR542384 5 0.0000 0.886 0.000 0.000 0.000 0.000 1.000
#> SRR542385 2 0.0000 0.989 0.000 1.000 0.000 0.000 0.000
#> SRR542386 2 0.0000 0.989 0.000 1.000 0.000 0.000 0.000
#> SRR542387 5 0.0162 0.885 0.000 0.000 0.000 0.004 0.996
#> SRR542388 2 0.0000 0.989 0.000 1.000 0.000 0.000 0.000
#> SRR542389 2 0.0000 0.989 0.000 1.000 0.000 0.000 0.000
#> SRR542390 2 0.0000 0.989 0.000 1.000 0.000 0.000 0.000
#> SRR542391 2 0.0000 0.989 0.000 1.000 0.000 0.000 0.000
#> SRR542392 2 0.2230 0.871 0.116 0.884 0.000 0.000 0.000
#> SRR542393 2 0.0794 0.962 0.000 0.972 0.000 0.000 0.028
#> SRR542394 5 0.1478 0.857 0.000 0.064 0.000 0.000 0.936
#> SRR542395 5 0.4219 0.325 0.000 0.416 0.000 0.000 0.584
#> SRR542396 5 0.0000 0.886 0.000 0.000 0.000 0.000 1.000
#> SRR542397 2 0.0000 0.989 0.000 1.000 0.000 0.000 0.000
#> SRR542398 5 0.1121 0.869 0.044 0.000 0.000 0.000 0.956
#> SRR542399 1 0.0000 1.000 1.000 0.000 0.000 0.000 0.000
#> SRR542400 1 0.0000 1.000 1.000 0.000 0.000 0.000 0.000
#> SRR542401 1 0.0000 1.000 1.000 0.000 0.000 0.000 0.000
#> SRR542402 1 0.0000 1.000 1.000 0.000 0.000 0.000 0.000
#> SRR542403 1 0.0000 1.000 1.000 0.000 0.000 0.000 0.000
#> SRR542404 1 0.0000 1.000 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
#> SRR542346 4 0.2699 0.8438 0.000 0.000 0.108 0.864 0.008 0.020
#> SRR542347 4 0.0692 0.9167 0.000 0.000 0.000 0.976 0.004 0.020
#> SRR542348 4 0.2555 0.8619 0.000 0.000 0.096 0.876 0.008 0.020
#> SRR542349 4 0.0692 0.9167 0.000 0.000 0.000 0.976 0.004 0.020
#> SRR542350 3 0.4342 0.4933 0.000 0.308 0.656 0.000 0.028 0.008
#> SRR542351 3 0.2562 0.6837 0.000 0.000 0.828 0.000 0.172 0.000
#> SRR542352 2 0.1320 0.8632 0.000 0.948 0.016 0.000 0.000 0.036
#> SRR542353 3 0.3788 0.6125 0.000 0.232 0.740 0.000 0.020 0.008
#> SRR542354 3 0.2823 0.4949 0.000 0.000 0.796 0.000 0.000 0.204
#> SRR542355 6 0.1152 0.6691 0.000 0.000 0.044 0.000 0.004 0.952
#> SRR542356 3 0.0146 0.6682 0.000 0.000 0.996 0.000 0.000 0.004
#> SRR542357 6 0.4284 0.2376 0.000 0.008 0.384 0.000 0.012 0.596
#> SRR542358 2 0.0603 0.8705 0.000 0.980 0.016 0.000 0.000 0.004
#> SRR542359 3 0.3714 0.6044 0.000 0.000 0.656 0.000 0.340 0.004
#> SRR542360 3 0.3766 0.6256 0.000 0.000 0.684 0.000 0.304 0.012
#> SRR542361 4 0.0000 0.9207 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR542362 4 0.0000 0.9207 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR542363 4 0.0547 0.9176 0.000 0.000 0.000 0.980 0.000 0.020
#> SRR542364 5 0.0692 0.7933 0.000 0.004 0.000 0.000 0.976 0.020
#> SRR542365 2 0.2897 0.8193 0.000 0.852 0.000 0.000 0.060 0.088
#> SRR542366 2 0.5706 0.2254 0.000 0.488 0.000 0.000 0.176 0.336
#> SRR542367 6 0.4969 0.4912 0.000 0.196 0.000 0.000 0.156 0.648
#> SRR542368 1 0.0000 1.0000 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR542369 2 0.0909 0.8733 0.000 0.968 0.000 0.000 0.020 0.012
#> SRR542370 2 0.3098 0.7705 0.000 0.812 0.000 0.000 0.164 0.024
#> SRR542371 6 0.2520 0.6377 0.000 0.000 0.004 0.000 0.152 0.844
#> SRR542372 6 0.3888 0.5086 0.000 0.016 0.000 0.000 0.312 0.672
#> SRR542373 5 0.1082 0.7834 0.000 0.000 0.040 0.000 0.956 0.004
#> SRR542374 3 0.3578 0.6050 0.000 0.000 0.660 0.000 0.340 0.000
#> SRR542375 5 0.3464 0.6259 0.000 0.000 0.000 0.000 0.688 0.312
#> SRR542376 4 0.0000 0.9207 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR542377 4 0.0000 0.9207 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR542378 4 0.4050 0.6637 0.000 0.000 0.000 0.716 0.048 0.236
#> SRR542379 4 0.0000 0.9207 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR542380 4 0.2558 0.8144 0.000 0.000 0.000 0.840 0.004 0.156
#> SRR542381 6 0.3672 0.1201 0.000 0.000 0.000 0.000 0.368 0.632
#> SRR542382 6 0.5953 0.0134 0.000 0.000 0.000 0.308 0.244 0.448
#> SRR542383 4 0.2553 0.8230 0.000 0.000 0.000 0.848 0.008 0.144
#> SRR542384 5 0.1714 0.8300 0.000 0.000 0.000 0.000 0.908 0.092
#> SRR542385 2 0.0000 0.8769 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR542386 2 0.1588 0.8553 0.000 0.924 0.000 0.000 0.004 0.072
#> SRR542387 6 0.1814 0.6221 0.000 0.000 0.000 0.000 0.100 0.900
#> SRR542388 2 0.0146 0.8760 0.000 0.996 0.000 0.000 0.000 0.004
#> SRR542389 2 0.0146 0.8761 0.000 0.996 0.004 0.000 0.000 0.000
#> SRR542390 2 0.0000 0.8769 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR542391 2 0.0000 0.8769 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR542392 2 0.5557 0.4332 0.300 0.548 0.000 0.000 0.004 0.148
#> SRR542393 2 0.2234 0.8198 0.000 0.872 0.004 0.000 0.000 0.124
#> SRR542394 6 0.0806 0.6727 0.000 0.020 0.000 0.000 0.008 0.972
#> SRR542395 6 0.0790 0.6726 0.000 0.032 0.000 0.000 0.000 0.968
#> SRR542396 5 0.1267 0.8312 0.000 0.000 0.000 0.000 0.940 0.060
#> SRR542397 2 0.0632 0.8766 0.000 0.976 0.000 0.000 0.000 0.024
#> SRR542398 5 0.4075 0.7321 0.076 0.000 0.000 0.000 0.740 0.184
#> SRR542399 1 0.0000 1.0000 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR542400 1 0.0000 1.0000 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR542401 1 0.0000 1.0000 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR542402 1 0.0000 1.0000 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR542403 1 0.0000 1.0000 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR542404 1 0.0000 1.0000 1.000 0.000 0.000 0.000 0.000 0.000
Heatmaps for the consensus matrix. It visualizes the probability of two samples to be in a same group.
consensus_heatmap(res, k = 2)
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 16804 rows and 59 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 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.634 0.823 0.911 0.289 0.814 0.814
#> 3 3 0.502 0.748 0.882 0.728 0.712 0.647
#> 4 4 0.516 0.731 0.864 0.306 0.785 0.611
#> 5 5 0.654 0.750 0.838 0.134 0.877 0.677
#> 6 6 0.671 0.701 0.758 0.105 0.884 0.586
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
#> SRR542346 2 0.971 0.514 0.400 0.600
#> SRR542347 2 0.971 0.514 0.400 0.600
#> SRR542348 2 0.971 0.514 0.400 0.600
#> SRR542349 2 0.971 0.514 0.400 0.600
#> SRR542350 2 0.971 0.514 0.400 0.600
#> SRR542351 2 0.971 0.514 0.400 0.600
#> SRR542352 2 0.671 0.768 0.176 0.824
#> SRR542353 2 0.971 0.514 0.400 0.600
#> SRR542354 2 0.971 0.514 0.400 0.600
#> SRR542355 2 0.000 0.890 0.000 1.000
#> SRR542356 2 0.971 0.514 0.400 0.600
#> SRR542357 2 0.000 0.890 0.000 1.000
#> SRR542358 2 0.671 0.768 0.176 0.824
#> SRR542359 2 0.971 0.514 0.400 0.600
#> SRR542360 2 0.000 0.890 0.000 1.000
#> SRR542361 2 0.373 0.856 0.072 0.928
#> SRR542362 2 0.373 0.856 0.072 0.928
#> SRR542363 2 0.373 0.856 0.072 0.928
#> SRR542364 2 0.000 0.890 0.000 1.000
#> SRR542365 2 0.000 0.890 0.000 1.000
#> SRR542366 2 0.000 0.890 0.000 1.000
#> SRR542367 2 0.000 0.890 0.000 1.000
#> SRR542368 2 0.000 0.890 0.000 1.000
#> SRR542369 2 0.000 0.890 0.000 1.000
#> SRR542370 2 0.000 0.890 0.000 1.000
#> SRR542371 2 0.000 0.890 0.000 1.000
#> SRR542372 2 0.000 0.890 0.000 1.000
#> SRR542373 2 0.000 0.890 0.000 1.000
#> SRR542374 2 0.971 0.514 0.400 0.600
#> SRR542375 2 0.000 0.890 0.000 1.000
#> SRR542376 2 0.373 0.856 0.072 0.928
#> SRR542377 2 0.373 0.856 0.072 0.928
#> SRR542378 2 0.000 0.890 0.000 1.000
#> SRR542379 2 0.373 0.856 0.072 0.928
#> SRR542380 2 0.000 0.890 0.000 1.000
#> SRR542381 2 0.000 0.890 0.000 1.000
#> SRR542382 2 0.000 0.890 0.000 1.000
#> SRR542383 2 0.000 0.890 0.000 1.000
#> SRR542384 2 0.000 0.890 0.000 1.000
#> SRR542385 2 0.000 0.890 0.000 1.000
#> SRR542386 2 0.000 0.890 0.000 1.000
#> SRR542387 2 0.000 0.890 0.000 1.000
#> SRR542388 2 0.000 0.890 0.000 1.000
#> SRR542389 2 0.000 0.890 0.000 1.000
#> SRR542390 2 0.000 0.890 0.000 1.000
#> SRR542391 2 0.000 0.890 0.000 1.000
#> SRR542392 2 0.000 0.890 0.000 1.000
#> SRR542393 2 0.358 0.854 0.068 0.932
#> SRR542394 2 0.000 0.890 0.000 1.000
#> SRR542395 2 0.000 0.890 0.000 1.000
#> SRR542396 2 0.000 0.890 0.000 1.000
#> SRR542397 2 0.000 0.890 0.000 1.000
#> SRR542398 2 0.000 0.890 0.000 1.000
#> SRR542399 1 0.000 1.000 1.000 0.000
#> SRR542400 1 0.000 1.000 1.000 0.000
#> SRR542401 1 0.000 1.000 1.000 0.000
#> SRR542402 1 0.000 1.000 1.000 0.000
#> SRR542403 1 0.000 1.000 1.000 0.000
#> SRR542404 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
#> SRR542346 3 0.3752 0.724 0 0.144 0.856
#> SRR542347 3 0.3752 0.724 0 0.144 0.856
#> SRR542348 3 0.3752 0.724 0 0.144 0.856
#> SRR542349 3 0.3752 0.724 0 0.144 0.856
#> SRR542350 3 0.4605 0.756 0 0.204 0.796
#> SRR542351 3 0.4062 0.788 0 0.164 0.836
#> SRR542352 2 0.5254 0.517 0 0.736 0.264
#> SRR542353 3 0.4605 0.756 0 0.204 0.796
#> SRR542354 3 0.4178 0.788 0 0.172 0.828
#> SRR542355 2 0.5431 0.540 0 0.716 0.284
#> SRR542356 3 0.4062 0.783 0 0.164 0.836
#> SRR542357 2 0.2796 0.814 0 0.908 0.092
#> SRR542358 2 0.4974 0.562 0 0.764 0.236
#> SRR542359 3 0.4062 0.788 0 0.164 0.836
#> SRR542360 2 0.0747 0.851 0 0.984 0.016
#> SRR542361 2 0.6299 0.165 0 0.524 0.476
#> SRR542362 2 0.6299 0.165 0 0.524 0.476
#> SRR542363 3 0.6307 -0.131 0 0.488 0.512
#> SRR542364 2 0.0237 0.855 0 0.996 0.004
#> SRR542365 2 0.0237 0.855 0 0.996 0.004
#> SRR542366 2 0.0237 0.855 0 0.996 0.004
#> SRR542367 2 0.0237 0.855 0 0.996 0.004
#> SRR542368 2 0.0237 0.855 0 0.996 0.004
#> SRR542369 2 0.0237 0.855 0 0.996 0.004
#> SRR542370 2 0.0237 0.855 0 0.996 0.004
#> SRR542371 2 0.0237 0.855 0 0.996 0.004
#> SRR542372 2 0.0237 0.855 0 0.996 0.004
#> SRR542373 2 0.0747 0.851 0 0.984 0.016
#> SRR542374 3 0.4062 0.788 0 0.164 0.836
#> SRR542375 2 0.2165 0.828 0 0.936 0.064
#> SRR542376 2 0.6267 0.232 0 0.548 0.452
#> SRR542377 2 0.6280 0.207 0 0.540 0.460
#> SRR542378 2 0.4605 0.704 0 0.796 0.204
#> SRR542379 2 0.6267 0.232 0 0.548 0.452
#> SRR542380 2 0.4605 0.704 0 0.796 0.204
#> SRR542381 2 0.2165 0.828 0 0.936 0.064
#> SRR542382 2 0.4605 0.704 0 0.796 0.204
#> SRR542383 2 0.4605 0.704 0 0.796 0.204
#> SRR542384 2 0.2165 0.828 0 0.936 0.064
#> SRR542385 2 0.0237 0.854 0 0.996 0.004
#> SRR542386 2 0.0237 0.855 0 0.996 0.004
#> SRR542387 2 0.1411 0.840 0 0.964 0.036
#> SRR542388 2 0.0237 0.855 0 0.996 0.004
#> SRR542389 2 0.0592 0.852 0 0.988 0.012
#> SRR542390 2 0.0237 0.854 0 0.996 0.004
#> SRR542391 2 0.0592 0.852 0 0.988 0.012
#> SRR542392 2 0.0237 0.855 0 0.996 0.004
#> SRR542393 2 0.2959 0.778 0 0.900 0.100
#> SRR542394 2 0.1411 0.840 0 0.964 0.036
#> SRR542395 2 0.1411 0.840 0 0.964 0.036
#> SRR542396 2 0.2165 0.828 0 0.936 0.064
#> SRR542397 2 0.0424 0.852 0 0.992 0.008
#> SRR542398 2 0.0237 0.854 0 0.996 0.004
#> SRR542399 1 0.0000 1.000 1 0.000 0.000
#> SRR542400 1 0.0000 1.000 1 0.000 0.000
#> SRR542401 1 0.0000 1.000 1 0.000 0.000
#> SRR542402 1 0.0000 1.000 1 0.000 0.000
#> SRR542403 1 0.0000 1.000 1 0.000 0.000
#> SRR542404 1 0.0000 1.000 1 0.000 0.000
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> SRR542346 4 0.4776 0.301 0 0.000 0.376 0.624
#> SRR542347 4 0.4776 0.301 0 0.000 0.376 0.624
#> SRR542348 4 0.4776 0.301 0 0.000 0.376 0.624
#> SRR542349 4 0.4776 0.301 0 0.000 0.376 0.624
#> SRR542350 3 0.2760 0.831 0 0.128 0.872 0.000
#> SRR542351 3 0.0336 0.909 0 0.008 0.992 0.000
#> SRR542352 2 0.4673 0.608 0 0.700 0.292 0.008
#> SRR542353 3 0.2760 0.831 0 0.128 0.872 0.000
#> SRR542354 3 0.3271 0.796 0 0.012 0.856 0.132
#> SRR542355 2 0.6851 0.358 0 0.568 0.300 0.132
#> SRR542356 3 0.0469 0.905 0 0.012 0.988 0.000
#> SRR542357 2 0.4323 0.724 0 0.776 0.204 0.020
#> SRR542358 2 0.4103 0.648 0 0.744 0.256 0.000
#> SRR542359 3 0.0336 0.909 0 0.008 0.992 0.000
#> SRR542360 2 0.2816 0.829 0 0.900 0.064 0.036
#> SRR542361 4 0.2867 0.688 0 0.104 0.012 0.884
#> SRR542362 4 0.2867 0.688 0 0.104 0.012 0.884
#> SRR542363 4 0.3149 0.670 0 0.088 0.032 0.880
#> SRR542364 2 0.0817 0.852 0 0.976 0.024 0.000
#> SRR542365 2 0.0524 0.853 0 0.988 0.008 0.004
#> SRR542366 2 0.0188 0.852 0 0.996 0.004 0.000
#> SRR542367 2 0.0657 0.852 0 0.984 0.012 0.004
#> SRR542368 2 0.0188 0.852 0 0.996 0.004 0.000
#> SRR542369 2 0.0188 0.852 0 0.996 0.004 0.000
#> SRR542370 2 0.0188 0.852 0 0.996 0.004 0.000
#> SRR542371 2 0.0804 0.852 0 0.980 0.012 0.008
#> SRR542372 2 0.0657 0.852 0 0.984 0.012 0.004
#> SRR542373 2 0.2816 0.829 0 0.900 0.064 0.036
#> SRR542374 3 0.0336 0.909 0 0.008 0.992 0.000
#> SRR542375 2 0.5212 0.365 0 0.572 0.008 0.420
#> SRR542376 4 0.2647 0.691 0 0.120 0.000 0.880
#> SRR542377 4 0.2530 0.691 0 0.112 0.000 0.888
#> SRR542378 4 0.4483 0.512 0 0.284 0.004 0.712
#> SRR542379 4 0.2647 0.691 0 0.120 0.000 0.880
#> SRR542380 4 0.4483 0.512 0 0.284 0.004 0.712
#> SRR542381 2 0.5212 0.365 0 0.572 0.008 0.420
#> SRR542382 4 0.4483 0.512 0 0.284 0.004 0.712
#> SRR542383 4 0.4483 0.512 0 0.284 0.004 0.712
#> SRR542384 2 0.5212 0.365 0 0.572 0.008 0.420
#> SRR542385 2 0.0672 0.852 0 0.984 0.008 0.008
#> SRR542386 2 0.0188 0.852 0 0.996 0.000 0.004
#> SRR542387 2 0.3224 0.803 0 0.864 0.120 0.016
#> SRR542388 2 0.0188 0.852 0 0.996 0.000 0.004
#> SRR542389 2 0.1022 0.849 0 0.968 0.032 0.000
#> SRR542390 2 0.0672 0.852 0 0.984 0.008 0.008
#> SRR542391 2 0.1209 0.849 0 0.964 0.032 0.004
#> SRR542392 2 0.0188 0.852 0 0.996 0.000 0.004
#> SRR542393 2 0.2737 0.809 0 0.888 0.104 0.008
#> SRR542394 2 0.2987 0.813 0 0.880 0.104 0.016
#> SRR542395 2 0.3224 0.803 0 0.864 0.120 0.016
#> SRR542396 2 0.5212 0.365 0 0.572 0.008 0.420
#> SRR542397 2 0.0657 0.852 0 0.984 0.012 0.004
#> SRR542398 2 0.4897 0.500 0 0.660 0.008 0.332
#> SRR542399 1 0.0000 1.000 1 0.000 0.000 0.000
#> SRR542400 1 0.0000 1.000 1 0.000 0.000 0.000
#> SRR542401 1 0.0000 1.000 1 0.000 0.000 0.000
#> SRR542402 1 0.0000 1.000 1 0.000 0.000 0.000
#> SRR542403 1 0.0000 1.000 1 0.000 0.000 0.000
#> SRR542404 1 0.0000 1.000 1 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
#> SRR542346 4 0.000 0.519 0 0.000 0.000 1.000 0.000
#> SRR542347 4 0.000 0.519 0 0.000 0.000 1.000 0.000
#> SRR542348 4 0.000 0.519 0 0.000 0.000 1.000 0.000
#> SRR542349 4 0.000 0.519 0 0.000 0.000 1.000 0.000
#> SRR542350 3 0.649 0.848 0 0.108 0.528 0.336 0.028
#> SRR542351 3 0.400 0.918 0 0.000 0.656 0.344 0.000
#> SRR542352 2 0.633 0.566 0 0.644 0.096 0.180 0.080
#> SRR542353 3 0.649 0.848 0 0.108 0.528 0.336 0.028
#> SRR542354 4 0.508 -0.747 0 0.020 0.484 0.488 0.008
#> SRR542355 2 0.638 0.473 0 0.568 0.260 0.156 0.016
#> SRR542356 3 0.445 0.913 0 0.016 0.644 0.340 0.000
#> SRR542357 2 0.461 0.769 0 0.752 0.184 0.020 0.044
#> SRR542358 2 0.539 0.605 0 0.712 0.068 0.176 0.044
#> SRR542359 3 0.400 0.918 0 0.000 0.656 0.344 0.000
#> SRR542360 2 0.431 0.784 0 0.760 0.068 0.000 0.172
#> SRR542361 4 0.548 0.658 0 0.000 0.336 0.584 0.080
#> SRR542362 4 0.548 0.658 0 0.000 0.336 0.584 0.080
#> SRR542363 4 0.424 0.658 0 0.000 0.336 0.656 0.008
#> SRR542364 2 0.277 0.849 0 0.876 0.032 0.000 0.092
#> SRR542365 2 0.128 0.861 0 0.952 0.004 0.000 0.044
#> SRR542366 2 0.195 0.853 0 0.912 0.004 0.000 0.084
#> SRR542367 2 0.236 0.853 0 0.892 0.012 0.000 0.096
#> SRR542368 2 0.195 0.852 0 0.912 0.004 0.000 0.084
#> SRR542369 2 0.195 0.853 0 0.912 0.004 0.000 0.084
#> SRR542370 2 0.195 0.853 0 0.912 0.004 0.000 0.084
#> SRR542371 2 0.252 0.851 0 0.880 0.012 0.000 0.108
#> SRR542372 2 0.247 0.851 0 0.884 0.012 0.000 0.104
#> SRR542373 2 0.431 0.784 0 0.760 0.068 0.000 0.172
#> SRR542374 3 0.400 0.918 0 0.000 0.656 0.344 0.000
#> SRR542375 5 0.362 0.751 0 0.172 0.008 0.016 0.804
#> SRR542376 4 0.633 0.614 0 0.000 0.336 0.492 0.172
#> SRR542377 4 0.627 0.621 0 0.000 0.336 0.500 0.164
#> SRR542378 5 0.335 0.636 0 0.000 0.008 0.196 0.796
#> SRR542379 4 0.633 0.614 0 0.000 0.336 0.492 0.172
#> SRR542380 5 0.335 0.636 0 0.000 0.008 0.196 0.796
#> SRR542381 5 0.362 0.751 0 0.172 0.008 0.016 0.804
#> SRR542382 5 0.335 0.636 0 0.000 0.008 0.196 0.796
#> SRR542383 5 0.335 0.636 0 0.000 0.008 0.196 0.796
#> SRR542384 5 0.362 0.751 0 0.172 0.008 0.016 0.804
#> SRR542385 2 0.143 0.849 0 0.944 0.004 0.000 0.052
#> SRR542386 2 0.104 0.858 0 0.960 0.000 0.000 0.040
#> SRR542387 2 0.469 0.770 0 0.748 0.108 0.004 0.140
#> SRR542388 2 0.104 0.858 0 0.960 0.000 0.000 0.040
#> SRR542389 2 0.172 0.848 0 0.936 0.020 0.000 0.044
#> SRR542390 2 0.143 0.849 0 0.944 0.004 0.000 0.052
#> SRR542391 2 0.187 0.846 0 0.928 0.020 0.000 0.052
#> SRR542392 2 0.104 0.858 0 0.960 0.000 0.000 0.040
#> SRR542393 2 0.330 0.821 0 0.864 0.020 0.072 0.044
#> SRR542394 2 0.461 0.777 0 0.752 0.092 0.004 0.152
#> SRR542395 2 0.469 0.770 0 0.748 0.108 0.004 0.140
#> SRR542396 5 0.362 0.751 0 0.172 0.008 0.016 0.804
#> SRR542397 2 0.128 0.849 0 0.952 0.004 0.000 0.044
#> SRR542398 5 0.402 0.592 0 0.292 0.008 0.000 0.700
#> SRR542399 1 0.000 1.000 1 0.000 0.000 0.000 0.000
#> SRR542400 1 0.000 1.000 1 0.000 0.000 0.000 0.000
#> SRR542401 1 0.000 1.000 1 0.000 0.000 0.000 0.000
#> SRR542402 1 0.000 1.000 1 0.000 0.000 0.000 0.000
#> SRR542403 1 0.000 1.000 1 0.000 0.000 0.000 0.000
#> SRR542404 1 0.000 1.000 1 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
#> SRR542346 4 0.4553 0.464 0 0.052 0.328 0.620 0.000 0.000
#> SRR542347 4 0.4553 0.464 0 0.052 0.328 0.620 0.000 0.000
#> SRR542348 4 0.4553 0.464 0 0.052 0.328 0.620 0.000 0.000
#> SRR542349 4 0.4607 0.461 0 0.056 0.328 0.616 0.000 0.000
#> SRR542350 3 0.2442 0.822 0 0.144 0.852 0.000 0.000 0.004
#> SRR542351 3 0.0000 0.885 0 0.000 1.000 0.000 0.000 0.000
#> SRR542352 2 0.5888 0.491 0 0.552 0.232 0.000 0.016 0.200
#> SRR542353 3 0.2442 0.822 0 0.144 0.852 0.000 0.000 0.004
#> SRR542354 3 0.4440 0.704 0 0.124 0.756 0.096 0.020 0.004
#> SRR542355 2 0.5568 0.473 0 0.660 0.196 0.096 0.024 0.024
#> SRR542356 3 0.1391 0.872 0 0.040 0.944 0.000 0.016 0.000
#> SRR542357 2 0.5373 0.625 0 0.684 0.116 0.012 0.032 0.156
#> SRR542358 2 0.5092 0.564 0 0.624 0.232 0.000 0.000 0.144
#> SRR542359 3 0.0000 0.885 0 0.000 1.000 0.000 0.000 0.000
#> SRR542360 6 0.4136 0.619 0 0.036 0.060 0.000 0.124 0.780
#> SRR542361 4 0.1714 0.683 0 0.000 0.000 0.908 0.092 0.000
#> SRR542362 4 0.1714 0.683 0 0.000 0.000 0.908 0.092 0.000
#> SRR542363 4 0.0405 0.679 0 0.004 0.000 0.988 0.008 0.000
#> SRR542364 6 0.1492 0.717 0 0.036 0.024 0.000 0.000 0.940
#> SRR542365 6 0.3215 0.703 0 0.240 0.000 0.000 0.004 0.756
#> SRR542366 6 0.2135 0.754 0 0.128 0.000 0.000 0.000 0.872
#> SRR542367 6 0.3065 0.738 0 0.152 0.000 0.000 0.028 0.820
#> SRR542368 6 0.1267 0.726 0 0.060 0.000 0.000 0.000 0.940
#> SRR542369 6 0.2178 0.753 0 0.132 0.000 0.000 0.000 0.868
#> SRR542370 6 0.2178 0.753 0 0.132 0.000 0.000 0.000 0.868
#> SRR542371 6 0.3385 0.715 0 0.180 0.000 0.000 0.032 0.788
#> SRR542372 6 0.3312 0.716 0 0.180 0.000 0.000 0.028 0.792
#> SRR542373 6 0.4136 0.619 0 0.036 0.060 0.000 0.124 0.780
#> SRR542374 3 0.0000 0.885 0 0.000 1.000 0.000 0.000 0.000
#> SRR542375 5 0.3520 0.751 0 0.036 0.000 0.000 0.776 0.188
#> SRR542376 4 0.3101 0.614 0 0.000 0.000 0.756 0.244 0.000
#> SRR542377 4 0.3076 0.616 0 0.000 0.000 0.760 0.240 0.000
#> SRR542378 5 0.1957 0.701 0 0.000 0.000 0.112 0.888 0.000
#> SRR542379 4 0.3101 0.614 0 0.000 0.000 0.756 0.244 0.000
#> SRR542380 5 0.1957 0.701 0 0.000 0.000 0.112 0.888 0.000
#> SRR542381 5 0.3520 0.751 0 0.036 0.000 0.000 0.776 0.188
#> SRR542382 5 0.1957 0.701 0 0.000 0.000 0.112 0.888 0.000
#> SRR542383 5 0.1957 0.701 0 0.000 0.000 0.112 0.888 0.000
#> SRR542384 5 0.3520 0.751 0 0.036 0.000 0.000 0.776 0.188
#> SRR542385 2 0.2703 0.701 0 0.824 0.000 0.000 0.004 0.172
#> SRR542386 6 0.3769 0.425 0 0.356 0.000 0.000 0.004 0.640
#> SRR542387 2 0.3899 0.693 0 0.800 0.044 0.000 0.112 0.044
#> SRR542388 6 0.3769 0.425 0 0.356 0.000 0.000 0.004 0.640
#> SRR542389 2 0.2631 0.715 0 0.840 0.008 0.000 0.000 0.152
#> SRR542390 2 0.2703 0.701 0 0.824 0.000 0.000 0.004 0.172
#> SRR542391 2 0.2734 0.716 0 0.840 0.008 0.000 0.004 0.148
#> SRR542392 6 0.3769 0.425 0 0.356 0.000 0.000 0.004 0.640
#> SRR542393 2 0.4585 0.527 0 0.648 0.068 0.000 0.000 0.284
#> SRR542394 2 0.3952 0.694 0 0.796 0.032 0.000 0.108 0.064
#> SRR542395 2 0.3899 0.693 0 0.800 0.044 0.000 0.112 0.044
#> SRR542396 5 0.3520 0.751 0 0.036 0.000 0.000 0.776 0.188
#> SRR542397 2 0.2491 0.710 0 0.836 0.000 0.000 0.000 0.164
#> SRR542398 5 0.5117 0.512 0 0.116 0.000 0.000 0.596 0.288
#> SRR542399 1 0.0000 1.000 1 0.000 0.000 0.000 0.000 0.000
#> SRR542400 1 0.0000 1.000 1 0.000 0.000 0.000 0.000 0.000
#> SRR542401 1 0.0000 1.000 1 0.000 0.000 0.000 0.000 0.000
#> SRR542402 1 0.0000 1.000 1 0.000 0.000 0.000 0.000 0.000
#> SRR542403 1 0.0000 1.000 1 0.000 0.000 0.000 0.000 0.000
#> SRR542404 1 0.0000 1.000 1 0.000 0.000 0.000 0.000 0.000
Heatmaps for the consensus matrix. It visualizes the probability of two samples to be in a same group.
consensus_heatmap(res, k = 2)
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 16804 rows and 59 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 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.138 0.597 0.746 0.4437 0.492 0.492
#> 3 3 0.354 0.560 0.761 0.3226 0.617 0.384
#> 4 4 0.610 0.719 0.838 0.2063 0.838 0.607
#> 5 5 0.620 0.501 0.694 0.0978 0.852 0.568
#> 6 6 0.689 0.587 0.769 0.0607 0.863 0.498
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
#> SRR542346 2 0.795 0.532 0.240 0.760
#> SRR542347 2 0.795 0.532 0.240 0.760
#> SRR542348 2 0.795 0.532 0.240 0.760
#> SRR542349 2 0.795 0.532 0.240 0.760
#> SRR542350 2 0.373 0.678 0.072 0.928
#> SRR542351 2 0.141 0.695 0.020 0.980
#> SRR542352 2 0.644 0.658 0.164 0.836
#> SRR542353 2 0.358 0.679 0.068 0.932
#> SRR542354 2 0.141 0.695 0.020 0.980
#> SRR542355 2 0.388 0.695 0.076 0.924
#> SRR542356 2 0.000 0.698 0.000 1.000
#> SRR542357 2 0.327 0.695 0.060 0.940
#> SRR542358 2 0.494 0.662 0.108 0.892
#> SRR542359 2 0.184 0.697 0.028 0.972
#> SRR542360 2 0.625 0.649 0.156 0.844
#> SRR542361 2 0.998 0.299 0.476 0.524
#> SRR542362 2 0.998 0.299 0.476 0.524
#> SRR542363 2 0.886 0.528 0.304 0.696
#> SRR542364 2 0.518 0.681 0.116 0.884
#> SRR542365 2 0.917 0.430 0.332 0.668
#> SRR542366 2 0.839 0.522 0.268 0.732
#> SRR542367 2 0.886 0.449 0.304 0.696
#> SRR542368 2 0.839 0.483 0.268 0.732
#> SRR542369 2 0.833 0.560 0.264 0.736
#> SRR542370 2 0.876 0.509 0.296 0.704
#> SRR542371 1 0.992 0.593 0.552 0.448
#> SRR542372 2 0.886 0.449 0.304 0.696
#> SRR542373 2 0.373 0.694 0.072 0.928
#> SRR542374 2 0.141 0.695 0.020 0.980
#> SRR542375 1 0.855 0.659 0.720 0.280
#> SRR542376 1 0.753 0.577 0.784 0.216
#> SRR542377 1 0.753 0.577 0.784 0.216
#> SRR542378 1 0.680 0.617 0.820 0.180
#> SRR542379 1 0.730 0.592 0.796 0.204
#> SRR542380 1 0.680 0.617 0.820 0.180
#> SRR542381 1 0.876 0.659 0.704 0.296
#> SRR542382 1 0.644 0.628 0.836 0.164
#> SRR542383 1 0.680 0.617 0.820 0.180
#> SRR542384 1 0.925 0.682 0.660 0.340
#> SRR542385 1 0.955 0.634 0.624 0.376
#> SRR542386 1 0.936 0.657 0.648 0.352
#> SRR542387 1 0.973 0.646 0.596 0.404
#> SRR542388 1 0.978 0.584 0.588 0.412
#> SRR542389 2 0.900 0.464 0.316 0.684
#> SRR542390 1 0.973 0.593 0.596 0.404
#> SRR542391 1 0.978 0.584 0.588 0.412
#> SRR542392 1 0.936 0.657 0.648 0.352
#> SRR542393 2 0.876 0.509 0.296 0.704
#> SRR542394 1 0.969 0.645 0.604 0.396
#> SRR542395 1 0.975 0.645 0.592 0.408
#> SRR542396 1 0.949 0.668 0.632 0.368
#> SRR542397 1 0.973 0.593 0.596 0.404
#> SRR542398 1 0.881 0.684 0.700 0.300
#> SRR542399 1 0.634 0.604 0.840 0.160
#> SRR542400 1 0.634 0.604 0.840 0.160
#> SRR542401 1 0.634 0.604 0.840 0.160
#> SRR542402 1 0.634 0.604 0.840 0.160
#> SRR542403 1 0.634 0.604 0.840 0.160
#> SRR542404 1 0.634 0.604 0.840 0.160
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> SRR542346 3 0.1643 0.5029 0.044 0.000 0.956
#> SRR542347 3 0.1643 0.5029 0.044 0.000 0.956
#> SRR542348 3 0.1643 0.5029 0.044 0.000 0.956
#> SRR542349 3 0.1643 0.5029 0.044 0.000 0.956
#> SRR542350 3 0.6180 0.3734 0.000 0.416 0.584
#> SRR542351 3 0.5058 0.6274 0.000 0.244 0.756
#> SRR542352 2 0.5058 0.5308 0.000 0.756 0.244
#> SRR542353 3 0.6079 0.4310 0.000 0.388 0.612
#> SRR542354 3 0.5098 0.6251 0.000 0.248 0.752
#> SRR542355 3 0.6973 0.3519 0.020 0.416 0.564
#> SRR542356 3 0.5363 0.5938 0.000 0.276 0.724
#> SRR542357 2 0.5785 0.3714 0.000 0.668 0.332
#> SRR542358 2 0.5254 0.4844 0.000 0.736 0.264
#> SRR542359 3 0.5058 0.6274 0.000 0.244 0.756
#> SRR542360 3 0.4033 0.5567 0.008 0.136 0.856
#> SRR542361 3 0.9702 -0.2224 0.220 0.364 0.416
#> SRR542362 3 0.9639 -0.1824 0.220 0.332 0.448
#> SRR542363 3 0.8304 0.1726 0.144 0.232 0.624
#> SRR542364 2 0.3500 0.7616 0.004 0.880 0.116
#> SRR542365 2 0.0892 0.8092 0.000 0.980 0.020
#> SRR542366 2 0.2590 0.7891 0.004 0.924 0.072
#> SRR542367 2 0.1129 0.8112 0.004 0.976 0.020
#> SRR542368 2 0.2356 0.7851 0.000 0.928 0.072
#> SRR542369 2 0.2356 0.7851 0.000 0.928 0.072
#> SRR542370 2 0.2066 0.7930 0.000 0.940 0.060
#> SRR542371 2 0.3406 0.7697 0.068 0.904 0.028
#> SRR542372 2 0.1129 0.8112 0.004 0.976 0.020
#> SRR542373 2 0.5253 0.6763 0.020 0.792 0.188
#> SRR542374 3 0.5058 0.6274 0.000 0.244 0.756
#> SRR542375 2 0.9855 -0.3579 0.364 0.384 0.252
#> SRR542376 1 0.9776 0.4653 0.388 0.232 0.380
#> SRR542377 1 0.9775 0.4710 0.392 0.232 0.376
#> SRR542378 1 0.9833 0.5000 0.412 0.256 0.332
#> SRR542379 1 0.9820 0.4858 0.396 0.244 0.360
#> SRR542380 1 0.9833 0.5000 0.412 0.256 0.332
#> SRR542381 2 0.9241 -0.0832 0.352 0.484 0.164
#> SRR542382 1 0.9842 0.4974 0.412 0.260 0.328
#> SRR542383 1 0.9833 0.5000 0.412 0.256 0.332
#> SRR542384 2 0.7514 0.3409 0.328 0.616 0.056
#> SRR542385 2 0.0747 0.8072 0.016 0.984 0.000
#> SRR542386 2 0.1031 0.8045 0.024 0.976 0.000
#> SRR542387 2 0.3112 0.7843 0.056 0.916 0.028
#> SRR542388 2 0.1315 0.8101 0.008 0.972 0.020
#> SRR542389 2 0.2280 0.8007 0.008 0.940 0.052
#> SRR542390 2 0.0661 0.8099 0.008 0.988 0.004
#> SRR542391 2 0.1315 0.8101 0.008 0.972 0.020
#> SRR542392 2 0.1031 0.8045 0.024 0.976 0.000
#> SRR542393 2 0.2066 0.7930 0.000 0.940 0.060
#> SRR542394 2 0.3310 0.7807 0.064 0.908 0.028
#> SRR542395 2 0.3434 0.7779 0.064 0.904 0.032
#> SRR542396 2 0.4892 0.7207 0.112 0.840 0.048
#> SRR542397 2 0.0661 0.8099 0.008 0.988 0.004
#> SRR542398 2 0.6355 0.4225 0.280 0.696 0.024
#> SRR542399 1 0.3377 0.5383 0.896 0.092 0.012
#> SRR542400 1 0.3377 0.5383 0.896 0.092 0.012
#> SRR542401 1 0.3377 0.5383 0.896 0.092 0.012
#> SRR542402 1 0.3377 0.5383 0.896 0.092 0.012
#> SRR542403 1 0.3377 0.5383 0.896 0.092 0.012
#> SRR542404 1 0.3377 0.5383 0.896 0.092 0.012
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> SRR542346 3 0.4540 0.647 0.008 0.004 0.740 0.248
#> SRR542347 3 0.4540 0.647 0.008 0.004 0.740 0.248
#> SRR542348 3 0.4540 0.647 0.008 0.004 0.740 0.248
#> SRR542349 3 0.4631 0.634 0.008 0.004 0.728 0.260
#> SRR542350 3 0.4252 0.686 0.004 0.252 0.744 0.000
#> SRR542351 3 0.2408 0.775 0.000 0.104 0.896 0.000
#> SRR542352 2 0.3208 0.707 0.004 0.848 0.148 0.000
#> SRR542353 3 0.4188 0.694 0.004 0.244 0.752 0.000
#> SRR542354 3 0.2408 0.775 0.000 0.104 0.896 0.000
#> SRR542355 3 0.7429 0.346 0.004 0.280 0.528 0.188
#> SRR542356 3 0.2469 0.773 0.000 0.108 0.892 0.000
#> SRR542357 2 0.4462 0.599 0.004 0.736 0.256 0.004
#> SRR542358 2 0.3306 0.697 0.004 0.840 0.156 0.000
#> SRR542359 3 0.2408 0.775 0.000 0.104 0.896 0.000
#> SRR542360 3 0.3211 0.731 0.008 0.024 0.884 0.084
#> SRR542361 4 0.3375 0.724 0.016 0.016 0.092 0.876
#> SRR542362 4 0.3319 0.720 0.016 0.012 0.096 0.876
#> SRR542363 4 0.3627 0.671 0.008 0.008 0.144 0.840
#> SRR542364 2 0.3378 0.799 0.012 0.884 0.060 0.044
#> SRR542365 2 0.1732 0.820 0.004 0.948 0.008 0.040
#> SRR542366 2 0.2573 0.815 0.012 0.920 0.024 0.044
#> SRR542367 2 0.2748 0.819 0.004 0.904 0.020 0.072
#> SRR542368 2 0.1985 0.817 0.004 0.940 0.016 0.040
#> SRR542369 2 0.1985 0.817 0.004 0.940 0.016 0.040
#> SRR542370 2 0.1985 0.817 0.004 0.940 0.016 0.040
#> SRR542371 2 0.6709 0.187 0.004 0.492 0.076 0.428
#> SRR542372 2 0.2748 0.819 0.004 0.904 0.020 0.072
#> SRR542373 2 0.5509 0.658 0.012 0.724 0.216 0.048
#> SRR542374 3 0.2408 0.775 0.000 0.104 0.896 0.000
#> SRR542375 4 0.6229 0.674 0.040 0.168 0.076 0.716
#> SRR542376 4 0.3538 0.754 0.044 0.004 0.084 0.868
#> SRR542377 4 0.3538 0.754 0.044 0.004 0.084 0.868
#> SRR542378 4 0.1767 0.783 0.044 0.012 0.000 0.944
#> SRR542379 4 0.3025 0.767 0.044 0.004 0.056 0.896
#> SRR542380 4 0.1767 0.783 0.044 0.012 0.000 0.944
#> SRR542381 4 0.6270 0.670 0.040 0.172 0.076 0.712
#> SRR542382 4 0.2473 0.780 0.044 0.016 0.016 0.924
#> SRR542383 4 0.1767 0.783 0.044 0.012 0.000 0.944
#> SRR542384 4 0.6965 0.552 0.040 0.256 0.076 0.628
#> SRR542385 2 0.2011 0.802 0.000 0.920 0.000 0.080
#> SRR542386 2 0.2412 0.796 0.000 0.908 0.008 0.084
#> SRR542387 2 0.6499 0.192 0.000 0.524 0.076 0.400
#> SRR542388 2 0.0672 0.821 0.000 0.984 0.008 0.008
#> SRR542389 2 0.0844 0.819 0.004 0.980 0.012 0.004
#> SRR542390 2 0.2124 0.811 0.000 0.924 0.008 0.068
#> SRR542391 2 0.0859 0.821 0.004 0.980 0.008 0.008
#> SRR542392 2 0.2412 0.796 0.000 0.908 0.008 0.084
#> SRR542393 2 0.0779 0.817 0.004 0.980 0.016 0.000
#> SRR542394 2 0.6315 0.223 0.000 0.540 0.064 0.396
#> SRR542395 2 0.6499 0.192 0.000 0.524 0.076 0.400
#> SRR542396 4 0.6968 0.451 0.032 0.308 0.068 0.592
#> SRR542397 2 0.1902 0.812 0.000 0.932 0.004 0.064
#> SRR542398 4 0.6397 0.422 0.040 0.352 0.020 0.588
#> SRR542399 1 0.0672 0.997 0.984 0.008 0.000 0.008
#> SRR542400 1 0.1139 0.994 0.972 0.008 0.008 0.012
#> SRR542401 1 0.0672 0.997 0.984 0.008 0.000 0.008
#> SRR542402 1 0.0672 0.997 0.984 0.008 0.000 0.008
#> SRR542403 1 0.1139 0.994 0.972 0.008 0.008 0.012
#> SRR542404 1 0.0672 0.997 0.984 0.008 0.000 0.008
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> SRR542346 3 0.0162 0.30146 0.004 0.000 0.996 0.000 0.000
#> SRR542347 3 0.1282 0.31953 0.004 0.000 0.952 0.044 0.000
#> SRR542348 3 0.0162 0.30146 0.004 0.000 0.996 0.000 0.000
#> SRR542349 3 0.1571 0.32199 0.004 0.000 0.936 0.060 0.000
#> SRR542350 4 0.6736 0.54383 0.000 0.260 0.344 0.396 0.000
#> SRR542351 3 0.4645 -0.15345 0.000 0.008 0.564 0.424 0.004
#> SRR542352 2 0.2890 0.61550 0.000 0.836 0.004 0.160 0.000
#> SRR542353 4 0.6646 0.52430 0.000 0.224 0.380 0.396 0.000
#> SRR542354 3 0.4680 -0.17780 0.000 0.008 0.540 0.448 0.004
#> SRR542355 4 0.8058 0.19152 0.000 0.124 0.176 0.380 0.320
#> SRR542356 3 0.4680 -0.17780 0.000 0.008 0.540 0.448 0.004
#> SRR542357 2 0.5292 0.15715 0.000 0.508 0.008 0.452 0.032
#> SRR542358 2 0.3006 0.61494 0.000 0.836 0.004 0.156 0.004
#> SRR542359 3 0.4645 -0.15345 0.000 0.008 0.564 0.424 0.004
#> SRR542360 3 0.5445 0.02615 0.000 0.008 0.616 0.312 0.064
#> SRR542361 3 0.6692 0.21437 0.004 0.000 0.408 0.388 0.200
#> SRR542362 3 0.6692 0.21437 0.004 0.000 0.408 0.388 0.200
#> SRR542363 3 0.6447 0.25046 0.004 0.000 0.456 0.384 0.156
#> SRR542364 2 0.5413 0.67654 0.000 0.664 0.000 0.168 0.168
#> SRR542365 2 0.3657 0.74469 0.000 0.820 0.000 0.116 0.064
#> SRR542366 2 0.5159 0.69536 0.000 0.692 0.000 0.164 0.144
#> SRR542367 2 0.5379 0.68025 0.000 0.668 0.000 0.164 0.168
#> SRR542368 2 0.3840 0.74438 0.000 0.808 0.000 0.116 0.076
#> SRR542369 2 0.2563 0.74375 0.000 0.872 0.000 0.120 0.008
#> SRR542370 2 0.3719 0.74417 0.000 0.816 0.000 0.116 0.068
#> SRR542371 5 0.5964 0.37305 0.000 0.232 0.000 0.180 0.588
#> SRR542372 2 0.5379 0.68025 0.000 0.668 0.000 0.164 0.168
#> SRR542373 2 0.6499 0.42272 0.000 0.488 0.008 0.348 0.156
#> SRR542374 3 0.4645 -0.15345 0.000 0.008 0.564 0.424 0.004
#> SRR542375 5 0.1478 0.63667 0.000 0.000 0.000 0.064 0.936
#> SRR542376 3 0.6935 0.05361 0.004 0.000 0.364 0.292 0.340
#> SRR542377 3 0.6935 0.05361 0.004 0.000 0.364 0.292 0.340
#> SRR542378 5 0.5118 0.49247 0.004 0.000 0.156 0.132 0.708
#> SRR542379 5 0.6846 0.00842 0.004 0.000 0.280 0.292 0.424
#> SRR542380 5 0.5118 0.49247 0.004 0.000 0.156 0.132 0.708
#> SRR542381 5 0.1478 0.63667 0.000 0.000 0.000 0.064 0.936
#> SRR542382 5 0.2756 0.61785 0.004 0.000 0.024 0.092 0.880
#> SRR542383 5 0.5118 0.49247 0.004 0.000 0.156 0.132 0.708
#> SRR542384 5 0.2361 0.63345 0.000 0.096 0.000 0.012 0.892
#> SRR542385 2 0.1364 0.74184 0.000 0.952 0.000 0.012 0.036
#> SRR542386 2 0.3689 0.67054 0.000 0.740 0.000 0.004 0.256
#> SRR542387 5 0.4755 0.51865 0.000 0.244 0.000 0.060 0.696
#> SRR542388 2 0.1430 0.74689 0.000 0.944 0.000 0.004 0.052
#> SRR542389 2 0.2769 0.68947 0.000 0.876 0.000 0.092 0.032
#> SRR542390 2 0.1364 0.74184 0.000 0.952 0.000 0.012 0.036
#> SRR542391 2 0.2221 0.72051 0.000 0.912 0.000 0.052 0.036
#> SRR542392 2 0.3689 0.67054 0.000 0.740 0.000 0.004 0.256
#> SRR542393 2 0.1877 0.71536 0.000 0.924 0.000 0.064 0.012
#> SRR542394 5 0.4706 0.49473 0.000 0.256 0.000 0.052 0.692
#> SRR542395 5 0.4795 0.54698 0.000 0.224 0.000 0.072 0.704
#> SRR542396 5 0.2719 0.62008 0.000 0.144 0.000 0.004 0.852
#> SRR542397 2 0.1168 0.74418 0.000 0.960 0.000 0.008 0.032
#> SRR542398 5 0.3687 0.60081 0.000 0.180 0.000 0.028 0.792
#> SRR542399 1 0.0000 0.99125 1.000 0.000 0.000 0.000 0.000
#> SRR542400 1 0.0794 0.98242 0.972 0.000 0.000 0.028 0.000
#> SRR542401 1 0.0000 0.99125 1.000 0.000 0.000 0.000 0.000
#> SRR542402 1 0.0000 0.99125 1.000 0.000 0.000 0.000 0.000
#> SRR542403 1 0.0794 0.98242 0.972 0.000 0.000 0.028 0.000
#> SRR542404 1 0.0000 0.99125 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
#> SRR542346 3 0.4992 -0.0166 0.000 0.000 0.472 0.460 0.000 0.068
#> SRR542347 4 0.4946 0.0185 0.000 0.000 0.404 0.528 0.000 0.068
#> SRR542348 3 0.4992 -0.0166 0.000 0.000 0.472 0.460 0.000 0.068
#> SRR542349 4 0.4919 0.0611 0.000 0.000 0.388 0.544 0.000 0.068
#> SRR542350 3 0.4234 0.3912 0.000 0.388 0.596 0.008 0.004 0.004
#> SRR542351 3 0.0146 0.6827 0.000 0.000 0.996 0.004 0.000 0.000
#> SRR542352 2 0.1965 0.6041 0.000 0.924 0.040 0.008 0.004 0.024
#> SRR542353 3 0.4214 0.4064 0.000 0.380 0.604 0.008 0.004 0.004
#> SRR542354 3 0.1944 0.6730 0.000 0.024 0.924 0.000 0.016 0.036
#> SRR542355 2 0.7712 -0.0628 0.000 0.340 0.292 0.008 0.172 0.188
#> SRR542356 3 0.1251 0.6769 0.000 0.024 0.956 0.000 0.012 0.008
#> SRR542357 2 0.6804 0.2390 0.000 0.492 0.192 0.008 0.060 0.248
#> SRR542358 2 0.1901 0.6083 0.000 0.924 0.040 0.008 0.000 0.028
#> SRR542359 3 0.0146 0.6827 0.000 0.000 0.996 0.004 0.000 0.000
#> SRR542360 3 0.6305 0.3118 0.000 0.000 0.544 0.252 0.064 0.140
#> SRR542361 4 0.1391 0.7077 0.000 0.000 0.000 0.944 0.016 0.040
#> SRR542362 4 0.1391 0.7077 0.000 0.000 0.000 0.944 0.016 0.040
#> SRR542363 4 0.1285 0.6884 0.000 0.000 0.004 0.944 0.000 0.052
#> SRR542364 6 0.3771 0.7585 0.000 0.164 0.020 0.000 0.032 0.784
#> SRR542365 6 0.3351 0.7424 0.000 0.288 0.000 0.000 0.000 0.712
#> SRR542366 6 0.3052 0.7798 0.000 0.216 0.000 0.000 0.004 0.780
#> SRR542367 6 0.3231 0.7798 0.000 0.200 0.000 0.000 0.016 0.784
#> SRR542368 6 0.3490 0.7475 0.000 0.268 0.000 0.000 0.008 0.724
#> SRR542369 6 0.3499 0.7010 0.000 0.320 0.000 0.000 0.000 0.680
#> SRR542370 6 0.3309 0.7517 0.000 0.280 0.000 0.000 0.000 0.720
#> SRR542371 6 0.4228 0.0487 0.000 0.020 0.000 0.000 0.392 0.588
#> SRR542372 6 0.3284 0.7768 0.000 0.196 0.000 0.000 0.020 0.784
#> SRR542373 6 0.5449 0.5290 0.000 0.088 0.160 0.000 0.080 0.672
#> SRR542374 3 0.0146 0.6827 0.000 0.000 0.996 0.004 0.000 0.000
#> SRR542375 5 0.2633 0.7143 0.000 0.000 0.000 0.104 0.864 0.032
#> SRR542376 4 0.2988 0.6672 0.000 0.000 0.000 0.828 0.144 0.028
#> SRR542377 4 0.2911 0.6689 0.000 0.000 0.000 0.832 0.144 0.024
#> SRR542378 5 0.3950 0.5504 0.000 0.000 0.000 0.276 0.696 0.028
#> SRR542379 4 0.3720 0.5313 0.000 0.000 0.000 0.736 0.236 0.028
#> SRR542380 5 0.3950 0.5504 0.000 0.000 0.000 0.276 0.696 0.028
#> SRR542381 5 0.2633 0.7143 0.000 0.000 0.000 0.104 0.864 0.032
#> SRR542382 5 0.2988 0.6720 0.000 0.000 0.000 0.144 0.828 0.028
#> SRR542383 5 0.3950 0.5504 0.000 0.000 0.000 0.276 0.696 0.028
#> SRR542384 5 0.2518 0.7229 0.000 0.016 0.004 0.020 0.892 0.068
#> SRR542385 2 0.3439 0.6489 0.000 0.808 0.000 0.000 0.072 0.120
#> SRR542386 2 0.5943 0.2007 0.000 0.456 0.000 0.000 0.252 0.292
#> SRR542387 5 0.5307 0.5045 0.000 0.136 0.008 0.000 0.616 0.240
#> SRR542388 2 0.3874 0.6012 0.000 0.760 0.000 0.000 0.068 0.172
#> SRR542389 2 0.0508 0.6448 0.000 0.984 0.000 0.000 0.012 0.004
#> SRR542390 2 0.3227 0.6492 0.000 0.824 0.000 0.000 0.060 0.116
#> SRR542391 2 0.2308 0.6613 0.000 0.892 0.000 0.000 0.040 0.068
#> SRR542392 2 0.5943 0.2007 0.000 0.456 0.000 0.000 0.252 0.292
#> SRR542393 2 0.2489 0.6390 0.000 0.860 0.000 0.000 0.012 0.128
#> SRR542394 5 0.5202 0.4882 0.000 0.140 0.000 0.000 0.600 0.260
#> SRR542395 5 0.5480 0.4727 0.000 0.192 0.012 0.000 0.612 0.184
#> SRR542396 5 0.3377 0.7124 0.000 0.036 0.004 0.020 0.836 0.104
#> SRR542397 2 0.3270 0.6470 0.000 0.820 0.000 0.000 0.060 0.120
#> SRR542398 5 0.3264 0.7079 0.000 0.056 0.000 0.020 0.844 0.080
#> SRR542399 1 0.0000 0.9839 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR542400 1 0.1546 0.9675 0.944 0.000 0.000 0.016 0.020 0.020
#> SRR542401 1 0.0000 0.9839 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR542402 1 0.0000 0.9839 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR542403 1 0.1546 0.9675 0.944 0.000 0.000 0.016 0.020 0.020
#> SRR542404 1 0.0000 0.9839 1.000 0.000 0.000 0.000 0.000 0.000
Heatmaps for the consensus matrix. It visualizes the probability of two samples to be in a same group.
consensus_heatmap(res, k = 2)
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 16804 rows and 59 columns.
#> Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'MAD' method.
#> Subgroups are detected by 'skmeans' method.
#> Performed in total 1250 partitions by row resampling.
#> Best k for subgroups seems to be 3.
#>
#> Following methods can be applied to this 'ConsensusPartition' object:
#> [1] "cola_report" "collect_classes" "collect_plots"
#> [4] "collect_stats" "colnames" "compare_signatures"
#> [7] "consensus_heatmap" "dimension_reduction" "functional_enrichment"
#> [10] "get_anno_col" "get_anno" "get_classes"
#> [13] "get_consensus" "get_matrix" "get_membership"
#> [16] "get_param" "get_signatures" "get_stats"
#> [19] "is_best_k" "is_stable_k" "membership_heatmap"
#> [22] "ncol" "nrow" "plot_ecdf"
#> [25] "rownames" "select_partition_number" "show"
#> [28] "suggest_best_k" "test_to_known_factors"
collect_plots()
function collects all the plots made from res
for all k
(number of partitions)
into one single page to provide an easy and fast comparison between different k
.
collect_plots(res)
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.574 0.736 0.868 0.5063 0.492 0.492
#> 3 3 0.705 0.828 0.904 0.3187 0.705 0.469
#> 4 4 0.751 0.825 0.919 0.1144 0.845 0.575
#> 5 5 0.710 0.691 0.828 0.0712 0.942 0.775
#> 6 6 0.760 0.722 0.850 0.0475 0.905 0.597
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
#> SRR542346 2 0.9686 0.512 0.396 0.604
#> SRR542347 2 0.9686 0.512 0.396 0.604
#> SRR542348 2 0.9686 0.512 0.396 0.604
#> SRR542349 2 0.9686 0.512 0.396 0.604
#> SRR542350 2 0.0000 0.849 0.000 1.000
#> SRR542351 2 0.1633 0.843 0.024 0.976
#> SRR542352 2 0.0000 0.849 0.000 1.000
#> SRR542353 2 0.0000 0.849 0.000 1.000
#> SRR542354 2 0.0938 0.847 0.012 0.988
#> SRR542355 2 0.2423 0.834 0.040 0.960
#> SRR542356 2 0.0672 0.847 0.008 0.992
#> SRR542357 2 0.0672 0.847 0.008 0.992
#> SRR542358 2 0.0000 0.849 0.000 1.000
#> SRR542359 2 0.1843 0.841 0.028 0.972
#> SRR542360 2 0.9552 0.532 0.376 0.624
#> SRR542361 2 0.9754 0.494 0.408 0.592
#> SRR542362 2 0.9754 0.494 0.408 0.592
#> SRR542363 2 0.9686 0.512 0.396 0.604
#> SRR542364 2 0.0000 0.849 0.000 1.000
#> SRR542365 2 0.0000 0.849 0.000 1.000
#> SRR542366 2 0.0000 0.849 0.000 1.000
#> SRR542367 2 0.0000 0.849 0.000 1.000
#> SRR542368 2 0.0000 0.849 0.000 1.000
#> SRR542369 2 0.0000 0.849 0.000 1.000
#> SRR542370 2 0.0000 0.849 0.000 1.000
#> SRR542371 1 0.9661 0.580 0.608 0.392
#> SRR542372 2 0.0000 0.849 0.000 1.000
#> SRR542373 2 0.0672 0.847 0.008 0.992
#> SRR542374 2 0.1633 0.843 0.024 0.976
#> SRR542375 1 0.0000 0.795 1.000 0.000
#> SRR542376 1 0.0000 0.795 1.000 0.000
#> SRR542377 1 0.0000 0.795 1.000 0.000
#> SRR542378 1 0.0000 0.795 1.000 0.000
#> SRR542379 1 0.0000 0.795 1.000 0.000
#> SRR542380 1 0.0000 0.795 1.000 0.000
#> SRR542381 1 0.0376 0.796 0.996 0.004
#> SRR542382 1 0.0000 0.795 1.000 0.000
#> SRR542383 1 0.0000 0.795 1.000 0.000
#> SRR542384 1 0.0376 0.796 0.996 0.004
#> SRR542385 1 0.9686 0.584 0.604 0.396
#> SRR542386 1 0.9686 0.584 0.604 0.396
#> SRR542387 1 0.9608 0.588 0.616 0.384
#> SRR542388 1 0.9754 0.569 0.592 0.408
#> SRR542389 2 0.0376 0.846 0.004 0.996
#> SRR542390 1 0.9754 0.569 0.592 0.408
#> SRR542391 1 0.9754 0.569 0.592 0.408
#> SRR542392 1 0.9686 0.584 0.604 0.396
#> SRR542393 2 0.0000 0.849 0.000 1.000
#> SRR542394 1 0.9686 0.584 0.604 0.396
#> SRR542395 1 0.9580 0.591 0.620 0.380
#> SRR542396 1 0.1843 0.791 0.972 0.028
#> SRR542397 1 0.9754 0.569 0.592 0.408
#> SRR542398 1 0.1843 0.791 0.972 0.028
#> SRR542399 1 0.0672 0.796 0.992 0.008
#> SRR542400 1 0.0672 0.796 0.992 0.008
#> SRR542401 1 0.0672 0.796 0.992 0.008
#> SRR542402 1 0.0672 0.796 0.992 0.008
#> SRR542403 1 0.0672 0.796 0.992 0.008
#> SRR542404 1 0.0672 0.796 0.992 0.008
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> SRR542346 3 0.0000 0.870 0.000 0.000 1.000
#> SRR542347 3 0.0000 0.870 0.000 0.000 1.000
#> SRR542348 3 0.0000 0.870 0.000 0.000 1.000
#> SRR542349 3 0.0000 0.870 0.000 0.000 1.000
#> SRR542350 3 0.5988 0.515 0.000 0.368 0.632
#> SRR542351 3 0.2165 0.872 0.000 0.064 0.936
#> SRR542352 2 0.0747 0.926 0.000 0.984 0.016
#> SRR542353 3 0.5905 0.547 0.000 0.352 0.648
#> SRR542354 3 0.2537 0.864 0.000 0.080 0.920
#> SRR542355 3 0.1529 0.874 0.000 0.040 0.960
#> SRR542356 3 0.4178 0.790 0.000 0.172 0.828
#> SRR542357 3 0.5650 0.617 0.000 0.312 0.688
#> SRR542358 2 0.0424 0.932 0.000 0.992 0.008
#> SRR542359 3 0.4291 0.790 0.152 0.008 0.840
#> SRR542360 3 0.0000 0.870 0.000 0.000 1.000
#> SRR542361 3 0.2066 0.828 0.060 0.000 0.940
#> SRR542362 3 0.1753 0.839 0.048 0.000 0.952
#> SRR542363 3 0.0592 0.864 0.012 0.000 0.988
#> SRR542364 2 0.0747 0.926 0.000 0.984 0.016
#> SRR542365 2 0.0424 0.932 0.000 0.992 0.008
#> SRR542366 2 0.0424 0.932 0.000 0.992 0.008
#> SRR542367 2 0.0475 0.932 0.004 0.992 0.004
#> SRR542368 2 0.4121 0.780 0.168 0.832 0.000
#> SRR542369 2 0.0424 0.932 0.000 0.992 0.008
#> SRR542370 2 0.0424 0.932 0.000 0.992 0.008
#> SRR542371 2 0.0747 0.925 0.016 0.984 0.000
#> SRR542372 2 0.0475 0.932 0.004 0.992 0.004
#> SRR542373 3 0.2066 0.873 0.000 0.060 0.940
#> SRR542374 3 0.2165 0.872 0.000 0.064 0.936
#> SRR542375 1 0.4062 0.857 0.836 0.000 0.164
#> SRR542376 1 0.5948 0.642 0.640 0.000 0.360
#> SRR542377 1 0.5785 0.686 0.668 0.000 0.332
#> SRR542378 1 0.4178 0.855 0.828 0.000 0.172
#> SRR542379 1 0.4178 0.855 0.828 0.000 0.172
#> SRR542380 1 0.4178 0.855 0.828 0.000 0.172
#> SRR542381 1 0.4062 0.857 0.836 0.000 0.164
#> SRR542382 1 0.4062 0.857 0.836 0.000 0.164
#> SRR542383 1 0.4178 0.855 0.828 0.000 0.172
#> SRR542384 1 0.2356 0.866 0.928 0.000 0.072
#> SRR542385 2 0.0237 0.931 0.004 0.996 0.000
#> SRR542386 2 0.2796 0.867 0.092 0.908 0.000
#> SRR542387 1 0.5480 0.643 0.732 0.264 0.004
#> SRR542388 2 0.1031 0.915 0.024 0.976 0.000
#> SRR542389 2 0.0000 0.931 0.000 1.000 0.000
#> SRR542390 2 0.0237 0.931 0.004 0.996 0.000
#> SRR542391 2 0.0000 0.931 0.000 1.000 0.000
#> SRR542392 2 0.6235 0.216 0.436 0.564 0.000
#> SRR542393 2 0.0424 0.932 0.000 0.992 0.008
#> SRR542394 2 0.6026 0.371 0.376 0.624 0.000
#> SRR542395 1 0.5327 0.630 0.728 0.272 0.000
#> SRR542396 1 0.2050 0.862 0.952 0.028 0.020
#> SRR542397 2 0.0237 0.931 0.004 0.996 0.000
#> SRR542398 1 0.0592 0.861 0.988 0.012 0.000
#> SRR542399 1 0.0747 0.860 0.984 0.016 0.000
#> SRR542400 1 0.0747 0.860 0.984 0.016 0.000
#> SRR542401 1 0.0747 0.860 0.984 0.016 0.000
#> SRR542402 1 0.0747 0.860 0.984 0.016 0.000
#> SRR542403 1 0.0747 0.860 0.984 0.016 0.000
#> SRR542404 1 0.0747 0.860 0.984 0.016 0.000
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> SRR542346 3 0.2760 0.8368 0.000 0.000 0.872 0.128
#> SRR542347 3 0.2760 0.8368 0.000 0.000 0.872 0.128
#> SRR542348 3 0.2760 0.8368 0.000 0.000 0.872 0.128
#> SRR542349 3 0.2868 0.8308 0.000 0.000 0.864 0.136
#> SRR542350 3 0.4008 0.6965 0.000 0.244 0.756 0.000
#> SRR542351 3 0.0000 0.8773 0.000 0.000 1.000 0.000
#> SRR542352 2 0.0336 0.9732 0.000 0.992 0.008 0.000
#> SRR542353 3 0.3873 0.7147 0.000 0.228 0.772 0.000
#> SRR542354 3 0.0188 0.8767 0.000 0.000 0.996 0.004
#> SRR542355 3 0.0188 0.8767 0.000 0.000 0.996 0.004
#> SRR542356 3 0.0188 0.8767 0.000 0.000 0.996 0.004
#> SRR542357 3 0.3448 0.7581 0.000 0.168 0.828 0.004
#> SRR542358 2 0.0336 0.9732 0.000 0.992 0.008 0.000
#> SRR542359 3 0.0592 0.8728 0.016 0.000 0.984 0.000
#> SRR542360 3 0.0336 0.8772 0.000 0.000 0.992 0.008
#> SRR542361 4 0.4051 0.6339 0.004 0.004 0.208 0.784
#> SRR542362 4 0.5308 -0.0399 0.004 0.004 0.452 0.540
#> SRR542363 3 0.5060 0.3803 0.000 0.004 0.584 0.412
#> SRR542364 2 0.1004 0.9566 0.004 0.972 0.024 0.000
#> SRR542365 2 0.0188 0.9749 0.004 0.996 0.000 0.000
#> SRR542366 2 0.0188 0.9749 0.004 0.996 0.000 0.000
#> SRR542367 2 0.0376 0.9735 0.004 0.992 0.000 0.004
#> SRR542368 1 0.1716 0.8577 0.936 0.064 0.000 0.000
#> SRR542369 2 0.0188 0.9749 0.004 0.996 0.000 0.000
#> SRR542370 2 0.0188 0.9749 0.004 0.996 0.000 0.000
#> SRR542371 4 0.5936 0.6257 0.004 0.232 0.080 0.684
#> SRR542372 2 0.0376 0.9735 0.004 0.992 0.000 0.004
#> SRR542373 3 0.0712 0.8744 0.004 0.008 0.984 0.004
#> SRR542374 3 0.0000 0.8773 0.000 0.000 1.000 0.000
#> SRR542375 4 0.0336 0.8472 0.000 0.000 0.008 0.992
#> SRR542376 4 0.0188 0.8489 0.000 0.000 0.004 0.996
#> SRR542377 4 0.0336 0.8475 0.000 0.000 0.008 0.992
#> SRR542378 4 0.0188 0.8489 0.000 0.000 0.004 0.996
#> SRR542379 4 0.0188 0.8489 0.000 0.000 0.004 0.996
#> SRR542380 4 0.0188 0.8489 0.000 0.000 0.004 0.996
#> SRR542381 4 0.0336 0.8472 0.000 0.000 0.008 0.992
#> SRR542382 4 0.0188 0.8489 0.000 0.000 0.004 0.996
#> SRR542383 4 0.0188 0.8489 0.000 0.000 0.004 0.996
#> SRR542384 4 0.1953 0.8229 0.044 0.004 0.012 0.940
#> SRR542385 2 0.0188 0.9751 0.004 0.996 0.000 0.000
#> SRR542386 2 0.3037 0.8739 0.036 0.888 0.000 0.076
#> SRR542387 4 0.4301 0.7577 0.000 0.064 0.120 0.816
#> SRR542388 2 0.3311 0.7942 0.172 0.828 0.000 0.000
#> SRR542389 2 0.0188 0.9751 0.004 0.996 0.000 0.000
#> SRR542390 2 0.0188 0.9751 0.004 0.996 0.000 0.000
#> SRR542391 2 0.0188 0.9751 0.004 0.996 0.000 0.000
#> SRR542392 1 0.3873 0.6586 0.772 0.228 0.000 0.000
#> SRR542393 2 0.0188 0.9745 0.000 0.996 0.004 0.000
#> SRR542394 4 0.4999 0.5332 0.000 0.328 0.012 0.660
#> SRR542395 4 0.5624 0.6750 0.000 0.172 0.108 0.720
#> SRR542396 4 0.3222 0.7902 0.036 0.076 0.004 0.884
#> SRR542397 2 0.0188 0.9751 0.004 0.996 0.000 0.000
#> SRR542398 1 0.4925 0.1859 0.572 0.000 0.000 0.428
#> SRR542399 1 0.0188 0.8977 0.996 0.000 0.000 0.004
#> SRR542400 1 0.0188 0.8977 0.996 0.000 0.000 0.004
#> SRR542401 1 0.0188 0.8977 0.996 0.000 0.000 0.004
#> SRR542402 1 0.0188 0.8977 0.996 0.000 0.000 0.004
#> SRR542403 1 0.0188 0.8977 0.996 0.000 0.000 0.004
#> SRR542404 1 0.0188 0.8977 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
#> SRR542346 3 0.4114 0.477 0.000 0.000 0.624 0.376 0.000
#> SRR542347 3 0.4192 0.430 0.000 0.000 0.596 0.404 0.000
#> SRR542348 3 0.4114 0.477 0.000 0.000 0.624 0.376 0.000
#> SRR542349 3 0.4235 0.390 0.000 0.000 0.576 0.424 0.000
#> SRR542350 3 0.4618 0.578 0.000 0.208 0.724 0.068 0.000
#> SRR542351 3 0.0000 0.770 0.000 0.000 1.000 0.000 0.000
#> SRR542352 2 0.5748 0.721 0.000 0.584 0.116 0.300 0.000
#> SRR542353 3 0.4272 0.617 0.000 0.196 0.752 0.052 0.000
#> SRR542354 3 0.0404 0.770 0.000 0.000 0.988 0.000 0.012
#> SRR542355 3 0.1082 0.765 0.000 0.000 0.964 0.008 0.028
#> SRR542356 3 0.0290 0.770 0.000 0.000 0.992 0.000 0.008
#> SRR542357 3 0.2082 0.752 0.000 0.032 0.928 0.016 0.024
#> SRR542358 2 0.5584 0.734 0.000 0.592 0.096 0.312 0.000
#> SRR542359 3 0.0000 0.770 0.000 0.000 1.000 0.000 0.000
#> SRR542360 3 0.1952 0.738 0.000 0.000 0.912 0.084 0.004
#> SRR542361 4 0.5534 0.727 0.000 0.200 0.024 0.684 0.092
#> SRR542362 4 0.5613 0.725 0.000 0.200 0.036 0.684 0.080
#> SRR542363 4 0.5904 0.654 0.000 0.116 0.144 0.684 0.056
#> SRR542364 2 0.3775 0.610 0.000 0.832 0.092 0.016 0.060
#> SRR542365 2 0.0000 0.731 0.000 1.000 0.000 0.000 0.000
#> SRR542366 2 0.1117 0.715 0.000 0.964 0.000 0.016 0.020
#> SRR542367 2 0.2233 0.678 0.000 0.904 0.000 0.016 0.080
#> SRR542368 1 0.4060 0.534 0.640 0.360 0.000 0.000 0.000
#> SRR542369 2 0.0404 0.735 0.000 0.988 0.000 0.012 0.000
#> SRR542370 2 0.0451 0.726 0.000 0.988 0.000 0.008 0.004
#> SRR542371 5 0.3789 0.569 0.000 0.212 0.000 0.020 0.768
#> SRR542372 2 0.2293 0.675 0.000 0.900 0.000 0.016 0.084
#> SRR542373 3 0.5787 0.386 0.000 0.320 0.596 0.024 0.060
#> SRR542374 3 0.0000 0.770 0.000 0.000 1.000 0.000 0.000
#> SRR542375 5 0.1012 0.782 0.000 0.000 0.012 0.020 0.968
#> SRR542376 4 0.3949 0.687 0.000 0.000 0.000 0.668 0.332
#> SRR542377 4 0.4084 0.691 0.000 0.000 0.004 0.668 0.328
#> SRR542378 5 0.3752 0.488 0.000 0.000 0.000 0.292 0.708
#> SRR542379 4 0.4015 0.659 0.000 0.000 0.000 0.652 0.348
#> SRR542380 5 0.3774 0.480 0.000 0.000 0.000 0.296 0.704
#> SRR542381 5 0.0693 0.784 0.000 0.000 0.008 0.012 0.980
#> SRR542382 5 0.2280 0.720 0.000 0.000 0.000 0.120 0.880
#> SRR542383 5 0.3752 0.488 0.000 0.000 0.000 0.292 0.708
#> SRR542384 5 0.0693 0.785 0.000 0.000 0.012 0.008 0.980
#> SRR542385 2 0.3969 0.783 0.000 0.692 0.000 0.304 0.004
#> SRR542386 2 0.6472 0.617 0.004 0.520 0.000 0.268 0.208
#> SRR542387 5 0.1836 0.770 0.000 0.008 0.016 0.040 0.936
#> SRR542388 2 0.6065 0.680 0.132 0.560 0.000 0.304 0.004
#> SRR542389 2 0.4162 0.781 0.000 0.680 0.004 0.312 0.004
#> SRR542390 2 0.3969 0.783 0.000 0.692 0.000 0.304 0.004
#> SRR542391 2 0.3990 0.782 0.000 0.688 0.000 0.308 0.004
#> SRR542392 1 0.6109 0.367 0.600 0.288 0.000 0.072 0.040
#> SRR542393 2 0.4280 0.780 0.000 0.676 0.008 0.312 0.004
#> SRR542394 5 0.2291 0.748 0.000 0.056 0.000 0.036 0.908
#> SRR542395 5 0.2321 0.758 0.000 0.008 0.024 0.056 0.912
#> SRR542396 5 0.1200 0.783 0.000 0.016 0.012 0.008 0.964
#> SRR542397 2 0.3969 0.783 0.000 0.692 0.000 0.304 0.004
#> SRR542398 5 0.3857 0.552 0.312 0.000 0.000 0.000 0.688
#> SRR542399 1 0.0000 0.877 1.000 0.000 0.000 0.000 0.000
#> SRR542400 1 0.0000 0.877 1.000 0.000 0.000 0.000 0.000
#> SRR542401 1 0.0000 0.877 1.000 0.000 0.000 0.000 0.000
#> SRR542402 1 0.0000 0.877 1.000 0.000 0.000 0.000 0.000
#> SRR542403 1 0.0000 0.877 1.000 0.000 0.000 0.000 0.000
#> SRR542404 1 0.0000 0.877 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
#> SRR542346 3 0.3937 0.2930 0.000 0.000 0.572 0.424 0.000 0.004
#> SRR542347 3 0.3996 0.1258 0.000 0.000 0.512 0.484 0.000 0.004
#> SRR542348 3 0.3930 0.3024 0.000 0.000 0.576 0.420 0.000 0.004
#> SRR542349 4 0.3991 -0.1900 0.000 0.000 0.472 0.524 0.000 0.004
#> SRR542350 3 0.3903 0.4965 0.000 0.304 0.680 0.012 0.000 0.004
#> SRR542351 3 0.0000 0.7505 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR542352 2 0.3093 0.7259 0.000 0.816 0.164 0.012 0.000 0.008
#> SRR542353 3 0.3746 0.5508 0.000 0.272 0.712 0.012 0.000 0.004
#> SRR542354 3 0.0692 0.7498 0.000 0.000 0.976 0.000 0.004 0.020
#> SRR542355 3 0.3204 0.7095 0.000 0.016 0.840 0.004 0.024 0.116
#> SRR542356 3 0.0603 0.7493 0.000 0.000 0.980 0.000 0.004 0.016
#> SRR542357 3 0.4433 0.6630 0.000 0.040 0.748 0.012 0.024 0.176
#> SRR542358 2 0.2408 0.7860 0.000 0.876 0.108 0.012 0.000 0.004
#> SRR542359 3 0.0000 0.7505 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR542360 3 0.3212 0.6305 0.000 0.000 0.800 0.180 0.016 0.004
#> SRR542361 4 0.0508 0.8627 0.000 0.000 0.004 0.984 0.000 0.012
#> SRR542362 4 0.0622 0.8617 0.000 0.000 0.008 0.980 0.000 0.012
#> SRR542363 4 0.0909 0.8532 0.000 0.000 0.020 0.968 0.000 0.012
#> SRR542364 6 0.3503 0.7843 0.000 0.048 0.064 0.004 0.044 0.840
#> SRR542365 6 0.3052 0.7372 0.000 0.216 0.000 0.004 0.000 0.780
#> SRR542366 6 0.2196 0.8008 0.000 0.108 0.000 0.004 0.004 0.884
#> SRR542367 6 0.1524 0.7981 0.000 0.060 0.000 0.000 0.008 0.932
#> SRR542368 6 0.4682 0.6325 0.224 0.092 0.000 0.004 0.000 0.680
#> SRR542369 6 0.2883 0.7493 0.000 0.212 0.000 0.000 0.000 0.788
#> SRR542370 6 0.2454 0.7807 0.000 0.160 0.000 0.000 0.000 0.840
#> SRR542371 6 0.3817 0.0114 0.000 0.000 0.000 0.000 0.432 0.568
#> SRR542372 6 0.1524 0.7987 0.000 0.060 0.000 0.000 0.008 0.932
#> SRR542373 6 0.4601 0.6331 0.000 0.000 0.232 0.008 0.072 0.688
#> SRR542374 3 0.0000 0.7505 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR542375 5 0.1349 0.8278 0.000 0.000 0.000 0.056 0.940 0.004
#> SRR542376 4 0.0713 0.8597 0.000 0.000 0.000 0.972 0.028 0.000
#> SRR542377 4 0.0547 0.8624 0.000 0.000 0.000 0.980 0.020 0.000
#> SRR542378 5 0.3464 0.6739 0.000 0.000 0.000 0.312 0.688 0.000
#> SRR542379 4 0.1610 0.7986 0.000 0.000 0.000 0.916 0.084 0.000
#> SRR542380 5 0.3515 0.6582 0.000 0.000 0.000 0.324 0.676 0.000
#> SRR542381 5 0.1367 0.8286 0.000 0.000 0.000 0.044 0.944 0.012
#> SRR542382 5 0.2416 0.7962 0.000 0.000 0.000 0.156 0.844 0.000
#> SRR542383 5 0.3499 0.6636 0.000 0.000 0.000 0.320 0.680 0.000
#> SRR542384 5 0.1168 0.8274 0.000 0.000 0.000 0.028 0.956 0.016
#> SRR542385 2 0.1261 0.8534 0.000 0.952 0.000 0.000 0.024 0.024
#> SRR542386 2 0.4750 0.6042 0.000 0.684 0.000 0.004 0.196 0.116
#> SRR542387 5 0.3147 0.7719 0.000 0.016 0.016 0.000 0.828 0.140
#> SRR542388 2 0.1819 0.8454 0.024 0.932 0.000 0.004 0.008 0.032
#> SRR542389 2 0.0260 0.8539 0.000 0.992 0.000 0.008 0.000 0.000
#> SRR542390 2 0.0820 0.8564 0.000 0.972 0.000 0.000 0.012 0.016
#> SRR542391 2 0.0508 0.8566 0.000 0.984 0.000 0.000 0.004 0.012
#> SRR542392 2 0.6441 0.2309 0.368 0.464 0.000 0.004 0.068 0.096
#> SRR542393 2 0.1053 0.8519 0.000 0.964 0.012 0.004 0.000 0.020
#> SRR542394 5 0.3136 0.7492 0.000 0.016 0.000 0.000 0.796 0.188
#> SRR542395 5 0.3395 0.7694 0.000 0.028 0.020 0.000 0.820 0.132
#> SRR542396 5 0.1257 0.8240 0.000 0.000 0.000 0.020 0.952 0.028
#> SRR542397 2 0.1074 0.8541 0.000 0.960 0.000 0.000 0.012 0.028
#> SRR542398 5 0.3245 0.7380 0.172 0.000 0.000 0.000 0.800 0.028
#> SRR542399 1 0.0000 1.0000 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR542400 1 0.0000 1.0000 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR542401 1 0.0000 1.0000 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR542402 1 0.0000 1.0000 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR542403 1 0.0000 1.0000 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR542404 1 0.0000 1.0000 1.000 0.000 0.000 0.000 0.000 0.000
Heatmaps for the consensus matrix. It visualizes the probability of two samples to be in a same group.
consensus_heatmap(res, k = 2)
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 16804 rows and 59 columns.
#> Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'MAD' method.
#> Subgroups are detected by 'pam' method.
#> Performed in total 1250 partitions by row resampling.
#> Best k for subgroups seems to be 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.260 0.452 0.808 0.3165 0.787 0.787
#> 3 3 0.497 0.700 0.847 0.7447 0.569 0.482
#> 4 4 0.781 0.836 0.923 0.2780 0.712 0.435
#> 5 5 0.704 0.653 0.850 0.1257 0.865 0.567
#> 6 6 0.769 0.729 0.827 0.0469 0.917 0.631
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
#> SRR542346 1 0.9866 0.9879 0.568 0.432
#> SRR542347 1 0.9866 0.9879 0.568 0.432
#> SRR542348 1 0.9866 0.9879 0.568 0.432
#> SRR542349 1 0.9866 0.9879 0.568 0.432
#> SRR542350 2 0.8144 0.0981 0.252 0.748
#> SRR542351 2 0.9522 -0.3672 0.372 0.628
#> SRR542352 2 0.4298 0.5431 0.088 0.912
#> SRR542353 2 0.9522 -0.3672 0.372 0.628
#> SRR542354 2 0.9522 -0.3672 0.372 0.628
#> SRR542355 1 0.9963 0.9232 0.536 0.464
#> SRR542356 2 0.9522 -0.3672 0.372 0.628
#> SRR542357 2 0.8144 0.0981 0.252 0.748
#> SRR542358 2 0.8081 0.1134 0.248 0.752
#> SRR542359 2 0.9522 -0.3672 0.372 0.628
#> SRR542360 1 0.9866 0.9879 0.568 0.432
#> SRR542361 2 0.7883 0.2877 0.236 0.764
#> SRR542362 2 0.7674 0.3233 0.224 0.776
#> SRR542363 1 0.9866 0.9879 0.568 0.432
#> SRR542364 2 0.0000 0.6530 0.000 1.000
#> SRR542365 2 0.0000 0.6530 0.000 1.000
#> SRR542366 2 0.0000 0.6530 0.000 1.000
#> SRR542367 2 0.0000 0.6530 0.000 1.000
#> SRR542368 2 0.4562 0.5287 0.096 0.904
#> SRR542369 2 0.0000 0.6530 0.000 1.000
#> SRR542370 2 0.0000 0.6530 0.000 1.000
#> SRR542371 2 0.0000 0.6530 0.000 1.000
#> SRR542372 2 0.0000 0.6530 0.000 1.000
#> SRR542373 2 0.6343 0.3916 0.160 0.840
#> SRR542374 2 0.9522 -0.3672 0.372 0.628
#> SRR542375 2 0.7139 0.3928 0.196 0.804
#> SRR542376 2 0.9000 -0.0522 0.316 0.684
#> SRR542377 2 0.7139 0.3928 0.196 0.804
#> SRR542378 2 0.7139 0.3928 0.196 0.804
#> SRR542379 2 0.7139 0.3928 0.196 0.804
#> SRR542380 2 0.7139 0.3928 0.196 0.804
#> SRR542381 2 0.7139 0.3928 0.196 0.804
#> SRR542382 2 0.7139 0.3928 0.196 0.804
#> SRR542383 2 0.7139 0.3928 0.196 0.804
#> SRR542384 2 0.0000 0.6530 0.000 1.000
#> SRR542385 2 0.0000 0.6530 0.000 1.000
#> SRR542386 2 0.0000 0.6530 0.000 1.000
#> SRR542387 2 0.0000 0.6530 0.000 1.000
#> SRR542388 2 0.0000 0.6530 0.000 1.000
#> SRR542389 2 0.0000 0.6530 0.000 1.000
#> SRR542390 2 0.0000 0.6530 0.000 1.000
#> SRR542391 2 0.0000 0.6530 0.000 1.000
#> SRR542392 2 0.0000 0.6530 0.000 1.000
#> SRR542393 2 0.0000 0.6530 0.000 1.000
#> SRR542394 2 0.0000 0.6530 0.000 1.000
#> SRR542395 2 0.0376 0.6499 0.004 0.996
#> SRR542396 2 0.0000 0.6530 0.000 1.000
#> SRR542397 2 0.0000 0.6530 0.000 1.000
#> SRR542398 2 0.0000 0.6530 0.000 1.000
#> SRR542399 2 0.9866 0.2551 0.432 0.568
#> SRR542400 2 0.9866 0.2551 0.432 0.568
#> SRR542401 2 0.9866 0.2551 0.432 0.568
#> SRR542402 2 0.9866 0.2551 0.432 0.568
#> SRR542403 2 0.9866 0.2551 0.432 0.568
#> SRR542404 2 0.9866 0.2551 0.432 0.568
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> SRR542346 3 0.5363 0.618 0 0.276 0.724
#> SRR542347 3 0.5363 0.618 0 0.276 0.724
#> SRR542348 3 0.5363 0.618 0 0.276 0.724
#> SRR542349 3 0.5363 0.618 0 0.276 0.724
#> SRR542350 3 0.4887 0.469 0 0.228 0.772
#> SRR542351 3 0.0424 0.703 0 0.008 0.992
#> SRR542352 2 0.6225 0.577 0 0.568 0.432
#> SRR542353 3 0.1643 0.683 0 0.044 0.956
#> SRR542354 3 0.0424 0.703 0 0.008 0.992
#> SRR542355 3 0.5178 0.641 0 0.256 0.744
#> SRR542356 3 0.0592 0.702 0 0.012 0.988
#> SRR542357 3 0.5016 0.464 0 0.240 0.760
#> SRR542358 3 0.4887 0.469 0 0.228 0.772
#> SRR542359 3 0.0424 0.703 0 0.008 0.992
#> SRR542360 3 0.5327 0.621 0 0.272 0.728
#> SRR542361 2 0.4555 0.380 0 0.800 0.200
#> SRR542362 2 0.4842 0.332 0 0.776 0.224
#> SRR542363 3 0.5397 0.618 0 0.280 0.720
#> SRR542364 2 0.5431 0.807 0 0.716 0.284
#> SRR542365 2 0.5363 0.813 0 0.724 0.276
#> SRR542366 2 0.5291 0.813 0 0.732 0.268
#> SRR542367 2 0.5291 0.813 0 0.732 0.268
#> SRR542368 3 0.6295 -0.332 0 0.472 0.528
#> SRR542369 2 0.5363 0.813 0 0.724 0.276
#> SRR542370 2 0.5363 0.813 0 0.724 0.276
#> SRR542371 2 0.5291 0.813 0 0.732 0.268
#> SRR542372 2 0.5291 0.813 0 0.732 0.268
#> SRR542373 3 0.5058 0.467 0 0.244 0.756
#> SRR542374 3 0.0424 0.703 0 0.008 0.992
#> SRR542375 2 0.0000 0.672 0 1.000 0.000
#> SRR542376 2 0.4887 0.323 0 0.772 0.228
#> SRR542377 2 0.4654 0.364 0 0.792 0.208
#> SRR542378 2 0.0000 0.672 0 1.000 0.000
#> SRR542379 2 0.0592 0.660 0 0.988 0.012
#> SRR542380 2 0.0000 0.672 0 1.000 0.000
#> SRR542381 2 0.0000 0.672 0 1.000 0.000
#> SRR542382 2 0.0000 0.672 0 1.000 0.000
#> SRR542383 2 0.0000 0.672 0 1.000 0.000
#> SRR542384 2 0.4002 0.777 0 0.840 0.160
#> SRR542385 2 0.5363 0.813 0 0.724 0.276
#> SRR542386 2 0.5291 0.813 0 0.732 0.268
#> SRR542387 2 0.5291 0.813 0 0.732 0.268
#> SRR542388 2 0.5363 0.813 0 0.724 0.276
#> SRR542389 2 0.5363 0.813 0 0.724 0.276
#> SRR542390 2 0.5363 0.813 0 0.724 0.276
#> SRR542391 2 0.5363 0.813 0 0.724 0.276
#> SRR542392 2 0.5291 0.813 0 0.732 0.268
#> SRR542393 2 0.5363 0.813 0 0.724 0.276
#> SRR542394 2 0.5291 0.813 0 0.732 0.268
#> SRR542395 2 0.4062 0.779 0 0.836 0.164
#> SRR542396 2 0.4121 0.781 0 0.832 0.168
#> SRR542397 2 0.5363 0.813 0 0.724 0.276
#> SRR542398 2 0.4555 0.794 0 0.800 0.200
#> SRR542399 1 0.0000 1.000 1 0.000 0.000
#> SRR542400 1 0.0000 1.000 1 0.000 0.000
#> SRR542401 1 0.0000 1.000 1 0.000 0.000
#> SRR542402 1 0.0000 1.000 1 0.000 0.000
#> SRR542403 1 0.0000 1.000 1 0.000 0.000
#> SRR542404 1 0.0000 1.000 1 0.000 0.000
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> SRR542346 3 0.3356 0.751 0 0.000 0.824 0.176
#> SRR542347 3 0.3528 0.742 0 0.000 0.808 0.192
#> SRR542348 3 0.2814 0.765 0 0.000 0.868 0.132
#> SRR542349 3 0.4250 0.647 0 0.000 0.724 0.276
#> SRR542350 3 0.4948 0.197 0 0.440 0.560 0.000
#> SRR542351 3 0.0000 0.785 0 0.000 1.000 0.000
#> SRR542352 2 0.1302 0.943 0 0.956 0.044 0.000
#> SRR542353 3 0.4730 0.393 0 0.364 0.636 0.000
#> SRR542354 3 0.0000 0.785 0 0.000 1.000 0.000
#> SRR542355 4 0.4139 0.740 0 0.040 0.144 0.816
#> SRR542356 3 0.0804 0.779 0 0.008 0.980 0.012
#> SRR542357 2 0.3217 0.857 0 0.860 0.128 0.012
#> SRR542358 2 0.1474 0.936 0 0.948 0.052 0.000
#> SRR542359 3 0.0000 0.785 0 0.000 1.000 0.000
#> SRR542360 3 0.3266 0.751 0 0.000 0.832 0.168
#> SRR542361 4 0.0188 0.842 0 0.000 0.004 0.996
#> SRR542362 4 0.6906 0.363 0 0.264 0.156 0.580
#> SRR542363 4 0.4999 0.388 0 0.012 0.328 0.660
#> SRR542364 2 0.0000 0.969 0 1.000 0.000 0.000
#> SRR542365 2 0.0000 0.969 0 1.000 0.000 0.000
#> SRR542366 2 0.0469 0.966 0 0.988 0.000 0.012
#> SRR542367 2 0.0657 0.964 0 0.984 0.004 0.012
#> SRR542368 2 0.1284 0.955 0 0.964 0.024 0.012
#> SRR542369 2 0.0000 0.969 0 1.000 0.000 0.000
#> SRR542370 2 0.0000 0.969 0 1.000 0.000 0.000
#> SRR542371 2 0.2522 0.912 0 0.908 0.076 0.016
#> SRR542372 2 0.0657 0.964 0 0.984 0.004 0.012
#> SRR542373 2 0.4121 0.780 0 0.796 0.184 0.020
#> SRR542374 3 0.0000 0.785 0 0.000 1.000 0.000
#> SRR542375 4 0.0376 0.843 0 0.004 0.004 0.992
#> SRR542376 4 0.0592 0.833 0 0.000 0.016 0.984
#> SRR542377 4 0.0188 0.842 0 0.000 0.004 0.996
#> SRR542378 4 0.0000 0.843 0 0.000 0.000 1.000
#> SRR542379 4 0.0000 0.843 0 0.000 0.000 1.000
#> SRR542380 4 0.0000 0.843 0 0.000 0.000 1.000
#> SRR542381 4 0.0657 0.842 0 0.012 0.004 0.984
#> SRR542382 4 0.0188 0.843 0 0.000 0.004 0.996
#> SRR542383 4 0.0000 0.843 0 0.000 0.000 1.000
#> SRR542384 4 0.2334 0.810 0 0.088 0.004 0.908
#> SRR542385 2 0.0000 0.969 0 1.000 0.000 0.000
#> SRR542386 2 0.0469 0.966 0 0.988 0.000 0.012
#> SRR542387 2 0.0895 0.960 0 0.976 0.004 0.020
#> SRR542388 2 0.0000 0.969 0 1.000 0.000 0.000
#> SRR542389 2 0.0000 0.969 0 1.000 0.000 0.000
#> SRR542390 2 0.0000 0.969 0 1.000 0.000 0.000
#> SRR542391 2 0.0000 0.969 0 1.000 0.000 0.000
#> SRR542392 2 0.0657 0.964 0 0.984 0.004 0.012
#> SRR542393 2 0.0000 0.969 0 1.000 0.000 0.000
#> SRR542394 4 0.5016 0.446 0 0.396 0.004 0.600
#> SRR542395 4 0.3945 0.717 0 0.216 0.004 0.780
#> SRR542396 4 0.3355 0.764 0 0.160 0.004 0.836
#> SRR542397 2 0.0000 0.969 0 1.000 0.000 0.000
#> SRR542398 4 0.3837 0.712 0 0.224 0.000 0.776
#> SRR542399 1 0.0000 1.000 1 0.000 0.000 0.000
#> SRR542400 1 0.0000 1.000 1 0.000 0.000 0.000
#> SRR542401 1 0.0000 1.000 1 0.000 0.000 0.000
#> SRR542402 1 0.0000 1.000 1 0.000 0.000 0.000
#> SRR542403 1 0.0000 1.000 1 0.000 0.000 0.000
#> SRR542404 1 0.0000 1.000 1 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
#> SRR542346 3 0.2583 0.88204 0 0.000 0.864 0.132 0.004
#> SRR542347 3 0.2719 0.87434 0 0.000 0.852 0.144 0.004
#> SRR542348 3 0.0955 0.91150 0 0.000 0.968 0.028 0.004
#> SRR542349 3 0.3010 0.84827 0 0.000 0.824 0.172 0.004
#> SRR542350 5 0.6024 0.08978 0 0.116 0.412 0.000 0.472
#> SRR542351 3 0.0000 0.91272 0 0.000 1.000 0.000 0.000
#> SRR542352 2 0.3039 0.68012 0 0.808 0.000 0.000 0.192
#> SRR542353 5 0.5680 0.05769 0 0.080 0.428 0.000 0.492
#> SRR542354 3 0.0000 0.91272 0 0.000 1.000 0.000 0.000
#> SRR542355 4 0.3106 0.76413 0 0.000 0.024 0.844 0.132
#> SRR542356 3 0.1386 0.87971 0 0.032 0.952 0.000 0.016
#> SRR542357 2 0.3527 0.68360 0 0.804 0.024 0.000 0.172
#> SRR542358 5 0.4278 -0.10761 0 0.452 0.000 0.000 0.548
#> SRR542359 3 0.0000 0.91272 0 0.000 1.000 0.000 0.000
#> SRR542360 3 0.2722 0.88092 0 0.004 0.868 0.120 0.008
#> SRR542361 4 0.0000 0.87878 0 0.000 0.000 1.000 0.000
#> SRR542362 4 0.6383 0.33836 0 0.264 0.196 0.536 0.004
#> SRR542363 4 0.4769 0.06566 0 0.012 0.440 0.544 0.004
#> SRR542364 2 0.2389 0.72531 0 0.880 0.004 0.000 0.116
#> SRR542365 2 0.1341 0.74294 0 0.944 0.000 0.000 0.056
#> SRR542366 2 0.2605 0.71222 0 0.852 0.000 0.000 0.148
#> SRR542367 2 0.0703 0.74580 0 0.976 0.000 0.000 0.024
#> SRR542368 2 0.0566 0.73641 0 0.984 0.004 0.000 0.012
#> SRR542369 2 0.2966 0.68482 0 0.816 0.000 0.000 0.184
#> SRR542370 2 0.0510 0.74355 0 0.984 0.000 0.000 0.016
#> SRR542371 2 0.0693 0.73628 0 0.980 0.012 0.000 0.008
#> SRR542372 2 0.0000 0.73699 0 1.000 0.000 0.000 0.000
#> SRR542373 2 0.2864 0.69481 0 0.872 0.104 0.012 0.012
#> SRR542374 3 0.0000 0.91272 0 0.000 1.000 0.000 0.000
#> SRR542375 4 0.0798 0.87080 0 0.016 0.000 0.976 0.008
#> SRR542376 4 0.0000 0.87878 0 0.000 0.000 1.000 0.000
#> SRR542377 4 0.0000 0.87878 0 0.000 0.000 1.000 0.000
#> SRR542378 4 0.0000 0.87878 0 0.000 0.000 1.000 0.000
#> SRR542379 4 0.0000 0.87878 0 0.000 0.000 1.000 0.000
#> SRR542380 4 0.0000 0.87878 0 0.000 0.000 1.000 0.000
#> SRR542381 4 0.0898 0.86853 0 0.020 0.000 0.972 0.008
#> SRR542382 4 0.0451 0.87532 0 0.004 0.000 0.988 0.008
#> SRR542383 4 0.0000 0.87878 0 0.000 0.000 1.000 0.000
#> SRR542384 4 0.2470 0.79194 0 0.104 0.000 0.884 0.012
#> SRR542385 5 0.0404 0.56014 0 0.012 0.000 0.000 0.988
#> SRR542386 2 0.4305 -0.11347 0 0.512 0.000 0.000 0.488
#> SRR542387 2 0.4451 -0.10683 0 0.504 0.000 0.004 0.492
#> SRR542388 5 0.3003 0.49559 0 0.188 0.000 0.000 0.812
#> SRR542389 5 0.4201 -0.00906 0 0.408 0.000 0.000 0.592
#> SRR542390 5 0.0609 0.55732 0 0.020 0.000 0.000 0.980
#> SRR542391 5 0.0404 0.56014 0 0.012 0.000 0.000 0.988
#> SRR542392 5 0.3876 0.38155 0 0.316 0.000 0.000 0.684
#> SRR542393 2 0.4306 -0.12777 0 0.508 0.000 0.000 0.492
#> SRR542394 5 0.6323 0.25082 0 0.360 0.000 0.164 0.476
#> SRR542395 4 0.3659 0.64813 0 0.012 0.000 0.768 0.220
#> SRR542396 5 0.6473 0.24142 0 0.188 0.000 0.364 0.448
#> SRR542397 5 0.0963 0.55822 0 0.036 0.000 0.000 0.964
#> SRR542398 5 0.6461 0.30203 0 0.196 0.000 0.332 0.472
#> SRR542399 1 0.0000 1.00000 1 0.000 0.000 0.000 0.000
#> SRR542400 1 0.0000 1.00000 1 0.000 0.000 0.000 0.000
#> SRR542401 1 0.0000 1.00000 1 0.000 0.000 0.000 0.000
#> SRR542402 1 0.0000 1.00000 1 0.000 0.000 0.000 0.000
#> SRR542403 1 0.0000 1.00000 1 0.000 0.000 0.000 0.000
#> SRR542404 1 0.0000 1.00000 1 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
#> SRR542346 3 0.0260 0.802 0 0.000 0.992 0.000 0.008 0.000
#> SRR542347 3 0.0260 0.802 0 0.000 0.992 0.000 0.008 0.000
#> SRR542348 3 0.0146 0.802 0 0.000 0.996 0.000 0.004 0.000
#> SRR542349 3 0.0363 0.802 0 0.000 0.988 0.000 0.012 0.000
#> SRR542350 4 0.6174 0.611 0 0.136 0.132 0.604 0.000 0.128
#> SRR542351 3 0.4078 0.757 0 0.000 0.640 0.340 0.000 0.020
#> SRR542352 6 0.3989 -0.268 0 0.004 0.000 0.468 0.000 0.528
#> SRR542353 4 0.4243 0.550 0 0.000 0.132 0.736 0.000 0.132
#> SRR542354 3 0.4078 0.757 0 0.000 0.640 0.340 0.000 0.020
#> SRR542355 4 0.6320 0.241 0 0.104 0.000 0.476 0.356 0.064
#> SRR542356 3 0.4358 0.741 0 0.008 0.620 0.352 0.000 0.020
#> SRR542357 6 0.4281 0.561 0 0.068 0.000 0.228 0.000 0.704
#> SRR542358 4 0.4893 0.721 0 0.168 0.000 0.660 0.000 0.172
#> SRR542359 3 0.3198 0.783 0 0.000 0.740 0.260 0.000 0.000
#> SRR542360 3 0.2151 0.787 0 0.000 0.904 0.016 0.072 0.008
#> SRR542361 5 0.0000 0.912 0 0.000 0.000 0.000 1.000 0.000
#> SRR542362 5 0.5962 0.130 0 0.000 0.328 0.000 0.436 0.236
#> SRR542363 3 0.2431 0.687 0 0.000 0.860 0.000 0.132 0.008
#> SRR542364 6 0.1713 0.759 0 0.044 0.000 0.028 0.000 0.928
#> SRR542365 6 0.2562 0.777 0 0.172 0.000 0.000 0.000 0.828
#> SRR542366 6 0.1333 0.761 0 0.048 0.000 0.008 0.000 0.944
#> SRR542367 6 0.2664 0.777 0 0.184 0.000 0.000 0.000 0.816
#> SRR542368 6 0.2793 0.768 0 0.200 0.000 0.000 0.000 0.800
#> SRR542369 6 0.0713 0.725 0 0.000 0.000 0.028 0.000 0.972
#> SRR542370 6 0.2762 0.771 0 0.196 0.000 0.000 0.000 0.804
#> SRR542371 6 0.3683 0.738 0 0.184 0.000 0.048 0.000 0.768
#> SRR542372 6 0.2793 0.768 0 0.200 0.000 0.000 0.000 0.800
#> SRR542373 6 0.3054 0.735 0 0.036 0.000 0.136 0.000 0.828
#> SRR542374 3 0.4078 0.757 0 0.000 0.640 0.340 0.000 0.020
#> SRR542375 5 0.0260 0.909 0 0.000 0.000 0.000 0.992 0.008
#> SRR542376 5 0.0000 0.912 0 0.000 0.000 0.000 1.000 0.000
#> SRR542377 5 0.0000 0.912 0 0.000 0.000 0.000 1.000 0.000
#> SRR542378 5 0.0000 0.912 0 0.000 0.000 0.000 1.000 0.000
#> SRR542379 5 0.0000 0.912 0 0.000 0.000 0.000 1.000 0.000
#> SRR542380 5 0.0000 0.912 0 0.000 0.000 0.000 1.000 0.000
#> SRR542381 5 0.0405 0.907 0 0.004 0.000 0.000 0.988 0.008
#> SRR542382 5 0.0260 0.909 0 0.000 0.000 0.000 0.992 0.008
#> SRR542383 5 0.0000 0.912 0 0.000 0.000 0.000 1.000 0.000
#> SRR542384 5 0.1643 0.847 0 0.068 0.000 0.000 0.924 0.008
#> SRR542385 2 0.4220 0.397 0 0.732 0.000 0.096 0.000 0.172
#> SRR542386 2 0.2562 0.670 0 0.828 0.000 0.000 0.000 0.172
#> SRR542387 2 0.2135 0.715 0 0.872 0.000 0.000 0.000 0.128
#> SRR542388 2 0.1267 0.677 0 0.940 0.000 0.060 0.000 0.000
#> SRR542389 4 0.4893 0.721 0 0.168 0.000 0.660 0.000 0.172
#> SRR542390 4 0.5612 0.557 0 0.308 0.000 0.520 0.000 0.172
#> SRR542391 4 0.4893 0.721 0 0.168 0.000 0.660 0.000 0.172
#> SRR542392 2 0.1501 0.737 0 0.924 0.000 0.000 0.000 0.076
#> SRR542393 2 0.5563 0.276 0 0.544 0.000 0.184 0.000 0.272
#> SRR542394 2 0.2651 0.734 0 0.872 0.000 0.004 0.036 0.088
#> SRR542395 5 0.5040 0.518 0 0.104 0.000 0.032 0.692 0.172
#> SRR542396 2 0.2527 0.671 0 0.832 0.000 0.000 0.168 0.000
#> SRR542397 2 0.4701 0.338 0 0.684 0.000 0.168 0.000 0.148
#> SRR542398 2 0.2135 0.696 0 0.872 0.000 0.000 0.128 0.000
#> SRR542399 1 0.0000 1.000 1 0.000 0.000 0.000 0.000 0.000
#> SRR542400 1 0.0000 1.000 1 0.000 0.000 0.000 0.000 0.000
#> SRR542401 1 0.0000 1.000 1 0.000 0.000 0.000 0.000 0.000
#> SRR542402 1 0.0000 1.000 1 0.000 0.000 0.000 0.000 0.000
#> SRR542403 1 0.0000 1.000 1 0.000 0.000 0.000 0.000 0.000
#> SRR542404 1 0.0000 1.000 1 0.000 0.000 0.000 0.000 0.000
Heatmaps for the consensus matrix. It visualizes the probability of two samples to be in a same group.
consensus_heatmap(res, k = 2)
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 16804 rows and 59 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.553 0.717 0.873 0.3404 0.814 0.814
#> 3 3 0.414 0.743 0.865 0.6302 0.590 0.496
#> 4 4 0.519 0.705 0.846 0.1976 0.815 0.603
#> 5 5 0.719 0.764 0.861 0.0827 0.915 0.767
#> 6 6 0.813 0.731 0.879 0.0999 0.867 0.590
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
#> SRR542346 2 0.9896 0.3930 0.440 0.560
#> SRR542347 2 0.9896 0.3930 0.440 0.560
#> SRR542348 2 0.9896 0.3930 0.440 0.560
#> SRR542349 2 0.9850 0.4157 0.428 0.572
#> SRR542350 2 0.0000 0.8289 0.000 1.000
#> SRR542351 2 0.3431 0.7868 0.064 0.936
#> SRR542352 2 0.0000 0.8289 0.000 1.000
#> SRR542353 2 0.0000 0.8289 0.000 1.000
#> SRR542354 2 0.0376 0.8267 0.004 0.996
#> SRR542355 2 0.0000 0.8289 0.000 1.000
#> SRR542356 2 0.0376 0.8267 0.004 0.996
#> SRR542357 2 0.0000 0.8289 0.000 1.000
#> SRR542358 2 0.0000 0.8289 0.000 1.000
#> SRR542359 2 0.3431 0.7868 0.064 0.936
#> SRR542360 2 0.0000 0.8289 0.000 1.000
#> SRR542361 2 0.9833 0.4222 0.424 0.576
#> SRR542362 2 0.9833 0.4222 0.424 0.576
#> SRR542363 2 0.9833 0.4222 0.424 0.576
#> SRR542364 2 0.0000 0.8289 0.000 1.000
#> SRR542365 2 0.0000 0.8289 0.000 1.000
#> SRR542366 2 0.0000 0.8289 0.000 1.000
#> SRR542367 2 0.0000 0.8289 0.000 1.000
#> SRR542368 2 0.8813 0.4867 0.300 0.700
#> SRR542369 2 0.0000 0.8289 0.000 1.000
#> SRR542370 2 0.0000 0.8289 0.000 1.000
#> SRR542371 2 0.0000 0.8289 0.000 1.000
#> SRR542372 2 0.0000 0.8289 0.000 1.000
#> SRR542373 2 0.0000 0.8289 0.000 1.000
#> SRR542374 2 0.3431 0.7868 0.064 0.936
#> SRR542375 2 0.0000 0.8289 0.000 1.000
#> SRR542376 2 0.9850 0.4162 0.428 0.572
#> SRR542377 2 0.9850 0.4162 0.428 0.572
#> SRR542378 2 0.9850 0.4162 0.428 0.572
#> SRR542379 2 0.9850 0.4162 0.428 0.572
#> SRR542380 2 0.9850 0.4162 0.428 0.572
#> SRR542381 2 0.0000 0.8289 0.000 1.000
#> SRR542382 2 0.9850 0.4162 0.428 0.572
#> SRR542383 2 0.9850 0.4162 0.428 0.572
#> SRR542384 2 0.0000 0.8289 0.000 1.000
#> SRR542385 2 0.0000 0.8289 0.000 1.000
#> SRR542386 2 0.0000 0.8289 0.000 1.000
#> SRR542387 2 0.0000 0.8289 0.000 1.000
#> SRR542388 2 0.8327 0.5460 0.264 0.736
#> SRR542389 2 0.0000 0.8289 0.000 1.000
#> SRR542390 2 0.0000 0.8289 0.000 1.000
#> SRR542391 2 0.0000 0.8289 0.000 1.000
#> SRR542392 2 0.7602 0.6093 0.220 0.780
#> SRR542393 2 0.0000 0.8289 0.000 1.000
#> SRR542394 2 0.0000 0.8289 0.000 1.000
#> SRR542395 2 0.0000 0.8289 0.000 1.000
#> SRR542396 2 0.0000 0.8289 0.000 1.000
#> SRR542397 2 0.0000 0.8289 0.000 1.000
#> SRR542398 2 0.9998 0.0166 0.492 0.508
#> SRR542399 1 0.0000 1.0000 1.000 0.000
#> SRR542400 1 0.0000 1.0000 1.000 0.000
#> SRR542401 1 0.0000 1.0000 1.000 0.000
#> SRR542402 1 0.0000 1.0000 1.000 0.000
#> SRR542403 1 0.0000 1.0000 1.000 0.000
#> SRR542404 1 0.0000 1.0000 1.000 0.000
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> SRR542346 3 0.0000 0.717 0.000 0.000 1.000
#> SRR542347 3 0.0000 0.717 0.000 0.000 1.000
#> SRR542348 3 0.0000 0.717 0.000 0.000 1.000
#> SRR542349 3 0.0000 0.717 0.000 0.000 1.000
#> SRR542350 3 0.6291 0.193 0.000 0.468 0.532
#> SRR542351 3 0.3941 0.733 0.000 0.156 0.844
#> SRR542352 2 0.0000 0.857 0.000 1.000 0.000
#> SRR542353 3 0.6280 0.217 0.000 0.460 0.540
#> SRR542354 3 0.4121 0.727 0.000 0.168 0.832
#> SRR542355 3 0.5810 0.666 0.000 0.336 0.664
#> SRR542356 3 0.4235 0.721 0.000 0.176 0.824
#> SRR542357 2 0.1163 0.848 0.000 0.972 0.028
#> SRR542358 2 0.1643 0.842 0.000 0.956 0.044
#> SRR542359 3 0.3941 0.733 0.000 0.156 0.844
#> SRR542360 3 0.5810 0.666 0.000 0.336 0.664
#> SRR542361 3 0.4121 0.786 0.000 0.168 0.832
#> SRR542362 3 0.4121 0.786 0.000 0.168 0.832
#> SRR542363 3 0.4121 0.786 0.000 0.168 0.832
#> SRR542364 2 0.0892 0.853 0.000 0.980 0.020
#> SRR542365 2 0.0000 0.857 0.000 1.000 0.000
#> SRR542366 2 0.0892 0.853 0.000 0.980 0.020
#> SRR542367 2 0.0000 0.857 0.000 1.000 0.000
#> SRR542368 2 0.5737 0.596 0.012 0.732 0.256
#> SRR542369 2 0.0000 0.857 0.000 1.000 0.000
#> SRR542370 2 0.0000 0.857 0.000 1.000 0.000
#> SRR542371 2 0.0592 0.855 0.000 0.988 0.012
#> SRR542372 2 0.0000 0.857 0.000 1.000 0.000
#> SRR542373 2 0.2356 0.810 0.000 0.928 0.072
#> SRR542374 3 0.4121 0.727 0.000 0.168 0.832
#> SRR542375 3 0.5810 0.666 0.000 0.336 0.664
#> SRR542376 3 0.4121 0.786 0.000 0.168 0.832
#> SRR542377 3 0.4121 0.786 0.000 0.168 0.832
#> SRR542378 3 0.4121 0.786 0.000 0.168 0.832
#> SRR542379 3 0.4121 0.786 0.000 0.168 0.832
#> SRR542380 3 0.4121 0.786 0.000 0.168 0.832
#> SRR542381 3 0.6286 0.367 0.000 0.464 0.536
#> SRR542382 3 0.4605 0.773 0.000 0.204 0.796
#> SRR542383 3 0.4121 0.786 0.000 0.168 0.832
#> SRR542384 2 0.6280 -0.119 0.000 0.540 0.460
#> SRR542385 2 0.0000 0.857 0.000 1.000 0.000
#> SRR542386 2 0.4931 0.633 0.000 0.768 0.232
#> SRR542387 3 0.5948 0.628 0.000 0.360 0.640
#> SRR542388 2 0.5058 0.614 0.000 0.756 0.244
#> SRR542389 2 0.1031 0.851 0.000 0.976 0.024
#> SRR542390 2 0.0000 0.857 0.000 1.000 0.000
#> SRR542391 2 0.0424 0.857 0.000 0.992 0.008
#> SRR542392 2 0.5659 0.600 0.012 0.740 0.248
#> SRR542393 2 0.0000 0.857 0.000 1.000 0.000
#> SRR542394 2 0.1031 0.852 0.000 0.976 0.024
#> SRR542395 2 0.5560 0.503 0.000 0.700 0.300
#> SRR542396 2 0.5216 0.591 0.000 0.740 0.260
#> SRR542397 2 0.0000 0.857 0.000 1.000 0.000
#> SRR542398 2 0.8673 0.452 0.160 0.588 0.252
#> SRR542399 1 0.0000 1.000 1.000 0.000 0.000
#> SRR542400 1 0.0000 1.000 1.000 0.000 0.000
#> SRR542401 1 0.0000 1.000 1.000 0.000 0.000
#> SRR542402 1 0.0000 1.000 1.000 0.000 0.000
#> SRR542403 1 0.0000 1.000 1.000 0.000 0.000
#> SRR542404 1 0.0000 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
#> SRR542346 3 0.1867 0.810 0 0.000 0.928 0.072
#> SRR542347 3 0.1867 0.810 0 0.000 0.928 0.072
#> SRR542348 3 0.1867 0.810 0 0.000 0.928 0.072
#> SRR542349 3 0.1867 0.810 0 0.000 0.928 0.072
#> SRR542350 3 0.3266 0.859 0 0.168 0.832 0.000
#> SRR542351 3 0.2589 0.883 0 0.116 0.884 0.000
#> SRR542352 2 0.0000 0.734 0 1.000 0.000 0.000
#> SRR542353 3 0.3172 0.865 0 0.160 0.840 0.000
#> SRR542354 3 0.2589 0.883 0 0.116 0.884 0.000
#> SRR542355 2 0.6056 0.575 0 0.660 0.092 0.248
#> SRR542356 3 0.2868 0.874 0 0.136 0.864 0.000
#> SRR542357 2 0.5550 0.600 0 0.692 0.060 0.248
#> SRR542358 2 0.0336 0.732 0 0.992 0.008 0.000
#> SRR542359 3 0.2589 0.883 0 0.116 0.884 0.000
#> SRR542360 2 0.6140 0.566 0 0.652 0.096 0.252
#> SRR542361 4 0.3801 0.655 0 0.220 0.000 0.780
#> SRR542362 4 0.3801 0.655 0 0.220 0.000 0.780
#> SRR542363 4 0.6449 0.583 0 0.220 0.140 0.640
#> SRR542364 2 0.1733 0.727 0 0.948 0.028 0.024
#> SRR542365 2 0.0000 0.734 0 1.000 0.000 0.000
#> SRR542366 2 0.5052 0.617 0 0.720 0.036 0.244
#> SRR542367 2 0.0707 0.735 0 0.980 0.000 0.020
#> SRR542368 2 0.0000 0.734 0 1.000 0.000 0.000
#> SRR542369 2 0.0336 0.734 0 0.992 0.000 0.008
#> SRR542370 2 0.0188 0.734 0 0.996 0.000 0.004
#> SRR542371 2 0.5931 0.433 0 0.504 0.036 0.460
#> SRR542372 2 0.0469 0.735 0 0.988 0.000 0.012
#> SRR542373 2 0.5753 0.592 0 0.680 0.072 0.248
#> SRR542374 3 0.2589 0.883 0 0.116 0.884 0.000
#> SRR542375 4 0.6011 -0.456 0 0.476 0.040 0.484
#> SRR542376 4 0.0188 0.803 0 0.004 0.000 0.996
#> SRR542377 4 0.2081 0.771 0 0.084 0.000 0.916
#> SRR542378 4 0.0000 0.802 0 0.000 0.000 1.000
#> SRR542379 4 0.0000 0.802 0 0.000 0.000 1.000
#> SRR542380 4 0.0000 0.802 0 0.000 0.000 1.000
#> SRR542381 2 0.6011 0.400 0 0.484 0.040 0.476
#> SRR542382 4 0.0188 0.802 0 0.004 0.000 0.996
#> SRR542383 4 0.0000 0.802 0 0.000 0.000 1.000
#> SRR542384 2 0.6009 0.416 0 0.492 0.040 0.468
#> SRR542385 2 0.3801 0.612 0 0.780 0.000 0.220
#> SRR542386 2 0.4977 0.452 0 0.540 0.000 0.460
#> SRR542387 2 0.5168 0.611 0 0.712 0.040 0.248
#> SRR542388 2 0.0000 0.734 0 1.000 0.000 0.000
#> SRR542389 2 0.0000 0.734 0 1.000 0.000 0.000
#> SRR542390 2 0.0188 0.734 0 0.996 0.000 0.004
#> SRR542391 2 0.0000 0.734 0 1.000 0.000 0.000
#> SRR542392 2 0.3448 0.656 0 0.828 0.004 0.168
#> SRR542393 2 0.0000 0.734 0 1.000 0.000 0.000
#> SRR542394 2 0.5503 0.437 0 0.516 0.016 0.468
#> SRR542395 2 0.6008 0.423 0 0.496 0.040 0.464
#> SRR542396 2 0.6009 0.416 0 0.492 0.040 0.468
#> SRR542397 2 0.2408 0.697 0 0.896 0.000 0.104
#> SRR542398 2 0.5497 0.441 0 0.524 0.016 0.460
#> SRR542399 1 0.0000 1.000 1 0.000 0.000 0.000
#> SRR542400 1 0.0000 1.000 1 0.000 0.000 0.000
#> SRR542401 1 0.0000 1.000 1 0.000 0.000 0.000
#> SRR542402 1 0.0000 1.000 1 0.000 0.000 0.000
#> SRR542403 1 0.0000 1.000 1 0.000 0.000 0.000
#> SRR542404 1 0.0000 1.000 1 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
#> SRR542346 5 0.4171 1.0000 0 0.000 0.104 0.112 0.784
#> SRR542347 5 0.4171 1.0000 0 0.000 0.104 0.112 0.784
#> SRR542348 5 0.4171 1.0000 0 0.000 0.104 0.112 0.784
#> SRR542349 5 0.4171 1.0000 0 0.000 0.104 0.112 0.784
#> SRR542350 3 0.3016 0.8122 0 0.132 0.848 0.000 0.020
#> SRR542351 3 0.0162 0.9245 0 0.004 0.996 0.000 0.000
#> SRR542352 2 0.0000 0.8389 0 1.000 0.000 0.000 0.000
#> SRR542353 3 0.2969 0.8181 0 0.128 0.852 0.000 0.020
#> SRR542354 3 0.0162 0.9245 0 0.004 0.996 0.000 0.000
#> SRR542355 4 0.6745 0.0293 0 0.400 0.188 0.404 0.008
#> SRR542356 3 0.0290 0.9237 0 0.008 0.992 0.000 0.000
#> SRR542357 2 0.2852 0.7381 0 0.828 0.172 0.000 0.000
#> SRR542358 2 0.0898 0.8287 0 0.972 0.008 0.000 0.020
#> SRR542359 3 0.0451 0.9208 0 0.004 0.988 0.000 0.008
#> SRR542360 4 0.7870 0.2723 0 0.296 0.208 0.408 0.088
#> SRR542361 4 0.1768 0.7720 0 0.004 0.000 0.924 0.072
#> SRR542362 4 0.1952 0.7662 0 0.004 0.000 0.912 0.084
#> SRR542363 4 0.2517 0.7507 0 0.004 0.008 0.884 0.104
#> SRR542364 2 0.1522 0.8312 0 0.944 0.044 0.000 0.012
#> SRR542365 2 0.0290 0.8397 0 0.992 0.000 0.000 0.008
#> SRR542366 2 0.1469 0.8371 0 0.948 0.016 0.000 0.036
#> SRR542367 2 0.1608 0.8305 0 0.928 0.000 0.000 0.072
#> SRR542368 2 0.0510 0.8392 0 0.984 0.000 0.000 0.016
#> SRR542369 2 0.0404 0.8397 0 0.988 0.000 0.000 0.012
#> SRR542370 2 0.0404 0.8397 0 0.988 0.000 0.000 0.012
#> SRR542371 2 0.6220 0.3681 0 0.540 0.016 0.340 0.104
#> SRR542372 2 0.1544 0.8317 0 0.932 0.000 0.000 0.068
#> SRR542373 2 0.2929 0.7336 0 0.820 0.180 0.000 0.000
#> SRR542374 3 0.0162 0.9245 0 0.004 0.996 0.000 0.000
#> SRR542375 4 0.4032 0.6664 0 0.072 0.004 0.800 0.124
#> SRR542376 4 0.1671 0.7733 0 0.000 0.000 0.924 0.076
#> SRR542377 4 0.1671 0.7733 0 0.000 0.000 0.924 0.076
#> SRR542378 4 0.0000 0.7857 0 0.000 0.000 1.000 0.000
#> SRR542379 4 0.0162 0.7855 0 0.000 0.000 0.996 0.004
#> SRR542380 4 0.0000 0.7857 0 0.000 0.000 1.000 0.000
#> SRR542381 4 0.5422 0.5211 0 0.208 0.004 0.668 0.120
#> SRR542382 4 0.0510 0.7815 0 0.000 0.000 0.984 0.016
#> SRR542383 4 0.0000 0.7857 0 0.000 0.000 1.000 0.000
#> SRR542384 2 0.6243 0.1160 0 0.440 0.004 0.432 0.124
#> SRR542385 2 0.2580 0.8096 0 0.892 0.000 0.064 0.044
#> SRR542386 2 0.3181 0.7913 0 0.856 0.000 0.072 0.072
#> SRR542387 2 0.2777 0.8055 0 0.864 0.000 0.016 0.120
#> SRR542388 2 0.0162 0.8396 0 0.996 0.000 0.000 0.004
#> SRR542389 2 0.0000 0.8389 0 1.000 0.000 0.000 0.000
#> SRR542390 2 0.0162 0.8396 0 0.996 0.000 0.000 0.004
#> SRR542391 2 0.0162 0.8396 0 0.996 0.000 0.000 0.004
#> SRR542392 2 0.1952 0.8256 0 0.912 0.000 0.004 0.084
#> SRR542393 2 0.0000 0.8389 0 1.000 0.000 0.000 0.000
#> SRR542394 2 0.5237 0.5860 0 0.664 0.000 0.236 0.100
#> SRR542395 2 0.6097 0.1606 0 0.456 0.000 0.420 0.124
#> SRR542396 2 0.6243 0.1160 0 0.440 0.004 0.432 0.124
#> SRR542397 2 0.0162 0.8396 0 0.996 0.000 0.000 0.004
#> SRR542398 2 0.6110 0.1182 0 0.452 0.004 0.436 0.108
#> SRR542399 1 0.0000 1.0000 1 0.000 0.000 0.000 0.000
#> SRR542400 1 0.0000 1.0000 1 0.000 0.000 0.000 0.000
#> SRR542401 1 0.0000 1.0000 1 0.000 0.000 0.000 0.000
#> SRR542402 1 0.0000 1.0000 1 0.000 0.000 0.000 0.000
#> SRR542403 1 0.0000 1.0000 1 0.000 0.000 0.000 0.000
#> SRR542404 1 0.0000 1.0000 1 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
#> SRR542346 6 0.0260 0.8214 0 0.000 0.000 0.008 0.000 0.992
#> SRR542347 6 0.0260 0.8214 0 0.000 0.000 0.008 0.000 0.992
#> SRR542348 6 0.0260 0.8214 0 0.000 0.000 0.008 0.000 0.992
#> SRR542349 6 0.0260 0.8214 0 0.000 0.000 0.008 0.000 0.992
#> SRR542350 3 0.2823 0.7270 0 0.204 0.796 0.000 0.000 0.000
#> SRR542351 3 0.0000 0.8903 0 0.000 1.000 0.000 0.000 0.000
#> SRR542352 2 0.0000 0.8601 0 1.000 0.000 0.000 0.000 0.000
#> SRR542353 3 0.2823 0.7270 0 0.204 0.796 0.000 0.000 0.000
#> SRR542354 3 0.0000 0.8903 0 0.000 1.000 0.000 0.000 0.000
#> SRR542355 2 0.6202 0.0727 0 0.424 0.208 0.356 0.012 0.000
#> SRR542356 3 0.0146 0.8887 0 0.004 0.996 0.000 0.000 0.000
#> SRR542357 2 0.2631 0.7377 0 0.820 0.180 0.000 0.000 0.000
#> SRR542358 2 0.0000 0.8601 0 1.000 0.000 0.000 0.000 0.000
#> SRR542359 3 0.0000 0.8903 0 0.000 1.000 0.000 0.000 0.000
#> SRR542360 6 0.6105 0.4481 0 0.000 0.204 0.360 0.008 0.428
#> SRR542361 4 0.0146 0.6587 0 0.000 0.000 0.996 0.000 0.004
#> SRR542362 4 0.1267 0.5964 0 0.000 0.000 0.940 0.000 0.060
#> SRR542363 6 0.3727 0.5724 0 0.000 0.000 0.388 0.000 0.612
#> SRR542364 2 0.1267 0.8425 0 0.940 0.000 0.000 0.060 0.000
#> SRR542365 2 0.0363 0.8589 0 0.988 0.000 0.000 0.012 0.000
#> SRR542366 2 0.1765 0.8197 0 0.904 0.000 0.000 0.096 0.000
#> SRR542367 2 0.1267 0.8425 0 0.940 0.000 0.000 0.060 0.000
#> SRR542368 2 0.0806 0.8558 0 0.972 0.000 0.000 0.020 0.008
#> SRR542369 2 0.0000 0.8601 0 1.000 0.000 0.000 0.000 0.000
#> SRR542370 2 0.0146 0.8590 0 0.996 0.000 0.000 0.004 0.000
#> SRR542371 5 0.3706 0.2508 0 0.380 0.000 0.000 0.620 0.000
#> SRR542372 2 0.1141 0.8460 0 0.948 0.000 0.000 0.052 0.000
#> SRR542373 2 0.3261 0.7025 0 0.780 0.204 0.000 0.016 0.000
#> SRR542374 3 0.0000 0.8903 0 0.000 1.000 0.000 0.000 0.000
#> SRR542375 5 0.3607 -0.1233 0 0.000 0.000 0.348 0.652 0.000
#> SRR542376 4 0.0146 0.6587 0 0.000 0.000 0.996 0.000 0.004
#> SRR542377 4 0.0000 0.6601 0 0.000 0.000 1.000 0.000 0.000
#> SRR542378 4 0.3634 0.7154 0 0.000 0.000 0.644 0.356 0.000
#> SRR542379 4 0.3620 0.7166 0 0.000 0.000 0.648 0.352 0.000
#> SRR542380 4 0.3634 0.7154 0 0.000 0.000 0.644 0.356 0.000
#> SRR542381 5 0.0260 0.7122 0 0.008 0.000 0.000 0.992 0.000
#> SRR542382 4 0.3684 0.6948 0 0.000 0.000 0.628 0.372 0.000
#> SRR542383 4 0.3634 0.7154 0 0.000 0.000 0.644 0.356 0.000
#> SRR542384 5 0.0260 0.7122 0 0.008 0.000 0.000 0.992 0.000
#> SRR542385 2 0.3468 0.5890 0 0.728 0.000 0.000 0.264 0.008
#> SRR542386 2 0.4093 0.0370 0 0.516 0.000 0.000 0.476 0.008
#> SRR542387 2 0.3446 0.5589 0 0.692 0.000 0.000 0.308 0.000
#> SRR542388 2 0.0260 0.8598 0 0.992 0.000 0.000 0.000 0.008
#> SRR542389 2 0.0000 0.8601 0 1.000 0.000 0.000 0.000 0.000
#> SRR542390 2 0.0146 0.8603 0 0.996 0.000 0.000 0.004 0.000
#> SRR542391 2 0.0260 0.8573 0 0.992 0.000 0.000 0.008 0.000
#> SRR542392 2 0.3789 0.4811 0 0.660 0.000 0.000 0.332 0.008
#> SRR542393 2 0.0000 0.8601 0 1.000 0.000 0.000 0.000 0.000
#> SRR542394 5 0.3672 0.2874 0 0.368 0.000 0.000 0.632 0.000
#> SRR542395 5 0.0458 0.7120 0 0.016 0.000 0.000 0.984 0.000
#> SRR542396 5 0.0260 0.7122 0 0.008 0.000 0.000 0.992 0.000
#> SRR542397 2 0.0146 0.8603 0 0.996 0.000 0.000 0.004 0.000
#> SRR542398 5 0.0806 0.7015 0 0.020 0.000 0.000 0.972 0.008
#> SRR542399 1 0.0000 1.0000 1 0.000 0.000 0.000 0.000 0.000
#> SRR542400 1 0.0000 1.0000 1 0.000 0.000 0.000 0.000 0.000
#> SRR542401 1 0.0000 1.0000 1 0.000 0.000 0.000 0.000 0.000
#> SRR542402 1 0.0000 1.0000 1 0.000 0.000 0.000 0.000 0.000
#> SRR542403 1 0.0000 1.0000 1 0.000 0.000 0.000 0.000 0.000
#> SRR542404 1 0.0000 1.0000 1 0.000 0.000 0.000 0.000 0.000
Heatmaps for the consensus matrix. It visualizes the probability of two samples to be in a same group.
consensus_heatmap(res, k = 2)
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 16804 rows and 59 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 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.248 0.706 0.813 0.4496 0.492 0.492
#> 3 3 0.451 0.514 0.789 0.3444 0.735 0.531
#> 4 4 0.845 0.844 0.936 0.2061 0.771 0.473
#> 5 5 0.657 0.707 0.843 0.0825 0.894 0.635
#> 6 6 0.702 0.593 0.783 0.0493 0.951 0.780
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
#> SRR542346 2 0.278 0.8243 0.048 0.952
#> SRR542347 2 0.278 0.8243 0.048 0.952
#> SRR542348 2 0.278 0.8243 0.048 0.952
#> SRR542349 2 0.278 0.8243 0.048 0.952
#> SRR542350 2 0.506 0.8064 0.112 0.888
#> SRR542351 2 0.000 0.8424 0.000 1.000
#> SRR542352 2 0.506 0.8064 0.112 0.888
#> SRR542353 2 0.506 0.8064 0.112 0.888
#> SRR542354 2 0.000 0.8424 0.000 1.000
#> SRR542355 2 0.000 0.8424 0.000 1.000
#> SRR542356 2 0.000 0.8424 0.000 1.000
#> SRR542357 2 0.000 0.8424 0.000 1.000
#> SRR542358 2 0.506 0.8064 0.112 0.888
#> SRR542359 2 0.443 0.8318 0.092 0.908
#> SRR542360 2 0.260 0.8265 0.044 0.956
#> SRR542361 2 0.644 0.6990 0.164 0.836
#> SRR542362 2 0.311 0.8218 0.056 0.944
#> SRR542363 2 0.278 0.8243 0.048 0.952
#> SRR542364 2 0.118 0.8417 0.016 0.984
#> SRR542365 2 0.990 -0.0788 0.440 0.560
#> SRR542366 2 0.518 0.8042 0.116 0.884
#> SRR542367 1 0.998 0.3856 0.524 0.476
#> SRR542368 1 0.904 0.6386 0.680 0.320
#> SRR542369 2 0.506 0.8064 0.112 0.888
#> SRR542370 2 0.615 0.7722 0.152 0.848
#> SRR542371 1 0.998 0.5854 0.524 0.476
#> SRR542372 2 0.994 -0.1650 0.456 0.544
#> SRR542373 2 0.000 0.8424 0.000 1.000
#> SRR542374 2 0.000 0.8424 0.000 1.000
#> SRR542375 1 0.936 0.7139 0.648 0.352
#> SRR542376 2 0.999 -0.4092 0.484 0.516
#> SRR542377 1 0.973 0.6491 0.596 0.404
#> SRR542378 1 0.795 0.7218 0.760 0.240
#> SRR542379 1 0.929 0.7172 0.656 0.344
#> SRR542380 1 0.925 0.7183 0.660 0.340
#> SRR542381 1 0.936 0.7139 0.648 0.352
#> SRR542382 1 0.552 0.6747 0.872 0.128
#> SRR542383 1 0.936 0.7139 0.648 0.352
#> SRR542384 1 0.871 0.7506 0.708 0.292
#> SRR542385 1 0.866 0.7508 0.712 0.288
#> SRR542386 1 0.795 0.7604 0.760 0.240
#> SRR542387 1 0.963 0.6590 0.612 0.388
#> SRR542388 1 0.827 0.7592 0.740 0.260
#> SRR542389 2 0.584 0.7848 0.140 0.860
#> SRR542390 1 0.891 0.7357 0.692 0.308
#> SRR542391 1 0.886 0.7396 0.696 0.304
#> SRR542392 1 0.574 0.7375 0.864 0.136
#> SRR542393 2 0.506 0.8064 0.112 0.888
#> SRR542394 1 0.866 0.7508 0.712 0.288
#> SRR542395 1 0.891 0.7492 0.692 0.308
#> SRR542396 1 0.821 0.7641 0.744 0.256
#> SRR542397 1 0.876 0.7459 0.704 0.296
#> SRR542398 1 0.000 0.7043 1.000 0.000
#> SRR542399 1 0.000 0.7043 1.000 0.000
#> SRR542400 1 0.000 0.7043 1.000 0.000
#> SRR542401 1 0.000 0.7043 1.000 0.000
#> SRR542402 1 0.000 0.7043 1.000 0.000
#> SRR542403 1 0.000 0.7043 1.000 0.000
#> SRR542404 1 0.000 0.7043 1.000 0.000
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> SRR542346 3 0.6252 0.3440 0.000 0.444 0.556
#> SRR542347 3 0.6260 0.3396 0.000 0.448 0.552
#> SRR542348 3 0.6252 0.3440 0.000 0.444 0.556
#> SRR542349 3 0.6274 0.3296 0.000 0.456 0.544
#> SRR542350 3 0.0000 0.7050 0.000 0.000 1.000
#> SRR542351 3 0.1031 0.7058 0.000 0.024 0.976
#> SRR542352 3 0.0237 0.7039 0.000 0.004 0.996
#> SRR542353 3 0.0000 0.7050 0.000 0.000 1.000
#> SRR542354 3 0.0892 0.7058 0.000 0.020 0.980
#> SRR542355 3 0.5016 0.5814 0.000 0.240 0.760
#> SRR542356 3 0.0747 0.7058 0.000 0.016 0.984
#> SRR542357 3 0.0237 0.7039 0.000 0.004 0.996
#> SRR542358 3 0.0000 0.7050 0.000 0.000 1.000
#> SRR542359 3 0.1753 0.6979 0.000 0.048 0.952
#> SRR542360 3 0.6274 0.3296 0.000 0.456 0.544
#> SRR542361 2 0.0237 0.6156 0.000 0.996 0.004
#> SRR542362 2 0.4887 0.2959 0.000 0.772 0.228
#> SRR542363 2 0.5560 0.1289 0.000 0.700 0.300
#> SRR542364 3 0.2066 0.6774 0.000 0.060 0.940
#> SRR542365 3 0.6302 -0.3253 0.000 0.480 0.520
#> SRR542366 3 0.4399 0.5156 0.000 0.188 0.812
#> SRR542367 2 0.6267 0.4387 0.000 0.548 0.452
#> SRR542368 1 0.6235 0.3051 0.564 0.000 0.436
#> SRR542369 3 0.3116 0.6327 0.000 0.108 0.892
#> SRR542370 3 0.5706 0.1954 0.000 0.320 0.680
#> SRR542371 2 0.6798 0.4900 0.016 0.584 0.400
#> SRR542372 2 0.6267 0.4387 0.000 0.548 0.452
#> SRR542373 3 0.4399 0.6104 0.000 0.188 0.812
#> SRR542374 3 0.1289 0.7041 0.000 0.032 0.968
#> SRR542375 2 0.1163 0.6277 0.028 0.972 0.000
#> SRR542376 2 0.0237 0.6156 0.000 0.996 0.004
#> SRR542377 2 0.0237 0.6170 0.004 0.996 0.000
#> SRR542378 2 0.1411 0.6268 0.036 0.964 0.000
#> SRR542379 2 0.0747 0.6250 0.016 0.984 0.000
#> SRR542380 2 0.0892 0.6265 0.020 0.980 0.000
#> SRR542381 2 0.1411 0.6277 0.036 0.964 0.000
#> SRR542382 2 0.2796 0.6083 0.092 0.908 0.000
#> SRR542383 2 0.0892 0.6265 0.020 0.980 0.000
#> SRR542384 2 0.5998 0.6016 0.084 0.788 0.128
#> SRR542385 2 0.6888 0.4619 0.016 0.552 0.432
#> SRR542386 2 0.7831 0.4735 0.056 0.540 0.404
#> SRR542387 2 0.7156 0.4900 0.028 0.572 0.400
#> SRR542388 1 0.7583 0.1899 0.492 0.040 0.468
#> SRR542389 3 0.3686 0.5927 0.000 0.140 0.860
#> SRR542390 2 0.6476 0.4428 0.004 0.548 0.448
#> SRR542391 3 0.6280 -0.2711 0.000 0.460 0.540
#> SRR542392 1 0.9696 0.0298 0.420 0.220 0.360
#> SRR542393 3 0.2165 0.6739 0.000 0.064 0.936
#> SRR542394 2 0.7102 0.4747 0.024 0.556 0.420
#> SRR542395 2 0.7091 0.4787 0.024 0.560 0.416
#> SRR542396 2 0.8866 0.5196 0.180 0.572 0.248
#> SRR542397 2 0.6483 0.4361 0.004 0.544 0.452
#> SRR542398 2 0.6286 0.2107 0.464 0.536 0.000
#> SRR542399 1 0.0000 0.7676 1.000 0.000 0.000
#> SRR542400 1 0.0000 0.7676 1.000 0.000 0.000
#> SRR542401 1 0.0000 0.7676 1.000 0.000 0.000
#> SRR542402 1 0.0000 0.7676 1.000 0.000 0.000
#> SRR542403 1 0.0000 0.7676 1.000 0.000 0.000
#> SRR542404 1 0.0000 0.7676 1.000 0.000 0.000
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> SRR542346 3 0.0188 0.92896 0.000 0.000 0.996 0.004
#> SRR542347 3 0.0336 0.92755 0.000 0.000 0.992 0.008
#> SRR542348 3 0.0188 0.92896 0.000 0.000 0.996 0.004
#> SRR542349 3 0.0921 0.91429 0.000 0.000 0.972 0.028
#> SRR542350 2 0.3311 0.78063 0.000 0.828 0.172 0.000
#> SRR542351 3 0.0000 0.92906 0.000 0.000 1.000 0.000
#> SRR542352 2 0.0000 0.96697 0.000 1.000 0.000 0.000
#> SRR542353 3 0.4998 -0.00863 0.000 0.488 0.512 0.000
#> SRR542354 3 0.0000 0.92906 0.000 0.000 1.000 0.000
#> SRR542355 3 0.2282 0.87476 0.000 0.024 0.924 0.052
#> SRR542356 3 0.0000 0.92906 0.000 0.000 1.000 0.000
#> SRR542357 2 0.4193 0.62310 0.000 0.732 0.268 0.000
#> SRR542358 2 0.0000 0.96697 0.000 1.000 0.000 0.000
#> SRR542359 3 0.0000 0.92906 0.000 0.000 1.000 0.000
#> SRR542360 3 0.0336 0.92784 0.000 0.000 0.992 0.008
#> SRR542361 4 0.0469 0.83898 0.000 0.000 0.012 0.988
#> SRR542362 4 0.3801 0.64804 0.000 0.000 0.220 0.780
#> SRR542363 4 0.4877 0.28894 0.000 0.000 0.408 0.592
#> SRR542364 2 0.0000 0.96697 0.000 1.000 0.000 0.000
#> SRR542365 2 0.0000 0.96697 0.000 1.000 0.000 0.000
#> SRR542366 2 0.0000 0.96697 0.000 1.000 0.000 0.000
#> SRR542367 2 0.0188 0.96426 0.000 0.996 0.000 0.004
#> SRR542368 1 0.3400 0.76361 0.820 0.180 0.000 0.000
#> SRR542369 2 0.0000 0.96697 0.000 1.000 0.000 0.000
#> SRR542370 2 0.0000 0.96697 0.000 1.000 0.000 0.000
#> SRR542371 4 0.3172 0.74172 0.000 0.160 0.000 0.840
#> SRR542372 2 0.0000 0.96697 0.000 1.000 0.000 0.000
#> SRR542373 3 0.1888 0.88928 0.000 0.016 0.940 0.044
#> SRR542374 3 0.0000 0.92906 0.000 0.000 1.000 0.000
#> SRR542375 4 0.0000 0.84386 0.000 0.000 0.000 1.000
#> SRR542376 4 0.0000 0.84386 0.000 0.000 0.000 1.000
#> SRR542377 4 0.0469 0.83898 0.000 0.000 0.012 0.988
#> SRR542378 4 0.0000 0.84386 0.000 0.000 0.000 1.000
#> SRR542379 4 0.0000 0.84386 0.000 0.000 0.000 1.000
#> SRR542380 4 0.0000 0.84386 0.000 0.000 0.000 1.000
#> SRR542381 4 0.0000 0.84386 0.000 0.000 0.000 1.000
#> SRR542382 4 0.0000 0.84386 0.000 0.000 0.000 1.000
#> SRR542383 4 0.0000 0.84386 0.000 0.000 0.000 1.000
#> SRR542384 4 0.0188 0.84257 0.000 0.004 0.000 0.996
#> SRR542385 2 0.0188 0.96426 0.000 0.996 0.000 0.004
#> SRR542386 2 0.1302 0.92493 0.000 0.956 0.000 0.044
#> SRR542387 4 0.4072 0.65714 0.000 0.252 0.000 0.748
#> SRR542388 2 0.0000 0.96697 0.000 1.000 0.000 0.000
#> SRR542389 2 0.0000 0.96697 0.000 1.000 0.000 0.000
#> SRR542390 2 0.0000 0.96697 0.000 1.000 0.000 0.000
#> SRR542391 2 0.0000 0.96697 0.000 1.000 0.000 0.000
#> SRR542392 2 0.1557 0.91990 0.056 0.944 0.000 0.000
#> SRR542393 2 0.0000 0.96697 0.000 1.000 0.000 0.000
#> SRR542394 4 0.4985 0.23261 0.000 0.468 0.000 0.532
#> SRR542395 4 0.4643 0.52857 0.000 0.344 0.000 0.656
#> SRR542396 4 0.1118 0.82785 0.000 0.036 0.000 0.964
#> SRR542397 2 0.0000 0.96697 0.000 1.000 0.000 0.000
#> SRR542398 4 0.6243 0.30040 0.392 0.060 0.000 0.548
#> SRR542399 1 0.0000 0.96250 1.000 0.000 0.000 0.000
#> SRR542400 1 0.0000 0.96250 1.000 0.000 0.000 0.000
#> SRR542401 1 0.0000 0.96250 1.000 0.000 0.000 0.000
#> SRR542402 1 0.0000 0.96250 1.000 0.000 0.000 0.000
#> SRR542403 1 0.0000 0.96250 1.000 0.000 0.000 0.000
#> SRR542404 1 0.0000 0.96250 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
#> SRR542346 4 0.4291 0.0741 0.000 0.000 0.464 0.536 0.000
#> SRR542347 4 0.3424 0.5736 0.000 0.000 0.240 0.760 0.000
#> SRR542348 3 0.4294 -0.0204 0.000 0.000 0.532 0.468 0.000
#> SRR542349 4 0.2966 0.6353 0.000 0.000 0.184 0.816 0.000
#> SRR542350 3 0.4088 0.4051 0.000 0.368 0.632 0.000 0.000
#> SRR542351 3 0.0703 0.7022 0.000 0.000 0.976 0.024 0.000
#> SRR542352 2 0.3192 0.8127 0.000 0.848 0.112 0.000 0.040
#> SRR542353 3 0.3480 0.5977 0.000 0.248 0.752 0.000 0.000
#> SRR542354 3 0.3051 0.6503 0.000 0.000 0.852 0.120 0.028
#> SRR542355 3 0.7545 0.2843 0.000 0.060 0.416 0.188 0.336
#> SRR542356 3 0.0609 0.7026 0.000 0.000 0.980 0.020 0.000
#> SRR542357 3 0.5729 0.4736 0.000 0.312 0.604 0.020 0.064
#> SRR542358 2 0.1732 0.8613 0.000 0.920 0.080 0.000 0.000
#> SRR542359 3 0.0703 0.7022 0.000 0.000 0.976 0.024 0.000
#> SRR542360 3 0.3056 0.6586 0.000 0.000 0.864 0.068 0.068
#> SRR542361 4 0.2358 0.7060 0.000 0.000 0.008 0.888 0.104
#> SRR542362 4 0.2470 0.7002 0.000 0.000 0.012 0.884 0.104
#> SRR542363 4 0.2331 0.7020 0.000 0.000 0.080 0.900 0.020
#> SRR542364 2 0.6491 0.5813 0.000 0.636 0.164 0.104 0.096
#> SRR542365 2 0.1836 0.8818 0.000 0.936 0.008 0.016 0.040
#> SRR542366 2 0.4389 0.7533 0.000 0.756 0.004 0.184 0.056
#> SRR542367 2 0.4035 0.7860 0.000 0.784 0.000 0.060 0.156
#> SRR542368 1 0.5487 0.4826 0.620 0.280 0.100 0.000 0.000
#> SRR542369 2 0.0000 0.8881 0.000 1.000 0.000 0.000 0.000
#> SRR542370 2 0.1200 0.8847 0.000 0.964 0.008 0.016 0.012
#> SRR542371 5 0.2438 0.7744 0.000 0.060 0.000 0.040 0.900
#> SRR542372 2 0.4059 0.7782 0.000 0.776 0.000 0.052 0.172
#> SRR542373 3 0.5027 0.5839 0.000 0.012 0.720 0.084 0.184
#> SRR542374 3 0.0794 0.7022 0.000 0.000 0.972 0.028 0.000
#> SRR542375 5 0.1270 0.7991 0.000 0.000 0.000 0.052 0.948
#> SRR542376 4 0.3003 0.6376 0.000 0.000 0.000 0.812 0.188
#> SRR542377 4 0.2516 0.6849 0.000 0.000 0.000 0.860 0.140
#> SRR542378 5 0.3561 0.6807 0.000 0.000 0.000 0.260 0.740
#> SRR542379 4 0.4278 -0.0497 0.000 0.000 0.000 0.548 0.452
#> SRR542380 5 0.3586 0.6700 0.000 0.000 0.000 0.264 0.736
#> SRR542381 5 0.1671 0.8003 0.000 0.000 0.000 0.076 0.924
#> SRR542382 5 0.1671 0.7957 0.000 0.000 0.000 0.076 0.924
#> SRR542383 5 0.3707 0.6593 0.000 0.000 0.000 0.284 0.716
#> SRR542384 5 0.2984 0.7868 0.000 0.016 0.004 0.124 0.856
#> SRR542385 2 0.0693 0.8880 0.000 0.980 0.000 0.008 0.012
#> SRR542386 2 0.2260 0.8641 0.000 0.908 0.000 0.028 0.064
#> SRR542387 5 0.2221 0.7751 0.000 0.052 0.000 0.036 0.912
#> SRR542388 2 0.0794 0.8865 0.000 0.972 0.028 0.000 0.000
#> SRR542389 2 0.1043 0.8825 0.000 0.960 0.040 0.000 0.000
#> SRR542390 2 0.0992 0.8874 0.000 0.968 0.024 0.000 0.008
#> SRR542391 2 0.0703 0.8863 0.000 0.976 0.024 0.000 0.000
#> SRR542392 2 0.3844 0.7636 0.176 0.792 0.000 0.008 0.024
#> SRR542393 2 0.1121 0.8811 0.000 0.956 0.044 0.000 0.000
#> SRR542394 5 0.3280 0.6903 0.000 0.176 0.000 0.012 0.812
#> SRR542395 5 0.4010 0.6356 0.000 0.208 0.000 0.032 0.760
#> SRR542396 5 0.3667 0.7678 0.000 0.048 0.000 0.140 0.812
#> SRR542397 2 0.1205 0.8832 0.000 0.956 0.004 0.000 0.040
#> SRR542398 5 0.5642 0.6632 0.164 0.084 0.000 0.052 0.700
#> SRR542399 1 0.0000 0.9274 1.000 0.000 0.000 0.000 0.000
#> SRR542400 1 0.0000 0.9274 1.000 0.000 0.000 0.000 0.000
#> SRR542401 1 0.0000 0.9274 1.000 0.000 0.000 0.000 0.000
#> SRR542402 1 0.0000 0.9274 1.000 0.000 0.000 0.000 0.000
#> SRR542403 1 0.0000 0.9274 1.000 0.000 0.000 0.000 0.000
#> SRR542404 1 0.0000 0.9274 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
#> SRR542346 4 0.4672 0.6596 0.000 0.000 0.188 0.684 0.000 0.128
#> SRR542347 4 0.2997 0.7722 0.000 0.000 0.060 0.844 0.000 0.096
#> SRR542348 4 0.5173 0.5089 0.000 0.000 0.276 0.596 0.000 0.128
#> SRR542349 4 0.2058 0.7957 0.000 0.000 0.036 0.908 0.000 0.056
#> SRR542350 3 0.3653 0.4824 0.000 0.300 0.692 0.000 0.000 0.008
#> SRR542351 3 0.0291 0.7308 0.000 0.000 0.992 0.004 0.000 0.004
#> SRR542352 2 0.3128 0.6589 0.000 0.812 0.008 0.000 0.012 0.168
#> SRR542353 3 0.3190 0.5927 0.000 0.220 0.772 0.000 0.000 0.008
#> SRR542354 3 0.4438 0.5296 0.000 0.000 0.696 0.048 0.012 0.244
#> SRR542355 5 0.6285 0.1433 0.000 0.008 0.136 0.024 0.452 0.380
#> SRR542356 3 0.1444 0.7152 0.000 0.000 0.928 0.000 0.000 0.072
#> SRR542357 6 0.7775 -0.0845 0.000 0.272 0.252 0.032 0.088 0.356
#> SRR542358 2 0.0725 0.7787 0.000 0.976 0.012 0.000 0.000 0.012
#> SRR542359 3 0.1753 0.7295 0.000 0.000 0.912 0.004 0.000 0.084
#> SRR542360 3 0.4609 0.6320 0.000 0.000 0.744 0.040 0.088 0.128
#> SRR542361 4 0.1082 0.7938 0.000 0.000 0.000 0.956 0.004 0.040
#> SRR542362 4 0.1845 0.7850 0.000 0.000 0.008 0.916 0.004 0.072
#> SRR542363 4 0.0551 0.8033 0.000 0.000 0.004 0.984 0.004 0.008
#> SRR542364 6 0.7146 0.2592 0.000 0.156 0.120 0.120 0.052 0.552
#> SRR542365 2 0.3050 0.6818 0.000 0.764 0.000 0.000 0.000 0.236
#> SRR542366 2 0.5507 0.4420 0.000 0.564 0.000 0.208 0.000 0.228
#> SRR542367 2 0.5270 0.4939 0.000 0.588 0.008 0.024 0.044 0.336
#> SRR542368 1 0.7004 0.1885 0.484 0.200 0.172 0.000 0.000 0.144
#> SRR542369 2 0.1007 0.7795 0.000 0.956 0.000 0.000 0.000 0.044
#> SRR542370 2 0.3052 0.6880 0.000 0.780 0.000 0.004 0.000 0.216
#> SRR542371 5 0.4184 0.2310 0.000 0.012 0.000 0.000 0.500 0.488
#> SRR542372 2 0.5144 0.3953 0.000 0.536 0.004 0.012 0.048 0.400
#> SRR542373 3 0.5194 0.3859 0.000 0.004 0.596 0.016 0.060 0.324
#> SRR542374 3 0.1753 0.7275 0.000 0.000 0.912 0.004 0.000 0.084
#> SRR542375 5 0.2572 0.5609 0.000 0.000 0.000 0.012 0.852 0.136
#> SRR542376 4 0.2282 0.7715 0.000 0.000 0.000 0.888 0.088 0.024
#> SRR542377 4 0.2112 0.7778 0.000 0.000 0.000 0.896 0.088 0.016
#> SRR542378 5 0.3189 0.5482 0.000 0.000 0.000 0.184 0.796 0.020
#> SRR542379 4 0.4456 0.4719 0.000 0.000 0.000 0.668 0.268 0.064
#> SRR542380 5 0.3409 0.5429 0.000 0.000 0.000 0.192 0.780 0.028
#> SRR542381 5 0.3078 0.5206 0.000 0.000 0.000 0.012 0.796 0.192
#> SRR542382 5 0.1682 0.5864 0.000 0.000 0.000 0.020 0.928 0.052
#> SRR542383 5 0.4418 0.5018 0.000 0.000 0.000 0.192 0.708 0.100
#> SRR542384 5 0.4380 0.2077 0.000 0.000 0.008 0.012 0.544 0.436
#> SRR542385 2 0.0692 0.7824 0.000 0.976 0.000 0.000 0.004 0.020
#> SRR542386 2 0.3964 0.5999 0.000 0.724 0.000 0.000 0.044 0.232
#> SRR542387 5 0.2907 0.5512 0.000 0.000 0.020 0.000 0.828 0.152
#> SRR542388 2 0.1594 0.7666 0.000 0.932 0.052 0.000 0.000 0.016
#> SRR542389 2 0.0692 0.7785 0.000 0.976 0.004 0.000 0.000 0.020
#> SRR542390 2 0.0508 0.7807 0.000 0.984 0.000 0.000 0.004 0.012
#> SRR542391 2 0.0291 0.7806 0.000 0.992 0.004 0.000 0.000 0.004
#> SRR542392 2 0.6201 0.2686 0.320 0.512 0.016 0.000 0.016 0.136
#> SRR542393 2 0.0790 0.7747 0.000 0.968 0.032 0.000 0.000 0.000
#> SRR542394 5 0.4307 0.4581 0.000 0.072 0.000 0.000 0.704 0.224
#> SRR542395 5 0.3559 0.4995 0.000 0.012 0.004 0.000 0.744 0.240
#> SRR542396 6 0.4151 -0.2241 0.000 0.000 0.008 0.004 0.412 0.576
#> SRR542397 2 0.1411 0.7683 0.000 0.936 0.000 0.000 0.004 0.060
#> SRR542398 5 0.5815 0.2026 0.120 0.008 0.000 0.008 0.512 0.352
#> SRR542399 1 0.0000 0.9063 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR542400 1 0.0000 0.9063 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR542401 1 0.0000 0.9063 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR542402 1 0.0000 0.9063 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR542403 1 0.0000 0.9063 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR542404 1 0.0000 0.9063 1.000 0.000 0.000 0.000 0.000 0.000
Heatmaps for the consensus matrix. It visualizes the probability of two samples to be in a same group.
consensus_heatmap(res, k = 2)
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 16804 rows and 59 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 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.681 0.916 0.943 0.3669 0.670 0.670
#> 3 3 0.618 0.825 0.916 0.7082 0.695 0.545
#> 4 4 0.742 0.845 0.909 0.1926 0.842 0.587
#> 5 5 0.781 0.793 0.884 0.0502 0.974 0.893
#> 6 6 0.821 0.733 0.841 0.0348 1.000 1.000
suggest_best_k()
suggests the best \(k\) based on these statistics. The rules are as follows:
suggest_best_k(res)
#> [1] 4
Following shows the table of the partitions (You need to click the show/hide
code output link to see it). The membership matrix (columns with name p*
)
is inferred by
clue::cl_consensus()
function with the SE
method. Basically the value in the membership matrix
represents the probability to belong to a certain group. The finall class
label for an item is determined with the group with highest probability it
belongs to.
In get_classes()
function, the entropy is calculated from the membership
matrix and the silhouette score is calculated from the consensus matrix.
cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#> class entropy silhouette p1 p2
#> SRR542346 1 0.000 1.000 1.000 0.000
#> SRR542347 1 0.000 1.000 1.000 0.000
#> SRR542348 1 0.000 1.000 1.000 0.000
#> SRR542349 1 0.000 1.000 1.000 0.000
#> SRR542350 1 0.000 1.000 1.000 0.000
#> SRR542351 1 0.000 1.000 1.000 0.000
#> SRR542352 2 0.855 0.741 0.280 0.720
#> SRR542353 1 0.000 1.000 1.000 0.000
#> SRR542354 1 0.000 1.000 1.000 0.000
#> SRR542355 2 0.373 0.912 0.072 0.928
#> SRR542356 1 0.000 1.000 1.000 0.000
#> SRR542357 2 0.855 0.741 0.280 0.720
#> SRR542358 1 0.000 1.000 1.000 0.000
#> SRR542359 1 0.000 1.000 1.000 0.000
#> SRR542360 2 0.855 0.741 0.280 0.720
#> SRR542361 2 0.653 0.862 0.168 0.832
#> SRR542362 2 0.653 0.862 0.168 0.832
#> SRR542363 2 0.653 0.862 0.168 0.832
#> SRR542364 2 0.697 0.848 0.188 0.812
#> SRR542365 2 0.697 0.848 0.188 0.812
#> SRR542366 2 0.697 0.848 0.188 0.812
#> SRR542367 2 0.697 0.848 0.188 0.812
#> SRR542368 2 0.697 0.848 0.188 0.812
#> SRR542369 2 0.697 0.848 0.188 0.812
#> SRR542370 2 0.697 0.848 0.188 0.812
#> SRR542371 2 0.204 0.923 0.032 0.968
#> SRR542372 2 0.311 0.918 0.056 0.944
#> SRR542373 2 0.697 0.848 0.188 0.812
#> SRR542374 1 0.000 1.000 1.000 0.000
#> SRR542375 2 0.000 0.926 0.000 1.000
#> SRR542376 2 0.204 0.923 0.032 0.968
#> SRR542377 2 0.224 0.922 0.036 0.964
#> SRR542378 2 0.000 0.926 0.000 1.000
#> SRR542379 2 0.000 0.926 0.000 1.000
#> SRR542380 2 0.000 0.926 0.000 1.000
#> SRR542381 2 0.000 0.926 0.000 1.000
#> SRR542382 2 0.000 0.926 0.000 1.000
#> SRR542383 2 0.000 0.926 0.000 1.000
#> SRR542384 2 0.000 0.926 0.000 1.000
#> SRR542385 2 0.000 0.926 0.000 1.000
#> SRR542386 2 0.000 0.926 0.000 1.000
#> SRR542387 2 0.327 0.916 0.060 0.940
#> SRR542388 2 0.358 0.914 0.068 0.932
#> SRR542389 2 0.358 0.914 0.068 0.932
#> SRR542390 2 0.000 0.926 0.000 1.000
#> SRR542391 2 0.000 0.926 0.000 1.000
#> SRR542392 2 0.204 0.923 0.032 0.968
#> SRR542393 2 0.358 0.914 0.068 0.932
#> SRR542394 2 0.000 0.926 0.000 1.000
#> SRR542395 2 0.000 0.926 0.000 1.000
#> SRR542396 2 0.000 0.926 0.000 1.000
#> SRR542397 2 0.000 0.926 0.000 1.000
#> SRR542398 2 0.000 0.926 0.000 1.000
#> SRR542399 2 0.000 0.926 0.000 1.000
#> SRR542400 2 0.000 0.926 0.000 1.000
#> SRR542401 2 0.000 0.926 0.000 1.000
#> SRR542402 2 0.000 0.926 0.000 1.000
#> SRR542403 2 0.000 0.926 0.000 1.000
#> SRR542404 2 0.000 0.926 0.000 1.000
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> SRR542346 3 0.0000 0.9719 0.000 0.000 1.000
#> SRR542347 3 0.0000 0.9719 0.000 0.000 1.000
#> SRR542348 3 0.0000 0.9719 0.000 0.000 1.000
#> SRR542349 3 0.0000 0.9719 0.000 0.000 1.000
#> SRR542350 3 0.3941 0.8530 0.000 0.156 0.844
#> SRR542351 3 0.0000 0.9719 0.000 0.000 1.000
#> SRR542352 2 0.3192 0.8058 0.000 0.888 0.112
#> SRR542353 3 0.0000 0.9719 0.000 0.000 1.000
#> SRR542354 3 0.0000 0.9719 0.000 0.000 1.000
#> SRR542355 2 0.2878 0.8610 0.096 0.904 0.000
#> SRR542356 3 0.0000 0.9719 0.000 0.000 1.000
#> SRR542357 2 0.3192 0.8058 0.000 0.888 0.112
#> SRR542358 3 0.3941 0.8530 0.000 0.156 0.844
#> SRR542359 3 0.0000 0.9719 0.000 0.000 1.000
#> SRR542360 2 0.3192 0.8058 0.000 0.888 0.112
#> SRR542361 2 0.0000 0.8641 0.000 1.000 0.000
#> SRR542362 2 0.0000 0.8641 0.000 1.000 0.000
#> SRR542363 2 0.0000 0.8641 0.000 1.000 0.000
#> SRR542364 2 0.0892 0.8637 0.000 0.980 0.020
#> SRR542365 2 0.0892 0.8637 0.000 0.980 0.020
#> SRR542366 2 0.0892 0.8637 0.000 0.980 0.020
#> SRR542367 2 0.0892 0.8637 0.000 0.980 0.020
#> SRR542368 2 0.0892 0.8637 0.000 0.980 0.020
#> SRR542369 2 0.0892 0.8637 0.000 0.980 0.020
#> SRR542370 2 0.0892 0.8637 0.000 0.980 0.020
#> SRR542371 2 0.3619 0.8418 0.136 0.864 0.000
#> SRR542372 2 0.3192 0.8556 0.112 0.888 0.000
#> SRR542373 2 0.0892 0.8637 0.000 0.980 0.020
#> SRR542374 3 0.0000 0.9719 0.000 0.000 1.000
#> SRR542375 1 0.0000 0.8969 1.000 0.000 0.000
#> SRR542376 2 0.3752 0.8360 0.144 0.856 0.000
#> SRR542377 2 0.3551 0.8446 0.132 0.868 0.000
#> SRR542378 1 0.0000 0.8969 1.000 0.000 0.000
#> SRR542379 1 0.5529 0.4955 0.704 0.296 0.000
#> SRR542380 1 0.0237 0.8948 0.996 0.004 0.000
#> SRR542381 1 0.0000 0.8969 1.000 0.000 0.000
#> SRR542382 1 0.0000 0.8969 1.000 0.000 0.000
#> SRR542383 1 0.0000 0.8969 1.000 0.000 0.000
#> SRR542384 1 0.0000 0.8969 1.000 0.000 0.000
#> SRR542385 1 0.6286 -0.0387 0.536 0.464 0.000
#> SRR542386 1 0.6267 0.0119 0.548 0.452 0.000
#> SRR542387 2 0.3116 0.8574 0.108 0.892 0.000
#> SRR542388 2 0.2959 0.8603 0.100 0.900 0.000
#> SRR542389 2 0.2959 0.8603 0.100 0.900 0.000
#> SRR542390 2 0.5363 0.6879 0.276 0.724 0.000
#> SRR542391 2 0.5363 0.6879 0.276 0.724 0.000
#> SRR542392 2 0.3619 0.8418 0.136 0.864 0.000
#> SRR542393 2 0.2959 0.8603 0.100 0.900 0.000
#> SRR542394 2 0.6026 0.5026 0.376 0.624 0.000
#> SRR542395 2 0.6026 0.5026 0.376 0.624 0.000
#> SRR542396 1 0.0892 0.8840 0.980 0.020 0.000
#> SRR542397 2 0.5591 0.6433 0.304 0.696 0.000
#> SRR542398 1 0.0000 0.8969 1.000 0.000 0.000
#> SRR542399 1 0.0000 0.8969 1.000 0.000 0.000
#> SRR542400 1 0.0000 0.8969 1.000 0.000 0.000
#> SRR542401 1 0.0000 0.8969 1.000 0.000 0.000
#> SRR542402 1 0.0000 0.8969 1.000 0.000 0.000
#> SRR542403 1 0.3752 0.7539 0.856 0.144 0.000
#> SRR542404 1 0.0000 0.8969 1.000 0.000 0.000
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> SRR542346 3 0.0000 0.957 0.000 0.000 1.000 0.000
#> SRR542347 3 0.0000 0.957 0.000 0.000 1.000 0.000
#> SRR542348 3 0.0000 0.957 0.000 0.000 1.000 0.000
#> SRR542349 3 0.0000 0.957 0.000 0.000 1.000 0.000
#> SRR542350 3 0.4103 0.737 0.256 0.000 0.744 0.000
#> SRR542351 3 0.0000 0.957 0.000 0.000 1.000 0.000
#> SRR542352 1 0.2021 0.875 0.932 0.056 0.012 0.000
#> SRR542353 3 0.0000 0.957 0.000 0.000 1.000 0.000
#> SRR542354 3 0.0000 0.957 0.000 0.000 1.000 0.000
#> SRR542355 1 0.4643 0.665 0.656 0.344 0.000 0.000
#> SRR542356 3 0.0000 0.957 0.000 0.000 1.000 0.000
#> SRR542357 1 0.2021 0.875 0.932 0.056 0.012 0.000
#> SRR542358 3 0.4103 0.737 0.256 0.000 0.744 0.000
#> SRR542359 3 0.0000 0.957 0.000 0.000 1.000 0.000
#> SRR542360 1 0.2021 0.875 0.932 0.056 0.012 0.000
#> SRR542361 1 0.3610 0.872 0.800 0.200 0.000 0.000
#> SRR542362 1 0.3610 0.872 0.800 0.200 0.000 0.000
#> SRR542363 1 0.3610 0.872 0.800 0.200 0.000 0.000
#> SRR542364 1 0.2011 0.926 0.920 0.080 0.000 0.000
#> SRR542365 1 0.2011 0.926 0.920 0.080 0.000 0.000
#> SRR542366 1 0.2011 0.926 0.920 0.080 0.000 0.000
#> SRR542367 1 0.2011 0.926 0.920 0.080 0.000 0.000
#> SRR542368 1 0.2011 0.926 0.920 0.080 0.000 0.000
#> SRR542369 1 0.2011 0.926 0.920 0.080 0.000 0.000
#> SRR542370 1 0.2011 0.926 0.920 0.080 0.000 0.000
#> SRR542371 2 0.0469 0.798 0.012 0.988 0.000 0.000
#> SRR542372 2 0.1557 0.791 0.056 0.944 0.000 0.000
#> SRR542373 1 0.2011 0.926 0.920 0.080 0.000 0.000
#> SRR542374 3 0.0000 0.957 0.000 0.000 1.000 0.000
#> SRR542375 4 0.0469 0.946 0.000 0.012 0.000 0.988
#> SRR542376 2 0.2589 0.723 0.116 0.884 0.000 0.000
#> SRR542377 2 0.3074 0.679 0.152 0.848 0.000 0.000
#> SRR542378 4 0.0000 0.951 0.000 0.000 0.000 1.000
#> SRR542379 4 0.4697 0.314 0.000 0.356 0.000 0.644
#> SRR542380 4 0.0469 0.946 0.000 0.012 0.000 0.988
#> SRR542381 4 0.0000 0.951 0.000 0.000 0.000 1.000
#> SRR542382 4 0.0000 0.951 0.000 0.000 0.000 1.000
#> SRR542383 4 0.0000 0.951 0.000 0.000 0.000 1.000
#> SRR542384 4 0.0469 0.946 0.000 0.012 0.000 0.988
#> SRR542385 2 0.4989 0.251 0.000 0.528 0.000 0.472
#> SRR542386 2 0.4996 0.216 0.000 0.516 0.000 0.484
#> SRR542387 2 0.1302 0.795 0.044 0.956 0.000 0.000
#> SRR542388 2 0.1792 0.787 0.068 0.932 0.000 0.000
#> SRR542389 2 0.1867 0.785 0.072 0.928 0.000 0.000
#> SRR542390 2 0.2814 0.785 0.000 0.868 0.000 0.132
#> SRR542391 2 0.2814 0.785 0.000 0.868 0.000 0.132
#> SRR542392 2 0.0469 0.798 0.012 0.988 0.000 0.000
#> SRR542393 2 0.1867 0.785 0.072 0.928 0.000 0.000
#> SRR542394 2 0.3942 0.709 0.000 0.764 0.000 0.236
#> SRR542395 2 0.3942 0.709 0.000 0.764 0.000 0.236
#> SRR542396 4 0.1118 0.924 0.000 0.036 0.000 0.964
#> SRR542397 2 0.3172 0.769 0.000 0.840 0.000 0.160
#> SRR542398 4 0.0000 0.951 0.000 0.000 0.000 1.000
#> SRR542399 4 0.0000 0.951 0.000 0.000 0.000 1.000
#> SRR542400 4 0.0000 0.951 0.000 0.000 0.000 1.000
#> SRR542401 4 0.0000 0.951 0.000 0.000 0.000 1.000
#> SRR542402 4 0.0000 0.951 0.000 0.000 0.000 1.000
#> SRR542403 4 0.3400 0.736 0.000 0.180 0.000 0.820
#> SRR542404 4 0.0000 0.951 0.000 0.000 0.000 1.000
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> SRR542346 3 0.0000 0.950 0.000 0.000 1.000 0.000 0.000
#> SRR542347 3 0.0290 0.946 0.000 0.000 0.992 0.000 0.008
#> SRR542348 3 0.0000 0.950 0.000 0.000 1.000 0.000 0.000
#> SRR542349 3 0.0290 0.946 0.000 0.000 0.992 0.000 0.008
#> SRR542350 3 0.4080 0.694 0.000 0.000 0.728 0.020 0.252
#> SRR542351 3 0.0000 0.950 0.000 0.000 1.000 0.000 0.000
#> SRR542352 5 0.4367 0.833 0.000 0.060 0.000 0.192 0.748
#> SRR542353 3 0.0000 0.950 0.000 0.000 1.000 0.000 0.000
#> SRR542354 3 0.0000 0.950 0.000 0.000 1.000 0.000 0.000
#> SRR542355 5 0.6244 0.540 0.000 0.348 0.000 0.156 0.496
#> SRR542356 3 0.0000 0.950 0.000 0.000 1.000 0.000 0.000
#> SRR542357 5 0.4367 0.833 0.000 0.060 0.000 0.192 0.748
#> SRR542358 3 0.4080 0.694 0.000 0.000 0.728 0.020 0.252
#> SRR542359 3 0.0000 0.950 0.000 0.000 1.000 0.000 0.000
#> SRR542360 5 0.4588 0.817 0.000 0.060 0.000 0.220 0.720
#> SRR542361 4 0.4575 0.635 0.000 0.052 0.000 0.712 0.236
#> SRR542362 4 0.4575 0.635 0.000 0.052 0.000 0.712 0.236
#> SRR542363 4 0.4575 0.635 0.000 0.052 0.000 0.712 0.236
#> SRR542364 4 0.0000 0.889 0.000 0.000 0.000 1.000 0.000
#> SRR542365 4 0.0000 0.889 0.000 0.000 0.000 1.000 0.000
#> SRR542366 4 0.0000 0.889 0.000 0.000 0.000 1.000 0.000
#> SRR542367 4 0.0000 0.889 0.000 0.000 0.000 1.000 0.000
#> SRR542368 4 0.0000 0.889 0.000 0.000 0.000 1.000 0.000
#> SRR542369 4 0.0000 0.889 0.000 0.000 0.000 1.000 0.000
#> SRR542370 4 0.0000 0.889 0.000 0.000 0.000 1.000 0.000
#> SRR542371 2 0.0290 0.751 0.000 0.992 0.000 0.000 0.008
#> SRR542372 2 0.1408 0.742 0.000 0.948 0.000 0.044 0.008
#> SRR542373 4 0.0000 0.889 0.000 0.000 0.000 1.000 0.000
#> SRR542374 3 0.0000 0.950 0.000 0.000 1.000 0.000 0.000
#> SRR542375 1 0.0566 0.901 0.984 0.012 0.000 0.000 0.004
#> SRR542376 2 0.4100 0.575 0.000 0.764 0.000 0.044 0.192
#> SRR542377 2 0.4496 0.524 0.000 0.728 0.000 0.056 0.216
#> SRR542378 1 0.0404 0.903 0.988 0.000 0.000 0.000 0.012
#> SRR542379 1 0.4298 0.334 0.640 0.352 0.000 0.000 0.008
#> SRR542380 1 0.0566 0.901 0.984 0.012 0.000 0.000 0.004
#> SRR542381 1 0.0290 0.903 0.992 0.000 0.000 0.000 0.008
#> SRR542382 1 0.0404 0.903 0.988 0.000 0.000 0.000 0.012
#> SRR542383 1 0.0404 0.903 0.988 0.000 0.000 0.000 0.012
#> SRR542384 1 0.0566 0.901 0.984 0.012 0.000 0.000 0.004
#> SRR542385 2 0.4440 0.234 0.468 0.528 0.000 0.000 0.004
#> SRR542386 2 0.4448 0.200 0.480 0.516 0.000 0.000 0.004
#> SRR542387 2 0.1195 0.748 0.000 0.960 0.000 0.028 0.012
#> SRR542388 2 0.1750 0.740 0.000 0.936 0.000 0.028 0.036
#> SRR542389 2 0.1830 0.739 0.000 0.932 0.000 0.028 0.040
#> SRR542390 2 0.2536 0.752 0.128 0.868 0.000 0.000 0.004
#> SRR542391 2 0.2536 0.752 0.128 0.868 0.000 0.000 0.004
#> SRR542392 2 0.0290 0.751 0.000 0.992 0.000 0.000 0.008
#> SRR542393 2 0.1830 0.739 0.000 0.932 0.000 0.028 0.040
#> SRR542394 2 0.3521 0.697 0.232 0.764 0.000 0.000 0.004
#> SRR542395 2 0.3521 0.697 0.232 0.764 0.000 0.000 0.004
#> SRR542396 1 0.1124 0.885 0.960 0.036 0.000 0.000 0.004
#> SRR542397 2 0.2848 0.741 0.156 0.840 0.000 0.000 0.004
#> SRR542398 1 0.0404 0.903 0.988 0.000 0.000 0.000 0.012
#> SRR542399 1 0.2377 0.881 0.872 0.000 0.000 0.000 0.128
#> SRR542400 1 0.2377 0.881 0.872 0.000 0.000 0.000 0.128
#> SRR542401 1 0.2377 0.881 0.872 0.000 0.000 0.000 0.128
#> SRR542402 1 0.2377 0.881 0.872 0.000 0.000 0.000 0.128
#> SRR542403 1 0.5177 0.674 0.688 0.180 0.000 0.000 0.132
#> SRR542404 1 0.2377 0.881 0.872 0.000 0.000 0.000 0.128
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> SRR542346 3 0.0000 0.915 NA 0.000 1.000 0.000 0.000 0.000
#> SRR542347 3 0.2510 0.859 NA 0.000 0.872 0.028 0.000 0.000
#> SRR542348 3 0.0000 0.915 NA 0.000 1.000 0.000 0.000 0.000
#> SRR542349 3 0.2510 0.859 NA 0.000 0.872 0.028 0.000 0.000
#> SRR542350 3 0.4781 0.599 NA 0.000 0.624 0.296 0.000 0.000
#> SRR542351 3 0.0000 0.915 NA 0.000 1.000 0.000 0.000 0.000
#> SRR542352 4 0.1536 0.867 NA 0.016 0.000 0.940 0.000 0.004
#> SRR542353 3 0.0000 0.915 NA 0.000 1.000 0.000 0.000 0.000
#> SRR542354 3 0.0000 0.915 NA 0.000 1.000 0.000 0.000 0.000
#> SRR542355 4 0.4283 0.546 NA 0.288 0.000 0.672 0.000 0.004
#> SRR542356 3 0.0000 0.915 NA 0.000 1.000 0.000 0.000 0.000
#> SRR542357 4 0.1536 0.867 NA 0.016 0.000 0.940 0.000 0.004
#> SRR542358 3 0.4781 0.599 NA 0.000 0.624 0.296 0.000 0.000
#> SRR542359 3 0.0000 0.915 NA 0.000 1.000 0.000 0.000 0.000
#> SRR542360 4 0.2036 0.864 NA 0.016 0.000 0.912 0.000 0.008
#> SRR542361 6 0.1949 0.524 NA 0.004 0.000 0.088 0.000 0.904
#> SRR542362 6 0.1949 0.524 NA 0.004 0.000 0.088 0.000 0.904
#> SRR542363 6 0.1806 0.527 NA 0.004 0.000 0.088 0.000 0.908
#> SRR542364 6 0.3706 0.855 NA 0.000 0.000 0.000 0.000 0.620
#> SRR542365 6 0.3706 0.855 NA 0.000 0.000 0.000 0.000 0.620
#> SRR542366 6 0.3706 0.855 NA 0.000 0.000 0.000 0.000 0.620
#> SRR542367 6 0.3706 0.855 NA 0.000 0.000 0.000 0.000 0.620
#> SRR542368 6 0.3706 0.855 NA 0.000 0.000 0.000 0.000 0.620
#> SRR542369 6 0.3706 0.855 NA 0.000 0.000 0.000 0.000 0.620
#> SRR542370 6 0.3706 0.855 NA 0.000 0.000 0.000 0.000 0.620
#> SRR542371 2 0.1152 0.733 NA 0.952 0.000 0.044 0.000 0.000
#> SRR542372 2 0.2384 0.720 NA 0.900 0.000 0.044 0.000 0.016
#> SRR542373 6 0.3706 0.855 NA 0.000 0.000 0.000 0.000 0.620
#> SRR542374 3 0.0000 0.915 NA 0.000 1.000 0.000 0.000 0.000
#> SRR542375 5 0.1564 0.779 NA 0.040 0.000 0.000 0.936 0.000
#> SRR542376 2 0.5801 0.468 NA 0.628 0.000 0.088 0.000 0.196
#> SRR542377 2 0.6011 0.406 NA 0.592 0.000 0.088 0.000 0.232
#> SRR542378 5 0.0622 0.792 NA 0.000 0.000 0.012 0.980 0.000
#> SRR542379 5 0.5007 0.337 NA 0.320 0.000 0.004 0.596 0.000
#> SRR542380 5 0.1480 0.781 NA 0.040 0.000 0.000 0.940 0.000
#> SRR542381 5 0.0520 0.793 NA 0.000 0.000 0.008 0.984 0.000
#> SRR542382 5 0.0622 0.792 NA 0.000 0.000 0.012 0.980 0.000
#> SRR542383 5 0.0622 0.792 NA 0.000 0.000 0.012 0.980 0.000
#> SRR542384 5 0.1564 0.779 NA 0.040 0.000 0.000 0.936 0.000
#> SRR542385 2 0.4550 0.239 NA 0.544 0.000 0.000 0.420 0.000
#> SRR542386 2 0.4565 0.209 NA 0.532 0.000 0.000 0.432 0.000
#> SRR542387 2 0.2146 0.726 NA 0.908 0.000 0.044 0.000 0.004
#> SRR542388 2 0.2641 0.715 NA 0.876 0.000 0.072 0.000 0.004
#> SRR542389 2 0.2696 0.714 NA 0.872 0.000 0.076 0.000 0.004
#> SRR542390 2 0.2474 0.735 NA 0.880 0.000 0.000 0.080 0.000
#> SRR542391 2 0.2474 0.735 NA 0.880 0.000 0.000 0.080 0.000
#> SRR542392 2 0.1480 0.731 NA 0.940 0.000 0.040 0.000 0.000
#> SRR542393 2 0.2696 0.714 NA 0.872 0.000 0.076 0.000 0.004
#> SRR542394 2 0.3555 0.688 NA 0.776 0.000 0.000 0.184 0.000
#> SRR542395 2 0.3555 0.688 NA 0.776 0.000 0.000 0.184 0.000
#> SRR542396 5 0.1950 0.764 NA 0.064 0.000 0.000 0.912 0.000
#> SRR542397 2 0.2822 0.727 NA 0.852 0.000 0.000 0.108 0.000
#> SRR542398 5 0.0622 0.792 NA 0.000 0.000 0.012 0.980 0.000
#> SRR542399 5 0.3607 0.715 NA 0.000 0.000 0.000 0.652 0.000
#> SRR542400 5 0.3607 0.715 NA 0.000 0.000 0.000 0.652 0.000
#> SRR542401 5 0.3607 0.715 NA 0.000 0.000 0.000 0.652 0.000
#> SRR542402 5 0.3607 0.715 NA 0.000 0.000 0.000 0.652 0.000
#> SRR542403 5 0.5691 0.518 NA 0.164 0.000 0.000 0.468 0.000
#> SRR542404 5 0.3607 0.715 NA 0.000 0.000 0.000 0.652 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", "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 16804 rows and 59 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 0.983 0.991 0.5063 0.493 0.493
#> 3 3 0.899 0.877 0.936 0.2746 0.688 0.459
#> 4 4 0.728 0.704 0.815 0.1221 0.839 0.595
#> 5 5 0.713 0.765 0.807 0.0823 0.865 0.567
#> 6 6 0.744 0.720 0.791 0.0468 0.985 0.927
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
#> SRR542346 2 0.0000 0.993 0.000 1.000
#> SRR542347 2 0.0000 0.993 0.000 1.000
#> SRR542348 2 0.0000 0.993 0.000 1.000
#> SRR542349 2 0.0000 0.993 0.000 1.000
#> SRR542350 2 0.0000 0.993 0.000 1.000
#> SRR542351 2 0.0000 0.993 0.000 1.000
#> SRR542352 2 0.0938 0.994 0.012 0.988
#> SRR542353 2 0.0000 0.993 0.000 1.000
#> SRR542354 2 0.0000 0.993 0.000 1.000
#> SRR542355 1 0.9170 0.496 0.668 0.332
#> SRR542356 2 0.0000 0.993 0.000 1.000
#> SRR542357 2 0.0672 0.994 0.008 0.992
#> SRR542358 2 0.0000 0.993 0.000 1.000
#> SRR542359 2 0.0000 0.993 0.000 1.000
#> SRR542360 2 0.0938 0.994 0.012 0.988
#> SRR542361 2 0.0938 0.994 0.012 0.988
#> SRR542362 2 0.0938 0.994 0.012 0.988
#> SRR542363 2 0.0938 0.994 0.012 0.988
#> SRR542364 2 0.0938 0.994 0.012 0.988
#> SRR542365 2 0.0938 0.994 0.012 0.988
#> SRR542366 2 0.0938 0.994 0.012 0.988
#> SRR542367 2 0.0938 0.994 0.012 0.988
#> SRR542368 2 0.0938 0.994 0.012 0.988
#> SRR542369 2 0.0938 0.994 0.012 0.988
#> SRR542370 2 0.0938 0.994 0.012 0.988
#> SRR542371 1 0.0000 0.989 1.000 0.000
#> SRR542372 1 0.0000 0.989 1.000 0.000
#> SRR542373 2 0.0938 0.994 0.012 0.988
#> SRR542374 2 0.0000 0.993 0.000 1.000
#> SRR542375 1 0.0000 0.989 1.000 0.000
#> SRR542376 1 0.0000 0.989 1.000 0.000
#> SRR542377 1 0.0000 0.989 1.000 0.000
#> SRR542378 1 0.0000 0.989 1.000 0.000
#> SRR542379 1 0.0000 0.989 1.000 0.000
#> SRR542380 1 0.0000 0.989 1.000 0.000
#> SRR542381 1 0.0000 0.989 1.000 0.000
#> SRR542382 1 0.0000 0.989 1.000 0.000
#> SRR542383 1 0.0000 0.989 1.000 0.000
#> SRR542384 1 0.0000 0.989 1.000 0.000
#> SRR542385 1 0.0000 0.989 1.000 0.000
#> SRR542386 1 0.0000 0.989 1.000 0.000
#> SRR542387 1 0.0000 0.989 1.000 0.000
#> SRR542388 1 0.0000 0.989 1.000 0.000
#> SRR542389 2 0.0938 0.994 0.012 0.988
#> SRR542390 1 0.0000 0.989 1.000 0.000
#> SRR542391 1 0.0000 0.989 1.000 0.000
#> SRR542392 1 0.0000 0.989 1.000 0.000
#> SRR542393 2 0.0938 0.994 0.012 0.988
#> SRR542394 1 0.0000 0.989 1.000 0.000
#> SRR542395 1 0.0000 0.989 1.000 0.000
#> SRR542396 1 0.0000 0.989 1.000 0.000
#> SRR542397 1 0.0000 0.989 1.000 0.000
#> SRR542398 1 0.0000 0.989 1.000 0.000
#> SRR542399 1 0.0000 0.989 1.000 0.000
#> SRR542400 1 0.0000 0.989 1.000 0.000
#> SRR542401 1 0.0000 0.989 1.000 0.000
#> SRR542402 1 0.0000 0.989 1.000 0.000
#> SRR542403 1 0.0000 0.989 1.000 0.000
#> SRR542404 1 0.0000 0.989 1.000 0.000
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> SRR542346 3 0.1860 0.980 0.000 0.052 0.948
#> SRR542347 3 0.1860 0.980 0.000 0.052 0.948
#> SRR542348 3 0.1860 0.980 0.000 0.052 0.948
#> SRR542349 3 0.1860 0.980 0.000 0.052 0.948
#> SRR542350 3 0.1860 0.980 0.000 0.052 0.948
#> SRR542351 3 0.1860 0.980 0.000 0.052 0.948
#> SRR542352 2 0.0592 0.892 0.000 0.988 0.012
#> SRR542353 3 0.1860 0.980 0.000 0.052 0.948
#> SRR542354 3 0.1860 0.980 0.000 0.052 0.948
#> SRR542355 2 0.1860 0.874 0.052 0.948 0.000
#> SRR542356 3 0.1860 0.980 0.000 0.052 0.948
#> SRR542357 2 0.0592 0.892 0.000 0.988 0.012
#> SRR542358 3 0.5178 0.719 0.000 0.256 0.744
#> SRR542359 3 0.1860 0.980 0.000 0.052 0.948
#> SRR542360 2 0.0592 0.892 0.000 0.988 0.012
#> SRR542361 2 0.0237 0.894 0.004 0.996 0.000
#> SRR542362 2 0.0592 0.892 0.000 0.988 0.012
#> SRR542363 2 0.0592 0.892 0.000 0.988 0.012
#> SRR542364 2 0.0592 0.892 0.000 0.988 0.012
#> SRR542365 2 0.0000 0.894 0.000 1.000 0.000
#> SRR542366 2 0.0592 0.892 0.000 0.988 0.012
#> SRR542367 2 0.0237 0.894 0.004 0.996 0.000
#> SRR542368 2 0.0592 0.892 0.000 0.988 0.012
#> SRR542369 2 0.0592 0.892 0.000 0.988 0.012
#> SRR542370 2 0.0000 0.894 0.000 1.000 0.000
#> SRR542371 2 0.5882 0.511 0.348 0.652 0.000
#> SRR542372 2 0.1860 0.874 0.052 0.948 0.000
#> SRR542373 2 0.0592 0.892 0.000 0.988 0.012
#> SRR542374 3 0.1860 0.980 0.000 0.052 0.948
#> SRR542375 1 0.0592 0.959 0.988 0.012 0.000
#> SRR542376 2 0.6308 0.140 0.492 0.508 0.000
#> SRR542377 2 0.1860 0.874 0.052 0.948 0.000
#> SRR542378 1 0.0237 0.958 0.996 0.004 0.000
#> SRR542379 1 0.0592 0.959 0.988 0.012 0.000
#> SRR542380 1 0.0592 0.959 0.988 0.012 0.000
#> SRR542381 1 0.0592 0.959 0.988 0.012 0.000
#> SRR542382 1 0.0237 0.958 0.996 0.004 0.000
#> SRR542383 1 0.0237 0.958 0.996 0.004 0.000
#> SRR542384 1 0.0592 0.959 0.988 0.012 0.000
#> SRR542385 1 0.0592 0.959 0.988 0.012 0.000
#> SRR542386 1 0.0592 0.959 0.988 0.012 0.000
#> SRR542387 2 0.1860 0.874 0.052 0.948 0.000
#> SRR542388 2 0.1860 0.874 0.052 0.948 0.000
#> SRR542389 2 0.0237 0.894 0.004 0.996 0.000
#> SRR542390 2 0.6192 0.358 0.420 0.580 0.000
#> SRR542391 2 0.6192 0.358 0.420 0.580 0.000
#> SRR542392 1 0.6126 0.226 0.600 0.400 0.000
#> SRR542393 2 0.0237 0.894 0.004 0.996 0.000
#> SRR542394 1 0.0592 0.959 0.988 0.012 0.000
#> SRR542395 1 0.0592 0.959 0.988 0.012 0.000
#> SRR542396 1 0.0592 0.959 0.988 0.012 0.000
#> SRR542397 1 0.0592 0.959 0.988 0.012 0.000
#> SRR542398 1 0.0237 0.958 0.996 0.004 0.000
#> SRR542399 1 0.1860 0.934 0.948 0.000 0.052
#> SRR542400 1 0.1860 0.934 0.948 0.000 0.052
#> SRR542401 1 0.1860 0.934 0.948 0.000 0.052
#> SRR542402 1 0.1860 0.934 0.948 0.000 0.052
#> SRR542403 1 0.1860 0.934 0.948 0.000 0.052
#> SRR542404 1 0.1860 0.934 0.948 0.000 0.052
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> SRR542346 3 0.1118 0.974 0.036 0.000 0.964 0.000
#> SRR542347 3 0.2011 0.957 0.080 0.000 0.920 0.000
#> SRR542348 3 0.1118 0.974 0.036 0.000 0.964 0.000
#> SRR542349 3 0.2011 0.957 0.080 0.000 0.920 0.000
#> SRR542350 3 0.0921 0.973 0.028 0.000 0.972 0.000
#> SRR542351 3 0.0000 0.981 0.000 0.000 1.000 0.000
#> SRR542352 2 0.1022 0.858 0.032 0.968 0.000 0.000
#> SRR542353 3 0.0188 0.980 0.004 0.000 0.996 0.000
#> SRR542354 3 0.0469 0.980 0.012 0.000 0.988 0.000
#> SRR542355 2 0.4103 0.761 0.256 0.744 0.000 0.000
#> SRR542356 3 0.0000 0.981 0.000 0.000 1.000 0.000
#> SRR542357 2 0.1022 0.858 0.032 0.968 0.000 0.000
#> SRR542358 2 0.5850 0.114 0.032 0.512 0.456 0.000
#> SRR542359 3 0.0188 0.980 0.004 0.000 0.996 0.000
#> SRR542360 2 0.1118 0.858 0.036 0.964 0.000 0.000
#> SRR542361 2 0.1389 0.846 0.048 0.952 0.000 0.000
#> SRR542362 2 0.1389 0.846 0.048 0.952 0.000 0.000
#> SRR542363 2 0.1389 0.846 0.048 0.952 0.000 0.000
#> SRR542364 2 0.0188 0.860 0.004 0.996 0.000 0.000
#> SRR542365 2 0.0000 0.861 0.000 1.000 0.000 0.000
#> SRR542366 2 0.0000 0.861 0.000 1.000 0.000 0.000
#> SRR542367 2 0.0000 0.861 0.000 1.000 0.000 0.000
#> SRR542368 2 0.0000 0.861 0.000 1.000 0.000 0.000
#> SRR542369 2 0.0000 0.861 0.000 1.000 0.000 0.000
#> SRR542370 2 0.0000 0.861 0.000 1.000 0.000 0.000
#> SRR542371 4 0.7380 0.337 0.288 0.200 0.000 0.512
#> SRR542372 2 0.3975 0.761 0.240 0.760 0.000 0.000
#> SRR542373 2 0.0000 0.861 0.000 1.000 0.000 0.000
#> SRR542374 3 0.0000 0.981 0.000 0.000 1.000 0.000
#> SRR542375 4 0.0000 0.559 0.000 0.000 0.000 1.000
#> SRR542376 4 0.5936 0.402 0.324 0.056 0.000 0.620
#> SRR542377 2 0.6945 0.578 0.312 0.552 0.000 0.136
#> SRR542378 4 0.2921 0.434 0.140 0.000 0.000 0.860
#> SRR542379 4 0.0188 0.561 0.004 0.000 0.000 0.996
#> SRR542380 4 0.2530 0.476 0.112 0.000 0.000 0.888
#> SRR542381 4 0.2530 0.476 0.112 0.000 0.000 0.888
#> SRR542382 4 0.2921 0.434 0.140 0.000 0.000 0.860
#> SRR542383 4 0.2921 0.434 0.140 0.000 0.000 0.860
#> SRR542384 4 0.2530 0.476 0.112 0.000 0.000 0.888
#> SRR542385 4 0.0707 0.557 0.020 0.000 0.000 0.980
#> SRR542386 4 0.0817 0.558 0.024 0.000 0.000 0.976
#> SRR542387 2 0.6773 0.596 0.276 0.588 0.000 0.136
#> SRR542388 2 0.6428 0.634 0.264 0.624 0.000 0.112
#> SRR542389 2 0.4134 0.753 0.260 0.740 0.000 0.000
#> SRR542390 4 0.7827 0.137 0.276 0.316 0.000 0.408
#> SRR542391 4 0.7827 0.137 0.276 0.316 0.000 0.408
#> SRR542392 4 0.7660 0.282 0.276 0.260 0.000 0.464
#> SRR542393 2 0.4134 0.753 0.260 0.740 0.000 0.000
#> SRR542394 4 0.3444 0.498 0.184 0.000 0.000 0.816
#> SRR542395 4 0.0921 0.558 0.028 0.000 0.000 0.972
#> SRR542396 4 0.0469 0.557 0.012 0.000 0.000 0.988
#> SRR542397 4 0.4250 0.449 0.276 0.000 0.000 0.724
#> SRR542398 4 0.2921 0.434 0.140 0.000 0.000 0.860
#> SRR542399 1 0.4866 0.917 0.596 0.000 0.000 0.404
#> SRR542400 1 0.4866 0.917 0.596 0.000 0.000 0.404
#> SRR542401 1 0.4866 0.917 0.596 0.000 0.000 0.404
#> SRR542402 1 0.4866 0.917 0.596 0.000 0.000 0.404
#> SRR542403 1 0.4866 0.550 0.596 0.000 0.000 0.404
#> SRR542404 1 0.4866 0.917 0.596 0.000 0.000 0.404
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> SRR542346 3 0.1907 0.939 0.044 0.000 0.928 0.028 0.000
#> SRR542347 3 0.3723 0.890 0.152 0.000 0.804 0.044 0.000
#> SRR542348 3 0.1907 0.939 0.044 0.000 0.928 0.028 0.000
#> SRR542349 3 0.3723 0.890 0.152 0.000 0.804 0.044 0.000
#> SRR542350 3 0.1943 0.930 0.056 0.000 0.924 0.020 0.000
#> SRR542351 3 0.0000 0.947 0.000 0.000 1.000 0.000 0.000
#> SRR542352 2 0.4413 0.661 0.044 0.724 0.000 0.232 0.000
#> SRR542353 3 0.0451 0.946 0.008 0.000 0.988 0.004 0.000
#> SRR542354 3 0.2260 0.938 0.064 0.000 0.908 0.028 0.000
#> SRR542355 4 0.4042 0.665 0.032 0.212 0.000 0.756 0.000
#> SRR542356 3 0.0451 0.947 0.008 0.000 0.988 0.004 0.000
#> SRR542357 2 0.4413 0.661 0.044 0.724 0.000 0.232 0.000
#> SRR542358 2 0.7295 0.362 0.072 0.492 0.296 0.140 0.000
#> SRR542359 3 0.0579 0.946 0.008 0.000 0.984 0.008 0.000
#> SRR542360 2 0.4248 0.665 0.032 0.728 0.000 0.240 0.000
#> SRR542361 2 0.4164 0.753 0.096 0.784 0.000 0.120 0.000
#> SRR542362 2 0.4069 0.754 0.096 0.792 0.000 0.112 0.000
#> SRR542363 2 0.4069 0.754 0.096 0.792 0.000 0.112 0.000
#> SRR542364 2 0.0000 0.850 0.000 1.000 0.000 0.000 0.000
#> SRR542365 2 0.0162 0.850 0.000 0.996 0.000 0.004 0.000
#> SRR542366 2 0.0000 0.850 0.000 1.000 0.000 0.000 0.000
#> SRR542367 2 0.0162 0.850 0.000 0.996 0.000 0.004 0.000
#> SRR542368 2 0.0000 0.850 0.000 1.000 0.000 0.000 0.000
#> SRR542369 2 0.0162 0.850 0.000 0.996 0.000 0.004 0.000
#> SRR542370 2 0.0162 0.850 0.000 0.996 0.000 0.004 0.000
#> SRR542371 4 0.4442 0.615 0.000 0.028 0.000 0.688 0.284
#> SRR542372 4 0.4306 0.277 0.000 0.492 0.000 0.508 0.000
#> SRR542373 2 0.0000 0.850 0.000 1.000 0.000 0.000 0.000
#> SRR542374 3 0.0000 0.947 0.000 0.000 1.000 0.000 0.000
#> SRR542375 5 0.1809 0.789 0.012 0.000 0.000 0.060 0.928
#> SRR542376 4 0.5051 0.581 0.060 0.008 0.000 0.684 0.248
#> SRR542377 4 0.3891 0.694 0.076 0.076 0.000 0.828 0.020
#> SRR542378 5 0.2280 0.739 0.120 0.000 0.000 0.000 0.880
#> SRR542379 5 0.2079 0.786 0.020 0.000 0.000 0.064 0.916
#> SRR542380 5 0.1341 0.783 0.056 0.000 0.000 0.000 0.944
#> SRR542381 5 0.1270 0.785 0.052 0.000 0.000 0.000 0.948
#> SRR542382 5 0.2280 0.739 0.120 0.000 0.000 0.000 0.880
#> SRR542383 5 0.2280 0.739 0.120 0.000 0.000 0.000 0.880
#> SRR542384 5 0.1270 0.785 0.052 0.000 0.000 0.000 0.948
#> SRR542385 5 0.2416 0.770 0.012 0.000 0.000 0.100 0.888
#> SRR542386 5 0.2771 0.746 0.012 0.000 0.000 0.128 0.860
#> SRR542387 4 0.3368 0.735 0.000 0.156 0.000 0.820 0.024
#> SRR542388 4 0.2966 0.721 0.000 0.184 0.000 0.816 0.000
#> SRR542389 4 0.3878 0.668 0.016 0.236 0.000 0.748 0.000
#> SRR542390 4 0.4204 0.722 0.000 0.048 0.000 0.756 0.196
#> SRR542391 4 0.4204 0.722 0.000 0.048 0.000 0.756 0.196
#> SRR542392 4 0.3988 0.717 0.000 0.036 0.000 0.768 0.196
#> SRR542393 4 0.3906 0.664 0.016 0.240 0.000 0.744 0.000
#> SRR542394 5 0.4574 0.137 0.012 0.000 0.000 0.412 0.576
#> SRR542395 5 0.2818 0.742 0.012 0.000 0.000 0.132 0.856
#> SRR542396 5 0.1809 0.789 0.012 0.000 0.000 0.060 0.928
#> SRR542397 4 0.4547 0.396 0.012 0.000 0.000 0.588 0.400
#> SRR542398 5 0.2280 0.739 0.120 0.000 0.000 0.000 0.880
#> SRR542399 1 0.3796 0.916 0.700 0.000 0.000 0.000 0.300
#> SRR542400 1 0.4218 0.893 0.660 0.000 0.000 0.008 0.332
#> SRR542401 1 0.3796 0.916 0.700 0.000 0.000 0.000 0.300
#> SRR542402 1 0.3837 0.914 0.692 0.000 0.000 0.000 0.308
#> SRR542403 1 0.5973 0.647 0.580 0.000 0.000 0.164 0.256
#> SRR542404 1 0.3796 0.916 0.700 0.000 0.000 0.000 0.300
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> SRR542346 3 0.2264 0.912 0.004 0.012 0.888 NA 0.000 0.000
#> SRR542347 3 0.4438 0.847 0.076 0.024 0.744 NA 0.000 0.000
#> SRR542348 3 0.2264 0.912 0.004 0.012 0.888 NA 0.000 0.000
#> SRR542349 3 0.4453 0.846 0.080 0.024 0.744 NA 0.000 0.000
#> SRR542350 3 0.1926 0.909 0.020 0.000 0.912 NA 0.000 0.000
#> SRR542351 3 0.0000 0.933 0.000 0.000 1.000 NA 0.000 0.000
#> SRR542352 6 0.6449 0.466 0.056 0.168 0.000 NA 0.000 0.512
#> SRR542353 3 0.0260 0.931 0.000 0.000 0.992 NA 0.000 0.000
#> SRR542354 3 0.1655 0.928 0.008 0.008 0.932 NA 0.000 0.000
#> SRR542355 2 0.4897 0.586 0.052 0.684 0.000 NA 0.000 0.040
#> SRR542356 3 0.0000 0.933 0.000 0.000 1.000 NA 0.000 0.000
#> SRR542357 6 0.6449 0.466 0.056 0.168 0.000 NA 0.000 0.512
#> SRR542358 6 0.7937 0.319 0.044 0.104 0.236 NA 0.000 0.380
#> SRR542359 3 0.0260 0.931 0.000 0.000 0.992 NA 0.000 0.000
#> SRR542360 6 0.6338 0.486 0.052 0.180 0.000 NA 0.000 0.536
#> SRR542361 6 0.4370 0.529 0.004 0.016 0.000 NA 0.000 0.536
#> SRR542362 6 0.4274 0.541 0.004 0.012 0.000 NA 0.000 0.552
#> SRR542363 6 0.4141 0.544 0.000 0.012 0.000 NA 0.000 0.556
#> SRR542364 6 0.0000 0.763 0.000 0.000 0.000 NA 0.000 1.000
#> SRR542365 6 0.0363 0.762 0.012 0.000 0.000 NA 0.000 0.988
#> SRR542366 6 0.0000 0.763 0.000 0.000 0.000 NA 0.000 1.000
#> SRR542367 6 0.0363 0.762 0.012 0.000 0.000 NA 0.000 0.988
#> SRR542368 6 0.0000 0.763 0.000 0.000 0.000 NA 0.000 1.000
#> SRR542369 6 0.0363 0.762 0.012 0.000 0.000 NA 0.000 0.988
#> SRR542370 6 0.0363 0.762 0.012 0.000 0.000 NA 0.000 0.988
#> SRR542371 2 0.3111 0.667 0.000 0.820 0.000 NA 0.156 0.008
#> SRR542372 2 0.4705 0.292 0.012 0.564 0.000 NA 0.000 0.396
#> SRR542373 6 0.0000 0.763 0.000 0.000 0.000 NA 0.000 1.000
#> SRR542374 3 0.0000 0.933 0.000 0.000 1.000 NA 0.000 0.000
#> SRR542375 5 0.1049 0.790 0.008 0.032 0.000 NA 0.960 0.000
#> SRR542376 2 0.6012 0.483 0.012 0.480 0.000 NA 0.176 0.000
#> SRR542377 2 0.4360 0.530 0.012 0.576 0.000 NA 0.004 0.004
#> SRR542378 5 0.3419 0.753 0.104 0.000 0.000 NA 0.812 0.000
#> SRR542379 5 0.1950 0.780 0.016 0.028 0.000 NA 0.924 0.000
#> SRR542380 5 0.1789 0.799 0.044 0.000 0.000 NA 0.924 0.000
#> SRR542381 5 0.1644 0.801 0.040 0.000 0.000 NA 0.932 0.000
#> SRR542382 5 0.3419 0.753 0.104 0.000 0.000 NA 0.812 0.000
#> SRR542383 5 0.3419 0.753 0.104 0.000 0.000 NA 0.812 0.000
#> SRR542384 5 0.1549 0.801 0.044 0.000 0.000 NA 0.936 0.000
#> SRR542385 5 0.3161 0.654 0.008 0.216 0.000 NA 0.776 0.000
#> SRR542386 5 0.3989 0.541 0.012 0.280 0.000 NA 0.696 0.000
#> SRR542387 2 0.1851 0.727 0.000 0.928 0.000 NA 0.012 0.036
#> SRR542388 2 0.1844 0.721 0.004 0.924 0.000 NA 0.000 0.048
#> SRR542389 2 0.3924 0.640 0.012 0.772 0.000 NA 0.000 0.052
#> SRR542390 2 0.2454 0.726 0.000 0.884 0.000 NA 0.088 0.020
#> SRR542391 2 0.2505 0.725 0.000 0.880 0.000 NA 0.092 0.020
#> SRR542392 2 0.1863 0.729 0.000 0.920 0.000 NA 0.060 0.016
#> SRR542393 2 0.4451 0.602 0.012 0.732 0.000 NA 0.000 0.092
#> SRR542394 2 0.4494 0.102 0.012 0.512 0.000 NA 0.464 0.000
#> SRR542395 5 0.3812 0.598 0.012 0.248 0.000 NA 0.728 0.000
#> SRR542396 5 0.1196 0.788 0.008 0.040 0.000 NA 0.952 0.000
#> SRR542397 2 0.4061 0.489 0.008 0.664 0.000 NA 0.316 0.000
#> SRR542398 5 0.3419 0.753 0.104 0.000 0.000 NA 0.812 0.000
#> SRR542399 1 0.2454 0.940 0.840 0.000 0.000 NA 0.160 0.000
#> SRR542400 1 0.3385 0.918 0.788 0.000 0.000 NA 0.180 0.000
#> SRR542401 1 0.2454 0.940 0.840 0.000 0.000 NA 0.160 0.000
#> SRR542402 1 0.2706 0.938 0.832 0.000 0.000 NA 0.160 0.000
#> SRR542403 1 0.4563 0.769 0.748 0.108 0.000 NA 0.108 0.000
#> SRR542404 1 0.2454 0.940 0.840 0.000 0.000 NA 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 16804 rows and 59 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.996 0.998 0.5089 0.492 0.492
#> 3 3 0.847 0.957 0.945 0.2279 0.861 0.721
#> 4 4 0.803 0.534 0.826 0.1248 0.930 0.808
#> 5 5 0.786 0.798 0.860 0.0589 0.860 0.582
#> 6 6 0.759 0.822 0.886 0.0466 0.959 0.833
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
#> SRR542346 2 0.000 0.998 0.000 1.000
#> SRR542347 2 0.000 0.998 0.000 1.000
#> SRR542348 2 0.000 0.998 0.000 1.000
#> SRR542349 2 0.000 0.998 0.000 1.000
#> SRR542350 2 0.000 0.998 0.000 1.000
#> SRR542351 2 0.000 0.998 0.000 1.000
#> SRR542352 2 0.000 0.998 0.000 1.000
#> SRR542353 2 0.000 0.998 0.000 1.000
#> SRR542354 2 0.000 0.998 0.000 1.000
#> SRR542355 2 0.295 0.945 0.052 0.948
#> SRR542356 2 0.000 0.998 0.000 1.000
#> SRR542357 2 0.000 0.998 0.000 1.000
#> SRR542358 2 0.000 0.998 0.000 1.000
#> SRR542359 2 0.000 0.998 0.000 1.000
#> SRR542360 2 0.000 0.998 0.000 1.000
#> SRR542361 2 0.000 0.998 0.000 1.000
#> SRR542362 2 0.000 0.998 0.000 1.000
#> SRR542363 2 0.000 0.998 0.000 1.000
#> SRR542364 2 0.000 0.998 0.000 1.000
#> SRR542365 2 0.000 0.998 0.000 1.000
#> SRR542366 2 0.000 0.998 0.000 1.000
#> SRR542367 2 0.000 0.998 0.000 1.000
#> SRR542368 2 0.000 0.998 0.000 1.000
#> SRR542369 2 0.000 0.998 0.000 1.000
#> SRR542370 2 0.000 0.998 0.000 1.000
#> SRR542371 1 0.000 0.998 1.000 0.000
#> SRR542372 1 0.343 0.931 0.936 0.064
#> SRR542373 2 0.000 0.998 0.000 1.000
#> SRR542374 2 0.000 0.998 0.000 1.000
#> SRR542375 1 0.000 0.998 1.000 0.000
#> SRR542376 1 0.000 0.998 1.000 0.000
#> SRR542377 1 0.000 0.998 1.000 0.000
#> SRR542378 1 0.000 0.998 1.000 0.000
#> SRR542379 1 0.000 0.998 1.000 0.000
#> SRR542380 1 0.000 0.998 1.000 0.000
#> SRR542381 1 0.000 0.998 1.000 0.000
#> SRR542382 1 0.000 0.998 1.000 0.000
#> SRR542383 1 0.000 0.998 1.000 0.000
#> SRR542384 1 0.000 0.998 1.000 0.000
#> SRR542385 1 0.000 0.998 1.000 0.000
#> SRR542386 1 0.000 0.998 1.000 0.000
#> SRR542387 1 0.000 0.998 1.000 0.000
#> SRR542388 1 0.000 0.998 1.000 0.000
#> SRR542389 2 0.000 0.998 0.000 1.000
#> SRR542390 1 0.000 0.998 1.000 0.000
#> SRR542391 1 0.000 0.998 1.000 0.000
#> SRR542392 1 0.000 0.998 1.000 0.000
#> SRR542393 2 0.000 0.998 0.000 1.000
#> SRR542394 1 0.000 0.998 1.000 0.000
#> SRR542395 1 0.000 0.998 1.000 0.000
#> SRR542396 1 0.000 0.998 1.000 0.000
#> SRR542397 1 0.000 0.998 1.000 0.000
#> SRR542398 1 0.000 0.998 1.000 0.000
#> SRR542399 1 0.000 0.998 1.000 0.000
#> SRR542400 1 0.000 0.998 1.000 0.000
#> SRR542401 1 0.000 0.998 1.000 0.000
#> SRR542402 1 0.000 0.998 1.000 0.000
#> SRR542403 1 0.000 0.998 1.000 0.000
#> SRR542404 1 0.000 0.998 1.000 0.000
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> SRR542346 3 0.0000 0.972 0.000 0.000 1.000
#> SRR542347 3 0.0000 0.972 0.000 0.000 1.000
#> SRR542348 3 0.0000 0.972 0.000 0.000 1.000
#> SRR542349 3 0.0000 0.972 0.000 0.000 1.000
#> SRR542350 3 0.0000 0.972 0.000 0.000 1.000
#> SRR542351 3 0.0000 0.972 0.000 0.000 1.000
#> SRR542352 3 0.0000 0.972 0.000 0.000 1.000
#> SRR542353 3 0.0000 0.972 0.000 0.000 1.000
#> SRR542354 3 0.0000 0.972 0.000 0.000 1.000
#> SRR542355 3 0.1491 0.940 0.016 0.016 0.968
#> SRR542356 3 0.0000 0.972 0.000 0.000 1.000
#> SRR542357 3 0.0000 0.972 0.000 0.000 1.000
#> SRR542358 3 0.0000 0.972 0.000 0.000 1.000
#> SRR542359 3 0.0000 0.972 0.000 0.000 1.000
#> SRR542360 3 0.0000 0.972 0.000 0.000 1.000
#> SRR542361 2 0.4605 0.957 0.000 0.796 0.204
#> SRR542362 2 0.4605 0.957 0.000 0.796 0.204
#> SRR542363 2 0.4750 0.948 0.000 0.784 0.216
#> SRR542364 2 0.4555 0.958 0.000 0.800 0.200
#> SRR542365 2 0.4291 0.954 0.000 0.820 0.180
#> SRR542366 2 0.4605 0.958 0.000 0.796 0.204
#> SRR542367 2 0.4291 0.954 0.000 0.820 0.180
#> SRR542368 2 0.4654 0.956 0.000 0.792 0.208
#> SRR542369 2 0.4291 0.954 0.000 0.820 0.180
#> SRR542370 2 0.4291 0.954 0.000 0.820 0.180
#> SRR542371 1 0.0000 0.983 1.000 0.000 0.000
#> SRR542372 2 0.3879 0.733 0.152 0.848 0.000
#> SRR542373 2 0.4702 0.953 0.000 0.788 0.212
#> SRR542374 3 0.0000 0.972 0.000 0.000 1.000
#> SRR542375 1 0.0000 0.983 1.000 0.000 0.000
#> SRR542376 1 0.0000 0.983 1.000 0.000 0.000
#> SRR542377 1 0.2796 0.917 0.908 0.092 0.000
#> SRR542378 1 0.0000 0.983 1.000 0.000 0.000
#> SRR542379 1 0.0000 0.983 1.000 0.000 0.000
#> SRR542380 1 0.0000 0.983 1.000 0.000 0.000
#> SRR542381 1 0.0000 0.983 1.000 0.000 0.000
#> SRR542382 1 0.0000 0.983 1.000 0.000 0.000
#> SRR542383 1 0.0000 0.983 1.000 0.000 0.000
#> SRR542384 1 0.0000 0.983 1.000 0.000 0.000
#> SRR542385 1 0.0000 0.983 1.000 0.000 0.000
#> SRR542386 1 0.0000 0.983 1.000 0.000 0.000
#> SRR542387 1 0.3482 0.885 0.872 0.128 0.000
#> SRR542388 1 0.4291 0.844 0.820 0.180 0.000
#> SRR542389 3 0.4291 0.793 0.000 0.180 0.820
#> SRR542390 1 0.0000 0.983 1.000 0.000 0.000
#> SRR542391 1 0.0000 0.983 1.000 0.000 0.000
#> SRR542392 1 0.0892 0.976 0.980 0.020 0.000
#> SRR542393 3 0.4452 0.785 0.000 0.192 0.808
#> SRR542394 1 0.0000 0.983 1.000 0.000 0.000
#> SRR542395 1 0.0000 0.983 1.000 0.000 0.000
#> SRR542396 1 0.0000 0.983 1.000 0.000 0.000
#> SRR542397 1 0.0000 0.983 1.000 0.000 0.000
#> SRR542398 1 0.0000 0.983 1.000 0.000 0.000
#> SRR542399 1 0.0892 0.976 0.980 0.020 0.000
#> SRR542400 1 0.0892 0.976 0.980 0.020 0.000
#> SRR542401 1 0.0892 0.976 0.980 0.020 0.000
#> SRR542402 1 0.0892 0.976 0.980 0.020 0.000
#> SRR542403 1 0.0892 0.976 0.980 0.020 0.000
#> SRR542404 1 0.0892 0.976 0.980 0.020 0.000
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> SRR542346 3 0.0188 0.9438 0.000 0.004 0.996 0.000
#> SRR542347 3 0.0188 0.9438 0.000 0.004 0.996 0.000
#> SRR542348 3 0.0188 0.9438 0.000 0.004 0.996 0.000
#> SRR542349 3 0.0188 0.9438 0.000 0.004 0.996 0.000
#> SRR542350 3 0.0188 0.9438 0.000 0.004 0.996 0.000
#> SRR542351 3 0.0188 0.9438 0.000 0.004 0.996 0.000
#> SRR542352 3 0.0000 0.9419 0.000 0.000 1.000 0.000
#> SRR542353 3 0.0188 0.9438 0.000 0.004 0.996 0.000
#> SRR542354 3 0.0188 0.9438 0.000 0.004 0.996 0.000
#> SRR542355 3 0.1059 0.9227 0.012 0.016 0.972 0.000
#> SRR542356 3 0.0188 0.9438 0.000 0.004 0.996 0.000
#> SRR542357 3 0.0000 0.9419 0.000 0.000 1.000 0.000
#> SRR542358 3 0.0188 0.9438 0.000 0.004 0.996 0.000
#> SRR542359 3 0.0188 0.9438 0.000 0.004 0.996 0.000
#> SRR542360 3 0.0000 0.9419 0.000 0.000 1.000 0.000
#> SRR542361 2 0.4419 0.8959 0.104 0.812 0.084 0.000
#> SRR542362 2 0.4362 0.8987 0.096 0.816 0.088 0.000
#> SRR542363 2 0.4969 0.8687 0.088 0.772 0.140 0.000
#> SRR542364 2 0.2011 0.9276 0.000 0.920 0.080 0.000
#> SRR542365 2 0.0469 0.9234 0.000 0.988 0.012 0.000
#> SRR542366 2 0.2081 0.9269 0.000 0.916 0.084 0.000
#> SRR542367 2 0.0469 0.9234 0.000 0.988 0.012 0.000
#> SRR542368 2 0.2216 0.9243 0.000 0.908 0.092 0.000
#> SRR542369 2 0.0469 0.9234 0.000 0.988 0.012 0.000
#> SRR542370 2 0.0469 0.9234 0.000 0.988 0.012 0.000
#> SRR542371 4 0.4933 0.0222 0.432 0.000 0.000 0.568
#> SRR542372 2 0.2032 0.8884 0.028 0.936 0.000 0.036
#> SRR542373 2 0.2921 0.8954 0.000 0.860 0.140 0.000
#> SRR542374 3 0.0188 0.9438 0.000 0.004 0.996 0.000
#> SRR542375 4 0.4916 0.0687 0.424 0.000 0.000 0.576
#> SRR542376 4 0.4999 -0.2665 0.492 0.000 0.000 0.508
#> SRR542377 1 0.4679 0.4321 0.648 0.000 0.000 0.352
#> SRR542378 4 0.4916 0.0687 0.424 0.000 0.000 0.576
#> SRR542379 4 0.4916 0.0687 0.424 0.000 0.000 0.576
#> SRR542380 4 0.4916 0.0687 0.424 0.000 0.000 0.576
#> SRR542381 4 0.4916 0.0687 0.424 0.000 0.000 0.576
#> SRR542382 4 0.4916 0.0687 0.424 0.000 0.000 0.576
#> SRR542383 4 0.4916 0.0687 0.424 0.000 0.000 0.576
#> SRR542384 4 0.4916 0.0687 0.424 0.000 0.000 0.576
#> SRR542385 4 0.4925 0.0401 0.428 0.000 0.000 0.572
#> SRR542386 4 0.4916 0.0687 0.424 0.000 0.000 0.576
#> SRR542387 1 0.3975 0.4051 0.760 0.000 0.000 0.240
#> SRR542388 4 0.5288 -0.0522 0.472 0.008 0.000 0.520
#> SRR542389 3 0.5602 0.4676 0.472 0.020 0.508 0.000
#> SRR542390 1 0.4972 0.5335 0.544 0.000 0.000 0.456
#> SRR542391 1 0.4961 0.5451 0.552 0.000 0.000 0.448
#> SRR542392 4 0.0592 0.2149 0.016 0.000 0.000 0.984
#> SRR542393 3 0.5774 0.4670 0.464 0.028 0.508 0.000
#> SRR542394 4 0.4916 0.0687 0.424 0.000 0.000 0.576
#> SRR542395 4 0.4916 0.0687 0.424 0.000 0.000 0.576
#> SRR542396 4 0.4916 0.0687 0.424 0.000 0.000 0.576
#> SRR542397 1 0.4996 0.4230 0.516 0.000 0.000 0.484
#> SRR542398 4 0.4916 0.0687 0.424 0.000 0.000 0.576
#> SRR542399 4 0.0000 0.2308 0.000 0.000 0.000 1.000
#> SRR542400 4 0.0000 0.2308 0.000 0.000 0.000 1.000
#> SRR542401 4 0.0000 0.2308 0.000 0.000 0.000 1.000
#> SRR542402 4 0.0000 0.2308 0.000 0.000 0.000 1.000
#> SRR542403 4 0.0000 0.2308 0.000 0.000 0.000 1.000
#> SRR542404 4 0.0000 0.2308 0.000 0.000 0.000 1.000
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> SRR542346 3 0.0000 0.9788 0.000 0.000 1.000 0.000 0.000
#> SRR542347 3 0.0000 0.9788 0.000 0.000 1.000 0.000 0.000
#> SRR542348 3 0.0000 0.9788 0.000 0.000 1.000 0.000 0.000
#> SRR542349 3 0.0000 0.9788 0.000 0.000 1.000 0.000 0.000
#> SRR542350 3 0.0000 0.9788 0.000 0.000 1.000 0.000 0.000
#> SRR542351 3 0.0000 0.9788 0.000 0.000 1.000 0.000 0.000
#> SRR542352 3 0.1740 0.9281 0.000 0.000 0.932 0.056 0.012
#> SRR542353 3 0.0000 0.9788 0.000 0.000 1.000 0.000 0.000
#> SRR542354 3 0.0000 0.9788 0.000 0.000 1.000 0.000 0.000
#> SRR542355 3 0.3857 0.7953 0.000 0.000 0.808 0.084 0.108
#> SRR542356 3 0.0000 0.9788 0.000 0.000 1.000 0.000 0.000
#> SRR542357 3 0.1522 0.9383 0.000 0.000 0.944 0.044 0.012
#> SRR542358 3 0.0000 0.9788 0.000 0.000 1.000 0.000 0.000
#> SRR542359 3 0.0000 0.9788 0.000 0.000 1.000 0.000 0.000
#> SRR542360 3 0.0290 0.9744 0.000 0.000 0.992 0.000 0.008
#> SRR542361 2 0.6889 0.5833 0.000 0.516 0.032 0.168 0.284
#> SRR542362 2 0.7070 0.6064 0.000 0.536 0.056 0.168 0.240
#> SRR542363 2 0.7801 0.5692 0.000 0.484 0.148 0.168 0.200
#> SRR542364 2 0.1952 0.8183 0.000 0.912 0.084 0.000 0.004
#> SRR542365 2 0.0404 0.8203 0.000 0.988 0.012 0.000 0.000
#> SRR542366 2 0.2124 0.8161 0.000 0.900 0.096 0.000 0.004
#> SRR542367 2 0.0290 0.8183 0.000 0.992 0.008 0.000 0.000
#> SRR542368 2 0.2338 0.8069 0.000 0.884 0.112 0.000 0.004
#> SRR542369 2 0.0404 0.8203 0.000 0.988 0.012 0.000 0.000
#> SRR542370 2 0.0404 0.8203 0.000 0.988 0.012 0.000 0.000
#> SRR542371 5 0.4015 0.8143 0.348 0.000 0.000 0.000 0.652
#> SRR542372 2 0.2411 0.7824 0.008 0.884 0.000 0.000 0.108
#> SRR542373 2 0.3266 0.7368 0.000 0.796 0.200 0.000 0.004
#> SRR542374 3 0.0000 0.9788 0.000 0.000 1.000 0.000 0.000
#> SRR542375 5 0.4171 0.8610 0.396 0.000 0.000 0.000 0.604
#> SRR542376 5 0.6219 0.4797 0.292 0.000 0.000 0.176 0.532
#> SRR542377 5 0.5083 0.1411 0.084 0.004 0.000 0.220 0.692
#> SRR542378 5 0.4171 0.8610 0.396 0.000 0.000 0.000 0.604
#> SRR542379 5 0.4321 0.8584 0.396 0.000 0.000 0.004 0.600
#> SRR542380 5 0.4171 0.8610 0.396 0.000 0.000 0.000 0.604
#> SRR542381 5 0.4171 0.8610 0.396 0.000 0.000 0.000 0.604
#> SRR542382 5 0.4171 0.8610 0.396 0.000 0.000 0.000 0.604
#> SRR542383 5 0.4171 0.8610 0.396 0.000 0.000 0.000 0.604
#> SRR542384 5 0.4171 0.8610 0.396 0.000 0.000 0.000 0.604
#> SRR542385 5 0.4321 0.8587 0.396 0.000 0.000 0.004 0.600
#> SRR542386 5 0.4331 0.8552 0.400 0.000 0.000 0.004 0.596
#> SRR542387 5 0.6349 -0.0137 0.160 0.000 0.000 0.412 0.428
#> SRR542388 4 0.3612 0.4187 0.228 0.000 0.000 0.764 0.008
#> SRR542389 4 0.3123 0.5657 0.000 0.004 0.184 0.812 0.000
#> SRR542390 5 0.6622 0.5497 0.364 0.000 0.000 0.220 0.416
#> SRR542391 4 0.6813 -0.4775 0.332 0.000 0.000 0.360 0.308
#> SRR542392 1 0.1281 0.9465 0.956 0.000 0.000 0.032 0.012
#> SRR542393 4 0.3544 0.5547 0.000 0.008 0.200 0.788 0.004
#> SRR542394 5 0.4171 0.8610 0.396 0.000 0.000 0.000 0.604
#> SRR542395 5 0.4182 0.8579 0.400 0.000 0.000 0.000 0.600
#> SRR542396 5 0.4171 0.8610 0.396 0.000 0.000 0.000 0.604
#> SRR542397 5 0.5843 0.7481 0.388 0.000 0.000 0.100 0.512
#> SRR542398 5 0.4171 0.8610 0.396 0.000 0.000 0.000 0.604
#> SRR542399 1 0.0000 0.9911 1.000 0.000 0.000 0.000 0.000
#> SRR542400 1 0.0000 0.9911 1.000 0.000 0.000 0.000 0.000
#> SRR542401 1 0.0000 0.9911 1.000 0.000 0.000 0.000 0.000
#> SRR542402 1 0.0000 0.9911 1.000 0.000 0.000 0.000 0.000
#> SRR542403 1 0.0000 0.9911 1.000 0.000 0.000 0.000 0.000
#> SRR542404 1 0.0000 0.9911 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
#> SRR542346 3 0.0000 0.9455 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR542347 3 0.0000 0.9455 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR542348 3 0.0000 0.9455 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR542349 3 0.0000 0.9455 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR542350 3 0.0000 0.9455 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR542351 3 0.0000 0.9455 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR542352 3 0.3776 0.7677 0.028 0.140 0.796 0.036 0.000 0.000
#> SRR542353 3 0.0000 0.9455 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR542354 3 0.0000 0.9455 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR542355 3 0.6617 0.3771 0.124 0.176 0.544 0.156 0.000 0.000
#> SRR542356 3 0.0000 0.9455 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR542357 3 0.3295 0.8105 0.028 0.108 0.836 0.028 0.000 0.000
#> SRR542358 3 0.0000 0.9455 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR542359 3 0.0000 0.9455 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR542360 3 0.0436 0.9382 0.004 0.004 0.988 0.004 0.000 0.000
#> SRR542361 4 0.3678 0.7549 0.004 0.000 0.024 0.752 0.000 0.220
#> SRR542362 4 0.3816 0.7506 0.000 0.000 0.032 0.728 0.000 0.240
#> SRR542363 4 0.4918 0.6769 0.000 0.000 0.124 0.644 0.000 0.232
#> SRR542364 6 0.2100 0.8241 0.000 0.000 0.112 0.004 0.000 0.884
#> SRR542365 6 0.0000 0.8460 0.000 0.000 0.000 0.000 0.000 1.000
#> SRR542366 6 0.2581 0.8067 0.000 0.000 0.128 0.016 0.000 0.856
#> SRR542367 6 0.0000 0.8460 0.000 0.000 0.000 0.000 0.000 1.000
#> SRR542368 6 0.2346 0.8130 0.000 0.000 0.124 0.008 0.000 0.868
#> SRR542369 6 0.0000 0.8460 0.000 0.000 0.000 0.000 0.000 1.000
#> SRR542370 6 0.0000 0.8460 0.000 0.000 0.000 0.000 0.000 1.000
#> SRR542371 5 0.2476 0.7947 0.072 0.008 0.000 0.032 0.888 0.000
#> SRR542372 6 0.3705 0.7134 0.088 0.016 0.000 0.076 0.004 0.816
#> SRR542373 6 0.3259 0.6787 0.000 0.000 0.216 0.012 0.000 0.772
#> SRR542374 3 0.0000 0.9455 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR542375 5 0.0000 0.8796 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR542376 5 0.4692 0.1785 0.036 0.004 0.000 0.428 0.532 0.000
#> SRR542377 4 0.4737 0.4157 0.080 0.036 0.000 0.724 0.160 0.000
#> SRR542378 5 0.0000 0.8796 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR542379 5 0.0291 0.8769 0.004 0.000 0.000 0.004 0.992 0.000
#> SRR542380 5 0.0000 0.8796 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR542381 5 0.0000 0.8796 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR542382 5 0.0000 0.8796 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR542383 5 0.0000 0.8796 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR542384 5 0.0000 0.8796 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR542385 5 0.0858 0.8687 0.000 0.004 0.000 0.028 0.968 0.000
#> SRR542386 5 0.0777 0.8706 0.000 0.004 0.000 0.024 0.972 0.000
#> SRR542387 5 0.6939 0.0455 0.100 0.304 0.000 0.156 0.440 0.000
#> SRR542388 2 0.2815 0.7790 0.120 0.848 0.000 0.032 0.000 0.000
#> SRR542389 2 0.0692 0.8625 0.000 0.976 0.020 0.000 0.000 0.004
#> SRR542390 5 0.3662 0.7068 0.004 0.172 0.000 0.044 0.780 0.000
#> SRR542391 5 0.4918 0.3698 0.012 0.380 0.000 0.044 0.564 0.000
#> SRR542392 1 0.4433 0.8840 0.720 0.040 0.000 0.028 0.212 0.000
#> SRR542393 2 0.2334 0.8346 0.008 0.904 0.044 0.040 0.000 0.004
#> SRR542394 5 0.0692 0.8730 0.004 0.000 0.000 0.020 0.976 0.000
#> SRR542395 5 0.0508 0.8756 0.004 0.000 0.000 0.012 0.984 0.000
#> SRR542396 5 0.0000 0.8796 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR542397 5 0.2451 0.8137 0.004 0.068 0.000 0.040 0.888 0.000
#> SRR542398 5 0.0000 0.8796 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR542399 1 0.2883 0.9819 0.788 0.000 0.000 0.000 0.212 0.000
#> SRR542400 1 0.2883 0.9819 0.788 0.000 0.000 0.000 0.212 0.000
#> SRR542401 1 0.2883 0.9819 0.788 0.000 0.000 0.000 0.212 0.000
#> SRR542402 1 0.2883 0.9819 0.788 0.000 0.000 0.000 0.212 0.000
#> SRR542403 1 0.2883 0.9819 0.788 0.000 0.000 0.000 0.212 0.000
#> SRR542404 1 0.2883 0.9819 0.788 0.000 0.000 0.000 0.212 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", "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 16804 rows and 59 columns.
#> Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'ATC' method.
#> Subgroups are detected by 'pam' method.
#> Performed in total 1250 partitions by row resampling.
#> Best k for subgroups seems to be 6.
#>
#> Following methods can be applied to this 'ConsensusPartition' object:
#> [1] "cola_report" "collect_classes" "collect_plots"
#> [4] "collect_stats" "colnames" "compare_signatures"
#> [7] "consensus_heatmap" "dimension_reduction" "functional_enrichment"
#> [10] "get_anno_col" "get_anno" "get_classes"
#> [13] "get_consensus" "get_matrix" "get_membership"
#> [16] "get_param" "get_signatures" "get_stats"
#> [19] "is_best_k" "is_stable_k" "membership_heatmap"
#> [22] "ncol" "nrow" "plot_ecdf"
#> [25] "rownames" "select_partition_number" "show"
#> [28] "suggest_best_k" "test_to_known_factors"
collect_plots()
function collects all the plots made from res
for all k
(number of partitions)
into one single page to provide an easy and fast comparison between different k
.
collect_plots(res)
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.769 0.787 0.909 0.4731 0.493 0.493
#> 3 3 0.782 0.926 0.959 0.3416 0.835 0.678
#> 4 4 0.918 0.899 0.961 0.1417 0.919 0.779
#> 5 5 0.901 0.837 0.906 0.0824 0.921 0.730
#> 6 6 0.982 0.927 0.971 0.0567 0.923 0.672
suggest_best_k()
suggests the best \(k\) based on these statistics. The rules are as follows:
suggest_best_k(res)
#> [1] 6
#> attr(,"optional")
#> [1] 4 5
There is also optional best \(k\) = 4 5 that is worth to check.
Following shows the table of the partitions (You need to click the show/hide
code output link to see it). The membership matrix (columns with name p*
)
is inferred by
clue::cl_consensus()
function with the SE
method. Basically the value in the membership matrix
represents the probability to belong to a certain group. The finall class
label for an item is determined with the group with highest probability it
belongs to.
In get_classes()
function, the entropy is calculated from the membership
matrix and the silhouette score is calculated from the consensus matrix.
cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#> class entropy silhouette p1 p2
#> SRR542346 2 1.0000 0.794 0.496 0.504
#> SRR542347 2 1.0000 0.794 0.496 0.504
#> SRR542348 2 1.0000 0.794 0.496 0.504
#> SRR542349 2 1.0000 0.794 0.496 0.504
#> SRR542350 2 1.0000 0.794 0.496 0.504
#> SRR542351 2 1.0000 0.794 0.496 0.504
#> SRR542352 2 0.9909 0.773 0.444 0.556
#> SRR542353 2 1.0000 0.794 0.496 0.504
#> SRR542354 2 1.0000 0.794 0.496 0.504
#> SRR542355 1 1.0000 1.000 0.504 0.496
#> SRR542356 2 1.0000 0.794 0.496 0.504
#> SRR542357 2 1.0000 0.794 0.496 0.504
#> SRR542358 2 1.0000 0.794 0.496 0.504
#> SRR542359 2 1.0000 0.794 0.496 0.504
#> SRR542360 2 1.0000 0.794 0.496 0.504
#> SRR542361 2 0.8909 -0.678 0.308 0.692
#> SRR542362 2 0.0000 0.261 0.000 1.000
#> SRR542363 2 0.8713 0.671 0.292 0.708
#> SRR542364 2 1.0000 0.794 0.496 0.504
#> SRR542365 2 0.0000 0.261 0.000 1.000
#> SRR542366 2 0.7883 0.620 0.236 0.764
#> SRR542367 2 0.1184 0.216 0.016 0.984
#> SRR542368 2 0.9909 0.773 0.444 0.556
#> SRR542369 2 0.0000 0.261 0.000 1.000
#> SRR542370 2 0.0000 0.261 0.000 1.000
#> SRR542371 1 1.0000 1.000 0.504 0.496
#> SRR542372 1 1.0000 1.000 0.504 0.496
#> SRR542373 2 1.0000 0.794 0.496 0.504
#> SRR542374 2 1.0000 0.794 0.496 0.504
#> SRR542375 1 1.0000 1.000 0.504 0.496
#> SRR542376 1 1.0000 1.000 0.504 0.496
#> SRR542377 1 1.0000 1.000 0.504 0.496
#> SRR542378 1 1.0000 1.000 0.504 0.496
#> SRR542379 1 1.0000 1.000 0.504 0.496
#> SRR542380 1 1.0000 1.000 0.504 0.496
#> SRR542381 1 1.0000 1.000 0.504 0.496
#> SRR542382 1 1.0000 1.000 0.504 0.496
#> SRR542383 1 1.0000 1.000 0.504 0.496
#> SRR542384 1 1.0000 1.000 0.504 0.496
#> SRR542385 1 1.0000 1.000 0.504 0.496
#> SRR542386 1 1.0000 1.000 0.504 0.496
#> SRR542387 1 1.0000 1.000 0.504 0.496
#> SRR542388 1 1.0000 1.000 0.504 0.496
#> SRR542389 2 0.0672 0.240 0.008 0.992
#> SRR542390 1 1.0000 1.000 0.504 0.496
#> SRR542391 1 1.0000 1.000 0.504 0.496
#> SRR542392 1 1.0000 1.000 0.504 0.496
#> SRR542393 2 0.9977 -0.958 0.472 0.528
#> SRR542394 1 1.0000 1.000 0.504 0.496
#> SRR542395 1 1.0000 1.000 0.504 0.496
#> SRR542396 1 1.0000 1.000 0.504 0.496
#> SRR542397 1 1.0000 1.000 0.504 0.496
#> SRR542398 1 1.0000 1.000 0.504 0.496
#> SRR542399 1 1.0000 1.000 0.504 0.496
#> SRR542400 1 1.0000 1.000 0.504 0.496
#> SRR542401 1 1.0000 1.000 0.504 0.496
#> SRR542402 1 1.0000 1.000 0.504 0.496
#> SRR542403 1 1.0000 1.000 0.504 0.496
#> SRR542404 1 1.0000 1.000 0.504 0.496
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> SRR542346 3 0.0000 1.000 0.000 0.000 1.000
#> SRR542347 3 0.0000 1.000 0.000 0.000 1.000
#> SRR542348 3 0.0000 1.000 0.000 0.000 1.000
#> SRR542349 3 0.0000 1.000 0.000 0.000 1.000
#> SRR542350 3 0.0000 1.000 0.000 0.000 1.000
#> SRR542351 3 0.0000 1.000 0.000 0.000 1.000
#> SRR542352 2 0.0000 0.973 0.000 1.000 0.000
#> SRR542353 3 0.0000 1.000 0.000 0.000 1.000
#> SRR542354 3 0.0000 1.000 0.000 0.000 1.000
#> SRR542355 2 0.5678 0.446 0.316 0.684 0.000
#> SRR542356 3 0.0000 1.000 0.000 0.000 1.000
#> SRR542357 2 0.0000 0.973 0.000 1.000 0.000
#> SRR542358 3 0.0000 1.000 0.000 0.000 1.000
#> SRR542359 3 0.0000 1.000 0.000 0.000 1.000
#> SRR542360 2 0.0000 0.973 0.000 1.000 0.000
#> SRR542361 2 0.0000 0.973 0.000 1.000 0.000
#> SRR542362 2 0.0000 0.973 0.000 1.000 0.000
#> SRR542363 2 0.0000 0.973 0.000 1.000 0.000
#> SRR542364 2 0.1860 0.916 0.000 0.948 0.052
#> SRR542365 2 0.0000 0.973 0.000 1.000 0.000
#> SRR542366 2 0.0000 0.973 0.000 1.000 0.000
#> SRR542367 2 0.0000 0.973 0.000 1.000 0.000
#> SRR542368 2 0.0000 0.973 0.000 1.000 0.000
#> SRR542369 2 0.0000 0.973 0.000 1.000 0.000
#> SRR542370 2 0.0000 0.973 0.000 1.000 0.000
#> SRR542371 1 0.4654 0.818 0.792 0.208 0.000
#> SRR542372 2 0.0000 0.973 0.000 1.000 0.000
#> SRR542373 2 0.0000 0.973 0.000 1.000 0.000
#> SRR542374 3 0.0000 1.000 0.000 0.000 1.000
#> SRR542375 1 0.0000 0.920 1.000 0.000 0.000
#> SRR542376 1 0.4654 0.818 0.792 0.208 0.000
#> SRR542377 1 0.4654 0.818 0.792 0.208 0.000
#> SRR542378 1 0.0000 0.920 1.000 0.000 0.000
#> SRR542379 1 0.0000 0.920 1.000 0.000 0.000
#> SRR542380 1 0.0000 0.920 1.000 0.000 0.000
#> SRR542381 1 0.0000 0.920 1.000 0.000 0.000
#> SRR542382 1 0.0000 0.920 1.000 0.000 0.000
#> SRR542383 1 0.0000 0.920 1.000 0.000 0.000
#> SRR542384 1 0.0000 0.920 1.000 0.000 0.000
#> SRR542385 1 0.0000 0.920 1.000 0.000 0.000
#> SRR542386 1 0.0424 0.918 0.992 0.008 0.000
#> SRR542387 1 0.4654 0.818 0.792 0.208 0.000
#> SRR542388 1 0.4654 0.818 0.792 0.208 0.000
#> SRR542389 2 0.0000 0.973 0.000 1.000 0.000
#> SRR542390 1 0.4654 0.818 0.792 0.208 0.000
#> SRR542391 1 0.4654 0.818 0.792 0.208 0.000
#> SRR542392 1 0.4654 0.818 0.792 0.208 0.000
#> SRR542393 2 0.0000 0.973 0.000 1.000 0.000
#> SRR542394 1 0.0892 0.914 0.980 0.020 0.000
#> SRR542395 1 0.0000 0.920 1.000 0.000 0.000
#> SRR542396 1 0.0000 0.920 1.000 0.000 0.000
#> SRR542397 1 0.4654 0.818 0.792 0.208 0.000
#> SRR542398 1 0.0000 0.920 1.000 0.000 0.000
#> SRR542399 1 0.0000 0.920 1.000 0.000 0.000
#> SRR542400 1 0.0000 0.920 1.000 0.000 0.000
#> SRR542401 1 0.0000 0.920 1.000 0.000 0.000
#> SRR542402 1 0.0000 0.920 1.000 0.000 0.000
#> SRR542403 1 0.3752 0.856 0.856 0.144 0.000
#> SRR542404 1 0.0000 0.920 1.000 0.000 0.000
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> SRR542346 3 0.0000 1.000 0.000 0.000 1 0.000
#> SRR542347 3 0.0000 1.000 0.000 0.000 1 0.000
#> SRR542348 3 0.0000 1.000 0.000 0.000 1 0.000
#> SRR542349 3 0.0000 1.000 0.000 0.000 1 0.000
#> SRR542350 3 0.0000 1.000 0.000 0.000 1 0.000
#> SRR542351 3 0.0000 1.000 0.000 0.000 1 0.000
#> SRR542352 2 0.0000 0.975 0.000 1.000 0 0.000
#> SRR542353 3 0.0000 1.000 0.000 0.000 1 0.000
#> SRR542354 3 0.0000 1.000 0.000 0.000 1 0.000
#> SRR542355 2 0.4500 0.488 0.000 0.684 0 0.316
#> SRR542356 3 0.0000 1.000 0.000 0.000 1 0.000
#> SRR542357 2 0.0000 0.975 0.000 1.000 0 0.000
#> SRR542358 3 0.0000 1.000 0.000 0.000 1 0.000
#> SRR542359 3 0.0000 1.000 0.000 0.000 1 0.000
#> SRR542360 2 0.0000 0.975 0.000 1.000 0 0.000
#> SRR542361 2 0.0000 0.975 0.000 1.000 0 0.000
#> SRR542362 2 0.0000 0.975 0.000 1.000 0 0.000
#> SRR542363 2 0.0000 0.975 0.000 1.000 0 0.000
#> SRR542364 2 0.0000 0.975 0.000 1.000 0 0.000
#> SRR542365 2 0.0000 0.975 0.000 1.000 0 0.000
#> SRR542366 2 0.0000 0.975 0.000 1.000 0 0.000
#> SRR542367 2 0.0000 0.975 0.000 1.000 0 0.000
#> SRR542368 2 0.0000 0.975 0.000 1.000 0 0.000
#> SRR542369 2 0.0000 0.975 0.000 1.000 0 0.000
#> SRR542370 2 0.0000 0.975 0.000 1.000 0 0.000
#> SRR542371 4 0.0000 0.916 0.000 0.000 0 1.000
#> SRR542372 2 0.0000 0.975 0.000 1.000 0 0.000
#> SRR542373 2 0.0000 0.975 0.000 1.000 0 0.000
#> SRR542374 3 0.0000 1.000 0.000 0.000 1 0.000
#> SRR542375 4 0.0000 0.916 0.000 0.000 0 1.000
#> SRR542376 4 0.0000 0.916 0.000 0.000 0 1.000
#> SRR542377 4 0.0000 0.916 0.000 0.000 0 1.000
#> SRR542378 4 0.4843 0.418 0.396 0.000 0 0.604
#> SRR542379 4 0.0000 0.916 0.000 0.000 0 1.000
#> SRR542380 4 0.0469 0.907 0.012 0.000 0 0.988
#> SRR542381 4 0.0000 0.916 0.000 0.000 0 1.000
#> SRR542382 4 0.4855 0.410 0.400 0.000 0 0.600
#> SRR542383 4 0.4855 0.410 0.400 0.000 0 0.600
#> SRR542384 4 0.0000 0.916 0.000 0.000 0 1.000
#> SRR542385 4 0.0000 0.916 0.000 0.000 0 1.000
#> SRR542386 4 0.0000 0.916 0.000 0.000 0 1.000
#> SRR542387 4 0.0000 0.916 0.000 0.000 0 1.000
#> SRR542388 4 0.0592 0.901 0.000 0.016 0 0.984
#> SRR542389 2 0.0000 0.975 0.000 1.000 0 0.000
#> SRR542390 4 0.0000 0.916 0.000 0.000 0 1.000
#> SRR542391 4 0.0000 0.916 0.000 0.000 0 1.000
#> SRR542392 4 0.0000 0.916 0.000 0.000 0 1.000
#> SRR542393 2 0.0000 0.975 0.000 1.000 0 0.000
#> SRR542394 4 0.0000 0.916 0.000 0.000 0 1.000
#> SRR542395 4 0.0000 0.916 0.000 0.000 0 1.000
#> SRR542396 4 0.0000 0.916 0.000 0.000 0 1.000
#> SRR542397 4 0.0000 0.916 0.000 0.000 0 1.000
#> SRR542398 4 0.4855 0.410 0.400 0.000 0 0.600
#> SRR542399 1 0.0000 0.908 1.000 0.000 0 0.000
#> SRR542400 1 0.0000 0.908 1.000 0.000 0 0.000
#> SRR542401 1 0.0000 0.908 1.000 0.000 0 0.000
#> SRR542402 1 0.0000 0.908 1.000 0.000 0 0.000
#> SRR542403 1 0.4730 0.395 0.636 0.000 0 0.364
#> SRR542404 1 0.0000 0.908 1.000 0.000 0 0.000
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> SRR542346 3 0.000 1.00000 0.000 0.000 1 0.000 0.000
#> SRR542347 3 0.000 1.00000 0.000 0.000 1 0.000 0.000
#> SRR542348 3 0.000 1.00000 0.000 0.000 1 0.000 0.000
#> SRR542349 3 0.000 1.00000 0.000 0.000 1 0.000 0.000
#> SRR542350 3 0.000 1.00000 0.000 0.000 1 0.000 0.000
#> SRR542351 3 0.000 1.00000 0.000 0.000 1 0.000 0.000
#> SRR542352 2 0.000 0.93647 0.000 1.000 0 0.000 0.000
#> SRR542353 3 0.000 1.00000 0.000 0.000 1 0.000 0.000
#> SRR542354 3 0.000 1.00000 0.000 0.000 1 0.000 0.000
#> SRR542355 5 0.530 -0.00031 0.060 0.360 0 0.000 0.580
#> SRR542356 3 0.000 1.00000 0.000 0.000 1 0.000 0.000
#> SRR542357 2 0.000 0.93647 0.000 1.000 0 0.000 0.000
#> SRR542358 3 0.000 1.00000 0.000 0.000 1 0.000 0.000
#> SRR542359 3 0.000 1.00000 0.000 0.000 1 0.000 0.000
#> SRR542360 2 0.120 0.90529 0.000 0.952 0 0.000 0.048
#> SRR542361 2 0.460 0.69849 0.052 0.708 0 0.000 0.240
#> SRR542362 2 0.000 0.93647 0.000 1.000 0 0.000 0.000
#> SRR542363 2 0.000 0.93647 0.000 1.000 0 0.000 0.000
#> SRR542364 2 0.000 0.93647 0.000 1.000 0 0.000 0.000
#> SRR542365 2 0.000 0.93647 0.000 1.000 0 0.000 0.000
#> SRR542366 2 0.000 0.93647 0.000 1.000 0 0.000 0.000
#> SRR542367 2 0.000 0.93647 0.000 1.000 0 0.000 0.000
#> SRR542368 2 0.000 0.93647 0.000 1.000 0 0.000 0.000
#> SRR542369 2 0.000 0.93647 0.000 1.000 0 0.000 0.000
#> SRR542370 2 0.000 0.93647 0.000 1.000 0 0.000 0.000
#> SRR542371 5 0.356 0.84108 0.260 0.000 0 0.000 0.740
#> SRR542372 2 0.000 0.93647 0.000 1.000 0 0.000 0.000
#> SRR542373 2 0.000 0.93647 0.000 1.000 0 0.000 0.000
#> SRR542374 3 0.000 1.00000 0.000 0.000 1 0.000 0.000
#> SRR542375 5 0.359 0.84264 0.264 0.000 0 0.000 0.736
#> SRR542376 5 0.359 0.84264 0.264 0.000 0 0.000 0.736
#> SRR542377 5 0.141 0.67048 0.060 0.000 0 0.000 0.940
#> SRR542378 4 0.000 0.72297 0.000 0.000 0 1.000 0.000
#> SRR542379 5 0.359 0.84264 0.264 0.000 0 0.000 0.736
#> SRR542380 4 0.534 0.52685 0.252 0.000 0 0.648 0.100
#> SRR542381 4 0.511 0.53668 0.264 0.000 0 0.660 0.076
#> SRR542382 4 0.000 0.72297 0.000 0.000 0 1.000 0.000
#> SRR542383 4 0.000 0.72297 0.000 0.000 0 1.000 0.000
#> SRR542384 5 0.359 0.84264 0.264 0.000 0 0.000 0.736
#> SRR542385 5 0.359 0.84264 0.264 0.000 0 0.000 0.736
#> SRR542386 5 0.359 0.84264 0.264 0.000 0 0.000 0.736
#> SRR542387 5 0.141 0.67048 0.060 0.000 0 0.000 0.940
#> SRR542388 5 0.141 0.67048 0.060 0.000 0 0.000 0.940
#> SRR542389 2 0.488 0.66588 0.060 0.676 0 0.000 0.264
#> SRR542390 5 0.359 0.84264 0.264 0.000 0 0.000 0.736
#> SRR542391 5 0.000 0.70678 0.000 0.000 0 0.000 1.000
#> SRR542392 5 0.141 0.67048 0.060 0.000 0 0.000 0.940
#> SRR542393 2 0.488 0.66588 0.060 0.676 0 0.000 0.264
#> SRR542394 5 0.359 0.84264 0.264 0.000 0 0.000 0.736
#> SRR542395 5 0.359 0.84264 0.264 0.000 0 0.000 0.736
#> SRR542396 5 0.359 0.84264 0.264 0.000 0 0.000 0.736
#> SRR542397 5 0.359 0.84264 0.264 0.000 0 0.000 0.736
#> SRR542398 4 0.000 0.72297 0.000 0.000 0 1.000 0.000
#> SRR542399 1 0.391 0.88311 0.676 0.000 0 0.324 0.000
#> SRR542400 1 0.391 0.88311 0.676 0.000 0 0.324 0.000
#> SRR542401 1 0.391 0.88311 0.676 0.000 0 0.324 0.000
#> SRR542402 1 0.391 0.88311 0.676 0.000 0 0.324 0.000
#> SRR542403 1 0.201 0.41086 0.920 0.000 0 0.020 0.060
#> SRR542404 1 0.391 0.88311 0.676 0.000 0 0.324 0.000
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> SRR542346 3 0.0000 0.99083 0.000 0.000 1.0 0.000 0.000 0.000
#> SRR542347 3 0.0000 0.99083 0.000 0.000 1.0 0.000 0.000 0.000
#> SRR542348 3 0.0000 0.99083 0.000 0.000 1.0 0.000 0.000 0.000
#> SRR542349 3 0.0000 0.99083 0.000 0.000 1.0 0.000 0.000 0.000
#> SRR542350 3 0.0000 0.99083 0.000 0.000 1.0 0.000 0.000 0.000
#> SRR542351 3 0.0000 0.99083 0.000 0.000 1.0 0.000 0.000 0.000
#> SRR542352 6 0.1007 0.93041 0.000 0.044 0.0 0.000 0.000 0.956
#> SRR542353 3 0.0000 0.99083 0.000 0.000 1.0 0.000 0.000 0.000
#> SRR542354 3 0.0000 0.99083 0.000 0.000 1.0 0.000 0.000 0.000
#> SRR542355 2 0.0000 0.87196 0.000 1.000 0.0 0.000 0.000 0.000
#> SRR542356 3 0.0000 0.99083 0.000 0.000 1.0 0.000 0.000 0.000
#> SRR542357 6 0.1007 0.93041 0.000 0.044 0.0 0.000 0.000 0.956
#> SRR542358 3 0.1814 0.89319 0.000 0.100 0.9 0.000 0.000 0.000
#> SRR542359 3 0.0000 0.99083 0.000 0.000 1.0 0.000 0.000 0.000
#> SRR542360 2 0.3864 0.00438 0.000 0.520 0.0 0.000 0.000 0.480
#> SRR542361 6 0.3684 0.35421 0.000 0.372 0.0 0.000 0.000 0.628
#> SRR542362 6 0.0000 0.96152 0.000 0.000 0.0 0.000 0.000 1.000
#> SRR542363 6 0.0000 0.96152 0.000 0.000 0.0 0.000 0.000 1.000
#> SRR542364 6 0.0000 0.96152 0.000 0.000 0.0 0.000 0.000 1.000
#> SRR542365 6 0.0000 0.96152 0.000 0.000 0.0 0.000 0.000 1.000
#> SRR542366 6 0.0000 0.96152 0.000 0.000 0.0 0.000 0.000 1.000
#> SRR542367 6 0.0000 0.96152 0.000 0.000 0.0 0.000 0.000 1.000
#> SRR542368 6 0.0000 0.96152 0.000 0.000 0.0 0.000 0.000 1.000
#> SRR542369 6 0.0000 0.96152 0.000 0.000 0.0 0.000 0.000 1.000
#> SRR542370 6 0.0000 0.96152 0.000 0.000 0.0 0.000 0.000 1.000
#> SRR542371 4 0.0146 0.99277 0.000 0.004 0.0 0.996 0.000 0.000
#> SRR542372 6 0.0000 0.96152 0.000 0.000 0.0 0.000 0.000 1.000
#> SRR542373 6 0.0000 0.96152 0.000 0.000 0.0 0.000 0.000 1.000
#> SRR542374 3 0.0000 0.99083 0.000 0.000 1.0 0.000 0.000 0.000
#> SRR542375 4 0.0000 0.99583 0.000 0.000 0.0 1.000 0.000 0.000
#> SRR542376 4 0.0146 0.99259 0.000 0.004 0.0 0.996 0.000 0.000
#> SRR542377 2 0.1007 0.88748 0.000 0.956 0.0 0.044 0.000 0.000
#> SRR542378 5 0.0000 0.92562 0.000 0.000 0.0 0.000 1.000 0.000
#> SRR542379 4 0.0000 0.99583 0.000 0.000 0.0 1.000 0.000 0.000
#> SRR542380 5 0.1075 0.89727 0.000 0.000 0.0 0.048 0.952 0.000
#> SRR542381 5 0.3126 0.67653 0.000 0.000 0.0 0.248 0.752 0.000
#> SRR542382 5 0.0000 0.92562 0.000 0.000 0.0 0.000 1.000 0.000
#> SRR542383 5 0.0000 0.92562 0.000 0.000 0.0 0.000 1.000 0.000
#> SRR542384 4 0.0000 0.99583 0.000 0.000 0.0 1.000 0.000 0.000
#> SRR542385 4 0.0000 0.99583 0.000 0.000 0.0 1.000 0.000 0.000
#> SRR542386 4 0.0000 0.99583 0.000 0.000 0.0 1.000 0.000 0.000
#> SRR542387 2 0.1007 0.88748 0.000 0.956 0.0 0.044 0.000 0.000
#> SRR542388 2 0.1007 0.88748 0.000 0.956 0.0 0.044 0.000 0.000
#> SRR542389 2 0.0000 0.87196 0.000 1.000 0.0 0.000 0.000 0.000
#> SRR542390 4 0.0790 0.96337 0.000 0.032 0.0 0.968 0.000 0.000
#> SRR542391 2 0.1910 0.83105 0.000 0.892 0.0 0.108 0.000 0.000
#> SRR542392 2 0.1075 0.88553 0.000 0.952 0.0 0.048 0.000 0.000
#> SRR542393 2 0.0865 0.86618 0.000 0.964 0.0 0.000 0.000 0.036
#> SRR542394 4 0.0000 0.99583 0.000 0.000 0.0 1.000 0.000 0.000
#> SRR542395 4 0.0000 0.99583 0.000 0.000 0.0 1.000 0.000 0.000
#> SRR542396 4 0.0000 0.99583 0.000 0.000 0.0 1.000 0.000 0.000
#> SRR542397 4 0.0000 0.99583 0.000 0.000 0.0 1.000 0.000 0.000
#> SRR542398 5 0.0000 0.92562 0.000 0.000 0.0 0.000 1.000 0.000
#> SRR542399 1 0.0000 0.99157 1.000 0.000 0.0 0.000 0.000 0.000
#> SRR542400 1 0.0000 0.99157 1.000 0.000 0.0 0.000 0.000 0.000
#> SRR542401 1 0.0000 0.99157 1.000 0.000 0.0 0.000 0.000 0.000
#> SRR542402 1 0.0000 0.99157 1.000 0.000 0.0 0.000 0.000 0.000
#> SRR542403 1 0.0790 0.95723 0.968 0.000 0.0 0.032 0.000 0.000
#> SRR542404 1 0.0000 0.99157 1.000 0.000 0.0 0.000 0.000 0.000
Heatmaps for the consensus matrix. It visualizes the probability of two samples to be in a same group.
consensus_heatmap(res, k = 2)
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", "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 16804 rows and 59 columns.
#> Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'ATC' method.
#> Subgroups are detected by 'mclust' method.
#> Performed in total 1250 partitions by row resampling.
#> Best k for subgroups seems to be 3.
#>
#> Following methods can be applied to this 'ConsensusPartition' object:
#> [1] "cola_report" "collect_classes" "collect_plots"
#> [4] "collect_stats" "colnames" "compare_signatures"
#> [7] "consensus_heatmap" "dimension_reduction" "functional_enrichment"
#> [10] "get_anno_col" "get_anno" "get_classes"
#> [13] "get_consensus" "get_matrix" "get_membership"
#> [16] "get_param" "get_signatures" "get_stats"
#> [19] "is_best_k" "is_stable_k" "membership_heatmap"
#> [22] "ncol" "nrow" "plot_ecdf"
#> [25] "rownames" "select_partition_number" "show"
#> [28] "suggest_best_k" "test_to_known_factors"
collect_plots()
function collects all the plots made from res
for all k
(number of partitions)
into one single page to provide an easy and fast comparison between different k
.
collect_plots(res)
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.240 0.635 0.741 0.3853 0.516 0.516
#> 3 3 0.494 0.838 0.867 0.5538 0.534 0.329
#> 4 4 0.511 0.641 0.778 0.1648 0.664 0.347
#> 5 5 0.538 0.499 0.718 0.0857 0.853 0.576
#> 6 6 0.695 0.674 0.793 0.0795 0.809 0.386
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
#> SRR542346 2 0.9795 0.768 0.416 0.584
#> SRR542347 2 0.9795 0.768 0.416 0.584
#> SRR542348 2 0.9795 0.768 0.416 0.584
#> SRR542349 2 0.9795 0.768 0.416 0.584
#> SRR542350 2 0.9795 0.768 0.416 0.584
#> SRR542351 2 0.9795 0.768 0.416 0.584
#> SRR542352 2 0.8608 0.766 0.284 0.716
#> SRR542353 2 0.9795 0.768 0.416 0.584
#> SRR542354 2 0.9795 0.768 0.416 0.584
#> SRR542355 2 0.8608 0.766 0.284 0.716
#> SRR542356 2 0.9795 0.768 0.416 0.584
#> SRR542357 2 0.9552 0.774 0.376 0.624
#> SRR542358 2 0.9795 0.769 0.416 0.584
#> SRR542359 2 0.9795 0.768 0.416 0.584
#> SRR542360 2 0.8608 0.766 0.284 0.716
#> SRR542361 2 0.9833 0.767 0.424 0.576
#> SRR542362 2 0.9833 0.767 0.424 0.576
#> SRR542363 2 0.9833 0.767 0.424 0.576
#> SRR542364 1 0.0000 0.645 1.000 0.000
#> SRR542365 1 0.0000 0.645 1.000 0.000
#> SRR542366 1 0.0000 0.645 1.000 0.000
#> SRR542367 1 0.0000 0.645 1.000 0.000
#> SRR542368 1 0.9209 -0.460 0.664 0.336
#> SRR542369 1 0.0000 0.645 1.000 0.000
#> SRR542370 1 0.0000 0.645 1.000 0.000
#> SRR542371 1 0.8327 0.430 0.736 0.264
#> SRR542372 1 0.0000 0.645 1.000 0.000
#> SRR542373 1 0.0672 0.638 0.992 0.008
#> SRR542374 2 0.9795 0.768 0.416 0.584
#> SRR542375 2 0.9775 0.688 0.412 0.588
#> SRR542376 2 0.8499 0.763 0.276 0.724
#> SRR542377 2 0.8608 0.766 0.284 0.716
#> SRR542378 2 0.9775 0.688 0.412 0.588
#> SRR542379 2 0.8499 0.763 0.276 0.724
#> SRR542380 2 0.9775 0.688 0.412 0.588
#> SRR542381 2 0.9775 0.688 0.412 0.588
#> SRR542382 2 0.9775 0.688 0.412 0.588
#> SRR542383 2 0.9775 0.688 0.412 0.588
#> SRR542384 2 0.9775 0.688 0.412 0.588
#> SRR542385 2 0.9850 0.681 0.428 0.572
#> SRR542386 2 0.9850 0.681 0.428 0.572
#> SRR542387 2 0.9522 0.729 0.372 0.628
#> SRR542388 1 0.6438 0.628 0.836 0.164
#> SRR542389 1 0.6438 0.628 0.836 0.164
#> SRR542390 1 0.6343 0.629 0.840 0.160
#> SRR542391 1 0.6343 0.629 0.840 0.160
#> SRR542392 1 0.6438 0.628 0.836 0.164
#> SRR542393 1 0.9977 -0.429 0.528 0.472
#> SRR542394 2 0.9850 0.681 0.428 0.572
#> SRR542395 2 0.9850 0.681 0.428 0.572
#> SRR542396 2 0.9850 0.681 0.428 0.572
#> SRR542397 1 0.9977 -0.430 0.528 0.472
#> SRR542398 2 0.9795 0.681 0.416 0.584
#> SRR542399 1 0.9909 0.586 0.556 0.444
#> SRR542400 1 0.9909 0.586 0.556 0.444
#> SRR542401 1 0.9909 0.586 0.556 0.444
#> SRR542402 1 0.9909 0.586 0.556 0.444
#> SRR542403 1 0.9393 0.615 0.644 0.356
#> SRR542404 1 0.9909 0.586 0.556 0.444
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> SRR542346 3 0.1860 0.851 0.052 0.000 0.948
#> SRR542347 3 0.1860 0.851 0.052 0.000 0.948
#> SRR542348 3 0.1860 0.851 0.052 0.000 0.948
#> SRR542349 3 0.0237 0.850 0.004 0.000 0.996
#> SRR542350 3 0.1753 0.851 0.048 0.000 0.952
#> SRR542351 3 0.1860 0.851 0.052 0.000 0.948
#> SRR542352 3 0.1989 0.849 0.004 0.048 0.948
#> SRR542353 3 0.1860 0.851 0.052 0.000 0.948
#> SRR542354 3 0.1753 0.851 0.048 0.000 0.952
#> SRR542355 3 0.1989 0.849 0.004 0.048 0.948
#> SRR542356 3 0.1753 0.851 0.048 0.000 0.952
#> SRR542357 3 0.5929 0.446 0.004 0.320 0.676
#> SRR542358 3 0.1753 0.849 0.000 0.048 0.952
#> SRR542359 3 0.1753 0.851 0.048 0.000 0.952
#> SRR542360 3 0.1989 0.849 0.004 0.048 0.948
#> SRR542361 2 0.6151 0.832 0.160 0.772 0.068
#> SRR542362 2 0.6151 0.832 0.160 0.772 0.068
#> SRR542363 2 0.6151 0.832 0.160 0.772 0.068
#> SRR542364 2 0.5241 0.854 0.132 0.820 0.048
#> SRR542365 2 0.3375 0.853 0.044 0.908 0.048
#> SRR542366 2 0.5791 0.834 0.168 0.784 0.048
#> SRR542367 2 0.4165 0.856 0.076 0.876 0.048
#> SRR542368 3 0.7078 0.656 0.088 0.200 0.712
#> SRR542369 2 0.6159 0.831 0.196 0.756 0.048
#> SRR542370 2 0.5901 0.841 0.176 0.776 0.048
#> SRR542371 2 0.2280 0.869 0.008 0.940 0.052
#> SRR542372 2 0.5371 0.773 0.140 0.812 0.048
#> SRR542373 2 0.6229 0.828 0.172 0.764 0.064
#> SRR542374 3 0.1860 0.851 0.052 0.000 0.948
#> SRR542375 2 0.3551 0.832 0.000 0.868 0.132
#> SRR542376 2 0.4291 0.799 0.000 0.820 0.180
#> SRR542377 3 0.1964 0.847 0.000 0.056 0.944
#> SRR542378 2 0.1643 0.869 0.000 0.956 0.044
#> SRR542379 2 0.4062 0.808 0.000 0.836 0.164
#> SRR542380 2 0.3686 0.827 0.000 0.860 0.140
#> SRR542381 2 0.3551 0.832 0.000 0.868 0.132
#> SRR542382 2 0.0237 0.869 0.000 0.996 0.004
#> SRR542383 2 0.2625 0.858 0.000 0.916 0.084
#> SRR542384 2 0.0237 0.869 0.000 0.996 0.004
#> SRR542385 2 0.0475 0.868 0.004 0.992 0.004
#> SRR542386 2 0.3572 0.821 0.060 0.900 0.040
#> SRR542387 3 0.1989 0.849 0.004 0.048 0.948
#> SRR542388 3 0.7558 0.642 0.144 0.164 0.692
#> SRR542389 3 0.6191 0.735 0.084 0.140 0.776
#> SRR542390 2 0.3369 0.853 0.040 0.908 0.052
#> SRR542391 3 0.6850 0.662 0.072 0.208 0.720
#> SRR542392 3 0.6714 0.716 0.140 0.112 0.748
#> SRR542393 3 0.7047 0.654 0.084 0.204 0.712
#> SRR542394 2 0.0237 0.869 0.000 0.996 0.004
#> SRR542395 2 0.1711 0.859 0.032 0.960 0.008
#> SRR542396 2 0.0237 0.869 0.000 0.996 0.004
#> SRR542397 2 0.1711 0.859 0.032 0.960 0.008
#> SRR542398 2 0.0237 0.869 0.000 0.996 0.004
#> SRR542399 1 0.4002 0.999 0.840 0.160 0.000
#> SRR542400 1 0.4002 0.999 0.840 0.160 0.000
#> SRR542401 1 0.4002 0.999 0.840 0.160 0.000
#> SRR542402 1 0.4002 0.999 0.840 0.160 0.000
#> SRR542403 1 0.4233 0.994 0.836 0.160 0.004
#> SRR542404 1 0.4002 0.999 0.840 0.160 0.000
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> SRR542346 3 0.0000 0.980 0.000 0.000 1.000 0.000
#> SRR542347 3 0.0992 0.964 0.008 0.012 0.976 0.004
#> SRR542348 3 0.0000 0.980 0.000 0.000 1.000 0.000
#> SRR542349 3 0.2380 0.893 0.008 0.064 0.920 0.008
#> SRR542350 3 0.2060 0.929 0.052 0.016 0.932 0.000
#> SRR542351 3 0.0000 0.980 0.000 0.000 1.000 0.000
#> SRR542352 2 0.7204 0.375 0.060 0.584 0.304 0.052
#> SRR542353 3 0.0000 0.980 0.000 0.000 1.000 0.000
#> SRR542354 3 0.0000 0.980 0.000 0.000 1.000 0.000
#> SRR542355 4 0.8782 0.334 0.040 0.284 0.312 0.364
#> SRR542356 3 0.0000 0.980 0.000 0.000 1.000 0.000
#> SRR542357 4 0.8823 0.344 0.044 0.288 0.292 0.376
#> SRR542358 2 0.6101 0.313 0.052 0.560 0.388 0.000
#> SRR542359 3 0.0000 0.980 0.000 0.000 1.000 0.000
#> SRR542360 4 0.8833 0.336 0.044 0.280 0.308 0.368
#> SRR542361 4 0.8588 0.326 0.036 0.368 0.224 0.372
#> SRR542362 4 0.8588 0.326 0.036 0.368 0.224 0.372
#> SRR542363 4 0.8588 0.326 0.036 0.368 0.224 0.372
#> SRR542364 2 0.1388 0.692 0.012 0.960 0.000 0.028
#> SRR542365 2 0.1302 0.708 0.044 0.956 0.000 0.000
#> SRR542366 2 0.1388 0.692 0.012 0.960 0.000 0.028
#> SRR542367 2 0.0657 0.696 0.012 0.984 0.000 0.004
#> SRR542368 2 0.4520 0.713 0.080 0.832 0.032 0.056
#> SRR542369 2 0.0000 0.693 0.000 1.000 0.000 0.000
#> SRR542370 2 0.0000 0.693 0.000 1.000 0.000 0.000
#> SRR542371 2 0.4957 0.656 0.048 0.748 0.000 0.204
#> SRR542372 2 0.1557 0.709 0.056 0.944 0.000 0.000
#> SRR542373 2 0.7148 -0.112 0.012 0.572 0.124 0.292
#> SRR542374 3 0.0000 0.980 0.000 0.000 1.000 0.000
#> SRR542375 4 0.1398 0.589 0.004 0.040 0.000 0.956
#> SRR542376 4 0.6586 0.510 0.036 0.176 0.100 0.688
#> SRR542377 4 0.8709 0.371 0.044 0.276 0.260 0.420
#> SRR542378 4 0.1211 0.590 0.000 0.040 0.000 0.960
#> SRR542379 4 0.3861 0.569 0.008 0.056 0.080 0.856
#> SRR542380 4 0.1211 0.590 0.000 0.040 0.000 0.960
#> SRR542381 4 0.1489 0.589 0.004 0.044 0.000 0.952
#> SRR542382 4 0.1211 0.590 0.000 0.040 0.000 0.960
#> SRR542383 4 0.1211 0.590 0.000 0.040 0.000 0.960
#> SRR542384 4 0.1211 0.590 0.000 0.040 0.000 0.960
#> SRR542385 2 0.6149 0.246 0.048 0.476 0.000 0.476
#> SRR542386 2 0.6242 0.350 0.056 0.520 0.000 0.424
#> SRR542387 4 0.8353 0.314 0.036 0.324 0.188 0.452
#> SRR542388 2 0.5102 0.701 0.100 0.764 0.000 0.136
#> SRR542389 2 0.5968 0.696 0.100 0.736 0.028 0.136
#> SRR542390 2 0.5307 0.678 0.076 0.736 0.000 0.188
#> SRR542391 2 0.5406 0.687 0.048 0.756 0.024 0.172
#> SRR542392 2 0.5136 0.702 0.084 0.768 0.004 0.144
#> SRR542393 2 0.5773 0.696 0.084 0.744 0.024 0.148
#> SRR542394 4 0.5284 0.352 0.040 0.264 0.000 0.696
#> SRR542395 4 0.5374 0.379 0.052 0.244 0.000 0.704
#> SRR542396 4 0.5623 0.275 0.048 0.292 0.000 0.660
#> SRR542397 2 0.6206 0.388 0.056 0.540 0.000 0.404
#> SRR542398 4 0.3024 0.526 0.000 0.148 0.000 0.852
#> SRR542399 1 0.1305 0.984 0.960 0.004 0.000 0.036
#> SRR542400 1 0.1305 0.984 0.960 0.004 0.000 0.036
#> SRR542401 1 0.1305 0.984 0.960 0.004 0.000 0.036
#> SRR542402 1 0.1305 0.984 0.960 0.004 0.000 0.036
#> SRR542403 1 0.2466 0.917 0.900 0.004 0.000 0.096
#> SRR542404 1 0.1305 0.984 0.960 0.004 0.000 0.036
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> SRR542346 3 0.2971 0.8239 0.000 0.000 0.836 0.156 0.008
#> SRR542347 3 0.4398 0.6829 0.000 0.008 0.672 0.312 0.008
#> SRR542348 3 0.2971 0.8239 0.000 0.000 0.836 0.156 0.008
#> SRR542349 3 0.5087 0.5345 0.000 0.016 0.572 0.396 0.016
#> SRR542350 3 0.2731 0.7912 0.000 0.016 0.876 0.104 0.004
#> SRR542351 3 0.0162 0.8506 0.000 0.004 0.996 0.000 0.000
#> SRR542352 2 0.6186 0.2411 0.012 0.600 0.188 0.000 0.200
#> SRR542353 3 0.0000 0.8517 0.000 0.000 1.000 0.000 0.000
#> SRR542354 3 0.2886 0.8268 0.000 0.000 0.844 0.148 0.008
#> SRR542355 2 0.7526 -0.3009 0.000 0.380 0.052 0.200 0.368
#> SRR542356 3 0.0000 0.8517 0.000 0.000 1.000 0.000 0.000
#> SRR542357 2 0.7466 -0.2059 0.000 0.456 0.052 0.252 0.240
#> SRR542358 2 0.6177 0.1185 0.004 0.544 0.340 0.104 0.008
#> SRR542359 3 0.2573 0.7938 0.000 0.016 0.880 0.104 0.000
#> SRR542360 2 0.7441 -0.3257 0.000 0.376 0.040 0.220 0.364
#> SRR542361 4 0.6329 1.0000 0.000 0.200 0.024 0.604 0.172
#> SRR542362 4 0.6329 1.0000 0.000 0.200 0.024 0.604 0.172
#> SRR542363 4 0.6329 1.0000 0.000 0.200 0.024 0.604 0.172
#> SRR542364 2 0.6245 0.2888 0.132 0.496 0.000 0.368 0.004
#> SRR542365 2 0.4421 0.3696 0.004 0.704 0.000 0.268 0.024
#> SRR542366 2 0.6132 0.2837 0.140 0.508 0.000 0.352 0.000
#> SRR542367 2 0.3988 0.3706 0.000 0.732 0.000 0.252 0.016
#> SRR542368 2 0.5984 0.3240 0.068 0.692 0.064 0.012 0.164
#> SRR542369 2 0.4090 0.3656 0.000 0.716 0.000 0.268 0.016
#> SRR542370 2 0.4090 0.3656 0.000 0.716 0.000 0.268 0.016
#> SRR542371 2 0.5548 0.3534 0.004 0.652 0.000 0.124 0.220
#> SRR542372 2 0.4114 0.3709 0.000 0.732 0.000 0.244 0.024
#> SRR542373 2 0.6585 0.2588 0.140 0.552 0.000 0.280 0.028
#> SRR542374 3 0.0000 0.8517 0.000 0.000 1.000 0.000 0.000
#> SRR542375 5 0.0162 0.6521 0.000 0.000 0.004 0.000 0.996
#> SRR542376 5 0.6269 -0.0791 0.000 0.196 0.008 0.220 0.576
#> SRR542377 5 0.7092 -0.5059 0.000 0.320 0.012 0.280 0.388
#> SRR542378 5 0.0000 0.6530 0.000 0.000 0.000 0.000 1.000
#> SRR542379 5 0.2409 0.5647 0.000 0.032 0.000 0.068 0.900
#> SRR542380 5 0.0000 0.6530 0.000 0.000 0.000 0.000 1.000
#> SRR542381 5 0.0000 0.6530 0.000 0.000 0.000 0.000 1.000
#> SRR542382 5 0.1270 0.6545 0.000 0.052 0.000 0.000 0.948
#> SRR542383 5 0.0000 0.6530 0.000 0.000 0.000 0.000 1.000
#> SRR542384 5 0.1908 0.6465 0.000 0.092 0.000 0.000 0.908
#> SRR542385 5 0.6210 0.3218 0.004 0.428 0.000 0.120 0.448
#> SRR542386 5 0.6247 0.3380 0.008 0.420 0.000 0.112 0.460
#> SRR542387 2 0.6622 0.3014 0.140 0.572 0.028 0.004 0.256
#> SRR542388 2 0.6204 0.3473 0.160 0.612 0.020 0.000 0.208
#> SRR542389 2 0.6260 0.3461 0.160 0.612 0.024 0.000 0.204
#> SRR542390 2 0.4492 0.2411 0.020 0.680 0.004 0.000 0.296
#> SRR542391 2 0.4405 0.2605 0.020 0.696 0.004 0.000 0.280
#> SRR542392 2 0.6143 0.3474 0.160 0.612 0.016 0.000 0.212
#> SRR542393 2 0.6354 0.3352 0.160 0.588 0.020 0.000 0.232
#> SRR542394 5 0.6202 0.3535 0.004 0.412 0.000 0.120 0.464
#> SRR542395 5 0.6096 0.4410 0.008 0.312 0.000 0.120 0.560
#> SRR542396 5 0.6186 0.3765 0.004 0.396 0.000 0.120 0.480
#> SRR542397 2 0.6625 -0.2574 0.020 0.476 0.004 0.112 0.388
#> SRR542398 5 0.1270 0.6553 0.000 0.052 0.000 0.000 0.948
#> SRR542399 1 0.0000 0.9914 1.000 0.000 0.000 0.000 0.000
#> SRR542400 1 0.0000 0.9914 1.000 0.000 0.000 0.000 0.000
#> SRR542401 1 0.0000 0.9914 1.000 0.000 0.000 0.000 0.000
#> SRR542402 1 0.0000 0.9914 1.000 0.000 0.000 0.000 0.000
#> SRR542403 1 0.1059 0.9558 0.968 0.008 0.004 0.000 0.020
#> SRR542404 1 0.0000 0.9914 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
#> SRR542346 3 0.4754 0.6558 0.000 0.020 0.668 0.260 0.000 0.052
#> SRR542347 3 0.5216 0.5213 0.000 0.020 0.532 0.396 0.000 0.052
#> SRR542348 3 0.4815 0.6480 0.000 0.020 0.656 0.272 0.000 0.052
#> SRR542349 3 0.5221 0.4239 0.000 0.020 0.472 0.460 0.000 0.048
#> SRR542350 3 0.2044 0.7114 0.008 0.020 0.924 0.032 0.000 0.016
#> SRR542351 3 0.0000 0.7383 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR542352 2 0.7519 0.0977 0.024 0.440 0.164 0.056 0.020 0.296
#> SRR542353 3 0.0363 0.7357 0.000 0.000 0.988 0.012 0.000 0.000
#> SRR542354 3 0.4465 0.6653 0.000 0.020 0.692 0.252 0.000 0.036
#> SRR542355 4 0.5940 0.6814 0.004 0.228 0.036 0.604 0.124 0.004
#> SRR542356 3 0.0000 0.7383 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR542357 4 0.7665 -0.0734 0.004 0.280 0.060 0.336 0.028 0.292
#> SRR542358 3 0.7673 -0.2923 0.028 0.264 0.332 0.076 0.000 0.300
#> SRR542359 3 0.1944 0.7221 0.000 0.036 0.924 0.024 0.000 0.016
#> SRR542360 4 0.5095 0.7552 0.004 0.128 0.040 0.708 0.120 0.000
#> SRR542361 4 0.2196 0.7887 0.000 0.004 0.000 0.884 0.108 0.004
#> SRR542362 4 0.2053 0.7894 0.000 0.004 0.000 0.888 0.108 0.000
#> SRR542363 4 0.2053 0.7894 0.000 0.004 0.000 0.888 0.108 0.000
#> SRR542364 6 0.1500 0.8758 0.012 0.052 0.000 0.000 0.000 0.936
#> SRR542365 6 0.2146 0.8689 0.004 0.116 0.000 0.000 0.000 0.880
#> SRR542366 6 0.1967 0.8792 0.012 0.084 0.000 0.000 0.000 0.904
#> SRR542367 6 0.2887 0.8449 0.000 0.120 0.000 0.000 0.036 0.844
#> SRR542368 2 0.5871 -0.0173 0.032 0.496 0.016 0.056 0.000 0.400
#> SRR542369 6 0.1387 0.8820 0.000 0.068 0.000 0.000 0.000 0.932
#> SRR542370 6 0.1588 0.8836 0.004 0.072 0.000 0.000 0.000 0.924
#> SRR542371 2 0.4207 0.5595 0.000 0.744 0.000 0.008 0.072 0.176
#> SRR542372 6 0.3642 0.7500 0.000 0.204 0.000 0.000 0.036 0.760
#> SRR542373 6 0.4389 0.6641 0.000 0.188 0.000 0.100 0.000 0.712
#> SRR542374 3 0.0000 0.7383 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR542375 5 0.0692 0.8931 0.000 0.004 0.020 0.000 0.976 0.000
#> SRR542376 4 0.3103 0.7502 0.000 0.008 0.000 0.784 0.208 0.000
#> SRR542377 4 0.3837 0.7748 0.000 0.044 0.008 0.768 0.180 0.000
#> SRR542378 5 0.0458 0.9030 0.000 0.016 0.000 0.000 0.984 0.000
#> SRR542379 5 0.3175 0.5406 0.000 0.000 0.000 0.256 0.744 0.000
#> SRR542380 5 0.0000 0.9007 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR542381 5 0.0000 0.9007 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR542382 5 0.0547 0.9019 0.000 0.020 0.000 0.000 0.980 0.000
#> SRR542383 5 0.0260 0.9032 0.000 0.008 0.000 0.000 0.992 0.000
#> SRR542384 5 0.1204 0.8804 0.000 0.056 0.000 0.000 0.944 0.000
#> SRR542385 2 0.3023 0.6070 0.000 0.768 0.000 0.000 0.232 0.000
#> SRR542386 2 0.3217 0.6195 0.000 0.768 0.000 0.000 0.224 0.008
#> SRR542387 2 0.4652 0.5520 0.004 0.780 0.032 0.076 0.040 0.068
#> SRR542388 2 0.6345 0.2632 0.080 0.556 0.024 0.056 0.000 0.284
#> SRR542389 2 0.6413 0.2621 0.080 0.552 0.028 0.056 0.000 0.284
#> SRR542390 2 0.3141 0.6449 0.004 0.836 0.000 0.000 0.112 0.048
#> SRR542391 2 0.2942 0.6328 0.008 0.860 0.000 0.000 0.068 0.064
#> SRR542392 2 0.4087 0.5661 0.064 0.816 0.020 0.056 0.004 0.040
#> SRR542393 2 0.6317 0.2369 0.036 0.548 0.020 0.056 0.020 0.320
#> SRR542394 2 0.2996 0.6115 0.000 0.772 0.000 0.000 0.228 0.000
#> SRR542395 2 0.3240 0.5964 0.000 0.752 0.004 0.000 0.244 0.000
#> SRR542396 2 0.3076 0.5968 0.000 0.760 0.000 0.000 0.240 0.000
#> SRR542397 2 0.3288 0.6492 0.008 0.800 0.000 0.000 0.176 0.016
#> SRR542398 5 0.2933 0.6314 0.000 0.200 0.000 0.000 0.796 0.004
#> SRR542399 1 0.0000 0.9927 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR542400 1 0.0000 0.9927 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR542401 1 0.0000 0.9927 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR542402 1 0.0000 0.9927 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR542403 1 0.0777 0.9631 0.972 0.024 0.000 0.004 0.000 0.000
#> SRR542404 1 0.0000 0.9927 1.000 0.000 0.000 0.000 0.000 0.000
Heatmaps for the consensus matrix. It visualizes the probability of two samples to be in a same group.
consensus_heatmap(res, k = 2)
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 16804 rows and 59 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.895 0.908 0.964 0.4774 0.524 0.524
#> 3 3 0.645 0.796 0.884 0.2256 0.861 0.745
#> 4 4 0.650 0.774 0.874 0.2266 0.732 0.450
#> 5 5 0.585 0.610 0.785 0.0907 0.880 0.613
#> 6 6 0.709 0.623 0.795 0.0478 0.887 0.556
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
#> SRR542346 2 0.000 0.960 0.000 1.000
#> SRR542347 2 0.000 0.960 0.000 1.000
#> SRR542348 2 0.000 0.960 0.000 1.000
#> SRR542349 2 0.000 0.960 0.000 1.000
#> SRR542350 2 0.000 0.960 0.000 1.000
#> SRR542351 2 0.000 0.960 0.000 1.000
#> SRR542352 2 0.000 0.960 0.000 1.000
#> SRR542353 2 0.000 0.960 0.000 1.000
#> SRR542354 2 0.000 0.960 0.000 1.000
#> SRR542355 2 0.000 0.960 0.000 1.000
#> SRR542356 2 0.000 0.960 0.000 1.000
#> SRR542357 2 0.000 0.960 0.000 1.000
#> SRR542358 2 0.000 0.960 0.000 1.000
#> SRR542359 2 0.000 0.960 0.000 1.000
#> SRR542360 2 0.000 0.960 0.000 1.000
#> SRR542361 2 0.000 0.960 0.000 1.000
#> SRR542362 2 0.000 0.960 0.000 1.000
#> SRR542363 2 0.000 0.960 0.000 1.000
#> SRR542364 2 0.000 0.960 0.000 1.000
#> SRR542365 2 0.000 0.960 0.000 1.000
#> SRR542366 2 0.000 0.960 0.000 1.000
#> SRR542367 2 0.000 0.960 0.000 1.000
#> SRR542368 2 0.000 0.960 0.000 1.000
#> SRR542369 2 0.000 0.960 0.000 1.000
#> SRR542370 2 0.000 0.960 0.000 1.000
#> SRR542371 1 0.981 0.244 0.580 0.420
#> SRR542372 2 0.000 0.960 0.000 1.000
#> SRR542373 2 0.000 0.960 0.000 1.000
#> SRR542374 2 0.000 0.960 0.000 1.000
#> SRR542375 1 0.000 0.960 1.000 0.000
#> SRR542376 2 0.850 0.612 0.276 0.724
#> SRR542377 2 0.000 0.960 0.000 1.000
#> SRR542378 1 0.000 0.960 1.000 0.000
#> SRR542379 1 0.000 0.960 1.000 0.000
#> SRR542380 1 0.000 0.960 1.000 0.000
#> SRR542381 1 0.000 0.960 1.000 0.000
#> SRR542382 1 0.000 0.960 1.000 0.000
#> SRR542383 1 0.000 0.960 1.000 0.000
#> SRR542384 1 0.000 0.960 1.000 0.000
#> SRR542385 1 0.000 0.960 1.000 0.000
#> SRR542386 1 0.000 0.960 1.000 0.000
#> SRR542387 2 0.000 0.960 0.000 1.000
#> SRR542388 2 0.000 0.960 0.000 1.000
#> SRR542389 2 0.000 0.960 0.000 1.000
#> SRR542390 2 0.978 0.301 0.412 0.588
#> SRR542391 2 0.876 0.576 0.296 0.704
#> SRR542392 2 0.943 0.439 0.360 0.640
#> SRR542393 2 0.000 0.960 0.000 1.000
#> SRR542394 1 0.260 0.923 0.956 0.044
#> SRR542395 1 0.000 0.960 1.000 0.000
#> SRR542396 1 0.000 0.960 1.000 0.000
#> SRR542397 1 0.866 0.576 0.712 0.288
#> SRR542398 1 0.000 0.960 1.000 0.000
#> SRR542399 1 0.000 0.960 1.000 0.000
#> SRR542400 1 0.000 0.960 1.000 0.000
#> SRR542401 1 0.000 0.960 1.000 0.000
#> SRR542402 1 0.000 0.960 1.000 0.000
#> SRR542403 1 0.163 0.941 0.976 0.024
#> SRR542404 1 0.000 0.960 1.000 0.000
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> SRR542346 3 0.1529 0.898 0.040 0.000 0.960
#> SRR542347 3 0.1163 0.891 0.028 0.000 0.972
#> SRR542348 3 0.1964 0.897 0.056 0.000 0.944
#> SRR542349 3 0.1289 0.889 0.032 0.000 0.968
#> SRR542350 3 0.4235 0.828 0.176 0.000 0.824
#> SRR542351 3 0.2537 0.891 0.080 0.000 0.920
#> SRR542352 3 0.3340 0.873 0.120 0.000 0.880
#> SRR542353 3 0.3038 0.882 0.104 0.000 0.896
#> SRR542354 3 0.2356 0.894 0.072 0.000 0.928
#> SRR542355 3 0.1643 0.898 0.044 0.000 0.956
#> SRR542356 3 0.2625 0.890 0.084 0.000 0.916
#> SRR542357 3 0.0747 0.899 0.016 0.000 0.984
#> SRR542358 3 0.4654 0.796 0.208 0.000 0.792
#> SRR542359 3 0.3116 0.880 0.108 0.000 0.892
#> SRR542360 3 0.1643 0.899 0.044 0.000 0.956
#> SRR542361 3 0.2152 0.880 0.036 0.016 0.948
#> SRR542362 3 0.1411 0.888 0.036 0.000 0.964
#> SRR542363 3 0.1411 0.888 0.036 0.000 0.964
#> SRR542364 3 0.0424 0.896 0.008 0.000 0.992
#> SRR542365 3 0.2448 0.893 0.076 0.000 0.924
#> SRR542366 3 0.1411 0.888 0.036 0.000 0.964
#> SRR542367 3 0.2152 0.880 0.036 0.016 0.948
#> SRR542368 3 0.3412 0.871 0.124 0.000 0.876
#> SRR542369 3 0.0237 0.898 0.004 0.000 0.996
#> SRR542370 3 0.0592 0.899 0.012 0.000 0.988
#> SRR542371 2 0.7141 0.495 0.032 0.600 0.368
#> SRR542372 3 0.6124 0.603 0.036 0.220 0.744
#> SRR542373 3 0.1411 0.888 0.036 0.000 0.964
#> SRR542374 3 0.2448 0.893 0.076 0.000 0.924
#> SRR542375 2 0.1989 0.790 0.004 0.948 0.048
#> SRR542376 2 0.7378 0.437 0.036 0.560 0.404
#> SRR542377 3 0.3554 0.842 0.036 0.064 0.900
#> SRR542378 2 0.0000 0.806 0.000 1.000 0.000
#> SRR542379 2 0.7150 0.514 0.036 0.616 0.348
#> SRR542380 2 0.0237 0.806 0.000 0.996 0.004
#> SRR542381 2 0.0000 0.806 0.000 1.000 0.000
#> SRR542382 2 0.0000 0.806 0.000 1.000 0.000
#> SRR542383 2 0.0000 0.806 0.000 1.000 0.000
#> SRR542384 2 0.0000 0.806 0.000 1.000 0.000
#> SRR542385 2 0.1163 0.799 0.000 0.972 0.028
#> SRR542386 2 0.2356 0.756 0.072 0.928 0.000
#> SRR542387 3 0.1877 0.887 0.032 0.012 0.956
#> SRR542388 3 0.5948 0.570 0.360 0.000 0.640
#> SRR542389 3 0.5926 0.578 0.356 0.000 0.644
#> SRR542390 2 0.8745 0.365 0.120 0.524 0.356
#> SRR542391 3 0.9385 0.281 0.328 0.188 0.484
#> SRR542392 1 0.4293 0.674 0.832 0.004 0.164
#> SRR542393 3 0.2356 0.893 0.072 0.000 0.928
#> SRR542394 2 0.4228 0.716 0.008 0.844 0.148
#> SRR542395 2 0.0000 0.806 0.000 1.000 0.000
#> SRR542396 2 0.0000 0.806 0.000 1.000 0.000
#> SRR542397 2 0.6435 0.617 0.168 0.756 0.076
#> SRR542398 2 0.0000 0.806 0.000 1.000 0.000
#> SRR542399 1 0.4796 0.818 0.780 0.220 0.000
#> SRR542400 1 0.3043 0.864 0.908 0.084 0.008
#> SRR542401 1 0.4399 0.838 0.812 0.188 0.000
#> SRR542402 1 0.2860 0.863 0.912 0.084 0.004
#> SRR542403 1 0.2599 0.846 0.932 0.052 0.016
#> SRR542404 1 0.5016 0.796 0.760 0.240 0.000
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> SRR542346 3 0.0921 0.8667 0.000 0.028 0.972 0.000
#> SRR542347 3 0.0817 0.8654 0.000 0.024 0.976 0.000
#> SRR542348 3 0.0707 0.8644 0.000 0.020 0.980 0.000
#> SRR542349 3 0.0336 0.8583 0.000 0.008 0.992 0.000
#> SRR542350 3 0.6929 0.0823 0.108 0.444 0.448 0.000
#> SRR542351 3 0.2882 0.8643 0.024 0.084 0.892 0.000
#> SRR542352 2 0.5477 0.6590 0.092 0.728 0.180 0.000
#> SRR542353 3 0.4194 0.8032 0.028 0.172 0.800 0.000
#> SRR542354 3 0.2142 0.8703 0.016 0.056 0.928 0.000
#> SRR542355 3 0.2053 0.8698 0.004 0.072 0.924 0.000
#> SRR542356 3 0.3080 0.8606 0.024 0.096 0.880 0.000
#> SRR542357 3 0.3052 0.8456 0.004 0.136 0.860 0.000
#> SRR542358 2 0.5724 0.6678 0.140 0.716 0.144 0.000
#> SRR542359 3 0.3325 0.8526 0.024 0.112 0.864 0.000
#> SRR542360 3 0.1557 0.8703 0.000 0.056 0.944 0.000
#> SRR542361 3 0.1118 0.8422 0.000 0.036 0.964 0.000
#> SRR542362 3 0.0707 0.8487 0.000 0.020 0.980 0.000
#> SRR542363 3 0.1118 0.8422 0.000 0.036 0.964 0.000
#> SRR542364 2 0.1389 0.8521 0.000 0.952 0.048 0.000
#> SRR542365 2 0.1022 0.8550 0.000 0.968 0.032 0.000
#> SRR542366 2 0.2814 0.7824 0.000 0.868 0.132 0.000
#> SRR542367 2 0.1624 0.8576 0.000 0.952 0.028 0.020
#> SRR542368 2 0.3051 0.8355 0.088 0.884 0.028 0.000
#> SRR542369 2 0.0817 0.8571 0.000 0.976 0.024 0.000
#> SRR542370 2 0.0469 0.8578 0.000 0.988 0.012 0.000
#> SRR542371 4 0.4857 0.6322 0.000 0.324 0.008 0.668
#> SRR542372 2 0.1059 0.8569 0.000 0.972 0.012 0.016
#> SRR542373 3 0.4331 0.6636 0.000 0.288 0.712 0.000
#> SRR542374 3 0.3037 0.8603 0.020 0.100 0.880 0.000
#> SRR542375 4 0.3205 0.7811 0.000 0.104 0.024 0.872
#> SRR542376 3 0.5735 0.1241 0.000 0.032 0.576 0.392
#> SRR542377 3 0.1356 0.8386 0.000 0.032 0.960 0.008
#> SRR542378 4 0.0000 0.7690 0.000 0.000 0.000 1.000
#> SRR542379 4 0.4900 0.6407 0.000 0.032 0.236 0.732
#> SRR542380 4 0.2224 0.7720 0.000 0.032 0.040 0.928
#> SRR542381 4 0.2036 0.7739 0.000 0.032 0.032 0.936
#> SRR542382 4 0.0469 0.7625 0.012 0.000 0.000 0.988
#> SRR542383 4 0.0000 0.7690 0.000 0.000 0.000 1.000
#> SRR542384 4 0.3569 0.7570 0.000 0.196 0.000 0.804
#> SRR542385 2 0.4222 0.5235 0.000 0.728 0.000 0.272
#> SRR542386 2 0.4370 0.7056 0.044 0.800 0.000 0.156
#> SRR542387 2 0.5434 0.5959 0.000 0.728 0.084 0.188
#> SRR542388 2 0.2589 0.8285 0.116 0.884 0.000 0.000
#> SRR542389 2 0.2647 0.8255 0.120 0.880 0.000 0.000
#> SRR542390 2 0.1545 0.8409 0.008 0.952 0.000 0.040
#> SRR542391 2 0.0707 0.8568 0.020 0.980 0.000 0.000
#> SRR542392 2 0.4164 0.6899 0.264 0.736 0.000 0.000
#> SRR542393 2 0.0336 0.8560 0.008 0.992 0.000 0.000
#> SRR542394 4 0.4992 0.3027 0.000 0.476 0.000 0.524
#> SRR542395 4 0.5487 0.4611 0.020 0.400 0.000 0.580
#> SRR542396 4 0.3942 0.7295 0.000 0.236 0.000 0.764
#> SRR542397 2 0.2443 0.8255 0.024 0.916 0.000 0.060
#> SRR542398 4 0.0707 0.7571 0.020 0.000 0.000 0.980
#> SRR542399 1 0.2281 0.9520 0.904 0.000 0.000 0.096
#> SRR542400 1 0.0921 0.9613 0.972 0.000 0.000 0.028
#> SRR542401 1 0.1867 0.9605 0.928 0.000 0.000 0.072
#> SRR542402 1 0.0707 0.9579 0.980 0.000 0.000 0.020
#> SRR542403 1 0.0895 0.9578 0.976 0.004 0.000 0.020
#> SRR542404 1 0.2281 0.9520 0.904 0.000 0.000 0.096
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> SRR542346 3 0.4114 0.41151 0.000 0.000 0.624 0.376 0.000
#> SRR542347 3 0.4030 0.39937 0.000 0.000 0.648 0.352 0.000
#> SRR542348 3 0.4161 0.36295 0.000 0.000 0.608 0.392 0.000
#> SRR542349 4 0.4242 0.07459 0.000 0.000 0.428 0.572 0.000
#> SRR542350 3 0.4584 0.61475 0.024 0.188 0.752 0.036 0.000
#> SRR542351 3 0.1365 0.67593 0.004 0.004 0.952 0.040 0.000
#> SRR542352 3 0.4878 0.57072 0.024 0.248 0.700 0.028 0.000
#> SRR542353 3 0.1883 0.67727 0.008 0.048 0.932 0.012 0.000
#> SRR542354 3 0.3487 0.63340 0.000 0.008 0.780 0.212 0.000
#> SRR542355 3 0.2389 0.67894 0.000 0.004 0.880 0.116 0.000
#> SRR542356 3 0.1365 0.68273 0.004 0.004 0.952 0.040 0.000
#> SRR542357 3 0.4255 0.63847 0.000 0.096 0.776 0.128 0.000
#> SRR542358 3 0.4855 0.58744 0.040 0.224 0.716 0.020 0.000
#> SRR542359 3 0.1041 0.68511 0.004 0.000 0.964 0.032 0.000
#> SRR542360 3 0.3196 0.62451 0.000 0.004 0.804 0.192 0.000
#> SRR542361 4 0.2347 0.74422 0.000 0.016 0.056 0.912 0.016
#> SRR542362 4 0.3456 0.66998 0.000 0.016 0.184 0.800 0.000
#> SRR542363 4 0.2625 0.73393 0.000 0.016 0.108 0.876 0.000
#> SRR542364 2 0.5289 0.56091 0.000 0.616 0.312 0.072 0.000
#> SRR542365 2 0.4114 0.67868 0.000 0.776 0.164 0.060 0.000
#> SRR542366 2 0.5819 0.55937 0.000 0.612 0.200 0.188 0.000
#> SRR542367 2 0.5345 0.58582 0.000 0.632 0.280 0.088 0.000
#> SRR542368 2 0.5536 0.61019 0.016 0.656 0.260 0.064 0.004
#> SRR542369 2 0.4289 0.66841 0.000 0.760 0.176 0.064 0.000
#> SRR542370 2 0.3427 0.68831 0.000 0.836 0.108 0.056 0.000
#> SRR542371 2 0.4769 0.47501 0.000 0.688 0.000 0.056 0.256
#> SRR542372 2 0.3950 0.68069 0.000 0.796 0.136 0.068 0.000
#> SRR542373 3 0.6712 -0.15078 0.000 0.256 0.412 0.332 0.000
#> SRR542374 3 0.1357 0.67026 0.000 0.004 0.948 0.048 0.000
#> SRR542375 5 0.3732 0.75463 0.004 0.056 0.000 0.120 0.820
#> SRR542376 4 0.3847 0.58123 0.000 0.000 0.036 0.784 0.180
#> SRR542377 4 0.2735 0.70128 0.000 0.000 0.084 0.880 0.036
#> SRR542378 5 0.0162 0.76872 0.004 0.000 0.000 0.000 0.996
#> SRR542379 5 0.4321 0.44297 0.000 0.000 0.004 0.396 0.600
#> SRR542380 5 0.2605 0.73840 0.000 0.000 0.000 0.148 0.852
#> SRR542381 5 0.3010 0.72703 0.004 0.000 0.000 0.172 0.824
#> SRR542382 5 0.0162 0.76872 0.004 0.000 0.000 0.000 0.996
#> SRR542383 5 0.0162 0.76872 0.004 0.000 0.000 0.000 0.996
#> SRR542384 5 0.2824 0.75785 0.000 0.116 0.000 0.020 0.864
#> SRR542385 2 0.2852 0.55642 0.000 0.828 0.000 0.000 0.172
#> SRR542386 2 0.4235 0.20387 0.008 0.656 0.000 0.000 0.336
#> SRR542387 3 0.7960 0.20485 0.012 0.324 0.420 0.164 0.080
#> SRR542388 2 0.5013 0.49524 0.108 0.700 0.192 0.000 0.000
#> SRR542389 2 0.5047 0.48711 0.088 0.700 0.208 0.004 0.000
#> SRR542390 2 0.0404 0.66896 0.000 0.988 0.000 0.000 0.012
#> SRR542391 2 0.0794 0.66763 0.000 0.972 0.028 0.000 0.000
#> SRR542392 2 0.7087 -0.00363 0.368 0.384 0.232 0.016 0.000
#> SRR542393 2 0.3586 0.46526 0.000 0.736 0.264 0.000 0.000
#> SRR542394 5 0.4283 0.32000 0.000 0.456 0.000 0.000 0.544
#> SRR542395 5 0.4350 0.43823 0.004 0.408 0.000 0.000 0.588
#> SRR542396 5 0.3816 0.58837 0.000 0.304 0.000 0.000 0.696
#> SRR542397 2 0.0898 0.66407 0.000 0.972 0.008 0.000 0.020
#> SRR542398 5 0.0162 0.76872 0.004 0.000 0.000 0.000 0.996
#> SRR542399 1 0.0510 0.99239 0.984 0.000 0.000 0.000 0.016
#> SRR542400 1 0.0290 0.99368 0.992 0.000 0.000 0.000 0.008
#> SRR542401 1 0.0404 0.99354 0.988 0.000 0.000 0.000 0.012
#> SRR542402 1 0.0290 0.99368 0.992 0.000 0.000 0.000 0.008
#> SRR542403 1 0.0000 0.98792 1.000 0.000 0.000 0.000 0.000
#> SRR542404 1 0.0609 0.98953 0.980 0.000 0.000 0.000 0.020
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> SRR542346 3 0.1542 0.78286 0.000 0.008 0.936 0.052 0.000 0.004
#> SRR542347 3 0.2976 0.72363 0.000 0.024 0.860 0.088 0.000 0.028
#> SRR542348 3 0.1801 0.77685 0.000 0.016 0.924 0.056 0.000 0.004
#> SRR542349 3 0.4375 0.57237 0.000 0.028 0.680 0.276 0.000 0.016
#> SRR542350 2 0.4129 -0.47590 0.000 0.496 0.496 0.004 0.000 0.004
#> SRR542351 3 0.1753 0.80302 0.000 0.084 0.912 0.000 0.000 0.004
#> SRR542352 2 0.2845 0.30962 0.000 0.820 0.172 0.004 0.000 0.004
#> SRR542353 3 0.3536 0.73477 0.000 0.252 0.736 0.008 0.000 0.004
#> SRR542354 3 0.4356 0.63054 0.000 0.360 0.608 0.032 0.000 0.000
#> SRR542355 3 0.3448 0.71653 0.000 0.280 0.716 0.004 0.000 0.000
#> SRR542356 3 0.2632 0.78586 0.000 0.164 0.832 0.000 0.000 0.004
#> SRR542357 2 0.3695 0.06910 0.000 0.712 0.272 0.016 0.000 0.000
#> SRR542358 2 0.3452 0.18329 0.000 0.736 0.256 0.004 0.000 0.004
#> SRR542359 3 0.3266 0.72734 0.000 0.272 0.728 0.000 0.000 0.000
#> SRR542360 3 0.1196 0.80356 0.000 0.040 0.952 0.008 0.000 0.000
#> SRR542361 4 0.1843 0.90217 0.000 0.004 0.004 0.912 0.000 0.080
#> SRR542362 4 0.2695 0.85666 0.000 0.004 0.008 0.844 0.000 0.144
#> SRR542363 4 0.1949 0.89963 0.000 0.004 0.004 0.904 0.000 0.088
#> SRR542364 6 0.2308 0.67975 0.000 0.012 0.076 0.016 0.000 0.896
#> SRR542365 6 0.0653 0.71701 0.000 0.012 0.004 0.004 0.000 0.980
#> SRR542366 6 0.2053 0.67447 0.000 0.004 0.000 0.108 0.000 0.888
#> SRR542367 6 0.2358 0.69097 0.000 0.016 0.056 0.028 0.000 0.900
#> SRR542368 6 0.2506 0.68569 0.052 0.008 0.036 0.008 0.000 0.896
#> SRR542369 6 0.0603 0.71633 0.000 0.000 0.016 0.004 0.000 0.980
#> SRR542370 6 0.0935 0.70965 0.000 0.032 0.000 0.004 0.000 0.964
#> SRR542371 6 0.2968 0.67362 0.000 0.052 0.000 0.004 0.092 0.852
#> SRR542372 6 0.0820 0.71711 0.000 0.012 0.000 0.016 0.000 0.972
#> SRR542373 6 0.4441 0.47847 0.000 0.016 0.204 0.060 0.000 0.720
#> SRR542374 3 0.1333 0.80256 0.000 0.048 0.944 0.000 0.000 0.008
#> SRR542375 5 0.2517 0.77467 0.000 0.008 0.000 0.100 0.876 0.016
#> SRR542376 4 0.1370 0.88626 0.000 0.036 0.012 0.948 0.004 0.000
#> SRR542377 4 0.1672 0.88107 0.000 0.048 0.016 0.932 0.004 0.000
#> SRR542378 5 0.0146 0.81161 0.000 0.000 0.000 0.004 0.996 0.000
#> SRR542379 4 0.2661 0.85414 0.000 0.012 0.004 0.876 0.092 0.016
#> SRR542380 5 0.2442 0.74999 0.000 0.000 0.000 0.144 0.852 0.004
#> SRR542381 5 0.2046 0.79435 0.000 0.060 0.000 0.032 0.908 0.000
#> SRR542382 5 0.0000 0.81236 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR542383 5 0.0146 0.81161 0.000 0.000 0.000 0.004 0.996 0.000
#> SRR542384 5 0.1434 0.80700 0.000 0.000 0.000 0.012 0.940 0.048
#> SRR542385 6 0.5408 0.34174 0.000 0.304 0.000 0.000 0.144 0.552
#> SRR542386 6 0.5574 0.26941 0.000 0.344 0.000 0.000 0.152 0.504
#> SRR542387 2 0.5825 0.29768 0.000 0.596 0.004 0.244 0.032 0.124
#> SRR542388 2 0.4250 -0.11892 0.016 0.528 0.000 0.000 0.000 0.456
#> SRR542389 2 0.3619 0.23063 0.004 0.680 0.000 0.000 0.000 0.316
#> SRR542390 6 0.3668 0.45951 0.000 0.328 0.000 0.004 0.000 0.668
#> SRR542391 6 0.3672 0.40292 0.000 0.368 0.000 0.000 0.000 0.632
#> SRR542392 2 0.6111 0.20984 0.252 0.516 0.000 0.012 0.004 0.216
#> SRR542393 2 0.3868 -0.18659 0.000 0.508 0.000 0.000 0.000 0.492
#> SRR542394 5 0.5633 -0.00255 0.000 0.148 0.000 0.000 0.440 0.412
#> SRR542395 5 0.5102 0.52662 0.000 0.160 0.000 0.000 0.628 0.212
#> SRR542396 5 0.3930 0.63970 0.000 0.032 0.000 0.004 0.728 0.236
#> SRR542397 6 0.3872 0.35364 0.000 0.392 0.000 0.000 0.004 0.604
#> SRR542398 5 0.0000 0.81236 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR542399 1 0.0000 1.00000 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR542400 1 0.0000 1.00000 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR542401 1 0.0000 1.00000 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR542402 1 0.0000 1.00000 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR542403 1 0.0000 1.00000 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR542404 1 0.0000 1.00000 1.000 0.000 0.000 0.000 0.000 0.000
Heatmaps for the consensus matrix. It visualizes the probability of two samples to be in a same group.
consensus_heatmap(res, k = 2)
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