Date: 2019-12-25 21:48:49 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 51941 rows and 65 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, anno = anno)
Dimension of the input matrix:
mat = get_matrix(res_list)
dim(mat)
#> [1] 51941 65
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, top_annotation = HeatmapAnnotation(df = get_anno(res_list),
col = get_anno_col(res_list)), ylab = "value", cluster_columns = TRUE, show_column_names = FALSE,
mc.cores = 4)
Folowing table shows the best k
(number of partitions) for each combination
of top-value methods and partition methods. Clicking on the method name in
the table goes to the section for a single combination of methods.
The cola vignette explains the definition of the metrics used for determining the best number of partitions.
suggest_best_k(res_list)
The best k | 1-PAC | Mean silhouette | Concordance | Optional k | ||
---|---|---|---|---|---|---|
SD:hclust | 2 | 1.000 | 0.986 | 0.992 | ** | |
CV:hclust | 2 | 1.000 | 0.996 | 0.998 | ** | |
CV:skmeans | 3 | 1.000 | 0.961 | 0.976 | ** | 2 |
CV:mclust | 3 | 1.000 | 0.945 | 0.979 | ** | |
CV:NMF | 3 | 1.000 | 0.958 | 0.984 | ** | 2 |
MAD:NMF | 4 | 1.000 | 0.962 | 0.984 | ** | 3 |
ATC:hclust | 2 | 1.000 | 1.000 | 1.000 | ** | |
ATC:kmeans | 2 | 1.000 | 1.000 | 1.000 | ** | |
SD:mclust | 5 | 0.975 | 0.949 | 0.978 | ** | 2,3 |
MAD:mclust | 5 | 0.971 | 0.954 | 0.976 | ** | 2 |
ATC:pam | 4 | 0.966 | 0.910 | 0.962 | ** | 2 |
SD:skmeans | 6 | 0.954 | 0.922 | 0.948 | ** | 2,3,4 |
CV:pam | 5 | 0.944 | 0.915 | 0.964 | * | 2,3 |
ATC:skmeans | 4 | 0.933 | 0.917 | 0.959 | * | 2,3 |
ATC:NMF | 3 | 0.930 | 0.929 | 0.969 | * | 2 |
MAD:hclust | 4 | 0.926 | 0.931 | 0.971 | * | 3 |
SD:pam | 6 | 0.925 | 0.846 | 0.940 | * | 5 |
MAD:pam | 5 | 0.914 | 0.876 | 0.948 | * | 2,3,4 |
SD:NMF | 6 | 0.909 | 0.853 | 0.927 | * | 2,3,4 |
MAD:skmeans | 6 | 0.903 | 0.882 | 0.917 | * | 3,4 |
ATC:mclust | 2 | 0.881 | 0.957 | 0.982 | ||
SD:kmeans | 3 | 0.770 | 0.839 | 0.884 | ||
MAD:kmeans | 2 | 0.754 | 0.863 | 0.938 | ||
CV:kmeans | 3 | 0.712 | 0.822 | 0.868 |
**: 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.904 0.927 0.964 0.487 0.502 0.502
#> CV:NMF 2 0.933 0.920 0.967 0.471 0.519 0.519
#> MAD:NMF 2 0.843 0.889 0.955 0.496 0.502 0.502
#> ATC:NMF 2 1.000 0.995 0.997 0.473 0.527 0.527
#> SD:skmeans 2 1.000 0.985 0.992 0.506 0.493 0.493
#> CV:skmeans 2 1.000 0.988 0.994 0.504 0.495 0.495
#> MAD:skmeans 2 0.781 0.945 0.970 0.505 0.493 0.493
#> ATC:skmeans 2 1.000 1.000 1.000 0.474 0.527 0.527
#> SD:mclust 2 1.000 0.989 0.994 0.467 0.536 0.536
#> CV:mclust 2 0.694 0.958 0.948 0.449 0.536 0.536
#> MAD:mclust 2 1.000 0.990 0.994 0.466 0.536 0.536
#> ATC:mclust 2 0.881 0.957 0.982 0.466 0.536 0.536
#> SD:kmeans 2 0.299 0.765 0.847 0.418 0.502 0.502
#> CV:kmeans 2 0.336 0.521 0.777 0.384 0.805 0.805
#> MAD:kmeans 2 0.754 0.863 0.938 0.480 0.536 0.536
#> ATC:kmeans 2 1.000 1.000 1.000 0.455 0.545 0.545
#> SD:pam 2 0.467 0.827 0.806 0.384 0.502 0.502
#> CV:pam 2 1.000 0.977 0.978 0.209 0.805 0.805
#> MAD:pam 2 1.000 0.965 0.985 0.504 0.495 0.495
#> ATC:pam 2 1.000 1.000 1.000 0.455 0.545 0.545
#> SD:hclust 2 1.000 0.986 0.992 0.206 0.805 0.805
#> CV:hclust 2 1.000 0.996 0.998 0.198 0.805 0.805
#> MAD:hclust 2 0.524 0.850 0.890 0.260 0.830 0.830
#> ATC:hclust 2 1.000 1.000 1.000 0.455 0.545 0.545
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.227 0.845 0.708
#> CV:NMF 3 1.000 0.958 0.984 0.271 0.789 0.627
#> MAD:NMF 3 1.000 0.967 0.986 0.209 0.888 0.781
#> ATC:NMF 3 0.930 0.929 0.969 0.249 0.832 0.699
#> SD:skmeans 3 0.998 0.961 0.972 0.192 0.912 0.821
#> CV:skmeans 3 1.000 0.961 0.976 0.193 0.888 0.779
#> MAD:skmeans 3 1.000 0.926 0.964 0.214 0.912 0.821
#> ATC:skmeans 3 1.000 0.984 0.983 0.265 0.873 0.759
#> SD:mclust 3 0.961 0.920 0.967 0.299 0.869 0.756
#> CV:mclust 3 1.000 0.945 0.979 0.297 0.882 0.780
#> MAD:mclust 3 0.893 0.936 0.963 0.340 0.827 0.677
#> ATC:mclust 3 0.799 0.847 0.925 0.347 0.846 0.713
#> SD:kmeans 3 0.770 0.839 0.884 0.454 0.875 0.762
#> CV:kmeans 3 0.712 0.822 0.868 0.564 0.619 0.527
#> MAD:kmeans 3 0.622 0.785 0.857 0.256 0.896 0.806
#> ATC:kmeans 3 0.663 0.816 0.842 0.277 0.893 0.804
#> SD:pam 3 0.889 0.926 0.969 0.548 0.872 0.751
#> CV:pam 3 0.972 0.908 0.965 1.740 0.619 0.527
#> MAD:pam 3 0.973 0.931 0.975 0.176 0.916 0.831
#> ATC:pam 3 0.795 0.964 0.926 0.261 0.893 0.804
#> SD:hclust 3 0.617 0.895 0.940 1.703 0.613 0.519
#> CV:hclust 3 0.760 0.813 0.908 1.569 0.704 0.632
#> MAD:hclust 3 1.000 0.960 0.986 1.218 0.596 0.513
#> ATC:hclust 3 0.750 0.771 0.869 0.330 0.893 0.804
get_stats(res_list, k = 4)
#> k 1-PAC mean_silhouette concordance area_increased Rand Jaccard
#> SD:NMF 4 0.999 0.936 0.975 0.1812 0.876 0.704
#> CV:NMF 4 0.846 0.881 0.936 0.1993 0.848 0.638
#> MAD:NMF 4 1.000 0.962 0.984 0.1798 0.885 0.715
#> ATC:NMF 4 0.681 0.718 0.857 0.1709 0.896 0.757
#> SD:skmeans 4 0.922 0.952 0.972 0.1914 0.863 0.665
#> CV:skmeans 4 0.811 0.887 0.933 0.1994 0.869 0.681
#> MAD:skmeans 4 1.000 0.970 0.988 0.1634 0.885 0.715
#> ATC:skmeans 4 0.933 0.917 0.959 0.1601 0.889 0.725
#> SD:mclust 4 0.852 0.558 0.809 0.1058 0.839 0.619
#> CV:mclust 4 0.782 0.755 0.848 0.1861 0.880 0.712
#> MAD:mclust 4 0.847 0.933 0.928 0.0901 0.844 0.622
#> ATC:mclust 4 0.815 0.832 0.916 0.1126 0.887 0.715
#> SD:kmeans 4 0.715 0.843 0.881 0.1512 0.880 0.712
#> CV:kmeans 4 0.666 0.777 0.805 0.1643 0.875 0.705
#> MAD:kmeans 4 0.862 0.835 0.890 0.1453 0.860 0.678
#> ATC:kmeans 4 0.611 0.527 0.727 0.1815 0.951 0.888
#> SD:pam 4 0.797 0.825 0.912 0.1994 0.851 0.644
#> CV:pam 4 0.810 0.781 0.897 0.2377 0.868 0.688
#> MAD:pam 4 0.936 0.878 0.944 0.2048 0.815 0.582
#> ATC:pam 4 0.966 0.910 0.962 0.2500 0.850 0.658
#> SD:hclust 4 0.846 0.801 0.893 0.2542 0.906 0.774
#> CV:hclust 4 0.551 0.684 0.817 0.2960 0.837 0.679
#> MAD:hclust 4 0.926 0.931 0.971 0.1214 0.940 0.860
#> ATC:hclust 4 0.771 0.746 0.819 0.1203 0.899 0.770
get_stats(res_list, k = 5)
#> k 1-PAC mean_silhouette concordance area_increased Rand Jaccard
#> SD:NMF 5 0.816 0.833 0.895 0.1102 0.886 0.641
#> CV:NMF 5 0.778 0.738 0.845 0.0906 0.901 0.672
#> MAD:NMF 5 0.825 0.810 0.881 0.0986 0.896 0.658
#> ATC:NMF 5 0.666 0.624 0.761 0.0714 0.938 0.814
#> SD:skmeans 5 0.866 0.930 0.933 0.0843 0.934 0.767
#> CV:skmeans 5 0.795 0.888 0.869 0.0840 0.933 0.767
#> MAD:skmeans 5 0.870 0.958 0.937 0.0851 0.938 0.784
#> ATC:skmeans 5 0.851 0.860 0.913 0.0512 0.974 0.913
#> SD:mclust 5 0.975 0.949 0.978 0.0513 0.812 0.506
#> CV:mclust 5 0.695 0.796 0.829 0.0670 0.827 0.554
#> MAD:mclust 5 0.971 0.954 0.976 0.0723 0.781 0.443
#> ATC:mclust 5 0.759 0.787 0.836 0.0803 0.870 0.633
#> SD:kmeans 5 0.748 0.768 0.726 0.0915 0.920 0.742
#> CV:kmeans 5 0.699 0.636 0.803 0.0824 0.979 0.932
#> MAD:kmeans 5 0.751 0.816 0.792 0.0942 0.933 0.780
#> ATC:kmeans 5 0.623 0.546 0.726 0.0771 0.853 0.632
#> SD:pam 5 0.931 0.872 0.950 0.0972 0.902 0.675
#> CV:pam 5 0.944 0.915 0.964 0.0920 0.918 0.728
#> MAD:pam 5 0.914 0.876 0.948 0.0947 0.904 0.680
#> ATC:pam 5 0.863 0.866 0.916 0.0652 0.950 0.825
#> SD:hclust 5 0.789 0.833 0.846 0.1020 0.891 0.674
#> CV:hclust 5 0.592 0.541 0.735 0.1408 0.850 0.570
#> MAD:hclust 5 0.745 0.725 0.855 0.1295 0.938 0.829
#> ATC:hclust 5 0.786 0.722 0.856 0.0425 0.950 0.852
get_stats(res_list, k = 6)
#> k 1-PAC mean_silhouette concordance area_increased Rand Jaccard
#> SD:NMF 6 0.909 0.853 0.927 0.0645 0.897 0.573
#> CV:NMF 6 0.866 0.850 0.916 0.0659 0.919 0.645
#> MAD:NMF 6 0.843 0.880 0.914 0.0658 0.911 0.621
#> ATC:NMF 6 0.719 0.617 0.757 0.0384 0.897 0.664
#> SD:skmeans 6 0.954 0.922 0.948 0.0748 0.926 0.674
#> CV:skmeans 6 0.869 0.831 0.896 0.0693 0.931 0.694
#> MAD:skmeans 6 0.903 0.882 0.917 0.0756 0.921 0.659
#> ATC:skmeans 6 0.839 0.690 0.854 0.0414 0.952 0.827
#> SD:mclust 6 0.826 0.848 0.896 0.1209 0.923 0.741
#> CV:mclust 6 0.783 0.754 0.848 0.0745 0.900 0.672
#> MAD:mclust 6 0.861 0.929 0.936 0.0708 0.950 0.814
#> ATC:mclust 6 0.822 0.612 0.814 0.0676 0.858 0.523
#> SD:kmeans 6 0.734 0.850 0.836 0.0642 0.909 0.632
#> CV:kmeans 6 0.773 0.744 0.785 0.0690 0.883 0.598
#> MAD:kmeans 6 0.751 0.829 0.811 0.0622 0.909 0.635
#> ATC:kmeans 6 0.654 0.558 0.715 0.0591 0.918 0.705
#> SD:pam 6 0.925 0.846 0.940 0.0228 0.986 0.934
#> CV:pam 6 0.838 0.816 0.880 0.0425 0.987 0.941
#> MAD:pam 6 0.880 0.852 0.927 0.0249 0.983 0.920
#> ATC:pam 6 0.888 0.866 0.921 0.0470 0.962 0.838
#> SD:hclust 6 0.820 0.785 0.865 0.0583 0.952 0.796
#> CV:hclust 6 0.632 0.743 0.787 0.0690 0.900 0.581
#> MAD:hclust 6 0.819 0.784 0.888 0.0853 0.931 0.774
#> ATC:hclust 6 0.777 0.754 0.816 0.0166 0.893 0.699
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)
Test correlation between subgroups and known annotations. If the known annotation is numeric, one-way ANOVA test is applied, and if the known annotation is discrete, chi-squared contingency table test is applied.
test_to_known_factors(res_list, k = 2)
#> n disease.state(p) tissue(p) k
#> SD:NMF 64 8.98e-07 0.11209 2
#> CV:NMF 62 2.77e-04 0.40102 2
#> MAD:NMF 62 3.60e-11 0.01099 2
#> ATC:NMF 65 5.10e-14 0.01293 2
#> SD:skmeans 65 2.12e-09 0.01293 2
#> CV:skmeans 65 1.48e-08 0.02827 2
#> MAD:skmeans 65 2.12e-09 0.01293 2
#> ATC:skmeans 65 5.10e-14 0.01293 2
#> SD:mclust 65 6.65e-15 0.01293 2
#> CV:mclust 65 6.65e-15 0.01293 2
#> MAD:mclust 65 6.65e-15 0.01293 2
#> ATC:mclust 64 1.14e-14 0.01594 2
#> SD:kmeans 56 6.10e-13 0.01357 2
#> CV:kmeans 44 1.00e+00 0.38691 2
#> MAD:kmeans 57 3.47e-13 0.00802 2
#> ATC:kmeans 65 5.53e-14 0.03069 2
#> SD:pam 63 1.01e-10 0.01163 2
#> CV:pam 65 9.81e-02 0.01293 2
#> MAD:pam 64 2.60e-10 0.01227 2
#> ATC:pam 65 5.53e-14 0.03069 2
#> SD:hclust 65 9.81e-02 0.01293 2
#> CV:hclust 65 9.81e-02 0.01293 2
#> MAD:hclust 65 1.46e-01 0.01293 2
#> ATC:hclust 65 5.53e-14 0.03069 2
test_to_known_factors(res_list, k = 3)
#> n disease.state(p) tissue(p) k
#> SD:NMF 65 7.68e-15 0.000962 3
#> CV:NMF 64 1.27e-14 0.001417 3
#> MAD:NMF 65 7.68e-15 0.000962 3
#> ATC:NMF 63 2.09e-14 0.001296 3
#> SD:skmeans 65 7.68e-15 0.000962 3
#> CV:skmeans 65 7.68e-15 0.000962 3
#> MAD:skmeans 61 5.68e-14 0.000644 3
#> ATC:skmeans 65 6.25e-14 0.000962 3
#> SD:mclust 61 5.68e-14 0.000644 3
#> CV:mclust 63 2.09e-14 0.000793 3
#> MAD:mclust 65 7.68e-15 0.000962 3
#> ATC:mclust 62 3.44e-14 0.001181 3
#> SD:kmeans 65 7.68e-15 0.000962 3
#> CV:kmeans 65 6.44e-14 0.002293 3
#> MAD:kmeans 58 2.54e-13 0.000456 3
#> ATC:kmeans 61 4.47e-13 0.001575 3
#> SD:pam 64 3.90e-10 0.000875 3
#> CV:pam 62 3.44e-14 0.002991 3
#> MAD:pam 62 2.28e-10 0.000716 3
#> ATC:pam 65 6.45e-14 0.002273 3
#> SD:hclust 65 7.68e-15 0.000962 3
#> CV:hclust 54 2.68e-11 0.063031 3
#> MAD:hclust 63 2.09e-14 0.000793 3
#> ATC:hclust 58 1.92e-12 0.001154 3
test_to_known_factors(res_list, k = 4)
#> n disease.state(p) tissue(p) k
#> SD:NMF 63 1.34e-13 1.22e-04 4
#> CV:NMF 63 1.34e-13 1.22e-04 4
#> MAD:NMF 63 1.34e-13 1.22e-04 4
#> ATC:NMF 52 3.00e-11 1.99e-05 4
#> SD:skmeans 65 3.61e-13 3.44e-04 4
#> CV:skmeans 65 3.55e-13 3.74e-04 4
#> MAD:skmeans 64 8.21e-14 1.39e-04 4
#> ATC:skmeans 63 1.34e-13 1.22e-04 4
#> SD:mclust 29 1.44e-06 6.08e-05 4
#> CV:mclust 57 2.57e-12 2.24e-05 4
#> MAD:mclust 65 5.02e-14 7.89e-05 4
#> ATC:mclust 59 9.61e-13 6.90e-05 4
#> SD:kmeans 63 1.34e-13 1.22e-04 4
#> CV:kmeans 63 1.34e-13 1.22e-04 4
#> MAD:kmeans 62 2.20e-13 1.06e-04 4
#> ATC:kmeans 47 3.48e-10 6.20e-06 4
#> SD:pam 62 2.20e-13 1.06e-04 4
#> CV:pam 63 1.34e-13 1.22e-04 4
#> MAD:pam 61 3.59e-13 4.41e-05 4
#> ATC:pam 61 2.63e-12 1.32e-04 4
#> SD:hclust 62 2.20e-13 5.14e-05 4
#> CV:hclust 59 1.36e-06 3.35e-02 4
#> MAD:hclust 63 1.34e-13 5.96e-05 4
#> ATC:hclust 50 4.33e-10 4.15e-05 4
test_to_known_factors(res_list, k = 5)
#> n disease.state(p) tissue(p) k
#> SD:NMF 60 2.90e-12 4.33e-05 5
#> CV:NMF 56 2.01e-11 2.21e-05 5
#> MAD:NMF 60 2.90e-12 1.78e-05 5
#> ATC:NMF 43 3.72e-08 7.10e-07 5
#> SD:skmeans 64 4.18e-13 9.89e-02 5
#> CV:skmeans 65 2.57e-13 7.54e-02 5
#> MAD:skmeans 65 2.57e-13 7.54e-02 5
#> ATC:skmeans 60 2.90e-12 6.92e-06 5
#> SD:mclust 64 4.18e-13 6.65e-02 5
#> CV:mclust 60 2.90e-12 9.14e-02 5
#> MAD:mclust 65 2.57e-13 7.54e-02 5
#> ATC:mclust 63 1.34e-13 1.22e-04 5
#> SD:kmeans 63 6.79e-13 5.83e-02 5
#> CV:kmeans 54 1.12e-11 1.69e-02 5
#> MAD:kmeans 63 6.79e-13 8.81e-02 5
#> ATC:kmeans 49 3.55e-09 1.77e-01 5
#> SD:pam 59 4.71e-12 5.21e-02 5
#> CV:pam 63 6.79e-13 5.83e-02 5
#> MAD:pam 62 1.10e-12 5.08e-02 5
#> ATC:pam 61 1.26e-11 7.75e-02 5
#> SD:hclust 60 2.90e-12 6.00e-02 5
#> CV:hclust 37 4.60e-08 9.37e-03 5
#> MAD:hclust 56 2.01e-11 1.02e-06 5
#> ATC:hclust 60 2.90e-12 6.92e-06 5
test_to_known_factors(res_list, k = 6)
#> n disease.state(p) tissue(p) k
#> SD:NMF 60 1.22e-11 1.55e-02 6
#> CV:NMF 62 4.69e-12 1.18e-02 6
#> MAD:NMF 64 1.81e-12 8.94e-03 6
#> ATC:NMF 40 2.06e-09 3.47e-05 6
#> SD:skmeans 64 1.81e-12 1.66e-02 6
#> CV:skmeans 60 1.22e-11 8.14e-03 6
#> MAD:skmeans 62 4.69e-12 6.10e-03 6
#> ATC:skmeans 53 3.36e-10 8.95e-08 6
#> SD:mclust 65 1.12e-12 1.07e-02 6
#> CV:mclust 56 8.13e-11 3.46e-03 6
#> MAD:mclust 65 1.12e-12 1.07e-02 6
#> ATC:mclust 46 2.46e-09 1.37e-02 6
#> SD:kmeans 64 1.81e-12 8.94e-03 6
#> CV:kmeans 54 2.10e-10 2.11e-03 6
#> MAD:kmeans 64 1.81e-12 8.94e-03 6
#> ATC:kmeans 47 2.96e-08 3.25e-02 6
#> SD:pam 58 3.15e-11 5.41e-03 6
#> CV:pam 63 2.91e-12 7.42e-03 6
#> MAD:pam 61 7.55e-12 4.97e-03 6
#> ATC:pam 60 8.33e-11 1.65e-02 6
#> SD:hclust 58 3.15e-11 5.41e-03 6
#> CV:hclust 56 8.13e-11 7.28e-03 6
#> MAD:hclust 56 8.13e-11 1.53e-03 6
#> ATC:hclust 52 1.38e-10 1.12e-06 6
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 51941 rows and 65 columns.
#> Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'SD' method.
#> Subgroups are detected by 'hclust' method.
#> Performed in total 1250 partitions by row resampling.
#> Best k for subgroups seems to be 2.
#>
#> Following methods can be applied to this 'ConsensusPartition' object:
#> [1] "cola_report" "collect_classes" "collect_plots"
#> [4] "collect_stats" "colnames" "compare_signatures"
#> [7] "consensus_heatmap" "dimension_reduction" "functional_enrichment"
#> [10] "get_anno_col" "get_anno" "get_classes"
#> [13] "get_consensus" "get_matrix" "get_membership"
#> [16] "get_param" "get_signatures" "get_stats"
#> [19] "is_best_k" "is_stable_k" "membership_heatmap"
#> [22] "ncol" "nrow" "plot_ecdf"
#> [25] "rownames" "select_partition_number" "show"
#> [28] "suggest_best_k" "test_to_known_factors"
collect_plots()
function collects all the plots made from res
for all k
(number of partitions)
into one single page to provide an easy and fast comparison between different k
.
collect_plots(res)
The plots are:
k
and the heatmap of
predicted classes for each k
.k
.k
.k
.All the plots in panels can be made by individual functions and they are plotted later in this section.
select_partition_number()
produces several plots showing different
statistics for choosing “optimized” k
. There are following statistics:
k
;k
, the area increased is defined as \(A_k - A_{k-1}\).The detailed explanations of these statistics can be found in the cola vignette.
Generally speaking, lower PAC score, higher mean silhouette score or higher
concordance corresponds to better partition. Rand index and Jaccard index
measure how similar the current partition is compared to partition with k-1
.
If they are too similar, we won't accept k
is better than k-1
.
select_partition_number(res)
The numeric values for all these statistics can be obtained by get_stats()
.
get_stats(res)
#> k 1-PAC mean_silhouette concordance area_increased Rand Jaccard
#> 2 2 1.000 0.986 0.992 0.2057 0.805 0.805
#> 3 3 0.617 0.895 0.940 1.7031 0.613 0.519
#> 4 4 0.846 0.801 0.893 0.2542 0.906 0.774
#> 5 5 0.789 0.833 0.846 0.1020 0.891 0.674
#> 6 6 0.820 0.785 0.865 0.0583 0.952 0.796
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
#> GSM1060768 1 0.26 0.963 0.956 0.044
#> GSM1060769 1 0.26 0.963 0.956 0.044
#> GSM1060770 1 0.26 0.963 0.956 0.044
#> GSM1060771 1 0.00 0.991 1.000 0.000
#> GSM1060772 1 0.26 0.963 0.956 0.044
#> GSM1060773 1 0.00 0.991 1.000 0.000
#> GSM1060774 1 0.26 0.963 0.956 0.044
#> GSM1060775 1 0.26 0.963 0.956 0.044
#> GSM1060776 1 0.26 0.963 0.956 0.044
#> GSM1060777 1 0.00 0.991 1.000 0.000
#> GSM1060778 1 0.26 0.963 0.956 0.044
#> GSM1060779 1 0.26 0.963 0.956 0.044
#> GSM1060780 1 0.00 0.991 1.000 0.000
#> GSM1060781 1 0.00 0.991 1.000 0.000
#> GSM1060782 1 0.26 0.963 0.956 0.044
#> GSM1060783 1 0.00 0.991 1.000 0.000
#> GSM1060784 1 0.00 0.991 1.000 0.000
#> GSM1060785 1 0.00 0.991 1.000 0.000
#> GSM1060786 1 0.26 0.963 0.956 0.044
#> GSM1060787 1 0.00 0.991 1.000 0.000
#> GSM1060788 1 0.00 0.991 1.000 0.000
#> GSM1060789 1 0.00 0.991 1.000 0.000
#> GSM1060790 1 0.26 0.963 0.956 0.044
#> GSM1060754 1 0.00 0.991 1.000 0.000
#> GSM1060745 1 0.00 0.991 1.000 0.000
#> GSM1060756 1 0.00 0.991 1.000 0.000
#> GSM1060746 1 0.00 0.991 1.000 0.000
#> GSM1060758 1 0.00 0.991 1.000 0.000
#> GSM1060765 1 0.00 0.991 1.000 0.000
#> GSM1060732 2 0.00 1.000 0.000 1.000
#> GSM1060727 2 0.00 1.000 0.000 1.000
#> GSM1060740 1 0.00 0.991 1.000 0.000
#> GSM1060730 2 0.00 1.000 0.000 1.000
#> GSM1060737 1 0.00 0.991 1.000 0.000
#> GSM1060743 1 0.00 0.991 1.000 0.000
#> GSM1060734 1 0.00 0.991 1.000 0.000
#> GSM1060729 2 0.00 1.000 0.000 1.000
#> GSM1060744 1 0.00 0.991 1.000 0.000
#> GSM1060742 1 0.00 0.991 1.000 0.000
#> GSM1060752 1 0.00 0.991 1.000 0.000
#> GSM1060755 1 0.00 0.991 1.000 0.000
#> GSM1060761 1 0.00 0.991 1.000 0.000
#> GSM1060760 1 0.00 0.991 1.000 0.000
#> GSM1060767 1 0.00 0.991 1.000 0.000
#> GSM1060741 1 0.00 0.991 1.000 0.000
#> GSM1060759 1 0.00 0.991 1.000 0.000
#> GSM1060728 2 0.00 1.000 0.000 1.000
#> GSM1060763 1 0.00 0.991 1.000 0.000
#> GSM1060747 1 0.00 0.991 1.000 0.000
#> GSM1060764 1 0.00 0.991 1.000 0.000
#> GSM1060733 1 0.00 0.991 1.000 0.000
#> GSM1060735 1 0.00 0.991 1.000 0.000
#> GSM1060739 1 0.00 0.991 1.000 0.000
#> GSM1060753 1 0.00 0.991 1.000 0.000
#> GSM1060738 1 0.00 0.991 1.000 0.000
#> GSM1060762 1 0.00 0.991 1.000 0.000
#> GSM1060731 2 0.00 1.000 0.000 1.000
#> GSM1060750 1 0.00 0.991 1.000 0.000
#> GSM1060749 1 0.00 0.991 1.000 0.000
#> GSM1060736 1 0.00 0.991 1.000 0.000
#> GSM1060748 1 0.00 0.991 1.000 0.000
#> GSM1060751 1 0.00 0.991 1.000 0.000
#> GSM1060766 1 0.00 0.991 1.000 0.000
#> GSM1060757 1 0.00 0.991 1.000 0.000
#> GSM1060726 2 0.00 1.000 0.000 1.000
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> GSM1060768 2 0.0000 0.824 0.000 1.000 0
#> GSM1060769 2 0.0000 0.824 0.000 1.000 0
#> GSM1060770 2 0.0000 0.824 0.000 1.000 0
#> GSM1060771 2 0.4974 0.813 0.236 0.764 0
#> GSM1060772 2 0.0000 0.824 0.000 1.000 0
#> GSM1060773 2 0.5016 0.808 0.240 0.760 0
#> GSM1060774 2 0.0000 0.824 0.000 1.000 0
#> GSM1060775 2 0.0000 0.824 0.000 1.000 0
#> GSM1060776 2 0.0000 0.824 0.000 1.000 0
#> GSM1060777 2 0.4974 0.813 0.236 0.764 0
#> GSM1060778 2 0.0000 0.824 0.000 1.000 0
#> GSM1060779 2 0.0000 0.824 0.000 1.000 0
#> GSM1060780 2 0.4750 0.815 0.216 0.784 0
#> GSM1060781 2 0.4974 0.813 0.236 0.764 0
#> GSM1060782 2 0.0000 0.824 0.000 1.000 0
#> GSM1060783 2 0.4974 0.813 0.236 0.764 0
#> GSM1060784 2 0.4974 0.813 0.236 0.764 0
#> GSM1060785 2 0.4974 0.813 0.236 0.764 0
#> GSM1060786 2 0.0000 0.824 0.000 1.000 0
#> GSM1060787 2 0.4974 0.813 0.236 0.764 0
#> GSM1060788 2 0.4974 0.813 0.236 0.764 0
#> GSM1060789 2 0.4974 0.813 0.236 0.764 0
#> GSM1060790 2 0.0000 0.824 0.000 1.000 0
#> GSM1060754 1 0.0000 0.952 1.000 0.000 0
#> GSM1060745 1 0.0000 0.952 1.000 0.000 0
#> GSM1060756 1 0.0000 0.952 1.000 0.000 0
#> GSM1060746 1 0.0000 0.952 1.000 0.000 0
#> GSM1060758 1 0.4178 0.802 0.828 0.172 0
#> GSM1060765 1 0.0592 0.953 0.988 0.012 0
#> GSM1060732 3 0.0000 1.000 0.000 0.000 1
#> GSM1060727 3 0.0000 1.000 0.000 0.000 1
#> GSM1060740 1 0.0592 0.953 0.988 0.012 0
#> GSM1060730 3 0.0000 1.000 0.000 0.000 1
#> GSM1060737 1 0.0000 0.952 1.000 0.000 0
#> GSM1060743 1 0.0592 0.953 0.988 0.012 0
#> GSM1060734 1 0.0000 0.952 1.000 0.000 0
#> GSM1060729 3 0.0000 1.000 0.000 0.000 1
#> GSM1060744 1 0.0592 0.953 0.988 0.012 0
#> GSM1060742 1 0.0592 0.953 0.988 0.012 0
#> GSM1060752 1 0.0592 0.953 0.988 0.012 0
#> GSM1060755 1 0.0000 0.952 1.000 0.000 0
#> GSM1060761 1 0.4178 0.802 0.828 0.172 0
#> GSM1060760 1 0.4178 0.802 0.828 0.172 0
#> GSM1060767 1 0.0000 0.952 1.000 0.000 0
#> GSM1060741 1 0.0592 0.953 0.988 0.012 0
#> GSM1060759 1 0.4178 0.802 0.828 0.172 0
#> GSM1060728 3 0.0000 1.000 0.000 0.000 1
#> GSM1060763 1 0.0000 0.952 1.000 0.000 0
#> GSM1060747 1 0.0592 0.953 0.988 0.012 0
#> GSM1060764 1 0.0000 0.952 1.000 0.000 0
#> GSM1060733 1 0.0000 0.952 1.000 0.000 0
#> GSM1060735 1 0.0237 0.952 0.996 0.004 0
#> GSM1060739 1 0.0592 0.953 0.988 0.012 0
#> GSM1060753 1 0.4178 0.802 0.828 0.172 0
#> GSM1060738 1 0.0592 0.953 0.988 0.012 0
#> GSM1060762 1 0.0000 0.952 1.000 0.000 0
#> GSM1060731 3 0.0000 1.000 0.000 0.000 1
#> GSM1060750 1 0.4062 0.812 0.836 0.164 0
#> GSM1060749 1 0.0592 0.953 0.988 0.012 0
#> GSM1060736 1 0.0000 0.952 1.000 0.000 0
#> GSM1060748 1 0.4062 0.812 0.836 0.164 0
#> GSM1060751 1 0.0592 0.953 0.988 0.012 0
#> GSM1060766 1 0.0592 0.953 0.988 0.012 0
#> GSM1060757 1 0.0000 0.952 1.000 0.000 0
#> GSM1060726 3 0.0000 1.000 0.000 0.000 1
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> GSM1060768 2 0.4866 0.7559 0.000 0.596 0 0.404
#> GSM1060769 2 0.4866 0.7559 0.000 0.596 0 0.404
#> GSM1060770 2 0.4866 0.7559 0.000 0.596 0 0.404
#> GSM1060771 2 0.0000 0.6515 0.000 1.000 0 0.000
#> GSM1060772 2 0.4866 0.7559 0.000 0.596 0 0.404
#> GSM1060773 2 0.0188 0.6470 0.000 0.996 0 0.004
#> GSM1060774 2 0.4866 0.7559 0.000 0.596 0 0.404
#> GSM1060775 2 0.4866 0.7559 0.000 0.596 0 0.404
#> GSM1060776 2 0.4866 0.7559 0.000 0.596 0 0.404
#> GSM1060777 2 0.0000 0.6515 0.000 1.000 0 0.000
#> GSM1060778 2 0.4866 0.7559 0.000 0.596 0 0.404
#> GSM1060779 2 0.4866 0.7559 0.000 0.596 0 0.404
#> GSM1060780 2 0.0707 0.6566 0.000 0.980 0 0.020
#> GSM1060781 2 0.0000 0.6515 0.000 1.000 0 0.000
#> GSM1060782 2 0.4866 0.7559 0.000 0.596 0 0.404
#> GSM1060783 2 0.0000 0.6515 0.000 1.000 0 0.000
#> GSM1060784 2 0.0000 0.6515 0.000 1.000 0 0.000
#> GSM1060785 2 0.0000 0.6515 0.000 1.000 0 0.000
#> GSM1060786 2 0.4866 0.7559 0.000 0.596 0 0.404
#> GSM1060787 2 0.0000 0.6515 0.000 1.000 0 0.000
#> GSM1060788 2 0.0000 0.6515 0.000 1.000 0 0.000
#> GSM1060789 2 0.0000 0.6515 0.000 1.000 0 0.000
#> GSM1060790 2 0.4866 0.7559 0.000 0.596 0 0.404
#> GSM1060754 1 0.0000 0.9160 1.000 0.000 0 0.000
#> GSM1060745 1 0.0000 0.9160 1.000 0.000 0 0.000
#> GSM1060756 1 0.0000 0.9160 1.000 0.000 0 0.000
#> GSM1060746 1 0.0000 0.9160 1.000 0.000 0 0.000
#> GSM1060758 4 0.5039 0.8892 0.004 0.404 0 0.592
#> GSM1060765 1 0.0707 0.9137 0.980 0.020 0 0.000
#> GSM1060732 3 0.0000 1.0000 0.000 0.000 1 0.000
#> GSM1060727 3 0.0000 1.0000 0.000 0.000 1 0.000
#> GSM1060740 1 0.0921 0.9111 0.972 0.028 0 0.000
#> GSM1060730 3 0.0000 1.0000 0.000 0.000 1 0.000
#> GSM1060737 1 0.0188 0.9147 0.996 0.000 0 0.004
#> GSM1060743 1 0.0921 0.9111 0.972 0.028 0 0.000
#> GSM1060734 1 0.0000 0.9160 1.000 0.000 0 0.000
#> GSM1060729 3 0.0000 1.0000 0.000 0.000 1 0.000
#> GSM1060744 1 0.1118 0.9062 0.964 0.036 0 0.000
#> GSM1060742 1 0.6140 0.0756 0.500 0.048 0 0.452
#> GSM1060752 1 0.1837 0.8948 0.944 0.028 0 0.028
#> GSM1060755 1 0.4994 0.0988 0.520 0.000 0 0.480
#> GSM1060761 4 0.5039 0.8892 0.004 0.404 0 0.592
#> GSM1060760 4 0.5039 0.8892 0.004 0.404 0 0.592
#> GSM1060767 1 0.0000 0.9160 1.000 0.000 0 0.000
#> GSM1060741 1 0.1118 0.9062 0.964 0.036 0 0.000
#> GSM1060759 4 0.5039 0.8892 0.004 0.404 0 0.592
#> GSM1060728 3 0.0000 1.0000 0.000 0.000 1 0.000
#> GSM1060763 1 0.0000 0.9160 1.000 0.000 0 0.000
#> GSM1060747 1 0.0469 0.9155 0.988 0.012 0 0.000
#> GSM1060764 1 0.0000 0.9160 1.000 0.000 0 0.000
#> GSM1060733 1 0.0000 0.9160 1.000 0.000 0 0.000
#> GSM1060735 1 0.0376 0.9141 0.992 0.004 0 0.004
#> GSM1060739 1 0.0921 0.9111 0.972 0.028 0 0.000
#> GSM1060753 4 0.6296 0.8738 0.064 0.388 0 0.548
#> GSM1060738 1 0.0921 0.9111 0.972 0.028 0 0.000
#> GSM1060762 1 0.0817 0.9059 0.976 0.024 0 0.000
#> GSM1060731 3 0.0000 1.0000 0.000 0.000 1 0.000
#> GSM1060750 4 0.7453 0.7821 0.192 0.324 0 0.484
#> GSM1060749 1 0.4590 0.6880 0.772 0.036 0 0.192
#> GSM1060736 1 0.0188 0.9147 0.996 0.000 0 0.004
#> GSM1060748 4 0.7453 0.7821 0.192 0.324 0 0.484
#> GSM1060751 1 0.0469 0.9155 0.988 0.012 0 0.000
#> GSM1060766 1 0.0921 0.9111 0.972 0.028 0 0.000
#> GSM1060757 1 0.4994 0.0988 0.520 0.000 0 0.480
#> GSM1060726 3 0.0000 1.0000 0.000 0.000 1 0.000
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> GSM1060768 5 0.000 0.961 0.000 0.000 0 0.000 1.000
#> GSM1060769 5 0.000 0.961 0.000 0.000 0 0.000 1.000
#> GSM1060770 5 0.000 0.961 0.000 0.000 0 0.000 1.000
#> GSM1060771 2 0.191 0.999 0.000 0.908 0 0.000 0.092
#> GSM1060772 5 0.000 0.961 0.000 0.000 0 0.000 1.000
#> GSM1060773 2 0.185 0.993 0.000 0.912 0 0.000 0.088
#> GSM1060774 5 0.000 0.961 0.000 0.000 0 0.000 1.000
#> GSM1060775 5 0.000 0.961 0.000 0.000 0 0.000 1.000
#> GSM1060776 5 0.000 0.961 0.000 0.000 0 0.000 1.000
#> GSM1060777 2 0.191 0.999 0.000 0.908 0 0.000 0.092
#> GSM1060778 5 0.000 0.961 0.000 0.000 0 0.000 1.000
#> GSM1060779 5 0.000 0.961 0.000 0.000 0 0.000 1.000
#> GSM1060780 5 0.415 0.175 0.000 0.388 0 0.000 0.612
#> GSM1060781 2 0.191 0.999 0.000 0.908 0 0.000 0.092
#> GSM1060782 5 0.000 0.961 0.000 0.000 0 0.000 1.000
#> GSM1060783 2 0.191 0.999 0.000 0.908 0 0.000 0.092
#> GSM1060784 2 0.191 0.999 0.000 0.908 0 0.000 0.092
#> GSM1060785 2 0.191 0.999 0.000 0.908 0 0.000 0.092
#> GSM1060786 5 0.000 0.961 0.000 0.000 0 0.000 1.000
#> GSM1060787 2 0.191 0.999 0.000 0.908 0 0.000 0.092
#> GSM1060788 2 0.191 0.999 0.000 0.908 0 0.000 0.092
#> GSM1060789 2 0.191 0.999 0.000 0.908 0 0.000 0.092
#> GSM1060790 5 0.000 0.961 0.000 0.000 0 0.000 1.000
#> GSM1060754 1 0.277 0.825 0.836 0.000 0 0.164 0.000
#> GSM1060745 1 0.300 0.821 0.840 0.012 0 0.148 0.000
#> GSM1060756 1 0.252 0.831 0.860 0.000 0 0.140 0.000
#> GSM1060746 1 0.238 0.836 0.872 0.000 0 0.128 0.000
#> GSM1060758 4 0.422 0.627 0.000 0.416 0 0.584 0.000
#> GSM1060765 1 0.272 0.829 0.872 0.020 0 0.108 0.000
#> GSM1060732 3 0.000 1.000 0.000 0.000 1 0.000 0.000
#> GSM1060727 3 0.000 1.000 0.000 0.000 1 0.000 0.000
#> GSM1060740 1 0.167 0.823 0.940 0.032 0 0.028 0.000
#> GSM1060730 3 0.000 1.000 0.000 0.000 1 0.000 0.000
#> GSM1060737 1 0.374 0.767 0.732 0.004 0 0.264 0.000
#> GSM1060743 1 0.149 0.827 0.948 0.028 0 0.024 0.000
#> GSM1060734 1 0.429 0.762 0.664 0.012 0 0.324 0.000
#> GSM1060729 3 0.000 1.000 0.000 0.000 1 0.000 0.000
#> GSM1060744 1 0.334 0.805 0.836 0.040 0 0.124 0.000
#> GSM1060742 4 0.511 0.348 0.356 0.048 0 0.596 0.000
#> GSM1060752 1 0.221 0.808 0.912 0.032 0 0.056 0.000
#> GSM1060755 4 0.389 0.408 0.320 0.000 0 0.680 0.000
#> GSM1060761 4 0.422 0.627 0.000 0.416 0 0.584 0.000
#> GSM1060760 4 0.422 0.627 0.000 0.416 0 0.584 0.000
#> GSM1060767 1 0.300 0.821 0.840 0.012 0 0.148 0.000
#> GSM1060741 1 0.334 0.805 0.836 0.040 0 0.124 0.000
#> GSM1060759 4 0.422 0.627 0.000 0.416 0 0.584 0.000
#> GSM1060728 3 0.000 1.000 0.000 0.000 1 0.000 0.000
#> GSM1060763 1 0.353 0.778 0.744 0.000 0 0.256 0.000
#> GSM1060747 1 0.272 0.819 0.864 0.012 0 0.124 0.000
#> GSM1060764 1 0.247 0.835 0.864 0.000 0 0.136 0.000
#> GSM1060733 1 0.429 0.762 0.664 0.012 0 0.324 0.000
#> GSM1060735 1 0.384 0.776 0.732 0.008 0 0.260 0.000
#> GSM1060739 1 0.167 0.823 0.940 0.032 0 0.028 0.000
#> GSM1060753 4 0.499 0.640 0.036 0.384 0 0.580 0.000
#> GSM1060738 1 0.167 0.823 0.940 0.032 0 0.028 0.000
#> GSM1060762 1 0.405 0.810 0.760 0.036 0 0.204 0.000
#> GSM1060731 3 0.000 1.000 0.000 0.000 1 0.000 0.000
#> GSM1060750 4 0.601 0.628 0.136 0.320 0 0.544 0.000
#> GSM1060749 1 0.443 0.491 0.700 0.032 0 0.268 0.000
#> GSM1060736 1 0.374 0.767 0.732 0.004 0 0.264 0.000
#> GSM1060748 4 0.601 0.628 0.136 0.320 0 0.544 0.000
#> GSM1060751 1 0.267 0.821 0.868 0.012 0 0.120 0.000
#> GSM1060766 1 0.183 0.830 0.932 0.028 0 0.040 0.000
#> GSM1060757 4 0.389 0.408 0.320 0.000 0 0.680 0.000
#> GSM1060726 3 0.000 1.000 0.000 0.000 1 0.000 0.000
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> GSM1060768 5 0.0000 0.962 0.000 0.000 0 0.000 1.000 0.000
#> GSM1060769 5 0.0000 0.962 0.000 0.000 0 0.000 1.000 0.000
#> GSM1060770 5 0.0000 0.962 0.000 0.000 0 0.000 1.000 0.000
#> GSM1060771 2 0.0146 0.999 0.000 0.996 0 0.000 0.004 0.000
#> GSM1060772 5 0.0000 0.962 0.000 0.000 0 0.000 1.000 0.000
#> GSM1060773 2 0.0000 0.994 0.000 1.000 0 0.000 0.000 0.000
#> GSM1060774 5 0.0000 0.962 0.000 0.000 0 0.000 1.000 0.000
#> GSM1060775 5 0.0000 0.962 0.000 0.000 0 0.000 1.000 0.000
#> GSM1060776 5 0.0000 0.962 0.000 0.000 0 0.000 1.000 0.000
#> GSM1060777 2 0.0146 0.999 0.000 0.996 0 0.000 0.004 0.000
#> GSM1060778 5 0.0000 0.962 0.000 0.000 0 0.000 1.000 0.000
#> GSM1060779 5 0.0000 0.962 0.000 0.000 0 0.000 1.000 0.000
#> GSM1060780 5 0.3747 0.323 0.000 0.396 0 0.000 0.604 0.000
#> GSM1060781 2 0.0146 0.999 0.000 0.996 0 0.000 0.004 0.000
#> GSM1060782 5 0.0000 0.962 0.000 0.000 0 0.000 1.000 0.000
#> GSM1060783 2 0.0146 0.999 0.000 0.996 0 0.000 0.004 0.000
#> GSM1060784 2 0.0146 0.999 0.000 0.996 0 0.000 0.004 0.000
#> GSM1060785 2 0.0146 0.999 0.000 0.996 0 0.000 0.004 0.000
#> GSM1060786 5 0.0000 0.962 0.000 0.000 0 0.000 1.000 0.000
#> GSM1060787 2 0.0146 0.999 0.000 0.996 0 0.000 0.004 0.000
#> GSM1060788 2 0.0146 0.999 0.000 0.996 0 0.000 0.004 0.000
#> GSM1060789 2 0.0146 0.999 0.000 0.996 0 0.000 0.004 0.000
#> GSM1060790 5 0.0000 0.962 0.000 0.000 0 0.000 1.000 0.000
#> GSM1060754 1 0.2883 0.651 0.788 0.000 0 0.000 0.000 0.212
#> GSM1060745 6 0.3727 0.695 0.388 0.000 0 0.000 0.000 0.612
#> GSM1060756 1 0.2664 0.669 0.816 0.000 0 0.000 0.000 0.184
#> GSM1060746 1 0.2838 0.671 0.808 0.000 0 0.004 0.000 0.188
#> GSM1060758 4 0.0458 0.677 0.000 0.016 0 0.984 0.000 0.000
#> GSM1060765 1 0.2884 0.713 0.824 0.008 0 0.004 0.000 0.164
#> GSM1060732 3 0.0000 1.000 0.000 0.000 1 0.000 0.000 0.000
#> GSM1060727 3 0.0000 1.000 0.000 0.000 1 0.000 0.000 0.000
#> GSM1060740 1 0.0405 0.746 0.988 0.008 0 0.000 0.000 0.004
#> GSM1060730 3 0.0000 1.000 0.000 0.000 1 0.000 0.000 0.000
#> GSM1060737 1 0.4090 0.571 0.652 0.004 0 0.016 0.000 0.328
#> GSM1060743 1 0.0622 0.748 0.980 0.008 0 0.000 0.000 0.012
#> GSM1060734 6 0.2135 0.764 0.128 0.000 0 0.000 0.000 0.872
#> GSM1060729 3 0.0000 1.000 0.000 0.000 1 0.000 0.000 0.000
#> GSM1060744 1 0.2643 0.665 0.856 0.008 0 0.008 0.000 0.128
#> GSM1060742 4 0.6155 0.273 0.348 0.008 0 0.424 0.000 0.220
#> GSM1060752 1 0.1173 0.733 0.960 0.008 0 0.016 0.000 0.016
#> GSM1060755 4 0.5982 0.355 0.268 0.000 0 0.444 0.000 0.288
#> GSM1060761 4 0.0458 0.677 0.000 0.016 0 0.984 0.000 0.000
#> GSM1060760 4 0.0458 0.677 0.000 0.016 0 0.984 0.000 0.000
#> GSM1060767 6 0.3727 0.695 0.388 0.000 0 0.000 0.000 0.612
#> GSM1060741 1 0.2643 0.665 0.856 0.008 0 0.008 0.000 0.128
#> GSM1060759 4 0.0458 0.677 0.000 0.016 0 0.984 0.000 0.000
#> GSM1060728 3 0.0000 1.000 0.000 0.000 1 0.000 0.000 0.000
#> GSM1060763 1 0.3853 0.600 0.680 0.000 0 0.016 0.000 0.304
#> GSM1060747 1 0.3037 0.697 0.808 0.000 0 0.016 0.000 0.176
#> GSM1060764 1 0.3405 0.538 0.724 0.000 0 0.004 0.000 0.272
#> GSM1060733 6 0.2135 0.764 0.128 0.000 0 0.000 0.000 0.872
#> GSM1060735 1 0.3940 0.576 0.652 0.008 0 0.004 0.000 0.336
#> GSM1060739 1 0.0405 0.746 0.988 0.008 0 0.000 0.000 0.004
#> GSM1060753 4 0.2458 0.672 0.024 0.016 0 0.892 0.000 0.068
#> GSM1060738 1 0.0405 0.746 0.988 0.008 0 0.000 0.000 0.004
#> GSM1060762 6 0.3756 0.772 0.240 0.016 0 0.008 0.000 0.736
#> GSM1060731 3 0.0000 1.000 0.000 0.000 1 0.000 0.000 0.000
#> GSM1060750 4 0.6785 0.473 0.112 0.312 0 0.460 0.000 0.116
#> GSM1060749 1 0.4556 0.415 0.704 0.004 0 0.192 0.000 0.100
#> GSM1060736 1 0.4090 0.571 0.652 0.004 0 0.016 0.000 0.328
#> GSM1060748 4 0.6785 0.473 0.112 0.312 0 0.460 0.000 0.116
#> GSM1060751 1 0.2968 0.700 0.816 0.000 0 0.016 0.000 0.168
#> GSM1060766 1 0.1049 0.751 0.960 0.008 0 0.000 0.000 0.032
#> GSM1060757 4 0.5982 0.355 0.268 0.000 0 0.444 0.000 0.288
#> GSM1060726 3 0.0000 1.000 0.000 0.000 1 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)
Test correlation between subgroups and known annotations. If the known annotation is numeric, one-way ANOVA test is applied, and if the known annotation is discrete, chi-squared contingency table test is applied.
test_to_known_factors(res)
#> n disease.state(p) tissue(p) k
#> SD:hclust 65 9.81e-02 1.29e-02 2
#> SD:hclust 65 7.68e-15 9.62e-04 3
#> SD:hclust 62 2.20e-13 5.14e-05 4
#> SD:hclust 60 2.90e-12 6.00e-02 5
#> SD:hclust 58 3.15e-11 5.41e-03 6
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 51941 rows and 65 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.299 0.765 0.847 0.4182 0.502 0.502
#> 3 3 0.770 0.839 0.884 0.4543 0.875 0.762
#> 4 4 0.715 0.843 0.881 0.1512 0.880 0.712
#> 5 5 0.748 0.768 0.726 0.0915 0.920 0.742
#> 6 6 0.734 0.850 0.836 0.0642 0.909 0.632
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
#> GSM1060768 2 0.7299 0.772 0.204 0.796
#> GSM1060769 2 0.7299 0.772 0.204 0.796
#> GSM1060770 2 0.7299 0.772 0.204 0.796
#> GSM1060771 2 0.9686 0.630 0.396 0.604
#> GSM1060772 2 0.7299 0.772 0.204 0.796
#> GSM1060773 1 0.8661 0.410 0.712 0.288
#> GSM1060774 2 0.7299 0.772 0.204 0.796
#> GSM1060775 2 0.7299 0.772 0.204 0.796
#> GSM1060776 2 0.7299 0.772 0.204 0.796
#> GSM1060777 2 0.9686 0.630 0.396 0.604
#> GSM1060778 2 0.7299 0.772 0.204 0.796
#> GSM1060779 2 0.7299 0.772 0.204 0.796
#> GSM1060780 2 0.8861 0.715 0.304 0.696
#> GSM1060781 1 0.9881 -0.164 0.564 0.436
#> GSM1060782 2 0.7299 0.772 0.204 0.796
#> GSM1060783 2 0.9686 0.630 0.396 0.604
#> GSM1060784 2 0.9686 0.630 0.396 0.604
#> GSM1060785 2 0.9686 0.630 0.396 0.604
#> GSM1060786 2 0.7299 0.772 0.204 0.796
#> GSM1060787 2 0.9686 0.630 0.396 0.604
#> GSM1060788 2 0.9686 0.630 0.396 0.604
#> GSM1060789 2 0.9686 0.630 0.396 0.604
#> GSM1060790 2 0.7299 0.772 0.204 0.796
#> GSM1060754 1 0.0938 0.916 0.988 0.012
#> GSM1060745 1 0.0938 0.916 0.988 0.012
#> GSM1060756 1 0.0938 0.916 0.988 0.012
#> GSM1060746 1 0.0938 0.916 0.988 0.012
#> GSM1060758 1 0.6148 0.734 0.848 0.152
#> GSM1060765 1 0.0376 0.921 0.996 0.004
#> GSM1060732 2 0.8661 0.494 0.288 0.712
#> GSM1060727 2 0.8661 0.494 0.288 0.712
#> GSM1060740 1 0.0376 0.921 0.996 0.004
#> GSM1060730 2 0.8661 0.494 0.288 0.712
#> GSM1060737 1 0.1184 0.918 0.984 0.016
#> GSM1060743 1 0.0000 0.921 1.000 0.000
#> GSM1060734 1 0.0938 0.916 0.988 0.012
#> GSM1060729 2 0.8661 0.494 0.288 0.712
#> GSM1060744 1 0.0000 0.921 1.000 0.000
#> GSM1060742 1 0.0000 0.921 1.000 0.000
#> GSM1060752 1 0.0376 0.921 0.996 0.004
#> GSM1060755 1 0.0000 0.921 1.000 0.000
#> GSM1060761 1 0.6048 0.738 0.852 0.148
#> GSM1060760 1 0.6048 0.738 0.852 0.148
#> GSM1060767 1 0.0938 0.916 0.988 0.012
#> GSM1060741 1 0.0000 0.921 1.000 0.000
#> GSM1060759 1 0.6048 0.738 0.852 0.148
#> GSM1060728 2 0.9922 0.451 0.448 0.552
#> GSM1060763 1 0.0938 0.916 0.988 0.012
#> GSM1060747 1 0.0376 0.921 0.996 0.004
#> GSM1060764 1 0.0938 0.916 0.988 0.012
#> GSM1060733 1 0.0938 0.916 0.988 0.012
#> GSM1060735 1 0.0376 0.921 0.996 0.004
#> GSM1060739 1 0.0376 0.921 0.996 0.004
#> GSM1060753 1 0.0000 0.921 1.000 0.000
#> GSM1060738 1 0.0376 0.921 0.996 0.004
#> GSM1060762 1 0.6623 0.655 0.828 0.172
#> GSM1060731 2 0.8661 0.494 0.288 0.712
#> GSM1060750 1 0.3431 0.860 0.936 0.064
#> GSM1060749 1 0.0376 0.921 0.996 0.004
#> GSM1060736 1 0.1184 0.918 0.984 0.016
#> GSM1060748 1 0.3879 0.846 0.924 0.076
#> GSM1060751 1 0.0376 0.921 0.996 0.004
#> GSM1060766 1 0.0376 0.921 0.996 0.004
#> GSM1060757 1 0.0938 0.916 0.988 0.012
#> GSM1060726 2 0.8661 0.494 0.288 0.712
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> GSM1060768 2 0.5754 0.751 0.004 0.700 0.296
#> GSM1060769 2 0.5754 0.751 0.004 0.700 0.296
#> GSM1060770 2 0.5754 0.751 0.004 0.700 0.296
#> GSM1060771 2 0.0747 0.792 0.016 0.984 0.000
#> GSM1060772 2 0.2625 0.788 0.000 0.916 0.084
#> GSM1060773 2 0.2550 0.750 0.024 0.936 0.040
#> GSM1060774 2 0.5690 0.754 0.004 0.708 0.288
#> GSM1060775 2 0.5690 0.754 0.004 0.708 0.288
#> GSM1060776 2 0.5754 0.751 0.004 0.700 0.296
#> GSM1060777 2 0.0747 0.792 0.016 0.984 0.000
#> GSM1060778 2 0.5754 0.751 0.004 0.700 0.296
#> GSM1060779 2 0.5754 0.751 0.004 0.700 0.296
#> GSM1060780 2 0.1999 0.793 0.012 0.952 0.036
#> GSM1060781 2 0.2434 0.754 0.024 0.940 0.036
#> GSM1060782 2 0.5754 0.751 0.004 0.700 0.296
#> GSM1060783 2 0.0747 0.792 0.016 0.984 0.000
#> GSM1060784 2 0.0747 0.792 0.016 0.984 0.000
#> GSM1060785 2 0.0747 0.792 0.016 0.984 0.000
#> GSM1060786 2 0.5754 0.751 0.004 0.700 0.296
#> GSM1060787 2 0.0747 0.792 0.016 0.984 0.000
#> GSM1060788 2 0.0892 0.789 0.020 0.980 0.000
#> GSM1060789 2 0.0747 0.792 0.016 0.984 0.000
#> GSM1060790 2 0.5754 0.751 0.004 0.700 0.296
#> GSM1060754 1 0.0237 0.902 0.996 0.000 0.004
#> GSM1060745 1 0.0424 0.901 0.992 0.000 0.008
#> GSM1060756 1 0.0237 0.902 0.996 0.000 0.004
#> GSM1060746 1 0.0000 0.902 1.000 0.000 0.000
#> GSM1060758 1 0.7558 0.667 0.644 0.284 0.072
#> GSM1060765 1 0.1399 0.903 0.968 0.028 0.004
#> GSM1060732 3 0.3683 0.998 0.060 0.044 0.896
#> GSM1060727 3 0.3683 0.998 0.060 0.044 0.896
#> GSM1060740 1 0.1163 0.903 0.972 0.028 0.000
#> GSM1060730 3 0.3683 0.998 0.060 0.044 0.896
#> GSM1060737 1 0.1267 0.903 0.972 0.024 0.004
#> GSM1060743 1 0.1163 0.903 0.972 0.028 0.000
#> GSM1060734 1 0.0424 0.901 0.992 0.000 0.008
#> GSM1060729 3 0.3683 0.998 0.060 0.044 0.896
#> GSM1060744 1 0.0237 0.903 0.996 0.004 0.000
#> GSM1060742 1 0.1751 0.896 0.960 0.012 0.028
#> GSM1060752 1 0.1525 0.903 0.964 0.032 0.004
#> GSM1060755 1 0.5377 0.818 0.820 0.112 0.068
#> GSM1060761 1 0.7528 0.668 0.648 0.280 0.072
#> GSM1060760 1 0.7528 0.668 0.648 0.280 0.072
#> GSM1060767 1 0.0424 0.901 0.992 0.000 0.008
#> GSM1060741 1 0.0661 0.904 0.988 0.008 0.004
#> GSM1060759 1 0.7528 0.668 0.648 0.280 0.072
#> GSM1060728 3 0.3875 0.988 0.068 0.044 0.888
#> GSM1060763 1 0.0237 0.903 0.996 0.000 0.004
#> GSM1060747 1 0.1399 0.903 0.968 0.028 0.004
#> GSM1060764 1 0.0000 0.902 1.000 0.000 0.000
#> GSM1060733 1 0.0424 0.901 0.992 0.000 0.008
#> GSM1060735 1 0.1267 0.903 0.972 0.024 0.004
#> GSM1060739 1 0.1525 0.903 0.964 0.032 0.004
#> GSM1060753 1 0.6405 0.770 0.756 0.172 0.072
#> GSM1060738 1 0.1163 0.903 0.972 0.028 0.000
#> GSM1060762 1 0.1711 0.888 0.960 0.032 0.008
#> GSM1060731 3 0.3683 0.998 0.060 0.044 0.896
#> GSM1060750 1 0.7564 0.669 0.636 0.296 0.068
#> GSM1060749 1 0.4194 0.866 0.876 0.060 0.064
#> GSM1060736 1 0.1267 0.903 0.972 0.024 0.004
#> GSM1060748 1 0.7564 0.669 0.636 0.296 0.068
#> GSM1060751 1 0.1399 0.903 0.968 0.028 0.004
#> GSM1060766 1 0.1647 0.902 0.960 0.036 0.004
#> GSM1060757 1 0.3649 0.863 0.896 0.036 0.068
#> GSM1060726 3 0.3683 0.998 0.060 0.044 0.896
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> GSM1060768 2 0.0592 0.835 0.000 0.984 0.016 0.000
#> GSM1060769 2 0.0592 0.835 0.000 0.984 0.016 0.000
#> GSM1060770 2 0.0592 0.835 0.000 0.984 0.016 0.000
#> GSM1060771 2 0.4551 0.798 0.004 0.724 0.004 0.268
#> GSM1060772 2 0.0921 0.835 0.000 0.972 0.000 0.028
#> GSM1060773 2 0.5909 0.489 0.016 0.512 0.012 0.460
#> GSM1060774 2 0.0469 0.836 0.000 0.988 0.012 0.000
#> GSM1060775 2 0.0469 0.836 0.000 0.988 0.012 0.000
#> GSM1060776 2 0.0592 0.835 0.000 0.984 0.016 0.000
#> GSM1060777 2 0.4551 0.798 0.004 0.724 0.004 0.268
#> GSM1060778 2 0.0592 0.835 0.000 0.984 0.016 0.000
#> GSM1060779 2 0.0592 0.835 0.000 0.984 0.016 0.000
#> GSM1060780 2 0.3105 0.827 0.000 0.856 0.004 0.140
#> GSM1060781 2 0.4799 0.780 0.004 0.704 0.008 0.284
#> GSM1060782 2 0.0592 0.835 0.000 0.984 0.016 0.000
#> GSM1060783 2 0.4551 0.798 0.004 0.724 0.004 0.268
#> GSM1060784 2 0.4551 0.798 0.004 0.724 0.004 0.268
#> GSM1060785 2 0.4551 0.798 0.004 0.724 0.004 0.268
#> GSM1060786 2 0.0592 0.835 0.000 0.984 0.016 0.000
#> GSM1060787 2 0.4551 0.798 0.004 0.724 0.004 0.268
#> GSM1060788 2 0.4718 0.792 0.004 0.716 0.008 0.272
#> GSM1060789 2 0.4551 0.798 0.004 0.724 0.004 0.268
#> GSM1060790 2 0.0592 0.835 0.000 0.984 0.016 0.000
#> GSM1060754 1 0.1174 0.910 0.968 0.000 0.012 0.020
#> GSM1060745 1 0.1305 0.906 0.960 0.000 0.004 0.036
#> GSM1060756 1 0.1059 0.911 0.972 0.000 0.012 0.016
#> GSM1060746 1 0.0672 0.914 0.984 0.000 0.008 0.008
#> GSM1060758 4 0.2853 0.821 0.076 0.016 0.008 0.900
#> GSM1060765 1 0.2915 0.911 0.892 0.000 0.028 0.080
#> GSM1060732 3 0.1902 0.938 0.004 0.064 0.932 0.000
#> GSM1060727 3 0.1902 0.938 0.004 0.064 0.932 0.000
#> GSM1060740 1 0.2915 0.909 0.892 0.000 0.028 0.080
#> GSM1060730 3 0.1902 0.938 0.004 0.064 0.932 0.000
#> GSM1060737 1 0.1520 0.906 0.956 0.000 0.024 0.020
#> GSM1060743 1 0.2845 0.911 0.896 0.000 0.028 0.076
#> GSM1060734 1 0.1929 0.897 0.940 0.000 0.024 0.036
#> GSM1060729 3 0.1902 0.938 0.004 0.064 0.932 0.000
#> GSM1060744 1 0.2915 0.909 0.892 0.000 0.028 0.080
#> GSM1060742 1 0.3581 0.893 0.852 0.000 0.032 0.116
#> GSM1060752 1 0.2915 0.909 0.892 0.000 0.028 0.080
#> GSM1060755 4 0.4364 0.765 0.220 0.000 0.016 0.764
#> GSM1060761 4 0.2853 0.821 0.076 0.016 0.008 0.900
#> GSM1060760 4 0.2853 0.821 0.076 0.016 0.008 0.900
#> GSM1060767 1 0.1305 0.906 0.960 0.000 0.004 0.036
#> GSM1060741 1 0.2915 0.909 0.892 0.000 0.028 0.080
#> GSM1060759 4 0.2853 0.821 0.076 0.016 0.008 0.900
#> GSM1060728 3 0.5705 0.585 0.260 0.064 0.676 0.000
#> GSM1060763 1 0.1284 0.908 0.964 0.000 0.024 0.012
#> GSM1060747 1 0.3149 0.907 0.880 0.000 0.032 0.088
#> GSM1060764 1 0.0336 0.916 0.992 0.000 0.000 0.008
#> GSM1060733 1 0.1929 0.897 0.940 0.000 0.024 0.036
#> GSM1060735 1 0.0895 0.912 0.976 0.000 0.004 0.020
#> GSM1060739 1 0.2915 0.909 0.892 0.000 0.028 0.080
#> GSM1060753 4 0.3447 0.812 0.128 0.000 0.020 0.852
#> GSM1060738 1 0.2915 0.909 0.892 0.000 0.028 0.080
#> GSM1060762 1 0.1771 0.900 0.948 0.012 0.004 0.036
#> GSM1060731 3 0.1902 0.938 0.004 0.064 0.932 0.000
#> GSM1060750 4 0.2589 0.819 0.116 0.000 0.000 0.884
#> GSM1060749 4 0.5478 0.555 0.344 0.000 0.028 0.628
#> GSM1060736 1 0.1520 0.906 0.956 0.000 0.024 0.020
#> GSM1060748 4 0.2773 0.814 0.116 0.000 0.004 0.880
#> GSM1060751 1 0.3149 0.907 0.880 0.000 0.032 0.088
#> GSM1060766 1 0.3117 0.906 0.880 0.000 0.028 0.092
#> GSM1060757 4 0.5404 0.354 0.476 0.000 0.012 0.512
#> GSM1060726 3 0.1902 0.938 0.004 0.064 0.932 0.000
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> GSM1060768 5 0.4305 0.988 0.000 0.488 0.000 0.000 0.512
#> GSM1060769 5 0.4450 0.987 0.000 0.488 0.000 0.004 0.508
#> GSM1060770 5 0.4450 0.987 0.000 0.488 0.000 0.004 0.508
#> GSM1060771 2 0.0000 0.928 0.000 1.000 0.000 0.000 0.000
#> GSM1060772 5 0.4907 0.976 0.000 0.488 0.000 0.024 0.488
#> GSM1060773 2 0.4430 0.596 0.088 0.792 0.000 0.096 0.024
#> GSM1060774 5 0.4907 0.976 0.000 0.488 0.000 0.024 0.488
#> GSM1060775 5 0.4747 0.980 0.000 0.488 0.000 0.016 0.496
#> GSM1060776 5 0.4830 0.977 0.000 0.488 0.000 0.020 0.492
#> GSM1060777 2 0.0000 0.928 0.000 1.000 0.000 0.000 0.000
#> GSM1060778 5 0.4305 0.988 0.000 0.488 0.000 0.000 0.512
#> GSM1060779 5 0.4305 0.988 0.000 0.488 0.000 0.000 0.512
#> GSM1060780 2 0.2616 0.635 0.000 0.880 0.000 0.020 0.100
#> GSM1060781 2 0.0162 0.921 0.000 0.996 0.000 0.004 0.000
#> GSM1060782 5 0.4305 0.988 0.000 0.488 0.000 0.000 0.512
#> GSM1060783 2 0.0000 0.928 0.000 1.000 0.000 0.000 0.000
#> GSM1060784 2 0.0000 0.928 0.000 1.000 0.000 0.000 0.000
#> GSM1060785 2 0.0000 0.928 0.000 1.000 0.000 0.000 0.000
#> GSM1060786 5 0.4305 0.988 0.000 0.488 0.000 0.000 0.512
#> GSM1060787 2 0.0000 0.928 0.000 1.000 0.000 0.000 0.000
#> GSM1060788 2 0.0000 0.928 0.000 1.000 0.000 0.000 0.000
#> GSM1060789 2 0.0000 0.928 0.000 1.000 0.000 0.000 0.000
#> GSM1060790 5 0.4305 0.988 0.000 0.488 0.000 0.000 0.512
#> GSM1060754 1 0.6362 0.631 0.464 0.000 0.368 0.168 0.000
#> GSM1060745 1 0.6572 0.639 0.480 0.000 0.344 0.168 0.008
#> GSM1060756 1 0.6362 0.631 0.464 0.000 0.368 0.168 0.000
#> GSM1060746 1 0.6247 0.640 0.484 0.000 0.364 0.152 0.000
#> GSM1060758 4 0.3409 0.793 0.024 0.160 0.000 0.816 0.000
#> GSM1060765 1 0.0324 0.642 0.992 0.000 0.000 0.004 0.004
#> GSM1060732 3 0.4327 0.945 0.000 0.008 0.632 0.000 0.360
#> GSM1060727 3 0.4327 0.945 0.000 0.008 0.632 0.000 0.360
#> GSM1060740 1 0.0290 0.641 0.992 0.000 0.000 0.008 0.000
#> GSM1060730 3 0.4327 0.945 0.000 0.008 0.632 0.000 0.360
#> GSM1060737 1 0.7118 0.627 0.484 0.000 0.328 0.132 0.056
#> GSM1060743 1 0.0290 0.641 0.992 0.000 0.000 0.008 0.000
#> GSM1060734 1 0.7108 0.609 0.428 0.000 0.368 0.172 0.032
#> GSM1060729 3 0.4327 0.945 0.000 0.008 0.632 0.000 0.360
#> GSM1060744 1 0.0566 0.641 0.984 0.000 0.004 0.012 0.000
#> GSM1060742 1 0.2289 0.597 0.904 0.000 0.004 0.080 0.012
#> GSM1060752 1 0.0579 0.636 0.984 0.000 0.000 0.008 0.008
#> GSM1060755 4 0.6481 0.689 0.280 0.060 0.008 0.592 0.060
#> GSM1060761 4 0.3409 0.793 0.024 0.160 0.000 0.816 0.000
#> GSM1060760 4 0.3409 0.793 0.024 0.160 0.000 0.816 0.000
#> GSM1060767 1 0.6554 0.638 0.480 0.000 0.348 0.164 0.008
#> GSM1060741 1 0.0579 0.636 0.984 0.000 0.000 0.008 0.008
#> GSM1060759 4 0.3409 0.793 0.024 0.160 0.000 0.816 0.000
#> GSM1060728 3 0.6749 0.639 0.164 0.008 0.524 0.012 0.292
#> GSM1060763 1 0.7100 0.616 0.436 0.000 0.368 0.160 0.036
#> GSM1060747 1 0.0955 0.632 0.968 0.000 0.000 0.004 0.028
#> GSM1060764 1 0.6147 0.652 0.536 0.000 0.328 0.132 0.004
#> GSM1060733 1 0.7108 0.609 0.428 0.000 0.368 0.172 0.032
#> GSM1060735 1 0.6476 0.647 0.568 0.000 0.280 0.120 0.032
#> GSM1060739 1 0.0579 0.636 0.984 0.000 0.000 0.008 0.008
#> GSM1060753 4 0.4956 0.774 0.108 0.068 0.000 0.764 0.060
#> GSM1060738 1 0.0290 0.641 0.992 0.000 0.000 0.008 0.000
#> GSM1060762 1 0.6598 0.638 0.476 0.000 0.344 0.172 0.008
#> GSM1060731 3 0.4327 0.945 0.000 0.008 0.632 0.000 0.360
#> GSM1060750 4 0.7007 0.755 0.204 0.152 0.000 0.568 0.076
#> GSM1060749 1 0.4924 -0.034 0.668 0.000 0.000 0.272 0.060
#> GSM1060736 1 0.7118 0.627 0.484 0.000 0.328 0.132 0.056
#> GSM1060748 4 0.7048 0.749 0.216 0.148 0.000 0.560 0.076
#> GSM1060751 1 0.0955 0.632 0.968 0.000 0.000 0.004 0.028
#> GSM1060766 1 0.0451 0.640 0.988 0.000 0.000 0.004 0.008
#> GSM1060757 4 0.6834 0.315 0.160 0.000 0.200 0.580 0.060
#> GSM1060726 3 0.4327 0.945 0.000 0.008 0.632 0.000 0.360
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> GSM1060768 5 0.0000 0.9680 0.000 0.000 0.00 0.000 1.000 0.000
#> GSM1060769 5 0.0405 0.9670 0.000 0.000 0.00 0.004 0.988 0.008
#> GSM1060770 5 0.0405 0.9670 0.000 0.000 0.00 0.004 0.988 0.008
#> GSM1060771 2 0.3050 0.9581 0.000 0.764 0.00 0.000 0.236 0.000
#> GSM1060772 5 0.2046 0.9343 0.000 0.000 0.00 0.032 0.908 0.060
#> GSM1060773 2 0.3608 0.7694 0.000 0.820 0.00 0.040 0.104 0.036
#> GSM1060774 5 0.2046 0.9343 0.000 0.000 0.00 0.032 0.908 0.060
#> GSM1060775 5 0.1549 0.9471 0.000 0.000 0.00 0.020 0.936 0.044
#> GSM1060776 5 0.1984 0.9387 0.000 0.000 0.00 0.032 0.912 0.056
#> GSM1060777 2 0.3050 0.9581 0.000 0.764 0.00 0.000 0.236 0.000
#> GSM1060778 5 0.0146 0.9681 0.000 0.000 0.00 0.000 0.996 0.004
#> GSM1060779 5 0.0000 0.9680 0.000 0.000 0.00 0.000 1.000 0.000
#> GSM1060780 2 0.5118 0.7725 0.000 0.612 0.00 0.028 0.308 0.052
#> GSM1060781 2 0.2996 0.9520 0.000 0.772 0.00 0.000 0.228 0.000
#> GSM1060782 5 0.0146 0.9681 0.000 0.000 0.00 0.000 0.996 0.004
#> GSM1060783 2 0.3189 0.9577 0.000 0.760 0.00 0.000 0.236 0.004
#> GSM1060784 2 0.3298 0.9570 0.000 0.756 0.00 0.000 0.236 0.008
#> GSM1060785 2 0.3050 0.9581 0.000 0.764 0.00 0.000 0.236 0.000
#> GSM1060786 5 0.0146 0.9681 0.000 0.000 0.00 0.000 0.996 0.004
#> GSM1060787 2 0.3189 0.9577 0.000 0.760 0.00 0.000 0.236 0.004
#> GSM1060788 2 0.3298 0.9570 0.000 0.756 0.00 0.000 0.236 0.008
#> GSM1060789 2 0.3050 0.9581 0.000 0.764 0.00 0.000 0.236 0.000
#> GSM1060790 5 0.0146 0.9681 0.000 0.000 0.00 0.000 0.996 0.004
#> GSM1060754 1 0.1780 0.8131 0.924 0.000 0.00 0.028 0.000 0.048
#> GSM1060745 1 0.4290 0.7741 0.776 0.076 0.00 0.048 0.000 0.100
#> GSM1060756 1 0.2039 0.8136 0.916 0.012 0.00 0.020 0.000 0.052
#> GSM1060746 1 0.2508 0.8093 0.884 0.016 0.00 0.016 0.000 0.084
#> GSM1060758 4 0.2848 0.8126 0.000 0.176 0.00 0.816 0.000 0.008
#> GSM1060765 6 0.4156 0.8767 0.164 0.056 0.00 0.020 0.000 0.760
#> GSM1060732 3 0.0000 0.9369 0.000 0.000 1.00 0.000 0.000 0.000
#> GSM1060727 3 0.0000 0.9369 0.000 0.000 1.00 0.000 0.000 0.000
#> GSM1060740 6 0.2300 0.9246 0.144 0.000 0.00 0.000 0.000 0.856
#> GSM1060730 3 0.0000 0.9369 0.000 0.000 1.00 0.000 0.000 0.000
#> GSM1060737 1 0.4185 0.7109 0.784 0.092 0.00 0.044 0.000 0.080
#> GSM1060743 6 0.2340 0.9241 0.148 0.000 0.00 0.000 0.000 0.852
#> GSM1060734 1 0.1401 0.8072 0.948 0.004 0.00 0.028 0.000 0.020
#> GSM1060729 3 0.0000 0.9369 0.000 0.000 1.00 0.000 0.000 0.000
#> GSM1060744 6 0.2692 0.9190 0.148 0.012 0.00 0.000 0.000 0.840
#> GSM1060742 6 0.3617 0.8805 0.144 0.012 0.00 0.044 0.000 0.800
#> GSM1060752 6 0.2442 0.9235 0.144 0.000 0.00 0.004 0.000 0.852
#> GSM1060755 4 0.5442 0.6364 0.052 0.048 0.00 0.588 0.000 0.312
#> GSM1060761 4 0.2920 0.8114 0.004 0.168 0.00 0.820 0.000 0.008
#> GSM1060760 4 0.2920 0.8114 0.004 0.168 0.00 0.820 0.000 0.008
#> GSM1060767 1 0.4244 0.7769 0.780 0.076 0.00 0.048 0.000 0.096
#> GSM1060741 6 0.2402 0.9234 0.140 0.004 0.00 0.000 0.000 0.856
#> GSM1060759 4 0.2778 0.8121 0.000 0.168 0.00 0.824 0.000 0.008
#> GSM1060728 3 0.5969 0.5282 0.200 0.076 0.64 0.044 0.000 0.040
#> GSM1060763 1 0.1296 0.7994 0.952 0.004 0.00 0.032 0.000 0.012
#> GSM1060747 6 0.4702 0.8204 0.164 0.080 0.00 0.032 0.000 0.724
#> GSM1060764 1 0.4491 0.7506 0.748 0.064 0.00 0.040 0.000 0.148
#> GSM1060733 1 0.1401 0.8072 0.948 0.004 0.00 0.028 0.000 0.020
#> GSM1060735 1 0.5417 0.5802 0.640 0.100 0.00 0.036 0.000 0.224
#> GSM1060739 6 0.2260 0.9240 0.140 0.000 0.00 0.000 0.000 0.860
#> GSM1060753 4 0.3424 0.7865 0.008 0.048 0.00 0.816 0.000 0.128
#> GSM1060738 6 0.2300 0.9246 0.144 0.000 0.00 0.000 0.000 0.856
#> GSM1060762 1 0.4478 0.7726 0.764 0.076 0.00 0.064 0.000 0.096
#> GSM1060731 3 0.0000 0.9369 0.000 0.000 1.00 0.000 0.000 0.000
#> GSM1060750 4 0.5420 0.7229 0.004 0.144 0.00 0.580 0.000 0.272
#> GSM1060749 6 0.3043 0.6927 0.024 0.008 0.00 0.132 0.000 0.836
#> GSM1060736 1 0.4185 0.7109 0.784 0.092 0.00 0.044 0.000 0.080
#> GSM1060748 4 0.5759 0.7187 0.024 0.144 0.00 0.580 0.000 0.252
#> GSM1060751 6 0.4702 0.8204 0.164 0.080 0.00 0.032 0.000 0.724
#> GSM1060766 6 0.2964 0.9161 0.140 0.012 0.00 0.012 0.000 0.836
#> GSM1060757 1 0.5501 -0.0767 0.460 0.000 0.00 0.412 0.000 0.128
#> GSM1060726 3 0.0000 0.9369 0.000 0.000 1.00 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)
Test correlation between subgroups and known annotations. If the known annotation is numeric, one-way ANOVA test is applied, and if the known annotation is discrete, chi-squared contingency table test is applied.
test_to_known_factors(res)
#> n disease.state(p) tissue(p) k
#> SD:kmeans 56 6.10e-13 0.013572 2
#> SD:kmeans 65 7.68e-15 0.000962 3
#> SD:kmeans 63 1.34e-13 0.000122 4
#> SD:kmeans 63 6.79e-13 0.058305 5
#> SD:kmeans 64 1.81e-12 0.008941 6
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 51941 rows and 65 columns.
#> Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'SD' method.
#> Subgroups are detected by 'skmeans' method.
#> Performed in total 1250 partitions by row resampling.
#> Best k for subgroups seems to be 6.
#>
#> Following methods can be applied to this 'ConsensusPartition' object:
#> [1] "cola_report" "collect_classes" "collect_plots"
#> [4] "collect_stats" "colnames" "compare_signatures"
#> [7] "consensus_heatmap" "dimension_reduction" "functional_enrichment"
#> [10] "get_anno_col" "get_anno" "get_classes"
#> [13] "get_consensus" "get_matrix" "get_membership"
#> [16] "get_param" "get_signatures" "get_stats"
#> [19] "is_best_k" "is_stable_k" "membership_heatmap"
#> [22] "ncol" "nrow" "plot_ecdf"
#> [25] "rownames" "select_partition_number" "show"
#> [28] "suggest_best_k" "test_to_known_factors"
collect_plots()
function collects all the plots made from res
for all k
(number of partitions)
into one single page to provide an easy and fast comparison between different k
.
collect_plots(res)
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.985 0.992 0.5064 0.493 0.493
#> 3 3 0.998 0.961 0.972 0.1925 0.912 0.821
#> 4 4 0.922 0.952 0.972 0.1914 0.863 0.665
#> 5 5 0.866 0.930 0.933 0.0843 0.934 0.767
#> 6 6 0.954 0.922 0.948 0.0748 0.926 0.674
suggest_best_k()
suggests the best \(k\) based on these statistics. The rules are as follows:
suggest_best_k(res)
#> [1] 6
#> attr(,"optional")
#> [1] 2 3 4
There is also optional best \(k\) = 2 3 4 that is worth to check.
Following shows the table of the partitions (You need to click the show/hide
code output link to see it). The membership matrix (columns with name p*
)
is inferred by
clue::cl_consensus()
function with the SE
method. Basically the value in the membership matrix
represents the probability to belong to a certain group. The finall class
label for an item is determined with the group with highest probability it
belongs to.
In get_classes()
function, the entropy is calculated from the membership
matrix and the silhouette score is calculated from the consensus matrix.
cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#> class entropy silhouette p1 p2
#> GSM1060768 2 0.0000 0.985 0.000 1.000
#> GSM1060769 2 0.0000 0.985 0.000 1.000
#> GSM1060770 2 0.0000 0.985 0.000 1.000
#> GSM1060771 2 0.0000 0.985 0.000 1.000
#> GSM1060772 2 0.0000 0.985 0.000 1.000
#> GSM1060773 2 0.6887 0.781 0.184 0.816
#> GSM1060774 2 0.0000 0.985 0.000 1.000
#> GSM1060775 2 0.0000 0.985 0.000 1.000
#> GSM1060776 2 0.0000 0.985 0.000 1.000
#> GSM1060777 2 0.0000 0.985 0.000 1.000
#> GSM1060778 2 0.0000 0.985 0.000 1.000
#> GSM1060779 2 0.0000 0.985 0.000 1.000
#> GSM1060780 2 0.0000 0.985 0.000 1.000
#> GSM1060781 2 0.0000 0.985 0.000 1.000
#> GSM1060782 2 0.0000 0.985 0.000 1.000
#> GSM1060783 2 0.0000 0.985 0.000 1.000
#> GSM1060784 2 0.0000 0.985 0.000 1.000
#> GSM1060785 2 0.0000 0.985 0.000 1.000
#> GSM1060786 2 0.0000 0.985 0.000 1.000
#> GSM1060787 2 0.0000 0.985 0.000 1.000
#> GSM1060788 2 0.0000 0.985 0.000 1.000
#> GSM1060789 2 0.0000 0.985 0.000 1.000
#> GSM1060790 2 0.0000 0.985 0.000 1.000
#> GSM1060754 1 0.0000 0.999 1.000 0.000
#> GSM1060745 1 0.0000 0.999 1.000 0.000
#> GSM1060756 1 0.0000 0.999 1.000 0.000
#> GSM1060746 1 0.0000 0.999 1.000 0.000
#> GSM1060758 1 0.0672 0.993 0.992 0.008
#> GSM1060765 1 0.0000 0.999 1.000 0.000
#> GSM1060732 2 0.0672 0.981 0.008 0.992
#> GSM1060727 2 0.0672 0.981 0.008 0.992
#> GSM1060740 1 0.0000 0.999 1.000 0.000
#> GSM1060730 2 0.0672 0.981 0.008 0.992
#> GSM1060737 1 0.0000 0.999 1.000 0.000
#> GSM1060743 1 0.0000 0.999 1.000 0.000
#> GSM1060734 1 0.0000 0.999 1.000 0.000
#> GSM1060729 2 0.0672 0.981 0.008 0.992
#> GSM1060744 1 0.0000 0.999 1.000 0.000
#> GSM1060742 1 0.0000 0.999 1.000 0.000
#> GSM1060752 1 0.0000 0.999 1.000 0.000
#> GSM1060755 1 0.0000 0.999 1.000 0.000
#> GSM1060761 1 0.0672 0.993 0.992 0.008
#> GSM1060760 1 0.0672 0.993 0.992 0.008
#> GSM1060767 1 0.0000 0.999 1.000 0.000
#> GSM1060741 1 0.0000 0.999 1.000 0.000
#> GSM1060759 1 0.0672 0.993 0.992 0.008
#> GSM1060728 2 0.0672 0.981 0.008 0.992
#> GSM1060763 1 0.0000 0.999 1.000 0.000
#> GSM1060747 1 0.0000 0.999 1.000 0.000
#> GSM1060764 1 0.0000 0.999 1.000 0.000
#> GSM1060733 1 0.0000 0.999 1.000 0.000
#> GSM1060735 1 0.0000 0.999 1.000 0.000
#> GSM1060739 1 0.0000 0.999 1.000 0.000
#> GSM1060753 1 0.0000 0.999 1.000 0.000
#> GSM1060738 1 0.0000 0.999 1.000 0.000
#> GSM1060762 2 0.7376 0.748 0.208 0.792
#> GSM1060731 2 0.0672 0.981 0.008 0.992
#> GSM1060750 1 0.0376 0.996 0.996 0.004
#> GSM1060749 1 0.0000 0.999 1.000 0.000
#> GSM1060736 1 0.0000 0.999 1.000 0.000
#> GSM1060748 1 0.0376 0.996 0.996 0.004
#> GSM1060751 1 0.0000 0.999 1.000 0.000
#> GSM1060766 1 0.0000 0.999 1.000 0.000
#> GSM1060757 1 0.0000 0.999 1.000 0.000
#> GSM1060726 2 0.0672 0.981 0.008 0.992
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> GSM1060768 2 0.2625 0.951 0.000 0.916 0.084
#> GSM1060769 2 0.2625 0.951 0.000 0.916 0.084
#> GSM1060770 2 0.2625 0.951 0.000 0.916 0.084
#> GSM1060771 2 0.0000 0.946 0.000 1.000 0.000
#> GSM1060772 2 0.2625 0.951 0.000 0.916 0.084
#> GSM1060773 2 0.0000 0.946 0.000 1.000 0.000
#> GSM1060774 2 0.2625 0.951 0.000 0.916 0.084
#> GSM1060775 2 0.2625 0.951 0.000 0.916 0.084
#> GSM1060776 2 0.2625 0.951 0.000 0.916 0.084
#> GSM1060777 2 0.0000 0.946 0.000 1.000 0.000
#> GSM1060778 2 0.2625 0.951 0.000 0.916 0.084
#> GSM1060779 2 0.2625 0.951 0.000 0.916 0.084
#> GSM1060780 2 0.0892 0.948 0.000 0.980 0.020
#> GSM1060781 2 0.0000 0.946 0.000 1.000 0.000
#> GSM1060782 2 0.2625 0.951 0.000 0.916 0.084
#> GSM1060783 2 0.0000 0.946 0.000 1.000 0.000
#> GSM1060784 2 0.0000 0.946 0.000 1.000 0.000
#> GSM1060785 2 0.0000 0.946 0.000 1.000 0.000
#> GSM1060786 2 0.2625 0.951 0.000 0.916 0.084
#> GSM1060787 2 0.0000 0.946 0.000 1.000 0.000
#> GSM1060788 2 0.0000 0.946 0.000 1.000 0.000
#> GSM1060789 2 0.0000 0.946 0.000 1.000 0.000
#> GSM1060790 2 0.2625 0.951 0.000 0.916 0.084
#> GSM1060754 1 0.0000 0.977 1.000 0.000 0.000
#> GSM1060745 1 0.1643 0.946 0.956 0.000 0.044
#> GSM1060756 1 0.0000 0.977 1.000 0.000 0.000
#> GSM1060746 1 0.0000 0.977 1.000 0.000 0.000
#> GSM1060758 1 0.2625 0.920 0.916 0.084 0.000
#> GSM1060765 1 0.0000 0.977 1.000 0.000 0.000
#> GSM1060732 3 0.0000 1.000 0.000 0.000 1.000
#> GSM1060727 3 0.0000 1.000 0.000 0.000 1.000
#> GSM1060740 1 0.0000 0.977 1.000 0.000 0.000
#> GSM1060730 3 0.0000 1.000 0.000 0.000 1.000
#> GSM1060737 1 0.0000 0.977 1.000 0.000 0.000
#> GSM1060743 1 0.0000 0.977 1.000 0.000 0.000
#> GSM1060734 1 0.0000 0.977 1.000 0.000 0.000
#> GSM1060729 3 0.0000 1.000 0.000 0.000 1.000
#> GSM1060744 1 0.0000 0.977 1.000 0.000 0.000
#> GSM1060742 1 0.0000 0.977 1.000 0.000 0.000
#> GSM1060752 1 0.0000 0.977 1.000 0.000 0.000
#> GSM1060755 1 0.0892 0.965 0.980 0.020 0.000
#> GSM1060761 1 0.5331 0.837 0.824 0.100 0.076
#> GSM1060760 1 0.4544 0.876 0.860 0.084 0.056
#> GSM1060767 1 0.0237 0.974 0.996 0.000 0.004
#> GSM1060741 1 0.0000 0.977 1.000 0.000 0.000
#> GSM1060759 1 0.4007 0.893 0.880 0.084 0.036
#> GSM1060728 3 0.0000 1.000 0.000 0.000 1.000
#> GSM1060763 1 0.0000 0.977 1.000 0.000 0.000
#> GSM1060747 1 0.0000 0.977 1.000 0.000 0.000
#> GSM1060764 1 0.0000 0.977 1.000 0.000 0.000
#> GSM1060733 1 0.0000 0.977 1.000 0.000 0.000
#> GSM1060735 1 0.0000 0.977 1.000 0.000 0.000
#> GSM1060739 1 0.0000 0.977 1.000 0.000 0.000
#> GSM1060753 1 0.1529 0.953 0.960 0.040 0.000
#> GSM1060738 1 0.0000 0.977 1.000 0.000 0.000
#> GSM1060762 3 0.0000 1.000 0.000 0.000 1.000
#> GSM1060731 3 0.0000 1.000 0.000 0.000 1.000
#> GSM1060750 1 0.2625 0.920 0.916 0.084 0.000
#> GSM1060749 1 0.0000 0.977 1.000 0.000 0.000
#> GSM1060736 1 0.0000 0.977 1.000 0.000 0.000
#> GSM1060748 1 0.2625 0.920 0.916 0.084 0.000
#> GSM1060751 1 0.0000 0.977 1.000 0.000 0.000
#> GSM1060766 1 0.0000 0.977 1.000 0.000 0.000
#> GSM1060757 1 0.0000 0.977 1.000 0.000 0.000
#> GSM1060726 3 0.0000 1.000 0.000 0.000 1.000
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> GSM1060768 2 0.0000 0.957 0.000 1.000 0.000 0.000
#> GSM1060769 2 0.0000 0.957 0.000 1.000 0.000 0.000
#> GSM1060770 2 0.0000 0.957 0.000 1.000 0.000 0.000
#> GSM1060771 2 0.2530 0.925 0.000 0.888 0.000 0.112
#> GSM1060772 2 0.0000 0.957 0.000 1.000 0.000 0.000
#> GSM1060773 4 0.1557 0.845 0.000 0.056 0.000 0.944
#> GSM1060774 2 0.0000 0.957 0.000 1.000 0.000 0.000
#> GSM1060775 2 0.0000 0.957 0.000 1.000 0.000 0.000
#> GSM1060776 2 0.0000 0.957 0.000 1.000 0.000 0.000
#> GSM1060777 2 0.2530 0.925 0.000 0.888 0.000 0.112
#> GSM1060778 2 0.0000 0.957 0.000 1.000 0.000 0.000
#> GSM1060779 2 0.0000 0.957 0.000 1.000 0.000 0.000
#> GSM1060780 2 0.0000 0.957 0.000 1.000 0.000 0.000
#> GSM1060781 2 0.2530 0.925 0.000 0.888 0.000 0.112
#> GSM1060782 2 0.0000 0.957 0.000 1.000 0.000 0.000
#> GSM1060783 2 0.2530 0.925 0.000 0.888 0.000 0.112
#> GSM1060784 2 0.2011 0.939 0.000 0.920 0.000 0.080
#> GSM1060785 2 0.2530 0.925 0.000 0.888 0.000 0.112
#> GSM1060786 2 0.0000 0.957 0.000 1.000 0.000 0.000
#> GSM1060787 2 0.2011 0.939 0.000 0.920 0.000 0.080
#> GSM1060788 2 0.2081 0.937 0.000 0.916 0.000 0.084
#> GSM1060789 2 0.2530 0.925 0.000 0.888 0.000 0.112
#> GSM1060790 2 0.0000 0.957 0.000 1.000 0.000 0.000
#> GSM1060754 1 0.0188 0.996 0.996 0.000 0.000 0.004
#> GSM1060745 1 0.0376 0.993 0.992 0.000 0.004 0.004
#> GSM1060756 1 0.0188 0.996 0.996 0.000 0.000 0.004
#> GSM1060746 1 0.0000 0.998 1.000 0.000 0.000 0.000
#> GSM1060758 4 0.0000 0.892 0.000 0.000 0.000 1.000
#> GSM1060765 1 0.0000 0.998 1.000 0.000 0.000 0.000
#> GSM1060732 3 0.0000 0.999 0.000 0.000 1.000 0.000
#> GSM1060727 3 0.0000 0.999 0.000 0.000 1.000 0.000
#> GSM1060740 1 0.0000 0.998 1.000 0.000 0.000 0.000
#> GSM1060730 3 0.0000 0.999 0.000 0.000 1.000 0.000
#> GSM1060737 1 0.0000 0.998 1.000 0.000 0.000 0.000
#> GSM1060743 1 0.0000 0.998 1.000 0.000 0.000 0.000
#> GSM1060734 1 0.0188 0.996 0.996 0.000 0.000 0.004
#> GSM1060729 3 0.0000 0.999 0.000 0.000 1.000 0.000
#> GSM1060744 1 0.0000 0.998 1.000 0.000 0.000 0.000
#> GSM1060742 4 0.4431 0.630 0.304 0.000 0.000 0.696
#> GSM1060752 1 0.0000 0.998 1.000 0.000 0.000 0.000
#> GSM1060755 4 0.2345 0.848 0.100 0.000 0.000 0.900
#> GSM1060761 4 0.0000 0.892 0.000 0.000 0.000 1.000
#> GSM1060760 4 0.0000 0.892 0.000 0.000 0.000 1.000
#> GSM1060767 1 0.0188 0.996 0.996 0.000 0.000 0.004
#> GSM1060741 1 0.0188 0.995 0.996 0.000 0.000 0.004
#> GSM1060759 4 0.0000 0.892 0.000 0.000 0.000 1.000
#> GSM1060728 3 0.0000 0.999 0.000 0.000 1.000 0.000
#> GSM1060763 1 0.0000 0.998 1.000 0.000 0.000 0.000
#> GSM1060747 1 0.0000 0.998 1.000 0.000 0.000 0.000
#> GSM1060764 1 0.0000 0.998 1.000 0.000 0.000 0.000
#> GSM1060733 1 0.0188 0.996 0.996 0.000 0.000 0.004
#> GSM1060735 1 0.0000 0.998 1.000 0.000 0.000 0.000
#> GSM1060739 1 0.0000 0.998 1.000 0.000 0.000 0.000
#> GSM1060753 4 0.1211 0.882 0.040 0.000 0.000 0.960
#> GSM1060738 1 0.0000 0.998 1.000 0.000 0.000 0.000
#> GSM1060762 3 0.0188 0.996 0.000 0.000 0.996 0.004
#> GSM1060731 3 0.0000 0.999 0.000 0.000 1.000 0.000
#> GSM1060750 4 0.0188 0.892 0.004 0.000 0.000 0.996
#> GSM1060749 4 0.2530 0.840 0.112 0.000 0.000 0.888
#> GSM1060736 1 0.0000 0.998 1.000 0.000 0.000 0.000
#> GSM1060748 4 0.0188 0.892 0.004 0.000 0.000 0.996
#> GSM1060751 1 0.0000 0.998 1.000 0.000 0.000 0.000
#> GSM1060766 1 0.0000 0.998 1.000 0.000 0.000 0.000
#> GSM1060757 4 0.3975 0.714 0.240 0.000 0.000 0.760
#> GSM1060726 3 0.0000 0.999 0.000 0.000 1.000 0.000
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> GSM1060768 5 0.0000 0.969 0.000 0.000 0.000 0.000 1.000
#> GSM1060769 5 0.0000 0.969 0.000 0.000 0.000 0.000 1.000
#> GSM1060770 5 0.0000 0.969 0.000 0.000 0.000 0.000 1.000
#> GSM1060771 2 0.2561 0.979 0.000 0.856 0.000 0.000 0.144
#> GSM1060772 5 0.0000 0.969 0.000 0.000 0.000 0.000 1.000
#> GSM1060773 2 0.2921 0.819 0.000 0.856 0.000 0.124 0.020
#> GSM1060774 5 0.0000 0.969 0.000 0.000 0.000 0.000 1.000
#> GSM1060775 5 0.0000 0.969 0.000 0.000 0.000 0.000 1.000
#> GSM1060776 5 0.0000 0.969 0.000 0.000 0.000 0.000 1.000
#> GSM1060777 2 0.2561 0.979 0.000 0.856 0.000 0.000 0.144
#> GSM1060778 5 0.0000 0.969 0.000 0.000 0.000 0.000 1.000
#> GSM1060779 5 0.0000 0.969 0.000 0.000 0.000 0.000 1.000
#> GSM1060780 5 0.3857 0.430 0.000 0.312 0.000 0.000 0.688
#> GSM1060781 2 0.2561 0.979 0.000 0.856 0.000 0.000 0.144
#> GSM1060782 5 0.0000 0.969 0.000 0.000 0.000 0.000 1.000
#> GSM1060783 2 0.2561 0.979 0.000 0.856 0.000 0.000 0.144
#> GSM1060784 2 0.2605 0.976 0.000 0.852 0.000 0.000 0.148
#> GSM1060785 2 0.2561 0.979 0.000 0.856 0.000 0.000 0.144
#> GSM1060786 5 0.0000 0.969 0.000 0.000 0.000 0.000 1.000
#> GSM1060787 2 0.2605 0.976 0.000 0.852 0.000 0.000 0.148
#> GSM1060788 2 0.2561 0.979 0.000 0.856 0.000 0.000 0.144
#> GSM1060789 2 0.2561 0.979 0.000 0.856 0.000 0.000 0.144
#> GSM1060790 5 0.0000 0.969 0.000 0.000 0.000 0.000 1.000
#> GSM1060754 1 0.2753 0.915 0.856 0.136 0.000 0.008 0.000
#> GSM1060745 1 0.3543 0.903 0.828 0.136 0.012 0.024 0.000
#> GSM1060756 1 0.2864 0.914 0.852 0.136 0.000 0.012 0.000
#> GSM1060746 1 0.2424 0.918 0.868 0.132 0.000 0.000 0.000
#> GSM1060758 4 0.0609 0.928 0.000 0.020 0.000 0.980 0.000
#> GSM1060765 1 0.0671 0.915 0.980 0.004 0.000 0.016 0.000
#> GSM1060732 3 0.0000 0.997 0.000 0.000 1.000 0.000 0.000
#> GSM1060727 3 0.0000 0.997 0.000 0.000 1.000 0.000 0.000
#> GSM1060740 1 0.0992 0.910 0.968 0.008 0.000 0.024 0.000
#> GSM1060730 3 0.0000 0.997 0.000 0.000 1.000 0.000 0.000
#> GSM1060737 1 0.2424 0.918 0.868 0.132 0.000 0.000 0.000
#> GSM1060743 1 0.0771 0.913 0.976 0.004 0.000 0.020 0.000
#> GSM1060734 1 0.3152 0.909 0.840 0.136 0.000 0.024 0.000
#> GSM1060729 3 0.0000 0.997 0.000 0.000 1.000 0.000 0.000
#> GSM1060744 1 0.1012 0.912 0.968 0.012 0.000 0.020 0.000
#> GSM1060742 4 0.3916 0.670 0.256 0.012 0.000 0.732 0.000
#> GSM1060752 1 0.0865 0.911 0.972 0.004 0.000 0.024 0.000
#> GSM1060755 4 0.0290 0.928 0.008 0.000 0.000 0.992 0.000
#> GSM1060761 4 0.0609 0.928 0.000 0.020 0.000 0.980 0.000
#> GSM1060760 4 0.0609 0.928 0.000 0.020 0.000 0.980 0.000
#> GSM1060767 1 0.3152 0.909 0.840 0.136 0.000 0.024 0.000
#> GSM1060741 1 0.1082 0.908 0.964 0.008 0.000 0.028 0.000
#> GSM1060759 4 0.0609 0.928 0.000 0.020 0.000 0.980 0.000
#> GSM1060728 3 0.0000 0.997 0.000 0.000 1.000 0.000 0.000
#> GSM1060763 1 0.2471 0.917 0.864 0.136 0.000 0.000 0.000
#> GSM1060747 1 0.0771 0.913 0.976 0.004 0.000 0.020 0.000
#> GSM1060764 1 0.2424 0.918 0.868 0.132 0.000 0.000 0.000
#> GSM1060733 1 0.3152 0.909 0.840 0.136 0.000 0.024 0.000
#> GSM1060735 1 0.2329 0.919 0.876 0.124 0.000 0.000 0.000
#> GSM1060739 1 0.0992 0.910 0.968 0.008 0.000 0.024 0.000
#> GSM1060753 4 0.0000 0.927 0.000 0.000 0.000 1.000 0.000
#> GSM1060738 1 0.0992 0.910 0.968 0.008 0.000 0.024 0.000
#> GSM1060762 3 0.0833 0.976 0.004 0.004 0.976 0.016 0.000
#> GSM1060731 3 0.0000 0.997 0.000 0.000 1.000 0.000 0.000
#> GSM1060750 4 0.1012 0.927 0.020 0.012 0.000 0.968 0.000
#> GSM1060749 4 0.1768 0.889 0.072 0.004 0.000 0.924 0.000
#> GSM1060736 1 0.2424 0.918 0.868 0.132 0.000 0.000 0.000
#> GSM1060748 4 0.1106 0.925 0.024 0.012 0.000 0.964 0.000
#> GSM1060751 1 0.0609 0.914 0.980 0.000 0.000 0.020 0.000
#> GSM1060766 1 0.0992 0.910 0.968 0.008 0.000 0.024 0.000
#> GSM1060757 4 0.3362 0.819 0.076 0.080 0.000 0.844 0.000
#> GSM1060726 3 0.0000 0.997 0.000 0.000 1.000 0.000 0.000
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> GSM1060768 5 0.0000 0.963 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM1060769 5 0.0000 0.963 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM1060770 5 0.0000 0.963 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM1060771 2 0.0790 0.995 0.000 0.968 0.000 0.000 0.032 0.000
#> GSM1060772 5 0.0000 0.963 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM1060773 2 0.0870 0.955 0.000 0.972 0.000 0.012 0.004 0.012
#> GSM1060774 5 0.0000 0.963 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM1060775 5 0.0000 0.963 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM1060776 5 0.0146 0.962 0.000 0.000 0.000 0.000 0.996 0.004
#> GSM1060777 2 0.0790 0.995 0.000 0.968 0.000 0.000 0.032 0.000
#> GSM1060778 5 0.0146 0.962 0.000 0.000 0.000 0.000 0.996 0.004
#> GSM1060779 5 0.0000 0.963 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM1060780 5 0.3984 0.298 0.000 0.396 0.000 0.000 0.596 0.008
#> GSM1060781 2 0.0790 0.995 0.000 0.968 0.000 0.000 0.032 0.000
#> GSM1060782 5 0.0146 0.962 0.000 0.000 0.000 0.000 0.996 0.004
#> GSM1060783 2 0.0790 0.995 0.000 0.968 0.000 0.000 0.032 0.000
#> GSM1060784 2 0.0790 0.995 0.000 0.968 0.000 0.000 0.032 0.000
#> GSM1060785 2 0.0790 0.995 0.000 0.968 0.000 0.000 0.032 0.000
#> GSM1060786 5 0.0146 0.962 0.000 0.000 0.000 0.000 0.996 0.004
#> GSM1060787 2 0.0790 0.995 0.000 0.968 0.000 0.000 0.032 0.000
#> GSM1060788 2 0.0790 0.995 0.000 0.968 0.000 0.000 0.032 0.000
#> GSM1060789 2 0.0790 0.995 0.000 0.968 0.000 0.000 0.032 0.000
#> GSM1060790 5 0.0146 0.962 0.000 0.000 0.000 0.000 0.996 0.004
#> GSM1060754 1 0.0363 0.960 0.988 0.000 0.000 0.000 0.000 0.012
#> GSM1060745 1 0.0777 0.955 0.972 0.004 0.000 0.000 0.000 0.024
#> GSM1060756 1 0.0363 0.960 0.988 0.000 0.000 0.000 0.000 0.012
#> GSM1060746 1 0.0632 0.960 0.976 0.000 0.000 0.000 0.000 0.024
#> GSM1060758 4 0.0603 0.912 0.000 0.004 0.000 0.980 0.000 0.016
#> GSM1060765 6 0.2704 0.868 0.140 0.016 0.000 0.000 0.000 0.844
#> GSM1060732 3 0.0000 0.981 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1060727 3 0.0000 0.981 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1060740 6 0.1141 0.933 0.052 0.000 0.000 0.000 0.000 0.948
#> GSM1060730 3 0.0000 0.981 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1060737 1 0.1950 0.924 0.912 0.024 0.000 0.000 0.000 0.064
#> GSM1060743 6 0.1327 0.934 0.064 0.000 0.000 0.000 0.000 0.936
#> GSM1060734 1 0.0260 0.960 0.992 0.000 0.000 0.000 0.000 0.008
#> GSM1060729 3 0.0000 0.981 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1060744 6 0.1531 0.930 0.068 0.004 0.000 0.000 0.000 0.928
#> GSM1060742 6 0.4411 0.543 0.048 0.004 0.000 0.276 0.000 0.672
#> GSM1060752 6 0.1204 0.934 0.056 0.000 0.000 0.000 0.000 0.944
#> GSM1060755 4 0.0713 0.907 0.000 0.000 0.000 0.972 0.000 0.028
#> GSM1060761 4 0.0603 0.912 0.000 0.004 0.000 0.980 0.000 0.016
#> GSM1060760 4 0.0603 0.912 0.000 0.004 0.000 0.980 0.000 0.016
#> GSM1060767 1 0.0508 0.960 0.984 0.004 0.000 0.000 0.000 0.012
#> GSM1060741 6 0.1285 0.933 0.052 0.000 0.000 0.004 0.000 0.944
#> GSM1060759 4 0.0603 0.912 0.000 0.004 0.000 0.980 0.000 0.016
#> GSM1060728 3 0.0000 0.981 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1060763 1 0.0547 0.956 0.980 0.000 0.000 0.000 0.000 0.020
#> GSM1060747 6 0.2301 0.902 0.096 0.020 0.000 0.000 0.000 0.884
#> GSM1060764 1 0.1010 0.953 0.960 0.004 0.000 0.000 0.000 0.036
#> GSM1060733 1 0.0260 0.960 0.992 0.000 0.000 0.000 0.000 0.008
#> GSM1060735 1 0.2911 0.839 0.832 0.024 0.000 0.000 0.000 0.144
#> GSM1060739 6 0.1141 0.933 0.052 0.000 0.000 0.000 0.000 0.948
#> GSM1060753 4 0.0000 0.911 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM1060738 6 0.1204 0.934 0.056 0.000 0.000 0.000 0.000 0.944
#> GSM1060762 3 0.2333 0.862 0.120 0.004 0.872 0.004 0.000 0.000
#> GSM1060731 3 0.0000 0.981 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1060750 4 0.0547 0.909 0.000 0.000 0.000 0.980 0.000 0.020
#> GSM1060749 4 0.3464 0.565 0.000 0.000 0.000 0.688 0.000 0.312
#> GSM1060736 1 0.1950 0.924 0.912 0.024 0.000 0.000 0.000 0.064
#> GSM1060748 4 0.1285 0.895 0.000 0.004 0.000 0.944 0.000 0.052
#> GSM1060751 6 0.2147 0.910 0.084 0.020 0.000 0.000 0.000 0.896
#> GSM1060766 6 0.1970 0.914 0.092 0.008 0.000 0.000 0.000 0.900
#> GSM1060757 4 0.3650 0.606 0.280 0.000 0.000 0.708 0.000 0.012
#> GSM1060726 3 0.0000 0.981 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)
Test correlation between subgroups and known annotations. If the known annotation is numeric, one-way ANOVA test is applied, and if the known annotation is discrete, chi-squared contingency table test is applied.
test_to_known_factors(res)
#> n disease.state(p) tissue(p) k
#> SD:skmeans 65 2.12e-09 0.012934 2
#> SD:skmeans 65 7.68e-15 0.000962 3
#> SD:skmeans 65 3.61e-13 0.000344 4
#> SD:skmeans 64 4.18e-13 0.098933 5
#> SD:skmeans 64 1.81e-12 0.016550 6
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 51941 rows and 65 columns.
#> Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'SD' method.
#> Subgroups are detected by 'pam' method.
#> Performed in total 1250 partitions by row resampling.
#> Best k for subgroups seems to be 6.
#>
#> Following methods can be applied to this 'ConsensusPartition' object:
#> [1] "cola_report" "collect_classes" "collect_plots"
#> [4] "collect_stats" "colnames" "compare_signatures"
#> [7] "consensus_heatmap" "dimension_reduction" "functional_enrichment"
#> [10] "get_anno_col" "get_anno" "get_classes"
#> [13] "get_consensus" "get_matrix" "get_membership"
#> [16] "get_param" "get_signatures" "get_stats"
#> [19] "is_best_k" "is_stable_k" "membership_heatmap"
#> [22] "ncol" "nrow" "plot_ecdf"
#> [25] "rownames" "select_partition_number" "show"
#> [28] "suggest_best_k" "test_to_known_factors"
collect_plots()
function collects all the plots made from res
for all k
(number of partitions)
into one single page to provide an easy and fast comparison between different k
.
collect_plots(res)
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.467 0.827 0.806 0.3843 0.502 0.502
#> 3 3 0.889 0.926 0.969 0.5478 0.872 0.751
#> 4 4 0.797 0.825 0.912 0.1994 0.851 0.644
#> 5 5 0.931 0.872 0.950 0.0972 0.902 0.675
#> 6 6 0.925 0.846 0.940 0.0228 0.986 0.934
suggest_best_k()
suggests the best \(k\) based on these statistics. The rules are as follows:
suggest_best_k(res)
#> [1] 6
#> attr(,"optional")
#> [1] 5
There is also optional best \(k\) = 5 that is worth to check.
Following shows the table of the partitions (You need to click the show/hide
code output link to see it). The membership matrix (columns with name p*
)
is inferred by
clue::cl_consensus()
function with the SE
method. Basically the value in the membership matrix
represents the probability to belong to a certain group. The finall class
label for an item is determined with the group with highest probability it
belongs to.
In get_classes()
function, the entropy is calculated from the membership
matrix and the silhouette score is calculated from the consensus matrix.
cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#> class entropy silhouette p1 p2
#> GSM1060768 2 0.958 1.000 0.380 0.620
#> GSM1060769 2 0.958 1.000 0.380 0.620
#> GSM1060770 2 0.958 1.000 0.380 0.620
#> GSM1060771 2 0.958 1.000 0.380 0.620
#> GSM1060772 2 0.958 1.000 0.380 0.620
#> GSM1060773 2 0.958 1.000 0.380 0.620
#> GSM1060774 2 0.958 1.000 0.380 0.620
#> GSM1060775 2 0.958 1.000 0.380 0.620
#> GSM1060776 2 0.958 1.000 0.380 0.620
#> GSM1060777 2 0.958 1.000 0.380 0.620
#> GSM1060778 2 0.958 1.000 0.380 0.620
#> GSM1060779 2 0.958 1.000 0.380 0.620
#> GSM1060780 2 0.958 1.000 0.380 0.620
#> GSM1060781 2 0.958 1.000 0.380 0.620
#> GSM1060782 2 0.958 1.000 0.380 0.620
#> GSM1060783 2 0.958 1.000 0.380 0.620
#> GSM1060784 2 0.958 1.000 0.380 0.620
#> GSM1060785 2 0.958 1.000 0.380 0.620
#> GSM1060786 2 0.958 1.000 0.380 0.620
#> GSM1060787 2 0.958 1.000 0.380 0.620
#> GSM1060788 2 0.958 1.000 0.380 0.620
#> GSM1060789 2 0.958 1.000 0.380 0.620
#> GSM1060790 2 0.958 1.000 0.380 0.620
#> GSM1060754 1 0.000 0.834 1.000 0.000
#> GSM1060745 1 0.000 0.834 1.000 0.000
#> GSM1060756 1 0.000 0.834 1.000 0.000
#> GSM1060746 1 0.000 0.834 1.000 0.000
#> GSM1060758 2 0.958 1.000 0.380 0.620
#> GSM1060765 1 0.000 0.834 1.000 0.000
#> GSM1060732 1 0.958 0.558 0.620 0.380
#> GSM1060727 1 0.958 0.558 0.620 0.380
#> GSM1060740 1 0.000 0.834 1.000 0.000
#> GSM1060730 1 0.958 0.558 0.620 0.380
#> GSM1060737 1 0.000 0.834 1.000 0.000
#> GSM1060743 1 0.000 0.834 1.000 0.000
#> GSM1060734 1 0.000 0.834 1.000 0.000
#> GSM1060729 1 0.958 0.558 0.620 0.380
#> GSM1060744 1 0.000 0.834 1.000 0.000
#> GSM1060742 1 0.000 0.834 1.000 0.000
#> GSM1060752 1 0.000 0.834 1.000 0.000
#> GSM1060755 1 0.278 0.769 0.952 0.048
#> GSM1060761 2 0.958 1.000 0.380 0.620
#> GSM1060760 1 0.998 -0.705 0.524 0.476
#> GSM1060767 1 0.000 0.834 1.000 0.000
#> GSM1060741 1 0.000 0.834 1.000 0.000
#> GSM1060759 2 0.958 1.000 0.380 0.620
#> GSM1060728 1 0.833 0.631 0.736 0.264
#> GSM1060763 1 0.000 0.834 1.000 0.000
#> GSM1060747 1 0.000 0.834 1.000 0.000
#> GSM1060764 1 0.000 0.834 1.000 0.000
#> GSM1060733 1 0.000 0.834 1.000 0.000
#> GSM1060735 1 0.000 0.834 1.000 0.000
#> GSM1060739 1 0.000 0.834 1.000 0.000
#> GSM1060753 1 0.000 0.834 1.000 0.000
#> GSM1060738 1 0.000 0.834 1.000 0.000
#> GSM1060762 1 0.541 0.620 0.876 0.124
#> GSM1060731 1 0.958 0.558 0.620 0.380
#> GSM1060750 2 0.958 1.000 0.380 0.620
#> GSM1060749 1 0.978 -0.514 0.588 0.412
#> GSM1060736 1 0.000 0.834 1.000 0.000
#> GSM1060748 2 0.958 1.000 0.380 0.620
#> GSM1060751 1 0.000 0.834 1.000 0.000
#> GSM1060766 1 0.278 0.769 0.952 0.048
#> GSM1060757 1 0.000 0.834 1.000 0.000
#> GSM1060726 1 0.958 0.558 0.620 0.380
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> GSM1060768 2 0.0000 0.941 0.000 1.000 0.000
#> GSM1060769 2 0.0000 0.941 0.000 1.000 0.000
#> GSM1060770 2 0.0000 0.941 0.000 1.000 0.000
#> GSM1060771 2 0.0000 0.941 0.000 1.000 0.000
#> GSM1060772 2 0.0000 0.941 0.000 1.000 0.000
#> GSM1060773 2 0.1860 0.907 0.052 0.948 0.000
#> GSM1060774 2 0.0000 0.941 0.000 1.000 0.000
#> GSM1060775 2 0.0000 0.941 0.000 1.000 0.000
#> GSM1060776 2 0.0000 0.941 0.000 1.000 0.000
#> GSM1060777 2 0.0000 0.941 0.000 1.000 0.000
#> GSM1060778 2 0.0000 0.941 0.000 1.000 0.000
#> GSM1060779 2 0.0000 0.941 0.000 1.000 0.000
#> GSM1060780 2 0.0000 0.941 0.000 1.000 0.000
#> GSM1060781 2 0.2711 0.880 0.088 0.912 0.000
#> GSM1060782 2 0.0000 0.941 0.000 1.000 0.000
#> GSM1060783 2 0.0000 0.941 0.000 1.000 0.000
#> GSM1060784 2 0.0000 0.941 0.000 1.000 0.000
#> GSM1060785 2 0.0000 0.941 0.000 1.000 0.000
#> GSM1060786 2 0.0000 0.941 0.000 1.000 0.000
#> GSM1060787 2 0.0000 0.941 0.000 1.000 0.000
#> GSM1060788 2 0.0000 0.941 0.000 1.000 0.000
#> GSM1060789 2 0.0000 0.941 0.000 1.000 0.000
#> GSM1060790 2 0.0000 0.941 0.000 1.000 0.000
#> GSM1060754 1 0.0000 0.968 1.000 0.000 0.000
#> GSM1060745 1 0.0000 0.968 1.000 0.000 0.000
#> GSM1060756 1 0.0000 0.968 1.000 0.000 0.000
#> GSM1060746 1 0.0000 0.968 1.000 0.000 0.000
#> GSM1060758 2 0.4504 0.784 0.196 0.804 0.000
#> GSM1060765 1 0.0000 0.968 1.000 0.000 0.000
#> GSM1060732 3 0.0000 0.991 0.000 0.000 1.000
#> GSM1060727 3 0.0000 0.991 0.000 0.000 1.000
#> GSM1060740 1 0.0000 0.968 1.000 0.000 0.000
#> GSM1060730 3 0.0000 0.991 0.000 0.000 1.000
#> GSM1060737 1 0.0000 0.968 1.000 0.000 0.000
#> GSM1060743 1 0.0000 0.968 1.000 0.000 0.000
#> GSM1060734 1 0.0000 0.968 1.000 0.000 0.000
#> GSM1060729 3 0.0000 0.991 0.000 0.000 1.000
#> GSM1060744 1 0.0000 0.968 1.000 0.000 0.000
#> GSM1060742 1 0.0000 0.968 1.000 0.000 0.000
#> GSM1060752 1 0.0000 0.968 1.000 0.000 0.000
#> GSM1060755 1 0.2356 0.889 0.928 0.072 0.000
#> GSM1060761 2 0.4235 0.804 0.176 0.824 0.000
#> GSM1060760 2 0.4654 0.768 0.208 0.792 0.000
#> GSM1060767 1 0.0000 0.968 1.000 0.000 0.000
#> GSM1060741 1 0.0000 0.968 1.000 0.000 0.000
#> GSM1060759 2 0.4504 0.783 0.196 0.804 0.000
#> GSM1060728 3 0.1860 0.944 0.052 0.000 0.948
#> GSM1060763 1 0.0000 0.968 1.000 0.000 0.000
#> GSM1060747 1 0.0000 0.968 1.000 0.000 0.000
#> GSM1060764 1 0.0000 0.968 1.000 0.000 0.000
#> GSM1060733 1 0.0000 0.968 1.000 0.000 0.000
#> GSM1060735 1 0.0000 0.968 1.000 0.000 0.000
#> GSM1060739 1 0.0000 0.968 1.000 0.000 0.000
#> GSM1060753 1 0.0000 0.968 1.000 0.000 0.000
#> GSM1060738 1 0.0592 0.957 0.988 0.012 0.000
#> GSM1060762 1 0.4605 0.709 0.796 0.204 0.000
#> GSM1060731 3 0.0000 0.991 0.000 0.000 1.000
#> GSM1060750 2 0.4399 0.792 0.188 0.812 0.000
#> GSM1060749 1 0.6079 0.307 0.612 0.388 0.000
#> GSM1060736 1 0.0000 0.968 1.000 0.000 0.000
#> GSM1060748 2 0.4399 0.792 0.188 0.812 0.000
#> GSM1060751 1 0.0000 0.968 1.000 0.000 0.000
#> GSM1060766 1 0.0892 0.950 0.980 0.020 0.000
#> GSM1060757 1 0.0000 0.968 1.000 0.000 0.000
#> GSM1060726 3 0.0000 0.991 0.000 0.000 1.000
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> GSM1060768 2 0.0000 0.873 0.000 1.000 0.000 0.000
#> GSM1060769 2 0.0000 0.873 0.000 1.000 0.000 0.000
#> GSM1060770 2 0.0000 0.873 0.000 1.000 0.000 0.000
#> GSM1060771 2 0.4134 0.814 0.000 0.740 0.000 0.260
#> GSM1060772 2 0.0000 0.873 0.000 1.000 0.000 0.000
#> GSM1060773 2 0.4250 0.796 0.000 0.724 0.000 0.276
#> GSM1060774 2 0.0000 0.873 0.000 1.000 0.000 0.000
#> GSM1060775 2 0.0000 0.873 0.000 1.000 0.000 0.000
#> GSM1060776 2 0.0000 0.873 0.000 1.000 0.000 0.000
#> GSM1060777 2 0.4134 0.814 0.000 0.740 0.000 0.260
#> GSM1060778 2 0.0000 0.873 0.000 1.000 0.000 0.000
#> GSM1060779 2 0.0000 0.873 0.000 1.000 0.000 0.000
#> GSM1060780 2 0.2760 0.850 0.000 0.872 0.000 0.128
#> GSM1060781 4 0.4961 -0.272 0.000 0.448 0.000 0.552
#> GSM1060782 2 0.0000 0.873 0.000 1.000 0.000 0.000
#> GSM1060783 2 0.4134 0.814 0.000 0.740 0.000 0.260
#> GSM1060784 2 0.4134 0.814 0.000 0.740 0.000 0.260
#> GSM1060785 2 0.4134 0.814 0.000 0.740 0.000 0.260
#> GSM1060786 2 0.0000 0.873 0.000 1.000 0.000 0.000
#> GSM1060787 2 0.4134 0.814 0.000 0.740 0.000 0.260
#> GSM1060788 2 0.4134 0.814 0.000 0.740 0.000 0.260
#> GSM1060789 2 0.4134 0.814 0.000 0.740 0.000 0.260
#> GSM1060790 2 0.0000 0.873 0.000 1.000 0.000 0.000
#> GSM1060754 1 0.2921 0.798 0.860 0.000 0.000 0.140
#> GSM1060745 1 0.0000 0.929 1.000 0.000 0.000 0.000
#> GSM1060756 1 0.0000 0.929 1.000 0.000 0.000 0.000
#> GSM1060746 1 0.0000 0.929 1.000 0.000 0.000 0.000
#> GSM1060758 4 0.0336 0.764 0.008 0.000 0.000 0.992
#> GSM1060765 1 0.0000 0.929 1.000 0.000 0.000 0.000
#> GSM1060732 3 0.0000 0.989 0.000 0.000 1.000 0.000
#> GSM1060727 3 0.0000 0.989 0.000 0.000 1.000 0.000
#> GSM1060740 1 0.0000 0.929 1.000 0.000 0.000 0.000
#> GSM1060730 3 0.0000 0.989 0.000 0.000 1.000 0.000
#> GSM1060737 1 0.0000 0.929 1.000 0.000 0.000 0.000
#> GSM1060743 1 0.0000 0.929 1.000 0.000 0.000 0.000
#> GSM1060734 1 0.0000 0.929 1.000 0.000 0.000 0.000
#> GSM1060729 3 0.0000 0.989 0.000 0.000 1.000 0.000
#> GSM1060744 1 0.0000 0.929 1.000 0.000 0.000 0.000
#> GSM1060742 4 0.4222 0.651 0.272 0.000 0.000 0.728
#> GSM1060752 1 0.1211 0.899 0.960 0.000 0.000 0.040
#> GSM1060755 4 0.4134 0.667 0.260 0.000 0.000 0.740
#> GSM1060761 4 0.0336 0.764 0.008 0.000 0.000 0.992
#> GSM1060760 4 0.0336 0.764 0.008 0.000 0.000 0.992
#> GSM1060767 1 0.0000 0.929 1.000 0.000 0.000 0.000
#> GSM1060741 1 0.4406 0.542 0.700 0.000 0.000 0.300
#> GSM1060759 4 0.0336 0.764 0.008 0.000 0.000 0.992
#> GSM1060728 3 0.1474 0.929 0.052 0.000 0.948 0.000
#> GSM1060763 1 0.0000 0.929 1.000 0.000 0.000 0.000
#> GSM1060747 1 0.4643 0.443 0.656 0.000 0.000 0.344
#> GSM1060764 1 0.0000 0.929 1.000 0.000 0.000 0.000
#> GSM1060733 1 0.0000 0.929 1.000 0.000 0.000 0.000
#> GSM1060735 1 0.0000 0.929 1.000 0.000 0.000 0.000
#> GSM1060739 1 0.4907 0.211 0.580 0.000 0.000 0.420
#> GSM1060753 4 0.4134 0.667 0.260 0.000 0.000 0.740
#> GSM1060738 1 0.0188 0.926 0.996 0.000 0.000 0.004
#> GSM1060762 1 0.3754 0.798 0.852 0.064 0.000 0.084
#> GSM1060731 3 0.0000 0.989 0.000 0.000 1.000 0.000
#> GSM1060750 4 0.0817 0.769 0.024 0.000 0.000 0.976
#> GSM1060749 4 0.3356 0.736 0.176 0.000 0.000 0.824
#> GSM1060736 1 0.0000 0.929 1.000 0.000 0.000 0.000
#> GSM1060748 4 0.0817 0.769 0.024 0.000 0.000 0.976
#> GSM1060751 1 0.0000 0.929 1.000 0.000 0.000 0.000
#> GSM1060766 1 0.0336 0.921 0.992 0.000 0.000 0.008
#> GSM1060757 4 0.4134 0.667 0.260 0.000 0.000 0.740
#> GSM1060726 3 0.0000 0.989 0.000 0.000 1.000 0.000
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> GSM1060768 5 0.0000 0.937 0.000 0.000 0.000 0.000 1.000
#> GSM1060769 5 0.0000 0.937 0.000 0.000 0.000 0.000 1.000
#> GSM1060770 5 0.0000 0.937 0.000 0.000 0.000 0.000 1.000
#> GSM1060771 2 0.0000 0.999 0.000 1.000 0.000 0.000 0.000
#> GSM1060772 5 0.3424 0.682 0.000 0.240 0.000 0.000 0.760
#> GSM1060773 2 0.0000 0.999 0.000 1.000 0.000 0.000 0.000
#> GSM1060774 5 0.0000 0.937 0.000 0.000 0.000 0.000 1.000
#> GSM1060775 5 0.0000 0.937 0.000 0.000 0.000 0.000 1.000
#> GSM1060776 5 0.0000 0.937 0.000 0.000 0.000 0.000 1.000
#> GSM1060777 2 0.0000 0.999 0.000 1.000 0.000 0.000 0.000
#> GSM1060778 5 0.0000 0.937 0.000 0.000 0.000 0.000 1.000
#> GSM1060779 5 0.0000 0.937 0.000 0.000 0.000 0.000 1.000
#> GSM1060780 5 0.4273 0.240 0.000 0.448 0.000 0.000 0.552
#> GSM1060781 2 0.0000 0.999 0.000 1.000 0.000 0.000 0.000
#> GSM1060782 5 0.0000 0.937 0.000 0.000 0.000 0.000 1.000
#> GSM1060783 2 0.0000 0.999 0.000 1.000 0.000 0.000 0.000
#> GSM1060784 2 0.0162 0.995 0.000 0.996 0.000 0.000 0.004
#> GSM1060785 2 0.0000 0.999 0.000 1.000 0.000 0.000 0.000
#> GSM1060786 5 0.0000 0.937 0.000 0.000 0.000 0.000 1.000
#> GSM1060787 2 0.0000 0.999 0.000 1.000 0.000 0.000 0.000
#> GSM1060788 2 0.0000 0.999 0.000 1.000 0.000 0.000 0.000
#> GSM1060789 2 0.0000 0.999 0.000 1.000 0.000 0.000 0.000
#> GSM1060790 5 0.0000 0.937 0.000 0.000 0.000 0.000 1.000
#> GSM1060754 1 0.4126 0.380 0.620 0.000 0.000 0.380 0.000
#> GSM1060745 1 0.0000 0.924 1.000 0.000 0.000 0.000 0.000
#> GSM1060756 1 0.0000 0.924 1.000 0.000 0.000 0.000 0.000
#> GSM1060746 1 0.0000 0.924 1.000 0.000 0.000 0.000 0.000
#> GSM1060758 4 0.0000 0.893 0.000 0.000 0.000 1.000 0.000
#> GSM1060765 1 0.0000 0.924 1.000 0.000 0.000 0.000 0.000
#> GSM1060732 3 0.0000 0.988 0.000 0.000 1.000 0.000 0.000
#> GSM1060727 3 0.0000 0.988 0.000 0.000 1.000 0.000 0.000
#> GSM1060740 1 0.0000 0.924 1.000 0.000 0.000 0.000 0.000
#> GSM1060730 3 0.0000 0.988 0.000 0.000 1.000 0.000 0.000
#> GSM1060737 1 0.0000 0.924 1.000 0.000 0.000 0.000 0.000
#> GSM1060743 1 0.0000 0.924 1.000 0.000 0.000 0.000 0.000
#> GSM1060734 1 0.0000 0.924 1.000 0.000 0.000 0.000 0.000
#> GSM1060729 3 0.0000 0.988 0.000 0.000 1.000 0.000 0.000
#> GSM1060744 1 0.0000 0.924 1.000 0.000 0.000 0.000 0.000
#> GSM1060742 4 0.0794 0.888 0.028 0.000 0.000 0.972 0.000
#> GSM1060752 1 0.2648 0.783 0.848 0.000 0.000 0.152 0.000
#> GSM1060755 4 0.0510 0.895 0.016 0.000 0.000 0.984 0.000
#> GSM1060761 4 0.1908 0.814 0.000 0.092 0.000 0.908 0.000
#> GSM1060760 4 0.0000 0.893 0.000 0.000 0.000 1.000 0.000
#> GSM1060767 1 0.0000 0.924 1.000 0.000 0.000 0.000 0.000
#> GSM1060741 1 0.4287 0.107 0.540 0.000 0.000 0.460 0.000
#> GSM1060759 4 0.0000 0.893 0.000 0.000 0.000 1.000 0.000
#> GSM1060728 3 0.1270 0.930 0.052 0.000 0.948 0.000 0.000
#> GSM1060763 1 0.0000 0.924 1.000 0.000 0.000 0.000 0.000
#> GSM1060747 4 0.4210 0.253 0.412 0.000 0.000 0.588 0.000
#> GSM1060764 1 0.0000 0.924 1.000 0.000 0.000 0.000 0.000
#> GSM1060733 1 0.0000 0.924 1.000 0.000 0.000 0.000 0.000
#> GSM1060735 1 0.0000 0.924 1.000 0.000 0.000 0.000 0.000
#> GSM1060739 4 0.4150 0.342 0.388 0.000 0.000 0.612 0.000
#> GSM1060753 4 0.0000 0.893 0.000 0.000 0.000 1.000 0.000
#> GSM1060738 1 0.0671 0.913 0.980 0.004 0.000 0.016 0.000
#> GSM1060762 1 0.6483 0.433 0.580 0.172 0.000 0.224 0.024
#> GSM1060731 3 0.0000 0.988 0.000 0.000 1.000 0.000 0.000
#> GSM1060750 4 0.0579 0.895 0.008 0.008 0.000 0.984 0.000
#> GSM1060749 4 0.0510 0.895 0.016 0.000 0.000 0.984 0.000
#> GSM1060736 1 0.0000 0.924 1.000 0.000 0.000 0.000 0.000
#> GSM1060748 4 0.0579 0.895 0.008 0.008 0.000 0.984 0.000
#> GSM1060751 1 0.1341 0.882 0.944 0.000 0.000 0.056 0.000
#> GSM1060766 1 0.0404 0.916 0.988 0.012 0.000 0.000 0.000
#> GSM1060757 4 0.0510 0.895 0.016 0.000 0.000 0.984 0.000
#> GSM1060726 3 0.0000 0.988 0.000 0.000 1.000 0.000 0.000
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> GSM1060768 5 0.0000 0.9304 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM1060769 5 0.0000 0.9304 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM1060770 5 0.0000 0.9304 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM1060771 2 0.0000 0.9978 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1060772 5 0.3076 0.6686 0.000 0.240 0.000 0.000 0.760 0.000
#> GSM1060773 2 0.0363 0.9856 0.000 0.988 0.000 0.000 0.000 0.012
#> GSM1060774 5 0.0000 0.9304 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM1060775 5 0.0000 0.9304 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM1060776 5 0.0000 0.9304 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM1060777 2 0.0000 0.9978 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1060778 5 0.0000 0.9304 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM1060779 5 0.0000 0.9304 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM1060780 5 0.3838 0.2406 0.000 0.448 0.000 0.000 0.552 0.000
#> GSM1060781 2 0.0000 0.9978 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1060782 5 0.0000 0.9304 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM1060783 2 0.0000 0.9978 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1060784 2 0.0146 0.9938 0.000 0.996 0.000 0.000 0.004 0.000
#> GSM1060785 2 0.0000 0.9978 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1060786 5 0.0000 0.9304 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM1060787 2 0.0000 0.9978 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1060788 2 0.0000 0.9978 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1060789 2 0.0000 0.9978 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1060790 5 0.0000 0.9304 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM1060754 1 0.3695 0.3860 0.624 0.000 0.000 0.000 0.000 0.376
#> GSM1060745 1 0.0260 0.9139 0.992 0.000 0.000 0.000 0.000 0.008
#> GSM1060756 1 0.0260 0.9139 0.992 0.000 0.000 0.000 0.000 0.008
#> GSM1060746 1 0.0260 0.9139 0.992 0.000 0.000 0.000 0.000 0.008
#> GSM1060758 6 0.3866 -0.0241 0.000 0.000 0.000 0.484 0.000 0.516
#> GSM1060765 1 0.0405 0.9116 0.988 0.000 0.000 0.008 0.000 0.004
#> GSM1060732 3 0.0000 0.9850 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1060727 3 0.0000 0.9850 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1060740 1 0.0508 0.9105 0.984 0.000 0.000 0.004 0.000 0.012
#> GSM1060730 3 0.0000 0.9850 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1060737 1 0.0520 0.9103 0.984 0.000 0.000 0.008 0.000 0.008
#> GSM1060743 1 0.0622 0.9096 0.980 0.000 0.000 0.008 0.000 0.012
#> GSM1060734 1 0.0260 0.9139 0.992 0.000 0.000 0.000 0.000 0.008
#> GSM1060729 3 0.0000 0.9850 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1060744 1 0.0547 0.9118 0.980 0.000 0.000 0.000 0.000 0.020
#> GSM1060742 6 0.0858 0.7793 0.028 0.000 0.000 0.004 0.000 0.968
#> GSM1060752 1 0.2553 0.7870 0.848 0.000 0.000 0.008 0.000 0.144
#> GSM1060755 6 0.0363 0.7888 0.012 0.000 0.000 0.000 0.000 0.988
#> GSM1060761 4 0.0260 1.0000 0.000 0.000 0.000 0.992 0.000 0.008
#> GSM1060760 4 0.0260 1.0000 0.000 0.000 0.000 0.992 0.000 0.008
#> GSM1060767 1 0.0260 0.9139 0.992 0.000 0.000 0.000 0.000 0.008
#> GSM1060741 1 0.3862 0.0500 0.524 0.000 0.000 0.000 0.000 0.476
#> GSM1060759 4 0.0260 1.0000 0.000 0.000 0.000 0.992 0.000 0.008
#> GSM1060728 3 0.1141 0.9077 0.052 0.000 0.948 0.000 0.000 0.000
#> GSM1060763 1 0.0260 0.9139 0.992 0.000 0.000 0.000 0.000 0.008
#> GSM1060747 6 0.4025 0.2357 0.416 0.000 0.000 0.008 0.000 0.576
#> GSM1060764 1 0.0260 0.9139 0.992 0.000 0.000 0.000 0.000 0.008
#> GSM1060733 1 0.0260 0.9139 0.992 0.000 0.000 0.000 0.000 0.008
#> GSM1060735 1 0.0146 0.9129 0.996 0.000 0.000 0.000 0.000 0.004
#> GSM1060739 6 0.3852 0.3389 0.384 0.000 0.000 0.004 0.000 0.612
#> GSM1060753 6 0.0713 0.7738 0.000 0.000 0.000 0.028 0.000 0.972
#> GSM1060738 1 0.0891 0.9066 0.968 0.000 0.000 0.008 0.000 0.024
#> GSM1060762 1 0.5823 0.4000 0.580 0.172 0.000 0.000 0.024 0.224
#> GSM1060731 3 0.0000 0.9850 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1060750 6 0.0405 0.7862 0.004 0.008 0.000 0.000 0.000 0.988
#> GSM1060749 6 0.0260 0.7892 0.008 0.000 0.000 0.000 0.000 0.992
#> GSM1060736 1 0.0520 0.9103 0.984 0.000 0.000 0.008 0.000 0.008
#> GSM1060748 6 0.0508 0.7856 0.012 0.004 0.000 0.000 0.000 0.984
#> GSM1060751 1 0.1584 0.8783 0.928 0.000 0.000 0.008 0.000 0.064
#> GSM1060766 1 0.1078 0.9043 0.964 0.012 0.000 0.008 0.000 0.016
#> GSM1060757 6 0.0363 0.7888 0.012 0.000 0.000 0.000 0.000 0.988
#> GSM1060726 3 0.0000 0.9850 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)
Test correlation between subgroups and known annotations. If the known annotation is numeric, one-way ANOVA test is applied, and if the known annotation is discrete, chi-squared contingency table test is applied.
test_to_known_factors(res)
#> n disease.state(p) tissue(p) k
#> SD:pam 63 1.01e-10 0.011626 2
#> SD:pam 64 3.90e-10 0.000875 3
#> SD:pam 62 2.20e-13 0.000106 4
#> SD:pam 59 4.71e-12 0.052108 5
#> SD:pam 58 3.15e-11 0.005414 6
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 51941 rows and 65 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 5.
#>
#> Following methods can be applied to this 'ConsensusPartition' object:
#> [1] "cola_report" "collect_classes" "collect_plots"
#> [4] "collect_stats" "colnames" "compare_signatures"
#> [7] "consensus_heatmap" "dimension_reduction" "functional_enrichment"
#> [10] "get_anno_col" "get_anno" "get_classes"
#> [13] "get_consensus" "get_matrix" "get_membership"
#> [16] "get_param" "get_signatures" "get_stats"
#> [19] "is_best_k" "is_stable_k" "membership_heatmap"
#> [22] "ncol" "nrow" "plot_ecdf"
#> [25] "rownames" "select_partition_number" "show"
#> [28] "suggest_best_k" "test_to_known_factors"
collect_plots()
function collects all the plots made from res
for all k
(number of partitions)
into one single page to provide an easy and fast comparison between different k
.
collect_plots(res)
The plots are:
k
and the heatmap of
predicted classes for each k
.k
.k
.k
.All the plots in panels can be made by individual functions and they are plotted later in this section.
select_partition_number()
produces several plots showing different
statistics for choosing “optimized” k
. There are following statistics:
k
;k
, the area increased is defined as \(A_k - A_{k-1}\).The detailed explanations of these statistics can be found in the cola vignette.
Generally speaking, lower PAC score, higher mean silhouette score or higher
concordance corresponds to better partition. Rand index and Jaccard index
measure how similar the current partition is compared to partition with k-1
.
If they are too similar, we won't accept k
is better than k-1
.
select_partition_number(res)
The numeric values for all these statistics can be obtained by get_stats()
.
get_stats(res)
#> k 1-PAC mean_silhouette concordance area_increased Rand Jaccard
#> 2 2 1.000 0.989 0.994 0.4671 0.536 0.536
#> 3 3 0.961 0.920 0.967 0.2989 0.869 0.756
#> 4 4 0.852 0.558 0.809 0.1058 0.839 0.619
#> 5 5 0.975 0.949 0.978 0.0513 0.812 0.506
#> 6 6 0.826 0.848 0.896 0.1209 0.923 0.741
suggest_best_k()
suggests the best \(k\) based on these statistics. The rules are as follows:
suggest_best_k(res)
#> [1] 5
#> attr(,"optional")
#> [1] 2 3
There is also optional best \(k\) = 2 3 that is worth to check.
Following shows the table of the partitions (You need to click the show/hide
code output link to see it). The membership matrix (columns with name p*
)
is inferred by
clue::cl_consensus()
function with the SE
method. Basically the value in the membership matrix
represents the probability to belong to a certain group. The finall class
label for an item is determined with the group with highest probability it
belongs to.
In get_classes()
function, the entropy is calculated from the membership
matrix and the silhouette score is calculated from the consensus matrix.
cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#> class entropy silhouette p1 p2
#> GSM1060768 2 0.0000 1.000 0.000 1.000
#> GSM1060769 2 0.0000 1.000 0.000 1.000
#> GSM1060770 2 0.0000 1.000 0.000 1.000
#> GSM1060771 2 0.0000 1.000 0.000 1.000
#> GSM1060772 2 0.0000 1.000 0.000 1.000
#> GSM1060773 2 0.0000 1.000 0.000 1.000
#> GSM1060774 2 0.0000 1.000 0.000 1.000
#> GSM1060775 2 0.0000 1.000 0.000 1.000
#> GSM1060776 2 0.0000 1.000 0.000 1.000
#> GSM1060777 2 0.0000 1.000 0.000 1.000
#> GSM1060778 2 0.0000 1.000 0.000 1.000
#> GSM1060779 2 0.0000 1.000 0.000 1.000
#> GSM1060780 2 0.0000 1.000 0.000 1.000
#> GSM1060781 2 0.0000 1.000 0.000 1.000
#> GSM1060782 2 0.0000 1.000 0.000 1.000
#> GSM1060783 2 0.0000 1.000 0.000 1.000
#> GSM1060784 2 0.0000 1.000 0.000 1.000
#> GSM1060785 2 0.0000 1.000 0.000 1.000
#> GSM1060786 2 0.0000 1.000 0.000 1.000
#> GSM1060787 2 0.0000 1.000 0.000 1.000
#> GSM1060788 2 0.0000 1.000 0.000 1.000
#> GSM1060789 2 0.0000 1.000 0.000 1.000
#> GSM1060790 2 0.0000 1.000 0.000 1.000
#> GSM1060754 1 0.0000 0.990 1.000 0.000
#> GSM1060745 1 0.0000 0.990 1.000 0.000
#> GSM1060756 1 0.0000 0.990 1.000 0.000
#> GSM1060746 1 0.0000 0.990 1.000 0.000
#> GSM1060758 1 0.0376 0.988 0.996 0.004
#> GSM1060765 1 0.0000 0.990 1.000 0.000
#> GSM1060732 1 0.2778 0.958 0.952 0.048
#> GSM1060727 1 0.2778 0.958 0.952 0.048
#> GSM1060740 1 0.0000 0.990 1.000 0.000
#> GSM1060730 1 0.2778 0.958 0.952 0.048
#> GSM1060737 1 0.0000 0.990 1.000 0.000
#> GSM1060743 1 0.0000 0.990 1.000 0.000
#> GSM1060734 1 0.0000 0.990 1.000 0.000
#> GSM1060729 1 0.2778 0.958 0.952 0.048
#> GSM1060744 1 0.0000 0.990 1.000 0.000
#> GSM1060742 1 0.0000 0.990 1.000 0.000
#> GSM1060752 1 0.0000 0.990 1.000 0.000
#> GSM1060755 1 0.0000 0.990 1.000 0.000
#> GSM1060761 1 0.0376 0.988 0.996 0.004
#> GSM1060760 1 0.0376 0.988 0.996 0.004
#> GSM1060767 1 0.0000 0.990 1.000 0.000
#> GSM1060741 1 0.0000 0.990 1.000 0.000
#> GSM1060759 1 0.0376 0.988 0.996 0.004
#> GSM1060728 1 0.2778 0.958 0.952 0.048
#> GSM1060763 1 0.0000 0.990 1.000 0.000
#> GSM1060747 1 0.0000 0.990 1.000 0.000
#> GSM1060764 1 0.0000 0.990 1.000 0.000
#> GSM1060733 1 0.0000 0.990 1.000 0.000
#> GSM1060735 1 0.0000 0.990 1.000 0.000
#> GSM1060739 1 0.0000 0.990 1.000 0.000
#> GSM1060753 1 0.0376 0.988 0.996 0.004
#> GSM1060738 1 0.0000 0.990 1.000 0.000
#> GSM1060762 1 0.2778 0.958 0.952 0.048
#> GSM1060731 1 0.2778 0.958 0.952 0.048
#> GSM1060750 1 0.0376 0.988 0.996 0.004
#> GSM1060749 1 0.0000 0.990 1.000 0.000
#> GSM1060736 1 0.0000 0.990 1.000 0.000
#> GSM1060748 1 0.0000 0.990 1.000 0.000
#> GSM1060751 1 0.0000 0.990 1.000 0.000
#> GSM1060766 1 0.0000 0.990 1.000 0.000
#> GSM1060757 1 0.0000 0.990 1.000 0.000
#> GSM1060726 1 0.2778 0.958 0.952 0.048
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> GSM1060768 2 0.0000 0.997 0.000 1.000 0.000
#> GSM1060769 2 0.0000 0.997 0.000 1.000 0.000
#> GSM1060770 2 0.0000 0.997 0.000 1.000 0.000
#> GSM1060771 2 0.0237 0.997 0.004 0.996 0.000
#> GSM1060772 2 0.0237 0.997 0.004 0.996 0.000
#> GSM1060773 2 0.0237 0.997 0.004 0.996 0.000
#> GSM1060774 2 0.0000 0.997 0.000 1.000 0.000
#> GSM1060775 2 0.0000 0.997 0.000 1.000 0.000
#> GSM1060776 2 0.0000 0.997 0.000 1.000 0.000
#> GSM1060777 2 0.0237 0.997 0.004 0.996 0.000
#> GSM1060778 2 0.0000 0.997 0.000 1.000 0.000
#> GSM1060779 2 0.0000 0.997 0.000 1.000 0.000
#> GSM1060780 2 0.0237 0.997 0.004 0.996 0.000
#> GSM1060781 2 0.0237 0.997 0.004 0.996 0.000
#> GSM1060782 2 0.0000 0.997 0.000 1.000 0.000
#> GSM1060783 2 0.0237 0.997 0.004 0.996 0.000
#> GSM1060784 2 0.0237 0.997 0.004 0.996 0.000
#> GSM1060785 2 0.0237 0.997 0.004 0.996 0.000
#> GSM1060786 2 0.0000 0.997 0.000 1.000 0.000
#> GSM1060787 2 0.0237 0.997 0.004 0.996 0.000
#> GSM1060788 2 0.0237 0.997 0.004 0.996 0.000
#> GSM1060789 2 0.0237 0.997 0.004 0.996 0.000
#> GSM1060790 2 0.0000 0.997 0.000 1.000 0.000
#> GSM1060754 1 0.0000 0.945 1.000 0.000 0.000
#> GSM1060745 1 0.0592 0.938 0.988 0.000 0.012
#> GSM1060756 1 0.0592 0.938 0.988 0.000 0.012
#> GSM1060746 1 0.0000 0.945 1.000 0.000 0.000
#> GSM1060758 1 0.6079 0.364 0.612 0.000 0.388
#> GSM1060765 1 0.0000 0.945 1.000 0.000 0.000
#> GSM1060732 3 0.0000 0.936 0.000 0.000 1.000
#> GSM1060727 3 0.0000 0.936 0.000 0.000 1.000
#> GSM1060740 1 0.0000 0.945 1.000 0.000 0.000
#> GSM1060730 3 0.0000 0.936 0.000 0.000 1.000
#> GSM1060737 1 0.0000 0.945 1.000 0.000 0.000
#> GSM1060743 1 0.0000 0.945 1.000 0.000 0.000
#> GSM1060734 1 0.0592 0.938 0.988 0.000 0.012
#> GSM1060729 3 0.0000 0.936 0.000 0.000 1.000
#> GSM1060744 1 0.0000 0.945 1.000 0.000 0.000
#> GSM1060742 1 0.0000 0.945 1.000 0.000 0.000
#> GSM1060752 1 0.0000 0.945 1.000 0.000 0.000
#> GSM1060755 1 0.0000 0.945 1.000 0.000 0.000
#> GSM1060761 1 0.6079 0.364 0.612 0.000 0.388
#> GSM1060760 1 0.6079 0.364 0.612 0.000 0.388
#> GSM1060767 1 0.0592 0.938 0.988 0.000 0.012
#> GSM1060741 1 0.0000 0.945 1.000 0.000 0.000
#> GSM1060759 1 0.6079 0.364 0.612 0.000 0.388
#> GSM1060728 3 0.6171 0.790 0.144 0.080 0.776
#> GSM1060763 1 0.0000 0.945 1.000 0.000 0.000
#> GSM1060747 1 0.0000 0.945 1.000 0.000 0.000
#> GSM1060764 1 0.0592 0.938 0.988 0.000 0.012
#> GSM1060733 1 0.0592 0.938 0.988 0.000 0.012
#> GSM1060735 1 0.0000 0.945 1.000 0.000 0.000
#> GSM1060739 1 0.0000 0.945 1.000 0.000 0.000
#> GSM1060753 1 0.0000 0.945 1.000 0.000 0.000
#> GSM1060738 1 0.0000 0.945 1.000 0.000 0.000
#> GSM1060762 3 0.5268 0.723 0.212 0.012 0.776
#> GSM1060731 3 0.0000 0.936 0.000 0.000 1.000
#> GSM1060750 1 0.0000 0.945 1.000 0.000 0.000
#> GSM1060749 1 0.0000 0.945 1.000 0.000 0.000
#> GSM1060736 1 0.0000 0.945 1.000 0.000 0.000
#> GSM1060748 1 0.0000 0.945 1.000 0.000 0.000
#> GSM1060751 1 0.0000 0.945 1.000 0.000 0.000
#> GSM1060766 1 0.0000 0.945 1.000 0.000 0.000
#> GSM1060757 1 0.0000 0.945 1.000 0.000 0.000
#> GSM1060726 3 0.0000 0.936 0.000 0.000 1.000
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> GSM1060768 2 0.0000 0.998 0.000 1.000 0.000 0.000
#> GSM1060769 2 0.0000 0.998 0.000 1.000 0.000 0.000
#> GSM1060770 2 0.0000 0.998 0.000 1.000 0.000 0.000
#> GSM1060771 2 0.0188 0.998 0.000 0.996 0.000 0.004
#> GSM1060772 2 0.0188 0.998 0.000 0.996 0.000 0.004
#> GSM1060773 2 0.0188 0.998 0.000 0.996 0.000 0.004
#> GSM1060774 2 0.0000 0.998 0.000 1.000 0.000 0.000
#> GSM1060775 2 0.0000 0.998 0.000 1.000 0.000 0.000
#> GSM1060776 2 0.0000 0.998 0.000 1.000 0.000 0.000
#> GSM1060777 2 0.0188 0.998 0.000 0.996 0.000 0.004
#> GSM1060778 2 0.0000 0.998 0.000 1.000 0.000 0.000
#> GSM1060779 2 0.0000 0.998 0.000 1.000 0.000 0.000
#> GSM1060780 2 0.0188 0.998 0.000 0.996 0.000 0.004
#> GSM1060781 2 0.0188 0.998 0.000 0.996 0.000 0.004
#> GSM1060782 2 0.0000 0.998 0.000 1.000 0.000 0.000
#> GSM1060783 2 0.0188 0.998 0.000 0.996 0.000 0.004
#> GSM1060784 2 0.0188 0.998 0.000 0.996 0.000 0.004
#> GSM1060785 2 0.0188 0.998 0.000 0.996 0.000 0.004
#> GSM1060786 2 0.0000 0.998 0.000 1.000 0.000 0.000
#> GSM1060787 2 0.0188 0.998 0.000 0.996 0.000 0.004
#> GSM1060788 2 0.0188 0.998 0.000 0.996 0.000 0.004
#> GSM1060789 2 0.0188 0.998 0.000 0.996 0.000 0.004
#> GSM1060790 2 0.0000 0.998 0.000 1.000 0.000 0.000
#> GSM1060754 1 0.4989 -0.234 0.528 0.000 0.000 0.472
#> GSM1060745 1 0.1022 0.476 0.968 0.000 0.000 0.032
#> GSM1060756 1 0.0336 0.486 0.992 0.000 0.000 0.008
#> GSM1060746 1 0.0707 0.485 0.980 0.000 0.000 0.020
#> GSM1060758 4 0.0188 0.371 0.004 0.000 0.000 0.996
#> GSM1060765 1 0.4989 -0.173 0.528 0.000 0.000 0.472
#> GSM1060732 3 0.0000 1.000 0.000 0.000 1.000 0.000
#> GSM1060727 3 0.0000 1.000 0.000 0.000 1.000 0.000
#> GSM1060740 4 0.4998 0.262 0.488 0.000 0.000 0.512
#> GSM1060730 3 0.0000 1.000 0.000 0.000 1.000 0.000
#> GSM1060737 1 0.5000 -0.304 0.500 0.000 0.000 0.500
#> GSM1060743 1 0.4989 -0.173 0.528 0.000 0.000 0.472
#> GSM1060734 1 0.0000 0.484 1.000 0.000 0.000 0.000
#> GSM1060729 3 0.0000 1.000 0.000 0.000 1.000 0.000
#> GSM1060744 1 0.4989 -0.173 0.528 0.000 0.000 0.472
#> GSM1060742 4 0.4977 0.298 0.460 0.000 0.000 0.540
#> GSM1060752 4 0.4996 0.276 0.484 0.000 0.000 0.516
#> GSM1060755 4 0.4992 0.296 0.476 0.000 0.000 0.524
#> GSM1060761 4 0.0188 0.371 0.004 0.000 0.000 0.996
#> GSM1060760 4 0.0188 0.371 0.004 0.000 0.000 0.996
#> GSM1060767 1 0.0188 0.485 0.996 0.000 0.000 0.004
#> GSM1060741 4 0.4998 0.262 0.488 0.000 0.000 0.512
#> GSM1060759 4 0.0188 0.371 0.004 0.000 0.000 0.996
#> GSM1060728 1 0.3015 0.441 0.904 0.020 0.036 0.040
#> GSM1060763 1 0.2345 0.451 0.900 0.000 0.000 0.100
#> GSM1060747 1 0.4992 -0.191 0.524 0.000 0.000 0.476
#> GSM1060764 1 0.1474 0.476 0.948 0.000 0.000 0.052
#> GSM1060733 1 0.0000 0.484 1.000 0.000 0.000 0.000
#> GSM1060735 1 0.4989 -0.173 0.528 0.000 0.000 0.472
#> GSM1060739 4 0.4996 0.276 0.484 0.000 0.000 0.516
#> GSM1060753 4 0.1302 0.371 0.044 0.000 0.000 0.956
#> GSM1060738 1 0.4989 -0.173 0.528 0.000 0.000 0.472
#> GSM1060762 1 0.2522 0.450 0.920 0.012 0.016 0.052
#> GSM1060731 3 0.0000 1.000 0.000 0.000 1.000 0.000
#> GSM1060750 4 0.5158 0.293 0.472 0.004 0.000 0.524
#> GSM1060749 4 0.4992 0.294 0.476 0.000 0.000 0.524
#> GSM1060736 1 0.4985 -0.168 0.532 0.000 0.000 0.468
#> GSM1060748 4 0.4992 0.294 0.476 0.000 0.000 0.524
#> GSM1060751 1 0.4989 -0.173 0.528 0.000 0.000 0.472
#> GSM1060766 1 0.4989 -0.173 0.528 0.000 0.000 0.472
#> GSM1060757 4 0.4992 0.288 0.476 0.000 0.000 0.524
#> GSM1060726 3 0.0000 1.000 0.000 0.000 1.000 0.000
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> GSM1060768 5 0.0000 0.98879 0.000 0.000 0 0.000 1.000
#> GSM1060769 5 0.0000 0.98879 0.000 0.000 0 0.000 1.000
#> GSM1060770 5 0.0000 0.98879 0.000 0.000 0 0.000 1.000
#> GSM1060771 2 0.0290 0.99141 0.000 0.992 0 0.000 0.008
#> GSM1060772 5 0.2233 0.86895 0.000 0.104 0 0.004 0.892
#> GSM1060773 2 0.0693 0.97995 0.000 0.980 0 0.012 0.008
#> GSM1060774 5 0.0000 0.98879 0.000 0.000 0 0.000 1.000
#> GSM1060775 5 0.0000 0.98879 0.000 0.000 0 0.000 1.000
#> GSM1060776 5 0.0000 0.98879 0.000 0.000 0 0.000 1.000
#> GSM1060777 2 0.0290 0.99141 0.000 0.992 0 0.000 0.008
#> GSM1060778 5 0.0000 0.98879 0.000 0.000 0 0.000 1.000
#> GSM1060779 5 0.0000 0.98879 0.000 0.000 0 0.000 1.000
#> GSM1060780 2 0.1544 0.92668 0.000 0.932 0 0.000 0.068
#> GSM1060781 2 0.0290 0.99141 0.000 0.992 0 0.000 0.008
#> GSM1060782 5 0.0000 0.98879 0.000 0.000 0 0.000 1.000
#> GSM1060783 2 0.0290 0.99141 0.000 0.992 0 0.000 0.008
#> GSM1060784 2 0.0290 0.99141 0.000 0.992 0 0.000 0.008
#> GSM1060785 2 0.0290 0.99141 0.000 0.992 0 0.000 0.008
#> GSM1060786 5 0.0000 0.98879 0.000 0.000 0 0.000 1.000
#> GSM1060787 2 0.0290 0.99141 0.000 0.992 0 0.000 0.008
#> GSM1060788 2 0.0290 0.99141 0.000 0.992 0 0.000 0.008
#> GSM1060789 2 0.0290 0.99141 0.000 0.992 0 0.000 0.008
#> GSM1060790 5 0.0000 0.98879 0.000 0.000 0 0.000 1.000
#> GSM1060754 1 0.0451 0.97573 0.988 0.004 0 0.008 0.000
#> GSM1060745 1 0.0451 0.97573 0.988 0.004 0 0.008 0.000
#> GSM1060756 1 0.0324 0.97687 0.992 0.004 0 0.004 0.000
#> GSM1060746 1 0.0162 0.97759 0.996 0.000 0 0.004 0.000
#> GSM1060758 4 0.0162 0.77496 0.004 0.000 0 0.996 0.000
#> GSM1060765 1 0.0162 0.97859 0.996 0.004 0 0.000 0.000
#> GSM1060732 3 0.0000 1.00000 0.000 0.000 1 0.000 0.000
#> GSM1060727 3 0.0000 1.00000 0.000 0.000 1 0.000 0.000
#> GSM1060740 1 0.0162 0.97859 0.996 0.004 0 0.000 0.000
#> GSM1060730 3 0.0000 1.00000 0.000 0.000 1 0.000 0.000
#> GSM1060737 1 0.0162 0.97859 0.996 0.004 0 0.000 0.000
#> GSM1060743 1 0.0162 0.97859 0.996 0.004 0 0.000 0.000
#> GSM1060734 1 0.0324 0.97687 0.992 0.004 0 0.004 0.000
#> GSM1060729 3 0.0000 1.00000 0.000 0.000 1 0.000 0.000
#> GSM1060744 1 0.0162 0.97759 0.996 0.000 0 0.004 0.000
#> GSM1060742 1 0.1124 0.95837 0.960 0.004 0 0.036 0.000
#> GSM1060752 1 0.0162 0.97859 0.996 0.004 0 0.000 0.000
#> GSM1060755 1 0.2136 0.90664 0.904 0.008 0 0.088 0.000
#> GSM1060761 4 0.0162 0.77496 0.004 0.000 0 0.996 0.000
#> GSM1060760 4 0.0162 0.77496 0.004 0.000 0 0.996 0.000
#> GSM1060767 1 0.0324 0.97687 0.992 0.004 0 0.004 0.000
#> GSM1060741 1 0.0000 0.97837 1.000 0.000 0 0.000 0.000
#> GSM1060759 4 0.0162 0.77496 0.004 0.000 0 0.996 0.000
#> GSM1060728 1 0.1408 0.95337 0.948 0.008 0 0.044 0.000
#> GSM1060763 1 0.0000 0.97837 1.000 0.000 0 0.000 0.000
#> GSM1060747 1 0.0162 0.97859 0.996 0.004 0 0.000 0.000
#> GSM1060764 1 0.0451 0.97573 0.988 0.004 0 0.008 0.000
#> GSM1060733 1 0.0324 0.97687 0.992 0.004 0 0.004 0.000
#> GSM1060735 1 0.0162 0.97859 0.996 0.004 0 0.000 0.000
#> GSM1060739 1 0.0162 0.97859 0.996 0.004 0 0.000 0.000
#> GSM1060753 4 0.4560 -0.00759 0.484 0.008 0 0.508 0.000
#> GSM1060738 1 0.0162 0.97859 0.996 0.004 0 0.000 0.000
#> GSM1060762 1 0.1408 0.95337 0.948 0.008 0 0.044 0.000
#> GSM1060731 3 0.0000 1.00000 0.000 0.000 1 0.000 0.000
#> GSM1060750 1 0.2077 0.91137 0.908 0.008 0 0.084 0.000
#> GSM1060749 1 0.1124 0.95918 0.960 0.004 0 0.036 0.000
#> GSM1060736 1 0.0162 0.97859 0.996 0.004 0 0.000 0.000
#> GSM1060748 1 0.2077 0.91137 0.908 0.008 0 0.084 0.000
#> GSM1060751 1 0.0162 0.97859 0.996 0.004 0 0.000 0.000
#> GSM1060766 1 0.0162 0.97859 0.996 0.004 0 0.000 0.000
#> GSM1060757 1 0.1205 0.95620 0.956 0.004 0 0.040 0.000
#> GSM1060726 3 0.0000 1.00000 0.000 0.000 1 0.000 0.000
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> GSM1060768 5 0.0000 0.992 0.000 0.000 0 0.000 1.000 0.000
#> GSM1060769 5 0.0000 0.992 0.000 0.000 0 0.000 1.000 0.000
#> GSM1060770 5 0.0146 0.989 0.000 0.000 0 0.000 0.996 0.004
#> GSM1060771 2 0.0000 0.976 0.000 1.000 0 0.000 0.000 0.000
#> GSM1060772 5 0.1588 0.907 0.000 0.072 0 0.000 0.924 0.004
#> GSM1060773 2 0.0000 0.976 0.000 1.000 0 0.000 0.000 0.000
#> GSM1060774 5 0.0000 0.992 0.000 0.000 0 0.000 1.000 0.000
#> GSM1060775 5 0.0000 0.992 0.000 0.000 0 0.000 1.000 0.000
#> GSM1060776 5 0.0000 0.992 0.000 0.000 0 0.000 1.000 0.000
#> GSM1060777 2 0.0000 0.976 0.000 1.000 0 0.000 0.000 0.000
#> GSM1060778 5 0.0000 0.992 0.000 0.000 0 0.000 1.000 0.000
#> GSM1060779 5 0.0000 0.992 0.000 0.000 0 0.000 1.000 0.000
#> GSM1060780 2 0.2697 0.739 0.000 0.812 0 0.000 0.188 0.000
#> GSM1060781 2 0.0000 0.976 0.000 1.000 0 0.000 0.000 0.000
#> GSM1060782 5 0.0000 0.992 0.000 0.000 0 0.000 1.000 0.000
#> GSM1060783 2 0.0000 0.976 0.000 1.000 0 0.000 0.000 0.000
#> GSM1060784 2 0.0000 0.976 0.000 1.000 0 0.000 0.000 0.000
#> GSM1060785 2 0.0000 0.976 0.000 1.000 0 0.000 0.000 0.000
#> GSM1060786 5 0.0000 0.992 0.000 0.000 0 0.000 1.000 0.000
#> GSM1060787 2 0.0000 0.976 0.000 1.000 0 0.000 0.000 0.000
#> GSM1060788 2 0.0000 0.976 0.000 1.000 0 0.000 0.000 0.000
#> GSM1060789 2 0.0000 0.976 0.000 1.000 0 0.000 0.000 0.000
#> GSM1060790 5 0.0000 0.992 0.000 0.000 0 0.000 1.000 0.000
#> GSM1060754 1 0.0363 0.693 0.988 0.000 0 0.000 0.000 0.012
#> GSM1060745 1 0.2135 0.564 0.872 0.000 0 0.000 0.000 0.128
#> GSM1060756 1 0.0260 0.696 0.992 0.000 0 0.000 0.000 0.008
#> GSM1060746 1 0.2378 0.732 0.848 0.000 0 0.000 0.000 0.152
#> GSM1060758 4 0.0937 0.941 0.040 0.000 0 0.960 0.000 0.000
#> GSM1060765 1 0.3695 0.685 0.624 0.000 0 0.000 0.000 0.376
#> GSM1060732 3 0.0000 1.000 0.000 0.000 1 0.000 0.000 0.000
#> GSM1060727 3 0.0000 1.000 0.000 0.000 1 0.000 0.000 0.000
#> GSM1060740 1 0.3695 0.685 0.624 0.000 0 0.000 0.000 0.376
#> GSM1060730 3 0.0000 1.000 0.000 0.000 1 0.000 0.000 0.000
#> GSM1060737 1 0.3330 0.713 0.716 0.000 0 0.000 0.000 0.284
#> GSM1060743 1 0.3221 0.721 0.736 0.000 0 0.000 0.000 0.264
#> GSM1060734 1 0.0865 0.677 0.964 0.000 0 0.000 0.000 0.036
#> GSM1060729 3 0.0000 1.000 0.000 0.000 1 0.000 0.000 0.000
#> GSM1060744 1 0.0000 0.701 1.000 0.000 0 0.000 0.000 0.000
#> GSM1060742 6 0.3782 0.897 0.412 0.000 0 0.000 0.000 0.588
#> GSM1060752 1 0.3050 0.703 0.764 0.000 0 0.000 0.000 0.236
#> GSM1060755 6 0.3756 0.904 0.400 0.000 0 0.000 0.000 0.600
#> GSM1060761 4 0.0000 0.981 0.000 0.000 0 1.000 0.000 0.000
#> GSM1060760 4 0.0000 0.981 0.000 0.000 0 1.000 0.000 0.000
#> GSM1060767 1 0.0146 0.699 0.996 0.000 0 0.000 0.000 0.004
#> GSM1060741 1 0.2823 0.536 0.796 0.000 0 0.000 0.000 0.204
#> GSM1060759 4 0.0000 0.981 0.000 0.000 0 1.000 0.000 0.000
#> GSM1060728 1 0.2402 0.538 0.856 0.004 0 0.000 0.000 0.140
#> GSM1060763 1 0.2697 0.727 0.812 0.000 0 0.000 0.000 0.188
#> GSM1060747 1 0.3695 0.684 0.624 0.000 0 0.000 0.000 0.376
#> GSM1060764 1 0.2416 0.731 0.844 0.000 0 0.000 0.000 0.156
#> GSM1060733 1 0.1556 0.630 0.920 0.000 0 0.000 0.000 0.080
#> GSM1060735 1 0.3684 0.687 0.628 0.000 0 0.000 0.000 0.372
#> GSM1060739 1 0.3390 0.559 0.704 0.000 0 0.000 0.000 0.296
#> GSM1060753 6 0.4653 0.882 0.360 0.000 0 0.052 0.000 0.588
#> GSM1060738 1 0.3371 0.709 0.708 0.000 0 0.000 0.000 0.292
#> GSM1060762 1 0.2402 0.538 0.856 0.004 0 0.000 0.000 0.140
#> GSM1060731 3 0.0000 1.000 0.000 0.000 1 0.000 0.000 0.000
#> GSM1060750 6 0.3446 0.890 0.308 0.000 0 0.000 0.000 0.692
#> GSM1060749 6 0.3446 0.890 0.308 0.000 0 0.000 0.000 0.692
#> GSM1060736 1 0.3330 0.713 0.716 0.000 0 0.000 0.000 0.284
#> GSM1060748 6 0.3428 0.885 0.304 0.000 0 0.000 0.000 0.696
#> GSM1060751 1 0.3563 0.706 0.664 0.000 0 0.000 0.000 0.336
#> GSM1060766 1 0.2912 0.639 0.784 0.000 0 0.000 0.000 0.216
#> GSM1060757 6 0.3782 0.897 0.412 0.000 0 0.000 0.000 0.588
#> GSM1060726 3 0.0000 1.000 0.000 0.000 1 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)
Test correlation between subgroups and known annotations. If the known annotation is numeric, one-way ANOVA test is applied, and if the known annotation is discrete, chi-squared contingency table test is applied.
test_to_known_factors(res)
#> n disease.state(p) tissue(p) k
#> SD:mclust 65 6.65e-15 1.29e-02 2
#> SD:mclust 61 5.68e-14 6.44e-04 3
#> SD:mclust 29 1.44e-06 6.08e-05 4
#> SD:mclust 64 4.18e-13 6.65e-02 5
#> SD:mclust 65 1.12e-12 1.07e-02 6
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 51941 rows and 65 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 6.
#>
#> Following methods can be applied to this 'ConsensusPartition' object:
#> [1] "cola_report" "collect_classes" "collect_plots"
#> [4] "collect_stats" "colnames" "compare_signatures"
#> [7] "consensus_heatmap" "dimension_reduction" "functional_enrichment"
#> [10] "get_anno_col" "get_anno" "get_classes"
#> [13] "get_consensus" "get_matrix" "get_membership"
#> [16] "get_param" "get_signatures" "get_stats"
#> [19] "is_best_k" "is_stable_k" "membership_heatmap"
#> [22] "ncol" "nrow" "plot_ecdf"
#> [25] "rownames" "select_partition_number" "show"
#> [28] "suggest_best_k" "test_to_known_factors"
collect_plots()
function collects all the plots made from res
for all k
(number of partitions)
into one single page to provide an easy and fast comparison between different k
.
collect_plots(res)
The plots are:
k
and the heatmap of
predicted classes for each k
.k
.k
.k
.All the plots in panels can be made by individual functions and they are plotted later in this section.
select_partition_number()
produces several plots showing different
statistics for choosing “optimized” k
. There are following statistics:
k
;k
, the area increased is defined as \(A_k - A_{k-1}\).The detailed explanations of these statistics can be found in the cola vignette.
Generally speaking, lower PAC score, higher mean silhouette score or higher
concordance corresponds to better partition. Rand index and Jaccard index
measure how similar the current partition is compared to partition with k-1
.
If they are too similar, we won't accept k
is better than k-1
.
select_partition_number(res)
The numeric values for all these statistics can be obtained by get_stats()
.
get_stats(res)
#> k 1-PAC mean_silhouette concordance area_increased Rand Jaccard
#> 2 2 0.904 0.927 0.964 0.4866 0.502 0.502
#> 3 3 1.000 0.989 0.995 0.2267 0.845 0.708
#> 4 4 0.999 0.936 0.975 0.1812 0.876 0.704
#> 5 5 0.816 0.833 0.895 0.1102 0.886 0.641
#> 6 6 0.909 0.853 0.927 0.0645 0.897 0.573
suggest_best_k()
suggests the best \(k\) based on these statistics. The rules are as follows:
suggest_best_k(res)
#> [1] 6
#> attr(,"optional")
#> [1] 2 3 4
There is also optional best \(k\) = 2 3 4 that is worth to check.
Following shows the table of the partitions (You need to click the show/hide
code output link to see it). The membership matrix (columns with name p*
)
is inferred by
clue::cl_consensus()
function with the SE
method. Basically the value in the membership matrix
represents the probability to belong to a certain group. The finall class
label for an item is determined with the group with highest probability it
belongs to.
In get_classes()
function, the entropy is calculated from the membership
matrix and the silhouette score is calculated from the consensus matrix.
cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#> class entropy silhouette p1 p2
#> GSM1060768 2 0.0000 0.925 0.000 1.000
#> GSM1060769 2 0.0000 0.925 0.000 1.000
#> GSM1060770 2 0.0000 0.925 0.000 1.000
#> GSM1060771 2 0.9248 0.557 0.340 0.660
#> GSM1060772 2 0.0000 0.925 0.000 1.000
#> GSM1060773 1 0.1184 0.981 0.984 0.016
#> GSM1060774 2 0.0000 0.925 0.000 1.000
#> GSM1060775 2 0.0000 0.925 0.000 1.000
#> GSM1060776 2 0.0000 0.925 0.000 1.000
#> GSM1060777 2 0.9896 0.312 0.440 0.560
#> GSM1060778 2 0.0000 0.925 0.000 1.000
#> GSM1060779 2 0.0000 0.925 0.000 1.000
#> GSM1060780 2 0.0672 0.924 0.008 0.992
#> GSM1060781 1 0.1184 0.981 0.984 0.016
#> GSM1060782 2 0.0000 0.925 0.000 1.000
#> GSM1060783 2 0.8955 0.609 0.312 0.688
#> GSM1060784 2 0.6712 0.794 0.176 0.824
#> GSM1060785 2 0.8661 0.649 0.288 0.712
#> GSM1060786 2 0.0000 0.925 0.000 1.000
#> GSM1060787 2 0.6801 0.790 0.180 0.820
#> GSM1060788 1 0.7674 0.685 0.776 0.224
#> GSM1060789 2 0.2423 0.908 0.040 0.960
#> GSM1060790 2 0.0000 0.925 0.000 1.000
#> GSM1060754 1 0.0000 0.989 1.000 0.000
#> GSM1060745 1 0.0000 0.989 1.000 0.000
#> GSM1060756 1 0.0000 0.989 1.000 0.000
#> GSM1060746 1 0.0000 0.989 1.000 0.000
#> GSM1060758 1 0.0938 0.985 0.988 0.012
#> GSM1060765 1 0.0376 0.989 0.996 0.004
#> GSM1060732 2 0.1184 0.923 0.016 0.984
#> GSM1060727 2 0.1184 0.923 0.016 0.984
#> GSM1060740 1 0.0376 0.989 0.996 0.004
#> GSM1060730 2 0.1184 0.923 0.016 0.984
#> GSM1060737 1 0.0000 0.989 1.000 0.000
#> GSM1060743 1 0.0000 0.989 1.000 0.000
#> GSM1060734 1 0.0000 0.989 1.000 0.000
#> GSM1060729 2 0.1184 0.923 0.016 0.984
#> GSM1060744 1 0.0000 0.989 1.000 0.000
#> GSM1060742 1 0.0000 0.989 1.000 0.000
#> GSM1060752 1 0.0376 0.989 0.996 0.004
#> GSM1060755 1 0.0376 0.989 0.996 0.004
#> GSM1060761 1 0.0938 0.985 0.988 0.012
#> GSM1060760 1 0.0672 0.987 0.992 0.008
#> GSM1060767 1 0.0000 0.989 1.000 0.000
#> GSM1060741 1 0.0376 0.989 0.996 0.004
#> GSM1060759 1 0.0672 0.987 0.992 0.008
#> GSM1060728 2 0.1184 0.923 0.016 0.984
#> GSM1060763 1 0.0000 0.989 1.000 0.000
#> GSM1060747 1 0.0000 0.989 1.000 0.000
#> GSM1060764 1 0.0000 0.989 1.000 0.000
#> GSM1060733 1 0.0000 0.989 1.000 0.000
#> GSM1060735 1 0.0000 0.989 1.000 0.000
#> GSM1060739 1 0.0376 0.989 0.996 0.004
#> GSM1060753 1 0.0376 0.989 0.996 0.004
#> GSM1060738 1 0.0376 0.989 0.996 0.004
#> GSM1060762 2 0.3584 0.896 0.068 0.932
#> GSM1060731 2 0.1184 0.923 0.016 0.984
#> GSM1060750 1 0.0938 0.985 0.988 0.012
#> GSM1060749 1 0.0672 0.987 0.992 0.008
#> GSM1060736 1 0.0000 0.989 1.000 0.000
#> GSM1060748 1 0.0938 0.985 0.988 0.012
#> GSM1060751 1 0.0376 0.989 0.996 0.004
#> GSM1060766 1 0.0938 0.985 0.988 0.012
#> GSM1060757 1 0.0000 0.989 1.000 0.000
#> GSM1060726 2 0.1184 0.923 0.016 0.984
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> GSM1060768 2 0.0000 0.999 0.000 1.00 0.000
#> GSM1060769 2 0.0000 0.999 0.000 1.00 0.000
#> GSM1060770 2 0.0000 0.999 0.000 1.00 0.000
#> GSM1060771 2 0.0000 0.999 0.000 1.00 0.000
#> GSM1060772 2 0.0000 0.999 0.000 1.00 0.000
#> GSM1060773 2 0.0892 0.973 0.020 0.98 0.000
#> GSM1060774 2 0.0000 0.999 0.000 1.00 0.000
#> GSM1060775 2 0.0000 0.999 0.000 1.00 0.000
#> GSM1060776 2 0.0000 0.999 0.000 1.00 0.000
#> GSM1060777 2 0.0000 0.999 0.000 1.00 0.000
#> GSM1060778 2 0.0000 0.999 0.000 1.00 0.000
#> GSM1060779 2 0.0000 0.999 0.000 1.00 0.000
#> GSM1060780 2 0.0000 0.999 0.000 1.00 0.000
#> GSM1060781 2 0.0000 0.999 0.000 1.00 0.000
#> GSM1060782 2 0.0000 0.999 0.000 1.00 0.000
#> GSM1060783 2 0.0000 0.999 0.000 1.00 0.000
#> GSM1060784 2 0.0000 0.999 0.000 1.00 0.000
#> GSM1060785 2 0.0000 0.999 0.000 1.00 0.000
#> GSM1060786 2 0.0000 0.999 0.000 1.00 0.000
#> GSM1060787 2 0.0000 0.999 0.000 1.00 0.000
#> GSM1060788 2 0.0000 0.999 0.000 1.00 0.000
#> GSM1060789 2 0.0000 0.999 0.000 1.00 0.000
#> GSM1060790 2 0.0000 0.999 0.000 1.00 0.000
#> GSM1060754 1 0.0000 0.992 1.000 0.00 0.000
#> GSM1060745 1 0.3116 0.878 0.892 0.00 0.108
#> GSM1060756 1 0.0000 0.992 1.000 0.00 0.000
#> GSM1060746 1 0.0000 0.992 1.000 0.00 0.000
#> GSM1060758 1 0.0000 0.992 1.000 0.00 0.000
#> GSM1060765 1 0.0000 0.992 1.000 0.00 0.000
#> GSM1060732 3 0.0000 0.993 0.000 0.00 1.000
#> GSM1060727 3 0.0000 0.993 0.000 0.00 1.000
#> GSM1060740 1 0.0000 0.992 1.000 0.00 0.000
#> GSM1060730 3 0.0000 0.993 0.000 0.00 1.000
#> GSM1060737 1 0.0000 0.992 1.000 0.00 0.000
#> GSM1060743 1 0.0000 0.992 1.000 0.00 0.000
#> GSM1060734 1 0.0000 0.992 1.000 0.00 0.000
#> GSM1060729 3 0.0000 0.993 0.000 0.00 1.000
#> GSM1060744 1 0.0000 0.992 1.000 0.00 0.000
#> GSM1060742 1 0.0000 0.992 1.000 0.00 0.000
#> GSM1060752 1 0.0000 0.992 1.000 0.00 0.000
#> GSM1060755 1 0.0000 0.992 1.000 0.00 0.000
#> GSM1060761 1 0.3686 0.818 0.860 0.14 0.000
#> GSM1060760 1 0.0000 0.992 1.000 0.00 0.000
#> GSM1060767 1 0.0000 0.992 1.000 0.00 0.000
#> GSM1060741 1 0.0000 0.992 1.000 0.00 0.000
#> GSM1060759 1 0.0000 0.992 1.000 0.00 0.000
#> GSM1060728 3 0.0000 0.993 0.000 0.00 1.000
#> GSM1060763 1 0.0000 0.992 1.000 0.00 0.000
#> GSM1060747 1 0.0000 0.992 1.000 0.00 0.000
#> GSM1060764 1 0.0000 0.992 1.000 0.00 0.000
#> GSM1060733 1 0.0000 0.992 1.000 0.00 0.000
#> GSM1060735 1 0.0000 0.992 1.000 0.00 0.000
#> GSM1060739 1 0.0000 0.992 1.000 0.00 0.000
#> GSM1060753 1 0.0000 0.992 1.000 0.00 0.000
#> GSM1060738 1 0.0000 0.992 1.000 0.00 0.000
#> GSM1060762 3 0.1643 0.949 0.044 0.00 0.956
#> GSM1060731 3 0.0000 0.993 0.000 0.00 1.000
#> GSM1060750 1 0.0000 0.992 1.000 0.00 0.000
#> GSM1060749 1 0.0000 0.992 1.000 0.00 0.000
#> GSM1060736 1 0.0000 0.992 1.000 0.00 0.000
#> GSM1060748 1 0.0000 0.992 1.000 0.00 0.000
#> GSM1060751 1 0.0000 0.992 1.000 0.00 0.000
#> GSM1060766 1 0.0000 0.992 1.000 0.00 0.000
#> GSM1060757 1 0.0000 0.992 1.000 0.00 0.000
#> GSM1060726 3 0.0000 0.993 0.000 0.00 1.000
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> GSM1060768 2 0.0000 0.9711 0.000 1.000 0.000 0.000
#> GSM1060769 2 0.0000 0.9711 0.000 1.000 0.000 0.000
#> GSM1060770 2 0.0000 0.9711 0.000 1.000 0.000 0.000
#> GSM1060771 2 0.0000 0.9711 0.000 1.000 0.000 0.000
#> GSM1060772 2 0.0000 0.9711 0.000 1.000 0.000 0.000
#> GSM1060773 2 0.4830 0.3820 0.000 0.608 0.000 0.392
#> GSM1060774 2 0.0000 0.9711 0.000 1.000 0.000 0.000
#> GSM1060775 2 0.0000 0.9711 0.000 1.000 0.000 0.000
#> GSM1060776 2 0.0000 0.9711 0.000 1.000 0.000 0.000
#> GSM1060777 2 0.0000 0.9711 0.000 1.000 0.000 0.000
#> GSM1060778 2 0.0000 0.9711 0.000 1.000 0.000 0.000
#> GSM1060779 2 0.0000 0.9711 0.000 1.000 0.000 0.000
#> GSM1060780 2 0.0000 0.9711 0.000 1.000 0.000 0.000
#> GSM1060781 2 0.3801 0.7179 0.000 0.780 0.000 0.220
#> GSM1060782 2 0.0000 0.9711 0.000 1.000 0.000 0.000
#> GSM1060783 2 0.0000 0.9711 0.000 1.000 0.000 0.000
#> GSM1060784 2 0.0000 0.9711 0.000 1.000 0.000 0.000
#> GSM1060785 2 0.0000 0.9711 0.000 1.000 0.000 0.000
#> GSM1060786 2 0.0000 0.9711 0.000 1.000 0.000 0.000
#> GSM1060787 2 0.0000 0.9711 0.000 1.000 0.000 0.000
#> GSM1060788 2 0.0000 0.9711 0.000 1.000 0.000 0.000
#> GSM1060789 2 0.0000 0.9711 0.000 1.000 0.000 0.000
#> GSM1060790 2 0.0000 0.9711 0.000 1.000 0.000 0.000
#> GSM1060754 1 0.0188 0.9594 0.996 0.000 0.000 0.004
#> GSM1060745 1 0.1118 0.9346 0.964 0.000 0.036 0.000
#> GSM1060756 1 0.0188 0.9594 0.996 0.000 0.000 0.004
#> GSM1060746 1 0.0000 0.9607 1.000 0.000 0.000 0.000
#> GSM1060758 4 0.0000 0.9869 0.000 0.000 0.000 1.000
#> GSM1060765 1 0.0000 0.9607 1.000 0.000 0.000 0.000
#> GSM1060732 3 0.0000 1.0000 0.000 0.000 1.000 0.000
#> GSM1060727 3 0.0000 1.0000 0.000 0.000 1.000 0.000
#> GSM1060740 1 0.0000 0.9607 1.000 0.000 0.000 0.000
#> GSM1060730 3 0.0000 1.0000 0.000 0.000 1.000 0.000
#> GSM1060737 1 0.0000 0.9607 1.000 0.000 0.000 0.000
#> GSM1060743 1 0.0000 0.9607 1.000 0.000 0.000 0.000
#> GSM1060734 1 0.0188 0.9594 0.996 0.000 0.000 0.004
#> GSM1060729 3 0.0000 1.0000 0.000 0.000 1.000 0.000
#> GSM1060744 1 0.0000 0.9607 1.000 0.000 0.000 0.000
#> GSM1060742 1 0.1389 0.9246 0.952 0.000 0.000 0.048
#> GSM1060752 1 0.0000 0.9607 1.000 0.000 0.000 0.000
#> GSM1060755 4 0.0000 0.9869 0.000 0.000 0.000 1.000
#> GSM1060761 4 0.0000 0.9869 0.000 0.000 0.000 1.000
#> GSM1060760 4 0.0000 0.9869 0.000 0.000 0.000 1.000
#> GSM1060767 1 0.0000 0.9607 1.000 0.000 0.000 0.000
#> GSM1060741 1 0.0188 0.9589 0.996 0.000 0.000 0.004
#> GSM1060759 4 0.0000 0.9869 0.000 0.000 0.000 1.000
#> GSM1060728 3 0.0000 1.0000 0.000 0.000 1.000 0.000
#> GSM1060763 1 0.0000 0.9607 1.000 0.000 0.000 0.000
#> GSM1060747 1 0.0000 0.9607 1.000 0.000 0.000 0.000
#> GSM1060764 1 0.0000 0.9607 1.000 0.000 0.000 0.000
#> GSM1060733 1 0.0188 0.9594 0.996 0.000 0.000 0.004
#> GSM1060735 1 0.0000 0.9607 1.000 0.000 0.000 0.000
#> GSM1060739 1 0.1022 0.9376 0.968 0.000 0.000 0.032
#> GSM1060753 4 0.0000 0.9869 0.000 0.000 0.000 1.000
#> GSM1060738 1 0.0000 0.9607 1.000 0.000 0.000 0.000
#> GSM1060762 1 0.5344 0.5251 0.668 0.032 0.300 0.000
#> GSM1060731 3 0.0000 1.0000 0.000 0.000 1.000 0.000
#> GSM1060750 4 0.0000 0.9869 0.000 0.000 0.000 1.000
#> GSM1060749 4 0.1867 0.8928 0.072 0.000 0.000 0.928
#> GSM1060736 1 0.0188 0.9594 0.996 0.000 0.000 0.004
#> GSM1060748 4 0.0000 0.9869 0.000 0.000 0.000 1.000
#> GSM1060751 1 0.0000 0.9607 1.000 0.000 0.000 0.000
#> GSM1060766 1 0.0000 0.9607 1.000 0.000 0.000 0.000
#> GSM1060757 1 0.4998 0.0489 0.512 0.000 0.000 0.488
#> GSM1060726 3 0.0000 1.0000 0.000 0.000 1.000 0.000
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> GSM1060768 5 0.0000 0.912 0.000 0.000 0.000 0.000 1.000
#> GSM1060769 5 0.0000 0.912 0.000 0.000 0.000 0.000 1.000
#> GSM1060770 5 0.0000 0.912 0.000 0.000 0.000 0.000 1.000
#> GSM1060771 5 0.3650 0.838 0.000 0.176 0.000 0.028 0.796
#> GSM1060772 5 0.0000 0.912 0.000 0.000 0.000 0.000 1.000
#> GSM1060773 2 0.3805 0.484 0.000 0.784 0.000 0.184 0.032
#> GSM1060774 5 0.0000 0.912 0.000 0.000 0.000 0.000 1.000
#> GSM1060775 5 0.0000 0.912 0.000 0.000 0.000 0.000 1.000
#> GSM1060776 5 0.0000 0.912 0.000 0.000 0.000 0.000 1.000
#> GSM1060777 5 0.4707 0.769 0.000 0.228 0.000 0.064 0.708
#> GSM1060778 5 0.0000 0.912 0.000 0.000 0.000 0.000 1.000
#> GSM1060779 5 0.0000 0.912 0.000 0.000 0.000 0.000 1.000
#> GSM1060780 5 0.1410 0.897 0.000 0.060 0.000 0.000 0.940
#> GSM1060781 5 0.6631 0.289 0.000 0.236 0.000 0.324 0.440
#> GSM1060782 5 0.0000 0.912 0.000 0.000 0.000 0.000 1.000
#> GSM1060783 5 0.3662 0.796 0.000 0.252 0.000 0.004 0.744
#> GSM1060784 5 0.2561 0.866 0.000 0.144 0.000 0.000 0.856
#> GSM1060785 5 0.3508 0.801 0.000 0.252 0.000 0.000 0.748
#> GSM1060786 5 0.0000 0.912 0.000 0.000 0.000 0.000 1.000
#> GSM1060787 5 0.1732 0.891 0.000 0.080 0.000 0.000 0.920
#> GSM1060788 2 0.3837 0.308 0.000 0.692 0.000 0.000 0.308
#> GSM1060789 5 0.2930 0.857 0.000 0.164 0.000 0.004 0.832
#> GSM1060790 5 0.0000 0.912 0.000 0.000 0.000 0.000 1.000
#> GSM1060754 1 0.0000 0.887 1.000 0.000 0.000 0.000 0.000
#> GSM1060745 1 0.3239 0.794 0.852 0.068 0.080 0.000 0.000
#> GSM1060756 1 0.0000 0.887 1.000 0.000 0.000 0.000 0.000
#> GSM1060746 1 0.2127 0.801 0.892 0.108 0.000 0.000 0.000
#> GSM1060758 4 0.0000 0.965 0.000 0.000 0.000 1.000 0.000
#> GSM1060765 2 0.2891 0.819 0.176 0.824 0.000 0.000 0.000
#> GSM1060732 3 0.0000 1.000 0.000 0.000 1.000 0.000 0.000
#> GSM1060727 3 0.0000 1.000 0.000 0.000 1.000 0.000 0.000
#> GSM1060740 2 0.2929 0.820 0.180 0.820 0.000 0.000 0.000
#> GSM1060730 3 0.0000 1.000 0.000 0.000 1.000 0.000 0.000
#> GSM1060737 1 0.0404 0.882 0.988 0.012 0.000 0.000 0.000
#> GSM1060743 2 0.3857 0.714 0.312 0.688 0.000 0.000 0.000
#> GSM1060734 1 0.0000 0.887 1.000 0.000 0.000 0.000 0.000
#> GSM1060729 3 0.0000 1.000 0.000 0.000 1.000 0.000 0.000
#> GSM1060744 2 0.3210 0.806 0.212 0.788 0.000 0.000 0.000
#> GSM1060742 2 0.3635 0.780 0.248 0.748 0.000 0.004 0.000
#> GSM1060752 2 0.3707 0.749 0.284 0.716 0.000 0.000 0.000
#> GSM1060755 4 0.0000 0.965 0.000 0.000 0.000 1.000 0.000
#> GSM1060761 4 0.0510 0.961 0.000 0.016 0.000 0.984 0.000
#> GSM1060760 4 0.0000 0.965 0.000 0.000 0.000 1.000 0.000
#> GSM1060767 1 0.1410 0.850 0.940 0.060 0.000 0.000 0.000
#> GSM1060741 2 0.2929 0.820 0.180 0.820 0.000 0.000 0.000
#> GSM1060759 4 0.0000 0.965 0.000 0.000 0.000 1.000 0.000
#> GSM1060728 3 0.0000 1.000 0.000 0.000 1.000 0.000 0.000
#> GSM1060763 1 0.0000 0.887 1.000 0.000 0.000 0.000 0.000
#> GSM1060747 2 0.2561 0.815 0.144 0.856 0.000 0.000 0.000
#> GSM1060764 1 0.4278 -0.176 0.548 0.452 0.000 0.000 0.000
#> GSM1060733 1 0.0000 0.887 1.000 0.000 0.000 0.000 0.000
#> GSM1060735 2 0.4150 0.449 0.388 0.612 0.000 0.000 0.000
#> GSM1060739 2 0.2798 0.817 0.140 0.852 0.000 0.008 0.000
#> GSM1060753 4 0.0162 0.963 0.000 0.004 0.000 0.996 0.000
#> GSM1060738 2 0.2424 0.813 0.132 0.868 0.000 0.000 0.000
#> GSM1060762 1 0.2929 0.792 0.876 0.004 0.076 0.000 0.044
#> GSM1060731 3 0.0000 1.000 0.000 0.000 1.000 0.000 0.000
#> GSM1060750 4 0.0510 0.960 0.000 0.016 0.000 0.984 0.000
#> GSM1060749 4 0.2516 0.818 0.000 0.140 0.000 0.860 0.000
#> GSM1060736 1 0.0963 0.866 0.964 0.036 0.000 0.000 0.000
#> GSM1060748 4 0.1768 0.918 0.004 0.072 0.000 0.924 0.000
#> GSM1060751 2 0.2471 0.815 0.136 0.864 0.000 0.000 0.000
#> GSM1060766 2 0.4060 0.628 0.360 0.640 0.000 0.000 0.000
#> GSM1060757 1 0.1851 0.816 0.912 0.000 0.000 0.088 0.000
#> GSM1060726 3 0.0000 1.000 0.000 0.000 1.000 0.000 0.000
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> GSM1060768 5 0.0000 0.968 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM1060769 5 0.0000 0.968 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM1060770 5 0.0000 0.968 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM1060771 2 0.3963 0.785 0.000 0.780 0.000 0.132 0.076 0.012
#> GSM1060772 5 0.0000 0.968 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM1060773 2 0.0547 0.797 0.000 0.980 0.000 0.000 0.000 0.020
#> GSM1060774 5 0.0000 0.968 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM1060775 5 0.0000 0.968 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM1060776 5 0.0146 0.964 0.000 0.004 0.000 0.000 0.996 0.000
#> GSM1060777 2 0.1767 0.836 0.000 0.932 0.000 0.020 0.036 0.012
#> GSM1060778 5 0.0000 0.968 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM1060779 5 0.0000 0.968 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM1060780 5 0.3446 0.423 0.000 0.308 0.000 0.000 0.692 0.000
#> GSM1060781 2 0.3181 0.771 0.000 0.824 0.000 0.144 0.020 0.012
#> GSM1060782 5 0.0000 0.968 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM1060783 2 0.1829 0.841 0.000 0.920 0.000 0.004 0.064 0.012
#> GSM1060784 2 0.3784 0.640 0.000 0.680 0.000 0.000 0.308 0.012
#> GSM1060785 2 0.1367 0.838 0.000 0.944 0.000 0.000 0.044 0.012
#> GSM1060786 5 0.0000 0.968 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM1060787 2 0.3843 0.328 0.000 0.548 0.000 0.000 0.452 0.000
#> GSM1060788 2 0.3611 0.790 0.000 0.796 0.000 0.000 0.108 0.096
#> GSM1060789 2 0.1141 0.836 0.000 0.948 0.000 0.000 0.052 0.000
#> GSM1060790 5 0.0000 0.968 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM1060754 1 0.0146 0.888 0.996 0.000 0.000 0.000 0.000 0.004
#> GSM1060745 1 0.4134 0.653 0.708 0.000 0.052 0.000 0.000 0.240
#> GSM1060756 1 0.0260 0.888 0.992 0.000 0.000 0.000 0.000 0.008
#> GSM1060746 1 0.3023 0.697 0.768 0.000 0.000 0.000 0.000 0.232
#> GSM1060758 4 0.0000 0.928 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM1060765 6 0.0405 0.926 0.004 0.008 0.000 0.000 0.000 0.988
#> GSM1060732 3 0.0000 1.000 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1060727 3 0.0000 1.000 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1060740 6 0.0000 0.927 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM1060730 3 0.0000 1.000 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1060737 1 0.0937 0.880 0.960 0.040 0.000 0.000 0.000 0.000
#> GSM1060743 6 0.0790 0.915 0.032 0.000 0.000 0.000 0.000 0.968
#> GSM1060734 1 0.0000 0.888 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1060729 3 0.0000 1.000 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1060744 6 0.0146 0.926 0.004 0.000 0.000 0.000 0.000 0.996
#> GSM1060742 6 0.0405 0.926 0.008 0.000 0.000 0.004 0.000 0.988
#> GSM1060752 6 0.0458 0.923 0.016 0.000 0.000 0.000 0.000 0.984
#> GSM1060755 4 0.0146 0.925 0.004 0.000 0.000 0.996 0.000 0.000
#> GSM1060761 4 0.0000 0.928 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM1060760 4 0.0000 0.928 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM1060767 1 0.1327 0.864 0.936 0.000 0.000 0.000 0.000 0.064
#> GSM1060741 6 0.0000 0.927 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM1060759 4 0.0000 0.928 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM1060728 3 0.0000 1.000 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1060763 1 0.0146 0.888 0.996 0.004 0.000 0.000 0.000 0.000
#> GSM1060747 6 0.1007 0.905 0.000 0.044 0.000 0.000 0.000 0.956
#> GSM1060764 6 0.1663 0.871 0.088 0.000 0.000 0.000 0.000 0.912
#> GSM1060733 1 0.0146 0.888 0.996 0.004 0.000 0.000 0.000 0.000
#> GSM1060735 1 0.5075 0.216 0.468 0.456 0.000 0.000 0.000 0.076
#> GSM1060739 6 0.0000 0.927 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM1060753 4 0.0000 0.928 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM1060738 6 0.0146 0.926 0.000 0.004 0.000 0.000 0.000 0.996
#> GSM1060762 1 0.1471 0.855 0.932 0.000 0.004 0.000 0.064 0.000
#> GSM1060731 3 0.0000 1.000 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1060750 4 0.0363 0.919 0.000 0.012 0.000 0.988 0.000 0.000
#> GSM1060749 6 0.3833 0.243 0.000 0.000 0.000 0.444 0.000 0.556
#> GSM1060736 1 0.1141 0.875 0.948 0.052 0.000 0.000 0.000 0.000
#> GSM1060748 4 0.3860 0.159 0.000 0.472 0.000 0.528 0.000 0.000
#> GSM1060751 6 0.0865 0.912 0.000 0.036 0.000 0.000 0.000 0.964
#> GSM1060766 6 0.4206 0.686 0.092 0.176 0.000 0.000 0.000 0.732
#> GSM1060757 1 0.1007 0.872 0.956 0.000 0.000 0.044 0.000 0.000
#> GSM1060726 3 0.0000 1.000 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)
Test correlation between subgroups and known annotations. If the known annotation is numeric, one-way ANOVA test is applied, and if the known annotation is discrete, chi-squared contingency table test is applied.
test_to_known_factors(res)
#> n disease.state(p) tissue(p) k
#> SD:NMF 64 8.98e-07 1.12e-01 2
#> SD:NMF 65 7.68e-15 9.62e-04 3
#> SD:NMF 63 1.34e-13 1.22e-04 4
#> SD:NMF 60 2.90e-12 4.33e-05 5
#> SD:NMF 60 1.22e-11 1.55e-02 6
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 51941 rows and 65 columns.
#> Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'CV' method.
#> Subgroups are detected by 'hclust' method.
#> Performed in total 1250 partitions by row resampling.
#> Best k for subgroups seems to be 2.
#>
#> Following methods can be applied to this 'ConsensusPartition' object:
#> [1] "cola_report" "collect_classes" "collect_plots"
#> [4] "collect_stats" "colnames" "compare_signatures"
#> [7] "consensus_heatmap" "dimension_reduction" "functional_enrichment"
#> [10] "get_anno_col" "get_anno" "get_classes"
#> [13] "get_consensus" "get_matrix" "get_membership"
#> [16] "get_param" "get_signatures" "get_stats"
#> [19] "is_best_k" "is_stable_k" "membership_heatmap"
#> [22] "ncol" "nrow" "plot_ecdf"
#> [25] "rownames" "select_partition_number" "show"
#> [28] "suggest_best_k" "test_to_known_factors"
collect_plots()
function collects all the plots made from res
for all k
(number of partitions)
into one single page to provide an easy and fast comparison between different k
.
collect_plots(res)
The plots are:
k
and the heatmap of
predicted classes for each k
.k
.k
.k
.All the plots in panels can be made by individual functions and they are plotted later in this section.
select_partition_number()
produces several plots showing different
statistics for choosing “optimized” k
. There are following statistics:
k
;k
, the area increased is defined as \(A_k - A_{k-1}\).The detailed explanations of these statistics can be found in the cola vignette.
Generally speaking, lower PAC score, higher mean silhouette score or higher
concordance corresponds to better partition. Rand index and Jaccard index
measure how similar the current partition is compared to partition with k-1
.
If they are too similar, we won't accept k
is better than k-1
.
select_partition_number(res)
The numeric values for all these statistics can be obtained by get_stats()
.
get_stats(res)
#> k 1-PAC mean_silhouette concordance area_increased Rand Jaccard
#> 2 2 1.000 0.996 0.998 0.198 0.805 0.805
#> 3 3 0.760 0.813 0.908 1.569 0.704 0.632
#> 4 4 0.551 0.684 0.817 0.296 0.837 0.679
#> 5 5 0.592 0.541 0.735 0.141 0.850 0.570
#> 6 6 0.632 0.743 0.787 0.069 0.900 0.581
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
#> GSM1060768 1 0.0938 0.990 0.988 0.012
#> GSM1060769 1 0.0938 0.990 0.988 0.012
#> GSM1060770 1 0.0938 0.990 0.988 0.012
#> GSM1060771 1 0.0000 0.997 1.000 0.000
#> GSM1060772 1 0.0938 0.990 0.988 0.012
#> GSM1060773 1 0.0000 0.997 1.000 0.000
#> GSM1060774 1 0.0938 0.990 0.988 0.012
#> GSM1060775 1 0.0938 0.990 0.988 0.012
#> GSM1060776 1 0.0938 0.990 0.988 0.012
#> GSM1060777 1 0.0000 0.997 1.000 0.000
#> GSM1060778 1 0.0938 0.990 0.988 0.012
#> GSM1060779 1 0.0938 0.990 0.988 0.012
#> GSM1060780 1 0.0000 0.997 1.000 0.000
#> GSM1060781 1 0.0000 0.997 1.000 0.000
#> GSM1060782 1 0.0938 0.990 0.988 0.012
#> GSM1060783 1 0.0000 0.997 1.000 0.000
#> GSM1060784 1 0.0000 0.997 1.000 0.000
#> GSM1060785 1 0.0000 0.997 1.000 0.000
#> GSM1060786 1 0.0938 0.990 0.988 0.012
#> GSM1060787 1 0.0000 0.997 1.000 0.000
#> GSM1060788 1 0.0000 0.997 1.000 0.000
#> GSM1060789 1 0.0000 0.997 1.000 0.000
#> GSM1060790 1 0.0938 0.990 0.988 0.012
#> GSM1060754 1 0.0000 0.997 1.000 0.000
#> GSM1060745 1 0.0000 0.997 1.000 0.000
#> GSM1060756 1 0.0000 0.997 1.000 0.000
#> GSM1060746 1 0.0000 0.997 1.000 0.000
#> GSM1060758 1 0.0000 0.997 1.000 0.000
#> GSM1060765 1 0.0000 0.997 1.000 0.000
#> GSM1060732 2 0.0000 1.000 0.000 1.000
#> GSM1060727 2 0.0000 1.000 0.000 1.000
#> GSM1060740 1 0.0000 0.997 1.000 0.000
#> GSM1060730 2 0.0000 1.000 0.000 1.000
#> GSM1060737 1 0.0000 0.997 1.000 0.000
#> GSM1060743 1 0.0000 0.997 1.000 0.000
#> GSM1060734 1 0.0000 0.997 1.000 0.000
#> GSM1060729 2 0.0000 1.000 0.000 1.000
#> GSM1060744 1 0.0000 0.997 1.000 0.000
#> GSM1060742 1 0.0000 0.997 1.000 0.000
#> GSM1060752 1 0.0000 0.997 1.000 0.000
#> GSM1060755 1 0.0000 0.997 1.000 0.000
#> GSM1060761 1 0.0000 0.997 1.000 0.000
#> GSM1060760 1 0.0000 0.997 1.000 0.000
#> GSM1060767 1 0.0000 0.997 1.000 0.000
#> GSM1060741 1 0.0000 0.997 1.000 0.000
#> GSM1060759 1 0.0000 0.997 1.000 0.000
#> GSM1060728 2 0.0000 1.000 0.000 1.000
#> GSM1060763 1 0.0000 0.997 1.000 0.000
#> GSM1060747 1 0.0000 0.997 1.000 0.000
#> GSM1060764 1 0.0000 0.997 1.000 0.000
#> GSM1060733 1 0.0000 0.997 1.000 0.000
#> GSM1060735 1 0.0000 0.997 1.000 0.000
#> GSM1060739 1 0.0000 0.997 1.000 0.000
#> GSM1060753 1 0.0000 0.997 1.000 0.000
#> GSM1060738 1 0.0000 0.997 1.000 0.000
#> GSM1060762 1 0.0000 0.997 1.000 0.000
#> GSM1060731 2 0.0000 1.000 0.000 1.000
#> GSM1060750 1 0.0000 0.997 1.000 0.000
#> GSM1060749 1 0.0000 0.997 1.000 0.000
#> GSM1060736 1 0.0000 0.997 1.000 0.000
#> GSM1060748 1 0.0000 0.997 1.000 0.000
#> GSM1060751 1 0.0000 0.997 1.000 0.000
#> GSM1060766 1 0.0000 0.997 1.000 0.000
#> GSM1060757 1 0.0000 0.997 1.000 0.000
#> GSM1060726 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
#> GSM1060768 2 0.2356 0.921 0.072 0.928 0
#> GSM1060769 2 0.2356 0.921 0.072 0.928 0
#> GSM1060770 2 0.2356 0.921 0.072 0.928 0
#> GSM1060771 1 0.5968 0.438 0.636 0.364 0
#> GSM1060772 2 0.2356 0.921 0.072 0.928 0
#> GSM1060773 1 0.5178 0.619 0.744 0.256 0
#> GSM1060774 2 0.2356 0.921 0.072 0.928 0
#> GSM1060775 2 0.2356 0.921 0.072 0.928 0
#> GSM1060776 2 0.2356 0.921 0.072 0.928 0
#> GSM1060777 1 0.5968 0.438 0.636 0.364 0
#> GSM1060778 2 0.2356 0.921 0.072 0.928 0
#> GSM1060779 2 0.2356 0.921 0.072 0.928 0
#> GSM1060780 2 0.6095 0.384 0.392 0.608 0
#> GSM1060781 1 0.5968 0.438 0.636 0.364 0
#> GSM1060782 2 0.2356 0.921 0.072 0.928 0
#> GSM1060783 1 0.5968 0.438 0.636 0.364 0
#> GSM1060784 1 0.5968 0.438 0.636 0.364 0
#> GSM1060785 1 0.5968 0.438 0.636 0.364 0
#> GSM1060786 2 0.2356 0.921 0.072 0.928 0
#> GSM1060787 1 0.5968 0.438 0.636 0.364 0
#> GSM1060788 1 0.5968 0.438 0.636 0.364 0
#> GSM1060789 1 0.5968 0.438 0.636 0.364 0
#> GSM1060790 2 0.2356 0.921 0.072 0.928 0
#> GSM1060754 1 0.2356 0.838 0.928 0.072 0
#> GSM1060745 1 0.1031 0.867 0.976 0.024 0
#> GSM1060756 1 0.1643 0.856 0.956 0.044 0
#> GSM1060746 1 0.0237 0.877 0.996 0.004 0
#> GSM1060758 1 0.0237 0.876 0.996 0.004 0
#> GSM1060765 1 0.0237 0.877 0.996 0.004 0
#> GSM1060732 3 0.0000 1.000 0.000 0.000 1
#> GSM1060727 3 0.0000 1.000 0.000 0.000 1
#> GSM1060740 1 0.0237 0.877 0.996 0.004 0
#> GSM1060730 3 0.0000 1.000 0.000 0.000 1
#> GSM1060737 1 0.2356 0.842 0.928 0.072 0
#> GSM1060743 1 0.0237 0.877 0.996 0.004 0
#> GSM1060734 1 0.2356 0.838 0.928 0.072 0
#> GSM1060729 3 0.0000 1.000 0.000 0.000 1
#> GSM1060744 1 0.0237 0.877 0.996 0.004 0
#> GSM1060742 1 0.0237 0.876 0.996 0.004 0
#> GSM1060752 1 0.0237 0.877 0.996 0.004 0
#> GSM1060755 1 0.2356 0.838 0.928 0.072 0
#> GSM1060761 1 0.0237 0.876 0.996 0.004 0
#> GSM1060760 1 0.0237 0.876 0.996 0.004 0
#> GSM1060767 1 0.1031 0.867 0.976 0.024 0
#> GSM1060741 1 0.0237 0.877 0.996 0.004 0
#> GSM1060759 1 0.0237 0.876 0.996 0.004 0
#> GSM1060728 3 0.0000 1.000 0.000 0.000 1
#> GSM1060763 1 0.2356 0.842 0.928 0.072 0
#> GSM1060747 1 0.0237 0.877 0.996 0.004 0
#> GSM1060764 1 0.0237 0.877 0.996 0.004 0
#> GSM1060733 1 0.2356 0.838 0.928 0.072 0
#> GSM1060735 1 0.0237 0.877 0.996 0.004 0
#> GSM1060739 1 0.0237 0.877 0.996 0.004 0
#> GSM1060753 1 0.0237 0.876 0.996 0.004 0
#> GSM1060738 1 0.0237 0.877 0.996 0.004 0
#> GSM1060762 2 0.6079 0.401 0.388 0.612 0
#> GSM1060731 3 0.0000 1.000 0.000 0.000 1
#> GSM1060750 1 0.0000 0.877 1.000 0.000 0
#> GSM1060749 1 0.0000 0.877 1.000 0.000 0
#> GSM1060736 1 0.2356 0.842 0.928 0.072 0
#> GSM1060748 1 0.0000 0.877 1.000 0.000 0
#> GSM1060751 1 0.0237 0.877 0.996 0.004 0
#> GSM1060766 1 0.0237 0.877 0.996 0.004 0
#> GSM1060757 1 0.2356 0.838 0.928 0.072 0
#> GSM1060726 3 0.0000 1.000 0.000 0.000 1
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> GSM1060768 2 0.0000 0.916 0.000 1.000 0 0.000
#> GSM1060769 2 0.0000 0.916 0.000 1.000 0 0.000
#> GSM1060770 2 0.0000 0.916 0.000 1.000 0 0.000
#> GSM1060771 1 0.4730 0.512 0.636 0.364 0 0.000
#> GSM1060772 2 0.0000 0.916 0.000 1.000 0 0.000
#> GSM1060773 1 0.6400 0.547 0.632 0.252 0 0.116
#> GSM1060774 2 0.0000 0.916 0.000 1.000 0 0.000
#> GSM1060775 2 0.0000 0.916 0.000 1.000 0 0.000
#> GSM1060776 2 0.0000 0.916 0.000 1.000 0 0.000
#> GSM1060777 1 0.4730 0.512 0.636 0.364 0 0.000
#> GSM1060778 2 0.0000 0.916 0.000 1.000 0 0.000
#> GSM1060779 2 0.0000 0.916 0.000 1.000 0 0.000
#> GSM1060780 2 0.4817 0.192 0.388 0.612 0 0.000
#> GSM1060781 1 0.4730 0.512 0.636 0.364 0 0.000
#> GSM1060782 2 0.0000 0.916 0.000 1.000 0 0.000
#> GSM1060783 1 0.4730 0.512 0.636 0.364 0 0.000
#> GSM1060784 1 0.4730 0.512 0.636 0.364 0 0.000
#> GSM1060785 1 0.4730 0.512 0.636 0.364 0 0.000
#> GSM1060786 2 0.0000 0.916 0.000 1.000 0 0.000
#> GSM1060787 1 0.4730 0.512 0.636 0.364 0 0.000
#> GSM1060788 1 0.4730 0.512 0.636 0.364 0 0.000
#> GSM1060789 1 0.4730 0.512 0.636 0.364 0 0.000
#> GSM1060790 2 0.0000 0.916 0.000 1.000 0 0.000
#> GSM1060754 4 0.4843 0.702 0.396 0.000 0 0.604
#> GSM1060745 1 0.3335 0.627 0.860 0.020 0 0.120
#> GSM1060756 4 0.4941 0.635 0.436 0.000 0 0.564
#> GSM1060746 1 0.2921 0.604 0.860 0.000 0 0.140
#> GSM1060758 1 0.2081 0.679 0.916 0.000 0 0.084
#> GSM1060765 1 0.4164 0.455 0.736 0.000 0 0.264
#> GSM1060732 3 0.0000 1.000 0.000 0.000 1 0.000
#> GSM1060727 3 0.0000 1.000 0.000 0.000 1 0.000
#> GSM1060740 1 0.1474 0.678 0.948 0.000 0 0.052
#> GSM1060730 3 0.0000 1.000 0.000 0.000 1 0.000
#> GSM1060737 4 0.2081 0.678 0.084 0.000 0 0.916
#> GSM1060743 1 0.1637 0.675 0.940 0.000 0 0.060
#> GSM1060734 4 0.3528 0.771 0.192 0.000 0 0.808
#> GSM1060729 3 0.0000 1.000 0.000 0.000 1 0.000
#> GSM1060744 1 0.0707 0.687 0.980 0.000 0 0.020
#> GSM1060742 1 0.1867 0.683 0.928 0.000 0 0.072
#> GSM1060752 1 0.1557 0.677 0.944 0.000 0 0.056
#> GSM1060755 4 0.4697 0.714 0.356 0.000 0 0.644
#> GSM1060761 1 0.2081 0.679 0.916 0.000 0 0.084
#> GSM1060760 1 0.2081 0.679 0.916 0.000 0 0.084
#> GSM1060767 1 0.3335 0.627 0.860 0.020 0 0.120
#> GSM1060741 1 0.0921 0.685 0.972 0.000 0 0.028
#> GSM1060759 1 0.2081 0.679 0.916 0.000 0 0.084
#> GSM1060728 3 0.0000 1.000 0.000 0.000 1 0.000
#> GSM1060763 4 0.3610 0.772 0.200 0.000 0 0.800
#> GSM1060747 4 0.4961 0.336 0.448 0.000 0 0.552
#> GSM1060764 1 0.2868 0.609 0.864 0.000 0 0.136
#> GSM1060733 4 0.3528 0.771 0.192 0.000 0 0.808
#> GSM1060735 1 0.4992 -0.145 0.524 0.000 0 0.476
#> GSM1060739 1 0.1474 0.678 0.948 0.000 0 0.052
#> GSM1060753 1 0.2081 0.679 0.916 0.000 0 0.084
#> GSM1060738 1 0.1474 0.678 0.948 0.000 0 0.052
#> GSM1060762 2 0.5467 0.213 0.364 0.612 0 0.024
#> GSM1060731 3 0.0000 1.000 0.000 0.000 1 0.000
#> GSM1060750 1 0.3688 0.595 0.792 0.000 0 0.208
#> GSM1060749 1 0.1637 0.685 0.940 0.000 0 0.060
#> GSM1060736 4 0.2081 0.678 0.084 0.000 0 0.916
#> GSM1060748 1 0.3688 0.595 0.792 0.000 0 0.208
#> GSM1060751 1 0.4843 0.124 0.604 0.000 0 0.396
#> GSM1060766 1 0.3801 0.526 0.780 0.000 0 0.220
#> GSM1060757 4 0.4697 0.714 0.356 0.000 0 0.644
#> GSM1060726 3 0.0000 1.000 0.000 0.000 1 0.000
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> GSM1060768 5 0.0000 0.9222 0.000 0.000 0 0.000 1.000
#> GSM1060769 5 0.0000 0.9222 0.000 0.000 0 0.000 1.000
#> GSM1060770 5 0.0000 0.9222 0.000 0.000 0 0.000 1.000
#> GSM1060771 2 0.3039 0.6175 0.000 0.808 0 0.000 0.192
#> GSM1060772 5 0.0000 0.9222 0.000 0.000 0 0.000 1.000
#> GSM1060773 2 0.4725 0.2339 0.000 0.720 0 0.200 0.080
#> GSM1060774 5 0.0000 0.9222 0.000 0.000 0 0.000 1.000
#> GSM1060775 5 0.0000 0.9222 0.000 0.000 0 0.000 1.000
#> GSM1060776 5 0.0000 0.9222 0.000 0.000 0 0.000 1.000
#> GSM1060777 2 0.3039 0.6175 0.000 0.808 0 0.000 0.192
#> GSM1060778 5 0.0000 0.9222 0.000 0.000 0 0.000 1.000
#> GSM1060779 5 0.0000 0.9222 0.000 0.000 0 0.000 1.000
#> GSM1060780 5 0.4242 0.0899 0.000 0.428 0 0.000 0.572
#> GSM1060781 2 0.3039 0.6175 0.000 0.808 0 0.000 0.192
#> GSM1060782 5 0.0000 0.9222 0.000 0.000 0 0.000 1.000
#> GSM1060783 2 0.3039 0.6175 0.000 0.808 0 0.000 0.192
#> GSM1060784 2 0.3039 0.6175 0.000 0.808 0 0.000 0.192
#> GSM1060785 2 0.3039 0.6175 0.000 0.808 0 0.000 0.192
#> GSM1060786 5 0.0000 0.9222 0.000 0.000 0 0.000 1.000
#> GSM1060787 2 0.3039 0.6175 0.000 0.808 0 0.000 0.192
#> GSM1060788 2 0.3039 0.6175 0.000 0.808 0 0.000 0.192
#> GSM1060789 2 0.3039 0.6175 0.000 0.808 0 0.000 0.192
#> GSM1060790 5 0.0000 0.9222 0.000 0.000 0 0.000 1.000
#> GSM1060754 1 0.3635 0.6560 0.748 0.004 0 0.248 0.000
#> GSM1060745 4 0.6400 0.3115 0.148 0.392 0 0.456 0.004
#> GSM1060756 1 0.4865 0.5614 0.684 0.064 0 0.252 0.000
#> GSM1060746 4 0.6447 0.3191 0.180 0.380 0 0.440 0.000
#> GSM1060758 4 0.4262 0.3759 0.000 0.440 0 0.560 0.000
#> GSM1060765 4 0.6510 0.2232 0.224 0.296 0 0.480 0.000
#> GSM1060732 3 0.0000 1.0000 0.000 0.000 1 0.000 0.000
#> GSM1060727 3 0.0000 1.0000 0.000 0.000 1 0.000 0.000
#> GSM1060740 2 0.5736 -0.2409 0.084 0.468 0 0.448 0.000
#> GSM1060730 3 0.0000 1.0000 0.000 0.000 1 0.000 0.000
#> GSM1060737 1 0.2824 0.7174 0.864 0.020 0 0.116 0.000
#> GSM1060743 2 0.5816 -0.2435 0.092 0.468 0 0.440 0.000
#> GSM1060734 1 0.0963 0.7355 0.964 0.000 0 0.036 0.000
#> GSM1060729 3 0.0000 1.0000 0.000 0.000 1 0.000 0.000
#> GSM1060744 4 0.5274 0.3448 0.056 0.372 0 0.572 0.000
#> GSM1060742 4 0.4114 0.3509 0.000 0.376 0 0.624 0.000
#> GSM1060752 2 0.5775 -0.2402 0.088 0.472 0 0.440 0.000
#> GSM1060755 1 0.4104 0.6769 0.748 0.032 0 0.220 0.000
#> GSM1060761 4 0.4262 0.3759 0.000 0.440 0 0.560 0.000
#> GSM1060760 4 0.4262 0.3759 0.000 0.440 0 0.560 0.000
#> GSM1060767 4 0.6400 0.3115 0.148 0.392 0 0.456 0.004
#> GSM1060741 4 0.5375 0.3460 0.064 0.368 0 0.568 0.000
#> GSM1060759 4 0.4262 0.3759 0.000 0.440 0 0.560 0.000
#> GSM1060728 3 0.0000 1.0000 0.000 0.000 1 0.000 0.000
#> GSM1060763 1 0.0566 0.7367 0.984 0.004 0 0.012 0.000
#> GSM1060747 1 0.6364 0.4206 0.500 0.188 0 0.312 0.000
#> GSM1060764 4 0.6428 0.3157 0.176 0.384 0 0.440 0.000
#> GSM1060733 1 0.0963 0.7355 0.964 0.000 0 0.036 0.000
#> GSM1060735 1 0.6635 0.2550 0.416 0.224 0 0.360 0.000
#> GSM1060739 2 0.5736 -0.2409 0.084 0.468 0 0.448 0.000
#> GSM1060753 4 0.4262 0.3759 0.000 0.440 0 0.560 0.000
#> GSM1060738 2 0.5736 -0.2409 0.084 0.468 0 0.448 0.000
#> GSM1060762 5 0.5846 0.2160 0.004 0.288 0 0.116 0.592
#> GSM1060731 3 0.0000 1.0000 0.000 0.000 1 0.000 0.000
#> GSM1060750 4 0.5024 0.2259 0.032 0.440 0 0.528 0.000
#> GSM1060749 4 0.5509 0.2598 0.064 0.464 0 0.472 0.000
#> GSM1060736 1 0.2824 0.7174 0.864 0.020 0 0.116 0.000
#> GSM1060748 4 0.5024 0.2259 0.032 0.440 0 0.528 0.000
#> GSM1060751 4 0.6673 -0.1102 0.316 0.252 0 0.432 0.000
#> GSM1060766 4 0.6246 0.2860 0.180 0.292 0 0.528 0.000
#> GSM1060757 1 0.4104 0.6769 0.748 0.032 0 0.220 0.000
#> GSM1060726 3 0.0000 1.0000 0.000 0.000 1 0.000 0.000
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> GSM1060768 5 0.000 0.9250 0.000 0.000 0 0.000 1.000 0.000
#> GSM1060769 5 0.000 0.9250 0.000 0.000 0 0.000 1.000 0.000
#> GSM1060770 5 0.000 0.9250 0.000 0.000 0 0.000 1.000 0.000
#> GSM1060771 2 0.200 0.9451 0.000 0.884 0 0.000 0.116 0.000
#> GSM1060772 5 0.000 0.9250 0.000 0.000 0 0.000 1.000 0.000
#> GSM1060773 2 0.359 0.4237 0.000 0.752 0 0.228 0.008 0.012
#> GSM1060774 5 0.000 0.9250 0.000 0.000 0 0.000 1.000 0.000
#> GSM1060775 5 0.000 0.9250 0.000 0.000 0 0.000 1.000 0.000
#> GSM1060776 5 0.000 0.9250 0.000 0.000 0 0.000 1.000 0.000
#> GSM1060777 2 0.200 0.9451 0.000 0.884 0 0.000 0.116 0.000
#> GSM1060778 5 0.000 0.9250 0.000 0.000 0 0.000 1.000 0.000
#> GSM1060779 5 0.000 0.9250 0.000 0.000 0 0.000 1.000 0.000
#> GSM1060780 5 0.382 0.0524 0.000 0.436 0 0.000 0.564 0.000
#> GSM1060781 2 0.200 0.9451 0.000 0.884 0 0.000 0.116 0.000
#> GSM1060782 5 0.000 0.9250 0.000 0.000 0 0.000 1.000 0.000
#> GSM1060783 2 0.200 0.9451 0.000 0.884 0 0.000 0.116 0.000
#> GSM1060784 2 0.200 0.9451 0.000 0.884 0 0.000 0.116 0.000
#> GSM1060785 2 0.200 0.9451 0.000 0.884 0 0.000 0.116 0.000
#> GSM1060786 5 0.000 0.9250 0.000 0.000 0 0.000 1.000 0.000
#> GSM1060787 2 0.200 0.9451 0.000 0.884 0 0.000 0.116 0.000
#> GSM1060788 2 0.200 0.9451 0.000 0.884 0 0.000 0.116 0.000
#> GSM1060789 2 0.200 0.9451 0.000 0.884 0 0.000 0.116 0.000
#> GSM1060790 5 0.000 0.9250 0.000 0.000 0 0.000 1.000 0.000
#> GSM1060754 1 0.443 0.6316 0.700 0.024 0 0.032 0.000 0.244
#> GSM1060745 6 0.527 0.6451 0.072 0.204 0 0.056 0.000 0.668
#> GSM1060756 1 0.523 0.5553 0.636 0.072 0 0.032 0.000 0.260
#> GSM1060746 6 0.494 0.6845 0.088 0.192 0 0.028 0.000 0.692
#> GSM1060758 4 0.410 0.7907 0.000 0.244 0 0.708 0.000 0.048
#> GSM1060765 6 0.647 0.4590 0.116 0.136 0 0.188 0.000 0.560
#> GSM1060732 3 0.000 1.0000 0.000 0.000 1 0.000 0.000 0.000
#> GSM1060727 3 0.000 1.0000 0.000 0.000 1 0.000 0.000 0.000
#> GSM1060740 6 0.266 0.7355 0.000 0.184 0 0.000 0.000 0.816
#> GSM1060730 3 0.000 1.0000 0.000 0.000 1 0.000 0.000 0.000
#> GSM1060737 1 0.508 0.6533 0.668 0.020 0 0.104 0.000 0.208
#> GSM1060743 6 0.292 0.7355 0.008 0.184 0 0.000 0.000 0.808
#> GSM1060734 1 0.205 0.6985 0.916 0.008 0 0.032 0.000 0.044
#> GSM1060729 3 0.000 1.0000 0.000 0.000 1 0.000 0.000 0.000
#> GSM1060744 6 0.456 0.6501 0.016 0.124 0 0.128 0.000 0.732
#> GSM1060742 6 0.518 0.5613 0.020 0.128 0 0.188 0.000 0.664
#> GSM1060752 6 0.299 0.7289 0.004 0.208 0 0.000 0.000 0.788
#> GSM1060755 1 0.476 0.6778 0.720 0.024 0 0.124 0.000 0.132
#> GSM1060761 4 0.410 0.7907 0.000 0.244 0 0.708 0.000 0.048
#> GSM1060760 4 0.410 0.7907 0.000 0.244 0 0.708 0.000 0.048
#> GSM1060767 6 0.527 0.6451 0.072 0.204 0 0.056 0.000 0.668
#> GSM1060741 6 0.433 0.6576 0.008 0.120 0 0.128 0.000 0.744
#> GSM1060759 4 0.410 0.7907 0.000 0.244 0 0.708 0.000 0.048
#> GSM1060728 3 0.000 1.0000 0.000 0.000 1 0.000 0.000 0.000
#> GSM1060763 1 0.250 0.7163 0.872 0.004 0 0.016 0.000 0.108
#> GSM1060747 1 0.734 0.1826 0.360 0.116 0 0.228 0.000 0.296
#> GSM1060764 6 0.490 0.6867 0.084 0.192 0 0.028 0.000 0.696
#> GSM1060733 1 0.205 0.6985 0.916 0.008 0 0.032 0.000 0.044
#> GSM1060735 6 0.738 -0.0602 0.268 0.128 0 0.232 0.000 0.372
#> GSM1060739 6 0.266 0.7355 0.000 0.184 0 0.000 0.000 0.816
#> GSM1060753 4 0.410 0.7907 0.000 0.244 0 0.708 0.000 0.048
#> GSM1060738 6 0.266 0.7355 0.000 0.184 0 0.000 0.000 0.816
#> GSM1060762 5 0.605 0.3315 0.004 0.244 0 0.052 0.584 0.116
#> GSM1060731 3 0.000 1.0000 0.000 0.000 1 0.000 0.000 0.000
#> GSM1060750 4 0.543 0.4125 0.028 0.312 0 0.584 0.000 0.076
#> GSM1060749 6 0.508 0.6133 0.004 0.212 0 0.140 0.000 0.644
#> GSM1060736 1 0.508 0.6533 0.668 0.020 0 0.104 0.000 0.208
#> GSM1060748 4 0.543 0.4125 0.028 0.312 0 0.584 0.000 0.076
#> GSM1060751 6 0.695 0.2253 0.176 0.116 0 0.228 0.000 0.480
#> GSM1060766 6 0.591 0.5377 0.080 0.116 0 0.184 0.000 0.620
#> GSM1060757 1 0.476 0.6778 0.720 0.024 0 0.124 0.000 0.132
#> GSM1060726 3 0.000 1.0000 0.000 0.000 1 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)
Test correlation between subgroups and known annotations. If the known annotation is numeric, one-way ANOVA test is applied, and if the known annotation is discrete, chi-squared contingency table test is applied.
test_to_known_factors(res)
#> n disease.state(p) tissue(p) k
#> CV:hclust 65 9.81e-02 0.01293 2
#> CV:hclust 54 2.68e-11 0.06303 3
#> CV:hclust 59 1.36e-06 0.03354 4
#> CV:hclust 37 4.60e-08 0.00937 5
#> CV:hclust 56 8.13e-11 0.00728 6
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 51941 rows and 65 columns.
#> Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'CV' method.
#> Subgroups are detected by 'kmeans' method.
#> Performed in total 1250 partitions by row resampling.
#> Best k for subgroups seems to be 3.
#>
#> Following methods can be applied to this 'ConsensusPartition' object:
#> [1] "cola_report" "collect_classes" "collect_plots"
#> [4] "collect_stats" "colnames" "compare_signatures"
#> [7] "consensus_heatmap" "dimension_reduction" "functional_enrichment"
#> [10] "get_anno_col" "get_anno" "get_classes"
#> [13] "get_consensus" "get_matrix" "get_membership"
#> [16] "get_param" "get_signatures" "get_stats"
#> [19] "is_best_k" "is_stable_k" "membership_heatmap"
#> [22] "ncol" "nrow" "plot_ecdf"
#> [25] "rownames" "select_partition_number" "show"
#> [28] "suggest_best_k" "test_to_known_factors"
collect_plots()
function collects all the plots made from res
for all k
(number of partitions)
into one single page to provide an easy and fast comparison between different k
.
collect_plots(res)
The plots are:
k
and the heatmap of
predicted classes for each k
.k
.k
.k
.All the plots in panels can be made by individual functions and they are plotted later in this section.
select_partition_number()
produces several plots showing different
statistics for choosing “optimized” k
. There are following statistics:
k
;k
, the area increased is defined as \(A_k - A_{k-1}\).The detailed explanations of these statistics can be found in the cola vignette.
Generally speaking, lower PAC score, higher mean silhouette score or higher
concordance corresponds to better partition. Rand index and Jaccard index
measure how similar the current partition is compared to partition with k-1
.
If they are too similar, we won't accept k
is better than k-1
.
select_partition_number(res)
The numeric values for all these statistics can be obtained by get_stats()
.
get_stats(res)
#> k 1-PAC mean_silhouette concordance area_increased Rand Jaccard
#> 2 2 0.336 0.521 0.777 0.3837 0.805 0.805
#> 3 3 0.712 0.822 0.868 0.5642 0.619 0.527
#> 4 4 0.666 0.777 0.805 0.1643 0.875 0.705
#> 5 5 0.699 0.636 0.803 0.0824 0.979 0.932
#> 6 6 0.773 0.744 0.785 0.0690 0.883 0.598
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
#> GSM1060768 1 0.895 -0.235 0.688 0.312
#> GSM1060769 1 0.895 -0.235 0.688 0.312
#> GSM1060770 1 0.895 -0.235 0.688 0.312
#> GSM1060771 1 0.000 0.444 1.000 0.000
#> GSM1060772 1 0.895 -0.235 0.688 0.312
#> GSM1060773 1 0.775 0.621 0.772 0.228
#> GSM1060774 1 0.895 -0.235 0.688 0.312
#> GSM1060775 1 0.895 -0.235 0.688 0.312
#> GSM1060776 1 0.895 -0.235 0.688 0.312
#> GSM1060777 1 0.000 0.444 1.000 0.000
#> GSM1060778 1 0.895 -0.235 0.688 0.312
#> GSM1060779 1 0.895 -0.235 0.688 0.312
#> GSM1060780 1 0.000 0.444 1.000 0.000
#> GSM1060781 1 0.615 0.575 0.848 0.152
#> GSM1060782 1 0.895 -0.235 0.688 0.312
#> GSM1060783 1 0.000 0.444 1.000 0.000
#> GSM1060784 1 0.000 0.444 1.000 0.000
#> GSM1060785 1 0.000 0.444 1.000 0.000
#> GSM1060786 1 0.895 -0.235 0.688 0.312
#> GSM1060787 1 0.000 0.444 1.000 0.000
#> GSM1060788 1 0.000 0.444 1.000 0.000
#> GSM1060789 1 0.000 0.444 1.000 0.000
#> GSM1060790 1 0.895 -0.235 0.688 0.312
#> GSM1060754 1 0.978 0.698 0.588 0.412
#> GSM1060745 1 0.978 0.698 0.588 0.412
#> GSM1060756 1 0.978 0.698 0.588 0.412
#> GSM1060746 1 0.978 0.698 0.588 0.412
#> GSM1060758 1 0.958 0.707 0.620 0.380
#> GSM1060765 1 0.966 0.708 0.608 0.392
#> GSM1060732 2 0.745 0.997 0.212 0.788
#> GSM1060727 2 0.745 0.997 0.212 0.788
#> GSM1060740 1 0.966 0.708 0.608 0.392
#> GSM1060730 2 0.745 0.997 0.212 0.788
#> GSM1060737 1 0.978 0.698 0.588 0.412
#> GSM1060743 1 0.966 0.708 0.608 0.392
#> GSM1060734 1 0.978 0.698 0.588 0.412
#> GSM1060729 2 0.745 0.997 0.212 0.788
#> GSM1060744 1 0.966 0.708 0.608 0.392
#> GSM1060742 1 0.966 0.708 0.608 0.392
#> GSM1060752 1 0.966 0.708 0.608 0.392
#> GSM1060755 1 0.966 0.708 0.608 0.392
#> GSM1060761 1 0.958 0.707 0.620 0.380
#> GSM1060760 1 0.958 0.707 0.620 0.380
#> GSM1060767 1 0.978 0.698 0.588 0.412
#> GSM1060741 1 0.966 0.708 0.608 0.392
#> GSM1060759 1 0.958 0.707 0.620 0.380
#> GSM1060728 2 0.767 0.979 0.224 0.776
#> GSM1060763 1 0.978 0.698 0.588 0.412
#> GSM1060747 1 0.966 0.708 0.608 0.392
#> GSM1060764 1 0.978 0.698 0.588 0.412
#> GSM1060733 1 0.978 0.698 0.588 0.412
#> GSM1060735 1 0.966 0.708 0.608 0.392
#> GSM1060739 1 0.966 0.708 0.608 0.392
#> GSM1060753 1 0.958 0.707 0.620 0.380
#> GSM1060738 1 0.966 0.708 0.608 0.392
#> GSM1060762 1 0.781 0.596 0.768 0.232
#> GSM1060731 2 0.745 0.997 0.212 0.788
#> GSM1060750 1 0.958 0.707 0.620 0.380
#> GSM1060749 1 0.958 0.707 0.620 0.380
#> GSM1060736 1 0.978 0.698 0.588 0.412
#> GSM1060748 1 0.958 0.707 0.620 0.380
#> GSM1060751 1 0.966 0.708 0.608 0.392
#> GSM1060766 1 0.958 0.707 0.620 0.380
#> GSM1060757 1 0.966 0.708 0.608 0.392
#> GSM1060726 2 0.745 0.997 0.212 0.788
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> GSM1060768 2 0.5864 0.748 0.008 0.704 0.288
#> GSM1060769 2 0.5864 0.748 0.008 0.704 0.288
#> GSM1060770 2 0.5864 0.748 0.008 0.704 0.288
#> GSM1060771 2 0.1964 0.742 0.056 0.944 0.000
#> GSM1060772 2 0.5202 0.753 0.008 0.772 0.220
#> GSM1060773 1 0.7464 0.544 0.560 0.400 0.040
#> GSM1060774 2 0.5797 0.750 0.008 0.712 0.280
#> GSM1060775 2 0.5831 0.749 0.008 0.708 0.284
#> GSM1060776 2 0.5864 0.748 0.008 0.704 0.288
#> GSM1060777 2 0.1964 0.742 0.056 0.944 0.000
#> GSM1060778 2 0.5864 0.748 0.008 0.704 0.288
#> GSM1060779 2 0.5864 0.748 0.008 0.704 0.288
#> GSM1060780 2 0.2492 0.750 0.048 0.936 0.016
#> GSM1060781 2 0.4206 0.662 0.088 0.872 0.040
#> GSM1060782 2 0.5864 0.748 0.008 0.704 0.288
#> GSM1060783 2 0.1964 0.742 0.056 0.944 0.000
#> GSM1060784 2 0.1753 0.747 0.048 0.952 0.000
#> GSM1060785 2 0.1964 0.742 0.056 0.944 0.000
#> GSM1060786 2 0.5864 0.748 0.008 0.704 0.288
#> GSM1060787 2 0.1643 0.748 0.044 0.956 0.000
#> GSM1060788 2 0.2066 0.742 0.060 0.940 0.000
#> GSM1060789 2 0.1964 0.742 0.056 0.944 0.000
#> GSM1060790 2 0.5864 0.748 0.008 0.704 0.288
#> GSM1060754 1 0.0424 0.880 0.992 0.008 0.000
#> GSM1060745 1 0.1163 0.888 0.972 0.028 0.000
#> GSM1060756 1 0.0424 0.880 0.992 0.008 0.000
#> GSM1060746 1 0.0424 0.880 0.992 0.008 0.000
#> GSM1060758 1 0.7363 0.729 0.656 0.280 0.064
#> GSM1060765 1 0.1289 0.888 0.968 0.032 0.000
#> GSM1060732 3 0.3148 1.000 0.036 0.048 0.916
#> GSM1060727 3 0.3148 1.000 0.036 0.048 0.916
#> GSM1060740 1 0.1411 0.888 0.964 0.036 0.000
#> GSM1060730 3 0.3148 1.000 0.036 0.048 0.916
#> GSM1060737 1 0.0592 0.880 0.988 0.012 0.000
#> GSM1060743 1 0.1411 0.888 0.964 0.036 0.000
#> GSM1060734 1 0.0424 0.880 0.992 0.008 0.000
#> GSM1060729 3 0.3148 1.000 0.036 0.048 0.916
#> GSM1060744 1 0.1411 0.888 0.964 0.036 0.000
#> GSM1060742 1 0.1411 0.888 0.964 0.036 0.000
#> GSM1060752 1 0.1753 0.885 0.952 0.048 0.000
#> GSM1060755 1 0.6585 0.773 0.736 0.200 0.064
#> GSM1060761 1 0.7363 0.729 0.656 0.280 0.064
#> GSM1060760 1 0.7363 0.729 0.656 0.280 0.064
#> GSM1060767 1 0.1163 0.888 0.972 0.028 0.000
#> GSM1060741 1 0.1411 0.888 0.964 0.036 0.000
#> GSM1060759 1 0.7363 0.729 0.656 0.280 0.064
#> GSM1060728 3 0.3148 1.000 0.036 0.048 0.916
#> GSM1060763 1 0.0424 0.880 0.992 0.008 0.000
#> GSM1060747 1 0.0424 0.884 0.992 0.008 0.000
#> GSM1060764 1 0.1163 0.888 0.972 0.028 0.000
#> GSM1060733 1 0.0424 0.880 0.992 0.008 0.000
#> GSM1060735 1 0.0237 0.883 0.996 0.004 0.000
#> GSM1060739 1 0.1411 0.888 0.964 0.036 0.000
#> GSM1060753 1 0.7363 0.729 0.656 0.280 0.064
#> GSM1060738 1 0.1411 0.888 0.964 0.036 0.000
#> GSM1060762 1 0.3879 0.831 0.848 0.152 0.000
#> GSM1060731 3 0.3148 1.000 0.036 0.048 0.916
#> GSM1060750 1 0.7394 0.727 0.652 0.284 0.064
#> GSM1060749 1 0.7053 0.757 0.692 0.244 0.064
#> GSM1060736 1 0.0592 0.880 0.988 0.012 0.000
#> GSM1060748 1 0.6976 0.744 0.700 0.236 0.064
#> GSM1060751 1 0.0424 0.884 0.992 0.008 0.000
#> GSM1060766 1 0.1860 0.885 0.948 0.052 0.000
#> GSM1060757 1 0.3993 0.846 0.884 0.052 0.064
#> GSM1060726 3 0.3148 1.000 0.036 0.048 0.916
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> GSM1060768 2 0.0188 0.797 0.000 0.996 0.004 0.000
#> GSM1060769 2 0.0188 0.797 0.000 0.996 0.004 0.000
#> GSM1060770 2 0.0188 0.797 0.000 0.996 0.004 0.000
#> GSM1060771 2 0.5302 0.717 0.012 0.628 0.004 0.356
#> GSM1060772 2 0.1305 0.795 0.000 0.960 0.004 0.036
#> GSM1060773 4 0.6329 -0.225 0.064 0.344 0.004 0.588
#> GSM1060774 2 0.0188 0.797 0.000 0.996 0.004 0.000
#> GSM1060775 2 0.0188 0.797 0.000 0.996 0.004 0.000
#> GSM1060776 2 0.0188 0.797 0.000 0.996 0.004 0.000
#> GSM1060777 2 0.5302 0.717 0.012 0.628 0.004 0.356
#> GSM1060778 2 0.0188 0.797 0.000 0.996 0.004 0.000
#> GSM1060779 2 0.0188 0.797 0.000 0.996 0.004 0.000
#> GSM1060780 2 0.4813 0.747 0.012 0.716 0.004 0.268
#> GSM1060781 2 0.6405 0.545 0.056 0.520 0.004 0.420
#> GSM1060782 2 0.0188 0.797 0.000 0.996 0.004 0.000
#> GSM1060783 2 0.5302 0.717 0.012 0.628 0.004 0.356
#> GSM1060784 2 0.5302 0.717 0.012 0.628 0.004 0.356
#> GSM1060785 2 0.5302 0.717 0.012 0.628 0.004 0.356
#> GSM1060786 2 0.0188 0.797 0.000 0.996 0.004 0.000
#> GSM1060787 2 0.5302 0.717 0.012 0.628 0.004 0.356
#> GSM1060788 2 0.5318 0.712 0.012 0.624 0.004 0.360
#> GSM1060789 2 0.5302 0.717 0.012 0.628 0.004 0.356
#> GSM1060790 2 0.0188 0.797 0.000 0.996 0.004 0.000
#> GSM1060754 1 0.3323 0.782 0.876 0.000 0.064 0.060
#> GSM1060745 1 0.1576 0.824 0.948 0.000 0.004 0.048
#> GSM1060756 1 0.1733 0.816 0.948 0.000 0.024 0.028
#> GSM1060746 1 0.1042 0.822 0.972 0.000 0.008 0.020
#> GSM1060758 4 0.4222 0.863 0.272 0.000 0.000 0.728
#> GSM1060765 1 0.2198 0.826 0.920 0.000 0.008 0.072
#> GSM1060732 3 0.2266 1.000 0.004 0.084 0.912 0.000
#> GSM1060727 3 0.2266 1.000 0.004 0.084 0.912 0.000
#> GSM1060740 1 0.3350 0.802 0.864 0.004 0.016 0.116
#> GSM1060730 3 0.2266 1.000 0.004 0.084 0.912 0.000
#> GSM1060737 1 0.4336 0.743 0.812 0.000 0.060 0.128
#> GSM1060743 1 0.3350 0.802 0.864 0.004 0.016 0.116
#> GSM1060734 1 0.3894 0.769 0.844 0.000 0.068 0.088
#> GSM1060729 3 0.2266 1.000 0.004 0.084 0.912 0.000
#> GSM1060744 1 0.3408 0.801 0.860 0.004 0.016 0.120
#> GSM1060742 1 0.3464 0.800 0.856 0.004 0.016 0.124
#> GSM1060752 1 0.3232 0.801 0.872 0.004 0.016 0.108
#> GSM1060755 4 0.5047 0.807 0.316 0.000 0.016 0.668
#> GSM1060761 4 0.4222 0.863 0.272 0.000 0.000 0.728
#> GSM1060760 4 0.4222 0.863 0.272 0.000 0.000 0.728
#> GSM1060767 1 0.1576 0.824 0.948 0.000 0.004 0.048
#> GSM1060741 1 0.3464 0.800 0.856 0.004 0.016 0.124
#> GSM1060759 4 0.4222 0.863 0.272 0.000 0.000 0.728
#> GSM1060728 3 0.2452 0.997 0.004 0.084 0.908 0.004
#> GSM1060763 1 0.4188 0.752 0.824 0.000 0.064 0.112
#> GSM1060747 1 0.3390 0.794 0.852 0.000 0.016 0.132
#> GSM1060764 1 0.1211 0.827 0.960 0.000 0.000 0.040
#> GSM1060733 1 0.3959 0.767 0.840 0.000 0.068 0.092
#> GSM1060735 1 0.2928 0.787 0.880 0.000 0.012 0.108
#> GSM1060739 1 0.3350 0.802 0.864 0.004 0.016 0.116
#> GSM1060753 4 0.4483 0.853 0.284 0.000 0.004 0.712
#> GSM1060738 1 0.3350 0.802 0.864 0.004 0.016 0.116
#> GSM1060762 1 0.2715 0.801 0.892 0.004 0.004 0.100
#> GSM1060731 3 0.2266 1.000 0.004 0.084 0.912 0.000
#> GSM1060750 4 0.4134 0.850 0.260 0.000 0.000 0.740
#> GSM1060749 4 0.4844 0.832 0.300 0.000 0.012 0.688
#> GSM1060736 1 0.4336 0.743 0.812 0.000 0.060 0.128
#> GSM1060748 4 0.4158 0.720 0.224 0.000 0.008 0.768
#> GSM1060751 1 0.3335 0.794 0.856 0.000 0.016 0.128
#> GSM1060766 1 0.3043 0.810 0.876 0.004 0.008 0.112
#> GSM1060757 1 0.6392 -0.269 0.484 0.000 0.064 0.452
#> GSM1060726 3 0.2266 1.000 0.004 0.084 0.912 0.000
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> GSM1060768 5 0.0000 0.60954 0.000 0.000 0.000 0.000 1.000
#> GSM1060769 5 0.0324 0.60890 0.000 0.004 0.000 0.004 0.992
#> GSM1060770 5 0.0162 0.60938 0.000 0.004 0.000 0.000 0.996
#> GSM1060771 5 0.6299 0.02773 0.012 0.380 0.000 0.112 0.496
#> GSM1060772 5 0.1018 0.60244 0.000 0.016 0.000 0.016 0.968
#> GSM1060773 2 0.7350 0.00000 0.052 0.484 0.000 0.232 0.232
#> GSM1060774 5 0.0798 0.60561 0.000 0.016 0.000 0.008 0.976
#> GSM1060775 5 0.0798 0.60561 0.000 0.016 0.000 0.008 0.976
#> GSM1060776 5 0.0798 0.60561 0.000 0.016 0.000 0.008 0.976
#> GSM1060777 5 0.6299 0.02773 0.012 0.380 0.000 0.112 0.496
#> GSM1060778 5 0.0000 0.60954 0.000 0.000 0.000 0.000 1.000
#> GSM1060779 5 0.0000 0.60954 0.000 0.000 0.000 0.000 1.000
#> GSM1060780 5 0.5683 0.11840 0.008 0.388 0.000 0.064 0.540
#> GSM1060781 5 0.6954 -0.39142 0.016 0.384 0.000 0.196 0.404
#> GSM1060782 5 0.0000 0.60954 0.000 0.000 0.000 0.000 1.000
#> GSM1060783 5 0.6299 0.02773 0.012 0.380 0.000 0.112 0.496
#> GSM1060784 5 0.6328 0.02690 0.012 0.376 0.000 0.116 0.496
#> GSM1060785 5 0.6299 0.02773 0.012 0.380 0.000 0.112 0.496
#> GSM1060786 5 0.0000 0.60954 0.000 0.000 0.000 0.000 1.000
#> GSM1060787 5 0.6328 0.02690 0.012 0.376 0.000 0.116 0.496
#> GSM1060788 5 0.6364 0.00864 0.012 0.376 0.000 0.120 0.492
#> GSM1060789 5 0.6299 0.02773 0.012 0.380 0.000 0.112 0.496
#> GSM1060790 5 0.0000 0.60954 0.000 0.000 0.000 0.000 1.000
#> GSM1060754 1 0.4608 0.71542 0.700 0.260 0.004 0.036 0.000
#> GSM1060745 1 0.2011 0.80291 0.908 0.088 0.000 0.004 0.000
#> GSM1060756 1 0.3320 0.77747 0.820 0.164 0.004 0.012 0.000
#> GSM1060746 1 0.2361 0.79975 0.892 0.096 0.000 0.012 0.000
#> GSM1060758 4 0.2286 0.90331 0.108 0.004 0.000 0.888 0.000
#> GSM1060765 1 0.1082 0.80483 0.964 0.008 0.000 0.028 0.000
#> GSM1060732 3 0.0693 0.98310 0.000 0.000 0.980 0.008 0.012
#> GSM1060727 3 0.0404 0.98611 0.000 0.000 0.988 0.000 0.012
#> GSM1060740 1 0.2806 0.78745 0.888 0.052 0.008 0.052 0.000
#> GSM1060730 3 0.0404 0.98611 0.000 0.000 0.988 0.000 0.012
#> GSM1060737 1 0.5385 0.58624 0.512 0.432 0.000 0.056 0.000
#> GSM1060743 1 0.2806 0.78745 0.888 0.052 0.008 0.052 0.000
#> GSM1060734 1 0.5152 0.65265 0.608 0.344 0.004 0.044 0.000
#> GSM1060729 3 0.0404 0.98611 0.000 0.000 0.988 0.000 0.012
#> GSM1060744 1 0.3078 0.78740 0.872 0.064 0.008 0.056 0.000
#> GSM1060742 1 0.3078 0.78740 0.872 0.064 0.008 0.056 0.000
#> GSM1060752 1 0.2734 0.78826 0.892 0.052 0.008 0.048 0.000
#> GSM1060755 4 0.3467 0.88511 0.128 0.036 0.004 0.832 0.000
#> GSM1060761 4 0.2286 0.90331 0.108 0.004 0.000 0.888 0.000
#> GSM1060760 4 0.2286 0.90331 0.108 0.004 0.000 0.888 0.000
#> GSM1060767 1 0.2011 0.80291 0.908 0.088 0.000 0.004 0.000
#> GSM1060741 1 0.3012 0.78714 0.876 0.060 0.008 0.056 0.000
#> GSM1060759 4 0.2286 0.90331 0.108 0.004 0.000 0.888 0.000
#> GSM1060728 3 0.2930 0.91948 0.000 0.076 0.880 0.032 0.012
#> GSM1060763 1 0.5085 0.65471 0.612 0.344 0.004 0.040 0.000
#> GSM1060747 1 0.3688 0.75685 0.816 0.124 0.000 0.060 0.000
#> GSM1060764 1 0.1768 0.80411 0.924 0.072 0.000 0.004 0.000
#> GSM1060733 1 0.5152 0.65265 0.608 0.344 0.004 0.044 0.000
#> GSM1060735 1 0.4369 0.74767 0.740 0.208 0.000 0.052 0.000
#> GSM1060739 1 0.2806 0.78745 0.888 0.052 0.008 0.052 0.000
#> GSM1060753 4 0.2179 0.90186 0.112 0.000 0.000 0.888 0.000
#> GSM1060738 1 0.2806 0.78745 0.888 0.052 0.008 0.052 0.000
#> GSM1060762 1 0.3779 0.76810 0.804 0.144 0.000 0.052 0.000
#> GSM1060731 3 0.0404 0.98611 0.000 0.000 0.988 0.000 0.012
#> GSM1060750 4 0.2983 0.87999 0.096 0.040 0.000 0.864 0.000
#> GSM1060749 4 0.3327 0.88286 0.144 0.028 0.000 0.828 0.000
#> GSM1060736 1 0.5385 0.58624 0.512 0.432 0.000 0.056 0.000
#> GSM1060748 4 0.4036 0.75057 0.068 0.144 0.000 0.788 0.000
#> GSM1060751 1 0.3688 0.75685 0.816 0.124 0.000 0.060 0.000
#> GSM1060766 1 0.1364 0.80322 0.952 0.012 0.000 0.036 0.000
#> GSM1060757 4 0.6107 0.58356 0.200 0.208 0.004 0.588 0.000
#> GSM1060726 3 0.0404 0.98611 0.000 0.000 0.988 0.000 0.012
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> GSM1060768 5 0.0000 0.970 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM1060769 5 0.0551 0.970 0.004 0.004 0.000 0.008 0.984 0.000
#> GSM1060770 5 0.0551 0.970 0.004 0.004 0.000 0.008 0.984 0.000
#> GSM1060771 2 0.5190 0.928 0.000 0.584 0.000 0.100 0.312 0.004
#> GSM1060772 5 0.2024 0.947 0.036 0.012 0.000 0.020 0.924 0.008
#> GSM1060773 2 0.5147 0.490 0.072 0.732 0.000 0.100 0.076 0.020
#> GSM1060774 5 0.1785 0.952 0.028 0.012 0.000 0.016 0.936 0.008
#> GSM1060775 5 0.1785 0.952 0.028 0.012 0.000 0.016 0.936 0.008
#> GSM1060776 5 0.2024 0.947 0.036 0.012 0.000 0.020 0.924 0.008
#> GSM1060777 2 0.5190 0.928 0.000 0.584 0.000 0.100 0.312 0.004
#> GSM1060778 5 0.0000 0.970 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM1060779 5 0.0000 0.970 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM1060780 2 0.5515 0.830 0.024 0.556 0.000 0.068 0.348 0.004
#> GSM1060781 2 0.5336 0.873 0.000 0.596 0.000 0.140 0.260 0.004
#> GSM1060782 5 0.0000 0.970 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM1060783 2 0.5190 0.928 0.000 0.584 0.000 0.100 0.312 0.004
#> GSM1060784 2 0.5323 0.927 0.004 0.580 0.000 0.100 0.312 0.004
#> GSM1060785 2 0.5190 0.928 0.000 0.584 0.000 0.100 0.312 0.004
#> GSM1060786 5 0.0260 0.969 0.008 0.000 0.000 0.000 0.992 0.000
#> GSM1060787 2 0.5323 0.927 0.004 0.580 0.000 0.100 0.312 0.004
#> GSM1060788 2 0.5309 0.925 0.004 0.584 0.000 0.100 0.308 0.004
#> GSM1060789 2 0.5190 0.928 0.000 0.584 0.000 0.100 0.312 0.004
#> GSM1060790 5 0.0260 0.969 0.008 0.000 0.000 0.000 0.992 0.000
#> GSM1060754 1 0.4962 0.513 0.640 0.048 0.000 0.028 0.000 0.284
#> GSM1060745 6 0.5113 0.370 0.352 0.064 0.000 0.012 0.000 0.572
#> GSM1060756 6 0.5249 0.172 0.432 0.064 0.000 0.012 0.000 0.492
#> GSM1060746 6 0.5209 0.313 0.372 0.068 0.000 0.012 0.000 0.548
#> GSM1060758 4 0.1196 0.886 0.000 0.008 0.000 0.952 0.000 0.040
#> GSM1060765 6 0.4596 0.552 0.124 0.132 0.000 0.016 0.000 0.728
#> GSM1060732 3 0.0291 0.982 0.000 0.000 0.992 0.004 0.004 0.000
#> GSM1060727 3 0.0146 0.983 0.000 0.000 0.996 0.000 0.004 0.000
#> GSM1060740 6 0.1194 0.627 0.000 0.008 0.004 0.032 0.000 0.956
#> GSM1060730 3 0.0146 0.983 0.000 0.000 0.996 0.000 0.004 0.000
#> GSM1060737 1 0.5307 0.632 0.652 0.196 0.000 0.024 0.000 0.128
#> GSM1060743 6 0.0858 0.630 0.004 0.000 0.000 0.028 0.000 0.968
#> GSM1060734 1 0.3269 0.749 0.792 0.000 0.000 0.024 0.000 0.184
#> GSM1060729 3 0.0146 0.983 0.000 0.000 0.996 0.000 0.004 0.000
#> GSM1060744 6 0.1736 0.624 0.008 0.020 0.004 0.032 0.000 0.936
#> GSM1060742 6 0.1736 0.624 0.008 0.020 0.004 0.032 0.000 0.936
#> GSM1060752 6 0.1616 0.627 0.000 0.020 0.000 0.048 0.000 0.932
#> GSM1060755 4 0.2968 0.860 0.032 0.044 0.000 0.868 0.000 0.056
#> GSM1060761 4 0.1196 0.886 0.000 0.008 0.000 0.952 0.000 0.040
#> GSM1060760 4 0.1196 0.886 0.000 0.008 0.000 0.952 0.000 0.040
#> GSM1060767 6 0.5113 0.370 0.352 0.064 0.000 0.012 0.000 0.572
#> GSM1060741 6 0.1736 0.624 0.008 0.020 0.004 0.032 0.000 0.936
#> GSM1060759 4 0.1196 0.886 0.000 0.008 0.000 0.952 0.000 0.040
#> GSM1060728 3 0.2893 0.897 0.080 0.048 0.864 0.000 0.004 0.004
#> GSM1060763 1 0.3089 0.750 0.800 0.004 0.000 0.008 0.000 0.188
#> GSM1060747 6 0.6244 0.281 0.204 0.244 0.004 0.024 0.000 0.524
#> GSM1060764 6 0.5139 0.368 0.344 0.068 0.000 0.012 0.000 0.576
#> GSM1060733 1 0.3269 0.749 0.792 0.000 0.000 0.024 0.000 0.184
#> GSM1060735 6 0.6650 -0.048 0.316 0.292 0.000 0.028 0.000 0.364
#> GSM1060739 6 0.1194 0.627 0.000 0.008 0.004 0.032 0.000 0.956
#> GSM1060753 4 0.1007 0.884 0.000 0.000 0.000 0.956 0.000 0.044
#> GSM1060738 6 0.1194 0.627 0.000 0.008 0.004 0.032 0.000 0.956
#> GSM1060762 6 0.6287 0.200 0.392 0.112 0.000 0.052 0.000 0.444
#> GSM1060731 3 0.0146 0.983 0.000 0.000 0.996 0.000 0.004 0.000
#> GSM1060750 4 0.2604 0.866 0.008 0.076 0.000 0.880 0.000 0.036
#> GSM1060749 4 0.3095 0.845 0.008 0.044 0.000 0.844 0.000 0.104
#> GSM1060736 1 0.5307 0.632 0.652 0.196 0.000 0.024 0.000 0.128
#> GSM1060748 4 0.4920 0.634 0.100 0.216 0.000 0.672 0.000 0.012
#> GSM1060751 6 0.6112 0.281 0.204 0.244 0.000 0.024 0.000 0.528
#> GSM1060766 6 0.4476 0.559 0.116 0.128 0.000 0.016 0.000 0.740
#> GSM1060757 4 0.5094 0.337 0.416 0.036 0.000 0.524 0.000 0.024
#> GSM1060726 3 0.0146 0.983 0.000 0.000 0.996 0.000 0.004 0.000
Heatmaps for the consensus matrix. It visualizes the probability of two samples to be in a same group.
consensus_heatmap(res, k = 2)
consensus_heatmap(res, k = 3)
consensus_heatmap(res, k = 4)
consensus_heatmap(res, k = 5)
consensus_heatmap(res, k = 6)
Heatmaps for the membership of samples in all partitions to see how consistent they are:
membership_heatmap(res, k = 2)
membership_heatmap(res, k = 3)
membership_heatmap(res, k = 4)
membership_heatmap(res, k = 5)
membership_heatmap(res, k = 6)
As soon as we have had the classes for columns, we can look for signatures which are significantly different between classes which can be candidate marks for certain classes. Following are the heatmaps for signatures.
Signature heatmaps where rows are scaled:
get_signatures(res, k = 2)
get_signatures(res, k = 3)
get_signatures(res, k = 4)
get_signatures(res, k = 5)
get_signatures(res, k = 6)
Signature heatmaps where rows are not scaled:
get_signatures(res, k = 2, scale_rows = FALSE)
get_signatures(res, k = 3, scale_rows = FALSE)
get_signatures(res, k = 4, scale_rows = FALSE)
get_signatures(res, k = 5, scale_rows = FALSE)
get_signatures(res, k = 6, scale_rows = FALSE)
Compare the overlap of signatures from different k:
compare_signatures(res)
get_signature()
returns a data frame invisibly. TO get the list of signatures, the function
call should be assigned to a variable explicitly. In following code, if plot
argument is set
to FALSE
, no heatmap is plotted while only the differential analysis is performed.
# code only for demonstration
tb = get_signature(res, k = ..., plot = FALSE)
An example of the output of tb
is:
#> which_row fdr mean_1 mean_2 scaled_mean_1 scaled_mean_2 km
#> 1 38 0.042760348 8.373488 9.131774 -0.5533452 0.5164555 1
#> 2 40 0.018707592 7.106213 8.469186 -0.6173731 0.5762149 1
#> 3 55 0.019134737 10.221463 11.207825 -0.6159697 0.5749050 1
#> 4 59 0.006059896 5.921854 7.869574 -0.6899429 0.6439467 1
#> 5 60 0.018055526 8.928898 10.211722 -0.6204761 0.5791110 1
#> 6 98 0.009384629 15.714769 14.887706 0.6635654 -0.6193277 2
...
The columns in tb
are:
which_row
: row indices corresponding to the input matrix.fdr
: FDR for the differential test. mean_x
: The mean value in group x.scaled_mean_x
: The mean value in group x after rows are scaled.km
: Row groups if k-means clustering is applied to rows.UMAP plot which shows how samples are separated.
dimension_reduction(res, k = 2, method = "UMAP")
dimension_reduction(res, k = 3, method = "UMAP")
dimension_reduction(res, k = 4, method = "UMAP")
dimension_reduction(res, k = 5, method = "UMAP")
dimension_reduction(res, k = 6, method = "UMAP")
Following heatmap shows how subgroups are split when increasing k
:
collect_classes(res)
Test correlation between subgroups and known annotations. If the known annotation is numeric, one-way ANOVA test is applied, and if the known annotation is discrete, chi-squared contingency table test is applied.
test_to_known_factors(res)
#> n disease.state(p) tissue(p) k
#> CV:kmeans 44 1.00e+00 0.386909 2
#> CV:kmeans 65 6.44e-14 0.002293 3
#> CV:kmeans 63 1.34e-13 0.000122 4
#> CV:kmeans 54 1.12e-11 0.016876 5
#> CV:kmeans 54 2.10e-10 0.002106 6
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 51941 rows and 65 columns.
#> Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'CV' method.
#> Subgroups are detected by 'skmeans' method.
#> Performed in total 1250 partitions by row resampling.
#> Best k for subgroups seems to be 3.
#>
#> Following methods can be applied to this 'ConsensusPartition' object:
#> [1] "cola_report" "collect_classes" "collect_plots"
#> [4] "collect_stats" "colnames" "compare_signatures"
#> [7] "consensus_heatmap" "dimension_reduction" "functional_enrichment"
#> [10] "get_anno_col" "get_anno" "get_classes"
#> [13] "get_consensus" "get_matrix" "get_membership"
#> [16] "get_param" "get_signatures" "get_stats"
#> [19] "is_best_k" "is_stable_k" "membership_heatmap"
#> [22] "ncol" "nrow" "plot_ecdf"
#> [25] "rownames" "select_partition_number" "show"
#> [28] "suggest_best_k" "test_to_known_factors"
collect_plots()
function collects all the plots made from res
for all k
(number of partitions)
into one single page to provide an easy and fast comparison between different k
.
collect_plots(res)
The plots are:
k
and the heatmap of
predicted classes for each k
.k
.k
.k
.All the plots in panels can be made by individual functions and they are plotted later in this section.
select_partition_number()
produces several plots showing different
statistics for choosing “optimized” k
. There are following statistics:
k
;k
, the area increased is defined as \(A_k - A_{k-1}\).The detailed explanations of these statistics can be found in the cola vignette.
Generally speaking, lower PAC score, higher mean silhouette score or higher
concordance corresponds to better partition. Rand index and Jaccard index
measure how similar the current partition is compared to partition with k-1
.
If they are too similar, we won't accept k
is better than k-1
.
select_partition_number(res)
The numeric values for all these statistics can be obtained by get_stats()
.
get_stats(res)
#> k 1-PAC mean_silhouette concordance area_increased Rand Jaccard
#> 2 2 1.000 0.988 0.994 0.5041 0.495 0.495
#> 3 3 1.000 0.961 0.976 0.1933 0.888 0.779
#> 4 4 0.811 0.887 0.933 0.1994 0.869 0.681
#> 5 5 0.795 0.888 0.869 0.0840 0.933 0.767
#> 6 6 0.869 0.831 0.896 0.0693 0.931 0.694
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
#> GSM1060768 2 0.0000 0.987 0.000 1.000
#> GSM1060769 2 0.0000 0.987 0.000 1.000
#> GSM1060770 2 0.0000 0.987 0.000 1.000
#> GSM1060771 2 0.0000 0.987 0.000 1.000
#> GSM1060772 2 0.0000 0.987 0.000 1.000
#> GSM1060773 1 0.0000 1.000 1.000 0.000
#> GSM1060774 2 0.0000 0.987 0.000 1.000
#> GSM1060775 2 0.0000 0.987 0.000 1.000
#> GSM1060776 2 0.0000 0.987 0.000 1.000
#> GSM1060777 2 0.0000 0.987 0.000 1.000
#> GSM1060778 2 0.0000 0.987 0.000 1.000
#> GSM1060779 2 0.0000 0.987 0.000 1.000
#> GSM1060780 2 0.0000 0.987 0.000 1.000
#> GSM1060781 2 0.7219 0.759 0.200 0.800
#> GSM1060782 2 0.0000 0.987 0.000 1.000
#> GSM1060783 2 0.0000 0.987 0.000 1.000
#> GSM1060784 2 0.0000 0.987 0.000 1.000
#> GSM1060785 2 0.0000 0.987 0.000 1.000
#> GSM1060786 2 0.0000 0.987 0.000 1.000
#> GSM1060787 2 0.0000 0.987 0.000 1.000
#> GSM1060788 2 0.0376 0.984 0.004 0.996
#> GSM1060789 2 0.0000 0.987 0.000 1.000
#> GSM1060790 2 0.0000 0.987 0.000 1.000
#> GSM1060754 1 0.0000 1.000 1.000 0.000
#> GSM1060745 1 0.0000 1.000 1.000 0.000
#> GSM1060756 1 0.0000 1.000 1.000 0.000
#> GSM1060746 1 0.0000 1.000 1.000 0.000
#> GSM1060758 1 0.0000 1.000 1.000 0.000
#> GSM1060765 1 0.0000 1.000 1.000 0.000
#> GSM1060732 2 0.0000 0.987 0.000 1.000
#> GSM1060727 2 0.0000 0.987 0.000 1.000
#> GSM1060740 1 0.0000 1.000 1.000 0.000
#> GSM1060730 2 0.0000 0.987 0.000 1.000
#> GSM1060737 1 0.0000 1.000 1.000 0.000
#> GSM1060743 1 0.0000 1.000 1.000 0.000
#> GSM1060734 1 0.0000 1.000 1.000 0.000
#> GSM1060729 2 0.0000 0.987 0.000 1.000
#> GSM1060744 1 0.0000 1.000 1.000 0.000
#> GSM1060742 1 0.0000 1.000 1.000 0.000
#> GSM1060752 1 0.0000 1.000 1.000 0.000
#> GSM1060755 1 0.0000 1.000 1.000 0.000
#> GSM1060761 1 0.0000 1.000 1.000 0.000
#> GSM1060760 1 0.0000 1.000 1.000 0.000
#> GSM1060767 1 0.0000 1.000 1.000 0.000
#> GSM1060741 1 0.0000 1.000 1.000 0.000
#> GSM1060759 1 0.0000 1.000 1.000 0.000
#> GSM1060728 2 0.0000 0.987 0.000 1.000
#> GSM1060763 1 0.0000 1.000 1.000 0.000
#> GSM1060747 1 0.0000 1.000 1.000 0.000
#> GSM1060764 1 0.0000 1.000 1.000 0.000
#> GSM1060733 1 0.0000 1.000 1.000 0.000
#> GSM1060735 1 0.0000 1.000 1.000 0.000
#> GSM1060739 1 0.0000 1.000 1.000 0.000
#> GSM1060753 1 0.0000 1.000 1.000 0.000
#> GSM1060738 1 0.0000 1.000 1.000 0.000
#> GSM1060762 2 0.6438 0.809 0.164 0.836
#> GSM1060731 2 0.0000 0.987 0.000 1.000
#> GSM1060750 1 0.0000 1.000 1.000 0.000
#> GSM1060749 1 0.0000 1.000 1.000 0.000
#> GSM1060736 1 0.0000 1.000 1.000 0.000
#> GSM1060748 1 0.0000 1.000 1.000 0.000
#> GSM1060751 1 0.0000 1.000 1.000 0.000
#> GSM1060766 1 0.0000 1.000 1.000 0.000
#> GSM1060757 1 0.0000 1.000 1.000 0.000
#> GSM1060726 2 0.0000 0.987 0.000 1.000
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> GSM1060768 2 0.1860 0.961 0.000 0.948 0.052
#> GSM1060769 2 0.1860 0.961 0.000 0.948 0.052
#> GSM1060770 2 0.1860 0.961 0.000 0.948 0.052
#> GSM1060771 2 0.0000 0.955 0.000 1.000 0.000
#> GSM1060772 2 0.1860 0.961 0.000 0.948 0.052
#> GSM1060773 2 0.4399 0.693 0.188 0.812 0.000
#> GSM1060774 2 0.1860 0.961 0.000 0.948 0.052
#> GSM1060775 2 0.1860 0.961 0.000 0.948 0.052
#> GSM1060776 2 0.1860 0.961 0.000 0.948 0.052
#> GSM1060777 2 0.0000 0.955 0.000 1.000 0.000
#> GSM1060778 2 0.1860 0.961 0.000 0.948 0.052
#> GSM1060779 2 0.1860 0.961 0.000 0.948 0.052
#> GSM1060780 2 0.0892 0.958 0.000 0.980 0.020
#> GSM1060781 2 0.0000 0.955 0.000 1.000 0.000
#> GSM1060782 2 0.1860 0.961 0.000 0.948 0.052
#> GSM1060783 2 0.0000 0.955 0.000 1.000 0.000
#> GSM1060784 2 0.0000 0.955 0.000 1.000 0.000
#> GSM1060785 2 0.0000 0.955 0.000 1.000 0.000
#> GSM1060786 2 0.1860 0.961 0.000 0.948 0.052
#> GSM1060787 2 0.0000 0.955 0.000 1.000 0.000
#> GSM1060788 2 0.0000 0.955 0.000 1.000 0.000
#> GSM1060789 2 0.0000 0.955 0.000 1.000 0.000
#> GSM1060790 2 0.1860 0.961 0.000 0.948 0.052
#> GSM1060754 1 0.0000 0.979 1.000 0.000 0.000
#> GSM1060745 1 0.5397 0.612 0.720 0.000 0.280
#> GSM1060756 1 0.0237 0.977 0.996 0.000 0.004
#> GSM1060746 1 0.0237 0.977 0.996 0.000 0.004
#> GSM1060758 1 0.1643 0.957 0.956 0.044 0.000
#> GSM1060765 1 0.0000 0.979 1.000 0.000 0.000
#> GSM1060732 3 0.0000 0.997 0.000 0.000 1.000
#> GSM1060727 3 0.0000 0.997 0.000 0.000 1.000
#> GSM1060740 1 0.0000 0.979 1.000 0.000 0.000
#> GSM1060730 3 0.0000 0.997 0.000 0.000 1.000
#> GSM1060737 1 0.0000 0.979 1.000 0.000 0.000
#> GSM1060743 1 0.0000 0.979 1.000 0.000 0.000
#> GSM1060734 1 0.0237 0.977 0.996 0.000 0.004
#> GSM1060729 3 0.0000 0.997 0.000 0.000 1.000
#> GSM1060744 1 0.0000 0.979 1.000 0.000 0.000
#> GSM1060742 1 0.0000 0.979 1.000 0.000 0.000
#> GSM1060752 1 0.0000 0.979 1.000 0.000 0.000
#> GSM1060755 1 0.0892 0.970 0.980 0.020 0.000
#> GSM1060761 1 0.1643 0.957 0.956 0.044 0.000
#> GSM1060760 1 0.1643 0.957 0.956 0.044 0.000
#> GSM1060767 1 0.0237 0.977 0.996 0.000 0.004
#> GSM1060741 1 0.0000 0.979 1.000 0.000 0.000
#> GSM1060759 1 0.1643 0.957 0.956 0.044 0.000
#> GSM1060728 3 0.0000 0.997 0.000 0.000 1.000
#> GSM1060763 1 0.0237 0.977 0.996 0.000 0.004
#> GSM1060747 1 0.0000 0.979 1.000 0.000 0.000
#> GSM1060764 1 0.0424 0.975 0.992 0.000 0.008
#> GSM1060733 1 0.0000 0.979 1.000 0.000 0.000
#> GSM1060735 1 0.0000 0.979 1.000 0.000 0.000
#> GSM1060739 1 0.0000 0.979 1.000 0.000 0.000
#> GSM1060753 1 0.1643 0.957 0.956 0.044 0.000
#> GSM1060738 1 0.0000 0.979 1.000 0.000 0.000
#> GSM1060762 3 0.0829 0.982 0.012 0.004 0.984
#> GSM1060731 3 0.0000 0.997 0.000 0.000 1.000
#> GSM1060750 1 0.1643 0.957 0.956 0.044 0.000
#> GSM1060749 1 0.1643 0.957 0.956 0.044 0.000
#> GSM1060736 1 0.0000 0.979 1.000 0.000 0.000
#> GSM1060748 1 0.1643 0.957 0.956 0.044 0.000
#> GSM1060751 1 0.0000 0.979 1.000 0.000 0.000
#> GSM1060766 1 0.0000 0.979 1.000 0.000 0.000
#> GSM1060757 1 0.0000 0.979 1.000 0.000 0.000
#> GSM1060726 3 0.0000 0.997 0.000 0.000 1.000
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> GSM1060768 2 0.0188 0.914 0.000 0.996 0.004 0.000
#> GSM1060769 2 0.0188 0.914 0.000 0.996 0.004 0.000
#> GSM1060770 2 0.0188 0.914 0.000 0.996 0.004 0.000
#> GSM1060771 2 0.3649 0.830 0.000 0.796 0.000 0.204
#> GSM1060772 2 0.0188 0.914 0.000 0.996 0.004 0.000
#> GSM1060773 4 0.4934 0.528 0.028 0.252 0.000 0.720
#> GSM1060774 2 0.0188 0.914 0.000 0.996 0.004 0.000
#> GSM1060775 2 0.0188 0.914 0.000 0.996 0.004 0.000
#> GSM1060776 2 0.0188 0.914 0.000 0.996 0.004 0.000
#> GSM1060777 2 0.3649 0.830 0.000 0.796 0.000 0.204
#> GSM1060778 2 0.0188 0.914 0.000 0.996 0.004 0.000
#> GSM1060779 2 0.0188 0.914 0.000 0.996 0.004 0.000
#> GSM1060780 2 0.0592 0.909 0.000 0.984 0.000 0.016
#> GSM1060781 2 0.4431 0.698 0.000 0.696 0.000 0.304
#> GSM1060782 2 0.0188 0.914 0.000 0.996 0.004 0.000
#> GSM1060783 2 0.3610 0.834 0.000 0.800 0.000 0.200
#> GSM1060784 2 0.2408 0.884 0.000 0.896 0.000 0.104
#> GSM1060785 2 0.3610 0.834 0.000 0.800 0.000 0.200
#> GSM1060786 2 0.0188 0.914 0.000 0.996 0.004 0.000
#> GSM1060787 2 0.2530 0.881 0.000 0.888 0.000 0.112
#> GSM1060788 2 0.3444 0.844 0.000 0.816 0.000 0.184
#> GSM1060789 2 0.3610 0.834 0.000 0.800 0.000 0.200
#> GSM1060790 2 0.0188 0.914 0.000 0.996 0.004 0.000
#> GSM1060754 1 0.0469 0.925 0.988 0.000 0.000 0.012
#> GSM1060745 1 0.2882 0.870 0.892 0.000 0.084 0.024
#> GSM1060756 1 0.0188 0.927 0.996 0.000 0.000 0.004
#> GSM1060746 1 0.0188 0.927 0.996 0.000 0.000 0.004
#> GSM1060758 4 0.0592 0.909 0.016 0.000 0.000 0.984
#> GSM1060765 1 0.0336 0.927 0.992 0.000 0.000 0.008
#> GSM1060732 3 0.0000 0.992 0.000 0.000 1.000 0.000
#> GSM1060727 3 0.0000 0.992 0.000 0.000 1.000 0.000
#> GSM1060740 1 0.2647 0.882 0.880 0.000 0.000 0.120
#> GSM1060730 3 0.0000 0.992 0.000 0.000 1.000 0.000
#> GSM1060737 1 0.0000 0.927 1.000 0.000 0.000 0.000
#> GSM1060743 1 0.2345 0.894 0.900 0.000 0.000 0.100
#> GSM1060734 1 0.0188 0.927 0.996 0.000 0.000 0.004
#> GSM1060729 3 0.0000 0.992 0.000 0.000 1.000 0.000
#> GSM1060744 1 0.2530 0.887 0.888 0.000 0.000 0.112
#> GSM1060742 1 0.4543 0.629 0.676 0.000 0.000 0.324
#> GSM1060752 1 0.3610 0.812 0.800 0.000 0.000 0.200
#> GSM1060755 4 0.2081 0.855 0.084 0.000 0.000 0.916
#> GSM1060761 4 0.0592 0.909 0.016 0.000 0.000 0.984
#> GSM1060760 4 0.0592 0.909 0.016 0.000 0.000 0.984
#> GSM1060767 1 0.0707 0.925 0.980 0.000 0.000 0.020
#> GSM1060741 1 0.4304 0.700 0.716 0.000 0.000 0.284
#> GSM1060759 4 0.0592 0.909 0.016 0.000 0.000 0.984
#> GSM1060728 3 0.0000 0.992 0.000 0.000 1.000 0.000
#> GSM1060763 1 0.0000 0.927 1.000 0.000 0.000 0.000
#> GSM1060747 1 0.0336 0.927 0.992 0.000 0.000 0.008
#> GSM1060764 1 0.0336 0.927 0.992 0.000 0.000 0.008
#> GSM1060733 1 0.0188 0.927 0.996 0.000 0.000 0.004
#> GSM1060735 1 0.0000 0.927 1.000 0.000 0.000 0.000
#> GSM1060739 1 0.3219 0.848 0.836 0.000 0.000 0.164
#> GSM1060753 4 0.0592 0.909 0.016 0.000 0.000 0.984
#> GSM1060738 1 0.2921 0.868 0.860 0.000 0.000 0.140
#> GSM1060762 3 0.1732 0.941 0.040 0.004 0.948 0.008
#> GSM1060731 3 0.0000 0.992 0.000 0.000 1.000 0.000
#> GSM1060750 4 0.1118 0.902 0.036 0.000 0.000 0.964
#> GSM1060749 4 0.0817 0.905 0.024 0.000 0.000 0.976
#> GSM1060736 1 0.0000 0.927 1.000 0.000 0.000 0.000
#> GSM1060748 4 0.1302 0.897 0.044 0.000 0.000 0.956
#> GSM1060751 1 0.0336 0.927 0.992 0.000 0.000 0.008
#> GSM1060766 1 0.1302 0.918 0.956 0.000 0.000 0.044
#> GSM1060757 4 0.4543 0.539 0.324 0.000 0.000 0.676
#> GSM1060726 3 0.0000 0.992 0.000 0.000 1.000 0.000
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> GSM1060768 5 0.0000 1.000 0.000 0.000 0.000 0.000 1.000
#> GSM1060769 5 0.0000 1.000 0.000 0.000 0.000 0.000 1.000
#> GSM1060770 5 0.0000 1.000 0.000 0.000 0.000 0.000 1.000
#> GSM1060771 2 0.2583 0.940 0.000 0.864 0.000 0.004 0.132
#> GSM1060772 5 0.0000 1.000 0.000 0.000 0.000 0.000 1.000
#> GSM1060773 2 0.3938 0.809 0.032 0.824 0.000 0.104 0.040
#> GSM1060774 5 0.0000 1.000 0.000 0.000 0.000 0.000 1.000
#> GSM1060775 5 0.0000 1.000 0.000 0.000 0.000 0.000 1.000
#> GSM1060776 5 0.0000 1.000 0.000 0.000 0.000 0.000 1.000
#> GSM1060777 2 0.2583 0.940 0.000 0.864 0.000 0.004 0.132
#> GSM1060778 5 0.0000 1.000 0.000 0.000 0.000 0.000 1.000
#> GSM1060779 5 0.0000 1.000 0.000 0.000 0.000 0.000 1.000
#> GSM1060780 2 0.4219 0.517 0.000 0.584 0.000 0.000 0.416
#> GSM1060781 2 0.2959 0.913 0.000 0.864 0.000 0.036 0.100
#> GSM1060782 5 0.0000 1.000 0.000 0.000 0.000 0.000 1.000
#> GSM1060783 2 0.2583 0.940 0.000 0.864 0.000 0.004 0.132
#> GSM1060784 2 0.2773 0.915 0.000 0.836 0.000 0.000 0.164
#> GSM1060785 2 0.2583 0.940 0.000 0.864 0.000 0.004 0.132
#> GSM1060786 5 0.0000 1.000 0.000 0.000 0.000 0.000 1.000
#> GSM1060787 2 0.2648 0.927 0.000 0.848 0.000 0.000 0.152
#> GSM1060788 2 0.2583 0.940 0.000 0.864 0.000 0.004 0.132
#> GSM1060789 2 0.2583 0.940 0.000 0.864 0.000 0.004 0.132
#> GSM1060790 5 0.0000 1.000 0.000 0.000 0.000 0.000 1.000
#> GSM1060754 1 0.1914 0.837 0.924 0.016 0.000 0.060 0.000
#> GSM1060745 1 0.3115 0.825 0.876 0.020 0.056 0.048 0.000
#> GSM1060756 1 0.1597 0.841 0.940 0.012 0.000 0.048 0.000
#> GSM1060746 1 0.0404 0.850 0.988 0.000 0.000 0.012 0.000
#> GSM1060758 4 0.1121 0.950 0.000 0.044 0.000 0.956 0.000
#> GSM1060765 1 0.2735 0.843 0.880 0.084 0.000 0.036 0.000
#> GSM1060732 3 0.0000 0.974 0.000 0.000 1.000 0.000 0.000
#> GSM1060727 3 0.0000 0.974 0.000 0.000 1.000 0.000 0.000
#> GSM1060740 1 0.4855 0.781 0.720 0.112 0.000 0.168 0.000
#> GSM1060730 3 0.0000 0.974 0.000 0.000 1.000 0.000 0.000
#> GSM1060737 1 0.1485 0.838 0.948 0.020 0.000 0.032 0.000
#> GSM1060743 1 0.4577 0.797 0.748 0.108 0.000 0.144 0.000
#> GSM1060734 1 0.1914 0.837 0.924 0.016 0.000 0.060 0.000
#> GSM1060729 3 0.0000 0.974 0.000 0.000 1.000 0.000 0.000
#> GSM1060744 1 0.4819 0.785 0.724 0.112 0.000 0.164 0.000
#> GSM1060742 1 0.5901 0.576 0.540 0.116 0.000 0.344 0.000
#> GSM1060752 1 0.5288 0.720 0.656 0.100 0.000 0.244 0.000
#> GSM1060755 4 0.0865 0.928 0.024 0.004 0.000 0.972 0.000
#> GSM1060761 4 0.1121 0.950 0.000 0.044 0.000 0.956 0.000
#> GSM1060760 4 0.1121 0.950 0.000 0.044 0.000 0.956 0.000
#> GSM1060767 1 0.1484 0.845 0.944 0.008 0.000 0.048 0.000
#> GSM1060741 1 0.5901 0.577 0.540 0.116 0.000 0.344 0.000
#> GSM1060759 4 0.1121 0.950 0.000 0.044 0.000 0.956 0.000
#> GSM1060728 3 0.0000 0.974 0.000 0.000 1.000 0.000 0.000
#> GSM1060763 1 0.1281 0.839 0.956 0.012 0.000 0.032 0.000
#> GSM1060747 1 0.3620 0.842 0.824 0.108 0.000 0.068 0.000
#> GSM1060764 1 0.0404 0.850 0.988 0.000 0.000 0.012 0.000
#> GSM1060733 1 0.1914 0.837 0.924 0.016 0.000 0.060 0.000
#> GSM1060735 1 0.1741 0.846 0.936 0.040 0.000 0.024 0.000
#> GSM1060739 1 0.5182 0.749 0.680 0.112 0.000 0.208 0.000
#> GSM1060753 4 0.1121 0.950 0.000 0.044 0.000 0.956 0.000
#> GSM1060738 1 0.5122 0.756 0.688 0.112 0.000 0.200 0.000
#> GSM1060762 3 0.4695 0.794 0.104 0.040 0.792 0.052 0.012
#> GSM1060731 3 0.0000 0.974 0.000 0.000 1.000 0.000 0.000
#> GSM1060750 4 0.1918 0.921 0.036 0.036 0.000 0.928 0.000
#> GSM1060749 4 0.1043 0.948 0.000 0.040 0.000 0.960 0.000
#> GSM1060736 1 0.1485 0.838 0.948 0.020 0.000 0.032 0.000
#> GSM1060748 4 0.2172 0.890 0.076 0.016 0.000 0.908 0.000
#> GSM1060751 1 0.3130 0.843 0.856 0.096 0.000 0.048 0.000
#> GSM1060766 1 0.3586 0.833 0.828 0.096 0.000 0.076 0.000
#> GSM1060757 4 0.3171 0.769 0.176 0.008 0.000 0.816 0.000
#> GSM1060726 3 0.0000 0.974 0.000 0.000 1.000 0.000 0.000
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> GSM1060768 5 0.0000 0.998 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM1060769 5 0.0000 0.998 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM1060770 5 0.0000 0.998 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM1060771 2 0.1296 0.936 0.000 0.948 0.000 0.004 0.044 0.004
#> GSM1060772 5 0.0000 0.998 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM1060773 2 0.3371 0.797 0.040 0.848 0.000 0.064 0.004 0.044
#> GSM1060774 5 0.0000 0.998 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM1060775 5 0.0000 0.998 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM1060776 5 0.0000 0.998 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM1060777 2 0.1296 0.935 0.000 0.948 0.000 0.004 0.044 0.004
#> GSM1060778 5 0.0146 0.998 0.000 0.000 0.000 0.000 0.996 0.004
#> GSM1060779 5 0.0146 0.998 0.000 0.000 0.000 0.000 0.996 0.004
#> GSM1060780 2 0.3881 0.418 0.000 0.600 0.000 0.000 0.396 0.004
#> GSM1060781 2 0.1268 0.931 0.000 0.952 0.000 0.008 0.036 0.004
#> GSM1060782 5 0.0146 0.998 0.000 0.000 0.000 0.000 0.996 0.004
#> GSM1060783 2 0.1410 0.936 0.000 0.944 0.000 0.004 0.044 0.008
#> GSM1060784 2 0.1528 0.933 0.000 0.936 0.000 0.000 0.048 0.016
#> GSM1060785 2 0.1410 0.935 0.000 0.944 0.000 0.004 0.044 0.008
#> GSM1060786 5 0.0146 0.998 0.000 0.000 0.000 0.000 0.996 0.004
#> GSM1060787 2 0.1434 0.934 0.000 0.940 0.000 0.000 0.048 0.012
#> GSM1060788 2 0.1528 0.933 0.000 0.936 0.000 0.000 0.048 0.016
#> GSM1060789 2 0.1152 0.936 0.000 0.952 0.000 0.004 0.044 0.000
#> GSM1060790 5 0.0146 0.998 0.000 0.000 0.000 0.000 0.996 0.004
#> GSM1060754 1 0.2302 0.802 0.900 0.008 0.000 0.032 0.000 0.060
#> GSM1060745 1 0.5426 0.560 0.632 0.024 0.072 0.012 0.000 0.260
#> GSM1060756 1 0.2420 0.792 0.876 0.008 0.000 0.008 0.000 0.108
#> GSM1060746 1 0.2902 0.751 0.800 0.004 0.000 0.000 0.000 0.196
#> GSM1060758 4 0.0146 0.928 0.000 0.004 0.000 0.996 0.000 0.000
#> GSM1060765 6 0.4069 0.469 0.376 0.008 0.000 0.004 0.000 0.612
#> GSM1060732 3 0.0000 0.946 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1060727 3 0.0000 0.946 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1060740 6 0.1838 0.780 0.068 0.000 0.000 0.016 0.000 0.916
#> GSM1060730 3 0.0000 0.946 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1060737 1 0.2237 0.761 0.896 0.020 0.000 0.004 0.000 0.080
#> GSM1060743 6 0.1913 0.778 0.080 0.000 0.000 0.012 0.000 0.908
#> GSM1060734 1 0.1749 0.797 0.932 0.008 0.000 0.024 0.000 0.036
#> GSM1060729 3 0.0000 0.946 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1060744 6 0.2663 0.766 0.084 0.012 0.000 0.028 0.000 0.876
#> GSM1060742 6 0.3636 0.707 0.064 0.016 0.000 0.108 0.000 0.812
#> GSM1060752 6 0.3649 0.746 0.112 0.004 0.000 0.084 0.000 0.800
#> GSM1060755 4 0.0870 0.923 0.012 0.004 0.000 0.972 0.000 0.012
#> GSM1060761 4 0.0291 0.928 0.000 0.004 0.000 0.992 0.000 0.004
#> GSM1060760 4 0.0291 0.928 0.000 0.004 0.000 0.992 0.000 0.004
#> GSM1060767 1 0.3705 0.687 0.740 0.020 0.000 0.004 0.000 0.236
#> GSM1060741 6 0.3169 0.739 0.052 0.016 0.000 0.084 0.000 0.848
#> GSM1060759 4 0.0146 0.928 0.000 0.004 0.000 0.996 0.000 0.000
#> GSM1060728 3 0.0000 0.946 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1060763 1 0.0937 0.798 0.960 0.000 0.000 0.000 0.000 0.040
#> GSM1060747 6 0.4440 0.395 0.420 0.016 0.000 0.008 0.000 0.556
#> GSM1060764 1 0.3464 0.616 0.688 0.000 0.000 0.000 0.000 0.312
#> GSM1060733 1 0.1599 0.796 0.940 0.008 0.000 0.024 0.000 0.028
#> GSM1060735 1 0.3627 0.604 0.752 0.020 0.000 0.004 0.000 0.224
#> GSM1060739 6 0.1780 0.780 0.048 0.000 0.000 0.028 0.000 0.924
#> GSM1060753 4 0.0146 0.928 0.000 0.004 0.000 0.996 0.000 0.000
#> GSM1060738 6 0.1672 0.780 0.048 0.004 0.000 0.016 0.000 0.932
#> GSM1060762 3 0.7027 0.464 0.236 0.048 0.560 0.080 0.028 0.048
#> GSM1060731 3 0.0000 0.946 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1060750 4 0.1321 0.909 0.024 0.004 0.000 0.952 0.000 0.020
#> GSM1060749 4 0.1265 0.908 0.000 0.008 0.000 0.948 0.000 0.044
#> GSM1060736 1 0.2237 0.761 0.896 0.020 0.000 0.004 0.000 0.080
#> GSM1060748 4 0.3178 0.831 0.092 0.012 0.000 0.844 0.000 0.052
#> GSM1060751 6 0.4356 0.370 0.432 0.016 0.000 0.004 0.000 0.548
#> GSM1060766 6 0.4067 0.588 0.296 0.012 0.000 0.012 0.000 0.680
#> GSM1060757 4 0.4224 0.501 0.336 0.008 0.000 0.640 0.000 0.016
#> GSM1060726 3 0.0000 0.946 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)
Test correlation between subgroups and known annotations. If the known annotation is numeric, one-way ANOVA test is applied, and if the known annotation is discrete, chi-squared contingency table test is applied.
test_to_known_factors(res)
#> n disease.state(p) tissue(p) k
#> CV:skmeans 65 1.48e-08 0.028269 2
#> CV:skmeans 65 7.68e-15 0.000962 3
#> CV:skmeans 65 3.55e-13 0.000374 4
#> CV:skmeans 65 2.57e-13 0.075410 5
#> CV:skmeans 60 1.22e-11 0.008137 6
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 51941 rows and 65 columns.
#> Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'CV' method.
#> Subgroups are detected by 'pam' method.
#> Performed in total 1250 partitions by row resampling.
#> Best k for subgroups seems to be 5.
#>
#> Following methods can be applied to this 'ConsensusPartition' object:
#> [1] "cola_report" "collect_classes" "collect_plots"
#> [4] "collect_stats" "colnames" "compare_signatures"
#> [7] "consensus_heatmap" "dimension_reduction" "functional_enrichment"
#> [10] "get_anno_col" "get_anno" "get_classes"
#> [13] "get_consensus" "get_matrix" "get_membership"
#> [16] "get_param" "get_signatures" "get_stats"
#> [19] "is_best_k" "is_stable_k" "membership_heatmap"
#> [22] "ncol" "nrow" "plot_ecdf"
#> [25] "rownames" "select_partition_number" "show"
#> [28] "suggest_best_k" "test_to_known_factors"
collect_plots()
function collects all the plots made from res
for all k
(number of partitions)
into one single page to provide an easy and fast comparison between different k
.
collect_plots(res)
The plots are:
k
and the heatmap of
predicted classes for each k
.k
.k
.k
.All the plots in panels can be made by individual functions and they are plotted later in this section.
select_partition_number()
produces several plots showing different
statistics for choosing “optimized” k
. There are following statistics:
k
;k
, the area increased is defined as \(A_k - A_{k-1}\).The detailed explanations of these statistics can be found in the cola vignette.
Generally speaking, lower PAC score, higher mean silhouette score or higher
concordance corresponds to better partition. Rand index and Jaccard index
measure how similar the current partition is compared to partition with k-1
.
If they are too similar, we won't accept k
is better than k-1
.
select_partition_number(res)
The numeric values for all these statistics can be obtained by get_stats()
.
get_stats(res)
#> k 1-PAC mean_silhouette concordance area_increased Rand Jaccard
#> 2 2 1.000 0.977 0.978 0.2093 0.805 0.805
#> 3 3 0.972 0.908 0.965 1.7400 0.619 0.527
#> 4 4 0.810 0.781 0.897 0.2377 0.868 0.688
#> 5 5 0.944 0.915 0.964 0.0920 0.918 0.728
#> 6 6 0.838 0.816 0.880 0.0425 0.987 0.941
suggest_best_k()
suggests the best \(k\) based on these statistics. The rules are as follows:
suggest_best_k(res)
#> [1] 5
#> attr(,"optional")
#> [1] 2 3
There is also optional best \(k\) = 2 3 that is worth to check.
Following shows the table of the partitions (You need to click the show/hide
code output link to see it). The membership matrix (columns with name p*
)
is inferred by
clue::cl_consensus()
function with the SE
method. Basically the value in the membership matrix
represents the probability to belong to a certain group. The finall class
label for an item is determined with the group with highest probability it
belongs to.
In get_classes()
function, the entropy is calculated from the membership
matrix and the silhouette score is calculated from the consensus matrix.
cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#> class entropy silhouette p1 p2
#> GSM1060768 1 0.2778 0.970 0.952 0.048
#> GSM1060769 1 0.2778 0.970 0.952 0.048
#> GSM1060770 1 0.2778 0.970 0.952 0.048
#> GSM1060771 1 0.2778 0.970 0.952 0.048
#> GSM1060772 1 0.2778 0.970 0.952 0.048
#> GSM1060773 1 0.2603 0.971 0.956 0.044
#> GSM1060774 1 0.2778 0.970 0.952 0.048
#> GSM1060775 1 0.2778 0.970 0.952 0.048
#> GSM1060776 1 0.2778 0.970 0.952 0.048
#> GSM1060777 1 0.2778 0.970 0.952 0.048
#> GSM1060778 1 0.2778 0.970 0.952 0.048
#> GSM1060779 1 0.2778 0.970 0.952 0.048
#> GSM1060780 1 0.2778 0.970 0.952 0.048
#> GSM1060781 1 0.2603 0.971 0.956 0.044
#> GSM1060782 1 0.2778 0.970 0.952 0.048
#> GSM1060783 1 0.2778 0.970 0.952 0.048
#> GSM1060784 1 0.2778 0.970 0.952 0.048
#> GSM1060785 1 0.2778 0.970 0.952 0.048
#> GSM1060786 1 0.2778 0.970 0.952 0.048
#> GSM1060787 1 0.2778 0.970 0.952 0.048
#> GSM1060788 1 0.2603 0.971 0.956 0.044
#> GSM1060789 1 0.2778 0.970 0.952 0.048
#> GSM1060790 1 0.2778 0.970 0.952 0.048
#> GSM1060754 1 0.0000 0.980 1.000 0.000
#> GSM1060745 1 0.0000 0.980 1.000 0.000
#> GSM1060756 1 0.0000 0.980 1.000 0.000
#> GSM1060746 1 0.0000 0.980 1.000 0.000
#> GSM1060758 1 0.2423 0.972 0.960 0.040
#> GSM1060765 1 0.0000 0.980 1.000 0.000
#> GSM1060732 2 0.0672 0.963 0.008 0.992
#> GSM1060727 2 0.2603 0.993 0.044 0.956
#> GSM1060740 1 0.0000 0.980 1.000 0.000
#> GSM1060730 2 0.2603 0.993 0.044 0.956
#> GSM1060737 1 0.0000 0.980 1.000 0.000
#> GSM1060743 1 0.0000 0.980 1.000 0.000
#> GSM1060734 1 0.0000 0.980 1.000 0.000
#> GSM1060729 2 0.2603 0.993 0.044 0.956
#> GSM1060744 1 0.0000 0.980 1.000 0.000
#> GSM1060742 1 0.0000 0.980 1.000 0.000
#> GSM1060752 1 0.0000 0.980 1.000 0.000
#> GSM1060755 1 0.0000 0.980 1.000 0.000
#> GSM1060761 1 0.0000 0.980 1.000 0.000
#> GSM1060760 1 0.0000 0.980 1.000 0.000
#> GSM1060767 1 0.0000 0.980 1.000 0.000
#> GSM1060741 1 0.0000 0.980 1.000 0.000
#> GSM1060759 1 0.0000 0.980 1.000 0.000
#> GSM1060728 2 0.2778 0.988 0.048 0.952
#> GSM1060763 1 0.0000 0.980 1.000 0.000
#> GSM1060747 1 0.0000 0.980 1.000 0.000
#> GSM1060764 1 0.0000 0.980 1.000 0.000
#> GSM1060733 1 0.0000 0.980 1.000 0.000
#> GSM1060735 1 0.0000 0.980 1.000 0.000
#> GSM1060739 1 0.0000 0.980 1.000 0.000
#> GSM1060753 1 0.0000 0.980 1.000 0.000
#> GSM1060738 1 0.0000 0.980 1.000 0.000
#> GSM1060762 1 0.0000 0.980 1.000 0.000
#> GSM1060731 2 0.2603 0.993 0.044 0.956
#> GSM1060750 1 0.0000 0.980 1.000 0.000
#> GSM1060749 1 0.0000 0.980 1.000 0.000
#> GSM1060736 1 0.0000 0.980 1.000 0.000
#> GSM1060748 1 0.0000 0.980 1.000 0.000
#> GSM1060751 1 0.0000 0.980 1.000 0.000
#> GSM1060766 1 0.0000 0.980 1.000 0.000
#> GSM1060757 1 0.0000 0.980 1.000 0.000
#> GSM1060726 2 0.2603 0.993 0.044 0.956
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> GSM1060768 2 0.0000 0.9336 0.000 1.000 0.000
#> GSM1060769 2 0.0000 0.9336 0.000 1.000 0.000
#> GSM1060770 2 0.0000 0.9336 0.000 1.000 0.000
#> GSM1060771 2 0.0892 0.9216 0.020 0.980 0.000
#> GSM1060772 2 0.0000 0.9336 0.000 1.000 0.000
#> GSM1060773 2 0.6235 0.2005 0.436 0.564 0.000
#> GSM1060774 2 0.0000 0.9336 0.000 1.000 0.000
#> GSM1060775 2 0.0000 0.9336 0.000 1.000 0.000
#> GSM1060776 2 0.0000 0.9336 0.000 1.000 0.000
#> GSM1060777 2 0.0892 0.9216 0.020 0.980 0.000
#> GSM1060778 2 0.0000 0.9336 0.000 1.000 0.000
#> GSM1060779 2 0.0000 0.9336 0.000 1.000 0.000
#> GSM1060780 2 0.0000 0.9336 0.000 1.000 0.000
#> GSM1060781 1 0.6308 0.0102 0.508 0.492 0.000
#> GSM1060782 2 0.0000 0.9336 0.000 1.000 0.000
#> GSM1060783 2 0.1031 0.9183 0.024 0.976 0.000
#> GSM1060784 2 0.0000 0.9336 0.000 1.000 0.000
#> GSM1060785 2 0.1529 0.9006 0.040 0.960 0.000
#> GSM1060786 2 0.0000 0.9336 0.000 1.000 0.000
#> GSM1060787 2 0.0000 0.9336 0.000 1.000 0.000
#> GSM1060788 2 0.6168 0.2758 0.412 0.588 0.000
#> GSM1060789 2 0.1031 0.9183 0.024 0.976 0.000
#> GSM1060790 2 0.0000 0.9336 0.000 1.000 0.000
#> GSM1060754 1 0.0000 0.9581 1.000 0.000 0.000
#> GSM1060745 1 0.0000 0.9581 1.000 0.000 0.000
#> GSM1060756 1 0.0000 0.9581 1.000 0.000 0.000
#> GSM1060746 1 0.0000 0.9581 1.000 0.000 0.000
#> GSM1060758 1 0.4887 0.7120 0.772 0.228 0.000
#> GSM1060765 1 0.0000 0.9581 1.000 0.000 0.000
#> GSM1060732 3 0.0000 0.9991 0.000 0.000 1.000
#> GSM1060727 3 0.0000 0.9991 0.000 0.000 1.000
#> GSM1060740 1 0.0000 0.9581 1.000 0.000 0.000
#> GSM1060730 3 0.0000 0.9991 0.000 0.000 1.000
#> GSM1060737 1 0.0000 0.9581 1.000 0.000 0.000
#> GSM1060743 1 0.0000 0.9581 1.000 0.000 0.000
#> GSM1060734 1 0.0000 0.9581 1.000 0.000 0.000
#> GSM1060729 3 0.0000 0.9991 0.000 0.000 1.000
#> GSM1060744 1 0.0000 0.9581 1.000 0.000 0.000
#> GSM1060742 1 0.0000 0.9581 1.000 0.000 0.000
#> GSM1060752 1 0.1411 0.9412 0.964 0.036 0.000
#> GSM1060755 1 0.1163 0.9454 0.972 0.028 0.000
#> GSM1060761 1 0.1860 0.9313 0.948 0.052 0.000
#> GSM1060760 1 0.1643 0.9364 0.956 0.044 0.000
#> GSM1060767 1 0.0000 0.9581 1.000 0.000 0.000
#> GSM1060741 1 0.0000 0.9581 1.000 0.000 0.000
#> GSM1060759 1 0.2261 0.9188 0.932 0.068 0.000
#> GSM1060728 3 0.0237 0.9949 0.004 0.000 0.996
#> GSM1060763 1 0.0000 0.9581 1.000 0.000 0.000
#> GSM1060747 1 0.0000 0.9581 1.000 0.000 0.000
#> GSM1060764 1 0.0000 0.9581 1.000 0.000 0.000
#> GSM1060733 1 0.0000 0.9581 1.000 0.000 0.000
#> GSM1060735 1 0.0000 0.9581 1.000 0.000 0.000
#> GSM1060739 1 0.0000 0.9581 1.000 0.000 0.000
#> GSM1060753 1 0.1529 0.9389 0.960 0.040 0.000
#> GSM1060738 1 0.0000 0.9581 1.000 0.000 0.000
#> GSM1060762 1 0.3267 0.8654 0.884 0.116 0.000
#> GSM1060731 3 0.0000 0.9991 0.000 0.000 1.000
#> GSM1060750 1 0.2261 0.9188 0.932 0.068 0.000
#> GSM1060749 1 0.1964 0.9284 0.944 0.056 0.000
#> GSM1060736 1 0.0000 0.9581 1.000 0.000 0.000
#> GSM1060748 1 0.2261 0.9188 0.932 0.068 0.000
#> GSM1060751 1 0.0000 0.9581 1.000 0.000 0.000
#> GSM1060766 1 0.0000 0.9581 1.000 0.000 0.000
#> GSM1060757 1 0.0000 0.9581 1.000 0.000 0.000
#> GSM1060726 3 0.0000 0.9991 0.000 0.000 1.000
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> GSM1060768 2 0.0000 0.758 0.000 1.000 0 0.000
#> GSM1060769 2 0.0000 0.758 0.000 1.000 0 0.000
#> GSM1060770 2 0.0000 0.758 0.000 1.000 0 0.000
#> GSM1060771 2 0.4941 0.568 0.000 0.564 0 0.436
#> GSM1060772 2 0.0000 0.758 0.000 1.000 0 0.000
#> GSM1060773 2 0.4941 0.568 0.000 0.564 0 0.436
#> GSM1060774 2 0.0000 0.758 0.000 1.000 0 0.000
#> GSM1060775 2 0.0000 0.758 0.000 1.000 0 0.000
#> GSM1060776 2 0.0000 0.758 0.000 1.000 0 0.000
#> GSM1060777 2 0.4941 0.568 0.000 0.564 0 0.436
#> GSM1060778 2 0.0000 0.758 0.000 1.000 0 0.000
#> GSM1060779 2 0.0000 0.758 0.000 1.000 0 0.000
#> GSM1060780 2 0.4008 0.665 0.000 0.756 0 0.244
#> GSM1060781 4 0.4967 -0.383 0.000 0.452 0 0.548
#> GSM1060782 2 0.0000 0.758 0.000 1.000 0 0.000
#> GSM1060783 2 0.4941 0.568 0.000 0.564 0 0.436
#> GSM1060784 2 0.4941 0.568 0.000 0.564 0 0.436
#> GSM1060785 2 0.4941 0.568 0.000 0.564 0 0.436
#> GSM1060786 2 0.0000 0.758 0.000 1.000 0 0.000
#> GSM1060787 2 0.4941 0.568 0.000 0.564 0 0.436
#> GSM1060788 2 0.4941 0.568 0.000 0.564 0 0.436
#> GSM1060789 2 0.4941 0.568 0.000 0.564 0 0.436
#> GSM1060790 2 0.0000 0.758 0.000 1.000 0 0.000
#> GSM1060754 1 0.3528 0.741 0.808 0.000 0 0.192
#> GSM1060745 1 0.0000 0.949 1.000 0.000 0 0.000
#> GSM1060756 1 0.0000 0.949 1.000 0.000 0 0.000
#> GSM1060746 1 0.0000 0.949 1.000 0.000 0 0.000
#> GSM1060758 4 0.0000 0.773 0.000 0.000 0 1.000
#> GSM1060765 1 0.0000 0.949 1.000 0.000 0 0.000
#> GSM1060732 3 0.0000 1.000 0.000 0.000 1 0.000
#> GSM1060727 3 0.0000 1.000 0.000 0.000 1 0.000
#> GSM1060740 1 0.0000 0.949 1.000 0.000 0 0.000
#> GSM1060730 3 0.0000 1.000 0.000 0.000 1 0.000
#> GSM1060737 1 0.0000 0.949 1.000 0.000 0 0.000
#> GSM1060743 1 0.0000 0.949 1.000 0.000 0 0.000
#> GSM1060734 1 0.0000 0.949 1.000 0.000 0 0.000
#> GSM1060729 3 0.0000 1.000 0.000 0.000 1 0.000
#> GSM1060744 1 0.0000 0.949 1.000 0.000 0 0.000
#> GSM1060742 1 0.0336 0.944 0.992 0.000 0 0.008
#> GSM1060752 1 0.3528 0.722 0.808 0.000 0 0.192
#> GSM1060755 4 0.4356 0.535 0.292 0.000 0 0.708
#> GSM1060761 4 0.0000 0.773 0.000 0.000 0 1.000
#> GSM1060760 4 0.0000 0.773 0.000 0.000 0 1.000
#> GSM1060767 1 0.0000 0.949 1.000 0.000 0 0.000
#> GSM1060741 1 0.0707 0.939 0.980 0.000 0 0.020
#> GSM1060759 4 0.0000 0.773 0.000 0.000 0 1.000
#> GSM1060728 3 0.0000 1.000 0.000 0.000 1 0.000
#> GSM1060763 1 0.0000 0.949 1.000 0.000 0 0.000
#> GSM1060747 1 0.4356 0.560 0.708 0.000 0 0.292
#> GSM1060764 1 0.0000 0.949 1.000 0.000 0 0.000
#> GSM1060733 1 0.0000 0.949 1.000 0.000 0 0.000
#> GSM1060735 1 0.0000 0.949 1.000 0.000 0 0.000
#> GSM1060739 1 0.0469 0.942 0.988 0.000 0 0.012
#> GSM1060753 4 0.3907 0.619 0.232 0.000 0 0.768
#> GSM1060738 1 0.1867 0.889 0.928 0.000 0 0.072
#> GSM1060762 1 0.4059 0.695 0.788 0.012 0 0.200
#> GSM1060731 3 0.0000 1.000 0.000 0.000 1 0.000
#> GSM1060750 4 0.0000 0.773 0.000 0.000 0 1.000
#> GSM1060749 4 0.0592 0.772 0.016 0.000 0 0.984
#> GSM1060736 1 0.0000 0.949 1.000 0.000 0 0.000
#> GSM1060748 4 0.1022 0.766 0.032 0.000 0 0.968
#> GSM1060751 1 0.0000 0.949 1.000 0.000 0 0.000
#> GSM1060766 1 0.1118 0.923 0.964 0.000 0 0.036
#> GSM1060757 4 0.4941 0.166 0.436 0.000 0 0.564
#> GSM1060726 3 0.0000 1.000 0.000 0.000 1 0.000
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> GSM1060768 5 0.0000 0.976 0.000 0.000 0 0.000 1.000
#> GSM1060769 5 0.0000 0.976 0.000 0.000 0 0.000 1.000
#> GSM1060770 5 0.0000 0.976 0.000 0.000 0 0.000 1.000
#> GSM1060771 2 0.0000 0.999 0.000 1.000 0 0.000 0.000
#> GSM1060772 5 0.0000 0.976 0.000 0.000 0 0.000 1.000
#> GSM1060773 2 0.0162 0.995 0.000 0.996 0 0.004 0.000
#> GSM1060774 5 0.0000 0.976 0.000 0.000 0 0.000 1.000
#> GSM1060775 5 0.0000 0.976 0.000 0.000 0 0.000 1.000
#> GSM1060776 5 0.0000 0.976 0.000 0.000 0 0.000 1.000
#> GSM1060777 2 0.0000 0.999 0.000 1.000 0 0.000 0.000
#> GSM1060778 5 0.0000 0.976 0.000 0.000 0 0.000 1.000
#> GSM1060779 5 0.0000 0.976 0.000 0.000 0 0.000 1.000
#> GSM1060780 5 0.3534 0.650 0.000 0.256 0 0.000 0.744
#> GSM1060781 2 0.0000 0.999 0.000 1.000 0 0.000 0.000
#> GSM1060782 5 0.0000 0.976 0.000 0.000 0 0.000 1.000
#> GSM1060783 2 0.0000 0.999 0.000 1.000 0 0.000 0.000
#> GSM1060784 2 0.0000 0.999 0.000 1.000 0 0.000 0.000
#> GSM1060785 2 0.0000 0.999 0.000 1.000 0 0.000 0.000
#> GSM1060786 5 0.0000 0.976 0.000 0.000 0 0.000 1.000
#> GSM1060787 2 0.0000 0.999 0.000 1.000 0 0.000 0.000
#> GSM1060788 2 0.0000 0.999 0.000 1.000 0 0.000 0.000
#> GSM1060789 2 0.0000 0.999 0.000 1.000 0 0.000 0.000
#> GSM1060790 5 0.0000 0.976 0.000 0.000 0 0.000 1.000
#> GSM1060754 1 0.4273 0.185 0.552 0.000 0 0.448 0.000
#> GSM1060745 1 0.0000 0.942 1.000 0.000 0 0.000 0.000
#> GSM1060756 1 0.0000 0.942 1.000 0.000 0 0.000 0.000
#> GSM1060746 1 0.0000 0.942 1.000 0.000 0 0.000 0.000
#> GSM1060758 4 0.0162 0.901 0.000 0.004 0 0.996 0.000
#> GSM1060765 1 0.0000 0.942 1.000 0.000 0 0.000 0.000
#> GSM1060732 3 0.0000 1.000 0.000 0.000 1 0.000 0.000
#> GSM1060727 3 0.0000 1.000 0.000 0.000 1 0.000 0.000
#> GSM1060740 1 0.0000 0.942 1.000 0.000 0 0.000 0.000
#> GSM1060730 3 0.0000 1.000 0.000 0.000 1 0.000 0.000
#> GSM1060737 1 0.0162 0.941 0.996 0.000 0 0.004 0.000
#> GSM1060743 1 0.0404 0.938 0.988 0.000 0 0.012 0.000
#> GSM1060734 1 0.0000 0.942 1.000 0.000 0 0.000 0.000
#> GSM1060729 3 0.0000 1.000 0.000 0.000 1 0.000 0.000
#> GSM1060744 1 0.0000 0.942 1.000 0.000 0 0.000 0.000
#> GSM1060742 1 0.2074 0.873 0.896 0.000 0 0.104 0.000
#> GSM1060752 1 0.3160 0.775 0.808 0.188 0 0.004 0.000
#> GSM1060755 4 0.0404 0.898 0.012 0.000 0 0.988 0.000
#> GSM1060761 4 0.3143 0.703 0.000 0.204 0 0.796 0.000
#> GSM1060760 4 0.1197 0.874 0.000 0.048 0 0.952 0.000
#> GSM1060767 1 0.0000 0.942 1.000 0.000 0 0.000 0.000
#> GSM1060741 1 0.1792 0.890 0.916 0.000 0 0.084 0.000
#> GSM1060759 4 0.0162 0.901 0.000 0.004 0 0.996 0.000
#> GSM1060728 3 0.0000 1.000 0.000 0.000 1 0.000 0.000
#> GSM1060763 1 0.0000 0.942 1.000 0.000 0 0.000 0.000
#> GSM1060747 4 0.4256 0.142 0.436 0.000 0 0.564 0.000
#> GSM1060764 1 0.0000 0.942 1.000 0.000 0 0.000 0.000
#> GSM1060733 1 0.0510 0.936 0.984 0.000 0 0.016 0.000
#> GSM1060735 1 0.0162 0.941 0.996 0.000 0 0.004 0.000
#> GSM1060739 1 0.0290 0.940 0.992 0.000 0 0.008 0.000
#> GSM1060753 4 0.0162 0.901 0.000 0.004 0 0.996 0.000
#> GSM1060738 1 0.0880 0.925 0.968 0.032 0 0.000 0.000
#> GSM1060762 1 0.4086 0.683 0.736 0.240 0 0.024 0.000
#> GSM1060731 3 0.0000 1.000 0.000 0.000 1 0.000 0.000
#> GSM1060750 4 0.0162 0.901 0.000 0.004 0 0.996 0.000
#> GSM1060749 4 0.0290 0.901 0.000 0.008 0 0.992 0.000
#> GSM1060736 1 0.0162 0.941 0.996 0.000 0 0.004 0.000
#> GSM1060748 4 0.0798 0.896 0.008 0.016 0 0.976 0.000
#> GSM1060751 1 0.2074 0.874 0.896 0.000 0 0.104 0.000
#> GSM1060766 1 0.0290 0.939 0.992 0.008 0 0.000 0.000
#> GSM1060757 4 0.0963 0.882 0.036 0.000 0 0.964 0.000
#> GSM1060726 3 0.0000 1.000 0.000 0.000 1 0.000 0.000
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> GSM1060768 5 0.0000 0.976 0.000 0.000 0 0.000 1.000 0.000
#> GSM1060769 5 0.0000 0.976 0.000 0.000 0 0.000 1.000 0.000
#> GSM1060770 5 0.0000 0.976 0.000 0.000 0 0.000 1.000 0.000
#> GSM1060771 2 0.0000 0.974 0.000 1.000 0 0.000 0.000 0.000
#> GSM1060772 5 0.0000 0.976 0.000 0.000 0 0.000 1.000 0.000
#> GSM1060773 2 0.3201 0.717 0.000 0.780 0 0.012 0.000 0.208
#> GSM1060774 5 0.0000 0.976 0.000 0.000 0 0.000 1.000 0.000
#> GSM1060775 5 0.0000 0.976 0.000 0.000 0 0.000 1.000 0.000
#> GSM1060776 5 0.0000 0.976 0.000 0.000 0 0.000 1.000 0.000
#> GSM1060777 2 0.0000 0.974 0.000 1.000 0 0.000 0.000 0.000
#> GSM1060778 5 0.0000 0.976 0.000 0.000 0 0.000 1.000 0.000
#> GSM1060779 5 0.0000 0.976 0.000 0.000 0 0.000 1.000 0.000
#> GSM1060780 5 0.3175 0.651 0.000 0.256 0 0.000 0.744 0.000
#> GSM1060781 2 0.0000 0.974 0.000 1.000 0 0.000 0.000 0.000
#> GSM1060782 5 0.0000 0.976 0.000 0.000 0 0.000 1.000 0.000
#> GSM1060783 2 0.0000 0.974 0.000 1.000 0 0.000 0.000 0.000
#> GSM1060784 2 0.0000 0.974 0.000 1.000 0 0.000 0.000 0.000
#> GSM1060785 2 0.0000 0.974 0.000 1.000 0 0.000 0.000 0.000
#> GSM1060786 5 0.0000 0.976 0.000 0.000 0 0.000 1.000 0.000
#> GSM1060787 2 0.0000 0.974 0.000 1.000 0 0.000 0.000 0.000
#> GSM1060788 2 0.0000 0.974 0.000 1.000 0 0.000 0.000 0.000
#> GSM1060789 2 0.0000 0.974 0.000 1.000 0 0.000 0.000 0.000
#> GSM1060790 5 0.0000 0.976 0.000 0.000 0 0.000 1.000 0.000
#> GSM1060754 1 0.3482 0.514 0.684 0.000 0 0.000 0.000 0.316
#> GSM1060745 1 0.0000 0.826 1.000 0.000 0 0.000 0.000 0.000
#> GSM1060756 1 0.0000 0.826 1.000 0.000 0 0.000 0.000 0.000
#> GSM1060746 1 0.0000 0.826 1.000 0.000 0 0.000 0.000 0.000
#> GSM1060758 4 0.3867 0.867 0.000 0.000 0 0.512 0.000 0.488
#> GSM1060765 1 0.0000 0.826 1.000 0.000 0 0.000 0.000 0.000
#> GSM1060732 3 0.0000 1.000 0.000 0.000 1 0.000 0.000 0.000
#> GSM1060727 3 0.0000 1.000 0.000 0.000 1 0.000 0.000 0.000
#> GSM1060740 1 0.3464 0.702 0.688 0.000 0 0.312 0.000 0.000
#> GSM1060730 3 0.0000 1.000 0.000 0.000 1 0.000 0.000 0.000
#> GSM1060737 1 0.4067 0.692 0.752 0.000 0 0.144 0.000 0.104
#> GSM1060743 1 0.2994 0.766 0.788 0.000 0 0.208 0.000 0.004
#> GSM1060734 1 0.0260 0.825 0.992 0.000 0 0.008 0.000 0.000
#> GSM1060729 3 0.0000 1.000 0.000 0.000 1 0.000 0.000 0.000
#> GSM1060744 1 0.1910 0.806 0.892 0.000 0 0.108 0.000 0.000
#> GSM1060742 1 0.4101 0.690 0.664 0.000 0 0.308 0.000 0.028
#> GSM1060752 1 0.3071 0.742 0.804 0.180 0 0.016 0.000 0.000
#> GSM1060755 6 0.2451 0.593 0.056 0.000 0 0.060 0.000 0.884
#> GSM1060761 4 0.4919 0.819 0.000 0.068 0 0.544 0.000 0.388
#> GSM1060760 4 0.4157 0.907 0.000 0.012 0 0.544 0.000 0.444
#> GSM1060767 1 0.0000 0.826 1.000 0.000 0 0.000 0.000 0.000
#> GSM1060741 1 0.3888 0.694 0.672 0.000 0 0.312 0.000 0.016
#> GSM1060759 4 0.3847 0.903 0.000 0.000 0 0.544 0.000 0.456
#> GSM1060728 3 0.0000 1.000 0.000 0.000 1 0.000 0.000 0.000
#> GSM1060763 1 0.0790 0.822 0.968 0.000 0 0.032 0.000 0.000
#> GSM1060747 6 0.5579 0.299 0.192 0.000 0 0.264 0.000 0.544
#> GSM1060764 1 0.0000 0.826 1.000 0.000 0 0.000 0.000 0.000
#> GSM1060733 1 0.2092 0.787 0.876 0.000 0 0.124 0.000 0.000
#> GSM1060735 1 0.2250 0.792 0.888 0.000 0 0.092 0.000 0.020
#> GSM1060739 1 0.3464 0.702 0.688 0.000 0 0.312 0.000 0.000
#> GSM1060753 6 0.3515 -0.436 0.000 0.000 0 0.324 0.000 0.676
#> GSM1060738 1 0.4252 0.684 0.652 0.036 0 0.312 0.000 0.000
#> GSM1060762 1 0.3394 0.675 0.752 0.236 0 0.000 0.000 0.012
#> GSM1060731 3 0.0000 1.000 0.000 0.000 1 0.000 0.000 0.000
#> GSM1060750 6 0.0146 0.599 0.000 0.000 0 0.004 0.000 0.996
#> GSM1060749 6 0.1444 0.514 0.000 0.000 0 0.072 0.000 0.928
#> GSM1060736 1 0.4949 0.540 0.648 0.000 0 0.144 0.000 0.208
#> GSM1060748 6 0.2375 0.603 0.036 0.008 0 0.060 0.000 0.896
#> GSM1060751 1 0.3454 0.685 0.768 0.000 0 0.024 0.000 0.208
#> GSM1060766 1 0.1075 0.819 0.952 0.048 0 0.000 0.000 0.000
#> GSM1060757 6 0.1643 0.624 0.068 0.000 0 0.008 0.000 0.924
#> GSM1060726 3 0.0000 1.000 0.000 0.000 1 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)
Test correlation between subgroups and known annotations. If the known annotation is numeric, one-way ANOVA test is applied, and if the known annotation is discrete, chi-squared contingency table test is applied.
test_to_known_factors(res)
#> n disease.state(p) tissue(p) k
#> CV:pam 65 9.81e-02 0.012934 2
#> CV:pam 62 3.44e-14 0.002991 3
#> CV:pam 63 1.34e-13 0.000122 4
#> CV:pam 63 6.79e-13 0.058305 5
#> CV:pam 63 2.91e-12 0.007418 6
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 51941 rows and 65 columns.
#> Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'CV' method.
#> Subgroups are detected by 'mclust' method.
#> Performed in total 1250 partitions by row resampling.
#> Best k for subgroups seems to be 3.
#>
#> Following methods can be applied to this 'ConsensusPartition' object:
#> [1] "cola_report" "collect_classes" "collect_plots"
#> [4] "collect_stats" "colnames" "compare_signatures"
#> [7] "consensus_heatmap" "dimension_reduction" "functional_enrichment"
#> [10] "get_anno_col" "get_anno" "get_classes"
#> [13] "get_consensus" "get_matrix" "get_membership"
#> [16] "get_param" "get_signatures" "get_stats"
#> [19] "is_best_k" "is_stable_k" "membership_heatmap"
#> [22] "ncol" "nrow" "plot_ecdf"
#> [25] "rownames" "select_partition_number" "show"
#> [28] "suggest_best_k" "test_to_known_factors"
collect_plots()
function collects all the plots made from res
for all k
(number of partitions)
into one single page to provide an easy and fast comparison between different k
.
collect_plots(res)
The plots are:
k
and the heatmap of
predicted classes for each k
.k
.k
.k
.All the plots in panels can be made by individual functions and they are plotted later in this section.
select_partition_number()
produces several plots showing different
statistics for choosing “optimized” k
. There are following statistics:
k
;k
, the area increased is defined as \(A_k - A_{k-1}\).The detailed explanations of these statistics can be found in the cola vignette.
Generally speaking, lower PAC score, higher mean silhouette score or higher
concordance corresponds to better partition. Rand index and Jaccard index
measure how similar the current partition is compared to partition with k-1
.
If they are too similar, we won't accept k
is better than k-1
.
select_partition_number(res)
The numeric values for all these statistics can be obtained by get_stats()
.
get_stats(res)
#> k 1-PAC mean_silhouette concordance area_increased Rand Jaccard
#> 2 2 0.694 0.958 0.948 0.4486 0.536 0.536
#> 3 3 1.000 0.945 0.979 0.2973 0.882 0.780
#> 4 4 0.782 0.755 0.848 0.1861 0.880 0.712
#> 5 5 0.695 0.796 0.829 0.0670 0.827 0.554
#> 6 6 0.783 0.754 0.848 0.0745 0.900 0.672
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
#> GSM1060768 2 0.2948 0.968 0.052 0.948
#> GSM1060769 2 0.2948 0.968 0.052 0.948
#> GSM1060770 2 0.2948 0.968 0.052 0.948
#> GSM1060771 2 0.4815 0.965 0.104 0.896
#> GSM1060772 2 0.3114 0.969 0.056 0.944
#> GSM1060773 2 0.6148 0.916 0.152 0.848
#> GSM1060774 2 0.2948 0.968 0.052 0.948
#> GSM1060775 2 0.2948 0.968 0.052 0.948
#> GSM1060776 2 0.3114 0.969 0.056 0.944
#> GSM1060777 2 0.4815 0.965 0.104 0.896
#> GSM1060778 2 0.2948 0.968 0.052 0.948
#> GSM1060779 2 0.2948 0.968 0.052 0.948
#> GSM1060780 2 0.4815 0.965 0.104 0.896
#> GSM1060781 2 0.4815 0.965 0.104 0.896
#> GSM1060782 2 0.2948 0.968 0.052 0.948
#> GSM1060783 2 0.4815 0.965 0.104 0.896
#> GSM1060784 2 0.4815 0.965 0.104 0.896
#> GSM1060785 2 0.4815 0.965 0.104 0.896
#> GSM1060786 2 0.2948 0.968 0.052 0.948
#> GSM1060787 2 0.4815 0.965 0.104 0.896
#> GSM1060788 2 0.4815 0.965 0.104 0.896
#> GSM1060789 2 0.4815 0.965 0.104 0.896
#> GSM1060790 2 0.2948 0.968 0.052 0.948
#> GSM1060754 1 0.1414 0.968 0.980 0.020
#> GSM1060745 1 0.0672 0.967 0.992 0.008
#> GSM1060756 1 0.1184 0.969 0.984 0.016
#> GSM1060746 1 0.1184 0.969 0.984 0.016
#> GSM1060758 1 0.1633 0.967 0.976 0.024
#> GSM1060765 1 0.2603 0.957 0.956 0.044
#> GSM1060732 1 0.5059 0.895 0.888 0.112
#> GSM1060727 1 0.5059 0.895 0.888 0.112
#> GSM1060740 1 0.1184 0.969 0.984 0.016
#> GSM1060730 1 0.5059 0.895 0.888 0.112
#> GSM1060737 1 0.2236 0.957 0.964 0.036
#> GSM1060743 1 0.1414 0.968 0.980 0.020
#> GSM1060734 1 0.1184 0.969 0.984 0.016
#> GSM1060729 1 0.5059 0.895 0.888 0.112
#> GSM1060744 1 0.0938 0.968 0.988 0.012
#> GSM1060742 1 0.0938 0.968 0.988 0.012
#> GSM1060752 1 0.1414 0.968 0.980 0.020
#> GSM1060755 1 0.1633 0.968 0.976 0.024
#> GSM1060761 1 0.1633 0.967 0.976 0.024
#> GSM1060760 1 0.1633 0.967 0.976 0.024
#> GSM1060767 1 0.0938 0.968 0.988 0.012
#> GSM1060741 1 0.0938 0.968 0.988 0.012
#> GSM1060759 1 0.1633 0.967 0.976 0.024
#> GSM1060728 1 0.3733 0.923 0.928 0.072
#> GSM1060763 1 0.0376 0.962 0.996 0.004
#> GSM1060747 1 0.2043 0.961 0.968 0.032
#> GSM1060764 1 0.1184 0.969 0.984 0.016
#> GSM1060733 1 0.1184 0.969 0.984 0.016
#> GSM1060735 1 0.2236 0.959 0.964 0.036
#> GSM1060739 1 0.1414 0.968 0.980 0.020
#> GSM1060753 1 0.1633 0.967 0.976 0.024
#> GSM1060738 1 0.1414 0.968 0.980 0.020
#> GSM1060762 1 0.1843 0.967 0.972 0.028
#> GSM1060731 1 0.5059 0.895 0.888 0.112
#> GSM1060750 1 0.3114 0.949 0.944 0.056
#> GSM1060749 1 0.1633 0.967 0.976 0.024
#> GSM1060736 1 0.2236 0.957 0.964 0.036
#> GSM1060748 1 0.2043 0.959 0.968 0.032
#> GSM1060751 1 0.1633 0.961 0.976 0.024
#> GSM1060766 1 0.2603 0.957 0.956 0.044
#> GSM1060757 1 0.1414 0.968 0.980 0.020
#> GSM1060726 1 0.5059 0.895 0.888 0.112
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> GSM1060768 2 0.0000 0.980 0.000 1.000 0.000
#> GSM1060769 2 0.0000 0.980 0.000 1.000 0.000
#> GSM1060770 2 0.0000 0.980 0.000 1.000 0.000
#> GSM1060771 2 0.0892 0.979 0.020 0.980 0.000
#> GSM1060772 2 0.0237 0.980 0.004 0.996 0.000
#> GSM1060773 2 0.4172 0.842 0.104 0.868 0.028
#> GSM1060774 2 0.0000 0.980 0.000 1.000 0.000
#> GSM1060775 2 0.0000 0.980 0.000 1.000 0.000
#> GSM1060776 2 0.0237 0.980 0.004 0.996 0.000
#> GSM1060777 2 0.0892 0.979 0.020 0.980 0.000
#> GSM1060778 2 0.0000 0.980 0.000 1.000 0.000
#> GSM1060779 2 0.0000 0.980 0.000 1.000 0.000
#> GSM1060780 2 0.0892 0.979 0.020 0.980 0.000
#> GSM1060781 2 0.0892 0.979 0.020 0.980 0.000
#> GSM1060782 2 0.0000 0.980 0.000 1.000 0.000
#> GSM1060783 2 0.0892 0.979 0.020 0.980 0.000
#> GSM1060784 2 0.0892 0.979 0.020 0.980 0.000
#> GSM1060785 2 0.0892 0.979 0.020 0.980 0.000
#> GSM1060786 2 0.0000 0.980 0.000 1.000 0.000
#> GSM1060787 2 0.0892 0.979 0.020 0.980 0.000
#> GSM1060788 2 0.0892 0.979 0.020 0.980 0.000
#> GSM1060789 2 0.0892 0.979 0.020 0.980 0.000
#> GSM1060790 2 0.0000 0.980 0.000 1.000 0.000
#> GSM1060754 1 0.0000 0.981 1.000 0.000 0.000
#> GSM1060745 1 0.2165 0.915 0.936 0.000 0.064
#> GSM1060756 1 0.0000 0.981 1.000 0.000 0.000
#> GSM1060746 1 0.0000 0.981 1.000 0.000 0.000
#> GSM1060758 1 0.0000 0.981 1.000 0.000 0.000
#> GSM1060765 1 0.0000 0.981 1.000 0.000 0.000
#> GSM1060732 3 0.0000 0.921 0.000 0.000 1.000
#> GSM1060727 3 0.0000 0.921 0.000 0.000 1.000
#> GSM1060740 1 0.0000 0.981 1.000 0.000 0.000
#> GSM1060730 3 0.0000 0.921 0.000 0.000 1.000
#> GSM1060737 1 0.1163 0.956 0.972 0.000 0.028
#> GSM1060743 1 0.0000 0.981 1.000 0.000 0.000
#> GSM1060734 1 0.0000 0.981 1.000 0.000 0.000
#> GSM1060729 3 0.0000 0.921 0.000 0.000 1.000
#> GSM1060744 1 0.0000 0.981 1.000 0.000 0.000
#> GSM1060742 1 0.0000 0.981 1.000 0.000 0.000
#> GSM1060752 1 0.0000 0.981 1.000 0.000 0.000
#> GSM1060755 1 0.0000 0.981 1.000 0.000 0.000
#> GSM1060761 1 0.0000 0.981 1.000 0.000 0.000
#> GSM1060760 1 0.0000 0.981 1.000 0.000 0.000
#> GSM1060767 1 0.0000 0.981 1.000 0.000 0.000
#> GSM1060741 1 0.0000 0.981 1.000 0.000 0.000
#> GSM1060759 1 0.0000 0.981 1.000 0.000 0.000
#> GSM1060728 3 0.6095 0.325 0.392 0.000 0.608
#> GSM1060763 1 0.0000 0.981 1.000 0.000 0.000
#> GSM1060747 1 0.0000 0.981 1.000 0.000 0.000
#> GSM1060764 1 0.0000 0.981 1.000 0.000 0.000
#> GSM1060733 1 0.0000 0.981 1.000 0.000 0.000
#> GSM1060735 1 0.0237 0.978 0.996 0.000 0.004
#> GSM1060739 1 0.0000 0.981 1.000 0.000 0.000
#> GSM1060753 1 0.0000 0.981 1.000 0.000 0.000
#> GSM1060738 1 0.0000 0.981 1.000 0.000 0.000
#> GSM1060762 1 0.6295 -0.001 0.528 0.000 0.472
#> GSM1060731 3 0.0000 0.921 0.000 0.000 1.000
#> GSM1060750 1 0.0000 0.981 1.000 0.000 0.000
#> GSM1060749 1 0.0000 0.981 1.000 0.000 0.000
#> GSM1060736 1 0.1163 0.956 0.972 0.000 0.028
#> GSM1060748 1 0.0424 0.973 0.992 0.008 0.000
#> GSM1060751 1 0.0000 0.981 1.000 0.000 0.000
#> GSM1060766 1 0.0237 0.977 0.996 0.004 0.000
#> GSM1060757 1 0.0000 0.981 1.000 0.000 0.000
#> GSM1060726 3 0.0000 0.921 0.000 0.000 1.000
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> GSM1060768 2 0.1022 0.944 0.000 0.968 0.000 0.032
#> GSM1060769 2 0.1022 0.944 0.000 0.968 0.000 0.032
#> GSM1060770 2 0.1022 0.944 0.000 0.968 0.000 0.032
#> GSM1060771 2 0.1824 0.940 0.004 0.936 0.000 0.060
#> GSM1060772 2 0.0000 0.944 0.000 1.000 0.000 0.000
#> GSM1060773 2 0.6226 0.579 0.200 0.676 0.120 0.004
#> GSM1060774 2 0.1022 0.944 0.000 0.968 0.000 0.032
#> GSM1060775 2 0.1022 0.944 0.000 0.968 0.000 0.032
#> GSM1060776 2 0.0707 0.944 0.000 0.980 0.000 0.020
#> GSM1060777 2 0.1824 0.940 0.004 0.936 0.000 0.060
#> GSM1060778 2 0.1022 0.944 0.000 0.968 0.000 0.032
#> GSM1060779 2 0.1022 0.944 0.000 0.968 0.000 0.032
#> GSM1060780 2 0.1824 0.940 0.004 0.936 0.000 0.060
#> GSM1060781 2 0.1824 0.940 0.004 0.936 0.000 0.060
#> GSM1060782 2 0.1022 0.944 0.000 0.968 0.000 0.032
#> GSM1060783 2 0.1824 0.940 0.004 0.936 0.000 0.060
#> GSM1060784 2 0.1824 0.940 0.004 0.936 0.000 0.060
#> GSM1060785 2 0.1824 0.940 0.004 0.936 0.000 0.060
#> GSM1060786 2 0.1022 0.944 0.000 0.968 0.000 0.032
#> GSM1060787 2 0.1824 0.940 0.004 0.936 0.000 0.060
#> GSM1060788 2 0.1824 0.940 0.004 0.936 0.000 0.060
#> GSM1060789 2 0.1824 0.940 0.004 0.936 0.000 0.060
#> GSM1060790 2 0.1022 0.944 0.000 0.968 0.000 0.032
#> GSM1060754 4 0.4164 0.595 0.264 0.000 0.000 0.736
#> GSM1060745 4 0.4761 0.208 0.372 0.000 0.000 0.628
#> GSM1060756 1 0.4925 0.306 0.572 0.000 0.000 0.428
#> GSM1060746 1 0.3444 0.654 0.816 0.000 0.000 0.184
#> GSM1060758 4 0.4933 0.700 0.432 0.000 0.000 0.568
#> GSM1060765 1 0.0188 0.771 0.996 0.000 0.000 0.004
#> GSM1060732 3 0.0000 0.926 0.000 0.000 1.000 0.000
#> GSM1060727 3 0.0000 0.926 0.000 0.000 1.000 0.000
#> GSM1060740 1 0.1211 0.770 0.960 0.000 0.000 0.040
#> GSM1060730 3 0.0000 0.926 0.000 0.000 1.000 0.000
#> GSM1060737 1 0.0592 0.771 0.984 0.000 0.000 0.016
#> GSM1060743 1 0.3266 0.656 0.832 0.000 0.000 0.168
#> GSM1060734 1 0.4916 0.312 0.576 0.000 0.000 0.424
#> GSM1060729 3 0.0000 0.926 0.000 0.000 1.000 0.000
#> GSM1060744 1 0.2921 0.687 0.860 0.000 0.000 0.140
#> GSM1060742 1 0.3975 0.503 0.760 0.000 0.000 0.240
#> GSM1060752 1 0.1118 0.770 0.964 0.000 0.000 0.036
#> GSM1060755 4 0.4925 0.714 0.428 0.000 0.000 0.572
#> GSM1060761 4 0.4855 0.743 0.400 0.000 0.000 0.600
#> GSM1060760 4 0.4843 0.746 0.396 0.000 0.000 0.604
#> GSM1060767 1 0.4941 0.292 0.564 0.000 0.000 0.436
#> GSM1060741 1 0.3219 0.661 0.836 0.000 0.000 0.164
#> GSM1060759 4 0.4843 0.746 0.396 0.000 0.000 0.604
#> GSM1060728 3 0.6614 0.363 0.052 0.012 0.484 0.452
#> GSM1060763 1 0.0817 0.774 0.976 0.000 0.000 0.024
#> GSM1060747 1 0.0188 0.772 0.996 0.000 0.000 0.004
#> GSM1060764 1 0.4972 -0.256 0.544 0.000 0.000 0.456
#> GSM1060733 1 0.4907 0.319 0.580 0.000 0.000 0.420
#> GSM1060735 1 0.0336 0.771 0.992 0.000 0.000 0.008
#> GSM1060739 1 0.1716 0.759 0.936 0.000 0.000 0.064
#> GSM1060753 4 0.4761 0.739 0.372 0.000 0.000 0.628
#> GSM1060738 1 0.1302 0.771 0.956 0.000 0.000 0.044
#> GSM1060762 4 0.6183 0.310 0.108 0.012 0.184 0.696
#> GSM1060731 3 0.0000 0.926 0.000 0.000 1.000 0.000
#> GSM1060750 1 0.0469 0.766 0.988 0.000 0.000 0.012
#> GSM1060749 1 0.2081 0.747 0.916 0.000 0.000 0.084
#> GSM1060736 1 0.0592 0.771 0.984 0.000 0.000 0.016
#> GSM1060748 1 0.0927 0.760 0.976 0.016 0.000 0.008
#> GSM1060751 1 0.0188 0.772 0.996 0.000 0.000 0.004
#> GSM1060766 1 0.0336 0.769 0.992 0.000 0.000 0.008
#> GSM1060757 4 0.4877 0.723 0.408 0.000 0.000 0.592
#> GSM1060726 3 0.0000 0.926 0.000 0.000 1.000 0.000
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> GSM1060768 5 0.1851 0.955 0.000 0.088 0.000 0.000 0.912
#> GSM1060769 5 0.1851 0.955 0.000 0.088 0.000 0.000 0.912
#> GSM1060770 5 0.2020 0.953 0.000 0.100 0.000 0.000 0.900
#> GSM1060771 2 0.0162 0.979 0.004 0.996 0.000 0.000 0.000
#> GSM1060772 5 0.4249 0.419 0.000 0.432 0.000 0.000 0.568
#> GSM1060773 1 0.6221 0.253 0.524 0.368 0.004 0.092 0.012
#> GSM1060774 5 0.2280 0.940 0.000 0.120 0.000 0.000 0.880
#> GSM1060775 5 0.2179 0.946 0.000 0.112 0.000 0.000 0.888
#> GSM1060776 5 0.2352 0.946 0.004 0.092 0.000 0.008 0.896
#> GSM1060777 2 0.0162 0.979 0.004 0.996 0.000 0.000 0.000
#> GSM1060778 5 0.1851 0.955 0.000 0.088 0.000 0.000 0.912
#> GSM1060779 5 0.1851 0.955 0.000 0.088 0.000 0.000 0.912
#> GSM1060780 2 0.1952 0.902 0.004 0.912 0.000 0.000 0.084
#> GSM1060781 2 0.0451 0.973 0.008 0.988 0.000 0.004 0.000
#> GSM1060782 5 0.2020 0.952 0.000 0.100 0.000 0.000 0.900
#> GSM1060783 2 0.0162 0.979 0.004 0.996 0.000 0.000 0.000
#> GSM1060784 2 0.1430 0.939 0.004 0.944 0.000 0.000 0.052
#> GSM1060785 2 0.0162 0.979 0.004 0.996 0.000 0.000 0.000
#> GSM1060786 5 0.1851 0.955 0.000 0.088 0.000 0.000 0.912
#> GSM1060787 2 0.0324 0.978 0.004 0.992 0.000 0.000 0.004
#> GSM1060788 2 0.0451 0.977 0.004 0.988 0.000 0.000 0.008
#> GSM1060789 2 0.0162 0.979 0.004 0.996 0.000 0.000 0.000
#> GSM1060790 5 0.1965 0.954 0.000 0.096 0.000 0.000 0.904
#> GSM1060754 1 0.4182 0.590 0.644 0.000 0.000 0.352 0.004
#> GSM1060745 1 0.4639 0.554 0.612 0.000 0.000 0.368 0.020
#> GSM1060756 1 0.3890 0.644 0.736 0.000 0.000 0.252 0.012
#> GSM1060746 1 0.2249 0.727 0.896 0.000 0.000 0.096 0.008
#> GSM1060758 4 0.3424 0.988 0.240 0.000 0.000 0.760 0.000
#> GSM1060765 1 0.2580 0.723 0.892 0.000 0.000 0.044 0.064
#> GSM1060732 3 0.0162 0.997 0.000 0.000 0.996 0.004 0.000
#> GSM1060727 3 0.0000 0.999 0.000 0.000 1.000 0.000 0.000
#> GSM1060740 1 0.1341 0.730 0.944 0.000 0.000 0.056 0.000
#> GSM1060730 3 0.0000 0.999 0.000 0.000 1.000 0.000 0.000
#> GSM1060737 1 0.2813 0.710 0.884 0.004 0.000 0.048 0.064
#> GSM1060743 1 0.2389 0.719 0.880 0.000 0.000 0.116 0.004
#> GSM1060734 1 0.3934 0.639 0.716 0.000 0.000 0.276 0.008
#> GSM1060729 3 0.0000 0.999 0.000 0.000 1.000 0.000 0.000
#> GSM1060744 1 0.2763 0.702 0.848 0.000 0.000 0.148 0.004
#> GSM1060742 1 0.3480 0.640 0.752 0.000 0.000 0.248 0.000
#> GSM1060752 1 0.1671 0.724 0.924 0.000 0.000 0.076 0.000
#> GSM1060755 1 0.4196 0.445 0.640 0.000 0.000 0.356 0.004
#> GSM1060761 4 0.3395 0.987 0.236 0.000 0.000 0.764 0.000
#> GSM1060760 4 0.3366 0.988 0.232 0.000 0.000 0.768 0.000
#> GSM1060767 1 0.4173 0.638 0.688 0.000 0.000 0.300 0.012
#> GSM1060741 1 0.3398 0.661 0.780 0.000 0.000 0.216 0.004
#> GSM1060759 4 0.3424 0.989 0.240 0.000 0.000 0.760 0.000
#> GSM1060728 1 0.7014 0.239 0.420 0.004 0.228 0.340 0.008
#> GSM1060763 1 0.2124 0.727 0.916 0.000 0.000 0.028 0.056
#> GSM1060747 1 0.0703 0.732 0.976 0.000 0.000 0.024 0.000
#> GSM1060764 1 0.4589 0.662 0.704 0.000 0.000 0.248 0.048
#> GSM1060733 1 0.3957 0.637 0.712 0.000 0.000 0.280 0.008
#> GSM1060735 1 0.2491 0.715 0.896 0.000 0.000 0.036 0.068
#> GSM1060739 1 0.2280 0.714 0.880 0.000 0.000 0.120 0.000
#> GSM1060753 4 0.3452 0.985 0.244 0.000 0.000 0.756 0.000
#> GSM1060738 1 0.2992 0.723 0.868 0.000 0.000 0.064 0.068
#> GSM1060762 1 0.6330 0.362 0.460 0.004 0.060 0.444 0.032
#> GSM1060731 3 0.0000 0.999 0.000 0.000 1.000 0.000 0.000
#> GSM1060750 1 0.3238 0.678 0.836 0.028 0.000 0.136 0.000
#> GSM1060749 1 0.3643 0.642 0.776 0.008 0.000 0.212 0.004
#> GSM1060736 1 0.2813 0.710 0.884 0.004 0.000 0.048 0.064
#> GSM1060748 1 0.3059 0.691 0.860 0.028 0.000 0.108 0.004
#> GSM1060751 1 0.2359 0.716 0.904 0.000 0.000 0.036 0.060
#> GSM1060766 1 0.3055 0.717 0.864 0.000 0.000 0.072 0.064
#> GSM1060757 1 0.4147 0.512 0.676 0.000 0.000 0.316 0.008
#> GSM1060726 3 0.0000 0.999 0.000 0.000 1.000 0.000 0.000
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> GSM1060768 5 0.0146 0.972 0.000 0.004 0.000 0.000 0.996 0.000
#> GSM1060769 5 0.0146 0.972 0.000 0.004 0.000 0.000 0.996 0.000
#> GSM1060770 5 0.0458 0.964 0.000 0.016 0.000 0.000 0.984 0.000
#> GSM1060771 2 0.0363 0.990 0.000 0.988 0.000 0.000 0.012 0.000
#> GSM1060772 5 0.3163 0.703 0.004 0.232 0.000 0.000 0.764 0.000
#> GSM1060773 6 0.6483 0.368 0.332 0.268 0.004 0.000 0.012 0.384
#> GSM1060774 5 0.0260 0.970 0.000 0.008 0.000 0.000 0.992 0.000
#> GSM1060775 5 0.0146 0.972 0.000 0.004 0.000 0.000 0.996 0.000
#> GSM1060776 5 0.0951 0.953 0.004 0.020 0.000 0.000 0.968 0.008
#> GSM1060777 2 0.0260 0.989 0.000 0.992 0.000 0.000 0.008 0.000
#> GSM1060778 5 0.0146 0.972 0.000 0.004 0.000 0.000 0.996 0.000
#> GSM1060779 5 0.0146 0.972 0.000 0.004 0.000 0.000 0.996 0.000
#> GSM1060780 2 0.0790 0.981 0.000 0.968 0.000 0.000 0.032 0.000
#> GSM1060781 2 0.0622 0.985 0.008 0.980 0.000 0.000 0.012 0.000
#> GSM1060782 5 0.0000 0.969 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM1060783 2 0.0260 0.989 0.000 0.992 0.000 0.000 0.008 0.000
#> GSM1060784 2 0.0713 0.984 0.000 0.972 0.000 0.000 0.028 0.000
#> GSM1060785 2 0.0260 0.989 0.000 0.992 0.000 0.000 0.008 0.000
#> GSM1060786 5 0.0146 0.972 0.000 0.004 0.000 0.000 0.996 0.000
#> GSM1060787 2 0.0632 0.987 0.000 0.976 0.000 0.000 0.024 0.000
#> GSM1060788 2 0.0458 0.989 0.000 0.984 0.000 0.000 0.016 0.000
#> GSM1060789 2 0.0458 0.989 0.000 0.984 0.000 0.000 0.016 0.000
#> GSM1060790 5 0.0146 0.972 0.000 0.004 0.000 0.000 0.996 0.000
#> GSM1060754 1 0.2265 0.681 0.896 0.000 0.000 0.052 0.000 0.052
#> GSM1060745 1 0.3965 -0.153 0.604 0.008 0.000 0.000 0.000 0.388
#> GSM1060756 1 0.0976 0.692 0.968 0.008 0.000 0.008 0.000 0.016
#> GSM1060746 1 0.0972 0.694 0.964 0.000 0.000 0.008 0.000 0.028
#> GSM1060758 4 0.0260 0.981 0.008 0.000 0.000 0.992 0.000 0.000
#> GSM1060765 1 0.2250 0.685 0.888 0.000 0.000 0.020 0.000 0.092
#> GSM1060732 3 0.0000 1.000 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1060727 3 0.0000 1.000 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1060740 1 0.2954 0.633 0.844 0.000 0.000 0.048 0.000 0.108
#> GSM1060730 3 0.0000 1.000 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1060737 1 0.3830 0.431 0.620 0.000 0.000 0.004 0.000 0.376
#> GSM1060743 1 0.1625 0.679 0.928 0.000 0.000 0.012 0.000 0.060
#> GSM1060734 1 0.1453 0.692 0.944 0.008 0.000 0.008 0.000 0.040
#> GSM1060729 3 0.0000 1.000 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1060744 1 0.3735 0.558 0.784 0.000 0.000 0.092 0.000 0.124
#> GSM1060742 6 0.5222 0.782 0.288 0.000 0.000 0.128 0.000 0.584
#> GSM1060752 6 0.5007 0.641 0.416 0.000 0.000 0.072 0.000 0.512
#> GSM1060755 6 0.5248 0.779 0.304 0.000 0.000 0.124 0.000 0.572
#> GSM1060761 4 0.1528 0.923 0.048 0.000 0.000 0.936 0.000 0.016
#> GSM1060760 4 0.0260 0.981 0.008 0.000 0.000 0.992 0.000 0.000
#> GSM1060767 1 0.1845 0.674 0.916 0.008 0.000 0.004 0.000 0.072
#> GSM1060741 6 0.5219 0.783 0.296 0.000 0.000 0.124 0.000 0.580
#> GSM1060759 4 0.0260 0.981 0.008 0.000 0.000 0.992 0.000 0.000
#> GSM1060728 1 0.5998 -0.249 0.464 0.004 0.156 0.000 0.008 0.368
#> GSM1060763 1 0.2915 0.622 0.808 0.000 0.000 0.008 0.000 0.184
#> GSM1060747 1 0.2019 0.684 0.900 0.000 0.000 0.012 0.000 0.088
#> GSM1060764 1 0.1471 0.690 0.932 0.000 0.000 0.004 0.000 0.064
#> GSM1060733 1 0.1781 0.686 0.924 0.008 0.000 0.008 0.000 0.060
#> GSM1060735 1 0.2494 0.676 0.864 0.000 0.000 0.016 0.000 0.120
#> GSM1060739 1 0.5128 -0.435 0.504 0.000 0.000 0.084 0.000 0.412
#> GSM1060753 4 0.0260 0.981 0.008 0.000 0.000 0.992 0.000 0.000
#> GSM1060738 1 0.4050 0.461 0.716 0.000 0.000 0.048 0.000 0.236
#> GSM1060762 1 0.4712 -0.162 0.560 0.012 0.020 0.000 0.004 0.404
#> GSM1060731 3 0.0000 1.000 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1060750 6 0.4304 0.761 0.336 0.008 0.000 0.020 0.000 0.636
#> GSM1060749 6 0.5224 0.782 0.280 0.000 0.000 0.132 0.000 0.588
#> GSM1060736 1 0.3830 0.431 0.620 0.000 0.000 0.004 0.000 0.376
#> GSM1060748 6 0.4317 0.709 0.336 0.016 0.000 0.012 0.000 0.636
#> GSM1060751 1 0.2404 0.677 0.872 0.000 0.000 0.016 0.000 0.112
#> GSM1060766 1 0.4119 0.240 0.644 0.016 0.000 0.004 0.000 0.336
#> GSM1060757 6 0.4972 0.714 0.392 0.000 0.000 0.072 0.000 0.536
#> GSM1060726 3 0.0000 1.000 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)
Test correlation between subgroups and known annotations. If the known annotation is numeric, one-way ANOVA test is applied, and if the known annotation is discrete, chi-squared contingency table test is applied.
test_to_known_factors(res)
#> n disease.state(p) tissue(p) k
#> CV:mclust 65 6.65e-15 1.29e-02 2
#> CV:mclust 63 2.09e-14 7.93e-04 3
#> CV:mclust 57 2.57e-12 2.24e-05 4
#> CV:mclust 60 2.90e-12 9.14e-02 5
#> CV:mclust 56 8.13e-11 3.46e-03 6
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 51941 rows and 65 columns.
#> Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'CV' method.
#> Subgroups are detected by 'NMF' method.
#> Performed in total 1250 partitions by row resampling.
#> Best k for subgroups seems to be 3.
#>
#> Following methods can be applied to this 'ConsensusPartition' object:
#> [1] "cola_report" "collect_classes" "collect_plots"
#> [4] "collect_stats" "colnames" "compare_signatures"
#> [7] "consensus_heatmap" "dimension_reduction" "functional_enrichment"
#> [10] "get_anno_col" "get_anno" "get_classes"
#> [13] "get_consensus" "get_matrix" "get_membership"
#> [16] "get_param" "get_signatures" "get_stats"
#> [19] "is_best_k" "is_stable_k" "membership_heatmap"
#> [22] "ncol" "nrow" "plot_ecdf"
#> [25] "rownames" "select_partition_number" "show"
#> [28] "suggest_best_k" "test_to_known_factors"
collect_plots()
function collects all the plots made from res
for all k
(number of partitions)
into one single page to provide an easy and fast comparison between different k
.
collect_plots(res)
The plots are:
k
and the heatmap of
predicted classes for each k
.k
.k
.k
.All the plots in panels can be made by individual functions and they are plotted later in this section.
select_partition_number()
produces several plots showing different
statistics for choosing “optimized” k
. There are following statistics:
k
;k
, the area increased is defined as \(A_k - A_{k-1}\).The detailed explanations of these statistics can be found in the cola vignette.
Generally speaking, lower PAC score, higher mean silhouette score or higher
concordance corresponds to better partition. Rand index and Jaccard index
measure how similar the current partition is compared to partition with k-1
.
If they are too similar, we won't accept k
is better than k-1
.
select_partition_number(res)
The numeric values for all these statistics can be obtained by get_stats()
.
get_stats(res)
#> k 1-PAC mean_silhouette concordance area_increased Rand Jaccard
#> 2 2 0.933 0.920 0.967 0.4710 0.519 0.519
#> 3 3 1.000 0.958 0.984 0.2710 0.789 0.627
#> 4 4 0.846 0.881 0.936 0.1993 0.848 0.638
#> 5 5 0.778 0.738 0.845 0.0906 0.901 0.672
#> 6 6 0.866 0.850 0.916 0.0659 0.919 0.645
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
#> GSM1060768 2 0.0000 0.932 0.000 1.000
#> GSM1060769 2 0.0000 0.932 0.000 1.000
#> GSM1060770 2 0.0000 0.932 0.000 1.000
#> GSM1060771 1 0.7139 0.738 0.804 0.196
#> GSM1060772 2 0.0000 0.932 0.000 1.000
#> GSM1060773 1 0.0000 0.983 1.000 0.000
#> GSM1060774 2 0.0000 0.932 0.000 1.000
#> GSM1060775 2 0.0000 0.932 0.000 1.000
#> GSM1060776 2 0.0000 0.932 0.000 1.000
#> GSM1060777 1 0.3733 0.910 0.928 0.072
#> GSM1060778 2 0.0000 0.932 0.000 1.000
#> GSM1060779 2 0.0000 0.932 0.000 1.000
#> GSM1060780 2 0.0376 0.929 0.004 0.996
#> GSM1060781 1 0.0000 0.983 1.000 0.000
#> GSM1060782 2 0.0000 0.932 0.000 1.000
#> GSM1060783 1 0.8207 0.629 0.744 0.256
#> GSM1060784 2 0.9909 0.268 0.444 0.556
#> GSM1060785 2 0.9881 0.292 0.436 0.564
#> GSM1060786 2 0.0000 0.932 0.000 1.000
#> GSM1060787 2 0.9358 0.496 0.352 0.648
#> GSM1060788 1 0.0672 0.976 0.992 0.008
#> GSM1060789 2 0.7950 0.689 0.240 0.760
#> GSM1060790 2 0.0000 0.932 0.000 1.000
#> GSM1060754 1 0.0000 0.983 1.000 0.000
#> GSM1060745 1 0.3274 0.924 0.940 0.060
#> GSM1060756 1 0.0000 0.983 1.000 0.000
#> GSM1060746 1 0.0000 0.983 1.000 0.000
#> GSM1060758 1 0.0000 0.983 1.000 0.000
#> GSM1060765 1 0.0000 0.983 1.000 0.000
#> GSM1060732 2 0.0000 0.932 0.000 1.000
#> GSM1060727 2 0.0000 0.932 0.000 1.000
#> GSM1060740 1 0.0000 0.983 1.000 0.000
#> GSM1060730 2 0.0000 0.932 0.000 1.000
#> GSM1060737 1 0.0000 0.983 1.000 0.000
#> GSM1060743 1 0.0000 0.983 1.000 0.000
#> GSM1060734 1 0.0000 0.983 1.000 0.000
#> GSM1060729 2 0.0000 0.932 0.000 1.000
#> GSM1060744 1 0.0000 0.983 1.000 0.000
#> GSM1060742 1 0.0000 0.983 1.000 0.000
#> GSM1060752 1 0.0000 0.983 1.000 0.000
#> GSM1060755 1 0.0000 0.983 1.000 0.000
#> GSM1060761 1 0.0000 0.983 1.000 0.000
#> GSM1060760 1 0.0000 0.983 1.000 0.000
#> GSM1060767 1 0.0000 0.983 1.000 0.000
#> GSM1060741 1 0.0000 0.983 1.000 0.000
#> GSM1060759 1 0.0000 0.983 1.000 0.000
#> GSM1060728 2 0.0000 0.932 0.000 1.000
#> GSM1060763 1 0.0000 0.983 1.000 0.000
#> GSM1060747 1 0.0000 0.983 1.000 0.000
#> GSM1060764 1 0.0000 0.983 1.000 0.000
#> GSM1060733 1 0.0000 0.983 1.000 0.000
#> GSM1060735 1 0.0000 0.983 1.000 0.000
#> GSM1060739 1 0.0000 0.983 1.000 0.000
#> GSM1060753 1 0.0000 0.983 1.000 0.000
#> GSM1060738 1 0.0000 0.983 1.000 0.000
#> GSM1060762 2 0.4431 0.859 0.092 0.908
#> GSM1060731 2 0.0000 0.932 0.000 1.000
#> GSM1060750 1 0.0000 0.983 1.000 0.000
#> GSM1060749 1 0.0000 0.983 1.000 0.000
#> GSM1060736 1 0.0000 0.983 1.000 0.000
#> GSM1060748 1 0.0000 0.983 1.000 0.000
#> GSM1060751 1 0.0000 0.983 1.000 0.000
#> GSM1060766 1 0.0000 0.983 1.000 0.000
#> GSM1060757 1 0.0000 0.983 1.000 0.000
#> GSM1060726 2 0.0000 0.932 0.000 1.000
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> GSM1060768 2 0.0000 0.9995 0.000 1.000 0.000
#> GSM1060769 2 0.0000 0.9995 0.000 1.000 0.000
#> GSM1060770 2 0.0000 0.9995 0.000 1.000 0.000
#> GSM1060771 2 0.0000 0.9995 0.000 1.000 0.000
#> GSM1060772 2 0.0000 0.9995 0.000 1.000 0.000
#> GSM1060773 1 0.6308 0.0293 0.508 0.492 0.000
#> GSM1060774 2 0.0000 0.9995 0.000 1.000 0.000
#> GSM1060775 2 0.0000 0.9995 0.000 1.000 0.000
#> GSM1060776 2 0.0000 0.9995 0.000 1.000 0.000
#> GSM1060777 2 0.0000 0.9995 0.000 1.000 0.000
#> GSM1060778 2 0.0000 0.9995 0.000 1.000 0.000
#> GSM1060779 2 0.0000 0.9995 0.000 1.000 0.000
#> GSM1060780 2 0.0000 0.9995 0.000 1.000 0.000
#> GSM1060781 2 0.0424 0.9889 0.008 0.992 0.000
#> GSM1060782 2 0.0000 0.9995 0.000 1.000 0.000
#> GSM1060783 2 0.0000 0.9995 0.000 1.000 0.000
#> GSM1060784 2 0.0000 0.9995 0.000 1.000 0.000
#> GSM1060785 2 0.0000 0.9995 0.000 1.000 0.000
#> GSM1060786 2 0.0000 0.9995 0.000 1.000 0.000
#> GSM1060787 2 0.0000 0.9995 0.000 1.000 0.000
#> GSM1060788 2 0.0000 0.9995 0.000 1.000 0.000
#> GSM1060789 2 0.0000 0.9995 0.000 1.000 0.000
#> GSM1060790 2 0.0000 0.9995 0.000 1.000 0.000
#> GSM1060754 1 0.0000 0.9815 1.000 0.000 0.000
#> GSM1060745 3 0.5431 0.6324 0.284 0.000 0.716
#> GSM1060756 1 0.0000 0.9815 1.000 0.000 0.000
#> GSM1060746 1 0.0000 0.9815 1.000 0.000 0.000
#> GSM1060758 1 0.0000 0.9815 1.000 0.000 0.000
#> GSM1060765 1 0.0000 0.9815 1.000 0.000 0.000
#> GSM1060732 3 0.0000 0.9269 0.000 0.000 1.000
#> GSM1060727 3 0.0000 0.9269 0.000 0.000 1.000
#> GSM1060740 1 0.0000 0.9815 1.000 0.000 0.000
#> GSM1060730 3 0.0000 0.9269 0.000 0.000 1.000
#> GSM1060737 1 0.0000 0.9815 1.000 0.000 0.000
#> GSM1060743 1 0.0000 0.9815 1.000 0.000 0.000
#> GSM1060734 1 0.0000 0.9815 1.000 0.000 0.000
#> GSM1060729 3 0.0000 0.9269 0.000 0.000 1.000
#> GSM1060744 1 0.0000 0.9815 1.000 0.000 0.000
#> GSM1060742 1 0.0000 0.9815 1.000 0.000 0.000
#> GSM1060752 1 0.0000 0.9815 1.000 0.000 0.000
#> GSM1060755 1 0.0000 0.9815 1.000 0.000 0.000
#> GSM1060761 1 0.0000 0.9815 1.000 0.000 0.000
#> GSM1060760 1 0.0000 0.9815 1.000 0.000 0.000
#> GSM1060767 1 0.0000 0.9815 1.000 0.000 0.000
#> GSM1060741 1 0.0000 0.9815 1.000 0.000 0.000
#> GSM1060759 1 0.0000 0.9815 1.000 0.000 0.000
#> GSM1060728 3 0.0000 0.9269 0.000 0.000 1.000
#> GSM1060763 1 0.0000 0.9815 1.000 0.000 0.000
#> GSM1060747 1 0.0000 0.9815 1.000 0.000 0.000
#> GSM1060764 1 0.0000 0.9815 1.000 0.000 0.000
#> GSM1060733 1 0.0000 0.9815 1.000 0.000 0.000
#> GSM1060735 1 0.0000 0.9815 1.000 0.000 0.000
#> GSM1060739 1 0.0000 0.9815 1.000 0.000 0.000
#> GSM1060753 1 0.0000 0.9815 1.000 0.000 0.000
#> GSM1060738 1 0.0000 0.9815 1.000 0.000 0.000
#> GSM1060762 3 0.5756 0.7396 0.208 0.028 0.764
#> GSM1060731 3 0.0000 0.9269 0.000 0.000 1.000
#> GSM1060750 1 0.0000 0.9815 1.000 0.000 0.000
#> GSM1060749 1 0.0000 0.9815 1.000 0.000 0.000
#> GSM1060736 1 0.0000 0.9815 1.000 0.000 0.000
#> GSM1060748 1 0.0000 0.9815 1.000 0.000 0.000
#> GSM1060751 1 0.0000 0.9815 1.000 0.000 0.000
#> GSM1060766 1 0.0000 0.9815 1.000 0.000 0.000
#> GSM1060757 1 0.0000 0.9815 1.000 0.000 0.000
#> GSM1060726 3 0.0000 0.9269 0.000 0.000 1.000
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> GSM1060768 2 0.0000 0.956 0.000 1.000 0.000 0.000
#> GSM1060769 2 0.0000 0.956 0.000 1.000 0.000 0.000
#> GSM1060770 2 0.0000 0.956 0.000 1.000 0.000 0.000
#> GSM1060771 2 0.0469 0.948 0.000 0.988 0.000 0.012
#> GSM1060772 2 0.0000 0.956 0.000 1.000 0.000 0.000
#> GSM1060773 2 0.6639 0.430 0.120 0.596 0.000 0.284
#> GSM1060774 2 0.0000 0.956 0.000 1.000 0.000 0.000
#> GSM1060775 2 0.0000 0.956 0.000 1.000 0.000 0.000
#> GSM1060776 2 0.0000 0.956 0.000 1.000 0.000 0.000
#> GSM1060777 2 0.0469 0.949 0.000 0.988 0.000 0.012
#> GSM1060778 2 0.0000 0.956 0.000 1.000 0.000 0.000
#> GSM1060779 2 0.0000 0.956 0.000 1.000 0.000 0.000
#> GSM1060780 2 0.0000 0.956 0.000 1.000 0.000 0.000
#> GSM1060781 2 0.4661 0.502 0.000 0.652 0.000 0.348
#> GSM1060782 2 0.0000 0.956 0.000 1.000 0.000 0.000
#> GSM1060783 2 0.1022 0.932 0.000 0.968 0.000 0.032
#> GSM1060784 2 0.0000 0.956 0.000 1.000 0.000 0.000
#> GSM1060785 2 0.0000 0.956 0.000 1.000 0.000 0.000
#> GSM1060786 2 0.0000 0.956 0.000 1.000 0.000 0.000
#> GSM1060787 2 0.0000 0.956 0.000 1.000 0.000 0.000
#> GSM1060788 2 0.2593 0.856 0.004 0.892 0.000 0.104
#> GSM1060789 2 0.0000 0.956 0.000 1.000 0.000 0.000
#> GSM1060790 2 0.0000 0.956 0.000 1.000 0.000 0.000
#> GSM1060754 1 0.1118 0.895 0.964 0.000 0.000 0.036
#> GSM1060745 1 0.4730 0.471 0.636 0.000 0.364 0.000
#> GSM1060756 1 0.0336 0.902 0.992 0.000 0.000 0.008
#> GSM1060746 1 0.0000 0.902 1.000 0.000 0.000 0.000
#> GSM1060758 4 0.0000 0.939 0.000 0.000 0.000 1.000
#> GSM1060765 1 0.0000 0.902 1.000 0.000 0.000 0.000
#> GSM1060732 3 0.0000 0.938 0.000 0.000 1.000 0.000
#> GSM1060727 3 0.0000 0.938 0.000 0.000 1.000 0.000
#> GSM1060740 1 0.3074 0.841 0.848 0.000 0.000 0.152
#> GSM1060730 3 0.0000 0.938 0.000 0.000 1.000 0.000
#> GSM1060737 1 0.0707 0.900 0.980 0.000 0.000 0.020
#> GSM1060743 1 0.3172 0.836 0.840 0.000 0.000 0.160
#> GSM1060734 1 0.1118 0.895 0.964 0.000 0.000 0.036
#> GSM1060729 3 0.0000 0.938 0.000 0.000 1.000 0.000
#> GSM1060744 1 0.3074 0.841 0.848 0.000 0.000 0.152
#> GSM1060742 1 0.4454 0.655 0.692 0.000 0.000 0.308
#> GSM1060752 1 0.3219 0.833 0.836 0.000 0.000 0.164
#> GSM1060755 4 0.0000 0.939 0.000 0.000 0.000 1.000
#> GSM1060761 4 0.0000 0.939 0.000 0.000 0.000 1.000
#> GSM1060760 4 0.0000 0.939 0.000 0.000 0.000 1.000
#> GSM1060767 1 0.0000 0.902 1.000 0.000 0.000 0.000
#> GSM1060741 1 0.3975 0.756 0.760 0.000 0.000 0.240
#> GSM1060759 4 0.0000 0.939 0.000 0.000 0.000 1.000
#> GSM1060728 3 0.0000 0.938 0.000 0.000 1.000 0.000
#> GSM1060763 1 0.1022 0.897 0.968 0.000 0.000 0.032
#> GSM1060747 1 0.0336 0.902 0.992 0.000 0.000 0.008
#> GSM1060764 1 0.0000 0.902 1.000 0.000 0.000 0.000
#> GSM1060733 1 0.1118 0.895 0.964 0.000 0.000 0.036
#> GSM1060735 1 0.0469 0.901 0.988 0.000 0.000 0.012
#> GSM1060739 1 0.3219 0.833 0.836 0.000 0.000 0.164
#> GSM1060753 4 0.0000 0.939 0.000 0.000 0.000 1.000
#> GSM1060738 1 0.3123 0.839 0.844 0.000 0.000 0.156
#> GSM1060762 3 0.6566 0.502 0.288 0.112 0.600 0.000
#> GSM1060731 3 0.0000 0.938 0.000 0.000 1.000 0.000
#> GSM1060750 4 0.0000 0.939 0.000 0.000 0.000 1.000
#> GSM1060749 4 0.0000 0.939 0.000 0.000 0.000 1.000
#> GSM1060736 1 0.1022 0.897 0.968 0.000 0.000 0.032
#> GSM1060748 4 0.2647 0.810 0.120 0.000 0.000 0.880
#> GSM1060751 1 0.0000 0.902 1.000 0.000 0.000 0.000
#> GSM1060766 1 0.0000 0.902 1.000 0.000 0.000 0.000
#> GSM1060757 4 0.4477 0.588 0.312 0.000 0.000 0.688
#> GSM1060726 3 0.0000 0.938 0.000 0.000 1.000 0.000
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> GSM1060768 5 0.0000 0.8677 0.000 0.000 0.000 0.000 1.000
#> GSM1060769 5 0.0000 0.8677 0.000 0.000 0.000 0.000 1.000
#> GSM1060770 5 0.0000 0.8677 0.000 0.000 0.000 0.000 1.000
#> GSM1060771 5 0.5112 0.7740 0.032 0.236 0.000 0.036 0.696
#> GSM1060772 5 0.0000 0.8677 0.000 0.000 0.000 0.000 1.000
#> GSM1060773 2 0.7832 0.0329 0.284 0.444 0.000 0.132 0.140
#> GSM1060774 5 0.0000 0.8677 0.000 0.000 0.000 0.000 1.000
#> GSM1060775 5 0.0000 0.8677 0.000 0.000 0.000 0.000 1.000
#> GSM1060776 5 0.0000 0.8677 0.000 0.000 0.000 0.000 1.000
#> GSM1060777 5 0.5627 0.7498 0.052 0.240 0.000 0.044 0.664
#> GSM1060778 5 0.0000 0.8677 0.000 0.000 0.000 0.000 1.000
#> GSM1060779 5 0.0000 0.8677 0.000 0.000 0.000 0.000 1.000
#> GSM1060780 5 0.2890 0.8291 0.004 0.160 0.000 0.000 0.836
#> GSM1060781 4 0.7563 -0.0695 0.048 0.240 0.000 0.404 0.308
#> GSM1060782 5 0.0000 0.8677 0.000 0.000 0.000 0.000 1.000
#> GSM1060783 5 0.4820 0.7784 0.056 0.240 0.000 0.004 0.700
#> GSM1060784 5 0.4575 0.7849 0.052 0.236 0.000 0.000 0.712
#> GSM1060785 5 0.4959 0.7670 0.076 0.240 0.000 0.000 0.684
#> GSM1060786 5 0.0000 0.8677 0.000 0.000 0.000 0.000 1.000
#> GSM1060787 5 0.3849 0.8021 0.016 0.232 0.000 0.000 0.752
#> GSM1060788 5 0.6917 0.3726 0.340 0.240 0.000 0.008 0.412
#> GSM1060789 5 0.4221 0.7949 0.032 0.236 0.000 0.000 0.732
#> GSM1060790 5 0.0000 0.8677 0.000 0.000 0.000 0.000 1.000
#> GSM1060754 2 0.3424 0.7602 0.240 0.760 0.000 0.000 0.000
#> GSM1060745 1 0.6265 0.2344 0.540 0.220 0.240 0.000 0.000
#> GSM1060756 2 0.4030 0.5844 0.352 0.648 0.000 0.000 0.000
#> GSM1060746 1 0.4291 -0.1202 0.536 0.464 0.000 0.000 0.000
#> GSM1060758 4 0.0000 0.8939 0.000 0.000 0.000 1.000 0.000
#> GSM1060765 1 0.0880 0.7913 0.968 0.032 0.000 0.000 0.000
#> GSM1060732 3 0.0000 0.9339 0.000 0.000 1.000 0.000 0.000
#> GSM1060727 3 0.0000 0.9339 0.000 0.000 1.000 0.000 0.000
#> GSM1060740 1 0.1117 0.7971 0.964 0.016 0.000 0.020 0.000
#> GSM1060730 3 0.0000 0.9339 0.000 0.000 1.000 0.000 0.000
#> GSM1060737 2 0.3424 0.7584 0.240 0.760 0.000 0.000 0.000
#> GSM1060743 1 0.2149 0.7849 0.916 0.048 0.000 0.036 0.000
#> GSM1060734 2 0.3424 0.7602 0.240 0.760 0.000 0.000 0.000
#> GSM1060729 3 0.0000 0.9339 0.000 0.000 1.000 0.000 0.000
#> GSM1060744 1 0.1485 0.7948 0.948 0.032 0.000 0.020 0.000
#> GSM1060742 1 0.2771 0.7271 0.860 0.012 0.000 0.128 0.000
#> GSM1060752 1 0.1364 0.7950 0.952 0.012 0.000 0.036 0.000
#> GSM1060755 4 0.0000 0.8939 0.000 0.000 0.000 1.000 0.000
#> GSM1060761 4 0.0000 0.8939 0.000 0.000 0.000 1.000 0.000
#> GSM1060760 4 0.0000 0.8939 0.000 0.000 0.000 1.000 0.000
#> GSM1060767 1 0.3857 0.4182 0.688 0.312 0.000 0.000 0.000
#> GSM1060741 1 0.2179 0.7541 0.896 0.004 0.000 0.100 0.000
#> GSM1060759 4 0.0000 0.8939 0.000 0.000 0.000 1.000 0.000
#> GSM1060728 3 0.0000 0.9339 0.000 0.000 1.000 0.000 0.000
#> GSM1060763 2 0.3424 0.7602 0.240 0.760 0.000 0.000 0.000
#> GSM1060747 1 0.3210 0.5445 0.788 0.212 0.000 0.000 0.000
#> GSM1060764 1 0.3177 0.6217 0.792 0.208 0.000 0.000 0.000
#> GSM1060733 2 0.3424 0.7602 0.240 0.760 0.000 0.000 0.000
#> GSM1060735 2 0.4268 0.4413 0.444 0.556 0.000 0.000 0.000
#> GSM1060739 1 0.1668 0.7893 0.940 0.028 0.000 0.032 0.000
#> GSM1060753 4 0.0000 0.8939 0.000 0.000 0.000 1.000 0.000
#> GSM1060738 1 0.1364 0.7757 0.952 0.036 0.000 0.012 0.000
#> GSM1060762 3 0.7390 0.3117 0.084 0.228 0.516 0.000 0.172
#> GSM1060731 3 0.0000 0.9339 0.000 0.000 1.000 0.000 0.000
#> GSM1060750 4 0.0324 0.8877 0.004 0.004 0.000 0.992 0.000
#> GSM1060749 4 0.0000 0.8939 0.000 0.000 0.000 1.000 0.000
#> GSM1060736 2 0.3424 0.7584 0.240 0.760 0.000 0.000 0.000
#> GSM1060748 4 0.4029 0.6410 0.024 0.232 0.000 0.744 0.000
#> GSM1060751 1 0.0794 0.7828 0.972 0.028 0.000 0.000 0.000
#> GSM1060766 1 0.0794 0.7904 0.972 0.028 0.000 0.000 0.000
#> GSM1060757 2 0.4506 0.4130 0.028 0.676 0.000 0.296 0.000
#> GSM1060726 3 0.0000 0.9339 0.000 0.000 1.000 0.000 0.000
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> GSM1060768 5 0.0000 0.9995 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM1060769 5 0.0000 0.9995 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM1060770 5 0.0000 0.9995 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM1060771 2 0.3637 0.8342 0.000 0.780 0.000 0.056 0.164 0.000
#> GSM1060772 5 0.0000 0.9995 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM1060773 2 0.0520 0.7944 0.000 0.984 0.000 0.000 0.008 0.008
#> GSM1060774 5 0.0000 0.9995 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM1060775 5 0.0000 0.9995 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM1060776 5 0.0146 0.9947 0.000 0.004 0.000 0.000 0.996 0.000
#> GSM1060777 2 0.2128 0.8382 0.000 0.908 0.000 0.032 0.056 0.004
#> GSM1060778 5 0.0000 0.9995 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM1060779 5 0.0000 0.9995 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM1060780 2 0.3860 0.3791 0.000 0.528 0.000 0.000 0.472 0.000
#> GSM1060781 2 0.2980 0.7359 0.000 0.808 0.000 0.180 0.012 0.000
#> GSM1060782 5 0.0000 0.9995 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM1060783 2 0.2615 0.8527 0.000 0.852 0.000 0.008 0.136 0.004
#> GSM1060784 2 0.2854 0.8181 0.000 0.792 0.000 0.000 0.208 0.000
#> GSM1060785 2 0.1411 0.8362 0.000 0.936 0.000 0.000 0.060 0.004
#> GSM1060786 5 0.0000 0.9995 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM1060787 2 0.3390 0.7273 0.000 0.704 0.000 0.000 0.296 0.000
#> GSM1060788 2 0.3321 0.8109 0.000 0.820 0.000 0.000 0.080 0.100
#> GSM1060789 2 0.1858 0.8470 0.000 0.904 0.000 0.000 0.092 0.004
#> GSM1060790 5 0.0000 0.9995 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM1060754 1 0.0603 0.8353 0.980 0.004 0.000 0.000 0.000 0.016
#> GSM1060745 6 0.3783 0.7723 0.060 0.012 0.136 0.000 0.000 0.792
#> GSM1060756 1 0.1753 0.7971 0.912 0.004 0.000 0.000 0.000 0.084
#> GSM1060746 1 0.3998 -0.0486 0.504 0.004 0.000 0.000 0.000 0.492
#> GSM1060758 4 0.0000 0.9462 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM1060765 6 0.0820 0.9023 0.016 0.012 0.000 0.000 0.000 0.972
#> GSM1060732 3 0.0000 0.9539 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1060727 3 0.0000 0.9539 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1060740 6 0.0405 0.9052 0.004 0.008 0.000 0.000 0.000 0.988
#> GSM1060730 3 0.0000 0.9539 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1060737 1 0.0790 0.8325 0.968 0.032 0.000 0.000 0.000 0.000
#> GSM1060743 6 0.0520 0.9042 0.008 0.008 0.000 0.000 0.000 0.984
#> GSM1060734 1 0.0146 0.8381 0.996 0.000 0.000 0.000 0.000 0.004
#> GSM1060729 3 0.0000 0.9539 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1060744 6 0.0405 0.9047 0.004 0.008 0.000 0.000 0.000 0.988
#> GSM1060742 6 0.0508 0.9032 0.000 0.012 0.000 0.004 0.000 0.984
#> GSM1060752 6 0.0405 0.9052 0.004 0.008 0.000 0.000 0.000 0.988
#> GSM1060755 4 0.0146 0.9448 0.000 0.004 0.000 0.996 0.000 0.000
#> GSM1060761 4 0.0146 0.9455 0.000 0.004 0.000 0.996 0.000 0.000
#> GSM1060760 4 0.0146 0.9455 0.000 0.004 0.000 0.996 0.000 0.000
#> GSM1060767 6 0.2915 0.7618 0.184 0.008 0.000 0.000 0.000 0.808
#> GSM1060741 6 0.0260 0.9046 0.000 0.008 0.000 0.000 0.000 0.992
#> GSM1060759 4 0.0000 0.9462 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM1060728 3 0.0000 0.9539 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1060763 1 0.0146 0.8381 0.996 0.000 0.000 0.000 0.000 0.004
#> GSM1060747 6 0.5156 0.5220 0.152 0.232 0.000 0.000 0.000 0.616
#> GSM1060764 6 0.2320 0.8278 0.132 0.004 0.000 0.000 0.000 0.864
#> GSM1060733 1 0.0146 0.8381 0.996 0.000 0.000 0.000 0.000 0.004
#> GSM1060735 1 0.3672 0.5916 0.688 0.304 0.000 0.000 0.000 0.008
#> GSM1060739 6 0.0363 0.9047 0.000 0.012 0.000 0.000 0.000 0.988
#> GSM1060753 4 0.0000 0.9462 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM1060738 6 0.0146 0.9052 0.000 0.004 0.000 0.000 0.000 0.996
#> GSM1060762 3 0.6254 0.5983 0.124 0.044 0.640 0.004 0.144 0.044
#> GSM1060731 3 0.0000 0.9539 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1060750 4 0.0790 0.9283 0.000 0.032 0.000 0.968 0.000 0.000
#> GSM1060749 4 0.0508 0.9386 0.000 0.004 0.000 0.984 0.000 0.012
#> GSM1060736 1 0.0713 0.8337 0.972 0.028 0.000 0.000 0.000 0.000
#> GSM1060748 4 0.4781 0.5326 0.072 0.320 0.000 0.608 0.000 0.000
#> GSM1060751 6 0.3231 0.7636 0.016 0.200 0.000 0.000 0.000 0.784
#> GSM1060766 6 0.2221 0.8675 0.032 0.072 0.000 0.000 0.000 0.896
#> GSM1060757 1 0.3714 0.4109 0.656 0.004 0.000 0.340 0.000 0.000
#> GSM1060726 3 0.0000 0.9539 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)
Test correlation between subgroups and known annotations. If the known annotation is numeric, one-way ANOVA test is applied, and if the known annotation is discrete, chi-squared contingency table test is applied.
test_to_known_factors(res)
#> n disease.state(p) tissue(p) k
#> CV:NMF 62 2.77e-04 4.01e-01 2
#> CV:NMF 64 1.27e-14 1.42e-03 3
#> CV:NMF 63 1.34e-13 1.22e-04 4
#> CV:NMF 56 2.01e-11 2.21e-05 5
#> CV:NMF 62 4.69e-12 1.18e-02 6
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 51941 rows and 65 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 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.524 0.850 0.890 0.2596 0.830 0.830
#> 3 3 1.000 0.960 0.986 1.2185 0.596 0.513
#> 4 4 0.926 0.931 0.971 0.1214 0.940 0.860
#> 5 5 0.745 0.725 0.855 0.1295 0.938 0.829
#> 6 6 0.819 0.784 0.888 0.0853 0.931 0.774
suggest_best_k()
suggests the best \(k\) based on these statistics. The rules are as follows:
suggest_best_k(res)
#> [1] 4
#> attr(,"optional")
#> [1] 3
There is also optional best \(k\) = 3 that is worth to check.
Following shows the table of the partitions (You need to click the show/hide
code output link to see it). The membership matrix (columns with name p*
)
is inferred by
clue::cl_consensus()
function with the SE
method. Basically the value in the membership matrix
represents the probability to belong to a certain group. The finall class
label for an item is determined with the group with highest probability it
belongs to.
In get_classes()
function, the entropy is calculated from the membership
matrix and the silhouette score is calculated from the consensus matrix.
cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#> class entropy silhouette p1 p2
#> GSM1060768 1 0.8327 0.797 0.736 0.264
#> GSM1060769 1 0.8327 0.797 0.736 0.264
#> GSM1060770 1 0.8327 0.797 0.736 0.264
#> GSM1060771 1 0.8327 0.797 0.736 0.264
#> GSM1060772 1 0.8327 0.797 0.736 0.264
#> GSM1060773 1 0.8327 0.797 0.736 0.264
#> GSM1060774 1 0.8327 0.797 0.736 0.264
#> GSM1060775 1 0.8327 0.797 0.736 0.264
#> GSM1060776 1 0.8327 0.797 0.736 0.264
#> GSM1060777 1 0.8327 0.797 0.736 0.264
#> GSM1060778 1 0.8327 0.797 0.736 0.264
#> GSM1060779 1 0.8327 0.797 0.736 0.264
#> GSM1060780 1 0.8327 0.797 0.736 0.264
#> GSM1060781 1 0.8327 0.797 0.736 0.264
#> GSM1060782 1 0.8327 0.797 0.736 0.264
#> GSM1060783 1 0.8327 0.797 0.736 0.264
#> GSM1060784 1 0.8327 0.797 0.736 0.264
#> GSM1060785 1 0.8327 0.797 0.736 0.264
#> GSM1060786 1 0.8327 0.797 0.736 0.264
#> GSM1060787 1 0.8327 0.797 0.736 0.264
#> GSM1060788 1 0.8327 0.797 0.736 0.264
#> GSM1060789 1 0.8327 0.797 0.736 0.264
#> GSM1060790 1 0.8327 0.797 0.736 0.264
#> GSM1060754 1 0.0000 0.866 1.000 0.000
#> GSM1060745 1 0.0000 0.866 1.000 0.000
#> GSM1060756 1 0.0000 0.866 1.000 0.000
#> GSM1060746 1 0.0000 0.866 1.000 0.000
#> GSM1060758 1 0.0376 0.865 0.996 0.004
#> GSM1060765 1 0.0000 0.866 1.000 0.000
#> GSM1060732 2 0.4562 1.000 0.096 0.904
#> GSM1060727 2 0.4562 1.000 0.096 0.904
#> GSM1060740 1 0.0000 0.866 1.000 0.000
#> GSM1060730 2 0.4562 1.000 0.096 0.904
#> GSM1060737 1 0.0000 0.866 1.000 0.000
#> GSM1060743 1 0.0000 0.866 1.000 0.000
#> GSM1060734 1 0.0000 0.866 1.000 0.000
#> GSM1060729 2 0.4562 1.000 0.096 0.904
#> GSM1060744 1 0.0000 0.866 1.000 0.000
#> GSM1060742 1 0.0000 0.866 1.000 0.000
#> GSM1060752 1 0.0000 0.866 1.000 0.000
#> GSM1060755 1 0.0000 0.866 1.000 0.000
#> GSM1060761 1 0.0376 0.865 0.996 0.004
#> GSM1060760 1 0.0376 0.865 0.996 0.004
#> GSM1060767 1 0.0000 0.866 1.000 0.000
#> GSM1060741 1 0.0000 0.866 1.000 0.000
#> GSM1060759 1 0.0376 0.865 0.996 0.004
#> GSM1060728 1 0.8955 0.690 0.688 0.312
#> GSM1060763 1 0.0000 0.866 1.000 0.000
#> GSM1060747 1 0.0000 0.866 1.000 0.000
#> GSM1060764 1 0.0000 0.866 1.000 0.000
#> GSM1060733 1 0.0000 0.866 1.000 0.000
#> GSM1060735 1 0.0000 0.866 1.000 0.000
#> GSM1060739 1 0.0000 0.866 1.000 0.000
#> GSM1060753 1 0.0000 0.866 1.000 0.000
#> GSM1060738 1 0.0000 0.866 1.000 0.000
#> GSM1060762 1 0.7056 0.816 0.808 0.192
#> GSM1060731 2 0.4562 1.000 0.096 0.904
#> GSM1060750 1 0.0000 0.866 1.000 0.000
#> GSM1060749 1 0.0000 0.866 1.000 0.000
#> GSM1060736 1 0.0000 0.866 1.000 0.000
#> GSM1060748 1 0.0000 0.866 1.000 0.000
#> GSM1060751 1 0.0000 0.866 1.000 0.000
#> GSM1060766 1 0.0000 0.866 1.000 0.000
#> GSM1060757 1 0.0000 0.866 1.000 0.000
#> GSM1060726 2 0.4562 1.000 0.096 0.904
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> GSM1060768 2 0.0000 0.976 0.000 1.000 0.000
#> GSM1060769 2 0.0000 0.976 0.000 1.000 0.000
#> GSM1060770 2 0.0000 0.976 0.000 1.000 0.000
#> GSM1060771 2 0.0000 0.976 0.000 1.000 0.000
#> GSM1060772 2 0.0000 0.976 0.000 1.000 0.000
#> GSM1060773 2 0.0000 0.976 0.000 1.000 0.000
#> GSM1060774 2 0.0000 0.976 0.000 1.000 0.000
#> GSM1060775 2 0.0000 0.976 0.000 1.000 0.000
#> GSM1060776 2 0.0000 0.976 0.000 1.000 0.000
#> GSM1060777 2 0.0000 0.976 0.000 1.000 0.000
#> GSM1060778 2 0.0000 0.976 0.000 1.000 0.000
#> GSM1060779 2 0.0000 0.976 0.000 1.000 0.000
#> GSM1060780 2 0.0000 0.976 0.000 1.000 0.000
#> GSM1060781 2 0.0000 0.976 0.000 1.000 0.000
#> GSM1060782 2 0.0000 0.976 0.000 1.000 0.000
#> GSM1060783 2 0.0000 0.976 0.000 1.000 0.000
#> GSM1060784 2 0.0000 0.976 0.000 1.000 0.000
#> GSM1060785 2 0.0000 0.976 0.000 1.000 0.000
#> GSM1060786 2 0.0000 0.976 0.000 1.000 0.000
#> GSM1060787 2 0.0000 0.976 0.000 1.000 0.000
#> GSM1060788 2 0.0000 0.976 0.000 1.000 0.000
#> GSM1060789 2 0.0000 0.976 0.000 1.000 0.000
#> GSM1060790 2 0.0000 0.976 0.000 1.000 0.000
#> GSM1060754 1 0.0000 0.984 1.000 0.000 0.000
#> GSM1060745 1 0.0000 0.984 1.000 0.000 0.000
#> GSM1060756 1 0.0000 0.984 1.000 0.000 0.000
#> GSM1060746 1 0.0000 0.984 1.000 0.000 0.000
#> GSM1060758 1 0.0237 0.980 0.996 0.004 0.000
#> GSM1060765 1 0.0000 0.984 1.000 0.000 0.000
#> GSM1060732 3 0.0000 1.000 0.000 0.000 1.000
#> GSM1060727 3 0.0000 1.000 0.000 0.000 1.000
#> GSM1060740 1 0.0000 0.984 1.000 0.000 0.000
#> GSM1060730 3 0.0000 1.000 0.000 0.000 1.000
#> GSM1060737 1 0.0000 0.984 1.000 0.000 0.000
#> GSM1060743 1 0.0000 0.984 1.000 0.000 0.000
#> GSM1060734 1 0.0000 0.984 1.000 0.000 0.000
#> GSM1060729 3 0.0000 1.000 0.000 0.000 1.000
#> GSM1060744 1 0.0000 0.984 1.000 0.000 0.000
#> GSM1060742 1 0.0000 0.984 1.000 0.000 0.000
#> GSM1060752 1 0.0000 0.984 1.000 0.000 0.000
#> GSM1060755 1 0.0000 0.984 1.000 0.000 0.000
#> GSM1060761 1 0.0237 0.980 0.996 0.004 0.000
#> GSM1060760 1 0.0237 0.980 0.996 0.004 0.000
#> GSM1060767 1 0.0000 0.984 1.000 0.000 0.000
#> GSM1060741 1 0.0000 0.984 1.000 0.000 0.000
#> GSM1060759 1 0.0237 0.980 0.996 0.004 0.000
#> GSM1060728 1 0.8969 0.194 0.512 0.348 0.140
#> GSM1060763 1 0.0000 0.984 1.000 0.000 0.000
#> GSM1060747 1 0.0000 0.984 1.000 0.000 0.000
#> GSM1060764 1 0.0000 0.984 1.000 0.000 0.000
#> GSM1060733 1 0.0000 0.984 1.000 0.000 0.000
#> GSM1060735 1 0.0000 0.984 1.000 0.000 0.000
#> GSM1060739 1 0.0000 0.984 1.000 0.000 0.000
#> GSM1060753 1 0.0000 0.984 1.000 0.000 0.000
#> GSM1060738 1 0.0000 0.984 1.000 0.000 0.000
#> GSM1060762 2 0.6600 0.342 0.384 0.604 0.012
#> GSM1060731 3 0.0000 1.000 0.000 0.000 1.000
#> GSM1060750 1 0.0000 0.984 1.000 0.000 0.000
#> GSM1060749 1 0.0000 0.984 1.000 0.000 0.000
#> GSM1060736 1 0.0000 0.984 1.000 0.000 0.000
#> GSM1060748 1 0.0000 0.984 1.000 0.000 0.000
#> GSM1060751 1 0.0000 0.984 1.000 0.000 0.000
#> GSM1060766 1 0.0000 0.984 1.000 0.000 0.000
#> GSM1060757 1 0.0000 0.984 1.000 0.000 0.000
#> GSM1060726 3 0.0000 1.000 0.000 0.000 1.000
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> GSM1060768 2 0.0000 0.976 0.000 1.000 0.000 0.000
#> GSM1060769 2 0.0000 0.976 0.000 1.000 0.000 0.000
#> GSM1060770 2 0.0000 0.976 0.000 1.000 0.000 0.000
#> GSM1060771 2 0.0000 0.976 0.000 1.000 0.000 0.000
#> GSM1060772 2 0.0000 0.976 0.000 1.000 0.000 0.000
#> GSM1060773 2 0.0000 0.976 0.000 1.000 0.000 0.000
#> GSM1060774 2 0.0000 0.976 0.000 1.000 0.000 0.000
#> GSM1060775 2 0.0000 0.976 0.000 1.000 0.000 0.000
#> GSM1060776 2 0.0000 0.976 0.000 1.000 0.000 0.000
#> GSM1060777 2 0.0000 0.976 0.000 1.000 0.000 0.000
#> GSM1060778 2 0.0000 0.976 0.000 1.000 0.000 0.000
#> GSM1060779 2 0.0000 0.976 0.000 1.000 0.000 0.000
#> GSM1060780 2 0.0000 0.976 0.000 1.000 0.000 0.000
#> GSM1060781 2 0.0000 0.976 0.000 1.000 0.000 0.000
#> GSM1060782 2 0.0000 0.976 0.000 1.000 0.000 0.000
#> GSM1060783 2 0.0000 0.976 0.000 1.000 0.000 0.000
#> GSM1060784 2 0.0000 0.976 0.000 1.000 0.000 0.000
#> GSM1060785 2 0.0000 0.976 0.000 1.000 0.000 0.000
#> GSM1060786 2 0.0000 0.976 0.000 1.000 0.000 0.000
#> GSM1060787 2 0.0000 0.976 0.000 1.000 0.000 0.000
#> GSM1060788 2 0.0000 0.976 0.000 1.000 0.000 0.000
#> GSM1060789 2 0.0000 0.976 0.000 1.000 0.000 0.000
#> GSM1060790 2 0.0000 0.976 0.000 1.000 0.000 0.000
#> GSM1060754 1 0.0000 0.946 1.000 0.000 0.000 0.000
#> GSM1060745 1 0.0000 0.946 1.000 0.000 0.000 0.000
#> GSM1060756 1 0.0000 0.946 1.000 0.000 0.000 0.000
#> GSM1060746 1 0.0000 0.946 1.000 0.000 0.000 0.000
#> GSM1060758 4 0.0000 1.000 0.000 0.000 0.000 1.000
#> GSM1060765 1 0.0000 0.946 1.000 0.000 0.000 0.000
#> GSM1060732 3 0.0000 1.000 0.000 0.000 1.000 0.000
#> GSM1060727 3 0.0000 1.000 0.000 0.000 1.000 0.000
#> GSM1060740 1 0.0000 0.946 1.000 0.000 0.000 0.000
#> GSM1060730 3 0.0000 1.000 0.000 0.000 1.000 0.000
#> GSM1060737 1 0.0000 0.946 1.000 0.000 0.000 0.000
#> GSM1060743 1 0.0000 0.946 1.000 0.000 0.000 0.000
#> GSM1060734 1 0.0000 0.946 1.000 0.000 0.000 0.000
#> GSM1060729 3 0.0000 1.000 0.000 0.000 1.000 0.000
#> GSM1060744 1 0.0000 0.946 1.000 0.000 0.000 0.000
#> GSM1060742 1 0.0188 0.944 0.996 0.000 0.000 0.004
#> GSM1060752 1 0.0000 0.946 1.000 0.000 0.000 0.000
#> GSM1060755 1 0.3610 0.774 0.800 0.000 0.000 0.200
#> GSM1060761 4 0.0000 1.000 0.000 0.000 0.000 1.000
#> GSM1060760 4 0.0000 1.000 0.000 0.000 0.000 1.000
#> GSM1060767 1 0.0000 0.946 1.000 0.000 0.000 0.000
#> GSM1060741 1 0.0000 0.946 1.000 0.000 0.000 0.000
#> GSM1060759 4 0.0000 1.000 0.000 0.000 0.000 1.000
#> GSM1060728 1 0.7108 0.197 0.512 0.348 0.140 0.000
#> GSM1060763 1 0.0000 0.946 1.000 0.000 0.000 0.000
#> GSM1060747 1 0.0000 0.946 1.000 0.000 0.000 0.000
#> GSM1060764 1 0.0000 0.946 1.000 0.000 0.000 0.000
#> GSM1060733 1 0.0000 0.946 1.000 0.000 0.000 0.000
#> GSM1060735 1 0.0000 0.946 1.000 0.000 0.000 0.000
#> GSM1060739 1 0.0000 0.946 1.000 0.000 0.000 0.000
#> GSM1060753 1 0.3610 0.774 0.800 0.000 0.000 0.200
#> GSM1060738 1 0.0000 0.946 1.000 0.000 0.000 0.000
#> GSM1060762 2 0.5231 0.322 0.384 0.604 0.012 0.000
#> GSM1060731 3 0.0000 1.000 0.000 0.000 1.000 0.000
#> GSM1060750 1 0.3486 0.787 0.812 0.000 0.000 0.188
#> GSM1060749 1 0.0817 0.931 0.976 0.000 0.000 0.024
#> GSM1060736 1 0.0000 0.946 1.000 0.000 0.000 0.000
#> GSM1060748 1 0.3486 0.787 0.812 0.000 0.000 0.188
#> GSM1060751 1 0.0000 0.946 1.000 0.000 0.000 0.000
#> GSM1060766 1 0.0000 0.946 1.000 0.000 0.000 0.000
#> GSM1060757 1 0.3610 0.774 0.800 0.000 0.000 0.200
#> GSM1060726 3 0.0000 1.000 0.000 0.000 1.000 0.000
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> GSM1060768 2 0.0162 0.8980 0.000 0.996 0.000 0.000 0.004
#> GSM1060769 2 0.0162 0.8980 0.000 0.996 0.000 0.000 0.004
#> GSM1060770 2 0.0162 0.8980 0.000 0.996 0.000 0.000 0.004
#> GSM1060771 2 0.2966 0.8770 0.000 0.816 0.000 0.000 0.184
#> GSM1060772 2 0.0000 0.8982 0.000 1.000 0.000 0.000 0.000
#> GSM1060773 2 0.2966 0.8770 0.000 0.816 0.000 0.000 0.184
#> GSM1060774 2 0.0000 0.8982 0.000 1.000 0.000 0.000 0.000
#> GSM1060775 2 0.0000 0.8982 0.000 1.000 0.000 0.000 0.000
#> GSM1060776 2 0.0162 0.8980 0.000 0.996 0.000 0.000 0.004
#> GSM1060777 2 0.2966 0.8770 0.000 0.816 0.000 0.000 0.184
#> GSM1060778 2 0.0162 0.8980 0.000 0.996 0.000 0.000 0.004
#> GSM1060779 2 0.0162 0.8980 0.000 0.996 0.000 0.000 0.004
#> GSM1060780 2 0.0609 0.8972 0.000 0.980 0.000 0.000 0.020
#> GSM1060781 2 0.2966 0.8770 0.000 0.816 0.000 0.000 0.184
#> GSM1060782 2 0.0162 0.8980 0.000 0.996 0.000 0.000 0.004
#> GSM1060783 2 0.2966 0.8770 0.000 0.816 0.000 0.000 0.184
#> GSM1060784 2 0.2966 0.8770 0.000 0.816 0.000 0.000 0.184
#> GSM1060785 2 0.2966 0.8770 0.000 0.816 0.000 0.000 0.184
#> GSM1060786 2 0.0162 0.8980 0.000 0.996 0.000 0.000 0.004
#> GSM1060787 2 0.2966 0.8770 0.000 0.816 0.000 0.000 0.184
#> GSM1060788 2 0.2966 0.8770 0.000 0.816 0.000 0.000 0.184
#> GSM1060789 2 0.2966 0.8770 0.000 0.816 0.000 0.000 0.184
#> GSM1060790 2 0.0162 0.8980 0.000 0.996 0.000 0.000 0.004
#> GSM1060754 1 0.4235 0.1112 0.576 0.000 0.000 0.000 0.424
#> GSM1060745 5 0.3586 0.8946 0.264 0.000 0.000 0.000 0.736
#> GSM1060756 1 0.4235 0.1112 0.576 0.000 0.000 0.000 0.424
#> GSM1060746 1 0.4138 0.2462 0.616 0.000 0.000 0.000 0.384
#> GSM1060758 4 0.0000 1.0000 0.000 0.000 0.000 1.000 0.000
#> GSM1060765 1 0.1270 0.6662 0.948 0.000 0.000 0.000 0.052
#> GSM1060732 3 0.0000 1.0000 0.000 0.000 1.000 0.000 0.000
#> GSM1060727 3 0.0000 1.0000 0.000 0.000 1.000 0.000 0.000
#> GSM1060740 1 0.0000 0.6749 1.000 0.000 0.000 0.000 0.000
#> GSM1060730 3 0.0000 1.0000 0.000 0.000 1.000 0.000 0.000
#> GSM1060737 1 0.3274 0.5443 0.780 0.000 0.000 0.000 0.220
#> GSM1060743 1 0.1792 0.6456 0.916 0.000 0.000 0.000 0.084
#> GSM1060734 5 0.3074 0.8911 0.196 0.000 0.000 0.000 0.804
#> GSM1060729 3 0.0000 1.0000 0.000 0.000 1.000 0.000 0.000
#> GSM1060744 1 0.4219 0.0179 0.584 0.000 0.000 0.000 0.416
#> GSM1060742 5 0.3969 0.8285 0.304 0.000 0.000 0.004 0.692
#> GSM1060752 1 0.0162 0.6754 0.996 0.000 0.000 0.000 0.004
#> GSM1060755 1 0.3266 0.5634 0.796 0.000 0.000 0.200 0.004
#> GSM1060761 4 0.0000 1.0000 0.000 0.000 0.000 1.000 0.000
#> GSM1060760 4 0.0000 1.0000 0.000 0.000 0.000 1.000 0.000
#> GSM1060767 5 0.3586 0.8946 0.264 0.000 0.000 0.000 0.736
#> GSM1060741 1 0.4219 0.0179 0.584 0.000 0.000 0.000 0.416
#> GSM1060759 4 0.0000 1.0000 0.000 0.000 0.000 1.000 0.000
#> GSM1060728 1 0.8161 -0.1549 0.364 0.320 0.140 0.000 0.176
#> GSM1060763 1 0.4138 0.2462 0.616 0.000 0.000 0.000 0.384
#> GSM1060747 1 0.0290 0.6755 0.992 0.000 0.000 0.000 0.008
#> GSM1060764 1 0.4150 0.2296 0.612 0.000 0.000 0.000 0.388
#> GSM1060733 5 0.3074 0.8911 0.196 0.000 0.000 0.000 0.804
#> GSM1060735 1 0.3274 0.5443 0.780 0.000 0.000 0.000 0.220
#> GSM1060739 1 0.0000 0.6749 1.000 0.000 0.000 0.000 0.000
#> GSM1060753 1 0.3266 0.5634 0.796 0.000 0.000 0.200 0.004
#> GSM1060738 1 0.0000 0.6749 1.000 0.000 0.000 0.000 0.000
#> GSM1060762 2 0.6232 0.3046 0.100 0.468 0.012 0.000 0.420
#> GSM1060731 3 0.0000 1.0000 0.000 0.000 1.000 0.000 0.000
#> GSM1060750 1 0.3160 0.5657 0.808 0.000 0.000 0.188 0.004
#> GSM1060749 1 0.0865 0.6682 0.972 0.000 0.000 0.024 0.004
#> GSM1060736 1 0.3274 0.5443 0.780 0.000 0.000 0.000 0.220
#> GSM1060748 1 0.3160 0.5657 0.808 0.000 0.000 0.188 0.004
#> GSM1060751 1 0.0963 0.6718 0.964 0.000 0.000 0.000 0.036
#> GSM1060766 1 0.0963 0.6738 0.964 0.000 0.000 0.000 0.036
#> GSM1060757 1 0.3266 0.5634 0.796 0.000 0.000 0.200 0.004
#> GSM1060726 3 0.0000 1.0000 0.000 0.000 1.000 0.000 0.000
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> GSM1060768 5 0.0000 0.9696 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM1060769 5 0.0000 0.9696 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM1060770 5 0.0000 0.9696 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM1060771 2 0.0790 0.9577 0.000 0.968 0.000 0.000 0.032 0.000
#> GSM1060772 5 0.0146 0.9674 0.000 0.004 0.000 0.000 0.996 0.000
#> GSM1060773 2 0.0790 0.9577 0.000 0.968 0.000 0.000 0.032 0.000
#> GSM1060774 5 0.0146 0.9674 0.000 0.004 0.000 0.000 0.996 0.000
#> GSM1060775 5 0.0146 0.9674 0.000 0.004 0.000 0.000 0.996 0.000
#> GSM1060776 5 0.0000 0.9696 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM1060777 2 0.0790 0.9577 0.000 0.968 0.000 0.000 0.032 0.000
#> GSM1060778 5 0.0000 0.9696 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM1060779 5 0.0000 0.9696 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM1060780 5 0.3371 0.5614 0.000 0.292 0.000 0.000 0.708 0.000
#> GSM1060781 2 0.0790 0.9577 0.000 0.968 0.000 0.000 0.032 0.000
#> GSM1060782 5 0.0000 0.9696 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM1060783 2 0.0790 0.9577 0.000 0.968 0.000 0.000 0.032 0.000
#> GSM1060784 2 0.0790 0.9577 0.000 0.968 0.000 0.000 0.032 0.000
#> GSM1060785 2 0.0790 0.9577 0.000 0.968 0.000 0.000 0.032 0.000
#> GSM1060786 5 0.0000 0.9696 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM1060787 2 0.0790 0.9577 0.000 0.968 0.000 0.000 0.032 0.000
#> GSM1060788 2 0.0790 0.9577 0.000 0.968 0.000 0.000 0.032 0.000
#> GSM1060789 2 0.0790 0.9577 0.000 0.968 0.000 0.000 0.032 0.000
#> GSM1060790 5 0.0000 0.9696 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM1060754 1 0.4039 0.3253 0.568 0.008 0.000 0.000 0.000 0.424
#> GSM1060745 6 0.2260 0.8867 0.140 0.000 0.000 0.000 0.000 0.860
#> GSM1060756 1 0.4039 0.3253 0.568 0.008 0.000 0.000 0.000 0.424
#> GSM1060746 1 0.3945 0.4212 0.612 0.008 0.000 0.000 0.000 0.380
#> GSM1060758 4 0.0508 0.9860 0.000 0.012 0.000 0.984 0.000 0.004
#> GSM1060765 1 0.1265 0.7171 0.948 0.008 0.000 0.000 0.000 0.044
#> GSM1060732 3 0.0000 1.0000 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1060727 3 0.0000 1.0000 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1060740 1 0.0000 0.7202 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1060730 3 0.0000 1.0000 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1060737 1 0.3290 0.6325 0.776 0.016 0.000 0.000 0.000 0.208
#> GSM1060743 1 0.1663 0.7003 0.912 0.000 0.000 0.000 0.000 0.088
#> GSM1060734 6 0.1444 0.8875 0.072 0.000 0.000 0.000 0.000 0.928
#> GSM1060729 3 0.0000 1.0000 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1060744 1 0.3810 0.2362 0.572 0.000 0.000 0.000 0.000 0.428
#> GSM1060742 6 0.2805 0.8330 0.184 0.000 0.000 0.004 0.000 0.812
#> GSM1060752 1 0.0146 0.7209 0.996 0.000 0.000 0.000 0.000 0.004
#> GSM1060755 1 0.3523 0.6153 0.796 0.012 0.000 0.164 0.000 0.028
#> GSM1060761 4 0.0000 0.9954 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM1060760 4 0.0000 0.9954 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM1060767 6 0.2260 0.8867 0.140 0.000 0.000 0.000 0.000 0.860
#> GSM1060741 1 0.3810 0.2362 0.572 0.000 0.000 0.000 0.000 0.428
#> GSM1060759 4 0.0000 0.9954 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM1060728 1 0.7471 -0.0842 0.356 0.352 0.136 0.000 0.012 0.144
#> GSM1060763 1 0.3945 0.4212 0.612 0.008 0.000 0.000 0.000 0.380
#> GSM1060747 1 0.0260 0.7213 0.992 0.000 0.000 0.000 0.000 0.008
#> GSM1060764 1 0.3955 0.4112 0.608 0.008 0.000 0.000 0.000 0.384
#> GSM1060733 6 0.1444 0.8875 0.072 0.000 0.000 0.000 0.000 0.928
#> GSM1060735 1 0.3290 0.6325 0.776 0.016 0.000 0.000 0.000 0.208
#> GSM1060739 1 0.0000 0.7202 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1060753 1 0.3523 0.6153 0.796 0.012 0.000 0.164 0.000 0.028
#> GSM1060738 1 0.0000 0.7202 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1060762 2 0.5093 0.3975 0.052 0.608 0.008 0.000 0.012 0.320
#> GSM1060731 3 0.0000 1.0000 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1060750 1 0.3175 0.6178 0.808 0.000 0.000 0.164 0.000 0.028
#> GSM1060749 1 0.0806 0.7133 0.972 0.008 0.000 0.000 0.000 0.020
#> GSM1060736 1 0.3290 0.6325 0.776 0.016 0.000 0.000 0.000 0.208
#> GSM1060748 1 0.3175 0.6178 0.808 0.000 0.000 0.164 0.000 0.028
#> GSM1060751 1 0.0935 0.7201 0.964 0.004 0.000 0.000 0.000 0.032
#> GSM1060766 1 0.0935 0.7214 0.964 0.004 0.000 0.000 0.000 0.032
#> GSM1060757 1 0.3523 0.6153 0.796 0.012 0.000 0.164 0.000 0.028
#> GSM1060726 3 0.0000 1.0000 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)
Test correlation between subgroups and known annotations. If the known annotation is numeric, one-way ANOVA test is applied, and if the known annotation is discrete, chi-squared contingency table test is applied.
test_to_known_factors(res)
#> n disease.state(p) tissue(p) k
#> MAD:hclust 65 1.46e-01 1.29e-02 2
#> MAD:hclust 63 2.09e-14 7.93e-04 3
#> MAD:hclust 63 1.34e-13 5.96e-05 4
#> MAD:hclust 56 2.01e-11 1.02e-06 5
#> MAD:hclust 56 8.13e-11 1.53e-03 6
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 51941 rows and 65 columns.
#> Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'MAD' method.
#> Subgroups are detected by 'kmeans' method.
#> Performed in total 1250 partitions by row resampling.
#> Best k for subgroups seems to be 2.
#>
#> Following methods can be applied to this 'ConsensusPartition' object:
#> [1] "cola_report" "collect_classes" "collect_plots"
#> [4] "collect_stats" "colnames" "compare_signatures"
#> [7] "consensus_heatmap" "dimension_reduction" "functional_enrichment"
#> [10] "get_anno_col" "get_anno" "get_classes"
#> [13] "get_consensus" "get_matrix" "get_membership"
#> [16] "get_param" "get_signatures" "get_stats"
#> [19] "is_best_k" "is_stable_k" "membership_heatmap"
#> [22] "ncol" "nrow" "plot_ecdf"
#> [25] "rownames" "select_partition_number" "show"
#> [28] "suggest_best_k" "test_to_known_factors"
collect_plots()
function collects all the plots made from res
for all k
(number of partitions)
into one single page to provide an easy and fast comparison between different k
.
collect_plots(res)
The plots are:
k
and the heatmap of
predicted classes for each k
.k
.k
.k
.All the plots in panels can be made by individual functions and they are plotted later in this section.
select_partition_number()
produces several plots showing different
statistics for choosing “optimized” k
. There are following statistics:
k
;k
, the area increased is defined as \(A_k - A_{k-1}\).The detailed explanations of these statistics can be found in the cola vignette.
Generally speaking, lower PAC score, higher mean silhouette score or higher
concordance corresponds to better partition. Rand index and Jaccard index
measure how similar the current partition is compared to partition with k-1
.
If they are too similar, we won't accept k
is better than k-1
.
select_partition_number(res)
The numeric values for all these statistics can be obtained by get_stats()
.
get_stats(res)
#> k 1-PAC mean_silhouette concordance area_increased Rand Jaccard
#> 2 2 0.754 0.863 0.938 0.4801 0.536 0.536
#> 3 3 0.622 0.785 0.857 0.2555 0.896 0.806
#> 4 4 0.862 0.835 0.890 0.1453 0.860 0.678
#> 5 5 0.751 0.816 0.792 0.0942 0.933 0.780
#> 6 6 0.751 0.829 0.811 0.0622 0.909 0.635
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
#> GSM1060768 2 0.0938 0.992 0.012 0.988
#> GSM1060769 2 0.0938 0.992 0.012 0.988
#> GSM1060770 2 0.0938 0.992 0.012 0.988
#> GSM1060771 2 0.0938 0.992 0.012 0.988
#> GSM1060772 2 0.0938 0.992 0.012 0.988
#> GSM1060773 2 0.6343 0.797 0.160 0.840
#> GSM1060774 2 0.0938 0.992 0.012 0.988
#> GSM1060775 2 0.0938 0.992 0.012 0.988
#> GSM1060776 2 0.0938 0.992 0.012 0.988
#> GSM1060777 2 0.0938 0.992 0.012 0.988
#> GSM1060778 2 0.0938 0.992 0.012 0.988
#> GSM1060779 2 0.0938 0.992 0.012 0.988
#> GSM1060780 2 0.0938 0.992 0.012 0.988
#> GSM1060781 2 0.0938 0.992 0.012 0.988
#> GSM1060782 2 0.0938 0.992 0.012 0.988
#> GSM1060783 2 0.0938 0.992 0.012 0.988
#> GSM1060784 2 0.0938 0.992 0.012 0.988
#> GSM1060785 2 0.0938 0.992 0.012 0.988
#> GSM1060786 2 0.0938 0.992 0.012 0.988
#> GSM1060787 2 0.0938 0.992 0.012 0.988
#> GSM1060788 2 0.0938 0.992 0.012 0.988
#> GSM1060789 2 0.0938 0.992 0.012 0.988
#> GSM1060790 2 0.0938 0.992 0.012 0.988
#> GSM1060754 1 0.0000 0.906 1.000 0.000
#> GSM1060745 1 0.0000 0.906 1.000 0.000
#> GSM1060756 1 0.0000 0.906 1.000 0.000
#> GSM1060746 1 0.0000 0.906 1.000 0.000
#> GSM1060758 1 0.0376 0.904 0.996 0.004
#> GSM1060765 1 0.0000 0.906 1.000 0.000
#> GSM1060732 1 0.9944 0.320 0.544 0.456
#> GSM1060727 1 0.9944 0.320 0.544 0.456
#> GSM1060740 1 0.0000 0.906 1.000 0.000
#> GSM1060730 1 0.9944 0.320 0.544 0.456
#> GSM1060737 1 0.0000 0.906 1.000 0.000
#> GSM1060743 1 0.0000 0.906 1.000 0.000
#> GSM1060734 1 0.0000 0.906 1.000 0.000
#> GSM1060729 1 0.9944 0.320 0.544 0.456
#> GSM1060744 1 0.0000 0.906 1.000 0.000
#> GSM1060742 1 0.0000 0.906 1.000 0.000
#> GSM1060752 1 0.0000 0.906 1.000 0.000
#> GSM1060755 1 0.0000 0.906 1.000 0.000
#> GSM1060761 1 0.2603 0.873 0.956 0.044
#> GSM1060760 1 0.0000 0.906 1.000 0.000
#> GSM1060767 1 0.0000 0.906 1.000 0.000
#> GSM1060741 1 0.0000 0.906 1.000 0.000
#> GSM1060759 1 0.0000 0.906 1.000 0.000
#> GSM1060728 1 0.9909 0.323 0.556 0.444
#> GSM1060763 1 0.0000 0.906 1.000 0.000
#> GSM1060747 1 0.0000 0.906 1.000 0.000
#> GSM1060764 1 0.0000 0.906 1.000 0.000
#> GSM1060733 1 0.0000 0.906 1.000 0.000
#> GSM1060735 1 0.0000 0.906 1.000 0.000
#> GSM1060739 1 0.0000 0.906 1.000 0.000
#> GSM1060753 1 0.0000 0.906 1.000 0.000
#> GSM1060738 1 0.0000 0.906 1.000 0.000
#> GSM1060762 1 0.9580 0.454 0.620 0.380
#> GSM1060731 1 0.9944 0.320 0.544 0.456
#> GSM1060750 1 0.0000 0.906 1.000 0.000
#> GSM1060749 1 0.0000 0.906 1.000 0.000
#> GSM1060736 1 0.0000 0.906 1.000 0.000
#> GSM1060748 1 0.0000 0.906 1.000 0.000
#> GSM1060751 1 0.0000 0.906 1.000 0.000
#> GSM1060766 1 0.0000 0.906 1.000 0.000
#> GSM1060757 1 0.0000 0.906 1.000 0.000
#> GSM1060726 1 0.9944 0.320 0.544 0.456
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> GSM1060768 2 0.4399 0.799 0.000 0.812 0.188
#> GSM1060769 2 0.4399 0.799 0.000 0.812 0.188
#> GSM1060770 2 0.4399 0.799 0.000 0.812 0.188
#> GSM1060771 2 0.2625 0.804 0.000 0.916 0.084
#> GSM1060772 2 0.1529 0.814 0.000 0.960 0.040
#> GSM1060773 2 0.5138 0.621 0.000 0.748 0.252
#> GSM1060774 2 0.4346 0.800 0.000 0.816 0.184
#> GSM1060775 2 0.4346 0.800 0.000 0.816 0.184
#> GSM1060776 2 0.4399 0.799 0.000 0.812 0.188
#> GSM1060777 2 0.2625 0.804 0.000 0.916 0.084
#> GSM1060778 2 0.4399 0.799 0.000 0.812 0.188
#> GSM1060779 2 0.4399 0.799 0.000 0.812 0.188
#> GSM1060780 2 0.0592 0.813 0.000 0.988 0.012
#> GSM1060781 2 0.3038 0.787 0.000 0.896 0.104
#> GSM1060782 2 0.4399 0.799 0.000 0.812 0.188
#> GSM1060783 2 0.2625 0.804 0.000 0.916 0.084
#> GSM1060784 2 0.2537 0.805 0.000 0.920 0.080
#> GSM1060785 2 0.2625 0.804 0.000 0.916 0.084
#> GSM1060786 2 0.4399 0.799 0.000 0.812 0.188
#> GSM1060787 2 0.2537 0.805 0.000 0.920 0.080
#> GSM1060788 2 0.2625 0.804 0.000 0.916 0.084
#> GSM1060789 2 0.2537 0.805 0.000 0.920 0.080
#> GSM1060790 2 0.4399 0.799 0.000 0.812 0.188
#> GSM1060754 1 0.0000 0.841 1.000 0.000 0.000
#> GSM1060745 1 0.0000 0.841 1.000 0.000 0.000
#> GSM1060756 1 0.0000 0.841 1.000 0.000 0.000
#> GSM1060746 1 0.0000 0.841 1.000 0.000 0.000
#> GSM1060758 1 0.9227 0.464 0.520 0.188 0.292
#> GSM1060765 1 0.0000 0.841 1.000 0.000 0.000
#> GSM1060732 3 0.6982 1.000 0.220 0.072 0.708
#> GSM1060727 3 0.6982 1.000 0.220 0.072 0.708
#> GSM1060740 1 0.0000 0.841 1.000 0.000 0.000
#> GSM1060730 3 0.6982 1.000 0.220 0.072 0.708
#> GSM1060737 1 0.0000 0.841 1.000 0.000 0.000
#> GSM1060743 1 0.0000 0.841 1.000 0.000 0.000
#> GSM1060734 1 0.0000 0.841 1.000 0.000 0.000
#> GSM1060729 3 0.6982 1.000 0.220 0.072 0.708
#> GSM1060744 1 0.0000 0.841 1.000 0.000 0.000
#> GSM1060742 1 0.1163 0.832 0.972 0.000 0.028
#> GSM1060752 1 0.0747 0.837 0.984 0.000 0.016
#> GSM1060755 1 0.5848 0.663 0.720 0.012 0.268
#> GSM1060761 1 0.9227 0.464 0.520 0.188 0.292
#> GSM1060760 1 0.9227 0.464 0.520 0.188 0.292
#> GSM1060767 1 0.0000 0.841 1.000 0.000 0.000
#> GSM1060741 1 0.0747 0.837 0.984 0.000 0.016
#> GSM1060759 1 0.9227 0.464 0.520 0.188 0.292
#> GSM1060728 1 0.6613 0.458 0.740 0.072 0.188
#> GSM1060763 1 0.0000 0.841 1.000 0.000 0.000
#> GSM1060747 1 0.0000 0.841 1.000 0.000 0.000
#> GSM1060764 1 0.0000 0.841 1.000 0.000 0.000
#> GSM1060733 1 0.0000 0.841 1.000 0.000 0.000
#> GSM1060735 1 0.0000 0.841 1.000 0.000 0.000
#> GSM1060739 1 0.1411 0.828 0.964 0.000 0.036
#> GSM1060753 1 0.5884 0.660 0.716 0.012 0.272
#> GSM1060738 1 0.0000 0.841 1.000 0.000 0.000
#> GSM1060762 1 0.5810 0.578 0.796 0.072 0.132
#> GSM1060731 3 0.6982 1.000 0.220 0.072 0.708
#> GSM1060750 1 0.9206 0.468 0.524 0.188 0.288
#> GSM1060749 1 0.4605 0.723 0.796 0.000 0.204
#> GSM1060736 1 0.0000 0.841 1.000 0.000 0.000
#> GSM1060748 1 0.9206 0.468 0.524 0.188 0.288
#> GSM1060751 1 0.0000 0.841 1.000 0.000 0.000
#> GSM1060766 1 0.0747 0.837 0.984 0.000 0.016
#> GSM1060757 1 0.4291 0.739 0.820 0.000 0.180
#> GSM1060726 3 0.6982 1.000 0.220 0.072 0.708
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> GSM1060768 2 0.0000 0.8325 0.000 1.000 0.000 0.000
#> GSM1060769 2 0.0000 0.8325 0.000 1.000 0.000 0.000
#> GSM1060770 2 0.0000 0.8325 0.000 1.000 0.000 0.000
#> GSM1060771 2 0.5835 0.7486 0.000 0.656 0.064 0.280
#> GSM1060772 2 0.0921 0.8299 0.000 0.972 0.000 0.028
#> GSM1060773 4 0.6188 -0.0372 0.004 0.312 0.064 0.620
#> GSM1060774 2 0.0000 0.8325 0.000 1.000 0.000 0.000
#> GSM1060775 2 0.0000 0.8325 0.000 1.000 0.000 0.000
#> GSM1060776 2 0.0000 0.8325 0.000 1.000 0.000 0.000
#> GSM1060777 2 0.5835 0.7486 0.000 0.656 0.064 0.280
#> GSM1060778 2 0.0000 0.8325 0.000 1.000 0.000 0.000
#> GSM1060779 2 0.0000 0.8325 0.000 1.000 0.000 0.000
#> GSM1060780 2 0.3400 0.8147 0.000 0.872 0.064 0.064
#> GSM1060781 2 0.5883 0.7394 0.000 0.648 0.064 0.288
#> GSM1060782 2 0.0000 0.8325 0.000 1.000 0.000 0.000
#> GSM1060783 2 0.5810 0.7522 0.000 0.660 0.064 0.276
#> GSM1060784 2 0.5810 0.7522 0.000 0.660 0.064 0.276
#> GSM1060785 2 0.5810 0.7522 0.000 0.660 0.064 0.276
#> GSM1060786 2 0.0000 0.8325 0.000 1.000 0.000 0.000
#> GSM1060787 2 0.5810 0.7522 0.000 0.660 0.064 0.276
#> GSM1060788 2 0.5810 0.7522 0.000 0.660 0.064 0.276
#> GSM1060789 2 0.5810 0.7522 0.000 0.660 0.064 0.276
#> GSM1060790 2 0.0000 0.8325 0.000 1.000 0.000 0.000
#> GSM1060754 1 0.1305 0.9580 0.960 0.000 0.036 0.004
#> GSM1060745 1 0.1545 0.9521 0.952 0.000 0.040 0.008
#> GSM1060756 1 0.1118 0.9569 0.964 0.000 0.036 0.000
#> GSM1060746 1 0.1022 0.9578 0.968 0.000 0.032 0.000
#> GSM1060758 4 0.1211 0.7052 0.040 0.000 0.000 0.960
#> GSM1060765 1 0.0804 0.9547 0.980 0.000 0.012 0.008
#> GSM1060732 3 0.3164 1.0000 0.064 0.052 0.884 0.000
#> GSM1060727 3 0.3164 1.0000 0.064 0.052 0.884 0.000
#> GSM1060740 1 0.1284 0.9507 0.964 0.000 0.012 0.024
#> GSM1060730 3 0.3164 1.0000 0.064 0.052 0.884 0.000
#> GSM1060737 1 0.1209 0.9582 0.964 0.000 0.032 0.004
#> GSM1060743 1 0.1284 0.9507 0.964 0.000 0.012 0.024
#> GSM1060734 1 0.1545 0.9521 0.952 0.000 0.040 0.008
#> GSM1060729 3 0.3164 1.0000 0.064 0.052 0.884 0.000
#> GSM1060744 1 0.0336 0.9576 0.992 0.000 0.008 0.000
#> GSM1060742 1 0.1635 0.9407 0.948 0.000 0.008 0.044
#> GSM1060752 1 0.1584 0.9426 0.952 0.000 0.012 0.036
#> GSM1060755 4 0.4844 0.6083 0.300 0.000 0.012 0.688
#> GSM1060761 4 0.1389 0.7050 0.048 0.000 0.000 0.952
#> GSM1060760 4 0.1389 0.7050 0.048 0.000 0.000 0.952
#> GSM1060767 1 0.1211 0.9556 0.960 0.000 0.040 0.000
#> GSM1060741 1 0.1584 0.9426 0.952 0.000 0.012 0.036
#> GSM1060759 4 0.1302 0.7053 0.044 0.000 0.000 0.956
#> GSM1060728 1 0.1474 0.9289 0.948 0.052 0.000 0.000
#> GSM1060763 1 0.1022 0.9578 0.968 0.000 0.032 0.000
#> GSM1060747 1 0.1284 0.9507 0.964 0.000 0.012 0.024
#> GSM1060764 1 0.1022 0.9578 0.968 0.000 0.032 0.000
#> GSM1060733 1 0.1545 0.9521 0.952 0.000 0.040 0.008
#> GSM1060735 1 0.1022 0.9578 0.968 0.000 0.032 0.000
#> GSM1060739 1 0.1584 0.9426 0.952 0.000 0.012 0.036
#> GSM1060753 4 0.4360 0.6265 0.248 0.000 0.008 0.744
#> GSM1060738 1 0.1284 0.9507 0.964 0.000 0.012 0.024
#> GSM1060762 1 0.2432 0.9309 0.928 0.028 0.020 0.024
#> GSM1060731 3 0.3164 1.0000 0.064 0.052 0.884 0.000
#> GSM1060750 4 0.2867 0.7112 0.104 0.000 0.012 0.884
#> GSM1060749 4 0.5404 0.2894 0.476 0.000 0.012 0.512
#> GSM1060736 1 0.1305 0.9585 0.960 0.000 0.036 0.004
#> GSM1060748 4 0.2676 0.7126 0.092 0.000 0.012 0.896
#> GSM1060751 1 0.1284 0.9507 0.964 0.000 0.012 0.024
#> GSM1060766 1 0.1284 0.9507 0.964 0.000 0.012 0.024
#> GSM1060757 4 0.5607 0.2413 0.484 0.000 0.020 0.496
#> GSM1060726 3 0.3164 1.0000 0.064 0.052 0.884 0.000
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> GSM1060768 5 0.4497 0.985 0.000 0.424 0.008 0.000 0.568
#> GSM1060769 5 0.4497 0.985 0.000 0.424 0.008 0.000 0.568
#> GSM1060770 5 0.4497 0.985 0.000 0.424 0.008 0.000 0.568
#> GSM1060771 2 0.0000 0.935 0.000 1.000 0.000 0.000 0.000
#> GSM1060772 5 0.5089 0.956 0.000 0.432 0.004 0.028 0.536
#> GSM1060773 2 0.2672 0.748 0.000 0.872 0.004 0.116 0.008
#> GSM1060774 5 0.5289 0.966 0.000 0.424 0.012 0.028 0.536
#> GSM1060775 5 0.5214 0.970 0.000 0.424 0.012 0.024 0.540
#> GSM1060776 5 0.5214 0.970 0.000 0.424 0.012 0.024 0.540
#> GSM1060777 2 0.0000 0.935 0.000 1.000 0.000 0.000 0.000
#> GSM1060778 5 0.4497 0.985 0.000 0.424 0.008 0.000 0.568
#> GSM1060779 5 0.4497 0.985 0.000 0.424 0.008 0.000 0.568
#> GSM1060780 2 0.3813 0.458 0.000 0.800 0.008 0.028 0.164
#> GSM1060781 2 0.0609 0.910 0.000 0.980 0.000 0.020 0.000
#> GSM1060782 5 0.4497 0.985 0.000 0.424 0.008 0.000 0.568
#> GSM1060783 2 0.0000 0.935 0.000 1.000 0.000 0.000 0.000
#> GSM1060784 2 0.0000 0.935 0.000 1.000 0.000 0.000 0.000
#> GSM1060785 2 0.0000 0.935 0.000 1.000 0.000 0.000 0.000
#> GSM1060786 5 0.4497 0.985 0.000 0.424 0.008 0.000 0.568
#> GSM1060787 2 0.0000 0.935 0.000 1.000 0.000 0.000 0.000
#> GSM1060788 2 0.0000 0.935 0.000 1.000 0.000 0.000 0.000
#> GSM1060789 2 0.0000 0.935 0.000 1.000 0.000 0.000 0.000
#> GSM1060790 5 0.4497 0.985 0.000 0.424 0.008 0.000 0.568
#> GSM1060754 1 0.0671 0.771 0.980 0.000 0.000 0.016 0.004
#> GSM1060745 1 0.2221 0.744 0.912 0.000 0.000 0.036 0.052
#> GSM1060756 1 0.0671 0.771 0.980 0.000 0.000 0.016 0.004
#> GSM1060746 1 0.0324 0.773 0.992 0.000 0.000 0.004 0.004
#> GSM1060758 4 0.5343 0.709 0.008 0.172 0.008 0.708 0.104
#> GSM1060765 1 0.5243 0.733 0.668 0.000 0.004 0.084 0.244
#> GSM1060732 3 0.0693 1.000 0.008 0.012 0.980 0.000 0.000
#> GSM1060727 3 0.0693 1.000 0.008 0.012 0.980 0.000 0.000
#> GSM1060740 1 0.5689 0.709 0.616 0.000 0.000 0.136 0.248
#> GSM1060730 3 0.0693 1.000 0.008 0.012 0.980 0.000 0.000
#> GSM1060737 1 0.1571 0.779 0.936 0.000 0.004 0.000 0.060
#> GSM1060743 1 0.5816 0.710 0.616 0.000 0.004 0.136 0.244
#> GSM1060734 1 0.2221 0.744 0.912 0.000 0.000 0.036 0.052
#> GSM1060729 3 0.0693 1.000 0.008 0.012 0.980 0.000 0.000
#> GSM1060744 1 0.4708 0.748 0.712 0.000 0.000 0.068 0.220
#> GSM1060742 1 0.5740 0.708 0.616 0.000 0.000 0.152 0.232
#> GSM1060752 1 0.5762 0.703 0.608 0.000 0.000 0.144 0.248
#> GSM1060755 4 0.3242 0.700 0.076 0.000 0.000 0.852 0.072
#> GSM1060761 4 0.5410 0.710 0.008 0.164 0.008 0.704 0.116
#> GSM1060760 4 0.5373 0.713 0.008 0.160 0.008 0.708 0.116
#> GSM1060767 1 0.2221 0.744 0.912 0.000 0.000 0.036 0.052
#> GSM1060741 1 0.5806 0.702 0.600 0.000 0.000 0.144 0.256
#> GSM1060759 4 0.5282 0.714 0.008 0.160 0.008 0.716 0.108
#> GSM1060728 1 0.2597 0.768 0.904 0.012 0.008 0.016 0.060
#> GSM1060763 1 0.0324 0.773 0.992 0.000 0.000 0.004 0.004
#> GSM1060747 1 0.5705 0.714 0.624 0.000 0.004 0.120 0.252
#> GSM1060764 1 0.0486 0.774 0.988 0.000 0.004 0.004 0.004
#> GSM1060733 1 0.2221 0.744 0.912 0.000 0.000 0.036 0.052
#> GSM1060735 1 0.1357 0.779 0.948 0.000 0.004 0.000 0.048
#> GSM1060739 1 0.5832 0.696 0.600 0.000 0.000 0.152 0.248
#> GSM1060753 4 0.1341 0.724 0.056 0.000 0.000 0.944 0.000
#> GSM1060738 1 0.5689 0.709 0.616 0.000 0.000 0.136 0.248
#> GSM1060762 1 0.3433 0.705 0.856 0.008 0.004 0.064 0.068
#> GSM1060731 3 0.0693 1.000 0.008 0.012 0.980 0.000 0.000
#> GSM1060750 4 0.4339 0.740 0.028 0.100 0.000 0.800 0.072
#> GSM1060749 4 0.6349 0.195 0.232 0.000 0.000 0.524 0.244
#> GSM1060736 1 0.1704 0.778 0.928 0.000 0.004 0.000 0.068
#> GSM1060748 4 0.4331 0.736 0.008 0.140 0.000 0.780 0.072
#> GSM1060751 1 0.5705 0.714 0.624 0.000 0.004 0.120 0.252
#> GSM1060766 1 0.5959 0.697 0.600 0.000 0.004 0.152 0.244
#> GSM1060757 4 0.4581 0.585 0.196 0.000 0.000 0.732 0.072
#> GSM1060726 3 0.0693 1.000 0.008 0.012 0.980 0.000 0.000
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> GSM1060768 5 0.000 0.957 0.000 0.000 0 0.000 1.000 0.000
#> GSM1060769 5 0.000 0.957 0.000 0.000 0 0.000 1.000 0.000
#> GSM1060770 5 0.000 0.957 0.000 0.000 0 0.000 1.000 0.000
#> GSM1060771 2 0.329 0.956 0.000 0.724 0 0.000 0.276 0.000
#> GSM1060772 5 0.227 0.900 0.000 0.000 0 0.012 0.880 0.108
#> GSM1060773 2 0.398 0.867 0.000 0.740 0 0.060 0.200 0.000
#> GSM1060774 5 0.227 0.900 0.000 0.000 0 0.012 0.880 0.108
#> GSM1060775 5 0.186 0.920 0.000 0.000 0 0.012 0.912 0.076
#> GSM1060776 5 0.204 0.920 0.000 0.000 0 0.020 0.904 0.076
#> GSM1060777 2 0.329 0.956 0.000 0.724 0 0.000 0.276 0.000
#> GSM1060778 5 0.026 0.957 0.000 0.000 0 0.008 0.992 0.000
#> GSM1060779 5 0.000 0.957 0.000 0.000 0 0.000 1.000 0.000
#> GSM1060780 2 0.549 0.755 0.000 0.560 0 0.020 0.332 0.088
#> GSM1060781 2 0.324 0.952 0.000 0.732 0 0.000 0.268 0.000
#> GSM1060782 5 0.026 0.957 0.000 0.000 0 0.008 0.992 0.000
#> GSM1060783 2 0.372 0.955 0.000 0.708 0 0.000 0.276 0.016
#> GSM1060784 2 0.395 0.952 0.000 0.696 0 0.000 0.276 0.028
#> GSM1060785 2 0.329 0.956 0.000 0.724 0 0.000 0.276 0.000
#> GSM1060786 5 0.026 0.957 0.000 0.000 0 0.008 0.992 0.000
#> GSM1060787 2 0.395 0.952 0.000 0.696 0 0.000 0.276 0.028
#> GSM1060788 2 0.395 0.952 0.000 0.696 0 0.000 0.276 0.028
#> GSM1060789 2 0.329 0.956 0.000 0.724 0 0.000 0.276 0.000
#> GSM1060790 5 0.026 0.957 0.000 0.000 0 0.008 0.992 0.000
#> GSM1060754 1 0.144 0.788 0.944 0.012 0 0.004 0.000 0.040
#> GSM1060745 1 0.271 0.748 0.864 0.108 0 0.016 0.000 0.012
#> GSM1060756 1 0.144 0.788 0.944 0.012 0 0.004 0.000 0.040
#> GSM1060746 1 0.200 0.772 0.884 0.000 0 0.000 0.000 0.116
#> GSM1060758 4 0.133 0.769 0.000 0.064 0 0.936 0.000 0.000
#> GSM1060765 6 0.426 0.671 0.408 0.020 0 0.000 0.000 0.572
#> GSM1060732 3 0.000 1.000 0.000 0.000 1 0.000 0.000 0.000
#> GSM1060727 3 0.000 1.000 0.000 0.000 1 0.000 0.000 0.000
#> GSM1060740 6 0.322 0.822 0.264 0.000 0 0.000 0.000 0.736
#> GSM1060730 3 0.000 1.000 0.000 0.000 1 0.000 0.000 0.000
#> GSM1060737 1 0.352 0.675 0.780 0.028 0 0.004 0.000 0.188
#> GSM1060743 6 0.395 0.788 0.328 0.016 0 0.000 0.000 0.656
#> GSM1060734 1 0.237 0.755 0.888 0.088 0 0.016 0.000 0.008
#> GSM1060729 3 0.000 1.000 0.000 0.000 1 0.000 0.000 0.000
#> GSM1060744 6 0.439 0.555 0.444 0.024 0 0.000 0.000 0.532
#> GSM1060742 6 0.528 0.516 0.420 0.028 0 0.044 0.000 0.508
#> GSM1060752 6 0.313 0.817 0.248 0.000 0 0.000 0.000 0.752
#> GSM1060755 4 0.549 0.743 0.028 0.096 0 0.604 0.000 0.272
#> GSM1060761 4 0.127 0.770 0.000 0.060 0 0.940 0.000 0.000
#> GSM1060760 4 0.127 0.770 0.000 0.060 0 0.940 0.000 0.000
#> GSM1060767 1 0.257 0.751 0.876 0.096 0 0.016 0.000 0.012
#> GSM1060741 6 0.347 0.811 0.248 0.012 0 0.000 0.000 0.740
#> GSM1060759 4 0.127 0.770 0.000 0.060 0 0.940 0.000 0.000
#> GSM1060728 1 0.505 0.630 0.676 0.088 0 0.028 0.000 0.208
#> GSM1060763 1 0.205 0.772 0.888 0.004 0 0.000 0.000 0.108
#> GSM1060747 6 0.367 0.816 0.284 0.012 0 0.000 0.000 0.704
#> GSM1060764 1 0.262 0.761 0.860 0.024 0 0.000 0.000 0.116
#> GSM1060733 1 0.237 0.755 0.888 0.088 0 0.016 0.000 0.008
#> GSM1060735 1 0.349 0.691 0.788 0.032 0 0.004 0.000 0.176
#> GSM1060739 6 0.297 0.807 0.224 0.000 0 0.000 0.000 0.776
#> GSM1060753 4 0.465 0.786 0.016 0.088 0 0.712 0.000 0.184
#> GSM1060738 6 0.322 0.822 0.264 0.000 0 0.000 0.000 0.736
#> GSM1060762 1 0.426 0.680 0.764 0.148 0 0.048 0.000 0.040
#> GSM1060731 3 0.000 1.000 0.000 0.000 1 0.000 0.000 0.000
#> GSM1060750 4 0.537 0.765 0.008 0.132 0 0.600 0.000 0.260
#> GSM1060749 6 0.518 0.429 0.084 0.088 0 0.124 0.000 0.704
#> GSM1060736 1 0.355 0.667 0.776 0.028 0 0.004 0.000 0.192
#> GSM1060748 4 0.527 0.777 0.000 0.164 0 0.600 0.000 0.236
#> GSM1060751 6 0.409 0.774 0.344 0.020 0 0.000 0.000 0.636
#> GSM1060766 6 0.445 0.769 0.312 0.040 0 0.004 0.000 0.644
#> GSM1060757 4 0.672 0.608 0.132 0.100 0 0.488 0.000 0.280
#> GSM1060726 3 0.000 1.000 0.000 0.000 1 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)
Test correlation between subgroups and known annotations. If the known annotation is numeric, one-way ANOVA test is applied, and if the known annotation is discrete, chi-squared contingency table test is applied.
test_to_known_factors(res)
#> n disease.state(p) tissue(p) k
#> MAD:kmeans 57 3.47e-13 0.008021 2
#> MAD:kmeans 58 2.54e-13 0.000456 3
#> MAD:kmeans 62 2.20e-13 0.000106 4
#> MAD:kmeans 63 6.79e-13 0.088144 5
#> MAD:kmeans 64 1.81e-12 0.008941 6
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 51941 rows and 65 columns.
#> Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'MAD' method.
#> Subgroups are detected by 'skmeans' method.
#> Performed in total 1250 partitions by row resampling.
#> Best k for subgroups seems to be 6.
#>
#> Following methods can be applied to this 'ConsensusPartition' object:
#> [1] "cola_report" "collect_classes" "collect_plots"
#> [4] "collect_stats" "colnames" "compare_signatures"
#> [7] "consensus_heatmap" "dimension_reduction" "functional_enrichment"
#> [10] "get_anno_col" "get_anno" "get_classes"
#> [13] "get_consensus" "get_matrix" "get_membership"
#> [16] "get_param" "get_signatures" "get_stats"
#> [19] "is_best_k" "is_stable_k" "membership_heatmap"
#> [22] "ncol" "nrow" "plot_ecdf"
#> [25] "rownames" "select_partition_number" "show"
#> [28] "suggest_best_k" "test_to_known_factors"
collect_plots()
function collects all the plots made from res
for all k
(number of partitions)
into one single page to provide an easy and fast comparison between different k
.
collect_plots(res)
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.781 0.945 0.970 0.5054 0.493 0.493
#> 3 3 1.000 0.926 0.964 0.2144 0.912 0.821
#> 4 4 1.000 0.970 0.988 0.1634 0.885 0.715
#> 5 5 0.870 0.958 0.937 0.0851 0.938 0.784
#> 6 6 0.903 0.882 0.917 0.0756 0.921 0.659
suggest_best_k()
suggests the best \(k\) based on these statistics. The rules are as follows:
suggest_best_k(res)
#> [1] 6
#> attr(,"optional")
#> [1] 3 4
There is also optional best \(k\) = 3 4 that is worth to check.
Following shows the table of the partitions (You need to click the show/hide
code output link to see it). The membership matrix (columns with name p*
)
is inferred by
clue::cl_consensus()
function with the SE
method. Basically the value in the membership matrix
represents the probability to belong to a certain group. The finall class
label for an item is determined with the group with highest probability it
belongs to.
In get_classes()
function, the entropy is calculated from the membership
matrix and the silhouette score is calculated from the consensus matrix.
cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#> class entropy silhouette p1 p2
#> GSM1060768 2 0.000 0.958 0.000 1.000
#> GSM1060769 2 0.000 0.958 0.000 1.000
#> GSM1060770 2 0.000 0.958 0.000 1.000
#> GSM1060771 2 0.000 0.958 0.000 1.000
#> GSM1060772 2 0.000 0.958 0.000 1.000
#> GSM1060773 2 0.000 0.958 0.000 1.000
#> GSM1060774 2 0.000 0.958 0.000 1.000
#> GSM1060775 2 0.000 0.958 0.000 1.000
#> GSM1060776 2 0.000 0.958 0.000 1.000
#> GSM1060777 2 0.000 0.958 0.000 1.000
#> GSM1060778 2 0.000 0.958 0.000 1.000
#> GSM1060779 2 0.000 0.958 0.000 1.000
#> GSM1060780 2 0.000 0.958 0.000 1.000
#> GSM1060781 2 0.000 0.958 0.000 1.000
#> GSM1060782 2 0.000 0.958 0.000 1.000
#> GSM1060783 2 0.000 0.958 0.000 1.000
#> GSM1060784 2 0.000 0.958 0.000 1.000
#> GSM1060785 2 0.000 0.958 0.000 1.000
#> GSM1060786 2 0.000 0.958 0.000 1.000
#> GSM1060787 2 0.000 0.958 0.000 1.000
#> GSM1060788 2 0.000 0.958 0.000 1.000
#> GSM1060789 2 0.000 0.958 0.000 1.000
#> GSM1060790 2 0.000 0.958 0.000 1.000
#> GSM1060754 1 0.000 0.976 1.000 0.000
#> GSM1060745 1 0.000 0.976 1.000 0.000
#> GSM1060756 1 0.000 0.976 1.000 0.000
#> GSM1060746 1 0.000 0.976 1.000 0.000
#> GSM1060758 1 0.662 0.812 0.828 0.172
#> GSM1060765 1 0.000 0.976 1.000 0.000
#> GSM1060732 2 0.625 0.858 0.156 0.844
#> GSM1060727 2 0.625 0.858 0.156 0.844
#> GSM1060740 1 0.000 0.976 1.000 0.000
#> GSM1060730 2 0.625 0.858 0.156 0.844
#> GSM1060737 1 0.000 0.976 1.000 0.000
#> GSM1060743 1 0.000 0.976 1.000 0.000
#> GSM1060734 1 0.000 0.976 1.000 0.000
#> GSM1060729 2 0.625 0.858 0.156 0.844
#> GSM1060744 1 0.000 0.976 1.000 0.000
#> GSM1060742 1 0.000 0.976 1.000 0.000
#> GSM1060752 1 0.000 0.976 1.000 0.000
#> GSM1060755 1 0.000 0.976 1.000 0.000
#> GSM1060761 1 0.808 0.710 0.752 0.248
#> GSM1060760 1 0.327 0.930 0.940 0.060
#> GSM1060767 1 0.000 0.976 1.000 0.000
#> GSM1060741 1 0.000 0.976 1.000 0.000
#> GSM1060759 1 0.327 0.930 0.940 0.060
#> GSM1060728 2 0.615 0.861 0.152 0.848
#> GSM1060763 1 0.000 0.976 1.000 0.000
#> GSM1060747 1 0.000 0.976 1.000 0.000
#> GSM1060764 1 0.000 0.976 1.000 0.000
#> GSM1060733 1 0.000 0.976 1.000 0.000
#> GSM1060735 1 0.000 0.976 1.000 0.000
#> GSM1060739 1 0.000 0.976 1.000 0.000
#> GSM1060753 1 0.000 0.976 1.000 0.000
#> GSM1060738 1 0.000 0.976 1.000 0.000
#> GSM1060762 2 0.541 0.882 0.124 0.876
#> GSM1060731 2 0.625 0.858 0.156 0.844
#> GSM1060750 1 0.311 0.933 0.944 0.056
#> GSM1060749 1 0.000 0.976 1.000 0.000
#> GSM1060736 1 0.000 0.976 1.000 0.000
#> GSM1060748 1 0.625 0.828 0.844 0.156
#> GSM1060751 1 0.000 0.976 1.000 0.000
#> GSM1060766 1 0.000 0.976 1.000 0.000
#> GSM1060757 1 0.000 0.976 1.000 0.000
#> GSM1060726 2 0.625 0.858 0.156 0.844
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> GSM1060768 2 0.0747 0.991 0.000 0.984 0.016
#> GSM1060769 2 0.0747 0.991 0.000 0.984 0.016
#> GSM1060770 2 0.0747 0.991 0.000 0.984 0.016
#> GSM1060771 2 0.0000 0.991 0.000 1.000 0.000
#> GSM1060772 2 0.0592 0.991 0.000 0.988 0.012
#> GSM1060773 2 0.0000 0.991 0.000 1.000 0.000
#> GSM1060774 2 0.0747 0.991 0.000 0.984 0.016
#> GSM1060775 2 0.0747 0.991 0.000 0.984 0.016
#> GSM1060776 2 0.0747 0.991 0.000 0.984 0.016
#> GSM1060777 2 0.0000 0.991 0.000 1.000 0.000
#> GSM1060778 2 0.0747 0.991 0.000 0.984 0.016
#> GSM1060779 2 0.0747 0.991 0.000 0.984 0.016
#> GSM1060780 2 0.0237 0.991 0.000 0.996 0.004
#> GSM1060781 2 0.0000 0.991 0.000 1.000 0.000
#> GSM1060782 2 0.0747 0.991 0.000 0.984 0.016
#> GSM1060783 2 0.0000 0.991 0.000 1.000 0.000
#> GSM1060784 2 0.0000 0.991 0.000 1.000 0.000
#> GSM1060785 2 0.0000 0.991 0.000 1.000 0.000
#> GSM1060786 2 0.0747 0.991 0.000 0.984 0.016
#> GSM1060787 2 0.0000 0.991 0.000 1.000 0.000
#> GSM1060788 2 0.0000 0.991 0.000 1.000 0.000
#> GSM1060789 2 0.0000 0.991 0.000 1.000 0.000
#> GSM1060790 2 0.0747 0.991 0.000 0.984 0.016
#> GSM1060754 1 0.0592 0.933 0.988 0.000 0.012
#> GSM1060745 1 0.2066 0.911 0.940 0.000 0.060
#> GSM1060756 1 0.1163 0.928 0.972 0.000 0.028
#> GSM1060746 1 0.1163 0.928 0.972 0.000 0.028
#> GSM1060758 1 0.7958 0.301 0.544 0.392 0.064
#> GSM1060765 1 0.0592 0.933 0.988 0.000 0.012
#> GSM1060732 3 0.0000 1.000 0.000 0.000 1.000
#> GSM1060727 3 0.0000 1.000 0.000 0.000 1.000
#> GSM1060740 1 0.0000 0.933 1.000 0.000 0.000
#> GSM1060730 3 0.0000 1.000 0.000 0.000 1.000
#> GSM1060737 1 0.1031 0.930 0.976 0.000 0.024
#> GSM1060743 1 0.0000 0.933 1.000 0.000 0.000
#> GSM1060734 1 0.1860 0.917 0.948 0.000 0.052
#> GSM1060729 3 0.0000 1.000 0.000 0.000 1.000
#> GSM1060744 1 0.0747 0.932 0.984 0.000 0.016
#> GSM1060742 1 0.0424 0.932 0.992 0.000 0.008
#> GSM1060752 1 0.0000 0.933 1.000 0.000 0.000
#> GSM1060755 1 0.0000 0.933 1.000 0.000 0.000
#> GSM1060761 1 0.8486 0.296 0.548 0.104 0.348
#> GSM1060760 1 0.6566 0.467 0.636 0.016 0.348
#> GSM1060767 1 0.1860 0.917 0.948 0.000 0.052
#> GSM1060741 1 0.0000 0.933 1.000 0.000 0.000
#> GSM1060759 1 0.6543 0.475 0.640 0.016 0.344
#> GSM1060728 3 0.0000 1.000 0.000 0.000 1.000
#> GSM1060763 1 0.1411 0.925 0.964 0.000 0.036
#> GSM1060747 1 0.0424 0.933 0.992 0.000 0.008
#> GSM1060764 1 0.1529 0.923 0.960 0.000 0.040
#> GSM1060733 1 0.1860 0.917 0.948 0.000 0.052
#> GSM1060735 1 0.0892 0.931 0.980 0.000 0.020
#> GSM1060739 1 0.0000 0.933 1.000 0.000 0.000
#> GSM1060753 1 0.0000 0.933 1.000 0.000 0.000
#> GSM1060738 1 0.0000 0.933 1.000 0.000 0.000
#> GSM1060762 3 0.0000 1.000 0.000 0.000 1.000
#> GSM1060731 3 0.0000 1.000 0.000 0.000 1.000
#> GSM1060750 1 0.0747 0.926 0.984 0.016 0.000
#> GSM1060749 1 0.0000 0.933 1.000 0.000 0.000
#> GSM1060736 1 0.0892 0.931 0.980 0.000 0.020
#> GSM1060748 1 0.0747 0.926 0.984 0.016 0.000
#> GSM1060751 1 0.0237 0.933 0.996 0.000 0.004
#> GSM1060766 1 0.0000 0.933 1.000 0.000 0.000
#> GSM1060757 1 0.0000 0.933 1.000 0.000 0.000
#> GSM1060726 3 0.0000 1.000 0.000 0.000 1.000
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> GSM1060768 2 0.0000 0.973 0.000 1.000 0 0.000
#> GSM1060769 2 0.0000 0.973 0.000 1.000 0 0.000
#> GSM1060770 2 0.0000 0.973 0.000 1.000 0 0.000
#> GSM1060771 2 0.0469 0.970 0.000 0.988 0 0.012
#> GSM1060772 2 0.0000 0.973 0.000 1.000 0 0.000
#> GSM1060773 2 0.4996 0.079 0.000 0.516 0 0.484
#> GSM1060774 2 0.0000 0.973 0.000 1.000 0 0.000
#> GSM1060775 2 0.0000 0.973 0.000 1.000 0 0.000
#> GSM1060776 2 0.0000 0.973 0.000 1.000 0 0.000
#> GSM1060777 2 0.0469 0.970 0.000 0.988 0 0.012
#> GSM1060778 2 0.0000 0.973 0.000 1.000 0 0.000
#> GSM1060779 2 0.0000 0.973 0.000 1.000 0 0.000
#> GSM1060780 2 0.0000 0.973 0.000 1.000 0 0.000
#> GSM1060781 2 0.0469 0.970 0.000 0.988 0 0.012
#> GSM1060782 2 0.0000 0.973 0.000 1.000 0 0.000
#> GSM1060783 2 0.0469 0.970 0.000 0.988 0 0.012
#> GSM1060784 2 0.0188 0.973 0.000 0.996 0 0.004
#> GSM1060785 2 0.0469 0.970 0.000 0.988 0 0.012
#> GSM1060786 2 0.0000 0.973 0.000 1.000 0 0.000
#> GSM1060787 2 0.0188 0.973 0.000 0.996 0 0.004
#> GSM1060788 2 0.0469 0.970 0.000 0.988 0 0.012
#> GSM1060789 2 0.0469 0.970 0.000 0.988 0 0.012
#> GSM1060790 2 0.0000 0.973 0.000 1.000 0 0.000
#> GSM1060754 1 0.0000 0.995 1.000 0.000 0 0.000
#> GSM1060745 1 0.0000 0.995 1.000 0.000 0 0.000
#> GSM1060756 1 0.0000 0.995 1.000 0.000 0 0.000
#> GSM1060746 1 0.0000 0.995 1.000 0.000 0 0.000
#> GSM1060758 4 0.0000 0.987 0.000 0.000 0 1.000
#> GSM1060765 1 0.0000 0.995 1.000 0.000 0 0.000
#> GSM1060732 3 0.0000 1.000 0.000 0.000 1 0.000
#> GSM1060727 3 0.0000 1.000 0.000 0.000 1 0.000
#> GSM1060740 1 0.0000 0.995 1.000 0.000 0 0.000
#> GSM1060730 3 0.0000 1.000 0.000 0.000 1 0.000
#> GSM1060737 1 0.0000 0.995 1.000 0.000 0 0.000
#> GSM1060743 1 0.0000 0.995 1.000 0.000 0 0.000
#> GSM1060734 1 0.0000 0.995 1.000 0.000 0 0.000
#> GSM1060729 3 0.0000 1.000 0.000 0.000 1 0.000
#> GSM1060744 1 0.0000 0.995 1.000 0.000 0 0.000
#> GSM1060742 1 0.2469 0.878 0.892 0.000 0 0.108
#> GSM1060752 1 0.0000 0.995 1.000 0.000 0 0.000
#> GSM1060755 4 0.0469 0.982 0.012 0.000 0 0.988
#> GSM1060761 4 0.0000 0.987 0.000 0.000 0 1.000
#> GSM1060760 4 0.0000 0.987 0.000 0.000 0 1.000
#> GSM1060767 1 0.0000 0.995 1.000 0.000 0 0.000
#> GSM1060741 1 0.0188 0.991 0.996 0.000 0 0.004
#> GSM1060759 4 0.0000 0.987 0.000 0.000 0 1.000
#> GSM1060728 3 0.0000 1.000 0.000 0.000 1 0.000
#> GSM1060763 1 0.0000 0.995 1.000 0.000 0 0.000
#> GSM1060747 1 0.0000 0.995 1.000 0.000 0 0.000
#> GSM1060764 1 0.0000 0.995 1.000 0.000 0 0.000
#> GSM1060733 1 0.0000 0.995 1.000 0.000 0 0.000
#> GSM1060735 1 0.0000 0.995 1.000 0.000 0 0.000
#> GSM1060739 1 0.0000 0.995 1.000 0.000 0 0.000
#> GSM1060753 4 0.0469 0.982 0.012 0.000 0 0.988
#> GSM1060738 1 0.0000 0.995 1.000 0.000 0 0.000
#> GSM1060762 3 0.0000 1.000 0.000 0.000 1 0.000
#> GSM1060731 3 0.0000 1.000 0.000 0.000 1 0.000
#> GSM1060750 4 0.0000 0.987 0.000 0.000 0 1.000
#> GSM1060749 4 0.0469 0.982 0.012 0.000 0 0.988
#> GSM1060736 1 0.0000 0.995 1.000 0.000 0 0.000
#> GSM1060748 4 0.0000 0.987 0.000 0.000 0 1.000
#> GSM1060751 1 0.0000 0.995 1.000 0.000 0 0.000
#> GSM1060766 1 0.0000 0.995 1.000 0.000 0 0.000
#> GSM1060757 4 0.1389 0.940 0.048 0.000 0 0.952
#> GSM1060726 3 0.0000 1.000 0.000 0.000 1 0.000
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> GSM1060768 5 0.0000 0.998 0.000 0.000 0.000 0.000 1.000
#> GSM1060769 5 0.0000 0.998 0.000 0.000 0.000 0.000 1.000
#> GSM1060770 5 0.0000 0.998 0.000 0.000 0.000 0.000 1.000
#> GSM1060771 2 0.2891 0.989 0.000 0.824 0.000 0.000 0.176
#> GSM1060772 5 0.0000 0.998 0.000 0.000 0.000 0.000 1.000
#> GSM1060773 2 0.3620 0.905 0.000 0.824 0.000 0.068 0.108
#> GSM1060774 5 0.0000 0.998 0.000 0.000 0.000 0.000 1.000
#> GSM1060775 5 0.0000 0.998 0.000 0.000 0.000 0.000 1.000
#> GSM1060776 5 0.0000 0.998 0.000 0.000 0.000 0.000 1.000
#> GSM1060777 2 0.2891 0.989 0.000 0.824 0.000 0.000 0.176
#> GSM1060778 5 0.0000 0.998 0.000 0.000 0.000 0.000 1.000
#> GSM1060779 5 0.0000 0.998 0.000 0.000 0.000 0.000 1.000
#> GSM1060780 5 0.0609 0.975 0.000 0.020 0.000 0.000 0.980
#> GSM1060781 2 0.2891 0.989 0.000 0.824 0.000 0.000 0.176
#> GSM1060782 5 0.0000 0.998 0.000 0.000 0.000 0.000 1.000
#> GSM1060783 2 0.2891 0.989 0.000 0.824 0.000 0.000 0.176
#> GSM1060784 2 0.2891 0.989 0.000 0.824 0.000 0.000 0.176
#> GSM1060785 2 0.2891 0.989 0.000 0.824 0.000 0.000 0.176
#> GSM1060786 5 0.0000 0.998 0.000 0.000 0.000 0.000 1.000
#> GSM1060787 2 0.2891 0.989 0.000 0.824 0.000 0.000 0.176
#> GSM1060788 2 0.2891 0.989 0.000 0.824 0.000 0.000 0.176
#> GSM1060789 2 0.2891 0.989 0.000 0.824 0.000 0.000 0.176
#> GSM1060790 5 0.0000 0.998 0.000 0.000 0.000 0.000 1.000
#> GSM1060754 1 0.0162 0.925 0.996 0.004 0.000 0.000 0.000
#> GSM1060745 1 0.0290 0.925 0.992 0.008 0.000 0.000 0.000
#> GSM1060756 1 0.0162 0.925 0.996 0.004 0.000 0.000 0.000
#> GSM1060746 1 0.0162 0.925 0.996 0.004 0.000 0.000 0.000
#> GSM1060758 4 0.0162 0.969 0.000 0.004 0.000 0.996 0.000
#> GSM1060765 1 0.2471 0.920 0.864 0.136 0.000 0.000 0.000
#> GSM1060732 3 0.0000 1.000 0.000 0.000 1.000 0.000 0.000
#> GSM1060727 3 0.0000 1.000 0.000 0.000 1.000 0.000 0.000
#> GSM1060740 1 0.2970 0.911 0.828 0.168 0.000 0.004 0.000
#> GSM1060730 3 0.0000 1.000 0.000 0.000 1.000 0.000 0.000
#> GSM1060737 1 0.0404 0.927 0.988 0.012 0.000 0.000 0.000
#> GSM1060743 1 0.2806 0.916 0.844 0.152 0.000 0.004 0.000
#> GSM1060734 1 0.0162 0.925 0.996 0.004 0.000 0.000 0.000
#> GSM1060729 3 0.0000 1.000 0.000 0.000 1.000 0.000 0.000
#> GSM1060744 1 0.2230 0.921 0.884 0.116 0.000 0.000 0.000
#> GSM1060742 1 0.4069 0.819 0.788 0.076 0.000 0.136 0.000
#> GSM1060752 1 0.2930 0.912 0.832 0.164 0.000 0.004 0.000
#> GSM1060755 4 0.0510 0.968 0.000 0.016 0.000 0.984 0.000
#> GSM1060761 4 0.0324 0.968 0.000 0.004 0.004 0.992 0.000
#> GSM1060760 4 0.0324 0.968 0.000 0.004 0.004 0.992 0.000
#> GSM1060767 1 0.0162 0.925 0.996 0.004 0.000 0.000 0.000
#> GSM1060741 1 0.3013 0.913 0.832 0.160 0.000 0.008 0.000
#> GSM1060759 4 0.0162 0.969 0.000 0.004 0.000 0.996 0.000
#> GSM1060728 3 0.0000 1.000 0.000 0.000 1.000 0.000 0.000
#> GSM1060763 1 0.0162 0.925 0.996 0.004 0.000 0.000 0.000
#> GSM1060747 1 0.2970 0.911 0.828 0.168 0.000 0.004 0.000
#> GSM1060764 1 0.0000 0.926 1.000 0.000 0.000 0.000 0.000
#> GSM1060733 1 0.0162 0.925 0.996 0.004 0.000 0.000 0.000
#> GSM1060735 1 0.0404 0.927 0.988 0.012 0.000 0.000 0.000
#> GSM1060739 1 0.3093 0.909 0.824 0.168 0.000 0.008 0.000
#> GSM1060753 4 0.0000 0.969 0.000 0.000 0.000 1.000 0.000
#> GSM1060738 1 0.2970 0.911 0.828 0.168 0.000 0.004 0.000
#> GSM1060762 3 0.0000 1.000 0.000 0.000 1.000 0.000 0.000
#> GSM1060731 3 0.0000 1.000 0.000 0.000 1.000 0.000 0.000
#> GSM1060750 4 0.0510 0.968 0.000 0.016 0.000 0.984 0.000
#> GSM1060749 4 0.2280 0.881 0.000 0.120 0.000 0.880 0.000
#> GSM1060736 1 0.0404 0.927 0.988 0.012 0.000 0.000 0.000
#> GSM1060748 4 0.0510 0.968 0.000 0.016 0.000 0.984 0.000
#> GSM1060751 1 0.2806 0.916 0.844 0.152 0.000 0.004 0.000
#> GSM1060766 1 0.2719 0.918 0.852 0.144 0.000 0.004 0.000
#> GSM1060757 4 0.2079 0.915 0.064 0.020 0.000 0.916 0.000
#> GSM1060726 3 0.0000 1.000 0.000 0.000 1.000 0.000 0.000
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> GSM1060768 5 0.0000 0.9930 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM1060769 5 0.0000 0.9930 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM1060770 5 0.0000 0.9930 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM1060771 2 0.0458 0.9939 0.000 0.984 0.000 0.000 0.016 0.000
#> GSM1060772 5 0.0000 0.9930 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM1060773 2 0.0779 0.9817 0.000 0.976 0.000 0.008 0.008 0.008
#> GSM1060774 5 0.0000 0.9930 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM1060775 5 0.0000 0.9930 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM1060776 5 0.0000 0.9930 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM1060777 2 0.0458 0.9939 0.000 0.984 0.000 0.000 0.016 0.000
#> GSM1060778 5 0.0000 0.9930 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM1060779 5 0.0000 0.9930 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM1060780 5 0.1556 0.9118 0.000 0.080 0.000 0.000 0.920 0.000
#> GSM1060781 2 0.0458 0.9939 0.000 0.984 0.000 0.000 0.016 0.000
#> GSM1060782 5 0.0000 0.9930 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM1060783 2 0.0717 0.9935 0.000 0.976 0.000 0.000 0.016 0.008
#> GSM1060784 2 0.0914 0.9917 0.000 0.968 0.000 0.000 0.016 0.016
#> GSM1060785 2 0.0603 0.9939 0.000 0.980 0.000 0.000 0.016 0.004
#> GSM1060786 5 0.0000 0.9930 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM1060787 2 0.0820 0.9925 0.000 0.972 0.000 0.000 0.016 0.012
#> GSM1060788 2 0.0914 0.9917 0.000 0.968 0.000 0.000 0.016 0.016
#> GSM1060789 2 0.0458 0.9939 0.000 0.984 0.000 0.000 0.016 0.000
#> GSM1060790 5 0.0000 0.9930 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM1060754 1 0.1267 0.8923 0.940 0.000 0.000 0.000 0.000 0.060
#> GSM1060745 1 0.0858 0.8541 0.968 0.004 0.000 0.000 0.000 0.028
#> GSM1060756 1 0.0937 0.8896 0.960 0.000 0.000 0.000 0.000 0.040
#> GSM1060746 1 0.1501 0.8908 0.924 0.000 0.000 0.000 0.000 0.076
#> GSM1060758 4 0.1196 0.9300 0.000 0.008 0.000 0.952 0.000 0.040
#> GSM1060765 6 0.3668 0.6111 0.328 0.004 0.000 0.000 0.000 0.668
#> GSM1060732 3 0.0000 0.9890 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1060727 3 0.0000 0.9890 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1060740 6 0.2219 0.7773 0.136 0.000 0.000 0.000 0.000 0.864
#> GSM1060730 3 0.0000 0.9890 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1060737 1 0.2933 0.7921 0.796 0.004 0.000 0.000 0.000 0.200
#> GSM1060743 6 0.3175 0.7260 0.256 0.000 0.000 0.000 0.000 0.744
#> GSM1060734 1 0.0291 0.8716 0.992 0.004 0.000 0.000 0.000 0.004
#> GSM1060729 3 0.0000 0.9890 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1060744 6 0.3797 0.4672 0.420 0.000 0.000 0.000 0.000 0.580
#> GSM1060742 6 0.5490 0.3731 0.344 0.000 0.000 0.140 0.000 0.516
#> GSM1060752 6 0.2597 0.7752 0.176 0.000 0.000 0.000 0.000 0.824
#> GSM1060755 4 0.1610 0.9213 0.000 0.000 0.000 0.916 0.000 0.084
#> GSM1060761 4 0.1340 0.9289 0.004 0.008 0.000 0.948 0.000 0.040
#> GSM1060760 4 0.1340 0.9289 0.004 0.008 0.000 0.948 0.000 0.040
#> GSM1060767 1 0.0291 0.8709 0.992 0.004 0.000 0.000 0.000 0.004
#> GSM1060741 6 0.2520 0.7458 0.152 0.000 0.000 0.004 0.000 0.844
#> GSM1060759 4 0.1196 0.9300 0.000 0.008 0.000 0.952 0.000 0.040
#> GSM1060728 3 0.0000 0.9890 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1060763 1 0.1610 0.8894 0.916 0.000 0.000 0.000 0.000 0.084
#> GSM1060747 6 0.2402 0.7747 0.140 0.004 0.000 0.000 0.000 0.856
#> GSM1060764 1 0.1910 0.8751 0.892 0.000 0.000 0.000 0.000 0.108
#> GSM1060733 1 0.0508 0.8664 0.984 0.004 0.000 0.000 0.000 0.012
#> GSM1060735 1 0.3052 0.7697 0.780 0.004 0.000 0.000 0.000 0.216
#> GSM1060739 6 0.1757 0.7584 0.076 0.000 0.000 0.008 0.000 0.916
#> GSM1060753 4 0.0790 0.9316 0.000 0.000 0.000 0.968 0.000 0.032
#> GSM1060738 6 0.2135 0.7761 0.128 0.000 0.000 0.000 0.000 0.872
#> GSM1060762 3 0.1946 0.9203 0.072 0.004 0.912 0.000 0.000 0.012
#> GSM1060731 3 0.0000 0.9890 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1060750 4 0.1556 0.9244 0.000 0.000 0.000 0.920 0.000 0.080
#> GSM1060749 6 0.3857 -0.0566 0.000 0.000 0.000 0.468 0.000 0.532
#> GSM1060736 1 0.2933 0.7924 0.796 0.004 0.000 0.000 0.000 0.200
#> GSM1060748 4 0.1700 0.9236 0.000 0.004 0.000 0.916 0.000 0.080
#> GSM1060751 6 0.3136 0.7402 0.228 0.004 0.000 0.000 0.000 0.768
#> GSM1060766 6 0.3215 0.7135 0.240 0.004 0.000 0.000 0.000 0.756
#> GSM1060757 4 0.3063 0.8669 0.068 0.000 0.000 0.840 0.000 0.092
#> GSM1060726 3 0.0000 0.9890 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)
Test correlation between subgroups and known annotations. If the known annotation is numeric, one-way ANOVA test is applied, and if the known annotation is discrete, chi-squared contingency table test is applied.
test_to_known_factors(res)
#> n disease.state(p) tissue(p) k
#> MAD:skmeans 65 2.12e-09 0.012934 2
#> MAD:skmeans 61 5.68e-14 0.000644 3
#> MAD:skmeans 64 8.21e-14 0.000139 4
#> MAD:skmeans 65 2.57e-13 0.075410 5
#> MAD:skmeans 62 4.69e-12 0.006102 6
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 51941 rows and 65 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 5.
#>
#> Following methods can be applied to this 'ConsensusPartition' object:
#> [1] "cola_report" "collect_classes" "collect_plots"
#> [4] "collect_stats" "colnames" "compare_signatures"
#> [7] "consensus_heatmap" "dimension_reduction" "functional_enrichment"
#> [10] "get_anno_col" "get_anno" "get_classes"
#> [13] "get_consensus" "get_matrix" "get_membership"
#> [16] "get_param" "get_signatures" "get_stats"
#> [19] "is_best_k" "is_stable_k" "membership_heatmap"
#> [22] "ncol" "nrow" "plot_ecdf"
#> [25] "rownames" "select_partition_number" "show"
#> [28] "suggest_best_k" "test_to_known_factors"
collect_plots()
function collects all the plots made from res
for all k
(number of partitions)
into one single page to provide an easy and fast comparison between different k
.
collect_plots(res)
The plots are:
k
and the heatmap of
predicted classes for each k
.k
.k
.k
.All the plots in panels can be made by individual functions and they are plotted later in this section.
select_partition_number()
produces several plots showing different
statistics for choosing “optimized” k
. There are following statistics:
k
;k
, the area increased is defined as \(A_k - A_{k-1}\).The detailed explanations of these statistics can be found in the cola vignette.
Generally speaking, lower PAC score, higher mean silhouette score or higher
concordance corresponds to better partition. Rand index and Jaccard index
measure how similar the current partition is compared to partition with k-1
.
If they are too similar, we won't accept k
is better than k-1
.
select_partition_number(res)
The numeric values for all these statistics can be obtained by get_stats()
.
get_stats(res)
#> k 1-PAC mean_silhouette concordance area_increased Rand Jaccard
#> 2 2 1.000 0.965 0.985 0.5038 0.495 0.495
#> 3 3 0.973 0.931 0.975 0.1758 0.916 0.831
#> 4 4 0.936 0.878 0.944 0.2048 0.815 0.582
#> 5 5 0.914 0.876 0.948 0.0947 0.904 0.680
#> 6 6 0.880 0.852 0.927 0.0249 0.983 0.920
suggest_best_k()
suggests the best \(k\) based on these statistics. The rules are as follows:
suggest_best_k(res)
#> [1] 5
#> attr(,"optional")
#> [1] 2 3 4
There is also optional best \(k\) = 2 3 4 that is worth to check.
Following shows the table of the partitions (You need to click the show/hide
code output link to see it). The membership matrix (columns with name p*
)
is inferred by
clue::cl_consensus()
function with the SE
method. Basically the value in the membership matrix
represents the probability to belong to a certain group. The finall class
label for an item is determined with the group with highest probability it
belongs to.
In get_classes()
function, the entropy is calculated from the membership
matrix and the silhouette score is calculated from the consensus matrix.
cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#> class entropy silhouette p1 p2
#> GSM1060768 2 0.000 0.975 0.000 1.000
#> GSM1060769 2 0.000 0.975 0.000 1.000
#> GSM1060770 2 0.000 0.975 0.000 1.000
#> GSM1060771 2 0.000 0.975 0.000 1.000
#> GSM1060772 2 0.000 0.975 0.000 1.000
#> GSM1060773 2 0.000 0.975 0.000 1.000
#> GSM1060774 2 0.000 0.975 0.000 1.000
#> GSM1060775 2 0.000 0.975 0.000 1.000
#> GSM1060776 2 0.000 0.975 0.000 1.000
#> GSM1060777 2 0.000 0.975 0.000 1.000
#> GSM1060778 2 0.000 0.975 0.000 1.000
#> GSM1060779 2 0.000 0.975 0.000 1.000
#> GSM1060780 2 0.000 0.975 0.000 1.000
#> GSM1060781 2 0.000 0.975 0.000 1.000
#> GSM1060782 2 0.000 0.975 0.000 1.000
#> GSM1060783 2 0.000 0.975 0.000 1.000
#> GSM1060784 2 0.000 0.975 0.000 1.000
#> GSM1060785 2 0.000 0.975 0.000 1.000
#> GSM1060786 2 0.000 0.975 0.000 1.000
#> GSM1060787 2 0.000 0.975 0.000 1.000
#> GSM1060788 2 0.000 0.975 0.000 1.000
#> GSM1060789 2 0.000 0.975 0.000 1.000
#> GSM1060790 2 0.000 0.975 0.000 1.000
#> GSM1060754 1 0.000 0.992 1.000 0.000
#> GSM1060745 1 0.000 0.992 1.000 0.000
#> GSM1060756 1 0.000 0.992 1.000 0.000
#> GSM1060746 1 0.000 0.992 1.000 0.000
#> GSM1060758 2 0.000 0.975 0.000 1.000
#> GSM1060765 1 0.000 0.992 1.000 0.000
#> GSM1060732 1 0.000 0.992 1.000 0.000
#> GSM1060727 1 0.000 0.992 1.000 0.000
#> GSM1060740 1 0.000 0.992 1.000 0.000
#> GSM1060730 1 0.000 0.992 1.000 0.000
#> GSM1060737 1 0.000 0.992 1.000 0.000
#> GSM1060743 1 0.000 0.992 1.000 0.000
#> GSM1060734 1 0.000 0.992 1.000 0.000
#> GSM1060729 1 0.000 0.992 1.000 0.000
#> GSM1060744 1 0.000 0.992 1.000 0.000
#> GSM1060742 1 0.000 0.992 1.000 0.000
#> GSM1060752 1 0.000 0.992 1.000 0.000
#> GSM1060755 1 0.000 0.992 1.000 0.000
#> GSM1060761 2 0.000 0.975 0.000 1.000
#> GSM1060760 2 0.722 0.756 0.200 0.800
#> GSM1060767 1 0.000 0.992 1.000 0.000
#> GSM1060741 1 0.000 0.992 1.000 0.000
#> GSM1060759 2 0.388 0.907 0.076 0.924
#> GSM1060728 1 0.730 0.742 0.796 0.204
#> GSM1060763 1 0.000 0.992 1.000 0.000
#> GSM1060747 1 0.000 0.992 1.000 0.000
#> GSM1060764 1 0.000 0.992 1.000 0.000
#> GSM1060733 1 0.000 0.992 1.000 0.000
#> GSM1060735 1 0.000 0.992 1.000 0.000
#> GSM1060739 1 0.000 0.992 1.000 0.000
#> GSM1060753 1 0.000 0.992 1.000 0.000
#> GSM1060738 1 0.000 0.992 1.000 0.000
#> GSM1060762 2 0.966 0.354 0.392 0.608
#> GSM1060731 1 0.000 0.992 1.000 0.000
#> GSM1060750 2 0.278 0.934 0.048 0.952
#> GSM1060749 1 0.118 0.978 0.984 0.016
#> GSM1060736 1 0.000 0.992 1.000 0.000
#> GSM1060748 2 0.000 0.975 0.000 1.000
#> GSM1060751 1 0.000 0.992 1.000 0.000
#> GSM1060766 1 0.224 0.958 0.964 0.036
#> GSM1060757 1 0.000 0.992 1.000 0.000
#> GSM1060726 1 0.000 0.992 1.000 0.000
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> GSM1060768 2 0.0000 0.955 0.000 1.000 0.000
#> GSM1060769 2 0.0000 0.955 0.000 1.000 0.000
#> GSM1060770 2 0.0000 0.955 0.000 1.000 0.000
#> GSM1060771 2 0.0000 0.955 0.000 1.000 0.000
#> GSM1060772 2 0.0000 0.955 0.000 1.000 0.000
#> GSM1060773 2 0.0237 0.953 0.004 0.996 0.000
#> GSM1060774 2 0.0000 0.955 0.000 1.000 0.000
#> GSM1060775 2 0.0000 0.955 0.000 1.000 0.000
#> GSM1060776 2 0.0000 0.955 0.000 1.000 0.000
#> GSM1060777 2 0.0000 0.955 0.000 1.000 0.000
#> GSM1060778 2 0.0000 0.955 0.000 1.000 0.000
#> GSM1060779 2 0.0000 0.955 0.000 1.000 0.000
#> GSM1060780 2 0.0000 0.955 0.000 1.000 0.000
#> GSM1060781 2 0.0237 0.953 0.004 0.996 0.000
#> GSM1060782 2 0.0000 0.955 0.000 1.000 0.000
#> GSM1060783 2 0.0000 0.955 0.000 1.000 0.000
#> GSM1060784 2 0.0000 0.955 0.000 1.000 0.000
#> GSM1060785 2 0.0000 0.955 0.000 1.000 0.000
#> GSM1060786 2 0.0000 0.955 0.000 1.000 0.000
#> GSM1060787 2 0.0000 0.955 0.000 1.000 0.000
#> GSM1060788 2 0.0000 0.955 0.000 1.000 0.000
#> GSM1060789 2 0.0000 0.955 0.000 1.000 0.000
#> GSM1060790 2 0.0000 0.955 0.000 1.000 0.000
#> GSM1060754 1 0.0000 0.977 1.000 0.000 0.000
#> GSM1060745 1 0.0000 0.977 1.000 0.000 0.000
#> GSM1060756 1 0.0000 0.977 1.000 0.000 0.000
#> GSM1060746 1 0.0000 0.977 1.000 0.000 0.000
#> GSM1060758 2 0.0237 0.953 0.004 0.996 0.000
#> GSM1060765 1 0.0000 0.977 1.000 0.000 0.000
#> GSM1060732 3 0.0000 1.000 0.000 0.000 1.000
#> GSM1060727 3 0.0000 1.000 0.000 0.000 1.000
#> GSM1060740 1 0.0000 0.977 1.000 0.000 0.000
#> GSM1060730 3 0.0000 1.000 0.000 0.000 1.000
#> GSM1060737 1 0.0000 0.977 1.000 0.000 0.000
#> GSM1060743 1 0.0000 0.977 1.000 0.000 0.000
#> GSM1060734 1 0.0000 0.977 1.000 0.000 0.000
#> GSM1060729 3 0.0000 1.000 0.000 0.000 1.000
#> GSM1060744 1 0.0000 0.977 1.000 0.000 0.000
#> GSM1060742 1 0.0000 0.977 1.000 0.000 0.000
#> GSM1060752 1 0.0000 0.977 1.000 0.000 0.000
#> GSM1060755 1 0.0000 0.977 1.000 0.000 0.000
#> GSM1060761 2 0.0237 0.953 0.004 0.996 0.000
#> GSM1060760 2 0.5835 0.496 0.340 0.660 0.000
#> GSM1060767 1 0.0000 0.977 1.000 0.000 0.000
#> GSM1060741 1 0.0000 0.977 1.000 0.000 0.000
#> GSM1060759 2 0.4121 0.761 0.168 0.832 0.000
#> GSM1060728 1 0.9787 -0.122 0.412 0.240 0.348
#> GSM1060763 1 0.0000 0.977 1.000 0.000 0.000
#> GSM1060747 1 0.0000 0.977 1.000 0.000 0.000
#> GSM1060764 1 0.0000 0.977 1.000 0.000 0.000
#> GSM1060733 1 0.0000 0.977 1.000 0.000 0.000
#> GSM1060735 1 0.0000 0.977 1.000 0.000 0.000
#> GSM1060739 1 0.0000 0.977 1.000 0.000 0.000
#> GSM1060753 1 0.0000 0.977 1.000 0.000 0.000
#> GSM1060738 1 0.0000 0.977 1.000 0.000 0.000
#> GSM1060762 2 0.6062 0.385 0.384 0.616 0.000
#> GSM1060731 3 0.0000 1.000 0.000 0.000 1.000
#> GSM1060750 2 0.2959 0.849 0.100 0.900 0.000
#> GSM1060749 1 0.0000 0.977 1.000 0.000 0.000
#> GSM1060736 1 0.0000 0.977 1.000 0.000 0.000
#> GSM1060748 2 0.0237 0.953 0.004 0.996 0.000
#> GSM1060751 1 0.0000 0.977 1.000 0.000 0.000
#> GSM1060766 1 0.1163 0.944 0.972 0.028 0.000
#> GSM1060757 1 0.0000 0.977 1.000 0.000 0.000
#> GSM1060726 3 0.0000 1.000 0.000 0.000 1.000
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> GSM1060768 2 0.0000 0.9745 0.000 1.000 0.000 0.000
#> GSM1060769 2 0.0000 0.9745 0.000 1.000 0.000 0.000
#> GSM1060770 2 0.0000 0.9745 0.000 1.000 0.000 0.000
#> GSM1060771 2 0.1474 0.9736 0.000 0.948 0.000 0.052
#> GSM1060772 2 0.1389 0.9741 0.000 0.952 0.000 0.048
#> GSM1060773 2 0.1474 0.9736 0.000 0.948 0.000 0.052
#> GSM1060774 2 0.0000 0.9745 0.000 1.000 0.000 0.000
#> GSM1060775 2 0.0000 0.9745 0.000 1.000 0.000 0.000
#> GSM1060776 2 0.0000 0.9745 0.000 1.000 0.000 0.000
#> GSM1060777 2 0.1474 0.9736 0.000 0.948 0.000 0.052
#> GSM1060778 2 0.0000 0.9745 0.000 1.000 0.000 0.000
#> GSM1060779 2 0.0000 0.9745 0.000 1.000 0.000 0.000
#> GSM1060780 2 0.0817 0.9750 0.000 0.976 0.000 0.024
#> GSM1060781 2 0.1474 0.9736 0.000 0.948 0.000 0.052
#> GSM1060782 2 0.0000 0.9745 0.000 1.000 0.000 0.000
#> GSM1060783 2 0.1474 0.9736 0.000 0.948 0.000 0.052
#> GSM1060784 2 0.1389 0.9742 0.000 0.952 0.000 0.048
#> GSM1060785 2 0.1474 0.9736 0.000 0.948 0.000 0.052
#> GSM1060786 2 0.0000 0.9745 0.000 1.000 0.000 0.000
#> GSM1060787 2 0.1474 0.9736 0.000 0.948 0.000 0.052
#> GSM1060788 2 0.1474 0.9736 0.000 0.948 0.000 0.052
#> GSM1060789 2 0.1474 0.9736 0.000 0.948 0.000 0.052
#> GSM1060790 2 0.0000 0.9745 0.000 1.000 0.000 0.000
#> GSM1060754 1 0.0000 0.9003 1.000 0.000 0.000 0.000
#> GSM1060745 1 0.0000 0.9003 1.000 0.000 0.000 0.000
#> GSM1060756 1 0.0000 0.9003 1.000 0.000 0.000 0.000
#> GSM1060746 1 0.0000 0.9003 1.000 0.000 0.000 0.000
#> GSM1060758 4 0.0000 0.8833 0.000 0.000 0.000 1.000
#> GSM1060765 1 0.0000 0.9003 1.000 0.000 0.000 0.000
#> GSM1060732 3 0.0000 1.0000 0.000 0.000 1.000 0.000
#> GSM1060727 3 0.0000 1.0000 0.000 0.000 1.000 0.000
#> GSM1060740 1 0.0000 0.9003 1.000 0.000 0.000 0.000
#> GSM1060730 3 0.0000 1.0000 0.000 0.000 1.000 0.000
#> GSM1060737 1 0.0000 0.9003 1.000 0.000 0.000 0.000
#> GSM1060743 1 0.1557 0.8626 0.944 0.000 0.000 0.056
#> GSM1060734 1 0.0000 0.9003 1.000 0.000 0.000 0.000
#> GSM1060729 3 0.0000 1.0000 0.000 0.000 1.000 0.000
#> GSM1060744 1 0.0000 0.9003 1.000 0.000 0.000 0.000
#> GSM1060742 4 0.4072 0.6966 0.252 0.000 0.000 0.748
#> GSM1060752 1 0.2011 0.8428 0.920 0.000 0.000 0.080
#> GSM1060755 4 0.1474 0.9054 0.052 0.000 0.000 0.948
#> GSM1060761 4 0.0000 0.8833 0.000 0.000 0.000 1.000
#> GSM1060760 4 0.1302 0.9050 0.044 0.000 0.000 0.956
#> GSM1060767 1 0.0000 0.9003 1.000 0.000 0.000 0.000
#> GSM1060741 1 0.4998 -0.0378 0.512 0.000 0.000 0.488
#> GSM1060759 4 0.0469 0.8923 0.012 0.000 0.000 0.988
#> GSM1060728 1 0.7563 0.1128 0.480 0.140 0.368 0.012
#> GSM1060763 1 0.0000 0.9003 1.000 0.000 0.000 0.000
#> GSM1060747 4 0.4730 0.4663 0.364 0.000 0.000 0.636
#> GSM1060764 1 0.0000 0.9003 1.000 0.000 0.000 0.000
#> GSM1060733 1 0.0000 0.9003 1.000 0.000 0.000 0.000
#> GSM1060735 1 0.0000 0.9003 1.000 0.000 0.000 0.000
#> GSM1060739 4 0.2647 0.8552 0.120 0.000 0.000 0.880
#> GSM1060753 4 0.1474 0.9054 0.052 0.000 0.000 0.948
#> GSM1060738 1 0.3074 0.7690 0.848 0.000 0.000 0.152
#> GSM1060762 1 0.7862 -0.0470 0.388 0.280 0.000 0.332
#> GSM1060731 3 0.0000 1.0000 0.000 0.000 1.000 0.000
#> GSM1060750 4 0.0817 0.8994 0.024 0.000 0.000 0.976
#> GSM1060749 4 0.1474 0.9054 0.052 0.000 0.000 0.948
#> GSM1060736 1 0.0000 0.9003 1.000 0.000 0.000 0.000
#> GSM1060748 4 0.0000 0.8833 0.000 0.000 0.000 1.000
#> GSM1060751 1 0.0000 0.9003 1.000 0.000 0.000 0.000
#> GSM1060766 1 0.3024 0.7737 0.852 0.000 0.000 0.148
#> GSM1060757 4 0.1474 0.9054 0.052 0.000 0.000 0.948
#> GSM1060726 3 0.0000 1.0000 0.000 0.000 1.000 0.000
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> GSM1060768 5 0.000 1.000 0.000 0.000 0.000 0.000 1.000
#> GSM1060769 5 0.000 1.000 0.000 0.000 0.000 0.000 1.000
#> GSM1060770 5 0.000 1.000 0.000 0.000 0.000 0.000 1.000
#> GSM1060771 2 0.000 0.940 0.000 1.000 0.000 0.000 0.000
#> GSM1060772 2 0.380 0.610 0.000 0.700 0.000 0.000 0.300
#> GSM1060773 2 0.000 0.940 0.000 1.000 0.000 0.000 0.000
#> GSM1060774 5 0.000 1.000 0.000 0.000 0.000 0.000 1.000
#> GSM1060775 5 0.000 1.000 0.000 0.000 0.000 0.000 1.000
#> GSM1060776 5 0.000 1.000 0.000 0.000 0.000 0.000 1.000
#> GSM1060777 2 0.000 0.940 0.000 1.000 0.000 0.000 0.000
#> GSM1060778 5 0.000 1.000 0.000 0.000 0.000 0.000 1.000
#> GSM1060779 5 0.000 1.000 0.000 0.000 0.000 0.000 1.000
#> GSM1060780 2 0.364 0.657 0.000 0.728 0.000 0.000 0.272
#> GSM1060781 2 0.000 0.940 0.000 1.000 0.000 0.000 0.000
#> GSM1060782 5 0.000 1.000 0.000 0.000 0.000 0.000 1.000
#> GSM1060783 2 0.000 0.940 0.000 1.000 0.000 0.000 0.000
#> GSM1060784 2 0.000 0.940 0.000 1.000 0.000 0.000 0.000
#> GSM1060785 2 0.000 0.940 0.000 1.000 0.000 0.000 0.000
#> GSM1060786 5 0.000 1.000 0.000 0.000 0.000 0.000 1.000
#> GSM1060787 2 0.000 0.940 0.000 1.000 0.000 0.000 0.000
#> GSM1060788 2 0.000 0.940 0.000 1.000 0.000 0.000 0.000
#> GSM1060789 2 0.000 0.940 0.000 1.000 0.000 0.000 0.000
#> GSM1060790 5 0.000 1.000 0.000 0.000 0.000 0.000 1.000
#> GSM1060754 1 0.000 0.939 1.000 0.000 0.000 0.000 0.000
#> GSM1060745 1 0.000 0.939 1.000 0.000 0.000 0.000 0.000
#> GSM1060756 1 0.000 0.939 1.000 0.000 0.000 0.000 0.000
#> GSM1060746 1 0.000 0.939 1.000 0.000 0.000 0.000 0.000
#> GSM1060758 4 0.000 0.855 0.000 0.000 0.000 1.000 0.000
#> GSM1060765 1 0.000 0.939 1.000 0.000 0.000 0.000 0.000
#> GSM1060732 3 0.000 1.000 0.000 0.000 1.000 0.000 0.000
#> GSM1060727 3 0.000 1.000 0.000 0.000 1.000 0.000 0.000
#> GSM1060740 1 0.000 0.939 1.000 0.000 0.000 0.000 0.000
#> GSM1060730 3 0.000 1.000 0.000 0.000 1.000 0.000 0.000
#> GSM1060737 1 0.000 0.939 1.000 0.000 0.000 0.000 0.000
#> GSM1060743 1 0.185 0.867 0.912 0.000 0.000 0.088 0.000
#> GSM1060734 1 0.000 0.939 1.000 0.000 0.000 0.000 0.000
#> GSM1060729 3 0.000 1.000 0.000 0.000 1.000 0.000 0.000
#> GSM1060744 1 0.000 0.939 1.000 0.000 0.000 0.000 0.000
#> GSM1060742 4 0.311 0.711 0.200 0.000 0.000 0.800 0.000
#> GSM1060752 1 0.213 0.846 0.892 0.000 0.000 0.108 0.000
#> GSM1060755 4 0.000 0.855 0.000 0.000 0.000 1.000 0.000
#> GSM1060761 4 0.000 0.855 0.000 0.000 0.000 1.000 0.000
#> GSM1060760 4 0.000 0.855 0.000 0.000 0.000 1.000 0.000
#> GSM1060767 1 0.000 0.939 1.000 0.000 0.000 0.000 0.000
#> GSM1060741 4 0.429 0.144 0.468 0.000 0.000 0.532 0.000
#> GSM1060759 4 0.000 0.855 0.000 0.000 0.000 1.000 0.000
#> GSM1060728 1 0.645 0.141 0.476 0.196 0.328 0.000 0.000
#> GSM1060763 1 0.000 0.939 1.000 0.000 0.000 0.000 0.000
#> GSM1060747 4 0.386 0.557 0.312 0.000 0.000 0.688 0.000
#> GSM1060764 1 0.000 0.939 1.000 0.000 0.000 0.000 0.000
#> GSM1060733 1 0.000 0.939 1.000 0.000 0.000 0.000 0.000
#> GSM1060735 1 0.000 0.939 1.000 0.000 0.000 0.000 0.000
#> GSM1060739 4 0.154 0.815 0.068 0.000 0.000 0.932 0.000
#> GSM1060753 4 0.000 0.855 0.000 0.000 0.000 1.000 0.000
#> GSM1060738 1 0.314 0.721 0.796 0.000 0.000 0.204 0.000
#> GSM1060762 4 0.783 0.177 0.332 0.228 0.000 0.368 0.072
#> GSM1060731 3 0.000 1.000 0.000 0.000 1.000 0.000 0.000
#> GSM1060750 4 0.000 0.855 0.000 0.000 0.000 1.000 0.000
#> GSM1060749 4 0.000 0.855 0.000 0.000 0.000 1.000 0.000
#> GSM1060736 1 0.000 0.939 1.000 0.000 0.000 0.000 0.000
#> GSM1060748 4 0.000 0.855 0.000 0.000 0.000 1.000 0.000
#> GSM1060751 1 0.000 0.939 1.000 0.000 0.000 0.000 0.000
#> GSM1060766 1 0.311 0.727 0.800 0.000 0.000 0.200 0.000
#> GSM1060757 4 0.000 0.855 0.000 0.000 0.000 1.000 0.000
#> GSM1060726 3 0.000 1.000 0.000 0.000 1.000 0.000 0.000
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> GSM1060768 5 0.000 1.0000 0.000 0.000 0.00 0.000 1.000 0.000
#> GSM1060769 5 0.000 1.0000 0.000 0.000 0.00 0.000 1.000 0.000
#> GSM1060770 5 0.000 1.0000 0.000 0.000 0.00 0.000 1.000 0.000
#> GSM1060771 2 0.000 0.9347 0.000 1.000 0.00 0.000 0.000 0.000
#> GSM1060772 2 0.341 0.6043 0.000 0.700 0.00 0.000 0.300 0.000
#> GSM1060773 2 0.000 0.9347 0.000 1.000 0.00 0.000 0.000 0.000
#> GSM1060774 5 0.000 1.0000 0.000 0.000 0.00 0.000 1.000 0.000
#> GSM1060775 5 0.000 1.0000 0.000 0.000 0.00 0.000 1.000 0.000
#> GSM1060776 5 0.000 1.0000 0.000 0.000 0.00 0.000 1.000 0.000
#> GSM1060777 2 0.000 0.9347 0.000 1.000 0.00 0.000 0.000 0.000
#> GSM1060778 5 0.000 1.0000 0.000 0.000 0.00 0.000 1.000 0.000
#> GSM1060779 5 0.000 1.0000 0.000 0.000 0.00 0.000 1.000 0.000
#> GSM1060780 2 0.327 0.6425 0.000 0.728 0.00 0.000 0.272 0.000
#> GSM1060781 2 0.000 0.9347 0.000 1.000 0.00 0.000 0.000 0.000
#> GSM1060782 5 0.000 1.0000 0.000 0.000 0.00 0.000 1.000 0.000
#> GSM1060783 2 0.000 0.9347 0.000 1.000 0.00 0.000 0.000 0.000
#> GSM1060784 2 0.000 0.9347 0.000 1.000 0.00 0.000 0.000 0.000
#> GSM1060785 2 0.000 0.9347 0.000 1.000 0.00 0.000 0.000 0.000
#> GSM1060786 5 0.000 1.0000 0.000 0.000 0.00 0.000 1.000 0.000
#> GSM1060787 2 0.000 0.9347 0.000 1.000 0.00 0.000 0.000 0.000
#> GSM1060788 2 0.000 0.9347 0.000 1.000 0.00 0.000 0.000 0.000
#> GSM1060789 2 0.000 0.9347 0.000 1.000 0.00 0.000 0.000 0.000
#> GSM1060790 5 0.000 1.0000 0.000 0.000 0.00 0.000 1.000 0.000
#> GSM1060754 1 0.000 0.9095 1.000 0.000 0.00 0.000 0.000 0.000
#> GSM1060745 1 0.000 0.9095 1.000 0.000 0.00 0.000 0.000 0.000
#> GSM1060756 1 0.000 0.9095 1.000 0.000 0.00 0.000 0.000 0.000
#> GSM1060746 1 0.000 0.9095 1.000 0.000 0.00 0.000 0.000 0.000
#> GSM1060758 6 0.000 0.7223 0.000 0.000 0.00 0.000 0.000 1.000
#> GSM1060765 1 0.226 0.8683 0.860 0.000 0.00 0.140 0.000 0.000
#> GSM1060732 3 0.000 1.0000 0.000 0.000 1.00 0.000 0.000 0.000
#> GSM1060727 3 0.000 1.0000 0.000 0.000 1.00 0.000 0.000 0.000
#> GSM1060740 1 0.226 0.8683 0.860 0.000 0.00 0.140 0.000 0.000
#> GSM1060730 3 0.000 1.0000 0.000 0.000 1.00 0.000 0.000 0.000
#> GSM1060737 1 0.000 0.9095 1.000 0.000 0.00 0.000 0.000 0.000
#> GSM1060743 1 0.261 0.8613 0.848 0.000 0.00 0.140 0.000 0.012
#> GSM1060734 1 0.000 0.9095 1.000 0.000 0.00 0.000 0.000 0.000
#> GSM1060729 3 0.000 1.0000 0.000 0.000 1.00 0.000 0.000 0.000
#> GSM1060744 1 0.000 0.9095 1.000 0.000 0.00 0.000 0.000 0.000
#> GSM1060742 6 0.279 0.5895 0.200 0.000 0.00 0.000 0.000 0.800
#> GSM1060752 1 0.302 0.8463 0.828 0.000 0.00 0.140 0.000 0.032
#> GSM1060755 6 0.000 0.7223 0.000 0.000 0.00 0.000 0.000 1.000
#> GSM1060761 4 0.226 1.0000 0.000 0.000 0.00 0.860 0.000 0.140
#> GSM1060760 4 0.226 1.0000 0.000 0.000 0.00 0.860 0.000 0.140
#> GSM1060767 1 0.000 0.9095 1.000 0.000 0.00 0.000 0.000 0.000
#> GSM1060741 6 0.526 0.0378 0.448 0.000 0.00 0.096 0.000 0.456
#> GSM1060759 4 0.226 1.0000 0.000 0.000 0.00 0.860 0.000 0.140
#> GSM1060728 1 0.646 0.2443 0.476 0.152 0.32 0.052 0.000 0.000
#> GSM1060763 1 0.000 0.9095 1.000 0.000 0.00 0.000 0.000 0.000
#> GSM1060747 6 0.540 0.3983 0.312 0.000 0.00 0.140 0.000 0.548
#> GSM1060764 1 0.000 0.9095 1.000 0.000 0.00 0.000 0.000 0.000
#> GSM1060733 1 0.000 0.9095 1.000 0.000 0.00 0.000 0.000 0.000
#> GSM1060735 1 0.000 0.9095 1.000 0.000 0.00 0.000 0.000 0.000
#> GSM1060739 6 0.291 0.6526 0.068 0.000 0.00 0.080 0.000 0.852
#> GSM1060753 6 0.000 0.7223 0.000 0.000 0.00 0.000 0.000 1.000
#> GSM1060738 1 0.369 0.8023 0.784 0.000 0.00 0.140 0.000 0.076
#> GSM1060762 6 0.703 0.1315 0.332 0.228 0.00 0.000 0.072 0.368
#> GSM1060731 3 0.000 1.0000 0.000 0.000 1.00 0.000 0.000 0.000
#> GSM1060750 6 0.000 0.7223 0.000 0.000 0.00 0.000 0.000 1.000
#> GSM1060749 6 0.000 0.7223 0.000 0.000 0.00 0.000 0.000 1.000
#> GSM1060736 1 0.196 0.8790 0.888 0.000 0.00 0.112 0.000 0.000
#> GSM1060748 6 0.000 0.7223 0.000 0.000 0.00 0.000 0.000 1.000
#> GSM1060751 1 0.226 0.8683 0.860 0.000 0.00 0.140 0.000 0.000
#> GSM1060766 1 0.364 0.7711 0.788 0.000 0.00 0.072 0.000 0.140
#> GSM1060757 6 0.000 0.7223 0.000 0.000 0.00 0.000 0.000 1.000
#> GSM1060726 3 0.000 1.0000 0.000 0.000 1.00 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)
Test correlation between subgroups and known annotations. If the known annotation is numeric, one-way ANOVA test is applied, and if the known annotation is discrete, chi-squared contingency table test is applied.
test_to_known_factors(res)
#> n disease.state(p) tissue(p) k
#> MAD:pam 64 2.60e-10 1.23e-02 2
#> MAD:pam 62 2.28e-10 7.16e-04 3
#> MAD:pam 61 3.59e-13 4.41e-05 4
#> MAD:pam 62 1.10e-12 5.08e-02 5
#> MAD:pam 61 7.55e-12 4.97e-03 6
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 51941 rows and 65 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 5.
#>
#> Following methods can be applied to this 'ConsensusPartition' object:
#> [1] "cola_report" "collect_classes" "collect_plots"
#> [4] "collect_stats" "colnames" "compare_signatures"
#> [7] "consensus_heatmap" "dimension_reduction" "functional_enrichment"
#> [10] "get_anno_col" "get_anno" "get_classes"
#> [13] "get_consensus" "get_matrix" "get_membership"
#> [16] "get_param" "get_signatures" "get_stats"
#> [19] "is_best_k" "is_stable_k" "membership_heatmap"
#> [22] "ncol" "nrow" "plot_ecdf"
#> [25] "rownames" "select_partition_number" "show"
#> [28] "suggest_best_k" "test_to_known_factors"
collect_plots()
function collects all the plots made from res
for all k
(number of partitions)
into one single page to provide an easy and fast comparison between different k
.
collect_plots(res)
The plots are:
k
and the heatmap of
predicted classes for each k
.k
.k
.k
.All the plots in panels can be made by individual functions and they are plotted later in this section.
select_partition_number()
produces several plots showing different
statistics for choosing “optimized” k
. There are following statistics:
k
;k
, the area increased is defined as \(A_k - A_{k-1}\).The detailed explanations of these statistics can be found in the cola vignette.
Generally speaking, lower PAC score, higher mean silhouette score or higher
concordance corresponds to better partition. Rand index and Jaccard index
measure how similar the current partition is compared to partition with k-1
.
If they are too similar, we won't accept k
is better than k-1
.
select_partition_number(res)
The numeric values for all these statistics can be obtained by get_stats()
.
get_stats(res)
#> k 1-PAC mean_silhouette concordance area_increased Rand Jaccard
#> 2 2 1.000 0.990 0.994 0.4661 0.536 0.536
#> 3 3 0.893 0.936 0.963 0.3398 0.827 0.677
#> 4 4 0.847 0.933 0.928 0.0901 0.844 0.622
#> 5 5 0.971 0.954 0.976 0.0723 0.781 0.443
#> 6 6 0.861 0.929 0.936 0.0708 0.950 0.814
suggest_best_k()
suggests the best \(k\) based on these statistics. The rules are as follows:
suggest_best_k(res)
#> [1] 5
#> attr(,"optional")
#> [1] 2
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
#> GSM1060768 2 0.0000 0.997 0.000 1.000
#> GSM1060769 2 0.0000 0.997 0.000 1.000
#> GSM1060770 2 0.0000 0.997 0.000 1.000
#> GSM1060771 2 0.0376 0.998 0.004 0.996
#> GSM1060772 2 0.0376 0.998 0.004 0.996
#> GSM1060773 2 0.0938 0.990 0.012 0.988
#> GSM1060774 2 0.0000 0.997 0.000 1.000
#> GSM1060775 2 0.0000 0.997 0.000 1.000
#> GSM1060776 2 0.0000 0.997 0.000 1.000
#> GSM1060777 2 0.0376 0.998 0.004 0.996
#> GSM1060778 2 0.0000 0.997 0.000 1.000
#> GSM1060779 2 0.0000 0.997 0.000 1.000
#> GSM1060780 2 0.0376 0.998 0.004 0.996
#> GSM1060781 2 0.0376 0.998 0.004 0.996
#> GSM1060782 2 0.0000 0.997 0.000 1.000
#> GSM1060783 2 0.0376 0.998 0.004 0.996
#> GSM1060784 2 0.0376 0.998 0.004 0.996
#> GSM1060785 2 0.0376 0.998 0.004 0.996
#> GSM1060786 2 0.0000 0.997 0.000 1.000
#> GSM1060787 2 0.0376 0.998 0.004 0.996
#> GSM1060788 2 0.0376 0.998 0.004 0.996
#> GSM1060789 2 0.0376 0.998 0.004 0.996
#> GSM1060790 2 0.0000 0.997 0.000 1.000
#> GSM1060754 1 0.0000 0.991 1.000 0.000
#> GSM1060745 1 0.0000 0.991 1.000 0.000
#> GSM1060756 1 0.0000 0.991 1.000 0.000
#> GSM1060746 1 0.0000 0.991 1.000 0.000
#> GSM1060758 1 0.0000 0.991 1.000 0.000
#> GSM1060765 1 0.0000 0.991 1.000 0.000
#> GSM1060732 1 0.2603 0.962 0.956 0.044
#> GSM1060727 1 0.2603 0.962 0.956 0.044
#> GSM1060740 1 0.0000 0.991 1.000 0.000
#> GSM1060730 1 0.2603 0.962 0.956 0.044
#> GSM1060737 1 0.0000 0.991 1.000 0.000
#> GSM1060743 1 0.0000 0.991 1.000 0.000
#> GSM1060734 1 0.0000 0.991 1.000 0.000
#> GSM1060729 1 0.2603 0.962 0.956 0.044
#> GSM1060744 1 0.0000 0.991 1.000 0.000
#> GSM1060742 1 0.0000 0.991 1.000 0.000
#> GSM1060752 1 0.0000 0.991 1.000 0.000
#> GSM1060755 1 0.0000 0.991 1.000 0.000
#> GSM1060761 1 0.0000 0.991 1.000 0.000
#> GSM1060760 1 0.0000 0.991 1.000 0.000
#> GSM1060767 1 0.0000 0.991 1.000 0.000
#> GSM1060741 1 0.0000 0.991 1.000 0.000
#> GSM1060759 1 0.0000 0.991 1.000 0.000
#> GSM1060728 1 0.2603 0.962 0.956 0.044
#> GSM1060763 1 0.0000 0.991 1.000 0.000
#> GSM1060747 1 0.0000 0.991 1.000 0.000
#> GSM1060764 1 0.0000 0.991 1.000 0.000
#> GSM1060733 1 0.0000 0.991 1.000 0.000
#> GSM1060735 1 0.0000 0.991 1.000 0.000
#> GSM1060739 1 0.0000 0.991 1.000 0.000
#> GSM1060753 1 0.0000 0.991 1.000 0.000
#> GSM1060738 1 0.0000 0.991 1.000 0.000
#> GSM1060762 1 0.2603 0.962 0.956 0.044
#> GSM1060731 1 0.2603 0.962 0.956 0.044
#> GSM1060750 1 0.0000 0.991 1.000 0.000
#> GSM1060749 1 0.0000 0.991 1.000 0.000
#> GSM1060736 1 0.0000 0.991 1.000 0.000
#> GSM1060748 1 0.0000 0.991 1.000 0.000
#> GSM1060751 1 0.0000 0.991 1.000 0.000
#> GSM1060766 1 0.0000 0.991 1.000 0.000
#> GSM1060757 1 0.0000 0.991 1.000 0.000
#> GSM1060726 1 0.2603 0.962 0.956 0.044
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> GSM1060768 2 0.0000 0.996 0.000 1.000 0.000
#> GSM1060769 2 0.0000 0.996 0.000 1.000 0.000
#> GSM1060770 2 0.0000 0.996 0.000 1.000 0.000
#> GSM1060771 2 0.0237 0.997 0.004 0.996 0.000
#> GSM1060772 2 0.0237 0.997 0.004 0.996 0.000
#> GSM1060773 2 0.0747 0.982 0.016 0.984 0.000
#> GSM1060774 2 0.0000 0.996 0.000 1.000 0.000
#> GSM1060775 2 0.0000 0.996 0.000 1.000 0.000
#> GSM1060776 2 0.0000 0.996 0.000 1.000 0.000
#> GSM1060777 2 0.0237 0.997 0.004 0.996 0.000
#> GSM1060778 2 0.0000 0.996 0.000 1.000 0.000
#> GSM1060779 2 0.0000 0.996 0.000 1.000 0.000
#> GSM1060780 2 0.0237 0.997 0.004 0.996 0.000
#> GSM1060781 2 0.0237 0.997 0.004 0.996 0.000
#> GSM1060782 2 0.0000 0.996 0.000 1.000 0.000
#> GSM1060783 2 0.0237 0.997 0.004 0.996 0.000
#> GSM1060784 2 0.0237 0.997 0.004 0.996 0.000
#> GSM1060785 2 0.0237 0.997 0.004 0.996 0.000
#> GSM1060786 2 0.0000 0.996 0.000 1.000 0.000
#> GSM1060787 2 0.0237 0.997 0.004 0.996 0.000
#> GSM1060788 2 0.0237 0.997 0.004 0.996 0.000
#> GSM1060789 2 0.0237 0.997 0.004 0.996 0.000
#> GSM1060790 2 0.0000 0.996 0.000 1.000 0.000
#> GSM1060754 1 0.2878 0.886 0.904 0.000 0.096
#> GSM1060745 1 0.3412 0.855 0.876 0.000 0.124
#> GSM1060756 1 0.0892 0.959 0.980 0.000 0.020
#> GSM1060746 1 0.0000 0.974 1.000 0.000 0.000
#> GSM1060758 3 0.6126 0.665 0.352 0.004 0.644
#> GSM1060765 1 0.0000 0.974 1.000 0.000 0.000
#> GSM1060732 3 0.0000 0.834 0.000 0.000 1.000
#> GSM1060727 3 0.0000 0.834 0.000 0.000 1.000
#> GSM1060740 1 0.0000 0.974 1.000 0.000 0.000
#> GSM1060730 3 0.0000 0.834 0.000 0.000 1.000
#> GSM1060737 1 0.0000 0.974 1.000 0.000 0.000
#> GSM1060743 1 0.0000 0.974 1.000 0.000 0.000
#> GSM1060734 1 0.3412 0.855 0.876 0.000 0.124
#> GSM1060729 3 0.0000 0.834 0.000 0.000 1.000
#> GSM1060744 1 0.0000 0.974 1.000 0.000 0.000
#> GSM1060742 1 0.0000 0.974 1.000 0.000 0.000
#> GSM1060752 1 0.0000 0.974 1.000 0.000 0.000
#> GSM1060755 1 0.0000 0.974 1.000 0.000 0.000
#> GSM1060761 3 0.6126 0.665 0.352 0.004 0.644
#> GSM1060760 3 0.6126 0.665 0.352 0.004 0.644
#> GSM1060767 1 0.3267 0.865 0.884 0.000 0.116
#> GSM1060741 1 0.0000 0.974 1.000 0.000 0.000
#> GSM1060759 3 0.6126 0.665 0.352 0.004 0.644
#> GSM1060728 3 0.4110 0.803 0.152 0.004 0.844
#> GSM1060763 1 0.0000 0.974 1.000 0.000 0.000
#> GSM1060747 1 0.0000 0.974 1.000 0.000 0.000
#> GSM1060764 1 0.0237 0.971 0.996 0.000 0.004
#> GSM1060733 1 0.3412 0.855 0.876 0.000 0.124
#> GSM1060735 1 0.0000 0.974 1.000 0.000 0.000
#> GSM1060739 1 0.0000 0.974 1.000 0.000 0.000
#> GSM1060753 1 0.0237 0.970 0.996 0.004 0.000
#> GSM1060738 1 0.0000 0.974 1.000 0.000 0.000
#> GSM1060762 3 0.4110 0.803 0.152 0.004 0.844
#> GSM1060731 3 0.0000 0.834 0.000 0.000 1.000
#> GSM1060750 1 0.0000 0.974 1.000 0.000 0.000
#> GSM1060749 1 0.0000 0.974 1.000 0.000 0.000
#> GSM1060736 1 0.0000 0.974 1.000 0.000 0.000
#> GSM1060748 1 0.0000 0.974 1.000 0.000 0.000
#> GSM1060751 1 0.0000 0.974 1.000 0.000 0.000
#> GSM1060766 1 0.0000 0.974 1.000 0.000 0.000
#> GSM1060757 1 0.0000 0.974 1.000 0.000 0.000
#> GSM1060726 3 0.0000 0.834 0.000 0.000 1.000
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> GSM1060768 2 0.0000 0.975 0.000 1.000 0.000 0.000
#> GSM1060769 2 0.0000 0.975 0.000 1.000 0.000 0.000
#> GSM1060770 2 0.0000 0.975 0.000 1.000 0.000 0.000
#> GSM1060771 2 0.0707 0.977 0.020 0.980 0.000 0.000
#> GSM1060772 2 0.0707 0.977 0.020 0.980 0.000 0.000
#> GSM1060773 2 0.4472 0.665 0.020 0.760 0.000 0.220
#> GSM1060774 2 0.0469 0.977 0.012 0.988 0.000 0.000
#> GSM1060775 2 0.0000 0.975 0.000 1.000 0.000 0.000
#> GSM1060776 2 0.0000 0.975 0.000 1.000 0.000 0.000
#> GSM1060777 2 0.0707 0.977 0.020 0.980 0.000 0.000
#> GSM1060778 2 0.0000 0.975 0.000 1.000 0.000 0.000
#> GSM1060779 2 0.0000 0.975 0.000 1.000 0.000 0.000
#> GSM1060780 2 0.0707 0.977 0.020 0.980 0.000 0.000
#> GSM1060781 2 0.0707 0.977 0.020 0.980 0.000 0.000
#> GSM1060782 2 0.0000 0.975 0.000 1.000 0.000 0.000
#> GSM1060783 2 0.0707 0.977 0.020 0.980 0.000 0.000
#> GSM1060784 2 0.0707 0.977 0.020 0.980 0.000 0.000
#> GSM1060785 2 0.0707 0.977 0.020 0.980 0.000 0.000
#> GSM1060786 2 0.0000 0.975 0.000 1.000 0.000 0.000
#> GSM1060787 2 0.0707 0.977 0.020 0.980 0.000 0.000
#> GSM1060788 2 0.0707 0.977 0.020 0.980 0.000 0.000
#> GSM1060789 2 0.0707 0.977 0.020 0.980 0.000 0.000
#> GSM1060790 2 0.0000 0.975 0.000 1.000 0.000 0.000
#> GSM1060754 4 0.1118 0.913 0.036 0.000 0.000 0.964
#> GSM1060745 1 0.3942 0.984 0.764 0.000 0.000 0.236
#> GSM1060756 1 0.3975 0.983 0.760 0.000 0.000 0.240
#> GSM1060746 1 0.4008 0.980 0.756 0.000 0.000 0.244
#> GSM1060758 4 0.3942 0.703 0.236 0.000 0.000 0.764
#> GSM1060765 4 0.1474 0.912 0.052 0.000 0.000 0.948
#> GSM1060732 3 0.0000 1.000 0.000 0.000 1.000 0.000
#> GSM1060727 3 0.0000 1.000 0.000 0.000 1.000 0.000
#> GSM1060740 4 0.1474 0.912 0.052 0.000 0.000 0.948
#> GSM1060730 3 0.0000 1.000 0.000 0.000 1.000 0.000
#> GSM1060737 4 0.1474 0.912 0.052 0.000 0.000 0.948
#> GSM1060743 4 0.1474 0.912 0.052 0.000 0.000 0.948
#> GSM1060734 1 0.3942 0.984 0.764 0.000 0.000 0.236
#> GSM1060729 3 0.0000 1.000 0.000 0.000 1.000 0.000
#> GSM1060744 4 0.1557 0.909 0.056 0.000 0.000 0.944
#> GSM1060742 4 0.0188 0.905 0.004 0.000 0.000 0.996
#> GSM1060752 4 0.1118 0.913 0.036 0.000 0.000 0.964
#> GSM1060755 4 0.0592 0.900 0.016 0.000 0.000 0.984
#> GSM1060761 4 0.3942 0.703 0.236 0.000 0.000 0.764
#> GSM1060760 4 0.3942 0.703 0.236 0.000 0.000 0.764
#> GSM1060767 1 0.3942 0.984 0.764 0.000 0.000 0.236
#> GSM1060741 4 0.1211 0.913 0.040 0.000 0.000 0.960
#> GSM1060759 4 0.3942 0.703 0.236 0.000 0.000 0.764
#> GSM1060728 1 0.4290 0.951 0.772 0.000 0.016 0.212
#> GSM1060763 1 0.4072 0.971 0.748 0.000 0.000 0.252
#> GSM1060747 4 0.1474 0.912 0.052 0.000 0.000 0.948
#> GSM1060764 1 0.3975 0.983 0.760 0.000 0.000 0.240
#> GSM1060733 1 0.3942 0.984 0.764 0.000 0.000 0.236
#> GSM1060735 4 0.1474 0.912 0.052 0.000 0.000 0.948
#> GSM1060739 4 0.0817 0.912 0.024 0.000 0.000 0.976
#> GSM1060753 4 0.1022 0.891 0.032 0.000 0.000 0.968
#> GSM1060738 4 0.1474 0.912 0.052 0.000 0.000 0.948
#> GSM1060762 1 0.4290 0.951 0.772 0.000 0.016 0.212
#> GSM1060731 3 0.0000 1.000 0.000 0.000 1.000 0.000
#> GSM1060750 4 0.0921 0.893 0.028 0.000 0.000 0.972
#> GSM1060749 4 0.0336 0.903 0.008 0.000 0.000 0.992
#> GSM1060736 4 0.1474 0.912 0.052 0.000 0.000 0.948
#> GSM1060748 4 0.0921 0.893 0.028 0.000 0.000 0.972
#> GSM1060751 4 0.1474 0.912 0.052 0.000 0.000 0.948
#> GSM1060766 4 0.1716 0.910 0.064 0.000 0.000 0.936
#> GSM1060757 4 0.0336 0.903 0.008 0.000 0.000 0.992
#> GSM1060726 3 0.0000 1.000 0.000 0.000 1.000 0.000
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> GSM1060768 5 0.0162 0.983 0.000 0.004 0 0.000 0.996
#> GSM1060769 5 0.0162 0.983 0.000 0.004 0 0.000 0.996
#> GSM1060770 5 0.0162 0.983 0.000 0.004 0 0.000 0.996
#> GSM1060771 2 0.0162 0.967 0.000 0.996 0 0.000 0.004
#> GSM1060772 2 0.3684 0.611 0.000 0.720 0 0.000 0.280
#> GSM1060773 2 0.0451 0.957 0.004 0.988 0 0.008 0.000
#> GSM1060774 5 0.2648 0.815 0.000 0.152 0 0.000 0.848
#> GSM1060775 5 0.0162 0.983 0.000 0.004 0 0.000 0.996
#> GSM1060776 5 0.0162 0.983 0.000 0.004 0 0.000 0.996
#> GSM1060777 2 0.0162 0.967 0.000 0.996 0 0.000 0.004
#> GSM1060778 5 0.0162 0.983 0.000 0.004 0 0.000 0.996
#> GSM1060779 5 0.0162 0.983 0.000 0.004 0 0.000 0.996
#> GSM1060780 2 0.1043 0.936 0.000 0.960 0 0.000 0.040
#> GSM1060781 2 0.0162 0.967 0.000 0.996 0 0.000 0.004
#> GSM1060782 5 0.0162 0.983 0.000 0.004 0 0.000 0.996
#> GSM1060783 2 0.0162 0.967 0.000 0.996 0 0.000 0.004
#> GSM1060784 2 0.0162 0.967 0.000 0.996 0 0.000 0.004
#> GSM1060785 2 0.0162 0.967 0.000 0.996 0 0.000 0.004
#> GSM1060786 5 0.0162 0.983 0.000 0.004 0 0.000 0.996
#> GSM1060787 2 0.0162 0.967 0.000 0.996 0 0.000 0.004
#> GSM1060788 2 0.0162 0.967 0.000 0.996 0 0.000 0.004
#> GSM1060789 2 0.0162 0.967 0.000 0.996 0 0.000 0.004
#> GSM1060790 5 0.0162 0.983 0.000 0.004 0 0.000 0.996
#> GSM1060754 1 0.0000 0.996 1.000 0.000 0 0.000 0.000
#> GSM1060745 1 0.0162 0.995 0.996 0.000 0 0.004 0.000
#> GSM1060756 1 0.0000 0.996 1.000 0.000 0 0.000 0.000
#> GSM1060746 1 0.0162 0.996 0.996 0.004 0 0.000 0.000
#> GSM1060758 4 0.0000 0.792 0.000 0.000 0 1.000 0.000
#> GSM1060765 1 0.0162 0.996 0.996 0.004 0 0.000 0.000
#> GSM1060732 3 0.0000 1.000 0.000 0.000 1 0.000 0.000
#> GSM1060727 3 0.0000 1.000 0.000 0.000 1 0.000 0.000
#> GSM1060740 1 0.0162 0.996 0.996 0.004 0 0.000 0.000
#> GSM1060730 3 0.0000 1.000 0.000 0.000 1 0.000 0.000
#> GSM1060737 1 0.0162 0.996 0.996 0.004 0 0.000 0.000
#> GSM1060743 1 0.0162 0.996 0.996 0.004 0 0.000 0.000
#> GSM1060734 1 0.0162 0.995 0.996 0.000 0 0.004 0.000
#> GSM1060729 3 0.0000 1.000 0.000 0.000 1 0.000 0.000
#> GSM1060744 1 0.0000 0.996 1.000 0.000 0 0.000 0.000
#> GSM1060742 1 0.0324 0.993 0.992 0.000 0 0.004 0.004
#> GSM1060752 1 0.0324 0.995 0.992 0.004 0 0.004 0.000
#> GSM1060755 4 0.3395 0.769 0.236 0.000 0 0.764 0.000
#> GSM1060761 4 0.0000 0.792 0.000 0.000 0 1.000 0.000
#> GSM1060760 4 0.0000 0.792 0.000 0.000 0 1.000 0.000
#> GSM1060767 1 0.0000 0.996 1.000 0.000 0 0.000 0.000
#> GSM1060741 1 0.0162 0.995 0.996 0.000 0 0.000 0.004
#> GSM1060759 4 0.0000 0.792 0.000 0.000 0 1.000 0.000
#> GSM1060728 1 0.0324 0.993 0.992 0.000 0 0.004 0.004
#> GSM1060763 1 0.0162 0.996 0.996 0.004 0 0.000 0.000
#> GSM1060747 1 0.0000 0.996 1.000 0.000 0 0.000 0.000
#> GSM1060764 1 0.0162 0.996 0.996 0.004 0 0.000 0.000
#> GSM1060733 1 0.0162 0.995 0.996 0.000 0 0.004 0.000
#> GSM1060735 1 0.0162 0.996 0.996 0.004 0 0.000 0.000
#> GSM1060739 1 0.0162 0.994 0.996 0.000 0 0.004 0.000
#> GSM1060753 4 0.2852 0.796 0.172 0.000 0 0.828 0.000
#> GSM1060738 1 0.0162 0.996 0.996 0.004 0 0.000 0.000
#> GSM1060762 1 0.0324 0.993 0.992 0.000 0 0.004 0.004
#> GSM1060731 3 0.0000 1.000 0.000 0.000 1 0.000 0.000
#> GSM1060750 4 0.3366 0.774 0.232 0.000 0 0.768 0.000
#> GSM1060749 1 0.0290 0.992 0.992 0.000 0 0.008 0.000
#> GSM1060736 1 0.0162 0.996 0.996 0.004 0 0.000 0.000
#> GSM1060748 4 0.3366 0.774 0.232 0.000 0 0.768 0.000
#> GSM1060751 1 0.0162 0.996 0.996 0.004 0 0.000 0.000
#> GSM1060766 1 0.0324 0.995 0.992 0.004 0 0.004 0.000
#> GSM1060757 1 0.0290 0.992 0.992 0.000 0 0.008 0.000
#> GSM1060726 3 0.0000 1.000 0.000 0.000 1 0.000 0.000
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> GSM1060768 5 0.0000 0.982 0.000 0.000 0 0.000 1.000 0.000
#> GSM1060769 5 0.0000 0.982 0.000 0.000 0 0.000 1.000 0.000
#> GSM1060770 5 0.0000 0.982 0.000 0.000 0 0.000 1.000 0.000
#> GSM1060771 2 0.0000 0.962 0.000 1.000 0 0.000 0.000 0.000
#> GSM1060772 2 0.3409 0.567 0.000 0.700 0 0.000 0.300 0.000
#> GSM1060773 2 0.0363 0.951 0.000 0.988 0 0.000 0.000 0.012
#> GSM1060774 5 0.2300 0.807 0.000 0.144 0 0.000 0.856 0.000
#> GSM1060775 5 0.0000 0.982 0.000 0.000 0 0.000 1.000 0.000
#> GSM1060776 5 0.0000 0.982 0.000 0.000 0 0.000 1.000 0.000
#> GSM1060777 2 0.0000 0.962 0.000 1.000 0 0.000 0.000 0.000
#> GSM1060778 5 0.0000 0.982 0.000 0.000 0 0.000 1.000 0.000
#> GSM1060779 5 0.0000 0.982 0.000 0.000 0 0.000 1.000 0.000
#> GSM1060780 2 0.0865 0.930 0.000 0.964 0 0.000 0.036 0.000
#> GSM1060781 2 0.0000 0.962 0.000 1.000 0 0.000 0.000 0.000
#> GSM1060782 5 0.0000 0.982 0.000 0.000 0 0.000 1.000 0.000
#> GSM1060783 2 0.0000 0.962 0.000 1.000 0 0.000 0.000 0.000
#> GSM1060784 2 0.0000 0.962 0.000 1.000 0 0.000 0.000 0.000
#> GSM1060785 2 0.0000 0.962 0.000 1.000 0 0.000 0.000 0.000
#> GSM1060786 5 0.0000 0.982 0.000 0.000 0 0.000 1.000 0.000
#> GSM1060787 2 0.0000 0.962 0.000 1.000 0 0.000 0.000 0.000
#> GSM1060788 2 0.0000 0.962 0.000 1.000 0 0.000 0.000 0.000
#> GSM1060789 2 0.0000 0.962 0.000 1.000 0 0.000 0.000 0.000
#> GSM1060790 5 0.0000 0.982 0.000 0.000 0 0.000 1.000 0.000
#> GSM1060754 1 0.0603 0.904 0.980 0.000 0 0.016 0.000 0.004
#> GSM1060745 1 0.1657 0.888 0.928 0.000 0 0.016 0.000 0.056
#> GSM1060756 1 0.0820 0.903 0.972 0.000 0 0.016 0.000 0.012
#> GSM1060746 1 0.0603 0.904 0.980 0.000 0 0.016 0.000 0.004
#> GSM1060758 4 0.0632 1.000 0.000 0.000 0 0.976 0.000 0.024
#> GSM1060765 1 0.2778 0.827 0.824 0.000 0 0.008 0.000 0.168
#> GSM1060732 3 0.0000 1.000 0.000 0.000 1 0.000 0.000 0.000
#> GSM1060727 3 0.0000 1.000 0.000 0.000 1 0.000 0.000 0.000
#> GSM1060740 1 0.2593 0.840 0.844 0.000 0 0.008 0.000 0.148
#> GSM1060730 3 0.0000 1.000 0.000 0.000 1 0.000 0.000 0.000
#> GSM1060737 1 0.0405 0.903 0.988 0.000 0 0.008 0.000 0.004
#> GSM1060743 1 0.2593 0.840 0.844 0.000 0 0.008 0.000 0.148
#> GSM1060734 1 0.1461 0.894 0.940 0.000 0 0.016 0.000 0.044
#> GSM1060729 3 0.0000 1.000 0.000 0.000 1 0.000 0.000 0.000
#> GSM1060744 1 0.1003 0.902 0.964 0.000 0 0.016 0.000 0.020
#> GSM1060742 6 0.2762 0.934 0.196 0.000 0 0.000 0.000 0.804
#> GSM1060752 1 0.2706 0.842 0.832 0.000 0 0.008 0.000 0.160
#> GSM1060755 6 0.2869 0.973 0.148 0.000 0 0.020 0.000 0.832
#> GSM1060761 4 0.0632 1.000 0.000 0.000 0 0.976 0.000 0.024
#> GSM1060760 4 0.0632 1.000 0.000 0.000 0 0.976 0.000 0.024
#> GSM1060767 1 0.1003 0.902 0.964 0.000 0 0.016 0.000 0.020
#> GSM1060741 1 0.1765 0.868 0.904 0.000 0 0.000 0.000 0.096
#> GSM1060759 4 0.0632 1.000 0.000 0.000 0 0.976 0.000 0.024
#> GSM1060728 1 0.1814 0.866 0.900 0.000 0 0.000 0.000 0.100
#> GSM1060763 1 0.0603 0.904 0.980 0.000 0 0.016 0.000 0.004
#> GSM1060747 1 0.2118 0.866 0.888 0.000 0 0.008 0.000 0.104
#> GSM1060764 1 0.0603 0.904 0.980 0.000 0 0.016 0.000 0.004
#> GSM1060733 1 0.1594 0.890 0.932 0.000 0 0.016 0.000 0.052
#> GSM1060735 1 0.1643 0.887 0.924 0.000 0 0.008 0.000 0.068
#> GSM1060739 1 0.1556 0.879 0.920 0.000 0 0.000 0.000 0.080
#> GSM1060753 6 0.2869 0.973 0.148 0.000 0 0.020 0.000 0.832
#> GSM1060738 1 0.1462 0.893 0.936 0.000 0 0.008 0.000 0.056
#> GSM1060762 1 0.1814 0.866 0.900 0.000 0 0.000 0.000 0.100
#> GSM1060731 3 0.0000 1.000 0.000 0.000 1 0.000 0.000 0.000
#> GSM1060750 6 0.2869 0.973 0.148 0.000 0 0.020 0.000 0.832
#> GSM1060749 6 0.2527 0.966 0.168 0.000 0 0.000 0.000 0.832
#> GSM1060736 1 0.2778 0.827 0.824 0.000 0 0.008 0.000 0.168
#> GSM1060748 6 0.2869 0.973 0.148 0.000 0 0.020 0.000 0.832
#> GSM1060751 1 0.2593 0.840 0.844 0.000 0 0.008 0.000 0.148
#> GSM1060766 1 0.1765 0.869 0.904 0.000 0 0.000 0.000 0.096
#> GSM1060757 6 0.2597 0.961 0.176 0.000 0 0.000 0.000 0.824
#> GSM1060726 3 0.0000 1.000 0.000 0.000 1 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)
Test correlation between subgroups and known annotations. If the known annotation is numeric, one-way ANOVA test is applied, and if the known annotation is discrete, chi-squared contingency table test is applied.
test_to_known_factors(res)
#> n disease.state(p) tissue(p) k
#> MAD:mclust 65 6.65e-15 1.29e-02 2
#> MAD:mclust 65 7.68e-15 9.62e-04 3
#> MAD:mclust 65 5.02e-14 7.89e-05 4
#> MAD:mclust 65 2.57e-13 7.54e-02 5
#> MAD:mclust 65 1.12e-12 1.07e-02 6
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 51941 rows and 65 columns.
#> Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'MAD' method.
#> Subgroups are detected by 'NMF' method.
#> Performed in total 1250 partitions by row resampling.
#> Best k for subgroups seems to be 4.
#>
#> Following methods can be applied to this 'ConsensusPartition' object:
#> [1] "cola_report" "collect_classes" "collect_plots"
#> [4] "collect_stats" "colnames" "compare_signatures"
#> [7] "consensus_heatmap" "dimension_reduction" "functional_enrichment"
#> [10] "get_anno_col" "get_anno" "get_classes"
#> [13] "get_consensus" "get_matrix" "get_membership"
#> [16] "get_param" "get_signatures" "get_stats"
#> [19] "is_best_k" "is_stable_k" "membership_heatmap"
#> [22] "ncol" "nrow" "plot_ecdf"
#> [25] "rownames" "select_partition_number" "show"
#> [28] "suggest_best_k" "test_to_known_factors"
collect_plots()
function collects all the plots made from res
for all k
(number of partitions)
into one single page to provide an easy and fast comparison between different k
.
collect_plots(res)
The plots are:
k
and the heatmap of
predicted classes for each k
.k
.k
.k
.All the plots in panels can be made by individual functions and they are plotted later in this section.
select_partition_number()
produces several plots showing different
statistics for choosing “optimized” k
. There are following statistics:
k
;k
, the area increased is defined as \(A_k - A_{k-1}\).The detailed explanations of these statistics can be found in the cola vignette.
Generally speaking, lower PAC score, higher mean silhouette score or higher
concordance corresponds to better partition. Rand index and Jaccard index
measure how similar the current partition is compared to partition with k-1
.
If they are too similar, we won't accept k
is better than k-1
.
select_partition_number(res)
The numeric values for all these statistics can be obtained by get_stats()
.
get_stats(res)
#> k 1-PAC mean_silhouette concordance area_increased Rand Jaccard
#> 2 2 0.843 0.889 0.955 0.4963 0.502 0.502
#> 3 3 1.000 0.967 0.986 0.2094 0.888 0.781
#> 4 4 1.000 0.962 0.984 0.1798 0.885 0.715
#> 5 5 0.825 0.810 0.881 0.0986 0.896 0.658
#> 6 6 0.843 0.880 0.914 0.0658 0.911 0.621
suggest_best_k()
suggests the best \(k\) based on these statistics. The rules are as follows:
suggest_best_k(res)
#> [1] 4
#> attr(,"optional")
#> [1] 3
There is also optional best \(k\) = 3 that is worth to check.
Following shows the table of the partitions (You need to click the show/hide
code output link to see it). The membership matrix (columns with name p*
)
is inferred by
clue::cl_consensus()
function with the SE
method. Basically the value in the membership matrix
represents the probability to belong to a certain group. The finall class
label for an item is determined with the group with highest probability it
belongs to.
In get_classes()
function, the entropy is calculated from the membership
matrix and the silhouette score is calculated from the consensus matrix.
cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#> class entropy silhouette p1 p2
#> GSM1060768 2 0.000 0.948 0.000 1.000
#> GSM1060769 2 0.000 0.948 0.000 1.000
#> GSM1060770 2 0.000 0.948 0.000 1.000
#> GSM1060771 2 0.000 0.948 0.000 1.000
#> GSM1060772 2 0.000 0.948 0.000 1.000
#> GSM1060773 2 0.000 0.948 0.000 1.000
#> GSM1060774 2 0.000 0.948 0.000 1.000
#> GSM1060775 2 0.000 0.948 0.000 1.000
#> GSM1060776 2 0.000 0.948 0.000 1.000
#> GSM1060777 2 0.000 0.948 0.000 1.000
#> GSM1060778 2 0.000 0.948 0.000 1.000
#> GSM1060779 2 0.000 0.948 0.000 1.000
#> GSM1060780 2 0.000 0.948 0.000 1.000
#> GSM1060781 2 0.000 0.948 0.000 1.000
#> GSM1060782 2 0.000 0.948 0.000 1.000
#> GSM1060783 2 0.000 0.948 0.000 1.000
#> GSM1060784 2 0.000 0.948 0.000 1.000
#> GSM1060785 2 0.000 0.948 0.000 1.000
#> GSM1060786 2 0.000 0.948 0.000 1.000
#> GSM1060787 2 0.000 0.948 0.000 1.000
#> GSM1060788 2 0.000 0.948 0.000 1.000
#> GSM1060789 2 0.000 0.948 0.000 1.000
#> GSM1060790 2 0.000 0.948 0.000 1.000
#> GSM1060754 1 0.000 0.953 1.000 0.000
#> GSM1060745 1 0.000 0.953 1.000 0.000
#> GSM1060756 1 0.000 0.953 1.000 0.000
#> GSM1060746 1 0.000 0.953 1.000 0.000
#> GSM1060758 1 0.904 0.539 0.680 0.320
#> GSM1060765 1 0.000 0.953 1.000 0.000
#> GSM1060732 2 0.224 0.919 0.036 0.964
#> GSM1060727 2 0.814 0.665 0.252 0.748
#> GSM1060740 1 0.000 0.953 1.000 0.000
#> GSM1060730 2 0.992 0.194 0.448 0.552
#> GSM1060737 1 0.000 0.953 1.000 0.000
#> GSM1060743 1 0.000 0.953 1.000 0.000
#> GSM1060734 1 0.000 0.953 1.000 0.000
#> GSM1060729 2 0.909 0.533 0.324 0.676
#> GSM1060744 1 0.000 0.953 1.000 0.000
#> GSM1060742 1 0.000 0.953 1.000 0.000
#> GSM1060752 1 0.000 0.953 1.000 0.000
#> GSM1060755 1 0.000 0.953 1.000 0.000
#> GSM1060761 1 0.844 0.628 0.728 0.272
#> GSM1060760 1 0.000 0.953 1.000 0.000
#> GSM1060767 1 0.000 0.953 1.000 0.000
#> GSM1060741 1 0.000 0.953 1.000 0.000
#> GSM1060759 1 0.000 0.953 1.000 0.000
#> GSM1060728 1 0.936 0.457 0.648 0.352
#> GSM1060763 1 0.000 0.953 1.000 0.000
#> GSM1060747 1 0.000 0.953 1.000 0.000
#> GSM1060764 1 0.000 0.953 1.000 0.000
#> GSM1060733 1 0.000 0.953 1.000 0.000
#> GSM1060735 1 0.000 0.953 1.000 0.000
#> GSM1060739 1 0.000 0.953 1.000 0.000
#> GSM1060753 1 0.000 0.953 1.000 0.000
#> GSM1060738 1 0.000 0.953 1.000 0.000
#> GSM1060762 1 0.993 0.170 0.548 0.452
#> GSM1060731 1 0.722 0.730 0.800 0.200
#> GSM1060750 1 0.000 0.953 1.000 0.000
#> GSM1060749 1 0.000 0.953 1.000 0.000
#> GSM1060736 1 0.000 0.953 1.000 0.000
#> GSM1060748 1 0.000 0.953 1.000 0.000
#> GSM1060751 1 0.000 0.953 1.000 0.000
#> GSM1060766 1 0.000 0.953 1.000 0.000
#> GSM1060757 1 0.000 0.953 1.000 0.000
#> GSM1060726 2 0.808 0.671 0.248 0.752
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> GSM1060768 2 0.0000 0.998 0.000 1.000 0.000
#> GSM1060769 2 0.0000 0.998 0.000 1.000 0.000
#> GSM1060770 2 0.0000 0.998 0.000 1.000 0.000
#> GSM1060771 2 0.0000 0.998 0.000 1.000 0.000
#> GSM1060772 2 0.0000 0.998 0.000 1.000 0.000
#> GSM1060773 2 0.1289 0.957 0.032 0.968 0.000
#> GSM1060774 2 0.0000 0.998 0.000 1.000 0.000
#> GSM1060775 2 0.0000 0.998 0.000 1.000 0.000
#> GSM1060776 2 0.0000 0.998 0.000 1.000 0.000
#> GSM1060777 2 0.0000 0.998 0.000 1.000 0.000
#> GSM1060778 2 0.0000 0.998 0.000 1.000 0.000
#> GSM1060779 2 0.0000 0.998 0.000 1.000 0.000
#> GSM1060780 2 0.0000 0.998 0.000 1.000 0.000
#> GSM1060781 2 0.0237 0.993 0.004 0.996 0.000
#> GSM1060782 2 0.0000 0.998 0.000 1.000 0.000
#> GSM1060783 2 0.0000 0.998 0.000 1.000 0.000
#> GSM1060784 2 0.0000 0.998 0.000 1.000 0.000
#> GSM1060785 2 0.0000 0.998 0.000 1.000 0.000
#> GSM1060786 2 0.0000 0.998 0.000 1.000 0.000
#> GSM1060787 2 0.0000 0.998 0.000 1.000 0.000
#> GSM1060788 2 0.0000 0.998 0.000 1.000 0.000
#> GSM1060789 2 0.0000 0.998 0.000 1.000 0.000
#> GSM1060790 2 0.0000 0.998 0.000 1.000 0.000
#> GSM1060754 1 0.0000 0.972 1.000 0.000 0.000
#> GSM1060745 1 0.4452 0.760 0.808 0.000 0.192
#> GSM1060756 1 0.0237 0.970 0.996 0.000 0.004
#> GSM1060746 1 0.0237 0.970 0.996 0.000 0.004
#> GSM1060758 1 0.5465 0.598 0.712 0.288 0.000
#> GSM1060765 1 0.0000 0.972 1.000 0.000 0.000
#> GSM1060732 3 0.0000 0.991 0.000 0.000 1.000
#> GSM1060727 3 0.0000 0.991 0.000 0.000 1.000
#> GSM1060740 1 0.0000 0.972 1.000 0.000 0.000
#> GSM1060730 3 0.0000 0.991 0.000 0.000 1.000
#> GSM1060737 1 0.0000 0.972 1.000 0.000 0.000
#> GSM1060743 1 0.0000 0.972 1.000 0.000 0.000
#> GSM1060734 1 0.1289 0.947 0.968 0.000 0.032
#> GSM1060729 3 0.0000 0.991 0.000 0.000 1.000
#> GSM1060744 1 0.0000 0.972 1.000 0.000 0.000
#> GSM1060742 1 0.0000 0.972 1.000 0.000 0.000
#> GSM1060752 1 0.0000 0.972 1.000 0.000 0.000
#> GSM1060755 1 0.0000 0.972 1.000 0.000 0.000
#> GSM1060761 1 0.5178 0.649 0.744 0.256 0.000
#> GSM1060760 1 0.0000 0.972 1.000 0.000 0.000
#> GSM1060767 1 0.0424 0.968 0.992 0.000 0.008
#> GSM1060741 1 0.0000 0.972 1.000 0.000 0.000
#> GSM1060759 1 0.0000 0.972 1.000 0.000 0.000
#> GSM1060728 3 0.0000 0.991 0.000 0.000 1.000
#> GSM1060763 1 0.0237 0.970 0.996 0.000 0.004
#> GSM1060747 1 0.0000 0.972 1.000 0.000 0.000
#> GSM1060764 1 0.0237 0.970 0.996 0.000 0.004
#> GSM1060733 1 0.0747 0.961 0.984 0.000 0.016
#> GSM1060735 1 0.0000 0.972 1.000 0.000 0.000
#> GSM1060739 1 0.0000 0.972 1.000 0.000 0.000
#> GSM1060753 1 0.0000 0.972 1.000 0.000 0.000
#> GSM1060738 1 0.0000 0.972 1.000 0.000 0.000
#> GSM1060762 3 0.2066 0.935 0.000 0.060 0.940
#> GSM1060731 3 0.0000 0.991 0.000 0.000 1.000
#> GSM1060750 1 0.0000 0.972 1.000 0.000 0.000
#> GSM1060749 1 0.0000 0.972 1.000 0.000 0.000
#> GSM1060736 1 0.0000 0.972 1.000 0.000 0.000
#> GSM1060748 1 0.0000 0.972 1.000 0.000 0.000
#> GSM1060751 1 0.0000 0.972 1.000 0.000 0.000
#> GSM1060766 1 0.0000 0.972 1.000 0.000 0.000
#> GSM1060757 1 0.0000 0.972 1.000 0.000 0.000
#> GSM1060726 3 0.0000 0.991 0.000 0.000 1.000
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> GSM1060768 2 0.0000 0.982 0.000 1.000 0.000 0.000
#> GSM1060769 2 0.0000 0.982 0.000 1.000 0.000 0.000
#> GSM1060770 2 0.0000 0.982 0.000 1.000 0.000 0.000
#> GSM1060771 2 0.0000 0.982 0.000 1.000 0.000 0.000
#> GSM1060772 2 0.0188 0.978 0.000 0.996 0.000 0.004
#> GSM1060773 2 0.4643 0.478 0.000 0.656 0.000 0.344
#> GSM1060774 2 0.0000 0.982 0.000 1.000 0.000 0.000
#> GSM1060775 2 0.0000 0.982 0.000 1.000 0.000 0.000
#> GSM1060776 2 0.0000 0.982 0.000 1.000 0.000 0.000
#> GSM1060777 2 0.0000 0.982 0.000 1.000 0.000 0.000
#> GSM1060778 2 0.0000 0.982 0.000 1.000 0.000 0.000
#> GSM1060779 2 0.0000 0.982 0.000 1.000 0.000 0.000
#> GSM1060780 2 0.0000 0.982 0.000 1.000 0.000 0.000
#> GSM1060781 2 0.0707 0.963 0.000 0.980 0.000 0.020
#> GSM1060782 2 0.0000 0.982 0.000 1.000 0.000 0.000
#> GSM1060783 2 0.0000 0.982 0.000 1.000 0.000 0.000
#> GSM1060784 2 0.0000 0.982 0.000 1.000 0.000 0.000
#> GSM1060785 2 0.0000 0.982 0.000 1.000 0.000 0.000
#> GSM1060786 2 0.0000 0.982 0.000 1.000 0.000 0.000
#> GSM1060787 2 0.0000 0.982 0.000 1.000 0.000 0.000
#> GSM1060788 2 0.0000 0.982 0.000 1.000 0.000 0.000
#> GSM1060789 2 0.0000 0.982 0.000 1.000 0.000 0.000
#> GSM1060790 2 0.0000 0.982 0.000 1.000 0.000 0.000
#> GSM1060754 1 0.0000 0.999 1.000 0.000 0.000 0.000
#> GSM1060745 1 0.0336 0.992 0.992 0.000 0.008 0.000
#> GSM1060756 1 0.0000 0.999 1.000 0.000 0.000 0.000
#> GSM1060746 1 0.0000 0.999 1.000 0.000 0.000 0.000
#> GSM1060758 4 0.0000 0.979 0.000 0.000 0.000 1.000
#> GSM1060765 1 0.0000 0.999 1.000 0.000 0.000 0.000
#> GSM1060732 3 0.0000 0.922 0.000 0.000 1.000 0.000
#> GSM1060727 3 0.0000 0.922 0.000 0.000 1.000 0.000
#> GSM1060740 1 0.0000 0.999 1.000 0.000 0.000 0.000
#> GSM1060730 3 0.0000 0.922 0.000 0.000 1.000 0.000
#> GSM1060737 1 0.0000 0.999 1.000 0.000 0.000 0.000
#> GSM1060743 1 0.0000 0.999 1.000 0.000 0.000 0.000
#> GSM1060734 1 0.0000 0.999 1.000 0.000 0.000 0.000
#> GSM1060729 3 0.0000 0.922 0.000 0.000 1.000 0.000
#> GSM1060744 1 0.0000 0.999 1.000 0.000 0.000 0.000
#> GSM1060742 1 0.0000 0.999 1.000 0.000 0.000 0.000
#> GSM1060752 1 0.0000 0.999 1.000 0.000 0.000 0.000
#> GSM1060755 4 0.0000 0.979 0.000 0.000 0.000 1.000
#> GSM1060761 4 0.0000 0.979 0.000 0.000 0.000 1.000
#> GSM1060760 4 0.0000 0.979 0.000 0.000 0.000 1.000
#> GSM1060767 1 0.0000 0.999 1.000 0.000 0.000 0.000
#> GSM1060741 1 0.0000 0.999 1.000 0.000 0.000 0.000
#> GSM1060759 4 0.0000 0.979 0.000 0.000 0.000 1.000
#> GSM1060728 3 0.0000 0.922 0.000 0.000 1.000 0.000
#> GSM1060763 1 0.0000 0.999 1.000 0.000 0.000 0.000
#> GSM1060747 1 0.0000 0.999 1.000 0.000 0.000 0.000
#> GSM1060764 1 0.0000 0.999 1.000 0.000 0.000 0.000
#> GSM1060733 1 0.0000 0.999 1.000 0.000 0.000 0.000
#> GSM1060735 1 0.0000 0.999 1.000 0.000 0.000 0.000
#> GSM1060739 1 0.0469 0.987 0.988 0.000 0.000 0.012
#> GSM1060753 4 0.0000 0.979 0.000 0.000 0.000 1.000
#> GSM1060738 1 0.0000 0.999 1.000 0.000 0.000 0.000
#> GSM1060762 3 0.7503 0.420 0.228 0.276 0.496 0.000
#> GSM1060731 3 0.0000 0.922 0.000 0.000 1.000 0.000
#> GSM1060750 4 0.0000 0.979 0.000 0.000 0.000 1.000
#> GSM1060749 4 0.1792 0.908 0.068 0.000 0.000 0.932
#> GSM1060736 1 0.0000 0.999 1.000 0.000 0.000 0.000
#> GSM1060748 4 0.0000 0.979 0.000 0.000 0.000 1.000
#> GSM1060751 1 0.0000 0.999 1.000 0.000 0.000 0.000
#> GSM1060766 1 0.0000 0.999 1.000 0.000 0.000 0.000
#> GSM1060757 4 0.1716 0.914 0.064 0.000 0.000 0.936
#> GSM1060726 3 0.0000 0.922 0.000 0.000 1.000 0.000
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> GSM1060768 5 0.0000 0.87727 0.000 0.000 0.000 0.000 1.000
#> GSM1060769 5 0.0000 0.87727 0.000 0.000 0.000 0.000 1.000
#> GSM1060770 5 0.0000 0.87727 0.000 0.000 0.000 0.000 1.000
#> GSM1060771 5 0.3612 0.79780 0.000 0.268 0.000 0.000 0.732
#> GSM1060772 5 0.0000 0.87727 0.000 0.000 0.000 0.000 1.000
#> GSM1060773 2 0.3794 0.37192 0.000 0.800 0.000 0.152 0.048
#> GSM1060774 5 0.0000 0.87727 0.000 0.000 0.000 0.000 1.000
#> GSM1060775 5 0.0000 0.87727 0.000 0.000 0.000 0.000 1.000
#> GSM1060776 5 0.0162 0.87664 0.000 0.004 0.000 0.000 0.996
#> GSM1060777 5 0.4015 0.73937 0.000 0.348 0.000 0.000 0.652
#> GSM1060778 5 0.0000 0.87727 0.000 0.000 0.000 0.000 1.000
#> GSM1060779 5 0.0000 0.87727 0.000 0.000 0.000 0.000 1.000
#> GSM1060780 5 0.2127 0.85424 0.000 0.108 0.000 0.000 0.892
#> GSM1060781 5 0.6309 0.55298 0.000 0.340 0.000 0.168 0.492
#> GSM1060782 5 0.0000 0.87727 0.000 0.000 0.000 0.000 1.000
#> GSM1060783 5 0.4015 0.73944 0.000 0.348 0.000 0.000 0.652
#> GSM1060784 5 0.3857 0.76966 0.000 0.312 0.000 0.000 0.688
#> GSM1060785 5 0.3774 0.78087 0.000 0.296 0.000 0.000 0.704
#> GSM1060786 5 0.0000 0.87727 0.000 0.000 0.000 0.000 1.000
#> GSM1060787 5 0.3480 0.80798 0.000 0.248 0.000 0.000 0.752
#> GSM1060788 2 0.1732 0.48262 0.000 0.920 0.000 0.000 0.080
#> GSM1060789 5 0.3395 0.81303 0.000 0.236 0.000 0.000 0.764
#> GSM1060790 5 0.0000 0.87727 0.000 0.000 0.000 0.000 1.000
#> GSM1060754 1 0.0000 0.90243 1.000 0.000 0.000 0.000 0.000
#> GSM1060745 1 0.0609 0.89157 0.980 0.020 0.000 0.000 0.000
#> GSM1060756 1 0.0000 0.90243 1.000 0.000 0.000 0.000 0.000
#> GSM1060746 1 0.0000 0.90243 1.000 0.000 0.000 0.000 0.000
#> GSM1060758 4 0.0000 0.92453 0.000 0.000 0.000 1.000 0.000
#> GSM1060765 2 0.4304 0.52260 0.484 0.516 0.000 0.000 0.000
#> GSM1060732 3 0.0000 1.00000 0.000 0.000 1.000 0.000 0.000
#> GSM1060727 3 0.0000 1.00000 0.000 0.000 1.000 0.000 0.000
#> GSM1060740 2 0.3983 0.72744 0.340 0.660 0.000 0.000 0.000
#> GSM1060730 3 0.0000 1.00000 0.000 0.000 1.000 0.000 0.000
#> GSM1060737 1 0.0510 0.89716 0.984 0.016 0.000 0.000 0.000
#> GSM1060743 1 0.2074 0.78830 0.896 0.104 0.000 0.000 0.000
#> GSM1060734 1 0.0162 0.90063 0.996 0.004 0.000 0.000 0.000
#> GSM1060729 3 0.0000 1.00000 0.000 0.000 1.000 0.000 0.000
#> GSM1060744 2 0.4291 0.53972 0.464 0.536 0.000 0.000 0.000
#> GSM1060742 1 0.4354 -0.00866 0.624 0.368 0.000 0.008 0.000
#> GSM1060752 2 0.4304 0.51994 0.484 0.516 0.000 0.000 0.000
#> GSM1060755 4 0.0404 0.92295 0.000 0.012 0.000 0.988 0.000
#> GSM1060761 4 0.0771 0.91633 0.000 0.020 0.000 0.976 0.004
#> GSM1060760 4 0.0162 0.92387 0.000 0.004 0.000 0.996 0.000
#> GSM1060767 1 0.0000 0.90243 1.000 0.000 0.000 0.000 0.000
#> GSM1060741 2 0.3774 0.74854 0.296 0.704 0.000 0.000 0.000
#> GSM1060759 4 0.0000 0.92453 0.000 0.000 0.000 1.000 0.000
#> GSM1060728 3 0.0000 1.00000 0.000 0.000 1.000 0.000 0.000
#> GSM1060763 1 0.0000 0.90243 1.000 0.000 0.000 0.000 0.000
#> GSM1060747 2 0.3561 0.75668 0.260 0.740 0.000 0.000 0.000
#> GSM1060764 1 0.1341 0.85769 0.944 0.056 0.000 0.000 0.000
#> GSM1060733 1 0.0510 0.89257 0.984 0.016 0.000 0.000 0.000
#> GSM1060735 1 0.0609 0.89435 0.980 0.020 0.000 0.000 0.000
#> GSM1060739 2 0.4378 0.74606 0.248 0.716 0.000 0.036 0.000
#> GSM1060753 4 0.0000 0.92453 0.000 0.000 0.000 1.000 0.000
#> GSM1060738 2 0.3561 0.75668 0.260 0.740 0.000 0.000 0.000
#> GSM1060762 1 0.5913 0.40645 0.648 0.032 0.076 0.004 0.240
#> GSM1060731 3 0.0000 1.00000 0.000 0.000 1.000 0.000 0.000
#> GSM1060750 4 0.0404 0.92295 0.000 0.012 0.000 0.988 0.000
#> GSM1060749 4 0.1579 0.89413 0.024 0.032 0.000 0.944 0.000
#> GSM1060736 1 0.0162 0.90151 0.996 0.004 0.000 0.000 0.000
#> GSM1060748 4 0.1270 0.89810 0.000 0.052 0.000 0.948 0.000
#> GSM1060751 2 0.3796 0.75325 0.300 0.700 0.000 0.000 0.000
#> GSM1060766 1 0.0510 0.89716 0.984 0.016 0.000 0.000 0.000
#> GSM1060757 4 0.4597 0.27466 0.424 0.012 0.000 0.564 0.000
#> GSM1060726 3 0.0000 1.00000 0.000 0.000 1.000 0.000 0.000
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> GSM1060768 5 0.0000 0.973 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM1060769 5 0.0000 0.973 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM1060770 5 0.0000 0.973 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM1060771 2 0.2669 0.904 0.000 0.836 0.000 0.008 0.156 0.000
#> GSM1060772 5 0.0458 0.964 0.000 0.016 0.000 0.000 0.984 0.000
#> GSM1060773 2 0.2562 0.816 0.012 0.892 0.000 0.024 0.008 0.064
#> GSM1060774 5 0.0146 0.972 0.000 0.004 0.000 0.000 0.996 0.000
#> GSM1060775 5 0.0260 0.969 0.000 0.008 0.000 0.000 0.992 0.000
#> GSM1060776 5 0.0713 0.958 0.000 0.028 0.000 0.000 0.972 0.000
#> GSM1060777 2 0.2092 0.913 0.000 0.876 0.000 0.000 0.124 0.000
#> GSM1060778 5 0.0000 0.973 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM1060779 5 0.0000 0.973 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM1060780 5 0.2969 0.658 0.000 0.224 0.000 0.000 0.776 0.000
#> GSM1060781 2 0.2672 0.845 0.000 0.868 0.000 0.080 0.052 0.000
#> GSM1060782 5 0.0000 0.973 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM1060783 2 0.2234 0.914 0.000 0.872 0.000 0.000 0.124 0.004
#> GSM1060784 2 0.2768 0.905 0.000 0.832 0.000 0.000 0.156 0.012
#> GSM1060785 2 0.2135 0.914 0.000 0.872 0.000 0.000 0.128 0.000
#> GSM1060786 5 0.0000 0.973 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM1060787 2 0.3171 0.865 0.000 0.784 0.000 0.000 0.204 0.012
#> GSM1060788 2 0.3023 0.724 0.000 0.784 0.000 0.000 0.004 0.212
#> GSM1060789 2 0.2527 0.898 0.000 0.832 0.000 0.000 0.168 0.000
#> GSM1060790 5 0.0000 0.973 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM1060754 1 0.0547 0.867 0.980 0.000 0.000 0.000 0.000 0.020
#> GSM1060745 1 0.1745 0.852 0.920 0.012 0.000 0.000 0.000 0.068
#> GSM1060756 1 0.0547 0.867 0.980 0.000 0.000 0.000 0.000 0.020
#> GSM1060746 1 0.0713 0.867 0.972 0.000 0.000 0.000 0.000 0.028
#> GSM1060758 4 0.0508 0.927 0.000 0.004 0.000 0.984 0.000 0.012
#> GSM1060765 6 0.2706 0.841 0.160 0.008 0.000 0.000 0.000 0.832
#> GSM1060732 3 0.0146 0.998 0.000 0.004 0.996 0.000 0.000 0.000
#> GSM1060727 3 0.0000 0.999 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1060740 6 0.1951 0.921 0.060 0.020 0.000 0.004 0.000 0.916
#> GSM1060730 3 0.0000 0.999 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1060737 1 0.1524 0.852 0.932 0.060 0.000 0.000 0.000 0.008
#> GSM1060743 1 0.3993 0.271 0.592 0.000 0.000 0.008 0.000 0.400
#> GSM1060734 1 0.0692 0.867 0.976 0.004 0.000 0.000 0.000 0.020
#> GSM1060729 3 0.0000 0.999 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1060744 6 0.1867 0.916 0.064 0.020 0.000 0.000 0.000 0.916
#> GSM1060742 6 0.3821 0.837 0.108 0.028 0.000 0.060 0.000 0.804
#> GSM1060752 6 0.2544 0.892 0.120 0.012 0.000 0.004 0.000 0.864
#> GSM1060755 4 0.1219 0.920 0.004 0.048 0.000 0.948 0.000 0.000
#> GSM1060761 4 0.2669 0.874 0.000 0.108 0.000 0.864 0.004 0.024
#> GSM1060760 4 0.1088 0.922 0.000 0.024 0.000 0.960 0.000 0.016
#> GSM1060767 1 0.0713 0.867 0.972 0.000 0.000 0.000 0.000 0.028
#> GSM1060741 6 0.2095 0.915 0.040 0.028 0.000 0.016 0.000 0.916
#> GSM1060759 4 0.0717 0.926 0.000 0.008 0.000 0.976 0.000 0.016
#> GSM1060728 3 0.0146 0.998 0.000 0.004 0.996 0.000 0.000 0.000
#> GSM1060763 1 0.0547 0.867 0.980 0.000 0.000 0.000 0.000 0.020
#> GSM1060747 6 0.1334 0.910 0.020 0.032 0.000 0.000 0.000 0.948
#> GSM1060764 1 0.3266 0.606 0.728 0.000 0.000 0.000 0.000 0.272
#> GSM1060733 1 0.0820 0.865 0.972 0.012 0.000 0.000 0.000 0.016
#> GSM1060735 1 0.2933 0.823 0.860 0.076 0.000 0.008 0.000 0.056
#> GSM1060739 6 0.2742 0.875 0.016 0.036 0.000 0.072 0.000 0.876
#> GSM1060753 4 0.0458 0.926 0.000 0.016 0.000 0.984 0.000 0.000
#> GSM1060738 6 0.1168 0.908 0.016 0.028 0.000 0.000 0.000 0.956
#> GSM1060762 1 0.4420 0.622 0.708 0.028 0.008 0.000 0.240 0.016
#> GSM1060731 3 0.0000 0.999 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1060750 4 0.0858 0.925 0.004 0.028 0.000 0.968 0.000 0.000
#> GSM1060749 4 0.3231 0.822 0.008 0.044 0.000 0.832 0.000 0.116
#> GSM1060736 1 0.2068 0.839 0.904 0.080 0.000 0.008 0.000 0.008
#> GSM1060748 4 0.2871 0.787 0.004 0.192 0.000 0.804 0.000 0.000
#> GSM1060751 6 0.2066 0.914 0.052 0.040 0.000 0.000 0.000 0.908
#> GSM1060766 1 0.2647 0.818 0.868 0.088 0.000 0.000 0.000 0.044
#> GSM1060757 1 0.3871 0.508 0.676 0.016 0.000 0.308 0.000 0.000
#> GSM1060726 3 0.0000 0.999 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)
Test correlation between subgroups and known annotations. If the known annotation is numeric, one-way ANOVA test is applied, and if the known annotation is discrete, chi-squared contingency table test is applied.
test_to_known_factors(res)
#> n disease.state(p) tissue(p) k
#> MAD:NMF 62 3.60e-11 1.10e-02 2
#> MAD:NMF 65 7.68e-15 9.62e-04 3
#> MAD:NMF 63 1.34e-13 1.22e-04 4
#> MAD:NMF 60 2.90e-12 1.78e-05 5
#> MAD:NMF 64 1.81e-12 8.94e-03 6
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 51941 rows and 65 columns.
#> Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'ATC' method.
#> Subgroups are detected by 'hclust' method.
#> Performed in total 1250 partitions by row resampling.
#> Best k for subgroups seems to be 2.
#>
#> Following methods can be applied to this 'ConsensusPartition' object:
#> [1] "cola_report" "collect_classes" "collect_plots"
#> [4] "collect_stats" "colnames" "compare_signatures"
#> [7] "consensus_heatmap" "dimension_reduction" "functional_enrichment"
#> [10] "get_anno_col" "get_anno" "get_classes"
#> [13] "get_consensus" "get_matrix" "get_membership"
#> [16] "get_param" "get_signatures" "get_stats"
#> [19] "is_best_k" "is_stable_k" "membership_heatmap"
#> [22] "ncol" "nrow" "plot_ecdf"
#> [25] "rownames" "select_partition_number" "show"
#> [28] "suggest_best_k" "test_to_known_factors"
collect_plots()
function collects all the plots made from res
for all k
(number of partitions)
into one single page to provide an easy and fast comparison between different k
.
collect_plots(res)
The plots are:
k
and the heatmap of
predicted classes for each k
.k
.k
.k
.All the plots in panels can be made by individual functions and they are plotted later in this section.
select_partition_number()
produces several plots showing different
statistics for choosing “optimized” k
. There are following statistics:
k
;k
, the area increased is defined as \(A_k - A_{k-1}\).The detailed explanations of these statistics can be found in the cola vignette.
Generally speaking, lower PAC score, higher mean silhouette score or higher
concordance corresponds to better partition. Rand index and Jaccard index
measure how similar the current partition is compared to partition with k-1
.
If they are too similar, we won't accept k
is better than k-1
.
select_partition_number(res)
The numeric values for all these statistics can be obtained by get_stats()
.
get_stats(res)
#> k 1-PAC mean_silhouette concordance area_increased Rand Jaccard
#> 2 2 1.000 1.000 1.000 0.4554 0.545 0.545
#> 3 3 0.750 0.771 0.869 0.3303 0.893 0.804
#> 4 4 0.771 0.746 0.819 0.1203 0.899 0.770
#> 5 5 0.786 0.722 0.856 0.0425 0.950 0.852
#> 6 6 0.777 0.754 0.816 0.0166 0.893 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
#> GSM1060768 2 0 1 0 1
#> GSM1060769 2 0 1 0 1
#> GSM1060770 2 0 1 0 1
#> GSM1060771 2 0 1 0 1
#> GSM1060772 2 0 1 0 1
#> GSM1060773 1 0 1 1 0
#> GSM1060774 2 0 1 0 1
#> GSM1060775 2 0 1 0 1
#> GSM1060776 2 0 1 0 1
#> GSM1060777 2 0 1 0 1
#> GSM1060778 2 0 1 0 1
#> GSM1060779 2 0 1 0 1
#> GSM1060780 2 0 1 0 1
#> GSM1060781 2 0 1 0 1
#> GSM1060782 2 0 1 0 1
#> GSM1060783 2 0 1 0 1
#> GSM1060784 2 0 1 0 1
#> GSM1060785 2 0 1 0 1
#> GSM1060786 2 0 1 0 1
#> GSM1060787 2 0 1 0 1
#> GSM1060788 2 0 1 0 1
#> GSM1060789 2 0 1 0 1
#> GSM1060790 2 0 1 0 1
#> GSM1060754 1 0 1 1 0
#> GSM1060745 1 0 1 1 0
#> GSM1060756 1 0 1 1 0
#> GSM1060746 1 0 1 1 0
#> GSM1060758 1 0 1 1 0
#> GSM1060765 1 0 1 1 0
#> GSM1060732 1 0 1 1 0
#> GSM1060727 1 0 1 1 0
#> GSM1060740 1 0 1 1 0
#> GSM1060730 1 0 1 1 0
#> GSM1060737 1 0 1 1 0
#> GSM1060743 1 0 1 1 0
#> GSM1060734 1 0 1 1 0
#> GSM1060729 1 0 1 1 0
#> GSM1060744 1 0 1 1 0
#> GSM1060742 1 0 1 1 0
#> GSM1060752 1 0 1 1 0
#> GSM1060755 1 0 1 1 0
#> GSM1060761 1 0 1 1 0
#> GSM1060760 1 0 1 1 0
#> GSM1060767 1 0 1 1 0
#> GSM1060741 1 0 1 1 0
#> GSM1060759 1 0 1 1 0
#> GSM1060728 1 0 1 1 0
#> GSM1060763 1 0 1 1 0
#> GSM1060747 1 0 1 1 0
#> GSM1060764 1 0 1 1 0
#> GSM1060733 1 0 1 1 0
#> GSM1060735 1 0 1 1 0
#> GSM1060739 1 0 1 1 0
#> GSM1060753 1 0 1 1 0
#> GSM1060738 1 0 1 1 0
#> GSM1060762 1 0 1 1 0
#> GSM1060731 1 0 1 1 0
#> GSM1060750 1 0 1 1 0
#> GSM1060749 1 0 1 1 0
#> GSM1060736 1 0 1 1 0
#> GSM1060748 1 0 1 1 0
#> GSM1060751 1 0 1 1 0
#> GSM1060766 1 0 1 1 0
#> GSM1060757 1 0 1 1 0
#> GSM1060726 1 0 1 1 0
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> GSM1060768 2 0.0000 1.0000 0.000 1 0.000
#> GSM1060769 2 0.0000 1.0000 0.000 1 0.000
#> GSM1060770 2 0.0000 1.0000 0.000 1 0.000
#> GSM1060771 2 0.0000 1.0000 0.000 1 0.000
#> GSM1060772 2 0.0000 1.0000 0.000 1 0.000
#> GSM1060773 1 0.5291 0.6276 0.732 0 0.268
#> GSM1060774 2 0.0000 1.0000 0.000 1 0.000
#> GSM1060775 2 0.0000 1.0000 0.000 1 0.000
#> GSM1060776 2 0.0000 1.0000 0.000 1 0.000
#> GSM1060777 2 0.0000 1.0000 0.000 1 0.000
#> GSM1060778 2 0.0000 1.0000 0.000 1 0.000
#> GSM1060779 2 0.0000 1.0000 0.000 1 0.000
#> GSM1060780 2 0.0000 1.0000 0.000 1 0.000
#> GSM1060781 2 0.0000 1.0000 0.000 1 0.000
#> GSM1060782 2 0.0000 1.0000 0.000 1 0.000
#> GSM1060783 2 0.0000 1.0000 0.000 1 0.000
#> GSM1060784 2 0.0000 1.0000 0.000 1 0.000
#> GSM1060785 2 0.0000 1.0000 0.000 1 0.000
#> GSM1060786 2 0.0000 1.0000 0.000 1 0.000
#> GSM1060787 2 0.0000 1.0000 0.000 1 0.000
#> GSM1060788 2 0.0000 1.0000 0.000 1 0.000
#> GSM1060789 2 0.0000 1.0000 0.000 1 0.000
#> GSM1060790 2 0.0000 1.0000 0.000 1 0.000
#> GSM1060754 1 0.3816 0.6426 0.852 0 0.148
#> GSM1060745 1 0.6154 -0.0390 0.592 0 0.408
#> GSM1060756 1 0.3816 0.6426 0.852 0 0.148
#> GSM1060746 1 0.0424 0.7769 0.992 0 0.008
#> GSM1060758 1 0.5706 0.3260 0.680 0 0.320
#> GSM1060765 1 0.0892 0.7779 0.980 0 0.020
#> GSM1060732 3 0.5291 1.0000 0.268 0 0.732
#> GSM1060727 3 0.5291 1.0000 0.268 0 0.732
#> GSM1060740 1 0.0892 0.7794 0.980 0 0.020
#> GSM1060730 3 0.5291 1.0000 0.268 0 0.732
#> GSM1060737 1 0.0592 0.7801 0.988 0 0.012
#> GSM1060743 1 0.0892 0.7779 0.980 0 0.020
#> GSM1060734 1 0.6154 -0.0390 0.592 0 0.408
#> GSM1060729 3 0.5291 1.0000 0.268 0 0.732
#> GSM1060744 1 0.6140 -0.0224 0.596 0 0.404
#> GSM1060742 1 0.0892 0.7728 0.980 0 0.020
#> GSM1060752 1 0.0892 0.7727 0.980 0 0.020
#> GSM1060755 1 0.5291 0.6276 0.732 0 0.268
#> GSM1060761 1 0.0747 0.7792 0.984 0 0.016
#> GSM1060760 1 0.0747 0.7792 0.984 0 0.016
#> GSM1060767 1 0.0892 0.7798 0.980 0 0.020
#> GSM1060741 1 0.0892 0.7728 0.980 0 0.020
#> GSM1060759 1 0.0747 0.7792 0.984 0 0.016
#> GSM1060728 1 0.5291 0.6276 0.732 0 0.268
#> GSM1060763 1 0.0424 0.7769 0.992 0 0.008
#> GSM1060747 1 0.6154 -0.0390 0.592 0 0.408
#> GSM1060764 1 0.5291 0.6276 0.732 0 0.268
#> GSM1060733 1 0.6154 -0.0390 0.592 0 0.408
#> GSM1060735 1 0.0892 0.7779 0.980 0 0.020
#> GSM1060739 1 0.0892 0.7794 0.980 0 0.020
#> GSM1060753 1 0.0892 0.7727 0.980 0 0.020
#> GSM1060738 1 0.0892 0.7794 0.980 0 0.020
#> GSM1060762 1 0.6045 0.1015 0.620 0 0.380
#> GSM1060731 3 0.5291 1.0000 0.268 0 0.732
#> GSM1060750 1 0.5291 0.6276 0.732 0 0.268
#> GSM1060749 1 0.0892 0.7727 0.980 0 0.020
#> GSM1060736 1 0.0592 0.7801 0.988 0 0.012
#> GSM1060748 1 0.5291 0.6276 0.732 0 0.268
#> GSM1060751 1 0.0892 0.7779 0.980 0 0.020
#> GSM1060766 1 0.5291 0.6276 0.732 0 0.268
#> GSM1060757 1 0.5291 0.6276 0.732 0 0.268
#> GSM1060726 3 0.5291 1.0000 0.268 0 0.732
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> GSM1060768 2 0.0000 1.000 0.000 1 0.000 0.000
#> GSM1060769 2 0.0000 1.000 0.000 1 0.000 0.000
#> GSM1060770 2 0.0000 1.000 0.000 1 0.000 0.000
#> GSM1060771 2 0.0000 1.000 0.000 1 0.000 0.000
#> GSM1060772 2 0.0000 1.000 0.000 1 0.000 0.000
#> GSM1060773 4 0.4955 0.928 0.444 0 0.000 0.556
#> GSM1060774 2 0.0000 1.000 0.000 1 0.000 0.000
#> GSM1060775 2 0.0000 1.000 0.000 1 0.000 0.000
#> GSM1060776 2 0.0000 1.000 0.000 1 0.000 0.000
#> GSM1060777 2 0.0000 1.000 0.000 1 0.000 0.000
#> GSM1060778 2 0.0000 1.000 0.000 1 0.000 0.000
#> GSM1060779 2 0.0000 1.000 0.000 1 0.000 0.000
#> GSM1060780 2 0.0000 1.000 0.000 1 0.000 0.000
#> GSM1060781 2 0.0000 1.000 0.000 1 0.000 0.000
#> GSM1060782 2 0.0000 1.000 0.000 1 0.000 0.000
#> GSM1060783 2 0.0000 1.000 0.000 1 0.000 0.000
#> GSM1060784 2 0.0000 1.000 0.000 1 0.000 0.000
#> GSM1060785 2 0.0000 1.000 0.000 1 0.000 0.000
#> GSM1060786 2 0.0000 1.000 0.000 1 0.000 0.000
#> GSM1060787 2 0.0000 1.000 0.000 1 0.000 0.000
#> GSM1060788 2 0.0000 1.000 0.000 1 0.000 0.000
#> GSM1060789 2 0.0000 1.000 0.000 1 0.000 0.000
#> GSM1060790 2 0.0000 1.000 0.000 1 0.000 0.000
#> GSM1060754 1 0.3157 0.565 0.852 0 0.144 0.004
#> GSM1060745 1 0.4994 0.394 0.520 0 0.480 0.000
#> GSM1060756 1 0.3157 0.565 0.852 0 0.144 0.004
#> GSM1060746 1 0.0817 0.612 0.976 0 0.000 0.024
#> GSM1060758 1 0.6179 0.428 0.608 0 0.320 0.072
#> GSM1060765 1 0.3356 0.351 0.824 0 0.000 0.176
#> GSM1060732 3 0.4948 1.000 0.000 0 0.560 0.440
#> GSM1060727 3 0.4948 1.000 0.000 0 0.560 0.440
#> GSM1060740 1 0.1022 0.605 0.968 0 0.000 0.032
#> GSM1060730 3 0.4948 1.000 0.000 0 0.560 0.440
#> GSM1060737 1 0.3024 0.417 0.852 0 0.000 0.148
#> GSM1060743 1 0.3356 0.351 0.824 0 0.000 0.176
#> GSM1060734 1 0.4981 0.405 0.536 0 0.464 0.000
#> GSM1060729 3 0.4948 1.000 0.000 0 0.560 0.440
#> GSM1060744 1 0.4977 0.407 0.540 0 0.460 0.000
#> GSM1060742 1 0.0469 0.624 0.988 0 0.012 0.000
#> GSM1060752 1 0.0469 0.624 0.988 0 0.012 0.000
#> GSM1060755 4 0.4994 0.988 0.480 0 0.000 0.520
#> GSM1060761 1 0.0817 0.612 0.976 0 0.000 0.024
#> GSM1060760 1 0.0817 0.612 0.976 0 0.000 0.024
#> GSM1060767 1 0.3266 0.366 0.832 0 0.000 0.168
#> GSM1060741 1 0.0469 0.624 0.988 0 0.012 0.000
#> GSM1060759 1 0.0817 0.612 0.976 0 0.000 0.024
#> GSM1060728 4 0.4994 0.988 0.480 0 0.000 0.520
#> GSM1060763 1 0.0817 0.612 0.976 0 0.000 0.024
#> GSM1060747 1 0.4994 0.394 0.520 0 0.480 0.000
#> GSM1060764 4 0.4994 0.988 0.480 0 0.000 0.520
#> GSM1060733 1 0.4981 0.405 0.536 0 0.464 0.000
#> GSM1060735 1 0.3356 0.351 0.824 0 0.000 0.176
#> GSM1060739 1 0.1022 0.605 0.968 0 0.000 0.032
#> GSM1060753 1 0.0469 0.624 0.988 0 0.012 0.000
#> GSM1060738 1 0.1022 0.605 0.968 0 0.000 0.032
#> GSM1060762 1 0.6442 0.367 0.492 0 0.440 0.068
#> GSM1060731 3 0.4948 1.000 0.000 0 0.560 0.440
#> GSM1060750 4 0.4994 0.988 0.480 0 0.000 0.520
#> GSM1060749 1 0.0469 0.624 0.988 0 0.012 0.000
#> GSM1060736 1 0.3024 0.417 0.852 0 0.000 0.148
#> GSM1060748 4 0.4994 0.988 0.480 0 0.000 0.520
#> GSM1060751 1 0.3356 0.351 0.824 0 0.000 0.176
#> GSM1060766 1 0.4992 -0.890 0.524 0 0.000 0.476
#> GSM1060757 4 0.4994 0.988 0.480 0 0.000 0.520
#> GSM1060726 3 0.4948 1.000 0.000 0 0.560 0.440
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> GSM1060768 2 0.0000 1.000 0.000 1 0.000 0.000 0.000
#> GSM1060769 2 0.0000 1.000 0.000 1 0.000 0.000 0.000
#> GSM1060770 2 0.0000 1.000 0.000 1 0.000 0.000 0.000
#> GSM1060771 2 0.0000 1.000 0.000 1 0.000 0.000 0.000
#> GSM1060772 2 0.0000 1.000 0.000 1 0.000 0.000 0.000
#> GSM1060773 4 0.2189 0.100 0.012 0 0.000 0.904 0.084
#> GSM1060774 2 0.0000 1.000 0.000 1 0.000 0.000 0.000
#> GSM1060775 2 0.0000 1.000 0.000 1 0.000 0.000 0.000
#> GSM1060776 2 0.0000 1.000 0.000 1 0.000 0.000 0.000
#> GSM1060777 2 0.0000 1.000 0.000 1 0.000 0.000 0.000
#> GSM1060778 2 0.0000 1.000 0.000 1 0.000 0.000 0.000
#> GSM1060779 2 0.0000 1.000 0.000 1 0.000 0.000 0.000
#> GSM1060780 2 0.0000 1.000 0.000 1 0.000 0.000 0.000
#> GSM1060781 2 0.0000 1.000 0.000 1 0.000 0.000 0.000
#> GSM1060782 2 0.0000 1.000 0.000 1 0.000 0.000 0.000
#> GSM1060783 2 0.0000 1.000 0.000 1 0.000 0.000 0.000
#> GSM1060784 2 0.0000 1.000 0.000 1 0.000 0.000 0.000
#> GSM1060785 2 0.0000 1.000 0.000 1 0.000 0.000 0.000
#> GSM1060786 2 0.0000 1.000 0.000 1 0.000 0.000 0.000
#> GSM1060787 2 0.0000 1.000 0.000 1 0.000 0.000 0.000
#> GSM1060788 2 0.0000 1.000 0.000 1 0.000 0.000 0.000
#> GSM1060789 2 0.0000 1.000 0.000 1 0.000 0.000 0.000
#> GSM1060790 2 0.0000 1.000 0.000 1 0.000 0.000 0.000
#> GSM1060754 1 0.3273 0.582 0.848 0 0.036 0.004 0.112
#> GSM1060745 5 0.4980 0.657 0.380 0 0.036 0.000 0.584
#> GSM1060756 1 0.3273 0.582 0.848 0 0.036 0.004 0.112
#> GSM1060746 1 0.0703 0.686 0.976 0 0.000 0.024 0.000
#> GSM1060758 5 0.4238 0.544 0.088 0 0.000 0.136 0.776
#> GSM1060765 1 0.2966 0.515 0.816 0 0.000 0.184 0.000
#> GSM1060732 3 0.0000 1.000 0.000 0 1.000 0.000 0.000
#> GSM1060727 3 0.0000 1.000 0.000 0 1.000 0.000 0.000
#> GSM1060740 1 0.0794 0.684 0.972 0 0.000 0.028 0.000
#> GSM1060730 3 0.0000 1.000 0.000 0 1.000 0.000 0.000
#> GSM1060737 1 0.2773 0.546 0.836 0 0.000 0.164 0.000
#> GSM1060743 1 0.2966 0.515 0.816 0 0.000 0.184 0.000
#> GSM1060734 1 0.5083 -0.431 0.532 0 0.036 0.000 0.432
#> GSM1060729 3 0.0000 1.000 0.000 0 1.000 0.000 0.000
#> GSM1060744 1 0.5077 -0.424 0.536 0 0.036 0.000 0.428
#> GSM1060742 1 0.0566 0.691 0.984 0 0.004 0.000 0.012
#> GSM1060752 1 0.0510 0.691 0.984 0 0.000 0.000 0.016
#> GSM1060755 4 0.4283 0.839 0.456 0 0.000 0.544 0.000
#> GSM1060761 1 0.4307 0.531 0.772 0 0.000 0.128 0.100
#> GSM1060760 1 0.4307 0.531 0.772 0 0.000 0.128 0.100
#> GSM1060767 1 0.2891 0.525 0.824 0 0.000 0.176 0.000
#> GSM1060741 1 0.0566 0.691 0.984 0 0.004 0.000 0.012
#> GSM1060759 1 0.4307 0.531 0.772 0 0.000 0.128 0.100
#> GSM1060728 4 0.4283 0.839 0.456 0 0.000 0.544 0.000
#> GSM1060763 1 0.0703 0.686 0.976 0 0.000 0.024 0.000
#> GSM1060747 5 0.4980 0.657 0.380 0 0.036 0.000 0.584
#> GSM1060764 4 0.4283 0.839 0.456 0 0.000 0.544 0.000
#> GSM1060733 1 0.5083 -0.431 0.532 0 0.036 0.000 0.432
#> GSM1060735 1 0.2966 0.515 0.816 0 0.000 0.184 0.000
#> GSM1060739 1 0.0794 0.684 0.972 0 0.000 0.028 0.000
#> GSM1060753 1 0.0510 0.691 0.984 0 0.000 0.000 0.016
#> GSM1060738 1 0.0794 0.684 0.972 0 0.000 0.028 0.000
#> GSM1060762 5 0.3203 0.665 0.168 0 0.000 0.012 0.820
#> GSM1060731 3 0.0000 1.000 0.000 0 1.000 0.000 0.000
#> GSM1060750 4 0.4283 0.839 0.456 0 0.000 0.544 0.000
#> GSM1060749 1 0.0510 0.691 0.984 0 0.000 0.000 0.016
#> GSM1060736 1 0.2773 0.546 0.836 0 0.000 0.164 0.000
#> GSM1060748 4 0.4283 0.839 0.456 0 0.000 0.544 0.000
#> GSM1060751 1 0.2966 0.515 0.816 0 0.000 0.184 0.000
#> GSM1060766 1 0.4306 -0.736 0.508 0 0.000 0.492 0.000
#> GSM1060757 4 0.4283 0.839 0.456 0 0.000 0.544 0.000
#> GSM1060726 3 0.0000 1.000 0.000 0 1.000 0.000 0.000
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> GSM1060768 5 0.0000 1.000 0.000 0.000 0 0.000 1 0.000
#> GSM1060769 5 0.0000 1.000 0.000 0.000 0 0.000 1 0.000
#> GSM1060770 5 0.0000 1.000 0.000 0.000 0 0.000 1 0.000
#> GSM1060771 5 0.0000 1.000 0.000 0.000 0 0.000 1 0.000
#> GSM1060772 5 0.0000 1.000 0.000 0.000 0 0.000 1 0.000
#> GSM1060773 2 0.2624 0.000 0.020 0.856 0 0.124 0 0.000
#> GSM1060774 5 0.0000 1.000 0.000 0.000 0 0.000 1 0.000
#> GSM1060775 5 0.0000 1.000 0.000 0.000 0 0.000 1 0.000
#> GSM1060776 5 0.0000 1.000 0.000 0.000 0 0.000 1 0.000
#> GSM1060777 5 0.0000 1.000 0.000 0.000 0 0.000 1 0.000
#> GSM1060778 5 0.0000 1.000 0.000 0.000 0 0.000 1 0.000
#> GSM1060779 5 0.0000 1.000 0.000 0.000 0 0.000 1 0.000
#> GSM1060780 5 0.0000 1.000 0.000 0.000 0 0.000 1 0.000
#> GSM1060781 5 0.0000 1.000 0.000 0.000 0 0.000 1 0.000
#> GSM1060782 5 0.0000 1.000 0.000 0.000 0 0.000 1 0.000
#> GSM1060783 5 0.0000 1.000 0.000 0.000 0 0.000 1 0.000
#> GSM1060784 5 0.0000 1.000 0.000 0.000 0 0.000 1 0.000
#> GSM1060785 5 0.0000 1.000 0.000 0.000 0 0.000 1 0.000
#> GSM1060786 5 0.0000 1.000 0.000 0.000 0 0.000 1 0.000
#> GSM1060787 5 0.0000 1.000 0.000 0.000 0 0.000 1 0.000
#> GSM1060788 5 0.0000 1.000 0.000 0.000 0 0.000 1 0.000
#> GSM1060789 5 0.0000 1.000 0.000 0.000 0 0.000 1 0.000
#> GSM1060790 5 0.0000 1.000 0.000 0.000 0 0.000 1 0.000
#> GSM1060754 1 0.2454 0.366 0.840 0.000 0 0.000 0 0.160
#> GSM1060745 6 0.5714 0.880 0.368 0.000 0 0.168 0 0.464
#> GSM1060756 1 0.2454 0.366 0.840 0.000 0 0.000 0 0.160
#> GSM1060746 1 0.0692 0.640 0.976 0.004 0 0.000 0 0.020
#> GSM1060758 4 0.0146 0.666 0.000 0.000 0 0.996 0 0.004
#> GSM1060765 1 0.3066 0.654 0.832 0.124 0 0.000 0 0.044
#> GSM1060732 3 0.0000 1.000 0.000 0.000 1 0.000 0 0.000
#> GSM1060727 3 0.0000 1.000 0.000 0.000 1 0.000 0 0.000
#> GSM1060740 1 0.0777 0.642 0.972 0.004 0 0.000 0 0.024
#> GSM1060730 3 0.0000 1.000 0.000 0.000 1 0.000 0 0.000
#> GSM1060737 1 0.2858 0.653 0.844 0.124 0 0.000 0 0.032
#> GSM1060743 1 0.3066 0.654 0.832 0.124 0 0.000 0 0.044
#> GSM1060734 6 0.4066 0.920 0.392 0.000 0 0.012 0 0.596
#> GSM1060729 3 0.0000 1.000 0.000 0.000 1 0.000 0 0.000
#> GSM1060744 6 0.4018 0.909 0.412 0.000 0 0.008 0 0.580
#> GSM1060742 1 0.1049 0.610 0.960 0.008 0 0.000 0 0.032
#> GSM1060752 1 0.1049 0.610 0.960 0.008 0 0.000 0 0.032
#> GSM1060755 1 0.5921 0.328 0.460 0.240 0 0.000 0 0.300
#> GSM1060761 1 0.3584 0.413 0.740 0.012 0 0.244 0 0.004
#> GSM1060760 1 0.3584 0.413 0.740 0.012 0 0.244 0 0.004
#> GSM1060767 1 0.2930 0.654 0.840 0.124 0 0.000 0 0.036
#> GSM1060741 1 0.1049 0.610 0.960 0.008 0 0.000 0 0.032
#> GSM1060759 1 0.3584 0.413 0.740 0.012 0 0.244 0 0.004
#> GSM1060728 1 0.5921 0.328 0.460 0.240 0 0.000 0 0.300
#> GSM1060763 1 0.0692 0.640 0.976 0.004 0 0.000 0 0.020
#> GSM1060747 6 0.5714 0.880 0.368 0.000 0 0.168 0 0.464
#> GSM1060764 1 0.5921 0.328 0.460 0.240 0 0.000 0 0.300
#> GSM1060733 6 0.4066 0.920 0.392 0.000 0 0.012 0 0.596
#> GSM1060735 1 0.3066 0.654 0.832 0.124 0 0.000 0 0.044
#> GSM1060739 1 0.0777 0.642 0.972 0.004 0 0.000 0 0.024
#> GSM1060753 1 0.1049 0.610 0.960 0.008 0 0.000 0 0.032
#> GSM1060738 1 0.0777 0.642 0.972 0.004 0 0.000 0 0.024
#> GSM1060762 4 0.4083 0.682 0.000 0.132 0 0.752 0 0.116
#> GSM1060731 3 0.0000 1.000 0.000 0.000 1 0.000 0 0.000
#> GSM1060750 1 0.5921 0.328 0.460 0.240 0 0.000 0 0.300
#> GSM1060749 1 0.1049 0.610 0.960 0.008 0 0.000 0 0.032
#> GSM1060736 1 0.2858 0.653 0.844 0.124 0 0.000 0 0.032
#> GSM1060748 1 0.5921 0.328 0.460 0.240 0 0.000 0 0.300
#> GSM1060751 1 0.3066 0.654 0.832 0.124 0 0.000 0 0.044
#> GSM1060766 1 0.5692 0.397 0.512 0.192 0 0.000 0 0.296
#> GSM1060757 1 0.5921 0.328 0.460 0.240 0 0.000 0 0.300
#> GSM1060726 3 0.0000 1.000 0.000 0.000 1 0.000 0 0.000
Heatmaps for the consensus matrix. It visualizes the probability of two samples to be in a same group.
consensus_heatmap(res, k = 2)
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)
Test correlation between subgroups and known annotations. If the known annotation is numeric, one-way ANOVA test is applied, and if the known annotation is discrete, chi-squared contingency table test is applied.
test_to_known_factors(res)
#> n disease.state(p) tissue(p) k
#> ATC:hclust 65 5.53e-14 3.07e-02 2
#> ATC:hclust 58 1.92e-12 1.15e-03 3
#> ATC:hclust 50 4.33e-10 4.15e-05 4
#> ATC:hclust 60 2.90e-12 6.92e-06 5
#> ATC:hclust 52 1.38e-10 1.12e-06 6
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 51941 rows and 65 columns.
#> Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'ATC' method.
#> Subgroups are detected by 'kmeans' method.
#> Performed in total 1250 partitions by row resampling.
#> Best k for subgroups seems to be 2.
#>
#> Following methods can be applied to this 'ConsensusPartition' object:
#> [1] "cola_report" "collect_classes" "collect_plots"
#> [4] "collect_stats" "colnames" "compare_signatures"
#> [7] "consensus_heatmap" "dimension_reduction" "functional_enrichment"
#> [10] "get_anno_col" "get_anno" "get_classes"
#> [13] "get_consensus" "get_matrix" "get_membership"
#> [16] "get_param" "get_signatures" "get_stats"
#> [19] "is_best_k" "is_stable_k" "membership_heatmap"
#> [22] "ncol" "nrow" "plot_ecdf"
#> [25] "rownames" "select_partition_number" "show"
#> [28] "suggest_best_k" "test_to_known_factors"
collect_plots()
function collects all the plots made from res
for all k
(number of partitions)
into one single page to provide an easy and fast comparison between different k
.
collect_plots(res)
The plots are:
k
and the heatmap of
predicted classes for each k
.k
.k
.k
.All the plots in panels can be made by individual functions and they are plotted later in this section.
select_partition_number()
produces several plots showing different
statistics for choosing “optimized” k
. There are following statistics:
k
;k
, the area increased is defined as \(A_k - A_{k-1}\).The detailed explanations of these statistics can be found in the cola vignette.
Generally speaking, lower PAC score, higher mean silhouette score or higher
concordance corresponds to better partition. Rand index and Jaccard index
measure how similar the current partition is compared to partition with k-1
.
If they are too similar, we won't accept k
is better than k-1
.
select_partition_number(res)
The numeric values for all these statistics can be obtained by get_stats()
.
get_stats(res)
#> k 1-PAC mean_silhouette concordance area_increased Rand Jaccard
#> 2 2 1.000 1.000 1.000 0.4554 0.545 0.545
#> 3 3 0.663 0.816 0.842 0.2775 0.893 0.804
#> 4 4 0.611 0.527 0.727 0.1815 0.951 0.888
#> 5 5 0.623 0.546 0.726 0.0771 0.853 0.632
#> 6 6 0.654 0.558 0.715 0.0591 0.918 0.705
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
#> GSM1060768 2 0 1 0 1
#> GSM1060769 2 0 1 0 1
#> GSM1060770 2 0 1 0 1
#> GSM1060771 2 0 1 0 1
#> GSM1060772 2 0 1 0 1
#> GSM1060773 1 0 1 1 0
#> GSM1060774 2 0 1 0 1
#> GSM1060775 2 0 1 0 1
#> GSM1060776 2 0 1 0 1
#> GSM1060777 2 0 1 0 1
#> GSM1060778 2 0 1 0 1
#> GSM1060779 2 0 1 0 1
#> GSM1060780 2 0 1 0 1
#> GSM1060781 2 0 1 0 1
#> GSM1060782 2 0 1 0 1
#> GSM1060783 2 0 1 0 1
#> GSM1060784 2 0 1 0 1
#> GSM1060785 2 0 1 0 1
#> GSM1060786 2 0 1 0 1
#> GSM1060787 2 0 1 0 1
#> GSM1060788 2 0 1 0 1
#> GSM1060789 2 0 1 0 1
#> GSM1060790 2 0 1 0 1
#> GSM1060754 1 0 1 1 0
#> GSM1060745 1 0 1 1 0
#> GSM1060756 1 0 1 1 0
#> GSM1060746 1 0 1 1 0
#> GSM1060758 1 0 1 1 0
#> GSM1060765 1 0 1 1 0
#> GSM1060732 1 0 1 1 0
#> GSM1060727 1 0 1 1 0
#> GSM1060740 1 0 1 1 0
#> GSM1060730 1 0 1 1 0
#> GSM1060737 1 0 1 1 0
#> GSM1060743 1 0 1 1 0
#> GSM1060734 1 0 1 1 0
#> GSM1060729 1 0 1 1 0
#> GSM1060744 1 0 1 1 0
#> GSM1060742 1 0 1 1 0
#> GSM1060752 1 0 1 1 0
#> GSM1060755 1 0 1 1 0
#> GSM1060761 1 0 1 1 0
#> GSM1060760 1 0 1 1 0
#> GSM1060767 1 0 1 1 0
#> GSM1060741 1 0 1 1 0
#> GSM1060759 1 0 1 1 0
#> GSM1060728 1 0 1 1 0
#> GSM1060763 1 0 1 1 0
#> GSM1060747 1 0 1 1 0
#> GSM1060764 1 0 1 1 0
#> GSM1060733 1 0 1 1 0
#> GSM1060735 1 0 1 1 0
#> GSM1060739 1 0 1 1 0
#> GSM1060753 1 0 1 1 0
#> GSM1060738 1 0 1 1 0
#> GSM1060762 1 0 1 1 0
#> GSM1060731 1 0 1 1 0
#> GSM1060750 1 0 1 1 0
#> GSM1060749 1 0 1 1 0
#> GSM1060736 1 0 1 1 0
#> GSM1060748 1 0 1 1 0
#> GSM1060751 1 0 1 1 0
#> GSM1060766 1 0 1 1 0
#> GSM1060757 1 0 1 1 0
#> GSM1060726 1 0 1 1 0
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> GSM1060768 2 0.4796 0.891 0.000 0.780 0.220
#> GSM1060769 2 0.4796 0.891 0.000 0.780 0.220
#> GSM1060770 2 0.4796 0.891 0.000 0.780 0.220
#> GSM1060771 2 0.0892 0.905 0.000 0.980 0.020
#> GSM1060772 2 0.0000 0.908 0.000 1.000 0.000
#> GSM1060773 1 0.5678 0.692 0.776 0.032 0.192
#> GSM1060774 2 0.0592 0.905 0.000 0.988 0.012
#> GSM1060775 2 0.0000 0.908 0.000 1.000 0.000
#> GSM1060776 2 0.0592 0.905 0.000 0.988 0.012
#> GSM1060777 2 0.0892 0.905 0.000 0.980 0.020
#> GSM1060778 2 0.4796 0.891 0.000 0.780 0.220
#> GSM1060779 2 0.4796 0.891 0.000 0.780 0.220
#> GSM1060780 2 0.0424 0.907 0.000 0.992 0.008
#> GSM1060781 2 0.0892 0.905 0.000 0.980 0.020
#> GSM1060782 2 0.4796 0.891 0.000 0.780 0.220
#> GSM1060783 2 0.4796 0.893 0.000 0.780 0.220
#> GSM1060784 2 0.4796 0.893 0.000 0.780 0.220
#> GSM1060785 2 0.0892 0.905 0.000 0.980 0.020
#> GSM1060786 2 0.0000 0.908 0.000 1.000 0.000
#> GSM1060787 2 0.4796 0.893 0.000 0.780 0.220
#> GSM1060788 2 0.2165 0.907 0.000 0.936 0.064
#> GSM1060789 2 0.4796 0.893 0.000 0.780 0.220
#> GSM1060790 2 0.0000 0.908 0.000 1.000 0.000
#> GSM1060754 1 0.1163 0.814 0.972 0.000 0.028
#> GSM1060745 1 0.4887 0.432 0.772 0.000 0.228
#> GSM1060756 1 0.4121 0.610 0.832 0.000 0.168
#> GSM1060746 1 0.0892 0.816 0.980 0.000 0.020
#> GSM1060758 1 0.4235 0.748 0.824 0.000 0.176
#> GSM1060765 1 0.1289 0.812 0.968 0.000 0.032
#> GSM1060732 3 0.6180 1.000 0.416 0.000 0.584
#> GSM1060727 3 0.6180 1.000 0.416 0.000 0.584
#> GSM1060740 1 0.0892 0.813 0.980 0.000 0.020
#> GSM1060730 3 0.6180 1.000 0.416 0.000 0.584
#> GSM1060737 1 0.1289 0.812 0.968 0.000 0.032
#> GSM1060743 1 0.1289 0.812 0.968 0.000 0.032
#> GSM1060734 1 0.4887 0.432 0.772 0.000 0.228
#> GSM1060729 3 0.6180 1.000 0.416 0.000 0.584
#> GSM1060744 1 0.4605 0.503 0.796 0.000 0.204
#> GSM1060742 1 0.0892 0.813 0.980 0.000 0.020
#> GSM1060752 1 0.0892 0.813 0.980 0.000 0.020
#> GSM1060755 1 0.4399 0.747 0.812 0.000 0.188
#> GSM1060761 1 0.4235 0.748 0.824 0.000 0.176
#> GSM1060760 1 0.4235 0.748 0.824 0.000 0.176
#> GSM1060767 1 0.1031 0.815 0.976 0.000 0.024
#> GSM1060741 1 0.0892 0.813 0.980 0.000 0.020
#> GSM1060759 1 0.4235 0.748 0.824 0.000 0.176
#> GSM1060728 1 0.2711 0.804 0.912 0.000 0.088
#> GSM1060763 1 0.0892 0.816 0.980 0.000 0.020
#> GSM1060747 1 0.4887 0.432 0.772 0.000 0.228
#> GSM1060764 1 0.1289 0.812 0.968 0.000 0.032
#> GSM1060733 1 0.4887 0.432 0.772 0.000 0.228
#> GSM1060735 1 0.1529 0.813 0.960 0.000 0.040
#> GSM1060739 1 0.0892 0.813 0.980 0.000 0.020
#> GSM1060753 1 0.3879 0.766 0.848 0.000 0.152
#> GSM1060738 1 0.1289 0.812 0.968 0.000 0.032
#> GSM1060762 1 0.3482 0.783 0.872 0.000 0.128
#> GSM1060731 3 0.6180 1.000 0.416 0.000 0.584
#> GSM1060750 1 0.4399 0.747 0.812 0.000 0.188
#> GSM1060749 1 0.0892 0.813 0.980 0.000 0.020
#> GSM1060736 1 0.0424 0.818 0.992 0.000 0.008
#> GSM1060748 1 0.4555 0.735 0.800 0.000 0.200
#> GSM1060751 1 0.0592 0.817 0.988 0.000 0.012
#> GSM1060766 1 0.4399 0.747 0.812 0.000 0.188
#> GSM1060757 1 0.4399 0.747 0.812 0.000 0.188
#> GSM1060726 3 0.6180 1.000 0.416 0.000 0.584
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> GSM1060768 2 0.0524 0.78440 0.000 0.988 0.004 0.008
#> GSM1060769 2 0.0524 0.78440 0.000 0.988 0.004 0.008
#> GSM1060770 2 0.0524 0.78440 0.000 0.988 0.004 0.008
#> GSM1060771 2 0.4950 0.81859 0.000 0.620 0.004 0.376
#> GSM1060772 2 0.4790 0.81856 0.000 0.620 0.000 0.380
#> GSM1060773 1 0.7398 -0.46339 0.456 0.000 0.168 0.376
#> GSM1060774 2 0.4964 0.81716 0.000 0.616 0.004 0.380
#> GSM1060775 2 0.4790 0.81856 0.000 0.620 0.000 0.380
#> GSM1060776 2 0.4964 0.81716 0.000 0.616 0.004 0.380
#> GSM1060777 2 0.4950 0.81859 0.000 0.620 0.004 0.376
#> GSM1060778 2 0.0524 0.78440 0.000 0.988 0.004 0.008
#> GSM1060779 2 0.0524 0.78440 0.000 0.988 0.004 0.008
#> GSM1060780 2 0.4950 0.81859 0.000 0.620 0.004 0.376
#> GSM1060781 2 0.5244 0.81028 0.000 0.600 0.012 0.388
#> GSM1060782 2 0.0524 0.78440 0.000 0.988 0.004 0.008
#> GSM1060783 2 0.0592 0.78726 0.000 0.984 0.016 0.000
#> GSM1060784 2 0.0592 0.78726 0.000 0.984 0.016 0.000
#> GSM1060785 2 0.4950 0.81859 0.000 0.620 0.004 0.376
#> GSM1060786 2 0.4790 0.81856 0.000 0.620 0.000 0.380
#> GSM1060787 2 0.0592 0.78726 0.000 0.984 0.016 0.000
#> GSM1060788 2 0.4776 0.81436 0.000 0.712 0.016 0.272
#> GSM1060789 2 0.0592 0.78726 0.000 0.984 0.016 0.000
#> GSM1060790 2 0.4790 0.81856 0.000 0.620 0.000 0.380
#> GSM1060754 1 0.2888 0.50186 0.872 0.000 0.004 0.124
#> GSM1060745 1 0.6695 0.25268 0.616 0.000 0.164 0.220
#> GSM1060756 1 0.4931 0.43080 0.776 0.000 0.092 0.132
#> GSM1060746 1 0.0921 0.55564 0.972 0.000 0.028 0.000
#> GSM1060758 4 0.7039 0.85047 0.316 0.000 0.144 0.540
#> GSM1060765 1 0.2623 0.53415 0.908 0.000 0.028 0.064
#> GSM1060732 3 0.3494 0.99725 0.172 0.000 0.824 0.004
#> GSM1060727 3 0.3311 0.99945 0.172 0.000 0.828 0.000
#> GSM1060740 1 0.1302 0.53860 0.956 0.000 0.000 0.044
#> GSM1060730 3 0.3311 0.99945 0.172 0.000 0.828 0.000
#> GSM1060737 1 0.2623 0.53415 0.908 0.000 0.028 0.064
#> GSM1060743 1 0.2623 0.53415 0.908 0.000 0.028 0.064
#> GSM1060734 1 0.6695 0.25268 0.616 0.000 0.164 0.220
#> GSM1060729 3 0.3311 0.99945 0.172 0.000 0.828 0.000
#> GSM1060744 1 0.6576 0.26337 0.628 0.000 0.152 0.220
#> GSM1060742 1 0.2814 0.49126 0.868 0.000 0.000 0.132
#> GSM1060752 1 0.2408 0.50775 0.896 0.000 0.000 0.104
#> GSM1060755 1 0.7325 -0.42182 0.472 0.000 0.160 0.368
#> GSM1060761 4 0.7231 0.82470 0.392 0.000 0.144 0.464
#> GSM1060760 1 0.6976 -0.50728 0.544 0.000 0.136 0.320
#> GSM1060767 1 0.1256 0.55417 0.964 0.000 0.028 0.008
#> GSM1060741 1 0.2760 0.49431 0.872 0.000 0.000 0.128
#> GSM1060759 1 0.6976 -0.50728 0.544 0.000 0.136 0.320
#> GSM1060728 1 0.6056 0.00742 0.660 0.000 0.092 0.248
#> GSM1060763 1 0.1109 0.55597 0.968 0.000 0.028 0.004
#> GSM1060747 1 0.6695 0.25268 0.616 0.000 0.164 0.220
#> GSM1060764 1 0.2623 0.53415 0.908 0.000 0.028 0.064
#> GSM1060733 1 0.6695 0.25268 0.616 0.000 0.164 0.220
#> GSM1060735 1 0.2722 0.53066 0.904 0.000 0.032 0.064
#> GSM1060739 1 0.0707 0.55104 0.980 0.000 0.000 0.020
#> GSM1060753 1 0.5569 0.17249 0.724 0.000 0.104 0.172
#> GSM1060738 1 0.2623 0.53415 0.908 0.000 0.028 0.064
#> GSM1060762 4 0.7042 0.81287 0.352 0.000 0.132 0.516
#> GSM1060731 3 0.3311 0.99945 0.172 0.000 0.828 0.000
#> GSM1060750 1 0.7325 -0.42182 0.472 0.000 0.160 0.368
#> GSM1060749 1 0.2345 0.50886 0.900 0.000 0.000 0.100
#> GSM1060736 1 0.1059 0.55273 0.972 0.000 0.012 0.016
#> GSM1060748 1 0.7356 -0.42465 0.468 0.000 0.164 0.368
#> GSM1060751 1 0.0779 0.55570 0.980 0.000 0.016 0.004
#> GSM1060766 1 0.7356 -0.42465 0.468 0.000 0.164 0.368
#> GSM1060757 1 0.6823 -0.20082 0.596 0.000 0.160 0.244
#> GSM1060726 3 0.3311 0.99945 0.172 0.000 0.828 0.000
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> GSM1060768 5 0.4278 0.9901 0.000 0.452 0.000 0.000 0.548
#> GSM1060769 5 0.4278 0.9901 0.000 0.452 0.000 0.000 0.548
#> GSM1060770 5 0.4278 0.9901 0.000 0.452 0.000 0.000 0.548
#> GSM1060771 2 0.1648 0.6682 0.000 0.940 0.020 0.040 0.000
#> GSM1060772 2 0.0854 0.6776 0.000 0.976 0.012 0.008 0.004
#> GSM1060773 4 0.5260 0.6496 0.164 0.004 0.004 0.704 0.124
#> GSM1060774 2 0.0854 0.6776 0.000 0.976 0.012 0.008 0.004
#> GSM1060775 2 0.0854 0.6776 0.000 0.976 0.012 0.008 0.004
#> GSM1060776 2 0.1314 0.6681 0.000 0.960 0.012 0.012 0.016
#> GSM1060777 2 0.1648 0.6682 0.000 0.940 0.020 0.040 0.000
#> GSM1060778 5 0.4637 0.9901 0.000 0.452 0.012 0.000 0.536
#> GSM1060779 5 0.4637 0.9901 0.000 0.452 0.012 0.000 0.536
#> GSM1060780 2 0.1310 0.6713 0.000 0.956 0.020 0.024 0.000
#> GSM1060781 2 0.1582 0.6480 0.000 0.944 0.000 0.028 0.028
#> GSM1060782 5 0.4637 0.9901 0.000 0.452 0.012 0.000 0.536
#> GSM1060783 2 0.6714 -0.7029 0.000 0.468 0.064 0.068 0.400
#> GSM1060784 2 0.6759 -0.6972 0.000 0.468 0.068 0.068 0.396
#> GSM1060785 2 0.1648 0.6682 0.000 0.940 0.020 0.040 0.000
#> GSM1060786 2 0.0162 0.6779 0.000 0.996 0.000 0.000 0.004
#> GSM1060787 2 0.6714 -0.7029 0.000 0.468 0.064 0.068 0.400
#> GSM1060788 2 0.5258 0.3453 0.000 0.744 0.068 0.084 0.104
#> GSM1060789 2 0.6714 -0.7029 0.000 0.468 0.064 0.068 0.400
#> GSM1060790 2 0.0854 0.6776 0.000 0.976 0.012 0.008 0.004
#> GSM1060754 1 0.3141 0.5936 0.852 0.000 0.000 0.040 0.108
#> GSM1060745 1 0.7261 0.3103 0.504 0.000 0.116 0.088 0.292
#> GSM1060756 1 0.4112 0.5734 0.812 0.000 0.032 0.044 0.112
#> GSM1060746 1 0.1121 0.6249 0.956 0.000 0.000 0.044 0.000
#> GSM1060758 4 0.6159 0.5845 0.208 0.000 0.004 0.580 0.208
#> GSM1060765 1 0.3143 0.5324 0.796 0.000 0.000 0.204 0.000
#> GSM1060732 3 0.2407 0.9945 0.088 0.000 0.896 0.012 0.004
#> GSM1060727 3 0.2136 0.9989 0.088 0.000 0.904 0.008 0.000
#> GSM1060740 1 0.0000 0.6230 1.000 0.000 0.000 0.000 0.000
#> GSM1060730 3 0.2136 0.9989 0.088 0.000 0.904 0.008 0.000
#> GSM1060737 1 0.3143 0.5324 0.796 0.000 0.000 0.204 0.000
#> GSM1060743 1 0.3109 0.5354 0.800 0.000 0.000 0.200 0.000
#> GSM1060734 1 0.7097 0.3555 0.544 0.000 0.116 0.088 0.252
#> GSM1060729 3 0.2136 0.9989 0.088 0.000 0.904 0.008 0.000
#> GSM1060744 1 0.7019 0.3626 0.552 0.000 0.108 0.088 0.252
#> GSM1060742 1 0.3575 0.5779 0.824 0.000 0.000 0.056 0.120
#> GSM1060752 1 0.2889 0.5962 0.872 0.000 0.000 0.044 0.084
#> GSM1060755 4 0.3752 0.6420 0.292 0.000 0.000 0.708 0.000
#> GSM1060761 4 0.6036 0.6041 0.252 0.000 0.004 0.588 0.156
#> GSM1060760 4 0.5778 0.4982 0.448 0.000 0.000 0.464 0.088
#> GSM1060767 1 0.2230 0.5988 0.884 0.000 0.000 0.116 0.000
#> GSM1060741 1 0.3527 0.5802 0.828 0.000 0.000 0.056 0.116
#> GSM1060759 4 0.5778 0.4982 0.448 0.000 0.000 0.464 0.088
#> GSM1060728 1 0.4617 -0.0662 0.552 0.000 0.000 0.436 0.012
#> GSM1060763 1 0.0963 0.6254 0.964 0.000 0.000 0.036 0.000
#> GSM1060747 1 0.7261 0.3103 0.504 0.000 0.116 0.088 0.292
#> GSM1060764 1 0.3336 0.4999 0.772 0.000 0.000 0.228 0.000
#> GSM1060733 1 0.7097 0.3555 0.544 0.000 0.116 0.088 0.252
#> GSM1060735 1 0.3143 0.5324 0.796 0.000 0.000 0.204 0.000
#> GSM1060739 1 0.1792 0.6088 0.916 0.000 0.000 0.084 0.000
#> GSM1060753 1 0.4793 0.2672 0.700 0.000 0.000 0.232 0.068
#> GSM1060738 1 0.3109 0.5354 0.800 0.000 0.000 0.200 0.000
#> GSM1060762 4 0.6493 0.5416 0.228 0.000 0.004 0.520 0.248
#> GSM1060731 3 0.2136 0.9989 0.088 0.000 0.904 0.008 0.000
#> GSM1060750 4 0.3752 0.6420 0.292 0.000 0.000 0.708 0.000
#> GSM1060749 1 0.2426 0.5996 0.900 0.000 0.000 0.036 0.064
#> GSM1060736 1 0.1197 0.6232 0.952 0.000 0.000 0.048 0.000
#> GSM1060748 4 0.4227 0.6369 0.292 0.000 0.000 0.692 0.016
#> GSM1060751 1 0.2179 0.6000 0.888 0.000 0.000 0.112 0.000
#> GSM1060766 4 0.4585 0.5601 0.352 0.000 0.000 0.628 0.020
#> GSM1060757 1 0.4256 -0.1244 0.564 0.000 0.000 0.436 0.000
#> GSM1060726 3 0.2136 0.9989 0.088 0.000 0.904 0.008 0.000
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> GSM1060768 5 0.3727 0.9940 0.000 0.388 0.000 0.000 0.612 0.000
#> GSM1060769 5 0.3727 0.9940 0.000 0.388 0.000 0.000 0.612 0.000
#> GSM1060770 5 0.3727 0.9940 0.000 0.388 0.000 0.000 0.612 0.000
#> GSM1060771 2 0.0405 0.6189 0.000 0.988 0.000 0.004 0.000 0.008
#> GSM1060772 2 0.3567 0.6227 0.000 0.824 0.008 0.068 0.008 0.092
#> GSM1060773 4 0.5466 0.5621 0.128 0.000 0.000 0.592 0.268 0.012
#> GSM1060774 2 0.3665 0.6215 0.000 0.820 0.008 0.068 0.012 0.092
#> GSM1060775 2 0.3567 0.6227 0.000 0.824 0.008 0.068 0.008 0.092
#> GSM1060776 2 0.4210 0.6063 0.000 0.792 0.008 0.068 0.040 0.092
#> GSM1060777 2 0.0405 0.6189 0.000 0.988 0.000 0.004 0.000 0.008
#> GSM1060778 5 0.3996 0.9940 0.000 0.388 0.004 0.004 0.604 0.000
#> GSM1060779 5 0.3996 0.9940 0.000 0.388 0.004 0.004 0.604 0.000
#> GSM1060780 2 0.0405 0.6189 0.000 0.988 0.000 0.004 0.000 0.008
#> GSM1060781 2 0.3849 0.5670 0.000 0.816 0.004 0.048 0.080 0.052
#> GSM1060782 5 0.3996 0.9940 0.000 0.388 0.004 0.004 0.604 0.000
#> GSM1060783 2 0.6072 -0.5338 0.000 0.492 0.012 0.032 0.380 0.084
#> GSM1060784 2 0.6105 -0.5275 0.000 0.492 0.012 0.032 0.376 0.088
#> GSM1060785 2 0.0405 0.6189 0.000 0.988 0.000 0.004 0.000 0.008
#> GSM1060786 2 0.2321 0.6253 0.000 0.904 0.004 0.032 0.008 0.052
#> GSM1060787 2 0.6072 -0.5338 0.000 0.492 0.012 0.032 0.380 0.084
#> GSM1060788 2 0.4498 0.3403 0.000 0.772 0.012 0.036 0.088 0.092
#> GSM1060789 2 0.6072 -0.5338 0.000 0.492 0.012 0.032 0.380 0.084
#> GSM1060790 2 0.3567 0.6227 0.000 0.824 0.008 0.068 0.008 0.092
#> GSM1060754 1 0.3955 0.3818 0.608 0.000 0.000 0.008 0.000 0.384
#> GSM1060745 6 0.4799 0.9038 0.160 0.000 0.044 0.016 0.044 0.736
#> GSM1060756 1 0.4312 0.3204 0.584 0.000 0.012 0.008 0.000 0.396
#> GSM1060746 1 0.2979 0.6361 0.804 0.000 0.004 0.004 0.000 0.188
#> GSM1060758 4 0.5583 0.4878 0.044 0.000 0.000 0.644 0.160 0.152
#> GSM1060765 1 0.0291 0.6537 0.992 0.000 0.004 0.004 0.000 0.000
#> GSM1060732 3 0.1636 0.9706 0.024 0.000 0.936 0.000 0.036 0.004
#> GSM1060727 3 0.0632 0.9930 0.024 0.000 0.976 0.000 0.000 0.000
#> GSM1060740 1 0.3705 0.5953 0.748 0.000 0.000 0.024 0.004 0.224
#> GSM1060730 3 0.0777 0.9923 0.024 0.000 0.972 0.004 0.000 0.000
#> GSM1060737 1 0.0291 0.6537 0.992 0.000 0.004 0.004 0.000 0.000
#> GSM1060743 1 0.0291 0.6537 0.992 0.000 0.004 0.004 0.000 0.000
#> GSM1060734 6 0.3652 0.9349 0.188 0.000 0.044 0.000 0.000 0.768
#> GSM1060729 3 0.0632 0.9930 0.024 0.000 0.976 0.000 0.000 0.000
#> GSM1060744 6 0.3652 0.9349 0.188 0.000 0.044 0.000 0.000 0.768
#> GSM1060742 1 0.4885 0.3108 0.556 0.000 0.000 0.040 0.012 0.392
#> GSM1060752 1 0.4810 0.4118 0.604 0.000 0.000 0.044 0.012 0.340
#> GSM1060755 4 0.5054 0.5158 0.368 0.000 0.000 0.548 0.084 0.000
#> GSM1060761 4 0.5662 0.4934 0.084 0.000 0.000 0.648 0.092 0.176
#> GSM1060760 4 0.5290 0.5057 0.244 0.000 0.000 0.608 0.004 0.144
#> GSM1060767 1 0.1753 0.6716 0.912 0.000 0.004 0.000 0.000 0.084
#> GSM1060741 1 0.4885 0.3108 0.556 0.000 0.000 0.040 0.012 0.392
#> GSM1060759 4 0.5290 0.5057 0.244 0.000 0.000 0.608 0.004 0.144
#> GSM1060728 1 0.4615 0.1024 0.676 0.000 0.000 0.244 0.076 0.004
#> GSM1060763 1 0.3104 0.6259 0.788 0.000 0.004 0.004 0.000 0.204
#> GSM1060747 6 0.4799 0.9038 0.160 0.000 0.044 0.016 0.044 0.736
#> GSM1060764 1 0.1413 0.6111 0.948 0.000 0.004 0.036 0.008 0.004
#> GSM1060733 6 0.3652 0.9349 0.188 0.000 0.044 0.000 0.000 0.768
#> GSM1060735 1 0.0291 0.6537 0.992 0.000 0.004 0.004 0.000 0.000
#> GSM1060739 1 0.2760 0.6617 0.856 0.000 0.000 0.024 0.004 0.116
#> GSM1060753 4 0.6407 -0.0925 0.332 0.000 0.000 0.356 0.012 0.300
#> GSM1060738 1 0.0436 0.6537 0.988 0.000 0.004 0.004 0.004 0.000
#> GSM1060762 4 0.6927 0.3623 0.076 0.000 0.000 0.444 0.232 0.248
#> GSM1060731 3 0.0777 0.9923 0.024 0.000 0.972 0.004 0.000 0.000
#> GSM1060750 4 0.5054 0.5158 0.368 0.000 0.000 0.548 0.084 0.000
#> GSM1060749 1 0.4923 0.4240 0.608 0.000 0.000 0.056 0.012 0.324
#> GSM1060736 1 0.3141 0.6272 0.788 0.000 0.000 0.012 0.000 0.200
#> GSM1060748 4 0.5479 0.5248 0.336 0.000 0.000 0.536 0.124 0.004
#> GSM1060751 1 0.1949 0.6711 0.904 0.000 0.004 0.004 0.000 0.088
#> GSM1060766 1 0.5583 -0.3911 0.480 0.000 0.000 0.392 0.124 0.004
#> GSM1060757 1 0.3608 0.1616 0.716 0.000 0.000 0.272 0.012 0.000
#> GSM1060726 3 0.0632 0.9930 0.024 0.000 0.976 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)
Test correlation between subgroups and known annotations. If the known annotation is numeric, one-way ANOVA test is applied, and if the known annotation is discrete, chi-squared contingency table test is applied.
test_to_known_factors(res)
#> n disease.state(p) tissue(p) k
#> ATC:kmeans 65 5.53e-14 3.07e-02 2
#> ATC:kmeans 61 4.47e-13 1.57e-03 3
#> ATC:kmeans 47 3.48e-10 6.20e-06 4
#> ATC:kmeans 49 3.55e-09 1.77e-01 5
#> ATC:kmeans 47 2.96e-08 3.25e-02 6
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 51941 rows and 65 columns.
#> Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'ATC' method.
#> Subgroups are detected by 'skmeans' method.
#> Performed in total 1250 partitions by row resampling.
#> Best k for subgroups seems to be 4.
#>
#> Following methods can be applied to this 'ConsensusPartition' object:
#> [1] "cola_report" "collect_classes" "collect_plots"
#> [4] "collect_stats" "colnames" "compare_signatures"
#> [7] "consensus_heatmap" "dimension_reduction" "functional_enrichment"
#> [10] "get_anno_col" "get_anno" "get_classes"
#> [13] "get_consensus" "get_matrix" "get_membership"
#> [16] "get_param" "get_signatures" "get_stats"
#> [19] "is_best_k" "is_stable_k" "membership_heatmap"
#> [22] "ncol" "nrow" "plot_ecdf"
#> [25] "rownames" "select_partition_number" "show"
#> [28] "suggest_best_k" "test_to_known_factors"
collect_plots()
function collects all the plots made from res
for all k
(number of partitions)
into one single page to provide an easy and fast comparison between different k
.
collect_plots(res)
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.4736 0.527 0.527
#> 3 3 1.000 0.984 0.983 0.2645 0.873 0.759
#> 4 4 0.933 0.917 0.959 0.1601 0.889 0.725
#> 5 5 0.851 0.860 0.913 0.0512 0.974 0.913
#> 6 6 0.839 0.690 0.854 0.0414 0.952 0.827
suggest_best_k()
suggests the best \(k\) based on these statistics. The rules are as follows:
suggest_best_k(res)
#> [1] 4
#> attr(,"optional")
#> [1] 2 3
There is also optional best \(k\) = 2 3 that is worth to check.
Following shows the table of the partitions (You need to click the show/hide
code output link to see it). The membership matrix (columns with name p*
)
is inferred by
clue::cl_consensus()
function with the SE
method. Basically the value in the membership matrix
represents the probability to belong to a certain group. The finall class
label for an item is determined with the group with highest probability it
belongs to.
In get_classes()
function, the entropy is calculated from the membership
matrix and the silhouette score is calculated from the consensus matrix.
cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#> class entropy silhouette p1 p2
#> GSM1060768 2 0 1 0 1
#> GSM1060769 2 0 1 0 1
#> GSM1060770 2 0 1 0 1
#> GSM1060771 2 0 1 0 1
#> GSM1060772 2 0 1 0 1
#> GSM1060773 2 0 1 0 1
#> GSM1060774 2 0 1 0 1
#> GSM1060775 2 0 1 0 1
#> GSM1060776 2 0 1 0 1
#> GSM1060777 2 0 1 0 1
#> GSM1060778 2 0 1 0 1
#> GSM1060779 2 0 1 0 1
#> GSM1060780 2 0 1 0 1
#> GSM1060781 2 0 1 0 1
#> GSM1060782 2 0 1 0 1
#> GSM1060783 2 0 1 0 1
#> GSM1060784 2 0 1 0 1
#> GSM1060785 2 0 1 0 1
#> GSM1060786 2 0 1 0 1
#> GSM1060787 2 0 1 0 1
#> GSM1060788 2 0 1 0 1
#> GSM1060789 2 0 1 0 1
#> GSM1060790 2 0 1 0 1
#> GSM1060754 1 0 1 1 0
#> GSM1060745 1 0 1 1 0
#> GSM1060756 1 0 1 1 0
#> GSM1060746 1 0 1 1 0
#> GSM1060758 1 0 1 1 0
#> GSM1060765 1 0 1 1 0
#> GSM1060732 1 0 1 1 0
#> GSM1060727 1 0 1 1 0
#> GSM1060740 1 0 1 1 0
#> GSM1060730 1 0 1 1 0
#> GSM1060737 1 0 1 1 0
#> GSM1060743 1 0 1 1 0
#> GSM1060734 1 0 1 1 0
#> GSM1060729 1 0 1 1 0
#> GSM1060744 1 0 1 1 0
#> GSM1060742 1 0 1 1 0
#> GSM1060752 1 0 1 1 0
#> GSM1060755 1 0 1 1 0
#> GSM1060761 1 0 1 1 0
#> GSM1060760 1 0 1 1 0
#> GSM1060767 1 0 1 1 0
#> GSM1060741 1 0 1 1 0
#> GSM1060759 1 0 1 1 0
#> GSM1060728 1 0 1 1 0
#> GSM1060763 1 0 1 1 0
#> GSM1060747 1 0 1 1 0
#> GSM1060764 1 0 1 1 0
#> GSM1060733 1 0 1 1 0
#> GSM1060735 1 0 1 1 0
#> GSM1060739 1 0 1 1 0
#> GSM1060753 1 0 1 1 0
#> GSM1060738 1 0 1 1 0
#> GSM1060762 1 0 1 1 0
#> GSM1060731 1 0 1 1 0
#> GSM1060750 1 0 1 1 0
#> GSM1060749 1 0 1 1 0
#> GSM1060736 1 0 1 1 0
#> GSM1060748 2 0 1 0 1
#> GSM1060751 1 0 1 1 0
#> GSM1060766 1 0 1 1 0
#> GSM1060757 1 0 1 1 0
#> GSM1060726 1 0 1 1 0
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> GSM1060768 2 0.0000 0.997 0.000 1.000 0.000
#> GSM1060769 2 0.0000 0.997 0.000 1.000 0.000
#> GSM1060770 2 0.0000 0.997 0.000 1.000 0.000
#> GSM1060771 2 0.0000 0.997 0.000 1.000 0.000
#> GSM1060772 2 0.0000 0.997 0.000 1.000 0.000
#> GSM1060773 2 0.0000 0.997 0.000 1.000 0.000
#> GSM1060774 2 0.0000 0.997 0.000 1.000 0.000
#> GSM1060775 2 0.0000 0.997 0.000 1.000 0.000
#> GSM1060776 2 0.0000 0.997 0.000 1.000 0.000
#> GSM1060777 2 0.0000 0.997 0.000 1.000 0.000
#> GSM1060778 2 0.0000 0.997 0.000 1.000 0.000
#> GSM1060779 2 0.0000 0.997 0.000 1.000 0.000
#> GSM1060780 2 0.0000 0.997 0.000 1.000 0.000
#> GSM1060781 2 0.0000 0.997 0.000 1.000 0.000
#> GSM1060782 2 0.0000 0.997 0.000 1.000 0.000
#> GSM1060783 2 0.0000 0.997 0.000 1.000 0.000
#> GSM1060784 2 0.0000 0.997 0.000 1.000 0.000
#> GSM1060785 2 0.0000 0.997 0.000 1.000 0.000
#> GSM1060786 2 0.0000 0.997 0.000 1.000 0.000
#> GSM1060787 2 0.0000 0.997 0.000 1.000 0.000
#> GSM1060788 2 0.0000 0.997 0.000 1.000 0.000
#> GSM1060789 2 0.0000 0.997 0.000 1.000 0.000
#> GSM1060790 2 0.0000 0.997 0.000 1.000 0.000
#> GSM1060754 1 0.0000 0.985 1.000 0.000 0.000
#> GSM1060745 1 0.0000 0.985 1.000 0.000 0.000
#> GSM1060756 1 0.0000 0.985 1.000 0.000 0.000
#> GSM1060746 1 0.0000 0.985 1.000 0.000 0.000
#> GSM1060758 1 0.1643 0.961 0.956 0.000 0.044
#> GSM1060765 1 0.0000 0.985 1.000 0.000 0.000
#> GSM1060732 3 0.2261 0.990 0.068 0.000 0.932
#> GSM1060727 3 0.2261 0.990 0.068 0.000 0.932
#> GSM1060740 1 0.0000 0.985 1.000 0.000 0.000
#> GSM1060730 3 0.2261 0.990 0.068 0.000 0.932
#> GSM1060737 1 0.0000 0.985 1.000 0.000 0.000
#> GSM1060743 1 0.0000 0.985 1.000 0.000 0.000
#> GSM1060734 1 0.0000 0.985 1.000 0.000 0.000
#> GSM1060729 3 0.2261 0.990 0.068 0.000 0.932
#> GSM1060744 1 0.0000 0.985 1.000 0.000 0.000
#> GSM1060742 1 0.0000 0.985 1.000 0.000 0.000
#> GSM1060752 1 0.0000 0.985 1.000 0.000 0.000
#> GSM1060755 1 0.2261 0.942 0.932 0.000 0.068
#> GSM1060761 1 0.1529 0.964 0.960 0.000 0.040
#> GSM1060760 1 0.1643 0.961 0.956 0.000 0.044
#> GSM1060767 1 0.0000 0.985 1.000 0.000 0.000
#> GSM1060741 1 0.0000 0.985 1.000 0.000 0.000
#> GSM1060759 1 0.1643 0.961 0.956 0.000 0.044
#> GSM1060728 3 0.2261 0.990 0.068 0.000 0.932
#> GSM1060763 1 0.0000 0.985 1.000 0.000 0.000
#> GSM1060747 1 0.0000 0.985 1.000 0.000 0.000
#> GSM1060764 1 0.0424 0.979 0.992 0.000 0.008
#> GSM1060733 1 0.0000 0.985 1.000 0.000 0.000
#> GSM1060735 1 0.0000 0.985 1.000 0.000 0.000
#> GSM1060739 1 0.0000 0.985 1.000 0.000 0.000
#> GSM1060753 1 0.1411 0.966 0.964 0.000 0.036
#> GSM1060738 1 0.0000 0.985 1.000 0.000 0.000
#> GSM1060762 3 0.3412 0.932 0.124 0.000 0.876
#> GSM1060731 3 0.2261 0.990 0.068 0.000 0.932
#> GSM1060750 1 0.2261 0.942 0.932 0.000 0.068
#> GSM1060749 1 0.0000 0.985 1.000 0.000 0.000
#> GSM1060736 1 0.0000 0.985 1.000 0.000 0.000
#> GSM1060748 2 0.2261 0.932 0.000 0.932 0.068
#> GSM1060751 1 0.0000 0.985 1.000 0.000 0.000
#> GSM1060766 1 0.2261 0.942 0.932 0.000 0.068
#> GSM1060757 1 0.1529 0.964 0.960 0.000 0.040
#> GSM1060726 3 0.2261 0.990 0.068 0.000 0.932
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> GSM1060768 2 0.0000 0.9836 0.000 1.000 0.000 0.000
#> GSM1060769 2 0.0000 0.9836 0.000 1.000 0.000 0.000
#> GSM1060770 2 0.0000 0.9836 0.000 1.000 0.000 0.000
#> GSM1060771 2 0.0000 0.9836 0.000 1.000 0.000 0.000
#> GSM1060772 2 0.0000 0.9836 0.000 1.000 0.000 0.000
#> GSM1060773 2 0.4837 0.4565 0.000 0.648 0.004 0.348
#> GSM1060774 2 0.0000 0.9836 0.000 1.000 0.000 0.000
#> GSM1060775 2 0.0000 0.9836 0.000 1.000 0.000 0.000
#> GSM1060776 2 0.0000 0.9836 0.000 1.000 0.000 0.000
#> GSM1060777 2 0.0000 0.9836 0.000 1.000 0.000 0.000
#> GSM1060778 2 0.0000 0.9836 0.000 1.000 0.000 0.000
#> GSM1060779 2 0.0000 0.9836 0.000 1.000 0.000 0.000
#> GSM1060780 2 0.0000 0.9836 0.000 1.000 0.000 0.000
#> GSM1060781 2 0.0000 0.9836 0.000 1.000 0.000 0.000
#> GSM1060782 2 0.0000 0.9836 0.000 1.000 0.000 0.000
#> GSM1060783 2 0.0000 0.9836 0.000 1.000 0.000 0.000
#> GSM1060784 2 0.0000 0.9836 0.000 1.000 0.000 0.000
#> GSM1060785 2 0.0000 0.9836 0.000 1.000 0.000 0.000
#> GSM1060786 2 0.0000 0.9836 0.000 1.000 0.000 0.000
#> GSM1060787 2 0.0000 0.9836 0.000 1.000 0.000 0.000
#> GSM1060788 2 0.0000 0.9836 0.000 1.000 0.000 0.000
#> GSM1060789 2 0.0000 0.9836 0.000 1.000 0.000 0.000
#> GSM1060790 2 0.0000 0.9836 0.000 1.000 0.000 0.000
#> GSM1060754 1 0.0336 0.9691 0.992 0.000 0.000 0.008
#> GSM1060745 1 0.0336 0.9677 0.992 0.000 0.000 0.008
#> GSM1060756 1 0.0336 0.9691 0.992 0.000 0.000 0.008
#> GSM1060746 1 0.0336 0.9691 0.992 0.000 0.000 0.008
#> GSM1060758 4 0.3751 0.8013 0.196 0.000 0.004 0.800
#> GSM1060765 1 0.0336 0.9691 0.992 0.000 0.000 0.008
#> GSM1060732 3 0.0188 0.9740 0.004 0.000 0.996 0.000
#> GSM1060727 3 0.0188 0.9740 0.004 0.000 0.996 0.000
#> GSM1060740 1 0.0000 0.9697 1.000 0.000 0.000 0.000
#> GSM1060730 3 0.0188 0.9740 0.004 0.000 0.996 0.000
#> GSM1060737 1 0.0336 0.9691 0.992 0.000 0.000 0.008
#> GSM1060743 1 0.0336 0.9691 0.992 0.000 0.000 0.008
#> GSM1060734 1 0.0336 0.9677 0.992 0.000 0.000 0.008
#> GSM1060729 3 0.0188 0.9740 0.004 0.000 0.996 0.000
#> GSM1060744 1 0.0336 0.9677 0.992 0.000 0.000 0.008
#> GSM1060742 1 0.0188 0.9691 0.996 0.000 0.000 0.004
#> GSM1060752 1 0.0188 0.9691 0.996 0.000 0.000 0.004
#> GSM1060755 4 0.0469 0.7299 0.012 0.000 0.000 0.988
#> GSM1060761 4 0.4720 0.7053 0.324 0.000 0.004 0.672
#> GSM1060760 4 0.3975 0.7937 0.240 0.000 0.000 0.760
#> GSM1060767 1 0.0336 0.9691 0.992 0.000 0.000 0.008
#> GSM1060741 1 0.0188 0.9691 0.996 0.000 0.000 0.004
#> GSM1060759 4 0.3873 0.7989 0.228 0.000 0.000 0.772
#> GSM1060728 3 0.0000 0.9693 0.000 0.000 1.000 0.000
#> GSM1060763 1 0.0188 0.9697 0.996 0.000 0.000 0.004
#> GSM1060747 1 0.0336 0.9677 0.992 0.000 0.000 0.008
#> GSM1060764 1 0.1059 0.9502 0.972 0.000 0.016 0.012
#> GSM1060733 1 0.0336 0.9677 0.992 0.000 0.000 0.008
#> GSM1060735 1 0.0336 0.9691 0.992 0.000 0.000 0.008
#> GSM1060739 1 0.0000 0.9697 1.000 0.000 0.000 0.000
#> GSM1060753 1 0.4877 0.0088 0.592 0.000 0.000 0.408
#> GSM1060738 1 0.0188 0.9697 0.996 0.000 0.000 0.004
#> GSM1060762 3 0.4155 0.7965 0.072 0.000 0.828 0.100
#> GSM1060731 3 0.0188 0.9740 0.004 0.000 0.996 0.000
#> GSM1060750 4 0.0469 0.7299 0.012 0.000 0.000 0.988
#> GSM1060749 1 0.0336 0.9677 0.992 0.000 0.000 0.008
#> GSM1060736 1 0.0336 0.9677 0.992 0.000 0.000 0.008
#> GSM1060748 4 0.0707 0.7137 0.000 0.020 0.000 0.980
#> GSM1060751 1 0.0336 0.9691 0.992 0.000 0.000 0.008
#> GSM1060766 4 0.3105 0.7401 0.140 0.000 0.004 0.856
#> GSM1060757 4 0.4624 0.6656 0.340 0.000 0.000 0.660
#> GSM1060726 3 0.0188 0.9740 0.004 0.000 0.996 0.000
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> GSM1060768 5 0.0000 0.997 0.000 0.000 0.000 0.000 1.000
#> GSM1060769 5 0.0000 0.997 0.000 0.000 0.000 0.000 1.000
#> GSM1060770 5 0.0000 0.997 0.000 0.000 0.000 0.000 1.000
#> GSM1060771 5 0.0290 0.996 0.000 0.008 0.000 0.000 0.992
#> GSM1060772 5 0.0162 0.997 0.000 0.004 0.000 0.000 0.996
#> GSM1060773 2 0.4413 0.426 0.000 0.724 0.000 0.044 0.232
#> GSM1060774 5 0.0162 0.997 0.000 0.004 0.000 0.000 0.996
#> GSM1060775 5 0.0162 0.997 0.000 0.004 0.000 0.000 0.996
#> GSM1060776 5 0.0162 0.997 0.000 0.004 0.000 0.000 0.996
#> GSM1060777 5 0.0290 0.996 0.000 0.008 0.000 0.000 0.992
#> GSM1060778 5 0.0000 0.997 0.000 0.000 0.000 0.000 1.000
#> GSM1060779 5 0.0000 0.997 0.000 0.000 0.000 0.000 1.000
#> GSM1060780 5 0.0162 0.997 0.000 0.004 0.000 0.000 0.996
#> GSM1060781 5 0.0290 0.996 0.000 0.008 0.000 0.000 0.992
#> GSM1060782 5 0.0000 0.997 0.000 0.000 0.000 0.000 1.000
#> GSM1060783 5 0.0162 0.996 0.000 0.004 0.000 0.000 0.996
#> GSM1060784 5 0.0162 0.996 0.000 0.004 0.000 0.000 0.996
#> GSM1060785 5 0.0162 0.996 0.000 0.004 0.000 0.000 0.996
#> GSM1060786 5 0.0162 0.997 0.000 0.004 0.000 0.000 0.996
#> GSM1060787 5 0.0162 0.996 0.000 0.004 0.000 0.000 0.996
#> GSM1060788 5 0.0162 0.996 0.000 0.004 0.000 0.000 0.996
#> GSM1060789 5 0.0162 0.996 0.000 0.004 0.000 0.000 0.996
#> GSM1060790 5 0.0162 0.997 0.000 0.004 0.000 0.000 0.996
#> GSM1060754 1 0.0162 0.851 0.996 0.004 0.000 0.000 0.000
#> GSM1060745 1 0.2773 0.848 0.836 0.164 0.000 0.000 0.000
#> GSM1060756 1 0.0290 0.850 0.992 0.008 0.000 0.000 0.000
#> GSM1060746 1 0.2280 0.810 0.880 0.120 0.000 0.000 0.000
#> GSM1060758 2 0.4479 0.477 0.036 0.700 0.000 0.264 0.000
#> GSM1060765 1 0.2424 0.803 0.868 0.132 0.000 0.000 0.000
#> GSM1060732 3 0.0000 0.999 0.000 0.000 1.000 0.000 0.000
#> GSM1060727 3 0.0000 0.999 0.000 0.000 1.000 0.000 0.000
#> GSM1060740 1 0.2605 0.859 0.852 0.148 0.000 0.000 0.000
#> GSM1060730 3 0.0000 0.999 0.000 0.000 1.000 0.000 0.000
#> GSM1060737 1 0.2329 0.810 0.876 0.124 0.000 0.000 0.000
#> GSM1060743 1 0.2280 0.810 0.880 0.120 0.000 0.000 0.000
#> GSM1060734 1 0.2648 0.854 0.848 0.152 0.000 0.000 0.000
#> GSM1060729 3 0.0000 0.999 0.000 0.000 1.000 0.000 0.000
#> GSM1060744 1 0.2773 0.848 0.836 0.164 0.000 0.000 0.000
#> GSM1060742 1 0.2732 0.850 0.840 0.160 0.000 0.000 0.000
#> GSM1060752 1 0.2605 0.854 0.852 0.148 0.000 0.000 0.000
#> GSM1060755 4 0.0000 0.697 0.000 0.000 0.000 1.000 0.000
#> GSM1060761 2 0.4025 0.598 0.132 0.792 0.000 0.076 0.000
#> GSM1060760 4 0.5983 0.432 0.200 0.212 0.000 0.588 0.000
#> GSM1060767 1 0.2230 0.811 0.884 0.116 0.000 0.000 0.000
#> GSM1060741 1 0.2561 0.855 0.856 0.144 0.000 0.000 0.000
#> GSM1060759 4 0.5983 0.432 0.200 0.212 0.000 0.588 0.000
#> GSM1060728 3 0.0162 0.996 0.000 0.004 0.996 0.000 0.000
#> GSM1060763 1 0.0703 0.848 0.976 0.024 0.000 0.000 0.000
#> GSM1060747 1 0.2813 0.846 0.832 0.168 0.000 0.000 0.000
#> GSM1060764 1 0.3599 0.769 0.828 0.132 0.016 0.024 0.000
#> GSM1060733 1 0.2690 0.852 0.844 0.156 0.000 0.000 0.000
#> GSM1060735 1 0.2329 0.808 0.876 0.124 0.000 0.000 0.000
#> GSM1060739 1 0.2732 0.857 0.840 0.160 0.000 0.000 0.000
#> GSM1060753 1 0.4100 0.782 0.764 0.192 0.000 0.044 0.000
#> GSM1060738 1 0.2605 0.850 0.852 0.148 0.000 0.000 0.000
#> GSM1060762 2 0.4446 0.598 0.116 0.776 0.100 0.008 0.000
#> GSM1060731 3 0.0000 0.999 0.000 0.000 1.000 0.000 0.000
#> GSM1060750 4 0.0162 0.696 0.000 0.004 0.000 0.996 0.000
#> GSM1060749 1 0.2732 0.850 0.840 0.160 0.000 0.000 0.000
#> GSM1060736 1 0.2605 0.855 0.852 0.148 0.000 0.000 0.000
#> GSM1060748 4 0.0290 0.694 0.000 0.008 0.000 0.992 0.000
#> GSM1060751 1 0.2329 0.808 0.876 0.124 0.000 0.000 0.000
#> GSM1060766 2 0.4914 0.466 0.092 0.704 0.000 0.204 0.000
#> GSM1060757 4 0.2707 0.654 0.132 0.008 0.000 0.860 0.000
#> GSM1060726 3 0.0000 0.999 0.000 0.000 1.000 0.000 0.000
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> GSM1060768 5 0.0000 0.980 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM1060769 5 0.0000 0.980 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM1060770 5 0.0000 0.980 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM1060771 5 0.0993 0.979 0.024 0.012 0.000 0.000 0.964 0.000
#> GSM1060772 5 0.1074 0.972 0.028 0.012 0.000 0.000 0.960 0.000
#> GSM1060773 2 0.2400 0.491 0.116 0.872 0.000 0.000 0.004 0.008
#> GSM1060774 5 0.1168 0.970 0.028 0.016 0.000 0.000 0.956 0.000
#> GSM1060775 5 0.1074 0.972 0.028 0.012 0.000 0.000 0.960 0.000
#> GSM1060776 5 0.1168 0.970 0.028 0.016 0.000 0.000 0.956 0.000
#> GSM1060777 5 0.0993 0.979 0.024 0.012 0.000 0.000 0.964 0.000
#> GSM1060778 5 0.0000 0.980 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM1060779 5 0.0000 0.980 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM1060780 5 0.0520 0.980 0.008 0.008 0.000 0.000 0.984 0.000
#> GSM1060781 5 0.1549 0.969 0.044 0.020 0.000 0.000 0.936 0.000
#> GSM1060782 5 0.0000 0.980 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM1060783 5 0.0603 0.978 0.016 0.004 0.000 0.000 0.980 0.000
#> GSM1060784 5 0.0603 0.978 0.016 0.004 0.000 0.000 0.980 0.000
#> GSM1060785 5 0.0993 0.979 0.024 0.012 0.000 0.000 0.964 0.000
#> GSM1060786 5 0.0520 0.980 0.008 0.008 0.000 0.000 0.984 0.000
#> GSM1060787 5 0.0603 0.978 0.016 0.004 0.000 0.000 0.980 0.000
#> GSM1060788 5 0.0603 0.978 0.016 0.004 0.000 0.000 0.980 0.000
#> GSM1060789 5 0.0603 0.978 0.016 0.004 0.000 0.000 0.980 0.000
#> GSM1060790 5 0.1074 0.972 0.028 0.012 0.000 0.000 0.960 0.000
#> GSM1060754 6 0.3266 0.314 0.272 0.000 0.000 0.000 0.000 0.728
#> GSM1060745 6 0.1092 0.659 0.020 0.020 0.000 0.000 0.000 0.960
#> GSM1060756 6 0.3309 0.278 0.280 0.000 0.000 0.000 0.000 0.720
#> GSM1060746 6 0.3851 -0.570 0.460 0.000 0.000 0.000 0.000 0.540
#> GSM1060758 2 0.6231 0.482 0.056 0.552 0.000 0.148 0.000 0.244
#> GSM1060765 1 0.3769 0.699 0.640 0.000 0.000 0.004 0.000 0.356
#> GSM1060732 3 0.0000 0.998 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1060727 3 0.0000 0.998 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1060740 6 0.2553 0.591 0.144 0.008 0.000 0.000 0.000 0.848
#> GSM1060730 3 0.0000 0.998 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1060737 6 0.3847 -0.546 0.456 0.000 0.000 0.000 0.000 0.544
#> GSM1060743 1 0.3866 0.678 0.516 0.000 0.000 0.000 0.000 0.484
#> GSM1060734 6 0.1297 0.665 0.040 0.012 0.000 0.000 0.000 0.948
#> GSM1060729 3 0.0000 0.998 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1060744 6 0.0260 0.665 0.000 0.008 0.000 0.000 0.000 0.992
#> GSM1060742 6 0.1643 0.653 0.068 0.008 0.000 0.000 0.000 0.924
#> GSM1060752 6 0.1524 0.660 0.060 0.008 0.000 0.000 0.000 0.932
#> GSM1060755 4 0.0000 0.660 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM1060761 2 0.4825 0.531 0.036 0.612 0.000 0.020 0.000 0.332
#> GSM1060760 4 0.6752 0.175 0.052 0.236 0.000 0.440 0.000 0.272
#> GSM1060767 6 0.3854 -0.592 0.464 0.000 0.000 0.000 0.000 0.536
#> GSM1060741 6 0.1753 0.647 0.084 0.004 0.000 0.000 0.000 0.912
#> GSM1060759 4 0.6741 0.181 0.052 0.236 0.000 0.444 0.000 0.268
#> GSM1060728 3 0.0520 0.986 0.008 0.008 0.984 0.000 0.000 0.000
#> GSM1060763 6 0.3371 0.227 0.292 0.000 0.000 0.000 0.000 0.708
#> GSM1060747 6 0.1003 0.658 0.016 0.020 0.000 0.000 0.000 0.964
#> GSM1060764 1 0.3667 0.570 0.740 0.000 0.008 0.012 0.000 0.240
#> GSM1060733 6 0.1245 0.664 0.032 0.016 0.000 0.000 0.000 0.952
#> GSM1060735 1 0.3854 0.717 0.536 0.000 0.000 0.000 0.000 0.464
#> GSM1060739 6 0.2473 0.603 0.136 0.008 0.000 0.000 0.000 0.856
#> GSM1060753 6 0.3374 0.515 0.048 0.092 0.000 0.024 0.000 0.836
#> GSM1060738 6 0.3819 0.161 0.340 0.008 0.000 0.000 0.000 0.652
#> GSM1060762 2 0.5542 0.583 0.044 0.628 0.064 0.008 0.000 0.256
#> GSM1060731 3 0.0000 0.998 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1060750 4 0.0146 0.660 0.004 0.000 0.000 0.996 0.000 0.000
#> GSM1060749 6 0.1074 0.655 0.012 0.028 0.000 0.000 0.000 0.960
#> GSM1060736 6 0.1616 0.663 0.048 0.020 0.000 0.000 0.000 0.932
#> GSM1060748 4 0.0622 0.653 0.012 0.008 0.000 0.980 0.000 0.000
#> GSM1060751 1 0.3866 0.696 0.516 0.000 0.000 0.000 0.000 0.484
#> GSM1060766 2 0.5386 0.461 0.184 0.668 0.000 0.084 0.000 0.064
#> GSM1060757 4 0.2506 0.612 0.068 0.000 0.000 0.880 0.000 0.052
#> GSM1060726 3 0.0000 0.998 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)
Test correlation between subgroups and known annotations. If the known annotation is numeric, one-way ANOVA test is applied, and if the known annotation is discrete, chi-squared contingency table test is applied.
test_to_known_factors(res)
#> n disease.state(p) tissue(p) k
#> ATC:skmeans 65 5.10e-14 1.29e-02 2
#> ATC:skmeans 65 6.25e-14 9.62e-04 3
#> ATC:skmeans 63 1.34e-13 1.22e-04 4
#> ATC:skmeans 60 2.90e-12 6.92e-06 5
#> ATC:skmeans 53 3.36e-10 8.95e-08 6
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 51941 rows and 65 columns.
#> Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'ATC' method.
#> Subgroups are detected by 'pam' method.
#> Performed in total 1250 partitions by row resampling.
#> Best k for subgroups seems to be 4.
#>
#> Following methods can be applied to this 'ConsensusPartition' object:
#> [1] "cola_report" "collect_classes" "collect_plots"
#> [4] "collect_stats" "colnames" "compare_signatures"
#> [7] "consensus_heatmap" "dimension_reduction" "functional_enrichment"
#> [10] "get_anno_col" "get_anno" "get_classes"
#> [13] "get_consensus" "get_matrix" "get_membership"
#> [16] "get_param" "get_signatures" "get_stats"
#> [19] "is_best_k" "is_stable_k" "membership_heatmap"
#> [22] "ncol" "nrow" "plot_ecdf"
#> [25] "rownames" "select_partition_number" "show"
#> [28] "suggest_best_k" "test_to_known_factors"
collect_plots()
function collects all the plots made from res
for all k
(number of partitions)
into one single page to provide an easy and fast comparison between different k
.
collect_plots(res)
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.4554 0.545 0.545
#> 3 3 0.795 0.964 0.926 0.2610 0.893 0.804
#> 4 4 0.966 0.910 0.962 0.2500 0.850 0.658
#> 5 5 0.863 0.866 0.916 0.0652 0.950 0.825
#> 6 6 0.888 0.866 0.921 0.0470 0.962 0.838
suggest_best_k()
suggests the best \(k\) based on these statistics. The rules are as follows:
suggest_best_k(res)
#> [1] 4
#> attr(,"optional")
#> [1] 2
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
#> GSM1060768 2 0 1 0 1
#> GSM1060769 2 0 1 0 1
#> GSM1060770 2 0 1 0 1
#> GSM1060771 2 0 1 0 1
#> GSM1060772 2 0 1 0 1
#> GSM1060773 1 0 1 1 0
#> GSM1060774 2 0 1 0 1
#> GSM1060775 2 0 1 0 1
#> GSM1060776 2 0 1 0 1
#> GSM1060777 2 0 1 0 1
#> GSM1060778 2 0 1 0 1
#> GSM1060779 2 0 1 0 1
#> GSM1060780 2 0 1 0 1
#> GSM1060781 2 0 1 0 1
#> GSM1060782 2 0 1 0 1
#> GSM1060783 2 0 1 0 1
#> GSM1060784 2 0 1 0 1
#> GSM1060785 2 0 1 0 1
#> GSM1060786 2 0 1 0 1
#> GSM1060787 2 0 1 0 1
#> GSM1060788 2 0 1 0 1
#> GSM1060789 2 0 1 0 1
#> GSM1060790 2 0 1 0 1
#> GSM1060754 1 0 1 1 0
#> GSM1060745 1 0 1 1 0
#> GSM1060756 1 0 1 1 0
#> GSM1060746 1 0 1 1 0
#> GSM1060758 1 0 1 1 0
#> GSM1060765 1 0 1 1 0
#> GSM1060732 1 0 1 1 0
#> GSM1060727 1 0 1 1 0
#> GSM1060740 1 0 1 1 0
#> GSM1060730 1 0 1 1 0
#> GSM1060737 1 0 1 1 0
#> GSM1060743 1 0 1 1 0
#> GSM1060734 1 0 1 1 0
#> GSM1060729 1 0 1 1 0
#> GSM1060744 1 0 1 1 0
#> GSM1060742 1 0 1 1 0
#> GSM1060752 1 0 1 1 0
#> GSM1060755 1 0 1 1 0
#> GSM1060761 1 0 1 1 0
#> GSM1060760 1 0 1 1 0
#> GSM1060767 1 0 1 1 0
#> GSM1060741 1 0 1 1 0
#> GSM1060759 1 0 1 1 0
#> GSM1060728 1 0 1 1 0
#> GSM1060763 1 0 1 1 0
#> GSM1060747 1 0 1 1 0
#> GSM1060764 1 0 1 1 0
#> GSM1060733 1 0 1 1 0
#> GSM1060735 1 0 1 1 0
#> GSM1060739 1 0 1 1 0
#> GSM1060753 1 0 1 1 0
#> GSM1060738 1 0 1 1 0
#> GSM1060762 1 0 1 1 0
#> GSM1060731 1 0 1 1 0
#> GSM1060750 1 0 1 1 0
#> GSM1060749 1 0 1 1 0
#> GSM1060736 1 0 1 1 0
#> GSM1060748 1 0 1 1 0
#> GSM1060751 1 0 1 1 0
#> GSM1060766 1 0 1 1 0
#> GSM1060757 1 0 1 1 0
#> GSM1060726 1 0 1 1 0
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> GSM1060768 2 0.000 1.000 0.000 1 0.000
#> GSM1060769 2 0.000 1.000 0.000 1 0.000
#> GSM1060770 2 0.000 1.000 0.000 1 0.000
#> GSM1060771 2 0.000 1.000 0.000 1 0.000
#> GSM1060772 2 0.000 1.000 0.000 1 0.000
#> GSM1060773 1 0.304 0.947 0.896 0 0.104
#> GSM1060774 2 0.000 1.000 0.000 1 0.000
#> GSM1060775 2 0.000 1.000 0.000 1 0.000
#> GSM1060776 2 0.000 1.000 0.000 1 0.000
#> GSM1060777 2 0.000 1.000 0.000 1 0.000
#> GSM1060778 2 0.000 1.000 0.000 1 0.000
#> GSM1060779 2 0.000 1.000 0.000 1 0.000
#> GSM1060780 2 0.000 1.000 0.000 1 0.000
#> GSM1060781 2 0.000 1.000 0.000 1 0.000
#> GSM1060782 2 0.000 1.000 0.000 1 0.000
#> GSM1060783 2 0.000 1.000 0.000 1 0.000
#> GSM1060784 2 0.000 1.000 0.000 1 0.000
#> GSM1060785 2 0.000 1.000 0.000 1 0.000
#> GSM1060786 2 0.000 1.000 0.000 1 0.000
#> GSM1060787 2 0.000 1.000 0.000 1 0.000
#> GSM1060788 2 0.000 1.000 0.000 1 0.000
#> GSM1060789 2 0.000 1.000 0.000 1 0.000
#> GSM1060790 2 0.000 1.000 0.000 1 0.000
#> GSM1060754 1 0.000 0.929 1.000 0 0.000
#> GSM1060745 1 0.216 0.884 0.936 0 0.064
#> GSM1060756 1 0.304 0.947 0.896 0 0.104
#> GSM1060746 1 0.304 0.947 0.896 0 0.104
#> GSM1060758 1 0.000 0.929 1.000 0 0.000
#> GSM1060765 1 0.304 0.947 0.896 0 0.104
#> GSM1060732 3 0.000 1.000 0.000 0 1.000
#> GSM1060727 3 0.000 1.000 0.000 0 1.000
#> GSM1060740 1 0.000 0.929 1.000 0 0.000
#> GSM1060730 3 0.000 1.000 0.000 0 1.000
#> GSM1060737 1 0.304 0.947 0.896 0 0.104
#> GSM1060743 1 0.304 0.947 0.896 0 0.104
#> GSM1060734 1 0.000 0.929 1.000 0 0.000
#> GSM1060729 3 0.000 1.000 0.000 0 1.000
#> GSM1060744 1 0.000 0.929 1.000 0 0.000
#> GSM1060742 1 0.000 0.929 1.000 0 0.000
#> GSM1060752 1 0.000 0.929 1.000 0 0.000
#> GSM1060755 1 0.304 0.947 0.896 0 0.104
#> GSM1060761 1 0.000 0.929 1.000 0 0.000
#> GSM1060760 1 0.000 0.929 1.000 0 0.000
#> GSM1060767 1 0.304 0.947 0.896 0 0.104
#> GSM1060741 1 0.000 0.929 1.000 0 0.000
#> GSM1060759 1 0.000 0.929 1.000 0 0.000
#> GSM1060728 1 0.304 0.947 0.896 0 0.104
#> GSM1060763 1 0.304 0.947 0.896 0 0.104
#> GSM1060747 1 0.216 0.884 0.936 0 0.064
#> GSM1060764 1 0.304 0.947 0.896 0 0.104
#> GSM1060733 1 0.000 0.929 1.000 0 0.000
#> GSM1060735 1 0.304 0.947 0.896 0 0.104
#> GSM1060739 1 0.288 0.946 0.904 0 0.096
#> GSM1060753 1 0.000 0.929 1.000 0 0.000
#> GSM1060738 1 0.304 0.947 0.896 0 0.104
#> GSM1060762 1 0.304 0.947 0.896 0 0.104
#> GSM1060731 3 0.000 1.000 0.000 0 1.000
#> GSM1060750 1 0.304 0.947 0.896 0 0.104
#> GSM1060749 1 0.000 0.929 1.000 0 0.000
#> GSM1060736 1 0.304 0.947 0.896 0 0.104
#> GSM1060748 1 0.304 0.947 0.896 0 0.104
#> GSM1060751 1 0.304 0.947 0.896 0 0.104
#> GSM1060766 1 0.304 0.947 0.896 0 0.104
#> GSM1060757 1 0.304 0.947 0.896 0 0.104
#> GSM1060726 3 0.000 1.000 0.000 0 1.000
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> GSM1060768 2 0.0000 1.000 0.000 1 0 0.000
#> GSM1060769 2 0.0000 1.000 0.000 1 0 0.000
#> GSM1060770 2 0.0000 1.000 0.000 1 0 0.000
#> GSM1060771 2 0.0000 1.000 0.000 1 0 0.000
#> GSM1060772 2 0.0000 1.000 0.000 1 0 0.000
#> GSM1060773 1 0.0921 0.885 0.972 0 0 0.028
#> GSM1060774 2 0.0000 1.000 0.000 1 0 0.000
#> GSM1060775 2 0.0000 1.000 0.000 1 0 0.000
#> GSM1060776 2 0.0000 1.000 0.000 1 0 0.000
#> GSM1060777 2 0.0000 1.000 0.000 1 0 0.000
#> GSM1060778 2 0.0000 1.000 0.000 1 0 0.000
#> GSM1060779 2 0.0000 1.000 0.000 1 0 0.000
#> GSM1060780 2 0.0000 1.000 0.000 1 0 0.000
#> GSM1060781 2 0.0000 1.000 0.000 1 0 0.000
#> GSM1060782 2 0.0000 1.000 0.000 1 0 0.000
#> GSM1060783 2 0.0000 1.000 0.000 1 0 0.000
#> GSM1060784 2 0.0000 1.000 0.000 1 0 0.000
#> GSM1060785 2 0.0000 1.000 0.000 1 0 0.000
#> GSM1060786 2 0.0000 1.000 0.000 1 0 0.000
#> GSM1060787 2 0.0000 1.000 0.000 1 0 0.000
#> GSM1060788 2 0.0000 1.000 0.000 1 0 0.000
#> GSM1060789 2 0.0000 1.000 0.000 1 0 0.000
#> GSM1060790 2 0.0000 1.000 0.000 1 0 0.000
#> GSM1060754 1 0.4776 0.397 0.624 0 0 0.376
#> GSM1060745 4 0.0921 0.961 0.028 0 0 0.972
#> GSM1060756 1 0.0000 0.900 1.000 0 0 0.000
#> GSM1060746 1 0.0000 0.900 1.000 0 0 0.000
#> GSM1060758 4 0.0000 0.946 0.000 0 0 1.000
#> GSM1060765 1 0.0000 0.900 1.000 0 0 0.000
#> GSM1060732 3 0.0000 1.000 0.000 0 1 0.000
#> GSM1060727 3 0.0000 1.000 0.000 0 1 0.000
#> GSM1060740 1 0.4843 0.349 0.604 0 0 0.396
#> GSM1060730 3 0.0000 1.000 0.000 0 1 0.000
#> GSM1060737 1 0.0000 0.900 1.000 0 0 0.000
#> GSM1060743 1 0.0000 0.900 1.000 0 0 0.000
#> GSM1060734 1 0.4830 0.359 0.608 0 0 0.392
#> GSM1060729 3 0.0000 1.000 0.000 0 1 0.000
#> GSM1060744 4 0.0921 0.961 0.028 0 0 0.972
#> GSM1060742 4 0.0921 0.961 0.028 0 0 0.972
#> GSM1060752 4 0.0921 0.961 0.028 0 0 0.972
#> GSM1060755 1 0.4331 0.601 0.712 0 0 0.288
#> GSM1060761 4 0.0188 0.949 0.004 0 0 0.996
#> GSM1060760 4 0.0000 0.946 0.000 0 0 1.000
#> GSM1060767 1 0.0000 0.900 1.000 0 0 0.000
#> GSM1060741 4 0.0921 0.961 0.028 0 0 0.972
#> GSM1060759 4 0.0000 0.946 0.000 0 0 1.000
#> GSM1060728 1 0.0336 0.897 0.992 0 0 0.008
#> GSM1060763 1 0.0000 0.900 1.000 0 0 0.000
#> GSM1060747 4 0.0921 0.961 0.028 0 0 0.972
#> GSM1060764 1 0.0000 0.900 1.000 0 0 0.000
#> GSM1060733 4 0.4134 0.629 0.260 0 0 0.740
#> GSM1060735 1 0.0000 0.900 1.000 0 0 0.000
#> GSM1060739 1 0.0469 0.894 0.988 0 0 0.012
#> GSM1060753 4 0.0921 0.961 0.028 0 0 0.972
#> GSM1060738 1 0.0000 0.900 1.000 0 0 0.000
#> GSM1060762 1 0.0188 0.899 0.996 0 0 0.004
#> GSM1060731 3 0.0000 1.000 0.000 0 1 0.000
#> GSM1060750 1 0.4948 0.275 0.560 0 0 0.440
#> GSM1060749 4 0.0921 0.961 0.028 0 0 0.972
#> GSM1060736 1 0.0000 0.900 1.000 0 0 0.000
#> GSM1060748 1 0.0921 0.885 0.972 0 0 0.028
#> GSM1060751 1 0.0000 0.900 1.000 0 0 0.000
#> GSM1060766 1 0.0336 0.897 0.992 0 0 0.008
#> GSM1060757 1 0.0921 0.885 0.972 0 0 0.028
#> GSM1060726 3 0.0000 1.000 0.000 0 1 0.000
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> GSM1060768 2 0.0000 0.938 0.000 1.000 0 0.000 0.000
#> GSM1060769 2 0.0000 0.938 0.000 1.000 0 0.000 0.000
#> GSM1060770 2 0.0000 0.938 0.000 1.000 0 0.000 0.000
#> GSM1060771 2 0.2690 0.788 0.000 0.844 0 0.000 0.156
#> GSM1060772 5 0.3336 0.924 0.000 0.228 0 0.000 0.772
#> GSM1060773 1 0.0290 0.890 0.992 0.000 0 0.008 0.000
#> GSM1060774 5 0.3336 0.924 0.000 0.228 0 0.000 0.772
#> GSM1060775 5 0.3336 0.924 0.000 0.228 0 0.000 0.772
#> GSM1060776 5 0.3336 0.924 0.000 0.228 0 0.000 0.772
#> GSM1060777 2 0.2605 0.800 0.000 0.852 0 0.000 0.148
#> GSM1060778 2 0.0000 0.938 0.000 1.000 0 0.000 0.000
#> GSM1060779 2 0.0000 0.938 0.000 1.000 0 0.000 0.000
#> GSM1060780 2 0.2605 0.800 0.000 0.852 0 0.000 0.148
#> GSM1060781 5 0.3336 0.924 0.000 0.228 0 0.000 0.772
#> GSM1060782 2 0.0000 0.938 0.000 1.000 0 0.000 0.000
#> GSM1060783 2 0.0000 0.938 0.000 1.000 0 0.000 0.000
#> GSM1060784 2 0.0000 0.938 0.000 1.000 0 0.000 0.000
#> GSM1060785 2 0.2471 0.814 0.000 0.864 0 0.000 0.136
#> GSM1060786 5 0.4278 0.542 0.000 0.452 0 0.000 0.548
#> GSM1060787 2 0.0000 0.938 0.000 1.000 0 0.000 0.000
#> GSM1060788 2 0.0290 0.933 0.000 0.992 0 0.000 0.008
#> GSM1060789 2 0.0000 0.938 0.000 1.000 0 0.000 0.000
#> GSM1060790 5 0.3913 0.833 0.000 0.324 0 0.000 0.676
#> GSM1060754 1 0.4114 0.419 0.624 0.000 0 0.376 0.000
#> GSM1060745 4 0.1544 0.928 0.000 0.000 0 0.932 0.068
#> GSM1060756 1 0.0000 0.892 1.000 0.000 0 0.000 0.000
#> GSM1060746 1 0.0000 0.892 1.000 0.000 0 0.000 0.000
#> GSM1060758 4 0.0290 0.944 0.000 0.000 0 0.992 0.008
#> GSM1060765 1 0.0000 0.892 1.000 0.000 0 0.000 0.000
#> GSM1060732 3 0.0000 1.000 0.000 0.000 1 0.000 0.000
#> GSM1060727 3 0.0000 1.000 0.000 0.000 1 0.000 0.000
#> GSM1060740 1 0.4171 0.374 0.604 0.000 0 0.396 0.000
#> GSM1060730 3 0.0000 1.000 0.000 0.000 1 0.000 0.000
#> GSM1060737 1 0.0000 0.892 1.000 0.000 0 0.000 0.000
#> GSM1060743 1 0.0000 0.892 1.000 0.000 0 0.000 0.000
#> GSM1060734 1 0.5284 0.400 0.608 0.000 0 0.324 0.068
#> GSM1060729 3 0.0000 1.000 0.000 0.000 1 0.000 0.000
#> GSM1060744 4 0.1544 0.928 0.000 0.000 0 0.932 0.068
#> GSM1060742 4 0.1544 0.928 0.000 0.000 0 0.932 0.068
#> GSM1060752 4 0.0000 0.946 0.000 0.000 0 1.000 0.000
#> GSM1060755 1 0.5476 0.597 0.656 0.000 0 0.184 0.160
#> GSM1060761 4 0.0000 0.946 0.000 0.000 0 1.000 0.000
#> GSM1060760 4 0.0290 0.944 0.000 0.000 0 0.992 0.008
#> GSM1060767 1 0.0000 0.892 1.000 0.000 0 0.000 0.000
#> GSM1060741 4 0.0000 0.946 0.000 0.000 0 1.000 0.000
#> GSM1060759 4 0.0290 0.944 0.000 0.000 0 0.992 0.008
#> GSM1060728 1 0.0162 0.891 0.996 0.000 0 0.000 0.004
#> GSM1060763 1 0.0000 0.892 1.000 0.000 0 0.000 0.000
#> GSM1060747 4 0.1544 0.928 0.000 0.000 0 0.932 0.068
#> GSM1060764 1 0.0000 0.892 1.000 0.000 0 0.000 0.000
#> GSM1060733 4 0.4972 0.580 0.260 0.000 0 0.672 0.068
#> GSM1060735 1 0.0000 0.892 1.000 0.000 0 0.000 0.000
#> GSM1060739 1 0.0609 0.884 0.980 0.000 0 0.020 0.000
#> GSM1060753 4 0.0000 0.946 0.000 0.000 0 1.000 0.000
#> GSM1060738 1 0.0000 0.892 1.000 0.000 0 0.000 0.000
#> GSM1060762 1 0.0290 0.890 0.992 0.000 0 0.008 0.000
#> GSM1060731 3 0.0000 1.000 0.000 0.000 1 0.000 0.000
#> GSM1060750 1 0.6133 0.376 0.540 0.000 0 0.300 0.160
#> GSM1060749 4 0.0000 0.946 0.000 0.000 0 1.000 0.000
#> GSM1060736 1 0.0000 0.892 1.000 0.000 0 0.000 0.000
#> GSM1060748 1 0.2732 0.792 0.840 0.000 0 0.000 0.160
#> GSM1060751 1 0.0000 0.892 1.000 0.000 0 0.000 0.000
#> GSM1060766 1 0.0290 0.890 0.992 0.000 0 0.008 0.000
#> GSM1060757 1 0.2732 0.792 0.840 0.000 0 0.000 0.160
#> GSM1060726 3 0.0000 1.000 0.000 0.000 1 0.000 0.000
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> GSM1060768 2 0.0000 0.952 0.000 1.000 0 0.000 0.000 0.000
#> GSM1060769 2 0.0000 0.952 0.000 1.000 0 0.000 0.000 0.000
#> GSM1060770 2 0.0000 0.952 0.000 1.000 0 0.000 0.000 0.000
#> GSM1060771 2 0.2416 0.844 0.000 0.844 0 0.000 0.156 0.000
#> GSM1060772 5 0.0146 0.901 0.000 0.004 0 0.000 0.996 0.000
#> GSM1060773 1 0.0547 0.884 0.980 0.000 0 0.000 0.000 0.020
#> GSM1060774 5 0.0146 0.901 0.000 0.004 0 0.000 0.996 0.000
#> GSM1060775 5 0.0146 0.901 0.000 0.004 0 0.000 0.996 0.000
#> GSM1060776 5 0.0146 0.901 0.000 0.004 0 0.000 0.996 0.000
#> GSM1060777 2 0.2340 0.852 0.000 0.852 0 0.000 0.148 0.000
#> GSM1060778 2 0.0000 0.952 0.000 1.000 0 0.000 0.000 0.000
#> GSM1060779 2 0.0000 0.952 0.000 1.000 0 0.000 0.000 0.000
#> GSM1060780 2 0.2340 0.852 0.000 0.852 0 0.000 0.148 0.000
#> GSM1060781 5 0.0260 0.899 0.000 0.008 0 0.000 0.992 0.000
#> GSM1060782 2 0.0000 0.952 0.000 1.000 0 0.000 0.000 0.000
#> GSM1060783 2 0.0000 0.952 0.000 1.000 0 0.000 0.000 0.000
#> GSM1060784 2 0.0000 0.952 0.000 1.000 0 0.000 0.000 0.000
#> GSM1060785 2 0.2219 0.862 0.000 0.864 0 0.000 0.136 0.000
#> GSM1060786 5 0.3592 0.430 0.000 0.344 0 0.000 0.656 0.000
#> GSM1060787 2 0.0000 0.952 0.000 1.000 0 0.000 0.000 0.000
#> GSM1060788 2 0.0260 0.949 0.000 0.992 0 0.000 0.008 0.000
#> GSM1060789 2 0.0000 0.952 0.000 1.000 0 0.000 0.000 0.000
#> GSM1060790 5 0.1863 0.827 0.000 0.104 0 0.000 0.896 0.000
#> GSM1060754 1 0.3695 0.396 0.624 0.000 0 0.000 0.000 0.376
#> GSM1060745 6 0.3426 0.765 0.000 0.000 0 0.276 0.004 0.720
#> GSM1060756 1 0.0260 0.891 0.992 0.000 0 0.008 0.000 0.000
#> GSM1060746 1 0.0000 0.895 1.000 0.000 0 0.000 0.000 0.000
#> GSM1060758 6 0.0458 0.862 0.000 0.000 0 0.016 0.000 0.984
#> GSM1060765 1 0.0000 0.895 1.000 0.000 0 0.000 0.000 0.000
#> GSM1060732 3 0.0000 1.000 0.000 0.000 1 0.000 0.000 0.000
#> GSM1060727 3 0.0000 1.000 0.000 0.000 1 0.000 0.000 0.000
#> GSM1060740 1 0.3747 0.366 0.604 0.000 0 0.000 0.000 0.396
#> GSM1060730 3 0.0000 1.000 0.000 0.000 1 0.000 0.000 0.000
#> GSM1060737 1 0.0000 0.895 1.000 0.000 0 0.000 0.000 0.000
#> GSM1060743 1 0.0000 0.895 1.000 0.000 0 0.000 0.000 0.000
#> GSM1060734 1 0.5237 0.365 0.600 0.000 0 0.276 0.004 0.120
#> GSM1060729 3 0.0000 1.000 0.000 0.000 1 0.000 0.000 0.000
#> GSM1060744 6 0.3383 0.770 0.000 0.000 0 0.268 0.004 0.728
#> GSM1060742 6 0.2994 0.798 0.000 0.000 0 0.208 0.004 0.788
#> GSM1060752 6 0.0000 0.866 0.000 0.000 0 0.000 0.000 1.000
#> GSM1060755 4 0.3288 1.000 0.276 0.000 0 0.724 0.000 0.000
#> GSM1060761 6 0.0000 0.866 0.000 0.000 0 0.000 0.000 1.000
#> GSM1060760 6 0.0547 0.860 0.000 0.000 0 0.020 0.000 0.980
#> GSM1060767 1 0.0000 0.895 1.000 0.000 0 0.000 0.000 0.000
#> GSM1060741 6 0.0260 0.864 0.008 0.000 0 0.000 0.000 0.992
#> GSM1060759 6 0.0547 0.860 0.000 0.000 0 0.020 0.000 0.980
#> GSM1060728 1 0.0458 0.885 0.984 0.000 0 0.016 0.000 0.000
#> GSM1060763 1 0.0000 0.895 1.000 0.000 0 0.000 0.000 0.000
#> GSM1060747 6 0.3426 0.765 0.000 0.000 0 0.276 0.004 0.720
#> GSM1060764 1 0.0000 0.895 1.000 0.000 0 0.000 0.000 0.000
#> GSM1060733 6 0.6079 0.392 0.272 0.000 0 0.272 0.004 0.452
#> GSM1060735 1 0.0000 0.895 1.000 0.000 0 0.000 0.000 0.000
#> GSM1060739 1 0.0790 0.877 0.968 0.000 0 0.000 0.000 0.032
#> GSM1060753 6 0.0000 0.866 0.000 0.000 0 0.000 0.000 1.000
#> GSM1060738 1 0.0000 0.895 1.000 0.000 0 0.000 0.000 0.000
#> GSM1060762 1 0.0547 0.884 0.980 0.000 0 0.000 0.000 0.020
#> GSM1060731 3 0.0000 1.000 0.000 0.000 1 0.000 0.000 0.000
#> GSM1060750 4 0.3288 1.000 0.276 0.000 0 0.724 0.000 0.000
#> GSM1060749 6 0.0000 0.866 0.000 0.000 0 0.000 0.000 1.000
#> GSM1060736 1 0.0363 0.890 0.988 0.000 0 0.000 0.000 0.012
#> GSM1060748 4 0.3288 1.000 0.276 0.000 0 0.724 0.000 0.000
#> GSM1060751 1 0.0000 0.895 1.000 0.000 0 0.000 0.000 0.000
#> GSM1060766 1 0.1092 0.870 0.960 0.000 0 0.020 0.000 0.020
#> GSM1060757 4 0.3288 1.000 0.276 0.000 0 0.724 0.000 0.000
#> GSM1060726 3 0.0000 1.000 0.000 0.000 1 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)
Test correlation between subgroups and known annotations. If the known annotation is numeric, one-way ANOVA test is applied, and if the known annotation is discrete, chi-squared contingency table test is applied.
test_to_known_factors(res)
#> n disease.state(p) tissue(p) k
#> ATC:pam 65 5.53e-14 0.030690 2
#> ATC:pam 65 6.45e-14 0.002273 3
#> ATC:pam 61 2.63e-12 0.000132 4
#> ATC:pam 61 1.26e-11 0.077505 5
#> ATC:pam 60 8.33e-11 0.016482 6
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 51941 rows and 65 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 0.881 0.957 0.982 0.4656 0.536 0.536
#> 3 3 0.799 0.847 0.925 0.3465 0.846 0.713
#> 4 4 0.815 0.832 0.916 0.1126 0.887 0.715
#> 5 5 0.759 0.787 0.836 0.0803 0.870 0.633
#> 6 6 0.822 0.612 0.814 0.0676 0.858 0.523
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
#> GSM1060768 2 0.0000 0.978 0.000 1.000
#> GSM1060769 2 0.0000 0.978 0.000 1.000
#> GSM1060770 2 0.0000 0.978 0.000 1.000
#> GSM1060771 2 0.0000 0.978 0.000 1.000
#> GSM1060772 2 0.0000 0.978 0.000 1.000
#> GSM1060773 2 0.9944 0.119 0.456 0.544
#> GSM1060774 2 0.0000 0.978 0.000 1.000
#> GSM1060775 2 0.0000 0.978 0.000 1.000
#> GSM1060776 2 0.0000 0.978 0.000 1.000
#> GSM1060777 2 0.0000 0.978 0.000 1.000
#> GSM1060778 2 0.0000 0.978 0.000 1.000
#> GSM1060779 2 0.0000 0.978 0.000 1.000
#> GSM1060780 2 0.0000 0.978 0.000 1.000
#> GSM1060781 2 0.0000 0.978 0.000 1.000
#> GSM1060782 2 0.0000 0.978 0.000 1.000
#> GSM1060783 2 0.0000 0.978 0.000 1.000
#> GSM1060784 2 0.0000 0.978 0.000 1.000
#> GSM1060785 2 0.0000 0.978 0.000 1.000
#> GSM1060786 2 0.0000 0.978 0.000 1.000
#> GSM1060787 2 0.0000 0.978 0.000 1.000
#> GSM1060788 2 0.0000 0.978 0.000 1.000
#> GSM1060789 2 0.0000 0.978 0.000 1.000
#> GSM1060790 2 0.0000 0.978 0.000 1.000
#> GSM1060754 1 0.0000 0.982 1.000 0.000
#> GSM1060745 1 0.0000 0.982 1.000 0.000
#> GSM1060756 1 0.0000 0.982 1.000 0.000
#> GSM1060746 1 0.0000 0.982 1.000 0.000
#> GSM1060758 1 0.6148 0.831 0.848 0.152
#> GSM1060765 1 0.0000 0.982 1.000 0.000
#> GSM1060732 1 0.0938 0.975 0.988 0.012
#> GSM1060727 1 0.0938 0.975 0.988 0.012
#> GSM1060740 1 0.0000 0.982 1.000 0.000
#> GSM1060730 1 0.0938 0.975 0.988 0.012
#> GSM1060737 1 0.0000 0.982 1.000 0.000
#> GSM1060743 1 0.0000 0.982 1.000 0.000
#> GSM1060734 1 0.0000 0.982 1.000 0.000
#> GSM1060729 1 0.0938 0.975 0.988 0.012
#> GSM1060744 1 0.0000 0.982 1.000 0.000
#> GSM1060742 1 0.0000 0.982 1.000 0.000
#> GSM1060752 1 0.0000 0.982 1.000 0.000
#> GSM1060755 1 0.0000 0.982 1.000 0.000
#> GSM1060761 1 0.6148 0.831 0.848 0.152
#> GSM1060760 1 0.0000 0.982 1.000 0.000
#> GSM1060767 1 0.0000 0.982 1.000 0.000
#> GSM1060741 1 0.0000 0.982 1.000 0.000
#> GSM1060759 1 0.0000 0.982 1.000 0.000
#> GSM1060728 1 0.0938 0.975 0.988 0.012
#> GSM1060763 1 0.0000 0.982 1.000 0.000
#> GSM1060747 1 0.0000 0.982 1.000 0.000
#> GSM1060764 1 0.0000 0.982 1.000 0.000
#> GSM1060733 1 0.0000 0.982 1.000 0.000
#> GSM1060735 1 0.0000 0.982 1.000 0.000
#> GSM1060739 1 0.0000 0.982 1.000 0.000
#> GSM1060753 1 0.0000 0.982 1.000 0.000
#> GSM1060738 1 0.0000 0.982 1.000 0.000
#> GSM1060762 1 0.0000 0.982 1.000 0.000
#> GSM1060731 1 0.0938 0.975 0.988 0.012
#> GSM1060750 1 0.1414 0.968 0.980 0.020
#> GSM1060749 1 0.0000 0.982 1.000 0.000
#> GSM1060736 1 0.0000 0.982 1.000 0.000
#> GSM1060748 1 0.6148 0.831 0.848 0.152
#> GSM1060751 1 0.0000 0.982 1.000 0.000
#> GSM1060766 1 0.6148 0.831 0.848 0.152
#> GSM1060757 1 0.0000 0.982 1.000 0.000
#> GSM1060726 1 0.0938 0.975 0.988 0.012
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> GSM1060768 2 0.0000 0.9750 0.000 1.000 0.000
#> GSM1060769 2 0.0000 0.9750 0.000 1.000 0.000
#> GSM1060770 2 0.0000 0.9750 0.000 1.000 0.000
#> GSM1060771 2 0.0000 0.9750 0.000 1.000 0.000
#> GSM1060772 2 0.0000 0.9750 0.000 1.000 0.000
#> GSM1060773 2 0.9030 -0.0647 0.140 0.492 0.368
#> GSM1060774 2 0.0000 0.9750 0.000 1.000 0.000
#> GSM1060775 2 0.0000 0.9750 0.000 1.000 0.000
#> GSM1060776 2 0.0000 0.9750 0.000 1.000 0.000
#> GSM1060777 2 0.0000 0.9750 0.000 1.000 0.000
#> GSM1060778 2 0.0000 0.9750 0.000 1.000 0.000
#> GSM1060779 2 0.0000 0.9750 0.000 1.000 0.000
#> GSM1060780 2 0.0000 0.9750 0.000 1.000 0.000
#> GSM1060781 2 0.0000 0.9750 0.000 1.000 0.000
#> GSM1060782 2 0.0000 0.9750 0.000 1.000 0.000
#> GSM1060783 2 0.0000 0.9750 0.000 1.000 0.000
#> GSM1060784 2 0.0000 0.9750 0.000 1.000 0.000
#> GSM1060785 2 0.0000 0.9750 0.000 1.000 0.000
#> GSM1060786 2 0.0000 0.9750 0.000 1.000 0.000
#> GSM1060787 2 0.0000 0.9750 0.000 1.000 0.000
#> GSM1060788 2 0.0000 0.9750 0.000 1.000 0.000
#> GSM1060789 2 0.0000 0.9750 0.000 1.000 0.000
#> GSM1060790 2 0.0000 0.9750 0.000 1.000 0.000
#> GSM1060754 1 0.1031 0.8742 0.976 0.000 0.024
#> GSM1060745 1 0.6111 0.4687 0.604 0.000 0.396
#> GSM1060756 1 0.2165 0.8671 0.936 0.000 0.064
#> GSM1060746 1 0.0000 0.8829 1.000 0.000 0.000
#> GSM1060758 3 0.5831 0.6779 0.284 0.008 0.708
#> GSM1060765 1 0.0000 0.8829 1.000 0.000 0.000
#> GSM1060732 3 0.0000 0.8487 0.000 0.000 1.000
#> GSM1060727 3 0.0000 0.8487 0.000 0.000 1.000
#> GSM1060740 1 0.0000 0.8829 1.000 0.000 0.000
#> GSM1060730 3 0.0000 0.8487 0.000 0.000 1.000
#> GSM1060737 1 0.0424 0.8817 0.992 0.000 0.008
#> GSM1060743 1 0.0000 0.8829 1.000 0.000 0.000
#> GSM1060734 1 0.5591 0.6467 0.696 0.000 0.304
#> GSM1060729 3 0.0000 0.8487 0.000 0.000 1.000
#> GSM1060744 1 0.5465 0.6700 0.712 0.000 0.288
#> GSM1060742 1 0.0000 0.8829 1.000 0.000 0.000
#> GSM1060752 1 0.0000 0.8829 1.000 0.000 0.000
#> GSM1060755 1 0.2165 0.8671 0.936 0.000 0.064
#> GSM1060761 3 0.6047 0.6239 0.312 0.008 0.680
#> GSM1060760 1 0.4750 0.7326 0.784 0.000 0.216
#> GSM1060767 1 0.0000 0.8829 1.000 0.000 0.000
#> GSM1060741 1 0.0000 0.8829 1.000 0.000 0.000
#> GSM1060759 1 0.4750 0.7326 0.784 0.000 0.216
#> GSM1060728 3 0.5363 0.6929 0.276 0.000 0.724
#> GSM1060763 1 0.0000 0.8829 1.000 0.000 0.000
#> GSM1060747 1 0.6111 0.4687 0.604 0.000 0.396
#> GSM1060764 1 0.2625 0.8611 0.916 0.000 0.084
#> GSM1060733 1 0.5968 0.5402 0.636 0.000 0.364
#> GSM1060735 1 0.0000 0.8829 1.000 0.000 0.000
#> GSM1060739 1 0.0000 0.8829 1.000 0.000 0.000
#> GSM1060753 1 0.1860 0.8716 0.948 0.000 0.052
#> GSM1060738 1 0.0000 0.8829 1.000 0.000 0.000
#> GSM1060762 3 0.5327 0.6973 0.272 0.000 0.728
#> GSM1060731 3 0.0000 0.8487 0.000 0.000 1.000
#> GSM1060750 1 0.3619 0.8248 0.864 0.000 0.136
#> GSM1060749 1 0.2165 0.8677 0.936 0.000 0.064
#> GSM1060736 1 0.3551 0.8276 0.868 0.000 0.132
#> GSM1060748 1 0.6372 0.7307 0.764 0.084 0.152
#> GSM1060751 1 0.0000 0.8829 1.000 0.000 0.000
#> GSM1060766 1 0.4291 0.8041 0.840 0.008 0.152
#> GSM1060757 1 0.0000 0.8829 1.000 0.000 0.000
#> GSM1060726 3 0.0000 0.8487 0.000 0.000 1.000
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> GSM1060768 2 0.0000 0.98720 0.000 1.000 0.000 0.000
#> GSM1060769 2 0.0000 0.98720 0.000 1.000 0.000 0.000
#> GSM1060770 2 0.0000 0.98720 0.000 1.000 0.000 0.000
#> GSM1060771 2 0.0707 0.99009 0.000 0.980 0.000 0.020
#> GSM1060772 2 0.0707 0.99009 0.000 0.980 0.000 0.020
#> GSM1060773 4 0.4730 0.34590 0.000 0.364 0.000 0.636
#> GSM1060774 2 0.0707 0.99009 0.000 0.980 0.000 0.020
#> GSM1060775 2 0.0707 0.99009 0.000 0.980 0.000 0.020
#> GSM1060776 2 0.0707 0.99009 0.000 0.980 0.000 0.020
#> GSM1060777 2 0.0707 0.99009 0.000 0.980 0.000 0.020
#> GSM1060778 2 0.0000 0.98720 0.000 1.000 0.000 0.000
#> GSM1060779 2 0.0000 0.98720 0.000 1.000 0.000 0.000
#> GSM1060780 2 0.0707 0.99009 0.000 0.980 0.000 0.020
#> GSM1060781 2 0.0707 0.99009 0.000 0.980 0.000 0.020
#> GSM1060782 2 0.0000 0.98720 0.000 1.000 0.000 0.000
#> GSM1060783 2 0.0469 0.98933 0.000 0.988 0.000 0.012
#> GSM1060784 2 0.0000 0.98720 0.000 1.000 0.000 0.000
#> GSM1060785 2 0.0707 0.99009 0.000 0.980 0.000 0.020
#> GSM1060786 2 0.0707 0.99009 0.000 0.980 0.000 0.020
#> GSM1060787 2 0.0000 0.98720 0.000 1.000 0.000 0.000
#> GSM1060788 2 0.1022 0.98112 0.000 0.968 0.000 0.032
#> GSM1060789 2 0.0000 0.98720 0.000 1.000 0.000 0.000
#> GSM1060790 2 0.0707 0.99009 0.000 0.980 0.000 0.020
#> GSM1060754 1 0.0188 0.84314 0.996 0.000 0.000 0.004
#> GSM1060745 4 0.3810 0.76973 0.188 0.000 0.008 0.804
#> GSM1060756 1 0.4730 0.47087 0.636 0.000 0.000 0.364
#> GSM1060746 1 0.0000 0.84437 1.000 0.000 0.000 0.000
#> GSM1060758 4 0.1042 0.72340 0.000 0.020 0.008 0.972
#> GSM1060765 1 0.0000 0.84437 1.000 0.000 0.000 0.000
#> GSM1060732 3 0.0000 1.00000 0.000 0.000 1.000 0.000
#> GSM1060727 3 0.0000 1.00000 0.000 0.000 1.000 0.000
#> GSM1060740 1 0.0000 0.84437 1.000 0.000 0.000 0.000
#> GSM1060730 3 0.0000 1.00000 0.000 0.000 1.000 0.000
#> GSM1060737 1 0.2530 0.79350 0.888 0.000 0.000 0.112
#> GSM1060743 1 0.0000 0.84437 1.000 0.000 0.000 0.000
#> GSM1060734 4 0.3810 0.76973 0.188 0.000 0.008 0.804
#> GSM1060729 3 0.0000 1.00000 0.000 0.000 1.000 0.000
#> GSM1060744 4 0.3810 0.76973 0.188 0.000 0.008 0.804
#> GSM1060742 1 0.0000 0.84437 1.000 0.000 0.000 0.000
#> GSM1060752 1 0.0000 0.84437 1.000 0.000 0.000 0.000
#> GSM1060755 1 0.3907 0.70064 0.768 0.000 0.000 0.232
#> GSM1060761 4 0.1042 0.72340 0.000 0.020 0.008 0.972
#> GSM1060760 1 0.4277 0.64154 0.720 0.000 0.000 0.280
#> GSM1060767 1 0.0000 0.84437 1.000 0.000 0.000 0.000
#> GSM1060741 1 0.0000 0.84437 1.000 0.000 0.000 0.000
#> GSM1060759 1 0.4222 0.65135 0.728 0.000 0.000 0.272
#> GSM1060728 4 0.1297 0.73801 0.020 0.000 0.016 0.964
#> GSM1060763 1 0.0336 0.84075 0.992 0.000 0.000 0.008
#> GSM1060747 4 0.3810 0.76973 0.188 0.000 0.008 0.804
#> GSM1060764 1 0.4104 0.74779 0.808 0.000 0.028 0.164
#> GSM1060733 4 0.3810 0.76973 0.188 0.000 0.008 0.804
#> GSM1060735 1 0.0000 0.84437 1.000 0.000 0.000 0.000
#> GSM1060739 1 0.0000 0.84437 1.000 0.000 0.000 0.000
#> GSM1060753 1 0.3219 0.75991 0.836 0.000 0.000 0.164
#> GSM1060738 1 0.0000 0.84437 1.000 0.000 0.000 0.000
#> GSM1060762 4 0.1211 0.71592 0.000 0.000 0.040 0.960
#> GSM1060731 3 0.0000 1.00000 0.000 0.000 1.000 0.000
#> GSM1060750 1 0.4898 0.45350 0.584 0.000 0.000 0.416
#> GSM1060749 1 0.3942 0.69525 0.764 0.000 0.000 0.236
#> GSM1060736 4 0.4985 -0.00353 0.468 0.000 0.000 0.532
#> GSM1060748 1 0.4977 0.36960 0.540 0.000 0.000 0.460
#> GSM1060751 1 0.0000 0.84437 1.000 0.000 0.000 0.000
#> GSM1060766 1 0.4994 0.32356 0.520 0.000 0.000 0.480
#> GSM1060757 1 0.0000 0.84437 1.000 0.000 0.000 0.000
#> GSM1060726 3 0.0000 1.00000 0.000 0.000 1.000 0.000
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> GSM1060768 2 0.4201 0.801 0.000 0.592 0 0.000 0.408
#> GSM1060769 2 0.4201 0.801 0.000 0.592 0 0.000 0.408
#> GSM1060770 2 0.4201 0.801 0.000 0.592 0 0.000 0.408
#> GSM1060771 2 0.0000 0.752 0.000 1.000 0 0.000 0.000
#> GSM1060772 2 0.0000 0.752 0.000 1.000 0 0.000 0.000
#> GSM1060773 4 0.4890 0.419 0.000 0.332 0 0.628 0.040
#> GSM1060774 2 0.0000 0.752 0.000 1.000 0 0.000 0.000
#> GSM1060775 2 0.0000 0.752 0.000 1.000 0 0.000 0.000
#> GSM1060776 2 0.0880 0.742 0.000 0.968 0 0.032 0.000
#> GSM1060777 2 0.0000 0.752 0.000 1.000 0 0.000 0.000
#> GSM1060778 2 0.4201 0.801 0.000 0.592 0 0.000 0.408
#> GSM1060779 2 0.4201 0.801 0.000 0.592 0 0.000 0.408
#> GSM1060780 2 0.0000 0.752 0.000 1.000 0 0.000 0.000
#> GSM1060781 2 0.3424 0.500 0.000 0.760 0 0.240 0.000
#> GSM1060782 2 0.4201 0.801 0.000 0.592 0 0.000 0.408
#> GSM1060783 2 0.4171 0.804 0.000 0.604 0 0.000 0.396
#> GSM1060784 2 0.4171 0.804 0.000 0.604 0 0.000 0.396
#> GSM1060785 2 0.4101 0.804 0.000 0.628 0 0.000 0.372
#> GSM1060786 2 0.0000 0.752 0.000 1.000 0 0.000 0.000
#> GSM1060787 2 0.4171 0.804 0.000 0.604 0 0.000 0.396
#> GSM1060788 2 0.4114 0.804 0.000 0.624 0 0.000 0.376
#> GSM1060789 2 0.4171 0.804 0.000 0.604 0 0.000 0.396
#> GSM1060790 2 0.0000 0.752 0.000 1.000 0 0.000 0.000
#> GSM1060754 1 0.2648 0.766 0.848 0.000 0 0.152 0.000
#> GSM1060745 4 0.0510 0.740 0.016 0.000 0 0.984 0.000
#> GSM1060756 4 0.4086 0.631 0.284 0.000 0 0.704 0.012
#> GSM1060746 1 0.0000 0.930 1.000 0.000 0 0.000 0.000
#> GSM1060758 4 0.1043 0.729 0.000 0.000 0 0.960 0.040
#> GSM1060765 1 0.0290 0.929 0.992 0.000 0 0.000 0.008
#> GSM1060732 3 0.0000 1.000 0.000 0.000 1 0.000 0.000
#> GSM1060727 3 0.0000 1.000 0.000 0.000 1 0.000 0.000
#> GSM1060740 1 0.2773 0.878 0.836 0.000 0 0.000 0.164
#> GSM1060730 3 0.0000 1.000 0.000 0.000 1 0.000 0.000
#> GSM1060737 1 0.0566 0.924 0.984 0.000 0 0.004 0.012
#> GSM1060743 1 0.0162 0.930 0.996 0.000 0 0.000 0.004
#> GSM1060734 4 0.0510 0.740 0.016 0.000 0 0.984 0.000
#> GSM1060729 3 0.0000 1.000 0.000 0.000 1 0.000 0.000
#> GSM1060744 4 0.0510 0.740 0.016 0.000 0 0.984 0.000
#> GSM1060742 1 0.3053 0.873 0.828 0.000 0 0.008 0.164
#> GSM1060752 1 0.3771 0.843 0.796 0.000 0 0.040 0.164
#> GSM1060755 4 0.5765 0.632 0.304 0.000 0 0.580 0.116
#> GSM1060761 4 0.1043 0.729 0.000 0.000 0 0.960 0.040
#> GSM1060760 4 0.5973 0.706 0.164 0.000 0 0.580 0.256
#> GSM1060767 1 0.0162 0.930 0.996 0.000 0 0.000 0.004
#> GSM1060741 1 0.2773 0.878 0.836 0.000 0 0.000 0.164
#> GSM1060759 4 0.5973 0.706 0.164 0.000 0 0.580 0.256
#> GSM1060728 4 0.3141 0.723 0.016 0.000 0 0.832 0.152
#> GSM1060763 1 0.0404 0.926 0.988 0.000 0 0.000 0.012
#> GSM1060747 4 0.0510 0.740 0.016 0.000 0 0.984 0.000
#> GSM1060764 4 0.5870 0.613 0.284 0.000 0 0.580 0.136
#> GSM1060733 4 0.0510 0.740 0.016 0.000 0 0.984 0.000
#> GSM1060735 1 0.0000 0.930 1.000 0.000 0 0.000 0.000
#> GSM1060739 1 0.2732 0.879 0.840 0.000 0 0.000 0.160
#> GSM1060753 4 0.4375 0.507 0.420 0.000 0 0.576 0.004
#> GSM1060738 1 0.0000 0.930 1.000 0.000 0 0.000 0.000
#> GSM1060762 4 0.0510 0.726 0.000 0.000 0 0.984 0.016
#> GSM1060731 3 0.0000 1.000 0.000 0.000 1 0.000 0.000
#> GSM1060750 4 0.5941 0.708 0.160 0.000 0 0.584 0.256
#> GSM1060749 4 0.5644 0.355 0.440 0.000 0 0.484 0.076
#> GSM1060736 4 0.4494 0.563 0.380 0.000 0 0.608 0.012
#> GSM1060748 4 0.5941 0.708 0.160 0.000 0 0.584 0.256
#> GSM1060751 1 0.0162 0.930 0.996 0.000 0 0.000 0.004
#> GSM1060766 4 0.5941 0.708 0.160 0.000 0 0.584 0.256
#> GSM1060757 1 0.0162 0.930 0.996 0.000 0 0.000 0.004
#> GSM1060726 3 0.0000 1.000 0.000 0.000 1 0.000 0.000
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> GSM1060768 2 0.383 0.664 0.000 0.556 0 0.444 0.000 0.000
#> GSM1060769 2 0.383 0.664 0.000 0.556 0 0.444 0.000 0.000
#> GSM1060770 2 0.383 0.664 0.000 0.556 0 0.444 0.000 0.000
#> GSM1060771 5 0.383 0.486 0.000 0.444 0 0.000 0.556 0.000
#> GSM1060772 5 0.383 0.486 0.000 0.444 0 0.000 0.556 0.000
#> GSM1060773 5 0.586 -0.541 0.000 0.000 0 0.200 0.444 0.356
#> GSM1060774 5 0.383 0.486 0.000 0.444 0 0.000 0.556 0.000
#> GSM1060775 5 0.383 0.486 0.000 0.444 0 0.000 0.556 0.000
#> GSM1060776 5 0.471 0.465 0.000 0.444 0 0.012 0.520 0.024
#> GSM1060777 5 0.383 0.486 0.000 0.444 0 0.000 0.556 0.000
#> GSM1060778 2 0.383 0.664 0.000 0.556 0 0.444 0.000 0.000
#> GSM1060779 2 0.383 0.664 0.000 0.556 0 0.444 0.000 0.000
#> GSM1060780 5 0.383 0.486 0.000 0.444 0 0.000 0.556 0.000
#> GSM1060781 5 0.351 0.307 0.000 0.128 0 0.024 0.816 0.032
#> GSM1060782 2 0.383 0.664 0.000 0.556 0 0.444 0.000 0.000
#> GSM1060783 2 0.000 0.580 0.000 1.000 0 0.000 0.000 0.000
#> GSM1060784 2 0.000 0.580 0.000 1.000 0 0.000 0.000 0.000
#> GSM1060785 2 0.301 0.268 0.000 0.796 0 0.000 0.196 0.008
#> GSM1060786 5 0.383 0.486 0.000 0.444 0 0.000 0.556 0.000
#> GSM1060787 2 0.000 0.580 0.000 1.000 0 0.000 0.000 0.000
#> GSM1060788 2 0.301 0.268 0.000 0.796 0 0.000 0.196 0.008
#> GSM1060789 2 0.000 0.580 0.000 1.000 0 0.000 0.000 0.000
#> GSM1060790 5 0.383 0.486 0.000 0.444 0 0.000 0.556 0.000
#> GSM1060754 1 0.611 -0.329 0.420 0.000 0 0.152 0.408 0.020
#> GSM1060745 4 0.431 0.943 0.000 0.000 0 0.536 0.444 0.020
#> GSM1060756 4 0.550 0.902 0.080 0.000 0 0.460 0.444 0.016
#> GSM1060746 1 0.000 0.792 1.000 0.000 0 0.000 0.000 0.000
#> GSM1060758 5 0.585 -0.542 0.000 0.000 0 0.196 0.444 0.360
#> GSM1060765 1 0.101 0.740 0.956 0.000 0 0.044 0.000 0.000
#> GSM1060732 3 0.000 1.000 0.000 0.000 1 0.000 0.000 0.000
#> GSM1060727 3 0.000 1.000 0.000 0.000 1 0.000 0.000 0.000
#> GSM1060740 6 0.454 0.638 0.384 0.000 0 0.040 0.000 0.576
#> GSM1060730 3 0.000 1.000 0.000 0.000 1 0.000 0.000 0.000
#> GSM1060737 1 0.234 0.568 0.852 0.000 0 0.148 0.000 0.000
#> GSM1060743 1 0.000 0.792 1.000 0.000 0 0.000 0.000 0.000
#> GSM1060734 4 0.431 0.943 0.000 0.000 0 0.536 0.444 0.020
#> GSM1060729 3 0.000 1.000 0.000 0.000 1 0.000 0.000 0.000
#> GSM1060744 4 0.431 0.943 0.000 0.000 0 0.536 0.444 0.020
#> GSM1060742 6 0.418 0.624 0.404 0.000 0 0.016 0.000 0.580
#> GSM1060752 6 0.516 0.616 0.244 0.000 0 0.144 0.000 0.612
#> GSM1060755 4 0.545 0.932 0.016 0.000 0 0.484 0.424 0.076
#> GSM1060761 5 0.586 -0.548 0.000 0.000 0 0.200 0.444 0.356
#> GSM1060760 4 0.559 0.927 0.032 0.000 0 0.480 0.424 0.064
#> GSM1060767 1 0.000 0.792 1.000 0.000 0 0.000 0.000 0.000
#> GSM1060741 6 0.417 0.629 0.400 0.000 0 0.016 0.000 0.584
#> GSM1060759 4 0.559 0.927 0.032 0.000 0 0.480 0.424 0.064
#> GSM1060728 4 0.452 0.938 0.000 0.000 0 0.524 0.444 0.032
#> GSM1060763 1 0.000 0.792 1.000 0.000 0 0.000 0.000 0.000
#> GSM1060747 4 0.431 0.943 0.000 0.000 0 0.536 0.444 0.020
#> GSM1060764 4 0.462 0.942 0.008 0.000 0 0.524 0.444 0.024
#> GSM1060733 4 0.431 0.943 0.000 0.000 0 0.536 0.444 0.020
#> GSM1060735 1 0.000 0.792 1.000 0.000 0 0.000 0.000 0.000
#> GSM1060739 1 0.438 -0.447 0.536 0.000 0 0.024 0.000 0.440
#> GSM1060753 4 0.609 0.882 0.048 0.000 0 0.436 0.424 0.092
#> GSM1060738 1 0.000 0.792 1.000 0.000 0 0.000 0.000 0.000
#> GSM1060762 5 0.585 -0.542 0.000 0.000 0 0.196 0.444 0.360
#> GSM1060731 3 0.000 1.000 0.000 0.000 1 0.000 0.000 0.000
#> GSM1060750 4 0.522 0.931 0.000 0.000 0 0.484 0.424 0.092
#> GSM1060749 6 0.555 0.155 0.052 0.000 0 0.408 0.040 0.500
#> GSM1060736 4 0.509 0.932 0.052 0.000 0 0.516 0.420 0.012
#> GSM1060748 4 0.478 0.939 0.000 0.000 0 0.524 0.424 0.052
#> GSM1060751 1 0.000 0.792 1.000 0.000 0 0.000 0.000 0.000
#> GSM1060766 4 0.478 0.939 0.000 0.000 0 0.524 0.424 0.052
#> GSM1060757 1 0.000 0.792 1.000 0.000 0 0.000 0.000 0.000
#> GSM1060726 3 0.000 1.000 0.000 0.000 1 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)
Test correlation between subgroups and known annotations. If the known annotation is numeric, one-way ANOVA test is applied, and if the known annotation is discrete, chi-squared contingency table test is applied.
test_to_known_factors(res)
#> n disease.state(p) tissue(p) k
#> ATC:mclust 64 1.14e-14 0.015940 2
#> ATC:mclust 62 3.44e-14 0.001181 3
#> ATC:mclust 59 9.61e-13 0.000069 4
#> ATC:mclust 63 1.34e-13 0.000122 5
#> ATC:mclust 46 2.46e-09 0.013659 6
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 51941 rows and 65 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.995 0.997 0.4731 0.527 0.527
#> 3 3 0.930 0.929 0.969 0.2489 0.832 0.699
#> 4 4 0.681 0.718 0.857 0.1709 0.896 0.757
#> 5 5 0.666 0.624 0.761 0.0714 0.938 0.814
#> 6 6 0.719 0.617 0.757 0.0384 0.897 0.664
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
#> GSM1060768 2 0.000 0.995 0.000 1.000
#> GSM1060769 2 0.000 0.995 0.000 1.000
#> GSM1060770 2 0.000 0.995 0.000 1.000
#> GSM1060771 2 0.000 0.995 0.000 1.000
#> GSM1060772 2 0.000 0.995 0.000 1.000
#> GSM1060773 2 0.184 0.970 0.028 0.972
#> GSM1060774 2 0.000 0.995 0.000 1.000
#> GSM1060775 2 0.000 0.995 0.000 1.000
#> GSM1060776 2 0.000 0.995 0.000 1.000
#> GSM1060777 2 0.000 0.995 0.000 1.000
#> GSM1060778 2 0.000 0.995 0.000 1.000
#> GSM1060779 2 0.000 0.995 0.000 1.000
#> GSM1060780 2 0.000 0.995 0.000 1.000
#> GSM1060781 2 0.000 0.995 0.000 1.000
#> GSM1060782 2 0.000 0.995 0.000 1.000
#> GSM1060783 2 0.000 0.995 0.000 1.000
#> GSM1060784 2 0.000 0.995 0.000 1.000
#> GSM1060785 2 0.000 0.995 0.000 1.000
#> GSM1060786 2 0.000 0.995 0.000 1.000
#> GSM1060787 2 0.000 0.995 0.000 1.000
#> GSM1060788 2 0.000 0.995 0.000 1.000
#> GSM1060789 2 0.000 0.995 0.000 1.000
#> GSM1060790 2 0.000 0.995 0.000 1.000
#> GSM1060754 1 0.000 0.998 1.000 0.000
#> GSM1060745 1 0.000 0.998 1.000 0.000
#> GSM1060756 1 0.000 0.998 1.000 0.000
#> GSM1060746 1 0.000 0.998 1.000 0.000
#> GSM1060758 1 0.000 0.998 1.000 0.000
#> GSM1060765 1 0.000 0.998 1.000 0.000
#> GSM1060732 1 0.000 0.998 1.000 0.000
#> GSM1060727 1 0.000 0.998 1.000 0.000
#> GSM1060740 1 0.000 0.998 1.000 0.000
#> GSM1060730 1 0.000 0.998 1.000 0.000
#> GSM1060737 1 0.000 0.998 1.000 0.000
#> GSM1060743 1 0.000 0.998 1.000 0.000
#> GSM1060734 1 0.000 0.998 1.000 0.000
#> GSM1060729 1 0.000 0.998 1.000 0.000
#> GSM1060744 1 0.000 0.998 1.000 0.000
#> GSM1060742 1 0.000 0.998 1.000 0.000
#> GSM1060752 1 0.000 0.998 1.000 0.000
#> GSM1060755 1 0.000 0.998 1.000 0.000
#> GSM1060761 1 0.000 0.998 1.000 0.000
#> GSM1060760 1 0.000 0.998 1.000 0.000
#> GSM1060767 1 0.000 0.998 1.000 0.000
#> GSM1060741 1 0.000 0.998 1.000 0.000
#> GSM1060759 1 0.000 0.998 1.000 0.000
#> GSM1060728 1 0.000 0.998 1.000 0.000
#> GSM1060763 1 0.000 0.998 1.000 0.000
#> GSM1060747 1 0.000 0.998 1.000 0.000
#> GSM1060764 1 0.000 0.998 1.000 0.000
#> GSM1060733 1 0.000 0.998 1.000 0.000
#> GSM1060735 1 0.000 0.998 1.000 0.000
#> GSM1060739 1 0.000 0.998 1.000 0.000
#> GSM1060753 1 0.000 0.998 1.000 0.000
#> GSM1060738 1 0.000 0.998 1.000 0.000
#> GSM1060762 1 0.000 0.998 1.000 0.000
#> GSM1060731 1 0.000 0.998 1.000 0.000
#> GSM1060750 1 0.000 0.998 1.000 0.000
#> GSM1060749 1 0.000 0.998 1.000 0.000
#> GSM1060736 1 0.000 0.998 1.000 0.000
#> GSM1060748 2 0.402 0.915 0.080 0.920
#> GSM1060751 1 0.000 0.998 1.000 0.000
#> GSM1060766 1 0.343 0.931 0.936 0.064
#> GSM1060757 1 0.000 0.998 1.000 0.000
#> GSM1060726 1 0.000 0.998 1.000 0.000
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> GSM1060768 2 0.0000 1.000 0.000 1.000 0.000
#> GSM1060769 2 0.0237 0.996 0.000 0.996 0.004
#> GSM1060770 2 0.0000 1.000 0.000 1.000 0.000
#> GSM1060771 2 0.0000 1.000 0.000 1.000 0.000
#> GSM1060772 2 0.0000 1.000 0.000 1.000 0.000
#> GSM1060773 1 0.6235 0.267 0.564 0.436 0.000
#> GSM1060774 2 0.0000 1.000 0.000 1.000 0.000
#> GSM1060775 2 0.0000 1.000 0.000 1.000 0.000
#> GSM1060776 2 0.0000 1.000 0.000 1.000 0.000
#> GSM1060777 2 0.0000 1.000 0.000 1.000 0.000
#> GSM1060778 2 0.0000 1.000 0.000 1.000 0.000
#> GSM1060779 2 0.0000 1.000 0.000 1.000 0.000
#> GSM1060780 2 0.0000 1.000 0.000 1.000 0.000
#> GSM1060781 2 0.0000 1.000 0.000 1.000 0.000
#> GSM1060782 2 0.0000 1.000 0.000 1.000 0.000
#> GSM1060783 2 0.0000 1.000 0.000 1.000 0.000
#> GSM1060784 2 0.0000 1.000 0.000 1.000 0.000
#> GSM1060785 2 0.0000 1.000 0.000 1.000 0.000
#> GSM1060786 2 0.0000 1.000 0.000 1.000 0.000
#> GSM1060787 2 0.0000 1.000 0.000 1.000 0.000
#> GSM1060788 2 0.0000 1.000 0.000 1.000 0.000
#> GSM1060789 2 0.0000 1.000 0.000 1.000 0.000
#> GSM1060790 2 0.0000 1.000 0.000 1.000 0.000
#> GSM1060754 1 0.0237 0.939 0.996 0.000 0.004
#> GSM1060745 1 0.3551 0.833 0.868 0.000 0.132
#> GSM1060756 1 0.1529 0.919 0.960 0.000 0.040
#> GSM1060746 1 0.0747 0.935 0.984 0.000 0.016
#> GSM1060758 1 0.0000 0.940 1.000 0.000 0.000
#> GSM1060765 1 0.0000 0.940 1.000 0.000 0.000
#> GSM1060732 3 0.0424 0.979 0.008 0.000 0.992
#> GSM1060727 3 0.0592 0.981 0.012 0.000 0.988
#> GSM1060740 1 0.0000 0.940 1.000 0.000 0.000
#> GSM1060730 3 0.0424 0.979 0.008 0.000 0.992
#> GSM1060737 1 0.0424 0.938 0.992 0.000 0.008
#> GSM1060743 1 0.0000 0.940 1.000 0.000 0.000
#> GSM1060734 1 0.6252 0.212 0.556 0.000 0.444
#> GSM1060729 3 0.0892 0.981 0.020 0.000 0.980
#> GSM1060744 1 0.0592 0.936 0.988 0.000 0.012
#> GSM1060742 1 0.0000 0.940 1.000 0.000 0.000
#> GSM1060752 1 0.0000 0.940 1.000 0.000 0.000
#> GSM1060755 1 0.0000 0.940 1.000 0.000 0.000
#> GSM1060761 1 0.0000 0.940 1.000 0.000 0.000
#> GSM1060760 1 0.0000 0.940 1.000 0.000 0.000
#> GSM1060767 1 0.0424 0.938 0.992 0.000 0.008
#> GSM1060741 1 0.0000 0.940 1.000 0.000 0.000
#> GSM1060759 1 0.0000 0.940 1.000 0.000 0.000
#> GSM1060728 3 0.2625 0.919 0.084 0.000 0.916
#> GSM1060763 1 0.0424 0.938 0.992 0.000 0.008
#> GSM1060747 1 0.0747 0.934 0.984 0.000 0.016
#> GSM1060764 1 0.4164 0.816 0.848 0.008 0.144
#> GSM1060733 1 0.0892 0.932 0.980 0.000 0.020
#> GSM1060735 1 0.0000 0.940 1.000 0.000 0.000
#> GSM1060739 1 0.0000 0.940 1.000 0.000 0.000
#> GSM1060753 1 0.0000 0.940 1.000 0.000 0.000
#> GSM1060738 1 0.0000 0.940 1.000 0.000 0.000
#> GSM1060762 1 0.3816 0.815 0.852 0.000 0.148
#> GSM1060731 3 0.0747 0.982 0.016 0.000 0.984
#> GSM1060750 1 0.1163 0.919 0.972 0.028 0.000
#> GSM1060749 1 0.0000 0.940 1.000 0.000 0.000
#> GSM1060736 1 0.0000 0.940 1.000 0.000 0.000
#> GSM1060748 1 0.5529 0.575 0.704 0.296 0.000
#> GSM1060751 1 0.0237 0.939 0.996 0.000 0.004
#> GSM1060766 1 0.2959 0.846 0.900 0.100 0.000
#> GSM1060757 1 0.0000 0.940 1.000 0.000 0.000
#> GSM1060726 3 0.0892 0.981 0.020 0.000 0.980
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> GSM1060768 2 0.2408 0.9106 0.000 0.896 0.000 0.104
#> GSM1060769 2 0.3266 0.8775 0.000 0.832 0.000 0.168
#> GSM1060770 2 0.2814 0.8958 0.000 0.868 0.000 0.132
#> GSM1060771 2 0.1940 0.9072 0.000 0.924 0.000 0.076
#> GSM1060772 2 0.1792 0.9096 0.000 0.932 0.000 0.068
#> GSM1060773 4 0.4776 0.3832 0.016 0.272 0.000 0.712
#> GSM1060774 2 0.1792 0.9096 0.000 0.932 0.000 0.068
#> GSM1060775 2 0.1940 0.9072 0.000 0.924 0.000 0.076
#> GSM1060776 2 0.2921 0.8643 0.000 0.860 0.000 0.140
#> GSM1060777 2 0.1474 0.9205 0.000 0.948 0.000 0.052
#> GSM1060778 2 0.1302 0.9191 0.000 0.956 0.000 0.044
#> GSM1060779 2 0.1389 0.9188 0.000 0.952 0.000 0.048
#> GSM1060780 2 0.1940 0.9072 0.000 0.924 0.000 0.076
#> GSM1060781 2 0.1940 0.9072 0.000 0.924 0.000 0.076
#> GSM1060782 2 0.0817 0.9207 0.000 0.976 0.000 0.024
#> GSM1060783 2 0.3266 0.8751 0.000 0.832 0.000 0.168
#> GSM1060784 2 0.2345 0.9053 0.000 0.900 0.000 0.100
#> GSM1060785 2 0.3400 0.8676 0.000 0.820 0.000 0.180
#> GSM1060786 2 0.1557 0.9131 0.000 0.944 0.000 0.056
#> GSM1060787 2 0.2647 0.8987 0.000 0.880 0.000 0.120
#> GSM1060788 2 0.3219 0.8763 0.000 0.836 0.000 0.164
#> GSM1060789 2 0.1118 0.9200 0.000 0.964 0.000 0.036
#> GSM1060790 2 0.1118 0.9166 0.000 0.964 0.000 0.036
#> GSM1060754 1 0.1452 0.7702 0.956 0.000 0.008 0.036
#> GSM1060745 4 0.7458 0.4385 0.380 0.000 0.176 0.444
#> GSM1060756 1 0.3325 0.7099 0.864 0.000 0.112 0.024
#> GSM1060746 1 0.1174 0.7588 0.968 0.000 0.012 0.020
#> GSM1060758 4 0.5444 0.6342 0.264 0.000 0.048 0.688
#> GSM1060765 1 0.1305 0.7534 0.960 0.004 0.000 0.036
#> GSM1060732 3 0.0000 0.9221 0.000 0.000 1.000 0.000
#> GSM1060727 3 0.0000 0.9221 0.000 0.000 1.000 0.000
#> GSM1060740 1 0.2011 0.7607 0.920 0.000 0.000 0.080
#> GSM1060730 3 0.0000 0.9221 0.000 0.000 1.000 0.000
#> GSM1060737 1 0.1624 0.7671 0.952 0.000 0.028 0.020
#> GSM1060743 1 0.0707 0.7644 0.980 0.000 0.000 0.020
#> GSM1060734 3 0.6016 0.1702 0.300 0.000 0.632 0.068
#> GSM1060729 3 0.0000 0.9221 0.000 0.000 1.000 0.000
#> GSM1060744 1 0.6108 -0.0947 0.528 0.000 0.048 0.424
#> GSM1060742 1 0.3494 0.6915 0.824 0.000 0.004 0.172
#> GSM1060752 1 0.2149 0.7582 0.912 0.000 0.000 0.088
#> GSM1060755 1 0.0921 0.7708 0.972 0.000 0.000 0.028
#> GSM1060761 4 0.5522 0.6181 0.288 0.000 0.044 0.668
#> GSM1060760 1 0.3266 0.6978 0.832 0.000 0.000 0.168
#> GSM1060767 1 0.1004 0.7608 0.972 0.000 0.004 0.024
#> GSM1060741 1 0.1792 0.7639 0.932 0.000 0.000 0.068
#> GSM1060759 1 0.4898 0.1483 0.584 0.000 0.000 0.416
#> GSM1060728 3 0.0000 0.9221 0.000 0.000 1.000 0.000
#> GSM1060763 1 0.0927 0.7681 0.976 0.000 0.016 0.008
#> GSM1060747 4 0.6477 0.3682 0.420 0.000 0.072 0.508
#> GSM1060764 1 0.5176 0.4677 0.748 0.056 0.004 0.192
#> GSM1060733 1 0.6811 -0.2118 0.496 0.000 0.100 0.404
#> GSM1060735 1 0.0336 0.7684 0.992 0.000 0.000 0.008
#> GSM1060739 1 0.2401 0.7535 0.904 0.000 0.004 0.092
#> GSM1060753 1 0.3688 0.6548 0.792 0.000 0.000 0.208
#> GSM1060738 1 0.0188 0.7693 0.996 0.000 0.000 0.004
#> GSM1060762 4 0.6627 0.4938 0.060 0.088 0.152 0.700
#> GSM1060731 3 0.0000 0.9221 0.000 0.000 1.000 0.000
#> GSM1060750 1 0.3444 0.6874 0.816 0.000 0.000 0.184
#> GSM1060749 1 0.4978 0.4189 0.664 0.000 0.012 0.324
#> GSM1060736 1 0.5698 0.3426 0.636 0.000 0.044 0.320
#> GSM1060748 1 0.5631 0.3978 0.700 0.224 0.000 0.076
#> GSM1060751 1 0.0592 0.7659 0.984 0.000 0.000 0.016
#> GSM1060766 1 0.5605 0.1513 0.572 0.008 0.012 0.408
#> GSM1060757 1 0.0707 0.7662 0.980 0.000 0.000 0.020
#> GSM1060726 3 0.0000 0.9221 0.000 0.000 1.000 0.000
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> GSM1060768 2 0.1661 0.92737 0.000 0.940 0.000 0.036 0.024
#> GSM1060769 2 0.2124 0.91640 0.000 0.916 0.000 0.056 0.028
#> GSM1060770 2 0.1965 0.91970 0.000 0.924 0.000 0.052 0.024
#> GSM1060771 2 0.2077 0.91373 0.000 0.908 0.000 0.084 0.008
#> GSM1060772 2 0.2077 0.91658 0.000 0.908 0.000 0.084 0.008
#> GSM1060773 4 0.6202 0.51292 0.000 0.220 0.000 0.552 0.228
#> GSM1060774 2 0.2286 0.90651 0.000 0.888 0.000 0.108 0.004
#> GSM1060775 2 0.1704 0.92009 0.000 0.928 0.000 0.068 0.004
#> GSM1060776 2 0.3530 0.81672 0.000 0.784 0.000 0.204 0.012
#> GSM1060777 2 0.1774 0.92852 0.000 0.932 0.000 0.052 0.016
#> GSM1060778 2 0.2074 0.91242 0.000 0.920 0.000 0.044 0.036
#> GSM1060779 2 0.1082 0.93100 0.000 0.964 0.000 0.028 0.008
#> GSM1060780 2 0.1956 0.91697 0.000 0.916 0.000 0.076 0.008
#> GSM1060781 2 0.3283 0.86473 0.000 0.832 0.000 0.140 0.028
#> GSM1060782 2 0.0912 0.93187 0.000 0.972 0.000 0.016 0.012
#> GSM1060783 2 0.1750 0.92367 0.000 0.936 0.000 0.036 0.028
#> GSM1060784 2 0.1493 0.92800 0.000 0.948 0.000 0.024 0.028
#> GSM1060785 2 0.1830 0.92576 0.000 0.932 0.000 0.028 0.040
#> GSM1060786 2 0.1557 0.92540 0.000 0.940 0.000 0.052 0.008
#> GSM1060787 2 0.1750 0.92367 0.000 0.936 0.000 0.036 0.028
#> GSM1060788 2 0.1918 0.92358 0.000 0.928 0.000 0.036 0.036
#> GSM1060789 2 0.1117 0.93271 0.000 0.964 0.000 0.016 0.020
#> GSM1060790 2 0.2046 0.92375 0.000 0.916 0.000 0.068 0.016
#> GSM1060754 1 0.3196 0.42070 0.804 0.000 0.000 0.004 0.192
#> GSM1060745 5 0.5666 0.66299 0.280 0.000 0.064 0.024 0.632
#> GSM1060756 1 0.4485 0.15361 0.680 0.000 0.028 0.000 0.292
#> GSM1060746 1 0.2068 0.51777 0.904 0.000 0.000 0.004 0.092
#> GSM1060758 4 0.5541 0.59178 0.128 0.000 0.000 0.636 0.236
#> GSM1060765 1 0.1082 0.52391 0.964 0.000 0.000 0.008 0.028
#> GSM1060732 3 0.0968 0.98113 0.004 0.000 0.972 0.012 0.012
#> GSM1060727 3 0.0000 0.99165 0.000 0.000 1.000 0.000 0.000
#> GSM1060740 1 0.3452 0.33505 0.756 0.000 0.000 0.000 0.244
#> GSM1060730 3 0.0000 0.99165 0.000 0.000 1.000 0.000 0.000
#> GSM1060737 1 0.2074 0.51447 0.920 0.000 0.016 0.004 0.060
#> GSM1060743 1 0.1697 0.51890 0.932 0.000 0.000 0.008 0.060
#> GSM1060734 5 0.6421 0.60424 0.300 0.000 0.180 0.004 0.516
#> GSM1060729 3 0.0486 0.99089 0.004 0.000 0.988 0.004 0.004
#> GSM1060744 5 0.4676 0.68989 0.392 0.000 0.004 0.012 0.592
#> GSM1060742 5 0.4287 0.56390 0.460 0.000 0.000 0.000 0.540
#> GSM1060752 1 0.4555 0.24928 0.636 0.000 0.000 0.020 0.344
#> GSM1060755 1 0.4827 0.43772 0.724 0.000 0.000 0.160 0.116
#> GSM1060761 4 0.5689 0.45426 0.080 0.000 0.000 0.480 0.440
#> GSM1060760 1 0.6054 0.34120 0.560 0.000 0.000 0.280 0.160
#> GSM1060767 1 0.2439 0.48681 0.876 0.000 0.000 0.004 0.120
#> GSM1060741 1 0.4268 -0.36324 0.556 0.000 0.000 0.000 0.444
#> GSM1060759 1 0.6469 0.04332 0.436 0.000 0.000 0.380 0.184
#> GSM1060728 3 0.0162 0.99147 0.004 0.000 0.996 0.000 0.000
#> GSM1060763 1 0.4251 0.23290 0.672 0.000 0.000 0.012 0.316
#> GSM1060747 5 0.5372 0.65391 0.284 0.000 0.008 0.068 0.640
#> GSM1060764 1 0.5048 0.39288 0.756 0.080 0.000 0.052 0.112
#> GSM1060733 5 0.5248 0.69407 0.348 0.000 0.012 0.036 0.604
#> GSM1060735 1 0.1357 0.52332 0.948 0.000 0.000 0.004 0.048
#> GSM1060739 1 0.4015 0.04140 0.652 0.000 0.000 0.000 0.348
#> GSM1060753 1 0.5357 0.38417 0.640 0.000 0.000 0.096 0.264
#> GSM1060738 1 0.3949 0.18085 0.696 0.000 0.000 0.004 0.300
#> GSM1060762 4 0.7046 0.61686 0.072 0.024 0.080 0.588 0.236
#> GSM1060731 3 0.0000 0.99165 0.000 0.000 1.000 0.000 0.000
#> GSM1060750 1 0.5652 0.26515 0.552 0.000 0.000 0.360 0.088
#> GSM1060749 1 0.4440 -0.34255 0.528 0.000 0.000 0.004 0.468
#> GSM1060736 5 0.5377 0.40103 0.456 0.000 0.004 0.044 0.496
#> GSM1060748 1 0.6670 0.25805 0.544 0.036 0.000 0.292 0.128
#> GSM1060751 1 0.2516 0.47130 0.860 0.000 0.000 0.000 0.140
#> GSM1060766 1 0.6623 0.00025 0.452 0.000 0.000 0.300 0.248
#> GSM1060757 1 0.3454 0.49375 0.836 0.000 0.000 0.064 0.100
#> GSM1060726 3 0.0486 0.99089 0.004 0.000 0.988 0.004 0.004
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> GSM1060768 5 0.1367 0.92611 0.000 0.044 0.000 0.012 0.944 0.000
#> GSM1060769 5 0.1700 0.91738 0.000 0.048 0.000 0.024 0.928 0.000
#> GSM1060770 5 0.1245 0.92730 0.000 0.032 0.000 0.016 0.952 0.000
#> GSM1060771 5 0.1845 0.92654 0.000 0.052 0.000 0.028 0.920 0.000
#> GSM1060772 5 0.1408 0.93287 0.000 0.036 0.000 0.020 0.944 0.000
#> GSM1060773 2 0.6513 0.25820 0.016 0.564 0.000 0.156 0.208 0.056
#> GSM1060774 5 0.1745 0.92649 0.000 0.056 0.000 0.020 0.924 0.000
#> GSM1060775 5 0.1334 0.93409 0.000 0.032 0.000 0.020 0.948 0.000
#> GSM1060776 5 0.4159 0.72575 0.000 0.140 0.000 0.116 0.744 0.000
#> GSM1060777 5 0.1010 0.93747 0.000 0.036 0.000 0.004 0.960 0.000
#> GSM1060778 5 0.2393 0.88375 0.004 0.092 0.000 0.020 0.884 0.000
#> GSM1060779 5 0.0603 0.93701 0.000 0.016 0.000 0.004 0.980 0.000
#> GSM1060780 5 0.1461 0.93288 0.000 0.044 0.000 0.016 0.940 0.000
#> GSM1060781 5 0.3422 0.80109 0.000 0.168 0.000 0.040 0.792 0.000
#> GSM1060782 5 0.0725 0.93844 0.000 0.012 0.000 0.012 0.976 0.000
#> GSM1060783 5 0.1168 0.93380 0.000 0.016 0.000 0.028 0.956 0.000
#> GSM1060784 5 0.0858 0.93807 0.000 0.028 0.000 0.004 0.968 0.000
#> GSM1060785 5 0.1321 0.93879 0.004 0.024 0.000 0.020 0.952 0.000
#> GSM1060786 5 0.1168 0.93916 0.000 0.028 0.000 0.016 0.956 0.000
#> GSM1060787 5 0.0909 0.93694 0.000 0.020 0.000 0.012 0.968 0.000
#> GSM1060788 5 0.1313 0.93487 0.000 0.028 0.000 0.016 0.952 0.004
#> GSM1060789 5 0.0972 0.93969 0.000 0.028 0.000 0.008 0.964 0.000
#> GSM1060790 5 0.1478 0.93725 0.004 0.032 0.000 0.020 0.944 0.000
#> GSM1060754 1 0.4096 0.08755 0.508 0.008 0.000 0.000 0.000 0.484
#> GSM1060745 6 0.3347 0.51310 0.008 0.016 0.012 0.144 0.000 0.820
#> GSM1060756 6 0.4074 0.35668 0.344 0.008 0.008 0.000 0.000 0.640
#> GSM1060746 1 0.4312 0.34030 0.604 0.028 0.000 0.000 0.000 0.368
#> GSM1060758 4 0.4131 0.32029 0.088 0.008 0.000 0.760 0.000 0.144
#> GSM1060765 1 0.4130 0.42445 0.672 0.024 0.000 0.004 0.000 0.300
#> GSM1060732 3 0.0964 0.97352 0.000 0.012 0.968 0.016 0.000 0.004
#> GSM1060727 3 0.0000 0.98922 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1060740 6 0.3969 0.38354 0.332 0.016 0.000 0.000 0.000 0.652
#> GSM1060730 3 0.0260 0.98853 0.000 0.008 0.992 0.000 0.000 0.000
#> GSM1060737 1 0.4591 0.34974 0.604 0.008 0.024 0.004 0.000 0.360
#> GSM1060743 1 0.3192 0.47673 0.776 0.004 0.000 0.004 0.000 0.216
#> GSM1060734 6 0.1823 0.66805 0.016 0.012 0.036 0.004 0.000 0.932
#> GSM1060729 3 0.0146 0.98901 0.000 0.004 0.996 0.000 0.000 0.000
#> GSM1060744 6 0.1835 0.64583 0.008 0.016 0.008 0.036 0.000 0.932
#> GSM1060742 6 0.1666 0.67019 0.036 0.020 0.000 0.008 0.000 0.936
#> GSM1060752 6 0.6307 0.24409 0.296 0.268 0.000 0.012 0.000 0.424
#> GSM1060755 1 0.4322 0.27897 0.752 0.048 0.000 0.172 0.004 0.024
#> GSM1060761 2 0.7139 0.00757 0.120 0.444 0.000 0.216 0.000 0.220
#> GSM1060760 1 0.6038 0.23467 0.604 0.132 0.000 0.188 0.000 0.076
#> GSM1060767 1 0.4238 0.20137 0.540 0.016 0.000 0.000 0.000 0.444
#> GSM1060741 6 0.2723 0.65245 0.128 0.004 0.000 0.016 0.000 0.852
#> GSM1060759 1 0.6553 0.07927 0.516 0.132 0.000 0.264 0.000 0.088
#> GSM1060728 3 0.0458 0.98269 0.000 0.000 0.984 0.016 0.000 0.000
#> GSM1060763 6 0.5069 0.48736 0.256 0.112 0.004 0.000 0.000 0.628
#> GSM1060747 6 0.3254 0.51600 0.008 0.020 0.008 0.136 0.000 0.828
#> GSM1060764 1 0.5440 0.42868 0.672 0.072 0.000 0.012 0.048 0.196
#> GSM1060733 6 0.3487 0.61883 0.028 0.108 0.012 0.020 0.000 0.832
#> GSM1060735 1 0.4180 0.37186 0.628 0.024 0.000 0.000 0.000 0.348
#> GSM1060739 6 0.4023 0.51526 0.264 0.004 0.000 0.028 0.000 0.704
#> GSM1060753 1 0.6184 0.27725 0.560 0.096 0.000 0.084 0.000 0.260
#> GSM1060738 6 0.3302 0.57010 0.232 0.004 0.000 0.004 0.000 0.760
#> GSM1060762 4 0.5289 0.29749 0.040 0.060 0.040 0.732 0.008 0.120
#> GSM1060731 3 0.0260 0.98853 0.000 0.008 0.992 0.000 0.000 0.000
#> GSM1060750 1 0.4929 -0.04889 0.564 0.052 0.000 0.376 0.000 0.008
#> GSM1060749 6 0.4562 0.61727 0.172 0.096 0.000 0.012 0.000 0.720
#> GSM1060736 6 0.5917 0.51108 0.176 0.200 0.004 0.028 0.000 0.592
#> GSM1060748 1 0.4643 0.08993 0.656 0.052 0.000 0.284 0.004 0.004
#> GSM1060751 1 0.4258 0.13341 0.516 0.016 0.000 0.000 0.000 0.468
#> GSM1060766 4 0.7846 0.08175 0.216 0.200 0.000 0.316 0.008 0.260
#> GSM1060757 1 0.3970 0.43110 0.800 0.044 0.000 0.064 0.000 0.092
#> GSM1060726 3 0.0291 0.98777 0.000 0.004 0.992 0.000 0.000 0.004
Heatmaps for the consensus matrix. It visualizes the probability of two samples to be in a same group.
consensus_heatmap(res, k = 2)
consensus_heatmap(res, k = 3)
consensus_heatmap(res, k = 4)
consensus_heatmap(res, k = 5)
consensus_heatmap(res, k = 6)
Heatmaps for the membership of samples in all partitions to see how consistent they are:
membership_heatmap(res, k = 2)
membership_heatmap(res, k = 3)
membership_heatmap(res, k = 4)
membership_heatmap(res, k = 5)
membership_heatmap(res, k = 6)
As soon as we have had the classes for columns, we can look for signatures which are significantly different between classes which can be candidate marks for certain classes. Following are the heatmaps for signatures.
Signature heatmaps where rows are scaled:
get_signatures(res, k = 2)
get_signatures(res, k = 3)
get_signatures(res, k = 4)
get_signatures(res, k = 5)
get_signatures(res, k = 6)
Signature heatmaps where rows are not scaled:
get_signatures(res, k = 2, scale_rows = FALSE)
get_signatures(res, k = 3, scale_rows = FALSE)
get_signatures(res, k = 4, scale_rows = FALSE)
get_signatures(res, k = 5, scale_rows = FALSE)
get_signatures(res, k = 6, scale_rows = FALSE)
Compare the overlap of signatures from different k:
compare_signatures(res)
get_signature()
returns a data frame invisibly. TO get the list of signatures, the function
call should be assigned to a variable explicitly. In following code, if plot
argument is set
to FALSE
, no heatmap is plotted while only the differential analysis is performed.
# code only for demonstration
tb = get_signature(res, k = ..., plot = FALSE)
An example of the output of tb
is:
#> which_row fdr mean_1 mean_2 scaled_mean_1 scaled_mean_2 km
#> 1 38 0.042760348 8.373488 9.131774 -0.5533452 0.5164555 1
#> 2 40 0.018707592 7.106213 8.469186 -0.6173731 0.5762149 1
#> 3 55 0.019134737 10.221463 11.207825 -0.6159697 0.5749050 1
#> 4 59 0.006059896 5.921854 7.869574 -0.6899429 0.6439467 1
#> 5 60 0.018055526 8.928898 10.211722 -0.6204761 0.5791110 1
#> 6 98 0.009384629 15.714769 14.887706 0.6635654 -0.6193277 2
...
The columns in tb
are:
which_row
: row indices corresponding to the input matrix.fdr
: FDR for the differential test. mean_x
: The mean value in group x.scaled_mean_x
: The mean value in group x after rows are scaled.km
: Row groups if k-means clustering is applied to rows.UMAP plot which shows how samples are separated.
dimension_reduction(res, k = 2, method = "UMAP")
dimension_reduction(res, k = 3, method = "UMAP")
dimension_reduction(res, k = 4, method = "UMAP")
dimension_reduction(res, k = 5, method = "UMAP")
dimension_reduction(res, k = 6, method = "UMAP")
Following heatmap shows how subgroups are split when increasing k
:
collect_classes(res)
Test correlation between subgroups and known annotations. If the known annotation is numeric, one-way ANOVA test is applied, and if the known annotation is discrete, chi-squared contingency table test is applied.
test_to_known_factors(res)
#> n disease.state(p) tissue(p) k
#> ATC:NMF 65 5.10e-14 1.29e-02 2
#> ATC:NMF 63 2.09e-14 1.30e-03 3
#> ATC:NMF 52 3.00e-11 1.99e-05 4
#> ATC:NMF 43 3.72e-08 7.10e-07 5
#> ATC:NMF 40 2.06e-09 3.47e-05 6
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