Date: 2019-12-26 01:10:38 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 14581 rows and 58 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] 14581 58
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:kmeans | 2 | 1.000 | 1.000 | 1.000 | ** | |
SD:skmeans | 2 | 1.000 | 1.000 | 1.000 | ** | |
SD:pam | 2 | 1.000 | 1.000 | 1.000 | ** | |
SD:mclust | 2 | 1.000 | 1.000 | 1.000 | ** | |
CV:hclust | 3 | 1.000 | 0.979 | 0.988 | ** | 2 |
CV:kmeans | 2 | 1.000 | 1.000 | 1.000 | ** | |
CV:skmeans | 2 | 1.000 | 1.000 | 1.000 | ** | |
CV:pam | 4 | 1.000 | 0.989 | 0.992 | ** | 2,3 |
CV:mclust | 2 | 1.000 | 1.000 | 1.000 | ** | |
MAD:hclust | 3 | 1.000 | 0.970 | 0.987 | ** | 2 |
MAD:kmeans | 2 | 1.000 | 1.000 | 1.000 | ** | |
MAD:pam | 2 | 1.000 | 1.000 | 1.000 | ** | |
MAD:mclust | 2 | 1.000 | 1.000 | 1.000 | ** | |
ATC:kmeans | 2 | 1.000 | 1.000 | 1.000 | ** | |
ATC:skmeans | 3 | 1.000 | 0.945 | 0.977 | ** | 2 |
ATC:mclust | 2 | 1.000 | 1.000 | 1.000 | ** | |
ATC:pam | 6 | 0.991 | 0.970 | 0.983 | ** | 2,5 |
SD:NMF | 3 | 0.987 | 0.966 | 0.983 | ** | 2 |
ATC:NMF | 3 | 0.981 | 0.952 | 0.971 | ** | 2 |
MAD:NMF | 3 | 0.980 | 0.943 | 0.896 | ** | 2 |
ATC:hclust | 5 | 0.969 | 0.879 | 0.953 | ** | 2,3,4 |
CV:NMF | 3 | 0.959 | 0.957 | 0.968 | ** | 2 |
SD:hclust | 5 | 0.912 | 0.823 | 0.900 | * | 2,3 |
MAD:skmeans | 3 | 0.902 | 0.981 | 0.982 | * | 2 |
**: 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 1 0.999 1 0.5 0.501 0.501
#> CV:NMF 2 1 1.000 1 0.5 0.501 0.501
#> MAD:NMF 2 1 1.000 1 0.5 0.501 0.501
#> ATC:NMF 2 1 0.999 1 0.5 0.501 0.501
#> SD:skmeans 2 1 1.000 1 0.5 0.501 0.501
#> CV:skmeans 2 1 1.000 1 0.5 0.501 0.501
#> MAD:skmeans 2 1 1.000 1 0.5 0.501 0.501
#> ATC:skmeans 2 1 1.000 1 0.5 0.501 0.501
#> SD:mclust 2 1 1.000 1 0.5 0.501 0.501
#> CV:mclust 2 1 1.000 1 0.5 0.501 0.501
#> MAD:mclust 2 1 1.000 1 0.5 0.501 0.501
#> ATC:mclust 2 1 1.000 1 0.5 0.501 0.501
#> SD:kmeans 2 1 1.000 1 0.5 0.501 0.501
#> CV:kmeans 2 1 1.000 1 0.5 0.501 0.501
#> MAD:kmeans 2 1 1.000 1 0.5 0.501 0.501
#> ATC:kmeans 2 1 1.000 1 0.5 0.501 0.501
#> SD:pam 2 1 1.000 1 0.5 0.501 0.501
#> CV:pam 2 1 1.000 1 0.5 0.501 0.501
#> MAD:pam 2 1 1.000 1 0.5 0.501 0.501
#> ATC:pam 2 1 1.000 1 0.5 0.501 0.501
#> SD:hclust 2 1 1.000 1 0.5 0.501 0.501
#> CV:hclust 2 1 1.000 1 0.5 0.501 0.501
#> MAD:hclust 2 1 1.000 1 0.5 0.501 0.501
#> ATC:hclust 2 1 1.000 1 0.5 0.501 0.501
get_stats(res_list, k = 3)
#> k 1-PAC mean_silhouette concordance area_increased Rand Jaccard
#> SD:NMF 3 0.987 0.966 0.983 0.139 0.930 0.860
#> CV:NMF 3 0.959 0.957 0.968 0.165 0.909 0.819
#> MAD:NMF 3 0.980 0.943 0.896 0.173 0.930 0.860
#> ATC:NMF 3 0.981 0.952 0.971 0.139 0.946 0.891
#> SD:skmeans 3 0.866 0.933 0.947 0.228 0.861 0.722
#> CV:skmeans 3 0.777 0.895 0.895 0.202 0.907 0.814
#> MAD:skmeans 3 0.902 0.981 0.982 0.254 0.861 0.722
#> ATC:skmeans 3 1.000 0.945 0.977 0.146 0.946 0.891
#> SD:mclust 3 0.760 0.826 0.873 0.225 0.902 0.804
#> CV:mclust 3 0.774 0.918 0.881 0.189 0.909 0.819
#> MAD:mclust 3 0.778 0.938 0.908 0.257 0.854 0.708
#> ATC:mclust 3 0.773 0.909 0.922 0.158 0.946 0.891
#> SD:kmeans 3 0.694 0.184 0.771 0.233 0.946 0.891
#> CV:kmeans 3 0.756 0.836 0.811 0.235 0.879 0.758
#> MAD:kmeans 3 0.723 0.943 0.871 0.250 0.854 0.708
#> ATC:kmeans 3 0.768 0.769 0.873 0.219 0.890 0.780
#> SD:pam 3 0.727 0.897 0.895 0.212 0.909 0.819
#> CV:pam 3 1.000 0.983 0.991 0.177 0.913 0.826
#> MAD:pam 3 0.716 0.786 0.787 0.236 0.906 0.812
#> ATC:pam 3 0.769 0.959 0.948 0.289 0.843 0.686
#> SD:hclust 3 1.000 0.984 0.994 0.120 0.946 0.891
#> CV:hclust 3 1.000 0.979 0.988 0.181 0.907 0.814
#> MAD:hclust 3 1.000 0.970 0.987 0.131 0.946 0.891
#> ATC:hclust 3 1.000 1.000 1.000 0.109 0.946 0.891
get_stats(res_list, k = 4)
#> k 1-PAC mean_silhouette concordance area_increased Rand Jaccard
#> SD:NMF 4 0.900 0.902 0.942 0.0651 1.000 1.000
#> CV:NMF 4 0.706 0.711 0.836 0.1032 0.944 0.868
#> MAD:NMF 4 0.896 0.907 0.941 0.0433 0.962 0.914
#> ATC:NMF 4 0.897 0.926 0.962 0.0708 0.946 0.880
#> SD:skmeans 4 0.734 0.536 0.826 0.1280 0.972 0.923
#> CV:skmeans 4 0.870 0.896 0.935 0.1959 0.879 0.703
#> MAD:skmeans 4 0.826 0.869 0.882 0.1024 0.987 0.965
#> ATC:skmeans 4 0.735 0.647 0.837 0.1449 0.924 0.831
#> SD:mclust 4 0.567 0.664 0.745 0.1334 0.909 0.775
#> CV:mclust 4 0.661 0.777 0.805 0.0989 0.967 0.920
#> MAD:mclust 4 0.799 0.847 0.918 0.1509 0.918 0.768
#> ATC:mclust 4 0.714 0.754 0.857 0.1543 0.907 0.791
#> SD:kmeans 4 0.585 0.684 0.724 0.1238 0.752 0.486
#> CV:kmeans 4 0.605 0.785 0.792 0.1163 0.909 0.761
#> MAD:kmeans 4 0.570 0.755 0.774 0.1184 0.913 0.754
#> ATC:kmeans 4 0.640 0.800 0.776 0.1182 0.854 0.641
#> SD:pam 4 0.892 0.900 0.939 0.2136 0.848 0.628
#> CV:pam 4 1.000 0.989 0.992 0.0596 0.964 0.912
#> MAD:pam 4 0.861 0.849 0.938 0.1973 0.826 0.587
#> ATC:pam 4 0.895 0.964 0.971 0.1245 0.918 0.761
#> SD:hclust 4 0.877 0.883 0.943 0.1509 0.907 0.791
#> CV:hclust 4 0.794 0.883 0.930 0.0777 0.994 0.985
#> MAD:hclust 4 0.756 0.906 0.913 0.1978 0.879 0.729
#> ATC:hclust 4 0.973 0.976 0.987 0.1426 0.924 0.829
get_stats(res_list, k = 5)
#> k 1-PAC mean_silhouette concordance area_increased Rand Jaccard
#> SD:NMF 5 0.661 0.680 0.852 0.0992 0.983 0.961
#> CV:NMF 5 0.637 0.634 0.741 0.0855 0.989 0.972
#> MAD:NMF 5 0.776 0.791 0.865 0.0790 0.995 0.988
#> ATC:NMF 5 0.754 0.733 0.896 0.0624 0.984 0.961
#> SD:skmeans 5 0.667 0.723 0.836 0.0812 0.871 0.634
#> CV:skmeans 5 0.727 0.666 0.828 0.0676 0.989 0.962
#> MAD:skmeans 5 0.760 0.793 0.839 0.0873 0.909 0.740
#> ATC:skmeans 5 0.660 0.564 0.736 0.1090 0.815 0.529
#> SD:mclust 5 0.576 0.521 0.676 0.0924 0.881 0.641
#> CV:mclust 5 0.651 0.637 0.802 0.1223 0.891 0.716
#> MAD:mclust 5 0.700 0.641 0.785 0.0787 0.871 0.569
#> ATC:mclust 5 0.633 0.612 0.773 0.1349 0.840 0.561
#> SD:kmeans 5 0.547 0.590 0.689 0.0747 1.000 1.000
#> CV:kmeans 5 0.566 0.744 0.743 0.0880 0.985 0.951
#> MAD:kmeans 5 0.535 0.702 0.721 0.0711 0.972 0.900
#> ATC:kmeans 5 0.575 0.706 0.752 0.0751 0.985 0.949
#> SD:pam 5 0.803 0.832 0.895 0.0574 0.967 0.873
#> CV:pam 5 0.815 0.892 0.917 0.0868 0.982 0.952
#> MAD:pam 5 0.875 0.854 0.940 0.0447 0.967 0.876
#> ATC:pam 5 0.906 0.910 0.919 0.0578 0.964 0.861
#> SD:hclust 5 0.912 0.823 0.900 0.0617 0.940 0.835
#> CV:hclust 5 0.803 0.686 0.894 0.0482 0.981 0.952
#> MAD:hclust 5 0.836 0.786 0.902 0.1278 0.909 0.721
#> ATC:hclust 5 0.969 0.879 0.953 0.0384 0.981 0.948
get_stats(res_list, k = 6)
#> k 1-PAC mean_silhouette concordance area_increased Rand Jaccard
#> SD:NMF 6 0.608 0.582 0.751 0.0939 0.926 0.821
#> CV:NMF 6 0.633 0.664 0.782 0.0983 0.789 0.472
#> MAD:NMF 6 0.693 0.573 0.773 0.0674 0.921 0.806
#> ATC:NMF 6 0.652 0.669 0.840 0.0594 1.000 1.000
#> SD:skmeans 6 0.677 0.633 0.756 0.0482 1.000 1.000
#> CV:skmeans 6 0.749 0.667 0.769 0.0451 0.925 0.732
#> MAD:skmeans 6 0.686 0.618 0.740 0.0637 0.932 0.738
#> ATC:skmeans 6 0.640 0.598 0.774 0.0521 0.904 0.647
#> SD:mclust 6 0.655 0.595 0.738 0.0705 0.894 0.584
#> CV:mclust 6 0.648 0.627 0.795 0.0850 0.944 0.802
#> MAD:mclust 6 0.713 0.642 0.817 0.0470 0.947 0.747
#> ATC:mclust 6 0.742 0.803 0.872 0.0671 0.911 0.634
#> SD:kmeans 6 0.621 0.525 0.641 0.0659 0.926 0.745
#> CV:kmeans 6 0.636 0.583 0.664 0.0583 0.907 0.675
#> MAD:kmeans 6 0.651 0.550 0.659 0.0651 0.881 0.593
#> ATC:kmeans 6 0.694 0.745 0.771 0.0722 0.952 0.828
#> SD:pam 6 0.795 0.764 0.840 0.0404 0.982 0.920
#> CV:pam 6 0.830 0.851 0.928 0.1515 0.861 0.617
#> MAD:pam 6 0.826 0.654 0.832 0.0508 0.923 0.691
#> ATC:pam 6 0.991 0.970 0.983 0.0380 0.982 0.919
#> SD:hclust 6 0.790 0.790 0.826 0.0907 0.984 0.949
#> CV:hclust 6 0.742 0.718 0.860 0.0393 0.962 0.902
#> MAD:hclust 6 0.879 0.726 0.822 0.0484 0.949 0.812
#> ATC:hclust 6 0.767 0.682 0.793 0.1177 0.829 0.539
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 14581 rows and 58 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 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 1.000 1.000 1.000 0.4996 0.501 0.501
#> 3 3 1.000 0.984 0.994 0.1201 0.946 0.891
#> 4 4 0.877 0.883 0.943 0.1509 0.907 0.791
#> 5 5 0.912 0.823 0.900 0.0617 0.940 0.835
#> 6 6 0.790 0.790 0.826 0.0907 0.984 0.949
suggest_best_k()
suggests the best \(k\) based on these statistics. The rules are as follows:
suggest_best_k(res)
#> [1] 5
#> attr(,"optional")
#> [1] 2 3
There is also optional best \(k\) = 2 3 that is worth to check.
Following shows the table of the partitions (You need to click the show/hide
code output link to see it). The membership matrix (columns with name p*
)
is inferred by
clue::cl_consensus()
function with the SE
method. Basically the value in the membership matrix
represents the probability to belong to a certain group. The finall class
label for an item is determined with the group with highest probability it
belongs to.
In get_classes()
function, the entropy is calculated from the membership
matrix and the silhouette score is calculated from the consensus matrix.
cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#> class entropy silhouette p1 p2
#> SRR2082532 2 0 1 0 1
#> SRR2082533 2 0 1 0 1
#> SRR2082534 2 0 1 0 1
#> SRR2082535 2 0 1 0 1
#> SRR2082536 2 0 1 0 1
#> SRR2082530 2 0 1 0 1
#> SRR2082531 2 0 1 0 1
#> SRR2082528 2 0 1 0 1
#> SRR2082529 2 0 1 0 1
#> SRR2082526 2 0 1 0 1
#> SRR2082527 2 0 1 0 1
#> SRR2082521 2 0 1 0 1
#> SRR2082520 2 0 1 0 1
#> SRR2082518 2 0 1 0 1
#> SRR2082523 2 0 1 0 1
#> SRR2082524 2 0 1 0 1
#> SRR2082525 2 0 1 0 1
#> SRR2082522 2 0 1 0 1
#> SRR2082519 2 0 1 0 1
#> SRR2082513 2 0 1 0 1
#> SRR2082512 2 0 1 0 1
#> SRR2082516 2 0 1 0 1
#> SRR2082515 2 0 1 0 1
#> SRR2082517 2 0 1 0 1
#> SRR2082514 2 0 1 0 1
#> SRR2082508 1 0 1 1 0
#> SRR2082509 1 0 1 1 0
#> SRR2082507 1 0 1 1 0
#> SRR2082510 1 0 1 1 0
#> SRR2082511 1 0 1 1 0
#> SRR2082501 1 0 1 1 0
#> SRR2082502 1 0 1 1 0
#> SRR2082499 1 0 1 1 0
#> SRR2082500 1 0 1 1 0
#> SRR2082503 1 0 1 1 0
#> SRR2082505 1 0 1 1 0
#> SRR2082506 1 0 1 1 0
#> SRR2082504 1 0 1 1 0
#> SRR2082495 1 0 1 1 0
#> SRR2082496 1 0 1 1 0
#> SRR2082493 1 0 1 1 0
#> SRR2082494 1 0 1 1 0
#> SRR2082491 1 0 1 1 0
#> SRR2082492 1 0 1 1 0
#> SRR2082489 1 0 1 1 0
#> SRR2082490 1 0 1 1 0
#> SRR2082497 1 0 1 1 0
#> SRR2082498 1 0 1 1 0
#> SRR2082487 1 0 1 1 0
#> SRR2082488 1 0 1 1 0
#> SRR2082485 1 0 1 1 0
#> SRR2082486 1 0 1 1 0
#> SRR2082479 1 0 1 1 0
#> SRR2082480 1 0 1 1 0
#> SRR2082483 1 0 1 1 0
#> SRR2082484 1 0 1 1 0
#> SRR2082481 1 0 1 1 0
#> SRR2082482 1 0 1 1 0
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> SRR2082532 2 0.000 1.000 0.000 1 0.000
#> SRR2082533 2 0.000 1.000 0.000 1 0.000
#> SRR2082534 2 0.000 1.000 0.000 1 0.000
#> SRR2082535 2 0.000 1.000 0.000 1 0.000
#> SRR2082536 2 0.000 1.000 0.000 1 0.000
#> SRR2082530 2 0.000 1.000 0.000 1 0.000
#> SRR2082531 2 0.000 1.000 0.000 1 0.000
#> SRR2082528 2 0.000 1.000 0.000 1 0.000
#> SRR2082529 2 0.000 1.000 0.000 1 0.000
#> SRR2082526 2 0.000 1.000 0.000 1 0.000
#> SRR2082527 2 0.000 1.000 0.000 1 0.000
#> SRR2082521 2 0.000 1.000 0.000 1 0.000
#> SRR2082520 2 0.000 1.000 0.000 1 0.000
#> SRR2082518 2 0.000 1.000 0.000 1 0.000
#> SRR2082523 2 0.000 1.000 0.000 1 0.000
#> SRR2082524 2 0.000 1.000 0.000 1 0.000
#> SRR2082525 2 0.000 1.000 0.000 1 0.000
#> SRR2082522 2 0.000 1.000 0.000 1 0.000
#> SRR2082519 2 0.000 1.000 0.000 1 0.000
#> SRR2082513 2 0.000 1.000 0.000 1 0.000
#> SRR2082512 2 0.000 1.000 0.000 1 0.000
#> SRR2082516 2 0.000 1.000 0.000 1 0.000
#> SRR2082515 2 0.000 1.000 0.000 1 0.000
#> SRR2082517 2 0.000 1.000 0.000 1 0.000
#> SRR2082514 2 0.000 1.000 0.000 1 0.000
#> SRR2082508 1 0.000 0.988 1.000 0 0.000
#> SRR2082509 1 0.000 0.988 1.000 0 0.000
#> SRR2082507 1 0.000 0.988 1.000 0 0.000
#> SRR2082510 3 0.000 1.000 0.000 0 1.000
#> SRR2082511 1 0.593 0.447 0.644 0 0.356
#> SRR2082501 1 0.000 0.988 1.000 0 0.000
#> SRR2082502 1 0.000 0.988 1.000 0 0.000
#> SRR2082499 1 0.000 0.988 1.000 0 0.000
#> SRR2082500 1 0.000 0.988 1.000 0 0.000
#> SRR2082503 1 0.000 0.988 1.000 0 0.000
#> SRR2082505 1 0.000 0.988 1.000 0 0.000
#> SRR2082506 1 0.000 0.988 1.000 0 0.000
#> SRR2082504 1 0.000 0.988 1.000 0 0.000
#> SRR2082495 1 0.000 0.988 1.000 0 0.000
#> SRR2082496 1 0.000 0.988 1.000 0 0.000
#> SRR2082493 1 0.000 0.988 1.000 0 0.000
#> SRR2082494 1 0.000 0.988 1.000 0 0.000
#> SRR2082491 1 0.000 0.988 1.000 0 0.000
#> SRR2082492 1 0.000 0.988 1.000 0 0.000
#> SRR2082489 1 0.000 0.988 1.000 0 0.000
#> SRR2082490 1 0.000 0.988 1.000 0 0.000
#> SRR2082497 1 0.000 0.988 1.000 0 0.000
#> SRR2082498 1 0.000 0.988 1.000 0 0.000
#> SRR2082487 1 0.000 0.988 1.000 0 0.000
#> SRR2082488 1 0.000 0.988 1.000 0 0.000
#> SRR2082485 1 0.000 0.988 1.000 0 0.000
#> SRR2082486 1 0.000 0.988 1.000 0 0.000
#> SRR2082479 1 0.000 0.988 1.000 0 0.000
#> SRR2082480 1 0.000 0.988 1.000 0 0.000
#> SRR2082483 3 0.000 1.000 0.000 0 1.000
#> SRR2082484 3 0.000 1.000 0.000 0 1.000
#> SRR2082481 1 0.000 0.988 1.000 0 0.000
#> SRR2082482 1 0.000 0.988 1.000 0 0.000
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> SRR2082532 4 0.4843 0.518 0.000 0.396 0.000 0.604
#> SRR2082533 4 0.4843 0.518 0.000 0.396 0.000 0.604
#> SRR2082534 4 0.0000 0.722 0.000 0.000 0.000 1.000
#> SRR2082535 4 0.0000 0.722 0.000 0.000 0.000 1.000
#> SRR2082536 4 0.0000 0.722 0.000 0.000 0.000 1.000
#> SRR2082530 2 0.1940 0.874 0.000 0.924 0.000 0.076
#> SRR2082531 2 0.1940 0.874 0.000 0.924 0.000 0.076
#> SRR2082528 4 0.0000 0.722 0.000 0.000 0.000 1.000
#> SRR2082529 4 0.0000 0.722 0.000 0.000 0.000 1.000
#> SRR2082526 2 0.0921 0.902 0.000 0.972 0.000 0.028
#> SRR2082527 2 0.0921 0.902 0.000 0.972 0.000 0.028
#> SRR2082521 2 0.0000 0.899 0.000 1.000 0.000 0.000
#> SRR2082520 2 0.2469 0.861 0.000 0.892 0.000 0.108
#> SRR2082518 2 0.0000 0.899 0.000 1.000 0.000 0.000
#> SRR2082523 4 0.3486 0.712 0.000 0.188 0.000 0.812
#> SRR2082524 4 0.3486 0.712 0.000 0.188 0.000 0.812
#> SRR2082525 2 0.0921 0.902 0.000 0.972 0.000 0.028
#> SRR2082522 2 0.4564 0.553 0.000 0.672 0.000 0.328
#> SRR2082519 2 0.2469 0.861 0.000 0.892 0.000 0.108
#> SRR2082513 2 0.0000 0.899 0.000 1.000 0.000 0.000
#> SRR2082512 2 0.0000 0.899 0.000 1.000 0.000 0.000
#> SRR2082516 4 0.4843 0.518 0.000 0.396 0.000 0.604
#> SRR2082515 2 0.2469 0.861 0.000 0.892 0.000 0.108
#> SRR2082517 2 0.2469 0.861 0.000 0.892 0.000 0.108
#> SRR2082514 4 0.4843 0.518 0.000 0.396 0.000 0.604
#> SRR2082508 1 0.0000 0.988 1.000 0.000 0.000 0.000
#> SRR2082509 1 0.0000 0.988 1.000 0.000 0.000 0.000
#> SRR2082507 1 0.0000 0.988 1.000 0.000 0.000 0.000
#> SRR2082510 3 0.0000 1.000 0.000 0.000 1.000 0.000
#> SRR2082511 1 0.4697 0.447 0.644 0.000 0.356 0.000
#> SRR2082501 1 0.0000 0.988 1.000 0.000 0.000 0.000
#> SRR2082502 1 0.0000 0.988 1.000 0.000 0.000 0.000
#> SRR2082499 1 0.0000 0.988 1.000 0.000 0.000 0.000
#> SRR2082500 1 0.0000 0.988 1.000 0.000 0.000 0.000
#> SRR2082503 1 0.0000 0.988 1.000 0.000 0.000 0.000
#> SRR2082505 1 0.0000 0.988 1.000 0.000 0.000 0.000
#> SRR2082506 1 0.0000 0.988 1.000 0.000 0.000 0.000
#> SRR2082504 1 0.0000 0.988 1.000 0.000 0.000 0.000
#> SRR2082495 1 0.0000 0.988 1.000 0.000 0.000 0.000
#> SRR2082496 1 0.0000 0.988 1.000 0.000 0.000 0.000
#> SRR2082493 1 0.0000 0.988 1.000 0.000 0.000 0.000
#> SRR2082494 1 0.0000 0.988 1.000 0.000 0.000 0.000
#> SRR2082491 1 0.0000 0.988 1.000 0.000 0.000 0.000
#> SRR2082492 1 0.0000 0.988 1.000 0.000 0.000 0.000
#> SRR2082489 1 0.0000 0.988 1.000 0.000 0.000 0.000
#> SRR2082490 1 0.0000 0.988 1.000 0.000 0.000 0.000
#> SRR2082497 1 0.0000 0.988 1.000 0.000 0.000 0.000
#> SRR2082498 1 0.0000 0.988 1.000 0.000 0.000 0.000
#> SRR2082487 1 0.0000 0.988 1.000 0.000 0.000 0.000
#> SRR2082488 1 0.0000 0.988 1.000 0.000 0.000 0.000
#> SRR2082485 1 0.0000 0.988 1.000 0.000 0.000 0.000
#> SRR2082486 1 0.0000 0.988 1.000 0.000 0.000 0.000
#> SRR2082479 1 0.0000 0.988 1.000 0.000 0.000 0.000
#> SRR2082480 1 0.0000 0.988 1.000 0.000 0.000 0.000
#> SRR2082483 3 0.0000 1.000 0.000 0.000 1.000 0.000
#> SRR2082484 3 0.0000 1.000 0.000 0.000 1.000 0.000
#> SRR2082481 1 0.0000 0.988 1.000 0.000 0.000 0.000
#> SRR2082482 1 0.0000 0.988 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
#> SRR2082532 5 0.0693 0.469 0.000 0.008 0.000 0.012 0.980
#> SRR2082533 5 0.0693 0.469 0.000 0.008 0.000 0.012 0.980
#> SRR2082534 4 0.4101 0.782 0.000 0.000 0.000 0.628 0.372
#> SRR2082535 4 0.4101 0.782 0.000 0.000 0.000 0.628 0.372
#> SRR2082536 4 0.4101 0.782 0.000 0.000 0.000 0.628 0.372
#> SRR2082530 2 0.3912 0.769 0.000 0.804 0.000 0.108 0.088
#> SRR2082531 2 0.3912 0.769 0.000 0.804 0.000 0.108 0.088
#> SRR2082528 4 0.4101 0.782 0.000 0.000 0.000 0.628 0.372
#> SRR2082529 4 0.4101 0.782 0.000 0.000 0.000 0.628 0.372
#> SRR2082526 2 0.2561 0.847 0.000 0.856 0.000 0.144 0.000
#> SRR2082527 2 0.2561 0.847 0.000 0.856 0.000 0.144 0.000
#> SRR2082521 2 0.2712 0.803 0.000 0.880 0.000 0.032 0.088
#> SRR2082520 5 0.6475 0.580 0.000 0.212 0.000 0.304 0.484
#> SRR2082518 2 0.2230 0.838 0.000 0.884 0.000 0.116 0.000
#> SRR2082523 4 0.5542 0.648 0.000 0.072 0.000 0.532 0.396
#> SRR2082524 4 0.5542 0.648 0.000 0.072 0.000 0.532 0.396
#> SRR2082525 2 0.2561 0.847 0.000 0.856 0.000 0.144 0.000
#> SRR2082522 4 0.6037 -0.571 0.000 0.116 0.000 0.444 0.440
#> SRR2082519 5 0.6475 0.580 0.000 0.212 0.000 0.304 0.484
#> SRR2082513 2 0.2712 0.803 0.000 0.880 0.000 0.032 0.088
#> SRR2082512 2 0.2230 0.838 0.000 0.884 0.000 0.116 0.000
#> SRR2082516 5 0.0290 0.478 0.000 0.008 0.000 0.000 0.992
#> SRR2082515 5 0.6475 0.580 0.000 0.212 0.000 0.304 0.484
#> SRR2082517 5 0.6475 0.580 0.000 0.212 0.000 0.304 0.484
#> SRR2082514 5 0.0290 0.478 0.000 0.008 0.000 0.000 0.992
#> SRR2082508 1 0.0000 0.974 1.000 0.000 0.000 0.000 0.000
#> SRR2082509 1 0.0000 0.974 1.000 0.000 0.000 0.000 0.000
#> SRR2082507 1 0.0000 0.974 1.000 0.000 0.000 0.000 0.000
#> SRR2082510 3 0.0000 1.000 0.000 0.000 1.000 0.000 0.000
#> SRR2082511 1 0.4865 0.428 0.616 0.000 0.356 0.020 0.008
#> SRR2082501 1 0.0000 0.974 1.000 0.000 0.000 0.000 0.000
#> SRR2082502 1 0.0000 0.974 1.000 0.000 0.000 0.000 0.000
#> SRR2082499 1 0.0000 0.974 1.000 0.000 0.000 0.000 0.000
#> SRR2082500 1 0.0000 0.974 1.000 0.000 0.000 0.000 0.000
#> SRR2082503 1 0.0693 0.968 0.980 0.000 0.000 0.012 0.008
#> SRR2082505 1 0.0000 0.974 1.000 0.000 0.000 0.000 0.000
#> SRR2082506 1 0.0000 0.974 1.000 0.000 0.000 0.000 0.000
#> SRR2082504 1 0.0000 0.974 1.000 0.000 0.000 0.000 0.000
#> SRR2082495 1 0.1251 0.960 0.956 0.000 0.000 0.036 0.008
#> SRR2082496 1 0.1251 0.960 0.956 0.000 0.000 0.036 0.008
#> SRR2082493 1 0.1251 0.960 0.956 0.000 0.000 0.036 0.008
#> SRR2082494 1 0.1251 0.960 0.956 0.000 0.000 0.036 0.008
#> SRR2082491 1 0.0609 0.969 0.980 0.000 0.000 0.020 0.000
#> SRR2082492 1 0.0609 0.969 0.980 0.000 0.000 0.020 0.000
#> SRR2082489 1 0.0162 0.973 0.996 0.000 0.000 0.004 0.000
#> SRR2082490 1 0.0162 0.973 0.996 0.000 0.000 0.004 0.000
#> SRR2082497 1 0.0000 0.974 1.000 0.000 0.000 0.000 0.000
#> SRR2082498 1 0.0000 0.974 1.000 0.000 0.000 0.000 0.000
#> SRR2082487 1 0.1251 0.960 0.956 0.000 0.000 0.036 0.008
#> SRR2082488 1 0.1251 0.960 0.956 0.000 0.000 0.036 0.008
#> SRR2082485 1 0.1251 0.960 0.956 0.000 0.000 0.036 0.008
#> SRR2082486 1 0.1251 0.960 0.956 0.000 0.000 0.036 0.008
#> SRR2082479 1 0.0000 0.974 1.000 0.000 0.000 0.000 0.000
#> SRR2082480 1 0.0000 0.974 1.000 0.000 0.000 0.000 0.000
#> SRR2082483 3 0.0000 1.000 0.000 0.000 1.000 0.000 0.000
#> SRR2082484 3 0.0000 1.000 0.000 0.000 1.000 0.000 0.000
#> SRR2082481 1 0.0000 0.974 1.000 0.000 0.000 0.000 0.000
#> SRR2082482 1 0.0000 0.974 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
#> SRR2082532 5 0.5660 0.9809 0.000 0.016 0.400 0.100 0.484 0.000
#> SRR2082533 5 0.5660 0.9809 0.000 0.016 0.400 0.100 0.484 0.000
#> SRR2082534 4 0.0000 0.9230 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR2082535 4 0.0000 0.9230 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR2082536 4 0.0000 0.9230 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR2082530 2 0.3272 0.7134 0.000 0.836 0.080 0.076 0.008 0.000
#> SRR2082531 2 0.3272 0.7134 0.000 0.836 0.080 0.076 0.008 0.000
#> SRR2082528 4 0.0000 0.9230 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR2082529 4 0.0000 0.9230 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR2082526 2 0.3694 0.7735 0.000 0.740 0.232 0.028 0.000 0.000
#> SRR2082527 2 0.3694 0.7735 0.000 0.740 0.232 0.028 0.000 0.000
#> SRR2082521 2 0.2346 0.7220 0.000 0.868 0.124 0.000 0.008 0.000
#> SRR2082520 3 0.0632 0.9010 0.000 0.024 0.976 0.000 0.000 0.000
#> SRR2082518 2 0.3175 0.7607 0.000 0.744 0.256 0.000 0.000 0.000
#> SRR2082523 4 0.3413 0.7899 0.000 0.108 0.080 0.812 0.000 0.000
#> SRR2082524 4 0.3413 0.7899 0.000 0.108 0.080 0.812 0.000 0.000
#> SRR2082525 2 0.3694 0.7735 0.000 0.740 0.232 0.028 0.000 0.000
#> SRR2082522 3 0.3890 0.5956 0.000 0.036 0.752 0.204 0.008 0.000
#> SRR2082519 3 0.0632 0.9010 0.000 0.024 0.976 0.000 0.000 0.000
#> SRR2082513 2 0.2346 0.7220 0.000 0.868 0.124 0.000 0.008 0.000
#> SRR2082512 2 0.3175 0.7607 0.000 0.744 0.256 0.000 0.000 0.000
#> SRR2082516 5 0.5510 0.9808 0.000 0.016 0.400 0.084 0.500 0.000
#> SRR2082515 3 0.0632 0.9010 0.000 0.024 0.976 0.000 0.000 0.000
#> SRR2082517 3 0.0713 0.8973 0.000 0.028 0.972 0.000 0.000 0.000
#> SRR2082514 5 0.5510 0.9808 0.000 0.016 0.400 0.084 0.500 0.000
#> SRR2082508 1 0.3833 0.8198 0.556 0.000 0.000 0.000 0.444 0.000
#> SRR2082509 1 0.3847 0.8182 0.544 0.000 0.000 0.000 0.456 0.000
#> SRR2082507 1 0.3833 0.8198 0.556 0.000 0.000 0.000 0.444 0.000
#> SRR2082510 6 0.0000 1.0000 0.000 0.000 0.000 0.000 0.000 1.000
#> SRR2082511 1 0.4277 0.0316 0.616 0.000 0.000 0.000 0.028 0.356
#> SRR2082501 1 0.3843 0.8195 0.548 0.000 0.000 0.000 0.452 0.000
#> SRR2082502 1 0.3843 0.8195 0.548 0.000 0.000 0.000 0.452 0.000
#> SRR2082499 1 0.3843 0.8195 0.548 0.000 0.000 0.000 0.452 0.000
#> SRR2082500 1 0.3843 0.8195 0.548 0.000 0.000 0.000 0.452 0.000
#> SRR2082503 1 0.2697 0.7073 0.812 0.000 0.000 0.000 0.188 0.000
#> SRR2082505 1 0.3817 0.8149 0.568 0.000 0.000 0.000 0.432 0.000
#> SRR2082506 1 0.3833 0.8198 0.556 0.000 0.000 0.000 0.444 0.000
#> SRR2082504 1 0.3817 0.8149 0.568 0.000 0.000 0.000 0.432 0.000
#> SRR2082495 1 0.0713 0.5966 0.972 0.000 0.000 0.000 0.028 0.000
#> SRR2082496 1 0.0713 0.5966 0.972 0.000 0.000 0.000 0.028 0.000
#> SRR2082493 1 0.0713 0.5966 0.972 0.000 0.000 0.000 0.028 0.000
#> SRR2082494 1 0.0713 0.5966 0.972 0.000 0.000 0.000 0.028 0.000
#> SRR2082491 1 0.3428 0.7529 0.696 0.000 0.000 0.000 0.304 0.000
#> SRR2082492 1 0.3428 0.7529 0.696 0.000 0.000 0.000 0.304 0.000
#> SRR2082489 1 0.3971 0.8177 0.548 0.004 0.000 0.000 0.448 0.000
#> SRR2082490 1 0.3971 0.8177 0.548 0.004 0.000 0.000 0.448 0.000
#> SRR2082497 1 0.3843 0.8195 0.548 0.000 0.000 0.000 0.452 0.000
#> SRR2082498 1 0.3843 0.8195 0.548 0.000 0.000 0.000 0.452 0.000
#> SRR2082487 1 0.0291 0.6125 0.992 0.004 0.000 0.000 0.004 0.000
#> SRR2082488 1 0.0291 0.6125 0.992 0.004 0.000 0.000 0.004 0.000
#> SRR2082485 1 0.0291 0.6125 0.992 0.004 0.000 0.000 0.004 0.000
#> SRR2082486 1 0.0291 0.6125 0.992 0.004 0.000 0.000 0.004 0.000
#> SRR2082479 1 0.3843 0.8195 0.548 0.000 0.000 0.000 0.452 0.000
#> SRR2082480 1 0.3843 0.8195 0.548 0.000 0.000 0.000 0.452 0.000
#> SRR2082483 6 0.0000 1.0000 0.000 0.000 0.000 0.000 0.000 1.000
#> SRR2082484 6 0.0000 1.0000 0.000 0.000 0.000 0.000 0.000 1.000
#> SRR2082481 1 0.3843 0.8195 0.548 0.000 0.000 0.000 0.452 0.000
#> SRR2082482 1 0.3843 0.8195 0.548 0.000 0.000 0.000 0.452 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 14581 rows and 58 columns.
#> Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'SD' method.
#> Subgroups are detected by 'kmeans' method.
#> Performed in total 1250 partitions by row resampling.
#> Best k for subgroups seems to be 2.
#>
#> Following methods can be applied to this 'ConsensusPartition' object:
#> [1] "cola_report" "collect_classes" "collect_plots"
#> [4] "collect_stats" "colnames" "compare_signatures"
#> [7] "consensus_heatmap" "dimension_reduction" "functional_enrichment"
#> [10] "get_anno_col" "get_anno" "get_classes"
#> [13] "get_consensus" "get_matrix" "get_membership"
#> [16] "get_param" "get_signatures" "get_stats"
#> [19] "is_best_k" "is_stable_k" "membership_heatmap"
#> [22] "ncol" "nrow" "plot_ecdf"
#> [25] "rownames" "select_partition_number" "show"
#> [28] "suggest_best_k" "test_to_known_factors"
collect_plots()
function collects all the plots made from res
for all k
(number of partitions)
into one single page to provide an easy and fast comparison between different k
.
collect_plots(res)
The plots are:
k
and the heatmap of
predicted classes for each k
.k
.k
.k
.All the plots in panels can be made by individual functions and they are plotted later in this section.
select_partition_number()
produces several plots showing different
statistics for choosing “optimized” k
. There are following statistics:
k
;k
, the area increased is defined as \(A_k - A_{k-1}\).The detailed explanations of these statistics can be found in the cola vignette.
Generally speaking, lower PAC score, higher mean silhouette score or higher
concordance corresponds to better partition. Rand index and Jaccard index
measure how similar the current partition is compared to partition with k-1
.
If they are too similar, we won't accept k
is better than k-1
.
select_partition_number(res)
The numeric values for all these statistics can be obtained by get_stats()
.
get_stats(res)
#> k 1-PAC mean_silhouette concordance area_increased Rand Jaccard
#> 2 2 1.000 1.000 1.000 0.4996 0.501 0.501
#> 3 3 0.694 0.184 0.771 0.2333 0.946 0.891
#> 4 4 0.585 0.684 0.724 0.1238 0.752 0.486
#> 5 5 0.547 0.590 0.689 0.0747 1.000 1.000
#> 6 6 0.621 0.525 0.641 0.0659 0.926 0.745
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
#> SRR2082532 2 0 1 0 1
#> SRR2082533 2 0 1 0 1
#> SRR2082534 2 0 1 0 1
#> SRR2082535 2 0 1 0 1
#> SRR2082536 2 0 1 0 1
#> SRR2082530 2 0 1 0 1
#> SRR2082531 2 0 1 0 1
#> SRR2082528 2 0 1 0 1
#> SRR2082529 2 0 1 0 1
#> SRR2082526 2 0 1 0 1
#> SRR2082527 2 0 1 0 1
#> SRR2082521 2 0 1 0 1
#> SRR2082520 2 0 1 0 1
#> SRR2082518 2 0 1 0 1
#> SRR2082523 2 0 1 0 1
#> SRR2082524 2 0 1 0 1
#> SRR2082525 2 0 1 0 1
#> SRR2082522 2 0 1 0 1
#> SRR2082519 2 0 1 0 1
#> SRR2082513 2 0 1 0 1
#> SRR2082512 2 0 1 0 1
#> SRR2082516 2 0 1 0 1
#> SRR2082515 2 0 1 0 1
#> SRR2082517 2 0 1 0 1
#> SRR2082514 2 0 1 0 1
#> SRR2082508 1 0 1 1 0
#> SRR2082509 1 0 1 1 0
#> SRR2082507 1 0 1 1 0
#> SRR2082510 1 0 1 1 0
#> SRR2082511 1 0 1 1 0
#> SRR2082501 1 0 1 1 0
#> SRR2082502 1 0 1 1 0
#> SRR2082499 1 0 1 1 0
#> SRR2082500 1 0 1 1 0
#> SRR2082503 1 0 1 1 0
#> SRR2082505 1 0 1 1 0
#> SRR2082506 1 0 1 1 0
#> SRR2082504 1 0 1 1 0
#> SRR2082495 1 0 1 1 0
#> SRR2082496 1 0 1 1 0
#> SRR2082493 1 0 1 1 0
#> SRR2082494 1 0 1 1 0
#> SRR2082491 1 0 1 1 0
#> SRR2082492 1 0 1 1 0
#> SRR2082489 1 0 1 1 0
#> SRR2082490 1 0 1 1 0
#> SRR2082497 1 0 1 1 0
#> SRR2082498 1 0 1 1 0
#> SRR2082487 1 0 1 1 0
#> SRR2082488 1 0 1 1 0
#> SRR2082485 1 0 1 1 0
#> SRR2082486 1 0 1 1 0
#> SRR2082479 1 0 1 1 0
#> SRR2082480 1 0 1 1 0
#> SRR2082483 1 0 1 1 0
#> SRR2082484 1 0 1 1 0
#> SRR2082481 1 0 1 1 0
#> SRR2082482 1 0 1 1 0
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> SRR2082532 2 0.6111 0.837 0.000 0.604 0.396
#> SRR2082533 2 0.6111 0.837 0.000 0.604 0.396
#> SRR2082534 2 0.6235 0.823 0.000 0.564 0.436
#> SRR2082535 2 0.6235 0.823 0.000 0.564 0.436
#> SRR2082536 2 0.6235 0.823 0.000 0.564 0.436
#> SRR2082530 2 0.3816 0.872 0.000 0.852 0.148
#> SRR2082531 2 0.3816 0.872 0.000 0.852 0.148
#> SRR2082528 2 0.6235 0.823 0.000 0.564 0.436
#> SRR2082529 2 0.6235 0.823 0.000 0.564 0.436
#> SRR2082526 2 0.2066 0.867 0.000 0.940 0.060
#> SRR2082527 2 0.2066 0.867 0.000 0.940 0.060
#> SRR2082521 2 0.2261 0.869 0.000 0.932 0.068
#> SRR2082520 2 0.0000 0.858 0.000 1.000 0.000
#> SRR2082518 2 0.0000 0.858 0.000 1.000 0.000
#> SRR2082523 2 0.5178 0.865 0.000 0.744 0.256
#> SRR2082524 2 0.5178 0.865 0.000 0.744 0.256
#> SRR2082525 2 0.2066 0.867 0.000 0.940 0.060
#> SRR2082522 2 0.5706 0.840 0.000 0.680 0.320
#> SRR2082519 2 0.0000 0.858 0.000 1.000 0.000
#> SRR2082513 2 0.0237 0.858 0.000 0.996 0.004
#> SRR2082512 2 0.0000 0.858 0.000 1.000 0.000
#> SRR2082516 2 0.6225 0.824 0.000 0.568 0.432
#> SRR2082515 2 0.0000 0.858 0.000 1.000 0.000
#> SRR2082517 2 0.0000 0.858 0.000 1.000 0.000
#> SRR2082514 2 0.4178 0.867 0.000 0.828 0.172
#> SRR2082508 1 0.6309 -0.957 0.504 0.000 0.496
#> SRR2082509 1 0.6308 -0.952 0.508 0.000 0.492
#> SRR2082507 1 0.6309 -0.957 0.504 0.000 0.496
#> SRR2082510 1 0.1964 0.321 0.944 0.000 0.056
#> SRR2082511 1 0.1964 0.321 0.944 0.000 0.056
#> SRR2082501 1 0.6308 -0.952 0.508 0.000 0.492
#> SRR2082502 1 0.6308 -0.952 0.508 0.000 0.492
#> SRR2082499 1 0.6308 -0.952 0.508 0.000 0.492
#> SRR2082500 1 0.6308 -0.952 0.508 0.000 0.492
#> SRR2082503 1 0.3816 0.208 0.852 0.000 0.148
#> SRR2082505 1 0.6309 -0.957 0.504 0.000 0.496
#> SRR2082506 1 0.6309 -0.957 0.504 0.000 0.496
#> SRR2082504 1 0.6309 -0.957 0.504 0.000 0.496
#> SRR2082495 1 0.0000 0.331 1.000 0.000 0.000
#> SRR2082496 1 0.0000 0.331 1.000 0.000 0.000
#> SRR2082493 1 0.0000 0.331 1.000 0.000 0.000
#> SRR2082494 1 0.0000 0.331 1.000 0.000 0.000
#> SRR2082491 1 0.5948 -0.376 0.640 0.000 0.360
#> SRR2082492 1 0.5948 -0.376 0.640 0.000 0.360
#> SRR2082489 1 0.6309 -0.986 0.500 0.000 0.500
#> SRR2082490 3 0.6309 0.978 0.500 0.000 0.500
#> SRR2082497 1 0.6308 -0.952 0.508 0.000 0.492
#> SRR2082498 1 0.6308 -0.952 0.508 0.000 0.492
#> SRR2082487 3 0.6309 0.989 0.496 0.000 0.504
#> SRR2082488 3 0.6309 0.989 0.496 0.000 0.504
#> SRR2082485 1 0.1163 0.325 0.972 0.000 0.028
#> SRR2082486 1 0.1163 0.325 0.972 0.000 0.028
#> SRR2082479 1 0.6309 -0.957 0.504 0.000 0.496
#> SRR2082480 1 0.6309 -0.957 0.504 0.000 0.496
#> SRR2082483 1 0.2066 0.321 0.940 0.000 0.060
#> SRR2082484 1 0.2066 0.321 0.940 0.000 0.060
#> SRR2082481 1 0.6309 -0.957 0.504 0.000 0.496
#> SRR2082482 1 0.6309 -0.957 0.504 0.000 0.496
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> SRR2082532 4 0.2222 0.6741 0.000 0.016 0.060 0.924
#> SRR2082533 4 0.2222 0.6741 0.000 0.016 0.060 0.924
#> SRR2082534 4 0.0469 0.6869 0.000 0.000 0.012 0.988
#> SRR2082535 4 0.0469 0.6869 0.000 0.000 0.012 0.988
#> SRR2082536 4 0.0469 0.6877 0.000 0.000 0.012 0.988
#> SRR2082530 4 0.6712 -0.3453 0.000 0.344 0.104 0.552
#> SRR2082531 4 0.6712 -0.3453 0.000 0.344 0.104 0.552
#> SRR2082528 4 0.0469 0.6877 0.000 0.000 0.012 0.988
#> SRR2082529 4 0.0469 0.6877 0.000 0.000 0.012 0.988
#> SRR2082526 2 0.6707 0.7651 0.000 0.468 0.088 0.444
#> SRR2082527 2 0.6707 0.7651 0.000 0.468 0.088 0.444
#> SRR2082521 4 0.6277 -0.6451 0.000 0.472 0.056 0.472
#> SRR2082520 2 0.5775 0.8374 0.000 0.560 0.032 0.408
#> SRR2082518 2 0.5827 0.8583 0.000 0.568 0.036 0.396
#> SRR2082523 4 0.4869 0.5178 0.000 0.132 0.088 0.780
#> SRR2082524 4 0.4869 0.5178 0.000 0.132 0.088 0.780
#> SRR2082525 2 0.6707 0.7651 0.000 0.468 0.088 0.444
#> SRR2082522 4 0.4199 0.4919 0.000 0.164 0.032 0.804
#> SRR2082519 2 0.5498 0.8557 0.000 0.576 0.020 0.404
#> SRR2082513 2 0.6042 0.8143 0.000 0.560 0.048 0.392
#> SRR2082512 2 0.5827 0.8583 0.000 0.568 0.036 0.396
#> SRR2082516 4 0.1004 0.6811 0.000 0.004 0.024 0.972
#> SRR2082515 2 0.5498 0.8557 0.000 0.576 0.020 0.404
#> SRR2082517 2 0.5487 0.8573 0.000 0.580 0.020 0.400
#> SRR2082514 4 0.6005 -0.0702 0.000 0.324 0.060 0.616
#> SRR2082508 1 0.2011 0.8440 0.920 0.080 0.000 0.000
#> SRR2082509 1 0.1118 0.8543 0.964 0.036 0.000 0.000
#> SRR2082507 1 0.2011 0.8440 0.920 0.080 0.000 0.000
#> SRR2082510 3 0.6416 0.8178 0.200 0.152 0.648 0.000
#> SRR2082511 3 0.5073 0.8420 0.200 0.056 0.744 0.000
#> SRR2082501 1 0.2124 0.8390 0.932 0.040 0.028 0.000
#> SRR2082502 1 0.2124 0.8390 0.932 0.040 0.028 0.000
#> SRR2082499 1 0.2840 0.8190 0.900 0.044 0.056 0.000
#> SRR2082500 1 0.2840 0.8190 0.900 0.044 0.056 0.000
#> SRR2082503 1 0.6554 -0.1584 0.540 0.084 0.376 0.000
#> SRR2082505 1 0.2216 0.8433 0.908 0.092 0.000 0.000
#> SRR2082506 1 0.2011 0.8440 0.920 0.080 0.000 0.000
#> SRR2082504 1 0.2216 0.8433 0.908 0.092 0.000 0.000
#> SRR2082495 3 0.5365 0.8462 0.264 0.044 0.692 0.000
#> SRR2082496 3 0.5365 0.8462 0.264 0.044 0.692 0.000
#> SRR2082493 3 0.4661 0.8583 0.256 0.016 0.728 0.000
#> SRR2082494 3 0.4661 0.8583 0.256 0.016 0.728 0.000
#> SRR2082491 1 0.5716 0.4927 0.680 0.068 0.252 0.000
#> SRR2082492 1 0.5716 0.4927 0.680 0.068 0.252 0.000
#> SRR2082489 1 0.3542 0.8138 0.852 0.120 0.028 0.000
#> SRR2082490 1 0.3542 0.8138 0.852 0.120 0.028 0.000
#> SRR2082497 1 0.1256 0.8521 0.964 0.028 0.008 0.000
#> SRR2082498 1 0.1256 0.8521 0.964 0.028 0.008 0.000
#> SRR2082487 1 0.3842 0.7951 0.836 0.128 0.036 0.000
#> SRR2082488 1 0.3842 0.7951 0.836 0.128 0.036 0.000
#> SRR2082485 3 0.6274 0.7876 0.292 0.088 0.620 0.000
#> SRR2082486 3 0.6274 0.7876 0.292 0.088 0.620 0.000
#> SRR2082479 1 0.1716 0.8540 0.936 0.064 0.000 0.000
#> SRR2082480 1 0.1716 0.8540 0.936 0.064 0.000 0.000
#> SRR2082483 3 0.6416 0.8178 0.200 0.152 0.648 0.000
#> SRR2082484 3 0.6416 0.8178 0.200 0.152 0.648 0.000
#> SRR2082481 1 0.2011 0.8511 0.920 0.080 0.000 0.000
#> SRR2082482 1 0.2011 0.8511 0.920 0.080 0.000 0.000
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> SRR2082532 4 0.3030 0.6421 0.000 0.004 0.040 0.868 NA
#> SRR2082533 4 0.3030 0.6421 0.000 0.004 0.040 0.868 NA
#> SRR2082534 4 0.0566 0.6613 0.000 0.000 0.012 0.984 NA
#> SRR2082535 4 0.0566 0.6613 0.000 0.000 0.012 0.984 NA
#> SRR2082536 4 0.1124 0.6592 0.000 0.000 0.004 0.960 NA
#> SRR2082530 4 0.6174 0.0162 0.000 0.256 0.000 0.552 NA
#> SRR2082531 4 0.6174 0.0162 0.000 0.256 0.000 0.552 NA
#> SRR2082528 4 0.1124 0.6592 0.000 0.000 0.004 0.960 NA
#> SRR2082529 4 0.1124 0.6592 0.000 0.000 0.004 0.960 NA
#> SRR2082526 2 0.5584 0.5754 0.000 0.532 0.000 0.392 NA
#> SRR2082527 2 0.5584 0.5754 0.000 0.532 0.000 0.392 NA
#> SRR2082521 4 0.6789 -0.5048 0.000 0.360 0.004 0.408 NA
#> SRR2082520 2 0.6910 0.7179 0.000 0.480 0.024 0.320 NA
#> SRR2082518 2 0.3876 0.7147 0.000 0.684 0.000 0.316 NA
#> SRR2082523 4 0.4806 0.5279 0.000 0.088 0.016 0.752 NA
#> SRR2082524 4 0.4806 0.5279 0.000 0.088 0.016 0.752 NA
#> SRR2082525 2 0.5584 0.5754 0.000 0.532 0.000 0.392 NA
#> SRR2082522 4 0.5662 0.2849 0.000 0.164 0.036 0.692 NA
#> SRR2082519 2 0.6910 0.7179 0.000 0.480 0.024 0.320 NA
#> SRR2082513 2 0.6890 0.6537 0.000 0.448 0.012 0.324 NA
#> SRR2082512 2 0.3876 0.7147 0.000 0.684 0.000 0.316 NA
#> SRR2082516 4 0.2152 0.6441 0.000 0.004 0.044 0.920 NA
#> SRR2082515 2 0.6910 0.7179 0.000 0.480 0.024 0.320 NA
#> SRR2082517 2 0.6744 0.7226 0.000 0.500 0.020 0.316 NA
#> SRR2082514 4 0.7394 -0.2097 0.000 0.248 0.064 0.492 NA
#> SRR2082508 1 0.3995 0.7103 0.788 0.152 0.000 0.000 NA
#> SRR2082509 1 0.1836 0.7497 0.936 0.008 0.040 0.000 NA
#> SRR2082507 1 0.3995 0.7103 0.788 0.152 0.000 0.000 NA
#> SRR2082510 3 0.6343 0.7291 0.100 0.024 0.536 0.000 NA
#> SRR2082511 3 0.5744 0.7586 0.100 0.020 0.652 0.000 NA
#> SRR2082501 1 0.4844 0.7024 0.764 0.032 0.116 0.000 NA
#> SRR2082502 1 0.4844 0.7024 0.764 0.032 0.116 0.000 NA
#> SRR2082499 1 0.5305 0.6731 0.720 0.032 0.160 0.000 NA
#> SRR2082500 1 0.5305 0.6731 0.720 0.032 0.160 0.000 NA
#> SRR2082503 1 0.7279 -0.0301 0.440 0.108 0.372 0.000 NA
#> SRR2082505 1 0.3953 0.7093 0.792 0.148 0.000 0.000 NA
#> SRR2082506 1 0.3995 0.7103 0.788 0.152 0.000 0.000 NA
#> SRR2082504 1 0.3953 0.7093 0.792 0.148 0.000 0.000 NA
#> SRR2082495 3 0.2890 0.7358 0.160 0.000 0.836 0.000 NA
#> SRR2082496 3 0.2890 0.7358 0.160 0.000 0.836 0.000 NA
#> SRR2082493 3 0.3521 0.7648 0.140 0.000 0.820 0.000 NA
#> SRR2082494 3 0.3521 0.7648 0.140 0.000 0.820 0.000 NA
#> SRR2082491 1 0.5321 0.1832 0.484 0.004 0.472 0.000 NA
#> SRR2082492 1 0.5321 0.1832 0.484 0.004 0.472 0.000 NA
#> SRR2082489 1 0.5148 0.6714 0.748 0.104 0.048 0.000 NA
#> SRR2082490 1 0.5148 0.6714 0.748 0.104 0.048 0.000 NA
#> SRR2082497 1 0.3821 0.7310 0.836 0.044 0.036 0.000 NA
#> SRR2082498 1 0.3821 0.7310 0.836 0.044 0.036 0.000 NA
#> SRR2082487 1 0.5983 0.6229 0.688 0.096 0.108 0.000 NA
#> SRR2082488 1 0.5983 0.6229 0.688 0.096 0.108 0.000 NA
#> SRR2082485 3 0.6694 0.6471 0.192 0.084 0.608 0.000 NA
#> SRR2082486 3 0.6694 0.6471 0.192 0.084 0.608 0.000 NA
#> SRR2082479 1 0.2095 0.7465 0.928 0.028 0.020 0.000 NA
#> SRR2082480 1 0.2095 0.7465 0.928 0.028 0.020 0.000 NA
#> SRR2082483 3 0.5793 0.7293 0.100 0.000 0.536 0.000 NA
#> SRR2082484 3 0.5793 0.7293 0.100 0.000 0.536 0.000 NA
#> SRR2082481 1 0.2300 0.7399 0.908 0.052 0.000 0.000 NA
#> SRR2082482 1 0.2300 0.7399 0.908 0.052 0.000 0.000 NA
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> SRR2082532 4 0.4956 0.6135 0.000 0.044 0.024 0.744 NA 0.112
#> SRR2082533 4 0.4956 0.6135 0.000 0.044 0.024 0.744 NA 0.112
#> SRR2082534 4 0.0665 0.6620 0.000 0.000 0.004 0.980 NA 0.008
#> SRR2082535 4 0.0665 0.6620 0.000 0.000 0.004 0.980 NA 0.008
#> SRR2082536 4 0.0935 0.6626 0.000 0.000 0.004 0.964 NA 0.000
#> SRR2082530 4 0.7383 -0.3942 0.000 0.264 0.000 0.328 NA 0.296
#> SRR2082531 4 0.7383 -0.3942 0.000 0.264 0.000 0.328 NA 0.296
#> SRR2082528 4 0.0935 0.6626 0.000 0.000 0.004 0.964 NA 0.000
#> SRR2082529 4 0.0935 0.6626 0.000 0.000 0.004 0.964 NA 0.000
#> SRR2082526 6 0.5925 1.0000 0.000 0.372 0.000 0.212 NA 0.416
#> SRR2082527 6 0.5925 1.0000 0.000 0.372 0.000 0.212 NA 0.416
#> SRR2082521 2 0.6819 0.2760 0.000 0.516 0.004 0.228 NA 0.136
#> SRR2082520 2 0.2703 0.5974 0.000 0.824 0.000 0.172 NA 0.000
#> SRR2082518 2 0.5400 -0.0697 0.000 0.572 0.000 0.164 NA 0.264
#> SRR2082523 4 0.6298 0.3693 0.000 0.096 0.016 0.564 NA 0.268
#> SRR2082524 4 0.6298 0.3693 0.000 0.096 0.016 0.564 NA 0.268
#> SRR2082525 6 0.5925 1.0000 0.000 0.372 0.000 0.212 NA 0.416
#> SRR2082522 4 0.4550 0.1589 0.000 0.372 0.004 0.596 NA 0.008
#> SRR2082519 2 0.2527 0.6015 0.000 0.832 0.000 0.168 NA 0.000
#> SRR2082513 2 0.6082 0.4202 0.000 0.620 0.004 0.164 NA 0.116
#> SRR2082512 2 0.5400 -0.0697 0.000 0.572 0.000 0.164 NA 0.264
#> SRR2082516 4 0.3339 0.6428 0.000 0.032 0.024 0.856 NA 0.024
#> SRR2082515 2 0.2527 0.6015 0.000 0.832 0.000 0.168 NA 0.000
#> SRR2082517 2 0.3210 0.5810 0.000 0.804 0.000 0.168 NA 0.028
#> SRR2082514 2 0.6458 0.2805 0.000 0.520 0.028 0.324 NA 0.064
#> SRR2082508 1 0.3878 0.6421 0.668 0.004 0.000 0.000 NA 0.008
#> SRR2082509 1 0.1750 0.6901 0.932 0.000 0.016 0.000 NA 0.040
#> SRR2082507 1 0.3878 0.6421 0.668 0.004 0.000 0.000 NA 0.008
#> SRR2082510 3 0.6763 0.6154 0.040 0.044 0.508 0.000 NA 0.108
#> SRR2082511 3 0.5406 0.6603 0.040 0.024 0.676 0.000 NA 0.056
#> SRR2082501 1 0.4993 0.6100 0.740 0.064 0.108 0.000 NA 0.016
#> SRR2082502 1 0.4993 0.6100 0.740 0.064 0.108 0.000 NA 0.016
#> SRR2082499 1 0.5529 0.5648 0.688 0.064 0.156 0.000 NA 0.020
#> SRR2082500 1 0.5529 0.5648 0.688 0.064 0.156 0.000 NA 0.020
#> SRR2082503 1 0.7272 0.2089 0.440 0.016 0.236 0.000 NA 0.076
#> SRR2082505 1 0.4130 0.6351 0.664 0.008 0.000 0.000 NA 0.016
#> SRR2082506 1 0.3878 0.6421 0.668 0.004 0.000 0.000 NA 0.008
#> SRR2082504 1 0.4130 0.6351 0.664 0.008 0.000 0.000 NA 0.016
#> SRR2082495 3 0.2086 0.6730 0.064 0.004 0.912 0.000 NA 0.012
#> SRR2082496 3 0.2086 0.6730 0.064 0.004 0.912 0.000 NA 0.012
#> SRR2082493 3 0.1500 0.6822 0.052 0.000 0.936 0.000 NA 0.000
#> SRR2082494 3 0.1500 0.6822 0.052 0.000 0.936 0.000 NA 0.000
#> SRR2082491 3 0.5413 0.0906 0.408 0.020 0.520 0.000 NA 0.036
#> SRR2082492 3 0.5413 0.0906 0.408 0.020 0.520 0.000 NA 0.036
#> SRR2082489 1 0.5747 0.5437 0.616 0.012 0.040 0.000 NA 0.252
#> SRR2082490 1 0.5747 0.5437 0.616 0.012 0.040 0.000 NA 0.252
#> SRR2082497 1 0.4414 0.6583 0.780 0.064 0.036 0.000 NA 0.016
#> SRR2082498 1 0.4414 0.6583 0.780 0.064 0.036 0.000 NA 0.016
#> SRR2082487 1 0.5861 0.4456 0.544 0.000 0.084 0.000 NA 0.324
#> SRR2082488 1 0.5861 0.4456 0.544 0.000 0.084 0.000 NA 0.324
#> SRR2082485 3 0.6320 0.5288 0.124 0.000 0.512 0.000 NA 0.304
#> SRR2082486 3 0.6320 0.5288 0.124 0.000 0.512 0.000 NA 0.304
#> SRR2082479 1 0.3063 0.6830 0.860 0.024 0.000 0.000 NA 0.052
#> SRR2082480 1 0.3063 0.6830 0.860 0.024 0.000 0.000 NA 0.052
#> SRR2082483 3 0.6689 0.6156 0.040 0.028 0.504 0.000 NA 0.128
#> SRR2082484 3 0.6689 0.6156 0.040 0.028 0.504 0.000 NA 0.128
#> SRR2082481 1 0.3817 0.6777 0.800 0.024 0.000 0.000 NA 0.056
#> SRR2082482 1 0.3817 0.6777 0.800 0.024 0.000 0.000 NA 0.056
Heatmaps for the consensus matrix. It visualizes the probability of two samples to be in a same group.
consensus_heatmap(res, k = 2)
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 14581 rows and 58 columns.
#> Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'SD' method.
#> Subgroups are detected by 'skmeans' method.
#> Performed in total 1250 partitions by row resampling.
#> Best k for subgroups seems to be 2.
#>
#> Following methods can be applied to this 'ConsensusPartition' object:
#> [1] "cola_report" "collect_classes" "collect_plots"
#> [4] "collect_stats" "colnames" "compare_signatures"
#> [7] "consensus_heatmap" "dimension_reduction" "functional_enrichment"
#> [10] "get_anno_col" "get_anno" "get_classes"
#> [13] "get_consensus" "get_matrix" "get_membership"
#> [16] "get_param" "get_signatures" "get_stats"
#> [19] "is_best_k" "is_stable_k" "membership_heatmap"
#> [22] "ncol" "nrow" "plot_ecdf"
#> [25] "rownames" "select_partition_number" "show"
#> [28] "suggest_best_k" "test_to_known_factors"
collect_plots()
function collects all the plots made from res
for all k
(number of partitions)
into one single page to provide an easy and fast comparison between different k
.
collect_plots(res)
The plots are:
k
and the heatmap of
predicted classes for each k
.k
.k
.k
.All the plots in panels can be made by individual functions and they are plotted later in this section.
select_partition_number()
produces several plots showing different
statistics for choosing “optimized” k
. There are following statistics:
k
;k
, the area increased is defined as \(A_k - A_{k-1}\).The detailed explanations of these statistics can be found in the cola vignette.
Generally speaking, lower PAC score, higher mean silhouette score or higher
concordance corresponds to better partition. Rand index and Jaccard index
measure how similar the current partition is compared to partition with k-1
.
If they are too similar, we won't accept k
is better than k-1
.
select_partition_number(res)
The numeric values for all these statistics can be obtained by get_stats()
.
get_stats(res)
#> k 1-PAC mean_silhouette concordance area_increased Rand Jaccard
#> 2 2 1.000 1.000 1.000 0.4996 0.501 0.501
#> 3 3 0.866 0.933 0.947 0.2276 0.861 0.722
#> 4 4 0.734 0.536 0.826 0.1280 0.972 0.923
#> 5 5 0.667 0.723 0.836 0.0812 0.871 0.634
#> 6 6 0.677 0.633 0.756 0.0482 1.000 1.000
suggest_best_k()
suggests the best \(k\) based on these statistics. The rules are as follows:
suggest_best_k(res)
#> [1] 2
Following shows the table of the partitions (You need to click the show/hide
code output link to see it). The membership matrix (columns with name p*
)
is inferred by
clue::cl_consensus()
function with the SE
method. Basically the value in the membership matrix
represents the probability to belong to a certain group. The finall class
label for an item is determined with the group with highest probability it
belongs to.
In get_classes()
function, the entropy is calculated from the membership
matrix and the silhouette score is calculated from the consensus matrix.
cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#> class entropy silhouette p1 p2
#> SRR2082532 2 0 1 0 1
#> SRR2082533 2 0 1 0 1
#> SRR2082534 2 0 1 0 1
#> SRR2082535 2 0 1 0 1
#> SRR2082536 2 0 1 0 1
#> SRR2082530 2 0 1 0 1
#> SRR2082531 2 0 1 0 1
#> SRR2082528 2 0 1 0 1
#> SRR2082529 2 0 1 0 1
#> SRR2082526 2 0 1 0 1
#> SRR2082527 2 0 1 0 1
#> SRR2082521 2 0 1 0 1
#> SRR2082520 2 0 1 0 1
#> SRR2082518 2 0 1 0 1
#> SRR2082523 2 0 1 0 1
#> SRR2082524 2 0 1 0 1
#> SRR2082525 2 0 1 0 1
#> SRR2082522 2 0 1 0 1
#> SRR2082519 2 0 1 0 1
#> SRR2082513 2 0 1 0 1
#> SRR2082512 2 0 1 0 1
#> SRR2082516 2 0 1 0 1
#> SRR2082515 2 0 1 0 1
#> SRR2082517 2 0 1 0 1
#> SRR2082514 2 0 1 0 1
#> SRR2082508 1 0 1 1 0
#> SRR2082509 1 0 1 1 0
#> SRR2082507 1 0 1 1 0
#> SRR2082510 1 0 1 1 0
#> SRR2082511 1 0 1 1 0
#> SRR2082501 1 0 1 1 0
#> SRR2082502 1 0 1 1 0
#> SRR2082499 1 0 1 1 0
#> SRR2082500 1 0 1 1 0
#> SRR2082503 1 0 1 1 0
#> SRR2082505 1 0 1 1 0
#> SRR2082506 1 0 1 1 0
#> SRR2082504 1 0 1 1 0
#> SRR2082495 1 0 1 1 0
#> SRR2082496 1 0 1 1 0
#> SRR2082493 1 0 1 1 0
#> SRR2082494 1 0 1 1 0
#> SRR2082491 1 0 1 1 0
#> SRR2082492 1 0 1 1 0
#> SRR2082489 1 0 1 1 0
#> SRR2082490 1 0 1 1 0
#> SRR2082497 1 0 1 1 0
#> SRR2082498 1 0 1 1 0
#> SRR2082487 1 0 1 1 0
#> SRR2082488 1 0 1 1 0
#> SRR2082485 1 0 1 1 0
#> SRR2082486 1 0 1 1 0
#> SRR2082479 1 0 1 1 0
#> SRR2082480 1 0 1 1 0
#> SRR2082483 1 0 1 1 0
#> SRR2082484 1 0 1 1 0
#> SRR2082481 1 0 1 1 0
#> SRR2082482 1 0 1 1 0
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> SRR2082532 2 0.000 1.000 0.000 1 0.000
#> SRR2082533 2 0.000 1.000 0.000 1 0.000
#> SRR2082534 2 0.000 1.000 0.000 1 0.000
#> SRR2082535 2 0.000 1.000 0.000 1 0.000
#> SRR2082536 2 0.000 1.000 0.000 1 0.000
#> SRR2082530 2 0.000 1.000 0.000 1 0.000
#> SRR2082531 2 0.000 1.000 0.000 1 0.000
#> SRR2082528 2 0.000 1.000 0.000 1 0.000
#> SRR2082529 2 0.000 1.000 0.000 1 0.000
#> SRR2082526 2 0.000 1.000 0.000 1 0.000
#> SRR2082527 2 0.000 1.000 0.000 1 0.000
#> SRR2082521 2 0.000 1.000 0.000 1 0.000
#> SRR2082520 2 0.000 1.000 0.000 1 0.000
#> SRR2082518 2 0.000 1.000 0.000 1 0.000
#> SRR2082523 2 0.000 1.000 0.000 1 0.000
#> SRR2082524 2 0.000 1.000 0.000 1 0.000
#> SRR2082525 2 0.000 1.000 0.000 1 0.000
#> SRR2082522 2 0.000 1.000 0.000 1 0.000
#> SRR2082519 2 0.000 1.000 0.000 1 0.000
#> SRR2082513 2 0.000 1.000 0.000 1 0.000
#> SRR2082512 2 0.000 1.000 0.000 1 0.000
#> SRR2082516 2 0.000 1.000 0.000 1 0.000
#> SRR2082515 2 0.000 1.000 0.000 1 0.000
#> SRR2082517 2 0.000 1.000 0.000 1 0.000
#> SRR2082514 2 0.000 1.000 0.000 1 0.000
#> SRR2082508 1 0.000 0.963 1.000 0 0.000
#> SRR2082509 1 0.236 0.914 0.928 0 0.072
#> SRR2082507 1 0.000 0.963 1.000 0 0.000
#> SRR2082510 3 0.000 0.680 0.000 0 1.000
#> SRR2082511 3 0.460 0.758 0.204 0 0.796
#> SRR2082501 1 0.000 0.963 1.000 0 0.000
#> SRR2082502 1 0.000 0.963 1.000 0 0.000
#> SRR2082499 1 0.000 0.963 1.000 0 0.000
#> SRR2082500 1 0.000 0.963 1.000 0 0.000
#> SRR2082503 1 0.000 0.963 1.000 0 0.000
#> SRR2082505 1 0.000 0.963 1.000 0 0.000
#> SRR2082506 1 0.000 0.963 1.000 0 0.000
#> SRR2082504 1 0.000 0.963 1.000 0 0.000
#> SRR2082495 3 0.588 0.775 0.348 0 0.652
#> SRR2082496 3 0.588 0.775 0.348 0 0.652
#> SRR2082493 3 0.588 0.775 0.348 0 0.652
#> SRR2082494 3 0.588 0.775 0.348 0 0.652
#> SRR2082491 1 0.319 0.869 0.888 0 0.112
#> SRR2082492 1 0.319 0.869 0.888 0 0.112
#> SRR2082489 1 0.236 0.914 0.928 0 0.072
#> SRR2082490 1 0.236 0.914 0.928 0 0.072
#> SRR2082497 1 0.000 0.963 1.000 0 0.000
#> SRR2082498 1 0.000 0.963 1.000 0 0.000
#> SRR2082487 1 0.236 0.914 0.928 0 0.072
#> SRR2082488 1 0.236 0.914 0.928 0 0.072
#> SRR2082485 3 0.597 0.758 0.364 0 0.636
#> SRR2082486 3 0.597 0.758 0.364 0 0.636
#> SRR2082479 1 0.000 0.963 1.000 0 0.000
#> SRR2082480 1 0.000 0.963 1.000 0 0.000
#> SRR2082483 3 0.254 0.677 0.080 0 0.920
#> SRR2082484 3 0.254 0.677 0.080 0 0.920
#> SRR2082481 1 0.000 0.963 1.000 0 0.000
#> SRR2082482 1 0.000 0.963 1.000 0 0.000
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> SRR2082532 2 0.0000 0.631 0.000 1.000 0.000 0.000
#> SRR2082533 2 0.0000 0.631 0.000 1.000 0.000 0.000
#> SRR2082534 2 0.0000 0.631 0.000 1.000 0.000 0.000
#> SRR2082535 2 0.0000 0.631 0.000 1.000 0.000 0.000
#> SRR2082536 2 0.0000 0.631 0.000 1.000 0.000 0.000
#> SRR2082530 2 0.2216 0.546 0.000 0.908 0.000 0.092
#> SRR2082531 2 0.2216 0.546 0.000 0.908 0.000 0.092
#> SRR2082528 2 0.0000 0.631 0.000 1.000 0.000 0.000
#> SRR2082529 2 0.0000 0.631 0.000 1.000 0.000 0.000
#> SRR2082526 2 0.4996 -0.920 0.000 0.516 0.000 0.484
#> SRR2082527 2 0.4996 -0.920 0.000 0.516 0.000 0.484
#> SRR2082521 2 0.2647 0.521 0.000 0.880 0.000 0.120
#> SRR2082520 2 0.4907 -0.665 0.000 0.580 0.000 0.420
#> SRR2082518 4 0.4999 1.000 0.000 0.492 0.000 0.508
#> SRR2082523 2 0.0000 0.631 0.000 1.000 0.000 0.000
#> SRR2082524 2 0.0000 0.631 0.000 1.000 0.000 0.000
#> SRR2082525 2 0.4996 -0.920 0.000 0.516 0.000 0.484
#> SRR2082522 2 0.1557 0.597 0.000 0.944 0.000 0.056
#> SRR2082519 2 0.4907 -0.665 0.000 0.580 0.000 0.420
#> SRR2082513 2 0.4790 -0.524 0.000 0.620 0.000 0.380
#> SRR2082512 4 0.4999 1.000 0.000 0.492 0.000 0.508
#> SRR2082516 2 0.0817 0.618 0.000 0.976 0.000 0.024
#> SRR2082515 2 0.4907 -0.665 0.000 0.580 0.000 0.420
#> SRR2082517 2 0.4916 -0.682 0.000 0.576 0.000 0.424
#> SRR2082514 2 0.1022 0.614 0.000 0.968 0.000 0.032
#> SRR2082508 1 0.0000 0.885 1.000 0.000 0.000 0.000
#> SRR2082509 1 0.2469 0.851 0.892 0.000 0.108 0.000
#> SRR2082507 1 0.0000 0.885 1.000 0.000 0.000 0.000
#> SRR2082510 3 0.4964 0.660 0.004 0.000 0.616 0.380
#> SRR2082511 3 0.3229 0.779 0.048 0.000 0.880 0.072
#> SRR2082501 1 0.1557 0.878 0.944 0.000 0.056 0.000
#> SRR2082502 1 0.1557 0.878 0.944 0.000 0.056 0.000
#> SRR2082499 1 0.2081 0.869 0.916 0.000 0.084 0.000
#> SRR2082500 1 0.2081 0.869 0.916 0.000 0.084 0.000
#> SRR2082503 1 0.1022 0.880 0.968 0.000 0.032 0.000
#> SRR2082505 1 0.0188 0.885 0.996 0.000 0.004 0.000
#> SRR2082506 1 0.0000 0.885 1.000 0.000 0.000 0.000
#> SRR2082504 1 0.0188 0.885 0.996 0.000 0.004 0.000
#> SRR2082495 3 0.2216 0.790 0.092 0.000 0.908 0.000
#> SRR2082496 3 0.2216 0.790 0.092 0.000 0.908 0.000
#> SRR2082493 3 0.2216 0.790 0.092 0.000 0.908 0.000
#> SRR2082494 3 0.2216 0.790 0.092 0.000 0.908 0.000
#> SRR2082491 1 0.4925 0.441 0.572 0.000 0.428 0.000
#> SRR2082492 1 0.4925 0.441 0.572 0.000 0.428 0.000
#> SRR2082489 1 0.3831 0.767 0.792 0.000 0.204 0.004
#> SRR2082490 1 0.3831 0.767 0.792 0.000 0.204 0.004
#> SRR2082497 1 0.0592 0.884 0.984 0.000 0.016 0.000
#> SRR2082498 1 0.0592 0.884 0.984 0.000 0.016 0.000
#> SRR2082487 1 0.4401 0.696 0.724 0.000 0.272 0.004
#> SRR2082488 1 0.4401 0.696 0.724 0.000 0.272 0.004
#> SRR2082485 3 0.4053 0.669 0.228 0.000 0.768 0.004
#> SRR2082486 3 0.4053 0.669 0.228 0.000 0.768 0.004
#> SRR2082479 1 0.0188 0.885 0.996 0.000 0.004 0.000
#> SRR2082480 1 0.0188 0.885 0.996 0.000 0.004 0.000
#> SRR2082483 3 0.5295 0.623 0.008 0.000 0.504 0.488
#> SRR2082484 3 0.5295 0.623 0.008 0.000 0.504 0.488
#> SRR2082481 1 0.0188 0.885 0.996 0.000 0.004 0.000
#> SRR2082482 1 0.0188 0.885 0.996 0.000 0.004 0.000
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> SRR2082532 4 0.2891 0.8603 0.000 0.176 0.000 0.824 0.000
#> SRR2082533 4 0.2891 0.8603 0.000 0.176 0.000 0.824 0.000
#> SRR2082534 4 0.2852 0.8620 0.000 0.172 0.000 0.828 0.000
#> SRR2082535 4 0.2852 0.8620 0.000 0.172 0.000 0.828 0.000
#> SRR2082536 4 0.2852 0.8620 0.000 0.172 0.000 0.828 0.000
#> SRR2082530 4 0.4268 0.6650 0.000 0.344 0.000 0.648 0.008
#> SRR2082531 4 0.4268 0.6650 0.000 0.344 0.000 0.648 0.008
#> SRR2082528 4 0.2852 0.8620 0.000 0.172 0.000 0.828 0.000
#> SRR2082529 4 0.2852 0.8620 0.000 0.172 0.000 0.828 0.000
#> SRR2082526 2 0.4059 0.7377 0.000 0.808 0.012 0.112 0.068
#> SRR2082527 2 0.4059 0.7377 0.000 0.808 0.012 0.112 0.068
#> SRR2082521 4 0.4451 0.4491 0.000 0.492 0.000 0.504 0.004
#> SRR2082520 2 0.2690 0.7265 0.000 0.844 0.000 0.156 0.000
#> SRR2082518 2 0.2037 0.7691 0.000 0.920 0.012 0.004 0.064
#> SRR2082523 4 0.3132 0.8592 0.000 0.172 0.000 0.820 0.008
#> SRR2082524 4 0.3132 0.8592 0.000 0.172 0.000 0.820 0.008
#> SRR2082525 2 0.4059 0.7377 0.000 0.808 0.012 0.112 0.068
#> SRR2082522 4 0.4283 0.4926 0.000 0.456 0.000 0.544 0.000
#> SRR2082519 2 0.2471 0.7487 0.000 0.864 0.000 0.136 0.000
#> SRR2082513 2 0.3689 0.4884 0.000 0.740 0.000 0.256 0.004
#> SRR2082512 2 0.2037 0.7691 0.000 0.920 0.012 0.004 0.064
#> SRR2082516 4 0.3816 0.7530 0.000 0.304 0.000 0.696 0.000
#> SRR2082515 2 0.2471 0.7487 0.000 0.864 0.000 0.136 0.000
#> SRR2082517 2 0.2179 0.7607 0.000 0.888 0.000 0.112 0.000
#> SRR2082514 4 0.4088 0.6811 0.000 0.368 0.000 0.632 0.000
#> SRR2082508 1 0.0703 0.8217 0.976 0.000 0.000 0.024 0.000
#> SRR2082509 1 0.2511 0.7858 0.892 0.000 0.088 0.016 0.004
#> SRR2082507 1 0.0703 0.8217 0.976 0.000 0.000 0.024 0.000
#> SRR2082510 5 0.4933 0.7867 0.000 0.000 0.228 0.080 0.692
#> SRR2082511 3 0.4476 0.5053 0.016 0.000 0.764 0.048 0.172
#> SRR2082501 1 0.3262 0.7749 0.840 0.000 0.124 0.036 0.000
#> SRR2082502 1 0.3262 0.7749 0.840 0.000 0.124 0.036 0.000
#> SRR2082499 1 0.4455 0.6256 0.704 0.000 0.260 0.036 0.000
#> SRR2082500 1 0.4455 0.6256 0.704 0.000 0.260 0.036 0.000
#> SRR2082503 1 0.3652 0.6891 0.784 0.000 0.200 0.012 0.004
#> SRR2082505 1 0.0566 0.8224 0.984 0.000 0.000 0.012 0.004
#> SRR2082506 1 0.0703 0.8217 0.976 0.000 0.000 0.024 0.000
#> SRR2082504 1 0.0566 0.8224 0.984 0.000 0.000 0.012 0.004
#> SRR2082495 3 0.0404 0.7448 0.012 0.000 0.988 0.000 0.000
#> SRR2082496 3 0.0404 0.7448 0.012 0.000 0.988 0.000 0.000
#> SRR2082493 3 0.0566 0.7431 0.012 0.000 0.984 0.000 0.004
#> SRR2082494 3 0.0566 0.7431 0.012 0.000 0.984 0.000 0.004
#> SRR2082491 3 0.3884 0.5459 0.288 0.000 0.708 0.000 0.004
#> SRR2082492 3 0.3884 0.5459 0.288 0.000 0.708 0.000 0.004
#> SRR2082489 1 0.4615 0.6044 0.724 0.000 0.220 0.052 0.004
#> SRR2082490 1 0.4615 0.6044 0.724 0.000 0.220 0.052 0.004
#> SRR2082497 1 0.1364 0.8165 0.952 0.000 0.012 0.036 0.000
#> SRR2082498 1 0.1364 0.8165 0.952 0.000 0.012 0.036 0.000
#> SRR2082487 1 0.5601 0.0627 0.488 0.000 0.452 0.052 0.008
#> SRR2082488 1 0.5601 0.0627 0.488 0.000 0.452 0.052 0.008
#> SRR2082485 3 0.4288 0.7030 0.180 0.000 0.764 0.052 0.004
#> SRR2082486 3 0.4288 0.7030 0.180 0.000 0.764 0.052 0.004
#> SRR2082479 1 0.0451 0.8247 0.988 0.000 0.004 0.000 0.008
#> SRR2082480 1 0.0451 0.8247 0.988 0.000 0.004 0.000 0.008
#> SRR2082483 5 0.1831 0.9051 0.004 0.000 0.076 0.000 0.920
#> SRR2082484 5 0.1831 0.9051 0.004 0.000 0.076 0.000 0.920
#> SRR2082481 1 0.0290 0.8242 0.992 0.000 0.000 0.000 0.008
#> SRR2082482 1 0.0290 0.8242 0.992 0.000 0.000 0.000 0.008
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> SRR2082532 4 0.0146 0.7904 0.000 0.000 0.000 0.996 NA 0.000
#> SRR2082533 4 0.0146 0.7904 0.000 0.000 0.000 0.996 NA 0.000
#> SRR2082534 4 0.0000 0.7905 0.000 0.000 0.000 1.000 NA 0.000
#> SRR2082535 4 0.0000 0.7905 0.000 0.000 0.000 1.000 NA 0.000
#> SRR2082536 4 0.0000 0.7905 0.000 0.000 0.000 1.000 NA 0.000
#> SRR2082530 4 0.4923 0.5160 0.000 0.116 0.000 0.688 NA 0.016
#> SRR2082531 4 0.4923 0.5160 0.000 0.116 0.000 0.688 NA 0.016
#> SRR2082528 4 0.0000 0.7905 0.000 0.000 0.000 1.000 NA 0.000
#> SRR2082529 4 0.0000 0.7905 0.000 0.000 0.000 1.000 NA 0.000
#> SRR2082526 2 0.3488 0.5842 0.000 0.764 0.000 0.216 NA 0.004
#> SRR2082527 2 0.3488 0.5842 0.000 0.764 0.000 0.216 NA 0.004
#> SRR2082521 4 0.6206 0.0541 0.000 0.244 0.000 0.460 NA 0.012
#> SRR2082520 2 0.5911 0.5609 0.000 0.468 0.000 0.252 NA 0.000
#> SRR2082518 2 0.1765 0.6190 0.000 0.904 0.000 0.096 NA 0.000
#> SRR2082523 4 0.1219 0.7747 0.000 0.000 0.000 0.948 NA 0.004
#> SRR2082524 4 0.1219 0.7747 0.000 0.000 0.000 0.948 NA 0.004
#> SRR2082525 2 0.3488 0.5842 0.000 0.764 0.000 0.216 NA 0.004
#> SRR2082522 4 0.5397 0.2779 0.000 0.200 0.000 0.584 NA 0.000
#> SRR2082519 2 0.5897 0.5656 0.000 0.472 0.000 0.248 NA 0.000
#> SRR2082513 2 0.6330 0.3552 0.000 0.352 0.000 0.300 NA 0.008
#> SRR2082512 2 0.2020 0.6202 0.000 0.896 0.000 0.096 NA 0.000
#> SRR2082516 4 0.3501 0.6254 0.000 0.116 0.000 0.804 NA 0.000
#> SRR2082515 2 0.5882 0.5691 0.000 0.476 0.000 0.244 NA 0.000
#> SRR2082517 2 0.5725 0.5907 0.000 0.512 0.000 0.208 NA 0.000
#> SRR2082514 4 0.5080 0.3874 0.000 0.140 0.000 0.624 NA 0.000
#> SRR2082508 1 0.1732 0.7623 0.920 0.004 0.000 0.000 NA 0.004
#> SRR2082509 1 0.3214 0.7453 0.836 0.004 0.080 0.000 NA 0.000
#> SRR2082507 1 0.1732 0.7623 0.920 0.004 0.000 0.000 NA 0.004
#> SRR2082510 6 0.6044 0.7096 0.000 0.076 0.116 0.000 NA 0.596
#> SRR2082511 3 0.5557 0.4555 0.000 0.056 0.656 0.000 NA 0.152
#> SRR2082501 1 0.4396 0.7128 0.748 0.016 0.116 0.000 NA 0.000
#> SRR2082502 1 0.4396 0.7128 0.748 0.016 0.116 0.000 NA 0.000
#> SRR2082499 1 0.5076 0.6366 0.668 0.016 0.196 0.000 NA 0.000
#> SRR2082500 1 0.5076 0.6366 0.668 0.016 0.196 0.000 NA 0.000
#> SRR2082503 1 0.4692 0.6797 0.724 0.008 0.140 0.000 NA 0.008
#> SRR2082505 1 0.1845 0.7596 0.916 0.004 0.000 0.000 NA 0.008
#> SRR2082506 1 0.1732 0.7623 0.920 0.004 0.000 0.000 NA 0.004
#> SRR2082504 1 0.1845 0.7596 0.916 0.004 0.000 0.000 NA 0.008
#> SRR2082495 3 0.0000 0.7316 0.000 0.000 1.000 0.000 NA 0.000
#> SRR2082496 3 0.0000 0.7316 0.000 0.000 1.000 0.000 NA 0.000
#> SRR2082493 3 0.0777 0.7174 0.000 0.000 0.972 0.000 NA 0.024
#> SRR2082494 3 0.0777 0.7174 0.000 0.000 0.972 0.000 NA 0.024
#> SRR2082491 3 0.3792 0.6261 0.188 0.004 0.764 0.000 NA 0.000
#> SRR2082492 3 0.3792 0.6261 0.188 0.004 0.764 0.000 NA 0.000
#> SRR2082489 1 0.5288 0.4776 0.596 0.000 0.164 0.000 NA 0.000
#> SRR2082490 1 0.5288 0.4776 0.596 0.000 0.164 0.000 NA 0.000
#> SRR2082497 1 0.2780 0.7583 0.868 0.016 0.024 0.000 NA 0.000
#> SRR2082498 1 0.2780 0.7583 0.868 0.016 0.024 0.000 NA 0.000
#> SRR2082487 1 0.6116 -0.0481 0.364 0.000 0.332 0.000 NA 0.000
#> SRR2082488 1 0.6116 -0.0481 0.364 0.000 0.332 0.000 NA 0.000
#> SRR2082485 3 0.5010 0.5868 0.104 0.000 0.632 0.000 NA 0.004
#> SRR2082486 3 0.5010 0.5868 0.104 0.000 0.632 0.000 NA 0.004
#> SRR2082479 1 0.1321 0.7751 0.952 0.000 0.020 0.000 NA 0.004
#> SRR2082480 1 0.1321 0.7751 0.952 0.000 0.020 0.000 NA 0.004
#> SRR2082483 6 0.0547 0.8700 0.000 0.000 0.020 0.000 NA 0.980
#> SRR2082484 6 0.0547 0.8700 0.000 0.000 0.020 0.000 NA 0.980
#> SRR2082481 1 0.0858 0.7715 0.968 0.000 0.000 0.000 NA 0.004
#> SRR2082482 1 0.0858 0.7715 0.968 0.000 0.000 0.000 NA 0.004
Heatmaps for the consensus matrix. It visualizes the probability of two samples to be in a same group.
consensus_heatmap(res, k = 2)
consensus_heatmap(res, k = 3)
consensus_heatmap(res, k = 4)
consensus_heatmap(res, k = 5)
consensus_heatmap(res, k = 6)
Heatmaps for the membership of samples in all partitions to see how consistent they are:
membership_heatmap(res, k = 2)
membership_heatmap(res, k = 3)
membership_heatmap(res, k = 4)
membership_heatmap(res, k = 5)
membership_heatmap(res, k = 6)
As soon as we have had the classes for columns, we can look for signatures which are significantly different between classes which can be candidate marks for certain classes. Following are the heatmaps for signatures.
Signature heatmaps where rows are scaled:
get_signatures(res, k = 2)
get_signatures(res, k = 3)
get_signatures(res, k = 4)
get_signatures(res, k = 5)
get_signatures(res, k = 6)
Signature heatmaps where rows are not scaled:
get_signatures(res, k = 2, scale_rows = FALSE)
get_signatures(res, k = 3, scale_rows = FALSE)
get_signatures(res, k = 4, scale_rows = FALSE)
get_signatures(res, k = 5, scale_rows = FALSE)
get_signatures(res, k = 6, scale_rows = FALSE)
Compare the overlap of signatures from different k:
compare_signatures(res)
get_signature()
returns a data frame invisibly. TO get the list of signatures, the function
call should be assigned to a variable explicitly. In following code, if plot
argument is set
to FALSE
, no heatmap is plotted while only the differential analysis is performed.
# code only for demonstration
tb = get_signature(res, k = ..., plot = FALSE)
An example of the output of tb
is:
#> which_row fdr mean_1 mean_2 scaled_mean_1 scaled_mean_2 km
#> 1 38 0.042760348 8.373488 9.131774 -0.5533452 0.5164555 1
#> 2 40 0.018707592 7.106213 8.469186 -0.6173731 0.5762149 1
#> 3 55 0.019134737 10.221463 11.207825 -0.6159697 0.5749050 1
#> 4 59 0.006059896 5.921854 7.869574 -0.6899429 0.6439467 1
#> 5 60 0.018055526 8.928898 10.211722 -0.6204761 0.5791110 1
#> 6 98 0.009384629 15.714769 14.887706 0.6635654 -0.6193277 2
...
The columns in tb
are:
which_row
: row indices corresponding to the input matrix.fdr
: FDR for the differential test. mean_x
: The mean value in group x.scaled_mean_x
: The mean value in group x after rows are scaled.km
: Row groups if k-means clustering is applied to rows.UMAP plot which shows how samples are separated.
dimension_reduction(res, k = 2, method = "UMAP")
dimension_reduction(res, k = 3, method = "UMAP")
dimension_reduction(res, k = 4, method = "UMAP")
dimension_reduction(res, k = 5, method = "UMAP")
dimension_reduction(res, k = 6, method = "UMAP")
Following heatmap shows how subgroups are split when increasing k
:
collect_classes(res)
If matrix rows can be associated to genes, consider to use functional_enrichment(res,
...)
to perform function enrichment for the signature genes. See this vignette for more detailed explanations.
The object with results only for a single top-value method and a single partition method can be extracted as:
res = res_list["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 14581 rows and 58 columns.
#> Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'SD' method.
#> Subgroups are detected by 'pam' method.
#> Performed in total 1250 partitions by row resampling.
#> Best k for subgroups seems to be 2.
#>
#> Following methods can be applied to this 'ConsensusPartition' object:
#> [1] "cola_report" "collect_classes" "collect_plots"
#> [4] "collect_stats" "colnames" "compare_signatures"
#> [7] "consensus_heatmap" "dimension_reduction" "functional_enrichment"
#> [10] "get_anno_col" "get_anno" "get_classes"
#> [13] "get_consensus" "get_matrix" "get_membership"
#> [16] "get_param" "get_signatures" "get_stats"
#> [19] "is_best_k" "is_stable_k" "membership_heatmap"
#> [22] "ncol" "nrow" "plot_ecdf"
#> [25] "rownames" "select_partition_number" "show"
#> [28] "suggest_best_k" "test_to_known_factors"
collect_plots()
function collects all the plots made from res
for all k
(number of partitions)
into one single page to provide an easy and fast comparison between different k
.
collect_plots(res)
The plots are:
k
and the heatmap of
predicted classes for each k
.k
.k
.k
.All the plots in panels can be made by individual functions and they are plotted later in this section.
select_partition_number()
produces several plots showing different
statistics for choosing “optimized” k
. There are following statistics:
k
;k
, the area increased is defined as \(A_k - A_{k-1}\).The detailed explanations of these statistics can be found in the cola vignette.
Generally speaking, lower PAC score, higher mean silhouette score or higher
concordance corresponds to better partition. Rand index and Jaccard index
measure how similar the current partition is compared to partition with k-1
.
If they are too similar, we won't accept k
is better than k-1
.
select_partition_number(res)
The numeric values for all these statistics can be obtained by get_stats()
.
get_stats(res)
#> k 1-PAC mean_silhouette concordance area_increased Rand Jaccard
#> 2 2 1.000 1.000 1.000 0.4996 0.501 0.501
#> 3 3 0.727 0.897 0.895 0.2118 0.909 0.819
#> 4 4 0.892 0.900 0.939 0.2136 0.848 0.628
#> 5 5 0.803 0.832 0.895 0.0574 0.967 0.873
#> 6 6 0.795 0.764 0.840 0.0404 0.982 0.920
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
#> SRR2082532 2 0 1 0 1
#> SRR2082533 2 0 1 0 1
#> SRR2082534 2 0 1 0 1
#> SRR2082535 2 0 1 0 1
#> SRR2082536 2 0 1 0 1
#> SRR2082530 2 0 1 0 1
#> SRR2082531 2 0 1 0 1
#> SRR2082528 2 0 1 0 1
#> SRR2082529 2 0 1 0 1
#> SRR2082526 2 0 1 0 1
#> SRR2082527 2 0 1 0 1
#> SRR2082521 2 0 1 0 1
#> SRR2082520 2 0 1 0 1
#> SRR2082518 2 0 1 0 1
#> SRR2082523 2 0 1 0 1
#> SRR2082524 2 0 1 0 1
#> SRR2082525 2 0 1 0 1
#> SRR2082522 2 0 1 0 1
#> SRR2082519 2 0 1 0 1
#> SRR2082513 2 0 1 0 1
#> SRR2082512 2 0 1 0 1
#> SRR2082516 2 0 1 0 1
#> SRR2082515 2 0 1 0 1
#> SRR2082517 2 0 1 0 1
#> SRR2082514 2 0 1 0 1
#> SRR2082508 1 0 1 1 0
#> SRR2082509 1 0 1 1 0
#> SRR2082507 1 0 1 1 0
#> SRR2082510 1 0 1 1 0
#> SRR2082511 1 0 1 1 0
#> SRR2082501 1 0 1 1 0
#> SRR2082502 1 0 1 1 0
#> SRR2082499 1 0 1 1 0
#> SRR2082500 1 0 1 1 0
#> SRR2082503 1 0 1 1 0
#> SRR2082505 1 0 1 1 0
#> SRR2082506 1 0 1 1 0
#> SRR2082504 1 0 1 1 0
#> SRR2082495 1 0 1 1 0
#> SRR2082496 1 0 1 1 0
#> SRR2082493 1 0 1 1 0
#> SRR2082494 1 0 1 1 0
#> SRR2082491 1 0 1 1 0
#> SRR2082492 1 0 1 1 0
#> SRR2082489 1 0 1 1 0
#> SRR2082490 1 0 1 1 0
#> SRR2082497 1 0 1 1 0
#> SRR2082498 1 0 1 1 0
#> SRR2082487 1 0 1 1 0
#> SRR2082488 1 0 1 1 0
#> SRR2082485 1 0 1 1 0
#> SRR2082486 1 0 1 1 0
#> SRR2082479 1 0 1 1 0
#> SRR2082480 1 0 1 1 0
#> SRR2082483 1 0 1 1 0
#> SRR2082484 1 0 1 1 0
#> SRR2082481 1 0 1 1 0
#> SRR2082482 1 0 1 1 0
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> SRR2082532 2 0.4931 0.933 0.000 0.768 0.232
#> SRR2082533 2 0.4931 0.933 0.000 0.768 0.232
#> SRR2082534 2 0.4931 0.933 0.000 0.768 0.232
#> SRR2082535 2 0.4931 0.933 0.000 0.768 0.232
#> SRR2082536 2 0.4931 0.933 0.000 0.768 0.232
#> SRR2082530 2 0.5948 0.799 0.000 0.640 0.360
#> SRR2082531 2 0.5948 0.799 0.000 0.640 0.360
#> SRR2082528 2 0.4931 0.933 0.000 0.768 0.232
#> SRR2082529 2 0.4931 0.933 0.000 0.768 0.232
#> SRR2082526 3 0.0000 0.958 0.000 0.000 1.000
#> SRR2082527 3 0.0000 0.958 0.000 0.000 1.000
#> SRR2082521 2 0.6244 0.634 0.000 0.560 0.440
#> SRR2082520 3 0.3482 0.806 0.000 0.128 0.872
#> SRR2082518 3 0.0000 0.958 0.000 0.000 1.000
#> SRR2082523 2 0.4974 0.931 0.000 0.764 0.236
#> SRR2082524 2 0.4974 0.931 0.000 0.764 0.236
#> SRR2082525 3 0.0000 0.958 0.000 0.000 1.000
#> SRR2082522 2 0.6095 0.734 0.000 0.608 0.392
#> SRR2082519 3 0.3412 0.811 0.000 0.124 0.876
#> SRR2082513 3 0.0000 0.958 0.000 0.000 1.000
#> SRR2082512 3 0.0000 0.958 0.000 0.000 1.000
#> SRR2082516 2 0.4931 0.933 0.000 0.768 0.232
#> SRR2082515 3 0.0000 0.958 0.000 0.000 1.000
#> SRR2082517 3 0.0000 0.958 0.000 0.000 1.000
#> SRR2082514 2 0.5178 0.916 0.000 0.744 0.256
#> SRR2082508 1 0.0000 0.919 1.000 0.000 0.000
#> SRR2082509 1 0.0000 0.919 1.000 0.000 0.000
#> SRR2082507 1 0.0000 0.919 1.000 0.000 0.000
#> SRR2082510 1 0.4931 0.856 0.768 0.232 0.000
#> SRR2082511 1 0.4931 0.856 0.768 0.232 0.000
#> SRR2082501 1 0.0000 0.919 1.000 0.000 0.000
#> SRR2082502 1 0.0000 0.919 1.000 0.000 0.000
#> SRR2082499 1 0.0000 0.919 1.000 0.000 0.000
#> SRR2082500 1 0.0000 0.919 1.000 0.000 0.000
#> SRR2082503 1 0.1753 0.908 0.952 0.048 0.000
#> SRR2082505 1 0.0000 0.919 1.000 0.000 0.000
#> SRR2082506 1 0.0000 0.919 1.000 0.000 0.000
#> SRR2082504 1 0.0000 0.919 1.000 0.000 0.000
#> SRR2082495 1 0.4931 0.856 0.768 0.232 0.000
#> SRR2082496 1 0.4931 0.856 0.768 0.232 0.000
#> SRR2082493 1 0.4931 0.856 0.768 0.232 0.000
#> SRR2082494 1 0.4931 0.856 0.768 0.232 0.000
#> SRR2082491 1 0.4931 0.856 0.768 0.232 0.000
#> SRR2082492 1 0.4931 0.856 0.768 0.232 0.000
#> SRR2082489 1 0.0000 0.919 1.000 0.000 0.000
#> SRR2082490 1 0.0000 0.919 1.000 0.000 0.000
#> SRR2082497 1 0.0000 0.919 1.000 0.000 0.000
#> SRR2082498 1 0.0000 0.919 1.000 0.000 0.000
#> SRR2082487 1 0.0237 0.918 0.996 0.004 0.000
#> SRR2082488 1 0.0237 0.918 0.996 0.004 0.000
#> SRR2082485 1 0.4931 0.856 0.768 0.232 0.000
#> SRR2082486 1 0.4931 0.856 0.768 0.232 0.000
#> SRR2082479 1 0.0000 0.919 1.000 0.000 0.000
#> SRR2082480 1 0.0000 0.919 1.000 0.000 0.000
#> SRR2082483 1 0.4931 0.856 0.768 0.232 0.000
#> SRR2082484 1 0.4931 0.856 0.768 0.232 0.000
#> SRR2082481 1 0.0000 0.919 1.000 0.000 0.000
#> SRR2082482 1 0.0000 0.919 1.000 0.000 0.000
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> SRR2082532 4 0.0000 0.884 0.000 0.000 0.000 1.000
#> SRR2082533 4 0.0000 0.884 0.000 0.000 0.000 1.000
#> SRR2082534 4 0.1792 0.882 0.000 0.000 0.068 0.932
#> SRR2082535 4 0.1792 0.882 0.000 0.000 0.068 0.932
#> SRR2082536 4 0.1792 0.882 0.000 0.000 0.068 0.932
#> SRR2082530 4 0.2921 0.793 0.000 0.140 0.000 0.860
#> SRR2082531 4 0.2921 0.793 0.000 0.140 0.000 0.860
#> SRR2082528 4 0.1792 0.882 0.000 0.000 0.068 0.932
#> SRR2082529 4 0.1792 0.882 0.000 0.000 0.068 0.932
#> SRR2082526 2 0.0000 0.963 0.000 1.000 0.000 0.000
#> SRR2082527 2 0.0000 0.963 0.000 1.000 0.000 0.000
#> SRR2082521 4 0.4925 0.240 0.000 0.428 0.000 0.572
#> SRR2082520 2 0.2921 0.832 0.000 0.860 0.000 0.140
#> SRR2082518 2 0.0000 0.963 0.000 1.000 0.000 0.000
#> SRR2082523 4 0.0188 0.883 0.000 0.004 0.000 0.996
#> SRR2082524 4 0.0188 0.883 0.000 0.004 0.000 0.996
#> SRR2082525 2 0.0000 0.963 0.000 1.000 0.000 0.000
#> SRR2082522 4 0.6337 0.352 0.000 0.380 0.068 0.552
#> SRR2082519 2 0.2868 0.836 0.000 0.864 0.000 0.136
#> SRR2082513 2 0.0188 0.960 0.000 0.996 0.000 0.004
#> SRR2082512 2 0.0000 0.963 0.000 1.000 0.000 0.000
#> SRR2082516 4 0.0188 0.884 0.000 0.000 0.004 0.996
#> SRR2082515 2 0.0000 0.963 0.000 1.000 0.000 0.000
#> SRR2082517 2 0.0000 0.963 0.000 1.000 0.000 0.000
#> SRR2082514 4 0.2011 0.846 0.000 0.080 0.000 0.920
#> SRR2082508 1 0.0000 0.981 1.000 0.000 0.000 0.000
#> SRR2082509 1 0.0000 0.981 1.000 0.000 0.000 0.000
#> SRR2082507 1 0.0000 0.981 1.000 0.000 0.000 0.000
#> SRR2082510 3 0.1792 0.946 0.068 0.000 0.932 0.000
#> SRR2082511 3 0.1792 0.946 0.068 0.000 0.932 0.000
#> SRR2082501 1 0.0000 0.981 1.000 0.000 0.000 0.000
#> SRR2082502 1 0.0000 0.981 1.000 0.000 0.000 0.000
#> SRR2082499 1 0.0000 0.981 1.000 0.000 0.000 0.000
#> SRR2082500 1 0.0000 0.981 1.000 0.000 0.000 0.000
#> SRR2082503 1 0.3123 0.810 0.844 0.000 0.156 0.000
#> SRR2082505 1 0.0000 0.981 1.000 0.000 0.000 0.000
#> SRR2082506 1 0.0000 0.981 1.000 0.000 0.000 0.000
#> SRR2082504 1 0.0000 0.981 1.000 0.000 0.000 0.000
#> SRR2082495 3 0.1792 0.946 0.068 0.000 0.932 0.000
#> SRR2082496 3 0.1792 0.946 0.068 0.000 0.932 0.000
#> SRR2082493 3 0.1792 0.946 0.068 0.000 0.932 0.000
#> SRR2082494 3 0.1792 0.946 0.068 0.000 0.932 0.000
#> SRR2082491 3 0.4008 0.774 0.244 0.000 0.756 0.000
#> SRR2082492 3 0.4830 0.507 0.392 0.000 0.608 0.000
#> SRR2082489 1 0.0000 0.981 1.000 0.000 0.000 0.000
#> SRR2082490 1 0.0000 0.981 1.000 0.000 0.000 0.000
#> SRR2082497 1 0.0000 0.981 1.000 0.000 0.000 0.000
#> SRR2082498 1 0.0000 0.981 1.000 0.000 0.000 0.000
#> SRR2082487 1 0.2216 0.891 0.908 0.000 0.092 0.000
#> SRR2082488 1 0.2216 0.891 0.908 0.000 0.092 0.000
#> SRR2082485 3 0.1792 0.946 0.068 0.000 0.932 0.000
#> SRR2082486 3 0.1792 0.946 0.068 0.000 0.932 0.000
#> SRR2082479 1 0.0000 0.981 1.000 0.000 0.000 0.000
#> SRR2082480 1 0.0000 0.981 1.000 0.000 0.000 0.000
#> SRR2082483 3 0.1792 0.946 0.068 0.000 0.932 0.000
#> SRR2082484 3 0.1792 0.946 0.068 0.000 0.932 0.000
#> SRR2082481 1 0.0000 0.981 1.000 0.000 0.000 0.000
#> SRR2082482 1 0.0000 0.981 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
#> SRR2082532 5 0.2605 0.706 0.000 0.000 0.000 0.148 0.852
#> SRR2082533 5 0.2605 0.706 0.000 0.000 0.000 0.148 0.852
#> SRR2082534 4 0.2852 0.894 0.000 0.000 0.000 0.828 0.172
#> SRR2082535 4 0.2852 0.894 0.000 0.000 0.000 0.828 0.172
#> SRR2082536 4 0.2852 0.894 0.000 0.000 0.000 0.828 0.172
#> SRR2082530 5 0.2813 0.684 0.000 0.168 0.000 0.000 0.832
#> SRR2082531 5 0.2813 0.684 0.000 0.168 0.000 0.000 0.832
#> SRR2082528 4 0.2852 0.894 0.000 0.000 0.000 0.828 0.172
#> SRR2082529 4 0.2852 0.894 0.000 0.000 0.000 0.828 0.172
#> SRR2082526 2 0.0609 0.916 0.000 0.980 0.000 0.000 0.020
#> SRR2082527 2 0.0609 0.916 0.000 0.980 0.000 0.000 0.020
#> SRR2082521 5 0.4181 0.513 0.000 0.268 0.000 0.020 0.712
#> SRR2082520 2 0.2813 0.770 0.000 0.832 0.000 0.000 0.168
#> SRR2082518 2 0.0609 0.916 0.000 0.980 0.000 0.000 0.020
#> SRR2082523 5 0.0000 0.752 0.000 0.000 0.000 0.000 1.000
#> SRR2082524 5 0.0000 0.752 0.000 0.000 0.000 0.000 1.000
#> SRR2082525 2 0.0609 0.916 0.000 0.980 0.000 0.000 0.020
#> SRR2082522 4 0.3895 0.457 0.000 0.320 0.000 0.680 0.000
#> SRR2082519 2 0.2813 0.770 0.000 0.832 0.000 0.000 0.168
#> SRR2082513 2 0.3210 0.685 0.000 0.788 0.000 0.000 0.212
#> SRR2082512 2 0.0404 0.915 0.000 0.988 0.000 0.000 0.012
#> SRR2082516 5 0.3366 0.602 0.000 0.000 0.000 0.232 0.768
#> SRR2082515 2 0.0000 0.912 0.000 1.000 0.000 0.000 0.000
#> SRR2082517 2 0.0000 0.912 0.000 1.000 0.000 0.000 0.000
#> SRR2082514 5 0.3661 0.606 0.000 0.276 0.000 0.000 0.724
#> SRR2082508 1 0.0000 0.940 1.000 0.000 0.000 0.000 0.000
#> SRR2082509 1 0.1270 0.924 0.948 0.000 0.000 0.052 0.000
#> SRR2082507 1 0.0000 0.940 1.000 0.000 0.000 0.000 0.000
#> SRR2082510 3 0.1478 0.869 0.000 0.000 0.936 0.064 0.000
#> SRR2082511 3 0.0000 0.887 0.000 0.000 1.000 0.000 0.000
#> SRR2082501 1 0.0000 0.940 1.000 0.000 0.000 0.000 0.000
#> SRR2082502 1 0.0000 0.940 1.000 0.000 0.000 0.000 0.000
#> SRR2082499 1 0.0000 0.940 1.000 0.000 0.000 0.000 0.000
#> SRR2082500 1 0.0000 0.940 1.000 0.000 0.000 0.000 0.000
#> SRR2082503 1 0.4767 0.724 0.720 0.000 0.192 0.088 0.000
#> SRR2082505 1 0.1965 0.906 0.904 0.000 0.000 0.096 0.000
#> SRR2082506 1 0.0000 0.940 1.000 0.000 0.000 0.000 0.000
#> SRR2082504 1 0.2020 0.904 0.900 0.000 0.000 0.100 0.000
#> SRR2082495 3 0.0000 0.887 0.000 0.000 1.000 0.000 0.000
#> SRR2082496 3 0.0000 0.887 0.000 0.000 1.000 0.000 0.000
#> SRR2082493 3 0.0000 0.887 0.000 0.000 1.000 0.000 0.000
#> SRR2082494 3 0.0000 0.887 0.000 0.000 1.000 0.000 0.000
#> SRR2082491 3 0.3242 0.690 0.216 0.000 0.784 0.000 0.000
#> SRR2082492 3 0.4161 0.351 0.392 0.000 0.608 0.000 0.000
#> SRR2082489 1 0.2411 0.896 0.884 0.000 0.008 0.108 0.000
#> SRR2082490 1 0.2411 0.896 0.884 0.000 0.008 0.108 0.000
#> SRR2082497 1 0.0000 0.940 1.000 0.000 0.000 0.000 0.000
#> SRR2082498 1 0.0000 0.940 1.000 0.000 0.000 0.000 0.000
#> SRR2082487 1 0.4734 0.751 0.732 0.000 0.160 0.108 0.000
#> SRR2082488 1 0.4734 0.751 0.732 0.000 0.160 0.108 0.000
#> SRR2082485 3 0.2127 0.834 0.000 0.000 0.892 0.108 0.000
#> SRR2082486 3 0.2127 0.834 0.000 0.000 0.892 0.108 0.000
#> SRR2082479 1 0.0162 0.939 0.996 0.000 0.000 0.004 0.000
#> SRR2082480 1 0.0000 0.940 1.000 0.000 0.000 0.000 0.000
#> SRR2082483 3 0.1478 0.869 0.000 0.000 0.936 0.064 0.000
#> SRR2082484 3 0.1478 0.869 0.000 0.000 0.936 0.064 0.000
#> SRR2082481 1 0.0000 0.940 1.000 0.000 0.000 0.000 0.000
#> SRR2082482 1 0.0000 0.940 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
#> SRR2082532 5 0.2378 0.802 0.000 0.000 0.000 0.152 0.848 0.000
#> SRR2082533 5 0.2378 0.802 0.000 0.000 0.000 0.152 0.848 0.000
#> SRR2082534 4 0.1075 0.922 0.000 0.000 0.000 0.952 0.048 0.000
#> SRR2082535 4 0.1075 0.922 0.000 0.000 0.000 0.952 0.048 0.000
#> SRR2082536 4 0.1075 0.922 0.000 0.000 0.000 0.952 0.048 0.000
#> SRR2082530 6 0.4695 0.724 0.000 0.044 0.000 0.000 0.448 0.508
#> SRR2082531 6 0.4695 0.724 0.000 0.044 0.000 0.000 0.448 0.508
#> SRR2082528 4 0.1075 0.922 0.000 0.000 0.000 0.952 0.048 0.000
#> SRR2082529 4 0.1075 0.922 0.000 0.000 0.000 0.952 0.048 0.000
#> SRR2082526 2 0.0260 0.873 0.000 0.992 0.000 0.000 0.008 0.000
#> SRR2082527 2 0.0260 0.873 0.000 0.992 0.000 0.000 0.008 0.000
#> SRR2082521 6 0.5125 0.724 0.000 0.076 0.000 0.004 0.380 0.540
#> SRR2082520 2 0.4300 0.555 0.000 0.640 0.000 0.000 0.324 0.036
#> SRR2082518 2 0.0260 0.873 0.000 0.992 0.000 0.000 0.008 0.000
#> SRR2082523 5 0.0820 0.714 0.000 0.012 0.000 0.000 0.972 0.016
#> SRR2082524 5 0.1151 0.696 0.000 0.012 0.000 0.000 0.956 0.032
#> SRR2082525 2 0.0260 0.873 0.000 0.992 0.000 0.000 0.008 0.000
#> SRR2082522 4 0.4346 0.565 0.000 0.232 0.000 0.712 0.020 0.036
#> SRR2082519 2 0.4348 0.558 0.000 0.640 0.000 0.000 0.320 0.040
#> SRR2082513 6 0.5578 0.531 0.000 0.276 0.000 0.000 0.184 0.540
#> SRR2082512 2 0.0000 0.872 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2082516 5 0.2793 0.762 0.000 0.000 0.000 0.200 0.800 0.000
#> SRR2082515 2 0.1408 0.854 0.000 0.944 0.000 0.000 0.020 0.036
#> SRR2082517 2 0.1408 0.854 0.000 0.944 0.000 0.000 0.020 0.036
#> SRR2082514 5 0.2631 0.628 0.000 0.180 0.000 0.000 0.820 0.000
#> SRR2082508 1 0.0000 0.834 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2082509 1 0.3446 0.734 0.692 0.000 0.000 0.000 0.000 0.308
#> SRR2082507 1 0.0000 0.834 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2082510 3 0.2325 0.789 0.000 0.000 0.892 0.048 0.000 0.060
#> SRR2082511 3 0.0000 0.818 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2082501 1 0.0000 0.834 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2082502 1 0.0000 0.834 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2082499 1 0.0000 0.834 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2082500 1 0.0000 0.834 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2082503 1 0.5190 0.618 0.528 0.000 0.096 0.000 0.000 0.376
#> SRR2082505 1 0.2048 0.802 0.880 0.000 0.000 0.000 0.000 0.120
#> SRR2082506 1 0.0000 0.834 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2082504 1 0.2260 0.796 0.860 0.000 0.000 0.000 0.000 0.140
#> SRR2082495 3 0.0000 0.818 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2082496 3 0.0000 0.818 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2082493 3 0.0000 0.818 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2082494 3 0.0000 0.818 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2082491 3 0.2883 0.665 0.212 0.000 0.788 0.000 0.000 0.000
#> SRR2082492 3 0.3727 0.419 0.388 0.000 0.612 0.000 0.000 0.000
#> SRR2082489 1 0.4168 0.678 0.584 0.000 0.016 0.000 0.000 0.400
#> SRR2082490 1 0.4168 0.678 0.584 0.000 0.016 0.000 0.000 0.400
#> SRR2082497 1 0.0000 0.834 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2082498 1 0.0000 0.834 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2082487 1 0.5112 0.610 0.516 0.000 0.084 0.000 0.000 0.400
#> SRR2082488 1 0.5112 0.610 0.516 0.000 0.084 0.000 0.000 0.400
#> SRR2082485 3 0.3756 0.538 0.000 0.000 0.600 0.000 0.000 0.400
#> SRR2082486 3 0.3756 0.538 0.000 0.000 0.600 0.000 0.000 0.400
#> SRR2082479 1 0.3175 0.754 0.744 0.000 0.000 0.000 0.000 0.256
#> SRR2082480 1 0.3101 0.757 0.756 0.000 0.000 0.000 0.000 0.244
#> SRR2082483 3 0.2325 0.789 0.000 0.000 0.892 0.048 0.000 0.060
#> SRR2082484 3 0.2325 0.789 0.000 0.000 0.892 0.048 0.000 0.060
#> SRR2082481 1 0.0000 0.834 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2082482 1 0.0146 0.833 0.996 0.000 0.000 0.000 0.000 0.004
Heatmaps for the consensus matrix. It visualizes the probability of two samples to be in a same group.
consensus_heatmap(res, k = 2)
consensus_heatmap(res, k = 3)
consensus_heatmap(res, k = 4)
consensus_heatmap(res, k = 5)
consensus_heatmap(res, k = 6)
Heatmaps for the membership of samples in all partitions to see how consistent they are:
membership_heatmap(res, k = 2)
membership_heatmap(res, k = 3)
membership_heatmap(res, k = 4)
membership_heatmap(res, k = 5)
membership_heatmap(res, k = 6)
As soon as we have had the classes for columns, we can look for signatures which are significantly different between classes which can be candidate marks for certain classes. Following are the heatmaps for signatures.
Signature heatmaps where rows are scaled:
get_signatures(res, k = 2)
get_signatures(res, k = 3)
get_signatures(res, k = 4)
get_signatures(res, k = 5)
get_signatures(res, k = 6)
Signature heatmaps where rows are not scaled:
get_signatures(res, k = 2, scale_rows = FALSE)
get_signatures(res, k = 3, scale_rows = FALSE)
get_signatures(res, k = 4, scale_rows = FALSE)
get_signatures(res, k = 5, scale_rows = FALSE)
get_signatures(res, k = 6, scale_rows = FALSE)
Compare the overlap of signatures from different k:
compare_signatures(res)
get_signature()
returns a data frame invisibly. TO get the list of signatures, the function
call should be assigned to a variable explicitly. In following code, if plot
argument is set
to FALSE
, no heatmap is plotted while only the differential analysis is performed.
# code only for demonstration
tb = get_signature(res, k = ..., plot = FALSE)
An example of the output of tb
is:
#> which_row fdr mean_1 mean_2 scaled_mean_1 scaled_mean_2 km
#> 1 38 0.042760348 8.373488 9.131774 -0.5533452 0.5164555 1
#> 2 40 0.018707592 7.106213 8.469186 -0.6173731 0.5762149 1
#> 3 55 0.019134737 10.221463 11.207825 -0.6159697 0.5749050 1
#> 4 59 0.006059896 5.921854 7.869574 -0.6899429 0.6439467 1
#> 5 60 0.018055526 8.928898 10.211722 -0.6204761 0.5791110 1
#> 6 98 0.009384629 15.714769 14.887706 0.6635654 -0.6193277 2
...
The columns in tb
are:
which_row
: row indices corresponding to the input matrix.fdr
: FDR for the differential test. mean_x
: The mean value in group x.scaled_mean_x
: The mean value in group x after rows are scaled.km
: Row groups if k-means clustering is applied to rows.UMAP plot which shows how samples are separated.
dimension_reduction(res, k = 2, method = "UMAP")
dimension_reduction(res, k = 3, method = "UMAP")
dimension_reduction(res, k = 4, method = "UMAP")
dimension_reduction(res, k = 5, method = "UMAP")
dimension_reduction(res, k = 6, method = "UMAP")
Following heatmap shows how subgroups are split when increasing k
:
collect_classes(res)
If matrix rows can be associated to genes, consider to use functional_enrichment(res,
...)
to perform function enrichment for the signature genes. See this vignette for more detailed explanations.
The object with results only for a single top-value method and a single partition method can be extracted as:
res = res_list["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 14581 rows and 58 columns.
#> Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'SD' method.
#> Subgroups are detected by 'mclust' method.
#> Performed in total 1250 partitions by row resampling.
#> Best k for subgroups seems to be 2.
#>
#> Following methods can be applied to this 'ConsensusPartition' object:
#> [1] "cola_report" "collect_classes" "collect_plots"
#> [4] "collect_stats" "colnames" "compare_signatures"
#> [7] "consensus_heatmap" "dimension_reduction" "functional_enrichment"
#> [10] "get_anno_col" "get_anno" "get_classes"
#> [13] "get_consensus" "get_matrix" "get_membership"
#> [16] "get_param" "get_signatures" "get_stats"
#> [19] "is_best_k" "is_stable_k" "membership_heatmap"
#> [22] "ncol" "nrow" "plot_ecdf"
#> [25] "rownames" "select_partition_number" "show"
#> [28] "suggest_best_k" "test_to_known_factors"
collect_plots()
function collects all the plots made from res
for all k
(number of partitions)
into one single page to provide an easy and fast comparison between different k
.
collect_plots(res)
The plots are:
k
and the heatmap of
predicted classes for each k
.k
.k
.k
.All the plots in panels can be made by individual functions and they are plotted later in this section.
select_partition_number()
produces several plots showing different
statistics for choosing “optimized” k
. There are following statistics:
k
;k
, the area increased is defined as \(A_k - A_{k-1}\).The detailed explanations of these statistics can be found in the cola vignette.
Generally speaking, lower PAC score, higher mean silhouette score or higher
concordance corresponds to better partition. Rand index and Jaccard index
measure how similar the current partition is compared to partition with k-1
.
If they are too similar, we won't accept k
is better than k-1
.
select_partition_number(res)
The numeric values for all these statistics can be obtained by get_stats()
.
get_stats(res)
#> k 1-PAC mean_silhouette concordance area_increased Rand Jaccard
#> 2 2 1.000 1.000 1.000 0.4996 0.501 0.501
#> 3 3 0.760 0.826 0.873 0.2246 0.902 0.804
#> 4 4 0.567 0.664 0.745 0.1334 0.909 0.775
#> 5 5 0.576 0.521 0.676 0.0924 0.881 0.641
#> 6 6 0.655 0.595 0.738 0.0705 0.894 0.584
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
#> SRR2082532 2 0 1 0 1
#> SRR2082533 2 0 1 0 1
#> SRR2082534 2 0 1 0 1
#> SRR2082535 2 0 1 0 1
#> SRR2082536 2 0 1 0 1
#> SRR2082530 2 0 1 0 1
#> SRR2082531 2 0 1 0 1
#> SRR2082528 2 0 1 0 1
#> SRR2082529 2 0 1 0 1
#> SRR2082526 2 0 1 0 1
#> SRR2082527 2 0 1 0 1
#> SRR2082521 2 0 1 0 1
#> SRR2082520 2 0 1 0 1
#> SRR2082518 2 0 1 0 1
#> SRR2082523 2 0 1 0 1
#> SRR2082524 2 0 1 0 1
#> SRR2082525 2 0 1 0 1
#> SRR2082522 2 0 1 0 1
#> SRR2082519 2 0 1 0 1
#> SRR2082513 2 0 1 0 1
#> SRR2082512 2 0 1 0 1
#> SRR2082516 2 0 1 0 1
#> SRR2082515 2 0 1 0 1
#> SRR2082517 2 0 1 0 1
#> SRR2082514 2 0 1 0 1
#> SRR2082508 1 0 1 1 0
#> SRR2082509 1 0 1 1 0
#> SRR2082507 1 0 1 1 0
#> SRR2082510 1 0 1 1 0
#> SRR2082511 1 0 1 1 0
#> SRR2082501 1 0 1 1 0
#> SRR2082502 1 0 1 1 0
#> SRR2082499 1 0 1 1 0
#> SRR2082500 1 0 1 1 0
#> SRR2082503 1 0 1 1 0
#> SRR2082505 1 0 1 1 0
#> SRR2082506 1 0 1 1 0
#> SRR2082504 1 0 1 1 0
#> SRR2082495 1 0 1 1 0
#> SRR2082496 1 0 1 1 0
#> SRR2082493 1 0 1 1 0
#> SRR2082494 1 0 1 1 0
#> SRR2082491 1 0 1 1 0
#> SRR2082492 1 0 1 1 0
#> SRR2082489 1 0 1 1 0
#> SRR2082490 1 0 1 1 0
#> SRR2082497 1 0 1 1 0
#> SRR2082498 1 0 1 1 0
#> SRR2082487 1 0 1 1 0
#> SRR2082488 1 0 1 1 0
#> SRR2082485 1 0 1 1 0
#> SRR2082486 1 0 1 1 0
#> SRR2082479 1 0 1 1 0
#> SRR2082480 1 0 1 1 0
#> SRR2082483 1 0 1 1 0
#> SRR2082484 1 0 1 1 0
#> SRR2082481 1 0 1 1 0
#> SRR2082482 1 0 1 1 0
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> SRR2082532 2 0.0000 0.9898 0.000 1.000 0.000
#> SRR2082533 2 0.0000 0.9898 0.000 1.000 0.000
#> SRR2082534 2 0.0000 0.9898 0.000 1.000 0.000
#> SRR2082535 2 0.0000 0.9898 0.000 1.000 0.000
#> SRR2082536 2 0.0000 0.9898 0.000 1.000 0.000
#> SRR2082530 2 0.0424 0.9871 0.000 0.992 0.008
#> SRR2082531 2 0.0424 0.9871 0.000 0.992 0.008
#> SRR2082528 2 0.0000 0.9898 0.000 1.000 0.000
#> SRR2082529 2 0.0000 0.9898 0.000 1.000 0.000
#> SRR2082526 2 0.2537 0.9327 0.000 0.920 0.080
#> SRR2082527 2 0.2537 0.9327 0.000 0.920 0.080
#> SRR2082521 2 0.0237 0.9887 0.000 0.996 0.004
#> SRR2082520 2 0.0000 0.9898 0.000 1.000 0.000
#> SRR2082518 2 0.0424 0.9871 0.000 0.992 0.008
#> SRR2082523 2 0.0000 0.9898 0.000 1.000 0.000
#> SRR2082524 2 0.0000 0.9898 0.000 1.000 0.000
#> SRR2082525 2 0.2537 0.9327 0.000 0.920 0.080
#> SRR2082522 2 0.0000 0.9898 0.000 1.000 0.000
#> SRR2082519 2 0.0000 0.9898 0.000 1.000 0.000
#> SRR2082513 2 0.0237 0.9887 0.000 0.996 0.004
#> SRR2082512 2 0.0237 0.9887 0.000 0.996 0.004
#> SRR2082516 2 0.0000 0.9898 0.000 1.000 0.000
#> SRR2082515 2 0.0000 0.9898 0.000 1.000 0.000
#> SRR2082517 2 0.0237 0.9887 0.000 0.996 0.004
#> SRR2082514 2 0.0000 0.9898 0.000 1.000 0.000
#> SRR2082508 1 0.5098 0.6812 0.752 0.000 0.248
#> SRR2082509 1 0.3038 0.7344 0.896 0.000 0.104
#> SRR2082507 1 0.4452 0.7367 0.808 0.000 0.192
#> SRR2082510 3 0.5138 0.7595 0.252 0.000 0.748
#> SRR2082511 3 0.6274 0.6917 0.456 0.000 0.544
#> SRR2082501 1 0.4291 0.7259 0.820 0.000 0.180
#> SRR2082502 1 0.4291 0.7259 0.820 0.000 0.180
#> SRR2082499 1 0.3816 0.7382 0.852 0.000 0.148
#> SRR2082500 1 0.3816 0.7382 0.852 0.000 0.148
#> SRR2082503 1 0.6079 0.0289 0.612 0.000 0.388
#> SRR2082505 1 0.3267 0.7582 0.884 0.000 0.116
#> SRR2082506 1 0.5138 0.6774 0.748 0.000 0.252
#> SRR2082504 1 0.3267 0.7582 0.884 0.000 0.116
#> SRR2082495 1 0.3116 0.7296 0.892 0.000 0.108
#> SRR2082496 1 0.3116 0.7297 0.892 0.000 0.108
#> SRR2082493 1 0.2796 0.7414 0.908 0.000 0.092
#> SRR2082494 1 0.2878 0.7386 0.904 0.000 0.096
#> SRR2082491 1 0.1163 0.7763 0.972 0.000 0.028
#> SRR2082492 1 0.1163 0.7763 0.972 0.000 0.028
#> SRR2082489 1 0.4399 0.6200 0.812 0.000 0.188
#> SRR2082490 1 0.4399 0.6200 0.812 0.000 0.188
#> SRR2082497 1 0.4002 0.7318 0.840 0.000 0.160
#> SRR2082498 1 0.4002 0.7318 0.840 0.000 0.160
#> SRR2082487 1 0.1643 0.7770 0.956 0.000 0.044
#> SRR2082488 1 0.1753 0.7768 0.952 0.000 0.048
#> SRR2082485 3 0.6302 0.6657 0.480 0.000 0.520
#> SRR2082486 3 0.6302 0.6657 0.480 0.000 0.520
#> SRR2082479 1 0.4062 0.7169 0.836 0.000 0.164
#> SRR2082480 1 0.4002 0.7219 0.840 0.000 0.160
#> SRR2082483 3 0.4842 0.7623 0.224 0.000 0.776
#> SRR2082484 3 0.4842 0.7623 0.224 0.000 0.776
#> SRR2082481 1 0.3192 0.7602 0.888 0.000 0.112
#> SRR2082482 1 0.3192 0.7602 0.888 0.000 0.112
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> SRR2082532 4 0.4908 0.8259 0.000 0.292 0.016 0.692
#> SRR2082533 4 0.4908 0.8259 0.000 0.292 0.016 0.692
#> SRR2082534 4 0.4040 0.8157 0.000 0.248 0.000 0.752
#> SRR2082535 4 0.4040 0.8157 0.000 0.248 0.000 0.752
#> SRR2082536 4 0.4040 0.8157 0.000 0.248 0.000 0.752
#> SRR2082530 2 0.4454 0.4268 0.000 0.692 0.000 0.308
#> SRR2082531 2 0.4454 0.4268 0.000 0.692 0.000 0.308
#> SRR2082528 4 0.4040 0.8157 0.000 0.248 0.000 0.752
#> SRR2082529 4 0.4040 0.8157 0.000 0.248 0.000 0.752
#> SRR2082526 2 0.0000 0.6471 0.000 1.000 0.000 0.000
#> SRR2082527 2 0.0000 0.6471 0.000 1.000 0.000 0.000
#> SRR2082521 4 0.4961 0.6313 0.000 0.448 0.000 0.552
#> SRR2082520 4 0.5127 0.7919 0.000 0.356 0.012 0.632
#> SRR2082518 2 0.0895 0.6421 0.000 0.976 0.020 0.004
#> SRR2082523 2 0.5220 0.0919 0.000 0.568 0.008 0.424
#> SRR2082524 2 0.5220 0.0919 0.000 0.568 0.008 0.424
#> SRR2082525 2 0.0000 0.6471 0.000 1.000 0.000 0.000
#> SRR2082522 4 0.5167 0.8005 0.000 0.340 0.016 0.644
#> SRR2082519 4 0.5279 0.7433 0.000 0.400 0.012 0.588
#> SRR2082513 2 0.4855 0.3235 0.000 0.644 0.004 0.352
#> SRR2082512 2 0.2266 0.6283 0.000 0.912 0.004 0.084
#> SRR2082516 4 0.4936 0.8262 0.000 0.280 0.020 0.700
#> SRR2082515 4 0.5290 0.7368 0.000 0.404 0.012 0.584
#> SRR2082517 4 0.5168 0.5265 0.000 0.492 0.004 0.504
#> SRR2082514 4 0.5645 0.7518 0.000 0.364 0.032 0.604
#> SRR2082508 1 0.2480 0.6762 0.904 0.000 0.008 0.088
#> SRR2082509 1 0.4718 0.7118 0.708 0.000 0.280 0.012
#> SRR2082507 1 0.3156 0.7021 0.884 0.000 0.048 0.068
#> SRR2082510 3 0.0859 0.7615 0.004 0.008 0.980 0.008
#> SRR2082511 3 0.3448 0.7208 0.168 0.000 0.828 0.004
#> SRR2082501 1 0.4181 0.7235 0.820 0.000 0.128 0.052
#> SRR2082502 1 0.4127 0.7241 0.824 0.000 0.124 0.052
#> SRR2082499 1 0.4234 0.7190 0.816 0.000 0.132 0.052
#> SRR2082500 1 0.4072 0.7235 0.828 0.000 0.120 0.052
#> SRR2082503 1 0.5942 0.4065 0.548 0.000 0.412 0.040
#> SRR2082505 1 0.4150 0.6849 0.824 0.000 0.056 0.120
#> SRR2082506 1 0.2480 0.6762 0.904 0.000 0.008 0.088
#> SRR2082504 1 0.4150 0.6849 0.824 0.000 0.056 0.120
#> SRR2082495 1 0.5969 0.5349 0.564 0.000 0.392 0.044
#> SRR2082496 1 0.5959 0.5432 0.568 0.000 0.388 0.044
#> SRR2082493 1 0.5911 0.5709 0.584 0.000 0.372 0.044
#> SRR2082494 1 0.5911 0.5709 0.584 0.000 0.372 0.044
#> SRR2082491 1 0.5213 0.7109 0.724 0.000 0.224 0.052
#> SRR2082492 1 0.5213 0.7109 0.724 0.000 0.224 0.052
#> SRR2082489 1 0.5289 0.6619 0.636 0.000 0.344 0.020
#> SRR2082490 1 0.5289 0.6619 0.636 0.000 0.344 0.020
#> SRR2082497 1 0.2983 0.7203 0.892 0.000 0.068 0.040
#> SRR2082498 1 0.2908 0.7205 0.896 0.000 0.064 0.040
#> SRR2082487 1 0.4826 0.7124 0.716 0.000 0.264 0.020
#> SRR2082488 1 0.4826 0.7124 0.716 0.000 0.264 0.020
#> SRR2082485 3 0.4348 0.7138 0.196 0.000 0.780 0.024
#> SRR2082486 3 0.4348 0.7138 0.196 0.000 0.780 0.024
#> SRR2082479 1 0.5383 0.6766 0.740 0.000 0.160 0.100
#> SRR2082480 1 0.5383 0.6766 0.740 0.000 0.160 0.100
#> SRR2082483 3 0.4040 0.7383 0.044 0.072 0.856 0.028
#> SRR2082484 3 0.4040 0.7383 0.044 0.072 0.856 0.028
#> SRR2082481 1 0.3996 0.6971 0.836 0.000 0.060 0.104
#> SRR2082482 1 0.3919 0.6960 0.840 0.000 0.056 0.104
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> SRR2082532 4 0.498 -0.588 0.000 0.028 0.000 0.504 0.468
#> SRR2082533 4 0.498 -0.588 0.000 0.028 0.000 0.504 0.468
#> SRR2082534 4 0.029 0.713 0.000 0.008 0.000 0.992 0.000
#> SRR2082535 4 0.029 0.713 0.000 0.008 0.000 0.992 0.000
#> SRR2082536 4 0.000 0.716 0.000 0.000 0.000 1.000 0.000
#> SRR2082530 2 0.602 0.370 0.000 0.524 0.000 0.348 0.128
#> SRR2082531 2 0.602 0.370 0.000 0.524 0.000 0.348 0.128
#> SRR2082528 4 0.000 0.716 0.000 0.000 0.000 1.000 0.000
#> SRR2082529 4 0.000 0.716 0.000 0.000 0.000 1.000 0.000
#> SRR2082526 2 0.120 0.565 0.000 0.952 0.000 0.048 0.000
#> SRR2082527 2 0.120 0.565 0.000 0.952 0.000 0.048 0.000
#> SRR2082521 5 0.659 0.686 0.000 0.220 0.000 0.340 0.440
#> SRR2082520 5 0.621 0.844 0.000 0.160 0.000 0.324 0.516
#> SRR2082518 2 0.323 0.528 0.000 0.852 0.000 0.060 0.088
#> SRR2082523 2 0.610 0.277 0.000 0.444 0.000 0.432 0.124
#> SRR2082524 2 0.610 0.277 0.000 0.444 0.000 0.432 0.124
#> SRR2082525 2 0.120 0.565 0.000 0.952 0.000 0.048 0.000
#> SRR2082522 5 0.631 0.839 0.000 0.168 0.000 0.340 0.492
#> SRR2082519 5 0.618 0.840 0.000 0.152 0.000 0.332 0.516
#> SRR2082513 2 0.678 -0.238 0.000 0.388 0.000 0.316 0.296
#> SRR2082512 2 0.537 0.368 0.000 0.668 0.000 0.148 0.184
#> SRR2082516 5 0.517 0.653 0.000 0.040 0.000 0.452 0.508
#> SRR2082515 5 0.625 0.843 0.000 0.168 0.000 0.316 0.516
#> SRR2082517 5 0.658 0.747 0.000 0.256 0.000 0.276 0.468
#> SRR2082514 5 0.563 0.733 0.000 0.076 0.000 0.420 0.504
#> SRR2082508 1 0.391 0.599 0.720 0.000 0.008 0.000 0.272
#> SRR2082509 1 0.443 0.466 0.648 0.000 0.336 0.000 0.016
#> SRR2082507 1 0.492 0.608 0.668 0.000 0.060 0.000 0.272
#> SRR2082510 3 0.152 0.689 0.004 0.004 0.944 0.000 0.048
#> SRR2082511 3 0.157 0.701 0.060 0.000 0.936 0.000 0.004
#> SRR2082501 1 0.244 0.576 0.876 0.000 0.120 0.000 0.004
#> SRR2082502 1 0.239 0.578 0.880 0.000 0.116 0.000 0.004
#> SRR2082499 1 0.239 0.577 0.880 0.000 0.116 0.000 0.004
#> SRR2082500 1 0.234 0.579 0.884 0.000 0.112 0.000 0.004
#> SRR2082503 3 0.669 -0.089 0.308 0.004 0.464 0.000 0.224
#> SRR2082505 1 0.541 0.589 0.584 0.000 0.072 0.000 0.344
#> SRR2082506 1 0.389 0.601 0.724 0.000 0.008 0.000 0.268
#> SRR2082504 1 0.541 0.589 0.584 0.000 0.072 0.000 0.344
#> SRR2082495 3 0.536 0.565 0.272 0.008 0.648 0.000 0.072
#> SRR2082496 3 0.543 0.551 0.284 0.008 0.636 0.000 0.072
#> SRR2082493 3 0.543 0.536 0.296 0.008 0.628 0.000 0.068
#> SRR2082494 3 0.543 0.536 0.296 0.008 0.628 0.000 0.068
#> SRR2082491 1 0.513 0.430 0.672 0.004 0.252 0.000 0.072
#> SRR2082492 1 0.513 0.430 0.672 0.004 0.252 0.000 0.072
#> SRR2082489 1 0.495 0.376 0.572 0.000 0.396 0.000 0.032
#> SRR2082490 1 0.495 0.376 0.572 0.000 0.396 0.000 0.032
#> SRR2082497 1 0.223 0.608 0.892 0.000 0.004 0.000 0.104
#> SRR2082498 1 0.223 0.608 0.892 0.000 0.004 0.000 0.104
#> SRR2082487 1 0.576 0.501 0.572 0.004 0.332 0.000 0.092
#> SRR2082488 1 0.576 0.501 0.572 0.004 0.332 0.000 0.092
#> SRR2082485 3 0.246 0.694 0.052 0.004 0.904 0.000 0.040
#> SRR2082486 3 0.246 0.694 0.052 0.004 0.904 0.000 0.040
#> SRR2082479 1 0.685 0.498 0.416 0.004 0.264 0.000 0.316
#> SRR2082480 1 0.685 0.498 0.416 0.004 0.264 0.000 0.316
#> SRR2082483 3 0.321 0.663 0.004 0.064 0.860 0.000 0.072
#> SRR2082484 3 0.321 0.663 0.004 0.064 0.860 0.000 0.072
#> SRR2082481 1 0.561 0.588 0.576 0.004 0.076 0.000 0.344
#> SRR2082482 1 0.561 0.588 0.576 0.004 0.076 0.000 0.344
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> SRR2082532 5 0.4064 0.66570 0.000 0.056 0.000 0.200 0.740 0.004
#> SRR2082533 5 0.4064 0.66570 0.000 0.056 0.000 0.200 0.740 0.004
#> SRR2082534 4 0.1556 0.98816 0.000 0.000 0.000 0.920 0.080 0.000
#> SRR2082535 4 0.1556 0.98816 0.000 0.000 0.000 0.920 0.080 0.000
#> SRR2082536 4 0.1588 0.99211 0.000 0.004 0.000 0.924 0.072 0.000
#> SRR2082530 2 0.5681 0.37729 0.000 0.492 0.000 0.104 0.388 0.016
#> SRR2082531 2 0.5681 0.37729 0.000 0.492 0.000 0.104 0.388 0.016
#> SRR2082528 4 0.1588 0.99211 0.000 0.004 0.000 0.924 0.072 0.000
#> SRR2082529 4 0.1588 0.99211 0.000 0.004 0.000 0.924 0.072 0.000
#> SRR2082526 2 0.3649 0.60240 0.000 0.796 0.000 0.016 0.152 0.036
#> SRR2082527 2 0.3649 0.60240 0.000 0.796 0.000 0.016 0.152 0.036
#> SRR2082521 5 0.4901 0.52905 0.000 0.200 0.000 0.100 0.684 0.016
#> SRR2082520 5 0.0291 0.73337 0.000 0.004 0.000 0.004 0.992 0.000
#> SRR2082518 2 0.4330 0.53471 0.000 0.680 0.000 0.008 0.276 0.036
#> SRR2082523 2 0.5917 0.30046 0.000 0.436 0.000 0.132 0.416 0.016
#> SRR2082524 2 0.5917 0.30046 0.000 0.436 0.000 0.132 0.416 0.016
#> SRR2082525 2 0.3649 0.60240 0.000 0.796 0.000 0.016 0.152 0.036
#> SRR2082522 5 0.3817 0.62734 0.000 0.052 0.000 0.152 0.784 0.012
#> SRR2082519 5 0.0146 0.73274 0.000 0.004 0.000 0.000 0.996 0.000
#> SRR2082513 5 0.4970 0.16026 0.000 0.296 0.000 0.068 0.624 0.012
#> SRR2082512 2 0.3930 0.38019 0.000 0.576 0.000 0.004 0.420 0.000
#> SRR2082516 5 0.2946 0.71148 0.000 0.004 0.000 0.184 0.808 0.004
#> SRR2082515 5 0.0146 0.73209 0.000 0.004 0.000 0.000 0.996 0.000
#> SRR2082517 5 0.2909 0.60221 0.000 0.156 0.000 0.004 0.828 0.012
#> SRR2082514 5 0.2501 0.73573 0.000 0.016 0.000 0.108 0.872 0.004
#> SRR2082508 1 0.3023 0.58165 0.784 0.000 0.004 0.000 0.000 0.212
#> SRR2082509 6 0.6041 0.00304 0.384 0.004 0.208 0.000 0.000 0.404
#> SRR2082507 1 0.3352 0.60146 0.792 0.000 0.032 0.000 0.000 0.176
#> SRR2082510 3 0.3636 0.73325 0.024 0.052 0.832 0.012 0.000 0.080
#> SRR2082511 3 0.2217 0.75288 0.048 0.004 0.908 0.004 0.000 0.036
#> SRR2082501 6 0.2999 0.76834 0.124 0.000 0.040 0.000 0.000 0.836
#> SRR2082502 6 0.2972 0.76819 0.128 0.000 0.036 0.000 0.000 0.836
#> SRR2082499 6 0.2843 0.77224 0.116 0.000 0.036 0.000 0.000 0.848
#> SRR2082500 6 0.2843 0.77224 0.116 0.000 0.036 0.000 0.000 0.848
#> SRR2082503 1 0.5931 0.18916 0.496 0.004 0.260 0.000 0.000 0.240
#> SRR2082505 1 0.1531 0.63900 0.928 0.000 0.004 0.000 0.000 0.068
#> SRR2082506 1 0.3052 0.57941 0.780 0.000 0.004 0.000 0.000 0.216
#> SRR2082504 1 0.0692 0.64476 0.976 0.000 0.004 0.000 0.000 0.020
#> SRR2082495 3 0.4350 0.60360 0.008 0.020 0.712 0.020 0.000 0.240
#> SRR2082496 3 0.4350 0.60360 0.008 0.020 0.712 0.020 0.000 0.240
#> SRR2082493 3 0.3683 0.69914 0.008 0.020 0.800 0.020 0.000 0.152
#> SRR2082494 3 0.3683 0.69914 0.008 0.020 0.800 0.020 0.000 0.152
#> SRR2082491 6 0.5307 0.69007 0.096 0.020 0.192 0.016 0.000 0.676
#> SRR2082492 6 0.5307 0.69007 0.096 0.020 0.192 0.016 0.000 0.676
#> SRR2082489 1 0.6199 0.12770 0.472 0.008 0.228 0.004 0.000 0.288
#> SRR2082490 1 0.6199 0.12770 0.472 0.008 0.228 0.004 0.000 0.288
#> SRR2082497 1 0.3851 0.21340 0.540 0.000 0.000 0.000 0.000 0.460
#> SRR2082498 1 0.3851 0.21340 0.540 0.000 0.000 0.000 0.000 0.460
#> SRR2082487 1 0.5804 0.36108 0.572 0.004 0.240 0.012 0.000 0.172
#> SRR2082488 1 0.5804 0.36108 0.572 0.004 0.240 0.012 0.000 0.172
#> SRR2082485 3 0.2881 0.74230 0.084 0.004 0.868 0.012 0.000 0.032
#> SRR2082486 3 0.2881 0.74230 0.084 0.004 0.868 0.012 0.000 0.032
#> SRR2082479 1 0.1951 0.63419 0.916 0.000 0.060 0.004 0.000 0.020
#> SRR2082480 1 0.1951 0.63419 0.916 0.000 0.060 0.004 0.000 0.020
#> SRR2082483 3 0.5114 0.68412 0.056 0.152 0.708 0.004 0.000 0.080
#> SRR2082484 3 0.5114 0.68412 0.056 0.152 0.708 0.004 0.000 0.080
#> SRR2082481 1 0.0291 0.64043 0.992 0.000 0.004 0.004 0.000 0.000
#> SRR2082482 1 0.0291 0.64043 0.992 0.000 0.004 0.004 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 14581 rows and 58 columns.
#> Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'SD' method.
#> Subgroups are detected by 'NMF' method.
#> Performed in total 1250 partitions by row resampling.
#> Best k for subgroups seems to be 3.
#>
#> Following methods can be applied to this 'ConsensusPartition' object:
#> [1] "cola_report" "collect_classes" "collect_plots"
#> [4] "collect_stats" "colnames" "compare_signatures"
#> [7] "consensus_heatmap" "dimension_reduction" "functional_enrichment"
#> [10] "get_anno_col" "get_anno" "get_classes"
#> [13] "get_consensus" "get_matrix" "get_membership"
#> [16] "get_param" "get_signatures" "get_stats"
#> [19] "is_best_k" "is_stable_k" "membership_heatmap"
#> [22] "ncol" "nrow" "plot_ecdf"
#> [25] "rownames" "select_partition_number" "show"
#> [28] "suggest_best_k" "test_to_known_factors"
collect_plots()
function collects all the plots made from res
for all k
(number of partitions)
into one single page to provide an easy and fast comparison between different k
.
collect_plots(res)
The plots are:
k
and the heatmap of
predicted classes for each k
.k
.k
.k
.All the plots in panels can be made by individual functions and they are plotted later in this section.
select_partition_number()
produces several plots showing different
statistics for choosing “optimized” k
. There are following statistics:
k
;k
, the area increased is defined as \(A_k - A_{k-1}\).The detailed explanations of these statistics can be found in the cola vignette.
Generally speaking, lower PAC score, higher mean silhouette score or higher
concordance corresponds to better partition. Rand index and Jaccard index
measure how similar the current partition is compared to partition with k-1
.
If they are too similar, we won't accept k
is better than k-1
.
select_partition_number(res)
The numeric values for all these statistics can be obtained by get_stats()
.
get_stats(res)
#> k 1-PAC mean_silhouette concordance area_increased Rand Jaccard
#> 2 2 1.000 0.999 1.000 0.4997 0.501 0.501
#> 3 3 0.987 0.966 0.983 0.1387 0.930 0.860
#> 4 4 0.900 0.902 0.942 0.0651 1.000 1.000
#> 5 5 0.661 0.680 0.852 0.0992 0.983 0.961
#> 6 6 0.608 0.582 0.751 0.0939 0.926 0.821
suggest_best_k()
suggests the best \(k\) based on these statistics. The rules are as follows:
suggest_best_k(res)
#> [1] 3
#> attr(,"optional")
#> [1] 2
There is also optional best \(k\) = 2 that is worth to check.
Following shows the table of the partitions (You need to click the show/hide
code output link to see it). The membership matrix (columns with name p*
)
is inferred by
clue::cl_consensus()
function with the SE
method. Basically the value in the membership matrix
represents the probability to belong to a certain group. The finall class
label for an item is determined with the group with highest probability it
belongs to.
In get_classes()
function, the entropy is calculated from the membership
matrix and the silhouette score is calculated from the consensus matrix.
cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#> class entropy silhouette p1 p2
#> SRR2082532 2 0.000 1.000 0.000 1.000
#> SRR2082533 2 0.000 1.000 0.000 1.000
#> SRR2082534 2 0.000 1.000 0.000 1.000
#> SRR2082535 2 0.000 1.000 0.000 1.000
#> SRR2082536 2 0.000 1.000 0.000 1.000
#> SRR2082530 2 0.000 1.000 0.000 1.000
#> SRR2082531 2 0.000 1.000 0.000 1.000
#> SRR2082528 2 0.000 1.000 0.000 1.000
#> SRR2082529 2 0.000 1.000 0.000 1.000
#> SRR2082526 2 0.000 1.000 0.000 1.000
#> SRR2082527 2 0.000 1.000 0.000 1.000
#> SRR2082521 2 0.000 1.000 0.000 1.000
#> SRR2082520 2 0.000 1.000 0.000 1.000
#> SRR2082518 2 0.000 1.000 0.000 1.000
#> SRR2082523 2 0.000 1.000 0.000 1.000
#> SRR2082524 2 0.000 1.000 0.000 1.000
#> SRR2082525 2 0.000 1.000 0.000 1.000
#> SRR2082522 2 0.000 1.000 0.000 1.000
#> SRR2082519 2 0.000 1.000 0.000 1.000
#> SRR2082513 2 0.000 1.000 0.000 1.000
#> SRR2082512 2 0.000 1.000 0.000 1.000
#> SRR2082516 2 0.000 1.000 0.000 1.000
#> SRR2082515 2 0.000 1.000 0.000 1.000
#> SRR2082517 2 0.000 1.000 0.000 1.000
#> SRR2082514 2 0.000 1.000 0.000 1.000
#> SRR2082508 1 0.000 0.999 1.000 0.000
#> SRR2082509 1 0.000 0.999 1.000 0.000
#> SRR2082507 1 0.000 0.999 1.000 0.000
#> SRR2082510 1 0.118 0.984 0.984 0.016
#> SRR2082511 1 0.000 0.999 1.000 0.000
#> SRR2082501 1 0.000 0.999 1.000 0.000
#> SRR2082502 1 0.000 0.999 1.000 0.000
#> SRR2082499 1 0.000 0.999 1.000 0.000
#> SRR2082500 1 0.000 0.999 1.000 0.000
#> SRR2082503 1 0.000 0.999 1.000 0.000
#> SRR2082505 1 0.000 0.999 1.000 0.000
#> SRR2082506 1 0.000 0.999 1.000 0.000
#> SRR2082504 1 0.000 0.999 1.000 0.000
#> SRR2082495 1 0.000 0.999 1.000 0.000
#> SRR2082496 1 0.000 0.999 1.000 0.000
#> SRR2082493 1 0.000 0.999 1.000 0.000
#> SRR2082494 1 0.000 0.999 1.000 0.000
#> SRR2082491 1 0.000 0.999 1.000 0.000
#> SRR2082492 1 0.000 0.999 1.000 0.000
#> SRR2082489 1 0.000 0.999 1.000 0.000
#> SRR2082490 1 0.000 0.999 1.000 0.000
#> SRR2082497 1 0.000 0.999 1.000 0.000
#> SRR2082498 1 0.000 0.999 1.000 0.000
#> SRR2082487 1 0.000 0.999 1.000 0.000
#> SRR2082488 1 0.000 0.999 1.000 0.000
#> SRR2082485 1 0.000 0.999 1.000 0.000
#> SRR2082486 1 0.000 0.999 1.000 0.000
#> SRR2082479 1 0.000 0.999 1.000 0.000
#> SRR2082480 1 0.000 0.999 1.000 0.000
#> SRR2082483 1 0.000 0.999 1.000 0.000
#> SRR2082484 1 0.000 0.999 1.000 0.000
#> SRR2082481 1 0.000 0.999 1.000 0.000
#> SRR2082482 1 0.000 0.999 1.000 0.000
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> SRR2082532 2 0.0000 0.984 0.000 1.000 0.000
#> SRR2082533 2 0.0000 0.984 0.000 1.000 0.000
#> SRR2082534 2 0.0000 0.984 0.000 1.000 0.000
#> SRR2082535 2 0.0000 0.984 0.000 1.000 0.000
#> SRR2082536 2 0.0000 0.984 0.000 1.000 0.000
#> SRR2082530 2 0.0592 0.980 0.000 0.988 0.012
#> SRR2082531 2 0.0592 0.980 0.000 0.988 0.012
#> SRR2082528 2 0.0000 0.984 0.000 1.000 0.000
#> SRR2082529 2 0.0000 0.984 0.000 1.000 0.000
#> SRR2082526 2 0.1964 0.955 0.000 0.944 0.056
#> SRR2082527 2 0.1964 0.955 0.000 0.944 0.056
#> SRR2082521 2 0.0237 0.983 0.000 0.996 0.004
#> SRR2082520 2 0.0000 0.984 0.000 1.000 0.000
#> SRR2082518 2 0.2066 0.952 0.000 0.940 0.060
#> SRR2082523 2 0.0000 0.984 0.000 1.000 0.000
#> SRR2082524 2 0.0237 0.983 0.000 0.996 0.004
#> SRR2082525 2 0.1964 0.955 0.000 0.944 0.056
#> SRR2082522 2 0.0000 0.984 0.000 1.000 0.000
#> SRR2082519 2 0.0000 0.984 0.000 1.000 0.000
#> SRR2082513 2 0.0892 0.977 0.000 0.980 0.020
#> SRR2082512 2 0.3192 0.903 0.000 0.888 0.112
#> SRR2082516 2 0.0000 0.984 0.000 1.000 0.000
#> SRR2082515 2 0.0000 0.984 0.000 1.000 0.000
#> SRR2082517 2 0.1163 0.973 0.000 0.972 0.028
#> SRR2082514 2 0.0000 0.984 0.000 1.000 0.000
#> SRR2082508 1 0.0000 0.994 1.000 0.000 0.000
#> SRR2082509 1 0.0000 0.994 1.000 0.000 0.000
#> SRR2082507 1 0.0000 0.994 1.000 0.000 0.000
#> SRR2082510 3 0.0892 0.855 0.020 0.000 0.980
#> SRR2082511 3 0.6062 0.382 0.384 0.000 0.616
#> SRR2082501 1 0.0000 0.994 1.000 0.000 0.000
#> SRR2082502 1 0.0000 0.994 1.000 0.000 0.000
#> SRR2082499 1 0.0000 0.994 1.000 0.000 0.000
#> SRR2082500 1 0.0000 0.994 1.000 0.000 0.000
#> SRR2082503 1 0.0237 0.991 0.996 0.000 0.004
#> SRR2082505 1 0.0000 0.994 1.000 0.000 0.000
#> SRR2082506 1 0.0000 0.994 1.000 0.000 0.000
#> SRR2082504 1 0.0000 0.994 1.000 0.000 0.000
#> SRR2082495 1 0.0000 0.994 1.000 0.000 0.000
#> SRR2082496 1 0.0000 0.994 1.000 0.000 0.000
#> SRR2082493 1 0.1163 0.969 0.972 0.000 0.028
#> SRR2082494 1 0.0747 0.980 0.984 0.000 0.016
#> SRR2082491 1 0.0000 0.994 1.000 0.000 0.000
#> SRR2082492 1 0.0000 0.994 1.000 0.000 0.000
#> SRR2082489 1 0.0000 0.994 1.000 0.000 0.000
#> SRR2082490 1 0.0000 0.994 1.000 0.000 0.000
#> SRR2082497 1 0.0000 0.994 1.000 0.000 0.000
#> SRR2082498 1 0.0000 0.994 1.000 0.000 0.000
#> SRR2082487 1 0.0000 0.994 1.000 0.000 0.000
#> SRR2082488 1 0.0000 0.994 1.000 0.000 0.000
#> SRR2082485 1 0.1860 0.943 0.948 0.000 0.052
#> SRR2082486 1 0.1860 0.943 0.948 0.000 0.052
#> SRR2082479 1 0.0000 0.994 1.000 0.000 0.000
#> SRR2082480 1 0.0000 0.994 1.000 0.000 0.000
#> SRR2082483 3 0.0424 0.855 0.008 0.000 0.992
#> SRR2082484 3 0.0424 0.855 0.008 0.000 0.992
#> SRR2082481 1 0.0000 0.994 1.000 0.000 0.000
#> SRR2082482 1 0.0000 0.994 1.000 0.000 0.000
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> SRR2082532 2 0.0188 0.975 0.000 0.996 0.000 NA
#> SRR2082533 2 0.0188 0.975 0.000 0.996 0.000 NA
#> SRR2082534 2 0.0000 0.975 0.000 1.000 0.000 NA
#> SRR2082535 2 0.0000 0.975 0.000 1.000 0.000 NA
#> SRR2082536 2 0.0000 0.975 0.000 1.000 0.000 NA
#> SRR2082530 2 0.0592 0.974 0.000 0.984 0.000 NA
#> SRR2082531 2 0.0592 0.974 0.000 0.984 0.000 NA
#> SRR2082528 2 0.0000 0.975 0.000 1.000 0.000 NA
#> SRR2082529 2 0.0000 0.975 0.000 1.000 0.000 NA
#> SRR2082526 2 0.1356 0.968 0.000 0.960 0.008 NA
#> SRR2082527 2 0.1356 0.968 0.000 0.960 0.008 NA
#> SRR2082521 2 0.0592 0.974 0.000 0.984 0.000 NA
#> SRR2082520 2 0.1474 0.959 0.000 0.948 0.000 NA
#> SRR2082518 2 0.2844 0.926 0.000 0.900 0.048 NA
#> SRR2082523 2 0.0469 0.974 0.000 0.988 0.000 NA
#> SRR2082524 2 0.0469 0.974 0.000 0.988 0.000 NA
#> SRR2082525 2 0.1356 0.968 0.000 0.960 0.008 NA
#> SRR2082522 2 0.1118 0.966 0.000 0.964 0.000 NA
#> SRR2082519 2 0.1118 0.966 0.000 0.964 0.000 NA
#> SRR2082513 2 0.0895 0.973 0.000 0.976 0.004 NA
#> SRR2082512 2 0.4139 0.826 0.000 0.816 0.144 NA
#> SRR2082516 2 0.0336 0.974 0.000 0.992 0.000 NA
#> SRR2082515 2 0.1389 0.961 0.000 0.952 0.000 NA
#> SRR2082517 2 0.1489 0.963 0.000 0.952 0.004 NA
#> SRR2082514 2 0.0000 0.975 0.000 1.000 0.000 NA
#> SRR2082508 1 0.3172 0.836 0.840 0.000 0.000 NA
#> SRR2082509 1 0.0707 0.916 0.980 0.000 0.000 NA
#> SRR2082507 1 0.3975 0.754 0.760 0.000 0.000 NA
#> SRR2082510 3 0.1388 0.918 0.012 0.000 0.960 NA
#> SRR2082511 3 0.3528 0.752 0.192 0.000 0.808 NA
#> SRR2082501 1 0.0895 0.916 0.976 0.000 0.004 NA
#> SRR2082502 1 0.0895 0.916 0.976 0.000 0.004 NA
#> SRR2082499 1 0.1733 0.912 0.948 0.000 0.024 NA
#> SRR2082500 1 0.1624 0.913 0.952 0.000 0.020 NA
#> SRR2082503 1 0.6298 0.534 0.632 0.000 0.268 NA
#> SRR2082505 1 0.2401 0.884 0.904 0.000 0.004 NA
#> SRR2082506 1 0.2345 0.882 0.900 0.000 0.000 NA
#> SRR2082504 1 0.2197 0.891 0.916 0.000 0.004 NA
#> SRR2082495 1 0.1975 0.894 0.936 0.000 0.016 NA
#> SRR2082496 1 0.1975 0.894 0.936 0.000 0.016 NA
#> SRR2082493 1 0.6097 0.323 0.580 0.000 0.364 NA
#> SRR2082494 1 0.5773 0.446 0.632 0.000 0.320 NA
#> SRR2082491 1 0.0524 0.916 0.988 0.000 0.008 NA
#> SRR2082492 1 0.0524 0.916 0.988 0.000 0.008 NA
#> SRR2082489 1 0.0000 0.917 1.000 0.000 0.000 NA
#> SRR2082490 1 0.0000 0.917 1.000 0.000 0.000 NA
#> SRR2082497 1 0.1211 0.911 0.960 0.000 0.000 NA
#> SRR2082498 1 0.1398 0.911 0.956 0.000 0.004 NA
#> SRR2082487 1 0.0188 0.917 0.996 0.000 0.004 NA
#> SRR2082488 1 0.0188 0.917 0.996 0.000 0.004 NA
#> SRR2082485 1 0.1733 0.903 0.948 0.000 0.024 NA
#> SRR2082486 1 0.1406 0.908 0.960 0.000 0.016 NA
#> SRR2082479 1 0.0469 0.917 0.988 0.000 0.012 NA
#> SRR2082480 1 0.0336 0.918 0.992 0.000 0.008 NA
#> SRR2082483 3 0.0469 0.922 0.000 0.000 0.988 NA
#> SRR2082484 3 0.0469 0.922 0.000 0.000 0.988 NA
#> SRR2082481 1 0.0188 0.918 0.996 0.000 0.004 NA
#> SRR2082482 1 0.0188 0.918 0.996 0.000 0.004 NA
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> SRR2082532 2 0.1041 0.9206 0.000 0.964 0.000 0.004 NA
#> SRR2082533 2 0.1041 0.9206 0.000 0.964 0.000 0.004 NA
#> SRR2082534 2 0.1251 0.9221 0.000 0.956 0.000 0.008 NA
#> SRR2082535 2 0.1251 0.9221 0.000 0.956 0.000 0.008 NA
#> SRR2082536 2 0.1522 0.9183 0.000 0.944 0.000 0.012 NA
#> SRR2082530 2 0.1300 0.9251 0.000 0.956 0.000 0.016 NA
#> SRR2082531 2 0.1300 0.9251 0.000 0.956 0.000 0.016 NA
#> SRR2082528 2 0.1522 0.9183 0.000 0.944 0.000 0.012 NA
#> SRR2082529 2 0.1522 0.9183 0.000 0.944 0.000 0.012 NA
#> SRR2082526 2 0.3191 0.8995 0.000 0.864 0.024 0.020 NA
#> SRR2082527 2 0.3191 0.8995 0.000 0.864 0.024 0.020 NA
#> SRR2082521 2 0.1701 0.9239 0.000 0.936 0.000 0.016 NA
#> SRR2082520 2 0.3798 0.8860 0.000 0.824 0.008 0.068 NA
#> SRR2082518 2 0.4063 0.8788 0.000 0.812 0.056 0.020 NA
#> SRR2082523 2 0.1281 0.9212 0.000 0.956 0.000 0.012 NA
#> SRR2082524 2 0.1281 0.9212 0.000 0.956 0.000 0.012 NA
#> SRR2082525 2 0.3191 0.8995 0.000 0.864 0.024 0.020 NA
#> SRR2082522 2 0.2916 0.9110 0.000 0.880 0.008 0.040 NA
#> SRR2082519 2 0.3076 0.9066 0.000 0.868 0.008 0.036 NA
#> SRR2082513 2 0.2378 0.9197 0.000 0.908 0.012 0.016 NA
#> SRR2082512 2 0.5456 0.7440 0.000 0.692 0.172 0.016 NA
#> SRR2082516 2 0.2209 0.9161 0.000 0.912 0.000 0.032 NA
#> SRR2082515 2 0.3536 0.8941 0.000 0.840 0.008 0.052 NA
#> SRR2082517 2 0.3321 0.9012 0.000 0.856 0.012 0.040 NA
#> SRR2082514 2 0.1965 0.9208 0.000 0.924 0.000 0.024 NA
#> SRR2082508 1 0.4182 -0.4144 0.600 0.000 0.000 0.400 NA
#> SRR2082509 1 0.1121 0.6661 0.956 0.000 0.000 0.044 NA
#> SRR2082507 4 0.4341 0.0000 0.404 0.000 0.000 0.592 NA
#> SRR2082510 3 0.2520 0.8637 0.012 0.004 0.888 0.000 NA
#> SRR2082511 3 0.3868 0.7298 0.140 0.000 0.800 0.000 NA
#> SRR2082501 1 0.3666 0.6236 0.824 0.000 0.012 0.032 NA
#> SRR2082502 1 0.3510 0.6288 0.832 0.000 0.008 0.032 NA
#> SRR2082499 1 0.4268 0.5789 0.768 0.000 0.012 0.036 NA
#> SRR2082500 1 0.4191 0.5822 0.772 0.000 0.012 0.032 NA
#> SRR2082503 1 0.7197 -0.3887 0.428 0.000 0.332 0.212 NA
#> SRR2082505 1 0.3167 0.5262 0.820 0.000 0.004 0.172 NA
#> SRR2082506 1 0.3336 0.3749 0.772 0.000 0.000 0.228 NA
#> SRR2082504 1 0.3088 0.5429 0.828 0.000 0.004 0.164 NA
#> SRR2082495 1 0.4371 0.3527 0.644 0.000 0.012 0.000 NA
#> SRR2082496 1 0.4538 0.3158 0.620 0.000 0.016 0.000 NA
#> SRR2082493 1 0.6645 -0.1079 0.400 0.000 0.224 0.000 NA
#> SRR2082494 1 0.6589 -0.0787 0.424 0.000 0.212 0.000 NA
#> SRR2082491 1 0.1671 0.6735 0.924 0.000 0.000 0.000 NA
#> SRR2082492 1 0.1544 0.6760 0.932 0.000 0.000 0.000 NA
#> SRR2082489 1 0.0290 0.6812 0.992 0.000 0.000 0.008 NA
#> SRR2082490 1 0.0290 0.6812 0.992 0.000 0.000 0.008 NA
#> SRR2082497 1 0.2673 0.6514 0.892 0.000 0.004 0.060 NA
#> SRR2082498 1 0.2673 0.6514 0.892 0.000 0.004 0.060 NA
#> SRR2082487 1 0.0290 0.6812 0.992 0.000 0.000 0.008 NA
#> SRR2082488 1 0.0290 0.6812 0.992 0.000 0.000 0.008 NA
#> SRR2082485 1 0.3690 0.5849 0.832 0.000 0.068 0.008 NA
#> SRR2082486 1 0.3572 0.5933 0.840 0.000 0.064 0.008 NA
#> SRR2082479 1 0.1885 0.6695 0.936 0.000 0.012 0.020 NA
#> SRR2082480 1 0.1967 0.6675 0.932 0.000 0.012 0.020 NA
#> SRR2082483 3 0.0162 0.8803 0.000 0.004 0.996 0.000 NA
#> SRR2082484 3 0.0162 0.8806 0.000 0.000 0.996 0.004 NA
#> SRR2082481 1 0.1653 0.6731 0.944 0.000 0.004 0.024 NA
#> SRR2082482 1 0.1653 0.6731 0.944 0.000 0.004 0.024 NA
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> SRR2082532 2 0.3774 0.790 0.000 0.592 0.000 0.408 NA 0.000
#> SRR2082533 2 0.3765 0.792 0.000 0.596 0.000 0.404 NA 0.000
#> SRR2082534 2 0.3881 0.793 0.000 0.600 0.000 0.396 NA 0.000
#> SRR2082535 2 0.3881 0.793 0.000 0.600 0.000 0.396 NA 0.000
#> SRR2082536 2 0.3923 0.783 0.000 0.580 0.000 0.416 NA 0.000
#> SRR2082530 2 0.3373 0.816 0.000 0.744 0.000 0.248 NA 0.000
#> SRR2082531 2 0.3373 0.816 0.000 0.744 0.000 0.248 NA 0.000
#> SRR2082528 2 0.3915 0.785 0.000 0.584 0.000 0.412 NA 0.000
#> SRR2082529 2 0.3923 0.783 0.000 0.580 0.000 0.416 NA 0.000
#> SRR2082526 2 0.3783 0.801 0.000 0.728 0.008 0.252 NA 0.004
#> SRR2082527 2 0.3842 0.801 0.000 0.732 0.008 0.244 NA 0.008
#> SRR2082521 2 0.1863 0.805 0.000 0.896 0.000 0.104 NA 0.000
#> SRR2082520 2 0.1138 0.775 0.000 0.960 0.000 0.012 NA 0.004
#> SRR2082518 2 0.3060 0.746 0.000 0.864 0.012 0.060 NA 0.056
#> SRR2082523 2 0.3765 0.794 0.000 0.596 0.000 0.404 NA 0.000
#> SRR2082524 2 0.3747 0.796 0.000 0.604 0.000 0.396 NA 0.000
#> SRR2082525 2 0.3783 0.801 0.000 0.728 0.008 0.252 NA 0.004
#> SRR2082522 2 0.0937 0.795 0.000 0.960 0.000 0.040 NA 0.000
#> SRR2082519 2 0.0508 0.782 0.000 0.984 0.004 0.012 NA 0.000
#> SRR2082513 2 0.1606 0.796 0.000 0.932 0.008 0.056 NA 0.004
#> SRR2082512 2 0.3350 0.678 0.000 0.828 0.008 0.040 NA 0.120
#> SRR2082516 2 0.2520 0.808 0.000 0.844 0.004 0.152 NA 0.000
#> SRR2082515 2 0.0964 0.777 0.000 0.968 0.000 0.012 NA 0.004
#> SRR2082517 2 0.1088 0.774 0.000 0.960 0.000 0.016 NA 0.024
#> SRR2082514 2 0.1297 0.793 0.000 0.948 0.012 0.040 NA 0.000
#> SRR2082508 1 0.6255 -0.750 0.412 0.000 0.008 0.308 NA 0.000
#> SRR2082509 1 0.1448 0.605 0.948 0.000 0.024 0.012 NA 0.000
#> SRR2082507 4 0.6313 0.000 0.288 0.000 0.008 0.372 NA 0.000
#> SRR2082510 6 0.2454 0.706 0.008 0.000 0.088 0.000 NA 0.884
#> SRR2082511 6 0.3818 0.626 0.120 0.000 0.064 0.004 NA 0.800
#> SRR2082501 1 0.5236 0.416 0.652 0.000 0.244 0.076 NA 0.012
#> SRR2082502 1 0.5258 0.412 0.648 0.000 0.248 0.076 NA 0.012
#> SRR2082499 1 0.6165 0.194 0.532 0.000 0.332 0.076 NA 0.040
#> SRR2082500 1 0.6130 0.217 0.532 0.000 0.332 0.084 NA 0.032
#> SRR2082503 6 0.8066 -0.300 0.296 0.000 0.064 0.176 NA 0.360
#> SRR2082505 1 0.4239 0.434 0.764 0.000 0.016 0.148 NA 0.004
#> SRR2082506 1 0.4976 0.148 0.664 0.000 0.008 0.208 NA 0.000
#> SRR2082504 1 0.3609 0.511 0.812 0.000 0.016 0.116 NA 0.000
#> SRR2082495 3 0.4962 0.742 0.416 0.000 0.516 0.000 NA 0.068
#> SRR2082496 3 0.5058 0.772 0.392 0.000 0.536 0.004 NA 0.068
#> SRR2082493 3 0.5602 0.786 0.264 0.000 0.540 0.000 NA 0.196
#> SRR2082494 3 0.5578 0.808 0.276 0.000 0.540 0.000 NA 0.184
#> SRR2082491 1 0.3835 0.120 0.684 0.000 0.300 0.000 NA 0.016
#> SRR2082492 1 0.3797 0.151 0.692 0.000 0.292 0.000 NA 0.016
#> SRR2082489 1 0.1930 0.578 0.916 0.000 0.048 0.000 NA 0.000
#> SRR2082490 1 0.1930 0.578 0.916 0.000 0.048 0.000 NA 0.000
#> SRR2082497 1 0.4616 0.538 0.752 0.000 0.120 0.092 NA 0.008
#> SRR2082498 1 0.4662 0.534 0.748 0.000 0.120 0.096 NA 0.008
#> SRR2082487 1 0.2822 0.549 0.864 0.000 0.076 0.000 NA 0.004
#> SRR2082488 1 0.2882 0.549 0.860 0.000 0.076 0.000 NA 0.004
#> SRR2082485 1 0.5699 0.210 0.648 0.000 0.140 0.000 NA 0.140
#> SRR2082486 1 0.5764 0.181 0.640 0.000 0.136 0.000 NA 0.152
#> SRR2082479 1 0.2813 0.591 0.880 0.000 0.052 0.004 NA 0.020
#> SRR2082480 1 0.2941 0.589 0.872 0.000 0.056 0.004 NA 0.020
#> SRR2082483 6 0.0000 0.718 0.000 0.000 0.000 0.000 NA 1.000
#> SRR2082484 6 0.0000 0.718 0.000 0.000 0.000 0.000 NA 1.000
#> SRR2082481 1 0.2732 0.588 0.880 0.000 0.056 0.000 NA 0.020
#> SRR2082482 1 0.2706 0.589 0.880 0.000 0.060 0.000 NA 0.016
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 14581 rows and 58 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 3.
#>
#> Following methods can be applied to this 'ConsensusPartition' object:
#> [1] "cola_report" "collect_classes" "collect_plots"
#> [4] "collect_stats" "colnames" "compare_signatures"
#> [7] "consensus_heatmap" "dimension_reduction" "functional_enrichment"
#> [10] "get_anno_col" "get_anno" "get_classes"
#> [13] "get_consensus" "get_matrix" "get_membership"
#> [16] "get_param" "get_signatures" "get_stats"
#> [19] "is_best_k" "is_stable_k" "membership_heatmap"
#> [22] "ncol" "nrow" "plot_ecdf"
#> [25] "rownames" "select_partition_number" "show"
#> [28] "suggest_best_k" "test_to_known_factors"
collect_plots()
function collects all the plots made from res
for all k
(number of partitions)
into one single page to provide an easy and fast comparison between different k
.
collect_plots(res)
The plots are:
k
and the heatmap of
predicted classes for each k
.k
.k
.k
.All the plots in panels can be made by individual functions and they are plotted later in this section.
select_partition_number()
produces several plots showing different
statistics for choosing “optimized” k
. There are following statistics:
k
;k
, the area increased is defined as \(A_k - A_{k-1}\).The detailed explanations of these statistics can be found in the cola vignette.
Generally speaking, lower PAC score, higher mean silhouette score or higher
concordance corresponds to better partition. Rand index and Jaccard index
measure how similar the current partition is compared to partition with k-1
.
If they are too similar, we won't accept k
is better than k-1
.
select_partition_number(res)
The numeric values for all these statistics can be obtained by get_stats()
.
get_stats(res)
#> k 1-PAC mean_silhouette concordance area_increased Rand Jaccard
#> 2 2 1.000 1.000 1.000 0.4996 0.501 0.501
#> 3 3 1.000 0.979 0.988 0.1805 0.907 0.814
#> 4 4 0.794 0.883 0.930 0.0777 0.994 0.985
#> 5 5 0.803 0.686 0.894 0.0482 0.981 0.952
#> 6 6 0.742 0.718 0.860 0.0393 0.962 0.902
suggest_best_k()
suggests the best \(k\) based on these statistics. The rules are as follows:
suggest_best_k(res)
#> [1] 3
#> attr(,"optional")
#> [1] 2
There is also optional best \(k\) = 2 that is worth to check.
Following shows the table of the partitions (You need to click the show/hide
code output link to see it). The membership matrix (columns with name p*
)
is inferred by
clue::cl_consensus()
function with the SE
method. Basically the value in the membership matrix
represents the probability to belong to a certain group. The finall class
label for an item is determined with the group with highest probability it
belongs to.
In get_classes()
function, the entropy is calculated from the membership
matrix and the silhouette score is calculated from the consensus matrix.
cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#> class entropy silhouette p1 p2
#> SRR2082532 2 0 1 0 1
#> SRR2082533 2 0 1 0 1
#> SRR2082534 2 0 1 0 1
#> SRR2082535 2 0 1 0 1
#> SRR2082536 2 0 1 0 1
#> SRR2082530 2 0 1 0 1
#> SRR2082531 2 0 1 0 1
#> SRR2082528 2 0 1 0 1
#> SRR2082529 2 0 1 0 1
#> SRR2082526 2 0 1 0 1
#> SRR2082527 2 0 1 0 1
#> SRR2082521 2 0 1 0 1
#> SRR2082520 2 0 1 0 1
#> SRR2082518 2 0 1 0 1
#> SRR2082523 2 0 1 0 1
#> SRR2082524 2 0 1 0 1
#> SRR2082525 2 0 1 0 1
#> SRR2082522 2 0 1 0 1
#> SRR2082519 2 0 1 0 1
#> SRR2082513 2 0 1 0 1
#> SRR2082512 2 0 1 0 1
#> SRR2082516 2 0 1 0 1
#> SRR2082515 2 0 1 0 1
#> SRR2082517 2 0 1 0 1
#> SRR2082514 2 0 1 0 1
#> SRR2082508 1 0 1 1 0
#> SRR2082509 1 0 1 1 0
#> SRR2082507 1 0 1 1 0
#> SRR2082510 1 0 1 1 0
#> SRR2082511 1 0 1 1 0
#> SRR2082501 1 0 1 1 0
#> SRR2082502 1 0 1 1 0
#> SRR2082499 1 0 1 1 0
#> SRR2082500 1 0 1 1 0
#> SRR2082503 1 0 1 1 0
#> SRR2082505 1 0 1 1 0
#> SRR2082506 1 0 1 1 0
#> SRR2082504 1 0 1 1 0
#> SRR2082495 1 0 1 1 0
#> SRR2082496 1 0 1 1 0
#> SRR2082493 1 0 1 1 0
#> SRR2082494 1 0 1 1 0
#> SRR2082491 1 0 1 1 0
#> SRR2082492 1 0 1 1 0
#> SRR2082489 1 0 1 1 0
#> SRR2082490 1 0 1 1 0
#> SRR2082497 1 0 1 1 0
#> SRR2082498 1 0 1 1 0
#> SRR2082487 1 0 1 1 0
#> SRR2082488 1 0 1 1 0
#> SRR2082485 1 0 1 1 0
#> SRR2082486 1 0 1 1 0
#> SRR2082479 1 0 1 1 0
#> SRR2082480 1 0 1 1 0
#> SRR2082483 1 0 1 1 0
#> SRR2082484 1 0 1 1 0
#> SRR2082481 1 0 1 1 0
#> SRR2082482 1 0 1 1 0
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> SRR2082532 3 0.288 0.909 0 0.096 0.904
#> SRR2082533 3 0.288 0.909 0 0.096 0.904
#> SRR2082534 3 0.000 0.927 0 0.000 1.000
#> SRR2082535 3 0.000 0.927 0 0.000 1.000
#> SRR2082536 3 0.000 0.927 0 0.000 1.000
#> SRR2082530 2 0.000 1.000 0 1.000 0.000
#> SRR2082531 2 0.000 1.000 0 1.000 0.000
#> SRR2082528 3 0.000 0.927 0 0.000 1.000
#> SRR2082529 3 0.000 0.927 0 0.000 1.000
#> SRR2082526 2 0.000 1.000 0 1.000 0.000
#> SRR2082527 2 0.000 1.000 0 1.000 0.000
#> SRR2082521 2 0.000 1.000 0 1.000 0.000
#> SRR2082520 3 0.000 0.927 0 0.000 1.000
#> SRR2082518 2 0.000 1.000 0 1.000 0.000
#> SRR2082523 2 0.000 1.000 0 1.000 0.000
#> SRR2082524 2 0.000 1.000 0 1.000 0.000
#> SRR2082525 2 0.000 1.000 0 1.000 0.000
#> SRR2082522 3 0.579 0.581 0 0.332 0.668
#> SRR2082519 2 0.000 1.000 0 1.000 0.000
#> SRR2082513 2 0.000 1.000 0 1.000 0.000
#> SRR2082512 2 0.000 1.000 0 1.000 0.000
#> SRR2082516 3 0.288 0.909 0 0.096 0.904
#> SRR2082515 2 0.000 1.000 0 1.000 0.000
#> SRR2082517 2 0.000 1.000 0 1.000 0.000
#> SRR2082514 3 0.288 0.909 0 0.096 0.904
#> SRR2082508 1 0.000 1.000 1 0.000 0.000
#> SRR2082509 1 0.000 1.000 1 0.000 0.000
#> SRR2082507 1 0.000 1.000 1 0.000 0.000
#> SRR2082510 1 0.000 1.000 1 0.000 0.000
#> SRR2082511 1 0.000 1.000 1 0.000 0.000
#> SRR2082501 1 0.000 1.000 1 0.000 0.000
#> SRR2082502 1 0.000 1.000 1 0.000 0.000
#> SRR2082499 1 0.000 1.000 1 0.000 0.000
#> SRR2082500 1 0.000 1.000 1 0.000 0.000
#> SRR2082503 1 0.000 1.000 1 0.000 0.000
#> SRR2082505 1 0.000 1.000 1 0.000 0.000
#> SRR2082506 1 0.000 1.000 1 0.000 0.000
#> SRR2082504 1 0.000 1.000 1 0.000 0.000
#> SRR2082495 1 0.000 1.000 1 0.000 0.000
#> SRR2082496 1 0.000 1.000 1 0.000 0.000
#> SRR2082493 1 0.000 1.000 1 0.000 0.000
#> SRR2082494 1 0.000 1.000 1 0.000 0.000
#> SRR2082491 1 0.000 1.000 1 0.000 0.000
#> SRR2082492 1 0.000 1.000 1 0.000 0.000
#> SRR2082489 1 0.000 1.000 1 0.000 0.000
#> SRR2082490 1 0.000 1.000 1 0.000 0.000
#> SRR2082497 1 0.000 1.000 1 0.000 0.000
#> SRR2082498 1 0.000 1.000 1 0.000 0.000
#> SRR2082487 1 0.000 1.000 1 0.000 0.000
#> SRR2082488 1 0.000 1.000 1 0.000 0.000
#> SRR2082485 1 0.000 1.000 1 0.000 0.000
#> SRR2082486 1 0.000 1.000 1 0.000 0.000
#> SRR2082479 1 0.000 1.000 1 0.000 0.000
#> SRR2082480 1 0.000 1.000 1 0.000 0.000
#> SRR2082483 1 0.000 1.000 1 0.000 0.000
#> SRR2082484 1 0.000 1.000 1 0.000 0.000
#> SRR2082481 1 0.000 1.000 1 0.000 0.000
#> SRR2082482 1 0.000 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
#> SRR2082532 4 0.2345 0.860 0.000 0.000 0.100 0.900
#> SRR2082533 4 0.2345 0.860 0.000 0.000 0.100 0.900
#> SRR2082534 4 0.0000 0.911 0.000 0.000 0.000 1.000
#> SRR2082535 4 0.0000 0.911 0.000 0.000 0.000 1.000
#> SRR2082536 4 0.0000 0.911 0.000 0.000 0.000 1.000
#> SRR2082530 2 0.0000 0.956 0.000 1.000 0.000 0.000
#> SRR2082531 2 0.0000 0.956 0.000 1.000 0.000 0.000
#> SRR2082528 4 0.0000 0.911 0.000 0.000 0.000 1.000
#> SRR2082529 4 0.0000 0.911 0.000 0.000 0.000 1.000
#> SRR2082526 2 0.0000 0.956 0.000 1.000 0.000 0.000
#> SRR2082527 2 0.0000 0.956 0.000 1.000 0.000 0.000
#> SRR2082521 2 0.0000 0.956 0.000 1.000 0.000 0.000
#> SRR2082520 4 0.0469 0.900 0.000 0.000 0.012 0.988
#> SRR2082518 2 0.0000 0.956 0.000 1.000 0.000 0.000
#> SRR2082523 2 0.0000 0.956 0.000 1.000 0.000 0.000
#> SRR2082524 2 0.0000 0.956 0.000 1.000 0.000 0.000
#> SRR2082525 2 0.0000 0.956 0.000 1.000 0.000 0.000
#> SRR2082522 3 0.4761 0.000 0.000 0.000 0.628 0.372
#> SRR2082519 2 0.3444 0.816 0.000 0.816 0.184 0.000
#> SRR2082513 2 0.0000 0.956 0.000 1.000 0.000 0.000
#> SRR2082512 2 0.0000 0.956 0.000 1.000 0.000 0.000
#> SRR2082516 4 0.2345 0.860 0.000 0.000 0.100 0.900
#> SRR2082515 2 0.3444 0.816 0.000 0.816 0.184 0.000
#> SRR2082517 2 0.3444 0.816 0.000 0.816 0.184 0.000
#> SRR2082514 4 0.2345 0.860 0.000 0.000 0.100 0.900
#> SRR2082508 1 0.0000 0.927 1.000 0.000 0.000 0.000
#> SRR2082509 1 0.2814 0.881 0.868 0.000 0.132 0.000
#> SRR2082507 1 0.3266 0.864 0.832 0.000 0.168 0.000
#> SRR2082510 1 0.4761 0.660 0.628 0.000 0.372 0.000
#> SRR2082511 1 0.2814 0.881 0.868 0.000 0.132 0.000
#> SRR2082501 1 0.0000 0.927 1.000 0.000 0.000 0.000
#> SRR2082502 1 0.0000 0.927 1.000 0.000 0.000 0.000
#> SRR2082499 1 0.0000 0.927 1.000 0.000 0.000 0.000
#> SRR2082500 1 0.0000 0.927 1.000 0.000 0.000 0.000
#> SRR2082503 1 0.3219 0.866 0.836 0.000 0.164 0.000
#> SRR2082505 1 0.0000 0.927 1.000 0.000 0.000 0.000
#> SRR2082506 1 0.0000 0.927 1.000 0.000 0.000 0.000
#> SRR2082504 1 0.0000 0.927 1.000 0.000 0.000 0.000
#> SRR2082495 1 0.3311 0.862 0.828 0.000 0.172 0.000
#> SRR2082496 1 0.3311 0.862 0.828 0.000 0.172 0.000
#> SRR2082493 1 0.3311 0.862 0.828 0.000 0.172 0.000
#> SRR2082494 1 0.3311 0.862 0.828 0.000 0.172 0.000
#> SRR2082491 1 0.3311 0.862 0.828 0.000 0.172 0.000
#> SRR2082492 1 0.3311 0.862 0.828 0.000 0.172 0.000
#> SRR2082489 1 0.0000 0.927 1.000 0.000 0.000 0.000
#> SRR2082490 1 0.0000 0.927 1.000 0.000 0.000 0.000
#> SRR2082497 1 0.0000 0.927 1.000 0.000 0.000 0.000
#> SRR2082498 1 0.0000 0.927 1.000 0.000 0.000 0.000
#> SRR2082487 1 0.0000 0.927 1.000 0.000 0.000 0.000
#> SRR2082488 1 0.0000 0.927 1.000 0.000 0.000 0.000
#> SRR2082485 1 0.0188 0.925 0.996 0.000 0.004 0.000
#> SRR2082486 1 0.0188 0.925 0.996 0.000 0.004 0.000
#> SRR2082479 1 0.0000 0.927 1.000 0.000 0.000 0.000
#> SRR2082480 1 0.0000 0.927 1.000 0.000 0.000 0.000
#> SRR2082483 1 0.3649 0.759 0.796 0.000 0.204 0.000
#> SRR2082484 1 0.3649 0.759 0.796 0.000 0.204 0.000
#> SRR2082481 1 0.0000 0.927 1.000 0.000 0.000 0.000
#> SRR2082482 1 0.0000 0.927 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
#> SRR2082532 4 0.418 0.668 0.000 0.000 0.000 0.60 0.40
#> SRR2082533 4 0.418 0.668 0.000 0.000 0.000 0.60 0.40
#> SRR2082534 4 0.000 0.764 0.000 0.000 0.000 1.00 0.00
#> SRR2082535 4 0.000 0.764 0.000 0.000 0.000 1.00 0.00
#> SRR2082536 4 0.000 0.764 0.000 0.000 0.000 1.00 0.00
#> SRR2082530 2 0.000 0.955 0.000 1.000 0.000 0.00 0.00
#> SRR2082531 2 0.000 0.955 0.000 1.000 0.000 0.00 0.00
#> SRR2082528 4 0.000 0.764 0.000 0.000 0.000 1.00 0.00
#> SRR2082529 4 0.000 0.764 0.000 0.000 0.000 1.00 0.00
#> SRR2082526 2 0.000 0.955 0.000 1.000 0.000 0.00 0.00
#> SRR2082527 2 0.000 0.955 0.000 1.000 0.000 0.00 0.00
#> SRR2082521 2 0.000 0.955 0.000 1.000 0.000 0.00 0.00
#> SRR2082520 4 0.356 0.447 0.000 0.000 0.000 0.74 0.26
#> SRR2082518 2 0.000 0.955 0.000 1.000 0.000 0.00 0.00
#> SRR2082523 2 0.000 0.955 0.000 1.000 0.000 0.00 0.00
#> SRR2082524 2 0.000 0.955 0.000 1.000 0.000 0.00 0.00
#> SRR2082525 2 0.000 0.955 0.000 1.000 0.000 0.00 0.00
#> SRR2082522 5 0.418 0.000 0.000 0.000 0.400 0.00 0.60
#> SRR2082519 2 0.297 0.810 0.000 0.816 0.184 0.00 0.00
#> SRR2082513 2 0.000 0.955 0.000 1.000 0.000 0.00 0.00
#> SRR2082512 2 0.000 0.955 0.000 1.000 0.000 0.00 0.00
#> SRR2082516 4 0.418 0.668 0.000 0.000 0.000 0.60 0.40
#> SRR2082515 2 0.297 0.810 0.000 0.816 0.184 0.00 0.00
#> SRR2082517 2 0.297 0.810 0.000 0.816 0.184 0.00 0.00
#> SRR2082514 4 0.418 0.668 0.000 0.000 0.000 0.60 0.40
#> SRR2082508 1 0.000 0.796 1.000 0.000 0.000 0.00 0.00
#> SRR2082509 1 0.334 0.528 0.772 0.000 0.228 0.00 0.00
#> SRR2082507 1 0.311 0.561 0.800 0.000 0.200 0.00 0.00
#> SRR2082510 3 0.418 0.000 0.400 0.000 0.600 0.00 0.00
#> SRR2082511 1 0.334 0.528 0.772 0.000 0.228 0.00 0.00
#> SRR2082501 1 0.000 0.796 1.000 0.000 0.000 0.00 0.00
#> SRR2082502 1 0.000 0.796 1.000 0.000 0.000 0.00 0.00
#> SRR2082499 1 0.000 0.796 1.000 0.000 0.000 0.00 0.00
#> SRR2082500 1 0.000 0.796 1.000 0.000 0.000 0.00 0.00
#> SRR2082503 1 0.321 0.550 0.788 0.000 0.212 0.00 0.00
#> SRR2082505 1 0.000 0.796 1.000 0.000 0.000 0.00 0.00
#> SRR2082506 1 0.000 0.796 1.000 0.000 0.000 0.00 0.00
#> SRR2082504 1 0.000 0.796 1.000 0.000 0.000 0.00 0.00
#> SRR2082495 1 0.366 0.418 0.724 0.000 0.276 0.00 0.00
#> SRR2082496 1 0.366 0.418 0.724 0.000 0.276 0.00 0.00
#> SRR2082493 1 0.366 0.418 0.724 0.000 0.276 0.00 0.00
#> SRR2082494 1 0.366 0.418 0.724 0.000 0.276 0.00 0.00
#> SRR2082491 1 0.327 0.546 0.780 0.000 0.220 0.00 0.00
#> SRR2082492 1 0.327 0.546 0.780 0.000 0.220 0.00 0.00
#> SRR2082489 1 0.000 0.796 1.000 0.000 0.000 0.00 0.00
#> SRR2082490 1 0.000 0.796 1.000 0.000 0.000 0.00 0.00
#> SRR2082497 1 0.000 0.796 1.000 0.000 0.000 0.00 0.00
#> SRR2082498 1 0.000 0.796 1.000 0.000 0.000 0.00 0.00
#> SRR2082487 1 0.000 0.796 1.000 0.000 0.000 0.00 0.00
#> SRR2082488 1 0.000 0.796 1.000 0.000 0.000 0.00 0.00
#> SRR2082485 1 0.141 0.745 0.940 0.000 0.060 0.00 0.00
#> SRR2082486 1 0.141 0.745 0.940 0.000 0.060 0.00 0.00
#> SRR2082479 1 0.000 0.796 1.000 0.000 0.000 0.00 0.00
#> SRR2082480 1 0.000 0.796 1.000 0.000 0.000 0.00 0.00
#> SRR2082483 1 0.418 -0.427 0.600 0.000 0.400 0.00 0.00
#> SRR2082484 1 0.418 -0.427 0.600 0.000 0.400 0.00 0.00
#> SRR2082481 1 0.000 0.796 1.000 0.000 0.000 0.00 0.00
#> SRR2082482 1 0.000 0.796 1.000 0.000 0.000 0.00 0.00
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> SRR2082532 4 0.386 0.579 0.000 0.000 NA 0.528 0.000 0.000
#> SRR2082533 4 0.386 0.579 0.000 0.000 NA 0.528 0.000 0.000
#> SRR2082534 4 0.000 0.685 0.000 0.000 NA 1.000 0.000 0.000
#> SRR2082535 4 0.000 0.685 0.000 0.000 NA 1.000 0.000 0.000
#> SRR2082536 4 0.000 0.685 0.000 0.000 NA 1.000 0.000 0.000
#> SRR2082530 2 0.249 0.877 0.000 0.836 NA 0.000 0.000 0.164
#> SRR2082531 2 0.249 0.877 0.000 0.836 NA 0.000 0.000 0.164
#> SRR2082528 4 0.000 0.685 0.000 0.000 NA 1.000 0.000 0.000
#> SRR2082529 4 0.000 0.685 0.000 0.000 NA 1.000 0.000 0.000
#> SRR2082526 2 0.000 0.911 0.000 1.000 NA 0.000 0.000 0.000
#> SRR2082527 2 0.000 0.911 0.000 1.000 NA 0.000 0.000 0.000
#> SRR2082521 2 0.249 0.877 0.000 0.836 NA 0.000 0.000 0.164
#> SRR2082520 4 0.597 -0.166 0.000 0.000 NA 0.436 0.096 0.036
#> SRR2082518 2 0.000 0.911 0.000 1.000 NA 0.000 0.000 0.000
#> SRR2082523 2 0.026 0.910 0.000 0.992 NA 0.000 0.000 0.008
#> SRR2082524 2 0.026 0.910 0.000 0.992 NA 0.000 0.000 0.008
#> SRR2082525 2 0.000 0.911 0.000 1.000 NA 0.000 0.000 0.000
#> SRR2082522 5 0.000 0.000 0.000 0.000 NA 0.000 1.000 0.000
#> SRR2082519 2 0.266 0.843 0.000 0.816 NA 0.000 0.184 0.000
#> SRR2082513 2 0.249 0.877 0.000 0.836 NA 0.000 0.000 0.164
#> SRR2082512 2 0.000 0.911 0.000 1.000 NA 0.000 0.000 0.000
#> SRR2082516 4 0.386 0.579 0.000 0.000 NA 0.528 0.000 0.000
#> SRR2082515 2 0.266 0.843 0.000 0.816 NA 0.000 0.184 0.000
#> SRR2082517 2 0.266 0.843 0.000 0.816 NA 0.000 0.184 0.000
#> SRR2082514 4 0.386 0.579 0.000 0.000 NA 0.528 0.000 0.000
#> SRR2082508 1 0.000 0.827 1.000 0.000 NA 0.000 0.000 0.000
#> SRR2082509 1 0.359 0.441 0.656 0.000 NA 0.000 0.000 0.344
#> SRR2082507 1 0.285 0.658 0.792 0.000 NA 0.000 0.000 0.208
#> SRR2082510 6 0.443 0.594 0.200 0.000 NA 0.000 0.000 0.704
#> SRR2082511 1 0.359 0.441 0.656 0.000 NA 0.000 0.000 0.344
#> SRR2082501 1 0.000 0.827 1.000 0.000 NA 0.000 0.000 0.000
#> SRR2082502 1 0.000 0.827 1.000 0.000 NA 0.000 0.000 0.000
#> SRR2082499 1 0.000 0.827 1.000 0.000 NA 0.000 0.000 0.000
#> SRR2082500 1 0.000 0.827 1.000 0.000 NA 0.000 0.000 0.000
#> SRR2082503 1 0.291 0.655 0.784 0.000 NA 0.000 0.000 0.216
#> SRR2082505 1 0.000 0.827 1.000 0.000 NA 0.000 0.000 0.000
#> SRR2082506 1 0.000 0.827 1.000 0.000 NA 0.000 0.000 0.000
#> SRR2082504 1 0.000 0.827 1.000 0.000 NA 0.000 0.000 0.000
#> SRR2082495 1 0.374 0.371 0.608 0.000 NA 0.000 0.000 0.392
#> SRR2082496 1 0.374 0.371 0.608 0.000 NA 0.000 0.000 0.392
#> SRR2082493 1 0.374 0.371 0.608 0.000 NA 0.000 0.000 0.392
#> SRR2082494 1 0.374 0.371 0.608 0.000 NA 0.000 0.000 0.392
#> SRR2082491 1 0.300 0.647 0.772 0.000 NA 0.000 0.000 0.228
#> SRR2082492 1 0.300 0.647 0.772 0.000 NA 0.000 0.000 0.228
#> SRR2082489 1 0.000 0.827 1.000 0.000 NA 0.000 0.000 0.000
#> SRR2082490 1 0.000 0.827 1.000 0.000 NA 0.000 0.000 0.000
#> SRR2082497 1 0.000 0.827 1.000 0.000 NA 0.000 0.000 0.000
#> SRR2082498 1 0.000 0.827 1.000 0.000 NA 0.000 0.000 0.000
#> SRR2082487 1 0.000 0.827 1.000 0.000 NA 0.000 0.000 0.000
#> SRR2082488 1 0.000 0.827 1.000 0.000 NA 0.000 0.000 0.000
#> SRR2082485 1 0.133 0.781 0.936 0.000 NA 0.000 0.000 0.064
#> SRR2082486 1 0.133 0.781 0.936 0.000 NA 0.000 0.000 0.064
#> SRR2082479 1 0.000 0.827 1.000 0.000 NA 0.000 0.000 0.000
#> SRR2082480 1 0.000 0.827 1.000 0.000 NA 0.000 0.000 0.000
#> SRR2082483 6 0.399 0.824 0.400 0.000 NA 0.000 0.000 0.592
#> SRR2082484 6 0.399 0.824 0.400 0.000 NA 0.000 0.000 0.592
#> SRR2082481 1 0.000 0.827 1.000 0.000 NA 0.000 0.000 0.000
#> SRR2082482 1 0.000 0.827 1.000 0.000 NA 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 14581 rows and 58 columns.
#> Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'CV' method.
#> Subgroups are detected by 'kmeans' method.
#> Performed in total 1250 partitions by row resampling.
#> Best k for subgroups seems to be 2.
#>
#> Following methods can be applied to this 'ConsensusPartition' object:
#> [1] "cola_report" "collect_classes" "collect_plots"
#> [4] "collect_stats" "colnames" "compare_signatures"
#> [7] "consensus_heatmap" "dimension_reduction" "functional_enrichment"
#> [10] "get_anno_col" "get_anno" "get_classes"
#> [13] "get_consensus" "get_matrix" "get_membership"
#> [16] "get_param" "get_signatures" "get_stats"
#> [19] "is_best_k" "is_stable_k" "membership_heatmap"
#> [22] "ncol" "nrow" "plot_ecdf"
#> [25] "rownames" "select_partition_number" "show"
#> [28] "suggest_best_k" "test_to_known_factors"
collect_plots()
function collects all the plots made from res
for all k
(number of partitions)
into one single page to provide an easy and fast comparison between different k
.
collect_plots(res)
The plots are:
k
and the heatmap of
predicted classes for each k
.k
.k
.k
.All the plots in panels can be made by individual functions and they are plotted later in this section.
select_partition_number()
produces several plots showing different
statistics for choosing “optimized” k
. There are following statistics:
k
;k
, the area increased is defined as \(A_k - A_{k-1}\).The detailed explanations of these statistics can be found in the cola vignette.
Generally speaking, lower PAC score, higher mean silhouette score or higher
concordance corresponds to better partition. Rand index and Jaccard index
measure how similar the current partition is compared to partition with k-1
.
If they are too similar, we won't accept k
is better than k-1
.
select_partition_number(res)
The numeric values for all these statistics can be obtained by get_stats()
.
get_stats(res)
#> k 1-PAC mean_silhouette concordance area_increased Rand Jaccard
#> 2 2 1.000 1.000 1.000 0.4996 0.501 0.501
#> 3 3 0.756 0.836 0.811 0.2350 0.879 0.758
#> 4 4 0.605 0.785 0.792 0.1163 0.909 0.761
#> 5 5 0.566 0.744 0.743 0.0880 0.985 0.951
#> 6 6 0.636 0.583 0.664 0.0583 0.907 0.675
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
#> SRR2082532 2 0 1 0 1
#> SRR2082533 2 0 1 0 1
#> SRR2082534 2 0 1 0 1
#> SRR2082535 2 0 1 0 1
#> SRR2082536 2 0 1 0 1
#> SRR2082530 2 0 1 0 1
#> SRR2082531 2 0 1 0 1
#> SRR2082528 2 0 1 0 1
#> SRR2082529 2 0 1 0 1
#> SRR2082526 2 0 1 0 1
#> SRR2082527 2 0 1 0 1
#> SRR2082521 2 0 1 0 1
#> SRR2082520 2 0 1 0 1
#> SRR2082518 2 0 1 0 1
#> SRR2082523 2 0 1 0 1
#> SRR2082524 2 0 1 0 1
#> SRR2082525 2 0 1 0 1
#> SRR2082522 2 0 1 0 1
#> SRR2082519 2 0 1 0 1
#> SRR2082513 2 0 1 0 1
#> SRR2082512 2 0 1 0 1
#> SRR2082516 2 0 1 0 1
#> SRR2082515 2 0 1 0 1
#> SRR2082517 2 0 1 0 1
#> SRR2082514 2 0 1 0 1
#> SRR2082508 1 0 1 1 0
#> SRR2082509 1 0 1 1 0
#> SRR2082507 1 0 1 1 0
#> SRR2082510 1 0 1 1 0
#> SRR2082511 1 0 1 1 0
#> SRR2082501 1 0 1 1 0
#> SRR2082502 1 0 1 1 0
#> SRR2082499 1 0 1 1 0
#> SRR2082500 1 0 1 1 0
#> SRR2082503 1 0 1 1 0
#> SRR2082505 1 0 1 1 0
#> SRR2082506 1 0 1 1 0
#> SRR2082504 1 0 1 1 0
#> SRR2082495 1 0 1 1 0
#> SRR2082496 1 0 1 1 0
#> SRR2082493 1 0 1 1 0
#> SRR2082494 1 0 1 1 0
#> SRR2082491 1 0 1 1 0
#> SRR2082492 1 0 1 1 0
#> SRR2082489 1 0 1 1 0
#> SRR2082490 1 0 1 1 0
#> SRR2082497 1 0 1 1 0
#> SRR2082498 1 0 1 1 0
#> SRR2082487 1 0 1 1 0
#> SRR2082488 1 0 1 1 0
#> SRR2082485 1 0 1 1 0
#> SRR2082486 1 0 1 1 0
#> SRR2082479 1 0 1 1 0
#> SRR2082480 1 0 1 1 0
#> SRR2082483 1 0 1 1 0
#> SRR2082484 1 0 1 1 0
#> SRR2082481 1 0 1 1 0
#> SRR2082482 1 0 1 1 0
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> SRR2082532 2 0.6111 0.785 0.000 0.604 0.396
#> SRR2082533 2 0.6111 0.785 0.000 0.604 0.396
#> SRR2082534 2 0.6111 0.785 0.000 0.604 0.396
#> SRR2082535 2 0.6111 0.785 0.000 0.604 0.396
#> SRR2082536 2 0.6111 0.785 0.000 0.604 0.396
#> SRR2082530 2 0.0000 0.843 0.000 1.000 0.000
#> SRR2082531 2 0.0000 0.843 0.000 1.000 0.000
#> SRR2082528 2 0.6111 0.785 0.000 0.604 0.396
#> SRR2082529 2 0.6111 0.785 0.000 0.604 0.396
#> SRR2082526 2 0.0000 0.843 0.000 1.000 0.000
#> SRR2082527 2 0.0000 0.843 0.000 1.000 0.000
#> SRR2082521 2 0.0237 0.843 0.000 0.996 0.004
#> SRR2082520 2 0.6126 0.785 0.000 0.600 0.400
#> SRR2082518 2 0.0237 0.843 0.000 0.996 0.004
#> SRR2082523 2 0.0000 0.843 0.000 1.000 0.000
#> SRR2082524 2 0.0000 0.843 0.000 1.000 0.000
#> SRR2082525 2 0.0000 0.843 0.000 1.000 0.000
#> SRR2082522 2 0.5621 0.801 0.000 0.692 0.308
#> SRR2082519 2 0.0237 0.843 0.000 0.996 0.004
#> SRR2082513 2 0.0237 0.843 0.000 0.996 0.004
#> SRR2082512 2 0.0237 0.843 0.000 0.996 0.004
#> SRR2082516 2 0.6126 0.785 0.000 0.600 0.400
#> SRR2082515 2 0.0237 0.843 0.000 0.996 0.004
#> SRR2082517 2 0.0237 0.843 0.000 0.996 0.004
#> SRR2082514 2 0.6126 0.785 0.000 0.600 0.400
#> SRR2082508 1 0.1529 0.875 0.960 0.000 0.040
#> SRR2082509 1 0.4504 0.610 0.804 0.000 0.196
#> SRR2082507 1 0.4887 0.402 0.772 0.000 0.228
#> SRR2082510 3 0.6215 0.957 0.428 0.000 0.572
#> SRR2082511 3 0.6215 0.957 0.428 0.000 0.572
#> SRR2082501 1 0.0424 0.897 0.992 0.000 0.008
#> SRR2082502 1 0.0424 0.897 0.992 0.000 0.008
#> SRR2082499 1 0.0424 0.897 0.992 0.000 0.008
#> SRR2082500 1 0.0424 0.897 0.992 0.000 0.008
#> SRR2082503 1 0.5291 0.208 0.732 0.000 0.268
#> SRR2082505 1 0.1860 0.865 0.948 0.000 0.052
#> SRR2082506 1 0.0592 0.890 0.988 0.000 0.012
#> SRR2082504 1 0.0747 0.889 0.984 0.000 0.016
#> SRR2082495 3 0.6235 0.960 0.436 0.000 0.564
#> SRR2082496 3 0.6235 0.960 0.436 0.000 0.564
#> SRR2082493 3 0.6235 0.960 0.436 0.000 0.564
#> SRR2082494 3 0.6235 0.960 0.436 0.000 0.564
#> SRR2082491 1 0.2625 0.840 0.916 0.000 0.084
#> SRR2082492 1 0.2625 0.840 0.916 0.000 0.084
#> SRR2082489 1 0.1643 0.880 0.956 0.000 0.044
#> SRR2082490 1 0.1643 0.880 0.956 0.000 0.044
#> SRR2082497 1 0.0424 0.897 0.992 0.000 0.008
#> SRR2082498 1 0.0424 0.897 0.992 0.000 0.008
#> SRR2082487 1 0.1753 0.878 0.952 0.000 0.048
#> SRR2082488 1 0.1753 0.878 0.952 0.000 0.048
#> SRR2082485 1 0.3267 0.794 0.884 0.000 0.116
#> SRR2082486 1 0.3267 0.794 0.884 0.000 0.116
#> SRR2082479 1 0.0424 0.895 0.992 0.000 0.008
#> SRR2082480 1 0.0424 0.895 0.992 0.000 0.008
#> SRR2082483 3 0.6308 0.885 0.492 0.000 0.508
#> SRR2082484 3 0.6308 0.885 0.492 0.000 0.508
#> SRR2082481 1 0.0424 0.895 0.992 0.000 0.008
#> SRR2082482 1 0.0424 0.895 0.992 0.000 0.008
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> SRR2082532 4 0.5936 0.929 0.000 0.380 0.044 0.576
#> SRR2082533 4 0.5936 0.929 0.000 0.380 0.044 0.576
#> SRR2082534 4 0.4936 0.942 0.000 0.372 0.004 0.624
#> SRR2082535 4 0.4936 0.942 0.000 0.372 0.004 0.624
#> SRR2082536 4 0.5298 0.939 0.000 0.372 0.016 0.612
#> SRR2082530 2 0.2489 0.856 0.000 0.912 0.068 0.020
#> SRR2082531 2 0.2489 0.856 0.000 0.912 0.068 0.020
#> SRR2082528 4 0.5298 0.939 0.000 0.372 0.016 0.612
#> SRR2082529 4 0.5298 0.939 0.000 0.372 0.016 0.612
#> SRR2082526 2 0.2775 0.852 0.000 0.896 0.084 0.020
#> SRR2082527 2 0.2775 0.852 0.000 0.896 0.084 0.020
#> SRR2082521 2 0.0921 0.861 0.000 0.972 0.028 0.000
#> SRR2082520 4 0.6111 0.919 0.000 0.392 0.052 0.556
#> SRR2082518 2 0.1716 0.849 0.000 0.936 0.064 0.000
#> SRR2082523 2 0.2706 0.856 0.000 0.900 0.080 0.020
#> SRR2082524 2 0.2706 0.856 0.000 0.900 0.080 0.020
#> SRR2082525 2 0.2775 0.852 0.000 0.896 0.084 0.020
#> SRR2082522 2 0.6677 -0.584 0.000 0.540 0.096 0.364
#> SRR2082519 2 0.1474 0.841 0.000 0.948 0.052 0.000
#> SRR2082513 2 0.0921 0.861 0.000 0.972 0.028 0.000
#> SRR2082512 2 0.1716 0.849 0.000 0.936 0.064 0.000
#> SRR2082516 4 0.6306 0.912 0.000 0.392 0.064 0.544
#> SRR2082515 2 0.1474 0.841 0.000 0.948 0.052 0.000
#> SRR2082517 2 0.1211 0.849 0.000 0.960 0.040 0.000
#> SRR2082514 4 0.6542 0.862 0.000 0.428 0.076 0.496
#> SRR2082508 1 0.4150 0.705 0.824 0.000 0.120 0.056
#> SRR2082509 1 0.5799 0.465 0.668 0.000 0.264 0.068
#> SRR2082507 1 0.5508 0.476 0.692 0.000 0.252 0.056
#> SRR2082510 3 0.6461 0.865 0.240 0.000 0.632 0.128
#> SRR2082511 3 0.6461 0.865 0.240 0.000 0.632 0.128
#> SRR2082501 1 0.1833 0.801 0.944 0.000 0.024 0.032
#> SRR2082502 1 0.1833 0.801 0.944 0.000 0.024 0.032
#> SRR2082499 1 0.1833 0.801 0.944 0.000 0.024 0.032
#> SRR2082500 1 0.1833 0.801 0.944 0.000 0.024 0.032
#> SRR2082503 1 0.5835 0.390 0.656 0.000 0.280 0.064
#> SRR2082505 1 0.4312 0.692 0.812 0.000 0.132 0.056
#> SRR2082506 1 0.1042 0.809 0.972 0.000 0.008 0.020
#> SRR2082504 1 0.1452 0.809 0.956 0.000 0.008 0.036
#> SRR2082495 3 0.4452 0.869 0.260 0.000 0.732 0.008
#> SRR2082496 3 0.4452 0.869 0.260 0.000 0.732 0.008
#> SRR2082493 3 0.4134 0.872 0.260 0.000 0.740 0.000
#> SRR2082494 3 0.4134 0.872 0.260 0.000 0.740 0.000
#> SRR2082491 1 0.3852 0.711 0.808 0.000 0.180 0.012
#> SRR2082492 1 0.3852 0.711 0.808 0.000 0.180 0.012
#> SRR2082489 1 0.3659 0.768 0.840 0.000 0.024 0.136
#> SRR2082490 1 0.3659 0.768 0.840 0.000 0.024 0.136
#> SRR2082497 1 0.1022 0.805 0.968 0.000 0.000 0.032
#> SRR2082498 1 0.1022 0.805 0.968 0.000 0.000 0.032
#> SRR2082487 1 0.3862 0.758 0.824 0.000 0.024 0.152
#> SRR2082488 1 0.3862 0.758 0.824 0.000 0.024 0.152
#> SRR2082485 1 0.5897 0.616 0.700 0.000 0.136 0.164
#> SRR2082486 1 0.5897 0.616 0.700 0.000 0.136 0.164
#> SRR2082479 1 0.1940 0.803 0.924 0.000 0.000 0.076
#> SRR2082480 1 0.1940 0.803 0.924 0.000 0.000 0.076
#> SRR2082483 3 0.7170 0.820 0.288 0.000 0.540 0.172
#> SRR2082484 3 0.7170 0.820 0.288 0.000 0.540 0.172
#> SRR2082481 1 0.2149 0.800 0.912 0.000 0.000 0.088
#> SRR2082482 1 0.2149 0.800 0.912 0.000 0.000 0.088
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> SRR2082532 4 0.207 0.885 0.000 0.020 0.016 0.928 0.036
#> SRR2082533 4 0.207 0.885 0.000 0.020 0.016 0.928 0.036
#> SRR2082534 4 0.101 0.896 0.000 0.000 0.012 0.968 0.020
#> SRR2082535 4 0.101 0.896 0.000 0.000 0.012 0.968 0.020
#> SRR2082536 4 0.207 0.888 0.000 0.000 0.036 0.920 0.044
#> SRR2082530 2 0.454 0.892 0.000 0.724 0.004 0.228 0.044
#> SRR2082531 2 0.454 0.892 0.000 0.724 0.004 0.228 0.044
#> SRR2082528 4 0.207 0.888 0.000 0.000 0.036 0.920 0.044
#> SRR2082529 4 0.207 0.888 0.000 0.000 0.036 0.920 0.044
#> SRR2082526 2 0.506 0.882 0.000 0.700 0.016 0.228 0.056
#> SRR2082527 2 0.506 0.882 0.000 0.700 0.016 0.228 0.056
#> SRR2082521 2 0.547 0.892 0.000 0.656 0.004 0.228 0.112
#> SRR2082520 4 0.204 0.884 0.000 0.000 0.024 0.920 0.056
#> SRR2082518 2 0.599 0.880 0.000 0.624 0.016 0.228 0.132
#> SRR2082523 2 0.452 0.892 0.000 0.720 0.000 0.228 0.052
#> SRR2082524 2 0.452 0.892 0.000 0.720 0.000 0.228 0.052
#> SRR2082525 2 0.506 0.882 0.000 0.700 0.016 0.228 0.056
#> SRR2082522 4 0.574 0.578 0.000 0.124 0.024 0.672 0.180
#> SRR2082519 2 0.588 0.852 0.000 0.600 0.000 0.228 0.172
#> SRR2082513 2 0.547 0.892 0.000 0.656 0.004 0.228 0.112
#> SRR2082512 2 0.599 0.880 0.000 0.624 0.016 0.228 0.132
#> SRR2082516 4 0.239 0.878 0.000 0.000 0.028 0.900 0.072
#> SRR2082515 2 0.588 0.852 0.000 0.600 0.000 0.228 0.172
#> SRR2082517 2 0.578 0.861 0.000 0.612 0.000 0.228 0.160
#> SRR2082514 4 0.373 0.818 0.000 0.028 0.016 0.820 0.136
#> SRR2082508 1 0.601 0.556 0.656 0.036 0.184 0.000 0.124
#> SRR2082509 1 0.679 0.290 0.496 0.044 0.352 0.000 0.108
#> SRR2082507 1 0.666 0.373 0.540 0.036 0.300 0.000 0.124
#> SRR2082510 3 0.621 0.804 0.100 0.072 0.656 0.000 0.172
#> SRR2082511 3 0.621 0.804 0.100 0.072 0.656 0.000 0.172
#> SRR2082501 1 0.374 0.692 0.836 0.096 0.024 0.000 0.044
#> SRR2082502 1 0.374 0.692 0.836 0.096 0.024 0.000 0.044
#> SRR2082499 1 0.374 0.692 0.836 0.096 0.024 0.000 0.044
#> SRR2082500 1 0.374 0.692 0.836 0.096 0.024 0.000 0.044
#> SRR2082503 1 0.677 0.324 0.516 0.036 0.320 0.000 0.128
#> SRR2082505 1 0.613 0.541 0.640 0.036 0.200 0.000 0.124
#> SRR2082506 1 0.231 0.707 0.912 0.012 0.016 0.000 0.060
#> SRR2082504 1 0.235 0.710 0.904 0.012 0.008 0.000 0.076
#> SRR2082495 3 0.252 0.810 0.108 0.000 0.880 0.000 0.012
#> SRR2082496 3 0.252 0.810 0.108 0.000 0.880 0.000 0.012
#> SRR2082493 3 0.213 0.813 0.108 0.000 0.892 0.000 0.000
#> SRR2082494 3 0.213 0.813 0.108 0.000 0.892 0.000 0.000
#> SRR2082491 1 0.553 0.565 0.632 0.032 0.296 0.000 0.040
#> SRR2082492 1 0.553 0.565 0.632 0.032 0.296 0.000 0.040
#> SRR2082489 1 0.438 0.629 0.708 0.000 0.032 0.000 0.260
#> SRR2082490 1 0.438 0.629 0.708 0.000 0.032 0.000 0.260
#> SRR2082497 1 0.365 0.692 0.840 0.096 0.020 0.000 0.044
#> SRR2082498 1 0.365 0.692 0.840 0.096 0.020 0.000 0.044
#> SRR2082487 1 0.455 0.617 0.688 0.000 0.036 0.000 0.276
#> SRR2082488 1 0.455 0.617 0.688 0.000 0.036 0.000 0.276
#> SRR2082485 1 0.609 0.512 0.572 0.008 0.128 0.000 0.292
#> SRR2082486 1 0.609 0.512 0.572 0.008 0.128 0.000 0.292
#> SRR2082479 1 0.213 0.706 0.908 0.012 0.000 0.000 0.080
#> SRR2082480 1 0.213 0.706 0.908 0.012 0.000 0.000 0.080
#> SRR2082483 3 0.742 0.727 0.160 0.084 0.504 0.000 0.252
#> SRR2082484 3 0.742 0.727 0.160 0.084 0.504 0.000 0.252
#> SRR2082481 1 0.236 0.702 0.892 0.012 0.000 0.000 0.096
#> SRR2082482 1 0.236 0.702 0.892 0.012 0.000 0.000 0.096
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> SRR2082532 4 0.5400 0.8530 0.036 0.184 0.000 0.680 NA 0.016
#> SRR2082533 4 0.5400 0.8530 0.036 0.184 0.000 0.680 NA 0.016
#> SRR2082534 4 0.3018 0.8711 0.000 0.168 0.000 0.816 NA 0.004
#> SRR2082535 4 0.3018 0.8711 0.000 0.168 0.000 0.816 NA 0.004
#> SRR2082536 4 0.3873 0.8644 0.020 0.168 0.000 0.780 NA 0.004
#> SRR2082530 2 0.2405 0.8265 0.016 0.880 0.000 0.000 NA 0.004
#> SRR2082531 2 0.2405 0.8265 0.016 0.880 0.000 0.000 NA 0.004
#> SRR2082528 4 0.3873 0.8644 0.020 0.168 0.000 0.780 NA 0.004
#> SRR2082529 4 0.3873 0.8644 0.020 0.168 0.000 0.780 NA 0.004
#> SRR2082526 2 0.3023 0.8028 0.000 0.768 0.000 0.000 NA 0.000
#> SRR2082527 2 0.3023 0.8028 0.000 0.768 0.000 0.000 NA 0.000
#> SRR2082521 2 0.2493 0.8215 0.036 0.884 0.000 0.000 NA 0.004
#> SRR2082520 4 0.5076 0.8564 0.032 0.168 0.000 0.708 NA 0.012
#> SRR2082518 2 0.2823 0.8020 0.000 0.796 0.000 0.000 NA 0.000
#> SRR2082523 2 0.2794 0.8258 0.012 0.840 0.000 0.000 NA 0.004
#> SRR2082524 2 0.2794 0.8258 0.012 0.840 0.000 0.000 NA 0.004
#> SRR2082525 2 0.3023 0.8028 0.000 0.768 0.000 0.000 NA 0.000
#> SRR2082522 4 0.7284 0.5601 0.068 0.316 0.000 0.408 NA 0.020
#> SRR2082519 2 0.3052 0.7821 0.068 0.848 0.000 0.000 NA 0.004
#> SRR2082513 2 0.2493 0.8215 0.036 0.884 0.000 0.000 NA 0.004
#> SRR2082512 2 0.2823 0.8020 0.000 0.796 0.000 0.000 NA 0.000
#> SRR2082516 4 0.5914 0.8442 0.040 0.168 0.000 0.648 NA 0.028
#> SRR2082515 2 0.3052 0.7821 0.068 0.848 0.000 0.000 NA 0.004
#> SRR2082517 2 0.2888 0.7910 0.068 0.860 0.000 0.000 NA 0.004
#> SRR2082514 4 0.6839 0.7702 0.072 0.216 0.000 0.540 NA 0.024
#> SRR2082508 1 0.6350 0.3777 0.496 0.000 0.204 0.004 NA 0.024
#> SRR2082509 1 0.7433 0.2799 0.392 0.000 0.172 0.000 NA 0.196
#> SRR2082507 1 0.6745 0.3717 0.476 0.000 0.148 0.000 NA 0.088
#> SRR2082510 6 0.1075 0.6903 0.000 0.000 0.048 0.000 NA 0.952
#> SRR2082511 6 0.1219 0.6903 0.004 0.000 0.048 0.000 NA 0.948
#> SRR2082501 1 0.3881 0.3734 0.600 0.000 0.396 0.000 NA 0.000
#> SRR2082502 1 0.3881 0.3734 0.600 0.000 0.396 0.000 NA 0.000
#> SRR2082499 1 0.3881 0.3734 0.600 0.000 0.396 0.000 NA 0.000
#> SRR2082500 1 0.3881 0.3734 0.600 0.000 0.396 0.000 NA 0.000
#> SRR2082503 1 0.6680 0.3732 0.484 0.000 0.144 0.000 NA 0.084
#> SRR2082505 1 0.6373 0.3833 0.492 0.000 0.192 0.000 NA 0.036
#> SRR2082506 3 0.5852 -0.0736 0.368 0.000 0.480 0.012 NA 0.000
#> SRR2082504 3 0.5554 0.1965 0.304 0.000 0.572 0.020 NA 0.000
#> SRR2082495 6 0.7453 0.6780 0.148 0.000 0.072 0.064 NA 0.488
#> SRR2082496 6 0.7453 0.6780 0.148 0.000 0.072 0.064 NA 0.488
#> SRR2082493 6 0.7349 0.6877 0.140 0.000 0.072 0.068 NA 0.512
#> SRR2082494 6 0.7349 0.6877 0.140 0.000 0.072 0.068 NA 0.512
#> SRR2082491 3 0.7838 -0.2009 0.320 0.000 0.332 0.052 NA 0.068
#> SRR2082492 3 0.7838 -0.2009 0.320 0.000 0.332 0.052 NA 0.068
#> SRR2082489 3 0.0146 0.5271 0.000 0.000 0.996 0.004 NA 0.000
#> SRR2082490 3 0.0146 0.5271 0.000 0.000 0.996 0.004 NA 0.000
#> SRR2082497 1 0.3774 0.3471 0.592 0.000 0.408 0.000 NA 0.000
#> SRR2082498 1 0.3782 0.3419 0.588 0.000 0.412 0.000 NA 0.000
#> SRR2082487 3 0.0405 0.5257 0.000 0.000 0.988 0.004 NA 0.000
#> SRR2082488 3 0.0405 0.5257 0.000 0.000 0.988 0.004 NA 0.000
#> SRR2082485 3 0.3049 0.4646 0.016 0.000 0.868 0.024 NA 0.072
#> SRR2082486 3 0.3049 0.4646 0.016 0.000 0.868 0.024 NA 0.072
#> SRR2082479 3 0.5377 0.3338 0.280 0.000 0.620 0.036 NA 0.004
#> SRR2082480 3 0.5377 0.3338 0.280 0.000 0.620 0.036 NA 0.004
#> SRR2082483 6 0.4840 0.6008 0.088 0.000 0.064 0.060 NA 0.760
#> SRR2082484 6 0.4840 0.6008 0.088 0.000 0.064 0.060 NA 0.760
#> SRR2082481 3 0.5241 0.3726 0.252 0.000 0.648 0.036 NA 0.004
#> SRR2082482 3 0.5241 0.3726 0.252 0.000 0.648 0.036 NA 0.004
Heatmaps for the consensus matrix. It visualizes the probability of two samples to be in a same group.
consensus_heatmap(res, k = 2)
consensus_heatmap(res, k = 3)
consensus_heatmap(res, k = 4)
consensus_heatmap(res, k = 5)
consensus_heatmap(res, k = 6)
Heatmaps for the membership of samples in all partitions to see how consistent they are:
membership_heatmap(res, k = 2)
membership_heatmap(res, k = 3)
membership_heatmap(res, k = 4)
membership_heatmap(res, k = 5)
membership_heatmap(res, k = 6)
As soon as we have had the classes for columns, we can look for signatures which are significantly different between classes which can be candidate marks for certain classes. Following are the heatmaps for signatures.
Signature heatmaps where rows are scaled:
get_signatures(res, k = 2)
get_signatures(res, k = 3)
get_signatures(res, k = 4)
get_signatures(res, k = 5)
get_signatures(res, k = 6)
Signature heatmaps where rows are not scaled:
get_signatures(res, k = 2, scale_rows = FALSE)
get_signatures(res, k = 3, scale_rows = FALSE)
get_signatures(res, k = 4, scale_rows = FALSE)
get_signatures(res, k = 5, scale_rows = FALSE)
get_signatures(res, k = 6, scale_rows = FALSE)
Compare the overlap of signatures from different k:
compare_signatures(res)
get_signature()
returns a data frame invisibly. TO get the list of signatures, the function
call should be assigned to a variable explicitly. In following code, if plot
argument is set
to FALSE
, no heatmap is plotted while only the differential analysis is performed.
# code only for demonstration
tb = get_signature(res, k = ..., plot = FALSE)
An example of the output of tb
is:
#> which_row fdr mean_1 mean_2 scaled_mean_1 scaled_mean_2 km
#> 1 38 0.042760348 8.373488 9.131774 -0.5533452 0.5164555 1
#> 2 40 0.018707592 7.106213 8.469186 -0.6173731 0.5762149 1
#> 3 55 0.019134737 10.221463 11.207825 -0.6159697 0.5749050 1
#> 4 59 0.006059896 5.921854 7.869574 -0.6899429 0.6439467 1
#> 5 60 0.018055526 8.928898 10.211722 -0.6204761 0.5791110 1
#> 6 98 0.009384629 15.714769 14.887706 0.6635654 -0.6193277 2
...
The columns in tb
are:
which_row
: row indices corresponding to the input matrix.fdr
: FDR for the differential test. mean_x
: The mean value in group x.scaled_mean_x
: The mean value in group x after rows are scaled.km
: Row groups if k-means clustering is applied to rows.UMAP plot which shows how samples are separated.
dimension_reduction(res, k = 2, method = "UMAP")
dimension_reduction(res, k = 3, method = "UMAP")
dimension_reduction(res, k = 4, method = "UMAP")
dimension_reduction(res, k = 5, method = "UMAP")
dimension_reduction(res, k = 6, method = "UMAP")
Following heatmap shows how subgroups are split when increasing k
:
collect_classes(res)
If matrix rows can be associated to genes, consider to use functional_enrichment(res,
...)
to perform function enrichment for the signature genes. See this vignette for more detailed explanations.
The object with results only for a single top-value method and a single partition method can be extracted as:
res = res_list["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 14581 rows and 58 columns.
#> Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'CV' method.
#> Subgroups are detected by 'skmeans' method.
#> Performed in total 1250 partitions by row resampling.
#> Best k for subgroups seems to be 2.
#>
#> Following methods can be applied to this 'ConsensusPartition' object:
#> [1] "cola_report" "collect_classes" "collect_plots"
#> [4] "collect_stats" "colnames" "compare_signatures"
#> [7] "consensus_heatmap" "dimension_reduction" "functional_enrichment"
#> [10] "get_anno_col" "get_anno" "get_classes"
#> [13] "get_consensus" "get_matrix" "get_membership"
#> [16] "get_param" "get_signatures" "get_stats"
#> [19] "is_best_k" "is_stable_k" "membership_heatmap"
#> [22] "ncol" "nrow" "plot_ecdf"
#> [25] "rownames" "select_partition_number" "show"
#> [28] "suggest_best_k" "test_to_known_factors"
collect_plots()
function collects all the plots made from res
for all k
(number of partitions)
into one single page to provide an easy and fast comparison between different k
.
collect_plots(res)
The plots are:
k
and the heatmap of
predicted classes for each k
.k
.k
.k
.All the plots in panels can be made by individual functions and they are plotted later in this section.
select_partition_number()
produces several plots showing different
statistics for choosing “optimized” k
. There are following statistics:
k
;k
, the area increased is defined as \(A_k - A_{k-1}\).The detailed explanations of these statistics can be found in the cola vignette.
Generally speaking, lower PAC score, higher mean silhouette score or higher
concordance corresponds to better partition. Rand index and Jaccard index
measure how similar the current partition is compared to partition with k-1
.
If they are too similar, we won't accept k
is better than k-1
.
select_partition_number(res)
The numeric values for all these statistics can be obtained by get_stats()
.
get_stats(res)
#> k 1-PAC mean_silhouette concordance area_increased Rand Jaccard
#> 2 2 1.000 1.000 1.000 0.4996 0.501 0.501
#> 3 3 0.777 0.895 0.895 0.2018 0.907 0.814
#> 4 4 0.870 0.896 0.935 0.1959 0.879 0.703
#> 5 5 0.727 0.666 0.828 0.0676 0.989 0.962
#> 6 6 0.749 0.667 0.769 0.0451 0.925 0.732
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
#> SRR2082532 2 0 1 0 1
#> SRR2082533 2 0 1 0 1
#> SRR2082534 2 0 1 0 1
#> SRR2082535 2 0 1 0 1
#> SRR2082536 2 0 1 0 1
#> SRR2082530 2 0 1 0 1
#> SRR2082531 2 0 1 0 1
#> SRR2082528 2 0 1 0 1
#> SRR2082529 2 0 1 0 1
#> SRR2082526 2 0 1 0 1
#> SRR2082527 2 0 1 0 1
#> SRR2082521 2 0 1 0 1
#> SRR2082520 2 0 1 0 1
#> SRR2082518 2 0 1 0 1
#> SRR2082523 2 0 1 0 1
#> SRR2082524 2 0 1 0 1
#> SRR2082525 2 0 1 0 1
#> SRR2082522 2 0 1 0 1
#> SRR2082519 2 0 1 0 1
#> SRR2082513 2 0 1 0 1
#> SRR2082512 2 0 1 0 1
#> SRR2082516 2 0 1 0 1
#> SRR2082515 2 0 1 0 1
#> SRR2082517 2 0 1 0 1
#> SRR2082514 2 0 1 0 1
#> SRR2082508 1 0 1 1 0
#> SRR2082509 1 0 1 1 0
#> SRR2082507 1 0 1 1 0
#> SRR2082510 1 0 1 1 0
#> SRR2082511 1 0 1 1 0
#> SRR2082501 1 0 1 1 0
#> SRR2082502 1 0 1 1 0
#> SRR2082499 1 0 1 1 0
#> SRR2082500 1 0 1 1 0
#> SRR2082503 1 0 1 1 0
#> SRR2082505 1 0 1 1 0
#> SRR2082506 1 0 1 1 0
#> SRR2082504 1 0 1 1 0
#> SRR2082495 1 0 1 1 0
#> SRR2082496 1 0 1 1 0
#> SRR2082493 1 0 1 1 0
#> SRR2082494 1 0 1 1 0
#> SRR2082491 1 0 1 1 0
#> SRR2082492 1 0 1 1 0
#> SRR2082489 1 0 1 1 0
#> SRR2082490 1 0 1 1 0
#> SRR2082497 1 0 1 1 0
#> SRR2082498 1 0 1 1 0
#> SRR2082487 1 0 1 1 0
#> SRR2082488 1 0 1 1 0
#> SRR2082485 1 0 1 1 0
#> SRR2082486 1 0 1 1 0
#> SRR2082479 1 0 1 1 0
#> SRR2082480 1 0 1 1 0
#> SRR2082483 1 0 1 1 0
#> SRR2082484 1 0 1 1 0
#> SRR2082481 1 0 1 1 0
#> SRR2082482 1 0 1 1 0
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> SRR2082532 2 0.0000 0.89018 0.000 1.000 0.000
#> SRR2082533 2 0.0000 0.89018 0.000 1.000 0.000
#> SRR2082534 2 0.0000 0.89018 0.000 1.000 0.000
#> SRR2082535 2 0.0000 0.89018 0.000 1.000 0.000
#> SRR2082536 2 0.0000 0.89018 0.000 1.000 0.000
#> SRR2082530 3 0.5178 0.99621 0.000 0.256 0.744
#> SRR2082531 3 0.5178 0.99621 0.000 0.256 0.744
#> SRR2082528 2 0.0000 0.89018 0.000 1.000 0.000
#> SRR2082529 2 0.0000 0.89018 0.000 1.000 0.000
#> SRR2082526 3 0.5178 0.99621 0.000 0.256 0.744
#> SRR2082527 3 0.5178 0.99621 0.000 0.256 0.744
#> SRR2082521 3 0.5138 0.99495 0.000 0.252 0.748
#> SRR2082520 2 0.0237 0.88873 0.000 0.996 0.004
#> SRR2082518 3 0.5138 0.99495 0.000 0.252 0.748
#> SRR2082523 3 0.5216 0.99302 0.000 0.260 0.740
#> SRR2082524 3 0.5216 0.99302 0.000 0.260 0.740
#> SRR2082525 3 0.5178 0.99621 0.000 0.256 0.744
#> SRR2082522 2 0.4452 0.69745 0.000 0.808 0.192
#> SRR2082519 2 0.4654 0.67283 0.000 0.792 0.208
#> SRR2082513 3 0.5138 0.99495 0.000 0.252 0.748
#> SRR2082512 3 0.5138 0.99495 0.000 0.252 0.748
#> SRR2082516 2 0.0237 0.88873 0.000 0.996 0.004
#> SRR2082515 2 0.4654 0.67283 0.000 0.792 0.208
#> SRR2082517 2 0.6154 0.00436 0.000 0.592 0.408
#> SRR2082514 2 0.0237 0.88873 0.000 0.996 0.004
#> SRR2082508 1 0.0000 0.94205 1.000 0.000 0.000
#> SRR2082509 1 0.1163 0.93277 0.972 0.000 0.028
#> SRR2082507 1 0.1643 0.92611 0.956 0.000 0.044
#> SRR2082510 1 0.5138 0.81674 0.748 0.000 0.252
#> SRR2082511 1 0.5138 0.81674 0.748 0.000 0.252
#> SRR2082501 1 0.0000 0.94205 1.000 0.000 0.000
#> SRR2082502 1 0.0000 0.94205 1.000 0.000 0.000
#> SRR2082499 1 0.0000 0.94205 1.000 0.000 0.000
#> SRR2082500 1 0.0000 0.94205 1.000 0.000 0.000
#> SRR2082503 1 0.1753 0.92444 0.952 0.000 0.048
#> SRR2082505 1 0.0000 0.94205 1.000 0.000 0.000
#> SRR2082506 1 0.0000 0.94205 1.000 0.000 0.000
#> SRR2082504 1 0.0000 0.94205 1.000 0.000 0.000
#> SRR2082495 1 0.5138 0.81674 0.748 0.000 0.252
#> SRR2082496 1 0.5138 0.81674 0.748 0.000 0.252
#> SRR2082493 1 0.5138 0.81674 0.748 0.000 0.252
#> SRR2082494 1 0.5138 0.81674 0.748 0.000 0.252
#> SRR2082491 1 0.0000 0.94205 1.000 0.000 0.000
#> SRR2082492 1 0.0000 0.94205 1.000 0.000 0.000
#> SRR2082489 1 0.0000 0.94205 1.000 0.000 0.000
#> SRR2082490 1 0.0000 0.94205 1.000 0.000 0.000
#> SRR2082497 1 0.0000 0.94205 1.000 0.000 0.000
#> SRR2082498 1 0.0000 0.94205 1.000 0.000 0.000
#> SRR2082487 1 0.0000 0.94205 1.000 0.000 0.000
#> SRR2082488 1 0.0000 0.94205 1.000 0.000 0.000
#> SRR2082485 1 0.0237 0.94096 0.996 0.000 0.004
#> SRR2082486 1 0.0237 0.94096 0.996 0.000 0.004
#> SRR2082479 1 0.0000 0.94205 1.000 0.000 0.000
#> SRR2082480 1 0.0000 0.94205 1.000 0.000 0.000
#> SRR2082483 1 0.5138 0.81674 0.748 0.000 0.252
#> SRR2082484 1 0.5138 0.81674 0.748 0.000 0.252
#> SRR2082481 1 0.0000 0.94205 1.000 0.000 0.000
#> SRR2082482 1 0.0000 0.94205 1.000 0.000 0.000
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> SRR2082532 4 0.0000 0.901 0.000 0.000 0.000 1.000
#> SRR2082533 4 0.0000 0.901 0.000 0.000 0.000 1.000
#> SRR2082534 4 0.0000 0.901 0.000 0.000 0.000 1.000
#> SRR2082535 4 0.0000 0.901 0.000 0.000 0.000 1.000
#> SRR2082536 4 0.0000 0.901 0.000 0.000 0.000 1.000
#> SRR2082530 2 0.0657 0.967 0.000 0.984 0.012 0.004
#> SRR2082531 2 0.0657 0.967 0.000 0.984 0.012 0.004
#> SRR2082528 4 0.0000 0.901 0.000 0.000 0.000 1.000
#> SRR2082529 4 0.0000 0.901 0.000 0.000 0.000 1.000
#> SRR2082526 2 0.1284 0.970 0.000 0.964 0.024 0.012
#> SRR2082527 2 0.1284 0.970 0.000 0.964 0.024 0.012
#> SRR2082521 2 0.1209 0.967 0.000 0.964 0.032 0.004
#> SRR2082520 4 0.0188 0.900 0.000 0.000 0.004 0.996
#> SRR2082518 2 0.1677 0.967 0.000 0.948 0.040 0.012
#> SRR2082523 2 0.1557 0.944 0.000 0.944 0.000 0.056
#> SRR2082524 2 0.1557 0.944 0.000 0.944 0.000 0.056
#> SRR2082525 2 0.1284 0.970 0.000 0.964 0.024 0.012
#> SRR2082522 4 0.4418 0.752 0.000 0.184 0.032 0.784
#> SRR2082519 4 0.5055 0.671 0.000 0.256 0.032 0.712
#> SRR2082513 2 0.1209 0.967 0.000 0.964 0.032 0.004
#> SRR2082512 2 0.1677 0.967 0.000 0.948 0.040 0.012
#> SRR2082516 4 0.0188 0.900 0.000 0.000 0.004 0.996
#> SRR2082515 4 0.5055 0.671 0.000 0.256 0.032 0.712
#> SRR2082517 4 0.5865 0.349 0.000 0.412 0.036 0.552
#> SRR2082514 4 0.0188 0.900 0.000 0.000 0.004 0.996
#> SRR2082508 1 0.0336 0.933 0.992 0.000 0.008 0.000
#> SRR2082509 1 0.4406 0.627 0.700 0.000 0.300 0.000
#> SRR2082507 1 0.3764 0.720 0.784 0.000 0.216 0.000
#> SRR2082510 3 0.1637 0.984 0.060 0.000 0.940 0.000
#> SRR2082511 3 0.1637 0.984 0.060 0.000 0.940 0.000
#> SRR2082501 1 0.0000 0.935 1.000 0.000 0.000 0.000
#> SRR2082502 1 0.0000 0.935 1.000 0.000 0.000 0.000
#> SRR2082499 1 0.0000 0.935 1.000 0.000 0.000 0.000
#> SRR2082500 1 0.0000 0.935 1.000 0.000 0.000 0.000
#> SRR2082503 1 0.4564 0.501 0.672 0.000 0.328 0.000
#> SRR2082505 1 0.1118 0.919 0.964 0.000 0.036 0.000
#> SRR2082506 1 0.0000 0.935 1.000 0.000 0.000 0.000
#> SRR2082504 1 0.0188 0.935 0.996 0.004 0.000 0.000
#> SRR2082495 3 0.1716 0.983 0.064 0.000 0.936 0.000
#> SRR2082496 3 0.1716 0.983 0.064 0.000 0.936 0.000
#> SRR2082493 3 0.1637 0.984 0.060 0.000 0.940 0.000
#> SRR2082494 3 0.1637 0.984 0.060 0.000 0.940 0.000
#> SRR2082491 1 0.1716 0.912 0.936 0.000 0.064 0.000
#> SRR2082492 1 0.1716 0.912 0.936 0.000 0.064 0.000
#> SRR2082489 1 0.1109 0.928 0.968 0.004 0.028 0.000
#> SRR2082490 1 0.1109 0.928 0.968 0.004 0.028 0.000
#> SRR2082497 1 0.0000 0.935 1.000 0.000 0.000 0.000
#> SRR2082498 1 0.0000 0.935 1.000 0.000 0.000 0.000
#> SRR2082487 1 0.1109 0.928 0.968 0.004 0.028 0.000
#> SRR2082488 1 0.1109 0.928 0.968 0.004 0.028 0.000
#> SRR2082485 1 0.3257 0.825 0.844 0.004 0.152 0.000
#> SRR2082486 1 0.3257 0.825 0.844 0.004 0.152 0.000
#> SRR2082479 1 0.0188 0.935 0.996 0.004 0.000 0.000
#> SRR2082480 1 0.0188 0.935 0.996 0.004 0.000 0.000
#> SRR2082483 3 0.2408 0.957 0.104 0.000 0.896 0.000
#> SRR2082484 3 0.2408 0.957 0.104 0.000 0.896 0.000
#> SRR2082481 1 0.0188 0.935 0.996 0.004 0.000 0.000
#> SRR2082482 1 0.0188 0.935 0.996 0.004 0.000 0.000
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> SRR2082532 5 0.0000 0.893 0.000 0.000 0.000 0.000 1.000
#> SRR2082533 5 0.0000 0.893 0.000 0.000 0.000 0.000 1.000
#> SRR2082534 5 0.0000 0.893 0.000 0.000 0.000 0.000 1.000
#> SRR2082535 5 0.0000 0.893 0.000 0.000 0.000 0.000 1.000
#> SRR2082536 5 0.0000 0.893 0.000 0.000 0.000 0.000 1.000
#> SRR2082530 2 0.0162 0.558 0.000 0.996 0.000 0.000 0.004
#> SRR2082531 2 0.0162 0.558 0.000 0.996 0.000 0.000 0.004
#> SRR2082528 5 0.0000 0.893 0.000 0.000 0.000 0.000 1.000
#> SRR2082529 5 0.0000 0.893 0.000 0.000 0.000 0.000 1.000
#> SRR2082526 2 0.4437 -0.879 0.000 0.532 0.000 0.464 0.004
#> SRR2082527 2 0.4437 -0.879 0.000 0.532 0.000 0.464 0.004
#> SRR2082521 2 0.1041 0.551 0.000 0.964 0.000 0.032 0.004
#> SRR2082520 5 0.0290 0.891 0.000 0.000 0.000 0.008 0.992
#> SRR2082518 4 0.4452 1.000 0.000 0.496 0.000 0.500 0.004
#> SRR2082523 2 0.2233 0.515 0.000 0.904 0.000 0.016 0.080
#> SRR2082524 2 0.2233 0.515 0.000 0.904 0.000 0.016 0.080
#> SRR2082525 2 0.4437 -0.879 0.000 0.532 0.000 0.464 0.004
#> SRR2082522 5 0.4608 0.709 0.000 0.048 0.008 0.212 0.732
#> SRR2082519 5 0.5201 0.661 0.000 0.084 0.008 0.220 0.688
#> SRR2082513 2 0.1041 0.551 0.000 0.964 0.000 0.032 0.004
#> SRR2082512 4 0.4452 1.000 0.000 0.496 0.000 0.500 0.004
#> SRR2082516 5 0.0162 0.893 0.000 0.000 0.000 0.004 0.996
#> SRR2082515 5 0.5201 0.661 0.000 0.084 0.008 0.220 0.688
#> SRR2082517 5 0.6499 0.348 0.000 0.212 0.008 0.244 0.536
#> SRR2082514 5 0.0162 0.893 0.000 0.000 0.000 0.004 0.996
#> SRR2082508 1 0.4588 0.638 0.604 0.000 0.016 0.380 0.000
#> SRR2082509 1 0.6671 0.322 0.396 0.000 0.232 0.372 0.000
#> SRR2082507 1 0.5670 0.541 0.528 0.000 0.084 0.388 0.000
#> SRR2082510 3 0.0290 0.858 0.008 0.000 0.992 0.000 0.000
#> SRR2082511 3 0.0290 0.858 0.008 0.000 0.992 0.000 0.000
#> SRR2082501 1 0.2179 0.808 0.888 0.000 0.000 0.112 0.000
#> SRR2082502 1 0.2179 0.808 0.888 0.000 0.000 0.112 0.000
#> SRR2082499 1 0.2179 0.808 0.888 0.000 0.000 0.112 0.000
#> SRR2082500 1 0.2179 0.808 0.888 0.000 0.000 0.112 0.000
#> SRR2082503 1 0.6356 0.405 0.452 0.000 0.164 0.384 0.000
#> SRR2082505 1 0.4686 0.629 0.596 0.000 0.020 0.384 0.000
#> SRR2082506 1 0.2179 0.809 0.888 0.000 0.000 0.112 0.000
#> SRR2082504 1 0.0703 0.806 0.976 0.000 0.000 0.024 0.000
#> SRR2082495 3 0.3719 0.867 0.012 0.004 0.776 0.208 0.000
#> SRR2082496 3 0.3719 0.867 0.012 0.004 0.776 0.208 0.000
#> SRR2082493 3 0.3686 0.869 0.012 0.004 0.780 0.204 0.000
#> SRR2082494 3 0.3686 0.869 0.012 0.004 0.780 0.204 0.000
#> SRR2082491 1 0.5405 0.666 0.620 0.004 0.072 0.304 0.000
#> SRR2082492 1 0.5405 0.666 0.620 0.004 0.072 0.304 0.000
#> SRR2082489 1 0.2416 0.766 0.888 0.000 0.012 0.100 0.000
#> SRR2082490 1 0.2416 0.766 0.888 0.000 0.012 0.100 0.000
#> SRR2082497 1 0.2074 0.809 0.896 0.000 0.000 0.104 0.000
#> SRR2082498 1 0.2074 0.809 0.896 0.000 0.000 0.104 0.000
#> SRR2082487 1 0.2616 0.762 0.880 0.000 0.020 0.100 0.000
#> SRR2082488 1 0.2616 0.762 0.880 0.000 0.020 0.100 0.000
#> SRR2082485 1 0.4675 0.632 0.736 0.000 0.164 0.100 0.000
#> SRR2082486 1 0.4675 0.632 0.736 0.000 0.164 0.100 0.000
#> SRR2082479 1 0.0000 0.803 1.000 0.000 0.000 0.000 0.000
#> SRR2082480 1 0.0000 0.803 1.000 0.000 0.000 0.000 0.000
#> SRR2082483 3 0.1357 0.842 0.048 0.000 0.948 0.004 0.000
#> SRR2082484 3 0.1357 0.842 0.048 0.000 0.948 0.004 0.000
#> SRR2082481 1 0.0000 0.803 1.000 0.000 0.000 0.000 0.000
#> SRR2082482 1 0.0000 0.803 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
#> SRR2082532 4 0.0291 0.849 0.000 0.004 0.000 0.992 0.000 0.004
#> SRR2082533 4 0.0291 0.849 0.000 0.004 0.000 0.992 0.000 0.004
#> SRR2082534 4 0.0000 0.848 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR2082535 4 0.0000 0.848 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR2082536 4 0.0000 0.848 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR2082530 5 0.0000 0.891 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR2082531 5 0.0000 0.891 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR2082528 4 0.0000 0.848 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR2082529 4 0.0000 0.848 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR2082526 2 0.3266 0.956 0.000 0.728 0.000 0.000 0.272 0.000
#> SRR2082527 2 0.3266 0.956 0.000 0.728 0.000 0.000 0.272 0.000
#> SRR2082521 5 0.0865 0.886 0.000 0.036 0.000 0.000 0.964 0.000
#> SRR2082520 4 0.0547 0.846 0.000 0.000 0.000 0.980 0.000 0.020
#> SRR2082518 2 0.3457 0.934 0.000 0.752 0.000 0.000 0.232 0.016
#> SRR2082523 5 0.3296 0.812 0.000 0.064 0.000 0.080 0.840 0.016
#> SRR2082524 5 0.3296 0.812 0.000 0.064 0.000 0.080 0.840 0.016
#> SRR2082525 2 0.3266 0.956 0.000 0.728 0.000 0.000 0.272 0.000
#> SRR2082522 4 0.5799 0.576 0.000 0.204 0.004 0.588 0.016 0.188
#> SRR2082519 4 0.6699 0.486 0.000 0.220 0.004 0.516 0.072 0.188
#> SRR2082513 5 0.0865 0.886 0.000 0.036 0.000 0.000 0.964 0.000
#> SRR2082512 2 0.3457 0.934 0.000 0.752 0.000 0.000 0.232 0.016
#> SRR2082516 4 0.0777 0.846 0.000 0.004 0.000 0.972 0.000 0.024
#> SRR2082515 4 0.6779 0.467 0.000 0.228 0.004 0.504 0.076 0.188
#> SRR2082517 4 0.7354 0.271 0.000 0.268 0.004 0.412 0.128 0.188
#> SRR2082514 4 0.0777 0.846 0.000 0.004 0.000 0.972 0.000 0.024
#> SRR2082508 6 0.4461 0.643 0.464 0.020 0.004 0.000 0.000 0.512
#> SRR2082509 6 0.5771 0.658 0.268 0.004 0.200 0.000 0.000 0.528
#> SRR2082507 6 0.5035 0.781 0.300 0.012 0.072 0.000 0.000 0.616
#> SRR2082510 3 0.0713 0.672 0.000 0.000 0.972 0.000 0.000 0.028
#> SRR2082511 3 0.0865 0.674 0.000 0.000 0.964 0.000 0.000 0.036
#> SRR2082501 1 0.4000 0.556 0.764 0.064 0.008 0.000 0.000 0.164
#> SRR2082502 1 0.4000 0.556 0.764 0.064 0.008 0.000 0.000 0.164
#> SRR2082499 1 0.4000 0.556 0.764 0.064 0.008 0.000 0.000 0.164
#> SRR2082500 1 0.4000 0.556 0.764 0.064 0.008 0.000 0.000 0.164
#> SRR2082503 6 0.5177 0.790 0.320 0.004 0.096 0.000 0.000 0.580
#> SRR2082505 6 0.4402 0.755 0.412 0.004 0.020 0.000 0.000 0.564
#> SRR2082506 1 0.2118 0.607 0.888 0.008 0.000 0.000 0.000 0.104
#> SRR2082504 1 0.1075 0.643 0.952 0.000 0.000 0.000 0.000 0.048
#> SRR2082495 3 0.4432 0.605 0.004 0.020 0.544 0.000 0.000 0.432
#> SRR2082496 3 0.4432 0.605 0.004 0.020 0.544 0.000 0.000 0.432
#> SRR2082493 3 0.4427 0.609 0.004 0.020 0.548 0.000 0.000 0.428
#> SRR2082494 3 0.4427 0.609 0.004 0.020 0.548 0.000 0.000 0.428
#> SRR2082491 1 0.5544 -0.342 0.488 0.032 0.060 0.000 0.000 0.420
#> SRR2082492 1 0.5536 -0.381 0.476 0.028 0.064 0.000 0.000 0.432
#> SRR2082489 1 0.4216 0.588 0.776 0.084 0.032 0.000 0.000 0.108
#> SRR2082490 1 0.4216 0.588 0.776 0.084 0.032 0.000 0.000 0.108
#> SRR2082497 1 0.3820 0.578 0.784 0.064 0.008 0.000 0.000 0.144
#> SRR2082498 1 0.3782 0.579 0.788 0.064 0.008 0.000 0.000 0.140
#> SRR2082487 1 0.4216 0.588 0.776 0.084 0.032 0.000 0.000 0.108
#> SRR2082488 1 0.4216 0.588 0.776 0.084 0.032 0.000 0.000 0.108
#> SRR2082485 1 0.5628 0.479 0.660 0.084 0.132 0.000 0.000 0.124
#> SRR2082486 1 0.5628 0.479 0.660 0.084 0.132 0.000 0.000 0.124
#> SRR2082479 1 0.0363 0.654 0.988 0.000 0.000 0.000 0.000 0.012
#> SRR2082480 1 0.0363 0.654 0.988 0.000 0.000 0.000 0.000 0.012
#> SRR2082483 3 0.2076 0.625 0.060 0.016 0.912 0.000 0.000 0.012
#> SRR2082484 3 0.2076 0.625 0.060 0.016 0.912 0.000 0.000 0.012
#> SRR2082481 1 0.0260 0.654 0.992 0.000 0.000 0.000 0.000 0.008
#> SRR2082482 1 0.0260 0.654 0.992 0.000 0.000 0.000 0.000 0.008
Heatmaps for the consensus matrix. It visualizes the probability of two samples to be in a same group.
consensus_heatmap(res, k = 2)
consensus_heatmap(res, k = 3)
consensus_heatmap(res, k = 4)
consensus_heatmap(res, k = 5)
consensus_heatmap(res, k = 6)
Heatmaps for the membership of samples in all partitions to see how consistent they are:
membership_heatmap(res, k = 2)
membership_heatmap(res, k = 3)
membership_heatmap(res, k = 4)
membership_heatmap(res, k = 5)
membership_heatmap(res, k = 6)
As soon as we have had the classes for columns, we can look for signatures which are significantly different between classes which can be candidate marks for certain classes. Following are the heatmaps for signatures.
Signature heatmaps where rows are scaled:
get_signatures(res, k = 2)
get_signatures(res, k = 3)
get_signatures(res, k = 4)
get_signatures(res, k = 5)
get_signatures(res, k = 6)
Signature heatmaps where rows are not scaled:
get_signatures(res, k = 2, scale_rows = FALSE)
get_signatures(res, k = 3, scale_rows = FALSE)
get_signatures(res, k = 4, scale_rows = FALSE)
get_signatures(res, k = 5, scale_rows = FALSE)
get_signatures(res, k = 6, scale_rows = FALSE)
Compare the overlap of signatures from different k:
compare_signatures(res)
get_signature()
returns a data frame invisibly. TO get the list of signatures, the function
call should be assigned to a variable explicitly. In following code, if plot
argument is set
to FALSE
, no heatmap is plotted while only the differential analysis is performed.
# code only for demonstration
tb = get_signature(res, k = ..., plot = FALSE)
An example of the output of tb
is:
#> which_row fdr mean_1 mean_2 scaled_mean_1 scaled_mean_2 km
#> 1 38 0.042760348 8.373488 9.131774 -0.5533452 0.5164555 1
#> 2 40 0.018707592 7.106213 8.469186 -0.6173731 0.5762149 1
#> 3 55 0.019134737 10.221463 11.207825 -0.6159697 0.5749050 1
#> 4 59 0.006059896 5.921854 7.869574 -0.6899429 0.6439467 1
#> 5 60 0.018055526 8.928898 10.211722 -0.6204761 0.5791110 1
#> 6 98 0.009384629 15.714769 14.887706 0.6635654 -0.6193277 2
...
The columns in tb
are:
which_row
: row indices corresponding to the input matrix.fdr
: FDR for the differential test. mean_x
: The mean value in group x.scaled_mean_x
: The mean value in group x after rows are scaled.km
: Row groups if k-means clustering is applied to rows.UMAP plot which shows how samples are separated.
dimension_reduction(res, k = 2, method = "UMAP")
dimension_reduction(res, k = 3, method = "UMAP")
dimension_reduction(res, k = 4, method = "UMAP")
dimension_reduction(res, k = 5, method = "UMAP")
dimension_reduction(res, k = 6, method = "UMAP")
Following heatmap shows how subgroups are split when increasing k
:
collect_classes(res)
If matrix rows can be associated to genes, consider to use functional_enrichment(res,
...)
to perform function enrichment for the signature genes. See this vignette for more detailed explanations.
The object with results only for a single top-value method and a single partition method can be extracted as:
res = res_list["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 14581 rows and 58 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 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 1.000 1.000 1.000 0.4996 0.501 0.501
#> 3 3 1.000 0.983 0.991 0.1767 0.913 0.826
#> 4 4 1.000 0.989 0.992 0.0596 0.964 0.912
#> 5 5 0.815 0.892 0.917 0.0868 0.982 0.952
#> 6 6 0.830 0.851 0.928 0.1515 0.861 0.617
suggest_best_k()
suggests the best \(k\) based on these statistics. The rules are as follows:
suggest_best_k(res)
#> [1] 4
#> attr(,"optional")
#> [1] 2 3
There is also optional best \(k\) = 2 3 that is worth to check.
Following shows the table of the partitions (You need to click the show/hide
code output link to see it). The membership matrix (columns with name p*
)
is inferred by
clue::cl_consensus()
function with the SE
method. Basically the value in the membership matrix
represents the probability to belong to a certain group. The finall class
label for an item is determined with the group with highest probability it
belongs to.
In get_classes()
function, the entropy is calculated from the membership
matrix and the silhouette score is calculated from the consensus matrix.
cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#> class entropy silhouette p1 p2
#> SRR2082532 2 0 1 0 1
#> SRR2082533 2 0 1 0 1
#> SRR2082534 2 0 1 0 1
#> SRR2082535 2 0 1 0 1
#> SRR2082536 2 0 1 0 1
#> SRR2082530 2 0 1 0 1
#> SRR2082531 2 0 1 0 1
#> SRR2082528 2 0 1 0 1
#> SRR2082529 2 0 1 0 1
#> SRR2082526 2 0 1 0 1
#> SRR2082527 2 0 1 0 1
#> SRR2082521 2 0 1 0 1
#> SRR2082520 2 0 1 0 1
#> SRR2082518 2 0 1 0 1
#> SRR2082523 2 0 1 0 1
#> SRR2082524 2 0 1 0 1
#> SRR2082525 2 0 1 0 1
#> SRR2082522 2 0 1 0 1
#> SRR2082519 2 0 1 0 1
#> SRR2082513 2 0 1 0 1
#> SRR2082512 2 0 1 0 1
#> SRR2082516 2 0 1 0 1
#> SRR2082515 2 0 1 0 1
#> SRR2082517 2 0 1 0 1
#> SRR2082514 2 0 1 0 1
#> SRR2082508 1 0 1 1 0
#> SRR2082509 1 0 1 1 0
#> SRR2082507 1 0 1 1 0
#> SRR2082510 1 0 1 1 0
#> SRR2082511 1 0 1 1 0
#> SRR2082501 1 0 1 1 0
#> SRR2082502 1 0 1 1 0
#> SRR2082499 1 0 1 1 0
#> SRR2082500 1 0 1 1 0
#> SRR2082503 1 0 1 1 0
#> SRR2082505 1 0 1 1 0
#> SRR2082506 1 0 1 1 0
#> SRR2082504 1 0 1 1 0
#> SRR2082495 1 0 1 1 0
#> SRR2082496 1 0 1 1 0
#> SRR2082493 1 0 1 1 0
#> SRR2082494 1 0 1 1 0
#> SRR2082491 1 0 1 1 0
#> SRR2082492 1 0 1 1 0
#> SRR2082489 1 0 1 1 0
#> SRR2082490 1 0 1 1 0
#> SRR2082497 1 0 1 1 0
#> SRR2082498 1 0 1 1 0
#> SRR2082487 1 0 1 1 0
#> SRR2082488 1 0 1 1 0
#> SRR2082485 1 0 1 1 0
#> SRR2082486 1 0 1 1 0
#> SRR2082479 1 0 1 1 0
#> SRR2082480 1 0 1 1 0
#> SRR2082483 1 0 1 1 0
#> SRR2082484 1 0 1 1 0
#> SRR2082481 1 0 1 1 0
#> SRR2082482 1 0 1 1 0
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> SRR2082532 3 0.0000 1.000 0 0.000 1.000
#> SRR2082533 3 0.0000 1.000 0 0.000 1.000
#> SRR2082534 3 0.0000 1.000 0 0.000 1.000
#> SRR2082535 3 0.0000 1.000 0 0.000 1.000
#> SRR2082536 3 0.0000 1.000 0 0.000 1.000
#> SRR2082530 2 0.0000 0.966 0 1.000 0.000
#> SRR2082531 2 0.0237 0.964 0 0.996 0.004
#> SRR2082528 3 0.0000 1.000 0 0.000 1.000
#> SRR2082529 3 0.0000 1.000 0 0.000 1.000
#> SRR2082526 2 0.0000 0.966 0 1.000 0.000
#> SRR2082527 2 0.0000 0.966 0 1.000 0.000
#> SRR2082521 2 0.0000 0.966 0 1.000 0.000
#> SRR2082520 3 0.0000 1.000 0 0.000 1.000
#> SRR2082518 2 0.0000 0.966 0 1.000 0.000
#> SRR2082523 2 0.3816 0.845 0 0.852 0.148
#> SRR2082524 2 0.3816 0.845 0 0.852 0.148
#> SRR2082525 2 0.0000 0.966 0 1.000 0.000
#> SRR2082522 2 0.0000 0.966 0 1.000 0.000
#> SRR2082519 2 0.0000 0.966 0 1.000 0.000
#> SRR2082513 2 0.0000 0.966 0 1.000 0.000
#> SRR2082512 2 0.0000 0.966 0 1.000 0.000
#> SRR2082516 3 0.0000 1.000 0 0.000 1.000
#> SRR2082515 2 0.0000 0.966 0 1.000 0.000
#> SRR2082517 2 0.0000 0.966 0 1.000 0.000
#> SRR2082514 2 0.4555 0.782 0 0.800 0.200
#> SRR2082508 1 0.0000 1.000 1 0.000 0.000
#> SRR2082509 1 0.0000 1.000 1 0.000 0.000
#> SRR2082507 1 0.0000 1.000 1 0.000 0.000
#> SRR2082510 1 0.0000 1.000 1 0.000 0.000
#> SRR2082511 1 0.0000 1.000 1 0.000 0.000
#> SRR2082501 1 0.0000 1.000 1 0.000 0.000
#> SRR2082502 1 0.0000 1.000 1 0.000 0.000
#> SRR2082499 1 0.0000 1.000 1 0.000 0.000
#> SRR2082500 1 0.0000 1.000 1 0.000 0.000
#> SRR2082503 1 0.0000 1.000 1 0.000 0.000
#> SRR2082505 1 0.0000 1.000 1 0.000 0.000
#> SRR2082506 1 0.0000 1.000 1 0.000 0.000
#> SRR2082504 1 0.0000 1.000 1 0.000 0.000
#> SRR2082495 1 0.0000 1.000 1 0.000 0.000
#> SRR2082496 1 0.0000 1.000 1 0.000 0.000
#> SRR2082493 1 0.0000 1.000 1 0.000 0.000
#> SRR2082494 1 0.0000 1.000 1 0.000 0.000
#> SRR2082491 1 0.0000 1.000 1 0.000 0.000
#> SRR2082492 1 0.0000 1.000 1 0.000 0.000
#> SRR2082489 1 0.0000 1.000 1 0.000 0.000
#> SRR2082490 1 0.0000 1.000 1 0.000 0.000
#> SRR2082497 1 0.0000 1.000 1 0.000 0.000
#> SRR2082498 1 0.0000 1.000 1 0.000 0.000
#> SRR2082487 1 0.0000 1.000 1 0.000 0.000
#> SRR2082488 1 0.0000 1.000 1 0.000 0.000
#> SRR2082485 1 0.0000 1.000 1 0.000 0.000
#> SRR2082486 1 0.0000 1.000 1 0.000 0.000
#> SRR2082479 1 0.0000 1.000 1 0.000 0.000
#> SRR2082480 1 0.0000 1.000 1 0.000 0.000
#> SRR2082483 1 0.0000 1.000 1 0.000 0.000
#> SRR2082484 1 0.0000 1.000 1 0.000 0.000
#> SRR2082481 1 0.0000 1.000 1 0.000 0.000
#> SRR2082482 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
#> SRR2082532 4 0.1118 0.980 0.000 0.000 0.036 0.964
#> SRR2082533 4 0.1118 0.980 0.000 0.000 0.036 0.964
#> SRR2082534 4 0.0592 0.986 0.000 0.000 0.016 0.984
#> SRR2082535 4 0.0592 0.986 0.000 0.000 0.016 0.984
#> SRR2082536 4 0.0000 0.985 0.000 0.000 0.000 1.000
#> SRR2082530 3 0.1211 0.983 0.000 0.040 0.960 0.000
#> SRR2082531 3 0.1211 0.983 0.000 0.040 0.960 0.000
#> SRR2082528 4 0.0000 0.985 0.000 0.000 0.000 1.000
#> SRR2082529 4 0.0000 0.985 0.000 0.000 0.000 1.000
#> SRR2082526 2 0.0000 0.984 0.000 1.000 0.000 0.000
#> SRR2082527 2 0.0000 0.984 0.000 1.000 0.000 0.000
#> SRR2082521 3 0.1211 0.983 0.000 0.040 0.960 0.000
#> SRR2082520 4 0.0000 0.985 0.000 0.000 0.000 1.000
#> SRR2082518 2 0.0000 0.984 0.000 1.000 0.000 0.000
#> SRR2082523 3 0.0188 0.966 0.000 0.004 0.996 0.000
#> SRR2082524 3 0.0188 0.966 0.000 0.004 0.996 0.000
#> SRR2082525 2 0.0000 0.984 0.000 1.000 0.000 0.000
#> SRR2082522 2 0.0000 0.984 0.000 1.000 0.000 0.000
#> SRR2082519 2 0.0000 0.984 0.000 1.000 0.000 0.000
#> SRR2082513 3 0.1211 0.983 0.000 0.040 0.960 0.000
#> SRR2082512 2 0.0000 0.984 0.000 1.000 0.000 0.000
#> SRR2082516 4 0.1118 0.980 0.000 0.000 0.036 0.964
#> SRR2082515 2 0.0000 0.984 0.000 1.000 0.000 0.000
#> SRR2082517 2 0.0000 0.984 0.000 1.000 0.000 0.000
#> SRR2082514 2 0.3372 0.849 0.000 0.868 0.036 0.096
#> SRR2082508 1 0.0000 0.998 1.000 0.000 0.000 0.000
#> SRR2082509 1 0.0188 0.998 0.996 0.000 0.004 0.000
#> SRR2082507 1 0.0188 0.998 0.996 0.000 0.004 0.000
#> SRR2082510 1 0.0188 0.998 0.996 0.000 0.004 0.000
#> SRR2082511 1 0.0188 0.998 0.996 0.000 0.004 0.000
#> SRR2082501 1 0.0000 0.998 1.000 0.000 0.000 0.000
#> SRR2082502 1 0.0000 0.998 1.000 0.000 0.000 0.000
#> SRR2082499 1 0.0000 0.998 1.000 0.000 0.000 0.000
#> SRR2082500 1 0.0000 0.998 1.000 0.000 0.000 0.000
#> SRR2082503 1 0.0188 0.998 0.996 0.000 0.004 0.000
#> SRR2082505 1 0.0188 0.998 0.996 0.000 0.004 0.000
#> SRR2082506 1 0.0000 0.998 1.000 0.000 0.000 0.000
#> SRR2082504 1 0.0000 0.998 1.000 0.000 0.000 0.000
#> SRR2082495 1 0.0188 0.998 0.996 0.000 0.004 0.000
#> SRR2082496 1 0.0188 0.998 0.996 0.000 0.004 0.000
#> SRR2082493 1 0.0188 0.998 0.996 0.000 0.004 0.000
#> SRR2082494 1 0.0188 0.998 0.996 0.000 0.004 0.000
#> SRR2082491 1 0.0000 0.998 1.000 0.000 0.000 0.000
#> SRR2082492 1 0.0188 0.998 0.996 0.000 0.004 0.000
#> SRR2082489 1 0.0000 0.998 1.000 0.000 0.000 0.000
#> SRR2082490 1 0.0000 0.998 1.000 0.000 0.000 0.000
#> SRR2082497 1 0.0000 0.998 1.000 0.000 0.000 0.000
#> SRR2082498 1 0.0000 0.998 1.000 0.000 0.000 0.000
#> SRR2082487 1 0.0000 0.998 1.000 0.000 0.000 0.000
#> SRR2082488 1 0.0000 0.998 1.000 0.000 0.000 0.000
#> SRR2082485 1 0.0000 0.998 1.000 0.000 0.000 0.000
#> SRR2082486 1 0.0000 0.998 1.000 0.000 0.000 0.000
#> SRR2082479 1 0.0000 0.998 1.000 0.000 0.000 0.000
#> SRR2082480 1 0.0000 0.998 1.000 0.000 0.000 0.000
#> SRR2082483 1 0.0188 0.998 0.996 0.000 0.004 0.000
#> SRR2082484 1 0.0188 0.998 0.996 0.000 0.004 0.000
#> SRR2082481 1 0.0000 0.998 1.000 0.000 0.000 0.000
#> SRR2082482 1 0.0000 0.998 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
#> SRR2082532 5 0.3895 0.810 0.000 0.000 0.000 0.320 0.680
#> SRR2082533 5 0.3895 0.810 0.000 0.000 0.000 0.320 0.680
#> SRR2082534 4 0.2280 0.839 0.000 0.000 0.000 0.880 0.120
#> SRR2082535 4 0.1965 0.870 0.000 0.000 0.000 0.904 0.096
#> SRR2082536 4 0.0000 0.938 0.000 0.000 0.000 1.000 0.000
#> SRR2082530 3 0.0000 0.996 0.000 0.000 1.000 0.000 0.000
#> SRR2082531 3 0.0000 0.996 0.000 0.000 1.000 0.000 0.000
#> SRR2082528 4 0.0000 0.938 0.000 0.000 0.000 1.000 0.000
#> SRR2082529 4 0.0000 0.938 0.000 0.000 0.000 1.000 0.000
#> SRR2082526 2 0.0000 1.000 0.000 1.000 0.000 0.000 0.000
#> SRR2082527 2 0.0000 1.000 0.000 1.000 0.000 0.000 0.000
#> SRR2082521 3 0.0000 0.996 0.000 0.000 1.000 0.000 0.000
#> SRR2082520 4 0.0000 0.938 0.000 0.000 0.000 1.000 0.000
#> SRR2082518 2 0.0000 1.000 0.000 1.000 0.000 0.000 0.000
#> SRR2082523 3 0.0162 0.994 0.000 0.000 0.996 0.000 0.004
#> SRR2082524 3 0.0510 0.985 0.000 0.000 0.984 0.000 0.016
#> SRR2082525 2 0.0000 1.000 0.000 1.000 0.000 0.000 0.000
#> SRR2082522 2 0.0000 1.000 0.000 1.000 0.000 0.000 0.000
#> SRR2082519 2 0.0000 1.000 0.000 1.000 0.000 0.000 0.000
#> SRR2082513 3 0.0000 0.996 0.000 0.000 1.000 0.000 0.000
#> SRR2082512 2 0.0000 1.000 0.000 1.000 0.000 0.000 0.000
#> SRR2082516 5 0.3895 0.810 0.000 0.000 0.000 0.320 0.680
#> SRR2082515 2 0.0000 1.000 0.000 1.000 0.000 0.000 0.000
#> SRR2082517 2 0.0000 1.000 0.000 1.000 0.000 0.000 0.000
#> SRR2082514 5 0.4890 0.553 0.000 0.256 0.000 0.064 0.680
#> SRR2082508 1 0.0000 0.902 1.000 0.000 0.000 0.000 0.000
#> SRR2082509 1 0.3508 0.795 0.748 0.000 0.000 0.000 0.252
#> SRR2082507 1 0.2020 0.874 0.900 0.000 0.000 0.000 0.100
#> SRR2082510 1 0.3895 0.754 0.680 0.000 0.000 0.000 0.320
#> SRR2082511 1 0.3895 0.754 0.680 0.000 0.000 0.000 0.320
#> SRR2082501 1 0.0000 0.902 1.000 0.000 0.000 0.000 0.000
#> SRR2082502 1 0.0000 0.902 1.000 0.000 0.000 0.000 0.000
#> SRR2082499 1 0.0000 0.902 1.000 0.000 0.000 0.000 0.000
#> SRR2082500 1 0.0000 0.902 1.000 0.000 0.000 0.000 0.000
#> SRR2082503 1 0.2020 0.874 0.900 0.000 0.000 0.000 0.100
#> SRR2082505 1 0.1671 0.882 0.924 0.000 0.000 0.000 0.076
#> SRR2082506 1 0.0000 0.902 1.000 0.000 0.000 0.000 0.000
#> SRR2082504 1 0.0000 0.902 1.000 0.000 0.000 0.000 0.000
#> SRR2082495 1 0.3895 0.754 0.680 0.000 0.000 0.000 0.320
#> SRR2082496 1 0.3895 0.754 0.680 0.000 0.000 0.000 0.320
#> SRR2082493 1 0.3895 0.754 0.680 0.000 0.000 0.000 0.320
#> SRR2082494 1 0.3895 0.754 0.680 0.000 0.000 0.000 0.320
#> SRR2082491 1 0.0794 0.896 0.972 0.000 0.000 0.000 0.028
#> SRR2082492 1 0.2648 0.851 0.848 0.000 0.000 0.000 0.152
#> SRR2082489 1 0.0000 0.902 1.000 0.000 0.000 0.000 0.000
#> SRR2082490 1 0.0000 0.902 1.000 0.000 0.000 0.000 0.000
#> SRR2082497 1 0.0000 0.902 1.000 0.000 0.000 0.000 0.000
#> SRR2082498 1 0.0000 0.902 1.000 0.000 0.000 0.000 0.000
#> SRR2082487 1 0.0000 0.902 1.000 0.000 0.000 0.000 0.000
#> SRR2082488 1 0.0000 0.902 1.000 0.000 0.000 0.000 0.000
#> SRR2082485 1 0.0290 0.901 0.992 0.000 0.000 0.000 0.008
#> SRR2082486 1 0.0000 0.902 1.000 0.000 0.000 0.000 0.000
#> SRR2082479 1 0.0000 0.902 1.000 0.000 0.000 0.000 0.000
#> SRR2082480 1 0.0000 0.902 1.000 0.000 0.000 0.000 0.000
#> SRR2082483 1 0.3895 0.754 0.680 0.000 0.000 0.000 0.320
#> SRR2082484 1 0.3876 0.756 0.684 0.000 0.000 0.000 0.316
#> SRR2082481 1 0.0000 0.902 1.000 0.000 0.000 0.000 0.000
#> SRR2082482 1 0.0000 0.902 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
#> SRR2082532 5 0.0000 1.0000 0.000 0 0.000 0.00 1.000 0.000
#> SRR2082533 5 0.0000 1.0000 0.000 0 0.000 0.00 1.000 0.000
#> SRR2082534 4 0.2454 0.8451 0.000 0 0.000 0.84 0.160 0.000
#> SRR2082535 4 0.2454 0.8451 0.000 0 0.000 0.84 0.160 0.000
#> SRR2082536 4 0.0000 0.9342 0.000 0 0.000 1.00 0.000 0.000
#> SRR2082530 6 0.0000 0.9960 0.000 0 0.000 0.00 0.000 1.000
#> SRR2082531 6 0.0000 0.9960 0.000 0 0.000 0.00 0.000 1.000
#> SRR2082528 4 0.0000 0.9342 0.000 0 0.000 1.00 0.000 0.000
#> SRR2082529 4 0.0000 0.9342 0.000 0 0.000 1.00 0.000 0.000
#> SRR2082526 2 0.0000 1.0000 0.000 1 0.000 0.00 0.000 0.000
#> SRR2082527 2 0.0000 1.0000 0.000 1 0.000 0.00 0.000 0.000
#> SRR2082521 6 0.0000 0.9960 0.000 0 0.000 0.00 0.000 1.000
#> SRR2082520 4 0.0000 0.9342 0.000 0 0.000 1.00 0.000 0.000
#> SRR2082518 2 0.0000 1.0000 0.000 1 0.000 0.00 0.000 0.000
#> SRR2082523 6 0.0146 0.9940 0.000 0 0.000 0.00 0.004 0.996
#> SRR2082524 6 0.0458 0.9847 0.000 0 0.000 0.00 0.016 0.984
#> SRR2082525 2 0.0000 1.0000 0.000 1 0.000 0.00 0.000 0.000
#> SRR2082522 2 0.0000 1.0000 0.000 1 0.000 0.00 0.000 0.000
#> SRR2082519 2 0.0000 1.0000 0.000 1 0.000 0.00 0.000 0.000
#> SRR2082513 6 0.0000 0.9960 0.000 0 0.000 0.00 0.000 1.000
#> SRR2082512 2 0.0000 1.0000 0.000 1 0.000 0.00 0.000 0.000
#> SRR2082516 5 0.0000 1.0000 0.000 0 0.000 0.00 1.000 0.000
#> SRR2082515 2 0.0000 1.0000 0.000 1 0.000 0.00 0.000 0.000
#> SRR2082517 2 0.0000 1.0000 0.000 1 0.000 0.00 0.000 0.000
#> SRR2082514 5 0.0000 1.0000 0.000 0 0.000 0.00 1.000 0.000
#> SRR2082508 1 0.0363 0.8762 0.988 0 0.012 0.00 0.000 0.000
#> SRR2082509 3 0.3797 0.3784 0.420 0 0.580 0.00 0.000 0.000
#> SRR2082507 1 0.3817 0.0867 0.568 0 0.432 0.00 0.000 0.000
#> SRR2082510 3 0.0458 0.7955 0.016 0 0.984 0.00 0.000 0.000
#> SRR2082511 3 0.1610 0.8003 0.084 0 0.916 0.00 0.000 0.000
#> SRR2082501 1 0.0260 0.8756 0.992 0 0.008 0.00 0.000 0.000
#> SRR2082502 1 0.0260 0.8756 0.992 0 0.008 0.00 0.000 0.000
#> SRR2082499 1 0.0260 0.8756 0.992 0 0.008 0.00 0.000 0.000
#> SRR2082500 1 0.0260 0.8756 0.992 0 0.008 0.00 0.000 0.000
#> SRR2082503 1 0.3717 0.2587 0.616 0 0.384 0.00 0.000 0.000
#> SRR2082505 1 0.2883 0.6516 0.788 0 0.212 0.00 0.000 0.000
#> SRR2082506 1 0.0260 0.8761 0.992 0 0.008 0.00 0.000 0.000
#> SRR2082504 1 0.0260 0.8754 0.992 0 0.008 0.00 0.000 0.000
#> SRR2082495 3 0.1007 0.8102 0.044 0 0.956 0.00 0.000 0.000
#> SRR2082496 3 0.1204 0.8096 0.056 0 0.944 0.00 0.000 0.000
#> SRR2082493 3 0.0865 0.8100 0.036 0 0.964 0.00 0.000 0.000
#> SRR2082494 3 0.0458 0.7967 0.016 0 0.984 0.00 0.000 0.000
#> SRR2082491 1 0.3515 0.5371 0.676 0 0.324 0.00 0.000 0.000
#> SRR2082492 3 0.3578 0.4794 0.340 0 0.660 0.00 0.000 0.000
#> SRR2082489 1 0.2135 0.8282 0.872 0 0.128 0.00 0.000 0.000
#> SRR2082490 1 0.2135 0.8282 0.872 0 0.128 0.00 0.000 0.000
#> SRR2082497 1 0.0260 0.8756 0.992 0 0.008 0.00 0.000 0.000
#> SRR2082498 1 0.0260 0.8756 0.992 0 0.008 0.00 0.000 0.000
#> SRR2082487 1 0.2135 0.8282 0.872 0 0.128 0.00 0.000 0.000
#> SRR2082488 1 0.2135 0.8282 0.872 0 0.128 0.00 0.000 0.000
#> SRR2082485 1 0.2697 0.7916 0.812 0 0.188 0.00 0.000 0.000
#> SRR2082486 1 0.2697 0.7876 0.812 0 0.188 0.00 0.000 0.000
#> SRR2082479 1 0.0260 0.8758 0.992 0 0.008 0.00 0.000 0.000
#> SRR2082480 1 0.0146 0.8752 0.996 0 0.004 0.00 0.000 0.000
#> SRR2082483 3 0.2883 0.7406 0.212 0 0.788 0.00 0.000 0.000
#> SRR2082484 3 0.2941 0.7365 0.220 0 0.780 0.00 0.000 0.000
#> SRR2082481 1 0.0000 0.8755 1.000 0 0.000 0.00 0.000 0.000
#> SRR2082482 1 0.0458 0.8738 0.984 0 0.016 0.00 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 14581 rows and 58 columns.
#> Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'CV' method.
#> Subgroups are detected by 'mclust' method.
#> Performed in total 1250 partitions by row resampling.
#> Best k for subgroups seems to be 2.
#>
#> Following methods can be applied to this 'ConsensusPartition' object:
#> [1] "cola_report" "collect_classes" "collect_plots"
#> [4] "collect_stats" "colnames" "compare_signatures"
#> [7] "consensus_heatmap" "dimension_reduction" "functional_enrichment"
#> [10] "get_anno_col" "get_anno" "get_classes"
#> [13] "get_consensus" "get_matrix" "get_membership"
#> [16] "get_param" "get_signatures" "get_stats"
#> [19] "is_best_k" "is_stable_k" "membership_heatmap"
#> [22] "ncol" "nrow" "plot_ecdf"
#> [25] "rownames" "select_partition_number" "show"
#> [28] "suggest_best_k" "test_to_known_factors"
collect_plots()
function collects all the plots made from res
for all k
(number of partitions)
into one single page to provide an easy and fast comparison between different k
.
collect_plots(res)
The plots are:
k
and the heatmap of
predicted classes for each k
.k
.k
.k
.All the plots in panels can be made by individual functions and they are plotted later in this section.
select_partition_number()
produces several plots showing different
statistics for choosing “optimized” k
. There are following statistics:
k
;k
, the area increased is defined as \(A_k - A_{k-1}\).The detailed explanations of these statistics can be found in the cola vignette.
Generally speaking, lower PAC score, higher mean silhouette score or higher
concordance corresponds to better partition. Rand index and Jaccard index
measure how similar the current partition is compared to partition with k-1
.
If they are too similar, we won't accept k
is better than k-1
.
select_partition_number(res)
The numeric values for all these statistics can be obtained by get_stats()
.
get_stats(res)
#> k 1-PAC mean_silhouette concordance area_increased Rand Jaccard
#> 2 2 1.000 1.000 1.000 0.4996 0.501 0.501
#> 3 3 0.774 0.918 0.881 0.1887 0.909 0.819
#> 4 4 0.661 0.777 0.805 0.0989 0.967 0.920
#> 5 5 0.651 0.637 0.802 0.1223 0.891 0.716
#> 6 6 0.648 0.627 0.795 0.0850 0.944 0.802
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
#> SRR2082532 2 0.0000 1.000 0.000 1.000
#> SRR2082533 2 0.0000 1.000 0.000 1.000
#> SRR2082534 2 0.0000 1.000 0.000 1.000
#> SRR2082535 2 0.0000 1.000 0.000 1.000
#> SRR2082536 2 0.0000 1.000 0.000 1.000
#> SRR2082530 2 0.0000 1.000 0.000 1.000
#> SRR2082531 2 0.0000 1.000 0.000 1.000
#> SRR2082528 2 0.0000 1.000 0.000 1.000
#> SRR2082529 2 0.0000 1.000 0.000 1.000
#> SRR2082526 2 0.0000 1.000 0.000 1.000
#> SRR2082527 2 0.0000 1.000 0.000 1.000
#> SRR2082521 2 0.0000 1.000 0.000 1.000
#> SRR2082520 2 0.0000 1.000 0.000 1.000
#> SRR2082518 2 0.0000 1.000 0.000 1.000
#> SRR2082523 2 0.0000 1.000 0.000 1.000
#> SRR2082524 2 0.0000 1.000 0.000 1.000
#> SRR2082525 2 0.0000 1.000 0.000 1.000
#> SRR2082522 2 0.0000 1.000 0.000 1.000
#> SRR2082519 2 0.0000 1.000 0.000 1.000
#> SRR2082513 2 0.0000 1.000 0.000 1.000
#> SRR2082512 2 0.0000 1.000 0.000 1.000
#> SRR2082516 2 0.0000 1.000 0.000 1.000
#> SRR2082515 2 0.0000 1.000 0.000 1.000
#> SRR2082517 2 0.0000 1.000 0.000 1.000
#> SRR2082514 2 0.0000 1.000 0.000 1.000
#> SRR2082508 1 0.0000 1.000 1.000 0.000
#> SRR2082509 1 0.0000 1.000 1.000 0.000
#> SRR2082507 1 0.0376 0.996 0.996 0.004
#> SRR2082510 1 0.0376 0.996 0.996 0.004
#> SRR2082511 1 0.0000 1.000 1.000 0.000
#> SRR2082501 1 0.0000 1.000 1.000 0.000
#> SRR2082502 1 0.0000 1.000 1.000 0.000
#> SRR2082499 1 0.0000 1.000 1.000 0.000
#> SRR2082500 1 0.0000 1.000 1.000 0.000
#> SRR2082503 1 0.0000 1.000 1.000 0.000
#> SRR2082505 1 0.0000 1.000 1.000 0.000
#> SRR2082506 1 0.0000 1.000 1.000 0.000
#> SRR2082504 1 0.0000 1.000 1.000 0.000
#> SRR2082495 1 0.0000 1.000 1.000 0.000
#> SRR2082496 1 0.0000 1.000 1.000 0.000
#> SRR2082493 1 0.0000 1.000 1.000 0.000
#> SRR2082494 1 0.0000 1.000 1.000 0.000
#> SRR2082491 1 0.0000 1.000 1.000 0.000
#> SRR2082492 1 0.0000 1.000 1.000 0.000
#> SRR2082489 1 0.0000 1.000 1.000 0.000
#> SRR2082490 1 0.0000 1.000 1.000 0.000
#> SRR2082497 1 0.0000 1.000 1.000 0.000
#> SRR2082498 1 0.0000 1.000 1.000 0.000
#> SRR2082487 1 0.0000 1.000 1.000 0.000
#> SRR2082488 1 0.0000 1.000 1.000 0.000
#> SRR2082485 1 0.0000 1.000 1.000 0.000
#> SRR2082486 1 0.0000 1.000 1.000 0.000
#> SRR2082479 1 0.0000 1.000 1.000 0.000
#> SRR2082480 1 0.0000 1.000 1.000 0.000
#> SRR2082483 1 0.0000 1.000 1.000 0.000
#> SRR2082484 1 0.0000 1.000 1.000 0.000
#> SRR2082481 1 0.0000 1.000 1.000 0.000
#> SRR2082482 1 0.0000 1.000 1.000 0.000
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> SRR2082532 3 0.6168 0.878 0.000 0.412 0.588
#> SRR2082533 3 0.6140 0.882 0.000 0.404 0.596
#> SRR2082534 3 0.5591 0.898 0.000 0.304 0.696
#> SRR2082535 3 0.5591 0.898 0.000 0.304 0.696
#> SRR2082536 3 0.5591 0.898 0.000 0.304 0.696
#> SRR2082530 2 0.1411 0.928 0.000 0.964 0.036
#> SRR2082531 2 0.1411 0.928 0.000 0.964 0.036
#> SRR2082528 3 0.5591 0.898 0.000 0.304 0.696
#> SRR2082529 3 0.5591 0.898 0.000 0.304 0.696
#> SRR2082526 2 0.0747 0.933 0.000 0.984 0.016
#> SRR2082527 2 0.0747 0.933 0.000 0.984 0.016
#> SRR2082521 2 0.2537 0.931 0.000 0.920 0.080
#> SRR2082520 3 0.6225 0.854 0.000 0.432 0.568
#> SRR2082518 2 0.2066 0.936 0.000 0.940 0.060
#> SRR2082523 2 0.1411 0.928 0.000 0.964 0.036
#> SRR2082524 2 0.1411 0.928 0.000 0.964 0.036
#> SRR2082525 2 0.0747 0.933 0.000 0.984 0.016
#> SRR2082522 3 0.6225 0.853 0.000 0.432 0.568
#> SRR2082519 2 0.1860 0.936 0.000 0.948 0.052
#> SRR2082513 2 0.2356 0.932 0.000 0.928 0.072
#> SRR2082512 2 0.2066 0.936 0.000 0.940 0.060
#> SRR2082516 3 0.6204 0.857 0.000 0.424 0.576
#> SRR2082515 2 0.1860 0.936 0.000 0.948 0.052
#> SRR2082517 2 0.1860 0.936 0.000 0.948 0.052
#> SRR2082514 2 0.2066 0.928 0.000 0.940 0.060
#> SRR2082508 1 0.4399 0.866 0.812 0.000 0.188
#> SRR2082509 1 0.2356 0.930 0.928 0.000 0.072
#> SRR2082507 1 0.4504 0.863 0.804 0.000 0.196
#> SRR2082510 1 0.4796 0.848 0.780 0.000 0.220
#> SRR2082511 1 0.4178 0.883 0.828 0.000 0.172
#> SRR2082501 1 0.1411 0.939 0.964 0.000 0.036
#> SRR2082502 1 0.1411 0.939 0.964 0.000 0.036
#> SRR2082499 1 0.1643 0.940 0.956 0.000 0.044
#> SRR2082500 1 0.1643 0.940 0.956 0.000 0.044
#> SRR2082503 1 0.2261 0.932 0.932 0.000 0.068
#> SRR2082505 1 0.2261 0.932 0.932 0.000 0.068
#> SRR2082506 1 0.1411 0.939 0.964 0.000 0.036
#> SRR2082504 1 0.1411 0.939 0.964 0.000 0.036
#> SRR2082495 1 0.2448 0.930 0.924 0.000 0.076
#> SRR2082496 1 0.2448 0.930 0.924 0.000 0.076
#> SRR2082493 1 0.2711 0.926 0.912 0.000 0.088
#> SRR2082494 1 0.2711 0.926 0.912 0.000 0.088
#> SRR2082491 1 0.0424 0.939 0.992 0.000 0.008
#> SRR2082492 1 0.0592 0.940 0.988 0.000 0.012
#> SRR2082489 1 0.1411 0.935 0.964 0.000 0.036
#> SRR2082490 1 0.1411 0.935 0.964 0.000 0.036
#> SRR2082497 1 0.1411 0.939 0.964 0.000 0.036
#> SRR2082498 1 0.1411 0.939 0.964 0.000 0.036
#> SRR2082487 1 0.1411 0.935 0.964 0.000 0.036
#> SRR2082488 1 0.1411 0.935 0.964 0.000 0.036
#> SRR2082485 1 0.1529 0.935 0.960 0.000 0.040
#> SRR2082486 1 0.1529 0.935 0.960 0.000 0.040
#> SRR2082479 1 0.1411 0.939 0.964 0.000 0.036
#> SRR2082480 1 0.1411 0.939 0.964 0.000 0.036
#> SRR2082483 1 0.4931 0.853 0.768 0.000 0.232
#> SRR2082484 1 0.4931 0.853 0.768 0.000 0.232
#> SRR2082481 1 0.1289 0.940 0.968 0.000 0.032
#> SRR2082482 1 0.1289 0.940 0.968 0.000 0.032
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> SRR2082532 4 0.4053 0.490 0.000 0.228 0.004 0.768
#> SRR2082533 4 0.4053 0.490 0.000 0.228 0.004 0.768
#> SRR2082534 4 0.0921 0.765 0.000 0.000 0.028 0.972
#> SRR2082535 4 0.0921 0.765 0.000 0.000 0.028 0.972
#> SRR2082536 4 0.0000 0.774 0.000 0.000 0.000 1.000
#> SRR2082530 3 0.5902 0.884 0.000 0.160 0.700 0.140
#> SRR2082531 3 0.5902 0.884 0.000 0.160 0.700 0.140
#> SRR2082528 4 0.0000 0.774 0.000 0.000 0.000 1.000
#> SRR2082529 4 0.0000 0.774 0.000 0.000 0.000 1.000
#> SRR2082526 2 0.6163 0.624 0.000 0.676 0.164 0.160
#> SRR2082527 2 0.6163 0.624 0.000 0.676 0.164 0.160
#> SRR2082521 3 0.6968 0.761 0.000 0.308 0.552 0.140
#> SRR2082520 4 0.5083 0.597 0.000 0.248 0.036 0.716
#> SRR2082518 2 0.3266 0.707 0.000 0.832 0.000 0.168
#> SRR2082523 3 0.5905 0.885 0.000 0.156 0.700 0.144
#> SRR2082524 3 0.5905 0.885 0.000 0.156 0.700 0.144
#> SRR2082525 2 0.6163 0.624 0.000 0.676 0.164 0.160
#> SRR2082522 4 0.4356 0.534 0.000 0.292 0.000 0.708
#> SRR2082519 2 0.5024 0.627 0.000 0.632 0.008 0.360
#> SRR2082513 3 0.7165 0.691 0.000 0.356 0.500 0.144
#> SRR2082512 2 0.3266 0.707 0.000 0.832 0.000 0.168
#> SRR2082516 4 0.4900 0.613 0.000 0.236 0.032 0.732
#> SRR2082515 2 0.4936 0.635 0.000 0.652 0.008 0.340
#> SRR2082517 2 0.5452 0.620 0.000 0.616 0.024 0.360
#> SRR2082514 2 0.5417 0.533 0.000 0.572 0.016 0.412
#> SRR2082508 1 0.3801 0.815 0.780 0.000 0.220 0.000
#> SRR2082509 1 0.2408 0.875 0.896 0.000 0.104 0.000
#> SRR2082507 1 0.3982 0.813 0.776 0.000 0.220 0.004
#> SRR2082510 1 0.8448 0.499 0.504 0.200 0.240 0.056
#> SRR2082511 1 0.4901 0.807 0.764 0.044 0.188 0.004
#> SRR2082501 1 0.1398 0.892 0.956 0.004 0.040 0.000
#> SRR2082502 1 0.1398 0.892 0.956 0.004 0.040 0.000
#> SRR2082499 1 0.1398 0.892 0.956 0.004 0.040 0.000
#> SRR2082500 1 0.1398 0.892 0.956 0.004 0.040 0.000
#> SRR2082503 1 0.2973 0.866 0.856 0.000 0.144 0.000
#> SRR2082505 1 0.2760 0.868 0.872 0.000 0.128 0.000
#> SRR2082506 1 0.1398 0.892 0.956 0.004 0.040 0.000
#> SRR2082504 1 0.1398 0.892 0.956 0.004 0.040 0.000
#> SRR2082495 1 0.2921 0.862 0.860 0.000 0.140 0.000
#> SRR2082496 1 0.2921 0.862 0.860 0.000 0.140 0.000
#> SRR2082493 1 0.3208 0.857 0.848 0.004 0.148 0.000
#> SRR2082494 1 0.3208 0.857 0.848 0.004 0.148 0.000
#> SRR2082491 1 0.0657 0.892 0.984 0.004 0.012 0.000
#> SRR2082492 1 0.0657 0.892 0.984 0.004 0.012 0.000
#> SRR2082489 1 0.1629 0.886 0.952 0.024 0.024 0.000
#> SRR2082490 1 0.1629 0.886 0.952 0.024 0.024 0.000
#> SRR2082497 1 0.1398 0.892 0.956 0.004 0.040 0.000
#> SRR2082498 1 0.1398 0.892 0.956 0.004 0.040 0.000
#> SRR2082487 1 0.1629 0.886 0.952 0.024 0.024 0.000
#> SRR2082488 1 0.1629 0.886 0.952 0.024 0.024 0.000
#> SRR2082485 1 0.1629 0.886 0.952 0.024 0.024 0.000
#> SRR2082486 1 0.1629 0.886 0.952 0.024 0.024 0.000
#> SRR2082479 1 0.1398 0.892 0.956 0.004 0.040 0.000
#> SRR2082480 1 0.1398 0.892 0.956 0.004 0.040 0.000
#> SRR2082483 1 0.8448 0.502 0.504 0.200 0.240 0.056
#> SRR2082484 1 0.8448 0.502 0.504 0.200 0.240 0.056
#> SRR2082481 1 0.1209 0.892 0.964 0.004 0.032 0.000
#> SRR2082482 1 0.1209 0.892 0.964 0.004 0.032 0.000
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> SRR2082532 4 0.4769 0.6160 0.000 0.056 0.000 0.688 0.256
#> SRR2082533 4 0.4719 0.6201 0.000 0.056 0.000 0.696 0.248
#> SRR2082534 4 0.1410 0.7393 0.000 0.000 0.000 0.940 0.060
#> SRR2082535 4 0.1410 0.7393 0.000 0.000 0.000 0.940 0.060
#> SRR2082536 4 0.0000 0.7399 0.000 0.000 0.000 1.000 0.000
#> SRR2082530 5 0.1041 0.8625 0.000 0.032 0.000 0.004 0.964
#> SRR2082531 5 0.1041 0.8625 0.000 0.032 0.000 0.004 0.964
#> SRR2082528 4 0.0000 0.7399 0.000 0.000 0.000 1.000 0.000
#> SRR2082529 4 0.0000 0.7399 0.000 0.000 0.000 1.000 0.000
#> SRR2082526 2 0.3391 0.5734 0.000 0.800 0.000 0.012 0.188
#> SRR2082527 2 0.3391 0.5734 0.000 0.800 0.000 0.012 0.188
#> SRR2082521 5 0.3300 0.7576 0.000 0.204 0.000 0.004 0.792
#> SRR2082520 4 0.3809 0.6357 0.000 0.256 0.000 0.736 0.008
#> SRR2082518 2 0.0912 0.6312 0.000 0.972 0.000 0.012 0.016
#> SRR2082523 5 0.1768 0.8654 0.000 0.072 0.000 0.004 0.924
#> SRR2082524 5 0.1768 0.8654 0.000 0.072 0.000 0.004 0.924
#> SRR2082525 2 0.3391 0.5734 0.000 0.800 0.000 0.012 0.188
#> SRR2082522 4 0.4590 0.3568 0.000 0.420 0.000 0.568 0.012
#> SRR2082519 2 0.5080 0.2952 0.000 0.588 0.000 0.368 0.044
#> SRR2082513 5 0.3906 0.6786 0.000 0.292 0.000 0.004 0.704
#> SRR2082512 2 0.1117 0.6309 0.000 0.964 0.000 0.016 0.020
#> SRR2082516 4 0.3724 0.6567 0.000 0.204 0.000 0.776 0.020
#> SRR2082515 2 0.4990 0.3007 0.000 0.600 0.000 0.360 0.040
#> SRR2082517 2 0.5263 0.2870 0.000 0.576 0.000 0.368 0.056
#> SRR2082514 4 0.6657 0.2124 0.000 0.352 0.000 0.416 0.232
#> SRR2082508 1 0.4359 0.2533 0.584 0.004 0.412 0.000 0.000
#> SRR2082509 1 0.4088 0.5638 0.688 0.000 0.304 0.000 0.008
#> SRR2082507 1 0.4560 0.0658 0.508 0.008 0.484 0.000 0.000
#> SRR2082510 3 0.1608 0.6787 0.072 0.000 0.928 0.000 0.000
#> SRR2082511 3 0.3424 0.6878 0.240 0.000 0.760 0.000 0.000
#> SRR2082501 1 0.0693 0.7663 0.980 0.000 0.012 0.000 0.008
#> SRR2082502 1 0.0693 0.7663 0.980 0.000 0.012 0.000 0.008
#> SRR2082499 1 0.1168 0.7631 0.960 0.000 0.032 0.000 0.008
#> SRR2082500 1 0.0992 0.7660 0.968 0.000 0.024 0.000 0.008
#> SRR2082503 1 0.3519 0.6270 0.776 0.000 0.216 0.000 0.008
#> SRR2082505 1 0.3551 0.6167 0.772 0.000 0.220 0.000 0.008
#> SRR2082506 1 0.0451 0.7654 0.988 0.000 0.008 0.000 0.004
#> SRR2082504 1 0.0324 0.7680 0.992 0.004 0.004 0.000 0.000
#> SRR2082495 1 0.4183 0.5259 0.668 0.000 0.324 0.000 0.008
#> SRR2082496 1 0.4183 0.5259 0.668 0.000 0.324 0.000 0.008
#> SRR2082493 3 0.4210 0.4423 0.412 0.000 0.588 0.000 0.000
#> SRR2082494 3 0.4210 0.4423 0.412 0.000 0.588 0.000 0.000
#> SRR2082491 1 0.2753 0.7345 0.856 0.000 0.136 0.000 0.008
#> SRR2082492 1 0.2753 0.7355 0.856 0.000 0.136 0.000 0.008
#> SRR2082489 1 0.4622 0.6155 0.700 0.012 0.264 0.000 0.024
#> SRR2082490 1 0.4622 0.6155 0.700 0.012 0.264 0.000 0.024
#> SRR2082497 1 0.0290 0.7665 0.992 0.000 0.008 0.000 0.000
#> SRR2082498 1 0.0162 0.7691 0.996 0.000 0.000 0.000 0.004
#> SRR2082487 1 0.4486 0.6335 0.712 0.012 0.256 0.000 0.020
#> SRR2082488 1 0.4407 0.6465 0.724 0.012 0.244 0.000 0.020
#> SRR2082485 1 0.4217 0.6685 0.740 0.008 0.232 0.000 0.020
#> SRR2082486 1 0.4217 0.6685 0.740 0.008 0.232 0.000 0.020
#> SRR2082479 1 0.0703 0.7716 0.976 0.000 0.024 0.000 0.000
#> SRR2082480 1 0.0703 0.7717 0.976 0.000 0.024 0.000 0.000
#> SRR2082483 3 0.2891 0.7218 0.176 0.000 0.824 0.000 0.000
#> SRR2082484 3 0.2891 0.7218 0.176 0.000 0.824 0.000 0.000
#> SRR2082481 1 0.1026 0.7714 0.968 0.004 0.024 0.000 0.004
#> SRR2082482 1 0.1026 0.7714 0.968 0.004 0.024 0.000 0.004
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> SRR2082532 4 0.3893 0.727 0.000 0.020 0.000 0.784 0.148 0.048
#> SRR2082533 4 0.3893 0.727 0.000 0.020 0.000 0.784 0.148 0.048
#> SRR2082534 4 0.0000 0.802 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR2082535 4 0.0000 0.802 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR2082536 4 0.0260 0.801 0.000 0.000 0.000 0.992 0.000 0.008
#> SRR2082530 5 0.0000 0.927 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR2082531 5 0.0000 0.927 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR2082528 4 0.0260 0.801 0.000 0.000 0.000 0.992 0.000 0.008
#> SRR2082529 4 0.0260 0.801 0.000 0.000 0.000 0.992 0.000 0.008
#> SRR2082526 2 0.3593 0.600 0.000 0.788 0.000 0.004 0.164 0.044
#> SRR2082527 2 0.3593 0.600 0.000 0.788 0.000 0.004 0.164 0.044
#> SRR2082521 5 0.3000 0.855 0.000 0.124 0.000 0.004 0.840 0.032
#> SRR2082520 4 0.4488 0.708 0.000 0.092 0.028 0.748 0.000 0.132
#> SRR2082518 2 0.0603 0.645 0.000 0.980 0.000 0.004 0.016 0.000
#> SRR2082523 5 0.0405 0.927 0.000 0.000 0.000 0.004 0.988 0.008
#> SRR2082524 5 0.0405 0.927 0.000 0.000 0.000 0.004 0.988 0.008
#> SRR2082525 2 0.3593 0.600 0.000 0.788 0.000 0.004 0.164 0.044
#> SRR2082522 4 0.6185 0.201 0.000 0.352 0.028 0.484 0.004 0.132
#> SRR2082519 2 0.5743 0.279 0.000 0.544 0.016 0.356 0.032 0.052
#> SRR2082513 5 0.3168 0.839 0.000 0.148 0.000 0.004 0.820 0.028
#> SRR2082512 2 0.1036 0.643 0.000 0.964 0.000 0.008 0.024 0.004
#> SRR2082516 4 0.4331 0.720 0.000 0.096 0.028 0.764 0.000 0.112
#> SRR2082515 2 0.5929 0.285 0.000 0.544 0.028 0.344 0.032 0.052
#> SRR2082517 2 0.5743 0.279 0.000 0.544 0.016 0.356 0.032 0.052
#> SRR2082514 4 0.6119 0.571 0.000 0.176 0.000 0.596 0.152 0.076
#> SRR2082508 1 0.4456 0.360 0.524 0.000 0.448 0.000 0.000 0.028
#> SRR2082509 1 0.4674 0.509 0.608 0.000 0.332 0.000 0.000 0.060
#> SRR2082507 1 0.4627 0.338 0.512 0.008 0.456 0.000 0.000 0.024
#> SRR2082510 3 0.1480 0.731 0.000 0.020 0.940 0.000 0.000 0.040
#> SRR2082511 3 0.2579 0.770 0.088 0.000 0.872 0.000 0.000 0.040
#> SRR2082501 1 0.0363 0.676 0.988 0.000 0.000 0.000 0.000 0.012
#> SRR2082502 1 0.0632 0.675 0.976 0.000 0.000 0.000 0.000 0.024
#> SRR2082499 1 0.1408 0.679 0.944 0.000 0.036 0.000 0.000 0.020
#> SRR2082500 1 0.1003 0.677 0.964 0.000 0.016 0.000 0.000 0.020
#> SRR2082503 1 0.4697 0.520 0.612 0.000 0.324 0.000 0.000 0.064
#> SRR2082505 1 0.4299 0.550 0.652 0.000 0.308 0.000 0.000 0.040
#> SRR2082506 1 0.1320 0.674 0.948 0.000 0.016 0.000 0.000 0.036
#> SRR2082504 1 0.2848 0.540 0.816 0.000 0.008 0.000 0.000 0.176
#> SRR2082495 1 0.4353 0.458 0.588 0.000 0.384 0.000 0.000 0.028
#> SRR2082496 1 0.4543 0.445 0.576 0.000 0.384 0.000 0.000 0.040
#> SRR2082493 3 0.2868 0.758 0.132 0.000 0.840 0.000 0.000 0.028
#> SRR2082494 3 0.2868 0.758 0.132 0.000 0.840 0.000 0.000 0.028
#> SRR2082491 1 0.2446 0.665 0.864 0.000 0.124 0.000 0.000 0.012
#> SRR2082492 1 0.2664 0.662 0.848 0.000 0.136 0.000 0.000 0.016
#> SRR2082489 6 0.4120 0.991 0.204 0.000 0.068 0.000 0.000 0.728
#> SRR2082490 6 0.4120 0.991 0.204 0.000 0.068 0.000 0.000 0.728
#> SRR2082497 1 0.0790 0.667 0.968 0.000 0.000 0.000 0.000 0.032
#> SRR2082498 1 0.0713 0.669 0.972 0.000 0.000 0.000 0.000 0.028
#> SRR2082487 6 0.4166 0.991 0.196 0.000 0.076 0.000 0.000 0.728
#> SRR2082488 6 0.4166 0.991 0.196 0.000 0.076 0.000 0.000 0.728
#> SRR2082485 1 0.4873 0.230 0.600 0.000 0.080 0.000 0.000 0.320
#> SRR2082486 1 0.4873 0.230 0.600 0.000 0.080 0.000 0.000 0.320
#> SRR2082479 1 0.1010 0.666 0.960 0.000 0.004 0.000 0.000 0.036
#> SRR2082480 1 0.1082 0.668 0.956 0.000 0.004 0.000 0.000 0.040
#> SRR2082483 3 0.4230 0.702 0.176 0.016 0.748 0.000 0.000 0.060
#> SRR2082484 3 0.4197 0.705 0.172 0.016 0.752 0.000 0.000 0.060
#> SRR2082481 1 0.4361 -0.284 0.552 0.000 0.024 0.000 0.000 0.424
#> SRR2082482 1 0.4366 -0.293 0.548 0.000 0.024 0.000 0.000 0.428
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 14581 rows and 58 columns.
#> Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'CV' method.
#> Subgroups are detected by 'NMF' method.
#> Performed in total 1250 partitions by row resampling.
#> Best k for subgroups seems to be 3.
#>
#> Following methods can be applied to this 'ConsensusPartition' object:
#> [1] "cola_report" "collect_classes" "collect_plots"
#> [4] "collect_stats" "colnames" "compare_signatures"
#> [7] "consensus_heatmap" "dimension_reduction" "functional_enrichment"
#> [10] "get_anno_col" "get_anno" "get_classes"
#> [13] "get_consensus" "get_matrix" "get_membership"
#> [16] "get_param" "get_signatures" "get_stats"
#> [19] "is_best_k" "is_stable_k" "membership_heatmap"
#> [22] "ncol" "nrow" "plot_ecdf"
#> [25] "rownames" "select_partition_number" "show"
#> [28] "suggest_best_k" "test_to_known_factors"
collect_plots()
function collects all the plots made from res
for all k
(number of partitions)
into one single page to provide an easy and fast comparison between different k
.
collect_plots(res)
The plots are:
k
and the heatmap of
predicted classes for each k
.k
.k
.k
.All the plots in panels can be made by individual functions and they are plotted later in this section.
select_partition_number()
produces several plots showing different
statistics for choosing “optimized” k
. There are following statistics:
k
;k
, the area increased is defined as \(A_k - A_{k-1}\).The detailed explanations of these statistics can be found in the cola vignette.
Generally speaking, lower PAC score, higher mean silhouette score or higher
concordance corresponds to better partition. Rand index and Jaccard index
measure how similar the current partition is compared to partition with k-1
.
If they are too similar, we won't accept k
is better than k-1
.
select_partition_number(res)
The numeric values for all these statistics can be obtained by get_stats()
.
get_stats(res)
#> k 1-PAC mean_silhouette concordance area_increased Rand Jaccard
#> 2 2 1.000 1.000 1.000 0.4996 0.501 0.501
#> 3 3 0.959 0.957 0.968 0.1649 0.909 0.819
#> 4 4 0.706 0.711 0.836 0.1032 0.944 0.868
#> 5 5 0.637 0.634 0.741 0.0855 0.989 0.972
#> 6 6 0.633 0.664 0.782 0.0983 0.789 0.472
suggest_best_k()
suggests the best \(k\) based on these statistics. The rules are as follows:
suggest_best_k(res)
#> [1] 3
#> attr(,"optional")
#> [1] 2
There is also optional best \(k\) = 2 that is worth to check.
Following shows the table of the partitions (You need to click the show/hide
code output link to see it). The membership matrix (columns with name p*
)
is inferred by
clue::cl_consensus()
function with the SE
method. Basically the value in the membership matrix
represents the probability to belong to a certain group. The finall class
label for an item is determined with the group with highest probability it
belongs to.
In get_classes()
function, the entropy is calculated from the membership
matrix and the silhouette score is calculated from the consensus matrix.
cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#> class entropy silhouette p1 p2
#> SRR2082532 2 0 1 0 1
#> SRR2082533 2 0 1 0 1
#> SRR2082534 2 0 1 0 1
#> SRR2082535 2 0 1 0 1
#> SRR2082536 2 0 1 0 1
#> SRR2082530 2 0 1 0 1
#> SRR2082531 2 0 1 0 1
#> SRR2082528 2 0 1 0 1
#> SRR2082529 2 0 1 0 1
#> SRR2082526 2 0 1 0 1
#> SRR2082527 2 0 1 0 1
#> SRR2082521 2 0 1 0 1
#> SRR2082520 2 0 1 0 1
#> SRR2082518 2 0 1 0 1
#> SRR2082523 2 0 1 0 1
#> SRR2082524 2 0 1 0 1
#> SRR2082525 2 0 1 0 1
#> SRR2082522 2 0 1 0 1
#> SRR2082519 2 0 1 0 1
#> SRR2082513 2 0 1 0 1
#> SRR2082512 2 0 1 0 1
#> SRR2082516 2 0 1 0 1
#> SRR2082515 2 0 1 0 1
#> SRR2082517 2 0 1 0 1
#> SRR2082514 2 0 1 0 1
#> SRR2082508 1 0 1 1 0
#> SRR2082509 1 0 1 1 0
#> SRR2082507 1 0 1 1 0
#> SRR2082510 1 0 1 1 0
#> SRR2082511 1 0 1 1 0
#> SRR2082501 1 0 1 1 0
#> SRR2082502 1 0 1 1 0
#> SRR2082499 1 0 1 1 0
#> SRR2082500 1 0 1 1 0
#> SRR2082503 1 0 1 1 0
#> SRR2082505 1 0 1 1 0
#> SRR2082506 1 0 1 1 0
#> SRR2082504 1 0 1 1 0
#> SRR2082495 1 0 1 1 0
#> SRR2082496 1 0 1 1 0
#> SRR2082493 1 0 1 1 0
#> SRR2082494 1 0 1 1 0
#> SRR2082491 1 0 1 1 0
#> SRR2082492 1 0 1 1 0
#> SRR2082489 1 0 1 1 0
#> SRR2082490 1 0 1 1 0
#> SRR2082497 1 0 1 1 0
#> SRR2082498 1 0 1 1 0
#> SRR2082487 1 0 1 1 0
#> SRR2082488 1 0 1 1 0
#> SRR2082485 1 0 1 1 0
#> SRR2082486 1 0 1 1 0
#> SRR2082479 1 0 1 1 0
#> SRR2082480 1 0 1 1 0
#> SRR2082483 1 0 1 1 0
#> SRR2082484 1 0 1 1 0
#> SRR2082481 1 0 1 1 0
#> SRR2082482 1 0 1 1 0
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> SRR2082532 3 0.5560 0.746 0.000 0.300 0.700
#> SRR2082533 3 0.5560 0.746 0.000 0.300 0.700
#> SRR2082534 3 0.5926 0.676 0.000 0.356 0.644
#> SRR2082535 3 0.5905 0.682 0.000 0.352 0.648
#> SRR2082536 3 0.1289 0.836 0.000 0.032 0.968
#> SRR2082530 2 0.0000 0.993 0.000 1.000 0.000
#> SRR2082531 2 0.0000 0.993 0.000 1.000 0.000
#> SRR2082528 3 0.1163 0.835 0.000 0.028 0.972
#> SRR2082529 3 0.1163 0.835 0.000 0.028 0.972
#> SRR2082526 2 0.0000 0.993 0.000 1.000 0.000
#> SRR2082527 2 0.0000 0.993 0.000 1.000 0.000
#> SRR2082521 2 0.0000 0.993 0.000 1.000 0.000
#> SRR2082520 3 0.0747 0.826 0.000 0.016 0.984
#> SRR2082518 2 0.0000 0.993 0.000 1.000 0.000
#> SRR2082523 2 0.0424 0.989 0.000 0.992 0.008
#> SRR2082524 2 0.0424 0.989 0.000 0.992 0.008
#> SRR2082525 2 0.0000 0.993 0.000 1.000 0.000
#> SRR2082522 2 0.0892 0.978 0.000 0.980 0.020
#> SRR2082519 2 0.0424 0.989 0.000 0.992 0.008
#> SRR2082513 2 0.0000 0.993 0.000 1.000 0.000
#> SRR2082512 2 0.0000 0.993 0.000 1.000 0.000
#> SRR2082516 3 0.3267 0.837 0.000 0.116 0.884
#> SRR2082515 2 0.1411 0.959 0.000 0.964 0.036
#> SRR2082517 2 0.0237 0.991 0.000 0.996 0.004
#> SRR2082514 3 0.2796 0.840 0.000 0.092 0.908
#> SRR2082508 1 0.0237 0.995 0.996 0.000 0.004
#> SRR2082509 1 0.0592 0.995 0.988 0.000 0.012
#> SRR2082507 1 0.0424 0.993 0.992 0.000 0.008
#> SRR2082510 1 0.0424 0.995 0.992 0.000 0.008
#> SRR2082511 1 0.0424 0.995 0.992 0.000 0.008
#> SRR2082501 1 0.0000 0.996 1.000 0.000 0.000
#> SRR2082502 1 0.0237 0.995 0.996 0.000 0.004
#> SRR2082499 1 0.0000 0.996 1.000 0.000 0.000
#> SRR2082500 1 0.0000 0.996 1.000 0.000 0.000
#> SRR2082503 1 0.0237 0.995 0.996 0.000 0.004
#> SRR2082505 1 0.0237 0.995 0.996 0.000 0.004
#> SRR2082506 1 0.0237 0.995 0.996 0.000 0.004
#> SRR2082504 1 0.0237 0.995 0.996 0.000 0.004
#> SRR2082495 1 0.0424 0.995 0.992 0.000 0.008
#> SRR2082496 1 0.0424 0.995 0.992 0.000 0.008
#> SRR2082493 1 0.0592 0.995 0.988 0.000 0.012
#> SRR2082494 1 0.0592 0.995 0.988 0.000 0.012
#> SRR2082491 1 0.0424 0.995 0.992 0.000 0.008
#> SRR2082492 1 0.0424 0.995 0.992 0.000 0.008
#> SRR2082489 1 0.0424 0.995 0.992 0.000 0.008
#> SRR2082490 1 0.0424 0.995 0.992 0.000 0.008
#> SRR2082497 1 0.0237 0.995 0.996 0.000 0.004
#> SRR2082498 1 0.0237 0.995 0.996 0.000 0.004
#> SRR2082487 1 0.0424 0.995 0.992 0.000 0.008
#> SRR2082488 1 0.0424 0.995 0.992 0.000 0.008
#> SRR2082485 1 0.0424 0.995 0.992 0.000 0.008
#> SRR2082486 1 0.0424 0.995 0.992 0.000 0.008
#> SRR2082479 1 0.0000 0.996 1.000 0.000 0.000
#> SRR2082480 1 0.0000 0.996 1.000 0.000 0.000
#> SRR2082483 1 0.0000 0.996 1.000 0.000 0.000
#> SRR2082484 1 0.0000 0.996 1.000 0.000 0.000
#> SRR2082481 1 0.0000 0.996 1.000 0.000 0.000
#> SRR2082482 1 0.0000 0.996 1.000 0.000 0.000
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> SRR2082532 4 0.1792 0.4955 0.000 0.068 0.000 0.932
#> SRR2082533 4 0.1792 0.4955 0.000 0.068 0.000 0.932
#> SRR2082534 4 0.1716 0.4917 0.000 0.064 0.000 0.936
#> SRR2082535 4 0.1716 0.4917 0.000 0.064 0.000 0.936
#> SRR2082536 4 0.4500 -0.3998 0.000 0.000 0.316 0.684
#> SRR2082530 4 0.4817 0.2987 0.000 0.388 0.000 0.612
#> SRR2082531 4 0.4817 0.2987 0.000 0.388 0.000 0.612
#> SRR2082528 4 0.4564 -0.4299 0.000 0.000 0.328 0.672
#> SRR2082529 4 0.4543 -0.4176 0.000 0.000 0.324 0.676
#> SRR2082526 2 0.2216 0.7971 0.000 0.908 0.000 0.092
#> SRR2082527 2 0.2216 0.7953 0.000 0.908 0.000 0.092
#> SRR2082521 2 0.4977 -0.0518 0.000 0.540 0.000 0.460
#> SRR2082520 3 0.5055 0.8017 0.000 0.008 0.624 0.368
#> SRR2082518 2 0.0000 0.8249 0.000 1.000 0.000 0.000
#> SRR2082523 4 0.4776 0.3211 0.000 0.376 0.000 0.624
#> SRR2082524 4 0.4790 0.3137 0.000 0.380 0.000 0.620
#> SRR2082525 2 0.2704 0.7680 0.000 0.876 0.000 0.124
#> SRR2082522 2 0.0657 0.8290 0.000 0.984 0.004 0.012
#> SRR2082519 2 0.0895 0.8275 0.000 0.976 0.004 0.020
#> SRR2082513 2 0.4977 -0.0518 0.000 0.540 0.000 0.460
#> SRR2082512 2 0.0000 0.8249 0.000 1.000 0.000 0.000
#> SRR2082516 3 0.6653 0.8404 0.000 0.084 0.480 0.436
#> SRR2082515 2 0.0779 0.8259 0.000 0.980 0.004 0.016
#> SRR2082517 2 0.0657 0.8290 0.000 0.984 0.004 0.012
#> SRR2082514 3 0.6055 0.8635 0.000 0.044 0.520 0.436
#> SRR2082508 1 0.2530 0.8355 0.888 0.000 0.112 0.000
#> SRR2082509 1 0.2814 0.9076 0.868 0.000 0.132 0.000
#> SRR2082507 1 0.2973 0.8156 0.856 0.000 0.144 0.000
#> SRR2082510 1 0.3764 0.8915 0.784 0.000 0.216 0.000
#> SRR2082511 1 0.3764 0.8915 0.784 0.000 0.216 0.000
#> SRR2082501 1 0.0000 0.9026 1.000 0.000 0.000 0.000
#> SRR2082502 1 0.0000 0.9026 1.000 0.000 0.000 0.000
#> SRR2082499 1 0.0000 0.9026 1.000 0.000 0.000 0.000
#> SRR2082500 1 0.0000 0.9026 1.000 0.000 0.000 0.000
#> SRR2082503 1 0.0817 0.9009 0.976 0.000 0.024 0.000
#> SRR2082505 1 0.1022 0.8986 0.968 0.000 0.032 0.000
#> SRR2082506 1 0.0000 0.9026 1.000 0.000 0.000 0.000
#> SRR2082504 1 0.0000 0.9026 1.000 0.000 0.000 0.000
#> SRR2082495 1 0.3764 0.8915 0.784 0.000 0.216 0.000
#> SRR2082496 1 0.3764 0.8915 0.784 0.000 0.216 0.000
#> SRR2082493 1 0.3649 0.8955 0.796 0.000 0.204 0.000
#> SRR2082494 1 0.3610 0.8967 0.800 0.000 0.200 0.000
#> SRR2082491 1 0.2973 0.9073 0.856 0.000 0.144 0.000
#> SRR2082492 1 0.3172 0.9054 0.840 0.000 0.160 0.000
#> SRR2082489 1 0.3400 0.9010 0.820 0.000 0.180 0.000
#> SRR2082490 1 0.3400 0.9010 0.820 0.000 0.180 0.000
#> SRR2082497 1 0.0000 0.9026 1.000 0.000 0.000 0.000
#> SRR2082498 1 0.0000 0.9026 1.000 0.000 0.000 0.000
#> SRR2082487 1 0.3400 0.9010 0.820 0.000 0.180 0.000
#> SRR2082488 1 0.3400 0.9010 0.820 0.000 0.180 0.000
#> SRR2082485 1 0.3528 0.8965 0.808 0.000 0.192 0.000
#> SRR2082486 1 0.3528 0.8965 0.808 0.000 0.192 0.000
#> SRR2082479 1 0.0336 0.9036 0.992 0.000 0.008 0.000
#> SRR2082480 1 0.0000 0.9026 1.000 0.000 0.000 0.000
#> SRR2082483 1 0.3123 0.9069 0.844 0.000 0.156 0.000
#> SRR2082484 1 0.3074 0.9071 0.848 0.000 0.152 0.000
#> SRR2082481 1 0.1302 0.9067 0.956 0.000 0.044 0.000
#> SRR2082482 1 0.1211 0.9064 0.960 0.000 0.040 0.000
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> SRR2082532 4 0.1484 0.607 0.000 0.008 0.000 0.944 0.048
#> SRR2082533 4 0.1168 0.613 0.000 0.008 0.000 0.960 0.032
#> SRR2082534 4 0.0671 0.618 0.000 0.016 0.000 0.980 0.004
#> SRR2082535 4 0.0798 0.618 0.000 0.016 0.000 0.976 0.008
#> SRR2082536 4 0.3932 0.278 0.000 0.000 0.000 0.672 0.328
#> SRR2082530 4 0.6157 -0.340 0.000 0.128 0.344 0.524 0.004
#> SRR2082531 4 0.6167 -0.353 0.000 0.128 0.348 0.520 0.004
#> SRR2082528 4 0.3999 0.251 0.000 0.000 0.000 0.656 0.344
#> SRR2082529 4 0.4045 0.227 0.000 0.000 0.000 0.644 0.356
#> SRR2082526 2 0.3318 0.584 0.000 0.808 0.012 0.180 0.000
#> SRR2082527 2 0.3242 0.589 0.000 0.816 0.012 0.172 0.000
#> SRR2082521 3 0.6889 0.955 0.000 0.288 0.404 0.304 0.004
#> SRR2082520 5 0.4724 0.483 0.000 0.052 0.024 0.172 0.752
#> SRR2082518 2 0.0671 0.633 0.000 0.980 0.004 0.016 0.000
#> SRR2082523 4 0.4073 0.411 0.000 0.104 0.092 0.800 0.004
#> SRR2082524 4 0.4073 0.411 0.000 0.104 0.092 0.800 0.004
#> SRR2082525 2 0.3246 0.579 0.000 0.808 0.008 0.184 0.000
#> SRR2082522 2 0.4915 0.486 0.000 0.700 0.240 0.048 0.012
#> SRR2082519 2 0.5017 0.458 0.000 0.684 0.256 0.048 0.012
#> SRR2082513 3 0.6887 0.954 0.000 0.308 0.404 0.284 0.004
#> SRR2082512 2 0.0486 0.628 0.000 0.988 0.004 0.004 0.004
#> SRR2082516 5 0.8283 0.633 0.000 0.168 0.188 0.264 0.380
#> SRR2082515 2 0.4855 0.483 0.000 0.696 0.252 0.040 0.012
#> SRR2082517 2 0.4835 0.481 0.000 0.700 0.244 0.048 0.008
#> SRR2082514 5 0.8211 0.611 0.000 0.136 0.248 0.228 0.388
#> SRR2082508 1 0.3495 0.661 0.816 0.000 0.032 0.000 0.152
#> SRR2082509 1 0.4341 0.749 0.592 0.000 0.404 0.000 0.004
#> SRR2082507 1 0.4100 0.624 0.764 0.000 0.044 0.000 0.192
#> SRR2082510 1 0.4415 0.729 0.552 0.000 0.444 0.000 0.004
#> SRR2082511 1 0.4410 0.731 0.556 0.000 0.440 0.000 0.004
#> SRR2082501 1 0.0162 0.780 0.996 0.000 0.004 0.000 0.000
#> SRR2082502 1 0.0290 0.778 0.992 0.000 0.008 0.000 0.000
#> SRR2082499 1 0.0290 0.780 0.992 0.000 0.008 0.000 0.000
#> SRR2082500 1 0.0290 0.780 0.992 0.000 0.008 0.000 0.000
#> SRR2082503 1 0.1732 0.775 0.920 0.000 0.080 0.000 0.000
#> SRR2082505 1 0.1469 0.774 0.948 0.000 0.036 0.000 0.016
#> SRR2082506 1 0.0162 0.780 0.996 0.000 0.004 0.000 0.000
#> SRR2082504 1 0.0162 0.780 0.996 0.000 0.004 0.000 0.000
#> SRR2082495 1 0.4410 0.731 0.556 0.000 0.440 0.000 0.004
#> SRR2082496 1 0.4410 0.731 0.556 0.000 0.440 0.000 0.004
#> SRR2082493 1 0.4627 0.725 0.544 0.000 0.444 0.000 0.012
#> SRR2082494 1 0.4627 0.725 0.544 0.000 0.444 0.000 0.012
#> SRR2082491 1 0.3636 0.785 0.728 0.000 0.272 0.000 0.000
#> SRR2082492 1 0.4252 0.771 0.652 0.000 0.340 0.000 0.008
#> SRR2082489 1 0.4040 0.779 0.712 0.000 0.276 0.000 0.012
#> SRR2082490 1 0.4016 0.780 0.716 0.000 0.272 0.000 0.012
#> SRR2082497 1 0.0771 0.772 0.976 0.000 0.020 0.000 0.004
#> SRR2082498 1 0.0771 0.772 0.976 0.000 0.020 0.000 0.004
#> SRR2082487 1 0.4232 0.771 0.676 0.000 0.312 0.000 0.012
#> SRR2082488 1 0.4232 0.771 0.676 0.000 0.312 0.000 0.012
#> SRR2082485 1 0.4371 0.763 0.644 0.000 0.344 0.000 0.012
#> SRR2082486 1 0.4387 0.762 0.640 0.000 0.348 0.000 0.012
#> SRR2082479 1 0.0324 0.781 0.992 0.000 0.004 0.000 0.004
#> SRR2082480 1 0.0162 0.781 0.996 0.000 0.004 0.000 0.000
#> SRR2082483 1 0.5489 0.708 0.576 0.064 0.356 0.000 0.004
#> SRR2082484 1 0.5595 0.700 0.568 0.072 0.356 0.000 0.004
#> SRR2082481 1 0.0162 0.781 0.996 0.000 0.000 0.000 0.004
#> SRR2082482 1 0.0162 0.781 0.996 0.000 0.000 0.000 0.004
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> SRR2082532 4 0.2062 0.7611 0.000 0.004 0.008 0.900 0.088 0.000
#> SRR2082533 4 0.1542 0.7676 0.000 0.004 0.008 0.936 0.052 0.000
#> SRR2082534 4 0.0405 0.7631 0.000 0.008 0.000 0.988 0.004 0.000
#> SRR2082535 4 0.0520 0.7615 0.000 0.008 0.000 0.984 0.008 0.000
#> SRR2082536 4 0.2902 0.6895 0.000 0.000 0.004 0.800 0.196 0.000
#> SRR2082530 2 0.3878 0.3347 0.000 0.688 0.008 0.296 0.000 0.008
#> SRR2082531 2 0.3840 0.3435 0.000 0.696 0.008 0.288 0.000 0.008
#> SRR2082528 4 0.2883 0.6773 0.000 0.000 0.000 0.788 0.212 0.000
#> SRR2082529 4 0.2941 0.6674 0.000 0.000 0.000 0.780 0.220 0.000
#> SRR2082526 6 0.2726 0.8442 0.000 0.008 0.008 0.136 0.000 0.848
#> SRR2082527 6 0.2556 0.8502 0.000 0.008 0.008 0.120 0.000 0.864
#> SRR2082521 2 0.2265 0.4928 0.000 0.900 0.000 0.068 0.008 0.024
#> SRR2082520 5 0.4722 0.0000 0.000 0.104 0.000 0.160 0.716 0.020
#> SRR2082518 6 0.2219 0.7415 0.000 0.136 0.000 0.000 0.000 0.864
#> SRR2082523 4 0.4037 0.5688 0.000 0.216 0.012 0.744 0.016 0.012
#> SRR2082524 4 0.4037 0.5688 0.000 0.216 0.012 0.744 0.016 0.012
#> SRR2082525 6 0.2685 0.8462 0.000 0.008 0.008 0.132 0.000 0.852
#> SRR2082522 2 0.4493 0.3465 0.000 0.548 0.004 0.000 0.024 0.424
#> SRR2082519 2 0.4242 0.4769 0.000 0.660 0.004 0.004 0.020 0.312
#> SRR2082513 2 0.2501 0.4851 0.000 0.896 0.004 0.056 0.016 0.028
#> SRR2082512 6 0.2100 0.7630 0.000 0.112 0.004 0.000 0.000 0.884
#> SRR2082516 2 0.6575 -0.0248 0.000 0.504 0.000 0.224 0.212 0.060
#> SRR2082515 2 0.4421 0.3569 0.000 0.552 0.004 0.000 0.020 0.424
#> SRR2082517 2 0.4325 0.3789 0.000 0.568 0.004 0.000 0.016 0.412
#> SRR2082514 2 0.5891 0.1425 0.000 0.592 0.000 0.180 0.192 0.036
#> SRR2082508 1 0.2265 0.8282 0.896 0.000 0.024 0.000 0.076 0.004
#> SRR2082509 3 0.3904 0.7922 0.232 0.000 0.732 0.000 0.032 0.004
#> SRR2082507 1 0.4361 0.6267 0.716 0.000 0.076 0.000 0.204 0.004
#> SRR2082510 3 0.3121 0.7989 0.192 0.000 0.796 0.000 0.004 0.008
#> SRR2082511 3 0.3011 0.7987 0.192 0.000 0.800 0.000 0.004 0.004
#> SRR2082501 1 0.0508 0.8884 0.984 0.004 0.012 0.000 0.000 0.000
#> SRR2082502 1 0.0405 0.8885 0.988 0.004 0.008 0.000 0.000 0.000
#> SRR2082499 1 0.0508 0.8886 0.984 0.004 0.012 0.000 0.000 0.000
#> SRR2082500 1 0.0508 0.8886 0.984 0.004 0.012 0.000 0.000 0.000
#> SRR2082503 1 0.2695 0.7649 0.844 0.000 0.144 0.000 0.008 0.004
#> SRR2082505 1 0.2209 0.8500 0.900 0.000 0.072 0.000 0.024 0.004
#> SRR2082506 1 0.0458 0.8879 0.984 0.000 0.016 0.000 0.000 0.000
#> SRR2082504 1 0.0632 0.8856 0.976 0.000 0.024 0.000 0.000 0.000
#> SRR2082495 3 0.3197 0.7972 0.184 0.004 0.800 0.000 0.008 0.004
#> SRR2082496 3 0.3154 0.7957 0.184 0.000 0.800 0.000 0.012 0.004
#> SRR2082493 3 0.3229 0.7877 0.172 0.000 0.804 0.000 0.020 0.004
#> SRR2082494 3 0.3274 0.7854 0.168 0.000 0.804 0.000 0.024 0.004
#> SRR2082491 1 0.4703 -0.4550 0.508 0.016 0.460 0.000 0.012 0.004
#> SRR2082492 3 0.4646 0.7333 0.348 0.024 0.612 0.000 0.012 0.004
#> SRR2082489 3 0.5208 0.6021 0.448 0.056 0.484 0.000 0.004 0.008
#> SRR2082490 3 0.5208 0.6021 0.448 0.056 0.484 0.000 0.004 0.008
#> SRR2082497 1 0.0653 0.8816 0.980 0.004 0.012 0.000 0.004 0.000
#> SRR2082498 1 0.0653 0.8816 0.980 0.004 0.012 0.000 0.004 0.000
#> SRR2082487 3 0.5138 0.7024 0.388 0.056 0.544 0.000 0.004 0.008
#> SRR2082488 3 0.5138 0.7024 0.388 0.056 0.544 0.000 0.004 0.008
#> SRR2082485 3 0.4937 0.7618 0.316 0.056 0.616 0.000 0.004 0.008
#> SRR2082486 3 0.4952 0.7593 0.320 0.056 0.612 0.000 0.004 0.008
#> SRR2082479 1 0.1003 0.8812 0.964 0.004 0.028 0.000 0.004 0.000
#> SRR2082480 1 0.0858 0.8825 0.968 0.000 0.028 0.000 0.004 0.000
#> SRR2082483 3 0.4906 0.6463 0.236 0.008 0.668 0.000 0.004 0.084
#> SRR2082484 3 0.4952 0.6351 0.236 0.008 0.664 0.000 0.004 0.088
#> SRR2082481 1 0.1401 0.8718 0.948 0.020 0.028 0.000 0.004 0.000
#> SRR2082482 1 0.1313 0.8746 0.952 0.016 0.028 0.000 0.004 0.000
Heatmaps for the consensus matrix. It visualizes the probability of two samples to be in a same group.
consensus_heatmap(res, k = 2)
consensus_heatmap(res, k = 3)
consensus_heatmap(res, k = 4)
consensus_heatmap(res, k = 5)
consensus_heatmap(res, k = 6)
Heatmaps for the membership of samples in all partitions to see how consistent they are:
membership_heatmap(res, k = 2)
membership_heatmap(res, k = 3)
membership_heatmap(res, k = 4)
membership_heatmap(res, k = 5)
membership_heatmap(res, k = 6)
As soon as we have had the classes for columns, we can look for signatures which are significantly different between classes which can be candidate marks for certain classes. Following are the heatmaps for signatures.
Signature heatmaps where rows are scaled:
get_signatures(res, k = 2)
get_signatures(res, k = 3)
get_signatures(res, k = 4)
get_signatures(res, k = 5)
get_signatures(res, k = 6)
Signature heatmaps where rows are not scaled:
get_signatures(res, k = 2, scale_rows = FALSE)
get_signatures(res, k = 3, scale_rows = FALSE)
get_signatures(res, k = 4, scale_rows = FALSE)
get_signatures(res, k = 5, scale_rows = FALSE)
get_signatures(res, k = 6, scale_rows = FALSE)
Compare the overlap of signatures from different k:
compare_signatures(res)
get_signature()
returns a data frame invisibly. TO get the list of signatures, the function
call should be assigned to a variable explicitly. In following code, if plot
argument is set
to FALSE
, no heatmap is plotted while only the differential analysis is performed.
# code only for demonstration
tb = get_signature(res, k = ..., plot = FALSE)
An example of the output of tb
is:
#> which_row fdr mean_1 mean_2 scaled_mean_1 scaled_mean_2 km
#> 1 38 0.042760348 8.373488 9.131774 -0.5533452 0.5164555 1
#> 2 40 0.018707592 7.106213 8.469186 -0.6173731 0.5762149 1
#> 3 55 0.019134737 10.221463 11.207825 -0.6159697 0.5749050 1
#> 4 59 0.006059896 5.921854 7.869574 -0.6899429 0.6439467 1
#> 5 60 0.018055526 8.928898 10.211722 -0.6204761 0.5791110 1
#> 6 98 0.009384629 15.714769 14.887706 0.6635654 -0.6193277 2
...
The columns in tb
are:
which_row
: row indices corresponding to the input matrix.fdr
: FDR for the differential test. mean_x
: The mean value in group x.scaled_mean_x
: The mean value in group x after rows are scaled.km
: Row groups if k-means clustering is applied to rows.UMAP plot which shows how samples are separated.
dimension_reduction(res, k = 2, method = "UMAP")
dimension_reduction(res, k = 3, method = "UMAP")
dimension_reduction(res, k = 4, method = "UMAP")
dimension_reduction(res, k = 5, method = "UMAP")
dimension_reduction(res, k = 6, method = "UMAP")
Following heatmap shows how subgroups are split when increasing k
:
collect_classes(res)
If matrix rows can be associated to genes, consider to use functional_enrichment(res,
...)
to perform function enrichment for the signature genes. See this vignette for more detailed explanations.
The object with results only for a single top-value method and a single partition method can be extracted as:
res = res_list["MAD", "hclust"]
# you can also extract it by
# res = res_list["MAD:hclust"]
A summary of res
and all the functions that can be applied to it:
res
#> A 'ConsensusPartition' object with k = 2, 3, 4, 5, 6.
#> On a matrix with 14581 rows and 58 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 3.
#>
#> Following methods can be applied to this 'ConsensusPartition' object:
#> [1] "cola_report" "collect_classes" "collect_plots"
#> [4] "collect_stats" "colnames" "compare_signatures"
#> [7] "consensus_heatmap" "dimension_reduction" "functional_enrichment"
#> [10] "get_anno_col" "get_anno" "get_classes"
#> [13] "get_consensus" "get_matrix" "get_membership"
#> [16] "get_param" "get_signatures" "get_stats"
#> [19] "is_best_k" "is_stable_k" "membership_heatmap"
#> [22] "ncol" "nrow" "plot_ecdf"
#> [25] "rownames" "select_partition_number" "show"
#> [28] "suggest_best_k" "test_to_known_factors"
collect_plots()
function collects all the plots made from res
for all k
(number of partitions)
into one single page to provide an easy and fast comparison between different k
.
collect_plots(res)
The plots are:
k
and the heatmap of
predicted classes for each k
.k
.k
.k
.All the plots in panels can be made by individual functions and they are plotted later in this section.
select_partition_number()
produces several plots showing different
statistics for choosing “optimized” k
. There are following statistics:
k
;k
, the area increased is defined as \(A_k - A_{k-1}\).The detailed explanations of these statistics can be found in the cola vignette.
Generally speaking, lower PAC score, higher mean silhouette score or higher
concordance corresponds to better partition. Rand index and Jaccard index
measure how similar the current partition is compared to partition with k-1
.
If they are too similar, we won't accept k
is better than k-1
.
select_partition_number(res)
The numeric values for all these statistics can be obtained by get_stats()
.
get_stats(res)
#> k 1-PAC mean_silhouette concordance area_increased Rand Jaccard
#> 2 2 1.000 1.000 1.000 0.4996 0.501 0.501
#> 3 3 1.000 0.970 0.987 0.1313 0.946 0.891
#> 4 4 0.756 0.906 0.913 0.1978 0.879 0.729
#> 5 5 0.836 0.786 0.902 0.1278 0.909 0.721
#> 6 6 0.879 0.726 0.822 0.0484 0.949 0.812
suggest_best_k()
suggests the best \(k\) based on these statistics. The rules are as follows:
suggest_best_k(res)
#> [1] 3
#> attr(,"optional")
#> [1] 2
There is also optional best \(k\) = 2 that is worth to check.
Following shows the table of the partitions (You need to click the show/hide
code output link to see it). The membership matrix (columns with name p*
)
is inferred by
clue::cl_consensus()
function with the SE
method. Basically the value in the membership matrix
represents the probability to belong to a certain group. The finall class
label for an item is determined with the group with highest probability it
belongs to.
In get_classes()
function, the entropy is calculated from the membership
matrix and the silhouette score is calculated from the consensus matrix.
cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#> class entropy silhouette p1 p2
#> SRR2082532 2 0 1 0 1
#> SRR2082533 2 0 1 0 1
#> SRR2082534 2 0 1 0 1
#> SRR2082535 2 0 1 0 1
#> SRR2082536 2 0 1 0 1
#> SRR2082530 2 0 1 0 1
#> SRR2082531 2 0 1 0 1
#> SRR2082528 2 0 1 0 1
#> SRR2082529 2 0 1 0 1
#> SRR2082526 2 0 1 0 1
#> SRR2082527 2 0 1 0 1
#> SRR2082521 2 0 1 0 1
#> SRR2082520 2 0 1 0 1
#> SRR2082518 2 0 1 0 1
#> SRR2082523 2 0 1 0 1
#> SRR2082524 2 0 1 0 1
#> SRR2082525 2 0 1 0 1
#> SRR2082522 2 0 1 0 1
#> SRR2082519 2 0 1 0 1
#> SRR2082513 2 0 1 0 1
#> SRR2082512 2 0 1 0 1
#> SRR2082516 2 0 1 0 1
#> SRR2082515 2 0 1 0 1
#> SRR2082517 2 0 1 0 1
#> SRR2082514 2 0 1 0 1
#> SRR2082508 1 0 1 1 0
#> SRR2082509 1 0 1 1 0
#> SRR2082507 1 0 1 1 0
#> SRR2082510 1 0 1 1 0
#> SRR2082511 1 0 1 1 0
#> SRR2082501 1 0 1 1 0
#> SRR2082502 1 0 1 1 0
#> SRR2082499 1 0 1 1 0
#> SRR2082500 1 0 1 1 0
#> SRR2082503 1 0 1 1 0
#> SRR2082505 1 0 1 1 0
#> SRR2082506 1 0 1 1 0
#> SRR2082504 1 0 1 1 0
#> SRR2082495 1 0 1 1 0
#> SRR2082496 1 0 1 1 0
#> SRR2082493 1 0 1 1 0
#> SRR2082494 1 0 1 1 0
#> SRR2082491 1 0 1 1 0
#> SRR2082492 1 0 1 1 0
#> SRR2082489 1 0 1 1 0
#> SRR2082490 1 0 1 1 0
#> SRR2082497 1 0 1 1 0
#> SRR2082498 1 0 1 1 0
#> SRR2082487 1 0 1 1 0
#> SRR2082488 1 0 1 1 0
#> SRR2082485 1 0 1 1 0
#> SRR2082486 1 0 1 1 0
#> SRR2082479 1 0 1 1 0
#> SRR2082480 1 0 1 1 0
#> SRR2082483 1 0 1 1 0
#> SRR2082484 1 0 1 1 0
#> SRR2082481 1 0 1 1 0
#> SRR2082482 1 0 1 1 0
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> SRR2082532 2 0.0000 1.000 0.000 1 0.000
#> SRR2082533 2 0.0000 1.000 0.000 1 0.000
#> SRR2082534 2 0.0000 1.000 0.000 1 0.000
#> SRR2082535 2 0.0000 1.000 0.000 1 0.000
#> SRR2082536 2 0.0000 1.000 0.000 1 0.000
#> SRR2082530 2 0.0000 1.000 0.000 1 0.000
#> SRR2082531 2 0.0000 1.000 0.000 1 0.000
#> SRR2082528 2 0.0000 1.000 0.000 1 0.000
#> SRR2082529 2 0.0000 1.000 0.000 1 0.000
#> SRR2082526 2 0.0000 1.000 0.000 1 0.000
#> SRR2082527 2 0.0000 1.000 0.000 1 0.000
#> SRR2082521 2 0.0000 1.000 0.000 1 0.000
#> SRR2082520 2 0.0000 1.000 0.000 1 0.000
#> SRR2082518 2 0.0000 1.000 0.000 1 0.000
#> SRR2082523 2 0.0000 1.000 0.000 1 0.000
#> SRR2082524 2 0.0000 1.000 0.000 1 0.000
#> SRR2082525 2 0.0000 1.000 0.000 1 0.000
#> SRR2082522 2 0.0000 1.000 0.000 1 0.000
#> SRR2082519 2 0.0000 1.000 0.000 1 0.000
#> SRR2082513 2 0.0000 1.000 0.000 1 0.000
#> SRR2082512 2 0.0000 1.000 0.000 1 0.000
#> SRR2082516 2 0.0000 1.000 0.000 1 0.000
#> SRR2082515 2 0.0000 1.000 0.000 1 0.000
#> SRR2082517 2 0.0000 1.000 0.000 1 0.000
#> SRR2082514 2 0.0000 1.000 0.000 1 0.000
#> SRR2082508 1 0.0000 0.973 1.000 0 0.000
#> SRR2082509 1 0.0000 0.973 1.000 0 0.000
#> SRR2082507 1 0.0000 0.973 1.000 0 0.000
#> SRR2082510 3 0.0000 1.000 0.000 0 1.000
#> SRR2082511 1 0.5926 0.487 0.644 0 0.356
#> SRR2082501 1 0.0000 0.973 1.000 0 0.000
#> SRR2082502 1 0.0000 0.973 1.000 0 0.000
#> SRR2082499 1 0.0000 0.973 1.000 0 0.000
#> SRR2082500 1 0.0000 0.973 1.000 0 0.000
#> SRR2082503 1 0.0237 0.971 0.996 0 0.004
#> SRR2082505 1 0.0000 0.973 1.000 0 0.000
#> SRR2082506 1 0.0000 0.973 1.000 0 0.000
#> SRR2082504 1 0.0000 0.973 1.000 0 0.000
#> SRR2082495 1 0.0237 0.971 0.996 0 0.004
#> SRR2082496 1 0.0237 0.971 0.996 0 0.004
#> SRR2082493 1 0.4504 0.767 0.804 0 0.196
#> SRR2082494 1 0.4504 0.767 0.804 0 0.196
#> SRR2082491 1 0.0000 0.973 1.000 0 0.000
#> SRR2082492 1 0.0000 0.973 1.000 0 0.000
#> SRR2082489 1 0.0000 0.973 1.000 0 0.000
#> SRR2082490 1 0.0000 0.973 1.000 0 0.000
#> SRR2082497 1 0.0000 0.973 1.000 0 0.000
#> SRR2082498 1 0.0000 0.973 1.000 0 0.000
#> SRR2082487 1 0.0237 0.971 0.996 0 0.004
#> SRR2082488 1 0.0237 0.971 0.996 0 0.004
#> SRR2082485 1 0.0237 0.971 0.996 0 0.004
#> SRR2082486 1 0.0237 0.971 0.996 0 0.004
#> SRR2082479 1 0.0000 0.973 1.000 0 0.000
#> SRR2082480 1 0.0000 0.973 1.000 0 0.000
#> SRR2082483 3 0.0000 1.000 0.000 0 1.000
#> SRR2082484 3 0.0000 1.000 0.000 0 1.000
#> SRR2082481 1 0.0000 0.973 1.000 0 0.000
#> SRR2082482 1 0.0000 0.973 1.000 0 0.000
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> SRR2082532 2 0.0000 0.899 0.000 1.000 0.000 0.000
#> SRR2082533 2 0.0000 0.899 0.000 1.000 0.000 0.000
#> SRR2082534 2 0.2345 0.853 0.000 0.900 0.000 0.100
#> SRR2082535 2 0.2345 0.853 0.000 0.900 0.000 0.100
#> SRR2082536 2 0.2345 0.853 0.000 0.900 0.000 0.100
#> SRR2082530 2 0.2999 0.913 0.000 0.864 0.004 0.132
#> SRR2082531 2 0.2999 0.913 0.000 0.864 0.004 0.132
#> SRR2082528 2 0.2345 0.853 0.000 0.900 0.000 0.100
#> SRR2082529 2 0.2345 0.853 0.000 0.900 0.000 0.100
#> SRR2082526 2 0.2999 0.913 0.000 0.864 0.004 0.132
#> SRR2082527 2 0.2999 0.913 0.000 0.864 0.004 0.132
#> SRR2082521 2 0.2999 0.913 0.000 0.864 0.004 0.132
#> SRR2082520 2 0.2999 0.913 0.000 0.864 0.004 0.132
#> SRR2082518 2 0.2999 0.913 0.000 0.864 0.004 0.132
#> SRR2082523 2 0.0000 0.899 0.000 1.000 0.000 0.000
#> SRR2082524 2 0.0000 0.899 0.000 1.000 0.000 0.000
#> SRR2082525 2 0.2999 0.913 0.000 0.864 0.004 0.132
#> SRR2082522 2 0.2281 0.855 0.000 0.904 0.000 0.096
#> SRR2082519 2 0.2999 0.913 0.000 0.864 0.004 0.132
#> SRR2082513 2 0.2999 0.913 0.000 0.864 0.004 0.132
#> SRR2082512 2 0.2999 0.913 0.000 0.864 0.004 0.132
#> SRR2082516 2 0.0000 0.899 0.000 1.000 0.000 0.000
#> SRR2082515 2 0.2999 0.913 0.000 0.864 0.004 0.132
#> SRR2082517 2 0.2999 0.913 0.000 0.864 0.004 0.132
#> SRR2082514 2 0.0000 0.899 0.000 1.000 0.000 0.000
#> SRR2082508 1 0.0000 0.980 1.000 0.000 0.000 0.000
#> SRR2082509 1 0.0000 0.980 1.000 0.000 0.000 0.000
#> SRR2082507 1 0.0000 0.980 1.000 0.000 0.000 0.000
#> SRR2082510 3 0.0188 1.000 0.000 0.000 0.996 0.004
#> SRR2082511 4 0.5762 0.439 0.040 0.000 0.352 0.608
#> SRR2082501 1 0.0000 0.980 1.000 0.000 0.000 0.000
#> SRR2082502 1 0.0000 0.980 1.000 0.000 0.000 0.000
#> SRR2082499 1 0.0000 0.980 1.000 0.000 0.000 0.000
#> SRR2082500 1 0.0000 0.980 1.000 0.000 0.000 0.000
#> SRR2082503 4 0.3907 0.881 0.232 0.000 0.000 0.768
#> SRR2082505 1 0.0000 0.980 1.000 0.000 0.000 0.000
#> SRR2082506 1 0.0000 0.980 1.000 0.000 0.000 0.000
#> SRR2082504 1 0.0000 0.980 1.000 0.000 0.000 0.000
#> SRR2082495 4 0.3907 0.881 0.232 0.000 0.000 0.768
#> SRR2082496 4 0.3907 0.881 0.232 0.000 0.000 0.768
#> SRR2082493 4 0.4677 0.674 0.040 0.000 0.192 0.768
#> SRR2082494 4 0.4677 0.674 0.040 0.000 0.192 0.768
#> SRR2082491 1 0.3024 0.790 0.852 0.000 0.000 0.148
#> SRR2082492 1 0.3024 0.790 0.852 0.000 0.000 0.148
#> SRR2082489 1 0.0000 0.980 1.000 0.000 0.000 0.000
#> SRR2082490 1 0.0000 0.980 1.000 0.000 0.000 0.000
#> SRR2082497 1 0.0000 0.980 1.000 0.000 0.000 0.000
#> SRR2082498 1 0.0000 0.980 1.000 0.000 0.000 0.000
#> SRR2082487 4 0.3907 0.881 0.232 0.000 0.000 0.768
#> SRR2082488 4 0.3907 0.881 0.232 0.000 0.000 0.768
#> SRR2082485 4 0.3907 0.881 0.232 0.000 0.000 0.768
#> SRR2082486 4 0.3907 0.881 0.232 0.000 0.000 0.768
#> SRR2082479 1 0.0000 0.980 1.000 0.000 0.000 0.000
#> SRR2082480 1 0.0000 0.980 1.000 0.000 0.000 0.000
#> SRR2082483 3 0.0188 1.000 0.000 0.000 0.996 0.004
#> SRR2082484 3 0.0188 1.000 0.000 0.000 0.996 0.004
#> SRR2082481 1 0.0000 0.980 1.000 0.000 0.000 0.000
#> SRR2082482 1 0.0000 0.980 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
#> SRR2082532 5 0.398 0.446 0.000 0.340 0.000 0.000 0.660
#> SRR2082533 5 0.398 0.446 0.000 0.340 0.000 0.000 0.660
#> SRR2082534 5 0.277 0.738 0.000 0.164 0.000 0.000 0.836
#> SRR2082535 5 0.277 0.738 0.000 0.164 0.000 0.000 0.836
#> SRR2082536 5 0.277 0.738 0.000 0.164 0.000 0.000 0.836
#> SRR2082530 2 0.120 0.810 0.000 0.952 0.000 0.000 0.048
#> SRR2082531 2 0.120 0.810 0.000 0.952 0.000 0.000 0.048
#> SRR2082528 5 0.277 0.738 0.000 0.164 0.000 0.000 0.836
#> SRR2082529 5 0.277 0.738 0.000 0.164 0.000 0.000 0.836
#> SRR2082526 2 0.000 0.824 0.000 1.000 0.000 0.000 0.000
#> SRR2082527 2 0.000 0.824 0.000 1.000 0.000 0.000 0.000
#> SRR2082521 2 0.120 0.810 0.000 0.952 0.000 0.000 0.048
#> SRR2082520 2 0.285 0.705 0.000 0.828 0.000 0.000 0.172
#> SRR2082518 2 0.000 0.824 0.000 1.000 0.000 0.000 0.000
#> SRR2082523 2 0.430 -0.307 0.000 0.512 0.000 0.000 0.488
#> SRR2082524 2 0.430 -0.307 0.000 0.512 0.000 0.000 0.488
#> SRR2082525 2 0.000 0.824 0.000 1.000 0.000 0.000 0.000
#> SRR2082522 5 0.307 0.725 0.000 0.196 0.000 0.000 0.804
#> SRR2082519 2 0.285 0.705 0.000 0.828 0.000 0.000 0.172
#> SRR2082513 2 0.120 0.810 0.000 0.952 0.000 0.000 0.048
#> SRR2082512 2 0.000 0.824 0.000 1.000 0.000 0.000 0.000
#> SRR2082516 5 0.398 0.446 0.000 0.340 0.000 0.000 0.660
#> SRR2082515 2 0.285 0.705 0.000 0.828 0.000 0.000 0.172
#> SRR2082517 2 0.000 0.824 0.000 1.000 0.000 0.000 0.000
#> SRR2082514 5 0.398 0.446 0.000 0.340 0.000 0.000 0.660
#> SRR2082508 1 0.000 0.957 1.000 0.000 0.000 0.000 0.000
#> SRR2082509 1 0.029 0.956 0.992 0.000 0.008 0.000 0.000
#> SRR2082507 1 0.000 0.957 1.000 0.000 0.000 0.000 0.000
#> SRR2082510 4 0.000 1.000 0.000 0.000 0.000 1.000 0.000
#> SRR2082511 3 0.403 0.521 0.000 0.000 0.648 0.352 0.000
#> SRR2082501 1 0.029 0.956 0.992 0.000 0.008 0.000 0.000
#> SRR2082502 1 0.029 0.956 0.992 0.000 0.008 0.000 0.000
#> SRR2082499 1 0.029 0.956 0.992 0.000 0.008 0.000 0.000
#> SRR2082500 1 0.029 0.956 0.992 0.000 0.008 0.000 0.000
#> SRR2082503 3 0.000 0.908 0.000 0.000 1.000 0.000 0.000
#> SRR2082505 1 0.000 0.957 1.000 0.000 0.000 0.000 0.000
#> SRR2082506 1 0.000 0.957 1.000 0.000 0.000 0.000 0.000
#> SRR2082504 1 0.000 0.957 1.000 0.000 0.000 0.000 0.000
#> SRR2082495 3 0.000 0.908 0.000 0.000 1.000 0.000 0.000
#> SRR2082496 3 0.000 0.908 0.000 0.000 1.000 0.000 0.000
#> SRR2082493 3 0.304 0.773 0.000 0.000 0.808 0.192 0.000
#> SRR2082494 3 0.304 0.773 0.000 0.000 0.808 0.192 0.000
#> SRR2082491 1 0.398 0.541 0.660 0.000 0.340 0.000 0.000
#> SRR2082492 1 0.398 0.541 0.660 0.000 0.340 0.000 0.000
#> SRR2082489 1 0.000 0.957 1.000 0.000 0.000 0.000 0.000
#> SRR2082490 1 0.000 0.957 1.000 0.000 0.000 0.000 0.000
#> SRR2082497 1 0.029 0.956 0.992 0.000 0.008 0.000 0.000
#> SRR2082498 1 0.029 0.956 0.992 0.000 0.008 0.000 0.000
#> SRR2082487 3 0.000 0.908 0.000 0.000 1.000 0.000 0.000
#> SRR2082488 3 0.000 0.908 0.000 0.000 1.000 0.000 0.000
#> SRR2082485 3 0.000 0.908 0.000 0.000 1.000 0.000 0.000
#> SRR2082486 3 0.000 0.908 0.000 0.000 1.000 0.000 0.000
#> SRR2082479 1 0.000 0.957 1.000 0.000 0.000 0.000 0.000
#> SRR2082480 1 0.000 0.957 1.000 0.000 0.000 0.000 0.000
#> SRR2082483 4 0.000 1.000 0.000 0.000 0.000 1.000 0.000
#> SRR2082484 4 0.000 1.000 0.000 0.000 0.000 1.000 0.000
#> SRR2082481 1 0.000 0.957 1.000 0.000 0.000 0.000 0.000
#> SRR2082482 1 0.000 0.957 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
#> SRR2082532 2 0.6030 0.1989 0.000 0.444 0.000 0.036 NA 0.416
#> SRR2082533 2 0.6030 0.1989 0.000 0.444 0.000 0.036 NA 0.416
#> SRR2082534 4 0.0000 0.9249 0.000 0.000 0.000 1.000 NA 0.000
#> SRR2082535 4 0.0000 0.9249 0.000 0.000 0.000 1.000 NA 0.000
#> SRR2082536 4 0.0000 0.9249 0.000 0.000 0.000 1.000 NA 0.000
#> SRR2082530 2 0.1714 0.4686 0.000 0.908 0.000 0.092 NA 0.000
#> SRR2082531 2 0.1714 0.4686 0.000 0.908 0.000 0.092 NA 0.000
#> SRR2082528 4 0.0000 0.9249 0.000 0.000 0.000 1.000 NA 0.000
#> SRR2082529 4 0.0000 0.9249 0.000 0.000 0.000 1.000 NA 0.000
#> SRR2082526 2 0.3993 0.5221 0.000 0.520 0.000 0.004 NA 0.000
#> SRR2082527 2 0.3993 0.5221 0.000 0.520 0.000 0.004 NA 0.000
#> SRR2082521 2 0.1714 0.4686 0.000 0.908 0.000 0.092 NA 0.000
#> SRR2082520 2 0.3868 0.4970 0.000 0.508 0.000 0.000 NA 0.000
#> SRR2082518 2 0.3993 0.5221 0.000 0.520 0.000 0.004 NA 0.000
#> SRR2082523 2 0.6359 -0.0322 0.000 0.452 0.000 0.352 NA 0.160
#> SRR2082524 2 0.6359 -0.0322 0.000 0.452 0.000 0.352 NA 0.160
#> SRR2082525 2 0.3993 0.5221 0.000 0.520 0.000 0.004 NA 0.000
#> SRR2082522 4 0.5388 0.5677 0.000 0.064 0.000 0.640 NA 0.240
#> SRR2082519 2 0.3868 0.4970 0.000 0.508 0.000 0.000 NA 0.000
#> SRR2082513 2 0.1714 0.4686 0.000 0.908 0.000 0.092 NA 0.000
#> SRR2082512 2 0.3993 0.5221 0.000 0.520 0.000 0.004 NA 0.000
#> SRR2082516 2 0.6030 0.1989 0.000 0.444 0.000 0.036 NA 0.416
#> SRR2082515 2 0.3868 0.4970 0.000 0.508 0.000 0.000 NA 0.000
#> SRR2082517 2 0.3995 0.5218 0.000 0.516 0.000 0.004 NA 0.000
#> SRR2082514 2 0.6030 0.1989 0.000 0.444 0.000 0.036 NA 0.416
#> SRR2082508 1 0.0000 0.9572 1.000 0.000 0.000 0.000 NA 0.000
#> SRR2082509 1 0.0260 0.9558 0.992 0.000 0.008 0.000 NA 0.000
#> SRR2082507 1 0.0000 0.9572 1.000 0.000 0.000 0.000 NA 0.000
#> SRR2082510 6 0.3789 1.0000 0.000 0.000 0.000 0.000 NA 0.584
#> SRR2082511 3 0.4955 0.5187 0.000 0.000 0.644 0.000 NA 0.220
#> SRR2082501 1 0.0260 0.9558 0.992 0.000 0.008 0.000 NA 0.000
#> SRR2082502 1 0.0260 0.9558 0.992 0.000 0.008 0.000 NA 0.000
#> SRR2082499 1 0.0260 0.9558 0.992 0.000 0.008 0.000 NA 0.000
#> SRR2082500 1 0.0260 0.9558 0.992 0.000 0.008 0.000 NA 0.000
#> SRR2082503 3 0.0000 0.9066 0.000 0.000 1.000 0.000 NA 0.000
#> SRR2082505 1 0.0000 0.9572 1.000 0.000 0.000 0.000 NA 0.000
#> SRR2082506 1 0.0000 0.9572 1.000 0.000 0.000 0.000 NA 0.000
#> SRR2082504 1 0.0000 0.9572 1.000 0.000 0.000 0.000 NA 0.000
#> SRR2082495 3 0.0146 0.9059 0.000 0.000 0.996 0.000 NA 0.000
#> SRR2082496 3 0.0146 0.9059 0.000 0.000 0.996 0.000 NA 0.000
#> SRR2082493 3 0.3492 0.7713 0.000 0.000 0.804 0.000 NA 0.076
#> SRR2082494 3 0.3492 0.7713 0.000 0.000 0.804 0.000 NA 0.076
#> SRR2082491 1 0.3578 0.5408 0.660 0.000 0.340 0.000 NA 0.000
#> SRR2082492 1 0.3578 0.5408 0.660 0.000 0.340 0.000 NA 0.000
#> SRR2082489 1 0.0000 0.9572 1.000 0.000 0.000 0.000 NA 0.000
#> SRR2082490 1 0.0000 0.9572 1.000 0.000 0.000 0.000 NA 0.000
#> SRR2082497 1 0.0260 0.9558 0.992 0.000 0.008 0.000 NA 0.000
#> SRR2082498 1 0.0260 0.9558 0.992 0.000 0.008 0.000 NA 0.000
#> SRR2082487 3 0.0000 0.9066 0.000 0.000 1.000 0.000 NA 0.000
#> SRR2082488 3 0.0000 0.9066 0.000 0.000 1.000 0.000 NA 0.000
#> SRR2082485 3 0.0000 0.9066 0.000 0.000 1.000 0.000 NA 0.000
#> SRR2082486 3 0.0000 0.9066 0.000 0.000 1.000 0.000 NA 0.000
#> SRR2082479 1 0.0000 0.9572 1.000 0.000 0.000 0.000 NA 0.000
#> SRR2082480 1 0.0000 0.9572 1.000 0.000 0.000 0.000 NA 0.000
#> SRR2082483 6 0.3789 1.0000 0.000 0.000 0.000 0.000 NA 0.584
#> SRR2082484 6 0.3789 1.0000 0.000 0.000 0.000 0.000 NA 0.584
#> SRR2082481 1 0.0000 0.9572 1.000 0.000 0.000 0.000 NA 0.000
#> SRR2082482 1 0.0000 0.9572 1.000 0.000 0.000 0.000 NA 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 14581 rows and 58 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 2.
#>
#> Following methods can be applied to this 'ConsensusPartition' object:
#> [1] "cola_report" "collect_classes" "collect_plots"
#> [4] "collect_stats" "colnames" "compare_signatures"
#> [7] "consensus_heatmap" "dimension_reduction" "functional_enrichment"
#> [10] "get_anno_col" "get_anno" "get_classes"
#> [13] "get_consensus" "get_matrix" "get_membership"
#> [16] "get_param" "get_signatures" "get_stats"
#> [19] "is_best_k" "is_stable_k" "membership_heatmap"
#> [22] "ncol" "nrow" "plot_ecdf"
#> [25] "rownames" "select_partition_number" "show"
#> [28] "suggest_best_k" "test_to_known_factors"
collect_plots()
function collects all the plots made from res
for all k
(number of partitions)
into one single page to provide an easy and fast comparison between different k
.
collect_plots(res)
The plots are:
k
and the heatmap of
predicted classes for each k
.k
.k
.k
.All the plots in panels can be made by individual functions and they are plotted later in this section.
select_partition_number()
produces several plots showing different
statistics for choosing “optimized” k
. There are following statistics:
k
;k
, the area increased is defined as \(A_k - A_{k-1}\).The detailed explanations of these statistics can be found in the cola vignette.
Generally speaking, lower PAC score, higher mean silhouette score or higher
concordance corresponds to better partition. Rand index and Jaccard index
measure how similar the current partition is compared to partition with k-1
.
If they are too similar, we won't accept k
is better than k-1
.
select_partition_number(res)
The numeric values for all these statistics can be obtained by get_stats()
.
get_stats(res)
#> k 1-PAC mean_silhouette concordance area_increased Rand Jaccard
#> 2 2 1.000 1.000 1.000 0.4996 0.501 0.501
#> 3 3 0.723 0.943 0.871 0.2502 0.854 0.708
#> 4 4 0.570 0.755 0.774 0.1184 0.913 0.754
#> 5 5 0.535 0.702 0.721 0.0711 0.972 0.900
#> 6 6 0.651 0.550 0.659 0.0651 0.881 0.593
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
#> SRR2082532 2 0 1 0 1
#> SRR2082533 2 0 1 0 1
#> SRR2082534 2 0 1 0 1
#> SRR2082535 2 0 1 0 1
#> SRR2082536 2 0 1 0 1
#> SRR2082530 2 0 1 0 1
#> SRR2082531 2 0 1 0 1
#> SRR2082528 2 0 1 0 1
#> SRR2082529 2 0 1 0 1
#> SRR2082526 2 0 1 0 1
#> SRR2082527 2 0 1 0 1
#> SRR2082521 2 0 1 0 1
#> SRR2082520 2 0 1 0 1
#> SRR2082518 2 0 1 0 1
#> SRR2082523 2 0 1 0 1
#> SRR2082524 2 0 1 0 1
#> SRR2082525 2 0 1 0 1
#> SRR2082522 2 0 1 0 1
#> SRR2082519 2 0 1 0 1
#> SRR2082513 2 0 1 0 1
#> SRR2082512 2 0 1 0 1
#> SRR2082516 2 0 1 0 1
#> SRR2082515 2 0 1 0 1
#> SRR2082517 2 0 1 0 1
#> SRR2082514 2 0 1 0 1
#> SRR2082508 1 0 1 1 0
#> SRR2082509 1 0 1 1 0
#> SRR2082507 1 0 1 1 0
#> SRR2082510 1 0 1 1 0
#> SRR2082511 1 0 1 1 0
#> SRR2082501 1 0 1 1 0
#> SRR2082502 1 0 1 1 0
#> SRR2082499 1 0 1 1 0
#> SRR2082500 1 0 1 1 0
#> SRR2082503 1 0 1 1 0
#> SRR2082505 1 0 1 1 0
#> SRR2082506 1 0 1 1 0
#> SRR2082504 1 0 1 1 0
#> SRR2082495 1 0 1 1 0
#> SRR2082496 1 0 1 1 0
#> SRR2082493 1 0 1 1 0
#> SRR2082494 1 0 1 1 0
#> SRR2082491 1 0 1 1 0
#> SRR2082492 1 0 1 1 0
#> SRR2082489 1 0 1 1 0
#> SRR2082490 1 0 1 1 0
#> SRR2082497 1 0 1 1 0
#> SRR2082498 1 0 1 1 0
#> SRR2082487 1 0 1 1 0
#> SRR2082488 1 0 1 1 0
#> SRR2082485 1 0 1 1 0
#> SRR2082486 1 0 1 1 0
#> SRR2082479 1 0 1 1 0
#> SRR2082480 1 0 1 1 0
#> SRR2082483 1 0 1 1 0
#> SRR2082484 1 0 1 1 0
#> SRR2082481 1 0 1 1 0
#> SRR2082482 1 0 1 1 0
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> SRR2082532 2 0.5431 0.873 0.284 0.716 0.000
#> SRR2082533 2 0.5431 0.873 0.284 0.716 0.000
#> SRR2082534 2 0.5733 0.855 0.324 0.676 0.000
#> SRR2082535 2 0.5733 0.855 0.324 0.676 0.000
#> SRR2082536 2 0.5706 0.855 0.320 0.680 0.000
#> SRR2082530 2 0.2959 0.888 0.100 0.900 0.000
#> SRR2082531 2 0.2959 0.888 0.100 0.900 0.000
#> SRR2082528 2 0.5706 0.855 0.320 0.680 0.000
#> SRR2082529 2 0.5706 0.855 0.320 0.680 0.000
#> SRR2082526 2 0.0000 0.876 0.000 1.000 0.000
#> SRR2082527 2 0.0000 0.876 0.000 1.000 0.000
#> SRR2082521 2 0.2959 0.888 0.100 0.900 0.000
#> SRR2082520 2 0.1411 0.871 0.036 0.964 0.000
#> SRR2082518 2 0.0237 0.875 0.004 0.996 0.000
#> SRR2082523 2 0.4974 0.881 0.236 0.764 0.000
#> SRR2082524 2 0.4974 0.881 0.236 0.764 0.000
#> SRR2082525 2 0.0000 0.876 0.000 1.000 0.000
#> SRR2082522 2 0.5706 0.856 0.320 0.680 0.000
#> SRR2082519 2 0.1411 0.871 0.036 0.964 0.000
#> SRR2082513 2 0.0424 0.877 0.008 0.992 0.000
#> SRR2082512 2 0.0237 0.875 0.004 0.996 0.000
#> SRR2082516 2 0.5926 0.848 0.356 0.644 0.000
#> SRR2082515 2 0.1411 0.871 0.036 0.964 0.000
#> SRR2082517 2 0.0237 0.875 0.004 0.996 0.000
#> SRR2082514 2 0.4796 0.883 0.220 0.780 0.000
#> SRR2082508 1 0.5926 1.000 0.644 0.000 0.356
#> SRR2082509 1 0.5926 1.000 0.644 0.000 0.356
#> SRR2082507 1 0.5926 1.000 0.644 0.000 0.356
#> SRR2082510 3 0.0000 0.992 0.000 0.000 1.000
#> SRR2082511 3 0.0000 0.992 0.000 0.000 1.000
#> SRR2082501 1 0.5926 1.000 0.644 0.000 0.356
#> SRR2082502 1 0.5926 1.000 0.644 0.000 0.356
#> SRR2082499 1 0.5926 1.000 0.644 0.000 0.356
#> SRR2082500 1 0.5926 1.000 0.644 0.000 0.356
#> SRR2082503 3 0.1163 0.959 0.028 0.000 0.972
#> SRR2082505 1 0.5926 1.000 0.644 0.000 0.356
#> SRR2082506 1 0.5926 1.000 0.644 0.000 0.356
#> SRR2082504 1 0.5926 1.000 0.644 0.000 0.356
#> SRR2082495 3 0.0237 0.994 0.004 0.000 0.996
#> SRR2082496 3 0.0237 0.994 0.004 0.000 0.996
#> SRR2082493 3 0.0237 0.994 0.004 0.000 0.996
#> SRR2082494 3 0.0237 0.994 0.004 0.000 0.996
#> SRR2082491 1 0.5926 1.000 0.644 0.000 0.356
#> SRR2082492 1 0.5926 1.000 0.644 0.000 0.356
#> SRR2082489 1 0.5926 1.000 0.644 0.000 0.356
#> SRR2082490 1 0.5926 1.000 0.644 0.000 0.356
#> SRR2082497 1 0.5926 1.000 0.644 0.000 0.356
#> SRR2082498 1 0.5926 1.000 0.644 0.000 0.356
#> SRR2082487 1 0.5926 1.000 0.644 0.000 0.356
#> SRR2082488 1 0.5926 1.000 0.644 0.000 0.356
#> SRR2082485 3 0.0237 0.994 0.004 0.000 0.996
#> SRR2082486 3 0.0237 0.994 0.004 0.000 0.996
#> SRR2082479 1 0.5926 1.000 0.644 0.000 0.356
#> SRR2082480 1 0.5926 1.000 0.644 0.000 0.356
#> SRR2082483 3 0.0000 0.992 0.000 0.000 1.000
#> SRR2082484 3 0.0000 0.992 0.000 0.000 1.000
#> SRR2082481 1 0.5926 1.000 0.644 0.000 0.356
#> SRR2082482 1 0.5926 1.000 0.644 0.000 0.356
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> SRR2082532 4 0.670 0.6885 0.000 0.436 0.088 0.476
#> SRR2082533 4 0.670 0.6885 0.000 0.436 0.088 0.476
#> SRR2082534 4 0.494 0.8630 0.000 0.340 0.008 0.652
#> SRR2082535 4 0.494 0.8630 0.000 0.340 0.008 0.652
#> SRR2082536 4 0.511 0.8574 0.000 0.352 0.012 0.636
#> SRR2082530 2 0.440 0.4686 0.000 0.768 0.020 0.212
#> SRR2082531 2 0.440 0.4686 0.000 0.768 0.020 0.212
#> SRR2082528 4 0.511 0.8574 0.000 0.352 0.012 0.636
#> SRR2082529 4 0.511 0.8574 0.000 0.352 0.012 0.636
#> SRR2082526 2 0.117 0.6960 0.000 0.968 0.020 0.012
#> SRR2082527 2 0.117 0.6960 0.000 0.968 0.020 0.012
#> SRR2082521 2 0.487 0.4611 0.000 0.748 0.040 0.212
#> SRR2082520 2 0.365 0.6698 0.000 0.844 0.128 0.028
#> SRR2082518 2 0.174 0.6987 0.000 0.940 0.056 0.004
#> SRR2082523 2 0.596 -0.4263 0.000 0.540 0.040 0.420
#> SRR2082524 2 0.596 -0.4263 0.000 0.540 0.040 0.420
#> SRR2082525 2 0.117 0.6960 0.000 0.968 0.020 0.012
#> SRR2082522 4 0.607 0.8146 0.000 0.376 0.052 0.572
#> SRR2082519 2 0.365 0.6698 0.000 0.844 0.128 0.028
#> SRR2082513 2 0.337 0.6916 0.000 0.868 0.096 0.036
#> SRR2082512 2 0.174 0.6987 0.000 0.940 0.056 0.004
#> SRR2082516 4 0.632 0.8080 0.000 0.356 0.072 0.572
#> SRR2082515 2 0.365 0.6698 0.000 0.844 0.128 0.028
#> SRR2082517 2 0.255 0.6947 0.000 0.900 0.092 0.008
#> SRR2082514 2 0.704 0.0426 0.000 0.564 0.168 0.268
#> SRR2082508 1 0.276 0.8794 0.872 0.000 0.000 0.128
#> SRR2082509 1 0.000 0.8922 1.000 0.000 0.000 0.000
#> SRR2082507 1 0.276 0.8794 0.872 0.000 0.000 0.128
#> SRR2082510 3 0.556 0.9068 0.216 0.000 0.708 0.076
#> SRR2082511 3 0.482 0.9168 0.216 0.000 0.748 0.036
#> SRR2082501 1 0.225 0.8650 0.920 0.000 0.012 0.068
#> SRR2082502 1 0.225 0.8650 0.920 0.000 0.012 0.068
#> SRR2082499 1 0.339 0.8274 0.872 0.000 0.056 0.072
#> SRR2082500 1 0.339 0.8274 0.872 0.000 0.056 0.072
#> SRR2082503 3 0.620 0.7257 0.376 0.000 0.564 0.060
#> SRR2082505 1 0.292 0.8763 0.860 0.000 0.000 0.140
#> SRR2082506 1 0.276 0.8794 0.872 0.000 0.000 0.128
#> SRR2082504 1 0.292 0.8763 0.860 0.000 0.000 0.140
#> SRR2082495 3 0.520 0.9016 0.264 0.000 0.700 0.036
#> SRR2082496 3 0.520 0.9016 0.264 0.000 0.700 0.036
#> SRR2082493 3 0.454 0.9241 0.216 0.000 0.760 0.024
#> SRR2082494 3 0.454 0.9241 0.216 0.000 0.760 0.024
#> SRR2082491 1 0.324 0.8302 0.880 0.000 0.052 0.068
#> SRR2082492 1 0.324 0.8302 0.880 0.000 0.052 0.068
#> SRR2082489 1 0.265 0.8844 0.880 0.000 0.000 0.120
#> SRR2082490 1 0.265 0.8844 0.880 0.000 0.000 0.120
#> SRR2082497 1 0.222 0.8917 0.908 0.000 0.000 0.092
#> SRR2082498 1 0.222 0.8917 0.908 0.000 0.000 0.092
#> SRR2082487 1 0.189 0.8801 0.936 0.000 0.008 0.056
#> SRR2082488 1 0.189 0.8801 0.936 0.000 0.008 0.056
#> SRR2082485 3 0.461 0.9223 0.236 0.000 0.744 0.020
#> SRR2082486 3 0.461 0.9223 0.236 0.000 0.744 0.020
#> SRR2082479 1 0.121 0.8937 0.960 0.000 0.000 0.040
#> SRR2082480 1 0.121 0.8937 0.960 0.000 0.000 0.040
#> SRR2082483 3 0.556 0.9068 0.216 0.000 0.708 0.076
#> SRR2082484 3 0.556 0.9068 0.216 0.000 0.708 0.076
#> SRR2082481 1 0.292 0.8767 0.860 0.000 0.000 0.140
#> SRR2082482 1 0.292 0.8767 0.860 0.000 0.000 0.140
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> SRR2082532 4 0.703 0.681 0.000 0.324 0.044 0.488 NA
#> SRR2082533 4 0.703 0.681 0.000 0.324 0.044 0.488 NA
#> SRR2082534 4 0.422 0.776 0.000 0.280 0.004 0.704 NA
#> SRR2082535 4 0.422 0.776 0.000 0.280 0.004 0.704 NA
#> SRR2082536 4 0.498 0.766 0.000 0.292 0.008 0.660 NA
#> SRR2082530 2 0.524 0.501 0.000 0.704 0.008 0.148 NA
#> SRR2082531 2 0.524 0.501 0.000 0.704 0.008 0.148 NA
#> SRR2082528 4 0.498 0.766 0.000 0.292 0.008 0.660 NA
#> SRR2082529 4 0.498 0.766 0.000 0.292 0.008 0.660 NA
#> SRR2082526 2 0.276 0.704 0.000 0.848 0.000 0.004 NA
#> SRR2082527 2 0.276 0.704 0.000 0.848 0.000 0.004 NA
#> SRR2082521 2 0.540 0.446 0.000 0.688 0.008 0.156 NA
#> SRR2082520 2 0.367 0.671 0.000 0.844 0.060 0.024 NA
#> SRR2082518 2 0.236 0.708 0.000 0.888 0.008 0.000 NA
#> SRR2082523 4 0.647 0.555 0.000 0.420 0.008 0.432 NA
#> SRR2082524 4 0.647 0.555 0.000 0.420 0.008 0.432 NA
#> SRR2082525 2 0.276 0.704 0.000 0.848 0.000 0.004 NA
#> SRR2082522 4 0.671 0.721 0.000 0.312 0.064 0.540 NA
#> SRR2082519 2 0.376 0.668 0.000 0.840 0.060 0.028 NA
#> SRR2082513 2 0.275 0.685 0.000 0.884 0.012 0.016 NA
#> SRR2082512 2 0.236 0.708 0.000 0.888 0.008 0.000 NA
#> SRR2082516 4 0.642 0.735 0.000 0.268 0.044 0.588 NA
#> SRR2082515 2 0.367 0.671 0.000 0.844 0.060 0.024 NA
#> SRR2082517 2 0.223 0.700 0.000 0.912 0.048 0.000 NA
#> SRR2082514 2 0.729 -0.349 0.000 0.480 0.064 0.308 NA
#> SRR2082508 1 0.293 0.736 0.872 0.000 0.000 0.060 NA
#> SRR2082509 1 0.273 0.785 0.840 0.000 0.000 0.000 NA
#> SRR2082507 1 0.293 0.736 0.872 0.000 0.000 0.060 NA
#> SRR2082510 3 0.625 0.803 0.120 0.000 0.664 0.120 NA
#> SRR2082511 3 0.502 0.826 0.120 0.000 0.756 0.048 NA
#> SRR2082501 1 0.476 0.726 0.664 0.000 0.032 0.004 NA
#> SRR2082502 1 0.476 0.726 0.664 0.000 0.032 0.004 NA
#> SRR2082499 1 0.586 0.648 0.576 0.000 0.108 0.004 NA
#> SRR2082500 1 0.586 0.648 0.576 0.000 0.108 0.004 NA
#> SRR2082503 3 0.644 0.602 0.224 0.000 0.548 0.008 NA
#> SRR2082505 1 0.305 0.732 0.864 0.000 0.000 0.060 NA
#> SRR2082506 1 0.293 0.736 0.872 0.000 0.000 0.060 NA
#> SRR2082504 1 0.305 0.732 0.864 0.000 0.000 0.060 NA
#> SRR2082495 3 0.508 0.817 0.128 0.000 0.736 0.020 NA
#> SRR2082496 3 0.508 0.817 0.128 0.000 0.736 0.020 NA
#> SRR2082493 3 0.388 0.845 0.120 0.000 0.820 0.020 NA
#> SRR2082494 3 0.388 0.845 0.120 0.000 0.820 0.020 NA
#> SRR2082491 1 0.625 0.625 0.572 0.000 0.128 0.016 NA
#> SRR2082492 1 0.625 0.625 0.572 0.000 0.128 0.016 NA
#> SRR2082489 1 0.348 0.770 0.824 0.000 0.000 0.040 NA
#> SRR2082490 1 0.348 0.770 0.824 0.000 0.000 0.040 NA
#> SRR2082497 1 0.322 0.781 0.824 0.000 0.000 0.016 NA
#> SRR2082498 1 0.322 0.781 0.824 0.000 0.000 0.016 NA
#> SRR2082487 1 0.495 0.745 0.688 0.000 0.028 0.024 NA
#> SRR2082488 1 0.495 0.745 0.688 0.000 0.028 0.024 NA
#> SRR2082485 3 0.449 0.838 0.124 0.000 0.772 0.008 NA
#> SRR2082486 3 0.449 0.838 0.124 0.000 0.772 0.008 NA
#> SRR2082479 1 0.297 0.781 0.836 0.000 0.000 0.008 NA
#> SRR2082480 1 0.297 0.781 0.836 0.000 0.000 0.008 NA
#> SRR2082483 3 0.629 0.803 0.120 0.000 0.660 0.124 NA
#> SRR2082484 3 0.629 0.803 0.120 0.000 0.660 0.124 NA
#> SRR2082481 1 0.242 0.746 0.888 0.000 0.000 0.012 NA
#> SRR2082482 1 0.242 0.746 0.888 0.000 0.000 0.012 NA
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> SRR2082532 4 0.4884 0.6097 0.000 0.044 0.008 0.640 NA 0.012
#> SRR2082533 4 0.4884 0.6097 0.000 0.044 0.008 0.640 NA 0.012
#> SRR2082534 4 0.0982 0.6495 0.000 0.004 0.004 0.968 NA 0.020
#> SRR2082535 4 0.0982 0.6495 0.000 0.004 0.004 0.968 NA 0.020
#> SRR2082536 4 0.1508 0.6440 0.000 0.012 0.004 0.948 NA 0.016
#> SRR2082530 4 0.6936 -0.0527 0.000 0.352 0.012 0.360 NA 0.032
#> SRR2082531 4 0.6936 -0.0527 0.000 0.352 0.012 0.360 NA 0.032
#> SRR2082528 4 0.1508 0.6440 0.000 0.012 0.004 0.948 NA 0.016
#> SRR2082529 4 0.1508 0.6440 0.000 0.012 0.004 0.948 NA 0.016
#> SRR2082526 2 0.3488 0.7601 0.000 0.780 0.000 0.184 NA 0.000
#> SRR2082527 2 0.3488 0.7601 0.000 0.780 0.000 0.184 NA 0.000
#> SRR2082521 4 0.7018 0.0522 0.000 0.288 0.012 0.376 NA 0.036
#> SRR2082520 2 0.6752 0.7251 0.000 0.524 0.000 0.184 NA 0.164
#> SRR2082518 2 0.2848 0.7746 0.000 0.816 0.000 0.176 NA 0.008
#> SRR2082523 4 0.5187 0.5809 0.000 0.096 0.004 0.628 NA 0.008
#> SRR2082524 4 0.5187 0.5809 0.000 0.096 0.004 0.628 NA 0.008
#> SRR2082525 2 0.3488 0.7601 0.000 0.780 0.000 0.184 NA 0.000
#> SRR2082522 4 0.4131 0.6041 0.000 0.036 0.000 0.784 NA 0.108
#> SRR2082519 2 0.6752 0.7251 0.000 0.524 0.000 0.184 NA 0.164
#> SRR2082513 2 0.7142 0.5332 0.000 0.464 0.012 0.224 NA 0.080
#> SRR2082512 2 0.3386 0.7772 0.000 0.796 0.000 0.176 NA 0.016
#> SRR2082516 4 0.3545 0.6324 0.000 0.012 0.008 0.792 NA 0.012
#> SRR2082515 2 0.6752 0.7251 0.000 0.524 0.000 0.184 NA 0.164
#> SRR2082517 2 0.6310 0.7492 0.000 0.576 0.000 0.176 NA 0.160
#> SRR2082514 4 0.6869 0.3152 0.000 0.164 0.008 0.440 NA 0.060
#> SRR2082508 1 0.2979 0.5683 0.868 0.036 0.000 0.000 NA 0.052
#> SRR2082509 1 0.5182 0.3009 0.596 0.008 0.000 0.000 NA 0.304
#> SRR2082507 1 0.2979 0.5683 0.868 0.036 0.000 0.000 NA 0.052
#> SRR2082510 3 0.3698 0.7400 0.028 0.036 0.824 0.000 NA 0.012
#> SRR2082511 3 0.1476 0.7703 0.028 0.008 0.948 0.000 NA 0.004
#> SRR2082501 6 0.3714 0.6218 0.340 0.000 0.000 0.000 NA 0.656
#> SRR2082502 6 0.3714 0.6218 0.340 0.000 0.000 0.000 NA 0.656
#> SRR2082499 6 0.3565 0.6791 0.304 0.000 0.004 0.000 NA 0.692
#> SRR2082500 6 0.3565 0.6791 0.304 0.000 0.004 0.000 NA 0.692
#> SRR2082503 6 0.7576 -0.2923 0.120 0.044 0.356 0.000 NA 0.380
#> SRR2082505 1 0.2449 0.5725 0.896 0.056 0.000 0.000 NA 0.024
#> SRR2082506 1 0.2979 0.5683 0.868 0.036 0.000 0.000 NA 0.052
#> SRR2082504 1 0.2449 0.5725 0.896 0.056 0.000 0.000 NA 0.024
#> SRR2082495 3 0.5475 0.6475 0.028 0.024 0.620 0.000 NA 0.284
#> SRR2082496 3 0.5475 0.6475 0.028 0.024 0.620 0.000 NA 0.284
#> SRR2082493 3 0.3795 0.7700 0.028 0.016 0.808 0.000 NA 0.128
#> SRR2082494 3 0.3795 0.7700 0.028 0.016 0.808 0.000 NA 0.128
#> SRR2082491 6 0.5689 0.6343 0.304 0.024 0.040 0.000 NA 0.592
#> SRR2082492 6 0.5689 0.6343 0.304 0.024 0.040 0.000 NA 0.592
#> SRR2082489 1 0.5449 0.4883 0.624 0.016 0.000 0.000 NA 0.164
#> SRR2082490 1 0.5449 0.4883 0.624 0.016 0.000 0.000 NA 0.164
#> SRR2082497 1 0.3782 0.1509 0.588 0.000 0.000 0.000 NA 0.412
#> SRR2082498 1 0.3782 0.1509 0.588 0.000 0.000 0.000 NA 0.412
#> SRR2082487 1 0.5961 0.0413 0.432 0.000 0.000 0.000 NA 0.336
#> SRR2082488 1 0.5961 0.0413 0.432 0.000 0.000 0.000 NA 0.336
#> SRR2082485 3 0.5307 0.7036 0.032 0.000 0.664 0.000 NA 0.176
#> SRR2082486 3 0.5307 0.7036 0.032 0.000 0.664 0.000 NA 0.176
#> SRR2082479 1 0.5276 0.4845 0.672 0.036 0.000 0.000 NA 0.168
#> SRR2082480 1 0.5276 0.4845 0.672 0.036 0.000 0.000 NA 0.168
#> SRR2082483 3 0.3808 0.7400 0.028 0.032 0.812 0.000 NA 0.012
#> SRR2082484 3 0.3808 0.7400 0.028 0.032 0.812 0.000 NA 0.012
#> SRR2082481 1 0.2743 0.5897 0.880 0.028 0.000 0.000 NA 0.032
#> SRR2082482 1 0.2743 0.5897 0.880 0.028 0.000 0.000 NA 0.032
Heatmaps for the consensus matrix. It visualizes the probability of two samples to be in a same group.
consensus_heatmap(res, k = 2)
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 14581 rows and 58 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 1.000 1.000 1.000 0.4996 0.501 0.501
#> 3 3 0.902 0.981 0.982 0.2539 0.861 0.722
#> 4 4 0.826 0.869 0.882 0.1024 0.987 0.965
#> 5 5 0.760 0.793 0.839 0.0873 0.909 0.740
#> 6 6 0.686 0.618 0.740 0.0637 0.932 0.738
suggest_best_k()
suggests the best \(k\) based on these statistics. The rules are as follows:
suggest_best_k(res)
#> [1] 3
#> attr(,"optional")
#> [1] 2
There is also optional best \(k\) = 2 that is worth to check.
Following shows the table of the partitions (You need to click the show/hide
code output link to see it). The membership matrix (columns with name p*
)
is inferred by
clue::cl_consensus()
function with the SE
method. Basically the value in the membership matrix
represents the probability to belong to a certain group. The finall class
label for an item is determined with the group with highest probability it
belongs to.
In get_classes()
function, the entropy is calculated from the membership
matrix and the silhouette score is calculated from the consensus matrix.
cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#> class entropy silhouette p1 p2
#> SRR2082532 2 0 1 0 1
#> SRR2082533 2 0 1 0 1
#> SRR2082534 2 0 1 0 1
#> SRR2082535 2 0 1 0 1
#> SRR2082536 2 0 1 0 1
#> SRR2082530 2 0 1 0 1
#> SRR2082531 2 0 1 0 1
#> SRR2082528 2 0 1 0 1
#> SRR2082529 2 0 1 0 1
#> SRR2082526 2 0 1 0 1
#> SRR2082527 2 0 1 0 1
#> SRR2082521 2 0 1 0 1
#> SRR2082520 2 0 1 0 1
#> SRR2082518 2 0 1 0 1
#> SRR2082523 2 0 1 0 1
#> SRR2082524 2 0 1 0 1
#> SRR2082525 2 0 1 0 1
#> SRR2082522 2 0 1 0 1
#> SRR2082519 2 0 1 0 1
#> SRR2082513 2 0 1 0 1
#> SRR2082512 2 0 1 0 1
#> SRR2082516 2 0 1 0 1
#> SRR2082515 2 0 1 0 1
#> SRR2082517 2 0 1 0 1
#> SRR2082514 2 0 1 0 1
#> SRR2082508 1 0 1 1 0
#> SRR2082509 1 0 1 1 0
#> SRR2082507 1 0 1 1 0
#> SRR2082510 1 0 1 1 0
#> SRR2082511 1 0 1 1 0
#> SRR2082501 1 0 1 1 0
#> SRR2082502 1 0 1 1 0
#> SRR2082499 1 0 1 1 0
#> SRR2082500 1 0 1 1 0
#> SRR2082503 1 0 1 1 0
#> SRR2082505 1 0 1 1 0
#> SRR2082506 1 0 1 1 0
#> SRR2082504 1 0 1 1 0
#> SRR2082495 1 0 1 1 0
#> SRR2082496 1 0 1 1 0
#> SRR2082493 1 0 1 1 0
#> SRR2082494 1 0 1 1 0
#> SRR2082491 1 0 1 1 0
#> SRR2082492 1 0 1 1 0
#> SRR2082489 1 0 1 1 0
#> SRR2082490 1 0 1 1 0
#> SRR2082497 1 0 1 1 0
#> SRR2082498 1 0 1 1 0
#> SRR2082487 1 0 1 1 0
#> SRR2082488 1 0 1 1 0
#> SRR2082485 1 0 1 1 0
#> SRR2082486 1 0 1 1 0
#> SRR2082479 1 0 1 1 0
#> SRR2082480 1 0 1 1 0
#> SRR2082483 1 0 1 1 0
#> SRR2082484 1 0 1 1 0
#> SRR2082481 1 0 1 1 0
#> SRR2082482 1 0 1 1 0
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> SRR2082532 2 0.000 1.000 0.000 1 0.000
#> SRR2082533 2 0.000 1.000 0.000 1 0.000
#> SRR2082534 2 0.000 1.000 0.000 1 0.000
#> SRR2082535 2 0.000 1.000 0.000 1 0.000
#> SRR2082536 2 0.000 1.000 0.000 1 0.000
#> SRR2082530 2 0.000 1.000 0.000 1 0.000
#> SRR2082531 2 0.000 1.000 0.000 1 0.000
#> SRR2082528 2 0.000 1.000 0.000 1 0.000
#> SRR2082529 2 0.000 1.000 0.000 1 0.000
#> SRR2082526 2 0.000 1.000 0.000 1 0.000
#> SRR2082527 2 0.000 1.000 0.000 1 0.000
#> SRR2082521 2 0.000 1.000 0.000 1 0.000
#> SRR2082520 2 0.000 1.000 0.000 1 0.000
#> SRR2082518 2 0.000 1.000 0.000 1 0.000
#> SRR2082523 2 0.000 1.000 0.000 1 0.000
#> SRR2082524 2 0.000 1.000 0.000 1 0.000
#> SRR2082525 2 0.000 1.000 0.000 1 0.000
#> SRR2082522 2 0.000 1.000 0.000 1 0.000
#> SRR2082519 2 0.000 1.000 0.000 1 0.000
#> SRR2082513 2 0.000 1.000 0.000 1 0.000
#> SRR2082512 2 0.000 1.000 0.000 1 0.000
#> SRR2082516 2 0.000 1.000 0.000 1 0.000
#> SRR2082515 2 0.000 1.000 0.000 1 0.000
#> SRR2082517 2 0.000 1.000 0.000 1 0.000
#> SRR2082514 2 0.000 1.000 0.000 1 0.000
#> SRR2082508 1 0.000 1.000 1.000 0 0.000
#> SRR2082509 1 0.000 1.000 1.000 0 0.000
#> SRR2082507 1 0.000 1.000 1.000 0 0.000
#> SRR2082510 3 0.000 0.875 0.000 0 1.000
#> SRR2082511 3 0.000 0.875 0.000 0 1.000
#> SRR2082501 1 0.000 1.000 1.000 0 0.000
#> SRR2082502 1 0.000 1.000 1.000 0 0.000
#> SRR2082499 1 0.000 1.000 1.000 0 0.000
#> SRR2082500 1 0.000 1.000 1.000 0 0.000
#> SRR2082503 1 0.000 1.000 1.000 0 0.000
#> SRR2082505 1 0.000 1.000 1.000 0 0.000
#> SRR2082506 1 0.000 1.000 1.000 0 0.000
#> SRR2082504 1 0.000 1.000 1.000 0 0.000
#> SRR2082495 3 0.445 0.886 0.192 0 0.808
#> SRR2082496 3 0.445 0.886 0.192 0 0.808
#> SRR2082493 3 0.418 0.902 0.172 0 0.828
#> SRR2082494 3 0.418 0.902 0.172 0 0.828
#> SRR2082491 1 0.000 1.000 1.000 0 0.000
#> SRR2082492 1 0.000 1.000 1.000 0 0.000
#> SRR2082489 1 0.000 1.000 1.000 0 0.000
#> SRR2082490 1 0.000 1.000 1.000 0 0.000
#> SRR2082497 1 0.000 1.000 1.000 0 0.000
#> SRR2082498 1 0.000 1.000 1.000 0 0.000
#> SRR2082487 1 0.000 1.000 1.000 0 0.000
#> SRR2082488 1 0.000 1.000 1.000 0 0.000
#> SRR2082485 3 0.418 0.902 0.172 0 0.828
#> SRR2082486 3 0.418 0.902 0.172 0 0.828
#> SRR2082479 1 0.000 1.000 1.000 0 0.000
#> SRR2082480 1 0.000 1.000 1.000 0 0.000
#> SRR2082483 3 0.000 0.875 0.000 0 1.000
#> SRR2082484 3 0.000 0.875 0.000 0 1.000
#> SRR2082481 1 0.000 1.000 1.000 0 0.000
#> SRR2082482 1 0.000 1.000 1.000 0 0.000
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> SRR2082532 2 0.4933 0.805 0.000 0.568 0.000 0.432
#> SRR2082533 2 0.4933 0.805 0.000 0.568 0.000 0.432
#> SRR2082534 2 0.4933 0.805 0.000 0.568 0.000 0.432
#> SRR2082535 2 0.4933 0.805 0.000 0.568 0.000 0.432
#> SRR2082536 2 0.4933 0.805 0.000 0.568 0.000 0.432
#> SRR2082530 2 0.4643 0.797 0.000 0.656 0.000 0.344
#> SRR2082531 2 0.4643 0.797 0.000 0.656 0.000 0.344
#> SRR2082528 2 0.4933 0.805 0.000 0.568 0.000 0.432
#> SRR2082529 2 0.4933 0.805 0.000 0.568 0.000 0.432
#> SRR2082526 2 0.0188 0.710 0.000 0.996 0.000 0.004
#> SRR2082527 2 0.0188 0.710 0.000 0.996 0.000 0.004
#> SRR2082521 2 0.4776 0.801 0.000 0.624 0.000 0.376
#> SRR2082520 2 0.0000 0.712 0.000 1.000 0.000 0.000
#> SRR2082518 2 0.0188 0.710 0.000 0.996 0.000 0.004
#> SRR2082523 2 0.4933 0.805 0.000 0.568 0.000 0.432
#> SRR2082524 2 0.4933 0.805 0.000 0.568 0.000 0.432
#> SRR2082525 2 0.0188 0.710 0.000 0.996 0.000 0.004
#> SRR2082522 2 0.4933 0.805 0.000 0.568 0.000 0.432
#> SRR2082519 2 0.0000 0.712 0.000 1.000 0.000 0.000
#> SRR2082513 2 0.0188 0.714 0.000 0.996 0.000 0.004
#> SRR2082512 2 0.0188 0.710 0.000 0.996 0.000 0.004
#> SRR2082516 2 0.4933 0.805 0.000 0.568 0.000 0.432
#> SRR2082515 2 0.0000 0.712 0.000 1.000 0.000 0.000
#> SRR2082517 2 0.0188 0.710 0.000 0.996 0.000 0.004
#> SRR2082514 2 0.4933 0.805 0.000 0.568 0.000 0.432
#> SRR2082508 1 0.0000 0.960 1.000 0.000 0.000 0.000
#> SRR2082509 1 0.0000 0.960 1.000 0.000 0.000 0.000
#> SRR2082507 1 0.0000 0.960 1.000 0.000 0.000 0.000
#> SRR2082510 4 0.4961 0.981 0.000 0.000 0.448 0.552
#> SRR2082511 3 0.0469 0.954 0.000 0.000 0.988 0.012
#> SRR2082501 1 0.1211 0.947 0.960 0.000 0.040 0.000
#> SRR2082502 1 0.1211 0.947 0.960 0.000 0.040 0.000
#> SRR2082499 1 0.3444 0.830 0.816 0.000 0.184 0.000
#> SRR2082500 1 0.3444 0.830 0.816 0.000 0.184 0.000
#> SRR2082503 1 0.2814 0.883 0.868 0.000 0.132 0.000
#> SRR2082505 1 0.0000 0.960 1.000 0.000 0.000 0.000
#> SRR2082506 1 0.0000 0.960 1.000 0.000 0.000 0.000
#> SRR2082504 1 0.0000 0.960 1.000 0.000 0.000 0.000
#> SRR2082495 3 0.0188 0.969 0.004 0.000 0.996 0.000
#> SRR2082496 3 0.0188 0.969 0.004 0.000 0.996 0.000
#> SRR2082493 3 0.0188 0.967 0.000 0.000 0.996 0.004
#> SRR2082494 3 0.0188 0.967 0.000 0.000 0.996 0.004
#> SRR2082491 1 0.2589 0.899 0.884 0.000 0.116 0.000
#> SRR2082492 1 0.2589 0.899 0.884 0.000 0.116 0.000
#> SRR2082489 1 0.0000 0.960 1.000 0.000 0.000 0.000
#> SRR2082490 1 0.0000 0.960 1.000 0.000 0.000 0.000
#> SRR2082497 1 0.0000 0.960 1.000 0.000 0.000 0.000
#> SRR2082498 1 0.0000 0.960 1.000 0.000 0.000 0.000
#> SRR2082487 1 0.1211 0.947 0.960 0.000 0.040 0.000
#> SRR2082488 1 0.1211 0.947 0.960 0.000 0.040 0.000
#> SRR2082485 3 0.0707 0.946 0.020 0.000 0.980 0.000
#> SRR2082486 3 0.0707 0.946 0.020 0.000 0.980 0.000
#> SRR2082479 1 0.0000 0.960 1.000 0.000 0.000 0.000
#> SRR2082480 1 0.0000 0.960 1.000 0.000 0.000 0.000
#> SRR2082483 4 0.4941 0.990 0.000 0.000 0.436 0.564
#> SRR2082484 4 0.4941 0.990 0.000 0.000 0.436 0.564
#> SRR2082481 1 0.0000 0.960 1.000 0.000 0.000 0.000
#> SRR2082482 1 0.0000 0.960 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
#> SRR2082532 5 0.0290 0.901 0.000 0.008 0.000 0.000 0.992
#> SRR2082533 5 0.0290 0.901 0.000 0.008 0.000 0.000 0.992
#> SRR2082534 5 0.0162 0.904 0.000 0.000 0.000 0.004 0.996
#> SRR2082535 5 0.0162 0.904 0.000 0.000 0.000 0.004 0.996
#> SRR2082536 5 0.0324 0.904 0.000 0.004 0.000 0.004 0.992
#> SRR2082530 5 0.3857 0.399 0.000 0.312 0.000 0.000 0.688
#> SRR2082531 5 0.3857 0.399 0.000 0.312 0.000 0.000 0.688
#> SRR2082528 5 0.0324 0.904 0.000 0.004 0.000 0.004 0.992
#> SRR2082529 5 0.0324 0.904 0.000 0.004 0.000 0.004 0.992
#> SRR2082526 2 0.4240 0.948 0.000 0.736 0.000 0.036 0.228
#> SRR2082527 2 0.4240 0.948 0.000 0.736 0.000 0.036 0.228
#> SRR2082521 5 0.3395 0.588 0.000 0.236 0.000 0.000 0.764
#> SRR2082520 2 0.3612 0.930 0.000 0.732 0.000 0.000 0.268
#> SRR2082518 2 0.4210 0.947 0.000 0.740 0.000 0.036 0.224
#> SRR2082523 5 0.0162 0.903 0.000 0.004 0.000 0.000 0.996
#> SRR2082524 5 0.0162 0.903 0.000 0.004 0.000 0.000 0.996
#> SRR2082525 2 0.4240 0.948 0.000 0.736 0.000 0.036 0.228
#> SRR2082522 5 0.0162 0.904 0.000 0.000 0.000 0.004 0.996
#> SRR2082519 2 0.3612 0.930 0.000 0.732 0.000 0.000 0.268
#> SRR2082513 2 0.3636 0.928 0.000 0.728 0.000 0.000 0.272
#> SRR2082512 2 0.4210 0.947 0.000 0.740 0.000 0.036 0.224
#> SRR2082516 5 0.0451 0.900 0.000 0.008 0.000 0.004 0.988
#> SRR2082515 2 0.3612 0.930 0.000 0.732 0.000 0.000 0.268
#> SRR2082517 2 0.3424 0.944 0.000 0.760 0.000 0.000 0.240
#> SRR2082514 5 0.1341 0.867 0.000 0.056 0.000 0.000 0.944
#> SRR2082508 1 0.0162 0.804 0.996 0.004 0.000 0.000 0.000
#> SRR2082509 1 0.1493 0.804 0.948 0.028 0.024 0.000 0.000
#> SRR2082507 1 0.0162 0.804 0.996 0.004 0.000 0.000 0.000
#> SRR2082510 4 0.2522 0.960 0.000 0.052 0.052 0.896 0.000
#> SRR2082511 3 0.4519 0.635 0.000 0.052 0.720 0.228 0.000
#> SRR2082501 1 0.5098 0.663 0.660 0.060 0.276 0.004 0.000
#> SRR2082502 1 0.5098 0.663 0.660 0.060 0.276 0.004 0.000
#> SRR2082499 1 0.5601 0.393 0.476 0.060 0.460 0.004 0.000
#> SRR2082500 1 0.5601 0.393 0.476 0.060 0.460 0.004 0.000
#> SRR2082503 1 0.5850 0.350 0.476 0.096 0.428 0.000 0.000
#> SRR2082505 1 0.0510 0.803 0.984 0.016 0.000 0.000 0.000
#> SRR2082506 1 0.0162 0.804 0.996 0.004 0.000 0.000 0.000
#> SRR2082504 1 0.0510 0.803 0.984 0.016 0.000 0.000 0.000
#> SRR2082495 3 0.0000 0.822 0.000 0.000 1.000 0.000 0.000
#> SRR2082496 3 0.0000 0.822 0.000 0.000 1.000 0.000 0.000
#> SRR2082493 3 0.2605 0.769 0.000 0.000 0.852 0.148 0.000
#> SRR2082494 3 0.2605 0.769 0.000 0.000 0.852 0.148 0.000
#> SRR2082491 1 0.5123 0.567 0.572 0.044 0.384 0.000 0.000
#> SRR2082492 1 0.5123 0.567 0.572 0.044 0.384 0.000 0.000
#> SRR2082489 1 0.1043 0.804 0.960 0.040 0.000 0.000 0.000
#> SRR2082490 1 0.1043 0.804 0.960 0.040 0.000 0.000 0.000
#> SRR2082497 1 0.1430 0.801 0.944 0.052 0.000 0.004 0.000
#> SRR2082498 1 0.1430 0.801 0.944 0.052 0.000 0.004 0.000
#> SRR2082487 1 0.5717 0.623 0.608 0.132 0.260 0.000 0.000
#> SRR2082488 1 0.5717 0.623 0.608 0.132 0.260 0.000 0.000
#> SRR2082485 3 0.2624 0.790 0.012 0.116 0.872 0.000 0.000
#> SRR2082486 3 0.2624 0.790 0.012 0.116 0.872 0.000 0.000
#> SRR2082479 1 0.1018 0.805 0.968 0.016 0.016 0.000 0.000
#> SRR2082480 1 0.1018 0.805 0.968 0.016 0.016 0.000 0.000
#> SRR2082483 4 0.1121 0.980 0.000 0.000 0.044 0.956 0.000
#> SRR2082484 4 0.1121 0.980 0.000 0.000 0.044 0.956 0.000
#> SRR2082481 1 0.0609 0.802 0.980 0.020 0.000 0.000 0.000
#> SRR2082482 1 0.0609 0.802 0.980 0.020 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
#> SRR2082532 4 0.1232 0.83467 0.000 0.016 0.004 0.956 0.024 0.000
#> SRR2082533 4 0.1232 0.83467 0.000 0.016 0.004 0.956 0.024 0.000
#> SRR2082534 4 0.0603 0.83885 0.000 0.004 0.000 0.980 0.016 0.000
#> SRR2082535 4 0.0603 0.83885 0.000 0.004 0.000 0.980 0.016 0.000
#> SRR2082536 4 0.1003 0.83794 0.000 0.020 0.000 0.964 0.016 0.000
#> SRR2082530 4 0.4925 -0.00811 0.000 0.448 0.008 0.500 0.044 0.000
#> SRR2082531 4 0.4925 -0.00811 0.000 0.448 0.008 0.500 0.044 0.000
#> SRR2082528 4 0.1003 0.83794 0.000 0.020 0.000 0.964 0.016 0.000
#> SRR2082529 4 0.1003 0.83794 0.000 0.020 0.000 0.964 0.016 0.000
#> SRR2082526 2 0.3401 0.86020 0.000 0.824 0.008 0.104 0.064 0.000
#> SRR2082527 2 0.3401 0.86020 0.000 0.824 0.008 0.104 0.064 0.000
#> SRR2082521 4 0.4672 0.36020 0.000 0.340 0.004 0.608 0.048 0.000
#> SRR2082520 2 0.4619 0.80731 0.000 0.704 0.008 0.192 0.096 0.000
#> SRR2082518 2 0.3160 0.86192 0.000 0.840 0.008 0.104 0.048 0.000
#> SRR2082523 4 0.1390 0.83501 0.000 0.016 0.004 0.948 0.032 0.000
#> SRR2082524 4 0.1390 0.83501 0.000 0.016 0.004 0.948 0.032 0.000
#> SRR2082525 2 0.3401 0.86020 0.000 0.824 0.008 0.104 0.064 0.000
#> SRR2082522 4 0.1092 0.83629 0.000 0.020 0.000 0.960 0.020 0.000
#> SRR2082519 2 0.4675 0.80255 0.000 0.696 0.008 0.200 0.096 0.000
#> SRR2082513 2 0.4835 0.79700 0.000 0.692 0.012 0.180 0.116 0.000
#> SRR2082512 2 0.3049 0.86244 0.000 0.844 0.004 0.104 0.048 0.000
#> SRR2082516 4 0.0717 0.83428 0.000 0.016 0.000 0.976 0.008 0.000
#> SRR2082515 2 0.4589 0.81049 0.000 0.708 0.008 0.188 0.096 0.000
#> SRR2082517 2 0.3936 0.84605 0.000 0.780 0.008 0.124 0.088 0.000
#> SRR2082514 4 0.3913 0.69394 0.000 0.096 0.012 0.788 0.104 0.000
#> SRR2082508 5 0.3847 0.96868 0.456 0.000 0.000 0.000 0.544 0.000
#> SRR2082509 1 0.3163 -0.10394 0.764 0.000 0.004 0.000 0.232 0.000
#> SRR2082507 5 0.3847 0.96868 0.456 0.000 0.000 0.000 0.544 0.000
#> SRR2082510 6 0.2831 0.91388 0.000 0.048 0.016 0.000 0.064 0.872
#> SRR2082511 3 0.5204 0.69127 0.016 0.032 0.708 0.000 0.108 0.136
#> SRR2082501 1 0.2632 0.53285 0.832 0.004 0.164 0.000 0.000 0.000
#> SRR2082502 1 0.2632 0.53285 0.832 0.004 0.164 0.000 0.000 0.000
#> SRR2082499 1 0.3693 0.47438 0.708 0.004 0.280 0.000 0.008 0.000
#> SRR2082500 1 0.3693 0.47438 0.708 0.004 0.280 0.000 0.008 0.000
#> SRR2082503 1 0.6346 0.35509 0.448 0.020 0.228 0.000 0.304 0.000
#> SRR2082505 5 0.3843 0.96750 0.452 0.000 0.000 0.000 0.548 0.000
#> SRR2082506 5 0.3847 0.96868 0.456 0.000 0.000 0.000 0.544 0.000
#> SRR2082504 5 0.3843 0.96750 0.452 0.000 0.000 0.000 0.548 0.000
#> SRR2082495 3 0.0713 0.79294 0.028 0.000 0.972 0.000 0.000 0.000
#> SRR2082496 3 0.0713 0.79294 0.028 0.000 0.972 0.000 0.000 0.000
#> SRR2082493 3 0.1714 0.76486 0.000 0.000 0.908 0.000 0.000 0.092
#> SRR2082494 3 0.1714 0.76486 0.000 0.000 0.908 0.000 0.000 0.092
#> SRR2082491 1 0.4134 0.51381 0.656 0.000 0.316 0.000 0.028 0.000
#> SRR2082492 1 0.4134 0.51381 0.656 0.000 0.316 0.000 0.028 0.000
#> SRR2082489 1 0.3841 -0.54499 0.616 0.004 0.000 0.000 0.380 0.000
#> SRR2082490 1 0.3841 -0.54499 0.616 0.004 0.000 0.000 0.380 0.000
#> SRR2082497 1 0.2442 0.12936 0.852 0.004 0.000 0.000 0.144 0.000
#> SRR2082498 1 0.2442 0.12936 0.852 0.004 0.000 0.000 0.144 0.000
#> SRR2082487 1 0.5970 0.46519 0.552 0.040 0.120 0.000 0.288 0.000
#> SRR2082488 1 0.5970 0.46519 0.552 0.040 0.120 0.000 0.288 0.000
#> SRR2082485 3 0.5466 0.69151 0.128 0.040 0.652 0.000 0.180 0.000
#> SRR2082486 3 0.5466 0.69151 0.128 0.040 0.652 0.000 0.180 0.000
#> SRR2082479 1 0.3714 -0.44327 0.656 0.000 0.004 0.000 0.340 0.000
#> SRR2082480 1 0.3714 -0.44327 0.656 0.000 0.004 0.000 0.340 0.000
#> SRR2082483 6 0.0000 0.95802 0.000 0.000 0.000 0.000 0.000 1.000
#> SRR2082484 6 0.0000 0.95802 0.000 0.000 0.000 0.000 0.000 1.000
#> SRR2082481 5 0.3864 0.92876 0.480 0.000 0.000 0.000 0.520 0.000
#> SRR2082482 5 0.3864 0.92876 0.480 0.000 0.000 0.000 0.520 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 14581 rows and 58 columns.
#> Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'MAD' method.
#> Subgroups are detected by 'pam' method.
#> Performed in total 1250 partitions by row resampling.
#> Best k for subgroups seems to be 2.
#>
#> Following methods can be applied to this 'ConsensusPartition' object:
#> [1] "cola_report" "collect_classes" "collect_plots"
#> [4] "collect_stats" "colnames" "compare_signatures"
#> [7] "consensus_heatmap" "dimension_reduction" "functional_enrichment"
#> [10] "get_anno_col" "get_anno" "get_classes"
#> [13] "get_consensus" "get_matrix" "get_membership"
#> [16] "get_param" "get_signatures" "get_stats"
#> [19] "is_best_k" "is_stable_k" "membership_heatmap"
#> [22] "ncol" "nrow" "plot_ecdf"
#> [25] "rownames" "select_partition_number" "show"
#> [28] "suggest_best_k" "test_to_known_factors"
collect_plots()
function collects all the plots made from res
for all k
(number of partitions)
into one single page to provide an easy and fast comparison between different k
.
collect_plots(res)
The plots are:
k
and the heatmap of
predicted classes for each k
.k
.k
.k
.All the plots in panels can be made by individual functions and they are plotted later in this section.
select_partition_number()
produces several plots showing different
statistics for choosing “optimized” k
. There are following statistics:
k
;k
, the area increased is defined as \(A_k - A_{k-1}\).The detailed explanations of these statistics can be found in the cola vignette.
Generally speaking, lower PAC score, higher mean silhouette score or higher
concordance corresponds to better partition. Rand index and Jaccard index
measure how similar the current partition is compared to partition with k-1
.
If they are too similar, we won't accept k
is better than k-1
.
select_partition_number(res)
The numeric values for all these statistics can be obtained by get_stats()
.
get_stats(res)
#> k 1-PAC mean_silhouette concordance area_increased Rand Jaccard
#> 2 2 1.000 1.000 1.000 0.4996 0.501 0.501
#> 3 3 0.716 0.786 0.787 0.2365 0.906 0.812
#> 4 4 0.861 0.849 0.938 0.1973 0.826 0.587
#> 5 5 0.875 0.854 0.940 0.0447 0.967 0.876
#> 6 6 0.826 0.654 0.832 0.0508 0.923 0.691
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
#> SRR2082532 2 0 1 0 1
#> SRR2082533 2 0 1 0 1
#> SRR2082534 2 0 1 0 1
#> SRR2082535 2 0 1 0 1
#> SRR2082536 2 0 1 0 1
#> SRR2082530 2 0 1 0 1
#> SRR2082531 2 0 1 0 1
#> SRR2082528 2 0 1 0 1
#> SRR2082529 2 0 1 0 1
#> SRR2082526 2 0 1 0 1
#> SRR2082527 2 0 1 0 1
#> SRR2082521 2 0 1 0 1
#> SRR2082520 2 0 1 0 1
#> SRR2082518 2 0 1 0 1
#> SRR2082523 2 0 1 0 1
#> SRR2082524 2 0 1 0 1
#> SRR2082525 2 0 1 0 1
#> SRR2082522 2 0 1 0 1
#> SRR2082519 2 0 1 0 1
#> SRR2082513 2 0 1 0 1
#> SRR2082512 2 0 1 0 1
#> SRR2082516 2 0 1 0 1
#> SRR2082515 2 0 1 0 1
#> SRR2082517 2 0 1 0 1
#> SRR2082514 2 0 1 0 1
#> SRR2082508 1 0 1 1 0
#> SRR2082509 1 0 1 1 0
#> SRR2082507 1 0 1 1 0
#> SRR2082510 1 0 1 1 0
#> SRR2082511 1 0 1 1 0
#> SRR2082501 1 0 1 1 0
#> SRR2082502 1 0 1 1 0
#> SRR2082499 1 0 1 1 0
#> SRR2082500 1 0 1 1 0
#> SRR2082503 1 0 1 1 0
#> SRR2082505 1 0 1 1 0
#> SRR2082506 1 0 1 1 0
#> SRR2082504 1 0 1 1 0
#> SRR2082495 1 0 1 1 0
#> SRR2082496 1 0 1 1 0
#> SRR2082493 1 0 1 1 0
#> SRR2082494 1 0 1 1 0
#> SRR2082491 1 0 1 1 0
#> SRR2082492 1 0 1 1 0
#> SRR2082489 1 0 1 1 0
#> SRR2082490 1 0 1 1 0
#> SRR2082497 1 0 1 1 0
#> SRR2082498 1 0 1 1 0
#> SRR2082487 1 0 1 1 0
#> SRR2082488 1 0 1 1 0
#> SRR2082485 1 0 1 1 0
#> SRR2082486 1 0 1 1 0
#> SRR2082479 1 0 1 1 0
#> SRR2082480 1 0 1 1 0
#> SRR2082483 1 0 1 1 0
#> SRR2082484 1 0 1 1 0
#> SRR2082481 1 0 1 1 0
#> SRR2082482 1 0 1 1 0
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> SRR2082532 2 0.631 0.994 0.000 0.512 0.488
#> SRR2082533 2 0.631 0.994 0.000 0.512 0.488
#> SRR2082534 2 0.630 0.995 0.000 0.516 0.484
#> SRR2082535 2 0.630 0.995 0.000 0.516 0.484
#> SRR2082536 2 0.630 0.995 0.000 0.516 0.484
#> SRR2082530 3 0.586 -0.433 0.000 0.344 0.656
#> SRR2082531 3 0.586 -0.433 0.000 0.344 0.656
#> SRR2082528 2 0.630 0.995 0.000 0.516 0.484
#> SRR2082529 2 0.630 0.995 0.000 0.516 0.484
#> SRR2082526 3 0.000 0.804 0.000 0.000 1.000
#> SRR2082527 3 0.000 0.804 0.000 0.000 1.000
#> SRR2082521 2 0.631 0.994 0.000 0.512 0.488
#> SRR2082520 3 0.412 0.508 0.000 0.168 0.832
#> SRR2082518 3 0.000 0.804 0.000 0.000 1.000
#> SRR2082523 2 0.631 0.994 0.000 0.512 0.488
#> SRR2082524 2 0.631 0.994 0.000 0.512 0.488
#> SRR2082525 3 0.000 0.804 0.000 0.000 1.000
#> SRR2082522 2 0.630 0.995 0.000 0.516 0.484
#> SRR2082519 3 0.412 0.508 0.000 0.168 0.832
#> SRR2082513 3 0.000 0.804 0.000 0.000 1.000
#> SRR2082512 3 0.000 0.804 0.000 0.000 1.000
#> SRR2082516 2 0.630 0.995 0.000 0.516 0.484
#> SRR2082515 3 0.000 0.804 0.000 0.000 1.000
#> SRR2082517 3 0.000 0.804 0.000 0.000 1.000
#> SRR2082514 2 0.631 0.994 0.000 0.512 0.488
#> SRR2082508 1 0.000 0.848 1.000 0.000 0.000
#> SRR2082509 1 0.000 0.848 1.000 0.000 0.000
#> SRR2082507 1 0.000 0.848 1.000 0.000 0.000
#> SRR2082510 1 0.630 0.677 0.516 0.484 0.000
#> SRR2082511 1 0.630 0.677 0.516 0.484 0.000
#> SRR2082501 1 0.000 0.848 1.000 0.000 0.000
#> SRR2082502 1 0.000 0.848 1.000 0.000 0.000
#> SRR2082499 1 0.000 0.848 1.000 0.000 0.000
#> SRR2082500 1 0.000 0.848 1.000 0.000 0.000
#> SRR2082503 1 0.522 0.771 0.740 0.260 0.000
#> SRR2082505 1 0.000 0.848 1.000 0.000 0.000
#> SRR2082506 1 0.000 0.848 1.000 0.000 0.000
#> SRR2082504 1 0.000 0.848 1.000 0.000 0.000
#> SRR2082495 1 0.630 0.677 0.516 0.484 0.000
#> SRR2082496 1 0.630 0.677 0.516 0.484 0.000
#> SRR2082493 1 0.630 0.677 0.516 0.484 0.000
#> SRR2082494 1 0.630 0.677 0.516 0.484 0.000
#> SRR2082491 1 0.440 0.796 0.812 0.188 0.000
#> SRR2082492 1 0.369 0.812 0.860 0.140 0.000
#> SRR2082489 1 0.000 0.848 1.000 0.000 0.000
#> SRR2082490 1 0.000 0.848 1.000 0.000 0.000
#> SRR2082497 1 0.000 0.848 1.000 0.000 0.000
#> SRR2082498 1 0.000 0.848 1.000 0.000 0.000
#> SRR2082487 1 0.141 0.841 0.964 0.036 0.000
#> SRR2082488 1 0.141 0.841 0.964 0.036 0.000
#> SRR2082485 1 0.630 0.677 0.516 0.484 0.000
#> SRR2082486 1 0.630 0.677 0.516 0.484 0.000
#> SRR2082479 1 0.000 0.848 1.000 0.000 0.000
#> SRR2082480 1 0.000 0.848 1.000 0.000 0.000
#> SRR2082483 1 0.630 0.677 0.516 0.484 0.000
#> SRR2082484 1 0.630 0.677 0.516 0.484 0.000
#> SRR2082481 1 0.000 0.848 1.000 0.000 0.000
#> SRR2082482 1 0.000 0.848 1.000 0.000 0.000
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> SRR2082532 4 0.0336 0.869 0.000 0.008 0.000 0.992
#> SRR2082533 4 0.0336 0.869 0.000 0.008 0.000 0.992
#> SRR2082534 4 0.0000 0.868 0.000 0.000 0.000 1.000
#> SRR2082535 4 0.0000 0.868 0.000 0.000 0.000 1.000
#> SRR2082536 4 0.2081 0.840 0.000 0.084 0.000 0.916
#> SRR2082530 2 0.4866 0.280 0.000 0.596 0.000 0.404
#> SRR2082531 2 0.4866 0.280 0.000 0.596 0.000 0.404
#> SRR2082528 4 0.2011 0.842 0.000 0.080 0.000 0.920
#> SRR2082529 4 0.1940 0.844 0.000 0.076 0.000 0.924
#> SRR2082526 2 0.0000 0.886 0.000 1.000 0.000 0.000
#> SRR2082527 2 0.0000 0.886 0.000 1.000 0.000 0.000
#> SRR2082521 4 0.3907 0.678 0.000 0.232 0.000 0.768
#> SRR2082520 4 0.4898 0.290 0.000 0.416 0.000 0.584
#> SRR2082518 2 0.0000 0.886 0.000 1.000 0.000 0.000
#> SRR2082523 4 0.0592 0.868 0.000 0.016 0.000 0.984
#> SRR2082524 4 0.0592 0.868 0.000 0.016 0.000 0.984
#> SRR2082525 2 0.0000 0.886 0.000 1.000 0.000 0.000
#> SRR2082522 4 0.3311 0.754 0.000 0.172 0.000 0.828
#> SRR2082519 4 0.4907 0.283 0.000 0.420 0.000 0.580
#> SRR2082513 2 0.0000 0.886 0.000 1.000 0.000 0.000
#> SRR2082512 2 0.0000 0.886 0.000 1.000 0.000 0.000
#> SRR2082516 4 0.0000 0.868 0.000 0.000 0.000 1.000
#> SRR2082515 2 0.0188 0.883 0.000 0.996 0.000 0.004
#> SRR2082517 2 0.0000 0.886 0.000 1.000 0.000 0.000
#> SRR2082514 4 0.0336 0.869 0.000 0.008 0.000 0.992
#> SRR2082508 1 0.0000 0.953 1.000 0.000 0.000 0.000
#> SRR2082509 1 0.0000 0.953 1.000 0.000 0.000 0.000
#> SRR2082507 1 0.0000 0.953 1.000 0.000 0.000 0.000
#> SRR2082510 3 0.0000 0.960 0.000 0.000 1.000 0.000
#> SRR2082511 3 0.0000 0.960 0.000 0.000 1.000 0.000
#> SRR2082501 1 0.0000 0.953 1.000 0.000 0.000 0.000
#> SRR2082502 1 0.0000 0.953 1.000 0.000 0.000 0.000
#> SRR2082499 1 0.0000 0.953 1.000 0.000 0.000 0.000
#> SRR2082500 1 0.0000 0.953 1.000 0.000 0.000 0.000
#> SRR2082503 3 0.4356 0.558 0.292 0.000 0.708 0.000
#> SRR2082505 1 0.0000 0.953 1.000 0.000 0.000 0.000
#> SRR2082506 1 0.0000 0.953 1.000 0.000 0.000 0.000
#> SRR2082504 1 0.0000 0.953 1.000 0.000 0.000 0.000
#> SRR2082495 3 0.0188 0.961 0.004 0.000 0.996 0.000
#> SRR2082496 3 0.0188 0.961 0.004 0.000 0.996 0.000
#> SRR2082493 3 0.0188 0.961 0.004 0.000 0.996 0.000
#> SRR2082494 3 0.0188 0.961 0.004 0.000 0.996 0.000
#> SRR2082491 1 0.3486 0.765 0.812 0.000 0.188 0.000
#> SRR2082492 1 0.2921 0.824 0.860 0.000 0.140 0.000
#> SRR2082489 1 0.0000 0.953 1.000 0.000 0.000 0.000
#> SRR2082490 1 0.0000 0.953 1.000 0.000 0.000 0.000
#> SRR2082497 1 0.0000 0.953 1.000 0.000 0.000 0.000
#> SRR2082498 1 0.0000 0.953 1.000 0.000 0.000 0.000
#> SRR2082487 1 0.4331 0.596 0.712 0.000 0.288 0.000
#> SRR2082488 1 0.4331 0.596 0.712 0.000 0.288 0.000
#> SRR2082485 3 0.0188 0.961 0.004 0.000 0.996 0.000
#> SRR2082486 3 0.0188 0.961 0.004 0.000 0.996 0.000
#> SRR2082479 1 0.0000 0.953 1.000 0.000 0.000 0.000
#> SRR2082480 1 0.0000 0.953 1.000 0.000 0.000 0.000
#> SRR2082483 3 0.0000 0.960 0.000 0.000 1.000 0.000
#> SRR2082484 3 0.0000 0.960 0.000 0.000 1.000 0.000
#> SRR2082481 1 0.0000 0.953 1.000 0.000 0.000 0.000
#> SRR2082482 1 0.0000 0.953 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
#> SRR2082532 5 0.0000 0.798 0.000 0.000 0.000 0.000 1.000
#> SRR2082533 5 0.0000 0.798 0.000 0.000 0.000 0.000 1.000
#> SRR2082534 4 0.0000 0.998 0.000 0.000 0.000 1.000 0.000
#> SRR2082535 4 0.0000 0.998 0.000 0.000 0.000 1.000 0.000
#> SRR2082536 4 0.0000 0.998 0.000 0.000 0.000 1.000 0.000
#> SRR2082530 2 0.4227 0.357 0.000 0.580 0.000 0.000 0.420
#> SRR2082531 2 0.4227 0.357 0.000 0.580 0.000 0.000 0.420
#> SRR2082528 4 0.0000 0.998 0.000 0.000 0.000 1.000 0.000
#> SRR2082529 4 0.0000 0.998 0.000 0.000 0.000 1.000 0.000
#> SRR2082526 2 0.0000 0.871 0.000 1.000 0.000 0.000 0.000
#> SRR2082527 2 0.0000 0.871 0.000 1.000 0.000 0.000 0.000
#> SRR2082521 5 0.4435 0.378 0.000 0.016 0.000 0.336 0.648
#> SRR2082520 5 0.4227 0.367 0.000 0.420 0.000 0.000 0.580
#> SRR2082518 2 0.0000 0.871 0.000 1.000 0.000 0.000 0.000
#> SRR2082523 5 0.0000 0.798 0.000 0.000 0.000 0.000 1.000
#> SRR2082524 5 0.0000 0.798 0.000 0.000 0.000 0.000 1.000
#> SRR2082525 2 0.0000 0.871 0.000 1.000 0.000 0.000 0.000
#> SRR2082522 4 0.0324 0.992 0.000 0.004 0.000 0.992 0.004
#> SRR2082519 5 0.4227 0.367 0.000 0.420 0.000 0.000 0.580
#> SRR2082513 2 0.1965 0.802 0.000 0.904 0.000 0.000 0.096
#> SRR2082512 2 0.0000 0.871 0.000 1.000 0.000 0.000 0.000
#> SRR2082516 5 0.1965 0.758 0.000 0.000 0.000 0.096 0.904
#> SRR2082515 2 0.0162 0.868 0.000 0.996 0.000 0.000 0.004
#> SRR2082517 2 0.0000 0.871 0.000 1.000 0.000 0.000 0.000
#> SRR2082514 5 0.1732 0.768 0.000 0.080 0.000 0.000 0.920
#> SRR2082508 1 0.0000 0.952 1.000 0.000 0.000 0.000 0.000
#> SRR2082509 1 0.0000 0.952 1.000 0.000 0.000 0.000 0.000
#> SRR2082507 1 0.0000 0.952 1.000 0.000 0.000 0.000 0.000
#> SRR2082510 3 0.0000 0.961 0.000 0.000 1.000 0.000 0.000
#> SRR2082511 3 0.0000 0.961 0.000 0.000 1.000 0.000 0.000
#> SRR2082501 1 0.0000 0.952 1.000 0.000 0.000 0.000 0.000
#> SRR2082502 1 0.0000 0.952 1.000 0.000 0.000 0.000 0.000
#> SRR2082499 1 0.0000 0.952 1.000 0.000 0.000 0.000 0.000
#> SRR2082500 1 0.0000 0.952 1.000 0.000 0.000 0.000 0.000
#> SRR2082503 3 0.3730 0.562 0.288 0.000 0.712 0.000 0.000
#> SRR2082505 1 0.0000 0.952 1.000 0.000 0.000 0.000 0.000
#> SRR2082506 1 0.0000 0.952 1.000 0.000 0.000 0.000 0.000
#> SRR2082504 1 0.0000 0.952 1.000 0.000 0.000 0.000 0.000
#> SRR2082495 3 0.0000 0.961 0.000 0.000 1.000 0.000 0.000
#> SRR2082496 3 0.0000 0.961 0.000 0.000 1.000 0.000 0.000
#> SRR2082493 3 0.0000 0.961 0.000 0.000 1.000 0.000 0.000
#> SRR2082494 3 0.0000 0.961 0.000 0.000 1.000 0.000 0.000
#> SRR2082491 1 0.3003 0.766 0.812 0.000 0.188 0.000 0.000
#> SRR2082492 1 0.2516 0.825 0.860 0.000 0.140 0.000 0.000
#> SRR2082489 1 0.0000 0.952 1.000 0.000 0.000 0.000 0.000
#> SRR2082490 1 0.0000 0.952 1.000 0.000 0.000 0.000 0.000
#> SRR2082497 1 0.0000 0.952 1.000 0.000 0.000 0.000 0.000
#> SRR2082498 1 0.0000 0.952 1.000 0.000 0.000 0.000 0.000
#> SRR2082487 1 0.3730 0.598 0.712 0.000 0.288 0.000 0.000
#> SRR2082488 1 0.3730 0.598 0.712 0.000 0.288 0.000 0.000
#> SRR2082485 3 0.0000 0.961 0.000 0.000 1.000 0.000 0.000
#> SRR2082486 3 0.0000 0.961 0.000 0.000 1.000 0.000 0.000
#> SRR2082479 1 0.0000 0.952 1.000 0.000 0.000 0.000 0.000
#> SRR2082480 1 0.0000 0.952 1.000 0.000 0.000 0.000 0.000
#> SRR2082483 3 0.0000 0.961 0.000 0.000 1.000 0.000 0.000
#> SRR2082484 3 0.0000 0.961 0.000 0.000 1.000 0.000 0.000
#> SRR2082481 1 0.0000 0.952 1.000 0.000 0.000 0.000 0.000
#> SRR2082482 1 0.0000 0.952 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
#> SRR2082532 5 0.0000 0.7660 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR2082533 5 0.0000 0.7660 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR2082534 4 0.0000 0.9985 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR2082535 4 0.0000 0.9985 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR2082536 4 0.0000 0.9985 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR2082530 2 0.5417 0.4664 0.000 0.576 0.000 0.000 0.244 0.180
#> SRR2082531 2 0.5417 0.4664 0.000 0.576 0.000 0.000 0.244 0.180
#> SRR2082528 4 0.0000 0.9985 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR2082529 4 0.0000 0.9985 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR2082526 2 0.0000 0.8571 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2082527 2 0.0000 0.8571 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2082521 5 0.6113 0.2765 0.000 0.016 0.000 0.332 0.472 0.180
#> SRR2082520 5 0.3797 0.4151 0.000 0.420 0.000 0.000 0.580 0.000
#> SRR2082518 2 0.0000 0.8571 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2082523 5 0.2219 0.7443 0.000 0.000 0.000 0.000 0.864 0.136
#> SRR2082524 5 0.2416 0.7358 0.000 0.000 0.000 0.000 0.844 0.156
#> SRR2082525 2 0.0000 0.8571 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2082522 4 0.0291 0.9923 0.000 0.004 0.000 0.992 0.004 0.000
#> SRR2082519 5 0.3797 0.4151 0.000 0.420 0.000 0.000 0.580 0.000
#> SRR2082513 2 0.3939 0.6877 0.000 0.752 0.000 0.000 0.068 0.180
#> SRR2082512 2 0.0000 0.8571 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2082516 5 0.1387 0.7444 0.000 0.000 0.000 0.068 0.932 0.000
#> SRR2082515 2 0.0291 0.8534 0.000 0.992 0.000 0.000 0.004 0.004
#> SRR2082517 2 0.0000 0.8571 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2082514 5 0.1204 0.7572 0.000 0.056 0.000 0.000 0.944 0.000
#> SRR2082508 1 0.0000 0.8753 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2082509 1 0.4781 0.6230 0.672 0.000 0.188 0.000 0.000 0.140
#> SRR2082507 1 0.0000 0.8753 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2082510 6 0.3684 0.9012 0.000 0.000 0.372 0.000 0.000 0.628
#> SRR2082511 3 0.2854 0.0744 0.000 0.000 0.792 0.000 0.000 0.208
#> SRR2082501 1 0.0000 0.8753 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2082502 1 0.0000 0.8753 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2082499 1 0.0000 0.8753 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2082500 1 0.0000 0.8753 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2082503 3 0.3807 0.2715 0.052 0.000 0.756 0.000 0.000 0.192
#> SRR2082505 1 0.0000 0.8753 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2082506 1 0.0000 0.8753 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2082504 1 0.0000 0.8753 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2082495 3 0.2854 0.0794 0.000 0.000 0.792 0.000 0.000 0.208
#> SRR2082496 3 0.2854 0.0794 0.000 0.000 0.792 0.000 0.000 0.208
#> SRR2082493 3 0.2854 0.0794 0.000 0.000 0.792 0.000 0.000 0.208
#> SRR2082494 3 0.2854 0.0794 0.000 0.000 0.792 0.000 0.000 0.208
#> SRR2082491 3 0.3774 0.1931 0.408 0.000 0.592 0.000 0.000 0.000
#> SRR2082492 3 0.3843 0.1939 0.452 0.000 0.548 0.000 0.000 0.000
#> SRR2082489 1 0.4890 0.6074 0.656 0.000 0.204 0.000 0.000 0.140
#> SRR2082490 1 0.4890 0.6074 0.656 0.000 0.204 0.000 0.000 0.140
#> SRR2082497 1 0.0000 0.8753 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2082498 1 0.0000 0.8753 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2082487 3 0.5855 -0.0481 0.396 0.000 0.412 0.000 0.000 0.192
#> SRR2082488 3 0.5855 -0.0481 0.396 0.000 0.412 0.000 0.000 0.192
#> SRR2082485 3 0.2730 0.2765 0.000 0.000 0.808 0.000 0.000 0.192
#> SRR2082486 3 0.2730 0.2765 0.000 0.000 0.808 0.000 0.000 0.192
#> SRR2082479 1 0.4890 0.6074 0.656 0.000 0.204 0.000 0.000 0.140
#> SRR2082480 1 0.4890 0.6074 0.656 0.000 0.204 0.000 0.000 0.140
#> SRR2082483 6 0.3515 0.9509 0.000 0.000 0.324 0.000 0.000 0.676
#> SRR2082484 6 0.3515 0.9509 0.000 0.000 0.324 0.000 0.000 0.676
#> SRR2082481 1 0.0260 0.8719 0.992 0.000 0.000 0.000 0.000 0.008
#> SRR2082482 1 0.0363 0.8699 0.988 0.000 0.000 0.000 0.000 0.012
Heatmaps for the consensus matrix. It visualizes the probability of two samples to be in a same group.
consensus_heatmap(res, k = 2)
consensus_heatmap(res, k = 3)
consensus_heatmap(res, k = 4)
consensus_heatmap(res, k = 5)
consensus_heatmap(res, k = 6)
Heatmaps for the membership of samples in all partitions to see how consistent they are:
membership_heatmap(res, k = 2)
membership_heatmap(res, k = 3)
membership_heatmap(res, k = 4)
membership_heatmap(res, k = 5)
membership_heatmap(res, k = 6)
As soon as we have had the classes for columns, we can look for signatures which are significantly different between classes which can be candidate marks for certain classes. Following are the heatmaps for signatures.
Signature heatmaps where rows are scaled:
get_signatures(res, k = 2)
get_signatures(res, k = 3)
get_signatures(res, k = 4)
get_signatures(res, k = 5)
get_signatures(res, k = 6)
Signature heatmaps where rows are not scaled:
get_signatures(res, k = 2, scale_rows = FALSE)
get_signatures(res, k = 3, scale_rows = FALSE)
get_signatures(res, k = 4, scale_rows = FALSE)
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 14581 rows and 58 columns.
#> Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'MAD' method.
#> Subgroups are detected by 'mclust' method.
#> Performed in total 1250 partitions by row resampling.
#> Best k for subgroups seems to be 2.
#>
#> Following methods can be applied to this 'ConsensusPartition' object:
#> [1] "cola_report" "collect_classes" "collect_plots"
#> [4] "collect_stats" "colnames" "compare_signatures"
#> [7] "consensus_heatmap" "dimension_reduction" "functional_enrichment"
#> [10] "get_anno_col" "get_anno" "get_classes"
#> [13] "get_consensus" "get_matrix" "get_membership"
#> [16] "get_param" "get_signatures" "get_stats"
#> [19] "is_best_k" "is_stable_k" "membership_heatmap"
#> [22] "ncol" "nrow" "plot_ecdf"
#> [25] "rownames" "select_partition_number" "show"
#> [28] "suggest_best_k" "test_to_known_factors"
collect_plots()
function collects all the plots made from res
for all k
(number of partitions)
into one single page to provide an easy and fast comparison between different k
.
collect_plots(res)
The plots are:
k
and the heatmap of
predicted classes for each k
.k
.k
.k
.All the plots in panels can be made by individual functions and they are plotted later in this section.
select_partition_number()
produces several plots showing different
statistics for choosing “optimized” k
. There are following statistics:
k
;k
, the area increased is defined as \(A_k - A_{k-1}\).The detailed explanations of these statistics can be found in the cola vignette.
Generally speaking, lower PAC score, higher mean silhouette score or higher
concordance corresponds to better partition. Rand index and Jaccard index
measure how similar the current partition is compared to partition with k-1
.
If they are too similar, we won't accept k
is better than k-1
.
select_partition_number(res)
The numeric values for all these statistics can be obtained by get_stats()
.
get_stats(res)
#> k 1-PAC mean_silhouette concordance area_increased Rand Jaccard
#> 2 2 1.000 1.000 1.000 0.4996 0.501 0.501
#> 3 3 0.778 0.938 0.908 0.2574 0.854 0.708
#> 4 4 0.799 0.847 0.918 0.1509 0.918 0.768
#> 5 5 0.700 0.641 0.785 0.0787 0.871 0.569
#> 6 6 0.713 0.642 0.817 0.0470 0.947 0.747
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
#> SRR2082532 2 0 1 0 1
#> SRR2082533 2 0 1 0 1
#> SRR2082534 2 0 1 0 1
#> SRR2082535 2 0 1 0 1
#> SRR2082536 2 0 1 0 1
#> SRR2082530 2 0 1 0 1
#> SRR2082531 2 0 1 0 1
#> SRR2082528 2 0 1 0 1
#> SRR2082529 2 0 1 0 1
#> SRR2082526 2 0 1 0 1
#> SRR2082527 2 0 1 0 1
#> SRR2082521 2 0 1 0 1
#> SRR2082520 2 0 1 0 1
#> SRR2082518 2 0 1 0 1
#> SRR2082523 2 0 1 0 1
#> SRR2082524 2 0 1 0 1
#> SRR2082525 2 0 1 0 1
#> SRR2082522 2 0 1 0 1
#> SRR2082519 2 0 1 0 1
#> SRR2082513 2 0 1 0 1
#> SRR2082512 2 0 1 0 1
#> SRR2082516 2 0 1 0 1
#> SRR2082515 2 0 1 0 1
#> SRR2082517 2 0 1 0 1
#> SRR2082514 2 0 1 0 1
#> SRR2082508 1 0 1 1 0
#> SRR2082509 1 0 1 1 0
#> SRR2082507 1 0 1 1 0
#> SRR2082510 1 0 1 1 0
#> SRR2082511 1 0 1 1 0
#> SRR2082501 1 0 1 1 0
#> SRR2082502 1 0 1 1 0
#> SRR2082499 1 0 1 1 0
#> SRR2082500 1 0 1 1 0
#> SRR2082503 1 0 1 1 0
#> SRR2082505 1 0 1 1 0
#> SRR2082506 1 0 1 1 0
#> SRR2082504 1 0 1 1 0
#> SRR2082495 1 0 1 1 0
#> SRR2082496 1 0 1 1 0
#> SRR2082493 1 0 1 1 0
#> SRR2082494 1 0 1 1 0
#> SRR2082491 1 0 1 1 0
#> SRR2082492 1 0 1 1 0
#> SRR2082489 1 0 1 1 0
#> SRR2082490 1 0 1 1 0
#> SRR2082497 1 0 1 1 0
#> SRR2082498 1 0 1 1 0
#> SRR2082487 1 0 1 1 0
#> SRR2082488 1 0 1 1 0
#> SRR2082485 1 0 1 1 0
#> SRR2082486 1 0 1 1 0
#> SRR2082479 1 0 1 1 0
#> SRR2082480 1 0 1 1 0
#> SRR2082483 1 0 1 1 0
#> SRR2082484 1 0 1 1 0
#> SRR2082481 1 0 1 1 0
#> SRR2082482 1 0 1 1 0
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> SRR2082532 2 0.0000 0.924 0.000 1.000 0.000
#> SRR2082533 2 0.0000 0.924 0.000 1.000 0.000
#> SRR2082534 2 0.0000 0.924 0.000 1.000 0.000
#> SRR2082535 2 0.0000 0.924 0.000 1.000 0.000
#> SRR2082536 2 0.0000 0.924 0.000 1.000 0.000
#> SRR2082530 2 0.4702 0.885 0.000 0.788 0.212
#> SRR2082531 2 0.4702 0.885 0.000 0.788 0.212
#> SRR2082528 2 0.0000 0.924 0.000 1.000 0.000
#> SRR2082529 2 0.0000 0.924 0.000 1.000 0.000
#> SRR2082526 2 0.4796 0.882 0.000 0.780 0.220
#> SRR2082527 2 0.4796 0.882 0.000 0.780 0.220
#> SRR2082521 2 0.4555 0.889 0.000 0.800 0.200
#> SRR2082520 2 0.0000 0.924 0.000 1.000 0.000
#> SRR2082518 2 0.4750 0.884 0.000 0.784 0.216
#> SRR2082523 2 0.1643 0.919 0.000 0.956 0.044
#> SRR2082524 2 0.1643 0.919 0.000 0.956 0.044
#> SRR2082525 2 0.4796 0.882 0.000 0.780 0.220
#> SRR2082522 2 0.0000 0.924 0.000 1.000 0.000
#> SRR2082519 2 0.0000 0.924 0.000 1.000 0.000
#> SRR2082513 2 0.4702 0.885 0.000 0.788 0.212
#> SRR2082512 2 0.4750 0.884 0.000 0.784 0.216
#> SRR2082516 2 0.0000 0.924 0.000 1.000 0.000
#> SRR2082515 2 0.0000 0.924 0.000 1.000 0.000
#> SRR2082517 2 0.4002 0.895 0.000 0.840 0.160
#> SRR2082514 2 0.0000 0.924 0.000 1.000 0.000
#> SRR2082508 1 0.0000 0.992 1.000 0.000 0.000
#> SRR2082509 1 0.0000 0.992 1.000 0.000 0.000
#> SRR2082507 1 0.0000 0.992 1.000 0.000 0.000
#> SRR2082510 3 0.4750 0.917 0.216 0.000 0.784
#> SRR2082511 3 0.4842 0.921 0.224 0.000 0.776
#> SRR2082501 1 0.0237 0.991 0.996 0.000 0.004
#> SRR2082502 1 0.0237 0.991 0.996 0.000 0.004
#> SRR2082499 1 0.0747 0.980 0.984 0.000 0.016
#> SRR2082500 1 0.0424 0.988 0.992 0.000 0.008
#> SRR2082503 3 0.5905 0.869 0.352 0.000 0.648
#> SRR2082505 1 0.0000 0.992 1.000 0.000 0.000
#> SRR2082506 1 0.0000 0.992 1.000 0.000 0.000
#> SRR2082504 1 0.0000 0.992 1.000 0.000 0.000
#> SRR2082495 3 0.5678 0.904 0.316 0.000 0.684
#> SRR2082496 3 0.5591 0.910 0.304 0.000 0.696
#> SRR2082493 3 0.5859 0.881 0.344 0.000 0.656
#> SRR2082494 3 0.5859 0.881 0.344 0.000 0.656
#> SRR2082491 1 0.0747 0.984 0.984 0.000 0.016
#> SRR2082492 1 0.0592 0.987 0.988 0.000 0.012
#> SRR2082489 1 0.0747 0.984 0.984 0.000 0.016
#> SRR2082490 1 0.0747 0.984 0.984 0.000 0.016
#> SRR2082497 1 0.0424 0.990 0.992 0.000 0.008
#> SRR2082498 1 0.0424 0.990 0.992 0.000 0.008
#> SRR2082487 1 0.0000 0.992 1.000 0.000 0.000
#> SRR2082488 1 0.0000 0.992 1.000 0.000 0.000
#> SRR2082485 3 0.5016 0.925 0.240 0.000 0.760
#> SRR2082486 3 0.5016 0.925 0.240 0.000 0.760
#> SRR2082479 1 0.0592 0.988 0.988 0.000 0.012
#> SRR2082480 1 0.0592 0.988 0.988 0.000 0.012
#> SRR2082483 3 0.4702 0.914 0.212 0.000 0.788
#> SRR2082484 3 0.4702 0.914 0.212 0.000 0.788
#> SRR2082481 1 0.0000 0.992 1.000 0.000 0.000
#> SRR2082482 1 0.0000 0.992 1.000 0.000 0.000
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> SRR2082532 4 0.0817 0.891 0.000 0.024 0.000 0.976
#> SRR2082533 4 0.0817 0.891 0.000 0.024 0.000 0.976
#> SRR2082534 4 0.0188 0.897 0.000 0.004 0.000 0.996
#> SRR2082535 4 0.0188 0.897 0.000 0.004 0.000 0.996
#> SRR2082536 4 0.0188 0.897 0.000 0.004 0.000 0.996
#> SRR2082530 2 0.4431 0.679 0.000 0.696 0.000 0.304
#> SRR2082531 2 0.4431 0.679 0.000 0.696 0.000 0.304
#> SRR2082528 4 0.0188 0.897 0.000 0.004 0.000 0.996
#> SRR2082529 4 0.0188 0.897 0.000 0.004 0.000 0.996
#> SRR2082526 2 0.1474 0.836 0.000 0.948 0.000 0.052
#> SRR2082527 2 0.1474 0.836 0.000 0.948 0.000 0.052
#> SRR2082521 4 0.4866 0.157 0.000 0.404 0.000 0.596
#> SRR2082520 4 0.0188 0.896 0.000 0.004 0.000 0.996
#> SRR2082518 2 0.1474 0.836 0.000 0.948 0.000 0.052
#> SRR2082523 4 0.2647 0.806 0.000 0.120 0.000 0.880
#> SRR2082524 4 0.2647 0.806 0.000 0.120 0.000 0.880
#> SRR2082525 2 0.1474 0.836 0.000 0.948 0.000 0.052
#> SRR2082522 4 0.0188 0.897 0.000 0.004 0.000 0.996
#> SRR2082519 4 0.1211 0.881 0.000 0.040 0.000 0.960
#> SRR2082513 2 0.4843 0.482 0.000 0.604 0.000 0.396
#> SRR2082512 2 0.2408 0.825 0.000 0.896 0.000 0.104
#> SRR2082516 4 0.0000 0.895 0.000 0.000 0.000 1.000
#> SRR2082515 4 0.0188 0.896 0.000 0.004 0.000 0.996
#> SRR2082517 4 0.4999 -0.239 0.000 0.492 0.000 0.508
#> SRR2082514 4 0.1940 0.855 0.000 0.076 0.000 0.924
#> SRR2082508 1 0.0707 0.941 0.980 0.000 0.020 0.000
#> SRR2082509 1 0.0188 0.943 0.996 0.000 0.004 0.000
#> SRR2082507 1 0.0707 0.941 0.980 0.000 0.020 0.000
#> SRR2082510 3 0.1474 0.901 0.000 0.052 0.948 0.000
#> SRR2082511 3 0.1022 0.903 0.000 0.032 0.968 0.000
#> SRR2082501 1 0.1474 0.933 0.948 0.000 0.052 0.000
#> SRR2082502 1 0.1211 0.935 0.960 0.000 0.040 0.000
#> SRR2082499 1 0.3172 0.847 0.840 0.000 0.160 0.000
#> SRR2082500 1 0.3172 0.845 0.840 0.000 0.160 0.000
#> SRR2082503 3 0.3311 0.837 0.172 0.000 0.828 0.000
#> SRR2082505 1 0.0707 0.941 0.980 0.000 0.020 0.000
#> SRR2082506 1 0.0707 0.941 0.980 0.000 0.020 0.000
#> SRR2082504 1 0.0707 0.941 0.980 0.000 0.020 0.000
#> SRR2082495 3 0.1940 0.909 0.076 0.000 0.924 0.000
#> SRR2082496 3 0.1940 0.909 0.076 0.000 0.924 0.000
#> SRR2082493 3 0.2469 0.893 0.108 0.000 0.892 0.000
#> SRR2082494 3 0.2469 0.893 0.108 0.000 0.892 0.000
#> SRR2082491 1 0.3649 0.790 0.796 0.000 0.204 0.000
#> SRR2082492 1 0.3649 0.790 0.796 0.000 0.204 0.000
#> SRR2082489 1 0.1474 0.934 0.948 0.000 0.052 0.000
#> SRR2082490 1 0.1474 0.934 0.948 0.000 0.052 0.000
#> SRR2082497 1 0.1211 0.936 0.960 0.000 0.040 0.000
#> SRR2082498 1 0.1211 0.936 0.960 0.000 0.040 0.000
#> SRR2082487 1 0.0000 0.943 1.000 0.000 0.000 0.000
#> SRR2082488 1 0.0000 0.943 1.000 0.000 0.000 0.000
#> SRR2082485 3 0.1867 0.902 0.072 0.000 0.928 0.000
#> SRR2082486 3 0.1867 0.902 0.072 0.000 0.928 0.000
#> SRR2082479 1 0.1302 0.937 0.956 0.000 0.044 0.000
#> SRR2082480 1 0.1302 0.937 0.956 0.000 0.044 0.000
#> SRR2082483 3 0.1474 0.901 0.000 0.052 0.948 0.000
#> SRR2082484 3 0.1474 0.901 0.000 0.052 0.948 0.000
#> SRR2082481 1 0.0707 0.941 0.980 0.000 0.020 0.000
#> SRR2082482 1 0.0707 0.941 0.980 0.000 0.020 0.000
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> SRR2082532 4 0.0912 0.7697 0.000 0.016 0.000 0.972 0.012
#> SRR2082533 4 0.1012 0.7688 0.000 0.020 0.000 0.968 0.012
#> SRR2082534 4 0.4437 0.7434 0.000 0.020 0.000 0.664 0.316
#> SRR2082535 4 0.4437 0.7434 0.000 0.020 0.000 0.664 0.316
#> SRR2082536 4 0.4891 0.7339 0.000 0.044 0.000 0.640 0.316
#> SRR2082530 2 0.3663 0.7470 0.000 0.776 0.000 0.208 0.016
#> SRR2082531 2 0.3696 0.7449 0.000 0.772 0.000 0.212 0.016
#> SRR2082528 4 0.4891 0.7339 0.000 0.044 0.000 0.640 0.316
#> SRR2082529 4 0.4891 0.7339 0.000 0.044 0.000 0.640 0.316
#> SRR2082526 2 0.0000 0.8011 0.000 1.000 0.000 0.000 0.000
#> SRR2082527 2 0.0000 0.8011 0.000 1.000 0.000 0.000 0.000
#> SRR2082521 2 0.4585 0.5543 0.000 0.628 0.000 0.352 0.020
#> SRR2082520 4 0.1544 0.7679 0.000 0.068 0.000 0.932 0.000
#> SRR2082518 2 0.0000 0.8011 0.000 1.000 0.000 0.000 0.000
#> SRR2082523 4 0.5595 0.5746 0.000 0.252 0.000 0.624 0.124
#> SRR2082524 4 0.5595 0.5746 0.000 0.252 0.000 0.624 0.124
#> SRR2082525 2 0.0000 0.8011 0.000 1.000 0.000 0.000 0.000
#> SRR2082522 4 0.2260 0.7813 0.000 0.028 0.000 0.908 0.064
#> SRR2082519 4 0.2471 0.7174 0.000 0.136 0.000 0.864 0.000
#> SRR2082513 2 0.4000 0.7209 0.000 0.748 0.000 0.228 0.024
#> SRR2082512 2 0.0566 0.8017 0.000 0.984 0.000 0.012 0.004
#> SRR2082516 4 0.0162 0.7686 0.000 0.000 0.000 0.996 0.004
#> SRR2082515 4 0.2020 0.7495 0.000 0.100 0.000 0.900 0.000
#> SRR2082517 2 0.4473 0.5592 0.000 0.656 0.000 0.324 0.020
#> SRR2082514 4 0.2763 0.6864 0.000 0.148 0.000 0.848 0.004
#> SRR2082508 1 0.1197 0.7588 0.952 0.000 0.000 0.000 0.048
#> SRR2082509 1 0.4162 0.5888 0.768 0.000 0.056 0.000 0.176
#> SRR2082507 1 0.1043 0.7618 0.960 0.000 0.000 0.000 0.040
#> SRR2082510 3 0.0000 0.8142 0.000 0.000 1.000 0.000 0.000
#> SRR2082511 3 0.2270 0.7800 0.020 0.000 0.904 0.000 0.076
#> SRR2082501 5 0.5005 0.7272 0.276 0.000 0.064 0.000 0.660
#> SRR2082502 5 0.5040 0.7270 0.272 0.000 0.068 0.000 0.660
#> SRR2082499 5 0.4901 0.7282 0.268 0.000 0.060 0.000 0.672
#> SRR2082500 5 0.4901 0.7282 0.268 0.000 0.060 0.000 0.672
#> SRR2082503 1 0.6569 -0.0772 0.448 0.000 0.336 0.000 0.216
#> SRR2082505 1 0.0000 0.7682 1.000 0.000 0.000 0.000 0.000
#> SRR2082506 1 0.1043 0.7618 0.960 0.000 0.000 0.000 0.040
#> SRR2082504 1 0.0000 0.7682 1.000 0.000 0.000 0.000 0.000
#> SRR2082495 5 0.4273 -0.0552 0.000 0.000 0.448 0.000 0.552
#> SRR2082496 5 0.4273 -0.0552 0.000 0.000 0.448 0.000 0.552
#> SRR2082493 3 0.4210 0.2682 0.000 0.000 0.588 0.000 0.412
#> SRR2082494 3 0.4210 0.2682 0.000 0.000 0.588 0.000 0.412
#> SRR2082491 5 0.5200 0.7085 0.304 0.000 0.068 0.000 0.628
#> SRR2082492 5 0.5200 0.7085 0.304 0.000 0.068 0.000 0.628
#> SRR2082489 1 0.4527 -0.0566 0.596 0.000 0.012 0.000 0.392
#> SRR2082490 1 0.4527 -0.0566 0.596 0.000 0.012 0.000 0.392
#> SRR2082497 5 0.4561 0.3898 0.488 0.000 0.008 0.000 0.504
#> SRR2082498 5 0.4561 0.3898 0.488 0.000 0.008 0.000 0.504
#> SRR2082487 1 0.3215 0.6912 0.852 0.000 0.056 0.000 0.092
#> SRR2082488 1 0.3215 0.6912 0.852 0.000 0.056 0.000 0.092
#> SRR2082485 3 0.1764 0.7983 0.064 0.000 0.928 0.000 0.008
#> SRR2082486 3 0.1764 0.7983 0.064 0.000 0.928 0.000 0.008
#> SRR2082479 1 0.1544 0.7455 0.932 0.000 0.068 0.000 0.000
#> SRR2082480 1 0.1544 0.7455 0.932 0.000 0.068 0.000 0.000
#> SRR2082483 3 0.0000 0.8142 0.000 0.000 1.000 0.000 0.000
#> SRR2082484 3 0.0000 0.8142 0.000 0.000 1.000 0.000 0.000
#> SRR2082481 1 0.0000 0.7682 1.000 0.000 0.000 0.000 0.000
#> SRR2082482 1 0.0000 0.7682 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
#> SRR2082532 5 0.1333 0.8103 0.000 0.008 0.000 0.048 0.944 0.000
#> SRR2082533 5 0.1333 0.8103 0.000 0.008 0.000 0.048 0.944 0.000
#> SRR2082534 4 0.0713 0.7755 0.000 0.000 0.000 0.972 0.028 0.000
#> SRR2082535 4 0.0713 0.7755 0.000 0.000 0.000 0.972 0.028 0.000
#> SRR2082536 4 0.0713 0.7755 0.000 0.000 0.000 0.972 0.028 0.000
#> SRR2082530 2 0.4261 0.6603 0.000 0.720 0.004 0.212 0.064 0.000
#> SRR2082531 2 0.4261 0.6603 0.000 0.720 0.004 0.212 0.064 0.000
#> SRR2082528 4 0.0713 0.7755 0.000 0.000 0.000 0.972 0.028 0.000
#> SRR2082529 4 0.0713 0.7755 0.000 0.000 0.000 0.972 0.028 0.000
#> SRR2082526 2 0.0000 0.7281 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2082527 2 0.0000 0.7281 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2082521 2 0.5215 0.6001 0.000 0.620 0.004 0.236 0.140 0.000
#> SRR2082520 5 0.2912 0.7879 0.000 0.012 0.000 0.172 0.816 0.000
#> SRR2082518 2 0.0146 0.7291 0.000 0.996 0.000 0.000 0.004 0.000
#> SRR2082523 4 0.5700 0.0315 0.000 0.396 0.004 0.460 0.140 0.000
#> SRR2082524 4 0.5700 0.0315 0.000 0.396 0.004 0.460 0.140 0.000
#> SRR2082525 2 0.0000 0.7281 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2082522 5 0.4747 0.4642 0.000 0.056 0.000 0.376 0.568 0.000
#> SRR2082519 5 0.2877 0.7906 0.000 0.012 0.000 0.168 0.820 0.000
#> SRR2082513 2 0.5459 0.6035 0.000 0.592 0.004 0.212 0.192 0.000
#> SRR2082512 2 0.2706 0.6963 0.000 0.832 0.000 0.008 0.160 0.000
#> SRR2082516 5 0.1387 0.8063 0.000 0.000 0.000 0.068 0.932 0.000
#> SRR2082515 5 0.2932 0.7911 0.000 0.016 0.000 0.164 0.820 0.000
#> SRR2082517 2 0.5924 0.4360 0.000 0.472 0.004 0.196 0.328 0.000
#> SRR2082514 5 0.0547 0.7957 0.000 0.020 0.000 0.000 0.980 0.000
#> SRR2082508 1 0.1152 0.8172 0.952 0.000 0.044 0.004 0.000 0.000
#> SRR2082509 1 0.3719 0.7263 0.800 0.000 0.124 0.012 0.000 0.064
#> SRR2082507 1 0.1152 0.8172 0.952 0.000 0.044 0.004 0.000 0.000
#> SRR2082510 6 0.0000 0.8517 0.000 0.000 0.000 0.000 0.000 1.000
#> SRR2082511 6 0.2949 0.8190 0.028 0.000 0.140 0.000 0.000 0.832
#> SRR2082501 3 0.2346 0.7124 0.124 0.000 0.868 0.008 0.000 0.000
#> SRR2082502 3 0.2346 0.7124 0.124 0.000 0.868 0.008 0.000 0.000
#> SRR2082499 3 0.2146 0.7148 0.116 0.000 0.880 0.000 0.000 0.004
#> SRR2082500 3 0.2048 0.7145 0.120 0.000 0.880 0.000 0.000 0.000
#> SRR2082503 1 0.5738 0.1099 0.508 0.000 0.284 0.000 0.000 0.208
#> SRR2082505 1 0.0000 0.8245 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2082506 1 0.1152 0.8172 0.952 0.000 0.044 0.004 0.000 0.000
#> SRR2082504 1 0.0000 0.8245 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2082495 3 0.3998 0.4550 0.020 0.000 0.728 0.016 0.000 0.236
#> SRR2082496 3 0.4023 0.4503 0.020 0.000 0.724 0.016 0.000 0.240
#> SRR2082493 3 0.4788 0.2052 0.028 0.000 0.560 0.016 0.000 0.396
#> SRR2082494 3 0.4788 0.2052 0.028 0.000 0.560 0.016 0.000 0.396
#> SRR2082491 3 0.2320 0.7119 0.132 0.000 0.864 0.000 0.000 0.004
#> SRR2082492 3 0.2320 0.7119 0.132 0.000 0.864 0.000 0.000 0.004
#> SRR2082489 1 0.3847 -0.0241 0.544 0.000 0.456 0.000 0.000 0.000
#> SRR2082490 1 0.3847 -0.0241 0.544 0.000 0.456 0.000 0.000 0.000
#> SRR2082497 3 0.3854 0.1940 0.464 0.000 0.536 0.000 0.000 0.000
#> SRR2082498 3 0.3857 0.1824 0.468 0.000 0.532 0.000 0.000 0.000
#> SRR2082487 1 0.2123 0.7981 0.908 0.000 0.020 0.008 0.000 0.064
#> SRR2082488 1 0.2123 0.7981 0.908 0.000 0.020 0.008 0.000 0.064
#> SRR2082485 6 0.4613 0.7703 0.196 0.000 0.116 0.000 0.000 0.688
#> SRR2082486 6 0.4585 0.7739 0.192 0.000 0.116 0.000 0.000 0.692
#> SRR2082479 1 0.0405 0.8257 0.988 0.000 0.004 0.008 0.000 0.000
#> SRR2082480 1 0.0405 0.8257 0.988 0.000 0.004 0.008 0.000 0.000
#> SRR2082483 6 0.0146 0.8514 0.000 0.004 0.000 0.000 0.000 0.996
#> SRR2082484 6 0.0146 0.8514 0.000 0.004 0.000 0.000 0.000 0.996
#> SRR2082481 1 0.0717 0.8260 0.976 0.000 0.016 0.008 0.000 0.000
#> SRR2082482 1 0.0717 0.8260 0.976 0.000 0.016 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["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 14581 rows and 58 columns.
#> Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'MAD' method.
#> Subgroups are detected by 'NMF' method.
#> Performed in total 1250 partitions by row resampling.
#> Best k for subgroups seems to be 3.
#>
#> Following methods can be applied to this 'ConsensusPartition' object:
#> [1] "cola_report" "collect_classes" "collect_plots"
#> [4] "collect_stats" "colnames" "compare_signatures"
#> [7] "consensus_heatmap" "dimension_reduction" "functional_enrichment"
#> [10] "get_anno_col" "get_anno" "get_classes"
#> [13] "get_consensus" "get_matrix" "get_membership"
#> [16] "get_param" "get_signatures" "get_stats"
#> [19] "is_best_k" "is_stable_k" "membership_heatmap"
#> [22] "ncol" "nrow" "plot_ecdf"
#> [25] "rownames" "select_partition_number" "show"
#> [28] "suggest_best_k" "test_to_known_factors"
collect_plots()
function collects all the plots made from res
for all k
(number of partitions)
into one single page to provide an easy and fast comparison between different k
.
collect_plots(res)
The plots are:
k
and the heatmap of
predicted classes for each k
.k
.k
.k
.All the plots in panels can be made by individual functions and they are plotted later in this section.
select_partition_number()
produces several plots showing different
statistics for choosing “optimized” k
. There are following statistics:
k
;k
, the area increased is defined as \(A_k - A_{k-1}\).The detailed explanations of these statistics can be found in the cola vignette.
Generally speaking, lower PAC score, higher mean silhouette score or higher
concordance corresponds to better partition. Rand index and Jaccard index
measure how similar the current partition is compared to partition with k-1
.
If they are too similar, we won't accept k
is better than k-1
.
select_partition_number(res)
The numeric values for all these statistics can be obtained by get_stats()
.
get_stats(res)
#> k 1-PAC mean_silhouette concordance area_increased Rand Jaccard
#> 2 2 1.000 1.000 1.000 0.4996 0.501 0.501
#> 3 3 0.980 0.943 0.896 0.1727 0.930 0.860
#> 4 4 0.896 0.907 0.941 0.0433 0.962 0.914
#> 5 5 0.776 0.791 0.865 0.0790 0.995 0.988
#> 6 6 0.693 0.573 0.773 0.0674 0.921 0.806
suggest_best_k()
suggests the best \(k\) based on these statistics. The rules are as follows:
suggest_best_k(res)
#> [1] 3
#> attr(,"optional")
#> [1] 2
There is also optional best \(k\) = 2 that is worth to check.
Following shows the table of the partitions (You need to click the show/hide
code output link to see it). The membership matrix (columns with name p*
)
is inferred by
clue::cl_consensus()
function with the SE
method. Basically the value in the membership matrix
represents the probability to belong to a certain group. The finall class
label for an item is determined with the group with highest probability it
belongs to.
In get_classes()
function, the entropy is calculated from the membership
matrix and the silhouette score is calculated from the consensus matrix.
cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#> class entropy silhouette p1 p2
#> SRR2082532 2 0.0000 1.000 0.000 1.000
#> SRR2082533 2 0.0000 1.000 0.000 1.000
#> SRR2082534 2 0.0000 1.000 0.000 1.000
#> SRR2082535 2 0.0000 1.000 0.000 1.000
#> SRR2082536 2 0.0000 1.000 0.000 1.000
#> SRR2082530 2 0.0000 1.000 0.000 1.000
#> SRR2082531 2 0.0000 1.000 0.000 1.000
#> SRR2082528 2 0.0000 1.000 0.000 1.000
#> SRR2082529 2 0.0000 1.000 0.000 1.000
#> SRR2082526 2 0.0000 1.000 0.000 1.000
#> SRR2082527 2 0.0000 1.000 0.000 1.000
#> SRR2082521 2 0.0000 1.000 0.000 1.000
#> SRR2082520 2 0.0000 1.000 0.000 1.000
#> SRR2082518 2 0.0000 1.000 0.000 1.000
#> SRR2082523 2 0.0000 1.000 0.000 1.000
#> SRR2082524 2 0.0000 1.000 0.000 1.000
#> SRR2082525 2 0.0000 1.000 0.000 1.000
#> SRR2082522 2 0.0000 1.000 0.000 1.000
#> SRR2082519 2 0.0000 1.000 0.000 1.000
#> SRR2082513 2 0.0000 1.000 0.000 1.000
#> SRR2082512 2 0.0000 1.000 0.000 1.000
#> SRR2082516 2 0.0000 1.000 0.000 1.000
#> SRR2082515 2 0.0000 1.000 0.000 1.000
#> SRR2082517 2 0.0000 1.000 0.000 1.000
#> SRR2082514 2 0.0000 1.000 0.000 1.000
#> SRR2082508 1 0.0000 1.000 1.000 0.000
#> SRR2082509 1 0.0000 1.000 1.000 0.000
#> SRR2082507 1 0.0000 1.000 1.000 0.000
#> SRR2082510 1 0.0376 0.996 0.996 0.004
#> SRR2082511 1 0.0000 1.000 1.000 0.000
#> SRR2082501 1 0.0000 1.000 1.000 0.000
#> SRR2082502 1 0.0000 1.000 1.000 0.000
#> SRR2082499 1 0.0000 1.000 1.000 0.000
#> SRR2082500 1 0.0000 1.000 1.000 0.000
#> SRR2082503 1 0.0000 1.000 1.000 0.000
#> SRR2082505 1 0.0000 1.000 1.000 0.000
#> SRR2082506 1 0.0000 1.000 1.000 0.000
#> SRR2082504 1 0.0000 1.000 1.000 0.000
#> SRR2082495 1 0.0000 1.000 1.000 0.000
#> SRR2082496 1 0.0000 1.000 1.000 0.000
#> SRR2082493 1 0.0000 1.000 1.000 0.000
#> SRR2082494 1 0.0000 1.000 1.000 0.000
#> SRR2082491 1 0.0000 1.000 1.000 0.000
#> SRR2082492 1 0.0000 1.000 1.000 0.000
#> SRR2082489 1 0.0000 1.000 1.000 0.000
#> SRR2082490 1 0.0000 1.000 1.000 0.000
#> SRR2082497 1 0.0000 1.000 1.000 0.000
#> SRR2082498 1 0.0000 1.000 1.000 0.000
#> SRR2082487 1 0.0000 1.000 1.000 0.000
#> SRR2082488 1 0.0000 1.000 1.000 0.000
#> SRR2082485 1 0.0000 1.000 1.000 0.000
#> SRR2082486 1 0.0000 1.000 1.000 0.000
#> SRR2082479 1 0.0000 1.000 1.000 0.000
#> SRR2082480 1 0.0000 1.000 1.000 0.000
#> SRR2082483 1 0.0000 1.000 1.000 0.000
#> SRR2082484 1 0.0000 1.000 1.000 0.000
#> SRR2082481 1 0.0000 1.000 1.000 0.000
#> SRR2082482 1 0.0000 1.000 1.000 0.000
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> SRR2082532 2 0.0000 0.998 0.000 1.000 0.000
#> SRR2082533 2 0.0000 0.998 0.000 1.000 0.000
#> SRR2082534 2 0.0000 0.998 0.000 1.000 0.000
#> SRR2082535 2 0.0000 0.998 0.000 1.000 0.000
#> SRR2082536 2 0.0000 0.998 0.000 1.000 0.000
#> SRR2082530 2 0.0000 0.998 0.000 1.000 0.000
#> SRR2082531 2 0.0000 0.998 0.000 1.000 0.000
#> SRR2082528 2 0.0000 0.998 0.000 1.000 0.000
#> SRR2082529 2 0.0000 0.998 0.000 1.000 0.000
#> SRR2082526 2 0.0424 0.994 0.000 0.992 0.008
#> SRR2082527 2 0.0424 0.994 0.000 0.992 0.008
#> SRR2082521 2 0.0000 0.998 0.000 1.000 0.000
#> SRR2082520 2 0.0000 0.998 0.000 1.000 0.000
#> SRR2082518 2 0.0424 0.994 0.000 0.992 0.008
#> SRR2082523 2 0.0000 0.998 0.000 1.000 0.000
#> SRR2082524 2 0.0000 0.998 0.000 1.000 0.000
#> SRR2082525 2 0.0424 0.994 0.000 0.992 0.008
#> SRR2082522 2 0.0000 0.998 0.000 1.000 0.000
#> SRR2082519 2 0.0000 0.998 0.000 1.000 0.000
#> SRR2082513 2 0.0237 0.996 0.000 0.996 0.004
#> SRR2082512 2 0.0592 0.991 0.000 0.988 0.012
#> SRR2082516 2 0.0000 0.998 0.000 1.000 0.000
#> SRR2082515 2 0.0000 0.998 0.000 1.000 0.000
#> SRR2082517 2 0.0237 0.996 0.000 0.996 0.004
#> SRR2082514 2 0.0000 0.998 0.000 1.000 0.000
#> SRR2082508 1 0.0000 0.953 1.000 0.000 0.000
#> SRR2082509 1 0.0000 0.953 1.000 0.000 0.000
#> SRR2082507 1 0.0000 0.953 1.000 0.000 0.000
#> SRR2082510 3 0.0424 0.984 0.008 0.000 0.992
#> SRR2082511 3 0.1643 0.955 0.044 0.000 0.956
#> SRR2082501 1 0.0000 0.953 1.000 0.000 0.000
#> SRR2082502 1 0.0000 0.953 1.000 0.000 0.000
#> SRR2082499 1 0.0000 0.953 1.000 0.000 0.000
#> SRR2082500 1 0.0000 0.953 1.000 0.000 0.000
#> SRR2082503 1 0.1289 0.928 0.968 0.000 0.032
#> SRR2082505 1 0.0000 0.953 1.000 0.000 0.000
#> SRR2082506 1 0.0000 0.953 1.000 0.000 0.000
#> SRR2082504 1 0.0000 0.953 1.000 0.000 0.000
#> SRR2082495 1 0.0000 0.953 1.000 0.000 0.000
#> SRR2082496 1 0.0000 0.953 1.000 0.000 0.000
#> SRR2082493 1 0.4842 0.710 0.776 0.000 0.224
#> SRR2082494 1 0.3340 0.841 0.880 0.000 0.120
#> SRR2082491 1 0.0000 0.953 1.000 0.000 0.000
#> SRR2082492 1 0.0000 0.953 1.000 0.000 0.000
#> SRR2082489 1 0.0000 0.953 1.000 0.000 0.000
#> SRR2082490 1 0.0000 0.953 1.000 0.000 0.000
#> SRR2082497 1 0.0000 0.953 1.000 0.000 0.000
#> SRR2082498 1 0.0000 0.953 1.000 0.000 0.000
#> SRR2082487 1 0.0000 0.953 1.000 0.000 0.000
#> SRR2082488 1 0.0000 0.953 1.000 0.000 0.000
#> SRR2082485 1 0.6244 0.264 0.560 0.000 0.440
#> SRR2082486 1 0.6244 0.265 0.560 0.000 0.440
#> SRR2082479 1 0.0000 0.953 1.000 0.000 0.000
#> SRR2082480 1 0.0000 0.953 1.000 0.000 0.000
#> SRR2082483 3 0.0237 0.984 0.004 0.000 0.996
#> SRR2082484 3 0.0237 0.984 0.004 0.000 0.996
#> SRR2082481 1 0.0000 0.953 1.000 0.000 0.000
#> SRR2082482 1 0.0000 0.953 1.000 0.000 0.000
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> SRR2082532 2 0.0188 0.986 0.000 0.996 0.000 0.004
#> SRR2082533 2 0.0188 0.986 0.000 0.996 0.000 0.004
#> SRR2082534 2 0.0000 0.987 0.000 1.000 0.000 0.000
#> SRR2082535 2 0.0000 0.987 0.000 1.000 0.000 0.000
#> SRR2082536 2 0.0000 0.987 0.000 1.000 0.000 0.000
#> SRR2082530 2 0.0779 0.983 0.000 0.980 0.004 0.016
#> SRR2082531 2 0.0779 0.983 0.000 0.980 0.004 0.016
#> SRR2082528 2 0.0000 0.987 0.000 1.000 0.000 0.000
#> SRR2082529 2 0.0000 0.987 0.000 1.000 0.000 0.000
#> SRR2082526 2 0.1406 0.971 0.000 0.960 0.016 0.024
#> SRR2082527 2 0.1406 0.971 0.000 0.960 0.016 0.024
#> SRR2082521 2 0.0524 0.985 0.000 0.988 0.004 0.008
#> SRR2082520 2 0.0592 0.982 0.000 0.984 0.000 0.016
#> SRR2082518 2 0.1510 0.969 0.000 0.956 0.016 0.028
#> SRR2082523 2 0.0188 0.986 0.000 0.996 0.000 0.004
#> SRR2082524 2 0.0188 0.986 0.000 0.996 0.000 0.004
#> SRR2082525 2 0.1406 0.971 0.000 0.960 0.016 0.024
#> SRR2082522 2 0.0469 0.984 0.000 0.988 0.000 0.012
#> SRR2082519 2 0.0336 0.985 0.000 0.992 0.000 0.008
#> SRR2082513 2 0.0657 0.984 0.000 0.984 0.004 0.012
#> SRR2082512 2 0.2319 0.943 0.000 0.924 0.036 0.040
#> SRR2082516 2 0.0469 0.985 0.000 0.988 0.000 0.012
#> SRR2082515 2 0.0188 0.986 0.000 0.996 0.000 0.004
#> SRR2082517 2 0.0524 0.985 0.000 0.988 0.004 0.008
#> SRR2082514 2 0.0469 0.985 0.000 0.988 0.000 0.012
#> SRR2082508 1 0.2973 0.832 0.856 0.000 0.000 0.144
#> SRR2082509 1 0.0707 0.928 0.980 0.000 0.000 0.020
#> SRR2082507 1 0.3219 0.808 0.836 0.000 0.000 0.164
#> SRR2082510 3 0.0937 0.789 0.012 0.000 0.976 0.012
#> SRR2082511 3 0.2011 0.774 0.080 0.000 0.920 0.000
#> SRR2082501 1 0.2198 0.907 0.920 0.000 0.008 0.072
#> SRR2082502 1 0.2124 0.907 0.924 0.000 0.008 0.068
#> SRR2082499 1 0.3015 0.881 0.884 0.000 0.024 0.092
#> SRR2082500 1 0.3080 0.881 0.880 0.000 0.024 0.096
#> SRR2082503 1 0.2844 0.888 0.900 0.000 0.052 0.048
#> SRR2082505 1 0.0592 0.926 0.984 0.000 0.000 0.016
#> SRR2082506 1 0.1302 0.920 0.956 0.000 0.000 0.044
#> SRR2082504 1 0.0469 0.926 0.988 0.000 0.000 0.012
#> SRR2082495 1 0.2413 0.912 0.916 0.000 0.020 0.064
#> SRR2082496 1 0.2413 0.912 0.916 0.000 0.020 0.064
#> SRR2082493 3 0.6507 0.394 0.404 0.000 0.520 0.076
#> SRR2082494 3 0.6487 0.330 0.428 0.000 0.500 0.072
#> SRR2082491 1 0.0657 0.928 0.984 0.000 0.012 0.004
#> SRR2082492 1 0.0657 0.928 0.984 0.000 0.012 0.004
#> SRR2082489 1 0.1022 0.927 0.968 0.000 0.000 0.032
#> SRR2082490 1 0.1022 0.927 0.968 0.000 0.000 0.032
#> SRR2082497 1 0.0592 0.926 0.984 0.000 0.000 0.016
#> SRR2082498 1 0.0592 0.926 0.984 0.000 0.000 0.016
#> SRR2082487 1 0.1610 0.924 0.952 0.000 0.016 0.032
#> SRR2082488 1 0.1610 0.924 0.952 0.000 0.016 0.032
#> SRR2082485 1 0.4793 0.714 0.756 0.000 0.204 0.040
#> SRR2082486 1 0.4508 0.754 0.780 0.000 0.184 0.036
#> SRR2082479 1 0.1118 0.927 0.964 0.000 0.000 0.036
#> SRR2082480 1 0.1118 0.927 0.964 0.000 0.000 0.036
#> SRR2082483 3 0.0707 0.786 0.000 0.000 0.980 0.020
#> SRR2082484 3 0.0707 0.786 0.000 0.000 0.980 0.020
#> SRR2082481 1 0.1022 0.927 0.968 0.000 0.000 0.032
#> SRR2082482 1 0.1022 0.927 0.968 0.000 0.000 0.032
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> SRR2082532 2 0.0579 0.967 0.000 0.984 0.000 0.008 NA
#> SRR2082533 2 0.0579 0.967 0.000 0.984 0.000 0.008 NA
#> SRR2082534 2 0.0693 0.966 0.000 0.980 0.000 0.012 NA
#> SRR2082535 2 0.0693 0.966 0.000 0.980 0.000 0.012 NA
#> SRR2082536 2 0.0693 0.966 0.000 0.980 0.000 0.012 NA
#> SRR2082530 2 0.0968 0.965 0.000 0.972 0.012 0.004 NA
#> SRR2082531 2 0.0968 0.965 0.000 0.972 0.012 0.004 NA
#> SRR2082528 2 0.0693 0.966 0.000 0.980 0.000 0.012 NA
#> SRR2082529 2 0.0693 0.966 0.000 0.980 0.000 0.012 NA
#> SRR2082526 2 0.2140 0.938 0.000 0.924 0.024 0.040 NA
#> SRR2082527 2 0.2140 0.938 0.000 0.924 0.024 0.040 NA
#> SRR2082521 2 0.0290 0.967 0.000 0.992 0.000 0.000 NA
#> SRR2082520 2 0.0794 0.964 0.000 0.972 0.000 0.000 NA
#> SRR2082518 2 0.2654 0.925 0.000 0.900 0.044 0.040 NA
#> SRR2082523 2 0.0162 0.967 0.000 0.996 0.000 0.000 NA
#> SRR2082524 2 0.0162 0.967 0.000 0.996 0.000 0.000 NA
#> SRR2082525 2 0.2140 0.938 0.000 0.924 0.024 0.040 NA
#> SRR2082522 2 0.0798 0.966 0.000 0.976 0.000 0.008 NA
#> SRR2082519 2 0.0579 0.968 0.000 0.984 0.008 0.000 NA
#> SRR2082513 2 0.1087 0.963 0.000 0.968 0.016 0.008 NA
#> SRR2082512 2 0.4181 0.800 0.000 0.788 0.152 0.048 NA
#> SRR2082516 2 0.1018 0.963 0.000 0.968 0.000 0.016 NA
#> SRR2082515 2 0.0968 0.966 0.000 0.972 0.004 0.012 NA
#> SRR2082517 2 0.1588 0.956 0.000 0.948 0.028 0.016 NA
#> SRR2082514 2 0.0798 0.965 0.000 0.976 0.000 0.008 NA
#> SRR2082508 1 0.3715 0.494 0.736 0.000 0.000 0.004 NA
#> SRR2082509 1 0.0290 0.737 0.992 0.000 0.000 0.000 NA
#> SRR2082507 1 0.4299 0.250 0.608 0.000 0.000 0.004 NA
#> SRR2082510 3 0.1124 0.913 0.004 0.000 0.960 0.036 NA
#> SRR2082511 3 0.2228 0.835 0.048 0.000 0.912 0.040 NA
#> SRR2082501 1 0.3790 0.575 0.744 0.000 0.004 0.248 NA
#> SRR2082502 1 0.3817 0.571 0.740 0.000 0.004 0.252 NA
#> SRR2082499 1 0.4084 0.457 0.668 0.000 0.004 0.328 NA
#> SRR2082500 1 0.4270 0.427 0.656 0.000 0.004 0.336 NA
#> SRR2082503 1 0.4449 0.611 0.784 0.000 0.136 0.028 NA
#> SRR2082505 1 0.0992 0.731 0.968 0.000 0.000 0.008 NA
#> SRR2082506 1 0.1952 0.700 0.912 0.000 0.000 0.004 NA
#> SRR2082504 1 0.0798 0.734 0.976 0.000 0.000 0.008 NA
#> SRR2082495 1 0.4626 0.483 0.616 0.000 0.020 0.364 NA
#> SRR2082496 1 0.4599 0.498 0.624 0.000 0.020 0.356 NA
#> SRR2082493 4 0.6906 0.909 0.188 0.000 0.368 0.428 NA
#> SRR2082494 4 0.7025 0.915 0.220 0.000 0.344 0.420 NA
#> SRR2082491 1 0.3022 0.735 0.848 0.000 0.012 0.136 NA
#> SRR2082492 1 0.3067 0.733 0.844 0.000 0.012 0.140 NA
#> SRR2082489 1 0.3350 0.733 0.844 0.000 0.004 0.112 NA
#> SRR2082490 1 0.3350 0.733 0.844 0.000 0.004 0.112 NA
#> SRR2082497 1 0.1597 0.729 0.940 0.000 0.000 0.048 NA
#> SRR2082498 1 0.1597 0.729 0.940 0.000 0.000 0.048 NA
#> SRR2082487 1 0.3070 0.736 0.860 0.000 0.012 0.112 NA
#> SRR2082488 1 0.3070 0.736 0.860 0.000 0.012 0.112 NA
#> SRR2082485 1 0.6309 0.198 0.536 0.000 0.312 0.144 NA
#> SRR2082486 1 0.6132 0.307 0.572 0.000 0.284 0.136 NA
#> SRR2082479 1 0.2407 0.744 0.896 0.000 0.004 0.088 NA
#> SRR2082480 1 0.2464 0.744 0.892 0.000 0.004 0.092 NA
#> SRR2082483 3 0.0290 0.922 0.000 0.000 0.992 0.000 NA
#> SRR2082484 3 0.0290 0.922 0.000 0.000 0.992 0.000 NA
#> SRR2082481 1 0.2407 0.744 0.896 0.000 0.004 0.088 NA
#> SRR2082482 1 0.2407 0.744 0.896 0.000 0.004 0.088 NA
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> SRR2082532 2 0.1477 0.9418 0.000 0.940 0.004 0.008 NA 0.000
#> SRR2082533 2 0.1477 0.9418 0.000 0.940 0.004 0.008 NA 0.000
#> SRR2082534 2 0.1152 0.9440 0.000 0.952 0.004 0.000 NA 0.000
#> SRR2082535 2 0.1152 0.9440 0.000 0.952 0.004 0.000 NA 0.000
#> SRR2082536 2 0.1075 0.9437 0.000 0.952 0.000 0.000 NA 0.000
#> SRR2082530 2 0.0909 0.9470 0.000 0.968 0.000 0.012 NA 0.000
#> SRR2082531 2 0.0909 0.9470 0.000 0.968 0.000 0.012 NA 0.000
#> SRR2082528 2 0.1075 0.9437 0.000 0.952 0.000 0.000 NA 0.000
#> SRR2082529 2 0.1075 0.9437 0.000 0.952 0.000 0.000 NA 0.000
#> SRR2082526 2 0.2520 0.9140 0.000 0.888 0.004 0.008 NA 0.024
#> SRR2082527 2 0.2599 0.9115 0.000 0.884 0.004 0.008 NA 0.028
#> SRR2082521 2 0.0870 0.9477 0.000 0.972 0.004 0.012 NA 0.000
#> SRR2082520 2 0.1151 0.9451 0.000 0.956 0.000 0.012 NA 0.000
#> SRR2082518 2 0.3090 0.8849 0.000 0.848 0.000 0.008 NA 0.056
#> SRR2082523 2 0.0964 0.9485 0.000 0.968 0.004 0.012 NA 0.000
#> SRR2082524 2 0.0964 0.9485 0.000 0.968 0.004 0.012 NA 0.000
#> SRR2082525 2 0.2465 0.9164 0.000 0.892 0.004 0.008 NA 0.024
#> SRR2082522 2 0.1196 0.9477 0.000 0.952 0.000 0.008 NA 0.000
#> SRR2082519 2 0.1390 0.9441 0.000 0.948 0.004 0.016 NA 0.000
#> SRR2082513 2 0.1692 0.9417 0.000 0.932 0.008 0.012 NA 0.000
#> SRR2082512 2 0.3952 0.8142 0.000 0.780 0.000 0.008 NA 0.108
#> SRR2082516 2 0.1364 0.9416 0.000 0.944 0.004 0.004 NA 0.000
#> SRR2082515 2 0.1194 0.9447 0.000 0.956 0.004 0.008 NA 0.000
#> SRR2082517 2 0.1787 0.9372 0.000 0.932 0.000 0.016 NA 0.020
#> SRR2082514 2 0.1194 0.9472 0.000 0.956 0.008 0.004 NA 0.000
#> SRR2082508 1 0.5000 -0.6261 0.520 0.000 0.060 0.416 NA 0.004
#> SRR2082509 1 0.2201 0.5422 0.912 0.000 0.048 0.024 NA 0.012
#> SRR2082507 4 0.4763 0.0000 0.372 0.000 0.048 0.576 NA 0.004
#> SRR2082510 6 0.1155 0.6094 0.004 0.000 0.036 0.000 NA 0.956
#> SRR2082511 6 0.2716 0.5752 0.044 0.000 0.064 0.004 NA 0.880
#> SRR2082501 1 0.4261 -0.0520 0.568 0.000 0.416 0.008 NA 0.008
#> SRR2082502 1 0.4253 -0.0372 0.572 0.000 0.412 0.008 NA 0.008
#> SRR2082499 3 0.4657 0.2119 0.456 0.000 0.508 0.004 NA 0.032
#> SRR2082500 3 0.4648 0.2315 0.444 0.000 0.520 0.004 NA 0.032
#> SRR2082503 6 0.7338 -0.2736 0.352 0.000 0.120 0.152 NA 0.368
#> SRR2082505 1 0.3666 0.4212 0.812 0.000 0.080 0.096 NA 0.004
#> SRR2082506 1 0.4121 0.1577 0.732 0.000 0.056 0.208 NA 0.004
#> SRR2082504 1 0.3194 0.4540 0.848 0.000 0.064 0.076 NA 0.004
#> SRR2082495 1 0.6090 -0.0659 0.484 0.000 0.376 0.000 NA 0.072
#> SRR2082496 1 0.6107 -0.0299 0.496 0.000 0.360 0.000 NA 0.076
#> SRR2082493 3 0.6622 0.2820 0.168 0.000 0.444 0.004 NA 0.340
#> SRR2082494 3 0.6755 0.3132 0.188 0.000 0.432 0.004 NA 0.328
#> SRR2082491 1 0.3800 0.4852 0.764 0.000 0.192 0.000 NA 0.008
#> SRR2082492 1 0.3764 0.4923 0.772 0.000 0.184 0.000 NA 0.012
#> SRR2082489 1 0.3660 0.5281 0.780 0.000 0.060 0.000 NA 0.000
#> SRR2082490 1 0.3660 0.5281 0.780 0.000 0.060 0.000 NA 0.000
#> SRR2082497 1 0.3470 0.4679 0.772 0.000 0.200 0.028 NA 0.000
#> SRR2082498 1 0.3301 0.4811 0.788 0.000 0.188 0.024 NA 0.000
#> SRR2082487 1 0.3620 0.5418 0.808 0.000 0.060 0.000 NA 0.012
#> SRR2082488 1 0.3603 0.5427 0.808 0.000 0.056 0.000 NA 0.012
#> SRR2082485 6 0.6725 -0.1107 0.384 0.000 0.084 0.000 NA 0.404
#> SRR2082486 1 0.6725 -0.1621 0.404 0.000 0.084 0.000 NA 0.384
#> SRR2082479 1 0.2302 0.5412 0.872 0.000 0.008 0.000 NA 0.000
#> SRR2082480 1 0.2234 0.5381 0.872 0.000 0.004 0.000 NA 0.000
#> SRR2082483 6 0.0935 0.6142 0.000 0.000 0.000 0.004 NA 0.964
#> SRR2082484 6 0.0935 0.6142 0.000 0.000 0.000 0.004 NA 0.964
#> SRR2082481 1 0.2655 0.5312 0.848 0.000 0.008 0.004 NA 0.000
#> SRR2082482 1 0.2755 0.5299 0.844 0.000 0.012 0.004 NA 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 14581 rows and 58 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 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 1.000 1.000 1.000 0.4996 0.501 0.501
#> 3 3 1.000 1.000 1.000 0.1089 0.946 0.891
#> 4 4 0.973 0.976 0.987 0.1426 0.924 0.829
#> 5 5 0.969 0.879 0.953 0.0384 0.981 0.948
#> 6 6 0.767 0.682 0.793 0.1177 0.829 0.539
suggest_best_k()
suggests the best \(k\) based on these statistics. The rules are as follows:
suggest_best_k(res)
#> [1] 5
#> attr(,"optional")
#> [1] 2 3 4
There is also optional best \(k\) = 2 3 4 that is worth to check.
Following shows the table of the partitions (You need to click the show/hide
code output link to see it). The membership matrix (columns with name p*
)
is inferred by
clue::cl_consensus()
function with the SE
method. Basically the value in the membership matrix
represents the probability to belong to a certain group. The finall class
label for an item is determined with the group with highest probability it
belongs to.
In get_classes()
function, the entropy is calculated from the membership
matrix and the silhouette score is calculated from the consensus matrix.
cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#> class entropy silhouette p1 p2
#> SRR2082532 2 0 1 0 1
#> SRR2082533 2 0 1 0 1
#> SRR2082534 2 0 1 0 1
#> SRR2082535 2 0 1 0 1
#> SRR2082536 2 0 1 0 1
#> SRR2082530 2 0 1 0 1
#> SRR2082531 2 0 1 0 1
#> SRR2082528 2 0 1 0 1
#> SRR2082529 2 0 1 0 1
#> SRR2082526 2 0 1 0 1
#> SRR2082527 2 0 1 0 1
#> SRR2082521 2 0 1 0 1
#> SRR2082520 2 0 1 0 1
#> SRR2082518 2 0 1 0 1
#> SRR2082523 2 0 1 0 1
#> SRR2082524 2 0 1 0 1
#> SRR2082525 2 0 1 0 1
#> SRR2082522 2 0 1 0 1
#> SRR2082519 2 0 1 0 1
#> SRR2082513 2 0 1 0 1
#> SRR2082512 2 0 1 0 1
#> SRR2082516 2 0 1 0 1
#> SRR2082515 2 0 1 0 1
#> SRR2082517 2 0 1 0 1
#> SRR2082514 2 0 1 0 1
#> SRR2082508 1 0 1 1 0
#> SRR2082509 1 0 1 1 0
#> SRR2082507 1 0 1 1 0
#> SRR2082510 1 0 1 1 0
#> SRR2082511 1 0 1 1 0
#> SRR2082501 1 0 1 1 0
#> SRR2082502 1 0 1 1 0
#> SRR2082499 1 0 1 1 0
#> SRR2082500 1 0 1 1 0
#> SRR2082503 1 0 1 1 0
#> SRR2082505 1 0 1 1 0
#> SRR2082506 1 0 1 1 0
#> SRR2082504 1 0 1 1 0
#> SRR2082495 1 0 1 1 0
#> SRR2082496 1 0 1 1 0
#> SRR2082493 1 0 1 1 0
#> SRR2082494 1 0 1 1 0
#> SRR2082491 1 0 1 1 0
#> SRR2082492 1 0 1 1 0
#> SRR2082489 1 0 1 1 0
#> SRR2082490 1 0 1 1 0
#> SRR2082497 1 0 1 1 0
#> SRR2082498 1 0 1 1 0
#> SRR2082487 1 0 1 1 0
#> SRR2082488 1 0 1 1 0
#> SRR2082485 1 0 1 1 0
#> SRR2082486 1 0 1 1 0
#> SRR2082479 1 0 1 1 0
#> SRR2082480 1 0 1 1 0
#> SRR2082483 1 0 1 1 0
#> SRR2082484 1 0 1 1 0
#> SRR2082481 1 0 1 1 0
#> SRR2082482 1 0 1 1 0
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> SRR2082532 2 0 1 0 1 0
#> SRR2082533 2 0 1 0 1 0
#> SRR2082534 2 0 1 0 1 0
#> SRR2082535 2 0 1 0 1 0
#> SRR2082536 2 0 1 0 1 0
#> SRR2082530 2 0 1 0 1 0
#> SRR2082531 2 0 1 0 1 0
#> SRR2082528 2 0 1 0 1 0
#> SRR2082529 2 0 1 0 1 0
#> SRR2082526 2 0 1 0 1 0
#> SRR2082527 2 0 1 0 1 0
#> SRR2082521 2 0 1 0 1 0
#> SRR2082520 2 0 1 0 1 0
#> SRR2082518 2 0 1 0 1 0
#> SRR2082523 2 0 1 0 1 0
#> SRR2082524 2 0 1 0 1 0
#> SRR2082525 2 0 1 0 1 0
#> SRR2082522 2 0 1 0 1 0
#> SRR2082519 2 0 1 0 1 0
#> SRR2082513 2 0 1 0 1 0
#> SRR2082512 2 0 1 0 1 0
#> SRR2082516 2 0 1 0 1 0
#> SRR2082515 2 0 1 0 1 0
#> SRR2082517 2 0 1 0 1 0
#> SRR2082514 2 0 1 0 1 0
#> SRR2082508 1 0 1 1 0 0
#> SRR2082509 1 0 1 1 0 0
#> SRR2082507 1 0 1 1 0 0
#> SRR2082510 3 0 1 0 0 1
#> SRR2082511 1 0 1 1 0 0
#> SRR2082501 1 0 1 1 0 0
#> SRR2082502 1 0 1 1 0 0
#> SRR2082499 1 0 1 1 0 0
#> SRR2082500 1 0 1 1 0 0
#> SRR2082503 1 0 1 1 0 0
#> SRR2082505 1 0 1 1 0 0
#> SRR2082506 1 0 1 1 0 0
#> SRR2082504 1 0 1 1 0 0
#> SRR2082495 1 0 1 1 0 0
#> SRR2082496 1 0 1 1 0 0
#> SRR2082493 1 0 1 1 0 0
#> SRR2082494 1 0 1 1 0 0
#> SRR2082491 1 0 1 1 0 0
#> SRR2082492 1 0 1 1 0 0
#> SRR2082489 1 0 1 1 0 0
#> SRR2082490 1 0 1 1 0 0
#> SRR2082497 1 0 1 1 0 0
#> SRR2082498 1 0 1 1 0 0
#> SRR2082487 1 0 1 1 0 0
#> SRR2082488 1 0 1 1 0 0
#> SRR2082485 1 0 1 1 0 0
#> SRR2082486 1 0 1 1 0 0
#> SRR2082479 1 0 1 1 0 0
#> SRR2082480 1 0 1 1 0 0
#> SRR2082483 3 0 1 0 0 1
#> SRR2082484 3 0 1 0 0 1
#> SRR2082481 1 0 1 1 0 0
#> SRR2082482 1 0 1 1 0 0
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> SRR2082532 2 0.0336 0.952 0 0.992 0 0.008
#> SRR2082533 2 0.0336 0.952 0 0.992 0 0.008
#> SRR2082534 4 0.0000 1.000 0 0.000 0 1.000
#> SRR2082535 4 0.0000 1.000 0 0.000 0 1.000
#> SRR2082536 4 0.0000 1.000 0 0.000 0 1.000
#> SRR2082530 2 0.0336 0.952 0 0.992 0 0.008
#> SRR2082531 2 0.0336 0.952 0 0.992 0 0.008
#> SRR2082528 4 0.0000 1.000 0 0.000 0 1.000
#> SRR2082529 4 0.0000 1.000 0 0.000 0 1.000
#> SRR2082526 2 0.0000 0.950 0 1.000 0 0.000
#> SRR2082527 2 0.0000 0.950 0 1.000 0 0.000
#> SRR2082521 2 0.0336 0.952 0 0.992 0 0.008
#> SRR2082520 2 0.3444 0.821 0 0.816 0 0.184
#> SRR2082518 2 0.0000 0.950 0 1.000 0 0.000
#> SRR2082523 2 0.0336 0.952 0 0.992 0 0.008
#> SRR2082524 2 0.0336 0.952 0 0.992 0 0.008
#> SRR2082525 2 0.0000 0.950 0 1.000 0 0.000
#> SRR2082522 4 0.0000 1.000 0 0.000 0 1.000
#> SRR2082519 2 0.3356 0.829 0 0.824 0 0.176
#> SRR2082513 2 0.0000 0.950 0 1.000 0 0.000
#> SRR2082512 2 0.0000 0.950 0 1.000 0 0.000
#> SRR2082516 4 0.0000 1.000 0 0.000 0 1.000
#> SRR2082515 2 0.3400 0.825 0 0.820 0 0.180
#> SRR2082517 2 0.3356 0.829 0 0.824 0 0.176
#> SRR2082514 2 0.0336 0.952 0 0.992 0 0.008
#> SRR2082508 1 0.0000 1.000 1 0.000 0 0.000
#> SRR2082509 1 0.0000 1.000 1 0.000 0 0.000
#> SRR2082507 1 0.0000 1.000 1 0.000 0 0.000
#> SRR2082510 3 0.0000 1.000 0 0.000 1 0.000
#> SRR2082511 1 0.0000 1.000 1 0.000 0 0.000
#> SRR2082501 1 0.0000 1.000 1 0.000 0 0.000
#> SRR2082502 1 0.0000 1.000 1 0.000 0 0.000
#> SRR2082499 1 0.0000 1.000 1 0.000 0 0.000
#> SRR2082500 1 0.0000 1.000 1 0.000 0 0.000
#> SRR2082503 1 0.0000 1.000 1 0.000 0 0.000
#> SRR2082505 1 0.0000 1.000 1 0.000 0 0.000
#> SRR2082506 1 0.0000 1.000 1 0.000 0 0.000
#> SRR2082504 1 0.0000 1.000 1 0.000 0 0.000
#> SRR2082495 1 0.0000 1.000 1 0.000 0 0.000
#> SRR2082496 1 0.0000 1.000 1 0.000 0 0.000
#> SRR2082493 1 0.0000 1.000 1 0.000 0 0.000
#> SRR2082494 1 0.0000 1.000 1 0.000 0 0.000
#> SRR2082491 1 0.0000 1.000 1 0.000 0 0.000
#> SRR2082492 1 0.0000 1.000 1 0.000 0 0.000
#> SRR2082489 1 0.0000 1.000 1 0.000 0 0.000
#> SRR2082490 1 0.0000 1.000 1 0.000 0 0.000
#> SRR2082497 1 0.0000 1.000 1 0.000 0 0.000
#> SRR2082498 1 0.0000 1.000 1 0.000 0 0.000
#> SRR2082487 1 0.0000 1.000 1 0.000 0 0.000
#> SRR2082488 1 0.0000 1.000 1 0.000 0 0.000
#> SRR2082485 1 0.0000 1.000 1 0.000 0 0.000
#> SRR2082486 1 0.0000 1.000 1 0.000 0 0.000
#> SRR2082479 1 0.0000 1.000 1 0.000 0 0.000
#> SRR2082480 1 0.0000 1.000 1 0.000 0 0.000
#> SRR2082483 3 0.0000 1.000 0 0.000 1 0.000
#> SRR2082484 3 0.0000 1.000 0 0.000 1 0.000
#> SRR2082481 1 0.0000 1.000 1 0.000 0 0.000
#> SRR2082482 1 0.0000 1.000 1 0.000 0 0.000
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> SRR2082532 2 0.0000 0.781 0 1.000 0 0.000 0.000
#> SRR2082533 2 0.0000 0.781 0 1.000 0 0.000 0.000
#> SRR2082534 4 0.0000 1.000 0 0.000 0 1.000 0.000
#> SRR2082535 4 0.0000 1.000 0 0.000 0 1.000 0.000
#> SRR2082536 4 0.0000 1.000 0 0.000 0 1.000 0.000
#> SRR2082530 2 0.0000 0.781 0 1.000 0 0.000 0.000
#> SRR2082531 2 0.0000 0.781 0 1.000 0 0.000 0.000
#> SRR2082528 4 0.0000 1.000 0 0.000 0 1.000 0.000
#> SRR2082529 4 0.0000 1.000 0 0.000 0 1.000 0.000
#> SRR2082526 2 0.1608 0.761 0 0.928 0 0.000 0.072
#> SRR2082527 2 0.1608 0.761 0 0.928 0 0.000 0.072
#> SRR2082521 2 0.0000 0.781 0 1.000 0 0.000 0.000
#> SRR2082520 5 0.4331 0.993 0 0.400 0 0.004 0.596
#> SRR2082518 2 0.1608 0.761 0 0.928 0 0.000 0.072
#> SRR2082523 2 0.0000 0.781 0 1.000 0 0.000 0.000
#> SRR2082524 2 0.0000 0.781 0 1.000 0 0.000 0.000
#> SRR2082525 2 0.1608 0.761 0 0.928 0 0.000 0.072
#> SRR2082522 4 0.0000 1.000 0 0.000 0 1.000 0.000
#> SRR2082519 2 0.4201 -0.508 0 0.592 0 0.000 0.408
#> SRR2082513 2 0.4192 0.371 0 0.596 0 0.000 0.404
#> SRR2082512 2 0.4192 0.371 0 0.596 0 0.000 0.404
#> SRR2082516 4 0.0000 1.000 0 0.000 0 1.000 0.000
#> SRR2082515 5 0.4182 0.993 0 0.400 0 0.000 0.600
#> SRR2082517 2 0.4201 -0.508 0 0.592 0 0.000 0.408
#> SRR2082514 2 0.0609 0.773 0 0.980 0 0.000 0.020
#> SRR2082508 1 0.0000 1.000 1 0.000 0 0.000 0.000
#> SRR2082509 1 0.0000 1.000 1 0.000 0 0.000 0.000
#> SRR2082507 1 0.0000 1.000 1 0.000 0 0.000 0.000
#> SRR2082510 3 0.0000 1.000 0 0.000 1 0.000 0.000
#> SRR2082511 1 0.0000 1.000 1 0.000 0 0.000 0.000
#> SRR2082501 1 0.0000 1.000 1 0.000 0 0.000 0.000
#> SRR2082502 1 0.0000 1.000 1 0.000 0 0.000 0.000
#> SRR2082499 1 0.0000 1.000 1 0.000 0 0.000 0.000
#> SRR2082500 1 0.0000 1.000 1 0.000 0 0.000 0.000
#> SRR2082503 1 0.0000 1.000 1 0.000 0 0.000 0.000
#> SRR2082505 1 0.0000 1.000 1 0.000 0 0.000 0.000
#> SRR2082506 1 0.0000 1.000 1 0.000 0 0.000 0.000
#> SRR2082504 1 0.0000 1.000 1 0.000 0 0.000 0.000
#> SRR2082495 1 0.0000 1.000 1 0.000 0 0.000 0.000
#> SRR2082496 1 0.0000 1.000 1 0.000 0 0.000 0.000
#> SRR2082493 1 0.0000 1.000 1 0.000 0 0.000 0.000
#> SRR2082494 1 0.0000 1.000 1 0.000 0 0.000 0.000
#> SRR2082491 1 0.0000 1.000 1 0.000 0 0.000 0.000
#> SRR2082492 1 0.0000 1.000 1 0.000 0 0.000 0.000
#> SRR2082489 1 0.0000 1.000 1 0.000 0 0.000 0.000
#> SRR2082490 1 0.0000 1.000 1 0.000 0 0.000 0.000
#> SRR2082497 1 0.0000 1.000 1 0.000 0 0.000 0.000
#> SRR2082498 1 0.0000 1.000 1 0.000 0 0.000 0.000
#> SRR2082487 1 0.0000 1.000 1 0.000 0 0.000 0.000
#> SRR2082488 1 0.0000 1.000 1 0.000 0 0.000 0.000
#> SRR2082485 1 0.0000 1.000 1 0.000 0 0.000 0.000
#> SRR2082486 1 0.0000 1.000 1 0.000 0 0.000 0.000
#> SRR2082479 1 0.0000 1.000 1 0.000 0 0.000 0.000
#> SRR2082480 1 0.0000 1.000 1 0.000 0 0.000 0.000
#> SRR2082483 3 0.0000 1.000 0 0.000 1 0.000 0.000
#> SRR2082484 3 0.0000 1.000 0 0.000 1 0.000 0.000
#> SRR2082481 1 0.0000 1.000 1 0.000 0 0.000 0.000
#> SRR2082482 1 0.0000 1.000 1 0.000 0 0.000 0.000
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> SRR2082532 2 0.0547 0.7363 0.000 0.980 0.000 0.000 0.020 0
#> SRR2082533 2 0.0547 0.7363 0.000 0.980 0.000 0.000 0.020 0
#> SRR2082534 4 0.0000 1.0000 0.000 0.000 0.000 1.000 0.000 0
#> SRR2082535 4 0.0000 1.0000 0.000 0.000 0.000 1.000 0.000 0
#> SRR2082536 4 0.0000 1.0000 0.000 0.000 0.000 1.000 0.000 0
#> SRR2082530 2 0.0000 0.7369 0.000 1.000 0.000 0.000 0.000 0
#> SRR2082531 2 0.0000 0.7369 0.000 1.000 0.000 0.000 0.000 0
#> SRR2082528 4 0.0000 1.0000 0.000 0.000 0.000 1.000 0.000 0
#> SRR2082529 4 0.0000 1.0000 0.000 0.000 0.000 1.000 0.000 0
#> SRR2082526 2 0.2378 0.6059 0.000 0.848 0.000 0.000 0.152 0
#> SRR2082527 2 0.2378 0.6059 0.000 0.848 0.000 0.000 0.152 0
#> SRR2082521 2 0.0000 0.7369 0.000 1.000 0.000 0.000 0.000 0
#> SRR2082520 1 0.6079 -0.5105 0.428 0.228 0.000 0.004 0.340 0
#> SRR2082518 2 0.2378 0.6059 0.000 0.848 0.000 0.000 0.152 0
#> SRR2082523 2 0.0547 0.7363 0.000 0.980 0.000 0.000 0.020 0
#> SRR2082524 2 0.0547 0.7363 0.000 0.980 0.000 0.000 0.020 0
#> SRR2082525 2 0.2378 0.6059 0.000 0.848 0.000 0.000 0.152 0
#> SRR2082522 4 0.0000 1.0000 0.000 0.000 0.000 1.000 0.000 0
#> SRR2082519 2 0.5944 -0.0556 0.384 0.400 0.000 0.000 0.216 0
#> SRR2082513 5 0.3647 1.0000 0.000 0.360 0.000 0.000 0.640 0
#> SRR2082512 5 0.3647 1.0000 0.000 0.360 0.000 0.000 0.640 0
#> SRR2082516 4 0.0000 1.0000 0.000 0.000 0.000 1.000 0.000 0
#> SRR2082515 1 0.5957 -0.5109 0.428 0.228 0.000 0.000 0.344 0
#> SRR2082517 2 0.5944 -0.0556 0.384 0.400 0.000 0.000 0.216 0
#> SRR2082514 2 0.0937 0.7178 0.000 0.960 0.000 0.000 0.040 0
#> SRR2082508 3 0.3684 0.0689 0.372 0.000 0.628 0.000 0.000 0
#> SRR2082509 1 0.3810 0.7521 0.572 0.000 0.428 0.000 0.000 0
#> SRR2082507 3 0.3684 0.0689 0.372 0.000 0.628 0.000 0.000 0
#> SRR2082510 6 0.0000 1.0000 0.000 0.000 0.000 0.000 0.000 1
#> SRR2082511 3 0.0000 0.7525 0.000 0.000 1.000 0.000 0.000 0
#> SRR2082501 1 0.3810 0.7521 0.572 0.000 0.428 0.000 0.000 0
#> SRR2082502 1 0.3810 0.7521 0.572 0.000 0.428 0.000 0.000 0
#> SRR2082499 1 0.3810 0.7521 0.572 0.000 0.428 0.000 0.000 0
#> SRR2082500 1 0.3810 0.7521 0.572 0.000 0.428 0.000 0.000 0
#> SRR2082503 3 0.0000 0.7525 0.000 0.000 1.000 0.000 0.000 0
#> SRR2082505 1 0.3810 0.7521 0.572 0.000 0.428 0.000 0.000 0
#> SRR2082506 3 0.3684 0.0689 0.372 0.000 0.628 0.000 0.000 0
#> SRR2082504 1 0.3810 0.7521 0.572 0.000 0.428 0.000 0.000 0
#> SRR2082495 3 0.2260 0.7166 0.140 0.000 0.860 0.000 0.000 0
#> SRR2082496 3 0.2260 0.7166 0.140 0.000 0.860 0.000 0.000 0
#> SRR2082493 3 0.0000 0.7525 0.000 0.000 1.000 0.000 0.000 0
#> SRR2082494 3 0.0000 0.7525 0.000 0.000 1.000 0.000 0.000 0
#> SRR2082491 3 0.2260 0.7166 0.140 0.000 0.860 0.000 0.000 0
#> SRR2082492 3 0.2260 0.7166 0.140 0.000 0.860 0.000 0.000 0
#> SRR2082489 1 0.3810 0.7521 0.572 0.000 0.428 0.000 0.000 0
#> SRR2082490 1 0.3810 0.7521 0.572 0.000 0.428 0.000 0.000 0
#> SRR2082497 1 0.3810 0.7521 0.572 0.000 0.428 0.000 0.000 0
#> SRR2082498 1 0.3810 0.7521 0.572 0.000 0.428 0.000 0.000 0
#> SRR2082487 1 0.3810 0.7521 0.572 0.000 0.428 0.000 0.000 0
#> SRR2082488 1 0.3810 0.7521 0.572 0.000 0.428 0.000 0.000 0
#> SRR2082485 3 0.0000 0.7525 0.000 0.000 1.000 0.000 0.000 0
#> SRR2082486 3 0.0000 0.7525 0.000 0.000 1.000 0.000 0.000 0
#> SRR2082479 1 0.3810 0.7521 0.572 0.000 0.428 0.000 0.000 0
#> SRR2082480 1 0.3810 0.7521 0.572 0.000 0.428 0.000 0.000 0
#> SRR2082483 6 0.0000 1.0000 0.000 0.000 0.000 0.000 0.000 1
#> SRR2082484 6 0.0000 1.0000 0.000 0.000 0.000 0.000 0.000 1
#> SRR2082481 1 0.3810 0.7521 0.572 0.000 0.428 0.000 0.000 0
#> SRR2082482 1 0.3810 0.7521 0.572 0.000 0.428 0.000 0.000 0
Heatmaps for the consensus matrix. It visualizes the probability of two samples to be in a same group.
consensus_heatmap(res, k = 2)
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 14581 rows and 58 columns.
#> Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'ATC' method.
#> Subgroups are detected by 'kmeans' method.
#> Performed in total 1250 partitions by row resampling.
#> Best k for subgroups seems to be 2.
#>
#> Following methods can be applied to this 'ConsensusPartition' object:
#> [1] "cola_report" "collect_classes" "collect_plots"
#> [4] "collect_stats" "colnames" "compare_signatures"
#> [7] "consensus_heatmap" "dimension_reduction" "functional_enrichment"
#> [10] "get_anno_col" "get_anno" "get_classes"
#> [13] "get_consensus" "get_matrix" "get_membership"
#> [16] "get_param" "get_signatures" "get_stats"
#> [19] "is_best_k" "is_stable_k" "membership_heatmap"
#> [22] "ncol" "nrow" "plot_ecdf"
#> [25] "rownames" "select_partition_number" "show"
#> [28] "suggest_best_k" "test_to_known_factors"
collect_plots()
function collects all the plots made from res
for all k
(number of partitions)
into one single page to provide an easy and fast comparison between different k
.
collect_plots(res)
The plots are:
k
and the heatmap of
predicted classes for each k
.k
.k
.k
.All the plots in panels can be made by individual functions and they are plotted later in this section.
select_partition_number()
produces several plots showing different
statistics for choosing “optimized” k
. There are following statistics:
k
;k
, the area increased is defined as \(A_k - A_{k-1}\).The detailed explanations of these statistics can be found in the cola vignette.
Generally speaking, lower PAC score, higher mean silhouette score or higher
concordance corresponds to better partition. Rand index and Jaccard index
measure how similar the current partition is compared to partition with k-1
.
If they are too similar, we won't accept k
is better than k-1
.
select_partition_number(res)
The numeric values for all these statistics can be obtained by get_stats()
.
get_stats(res)
#> k 1-PAC mean_silhouette concordance area_increased Rand Jaccard
#> 2 2 1.000 1.000 1.000 0.4996 0.501 0.501
#> 3 3 0.768 0.769 0.873 0.2195 0.890 0.780
#> 4 4 0.640 0.800 0.776 0.1182 0.854 0.641
#> 5 5 0.575 0.706 0.752 0.0751 0.985 0.949
#> 6 6 0.694 0.745 0.771 0.0722 0.952 0.828
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
#> SRR2082532 2 0 1 0 1
#> SRR2082533 2 0 1 0 1
#> SRR2082534 2 0 1 0 1
#> SRR2082535 2 0 1 0 1
#> SRR2082536 2 0 1 0 1
#> SRR2082530 2 0 1 0 1
#> SRR2082531 2 0 1 0 1
#> SRR2082528 2 0 1 0 1
#> SRR2082529 2 0 1 0 1
#> SRR2082526 2 0 1 0 1
#> SRR2082527 2 0 1 0 1
#> SRR2082521 2 0 1 0 1
#> SRR2082520 2 0 1 0 1
#> SRR2082518 2 0 1 0 1
#> SRR2082523 2 0 1 0 1
#> SRR2082524 2 0 1 0 1
#> SRR2082525 2 0 1 0 1
#> SRR2082522 2 0 1 0 1
#> SRR2082519 2 0 1 0 1
#> SRR2082513 2 0 1 0 1
#> SRR2082512 2 0 1 0 1
#> SRR2082516 2 0 1 0 1
#> SRR2082515 2 0 1 0 1
#> SRR2082517 2 0 1 0 1
#> SRR2082514 2 0 1 0 1
#> SRR2082508 1 0 1 1 0
#> SRR2082509 1 0 1 1 0
#> SRR2082507 1 0 1 1 0
#> SRR2082510 1 0 1 1 0
#> SRR2082511 1 0 1 1 0
#> SRR2082501 1 0 1 1 0
#> SRR2082502 1 0 1 1 0
#> SRR2082499 1 0 1 1 0
#> SRR2082500 1 0 1 1 0
#> SRR2082503 1 0 1 1 0
#> SRR2082505 1 0 1 1 0
#> SRR2082506 1 0 1 1 0
#> SRR2082504 1 0 1 1 0
#> SRR2082495 1 0 1 1 0
#> SRR2082496 1 0 1 1 0
#> SRR2082493 1 0 1 1 0
#> SRR2082494 1 0 1 1 0
#> SRR2082491 1 0 1 1 0
#> SRR2082492 1 0 1 1 0
#> SRR2082489 1 0 1 1 0
#> SRR2082490 1 0 1 1 0
#> SRR2082497 1 0 1 1 0
#> SRR2082498 1 0 1 1 0
#> SRR2082487 1 0 1 1 0
#> SRR2082488 1 0 1 1 0
#> SRR2082485 1 0 1 1 0
#> SRR2082486 1 0 1 1 0
#> SRR2082479 1 0 1 1 0
#> SRR2082480 1 0 1 1 0
#> SRR2082483 1 0 1 1 0
#> SRR2082484 1 0 1 1 0
#> SRR2082481 1 0 1 1 0
#> SRR2082482 1 0 1 1 0
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> SRR2082532 2 0.1289 0.895 0.000 0.968 0.032
#> SRR2082533 2 0.1289 0.895 0.000 0.968 0.032
#> SRR2082534 2 0.5835 0.777 0.000 0.660 0.340
#> SRR2082535 2 0.5835 0.777 0.000 0.660 0.340
#> SRR2082536 2 0.5835 0.777 0.000 0.660 0.340
#> SRR2082530 2 0.0000 0.901 0.000 1.000 0.000
#> SRR2082531 2 0.0000 0.901 0.000 1.000 0.000
#> SRR2082528 2 0.5835 0.777 0.000 0.660 0.340
#> SRR2082529 2 0.5835 0.777 0.000 0.660 0.340
#> SRR2082526 2 0.0000 0.901 0.000 1.000 0.000
#> SRR2082527 2 0.0000 0.901 0.000 1.000 0.000
#> SRR2082521 2 0.0237 0.901 0.000 0.996 0.004
#> SRR2082520 2 0.5363 0.810 0.000 0.724 0.276
#> SRR2082518 2 0.0592 0.900 0.000 0.988 0.012
#> SRR2082523 2 0.0000 0.901 0.000 1.000 0.000
#> SRR2082524 2 0.0000 0.901 0.000 1.000 0.000
#> SRR2082525 2 0.0000 0.901 0.000 1.000 0.000
#> SRR2082522 2 0.5835 0.777 0.000 0.660 0.340
#> SRR2082519 2 0.0592 0.900 0.000 0.988 0.012
#> SRR2082513 2 0.0592 0.900 0.000 0.988 0.012
#> SRR2082512 2 0.0592 0.900 0.000 0.988 0.012
#> SRR2082516 2 0.5835 0.777 0.000 0.660 0.340
#> SRR2082515 2 0.0592 0.900 0.000 0.988 0.012
#> SRR2082517 2 0.0592 0.900 0.000 0.988 0.012
#> SRR2082514 2 0.0592 0.900 0.000 0.988 0.012
#> SRR2082508 1 0.0000 0.877 1.000 0.000 0.000
#> SRR2082509 1 0.0000 0.877 1.000 0.000 0.000
#> SRR2082507 1 0.0000 0.877 1.000 0.000 0.000
#> SRR2082510 3 0.5905 0.871 0.352 0.000 0.648
#> SRR2082511 3 0.6225 0.883 0.432 0.000 0.568
#> SRR2082501 1 0.0000 0.877 1.000 0.000 0.000
#> SRR2082502 1 0.0000 0.877 1.000 0.000 0.000
#> SRR2082499 1 0.0000 0.877 1.000 0.000 0.000
#> SRR2082500 1 0.0000 0.877 1.000 0.000 0.000
#> SRR2082503 3 0.6302 0.823 0.480 0.000 0.520
#> SRR2082505 1 0.0000 0.877 1.000 0.000 0.000
#> SRR2082506 1 0.0000 0.877 1.000 0.000 0.000
#> SRR2082504 1 0.0000 0.877 1.000 0.000 0.000
#> SRR2082495 1 0.6215 -0.591 0.572 0.000 0.428
#> SRR2082496 1 0.6215 -0.591 0.572 0.000 0.428
#> SRR2082493 3 0.6274 0.870 0.456 0.000 0.544
#> SRR2082494 3 0.6274 0.870 0.456 0.000 0.544
#> SRR2082491 1 0.0000 0.877 1.000 0.000 0.000
#> SRR2082492 1 0.0000 0.877 1.000 0.000 0.000
#> SRR2082489 1 0.0000 0.877 1.000 0.000 0.000
#> SRR2082490 1 0.0000 0.877 1.000 0.000 0.000
#> SRR2082497 1 0.0000 0.877 1.000 0.000 0.000
#> SRR2082498 1 0.0000 0.877 1.000 0.000 0.000
#> SRR2082487 1 0.0000 0.877 1.000 0.000 0.000
#> SRR2082488 1 0.0000 0.877 1.000 0.000 0.000
#> SRR2082485 1 0.6192 -0.566 0.580 0.000 0.420
#> SRR2082486 1 0.6192 -0.566 0.580 0.000 0.420
#> SRR2082479 1 0.0000 0.877 1.000 0.000 0.000
#> SRR2082480 1 0.0000 0.877 1.000 0.000 0.000
#> SRR2082483 3 0.5905 0.871 0.352 0.000 0.648
#> SRR2082484 3 0.5905 0.871 0.352 0.000 0.648
#> SRR2082481 1 0.0000 0.877 1.000 0.000 0.000
#> SRR2082482 1 0.0000 0.877 1.000 0.000 0.000
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> SRR2082532 2 0.1256 0.816 0.000 0.964 0.008 0.028
#> SRR2082533 2 0.1256 0.816 0.000 0.964 0.008 0.028
#> SRR2082534 4 0.5155 0.993 0.000 0.468 0.004 0.528
#> SRR2082535 4 0.5155 0.993 0.000 0.468 0.004 0.528
#> SRR2082536 4 0.5155 0.994 0.000 0.468 0.004 0.528
#> SRR2082530 2 0.0469 0.838 0.000 0.988 0.012 0.000
#> SRR2082531 2 0.0469 0.838 0.000 0.988 0.012 0.000
#> SRR2082528 4 0.5155 0.994 0.000 0.468 0.004 0.528
#> SRR2082529 4 0.5155 0.994 0.000 0.468 0.004 0.528
#> SRR2082526 2 0.1637 0.836 0.000 0.940 0.060 0.000
#> SRR2082527 2 0.1637 0.836 0.000 0.940 0.060 0.000
#> SRR2082521 2 0.1978 0.842 0.000 0.928 0.068 0.004
#> SRR2082520 2 0.6079 -0.633 0.000 0.544 0.048 0.408
#> SRR2082518 2 0.3497 0.828 0.000 0.852 0.124 0.024
#> SRR2082523 2 0.0000 0.839 0.000 1.000 0.000 0.000
#> SRR2082524 2 0.0000 0.839 0.000 1.000 0.000 0.000
#> SRR2082525 2 0.1637 0.836 0.000 0.940 0.060 0.000
#> SRR2082522 4 0.5155 0.993 0.000 0.468 0.004 0.528
#> SRR2082519 2 0.3606 0.816 0.000 0.844 0.132 0.024
#> SRR2082513 2 0.3080 0.836 0.000 0.880 0.096 0.024
#> SRR2082512 2 0.3606 0.823 0.000 0.844 0.132 0.024
#> SRR2082516 4 0.5155 0.993 0.000 0.468 0.004 0.528
#> SRR2082515 2 0.3606 0.816 0.000 0.844 0.132 0.024
#> SRR2082517 2 0.3606 0.816 0.000 0.844 0.132 0.024
#> SRR2082514 2 0.3143 0.818 0.000 0.876 0.100 0.024
#> SRR2082508 1 0.2530 0.814 0.888 0.000 0.000 0.112
#> SRR2082509 1 0.1637 0.870 0.940 0.000 0.000 0.060
#> SRR2082507 1 0.3877 0.771 0.840 0.000 0.048 0.112
#> SRR2082510 3 0.6957 0.665 0.172 0.000 0.580 0.248
#> SRR2082511 3 0.4737 0.794 0.252 0.000 0.728 0.020
#> SRR2082501 1 0.0657 0.862 0.984 0.000 0.012 0.004
#> SRR2082502 1 0.0657 0.862 0.984 0.000 0.012 0.004
#> SRR2082499 1 0.3306 0.706 0.840 0.000 0.156 0.004
#> SRR2082500 1 0.3306 0.706 0.840 0.000 0.156 0.004
#> SRR2082503 3 0.5182 0.795 0.288 0.000 0.684 0.028
#> SRR2082505 1 0.2081 0.839 0.916 0.000 0.000 0.084
#> SRR2082506 1 0.2530 0.814 0.888 0.000 0.000 0.112
#> SRR2082504 1 0.2760 0.842 0.872 0.000 0.000 0.128
#> SRR2082495 3 0.4730 0.762 0.364 0.000 0.636 0.000
#> SRR2082496 3 0.4730 0.762 0.364 0.000 0.636 0.000
#> SRR2082493 3 0.4770 0.804 0.288 0.000 0.700 0.012
#> SRR2082494 3 0.4770 0.804 0.288 0.000 0.700 0.012
#> SRR2082491 1 0.4776 0.503 0.732 0.000 0.244 0.024
#> SRR2082492 1 0.4776 0.503 0.732 0.000 0.244 0.024
#> SRR2082489 1 0.2149 0.865 0.912 0.000 0.000 0.088
#> SRR2082490 1 0.2149 0.865 0.912 0.000 0.000 0.088
#> SRR2082497 1 0.0592 0.863 0.984 0.000 0.000 0.016
#> SRR2082498 1 0.0592 0.863 0.984 0.000 0.000 0.016
#> SRR2082487 1 0.2329 0.867 0.916 0.000 0.012 0.072
#> SRR2082488 1 0.2329 0.867 0.916 0.000 0.012 0.072
#> SRR2082485 3 0.4746 0.756 0.368 0.000 0.632 0.000
#> SRR2082486 3 0.4746 0.756 0.368 0.000 0.632 0.000
#> SRR2082479 1 0.1792 0.868 0.932 0.000 0.000 0.068
#> SRR2082480 1 0.1792 0.868 0.932 0.000 0.000 0.068
#> SRR2082483 3 0.6933 0.665 0.172 0.000 0.584 0.244
#> SRR2082484 3 0.6933 0.665 0.172 0.000 0.584 0.244
#> SRR2082481 1 0.2081 0.865 0.916 0.000 0.000 0.084
#> SRR2082482 1 0.2081 0.865 0.916 0.000 0.000 0.084
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> SRR2082532 2 0.2157 0.7576 0.000 0.920 0.004 0.040 NA
#> SRR2082533 2 0.2157 0.7576 0.000 0.920 0.004 0.040 NA
#> SRR2082534 4 0.3932 0.9322 0.000 0.328 0.000 0.672 NA
#> SRR2082535 4 0.3932 0.9322 0.000 0.328 0.000 0.672 NA
#> SRR2082536 4 0.4774 0.9299 0.000 0.328 0.012 0.644 NA
#> SRR2082530 2 0.0579 0.7983 0.000 0.984 0.008 0.000 NA
#> SRR2082531 2 0.0579 0.7983 0.000 0.984 0.008 0.000 NA
#> SRR2082528 4 0.4774 0.9299 0.000 0.328 0.012 0.644 NA
#> SRR2082529 4 0.4774 0.9299 0.000 0.328 0.012 0.644 NA
#> SRR2082526 2 0.3354 0.7685 0.000 0.844 0.068 0.000 NA
#> SRR2082527 2 0.3354 0.7685 0.000 0.844 0.068 0.000 NA
#> SRR2082521 2 0.2953 0.7950 0.000 0.844 0.012 0.000 NA
#> SRR2082520 4 0.6815 0.5327 0.000 0.388 0.012 0.416 NA
#> SRR2082518 2 0.4964 0.7524 0.000 0.700 0.096 0.000 NA
#> SRR2082523 2 0.0162 0.7977 0.000 0.996 0.004 0.000 NA
#> SRR2082524 2 0.0162 0.7977 0.000 0.996 0.004 0.000 NA
#> SRR2082525 2 0.3354 0.7685 0.000 0.844 0.068 0.000 NA
#> SRR2082522 4 0.4574 0.9271 0.000 0.328 0.012 0.652 NA
#> SRR2082519 2 0.3661 0.7613 0.000 0.724 0.000 0.000 NA
#> SRR2082513 2 0.3847 0.7880 0.000 0.784 0.036 0.000 NA
#> SRR2082512 2 0.5053 0.7482 0.000 0.688 0.096 0.000 NA
#> SRR2082516 4 0.4574 0.9271 0.000 0.328 0.012 0.652 NA
#> SRR2082515 2 0.3684 0.7597 0.000 0.720 0.000 0.000 NA
#> SRR2082517 2 0.3661 0.7613 0.000 0.724 0.000 0.000 NA
#> SRR2082514 2 0.3563 0.7755 0.000 0.780 0.012 0.000 NA
#> SRR2082508 1 0.3741 0.6183 0.732 0.000 0.000 0.004 NA
#> SRR2082509 1 0.2377 0.7453 0.872 0.000 0.000 0.000 NA
#> SRR2082507 1 0.4705 0.5776 0.692 0.000 0.040 0.004 NA
#> SRR2082510 3 0.8105 0.5109 0.132 0.000 0.388 0.300 NA
#> SRR2082511 3 0.4237 0.7326 0.168 0.000 0.780 0.020 NA
#> SRR2082501 1 0.2513 0.7180 0.904 0.000 0.048 0.008 NA
#> SRR2082502 1 0.2513 0.7180 0.904 0.000 0.048 0.008 NA
#> SRR2082499 1 0.4548 0.4575 0.708 0.000 0.256 0.008 NA
#> SRR2082500 1 0.4548 0.4575 0.708 0.000 0.256 0.008 NA
#> SRR2082503 3 0.4393 0.7306 0.192 0.000 0.752 0.004 NA
#> SRR2082505 1 0.2930 0.6883 0.832 0.000 0.000 0.004 NA
#> SRR2082506 1 0.3741 0.6183 0.732 0.000 0.000 0.004 NA
#> SRR2082504 1 0.3455 0.7009 0.784 0.000 0.000 0.008 NA
#> SRR2082495 3 0.3766 0.7011 0.268 0.000 0.728 0.000 NA
#> SRR2082496 3 0.3766 0.7011 0.268 0.000 0.728 0.000 NA
#> SRR2082493 3 0.4208 0.7432 0.204 0.000 0.760 0.020 NA
#> SRR2082494 3 0.4208 0.7432 0.204 0.000 0.760 0.020 NA
#> SRR2082491 1 0.5109 -0.0814 0.504 0.000 0.460 0.000 NA
#> SRR2082492 1 0.5109 -0.0814 0.504 0.000 0.460 0.000 NA
#> SRR2082489 1 0.3111 0.7394 0.840 0.000 0.004 0.012 NA
#> SRR2082490 1 0.3111 0.7394 0.840 0.000 0.004 0.012 NA
#> SRR2082497 1 0.1956 0.7290 0.916 0.000 0.000 0.008 NA
#> SRR2082498 1 0.1956 0.7290 0.916 0.000 0.000 0.008 NA
#> SRR2082487 1 0.3855 0.7272 0.800 0.000 0.032 0.008 NA
#> SRR2082488 1 0.3855 0.7272 0.800 0.000 0.032 0.008 NA
#> SRR2082485 3 0.4090 0.7037 0.268 0.000 0.716 0.000 NA
#> SRR2082486 3 0.4090 0.7037 0.268 0.000 0.716 0.000 NA
#> SRR2082479 1 0.2911 0.7405 0.852 0.000 0.004 0.008 NA
#> SRR2082480 1 0.2911 0.7405 0.852 0.000 0.004 0.008 NA
#> SRR2082483 3 0.8105 0.5109 0.132 0.000 0.388 0.300 NA
#> SRR2082484 3 0.8105 0.5109 0.132 0.000 0.388 0.300 NA
#> SRR2082481 1 0.3154 0.7395 0.836 0.000 0.004 0.012 NA
#> SRR2082482 1 0.3154 0.7395 0.836 0.000 0.004 0.012 NA
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> SRR2082532 2 0.2504 0.728 0.000 0.892 0.004 0.064 NA 0.008
#> SRR2082533 2 0.2504 0.728 0.000 0.892 0.004 0.064 NA 0.008
#> SRR2082534 4 0.2933 0.922 0.000 0.200 0.000 0.796 NA 0.000
#> SRR2082535 4 0.2933 0.922 0.000 0.200 0.000 0.796 NA 0.000
#> SRR2082536 4 0.3909 0.919 0.000 0.200 0.008 0.760 NA 0.020
#> SRR2082530 2 0.0665 0.771 0.000 0.980 0.000 0.004 NA 0.008
#> SRR2082531 2 0.0665 0.771 0.000 0.980 0.000 0.004 NA 0.008
#> SRR2082528 4 0.3909 0.919 0.000 0.200 0.008 0.760 NA 0.020
#> SRR2082529 4 0.3909 0.919 0.000 0.200 0.008 0.760 NA 0.020
#> SRR2082526 2 0.3296 0.752 0.000 0.844 0.012 0.004 NA 0.068
#> SRR2082527 2 0.3296 0.752 0.000 0.844 0.012 0.004 NA 0.068
#> SRR2082521 2 0.3628 0.761 0.000 0.776 0.004 0.000 NA 0.036
#> SRR2082520 4 0.6702 0.498 0.000 0.268 0.004 0.456 NA 0.040
#> SRR2082518 2 0.5234 0.733 0.000 0.656 0.024 0.000 NA 0.112
#> SRR2082523 2 0.0551 0.771 0.000 0.984 0.004 0.004 NA 0.000
#> SRR2082524 2 0.0551 0.771 0.000 0.984 0.004 0.004 NA 0.000
#> SRR2082525 2 0.3296 0.752 0.000 0.844 0.012 0.004 NA 0.068
#> SRR2082522 4 0.3800 0.914 0.000 0.200 0.012 0.764 NA 0.020
#> SRR2082519 2 0.4384 0.706 0.000 0.616 0.000 0.000 NA 0.036
#> SRR2082513 2 0.4497 0.745 0.000 0.712 0.016 0.000 NA 0.060
#> SRR2082512 2 0.5497 0.716 0.000 0.616 0.024 0.000 NA 0.120
#> SRR2082516 4 0.3800 0.914 0.000 0.200 0.012 0.764 NA 0.020
#> SRR2082515 2 0.4396 0.703 0.000 0.612 0.000 0.000 NA 0.036
#> SRR2082517 2 0.4384 0.706 0.000 0.616 0.000 0.000 NA 0.036
#> SRR2082514 2 0.4507 0.716 0.000 0.660 0.004 0.000 NA 0.052
#> SRR2082508 1 0.5953 0.587 0.468 0.000 0.000 0.120 NA 0.024
#> SRR2082509 1 0.0713 0.726 0.972 0.000 0.000 0.000 NA 0.000
#> SRR2082507 1 0.7112 0.505 0.392 0.000 0.076 0.120 NA 0.024
#> SRR2082510 6 0.3897 0.981 0.020 0.000 0.180 0.004 NA 0.772
#> SRR2082511 3 0.3453 0.818 0.052 0.000 0.852 0.040 NA 0.032
#> SRR2082501 1 0.4511 0.681 0.620 0.000 0.048 0.000 NA 0.000
#> SRR2082502 1 0.4511 0.681 0.620 0.000 0.048 0.000 NA 0.000
#> SRR2082499 1 0.6108 0.183 0.364 0.000 0.344 0.000 NA 0.000
#> SRR2082500 1 0.6108 0.183 0.364 0.000 0.344 0.000 NA 0.000
#> SRR2082503 3 0.3067 0.854 0.068 0.000 0.864 0.040 NA 0.004
#> SRR2082505 1 0.5026 0.659 0.568 0.000 0.000 0.072 NA 0.004
#> SRR2082506 1 0.5953 0.587 0.468 0.000 0.000 0.120 NA 0.024
#> SRR2082504 1 0.4638 0.675 0.636 0.000 0.000 0.068 NA 0.000
#> SRR2082495 3 0.1663 0.866 0.088 0.000 0.912 0.000 NA 0.000
#> SRR2082496 3 0.1663 0.866 0.088 0.000 0.912 0.000 NA 0.000
#> SRR2082493 3 0.2627 0.832 0.052 0.000 0.892 0.016 NA 0.032
#> SRR2082494 3 0.2627 0.832 0.052 0.000 0.892 0.016 NA 0.032
#> SRR2082491 3 0.4511 0.693 0.192 0.000 0.716 0.004 NA 0.004
#> SRR2082492 3 0.4511 0.693 0.192 0.000 0.716 0.004 NA 0.004
#> SRR2082489 1 0.1059 0.713 0.964 0.000 0.000 0.016 NA 0.004
#> SRR2082490 1 0.1059 0.713 0.964 0.000 0.000 0.016 NA 0.004
#> SRR2082497 1 0.3727 0.687 0.612 0.000 0.000 0.000 NA 0.000
#> SRR2082498 1 0.3727 0.687 0.612 0.000 0.000 0.000 NA 0.000
#> SRR2082487 1 0.1710 0.710 0.936 0.000 0.028 0.016 NA 0.000
#> SRR2082488 1 0.1710 0.710 0.936 0.000 0.028 0.016 NA 0.000
#> SRR2082485 3 0.2637 0.864 0.088 0.000 0.876 0.024 NA 0.000
#> SRR2082486 3 0.2637 0.864 0.088 0.000 0.876 0.024 NA 0.000
#> SRR2082479 1 0.0622 0.721 0.980 0.000 0.000 0.012 NA 0.000
#> SRR2082480 1 0.0622 0.721 0.980 0.000 0.000 0.012 NA 0.000
#> SRR2082483 6 0.3156 0.991 0.020 0.000 0.180 0.000 NA 0.800
#> SRR2082484 6 0.3156 0.991 0.020 0.000 0.180 0.000 NA 0.800
#> SRR2082481 1 0.1237 0.714 0.956 0.000 0.000 0.020 NA 0.004
#> SRR2082482 1 0.1237 0.714 0.956 0.000 0.000 0.020 NA 0.004
Heatmaps for the consensus matrix. It visualizes the probability of two samples to be in a same group.
consensus_heatmap(res, k = 2)
consensus_heatmap(res, k = 3)
consensus_heatmap(res, k = 4)
consensus_heatmap(res, k = 5)
consensus_heatmap(res, k = 6)
Heatmaps for the membership of samples in all partitions to see how consistent they are:
membership_heatmap(res, k = 2)
membership_heatmap(res, k = 3)
membership_heatmap(res, k = 4)
membership_heatmap(res, k = 5)
membership_heatmap(res, k = 6)
As soon as we have had the classes for columns, we can look for signatures which are significantly different between classes which can be candidate marks for certain classes. Following are the heatmaps for signatures.
Signature heatmaps where rows are scaled:
get_signatures(res, k = 2)
get_signatures(res, k = 3)
get_signatures(res, k = 4)
get_signatures(res, k = 5)
get_signatures(res, k = 6)
Signature heatmaps where rows are not scaled:
get_signatures(res, k = 2, scale_rows = FALSE)
get_signatures(res, k = 3, scale_rows = FALSE)
get_signatures(res, k = 4, scale_rows = FALSE)
get_signatures(res, k = 5, scale_rows = FALSE)
get_signatures(res, k = 6, scale_rows = FALSE)
Compare the overlap of signatures from different k:
compare_signatures(res)
get_signature()
returns a data frame invisibly. TO get the list of signatures, the function
call should be assigned to a variable explicitly. In following code, if plot
argument is set
to FALSE
, no heatmap is plotted while only the differential analysis is performed.
# code only for demonstration
tb = get_signature(res, k = ..., plot = FALSE)
An example of the output of tb
is:
#> which_row fdr mean_1 mean_2 scaled_mean_1 scaled_mean_2 km
#> 1 38 0.042760348 8.373488 9.131774 -0.5533452 0.5164555 1
#> 2 40 0.018707592 7.106213 8.469186 -0.6173731 0.5762149 1
#> 3 55 0.019134737 10.221463 11.207825 -0.6159697 0.5749050 1
#> 4 59 0.006059896 5.921854 7.869574 -0.6899429 0.6439467 1
#> 5 60 0.018055526 8.928898 10.211722 -0.6204761 0.5791110 1
#> 6 98 0.009384629 15.714769 14.887706 0.6635654 -0.6193277 2
...
The columns in tb
are:
which_row
: row indices corresponding to the input matrix.fdr
: FDR for the differential test. mean_x
: The mean value in group x.scaled_mean_x
: The mean value in group x after rows are scaled.km
: Row groups if k-means clustering is applied to rows.UMAP plot which shows how samples are separated.
dimension_reduction(res, k = 2, method = "UMAP")
dimension_reduction(res, k = 3, method = "UMAP")
dimension_reduction(res, k = 4, method = "UMAP")
dimension_reduction(res, k = 5, method = "UMAP")
dimension_reduction(res, k = 6, method = "UMAP")
Following heatmap shows how subgroups are split when increasing k
:
collect_classes(res)
If matrix rows can be associated to genes, consider to use functional_enrichment(res,
...)
to perform function enrichment for the signature genes. See this vignette for more detailed explanations.
The object with results only for a single top-value method and a single partition method can be extracted as:
res = res_list["ATC", "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 14581 rows and 58 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 3.
#>
#> Following methods can be applied to this 'ConsensusPartition' object:
#> [1] "cola_report" "collect_classes" "collect_plots"
#> [4] "collect_stats" "colnames" "compare_signatures"
#> [7] "consensus_heatmap" "dimension_reduction" "functional_enrichment"
#> [10] "get_anno_col" "get_anno" "get_classes"
#> [13] "get_consensus" "get_matrix" "get_membership"
#> [16] "get_param" "get_signatures" "get_stats"
#> [19] "is_best_k" "is_stable_k" "membership_heatmap"
#> [22] "ncol" "nrow" "plot_ecdf"
#> [25] "rownames" "select_partition_number" "show"
#> [28] "suggest_best_k" "test_to_known_factors"
collect_plots()
function collects all the plots made from res
for all k
(number of partitions)
into one single page to provide an easy and fast comparison between different k
.
collect_plots(res)
The plots are:
k
and the heatmap of
predicted classes for each k
.k
.k
.k
.All the plots in panels can be made by individual functions and they are plotted later in this section.
select_partition_number()
produces several plots showing different
statistics for choosing “optimized” k
. There are following statistics:
k
;k
, the area increased is defined as \(A_k - A_{k-1}\).The detailed explanations of these statistics can be found in the cola vignette.
Generally speaking, lower PAC score, higher mean silhouette score or higher
concordance corresponds to better partition. Rand index and Jaccard index
measure how similar the current partition is compared to partition with k-1
.
If they are too similar, we won't accept k
is better than k-1
.
select_partition_number(res)
The numeric values for all these statistics can be obtained by get_stats()
.
get_stats(res)
#> k 1-PAC mean_silhouette concordance area_increased Rand Jaccard
#> 2 2 1.000 1.000 1.000 0.4996 0.501 0.501
#> 3 3 1.000 0.945 0.977 0.1464 0.946 0.891
#> 4 4 0.735 0.647 0.837 0.1449 0.924 0.831
#> 5 5 0.660 0.564 0.736 0.1090 0.815 0.529
#> 6 6 0.640 0.598 0.774 0.0521 0.904 0.647
suggest_best_k()
suggests the best \(k\) based on these statistics. The rules are as follows:
suggest_best_k(res)
#> [1] 3
#> attr(,"optional")
#> [1] 2
There is also optional best \(k\) = 2 that is worth to check.
Following shows the table of the partitions (You need to click the show/hide
code output link to see it). The membership matrix (columns with name p*
)
is inferred by
clue::cl_consensus()
function with the SE
method. Basically the value in the membership matrix
represents the probability to belong to a certain group. The finall class
label for an item is determined with the group with highest probability it
belongs to.
In get_classes()
function, the entropy is calculated from the membership
matrix and the silhouette score is calculated from the consensus matrix.
cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#> class entropy silhouette p1 p2
#> SRR2082532 2 0 1 0 1
#> SRR2082533 2 0 1 0 1
#> SRR2082534 2 0 1 0 1
#> SRR2082535 2 0 1 0 1
#> SRR2082536 2 0 1 0 1
#> SRR2082530 2 0 1 0 1
#> SRR2082531 2 0 1 0 1
#> SRR2082528 2 0 1 0 1
#> SRR2082529 2 0 1 0 1
#> SRR2082526 2 0 1 0 1
#> SRR2082527 2 0 1 0 1
#> SRR2082521 2 0 1 0 1
#> SRR2082520 2 0 1 0 1
#> SRR2082518 2 0 1 0 1
#> SRR2082523 2 0 1 0 1
#> SRR2082524 2 0 1 0 1
#> SRR2082525 2 0 1 0 1
#> SRR2082522 2 0 1 0 1
#> SRR2082519 2 0 1 0 1
#> SRR2082513 2 0 1 0 1
#> SRR2082512 2 0 1 0 1
#> SRR2082516 2 0 1 0 1
#> SRR2082515 2 0 1 0 1
#> SRR2082517 2 0 1 0 1
#> SRR2082514 2 0 1 0 1
#> SRR2082508 1 0 1 1 0
#> SRR2082509 1 0 1 1 0
#> SRR2082507 1 0 1 1 0
#> SRR2082510 1 0 1 1 0
#> SRR2082511 1 0 1 1 0
#> SRR2082501 1 0 1 1 0
#> SRR2082502 1 0 1 1 0
#> SRR2082499 1 0 1 1 0
#> SRR2082500 1 0 1 1 0
#> SRR2082503 1 0 1 1 0
#> SRR2082505 1 0 1 1 0
#> SRR2082506 1 0 1 1 0
#> SRR2082504 1 0 1 1 0
#> SRR2082495 1 0 1 1 0
#> SRR2082496 1 0 1 1 0
#> SRR2082493 1 0 1 1 0
#> SRR2082494 1 0 1 1 0
#> SRR2082491 1 0 1 1 0
#> SRR2082492 1 0 1 1 0
#> SRR2082489 1 0 1 1 0
#> SRR2082490 1 0 1 1 0
#> SRR2082497 1 0 1 1 0
#> SRR2082498 1 0 1 1 0
#> SRR2082487 1 0 1 1 0
#> SRR2082488 1 0 1 1 0
#> SRR2082485 1 0 1 1 0
#> SRR2082486 1 0 1 1 0
#> SRR2082479 1 0 1 1 0
#> SRR2082480 1 0 1 1 0
#> SRR2082483 1 0 1 1 0
#> SRR2082484 1 0 1 1 0
#> SRR2082481 1 0 1 1 0
#> SRR2082482 1 0 1 1 0
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> SRR2082532 2 0.000 1.000 0.00 1 0.00
#> SRR2082533 2 0.000 1.000 0.00 1 0.00
#> SRR2082534 2 0.000 1.000 0.00 1 0.00
#> SRR2082535 2 0.000 1.000 0.00 1 0.00
#> SRR2082536 2 0.000 1.000 0.00 1 0.00
#> SRR2082530 2 0.000 1.000 0.00 1 0.00
#> SRR2082531 2 0.000 1.000 0.00 1 0.00
#> SRR2082528 2 0.000 1.000 0.00 1 0.00
#> SRR2082529 2 0.000 1.000 0.00 1 0.00
#> SRR2082526 2 0.000 1.000 0.00 1 0.00
#> SRR2082527 2 0.000 1.000 0.00 1 0.00
#> SRR2082521 2 0.000 1.000 0.00 1 0.00
#> SRR2082520 2 0.000 1.000 0.00 1 0.00
#> SRR2082518 2 0.000 1.000 0.00 1 0.00
#> SRR2082523 2 0.000 1.000 0.00 1 0.00
#> SRR2082524 2 0.000 1.000 0.00 1 0.00
#> SRR2082525 2 0.000 1.000 0.00 1 0.00
#> SRR2082522 2 0.000 1.000 0.00 1 0.00
#> SRR2082519 2 0.000 1.000 0.00 1 0.00
#> SRR2082513 2 0.000 1.000 0.00 1 0.00
#> SRR2082512 2 0.000 1.000 0.00 1 0.00
#> SRR2082516 2 0.000 1.000 0.00 1 0.00
#> SRR2082515 2 0.000 1.000 0.00 1 0.00
#> SRR2082517 2 0.000 1.000 0.00 1 0.00
#> SRR2082514 2 0.000 1.000 0.00 1 0.00
#> SRR2082508 1 0.000 0.953 1.00 0 0.00
#> SRR2082509 1 0.000 0.953 1.00 0 0.00
#> SRR2082507 1 0.000 0.953 1.00 0 0.00
#> SRR2082510 3 0.000 1.000 0.00 0 1.00
#> SRR2082511 1 0.613 0.395 0.60 0 0.40
#> SRR2082501 1 0.000 0.953 1.00 0 0.00
#> SRR2082502 1 0.000 0.953 1.00 0 0.00
#> SRR2082499 1 0.000 0.953 1.00 0 0.00
#> SRR2082500 1 0.000 0.953 1.00 0 0.00
#> SRR2082503 1 0.000 0.953 1.00 0 0.00
#> SRR2082505 1 0.000 0.953 1.00 0 0.00
#> SRR2082506 1 0.000 0.953 1.00 0 0.00
#> SRR2082504 1 0.000 0.953 1.00 0 0.00
#> SRR2082495 1 0.000 0.953 1.00 0 0.00
#> SRR2082496 1 0.000 0.953 1.00 0 0.00
#> SRR2082493 1 0.613 0.395 0.60 0 0.40
#> SRR2082494 1 0.613 0.395 0.60 0 0.40
#> SRR2082491 1 0.000 0.953 1.00 0 0.00
#> SRR2082492 1 0.000 0.953 1.00 0 0.00
#> SRR2082489 1 0.000 0.953 1.00 0 0.00
#> SRR2082490 1 0.000 0.953 1.00 0 0.00
#> SRR2082497 1 0.000 0.953 1.00 0 0.00
#> SRR2082498 1 0.000 0.953 1.00 0 0.00
#> SRR2082487 1 0.000 0.953 1.00 0 0.00
#> SRR2082488 1 0.000 0.953 1.00 0 0.00
#> SRR2082485 1 0.207 0.903 0.94 0 0.06
#> SRR2082486 1 0.207 0.903 0.94 0 0.06
#> SRR2082479 1 0.000 0.953 1.00 0 0.00
#> SRR2082480 1 0.000 0.953 1.00 0 0.00
#> SRR2082483 3 0.000 1.000 0.00 0 1.00
#> SRR2082484 3 0.000 1.000 0.00 0 1.00
#> SRR2082481 1 0.000 0.953 1.00 0 0.00
#> SRR2082482 1 0.000 0.953 1.00 0 0.00
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> SRR2082532 2 0.1022 0.8734 0.000 0.968 0.000 0.032
#> SRR2082533 2 0.1022 0.8734 0.000 0.968 0.000 0.032
#> SRR2082534 2 0.0336 0.8723 0.000 0.992 0.000 0.008
#> SRR2082535 2 0.0336 0.8723 0.000 0.992 0.000 0.008
#> SRR2082536 2 0.0336 0.8723 0.000 0.992 0.000 0.008
#> SRR2082530 2 0.3610 0.8253 0.000 0.800 0.000 0.200
#> SRR2082531 2 0.3610 0.8253 0.000 0.800 0.000 0.200
#> SRR2082528 2 0.0336 0.8723 0.000 0.992 0.000 0.008
#> SRR2082529 2 0.0336 0.8723 0.000 0.992 0.000 0.008
#> SRR2082526 2 0.4776 0.6957 0.000 0.624 0.000 0.376
#> SRR2082527 2 0.4776 0.6957 0.000 0.624 0.000 0.376
#> SRR2082521 2 0.2589 0.8671 0.000 0.884 0.000 0.116
#> SRR2082520 2 0.1389 0.8684 0.000 0.952 0.000 0.048
#> SRR2082518 2 0.4898 0.6927 0.000 0.584 0.000 0.416
#> SRR2082523 2 0.3074 0.8459 0.000 0.848 0.000 0.152
#> SRR2082524 2 0.3074 0.8459 0.000 0.848 0.000 0.152
#> SRR2082525 2 0.4776 0.6957 0.000 0.624 0.000 0.376
#> SRR2082522 2 0.1389 0.8684 0.000 0.952 0.000 0.048
#> SRR2082519 2 0.1389 0.8719 0.000 0.952 0.000 0.048
#> SRR2082513 2 0.3311 0.8526 0.000 0.828 0.000 0.172
#> SRR2082512 2 0.4898 0.6927 0.000 0.584 0.000 0.416
#> SRR2082516 2 0.1389 0.8684 0.000 0.952 0.000 0.048
#> SRR2082515 2 0.1389 0.8702 0.000 0.952 0.000 0.048
#> SRR2082517 2 0.1389 0.8719 0.000 0.952 0.000 0.048
#> SRR2082514 2 0.1302 0.8718 0.000 0.956 0.000 0.044
#> SRR2082508 1 0.0707 0.7241 0.980 0.000 0.000 0.020
#> SRR2082509 1 0.0000 0.7348 1.000 0.000 0.000 0.000
#> SRR2082507 1 0.0707 0.7241 0.980 0.000 0.000 0.020
#> SRR2082510 3 0.1474 0.9627 0.000 0.000 0.948 0.052
#> SRR2082511 4 0.6716 0.9064 0.404 0.000 0.092 0.504
#> SRR2082501 1 0.2081 0.6667 0.916 0.000 0.000 0.084
#> SRR2082502 1 0.2081 0.6667 0.916 0.000 0.000 0.084
#> SRR2082499 1 0.4948 -0.6234 0.560 0.000 0.000 0.440
#> SRR2082500 1 0.4948 -0.6234 0.560 0.000 0.000 0.440
#> SRR2082503 1 0.5000 -0.7484 0.504 0.000 0.000 0.496
#> SRR2082505 1 0.0707 0.7241 0.980 0.000 0.000 0.020
#> SRR2082506 1 0.0707 0.7241 0.980 0.000 0.000 0.020
#> SRR2082504 1 0.0707 0.7241 0.980 0.000 0.000 0.020
#> SRR2082495 1 0.5000 -0.7918 0.504 0.000 0.000 0.496
#> SRR2082496 1 0.5000 -0.7918 0.504 0.000 0.000 0.496
#> SRR2082493 4 0.6716 0.9064 0.404 0.000 0.092 0.504
#> SRR2082494 4 0.6716 0.9064 0.404 0.000 0.092 0.504
#> SRR2082491 1 0.4382 0.0647 0.704 0.000 0.000 0.296
#> SRR2082492 1 0.4382 0.0647 0.704 0.000 0.000 0.296
#> SRR2082489 1 0.0000 0.7348 1.000 0.000 0.000 0.000
#> SRR2082490 1 0.0000 0.7348 1.000 0.000 0.000 0.000
#> SRR2082497 1 0.0000 0.7348 1.000 0.000 0.000 0.000
#> SRR2082498 1 0.0000 0.7348 1.000 0.000 0.000 0.000
#> SRR2082487 1 0.2149 0.6627 0.912 0.000 0.000 0.088
#> SRR2082488 1 0.2149 0.6627 0.912 0.000 0.000 0.088
#> SRR2082485 4 0.5604 0.8408 0.476 0.000 0.020 0.504
#> SRR2082486 4 0.5604 0.8408 0.476 0.000 0.020 0.504
#> SRR2082479 1 0.0000 0.7348 1.000 0.000 0.000 0.000
#> SRR2082480 1 0.0000 0.7348 1.000 0.000 0.000 0.000
#> SRR2082483 3 0.0817 0.9812 0.000 0.000 0.976 0.024
#> SRR2082484 3 0.0817 0.9812 0.000 0.000 0.976 0.024
#> SRR2082481 1 0.0000 0.7348 1.000 0.000 0.000 0.000
#> SRR2082482 1 0.0000 0.7348 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
#> SRR2082532 2 0.3430 0.24623 0.000 0.776 0.000 0.004 0.220
#> SRR2082533 2 0.3430 0.24623 0.000 0.776 0.000 0.004 0.220
#> SRR2082534 2 0.4367 0.10073 0.000 0.620 0.000 0.008 0.372
#> SRR2082535 2 0.4367 0.10073 0.000 0.620 0.000 0.008 0.372
#> SRR2082536 2 0.4367 0.10073 0.000 0.620 0.000 0.008 0.372
#> SRR2082530 2 0.1270 0.39121 0.000 0.948 0.000 0.000 0.052
#> SRR2082531 2 0.1270 0.39121 0.000 0.948 0.000 0.000 0.052
#> SRR2082528 2 0.4367 0.10073 0.000 0.620 0.000 0.008 0.372
#> SRR2082529 2 0.4367 0.10073 0.000 0.620 0.000 0.008 0.372
#> SRR2082526 2 0.4306 0.23911 0.012 0.660 0.000 0.000 0.328
#> SRR2082527 2 0.4306 0.23911 0.012 0.660 0.000 0.000 0.328
#> SRR2082521 2 0.3906 0.00206 0.016 0.744 0.000 0.000 0.240
#> SRR2082520 5 0.4201 0.49531 0.000 0.408 0.000 0.000 0.592
#> SRR2082518 5 0.4900 -0.13406 0.024 0.464 0.000 0.000 0.512
#> SRR2082523 2 0.0000 0.39332 0.000 1.000 0.000 0.000 0.000
#> SRR2082524 2 0.0000 0.39332 0.000 1.000 0.000 0.000 0.000
#> SRR2082525 2 0.4306 0.23911 0.012 0.660 0.000 0.000 0.328
#> SRR2082522 5 0.4481 0.48133 0.000 0.416 0.000 0.008 0.576
#> SRR2082519 5 0.4740 0.51472 0.016 0.468 0.000 0.000 0.516
#> SRR2082513 2 0.4014 -0.05567 0.016 0.728 0.000 0.000 0.256
#> SRR2082512 5 0.4937 -0.10130 0.028 0.428 0.000 0.000 0.544
#> SRR2082516 5 0.4497 0.46902 0.000 0.424 0.000 0.008 0.568
#> SRR2082515 5 0.4727 0.52116 0.016 0.452 0.000 0.000 0.532
#> SRR2082517 5 0.4747 0.49493 0.016 0.484 0.000 0.000 0.500
#> SRR2082514 5 0.4747 0.50283 0.016 0.484 0.000 0.000 0.500
#> SRR2082508 1 0.2891 0.86796 0.824 0.000 0.176 0.000 0.000
#> SRR2082509 1 0.3395 0.89805 0.764 0.000 0.236 0.000 0.000
#> SRR2082507 1 0.2891 0.86796 0.824 0.000 0.176 0.000 0.000
#> SRR2082510 4 0.4586 0.84944 0.148 0.000 0.008 0.760 0.084
#> SRR2082511 3 0.0000 0.81411 0.000 0.000 1.000 0.000 0.000
#> SRR2082501 1 0.4182 0.67654 0.600 0.000 0.400 0.000 0.000
#> SRR2082502 1 0.4182 0.67654 0.600 0.000 0.400 0.000 0.000
#> SRR2082499 3 0.3210 0.68411 0.212 0.000 0.788 0.000 0.000
#> SRR2082500 3 0.3210 0.68411 0.212 0.000 0.788 0.000 0.000
#> SRR2082503 3 0.2966 0.74997 0.184 0.000 0.816 0.000 0.000
#> SRR2082505 1 0.2891 0.86796 0.824 0.000 0.176 0.000 0.000
#> SRR2082506 1 0.2891 0.86796 0.824 0.000 0.176 0.000 0.000
#> SRR2082504 1 0.2891 0.86796 0.824 0.000 0.176 0.000 0.000
#> SRR2082495 3 0.1410 0.81565 0.060 0.000 0.940 0.000 0.000
#> SRR2082496 3 0.1410 0.81565 0.060 0.000 0.940 0.000 0.000
#> SRR2082493 3 0.0000 0.81411 0.000 0.000 1.000 0.000 0.000
#> SRR2082494 3 0.0000 0.81411 0.000 0.000 1.000 0.000 0.000
#> SRR2082491 3 0.4015 0.28140 0.348 0.000 0.652 0.000 0.000
#> SRR2082492 3 0.4015 0.28140 0.348 0.000 0.652 0.000 0.000
#> SRR2082489 1 0.3452 0.89809 0.756 0.000 0.244 0.000 0.000
#> SRR2082490 1 0.3452 0.89809 0.756 0.000 0.244 0.000 0.000
#> SRR2082497 1 0.3336 0.89638 0.772 0.000 0.228 0.000 0.000
#> SRR2082498 1 0.3336 0.89638 0.772 0.000 0.228 0.000 0.000
#> SRR2082487 1 0.4192 0.68399 0.596 0.000 0.404 0.000 0.000
#> SRR2082488 1 0.4182 0.69229 0.600 0.000 0.400 0.000 0.000
#> SRR2082485 3 0.0404 0.81960 0.012 0.000 0.988 0.000 0.000
#> SRR2082486 3 0.0404 0.81960 0.012 0.000 0.988 0.000 0.000
#> SRR2082479 1 0.3452 0.89809 0.756 0.000 0.244 0.000 0.000
#> SRR2082480 1 0.3452 0.89809 0.756 0.000 0.244 0.000 0.000
#> SRR2082483 4 0.1608 0.92628 0.000 0.000 0.072 0.928 0.000
#> SRR2082484 4 0.1608 0.92628 0.000 0.000 0.072 0.928 0.000
#> SRR2082481 1 0.3452 0.89809 0.756 0.000 0.244 0.000 0.000
#> SRR2082482 1 0.3452 0.89809 0.756 0.000 0.244 0.000 0.000
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> SRR2082532 4 0.4526 0.4598 0.000 0.244 0.000 0.676 0.00 0.080
#> SRR2082533 4 0.4526 0.4598 0.000 0.244 0.000 0.676 0.00 0.080
#> SRR2082534 4 0.1556 0.6887 0.000 0.080 0.000 0.920 0.00 0.000
#> SRR2082535 4 0.1556 0.6887 0.000 0.080 0.000 0.920 0.00 0.000
#> SRR2082536 4 0.1556 0.6887 0.000 0.080 0.000 0.920 0.00 0.000
#> SRR2082530 2 0.5309 0.4765 0.000 0.560 0.000 0.312 0.00 0.128
#> SRR2082531 2 0.5309 0.4765 0.000 0.560 0.000 0.312 0.00 0.128
#> SRR2082528 4 0.1556 0.6887 0.000 0.080 0.000 0.920 0.00 0.000
#> SRR2082529 4 0.1556 0.6887 0.000 0.080 0.000 0.920 0.00 0.000
#> SRR2082526 2 0.0547 0.5858 0.000 0.980 0.000 0.020 0.00 0.000
#> SRR2082527 2 0.0547 0.5858 0.000 0.980 0.000 0.020 0.00 0.000
#> SRR2082521 4 0.5897 0.0969 0.000 0.248 0.000 0.472 0.00 0.280
#> SRR2082520 4 0.2805 0.6663 0.000 0.004 0.000 0.812 0.00 0.184
#> SRR2082518 2 0.2956 0.4914 0.000 0.848 0.000 0.088 0.00 0.064
#> SRR2082523 2 0.5442 0.3940 0.000 0.508 0.000 0.364 0.00 0.128
#> SRR2082524 2 0.5442 0.3940 0.000 0.508 0.000 0.364 0.00 0.128
#> SRR2082525 2 0.0547 0.5858 0.000 0.980 0.000 0.020 0.00 0.000
#> SRR2082522 4 0.2178 0.6823 0.000 0.000 0.000 0.868 0.00 0.132
#> SRR2082519 4 0.4361 0.6180 0.000 0.044 0.000 0.648 0.00 0.308
#> SRR2082513 6 0.6102 -0.4108 0.000 0.292 0.000 0.332 0.00 0.376
#> SRR2082512 2 0.3901 0.4128 0.000 0.768 0.000 0.096 0.00 0.136
#> SRR2082516 4 0.2257 0.6906 0.000 0.008 0.000 0.876 0.00 0.116
#> SRR2082515 4 0.4282 0.6206 0.000 0.040 0.000 0.656 0.00 0.304
#> SRR2082517 4 0.4587 0.6107 0.000 0.064 0.000 0.640 0.00 0.296
#> SRR2082514 4 0.4518 0.5929 0.000 0.044 0.000 0.604 0.00 0.352
#> SRR2082508 1 0.2011 0.8171 0.912 0.004 0.064 0.000 0.00 0.020
#> SRR2082509 1 0.0692 0.8611 0.976 0.000 0.020 0.000 0.00 0.004
#> SRR2082507 1 0.2011 0.8171 0.912 0.004 0.064 0.000 0.00 0.020
#> SRR2082510 5 0.0000 0.0000 0.000 0.000 0.000 0.000 1.00 0.000
#> SRR2082511 3 0.2333 0.7735 0.120 0.004 0.872 0.000 0.00 0.004
#> SRR2082501 1 0.3168 0.6621 0.792 0.000 0.192 0.000 0.00 0.016
#> SRR2082502 1 0.3168 0.6621 0.792 0.000 0.192 0.000 0.00 0.016
#> SRR2082499 3 0.4234 0.5111 0.440 0.000 0.544 0.000 0.00 0.016
#> SRR2082500 3 0.4234 0.5111 0.440 0.000 0.544 0.000 0.00 0.016
#> SRR2082503 3 0.3302 0.6562 0.232 0.004 0.760 0.000 0.00 0.004
#> SRR2082505 1 0.2011 0.8171 0.912 0.004 0.064 0.000 0.00 0.020
#> SRR2082506 1 0.2011 0.8171 0.912 0.004 0.064 0.000 0.00 0.020
#> SRR2082504 1 0.2011 0.8171 0.912 0.004 0.064 0.000 0.00 0.020
#> SRR2082495 3 0.2558 0.7820 0.156 0.004 0.840 0.000 0.00 0.000
#> SRR2082496 3 0.2558 0.7820 0.156 0.004 0.840 0.000 0.00 0.000
#> SRR2082493 3 0.2445 0.7730 0.120 0.008 0.868 0.000 0.00 0.004
#> SRR2082494 3 0.2445 0.7730 0.120 0.008 0.868 0.000 0.00 0.004
#> SRR2082491 3 0.4122 0.3743 0.472 0.004 0.520 0.000 0.00 0.004
#> SRR2082492 3 0.4122 0.3743 0.472 0.004 0.520 0.000 0.00 0.004
#> SRR2082489 1 0.1500 0.8599 0.936 0.000 0.052 0.000 0.00 0.012
#> SRR2082490 1 0.1500 0.8599 0.936 0.000 0.052 0.000 0.00 0.012
#> SRR2082497 1 0.0622 0.8577 0.980 0.000 0.008 0.000 0.00 0.012
#> SRR2082498 1 0.0622 0.8577 0.980 0.000 0.008 0.000 0.00 0.012
#> SRR2082487 1 0.3349 0.6097 0.748 0.000 0.244 0.000 0.00 0.008
#> SRR2082488 1 0.3349 0.6097 0.748 0.000 0.244 0.000 0.00 0.008
#> SRR2082485 3 0.2191 0.7752 0.120 0.004 0.876 0.000 0.00 0.000
#> SRR2082486 3 0.2191 0.7752 0.120 0.004 0.876 0.000 0.00 0.000
#> SRR2082479 1 0.1462 0.8556 0.936 0.000 0.056 0.000 0.00 0.008
#> SRR2082480 1 0.1462 0.8556 0.936 0.000 0.056 0.000 0.00 0.008
#> SRR2082483 6 0.5182 -0.2311 0.000 0.000 0.104 0.000 0.34 0.556
#> SRR2082484 6 0.5182 -0.2311 0.000 0.000 0.104 0.000 0.34 0.556
#> SRR2082481 1 0.1500 0.8599 0.936 0.000 0.052 0.000 0.00 0.012
#> SRR2082482 1 0.1500 0.8599 0.936 0.000 0.052 0.000 0.00 0.012
Heatmaps for the consensus matrix. It visualizes the probability of two samples to be in a same group.
consensus_heatmap(res, k = 2)
consensus_heatmap(res, k = 3)
consensus_heatmap(res, k = 4)
consensus_heatmap(res, k = 5)
consensus_heatmap(res, k = 6)
Heatmaps for the membership of samples in all partitions to see how consistent they are:
membership_heatmap(res, k = 2)
membership_heatmap(res, k = 3)
membership_heatmap(res, k = 4)
membership_heatmap(res, k = 5)
membership_heatmap(res, k = 6)
As soon as we have had the classes for columns, we can look for signatures which are significantly different between classes which can be candidate marks for certain classes. Following are the heatmaps for signatures.
Signature heatmaps where rows are scaled:
get_signatures(res, k = 2)
get_signatures(res, k = 3)
get_signatures(res, k = 4)
get_signatures(res, k = 5)
get_signatures(res, k = 6)
Signature heatmaps where rows are not scaled:
get_signatures(res, k = 2, scale_rows = FALSE)
get_signatures(res, k = 3, scale_rows = FALSE)
get_signatures(res, k = 4, scale_rows = FALSE)
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 14581 rows and 58 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 1.000 1.000 1.000 0.4996 0.501 0.501
#> 3 3 0.769 0.959 0.948 0.2893 0.843 0.686
#> 4 4 0.895 0.964 0.971 0.1245 0.918 0.761
#> 5 5 0.906 0.910 0.919 0.0578 0.964 0.861
#> 6 6 0.991 0.970 0.983 0.0380 0.982 0.919
suggest_best_k()
suggests the best \(k\) based on these statistics. The rules are as follows:
suggest_best_k(res)
#> [1] 6
#> attr(,"optional")
#> [1] 2 5
There is also optional best \(k\) = 2 5 that is worth to check.
Following shows the table of the partitions (You need to click the show/hide
code output link to see it). The membership matrix (columns with name p*
)
is inferred by
clue::cl_consensus()
function with the SE
method. Basically the value in the membership matrix
represents the probability to belong to a certain group. The finall class
label for an item is determined with the group with highest probability it
belongs to.
In get_classes()
function, the entropy is calculated from the membership
matrix and the silhouette score is calculated from the consensus matrix.
cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#> class entropy silhouette p1 p2
#> SRR2082532 2 0 1 0 1
#> SRR2082533 2 0 1 0 1
#> SRR2082534 2 0 1 0 1
#> SRR2082535 2 0 1 0 1
#> SRR2082536 2 0 1 0 1
#> SRR2082530 2 0 1 0 1
#> SRR2082531 2 0 1 0 1
#> SRR2082528 2 0 1 0 1
#> SRR2082529 2 0 1 0 1
#> SRR2082526 2 0 1 0 1
#> SRR2082527 2 0 1 0 1
#> SRR2082521 2 0 1 0 1
#> SRR2082520 2 0 1 0 1
#> SRR2082518 2 0 1 0 1
#> SRR2082523 2 0 1 0 1
#> SRR2082524 2 0 1 0 1
#> SRR2082525 2 0 1 0 1
#> SRR2082522 2 0 1 0 1
#> SRR2082519 2 0 1 0 1
#> SRR2082513 2 0 1 0 1
#> SRR2082512 2 0 1 0 1
#> SRR2082516 2 0 1 0 1
#> SRR2082515 2 0 1 0 1
#> SRR2082517 2 0 1 0 1
#> SRR2082514 2 0 1 0 1
#> SRR2082508 1 0 1 1 0
#> SRR2082509 1 0 1 1 0
#> SRR2082507 1 0 1 1 0
#> SRR2082510 1 0 1 1 0
#> SRR2082511 1 0 1 1 0
#> SRR2082501 1 0 1 1 0
#> SRR2082502 1 0 1 1 0
#> SRR2082499 1 0 1 1 0
#> SRR2082500 1 0 1 1 0
#> SRR2082503 1 0 1 1 0
#> SRR2082505 1 0 1 1 0
#> SRR2082506 1 0 1 1 0
#> SRR2082504 1 0 1 1 0
#> SRR2082495 1 0 1 1 0
#> SRR2082496 1 0 1 1 0
#> SRR2082493 1 0 1 1 0
#> SRR2082494 1 0 1 1 0
#> SRR2082491 1 0 1 1 0
#> SRR2082492 1 0 1 1 0
#> SRR2082489 1 0 1 1 0
#> SRR2082490 1 0 1 1 0
#> SRR2082497 1 0 1 1 0
#> SRR2082498 1 0 1 1 0
#> SRR2082487 1 0 1 1 0
#> SRR2082488 1 0 1 1 0
#> SRR2082485 1 0 1 1 0
#> SRR2082486 1 0 1 1 0
#> SRR2082479 1 0 1 1 0
#> SRR2082480 1 0 1 1 0
#> SRR2082483 1 0 1 1 0
#> SRR2082484 1 0 1 1 0
#> SRR2082481 1 0 1 1 0
#> SRR2082482 1 0 1 1 0
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> SRR2082532 2 0.0000 0.968 0.000 1.000 0.000
#> SRR2082533 2 0.0000 0.968 0.000 1.000 0.000
#> SRR2082534 2 0.3267 0.929 0.000 0.884 0.116
#> SRR2082535 2 0.3267 0.929 0.000 0.884 0.116
#> SRR2082536 2 0.3267 0.929 0.000 0.884 0.116
#> SRR2082530 2 0.0000 0.968 0.000 1.000 0.000
#> SRR2082531 2 0.0000 0.968 0.000 1.000 0.000
#> SRR2082528 2 0.3267 0.929 0.000 0.884 0.116
#> SRR2082529 2 0.3267 0.929 0.000 0.884 0.116
#> SRR2082526 2 0.0000 0.968 0.000 1.000 0.000
#> SRR2082527 2 0.0000 0.968 0.000 1.000 0.000
#> SRR2082521 2 0.0000 0.968 0.000 1.000 0.000
#> SRR2082520 2 0.3267 0.929 0.000 0.884 0.116
#> SRR2082518 2 0.0000 0.968 0.000 1.000 0.000
#> SRR2082523 2 0.0000 0.968 0.000 1.000 0.000
#> SRR2082524 2 0.0000 0.968 0.000 1.000 0.000
#> SRR2082525 2 0.0000 0.968 0.000 1.000 0.000
#> SRR2082522 2 0.3267 0.929 0.000 0.884 0.116
#> SRR2082519 2 0.0000 0.968 0.000 1.000 0.000
#> SRR2082513 2 0.0000 0.968 0.000 1.000 0.000
#> SRR2082512 2 0.0000 0.968 0.000 1.000 0.000
#> SRR2082516 2 0.3267 0.929 0.000 0.884 0.116
#> SRR2082515 2 0.0000 0.968 0.000 1.000 0.000
#> SRR2082517 2 0.0000 0.968 0.000 1.000 0.000
#> SRR2082514 2 0.0000 0.968 0.000 1.000 0.000
#> SRR2082508 1 0.0000 0.999 1.000 0.000 0.000
#> SRR2082509 1 0.0000 0.999 1.000 0.000 0.000
#> SRR2082507 1 0.0424 0.990 0.992 0.000 0.008
#> SRR2082510 3 0.3267 0.943 0.116 0.000 0.884
#> SRR2082511 3 0.3412 0.947 0.124 0.000 0.876
#> SRR2082501 1 0.0000 0.999 1.000 0.000 0.000
#> SRR2082502 1 0.0000 0.999 1.000 0.000 0.000
#> SRR2082499 1 0.0000 0.999 1.000 0.000 0.000
#> SRR2082500 1 0.0000 0.999 1.000 0.000 0.000
#> SRR2082503 3 0.3551 0.950 0.132 0.000 0.868
#> SRR2082505 1 0.0000 0.999 1.000 0.000 0.000
#> SRR2082506 1 0.0000 0.999 1.000 0.000 0.000
#> SRR2082504 1 0.0000 0.999 1.000 0.000 0.000
#> SRR2082495 3 0.3551 0.950 0.132 0.000 0.868
#> SRR2082496 3 0.3551 0.950 0.132 0.000 0.868
#> SRR2082493 3 0.3551 0.950 0.132 0.000 0.868
#> SRR2082494 3 0.3551 0.950 0.132 0.000 0.868
#> SRR2082491 3 0.5926 0.677 0.356 0.000 0.644
#> SRR2082492 3 0.5926 0.677 0.356 0.000 0.644
#> SRR2082489 1 0.0000 0.999 1.000 0.000 0.000
#> SRR2082490 1 0.0000 0.999 1.000 0.000 0.000
#> SRR2082497 1 0.0000 0.999 1.000 0.000 0.000
#> SRR2082498 1 0.0000 0.999 1.000 0.000 0.000
#> SRR2082487 1 0.0000 0.999 1.000 0.000 0.000
#> SRR2082488 1 0.0000 0.999 1.000 0.000 0.000
#> SRR2082485 3 0.3551 0.950 0.132 0.000 0.868
#> SRR2082486 3 0.3551 0.950 0.132 0.000 0.868
#> SRR2082479 1 0.0000 0.999 1.000 0.000 0.000
#> SRR2082480 1 0.0000 0.999 1.000 0.000 0.000
#> SRR2082483 3 0.3267 0.943 0.116 0.000 0.884
#> SRR2082484 3 0.3267 0.943 0.116 0.000 0.884
#> SRR2082481 1 0.0000 0.999 1.000 0.000 0.000
#> SRR2082482 1 0.0000 0.999 1.000 0.000 0.000
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> SRR2082532 2 0.0000 1.000 0.000 1 0.000 0
#> SRR2082533 2 0.0000 1.000 0.000 1 0.000 0
#> SRR2082534 4 0.0000 1.000 0.000 0 0.000 1
#> SRR2082535 4 0.0000 1.000 0.000 0 0.000 1
#> SRR2082536 4 0.0000 1.000 0.000 0 0.000 1
#> SRR2082530 2 0.0000 1.000 0.000 1 0.000 0
#> SRR2082531 2 0.0000 1.000 0.000 1 0.000 0
#> SRR2082528 4 0.0000 1.000 0.000 0 0.000 1
#> SRR2082529 4 0.0000 1.000 0.000 0 0.000 1
#> SRR2082526 2 0.0000 1.000 0.000 1 0.000 0
#> SRR2082527 2 0.0000 1.000 0.000 1 0.000 0
#> SRR2082521 2 0.0000 1.000 0.000 1 0.000 0
#> SRR2082520 4 0.0000 1.000 0.000 0 0.000 1
#> SRR2082518 2 0.0000 1.000 0.000 1 0.000 0
#> SRR2082523 2 0.0000 1.000 0.000 1 0.000 0
#> SRR2082524 2 0.0000 1.000 0.000 1 0.000 0
#> SRR2082525 2 0.0000 1.000 0.000 1 0.000 0
#> SRR2082522 4 0.0000 1.000 0.000 0 0.000 1
#> SRR2082519 2 0.0000 1.000 0.000 1 0.000 0
#> SRR2082513 2 0.0000 1.000 0.000 1 0.000 0
#> SRR2082512 2 0.0000 1.000 0.000 1 0.000 0
#> SRR2082516 4 0.0000 1.000 0.000 0 0.000 1
#> SRR2082515 2 0.0000 1.000 0.000 1 0.000 0
#> SRR2082517 2 0.0000 1.000 0.000 1 0.000 0
#> SRR2082514 2 0.0000 1.000 0.000 1 0.000 0
#> SRR2082508 1 0.0000 0.999 1.000 0 0.000 0
#> SRR2082509 1 0.0000 0.999 1.000 0 0.000 0
#> SRR2082507 1 0.0469 0.985 0.988 0 0.012 0
#> SRR2082510 3 0.0000 0.822 0.000 0 1.000 0
#> SRR2082511 3 0.1867 0.876 0.072 0 0.928 0
#> SRR2082501 1 0.0000 0.999 1.000 0 0.000 0
#> SRR2082502 1 0.0000 0.999 1.000 0 0.000 0
#> SRR2082499 1 0.0000 0.999 1.000 0 0.000 0
#> SRR2082500 1 0.0000 0.999 1.000 0 0.000 0
#> SRR2082503 3 0.2760 0.905 0.128 0 0.872 0
#> SRR2082505 1 0.0000 0.999 1.000 0 0.000 0
#> SRR2082506 1 0.0000 0.999 1.000 0 0.000 0
#> SRR2082504 1 0.0000 0.999 1.000 0 0.000 0
#> SRR2082495 3 0.2760 0.905 0.128 0 0.872 0
#> SRR2082496 3 0.2760 0.905 0.128 0 0.872 0
#> SRR2082493 3 0.2760 0.905 0.128 0 0.872 0
#> SRR2082494 3 0.2760 0.905 0.128 0 0.872 0
#> SRR2082491 3 0.4679 0.644 0.352 0 0.648 0
#> SRR2082492 3 0.4679 0.644 0.352 0 0.648 0
#> SRR2082489 1 0.0000 0.999 1.000 0 0.000 0
#> SRR2082490 1 0.0000 0.999 1.000 0 0.000 0
#> SRR2082497 1 0.0000 0.999 1.000 0 0.000 0
#> SRR2082498 1 0.0000 0.999 1.000 0 0.000 0
#> SRR2082487 1 0.0000 0.999 1.000 0 0.000 0
#> SRR2082488 1 0.0000 0.999 1.000 0 0.000 0
#> SRR2082485 3 0.2760 0.905 0.128 0 0.872 0
#> SRR2082486 3 0.2760 0.905 0.128 0 0.872 0
#> SRR2082479 1 0.0000 0.999 1.000 0 0.000 0
#> SRR2082480 1 0.0000 0.999 1.000 0 0.000 0
#> SRR2082483 3 0.0000 0.822 0.000 0 1.000 0
#> SRR2082484 3 0.0000 0.822 0.000 0 1.000 0
#> SRR2082481 1 0.0000 0.999 1.000 0 0.000 0
#> SRR2082482 1 0.0000 0.999 1.000 0 0.000 0
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> SRR2082532 2 0.0000 0.868 0.000 1.000 0.000 0.000 0.000
#> SRR2082533 2 0.0000 0.868 0.000 1.000 0.000 0.000 0.000
#> SRR2082534 4 0.0000 0.990 0.000 0.000 0.000 1.000 0.000
#> SRR2082535 4 0.0000 0.990 0.000 0.000 0.000 1.000 0.000
#> SRR2082536 4 0.0000 0.990 0.000 0.000 0.000 1.000 0.000
#> SRR2082530 2 0.1121 0.852 0.000 0.956 0.000 0.000 0.044
#> SRR2082531 2 0.1121 0.852 0.000 0.956 0.000 0.000 0.044
#> SRR2082528 4 0.0000 0.990 0.000 0.000 0.000 1.000 0.000
#> SRR2082529 4 0.0000 0.990 0.000 0.000 0.000 1.000 0.000
#> SRR2082526 5 0.3932 1.000 0.000 0.328 0.000 0.000 0.672
#> SRR2082527 5 0.3932 1.000 0.000 0.328 0.000 0.000 0.672
#> SRR2082521 2 0.0000 0.868 0.000 1.000 0.000 0.000 0.000
#> SRR2082520 4 0.1992 0.922 0.000 0.044 0.000 0.924 0.032
#> SRR2082518 5 0.3932 1.000 0.000 0.328 0.000 0.000 0.672
#> SRR2082523 2 0.0000 0.868 0.000 1.000 0.000 0.000 0.000
#> SRR2082524 2 0.0000 0.868 0.000 1.000 0.000 0.000 0.000
#> SRR2082525 5 0.3932 1.000 0.000 0.328 0.000 0.000 0.672
#> SRR2082522 4 0.0000 0.990 0.000 0.000 0.000 1.000 0.000
#> SRR2082519 2 0.3143 0.666 0.000 0.796 0.000 0.000 0.204
#> SRR2082513 2 0.1121 0.852 0.000 0.956 0.000 0.000 0.044
#> SRR2082512 5 0.3932 1.000 0.000 0.328 0.000 0.000 0.672
#> SRR2082516 4 0.0000 0.990 0.000 0.000 0.000 1.000 0.000
#> SRR2082515 2 0.3143 0.666 0.000 0.796 0.000 0.000 0.204
#> SRR2082517 2 0.3274 0.646 0.000 0.780 0.000 0.000 0.220
#> SRR2082514 2 0.2329 0.778 0.000 0.876 0.000 0.000 0.124
#> SRR2082508 1 0.0000 0.998 1.000 0.000 0.000 0.000 0.000
#> SRR2082509 1 0.0000 0.998 1.000 0.000 0.000 0.000 0.000
#> SRR2082507 1 0.1043 0.955 0.960 0.000 0.040 0.000 0.000
#> SRR2082510 3 0.3932 0.691 0.000 0.000 0.672 0.000 0.328
#> SRR2082511 3 0.0404 0.859 0.012 0.000 0.988 0.000 0.000
#> SRR2082501 1 0.0000 0.998 1.000 0.000 0.000 0.000 0.000
#> SRR2082502 1 0.0000 0.998 1.000 0.000 0.000 0.000 0.000
#> SRR2082499 1 0.0000 0.998 1.000 0.000 0.000 0.000 0.000
#> SRR2082500 1 0.0000 0.998 1.000 0.000 0.000 0.000 0.000
#> SRR2082503 3 0.0794 0.870 0.028 0.000 0.972 0.000 0.000
#> SRR2082505 1 0.0000 0.998 1.000 0.000 0.000 0.000 0.000
#> SRR2082506 1 0.0000 0.998 1.000 0.000 0.000 0.000 0.000
#> SRR2082504 1 0.0000 0.998 1.000 0.000 0.000 0.000 0.000
#> SRR2082495 3 0.0794 0.870 0.028 0.000 0.972 0.000 0.000
#> SRR2082496 3 0.0794 0.870 0.028 0.000 0.972 0.000 0.000
#> SRR2082493 3 0.0794 0.870 0.028 0.000 0.972 0.000 0.000
#> SRR2082494 3 0.0794 0.870 0.028 0.000 0.972 0.000 0.000
#> SRR2082491 3 0.3508 0.671 0.252 0.000 0.748 0.000 0.000
#> SRR2082492 3 0.3508 0.671 0.252 0.000 0.748 0.000 0.000
#> SRR2082489 1 0.0000 0.998 1.000 0.000 0.000 0.000 0.000
#> SRR2082490 1 0.0000 0.998 1.000 0.000 0.000 0.000 0.000
#> SRR2082497 1 0.0000 0.998 1.000 0.000 0.000 0.000 0.000
#> SRR2082498 1 0.0000 0.998 1.000 0.000 0.000 0.000 0.000
#> SRR2082487 1 0.0000 0.998 1.000 0.000 0.000 0.000 0.000
#> SRR2082488 1 0.0000 0.998 1.000 0.000 0.000 0.000 0.000
#> SRR2082485 3 0.0794 0.870 0.028 0.000 0.972 0.000 0.000
#> SRR2082486 3 0.0794 0.870 0.028 0.000 0.972 0.000 0.000
#> SRR2082479 1 0.0000 0.998 1.000 0.000 0.000 0.000 0.000
#> SRR2082480 1 0.0000 0.998 1.000 0.000 0.000 0.000 0.000
#> SRR2082483 3 0.3932 0.691 0.000 0.000 0.672 0.000 0.328
#> SRR2082484 3 0.3932 0.691 0.000 0.000 0.672 0.000 0.328
#> SRR2082481 1 0.0000 0.998 1.000 0.000 0.000 0.000 0.000
#> SRR2082482 1 0.0000 0.998 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
#> SRR2082532 2 0.000 0.912 0.000 1.000 0.000 0.000 0.000 0
#> SRR2082533 2 0.000 0.912 0.000 1.000 0.000 0.000 0.000 0
#> SRR2082534 4 0.000 0.988 0.000 0.000 0.000 1.000 0.000 0
#> SRR2082535 4 0.000 0.988 0.000 0.000 0.000 1.000 0.000 0
#> SRR2082536 4 0.000 0.988 0.000 0.000 0.000 1.000 0.000 0
#> SRR2082530 2 0.101 0.904 0.000 0.956 0.000 0.000 0.044 0
#> SRR2082531 2 0.101 0.904 0.000 0.956 0.000 0.000 0.044 0
#> SRR2082528 4 0.000 0.988 0.000 0.000 0.000 1.000 0.000 0
#> SRR2082529 4 0.000 0.988 0.000 0.000 0.000 1.000 0.000 0
#> SRR2082526 5 0.000 1.000 0.000 0.000 0.000 0.000 1.000 0
#> SRR2082527 5 0.000 1.000 0.000 0.000 0.000 0.000 1.000 0
#> SRR2082521 2 0.000 0.912 0.000 1.000 0.000 0.000 0.000 0
#> SRR2082520 4 0.179 0.911 0.000 0.044 0.000 0.924 0.032 0
#> SRR2082518 5 0.000 1.000 0.000 0.000 0.000 0.000 1.000 0
#> SRR2082523 2 0.000 0.912 0.000 1.000 0.000 0.000 0.000 0
#> SRR2082524 2 0.000 0.912 0.000 1.000 0.000 0.000 0.000 0
#> SRR2082525 5 0.000 1.000 0.000 0.000 0.000 0.000 1.000 0
#> SRR2082522 4 0.000 0.988 0.000 0.000 0.000 1.000 0.000 0
#> SRR2082519 2 0.282 0.806 0.000 0.796 0.000 0.000 0.204 0
#> SRR2082513 2 0.101 0.904 0.000 0.956 0.000 0.000 0.044 0
#> SRR2082512 5 0.000 1.000 0.000 0.000 0.000 0.000 1.000 0
#> SRR2082516 4 0.000 0.988 0.000 0.000 0.000 1.000 0.000 0
#> SRR2082515 2 0.282 0.806 0.000 0.796 0.000 0.000 0.204 0
#> SRR2082517 2 0.294 0.796 0.000 0.780 0.000 0.000 0.220 0
#> SRR2082514 2 0.209 0.865 0.000 0.876 0.000 0.000 0.124 0
#> SRR2082508 1 0.000 0.997 1.000 0.000 0.000 0.000 0.000 0
#> SRR2082509 1 0.000 0.997 1.000 0.000 0.000 0.000 0.000 0
#> SRR2082507 1 0.107 0.943 0.952 0.000 0.048 0.000 0.000 0
#> SRR2082510 6 0.000 1.000 0.000 0.000 0.000 0.000 0.000 1
#> SRR2082511 3 0.000 1.000 0.000 0.000 1.000 0.000 0.000 0
#> SRR2082501 1 0.000 0.997 1.000 0.000 0.000 0.000 0.000 0
#> SRR2082502 1 0.000 0.997 1.000 0.000 0.000 0.000 0.000 0
#> SRR2082499 1 0.000 0.997 1.000 0.000 0.000 0.000 0.000 0
#> SRR2082500 1 0.000 0.997 1.000 0.000 0.000 0.000 0.000 0
#> SRR2082503 3 0.000 1.000 0.000 0.000 1.000 0.000 0.000 0
#> SRR2082505 1 0.000 0.997 1.000 0.000 0.000 0.000 0.000 0
#> SRR2082506 1 0.000 0.997 1.000 0.000 0.000 0.000 0.000 0
#> SRR2082504 1 0.000 0.997 1.000 0.000 0.000 0.000 0.000 0
#> SRR2082495 3 0.000 1.000 0.000 0.000 1.000 0.000 0.000 0
#> SRR2082496 3 0.000 1.000 0.000 0.000 1.000 0.000 0.000 0
#> SRR2082493 3 0.000 1.000 0.000 0.000 1.000 0.000 0.000 0
#> SRR2082494 3 0.000 1.000 0.000 0.000 1.000 0.000 0.000 0
#> SRR2082491 3 0.000 1.000 0.000 0.000 1.000 0.000 0.000 0
#> SRR2082492 3 0.000 1.000 0.000 0.000 1.000 0.000 0.000 0
#> SRR2082489 1 0.000 0.997 1.000 0.000 0.000 0.000 0.000 0
#> SRR2082490 1 0.000 0.997 1.000 0.000 0.000 0.000 0.000 0
#> SRR2082497 1 0.000 0.997 1.000 0.000 0.000 0.000 0.000 0
#> SRR2082498 1 0.000 0.997 1.000 0.000 0.000 0.000 0.000 0
#> SRR2082487 1 0.000 0.997 1.000 0.000 0.000 0.000 0.000 0
#> SRR2082488 1 0.000 0.997 1.000 0.000 0.000 0.000 0.000 0
#> SRR2082485 3 0.000 1.000 0.000 0.000 1.000 0.000 0.000 0
#> SRR2082486 3 0.000 1.000 0.000 0.000 1.000 0.000 0.000 0
#> SRR2082479 1 0.000 0.997 1.000 0.000 0.000 0.000 0.000 0
#> SRR2082480 1 0.000 0.997 1.000 0.000 0.000 0.000 0.000 0
#> SRR2082483 6 0.000 1.000 0.000 0.000 0.000 0.000 0.000 1
#> SRR2082484 6 0.000 1.000 0.000 0.000 0.000 0.000 0.000 1
#> SRR2082481 1 0.000 0.997 1.000 0.000 0.000 0.000 0.000 0
#> SRR2082482 1 0.000 0.997 1.000 0.000 0.000 0.000 0.000 0
Heatmaps for the consensus matrix. It visualizes the probability of two samples to be in a same group.
consensus_heatmap(res, k = 2)
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 14581 rows and 58 columns.
#> Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'ATC' method.
#> Subgroups are detected by 'mclust' method.
#> Performed in total 1250 partitions by row resampling.
#> Best k for subgroups seems to be 2.
#>
#> Following methods can be applied to this 'ConsensusPartition' object:
#> [1] "cola_report" "collect_classes" "collect_plots"
#> [4] "collect_stats" "colnames" "compare_signatures"
#> [7] "consensus_heatmap" "dimension_reduction" "functional_enrichment"
#> [10] "get_anno_col" "get_anno" "get_classes"
#> [13] "get_consensus" "get_matrix" "get_membership"
#> [16] "get_param" "get_signatures" "get_stats"
#> [19] "is_best_k" "is_stable_k" "membership_heatmap"
#> [22] "ncol" "nrow" "plot_ecdf"
#> [25] "rownames" "select_partition_number" "show"
#> [28] "suggest_best_k" "test_to_known_factors"
collect_plots()
function collects all the plots made from res
for all k
(number of partitions)
into one single page to provide an easy and fast comparison between different k
.
collect_plots(res)
The plots are:
k
and the heatmap of
predicted classes for each k
.k
.k
.k
.All the plots in panels can be made by individual functions and they are plotted later in this section.
select_partition_number()
produces several plots showing different
statistics for choosing “optimized” k
. There are following statistics:
k
;k
, the area increased is defined as \(A_k - A_{k-1}\).The detailed explanations of these statistics can be found in the cola vignette.
Generally speaking, lower PAC score, higher mean silhouette score or higher
concordance corresponds to better partition. Rand index and Jaccard index
measure how similar the current partition is compared to partition with k-1
.
If they are too similar, we won't accept k
is better than k-1
.
select_partition_number(res)
The numeric values for all these statistics can be obtained by get_stats()
.
get_stats(res)
#> k 1-PAC mean_silhouette concordance area_increased Rand Jaccard
#> 2 2 1.000 1.000 1.000 0.4996 0.501 0.501
#> 3 3 0.773 0.909 0.922 0.1580 0.946 0.891
#> 4 4 0.714 0.754 0.857 0.1543 0.907 0.791
#> 5 5 0.633 0.612 0.773 0.1349 0.840 0.561
#> 6 6 0.742 0.803 0.872 0.0671 0.911 0.634
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
#> SRR2082532 2 0 1 0 1
#> SRR2082533 2 0 1 0 1
#> SRR2082534 2 0 1 0 1
#> SRR2082535 2 0 1 0 1
#> SRR2082536 2 0 1 0 1
#> SRR2082530 2 0 1 0 1
#> SRR2082531 2 0 1 0 1
#> SRR2082528 2 0 1 0 1
#> SRR2082529 2 0 1 0 1
#> SRR2082526 2 0 1 0 1
#> SRR2082527 2 0 1 0 1
#> SRR2082521 2 0 1 0 1
#> SRR2082520 2 0 1 0 1
#> SRR2082518 2 0 1 0 1
#> SRR2082523 2 0 1 0 1
#> SRR2082524 2 0 1 0 1
#> SRR2082525 2 0 1 0 1
#> SRR2082522 2 0 1 0 1
#> SRR2082519 2 0 1 0 1
#> SRR2082513 2 0 1 0 1
#> SRR2082512 2 0 1 0 1
#> SRR2082516 2 0 1 0 1
#> SRR2082515 2 0 1 0 1
#> SRR2082517 2 0 1 0 1
#> SRR2082514 2 0 1 0 1
#> SRR2082508 1 0 1 1 0
#> SRR2082509 1 0 1 1 0
#> SRR2082507 1 0 1 1 0
#> SRR2082510 1 0 1 1 0
#> SRR2082511 1 0 1 1 0
#> SRR2082501 1 0 1 1 0
#> SRR2082502 1 0 1 1 0
#> SRR2082499 1 0 1 1 0
#> SRR2082500 1 0 1 1 0
#> SRR2082503 1 0 1 1 0
#> SRR2082505 1 0 1 1 0
#> SRR2082506 1 0 1 1 0
#> SRR2082504 1 0 1 1 0
#> SRR2082495 1 0 1 1 0
#> SRR2082496 1 0 1 1 0
#> SRR2082493 1 0 1 1 0
#> SRR2082494 1 0 1 1 0
#> SRR2082491 1 0 1 1 0
#> SRR2082492 1 0 1 1 0
#> SRR2082489 1 0 1 1 0
#> SRR2082490 1 0 1 1 0
#> SRR2082497 1 0 1 1 0
#> SRR2082498 1 0 1 1 0
#> SRR2082487 1 0 1 1 0
#> SRR2082488 1 0 1 1 0
#> SRR2082485 1 0 1 1 0
#> SRR2082486 1 0 1 1 0
#> SRR2082479 1 0 1 1 0
#> SRR2082480 1 0 1 1 0
#> SRR2082483 1 0 1 1 0
#> SRR2082484 1 0 1 1 0
#> SRR2082481 1 0 1 1 0
#> SRR2082482 1 0 1 1 0
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> SRR2082532 2 0.2261 0.903 0.000 0.932 0.068
#> SRR2082533 2 0.2261 0.903 0.000 0.932 0.068
#> SRR2082534 2 0.0424 0.908 0.000 0.992 0.008
#> SRR2082535 2 0.0237 0.908 0.000 0.996 0.004
#> SRR2082536 2 0.0747 0.908 0.000 0.984 0.016
#> SRR2082530 2 0.2625 0.900 0.000 0.916 0.084
#> SRR2082531 2 0.2625 0.900 0.000 0.916 0.084
#> SRR2082528 2 0.0424 0.908 0.000 0.992 0.008
#> SRR2082529 2 0.0747 0.908 0.000 0.984 0.016
#> SRR2082526 2 0.2625 0.900 0.000 0.916 0.084
#> SRR2082527 2 0.2625 0.900 0.000 0.916 0.084
#> SRR2082521 2 0.0424 0.907 0.000 0.992 0.008
#> SRR2082520 2 0.3267 0.882 0.000 0.884 0.116
#> SRR2082518 2 0.1753 0.902 0.000 0.952 0.048
#> SRR2082523 2 0.2625 0.900 0.000 0.916 0.084
#> SRR2082524 2 0.2625 0.900 0.000 0.916 0.084
#> SRR2082525 2 0.2625 0.900 0.000 0.916 0.084
#> SRR2082522 2 0.5497 0.614 0.000 0.708 0.292
#> SRR2082519 2 0.3267 0.882 0.000 0.884 0.116
#> SRR2082513 2 0.3267 0.882 0.000 0.884 0.116
#> SRR2082512 2 0.3267 0.882 0.000 0.884 0.116
#> SRR2082516 2 0.5560 0.601 0.000 0.700 0.300
#> SRR2082515 2 0.3267 0.882 0.000 0.884 0.116
#> SRR2082517 2 0.3267 0.882 0.000 0.884 0.116
#> SRR2082514 2 0.3267 0.882 0.000 0.884 0.116
#> SRR2082508 1 0.0000 0.954 1.000 0.000 0.000
#> SRR2082509 1 0.0000 0.954 1.000 0.000 0.000
#> SRR2082507 1 0.0000 0.954 1.000 0.000 0.000
#> SRR2082510 3 0.4555 1.000 0.200 0.000 0.800
#> SRR2082511 1 0.3551 0.858 0.868 0.000 0.132
#> SRR2082501 1 0.0000 0.954 1.000 0.000 0.000
#> SRR2082502 1 0.0000 0.954 1.000 0.000 0.000
#> SRR2082499 1 0.0592 0.951 0.988 0.000 0.012
#> SRR2082500 1 0.0424 0.953 0.992 0.000 0.008
#> SRR2082503 1 0.3551 0.858 0.868 0.000 0.132
#> SRR2082505 1 0.0000 0.954 1.000 0.000 0.000
#> SRR2082506 1 0.0000 0.954 1.000 0.000 0.000
#> SRR2082504 1 0.0000 0.954 1.000 0.000 0.000
#> SRR2082495 1 0.3551 0.858 0.868 0.000 0.132
#> SRR2082496 1 0.3551 0.858 0.868 0.000 0.132
#> SRR2082493 1 0.2878 0.891 0.904 0.000 0.096
#> SRR2082494 1 0.2878 0.891 0.904 0.000 0.096
#> SRR2082491 1 0.0592 0.951 0.988 0.000 0.012
#> SRR2082492 1 0.0592 0.951 0.988 0.000 0.012
#> SRR2082489 1 0.0237 0.953 0.996 0.000 0.004
#> SRR2082490 1 0.0237 0.953 0.996 0.000 0.004
#> SRR2082497 1 0.0000 0.954 1.000 0.000 0.000
#> SRR2082498 1 0.0000 0.954 1.000 0.000 0.000
#> SRR2082487 1 0.0000 0.954 1.000 0.000 0.000
#> SRR2082488 1 0.0000 0.954 1.000 0.000 0.000
#> SRR2082485 1 0.3551 0.858 0.868 0.000 0.132
#> SRR2082486 1 0.3551 0.858 0.868 0.000 0.132
#> SRR2082479 1 0.0424 0.953 0.992 0.000 0.008
#> SRR2082480 1 0.0424 0.953 0.992 0.000 0.008
#> SRR2082483 3 0.4555 1.000 0.200 0.000 0.800
#> SRR2082484 3 0.4555 1.000 0.200 0.000 0.800
#> SRR2082481 1 0.0000 0.954 1.000 0.000 0.000
#> SRR2082482 1 0.0000 0.954 1.000 0.000 0.000
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> SRR2082532 2 0.3400 0.694 0.000 0.820 0.000 0.180
#> SRR2082533 2 0.3400 0.694 0.000 0.820 0.000 0.180
#> SRR2082534 4 0.4297 0.681 0.000 0.084 0.096 0.820
#> SRR2082535 4 0.4297 0.681 0.000 0.084 0.096 0.820
#> SRR2082536 4 0.4362 0.682 0.000 0.088 0.096 0.816
#> SRR2082530 2 0.0000 0.830 0.000 1.000 0.000 0.000
#> SRR2082531 2 0.0000 0.830 0.000 1.000 0.000 0.000
#> SRR2082528 4 0.4362 0.682 0.000 0.088 0.096 0.816
#> SRR2082529 4 0.4362 0.682 0.000 0.088 0.096 0.816
#> SRR2082526 2 0.0000 0.830 0.000 1.000 0.000 0.000
#> SRR2082527 2 0.0000 0.830 0.000 1.000 0.000 0.000
#> SRR2082521 2 0.4673 0.584 0.000 0.700 0.008 0.292
#> SRR2082520 4 0.6393 0.517 0.000 0.188 0.160 0.652
#> SRR2082518 2 0.4244 0.748 0.000 0.804 0.036 0.160
#> SRR2082523 2 0.0000 0.830 0.000 1.000 0.000 0.000
#> SRR2082524 2 0.0000 0.830 0.000 1.000 0.000 0.000
#> SRR2082525 2 0.0000 0.830 0.000 1.000 0.000 0.000
#> SRR2082522 4 0.5712 0.531 0.000 0.048 0.308 0.644
#> SRR2082519 4 0.6014 0.276 0.000 0.360 0.052 0.588
#> SRR2082513 2 0.4881 0.699 0.000 0.756 0.048 0.196
#> SRR2082512 2 0.4990 0.702 0.000 0.756 0.060 0.184
#> SRR2082516 4 0.5926 0.537 0.000 0.060 0.308 0.632
#> SRR2082515 4 0.6014 0.276 0.000 0.360 0.052 0.588
#> SRR2082517 4 0.6014 0.276 0.000 0.360 0.052 0.588
#> SRR2082514 2 0.5830 0.501 0.000 0.620 0.048 0.332
#> SRR2082508 1 0.1174 0.880 0.968 0.000 0.020 0.012
#> SRR2082509 1 0.0336 0.885 0.992 0.000 0.008 0.000
#> SRR2082507 1 0.1174 0.880 0.968 0.000 0.020 0.012
#> SRR2082510 3 0.3172 1.000 0.160 0.000 0.840 0.000
#> SRR2082511 1 0.4560 0.582 0.700 0.000 0.296 0.004
#> SRR2082501 1 0.1576 0.869 0.948 0.000 0.048 0.004
#> SRR2082502 1 0.1305 0.874 0.960 0.000 0.036 0.004
#> SRR2082499 1 0.1398 0.872 0.956 0.000 0.040 0.004
#> SRR2082500 1 0.1398 0.872 0.956 0.000 0.040 0.004
#> SRR2082503 1 0.4372 0.633 0.728 0.000 0.268 0.004
#> SRR2082505 1 0.1174 0.880 0.968 0.000 0.020 0.012
#> SRR2082506 1 0.1174 0.880 0.968 0.000 0.020 0.012
#> SRR2082504 1 0.1174 0.880 0.968 0.000 0.020 0.012
#> SRR2082495 1 0.4372 0.633 0.728 0.000 0.268 0.004
#> SRR2082496 1 0.4372 0.633 0.728 0.000 0.268 0.004
#> SRR2082493 1 0.3837 0.673 0.776 0.000 0.224 0.000
#> SRR2082494 1 0.3837 0.673 0.776 0.000 0.224 0.000
#> SRR2082491 1 0.0524 0.885 0.988 0.000 0.008 0.004
#> SRR2082492 1 0.0524 0.885 0.988 0.000 0.008 0.004
#> SRR2082489 1 0.0188 0.886 0.996 0.000 0.004 0.000
#> SRR2082490 1 0.0188 0.886 0.996 0.000 0.004 0.000
#> SRR2082497 1 0.1174 0.880 0.968 0.000 0.020 0.012
#> SRR2082498 1 0.1174 0.880 0.968 0.000 0.020 0.012
#> SRR2082487 1 0.0000 0.886 1.000 0.000 0.000 0.000
#> SRR2082488 1 0.0188 0.886 0.996 0.000 0.004 0.000
#> SRR2082485 1 0.4401 0.626 0.724 0.000 0.272 0.004
#> SRR2082486 1 0.4401 0.626 0.724 0.000 0.272 0.004
#> SRR2082479 1 0.0188 0.886 0.996 0.000 0.004 0.000
#> SRR2082480 1 0.0000 0.886 1.000 0.000 0.000 0.000
#> SRR2082483 3 0.3172 1.000 0.160 0.000 0.840 0.000
#> SRR2082484 3 0.3172 1.000 0.160 0.000 0.840 0.000
#> SRR2082481 1 0.1174 0.880 0.968 0.000 0.020 0.012
#> SRR2082482 1 0.1174 0.880 0.968 0.000 0.020 0.012
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> SRR2082532 2 0.2389 0.7491 0.000 0.880 0.000 0.116 0.004
#> SRR2082533 2 0.2389 0.7491 0.000 0.880 0.000 0.116 0.004
#> SRR2082534 4 0.0000 1.0000 0.000 0.000 0.000 1.000 0.000
#> SRR2082535 4 0.0000 1.0000 0.000 0.000 0.000 1.000 0.000
#> SRR2082536 4 0.0000 1.0000 0.000 0.000 0.000 1.000 0.000
#> SRR2082530 2 0.0000 0.8182 0.000 1.000 0.000 0.000 0.000
#> SRR2082531 2 0.0000 0.8182 0.000 1.000 0.000 0.000 0.000
#> SRR2082528 4 0.0000 1.0000 0.000 0.000 0.000 1.000 0.000
#> SRR2082529 4 0.0000 1.0000 0.000 0.000 0.000 1.000 0.000
#> SRR2082526 2 0.0000 0.8182 0.000 1.000 0.000 0.000 0.000
#> SRR2082527 2 0.0000 0.8182 0.000 1.000 0.000 0.000 0.000
#> SRR2082521 2 0.5045 0.6200 0.000 0.696 0.000 0.108 0.196
#> SRR2082520 5 0.6460 0.3048 0.000 0.252 0.000 0.248 0.500
#> SRR2082518 2 0.3835 0.6641 0.000 0.732 0.000 0.008 0.260
#> SRR2082523 2 0.0162 0.8180 0.000 0.996 0.000 0.004 0.000
#> SRR2082524 2 0.0162 0.8180 0.000 0.996 0.000 0.004 0.000
#> SRR2082525 2 0.0000 0.8182 0.000 1.000 0.000 0.000 0.000
#> SRR2082522 5 0.5775 0.3345 0.000 0.136 0.000 0.264 0.600
#> SRR2082519 5 0.6609 0.1268 0.000 0.368 0.000 0.216 0.416
#> SRR2082513 2 0.3861 0.6410 0.000 0.712 0.000 0.004 0.284
#> SRR2082512 2 0.3861 0.6410 0.000 0.712 0.000 0.004 0.284
#> SRR2082516 5 0.5758 0.3306 0.000 0.132 0.000 0.268 0.600
#> SRR2082515 5 0.6625 0.1294 0.000 0.368 0.000 0.220 0.412
#> SRR2082517 5 0.6596 0.1154 0.000 0.372 0.000 0.212 0.416
#> SRR2082514 2 0.5067 0.5630 0.000 0.648 0.000 0.064 0.288
#> SRR2082508 1 0.0000 0.8309 1.000 0.000 0.000 0.000 0.000
#> SRR2082509 1 0.4306 -0.4583 0.508 0.000 0.492 0.000 0.000
#> SRR2082507 1 0.0000 0.8309 1.000 0.000 0.000 0.000 0.000
#> SRR2082510 5 0.4359 0.0857 0.004 0.000 0.412 0.000 0.584
#> SRR2082511 3 0.3134 0.7102 0.120 0.000 0.848 0.000 0.032
#> SRR2082501 3 0.4150 0.6098 0.388 0.000 0.612 0.000 0.000
#> SRR2082502 3 0.4192 0.5894 0.404 0.000 0.596 0.000 0.000
#> SRR2082499 3 0.4074 0.6298 0.364 0.000 0.636 0.000 0.000
#> SRR2082500 3 0.4101 0.6237 0.372 0.000 0.628 0.000 0.000
#> SRR2082503 3 0.2873 0.7186 0.128 0.000 0.856 0.000 0.016
#> SRR2082505 1 0.0510 0.8267 0.984 0.000 0.016 0.000 0.000
#> SRR2082506 1 0.0000 0.8309 1.000 0.000 0.000 0.000 0.000
#> SRR2082504 1 0.0162 0.8311 0.996 0.000 0.004 0.000 0.000
#> SRR2082495 3 0.2329 0.7191 0.124 0.000 0.876 0.000 0.000
#> SRR2082496 3 0.2329 0.7191 0.124 0.000 0.876 0.000 0.000
#> SRR2082493 3 0.4196 0.2748 0.004 0.000 0.640 0.000 0.356
#> SRR2082494 3 0.4196 0.2748 0.004 0.000 0.640 0.000 0.356
#> SRR2082491 3 0.3661 0.6852 0.276 0.000 0.724 0.000 0.000
#> SRR2082492 3 0.3586 0.6920 0.264 0.000 0.736 0.000 0.000
#> SRR2082489 1 0.3932 0.3231 0.672 0.000 0.328 0.000 0.000
#> SRR2082490 1 0.3932 0.3231 0.672 0.000 0.328 0.000 0.000
#> SRR2082497 1 0.0290 0.8315 0.992 0.000 0.008 0.000 0.000
#> SRR2082498 1 0.0404 0.8310 0.988 0.000 0.012 0.000 0.000
#> SRR2082487 3 0.4278 0.5055 0.452 0.000 0.548 0.000 0.000
#> SRR2082488 3 0.4278 0.5055 0.452 0.000 0.548 0.000 0.000
#> SRR2082485 3 0.2612 0.7166 0.124 0.000 0.868 0.000 0.008
#> SRR2082486 3 0.2612 0.7166 0.124 0.000 0.868 0.000 0.008
#> SRR2082479 3 0.4074 0.5976 0.364 0.000 0.636 0.000 0.000
#> SRR2082480 3 0.4074 0.5976 0.364 0.000 0.636 0.000 0.000
#> SRR2082483 5 0.4415 0.0771 0.004 0.000 0.444 0.000 0.552
#> SRR2082484 5 0.4415 0.0771 0.004 0.000 0.444 0.000 0.552
#> SRR2082481 1 0.0794 0.8241 0.972 0.000 0.028 0.000 0.000
#> SRR2082482 1 0.0794 0.8241 0.972 0.000 0.028 0.000 0.000
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> SRR2082532 2 0.0777 0.953 0.000 0.972 0.000 0.024 0.004 0.000
#> SRR2082533 2 0.0777 0.953 0.000 0.972 0.000 0.024 0.004 0.000
#> SRR2082534 4 0.0000 1.000 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR2082535 4 0.0000 1.000 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR2082536 4 0.0000 1.000 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR2082530 2 0.0146 0.965 0.000 0.996 0.000 0.004 0.000 0.000
#> SRR2082531 2 0.0146 0.965 0.000 0.996 0.000 0.004 0.000 0.000
#> SRR2082528 4 0.0000 1.000 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR2082529 4 0.0000 1.000 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR2082526 2 0.0146 0.965 0.000 0.996 0.000 0.000 0.004 0.000
#> SRR2082527 2 0.0146 0.965 0.000 0.996 0.000 0.000 0.004 0.000
#> SRR2082521 2 0.3393 0.703 0.000 0.784 0.000 0.020 0.192 0.004
#> SRR2082520 5 0.0000 0.853 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR2082518 5 0.4546 0.505 0.000 0.356 0.000 0.020 0.608 0.016
#> SRR2082523 2 0.0000 0.965 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2082524 2 0.0000 0.965 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2082525 2 0.0146 0.965 0.000 0.996 0.000 0.000 0.004 0.000
#> SRR2082522 5 0.2454 0.766 0.000 0.000 0.000 0.160 0.840 0.000
#> SRR2082519 5 0.0146 0.853 0.000 0.000 0.000 0.000 0.996 0.004
#> SRR2082513 5 0.3166 0.809 0.000 0.156 0.000 0.004 0.816 0.024
#> SRR2082512 5 0.2362 0.829 0.000 0.136 0.000 0.000 0.860 0.004
#> SRR2082516 5 0.2454 0.766 0.000 0.000 0.000 0.160 0.840 0.000
#> SRR2082515 5 0.0146 0.853 0.000 0.000 0.000 0.000 0.996 0.004
#> SRR2082517 5 0.0000 0.853 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR2082514 5 0.2790 0.820 0.000 0.132 0.000 0.024 0.844 0.000
#> SRR2082508 1 0.0146 0.882 0.996 0.000 0.004 0.000 0.000 0.000
#> SRR2082509 3 0.3975 0.555 0.392 0.000 0.600 0.000 0.000 0.008
#> SRR2082507 1 0.0146 0.882 0.996 0.000 0.004 0.000 0.000 0.000
#> SRR2082510 6 0.0146 0.826 0.000 0.000 0.004 0.000 0.000 0.996
#> SRR2082511 3 0.3448 0.460 0.004 0.000 0.716 0.000 0.000 0.280
#> SRR2082501 3 0.4456 0.710 0.268 0.000 0.668 0.000 0.000 0.064
#> SRR2082502 3 0.4456 0.710 0.268 0.000 0.668 0.000 0.000 0.064
#> SRR2082499 3 0.4174 0.736 0.184 0.000 0.732 0.000 0.000 0.084
#> SRR2082500 3 0.4174 0.735 0.184 0.000 0.732 0.000 0.000 0.084
#> SRR2082503 3 0.2778 0.606 0.008 0.000 0.824 0.000 0.000 0.168
#> SRR2082505 1 0.1141 0.902 0.948 0.000 0.052 0.000 0.000 0.000
#> SRR2082506 1 0.0146 0.882 0.996 0.000 0.004 0.000 0.000 0.000
#> SRR2082504 1 0.1141 0.903 0.948 0.000 0.052 0.000 0.000 0.000
#> SRR2082495 3 0.2100 0.630 0.004 0.000 0.884 0.000 0.000 0.112
#> SRR2082496 3 0.2100 0.630 0.004 0.000 0.884 0.000 0.000 0.112
#> SRR2082493 6 0.3371 0.708 0.000 0.000 0.292 0.000 0.000 0.708
#> SRR2082494 6 0.3371 0.708 0.000 0.000 0.292 0.000 0.000 0.708
#> SRR2082491 3 0.2491 0.732 0.164 0.000 0.836 0.000 0.000 0.000
#> SRR2082492 3 0.2454 0.733 0.160 0.000 0.840 0.000 0.000 0.000
#> SRR2082489 1 0.3023 0.714 0.768 0.000 0.232 0.000 0.000 0.000
#> SRR2082490 1 0.3023 0.714 0.768 0.000 0.232 0.000 0.000 0.000
#> SRR2082497 1 0.1327 0.902 0.936 0.000 0.064 0.000 0.000 0.000
#> SRR2082498 1 0.1327 0.902 0.936 0.000 0.064 0.000 0.000 0.000
#> SRR2082487 3 0.3707 0.654 0.312 0.000 0.680 0.000 0.000 0.008
#> SRR2082488 3 0.3802 0.656 0.312 0.000 0.676 0.000 0.000 0.012
#> SRR2082485 3 0.2793 0.541 0.000 0.000 0.800 0.000 0.000 0.200
#> SRR2082486 3 0.2793 0.541 0.000 0.000 0.800 0.000 0.000 0.200
#> SRR2082479 3 0.3330 0.670 0.284 0.000 0.716 0.000 0.000 0.000
#> SRR2082480 3 0.3330 0.668 0.284 0.000 0.716 0.000 0.000 0.000
#> SRR2082483 6 0.0146 0.826 0.000 0.000 0.004 0.000 0.000 0.996
#> SRR2082484 6 0.0146 0.826 0.000 0.000 0.004 0.000 0.000 0.996
#> SRR2082481 1 0.2135 0.866 0.872 0.000 0.128 0.000 0.000 0.000
#> SRR2082482 1 0.2135 0.866 0.872 0.000 0.128 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 14581 rows and 58 columns.
#> Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'ATC' method.
#> Subgroups are detected by 'NMF' method.
#> Performed in total 1250 partitions by row resampling.
#> Best k for subgroups seems to be 3.
#>
#> Following methods can be applied to this 'ConsensusPartition' object:
#> [1] "cola_report" "collect_classes" "collect_plots"
#> [4] "collect_stats" "colnames" "compare_signatures"
#> [7] "consensus_heatmap" "dimension_reduction" "functional_enrichment"
#> [10] "get_anno_col" "get_anno" "get_classes"
#> [13] "get_consensus" "get_matrix" "get_membership"
#> [16] "get_param" "get_signatures" "get_stats"
#> [19] "is_best_k" "is_stable_k" "membership_heatmap"
#> [22] "ncol" "nrow" "plot_ecdf"
#> [25] "rownames" "select_partition_number" "show"
#> [28] "suggest_best_k" "test_to_known_factors"
collect_plots()
function collects all the plots made from res
for all k
(number of partitions)
into one single page to provide an easy and fast comparison between different k
.
collect_plots(res)
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.999 1.000 0.4997 0.501 0.501
#> 3 3 0.981 0.952 0.971 0.1385 0.946 0.891
#> 4 4 0.897 0.926 0.962 0.0708 0.946 0.880
#> 5 5 0.754 0.733 0.896 0.0624 0.984 0.961
#> 6 6 0.652 0.669 0.840 0.0594 1.000 1.000
suggest_best_k()
suggests the best \(k\) based on these statistics. The rules are as follows:
suggest_best_k(res)
#> [1] 3
#> attr(,"optional")
#> [1] 2
There is also optional best \(k\) = 2 that is worth to check.
Following shows the table of the partitions (You need to click the show/hide
code output link to see it). The membership matrix (columns with name p*
)
is inferred by
clue::cl_consensus()
function with the SE
method. Basically the value in the membership matrix
represents the probability to belong to a certain group. The finall class
label for an item is determined with the group with highest probability it
belongs to.
In get_classes()
function, the entropy is calculated from the membership
matrix and the silhouette score is calculated from the consensus matrix.
cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#> class entropy silhouette p1 p2
#> SRR2082532 2 0.000 1.000 0.00 1.00
#> SRR2082533 2 0.000 1.000 0.00 1.00
#> SRR2082534 2 0.000 1.000 0.00 1.00
#> SRR2082535 2 0.000 1.000 0.00 1.00
#> SRR2082536 2 0.000 1.000 0.00 1.00
#> SRR2082530 2 0.000 1.000 0.00 1.00
#> SRR2082531 2 0.000 1.000 0.00 1.00
#> SRR2082528 2 0.000 1.000 0.00 1.00
#> SRR2082529 2 0.000 1.000 0.00 1.00
#> SRR2082526 2 0.000 1.000 0.00 1.00
#> SRR2082527 2 0.000 1.000 0.00 1.00
#> SRR2082521 2 0.000 1.000 0.00 1.00
#> SRR2082520 2 0.000 1.000 0.00 1.00
#> SRR2082518 2 0.000 1.000 0.00 1.00
#> SRR2082523 2 0.000 1.000 0.00 1.00
#> SRR2082524 2 0.000 1.000 0.00 1.00
#> SRR2082525 2 0.000 1.000 0.00 1.00
#> SRR2082522 2 0.000 1.000 0.00 1.00
#> SRR2082519 2 0.000 1.000 0.00 1.00
#> SRR2082513 2 0.000 1.000 0.00 1.00
#> SRR2082512 2 0.000 1.000 0.00 1.00
#> SRR2082516 2 0.000 1.000 0.00 1.00
#> SRR2082515 2 0.000 1.000 0.00 1.00
#> SRR2082517 2 0.000 1.000 0.00 1.00
#> SRR2082514 2 0.000 1.000 0.00 1.00
#> SRR2082508 1 0.000 0.999 1.00 0.00
#> SRR2082509 1 0.000 0.999 1.00 0.00
#> SRR2082507 1 0.000 0.999 1.00 0.00
#> SRR2082510 1 0.141 0.980 0.98 0.02
#> SRR2082511 1 0.000 0.999 1.00 0.00
#> SRR2082501 1 0.000 0.999 1.00 0.00
#> SRR2082502 1 0.000 0.999 1.00 0.00
#> SRR2082499 1 0.000 0.999 1.00 0.00
#> SRR2082500 1 0.000 0.999 1.00 0.00
#> SRR2082503 1 0.000 0.999 1.00 0.00
#> SRR2082505 1 0.000 0.999 1.00 0.00
#> SRR2082506 1 0.000 0.999 1.00 0.00
#> SRR2082504 1 0.000 0.999 1.00 0.00
#> SRR2082495 1 0.000 0.999 1.00 0.00
#> SRR2082496 1 0.000 0.999 1.00 0.00
#> SRR2082493 1 0.000 0.999 1.00 0.00
#> SRR2082494 1 0.000 0.999 1.00 0.00
#> SRR2082491 1 0.000 0.999 1.00 0.00
#> SRR2082492 1 0.000 0.999 1.00 0.00
#> SRR2082489 1 0.000 0.999 1.00 0.00
#> SRR2082490 1 0.000 0.999 1.00 0.00
#> SRR2082497 1 0.000 0.999 1.00 0.00
#> SRR2082498 1 0.000 0.999 1.00 0.00
#> SRR2082487 1 0.000 0.999 1.00 0.00
#> SRR2082488 1 0.000 0.999 1.00 0.00
#> SRR2082485 1 0.000 0.999 1.00 0.00
#> SRR2082486 1 0.000 0.999 1.00 0.00
#> SRR2082479 1 0.000 0.999 1.00 0.00
#> SRR2082480 1 0.000 0.999 1.00 0.00
#> SRR2082483 1 0.000 0.999 1.00 0.00
#> SRR2082484 1 0.000 0.999 1.00 0.00
#> SRR2082481 1 0.000 0.999 1.00 0.00
#> SRR2082482 1 0.000 0.999 1.00 0.00
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> SRR2082532 2 0.0237 0.968 0.000 0.996 0.004
#> SRR2082533 2 0.0237 0.968 0.000 0.996 0.004
#> SRR2082534 2 0.0747 0.965 0.000 0.984 0.016
#> SRR2082535 2 0.0747 0.965 0.000 0.984 0.016
#> SRR2082536 2 0.0747 0.965 0.000 0.984 0.016
#> SRR2082530 2 0.2165 0.946 0.000 0.936 0.064
#> SRR2082531 2 0.2165 0.946 0.000 0.936 0.064
#> SRR2082528 2 0.0747 0.965 0.000 0.984 0.016
#> SRR2082529 2 0.0747 0.965 0.000 0.984 0.016
#> SRR2082526 2 0.2356 0.942 0.000 0.928 0.072
#> SRR2082527 2 0.2261 0.944 0.000 0.932 0.068
#> SRR2082521 2 0.0237 0.968 0.000 0.996 0.004
#> SRR2082520 2 0.0747 0.965 0.000 0.984 0.016
#> SRR2082518 2 0.2356 0.942 0.000 0.928 0.072
#> SRR2082523 2 0.0000 0.968 0.000 1.000 0.000
#> SRR2082524 2 0.0000 0.968 0.000 1.000 0.000
#> SRR2082525 2 0.2261 0.944 0.000 0.932 0.068
#> SRR2082522 2 0.0747 0.965 0.000 0.984 0.016
#> SRR2082519 2 0.0592 0.966 0.000 0.988 0.012
#> SRR2082513 2 0.2625 0.934 0.000 0.916 0.084
#> SRR2082512 2 0.3482 0.894 0.000 0.872 0.128
#> SRR2082516 2 0.0747 0.965 0.000 0.984 0.016
#> SRR2082515 2 0.0424 0.967 0.000 0.992 0.008
#> SRR2082517 2 0.0592 0.967 0.000 0.988 0.012
#> SRR2082514 2 0.0237 0.968 0.000 0.996 0.004
#> SRR2082508 1 0.0000 0.974 1.000 0.000 0.000
#> SRR2082509 1 0.0000 0.974 1.000 0.000 0.000
#> SRR2082507 1 0.0000 0.974 1.000 0.000 0.000
#> SRR2082510 3 0.1774 0.973 0.024 0.016 0.960
#> SRR2082511 1 0.5968 0.433 0.636 0.000 0.364
#> SRR2082501 1 0.0000 0.974 1.000 0.000 0.000
#> SRR2082502 1 0.0000 0.974 1.000 0.000 0.000
#> SRR2082499 1 0.0000 0.974 1.000 0.000 0.000
#> SRR2082500 1 0.0000 0.974 1.000 0.000 0.000
#> SRR2082503 1 0.0000 0.974 1.000 0.000 0.000
#> SRR2082505 1 0.0000 0.974 1.000 0.000 0.000
#> SRR2082506 1 0.0000 0.974 1.000 0.000 0.000
#> SRR2082504 1 0.0000 0.974 1.000 0.000 0.000
#> SRR2082495 1 0.0000 0.974 1.000 0.000 0.000
#> SRR2082496 1 0.0000 0.974 1.000 0.000 0.000
#> SRR2082493 1 0.3752 0.831 0.856 0.000 0.144
#> SRR2082494 1 0.3752 0.831 0.856 0.000 0.144
#> SRR2082491 1 0.0000 0.974 1.000 0.000 0.000
#> SRR2082492 1 0.0000 0.974 1.000 0.000 0.000
#> SRR2082489 1 0.0000 0.974 1.000 0.000 0.000
#> SRR2082490 1 0.0000 0.974 1.000 0.000 0.000
#> SRR2082497 1 0.0000 0.974 1.000 0.000 0.000
#> SRR2082498 1 0.0000 0.974 1.000 0.000 0.000
#> SRR2082487 1 0.0000 0.974 1.000 0.000 0.000
#> SRR2082488 1 0.0000 0.974 1.000 0.000 0.000
#> SRR2082485 1 0.1289 0.949 0.968 0.000 0.032
#> SRR2082486 1 0.1289 0.949 0.968 0.000 0.032
#> SRR2082479 1 0.0000 0.974 1.000 0.000 0.000
#> SRR2082480 1 0.0000 0.974 1.000 0.000 0.000
#> SRR2082483 3 0.2492 0.983 0.048 0.016 0.936
#> SRR2082484 3 0.2383 0.985 0.044 0.016 0.940
#> SRR2082481 1 0.0000 0.974 1.000 0.000 0.000
#> SRR2082482 1 0.0000 0.974 1.000 0.000 0.000
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> SRR2082532 2 0.0000 0.985 0.000 1.000 0.000 0.000
#> SRR2082533 2 0.0000 0.985 0.000 1.000 0.000 0.000
#> SRR2082534 2 0.0188 0.985 0.000 0.996 0.000 0.004
#> SRR2082535 2 0.0188 0.985 0.000 0.996 0.000 0.004
#> SRR2082536 2 0.0188 0.985 0.000 0.996 0.000 0.004
#> SRR2082530 2 0.0188 0.984 0.000 0.996 0.000 0.004
#> SRR2082531 2 0.0188 0.984 0.000 0.996 0.000 0.004
#> SRR2082528 2 0.0188 0.985 0.000 0.996 0.000 0.004
#> SRR2082529 2 0.0188 0.985 0.000 0.996 0.000 0.004
#> SRR2082526 2 0.0336 0.983 0.000 0.992 0.000 0.008
#> SRR2082527 2 0.0336 0.983 0.000 0.992 0.000 0.008
#> SRR2082521 2 0.0000 0.985 0.000 1.000 0.000 0.000
#> SRR2082520 2 0.3764 0.783 0.000 0.784 0.000 0.216
#> SRR2082518 2 0.0336 0.983 0.000 0.992 0.000 0.008
#> SRR2082523 2 0.0000 0.985 0.000 1.000 0.000 0.000
#> SRR2082524 2 0.0000 0.985 0.000 1.000 0.000 0.000
#> SRR2082525 2 0.0336 0.983 0.000 0.992 0.000 0.008
#> SRR2082522 2 0.1940 0.931 0.000 0.924 0.000 0.076
#> SRR2082519 2 0.0188 0.985 0.000 0.996 0.000 0.004
#> SRR2082513 2 0.0188 0.984 0.000 0.996 0.000 0.004
#> SRR2082512 2 0.0336 0.983 0.000 0.992 0.000 0.008
#> SRR2082516 2 0.0707 0.976 0.000 0.980 0.000 0.020
#> SRR2082515 2 0.0817 0.973 0.000 0.976 0.000 0.024
#> SRR2082517 2 0.0188 0.985 0.000 0.996 0.000 0.004
#> SRR2082514 2 0.0000 0.985 0.000 1.000 0.000 0.000
#> SRR2082508 1 0.2216 0.876 0.908 0.000 0.000 0.092
#> SRR2082509 1 0.0000 0.946 1.000 0.000 0.000 0.000
#> SRR2082507 1 0.3172 0.805 0.840 0.000 0.000 0.160
#> SRR2082510 3 0.0376 0.883 0.004 0.000 0.992 0.004
#> SRR2082511 3 0.1716 0.878 0.064 0.000 0.936 0.000
#> SRR2082501 1 0.0000 0.946 1.000 0.000 0.000 0.000
#> SRR2082502 1 0.0000 0.946 1.000 0.000 0.000 0.000
#> SRR2082499 1 0.0592 0.938 0.984 0.000 0.016 0.000
#> SRR2082500 1 0.0469 0.940 0.988 0.000 0.012 0.000
#> SRR2082503 1 0.4539 0.623 0.720 0.000 0.272 0.008
#> SRR2082505 1 0.0000 0.946 1.000 0.000 0.000 0.000
#> SRR2082506 1 0.0188 0.944 0.996 0.000 0.000 0.004
#> SRR2082504 1 0.0000 0.946 1.000 0.000 0.000 0.000
#> SRR2082495 1 0.2647 0.849 0.880 0.000 0.120 0.000
#> SRR2082496 1 0.2760 0.841 0.872 0.000 0.128 0.000
#> SRR2082493 3 0.3837 0.764 0.224 0.000 0.776 0.000
#> SRR2082494 3 0.4040 0.729 0.248 0.000 0.752 0.000
#> SRR2082491 1 0.0000 0.946 1.000 0.000 0.000 0.000
#> SRR2082492 1 0.0000 0.946 1.000 0.000 0.000 0.000
#> SRR2082489 1 0.0000 0.946 1.000 0.000 0.000 0.000
#> SRR2082490 1 0.0000 0.946 1.000 0.000 0.000 0.000
#> SRR2082497 1 0.0000 0.946 1.000 0.000 0.000 0.000
#> SRR2082498 1 0.0000 0.946 1.000 0.000 0.000 0.000
#> SRR2082487 1 0.0000 0.946 1.000 0.000 0.000 0.000
#> SRR2082488 1 0.0000 0.946 1.000 0.000 0.000 0.000
#> SRR2082485 1 0.3444 0.771 0.816 0.000 0.184 0.000
#> SRR2082486 1 0.4072 0.665 0.748 0.000 0.252 0.000
#> SRR2082479 1 0.0000 0.946 1.000 0.000 0.000 0.000
#> SRR2082480 1 0.0000 0.946 1.000 0.000 0.000 0.000
#> SRR2082483 3 0.0336 0.885 0.008 0.000 0.992 0.000
#> SRR2082484 3 0.0336 0.885 0.008 0.000 0.992 0.000
#> SRR2082481 1 0.0000 0.946 1.000 0.000 0.000 0.000
#> SRR2082482 1 0.0000 0.946 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
#> SRR2082532 2 0.0609 0.9425 0.000 0.980 0.000 0.000 NA
#> SRR2082533 2 0.0609 0.9425 0.000 0.980 0.000 0.000 NA
#> SRR2082534 2 0.0609 0.9414 0.000 0.980 0.000 0.000 NA
#> SRR2082535 2 0.0609 0.9414 0.000 0.980 0.000 0.000 NA
#> SRR2082536 2 0.0703 0.9409 0.000 0.976 0.000 0.000 NA
#> SRR2082530 2 0.0865 0.9414 0.000 0.972 0.000 0.004 NA
#> SRR2082531 2 0.0865 0.9414 0.000 0.972 0.000 0.004 NA
#> SRR2082528 2 0.0703 0.9409 0.000 0.976 0.000 0.000 NA
#> SRR2082529 2 0.0703 0.9409 0.000 0.976 0.000 0.000 NA
#> SRR2082526 2 0.2813 0.8729 0.000 0.832 0.000 0.000 NA
#> SRR2082527 2 0.2813 0.8729 0.000 0.832 0.000 0.000 NA
#> SRR2082521 2 0.0609 0.9426 0.000 0.980 0.000 0.000 NA
#> SRR2082520 2 0.3437 0.8651 0.000 0.832 0.000 0.120 NA
#> SRR2082518 2 0.2966 0.8629 0.000 0.816 0.000 0.000 NA
#> SRR2082523 2 0.0510 0.9427 0.000 0.984 0.000 0.000 NA
#> SRR2082524 2 0.0510 0.9427 0.000 0.984 0.000 0.000 NA
#> SRR2082525 2 0.2813 0.8729 0.000 0.832 0.000 0.000 NA
#> SRR2082522 2 0.2153 0.9223 0.000 0.916 0.000 0.040 NA
#> SRR2082519 2 0.1043 0.9419 0.000 0.960 0.000 0.000 NA
#> SRR2082513 2 0.1282 0.9393 0.000 0.952 0.000 0.004 NA
#> SRR2082512 2 0.4054 0.8046 0.000 0.748 0.028 0.000 NA
#> SRR2082516 2 0.1205 0.9358 0.000 0.956 0.000 0.004 NA
#> SRR2082515 2 0.2171 0.9281 0.000 0.912 0.000 0.024 NA
#> SRR2082517 2 0.1952 0.9252 0.000 0.912 0.000 0.004 NA
#> SRR2082514 2 0.0703 0.9437 0.000 0.976 0.000 0.000 NA
#> SRR2082508 1 0.4060 -0.5160 0.640 0.000 0.000 0.360 NA
#> SRR2082509 1 0.0404 0.7656 0.988 0.000 0.000 0.012 NA
#> SRR2082507 4 0.4304 0.0000 0.484 0.000 0.000 0.516 NA
#> SRR2082510 3 0.0693 0.7892 0.012 0.000 0.980 0.008 NA
#> SRR2082511 3 0.2304 0.7720 0.100 0.000 0.892 0.008 NA
#> SRR2082501 1 0.1764 0.7451 0.940 0.000 0.012 0.036 NA
#> SRR2082502 1 0.1731 0.7437 0.940 0.000 0.008 0.040 NA
#> SRR2082499 1 0.3715 0.6441 0.840 0.000 0.088 0.044 NA
#> SRR2082500 1 0.3164 0.6820 0.868 0.000 0.076 0.044 NA
#> SRR2082503 1 0.5973 -0.1472 0.560 0.000 0.320 0.116 NA
#> SRR2082505 1 0.1638 0.7178 0.932 0.000 0.004 0.064 NA
#> SRR2082506 1 0.2891 0.4288 0.824 0.000 0.000 0.176 NA
#> SRR2082504 1 0.1270 0.7326 0.948 0.000 0.000 0.052 NA
#> SRR2082495 1 0.3398 0.4860 0.780 0.000 0.216 0.004 NA
#> SRR2082496 1 0.3461 0.4713 0.772 0.000 0.224 0.004 NA
#> SRR2082493 3 0.4134 0.5932 0.264 0.000 0.720 0.008 NA
#> SRR2082494 3 0.4265 0.5826 0.268 0.000 0.712 0.008 NA
#> SRR2082491 1 0.0880 0.7592 0.968 0.000 0.032 0.000 NA
#> SRR2082492 1 0.0794 0.7618 0.972 0.000 0.028 0.000 NA
#> SRR2082489 1 0.0000 0.7708 1.000 0.000 0.000 0.000 NA
#> SRR2082490 1 0.0000 0.7708 1.000 0.000 0.000 0.000 NA
#> SRR2082497 1 0.1173 0.7587 0.964 0.000 0.004 0.020 NA
#> SRR2082498 1 0.1267 0.7577 0.960 0.000 0.004 0.024 NA
#> SRR2082487 1 0.0162 0.7710 0.996 0.000 0.004 0.000 NA
#> SRR2082488 1 0.0162 0.7710 0.996 0.000 0.004 0.000 NA
#> SRR2082485 1 0.4060 0.1538 0.640 0.000 0.360 0.000 NA
#> SRR2082486 1 0.4150 0.0984 0.612 0.000 0.388 0.000 NA
#> SRR2082479 1 0.0000 0.7708 1.000 0.000 0.000 0.000 NA
#> SRR2082480 1 0.0000 0.7708 1.000 0.000 0.000 0.000 NA
#> SRR2082483 3 0.1329 0.7862 0.008 0.000 0.956 0.004 NA
#> SRR2082484 3 0.1202 0.7826 0.004 0.000 0.960 0.004 NA
#> SRR2082481 1 0.0000 0.7708 1.000 0.000 0.000 0.000 NA
#> SRR2082482 1 0.0000 0.7708 1.000 0.000 0.000 0.000 NA
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> SRR2082532 2 0.0820 0.9044 0.000 0.972 0.000 NA NA 0.012
#> SRR2082533 2 0.0725 0.9046 0.000 0.976 0.000 NA NA 0.012
#> SRR2082534 2 0.0972 0.9022 0.000 0.964 0.000 NA NA 0.008
#> SRR2082535 2 0.0972 0.9022 0.000 0.964 0.000 NA NA 0.008
#> SRR2082536 2 0.1333 0.8986 0.000 0.944 0.000 NA NA 0.008
#> SRR2082530 2 0.1461 0.9033 0.000 0.940 0.000 NA NA 0.044
#> SRR2082531 2 0.1461 0.9033 0.000 0.940 0.000 NA NA 0.044
#> SRR2082528 2 0.1333 0.8986 0.000 0.944 0.000 NA NA 0.008
#> SRR2082529 2 0.1219 0.8978 0.000 0.948 0.000 NA NA 0.004
#> SRR2082526 2 0.3215 0.8176 0.000 0.756 0.000 NA NA 0.240
#> SRR2082527 2 0.3215 0.8176 0.000 0.756 0.000 NA NA 0.240
#> SRR2082521 2 0.1594 0.9016 0.000 0.932 0.000 NA NA 0.052
#> SRR2082520 2 0.4732 0.7849 0.000 0.728 0.000 NA NA 0.072
#> SRR2082518 2 0.3758 0.7817 0.000 0.700 0.000 NA NA 0.284
#> SRR2082523 2 0.0717 0.9048 0.000 0.976 0.000 NA NA 0.016
#> SRR2082524 2 0.0717 0.9048 0.000 0.976 0.000 NA NA 0.016
#> SRR2082525 2 0.3240 0.8146 0.000 0.752 0.000 NA NA 0.244
#> SRR2082522 2 0.2249 0.8971 0.000 0.900 0.000 NA NA 0.032
#> SRR2082519 2 0.2821 0.8898 0.000 0.860 0.000 NA NA 0.096
#> SRR2082513 2 0.2478 0.8960 0.000 0.888 0.000 NA NA 0.076
#> SRR2082512 2 0.4829 0.7124 0.000 0.624 0.020 NA NA 0.316
#> SRR2082516 2 0.1765 0.9004 0.000 0.924 0.000 NA NA 0.024
#> SRR2082515 2 0.3352 0.8801 0.000 0.836 0.004 NA NA 0.108
#> SRR2082517 2 0.2700 0.8751 0.000 0.836 0.004 NA NA 0.156
#> SRR2082514 2 0.1957 0.9021 0.000 0.920 0.000 NA NA 0.048
#> SRR2082508 1 0.6101 -0.7163 0.440 0.000 0.000 NA NA 0.388
#> SRR2082509 1 0.1010 0.6931 0.960 0.000 0.000 NA NA 0.004
#> SRR2082507 6 0.6581 0.0000 0.308 0.000 0.000 NA NA 0.468
#> SRR2082510 3 0.0858 0.7576 0.000 0.000 0.968 NA NA 0.000
#> SRR2082511 3 0.2144 0.7481 0.048 0.000 0.908 NA NA 0.004
#> SRR2082501 1 0.3071 0.6275 0.804 0.000 0.016 NA NA 0.000
#> SRR2082502 1 0.3046 0.6216 0.800 0.000 0.012 NA NA 0.000
#> SRR2082499 1 0.4478 0.5219 0.680 0.000 0.076 NA NA 0.000
#> SRR2082500 1 0.4223 0.5438 0.704 0.000 0.060 NA NA 0.000
#> SRR2082503 1 0.7164 -0.2371 0.428 0.000 0.268 NA NA 0.124
#> SRR2082505 1 0.3611 0.5410 0.796 0.000 0.000 NA NA 0.108
#> SRR2082506 1 0.4927 0.0837 0.648 0.000 0.000 NA NA 0.244
#> SRR2082504 1 0.3221 0.5791 0.828 0.000 0.000 NA NA 0.096
#> SRR2082495 1 0.4237 0.5026 0.704 0.000 0.244 NA NA 0.000
#> SRR2082496 1 0.4226 0.4796 0.692 0.000 0.264 NA NA 0.000
#> SRR2082493 3 0.4791 0.5231 0.268 0.000 0.656 NA NA 0.000
#> SRR2082494 3 0.4830 0.5095 0.276 0.000 0.648 NA NA 0.000
#> SRR2082491 1 0.2492 0.6790 0.888 0.000 0.068 NA NA 0.000
#> SRR2082492 1 0.2492 0.6782 0.888 0.000 0.068 NA NA 0.000
#> SRR2082489 1 0.0260 0.7075 0.992 0.000 0.008 NA NA 0.000
#> SRR2082490 1 0.0260 0.7075 0.992 0.000 0.008 NA NA 0.000
#> SRR2082497 1 0.2416 0.6490 0.844 0.000 0.000 NA NA 0.000
#> SRR2082498 1 0.2340 0.6535 0.852 0.000 0.000 NA NA 0.000
#> SRR2082487 1 0.0363 0.7083 0.988 0.000 0.012 NA NA 0.000
#> SRR2082488 1 0.0363 0.7083 0.988 0.000 0.012 NA NA 0.000
#> SRR2082485 1 0.4123 0.2122 0.568 0.000 0.420 NA NA 0.000
#> SRR2082486 1 0.4152 0.1512 0.548 0.000 0.440 NA NA 0.000
#> SRR2082479 1 0.0520 0.7075 0.984 0.000 0.008 NA NA 0.000
#> SRR2082480 1 0.0520 0.7075 0.984 0.000 0.008 NA NA 0.000
#> SRR2082483 3 0.0870 0.7606 0.004 0.000 0.972 NA NA 0.012
#> SRR2082484 3 0.0767 0.7610 0.004 0.000 0.976 NA NA 0.008
#> SRR2082481 1 0.0520 0.7075 0.984 0.000 0.008 NA NA 0.000
#> SRR2082482 1 0.0520 0.7075 0.984 0.000 0.008 NA NA 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