Date: 2019-12-26 01:21:05 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 18096 rows and 52 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] 18096 52
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 | 3 | 1.000 | 0.955 | 0.955 | ** | |
SD:skmeans | 3 | 1.000 | 0.990 | 0.995 | ** | 2 |
SD:mclust | 2 | 1.000 | 0.989 | 0.995 | ** | |
SD:NMF | 3 | 1.000 | 0.989 | 0.995 | ** | |
CV:hclust | 4 | 1.000 | 0.981 | 0.989 | ** | |
CV:kmeans | 2 | 1.000 | 0.983 | 0.982 | ** | |
CV:pam | 2 | 1.000 | 0.981 | 0.992 | ** | |
CV:mclust | 2 | 1.000 | 0.973 | 0.988 | ** | |
MAD:kmeans | 3 | 1.000 | 0.995 | 0.996 | ** | |
MAD:skmeans | 3 | 1.000 | 0.985 | 0.993 | ** | 2 |
MAD:pam | 3 | 1.000 | 0.956 | 0.981 | ** | 2 |
MAD:NMF | 3 | 1.000 | 0.995 | 0.997 | ** | 2 |
ATC:kmeans | 3 | 1.000 | 0.977 | 0.988 | ** | 2 |
ATC:skmeans | 3 | 1.000 | 0.963 | 0.983 | ** | 2 |
ATC:mclust | 2 | 1.000 | 1.000 | 1.000 | ** | |
ATC:NMF | 3 | 1.000 | 0.949 | 0.980 | ** | 2 |
SD:pam | 3 | 0.976 | 0.929 | 0.971 | ** | 2 |
ATC:pam | 6 | 0.969 | 0.930 | 0.965 | ** | 2,3,5 |
CV:NMF | 2 | 0.959 | 0.945 | 0.978 | ** | |
MAD:mclust | 3 | 0.957 | 0.940 | 0.968 | ** | 2 |
CV:skmeans | 2 | 0.919 | 0.918 | 0.966 | * | |
MAD:hclust | 3 | 0.850 | 0.920 | 0.956 | ||
SD:hclust | 4 | 0.744 | 0.858 | 0.919 | ||
ATC:hclust | 2 | 0.694 | 0.930 | 0.957 |
**: 1-PAC > 0.95, *: 1-PAC > 0.9
Cumulative distribution function curves of consensus matrix for all methods.
collect_plots(res_list, fun = plot_ecdf)
Consensus heatmaps for all methods. (What is a consensus heatmap?)
collect_plots(res_list, k = 2, fun = consensus_heatmap, mc.cores = 4)
collect_plots(res_list, k = 3, fun = consensus_heatmap, mc.cores = 4)
collect_plots(res_list, k = 4, fun = consensus_heatmap, mc.cores = 4)
collect_plots(res_list, k = 5, fun = consensus_heatmap, mc.cores = 4)
collect_plots(res_list, k = 6, fun = consensus_heatmap, mc.cores = 4)
Membership heatmaps for all methods. (What is a membership heatmap?)
collect_plots(res_list, k = 2, fun = membership_heatmap, mc.cores = 4)
collect_plots(res_list, k = 3, fun = membership_heatmap, mc.cores = 4)
collect_plots(res_list, k = 4, fun = membership_heatmap, mc.cores = 4)
collect_plots(res_list, k = 5, fun = membership_heatmap, mc.cores = 4)
collect_plots(res_list, k = 6, fun = membership_heatmap, mc.cores = 4)
Signature heatmaps for all methods. (What is a signature heatmap?)
Note in following heatmaps, rows are scaled.
collect_plots(res_list, k = 2, fun = get_signatures, mc.cores = 4)
collect_plots(res_list, k = 3, fun = get_signatures, mc.cores = 4)
collect_plots(res_list, k = 4, fun = get_signatures, mc.cores = 4)
collect_plots(res_list, k = 5, fun = get_signatures, mc.cores = 4)
collect_plots(res_list, k = 6, fun = get_signatures, mc.cores = 4)
The statistics used for measuring the stability of consensus partitioning. (How are they defined?)
get_stats(res_list, k = 2)
#> k 1-PAC mean_silhouette concordance area_increased Rand Jaccard
#> SD:NMF 2 0.881 0.890 0.960 0.467 0.538 0.538
#> CV:NMF 2 0.959 0.945 0.978 0.475 0.527 0.527
#> MAD:NMF 2 0.959 0.937 0.975 0.505 0.493 0.493
#> ATC:NMF 2 1.000 0.986 0.994 0.508 0.493 0.493
#> SD:skmeans 2 1.000 0.934 0.975 0.504 0.493 0.493
#> CV:skmeans 2 0.919 0.918 0.966 0.491 0.497 0.497
#> MAD:skmeans 2 0.959 0.941 0.975 0.508 0.491 0.491
#> ATC:skmeans 2 1.000 0.974 0.990 0.510 0.490 0.490
#> SD:mclust 2 1.000 0.989 0.995 0.406 0.599 0.599
#> CV:mclust 2 1.000 0.973 0.988 0.463 0.538 0.538
#> MAD:mclust 2 1.000 0.997 0.998 0.403 0.599 0.599
#> ATC:mclust 2 1.000 1.000 1.000 0.435 0.566 0.566
#> SD:kmeans 2 0.802 0.955 0.975 0.433 0.581 0.581
#> CV:kmeans 2 1.000 0.983 0.982 0.430 0.551 0.551
#> MAD:kmeans 2 0.682 0.834 0.931 0.486 0.497 0.497
#> ATC:kmeans 2 1.000 0.987 0.995 0.508 0.493 0.493
#> SD:pam 2 1.000 0.977 0.992 0.412 0.581 0.581
#> CV:pam 2 1.000 0.981 0.992 0.443 0.551 0.551
#> MAD:pam 2 1.000 0.976 0.990 0.427 0.581 0.581
#> ATC:pam 2 1.000 0.979 0.991 0.463 0.538 0.538
#> SD:hclust 2 0.503 0.633 0.781 0.433 0.527 0.527
#> CV:hclust 2 0.735 0.961 0.969 0.146 0.855 0.855
#> MAD:hclust 2 0.813 0.911 0.956 0.484 0.517 0.517
#> ATC:hclust 2 0.694 0.930 0.957 0.497 0.493 0.493
get_stats(res_list, k = 3)
#> k 1-PAC mean_silhouette concordance area_increased Rand Jaccard
#> SD:NMF 3 1.000 0.989 0.995 0.429 0.722 0.517
#> CV:NMF 3 0.629 0.728 0.871 0.328 0.813 0.660
#> MAD:NMF 3 1.000 0.995 0.997 0.320 0.750 0.535
#> ATC:NMF 3 1.000 0.949 0.980 0.321 0.728 0.503
#> SD:skmeans 3 1.000 0.990 0.995 0.323 0.750 0.535
#> CV:skmeans 3 0.876 0.886 0.955 0.338 0.792 0.603
#> MAD:skmeans 3 1.000 0.985 0.993 0.312 0.784 0.584
#> ATC:skmeans 3 1.000 0.963 0.983 0.263 0.845 0.690
#> SD:mclust 3 0.697 0.846 0.917 0.539 0.755 0.591
#> CV:mclust 3 0.698 0.834 0.870 0.408 0.789 0.608
#> MAD:mclust 3 0.957 0.940 0.968 0.615 0.755 0.591
#> ATC:mclust 3 0.757 0.862 0.905 0.361 0.768 0.600
#> SD:kmeans 3 1.000 0.955 0.955 0.493 0.729 0.543
#> CV:kmeans 3 0.606 0.715 0.824 0.305 0.955 0.918
#> MAD:kmeans 3 1.000 0.995 0.996 0.371 0.741 0.525
#> ATC:kmeans 3 1.000 0.977 0.988 0.274 0.811 0.635
#> SD:pam 3 0.976 0.929 0.971 0.622 0.720 0.529
#> CV:pam 3 0.734 0.870 0.916 0.149 0.961 0.929
#> MAD:pam 3 1.000 0.956 0.981 0.569 0.720 0.529
#> ATC:pam 3 1.000 0.987 0.994 0.397 0.747 0.559
#> SD:hclust 3 0.519 0.608 0.835 0.330 0.913 0.834
#> CV:hclust 3 0.711 0.910 0.920 1.862 0.657 0.599
#> MAD:hclust 3 0.850 0.920 0.956 0.369 0.810 0.633
#> ATC:hclust 3 0.706 0.842 0.837 0.286 0.853 0.702
get_stats(res_list, k = 4)
#> k 1-PAC mean_silhouette concordance area_increased Rand Jaccard
#> SD:NMF 4 0.821 0.447 0.796 0.0905 0.916 0.760
#> CV:NMF 4 0.741 0.844 0.906 0.1342 0.804 0.545
#> MAD:NMF 4 0.872 0.922 0.918 0.1090 0.894 0.687
#> ATC:NMF 4 0.884 0.892 0.953 0.0528 0.972 0.916
#> SD:skmeans 4 0.819 0.874 0.912 0.1324 0.877 0.646
#> CV:skmeans 4 0.830 0.800 0.905 0.0829 0.941 0.830
#> MAD:skmeans 4 0.881 0.886 0.932 0.1329 0.894 0.687
#> ATC:skmeans 4 0.785 0.698 0.824 0.1133 0.964 0.898
#> SD:mclust 4 0.736 0.836 0.919 0.1198 0.916 0.771
#> CV:mclust 4 0.613 0.584 0.831 0.0867 0.880 0.667
#> MAD:mclust 4 0.669 0.659 0.851 0.0975 0.962 0.896
#> ATC:mclust 4 0.657 0.623 0.765 0.1442 0.913 0.784
#> SD:kmeans 4 0.793 0.789 0.823 0.1231 0.972 0.920
#> CV:kmeans 4 0.677 0.828 0.859 0.1960 0.780 0.572
#> MAD:kmeans 4 0.774 0.739 0.780 0.1014 0.916 0.747
#> ATC:kmeans 4 0.786 0.512 0.732 0.1136 0.905 0.731
#> SD:pam 4 0.698 0.605 0.774 0.0949 0.898 0.715
#> CV:pam 4 0.672 0.528 0.679 0.3436 0.965 0.934
#> MAD:pam 4 0.764 0.588 0.791 0.1174 0.821 0.518
#> ATC:pam 4 0.829 0.887 0.879 0.0930 0.968 0.910
#> SD:hclust 4 0.744 0.858 0.919 0.1673 0.839 0.645
#> CV:hclust 4 1.000 0.981 0.989 0.2448 0.973 0.947
#> MAD:hclust 4 0.818 0.886 0.926 0.0491 0.982 0.945
#> ATC:hclust 4 0.814 0.896 0.915 0.0793 0.968 0.908
get_stats(res_list, k = 5)
#> k 1-PAC mean_silhouette concordance area_increased Rand Jaccard
#> SD:NMF 5 0.851 0.867 0.906 0.0692 0.838 0.503
#> CV:NMF 5 0.824 0.830 0.912 0.0543 0.976 0.914
#> MAD:NMF 5 0.873 0.875 0.920 0.0596 0.962 0.845
#> ATC:NMF 5 0.889 0.848 0.941 0.0574 0.953 0.847
#> SD:skmeans 5 0.747 0.625 0.807 0.0547 0.992 0.968
#> CV:skmeans 5 0.730 0.712 0.774 0.0704 0.955 0.849
#> MAD:skmeans 5 0.790 0.789 0.874 0.0549 0.952 0.804
#> ATC:skmeans 5 0.728 0.729 0.808 0.0726 0.863 0.587
#> SD:mclust 5 0.763 0.740 0.876 0.1190 0.889 0.639
#> CV:mclust 5 0.713 0.782 0.858 0.0583 0.927 0.756
#> MAD:mclust 5 0.713 0.765 0.880 0.0890 0.856 0.594
#> ATC:mclust 5 0.770 0.814 0.902 0.1605 0.795 0.467
#> SD:kmeans 5 0.723 0.721 0.809 0.0689 0.854 0.577
#> CV:kmeans 5 0.717 0.761 0.819 0.1062 0.976 0.921
#> MAD:kmeans 5 0.736 0.678 0.799 0.0647 0.901 0.648
#> ATC:kmeans 5 0.712 0.689 0.810 0.0774 0.882 0.616
#> SD:pam 5 0.741 0.641 0.802 0.0609 0.905 0.693
#> CV:pam 5 0.702 0.756 0.813 0.0758 0.744 0.525
#> MAD:pam 5 0.760 0.718 0.807 0.0574 0.891 0.602
#> ATC:pam 5 0.997 0.953 0.978 0.0958 0.905 0.705
#> SD:hclust 5 0.692 0.820 0.898 0.0280 0.985 0.951
#> CV:hclust 5 0.764 0.823 0.878 0.1417 0.998 0.995
#> MAD:hclust 5 0.783 0.803 0.843 0.0927 0.925 0.759
#> ATC:hclust 5 0.756 0.812 0.873 0.0686 0.980 0.938
get_stats(res_list, k = 6)
#> k 1-PAC mean_silhouette concordance area_increased Rand Jaccard
#> SD:NMF 6 0.802 0.678 0.832 0.0505 0.920 0.649
#> CV:NMF 6 0.827 0.785 0.889 0.0557 0.911 0.676
#> MAD:NMF 6 0.818 0.669 0.843 0.0427 0.958 0.804
#> ATC:NMF 6 0.751 0.713 0.857 0.0410 0.974 0.901
#> SD:skmeans 6 0.770 0.643 0.765 0.0412 0.879 0.525
#> CV:skmeans 6 0.712 0.707 0.795 0.0556 0.924 0.723
#> MAD:skmeans 6 0.800 0.667 0.810 0.0381 0.981 0.907
#> ATC:skmeans 6 0.752 0.620 0.781 0.0434 0.942 0.742
#> SD:mclust 6 0.861 0.771 0.890 0.0667 0.941 0.721
#> CV:mclust 6 0.639 0.537 0.734 0.0468 0.888 0.592
#> MAD:mclust 6 0.838 0.842 0.892 0.0729 0.912 0.636
#> ATC:mclust 6 0.745 0.711 0.821 0.0180 0.932 0.699
#> SD:kmeans 6 0.690 0.648 0.765 0.0473 0.928 0.687
#> CV:kmeans 6 0.713 0.739 0.800 0.0734 0.866 0.552
#> MAD:kmeans 6 0.707 0.611 0.750 0.0431 0.934 0.712
#> ATC:kmeans 6 0.754 0.710 0.752 0.0399 0.909 0.655
#> SD:pam 6 0.747 0.554 0.716 0.0492 0.931 0.713
#> CV:pam 6 0.831 0.876 0.880 0.0835 0.862 0.547
#> MAD:pam 6 0.821 0.733 0.833 0.0517 0.942 0.726
#> ATC:pam 6 0.969 0.930 0.965 0.0621 0.928 0.698
#> SD:hclust 6 0.704 0.566 0.827 0.0698 0.986 0.954
#> CV:hclust 6 0.741 0.787 0.864 0.0322 0.997 0.994
#> MAD:hclust 6 0.741 0.718 0.822 0.0359 0.962 0.841
#> ATC:hclust 6 0.854 0.867 0.906 0.0823 0.893 0.639
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 18096 rows and 52 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 4.
#>
#> Following methods can be applied to this 'ConsensusPartition' object:
#> [1] "cola_report" "collect_classes" "collect_plots"
#> [4] "collect_stats" "colnames" "compare_signatures"
#> [7] "consensus_heatmap" "dimension_reduction" "functional_enrichment"
#> [10] "get_anno_col" "get_anno" "get_classes"
#> [13] "get_consensus" "get_matrix" "get_membership"
#> [16] "get_param" "get_signatures" "get_stats"
#> [19] "is_best_k" "is_stable_k" "membership_heatmap"
#> [22] "ncol" "nrow" "plot_ecdf"
#> [25] "rownames" "select_partition_number" "show"
#> [28] "suggest_best_k" "test_to_known_factors"
collect_plots()
function collects all the plots made from res
for all k
(number of partitions)
into one single page to provide an easy and fast comparison between different k
.
collect_plots(res)
The plots are:
k
and the heatmap of
predicted classes for each k
.k
.k
.k
.All the plots in panels can be made by individual functions and they are plotted later in this section.
select_partition_number()
produces several plots showing different
statistics for choosing “optimized” k
. There are following statistics:
k
;k
, the area increased is defined as \(A_k - A_{k-1}\).The detailed explanations of these statistics can be found in the cola vignette.
Generally speaking, lower PAC score, higher mean silhouette score or higher
concordance corresponds to better partition. Rand index and Jaccard index
measure how similar the current partition is compared to partition with k-1
.
If they are too similar, we won't accept k
is better than k-1
.
select_partition_number(res)
The numeric values for all these statistics can be obtained by get_stats()
.
get_stats(res)
#> k 1-PAC mean_silhouette concordance area_increased Rand Jaccard
#> 2 2 0.503 0.633 0.781 0.4329 0.527 0.527
#> 3 3 0.519 0.608 0.835 0.3300 0.913 0.834
#> 4 4 0.744 0.858 0.919 0.1673 0.839 0.645
#> 5 5 0.692 0.820 0.898 0.0280 0.985 0.951
#> 6 6 0.704 0.566 0.827 0.0698 0.986 0.954
suggest_best_k()
suggests the best \(k\) based on these statistics. The rules are as follows:
suggest_best_k(res)
#> [1] 4
Following shows the table of the partitions (You need to click the show/hide
code output link to see it). The membership matrix (columns with name p*
)
is inferred by
clue::cl_consensus()
function with the SE
method. Basically the value in the membership matrix
represents the probability to belong to a certain group. The finall class
label for an item is determined with the group with highest probability it
belongs to.
In get_classes()
function, the entropy is calculated from the membership
matrix and the silhouette score is calculated from the consensus matrix.
cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#> class entropy silhouette p1 p2
#> SRR2926066 1 0.0376 0.4795 0.996 0.004
#> SRR2926067 1 0.6623 0.1367 0.828 0.172
#> SRR2926063 1 0.0376 0.4795 0.996 0.004
#> SRR2926064 2 0.9988 1.0000 0.480 0.520
#> SRR2926062 2 0.9988 1.0000 0.480 0.520
#> SRR2926061 1 0.5842 0.2469 0.860 0.140
#> SRR2926065 2 0.9988 1.0000 0.480 0.520
#> SRR2926060 2 0.9988 1.0000 0.480 0.520
#> SRR2926059 1 0.5842 0.2469 0.860 0.140
#> SRR2926058 1 0.5737 0.2581 0.864 0.136
#> SRR2926056 1 0.0672 0.4821 0.992 0.008
#> SRR2926057 1 0.5737 0.2581 0.864 0.136
#> SRR2926055 1 0.6712 0.1207 0.824 0.176
#> SRR2926054 1 0.4690 0.3312 0.900 0.100
#> SRR2926051 1 0.0376 0.4795 0.996 0.004
#> SRR2926052 1 0.2948 0.4105 0.948 0.052
#> SRR2926053 1 0.5737 0.2581 0.864 0.136
#> SRR2926050 1 0.1633 0.4482 0.976 0.024
#> SRR2926049 2 0.9988 1.0000 0.480 0.520
#> SRR2926047 2 0.9988 1.0000 0.480 0.520
#> SRR2926046 1 0.0376 0.4795 0.996 0.004
#> SRR2926048 2 0.9988 1.0000 0.480 0.520
#> SRR2926044 1 0.8443 -0.3297 0.728 0.272
#> SRR2926045 1 0.5737 0.2581 0.864 0.136
#> SRR2926041 2 0.9988 1.0000 0.480 0.520
#> SRR2926042 2 0.9988 1.0000 0.480 0.520
#> SRR2926040 2 0.9988 1.0000 0.480 0.520
#> SRR2926039 2 0.9988 1.0000 0.480 0.520
#> SRR2926043 2 0.9988 1.0000 0.480 0.520
#> SRR2926038 2 0.9988 1.0000 0.480 0.520
#> SRR2926036 2 0.9988 1.0000 0.480 0.520
#> SRR2926037 2 0.9988 1.0000 0.480 0.520
#> SRR2926035 2 0.9988 1.0000 0.480 0.520
#> SRR2926034 2 0.9988 1.0000 0.480 0.520
#> SRR2926032 2 0.9988 1.0000 0.480 0.520
#> SRR2926031 1 0.9988 0.5818 0.520 0.480
#> SRR2926033 1 0.7139 0.0303 0.804 0.196
#> SRR2926030 1 0.9850 0.6055 0.572 0.428
#> SRR2926029 1 0.0672 0.4821 0.992 0.008
#> SRR2926027 1 0.9850 0.6055 0.572 0.428
#> SRR2926028 1 0.9988 0.5818 0.520 0.480
#> SRR2926026 1 0.9850 0.6055 0.572 0.428
#> SRR2926025 1 0.9988 0.5818 0.520 0.480
#> SRR2926023 1 0.9850 0.6055 0.572 0.428
#> SRR2926022 1 0.9850 0.6055 0.572 0.428
#> SRR2926024 1 0.9850 0.6055 0.572 0.428
#> SRR2926021 1 0.9988 0.5818 0.520 0.480
#> SRR2926020 1 0.9850 0.6055 0.572 0.428
#> SRR2926019 1 0.9850 0.6055 0.572 0.428
#> SRR2926018 1 0.9850 0.6055 0.572 0.428
#> SRR2926017 1 0.9963 0.5894 0.536 0.464
#> SRR2926016 2 0.9988 1.0000 0.480 0.520
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> SRR2926066 3 0.2356 0.5745 0.000 0.072 0.928
#> SRR2926067 3 0.5968 0.5044 0.000 0.364 0.636
#> SRR2926063 3 0.2356 0.5745 0.000 0.072 0.928
#> SRR2926064 2 0.0000 0.9997 0.000 1.000 0.000
#> SRR2926062 2 0.0000 0.9997 0.000 1.000 0.000
#> SRR2926061 3 0.5497 0.5528 0.000 0.292 0.708
#> SRR2926065 2 0.0000 0.9997 0.000 1.000 0.000
#> SRR2926060 2 0.0000 0.9997 0.000 1.000 0.000
#> SRR2926059 3 0.5291 0.5627 0.000 0.268 0.732
#> SRR2926058 3 0.4702 0.5798 0.000 0.212 0.788
#> SRR2926056 3 0.2261 0.5715 0.000 0.068 0.932
#> SRR2926057 3 0.4702 0.5798 0.000 0.212 0.788
#> SRR2926055 3 0.5988 0.5006 0.000 0.368 0.632
#> SRR2926054 3 0.4235 0.5836 0.000 0.176 0.824
#> SRR2926051 3 0.2356 0.5745 0.000 0.072 0.928
#> SRR2926052 3 0.3482 0.5838 0.000 0.128 0.872
#> SRR2926053 3 0.5650 0.5451 0.000 0.312 0.688
#> SRR2926050 3 0.2959 0.5828 0.000 0.100 0.900
#> SRR2926049 2 0.0000 0.9997 0.000 1.000 0.000
#> SRR2926047 2 0.0000 0.9997 0.000 1.000 0.000
#> SRR2926046 3 0.2356 0.5745 0.000 0.072 0.928
#> SRR2926048 2 0.0000 0.9997 0.000 1.000 0.000
#> SRR2926044 3 0.6168 0.4215 0.000 0.412 0.588
#> SRR2926045 3 0.5650 0.5451 0.000 0.312 0.688
#> SRR2926041 2 0.0000 0.9997 0.000 1.000 0.000
#> SRR2926042 2 0.0000 0.9997 0.000 1.000 0.000
#> SRR2926040 2 0.0000 0.9997 0.000 1.000 0.000
#> SRR2926039 2 0.0000 0.9997 0.000 1.000 0.000
#> SRR2926043 2 0.0000 0.9997 0.000 1.000 0.000
#> SRR2926038 2 0.0000 0.9997 0.000 1.000 0.000
#> SRR2926036 2 0.0000 0.9997 0.000 1.000 0.000
#> SRR2926037 2 0.0000 0.9997 0.000 1.000 0.000
#> SRR2926035 2 0.0000 0.9997 0.000 1.000 0.000
#> SRR2926034 2 0.0237 0.9946 0.000 0.996 0.004
#> SRR2926032 2 0.0000 0.9997 0.000 1.000 0.000
#> SRR2926031 1 0.0237 0.6074 0.996 0.000 0.004
#> SRR2926033 3 0.6140 0.4653 0.000 0.404 0.596
#> SRR2926030 3 0.6008 0.0416 0.372 0.000 0.628
#> SRR2926029 3 0.2261 0.5715 0.000 0.068 0.932
#> SRR2926027 3 0.6008 0.0416 0.372 0.000 0.628
#> SRR2926028 1 0.0892 0.6016 0.980 0.000 0.020
#> SRR2926026 3 0.6008 0.0416 0.372 0.000 0.628
#> SRR2926025 1 0.6062 0.3541 0.616 0.000 0.384
#> SRR2926023 3 0.6008 0.0416 0.372 0.000 0.628
#> SRR2926022 3 0.6008 0.0416 0.372 0.000 0.628
#> SRR2926024 3 0.6008 0.0416 0.372 0.000 0.628
#> SRR2926021 1 0.6079 0.3449 0.612 0.000 0.388
#> SRR2926020 3 0.6008 0.0416 0.372 0.000 0.628
#> SRR2926019 3 0.6008 0.0416 0.372 0.000 0.628
#> SRR2926018 3 0.6008 0.0416 0.372 0.000 0.628
#> SRR2926017 3 0.6168 -0.0977 0.412 0.000 0.588
#> SRR2926016 2 0.0000 0.9997 0.000 1.000 0.000
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> SRR2926066 3 0.0188 0.748 0.000 0.004 0.996 0.000
#> SRR2926067 3 0.4730 0.680 0.000 0.364 0.636 0.000
#> SRR2926063 3 0.0188 0.748 0.000 0.004 0.996 0.000
#> SRR2926064 2 0.0000 1.000 0.000 1.000 0.000 0.000
#> SRR2926062 2 0.0000 1.000 0.000 1.000 0.000 0.000
#> SRR2926061 3 0.4356 0.750 0.000 0.292 0.708 0.000
#> SRR2926065 2 0.0000 1.000 0.000 1.000 0.000 0.000
#> SRR2926060 2 0.0000 1.000 0.000 1.000 0.000 0.000
#> SRR2926059 3 0.4193 0.759 0.000 0.268 0.732 0.000
#> SRR2926058 3 0.2973 0.787 0.000 0.144 0.856 0.000
#> SRR2926056 3 0.0000 0.743 0.000 0.000 1.000 0.000
#> SRR2926057 3 0.2973 0.787 0.000 0.144 0.856 0.000
#> SRR2926055 3 0.4746 0.674 0.000 0.368 0.632 0.000
#> SRR2926054 3 0.2469 0.784 0.000 0.108 0.892 0.000
#> SRR2926051 3 0.0188 0.748 0.000 0.004 0.996 0.000
#> SRR2926052 3 0.1637 0.773 0.000 0.060 0.940 0.000
#> SRR2926053 3 0.4477 0.740 0.000 0.312 0.688 0.000
#> SRR2926050 3 0.1022 0.762 0.000 0.032 0.968 0.000
#> SRR2926049 2 0.0000 1.000 0.000 1.000 0.000 0.000
#> SRR2926047 2 0.0000 1.000 0.000 1.000 0.000 0.000
#> SRR2926046 3 0.0188 0.748 0.000 0.004 0.996 0.000
#> SRR2926048 2 0.0000 1.000 0.000 1.000 0.000 0.000
#> SRR2926044 3 0.4888 0.581 0.000 0.412 0.588 0.000
#> SRR2926045 3 0.4477 0.740 0.000 0.312 0.688 0.000
#> SRR2926041 2 0.0000 1.000 0.000 1.000 0.000 0.000
#> SRR2926042 2 0.0000 1.000 0.000 1.000 0.000 0.000
#> SRR2926040 2 0.0000 1.000 0.000 1.000 0.000 0.000
#> SRR2926039 2 0.0000 1.000 0.000 1.000 0.000 0.000
#> SRR2926043 2 0.0000 1.000 0.000 1.000 0.000 0.000
#> SRR2926038 2 0.0000 1.000 0.000 1.000 0.000 0.000
#> SRR2926036 2 0.0000 1.000 0.000 1.000 0.000 0.000
#> SRR2926037 2 0.0000 1.000 0.000 1.000 0.000 0.000
#> SRR2926035 2 0.0000 1.000 0.000 1.000 0.000 0.000
#> SRR2926034 2 0.0188 0.995 0.000 0.996 0.004 0.000
#> SRR2926032 2 0.0000 1.000 0.000 1.000 0.000 0.000
#> SRR2926031 4 0.3486 0.729 0.188 0.000 0.000 0.812
#> SRR2926033 3 0.4866 0.614 0.000 0.404 0.596 0.000
#> SRR2926030 1 0.0000 0.916 1.000 0.000 0.000 0.000
#> SRR2926029 3 0.0000 0.743 0.000 0.000 1.000 0.000
#> SRR2926027 1 0.1389 0.881 0.952 0.000 0.048 0.000
#> SRR2926028 4 0.0000 0.780 0.000 0.000 0.000 1.000
#> SRR2926026 1 0.0000 0.916 1.000 0.000 0.000 0.000
#> SRR2926025 1 0.4250 0.632 0.724 0.000 0.000 0.276
#> SRR2926023 1 0.0000 0.916 1.000 0.000 0.000 0.000
#> SRR2926022 1 0.0000 0.916 1.000 0.000 0.000 0.000
#> SRR2926024 1 0.0000 0.916 1.000 0.000 0.000 0.000
#> SRR2926021 1 0.4164 0.652 0.736 0.000 0.000 0.264
#> SRR2926020 1 0.0000 0.916 1.000 0.000 0.000 0.000
#> SRR2926019 1 0.0000 0.916 1.000 0.000 0.000 0.000
#> SRR2926018 1 0.0000 0.916 1.000 0.000 0.000 0.000
#> SRR2926017 1 0.4514 0.739 0.800 0.000 0.136 0.064
#> SRR2926016 2 0.0000 1.000 0.000 1.000 0.000 0.000
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> SRR2926066 3 0.0404 0.748 0.000 0.000 0.988 0.012 0.000
#> SRR2926067 3 0.4030 0.677 0.000 0.352 0.648 0.000 0.000
#> SRR2926063 3 0.0404 0.748 0.000 0.000 0.988 0.012 0.000
#> SRR2926064 2 0.0992 0.971 0.000 0.968 0.008 0.024 0.000
#> SRR2926062 2 0.0290 0.977 0.000 0.992 0.000 0.008 0.000
#> SRR2926061 3 0.3684 0.747 0.000 0.280 0.720 0.000 0.000
#> SRR2926065 2 0.0992 0.971 0.000 0.968 0.008 0.024 0.000
#> SRR2926060 2 0.0579 0.976 0.000 0.984 0.008 0.008 0.000
#> SRR2926059 3 0.3508 0.757 0.000 0.252 0.748 0.000 0.000
#> SRR2926058 3 0.2377 0.786 0.000 0.128 0.872 0.000 0.000
#> SRR2926056 3 0.0703 0.744 0.000 0.000 0.976 0.024 0.000
#> SRR2926057 3 0.2377 0.786 0.000 0.128 0.872 0.000 0.000
#> SRR2926055 3 0.4045 0.672 0.000 0.356 0.644 0.000 0.000
#> SRR2926054 3 0.1908 0.783 0.000 0.092 0.908 0.000 0.000
#> SRR2926051 3 0.0404 0.748 0.000 0.000 0.988 0.012 0.000
#> SRR2926052 3 0.1357 0.772 0.000 0.048 0.948 0.004 0.000
#> SRR2926053 3 0.3796 0.737 0.000 0.300 0.700 0.000 0.000
#> SRR2926050 3 0.0992 0.761 0.000 0.024 0.968 0.008 0.000
#> SRR2926049 2 0.0162 0.979 0.000 0.996 0.000 0.004 0.000
#> SRR2926047 2 0.0162 0.979 0.000 0.996 0.000 0.004 0.000
#> SRR2926046 3 0.0404 0.748 0.000 0.000 0.988 0.012 0.000
#> SRR2926048 2 0.0162 0.979 0.000 0.996 0.000 0.004 0.000
#> SRR2926044 3 0.4415 0.597 0.000 0.388 0.604 0.008 0.000
#> SRR2926045 3 0.3796 0.737 0.000 0.300 0.700 0.000 0.000
#> SRR2926041 2 0.0162 0.979 0.000 0.996 0.000 0.004 0.000
#> SRR2926042 2 0.0579 0.976 0.000 0.984 0.008 0.008 0.000
#> SRR2926040 2 0.0162 0.979 0.000 0.996 0.000 0.004 0.000
#> SRR2926039 2 0.0992 0.971 0.000 0.968 0.008 0.024 0.000
#> SRR2926043 2 0.0771 0.974 0.000 0.976 0.004 0.020 0.000
#> SRR2926038 2 0.0510 0.975 0.000 0.984 0.000 0.016 0.000
#> SRR2926036 2 0.0162 0.979 0.000 0.996 0.000 0.004 0.000
#> SRR2926037 2 0.0162 0.979 0.000 0.996 0.000 0.004 0.000
#> SRR2926035 2 0.0162 0.979 0.000 0.996 0.000 0.004 0.000
#> SRR2926034 2 0.1012 0.971 0.000 0.968 0.012 0.020 0.000
#> SRR2926032 2 0.0162 0.979 0.000 0.996 0.000 0.004 0.000
#> SRR2926031 5 0.4235 0.471 0.008 0.000 0.000 0.336 0.656
#> SRR2926033 3 0.4161 0.612 0.000 0.392 0.608 0.000 0.000
#> SRR2926030 1 0.0000 0.919 1.000 0.000 0.000 0.000 0.000
#> SRR2926029 3 0.0703 0.744 0.000 0.000 0.976 0.024 0.000
#> SRR2926027 1 0.2291 0.816 0.908 0.000 0.036 0.056 0.000
#> SRR2926028 5 0.0000 0.587 0.000 0.000 0.000 0.000 1.000
#> SRR2926026 1 0.0000 0.919 1.000 0.000 0.000 0.000 0.000
#> SRR2926025 1 0.5916 -0.198 0.544 0.000 0.000 0.336 0.120
#> SRR2926023 1 0.0000 0.919 1.000 0.000 0.000 0.000 0.000
#> SRR2926022 1 0.0000 0.919 1.000 0.000 0.000 0.000 0.000
#> SRR2926024 1 0.0000 0.919 1.000 0.000 0.000 0.000 0.000
#> SRR2926021 4 0.5107 0.659 0.204 0.000 0.000 0.688 0.108
#> SRR2926020 1 0.0000 0.919 1.000 0.000 0.000 0.000 0.000
#> SRR2926019 1 0.0000 0.919 1.000 0.000 0.000 0.000 0.000
#> SRR2926018 1 0.0000 0.919 1.000 0.000 0.000 0.000 0.000
#> SRR2926017 4 0.4914 0.689 0.204 0.000 0.092 0.704 0.000
#> SRR2926016 2 0.3109 0.795 0.000 0.800 0.000 0.200 0.000
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> SRR2926066 3 0.1863 0.7819 0.000 0.000 0.896 0.104 0.000 0.000
#> SRR2926067 3 0.3954 0.6868 0.000 0.204 0.740 0.056 0.000 0.000
#> SRR2926063 3 0.1863 0.7819 0.000 0.000 0.896 0.104 0.000 0.000
#> SRR2926064 2 0.4674 0.0590 0.000 0.608 0.060 0.332 0.000 0.000
#> SRR2926062 2 0.3482 0.1594 0.000 0.684 0.000 0.316 0.000 0.000
#> SRR2926061 3 0.2871 0.7435 0.000 0.192 0.804 0.004 0.000 0.000
#> SRR2926065 2 0.5223 -0.2232 0.000 0.508 0.096 0.396 0.000 0.000
#> SRR2926060 2 0.4668 0.0981 0.000 0.620 0.064 0.316 0.000 0.000
#> SRR2926059 3 0.2631 0.7649 0.000 0.152 0.840 0.008 0.000 0.000
#> SRR2926058 3 0.0972 0.8030 0.000 0.028 0.964 0.008 0.000 0.000
#> SRR2926056 3 0.2092 0.7736 0.000 0.000 0.876 0.124 0.000 0.000
#> SRR2926057 3 0.0972 0.8030 0.000 0.028 0.964 0.008 0.000 0.000
#> SRR2926055 3 0.4037 0.6848 0.000 0.200 0.736 0.064 0.000 0.000
#> SRR2926054 3 0.0909 0.8017 0.000 0.012 0.968 0.020 0.000 0.000
#> SRR2926051 3 0.1863 0.7819 0.000 0.000 0.896 0.104 0.000 0.000
#> SRR2926052 3 0.1462 0.7978 0.000 0.008 0.936 0.056 0.000 0.000
#> SRR2926053 3 0.3043 0.7300 0.000 0.200 0.792 0.008 0.000 0.000
#> SRR2926050 3 0.1501 0.7890 0.000 0.000 0.924 0.076 0.000 0.000
#> SRR2926049 2 0.0000 0.5512 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2926047 2 0.0000 0.5512 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2926046 3 0.1863 0.7819 0.000 0.000 0.896 0.104 0.000 0.000
#> SRR2926048 2 0.0000 0.5512 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2926044 3 0.3778 0.5706 0.000 0.288 0.696 0.016 0.000 0.000
#> SRR2926045 3 0.3043 0.7300 0.000 0.200 0.792 0.008 0.000 0.000
#> SRR2926041 2 0.0000 0.5512 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2926042 2 0.4548 0.1182 0.000 0.632 0.056 0.312 0.000 0.000
#> SRR2926040 2 0.0000 0.5512 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2926039 2 0.5022 -0.1853 0.000 0.528 0.076 0.396 0.000 0.000
#> SRR2926043 2 0.4872 -0.1635 0.000 0.548 0.064 0.388 0.000 0.000
#> SRR2926038 2 0.3515 0.1332 0.000 0.676 0.000 0.324 0.000 0.000
#> SRR2926036 2 0.0000 0.5512 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2926037 2 0.0000 0.5512 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2926035 2 0.0000 0.5512 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2926034 2 0.5248 -0.2068 0.000 0.512 0.100 0.388 0.000 0.000
#> SRR2926032 2 0.0000 0.5512 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2926031 5 0.5731 0.4408 0.008 0.000 0.000 0.268 0.548 0.176
#> SRR2926033 3 0.4215 0.6260 0.000 0.244 0.700 0.056 0.000 0.000
#> SRR2926030 1 0.0000 0.9124 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2926029 3 0.2092 0.7736 0.000 0.000 0.876 0.124 0.000 0.000
#> SRR2926027 1 0.3872 0.5818 0.712 0.000 0.004 0.020 0.000 0.264
#> SRR2926028 5 0.0000 0.5104 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR2926026 1 0.0000 0.9124 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2926025 1 0.5821 0.2459 0.544 0.000 0.000 0.268 0.012 0.176
#> SRR2926023 1 0.0000 0.9124 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2926022 1 0.0000 0.9124 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2926024 1 0.0000 0.9124 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2926021 6 0.1958 0.6944 0.000 0.000 0.000 0.100 0.004 0.896
#> SRR2926020 1 0.0000 0.9124 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2926019 1 0.0000 0.9124 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2926018 1 0.0000 0.9124 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2926017 6 0.1918 0.7182 0.000 0.000 0.008 0.088 0.000 0.904
#> SRR2926016 4 0.3756 0.0000 0.000 0.400 0.000 0.600 0.000 0.000
Heatmaps for the consensus matrix. It visualizes the probability of two samples to be in a same group.
consensus_heatmap(res, k = 2)
consensus_heatmap(res, k = 3)
consensus_heatmap(res, k = 4)
consensus_heatmap(res, k = 5)
consensus_heatmap(res, k = 6)
Heatmaps for the membership of samples in all partitions to see how consistent they are:
membership_heatmap(res, k = 2)
membership_heatmap(res, k = 3)
membership_heatmap(res, k = 4)
membership_heatmap(res, k = 5)
membership_heatmap(res, k = 6)
As soon as we have had the classes for columns, we can look for signatures which are significantly different between classes which can be candidate marks for certain classes. Following are the heatmaps for signatures.
Signature heatmaps where rows are scaled:
get_signatures(res, k = 2)
get_signatures(res, k = 3)
get_signatures(res, k = 4)
get_signatures(res, k = 5)
get_signatures(res, k = 6)
Signature heatmaps where rows are not scaled:
get_signatures(res, k = 2, scale_rows = FALSE)
get_signatures(res, k = 3, scale_rows = FALSE)
get_signatures(res, k = 4, scale_rows = FALSE)
get_signatures(res, k = 5, scale_rows = FALSE)
get_signatures(res, k = 6, scale_rows = FALSE)
Compare the overlap of signatures from different k:
compare_signatures(res)
get_signature()
returns a data frame invisibly. TO get the list of signatures, the function
call should be assigned to a variable explicitly. In following code, if plot
argument is set
to FALSE
, no heatmap is plotted while only the differential analysis is performed.
# code only for demonstration
tb = get_signature(res, k = ..., plot = FALSE)
An example of the output of tb
is:
#> which_row fdr mean_1 mean_2 scaled_mean_1 scaled_mean_2 km
#> 1 38 0.042760348 8.373488 9.131774 -0.5533452 0.5164555 1
#> 2 40 0.018707592 7.106213 8.469186 -0.6173731 0.5762149 1
#> 3 55 0.019134737 10.221463 11.207825 -0.6159697 0.5749050 1
#> 4 59 0.006059896 5.921854 7.869574 -0.6899429 0.6439467 1
#> 5 60 0.018055526 8.928898 10.211722 -0.6204761 0.5791110 1
#> 6 98 0.009384629 15.714769 14.887706 0.6635654 -0.6193277 2
...
The columns in tb
are:
which_row
: row indices corresponding to the input matrix.fdr
: FDR for the differential test. mean_x
: The mean value in group x.scaled_mean_x
: The mean value in group x after rows are scaled.km
: Row groups if k-means clustering is applied to rows.UMAP plot which shows how samples are separated.
dimension_reduction(res, k = 2, method = "UMAP")
dimension_reduction(res, k = 3, method = "UMAP")
dimension_reduction(res, k = 4, method = "UMAP")
dimension_reduction(res, k = 5, method = "UMAP")
dimension_reduction(res, k = 6, method = "UMAP")
Following heatmap shows how subgroups are split when increasing k
:
collect_classes(res)
If matrix rows can be associated to genes, consider to use functional_enrichment(res,
...)
to perform function enrichment for the signature genes. See this vignette for more detailed explanations.
The object with results only for a single top-value method and a single partition method can be extracted as:
res = res_list["SD", "kmeans"]
# you can also extract it by
# res = res_list["SD:kmeans"]
A summary of res
and all the functions that can be applied to it:
res
#> A 'ConsensusPartition' object with k = 2, 3, 4, 5, 6.
#> On a matrix with 18096 rows and 52 columns.
#> Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'SD' method.
#> Subgroups are detected by 'kmeans' method.
#> Performed in total 1250 partitions by row resampling.
#> Best k for subgroups seems to be 3.
#>
#> Following methods can be applied to this 'ConsensusPartition' object:
#> [1] "cola_report" "collect_classes" "collect_plots"
#> [4] "collect_stats" "colnames" "compare_signatures"
#> [7] "consensus_heatmap" "dimension_reduction" "functional_enrichment"
#> [10] "get_anno_col" "get_anno" "get_classes"
#> [13] "get_consensus" "get_matrix" "get_membership"
#> [16] "get_param" "get_signatures" "get_stats"
#> [19] "is_best_k" "is_stable_k" "membership_heatmap"
#> [22] "ncol" "nrow" "plot_ecdf"
#> [25] "rownames" "select_partition_number" "show"
#> [28] "suggest_best_k" "test_to_known_factors"
collect_plots()
function collects all the plots made from res
for all k
(number of partitions)
into one single page to provide an easy and fast comparison between different k
.
collect_plots(res)
The plots are:
k
and the heatmap of
predicted classes for each k
.k
.k
.k
.All the plots in panels can be made by individual functions and they are plotted later in this section.
select_partition_number()
produces several plots showing different
statistics for choosing “optimized” k
. There are following statistics:
k
;k
, the area increased is defined as \(A_k - A_{k-1}\).The detailed explanations of these statistics can be found in the cola vignette.
Generally speaking, lower PAC score, higher mean silhouette score or higher
concordance corresponds to better partition. Rand index and Jaccard index
measure how similar the current partition is compared to partition with k-1
.
If they are too similar, we won't accept k
is better than k-1
.
select_partition_number(res)
The numeric values for all these statistics can be obtained by get_stats()
.
get_stats(res)
#> k 1-PAC mean_silhouette concordance area_increased Rand Jaccard
#> 2 2 0.802 0.955 0.975 0.4330 0.581 0.581
#> 3 3 1.000 0.955 0.955 0.4927 0.729 0.543
#> 4 4 0.793 0.789 0.823 0.1231 0.972 0.920
#> 5 5 0.723 0.721 0.809 0.0689 0.854 0.577
#> 6 6 0.690 0.648 0.765 0.0473 0.928 0.687
suggest_best_k()
suggests the best \(k\) based on these statistics. The rules are as follows:
suggest_best_k(res)
#> [1] 3
Following shows the table of the partitions (You need to click the show/hide
code output link to see it). The membership matrix (columns with name p*
)
is inferred by
clue::cl_consensus()
function with the SE
method. Basically the value in the membership matrix
represents the probability to belong to a certain group. The finall class
label for an item is determined with the group with highest probability it
belongs to.
In get_classes()
function, the entropy is calculated from the membership
matrix and the silhouette score is calculated from the consensus matrix.
cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#> class entropy silhouette p1 p2
#> SRR2926066 2 0.595 0.866 0.144 0.856
#> SRR2926067 2 0.000 0.963 0.000 1.000
#> SRR2926063 2 0.595 0.866 0.144 0.856
#> SRR2926064 2 0.000 0.963 0.000 1.000
#> SRR2926062 2 0.000 0.963 0.000 1.000
#> SRR2926061 2 0.000 0.963 0.000 1.000
#> SRR2926065 2 0.000 0.963 0.000 1.000
#> SRR2926060 2 0.000 0.963 0.000 1.000
#> SRR2926059 2 0.000 0.963 0.000 1.000
#> SRR2926058 2 0.343 0.927 0.064 0.936
#> SRR2926056 1 0.000 1.000 1.000 0.000
#> SRR2926057 2 0.358 0.924 0.068 0.932
#> SRR2926055 2 0.000 0.963 0.000 1.000
#> SRR2926054 2 0.358 0.924 0.068 0.932
#> SRR2926051 2 0.595 0.866 0.144 0.856
#> SRR2926052 2 0.595 0.866 0.144 0.856
#> SRR2926053 2 0.000 0.963 0.000 1.000
#> SRR2926050 2 0.595 0.866 0.144 0.856
#> SRR2926049 2 0.000 0.963 0.000 1.000
#> SRR2926047 2 0.000 0.963 0.000 1.000
#> SRR2926046 2 0.595 0.866 0.144 0.856
#> SRR2926048 2 0.000 0.963 0.000 1.000
#> SRR2926044 2 0.000 0.963 0.000 1.000
#> SRR2926045 2 0.000 0.963 0.000 1.000
#> SRR2926041 2 0.000 0.963 0.000 1.000
#> SRR2926042 2 0.000 0.963 0.000 1.000
#> SRR2926040 2 0.000 0.963 0.000 1.000
#> SRR2926039 2 0.000 0.963 0.000 1.000
#> SRR2926043 2 0.000 0.963 0.000 1.000
#> SRR2926038 2 0.000 0.963 0.000 1.000
#> SRR2926036 2 0.000 0.963 0.000 1.000
#> SRR2926037 2 0.000 0.963 0.000 1.000
#> SRR2926035 2 0.000 0.963 0.000 1.000
#> SRR2926034 2 0.000 0.963 0.000 1.000
#> SRR2926032 2 0.000 0.963 0.000 1.000
#> SRR2926031 1 0.000 1.000 1.000 0.000
#> SRR2926033 2 0.000 0.963 0.000 1.000
#> SRR2926030 1 0.000 1.000 1.000 0.000
#> SRR2926029 2 0.827 0.712 0.260 0.740
#> SRR2926027 1 0.000 1.000 1.000 0.000
#> SRR2926028 1 0.000 1.000 1.000 0.000
#> SRR2926026 1 0.000 1.000 1.000 0.000
#> SRR2926025 1 0.000 1.000 1.000 0.000
#> SRR2926023 1 0.000 1.000 1.000 0.000
#> SRR2926022 1 0.000 1.000 1.000 0.000
#> SRR2926024 1 0.000 1.000 1.000 0.000
#> SRR2926021 1 0.000 1.000 1.000 0.000
#> SRR2926020 1 0.000 1.000 1.000 0.000
#> SRR2926019 1 0.000 1.000 1.000 0.000
#> SRR2926018 1 0.000 1.000 1.000 0.000
#> SRR2926017 1 0.000 1.000 1.000 0.000
#> SRR2926016 2 0.000 0.963 0.000 1.000
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> SRR2926066 3 0.2625 0.938 0.000 0.084 0.916
#> SRR2926067 3 0.6062 0.546 0.000 0.384 0.616
#> SRR2926063 3 0.2625 0.938 0.000 0.084 0.916
#> SRR2926064 2 0.0000 1.000 0.000 1.000 0.000
#> SRR2926062 2 0.0000 1.000 0.000 1.000 0.000
#> SRR2926061 2 0.0000 1.000 0.000 1.000 0.000
#> SRR2926065 2 0.0000 1.000 0.000 1.000 0.000
#> SRR2926060 2 0.0000 1.000 0.000 1.000 0.000
#> SRR2926059 3 0.2796 0.938 0.000 0.092 0.908
#> SRR2926058 3 0.2796 0.938 0.000 0.092 0.908
#> SRR2926056 3 0.1129 0.857 0.020 0.004 0.976
#> SRR2926057 3 0.2796 0.938 0.000 0.092 0.908
#> SRR2926055 3 0.6062 0.546 0.000 0.384 0.616
#> SRR2926054 3 0.2796 0.938 0.000 0.092 0.908
#> SRR2926051 3 0.2625 0.938 0.000 0.084 0.916
#> SRR2926052 3 0.2625 0.938 0.000 0.084 0.916
#> SRR2926053 3 0.2796 0.938 0.000 0.092 0.908
#> SRR2926050 3 0.2625 0.938 0.000 0.084 0.916
#> SRR2926049 2 0.0000 1.000 0.000 1.000 0.000
#> SRR2926047 2 0.0000 1.000 0.000 1.000 0.000
#> SRR2926046 3 0.2625 0.938 0.000 0.084 0.916
#> SRR2926048 2 0.0000 1.000 0.000 1.000 0.000
#> SRR2926044 2 0.0000 1.000 0.000 1.000 0.000
#> SRR2926045 3 0.2796 0.938 0.000 0.092 0.908
#> SRR2926041 2 0.0000 1.000 0.000 1.000 0.000
#> SRR2926042 2 0.0000 1.000 0.000 1.000 0.000
#> SRR2926040 2 0.0000 1.000 0.000 1.000 0.000
#> SRR2926039 2 0.0000 1.000 0.000 1.000 0.000
#> SRR2926043 2 0.0000 1.000 0.000 1.000 0.000
#> SRR2926038 2 0.0000 1.000 0.000 1.000 0.000
#> SRR2926036 2 0.0000 1.000 0.000 1.000 0.000
#> SRR2926037 2 0.0000 1.000 0.000 1.000 0.000
#> SRR2926035 2 0.0000 1.000 0.000 1.000 0.000
#> SRR2926034 2 0.0000 1.000 0.000 1.000 0.000
#> SRR2926032 2 0.0000 1.000 0.000 1.000 0.000
#> SRR2926031 1 0.2625 0.954 0.916 0.000 0.084
#> SRR2926033 2 0.0000 1.000 0.000 1.000 0.000
#> SRR2926030 1 0.0424 0.979 0.992 0.000 0.008
#> SRR2926029 3 0.1031 0.880 0.000 0.024 0.976
#> SRR2926027 1 0.1411 0.973 0.964 0.000 0.036
#> SRR2926028 1 0.2625 0.954 0.916 0.000 0.084
#> SRR2926026 1 0.0424 0.979 0.992 0.000 0.008
#> SRR2926025 1 0.1163 0.970 0.972 0.000 0.028
#> SRR2926023 1 0.0424 0.979 0.992 0.000 0.008
#> SRR2926022 1 0.0424 0.979 0.992 0.000 0.008
#> SRR2926024 1 0.0424 0.979 0.992 0.000 0.008
#> SRR2926021 1 0.2625 0.954 0.916 0.000 0.084
#> SRR2926020 1 0.0424 0.979 0.992 0.000 0.008
#> SRR2926019 1 0.0424 0.979 0.992 0.000 0.008
#> SRR2926018 1 0.0424 0.979 0.992 0.000 0.008
#> SRR2926017 1 0.2356 0.961 0.928 0.000 0.072
#> SRR2926016 2 0.0000 1.000 0.000 1.000 0.000
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> SRR2926066 3 0.1004 0.910 0.000 0.004 0.972 NA
#> SRR2926067 3 0.5602 0.344 0.000 0.472 0.508 NA
#> SRR2926063 3 0.0895 0.910 0.000 0.004 0.976 NA
#> SRR2926064 2 0.2149 0.775 0.000 0.912 0.000 NA
#> SRR2926062 2 0.2281 0.776 0.000 0.904 0.000 NA
#> SRR2926061 2 0.3831 0.781 0.000 0.792 0.004 NA
#> SRR2926065 2 0.1256 0.720 0.000 0.964 0.028 NA
#> SRR2926060 2 0.0188 0.746 0.000 0.996 0.000 NA
#> SRR2926059 3 0.2450 0.892 0.000 0.072 0.912 NA
#> SRR2926058 3 0.3156 0.896 0.000 0.068 0.884 NA
#> SRR2926056 3 0.1557 0.903 0.000 0.000 0.944 NA
#> SRR2926057 3 0.3071 0.896 0.000 0.068 0.888 NA
#> SRR2926055 2 0.5570 -0.271 0.000 0.540 0.440 NA
#> SRR2926054 3 0.0469 0.911 0.000 0.012 0.988 NA
#> SRR2926051 3 0.1004 0.910 0.000 0.004 0.972 NA
#> SRR2926052 3 0.0804 0.910 0.000 0.012 0.980 NA
#> SRR2926053 3 0.2179 0.897 0.000 0.064 0.924 NA
#> SRR2926050 3 0.1398 0.907 0.000 0.004 0.956 NA
#> SRR2926049 2 0.4961 0.783 0.000 0.552 0.000 NA
#> SRR2926047 2 0.4955 0.785 0.000 0.556 0.000 NA
#> SRR2926046 3 0.1743 0.905 0.000 0.004 0.940 NA
#> SRR2926048 2 0.4955 0.785 0.000 0.556 0.000 NA
#> SRR2926044 2 0.3831 0.781 0.000 0.792 0.004 NA
#> SRR2926045 3 0.4606 0.716 0.000 0.264 0.724 NA
#> SRR2926041 2 0.4955 0.785 0.000 0.556 0.000 NA
#> SRR2926042 2 0.4916 0.789 0.000 0.576 0.000 NA
#> SRR2926040 2 0.4961 0.783 0.000 0.552 0.000 NA
#> SRR2926039 2 0.0000 0.745 0.000 1.000 0.000 NA
#> SRR2926043 2 0.0336 0.749 0.000 0.992 0.000 NA
#> SRR2926038 2 0.4193 0.782 0.000 0.732 0.000 NA
#> SRR2926036 2 0.4955 0.785 0.000 0.556 0.000 NA
#> SRR2926037 2 0.4961 0.783 0.000 0.552 0.000 NA
#> SRR2926035 2 0.4955 0.785 0.000 0.556 0.000 NA
#> SRR2926034 2 0.0000 0.745 0.000 1.000 0.000 NA
#> SRR2926032 2 0.4925 0.788 0.000 0.572 0.000 NA
#> SRR2926031 1 0.4992 0.700 0.524 0.000 0.000 NA
#> SRR2926033 2 0.2345 0.765 0.000 0.900 0.000 NA
#> SRR2926030 1 0.0000 0.880 1.000 0.000 0.000 NA
#> SRR2926029 3 0.1637 0.902 0.000 0.000 0.940 NA
#> SRR2926027 1 0.0188 0.880 0.996 0.000 0.004 NA
#> SRR2926028 1 0.4992 0.700 0.524 0.000 0.000 NA
#> SRR2926026 1 0.0000 0.880 1.000 0.000 0.000 NA
#> SRR2926025 1 0.2921 0.838 0.860 0.000 0.000 NA
#> SRR2926023 1 0.0188 0.880 0.996 0.000 0.004 NA
#> SRR2926022 1 0.0188 0.880 0.996 0.000 0.004 NA
#> SRR2926024 1 0.0000 0.880 1.000 0.000 0.000 NA
#> SRR2926021 1 0.4989 0.702 0.528 0.000 0.000 NA
#> SRR2926020 1 0.0000 0.880 1.000 0.000 0.000 NA
#> SRR2926019 1 0.0000 0.880 1.000 0.000 0.000 NA
#> SRR2926018 1 0.0188 0.880 0.996 0.000 0.004 NA
#> SRR2926017 1 0.5693 0.681 0.504 0.000 0.024 NA
#> SRR2926016 2 0.0817 0.751 0.000 0.976 0.000 NA
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> SRR2926066 3 0.1830 0.8428 0.000 0.000 0.924 0.068 0.008
#> SRR2926067 4 0.6435 0.0665 0.000 0.040 0.308 0.560 0.092
#> SRR2926063 3 0.1697 0.8420 0.000 0.000 0.932 0.060 0.008
#> SRR2926064 4 0.4649 0.5641 0.000 0.404 0.000 0.580 0.016
#> SRR2926062 4 0.4825 0.5525 0.000 0.408 0.000 0.568 0.024
#> SRR2926061 2 0.6066 -0.0864 0.000 0.516 0.000 0.352 0.132
#> SRR2926065 4 0.3550 0.7163 0.000 0.236 0.000 0.760 0.004
#> SRR2926060 4 0.3766 0.7287 0.000 0.268 0.000 0.728 0.004
#> SRR2926059 3 0.4734 0.7902 0.000 0.000 0.724 0.188 0.088
#> SRR2926058 3 0.4149 0.8041 0.000 0.000 0.784 0.128 0.088
#> SRR2926056 3 0.2054 0.7992 0.000 0.000 0.920 0.052 0.028
#> SRR2926057 3 0.4104 0.8048 0.000 0.000 0.788 0.124 0.088
#> SRR2926055 4 0.5437 0.4416 0.000 0.036 0.172 0.708 0.084
#> SRR2926054 3 0.3267 0.8387 0.000 0.000 0.844 0.112 0.044
#> SRR2926051 3 0.1697 0.8420 0.000 0.000 0.932 0.060 0.008
#> SRR2926052 3 0.2464 0.8454 0.000 0.000 0.888 0.096 0.016
#> SRR2926053 3 0.5004 0.7542 0.000 0.000 0.692 0.216 0.092
#> SRR2926050 3 0.1331 0.8328 0.000 0.000 0.952 0.008 0.040
#> SRR2926049 2 0.1522 0.7888 0.000 0.944 0.000 0.012 0.044
#> SRR2926047 2 0.0510 0.7992 0.000 0.984 0.000 0.000 0.016
#> SRR2926046 3 0.1082 0.8259 0.000 0.000 0.964 0.008 0.028
#> SRR2926048 2 0.0000 0.8008 0.000 1.000 0.000 0.000 0.000
#> SRR2926044 2 0.5996 -0.0798 0.000 0.524 0.000 0.352 0.124
#> SRR2926045 3 0.5818 0.3175 0.000 0.000 0.460 0.448 0.092
#> SRR2926041 2 0.0290 0.8004 0.000 0.992 0.000 0.000 0.008
#> SRR2926042 2 0.2932 0.7196 0.000 0.864 0.000 0.104 0.032
#> SRR2926040 2 0.1670 0.7887 0.000 0.936 0.000 0.012 0.052
#> SRR2926039 4 0.3766 0.7293 0.000 0.268 0.000 0.728 0.004
#> SRR2926043 4 0.3857 0.7077 0.000 0.312 0.000 0.688 0.000
#> SRR2926038 2 0.4866 0.1511 0.000 0.620 0.000 0.344 0.036
#> SRR2926036 2 0.0162 0.8007 0.000 0.996 0.000 0.000 0.004
#> SRR2926037 2 0.1670 0.7887 0.000 0.936 0.000 0.012 0.052
#> SRR2926035 2 0.0000 0.8008 0.000 1.000 0.000 0.000 0.000
#> SRR2926034 4 0.3636 0.7290 0.000 0.272 0.000 0.728 0.000
#> SRR2926032 2 0.2017 0.7487 0.000 0.912 0.000 0.080 0.008
#> SRR2926031 5 0.5064 0.8870 0.232 0.000 0.000 0.088 0.680
#> SRR2926033 4 0.5553 0.4093 0.000 0.448 0.000 0.484 0.068
#> SRR2926030 1 0.0162 0.9472 0.996 0.000 0.000 0.004 0.000
#> SRR2926029 3 0.2278 0.7922 0.000 0.000 0.908 0.060 0.032
#> SRR2926027 1 0.2464 0.8282 0.888 0.000 0.000 0.016 0.096
#> SRR2926028 5 0.5211 0.8848 0.232 0.000 0.000 0.100 0.668
#> SRR2926026 1 0.0000 0.9483 1.000 0.000 0.000 0.000 0.000
#> SRR2926025 1 0.3336 0.5914 0.772 0.000 0.000 0.000 0.228
#> SRR2926023 1 0.0000 0.9483 1.000 0.000 0.000 0.000 0.000
#> SRR2926022 1 0.0162 0.9472 0.996 0.000 0.000 0.004 0.000
#> SRR2926024 1 0.0162 0.9472 0.996 0.000 0.000 0.004 0.000
#> SRR2926021 5 0.3395 0.8718 0.236 0.000 0.000 0.000 0.764
#> SRR2926020 1 0.0000 0.9483 1.000 0.000 0.000 0.000 0.000
#> SRR2926019 1 0.0000 0.9483 1.000 0.000 0.000 0.000 0.000
#> SRR2926018 1 0.0000 0.9483 1.000 0.000 0.000 0.000 0.000
#> SRR2926017 5 0.6313 0.7595 0.228 0.000 0.124 0.036 0.612
#> SRR2926016 4 0.4989 0.6686 0.000 0.296 0.000 0.648 0.056
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> SRR2926066 3 0.3329 0.6136 0.000 0.000 0.792 0.004 0.020 0.184
#> SRR2926067 6 0.5762 0.5355 0.000 0.000 0.152 0.380 0.004 0.464
#> SRR2926063 3 0.3202 0.6155 0.000 0.000 0.800 0.000 0.024 0.176
#> SRR2926064 4 0.3668 0.6448 0.000 0.104 0.000 0.816 0.032 0.048
#> SRR2926062 4 0.3861 0.6562 0.000 0.100 0.000 0.804 0.032 0.064
#> SRR2926061 4 0.6634 0.2920 0.000 0.248 0.000 0.424 0.036 0.292
#> SRR2926065 4 0.1010 0.6513 0.000 0.000 0.000 0.960 0.004 0.036
#> SRR2926060 4 0.1313 0.6748 0.000 0.016 0.000 0.952 0.004 0.028
#> SRR2926059 3 0.5566 0.1426 0.000 0.000 0.472 0.056 0.036 0.436
#> SRR2926058 3 0.4963 0.4471 0.000 0.008 0.684 0.052 0.028 0.228
#> SRR2926056 3 0.2051 0.6107 0.000 0.036 0.916 0.000 0.008 0.040
#> SRR2926057 3 0.4963 0.4471 0.000 0.008 0.684 0.052 0.028 0.228
#> SRR2926055 4 0.5450 -0.2851 0.000 0.008 0.064 0.512 0.012 0.404
#> SRR2926054 3 0.4224 0.4819 0.000 0.000 0.632 0.000 0.028 0.340
#> SRR2926051 3 0.3473 0.5989 0.000 0.000 0.780 0.004 0.024 0.192
#> SRR2926052 3 0.3971 0.5763 0.000 0.000 0.704 0.004 0.024 0.268
#> SRR2926053 6 0.5386 0.0739 0.000 0.000 0.432 0.096 0.004 0.468
#> SRR2926050 3 0.1901 0.6438 0.000 0.008 0.912 0.000 0.004 0.076
#> SRR2926049 2 0.3999 0.8410 0.000 0.796 0.000 0.104 0.048 0.052
#> SRR2926047 2 0.3398 0.8590 0.000 0.824 0.000 0.120 0.016 0.040
#> SRR2926046 3 0.0976 0.6381 0.000 0.016 0.968 0.000 0.008 0.008
#> SRR2926048 2 0.3393 0.8592 0.000 0.824 0.000 0.124 0.024 0.028
#> SRR2926044 4 0.6599 0.3057 0.000 0.252 0.000 0.440 0.036 0.272
#> SRR2926045 6 0.5835 0.6362 0.000 0.000 0.232 0.280 0.000 0.488
#> SRR2926041 2 0.2191 0.8719 0.000 0.876 0.000 0.120 0.004 0.000
#> SRR2926042 2 0.5110 0.6232 0.000 0.604 0.000 0.316 0.020 0.060
#> SRR2926040 2 0.4061 0.8410 0.000 0.792 0.000 0.104 0.052 0.052
#> SRR2926039 4 0.1138 0.6780 0.000 0.024 0.000 0.960 0.004 0.012
#> SRR2926043 4 0.2239 0.6833 0.000 0.048 0.000 0.908 0.020 0.024
#> SRR2926038 4 0.5248 0.1185 0.000 0.340 0.000 0.580 0.040 0.040
#> SRR2926036 2 0.2092 0.8724 0.000 0.876 0.000 0.124 0.000 0.000
#> SRR2926037 2 0.4061 0.8410 0.000 0.792 0.000 0.104 0.052 0.052
#> SRR2926035 2 0.2092 0.8724 0.000 0.876 0.000 0.124 0.000 0.000
#> SRR2926034 4 0.1320 0.6726 0.000 0.016 0.000 0.948 0.000 0.036
#> SRR2926032 2 0.4924 0.6716 0.000 0.648 0.000 0.276 0.028 0.048
#> SRR2926031 5 0.5517 0.8189 0.144 0.044 0.000 0.000 0.652 0.160
#> SRR2926033 4 0.5377 0.4486 0.000 0.176 0.000 0.604 0.004 0.216
#> SRR2926030 1 0.0806 0.9197 0.972 0.008 0.000 0.000 0.000 0.020
#> SRR2926029 3 0.2577 0.5933 0.000 0.036 0.888 0.004 0.008 0.064
#> SRR2926027 1 0.3829 0.6693 0.760 0.016 0.000 0.000 0.200 0.024
#> SRR2926028 5 0.5660 0.8158 0.144 0.040 0.000 0.000 0.628 0.188
#> SRR2926026 1 0.0000 0.9272 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2926025 1 0.3354 0.6202 0.752 0.004 0.000 0.000 0.240 0.004
#> SRR2926023 1 0.0260 0.9268 0.992 0.008 0.000 0.000 0.000 0.000
#> SRR2926022 1 0.0603 0.9248 0.980 0.016 0.000 0.000 0.000 0.004
#> SRR2926024 1 0.1003 0.9196 0.964 0.016 0.000 0.000 0.000 0.020
#> SRR2926021 5 0.2300 0.7909 0.144 0.000 0.000 0.000 0.856 0.000
#> SRR2926020 1 0.0000 0.9272 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2926019 1 0.0000 0.9272 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2926018 1 0.0260 0.9268 0.992 0.008 0.000 0.000 0.000 0.000
#> SRR2926017 5 0.5638 0.6712 0.108 0.012 0.184 0.000 0.656 0.040
#> SRR2926016 4 0.4548 0.5865 0.000 0.044 0.000 0.740 0.056 0.160
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 18096 rows and 52 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 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.934 0.975 0.5041 0.493 0.493
#> 3 3 1.000 0.990 0.995 0.3231 0.750 0.535
#> 4 4 0.819 0.874 0.912 0.1324 0.877 0.646
#> 5 5 0.747 0.625 0.807 0.0547 0.992 0.968
#> 6 6 0.770 0.643 0.765 0.0412 0.879 0.525
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
#> SRR2926066 1 0.000 0.961 1.000 0.000
#> SRR2926067 2 0.000 0.984 0.000 1.000
#> SRR2926063 1 0.000 0.961 1.000 0.000
#> SRR2926064 2 0.000 0.984 0.000 1.000
#> SRR2926062 2 0.000 0.984 0.000 1.000
#> SRR2926061 2 0.000 0.984 0.000 1.000
#> SRR2926065 2 0.000 0.984 0.000 1.000
#> SRR2926060 2 0.000 0.984 0.000 1.000
#> SRR2926059 2 0.118 0.968 0.016 0.984
#> SRR2926058 2 0.971 0.277 0.400 0.600
#> SRR2926056 1 0.000 0.961 1.000 0.000
#> SRR2926057 1 0.981 0.292 0.580 0.420
#> SRR2926055 2 0.000 0.984 0.000 1.000
#> SRR2926054 1 0.955 0.408 0.624 0.376
#> SRR2926051 1 0.000 0.961 1.000 0.000
#> SRR2926052 1 0.242 0.928 0.960 0.040
#> SRR2926053 2 0.000 0.984 0.000 1.000
#> SRR2926050 1 0.224 0.932 0.964 0.036
#> SRR2926049 2 0.000 0.984 0.000 1.000
#> SRR2926047 2 0.000 0.984 0.000 1.000
#> SRR2926046 1 0.000 0.961 1.000 0.000
#> SRR2926048 2 0.000 0.984 0.000 1.000
#> SRR2926044 2 0.000 0.984 0.000 1.000
#> SRR2926045 2 0.000 0.984 0.000 1.000
#> SRR2926041 2 0.000 0.984 0.000 1.000
#> SRR2926042 2 0.000 0.984 0.000 1.000
#> SRR2926040 2 0.000 0.984 0.000 1.000
#> SRR2926039 2 0.000 0.984 0.000 1.000
#> SRR2926043 2 0.000 0.984 0.000 1.000
#> SRR2926038 2 0.000 0.984 0.000 1.000
#> SRR2926036 2 0.000 0.984 0.000 1.000
#> SRR2926037 2 0.000 0.984 0.000 1.000
#> SRR2926035 2 0.000 0.984 0.000 1.000
#> SRR2926034 2 0.000 0.984 0.000 1.000
#> SRR2926032 2 0.000 0.984 0.000 1.000
#> SRR2926031 1 0.000 0.961 1.000 0.000
#> SRR2926033 2 0.000 0.984 0.000 1.000
#> SRR2926030 1 0.000 0.961 1.000 0.000
#> SRR2926029 1 0.000 0.961 1.000 0.000
#> SRR2926027 1 0.000 0.961 1.000 0.000
#> SRR2926028 1 0.000 0.961 1.000 0.000
#> SRR2926026 1 0.000 0.961 1.000 0.000
#> SRR2926025 1 0.000 0.961 1.000 0.000
#> SRR2926023 1 0.000 0.961 1.000 0.000
#> SRR2926022 1 0.000 0.961 1.000 0.000
#> SRR2926024 1 0.000 0.961 1.000 0.000
#> SRR2926021 1 0.000 0.961 1.000 0.000
#> SRR2926020 1 0.000 0.961 1.000 0.000
#> SRR2926019 1 0.000 0.961 1.000 0.000
#> SRR2926018 1 0.000 0.961 1.000 0.000
#> SRR2926017 1 0.000 0.961 1.000 0.000
#> SRR2926016 2 0.000 0.984 0.000 1.000
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> SRR2926066 3 0.0000 0.982 0.000 0.000 1.000
#> SRR2926067 3 0.0592 0.973 0.000 0.012 0.988
#> SRR2926063 3 0.0000 0.982 0.000 0.000 1.000
#> SRR2926064 2 0.0000 1.000 0.000 1.000 0.000
#> SRR2926062 2 0.0000 1.000 0.000 1.000 0.000
#> SRR2926061 2 0.0000 1.000 0.000 1.000 0.000
#> SRR2926065 2 0.0000 1.000 0.000 1.000 0.000
#> SRR2926060 2 0.0000 1.000 0.000 1.000 0.000
#> SRR2926059 3 0.0000 0.982 0.000 0.000 1.000
#> SRR2926058 3 0.0000 0.982 0.000 0.000 1.000
#> SRR2926056 3 0.2537 0.913 0.080 0.000 0.920
#> SRR2926057 3 0.0000 0.982 0.000 0.000 1.000
#> SRR2926055 3 0.0592 0.973 0.000 0.012 0.988
#> SRR2926054 3 0.0000 0.982 0.000 0.000 1.000
#> SRR2926051 3 0.0000 0.982 0.000 0.000 1.000
#> SRR2926052 3 0.0000 0.982 0.000 0.000 1.000
#> SRR2926053 3 0.0000 0.982 0.000 0.000 1.000
#> SRR2926050 3 0.0000 0.982 0.000 0.000 1.000
#> SRR2926049 2 0.0000 1.000 0.000 1.000 0.000
#> SRR2926047 2 0.0000 1.000 0.000 1.000 0.000
#> SRR2926046 3 0.0000 0.982 0.000 0.000 1.000
#> SRR2926048 2 0.0000 1.000 0.000 1.000 0.000
#> SRR2926044 2 0.0000 1.000 0.000 1.000 0.000
#> SRR2926045 3 0.0000 0.982 0.000 0.000 1.000
#> SRR2926041 2 0.0000 1.000 0.000 1.000 0.000
#> SRR2926042 2 0.0000 1.000 0.000 1.000 0.000
#> SRR2926040 2 0.0000 1.000 0.000 1.000 0.000
#> SRR2926039 2 0.0000 1.000 0.000 1.000 0.000
#> SRR2926043 2 0.0000 1.000 0.000 1.000 0.000
#> SRR2926038 2 0.0000 1.000 0.000 1.000 0.000
#> SRR2926036 2 0.0000 1.000 0.000 1.000 0.000
#> SRR2926037 2 0.0000 1.000 0.000 1.000 0.000
#> SRR2926035 2 0.0000 1.000 0.000 1.000 0.000
#> SRR2926034 2 0.0000 1.000 0.000 1.000 0.000
#> SRR2926032 2 0.0000 1.000 0.000 1.000 0.000
#> SRR2926031 1 0.0000 1.000 1.000 0.000 0.000
#> SRR2926033 2 0.0000 1.000 0.000 1.000 0.000
#> SRR2926030 1 0.0000 1.000 1.000 0.000 0.000
#> SRR2926029 3 0.3941 0.825 0.156 0.000 0.844
#> SRR2926027 1 0.0000 1.000 1.000 0.000 0.000
#> SRR2926028 1 0.0000 1.000 1.000 0.000 0.000
#> SRR2926026 1 0.0000 1.000 1.000 0.000 0.000
#> SRR2926025 1 0.0000 1.000 1.000 0.000 0.000
#> SRR2926023 1 0.0000 1.000 1.000 0.000 0.000
#> SRR2926022 1 0.0000 1.000 1.000 0.000 0.000
#> SRR2926024 1 0.0000 1.000 1.000 0.000 0.000
#> SRR2926021 1 0.0000 1.000 1.000 0.000 0.000
#> SRR2926020 1 0.0000 1.000 1.000 0.000 0.000
#> SRR2926019 1 0.0000 1.000 1.000 0.000 0.000
#> SRR2926018 1 0.0000 1.000 1.000 0.000 0.000
#> SRR2926017 1 0.0000 1.000 1.000 0.000 0.000
#> SRR2926016 2 0.0000 1.000 0.000 1.000 0.000
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> SRR2926066 3 0.0921 0.933 0.000 0.000 0.972 0.028
#> SRR2926067 4 0.3900 0.577 0.000 0.020 0.164 0.816
#> SRR2926063 3 0.0921 0.933 0.000 0.000 0.972 0.028
#> SRR2926064 4 0.4304 0.727 0.000 0.284 0.000 0.716
#> SRR2926062 4 0.4855 0.660 0.000 0.400 0.000 0.600
#> SRR2926061 2 0.3625 0.752 0.000 0.828 0.012 0.160
#> SRR2926065 4 0.2281 0.769 0.000 0.096 0.000 0.904
#> SRR2926060 4 0.3074 0.792 0.000 0.152 0.000 0.848
#> SRR2926059 3 0.3024 0.860 0.000 0.000 0.852 0.148
#> SRR2926058 3 0.3074 0.859 0.000 0.000 0.848 0.152
#> SRR2926056 3 0.1302 0.920 0.000 0.000 0.956 0.044
#> SRR2926057 3 0.3074 0.859 0.000 0.000 0.848 0.152
#> SRR2926055 4 0.3668 0.641 0.000 0.004 0.188 0.808
#> SRR2926054 3 0.0000 0.933 0.000 0.000 1.000 0.000
#> SRR2926051 3 0.0921 0.933 0.000 0.000 0.972 0.028
#> SRR2926052 3 0.0469 0.934 0.000 0.000 0.988 0.012
#> SRR2926053 3 0.2216 0.903 0.000 0.000 0.908 0.092
#> SRR2926050 3 0.0188 0.933 0.000 0.000 0.996 0.004
#> SRR2926049 2 0.0188 0.919 0.000 0.996 0.000 0.004
#> SRR2926047 2 0.0000 0.920 0.000 1.000 0.000 0.000
#> SRR2926046 3 0.0707 0.934 0.000 0.000 0.980 0.020
#> SRR2926048 2 0.0188 0.918 0.000 0.996 0.000 0.004
#> SRR2926044 2 0.3074 0.771 0.000 0.848 0.000 0.152
#> SRR2926045 3 0.3311 0.846 0.000 0.000 0.828 0.172
#> SRR2926041 2 0.0000 0.920 0.000 1.000 0.000 0.000
#> SRR2926042 2 0.1022 0.894 0.000 0.968 0.000 0.032
#> SRR2926040 2 0.0188 0.919 0.000 0.996 0.000 0.004
#> SRR2926039 4 0.3123 0.792 0.000 0.156 0.000 0.844
#> SRR2926043 4 0.4250 0.782 0.000 0.276 0.000 0.724
#> SRR2926038 4 0.4866 0.654 0.000 0.404 0.000 0.596
#> SRR2926036 2 0.0000 0.920 0.000 1.000 0.000 0.000
#> SRR2926037 2 0.0188 0.919 0.000 0.996 0.000 0.004
#> SRR2926035 2 0.0000 0.920 0.000 1.000 0.000 0.000
#> SRR2926034 4 0.4134 0.787 0.000 0.260 0.000 0.740
#> SRR2926032 2 0.0469 0.913 0.000 0.988 0.000 0.012
#> SRR2926031 1 0.1211 0.973 0.960 0.000 0.000 0.040
#> SRR2926033 2 0.4661 0.344 0.000 0.652 0.000 0.348
#> SRR2926030 1 0.0000 0.990 1.000 0.000 0.000 0.000
#> SRR2926029 3 0.1635 0.916 0.008 0.000 0.948 0.044
#> SRR2926027 1 0.0000 0.990 1.000 0.000 0.000 0.000
#> SRR2926028 1 0.1211 0.973 0.960 0.000 0.000 0.040
#> SRR2926026 1 0.0000 0.990 1.000 0.000 0.000 0.000
#> SRR2926025 1 0.0000 0.990 1.000 0.000 0.000 0.000
#> SRR2926023 1 0.0000 0.990 1.000 0.000 0.000 0.000
#> SRR2926022 1 0.0000 0.990 1.000 0.000 0.000 0.000
#> SRR2926024 1 0.0000 0.990 1.000 0.000 0.000 0.000
#> SRR2926021 1 0.1211 0.973 0.960 0.000 0.000 0.040
#> SRR2926020 1 0.0000 0.990 1.000 0.000 0.000 0.000
#> SRR2926019 1 0.0000 0.990 1.000 0.000 0.000 0.000
#> SRR2926018 1 0.0000 0.990 1.000 0.000 0.000 0.000
#> SRR2926017 1 0.1211 0.973 0.960 0.000 0.000 0.040
#> SRR2926016 4 0.4250 0.779 0.000 0.276 0.000 0.724
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> SRR2926066 3 0.2171 0.603 0.000 0.000 0.912 0.024 0.064
#> SRR2926067 5 0.6964 0.000 0.000 0.012 0.232 0.328 0.428
#> SRR2926063 3 0.2482 0.590 0.000 0.000 0.892 0.024 0.084
#> SRR2926064 4 0.3424 0.728 0.000 0.240 0.000 0.760 0.000
#> SRR2926062 4 0.3857 0.703 0.000 0.312 0.000 0.688 0.000
#> SRR2926061 2 0.6279 0.470 0.000 0.596 0.032 0.108 0.264
#> SRR2926065 4 0.1410 0.698 0.000 0.060 0.000 0.940 0.000
#> SRR2926060 4 0.1965 0.744 0.000 0.096 0.000 0.904 0.000
#> SRR2926059 3 0.4819 0.520 0.000 0.000 0.716 0.092 0.192
#> SRR2926058 3 0.5394 0.520 0.000 0.000 0.628 0.092 0.280
#> SRR2926056 3 0.4045 0.496 0.000 0.000 0.644 0.000 0.356
#> SRR2926057 3 0.5394 0.520 0.000 0.000 0.628 0.092 0.280
#> SRR2926055 4 0.6618 -0.761 0.000 0.008 0.168 0.452 0.372
#> SRR2926054 3 0.1121 0.624 0.000 0.000 0.956 0.000 0.044
#> SRR2926051 3 0.2482 0.589 0.000 0.000 0.892 0.024 0.084
#> SRR2926052 3 0.1638 0.611 0.000 0.000 0.932 0.004 0.064
#> SRR2926053 3 0.6088 -0.406 0.000 0.000 0.492 0.128 0.380
#> SRR2926050 3 0.2488 0.628 0.000 0.000 0.872 0.004 0.124
#> SRR2926049 2 0.0324 0.841 0.000 0.992 0.000 0.004 0.004
#> SRR2926047 2 0.0290 0.839 0.000 0.992 0.000 0.008 0.000
#> SRR2926046 3 0.2921 0.629 0.000 0.000 0.856 0.020 0.124
#> SRR2926048 2 0.0290 0.839 0.000 0.992 0.000 0.008 0.000
#> SRR2926044 2 0.4548 0.647 0.000 0.748 0.000 0.096 0.156
#> SRR2926045 3 0.6245 -0.510 0.000 0.000 0.440 0.144 0.416
#> SRR2926041 2 0.0000 0.841 0.000 1.000 0.000 0.000 0.000
#> SRR2926042 2 0.3074 0.619 0.000 0.804 0.000 0.196 0.000
#> SRR2926040 2 0.0324 0.841 0.000 0.992 0.000 0.004 0.004
#> SRR2926039 4 0.1965 0.744 0.000 0.096 0.000 0.904 0.000
#> SRR2926043 4 0.2966 0.772 0.000 0.184 0.000 0.816 0.000
#> SRR2926038 4 0.3932 0.679 0.000 0.328 0.000 0.672 0.000
#> SRR2926036 2 0.0000 0.841 0.000 1.000 0.000 0.000 0.000
#> SRR2926037 2 0.0324 0.841 0.000 0.992 0.000 0.004 0.004
#> SRR2926035 2 0.0000 0.841 0.000 1.000 0.000 0.000 0.000
#> SRR2926034 4 0.2732 0.768 0.000 0.160 0.000 0.840 0.000
#> SRR2926032 2 0.2020 0.758 0.000 0.900 0.000 0.100 0.000
#> SRR2926031 1 0.3913 0.741 0.676 0.000 0.000 0.000 0.324
#> SRR2926033 2 0.6771 -0.269 0.000 0.392 0.000 0.324 0.284
#> SRR2926030 1 0.0000 0.897 1.000 0.000 0.000 0.000 0.000
#> SRR2926029 3 0.4291 0.390 0.000 0.000 0.536 0.000 0.464
#> SRR2926027 1 0.1732 0.869 0.920 0.000 0.000 0.000 0.080
#> SRR2926028 1 0.3999 0.724 0.656 0.000 0.000 0.000 0.344
#> SRR2926026 1 0.0000 0.897 1.000 0.000 0.000 0.000 0.000
#> SRR2926025 1 0.0404 0.894 0.988 0.000 0.000 0.000 0.012
#> SRR2926023 1 0.0000 0.897 1.000 0.000 0.000 0.000 0.000
#> SRR2926022 1 0.0000 0.897 1.000 0.000 0.000 0.000 0.000
#> SRR2926024 1 0.0000 0.897 1.000 0.000 0.000 0.000 0.000
#> SRR2926021 1 0.3913 0.741 0.676 0.000 0.000 0.000 0.324
#> SRR2926020 1 0.0000 0.897 1.000 0.000 0.000 0.000 0.000
#> SRR2926019 1 0.0000 0.897 1.000 0.000 0.000 0.000 0.000
#> SRR2926018 1 0.0000 0.897 1.000 0.000 0.000 0.000 0.000
#> SRR2926017 1 0.3895 0.744 0.680 0.000 0.000 0.000 0.320
#> SRR2926016 4 0.3366 0.765 0.000 0.212 0.000 0.784 0.004
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> SRR2926066 3 0.4205 0.00246 0.000 0.000 0.564 0.000 0.016 0.420
#> SRR2926067 3 0.5669 0.38759 0.000 0.000 0.624 0.160 0.180 0.036
#> SRR2926063 3 0.3984 0.12789 0.000 0.000 0.648 0.000 0.016 0.336
#> SRR2926064 4 0.2473 0.87390 0.000 0.136 0.000 0.856 0.000 0.008
#> SRR2926062 4 0.3309 0.75244 0.000 0.280 0.000 0.720 0.000 0.000
#> SRR2926061 6 0.5382 -0.17110 0.000 0.436 0.004 0.072 0.008 0.480
#> SRR2926065 4 0.0291 0.83409 0.000 0.004 0.000 0.992 0.000 0.004
#> SRR2926060 4 0.1219 0.87997 0.000 0.048 0.000 0.948 0.000 0.004
#> SRR2926059 6 0.3141 0.43372 0.000 0.000 0.124 0.040 0.004 0.832
#> SRR2926058 6 0.1297 0.51792 0.000 0.000 0.012 0.040 0.000 0.948
#> SRR2926056 6 0.5630 0.29027 0.000 0.000 0.260 0.000 0.204 0.536
#> SRR2926057 6 0.1297 0.51792 0.000 0.000 0.012 0.040 0.000 0.948
#> SRR2926055 3 0.5534 0.35746 0.000 0.000 0.556 0.248 0.196 0.000
#> SRR2926054 3 0.4083 -0.04577 0.000 0.000 0.532 0.000 0.008 0.460
#> SRR2926051 3 0.4172 0.18112 0.000 0.000 0.680 0.000 0.040 0.280
#> SRR2926052 3 0.4161 -0.03998 0.000 0.000 0.540 0.000 0.012 0.448
#> SRR2926053 3 0.4694 0.41114 0.000 0.000 0.740 0.072 0.132 0.056
#> SRR2926050 6 0.3725 0.33928 0.000 0.000 0.316 0.000 0.008 0.676
#> SRR2926049 2 0.0725 0.90978 0.000 0.976 0.012 0.000 0.012 0.000
#> SRR2926047 2 0.0260 0.91206 0.000 0.992 0.000 0.000 0.008 0.000
#> SRR2926046 6 0.4110 0.26501 0.000 0.000 0.376 0.000 0.016 0.608
#> SRR2926048 2 0.0291 0.91247 0.000 0.992 0.000 0.004 0.004 0.000
#> SRR2926044 2 0.4788 0.48158 0.000 0.648 0.000 0.068 0.008 0.276
#> SRR2926045 3 0.4769 0.41461 0.000 0.000 0.724 0.080 0.156 0.040
#> SRR2926041 2 0.0000 0.91299 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2926042 2 0.2933 0.68201 0.000 0.796 0.000 0.200 0.004 0.000
#> SRR2926040 2 0.0725 0.90978 0.000 0.976 0.012 0.000 0.012 0.000
#> SRR2926039 4 0.1285 0.88230 0.000 0.052 0.000 0.944 0.000 0.004
#> SRR2926043 4 0.2003 0.89237 0.000 0.116 0.000 0.884 0.000 0.000
#> SRR2926038 4 0.3151 0.79271 0.000 0.252 0.000 0.748 0.000 0.000
#> SRR2926036 2 0.0146 0.91302 0.000 0.996 0.000 0.004 0.000 0.000
#> SRR2926037 2 0.0725 0.90978 0.000 0.976 0.012 0.000 0.012 0.000
#> SRR2926035 2 0.0146 0.91302 0.000 0.996 0.000 0.004 0.000 0.000
#> SRR2926034 4 0.1556 0.89192 0.000 0.080 0.000 0.920 0.000 0.000
#> SRR2926032 2 0.2146 0.81613 0.000 0.880 0.000 0.116 0.004 0.000
#> SRR2926031 5 0.3446 0.76540 0.308 0.000 0.000 0.000 0.692 0.000
#> SRR2926033 3 0.7497 0.13943 0.000 0.304 0.340 0.180 0.176 0.000
#> SRR2926030 1 0.0146 0.95187 0.996 0.000 0.000 0.000 0.004 0.000
#> SRR2926029 5 0.5219 0.18787 0.000 0.000 0.176 0.000 0.612 0.212
#> SRR2926027 1 0.2854 0.62440 0.792 0.000 0.000 0.000 0.208 0.000
#> SRR2926028 5 0.3271 0.75929 0.232 0.000 0.000 0.000 0.760 0.008
#> SRR2926026 1 0.0000 0.95487 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2926025 1 0.1501 0.87148 0.924 0.000 0.000 0.000 0.076 0.000
#> SRR2926023 1 0.0000 0.95487 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2926022 1 0.0146 0.95236 0.996 0.000 0.000 0.000 0.004 0.000
#> SRR2926024 1 0.0000 0.95487 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2926021 5 0.3446 0.76859 0.308 0.000 0.000 0.000 0.692 0.000
#> SRR2926020 1 0.0000 0.95487 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2926019 1 0.0000 0.95487 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2926018 1 0.0000 0.95487 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2926017 5 0.3592 0.72682 0.344 0.000 0.000 0.000 0.656 0.000
#> SRR2926016 4 0.3192 0.87616 0.000 0.136 0.016 0.828 0.020 0.000
Heatmaps for the consensus matrix. It visualizes the probability of two samples to be in a same group.
consensus_heatmap(res, k = 2)
consensus_heatmap(res, k = 3)
consensus_heatmap(res, k = 4)
consensus_heatmap(res, k = 5)
consensus_heatmap(res, k = 6)
Heatmaps for the membership of samples in all partitions to see how consistent they are:
membership_heatmap(res, k = 2)
membership_heatmap(res, k = 3)
membership_heatmap(res, k = 4)
membership_heatmap(res, k = 5)
membership_heatmap(res, k = 6)
As soon as we have had the classes for columns, we can look for signatures which are significantly different between classes which can be candidate marks for certain classes. Following are the heatmaps for signatures.
Signature heatmaps where rows are scaled:
get_signatures(res, k = 2)
get_signatures(res, k = 3)
get_signatures(res, k = 4)
get_signatures(res, k = 5)
get_signatures(res, k = 6)
Signature heatmaps where rows are not scaled:
get_signatures(res, k = 2, scale_rows = FALSE)
get_signatures(res, k = 3, scale_rows = FALSE)
get_signatures(res, k = 4, scale_rows = FALSE)
get_signatures(res, k = 5, scale_rows = FALSE)
get_signatures(res, k = 6, scale_rows = FALSE)
Compare the overlap of signatures from different k:
compare_signatures(res)
get_signature()
returns a data frame invisibly. TO get the list of signatures, the function
call should be assigned to a variable explicitly. In following code, if plot
argument is set
to FALSE
, no heatmap is plotted while only the differential analysis is performed.
# code only for demonstration
tb = get_signature(res, k = ..., plot = FALSE)
An example of the output of tb
is:
#> which_row fdr mean_1 mean_2 scaled_mean_1 scaled_mean_2 km
#> 1 38 0.042760348 8.373488 9.131774 -0.5533452 0.5164555 1
#> 2 40 0.018707592 7.106213 8.469186 -0.6173731 0.5762149 1
#> 3 55 0.019134737 10.221463 11.207825 -0.6159697 0.5749050 1
#> 4 59 0.006059896 5.921854 7.869574 -0.6899429 0.6439467 1
#> 5 60 0.018055526 8.928898 10.211722 -0.6204761 0.5791110 1
#> 6 98 0.009384629 15.714769 14.887706 0.6635654 -0.6193277 2
...
The columns in tb
are:
which_row
: row indices corresponding to the input matrix.fdr
: FDR for the differential test. mean_x
: The mean value in group x.scaled_mean_x
: The mean value in group x after rows are scaled.km
: Row groups if k-means clustering is applied to rows.UMAP plot which shows how samples are separated.
dimension_reduction(res, k = 2, method = "UMAP")
dimension_reduction(res, k = 3, method = "UMAP")
dimension_reduction(res, k = 4, method = "UMAP")
dimension_reduction(res, k = 5, method = "UMAP")
dimension_reduction(res, k = 6, method = "UMAP")
Following heatmap shows how subgroups are split when increasing k
:
collect_classes(res)
If matrix rows can be associated to genes, consider to use functional_enrichment(res,
...)
to perform function enrichment for the signature genes. See this vignette for more detailed explanations.
The object with results only for a single top-value method and a single partition method can be extracted as:
res = res_list["SD", "pam"]
# you can also extract it by
# res = res_list["SD:pam"]
A summary of res
and all the functions that can be applied to it:
res
#> A 'ConsensusPartition' object with k = 2, 3, 4, 5, 6.
#> On a matrix with 18096 rows and 52 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 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.977 0.992 0.4117 0.581 0.581
#> 3 3 0.976 0.929 0.971 0.6222 0.720 0.529
#> 4 4 0.698 0.605 0.774 0.0949 0.898 0.715
#> 5 5 0.741 0.641 0.802 0.0609 0.905 0.693
#> 6 6 0.747 0.554 0.716 0.0492 0.931 0.713
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
#> SRR2926066 2 0.000 1.000 0.000 1.000
#> SRR2926067 2 0.000 1.000 0.000 1.000
#> SRR2926063 2 0.000 1.000 0.000 1.000
#> SRR2926064 2 0.000 1.000 0.000 1.000
#> SRR2926062 2 0.000 1.000 0.000 1.000
#> SRR2926061 2 0.000 1.000 0.000 1.000
#> SRR2926065 2 0.000 1.000 0.000 1.000
#> SRR2926060 2 0.000 1.000 0.000 1.000
#> SRR2926059 2 0.000 1.000 0.000 1.000
#> SRR2926058 2 0.000 1.000 0.000 1.000
#> SRR2926056 1 0.985 0.252 0.572 0.428
#> SRR2926057 2 0.000 1.000 0.000 1.000
#> SRR2926055 2 0.000 1.000 0.000 1.000
#> SRR2926054 2 0.000 1.000 0.000 1.000
#> SRR2926051 2 0.000 1.000 0.000 1.000
#> SRR2926052 2 0.000 1.000 0.000 1.000
#> SRR2926053 2 0.000 1.000 0.000 1.000
#> SRR2926050 2 0.000 1.000 0.000 1.000
#> SRR2926049 2 0.000 1.000 0.000 1.000
#> SRR2926047 2 0.000 1.000 0.000 1.000
#> SRR2926046 2 0.000 1.000 0.000 1.000
#> SRR2926048 2 0.000 1.000 0.000 1.000
#> SRR2926044 2 0.000 1.000 0.000 1.000
#> SRR2926045 2 0.000 1.000 0.000 1.000
#> SRR2926041 2 0.000 1.000 0.000 1.000
#> SRR2926042 2 0.000 1.000 0.000 1.000
#> SRR2926040 2 0.000 1.000 0.000 1.000
#> SRR2926039 2 0.000 1.000 0.000 1.000
#> SRR2926043 2 0.000 1.000 0.000 1.000
#> SRR2926038 2 0.000 1.000 0.000 1.000
#> SRR2926036 2 0.000 1.000 0.000 1.000
#> SRR2926037 2 0.000 1.000 0.000 1.000
#> SRR2926035 2 0.000 1.000 0.000 1.000
#> SRR2926034 2 0.000 1.000 0.000 1.000
#> SRR2926032 2 0.000 1.000 0.000 1.000
#> SRR2926031 1 0.000 0.969 1.000 0.000
#> SRR2926033 2 0.000 1.000 0.000 1.000
#> SRR2926030 1 0.000 0.969 1.000 0.000
#> SRR2926029 2 0.000 1.000 0.000 1.000
#> SRR2926027 1 0.000 0.969 1.000 0.000
#> SRR2926028 1 0.000 0.969 1.000 0.000
#> SRR2926026 1 0.000 0.969 1.000 0.000
#> SRR2926025 1 0.000 0.969 1.000 0.000
#> SRR2926023 1 0.000 0.969 1.000 0.000
#> SRR2926022 1 0.000 0.969 1.000 0.000
#> SRR2926024 1 0.000 0.969 1.000 0.000
#> SRR2926021 1 0.000 0.969 1.000 0.000
#> SRR2926020 1 0.000 0.969 1.000 0.000
#> SRR2926019 1 0.000 0.969 1.000 0.000
#> SRR2926018 1 0.000 0.969 1.000 0.000
#> SRR2926017 1 0.000 0.969 1.000 0.000
#> SRR2926016 2 0.000 1.000 0.000 1.000
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> SRR2926066 3 0.0000 0.915 0.000 0.000 1.000
#> SRR2926067 3 0.5254 0.654 0.000 0.264 0.736
#> SRR2926063 3 0.0000 0.915 0.000 0.000 1.000
#> SRR2926064 2 0.0000 1.000 0.000 1.000 0.000
#> SRR2926062 2 0.0000 1.000 0.000 1.000 0.000
#> SRR2926061 2 0.0237 0.996 0.000 0.996 0.004
#> SRR2926065 3 0.6286 0.232 0.000 0.464 0.536
#> SRR2926060 2 0.0000 1.000 0.000 1.000 0.000
#> SRR2926059 3 0.0237 0.914 0.000 0.004 0.996
#> SRR2926058 3 0.0237 0.914 0.000 0.004 0.996
#> SRR2926056 3 0.0000 0.915 0.000 0.000 1.000
#> SRR2926057 3 0.0237 0.914 0.000 0.004 0.996
#> SRR2926055 3 0.1031 0.902 0.000 0.024 0.976
#> SRR2926054 3 0.0000 0.915 0.000 0.000 1.000
#> SRR2926051 3 0.0000 0.915 0.000 0.000 1.000
#> SRR2926052 3 0.0000 0.915 0.000 0.000 1.000
#> SRR2926053 3 0.0000 0.915 0.000 0.000 1.000
#> SRR2926050 3 0.0000 0.915 0.000 0.000 1.000
#> SRR2926049 2 0.0000 1.000 0.000 1.000 0.000
#> SRR2926047 2 0.0000 1.000 0.000 1.000 0.000
#> SRR2926046 3 0.0000 0.915 0.000 0.000 1.000
#> SRR2926048 2 0.0000 1.000 0.000 1.000 0.000
#> SRR2926044 2 0.0000 1.000 0.000 1.000 0.000
#> SRR2926045 3 0.1529 0.890 0.000 0.040 0.960
#> SRR2926041 2 0.0000 1.000 0.000 1.000 0.000
#> SRR2926042 2 0.0000 1.000 0.000 1.000 0.000
#> SRR2926040 2 0.0000 1.000 0.000 1.000 0.000
#> SRR2926039 2 0.0000 1.000 0.000 1.000 0.000
#> SRR2926043 2 0.0000 1.000 0.000 1.000 0.000
#> SRR2926038 2 0.0000 1.000 0.000 1.000 0.000
#> SRR2926036 2 0.0000 1.000 0.000 1.000 0.000
#> SRR2926037 2 0.0000 1.000 0.000 1.000 0.000
#> SRR2926035 2 0.0000 1.000 0.000 1.000 0.000
#> SRR2926034 2 0.0000 1.000 0.000 1.000 0.000
#> SRR2926032 2 0.0000 1.000 0.000 1.000 0.000
#> SRR2926031 1 0.0000 0.984 1.000 0.000 0.000
#> SRR2926033 3 0.6295 0.209 0.000 0.472 0.528
#> SRR2926030 1 0.0000 0.984 1.000 0.000 0.000
#> SRR2926029 3 0.0000 0.915 0.000 0.000 1.000
#> SRR2926027 1 0.0000 0.984 1.000 0.000 0.000
#> SRR2926028 1 0.0000 0.984 1.000 0.000 0.000
#> SRR2926026 1 0.0000 0.984 1.000 0.000 0.000
#> SRR2926025 1 0.0000 0.984 1.000 0.000 0.000
#> SRR2926023 1 0.0000 0.984 1.000 0.000 0.000
#> SRR2926022 1 0.0000 0.984 1.000 0.000 0.000
#> SRR2926024 1 0.0000 0.984 1.000 0.000 0.000
#> SRR2926021 1 0.0000 0.984 1.000 0.000 0.000
#> SRR2926020 1 0.0000 0.984 1.000 0.000 0.000
#> SRR2926019 1 0.0000 0.984 1.000 0.000 0.000
#> SRR2926018 1 0.0000 0.984 1.000 0.000 0.000
#> SRR2926017 1 0.4605 0.743 0.796 0.000 0.204
#> SRR2926016 2 0.0000 1.000 0.000 1.000 0.000
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> SRR2926066 3 0.4564 0.7217 0.000 0.000 0.672 0.328
#> SRR2926067 2 0.5220 0.2941 0.000 0.568 0.008 0.424
#> SRR2926063 4 0.4941 -0.1638 0.000 0.000 0.436 0.564
#> SRR2926064 2 0.4916 0.6408 0.000 0.576 0.000 0.424
#> SRR2926062 2 0.2281 0.7411 0.000 0.904 0.000 0.096
#> SRR2926061 2 0.2530 0.7367 0.000 0.888 0.000 0.112
#> SRR2926065 4 0.4356 -0.2981 0.000 0.292 0.000 0.708
#> SRR2926060 2 0.4916 0.6408 0.000 0.576 0.000 0.424
#> SRR2926059 4 0.6763 -0.0176 0.000 0.320 0.116 0.564
#> SRR2926058 3 0.7919 0.2300 0.000 0.320 0.352 0.328
#> SRR2926056 3 0.4564 0.7217 0.000 0.000 0.672 0.328
#> SRR2926057 3 0.7919 0.2300 0.000 0.320 0.352 0.328
#> SRR2926055 4 0.0817 0.2383 0.000 0.024 0.000 0.976
#> SRR2926054 4 0.4941 -0.1638 0.000 0.000 0.436 0.564
#> SRR2926051 3 0.4888 0.5954 0.000 0.000 0.588 0.412
#> SRR2926052 3 0.4866 0.6039 0.000 0.000 0.596 0.404
#> SRR2926053 4 0.4916 -0.1400 0.000 0.000 0.424 0.576
#> SRR2926050 3 0.4564 0.7217 0.000 0.000 0.672 0.328
#> SRR2926049 2 0.4585 0.6425 0.000 0.668 0.000 0.332
#> SRR2926047 2 0.0188 0.7458 0.000 0.996 0.000 0.004
#> SRR2926046 3 0.4564 0.7217 0.000 0.000 0.672 0.328
#> SRR2926048 2 0.0000 0.7446 0.000 1.000 0.000 0.000
#> SRR2926044 2 0.4643 0.5002 0.000 0.656 0.000 0.344
#> SRR2926045 4 0.5913 0.0968 0.000 0.048 0.352 0.600
#> SRR2926041 2 0.0469 0.7445 0.000 0.988 0.000 0.012
#> SRR2926042 2 0.2408 0.7393 0.000 0.896 0.000 0.104
#> SRR2926040 2 0.0469 0.7445 0.000 0.988 0.000 0.012
#> SRR2926039 2 0.4916 0.6408 0.000 0.576 0.000 0.424
#> SRR2926043 2 0.4916 0.6408 0.000 0.576 0.000 0.424
#> SRR2926038 2 0.4522 0.6426 0.000 0.680 0.000 0.320
#> SRR2926036 2 0.0469 0.7445 0.000 0.988 0.000 0.012
#> SRR2926037 2 0.1118 0.7480 0.000 0.964 0.000 0.036
#> SRR2926035 2 0.0469 0.7445 0.000 0.988 0.000 0.012
#> SRR2926034 2 0.4866 0.6587 0.000 0.596 0.000 0.404
#> SRR2926032 2 0.0817 0.7484 0.000 0.976 0.000 0.024
#> SRR2926031 1 0.4564 0.7830 0.672 0.000 0.328 0.000
#> SRR2926033 2 0.4817 0.4153 0.000 0.612 0.000 0.388
#> SRR2926030 1 0.0000 0.9066 1.000 0.000 0.000 0.000
#> SRR2926029 3 0.4564 0.7217 0.000 0.000 0.672 0.328
#> SRR2926027 1 0.0000 0.9066 1.000 0.000 0.000 0.000
#> SRR2926028 1 0.4564 0.7830 0.672 0.000 0.328 0.000
#> SRR2926026 1 0.0000 0.9066 1.000 0.000 0.000 0.000
#> SRR2926025 1 0.2973 0.8613 0.856 0.000 0.144 0.000
#> SRR2926023 1 0.0000 0.9066 1.000 0.000 0.000 0.000
#> SRR2926022 1 0.0000 0.9066 1.000 0.000 0.000 0.000
#> SRR2926024 1 0.0000 0.9066 1.000 0.000 0.000 0.000
#> SRR2926021 1 0.4564 0.7830 0.672 0.000 0.328 0.000
#> SRR2926020 1 0.0000 0.9066 1.000 0.000 0.000 0.000
#> SRR2926019 1 0.0000 0.9066 1.000 0.000 0.000 0.000
#> SRR2926018 1 0.0000 0.9066 1.000 0.000 0.000 0.000
#> SRR2926017 1 0.4790 0.7366 0.620 0.000 0.380 0.000
#> SRR2926016 2 0.4941 0.6397 0.000 0.564 0.000 0.436
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> SRR2926066 3 0.4294 0.737 0.000 0.000 0.532 0.468 0.000
#> SRR2926067 4 0.5744 0.376 0.000 0.104 0.332 0.564 0.000
#> SRR2926063 4 0.0880 0.315 0.000 0.000 0.032 0.968 0.000
#> SRR2926064 2 0.0000 0.663 0.000 1.000 0.000 0.000 0.000
#> SRR2926062 2 0.3949 0.736 0.000 0.668 0.332 0.000 0.000
#> SRR2926061 2 0.4235 0.725 0.000 0.656 0.336 0.008 0.000
#> SRR2926065 4 0.4648 0.361 0.000 0.464 0.012 0.524 0.000
#> SRR2926060 2 0.0000 0.663 0.000 1.000 0.000 0.000 0.000
#> SRR2926059 4 0.4101 0.349 0.000 0.000 0.372 0.628 0.000
#> SRR2926058 3 0.2280 0.389 0.000 0.000 0.880 0.120 0.000
#> SRR2926056 3 0.4287 0.742 0.000 0.000 0.540 0.460 0.000
#> SRR2926057 3 0.2280 0.389 0.000 0.000 0.880 0.120 0.000
#> SRR2926055 4 0.4517 0.375 0.000 0.436 0.008 0.556 0.000
#> SRR2926054 4 0.2516 0.142 0.000 0.000 0.140 0.860 0.000
#> SRR2926051 4 0.4283 -0.673 0.000 0.000 0.456 0.544 0.000
#> SRR2926052 4 0.4291 -0.678 0.000 0.000 0.464 0.536 0.000
#> SRR2926053 4 0.0000 0.342 0.000 0.000 0.000 1.000 0.000
#> SRR2926050 3 0.4273 0.737 0.000 0.000 0.552 0.448 0.000
#> SRR2926049 2 0.2624 0.665 0.000 0.872 0.116 0.012 0.000
#> SRR2926047 2 0.4242 0.750 0.000 0.572 0.428 0.000 0.000
#> SRR2926046 3 0.4291 0.740 0.000 0.000 0.536 0.464 0.000
#> SRR2926048 2 0.4256 0.747 0.000 0.564 0.436 0.000 0.000
#> SRR2926044 2 0.6826 0.123 0.000 0.336 0.332 0.332 0.000
#> SRR2926045 4 0.1732 0.398 0.000 0.080 0.000 0.920 0.000
#> SRR2926041 2 0.4622 0.746 0.000 0.548 0.440 0.012 0.000
#> SRR2926042 2 0.3895 0.735 0.000 0.680 0.320 0.000 0.000
#> SRR2926040 2 0.4617 0.747 0.000 0.552 0.436 0.012 0.000
#> SRR2926039 2 0.0000 0.663 0.000 1.000 0.000 0.000 0.000
#> SRR2926043 2 0.0000 0.663 0.000 1.000 0.000 0.000 0.000
#> SRR2926038 2 0.2230 0.665 0.000 0.884 0.116 0.000 0.000
#> SRR2926036 2 0.4617 0.747 0.000 0.552 0.436 0.012 0.000
#> SRR2926037 2 0.4565 0.751 0.000 0.580 0.408 0.012 0.000
#> SRR2926035 2 0.4617 0.747 0.000 0.552 0.436 0.012 0.000
#> SRR2926034 2 0.1568 0.672 0.000 0.944 0.036 0.020 0.000
#> SRR2926032 2 0.4201 0.752 0.000 0.592 0.408 0.000 0.000
#> SRR2926031 5 0.0000 0.997 0.000 0.000 0.000 0.000 1.000
#> SRR2926033 4 0.6022 0.327 0.000 0.136 0.324 0.540 0.000
#> SRR2926030 1 0.0000 0.981 1.000 0.000 0.000 0.000 0.000
#> SRR2926029 3 0.4287 0.742 0.000 0.000 0.540 0.460 0.000
#> SRR2926027 1 0.0000 0.981 1.000 0.000 0.000 0.000 0.000
#> SRR2926028 5 0.0000 0.997 0.000 0.000 0.000 0.000 1.000
#> SRR2926026 1 0.0000 0.981 1.000 0.000 0.000 0.000 0.000
#> SRR2926025 1 0.2852 0.793 0.828 0.000 0.000 0.000 0.172
#> SRR2926023 1 0.0000 0.981 1.000 0.000 0.000 0.000 0.000
#> SRR2926022 1 0.0000 0.981 1.000 0.000 0.000 0.000 0.000
#> SRR2926024 1 0.0000 0.981 1.000 0.000 0.000 0.000 0.000
#> SRR2926021 5 0.0000 0.997 0.000 0.000 0.000 0.000 1.000
#> SRR2926020 1 0.0000 0.981 1.000 0.000 0.000 0.000 0.000
#> SRR2926019 1 0.0000 0.981 1.000 0.000 0.000 0.000 0.000
#> SRR2926018 1 0.0000 0.981 1.000 0.000 0.000 0.000 0.000
#> SRR2926017 5 0.0324 0.991 0.000 0.000 0.004 0.004 0.992
#> SRR2926016 2 0.0404 0.661 0.000 0.988 0.000 0.012 0.000
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> SRR2926066 6 0.3862 0.6555 0.000 0.000 0.476 0.000 0.000 0.524
#> SRR2926067 3 0.3971 0.3095 0.000 0.000 0.548 0.448 0.000 0.004
#> SRR2926063 3 0.0713 0.3212 0.000 0.000 0.972 0.000 0.000 0.028
#> SRR2926064 4 0.3515 0.5495 0.000 0.000 0.000 0.676 0.000 0.324
#> SRR2926062 4 0.0291 0.5093 0.000 0.004 0.000 0.992 0.000 0.004
#> SRR2926061 4 0.2664 0.4180 0.000 0.000 0.016 0.848 0.000 0.136
#> SRR2926065 3 0.6340 -0.1101 0.000 0.008 0.344 0.320 0.000 0.328
#> SRR2926060 4 0.3652 0.5486 0.000 0.000 0.004 0.672 0.000 0.324
#> SRR2926059 3 0.5872 0.3071 0.000 0.012 0.508 0.324 0.000 0.156
#> SRR2926058 6 0.3852 0.3461 0.000 0.012 0.000 0.324 0.000 0.664
#> SRR2926056 6 0.3851 0.6683 0.000 0.000 0.460 0.000 0.000 0.540
#> SRR2926057 6 0.3852 0.3461 0.000 0.012 0.000 0.324 0.000 0.664
#> SRR2926055 3 0.5378 0.2197 0.000 0.000 0.544 0.132 0.000 0.324
#> SRR2926054 3 0.2357 0.1602 0.000 0.012 0.872 0.000 0.000 0.116
#> SRR2926051 3 0.3843 -0.6033 0.000 0.000 0.548 0.000 0.000 0.452
#> SRR2926052 3 0.3843 -0.6019 0.000 0.000 0.548 0.000 0.000 0.452
#> SRR2926053 3 0.0000 0.3429 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2926050 6 0.3547 0.6200 0.000 0.000 0.332 0.000 0.000 0.668
#> SRR2926049 2 0.3428 0.9059 0.000 0.696 0.000 0.304 0.000 0.000
#> SRR2926047 4 0.3351 0.0310 0.000 0.288 0.000 0.712 0.000 0.000
#> SRR2926046 6 0.3854 0.6666 0.000 0.000 0.464 0.000 0.000 0.536
#> SRR2926048 2 0.3428 0.9059 0.000 0.696 0.000 0.304 0.000 0.000
#> SRR2926044 4 0.3426 0.3280 0.000 0.012 0.220 0.764 0.000 0.004
#> SRR2926045 3 0.0000 0.3429 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2926041 2 0.3547 0.8998 0.000 0.696 0.000 0.300 0.000 0.004
#> SRR2926042 4 0.0000 0.5109 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR2926040 2 0.3428 0.9059 0.000 0.696 0.000 0.304 0.000 0.000
#> SRR2926039 4 0.3515 0.5495 0.000 0.000 0.000 0.676 0.000 0.324
#> SRR2926043 4 0.3515 0.5495 0.000 0.000 0.000 0.676 0.000 0.324
#> SRR2926038 2 0.6125 0.2039 0.000 0.356 0.000 0.320 0.000 0.324
#> SRR2926036 2 0.3428 0.9059 0.000 0.696 0.000 0.304 0.000 0.000
#> SRR2926037 4 0.3607 -0.1382 0.000 0.348 0.000 0.652 0.000 0.000
#> SRR2926035 2 0.3428 0.9059 0.000 0.696 0.000 0.304 0.000 0.000
#> SRR2926034 4 0.3974 0.5472 0.000 0.000 0.024 0.680 0.000 0.296
#> SRR2926032 4 0.3266 0.0756 0.000 0.272 0.000 0.728 0.000 0.000
#> SRR2926031 5 0.0000 0.9334 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR2926033 3 0.3982 0.2917 0.000 0.000 0.536 0.460 0.000 0.004
#> SRR2926030 1 0.0000 0.9807 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2926029 6 0.3851 0.6683 0.000 0.000 0.460 0.000 0.000 0.540
#> SRR2926027 1 0.0000 0.9807 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2926028 5 0.3371 0.7987 0.000 0.292 0.000 0.000 0.708 0.000
#> SRR2926026 1 0.0000 0.9807 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2926025 1 0.2562 0.7962 0.828 0.000 0.000 0.000 0.172 0.000
#> SRR2926023 1 0.0000 0.9807 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2926022 1 0.0000 0.9807 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2926024 1 0.0000 0.9807 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2926021 5 0.0000 0.9334 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR2926020 1 0.0000 0.9807 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2926019 1 0.0000 0.9807 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2926018 1 0.0000 0.9807 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2926017 5 0.0260 0.9302 0.000 0.000 0.000 0.000 0.992 0.008
#> SRR2926016 4 0.3515 0.5495 0.000 0.000 0.000 0.676 0.000 0.324
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 18096 rows and 52 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 0.989 0.995 0.4064 0.599 0.599
#> 3 3 0.697 0.846 0.917 0.5395 0.755 0.591
#> 4 4 0.736 0.836 0.919 0.1198 0.916 0.771
#> 5 5 0.763 0.740 0.876 0.1190 0.889 0.639
#> 6 6 0.861 0.771 0.890 0.0667 0.941 0.721
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
#> SRR2926066 2 0.000 0.992 0.000 1.000
#> SRR2926067 2 0.000 0.992 0.000 1.000
#> SRR2926063 2 0.000 0.992 0.000 1.000
#> SRR2926064 2 0.000 0.992 0.000 1.000
#> SRR2926062 2 0.000 0.992 0.000 1.000
#> SRR2926061 2 0.000 0.992 0.000 1.000
#> SRR2926065 2 0.000 0.992 0.000 1.000
#> SRR2926060 2 0.000 0.992 0.000 1.000
#> SRR2926059 2 0.000 0.992 0.000 1.000
#> SRR2926058 2 0.000 0.992 0.000 1.000
#> SRR2926056 2 0.574 0.847 0.136 0.864
#> SRR2926057 2 0.000 0.992 0.000 1.000
#> SRR2926055 2 0.000 0.992 0.000 1.000
#> SRR2926054 2 0.000 0.992 0.000 1.000
#> SRR2926051 2 0.000 0.992 0.000 1.000
#> SRR2926052 2 0.000 0.992 0.000 1.000
#> SRR2926053 2 0.000 0.992 0.000 1.000
#> SRR2926050 2 0.000 0.992 0.000 1.000
#> SRR2926049 2 0.000 0.992 0.000 1.000
#> SRR2926047 2 0.000 0.992 0.000 1.000
#> SRR2926046 2 0.000 0.992 0.000 1.000
#> SRR2926048 2 0.000 0.992 0.000 1.000
#> SRR2926044 2 0.000 0.992 0.000 1.000
#> SRR2926045 2 0.000 0.992 0.000 1.000
#> SRR2926041 2 0.000 0.992 0.000 1.000
#> SRR2926042 2 0.000 0.992 0.000 1.000
#> SRR2926040 2 0.000 0.992 0.000 1.000
#> SRR2926039 2 0.000 0.992 0.000 1.000
#> SRR2926043 2 0.000 0.992 0.000 1.000
#> SRR2926038 2 0.000 0.992 0.000 1.000
#> SRR2926036 2 0.000 0.992 0.000 1.000
#> SRR2926037 2 0.000 0.992 0.000 1.000
#> SRR2926035 2 0.000 0.992 0.000 1.000
#> SRR2926034 2 0.000 0.992 0.000 1.000
#> SRR2926032 2 0.000 0.992 0.000 1.000
#> SRR2926031 1 0.000 1.000 1.000 0.000
#> SRR2926033 2 0.000 0.992 0.000 1.000
#> SRR2926030 1 0.000 1.000 1.000 0.000
#> SRR2926029 2 0.595 0.836 0.144 0.856
#> SRR2926027 1 0.000 1.000 1.000 0.000
#> SRR2926028 1 0.000 1.000 1.000 0.000
#> SRR2926026 1 0.000 1.000 1.000 0.000
#> SRR2926025 1 0.000 1.000 1.000 0.000
#> SRR2926023 1 0.000 1.000 1.000 0.000
#> SRR2926022 1 0.000 1.000 1.000 0.000
#> SRR2926024 1 0.000 1.000 1.000 0.000
#> SRR2926021 1 0.000 1.000 1.000 0.000
#> SRR2926020 1 0.000 1.000 1.000 0.000
#> SRR2926019 1 0.000 1.000 1.000 0.000
#> SRR2926018 1 0.000 1.000 1.000 0.000
#> SRR2926017 1 0.000 1.000 1.000 0.000
#> SRR2926016 2 0.000 0.992 0.000 1.000
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> SRR2926066 3 0.3116 0.82330 0.000 0.108 0.892
#> SRR2926067 2 0.4796 0.73501 0.000 0.780 0.220
#> SRR2926063 3 0.3038 0.82174 0.000 0.104 0.896
#> SRR2926064 2 0.1643 0.91834 0.000 0.956 0.044
#> SRR2926062 2 0.0000 0.92643 0.000 1.000 0.000
#> SRR2926061 2 0.4452 0.77502 0.000 0.808 0.192
#> SRR2926065 2 0.1753 0.91672 0.000 0.952 0.048
#> SRR2926060 2 0.1753 0.91672 0.000 0.952 0.048
#> SRR2926059 3 0.6244 0.30035 0.000 0.440 0.560
#> SRR2926058 3 0.4121 0.79639 0.000 0.168 0.832
#> SRR2926056 3 0.5178 0.40824 0.256 0.000 0.744
#> SRR2926057 3 0.4002 0.80317 0.000 0.160 0.840
#> SRR2926055 2 0.4931 0.71660 0.000 0.768 0.232
#> SRR2926054 3 0.3412 0.82462 0.000 0.124 0.876
#> SRR2926051 3 0.3267 0.82463 0.000 0.116 0.884
#> SRR2926052 3 0.3412 0.82462 0.000 0.124 0.876
#> SRR2926053 3 0.6215 0.33295 0.000 0.428 0.572
#> SRR2926050 3 0.3412 0.82462 0.000 0.124 0.876
#> SRR2926049 2 0.0000 0.92643 0.000 1.000 0.000
#> SRR2926047 2 0.0000 0.92643 0.000 1.000 0.000
#> SRR2926046 3 0.1529 0.77404 0.000 0.040 0.960
#> SRR2926048 2 0.0000 0.92643 0.000 1.000 0.000
#> SRR2926044 2 0.4178 0.79996 0.000 0.828 0.172
#> SRR2926045 2 0.5431 0.61769 0.000 0.716 0.284
#> SRR2926041 2 0.0000 0.92643 0.000 1.000 0.000
#> SRR2926042 2 0.0000 0.92643 0.000 1.000 0.000
#> SRR2926040 2 0.0000 0.92643 0.000 1.000 0.000
#> SRR2926039 2 0.1643 0.91834 0.000 0.956 0.044
#> SRR2926043 2 0.1643 0.91834 0.000 0.956 0.044
#> SRR2926038 2 0.0000 0.92643 0.000 1.000 0.000
#> SRR2926036 2 0.0000 0.92643 0.000 1.000 0.000
#> SRR2926037 2 0.0000 0.92643 0.000 1.000 0.000
#> SRR2926035 2 0.0000 0.92643 0.000 1.000 0.000
#> SRR2926034 2 0.1753 0.91672 0.000 0.952 0.048
#> SRR2926032 2 0.0000 0.92643 0.000 1.000 0.000
#> SRR2926031 1 0.3267 0.89899 0.884 0.000 0.116
#> SRR2926033 2 0.2261 0.90359 0.000 0.932 0.068
#> SRR2926030 1 0.0000 0.98180 1.000 0.000 0.000
#> SRR2926029 3 0.6421 0.00553 0.424 0.004 0.572
#> SRR2926027 1 0.0424 0.97718 0.992 0.000 0.008
#> SRR2926028 1 0.0000 0.98180 1.000 0.000 0.000
#> SRR2926026 1 0.0000 0.98180 1.000 0.000 0.000
#> SRR2926025 1 0.0000 0.98180 1.000 0.000 0.000
#> SRR2926023 1 0.0000 0.98180 1.000 0.000 0.000
#> SRR2926022 1 0.0000 0.98180 1.000 0.000 0.000
#> SRR2926024 1 0.0000 0.98180 1.000 0.000 0.000
#> SRR2926021 1 0.0424 0.97718 0.992 0.000 0.008
#> SRR2926020 1 0.0000 0.98180 1.000 0.000 0.000
#> SRR2926019 1 0.0000 0.98180 1.000 0.000 0.000
#> SRR2926018 1 0.0000 0.98180 1.000 0.000 0.000
#> SRR2926017 1 0.3619 0.88213 0.864 0.000 0.136
#> SRR2926016 2 0.0424 0.91992 0.000 0.992 0.008
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> SRR2926066 3 0.0469 0.922 0.000 0.000 0.988 0.012
#> SRR2926067 2 0.5284 0.542 0.000 0.616 0.368 0.016
#> SRR2926063 3 0.0000 0.929 0.000 0.000 1.000 0.000
#> SRR2926064 2 0.3401 0.843 0.000 0.840 0.152 0.008
#> SRR2926062 2 0.0000 0.880 0.000 1.000 0.000 0.000
#> SRR2926061 2 0.4482 0.732 0.000 0.728 0.264 0.008
#> SRR2926065 2 0.3545 0.836 0.000 0.828 0.164 0.008
#> SRR2926060 2 0.3591 0.834 0.000 0.824 0.168 0.008
#> SRR2926059 3 0.1059 0.920 0.000 0.012 0.972 0.016
#> SRR2926058 3 0.0672 0.926 0.000 0.008 0.984 0.008
#> SRR2926056 4 0.1042 0.944 0.008 0.000 0.020 0.972
#> SRR2926057 3 0.0336 0.928 0.000 0.008 0.992 0.000
#> SRR2926055 2 0.5284 0.542 0.000 0.616 0.368 0.016
#> SRR2926054 3 0.0188 0.929 0.000 0.004 0.996 0.000
#> SRR2926051 3 0.0000 0.929 0.000 0.000 1.000 0.000
#> SRR2926052 3 0.0000 0.929 0.000 0.000 1.000 0.000
#> SRR2926053 3 0.1059 0.920 0.000 0.012 0.972 0.016
#> SRR2926050 3 0.0000 0.929 0.000 0.000 1.000 0.000
#> SRR2926049 2 0.0000 0.880 0.000 1.000 0.000 0.000
#> SRR2926047 2 0.0000 0.880 0.000 1.000 0.000 0.000
#> SRR2926046 3 0.0000 0.929 0.000 0.000 1.000 0.000
#> SRR2926048 2 0.0000 0.880 0.000 1.000 0.000 0.000
#> SRR2926044 2 0.4123 0.786 0.000 0.772 0.220 0.008
#> SRR2926045 3 0.5508 -0.217 0.000 0.476 0.508 0.016
#> SRR2926041 2 0.0000 0.880 0.000 1.000 0.000 0.000
#> SRR2926042 2 0.0000 0.880 0.000 1.000 0.000 0.000
#> SRR2926040 2 0.0000 0.880 0.000 1.000 0.000 0.000
#> SRR2926039 2 0.3401 0.843 0.000 0.840 0.152 0.008
#> SRR2926043 2 0.3300 0.846 0.000 0.848 0.144 0.008
#> SRR2926038 2 0.0000 0.880 0.000 1.000 0.000 0.000
#> SRR2926036 2 0.0000 0.880 0.000 1.000 0.000 0.000
#> SRR2926037 2 0.0000 0.880 0.000 1.000 0.000 0.000
#> SRR2926035 2 0.0188 0.877 0.000 0.996 0.000 0.004
#> SRR2926034 2 0.3636 0.832 0.000 0.820 0.172 0.008
#> SRR2926032 2 0.0000 0.880 0.000 1.000 0.000 0.000
#> SRR2926031 4 0.2530 0.895 0.112 0.000 0.000 0.888
#> SRR2926033 2 0.3636 0.832 0.000 0.820 0.172 0.008
#> SRR2926030 1 0.4941 0.131 0.564 0.000 0.000 0.436
#> SRR2926029 4 0.0779 0.953 0.016 0.000 0.004 0.980
#> SRR2926027 4 0.1209 0.950 0.032 0.000 0.004 0.964
#> SRR2926028 4 0.2589 0.892 0.116 0.000 0.000 0.884
#> SRR2926026 1 0.0000 0.905 1.000 0.000 0.000 0.000
#> SRR2926025 1 0.3907 0.646 0.768 0.000 0.000 0.232
#> SRR2926023 1 0.0000 0.905 1.000 0.000 0.000 0.000
#> SRR2926022 1 0.0000 0.905 1.000 0.000 0.000 0.000
#> SRR2926024 1 0.0000 0.905 1.000 0.000 0.000 0.000
#> SRR2926021 4 0.0707 0.953 0.020 0.000 0.000 0.980
#> SRR2926020 1 0.0000 0.905 1.000 0.000 0.000 0.000
#> SRR2926019 1 0.0000 0.905 1.000 0.000 0.000 0.000
#> SRR2926018 1 0.0000 0.905 1.000 0.000 0.000 0.000
#> SRR2926017 4 0.0927 0.953 0.016 0.000 0.008 0.976
#> SRR2926016 2 0.1389 0.848 0.000 0.952 0.000 0.048
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> SRR2926066 3 0.2127 0.8649 0.000 0.000 0.892 0.000 0.108
#> SRR2926067 4 0.3535 0.6621 0.000 0.028 0.164 0.808 0.000
#> SRR2926063 3 0.0000 0.9551 0.000 0.000 1.000 0.000 0.000
#> SRR2926064 2 0.4227 0.4013 0.000 0.580 0.000 0.420 0.000
#> SRR2926062 2 0.3242 0.7300 0.000 0.784 0.000 0.216 0.000
#> SRR2926061 4 0.1399 0.6856 0.000 0.028 0.020 0.952 0.000
#> SRR2926065 4 0.4350 0.1010 0.000 0.408 0.004 0.588 0.000
#> SRR2926060 4 0.4210 0.0765 0.000 0.412 0.000 0.588 0.000
#> SRR2926059 3 0.2450 0.8849 0.000 0.028 0.896 0.076 0.000
#> SRR2926058 3 0.1195 0.9403 0.000 0.028 0.960 0.012 0.000
#> SRR2926056 5 0.1792 0.8656 0.000 0.000 0.084 0.000 0.916
#> SRR2926057 3 0.1300 0.9377 0.000 0.028 0.956 0.016 0.000
#> SRR2926055 4 0.3687 0.6472 0.000 0.028 0.180 0.792 0.000
#> SRR2926054 3 0.0162 0.9545 0.000 0.000 0.996 0.004 0.000
#> SRR2926051 3 0.0000 0.9551 0.000 0.000 1.000 0.000 0.000
#> SRR2926052 3 0.0000 0.9551 0.000 0.000 1.000 0.000 0.000
#> SRR2926053 3 0.1907 0.9140 0.000 0.028 0.928 0.044 0.000
#> SRR2926050 3 0.0000 0.9551 0.000 0.000 1.000 0.000 0.000
#> SRR2926049 2 0.0703 0.7675 0.000 0.976 0.000 0.024 0.000
#> SRR2926047 2 0.3305 0.7233 0.000 0.776 0.000 0.224 0.000
#> SRR2926046 3 0.0000 0.9551 0.000 0.000 1.000 0.000 0.000
#> SRR2926048 2 0.2424 0.7670 0.000 0.868 0.000 0.132 0.000
#> SRR2926044 4 0.1399 0.6856 0.000 0.028 0.020 0.952 0.000
#> SRR2926045 4 0.3993 0.5982 0.000 0.028 0.216 0.756 0.000
#> SRR2926041 2 0.0000 0.7590 0.000 1.000 0.000 0.000 0.000
#> SRR2926042 2 0.3143 0.7380 0.000 0.796 0.000 0.204 0.000
#> SRR2926040 2 0.0000 0.7590 0.000 1.000 0.000 0.000 0.000
#> SRR2926039 2 0.4302 0.2512 0.000 0.520 0.000 0.480 0.000
#> SRR2926043 2 0.4302 0.2512 0.000 0.520 0.000 0.480 0.000
#> SRR2926038 2 0.2127 0.7711 0.000 0.892 0.000 0.108 0.000
#> SRR2926036 2 0.0703 0.7675 0.000 0.976 0.000 0.024 0.000
#> SRR2926037 2 0.0162 0.7607 0.000 0.996 0.000 0.004 0.000
#> SRR2926035 2 0.0000 0.7590 0.000 1.000 0.000 0.000 0.000
#> SRR2926034 4 0.4201 0.0925 0.000 0.408 0.000 0.592 0.000
#> SRR2926032 2 0.3305 0.7233 0.000 0.776 0.000 0.224 0.000
#> SRR2926031 5 0.0794 0.8951 0.028 0.000 0.000 0.000 0.972
#> SRR2926033 4 0.1493 0.6864 0.000 0.028 0.024 0.948 0.000
#> SRR2926030 1 0.4668 0.4120 0.624 0.024 0.000 0.000 0.352
#> SRR2926029 5 0.1195 0.8913 0.000 0.000 0.012 0.028 0.960
#> SRR2926027 5 0.2516 0.8692 0.140 0.000 0.000 0.000 0.860
#> SRR2926028 5 0.0000 0.8940 0.000 0.000 0.000 0.000 1.000
#> SRR2926026 1 0.0000 0.9069 1.000 0.000 0.000 0.000 0.000
#> SRR2926025 1 0.3730 0.5216 0.712 0.000 0.000 0.000 0.288
#> SRR2926023 1 0.0000 0.9069 1.000 0.000 0.000 0.000 0.000
#> SRR2926022 1 0.0000 0.9069 1.000 0.000 0.000 0.000 0.000
#> SRR2926024 1 0.0000 0.9069 1.000 0.000 0.000 0.000 0.000
#> SRR2926021 5 0.2471 0.8722 0.136 0.000 0.000 0.000 0.864
#> SRR2926020 1 0.0000 0.9069 1.000 0.000 0.000 0.000 0.000
#> SRR2926019 1 0.0000 0.9069 1.000 0.000 0.000 0.000 0.000
#> SRR2926018 1 0.0000 0.9069 1.000 0.000 0.000 0.000 0.000
#> SRR2926017 5 0.3283 0.8683 0.140 0.000 0.000 0.028 0.832
#> SRR2926016 2 0.4168 0.6100 0.000 0.756 0.000 0.044 0.200
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> SRR2926066 3 0.0000 0.8615 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2926067 6 0.0146 0.8546 0.000 0.000 0.000 0.004 0.000 0.996
#> SRR2926063 3 0.0146 0.8628 0.000 0.000 0.996 0.000 0.000 0.004
#> SRR2926064 4 0.2883 0.6653 0.000 0.212 0.000 0.788 0.000 0.000
#> SRR2926062 4 0.3864 -0.0478 0.000 0.480 0.000 0.520 0.000 0.000
#> SRR2926061 6 0.2933 0.8380 0.000 0.004 0.000 0.200 0.000 0.796
#> SRR2926065 4 0.1471 0.7919 0.000 0.004 0.000 0.932 0.000 0.064
#> SRR2926060 4 0.1471 0.7919 0.000 0.004 0.000 0.932 0.000 0.064
#> SRR2926059 3 0.3797 0.5385 0.000 0.000 0.580 0.000 0.000 0.420
#> SRR2926058 3 0.2996 0.7729 0.000 0.000 0.772 0.000 0.000 0.228
#> SRR2926056 5 0.2793 0.8202 0.000 0.000 0.200 0.000 0.800 0.000
#> SRR2926057 3 0.2969 0.7760 0.000 0.000 0.776 0.000 0.000 0.224
#> SRR2926055 6 0.0146 0.8546 0.000 0.000 0.000 0.004 0.000 0.996
#> SRR2926054 3 0.0937 0.8598 0.000 0.000 0.960 0.000 0.000 0.040
#> SRR2926051 3 0.0790 0.8606 0.000 0.000 0.968 0.000 0.000 0.032
#> SRR2926052 3 0.0146 0.8628 0.000 0.000 0.996 0.000 0.000 0.004
#> SRR2926053 3 0.3782 0.5526 0.000 0.000 0.588 0.000 0.000 0.412
#> SRR2926050 3 0.0405 0.8634 0.000 0.000 0.988 0.000 0.004 0.008
#> SRR2926049 2 0.0909 0.8493 0.000 0.968 0.000 0.012 0.000 0.020
#> SRR2926047 2 0.3843 0.0884 0.000 0.548 0.000 0.452 0.000 0.000
#> SRR2926046 3 0.0146 0.8613 0.000 0.000 0.996 0.000 0.004 0.000
#> SRR2926048 2 0.0790 0.8442 0.000 0.968 0.000 0.032 0.000 0.000
#> SRR2926044 6 0.2933 0.8380 0.000 0.004 0.000 0.200 0.000 0.796
#> SRR2926045 6 0.0146 0.8546 0.000 0.000 0.000 0.004 0.000 0.996
#> SRR2926041 2 0.0547 0.8483 0.000 0.980 0.000 0.000 0.000 0.020
#> SRR2926042 2 0.2823 0.6689 0.000 0.796 0.000 0.204 0.000 0.000
#> SRR2926040 2 0.0000 0.8436 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2926039 4 0.1387 0.8125 0.000 0.068 0.000 0.932 0.000 0.000
#> SRR2926043 4 0.1387 0.8125 0.000 0.068 0.000 0.932 0.000 0.000
#> SRR2926038 2 0.0790 0.8442 0.000 0.968 0.000 0.032 0.000 0.000
#> SRR2926036 2 0.0790 0.8445 0.000 0.968 0.000 0.000 0.000 0.032
#> SRR2926037 2 0.0909 0.8462 0.000 0.968 0.000 0.012 0.000 0.020
#> SRR2926035 2 0.0632 0.8478 0.000 0.976 0.000 0.000 0.000 0.024
#> SRR2926034 4 0.1471 0.7919 0.000 0.004 0.000 0.932 0.000 0.064
#> SRR2926032 2 0.3868 -0.0846 0.000 0.504 0.000 0.496 0.000 0.000
#> SRR2926031 5 0.0000 0.9092 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR2926033 6 0.2933 0.8380 0.000 0.004 0.000 0.200 0.000 0.796
#> SRR2926030 1 0.4378 0.3364 0.600 0.032 0.000 0.000 0.368 0.000
#> SRR2926029 5 0.2416 0.8451 0.000 0.000 0.156 0.000 0.844 0.000
#> SRR2926027 5 0.2307 0.9015 0.032 0.000 0.000 0.068 0.896 0.004
#> SRR2926028 5 0.0000 0.9092 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR2926026 1 0.0146 0.9055 0.996 0.004 0.000 0.000 0.000 0.000
#> SRR2926025 1 0.3426 0.5933 0.720 0.000 0.000 0.004 0.276 0.000
#> SRR2926023 1 0.0000 0.9081 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2926022 1 0.0000 0.9081 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2926024 1 0.0000 0.9081 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2926021 5 0.0790 0.9061 0.032 0.000 0.000 0.000 0.968 0.000
#> SRR2926020 1 0.0000 0.9081 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2926019 1 0.0000 0.9081 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2926018 1 0.0000 0.9081 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2926017 5 0.2307 0.9015 0.032 0.000 0.000 0.068 0.896 0.004
#> SRR2926016 2 0.1297 0.8128 0.000 0.948 0.000 0.012 0.040 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 18096 rows and 52 columns.
#> Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'SD' method.
#> Subgroups are detected by 'NMF' method.
#> Performed in total 1250 partitions by row resampling.
#> Best k for subgroups seems to be 3.
#>
#> Following methods can be applied to this 'ConsensusPartition' object:
#> [1] "cola_report" "collect_classes" "collect_plots"
#> [4] "collect_stats" "colnames" "compare_signatures"
#> [7] "consensus_heatmap" "dimension_reduction" "functional_enrichment"
#> [10] "get_anno_col" "get_anno" "get_classes"
#> [13] "get_consensus" "get_matrix" "get_membership"
#> [16] "get_param" "get_signatures" "get_stats"
#> [19] "is_best_k" "is_stable_k" "membership_heatmap"
#> [22] "ncol" "nrow" "plot_ecdf"
#> [25] "rownames" "select_partition_number" "show"
#> [28] "suggest_best_k" "test_to_known_factors"
collect_plots()
function collects all the plots made from res
for all k
(number of partitions)
into one single page to provide an easy and fast comparison between different k
.
collect_plots(res)
The plots are:
k
and the heatmap of
predicted classes for each k
.k
.k
.k
.All the plots in panels can be made by individual functions and they are plotted later in this section.
select_partition_number()
produces several plots showing different
statistics for choosing “optimized” k
. There are following statistics:
k
;k
, the area increased is defined as \(A_k - A_{k-1}\).The detailed explanations of these statistics can be found in the cola vignette.
Generally speaking, lower PAC score, higher mean silhouette score or higher
concordance corresponds to better partition. Rand index and Jaccard index
measure how similar the current partition is compared to partition with k-1
.
If they are too similar, we won't accept k
is better than k-1
.
select_partition_number(res)
The numeric values for all these statistics can be obtained by get_stats()
.
get_stats(res)
#> k 1-PAC mean_silhouette concordance area_increased Rand Jaccard
#> 2 2 0.881 0.890 0.960 0.4674 0.538 0.538
#> 3 3 1.000 0.989 0.995 0.4287 0.722 0.517
#> 4 4 0.821 0.447 0.796 0.0905 0.916 0.760
#> 5 5 0.851 0.867 0.906 0.0692 0.838 0.503
#> 6 6 0.802 0.678 0.832 0.0505 0.920 0.649
suggest_best_k()
suggests the best \(k\) based on these statistics. The rules are as follows:
suggest_best_k(res)
#> [1] 3
Following shows the table of the partitions (You need to click the show/hide
code output link to see it). The membership matrix (columns with name p*
)
is inferred by
clue::cl_consensus()
function with the SE
method. Basically the value in the membership matrix
represents the probability to belong to a certain group. The finall class
label for an item is determined with the group with highest probability it
belongs to.
In get_classes()
function, the entropy is calculated from the membership
matrix and the silhouette score is calculated from the consensus matrix.
cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#> class entropy silhouette p1 p2
#> SRR2926066 1 0.913 0.4938 0.672 0.328
#> SRR2926067 2 0.000 0.9527 0.000 1.000
#> SRR2926063 1 0.904 0.5117 0.680 0.320
#> SRR2926064 2 0.000 0.9527 0.000 1.000
#> SRR2926062 2 0.000 0.9527 0.000 1.000
#> SRR2926061 2 0.000 0.9527 0.000 1.000
#> SRR2926065 2 0.000 0.9527 0.000 1.000
#> SRR2926060 2 0.000 0.9527 0.000 1.000
#> SRR2926059 2 0.000 0.9527 0.000 1.000
#> SRR2926058 2 0.000 0.9527 0.000 1.000
#> SRR2926056 1 0.000 0.9583 1.000 0.000
#> SRR2926057 2 0.000 0.9527 0.000 1.000
#> SRR2926055 2 0.000 0.9527 0.000 1.000
#> SRR2926054 2 0.000 0.9527 0.000 1.000
#> SRR2926051 2 1.000 0.0332 0.488 0.512
#> SRR2926052 2 0.529 0.8287 0.120 0.880
#> SRR2926053 2 0.000 0.9527 0.000 1.000
#> SRR2926050 2 0.939 0.4296 0.356 0.644
#> SRR2926049 2 0.000 0.9527 0.000 1.000
#> SRR2926047 2 0.000 0.9527 0.000 1.000
#> SRR2926046 2 0.999 0.0487 0.484 0.516
#> SRR2926048 2 0.000 0.9527 0.000 1.000
#> SRR2926044 2 0.000 0.9527 0.000 1.000
#> SRR2926045 2 0.000 0.9527 0.000 1.000
#> SRR2926041 2 0.000 0.9527 0.000 1.000
#> SRR2926042 2 0.000 0.9527 0.000 1.000
#> SRR2926040 2 0.000 0.9527 0.000 1.000
#> SRR2926039 2 0.000 0.9527 0.000 1.000
#> SRR2926043 2 0.000 0.9527 0.000 1.000
#> SRR2926038 2 0.000 0.9527 0.000 1.000
#> SRR2926036 2 0.000 0.9527 0.000 1.000
#> SRR2926037 2 0.000 0.9527 0.000 1.000
#> SRR2926035 2 0.000 0.9527 0.000 1.000
#> SRR2926034 2 0.000 0.9527 0.000 1.000
#> SRR2926032 2 0.000 0.9527 0.000 1.000
#> SRR2926031 1 0.000 0.9583 1.000 0.000
#> SRR2926033 2 0.000 0.9527 0.000 1.000
#> SRR2926030 1 0.000 0.9583 1.000 0.000
#> SRR2926029 1 0.000 0.9583 1.000 0.000
#> SRR2926027 1 0.000 0.9583 1.000 0.000
#> SRR2926028 1 0.000 0.9583 1.000 0.000
#> SRR2926026 1 0.000 0.9583 1.000 0.000
#> SRR2926025 1 0.000 0.9583 1.000 0.000
#> SRR2926023 1 0.000 0.9583 1.000 0.000
#> SRR2926022 1 0.000 0.9583 1.000 0.000
#> SRR2926024 1 0.000 0.9583 1.000 0.000
#> SRR2926021 1 0.000 0.9583 1.000 0.000
#> SRR2926020 1 0.000 0.9583 1.000 0.000
#> SRR2926019 1 0.000 0.9583 1.000 0.000
#> SRR2926018 1 0.000 0.9583 1.000 0.000
#> SRR2926017 1 0.000 0.9583 1.000 0.000
#> SRR2926016 2 0.000 0.9527 0.000 1.000
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> SRR2926066 3 0.0000 0.997 0.000 0.000 1.000
#> SRR2926067 3 0.0000 0.997 0.000 0.000 1.000
#> SRR2926063 3 0.0000 0.997 0.000 0.000 1.000
#> SRR2926064 2 0.0000 0.989 0.000 1.000 0.000
#> SRR2926062 2 0.0000 0.989 0.000 1.000 0.000
#> SRR2926061 2 0.2625 0.908 0.000 0.916 0.084
#> SRR2926065 2 0.0000 0.989 0.000 1.000 0.000
#> SRR2926060 2 0.0000 0.989 0.000 1.000 0.000
#> SRR2926059 3 0.0237 0.993 0.000 0.004 0.996
#> SRR2926058 3 0.0000 0.997 0.000 0.000 1.000
#> SRR2926056 3 0.0000 0.997 0.000 0.000 1.000
#> SRR2926057 3 0.0000 0.997 0.000 0.000 1.000
#> SRR2926055 3 0.1163 0.968 0.000 0.028 0.972
#> SRR2926054 3 0.0000 0.997 0.000 0.000 1.000
#> SRR2926051 3 0.0000 0.997 0.000 0.000 1.000
#> SRR2926052 3 0.0000 0.997 0.000 0.000 1.000
#> SRR2926053 3 0.0000 0.997 0.000 0.000 1.000
#> SRR2926050 3 0.0000 0.997 0.000 0.000 1.000
#> SRR2926049 2 0.0000 0.989 0.000 1.000 0.000
#> SRR2926047 2 0.0000 0.989 0.000 1.000 0.000
#> SRR2926046 3 0.0000 0.997 0.000 0.000 1.000
#> SRR2926048 2 0.0000 0.989 0.000 1.000 0.000
#> SRR2926044 2 0.0000 0.989 0.000 1.000 0.000
#> SRR2926045 3 0.0000 0.997 0.000 0.000 1.000
#> SRR2926041 2 0.0000 0.989 0.000 1.000 0.000
#> SRR2926042 2 0.0000 0.989 0.000 1.000 0.000
#> SRR2926040 2 0.0000 0.989 0.000 1.000 0.000
#> SRR2926039 2 0.0000 0.989 0.000 1.000 0.000
#> SRR2926043 2 0.0000 0.989 0.000 1.000 0.000
#> SRR2926038 2 0.0000 0.989 0.000 1.000 0.000
#> SRR2926036 2 0.0000 0.989 0.000 1.000 0.000
#> SRR2926037 2 0.0000 0.989 0.000 1.000 0.000
#> SRR2926035 2 0.0000 0.989 0.000 1.000 0.000
#> SRR2926034 2 0.0000 0.989 0.000 1.000 0.000
#> SRR2926032 2 0.0000 0.989 0.000 1.000 0.000
#> SRR2926031 1 0.0000 1.000 1.000 0.000 0.000
#> SRR2926033 2 0.3686 0.840 0.000 0.860 0.140
#> SRR2926030 1 0.0000 1.000 1.000 0.000 0.000
#> SRR2926029 3 0.0747 0.983 0.016 0.000 0.984
#> SRR2926027 1 0.0000 1.000 1.000 0.000 0.000
#> SRR2926028 1 0.0000 1.000 1.000 0.000 0.000
#> SRR2926026 1 0.0000 1.000 1.000 0.000 0.000
#> SRR2926025 1 0.0000 1.000 1.000 0.000 0.000
#> SRR2926023 1 0.0000 1.000 1.000 0.000 0.000
#> SRR2926022 1 0.0000 1.000 1.000 0.000 0.000
#> SRR2926024 1 0.0000 1.000 1.000 0.000 0.000
#> SRR2926021 1 0.0000 1.000 1.000 0.000 0.000
#> SRR2926020 1 0.0000 1.000 1.000 0.000 0.000
#> SRR2926019 1 0.0000 1.000 1.000 0.000 0.000
#> SRR2926018 1 0.0000 1.000 1.000 0.000 0.000
#> SRR2926017 1 0.0000 1.000 1.000 0.000 0.000
#> SRR2926016 2 0.0000 0.989 0.000 1.000 0.000
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> SRR2926066 3 0.4992 -0.3827 0.000 0.000 0.524 0.476
#> SRR2926067 4 0.6010 0.2010 0.000 0.040 0.472 0.488
#> SRR2926063 3 0.4999 -0.3836 0.000 0.000 0.508 0.492
#> SRR2926064 2 0.3311 0.8116 0.000 0.828 0.172 0.000
#> SRR2926062 2 0.4193 0.7657 0.000 0.732 0.268 0.000
#> SRR2926061 2 0.1820 0.8368 0.000 0.944 0.036 0.020
#> SRR2926065 3 0.4998 -0.6231 0.000 0.488 0.512 0.000
#> SRR2926060 2 0.4916 0.6664 0.000 0.576 0.424 0.000
#> SRR2926059 3 0.4985 -0.3153 0.000 0.000 0.532 0.468
#> SRR2926058 3 0.4989 -0.3166 0.000 0.000 0.528 0.472
#> SRR2926056 4 0.5000 0.1350 0.000 0.000 0.500 0.500
#> SRR2926057 3 0.4992 -0.3217 0.000 0.000 0.524 0.476
#> SRR2926055 3 0.1284 -0.0849 0.000 0.012 0.964 0.024
#> SRR2926054 3 0.4992 -0.3231 0.000 0.000 0.524 0.476
#> SRR2926051 3 0.4994 -0.3814 0.000 0.000 0.520 0.480
#> SRR2926052 3 0.4967 -0.3225 0.000 0.000 0.548 0.452
#> SRR2926053 3 0.4999 -0.3859 0.000 0.000 0.508 0.492
#> SRR2926050 3 0.4992 -0.3231 0.000 0.000 0.524 0.476
#> SRR2926049 2 0.0000 0.8674 0.000 1.000 0.000 0.000
#> SRR2926047 2 0.0336 0.8644 0.000 0.992 0.000 0.008
#> SRR2926046 4 0.4996 0.1747 0.000 0.000 0.484 0.516
#> SRR2926048 2 0.0000 0.8674 0.000 1.000 0.000 0.000
#> SRR2926044 2 0.0336 0.8645 0.000 0.992 0.008 0.000
#> SRR2926045 3 0.4977 -0.3184 0.000 0.000 0.540 0.460
#> SRR2926041 2 0.0000 0.8674 0.000 1.000 0.000 0.000
#> SRR2926042 2 0.0000 0.8674 0.000 1.000 0.000 0.000
#> SRR2926040 2 0.0000 0.8674 0.000 1.000 0.000 0.000
#> SRR2926039 2 0.4977 0.6293 0.000 0.540 0.460 0.000
#> SRR2926043 2 0.4817 0.6907 0.000 0.612 0.388 0.000
#> SRR2926038 2 0.4564 0.7310 0.000 0.672 0.328 0.000
#> SRR2926036 2 0.0000 0.8674 0.000 1.000 0.000 0.000
#> SRR2926037 2 0.0000 0.8674 0.000 1.000 0.000 0.000
#> SRR2926035 2 0.0000 0.8674 0.000 1.000 0.000 0.000
#> SRR2926034 2 0.4925 0.6589 0.000 0.572 0.428 0.000
#> SRR2926032 2 0.0000 0.8674 0.000 1.000 0.000 0.000
#> SRR2926031 1 0.4961 0.6732 0.552 0.000 0.000 0.448
#> SRR2926033 2 0.4236 0.7308 0.000 0.824 0.088 0.088
#> SRR2926030 1 0.0000 0.8903 1.000 0.000 0.000 0.000
#> SRR2926029 4 0.2002 0.1349 0.020 0.000 0.044 0.936
#> SRR2926027 1 0.0000 0.8903 1.000 0.000 0.000 0.000
#> SRR2926028 1 0.4967 0.6703 0.548 0.000 0.000 0.452
#> SRR2926026 1 0.0000 0.8903 1.000 0.000 0.000 0.000
#> SRR2926025 1 0.0592 0.8850 0.984 0.000 0.000 0.016
#> SRR2926023 1 0.0000 0.8903 1.000 0.000 0.000 0.000
#> SRR2926022 1 0.0000 0.8903 1.000 0.000 0.000 0.000
#> SRR2926024 1 0.0000 0.8903 1.000 0.000 0.000 0.000
#> SRR2926021 1 0.4961 0.6732 0.552 0.000 0.000 0.448
#> SRR2926020 1 0.0000 0.8903 1.000 0.000 0.000 0.000
#> SRR2926019 1 0.0000 0.8903 1.000 0.000 0.000 0.000
#> SRR2926018 1 0.0000 0.8903 1.000 0.000 0.000 0.000
#> SRR2926017 1 0.4916 0.6844 0.576 0.000 0.000 0.424
#> SRR2926016 3 0.6611 -0.5950 0.000 0.456 0.464 0.080
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> SRR2926066 3 0.2130 0.914 0.000 0.000 0.908 0.080 0.012
#> SRR2926067 3 0.4576 0.731 0.000 0.096 0.764 0.132 0.008
#> SRR2926063 3 0.0992 0.933 0.000 0.000 0.968 0.024 0.008
#> SRR2926064 2 0.4249 -0.221 0.000 0.568 0.000 0.432 0.000
#> SRR2926062 4 0.3999 0.792 0.000 0.344 0.000 0.656 0.000
#> SRR2926061 2 0.1904 0.862 0.000 0.936 0.020 0.028 0.016
#> SRR2926065 4 0.3171 0.865 0.000 0.176 0.008 0.816 0.000
#> SRR2926060 4 0.3480 0.880 0.000 0.248 0.000 0.752 0.000
#> SRR2926059 3 0.1787 0.925 0.000 0.012 0.940 0.032 0.016
#> SRR2926058 3 0.1547 0.929 0.000 0.004 0.948 0.032 0.016
#> SRR2926056 3 0.0451 0.937 0.000 0.000 0.988 0.004 0.008
#> SRR2926057 3 0.1300 0.931 0.000 0.000 0.956 0.028 0.016
#> SRR2926055 4 0.3123 0.585 0.000 0.000 0.184 0.812 0.004
#> SRR2926054 3 0.0703 0.936 0.000 0.000 0.976 0.024 0.000
#> SRR2926051 3 0.1942 0.920 0.000 0.000 0.920 0.068 0.012
#> SRR2926052 3 0.1408 0.935 0.000 0.000 0.948 0.044 0.008
#> SRR2926053 3 0.1764 0.924 0.000 0.000 0.928 0.064 0.008
#> SRR2926050 3 0.1211 0.932 0.000 0.000 0.960 0.024 0.016
#> SRR2926049 2 0.0290 0.907 0.000 0.992 0.000 0.008 0.000
#> SRR2926047 2 0.0290 0.909 0.000 0.992 0.000 0.008 0.000
#> SRR2926046 3 0.1106 0.934 0.000 0.000 0.964 0.024 0.012
#> SRR2926048 2 0.0000 0.911 0.000 1.000 0.000 0.000 0.000
#> SRR2926044 2 0.1278 0.883 0.000 0.960 0.016 0.020 0.004
#> SRR2926045 3 0.1341 0.930 0.000 0.000 0.944 0.056 0.000
#> SRR2926041 2 0.0290 0.909 0.000 0.992 0.000 0.008 0.000
#> SRR2926042 2 0.0510 0.901 0.000 0.984 0.000 0.016 0.000
#> SRR2926040 2 0.0162 0.910 0.000 0.996 0.000 0.004 0.000
#> SRR2926039 4 0.3242 0.888 0.000 0.216 0.000 0.784 0.000
#> SRR2926043 4 0.3586 0.879 0.000 0.264 0.000 0.736 0.000
#> SRR2926038 4 0.3876 0.832 0.000 0.316 0.000 0.684 0.000
#> SRR2926036 2 0.0162 0.910 0.000 0.996 0.000 0.004 0.000
#> SRR2926037 2 0.0000 0.911 0.000 1.000 0.000 0.000 0.000
#> SRR2926035 2 0.0000 0.911 0.000 1.000 0.000 0.000 0.000
#> SRR2926034 4 0.3395 0.889 0.000 0.236 0.000 0.764 0.000
#> SRR2926032 2 0.0162 0.909 0.000 0.996 0.000 0.004 0.000
#> SRR2926031 5 0.1197 0.868 0.048 0.000 0.000 0.000 0.952
#> SRR2926033 2 0.5469 0.530 0.000 0.688 0.112 0.184 0.016
#> SRR2926030 1 0.0000 0.989 1.000 0.000 0.000 0.000 0.000
#> SRR2926029 5 0.2304 0.804 0.000 0.000 0.100 0.008 0.892
#> SRR2926027 1 0.0404 0.984 0.988 0.000 0.000 0.000 0.012
#> SRR2926028 5 0.1121 0.869 0.044 0.000 0.000 0.000 0.956
#> SRR2926026 1 0.0162 0.988 0.996 0.000 0.000 0.000 0.004
#> SRR2926025 1 0.1544 0.924 0.932 0.000 0.000 0.000 0.068
#> SRR2926023 1 0.0000 0.989 1.000 0.000 0.000 0.000 0.000
#> SRR2926022 1 0.0290 0.986 0.992 0.000 0.000 0.000 0.008
#> SRR2926024 1 0.0000 0.989 1.000 0.000 0.000 0.000 0.000
#> SRR2926021 5 0.1121 0.869 0.044 0.000 0.000 0.000 0.956
#> SRR2926020 1 0.0000 0.989 1.000 0.000 0.000 0.000 0.000
#> SRR2926019 1 0.0000 0.989 1.000 0.000 0.000 0.000 0.000
#> SRR2926018 1 0.0162 0.988 0.996 0.000 0.000 0.000 0.004
#> SRR2926017 5 0.6944 0.436 0.300 0.000 0.032 0.168 0.500
#> SRR2926016 4 0.3333 0.884 0.000 0.208 0.000 0.788 0.004
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> SRR2926066 3 0.4434 0.0623 0.000 0.000 0.544 0.028 0.000 0.428
#> SRR2926067 6 0.5682 0.2929 0.000 0.008 0.340 0.136 0.000 0.516
#> SRR2926063 3 0.3860 -0.0654 0.000 0.000 0.528 0.000 0.000 0.472
#> SRR2926064 4 0.6099 0.5942 0.000 0.192 0.116 0.600 0.000 0.092
#> SRR2926062 2 0.4032 0.1662 0.000 0.572 0.000 0.420 0.000 0.008
#> SRR2926061 2 0.4415 0.4094 0.000 0.556 0.420 0.004 0.000 0.020
#> SRR2926065 4 0.1592 0.8561 0.000 0.008 0.032 0.940 0.000 0.020
#> SRR2926060 4 0.1951 0.8744 0.000 0.060 0.004 0.916 0.000 0.020
#> SRR2926059 3 0.0820 0.5950 0.000 0.000 0.972 0.016 0.000 0.012
#> SRR2926058 3 0.2019 0.5258 0.000 0.000 0.900 0.012 0.000 0.088
#> SRR2926056 3 0.3136 0.5154 0.000 0.000 0.768 0.004 0.000 0.228
#> SRR2926057 3 0.0632 0.6053 0.000 0.000 0.976 0.000 0.000 0.024
#> SRR2926055 4 0.3686 0.6390 0.000 0.000 0.032 0.748 0.000 0.220
#> SRR2926054 3 0.3390 0.4358 0.000 0.000 0.704 0.000 0.000 0.296
#> SRR2926051 6 0.3982 0.0129 0.000 0.000 0.460 0.004 0.000 0.536
#> SRR2926052 3 0.2404 0.5985 0.000 0.000 0.872 0.016 0.000 0.112
#> SRR2926053 6 0.5022 0.1796 0.000 0.000 0.432 0.072 0.000 0.496
#> SRR2926050 3 0.1007 0.6145 0.000 0.000 0.956 0.000 0.000 0.044
#> SRR2926049 2 0.0405 0.8998 0.000 0.988 0.000 0.008 0.000 0.004
#> SRR2926047 2 0.0713 0.8838 0.000 0.972 0.000 0.028 0.000 0.000
#> SRR2926046 3 0.3737 0.2168 0.000 0.000 0.608 0.000 0.000 0.392
#> SRR2926048 2 0.0291 0.9008 0.000 0.992 0.000 0.004 0.000 0.004
#> SRR2926044 2 0.2048 0.8168 0.000 0.880 0.120 0.000 0.000 0.000
#> SRR2926045 6 0.5376 0.2417 0.000 0.000 0.408 0.112 0.000 0.480
#> SRR2926041 2 0.0000 0.9018 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2926042 2 0.0547 0.8953 0.000 0.980 0.000 0.020 0.000 0.000
#> SRR2926040 2 0.0000 0.9018 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2926039 4 0.0790 0.8757 0.000 0.032 0.000 0.968 0.000 0.000
#> SRR2926043 4 0.2113 0.8580 0.000 0.092 0.004 0.896 0.000 0.008
#> SRR2926038 4 0.2302 0.8429 0.000 0.120 0.000 0.872 0.000 0.008
#> SRR2926036 2 0.0260 0.8992 0.000 0.992 0.000 0.000 0.000 0.008
#> SRR2926037 2 0.0000 0.9018 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2926035 2 0.0000 0.9018 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2926034 4 0.1010 0.8766 0.000 0.036 0.000 0.960 0.000 0.004
#> SRR2926032 2 0.0520 0.8986 0.000 0.984 0.000 0.008 0.000 0.008
#> SRR2926031 5 0.0603 0.8675 0.004 0.000 0.000 0.000 0.980 0.016
#> SRR2926033 6 0.4720 0.2465 0.000 0.228 0.076 0.012 0.000 0.684
#> SRR2926030 1 0.0000 0.9831 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2926029 5 0.5241 0.4959 0.000 0.000 0.112 0.032 0.668 0.188
#> SRR2926027 1 0.0291 0.9775 0.992 0.000 0.000 0.000 0.004 0.004
#> SRR2926028 5 0.0146 0.8718 0.004 0.000 0.000 0.000 0.996 0.000
#> SRR2926026 1 0.0000 0.9831 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2926025 1 0.2260 0.8356 0.860 0.000 0.000 0.000 0.140 0.000
#> SRR2926023 1 0.0000 0.9831 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2926022 1 0.0000 0.9831 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2926024 1 0.0000 0.9831 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2926021 5 0.0146 0.8718 0.004 0.000 0.000 0.000 0.996 0.000
#> SRR2926020 1 0.0000 0.9831 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2926019 1 0.0000 0.9831 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2926018 1 0.0000 0.9831 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2926017 6 0.5698 -0.2819 0.176 0.000 0.008 0.000 0.260 0.556
#> SRR2926016 4 0.1649 0.8719 0.000 0.032 0.000 0.932 0.000 0.036
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 18096 rows and 52 columns.
#> Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'CV' method.
#> Subgroups are detected by 'hclust' method.
#> Performed in total 1250 partitions by row resampling.
#> Best k for subgroups seems to be 4.
#>
#> Following methods can be applied to this 'ConsensusPartition' object:
#> [1] "cola_report" "collect_classes" "collect_plots"
#> [4] "collect_stats" "colnames" "compare_signatures"
#> [7] "consensus_heatmap" "dimension_reduction" "functional_enrichment"
#> [10] "get_anno_col" "get_anno" "get_classes"
#> [13] "get_consensus" "get_matrix" "get_membership"
#> [16] "get_param" "get_signatures" "get_stats"
#> [19] "is_best_k" "is_stable_k" "membership_heatmap"
#> [22] "ncol" "nrow" "plot_ecdf"
#> [25] "rownames" "select_partition_number" "show"
#> [28] "suggest_best_k" "test_to_known_factors"
collect_plots()
function collects all the plots made from res
for all k
(number of partitions)
into one single page to provide an easy and fast comparison between different k
.
collect_plots(res)
The plots are:
k
and the heatmap of
predicted classes for each k
.k
.k
.k
.All the plots in panels can be made by individual functions and they are plotted later in this section.
select_partition_number()
produces several plots showing different
statistics for choosing “optimized” k
. There are following statistics:
k
;k
, the area increased is defined as \(A_k - A_{k-1}\).The detailed explanations of these statistics can be found in the cola vignette.
Generally speaking, lower PAC score, higher mean silhouette score or higher
concordance corresponds to better partition. Rand index and Jaccard index
measure how similar the current partition is compared to partition with k-1
.
If they are too similar, we won't accept k
is better than k-1
.
select_partition_number(res)
The numeric values for all these statistics can be obtained by get_stats()
.
get_stats(res)
#> k 1-PAC mean_silhouette concordance area_increased Rand Jaccard
#> 2 2 0.735 0.961 0.969 0.1457 0.855 0.855
#> 3 3 0.711 0.910 0.920 1.8623 0.657 0.599
#> 4 4 1.000 0.981 0.989 0.2448 0.973 0.947
#> 5 5 0.764 0.823 0.878 0.1417 0.998 0.995
#> 6 6 0.741 0.787 0.864 0.0322 0.997 0.994
suggest_best_k()
suggests the best \(k\) based on these statistics. The rules are as follows:
suggest_best_k(res)
#> [1] 4
Following shows the table of the partitions (You need to click the show/hide
code output link to see it). The membership matrix (columns with name p*
)
is inferred by
clue::cl_consensus()
function with the SE
method. Basically the value in the membership matrix
represents the probability to belong to a certain group. The finall class
label for an item is determined with the group with highest probability it
belongs to.
In get_classes()
function, the entropy is calculated from the membership
matrix and the silhouette score is calculated from the consensus matrix.
cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#> class entropy silhouette p1 p2
#> SRR2926066 2 0.000 0.979 0.0 1.0
#> SRR2926067 2 0.000 0.979 0.0 1.0
#> SRR2926063 2 0.000 0.979 0.0 1.0
#> SRR2926064 2 0.000 0.979 0.0 1.0
#> SRR2926062 2 0.000 0.979 0.0 1.0
#> SRR2926061 2 0.000 0.979 0.0 1.0
#> SRR2926065 2 0.000 0.979 0.0 1.0
#> SRR2926060 2 0.000 0.979 0.0 1.0
#> SRR2926059 2 0.000 0.979 0.0 1.0
#> SRR2926058 2 0.000 0.979 0.0 1.0
#> SRR2926056 2 0.000 0.979 0.0 1.0
#> SRR2926057 1 0.722 1.000 0.8 0.2
#> SRR2926055 2 0.000 0.979 0.0 1.0
#> SRR2926054 2 0.000 0.979 0.0 1.0
#> SRR2926051 2 0.000 0.979 0.0 1.0
#> SRR2926052 2 0.000 0.979 0.0 1.0
#> SRR2926053 2 0.000 0.979 0.0 1.0
#> SRR2926050 2 0.000 0.979 0.0 1.0
#> SRR2926049 2 0.000 0.979 0.0 1.0
#> SRR2926047 2 0.000 0.979 0.0 1.0
#> SRR2926046 2 0.000 0.979 0.0 1.0
#> SRR2926048 2 0.000 0.979 0.0 1.0
#> SRR2926044 2 0.000 0.979 0.0 1.0
#> SRR2926045 2 0.000 0.979 0.0 1.0
#> SRR2926041 2 0.000 0.979 0.0 1.0
#> SRR2926042 2 0.000 0.979 0.0 1.0
#> SRR2926040 2 0.000 0.979 0.0 1.0
#> SRR2926039 2 0.000 0.979 0.0 1.0
#> SRR2926043 2 0.000 0.979 0.0 1.0
#> SRR2926038 2 0.000 0.979 0.0 1.0
#> SRR2926036 2 0.000 0.979 0.0 1.0
#> SRR2926037 2 0.000 0.979 0.0 1.0
#> SRR2926035 2 0.000 0.979 0.0 1.0
#> SRR2926034 2 0.000 0.979 0.0 1.0
#> SRR2926032 2 0.000 0.979 0.0 1.0
#> SRR2926031 2 0.722 0.723 0.2 0.8
#> SRR2926033 2 0.000 0.979 0.0 1.0
#> SRR2926030 1 0.722 1.000 0.8 0.2
#> SRR2926029 1 0.722 1.000 0.8 0.2
#> SRR2926027 2 0.000 0.979 0.0 1.0
#> SRR2926028 2 0.722 0.723 0.2 0.8
#> SRR2926026 2 0.000 0.979 0.0 1.0
#> SRR2926025 2 0.722 0.723 0.2 0.8
#> SRR2926023 2 0.000 0.979 0.0 1.0
#> SRR2926022 1 0.722 1.000 0.8 0.2
#> SRR2926024 2 0.000 0.979 0.0 1.0
#> SRR2926021 2 0.722 0.723 0.2 0.8
#> SRR2926020 2 0.000 0.979 0.0 1.0
#> SRR2926019 2 0.000 0.979 0.0 1.0
#> SRR2926018 2 0.000 0.979 0.0 1.0
#> SRR2926017 2 0.000 0.979 0.0 1.0
#> SRR2926016 2 0.000 0.979 0.0 1.0
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> SRR2926066 2 0.0237 0.996 0.004 0.996 0.000
#> SRR2926067 2 0.0000 0.998 0.000 1.000 0.000
#> SRR2926063 2 0.0237 0.996 0.004 0.996 0.000
#> SRR2926064 2 0.0000 0.998 0.000 1.000 0.000
#> SRR2926062 2 0.0000 0.998 0.000 1.000 0.000
#> SRR2926061 2 0.0000 0.998 0.000 1.000 0.000
#> SRR2926065 2 0.0000 0.998 0.000 1.000 0.000
#> SRR2926060 2 0.0000 0.998 0.000 1.000 0.000
#> SRR2926059 2 0.0237 0.996 0.004 0.996 0.000
#> SRR2926058 2 0.0237 0.996 0.004 0.996 0.000
#> SRR2926056 1 0.8361 0.748 0.544 0.364 0.092
#> SRR2926057 3 0.0000 1.000 0.000 0.000 1.000
#> SRR2926055 2 0.0000 0.998 0.000 1.000 0.000
#> SRR2926054 2 0.0237 0.996 0.004 0.996 0.000
#> SRR2926051 2 0.0237 0.996 0.004 0.996 0.000
#> SRR2926052 2 0.0237 0.996 0.004 0.996 0.000
#> SRR2926053 2 0.0237 0.996 0.004 0.996 0.000
#> SRR2926050 2 0.0237 0.996 0.004 0.996 0.000
#> SRR2926049 2 0.0000 0.998 0.000 1.000 0.000
#> SRR2926047 2 0.0000 0.998 0.000 1.000 0.000
#> SRR2926046 2 0.0424 0.991 0.008 0.992 0.000
#> SRR2926048 2 0.0000 0.998 0.000 1.000 0.000
#> SRR2926044 2 0.0000 0.998 0.000 1.000 0.000
#> SRR2926045 2 0.0237 0.996 0.004 0.996 0.000
#> SRR2926041 2 0.0000 0.998 0.000 1.000 0.000
#> SRR2926042 2 0.0000 0.998 0.000 1.000 0.000
#> SRR2926040 2 0.0000 0.998 0.000 1.000 0.000
#> SRR2926039 2 0.0000 0.998 0.000 1.000 0.000
#> SRR2926043 2 0.0000 0.998 0.000 1.000 0.000
#> SRR2926038 2 0.0000 0.998 0.000 1.000 0.000
#> SRR2926036 2 0.0000 0.998 0.000 1.000 0.000
#> SRR2926037 2 0.0000 0.998 0.000 1.000 0.000
#> SRR2926035 2 0.0000 0.998 0.000 1.000 0.000
#> SRR2926034 2 0.0000 0.998 0.000 1.000 0.000
#> SRR2926032 2 0.0000 0.998 0.000 1.000 0.000
#> SRR2926031 1 0.0000 0.370 1.000 0.000 0.000
#> SRR2926033 2 0.0000 0.998 0.000 1.000 0.000
#> SRR2926030 3 0.0000 1.000 0.000 0.000 1.000
#> SRR2926029 3 0.0000 1.000 0.000 0.000 1.000
#> SRR2926027 1 0.8628 0.775 0.544 0.340 0.116
#> SRR2926028 1 0.0000 0.370 1.000 0.000 0.000
#> SRR2926026 1 0.8628 0.775 0.544 0.340 0.116
#> SRR2926025 1 0.0000 0.370 1.000 0.000 0.000
#> SRR2926023 1 0.8628 0.775 0.544 0.340 0.116
#> SRR2926022 3 0.0000 1.000 0.000 0.000 1.000
#> SRR2926024 1 0.8628 0.775 0.544 0.340 0.116
#> SRR2926021 1 0.0000 0.370 1.000 0.000 0.000
#> SRR2926020 1 0.8628 0.775 0.544 0.340 0.116
#> SRR2926019 1 0.8628 0.775 0.544 0.340 0.116
#> SRR2926018 1 0.8628 0.775 0.544 0.340 0.116
#> SRR2926017 1 0.8628 0.775 0.544 0.340 0.116
#> SRR2926016 2 0.0000 0.998 0.000 1.000 0.000
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> SRR2926066 2 0.1211 0.970 0.040 0.960 0.000 0
#> SRR2926067 2 0.0336 0.985 0.008 0.992 0.000 0
#> SRR2926063 2 0.1118 0.972 0.036 0.964 0.000 0
#> SRR2926064 2 0.0000 0.988 0.000 1.000 0.000 0
#> SRR2926062 2 0.0000 0.988 0.000 1.000 0.000 0
#> SRR2926061 2 0.0000 0.988 0.000 1.000 0.000 0
#> SRR2926065 2 0.0000 0.988 0.000 1.000 0.000 0
#> SRR2926060 2 0.0000 0.988 0.000 1.000 0.000 0
#> SRR2926059 2 0.1022 0.974 0.032 0.968 0.000 0
#> SRR2926058 2 0.1022 0.974 0.032 0.968 0.000 0
#> SRR2926056 1 0.1389 0.907 0.952 0.048 0.000 0
#> SRR2926057 3 0.0000 0.961 0.000 0.000 1.000 0
#> SRR2926055 2 0.0469 0.984 0.012 0.988 0.000 0
#> SRR2926054 2 0.1118 0.972 0.036 0.964 0.000 0
#> SRR2926051 2 0.1211 0.970 0.040 0.960 0.000 0
#> SRR2926052 2 0.1118 0.972 0.036 0.964 0.000 0
#> SRR2926053 2 0.0469 0.984 0.012 0.988 0.000 0
#> SRR2926050 2 0.1118 0.972 0.036 0.964 0.000 0
#> SRR2926049 2 0.0000 0.988 0.000 1.000 0.000 0
#> SRR2926047 2 0.0000 0.988 0.000 1.000 0.000 0
#> SRR2926046 2 0.1302 0.967 0.044 0.956 0.000 0
#> SRR2926048 2 0.0000 0.988 0.000 1.000 0.000 0
#> SRR2926044 2 0.0000 0.988 0.000 1.000 0.000 0
#> SRR2926045 2 0.1118 0.972 0.036 0.964 0.000 0
#> SRR2926041 2 0.0000 0.988 0.000 1.000 0.000 0
#> SRR2926042 2 0.0000 0.988 0.000 1.000 0.000 0
#> SRR2926040 2 0.0000 0.988 0.000 1.000 0.000 0
#> SRR2926039 2 0.0000 0.988 0.000 1.000 0.000 0
#> SRR2926043 2 0.0000 0.988 0.000 1.000 0.000 0
#> SRR2926038 2 0.0000 0.988 0.000 1.000 0.000 0
#> SRR2926036 2 0.0000 0.988 0.000 1.000 0.000 0
#> SRR2926037 2 0.0000 0.988 0.000 1.000 0.000 0
#> SRR2926035 2 0.0000 0.988 0.000 1.000 0.000 0
#> SRR2926034 2 0.0000 0.988 0.000 1.000 0.000 0
#> SRR2926032 2 0.0000 0.988 0.000 1.000 0.000 0
#> SRR2926031 4 0.0000 1.000 0.000 0.000 0.000 1
#> SRR2926033 2 0.0336 0.985 0.008 0.992 0.000 0
#> SRR2926030 3 0.1389 0.961 0.048 0.000 0.952 0
#> SRR2926029 3 0.0000 0.961 0.000 0.000 1.000 0
#> SRR2926027 1 0.0000 0.984 1.000 0.000 0.000 0
#> SRR2926028 4 0.0000 1.000 0.000 0.000 0.000 1
#> SRR2926026 1 0.0000 0.984 1.000 0.000 0.000 0
#> SRR2926025 4 0.0000 1.000 0.000 0.000 0.000 1
#> SRR2926023 1 0.0000 0.984 1.000 0.000 0.000 0
#> SRR2926022 3 0.1389 0.961 0.048 0.000 0.952 0
#> SRR2926024 1 0.0000 0.984 1.000 0.000 0.000 0
#> SRR2926021 4 0.0000 1.000 0.000 0.000 0.000 1
#> SRR2926020 1 0.0000 0.984 1.000 0.000 0.000 0
#> SRR2926019 1 0.0000 0.984 1.000 0.000 0.000 0
#> SRR2926018 1 0.0000 0.984 1.000 0.000 0.000 0
#> SRR2926017 1 0.1022 0.960 0.968 0.000 0.032 0
#> SRR2926016 2 0.0000 0.988 0.000 1.000 0.000 0
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> SRR2926066 2 0.1732 0.747 0.000 0.920 0.00 0.080 0.000
#> SRR2926067 2 0.0880 0.772 0.000 0.968 0.00 0.032 0.000
#> SRR2926063 2 0.1671 0.751 0.000 0.924 0.00 0.076 0.000
#> SRR2926064 2 0.3636 0.855 0.000 0.728 0.00 0.000 0.272
#> SRR2926062 2 0.3636 0.855 0.000 0.728 0.00 0.000 0.272
#> SRR2926061 2 0.3636 0.855 0.000 0.728 0.00 0.000 0.272
#> SRR2926065 2 0.3636 0.855 0.000 0.728 0.00 0.000 0.272
#> SRR2926060 2 0.3636 0.855 0.000 0.728 0.00 0.000 0.272
#> SRR2926059 2 0.1121 0.767 0.000 0.956 0.00 0.044 0.000
#> SRR2926058 2 0.1121 0.767 0.000 0.956 0.00 0.044 0.000
#> SRR2926056 1 0.2221 0.877 0.912 0.052 0.00 0.036 0.000
#> SRR2926057 3 0.0000 0.803 0.000 0.000 1.00 0.000 0.000
#> SRR2926055 2 0.0963 0.771 0.000 0.964 0.00 0.036 0.000
#> SRR2926054 2 0.1671 0.751 0.000 0.924 0.00 0.076 0.000
#> SRR2926051 2 0.1732 0.747 0.000 0.920 0.00 0.080 0.000
#> SRR2926052 2 0.1671 0.751 0.000 0.924 0.00 0.076 0.000
#> SRR2926053 2 0.1270 0.764 0.000 0.948 0.00 0.052 0.000
#> SRR2926050 2 0.1671 0.751 0.000 0.924 0.00 0.076 0.000
#> SRR2926049 2 0.3636 0.855 0.000 0.728 0.00 0.000 0.272
#> SRR2926047 2 0.3636 0.855 0.000 0.728 0.00 0.000 0.272
#> SRR2926046 2 0.1792 0.744 0.000 0.916 0.00 0.084 0.000
#> SRR2926048 2 0.3636 0.855 0.000 0.728 0.00 0.000 0.272
#> SRR2926044 2 0.3636 0.855 0.000 0.728 0.00 0.000 0.272
#> SRR2926045 2 0.1671 0.751 0.000 0.924 0.00 0.076 0.000
#> SRR2926041 2 0.3636 0.855 0.000 0.728 0.00 0.000 0.272
#> SRR2926042 2 0.3636 0.855 0.000 0.728 0.00 0.000 0.272
#> SRR2926040 2 0.3636 0.855 0.000 0.728 0.00 0.000 0.272
#> SRR2926039 2 0.3636 0.855 0.000 0.728 0.00 0.000 0.272
#> SRR2926043 2 0.3636 0.855 0.000 0.728 0.00 0.000 0.272
#> SRR2926038 2 0.3636 0.855 0.000 0.728 0.00 0.000 0.272
#> SRR2926036 2 0.3636 0.855 0.000 0.728 0.00 0.000 0.272
#> SRR2926037 2 0.3636 0.855 0.000 0.728 0.00 0.000 0.272
#> SRR2926035 2 0.3636 0.855 0.000 0.728 0.00 0.000 0.272
#> SRR2926034 2 0.3586 0.853 0.000 0.736 0.00 0.000 0.264
#> SRR2926032 2 0.3636 0.855 0.000 0.728 0.00 0.000 0.272
#> SRR2926031 5 0.3816 0.802 0.000 0.000 0.00 0.304 0.696
#> SRR2926033 2 0.0880 0.772 0.000 0.968 0.00 0.032 0.000
#> SRR2926030 3 0.4843 0.803 0.048 0.000 0.66 0.292 0.000
#> SRR2926029 3 0.0000 0.803 0.000 0.000 1.00 0.000 0.000
#> SRR2926027 1 0.0000 0.979 1.000 0.000 0.00 0.000 0.000
#> SRR2926028 4 0.4283 0.000 0.000 0.000 0.00 0.544 0.456
#> SRR2926026 1 0.0000 0.979 1.000 0.000 0.00 0.000 0.000
#> SRR2926025 5 0.3895 0.737 0.000 0.000 0.00 0.320 0.680
#> SRR2926023 1 0.0000 0.979 1.000 0.000 0.00 0.000 0.000
#> SRR2926022 3 0.4843 0.803 0.048 0.000 0.66 0.292 0.000
#> SRR2926024 1 0.0000 0.979 1.000 0.000 0.00 0.000 0.000
#> SRR2926021 5 0.3636 0.841 0.000 0.000 0.00 0.272 0.728
#> SRR2926020 1 0.0000 0.979 1.000 0.000 0.00 0.000 0.000
#> SRR2926019 1 0.0000 0.979 1.000 0.000 0.00 0.000 0.000
#> SRR2926018 1 0.0000 0.979 1.000 0.000 0.00 0.000 0.000
#> SRR2926017 1 0.1270 0.943 0.948 0.000 0.00 0.052 0.000
#> SRR2926016 2 0.3491 0.844 0.000 0.768 0.00 0.004 0.228
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> SRR2926066 2 0.381 0.675 0.000 0.572 0.000 0.428 0.000 0.000
#> SRR2926067 2 0.366 0.710 0.000 0.636 0.000 0.364 0.000 0.000
#> SRR2926063 2 0.380 0.678 0.000 0.576 0.000 0.424 0.000 0.000
#> SRR2926064 2 0.000 0.818 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2926062 2 0.000 0.818 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2926061 2 0.000 0.818 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2926065 2 0.000 0.818 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2926060 2 0.000 0.818 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2926059 2 0.368 0.706 0.000 0.628 0.000 0.372 0.000 0.000
#> SRR2926058 2 0.368 0.706 0.000 0.628 0.000 0.372 0.000 0.000
#> SRR2926056 1 0.203 0.870 0.912 0.024 0.000 0.060 0.000 0.004
#> SRR2926057 3 0.000 1.000 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2926055 2 0.367 0.708 0.000 0.632 0.000 0.368 0.000 0.000
#> SRR2926054 2 0.380 0.678 0.000 0.576 0.000 0.424 0.000 0.000
#> SRR2926051 2 0.381 0.675 0.000 0.572 0.000 0.428 0.000 0.000
#> SRR2926052 2 0.380 0.678 0.000 0.576 0.000 0.424 0.000 0.000
#> SRR2926053 2 0.376 0.692 0.000 0.600 0.000 0.400 0.000 0.000
#> SRR2926050 2 0.380 0.678 0.000 0.576 0.000 0.424 0.000 0.000
#> SRR2926049 2 0.000 0.818 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2926047 2 0.000 0.818 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2926046 2 0.394 0.671 0.000 0.568 0.000 0.428 0.000 0.004
#> SRR2926048 2 0.000 0.818 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2926044 2 0.000 0.818 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2926045 2 0.380 0.678 0.000 0.576 0.000 0.424 0.000 0.000
#> SRR2926041 2 0.000 0.818 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2926042 2 0.000 0.818 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2926040 2 0.000 0.818 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2926039 2 0.000 0.818 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2926043 2 0.000 0.818 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2926038 2 0.000 0.818 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2926036 2 0.000 0.818 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2926037 2 0.000 0.818 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2926035 2 0.000 0.818 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2926034 2 0.026 0.816 0.000 0.992 0.000 0.008 0.000 0.000
#> SRR2926032 2 0.000 0.818 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2926031 5 0.306 0.558 0.000 0.000 0.000 0.052 0.836 0.112
#> SRR2926033 2 0.366 0.710 0.000 0.636 0.000 0.364 0.000 0.000
#> SRR2926030 6 0.334 1.000 0.044 0.000 0.152 0.000 0.000 0.804
#> SRR2926029 3 0.000 1.000 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2926027 1 0.000 0.977 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2926028 4 0.458 0.000 0.000 0.000 0.000 0.512 0.452 0.036
#> SRR2926026 1 0.000 0.977 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2926025 5 0.276 0.278 0.000 0.000 0.000 0.196 0.804 0.000
#> SRR2926023 1 0.000 0.977 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2926022 6 0.334 1.000 0.044 0.000 0.152 0.000 0.000 0.804
#> SRR2926024 1 0.000 0.977 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2926021 5 0.000 0.626 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR2926020 1 0.000 0.977 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2926019 1 0.000 0.977 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2926018 1 0.000 0.977 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2926017 1 0.133 0.937 0.944 0.000 0.000 0.008 0.000 0.048
#> SRR2926016 2 0.166 0.796 0.000 0.912 0.000 0.088 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 18096 rows and 52 columns.
#> Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'CV' method.
#> Subgroups are detected by 'kmeans' method.
#> Performed in total 1250 partitions by row resampling.
#> Best k for subgroups seems to be 2.
#>
#> Following methods can be applied to this 'ConsensusPartition' object:
#> [1] "cola_report" "collect_classes" "collect_plots"
#> [4] "collect_stats" "colnames" "compare_signatures"
#> [7] "consensus_heatmap" "dimension_reduction" "functional_enrichment"
#> [10] "get_anno_col" "get_anno" "get_classes"
#> [13] "get_consensus" "get_matrix" "get_membership"
#> [16] "get_param" "get_signatures" "get_stats"
#> [19] "is_best_k" "is_stable_k" "membership_heatmap"
#> [22] "ncol" "nrow" "plot_ecdf"
#> [25] "rownames" "select_partition_number" "show"
#> [28] "suggest_best_k" "test_to_known_factors"
collect_plots()
function collects all the plots made from res
for all k
(number of partitions)
into one single page to provide an easy and fast comparison between different k
.
collect_plots(res)
The plots are:
k
and the heatmap of
predicted classes for each k
.k
.k
.k
.All the plots in panels can be made by individual functions and they are plotted later in this section.
select_partition_number()
produces several plots showing different
statistics for choosing “optimized” k
. There are following statistics:
k
;k
, the area increased is defined as \(A_k - A_{k-1}\).The detailed explanations of these statistics can be found in the cola vignette.
Generally speaking, lower PAC score, higher mean silhouette score or higher
concordance corresponds to better partition. Rand index and Jaccard index
measure how similar the current partition is compared to partition with k-1
.
If they are too similar, we won't accept k
is better than k-1
.
select_partition_number(res)
The numeric values for all these statistics can be obtained by get_stats()
.
get_stats(res)
#> k 1-PAC mean_silhouette concordance area_increased Rand Jaccard
#> 2 2 1.000 0.983 0.982 0.4303 0.551 0.551
#> 3 3 0.606 0.715 0.824 0.3052 0.955 0.918
#> 4 4 0.677 0.828 0.859 0.1960 0.780 0.572
#> 5 5 0.717 0.761 0.819 0.1062 0.976 0.921
#> 6 6 0.713 0.739 0.800 0.0734 0.866 0.552
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
#> SRR2926066 2 0.0376 0.996 0.004 0.996
#> SRR2926067 2 0.0000 1.000 0.000 1.000
#> SRR2926063 2 0.0000 1.000 0.000 1.000
#> SRR2926064 2 0.0000 1.000 0.000 1.000
#> SRR2926062 2 0.0000 1.000 0.000 1.000
#> SRR2926061 2 0.0000 1.000 0.000 1.000
#> SRR2926065 2 0.0000 1.000 0.000 1.000
#> SRR2926060 2 0.0000 1.000 0.000 1.000
#> SRR2926059 2 0.0000 1.000 0.000 1.000
#> SRR2926058 2 0.0000 1.000 0.000 1.000
#> SRR2926056 1 0.6712 0.843 0.824 0.176
#> SRR2926057 1 0.6973 0.791 0.812 0.188
#> SRR2926055 2 0.0000 1.000 0.000 1.000
#> SRR2926054 2 0.0000 1.000 0.000 1.000
#> SRR2926051 2 0.0000 1.000 0.000 1.000
#> SRR2926052 2 0.0000 1.000 0.000 1.000
#> SRR2926053 2 0.0000 1.000 0.000 1.000
#> SRR2926050 2 0.0000 1.000 0.000 1.000
#> SRR2926049 2 0.0000 1.000 0.000 1.000
#> SRR2926047 2 0.0000 1.000 0.000 1.000
#> SRR2926046 2 0.0000 1.000 0.000 1.000
#> SRR2926048 2 0.0000 1.000 0.000 1.000
#> SRR2926044 2 0.0000 1.000 0.000 1.000
#> SRR2926045 2 0.0000 1.000 0.000 1.000
#> SRR2926041 2 0.0000 1.000 0.000 1.000
#> SRR2926042 2 0.0000 1.000 0.000 1.000
#> SRR2926040 2 0.0000 1.000 0.000 1.000
#> SRR2926039 2 0.0000 1.000 0.000 1.000
#> SRR2926043 2 0.0000 1.000 0.000 1.000
#> SRR2926038 2 0.0000 1.000 0.000 1.000
#> SRR2926036 2 0.0000 1.000 0.000 1.000
#> SRR2926037 2 0.0000 1.000 0.000 1.000
#> SRR2926035 2 0.0000 1.000 0.000 1.000
#> SRR2926034 2 0.0000 1.000 0.000 1.000
#> SRR2926032 2 0.0000 1.000 0.000 1.000
#> SRR2926031 1 0.2778 0.971 0.952 0.048
#> SRR2926033 2 0.0000 1.000 0.000 1.000
#> SRR2926030 1 0.0000 0.941 1.000 0.000
#> SRR2926029 1 0.0000 0.941 1.000 0.000
#> SRR2926027 1 0.2778 0.971 0.952 0.048
#> SRR2926028 1 0.2778 0.971 0.952 0.048
#> SRR2926026 1 0.2778 0.971 0.952 0.048
#> SRR2926025 1 0.2778 0.971 0.952 0.048
#> SRR2926023 1 0.2778 0.971 0.952 0.048
#> SRR2926022 1 0.0000 0.941 1.000 0.000
#> SRR2926024 1 0.2778 0.971 0.952 0.048
#> SRR2926021 1 0.2778 0.971 0.952 0.048
#> SRR2926020 1 0.2778 0.971 0.952 0.048
#> SRR2926019 1 0.2778 0.971 0.952 0.048
#> SRR2926018 1 0.2778 0.971 0.952 0.048
#> SRR2926017 1 0.2778 0.971 0.952 0.048
#> SRR2926016 2 0.0000 1.000 0.000 1.000
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> SRR2926066 2 0.877 0.423 0.112 0.476 0.412
#> SRR2926067 2 0.288 0.826 0.000 0.904 0.096
#> SRR2926063 2 0.877 0.430 0.112 0.480 0.408
#> SRR2926064 2 0.000 0.857 0.000 1.000 0.000
#> SRR2926062 2 0.000 0.857 0.000 1.000 0.000
#> SRR2926061 2 0.000 0.857 0.000 1.000 0.000
#> SRR2926065 2 0.000 0.857 0.000 1.000 0.000
#> SRR2926060 2 0.000 0.857 0.000 1.000 0.000
#> SRR2926059 2 0.576 0.661 0.000 0.672 0.328
#> SRR2926058 2 0.546 0.700 0.000 0.712 0.288
#> SRR2926056 3 0.662 0.122 0.388 0.012 0.600
#> SRR2926057 3 0.217 0.473 0.048 0.008 0.944
#> SRR2926055 2 0.296 0.825 0.000 0.900 0.100
#> SRR2926054 2 0.553 0.702 0.000 0.704 0.296
#> SRR2926051 2 0.877 0.430 0.112 0.480 0.408
#> SRR2926052 2 0.869 0.483 0.112 0.516 0.372
#> SRR2926053 2 0.412 0.792 0.000 0.832 0.168
#> SRR2926050 2 0.877 0.430 0.112 0.480 0.408
#> SRR2926049 2 0.000 0.857 0.000 1.000 0.000
#> SRR2926047 2 0.000 0.857 0.000 1.000 0.000
#> SRR2926046 2 0.877 0.423 0.112 0.476 0.412
#> SRR2926048 2 0.000 0.857 0.000 1.000 0.000
#> SRR2926044 2 0.000 0.857 0.000 1.000 0.000
#> SRR2926045 2 0.327 0.818 0.000 0.884 0.116
#> SRR2926041 2 0.000 0.857 0.000 1.000 0.000
#> SRR2926042 2 0.000 0.857 0.000 1.000 0.000
#> SRR2926040 2 0.000 0.857 0.000 1.000 0.000
#> SRR2926039 2 0.000 0.857 0.000 1.000 0.000
#> SRR2926043 2 0.000 0.857 0.000 1.000 0.000
#> SRR2926038 2 0.000 0.857 0.000 1.000 0.000
#> SRR2926036 2 0.000 0.857 0.000 1.000 0.000
#> SRR2926037 2 0.000 0.857 0.000 1.000 0.000
#> SRR2926035 2 0.000 0.857 0.000 1.000 0.000
#> SRR2926034 2 0.000 0.857 0.000 1.000 0.000
#> SRR2926032 2 0.000 0.857 0.000 1.000 0.000
#> SRR2926031 1 0.226 0.654 0.932 0.000 0.068
#> SRR2926033 2 0.288 0.826 0.000 0.904 0.096
#> SRR2926030 3 0.619 0.178 0.420 0.000 0.580
#> SRR2926029 3 0.424 0.492 0.176 0.000 0.824
#> SRR2926027 1 0.445 0.817 0.808 0.000 0.192
#> SRR2926028 1 0.226 0.654 0.932 0.000 0.068
#> SRR2926026 1 0.445 0.817 0.808 0.000 0.192
#> SRR2926025 1 0.226 0.654 0.932 0.000 0.068
#> SRR2926023 1 0.445 0.817 0.808 0.000 0.192
#> SRR2926022 3 0.619 0.178 0.420 0.000 0.580
#> SRR2926024 1 0.440 0.814 0.812 0.000 0.188
#> SRR2926021 1 0.226 0.654 0.932 0.000 0.068
#> SRR2926020 1 0.445 0.817 0.808 0.000 0.192
#> SRR2926019 1 0.445 0.817 0.808 0.000 0.192
#> SRR2926018 1 0.445 0.817 0.808 0.000 0.192
#> SRR2926017 1 0.489 0.756 0.772 0.000 0.228
#> SRR2926016 2 0.522 0.708 0.000 0.740 0.260
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> SRR2926066 3 0.2654 0.836 0.004 0.108 0.888 0.000
#> SRR2926067 2 0.4477 0.430 0.000 0.688 0.312 0.000
#> SRR2926063 3 0.2654 0.836 0.004 0.108 0.888 0.000
#> SRR2926064 2 0.0592 0.941 0.000 0.984 0.000 0.016
#> SRR2926062 2 0.0000 0.945 0.000 1.000 0.000 0.000
#> SRR2926061 2 0.0592 0.941 0.000 0.984 0.000 0.016
#> SRR2926065 2 0.0592 0.941 0.000 0.984 0.000 0.016
#> SRR2926060 2 0.0592 0.941 0.000 0.984 0.000 0.016
#> SRR2926059 3 0.4908 0.750 0.000 0.292 0.692 0.016
#> SRR2926058 3 0.5026 0.732 0.000 0.312 0.672 0.016
#> SRR2926056 3 0.0895 0.657 0.020 0.000 0.976 0.004
#> SRR2926057 4 0.3208 0.826 0.004 0.000 0.148 0.848
#> SRR2926055 3 0.4998 0.267 0.000 0.488 0.512 0.000
#> SRR2926054 3 0.4606 0.786 0.000 0.264 0.724 0.012
#> SRR2926051 3 0.2654 0.836 0.004 0.108 0.888 0.000
#> SRR2926052 3 0.3400 0.838 0.004 0.128 0.856 0.012
#> SRR2926053 3 0.3569 0.825 0.000 0.196 0.804 0.000
#> SRR2926050 3 0.2839 0.836 0.004 0.108 0.884 0.004
#> SRR2926049 2 0.0188 0.946 0.000 0.996 0.000 0.004
#> SRR2926047 2 0.0188 0.946 0.000 0.996 0.000 0.004
#> SRR2926046 3 0.2654 0.836 0.004 0.108 0.888 0.000
#> SRR2926048 2 0.0188 0.946 0.000 0.996 0.000 0.004
#> SRR2926044 2 0.0592 0.941 0.000 0.984 0.000 0.016
#> SRR2926045 3 0.3764 0.819 0.000 0.216 0.784 0.000
#> SRR2926041 2 0.0188 0.946 0.000 0.996 0.000 0.004
#> SRR2926042 2 0.0000 0.945 0.000 1.000 0.000 0.000
#> SRR2926040 2 0.0188 0.946 0.000 0.996 0.000 0.004
#> SRR2926039 2 0.0592 0.941 0.000 0.984 0.000 0.016
#> SRR2926043 2 0.0000 0.945 0.000 1.000 0.000 0.000
#> SRR2926038 2 0.0188 0.946 0.000 0.996 0.000 0.004
#> SRR2926036 2 0.0188 0.946 0.000 0.996 0.000 0.004
#> SRR2926037 2 0.0188 0.946 0.000 0.996 0.000 0.004
#> SRR2926035 2 0.0188 0.946 0.000 0.996 0.000 0.004
#> SRR2926034 2 0.0592 0.941 0.000 0.984 0.000 0.016
#> SRR2926032 2 0.0188 0.946 0.000 0.996 0.000 0.004
#> SRR2926031 1 0.1022 0.678 0.968 0.000 0.000 0.032
#> SRR2926033 2 0.4477 0.430 0.000 0.688 0.312 0.000
#> SRR2926030 4 0.0707 0.901 0.020 0.000 0.000 0.980
#> SRR2926029 4 0.2450 0.900 0.016 0.000 0.072 0.912
#> SRR2926027 1 0.6184 0.826 0.664 0.000 0.120 0.216
#> SRR2926028 1 0.1209 0.677 0.964 0.000 0.004 0.032
#> SRR2926026 1 0.6184 0.826 0.664 0.000 0.120 0.216
#> SRR2926025 1 0.1022 0.678 0.968 0.000 0.000 0.032
#> SRR2926023 1 0.6184 0.826 0.664 0.000 0.120 0.216
#> SRR2926022 4 0.0707 0.901 0.020 0.000 0.000 0.980
#> SRR2926024 1 0.6184 0.826 0.664 0.000 0.120 0.216
#> SRR2926021 1 0.1022 0.678 0.968 0.000 0.000 0.032
#> SRR2926020 1 0.6184 0.826 0.664 0.000 0.120 0.216
#> SRR2926019 1 0.6184 0.826 0.664 0.000 0.120 0.216
#> SRR2926018 1 0.6184 0.826 0.664 0.000 0.120 0.216
#> SRR2926017 1 0.6420 0.734 0.640 0.000 0.228 0.132
#> SRR2926016 2 0.3925 0.703 0.000 0.808 0.176 0.016
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> SRR2926066 3 0.1093 0.778 0.004 0.020 0.968 0.004 0.004
#> SRR2926067 2 0.6816 0.239 0.000 0.360 0.324 0.316 0.000
#> SRR2926063 3 0.0771 0.778 0.004 0.020 0.976 0.000 0.000
#> SRR2926064 2 0.4288 0.723 0.000 0.612 0.004 0.384 0.000
#> SRR2926062 2 0.3741 0.753 0.000 0.732 0.004 0.264 0.000
#> SRR2926061 2 0.4251 0.728 0.000 0.624 0.004 0.372 0.000
#> SRR2926065 2 0.4321 0.714 0.000 0.600 0.004 0.396 0.000
#> SRR2926060 2 0.4251 0.726 0.000 0.624 0.004 0.372 0.000
#> SRR2926059 3 0.5654 0.646 0.000 0.148 0.628 0.224 0.000
#> SRR2926058 3 0.5715 0.641 0.000 0.152 0.620 0.228 0.000
#> SRR2926056 3 0.1372 0.757 0.024 0.000 0.956 0.016 0.004
#> SRR2926057 4 0.5703 0.908 0.024 0.000 0.040 0.540 0.396
#> SRR2926055 3 0.6514 0.202 0.000 0.220 0.476 0.304 0.000
#> SRR2926054 3 0.5162 0.698 0.000 0.148 0.692 0.160 0.000
#> SRR2926051 3 0.1173 0.777 0.004 0.020 0.964 0.012 0.000
#> SRR2926052 3 0.3037 0.772 0.004 0.032 0.864 0.100 0.000
#> SRR2926053 3 0.2927 0.767 0.000 0.040 0.868 0.092 0.000
#> SRR2926050 3 0.2608 0.774 0.004 0.020 0.888 0.088 0.000
#> SRR2926049 2 0.0000 0.753 0.000 1.000 0.000 0.000 0.000
#> SRR2926047 2 0.0000 0.753 0.000 1.000 0.000 0.000 0.000
#> SRR2926046 3 0.0932 0.778 0.004 0.020 0.972 0.000 0.004
#> SRR2926048 2 0.0000 0.753 0.000 1.000 0.000 0.000 0.000
#> SRR2926044 2 0.4288 0.723 0.000 0.612 0.004 0.384 0.000
#> SRR2926045 3 0.4938 0.614 0.000 0.048 0.640 0.312 0.000
#> SRR2926041 2 0.0000 0.753 0.000 1.000 0.000 0.000 0.000
#> SRR2926042 2 0.3521 0.756 0.000 0.764 0.004 0.232 0.000
#> SRR2926040 2 0.0000 0.753 0.000 1.000 0.000 0.000 0.000
#> SRR2926039 2 0.4299 0.718 0.000 0.608 0.004 0.388 0.000
#> SRR2926043 2 0.3838 0.750 0.000 0.716 0.004 0.280 0.000
#> SRR2926038 2 0.0162 0.753 0.000 0.996 0.000 0.004 0.000
#> SRR2926036 2 0.0000 0.753 0.000 1.000 0.000 0.000 0.000
#> SRR2926037 2 0.0000 0.753 0.000 1.000 0.000 0.000 0.000
#> SRR2926035 2 0.0000 0.753 0.000 1.000 0.000 0.000 0.000
#> SRR2926034 2 0.4321 0.714 0.000 0.600 0.004 0.396 0.000
#> SRR2926032 2 0.0000 0.753 0.000 1.000 0.000 0.000 0.000
#> SRR2926031 5 0.4161 0.991 0.392 0.000 0.000 0.000 0.608
#> SRR2926033 2 0.6801 0.208 0.000 0.360 0.348 0.292 0.000
#> SRR2926030 4 0.5744 0.949 0.092 0.000 0.000 0.528 0.380
#> SRR2926029 4 0.6245 0.945 0.068 0.000 0.032 0.504 0.396
#> SRR2926027 1 0.0000 0.936 1.000 0.000 0.000 0.000 0.000
#> SRR2926028 5 0.4676 0.989 0.392 0.000 0.004 0.012 0.592
#> SRR2926026 1 0.0000 0.936 1.000 0.000 0.000 0.000 0.000
#> SRR2926025 5 0.4527 0.991 0.392 0.000 0.000 0.012 0.596
#> SRR2926023 1 0.0000 0.936 1.000 0.000 0.000 0.000 0.000
#> SRR2926022 4 0.5744 0.949 0.092 0.000 0.000 0.528 0.380
#> SRR2926024 1 0.0000 0.936 1.000 0.000 0.000 0.000 0.000
#> SRR2926021 5 0.4161 0.991 0.392 0.000 0.000 0.000 0.608
#> SRR2926020 1 0.0000 0.936 1.000 0.000 0.000 0.000 0.000
#> SRR2926019 1 0.0000 0.936 1.000 0.000 0.000 0.000 0.000
#> SRR2926018 1 0.0000 0.936 1.000 0.000 0.000 0.000 0.000
#> SRR2926017 1 0.3398 0.519 0.780 0.000 0.216 0.000 0.004
#> SRR2926016 2 0.5933 0.534 0.000 0.452 0.104 0.444 0.000
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> SRR2926066 3 0.2507 0.75535 0.000 0.056 0.892 0.016 0.036 0.000
#> SRR2926067 4 0.5087 0.34757 0.000 0.016 0.332 0.592 0.060 0.000
#> SRR2926063 3 0.0520 0.76956 0.000 0.000 0.984 0.008 0.008 0.000
#> SRR2926064 4 0.3566 0.61612 0.000 0.096 0.000 0.800 0.104 0.000
#> SRR2926062 4 0.5190 0.17295 0.000 0.352 0.004 0.556 0.088 0.000
#> SRR2926061 4 0.3520 0.61918 0.000 0.100 0.000 0.804 0.096 0.000
#> SRR2926065 4 0.1391 0.65879 0.000 0.040 0.000 0.944 0.016 0.000
#> SRR2926060 4 0.2608 0.64513 0.000 0.080 0.000 0.872 0.048 0.000
#> SRR2926059 3 0.4952 0.47492 0.000 0.000 0.524 0.408 0.068 0.000
#> SRR2926058 3 0.4952 0.47492 0.000 0.000 0.524 0.408 0.068 0.000
#> SRR2926056 3 0.2985 0.73745 0.008 0.068 0.868 0.012 0.044 0.000
#> SRR2926057 6 0.1649 0.94987 0.000 0.036 0.000 0.000 0.032 0.932
#> SRR2926055 4 0.5166 0.18926 0.000 0.012 0.400 0.528 0.060 0.000
#> SRR2926054 3 0.4749 0.66082 0.000 0.004 0.656 0.260 0.080 0.000
#> SRR2926051 3 0.1225 0.75924 0.000 0.000 0.952 0.012 0.036 0.000
#> SRR2926052 3 0.3558 0.73885 0.000 0.004 0.780 0.184 0.032 0.000
#> SRR2926053 3 0.4233 0.59667 0.000 0.004 0.724 0.208 0.064 0.000
#> SRR2926050 3 0.2618 0.76949 0.000 0.000 0.860 0.116 0.024 0.000
#> SRR2926049 2 0.2793 0.98635 0.000 0.800 0.000 0.200 0.000 0.000
#> SRR2926047 2 0.3171 0.97738 0.000 0.784 0.000 0.204 0.012 0.000
#> SRR2926046 3 0.2164 0.75635 0.000 0.056 0.908 0.008 0.028 0.000
#> SRR2926048 2 0.2793 0.98635 0.000 0.800 0.000 0.200 0.000 0.000
#> SRR2926044 4 0.3701 0.61036 0.000 0.100 0.000 0.788 0.112 0.000
#> SRR2926045 4 0.5060 -0.00131 0.000 0.004 0.428 0.504 0.064 0.000
#> SRR2926041 2 0.2964 0.98291 0.000 0.792 0.000 0.204 0.004 0.000
#> SRR2926042 4 0.5009 0.06795 0.000 0.388 0.000 0.536 0.076 0.000
#> SRR2926040 2 0.2823 0.98442 0.000 0.796 0.000 0.204 0.000 0.000
#> SRR2926039 4 0.1387 0.65404 0.000 0.068 0.000 0.932 0.000 0.000
#> SRR2926043 4 0.4053 0.35502 0.000 0.300 0.004 0.676 0.020 0.000
#> SRR2926038 2 0.2996 0.96151 0.000 0.772 0.000 0.228 0.000 0.000
#> SRR2926036 2 0.2793 0.98635 0.000 0.800 0.000 0.200 0.000 0.000
#> SRR2926037 2 0.2793 0.98635 0.000 0.800 0.000 0.200 0.000 0.000
#> SRR2926035 2 0.2793 0.98635 0.000 0.800 0.000 0.200 0.000 0.000
#> SRR2926034 4 0.1549 0.65720 0.000 0.044 0.000 0.936 0.020 0.000
#> SRR2926032 2 0.2996 0.96151 0.000 0.772 0.000 0.228 0.000 0.000
#> SRR2926031 5 0.3583 0.97955 0.260 0.008 0.000 0.000 0.728 0.004
#> SRR2926033 4 0.5204 0.29473 0.000 0.016 0.376 0.548 0.060 0.000
#> SRR2926030 6 0.0858 0.94886 0.028 0.000 0.000 0.000 0.004 0.968
#> SRR2926029 6 0.1649 0.94987 0.000 0.036 0.000 0.000 0.032 0.932
#> SRR2926027 1 0.0937 0.90262 0.960 0.040 0.000 0.000 0.000 0.000
#> SRR2926028 5 0.4139 0.97555 0.260 0.036 0.000 0.000 0.700 0.004
#> SRR2926026 1 0.0000 0.92790 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2926025 5 0.4095 0.98047 0.260 0.020 0.008 0.000 0.708 0.004
#> SRR2926023 1 0.0000 0.92790 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2926022 6 0.0858 0.94886 0.028 0.004 0.000 0.000 0.000 0.968
#> SRR2926024 1 0.0458 0.92017 0.984 0.016 0.000 0.000 0.000 0.000
#> SRR2926021 5 0.3476 0.98170 0.260 0.004 0.000 0.000 0.732 0.004
#> SRR2926020 1 0.0000 0.92790 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2926019 1 0.0000 0.92790 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2926018 1 0.0000 0.92790 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2926017 1 0.5219 0.49834 0.676 0.100 0.184 0.000 0.040 0.000
#> SRR2926016 4 0.3413 0.57877 0.000 0.016 0.052 0.828 0.104 0.000
Heatmaps for the consensus matrix. It visualizes the probability of two samples to be in a same group.
consensus_heatmap(res, k = 2)
consensus_heatmap(res, k = 3)
consensus_heatmap(res, k = 4)
consensus_heatmap(res, k = 5)
consensus_heatmap(res, k = 6)
Heatmaps for the membership of samples in all partitions to see how consistent they are:
membership_heatmap(res, k = 2)
membership_heatmap(res, k = 3)
membership_heatmap(res, k = 4)
membership_heatmap(res, k = 5)
membership_heatmap(res, k = 6)
As soon as we have had the classes for columns, we can look for signatures which are significantly different between classes which can be candidate marks for certain classes. Following are the heatmaps for signatures.
Signature heatmaps where rows are scaled:
get_signatures(res, k = 2)
get_signatures(res, k = 3)
get_signatures(res, k = 4)
get_signatures(res, k = 5)
get_signatures(res, k = 6)
Signature heatmaps where rows are not scaled:
get_signatures(res, k = 2, scale_rows = FALSE)
get_signatures(res, k = 3, scale_rows = FALSE)
get_signatures(res, k = 4, scale_rows = FALSE)
get_signatures(res, k = 5, scale_rows = FALSE)
get_signatures(res, k = 6, scale_rows = FALSE)
Compare the overlap of signatures from different k:
compare_signatures(res)
get_signature()
returns a data frame invisibly. TO get the list of signatures, the function
call should be assigned to a variable explicitly. In following code, if plot
argument is set
to FALSE
, no heatmap is plotted while only the differential analysis is performed.
# code only for demonstration
tb = get_signature(res, k = ..., plot = FALSE)
An example of the output of tb
is:
#> which_row fdr mean_1 mean_2 scaled_mean_1 scaled_mean_2 km
#> 1 38 0.042760348 8.373488 9.131774 -0.5533452 0.5164555 1
#> 2 40 0.018707592 7.106213 8.469186 -0.6173731 0.5762149 1
#> 3 55 0.019134737 10.221463 11.207825 -0.6159697 0.5749050 1
#> 4 59 0.006059896 5.921854 7.869574 -0.6899429 0.6439467 1
#> 5 60 0.018055526 8.928898 10.211722 -0.6204761 0.5791110 1
#> 6 98 0.009384629 15.714769 14.887706 0.6635654 -0.6193277 2
...
The columns in tb
are:
which_row
: row indices corresponding to the input matrix.fdr
: FDR for the differential test. mean_x
: The mean value in group x.scaled_mean_x
: The mean value in group x after rows are scaled.km
: Row groups if k-means clustering is applied to rows.UMAP plot which shows how samples are separated.
dimension_reduction(res, k = 2, method = "UMAP")
dimension_reduction(res, k = 3, method = "UMAP")
dimension_reduction(res, k = 4, method = "UMAP")
dimension_reduction(res, k = 5, method = "UMAP")
dimension_reduction(res, k = 6, method = "UMAP")
Following heatmap shows how subgroups are split when increasing k
:
collect_classes(res)
If matrix rows can be associated to genes, consider to use functional_enrichment(res,
...)
to perform function enrichment for the signature genes. See this vignette for more detailed explanations.
The object with results only for a single top-value method and a single partition method can be extracted as:
res = res_list["CV", "skmeans"]
# you can also extract it by
# res = res_list["CV:skmeans"]
A summary of res
and all the functions that can be applied to it:
res
#> A 'ConsensusPartition' object with k = 2, 3, 4, 5, 6.
#> On a matrix with 18096 rows and 52 columns.
#> Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'CV' method.
#> Subgroups are detected by 'skmeans' method.
#> Performed in total 1250 partitions by row resampling.
#> Best k for subgroups seems to be 2.
#>
#> Following methods can be applied to this 'ConsensusPartition' object:
#> [1] "cola_report" "collect_classes" "collect_plots"
#> [4] "collect_stats" "colnames" "compare_signatures"
#> [7] "consensus_heatmap" "dimension_reduction" "functional_enrichment"
#> [10] "get_anno_col" "get_anno" "get_classes"
#> [13] "get_consensus" "get_matrix" "get_membership"
#> [16] "get_param" "get_signatures" "get_stats"
#> [19] "is_best_k" "is_stable_k" "membership_heatmap"
#> [22] "ncol" "nrow" "plot_ecdf"
#> [25] "rownames" "select_partition_number" "show"
#> [28] "suggest_best_k" "test_to_known_factors"
collect_plots()
function collects all the plots made from res
for all k
(number of partitions)
into one single page to provide an easy and fast comparison between different k
.
collect_plots(res)
The plots are:
k
and the heatmap of
predicted classes for each k
.k
.k
.k
.All the plots in panels can be made by individual functions and they are plotted later in this section.
select_partition_number()
produces several plots showing different
statistics for choosing “optimized” k
. There are following statistics:
k
;k
, the area increased is defined as \(A_k - A_{k-1}\).The detailed explanations of these statistics can be found in the cola vignette.
Generally speaking, lower PAC score, higher mean silhouette score or higher
concordance corresponds to better partition. Rand index and Jaccard index
measure how similar the current partition is compared to partition with k-1
.
If they are too similar, we won't accept k
is better than k-1
.
select_partition_number(res)
The numeric values for all these statistics can be obtained by get_stats()
.
get_stats(res)
#> k 1-PAC mean_silhouette concordance area_increased Rand Jaccard
#> 2 2 0.919 0.918 0.966 0.4914 0.497 0.497
#> 3 3 0.876 0.886 0.955 0.3380 0.792 0.603
#> 4 4 0.830 0.800 0.905 0.0829 0.941 0.830
#> 5 5 0.730 0.712 0.774 0.0704 0.955 0.849
#> 6 6 0.712 0.707 0.795 0.0556 0.924 0.723
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
#> SRR2926066 1 0.000 0.921 1.000 0.000
#> SRR2926067 2 0.000 0.996 0.000 1.000
#> SRR2926063 1 0.983 0.357 0.576 0.424
#> SRR2926064 2 0.000 0.996 0.000 1.000
#> SRR2926062 2 0.000 0.996 0.000 1.000
#> SRR2926061 2 0.000 0.996 0.000 1.000
#> SRR2926065 2 0.000 0.996 0.000 1.000
#> SRR2926060 2 0.000 0.996 0.000 1.000
#> SRR2926059 2 0.000 0.996 0.000 1.000
#> SRR2926058 2 0.000 0.996 0.000 1.000
#> SRR2926056 1 0.000 0.921 1.000 0.000
#> SRR2926057 1 0.000 0.921 1.000 0.000
#> SRR2926055 2 0.000 0.996 0.000 1.000
#> SRR2926054 2 0.000 0.996 0.000 1.000
#> SRR2926051 1 0.983 0.357 0.576 0.424
#> SRR2926052 1 0.983 0.357 0.576 0.424
#> SRR2926053 2 0.000 0.996 0.000 1.000
#> SRR2926050 1 0.971 0.410 0.600 0.400
#> SRR2926049 2 0.000 0.996 0.000 1.000
#> SRR2926047 2 0.000 0.996 0.000 1.000
#> SRR2926046 1 0.000 0.921 1.000 0.000
#> SRR2926048 2 0.000 0.996 0.000 1.000
#> SRR2926044 2 0.000 0.996 0.000 1.000
#> SRR2926045 2 0.000 0.996 0.000 1.000
#> SRR2926041 2 0.000 0.996 0.000 1.000
#> SRR2926042 2 0.000 0.996 0.000 1.000
#> SRR2926040 2 0.000 0.996 0.000 1.000
#> SRR2926039 2 0.000 0.996 0.000 1.000
#> SRR2926043 2 0.000 0.996 0.000 1.000
#> SRR2926038 2 0.000 0.996 0.000 1.000
#> SRR2926036 2 0.000 0.996 0.000 1.000
#> SRR2926037 2 0.000 0.996 0.000 1.000
#> SRR2926035 2 0.000 0.996 0.000 1.000
#> SRR2926034 2 0.000 0.996 0.000 1.000
#> SRR2926032 2 0.000 0.996 0.000 1.000
#> SRR2926031 1 0.000 0.921 1.000 0.000
#> SRR2926033 2 0.000 0.996 0.000 1.000
#> SRR2926030 1 0.000 0.921 1.000 0.000
#> SRR2926029 1 0.000 0.921 1.000 0.000
#> SRR2926027 1 0.000 0.921 1.000 0.000
#> SRR2926028 1 0.000 0.921 1.000 0.000
#> SRR2926026 1 0.000 0.921 1.000 0.000
#> SRR2926025 1 0.000 0.921 1.000 0.000
#> SRR2926023 1 0.000 0.921 1.000 0.000
#> SRR2926022 1 0.000 0.921 1.000 0.000
#> SRR2926024 1 0.000 0.921 1.000 0.000
#> SRR2926021 1 0.000 0.921 1.000 0.000
#> SRR2926020 1 0.000 0.921 1.000 0.000
#> SRR2926019 1 0.000 0.921 1.000 0.000
#> SRR2926018 1 0.000 0.921 1.000 0.000
#> SRR2926017 1 0.000 0.921 1.000 0.000
#> SRR2926016 2 0.482 0.871 0.104 0.896
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> SRR2926066 3 0.0000 0.900 0.000 0.000 1.000
#> SRR2926067 2 0.6095 0.327 0.000 0.608 0.392
#> SRR2926063 3 0.0000 0.900 0.000 0.000 1.000
#> SRR2926064 2 0.0000 0.945 0.000 1.000 0.000
#> SRR2926062 2 0.0000 0.945 0.000 1.000 0.000
#> SRR2926061 2 0.0000 0.945 0.000 1.000 0.000
#> SRR2926065 2 0.0000 0.945 0.000 1.000 0.000
#> SRR2926060 2 0.0000 0.945 0.000 1.000 0.000
#> SRR2926059 3 0.4750 0.726 0.000 0.216 0.784
#> SRR2926058 3 0.4702 0.732 0.000 0.212 0.788
#> SRR2926056 1 0.5058 0.686 0.756 0.000 0.244
#> SRR2926057 1 0.2959 0.883 0.900 0.000 0.100
#> SRR2926055 3 0.6244 0.165 0.000 0.440 0.560
#> SRR2926054 3 0.2448 0.861 0.000 0.076 0.924
#> SRR2926051 3 0.0000 0.900 0.000 0.000 1.000
#> SRR2926052 3 0.0000 0.900 0.000 0.000 1.000
#> SRR2926053 3 0.0237 0.899 0.000 0.004 0.996
#> SRR2926050 3 0.0000 0.900 0.000 0.000 1.000
#> SRR2926049 2 0.0000 0.945 0.000 1.000 0.000
#> SRR2926047 2 0.0000 0.945 0.000 1.000 0.000
#> SRR2926046 3 0.0000 0.900 0.000 0.000 1.000
#> SRR2926048 2 0.0000 0.945 0.000 1.000 0.000
#> SRR2926044 2 0.0000 0.945 0.000 1.000 0.000
#> SRR2926045 3 0.0424 0.897 0.000 0.008 0.992
#> SRR2926041 2 0.0000 0.945 0.000 1.000 0.000
#> SRR2926042 2 0.0000 0.945 0.000 1.000 0.000
#> SRR2926040 2 0.0000 0.945 0.000 1.000 0.000
#> SRR2926039 2 0.0000 0.945 0.000 1.000 0.000
#> SRR2926043 2 0.0000 0.945 0.000 1.000 0.000
#> SRR2926038 2 0.0000 0.945 0.000 1.000 0.000
#> SRR2926036 2 0.0000 0.945 0.000 1.000 0.000
#> SRR2926037 2 0.0000 0.945 0.000 1.000 0.000
#> SRR2926035 2 0.0000 0.945 0.000 1.000 0.000
#> SRR2926034 2 0.0000 0.945 0.000 1.000 0.000
#> SRR2926032 2 0.0000 0.945 0.000 1.000 0.000
#> SRR2926031 1 0.0000 0.978 1.000 0.000 0.000
#> SRR2926033 2 0.6095 0.327 0.000 0.608 0.392
#> SRR2926030 1 0.0000 0.978 1.000 0.000 0.000
#> SRR2926029 1 0.0237 0.975 0.996 0.000 0.004
#> SRR2926027 1 0.0000 0.978 1.000 0.000 0.000
#> SRR2926028 1 0.0000 0.978 1.000 0.000 0.000
#> SRR2926026 1 0.0000 0.978 1.000 0.000 0.000
#> SRR2926025 1 0.0000 0.978 1.000 0.000 0.000
#> SRR2926023 1 0.0000 0.978 1.000 0.000 0.000
#> SRR2926022 1 0.0000 0.978 1.000 0.000 0.000
#> SRR2926024 1 0.0000 0.978 1.000 0.000 0.000
#> SRR2926021 1 0.0000 0.978 1.000 0.000 0.000
#> SRR2926020 1 0.0000 0.978 1.000 0.000 0.000
#> SRR2926019 1 0.0000 0.978 1.000 0.000 0.000
#> SRR2926018 1 0.0000 0.978 1.000 0.000 0.000
#> SRR2926017 1 0.0000 0.978 1.000 0.000 0.000
#> SRR2926016 2 0.5553 0.593 0.272 0.724 0.004
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> SRR2926066 3 0.1118 0.8328 0.000 0.000 0.964 0.036
#> SRR2926067 2 0.5203 0.2743 0.000 0.576 0.416 0.008
#> SRR2926063 3 0.0336 0.8340 0.000 0.000 0.992 0.008
#> SRR2926064 2 0.0817 0.9386 0.000 0.976 0.000 0.024
#> SRR2926062 2 0.0188 0.9443 0.000 0.996 0.000 0.004
#> SRR2926061 2 0.0707 0.9392 0.000 0.980 0.000 0.020
#> SRR2926065 2 0.1209 0.9330 0.000 0.964 0.004 0.032
#> SRR2926060 2 0.0817 0.9386 0.000 0.976 0.000 0.024
#> SRR2926059 3 0.6393 0.5747 0.000 0.160 0.652 0.188
#> SRR2926058 3 0.5646 0.6192 0.000 0.204 0.708 0.088
#> SRR2926056 1 0.7503 0.0282 0.496 0.000 0.276 0.228
#> SRR2926057 4 0.0937 0.7536 0.012 0.000 0.012 0.976
#> SRR2926055 3 0.5161 0.2387 0.000 0.400 0.592 0.008
#> SRR2926054 3 0.3320 0.7883 0.000 0.068 0.876 0.056
#> SRR2926051 3 0.0000 0.8327 0.000 0.000 1.000 0.000
#> SRR2926052 3 0.2197 0.8232 0.000 0.004 0.916 0.080
#> SRR2926053 3 0.0336 0.8310 0.000 0.000 0.992 0.008
#> SRR2926050 3 0.2081 0.8227 0.000 0.000 0.916 0.084
#> SRR2926049 2 0.0000 0.9446 0.000 1.000 0.000 0.000
#> SRR2926047 2 0.0000 0.9446 0.000 1.000 0.000 0.000
#> SRR2926046 3 0.1637 0.8239 0.000 0.000 0.940 0.060
#> SRR2926048 2 0.0000 0.9446 0.000 1.000 0.000 0.000
#> SRR2926044 2 0.0707 0.9392 0.000 0.980 0.000 0.020
#> SRR2926045 3 0.0672 0.8295 0.000 0.008 0.984 0.008
#> SRR2926041 2 0.0000 0.9446 0.000 1.000 0.000 0.000
#> SRR2926042 2 0.0188 0.9443 0.000 0.996 0.000 0.004
#> SRR2926040 2 0.0000 0.9446 0.000 1.000 0.000 0.000
#> SRR2926039 2 0.1022 0.9353 0.000 0.968 0.000 0.032
#> SRR2926043 2 0.0336 0.9435 0.000 0.992 0.000 0.008
#> SRR2926038 2 0.0188 0.9443 0.000 0.996 0.000 0.004
#> SRR2926036 2 0.0000 0.9446 0.000 1.000 0.000 0.000
#> SRR2926037 2 0.0000 0.9446 0.000 1.000 0.000 0.000
#> SRR2926035 2 0.0000 0.9446 0.000 1.000 0.000 0.000
#> SRR2926034 2 0.0921 0.9376 0.000 0.972 0.000 0.028
#> SRR2926032 2 0.0188 0.9443 0.000 0.996 0.000 0.004
#> SRR2926031 1 0.3764 0.7827 0.784 0.000 0.000 0.216
#> SRR2926033 2 0.5212 0.2630 0.000 0.572 0.420 0.008
#> SRR2926030 4 0.4134 0.7223 0.260 0.000 0.000 0.740
#> SRR2926029 4 0.2048 0.7576 0.064 0.000 0.008 0.928
#> SRR2926027 1 0.0188 0.8434 0.996 0.000 0.000 0.004
#> SRR2926028 1 0.3801 0.7799 0.780 0.000 0.000 0.220
#> SRR2926026 1 0.0000 0.8439 1.000 0.000 0.000 0.000
#> SRR2926025 1 0.3444 0.7931 0.816 0.000 0.000 0.184
#> SRR2926023 1 0.0000 0.8439 1.000 0.000 0.000 0.000
#> SRR2926022 4 0.4356 0.6867 0.292 0.000 0.000 0.708
#> SRR2926024 1 0.0336 0.8423 0.992 0.000 0.000 0.008
#> SRR2926021 1 0.3764 0.7827 0.784 0.000 0.000 0.216
#> SRR2926020 1 0.0000 0.8439 1.000 0.000 0.000 0.000
#> SRR2926019 1 0.0000 0.8439 1.000 0.000 0.000 0.000
#> SRR2926018 1 0.0000 0.8439 1.000 0.000 0.000 0.000
#> SRR2926017 1 0.3764 0.7828 0.784 0.000 0.000 0.216
#> SRR2926016 4 0.3710 0.6135 0.004 0.192 0.000 0.804
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> SRR2926066 3 0.0867 0.7027 0.008 0.000 0.976 0.008 0.008
#> SRR2926067 2 0.6972 -0.1260 0.260 0.396 0.336 0.008 0.000
#> SRR2926063 3 0.1270 0.7082 0.052 0.000 0.948 0.000 0.000
#> SRR2926064 2 0.4238 0.8014 0.164 0.768 0.000 0.068 0.000
#> SRR2926062 2 0.2522 0.8508 0.108 0.880 0.000 0.012 0.000
#> SRR2926061 2 0.3608 0.8251 0.112 0.824 0.000 0.064 0.000
#> SRR2926065 2 0.4252 0.8027 0.172 0.764 0.000 0.064 0.000
#> SRR2926060 2 0.4114 0.8115 0.164 0.776 0.000 0.060 0.000
#> SRR2926059 3 0.6261 0.5165 0.124 0.028 0.604 0.244 0.000
#> SRR2926058 3 0.6763 0.5343 0.136 0.100 0.612 0.152 0.000
#> SRR2926056 3 0.7721 -0.0882 0.220 0.000 0.384 0.064 0.332
#> SRR2926057 4 0.2068 0.8265 0.000 0.000 0.004 0.904 0.092
#> SRR2926055 3 0.6825 0.3901 0.288 0.244 0.460 0.008 0.000
#> SRR2926054 3 0.6397 0.6522 0.248 0.028 0.588 0.136 0.000
#> SRR2926051 3 0.2848 0.6859 0.156 0.000 0.840 0.004 0.000
#> SRR2926052 3 0.3714 0.6685 0.056 0.000 0.812 0.132 0.000
#> SRR2926053 3 0.3835 0.6475 0.260 0.000 0.732 0.008 0.000
#> SRR2926050 3 0.3115 0.6767 0.036 0.000 0.852 0.112 0.000
#> SRR2926049 2 0.0290 0.8677 0.008 0.992 0.000 0.000 0.000
#> SRR2926047 2 0.0703 0.8673 0.024 0.976 0.000 0.000 0.000
#> SRR2926046 3 0.2151 0.6953 0.020 0.000 0.924 0.040 0.016
#> SRR2926048 2 0.0162 0.8683 0.004 0.996 0.000 0.000 0.000
#> SRR2926044 2 0.3868 0.8127 0.140 0.800 0.000 0.060 0.000
#> SRR2926045 3 0.4240 0.6296 0.304 0.004 0.684 0.008 0.000
#> SRR2926041 2 0.0404 0.8680 0.012 0.988 0.000 0.000 0.000
#> SRR2926042 2 0.2193 0.8552 0.092 0.900 0.000 0.008 0.000
#> SRR2926040 2 0.0290 0.8677 0.008 0.992 0.000 0.000 0.000
#> SRR2926039 2 0.3442 0.8371 0.104 0.836 0.000 0.060 0.000
#> SRR2926043 2 0.1484 0.8639 0.048 0.944 0.000 0.008 0.000
#> SRR2926038 2 0.0865 0.8674 0.024 0.972 0.000 0.004 0.000
#> SRR2926036 2 0.0451 0.8670 0.008 0.988 0.000 0.004 0.000
#> SRR2926037 2 0.0404 0.8677 0.012 0.988 0.000 0.000 0.000
#> SRR2926035 2 0.0290 0.8677 0.008 0.992 0.000 0.000 0.000
#> SRR2926034 2 0.3102 0.8439 0.084 0.860 0.000 0.056 0.000
#> SRR2926032 2 0.0290 0.8688 0.008 0.992 0.000 0.000 0.000
#> SRR2926031 5 0.0703 0.7943 0.000 0.000 0.000 0.024 0.976
#> SRR2926033 2 0.6947 -0.1341 0.248 0.400 0.344 0.008 0.000
#> SRR2926030 4 0.3847 0.8053 0.180 0.000 0.000 0.784 0.036
#> SRR2926029 4 0.3087 0.8104 0.008 0.000 0.004 0.836 0.152
#> SRR2926027 5 0.4300 -0.9086 0.476 0.000 0.000 0.000 0.524
#> SRR2926028 5 0.0794 0.7950 0.000 0.000 0.000 0.028 0.972
#> SRR2926026 1 0.4297 0.9874 0.528 0.000 0.000 0.000 0.472
#> SRR2926025 5 0.1012 0.7585 0.020 0.000 0.000 0.012 0.968
#> SRR2926023 1 0.4297 0.9874 0.528 0.000 0.000 0.000 0.472
#> SRR2926022 4 0.4269 0.7809 0.188 0.000 0.000 0.756 0.056
#> SRR2926024 1 0.4307 0.9342 0.500 0.000 0.000 0.000 0.500
#> SRR2926021 5 0.0794 0.7950 0.000 0.000 0.000 0.028 0.972
#> SRR2926020 1 0.4297 0.9874 0.528 0.000 0.000 0.000 0.472
#> SRR2926019 1 0.4297 0.9874 0.528 0.000 0.000 0.000 0.472
#> SRR2926018 1 0.4297 0.9874 0.528 0.000 0.000 0.000 0.472
#> SRR2926017 5 0.1041 0.7922 0.004 0.000 0.000 0.032 0.964
#> SRR2926016 4 0.1043 0.7802 0.000 0.040 0.000 0.960 0.000
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> SRR2926066 3 0.4318 0.319 0.000 0.000 0.632 0.340 0.008 0.020
#> SRR2926067 4 0.3602 0.572 0.000 0.208 0.000 0.760 0.032 0.000
#> SRR2926063 4 0.4325 -0.246 0.000 0.000 0.480 0.504 0.008 0.008
#> SRR2926064 2 0.6870 0.649 0.000 0.552 0.160 0.064 0.188 0.036
#> SRR2926062 2 0.4438 0.780 0.000 0.760 0.028 0.060 0.144 0.008
#> SRR2926061 2 0.6083 0.706 0.000 0.644 0.156 0.056 0.112 0.032
#> SRR2926065 2 0.7046 0.613 0.000 0.520 0.152 0.156 0.160 0.012
#> SRR2926060 2 0.6605 0.690 0.000 0.580 0.128 0.104 0.172 0.016
#> SRR2926059 3 0.3835 0.520 0.000 0.000 0.812 0.048 0.068 0.072
#> SRR2926058 3 0.3909 0.506 0.000 0.016 0.816 0.072 0.072 0.024
#> SRR2926056 3 0.7297 0.335 0.228 0.000 0.492 0.028 0.136 0.116
#> SRR2926057 6 0.1245 0.846 0.000 0.000 0.016 0.000 0.032 0.952
#> SRR2926055 4 0.3196 0.595 0.000 0.136 0.004 0.824 0.036 0.000
#> SRR2926054 3 0.4830 0.132 0.000 0.004 0.484 0.476 0.028 0.008
#> SRR2926051 4 0.4253 0.132 0.000 0.000 0.372 0.608 0.012 0.008
#> SRR2926052 3 0.2865 0.556 0.000 0.000 0.840 0.140 0.012 0.008
#> SRR2926053 4 0.2325 0.516 0.000 0.008 0.100 0.884 0.008 0.000
#> SRR2926050 3 0.2932 0.548 0.000 0.000 0.836 0.140 0.004 0.020
#> SRR2926049 2 0.1088 0.818 0.000 0.960 0.000 0.024 0.016 0.000
#> SRR2926047 2 0.2012 0.817 0.000 0.924 0.008 0.028 0.032 0.008
#> SRR2926046 3 0.5028 0.216 0.000 0.000 0.536 0.400 0.008 0.056
#> SRR2926048 2 0.0260 0.823 0.000 0.992 0.000 0.008 0.000 0.000
#> SRR2926044 2 0.6535 0.667 0.000 0.596 0.148 0.048 0.164 0.044
#> SRR2926045 4 0.2444 0.550 0.000 0.028 0.068 0.892 0.012 0.000
#> SRR2926041 2 0.0622 0.823 0.000 0.980 0.000 0.012 0.008 0.000
#> SRR2926042 2 0.4124 0.792 0.000 0.796 0.028 0.048 0.112 0.016
#> SRR2926040 2 0.0891 0.820 0.000 0.968 0.000 0.024 0.008 0.000
#> SRR2926039 2 0.5820 0.725 0.000 0.664 0.112 0.088 0.124 0.012
#> SRR2926043 2 0.3138 0.783 0.000 0.840 0.000 0.096 0.060 0.004
#> SRR2926038 2 0.1578 0.824 0.000 0.936 0.000 0.012 0.048 0.004
#> SRR2926036 2 0.0692 0.822 0.000 0.976 0.000 0.020 0.004 0.000
#> SRR2926037 2 0.1320 0.815 0.000 0.948 0.000 0.036 0.016 0.000
#> SRR2926035 2 0.0508 0.822 0.000 0.984 0.000 0.012 0.004 0.000
#> SRR2926034 2 0.5307 0.725 0.000 0.708 0.100 0.104 0.080 0.008
#> SRR2926032 2 0.0692 0.826 0.000 0.976 0.000 0.004 0.020 0.000
#> SRR2926031 5 0.3617 0.968 0.244 0.000 0.000 0.000 0.736 0.020
#> SRR2926033 4 0.3740 0.560 0.000 0.228 0.000 0.740 0.032 0.000
#> SRR2926030 6 0.3269 0.818 0.184 0.000 0.000 0.000 0.024 0.792
#> SRR2926029 6 0.1555 0.845 0.004 0.000 0.004 0.000 0.060 0.932
#> SRR2926027 1 0.1429 0.927 0.940 0.000 0.000 0.004 0.052 0.004
#> SRR2926028 5 0.3670 0.968 0.240 0.000 0.000 0.000 0.736 0.024
#> SRR2926026 1 0.0000 0.974 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2926025 5 0.3606 0.961 0.256 0.000 0.000 0.000 0.728 0.016
#> SRR2926023 1 0.0000 0.974 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2926022 6 0.3333 0.812 0.192 0.000 0.000 0.000 0.024 0.784
#> SRR2926024 1 0.1477 0.927 0.940 0.000 0.000 0.004 0.048 0.008
#> SRR2926021 5 0.3670 0.968 0.240 0.000 0.000 0.000 0.736 0.024
#> SRR2926020 1 0.0000 0.974 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2926019 1 0.0000 0.974 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2926018 1 0.0000 0.974 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2926017 5 0.4570 0.895 0.288 0.000 0.016 0.004 0.664 0.028
#> SRR2926016 6 0.2145 0.792 0.000 0.008 0.056 0.004 0.020 0.912
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 18096 rows and 52 columns.
#> Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'CV' method.
#> Subgroups are detected by 'pam' method.
#> Performed in total 1250 partitions by row resampling.
#> Best k for subgroups seems to be 2.
#>
#> Following methods can be applied to this 'ConsensusPartition' object:
#> [1] "cola_report" "collect_classes" "collect_plots"
#> [4] "collect_stats" "colnames" "compare_signatures"
#> [7] "consensus_heatmap" "dimension_reduction" "functional_enrichment"
#> [10] "get_anno_col" "get_anno" "get_classes"
#> [13] "get_consensus" "get_matrix" "get_membership"
#> [16] "get_param" "get_signatures" "get_stats"
#> [19] "is_best_k" "is_stable_k" "membership_heatmap"
#> [22] "ncol" "nrow" "plot_ecdf"
#> [25] "rownames" "select_partition_number" "show"
#> [28] "suggest_best_k" "test_to_known_factors"
collect_plots()
function collects all the plots made from res
for all k
(number of partitions)
into one single page to provide an easy and fast comparison between different k
.
collect_plots(res)
The plots are:
k
and the heatmap of
predicted classes for each k
.k
.k
.k
.All the plots in panels can be made by individual functions and they are plotted later in this section.
select_partition_number()
produces several plots showing different
statistics for choosing “optimized” k
. There are following statistics:
k
;k
, the area increased is defined as \(A_k - A_{k-1}\).The detailed explanations of these statistics can be found in the cola vignette.
Generally speaking, lower PAC score, higher mean silhouette score or higher
concordance corresponds to better partition. Rand index and Jaccard index
measure how similar the current partition is compared to partition with k-1
.
If they are too similar, we won't accept k
is better than k-1
.
select_partition_number(res)
The numeric values for all these statistics can be obtained by get_stats()
.
get_stats(res)
#> k 1-PAC mean_silhouette concordance area_increased Rand Jaccard
#> 2 2 1.000 0.981 0.992 0.4432 0.551 0.551
#> 3 3 0.734 0.870 0.916 0.1485 0.961 0.929
#> 4 4 0.672 0.528 0.679 0.3436 0.965 0.934
#> 5 5 0.702 0.756 0.813 0.0758 0.744 0.525
#> 6 6 0.831 0.876 0.880 0.0835 0.862 0.547
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
#> SRR2926066 2 0.000 1.000 0.000 1.000
#> SRR2926067 2 0.000 1.000 0.000 1.000
#> SRR2926063 2 0.000 1.000 0.000 1.000
#> SRR2926064 2 0.000 1.000 0.000 1.000
#> SRR2926062 2 0.000 1.000 0.000 1.000
#> SRR2926061 2 0.000 1.000 0.000 1.000
#> SRR2926065 2 0.000 1.000 0.000 1.000
#> SRR2926060 2 0.000 1.000 0.000 1.000
#> SRR2926059 2 0.000 1.000 0.000 1.000
#> SRR2926058 2 0.000 1.000 0.000 1.000
#> SRR2926056 1 0.224 0.946 0.964 0.036
#> SRR2926057 1 0.932 0.476 0.652 0.348
#> SRR2926055 2 0.000 1.000 0.000 1.000
#> SRR2926054 2 0.000 1.000 0.000 1.000
#> SRR2926051 2 0.000 1.000 0.000 1.000
#> SRR2926052 2 0.000 1.000 0.000 1.000
#> SRR2926053 2 0.000 1.000 0.000 1.000
#> SRR2926050 2 0.000 1.000 0.000 1.000
#> SRR2926049 2 0.000 1.000 0.000 1.000
#> SRR2926047 2 0.000 1.000 0.000 1.000
#> SRR2926046 2 0.000 1.000 0.000 1.000
#> SRR2926048 2 0.000 1.000 0.000 1.000
#> SRR2926044 2 0.000 1.000 0.000 1.000
#> SRR2926045 2 0.000 1.000 0.000 1.000
#> SRR2926041 2 0.000 1.000 0.000 1.000
#> SRR2926042 2 0.000 1.000 0.000 1.000
#> SRR2926040 2 0.000 1.000 0.000 1.000
#> SRR2926039 2 0.000 1.000 0.000 1.000
#> SRR2926043 2 0.000 1.000 0.000 1.000
#> SRR2926038 2 0.000 1.000 0.000 1.000
#> SRR2926036 2 0.000 1.000 0.000 1.000
#> SRR2926037 2 0.000 1.000 0.000 1.000
#> SRR2926035 2 0.000 1.000 0.000 1.000
#> SRR2926034 2 0.000 1.000 0.000 1.000
#> SRR2926032 2 0.000 1.000 0.000 1.000
#> SRR2926031 1 0.000 0.974 1.000 0.000
#> SRR2926033 2 0.000 1.000 0.000 1.000
#> SRR2926030 1 0.000 0.974 1.000 0.000
#> SRR2926029 1 0.000 0.974 1.000 0.000
#> SRR2926027 1 0.000 0.974 1.000 0.000
#> SRR2926028 1 0.204 0.950 0.968 0.032
#> SRR2926026 1 0.000 0.974 1.000 0.000
#> SRR2926025 1 0.000 0.974 1.000 0.000
#> SRR2926023 1 0.000 0.974 1.000 0.000
#> SRR2926022 1 0.000 0.974 1.000 0.000
#> SRR2926024 1 0.000 0.974 1.000 0.000
#> SRR2926021 1 0.000 0.974 1.000 0.000
#> SRR2926020 1 0.000 0.974 1.000 0.000
#> SRR2926019 1 0.000 0.974 1.000 0.000
#> SRR2926018 1 0.000 0.974 1.000 0.000
#> SRR2926017 1 0.000 0.974 1.000 0.000
#> SRR2926016 2 0.000 1.000 0.000 1.000
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> SRR2926066 2 0.3752 0.893 0.000 0.856 0.144
#> SRR2926067 2 0.1643 0.935 0.000 0.956 0.044
#> SRR2926063 2 0.3752 0.893 0.000 0.856 0.144
#> SRR2926064 2 0.0747 0.938 0.000 0.984 0.016
#> SRR2926062 2 0.0000 0.938 0.000 1.000 0.000
#> SRR2926061 2 0.0592 0.937 0.000 0.988 0.012
#> SRR2926065 2 0.1643 0.935 0.000 0.956 0.044
#> SRR2926060 2 0.0237 0.938 0.000 0.996 0.004
#> SRR2926059 2 0.3752 0.893 0.000 0.856 0.144
#> SRR2926058 2 0.3340 0.905 0.000 0.880 0.120
#> SRR2926056 1 0.7673 0.554 0.664 0.100 0.236
#> SRR2926057 3 0.4702 0.503 0.000 0.212 0.788
#> SRR2926055 2 0.1753 0.934 0.000 0.952 0.048
#> SRR2926054 2 0.3752 0.893 0.000 0.856 0.144
#> SRR2926051 2 0.3752 0.893 0.000 0.856 0.144
#> SRR2926052 2 0.3752 0.893 0.000 0.856 0.144
#> SRR2926053 2 0.3752 0.893 0.000 0.856 0.144
#> SRR2926050 2 0.3752 0.893 0.000 0.856 0.144
#> SRR2926049 2 0.0592 0.937 0.000 0.988 0.012
#> SRR2926047 2 0.0592 0.937 0.000 0.988 0.012
#> SRR2926046 2 0.3752 0.893 0.000 0.856 0.144
#> SRR2926048 2 0.0592 0.937 0.000 0.988 0.012
#> SRR2926044 2 0.1529 0.935 0.000 0.960 0.040
#> SRR2926045 2 0.3752 0.893 0.000 0.856 0.144
#> SRR2926041 2 0.0592 0.937 0.000 0.988 0.012
#> SRR2926042 2 0.0592 0.937 0.000 0.988 0.012
#> SRR2926040 2 0.0592 0.937 0.000 0.988 0.012
#> SRR2926039 2 0.0592 0.937 0.000 0.988 0.012
#> SRR2926043 2 0.0000 0.938 0.000 1.000 0.000
#> SRR2926038 2 0.0592 0.937 0.000 0.988 0.012
#> SRR2926036 2 0.0592 0.937 0.000 0.988 0.012
#> SRR2926037 2 0.0592 0.937 0.000 0.988 0.012
#> SRR2926035 2 0.0592 0.937 0.000 0.988 0.012
#> SRR2926034 2 0.1031 0.937 0.000 0.976 0.024
#> SRR2926032 2 0.0592 0.937 0.000 0.988 0.012
#> SRR2926031 1 0.0000 0.782 1.000 0.000 0.000
#> SRR2926033 2 0.1643 0.935 0.000 0.956 0.044
#> SRR2926030 3 0.3941 0.663 0.156 0.000 0.844
#> SRR2926029 3 0.0892 0.678 0.020 0.000 0.980
#> SRR2926027 1 0.4555 0.863 0.800 0.000 0.200
#> SRR2926028 1 0.3415 0.696 0.900 0.020 0.080
#> SRR2926026 1 0.4555 0.863 0.800 0.000 0.200
#> SRR2926025 1 0.0000 0.782 1.000 0.000 0.000
#> SRR2926023 1 0.4555 0.863 0.800 0.000 0.200
#> SRR2926022 3 0.3941 0.663 0.156 0.000 0.844
#> SRR2926024 1 0.4555 0.863 0.800 0.000 0.200
#> SRR2926021 1 0.0000 0.782 1.000 0.000 0.000
#> SRR2926020 1 0.4555 0.863 0.800 0.000 0.200
#> SRR2926019 1 0.4555 0.863 0.800 0.000 0.200
#> SRR2926018 1 0.4555 0.863 0.800 0.000 0.200
#> SRR2926017 1 0.5619 0.808 0.744 0.012 0.244
#> SRR2926016 2 0.1643 0.935 0.000 0.956 0.044
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> SRR2926066 2 0.497 0.1950 0.000 0.544 0.456 0.000
#> SRR2926067 2 0.349 0.3398 0.000 0.812 0.188 0.000
#> SRR2926063 2 0.497 0.1950 0.000 0.544 0.456 0.000
#> SRR2926064 2 0.487 0.5465 0.000 0.596 0.000 0.404
#> SRR2926062 2 0.498 0.5531 0.000 0.536 0.000 0.464
#> SRR2926061 2 0.499 0.5530 0.000 0.528 0.000 0.472
#> SRR2926065 2 0.000 0.4443 0.000 1.000 0.000 0.000
#> SRR2926060 2 0.480 0.5444 0.000 0.616 0.000 0.384
#> SRR2926059 2 0.422 0.3131 0.000 0.728 0.272 0.000
#> SRR2926058 2 0.373 0.3482 0.000 0.788 0.212 0.000
#> SRR2926056 2 0.656 0.0677 0.076 0.468 0.456 0.000
#> SRR2926057 3 0.448 0.8042 0.000 0.012 0.740 0.248
#> SRR2926055 2 0.228 0.3989 0.000 0.904 0.096 0.000
#> SRR2926054 2 0.466 0.2690 0.000 0.652 0.348 0.000
#> SRR2926051 2 0.497 0.1950 0.000 0.544 0.456 0.000
#> SRR2926052 2 0.462 0.2743 0.000 0.660 0.340 0.000
#> SRR2926053 2 0.497 0.1950 0.000 0.544 0.456 0.000
#> SRR2926050 2 0.497 0.1950 0.000 0.544 0.456 0.000
#> SRR2926049 2 0.499 0.5530 0.000 0.528 0.000 0.472
#> SRR2926047 2 0.499 0.5530 0.000 0.528 0.000 0.472
#> SRR2926046 2 0.497 0.1950 0.000 0.544 0.456 0.000
#> SRR2926048 2 0.499 0.5530 0.000 0.528 0.000 0.472
#> SRR2926044 2 0.410 0.5139 0.000 0.744 0.000 0.256
#> SRR2926045 2 0.497 0.1950 0.000 0.544 0.456 0.000
#> SRR2926041 2 0.499 0.5530 0.000 0.528 0.000 0.472
#> SRR2926042 2 0.499 0.5530 0.000 0.528 0.000 0.472
#> SRR2926040 2 0.499 0.5530 0.000 0.528 0.000 0.472
#> SRR2926039 2 0.499 0.5530 0.000 0.528 0.000 0.472
#> SRR2926043 2 0.498 0.5531 0.000 0.536 0.000 0.464
#> SRR2926038 2 0.499 0.5530 0.000 0.528 0.000 0.472
#> SRR2926036 2 0.499 0.5530 0.000 0.528 0.000 0.472
#> SRR2926037 2 0.499 0.5530 0.000 0.528 0.000 0.472
#> SRR2926035 2 0.499 0.5530 0.000 0.528 0.000 0.472
#> SRR2926034 2 0.466 0.5342 0.000 0.652 0.000 0.348
#> SRR2926032 2 0.499 0.5530 0.000 0.528 0.000 0.472
#> SRR2926031 1 0.428 0.7497 0.720 0.000 0.000 0.280
#> SRR2926033 2 0.349 0.3398 0.000 0.812 0.188 0.000
#> SRR2926030 3 0.724 0.7838 0.208 0.000 0.544 0.248
#> SRR2926029 3 0.422 0.8015 0.000 0.004 0.748 0.248
#> SRR2926027 1 0.000 0.8389 1.000 0.000 0.000 0.000
#> SRR2926028 1 0.810 0.5732 0.540 0.092 0.088 0.280
#> SRR2926026 1 0.000 0.8389 1.000 0.000 0.000 0.000
#> SRR2926025 1 0.428 0.7497 0.720 0.000 0.000 0.280
#> SRR2926023 1 0.000 0.8389 1.000 0.000 0.000 0.000
#> SRR2926022 3 0.727 0.7817 0.212 0.000 0.540 0.248
#> SRR2926024 1 0.000 0.8389 1.000 0.000 0.000 0.000
#> SRR2926021 1 0.428 0.7497 0.720 0.000 0.000 0.280
#> SRR2926020 1 0.000 0.8389 1.000 0.000 0.000 0.000
#> SRR2926019 1 0.000 0.8389 1.000 0.000 0.000 0.000
#> SRR2926018 1 0.000 0.8389 1.000 0.000 0.000 0.000
#> SRR2926017 1 0.579 0.5496 0.656 0.000 0.284 0.060
#> SRR2926016 2 0.000 0.4443 0.000 1.000 0.000 0.000
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> SRR2926066 3 0.0000 0.820 0.000 0.000 1.000 0.000 0.000
#> SRR2926067 2 0.6802 0.430 0.000 0.372 0.328 0.300 0.000
#> SRR2926063 3 0.0000 0.820 0.000 0.000 1.000 0.000 0.000
#> SRR2926064 2 0.4445 0.779 0.000 0.676 0.024 0.300 0.000
#> SRR2926062 2 0.4173 0.781 0.000 0.688 0.012 0.300 0.000
#> SRR2926061 2 0.3796 0.782 0.000 0.700 0.000 0.300 0.000
#> SRR2926065 2 0.5972 0.697 0.000 0.560 0.140 0.300 0.000
#> SRR2926060 2 0.4677 0.774 0.000 0.664 0.036 0.300 0.000
#> SRR2926059 3 0.3039 0.664 0.000 0.192 0.808 0.000 0.000
#> SRR2926058 3 0.6725 -0.163 0.000 0.288 0.420 0.292 0.000
#> SRR2926056 3 0.0162 0.817 0.004 0.000 0.996 0.000 0.000
#> SRR2926057 4 0.3796 0.853 0.000 0.000 0.000 0.700 0.300
#> SRR2926055 2 0.6575 0.589 0.000 0.464 0.236 0.300 0.000
#> SRR2926054 3 0.2179 0.750 0.000 0.112 0.888 0.000 0.000
#> SRR2926051 3 0.0000 0.820 0.000 0.000 1.000 0.000 0.000
#> SRR2926052 3 0.2280 0.743 0.000 0.120 0.880 0.000 0.000
#> SRR2926053 3 0.0000 0.820 0.000 0.000 1.000 0.000 0.000
#> SRR2926050 3 0.0000 0.820 0.000 0.000 1.000 0.000 0.000
#> SRR2926049 2 0.0000 0.764 0.000 1.000 0.000 0.000 0.000
#> SRR2926047 2 0.0000 0.764 0.000 1.000 0.000 0.000 0.000
#> SRR2926046 3 0.0000 0.820 0.000 0.000 1.000 0.000 0.000
#> SRR2926048 2 0.0000 0.764 0.000 1.000 0.000 0.000 0.000
#> SRR2926044 2 0.5534 0.737 0.000 0.604 0.096 0.300 0.000
#> SRR2926045 3 0.0000 0.820 0.000 0.000 1.000 0.000 0.000
#> SRR2926041 2 0.0000 0.764 0.000 1.000 0.000 0.000 0.000
#> SRR2926042 2 0.3796 0.782 0.000 0.700 0.000 0.300 0.000
#> SRR2926040 2 0.0000 0.764 0.000 1.000 0.000 0.000 0.000
#> SRR2926039 2 0.3796 0.782 0.000 0.700 0.000 0.300 0.000
#> SRR2926043 2 0.3942 0.787 0.000 0.728 0.012 0.260 0.000
#> SRR2926038 2 0.0000 0.764 0.000 1.000 0.000 0.000 0.000
#> SRR2926036 2 0.0000 0.764 0.000 1.000 0.000 0.000 0.000
#> SRR2926037 2 0.0000 0.764 0.000 1.000 0.000 0.000 0.000
#> SRR2926035 2 0.0000 0.764 0.000 1.000 0.000 0.000 0.000
#> SRR2926034 2 0.4946 0.767 0.000 0.648 0.052 0.300 0.000
#> SRR2926032 2 0.0000 0.764 0.000 1.000 0.000 0.000 0.000
#> SRR2926031 5 0.3796 0.891 0.300 0.000 0.000 0.000 0.700
#> SRR2926033 2 0.5731 0.444 0.000 0.568 0.328 0.104 0.000
#> SRR2926030 4 0.6301 0.848 0.184 0.000 0.000 0.516 0.300
#> SRR2926029 4 0.3796 0.853 0.000 0.000 0.000 0.700 0.300
#> SRR2926027 1 0.0000 1.000 1.000 0.000 0.000 0.000 0.000
#> SRR2926028 5 0.5083 0.738 0.160 0.000 0.140 0.000 0.700
#> SRR2926026 1 0.0000 1.000 1.000 0.000 0.000 0.000 0.000
#> SRR2926025 5 0.3932 0.867 0.328 0.000 0.000 0.000 0.672
#> SRR2926023 1 0.0000 1.000 1.000 0.000 0.000 0.000 0.000
#> SRR2926022 4 0.6326 0.845 0.188 0.000 0.000 0.512 0.300
#> SRR2926024 1 0.0000 1.000 1.000 0.000 0.000 0.000 0.000
#> SRR2926021 5 0.3796 0.891 0.300 0.000 0.000 0.000 0.700
#> SRR2926020 1 0.0000 1.000 1.000 0.000 0.000 0.000 0.000
#> SRR2926019 1 0.0000 1.000 1.000 0.000 0.000 0.000 0.000
#> SRR2926018 1 0.0000 1.000 1.000 0.000 0.000 0.000 0.000
#> SRR2926017 3 0.6813 -0.514 0.304 0.000 0.356 0.000 0.340
#> SRR2926016 2 0.5972 0.697 0.000 0.560 0.140 0.300 0.000
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> SRR2926066 3 0.0000 0.942 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2926067 4 0.4585 0.753 0.000 0.116 0.192 0.692 0.000 0.000
#> SRR2926063 3 0.0000 0.942 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2926064 4 0.2664 0.925 0.000 0.184 0.000 0.816 0.000 0.000
#> SRR2926062 4 0.2854 0.914 0.000 0.208 0.000 0.792 0.000 0.000
#> SRR2926061 4 0.2597 0.925 0.000 0.176 0.000 0.824 0.000 0.000
#> SRR2926065 4 0.2793 0.921 0.000 0.200 0.000 0.800 0.000 0.000
#> SRR2926060 4 0.2597 0.925 0.000 0.176 0.000 0.824 0.000 0.000
#> SRR2926059 3 0.4255 0.577 0.000 0.068 0.708 0.224 0.000 0.000
#> SRR2926058 4 0.3313 0.875 0.000 0.124 0.060 0.816 0.000 0.000
#> SRR2926056 3 0.0000 0.942 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2926057 6 0.2854 0.829 0.000 0.000 0.000 0.208 0.000 0.792
#> SRR2926055 4 0.4898 0.739 0.000 0.144 0.200 0.656 0.000 0.000
#> SRR2926054 3 0.1341 0.899 0.000 0.028 0.948 0.024 0.000 0.000
#> SRR2926051 3 0.0000 0.942 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2926052 3 0.1720 0.881 0.000 0.032 0.928 0.040 0.000 0.000
#> SRR2926053 3 0.0000 0.942 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2926050 3 0.0000 0.942 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2926049 2 0.0363 0.920 0.000 0.988 0.000 0.012 0.000 0.000
#> SRR2926047 2 0.0865 0.904 0.000 0.964 0.000 0.036 0.000 0.000
#> SRR2926046 3 0.0000 0.942 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2926048 2 0.0000 0.926 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2926044 4 0.2597 0.925 0.000 0.176 0.000 0.824 0.000 0.000
#> SRR2926045 3 0.0000 0.942 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2926041 2 0.0547 0.914 0.000 0.980 0.000 0.020 0.000 0.000
#> SRR2926042 4 0.2969 0.905 0.000 0.224 0.000 0.776 0.000 0.000
#> SRR2926040 2 0.0000 0.926 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2926039 4 0.2730 0.924 0.000 0.192 0.000 0.808 0.000 0.000
#> SRR2926043 4 0.3221 0.869 0.000 0.264 0.000 0.736 0.000 0.000
#> SRR2926038 2 0.0000 0.926 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2926036 2 0.0000 0.926 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2926037 2 0.0937 0.894 0.000 0.960 0.000 0.040 0.000 0.000
#> SRR2926035 2 0.0000 0.926 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2926034 4 0.3198 0.877 0.000 0.260 0.000 0.740 0.000 0.000
#> SRR2926032 2 0.0000 0.926 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2926031 5 0.0000 0.835 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR2926033 2 0.5992 0.013 0.000 0.440 0.268 0.292 0.000 0.000
#> SRR2926030 6 0.1663 0.849 0.088 0.000 0.000 0.000 0.000 0.912
#> SRR2926029 6 0.2597 0.840 0.000 0.000 0.000 0.176 0.000 0.824
#> SRR2926027 1 0.0000 1.000 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2926028 5 0.0000 0.835 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR2926026 1 0.0000 1.000 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2926025 5 0.1765 0.765 0.096 0.000 0.000 0.000 0.904 0.000
#> SRR2926023 1 0.0000 1.000 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2926022 6 0.1714 0.847 0.092 0.000 0.000 0.000 0.000 0.908
#> SRR2926024 1 0.0000 1.000 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2926021 5 0.0000 0.835 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR2926020 1 0.0000 1.000 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2926019 1 0.0000 1.000 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2926018 1 0.0000 1.000 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2926017 5 0.3795 0.421 0.004 0.000 0.364 0.000 0.632 0.000
#> SRR2926016 4 0.2631 0.925 0.000 0.180 0.000 0.820 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 18096 rows and 52 columns.
#> Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'CV' method.
#> Subgroups are detected by 'mclust' method.
#> Performed in total 1250 partitions by row resampling.
#> Best k for subgroups seems to be 2.
#>
#> Following methods can be applied to this 'ConsensusPartition' object:
#> [1] "cola_report" "collect_classes" "collect_plots"
#> [4] "collect_stats" "colnames" "compare_signatures"
#> [7] "consensus_heatmap" "dimension_reduction" "functional_enrichment"
#> [10] "get_anno_col" "get_anno" "get_classes"
#> [13] "get_consensus" "get_matrix" "get_membership"
#> [16] "get_param" "get_signatures" "get_stats"
#> [19] "is_best_k" "is_stable_k" "membership_heatmap"
#> [22] "ncol" "nrow" "plot_ecdf"
#> [25] "rownames" "select_partition_number" "show"
#> [28] "suggest_best_k" "test_to_known_factors"
collect_plots()
function collects all the plots made from res
for all k
(number of partitions)
into one single page to provide an easy and fast comparison between different k
.
collect_plots(res)
The plots are:
k
and the heatmap of
predicted classes for each k
.k
.k
.k
.All the plots in panels can be made by individual functions and they are plotted later in this section.
select_partition_number()
produces several plots showing different
statistics for choosing “optimized” k
. There are following statistics:
k
;k
, the area increased is defined as \(A_k - A_{k-1}\).The detailed explanations of these statistics can be found in the cola vignette.
Generally speaking, lower PAC score, higher mean silhouette score or higher
concordance corresponds to better partition. Rand index and Jaccard index
measure how similar the current partition is compared to partition with k-1
.
If they are too similar, we won't accept k
is better than k-1
.
select_partition_number(res)
The numeric values for all these statistics can be obtained by get_stats()
.
get_stats(res)
#> k 1-PAC mean_silhouette concordance area_increased Rand Jaccard
#> 2 2 1.000 0.973 0.988 0.4632 0.538 0.538
#> 3 3 0.698 0.834 0.870 0.4084 0.789 0.608
#> 4 4 0.613 0.584 0.831 0.0867 0.880 0.667
#> 5 5 0.713 0.782 0.858 0.0583 0.927 0.756
#> 6 6 0.639 0.537 0.734 0.0468 0.888 0.592
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
#> SRR2926066 2 0.563 0.847 0.132 0.868
#> SRR2926067 2 0.000 0.989 0.000 1.000
#> SRR2926063 2 0.000 0.989 0.000 1.000
#> SRR2926064 2 0.000 0.989 0.000 1.000
#> SRR2926062 2 0.000 0.989 0.000 1.000
#> SRR2926061 2 0.000 0.989 0.000 1.000
#> SRR2926065 2 0.000 0.989 0.000 1.000
#> SRR2926060 2 0.000 0.989 0.000 1.000
#> SRR2926059 2 0.000 0.989 0.000 1.000
#> SRR2926058 2 0.000 0.989 0.000 1.000
#> SRR2926056 1 0.000 0.985 1.000 0.000
#> SRR2926057 1 0.000 0.985 1.000 0.000
#> SRR2926055 2 0.000 0.989 0.000 1.000
#> SRR2926054 2 0.000 0.989 0.000 1.000
#> SRR2926051 2 0.000 0.989 0.000 1.000
#> SRR2926052 2 0.204 0.959 0.032 0.968
#> SRR2926053 2 0.000 0.989 0.000 1.000
#> SRR2926050 2 0.000 0.989 0.000 1.000
#> SRR2926049 2 0.000 0.989 0.000 1.000
#> SRR2926047 2 0.000 0.989 0.000 1.000
#> SRR2926046 2 0.730 0.749 0.204 0.796
#> SRR2926048 2 0.000 0.989 0.000 1.000
#> SRR2926044 2 0.000 0.989 0.000 1.000
#> SRR2926045 2 0.000 0.989 0.000 1.000
#> SRR2926041 2 0.000 0.989 0.000 1.000
#> SRR2926042 2 0.000 0.989 0.000 1.000
#> SRR2926040 2 0.000 0.989 0.000 1.000
#> SRR2926039 2 0.000 0.989 0.000 1.000
#> SRR2926043 2 0.000 0.989 0.000 1.000
#> SRR2926038 2 0.000 0.989 0.000 1.000
#> SRR2926036 2 0.000 0.989 0.000 1.000
#> SRR2926037 2 0.000 0.989 0.000 1.000
#> SRR2926035 2 0.000 0.989 0.000 1.000
#> SRR2926034 2 0.000 0.989 0.000 1.000
#> SRR2926032 2 0.000 0.989 0.000 1.000
#> SRR2926031 1 0.000 0.985 1.000 0.000
#> SRR2926033 2 0.000 0.989 0.000 1.000
#> SRR2926030 1 0.000 0.985 1.000 0.000
#> SRR2926029 1 0.000 0.985 1.000 0.000
#> SRR2926027 1 0.000 0.985 1.000 0.000
#> SRR2926028 1 0.000 0.985 1.000 0.000
#> SRR2926026 1 0.000 0.985 1.000 0.000
#> SRR2926025 1 0.000 0.985 1.000 0.000
#> SRR2926023 1 0.000 0.985 1.000 0.000
#> SRR2926022 1 0.000 0.985 1.000 0.000
#> SRR2926024 1 0.000 0.985 1.000 0.000
#> SRR2926021 1 0.000 0.985 1.000 0.000
#> SRR2926020 1 0.000 0.985 1.000 0.000
#> SRR2926019 1 0.000 0.985 1.000 0.000
#> SRR2926018 1 0.000 0.985 1.000 0.000
#> SRR2926017 1 0.000 0.985 1.000 0.000
#> SRR2926016 1 0.808 0.671 0.752 0.248
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> SRR2926066 3 0.2772 0.903 0.004 0.080 0.916
#> SRR2926067 3 0.4062 0.903 0.000 0.164 0.836
#> SRR2926063 3 0.2625 0.906 0.000 0.084 0.916
#> SRR2926064 2 0.4796 0.690 0.000 0.780 0.220
#> SRR2926062 2 0.5560 0.575 0.000 0.700 0.300
#> SRR2926061 2 0.5560 0.576 0.000 0.700 0.300
#> SRR2926065 2 0.5733 0.470 0.000 0.676 0.324
#> SRR2926060 2 0.2878 0.812 0.000 0.904 0.096
#> SRR2926059 3 0.5254 0.772 0.000 0.264 0.736
#> SRR2926058 3 0.5650 0.703 0.000 0.312 0.688
#> SRR2926056 1 0.5792 0.729 0.772 0.036 0.192
#> SRR2926057 1 0.2356 0.916 0.928 0.000 0.072
#> SRR2926055 3 0.4178 0.907 0.000 0.172 0.828
#> SRR2926054 3 0.4121 0.908 0.000 0.168 0.832
#> SRR2926051 3 0.2625 0.906 0.000 0.084 0.916
#> SRR2926052 3 0.3686 0.915 0.000 0.140 0.860
#> SRR2926053 3 0.3267 0.914 0.000 0.116 0.884
#> SRR2926050 3 0.3619 0.916 0.000 0.136 0.864
#> SRR2926049 2 0.0000 0.860 0.000 1.000 0.000
#> SRR2926047 2 0.0747 0.860 0.000 0.984 0.016
#> SRR2926046 3 0.2860 0.904 0.004 0.084 0.912
#> SRR2926048 2 0.0424 0.860 0.000 0.992 0.008
#> SRR2926044 2 0.4842 0.685 0.000 0.776 0.224
#> SRR2926045 3 0.4121 0.909 0.000 0.168 0.832
#> SRR2926041 2 0.0237 0.860 0.000 0.996 0.004
#> SRR2926042 2 0.1163 0.856 0.000 0.972 0.028
#> SRR2926040 2 0.0000 0.860 0.000 1.000 0.000
#> SRR2926039 2 0.0592 0.860 0.000 0.988 0.012
#> SRR2926043 2 0.5678 0.560 0.000 0.684 0.316
#> SRR2926038 2 0.0000 0.860 0.000 1.000 0.000
#> SRR2926036 2 0.1289 0.849 0.000 0.968 0.032
#> SRR2926037 2 0.0000 0.860 0.000 1.000 0.000
#> SRR2926035 2 0.0000 0.860 0.000 1.000 0.000
#> SRR2926034 2 0.4887 0.654 0.000 0.772 0.228
#> SRR2926032 2 0.0000 0.860 0.000 1.000 0.000
#> SRR2926031 1 0.0000 0.935 1.000 0.000 0.000
#> SRR2926033 3 0.3551 0.912 0.000 0.132 0.868
#> SRR2926030 1 0.2066 0.920 0.940 0.000 0.060
#> SRR2926029 1 0.2066 0.920 0.940 0.000 0.060
#> SRR2926027 1 0.0237 0.935 0.996 0.000 0.004
#> SRR2926028 1 0.0000 0.935 1.000 0.000 0.000
#> SRR2926026 1 0.1031 0.933 0.976 0.000 0.024
#> SRR2926025 1 0.0000 0.935 1.000 0.000 0.000
#> SRR2926023 1 0.1031 0.933 0.976 0.000 0.024
#> SRR2926022 1 0.2066 0.920 0.940 0.000 0.060
#> SRR2926024 1 0.0237 0.935 0.996 0.000 0.004
#> SRR2926021 1 0.0000 0.935 1.000 0.000 0.000
#> SRR2926020 1 0.1031 0.933 0.976 0.000 0.024
#> SRR2926019 1 0.1031 0.933 0.976 0.000 0.024
#> SRR2926018 1 0.1031 0.933 0.976 0.000 0.024
#> SRR2926017 1 0.2796 0.875 0.908 0.000 0.092
#> SRR2926016 1 0.9487 0.124 0.496 0.244 0.260
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> SRR2926066 3 0.0000 0.7714 0.000 0.000 1.000 0.000
#> SRR2926067 3 0.3688 0.6903 0.000 0.208 0.792 0.000
#> SRR2926063 3 0.0000 0.7714 0.000 0.000 1.000 0.000
#> SRR2926064 2 0.4933 0.2648 0.000 0.568 0.432 0.000
#> SRR2926062 3 0.4998 -0.1078 0.000 0.488 0.512 0.000
#> SRR2926061 2 0.4933 0.2648 0.000 0.568 0.432 0.000
#> SRR2926065 2 0.4382 0.4840 0.000 0.704 0.296 0.000
#> SRR2926060 2 0.1302 0.8067 0.000 0.956 0.044 0.000
#> SRR2926059 3 0.4164 0.5662 0.000 0.264 0.736 0.000
#> SRR2926058 3 0.4040 0.6169 0.000 0.248 0.752 0.000
#> SRR2926056 3 0.6054 0.2046 0.040 0.008 0.604 0.348
#> SRR2926057 4 0.0817 0.5742 0.024 0.000 0.000 0.976
#> SRR2926055 3 0.3726 0.6885 0.000 0.212 0.788 0.000
#> SRR2926054 3 0.2345 0.7618 0.000 0.100 0.900 0.000
#> SRR2926051 3 0.0000 0.7714 0.000 0.000 1.000 0.000
#> SRR2926052 3 0.1211 0.7711 0.000 0.040 0.960 0.000
#> SRR2926053 3 0.3219 0.7262 0.000 0.164 0.836 0.000
#> SRR2926050 3 0.0921 0.7728 0.000 0.028 0.972 0.000
#> SRR2926049 2 0.0000 0.8183 0.000 1.000 0.000 0.000
#> SRR2926047 2 0.1637 0.7976 0.000 0.940 0.060 0.000
#> SRR2926046 3 0.0000 0.7714 0.000 0.000 1.000 0.000
#> SRR2926048 2 0.0592 0.8134 0.000 0.984 0.016 0.000
#> SRR2926044 2 0.4941 0.2533 0.000 0.564 0.436 0.000
#> SRR2926045 3 0.2408 0.7629 0.000 0.104 0.896 0.000
#> SRR2926041 2 0.0000 0.8183 0.000 1.000 0.000 0.000
#> SRR2926042 2 0.3837 0.6519 0.000 0.776 0.224 0.000
#> SRR2926040 2 0.0000 0.8183 0.000 1.000 0.000 0.000
#> SRR2926039 2 0.1022 0.8119 0.000 0.968 0.032 0.000
#> SRR2926043 2 0.4477 0.4902 0.000 0.688 0.312 0.000
#> SRR2926038 2 0.0000 0.8183 0.000 1.000 0.000 0.000
#> SRR2926036 2 0.1118 0.8032 0.000 0.964 0.036 0.000
#> SRR2926037 2 0.0000 0.8183 0.000 1.000 0.000 0.000
#> SRR2926035 2 0.0000 0.8183 0.000 1.000 0.000 0.000
#> SRR2926034 2 0.3764 0.6272 0.000 0.784 0.216 0.000
#> SRR2926032 2 0.0000 0.8183 0.000 1.000 0.000 0.000
#> SRR2926031 4 0.5512 0.1784 0.488 0.000 0.016 0.496
#> SRR2926033 3 0.3610 0.6958 0.000 0.200 0.800 0.000
#> SRR2926030 4 0.0921 0.5734 0.028 0.000 0.000 0.972
#> SRR2926029 4 0.0817 0.5742 0.024 0.000 0.000 0.976
#> SRR2926027 1 0.5130 0.2257 0.652 0.000 0.016 0.332
#> SRR2926028 4 0.5512 0.1784 0.488 0.000 0.016 0.496
#> SRR2926026 1 0.0000 0.7420 1.000 0.000 0.000 0.000
#> SRR2926025 4 0.5512 0.1784 0.488 0.000 0.016 0.496
#> SRR2926023 1 0.0000 0.7420 1.000 0.000 0.000 0.000
#> SRR2926022 4 0.1118 0.5691 0.036 0.000 0.000 0.964
#> SRR2926024 1 0.4908 0.3369 0.692 0.000 0.016 0.292
#> SRR2926021 4 0.5512 0.1784 0.488 0.000 0.016 0.496
#> SRR2926020 1 0.0000 0.7420 1.000 0.000 0.000 0.000
#> SRR2926019 1 0.0000 0.7420 1.000 0.000 0.000 0.000
#> SRR2926018 1 0.0000 0.7420 1.000 0.000 0.000 0.000
#> SRR2926017 1 0.7070 -0.0200 0.516 0.000 0.136 0.348
#> SRR2926016 3 0.7055 0.0754 0.000 0.396 0.480 0.124
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> SRR2926066 3 0.2835 0.8339 0.004 0.000 0.880 0.080 0.036
#> SRR2926067 3 0.1205 0.8726 0.000 0.040 0.956 0.004 0.000
#> SRR2926063 3 0.1202 0.8749 0.004 0.004 0.960 0.032 0.000
#> SRR2926064 2 0.4996 0.6179 0.012 0.652 0.304 0.032 0.000
#> SRR2926062 2 0.5141 0.5682 0.012 0.600 0.360 0.028 0.000
#> SRR2926061 2 0.4996 0.6179 0.012 0.652 0.304 0.032 0.000
#> SRR2926065 2 0.4437 0.5418 0.000 0.664 0.316 0.020 0.000
#> SRR2926060 2 0.1991 0.8226 0.004 0.916 0.076 0.004 0.000
#> SRR2926059 3 0.4399 0.7695 0.004 0.136 0.792 0.036 0.032
#> SRR2926058 3 0.3439 0.7403 0.004 0.188 0.800 0.008 0.000
#> SRR2926056 3 0.7403 -0.0828 0.032 0.000 0.400 0.292 0.276
#> SRR2926057 4 0.3218 0.8107 0.016 0.012 0.000 0.848 0.124
#> SRR2926055 3 0.1041 0.8761 0.000 0.032 0.964 0.004 0.000
#> SRR2926054 3 0.2378 0.8620 0.000 0.048 0.904 0.048 0.000
#> SRR2926051 3 0.1443 0.8717 0.004 0.004 0.948 0.044 0.000
#> SRR2926052 3 0.1960 0.8692 0.004 0.020 0.928 0.048 0.000
#> SRR2926053 3 0.1012 0.8777 0.000 0.020 0.968 0.012 0.000
#> SRR2926050 3 0.2427 0.8615 0.004 0.008 0.912 0.048 0.028
#> SRR2926049 2 0.0162 0.8234 0.000 0.996 0.004 0.000 0.000
#> SRR2926047 2 0.1569 0.8173 0.008 0.948 0.012 0.032 0.000
#> SRR2926046 3 0.3008 0.8247 0.004 0.000 0.868 0.092 0.036
#> SRR2926048 2 0.1830 0.8094 0.000 0.932 0.040 0.028 0.000
#> SRR2926044 2 0.5069 0.6144 0.012 0.648 0.304 0.036 0.000
#> SRR2926045 3 0.1041 0.8759 0.000 0.032 0.964 0.004 0.000
#> SRR2926041 2 0.0880 0.8185 0.000 0.968 0.000 0.032 0.000
#> SRR2926042 2 0.2604 0.8169 0.012 0.896 0.072 0.020 0.000
#> SRR2926040 2 0.0579 0.8242 0.000 0.984 0.008 0.008 0.000
#> SRR2926039 2 0.1704 0.8241 0.000 0.928 0.068 0.004 0.000
#> SRR2926043 2 0.4497 0.5996 0.000 0.632 0.352 0.016 0.000
#> SRR2926038 2 0.1168 0.8194 0.000 0.960 0.032 0.008 0.000
#> SRR2926036 2 0.2104 0.8021 0.000 0.916 0.060 0.024 0.000
#> SRR2926037 2 0.0404 0.8263 0.000 0.988 0.012 0.000 0.000
#> SRR2926035 2 0.0162 0.8228 0.000 0.996 0.000 0.004 0.000
#> SRR2926034 2 0.4014 0.6445 0.000 0.728 0.256 0.016 0.000
#> SRR2926032 2 0.0404 0.8233 0.000 0.988 0.012 0.000 0.000
#> SRR2926031 5 0.0000 0.8425 0.000 0.000 0.000 0.000 1.000
#> SRR2926033 3 0.1310 0.8786 0.000 0.020 0.956 0.024 0.000
#> SRR2926030 4 0.3593 0.8038 0.060 0.000 0.000 0.824 0.116
#> SRR2926029 4 0.3218 0.8107 0.016 0.012 0.000 0.848 0.124
#> SRR2926027 5 0.3684 0.8097 0.116 0.000 0.004 0.056 0.824
#> SRR2926028 5 0.0000 0.8425 0.000 0.000 0.000 0.000 1.000
#> SRR2926026 1 0.0510 1.0000 0.984 0.000 0.000 0.000 0.016
#> SRR2926025 5 0.4252 0.5772 0.280 0.000 0.000 0.020 0.700
#> SRR2926023 1 0.0510 1.0000 0.984 0.000 0.000 0.000 0.016
#> SRR2926022 4 0.3477 0.8045 0.056 0.000 0.000 0.832 0.112
#> SRR2926024 5 0.4039 0.7698 0.184 0.000 0.004 0.036 0.776
#> SRR2926021 5 0.0000 0.8425 0.000 0.000 0.000 0.000 1.000
#> SRR2926020 1 0.0510 1.0000 0.984 0.000 0.000 0.000 0.016
#> SRR2926019 1 0.0510 1.0000 0.984 0.000 0.000 0.000 0.016
#> SRR2926018 1 0.0510 1.0000 0.984 0.000 0.000 0.000 0.016
#> SRR2926017 5 0.3455 0.7915 0.004 0.000 0.068 0.084 0.844
#> SRR2926016 4 0.7607 0.3189 0.012 0.108 0.276 0.504 0.100
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> SRR2926066 3 0.2170 0.6529 0.000 0.012 0.888 0.100 0.000 0.000
#> SRR2926067 4 0.4928 0.3175 0.000 0.076 0.352 0.572 0.000 0.000
#> SRR2926063 3 0.0603 0.6684 0.000 0.016 0.980 0.004 0.000 0.000
#> SRR2926064 4 0.5509 0.4877 0.000 0.368 0.136 0.496 0.000 0.000
#> SRR2926062 4 0.5848 0.5443 0.000 0.256 0.256 0.488 0.000 0.000
#> SRR2926061 4 0.5492 0.4854 0.000 0.376 0.132 0.492 0.000 0.000
#> SRR2926065 4 0.4453 0.2839 0.000 0.400 0.032 0.568 0.000 0.000
#> SRR2926060 2 0.3944 0.0346 0.000 0.568 0.004 0.428 0.000 0.000
#> SRR2926059 3 0.5175 0.5417 0.000 0.180 0.636 0.180 0.004 0.000
#> SRR2926058 3 0.5352 0.4191 0.000 0.204 0.592 0.204 0.000 0.000
#> SRR2926056 3 0.6560 0.3958 0.032 0.000 0.564 0.176 0.036 0.192
#> SRR2926057 6 0.1590 0.8988 0.008 0.048 0.000 0.008 0.000 0.936
#> SRR2926055 3 0.4407 -0.0255 0.000 0.024 0.492 0.484 0.000 0.000
#> SRR2926054 3 0.4499 0.5490 0.000 0.060 0.652 0.288 0.000 0.000
#> SRR2926051 3 0.0717 0.6690 0.000 0.016 0.976 0.008 0.000 0.000
#> SRR2926052 3 0.2129 0.6697 0.000 0.040 0.904 0.056 0.000 0.000
#> SRR2926053 3 0.4028 0.4868 0.000 0.024 0.668 0.308 0.000 0.000
#> SRR2926050 3 0.3197 0.6617 0.008 0.068 0.848 0.072 0.004 0.000
#> SRR2926049 2 0.0291 0.5610 0.000 0.992 0.004 0.004 0.000 0.000
#> SRR2926047 2 0.4794 -0.0806 0.000 0.508 0.052 0.440 0.000 0.000
#> SRR2926046 3 0.3436 0.6405 0.000 0.056 0.812 0.128 0.004 0.000
#> SRR2926048 2 0.1926 0.5413 0.000 0.912 0.068 0.020 0.000 0.000
#> SRR2926044 4 0.5893 0.4736 0.000 0.372 0.204 0.424 0.000 0.000
#> SRR2926045 3 0.5067 0.0882 0.000 0.076 0.488 0.436 0.000 0.000
#> SRR2926041 2 0.0935 0.5484 0.000 0.964 0.004 0.032 0.000 0.000
#> SRR2926042 2 0.4463 -0.0863 0.000 0.516 0.028 0.456 0.000 0.000
#> SRR2926040 2 0.1285 0.5600 0.000 0.944 0.052 0.004 0.000 0.000
#> SRR2926039 2 0.3944 0.0390 0.000 0.568 0.004 0.428 0.000 0.000
#> SRR2926043 4 0.6006 0.4894 0.000 0.304 0.264 0.432 0.000 0.000
#> SRR2926038 2 0.1745 0.5474 0.000 0.920 0.068 0.012 0.000 0.000
#> SRR2926036 2 0.2331 0.5316 0.000 0.888 0.080 0.032 0.000 0.000
#> SRR2926037 2 0.4403 0.0598 0.000 0.564 0.028 0.408 0.000 0.000
#> SRR2926035 2 0.0405 0.5607 0.000 0.988 0.008 0.004 0.000 0.000
#> SRR2926034 4 0.4218 0.2427 0.000 0.428 0.016 0.556 0.000 0.000
#> SRR2926032 2 0.4524 0.0582 0.000 0.560 0.036 0.404 0.000 0.000
#> SRR2926031 5 0.0000 0.7758 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR2926033 4 0.4355 0.1961 0.000 0.024 0.420 0.556 0.000 0.000
#> SRR2926030 6 0.1333 0.9389 0.048 0.000 0.000 0.008 0.000 0.944
#> SRR2926029 6 0.0363 0.9327 0.012 0.000 0.000 0.000 0.000 0.988
#> SRR2926027 5 0.6075 0.7073 0.192 0.000 0.000 0.128 0.600 0.080
#> SRR2926028 5 0.0458 0.7747 0.000 0.000 0.000 0.000 0.984 0.016
#> SRR2926026 1 0.0146 0.9962 0.996 0.000 0.000 0.000 0.000 0.004
#> SRR2926025 5 0.5397 0.6969 0.148 0.000 0.008 0.184 0.648 0.012
#> SRR2926023 1 0.0000 0.9975 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2926022 6 0.1701 0.9248 0.072 0.000 0.000 0.008 0.000 0.920
#> SRR2926024 5 0.5972 0.6944 0.212 0.000 0.000 0.124 0.600 0.064
#> SRR2926021 5 0.0000 0.7758 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR2926020 1 0.0000 0.9975 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2926019 1 0.0000 0.9975 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2926018 1 0.0146 0.9962 0.996 0.000 0.000 0.000 0.000 0.004
#> SRR2926017 5 0.5859 0.7108 0.024 0.000 0.044 0.264 0.608 0.060
#> SRR2926016 3 0.6786 0.2951 0.000 0.096 0.452 0.132 0.000 0.320
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 18096 rows and 52 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 2.
#>
#> Following methods can be applied to this 'ConsensusPartition' object:
#> [1] "cola_report" "collect_classes" "collect_plots"
#> [4] "collect_stats" "colnames" "compare_signatures"
#> [7] "consensus_heatmap" "dimension_reduction" "functional_enrichment"
#> [10] "get_anno_col" "get_anno" "get_classes"
#> [13] "get_consensus" "get_matrix" "get_membership"
#> [16] "get_param" "get_signatures" "get_stats"
#> [19] "is_best_k" "is_stable_k" "membership_heatmap"
#> [22] "ncol" "nrow" "plot_ecdf"
#> [25] "rownames" "select_partition_number" "show"
#> [28] "suggest_best_k" "test_to_known_factors"
collect_plots()
function collects all the plots made from res
for all k
(number of partitions)
into one single page to provide an easy and fast comparison between different k
.
collect_plots(res)
The plots are:
k
and the heatmap of
predicted classes for each k
.k
.k
.k
.All the plots in panels can be made by individual functions and they are plotted later in this section.
select_partition_number()
produces several plots showing different
statistics for choosing “optimized” k
. There are following statistics:
k
;k
, the area increased is defined as \(A_k - A_{k-1}\).The detailed explanations of these statistics can be found in the cola vignette.
Generally speaking, lower PAC score, higher mean silhouette score or higher
concordance corresponds to better partition. Rand index and Jaccard index
measure how similar the current partition is compared to partition with k-1
.
If they are too similar, we won't accept k
is better than k-1
.
select_partition_number(res)
The numeric values for all these statistics can be obtained by get_stats()
.
get_stats(res)
#> k 1-PAC mean_silhouette concordance area_increased Rand Jaccard
#> 2 2 0.959 0.945 0.978 0.4754 0.527 0.527
#> 3 3 0.629 0.728 0.871 0.3275 0.813 0.660
#> 4 4 0.741 0.844 0.906 0.1342 0.804 0.545
#> 5 5 0.824 0.830 0.912 0.0543 0.976 0.914
#> 6 6 0.827 0.785 0.889 0.0557 0.911 0.676
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
#> SRR2926066 2 0.9323 0.463 0.348 0.652
#> SRR2926067 2 0.0000 0.976 0.000 1.000
#> SRR2926063 2 0.0376 0.973 0.004 0.996
#> SRR2926064 2 0.0000 0.976 0.000 1.000
#> SRR2926062 2 0.0000 0.976 0.000 1.000
#> SRR2926061 2 0.0000 0.976 0.000 1.000
#> SRR2926065 2 0.0000 0.976 0.000 1.000
#> SRR2926060 2 0.0000 0.976 0.000 1.000
#> SRR2926059 2 0.0000 0.976 0.000 1.000
#> SRR2926058 2 0.0000 0.976 0.000 1.000
#> SRR2926056 1 0.0000 0.975 1.000 0.000
#> SRR2926057 1 0.0000 0.975 1.000 0.000
#> SRR2926055 2 0.0000 0.976 0.000 1.000
#> SRR2926054 2 0.0000 0.976 0.000 1.000
#> SRR2926051 2 0.9580 0.373 0.380 0.620
#> SRR2926052 2 0.0000 0.976 0.000 1.000
#> SRR2926053 2 0.0000 0.976 0.000 1.000
#> SRR2926050 2 0.0672 0.969 0.008 0.992
#> SRR2926049 2 0.0000 0.976 0.000 1.000
#> SRR2926047 2 0.0000 0.976 0.000 1.000
#> SRR2926046 1 0.7139 0.759 0.804 0.196
#> SRR2926048 2 0.0000 0.976 0.000 1.000
#> SRR2926044 2 0.0000 0.976 0.000 1.000
#> SRR2926045 2 0.0000 0.976 0.000 1.000
#> SRR2926041 2 0.0000 0.976 0.000 1.000
#> SRR2926042 2 0.0000 0.976 0.000 1.000
#> SRR2926040 2 0.0000 0.976 0.000 1.000
#> SRR2926039 2 0.0000 0.976 0.000 1.000
#> SRR2926043 2 0.0000 0.976 0.000 1.000
#> SRR2926038 2 0.0000 0.976 0.000 1.000
#> SRR2926036 2 0.0000 0.976 0.000 1.000
#> SRR2926037 2 0.0000 0.976 0.000 1.000
#> SRR2926035 2 0.0000 0.976 0.000 1.000
#> SRR2926034 2 0.0000 0.976 0.000 1.000
#> SRR2926032 2 0.0000 0.976 0.000 1.000
#> SRR2926031 1 0.0000 0.975 1.000 0.000
#> SRR2926033 2 0.0000 0.976 0.000 1.000
#> SRR2926030 1 0.0000 0.975 1.000 0.000
#> SRR2926029 1 0.0000 0.975 1.000 0.000
#> SRR2926027 1 0.0000 0.975 1.000 0.000
#> SRR2926028 1 0.0000 0.975 1.000 0.000
#> SRR2926026 1 0.0000 0.975 1.000 0.000
#> SRR2926025 1 0.0000 0.975 1.000 0.000
#> SRR2926023 1 0.0000 0.975 1.000 0.000
#> SRR2926022 1 0.0000 0.975 1.000 0.000
#> SRR2926024 1 0.0000 0.975 1.000 0.000
#> SRR2926021 1 0.0000 0.975 1.000 0.000
#> SRR2926020 1 0.0000 0.975 1.000 0.000
#> SRR2926019 1 0.0000 0.975 1.000 0.000
#> SRR2926018 1 0.0000 0.975 1.000 0.000
#> SRR2926017 1 0.0000 0.975 1.000 0.000
#> SRR2926016 1 0.7745 0.709 0.772 0.228
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> SRR2926066 3 0.778 0.5905 0.208 0.124 0.668
#> SRR2926067 2 0.280 0.7982 0.000 0.908 0.092
#> SRR2926063 3 0.636 0.4513 0.020 0.296 0.684
#> SRR2926064 2 0.000 0.8657 0.000 1.000 0.000
#> SRR2926062 2 0.000 0.8657 0.000 1.000 0.000
#> SRR2926061 2 0.000 0.8657 0.000 1.000 0.000
#> SRR2926065 2 0.000 0.8657 0.000 1.000 0.000
#> SRR2926060 2 0.000 0.8657 0.000 1.000 0.000
#> SRR2926059 3 0.470 0.6647 0.000 0.212 0.788
#> SRR2926058 2 0.631 -0.0448 0.000 0.504 0.496
#> SRR2926056 3 0.506 0.6897 0.244 0.000 0.756
#> SRR2926057 3 0.445 0.7099 0.192 0.000 0.808
#> SRR2926055 2 0.579 0.5070 0.000 0.668 0.332
#> SRR2926054 2 0.631 -0.0556 0.000 0.504 0.496
#> SRR2926051 3 0.753 0.5706 0.236 0.092 0.672
#> SRR2926052 2 0.708 -0.0940 0.020 0.492 0.488
#> SRR2926053 2 0.613 0.3769 0.000 0.600 0.400
#> SRR2926050 3 0.375 0.7182 0.000 0.144 0.856
#> SRR2926049 2 0.000 0.8657 0.000 1.000 0.000
#> SRR2926047 2 0.000 0.8657 0.000 1.000 0.000
#> SRR2926046 3 0.218 0.7254 0.020 0.032 0.948
#> SRR2926048 2 0.000 0.8657 0.000 1.000 0.000
#> SRR2926044 2 0.630 0.0372 0.000 0.528 0.472
#> SRR2926045 2 0.304 0.7928 0.000 0.896 0.104
#> SRR2926041 2 0.000 0.8657 0.000 1.000 0.000
#> SRR2926042 2 0.000 0.8657 0.000 1.000 0.000
#> SRR2926040 2 0.000 0.8657 0.000 1.000 0.000
#> SRR2926039 2 0.000 0.8657 0.000 1.000 0.000
#> SRR2926043 2 0.000 0.8657 0.000 1.000 0.000
#> SRR2926038 2 0.000 0.8657 0.000 1.000 0.000
#> SRR2926036 2 0.000 0.8657 0.000 1.000 0.000
#> SRR2926037 2 0.000 0.8657 0.000 1.000 0.000
#> SRR2926035 2 0.000 0.8657 0.000 1.000 0.000
#> SRR2926034 2 0.000 0.8657 0.000 1.000 0.000
#> SRR2926032 2 0.000 0.8657 0.000 1.000 0.000
#> SRR2926031 1 0.355 0.8702 0.868 0.000 0.132
#> SRR2926033 2 0.418 0.7197 0.000 0.828 0.172
#> SRR2926030 3 0.573 0.5781 0.324 0.000 0.676
#> SRR2926029 3 0.445 0.7099 0.192 0.000 0.808
#> SRR2926027 1 0.000 0.9072 1.000 0.000 0.000
#> SRR2926028 1 0.375 0.8673 0.856 0.000 0.144
#> SRR2926026 1 0.000 0.9072 1.000 0.000 0.000
#> SRR2926025 1 0.362 0.8701 0.864 0.000 0.136
#> SRR2926023 1 0.000 0.9072 1.000 0.000 0.000
#> SRR2926022 1 0.489 0.6213 0.772 0.000 0.228
#> SRR2926024 1 0.000 0.9072 1.000 0.000 0.000
#> SRR2926021 1 0.362 0.8701 0.864 0.000 0.136
#> SRR2926020 1 0.000 0.9072 1.000 0.000 0.000
#> SRR2926019 1 0.000 0.9072 1.000 0.000 0.000
#> SRR2926018 1 0.000 0.9072 1.000 0.000 0.000
#> SRR2926017 1 0.450 0.7816 0.804 0.000 0.196
#> SRR2926016 3 0.547 0.7303 0.140 0.052 0.808
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> SRR2926066 3 0.0000 0.818 0.000 0.000 1.000 0.000
#> SRR2926067 3 0.2868 0.835 0.000 0.136 0.864 0.000
#> SRR2926063 3 0.0000 0.818 0.000 0.000 1.000 0.000
#> SRR2926064 2 0.0000 0.969 0.000 1.000 0.000 0.000
#> SRR2926062 2 0.0000 0.969 0.000 1.000 0.000 0.000
#> SRR2926061 2 0.0000 0.969 0.000 1.000 0.000 0.000
#> SRR2926065 2 0.0817 0.946 0.000 0.976 0.024 0.000
#> SRR2926060 2 0.0000 0.969 0.000 1.000 0.000 0.000
#> SRR2926059 3 0.6685 0.527 0.000 0.108 0.568 0.324
#> SRR2926058 3 0.5564 0.742 0.000 0.216 0.708 0.076
#> SRR2926056 3 0.3342 0.798 0.032 0.000 0.868 0.100
#> SRR2926057 4 0.2053 0.857 0.072 0.000 0.004 0.924
#> SRR2926055 3 0.2647 0.841 0.000 0.120 0.880 0.000
#> SRR2926054 3 0.5085 0.716 0.000 0.260 0.708 0.032
#> SRR2926051 3 0.0000 0.818 0.000 0.000 1.000 0.000
#> SRR2926052 3 0.5749 0.755 0.040 0.204 0.724 0.032
#> SRR2926053 3 0.2408 0.844 0.000 0.104 0.896 0.000
#> SRR2926050 3 0.3266 0.780 0.000 0.000 0.832 0.168
#> SRR2926049 2 0.0000 0.969 0.000 1.000 0.000 0.000
#> SRR2926047 2 0.0000 0.969 0.000 1.000 0.000 0.000
#> SRR2926046 3 0.0469 0.819 0.000 0.000 0.988 0.012
#> SRR2926048 2 0.0000 0.969 0.000 1.000 0.000 0.000
#> SRR2926044 2 0.4866 0.337 0.000 0.596 0.000 0.404
#> SRR2926045 3 0.2868 0.835 0.000 0.136 0.864 0.000
#> SRR2926041 2 0.0000 0.969 0.000 1.000 0.000 0.000
#> SRR2926042 2 0.0000 0.969 0.000 1.000 0.000 0.000
#> SRR2926040 2 0.0000 0.969 0.000 1.000 0.000 0.000
#> SRR2926039 2 0.0000 0.969 0.000 1.000 0.000 0.000
#> SRR2926043 2 0.0000 0.969 0.000 1.000 0.000 0.000
#> SRR2926038 2 0.0000 0.969 0.000 1.000 0.000 0.000
#> SRR2926036 2 0.0000 0.969 0.000 1.000 0.000 0.000
#> SRR2926037 2 0.0000 0.969 0.000 1.000 0.000 0.000
#> SRR2926035 2 0.0000 0.969 0.000 1.000 0.000 0.000
#> SRR2926034 2 0.2647 0.828 0.000 0.880 0.120 0.000
#> SRR2926032 2 0.0000 0.969 0.000 1.000 0.000 0.000
#> SRR2926031 1 0.5222 0.780 0.756 0.000 0.132 0.112
#> SRR2926033 3 0.1474 0.839 0.000 0.052 0.948 0.000
#> SRR2926030 4 0.3486 0.808 0.188 0.000 0.000 0.812
#> SRR2926029 4 0.2053 0.857 0.072 0.000 0.004 0.924
#> SRR2926027 1 0.0000 0.860 1.000 0.000 0.000 0.000
#> SRR2926028 1 0.5533 0.767 0.732 0.000 0.132 0.136
#> SRR2926026 1 0.0000 0.860 1.000 0.000 0.000 0.000
#> SRR2926025 1 0.4401 0.806 0.812 0.000 0.076 0.112
#> SRR2926023 1 0.0000 0.860 1.000 0.000 0.000 0.000
#> SRR2926022 4 0.4989 0.387 0.472 0.000 0.000 0.528
#> SRR2926024 1 0.0000 0.860 1.000 0.000 0.000 0.000
#> SRR2926021 1 0.5533 0.767 0.732 0.000 0.132 0.136
#> SRR2926020 1 0.0000 0.860 1.000 0.000 0.000 0.000
#> SRR2926019 1 0.0000 0.860 1.000 0.000 0.000 0.000
#> SRR2926018 1 0.0000 0.860 1.000 0.000 0.000 0.000
#> SRR2926017 1 0.4624 0.601 0.660 0.000 0.340 0.000
#> SRR2926016 4 0.2287 0.848 0.060 0.012 0.004 0.924
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> SRR2926066 3 0.0290 0.890 0.000 0.000 0.992 0.000 0.008
#> SRR2926067 3 0.1704 0.868 0.000 0.004 0.928 0.000 0.068
#> SRR2926063 3 0.0000 0.889 0.000 0.000 1.000 0.000 0.000
#> SRR2926064 2 0.0703 0.928 0.000 0.976 0.000 0.000 0.024
#> SRR2926062 2 0.0290 0.934 0.000 0.992 0.000 0.000 0.008
#> SRR2926061 2 0.0324 0.934 0.000 0.992 0.004 0.000 0.004
#> SRR2926065 2 0.4237 0.701 0.000 0.752 0.200 0.000 0.048
#> SRR2926060 2 0.0865 0.926 0.000 0.972 0.004 0.000 0.024
#> SRR2926059 3 0.4668 0.560 0.000 0.000 0.624 0.352 0.024
#> SRR2926058 3 0.3952 0.790 0.000 0.012 0.788 0.176 0.024
#> SRR2926056 3 0.0671 0.888 0.004 0.000 0.980 0.016 0.000
#> SRR2926057 4 0.0000 0.794 0.000 0.000 0.000 1.000 0.000
#> SRR2926055 3 0.1121 0.880 0.000 0.000 0.956 0.000 0.044
#> SRR2926054 3 0.3780 0.779 0.000 0.116 0.812 0.072 0.000
#> SRR2926051 3 0.0290 0.890 0.000 0.000 0.992 0.000 0.008
#> SRR2926052 3 0.4451 0.789 0.108 0.044 0.804 0.032 0.012
#> SRR2926053 3 0.0794 0.886 0.000 0.000 0.972 0.000 0.028
#> SRR2926050 3 0.3048 0.805 0.000 0.000 0.820 0.176 0.004
#> SRR2926049 2 0.0000 0.936 0.000 1.000 0.000 0.000 0.000
#> SRR2926047 2 0.0000 0.936 0.000 1.000 0.000 0.000 0.000
#> SRR2926046 3 0.1671 0.865 0.000 0.000 0.924 0.000 0.076
#> SRR2926048 2 0.0000 0.936 0.000 1.000 0.000 0.000 0.000
#> SRR2926044 2 0.4297 0.142 0.000 0.528 0.000 0.472 0.000
#> SRR2926045 3 0.0000 0.889 0.000 0.000 1.000 0.000 0.000
#> SRR2926041 2 0.0000 0.936 0.000 1.000 0.000 0.000 0.000
#> SRR2926042 2 0.0000 0.936 0.000 1.000 0.000 0.000 0.000
#> SRR2926040 2 0.0000 0.936 0.000 1.000 0.000 0.000 0.000
#> SRR2926039 2 0.1197 0.917 0.000 0.952 0.000 0.000 0.048
#> SRR2926043 2 0.0880 0.925 0.000 0.968 0.000 0.000 0.032
#> SRR2926038 2 0.0703 0.927 0.000 0.976 0.000 0.000 0.024
#> SRR2926036 2 0.0000 0.936 0.000 1.000 0.000 0.000 0.000
#> SRR2926037 2 0.0000 0.936 0.000 1.000 0.000 0.000 0.000
#> SRR2926035 2 0.0000 0.936 0.000 1.000 0.000 0.000 0.000
#> SRR2926034 2 0.4453 0.660 0.000 0.724 0.228 0.000 0.048
#> SRR2926032 2 0.0000 0.936 0.000 1.000 0.000 0.000 0.000
#> SRR2926031 5 0.2127 0.904 0.108 0.000 0.000 0.000 0.892
#> SRR2926033 3 0.2914 0.831 0.000 0.052 0.872 0.000 0.076
#> SRR2926030 4 0.2929 0.712 0.180 0.000 0.000 0.820 0.000
#> SRR2926029 4 0.0000 0.794 0.000 0.000 0.000 1.000 0.000
#> SRR2926027 1 0.0000 0.908 1.000 0.000 0.000 0.000 0.000
#> SRR2926028 5 0.2389 0.905 0.116 0.000 0.000 0.004 0.880
#> SRR2926026 1 0.0000 0.908 1.000 0.000 0.000 0.000 0.000
#> SRR2926025 5 0.4101 0.671 0.332 0.000 0.000 0.004 0.664
#> SRR2926023 1 0.0000 0.908 1.000 0.000 0.000 0.000 0.000
#> SRR2926022 4 0.4273 0.292 0.448 0.000 0.000 0.552 0.000
#> SRR2926024 1 0.0000 0.908 1.000 0.000 0.000 0.000 0.000
#> SRR2926021 5 0.2179 0.906 0.112 0.000 0.000 0.000 0.888
#> SRR2926020 1 0.0000 0.908 1.000 0.000 0.000 0.000 0.000
#> SRR2926019 1 0.0000 0.908 1.000 0.000 0.000 0.000 0.000
#> SRR2926018 1 0.0000 0.908 1.000 0.000 0.000 0.000 0.000
#> SRR2926017 1 0.6380 0.185 0.508 0.000 0.288 0.000 0.204
#> SRR2926016 4 0.0609 0.786 0.000 0.000 0.000 0.980 0.020
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> SRR2926066 3 0.3789 0.456 0.000 0.000 0.584 0.416 0.000 0.000
#> SRR2926067 4 0.2510 0.645 0.000 0.028 0.100 0.872 0.000 0.000
#> SRR2926063 3 0.2854 0.793 0.000 0.000 0.792 0.208 0.000 0.000
#> SRR2926064 2 0.2378 0.866 0.000 0.848 0.152 0.000 0.000 0.000
#> SRR2926062 2 0.1663 0.893 0.000 0.912 0.088 0.000 0.000 0.000
#> SRR2926061 2 0.0790 0.911 0.000 0.968 0.032 0.000 0.000 0.000
#> SRR2926065 3 0.0790 0.614 0.000 0.032 0.968 0.000 0.000 0.000
#> SRR2926060 2 0.2762 0.831 0.000 0.804 0.196 0.000 0.000 0.000
#> SRR2926059 3 0.3551 0.738 0.000 0.000 0.792 0.148 0.000 0.060
#> SRR2926058 3 0.2340 0.774 0.000 0.000 0.852 0.148 0.000 0.000
#> SRR2926056 3 0.2912 0.788 0.000 0.000 0.784 0.216 0.000 0.000
#> SRR2926057 6 0.0000 0.873 0.000 0.000 0.000 0.000 0.000 1.000
#> SRR2926055 3 0.2854 0.507 0.000 0.000 0.792 0.208 0.000 0.000
#> SRR2926054 3 0.2823 0.794 0.000 0.000 0.796 0.204 0.000 0.000
#> SRR2926051 4 0.3862 -0.328 0.000 0.000 0.476 0.524 0.000 0.000
#> SRR2926052 3 0.2793 0.794 0.000 0.000 0.800 0.200 0.000 0.000
#> SRR2926053 4 0.3607 0.274 0.000 0.000 0.348 0.652 0.000 0.000
#> SRR2926050 3 0.2823 0.794 0.000 0.000 0.796 0.204 0.000 0.000
#> SRR2926049 2 0.0000 0.921 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2926047 2 0.0146 0.921 0.000 0.996 0.004 0.000 0.000 0.000
#> SRR2926046 4 0.1610 0.657 0.000 0.000 0.084 0.916 0.000 0.000
#> SRR2926048 2 0.0000 0.921 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2926044 2 0.3927 0.457 0.000 0.644 0.012 0.000 0.000 0.344
#> SRR2926045 3 0.2912 0.788 0.000 0.000 0.784 0.216 0.000 0.000
#> SRR2926041 2 0.0000 0.921 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2926042 2 0.0458 0.919 0.000 0.984 0.016 0.000 0.000 0.000
#> SRR2926040 2 0.0000 0.921 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2926039 2 0.2902 0.832 0.000 0.800 0.196 0.000 0.004 0.000
#> SRR2926043 2 0.2697 0.839 0.000 0.812 0.188 0.000 0.000 0.000
#> SRR2926038 2 0.2340 0.862 0.000 0.852 0.148 0.000 0.000 0.000
#> SRR2926036 2 0.0000 0.921 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2926037 2 0.0000 0.921 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2926035 2 0.0000 0.921 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2926034 3 0.3074 0.377 0.000 0.200 0.792 0.004 0.004 0.000
#> SRR2926032 2 0.0000 0.921 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2926031 5 0.0858 0.926 0.004 0.000 0.000 0.028 0.968 0.000
#> SRR2926033 4 0.0436 0.645 0.000 0.004 0.004 0.988 0.004 0.000
#> SRR2926030 6 0.0458 0.872 0.016 0.000 0.000 0.000 0.000 0.984
#> SRR2926029 6 0.0000 0.873 0.000 0.000 0.000 0.000 0.000 1.000
#> SRR2926027 1 0.0146 0.996 0.996 0.000 0.000 0.004 0.000 0.000
#> SRR2926028 5 0.0146 0.934 0.004 0.000 0.000 0.000 0.996 0.000
#> SRR2926026 1 0.0000 0.999 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2926025 5 0.2340 0.822 0.148 0.000 0.000 0.000 0.852 0.000
#> SRR2926023 1 0.0000 0.999 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2926022 6 0.3351 0.605 0.288 0.000 0.000 0.000 0.000 0.712
#> SRR2926024 1 0.0000 0.999 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2926021 5 0.0146 0.934 0.004 0.000 0.000 0.000 0.996 0.000
#> SRR2926020 1 0.0000 0.999 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2926019 1 0.0000 0.999 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2926018 1 0.0000 0.999 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2926017 4 0.3596 0.380 0.232 0.000 0.004 0.748 0.016 0.000
#> SRR2926016 6 0.2243 0.800 0.000 0.000 0.112 0.004 0.004 0.880
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 18096 rows and 52 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 0.813 0.911 0.956 0.4840 0.517 0.517
#> 3 3 0.850 0.920 0.956 0.3694 0.810 0.633
#> 4 4 0.818 0.886 0.926 0.0491 0.982 0.945
#> 5 5 0.783 0.803 0.843 0.0927 0.925 0.759
#> 6 6 0.741 0.718 0.822 0.0359 0.962 0.841
suggest_best_k()
suggests the best \(k\) based on these statistics. The rules are as follows:
suggest_best_k(res)
#> [1] 3
Following shows the table of the partitions (You need to click the show/hide
code output link to see it). The membership matrix (columns with name p*
)
is inferred by
clue::cl_consensus()
function with the SE
method. Basically the value in the membership matrix
represents the probability to belong to a certain group. The finall class
label for an item is determined with the group with highest probability it
belongs to.
In get_classes()
function, the entropy is calculated from the membership
matrix and the silhouette score is calculated from the consensus matrix.
cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#> class entropy silhouette p1 p2
#> SRR2926066 1 0.0672 0.9371 0.992 0.008
#> SRR2926067 1 0.7528 0.7851 0.784 0.216
#> SRR2926063 1 0.0672 0.9371 0.992 0.008
#> SRR2926064 2 0.0000 0.9746 0.000 1.000
#> SRR2926062 2 0.0000 0.9746 0.000 1.000
#> SRR2926061 1 0.7528 0.7853 0.784 0.216
#> SRR2926065 2 0.0000 0.9746 0.000 1.000
#> SRR2926060 2 0.0000 0.9746 0.000 1.000
#> SRR2926059 1 0.7528 0.7853 0.784 0.216
#> SRR2926058 1 0.4562 0.8888 0.904 0.096
#> SRR2926056 1 0.0000 0.9381 1.000 0.000
#> SRR2926057 1 0.4562 0.8888 0.904 0.096
#> SRR2926055 1 0.7950 0.7541 0.760 0.240
#> SRR2926054 1 0.1843 0.9289 0.972 0.028
#> SRR2926051 1 0.0672 0.9371 0.992 0.008
#> SRR2926052 1 0.0672 0.9371 0.992 0.008
#> SRR2926053 1 0.7219 0.8020 0.800 0.200
#> SRR2926050 1 0.1843 0.9289 0.972 0.028
#> SRR2926049 2 0.0000 0.9746 0.000 1.000
#> SRR2926047 2 0.0000 0.9746 0.000 1.000
#> SRR2926046 1 0.0672 0.9371 0.992 0.008
#> SRR2926048 2 0.0000 0.9746 0.000 1.000
#> SRR2926044 2 0.9866 0.0954 0.432 0.568
#> SRR2926045 1 0.7219 0.8020 0.800 0.200
#> SRR2926041 2 0.0000 0.9746 0.000 1.000
#> SRR2926042 2 0.0000 0.9746 0.000 1.000
#> SRR2926040 2 0.0000 0.9746 0.000 1.000
#> SRR2926039 2 0.0000 0.9746 0.000 1.000
#> SRR2926043 2 0.0000 0.9746 0.000 1.000
#> SRR2926038 2 0.0000 0.9746 0.000 1.000
#> SRR2926036 2 0.0000 0.9746 0.000 1.000
#> SRR2926037 2 0.0000 0.9746 0.000 1.000
#> SRR2926035 2 0.0000 0.9746 0.000 1.000
#> SRR2926034 2 0.0000 0.9746 0.000 1.000
#> SRR2926032 2 0.0000 0.9746 0.000 1.000
#> SRR2926031 1 0.0000 0.9381 1.000 0.000
#> SRR2926033 1 0.8267 0.7247 0.740 0.260
#> SRR2926030 1 0.0000 0.9381 1.000 0.000
#> SRR2926029 1 0.0000 0.9381 1.000 0.000
#> SRR2926027 1 0.0000 0.9381 1.000 0.000
#> SRR2926028 1 0.0000 0.9381 1.000 0.000
#> SRR2926026 1 0.0000 0.9381 1.000 0.000
#> SRR2926025 1 0.0000 0.9381 1.000 0.000
#> SRR2926023 1 0.0000 0.9381 1.000 0.000
#> SRR2926022 1 0.0000 0.9381 1.000 0.000
#> SRR2926024 1 0.0000 0.9381 1.000 0.000
#> SRR2926021 1 0.0000 0.9381 1.000 0.000
#> SRR2926020 1 0.0000 0.9381 1.000 0.000
#> SRR2926019 1 0.0000 0.9381 1.000 0.000
#> SRR2926018 1 0.0000 0.9381 1.000 0.000
#> SRR2926017 1 0.0000 0.9381 1.000 0.000
#> SRR2926016 2 0.0000 0.9746 0.000 1.000
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> SRR2926066 3 0.0892 0.8861 0.020 0.000 0.980
#> SRR2926067 3 0.4452 0.8399 0.000 0.192 0.808
#> SRR2926063 3 0.0892 0.8861 0.020 0.000 0.980
#> SRR2926064 2 0.0000 0.9716 0.000 1.000 0.000
#> SRR2926062 2 0.0000 0.9716 0.000 1.000 0.000
#> SRR2926061 3 0.4399 0.8432 0.000 0.188 0.812
#> SRR2926065 2 0.0237 0.9688 0.000 0.996 0.004
#> SRR2926060 2 0.0000 0.9716 0.000 1.000 0.000
#> SRR2926059 3 0.4399 0.8432 0.000 0.188 0.812
#> SRR2926058 3 0.2261 0.8893 0.000 0.068 0.932
#> SRR2926056 3 0.1411 0.8783 0.036 0.000 0.964
#> SRR2926057 3 0.2261 0.8893 0.000 0.068 0.932
#> SRR2926055 3 0.4750 0.8151 0.000 0.216 0.784
#> SRR2926054 3 0.0000 0.8864 0.000 0.000 1.000
#> SRR2926051 3 0.0892 0.8861 0.020 0.000 0.980
#> SRR2926052 3 0.0892 0.8861 0.020 0.000 0.980
#> SRR2926053 3 0.4178 0.8532 0.000 0.172 0.828
#> SRR2926050 3 0.0000 0.8864 0.000 0.000 1.000
#> SRR2926049 2 0.0000 0.9716 0.000 1.000 0.000
#> SRR2926047 2 0.0000 0.9716 0.000 1.000 0.000
#> SRR2926046 3 0.0892 0.8861 0.020 0.000 0.980
#> SRR2926048 2 0.0000 0.9716 0.000 1.000 0.000
#> SRR2926044 2 0.6280 -0.0578 0.000 0.540 0.460
#> SRR2926045 3 0.4178 0.8532 0.000 0.172 0.828
#> SRR2926041 2 0.0000 0.9716 0.000 1.000 0.000
#> SRR2926042 2 0.0000 0.9716 0.000 1.000 0.000
#> SRR2926040 2 0.0000 0.9716 0.000 1.000 0.000
#> SRR2926039 2 0.0000 0.9716 0.000 1.000 0.000
#> SRR2926043 2 0.0237 0.9688 0.000 0.996 0.004
#> SRR2926038 2 0.0000 0.9716 0.000 1.000 0.000
#> SRR2926036 2 0.0000 0.9716 0.000 1.000 0.000
#> SRR2926037 2 0.0000 0.9716 0.000 1.000 0.000
#> SRR2926035 2 0.0000 0.9716 0.000 1.000 0.000
#> SRR2926034 2 0.0237 0.9688 0.000 0.996 0.004
#> SRR2926032 2 0.0000 0.9716 0.000 1.000 0.000
#> SRR2926031 1 0.0000 0.9977 1.000 0.000 0.000
#> SRR2926033 3 0.4974 0.7896 0.000 0.236 0.764
#> SRR2926030 1 0.0000 0.9977 1.000 0.000 0.000
#> SRR2926029 3 0.3816 0.7873 0.148 0.000 0.852
#> SRR2926027 1 0.0237 0.9949 0.996 0.000 0.004
#> SRR2926028 1 0.0000 0.9977 1.000 0.000 0.000
#> SRR2926026 1 0.0000 0.9977 1.000 0.000 0.000
#> SRR2926025 1 0.0000 0.9977 1.000 0.000 0.000
#> SRR2926023 1 0.0000 0.9977 1.000 0.000 0.000
#> SRR2926022 1 0.0000 0.9977 1.000 0.000 0.000
#> SRR2926024 1 0.0000 0.9977 1.000 0.000 0.000
#> SRR2926021 1 0.0592 0.9883 0.988 0.000 0.012
#> SRR2926020 1 0.0000 0.9977 1.000 0.000 0.000
#> SRR2926019 1 0.0000 0.9977 1.000 0.000 0.000
#> SRR2926018 1 0.0000 0.9977 1.000 0.000 0.000
#> SRR2926017 1 0.0592 0.9883 0.988 0.000 0.012
#> SRR2926016 2 0.0000 0.9716 0.000 1.000 0.000
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> SRR2926066 3 0.2281 0.835 0.000 0.000 0.904 0.096
#> SRR2926067 3 0.4428 0.801 0.000 0.124 0.808 0.068
#> SRR2926063 3 0.2281 0.835 0.000 0.000 0.904 0.096
#> SRR2926064 2 0.1520 0.929 0.000 0.956 0.020 0.024
#> SRR2926062 2 0.0000 0.948 0.000 1.000 0.000 0.000
#> SRR2926061 3 0.4374 0.804 0.000 0.120 0.812 0.068
#> SRR2926065 2 0.2224 0.906 0.000 0.928 0.032 0.040
#> SRR2926060 2 0.1520 0.929 0.000 0.956 0.020 0.024
#> SRR2926059 3 0.4374 0.804 0.000 0.120 0.812 0.068
#> SRR2926058 3 0.1792 0.833 0.000 0.000 0.932 0.068
#> SRR2926056 3 0.2737 0.827 0.008 0.000 0.888 0.104
#> SRR2926057 3 0.1792 0.833 0.000 0.000 0.932 0.068
#> SRR2926055 3 0.4735 0.777 0.000 0.148 0.784 0.068
#> SRR2926054 3 0.1716 0.840 0.000 0.000 0.936 0.064
#> SRR2926051 3 0.2281 0.835 0.000 0.000 0.904 0.096
#> SRR2926052 3 0.2281 0.835 0.000 0.000 0.904 0.096
#> SRR2926053 3 0.4144 0.812 0.000 0.104 0.828 0.068
#> SRR2926050 3 0.1716 0.840 0.000 0.000 0.936 0.064
#> SRR2926049 2 0.0000 0.948 0.000 1.000 0.000 0.000
#> SRR2926047 2 0.0000 0.948 0.000 1.000 0.000 0.000
#> SRR2926046 3 0.2281 0.835 0.000 0.000 0.904 0.096
#> SRR2926048 2 0.0000 0.948 0.000 1.000 0.000 0.000
#> SRR2926044 2 0.6452 -0.105 0.000 0.472 0.460 0.068
#> SRR2926045 3 0.4144 0.812 0.000 0.104 0.828 0.068
#> SRR2926041 2 0.0000 0.948 0.000 1.000 0.000 0.000
#> SRR2926042 2 0.0000 0.948 0.000 1.000 0.000 0.000
#> SRR2926040 2 0.0000 0.948 0.000 1.000 0.000 0.000
#> SRR2926039 2 0.1520 0.929 0.000 0.956 0.020 0.024
#> SRR2926043 2 0.1411 0.931 0.000 0.960 0.020 0.020
#> SRR2926038 2 0.0000 0.948 0.000 1.000 0.000 0.000
#> SRR2926036 2 0.0000 0.948 0.000 1.000 0.000 0.000
#> SRR2926037 2 0.0000 0.948 0.000 1.000 0.000 0.000
#> SRR2926035 2 0.0000 0.948 0.000 1.000 0.000 0.000
#> SRR2926034 2 0.2036 0.913 0.000 0.936 0.032 0.032
#> SRR2926032 2 0.0000 0.948 0.000 1.000 0.000 0.000
#> SRR2926031 4 0.3801 0.926 0.220 0.000 0.000 0.780
#> SRR2926033 3 0.4937 0.751 0.000 0.172 0.764 0.064
#> SRR2926030 1 0.0188 0.986 0.996 0.000 0.000 0.004
#> SRR2926029 3 0.3966 0.758 0.072 0.000 0.840 0.088
#> SRR2926027 1 0.0336 0.983 0.992 0.000 0.000 0.008
#> SRR2926028 4 0.3219 0.930 0.164 0.000 0.000 0.836
#> SRR2926026 1 0.0000 0.989 1.000 0.000 0.000 0.000
#> SRR2926025 1 0.0000 0.989 1.000 0.000 0.000 0.000
#> SRR2926023 1 0.0000 0.989 1.000 0.000 0.000 0.000
#> SRR2926022 1 0.0000 0.989 1.000 0.000 0.000 0.000
#> SRR2926024 1 0.0000 0.989 1.000 0.000 0.000 0.000
#> SRR2926021 1 0.1118 0.953 0.964 0.000 0.000 0.036
#> SRR2926020 1 0.0000 0.989 1.000 0.000 0.000 0.000
#> SRR2926019 1 0.0000 0.989 1.000 0.000 0.000 0.000
#> SRR2926018 1 0.0000 0.989 1.000 0.000 0.000 0.000
#> SRR2926017 1 0.1118 0.953 0.964 0.000 0.000 0.036
#> SRR2926016 2 0.0000 0.948 0.000 1.000 0.000 0.000
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> SRR2926066 3 0.0703 0.802 0.000 0.024 0.976 0.000 0.000
#> SRR2926067 3 0.5305 0.774 0.000 0.132 0.672 0.196 0.000
#> SRR2926063 3 0.0703 0.802 0.000 0.024 0.976 0.000 0.000
#> SRR2926064 4 0.1478 0.717 0.000 0.064 0.000 0.936 0.000
#> SRR2926062 4 0.3895 0.401 0.000 0.320 0.000 0.680 0.000
#> SRR2926061 3 0.5329 0.776 0.000 0.144 0.672 0.184 0.000
#> SRR2926065 4 0.0000 0.711 0.000 0.000 0.000 1.000 0.000
#> SRR2926060 4 0.3274 0.570 0.000 0.220 0.000 0.780 0.000
#> SRR2926059 3 0.5329 0.776 0.000 0.144 0.672 0.184 0.000
#> SRR2926058 3 0.4010 0.805 0.000 0.136 0.792 0.072 0.000
#> SRR2926056 3 0.1202 0.793 0.004 0.032 0.960 0.000 0.004
#> SRR2926057 3 0.4010 0.805 0.000 0.136 0.792 0.072 0.000
#> SRR2926055 3 0.5477 0.755 0.000 0.132 0.648 0.220 0.000
#> SRR2926054 3 0.0324 0.808 0.000 0.004 0.992 0.004 0.000
#> SRR2926051 3 0.0703 0.802 0.000 0.024 0.976 0.000 0.000
#> SRR2926052 3 0.0703 0.802 0.000 0.024 0.976 0.000 0.000
#> SRR2926053 3 0.5184 0.783 0.000 0.136 0.688 0.176 0.000
#> SRR2926050 3 0.0324 0.808 0.000 0.004 0.992 0.004 0.000
#> SRR2926049 2 0.3242 0.993 0.000 0.784 0.000 0.216 0.000
#> SRR2926047 2 0.3242 0.993 0.000 0.784 0.000 0.216 0.000
#> SRR2926046 3 0.0703 0.802 0.000 0.024 0.976 0.000 0.000
#> SRR2926048 2 0.3366 0.976 0.000 0.768 0.000 0.232 0.000
#> SRR2926044 4 0.6816 -0.151 0.000 0.320 0.320 0.360 0.000
#> SRR2926045 3 0.5184 0.783 0.000 0.136 0.688 0.176 0.000
#> SRR2926041 2 0.3242 0.993 0.000 0.784 0.000 0.216 0.000
#> SRR2926042 4 0.4307 -0.293 0.000 0.496 0.000 0.504 0.000
#> SRR2926040 2 0.3242 0.993 0.000 0.784 0.000 0.216 0.000
#> SRR2926039 4 0.0963 0.722 0.000 0.036 0.000 0.964 0.000
#> SRR2926043 4 0.1121 0.722 0.000 0.044 0.000 0.956 0.000
#> SRR2926038 4 0.3561 0.480 0.000 0.260 0.000 0.740 0.000
#> SRR2926036 2 0.3242 0.993 0.000 0.784 0.000 0.216 0.000
#> SRR2926037 2 0.3242 0.993 0.000 0.784 0.000 0.216 0.000
#> SRR2926035 2 0.3242 0.993 0.000 0.784 0.000 0.216 0.000
#> SRR2926034 4 0.0290 0.716 0.000 0.008 0.000 0.992 0.000
#> SRR2926032 2 0.3366 0.976 0.000 0.768 0.000 0.232 0.000
#> SRR2926031 5 0.2605 0.820 0.148 0.000 0.000 0.000 0.852
#> SRR2926033 3 0.5618 0.731 0.000 0.136 0.628 0.236 0.000
#> SRR2926030 1 0.0162 0.986 0.996 0.000 0.000 0.000 0.004
#> SRR2926029 3 0.3243 0.761 0.004 0.032 0.848 0.000 0.116
#> SRR2926027 1 0.0324 0.983 0.992 0.004 0.004 0.000 0.000
#> SRR2926028 5 0.0000 0.821 0.000 0.000 0.000 0.000 1.000
#> SRR2926026 1 0.0000 0.989 1.000 0.000 0.000 0.000 0.000
#> SRR2926025 1 0.0000 0.989 1.000 0.000 0.000 0.000 0.000
#> SRR2926023 1 0.0000 0.989 1.000 0.000 0.000 0.000 0.000
#> SRR2926022 1 0.0000 0.989 1.000 0.000 0.000 0.000 0.000
#> SRR2926024 1 0.0000 0.989 1.000 0.000 0.000 0.000 0.000
#> SRR2926021 1 0.1331 0.950 0.952 0.040 0.008 0.000 0.000
#> SRR2926020 1 0.0000 0.989 1.000 0.000 0.000 0.000 0.000
#> SRR2926019 1 0.0000 0.989 1.000 0.000 0.000 0.000 0.000
#> SRR2926018 1 0.0000 0.989 1.000 0.000 0.000 0.000 0.000
#> SRR2926017 1 0.1331 0.950 0.952 0.040 0.008 0.000 0.000
#> SRR2926016 4 0.2179 0.699 0.000 0.112 0.000 0.888 0.000
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> SRR2926066 3 0.0713 0.8005 0.000 0.000 0.972 0.000 0.000 0.028
#> SRR2926067 3 0.3952 0.7709 0.000 0.000 0.672 0.308 0.000 0.020
#> SRR2926063 3 0.0713 0.8005 0.000 0.000 0.972 0.000 0.000 0.028
#> SRR2926064 4 0.2969 0.7606 0.000 0.224 0.000 0.776 0.000 0.000
#> SRR2926062 4 0.3991 0.4225 0.000 0.472 0.000 0.524 0.000 0.004
#> SRR2926061 3 0.4216 0.7740 0.000 0.012 0.676 0.292 0.000 0.020
#> SRR2926065 4 0.2378 0.7591 0.000 0.152 0.000 0.848 0.000 0.000
#> SRR2926060 4 0.3684 0.6038 0.000 0.372 0.000 0.628 0.000 0.000
#> SRR2926059 3 0.4216 0.7740 0.000 0.012 0.676 0.292 0.000 0.020
#> SRR2926058 3 0.3189 0.8039 0.000 0.000 0.796 0.184 0.000 0.020
#> SRR2926056 3 0.1152 0.7892 0.000 0.000 0.952 0.000 0.004 0.044
#> SRR2926057 3 0.3189 0.8039 0.000 0.000 0.796 0.184 0.000 0.020
#> SRR2926055 3 0.4049 0.7490 0.000 0.000 0.648 0.332 0.000 0.020
#> SRR2926054 3 0.0146 0.8066 0.000 0.000 0.996 0.004 0.000 0.000
#> SRR2926051 3 0.0713 0.8005 0.000 0.000 0.972 0.000 0.000 0.028
#> SRR2926052 3 0.0713 0.8005 0.000 0.000 0.972 0.000 0.000 0.028
#> SRR2926053 3 0.3859 0.7817 0.000 0.000 0.692 0.288 0.000 0.020
#> SRR2926050 3 0.0146 0.8066 0.000 0.000 0.996 0.004 0.000 0.000
#> SRR2926049 2 0.0146 0.9447 0.000 0.996 0.000 0.000 0.000 0.004
#> SRR2926047 2 0.0000 0.9452 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2926046 3 0.0713 0.8005 0.000 0.000 0.972 0.000 0.000 0.028
#> SRR2926048 2 0.0458 0.9345 0.000 0.984 0.000 0.016 0.000 0.000
#> SRR2926044 4 0.6305 -0.1402 0.000 0.208 0.324 0.448 0.000 0.020
#> SRR2926045 3 0.3859 0.7817 0.000 0.000 0.692 0.288 0.000 0.020
#> SRR2926041 2 0.0000 0.9452 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2926042 2 0.3547 0.3326 0.000 0.696 0.000 0.300 0.000 0.004
#> SRR2926040 2 0.0146 0.9447 0.000 0.996 0.000 0.000 0.000 0.004
#> SRR2926039 4 0.2697 0.7705 0.000 0.188 0.000 0.812 0.000 0.000
#> SRR2926043 4 0.2762 0.7703 0.000 0.196 0.000 0.804 0.000 0.000
#> SRR2926038 4 0.3915 0.5198 0.000 0.412 0.000 0.584 0.000 0.004
#> SRR2926036 2 0.0000 0.9452 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2926037 2 0.0146 0.9447 0.000 0.996 0.000 0.000 0.000 0.004
#> SRR2926035 2 0.0000 0.9452 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2926034 4 0.2454 0.7657 0.000 0.160 0.000 0.840 0.000 0.000
#> SRR2926032 2 0.0458 0.9345 0.000 0.984 0.000 0.016 0.000 0.000
#> SRR2926031 5 0.2748 0.8447 0.024 0.000 0.000 0.000 0.848 0.128
#> SRR2926033 3 0.4332 0.7241 0.000 0.008 0.628 0.344 0.000 0.020
#> SRR2926030 1 0.0260 0.7678 0.992 0.000 0.000 0.000 0.000 0.008
#> SRR2926029 3 0.2979 0.7567 0.000 0.000 0.840 0.000 0.116 0.044
#> SRR2926027 6 0.2793 0.6516 0.200 0.000 0.000 0.000 0.000 0.800
#> SRR2926028 5 0.0000 0.8568 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR2926026 1 0.0000 0.7746 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2926025 1 0.0000 0.7746 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2926023 1 0.3563 0.4055 0.664 0.000 0.000 0.000 0.000 0.336
#> SRR2926022 6 0.3862 -0.0441 0.476 0.000 0.000 0.000 0.000 0.524
#> SRR2926024 1 0.3817 0.0342 0.568 0.000 0.000 0.000 0.000 0.432
#> SRR2926021 6 0.1219 0.6957 0.048 0.000 0.004 0.000 0.000 0.948
#> SRR2926020 1 0.0000 0.7746 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2926019 1 0.0000 0.7746 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2926018 1 0.3531 0.4220 0.672 0.000 0.000 0.000 0.000 0.328
#> SRR2926017 6 0.1219 0.6957 0.048 0.000 0.004 0.000 0.000 0.948
#> SRR2926016 4 0.3017 0.7401 0.000 0.164 0.000 0.816 0.000 0.020
Heatmaps for the consensus matrix. It visualizes the probability of two samples to be in a same group.
consensus_heatmap(res, k = 2)
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 18096 rows and 52 columns.
#> Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'MAD' method.
#> Subgroups are detected by 'kmeans' method.
#> Performed in total 1250 partitions by row resampling.
#> Best k for subgroups seems to be 3.
#>
#> Following methods can be applied to this 'ConsensusPartition' object:
#> [1] "cola_report" "collect_classes" "collect_plots"
#> [4] "collect_stats" "colnames" "compare_signatures"
#> [7] "consensus_heatmap" "dimension_reduction" "functional_enrichment"
#> [10] "get_anno_col" "get_anno" "get_classes"
#> [13] "get_consensus" "get_matrix" "get_membership"
#> [16] "get_param" "get_signatures" "get_stats"
#> [19] "is_best_k" "is_stable_k" "membership_heatmap"
#> [22] "ncol" "nrow" "plot_ecdf"
#> [25] "rownames" "select_partition_number" "show"
#> [28] "suggest_best_k" "test_to_known_factors"
collect_plots()
function collects all the plots made from res
for all k
(number of partitions)
into one single page to provide an easy and fast comparison between different k
.
collect_plots(res)
The plots are:
k
and the heatmap of
predicted classes for each k
.k
.k
.k
.All the plots in panels can be made by individual functions and they are plotted later in this section.
select_partition_number()
produces several plots showing different
statistics for choosing “optimized” k
. There are following statistics:
k
;k
, the area increased is defined as \(A_k - A_{k-1}\).The detailed explanations of these statistics can be found in the cola vignette.
Generally speaking, lower PAC score, higher mean silhouette score or higher
concordance corresponds to better partition. Rand index and Jaccard index
measure how similar the current partition is compared to partition with k-1
.
If they are too similar, we won't accept k
is better than k-1
.
select_partition_number(res)
The numeric values for all these statistics can be obtained by get_stats()
.
get_stats(res)
#> k 1-PAC mean_silhouette concordance area_increased Rand Jaccard
#> 2 2 0.682 0.834 0.931 0.4859 0.497 0.497
#> 3 3 1.000 0.995 0.996 0.3705 0.741 0.525
#> 4 4 0.774 0.739 0.780 0.1014 0.916 0.747
#> 5 5 0.736 0.678 0.799 0.0647 0.901 0.648
#> 6 6 0.707 0.611 0.750 0.0431 0.934 0.712
suggest_best_k()
suggests the best \(k\) based on these statistics. The rules are as follows:
suggest_best_k(res)
#> [1] 3
Following shows the table of the partitions (You need to click the show/hide
code output link to see it). The membership matrix (columns with name p*
)
is inferred by
clue::cl_consensus()
function with the SE
method. Basically the value in the membership matrix
represents the probability to belong to a certain group. The finall class
label for an item is determined with the group with highest probability it
belongs to.
In get_classes()
function, the entropy is calculated from the membership
matrix and the silhouette score is calculated from the consensus matrix.
cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#> class entropy silhouette p1 p2
#> SRR2926066 1 0.850 0.683 0.724 0.276
#> SRR2926067 2 0.000 0.935 0.000 1.000
#> SRR2926063 1 0.850 0.683 0.724 0.276
#> SRR2926064 2 0.000 0.935 0.000 1.000
#> SRR2926062 2 0.000 0.935 0.000 1.000
#> SRR2926061 2 0.000 0.935 0.000 1.000
#> SRR2926065 2 0.000 0.935 0.000 1.000
#> SRR2926060 2 0.000 0.935 0.000 1.000
#> SRR2926059 2 0.936 0.389 0.352 0.648
#> SRR2926058 2 0.973 0.238 0.404 0.596
#> SRR2926056 1 0.000 0.891 1.000 0.000
#> SRR2926057 2 0.980 0.198 0.416 0.584
#> SRR2926055 2 0.000 0.935 0.000 1.000
#> SRR2926054 1 0.966 0.440 0.608 0.392
#> SRR2926051 1 0.850 0.683 0.724 0.276
#> SRR2926052 1 0.855 0.677 0.720 0.280
#> SRR2926053 2 0.936 0.389 0.352 0.648
#> SRR2926050 1 0.850 0.683 0.724 0.276
#> SRR2926049 2 0.000 0.935 0.000 1.000
#> SRR2926047 2 0.000 0.935 0.000 1.000
#> SRR2926046 1 0.850 0.683 0.724 0.276
#> SRR2926048 2 0.000 0.935 0.000 1.000
#> SRR2926044 2 0.000 0.935 0.000 1.000
#> SRR2926045 2 0.000 0.935 0.000 1.000
#> SRR2926041 2 0.000 0.935 0.000 1.000
#> SRR2926042 2 0.000 0.935 0.000 1.000
#> SRR2926040 2 0.000 0.935 0.000 1.000
#> SRR2926039 2 0.000 0.935 0.000 1.000
#> SRR2926043 2 0.000 0.935 0.000 1.000
#> SRR2926038 2 0.000 0.935 0.000 1.000
#> SRR2926036 2 0.000 0.935 0.000 1.000
#> SRR2926037 2 0.000 0.935 0.000 1.000
#> SRR2926035 2 0.000 0.935 0.000 1.000
#> SRR2926034 2 0.000 0.935 0.000 1.000
#> SRR2926032 2 0.000 0.935 0.000 1.000
#> SRR2926031 1 0.000 0.891 1.000 0.000
#> SRR2926033 2 0.000 0.935 0.000 1.000
#> SRR2926030 1 0.000 0.891 1.000 0.000
#> SRR2926029 1 0.224 0.873 0.964 0.036
#> SRR2926027 1 0.000 0.891 1.000 0.000
#> SRR2926028 1 0.000 0.891 1.000 0.000
#> SRR2926026 1 0.000 0.891 1.000 0.000
#> SRR2926025 1 0.000 0.891 1.000 0.000
#> SRR2926023 1 0.000 0.891 1.000 0.000
#> SRR2926022 1 0.000 0.891 1.000 0.000
#> SRR2926024 1 0.000 0.891 1.000 0.000
#> SRR2926021 1 0.000 0.891 1.000 0.000
#> SRR2926020 1 0.000 0.891 1.000 0.000
#> SRR2926019 1 0.000 0.891 1.000 0.000
#> SRR2926018 1 0.000 0.891 1.000 0.000
#> SRR2926017 1 0.000 0.891 1.000 0.000
#> SRR2926016 2 0.000 0.935 0.000 1.000
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> SRR2926066 3 0.0000 0.992 0.000 0.000 1.000
#> SRR2926067 3 0.1753 0.949 0.000 0.048 0.952
#> SRR2926063 3 0.0000 0.992 0.000 0.000 1.000
#> SRR2926064 2 0.0000 1.000 0.000 1.000 0.000
#> SRR2926062 2 0.0000 1.000 0.000 1.000 0.000
#> SRR2926061 2 0.0000 1.000 0.000 1.000 0.000
#> SRR2926065 2 0.0000 1.000 0.000 1.000 0.000
#> SRR2926060 2 0.0000 1.000 0.000 1.000 0.000
#> SRR2926059 3 0.0000 0.992 0.000 0.000 1.000
#> SRR2926058 3 0.0000 0.992 0.000 0.000 1.000
#> SRR2926056 3 0.0000 0.992 0.000 0.000 1.000
#> SRR2926057 3 0.0000 0.992 0.000 0.000 1.000
#> SRR2926055 3 0.1753 0.949 0.000 0.048 0.952
#> SRR2926054 3 0.0000 0.992 0.000 0.000 1.000
#> SRR2926051 3 0.0000 0.992 0.000 0.000 1.000
#> SRR2926052 3 0.0000 0.992 0.000 0.000 1.000
#> SRR2926053 3 0.0000 0.992 0.000 0.000 1.000
#> SRR2926050 3 0.0000 0.992 0.000 0.000 1.000
#> SRR2926049 2 0.0000 1.000 0.000 1.000 0.000
#> SRR2926047 2 0.0000 1.000 0.000 1.000 0.000
#> SRR2926046 3 0.0000 0.992 0.000 0.000 1.000
#> SRR2926048 2 0.0000 1.000 0.000 1.000 0.000
#> SRR2926044 2 0.0000 1.000 0.000 1.000 0.000
#> SRR2926045 3 0.0424 0.985 0.000 0.008 0.992
#> SRR2926041 2 0.0000 1.000 0.000 1.000 0.000
#> SRR2926042 2 0.0000 1.000 0.000 1.000 0.000
#> SRR2926040 2 0.0000 1.000 0.000 1.000 0.000
#> SRR2926039 2 0.0000 1.000 0.000 1.000 0.000
#> SRR2926043 2 0.0000 1.000 0.000 1.000 0.000
#> SRR2926038 2 0.0000 1.000 0.000 1.000 0.000
#> SRR2926036 2 0.0000 1.000 0.000 1.000 0.000
#> SRR2926037 2 0.0000 1.000 0.000 1.000 0.000
#> SRR2926035 2 0.0000 1.000 0.000 1.000 0.000
#> SRR2926034 2 0.0000 1.000 0.000 1.000 0.000
#> SRR2926032 2 0.0000 1.000 0.000 1.000 0.000
#> SRR2926031 1 0.0000 0.994 1.000 0.000 0.000
#> SRR2926033 2 0.0000 1.000 0.000 1.000 0.000
#> SRR2926030 1 0.0000 0.994 1.000 0.000 0.000
#> SRR2926029 3 0.0424 0.986 0.008 0.000 0.992
#> SRR2926027 1 0.0424 0.998 0.992 0.000 0.008
#> SRR2926028 1 0.0000 0.994 1.000 0.000 0.000
#> SRR2926026 1 0.0424 0.998 0.992 0.000 0.008
#> SRR2926025 1 0.0424 0.998 0.992 0.000 0.008
#> SRR2926023 1 0.0424 0.998 0.992 0.000 0.008
#> SRR2926022 1 0.0424 0.998 0.992 0.000 0.008
#> SRR2926024 1 0.0424 0.998 0.992 0.000 0.008
#> SRR2926021 1 0.0424 0.998 0.992 0.000 0.008
#> SRR2926020 1 0.0424 0.998 0.992 0.000 0.008
#> SRR2926019 1 0.0424 0.998 0.992 0.000 0.008
#> SRR2926018 1 0.0424 0.998 0.992 0.000 0.008
#> SRR2926017 1 0.0424 0.998 0.992 0.000 0.008
#> SRR2926016 2 0.0000 1.000 0.000 1.000 0.000
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> SRR2926066 3 0.0336 0.881 0.000 0.000 0.992 0.008
#> SRR2926067 3 0.5339 0.498 0.000 0.384 0.600 0.016
#> SRR2926063 3 0.0469 0.880 0.000 0.000 0.988 0.012
#> SRR2926064 2 0.0817 0.704 0.000 0.976 0.000 0.024
#> SRR2926062 2 0.1637 0.670 0.000 0.940 0.000 0.060
#> SRR2926061 2 0.3528 0.511 0.000 0.808 0.000 0.192
#> SRR2926065 2 0.1510 0.661 0.000 0.956 0.028 0.016
#> SRR2926060 2 0.0469 0.694 0.000 0.988 0.000 0.012
#> SRR2926059 3 0.1706 0.871 0.000 0.036 0.948 0.016
#> SRR2926058 3 0.2021 0.878 0.000 0.012 0.932 0.056
#> SRR2926056 3 0.3266 0.811 0.000 0.000 0.832 0.168
#> SRR2926057 3 0.1938 0.878 0.000 0.012 0.936 0.052
#> SRR2926055 3 0.5859 0.319 0.000 0.472 0.496 0.032
#> SRR2926054 3 0.0000 0.881 0.000 0.000 1.000 0.000
#> SRR2926051 3 0.0469 0.880 0.000 0.000 0.988 0.012
#> SRR2926052 3 0.0188 0.881 0.000 0.000 0.996 0.004
#> SRR2926053 3 0.1406 0.875 0.000 0.024 0.960 0.016
#> SRR2926050 3 0.1302 0.875 0.000 0.000 0.956 0.044
#> SRR2926049 4 0.4981 0.968 0.000 0.464 0.000 0.536
#> SRR2926047 4 0.4994 0.981 0.000 0.480 0.000 0.520
#> SRR2926046 3 0.1474 0.873 0.000 0.000 0.948 0.052
#> SRR2926048 4 0.4994 0.981 0.000 0.480 0.000 0.520
#> SRR2926044 2 0.3528 0.511 0.000 0.808 0.000 0.192
#> SRR2926045 3 0.4468 0.710 0.000 0.232 0.752 0.016
#> SRR2926041 4 0.4994 0.981 0.000 0.480 0.000 0.520
#> SRR2926042 2 0.4888 -0.673 0.000 0.588 0.000 0.412
#> SRR2926040 4 0.4981 0.968 0.000 0.464 0.000 0.536
#> SRR2926039 2 0.0469 0.705 0.000 0.988 0.000 0.012
#> SRR2926043 2 0.0817 0.704 0.000 0.976 0.000 0.024
#> SRR2926038 2 0.4477 -0.279 0.000 0.688 0.000 0.312
#> SRR2926036 4 0.4994 0.981 0.000 0.480 0.000 0.520
#> SRR2926037 4 0.4981 0.968 0.000 0.464 0.000 0.536
#> SRR2926035 4 0.4994 0.981 0.000 0.480 0.000 0.520
#> SRR2926034 2 0.0000 0.702 0.000 1.000 0.000 0.000
#> SRR2926032 2 0.4916 -0.712 0.000 0.576 0.000 0.424
#> SRR2926031 1 0.4679 0.769 0.648 0.000 0.000 0.352
#> SRR2926033 2 0.3123 0.553 0.000 0.844 0.000 0.156
#> SRR2926030 1 0.0469 0.926 0.988 0.000 0.000 0.012
#> SRR2926029 3 0.4661 0.660 0.000 0.000 0.652 0.348
#> SRR2926027 1 0.3024 0.888 0.852 0.000 0.000 0.148
#> SRR2926028 1 0.4843 0.733 0.604 0.000 0.000 0.396
#> SRR2926026 1 0.0000 0.929 1.000 0.000 0.000 0.000
#> SRR2926025 1 0.0000 0.929 1.000 0.000 0.000 0.000
#> SRR2926023 1 0.0000 0.929 1.000 0.000 0.000 0.000
#> SRR2926022 1 0.0469 0.928 0.988 0.000 0.000 0.012
#> SRR2926024 1 0.0469 0.928 0.988 0.000 0.000 0.012
#> SRR2926021 1 0.3311 0.880 0.828 0.000 0.000 0.172
#> SRR2926020 1 0.0000 0.929 1.000 0.000 0.000 0.000
#> SRR2926019 1 0.0000 0.929 1.000 0.000 0.000 0.000
#> SRR2926018 1 0.0000 0.929 1.000 0.000 0.000 0.000
#> SRR2926017 1 0.3311 0.880 0.828 0.000 0.000 0.172
#> SRR2926016 2 0.1211 0.699 0.000 0.960 0.000 0.040
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> SRR2926066 3 0.0162 0.8740 0.000 0.004 0.996 0.000 0.000
#> SRR2926067 4 0.6191 -0.0112 0.000 0.000 0.428 0.436 0.136
#> SRR2926063 3 0.1012 0.8695 0.000 0.012 0.968 0.000 0.020
#> SRR2926064 4 0.1741 0.6855 0.000 0.040 0.000 0.936 0.024
#> SRR2926062 4 0.2859 0.6500 0.000 0.068 0.000 0.876 0.056
#> SRR2926061 4 0.6243 0.3224 0.000 0.264 0.008 0.568 0.160
#> SRR2926065 4 0.1082 0.6947 0.000 0.000 0.028 0.964 0.008
#> SRR2926060 4 0.0162 0.7046 0.000 0.000 0.000 0.996 0.004
#> SRR2926059 3 0.2238 0.8475 0.000 0.004 0.912 0.020 0.064
#> SRR2926058 3 0.3375 0.8481 0.000 0.040 0.852 0.012 0.096
#> SRR2926056 3 0.4360 0.6916 0.000 0.064 0.752 0.000 0.184
#> SRR2926057 3 0.3375 0.8481 0.000 0.040 0.852 0.012 0.096
#> SRR2926055 4 0.5972 0.3377 0.000 0.000 0.300 0.560 0.140
#> SRR2926054 3 0.0898 0.8741 0.000 0.008 0.972 0.000 0.020
#> SRR2926051 3 0.1106 0.8696 0.000 0.012 0.964 0.000 0.024
#> SRR2926052 3 0.0000 0.8738 0.000 0.000 1.000 0.000 0.000
#> SRR2926053 3 0.3099 0.7823 0.000 0.000 0.848 0.028 0.124
#> SRR2926050 3 0.2520 0.8479 0.000 0.048 0.896 0.000 0.056
#> SRR2926049 2 0.3710 0.9048 0.000 0.784 0.000 0.192 0.024
#> SRR2926047 2 0.3910 0.8957 0.000 0.772 0.000 0.196 0.032
#> SRR2926046 3 0.2654 0.8432 0.000 0.048 0.888 0.000 0.064
#> SRR2926048 2 0.3656 0.9056 0.000 0.784 0.000 0.196 0.020
#> SRR2926044 4 0.5886 0.3166 0.000 0.272 0.000 0.584 0.144
#> SRR2926045 3 0.5093 0.5784 0.000 0.000 0.696 0.180 0.124
#> SRR2926041 2 0.3074 0.9088 0.000 0.804 0.000 0.196 0.000
#> SRR2926042 2 0.5065 0.5863 0.000 0.544 0.000 0.420 0.036
#> SRR2926040 2 0.3621 0.9055 0.000 0.788 0.000 0.192 0.020
#> SRR2926039 4 0.0671 0.7028 0.000 0.016 0.000 0.980 0.004
#> SRR2926043 4 0.1117 0.6989 0.000 0.020 0.000 0.964 0.016
#> SRR2926038 4 0.4963 -0.0947 0.000 0.352 0.000 0.608 0.040
#> SRR2926036 2 0.3231 0.9090 0.000 0.800 0.000 0.196 0.004
#> SRR2926037 2 0.3621 0.9055 0.000 0.788 0.000 0.192 0.020
#> SRR2926035 2 0.3231 0.9090 0.000 0.800 0.000 0.196 0.004
#> SRR2926034 4 0.0451 0.7047 0.000 0.008 0.000 0.988 0.004
#> SRR2926032 2 0.4949 0.6342 0.000 0.572 0.000 0.396 0.032
#> SRR2926031 5 0.4851 0.3126 0.340 0.036 0.000 0.000 0.624
#> SRR2926033 4 0.5256 0.4600 0.000 0.212 0.000 0.672 0.116
#> SRR2926030 1 0.0807 0.8408 0.976 0.012 0.000 0.000 0.012
#> SRR2926029 5 0.5405 -0.2645 0.000 0.056 0.460 0.000 0.484
#> SRR2926027 1 0.5073 0.5525 0.688 0.100 0.000 0.000 0.212
#> SRR2926028 5 0.3876 0.3688 0.316 0.000 0.000 0.000 0.684
#> SRR2926026 1 0.0000 0.8502 1.000 0.000 0.000 0.000 0.000
#> SRR2926025 1 0.0000 0.8502 1.000 0.000 0.000 0.000 0.000
#> SRR2926023 1 0.0162 0.8499 0.996 0.000 0.000 0.000 0.004
#> SRR2926022 1 0.1914 0.8233 0.924 0.060 0.000 0.000 0.016
#> SRR2926024 1 0.1740 0.8265 0.932 0.056 0.000 0.000 0.012
#> SRR2926021 1 0.5810 0.3557 0.580 0.124 0.000 0.000 0.296
#> SRR2926020 1 0.0000 0.8502 1.000 0.000 0.000 0.000 0.000
#> SRR2926019 1 0.0000 0.8502 1.000 0.000 0.000 0.000 0.000
#> SRR2926018 1 0.0162 0.8499 0.996 0.000 0.000 0.000 0.004
#> SRR2926017 1 0.5810 0.3557 0.580 0.124 0.000 0.000 0.296
#> SRR2926016 4 0.2236 0.6841 0.000 0.024 0.000 0.908 0.068
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> SRR2926066 3 0.2793 0.61147 0.000 0.000 0.800 0.000 0.000 0.200
#> SRR2926067 6 0.5701 0.57065 0.000 0.000 0.196 0.256 0.004 0.544
#> SRR2926063 3 0.2994 0.62008 0.000 0.000 0.788 0.000 0.004 0.208
#> SRR2926064 4 0.3058 0.73425 0.000 0.124 0.000 0.840 0.024 0.012
#> SRR2926062 4 0.3961 0.70067 0.000 0.160 0.000 0.776 0.036 0.028
#> SRR2926061 4 0.6817 0.19721 0.000 0.276 0.004 0.352 0.032 0.336
#> SRR2926065 4 0.2492 0.70376 0.000 0.068 0.008 0.888 0.000 0.036
#> SRR2926060 4 0.2218 0.73735 0.000 0.104 0.000 0.884 0.000 0.012
#> SRR2926059 3 0.4224 0.40757 0.000 0.000 0.640 0.016 0.008 0.336
#> SRR2926058 3 0.3348 0.55043 0.000 0.000 0.812 0.020 0.016 0.152
#> SRR2926056 3 0.3448 0.53091 0.000 0.000 0.816 0.004 0.072 0.108
#> SRR2926057 3 0.3348 0.55043 0.000 0.000 0.812 0.020 0.016 0.152
#> SRR2926055 6 0.5913 0.32486 0.000 0.004 0.100 0.384 0.024 0.488
#> SRR2926054 3 0.3265 0.57657 0.000 0.000 0.748 0.000 0.004 0.248
#> SRR2926051 3 0.3081 0.61241 0.000 0.000 0.776 0.000 0.004 0.220
#> SRR2926052 3 0.2793 0.61147 0.000 0.000 0.800 0.000 0.000 0.200
#> SRR2926053 6 0.4263 0.12898 0.000 0.000 0.480 0.016 0.000 0.504
#> SRR2926050 3 0.0622 0.63473 0.000 0.000 0.980 0.012 0.008 0.000
#> SRR2926049 2 0.1856 0.82985 0.000 0.920 0.000 0.000 0.048 0.032
#> SRR2926047 2 0.2220 0.81622 0.000 0.908 0.000 0.020 0.052 0.020
#> SRR2926046 3 0.1367 0.62494 0.000 0.000 0.944 0.000 0.012 0.044
#> SRR2926048 2 0.1861 0.82781 0.000 0.928 0.000 0.016 0.036 0.020
#> SRR2926044 4 0.6766 0.23206 0.000 0.296 0.000 0.344 0.036 0.324
#> SRR2926045 6 0.5190 0.44622 0.000 0.000 0.376 0.096 0.000 0.528
#> SRR2926041 2 0.0146 0.84445 0.000 0.996 0.000 0.004 0.000 0.000
#> SRR2926042 2 0.4967 0.30655 0.000 0.588 0.000 0.352 0.032 0.028
#> SRR2926040 2 0.1789 0.83029 0.000 0.924 0.000 0.000 0.044 0.032
#> SRR2926039 4 0.2308 0.73833 0.000 0.108 0.000 0.880 0.004 0.008
#> SRR2926043 4 0.2165 0.73942 0.000 0.108 0.000 0.884 0.008 0.000
#> SRR2926038 4 0.5329 0.25098 0.000 0.376 0.000 0.544 0.048 0.032
#> SRR2926036 2 0.0291 0.84467 0.000 0.992 0.000 0.004 0.004 0.000
#> SRR2926037 2 0.1856 0.82962 0.000 0.920 0.000 0.000 0.048 0.032
#> SRR2926035 2 0.0291 0.84467 0.000 0.992 0.000 0.004 0.004 0.000
#> SRR2926034 4 0.2734 0.73396 0.000 0.104 0.000 0.864 0.008 0.024
#> SRR2926032 2 0.4989 0.37612 0.000 0.616 0.000 0.312 0.052 0.020
#> SRR2926031 5 0.5899 0.58482 0.164 0.000 0.000 0.060 0.616 0.160
#> SRR2926033 4 0.6514 0.33130 0.000 0.280 0.000 0.416 0.024 0.280
#> SRR2926030 1 0.1218 0.87594 0.956 0.000 0.000 0.028 0.012 0.004
#> SRR2926029 3 0.6193 0.03737 0.000 0.000 0.440 0.008 0.292 0.260
#> SRR2926027 1 0.3727 0.00716 0.612 0.000 0.000 0.000 0.388 0.000
#> SRR2926028 5 0.6050 0.56575 0.148 0.000 0.000 0.044 0.568 0.240
#> SRR2926026 1 0.0000 0.89749 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2926025 1 0.0260 0.89783 0.992 0.000 0.000 0.008 0.000 0.000
#> SRR2926023 1 0.0146 0.89778 0.996 0.000 0.000 0.004 0.000 0.000
#> SRR2926022 1 0.2249 0.83583 0.900 0.000 0.000 0.032 0.064 0.004
#> SRR2926024 1 0.2263 0.83991 0.900 0.000 0.000 0.036 0.060 0.004
#> SRR2926021 5 0.3851 0.35099 0.460 0.000 0.000 0.000 0.540 0.000
#> SRR2926020 1 0.0260 0.89783 0.992 0.000 0.000 0.008 0.000 0.000
#> SRR2926019 1 0.0260 0.89783 0.992 0.000 0.000 0.008 0.000 0.000
#> SRR2926018 1 0.0146 0.89778 0.996 0.000 0.000 0.004 0.000 0.000
#> SRR2926017 5 0.3851 0.35099 0.460 0.000 0.000 0.000 0.540 0.000
#> SRR2926016 4 0.5316 0.66124 0.000 0.112 0.000 0.688 0.068 0.132
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 18096 rows and 52 columns.
#> Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'MAD' method.
#> Subgroups are detected by 'skmeans' method.
#> Performed in total 1250 partitions by row resampling.
#> Best k for subgroups seems to be 3.
#>
#> Following methods can be applied to this 'ConsensusPartition' object:
#> [1] "cola_report" "collect_classes" "collect_plots"
#> [4] "collect_stats" "colnames" "compare_signatures"
#> [7] "consensus_heatmap" "dimension_reduction" "functional_enrichment"
#> [10] "get_anno_col" "get_anno" "get_classes"
#> [13] "get_consensus" "get_matrix" "get_membership"
#> [16] "get_param" "get_signatures" "get_stats"
#> [19] "is_best_k" "is_stable_k" "membership_heatmap"
#> [22] "ncol" "nrow" "plot_ecdf"
#> [25] "rownames" "select_partition_number" "show"
#> [28] "suggest_best_k" "test_to_known_factors"
collect_plots()
function collects all the plots made from res
for all k
(number of partitions)
into one single page to provide an easy and fast comparison between different k
.
collect_plots(res)
The plots are:
k
and the heatmap of
predicted classes for each k
.k
.k
.k
.All the plots in panels can be made by individual functions and they are plotted later in this section.
select_partition_number()
produces several plots showing different
statistics for choosing “optimized” k
. There are following statistics:
k
;k
, the area increased is defined as \(A_k - A_{k-1}\).The detailed explanations of these statistics can be found in the cola vignette.
Generally speaking, lower PAC score, higher mean silhouette score or higher
concordance corresponds to better partition. Rand index and Jaccard index
measure how similar the current partition is compared to partition with k-1
.
If they are too similar, we won't accept k
is better than k-1
.
select_partition_number(res)
The numeric values for all these statistics can be obtained by get_stats()
.
get_stats(res)
#> k 1-PAC mean_silhouette concordance area_increased Rand Jaccard
#> 2 2 0.959 0.941 0.975 0.5083 0.491 0.491
#> 3 3 1.000 0.985 0.993 0.3121 0.784 0.584
#> 4 4 0.881 0.886 0.932 0.1329 0.894 0.687
#> 5 5 0.790 0.789 0.874 0.0549 0.952 0.804
#> 6 6 0.800 0.667 0.810 0.0381 0.981 0.907
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
#> SRR2926066 1 0.000 0.950 1.000 0.000
#> SRR2926067 2 0.000 1.000 0.000 1.000
#> SRR2926063 1 0.000 0.950 1.000 0.000
#> SRR2926064 2 0.000 1.000 0.000 1.000
#> SRR2926062 2 0.000 1.000 0.000 1.000
#> SRR2926061 2 0.000 1.000 0.000 1.000
#> SRR2926065 2 0.000 1.000 0.000 1.000
#> SRR2926060 2 0.000 1.000 0.000 1.000
#> SRR2926059 1 0.978 0.361 0.588 0.412
#> SRR2926058 1 0.753 0.731 0.784 0.216
#> SRR2926056 1 0.000 0.950 1.000 0.000
#> SRR2926057 1 0.714 0.757 0.804 0.196
#> SRR2926055 2 0.000 1.000 0.000 1.000
#> SRR2926054 1 0.000 0.950 1.000 0.000
#> SRR2926051 1 0.000 0.950 1.000 0.000
#> SRR2926052 1 0.000 0.950 1.000 0.000
#> SRR2926053 1 0.994 0.237 0.544 0.456
#> SRR2926050 1 0.000 0.950 1.000 0.000
#> SRR2926049 2 0.000 1.000 0.000 1.000
#> SRR2926047 2 0.000 1.000 0.000 1.000
#> SRR2926046 1 0.000 0.950 1.000 0.000
#> SRR2926048 2 0.000 1.000 0.000 1.000
#> SRR2926044 2 0.000 1.000 0.000 1.000
#> SRR2926045 2 0.000 1.000 0.000 1.000
#> SRR2926041 2 0.000 1.000 0.000 1.000
#> SRR2926042 2 0.000 1.000 0.000 1.000
#> SRR2926040 2 0.000 1.000 0.000 1.000
#> SRR2926039 2 0.000 1.000 0.000 1.000
#> SRR2926043 2 0.000 1.000 0.000 1.000
#> SRR2926038 2 0.000 1.000 0.000 1.000
#> SRR2926036 2 0.000 1.000 0.000 1.000
#> SRR2926037 2 0.000 1.000 0.000 1.000
#> SRR2926035 2 0.000 1.000 0.000 1.000
#> SRR2926034 2 0.000 1.000 0.000 1.000
#> SRR2926032 2 0.000 1.000 0.000 1.000
#> SRR2926031 1 0.000 0.950 1.000 0.000
#> SRR2926033 2 0.000 1.000 0.000 1.000
#> SRR2926030 1 0.000 0.950 1.000 0.000
#> SRR2926029 1 0.000 0.950 1.000 0.000
#> SRR2926027 1 0.000 0.950 1.000 0.000
#> SRR2926028 1 0.000 0.950 1.000 0.000
#> SRR2926026 1 0.000 0.950 1.000 0.000
#> SRR2926025 1 0.000 0.950 1.000 0.000
#> SRR2926023 1 0.000 0.950 1.000 0.000
#> SRR2926022 1 0.000 0.950 1.000 0.000
#> SRR2926024 1 0.000 0.950 1.000 0.000
#> SRR2926021 1 0.000 0.950 1.000 0.000
#> SRR2926020 1 0.000 0.950 1.000 0.000
#> SRR2926019 1 0.000 0.950 1.000 0.000
#> SRR2926018 1 0.000 0.950 1.000 0.000
#> SRR2926017 1 0.000 0.950 1.000 0.000
#> SRR2926016 2 0.000 1.000 0.000 1.000
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> SRR2926066 3 0.000 0.975 0.000 0 1.000
#> SRR2926067 3 0.000 0.975 0.000 0 1.000
#> SRR2926063 3 0.000 0.975 0.000 0 1.000
#> SRR2926064 2 0.000 1.000 0.000 1 0.000
#> SRR2926062 2 0.000 1.000 0.000 1 0.000
#> SRR2926061 2 0.000 1.000 0.000 1 0.000
#> SRR2926065 2 0.000 1.000 0.000 1 0.000
#> SRR2926060 2 0.000 1.000 0.000 1 0.000
#> SRR2926059 3 0.000 0.975 0.000 0 1.000
#> SRR2926058 3 0.000 0.975 0.000 0 1.000
#> SRR2926056 3 0.418 0.803 0.172 0 0.828
#> SRR2926057 3 0.000 0.975 0.000 0 1.000
#> SRR2926055 3 0.000 0.975 0.000 0 1.000
#> SRR2926054 3 0.000 0.975 0.000 0 1.000
#> SRR2926051 3 0.000 0.975 0.000 0 1.000
#> SRR2926052 3 0.000 0.975 0.000 0 1.000
#> SRR2926053 3 0.000 0.975 0.000 0 1.000
#> SRR2926050 3 0.000 0.975 0.000 0 1.000
#> SRR2926049 2 0.000 1.000 0.000 1 0.000
#> SRR2926047 2 0.000 1.000 0.000 1 0.000
#> SRR2926046 3 0.000 0.975 0.000 0 1.000
#> SRR2926048 2 0.000 1.000 0.000 1 0.000
#> SRR2926044 2 0.000 1.000 0.000 1 0.000
#> SRR2926045 3 0.000 0.975 0.000 0 1.000
#> SRR2926041 2 0.000 1.000 0.000 1 0.000
#> SRR2926042 2 0.000 1.000 0.000 1 0.000
#> SRR2926040 2 0.000 1.000 0.000 1 0.000
#> SRR2926039 2 0.000 1.000 0.000 1 0.000
#> SRR2926043 2 0.000 1.000 0.000 1 0.000
#> SRR2926038 2 0.000 1.000 0.000 1 0.000
#> SRR2926036 2 0.000 1.000 0.000 1 0.000
#> SRR2926037 2 0.000 1.000 0.000 1 0.000
#> SRR2926035 2 0.000 1.000 0.000 1 0.000
#> SRR2926034 2 0.000 1.000 0.000 1 0.000
#> SRR2926032 2 0.000 1.000 0.000 1 0.000
#> SRR2926031 1 0.000 1.000 1.000 0 0.000
#> SRR2926033 2 0.000 1.000 0.000 1 0.000
#> SRR2926030 1 0.000 1.000 1.000 0 0.000
#> SRR2926029 3 0.455 0.766 0.200 0 0.800
#> SRR2926027 1 0.000 1.000 1.000 0 0.000
#> SRR2926028 1 0.000 1.000 1.000 0 0.000
#> SRR2926026 1 0.000 1.000 1.000 0 0.000
#> SRR2926025 1 0.000 1.000 1.000 0 0.000
#> SRR2926023 1 0.000 1.000 1.000 0 0.000
#> SRR2926022 1 0.000 1.000 1.000 0 0.000
#> SRR2926024 1 0.000 1.000 1.000 0 0.000
#> SRR2926021 1 0.000 1.000 1.000 0 0.000
#> SRR2926020 1 0.000 1.000 1.000 0 0.000
#> SRR2926019 1 0.000 1.000 1.000 0 0.000
#> SRR2926018 1 0.000 1.000 1.000 0 0.000
#> SRR2926017 1 0.000 1.000 1.000 0 0.000
#> SRR2926016 2 0.000 1.000 0.000 1 0.000
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> SRR2926066 3 0.0336 0.933 0.000 0.000 0.992 0.008
#> SRR2926067 3 0.5688 0.321 0.000 0.024 0.512 0.464
#> SRR2926063 3 0.0336 0.933 0.000 0.000 0.992 0.008
#> SRR2926064 4 0.4679 0.653 0.000 0.352 0.000 0.648
#> SRR2926062 4 0.4730 0.645 0.000 0.364 0.000 0.636
#> SRR2926061 2 0.1970 0.883 0.000 0.932 0.008 0.060
#> SRR2926065 4 0.1302 0.809 0.000 0.044 0.000 0.956
#> SRR2926060 4 0.2345 0.846 0.000 0.100 0.000 0.900
#> SRR2926059 3 0.1211 0.923 0.000 0.000 0.960 0.040
#> SRR2926058 3 0.1211 0.923 0.000 0.000 0.960 0.040
#> SRR2926056 3 0.0188 0.933 0.004 0.000 0.996 0.000
#> SRR2926057 3 0.1211 0.923 0.000 0.000 0.960 0.040
#> SRR2926055 4 0.2909 0.727 0.000 0.020 0.092 0.888
#> SRR2926054 3 0.0000 0.933 0.000 0.000 1.000 0.000
#> SRR2926051 3 0.0336 0.933 0.000 0.000 0.992 0.008
#> SRR2926052 3 0.0336 0.933 0.000 0.000 0.992 0.008
#> SRR2926053 3 0.1792 0.906 0.000 0.000 0.932 0.068
#> SRR2926050 3 0.0000 0.933 0.000 0.000 1.000 0.000
#> SRR2926049 2 0.0188 0.927 0.000 0.996 0.000 0.004
#> SRR2926047 2 0.0592 0.921 0.000 0.984 0.000 0.016
#> SRR2926046 3 0.0000 0.933 0.000 0.000 1.000 0.000
#> SRR2926048 2 0.0707 0.919 0.000 0.980 0.000 0.020
#> SRR2926044 2 0.1557 0.894 0.000 0.944 0.000 0.056
#> SRR2926045 3 0.2281 0.891 0.000 0.000 0.904 0.096
#> SRR2926041 2 0.0000 0.927 0.000 1.000 0.000 0.000
#> SRR2926042 2 0.2011 0.867 0.000 0.920 0.000 0.080
#> SRR2926040 2 0.0188 0.927 0.000 0.996 0.000 0.004
#> SRR2926039 4 0.2530 0.851 0.000 0.112 0.000 0.888
#> SRR2926043 4 0.2760 0.849 0.000 0.128 0.000 0.872
#> SRR2926038 4 0.4730 0.644 0.000 0.364 0.000 0.636
#> SRR2926036 2 0.0000 0.927 0.000 1.000 0.000 0.000
#> SRR2926037 2 0.0188 0.927 0.000 0.996 0.000 0.004
#> SRR2926035 2 0.0000 0.927 0.000 1.000 0.000 0.000
#> SRR2926034 4 0.2530 0.851 0.000 0.112 0.000 0.888
#> SRR2926032 2 0.1940 0.871 0.000 0.924 0.000 0.076
#> SRR2926031 1 0.0000 1.000 1.000 0.000 0.000 0.000
#> SRR2926033 2 0.4790 0.342 0.000 0.620 0.000 0.380
#> SRR2926030 1 0.0000 1.000 1.000 0.000 0.000 0.000
#> SRR2926029 3 0.3486 0.759 0.188 0.000 0.812 0.000
#> SRR2926027 1 0.0000 1.000 1.000 0.000 0.000 0.000
#> SRR2926028 1 0.0000 1.000 1.000 0.000 0.000 0.000
#> SRR2926026 1 0.0000 1.000 1.000 0.000 0.000 0.000
#> SRR2926025 1 0.0000 1.000 1.000 0.000 0.000 0.000
#> SRR2926023 1 0.0000 1.000 1.000 0.000 0.000 0.000
#> SRR2926022 1 0.0000 1.000 1.000 0.000 0.000 0.000
#> SRR2926024 1 0.0000 1.000 1.000 0.000 0.000 0.000
#> SRR2926021 1 0.0000 1.000 1.000 0.000 0.000 0.000
#> SRR2926020 1 0.0000 1.000 1.000 0.000 0.000 0.000
#> SRR2926019 1 0.0000 1.000 1.000 0.000 0.000 0.000
#> SRR2926018 1 0.0000 1.000 1.000 0.000 0.000 0.000
#> SRR2926017 1 0.0000 1.000 1.000 0.000 0.000 0.000
#> SRR2926016 4 0.2868 0.845 0.000 0.136 0.000 0.864
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> SRR2926066 3 0.1851 0.773 0.000 0.000 0.912 0.000 0.088
#> SRR2926067 5 0.4580 0.594 0.000 0.016 0.084 0.128 0.772
#> SRR2926063 3 0.3039 0.696 0.000 0.000 0.808 0.000 0.192
#> SRR2926064 4 0.2230 0.850 0.000 0.116 0.000 0.884 0.000
#> SRR2926062 4 0.3160 0.790 0.000 0.188 0.000 0.808 0.004
#> SRR2926061 2 0.4549 0.592 0.000 0.752 0.016 0.044 0.188
#> SRR2926065 4 0.1197 0.847 0.000 0.000 0.000 0.952 0.048
#> SRR2926060 4 0.0404 0.891 0.000 0.000 0.000 0.988 0.012
#> SRR2926059 3 0.4465 0.670 0.000 0.056 0.732 0.000 0.212
#> SRR2926058 3 0.4269 0.670 0.000 0.056 0.756 0.000 0.188
#> SRR2926056 3 0.2280 0.729 0.000 0.000 0.880 0.000 0.120
#> SRR2926057 3 0.4269 0.670 0.000 0.056 0.756 0.000 0.188
#> SRR2926055 5 0.4602 0.492 0.000 0.000 0.028 0.316 0.656
#> SRR2926054 3 0.2471 0.754 0.000 0.000 0.864 0.000 0.136
#> SRR2926051 3 0.3177 0.678 0.000 0.000 0.792 0.000 0.208
#> SRR2926052 3 0.1792 0.774 0.000 0.000 0.916 0.000 0.084
#> SRR2926053 5 0.4138 0.358 0.000 0.000 0.384 0.000 0.616
#> SRR2926050 3 0.0162 0.781 0.000 0.000 0.996 0.000 0.004
#> SRR2926049 2 0.1341 0.880 0.000 0.944 0.000 0.056 0.000
#> SRR2926047 2 0.1410 0.878 0.000 0.940 0.000 0.060 0.000
#> SRR2926046 3 0.0510 0.783 0.000 0.000 0.984 0.000 0.016
#> SRR2926048 2 0.1410 0.878 0.000 0.940 0.000 0.060 0.000
#> SRR2926044 2 0.3449 0.657 0.000 0.812 0.000 0.024 0.164
#> SRR2926045 5 0.4046 0.489 0.000 0.000 0.296 0.008 0.696
#> SRR2926041 2 0.1341 0.880 0.000 0.944 0.000 0.056 0.000
#> SRR2926042 2 0.3837 0.589 0.000 0.692 0.000 0.308 0.000
#> SRR2926040 2 0.1341 0.880 0.000 0.944 0.000 0.056 0.000
#> SRR2926039 4 0.0162 0.894 0.000 0.000 0.000 0.996 0.004
#> SRR2926043 4 0.0703 0.898 0.000 0.024 0.000 0.976 0.000
#> SRR2926038 4 0.2813 0.812 0.000 0.168 0.000 0.832 0.000
#> SRR2926036 2 0.1341 0.880 0.000 0.944 0.000 0.056 0.000
#> SRR2926037 2 0.1341 0.880 0.000 0.944 0.000 0.056 0.000
#> SRR2926035 2 0.1341 0.880 0.000 0.944 0.000 0.056 0.000
#> SRR2926034 4 0.0451 0.898 0.000 0.008 0.000 0.988 0.004
#> SRR2926032 2 0.3932 0.550 0.000 0.672 0.000 0.328 0.000
#> SRR2926031 1 0.2424 0.913 0.868 0.000 0.000 0.000 0.132
#> SRR2926033 5 0.6551 0.143 0.000 0.384 0.000 0.200 0.416
#> SRR2926030 1 0.0794 0.947 0.972 0.000 0.000 0.000 0.028
#> SRR2926029 3 0.4724 0.583 0.104 0.000 0.732 0.000 0.164
#> SRR2926027 1 0.2020 0.928 0.900 0.000 0.000 0.000 0.100
#> SRR2926028 1 0.2690 0.895 0.844 0.000 0.000 0.000 0.156
#> SRR2926026 1 0.0000 0.956 1.000 0.000 0.000 0.000 0.000
#> SRR2926025 1 0.0000 0.956 1.000 0.000 0.000 0.000 0.000
#> SRR2926023 1 0.0000 0.956 1.000 0.000 0.000 0.000 0.000
#> SRR2926022 1 0.0290 0.956 0.992 0.000 0.000 0.000 0.008
#> SRR2926024 1 0.0162 0.956 0.996 0.000 0.000 0.000 0.004
#> SRR2926021 1 0.2074 0.926 0.896 0.000 0.000 0.000 0.104
#> SRR2926020 1 0.0000 0.956 1.000 0.000 0.000 0.000 0.000
#> SRR2926019 1 0.0000 0.956 1.000 0.000 0.000 0.000 0.000
#> SRR2926018 1 0.0000 0.956 1.000 0.000 0.000 0.000 0.000
#> SRR2926017 1 0.2074 0.926 0.896 0.000 0.000 0.000 0.104
#> SRR2926016 4 0.1211 0.894 0.000 0.024 0.000 0.960 0.016
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> SRR2926066 3 0.2361 0.687 0.000 0.000 0.884 0.000 0.028 0.088
#> SRR2926067 6 0.1563 0.728 0.000 0.000 0.012 0.056 0.000 0.932
#> SRR2926063 3 0.3998 0.559 0.000 0.000 0.712 0.000 0.040 0.248
#> SRR2926064 4 0.1976 0.895 0.000 0.060 0.000 0.916 0.016 0.008
#> SRR2926062 4 0.3624 0.747 0.000 0.220 0.000 0.756 0.016 0.008
#> SRR2926061 2 0.6916 0.378 0.000 0.528 0.040 0.064 0.252 0.116
#> SRR2926065 4 0.0260 0.898 0.000 0.000 0.000 0.992 0.000 0.008
#> SRR2926060 4 0.0551 0.905 0.000 0.008 0.000 0.984 0.004 0.004
#> SRR2926059 3 0.5257 0.537 0.000 0.004 0.636 0.008 0.232 0.120
#> SRR2926058 3 0.5269 0.522 0.000 0.004 0.620 0.008 0.264 0.104
#> SRR2926056 3 0.3819 0.353 0.000 0.000 0.672 0.000 0.316 0.012
#> SRR2926057 3 0.5269 0.522 0.000 0.004 0.620 0.008 0.264 0.104
#> SRR2926055 6 0.3043 0.710 0.000 0.000 0.008 0.140 0.020 0.832
#> SRR2926054 3 0.3139 0.654 0.000 0.000 0.812 0.000 0.028 0.160
#> SRR2926051 3 0.4107 0.545 0.000 0.000 0.700 0.000 0.044 0.256
#> SRR2926052 3 0.2309 0.687 0.000 0.000 0.888 0.000 0.028 0.084
#> SRR2926053 6 0.3855 0.520 0.000 0.000 0.272 0.000 0.024 0.704
#> SRR2926050 3 0.1075 0.671 0.000 0.000 0.952 0.000 0.048 0.000
#> SRR2926049 2 0.0748 0.847 0.000 0.976 0.000 0.004 0.016 0.004
#> SRR2926047 2 0.1268 0.841 0.000 0.952 0.000 0.008 0.036 0.004
#> SRR2926046 3 0.2145 0.670 0.000 0.000 0.900 0.000 0.072 0.028
#> SRR2926048 2 0.0806 0.846 0.000 0.972 0.000 0.008 0.020 0.000
#> SRR2926044 2 0.5071 0.615 0.000 0.708 0.000 0.056 0.132 0.104
#> SRR2926045 6 0.2773 0.685 0.000 0.000 0.152 0.004 0.008 0.836
#> SRR2926041 2 0.0146 0.849 0.000 0.996 0.000 0.004 0.000 0.000
#> SRR2926042 2 0.3970 0.538 0.000 0.692 0.000 0.280 0.028 0.000
#> SRR2926040 2 0.0748 0.847 0.000 0.976 0.000 0.004 0.016 0.004
#> SRR2926039 4 0.0260 0.904 0.000 0.008 0.000 0.992 0.000 0.000
#> SRR2926043 4 0.1367 0.906 0.000 0.044 0.000 0.944 0.012 0.000
#> SRR2926038 4 0.2946 0.815 0.000 0.176 0.000 0.812 0.012 0.000
#> SRR2926036 2 0.0260 0.849 0.000 0.992 0.000 0.008 0.000 0.000
#> SRR2926037 2 0.0748 0.847 0.000 0.976 0.000 0.004 0.016 0.004
#> SRR2926035 2 0.0260 0.849 0.000 0.992 0.000 0.008 0.000 0.000
#> SRR2926034 4 0.0717 0.902 0.000 0.008 0.000 0.976 0.016 0.000
#> SRR2926032 2 0.3979 0.574 0.000 0.708 0.000 0.256 0.036 0.000
#> SRR2926031 1 0.3866 0.139 0.516 0.000 0.000 0.000 0.484 0.000
#> SRR2926033 6 0.5114 0.451 0.000 0.292 0.000 0.100 0.004 0.604
#> SRR2926030 1 0.2092 0.702 0.876 0.000 0.000 0.000 0.124 0.000
#> SRR2926029 5 0.4447 -0.189 0.012 0.000 0.420 0.000 0.556 0.012
#> SRR2926027 1 0.3634 0.558 0.696 0.000 0.000 0.000 0.296 0.008
#> SRR2926028 5 0.3717 -0.233 0.384 0.000 0.000 0.000 0.616 0.000
#> SRR2926026 1 0.0000 0.812 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2926025 1 0.0000 0.812 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2926023 1 0.0000 0.812 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2926022 1 0.1204 0.796 0.944 0.000 0.000 0.000 0.056 0.000
#> SRR2926024 1 0.1075 0.799 0.952 0.000 0.000 0.000 0.048 0.000
#> SRR2926021 1 0.3819 0.489 0.652 0.000 0.000 0.000 0.340 0.008
#> SRR2926020 1 0.0000 0.812 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2926019 1 0.0000 0.812 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2926018 1 0.0000 0.812 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2926017 1 0.3819 0.489 0.652 0.000 0.000 0.000 0.340 0.008
#> SRR2926016 4 0.2189 0.888 0.000 0.060 0.000 0.904 0.032 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["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 18096 rows and 52 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 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.976 0.990 0.4269 0.581 0.581
#> 3 3 1.000 0.956 0.981 0.5693 0.720 0.529
#> 4 4 0.764 0.588 0.791 0.1174 0.821 0.518
#> 5 5 0.760 0.718 0.807 0.0574 0.891 0.602
#> 6 6 0.821 0.733 0.833 0.0517 0.942 0.726
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
#> SRR2926066 2 0.204 0.961 0.032 0.968
#> SRR2926067 2 0.000 0.985 0.000 1.000
#> SRR2926063 2 0.184 0.964 0.028 0.972
#> SRR2926064 2 0.000 0.985 0.000 1.000
#> SRR2926062 2 0.000 0.985 0.000 1.000
#> SRR2926061 2 0.000 0.985 0.000 1.000
#> SRR2926065 2 0.000 0.985 0.000 1.000
#> SRR2926060 2 0.000 0.985 0.000 1.000
#> SRR2926059 2 0.000 0.985 0.000 1.000
#> SRR2926058 2 0.000 0.985 0.000 1.000
#> SRR2926056 1 0.000 1.000 1.000 0.000
#> SRR2926057 2 0.000 0.985 0.000 1.000
#> SRR2926055 2 0.000 0.985 0.000 1.000
#> SRR2926054 2 0.000 0.985 0.000 1.000
#> SRR2926051 2 0.184 0.964 0.028 0.972
#> SRR2926052 2 0.000 0.985 0.000 1.000
#> SRR2926053 2 0.000 0.985 0.000 1.000
#> SRR2926050 2 0.118 0.974 0.016 0.984
#> SRR2926049 2 0.000 0.985 0.000 1.000
#> SRR2926047 2 0.000 0.985 0.000 1.000
#> SRR2926046 2 0.184 0.964 0.028 0.972
#> SRR2926048 2 0.000 0.985 0.000 1.000
#> SRR2926044 2 0.000 0.985 0.000 1.000
#> SRR2926045 2 0.000 0.985 0.000 1.000
#> SRR2926041 2 0.000 0.985 0.000 1.000
#> SRR2926042 2 0.000 0.985 0.000 1.000
#> SRR2926040 2 0.000 0.985 0.000 1.000
#> SRR2926039 2 0.000 0.985 0.000 1.000
#> SRR2926043 2 0.000 0.985 0.000 1.000
#> SRR2926038 2 0.000 0.985 0.000 1.000
#> SRR2926036 2 0.000 0.985 0.000 1.000
#> SRR2926037 2 0.000 0.985 0.000 1.000
#> SRR2926035 2 0.000 0.985 0.000 1.000
#> SRR2926034 2 0.000 0.985 0.000 1.000
#> SRR2926032 2 0.000 0.985 0.000 1.000
#> SRR2926031 1 0.000 1.000 1.000 0.000
#> SRR2926033 2 0.000 0.985 0.000 1.000
#> SRR2926030 1 0.000 1.000 1.000 0.000
#> SRR2926029 2 0.969 0.357 0.396 0.604
#> SRR2926027 1 0.000 1.000 1.000 0.000
#> SRR2926028 1 0.000 1.000 1.000 0.000
#> SRR2926026 1 0.000 1.000 1.000 0.000
#> SRR2926025 1 0.000 1.000 1.000 0.000
#> SRR2926023 1 0.000 1.000 1.000 0.000
#> SRR2926022 1 0.000 1.000 1.000 0.000
#> SRR2926024 1 0.000 1.000 1.000 0.000
#> SRR2926021 1 0.000 1.000 1.000 0.000
#> SRR2926020 1 0.000 1.000 1.000 0.000
#> SRR2926019 1 0.000 1.000 1.000 0.000
#> SRR2926018 1 0.000 1.000 1.000 0.000
#> SRR2926017 1 0.000 1.000 1.000 0.000
#> SRR2926016 2 0.000 0.985 0.000 1.000
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> SRR2926066 3 0.0000 0.939 0.000 0.000 1.000
#> SRR2926067 3 0.4178 0.783 0.000 0.172 0.828
#> SRR2926063 3 0.0000 0.939 0.000 0.000 1.000
#> SRR2926064 2 0.0000 0.999 0.000 1.000 0.000
#> SRR2926062 2 0.0000 0.999 0.000 1.000 0.000
#> SRR2926061 2 0.0747 0.982 0.000 0.984 0.016
#> SRR2926065 3 0.6008 0.463 0.000 0.372 0.628
#> SRR2926060 2 0.0000 0.999 0.000 1.000 0.000
#> SRR2926059 3 0.0000 0.939 0.000 0.000 1.000
#> SRR2926058 3 0.0000 0.939 0.000 0.000 1.000
#> SRR2926056 3 0.0592 0.930 0.012 0.000 0.988
#> SRR2926057 3 0.0000 0.939 0.000 0.000 1.000
#> SRR2926055 3 0.0000 0.939 0.000 0.000 1.000
#> SRR2926054 3 0.0000 0.939 0.000 0.000 1.000
#> SRR2926051 3 0.0000 0.939 0.000 0.000 1.000
#> SRR2926052 3 0.0000 0.939 0.000 0.000 1.000
#> SRR2926053 3 0.0000 0.939 0.000 0.000 1.000
#> SRR2926050 3 0.0000 0.939 0.000 0.000 1.000
#> SRR2926049 2 0.0000 0.999 0.000 1.000 0.000
#> SRR2926047 2 0.0000 0.999 0.000 1.000 0.000
#> SRR2926046 3 0.0000 0.939 0.000 0.000 1.000
#> SRR2926048 2 0.0000 0.999 0.000 1.000 0.000
#> SRR2926044 2 0.0000 0.999 0.000 1.000 0.000
#> SRR2926045 3 0.0000 0.939 0.000 0.000 1.000
#> SRR2926041 2 0.0000 0.999 0.000 1.000 0.000
#> SRR2926042 2 0.0000 0.999 0.000 1.000 0.000
#> SRR2926040 2 0.0000 0.999 0.000 1.000 0.000
#> SRR2926039 2 0.0000 0.999 0.000 1.000 0.000
#> SRR2926043 2 0.0000 0.999 0.000 1.000 0.000
#> SRR2926038 2 0.0000 0.999 0.000 1.000 0.000
#> SRR2926036 2 0.0000 0.999 0.000 1.000 0.000
#> SRR2926037 2 0.0000 0.999 0.000 1.000 0.000
#> SRR2926035 2 0.0000 0.999 0.000 1.000 0.000
#> SRR2926034 2 0.0237 0.995 0.000 0.996 0.004
#> SRR2926032 2 0.0000 0.999 0.000 1.000 0.000
#> SRR2926031 1 0.0000 1.000 1.000 0.000 0.000
#> SRR2926033 3 0.6026 0.454 0.000 0.376 0.624
#> SRR2926030 1 0.0000 1.000 1.000 0.000 0.000
#> SRR2926029 3 0.0592 0.930 0.012 0.000 0.988
#> SRR2926027 1 0.0000 1.000 1.000 0.000 0.000
#> SRR2926028 1 0.0000 1.000 1.000 0.000 0.000
#> SRR2926026 1 0.0000 1.000 1.000 0.000 0.000
#> SRR2926025 1 0.0000 1.000 1.000 0.000 0.000
#> SRR2926023 1 0.0000 1.000 1.000 0.000 0.000
#> SRR2926022 1 0.0000 1.000 1.000 0.000 0.000
#> SRR2926024 1 0.0000 1.000 1.000 0.000 0.000
#> SRR2926021 1 0.0000 1.000 1.000 0.000 0.000
#> SRR2926020 1 0.0000 1.000 1.000 0.000 0.000
#> SRR2926019 1 0.0000 1.000 1.000 0.000 0.000
#> SRR2926018 1 0.0000 1.000 1.000 0.000 0.000
#> SRR2926017 1 0.0000 1.000 1.000 0.000 0.000
#> SRR2926016 2 0.0000 0.999 0.000 1.000 0.000
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> SRR2926066 3 0.4500 0.7982 0 0.000 0.684 0.316
#> SRR2926067 4 0.7711 0.1490 0 0.228 0.352 0.420
#> SRR2926063 3 0.0000 0.6883 0 0.000 1.000 0.000
#> SRR2926064 2 0.0000 0.5961 0 1.000 0.000 0.000
#> SRR2926062 2 0.4941 -0.2314 0 0.564 0.000 0.436
#> SRR2926061 2 0.4955 -0.2324 0 0.556 0.000 0.444
#> SRR2926065 2 0.4836 0.3572 0 0.672 0.320 0.008
#> SRR2926060 2 0.0000 0.5961 0 1.000 0.000 0.000
#> SRR2926059 3 0.4925 -0.1742 0 0.000 0.572 0.428
#> SRR2926058 4 0.4164 -0.0996 0 0.000 0.264 0.736
#> SRR2926056 3 0.4500 0.7982 0 0.000 0.684 0.316
#> SRR2926057 4 0.4164 -0.0996 0 0.000 0.264 0.736
#> SRR2926055 2 0.4973 0.3378 0 0.644 0.348 0.008
#> SRR2926054 3 0.1022 0.7044 0 0.000 0.968 0.032
#> SRR2926051 3 0.4454 0.7973 0 0.000 0.692 0.308
#> SRR2926052 3 0.4500 0.7982 0 0.000 0.684 0.316
#> SRR2926053 3 0.0336 0.6830 0 0.000 0.992 0.008
#> SRR2926050 3 0.4543 0.7941 0 0.000 0.676 0.324
#> SRR2926049 2 0.4103 0.3654 0 0.744 0.000 0.256
#> SRR2926047 4 0.4661 0.5387 0 0.348 0.000 0.652
#> SRR2926046 3 0.4500 0.7982 0 0.000 0.684 0.316
#> SRR2926048 4 0.4585 0.5481 0 0.332 0.000 0.668
#> SRR2926044 4 0.7500 0.1438 0 0.404 0.180 0.416
#> SRR2926045 3 0.3852 0.4392 0 0.192 0.800 0.008
#> SRR2926041 4 0.4585 0.5481 0 0.332 0.000 0.668
#> SRR2926042 2 0.4888 -0.1897 0 0.588 0.000 0.412
#> SRR2926040 4 0.4585 0.5481 0 0.332 0.000 0.668
#> SRR2926039 2 0.0000 0.5961 0 1.000 0.000 0.000
#> SRR2926043 2 0.0336 0.5932 0 0.992 0.000 0.008
#> SRR2926038 2 0.4103 0.3654 0 0.744 0.000 0.256
#> SRR2926036 4 0.4585 0.5481 0 0.332 0.000 0.668
#> SRR2926037 4 0.4790 0.5089 0 0.380 0.000 0.620
#> SRR2926035 4 0.4585 0.5481 0 0.332 0.000 0.668
#> SRR2926034 2 0.4095 0.3662 0 0.792 0.016 0.192
#> SRR2926032 4 0.4843 0.4867 0 0.396 0.000 0.604
#> SRR2926031 1 0.0000 1.0000 1 0.000 0.000 0.000
#> SRR2926033 4 0.7771 0.1435 0 0.256 0.320 0.424
#> SRR2926030 1 0.0000 1.0000 1 0.000 0.000 0.000
#> SRR2926029 3 0.4500 0.7982 0 0.000 0.684 0.316
#> SRR2926027 1 0.0000 1.0000 1 0.000 0.000 0.000
#> SRR2926028 1 0.0000 1.0000 1 0.000 0.000 0.000
#> SRR2926026 1 0.0000 1.0000 1 0.000 0.000 0.000
#> SRR2926025 1 0.0000 1.0000 1 0.000 0.000 0.000
#> SRR2926023 1 0.0000 1.0000 1 0.000 0.000 0.000
#> SRR2926022 1 0.0000 1.0000 1 0.000 0.000 0.000
#> SRR2926024 1 0.0000 1.0000 1 0.000 0.000 0.000
#> SRR2926021 1 0.0000 1.0000 1 0.000 0.000 0.000
#> SRR2926020 1 0.0000 1.0000 1 0.000 0.000 0.000
#> SRR2926019 1 0.0000 1.0000 1 0.000 0.000 0.000
#> SRR2926018 1 0.0000 1.0000 1 0.000 0.000 0.000
#> SRR2926017 1 0.0000 1.0000 1 0.000 0.000 0.000
#> SRR2926016 2 0.0000 0.5961 0 1.000 0.000 0.000
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> SRR2926066 3 0.3707 0.849 0.000 0.000 0.716 0.284 0.000
#> SRR2926067 2 0.5851 0.501 0.000 0.580 0.288 0.132 0.000
#> SRR2926063 3 0.1041 0.721 0.000 0.004 0.964 0.032 0.000
#> SRR2926064 4 0.3949 0.788 0.000 0.332 0.000 0.668 0.000
#> SRR2926062 2 0.2069 0.547 0.000 0.912 0.000 0.076 0.012
#> SRR2926061 2 0.0794 0.562 0.000 0.972 0.000 0.028 0.000
#> SRR2926065 4 0.4301 0.503 0.000 0.028 0.260 0.712 0.000
#> SRR2926060 4 0.3949 0.788 0.000 0.332 0.000 0.668 0.000
#> SRR2926059 2 0.4873 0.505 0.000 0.644 0.312 0.044 0.000
#> SRR2926058 2 0.5179 0.398 0.000 0.640 0.072 0.288 0.000
#> SRR2926056 3 0.3707 0.849 0.000 0.000 0.716 0.284 0.000
#> SRR2926057 2 0.5179 0.398 0.000 0.640 0.072 0.288 0.000
#> SRR2926055 4 0.3884 0.473 0.000 0.004 0.288 0.708 0.000
#> SRR2926054 3 0.0162 0.740 0.000 0.004 0.996 0.000 0.000
#> SRR2926051 3 0.3636 0.849 0.000 0.000 0.728 0.272 0.000
#> SRR2926052 3 0.3684 0.850 0.000 0.000 0.720 0.280 0.000
#> SRR2926053 3 0.1205 0.715 0.000 0.004 0.956 0.040 0.000
#> SRR2926050 3 0.5067 0.805 0.000 0.064 0.648 0.288 0.000
#> SRR2926049 5 0.4084 0.992 0.000 0.328 0.000 0.004 0.668
#> SRR2926047 2 0.1908 0.477 0.000 0.908 0.000 0.000 0.092
#> SRR2926046 3 0.3707 0.849 0.000 0.000 0.716 0.284 0.000
#> SRR2926048 5 0.3949 0.998 0.000 0.332 0.000 0.000 0.668
#> SRR2926044 2 0.4637 0.558 0.000 0.740 0.160 0.100 0.000
#> SRR2926045 3 0.1638 0.690 0.000 0.004 0.932 0.064 0.000
#> SRR2926041 5 0.3949 0.998 0.000 0.332 0.000 0.000 0.668
#> SRR2926042 2 0.2305 0.544 0.000 0.896 0.000 0.092 0.012
#> SRR2926040 5 0.3949 0.998 0.000 0.332 0.000 0.000 0.668
#> SRR2926039 4 0.3932 0.789 0.000 0.328 0.000 0.672 0.000
#> SRR2926043 4 0.3895 0.787 0.000 0.320 0.000 0.680 0.000
#> SRR2926038 4 0.5715 0.575 0.000 0.336 0.000 0.564 0.100
#> SRR2926036 5 0.3949 0.998 0.000 0.332 0.000 0.000 0.668
#> SRR2926037 2 0.4384 -0.135 0.000 0.660 0.000 0.016 0.324
#> SRR2926035 5 0.3949 0.998 0.000 0.332 0.000 0.000 0.668
#> SRR2926034 2 0.4648 -0.417 0.000 0.524 0.012 0.464 0.000
#> SRR2926032 2 0.2068 0.482 0.000 0.904 0.000 0.004 0.092
#> SRR2926031 1 0.3932 0.767 0.672 0.000 0.000 0.000 0.328
#> SRR2926033 2 0.5940 0.497 0.000 0.572 0.284 0.144 0.000
#> SRR2926030 1 0.0000 0.913 1.000 0.000 0.000 0.000 0.000
#> SRR2926029 3 0.3707 0.849 0.000 0.000 0.716 0.284 0.000
#> SRR2926027 1 0.0290 0.912 0.992 0.000 0.000 0.000 0.008
#> SRR2926028 1 0.3949 0.767 0.668 0.000 0.000 0.000 0.332
#> SRR2926026 1 0.0000 0.913 1.000 0.000 0.000 0.000 0.000
#> SRR2926025 1 0.0000 0.913 1.000 0.000 0.000 0.000 0.000
#> SRR2926023 1 0.0162 0.913 0.996 0.000 0.000 0.000 0.004
#> SRR2926022 1 0.0290 0.912 0.992 0.000 0.000 0.000 0.008
#> SRR2926024 1 0.0290 0.912 0.992 0.000 0.000 0.000 0.008
#> SRR2926021 1 0.3949 0.767 0.668 0.000 0.000 0.000 0.332
#> SRR2926020 1 0.0000 0.913 1.000 0.000 0.000 0.000 0.000
#> SRR2926019 1 0.0000 0.913 1.000 0.000 0.000 0.000 0.000
#> SRR2926018 1 0.0000 0.913 1.000 0.000 0.000 0.000 0.000
#> SRR2926017 1 0.3949 0.767 0.668 0.000 0.000 0.000 0.332
#> SRR2926016 4 0.3932 0.789 0.000 0.328 0.000 0.672 0.000
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> SRR2926066 3 0.0632 0.846 0.000 0.000 0.976 0.000 0.000 0.024
#> SRR2926067 6 0.1327 0.616 0.000 0.000 0.000 0.064 0.000 0.936
#> SRR2926063 3 0.3428 0.744 0.000 0.000 0.696 0.000 0.000 0.304
#> SRR2926064 4 0.1333 0.831 0.000 0.048 0.000 0.944 0.000 0.008
#> SRR2926062 6 0.5220 0.610 0.000 0.140 0.000 0.264 0.000 0.596
#> SRR2926061 6 0.4312 0.610 0.000 0.052 0.000 0.272 0.000 0.676
#> SRR2926065 4 0.1141 0.794 0.000 0.000 0.000 0.948 0.000 0.052
#> SRR2926060 4 0.1333 0.831 0.000 0.048 0.000 0.944 0.000 0.008
#> SRR2926059 6 0.0363 0.621 0.000 0.000 0.012 0.000 0.000 0.988
#> SRR2926058 6 0.3592 0.537 0.000 0.000 0.344 0.000 0.000 0.656
#> SRR2926056 3 0.0000 0.841 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2926057 6 0.3592 0.537 0.000 0.000 0.344 0.000 0.000 0.656
#> SRR2926055 4 0.3592 0.494 0.000 0.000 0.000 0.656 0.000 0.344
#> SRR2926054 3 0.3351 0.754 0.000 0.000 0.712 0.000 0.000 0.288
#> SRR2926051 3 0.0937 0.846 0.000 0.000 0.960 0.000 0.000 0.040
#> SRR2926052 3 0.0790 0.847 0.000 0.000 0.968 0.000 0.000 0.032
#> SRR2926053 3 0.3592 0.714 0.000 0.000 0.656 0.000 0.000 0.344
#> SRR2926050 3 0.1327 0.800 0.000 0.000 0.936 0.000 0.000 0.064
#> SRR2926049 2 0.0000 0.918 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2926047 6 0.4371 0.420 0.000 0.392 0.000 0.028 0.000 0.580
#> SRR2926046 3 0.0000 0.841 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2926048 2 0.0000 0.918 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2926044 6 0.4344 0.596 0.000 0.044 0.000 0.304 0.000 0.652
#> SRR2926045 3 0.3592 0.714 0.000 0.000 0.656 0.000 0.000 0.344
#> SRR2926041 2 0.0000 0.918 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2926042 6 0.5070 0.572 0.000 0.096 0.000 0.328 0.000 0.576
#> SRR2926040 2 0.0000 0.918 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2926039 4 0.1075 0.834 0.000 0.048 0.000 0.952 0.000 0.000
#> SRR2926043 4 0.1075 0.834 0.000 0.048 0.000 0.952 0.000 0.000
#> SRR2926038 4 0.3706 0.376 0.000 0.380 0.000 0.620 0.000 0.000
#> SRR2926036 2 0.0000 0.918 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2926037 2 0.4887 0.164 0.000 0.596 0.000 0.080 0.000 0.324
#> SRR2926035 2 0.0000 0.918 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2926034 4 0.3892 0.524 0.000 0.048 0.000 0.740 0.000 0.212
#> SRR2926032 6 0.4593 0.439 0.000 0.380 0.000 0.044 0.000 0.576
#> SRR2926031 5 0.3360 0.607 0.264 0.000 0.000 0.004 0.732 0.000
#> SRR2926033 6 0.1910 0.616 0.000 0.000 0.000 0.108 0.000 0.892
#> SRR2926030 1 0.0000 0.869 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2926029 3 0.0000 0.841 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2926027 1 0.3607 0.584 0.652 0.000 0.000 0.000 0.348 0.000
#> SRR2926028 5 0.1075 0.869 0.000 0.000 0.000 0.048 0.952 0.000
#> SRR2926026 1 0.0000 0.869 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2926025 1 0.0000 0.869 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2926023 1 0.0146 0.867 0.996 0.000 0.000 0.000 0.004 0.000
#> SRR2926022 1 0.3515 0.618 0.676 0.000 0.000 0.000 0.324 0.000
#> SRR2926024 1 0.3531 0.613 0.672 0.000 0.000 0.000 0.328 0.000
#> SRR2926021 5 0.0000 0.880 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR2926020 1 0.0000 0.869 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2926019 1 0.0000 0.869 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2926018 1 0.0000 0.869 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2926017 5 0.0000 0.880 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR2926016 4 0.1075 0.834 0.000 0.048 0.000 0.952 0.000 0.000
Heatmaps for the consensus matrix. It visualizes the probability of two samples to be in a same group.
consensus_heatmap(res, k = 2)
consensus_heatmap(res, k = 3)
consensus_heatmap(res, k = 4)
consensus_heatmap(res, k = 5)
consensus_heatmap(res, k = 6)
Heatmaps for the membership of samples in all partitions to see how consistent they are:
membership_heatmap(res, k = 2)
membership_heatmap(res, k = 3)
membership_heatmap(res, k = 4)
membership_heatmap(res, k = 5)
membership_heatmap(res, k = 6)
As soon as we have had the classes for columns, we can look for signatures which are significantly different between classes which can be candidate marks for certain classes. Following are the heatmaps for signatures.
Signature heatmaps where rows are scaled:
get_signatures(res, k = 2)
get_signatures(res, k = 3)
get_signatures(res, k = 4)
get_signatures(res, k = 5)
get_signatures(res, k = 6)
Signature heatmaps where rows are not scaled:
get_signatures(res, k = 2, scale_rows = FALSE)
get_signatures(res, k = 3, scale_rows = FALSE)
get_signatures(res, k = 4, scale_rows = FALSE)
get_signatures(res, k = 5, scale_rows = FALSE)
get_signatures(res, k = 6, scale_rows = FALSE)
Compare the overlap of signatures from different k:
compare_signatures(res)
get_signature()
returns a data frame invisibly. TO get the list of signatures, the function
call should be assigned to a variable explicitly. In following code, if plot
argument is set
to FALSE
, no heatmap is plotted while only the differential analysis is performed.
# code only for demonstration
tb = get_signature(res, k = ..., plot = FALSE)
An example of the output of tb
is:
#> which_row fdr mean_1 mean_2 scaled_mean_1 scaled_mean_2 km
#> 1 38 0.042760348 8.373488 9.131774 -0.5533452 0.5164555 1
#> 2 40 0.018707592 7.106213 8.469186 -0.6173731 0.5762149 1
#> 3 55 0.019134737 10.221463 11.207825 -0.6159697 0.5749050 1
#> 4 59 0.006059896 5.921854 7.869574 -0.6899429 0.6439467 1
#> 5 60 0.018055526 8.928898 10.211722 -0.6204761 0.5791110 1
#> 6 98 0.009384629 15.714769 14.887706 0.6635654 -0.6193277 2
...
The columns in tb
are:
which_row
: row indices corresponding to the input matrix.fdr
: FDR for the differential test. mean_x
: The mean value in group x.scaled_mean_x
: The mean value in group x after rows are scaled.km
: Row groups if k-means clustering is applied to rows.UMAP plot which shows how samples are separated.
dimension_reduction(res, k = 2, method = "UMAP")
dimension_reduction(res, k = 3, method = "UMAP")
dimension_reduction(res, k = 4, method = "UMAP")
dimension_reduction(res, k = 5, method = "UMAP")
dimension_reduction(res, k = 6, method = "UMAP")
Following heatmap shows how subgroups are split when increasing k
:
collect_classes(res)
If matrix rows can be associated to genes, consider to use functional_enrichment(res,
...)
to perform function enrichment for the signature genes. See this vignette for more detailed explanations.
The object with results only for a single top-value method and a single partition method can be extracted as:
res = res_list["MAD", "mclust"]
# you can also extract it by
# res = res_list["MAD:mclust"]
A summary of res
and all the functions that can be applied to it:
res
#> A 'ConsensusPartition' object with k = 2, 3, 4, 5, 6.
#> On a matrix with 18096 rows and 52 columns.
#> Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'MAD' method.
#> Subgroups are detected by 'mclust' method.
#> Performed in total 1250 partitions by row resampling.
#> Best k for subgroups seems to be 3.
#>
#> Following methods can be applied to this 'ConsensusPartition' object:
#> [1] "cola_report" "collect_classes" "collect_plots"
#> [4] "collect_stats" "colnames" "compare_signatures"
#> [7] "consensus_heatmap" "dimension_reduction" "functional_enrichment"
#> [10] "get_anno_col" "get_anno" "get_classes"
#> [13] "get_consensus" "get_matrix" "get_membership"
#> [16] "get_param" "get_signatures" "get_stats"
#> [19] "is_best_k" "is_stable_k" "membership_heatmap"
#> [22] "ncol" "nrow" "plot_ecdf"
#> [25] "rownames" "select_partition_number" "show"
#> [28] "suggest_best_k" "test_to_known_factors"
collect_plots()
function collects all the plots made from res
for all k
(number of partitions)
into one single page to provide an easy and fast comparison between different k
.
collect_plots(res)
The plots are:
k
and the heatmap of
predicted classes for each k
.k
.k
.k
.All the plots in panels can be made by individual functions and they are plotted later in this section.
select_partition_number()
produces several plots showing different
statistics for choosing “optimized” k
. There are following statistics:
k
;k
, the area increased is defined as \(A_k - A_{k-1}\).The detailed explanations of these statistics can be found in the cola vignette.
Generally speaking, lower PAC score, higher mean silhouette score or higher
concordance corresponds to better partition. Rand index and Jaccard index
measure how similar the current partition is compared to partition with k-1
.
If they are too similar, we won't accept k
is better than k-1
.
select_partition_number(res)
The numeric values for all these statistics can be obtained by get_stats()
.
get_stats(res)
#> k 1-PAC mean_silhouette concordance area_increased Rand Jaccard
#> 2 2 1.000 0.997 0.998 0.4032 0.599 0.599
#> 3 3 0.957 0.940 0.968 0.6146 0.755 0.591
#> 4 4 0.669 0.659 0.851 0.0975 0.962 0.896
#> 5 5 0.713 0.765 0.880 0.0890 0.856 0.594
#> 6 6 0.838 0.842 0.892 0.0729 0.912 0.636
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
#> SRR2926066 2 0.00 0.998 0.000 1.000
#> SRR2926067 2 0.00 0.998 0.000 1.000
#> SRR2926063 2 0.00 0.998 0.000 1.000
#> SRR2926064 2 0.00 0.998 0.000 1.000
#> SRR2926062 2 0.00 0.998 0.000 1.000
#> SRR2926061 2 0.00 0.998 0.000 1.000
#> SRR2926065 2 0.00 0.998 0.000 1.000
#> SRR2926060 2 0.00 0.998 0.000 1.000
#> SRR2926059 2 0.00 0.998 0.000 1.000
#> SRR2926058 2 0.00 0.998 0.000 1.000
#> SRR2926056 2 0.26 0.955 0.044 0.956
#> SRR2926057 2 0.00 0.998 0.000 1.000
#> SRR2926055 2 0.00 0.998 0.000 1.000
#> SRR2926054 2 0.00 0.998 0.000 1.000
#> SRR2926051 2 0.00 0.998 0.000 1.000
#> SRR2926052 2 0.00 0.998 0.000 1.000
#> SRR2926053 2 0.00 0.998 0.000 1.000
#> SRR2926050 2 0.00 0.998 0.000 1.000
#> SRR2926049 2 0.00 0.998 0.000 1.000
#> SRR2926047 2 0.00 0.998 0.000 1.000
#> SRR2926046 2 0.00 0.998 0.000 1.000
#> SRR2926048 2 0.00 0.998 0.000 1.000
#> SRR2926044 2 0.00 0.998 0.000 1.000
#> SRR2926045 2 0.00 0.998 0.000 1.000
#> SRR2926041 2 0.00 0.998 0.000 1.000
#> SRR2926042 2 0.00 0.998 0.000 1.000
#> SRR2926040 2 0.00 0.998 0.000 1.000
#> SRR2926039 2 0.00 0.998 0.000 1.000
#> SRR2926043 2 0.00 0.998 0.000 1.000
#> SRR2926038 2 0.00 0.998 0.000 1.000
#> SRR2926036 2 0.00 0.998 0.000 1.000
#> SRR2926037 2 0.00 0.998 0.000 1.000
#> SRR2926035 2 0.00 0.998 0.000 1.000
#> SRR2926034 2 0.00 0.998 0.000 1.000
#> SRR2926032 2 0.00 0.998 0.000 1.000
#> SRR2926031 1 0.00 1.000 1.000 0.000
#> SRR2926033 2 0.00 0.998 0.000 1.000
#> SRR2926030 1 0.00 1.000 1.000 0.000
#> SRR2926029 2 0.26 0.955 0.044 0.956
#> SRR2926027 1 0.00 1.000 1.000 0.000
#> SRR2926028 1 0.00 1.000 1.000 0.000
#> SRR2926026 1 0.00 1.000 1.000 0.000
#> SRR2926025 1 0.00 1.000 1.000 0.000
#> SRR2926023 1 0.00 1.000 1.000 0.000
#> SRR2926022 1 0.00 1.000 1.000 0.000
#> SRR2926024 1 0.00 1.000 1.000 0.000
#> SRR2926021 1 0.00 1.000 1.000 0.000
#> SRR2926020 1 0.00 1.000 1.000 0.000
#> SRR2926019 1 0.00 1.000 1.000 0.000
#> SRR2926018 1 0.00 1.000 1.000 0.000
#> SRR2926017 1 0.00 1.000 1.000 0.000
#> SRR2926016 2 0.00 0.998 0.000 1.000
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> SRR2926066 3 0.0592 0.977 0.000 0.012 0.988
#> SRR2926067 2 0.4654 0.770 0.000 0.792 0.208
#> SRR2926063 3 0.0592 0.977 0.000 0.012 0.988
#> SRR2926064 2 0.1411 0.944 0.000 0.964 0.036
#> SRR2926062 2 0.0000 0.948 0.000 1.000 0.000
#> SRR2926061 2 0.1411 0.944 0.000 0.964 0.036
#> SRR2926065 2 0.1411 0.944 0.000 0.964 0.036
#> SRR2926060 2 0.1411 0.944 0.000 0.964 0.036
#> SRR2926059 3 0.0592 0.977 0.000 0.012 0.988
#> SRR2926058 3 0.0592 0.977 0.000 0.012 0.988
#> SRR2926056 3 0.3755 0.862 0.120 0.008 0.872
#> SRR2926057 3 0.0592 0.977 0.000 0.012 0.988
#> SRR2926055 2 0.4654 0.770 0.000 0.792 0.208
#> SRR2926054 3 0.0592 0.977 0.000 0.012 0.988
#> SRR2926051 3 0.0592 0.977 0.000 0.012 0.988
#> SRR2926052 3 0.0592 0.977 0.000 0.012 0.988
#> SRR2926053 3 0.0592 0.977 0.000 0.012 0.988
#> SRR2926050 3 0.0592 0.977 0.000 0.012 0.988
#> SRR2926049 2 0.0000 0.948 0.000 1.000 0.000
#> SRR2926047 2 0.0000 0.948 0.000 1.000 0.000
#> SRR2926046 3 0.0592 0.977 0.000 0.012 0.988
#> SRR2926048 2 0.0000 0.948 0.000 1.000 0.000
#> SRR2926044 2 0.1411 0.944 0.000 0.964 0.036
#> SRR2926045 2 0.6308 0.122 0.000 0.508 0.492
#> SRR2926041 2 0.0000 0.948 0.000 1.000 0.000
#> SRR2926042 2 0.0000 0.948 0.000 1.000 0.000
#> SRR2926040 2 0.0000 0.948 0.000 1.000 0.000
#> SRR2926039 2 0.1411 0.944 0.000 0.964 0.036
#> SRR2926043 2 0.1411 0.944 0.000 0.964 0.036
#> SRR2926038 2 0.0000 0.948 0.000 1.000 0.000
#> SRR2926036 2 0.0000 0.948 0.000 1.000 0.000
#> SRR2926037 2 0.0000 0.948 0.000 1.000 0.000
#> SRR2926035 2 0.0000 0.948 0.000 1.000 0.000
#> SRR2926034 2 0.1411 0.944 0.000 0.964 0.036
#> SRR2926032 2 0.0000 0.948 0.000 1.000 0.000
#> SRR2926031 1 0.0592 0.992 0.988 0.000 0.012
#> SRR2926033 2 0.1411 0.944 0.000 0.964 0.036
#> SRR2926030 1 0.0592 0.992 0.988 0.000 0.012
#> SRR2926029 3 0.3644 0.848 0.124 0.004 0.872
#> SRR2926027 1 0.0000 0.998 1.000 0.000 0.000
#> SRR2926028 1 0.0592 0.992 0.988 0.000 0.012
#> SRR2926026 1 0.0000 0.998 1.000 0.000 0.000
#> SRR2926025 1 0.0000 0.998 1.000 0.000 0.000
#> SRR2926023 1 0.0000 0.998 1.000 0.000 0.000
#> SRR2926022 1 0.0000 0.998 1.000 0.000 0.000
#> SRR2926024 1 0.0000 0.998 1.000 0.000 0.000
#> SRR2926021 1 0.0000 0.998 1.000 0.000 0.000
#> SRR2926020 1 0.0000 0.998 1.000 0.000 0.000
#> SRR2926019 1 0.0000 0.998 1.000 0.000 0.000
#> SRR2926018 1 0.0000 0.998 1.000 0.000 0.000
#> SRR2926017 1 0.0000 0.998 1.000 0.000 0.000
#> SRR2926016 2 0.0592 0.940 0.000 0.988 0.012
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> SRR2926066 3 0.0000 0.8680 0.000 0.000 1.000 0.000
#> SRR2926067 2 0.7413 0.4715 0.000 0.516 0.232 0.252
#> SRR2926063 3 0.0000 0.8680 0.000 0.000 1.000 0.000
#> SRR2926064 2 0.2197 0.8062 0.000 0.916 0.080 0.004
#> SRR2926062 2 0.0000 0.8116 0.000 1.000 0.000 0.000
#> SRR2926061 2 0.6753 0.6121 0.000 0.608 0.164 0.228
#> SRR2926065 2 0.6327 0.6578 0.000 0.648 0.124 0.228
#> SRR2926060 2 0.2654 0.7956 0.000 0.888 0.108 0.004
#> SRR2926059 3 0.0921 0.8666 0.000 0.000 0.972 0.028
#> SRR2926058 3 0.0921 0.8666 0.000 0.000 0.972 0.028
#> SRR2926056 3 0.4916 0.3455 0.000 0.000 0.576 0.424
#> SRR2926057 3 0.0921 0.8666 0.000 0.000 0.972 0.028
#> SRR2926055 2 0.7640 0.3704 0.000 0.468 0.280 0.252
#> SRR2926054 3 0.0921 0.8666 0.000 0.000 0.972 0.028
#> SRR2926051 3 0.0000 0.8680 0.000 0.000 1.000 0.000
#> SRR2926052 3 0.0000 0.8680 0.000 0.000 1.000 0.000
#> SRR2926053 3 0.0921 0.8666 0.000 0.000 0.972 0.028
#> SRR2926050 3 0.0000 0.8680 0.000 0.000 1.000 0.000
#> SRR2926049 2 0.3356 0.7505 0.000 0.824 0.000 0.176
#> SRR2926047 2 0.0000 0.8116 0.000 1.000 0.000 0.000
#> SRR2926046 3 0.0707 0.8569 0.000 0.000 0.980 0.020
#> SRR2926048 2 0.1022 0.8074 0.000 0.968 0.000 0.032
#> SRR2926044 2 0.6635 0.6272 0.000 0.620 0.152 0.228
#> SRR2926045 3 0.7640 0.1360 0.000 0.280 0.468 0.252
#> SRR2926041 2 0.3400 0.7481 0.000 0.820 0.000 0.180
#> SRR2926042 2 0.0000 0.8116 0.000 1.000 0.000 0.000
#> SRR2926040 2 0.3400 0.7481 0.000 0.820 0.000 0.180
#> SRR2926039 2 0.2401 0.8029 0.000 0.904 0.092 0.004
#> SRR2926043 2 0.2466 0.8013 0.000 0.900 0.096 0.004
#> SRR2926038 2 0.3356 0.7505 0.000 0.824 0.000 0.176
#> SRR2926036 2 0.3356 0.7505 0.000 0.824 0.000 0.176
#> SRR2926037 2 0.0817 0.8090 0.000 0.976 0.000 0.024
#> SRR2926035 2 0.3688 0.7271 0.000 0.792 0.000 0.208
#> SRR2926034 2 0.2654 0.7956 0.000 0.888 0.108 0.004
#> SRR2926032 2 0.0000 0.8116 0.000 1.000 0.000 0.000
#> SRR2926031 1 0.4661 -0.1227 0.652 0.000 0.000 0.348
#> SRR2926033 2 0.6465 0.6454 0.000 0.636 0.136 0.228
#> SRR2926030 1 0.3311 0.5238 0.828 0.000 0.000 0.172
#> SRR2926029 3 0.4998 0.2076 0.000 0.000 0.512 0.488
#> SRR2926027 1 0.4522 0.0345 0.680 0.000 0.000 0.320
#> SRR2926028 4 0.4925 0.0000 0.428 0.000 0.000 0.572
#> SRR2926026 1 0.0000 0.7543 1.000 0.000 0.000 0.000
#> SRR2926025 1 0.0000 0.7543 1.000 0.000 0.000 0.000
#> SRR2926023 1 0.0000 0.7543 1.000 0.000 0.000 0.000
#> SRR2926022 1 0.0000 0.7543 1.000 0.000 0.000 0.000
#> SRR2926024 1 0.0000 0.7543 1.000 0.000 0.000 0.000
#> SRR2926021 1 0.4522 0.0345 0.680 0.000 0.000 0.320
#> SRR2926020 1 0.0000 0.7543 1.000 0.000 0.000 0.000
#> SRR2926019 1 0.0000 0.7543 1.000 0.000 0.000 0.000
#> SRR2926018 1 0.0000 0.7543 1.000 0.000 0.000 0.000
#> SRR2926017 1 0.4522 0.0345 0.680 0.000 0.000 0.320
#> SRR2926016 2 0.1302 0.8017 0.000 0.956 0.000 0.044
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> SRR2926066 3 0.0000 0.881 0.000 0.000 1.000 0.000 0.000
#> SRR2926067 4 0.4162 0.672 0.000 0.176 0.056 0.768 0.000
#> SRR2926063 3 0.0000 0.881 0.000 0.000 1.000 0.000 0.000
#> SRR2926064 4 0.0162 0.751 0.000 0.004 0.000 0.996 0.000
#> SRR2926062 4 0.3366 0.678 0.000 0.232 0.000 0.768 0.000
#> SRR2926061 4 0.4096 0.673 0.000 0.176 0.052 0.772 0.000
#> SRR2926065 4 0.2773 0.686 0.000 0.000 0.164 0.836 0.000
#> SRR2926060 4 0.0000 0.752 0.000 0.000 0.000 1.000 0.000
#> SRR2926059 3 0.5610 0.547 0.000 0.176 0.640 0.184 0.000
#> SRR2926058 3 0.1043 0.870 0.000 0.000 0.960 0.040 0.000
#> SRR2926056 5 0.4287 0.196 0.000 0.000 0.460 0.000 0.540
#> SRR2926057 3 0.0963 0.872 0.000 0.000 0.964 0.036 0.000
#> SRR2926055 4 0.4926 0.646 0.000 0.176 0.112 0.712 0.000
#> SRR2926054 3 0.1478 0.850 0.000 0.000 0.936 0.064 0.000
#> SRR2926051 3 0.0000 0.881 0.000 0.000 1.000 0.000 0.000
#> SRR2926052 3 0.0000 0.881 0.000 0.000 1.000 0.000 0.000
#> SRR2926053 3 0.5610 0.547 0.000 0.176 0.640 0.184 0.000
#> SRR2926050 3 0.0000 0.881 0.000 0.000 1.000 0.000 0.000
#> SRR2926049 2 0.0000 0.955 0.000 1.000 0.000 0.000 0.000
#> SRR2926047 4 0.3534 0.654 0.000 0.256 0.000 0.744 0.000
#> SRR2926046 3 0.0000 0.881 0.000 0.000 1.000 0.000 0.000
#> SRR2926048 4 0.3480 0.664 0.000 0.248 0.000 0.752 0.000
#> SRR2926044 4 0.4028 0.675 0.000 0.176 0.048 0.776 0.000
#> SRR2926045 4 0.5700 0.583 0.000 0.176 0.196 0.628 0.000
#> SRR2926041 2 0.0000 0.955 0.000 1.000 0.000 0.000 0.000
#> SRR2926042 4 0.3395 0.675 0.000 0.236 0.000 0.764 0.000
#> SRR2926040 2 0.0000 0.955 0.000 1.000 0.000 0.000 0.000
#> SRR2926039 4 0.0000 0.752 0.000 0.000 0.000 1.000 0.000
#> SRR2926043 4 0.0000 0.752 0.000 0.000 0.000 1.000 0.000
#> SRR2926038 4 0.3452 0.669 0.000 0.244 0.000 0.756 0.000
#> SRR2926036 2 0.0000 0.955 0.000 1.000 0.000 0.000 0.000
#> SRR2926037 2 0.2516 0.753 0.000 0.860 0.000 0.140 0.000
#> SRR2926035 2 0.0000 0.955 0.000 1.000 0.000 0.000 0.000
#> SRR2926034 4 0.0000 0.752 0.000 0.000 0.000 1.000 0.000
#> SRR2926032 4 0.3395 0.675 0.000 0.236 0.000 0.764 0.000
#> SRR2926031 5 0.3336 0.567 0.228 0.000 0.000 0.000 0.772
#> SRR2926033 4 0.4028 0.675 0.000 0.176 0.048 0.776 0.000
#> SRR2926030 5 0.3550 0.610 0.236 0.004 0.000 0.000 0.760
#> SRR2926029 5 0.0162 0.728 0.000 0.004 0.000 0.000 0.996
#> SRR2926027 1 0.2648 0.820 0.848 0.000 0.000 0.000 0.152
#> SRR2926028 5 0.0000 0.728 0.000 0.000 0.000 0.000 1.000
#> SRR2926026 1 0.0000 0.933 1.000 0.000 0.000 0.000 0.000
#> SRR2926025 1 0.0000 0.933 1.000 0.000 0.000 0.000 0.000
#> SRR2926023 1 0.0000 0.933 1.000 0.000 0.000 0.000 0.000
#> SRR2926022 1 0.0000 0.933 1.000 0.000 0.000 0.000 0.000
#> SRR2926024 1 0.0000 0.933 1.000 0.000 0.000 0.000 0.000
#> SRR2926021 1 0.3109 0.771 0.800 0.000 0.000 0.000 0.200
#> SRR2926020 1 0.0000 0.933 1.000 0.000 0.000 0.000 0.000
#> SRR2926019 1 0.0000 0.933 1.000 0.000 0.000 0.000 0.000
#> SRR2926018 1 0.0000 0.933 1.000 0.000 0.000 0.000 0.000
#> SRR2926017 1 0.3109 0.771 0.800 0.000 0.000 0.000 0.200
#> SRR2926016 4 0.7890 0.219 0.000 0.276 0.172 0.436 0.116
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> SRR2926066 3 0.3344 0.797 0.000 0.000 0.804 0.000 0.152 0.044
#> SRR2926067 6 0.0777 0.865 0.000 0.000 0.024 0.004 0.000 0.972
#> SRR2926063 3 0.0146 0.885 0.000 0.000 0.996 0.000 0.000 0.004
#> SRR2926064 4 0.0146 0.772 0.000 0.000 0.000 0.996 0.000 0.004
#> SRR2926062 4 0.2996 0.756 0.000 0.228 0.000 0.772 0.000 0.000
#> SRR2926061 6 0.2454 0.871 0.000 0.000 0.000 0.160 0.000 0.840
#> SRR2926065 4 0.0405 0.769 0.000 0.000 0.004 0.988 0.000 0.008
#> SRR2926060 4 0.0260 0.770 0.000 0.000 0.000 0.992 0.000 0.008
#> SRR2926059 3 0.3076 0.800 0.000 0.000 0.760 0.000 0.000 0.240
#> SRR2926058 3 0.2597 0.847 0.000 0.000 0.824 0.000 0.000 0.176
#> SRR2926056 5 0.2053 0.764 0.000 0.000 0.108 0.000 0.888 0.004
#> SRR2926057 3 0.1814 0.881 0.000 0.000 0.900 0.000 0.000 0.100
#> SRR2926055 6 0.0993 0.866 0.000 0.000 0.024 0.012 0.000 0.964
#> SRR2926054 3 0.1663 0.883 0.000 0.000 0.912 0.000 0.000 0.088
#> SRR2926051 3 0.0146 0.885 0.000 0.000 0.996 0.000 0.000 0.004
#> SRR2926052 3 0.3530 0.799 0.000 0.000 0.792 0.000 0.152 0.056
#> SRR2926053 3 0.3076 0.800 0.000 0.000 0.760 0.000 0.000 0.240
#> SRR2926050 3 0.0146 0.885 0.000 0.000 0.996 0.000 0.000 0.004
#> SRR2926049 2 0.0146 0.994 0.000 0.996 0.000 0.004 0.000 0.000
#> SRR2926047 4 0.3515 0.711 0.000 0.324 0.000 0.676 0.000 0.000
#> SRR2926046 3 0.0000 0.884 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2926048 4 0.3563 0.695 0.000 0.336 0.000 0.664 0.000 0.000
#> SRR2926044 6 0.2454 0.871 0.000 0.000 0.000 0.160 0.000 0.840
#> SRR2926045 6 0.1082 0.853 0.000 0.000 0.040 0.004 0.000 0.956
#> SRR2926041 2 0.0146 0.994 0.000 0.996 0.000 0.004 0.000 0.000
#> SRR2926042 4 0.3531 0.704 0.000 0.328 0.000 0.672 0.000 0.000
#> SRR2926040 2 0.0146 0.994 0.000 0.996 0.000 0.004 0.000 0.000
#> SRR2926039 4 0.0146 0.772 0.000 0.000 0.000 0.996 0.000 0.004
#> SRR2926043 4 0.0458 0.769 0.000 0.000 0.000 0.984 0.000 0.016
#> SRR2926038 4 0.3482 0.717 0.000 0.316 0.000 0.684 0.000 0.000
#> SRR2926036 2 0.0146 0.993 0.000 0.996 0.000 0.004 0.000 0.000
#> SRR2926037 2 0.0363 0.983 0.000 0.988 0.000 0.012 0.000 0.000
#> SRR2926035 2 0.0146 0.993 0.000 0.996 0.000 0.004 0.000 0.000
#> SRR2926034 4 0.0865 0.761 0.000 0.000 0.000 0.964 0.000 0.036
#> SRR2926032 4 0.3198 0.745 0.000 0.260 0.000 0.740 0.000 0.000
#> SRR2926031 5 0.0632 0.809 0.024 0.000 0.000 0.000 0.976 0.000
#> SRR2926033 6 0.2491 0.868 0.000 0.000 0.000 0.164 0.000 0.836
#> SRR2926030 5 0.2854 0.691 0.208 0.000 0.000 0.000 0.792 0.000
#> SRR2926029 5 0.0405 0.801 0.000 0.004 0.008 0.000 0.988 0.000
#> SRR2926027 5 0.3330 0.719 0.284 0.000 0.000 0.000 0.716 0.000
#> SRR2926028 5 0.0000 0.801 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR2926026 1 0.0000 0.993 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2926025 1 0.0000 0.993 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2926023 1 0.0000 0.993 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2926022 1 0.0000 0.993 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2926024 1 0.0937 0.947 0.960 0.000 0.000 0.000 0.040 0.000
#> SRR2926021 5 0.3288 0.725 0.276 0.000 0.000 0.000 0.724 0.000
#> SRR2926020 1 0.0000 0.993 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2926019 1 0.0000 0.993 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2926018 1 0.0000 0.993 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2926017 5 0.3330 0.719 0.284 0.000 0.000 0.000 0.716 0.000
#> SRR2926016 4 0.6193 0.449 0.000 0.344 0.012 0.472 0.164 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["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 18096 rows and 52 columns.
#> Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'MAD' method.
#> Subgroups are detected by 'NMF' method.
#> Performed in total 1250 partitions by row resampling.
#> Best k for subgroups seems to be 3.
#>
#> Following methods can be applied to this 'ConsensusPartition' object:
#> [1] "cola_report" "collect_classes" "collect_plots"
#> [4] "collect_stats" "colnames" "compare_signatures"
#> [7] "consensus_heatmap" "dimension_reduction" "functional_enrichment"
#> [10] "get_anno_col" "get_anno" "get_classes"
#> [13] "get_consensus" "get_matrix" "get_membership"
#> [16] "get_param" "get_signatures" "get_stats"
#> [19] "is_best_k" "is_stable_k" "membership_heatmap"
#> [22] "ncol" "nrow" "plot_ecdf"
#> [25] "rownames" "select_partition_number" "show"
#> [28] "suggest_best_k" "test_to_known_factors"
collect_plots()
function collects all the plots made from res
for all k
(number of partitions)
into one single page to provide an easy and fast comparison between different k
.
collect_plots(res)
The plots are:
k
and the heatmap of
predicted classes for each k
.k
.k
.k
.All the plots in panels can be made by individual functions and they are plotted later in this section.
select_partition_number()
produces several plots showing different
statistics for choosing “optimized” k
. There are following statistics:
k
;k
, the area increased is defined as \(A_k - A_{k-1}\).The detailed explanations of these statistics can be found in the cola vignette.
Generally speaking, lower PAC score, higher mean silhouette score or higher
concordance corresponds to better partition. Rand index and Jaccard index
measure how similar the current partition is compared to partition with k-1
.
If they are too similar, we won't accept k
is better than k-1
.
select_partition_number(res)
The numeric values for all these statistics can be obtained by get_stats()
.
get_stats(res)
#> k 1-PAC mean_silhouette concordance area_increased Rand Jaccard
#> 2 2 0.959 0.937 0.975 0.5054 0.493 0.493
#> 3 3 1.000 0.995 0.997 0.3205 0.750 0.535
#> 4 4 0.872 0.922 0.918 0.1090 0.894 0.687
#> 5 5 0.873 0.875 0.920 0.0596 0.962 0.845
#> 6 6 0.818 0.669 0.843 0.0427 0.958 0.804
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
#> SRR2926066 1 0.000 0.970 1.000 0.000
#> SRR2926067 2 0.000 0.975 0.000 1.000
#> SRR2926063 1 0.000 0.970 1.000 0.000
#> SRR2926064 2 0.000 0.975 0.000 1.000
#> SRR2926062 2 0.000 0.975 0.000 1.000
#> SRR2926061 2 0.000 0.975 0.000 1.000
#> SRR2926065 2 0.000 0.975 0.000 1.000
#> SRR2926060 2 0.000 0.975 0.000 1.000
#> SRR2926059 2 0.644 0.792 0.164 0.836
#> SRR2926058 2 0.981 0.251 0.420 0.580
#> SRR2926056 1 0.000 0.970 1.000 0.000
#> SRR2926057 1 0.963 0.356 0.612 0.388
#> SRR2926055 2 0.000 0.975 0.000 1.000
#> SRR2926054 1 0.775 0.695 0.772 0.228
#> SRR2926051 1 0.000 0.970 1.000 0.000
#> SRR2926052 1 0.204 0.942 0.968 0.032
#> SRR2926053 2 0.327 0.918 0.060 0.940
#> SRR2926050 1 0.000 0.970 1.000 0.000
#> SRR2926049 2 0.000 0.975 0.000 1.000
#> SRR2926047 2 0.000 0.975 0.000 1.000
#> SRR2926046 1 0.000 0.970 1.000 0.000
#> SRR2926048 2 0.000 0.975 0.000 1.000
#> SRR2926044 2 0.000 0.975 0.000 1.000
#> SRR2926045 2 0.000 0.975 0.000 1.000
#> SRR2926041 2 0.000 0.975 0.000 1.000
#> SRR2926042 2 0.000 0.975 0.000 1.000
#> SRR2926040 2 0.000 0.975 0.000 1.000
#> SRR2926039 2 0.000 0.975 0.000 1.000
#> SRR2926043 2 0.000 0.975 0.000 1.000
#> SRR2926038 2 0.000 0.975 0.000 1.000
#> SRR2926036 2 0.000 0.975 0.000 1.000
#> SRR2926037 2 0.000 0.975 0.000 1.000
#> SRR2926035 2 0.000 0.975 0.000 1.000
#> SRR2926034 2 0.000 0.975 0.000 1.000
#> SRR2926032 2 0.000 0.975 0.000 1.000
#> SRR2926031 1 0.000 0.970 1.000 0.000
#> SRR2926033 2 0.000 0.975 0.000 1.000
#> SRR2926030 1 0.000 0.970 1.000 0.000
#> SRR2926029 1 0.000 0.970 1.000 0.000
#> SRR2926027 1 0.000 0.970 1.000 0.000
#> SRR2926028 1 0.000 0.970 1.000 0.000
#> SRR2926026 1 0.000 0.970 1.000 0.000
#> SRR2926025 1 0.000 0.970 1.000 0.000
#> SRR2926023 1 0.000 0.970 1.000 0.000
#> SRR2926022 1 0.000 0.970 1.000 0.000
#> SRR2926024 1 0.000 0.970 1.000 0.000
#> SRR2926021 1 0.000 0.970 1.000 0.000
#> SRR2926020 1 0.000 0.970 1.000 0.000
#> SRR2926019 1 0.000 0.970 1.000 0.000
#> SRR2926018 1 0.000 0.970 1.000 0.000
#> SRR2926017 1 0.000 0.970 1.000 0.000
#> SRR2926016 2 0.000 0.975 0.000 1.000
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> SRR2926066 3 0.0000 0.998 0.000 0.000 1.000
#> SRR2926067 3 0.0000 0.998 0.000 0.000 1.000
#> SRR2926063 3 0.0000 0.998 0.000 0.000 1.000
#> SRR2926064 2 0.0000 0.995 0.000 1.000 0.000
#> SRR2926062 2 0.0000 0.995 0.000 1.000 0.000
#> SRR2926061 2 0.2796 0.899 0.000 0.908 0.092
#> SRR2926065 2 0.0000 0.995 0.000 1.000 0.000
#> SRR2926060 2 0.0000 0.995 0.000 1.000 0.000
#> SRR2926059 3 0.0000 0.998 0.000 0.000 1.000
#> SRR2926058 3 0.0000 0.998 0.000 0.000 1.000
#> SRR2926056 3 0.0000 0.998 0.000 0.000 1.000
#> SRR2926057 3 0.0000 0.998 0.000 0.000 1.000
#> SRR2926055 3 0.0000 0.998 0.000 0.000 1.000
#> SRR2926054 3 0.0000 0.998 0.000 0.000 1.000
#> SRR2926051 3 0.0000 0.998 0.000 0.000 1.000
#> SRR2926052 3 0.0000 0.998 0.000 0.000 1.000
#> SRR2926053 3 0.0000 0.998 0.000 0.000 1.000
#> SRR2926050 3 0.0000 0.998 0.000 0.000 1.000
#> SRR2926049 2 0.0000 0.995 0.000 1.000 0.000
#> SRR2926047 2 0.0000 0.995 0.000 1.000 0.000
#> SRR2926046 3 0.0000 0.998 0.000 0.000 1.000
#> SRR2926048 2 0.0000 0.995 0.000 1.000 0.000
#> SRR2926044 2 0.0000 0.995 0.000 1.000 0.000
#> SRR2926045 3 0.0000 0.998 0.000 0.000 1.000
#> SRR2926041 2 0.0000 0.995 0.000 1.000 0.000
#> SRR2926042 2 0.0000 0.995 0.000 1.000 0.000
#> SRR2926040 2 0.0000 0.995 0.000 1.000 0.000
#> SRR2926039 2 0.0000 0.995 0.000 1.000 0.000
#> SRR2926043 2 0.0000 0.995 0.000 1.000 0.000
#> SRR2926038 2 0.0000 0.995 0.000 1.000 0.000
#> SRR2926036 2 0.0000 0.995 0.000 1.000 0.000
#> SRR2926037 2 0.0000 0.995 0.000 1.000 0.000
#> SRR2926035 2 0.0000 0.995 0.000 1.000 0.000
#> SRR2926034 2 0.0000 0.995 0.000 1.000 0.000
#> SRR2926032 2 0.0000 0.995 0.000 1.000 0.000
#> SRR2926031 1 0.0000 1.000 1.000 0.000 0.000
#> SRR2926033 2 0.0424 0.988 0.000 0.992 0.008
#> SRR2926030 1 0.0000 1.000 1.000 0.000 0.000
#> SRR2926029 3 0.1411 0.963 0.036 0.000 0.964
#> SRR2926027 1 0.0000 1.000 1.000 0.000 0.000
#> SRR2926028 1 0.0000 1.000 1.000 0.000 0.000
#> SRR2926026 1 0.0000 1.000 1.000 0.000 0.000
#> SRR2926025 1 0.0000 1.000 1.000 0.000 0.000
#> SRR2926023 1 0.0000 1.000 1.000 0.000 0.000
#> SRR2926022 1 0.0000 1.000 1.000 0.000 0.000
#> SRR2926024 1 0.0000 1.000 1.000 0.000 0.000
#> SRR2926021 1 0.0000 1.000 1.000 0.000 0.000
#> SRR2926020 1 0.0000 1.000 1.000 0.000 0.000
#> SRR2926019 1 0.0000 1.000 1.000 0.000 0.000
#> SRR2926018 1 0.0000 1.000 1.000 0.000 0.000
#> SRR2926017 1 0.0000 1.000 1.000 0.000 0.000
#> SRR2926016 2 0.0000 0.995 0.000 1.000 0.000
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> SRR2926066 3 0.0921 0.969 0.000 0.000 0.972 0.028
#> SRR2926067 3 0.1388 0.952 0.000 0.028 0.960 0.012
#> SRR2926063 3 0.0000 0.979 0.000 0.000 1.000 0.000
#> SRR2926064 4 0.4999 0.591 0.000 0.492 0.000 0.508
#> SRR2926062 4 0.4998 0.614 0.000 0.488 0.000 0.512
#> SRR2926061 2 0.0779 0.965 0.000 0.980 0.016 0.004
#> SRR2926065 4 0.3907 0.817 0.000 0.232 0.000 0.768
#> SRR2926060 4 0.4454 0.821 0.000 0.308 0.000 0.692
#> SRR2926059 3 0.0336 0.978 0.000 0.000 0.992 0.008
#> SRR2926058 3 0.0188 0.979 0.000 0.000 0.996 0.004
#> SRR2926056 3 0.0000 0.979 0.000 0.000 1.000 0.000
#> SRR2926057 3 0.0188 0.979 0.000 0.000 0.996 0.004
#> SRR2926055 4 0.4468 0.543 0.000 0.016 0.232 0.752
#> SRR2926054 3 0.0188 0.979 0.000 0.000 0.996 0.004
#> SRR2926051 3 0.0921 0.970 0.000 0.000 0.972 0.028
#> SRR2926052 3 0.1118 0.963 0.000 0.000 0.964 0.036
#> SRR2926053 3 0.0188 0.978 0.000 0.000 0.996 0.004
#> SRR2926050 3 0.0188 0.979 0.000 0.000 0.996 0.004
#> SRR2926049 2 0.0000 0.990 0.000 1.000 0.000 0.000
#> SRR2926047 2 0.0469 0.977 0.000 0.988 0.000 0.012
#> SRR2926046 3 0.0000 0.979 0.000 0.000 1.000 0.000
#> SRR2926048 2 0.0000 0.990 0.000 1.000 0.000 0.000
#> SRR2926044 2 0.0188 0.986 0.000 0.996 0.000 0.004
#> SRR2926045 3 0.0188 0.979 0.000 0.000 0.996 0.004
#> SRR2926041 2 0.0000 0.990 0.000 1.000 0.000 0.000
#> SRR2926042 2 0.0000 0.990 0.000 1.000 0.000 0.000
#> SRR2926040 2 0.0000 0.990 0.000 1.000 0.000 0.000
#> SRR2926039 4 0.4008 0.821 0.000 0.244 0.000 0.756
#> SRR2926043 4 0.4697 0.797 0.000 0.356 0.000 0.644
#> SRR2926038 4 0.4830 0.766 0.000 0.392 0.000 0.608
#> SRR2926036 2 0.0000 0.990 0.000 1.000 0.000 0.000
#> SRR2926037 2 0.0000 0.990 0.000 1.000 0.000 0.000
#> SRR2926035 2 0.0000 0.990 0.000 1.000 0.000 0.000
#> SRR2926034 4 0.4331 0.826 0.000 0.288 0.000 0.712
#> SRR2926032 2 0.0000 0.990 0.000 1.000 0.000 0.000
#> SRR2926031 1 0.3219 0.887 0.836 0.000 0.000 0.164
#> SRR2926033 2 0.1677 0.932 0.000 0.948 0.012 0.040
#> SRR2926030 1 0.0000 0.967 1.000 0.000 0.000 0.000
#> SRR2926029 3 0.3711 0.840 0.024 0.000 0.836 0.140
#> SRR2926027 1 0.0000 0.967 1.000 0.000 0.000 0.000
#> SRR2926028 1 0.3311 0.880 0.828 0.000 0.000 0.172
#> SRR2926026 1 0.0000 0.967 1.000 0.000 0.000 0.000
#> SRR2926025 1 0.0000 0.967 1.000 0.000 0.000 0.000
#> SRR2926023 1 0.0000 0.967 1.000 0.000 0.000 0.000
#> SRR2926022 1 0.0000 0.967 1.000 0.000 0.000 0.000
#> SRR2926024 1 0.0000 0.967 1.000 0.000 0.000 0.000
#> SRR2926021 1 0.3123 0.890 0.844 0.000 0.000 0.156
#> SRR2926020 1 0.0188 0.965 0.996 0.000 0.000 0.004
#> SRR2926019 1 0.0188 0.965 0.996 0.000 0.000 0.004
#> SRR2926018 1 0.0000 0.967 1.000 0.000 0.000 0.000
#> SRR2926017 1 0.1474 0.947 0.948 0.000 0.000 0.052
#> SRR2926016 4 0.3837 0.808 0.000 0.224 0.000 0.776
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> SRR2926066 3 0.1522 0.924 0.000 0.000 0.944 0.044 0.012
#> SRR2926067 3 0.3809 0.764 0.000 0.020 0.804 0.160 0.016
#> SRR2926063 3 0.0451 0.934 0.000 0.000 0.988 0.004 0.008
#> SRR2926064 4 0.5161 0.327 0.000 0.444 0.000 0.516 0.040
#> SRR2926062 4 0.3957 0.723 0.000 0.280 0.000 0.712 0.008
#> SRR2926061 2 0.1885 0.918 0.000 0.936 0.012 0.020 0.032
#> SRR2926065 4 0.1281 0.846 0.000 0.032 0.000 0.956 0.012
#> SRR2926060 4 0.1628 0.856 0.000 0.056 0.000 0.936 0.008
#> SRR2926059 3 0.1568 0.931 0.000 0.000 0.944 0.020 0.036
#> SRR2926058 3 0.1800 0.927 0.000 0.000 0.932 0.020 0.048
#> SRR2926056 3 0.0703 0.936 0.000 0.000 0.976 0.000 0.024
#> SRR2926057 3 0.1568 0.931 0.000 0.000 0.944 0.020 0.036
#> SRR2926055 4 0.2374 0.811 0.000 0.016 0.052 0.912 0.020
#> SRR2926054 3 0.1012 0.937 0.000 0.000 0.968 0.020 0.012
#> SRR2926051 3 0.1648 0.921 0.000 0.000 0.940 0.020 0.040
#> SRR2926052 3 0.1661 0.937 0.000 0.000 0.940 0.036 0.024
#> SRR2926053 3 0.1877 0.907 0.000 0.000 0.924 0.064 0.012
#> SRR2926050 3 0.1399 0.933 0.000 0.000 0.952 0.020 0.028
#> SRR2926049 2 0.0404 0.962 0.000 0.988 0.000 0.012 0.000
#> SRR2926047 2 0.0000 0.968 0.000 1.000 0.000 0.000 0.000
#> SRR2926046 3 0.0290 0.934 0.000 0.000 0.992 0.000 0.008
#> SRR2926048 2 0.0000 0.968 0.000 1.000 0.000 0.000 0.000
#> SRR2926044 2 0.0932 0.948 0.000 0.972 0.004 0.020 0.004
#> SRR2926045 3 0.1831 0.913 0.000 0.000 0.920 0.076 0.004
#> SRR2926041 2 0.0000 0.968 0.000 1.000 0.000 0.000 0.000
#> SRR2926042 2 0.0609 0.956 0.000 0.980 0.000 0.020 0.000
#> SRR2926040 2 0.0000 0.968 0.000 1.000 0.000 0.000 0.000
#> SRR2926039 4 0.1341 0.860 0.000 0.056 0.000 0.944 0.000
#> SRR2926043 4 0.2424 0.845 0.000 0.132 0.000 0.868 0.000
#> SRR2926038 4 0.2929 0.818 0.000 0.180 0.000 0.820 0.000
#> SRR2926036 2 0.0000 0.968 0.000 1.000 0.000 0.000 0.000
#> SRR2926037 2 0.0000 0.968 0.000 1.000 0.000 0.000 0.000
#> SRR2926035 2 0.0000 0.968 0.000 1.000 0.000 0.000 0.000
#> SRR2926034 4 0.1697 0.862 0.000 0.060 0.000 0.932 0.008
#> SRR2926032 2 0.0290 0.965 0.000 0.992 0.000 0.008 0.000
#> SRR2926031 5 0.3805 0.746 0.184 0.000 0.000 0.032 0.784
#> SRR2926033 2 0.4572 0.736 0.000 0.780 0.032 0.128 0.060
#> SRR2926030 1 0.0290 0.953 0.992 0.000 0.000 0.000 0.008
#> SRR2926029 5 0.4210 0.210 0.000 0.000 0.412 0.000 0.588
#> SRR2926027 1 0.1121 0.932 0.956 0.000 0.000 0.000 0.044
#> SRR2926028 5 0.3039 0.751 0.192 0.000 0.000 0.000 0.808
#> SRR2926026 1 0.0000 0.956 1.000 0.000 0.000 0.000 0.000
#> SRR2926025 1 0.0510 0.952 0.984 0.000 0.000 0.000 0.016
#> SRR2926023 1 0.0404 0.953 0.988 0.000 0.000 0.000 0.012
#> SRR2926022 1 0.1043 0.935 0.960 0.000 0.000 0.000 0.040
#> SRR2926024 1 0.0000 0.956 1.000 0.000 0.000 0.000 0.000
#> SRR2926021 5 0.3779 0.720 0.236 0.000 0.012 0.000 0.752
#> SRR2926020 1 0.0794 0.946 0.972 0.000 0.000 0.000 0.028
#> SRR2926019 1 0.0794 0.946 0.972 0.000 0.000 0.000 0.028
#> SRR2926018 1 0.0000 0.956 1.000 0.000 0.000 0.000 0.000
#> SRR2926017 1 0.4057 0.712 0.784 0.000 0.020 0.020 0.176
#> SRR2926016 4 0.1809 0.861 0.000 0.060 0.000 0.928 0.012
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> SRR2926066 3 0.3404 0.2704 0.000 0.000 0.760 0.016 0.000 0.224
#> SRR2926067 3 0.3130 0.4649 0.000 0.000 0.828 0.124 0.000 0.048
#> SRR2926063 3 0.0713 0.5533 0.000 0.000 0.972 0.000 0.000 0.028
#> SRR2926064 4 0.5962 0.3750 0.000 0.228 0.000 0.424 0.000 0.348
#> SRR2926062 4 0.4242 0.3523 0.000 0.412 0.004 0.572 0.000 0.012
#> SRR2926061 2 0.4289 0.3287 0.000 0.540 0.012 0.004 0.000 0.444
#> SRR2926065 4 0.1802 0.7696 0.000 0.000 0.012 0.916 0.000 0.072
#> SRR2926060 4 0.1838 0.7778 0.000 0.012 0.020 0.928 0.000 0.040
#> SRR2926059 6 0.3828 0.8286 0.000 0.000 0.440 0.000 0.000 0.560
#> SRR2926058 6 0.3592 0.7522 0.000 0.000 0.344 0.000 0.000 0.656
#> SRR2926056 3 0.3221 0.1746 0.000 0.000 0.736 0.000 0.000 0.264
#> SRR2926057 6 0.3854 0.7959 0.000 0.000 0.464 0.000 0.000 0.536
#> SRR2926055 4 0.4145 0.5288 0.000 0.000 0.252 0.700 0.000 0.048
#> SRR2926054 3 0.2491 0.4332 0.000 0.000 0.836 0.000 0.000 0.164
#> SRR2926051 3 0.1718 0.5574 0.000 0.000 0.932 0.016 0.008 0.044
#> SRR2926052 3 0.3864 -0.6941 0.000 0.000 0.520 0.000 0.000 0.480
#> SRR2926053 3 0.0622 0.5642 0.000 0.000 0.980 0.008 0.000 0.012
#> SRR2926050 3 0.3867 -0.7528 0.000 0.000 0.512 0.000 0.000 0.488
#> SRR2926049 2 0.0000 0.9381 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2926047 2 0.0547 0.9360 0.000 0.980 0.000 0.000 0.000 0.020
#> SRR2926046 3 0.2340 0.4519 0.000 0.000 0.852 0.000 0.000 0.148
#> SRR2926048 2 0.0806 0.9325 0.000 0.972 0.000 0.008 0.000 0.020
#> SRR2926044 2 0.1327 0.9029 0.000 0.936 0.000 0.000 0.000 0.064
#> SRR2926045 3 0.1334 0.5606 0.000 0.000 0.948 0.020 0.000 0.032
#> SRR2926041 2 0.0260 0.9376 0.000 0.992 0.000 0.000 0.000 0.008
#> SRR2926042 2 0.0820 0.9320 0.000 0.972 0.000 0.016 0.000 0.012
#> SRR2926040 2 0.0000 0.9381 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2926039 4 0.0653 0.7782 0.000 0.004 0.004 0.980 0.000 0.012
#> SRR2926043 4 0.3276 0.7324 0.000 0.132 0.000 0.816 0.000 0.052
#> SRR2926038 4 0.2218 0.7647 0.000 0.104 0.000 0.884 0.000 0.012
#> SRR2926036 2 0.0146 0.9369 0.000 0.996 0.004 0.000 0.000 0.000
#> SRR2926037 2 0.0260 0.9372 0.000 0.992 0.000 0.000 0.000 0.008
#> SRR2926035 2 0.0000 0.9381 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2926034 4 0.0820 0.7790 0.000 0.016 0.000 0.972 0.000 0.012
#> SRR2926032 2 0.1341 0.9145 0.000 0.948 0.000 0.028 0.000 0.024
#> SRR2926031 5 0.3156 0.7193 0.020 0.000 0.000 0.000 0.800 0.180
#> SRR2926033 3 0.5283 0.2075 0.000 0.328 0.592 0.020 0.008 0.052
#> SRR2926030 1 0.0000 0.9601 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2926029 5 0.4731 0.0714 0.000 0.000 0.428 0.000 0.524 0.048
#> SRR2926027 1 0.0865 0.9373 0.964 0.000 0.000 0.000 0.036 0.000
#> SRR2926028 5 0.0692 0.7677 0.020 0.000 0.000 0.000 0.976 0.004
#> SRR2926026 1 0.0000 0.9601 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2926025 1 0.0000 0.9601 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2926023 1 0.0000 0.9601 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2926022 1 0.0458 0.9514 0.984 0.000 0.000 0.000 0.016 0.000
#> SRR2926024 1 0.0000 0.9601 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2926021 5 0.0713 0.7672 0.028 0.000 0.000 0.000 0.972 0.000
#> SRR2926020 1 0.0146 0.9584 0.996 0.000 0.000 0.000 0.004 0.000
#> SRR2926019 1 0.0146 0.9584 0.996 0.000 0.000 0.000 0.004 0.000
#> SRR2926018 1 0.0000 0.9601 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2926017 1 0.5579 0.5405 0.644 0.000 0.044 0.000 0.144 0.168
#> SRR2926016 4 0.1152 0.7713 0.000 0.004 0.000 0.952 0.000 0.044
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 18096 rows and 52 columns.
#> Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'ATC' method.
#> Subgroups are detected by 'hclust' method.
#> Performed in total 1250 partitions by row resampling.
#> Best k for subgroups seems to be 2.
#>
#> Following methods can be applied to this 'ConsensusPartition' object:
#> [1] "cola_report" "collect_classes" "collect_plots"
#> [4] "collect_stats" "colnames" "compare_signatures"
#> [7] "consensus_heatmap" "dimension_reduction" "functional_enrichment"
#> [10] "get_anno_col" "get_anno" "get_classes"
#> [13] "get_consensus" "get_matrix" "get_membership"
#> [16] "get_param" "get_signatures" "get_stats"
#> [19] "is_best_k" "is_stable_k" "membership_heatmap"
#> [22] "ncol" "nrow" "plot_ecdf"
#> [25] "rownames" "select_partition_number" "show"
#> [28] "suggest_best_k" "test_to_known_factors"
collect_plots()
function collects all the plots made from res
for all k
(number of partitions)
into one single page to provide an easy and fast comparison between different k
.
collect_plots(res)
The plots are:
k
and the heatmap of
predicted classes for each k
.k
.k
.k
.All the plots in panels can be made by individual functions and they are plotted later in this section.
select_partition_number()
produces several plots showing different
statistics for choosing “optimized” k
. There are following statistics:
k
;k
, the area increased is defined as \(A_k - A_{k-1}\).The detailed explanations of these statistics can be found in the cola vignette.
Generally speaking, lower PAC score, higher mean silhouette score or higher
concordance corresponds to better partition. Rand index and Jaccard index
measure how similar the current partition is compared to partition with k-1
.
If they are too similar, we won't accept k
is better than k-1
.
select_partition_number(res)
The numeric values for all these statistics can be obtained by get_stats()
.
get_stats(res)
#> k 1-PAC mean_silhouette concordance area_increased Rand Jaccard
#> 2 2 0.694 0.930 0.957 0.4973 0.493 0.493
#> 3 3 0.706 0.842 0.837 0.2863 0.853 0.702
#> 4 4 0.814 0.896 0.915 0.0793 0.968 0.908
#> 5 5 0.756 0.812 0.873 0.0686 0.980 0.938
#> 6 6 0.854 0.867 0.906 0.0823 0.893 0.639
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
#> SRR2926066 1 0.494 0.892 0.892 0.108
#> SRR2926067 2 0.204 0.965 0.032 0.968
#> SRR2926063 1 0.615 0.873 0.848 0.152
#> SRR2926064 2 0.000 0.992 0.000 1.000
#> SRR2926062 2 0.000 0.992 0.000 1.000
#> SRR2926061 2 0.000 0.992 0.000 1.000
#> SRR2926065 2 0.242 0.957 0.040 0.960
#> SRR2926060 2 0.000 0.992 0.000 1.000
#> SRR2926059 1 0.644 0.862 0.836 0.164
#> SRR2926058 1 0.605 0.875 0.852 0.148
#> SRR2926056 1 0.000 0.920 1.000 0.000
#> SRR2926057 1 0.615 0.873 0.848 0.152
#> SRR2926055 2 0.204 0.965 0.032 0.968
#> SRR2926054 1 0.615 0.873 0.848 0.152
#> SRR2926051 1 0.615 0.873 0.848 0.152
#> SRR2926052 1 0.595 0.877 0.856 0.144
#> SRR2926053 1 0.802 0.766 0.756 0.244
#> SRR2926050 1 0.494 0.892 0.892 0.108
#> SRR2926049 2 0.000 0.992 0.000 1.000
#> SRR2926047 2 0.000 0.992 0.000 1.000
#> SRR2926046 1 0.615 0.873 0.848 0.152
#> SRR2926048 2 0.000 0.992 0.000 1.000
#> SRR2926044 2 0.000 0.992 0.000 1.000
#> SRR2926045 1 0.973 0.460 0.596 0.404
#> SRR2926041 2 0.000 0.992 0.000 1.000
#> SRR2926042 2 0.000 0.992 0.000 1.000
#> SRR2926040 2 0.000 0.992 0.000 1.000
#> SRR2926039 2 0.000 0.992 0.000 1.000
#> SRR2926043 2 0.000 0.992 0.000 1.000
#> SRR2926038 2 0.000 0.992 0.000 1.000
#> SRR2926036 2 0.000 0.992 0.000 1.000
#> SRR2926037 2 0.000 0.992 0.000 1.000
#> SRR2926035 2 0.000 0.992 0.000 1.000
#> SRR2926034 2 0.000 0.992 0.000 1.000
#> SRR2926032 2 0.000 0.992 0.000 1.000
#> SRR2926031 1 0.000 0.920 1.000 0.000
#> SRR2926033 2 0.000 0.992 0.000 1.000
#> SRR2926030 1 0.000 0.920 1.000 0.000
#> SRR2926029 1 0.000 0.920 1.000 0.000
#> SRR2926027 1 0.000 0.920 1.000 0.000
#> SRR2926028 1 0.000 0.920 1.000 0.000
#> SRR2926026 1 0.000 0.920 1.000 0.000
#> SRR2926025 1 0.000 0.920 1.000 0.000
#> SRR2926023 1 0.000 0.920 1.000 0.000
#> SRR2926022 1 0.000 0.920 1.000 0.000
#> SRR2926024 1 0.000 0.920 1.000 0.000
#> SRR2926021 1 0.000 0.920 1.000 0.000
#> SRR2926020 1 0.000 0.920 1.000 0.000
#> SRR2926019 1 0.000 0.920 1.000 0.000
#> SRR2926018 1 0.000 0.920 1.000 0.000
#> SRR2926017 1 0.000 0.920 1.000 0.000
#> SRR2926016 2 0.358 0.925 0.068 0.932
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> SRR2926066 3 0.1643 0.859 0.044 0.000 0.956
#> SRR2926067 2 0.4291 0.853 0.000 0.820 0.180
#> SRR2926063 3 0.0000 0.884 0.000 0.000 1.000
#> SRR2926064 2 0.1289 0.946 0.000 0.968 0.032
#> SRR2926062 2 0.1289 0.946 0.000 0.968 0.032
#> SRR2926061 2 0.1411 0.945 0.000 0.964 0.036
#> SRR2926065 2 0.4399 0.845 0.000 0.812 0.188
#> SRR2926060 2 0.1964 0.937 0.000 0.944 0.056
#> SRR2926059 3 0.0592 0.875 0.000 0.012 0.988
#> SRR2926058 3 0.0237 0.884 0.004 0.000 0.996
#> SRR2926056 3 0.4452 0.676 0.192 0.000 0.808
#> SRR2926057 3 0.0000 0.884 0.000 0.000 1.000
#> SRR2926055 2 0.4291 0.853 0.000 0.820 0.180
#> SRR2926054 3 0.0000 0.884 0.000 0.000 1.000
#> SRR2926051 3 0.0000 0.884 0.000 0.000 1.000
#> SRR2926052 3 0.0424 0.883 0.008 0.000 0.992
#> SRR2926053 3 0.2796 0.781 0.000 0.092 0.908
#> SRR2926050 3 0.1643 0.859 0.044 0.000 0.956
#> SRR2926049 2 0.0000 0.943 0.000 1.000 0.000
#> SRR2926047 2 0.0000 0.943 0.000 1.000 0.000
#> SRR2926046 3 0.0000 0.884 0.000 0.000 1.000
#> SRR2926048 2 0.0000 0.943 0.000 1.000 0.000
#> SRR2926044 2 0.3752 0.883 0.000 0.856 0.144
#> SRR2926045 3 0.5138 0.556 0.000 0.252 0.748
#> SRR2926041 2 0.0000 0.943 0.000 1.000 0.000
#> SRR2926042 2 0.1289 0.946 0.000 0.968 0.032
#> SRR2926040 2 0.0000 0.943 0.000 1.000 0.000
#> SRR2926039 2 0.0747 0.945 0.000 0.984 0.016
#> SRR2926043 2 0.1289 0.946 0.000 0.968 0.032
#> SRR2926038 2 0.0000 0.943 0.000 1.000 0.000
#> SRR2926036 2 0.0000 0.943 0.000 1.000 0.000
#> SRR2926037 2 0.0000 0.943 0.000 1.000 0.000
#> SRR2926035 2 0.0000 0.943 0.000 1.000 0.000
#> SRR2926034 2 0.1643 0.943 0.000 0.956 0.044
#> SRR2926032 2 0.1289 0.946 0.000 0.968 0.032
#> SRR2926031 1 0.0000 0.752 1.000 0.000 0.000
#> SRR2926033 2 0.3816 0.880 0.000 0.852 0.148
#> SRR2926030 1 0.5905 0.703 0.648 0.000 0.352
#> SRR2926029 3 0.4452 0.676 0.192 0.000 0.808
#> SRR2926027 1 0.0000 0.752 1.000 0.000 0.000
#> SRR2926028 3 0.4452 0.676 0.192 0.000 0.808
#> SRR2926026 1 0.5859 0.715 0.656 0.000 0.344
#> SRR2926025 1 0.5859 0.715 0.656 0.000 0.344
#> SRR2926023 1 0.5859 0.715 0.656 0.000 0.344
#> SRR2926022 1 0.0000 0.752 1.000 0.000 0.000
#> SRR2926024 1 0.0000 0.752 1.000 0.000 0.000
#> SRR2926021 1 0.0000 0.752 1.000 0.000 0.000
#> SRR2926020 1 0.5859 0.715 0.656 0.000 0.344
#> SRR2926019 1 0.5859 0.715 0.656 0.000 0.344
#> SRR2926018 1 0.5859 0.715 0.656 0.000 0.344
#> SRR2926017 1 0.0000 0.752 1.000 0.000 0.000
#> SRR2926016 2 0.4796 0.809 0.000 0.780 0.220
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> SRR2926066 3 0.1488 0.860 0.032 0.000 0.956 0.012
#> SRR2926067 2 0.3852 0.835 0.012 0.808 0.180 0.000
#> SRR2926063 3 0.0000 0.875 0.000 0.000 1.000 0.000
#> SRR2926064 2 0.1022 0.930 0.000 0.968 0.032 0.000
#> SRR2926062 2 0.1022 0.930 0.000 0.968 0.032 0.000
#> SRR2926061 2 0.1584 0.929 0.012 0.952 0.036 0.000
#> SRR2926065 2 0.3937 0.827 0.012 0.800 0.188 0.000
#> SRR2926060 2 0.1557 0.923 0.000 0.944 0.056 0.000
#> SRR2926059 3 0.0524 0.870 0.004 0.008 0.988 0.000
#> SRR2926058 3 0.0188 0.876 0.004 0.000 0.996 0.000
#> SRR2926056 3 0.5732 0.625 0.264 0.000 0.672 0.064
#> SRR2926057 3 0.1118 0.870 0.000 0.000 0.964 0.036
#> SRR2926055 2 0.3852 0.835 0.012 0.808 0.180 0.000
#> SRR2926054 3 0.0000 0.875 0.000 0.000 1.000 0.000
#> SRR2926051 3 0.0000 0.875 0.000 0.000 1.000 0.000
#> SRR2926052 3 0.0336 0.875 0.008 0.000 0.992 0.000
#> SRR2926053 3 0.2473 0.803 0.012 0.080 0.908 0.000
#> SRR2926050 3 0.1488 0.860 0.032 0.000 0.956 0.012
#> SRR2926049 2 0.0921 0.923 0.028 0.972 0.000 0.000
#> SRR2926047 2 0.0921 0.923 0.028 0.972 0.000 0.000
#> SRR2926046 3 0.1118 0.870 0.000 0.000 0.964 0.036
#> SRR2926048 2 0.0921 0.923 0.028 0.972 0.000 0.000
#> SRR2926044 2 0.3428 0.865 0.012 0.844 0.144 0.000
#> SRR2926045 3 0.4420 0.597 0.012 0.240 0.748 0.000
#> SRR2926041 2 0.0921 0.923 0.028 0.972 0.000 0.000
#> SRR2926042 2 0.1022 0.930 0.000 0.968 0.032 0.000
#> SRR2926040 2 0.0921 0.923 0.028 0.972 0.000 0.000
#> SRR2926039 2 0.0779 0.929 0.004 0.980 0.016 0.000
#> SRR2926043 2 0.1022 0.930 0.000 0.968 0.032 0.000
#> SRR2926038 2 0.0921 0.923 0.028 0.972 0.000 0.000
#> SRR2926036 2 0.0921 0.923 0.028 0.972 0.000 0.000
#> SRR2926037 2 0.0817 0.924 0.024 0.976 0.000 0.000
#> SRR2926035 2 0.0921 0.923 0.028 0.972 0.000 0.000
#> SRR2926034 2 0.1635 0.926 0.008 0.948 0.044 0.000
#> SRR2926032 2 0.1209 0.930 0.004 0.964 0.032 0.000
#> SRR2926031 4 0.1474 1.000 0.052 0.000 0.000 0.948
#> SRR2926033 2 0.3479 0.862 0.012 0.840 0.148 0.000
#> SRR2926030 1 0.2149 0.990 0.912 0.000 0.088 0.000
#> SRR2926029 3 0.5759 0.622 0.268 0.000 0.668 0.064
#> SRR2926027 4 0.1474 1.000 0.052 0.000 0.000 0.948
#> SRR2926028 3 0.5720 0.593 0.296 0.000 0.652 0.052
#> SRR2926026 1 0.2412 0.998 0.908 0.000 0.084 0.008
#> SRR2926025 1 0.2412 0.998 0.908 0.000 0.084 0.008
#> SRR2926023 1 0.2412 0.998 0.908 0.000 0.084 0.008
#> SRR2926022 4 0.1474 1.000 0.052 0.000 0.000 0.948
#> SRR2926024 4 0.1474 1.000 0.052 0.000 0.000 0.948
#> SRR2926021 4 0.1474 1.000 0.052 0.000 0.000 0.948
#> SRR2926020 1 0.2412 0.998 0.908 0.000 0.084 0.008
#> SRR2926019 1 0.2412 0.998 0.908 0.000 0.084 0.008
#> SRR2926018 1 0.2412 0.998 0.908 0.000 0.084 0.008
#> SRR2926017 4 0.1474 1.000 0.052 0.000 0.000 0.948
#> SRR2926016 2 0.4248 0.790 0.012 0.768 0.220 0.000
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> SRR2926066 3 0.1413 0.831 0.012 0.000 0.956 0.020 0.012
#> SRR2926067 2 0.4872 0.690 0.000 0.720 0.160 0.120 0.000
#> SRR2926063 3 0.0000 0.861 0.000 0.000 1.000 0.000 0.000
#> SRR2926064 2 0.0609 0.830 0.000 0.980 0.020 0.000 0.000
#> SRR2926062 2 0.0609 0.830 0.000 0.980 0.020 0.000 0.000
#> SRR2926061 2 0.3327 0.806 0.000 0.828 0.028 0.144 0.000
#> SRR2926065 2 0.4946 0.681 0.000 0.712 0.168 0.120 0.000
#> SRR2926060 2 0.1907 0.818 0.000 0.928 0.044 0.028 0.000
#> SRR2926059 3 0.0451 0.855 0.000 0.004 0.988 0.008 0.000
#> SRR2926058 3 0.0162 0.861 0.000 0.000 0.996 0.004 0.000
#> SRR2926056 3 0.6150 -0.504 0.100 0.000 0.524 0.364 0.012
#> SRR2926057 3 0.0963 0.840 0.000 0.000 0.964 0.036 0.000
#> SRR2926055 2 0.4872 0.690 0.000 0.720 0.160 0.120 0.000
#> SRR2926054 3 0.0000 0.861 0.000 0.000 1.000 0.000 0.000
#> SRR2926051 3 0.0000 0.861 0.000 0.000 1.000 0.000 0.000
#> SRR2926052 3 0.0290 0.860 0.000 0.000 0.992 0.008 0.000
#> SRR2926053 3 0.2378 0.755 0.000 0.048 0.904 0.048 0.000
#> SRR2926050 3 0.1413 0.831 0.012 0.000 0.956 0.020 0.012
#> SRR2926049 2 0.3109 0.791 0.000 0.800 0.000 0.200 0.000
#> SRR2926047 2 0.3109 0.791 0.000 0.800 0.000 0.200 0.000
#> SRR2926046 3 0.0963 0.840 0.000 0.000 0.964 0.036 0.000
#> SRR2926048 2 0.3109 0.791 0.000 0.800 0.000 0.200 0.000
#> SRR2926044 2 0.4503 0.725 0.000 0.756 0.124 0.120 0.000
#> SRR2926045 3 0.4624 0.490 0.000 0.144 0.744 0.112 0.000
#> SRR2926041 2 0.3109 0.791 0.000 0.800 0.000 0.200 0.000
#> SRR2926042 2 0.0609 0.830 0.000 0.980 0.020 0.000 0.000
#> SRR2926040 2 0.3109 0.791 0.000 0.800 0.000 0.200 0.000
#> SRR2926039 2 0.0955 0.828 0.000 0.968 0.004 0.028 0.000
#> SRR2926043 2 0.0609 0.830 0.000 0.980 0.020 0.000 0.000
#> SRR2926038 2 0.2280 0.812 0.000 0.880 0.000 0.120 0.000
#> SRR2926036 2 0.3109 0.791 0.000 0.800 0.000 0.200 0.000
#> SRR2926037 2 0.3039 0.793 0.000 0.808 0.000 0.192 0.000
#> SRR2926035 2 0.3109 0.791 0.000 0.800 0.000 0.200 0.000
#> SRR2926034 2 0.1668 0.823 0.000 0.940 0.032 0.028 0.000
#> SRR2926032 2 0.0898 0.831 0.000 0.972 0.020 0.008 0.000
#> SRR2926031 5 0.0000 1.000 0.000 0.000 0.000 0.000 1.000
#> SRR2926033 2 0.4593 0.719 0.000 0.748 0.128 0.124 0.000
#> SRR2926030 1 0.0000 0.989 1.000 0.000 0.000 0.000 0.000
#> SRR2926029 4 0.6213 0.597 0.100 0.000 0.400 0.488 0.012
#> SRR2926027 5 0.0000 1.000 0.000 0.000 0.000 0.000 1.000
#> SRR2926028 4 0.5233 0.695 0.128 0.000 0.192 0.680 0.000
#> SRR2926026 1 0.0290 0.998 0.992 0.000 0.000 0.000 0.008
#> SRR2926025 1 0.0290 0.998 0.992 0.000 0.000 0.000 0.008
#> SRR2926023 1 0.0290 0.998 0.992 0.000 0.000 0.000 0.008
#> SRR2926022 5 0.0000 1.000 0.000 0.000 0.000 0.000 1.000
#> SRR2926024 5 0.0000 1.000 0.000 0.000 0.000 0.000 1.000
#> SRR2926021 5 0.0000 1.000 0.000 0.000 0.000 0.000 1.000
#> SRR2926020 1 0.0290 0.998 0.992 0.000 0.000 0.000 0.008
#> SRR2926019 1 0.0290 0.998 0.992 0.000 0.000 0.000 0.008
#> SRR2926018 1 0.0290 0.998 0.992 0.000 0.000 0.000 0.008
#> SRR2926017 5 0.0000 1.000 0.000 0.000 0.000 0.000 1.000
#> SRR2926016 2 0.5210 0.640 0.000 0.680 0.200 0.120 0.000
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> SRR2926066 3 0.0972 0.888 0.000 0.000 0.964 0.000 0.008 0.028
#> SRR2926067 4 0.0865 0.757 0.000 0.000 0.036 0.964 0.000 0.000
#> SRR2926063 3 0.0260 0.910 0.000 0.000 0.992 0.008 0.000 0.000
#> SRR2926064 4 0.3101 0.802 0.000 0.244 0.000 0.756 0.000 0.000
#> SRR2926062 4 0.3101 0.802 0.000 0.244 0.000 0.756 0.000 0.000
#> SRR2926061 4 0.2697 0.787 0.000 0.188 0.000 0.812 0.000 0.000
#> SRR2926065 4 0.1007 0.748 0.000 0.000 0.044 0.956 0.000 0.000
#> SRR2926060 4 0.2730 0.813 0.000 0.192 0.000 0.808 0.000 0.000
#> SRR2926059 3 0.0713 0.900 0.000 0.000 0.972 0.028 0.000 0.000
#> SRR2926058 3 0.0146 0.910 0.000 0.000 0.996 0.004 0.000 0.000
#> SRR2926056 6 0.3993 0.490 0.000 0.000 0.400 0.000 0.008 0.592
#> SRR2926057 3 0.1124 0.890 0.000 0.000 0.956 0.008 0.000 0.036
#> SRR2926055 4 0.0865 0.757 0.000 0.000 0.036 0.964 0.000 0.000
#> SRR2926054 3 0.0260 0.910 0.000 0.000 0.992 0.008 0.000 0.000
#> SRR2926051 3 0.0260 0.910 0.000 0.000 0.992 0.008 0.000 0.000
#> SRR2926052 3 0.0291 0.909 0.000 0.000 0.992 0.004 0.000 0.004
#> SRR2926053 3 0.1957 0.798 0.000 0.000 0.888 0.112 0.000 0.000
#> SRR2926050 3 0.0972 0.888 0.000 0.000 0.964 0.000 0.008 0.028
#> SRR2926049 2 0.1444 0.997 0.000 0.928 0.000 0.072 0.000 0.000
#> SRR2926047 2 0.1444 0.997 0.000 0.928 0.000 0.072 0.000 0.000
#> SRR2926046 3 0.1124 0.890 0.000 0.000 0.956 0.008 0.000 0.036
#> SRR2926048 2 0.1556 0.989 0.000 0.920 0.000 0.080 0.000 0.000
#> SRR2926044 4 0.0935 0.782 0.000 0.032 0.004 0.964 0.000 0.000
#> SRR2926045 3 0.3634 0.363 0.000 0.000 0.644 0.356 0.000 0.000
#> SRR2926041 2 0.1444 0.997 0.000 0.928 0.000 0.072 0.000 0.000
#> SRR2926042 4 0.3101 0.802 0.000 0.244 0.000 0.756 0.000 0.000
#> SRR2926040 2 0.1444 0.997 0.000 0.928 0.000 0.072 0.000 0.000
#> SRR2926039 4 0.3351 0.755 0.000 0.288 0.000 0.712 0.000 0.000
#> SRR2926043 4 0.3101 0.802 0.000 0.244 0.000 0.756 0.000 0.000
#> SRR2926038 4 0.3782 0.529 0.000 0.412 0.000 0.588 0.000 0.000
#> SRR2926036 2 0.1444 0.997 0.000 0.928 0.000 0.072 0.000 0.000
#> SRR2926037 2 0.1556 0.988 0.000 0.920 0.000 0.080 0.000 0.000
#> SRR2926035 2 0.1444 0.997 0.000 0.928 0.000 0.072 0.000 0.000
#> SRR2926034 4 0.2933 0.813 0.000 0.200 0.004 0.796 0.000 0.000
#> SRR2926032 4 0.3151 0.796 0.000 0.252 0.000 0.748 0.000 0.000
#> SRR2926031 5 0.0000 1.000 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR2926033 4 0.0777 0.779 0.000 0.024 0.004 0.972 0.000 0.000
#> SRR2926030 1 0.0000 0.991 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2926029 6 0.3349 0.695 0.000 0.000 0.244 0.000 0.008 0.748
#> SRR2926027 5 0.0000 1.000 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR2926028 6 0.1082 0.550 0.000 0.040 0.000 0.004 0.000 0.956
#> SRR2926026 1 0.0260 0.998 0.992 0.000 0.000 0.000 0.008 0.000
#> SRR2926025 1 0.0260 0.998 0.992 0.000 0.000 0.000 0.008 0.000
#> SRR2926023 1 0.0260 0.998 0.992 0.000 0.000 0.000 0.008 0.000
#> SRR2926022 5 0.0000 1.000 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR2926024 5 0.0000 1.000 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR2926021 5 0.0000 1.000 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR2926020 1 0.0260 0.998 0.992 0.000 0.000 0.000 0.008 0.000
#> SRR2926019 1 0.0260 0.998 0.992 0.000 0.000 0.000 0.008 0.000
#> SRR2926018 1 0.0260 0.998 0.992 0.000 0.000 0.000 0.008 0.000
#> SRR2926017 5 0.0000 1.000 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR2926016 4 0.1789 0.715 0.000 0.032 0.044 0.924 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", "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 18096 rows and 52 columns.
#> Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'ATC' method.
#> Subgroups are detected by 'kmeans' method.
#> Performed in total 1250 partitions by row resampling.
#> Best k for subgroups seems to be 3.
#>
#> Following methods can be applied to this 'ConsensusPartition' object:
#> [1] "cola_report" "collect_classes" "collect_plots"
#> [4] "collect_stats" "colnames" "compare_signatures"
#> [7] "consensus_heatmap" "dimension_reduction" "functional_enrichment"
#> [10] "get_anno_col" "get_anno" "get_classes"
#> [13] "get_consensus" "get_matrix" "get_membership"
#> [16] "get_param" "get_signatures" "get_stats"
#> [19] "is_best_k" "is_stable_k" "membership_heatmap"
#> [22] "ncol" "nrow" "plot_ecdf"
#> [25] "rownames" "select_partition_number" "show"
#> [28] "suggest_best_k" "test_to_known_factors"
collect_plots()
function collects all the plots made from res
for all k
(number of partitions)
into one single page to provide an easy and fast comparison between different k
.
collect_plots(res)
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.987 0.995 0.5079 0.493 0.493
#> 3 3 1.000 0.977 0.988 0.2737 0.811 0.635
#> 4 4 0.786 0.512 0.732 0.1136 0.905 0.731
#> 5 5 0.712 0.689 0.810 0.0774 0.882 0.616
#> 6 6 0.754 0.710 0.752 0.0399 0.909 0.655
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
#> SRR2926066 1 0.0000 1.000 1.000 0.000
#> SRR2926067 2 0.0000 0.990 0.000 1.000
#> SRR2926063 1 0.0000 1.000 1.000 0.000
#> SRR2926064 2 0.0000 0.990 0.000 1.000
#> SRR2926062 2 0.0000 0.990 0.000 1.000
#> SRR2926061 2 0.0000 0.990 0.000 1.000
#> SRR2926065 2 0.0000 0.990 0.000 1.000
#> SRR2926060 2 0.0000 0.990 0.000 1.000
#> SRR2926059 2 0.8443 0.627 0.272 0.728
#> SRR2926058 1 0.0000 1.000 1.000 0.000
#> SRR2926056 1 0.0000 1.000 1.000 0.000
#> SRR2926057 1 0.0000 1.000 1.000 0.000
#> SRR2926055 2 0.0000 0.990 0.000 1.000
#> SRR2926054 2 0.0376 0.986 0.004 0.996
#> SRR2926051 1 0.0000 1.000 1.000 0.000
#> SRR2926052 1 0.0000 1.000 1.000 0.000
#> SRR2926053 2 0.0000 0.990 0.000 1.000
#> SRR2926050 1 0.0000 1.000 1.000 0.000
#> SRR2926049 2 0.0000 0.990 0.000 1.000
#> SRR2926047 2 0.0000 0.990 0.000 1.000
#> SRR2926046 1 0.0000 1.000 1.000 0.000
#> SRR2926048 2 0.0000 0.990 0.000 1.000
#> SRR2926044 2 0.0000 0.990 0.000 1.000
#> SRR2926045 2 0.0000 0.990 0.000 1.000
#> SRR2926041 2 0.0000 0.990 0.000 1.000
#> SRR2926042 2 0.0000 0.990 0.000 1.000
#> SRR2926040 2 0.0000 0.990 0.000 1.000
#> SRR2926039 2 0.0000 0.990 0.000 1.000
#> SRR2926043 2 0.0000 0.990 0.000 1.000
#> SRR2926038 2 0.0000 0.990 0.000 1.000
#> SRR2926036 2 0.0000 0.990 0.000 1.000
#> SRR2926037 2 0.0000 0.990 0.000 1.000
#> SRR2926035 2 0.0000 0.990 0.000 1.000
#> SRR2926034 2 0.0000 0.990 0.000 1.000
#> SRR2926032 2 0.0000 0.990 0.000 1.000
#> SRR2926031 1 0.0000 1.000 1.000 0.000
#> SRR2926033 2 0.0000 0.990 0.000 1.000
#> SRR2926030 1 0.0000 1.000 1.000 0.000
#> SRR2926029 1 0.0000 1.000 1.000 0.000
#> SRR2926027 1 0.0000 1.000 1.000 0.000
#> SRR2926028 1 0.0000 1.000 1.000 0.000
#> SRR2926026 1 0.0000 1.000 1.000 0.000
#> SRR2926025 1 0.0000 1.000 1.000 0.000
#> SRR2926023 1 0.0000 1.000 1.000 0.000
#> SRR2926022 1 0.0000 1.000 1.000 0.000
#> SRR2926024 1 0.0000 1.000 1.000 0.000
#> SRR2926021 1 0.0000 1.000 1.000 0.000
#> SRR2926020 1 0.0000 1.000 1.000 0.000
#> SRR2926019 1 0.0000 1.000 1.000 0.000
#> SRR2926018 1 0.0000 1.000 1.000 0.000
#> SRR2926017 1 0.0000 1.000 1.000 0.000
#> SRR2926016 2 0.0000 0.990 0.000 1.000
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> SRR2926066 3 0.0000 0.962 0.000 0.000 1.000
#> SRR2926067 2 0.0000 0.996 0.000 1.000 0.000
#> SRR2926063 3 0.0000 0.962 0.000 0.000 1.000
#> SRR2926064 2 0.0000 0.996 0.000 1.000 0.000
#> SRR2926062 2 0.0000 0.996 0.000 1.000 0.000
#> SRR2926061 2 0.0000 0.996 0.000 1.000 0.000
#> SRR2926065 2 0.0237 0.993 0.000 0.996 0.004
#> SRR2926060 2 0.0000 0.996 0.000 1.000 0.000
#> SRR2926059 3 0.0000 0.962 0.000 0.000 1.000
#> SRR2926058 3 0.0000 0.962 0.000 0.000 1.000
#> SRR2926056 3 0.4504 0.789 0.196 0.000 0.804
#> SRR2926057 3 0.0000 0.962 0.000 0.000 1.000
#> SRR2926055 2 0.0000 0.996 0.000 1.000 0.000
#> SRR2926054 3 0.0000 0.962 0.000 0.000 1.000
#> SRR2926051 3 0.0000 0.962 0.000 0.000 1.000
#> SRR2926052 3 0.0000 0.962 0.000 0.000 1.000
#> SRR2926053 3 0.0000 0.962 0.000 0.000 1.000
#> SRR2926050 3 0.0000 0.962 0.000 0.000 1.000
#> SRR2926049 2 0.0000 0.996 0.000 1.000 0.000
#> SRR2926047 2 0.0000 0.996 0.000 1.000 0.000
#> SRR2926046 3 0.0000 0.962 0.000 0.000 1.000
#> SRR2926048 2 0.0000 0.996 0.000 1.000 0.000
#> SRR2926044 2 0.0000 0.996 0.000 1.000 0.000
#> SRR2926045 2 0.0747 0.983 0.000 0.984 0.016
#> SRR2926041 2 0.0000 0.996 0.000 1.000 0.000
#> SRR2926042 2 0.0000 0.996 0.000 1.000 0.000
#> SRR2926040 2 0.0000 0.996 0.000 1.000 0.000
#> SRR2926039 2 0.0000 0.996 0.000 1.000 0.000
#> SRR2926043 2 0.0000 0.996 0.000 1.000 0.000
#> SRR2926038 2 0.0000 0.996 0.000 1.000 0.000
#> SRR2926036 2 0.0000 0.996 0.000 1.000 0.000
#> SRR2926037 2 0.0000 0.996 0.000 1.000 0.000
#> SRR2926035 2 0.0000 0.996 0.000 1.000 0.000
#> SRR2926034 2 0.0000 0.996 0.000 1.000 0.000
#> SRR2926032 2 0.0000 0.996 0.000 1.000 0.000
#> SRR2926031 1 0.0000 0.998 1.000 0.000 0.000
#> SRR2926033 2 0.0000 0.996 0.000 1.000 0.000
#> SRR2926030 1 0.1031 0.974 0.976 0.000 0.024
#> SRR2926029 3 0.3116 0.881 0.108 0.000 0.892
#> SRR2926027 1 0.0000 0.998 1.000 0.000 0.000
#> SRR2926028 3 0.4291 0.808 0.180 0.000 0.820
#> SRR2926026 1 0.0000 0.998 1.000 0.000 0.000
#> SRR2926025 1 0.0000 0.998 1.000 0.000 0.000
#> SRR2926023 1 0.0000 0.998 1.000 0.000 0.000
#> SRR2926022 1 0.0000 0.998 1.000 0.000 0.000
#> SRR2926024 1 0.0000 0.998 1.000 0.000 0.000
#> SRR2926021 1 0.0000 0.998 1.000 0.000 0.000
#> SRR2926020 1 0.0000 0.998 1.000 0.000 0.000
#> SRR2926019 1 0.0000 0.998 1.000 0.000 0.000
#> SRR2926018 1 0.0000 0.998 1.000 0.000 0.000
#> SRR2926017 1 0.0000 0.998 1.000 0.000 0.000
#> SRR2926016 2 0.2356 0.926 0.000 0.928 0.072
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> SRR2926066 3 0.0707 0.911 0.000 0.000 0.980 0.020
#> SRR2926067 4 0.5143 0.817 0.000 0.456 0.004 0.540
#> SRR2926063 3 0.0000 0.915 0.000 0.000 1.000 0.000
#> SRR2926064 2 0.4998 -0.708 0.000 0.512 0.000 0.488
#> SRR2926062 2 0.4998 -0.708 0.000 0.512 0.000 0.488
#> SRR2926061 2 0.4998 -0.708 0.000 0.512 0.000 0.488
#> SRR2926065 4 0.5888 0.828 0.000 0.424 0.036 0.540
#> SRR2926060 2 0.4998 -0.708 0.000 0.512 0.000 0.488
#> SRR2926059 3 0.1474 0.899 0.000 0.000 0.948 0.052
#> SRR2926058 3 0.0336 0.914 0.000 0.000 0.992 0.008
#> SRR2926056 3 0.6167 0.683 0.124 0.000 0.668 0.208
#> SRR2926057 3 0.0707 0.914 0.000 0.000 0.980 0.020
#> SRR2926055 4 0.5570 0.833 0.000 0.440 0.020 0.540
#> SRR2926054 3 0.1474 0.899 0.000 0.000 0.948 0.052
#> SRR2926051 3 0.0188 0.915 0.000 0.000 0.996 0.004
#> SRR2926052 3 0.0000 0.915 0.000 0.000 1.000 0.000
#> SRR2926053 3 0.1474 0.899 0.000 0.000 0.948 0.052
#> SRR2926050 3 0.0592 0.912 0.000 0.000 0.984 0.016
#> SRR2926049 2 0.0000 0.474 0.000 1.000 0.000 0.000
#> SRR2926047 2 0.0336 0.469 0.000 0.992 0.000 0.008
#> SRR2926046 3 0.0592 0.915 0.000 0.000 0.984 0.016
#> SRR2926048 2 0.0000 0.474 0.000 1.000 0.000 0.000
#> SRR2926044 2 0.4998 -0.708 0.000 0.512 0.000 0.488
#> SRR2926045 4 0.6714 0.676 0.000 0.360 0.100 0.540
#> SRR2926041 2 0.0000 0.474 0.000 1.000 0.000 0.000
#> SRR2926042 2 0.4998 -0.708 0.000 0.512 0.000 0.488
#> SRR2926040 2 0.0000 0.474 0.000 1.000 0.000 0.000
#> SRR2926039 2 0.4998 -0.708 0.000 0.512 0.000 0.488
#> SRR2926043 2 0.4998 -0.708 0.000 0.512 0.000 0.488
#> SRR2926038 2 0.1867 0.410 0.000 0.928 0.000 0.072
#> SRR2926036 2 0.0000 0.474 0.000 1.000 0.000 0.000
#> SRR2926037 2 0.0000 0.474 0.000 1.000 0.000 0.000
#> SRR2926035 2 0.0000 0.474 0.000 1.000 0.000 0.000
#> SRR2926034 4 0.5000 0.725 0.000 0.496 0.000 0.504
#> SRR2926032 2 0.4998 -0.708 0.000 0.512 0.000 0.488
#> SRR2926031 1 0.3801 0.884 0.780 0.000 0.000 0.220
#> SRR2926033 4 0.5000 0.725 0.000 0.496 0.000 0.504
#> SRR2926030 1 0.4956 0.684 0.732 0.000 0.036 0.232
#> SRR2926029 3 0.5623 0.707 0.048 0.000 0.660 0.292
#> SRR2926027 1 0.3764 0.885 0.784 0.000 0.000 0.216
#> SRR2926028 3 0.6538 0.628 0.108 0.000 0.600 0.292
#> SRR2926026 1 0.0000 0.892 1.000 0.000 0.000 0.000
#> SRR2926025 1 0.0000 0.892 1.000 0.000 0.000 0.000
#> SRR2926023 1 0.0000 0.892 1.000 0.000 0.000 0.000
#> SRR2926022 1 0.3801 0.884 0.780 0.000 0.000 0.220
#> SRR2926024 1 0.3801 0.884 0.780 0.000 0.000 0.220
#> SRR2926021 1 0.3764 0.885 0.784 0.000 0.000 0.216
#> SRR2926020 1 0.0000 0.892 1.000 0.000 0.000 0.000
#> SRR2926019 1 0.0000 0.892 1.000 0.000 0.000 0.000
#> SRR2926018 1 0.0000 0.892 1.000 0.000 0.000 0.000
#> SRR2926017 1 0.3764 0.885 0.784 0.000 0.000 0.216
#> SRR2926016 4 0.6087 0.808 0.000 0.412 0.048 0.540
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> SRR2926066 3 0.0404 0.794 0.000 0.012 0.988 0.000 0.000
#> SRR2926067 4 0.4583 0.686 0.000 0.032 0.000 0.672 0.296
#> SRR2926063 3 0.0510 0.795 0.000 0.000 0.984 0.000 0.016
#> SRR2926064 4 0.0162 0.814 0.000 0.004 0.000 0.996 0.000
#> SRR2926062 4 0.0162 0.814 0.000 0.004 0.000 0.996 0.000
#> SRR2926061 4 0.2249 0.804 0.000 0.008 0.000 0.896 0.096
#> SRR2926065 4 0.4790 0.676 0.000 0.032 0.008 0.676 0.284
#> SRR2926060 4 0.1638 0.813 0.000 0.004 0.000 0.932 0.064
#> SRR2926059 3 0.3885 0.697 0.000 0.040 0.784 0.000 0.176
#> SRR2926058 3 0.1331 0.788 0.000 0.008 0.952 0.000 0.040
#> SRR2926056 3 0.6706 0.451 0.112 0.096 0.612 0.000 0.180
#> SRR2926057 3 0.0324 0.796 0.000 0.004 0.992 0.000 0.004
#> SRR2926055 4 0.4763 0.653 0.000 0.032 0.000 0.632 0.336
#> SRR2926054 3 0.4404 0.630 0.000 0.032 0.704 0.000 0.264
#> SRR2926051 3 0.1168 0.791 0.000 0.008 0.960 0.000 0.032
#> SRR2926052 3 0.0290 0.795 0.000 0.008 0.992 0.000 0.000
#> SRR2926053 3 0.4848 0.575 0.000 0.032 0.644 0.004 0.320
#> SRR2926050 3 0.0404 0.794 0.000 0.012 0.988 0.000 0.000
#> SRR2926049 2 0.3274 0.869 0.000 0.780 0.000 0.220 0.000
#> SRR2926047 2 0.4902 0.683 0.000 0.508 0.000 0.468 0.024
#> SRR2926046 3 0.0671 0.795 0.000 0.004 0.980 0.000 0.016
#> SRR2926048 2 0.4787 0.737 0.000 0.548 0.000 0.432 0.020
#> SRR2926044 4 0.2179 0.804 0.000 0.004 0.000 0.896 0.100
#> SRR2926045 4 0.5819 0.602 0.000 0.032 0.048 0.584 0.336
#> SRR2926041 2 0.3274 0.869 0.000 0.780 0.000 0.220 0.000
#> SRR2926042 4 0.0162 0.814 0.000 0.004 0.000 0.996 0.000
#> SRR2926040 2 0.3274 0.869 0.000 0.780 0.000 0.220 0.000
#> SRR2926039 4 0.0162 0.814 0.000 0.004 0.000 0.996 0.000
#> SRR2926043 4 0.0162 0.814 0.000 0.004 0.000 0.996 0.000
#> SRR2926038 2 0.4747 0.633 0.000 0.496 0.000 0.488 0.016
#> SRR2926036 2 0.3852 0.866 0.000 0.760 0.000 0.220 0.020
#> SRR2926037 2 0.4249 0.838 0.000 0.688 0.000 0.296 0.016
#> SRR2926035 2 0.3274 0.869 0.000 0.780 0.000 0.220 0.000
#> SRR2926034 4 0.0671 0.817 0.000 0.004 0.000 0.980 0.016
#> SRR2926032 4 0.0162 0.814 0.000 0.004 0.000 0.996 0.000
#> SRR2926031 1 0.0290 0.655 0.992 0.000 0.000 0.000 0.008
#> SRR2926033 4 0.2563 0.799 0.000 0.008 0.000 0.872 0.120
#> SRR2926030 5 0.5610 0.000 0.284 0.040 0.040 0.000 0.636
#> SRR2926029 3 0.7595 0.229 0.080 0.172 0.456 0.000 0.292
#> SRR2926027 1 0.0162 0.658 0.996 0.000 0.000 0.000 0.004
#> SRR2926028 3 0.7851 0.154 0.108 0.168 0.428 0.000 0.296
#> SRR2926026 1 0.3949 0.558 0.668 0.000 0.000 0.000 0.332
#> SRR2926025 1 0.3949 0.558 0.668 0.000 0.000 0.000 0.332
#> SRR2926023 1 0.3949 0.558 0.668 0.000 0.000 0.000 0.332
#> SRR2926022 1 0.0162 0.658 0.996 0.000 0.000 0.000 0.004
#> SRR2926024 1 0.0162 0.658 0.996 0.000 0.000 0.000 0.004
#> SRR2926021 1 0.0162 0.658 0.996 0.000 0.000 0.000 0.004
#> SRR2926020 1 0.3949 0.558 0.668 0.000 0.000 0.000 0.332
#> SRR2926019 1 0.3949 0.558 0.668 0.000 0.000 0.000 0.332
#> SRR2926018 1 0.3949 0.558 0.668 0.000 0.000 0.000 0.332
#> SRR2926017 1 0.0162 0.658 0.996 0.000 0.000 0.000 0.004
#> SRR2926016 4 0.4548 0.703 0.000 0.048 0.016 0.756 0.180
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> SRR2926066 3 0.1261 0.8565 0.008 0.004 0.956 0.000 0.004 0.028
#> SRR2926067 4 0.6378 0.5254 0.360 0.028 0.008 0.460 0.000 0.144
#> SRR2926063 3 0.0790 0.8686 0.032 0.000 0.968 0.000 0.000 0.000
#> SRR2926064 4 0.0547 0.6766 0.000 0.020 0.000 0.980 0.000 0.000
#> SRR2926062 4 0.0547 0.6766 0.000 0.020 0.000 0.980 0.000 0.000
#> SRR2926061 4 0.4803 0.6489 0.196 0.024 0.000 0.700 0.000 0.080
#> SRR2926065 4 0.6048 0.5718 0.224 0.028 0.024 0.604 0.000 0.120
#> SRR2926060 4 0.4256 0.6619 0.176 0.020 0.000 0.748 0.000 0.056
#> SRR2926059 3 0.2119 0.8184 0.036 0.000 0.904 0.000 0.000 0.060
#> SRR2926058 3 0.0146 0.8694 0.000 0.000 0.996 0.000 0.000 0.004
#> SRR2926056 6 0.4952 0.4937 0.000 0.000 0.408 0.000 0.068 0.524
#> SRR2926057 3 0.1555 0.8391 0.004 0.004 0.932 0.000 0.000 0.060
#> SRR2926055 4 0.6541 0.5206 0.360 0.028 0.016 0.452 0.000 0.144
#> SRR2926054 3 0.3838 0.7096 0.116 0.004 0.784 0.000 0.000 0.096
#> SRR2926051 3 0.1225 0.8654 0.036 0.000 0.952 0.000 0.000 0.012
#> SRR2926052 3 0.0405 0.8683 0.008 0.000 0.988 0.000 0.000 0.004
#> SRR2926053 3 0.5898 0.4811 0.212 0.032 0.624 0.020 0.000 0.112
#> SRR2926050 3 0.1124 0.8562 0.008 0.000 0.956 0.000 0.000 0.036
#> SRR2926049 2 0.2219 0.8970 0.000 0.864 0.000 0.136 0.000 0.000
#> SRR2926047 4 0.5195 -0.4443 0.016 0.448 0.000 0.484 0.000 0.052
#> SRR2926046 3 0.1857 0.8499 0.028 0.004 0.924 0.000 0.000 0.044
#> SRR2926048 2 0.5148 0.3973 0.016 0.476 0.000 0.460 0.000 0.048
#> SRR2926044 4 0.4803 0.6500 0.196 0.024 0.000 0.700 0.000 0.080
#> SRR2926045 4 0.7213 0.4552 0.364 0.032 0.060 0.400 0.000 0.144
#> SRR2926041 2 0.2219 0.8970 0.000 0.864 0.000 0.136 0.000 0.000
#> SRR2926042 4 0.0692 0.6764 0.000 0.020 0.000 0.976 0.000 0.004
#> SRR2926040 2 0.2219 0.8970 0.000 0.864 0.000 0.136 0.000 0.000
#> SRR2926039 4 0.0547 0.6766 0.000 0.020 0.000 0.980 0.000 0.000
#> SRR2926043 4 0.0547 0.6766 0.000 0.020 0.000 0.980 0.000 0.000
#> SRR2926038 4 0.4802 -0.2899 0.016 0.404 0.000 0.552 0.000 0.028
#> SRR2926036 2 0.3564 0.8795 0.016 0.808 0.000 0.136 0.000 0.040
#> SRR2926037 2 0.3957 0.8355 0.012 0.752 0.000 0.200 0.000 0.036
#> SRR2926035 2 0.2219 0.8970 0.000 0.864 0.000 0.136 0.000 0.000
#> SRR2926034 4 0.1515 0.6838 0.028 0.008 0.000 0.944 0.000 0.020
#> SRR2926032 4 0.0547 0.6766 0.000 0.020 0.000 0.980 0.000 0.000
#> SRR2926031 5 0.0146 0.9782 0.000 0.000 0.000 0.000 0.996 0.004
#> SRR2926033 4 0.4710 0.6332 0.236 0.004 0.000 0.672 0.000 0.088
#> SRR2926030 1 0.5521 0.0782 0.544 0.040 0.000 0.000 0.056 0.360
#> SRR2926029 6 0.3493 0.7946 0.000 0.000 0.148 0.000 0.056 0.796
#> SRR2926027 5 0.0632 0.9781 0.000 0.024 0.000 0.000 0.976 0.000
#> SRR2926028 6 0.5298 0.7791 0.048 0.032 0.136 0.000 0.068 0.716
#> SRR2926026 1 0.3868 0.8402 0.508 0.000 0.000 0.000 0.492 0.000
#> SRR2926025 1 0.3868 0.8402 0.508 0.000 0.000 0.000 0.492 0.000
#> SRR2926023 1 0.3868 0.8402 0.508 0.000 0.000 0.000 0.492 0.000
#> SRR2926022 5 0.0146 0.9782 0.000 0.000 0.000 0.000 0.996 0.004
#> SRR2926024 5 0.0146 0.9782 0.000 0.000 0.000 0.000 0.996 0.004
#> SRR2926021 5 0.0632 0.9781 0.000 0.024 0.000 0.000 0.976 0.000
#> SRR2926020 1 0.3868 0.8402 0.508 0.000 0.000 0.000 0.492 0.000
#> SRR2926019 1 0.3868 0.8402 0.508 0.000 0.000 0.000 0.492 0.000
#> SRR2926018 1 0.3868 0.8402 0.508 0.000 0.000 0.000 0.492 0.000
#> SRR2926017 5 0.0632 0.9781 0.000 0.024 0.000 0.000 0.976 0.000
#> SRR2926016 4 0.4650 0.6181 0.136 0.052 0.004 0.748 0.000 0.060
Heatmaps for the consensus matrix. It visualizes the probability of two samples to be in a same group.
consensus_heatmap(res, k = 2)
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 18096 rows and 52 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 0.974 0.990 0.5098 0.490 0.490
#> 3 3 1.000 0.963 0.983 0.2634 0.845 0.690
#> 4 4 0.785 0.698 0.824 0.1133 0.964 0.898
#> 5 5 0.728 0.729 0.808 0.0726 0.863 0.587
#> 6 6 0.752 0.620 0.781 0.0434 0.942 0.742
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
#> SRR2926066 1 0.000 0.979 1.000 0.000
#> SRR2926067 2 0.000 1.000 0.000 1.000
#> SRR2926063 1 0.000 0.979 1.000 0.000
#> SRR2926064 2 0.000 1.000 0.000 1.000
#> SRR2926062 2 0.000 1.000 0.000 1.000
#> SRR2926061 2 0.000 1.000 0.000 1.000
#> SRR2926065 2 0.000 1.000 0.000 1.000
#> SRR2926060 2 0.000 1.000 0.000 1.000
#> SRR2926059 1 0.430 0.892 0.912 0.088
#> SRR2926058 1 0.000 0.979 1.000 0.000
#> SRR2926056 1 0.000 0.979 1.000 0.000
#> SRR2926057 1 0.000 0.979 1.000 0.000
#> SRR2926055 2 0.000 1.000 0.000 1.000
#> SRR2926054 1 0.983 0.273 0.576 0.424
#> SRR2926051 1 0.000 0.979 1.000 0.000
#> SRR2926052 1 0.000 0.979 1.000 0.000
#> SRR2926053 2 0.000 1.000 0.000 1.000
#> SRR2926050 1 0.000 0.979 1.000 0.000
#> SRR2926049 2 0.000 1.000 0.000 1.000
#> SRR2926047 2 0.000 1.000 0.000 1.000
#> SRR2926046 1 0.000 0.979 1.000 0.000
#> SRR2926048 2 0.000 1.000 0.000 1.000
#> SRR2926044 2 0.000 1.000 0.000 1.000
#> SRR2926045 2 0.000 1.000 0.000 1.000
#> SRR2926041 2 0.000 1.000 0.000 1.000
#> SRR2926042 2 0.000 1.000 0.000 1.000
#> SRR2926040 2 0.000 1.000 0.000 1.000
#> SRR2926039 2 0.000 1.000 0.000 1.000
#> SRR2926043 2 0.000 1.000 0.000 1.000
#> SRR2926038 2 0.000 1.000 0.000 1.000
#> SRR2926036 2 0.000 1.000 0.000 1.000
#> SRR2926037 2 0.000 1.000 0.000 1.000
#> SRR2926035 2 0.000 1.000 0.000 1.000
#> SRR2926034 2 0.000 1.000 0.000 1.000
#> SRR2926032 2 0.000 1.000 0.000 1.000
#> SRR2926031 1 0.000 0.979 1.000 0.000
#> SRR2926033 2 0.000 1.000 0.000 1.000
#> SRR2926030 1 0.000 0.979 1.000 0.000
#> SRR2926029 1 0.000 0.979 1.000 0.000
#> SRR2926027 1 0.000 0.979 1.000 0.000
#> SRR2926028 1 0.000 0.979 1.000 0.000
#> SRR2926026 1 0.000 0.979 1.000 0.000
#> SRR2926025 1 0.000 0.979 1.000 0.000
#> SRR2926023 1 0.000 0.979 1.000 0.000
#> SRR2926022 1 0.000 0.979 1.000 0.000
#> SRR2926024 1 0.000 0.979 1.000 0.000
#> SRR2926021 1 0.000 0.979 1.000 0.000
#> SRR2926020 1 0.000 0.979 1.000 0.000
#> SRR2926019 1 0.000 0.979 1.000 0.000
#> SRR2926018 1 0.000 0.979 1.000 0.000
#> SRR2926017 1 0.000 0.979 1.000 0.000
#> SRR2926016 2 0.000 1.000 0.000 1.000
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> SRR2926066 3 0.506 0.707 0.244 0 0.756
#> SRR2926067 2 0.000 1.000 0.000 1 0.000
#> SRR2926063 3 0.000 0.921 0.000 0 1.000
#> SRR2926064 2 0.000 1.000 0.000 1 0.000
#> SRR2926062 2 0.000 1.000 0.000 1 0.000
#> SRR2926061 2 0.000 1.000 0.000 1 0.000
#> SRR2926065 2 0.000 1.000 0.000 1 0.000
#> SRR2926060 2 0.000 1.000 0.000 1 0.000
#> SRR2926059 3 0.000 0.921 0.000 0 1.000
#> SRR2926058 3 0.000 0.921 0.000 0 1.000
#> SRR2926056 3 0.579 0.581 0.332 0 0.668
#> SRR2926057 3 0.000 0.921 0.000 0 1.000
#> SRR2926055 2 0.000 1.000 0.000 1 0.000
#> SRR2926054 3 0.000 0.921 0.000 0 1.000
#> SRR2926051 3 0.000 0.921 0.000 0 1.000
#> SRR2926052 3 0.000 0.921 0.000 0 1.000
#> SRR2926053 3 0.000 0.921 0.000 0 1.000
#> SRR2926050 3 0.000 0.921 0.000 0 1.000
#> SRR2926049 2 0.000 1.000 0.000 1 0.000
#> SRR2926047 2 0.000 1.000 0.000 1 0.000
#> SRR2926046 3 0.000 0.921 0.000 0 1.000
#> SRR2926048 2 0.000 1.000 0.000 1 0.000
#> SRR2926044 2 0.000 1.000 0.000 1 0.000
#> SRR2926045 2 0.000 1.000 0.000 1 0.000
#> SRR2926041 2 0.000 1.000 0.000 1 0.000
#> SRR2926042 2 0.000 1.000 0.000 1 0.000
#> SRR2926040 2 0.000 1.000 0.000 1 0.000
#> SRR2926039 2 0.000 1.000 0.000 1 0.000
#> SRR2926043 2 0.000 1.000 0.000 1 0.000
#> SRR2926038 2 0.000 1.000 0.000 1 0.000
#> SRR2926036 2 0.000 1.000 0.000 1 0.000
#> SRR2926037 2 0.000 1.000 0.000 1 0.000
#> SRR2926035 2 0.000 1.000 0.000 1 0.000
#> SRR2926034 2 0.000 1.000 0.000 1 0.000
#> SRR2926032 2 0.000 1.000 0.000 1 0.000
#> SRR2926031 1 0.000 1.000 1.000 0 0.000
#> SRR2926033 2 0.000 1.000 0.000 1 0.000
#> SRR2926030 1 0.000 1.000 1.000 0 0.000
#> SRR2926029 3 0.579 0.581 0.332 0 0.668
#> SRR2926027 1 0.000 1.000 1.000 0 0.000
#> SRR2926028 1 0.000 1.000 1.000 0 0.000
#> SRR2926026 1 0.000 1.000 1.000 0 0.000
#> SRR2926025 1 0.000 1.000 1.000 0 0.000
#> SRR2926023 1 0.000 1.000 1.000 0 0.000
#> SRR2926022 1 0.000 1.000 1.000 0 0.000
#> SRR2926024 1 0.000 1.000 1.000 0 0.000
#> SRR2926021 1 0.000 1.000 1.000 0 0.000
#> SRR2926020 1 0.000 1.000 1.000 0 0.000
#> SRR2926019 1 0.000 1.000 1.000 0 0.000
#> SRR2926018 1 0.000 1.000 1.000 0 0.000
#> SRR2926017 1 0.000 1.000 1.000 0 0.000
#> SRR2926016 2 0.000 1.000 0.000 1 0.000
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> SRR2926066 3 0.2021 0.755 0.012 0.000 0.932 0.056
#> SRR2926067 2 0.3266 0.595 0.000 0.832 0.000 0.168
#> SRR2926063 3 0.3837 0.680 0.000 0.000 0.776 0.224
#> SRR2926064 2 0.4843 0.617 0.000 0.604 0.000 0.396
#> SRR2926062 2 0.4843 0.617 0.000 0.604 0.000 0.396
#> SRR2926061 2 0.0000 0.747 0.000 1.000 0.000 0.000
#> SRR2926065 4 0.4948 -0.589 0.000 0.440 0.000 0.560
#> SRR2926060 2 0.0921 0.743 0.000 0.972 0.000 0.028
#> SRR2926059 3 0.2345 0.735 0.000 0.000 0.900 0.100
#> SRR2926058 3 0.1637 0.765 0.000 0.000 0.940 0.060
#> SRR2926056 3 0.5250 0.603 0.196 0.000 0.736 0.068
#> SRR2926057 3 0.1557 0.778 0.000 0.000 0.944 0.056
#> SRR2926055 2 0.3266 0.595 0.000 0.832 0.000 0.168
#> SRR2926054 4 0.4977 -0.277 0.000 0.000 0.460 0.540
#> SRR2926051 3 0.3837 0.680 0.000 0.000 0.776 0.224
#> SRR2926052 3 0.0336 0.781 0.000 0.000 0.992 0.008
#> SRR2926053 4 0.4985 -0.278 0.000 0.000 0.468 0.532
#> SRR2926050 3 0.0000 0.780 0.000 0.000 1.000 0.000
#> SRR2926049 2 0.0000 0.747 0.000 1.000 0.000 0.000
#> SRR2926047 2 0.0000 0.747 0.000 1.000 0.000 0.000
#> SRR2926046 3 0.4277 0.628 0.000 0.000 0.720 0.280
#> SRR2926048 2 0.4040 0.674 0.000 0.752 0.000 0.248
#> SRR2926044 2 0.0000 0.747 0.000 1.000 0.000 0.000
#> SRR2926045 2 0.4250 0.440 0.000 0.724 0.000 0.276
#> SRR2926041 2 0.0000 0.747 0.000 1.000 0.000 0.000
#> SRR2926042 2 0.4843 0.617 0.000 0.604 0.000 0.396
#> SRR2926040 2 0.0000 0.747 0.000 1.000 0.000 0.000
#> SRR2926039 2 0.4843 0.617 0.000 0.604 0.000 0.396
#> SRR2926043 2 0.4843 0.617 0.000 0.604 0.000 0.396
#> SRR2926038 2 0.4843 0.617 0.000 0.604 0.000 0.396
#> SRR2926036 2 0.0000 0.747 0.000 1.000 0.000 0.000
#> SRR2926037 2 0.0000 0.747 0.000 1.000 0.000 0.000
#> SRR2926035 2 0.0000 0.747 0.000 1.000 0.000 0.000
#> SRR2926034 2 0.4843 0.617 0.000 0.604 0.000 0.396
#> SRR2926032 2 0.4843 0.617 0.000 0.604 0.000 0.396
#> SRR2926031 1 0.1557 0.971 0.944 0.000 0.000 0.056
#> SRR2926033 2 0.0000 0.747 0.000 1.000 0.000 0.000
#> SRR2926030 1 0.0000 0.972 1.000 0.000 0.000 0.000
#> SRR2926029 3 0.5172 0.612 0.188 0.000 0.744 0.068
#> SRR2926027 1 0.1557 0.971 0.944 0.000 0.000 0.056
#> SRR2926028 1 0.1716 0.967 0.936 0.000 0.000 0.064
#> SRR2926026 1 0.0000 0.972 1.000 0.000 0.000 0.000
#> SRR2926025 1 0.0000 0.972 1.000 0.000 0.000 0.000
#> SRR2926023 1 0.0000 0.972 1.000 0.000 0.000 0.000
#> SRR2926022 1 0.1557 0.971 0.944 0.000 0.000 0.056
#> SRR2926024 1 0.1557 0.971 0.944 0.000 0.000 0.056
#> SRR2926021 1 0.1557 0.971 0.944 0.000 0.000 0.056
#> SRR2926020 1 0.0000 0.972 1.000 0.000 0.000 0.000
#> SRR2926019 1 0.0000 0.972 1.000 0.000 0.000 0.000
#> SRR2926018 1 0.0000 0.972 1.000 0.000 0.000 0.000
#> SRR2926017 1 0.1557 0.971 0.944 0.000 0.000 0.056
#> SRR2926016 2 0.4843 0.617 0.000 0.604 0.000 0.396
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> SRR2926066 3 0.1952 0.531 0.000 0.004 0.912 0.000 0.084
#> SRR2926067 2 0.5013 0.706 0.000 0.696 0.000 0.204 0.100
#> SRR2926063 5 0.4101 0.411 0.000 0.000 0.372 0.000 0.628
#> SRR2926064 4 0.0000 0.904 0.000 0.000 0.000 1.000 0.000
#> SRR2926062 4 0.0000 0.904 0.000 0.000 0.000 1.000 0.000
#> SRR2926061 2 0.3966 0.882 0.000 0.664 0.000 0.336 0.000
#> SRR2926065 4 0.2625 0.770 0.000 0.108 0.000 0.876 0.016
#> SRR2926060 2 0.4302 0.633 0.000 0.520 0.000 0.480 0.000
#> SRR2926059 3 0.4873 0.486 0.000 0.044 0.644 0.000 0.312
#> SRR2926058 3 0.4668 0.522 0.000 0.044 0.684 0.000 0.272
#> SRR2926056 3 0.5578 0.343 0.128 0.064 0.716 0.000 0.092
#> SRR2926057 3 0.4350 0.459 0.000 0.028 0.704 0.000 0.268
#> SRR2926055 2 0.5013 0.706 0.000 0.696 0.000 0.204 0.100
#> SRR2926054 5 0.2077 0.552 0.000 0.084 0.008 0.000 0.908
#> SRR2926051 5 0.4150 0.375 0.000 0.000 0.388 0.000 0.612
#> SRR2926052 3 0.3424 0.541 0.000 0.000 0.760 0.000 0.240
#> SRR2926053 5 0.2929 0.523 0.000 0.152 0.008 0.000 0.840
#> SRR2926050 3 0.3366 0.558 0.000 0.004 0.784 0.000 0.212
#> SRR2926049 2 0.3966 0.882 0.000 0.664 0.000 0.336 0.000
#> SRR2926047 2 0.4030 0.865 0.000 0.648 0.000 0.352 0.000
#> SRR2926046 5 0.4232 0.432 0.000 0.012 0.312 0.000 0.676
#> SRR2926048 4 0.4060 -0.149 0.000 0.360 0.000 0.640 0.000
#> SRR2926044 2 0.3966 0.882 0.000 0.664 0.000 0.336 0.000
#> SRR2926045 2 0.5979 0.304 0.000 0.520 0.000 0.120 0.360
#> SRR2926041 2 0.3966 0.882 0.000 0.664 0.000 0.336 0.000
#> SRR2926042 4 0.0162 0.902 0.000 0.004 0.000 0.996 0.000
#> SRR2926040 2 0.3966 0.882 0.000 0.664 0.000 0.336 0.000
#> SRR2926039 4 0.0000 0.904 0.000 0.000 0.000 1.000 0.000
#> SRR2926043 4 0.0000 0.904 0.000 0.000 0.000 1.000 0.000
#> SRR2926038 4 0.0000 0.904 0.000 0.000 0.000 1.000 0.000
#> SRR2926036 2 0.3966 0.882 0.000 0.664 0.000 0.336 0.000
#> SRR2926037 2 0.3966 0.882 0.000 0.664 0.000 0.336 0.000
#> SRR2926035 2 0.3966 0.882 0.000 0.664 0.000 0.336 0.000
#> SRR2926034 4 0.0162 0.902 0.000 0.004 0.000 0.996 0.000
#> SRR2926032 4 0.0162 0.902 0.000 0.004 0.000 0.996 0.000
#> SRR2926031 1 0.3752 0.868 0.804 0.048 0.148 0.000 0.000
#> SRR2926033 2 0.3949 0.879 0.000 0.668 0.000 0.332 0.000
#> SRR2926030 1 0.0451 0.875 0.988 0.008 0.000 0.000 0.004
#> SRR2926029 3 0.5801 0.328 0.128 0.076 0.700 0.000 0.096
#> SRR2926027 1 0.3794 0.866 0.800 0.048 0.152 0.000 0.000
#> SRR2926028 1 0.6382 0.683 0.616 0.088 0.232 0.000 0.064
#> SRR2926026 1 0.0000 0.880 1.000 0.000 0.000 0.000 0.000
#> SRR2926025 1 0.0000 0.880 1.000 0.000 0.000 0.000 0.000
#> SRR2926023 1 0.0000 0.880 1.000 0.000 0.000 0.000 0.000
#> SRR2926022 1 0.3639 0.870 0.812 0.044 0.144 0.000 0.000
#> SRR2926024 1 0.3639 0.870 0.812 0.044 0.144 0.000 0.000
#> SRR2926021 1 0.3794 0.866 0.800 0.048 0.152 0.000 0.000
#> SRR2926020 1 0.0000 0.880 1.000 0.000 0.000 0.000 0.000
#> SRR2926019 1 0.0000 0.880 1.000 0.000 0.000 0.000 0.000
#> SRR2926018 1 0.0000 0.880 1.000 0.000 0.000 0.000 0.000
#> SRR2926017 1 0.3794 0.866 0.800 0.048 0.152 0.000 0.000
#> SRR2926016 4 0.2338 0.789 0.000 0.112 0.000 0.884 0.004
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> SRR2926066 3 0.3728 0.36830 0.000 0.004 0.652 0.000 0.344 0.000
#> SRR2926067 2 0.5240 0.66380 0.000 0.640 0.000 0.136 0.012 0.212
#> SRR2926063 6 0.6148 -0.14438 0.000 0.012 0.372 0.000 0.192 0.424
#> SRR2926064 4 0.0000 0.84664 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR2926062 4 0.0000 0.84664 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR2926061 2 0.3081 0.92342 0.000 0.776 0.000 0.220 0.000 0.004
#> SRR2926065 4 0.2209 0.75601 0.000 0.052 0.004 0.904 0.000 0.040
#> SRR2926060 4 0.3866 -0.36144 0.000 0.484 0.000 0.516 0.000 0.000
#> SRR2926059 3 0.1010 0.65649 0.000 0.004 0.960 0.000 0.000 0.036
#> SRR2926058 3 0.0717 0.66369 0.000 0.000 0.976 0.000 0.008 0.016
#> SRR2926056 5 0.4130 0.64153 0.036 0.000 0.180 0.000 0.756 0.028
#> SRR2926057 3 0.4987 0.42144 0.000 0.008 0.624 0.000 0.288 0.080
#> SRR2926055 2 0.5394 0.63732 0.000 0.632 0.000 0.132 0.020 0.216
#> SRR2926054 6 0.1918 0.46724 0.000 0.000 0.088 0.000 0.008 0.904
#> SRR2926051 3 0.6123 -0.00674 0.000 0.012 0.436 0.000 0.188 0.364
#> SRR2926052 3 0.3500 0.66463 0.000 0.012 0.816 0.000 0.120 0.052
#> SRR2926053 6 0.3174 0.45745 0.000 0.056 0.104 0.000 0.004 0.836
#> SRR2926050 3 0.2100 0.68351 0.000 0.004 0.884 0.000 0.112 0.000
#> SRR2926049 2 0.2941 0.92517 0.000 0.780 0.000 0.220 0.000 0.000
#> SRR2926047 2 0.3446 0.80555 0.000 0.692 0.000 0.308 0.000 0.000
#> SRR2926046 6 0.5970 0.12386 0.000 0.004 0.220 0.000 0.300 0.476
#> SRR2926048 4 0.3823 -0.15630 0.000 0.436 0.000 0.564 0.000 0.000
#> SRR2926044 2 0.2941 0.92517 0.000 0.780 0.000 0.220 0.000 0.000
#> SRR2926045 6 0.5228 0.12230 0.000 0.328 0.000 0.080 0.012 0.580
#> SRR2926041 2 0.2941 0.92517 0.000 0.780 0.000 0.220 0.000 0.000
#> SRR2926042 4 0.0363 0.84042 0.000 0.012 0.000 0.988 0.000 0.000
#> SRR2926040 2 0.2941 0.92517 0.000 0.780 0.000 0.220 0.000 0.000
#> SRR2926039 4 0.0000 0.84664 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR2926043 4 0.0000 0.84664 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR2926038 4 0.0000 0.84664 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR2926036 2 0.2941 0.92517 0.000 0.780 0.000 0.220 0.000 0.000
#> SRR2926037 2 0.2941 0.92517 0.000 0.780 0.000 0.220 0.000 0.000
#> SRR2926035 2 0.2941 0.92517 0.000 0.780 0.000 0.220 0.000 0.000
#> SRR2926034 4 0.0146 0.84526 0.000 0.004 0.000 0.996 0.000 0.000
#> SRR2926032 4 0.0363 0.84040 0.000 0.012 0.000 0.988 0.000 0.000
#> SRR2926031 1 0.3810 0.52111 0.572 0.000 0.000 0.000 0.428 0.000
#> SRR2926033 2 0.3329 0.91896 0.000 0.768 0.000 0.220 0.004 0.008
#> SRR2926030 1 0.1082 0.66517 0.956 0.000 0.000 0.000 0.040 0.004
#> SRR2926029 5 0.3295 0.70809 0.028 0.000 0.108 0.000 0.836 0.028
#> SRR2926027 1 0.3833 0.50113 0.556 0.000 0.000 0.000 0.444 0.000
#> SRR2926028 5 0.3888 0.48164 0.200 0.012 0.000 0.000 0.756 0.032
#> SRR2926026 1 0.0000 0.69928 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2926025 1 0.0000 0.69928 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2926023 1 0.0000 0.69928 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2926022 1 0.3797 0.52667 0.580 0.000 0.000 0.000 0.420 0.000
#> SRR2926024 1 0.3810 0.52111 0.572 0.000 0.000 0.000 0.428 0.000
#> SRR2926021 1 0.3843 0.48817 0.548 0.000 0.000 0.000 0.452 0.000
#> SRR2926020 1 0.0000 0.69928 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2926019 1 0.0000 0.69928 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2926018 1 0.0000 0.69928 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2926017 1 0.3843 0.48817 0.548 0.000 0.000 0.000 0.452 0.000
#> SRR2926016 4 0.4179 0.59582 0.000 0.160 0.000 0.760 0.060 0.020
Heatmaps for the consensus matrix. It visualizes the probability of two samples to be in a same group.
consensus_heatmap(res, k = 2)
consensus_heatmap(res, k = 3)
consensus_heatmap(res, k = 4)
consensus_heatmap(res, k = 5)
consensus_heatmap(res, k = 6)
Heatmaps for the membership of samples in all partitions to see how consistent they are:
membership_heatmap(res, k = 2)
membership_heatmap(res, k = 3)
membership_heatmap(res, k = 4)
membership_heatmap(res, k = 5)
membership_heatmap(res, k = 6)
As soon as we have had the classes for columns, we can look for signatures which are significantly different between classes which can be candidate marks for certain classes. Following are the heatmaps for signatures.
Signature heatmaps where rows are scaled:
get_signatures(res, k = 2)
get_signatures(res, k = 3)
get_signatures(res, k = 4)
get_signatures(res, k = 5)
get_signatures(res, k = 6)
Signature heatmaps where rows are not scaled:
get_signatures(res, k = 2, scale_rows = FALSE)
get_signatures(res, k = 3, scale_rows = FALSE)
get_signatures(res, k = 4, scale_rows = FALSE)
get_signatures(res, k = 5, scale_rows = FALSE)
get_signatures(res, k = 6, scale_rows = FALSE)
Compare the overlap of signatures from different k:
compare_signatures(res)
get_signature()
returns a data frame invisibly. TO get the list of signatures, the function
call should be assigned to a variable explicitly. In following code, if plot
argument is set
to FALSE
, no heatmap is plotted while only the differential analysis is performed.
# code only for demonstration
tb = get_signature(res, k = ..., plot = FALSE)
An example of the output of tb
is:
#> which_row fdr mean_1 mean_2 scaled_mean_1 scaled_mean_2 km
#> 1 38 0.042760348 8.373488 9.131774 -0.5533452 0.5164555 1
#> 2 40 0.018707592 7.106213 8.469186 -0.6173731 0.5762149 1
#> 3 55 0.019134737 10.221463 11.207825 -0.6159697 0.5749050 1
#> 4 59 0.006059896 5.921854 7.869574 -0.6899429 0.6439467 1
#> 5 60 0.018055526 8.928898 10.211722 -0.6204761 0.5791110 1
#> 6 98 0.009384629 15.714769 14.887706 0.6635654 -0.6193277 2
...
The columns in tb
are:
which_row
: row indices corresponding to the input matrix.fdr
: FDR for the differential test. mean_x
: The mean value in group x.scaled_mean_x
: The mean value in group x after rows are scaled.km
: Row groups if k-means clustering is applied to rows.UMAP plot which shows how samples are separated.
dimension_reduction(res, k = 2, method = "UMAP")
dimension_reduction(res, k = 3, method = "UMAP")
dimension_reduction(res, k = 4, method = "UMAP")
dimension_reduction(res, k = 5, method = "UMAP")
dimension_reduction(res, k = 6, method = "UMAP")
Following heatmap shows how subgroups are split when increasing k
:
collect_classes(res)
If matrix rows can be associated to genes, consider to use functional_enrichment(res,
...)
to perform function enrichment for the signature genes. See this vignette for more detailed explanations.
The object with results only for a single top-value method and a single partition method can be extracted as:
res = res_list["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 18096 rows and 52 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 0.979 0.991 0.4628 0.538 0.538
#> 3 3 1.000 0.987 0.994 0.3970 0.747 0.559
#> 4 4 0.829 0.887 0.879 0.0930 0.968 0.910
#> 5 5 0.997 0.953 0.978 0.0958 0.905 0.705
#> 6 6 0.969 0.930 0.965 0.0621 0.928 0.698
suggest_best_k()
suggests the best \(k\) based on these statistics. The rules are as follows:
suggest_best_k(res)
#> [1] 6
#> attr(,"optional")
#> [1] 2 3 5
There is also optional best \(k\) = 2 3 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
#> SRR2926066 1 0.000 0.988 1.000 0.000
#> SRR2926067 2 0.000 0.991 0.000 1.000
#> SRR2926063 2 0.722 0.751 0.200 0.800
#> SRR2926064 2 0.000 0.991 0.000 1.000
#> SRR2926062 2 0.000 0.991 0.000 1.000
#> SRR2926061 2 0.000 0.991 0.000 1.000
#> SRR2926065 2 0.000 0.991 0.000 1.000
#> SRR2926060 2 0.000 0.991 0.000 1.000
#> SRR2926059 2 0.000 0.991 0.000 1.000
#> SRR2926058 2 0.000 0.991 0.000 1.000
#> SRR2926056 1 0.000 0.988 1.000 0.000
#> SRR2926057 2 0.000 0.991 0.000 1.000
#> SRR2926055 2 0.000 0.991 0.000 1.000
#> SRR2926054 2 0.000 0.991 0.000 1.000
#> SRR2926051 2 0.000 0.991 0.000 1.000
#> SRR2926052 2 0.443 0.896 0.092 0.908
#> SRR2926053 2 0.000 0.991 0.000 1.000
#> SRR2926050 1 0.000 0.988 1.000 0.000
#> SRR2926049 2 0.000 0.991 0.000 1.000
#> SRR2926047 2 0.000 0.991 0.000 1.000
#> SRR2926046 2 0.000 0.991 0.000 1.000
#> SRR2926048 2 0.000 0.991 0.000 1.000
#> SRR2926044 2 0.000 0.991 0.000 1.000
#> SRR2926045 2 0.000 0.991 0.000 1.000
#> SRR2926041 2 0.000 0.991 0.000 1.000
#> SRR2926042 2 0.000 0.991 0.000 1.000
#> SRR2926040 2 0.000 0.991 0.000 1.000
#> SRR2926039 2 0.000 0.991 0.000 1.000
#> SRR2926043 2 0.000 0.991 0.000 1.000
#> SRR2926038 2 0.000 0.991 0.000 1.000
#> SRR2926036 2 0.000 0.991 0.000 1.000
#> SRR2926037 2 0.000 0.991 0.000 1.000
#> SRR2926035 2 0.000 0.991 0.000 1.000
#> SRR2926034 2 0.000 0.991 0.000 1.000
#> SRR2926032 2 0.000 0.991 0.000 1.000
#> SRR2926031 1 0.000 0.988 1.000 0.000
#> SRR2926033 2 0.000 0.991 0.000 1.000
#> SRR2926030 1 0.706 0.757 0.808 0.192
#> SRR2926029 1 0.000 0.988 1.000 0.000
#> SRR2926027 1 0.000 0.988 1.000 0.000
#> SRR2926028 1 0.000 0.988 1.000 0.000
#> SRR2926026 1 0.000 0.988 1.000 0.000
#> SRR2926025 1 0.000 0.988 1.000 0.000
#> SRR2926023 1 0.000 0.988 1.000 0.000
#> SRR2926022 1 0.000 0.988 1.000 0.000
#> SRR2926024 1 0.000 0.988 1.000 0.000
#> SRR2926021 1 0.000 0.988 1.000 0.000
#> SRR2926020 1 0.000 0.988 1.000 0.000
#> SRR2926019 1 0.000 0.988 1.000 0.000
#> SRR2926018 1 0.000 0.988 1.000 0.000
#> SRR2926017 1 0.000 0.988 1.000 0.000
#> SRR2926016 2 0.000 0.991 0.000 1.000
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> SRR2926066 3 0.000 0.975 0.00 0 1.00
#> SRR2926067 2 0.000 1.000 0.00 1 0.00
#> SRR2926063 3 0.000 0.975 0.00 0 1.00
#> SRR2926064 2 0.000 1.000 0.00 1 0.00
#> SRR2926062 2 0.000 1.000 0.00 1 0.00
#> SRR2926061 2 0.000 1.000 0.00 1 0.00
#> SRR2926065 2 0.000 1.000 0.00 1 0.00
#> SRR2926060 2 0.000 1.000 0.00 1 0.00
#> SRR2926059 3 0.000 0.975 0.00 0 1.00
#> SRR2926058 3 0.000 0.975 0.00 0 1.00
#> SRR2926056 3 0.455 0.766 0.20 0 0.80
#> SRR2926057 3 0.000 0.975 0.00 0 1.00
#> SRR2926055 2 0.000 1.000 0.00 1 0.00
#> SRR2926054 3 0.000 0.975 0.00 0 1.00
#> SRR2926051 3 0.000 0.975 0.00 0 1.00
#> SRR2926052 3 0.000 0.975 0.00 0 1.00
#> SRR2926053 3 0.000 0.975 0.00 0 1.00
#> SRR2926050 3 0.000 0.975 0.00 0 1.00
#> SRR2926049 2 0.000 1.000 0.00 1 0.00
#> SRR2926047 2 0.000 1.000 0.00 1 0.00
#> SRR2926046 3 0.000 0.975 0.00 0 1.00
#> SRR2926048 2 0.000 1.000 0.00 1 0.00
#> SRR2926044 2 0.000 1.000 0.00 1 0.00
#> SRR2926045 2 0.000 1.000 0.00 1 0.00
#> SRR2926041 2 0.000 1.000 0.00 1 0.00
#> SRR2926042 2 0.000 1.000 0.00 1 0.00
#> SRR2926040 2 0.000 1.000 0.00 1 0.00
#> SRR2926039 2 0.000 1.000 0.00 1 0.00
#> SRR2926043 2 0.000 1.000 0.00 1 0.00
#> SRR2926038 2 0.000 1.000 0.00 1 0.00
#> SRR2926036 2 0.000 1.000 0.00 1 0.00
#> SRR2926037 2 0.000 1.000 0.00 1 0.00
#> SRR2926035 2 0.000 1.000 0.00 1 0.00
#> SRR2926034 2 0.000 1.000 0.00 1 0.00
#> SRR2926032 2 0.000 1.000 0.00 1 0.00
#> SRR2926031 1 0.000 1.000 1.00 0 0.00
#> SRR2926033 2 0.000 1.000 0.00 1 0.00
#> SRR2926030 1 0.000 1.000 1.00 0 0.00
#> SRR2926029 3 0.000 0.975 0.00 0 1.00
#> SRR2926027 1 0.000 1.000 1.00 0 0.00
#> SRR2926028 3 0.334 0.866 0.12 0 0.88
#> SRR2926026 1 0.000 1.000 1.00 0 0.00
#> SRR2926025 1 0.000 1.000 1.00 0 0.00
#> SRR2926023 1 0.000 1.000 1.00 0 0.00
#> SRR2926022 1 0.000 1.000 1.00 0 0.00
#> SRR2926024 1 0.000 1.000 1.00 0 0.00
#> SRR2926021 1 0.000 1.000 1.00 0 0.00
#> SRR2926020 1 0.000 1.000 1.00 0 0.00
#> SRR2926019 1 0.000 1.000 1.00 0 0.00
#> SRR2926018 1 0.000 1.000 1.00 0 0.00
#> SRR2926017 1 0.000 1.000 1.00 0 0.00
#> SRR2926016 2 0.000 1.000 0.00 1 0.00
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> SRR2926066 3 0.1557 0.922 0.000 0.000 0.944 0.056
#> SRR2926067 2 0.4948 0.882 0.000 0.560 0.000 0.440
#> SRR2926063 3 0.0000 0.953 0.000 0.000 1.000 0.000
#> SRR2926064 2 0.4948 0.882 0.000 0.560 0.000 0.440
#> SRR2926062 2 0.4948 0.882 0.000 0.560 0.000 0.440
#> SRR2926061 2 0.4948 0.882 0.000 0.560 0.000 0.440
#> SRR2926065 2 0.4948 0.882 0.000 0.560 0.000 0.440
#> SRR2926060 2 0.4948 0.882 0.000 0.560 0.000 0.440
#> SRR2926059 3 0.0000 0.953 0.000 0.000 1.000 0.000
#> SRR2926058 3 0.0000 0.953 0.000 0.000 1.000 0.000
#> SRR2926056 3 0.5102 0.683 0.188 0.000 0.748 0.064
#> SRR2926057 3 0.0000 0.953 0.000 0.000 1.000 0.000
#> SRR2926055 2 0.5119 0.880 0.000 0.556 0.004 0.440
#> SRR2926054 3 0.0000 0.953 0.000 0.000 1.000 0.000
#> SRR2926051 3 0.0000 0.953 0.000 0.000 1.000 0.000
#> SRR2926052 3 0.0000 0.953 0.000 0.000 1.000 0.000
#> SRR2926053 3 0.0592 0.941 0.000 0.000 0.984 0.016
#> SRR2926050 3 0.0000 0.953 0.000 0.000 1.000 0.000
#> SRR2926049 2 0.0000 0.633 0.000 1.000 0.000 0.000
#> SRR2926047 2 0.4948 0.882 0.000 0.560 0.000 0.440
#> SRR2926046 3 0.0000 0.953 0.000 0.000 1.000 0.000
#> SRR2926048 2 0.4776 0.857 0.000 0.624 0.000 0.376
#> SRR2926044 2 0.4948 0.882 0.000 0.560 0.000 0.440
#> SRR2926045 2 0.6261 0.845 0.000 0.504 0.056 0.440
#> SRR2926041 2 0.0000 0.633 0.000 1.000 0.000 0.000
#> SRR2926042 2 0.4948 0.882 0.000 0.560 0.000 0.440
#> SRR2926040 2 0.0000 0.633 0.000 1.000 0.000 0.000
#> SRR2926039 2 0.4948 0.882 0.000 0.560 0.000 0.440
#> SRR2926043 2 0.4948 0.882 0.000 0.560 0.000 0.440
#> SRR2926038 2 0.0000 0.633 0.000 1.000 0.000 0.000
#> SRR2926036 2 0.0000 0.633 0.000 1.000 0.000 0.000
#> SRR2926037 2 0.3764 0.771 0.000 0.784 0.000 0.216
#> SRR2926035 2 0.0000 0.633 0.000 1.000 0.000 0.000
#> SRR2926034 2 0.4948 0.882 0.000 0.560 0.000 0.440
#> SRR2926032 2 0.4948 0.882 0.000 0.560 0.000 0.440
#> SRR2926031 4 0.4948 1.000 0.440 0.000 0.000 0.560
#> SRR2926033 2 0.4948 0.882 0.000 0.560 0.000 0.440
#> SRR2926030 1 0.0000 1.000 1.000 0.000 0.000 0.000
#> SRR2926029 3 0.1637 0.919 0.000 0.000 0.940 0.060
#> SRR2926027 4 0.4948 1.000 0.440 0.000 0.000 0.560
#> SRR2926028 3 0.4700 0.767 0.124 0.000 0.792 0.084
#> SRR2926026 1 0.0000 1.000 1.000 0.000 0.000 0.000
#> SRR2926025 1 0.0000 1.000 1.000 0.000 0.000 0.000
#> SRR2926023 1 0.0000 1.000 1.000 0.000 0.000 0.000
#> SRR2926022 4 0.4948 1.000 0.440 0.000 0.000 0.560
#> SRR2926024 4 0.4948 1.000 0.440 0.000 0.000 0.560
#> SRR2926021 4 0.4948 1.000 0.440 0.000 0.000 0.560
#> SRR2926020 1 0.0000 1.000 1.000 0.000 0.000 0.000
#> SRR2926019 1 0.0000 1.000 1.000 0.000 0.000 0.000
#> SRR2926018 1 0.0000 1.000 1.000 0.000 0.000 0.000
#> SRR2926017 4 0.4948 1.000 0.440 0.000 0.000 0.560
#> SRR2926016 2 0.6261 0.845 0.000 0.504 0.056 0.440
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> SRR2926066 3 0.1478 0.915 0.000 0.000 0.936 0.000 0.064
#> SRR2926067 4 0.0000 0.986 0.000 0.000 0.000 1.000 0.000
#> SRR2926063 3 0.0000 0.953 0.000 0.000 1.000 0.000 0.000
#> SRR2926064 4 0.0000 0.986 0.000 0.000 0.000 1.000 0.000
#> SRR2926062 4 0.0000 0.986 0.000 0.000 0.000 1.000 0.000
#> SRR2926061 4 0.0000 0.986 0.000 0.000 0.000 1.000 0.000
#> SRR2926065 4 0.0510 0.974 0.000 0.000 0.016 0.984 0.000
#> SRR2926060 4 0.0000 0.986 0.000 0.000 0.000 1.000 0.000
#> SRR2926059 3 0.0000 0.953 0.000 0.000 1.000 0.000 0.000
#> SRR2926058 3 0.0000 0.953 0.000 0.000 1.000 0.000 0.000
#> SRR2926056 3 0.3561 0.695 0.000 0.000 0.740 0.000 0.260
#> SRR2926057 3 0.0000 0.953 0.000 0.000 1.000 0.000 0.000
#> SRR2926055 4 0.0000 0.986 0.000 0.000 0.000 1.000 0.000
#> SRR2926054 3 0.0000 0.953 0.000 0.000 1.000 0.000 0.000
#> SRR2926051 3 0.0000 0.953 0.000 0.000 1.000 0.000 0.000
#> SRR2926052 3 0.0000 0.953 0.000 0.000 1.000 0.000 0.000
#> SRR2926053 3 0.0609 0.938 0.000 0.000 0.980 0.020 0.000
#> SRR2926050 3 0.0000 0.953 0.000 0.000 1.000 0.000 0.000
#> SRR2926049 2 0.0000 0.933 0.000 1.000 0.000 0.000 0.000
#> SRR2926047 4 0.0000 0.986 0.000 0.000 0.000 1.000 0.000
#> SRR2926046 3 0.0000 0.953 0.000 0.000 1.000 0.000 0.000
#> SRR2926048 4 0.1732 0.910 0.000 0.080 0.000 0.920 0.000
#> SRR2926044 4 0.0000 0.986 0.000 0.000 0.000 1.000 0.000
#> SRR2926045 4 0.1478 0.931 0.000 0.000 0.064 0.936 0.000
#> SRR2926041 2 0.0000 0.933 0.000 1.000 0.000 0.000 0.000
#> SRR2926042 4 0.0000 0.986 0.000 0.000 0.000 1.000 0.000
#> SRR2926040 2 0.0000 0.933 0.000 1.000 0.000 0.000 0.000
#> SRR2926039 4 0.0000 0.986 0.000 0.000 0.000 1.000 0.000
#> SRR2926043 4 0.0000 0.986 0.000 0.000 0.000 1.000 0.000
#> SRR2926038 2 0.0000 0.933 0.000 1.000 0.000 0.000 0.000
#> SRR2926036 2 0.0000 0.933 0.000 1.000 0.000 0.000 0.000
#> SRR2926037 2 0.3752 0.582 0.000 0.708 0.000 0.292 0.000
#> SRR2926035 2 0.0000 0.933 0.000 1.000 0.000 0.000 0.000
#> SRR2926034 4 0.0000 0.986 0.000 0.000 0.000 1.000 0.000
#> SRR2926032 4 0.0000 0.986 0.000 0.000 0.000 1.000 0.000
#> SRR2926031 5 0.0000 1.000 0.000 0.000 0.000 0.000 1.000
#> SRR2926033 4 0.0000 0.986 0.000 0.000 0.000 1.000 0.000
#> SRR2926030 1 0.0000 1.000 1.000 0.000 0.000 0.000 0.000
#> SRR2926029 3 0.1965 0.893 0.000 0.000 0.904 0.000 0.096
#> SRR2926027 5 0.0000 1.000 0.000 0.000 0.000 0.000 1.000
#> SRR2926028 3 0.3758 0.821 0.096 0.000 0.816 0.000 0.088
#> SRR2926026 1 0.0000 1.000 1.000 0.000 0.000 0.000 0.000
#> SRR2926025 1 0.0000 1.000 1.000 0.000 0.000 0.000 0.000
#> SRR2926023 1 0.0000 1.000 1.000 0.000 0.000 0.000 0.000
#> SRR2926022 5 0.0000 1.000 0.000 0.000 0.000 0.000 1.000
#> SRR2926024 5 0.0000 1.000 0.000 0.000 0.000 0.000 1.000
#> SRR2926021 5 0.0000 1.000 0.000 0.000 0.000 0.000 1.000
#> SRR2926020 1 0.0000 1.000 1.000 0.000 0.000 0.000 0.000
#> SRR2926019 1 0.0000 1.000 1.000 0.000 0.000 0.000 0.000
#> SRR2926018 1 0.0000 1.000 1.000 0.000 0.000 0.000 0.000
#> SRR2926017 5 0.0000 1.000 0.000 0.000 0.000 0.000 1.000
#> SRR2926016 4 0.1478 0.931 0.000 0.000 0.064 0.936 0.000
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> SRR2926066 6 0.0000 0.880 0.000 0.000 0.000 0.000 0.000 1.000
#> SRR2926067 4 0.0000 0.992 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR2926063 3 0.2793 0.792 0.000 0.000 0.800 0.000 0.000 0.200
#> SRR2926064 4 0.0000 0.992 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR2926062 4 0.0000 0.992 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR2926061 4 0.0000 0.992 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR2926065 4 0.1204 0.940 0.000 0.000 0.056 0.944 0.000 0.000
#> SRR2926060 4 0.0000 0.992 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR2926059 3 0.0000 0.903 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2926058 6 0.2762 0.757 0.000 0.000 0.196 0.000 0.000 0.804
#> SRR2926056 6 0.2762 0.748 0.000 0.000 0.000 0.000 0.196 0.804
#> SRR2926057 6 0.0790 0.875 0.000 0.000 0.032 0.000 0.000 0.968
#> SRR2926055 4 0.0146 0.989 0.000 0.000 0.004 0.996 0.000 0.000
#> SRR2926054 3 0.0000 0.903 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2926051 3 0.2762 0.794 0.000 0.000 0.804 0.000 0.000 0.196
#> SRR2926052 3 0.3563 0.608 0.000 0.000 0.664 0.000 0.000 0.336
#> SRR2926053 3 0.0000 0.903 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2926050 6 0.0000 0.880 0.000 0.000 0.000 0.000 0.000 1.000
#> SRR2926049 2 0.0000 0.934 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2926047 4 0.0000 0.992 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR2926046 3 0.0000 0.903 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2926048 4 0.1204 0.939 0.000 0.056 0.000 0.944 0.000 0.000
#> SRR2926044 4 0.0000 0.992 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR2926045 3 0.0000 0.903 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2926041 2 0.0000 0.934 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2926042 4 0.0000 0.992 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR2926040 2 0.0000 0.934 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2926039 4 0.0000 0.992 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR2926043 4 0.0000 0.992 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR2926038 2 0.0000 0.934 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2926036 2 0.0000 0.934 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2926037 2 0.3371 0.580 0.000 0.708 0.000 0.292 0.000 0.000
#> SRR2926035 2 0.0000 0.934 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR2926034 4 0.0000 0.992 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR2926032 4 0.0000 0.992 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR2926031 5 0.0000 1.000 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR2926033 4 0.0000 0.992 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR2926030 1 0.0000 1.000 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2926029 6 0.0790 0.880 0.000 0.000 0.000 0.000 0.032 0.968
#> SRR2926027 5 0.0000 1.000 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR2926028 6 0.4640 0.760 0.092 0.000 0.084 0.000 0.072 0.752
#> SRR2926026 1 0.0000 1.000 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2926025 1 0.0000 1.000 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2926023 1 0.0000 1.000 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2926022 5 0.0000 1.000 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR2926024 5 0.0000 1.000 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR2926021 5 0.0000 1.000 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR2926020 1 0.0000 1.000 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2926019 1 0.0000 1.000 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2926018 1 0.0000 1.000 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2926017 5 0.0000 1.000 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR2926016 3 0.0000 0.903 0.000 0.000 1.000 0.000 0.000 0.000
Heatmaps for the consensus matrix. It visualizes the probability of two samples to be in a same group.
consensus_heatmap(res, k = 2)
consensus_heatmap(res, k = 3)
consensus_heatmap(res, k = 4)
consensus_heatmap(res, k = 5)
consensus_heatmap(res, k = 6)
Heatmaps for the membership of samples in all partitions to see how consistent they are:
membership_heatmap(res, k = 2)
membership_heatmap(res, k = 3)
membership_heatmap(res, k = 4)
membership_heatmap(res, k = 5)
membership_heatmap(res, k = 6)
As soon as we have had the classes for columns, we can look for signatures which are significantly different between classes which can be candidate marks for certain classes. Following are the heatmaps for signatures.
Signature heatmaps where rows are scaled:
get_signatures(res, k = 2)
get_signatures(res, k = 3)
get_signatures(res, k = 4)
get_signatures(res, k = 5)
get_signatures(res, k = 6)
Signature heatmaps where rows are not scaled:
get_signatures(res, k = 2, scale_rows = FALSE)
get_signatures(res, k = 3, scale_rows = FALSE)
get_signatures(res, k = 4, scale_rows = FALSE)
get_signatures(res, k = 5, scale_rows = FALSE)
get_signatures(res, k = 6, scale_rows = FALSE)
Compare the overlap of signatures from different k:
compare_signatures(res)
get_signature()
returns a data frame invisibly. TO get the list of signatures, the function
call should be assigned to a variable explicitly. In following code, if plot
argument is set
to FALSE
, no heatmap is plotted while only the differential analysis is performed.
# code only for demonstration
tb = get_signature(res, k = ..., plot = FALSE)
An example of the output of tb
is:
#> which_row fdr mean_1 mean_2 scaled_mean_1 scaled_mean_2 km
#> 1 38 0.042760348 8.373488 9.131774 -0.5533452 0.5164555 1
#> 2 40 0.018707592 7.106213 8.469186 -0.6173731 0.5762149 1
#> 3 55 0.019134737 10.221463 11.207825 -0.6159697 0.5749050 1
#> 4 59 0.006059896 5.921854 7.869574 -0.6899429 0.6439467 1
#> 5 60 0.018055526 8.928898 10.211722 -0.6204761 0.5791110 1
#> 6 98 0.009384629 15.714769 14.887706 0.6635654 -0.6193277 2
...
The columns in tb
are:
which_row
: row indices corresponding to the input matrix.fdr
: FDR for the differential test. mean_x
: The mean value in group x.scaled_mean_x
: The mean value in group x after rows are scaled.km
: Row groups if k-means clustering is applied to rows.UMAP plot which shows how samples are separated.
dimension_reduction(res, k = 2, method = "UMAP")
dimension_reduction(res, k = 3, method = "UMAP")
dimension_reduction(res, k = 4, method = "UMAP")
dimension_reduction(res, k = 5, method = "UMAP")
dimension_reduction(res, k = 6, method = "UMAP")
Following heatmap shows how subgroups are split when increasing k
:
collect_classes(res)
If matrix rows can be associated to genes, consider to use functional_enrichment(res,
...)
to perform function enrichment for the signature genes. See this vignette for more detailed explanations.
The object with results only for a single top-value method and a single partition method can be extracted as:
res = res_list["ATC", "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 18096 rows and 52 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.435 0.566 0.566
#> 3 3 0.757 0.862 0.905 0.361 0.768 0.600
#> 4 4 0.657 0.623 0.765 0.144 0.913 0.784
#> 5 5 0.770 0.814 0.902 0.160 0.795 0.467
#> 6 6 0.745 0.711 0.821 0.018 0.932 0.699
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
#> SRR2926066 2 0.0376 0.996 0.004 0.996
#> SRR2926067 2 0.0000 1.000 0.000 1.000
#> SRR2926063 2 0.0000 1.000 0.000 1.000
#> SRR2926064 2 0.0000 1.000 0.000 1.000
#> SRR2926062 2 0.0000 1.000 0.000 1.000
#> SRR2926061 2 0.0000 1.000 0.000 1.000
#> SRR2926065 2 0.0000 1.000 0.000 1.000
#> SRR2926060 2 0.0000 1.000 0.000 1.000
#> SRR2926059 2 0.0000 1.000 0.000 1.000
#> SRR2926058 2 0.0000 1.000 0.000 1.000
#> SRR2926056 1 0.0000 1.000 1.000 0.000
#> SRR2926057 2 0.0000 1.000 0.000 1.000
#> SRR2926055 2 0.0000 1.000 0.000 1.000
#> SRR2926054 2 0.0000 1.000 0.000 1.000
#> SRR2926051 2 0.0000 1.000 0.000 1.000
#> SRR2926052 2 0.0000 1.000 0.000 1.000
#> SRR2926053 2 0.0000 1.000 0.000 1.000
#> SRR2926050 2 0.0000 1.000 0.000 1.000
#> SRR2926049 2 0.0000 1.000 0.000 1.000
#> SRR2926047 2 0.0000 1.000 0.000 1.000
#> SRR2926046 2 0.0000 1.000 0.000 1.000
#> SRR2926048 2 0.0000 1.000 0.000 1.000
#> SRR2926044 2 0.0000 1.000 0.000 1.000
#> SRR2926045 2 0.0000 1.000 0.000 1.000
#> SRR2926041 2 0.0000 1.000 0.000 1.000
#> SRR2926042 2 0.0000 1.000 0.000 1.000
#> SRR2926040 2 0.0000 1.000 0.000 1.000
#> SRR2926039 2 0.0000 1.000 0.000 1.000
#> SRR2926043 2 0.0000 1.000 0.000 1.000
#> SRR2926038 2 0.0000 1.000 0.000 1.000
#> SRR2926036 2 0.0000 1.000 0.000 1.000
#> SRR2926037 2 0.0000 1.000 0.000 1.000
#> SRR2926035 2 0.0000 1.000 0.000 1.000
#> SRR2926034 2 0.0000 1.000 0.000 1.000
#> SRR2926032 2 0.0000 1.000 0.000 1.000
#> SRR2926031 1 0.0000 1.000 1.000 0.000
#> SRR2926033 2 0.0000 1.000 0.000 1.000
#> SRR2926030 1 0.0000 1.000 1.000 0.000
#> SRR2926029 1 0.0000 1.000 1.000 0.000
#> SRR2926027 1 0.0000 1.000 1.000 0.000
#> SRR2926028 1 0.0000 1.000 1.000 0.000
#> SRR2926026 1 0.0000 1.000 1.000 0.000
#> SRR2926025 1 0.0000 1.000 1.000 0.000
#> SRR2926023 1 0.0000 1.000 1.000 0.000
#> SRR2926022 1 0.0000 1.000 1.000 0.000
#> SRR2926024 1 0.0000 1.000 1.000 0.000
#> SRR2926021 1 0.0000 1.000 1.000 0.000
#> SRR2926020 1 0.0000 1.000 1.000 0.000
#> SRR2926019 1 0.0000 1.000 1.000 0.000
#> SRR2926018 1 0.0000 1.000 1.000 0.000
#> SRR2926017 1 0.0000 1.000 1.000 0.000
#> SRR2926016 2 0.0376 0.996 0.004 0.996
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> SRR2926066 3 0.4326 0.698 0.012 0.144 0.844
#> SRR2926067 2 0.0592 0.941 0.000 0.988 0.012
#> SRR2926063 3 0.5835 0.817 0.000 0.340 0.660
#> SRR2926064 2 0.0424 0.937 0.000 0.992 0.008
#> SRR2926062 2 0.0747 0.932 0.000 0.984 0.016
#> SRR2926061 2 0.0592 0.941 0.000 0.988 0.012
#> SRR2926065 2 0.0000 0.939 0.000 1.000 0.000
#> SRR2926060 2 0.0000 0.939 0.000 1.000 0.000
#> SRR2926059 3 0.6244 0.673 0.000 0.440 0.560
#> SRR2926058 3 0.6062 0.775 0.000 0.384 0.616
#> SRR2926056 3 0.4842 0.301 0.224 0.000 0.776
#> SRR2926057 3 0.5835 0.817 0.000 0.340 0.660
#> SRR2926055 2 0.0592 0.941 0.000 0.988 0.012
#> SRR2926054 3 0.5835 0.817 0.000 0.340 0.660
#> SRR2926051 3 0.5835 0.817 0.000 0.340 0.660
#> SRR2926052 3 0.6229 0.815 0.008 0.340 0.652
#> SRR2926053 2 0.6307 -0.533 0.000 0.512 0.488
#> SRR2926050 3 0.6062 0.775 0.000 0.384 0.616
#> SRR2926049 2 0.0592 0.941 0.000 0.988 0.012
#> SRR2926047 2 0.0424 0.939 0.000 0.992 0.008
#> SRR2926046 3 0.6155 0.812 0.008 0.328 0.664
#> SRR2926048 2 0.0747 0.932 0.000 0.984 0.016
#> SRR2926044 2 0.0592 0.941 0.000 0.988 0.012
#> SRR2926045 2 0.0592 0.941 0.000 0.988 0.012
#> SRR2926041 2 0.0592 0.941 0.000 0.988 0.012
#> SRR2926042 2 0.0747 0.932 0.000 0.984 0.016
#> SRR2926040 2 0.0592 0.941 0.000 0.988 0.012
#> SRR2926039 2 0.0747 0.932 0.000 0.984 0.016
#> SRR2926043 2 0.0592 0.934 0.000 0.988 0.012
#> SRR2926038 2 0.0424 0.937 0.000 0.992 0.008
#> SRR2926036 2 0.0592 0.941 0.000 0.988 0.012
#> SRR2926037 2 0.0592 0.941 0.000 0.988 0.012
#> SRR2926035 2 0.0592 0.941 0.000 0.988 0.012
#> SRR2926034 2 0.0000 0.939 0.000 1.000 0.000
#> SRR2926032 2 0.0747 0.932 0.000 0.984 0.016
#> SRR2926031 1 0.0000 0.993 1.000 0.000 0.000
#> SRR2926033 2 0.0592 0.941 0.000 0.988 0.012
#> SRR2926030 1 0.1411 0.969 0.964 0.000 0.036
#> SRR2926029 3 0.4047 0.427 0.148 0.004 0.848
#> SRR2926027 1 0.0000 0.993 1.000 0.000 0.000
#> SRR2926028 1 0.2537 0.935 0.920 0.000 0.080
#> SRR2926026 1 0.0000 0.993 1.000 0.000 0.000
#> SRR2926025 1 0.0000 0.993 1.000 0.000 0.000
#> SRR2926023 1 0.0000 0.993 1.000 0.000 0.000
#> SRR2926022 1 0.0000 0.993 1.000 0.000 0.000
#> SRR2926024 1 0.0000 0.993 1.000 0.000 0.000
#> SRR2926021 1 0.0000 0.993 1.000 0.000 0.000
#> SRR2926020 1 0.0000 0.993 1.000 0.000 0.000
#> SRR2926019 1 0.0000 0.993 1.000 0.000 0.000
#> SRR2926018 1 0.0000 0.993 1.000 0.000 0.000
#> SRR2926017 1 0.0000 0.993 1.000 0.000 0.000
#> SRR2926016 2 0.5815 0.470 0.004 0.692 0.304
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> SRR2926066 3 0.6566 0.8196 0.000 0.288 0.600 0.112
#> SRR2926067 2 0.0188 0.6224 0.000 0.996 0.004 0.000
#> SRR2926063 3 0.6270 0.9219 0.000 0.404 0.536 0.060
#> SRR2926064 2 0.4907 0.5908 0.000 0.580 0.420 0.000
#> SRR2926062 2 0.4981 0.5786 0.000 0.536 0.464 0.000
#> SRR2926061 2 0.0000 0.6265 0.000 1.000 0.000 0.000
#> SRR2926065 2 0.3958 0.6079 0.000 0.824 0.144 0.032
#> SRR2926060 2 0.3837 0.6190 0.000 0.776 0.224 0.000
#> SRR2926059 2 0.5558 -0.4753 0.000 0.608 0.364 0.028
#> SRR2926058 2 0.5453 -0.2379 0.000 0.660 0.304 0.036
#> SRR2926056 4 0.0000 0.7858 0.000 0.000 0.000 1.000
#> SRR2926057 3 0.6278 0.9194 0.000 0.408 0.532 0.060
#> SRR2926055 2 0.0817 0.5991 0.000 0.976 0.024 0.000
#> SRR2926054 3 0.6270 0.9219 0.000 0.404 0.536 0.060
#> SRR2926051 3 0.6270 0.9219 0.000 0.404 0.536 0.060
#> SRR2926052 3 0.6194 0.8347 0.000 0.288 0.628 0.084
#> SRR2926053 2 0.5062 -0.1856 0.000 0.692 0.284 0.024
#> SRR2926050 3 0.6197 0.8627 0.000 0.440 0.508 0.052
#> SRR2926049 2 0.0000 0.6265 0.000 1.000 0.000 0.000
#> SRR2926047 2 0.4746 0.5984 0.000 0.632 0.368 0.000
#> SRR2926046 3 0.6688 0.9066 0.000 0.368 0.536 0.096
#> SRR2926048 2 0.4972 0.5819 0.000 0.544 0.456 0.000
#> SRR2926044 2 0.0000 0.6265 0.000 1.000 0.000 0.000
#> SRR2926045 2 0.0921 0.5937 0.000 0.972 0.028 0.000
#> SRR2926041 2 0.0000 0.6265 0.000 1.000 0.000 0.000
#> SRR2926042 2 0.4981 0.5786 0.000 0.536 0.464 0.000
#> SRR2926040 2 0.0000 0.6265 0.000 1.000 0.000 0.000
#> SRR2926039 2 0.4981 0.5786 0.000 0.536 0.464 0.000
#> SRR2926043 2 0.4981 0.5786 0.000 0.536 0.464 0.000
#> SRR2926038 2 0.4972 0.5821 0.000 0.544 0.456 0.000
#> SRR2926036 2 0.0000 0.6265 0.000 1.000 0.000 0.000
#> SRR2926037 2 0.0000 0.6265 0.000 1.000 0.000 0.000
#> SRR2926035 2 0.0000 0.6265 0.000 1.000 0.000 0.000
#> SRR2926034 2 0.4382 0.6134 0.000 0.704 0.296 0.000
#> SRR2926032 2 0.4981 0.5786 0.000 0.536 0.464 0.000
#> SRR2926031 1 0.1716 0.8313 0.936 0.000 0.000 0.064
#> SRR2926033 2 0.0000 0.6265 0.000 1.000 0.000 0.000
#> SRR2926030 4 0.4998 -0.0301 0.488 0.000 0.000 0.512
#> SRR2926029 4 0.0000 0.7858 0.000 0.000 0.000 1.000
#> SRR2926027 1 0.4605 0.5109 0.664 0.000 0.000 0.336
#> SRR2926028 4 0.1867 0.7642 0.072 0.000 0.000 0.928
#> SRR2926026 1 0.0000 0.8703 1.000 0.000 0.000 0.000
#> SRR2926025 1 0.0469 0.8642 0.988 0.000 0.000 0.012
#> SRR2926023 1 0.0000 0.8703 1.000 0.000 0.000 0.000
#> SRR2926022 1 0.0188 0.8701 0.996 0.000 0.000 0.004
#> SRR2926024 1 0.0188 0.8701 0.996 0.000 0.000 0.004
#> SRR2926021 1 0.4643 0.4969 0.656 0.000 0.000 0.344
#> SRR2926020 1 0.0000 0.8703 1.000 0.000 0.000 0.000
#> SRR2926019 1 0.0336 0.8670 0.992 0.000 0.000 0.008
#> SRR2926018 1 0.0000 0.8703 1.000 0.000 0.000 0.000
#> SRR2926017 1 0.4643 0.4969 0.656 0.000 0.000 0.344
#> SRR2926016 2 0.7013 0.0467 0.000 0.516 0.356 0.128
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> SRR2926066 3 0.0451 0.8124 0.000 0.004 0.988 0.008 0.000
#> SRR2926067 2 0.2707 0.8915 0.000 0.876 0.024 0.100 0.000
#> SRR2926063 3 0.0963 0.8214 0.000 0.036 0.964 0.000 0.000
#> SRR2926064 4 0.0162 0.9234 0.000 0.004 0.000 0.996 0.000
#> SRR2926062 4 0.0000 0.9264 0.000 0.000 0.000 1.000 0.000
#> SRR2926061 2 0.2864 0.8901 0.000 0.864 0.024 0.112 0.000
#> SRR2926065 4 0.4443 -0.0954 0.000 0.004 0.472 0.524 0.000
#> SRR2926060 4 0.0162 0.9236 0.000 0.004 0.000 0.996 0.000
#> SRR2926059 3 0.5136 0.7015 0.000 0.128 0.692 0.180 0.000
#> SRR2926058 3 0.5756 0.6489 0.000 0.176 0.620 0.204 0.000
#> SRR2926056 5 0.0510 0.9006 0.000 0.000 0.016 0.000 0.984
#> SRR2926057 3 0.0703 0.8223 0.000 0.024 0.976 0.000 0.000
#> SRR2926055 2 0.2959 0.8852 0.000 0.864 0.036 0.100 0.000
#> SRR2926054 3 0.0609 0.8221 0.000 0.020 0.980 0.000 0.000
#> SRR2926051 3 0.0963 0.8214 0.000 0.036 0.964 0.000 0.000
#> SRR2926052 3 0.0566 0.8175 0.000 0.004 0.984 0.012 0.000
#> SRR2926053 3 0.4150 0.4302 0.000 0.388 0.612 0.000 0.000
#> SRR2926050 3 0.3419 0.7433 0.000 0.180 0.804 0.016 0.000
#> SRR2926049 2 0.0510 0.8587 0.000 0.984 0.000 0.016 0.000
#> SRR2926047 4 0.2852 0.7328 0.000 0.172 0.000 0.828 0.000
#> SRR2926046 3 0.0771 0.8124 0.000 0.004 0.976 0.000 0.020
#> SRR2926048 4 0.0000 0.9264 0.000 0.000 0.000 1.000 0.000
#> SRR2926044 2 0.2669 0.8917 0.000 0.876 0.020 0.104 0.000
#> SRR2926045 2 0.5876 0.0768 0.000 0.488 0.412 0.100 0.000
#> SRR2926041 2 0.0510 0.8587 0.000 0.984 0.000 0.016 0.000
#> SRR2926042 4 0.0000 0.9264 0.000 0.000 0.000 1.000 0.000
#> SRR2926040 2 0.0510 0.8587 0.000 0.984 0.000 0.016 0.000
#> SRR2926039 4 0.0000 0.9264 0.000 0.000 0.000 1.000 0.000
#> SRR2926043 4 0.0000 0.9264 0.000 0.000 0.000 1.000 0.000
#> SRR2926038 4 0.0000 0.9264 0.000 0.000 0.000 1.000 0.000
#> SRR2926036 2 0.2230 0.8856 0.000 0.884 0.000 0.116 0.000
#> SRR2926037 2 0.2280 0.8835 0.000 0.880 0.000 0.120 0.000
#> SRR2926035 2 0.0510 0.8587 0.000 0.984 0.000 0.016 0.000
#> SRR2926034 4 0.0000 0.9264 0.000 0.000 0.000 1.000 0.000
#> SRR2926032 4 0.0000 0.9264 0.000 0.000 0.000 1.000 0.000
#> SRR2926031 1 0.1372 0.9191 0.956 0.004 0.016 0.000 0.024
#> SRR2926033 2 0.2707 0.8915 0.000 0.876 0.024 0.100 0.000
#> SRR2926030 5 0.3752 0.6048 0.292 0.000 0.000 0.000 0.708
#> SRR2926029 5 0.0510 0.9006 0.000 0.000 0.016 0.000 0.984
#> SRR2926027 1 0.3718 0.7962 0.784 0.004 0.016 0.000 0.196
#> SRR2926028 5 0.0510 0.9006 0.000 0.000 0.016 0.000 0.984
#> SRR2926026 1 0.0162 0.9242 0.996 0.000 0.000 0.000 0.004
#> SRR2926025 1 0.0290 0.9228 0.992 0.000 0.000 0.000 0.008
#> SRR2926023 1 0.0000 0.9246 1.000 0.000 0.000 0.000 0.000
#> SRR2926022 1 0.1179 0.9211 0.964 0.004 0.016 0.000 0.016
#> SRR2926024 1 0.1179 0.9211 0.964 0.004 0.016 0.000 0.016
#> SRR2926021 1 0.3752 0.7919 0.780 0.004 0.016 0.000 0.200
#> SRR2926020 1 0.0000 0.9246 1.000 0.000 0.000 0.000 0.000
#> SRR2926019 1 0.0404 0.9206 0.988 0.000 0.000 0.000 0.012
#> SRR2926018 1 0.0000 0.9246 1.000 0.000 0.000 0.000 0.000
#> SRR2926017 1 0.3718 0.7962 0.784 0.004 0.016 0.000 0.196
#> SRR2926016 3 0.4958 0.4389 0.000 0.036 0.592 0.372 0.000
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> SRR2926066 3 0.0260 0.8145 0.000 0.000 0.992 0.000 0.008 0.000
#> SRR2926067 2 0.5818 0.3483 0.000 0.516 0.012 0.324 0.148 0.000
#> SRR2926063 3 0.1578 0.8295 0.000 0.048 0.936 0.000 0.004 0.012
#> SRR2926064 4 0.0458 0.8766 0.000 0.016 0.000 0.984 0.000 0.000
#> SRR2926062 4 0.0000 0.8739 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR2926061 4 0.5561 0.1158 0.000 0.260 0.012 0.584 0.144 0.000
#> SRR2926065 4 0.3203 0.6499 0.000 0.024 0.160 0.812 0.004 0.000
#> SRR2926060 4 0.2048 0.7708 0.000 0.120 0.000 0.880 0.000 0.000
#> SRR2926059 3 0.4300 0.5567 0.000 0.364 0.608 0.028 0.000 0.000
#> SRR2926058 3 0.4144 0.5663 0.000 0.360 0.620 0.020 0.000 0.000
#> SRR2926056 6 0.0000 0.9875 0.000 0.000 0.000 0.000 0.000 1.000
#> SRR2926057 3 0.1349 0.8291 0.000 0.056 0.940 0.000 0.004 0.000
#> SRR2926055 2 0.6022 0.3509 0.000 0.512 0.024 0.316 0.148 0.000
#> SRR2926054 3 0.1707 0.8293 0.000 0.056 0.928 0.000 0.004 0.012
#> SRR2926051 3 0.1578 0.8295 0.000 0.048 0.936 0.000 0.004 0.012
#> SRR2926052 3 0.0000 0.8158 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR2926053 3 0.4189 0.5000 0.000 0.436 0.552 0.008 0.004 0.000
#> SRR2926050 3 0.0937 0.8183 0.000 0.040 0.960 0.000 0.000 0.000
#> SRR2926049 2 0.3586 0.5081 0.000 0.720 0.000 0.268 0.012 0.000
#> SRR2926047 4 0.1674 0.8398 0.000 0.068 0.004 0.924 0.004 0.000
#> SRR2926046 3 0.1462 0.8072 0.000 0.008 0.936 0.000 0.000 0.056
#> SRR2926048 4 0.0458 0.8765 0.000 0.016 0.000 0.984 0.000 0.000
#> SRR2926044 2 0.5864 0.3307 0.000 0.496 0.012 0.344 0.148 0.000
#> SRR2926045 2 0.6307 0.3368 0.000 0.492 0.044 0.320 0.144 0.000
#> SRR2926041 2 0.3586 0.5081 0.000 0.720 0.000 0.268 0.012 0.000
#> SRR2926042 4 0.0000 0.8739 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR2926040 2 0.3586 0.5081 0.000 0.720 0.000 0.268 0.012 0.000
#> SRR2926039 4 0.0000 0.8739 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR2926043 4 0.0363 0.8773 0.000 0.012 0.000 0.988 0.000 0.000
#> SRR2926038 4 0.0363 0.8772 0.000 0.012 0.000 0.988 0.000 0.000
#> SRR2926036 2 0.3244 0.5091 0.000 0.732 0.000 0.268 0.000 0.000
#> SRR2926037 2 0.3695 0.5063 0.000 0.712 0.000 0.272 0.016 0.000
#> SRR2926035 2 0.3244 0.5091 0.000 0.732 0.000 0.268 0.000 0.000
#> SRR2926034 4 0.2003 0.7767 0.000 0.116 0.000 0.884 0.000 0.000
#> SRR2926032 4 0.0000 0.8739 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR2926031 5 0.3737 0.7016 0.392 0.000 0.000 0.000 0.608 0.000
#> SRR2926033 2 0.5838 0.3435 0.000 0.508 0.012 0.332 0.148 0.000
#> SRR2926030 1 0.2442 0.7906 0.852 0.000 0.000 0.000 0.004 0.144
#> SRR2926029 6 0.0000 0.9875 0.000 0.000 0.000 0.000 0.000 1.000
#> SRR2926027 5 0.3023 0.7641 0.120 0.000 0.000 0.000 0.836 0.044
#> SRR2926028 6 0.0713 0.9748 0.000 0.000 0.000 0.000 0.028 0.972
#> SRR2926026 1 0.0000 0.9604 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2926025 1 0.0260 0.9571 0.992 0.000 0.000 0.000 0.008 0.000
#> SRR2926023 1 0.0146 0.9587 0.996 0.000 0.000 0.000 0.004 0.000
#> SRR2926022 5 0.3838 0.6138 0.448 0.000 0.000 0.000 0.552 0.000
#> SRR2926024 5 0.3756 0.6930 0.400 0.000 0.000 0.000 0.600 0.000
#> SRR2926021 5 0.3023 0.7641 0.120 0.000 0.000 0.000 0.836 0.044
#> SRR2926020 1 0.0000 0.9604 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2926019 1 0.0363 0.9543 0.988 0.000 0.000 0.000 0.012 0.000
#> SRR2926018 1 0.0000 0.9604 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR2926017 5 0.3023 0.7641 0.120 0.000 0.000 0.000 0.836 0.044
#> SRR2926016 2 0.5577 0.0846 0.000 0.572 0.216 0.208 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["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 18096 rows and 52 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.986 0.994 0.5079 0.493 0.493
#> 3 3 1.000 0.949 0.980 0.3212 0.728 0.503
#> 4 4 0.884 0.892 0.953 0.0528 0.972 0.916
#> 5 5 0.889 0.848 0.941 0.0574 0.953 0.847
#> 6 6 0.751 0.713 0.857 0.0410 0.974 0.901
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
#> SRR2926066 1 0.0000 0.989 1.000 0.000
#> SRR2926067 2 0.0000 1.000 0.000 1.000
#> SRR2926063 1 0.0000 0.989 1.000 0.000
#> SRR2926064 2 0.0000 1.000 0.000 1.000
#> SRR2926062 2 0.0000 1.000 0.000 1.000
#> SRR2926061 2 0.0000 1.000 0.000 1.000
#> SRR2926065 2 0.0000 1.000 0.000 1.000
#> SRR2926060 2 0.0000 1.000 0.000 1.000
#> SRR2926059 1 0.0000 0.989 1.000 0.000
#> SRR2926058 1 0.0000 0.989 1.000 0.000
#> SRR2926056 1 0.0000 0.989 1.000 0.000
#> SRR2926057 1 0.0000 0.989 1.000 0.000
#> SRR2926055 2 0.0000 1.000 0.000 1.000
#> SRR2926054 1 0.0000 0.989 1.000 0.000
#> SRR2926051 1 0.0000 0.989 1.000 0.000
#> SRR2926052 1 0.0000 0.989 1.000 0.000
#> SRR2926053 1 0.0376 0.985 0.996 0.004
#> SRR2926050 1 0.0000 0.989 1.000 0.000
#> SRR2926049 2 0.0000 1.000 0.000 1.000
#> SRR2926047 2 0.0000 1.000 0.000 1.000
#> SRR2926046 1 0.0000 0.989 1.000 0.000
#> SRR2926048 2 0.0000 1.000 0.000 1.000
#> SRR2926044 2 0.0000 1.000 0.000 1.000
#> SRR2926045 2 0.0376 0.996 0.004 0.996
#> SRR2926041 2 0.0000 1.000 0.000 1.000
#> SRR2926042 2 0.0000 1.000 0.000 1.000
#> SRR2926040 2 0.0000 1.000 0.000 1.000
#> SRR2926039 2 0.0000 1.000 0.000 1.000
#> SRR2926043 2 0.0000 1.000 0.000 1.000
#> SRR2926038 2 0.0000 1.000 0.000 1.000
#> SRR2926036 2 0.0000 1.000 0.000 1.000
#> SRR2926037 2 0.0000 1.000 0.000 1.000
#> SRR2926035 2 0.0000 1.000 0.000 1.000
#> SRR2926034 2 0.0000 1.000 0.000 1.000
#> SRR2926032 2 0.0000 1.000 0.000 1.000
#> SRR2926031 1 0.0000 0.989 1.000 0.000
#> SRR2926033 2 0.0000 1.000 0.000 1.000
#> SRR2926030 1 0.0000 0.989 1.000 0.000
#> SRR2926029 1 0.0000 0.989 1.000 0.000
#> SRR2926027 1 0.0000 0.989 1.000 0.000
#> SRR2926028 1 0.0000 0.989 1.000 0.000
#> SRR2926026 1 0.0000 0.989 1.000 0.000
#> SRR2926025 1 0.0000 0.989 1.000 0.000
#> SRR2926023 1 0.0000 0.989 1.000 0.000
#> SRR2926022 1 0.0000 0.989 1.000 0.000
#> SRR2926024 1 0.0000 0.989 1.000 0.000
#> SRR2926021 1 0.0000 0.989 1.000 0.000
#> SRR2926020 1 0.0000 0.989 1.000 0.000
#> SRR2926019 1 0.0000 0.989 1.000 0.000
#> SRR2926018 1 0.0000 0.989 1.000 0.000
#> SRR2926017 1 0.0000 0.989 1.000 0.000
#> SRR2926016 1 0.8813 0.572 0.700 0.300
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> SRR2926066 3 0.0000 0.9687 0.000 0.000 1.000
#> SRR2926067 3 0.6062 0.3721 0.000 0.384 0.616
#> SRR2926063 3 0.0000 0.9687 0.000 0.000 1.000
#> SRR2926064 2 0.0000 0.9731 0.000 1.000 0.000
#> SRR2926062 2 0.0000 0.9731 0.000 1.000 0.000
#> SRR2926061 2 0.0000 0.9731 0.000 1.000 0.000
#> SRR2926065 3 0.2165 0.9098 0.000 0.064 0.936
#> SRR2926060 2 0.0000 0.9731 0.000 1.000 0.000
#> SRR2926059 3 0.0000 0.9687 0.000 0.000 1.000
#> SRR2926058 3 0.0000 0.9687 0.000 0.000 1.000
#> SRR2926056 3 0.0000 0.9687 0.000 0.000 1.000
#> SRR2926057 3 0.0000 0.9687 0.000 0.000 1.000
#> SRR2926055 3 0.0424 0.9624 0.000 0.008 0.992
#> SRR2926054 3 0.0000 0.9687 0.000 0.000 1.000
#> SRR2926051 3 0.0000 0.9687 0.000 0.000 1.000
#> SRR2926052 3 0.0000 0.9687 0.000 0.000 1.000
#> SRR2926053 3 0.0000 0.9687 0.000 0.000 1.000
#> SRR2926050 3 0.0000 0.9687 0.000 0.000 1.000
#> SRR2926049 2 0.0000 0.9731 0.000 1.000 0.000
#> SRR2926047 2 0.0000 0.9731 0.000 1.000 0.000
#> SRR2926046 3 0.0000 0.9687 0.000 0.000 1.000
#> SRR2926048 2 0.0000 0.9731 0.000 1.000 0.000
#> SRR2926044 2 0.0000 0.9731 0.000 1.000 0.000
#> SRR2926045 3 0.0000 0.9687 0.000 0.000 1.000
#> SRR2926041 2 0.0000 0.9731 0.000 1.000 0.000
#> SRR2926042 2 0.0000 0.9731 0.000 1.000 0.000
#> SRR2926040 2 0.0000 0.9731 0.000 1.000 0.000
#> SRR2926039 2 0.0000 0.9731 0.000 1.000 0.000
#> SRR2926043 2 0.0000 0.9731 0.000 1.000 0.000
#> SRR2926038 2 0.0000 0.9731 0.000 1.000 0.000
#> SRR2926036 2 0.0000 0.9731 0.000 1.000 0.000
#> SRR2926037 2 0.0000 0.9731 0.000 1.000 0.000
#> SRR2926035 2 0.0000 0.9731 0.000 1.000 0.000
#> SRR2926034 2 0.0424 0.9659 0.000 0.992 0.008
#> SRR2926032 2 0.0000 0.9731 0.000 1.000 0.000
#> SRR2926031 1 0.0000 1.0000 1.000 0.000 0.000
#> SRR2926033 2 0.0237 0.9697 0.000 0.996 0.004
#> SRR2926030 1 0.0000 1.0000 1.000 0.000 0.000
#> SRR2926029 3 0.0000 0.9687 0.000 0.000 1.000
#> SRR2926027 1 0.0000 1.0000 1.000 0.000 0.000
#> SRR2926028 1 0.0000 1.0000 1.000 0.000 0.000
#> SRR2926026 1 0.0000 1.0000 1.000 0.000 0.000
#> SRR2926025 1 0.0000 1.0000 1.000 0.000 0.000
#> SRR2926023 1 0.0000 1.0000 1.000 0.000 0.000
#> SRR2926022 1 0.0000 1.0000 1.000 0.000 0.000
#> SRR2926024 1 0.0000 1.0000 1.000 0.000 0.000
#> SRR2926021 1 0.0000 1.0000 1.000 0.000 0.000
#> SRR2926020 1 0.0000 1.0000 1.000 0.000 0.000
#> SRR2926019 1 0.0000 1.0000 1.000 0.000 0.000
#> SRR2926018 1 0.0000 1.0000 1.000 0.000 0.000
#> SRR2926017 1 0.0000 1.0000 1.000 0.000 0.000
#> SRR2926016 2 0.9767 0.0887 0.244 0.428 0.328
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> SRR2926066 3 0.0188 0.964 0.000 0.000 0.996 0.004
#> SRR2926067 3 0.3219 0.718 0.000 0.164 0.836 0.000
#> SRR2926063 3 0.0000 0.966 0.000 0.000 1.000 0.000
#> SRR2926064 2 0.2530 0.843 0.000 0.888 0.000 0.112
#> SRR2926062 2 0.3726 0.716 0.000 0.788 0.000 0.212
#> SRR2926061 2 0.0188 0.931 0.000 0.996 0.004 0.000
#> SRR2926065 4 0.7011 0.417 0.000 0.300 0.148 0.552
#> SRR2926060 2 0.0000 0.934 0.000 1.000 0.000 0.000
#> SRR2926059 3 0.0000 0.966 0.000 0.000 1.000 0.000
#> SRR2926058 3 0.0188 0.964 0.000 0.000 0.996 0.004
#> SRR2926056 3 0.0000 0.966 0.000 0.000 1.000 0.000
#> SRR2926057 3 0.0000 0.966 0.000 0.000 1.000 0.000
#> SRR2926055 3 0.1474 0.904 0.000 0.052 0.948 0.000
#> SRR2926054 3 0.0000 0.966 0.000 0.000 1.000 0.000
#> SRR2926051 3 0.0000 0.966 0.000 0.000 1.000 0.000
#> SRR2926052 3 0.0000 0.966 0.000 0.000 1.000 0.000
#> SRR2926053 3 0.0000 0.966 0.000 0.000 1.000 0.000
#> SRR2926050 3 0.0000 0.966 0.000 0.000 1.000 0.000
#> SRR2926049 2 0.0000 0.934 0.000 1.000 0.000 0.000
#> SRR2926047 2 0.0000 0.934 0.000 1.000 0.000 0.000
#> SRR2926046 3 0.0000 0.966 0.000 0.000 1.000 0.000
#> SRR2926048 2 0.0000 0.934 0.000 1.000 0.000 0.000
#> SRR2926044 2 0.0000 0.934 0.000 1.000 0.000 0.000
#> SRR2926045 3 0.0000 0.966 0.000 0.000 1.000 0.000
#> SRR2926041 2 0.0000 0.934 0.000 1.000 0.000 0.000
#> SRR2926042 2 0.0188 0.933 0.000 0.996 0.000 0.004
#> SRR2926040 2 0.0000 0.934 0.000 1.000 0.000 0.000
#> SRR2926039 2 0.1211 0.909 0.000 0.960 0.000 0.040
#> SRR2926043 2 0.4564 0.477 0.000 0.672 0.000 0.328
#> SRR2926038 2 0.0336 0.931 0.000 0.992 0.000 0.008
#> SRR2926036 2 0.0000 0.934 0.000 1.000 0.000 0.000
#> SRR2926037 2 0.0000 0.934 0.000 1.000 0.000 0.000
#> SRR2926035 2 0.0000 0.934 0.000 1.000 0.000 0.000
#> SRR2926034 2 0.3688 0.723 0.000 0.792 0.000 0.208
#> SRR2926032 2 0.0188 0.933 0.000 0.996 0.000 0.004
#> SRR2926031 1 0.2345 0.894 0.900 0.000 0.000 0.100
#> SRR2926033 2 0.2216 0.816 0.000 0.908 0.092 0.000
#> SRR2926030 1 0.0000 0.957 1.000 0.000 0.000 0.000
#> SRR2926029 3 0.3172 0.790 0.000 0.000 0.840 0.160
#> SRR2926027 1 0.0000 0.957 1.000 0.000 0.000 0.000
#> SRR2926028 1 0.4564 0.631 0.672 0.000 0.000 0.328
#> SRR2926026 1 0.0000 0.957 1.000 0.000 0.000 0.000
#> SRR2926025 1 0.0000 0.957 1.000 0.000 0.000 0.000
#> SRR2926023 1 0.0000 0.957 1.000 0.000 0.000 0.000
#> SRR2926022 1 0.0000 0.957 1.000 0.000 0.000 0.000
#> SRR2926024 1 0.0000 0.957 1.000 0.000 0.000 0.000
#> SRR2926021 1 0.2530 0.887 0.888 0.000 0.000 0.112
#> SRR2926020 1 0.0000 0.957 1.000 0.000 0.000 0.000
#> SRR2926019 1 0.0000 0.957 1.000 0.000 0.000 0.000
#> SRR2926018 1 0.0000 0.957 1.000 0.000 0.000 0.000
#> SRR2926017 1 0.1474 0.928 0.948 0.000 0.000 0.052
#> SRR2926016 4 0.0000 0.540 0.000 0.000 0.000 1.000
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> SRR2926066 3 0.1430 0.931 0.000 0.000 0.944 0.052 0.004
#> SRR2926067 3 0.1365 0.927 0.000 0.040 0.952 0.004 0.004
#> SRR2926063 3 0.0000 0.956 0.000 0.000 1.000 0.000 0.000
#> SRR2926064 2 0.3671 0.652 0.000 0.756 0.008 0.236 0.000
#> SRR2926062 2 0.4307 -0.134 0.000 0.504 0.000 0.496 0.000
#> SRR2926061 2 0.0162 0.913 0.000 0.996 0.004 0.000 0.000
#> SRR2926065 4 0.1956 0.577 0.000 0.008 0.052 0.928 0.012
#> SRR2926060 2 0.0579 0.906 0.000 0.984 0.008 0.008 0.000
#> SRR2926059 3 0.0162 0.956 0.000 0.000 0.996 0.000 0.004
#> SRR2926058 3 0.0404 0.954 0.000 0.000 0.988 0.012 0.000
#> SRR2926056 3 0.3177 0.761 0.000 0.000 0.792 0.000 0.208
#> SRR2926057 3 0.0963 0.942 0.000 0.000 0.964 0.000 0.036
#> SRR2926055 3 0.3106 0.781 0.000 0.132 0.844 0.024 0.000
#> SRR2926054 3 0.0324 0.956 0.000 0.000 0.992 0.004 0.004
#> SRR2926051 3 0.0162 0.956 0.000 0.000 0.996 0.000 0.004
#> SRR2926052 3 0.0566 0.954 0.000 0.000 0.984 0.012 0.004
#> SRR2926053 3 0.0000 0.956 0.000 0.000 1.000 0.000 0.000
#> SRR2926050 3 0.0162 0.956 0.000 0.000 0.996 0.000 0.004
#> SRR2926049 2 0.0000 0.915 0.000 1.000 0.000 0.000 0.000
#> SRR2926047 2 0.0000 0.915 0.000 1.000 0.000 0.000 0.000
#> SRR2926046 3 0.0703 0.949 0.000 0.000 0.976 0.000 0.024
#> SRR2926048 2 0.0000 0.915 0.000 1.000 0.000 0.000 0.000
#> SRR2926044 2 0.0000 0.915 0.000 1.000 0.000 0.000 0.000
#> SRR2926045 3 0.0324 0.955 0.000 0.000 0.992 0.004 0.004
#> SRR2926041 2 0.0000 0.915 0.000 1.000 0.000 0.000 0.000
#> SRR2926042 2 0.0162 0.913 0.000 0.996 0.000 0.004 0.000
#> SRR2926040 2 0.0000 0.915 0.000 1.000 0.000 0.000 0.000
#> SRR2926039 2 0.2377 0.807 0.000 0.872 0.000 0.128 0.000
#> SRR2926043 4 0.4126 0.267 0.000 0.380 0.000 0.620 0.000
#> SRR2926038 2 0.0794 0.899 0.000 0.972 0.000 0.028 0.000
#> SRR2926036 2 0.0000 0.915 0.000 1.000 0.000 0.000 0.000
#> SRR2926037 2 0.0000 0.915 0.000 1.000 0.000 0.000 0.000
#> SRR2926035 2 0.0000 0.915 0.000 1.000 0.000 0.000 0.000
#> SRR2926034 2 0.3424 0.654 0.000 0.760 0.000 0.240 0.000
#> SRR2926032 2 0.0162 0.913 0.000 0.996 0.000 0.004 0.000
#> SRR2926031 1 0.2377 0.836 0.872 0.000 0.000 0.000 0.128
#> SRR2926033 2 0.1908 0.811 0.000 0.908 0.092 0.000 0.000
#> SRR2926030 1 0.0404 0.942 0.988 0.000 0.000 0.000 0.012
#> SRR2926029 5 0.0963 0.868 0.000 0.000 0.036 0.000 0.964
#> SRR2926027 1 0.0290 0.944 0.992 0.000 0.000 0.000 0.008
#> SRR2926028 5 0.0771 0.887 0.020 0.000 0.000 0.004 0.976
#> SRR2926026 1 0.0000 0.947 1.000 0.000 0.000 0.000 0.000
#> SRR2926025 1 0.0000 0.947 1.000 0.000 0.000 0.000 0.000
#> SRR2926023 1 0.0000 0.947 1.000 0.000 0.000 0.000 0.000
#> SRR2926022 1 0.0794 0.933 0.972 0.000 0.000 0.000 0.028
#> SRR2926024 1 0.0162 0.946 0.996 0.000 0.000 0.004 0.000
#> SRR2926021 5 0.2377 0.819 0.128 0.000 0.000 0.000 0.872
#> SRR2926020 1 0.0000 0.947 1.000 0.000 0.000 0.000 0.000
#> SRR2926019 1 0.0000 0.947 1.000 0.000 0.000 0.000 0.000
#> SRR2926018 1 0.0000 0.947 1.000 0.000 0.000 0.000 0.000
#> SRR2926017 1 0.4211 0.395 0.636 0.000 0.000 0.004 0.360
#> SRR2926016 4 0.0794 0.565 0.000 0.000 0.000 0.972 0.028
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> SRR2926066 3 0.4252 0.5715 0.000 0.000 0.652 0.312 0.000 NA
#> SRR2926067 3 0.4361 0.5861 0.000 0.224 0.716 0.020 0.000 NA
#> SRR2926063 3 0.0520 0.8300 0.000 0.000 0.984 0.008 0.000 NA
#> SRR2926064 2 0.4343 0.2215 0.000 0.592 0.004 0.384 0.000 NA
#> SRR2926062 4 0.3672 0.5662 0.000 0.304 0.000 0.688 0.000 NA
#> SRR2926061 2 0.4874 0.4156 0.000 0.664 0.248 0.016 0.000 NA
#> SRR2926065 4 0.3546 0.5222 0.000 0.004 0.076 0.808 0.000 NA
#> SRR2926060 2 0.2638 0.7786 0.000 0.888 0.032 0.044 0.000 NA
#> SRR2926059 3 0.2544 0.8166 0.000 0.004 0.852 0.004 0.000 NA
#> SRR2926058 3 0.3876 0.7740 0.000 0.000 0.772 0.068 0.004 NA
#> SRR2926056 3 0.4085 0.7241 0.000 0.000 0.748 0.000 0.096 NA
#> SRR2926057 3 0.2823 0.7703 0.000 0.000 0.796 0.000 0.000 NA
#> SRR2926055 3 0.5267 0.5062 0.000 0.088 0.640 0.244 0.000 NA
#> SRR2926054 3 0.1444 0.8290 0.000 0.000 0.928 0.000 0.000 NA
#> SRR2926051 3 0.1391 0.8277 0.000 0.000 0.944 0.016 0.000 NA
#> SRR2926052 3 0.2509 0.8148 0.000 0.000 0.876 0.036 0.000 NA
#> SRR2926053 3 0.0405 0.8305 0.000 0.000 0.988 0.004 0.000 NA
#> SRR2926050 3 0.2048 0.8119 0.000 0.000 0.880 0.000 0.000 NA
#> SRR2926049 2 0.0717 0.8238 0.000 0.976 0.000 0.016 0.000 NA
#> SRR2926047 2 0.0547 0.8188 0.000 0.980 0.000 0.000 0.000 NA
#> SRR2926046 3 0.2378 0.7974 0.000 0.000 0.848 0.000 0.000 NA
#> SRR2926048 2 0.0405 0.8256 0.000 0.988 0.000 0.008 0.000 NA
#> SRR2926044 2 0.0000 0.8248 0.000 1.000 0.000 0.000 0.000 NA
#> SRR2926045 3 0.0891 0.8285 0.000 0.000 0.968 0.008 0.000 NA
#> SRR2926041 2 0.0000 0.8248 0.000 1.000 0.000 0.000 0.000 NA
#> SRR2926042 2 0.0260 0.8254 0.000 0.992 0.000 0.008 0.000 NA
#> SRR2926040 2 0.0458 0.8252 0.000 0.984 0.000 0.016 0.000 NA
#> SRR2926039 2 0.4039 0.1706 0.000 0.568 0.000 0.424 0.000 NA
#> SRR2926043 4 0.3867 0.5480 0.000 0.328 0.000 0.660 0.000 NA
#> SRR2926038 2 0.3634 0.5046 0.000 0.696 0.000 0.296 0.000 NA
#> SRR2926036 2 0.0777 0.8206 0.000 0.972 0.000 0.004 0.000 NA
#> SRR2926037 2 0.0000 0.8248 0.000 1.000 0.000 0.000 0.000 NA
#> SRR2926035 2 0.0717 0.8238 0.000 0.976 0.000 0.016 0.000 NA
#> SRR2926034 2 0.3945 0.2642 0.000 0.612 0.000 0.380 0.000 NA
#> SRR2926032 2 0.0632 0.8211 0.000 0.976 0.000 0.024 0.000 NA
#> SRR2926031 1 0.2537 0.8162 0.872 0.000 0.000 0.000 0.096 NA
#> SRR2926033 2 0.2662 0.6843 0.000 0.840 0.152 0.004 0.000 NA
#> SRR2926030 1 0.0790 0.9067 0.968 0.000 0.000 0.000 0.000 NA
#> SRR2926029 5 0.5731 0.4887 0.000 0.000 0.212 0.000 0.512 NA
#> SRR2926027 1 0.5548 -0.0378 0.464 0.000 0.000 0.000 0.400 NA
#> SRR2926028 5 0.1327 0.7038 0.000 0.000 0.000 0.000 0.936 NA
#> SRR2926026 1 0.0000 0.9249 1.000 0.000 0.000 0.000 0.000 NA
#> SRR2926025 1 0.0000 0.9249 1.000 0.000 0.000 0.000 0.000 NA
#> SRR2926023 1 0.0000 0.9249 1.000 0.000 0.000 0.000 0.000 NA
#> SRR2926022 1 0.0000 0.9249 1.000 0.000 0.000 0.000 0.000 NA
#> SRR2926024 1 0.0146 0.9231 0.996 0.000 0.000 0.000 0.000 NA
#> SRR2926021 5 0.0458 0.7095 0.016 0.000 0.000 0.000 0.984 NA
#> SRR2926020 1 0.0000 0.9249 1.000 0.000 0.000 0.000 0.000 NA
#> SRR2926019 1 0.0000 0.9249 1.000 0.000 0.000 0.000 0.000 NA
#> SRR2926018 1 0.0508 0.9172 0.984 0.000 0.000 0.000 0.012 NA
#> SRR2926017 5 0.5579 0.5515 0.092 0.000 0.020 0.000 0.536 NA
#> SRR2926016 4 0.1462 0.5173 0.000 0.000 0.000 0.936 0.008 NA
Heatmaps for the consensus matrix. It visualizes the probability of two samples to be in a same group.
consensus_heatmap(res, k = 2)
consensus_heatmap(res, k = 3)
consensus_heatmap(res, k = 4)
consensus_heatmap(res, k = 5)
consensus_heatmap(res, k = 6)
Heatmaps for the membership of samples in all partitions to see how consistent they are:
membership_heatmap(res, k = 2)
membership_heatmap(res, k = 3)
membership_heatmap(res, k = 4)
membership_heatmap(res, k = 5)
membership_heatmap(res, k = 6)
As soon as we have had the classes for columns, we can look for signatures which are significantly different between classes which can be candidate marks for certain classes. Following are the heatmaps for signatures.
Signature heatmaps where rows are scaled:
get_signatures(res, k = 2)
get_signatures(res, k = 3)
get_signatures(res, k = 4)
get_signatures(res, k = 5)
get_signatures(res, k = 6)
Signature heatmaps where rows are not scaled:
get_signatures(res, k = 2, scale_rows = FALSE)
get_signatures(res, k = 3, scale_rows = FALSE)
get_signatures(res, k = 4, scale_rows = FALSE)
get_signatures(res, k = 5, scale_rows = FALSE)
get_signatures(res, k = 6, scale_rows = FALSE)
Compare the overlap of signatures from different k:
compare_signatures(res)
get_signature()
returns a data frame invisibly. TO get the list of signatures, the function
call should be assigned to a variable explicitly. In following code, if plot
argument is set
to FALSE
, no heatmap is plotted while only the differential analysis is performed.
# code only for demonstration
tb = get_signature(res, k = ..., plot = FALSE)
An example of the output of tb
is:
#> which_row fdr mean_1 mean_2 scaled_mean_1 scaled_mean_2 km
#> 1 38 0.042760348 8.373488 9.131774 -0.5533452 0.5164555 1
#> 2 40 0.018707592 7.106213 8.469186 -0.6173731 0.5762149 1
#> 3 55 0.019134737 10.221463 11.207825 -0.6159697 0.5749050 1
#> 4 59 0.006059896 5.921854 7.869574 -0.6899429 0.6439467 1
#> 5 60 0.018055526 8.928898 10.211722 -0.6204761 0.5791110 1
#> 6 98 0.009384629 15.714769 14.887706 0.6635654 -0.6193277 2
...
The columns in tb
are:
which_row
: row indices corresponding to the input matrix.fdr
: FDR for the differential test. mean_x
: The mean value in group x.scaled_mean_x
: The mean value in group x after rows are scaled.km
: Row groups if k-means clustering is applied to rows.UMAP plot which shows how samples are separated.
dimension_reduction(res, k = 2, method = "UMAP")
dimension_reduction(res, k = 3, method = "UMAP")
dimension_reduction(res, k = 4, method = "UMAP")
dimension_reduction(res, k = 5, method = "UMAP")
dimension_reduction(res, k = 6, method = "UMAP")
Following heatmap shows how subgroups are split when increasing k
:
collect_classes(res)
If matrix rows can be associated to genes, consider to use functional_enrichment(res,
...)
to perform function enrichment for the signature genes. See this vignette for more detailed explanations.
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