Date: 2019-12-25 20:17:12 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 21168 rows and 70 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] 21168 70
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:kmeans | 2 | 1.000 | 0.990 | 0.987 | ** | |
SD:pam | 4 | 1.000 | 0.975 | 0.989 | ** | 2,3 |
SD:NMF | 4 | 1.000 | 0.947 | 0.974 | ** | 2,3 |
CV:kmeans | 2 | 1.000 | 0.984 | 0.988 | ** | |
CV:skmeans | 3 | 1.000 | 0.982 | 0.983 | ** | 2 |
CV:pam | 4 | 1.000 | 0.985 | 0.995 | ** | 2,3 |
MAD:kmeans | 2 | 1.000 | 0.964 | 0.986 | ** | |
ATC:skmeans | 4 | 1.000 | 0.979 | 0.987 | ** | 2 |
ATC:kmeans | 4 | 0.999 | 0.969 | 0.982 | ** | 2,3 |
CV:NMF | 4 | 0.987 | 0.942 | 0.957 | ** | 2,3 |
CV:hclust | 4 | 0.981 | 0.957 | 0.975 | ** | |
ATC:NMF | 4 | 0.974 | 0.922 | 0.963 | ** | 2,3 |
ATC:hclust | 6 | 0.970 | 0.989 | 0.980 | ** | 2,3,4 |
SD:skmeans | 4 | 0.958 | 0.954 | 0.956 | ** | 2,3 |
SD:mclust | 4 | 0.957 | 0.933 | 0.969 | ** | 2 |
MAD:mclust | 4 | 0.947 | 0.925 | 0.963 | * | 2,3 |
MAD:NMF | 3 | 0.937 | 0.873 | 0.949 | * | 2 |
MAD:hclust | 4 | 0.930 | 0.930 | 0.914 | * | |
SD:hclust | 6 | 0.926 | 0.885 | 0.913 | * | 5 |
ATC:mclust | 4 | 0.923 | 0.931 | 0.945 | * | |
CV:mclust | 4 | 0.922 | 0.905 | 0.961 | * | 2,3 |
MAD:skmeans | 3 | 0.919 | 0.960 | 0.967 | * | 2 |
ATC:pam | 5 | 0.914 | 0.918 | 0.945 | * | 2,3,4 |
MAD:pam | 5 | 0.901 | 0.871 | 0.948 | * | 2,3 |
**: 1-PAC > 0.95, *: 1-PAC > 0.9
Cumulative distribution function curves of consensus matrix for all methods.
collect_plots(res_list, fun = plot_ecdf)
Consensus heatmaps for all methods. (What is a consensus heatmap?)
collect_plots(res_list, k = 2, fun = consensus_heatmap, mc.cores = 4)
collect_plots(res_list, k = 3, fun = consensus_heatmap, mc.cores = 4)
collect_plots(res_list, k = 4, fun = consensus_heatmap, mc.cores = 4)
collect_plots(res_list, k = 5, fun = consensus_heatmap, mc.cores = 4)
collect_plots(res_list, k = 6, fun = consensus_heatmap, mc.cores = 4)
Membership heatmaps for all methods. (What is a membership heatmap?)
collect_plots(res_list, k = 2, fun = membership_heatmap, mc.cores = 4)
collect_plots(res_list, k = 3, fun = membership_heatmap, mc.cores = 4)
collect_plots(res_list, k = 4, fun = membership_heatmap, mc.cores = 4)
collect_plots(res_list, k = 5, fun = membership_heatmap, mc.cores = 4)
collect_plots(res_list, k = 6, fun = membership_heatmap, mc.cores = 4)
Signature heatmaps for all methods. (What is a signature heatmap?)
Note in following heatmaps, rows are scaled.
collect_plots(res_list, k = 2, fun = get_signatures, mc.cores = 4)
collect_plots(res_list, k = 3, fun = get_signatures, mc.cores = 4)
collect_plots(res_list, k = 4, fun = get_signatures, mc.cores = 4)
collect_plots(res_list, k = 5, fun = get_signatures, mc.cores = 4)
collect_plots(res_list, k = 6, fun = get_signatures, mc.cores = 4)
The statistics used for measuring the stability of consensus partitioning. (How are they defined?)
get_stats(res_list, k = 2)
#> k 1-PAC mean_silhouette concordance area_increased Rand Jaccard
#> SD:NMF 2 1.000 0.996 0.998 0.493 0.508 0.508
#> CV:NMF 2 1.000 0.977 0.992 0.495 0.508 0.508
#> MAD:NMF 2 1.000 0.986 0.994 0.503 0.496 0.496
#> ATC:NMF 2 1.000 0.991 0.996 0.487 0.513 0.513
#> SD:skmeans 2 1.000 0.976 0.990 0.500 0.499 0.499
#> CV:skmeans 2 1.000 0.984 0.993 0.503 0.496 0.496
#> MAD:skmeans 2 1.000 0.988 0.995 0.503 0.496 0.496
#> ATC:skmeans 2 1.000 1.000 1.000 0.497 0.503 0.503
#> SD:mclust 2 0.911 0.943 0.976 0.505 0.493 0.493
#> CV:mclust 2 1.000 0.973 0.988 0.507 0.493 0.493
#> MAD:mclust 2 0.970 0.969 0.985 0.506 0.493 0.493
#> ATC:mclust 2 0.724 0.861 0.936 0.488 0.493 0.493
#> SD:kmeans 2 1.000 0.990 0.987 0.481 0.508 0.508
#> CV:kmeans 2 1.000 0.984 0.988 0.488 0.508 0.508
#> MAD:kmeans 2 1.000 0.964 0.986 0.498 0.503 0.503
#> ATC:kmeans 2 1.000 0.990 0.986 0.480 0.508 0.508
#> SD:pam 2 1.000 1.000 1.000 0.493 0.508 0.508
#> CV:pam 2 1.000 0.998 0.999 0.493 0.508 0.508
#> MAD:pam 2 1.000 0.951 0.982 0.499 0.499 0.499
#> ATC:pam 2 1.000 0.989 0.995 0.494 0.508 0.508
#> SD:hclust 2 0.675 0.949 0.970 0.280 0.752 0.752
#> CV:hclust 2 0.653 0.825 0.916 0.335 0.752 0.752
#> MAD:hclust 2 0.546 0.827 0.919 0.465 0.503 0.503
#> ATC:hclust 2 1.000 0.991 0.993 0.255 0.752 0.752
get_stats(res_list, k = 3)
#> k 1-PAC mean_silhouette concordance area_increased Rand Jaccard
#> SD:NMF 3 1.000 0.959 0.982 0.238 0.807 0.648
#> CV:NMF 3 0.945 0.949 0.974 0.244 0.806 0.642
#> MAD:NMF 3 0.937 0.873 0.949 0.232 0.851 0.708
#> ATC:NMF 3 1.000 0.990 0.996 0.236 0.812 0.658
#> SD:skmeans 3 1.000 0.934 0.972 0.205 0.859 0.727
#> CV:skmeans 3 1.000 0.982 0.983 0.201 0.901 0.800
#> MAD:skmeans 3 0.919 0.960 0.967 0.206 0.877 0.756
#> ATC:skmeans 3 0.871 0.930 0.933 0.195 0.864 0.738
#> SD:mclust 3 0.867 0.839 0.891 0.225 0.867 0.735
#> CV:mclust 3 0.988 0.972 0.981 0.205 0.896 0.790
#> MAD:mclust 3 1.000 0.965 0.985 0.210 0.872 0.746
#> ATC:mclust 3 0.886 0.912 0.934 0.284 0.839 0.685
#> SD:kmeans 3 0.718 0.890 0.885 0.241 0.873 0.758
#> CV:kmeans 3 0.721 0.847 0.854 0.236 0.873 0.758
#> MAD:kmeans 3 0.709 0.791 0.811 0.222 0.971 0.945
#> ATC:kmeans 3 1.000 0.980 0.993 0.231 0.851 0.719
#> SD:pam 3 1.000 0.988 0.995 0.163 0.921 0.845
#> CV:pam 3 1.000 0.965 0.986 0.164 0.921 0.845
#> MAD:pam 3 0.964 0.922 0.948 0.185 0.913 0.826
#> ATC:pam 3 1.000 0.980 0.992 0.161 0.921 0.845
#> SD:hclust 3 0.876 0.940 0.955 1.096 0.661 0.549
#> CV:hclust 3 0.855 0.890 0.905 0.745 0.661 0.549
#> MAD:hclust 3 0.860 0.813 0.892 0.262 0.891 0.786
#> ATC:hclust 3 1.000 1.000 1.000 1.243 0.677 0.571
get_stats(res_list, k = 4)
#> k 1-PAC mean_silhouette concordance area_increased Rand Jaccard
#> SD:NMF 4 1.000 0.947 0.974 0.0795 0.944 0.858
#> CV:NMF 4 0.987 0.942 0.957 0.0774 0.933 0.829
#> MAD:NMF 4 0.856 0.887 0.914 0.0766 0.919 0.796
#> ATC:NMF 4 0.974 0.922 0.963 0.0985 0.932 0.831
#> SD:skmeans 4 0.958 0.954 0.956 0.1102 0.920 0.801
#> CV:skmeans 4 0.801 0.912 0.918 0.1234 0.908 0.777
#> MAD:skmeans 4 0.801 0.886 0.909 0.1139 0.920 0.801
#> ATC:skmeans 4 1.000 0.979 0.987 0.0939 0.924 0.817
#> SD:mclust 4 0.957 0.933 0.969 0.0962 0.938 0.836
#> CV:mclust 4 0.922 0.905 0.961 0.0950 0.935 0.834
#> MAD:mclust 4 0.947 0.925 0.963 0.0977 0.893 0.741
#> ATC:mclust 4 0.923 0.931 0.945 0.0876 0.950 0.864
#> SD:kmeans 4 0.698 0.670 0.807 0.1424 0.984 0.962
#> CV:kmeans 4 0.716 0.774 0.742 0.1498 0.819 0.574
#> MAD:kmeans 4 0.701 0.757 0.705 0.1522 0.741 0.490
#> ATC:kmeans 4 0.999 0.969 0.982 0.1010 0.931 0.831
#> SD:pam 4 1.000 0.975 0.989 0.0956 0.930 0.840
#> CV:pam 4 1.000 0.985 0.995 0.0940 0.930 0.840
#> MAD:pam 4 0.733 0.744 0.820 0.1619 0.957 0.896
#> ATC:pam 4 0.970 0.958 0.978 0.1145 0.918 0.811
#> SD:hclust 4 0.885 0.919 0.959 0.0689 0.959 0.902
#> CV:hclust 4 0.981 0.957 0.975 0.0818 0.959 0.902
#> MAD:hclust 4 0.930 0.930 0.914 0.0729 0.916 0.799
#> ATC:hclust 4 1.000 0.996 0.998 0.1099 0.939 0.857
get_stats(res_list, k = 5)
#> k 1-PAC mean_silhouette concordance area_increased Rand Jaccard
#> SD:NMF 5 0.780 0.728 0.845 0.1156 0.982 0.946
#> CV:NMF 5 0.784 0.846 0.895 0.1512 0.860 0.597
#> MAD:NMF 5 0.745 0.820 0.879 0.1559 0.867 0.608
#> ATC:NMF 5 0.938 0.858 0.935 0.0308 0.993 0.978
#> SD:skmeans 5 0.738 0.568 0.796 0.1280 0.901 0.709
#> CV:skmeans 5 0.732 0.807 0.853 0.1317 0.855 0.581
#> MAD:skmeans 5 0.697 0.723 0.831 0.1388 0.866 0.604
#> ATC:skmeans 5 0.821 0.526 0.805 0.1196 0.885 0.681
#> SD:mclust 5 0.778 0.854 0.887 0.0889 0.978 0.930
#> CV:mclust 5 0.745 0.803 0.876 0.0856 0.973 0.917
#> MAD:mclust 5 0.756 0.730 0.855 0.1124 0.935 0.809
#> ATC:mclust 5 0.791 0.774 0.860 0.0682 0.995 0.986
#> SD:kmeans 5 0.758 0.853 0.840 0.1017 0.812 0.531
#> CV:kmeans 5 0.731 0.908 0.873 0.0898 0.938 0.769
#> MAD:kmeans 5 0.712 0.902 0.861 0.0892 0.943 0.783
#> ATC:kmeans 5 0.797 0.886 0.887 0.1636 0.866 0.612
#> SD:pam 5 0.730 0.830 0.869 0.2246 0.842 0.579
#> CV:pam 5 0.811 0.850 0.925 0.2336 0.832 0.554
#> MAD:pam 5 0.901 0.871 0.948 0.1426 0.825 0.540
#> ATC:pam 5 0.914 0.918 0.945 0.2182 0.854 0.594
#> SD:hclust 5 0.938 0.895 0.944 0.0636 0.969 0.918
#> CV:hclust 5 0.817 0.858 0.920 0.0846 0.969 0.918
#> MAD:hclust 5 0.918 0.945 0.960 0.0417 0.997 0.991
#> ATC:hclust 5 1.000 0.996 0.998 0.0104 0.993 0.982
get_stats(res_list, k = 6)
#> k 1-PAC mean_silhouette concordance area_increased Rand Jaccard
#> SD:NMF 6 0.734 0.672 0.841 0.0452 0.922 0.758
#> CV:NMF 6 0.761 0.742 0.863 0.0272 0.947 0.781
#> MAD:NMF 6 0.746 0.731 0.849 0.0315 0.978 0.897
#> ATC:NMF 6 0.906 0.875 0.927 0.0136 0.989 0.967
#> SD:skmeans 6 0.704 0.645 0.783 0.0665 0.880 0.573
#> CV:skmeans 6 0.733 0.739 0.835 0.0552 0.974 0.881
#> MAD:skmeans 6 0.662 0.663 0.791 0.0518 0.969 0.856
#> ATC:skmeans 6 0.800 0.861 0.874 0.0621 0.879 0.573
#> SD:mclust 6 0.758 0.603 0.768 0.0565 0.901 0.667
#> CV:mclust 6 0.688 0.574 0.783 0.0602 0.928 0.769
#> MAD:mclust 6 0.738 0.713 0.800 0.0564 0.871 0.589
#> ATC:mclust 6 0.760 0.693 0.790 0.0893 0.901 0.681
#> SD:kmeans 6 0.698 0.788 0.826 0.0565 0.964 0.839
#> CV:kmeans 6 0.801 0.835 0.875 0.0533 0.961 0.830
#> MAD:kmeans 6 0.717 0.798 0.832 0.0420 0.988 0.945
#> ATC:kmeans 6 0.733 0.757 0.808 0.0411 1.000 1.000
#> SD:pam 6 0.732 0.769 0.823 0.0326 0.991 0.961
#> CV:pam 6 0.797 0.808 0.883 0.0214 0.991 0.960
#> MAD:pam 6 0.820 0.693 0.847 0.0439 0.962 0.825
#> ATC:pam 6 0.870 0.740 0.888 0.0342 0.962 0.827
#> SD:hclust 6 0.926 0.885 0.913 0.0215 0.969 0.908
#> CV:hclust 6 0.786 0.790 0.886 0.0286 0.965 0.899
#> MAD:hclust 6 0.920 0.895 0.954 0.0458 0.986 0.958
#> ATC:hclust 6 0.970 0.989 0.980 0.0401 0.971 0.920
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) k
#> SD:NMF 70 1.15e-12 2
#> CV:NMF 69 1.81e-12 2
#> MAD:NMF 70 9.38e-11 2
#> ATC:NMF 70 2.15e-13 2
#> SD:skmeans 69 8.57e-12 2
#> CV:skmeans 70 9.38e-11 2
#> MAD:skmeans 70 9.38e-11 2
#> ATC:skmeans 70 5.50e-12 2
#> SD:mclust 69 5.37e-09 2
#> CV:mclust 70 3.59e-09 2
#> MAD:mclust 70 3.59e-09 2
#> ATC:mclust 69 1.72e-09 2
#> SD:kmeans 70 1.15e-12 2
#> CV:kmeans 70 1.15e-12 2
#> MAD:kmeans 68 2.85e-12 2
#> ATC:kmeans 70 1.15e-12 2
#> SD:pam 70 1.15e-12 2
#> CV:pam 70 1.15e-12 2
#> MAD:pam 68 2.85e-12 2
#> ATC:pam 70 1.15e-12 2
#> SD:hclust 70 1.71e-11 2
#> CV:hclust 58 4.88e-11 2
#> MAD:hclust 63 5.96e-12 2
#> ATC:hclust 70 1.71e-11 2
test_to_known_factors(res_list, k = 3)
#> n disease.state(p) k
#> SD:NMF 68 1.20e-15 3
#> CV:NMF 69 4.37e-14 3
#> MAD:NMF 65 6.08e-12 3
#> ATC:NMF 70 5.33e-17 3
#> SD:skmeans 67 2.67e-16 3
#> CV:skmeans 70 2.29e-15 3
#> MAD:skmeans 69 4.15e-15 3
#> ATC:skmeans 69 4.15e-15 3
#> SD:mclust 69 1.81e-12 3
#> CV:mclust 70 4.26e-16 3
#> MAD:mclust 69 8.13e-16 3
#> ATC:mclust 69 2.52e-14 3
#> SD:kmeans 69 2.15e-18 3
#> CV:kmeans 67 1.86e-18 3
#> MAD:kmeans 67 4.49e-12 3
#> ATC:kmeans 70 1.63e-17 3
#> SD:pam 70 2.22e-19 3
#> CV:pam 69 6.71e-19 3
#> MAD:pam 68 9.16e-19 3
#> ATC:pam 69 4.50e-19 3
#> SD:hclust 70 4.47e-18 3
#> CV:hclust 69 8.86e-18 3
#> MAD:hclust 66 7.95e-13 3
#> ATC:hclust 70 2.22e-19 3
test_to_known_factors(res_list, k = 4)
#> n disease.state(p) k
#> SD:NMF 69 4.88e-19 4
#> CV:NMF 69 3.22e-19 4
#> MAD:NMF 68 9.63e-19 4
#> ATC:NMF 67 1.31e-18 4
#> SD:skmeans 70 1.62e-19 4
#> CV:skmeans 70 1.62e-19 4
#> MAD:skmeans 69 4.88e-19 4
#> ATC:skmeans 70 5.30e-18 4
#> SD:mclust 68 7.84e-18 4
#> CV:mclust 67 1.92e-17 4
#> MAD:mclust 69 3.88e-18 4
#> ATC:mclust 69 3.18e-20 4
#> SD:kmeans 63 3.48e-19 4
#> CV:kmeans 62 7.42e-19 4
#> MAD:kmeans 60 3.37e-18 4
#> ATC:kmeans 70 1.39e-19 4
#> SD:pam 69 1.20e-19 4
#> CV:pam 70 6.96e-20 4
#> MAD:pam 64 9.10e-19 4
#> ATC:pam 69 7.06e-20 4
#> SD:hclust 68 1.09e-19 4
#> CV:hclust 69 2.72e-20 4
#> MAD:hclust 67 1.23e-18 4
#> ATC:hclust 70 5.30e-18 4
test_to_known_factors(res_list, k = 5)
#> n disease.state(p) k
#> SD:NMF 61 1.45e-16 5
#> CV:NMF 67 2.25e-17 5
#> MAD:NMF 66 4.31e-18 5
#> ATC:NMF 65 5.59e-18 5
#> SD:skmeans 49 1.02e-12 5
#> CV:skmeans 65 9.26e-17 5
#> MAD:skmeans 64 1.94e-16 5
#> ATC:skmeans 54 4.51e-15 5
#> SD:mclust 68 3.14e-17 5
#> CV:mclust 63 1.06e-16 5
#> MAD:mclust 62 4.04e-15 5
#> ATC:mclust 67 1.35e-19 5
#> SD:kmeans 69 4.84e-19 5
#> CV:kmeans 69 4.84e-19 5
#> MAD:kmeans 70 2.44e-19 5
#> ATC:kmeans 68 9.91e-18 5
#> SD:pam 68 4.25e-18 5
#> CV:pam 65 3.65e-17 5
#> MAD:pam 65 1.56e-16 5
#> ATC:pam 69 1.23e-18 5
#> SD:hclust 66 7.92e-18 5
#> CV:hclust 68 1.00e-18 5
#> MAD:hclust 67 8.80e-18 5
#> ATC:hclust 70 1.95e-17 5
test_to_known_factors(res_list, k = 6)
#> n disease.state(p) k
#> SD:NMF 59 6.37e-14 6
#> CV:NMF 61 2.16e-14 6
#> MAD:NMF 63 5.07e-15 6
#> ATC:NMF 67 1.29e-18 6
#> SD:skmeans 53 6.02e-13 6
#> CV:skmeans 62 9.00e-16 6
#> MAD:skmeans 59 6.14e-16 6
#> ATC:skmeans 68 1.15e-17 6
#> SD:mclust 55 1.17e-12 6
#> CV:mclust 48 5.44e-13 6
#> MAD:mclust 64 1.77e-16 6
#> ATC:mclust 60 8.02e-16 6
#> SD:kmeans 66 6.30e-17 6
#> CV:kmeans 68 1.32e-17 6
#> MAD:kmeans 67 2.08e-18 6
#> ATC:kmeans 68 9.91e-18 6
#> SD:pam 68 1.02e-22 6
#> CV:pam 65 1.56e-21 6
#> MAD:pam 59 1.11e-13 6
#> ATC:pam 54 2.22e-15 6
#> SD:hclust 64 4.60e-18 6
#> CV:hclust 65 8.94e-18 6
#> MAD:hclust 66 1.80e-17 6
#> ATC:hclust 70 6.42e-19 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 21168 rows and 70 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 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.675 0.949 0.970 0.2799 0.752 0.752
#> 3 3 0.876 0.940 0.955 1.0961 0.661 0.549
#> 4 4 0.885 0.919 0.959 0.0689 0.959 0.902
#> 5 5 0.938 0.895 0.944 0.0636 0.969 0.918
#> 6 6 0.926 0.885 0.913 0.0215 0.969 0.908
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
#> GSM71671 2 0.000 1.000 0.000 1.000
#> GSM71672 2 0.000 1.000 0.000 1.000
#> GSM71673 2 0.000 1.000 0.000 1.000
#> GSM71674 2 0.000 1.000 0.000 1.000
#> GSM71675 2 0.000 1.000 0.000 1.000
#> GSM71676 2 0.000 1.000 0.000 1.000
#> GSM71677 2 0.000 1.000 0.000 1.000
#> GSM71678 1 0.605 0.865 0.852 0.148
#> GSM71679 1 0.605 0.865 0.852 0.148
#> GSM71680 1 0.000 0.963 1.000 0.000
#> GSM71681 1 0.605 0.865 0.852 0.148
#> GSM71682 1 0.605 0.865 0.852 0.148
#> GSM71683 1 0.605 0.865 0.852 0.148
#> GSM71684 1 0.605 0.865 0.852 0.148
#> GSM71685 1 0.605 0.865 0.852 0.148
#> GSM71686 1 0.605 0.865 0.852 0.148
#> GSM71687 1 0.605 0.865 0.852 0.148
#> GSM71688 1 0.605 0.865 0.852 0.148
#> GSM71689 2 0.000 1.000 0.000 1.000
#> GSM71690 1 0.605 0.865 0.852 0.148
#> GSM71691 1 0.605 0.865 0.852 0.148
#> GSM71692 2 0.000 1.000 0.000 1.000
#> GSM71693 1 0.605 0.865 0.852 0.148
#> GSM71694 2 0.000 1.000 0.000 1.000
#> GSM71695 1 0.605 0.865 0.852 0.148
#> GSM71696 1 0.000 0.963 1.000 0.000
#> GSM71697 1 0.000 0.963 1.000 0.000
#> GSM71698 1 0.000 0.963 1.000 0.000
#> GSM71699 1 0.000 0.963 1.000 0.000
#> GSM71700 1 0.000 0.963 1.000 0.000
#> GSM71701 1 0.000 0.963 1.000 0.000
#> GSM71702 1 0.000 0.963 1.000 0.000
#> GSM71703 1 0.000 0.963 1.000 0.000
#> GSM71704 1 0.000 0.963 1.000 0.000
#> GSM71705 1 0.000 0.963 1.000 0.000
#> GSM71706 1 0.000 0.963 1.000 0.000
#> GSM71707 1 0.000 0.963 1.000 0.000
#> GSM71708 1 0.000 0.963 1.000 0.000
#> GSM71709 1 0.000 0.963 1.000 0.000
#> GSM71710 1 0.000 0.963 1.000 0.000
#> GSM71711 1 0.000 0.963 1.000 0.000
#> GSM71712 1 0.000 0.963 1.000 0.000
#> GSM71713 1 0.000 0.963 1.000 0.000
#> GSM71714 1 0.000 0.963 1.000 0.000
#> GSM71715 1 0.000 0.963 1.000 0.000
#> GSM71716 1 0.000 0.963 1.000 0.000
#> GSM71717 1 0.000 0.963 1.000 0.000
#> GSM71718 1 0.000 0.963 1.000 0.000
#> GSM71719 1 0.000 0.963 1.000 0.000
#> GSM71720 1 0.000 0.963 1.000 0.000
#> GSM71721 1 0.000 0.963 1.000 0.000
#> GSM71722 1 0.000 0.963 1.000 0.000
#> GSM71723 1 0.000 0.963 1.000 0.000
#> GSM71724 1 0.000 0.963 1.000 0.000
#> GSM71725 1 0.000 0.963 1.000 0.000
#> GSM71726 1 0.000 0.963 1.000 0.000
#> GSM71727 1 0.000 0.963 1.000 0.000
#> GSM71728 1 0.000 0.963 1.000 0.000
#> GSM71729 1 0.000 0.963 1.000 0.000
#> GSM71730 1 0.000 0.963 1.000 0.000
#> GSM71731 1 0.000 0.963 1.000 0.000
#> GSM71732 1 0.000 0.963 1.000 0.000
#> GSM71733 1 0.000 0.963 1.000 0.000
#> GSM71734 1 0.000 0.963 1.000 0.000
#> GSM71735 1 0.000 0.963 1.000 0.000
#> GSM71736 1 0.000 0.963 1.000 0.000
#> GSM71737 1 0.000 0.963 1.000 0.000
#> GSM71738 1 0.000 0.963 1.000 0.000
#> GSM71739 1 0.000 0.963 1.000 0.000
#> GSM71740 1 0.000 0.963 1.000 0.000
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> GSM71671 3 0.3816 1.000 0.000 0.148 0.852
#> GSM71672 3 0.3816 1.000 0.000 0.148 0.852
#> GSM71673 3 0.3816 1.000 0.000 0.148 0.852
#> GSM71674 3 0.3816 1.000 0.000 0.148 0.852
#> GSM71675 3 0.3816 1.000 0.000 0.148 0.852
#> GSM71676 3 0.3816 1.000 0.000 0.148 0.852
#> GSM71677 3 0.3816 1.000 0.000 0.148 0.852
#> GSM71678 2 0.0237 0.918 0.004 0.996 0.000
#> GSM71679 2 0.0237 0.918 0.004 0.996 0.000
#> GSM71680 2 0.3816 0.852 0.000 0.852 0.148
#> GSM71681 2 0.0000 0.915 0.000 1.000 0.000
#> GSM71682 2 0.0237 0.918 0.004 0.996 0.000
#> GSM71683 2 0.0237 0.918 0.004 0.996 0.000
#> GSM71684 2 0.0237 0.918 0.004 0.996 0.000
#> GSM71685 2 0.0000 0.915 0.000 1.000 0.000
#> GSM71686 2 0.0237 0.918 0.004 0.996 0.000
#> GSM71687 2 0.0237 0.918 0.004 0.996 0.000
#> GSM71688 2 0.0237 0.918 0.004 0.996 0.000
#> GSM71689 3 0.3816 1.000 0.000 0.148 0.852
#> GSM71690 2 0.0237 0.918 0.004 0.996 0.000
#> GSM71691 2 0.0237 0.918 0.004 0.996 0.000
#> GSM71692 3 0.3816 1.000 0.000 0.148 0.852
#> GSM71693 2 0.0237 0.918 0.004 0.996 0.000
#> GSM71694 3 0.3816 1.000 0.000 0.148 0.852
#> GSM71695 2 0.0237 0.918 0.004 0.996 0.000
#> GSM71696 1 0.0000 0.980 1.000 0.000 0.000
#> GSM71697 1 0.0000 0.980 1.000 0.000 0.000
#> GSM71698 1 0.0000 0.980 1.000 0.000 0.000
#> GSM71699 1 0.0000 0.980 1.000 0.000 0.000
#> GSM71700 1 0.0000 0.980 1.000 0.000 0.000
#> GSM71701 1 0.0000 0.980 1.000 0.000 0.000
#> GSM71702 1 0.0000 0.980 1.000 0.000 0.000
#> GSM71703 1 0.0000 0.980 1.000 0.000 0.000
#> GSM71704 1 0.0000 0.980 1.000 0.000 0.000
#> GSM71705 1 0.0000 0.980 1.000 0.000 0.000
#> GSM71706 1 0.0000 0.980 1.000 0.000 0.000
#> GSM71707 1 0.0000 0.980 1.000 0.000 0.000
#> GSM71708 1 0.0000 0.980 1.000 0.000 0.000
#> GSM71709 2 0.3816 0.852 0.000 0.852 0.148
#> GSM71710 1 0.0000 0.980 1.000 0.000 0.000
#> GSM71711 1 0.0000 0.980 1.000 0.000 0.000
#> GSM71712 1 0.4750 0.721 0.784 0.216 0.000
#> GSM71713 1 0.0000 0.980 1.000 0.000 0.000
#> GSM71714 1 0.0000 0.980 1.000 0.000 0.000
#> GSM71715 1 0.0000 0.980 1.000 0.000 0.000
#> GSM71716 1 0.0000 0.980 1.000 0.000 0.000
#> GSM71717 1 0.0000 0.980 1.000 0.000 0.000
#> GSM71718 1 0.0000 0.980 1.000 0.000 0.000
#> GSM71719 1 0.0000 0.980 1.000 0.000 0.000
#> GSM71720 1 0.0000 0.980 1.000 0.000 0.000
#> GSM71721 1 0.0000 0.980 1.000 0.000 0.000
#> GSM71722 1 0.0000 0.980 1.000 0.000 0.000
#> GSM71723 1 0.0000 0.980 1.000 0.000 0.000
#> GSM71724 1 0.0000 0.980 1.000 0.000 0.000
#> GSM71725 1 0.4346 0.769 0.816 0.184 0.000
#> GSM71726 2 0.7717 0.663 0.172 0.680 0.148
#> GSM71727 2 0.3816 0.852 0.000 0.852 0.148
#> GSM71728 2 0.7717 0.663 0.172 0.680 0.148
#> GSM71729 2 0.3816 0.852 0.000 0.852 0.148
#> GSM71730 2 0.3816 0.852 0.000 0.852 0.148
#> GSM71731 1 0.0000 0.980 1.000 0.000 0.000
#> GSM71732 1 0.0000 0.980 1.000 0.000 0.000
#> GSM71733 1 0.0000 0.980 1.000 0.000 0.000
#> GSM71734 1 0.0000 0.980 1.000 0.000 0.000
#> GSM71735 1 0.0000 0.980 1.000 0.000 0.000
#> GSM71736 1 0.0000 0.980 1.000 0.000 0.000
#> GSM71737 1 0.0000 0.980 1.000 0.000 0.000
#> GSM71738 1 0.0000 0.980 1.000 0.000 0.000
#> GSM71739 1 0.5397 0.611 0.720 0.280 0.000
#> GSM71740 1 0.0000 0.980 1.000 0.000 0.000
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> GSM71671 3 0.000 1.000 0.000 0.000 1 0.000
#> GSM71672 3 0.000 1.000 0.000 0.000 1 0.000
#> GSM71673 3 0.000 1.000 0.000 0.000 1 0.000
#> GSM71674 3 0.000 1.000 0.000 0.000 1 0.000
#> GSM71675 3 0.000 1.000 0.000 0.000 1 0.000
#> GSM71676 3 0.000 1.000 0.000 0.000 1 0.000
#> GSM71677 3 0.000 1.000 0.000 0.000 1 0.000
#> GSM71678 2 0.000 0.933 0.000 1.000 0 0.000
#> GSM71679 2 0.000 0.933 0.000 1.000 0 0.000
#> GSM71680 4 0.000 0.717 0.000 0.000 0 1.000
#> GSM71681 2 0.478 0.435 0.000 0.624 0 0.376
#> GSM71682 2 0.000 0.933 0.000 1.000 0 0.000
#> GSM71683 2 0.000 0.933 0.000 1.000 0 0.000
#> GSM71684 2 0.000 0.933 0.000 1.000 0 0.000
#> GSM71685 2 0.478 0.435 0.000 0.624 0 0.376
#> GSM71686 2 0.000 0.933 0.000 1.000 0 0.000
#> GSM71687 2 0.000 0.933 0.000 1.000 0 0.000
#> GSM71688 2 0.000 0.933 0.000 1.000 0 0.000
#> GSM71689 3 0.000 1.000 0.000 0.000 1 0.000
#> GSM71690 2 0.000 0.933 0.000 1.000 0 0.000
#> GSM71691 2 0.000 0.933 0.000 1.000 0 0.000
#> GSM71692 3 0.000 1.000 0.000 0.000 1 0.000
#> GSM71693 2 0.000 0.933 0.000 1.000 0 0.000
#> GSM71694 3 0.000 1.000 0.000 0.000 1 0.000
#> GSM71695 2 0.000 0.933 0.000 1.000 0 0.000
#> GSM71696 1 0.000 0.979 1.000 0.000 0 0.000
#> GSM71697 1 0.000 0.979 1.000 0.000 0 0.000
#> GSM71698 1 0.000 0.979 1.000 0.000 0 0.000
#> GSM71699 1 0.000 0.979 1.000 0.000 0 0.000
#> GSM71700 1 0.000 0.979 1.000 0.000 0 0.000
#> GSM71701 1 0.000 0.979 1.000 0.000 0 0.000
#> GSM71702 1 0.000 0.979 1.000 0.000 0 0.000
#> GSM71703 1 0.000 0.979 1.000 0.000 0 0.000
#> GSM71704 1 0.000 0.979 1.000 0.000 0 0.000
#> GSM71705 1 0.000 0.979 1.000 0.000 0 0.000
#> GSM71706 1 0.000 0.979 1.000 0.000 0 0.000
#> GSM71707 1 0.000 0.979 1.000 0.000 0 0.000
#> GSM71708 1 0.000 0.979 1.000 0.000 0 0.000
#> GSM71709 4 0.000 0.717 0.000 0.000 0 1.000
#> GSM71710 1 0.000 0.979 1.000 0.000 0 0.000
#> GSM71711 1 0.000 0.979 1.000 0.000 0 0.000
#> GSM71712 1 0.442 0.701 0.784 0.184 0 0.032
#> GSM71713 1 0.000 0.979 1.000 0.000 0 0.000
#> GSM71714 1 0.000 0.979 1.000 0.000 0 0.000
#> GSM71715 1 0.000 0.979 1.000 0.000 0 0.000
#> GSM71716 1 0.000 0.979 1.000 0.000 0 0.000
#> GSM71717 1 0.000 0.979 1.000 0.000 0 0.000
#> GSM71718 1 0.000 0.979 1.000 0.000 0 0.000
#> GSM71719 1 0.000 0.979 1.000 0.000 0 0.000
#> GSM71720 1 0.000 0.979 1.000 0.000 0 0.000
#> GSM71721 1 0.000 0.979 1.000 0.000 0 0.000
#> GSM71722 1 0.000 0.979 1.000 0.000 0 0.000
#> GSM71723 1 0.000 0.979 1.000 0.000 0 0.000
#> GSM71724 1 0.000 0.979 1.000 0.000 0 0.000
#> GSM71725 1 0.344 0.745 0.816 0.184 0 0.000
#> GSM71726 4 0.648 0.667 0.172 0.184 0 0.644
#> GSM71727 4 0.407 0.746 0.000 0.252 0 0.748
#> GSM71728 4 0.648 0.667 0.172 0.184 0 0.644
#> GSM71729 4 0.407 0.746 0.000 0.252 0 0.748
#> GSM71730 4 0.407 0.746 0.000 0.252 0 0.748
#> GSM71731 1 0.000 0.979 1.000 0.000 0 0.000
#> GSM71732 1 0.000 0.979 1.000 0.000 0 0.000
#> GSM71733 1 0.000 0.979 1.000 0.000 0 0.000
#> GSM71734 1 0.000 0.979 1.000 0.000 0 0.000
#> GSM71735 1 0.000 0.979 1.000 0.000 0 0.000
#> GSM71736 1 0.000 0.979 1.000 0.000 0 0.000
#> GSM71737 1 0.000 0.979 1.000 0.000 0 0.000
#> GSM71738 1 0.000 0.979 1.000 0.000 0 0.000
#> GSM71739 1 0.428 0.583 0.720 0.280 0 0.000
#> GSM71740 1 0.000 0.979 1.000 0.000 0 0.000
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> GSM71671 3 0.000 1.0000 0.000 0.000 1 0.000 0.000
#> GSM71672 3 0.000 1.0000 0.000 0.000 1 0.000 0.000
#> GSM71673 3 0.000 1.0000 0.000 0.000 1 0.000 0.000
#> GSM71674 3 0.000 1.0000 0.000 0.000 1 0.000 0.000
#> GSM71675 3 0.000 1.0000 0.000 0.000 1 0.000 0.000
#> GSM71676 3 0.000 1.0000 0.000 0.000 1 0.000 0.000
#> GSM71677 3 0.000 1.0000 0.000 0.000 1 0.000 0.000
#> GSM71678 2 0.000 0.9351 0.000 1.000 0 0.000 0.000
#> GSM71679 2 0.000 0.9351 0.000 1.000 0 0.000 0.000
#> GSM71680 4 0.297 0.6632 0.000 0.000 0 0.816 0.184
#> GSM71681 2 0.593 0.4478 0.000 0.596 0 0.192 0.212
#> GSM71682 2 0.000 0.9351 0.000 1.000 0 0.000 0.000
#> GSM71683 2 0.000 0.9351 0.000 1.000 0 0.000 0.000
#> GSM71684 2 0.000 0.9351 0.000 1.000 0 0.000 0.000
#> GSM71685 2 0.593 0.4478 0.000 0.596 0 0.192 0.212
#> GSM71686 2 0.000 0.9351 0.000 1.000 0 0.000 0.000
#> GSM71687 2 0.000 0.9351 0.000 1.000 0 0.000 0.000
#> GSM71688 2 0.000 0.9351 0.000 1.000 0 0.000 0.000
#> GSM71689 3 0.000 1.0000 0.000 0.000 1 0.000 0.000
#> GSM71690 2 0.000 0.9351 0.000 1.000 0 0.000 0.000
#> GSM71691 2 0.000 0.9351 0.000 1.000 0 0.000 0.000
#> GSM71692 3 0.000 1.0000 0.000 0.000 1 0.000 0.000
#> GSM71693 2 0.000 0.9351 0.000 1.000 0 0.000 0.000
#> GSM71694 3 0.000 1.0000 0.000 0.000 1 0.000 0.000
#> GSM71695 2 0.000 0.9351 0.000 1.000 0 0.000 0.000
#> GSM71696 1 0.148 0.8943 0.936 0.000 0 0.000 0.064
#> GSM71697 1 0.000 0.9672 1.000 0.000 0 0.000 0.000
#> GSM71698 1 0.000 0.9672 1.000 0.000 0 0.000 0.000
#> GSM71699 1 0.000 0.9672 1.000 0.000 0 0.000 0.000
#> GSM71700 1 0.000 0.9672 1.000 0.000 0 0.000 0.000
#> GSM71701 1 0.000 0.9672 1.000 0.000 0 0.000 0.000
#> GSM71702 1 0.000 0.9672 1.000 0.000 0 0.000 0.000
#> GSM71703 1 0.000 0.9672 1.000 0.000 0 0.000 0.000
#> GSM71704 1 0.000 0.9672 1.000 0.000 0 0.000 0.000
#> GSM71705 1 0.000 0.9672 1.000 0.000 0 0.000 0.000
#> GSM71706 1 0.000 0.9672 1.000 0.000 0 0.000 0.000
#> GSM71707 1 0.000 0.9672 1.000 0.000 0 0.000 0.000
#> GSM71708 1 0.000 0.9672 1.000 0.000 0 0.000 0.000
#> GSM71709 4 0.297 0.6632 0.000 0.000 0 0.816 0.184
#> GSM71710 1 0.000 0.9672 1.000 0.000 0 0.000 0.000
#> GSM71711 1 0.000 0.9672 1.000 0.000 0 0.000 0.000
#> GSM71712 5 0.490 0.9178 0.184 0.000 0 0.104 0.712
#> GSM71713 1 0.423 -0.0633 0.580 0.000 0 0.000 0.420
#> GSM71714 1 0.000 0.9672 1.000 0.000 0 0.000 0.000
#> GSM71715 1 0.167 0.8797 0.924 0.000 0 0.000 0.076
#> GSM71716 1 0.000 0.9672 1.000 0.000 0 0.000 0.000
#> GSM71717 1 0.000 0.9672 1.000 0.000 0 0.000 0.000
#> GSM71718 1 0.000 0.9672 1.000 0.000 0 0.000 0.000
#> GSM71719 1 0.000 0.9672 1.000 0.000 0 0.000 0.000
#> GSM71720 1 0.000 0.9672 1.000 0.000 0 0.000 0.000
#> GSM71721 1 0.000 0.9672 1.000 0.000 0 0.000 0.000
#> GSM71722 1 0.000 0.9672 1.000 0.000 0 0.000 0.000
#> GSM71723 1 0.000 0.9672 1.000 0.000 0 0.000 0.000
#> GSM71724 1 0.000 0.9672 1.000 0.000 0 0.000 0.000
#> GSM71725 5 0.515 0.9212 0.216 0.000 0 0.104 0.680
#> GSM71726 4 0.371 0.5900 0.000 0.000 0 0.716 0.284
#> GSM71727 4 0.260 0.7519 0.000 0.148 0 0.852 0.000
#> GSM71728 4 0.371 0.5900 0.000 0.000 0 0.716 0.284
#> GSM71729 4 0.260 0.7519 0.000 0.148 0 0.852 0.000
#> GSM71730 4 0.260 0.7519 0.000 0.148 0 0.852 0.000
#> GSM71731 1 0.000 0.9672 1.000 0.000 0 0.000 0.000
#> GSM71732 1 0.000 0.9672 1.000 0.000 0 0.000 0.000
#> GSM71733 1 0.000 0.9672 1.000 0.000 0 0.000 0.000
#> GSM71734 1 0.000 0.9672 1.000 0.000 0 0.000 0.000
#> GSM71735 1 0.000 0.9672 1.000 0.000 0 0.000 0.000
#> GSM71736 1 0.000 0.9672 1.000 0.000 0 0.000 0.000
#> GSM71737 1 0.000 0.9672 1.000 0.000 0 0.000 0.000
#> GSM71738 1 0.000 0.9672 1.000 0.000 0 0.000 0.000
#> GSM71739 1 0.634 0.2734 0.636 0.200 0 0.080 0.084
#> GSM71740 1 0.000 0.9672 1.000 0.000 0 0.000 0.000
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> GSM71671 3 0.0000 0.9930 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM71672 3 0.0000 0.9930 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM71673 3 0.0000 0.9930 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM71674 3 0.0000 0.9930 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM71675 3 0.0000 0.9930 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM71676 3 0.0000 0.9930 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM71677 3 0.0000 0.9930 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM71678 2 0.0000 0.9934 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM71679 2 0.0000 0.9934 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM71680 6 0.3620 -0.0439 0.000 0.000 0.000 0.352 0.000 0.648
#> GSM71681 6 0.4939 0.3007 0.000 0.472 0.000 0.020 0.028 0.480
#> GSM71682 2 0.0000 0.9934 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM71683 2 0.0000 0.9934 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM71684 2 0.0000 0.9934 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM71685 6 0.4939 0.3007 0.000 0.472 0.000 0.020 0.028 0.480
#> GSM71686 2 0.0000 0.9934 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM71687 2 0.0000 0.9934 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM71688 2 0.0000 0.9934 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM71689 3 0.0632 0.9834 0.000 0.000 0.976 0.000 0.000 0.024
#> GSM71690 2 0.0000 0.9934 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM71691 2 0.0820 0.9664 0.000 0.972 0.000 0.000 0.016 0.012
#> GSM71692 3 0.0632 0.9834 0.000 0.000 0.976 0.000 0.000 0.024
#> GSM71693 2 0.0000 0.9934 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM71694 3 0.0632 0.9834 0.000 0.000 0.976 0.000 0.000 0.024
#> GSM71695 2 0.0820 0.9664 0.000 0.972 0.000 0.000 0.016 0.012
#> GSM71696 1 0.1556 0.8982 0.920 0.000 0.000 0.000 0.080 0.000
#> GSM71697 1 0.0000 0.9782 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM71698 1 0.0000 0.9782 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM71699 1 0.0000 0.9782 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM71700 1 0.0000 0.9782 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM71701 1 0.0000 0.9782 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM71702 1 0.0000 0.9782 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM71703 1 0.0000 0.9782 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM71704 1 0.0000 0.9782 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM71705 1 0.0000 0.9782 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM71706 1 0.0000 0.9782 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM71707 1 0.0000 0.9782 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM71708 1 0.0000 0.9782 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM71709 6 0.3620 -0.0439 0.000 0.000 0.000 0.352 0.000 0.648
#> GSM71710 1 0.0363 0.9714 0.988 0.000 0.000 0.000 0.012 0.000
#> GSM71711 1 0.0146 0.9767 0.996 0.000 0.000 0.000 0.004 0.000
#> GSM71712 5 0.4873 0.6298 0.100 0.000 0.000 0.268 0.632 0.000
#> GSM71713 5 0.5635 0.4761 0.256 0.000 0.000 0.000 0.536 0.208
#> GSM71714 1 0.0000 0.9782 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM71715 1 0.1814 0.8746 0.900 0.000 0.000 0.000 0.100 0.000
#> GSM71716 1 0.0547 0.9647 0.980 0.000 0.000 0.000 0.020 0.000
#> GSM71717 1 0.0458 0.9665 0.984 0.000 0.000 0.000 0.016 0.000
#> GSM71718 1 0.0146 0.9767 0.996 0.000 0.000 0.000 0.004 0.000
#> GSM71719 1 0.0146 0.9767 0.996 0.000 0.000 0.000 0.004 0.000
#> GSM71720 1 0.0146 0.9767 0.996 0.000 0.000 0.000 0.004 0.000
#> GSM71721 1 0.0000 0.9782 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM71722 1 0.0146 0.9767 0.996 0.000 0.000 0.000 0.004 0.000
#> GSM71723 1 0.0146 0.9767 0.996 0.000 0.000 0.000 0.004 0.000
#> GSM71724 1 0.0000 0.9782 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM71725 5 0.4849 0.6517 0.112 0.000 0.000 0.240 0.648 0.000
#> GSM71726 4 0.2003 0.6690 0.000 0.000 0.000 0.884 0.116 0.000
#> GSM71727 4 0.3422 0.7536 0.000 0.040 0.000 0.792 0.000 0.168
#> GSM71728 4 0.2003 0.6690 0.000 0.000 0.000 0.884 0.116 0.000
#> GSM71729 4 0.3422 0.7536 0.000 0.040 0.000 0.792 0.000 0.168
#> GSM71730 4 0.3422 0.7536 0.000 0.040 0.000 0.792 0.000 0.168
#> GSM71731 1 0.0146 0.9767 0.996 0.000 0.000 0.000 0.004 0.000
#> GSM71732 1 0.0000 0.9782 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM71733 1 0.0000 0.9782 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM71734 1 0.0000 0.9782 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM71735 1 0.0000 0.9782 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM71736 1 0.0000 0.9782 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM71737 1 0.0458 0.9665 0.984 0.000 0.000 0.000 0.016 0.000
#> GSM71738 1 0.0000 0.9782 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM71739 1 0.6060 0.2955 0.612 0.108 0.000 0.168 0.112 0.000
#> GSM71740 1 0.0146 0.9767 0.996 0.000 0.000 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) k
#> SD:hclust 70 1.71e-11 2
#> SD:hclust 70 4.47e-18 3
#> SD:hclust 68 1.09e-19 4
#> SD:hclust 66 7.92e-18 5
#> SD:hclust 64 4.60e-18 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 21168 rows and 70 columns.
#> Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'SD' method.
#> Subgroups are detected by 'kmeans' method.
#> Performed in total 1250 partitions by row resampling.
#> Best k for subgroups seems to be 2.
#>
#> Following methods can be applied to this 'ConsensusPartition' object:
#> [1] "cola_report" "collect_classes" "collect_plots"
#> [4] "collect_stats" "colnames" "compare_signatures"
#> [7] "consensus_heatmap" "dimension_reduction" "functional_enrichment"
#> [10] "get_anno_col" "get_anno" "get_classes"
#> [13] "get_consensus" "get_matrix" "get_membership"
#> [16] "get_param" "get_signatures" "get_stats"
#> [19] "is_best_k" "is_stable_k" "membership_heatmap"
#> [22] "ncol" "nrow" "plot_ecdf"
#> [25] "rownames" "select_partition_number" "show"
#> [28] "suggest_best_k" "test_to_known_factors"
collect_plots()
function collects all the plots made from res
for all k
(number of partitions)
into one single page to provide an easy and fast comparison between different k
.
collect_plots(res)
The plots are:
k
and the heatmap of
predicted classes for each k
.k
.k
.k
.All the plots in panels can be made by individual functions and they are plotted later in this section.
select_partition_number()
produces several plots showing different
statistics for choosing “optimized” k
. There are following statistics:
k
;k
, the area increased is defined as \(A_k - A_{k-1}\).The detailed explanations of these statistics can be found in the cola vignette.
Generally speaking, lower PAC score, higher mean silhouette score or higher
concordance corresponds to better partition. Rand index and Jaccard index
measure how similar the current partition is compared to partition with k-1
.
If they are too similar, we won't accept k
is better than k-1
.
select_partition_number(res)
The numeric values for all these statistics can be obtained by get_stats()
.
get_stats(res)
#> k 1-PAC mean_silhouette concordance area_increased Rand Jaccard
#> 2 2 1.000 0.990 0.987 0.4814 0.508 0.508
#> 3 3 0.718 0.890 0.885 0.2406 0.873 0.758
#> 4 4 0.698 0.670 0.807 0.1424 0.984 0.962
#> 5 5 0.758 0.853 0.840 0.1017 0.812 0.531
#> 6 6 0.698 0.788 0.826 0.0565 0.964 0.839
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
#> GSM71671 2 0.000 0.967 0.000 1.000
#> GSM71672 2 0.000 0.967 0.000 1.000
#> GSM71673 2 0.000 0.967 0.000 1.000
#> GSM71674 2 0.000 0.967 0.000 1.000
#> GSM71675 2 0.000 0.967 0.000 1.000
#> GSM71676 2 0.000 0.967 0.000 1.000
#> GSM71677 2 0.000 0.967 0.000 1.000
#> GSM71678 2 0.278 0.982 0.048 0.952
#> GSM71679 2 0.278 0.982 0.048 0.952
#> GSM71680 2 0.278 0.982 0.048 0.952
#> GSM71681 2 0.278 0.982 0.048 0.952
#> GSM71682 2 0.278 0.982 0.048 0.952
#> GSM71683 2 0.278 0.982 0.048 0.952
#> GSM71684 2 0.278 0.982 0.048 0.952
#> GSM71685 2 0.278 0.982 0.048 0.952
#> GSM71686 2 0.278 0.982 0.048 0.952
#> GSM71687 2 0.278 0.982 0.048 0.952
#> GSM71688 2 0.278 0.982 0.048 0.952
#> GSM71689 2 0.000 0.967 0.000 1.000
#> GSM71690 2 0.278 0.982 0.048 0.952
#> GSM71691 2 0.278 0.982 0.048 0.952
#> GSM71692 2 0.000 0.967 0.000 1.000
#> GSM71693 2 0.278 0.982 0.048 0.952
#> GSM71694 2 0.000 0.967 0.000 1.000
#> GSM71695 2 0.278 0.982 0.048 0.952
#> GSM71696 1 0.000 1.000 1.000 0.000
#> GSM71697 1 0.000 1.000 1.000 0.000
#> GSM71698 1 0.000 1.000 1.000 0.000
#> GSM71699 1 0.000 1.000 1.000 0.000
#> GSM71700 1 0.000 1.000 1.000 0.000
#> GSM71701 1 0.000 1.000 1.000 0.000
#> GSM71702 1 0.000 1.000 1.000 0.000
#> GSM71703 1 0.000 1.000 1.000 0.000
#> GSM71704 1 0.000 1.000 1.000 0.000
#> GSM71705 1 0.000 1.000 1.000 0.000
#> GSM71706 1 0.000 1.000 1.000 0.000
#> GSM71707 1 0.000 1.000 1.000 0.000
#> GSM71708 1 0.000 1.000 1.000 0.000
#> GSM71709 2 0.278 0.982 0.048 0.952
#> GSM71710 1 0.000 1.000 1.000 0.000
#> GSM71711 1 0.000 1.000 1.000 0.000
#> GSM71712 1 0.000 1.000 1.000 0.000
#> GSM71713 1 0.000 1.000 1.000 0.000
#> GSM71714 1 0.000 1.000 1.000 0.000
#> GSM71715 1 0.000 1.000 1.000 0.000
#> GSM71716 1 0.000 1.000 1.000 0.000
#> GSM71717 1 0.000 1.000 1.000 0.000
#> GSM71718 1 0.000 1.000 1.000 0.000
#> GSM71719 1 0.000 1.000 1.000 0.000
#> GSM71720 1 0.000 1.000 1.000 0.000
#> GSM71721 1 0.000 1.000 1.000 0.000
#> GSM71722 1 0.000 1.000 1.000 0.000
#> GSM71723 1 0.000 1.000 1.000 0.000
#> GSM71724 1 0.000 1.000 1.000 0.000
#> GSM71725 1 0.000 1.000 1.000 0.000
#> GSM71726 1 0.118 0.983 0.984 0.016
#> GSM71727 2 0.278 0.982 0.048 0.952
#> GSM71728 1 0.000 1.000 1.000 0.000
#> GSM71729 2 0.278 0.982 0.048 0.952
#> GSM71730 2 0.278 0.982 0.048 0.952
#> GSM71731 1 0.000 1.000 1.000 0.000
#> GSM71732 1 0.000 1.000 1.000 0.000
#> GSM71733 1 0.000 1.000 1.000 0.000
#> GSM71734 1 0.000 1.000 1.000 0.000
#> GSM71735 1 0.000 1.000 1.000 0.000
#> GSM71736 1 0.000 1.000 1.000 0.000
#> GSM71737 1 0.000 1.000 1.000 0.000
#> GSM71738 1 0.000 1.000 1.000 0.000
#> GSM71739 1 0.000 1.000 1.000 0.000
#> GSM71740 1 0.000 1.000 1.000 0.000
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> GSM71671 3 0.6062 1.000 0.000 0.384 0.616
#> GSM71672 3 0.6062 1.000 0.000 0.384 0.616
#> GSM71673 3 0.6062 1.000 0.000 0.384 0.616
#> GSM71674 3 0.6062 1.000 0.000 0.384 0.616
#> GSM71675 3 0.6062 1.000 0.000 0.384 0.616
#> GSM71676 3 0.6062 1.000 0.000 0.384 0.616
#> GSM71677 3 0.6062 1.000 0.000 0.384 0.616
#> GSM71678 2 0.0000 0.826 0.000 1.000 0.000
#> GSM71679 2 0.0000 0.826 0.000 1.000 0.000
#> GSM71680 2 0.4842 0.754 0.000 0.776 0.224
#> GSM71681 2 0.0000 0.826 0.000 1.000 0.000
#> GSM71682 2 0.0000 0.826 0.000 1.000 0.000
#> GSM71683 2 0.0000 0.826 0.000 1.000 0.000
#> GSM71684 2 0.4291 0.772 0.000 0.820 0.180
#> GSM71685 2 0.1753 0.815 0.000 0.952 0.048
#> GSM71686 2 0.0000 0.826 0.000 1.000 0.000
#> GSM71687 2 0.0000 0.826 0.000 1.000 0.000
#> GSM71688 2 0.0000 0.826 0.000 1.000 0.000
#> GSM71689 3 0.6062 1.000 0.000 0.384 0.616
#> GSM71690 2 0.0000 0.826 0.000 1.000 0.000
#> GSM71691 2 0.0000 0.826 0.000 1.000 0.000
#> GSM71692 3 0.6062 1.000 0.000 0.384 0.616
#> GSM71693 2 0.0000 0.826 0.000 1.000 0.000
#> GSM71694 3 0.6062 1.000 0.000 0.384 0.616
#> GSM71695 2 0.0000 0.826 0.000 1.000 0.000
#> GSM71696 1 0.0592 0.930 0.988 0.000 0.012
#> GSM71697 1 0.0000 0.932 1.000 0.000 0.000
#> GSM71698 1 0.4002 0.916 0.840 0.000 0.160
#> GSM71699 1 0.3816 0.919 0.852 0.000 0.148
#> GSM71700 1 0.0592 0.933 0.988 0.000 0.012
#> GSM71701 1 0.4002 0.916 0.840 0.000 0.160
#> GSM71702 1 0.3816 0.919 0.852 0.000 0.148
#> GSM71703 1 0.3816 0.919 0.852 0.000 0.148
#> GSM71704 1 0.3816 0.919 0.852 0.000 0.148
#> GSM71705 1 0.4002 0.916 0.840 0.000 0.160
#> GSM71706 1 0.3816 0.919 0.852 0.000 0.148
#> GSM71707 1 0.4002 0.916 0.840 0.000 0.160
#> GSM71708 1 0.3816 0.919 0.852 0.000 0.148
#> GSM71709 2 0.4842 0.754 0.000 0.776 0.224
#> GSM71710 1 0.1289 0.933 0.968 0.000 0.032
#> GSM71711 1 0.0000 0.932 1.000 0.000 0.000
#> GSM71712 1 0.1753 0.904 0.952 0.000 0.048
#> GSM71713 1 0.3816 0.919 0.852 0.000 0.148
#> GSM71714 1 0.0000 0.932 1.000 0.000 0.000
#> GSM71715 1 0.0000 0.932 1.000 0.000 0.000
#> GSM71716 1 0.0000 0.932 1.000 0.000 0.000
#> GSM71717 1 0.1289 0.933 0.968 0.000 0.032
#> GSM71718 1 0.0592 0.930 0.988 0.000 0.012
#> GSM71719 1 0.0000 0.932 1.000 0.000 0.000
#> GSM71720 1 0.0000 0.932 1.000 0.000 0.000
#> GSM71721 1 0.0592 0.930 0.988 0.000 0.012
#> GSM71722 1 0.0592 0.930 0.988 0.000 0.012
#> GSM71723 1 0.0000 0.932 1.000 0.000 0.000
#> GSM71724 1 0.3816 0.919 0.852 0.000 0.148
#> GSM71725 1 0.0000 0.932 1.000 0.000 0.000
#> GSM71726 2 0.8623 0.555 0.176 0.600 0.224
#> GSM71727 2 0.4842 0.754 0.000 0.776 0.224
#> GSM71728 2 0.9181 0.477 0.236 0.540 0.224
#> GSM71729 2 0.4842 0.754 0.000 0.776 0.224
#> GSM71730 2 0.4842 0.754 0.000 0.776 0.224
#> GSM71731 1 0.0000 0.932 1.000 0.000 0.000
#> GSM71732 1 0.0592 0.930 0.988 0.000 0.012
#> GSM71733 1 0.0000 0.932 1.000 0.000 0.000
#> GSM71734 1 0.4002 0.916 0.840 0.000 0.160
#> GSM71735 1 0.3816 0.919 0.852 0.000 0.148
#> GSM71736 1 0.3941 0.917 0.844 0.000 0.156
#> GSM71737 1 0.3816 0.919 0.852 0.000 0.148
#> GSM71738 1 0.3816 0.919 0.852 0.000 0.148
#> GSM71739 1 0.2165 0.886 0.936 0.064 0.000
#> GSM71740 1 0.0000 0.932 1.000 0.000 0.000
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> GSM71671 3 0.0188 0.992 0.000 0.004 0.996 0.000
#> GSM71672 3 0.0188 0.992 0.000 0.004 0.996 0.000
#> GSM71673 3 0.0188 0.992 0.000 0.004 0.996 0.000
#> GSM71674 3 0.0188 0.992 0.000 0.004 0.996 0.000
#> GSM71675 3 0.0188 0.992 0.000 0.004 0.996 0.000
#> GSM71676 3 0.0188 0.992 0.000 0.004 0.996 0.000
#> GSM71677 3 0.0188 0.992 0.000 0.004 0.996 0.000
#> GSM71678 2 0.2888 0.754 0.000 0.872 0.124 0.004
#> GSM71679 2 0.2888 0.754 0.000 0.872 0.124 0.004
#> GSM71680 2 0.4996 -0.434 0.000 0.516 0.000 0.484
#> GSM71681 2 0.2704 0.755 0.000 0.876 0.124 0.000
#> GSM71682 2 0.2888 0.754 0.000 0.872 0.124 0.004
#> GSM71683 2 0.2704 0.755 0.000 0.876 0.124 0.000
#> GSM71684 2 0.0592 0.650 0.000 0.984 0.016 0.000
#> GSM71685 2 0.3164 0.662 0.000 0.884 0.064 0.052
#> GSM71686 2 0.2888 0.754 0.000 0.872 0.124 0.004
#> GSM71687 2 0.2704 0.755 0.000 0.876 0.124 0.000
#> GSM71688 2 0.2704 0.755 0.000 0.876 0.124 0.000
#> GSM71689 3 0.1209 0.980 0.000 0.004 0.964 0.032
#> GSM71690 2 0.2704 0.755 0.000 0.876 0.124 0.000
#> GSM71691 2 0.2704 0.755 0.000 0.876 0.124 0.000
#> GSM71692 3 0.1209 0.980 0.000 0.004 0.964 0.032
#> GSM71693 2 0.2704 0.755 0.000 0.876 0.124 0.000
#> GSM71694 3 0.1209 0.980 0.000 0.004 0.964 0.032
#> GSM71695 2 0.2704 0.755 0.000 0.876 0.124 0.000
#> GSM71696 1 0.0657 0.752 0.984 0.000 0.004 0.012
#> GSM71697 1 0.0188 0.753 0.996 0.000 0.000 0.004
#> GSM71698 1 0.5080 0.707 0.576 0.000 0.004 0.420
#> GSM71699 1 0.4830 0.718 0.608 0.000 0.000 0.392
#> GSM71700 1 0.0592 0.756 0.984 0.000 0.000 0.016
#> GSM71701 1 0.5070 0.709 0.580 0.000 0.004 0.416
#> GSM71702 1 0.4790 0.720 0.620 0.000 0.000 0.380
#> GSM71703 1 0.4830 0.718 0.608 0.000 0.000 0.392
#> GSM71704 1 0.4830 0.718 0.608 0.000 0.000 0.392
#> GSM71705 1 0.4950 0.723 0.620 0.000 0.004 0.376
#> GSM71706 1 0.4830 0.718 0.608 0.000 0.000 0.392
#> GSM71707 1 0.5004 0.717 0.604 0.000 0.004 0.392
#> GSM71708 1 0.4830 0.718 0.608 0.000 0.000 0.392
#> GSM71709 2 0.4996 -0.434 0.000 0.516 0.000 0.484
#> GSM71710 1 0.1902 0.757 0.932 0.000 0.004 0.064
#> GSM71711 1 0.0592 0.753 0.984 0.000 0.000 0.016
#> GSM71712 1 0.4781 0.229 0.660 0.004 0.000 0.336
#> GSM71713 1 0.4925 0.705 0.572 0.000 0.000 0.428
#> GSM71714 1 0.0000 0.752 1.000 0.000 0.000 0.000
#> GSM71715 1 0.0469 0.752 0.988 0.000 0.000 0.012
#> GSM71716 1 0.0469 0.752 0.988 0.000 0.000 0.012
#> GSM71717 1 0.1716 0.757 0.936 0.000 0.000 0.064
#> GSM71718 1 0.2334 0.711 0.908 0.000 0.004 0.088
#> GSM71719 1 0.1474 0.725 0.948 0.000 0.000 0.052
#> GSM71720 1 0.2081 0.712 0.916 0.000 0.000 0.084
#> GSM71721 1 0.2334 0.711 0.908 0.000 0.004 0.088
#> GSM71722 1 0.1489 0.740 0.952 0.000 0.004 0.044
#> GSM71723 1 0.0000 0.752 1.000 0.000 0.000 0.000
#> GSM71724 1 0.4964 0.720 0.616 0.000 0.004 0.380
#> GSM71725 1 0.2216 0.707 0.908 0.000 0.000 0.092
#> GSM71726 4 0.6170 0.415 0.052 0.420 0.000 0.528
#> GSM71727 2 0.4996 -0.434 0.000 0.516 0.000 0.484
#> GSM71728 4 0.7310 0.581 0.256 0.212 0.000 0.532
#> GSM71729 2 0.4998 -0.440 0.000 0.512 0.000 0.488
#> GSM71730 2 0.4996 -0.434 0.000 0.516 0.000 0.484
#> GSM71731 1 0.0000 0.752 1.000 0.000 0.000 0.000
#> GSM71732 1 0.1489 0.740 0.952 0.000 0.004 0.044
#> GSM71733 1 0.0000 0.752 1.000 0.000 0.000 0.000
#> GSM71734 1 0.5016 0.716 0.600 0.000 0.004 0.396
#> GSM71735 1 0.4817 0.719 0.612 0.000 0.000 0.388
#> GSM71736 1 0.4830 0.718 0.608 0.000 0.000 0.392
#> GSM71737 1 0.4817 0.719 0.612 0.000 0.000 0.388
#> GSM71738 1 0.4817 0.719 0.612 0.000 0.000 0.388
#> GSM71739 1 0.4534 0.553 0.800 0.132 0.000 0.068
#> GSM71740 1 0.0469 0.752 0.988 0.000 0.000 0.012
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> GSM71671 3 0.1430 0.9706 0.000 0.052 0.944 0.004 0.000
#> GSM71672 3 0.1670 0.9682 0.012 0.052 0.936 0.000 0.000
#> GSM71673 3 0.1670 0.9682 0.012 0.052 0.936 0.000 0.000
#> GSM71674 3 0.1430 0.9706 0.000 0.052 0.944 0.004 0.000
#> GSM71675 3 0.1270 0.9705 0.000 0.052 0.948 0.000 0.000
#> GSM71676 3 0.1430 0.9706 0.000 0.052 0.944 0.004 0.000
#> GSM71677 3 0.1270 0.9705 0.000 0.052 0.948 0.000 0.000
#> GSM71678 2 0.0000 0.9634 0.000 1.000 0.000 0.000 0.000
#> GSM71679 2 0.0000 0.9634 0.000 1.000 0.000 0.000 0.000
#> GSM71680 4 0.1121 0.9595 0.000 0.044 0.000 0.956 0.000
#> GSM71681 2 0.1430 0.9232 0.004 0.944 0.000 0.052 0.000
#> GSM71682 2 0.0000 0.9634 0.000 1.000 0.000 0.000 0.000
#> GSM71683 2 0.0162 0.9634 0.004 0.996 0.000 0.000 0.000
#> GSM71684 2 0.1043 0.9273 0.000 0.960 0.000 0.040 0.000
#> GSM71685 2 0.4047 0.5278 0.004 0.676 0.000 0.320 0.000
#> GSM71686 2 0.0000 0.9634 0.000 1.000 0.000 0.000 0.000
#> GSM71687 2 0.0162 0.9634 0.004 0.996 0.000 0.000 0.000
#> GSM71688 2 0.0162 0.9634 0.004 0.996 0.000 0.000 0.000
#> GSM71689 3 0.3528 0.9366 0.084 0.052 0.848 0.016 0.000
#> GSM71690 2 0.0000 0.9634 0.000 1.000 0.000 0.000 0.000
#> GSM71691 2 0.0404 0.9605 0.012 0.988 0.000 0.000 0.000
#> GSM71692 3 0.3528 0.9366 0.084 0.052 0.848 0.016 0.000
#> GSM71693 2 0.0162 0.9634 0.004 0.996 0.000 0.000 0.000
#> GSM71694 3 0.3695 0.9337 0.096 0.052 0.836 0.016 0.000
#> GSM71695 2 0.0404 0.9605 0.012 0.988 0.000 0.000 0.000
#> GSM71696 5 0.4497 0.8207 0.248 0.000 0.028 0.008 0.716
#> GSM71697 5 0.3661 0.8245 0.276 0.000 0.000 0.000 0.724
#> GSM71698 1 0.4695 0.7394 0.672 0.000 0.024 0.008 0.296
#> GSM71699 1 0.2389 0.8755 0.880 0.000 0.000 0.004 0.116
#> GSM71700 5 0.3661 0.8245 0.276 0.000 0.000 0.000 0.724
#> GSM71701 1 0.4332 0.7993 0.732 0.000 0.024 0.008 0.236
#> GSM71702 1 0.2763 0.8727 0.848 0.000 0.000 0.004 0.148
#> GSM71703 1 0.2389 0.8755 0.880 0.000 0.000 0.004 0.116
#> GSM71704 1 0.2439 0.8760 0.876 0.000 0.000 0.004 0.120
#> GSM71705 1 0.4430 0.8007 0.708 0.000 0.020 0.008 0.264
#> GSM71706 1 0.2583 0.8750 0.864 0.000 0.000 0.004 0.132
#> GSM71707 1 0.4128 0.8382 0.752 0.000 0.020 0.008 0.220
#> GSM71708 1 0.2583 0.8750 0.864 0.000 0.000 0.004 0.132
#> GSM71709 4 0.1121 0.9595 0.000 0.044 0.000 0.956 0.000
#> GSM71710 5 0.4252 0.7767 0.340 0.000 0.000 0.008 0.652
#> GSM71711 5 0.3895 0.8021 0.320 0.000 0.000 0.000 0.680
#> GSM71712 5 0.5041 -0.0159 0.016 0.000 0.024 0.328 0.632
#> GSM71713 1 0.4814 0.6042 0.568 0.000 0.016 0.004 0.412
#> GSM71714 5 0.3612 0.8246 0.268 0.000 0.000 0.000 0.732
#> GSM71715 5 0.4513 0.8103 0.284 0.000 0.024 0.004 0.688
#> GSM71716 5 0.3969 0.8037 0.304 0.000 0.000 0.004 0.692
#> GSM71717 5 0.4151 0.7582 0.344 0.000 0.000 0.004 0.652
#> GSM71718 5 0.3451 0.7552 0.128 0.000 0.024 0.012 0.836
#> GSM71719 5 0.3519 0.8193 0.216 0.000 0.000 0.008 0.776
#> GSM71720 5 0.2753 0.7809 0.136 0.000 0.000 0.008 0.856
#> GSM71721 5 0.3599 0.7495 0.132 0.000 0.024 0.016 0.828
#> GSM71722 5 0.3648 0.7712 0.156 0.000 0.024 0.008 0.812
#> GSM71723 5 0.3534 0.8271 0.256 0.000 0.000 0.000 0.744
#> GSM71724 1 0.3548 0.8588 0.796 0.000 0.012 0.004 0.188
#> GSM71725 5 0.1299 0.6264 0.008 0.000 0.020 0.012 0.960
#> GSM71726 4 0.2729 0.9150 0.000 0.028 0.004 0.884 0.084
#> GSM71727 4 0.1121 0.9595 0.000 0.044 0.000 0.956 0.000
#> GSM71728 4 0.3365 0.8459 0.000 0.008 0.004 0.808 0.180
#> GSM71729 4 0.1121 0.9595 0.000 0.044 0.000 0.956 0.000
#> GSM71730 4 0.1121 0.9595 0.000 0.044 0.000 0.956 0.000
#> GSM71731 5 0.3508 0.8277 0.252 0.000 0.000 0.000 0.748
#> GSM71732 5 0.3648 0.7712 0.156 0.000 0.024 0.008 0.812
#> GSM71733 5 0.3561 0.8261 0.260 0.000 0.000 0.000 0.740
#> GSM71734 1 0.4245 0.8357 0.736 0.000 0.020 0.008 0.236
#> GSM71735 1 0.2813 0.8593 0.832 0.000 0.000 0.000 0.168
#> GSM71736 1 0.2516 0.8752 0.860 0.000 0.000 0.000 0.140
#> GSM71737 1 0.3266 0.8143 0.796 0.000 0.000 0.004 0.200
#> GSM71738 1 0.2806 0.8706 0.844 0.000 0.000 0.004 0.152
#> GSM71739 5 0.5685 0.6595 0.104 0.156 0.024 0.012 0.704
#> GSM71740 5 0.3774 0.8114 0.296 0.000 0.000 0.000 0.704
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> GSM71671 3 0.0458 0.9603 0.000 0.016 0.984 0.000 0.000 0.000
#> GSM71672 3 0.0748 0.9594 0.000 0.016 0.976 0.000 0.004 0.004
#> GSM71673 3 0.0748 0.9594 0.000 0.016 0.976 0.000 0.004 0.004
#> GSM71674 3 0.0458 0.9603 0.000 0.016 0.984 0.000 0.000 0.000
#> GSM71675 3 0.0748 0.9594 0.000 0.016 0.976 0.000 0.004 0.004
#> GSM71676 3 0.0458 0.9603 0.000 0.016 0.984 0.000 0.000 0.000
#> GSM71677 3 0.0458 0.9603 0.000 0.016 0.984 0.000 0.000 0.000
#> GSM71678 2 0.0777 0.9577 0.000 0.972 0.000 0.000 0.004 0.024
#> GSM71679 2 0.0777 0.9577 0.000 0.972 0.000 0.000 0.004 0.024
#> GSM71680 4 0.0767 0.8326 0.000 0.008 0.004 0.976 0.000 0.012
#> GSM71681 2 0.3844 0.7268 0.000 0.772 0.004 0.180 0.008 0.036
#> GSM71682 2 0.0777 0.9577 0.000 0.972 0.000 0.000 0.004 0.024
#> GSM71683 2 0.0363 0.9580 0.000 0.988 0.000 0.000 0.012 0.000
#> GSM71684 2 0.0508 0.9552 0.000 0.984 0.000 0.012 0.000 0.004
#> GSM71685 4 0.4255 0.4220 0.000 0.336 0.004 0.640 0.004 0.016
#> GSM71686 2 0.0777 0.9577 0.000 0.972 0.000 0.000 0.004 0.024
#> GSM71687 2 0.0458 0.9575 0.000 0.984 0.000 0.000 0.016 0.000
#> GSM71688 2 0.0363 0.9580 0.000 0.988 0.000 0.000 0.012 0.000
#> GSM71689 3 0.3206 0.9085 0.000 0.016 0.856 0.008 0.052 0.068
#> GSM71690 2 0.0692 0.9575 0.000 0.976 0.000 0.000 0.004 0.020
#> GSM71691 2 0.1480 0.9371 0.000 0.940 0.000 0.000 0.040 0.020
#> GSM71692 3 0.3206 0.9085 0.000 0.016 0.856 0.008 0.052 0.068
#> GSM71693 2 0.0363 0.9580 0.000 0.988 0.000 0.000 0.012 0.000
#> GSM71694 3 0.3323 0.9076 0.000 0.016 0.848 0.008 0.056 0.072
#> GSM71695 2 0.1480 0.9371 0.000 0.940 0.000 0.000 0.040 0.020
#> GSM71696 1 0.3579 0.7873 0.808 0.000 0.008 0.000 0.064 0.120
#> GSM71697 1 0.0713 0.8250 0.972 0.000 0.000 0.000 0.000 0.028
#> GSM71698 6 0.5703 0.6281 0.188 0.000 0.004 0.000 0.268 0.540
#> GSM71699 6 0.4061 0.7995 0.248 0.000 0.000 0.000 0.044 0.708
#> GSM71700 1 0.0713 0.8250 0.972 0.000 0.000 0.000 0.000 0.028
#> GSM71701 6 0.5470 0.6582 0.160 0.000 0.004 0.000 0.256 0.580
#> GSM71702 6 0.4368 0.7888 0.296 0.000 0.000 0.000 0.048 0.656
#> GSM71703 6 0.4061 0.7995 0.248 0.000 0.000 0.000 0.044 0.708
#> GSM71704 6 0.3888 0.8036 0.252 0.000 0.000 0.000 0.032 0.716
#> GSM71705 6 0.5778 0.6363 0.296 0.000 0.004 0.000 0.184 0.516
#> GSM71706 6 0.3337 0.8048 0.260 0.000 0.000 0.000 0.004 0.736
#> GSM71707 6 0.5591 0.7005 0.232 0.000 0.004 0.000 0.196 0.568
#> GSM71708 6 0.3337 0.8048 0.260 0.000 0.000 0.000 0.004 0.736
#> GSM71709 4 0.0767 0.8326 0.000 0.008 0.004 0.976 0.000 0.012
#> GSM71710 1 0.3235 0.7531 0.820 0.000 0.000 0.000 0.052 0.128
#> GSM71711 1 0.1701 0.8129 0.920 0.000 0.000 0.000 0.008 0.072
#> GSM71712 5 0.4847 0.5602 0.220 0.000 0.000 0.124 0.656 0.000
#> GSM71713 5 0.5024 0.3432 0.088 0.000 0.000 0.000 0.572 0.340
#> GSM71714 1 0.0993 0.8229 0.964 0.000 0.000 0.000 0.012 0.024
#> GSM71715 1 0.3314 0.7723 0.828 0.000 0.008 0.000 0.052 0.112
#> GSM71716 1 0.2762 0.7712 0.860 0.000 0.000 0.000 0.048 0.092
#> GSM71717 1 0.3618 0.6649 0.776 0.000 0.000 0.000 0.048 0.176
#> GSM71718 1 0.4286 0.6706 0.720 0.000 0.004 0.000 0.208 0.068
#> GSM71719 1 0.1082 0.8189 0.956 0.000 0.000 0.000 0.040 0.004
#> GSM71720 1 0.2009 0.7934 0.908 0.000 0.000 0.000 0.068 0.024
#> GSM71721 1 0.4537 0.6267 0.680 0.000 0.004 0.000 0.248 0.068
#> GSM71722 1 0.4341 0.6480 0.712 0.000 0.004 0.000 0.216 0.068
#> GSM71723 1 0.0000 0.8285 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM71724 6 0.5832 0.7457 0.324 0.000 0.004 0.000 0.180 0.492
#> GSM71725 5 0.3547 0.5210 0.332 0.000 0.000 0.000 0.668 0.000
#> GSM71726 4 0.3665 0.4052 0.004 0.000 0.000 0.696 0.296 0.004
#> GSM71727 4 0.0405 0.8352 0.000 0.008 0.000 0.988 0.000 0.004
#> GSM71728 5 0.3937 0.0542 0.004 0.000 0.000 0.424 0.572 0.000
#> GSM71729 4 0.0405 0.8352 0.000 0.008 0.000 0.988 0.000 0.004
#> GSM71730 4 0.0405 0.8352 0.000 0.008 0.000 0.988 0.000 0.004
#> GSM71731 1 0.0000 0.8285 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM71732 1 0.4367 0.6454 0.708 0.000 0.004 0.000 0.220 0.068
#> GSM71733 1 0.0000 0.8285 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM71734 6 0.5504 0.7034 0.220 0.000 0.004 0.000 0.192 0.584
#> GSM71735 6 0.3940 0.7540 0.348 0.000 0.000 0.000 0.012 0.640
#> GSM71736 6 0.3606 0.8042 0.284 0.000 0.004 0.000 0.004 0.708
#> GSM71737 6 0.4598 0.6933 0.360 0.000 0.000 0.000 0.048 0.592
#> GSM71738 6 0.3565 0.7937 0.304 0.000 0.000 0.000 0.004 0.692
#> GSM71739 1 0.4747 0.6408 0.744 0.132 0.008 0.000 0.076 0.040
#> GSM71740 1 0.1333 0.8156 0.944 0.000 0.000 0.000 0.008 0.048
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) k
#> SD:kmeans 70 1.15e-12 2
#> SD:kmeans 69 2.15e-18 3
#> SD:kmeans 63 3.48e-19 4
#> SD:kmeans 69 4.84e-19 5
#> SD:kmeans 66 6.30e-17 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 21168 rows and 70 columns.
#> Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'SD' method.
#> Subgroups are detected by 'skmeans' method.
#> Performed in total 1250 partitions by row resampling.
#> Best k for subgroups seems to be 4.
#>
#> Following methods can be applied to this 'ConsensusPartition' object:
#> [1] "cola_report" "collect_classes" "collect_plots"
#> [4] "collect_stats" "colnames" "compare_signatures"
#> [7] "consensus_heatmap" "dimension_reduction" "functional_enrichment"
#> [10] "get_anno_col" "get_anno" "get_classes"
#> [13] "get_consensus" "get_matrix" "get_membership"
#> [16] "get_param" "get_signatures" "get_stats"
#> [19] "is_best_k" "is_stable_k" "membership_heatmap"
#> [22] "ncol" "nrow" "plot_ecdf"
#> [25] "rownames" "select_partition_number" "show"
#> [28] "suggest_best_k" "test_to_known_factors"
collect_plots()
function collects all the plots made from res
for all k
(number of partitions)
into one single page to provide an easy and fast comparison between different k
.
collect_plots(res)
The plots are:
k
and the heatmap of
predicted classes for each k
.k
.k
.k
.All the plots in panels can be made by individual functions and they are plotted later in this section.
select_partition_number()
produces several plots showing different
statistics for choosing “optimized” k
. There are following statistics:
k
;k
, the area increased is defined as \(A_k - A_{k-1}\).The detailed explanations of these statistics can be found in the cola vignette.
Generally speaking, lower PAC score, higher mean silhouette score or higher
concordance corresponds to better partition. Rand index and Jaccard index
measure how similar the current partition is compared to partition with k-1
.
If they are too similar, we won't accept k
is better than k-1
.
select_partition_number(res)
The numeric values for all these statistics can be obtained by get_stats()
.
get_stats(res)
#> k 1-PAC mean_silhouette concordance area_increased Rand Jaccard
#> 2 2 1.000 0.976 0.990 0.5001 0.499 0.499
#> 3 3 1.000 0.934 0.972 0.2050 0.859 0.727
#> 4 4 0.958 0.954 0.956 0.1102 0.920 0.801
#> 5 5 0.738 0.568 0.796 0.1280 0.901 0.709
#> 6 6 0.704 0.645 0.783 0.0665 0.880 0.573
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
#> GSM71671 2 0.000 0.983 0.000 1.000
#> GSM71672 2 0.000 0.983 0.000 1.000
#> GSM71673 2 0.000 0.983 0.000 1.000
#> GSM71674 2 0.000 0.983 0.000 1.000
#> GSM71675 2 0.000 0.983 0.000 1.000
#> GSM71676 2 0.000 0.983 0.000 1.000
#> GSM71677 2 0.000 0.983 0.000 1.000
#> GSM71678 2 0.000 0.983 0.000 1.000
#> GSM71679 2 0.000 0.983 0.000 1.000
#> GSM71680 2 0.000 0.983 0.000 1.000
#> GSM71681 2 0.000 0.983 0.000 1.000
#> GSM71682 2 0.000 0.983 0.000 1.000
#> GSM71683 2 0.000 0.983 0.000 1.000
#> GSM71684 2 0.000 0.983 0.000 1.000
#> GSM71685 2 0.000 0.983 0.000 1.000
#> GSM71686 2 0.000 0.983 0.000 1.000
#> GSM71687 2 0.000 0.983 0.000 1.000
#> GSM71688 2 0.000 0.983 0.000 1.000
#> GSM71689 2 0.000 0.983 0.000 1.000
#> GSM71690 2 0.000 0.983 0.000 1.000
#> GSM71691 2 0.000 0.983 0.000 1.000
#> GSM71692 2 0.000 0.983 0.000 1.000
#> GSM71693 2 0.000 0.983 0.000 1.000
#> GSM71694 2 0.000 0.983 0.000 1.000
#> GSM71695 2 0.000 0.983 0.000 1.000
#> GSM71696 1 0.000 0.995 1.000 0.000
#> GSM71697 1 0.000 0.995 1.000 0.000
#> GSM71698 1 0.000 0.995 1.000 0.000
#> GSM71699 1 0.000 0.995 1.000 0.000
#> GSM71700 1 0.000 0.995 1.000 0.000
#> GSM71701 1 0.000 0.995 1.000 0.000
#> GSM71702 1 0.000 0.995 1.000 0.000
#> GSM71703 1 0.000 0.995 1.000 0.000
#> GSM71704 1 0.000 0.995 1.000 0.000
#> GSM71705 1 0.000 0.995 1.000 0.000
#> GSM71706 1 0.000 0.995 1.000 0.000
#> GSM71707 1 0.000 0.995 1.000 0.000
#> GSM71708 1 0.000 0.995 1.000 0.000
#> GSM71709 2 0.000 0.983 0.000 1.000
#> GSM71710 1 0.000 0.995 1.000 0.000
#> GSM71711 1 0.000 0.995 1.000 0.000
#> GSM71712 1 0.000 0.995 1.000 0.000
#> GSM71713 1 0.000 0.995 1.000 0.000
#> GSM71714 1 0.000 0.995 1.000 0.000
#> GSM71715 1 0.000 0.995 1.000 0.000
#> GSM71716 1 0.000 0.995 1.000 0.000
#> GSM71717 1 0.000 0.995 1.000 0.000
#> GSM71718 1 0.000 0.995 1.000 0.000
#> GSM71719 1 0.000 0.995 1.000 0.000
#> GSM71720 1 0.000 0.995 1.000 0.000
#> GSM71721 1 0.000 0.995 1.000 0.000
#> GSM71722 1 0.000 0.995 1.000 0.000
#> GSM71723 1 0.000 0.995 1.000 0.000
#> GSM71724 1 0.000 0.995 1.000 0.000
#> GSM71725 1 0.000 0.995 1.000 0.000
#> GSM71726 2 0.494 0.871 0.108 0.892
#> GSM71727 2 0.000 0.983 0.000 1.000
#> GSM71728 2 0.961 0.386 0.384 0.616
#> GSM71729 2 0.000 0.983 0.000 1.000
#> GSM71730 2 0.000 0.983 0.000 1.000
#> GSM71731 1 0.000 0.995 1.000 0.000
#> GSM71732 1 0.000 0.995 1.000 0.000
#> GSM71733 1 0.000 0.995 1.000 0.000
#> GSM71734 1 0.000 0.995 1.000 0.000
#> GSM71735 1 0.000 0.995 1.000 0.000
#> GSM71736 1 0.000 0.995 1.000 0.000
#> GSM71737 1 0.000 0.995 1.000 0.000
#> GSM71738 1 0.000 0.995 1.000 0.000
#> GSM71739 1 0.730 0.739 0.796 0.204
#> GSM71740 1 0.000 0.995 1.000 0.000
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> GSM71671 3 0.0424 0.9241 0.000 0.008 0.992
#> GSM71672 3 0.0424 0.9241 0.000 0.008 0.992
#> GSM71673 3 0.0424 0.9241 0.000 0.008 0.992
#> GSM71674 3 0.0424 0.9241 0.000 0.008 0.992
#> GSM71675 3 0.0424 0.9241 0.000 0.008 0.992
#> GSM71676 3 0.0424 0.9241 0.000 0.008 0.992
#> GSM71677 3 0.0424 0.9241 0.000 0.008 0.992
#> GSM71678 2 0.0892 0.9413 0.000 0.980 0.020
#> GSM71679 2 0.0892 0.9413 0.000 0.980 0.020
#> GSM71680 2 0.0000 0.9360 0.000 1.000 0.000
#> GSM71681 2 0.0892 0.9413 0.000 0.980 0.020
#> GSM71682 2 0.0892 0.9413 0.000 0.980 0.020
#> GSM71683 2 0.0892 0.9413 0.000 0.980 0.020
#> GSM71684 2 0.0892 0.9413 0.000 0.980 0.020
#> GSM71685 2 0.0892 0.9413 0.000 0.980 0.020
#> GSM71686 2 0.0892 0.9413 0.000 0.980 0.020
#> GSM71687 2 0.0892 0.9413 0.000 0.980 0.020
#> GSM71688 2 0.0892 0.9413 0.000 0.980 0.020
#> GSM71689 3 0.0424 0.9241 0.000 0.008 0.992
#> GSM71690 2 0.0892 0.9413 0.000 0.980 0.020
#> GSM71691 3 0.6154 0.3722 0.000 0.408 0.592
#> GSM71692 3 0.0424 0.9241 0.000 0.008 0.992
#> GSM71693 2 0.0892 0.9413 0.000 0.980 0.020
#> GSM71694 3 0.0424 0.9241 0.000 0.008 0.992
#> GSM71695 3 0.6095 0.4103 0.000 0.392 0.608
#> GSM71696 1 0.0237 0.9963 0.996 0.000 0.004
#> GSM71697 1 0.0237 0.9963 0.996 0.000 0.004
#> GSM71698 1 0.0000 0.9964 1.000 0.000 0.000
#> GSM71699 1 0.0000 0.9964 1.000 0.000 0.000
#> GSM71700 1 0.0237 0.9963 0.996 0.000 0.004
#> GSM71701 1 0.0000 0.9964 1.000 0.000 0.000
#> GSM71702 1 0.0000 0.9964 1.000 0.000 0.000
#> GSM71703 1 0.0000 0.9964 1.000 0.000 0.000
#> GSM71704 1 0.0000 0.9964 1.000 0.000 0.000
#> GSM71705 1 0.0000 0.9964 1.000 0.000 0.000
#> GSM71706 1 0.0000 0.9964 1.000 0.000 0.000
#> GSM71707 1 0.0000 0.9964 1.000 0.000 0.000
#> GSM71708 1 0.0000 0.9964 1.000 0.000 0.000
#> GSM71709 2 0.0000 0.9360 0.000 1.000 0.000
#> GSM71710 1 0.0237 0.9963 0.996 0.000 0.004
#> GSM71711 1 0.0237 0.9963 0.996 0.000 0.004
#> GSM71712 2 0.6683 -0.0248 0.496 0.496 0.008
#> GSM71713 1 0.0237 0.9942 0.996 0.000 0.004
#> GSM71714 1 0.0000 0.9964 1.000 0.000 0.000
#> GSM71715 1 0.0237 0.9963 0.996 0.000 0.004
#> GSM71716 1 0.0237 0.9963 0.996 0.000 0.004
#> GSM71717 1 0.0237 0.9963 0.996 0.000 0.004
#> GSM71718 1 0.0237 0.9963 0.996 0.000 0.004
#> GSM71719 1 0.0237 0.9963 0.996 0.000 0.004
#> GSM71720 1 0.0237 0.9963 0.996 0.000 0.004
#> GSM71721 1 0.0237 0.9963 0.996 0.000 0.004
#> GSM71722 1 0.0237 0.9963 0.996 0.000 0.004
#> GSM71723 1 0.0237 0.9963 0.996 0.000 0.004
#> GSM71724 1 0.0000 0.9964 1.000 0.000 0.000
#> GSM71725 1 0.2384 0.9357 0.936 0.056 0.008
#> GSM71726 2 0.0237 0.9333 0.000 0.996 0.004
#> GSM71727 2 0.0000 0.9360 0.000 1.000 0.000
#> GSM71728 2 0.0424 0.9302 0.000 0.992 0.008
#> GSM71729 2 0.0000 0.9360 0.000 1.000 0.000
#> GSM71730 2 0.0000 0.9360 0.000 1.000 0.000
#> GSM71731 1 0.0237 0.9963 0.996 0.000 0.004
#> GSM71732 1 0.0237 0.9963 0.996 0.000 0.004
#> GSM71733 1 0.0000 0.9964 1.000 0.000 0.000
#> GSM71734 1 0.0000 0.9964 1.000 0.000 0.000
#> GSM71735 1 0.0000 0.9964 1.000 0.000 0.000
#> GSM71736 1 0.0000 0.9964 1.000 0.000 0.000
#> GSM71737 1 0.0000 0.9964 1.000 0.000 0.000
#> GSM71738 1 0.0000 0.9964 1.000 0.000 0.000
#> GSM71739 2 0.4539 0.7381 0.148 0.836 0.016
#> GSM71740 1 0.0237 0.9963 0.996 0.000 0.004
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> GSM71671 3 0.0188 1.000 0.000 0.004 0.996 0.000
#> GSM71672 3 0.0188 1.000 0.000 0.004 0.996 0.000
#> GSM71673 3 0.0188 1.000 0.000 0.004 0.996 0.000
#> GSM71674 3 0.0188 1.000 0.000 0.004 0.996 0.000
#> GSM71675 3 0.0188 1.000 0.000 0.004 0.996 0.000
#> GSM71676 3 0.0188 1.000 0.000 0.004 0.996 0.000
#> GSM71677 3 0.0188 1.000 0.000 0.004 0.996 0.000
#> GSM71678 2 0.0000 0.976 0.000 1.000 0.000 0.000
#> GSM71679 2 0.0000 0.976 0.000 1.000 0.000 0.000
#> GSM71680 4 0.3032 0.910 0.000 0.124 0.008 0.868
#> GSM71681 2 0.0000 0.976 0.000 1.000 0.000 0.000
#> GSM71682 2 0.0000 0.976 0.000 1.000 0.000 0.000
#> GSM71683 2 0.0000 0.976 0.000 1.000 0.000 0.000
#> GSM71684 2 0.0000 0.976 0.000 1.000 0.000 0.000
#> GSM71685 2 0.0000 0.976 0.000 1.000 0.000 0.000
#> GSM71686 2 0.0000 0.976 0.000 1.000 0.000 0.000
#> GSM71687 2 0.0000 0.976 0.000 1.000 0.000 0.000
#> GSM71688 2 0.0000 0.976 0.000 1.000 0.000 0.000
#> GSM71689 3 0.0188 1.000 0.000 0.004 0.996 0.000
#> GSM71690 2 0.0000 0.976 0.000 1.000 0.000 0.000
#> GSM71691 2 0.1867 0.909 0.000 0.928 0.072 0.000
#> GSM71692 3 0.0188 1.000 0.000 0.004 0.996 0.000
#> GSM71693 2 0.0000 0.976 0.000 1.000 0.000 0.000
#> GSM71694 3 0.0188 1.000 0.000 0.004 0.996 0.000
#> GSM71695 2 0.2081 0.895 0.000 0.916 0.084 0.000
#> GSM71696 1 0.1489 0.959 0.952 0.000 0.004 0.044
#> GSM71697 1 0.1211 0.960 0.960 0.000 0.000 0.040
#> GSM71698 1 0.1211 0.959 0.960 0.000 0.000 0.040
#> GSM71699 1 0.1398 0.959 0.956 0.000 0.004 0.040
#> GSM71700 1 0.0921 0.963 0.972 0.000 0.000 0.028
#> GSM71701 1 0.1302 0.958 0.956 0.000 0.000 0.044
#> GSM71702 1 0.1211 0.959 0.960 0.000 0.000 0.040
#> GSM71703 1 0.1398 0.959 0.956 0.000 0.004 0.040
#> GSM71704 1 0.1398 0.959 0.956 0.000 0.004 0.040
#> GSM71705 1 0.0817 0.962 0.976 0.000 0.000 0.024
#> GSM71706 1 0.1398 0.959 0.956 0.000 0.004 0.040
#> GSM71707 1 0.1211 0.961 0.960 0.000 0.000 0.040
#> GSM71708 1 0.1398 0.959 0.956 0.000 0.004 0.040
#> GSM71709 4 0.3266 0.905 0.000 0.168 0.000 0.832
#> GSM71710 1 0.1209 0.962 0.964 0.000 0.004 0.032
#> GSM71711 1 0.1398 0.960 0.956 0.000 0.004 0.040
#> GSM71712 4 0.1929 0.856 0.036 0.024 0.000 0.940
#> GSM71713 1 0.2760 0.892 0.872 0.000 0.000 0.128
#> GSM71714 1 0.0592 0.964 0.984 0.000 0.000 0.016
#> GSM71715 1 0.1489 0.961 0.952 0.000 0.004 0.044
#> GSM71716 1 0.1398 0.960 0.956 0.000 0.004 0.040
#> GSM71717 1 0.1109 0.963 0.968 0.000 0.004 0.028
#> GSM71718 1 0.1557 0.954 0.944 0.000 0.000 0.056
#> GSM71719 1 0.1474 0.955 0.948 0.000 0.000 0.052
#> GSM71720 1 0.1557 0.954 0.944 0.000 0.000 0.056
#> GSM71721 1 0.1474 0.958 0.948 0.000 0.000 0.052
#> GSM71722 1 0.1118 0.963 0.964 0.000 0.000 0.036
#> GSM71723 1 0.1211 0.960 0.960 0.000 0.000 0.040
#> GSM71724 1 0.1211 0.959 0.960 0.000 0.000 0.040
#> GSM71725 4 0.2345 0.773 0.100 0.000 0.000 0.900
#> GSM71726 4 0.2216 0.905 0.000 0.092 0.000 0.908
#> GSM71727 4 0.3400 0.900 0.000 0.180 0.000 0.820
#> GSM71728 4 0.2149 0.904 0.000 0.088 0.000 0.912
#> GSM71729 4 0.3610 0.886 0.000 0.200 0.000 0.800
#> GSM71730 4 0.3649 0.882 0.000 0.204 0.000 0.796
#> GSM71731 1 0.1211 0.960 0.960 0.000 0.000 0.040
#> GSM71732 1 0.1389 0.958 0.952 0.000 0.000 0.048
#> GSM71733 1 0.0817 0.963 0.976 0.000 0.000 0.024
#> GSM71734 1 0.1302 0.958 0.956 0.000 0.000 0.044
#> GSM71735 1 0.1209 0.961 0.964 0.000 0.004 0.032
#> GSM71736 1 0.1398 0.959 0.956 0.000 0.004 0.040
#> GSM71737 1 0.1305 0.962 0.960 0.000 0.004 0.036
#> GSM71738 1 0.1398 0.959 0.956 0.000 0.004 0.040
#> GSM71739 2 0.2840 0.861 0.044 0.900 0.000 0.056
#> GSM71740 1 0.1398 0.960 0.956 0.000 0.004 0.040
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> GSM71671 3 0.0162 1.00000 0.000 0.004 0.996 0.000 0.000
#> GSM71672 3 0.0162 1.00000 0.000 0.004 0.996 0.000 0.000
#> GSM71673 3 0.0162 1.00000 0.000 0.004 0.996 0.000 0.000
#> GSM71674 3 0.0162 1.00000 0.000 0.004 0.996 0.000 0.000
#> GSM71675 3 0.0162 1.00000 0.000 0.004 0.996 0.000 0.000
#> GSM71676 3 0.0162 1.00000 0.000 0.004 0.996 0.000 0.000
#> GSM71677 3 0.0162 1.00000 0.000 0.004 0.996 0.000 0.000
#> GSM71678 2 0.0162 0.92391 0.000 0.996 0.000 0.000 0.004
#> GSM71679 2 0.0162 0.92391 0.000 0.996 0.000 0.000 0.004
#> GSM71680 4 0.1124 0.88426 0.000 0.036 0.004 0.960 0.000
#> GSM71681 2 0.2377 0.81537 0.000 0.872 0.000 0.128 0.000
#> GSM71682 2 0.0162 0.92391 0.000 0.996 0.000 0.000 0.004
#> GSM71683 2 0.0000 0.92436 0.000 1.000 0.000 0.000 0.000
#> GSM71684 2 0.0000 0.92436 0.000 1.000 0.000 0.000 0.000
#> GSM71685 2 0.3561 0.64292 0.000 0.740 0.000 0.260 0.000
#> GSM71686 2 0.0162 0.92391 0.000 0.996 0.000 0.000 0.004
#> GSM71687 2 0.0000 0.92436 0.000 1.000 0.000 0.000 0.000
#> GSM71688 2 0.0000 0.92436 0.000 1.000 0.000 0.000 0.000
#> GSM71689 3 0.0162 1.00000 0.000 0.004 0.996 0.000 0.000
#> GSM71690 2 0.0000 0.92436 0.000 1.000 0.000 0.000 0.000
#> GSM71691 2 0.0693 0.91365 0.000 0.980 0.012 0.000 0.008
#> GSM71692 3 0.0162 1.00000 0.000 0.004 0.996 0.000 0.000
#> GSM71693 2 0.0000 0.92436 0.000 1.000 0.000 0.000 0.000
#> GSM71694 3 0.0162 1.00000 0.000 0.004 0.996 0.000 0.000
#> GSM71695 2 0.0992 0.90444 0.000 0.968 0.024 0.000 0.008
#> GSM71696 5 0.4268 0.41301 0.444 0.000 0.000 0.000 0.556
#> GSM71697 1 0.4452 -0.36340 0.500 0.000 0.000 0.004 0.496
#> GSM71698 1 0.3934 0.40178 0.748 0.000 0.004 0.012 0.236
#> GSM71699 1 0.0880 0.57169 0.968 0.000 0.000 0.000 0.032
#> GSM71700 1 0.4436 -0.09308 0.596 0.000 0.000 0.008 0.396
#> GSM71701 1 0.2605 0.49917 0.852 0.000 0.000 0.000 0.148
#> GSM71702 1 0.1197 0.57353 0.952 0.000 0.000 0.000 0.048
#> GSM71703 1 0.0290 0.57615 0.992 0.000 0.000 0.000 0.008
#> GSM71704 1 0.0404 0.57792 0.988 0.000 0.000 0.000 0.012
#> GSM71705 1 0.3143 0.49406 0.796 0.000 0.000 0.000 0.204
#> GSM71706 1 0.0162 0.57709 0.996 0.000 0.000 0.000 0.004
#> GSM71707 1 0.3366 0.47233 0.784 0.000 0.004 0.000 0.212
#> GSM71708 1 0.0162 0.57709 0.996 0.000 0.000 0.000 0.004
#> GSM71709 4 0.1478 0.88620 0.000 0.064 0.000 0.936 0.000
#> GSM71710 1 0.4201 -0.12176 0.592 0.000 0.000 0.000 0.408
#> GSM71711 1 0.4291 -0.27815 0.536 0.000 0.000 0.000 0.464
#> GSM71712 4 0.3999 0.74166 0.000 0.000 0.000 0.656 0.344
#> GSM71713 1 0.5107 0.18557 0.596 0.000 0.000 0.048 0.356
#> GSM71714 1 0.3913 0.19708 0.676 0.000 0.000 0.000 0.324
#> GSM71715 1 0.4294 -0.27710 0.532 0.000 0.000 0.000 0.468
#> GSM71716 1 0.4304 -0.32311 0.516 0.000 0.000 0.000 0.484
#> GSM71717 1 0.4126 -0.00645 0.620 0.000 0.000 0.000 0.380
#> GSM71718 5 0.4403 0.57790 0.316 0.000 0.004 0.012 0.668
#> GSM71719 5 0.4436 0.50994 0.396 0.000 0.000 0.008 0.596
#> GSM71720 5 0.4552 0.57356 0.352 0.000 0.004 0.012 0.632
#> GSM71721 5 0.4661 0.52899 0.356 0.000 0.004 0.016 0.624
#> GSM71722 5 0.4545 0.38708 0.432 0.000 0.004 0.004 0.560
#> GSM71723 1 0.4300 -0.28833 0.524 0.000 0.000 0.000 0.476
#> GSM71724 1 0.2392 0.55471 0.888 0.000 0.004 0.004 0.104
#> GSM71725 5 0.4906 -0.61798 0.024 0.000 0.000 0.480 0.496
#> GSM71726 4 0.3242 0.83633 0.000 0.012 0.000 0.816 0.172
#> GSM71727 4 0.1410 0.88712 0.000 0.060 0.000 0.940 0.000
#> GSM71728 4 0.3890 0.80433 0.000 0.012 0.000 0.736 0.252
#> GSM71729 4 0.1608 0.88254 0.000 0.072 0.000 0.928 0.000
#> GSM71730 4 0.1608 0.88254 0.000 0.072 0.000 0.928 0.000
#> GSM71731 5 0.4542 0.37232 0.456 0.000 0.000 0.008 0.536
#> GSM71732 5 0.4434 0.56936 0.348 0.000 0.004 0.008 0.640
#> GSM71733 1 0.4182 -0.03437 0.600 0.000 0.000 0.000 0.400
#> GSM71734 1 0.2877 0.52168 0.848 0.000 0.004 0.004 0.144
#> GSM71735 1 0.1608 0.56280 0.928 0.000 0.000 0.000 0.072
#> GSM71736 1 0.0703 0.57455 0.976 0.000 0.000 0.000 0.024
#> GSM71737 1 0.2329 0.52055 0.876 0.000 0.000 0.000 0.124
#> GSM71738 1 0.0703 0.57712 0.976 0.000 0.000 0.000 0.024
#> GSM71739 2 0.4731 0.24657 0.016 0.528 0.000 0.000 0.456
#> GSM71740 1 0.4305 -0.32233 0.512 0.000 0.000 0.000 0.488
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> GSM71671 3 0.0000 1.00000 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM71672 3 0.0000 1.00000 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM71673 3 0.0000 1.00000 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM71674 3 0.0000 1.00000 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM71675 3 0.0000 1.00000 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM71676 3 0.0000 1.00000 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM71677 3 0.0000 1.00000 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM71678 2 0.0717 0.89602 0.000 0.976 0.000 0.000 0.016 0.008
#> GSM71679 2 0.0717 0.89602 0.000 0.976 0.000 0.000 0.016 0.008
#> GSM71680 4 0.0260 0.79363 0.000 0.008 0.000 0.992 0.000 0.000
#> GSM71681 2 0.2500 0.80645 0.000 0.868 0.000 0.116 0.012 0.004
#> GSM71682 2 0.0717 0.89602 0.000 0.976 0.000 0.000 0.016 0.008
#> GSM71683 2 0.0291 0.89786 0.000 0.992 0.000 0.000 0.004 0.004
#> GSM71684 2 0.0717 0.89373 0.000 0.976 0.000 0.016 0.008 0.000
#> GSM71685 2 0.4032 0.32576 0.000 0.572 0.000 0.420 0.008 0.000
#> GSM71686 2 0.0717 0.89602 0.000 0.976 0.000 0.000 0.016 0.008
#> GSM71687 2 0.0405 0.89746 0.000 0.988 0.000 0.000 0.008 0.004
#> GSM71688 2 0.0405 0.89743 0.000 0.988 0.000 0.000 0.008 0.004
#> GSM71689 3 0.0000 1.00000 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM71690 2 0.0260 0.89806 0.000 0.992 0.000 0.000 0.008 0.000
#> GSM71691 2 0.0858 0.89076 0.000 0.968 0.004 0.000 0.028 0.000
#> GSM71692 3 0.0000 1.00000 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM71693 2 0.0405 0.89743 0.000 0.988 0.000 0.000 0.008 0.004
#> GSM71694 3 0.0000 1.00000 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM71695 2 0.1003 0.88946 0.000 0.964 0.004 0.000 0.028 0.004
#> GSM71696 1 0.5250 0.52014 0.608 0.000 0.000 0.000 0.184 0.208
#> GSM71697 1 0.2680 0.61324 0.860 0.000 0.000 0.000 0.032 0.108
#> GSM71698 6 0.5091 0.32656 0.196 0.000 0.000 0.000 0.172 0.632
#> GSM71699 6 0.3766 0.65286 0.232 0.000 0.000 0.000 0.032 0.736
#> GSM71700 1 0.3520 0.52615 0.776 0.000 0.000 0.000 0.036 0.188
#> GSM71701 6 0.3735 0.50297 0.092 0.000 0.000 0.000 0.124 0.784
#> GSM71702 6 0.4306 0.60254 0.344 0.000 0.000 0.000 0.032 0.624
#> GSM71703 6 0.3445 0.65356 0.260 0.000 0.000 0.000 0.008 0.732
#> GSM71704 6 0.3405 0.65172 0.272 0.000 0.000 0.000 0.004 0.724
#> GSM71705 6 0.4823 0.32389 0.348 0.000 0.000 0.000 0.068 0.584
#> GSM71706 6 0.3835 0.63587 0.300 0.000 0.000 0.000 0.016 0.684
#> GSM71707 6 0.4953 0.40403 0.268 0.000 0.000 0.000 0.108 0.624
#> GSM71708 6 0.4028 0.62507 0.308 0.000 0.000 0.000 0.024 0.668
#> GSM71709 4 0.0363 0.79781 0.000 0.012 0.000 0.988 0.000 0.000
#> GSM71710 1 0.4851 0.36530 0.632 0.000 0.000 0.000 0.096 0.272
#> GSM71711 1 0.3245 0.56469 0.800 0.000 0.000 0.000 0.028 0.172
#> GSM71712 5 0.4609 0.37692 0.024 0.000 0.000 0.436 0.532 0.008
#> GSM71713 6 0.4852 0.12049 0.048 0.000 0.000 0.004 0.420 0.528
#> GSM71714 1 0.4158 0.39679 0.704 0.000 0.000 0.000 0.052 0.244
#> GSM71715 1 0.5345 0.40733 0.592 0.000 0.000 0.000 0.220 0.188
#> GSM71716 1 0.4079 0.52798 0.752 0.000 0.000 0.000 0.112 0.136
#> GSM71717 1 0.4929 0.27686 0.620 0.000 0.000 0.000 0.100 0.280
#> GSM71718 1 0.4921 0.50040 0.656 0.000 0.000 0.000 0.164 0.180
#> GSM71719 1 0.2179 0.62683 0.900 0.000 0.000 0.000 0.064 0.036
#> GSM71720 1 0.3274 0.59721 0.824 0.000 0.000 0.000 0.080 0.096
#> GSM71721 1 0.5449 0.43068 0.572 0.000 0.000 0.000 0.188 0.240
#> GSM71722 1 0.5307 0.44234 0.588 0.000 0.000 0.000 0.156 0.256
#> GSM71723 1 0.2436 0.62628 0.880 0.000 0.000 0.000 0.032 0.088
#> GSM71724 6 0.4813 0.52401 0.316 0.000 0.000 0.000 0.076 0.608
#> GSM71725 5 0.5449 0.56028 0.148 0.000 0.000 0.216 0.620 0.016
#> GSM71726 4 0.3309 0.26547 0.000 0.000 0.000 0.720 0.280 0.000
#> GSM71727 4 0.0363 0.79781 0.000 0.012 0.000 0.988 0.000 0.000
#> GSM71728 4 0.3823 -0.34571 0.000 0.000 0.000 0.564 0.436 0.000
#> GSM71729 4 0.0363 0.79781 0.000 0.012 0.000 0.988 0.000 0.000
#> GSM71730 4 0.0363 0.79781 0.000 0.012 0.000 0.988 0.000 0.000
#> GSM71731 1 0.1644 0.63643 0.932 0.000 0.000 0.000 0.028 0.040
#> GSM71732 1 0.5102 0.48933 0.628 0.000 0.000 0.000 0.160 0.212
#> GSM71733 1 0.3122 0.51499 0.804 0.000 0.000 0.000 0.020 0.176
#> GSM71734 6 0.4386 0.50970 0.200 0.000 0.000 0.000 0.092 0.708
#> GSM71735 6 0.4500 0.53582 0.392 0.000 0.000 0.000 0.036 0.572
#> GSM71736 6 0.4022 0.65271 0.252 0.000 0.000 0.000 0.040 0.708
#> GSM71737 6 0.4925 0.42538 0.424 0.000 0.000 0.000 0.064 0.512
#> GSM71738 6 0.4144 0.59151 0.360 0.000 0.000 0.000 0.020 0.620
#> GSM71739 2 0.7131 0.00424 0.316 0.372 0.000 0.008 0.248 0.056
#> GSM71740 1 0.2586 0.60973 0.868 0.000 0.000 0.000 0.032 0.100
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) k
#> SD:skmeans 69 8.57e-12 2
#> SD:skmeans 67 2.67e-16 3
#> SD:skmeans 70 1.62e-19 4
#> SD:skmeans 49 1.02e-12 5
#> SD:skmeans 53 6.02e-13 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 21168 rows and 70 columns.
#> Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'SD' method.
#> Subgroups are detected by 'pam' method.
#> Performed in total 1250 partitions by row resampling.
#> Best k for subgroups seems to be 4.
#>
#> Following methods can be applied to this 'ConsensusPartition' object:
#> [1] "cola_report" "collect_classes" "collect_plots"
#> [4] "collect_stats" "colnames" "compare_signatures"
#> [7] "consensus_heatmap" "dimension_reduction" "functional_enrichment"
#> [10] "get_anno_col" "get_anno" "get_classes"
#> [13] "get_consensus" "get_matrix" "get_membership"
#> [16] "get_param" "get_signatures" "get_stats"
#> [19] "is_best_k" "is_stable_k" "membership_heatmap"
#> [22] "ncol" "nrow" "plot_ecdf"
#> [25] "rownames" "select_partition_number" "show"
#> [28] "suggest_best_k" "test_to_known_factors"
collect_plots()
function collects all the plots made from res
for all k
(number of partitions)
into one single page to provide an easy and fast comparison between different k
.
collect_plots(res)
The plots are:
k
and the heatmap of
predicted classes for each k
.k
.k
.k
.All the plots in panels can be made by individual functions and they are plotted later in this section.
select_partition_number()
produces several plots showing different
statistics for choosing “optimized” k
. There are following statistics:
k
;k
, the area increased is defined as \(A_k - A_{k-1}\).The detailed explanations of these statistics can be found in the cola vignette.
Generally speaking, lower PAC score, higher mean silhouette score or higher
concordance corresponds to better partition. Rand index and Jaccard index
measure how similar the current partition is compared to partition with k-1
.
If they are too similar, we won't accept k
is better than k-1
.
select_partition_number(res)
The numeric values for all these statistics can be obtained by get_stats()
.
get_stats(res)
#> k 1-PAC mean_silhouette concordance area_increased Rand Jaccard
#> 2 2 1.000 1.000 1.000 0.4929 0.508 0.508
#> 3 3 1.000 0.988 0.995 0.1626 0.921 0.845
#> 4 4 1.000 0.975 0.989 0.0956 0.930 0.840
#> 5 5 0.730 0.830 0.869 0.2246 0.842 0.579
#> 6 6 0.732 0.769 0.823 0.0326 0.991 0.961
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
#> GSM71671 2 0.0000 1.000 0.000 1.000
#> GSM71672 2 0.0000 1.000 0.000 1.000
#> GSM71673 2 0.0000 1.000 0.000 1.000
#> GSM71674 2 0.0000 1.000 0.000 1.000
#> GSM71675 2 0.0000 1.000 0.000 1.000
#> GSM71676 2 0.0000 1.000 0.000 1.000
#> GSM71677 2 0.0000 1.000 0.000 1.000
#> GSM71678 2 0.0000 1.000 0.000 1.000
#> GSM71679 2 0.0000 1.000 0.000 1.000
#> GSM71680 2 0.0000 1.000 0.000 1.000
#> GSM71681 2 0.0000 1.000 0.000 1.000
#> GSM71682 2 0.0000 1.000 0.000 1.000
#> GSM71683 2 0.0000 1.000 0.000 1.000
#> GSM71684 2 0.0000 1.000 0.000 1.000
#> GSM71685 2 0.0000 1.000 0.000 1.000
#> GSM71686 2 0.0000 1.000 0.000 1.000
#> GSM71687 2 0.0000 1.000 0.000 1.000
#> GSM71688 2 0.0000 1.000 0.000 1.000
#> GSM71689 2 0.0000 1.000 0.000 1.000
#> GSM71690 2 0.0000 1.000 0.000 1.000
#> GSM71691 2 0.0000 1.000 0.000 1.000
#> GSM71692 2 0.0000 1.000 0.000 1.000
#> GSM71693 2 0.0000 1.000 0.000 1.000
#> GSM71694 2 0.0000 1.000 0.000 1.000
#> GSM71695 2 0.0000 1.000 0.000 1.000
#> GSM71696 1 0.0000 1.000 1.000 0.000
#> GSM71697 1 0.0000 1.000 1.000 0.000
#> GSM71698 1 0.0000 1.000 1.000 0.000
#> GSM71699 1 0.0000 1.000 1.000 0.000
#> GSM71700 1 0.0000 1.000 1.000 0.000
#> GSM71701 1 0.0000 1.000 1.000 0.000
#> GSM71702 1 0.0000 1.000 1.000 0.000
#> GSM71703 1 0.0000 1.000 1.000 0.000
#> GSM71704 1 0.0000 1.000 1.000 0.000
#> GSM71705 1 0.0000 1.000 1.000 0.000
#> GSM71706 1 0.0000 1.000 1.000 0.000
#> GSM71707 1 0.0000 1.000 1.000 0.000
#> GSM71708 1 0.0000 1.000 1.000 0.000
#> GSM71709 2 0.0000 1.000 0.000 1.000
#> GSM71710 1 0.0000 1.000 1.000 0.000
#> GSM71711 1 0.0000 1.000 1.000 0.000
#> GSM71712 1 0.0000 1.000 1.000 0.000
#> GSM71713 1 0.0000 1.000 1.000 0.000
#> GSM71714 1 0.0000 1.000 1.000 0.000
#> GSM71715 1 0.0000 1.000 1.000 0.000
#> GSM71716 1 0.0000 1.000 1.000 0.000
#> GSM71717 1 0.0000 1.000 1.000 0.000
#> GSM71718 1 0.0000 1.000 1.000 0.000
#> GSM71719 1 0.0000 1.000 1.000 0.000
#> GSM71720 1 0.0000 1.000 1.000 0.000
#> GSM71721 1 0.0000 1.000 1.000 0.000
#> GSM71722 1 0.0000 1.000 1.000 0.000
#> GSM71723 1 0.0000 1.000 1.000 0.000
#> GSM71724 1 0.0000 1.000 1.000 0.000
#> GSM71725 1 0.0000 1.000 1.000 0.000
#> GSM71726 1 0.0000 1.000 1.000 0.000
#> GSM71727 2 0.0000 1.000 0.000 1.000
#> GSM71728 1 0.0000 1.000 1.000 0.000
#> GSM71729 2 0.0000 1.000 0.000 1.000
#> GSM71730 2 0.0000 1.000 0.000 1.000
#> GSM71731 1 0.0000 1.000 1.000 0.000
#> GSM71732 1 0.0000 1.000 1.000 0.000
#> GSM71733 1 0.0000 1.000 1.000 0.000
#> GSM71734 1 0.0000 1.000 1.000 0.000
#> GSM71735 1 0.0000 1.000 1.000 0.000
#> GSM71736 1 0.0000 1.000 1.000 0.000
#> GSM71737 1 0.0000 1.000 1.000 0.000
#> GSM71738 1 0.0000 1.000 1.000 0.000
#> GSM71739 1 0.0376 0.996 0.996 0.004
#> GSM71740 1 0.0000 1.000 1.000 0.000
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> GSM71671 3 0.0000 1.000 0.000 0.000 1.000
#> GSM71672 3 0.0000 1.000 0.000 0.000 1.000
#> GSM71673 3 0.0000 1.000 0.000 0.000 1.000
#> GSM71674 3 0.0000 1.000 0.000 0.000 1.000
#> GSM71675 3 0.0000 1.000 0.000 0.000 1.000
#> GSM71676 3 0.0000 1.000 0.000 0.000 1.000
#> GSM71677 3 0.0000 1.000 0.000 0.000 1.000
#> GSM71678 2 0.0000 0.984 0.000 1.000 0.000
#> GSM71679 2 0.0000 0.984 0.000 1.000 0.000
#> GSM71680 2 0.5465 0.596 0.000 0.712 0.288
#> GSM71681 2 0.0000 0.984 0.000 1.000 0.000
#> GSM71682 2 0.0000 0.984 0.000 1.000 0.000
#> GSM71683 2 0.0000 0.984 0.000 1.000 0.000
#> GSM71684 2 0.0000 0.984 0.000 1.000 0.000
#> GSM71685 2 0.0000 0.984 0.000 1.000 0.000
#> GSM71686 2 0.0000 0.984 0.000 1.000 0.000
#> GSM71687 2 0.0000 0.984 0.000 1.000 0.000
#> GSM71688 2 0.0000 0.984 0.000 1.000 0.000
#> GSM71689 3 0.0000 1.000 0.000 0.000 1.000
#> GSM71690 2 0.0000 0.984 0.000 1.000 0.000
#> GSM71691 2 0.0000 0.984 0.000 1.000 0.000
#> GSM71692 3 0.0000 1.000 0.000 0.000 1.000
#> GSM71693 2 0.0000 0.984 0.000 1.000 0.000
#> GSM71694 3 0.0000 1.000 0.000 0.000 1.000
#> GSM71695 2 0.0000 0.984 0.000 1.000 0.000
#> GSM71696 1 0.0000 0.998 1.000 0.000 0.000
#> GSM71697 1 0.0000 0.998 1.000 0.000 0.000
#> GSM71698 1 0.0000 0.998 1.000 0.000 0.000
#> GSM71699 1 0.0000 0.998 1.000 0.000 0.000
#> GSM71700 1 0.0000 0.998 1.000 0.000 0.000
#> GSM71701 1 0.0000 0.998 1.000 0.000 0.000
#> GSM71702 1 0.0000 0.998 1.000 0.000 0.000
#> GSM71703 1 0.0000 0.998 1.000 0.000 0.000
#> GSM71704 1 0.0000 0.998 1.000 0.000 0.000
#> GSM71705 1 0.0000 0.998 1.000 0.000 0.000
#> GSM71706 1 0.0000 0.998 1.000 0.000 0.000
#> GSM71707 1 0.0000 0.998 1.000 0.000 0.000
#> GSM71708 1 0.0000 0.998 1.000 0.000 0.000
#> GSM71709 2 0.0000 0.984 0.000 1.000 0.000
#> GSM71710 1 0.0000 0.998 1.000 0.000 0.000
#> GSM71711 1 0.0000 0.998 1.000 0.000 0.000
#> GSM71712 1 0.0000 0.998 1.000 0.000 0.000
#> GSM71713 1 0.0000 0.998 1.000 0.000 0.000
#> GSM71714 1 0.0000 0.998 1.000 0.000 0.000
#> GSM71715 1 0.0000 0.998 1.000 0.000 0.000
#> GSM71716 1 0.0000 0.998 1.000 0.000 0.000
#> GSM71717 1 0.0000 0.998 1.000 0.000 0.000
#> GSM71718 1 0.0000 0.998 1.000 0.000 0.000
#> GSM71719 1 0.0000 0.998 1.000 0.000 0.000
#> GSM71720 1 0.0000 0.998 1.000 0.000 0.000
#> GSM71721 1 0.0000 0.998 1.000 0.000 0.000
#> GSM71722 1 0.0000 0.998 1.000 0.000 0.000
#> GSM71723 1 0.0000 0.998 1.000 0.000 0.000
#> GSM71724 1 0.0000 0.998 1.000 0.000 0.000
#> GSM71725 1 0.0000 0.998 1.000 0.000 0.000
#> GSM71726 1 0.1031 0.974 0.976 0.024 0.000
#> GSM71727 2 0.0000 0.984 0.000 1.000 0.000
#> GSM71728 1 0.0237 0.994 0.996 0.004 0.000
#> GSM71729 2 0.0000 0.984 0.000 1.000 0.000
#> GSM71730 2 0.0000 0.984 0.000 1.000 0.000
#> GSM71731 1 0.0000 0.998 1.000 0.000 0.000
#> GSM71732 1 0.0000 0.998 1.000 0.000 0.000
#> GSM71733 1 0.0000 0.998 1.000 0.000 0.000
#> GSM71734 1 0.0000 0.998 1.000 0.000 0.000
#> GSM71735 1 0.0000 0.998 1.000 0.000 0.000
#> GSM71736 1 0.0000 0.998 1.000 0.000 0.000
#> GSM71737 1 0.0000 0.998 1.000 0.000 0.000
#> GSM71738 1 0.0000 0.998 1.000 0.000 0.000
#> GSM71739 1 0.1643 0.951 0.956 0.044 0.000
#> GSM71740 1 0.0000 0.998 1.000 0.000 0.000
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> GSM71671 3 0.0000 1.000 0.000 0.000 1 0.000
#> GSM71672 3 0.0000 1.000 0.000 0.000 1 0.000
#> GSM71673 3 0.0000 1.000 0.000 0.000 1 0.000
#> GSM71674 3 0.0000 1.000 0.000 0.000 1 0.000
#> GSM71675 3 0.0000 1.000 0.000 0.000 1 0.000
#> GSM71676 3 0.0000 1.000 0.000 0.000 1 0.000
#> GSM71677 3 0.0000 1.000 0.000 0.000 1 0.000
#> GSM71678 2 0.0000 0.993 0.000 1.000 0 0.000
#> GSM71679 2 0.0000 0.993 0.000 1.000 0 0.000
#> GSM71680 4 0.0336 0.908 0.000 0.008 0 0.992
#> GSM71681 2 0.2081 0.909 0.000 0.916 0 0.084
#> GSM71682 2 0.0000 0.993 0.000 1.000 0 0.000
#> GSM71683 2 0.0000 0.993 0.000 1.000 0 0.000
#> GSM71684 2 0.0000 0.993 0.000 1.000 0 0.000
#> GSM71685 4 0.1022 0.890 0.000 0.032 0 0.968
#> GSM71686 2 0.0000 0.993 0.000 1.000 0 0.000
#> GSM71687 2 0.0000 0.993 0.000 1.000 0 0.000
#> GSM71688 2 0.0000 0.993 0.000 1.000 0 0.000
#> GSM71689 3 0.0000 1.000 0.000 0.000 1 0.000
#> GSM71690 2 0.0000 0.993 0.000 1.000 0 0.000
#> GSM71691 2 0.0000 0.993 0.000 1.000 0 0.000
#> GSM71692 3 0.0000 1.000 0.000 0.000 1 0.000
#> GSM71693 2 0.0000 0.993 0.000 1.000 0 0.000
#> GSM71694 3 0.0000 1.000 0.000 0.000 1 0.000
#> GSM71695 2 0.0000 0.993 0.000 1.000 0 0.000
#> GSM71696 1 0.0000 0.995 1.000 0.000 0 0.000
#> GSM71697 1 0.0000 0.995 1.000 0.000 0 0.000
#> GSM71698 1 0.0188 0.994 0.996 0.000 0 0.004
#> GSM71699 1 0.0336 0.994 0.992 0.000 0 0.008
#> GSM71700 1 0.0000 0.995 1.000 0.000 0 0.000
#> GSM71701 1 0.0336 0.994 0.992 0.000 0 0.008
#> GSM71702 1 0.0336 0.994 0.992 0.000 0 0.008
#> GSM71703 1 0.0188 0.994 0.996 0.000 0 0.004
#> GSM71704 1 0.0188 0.994 0.996 0.000 0 0.004
#> GSM71705 1 0.0336 0.994 0.992 0.000 0 0.008
#> GSM71706 1 0.0188 0.994 0.996 0.000 0 0.004
#> GSM71707 1 0.0336 0.994 0.992 0.000 0 0.008
#> GSM71708 1 0.0188 0.994 0.996 0.000 0 0.004
#> GSM71709 4 0.0336 0.908 0.000 0.008 0 0.992
#> GSM71710 1 0.0000 0.995 1.000 0.000 0 0.000
#> GSM71711 1 0.0000 0.995 1.000 0.000 0 0.000
#> GSM71712 1 0.0188 0.994 0.996 0.000 0 0.004
#> GSM71713 1 0.0336 0.994 0.992 0.000 0 0.008
#> GSM71714 1 0.0188 0.994 0.996 0.000 0 0.004
#> GSM71715 1 0.0000 0.995 1.000 0.000 0 0.000
#> GSM71716 1 0.0000 0.995 1.000 0.000 0 0.000
#> GSM71717 1 0.0188 0.994 0.996 0.000 0 0.004
#> GSM71718 1 0.0188 0.994 0.996 0.000 0 0.004
#> GSM71719 1 0.0000 0.995 1.000 0.000 0 0.000
#> GSM71720 1 0.0188 0.994 0.996 0.000 0 0.004
#> GSM71721 1 0.0188 0.994 0.996 0.000 0 0.004
#> GSM71722 1 0.0188 0.994 0.996 0.000 0 0.004
#> GSM71723 1 0.0000 0.995 1.000 0.000 0 0.000
#> GSM71724 1 0.0188 0.994 0.996 0.000 0 0.004
#> GSM71725 1 0.0000 0.995 1.000 0.000 0 0.000
#> GSM71726 4 0.0376 0.905 0.004 0.004 0 0.992
#> GSM71727 4 0.0336 0.908 0.000 0.008 0 0.992
#> GSM71728 4 0.4761 0.406 0.372 0.000 0 0.628
#> GSM71729 4 0.0336 0.908 0.000 0.008 0 0.992
#> GSM71730 4 0.0336 0.908 0.000 0.008 0 0.992
#> GSM71731 1 0.0000 0.995 1.000 0.000 0 0.000
#> GSM71732 1 0.0188 0.994 0.996 0.000 0 0.004
#> GSM71733 1 0.0336 0.994 0.992 0.000 0 0.008
#> GSM71734 1 0.0336 0.994 0.992 0.000 0 0.008
#> GSM71735 1 0.0188 0.994 0.996 0.000 0 0.004
#> GSM71736 1 0.0188 0.994 0.996 0.000 0 0.004
#> GSM71737 1 0.0188 0.994 0.996 0.000 0 0.004
#> GSM71738 1 0.0188 0.994 0.996 0.000 0 0.004
#> GSM71739 1 0.2011 0.903 0.920 0.080 0 0.000
#> GSM71740 1 0.0000 0.995 1.000 0.000 0 0.000
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> GSM71671 3 0.0000 0.998 0.000 0.000 1.000 0.000 0.000
#> GSM71672 3 0.0000 0.998 0.000 0.000 1.000 0.000 0.000
#> GSM71673 3 0.0000 0.998 0.000 0.000 1.000 0.000 0.000
#> GSM71674 3 0.0000 0.998 0.000 0.000 1.000 0.000 0.000
#> GSM71675 3 0.0000 0.998 0.000 0.000 1.000 0.000 0.000
#> GSM71676 3 0.0000 0.998 0.000 0.000 1.000 0.000 0.000
#> GSM71677 3 0.0000 0.998 0.000 0.000 1.000 0.000 0.000
#> GSM71678 2 0.0000 0.989 0.000 1.000 0.000 0.000 0.000
#> GSM71679 2 0.0000 0.989 0.000 1.000 0.000 0.000 0.000
#> GSM71680 4 0.0000 0.985 0.000 0.000 0.000 1.000 0.000
#> GSM71681 2 0.2329 0.858 0.000 0.876 0.000 0.124 0.000
#> GSM71682 2 0.0000 0.989 0.000 1.000 0.000 0.000 0.000
#> GSM71683 2 0.0000 0.989 0.000 1.000 0.000 0.000 0.000
#> GSM71684 2 0.0000 0.989 0.000 1.000 0.000 0.000 0.000
#> GSM71685 4 0.0609 0.971 0.000 0.020 0.000 0.980 0.000
#> GSM71686 2 0.0000 0.989 0.000 1.000 0.000 0.000 0.000
#> GSM71687 2 0.0000 0.989 0.000 1.000 0.000 0.000 0.000
#> GSM71688 2 0.0000 0.989 0.000 1.000 0.000 0.000 0.000
#> GSM71689 3 0.0290 0.995 0.000 0.000 0.992 0.000 0.008
#> GSM71690 2 0.0000 0.989 0.000 1.000 0.000 0.000 0.000
#> GSM71691 2 0.0000 0.989 0.000 1.000 0.000 0.000 0.000
#> GSM71692 3 0.0290 0.995 0.000 0.000 0.992 0.000 0.008
#> GSM71693 2 0.0000 0.989 0.000 1.000 0.000 0.000 0.000
#> GSM71694 3 0.0290 0.995 0.000 0.000 0.992 0.000 0.008
#> GSM71695 2 0.0000 0.989 0.000 1.000 0.000 0.000 0.000
#> GSM71696 1 0.4283 0.389 0.544 0.000 0.000 0.000 0.456
#> GSM71697 5 0.2561 0.788 0.144 0.000 0.000 0.000 0.856
#> GSM71698 1 0.3966 0.660 0.664 0.000 0.000 0.000 0.336
#> GSM71699 1 0.0609 0.757 0.980 0.000 0.000 0.000 0.020
#> GSM71700 5 0.2329 0.800 0.124 0.000 0.000 0.000 0.876
#> GSM71701 1 0.2516 0.763 0.860 0.000 0.000 0.000 0.140
#> GSM71702 1 0.1965 0.768 0.904 0.000 0.000 0.000 0.096
#> GSM71703 1 0.1043 0.750 0.960 0.000 0.000 0.000 0.040
#> GSM71704 1 0.1043 0.750 0.960 0.000 0.000 0.000 0.040
#> GSM71705 1 0.3242 0.745 0.784 0.000 0.000 0.000 0.216
#> GSM71706 1 0.0794 0.752 0.972 0.000 0.000 0.000 0.028
#> GSM71707 1 0.3274 0.739 0.780 0.000 0.000 0.000 0.220
#> GSM71708 1 0.1043 0.750 0.960 0.000 0.000 0.000 0.040
#> GSM71709 4 0.0000 0.985 0.000 0.000 0.000 1.000 0.000
#> GSM71710 5 0.4060 0.695 0.360 0.000 0.000 0.000 0.640
#> GSM71711 5 0.3983 0.708 0.340 0.000 0.000 0.000 0.660
#> GSM71712 5 0.0703 0.757 0.024 0.000 0.000 0.000 0.976
#> GSM71713 1 0.2516 0.770 0.860 0.000 0.000 0.000 0.140
#> GSM71714 1 0.3857 0.699 0.688 0.000 0.000 0.000 0.312
#> GSM71715 5 0.3895 0.737 0.320 0.000 0.000 0.000 0.680
#> GSM71716 5 0.3752 0.758 0.292 0.000 0.000 0.000 0.708
#> GSM71717 5 0.4307 0.439 0.496 0.000 0.000 0.000 0.504
#> GSM71718 5 0.2732 0.738 0.160 0.000 0.000 0.000 0.840
#> GSM71719 5 0.1965 0.788 0.096 0.000 0.000 0.000 0.904
#> GSM71720 5 0.2074 0.778 0.104 0.000 0.000 0.000 0.896
#> GSM71721 1 0.4192 0.576 0.596 0.000 0.000 0.000 0.404
#> GSM71722 1 0.4192 0.576 0.596 0.000 0.000 0.000 0.404
#> GSM71723 1 0.4227 0.592 0.580 0.000 0.000 0.000 0.420
#> GSM71724 1 0.3508 0.730 0.748 0.000 0.000 0.000 0.252
#> GSM71725 5 0.0290 0.766 0.008 0.000 0.000 0.000 0.992
#> GSM71726 4 0.1792 0.933 0.000 0.000 0.000 0.916 0.084
#> GSM71727 4 0.0000 0.985 0.000 0.000 0.000 1.000 0.000
#> GSM71728 5 0.2017 0.730 0.008 0.000 0.000 0.080 0.912
#> GSM71729 4 0.0000 0.985 0.000 0.000 0.000 1.000 0.000
#> GSM71730 4 0.0000 0.985 0.000 0.000 0.000 1.000 0.000
#> GSM71731 5 0.2966 0.800 0.184 0.000 0.000 0.000 0.816
#> GSM71732 1 0.4192 0.576 0.596 0.000 0.000 0.000 0.404
#> GSM71733 1 0.4171 0.606 0.604 0.000 0.000 0.000 0.396
#> GSM71734 1 0.2516 0.763 0.860 0.000 0.000 0.000 0.140
#> GSM71735 1 0.0794 0.752 0.972 0.000 0.000 0.000 0.028
#> GSM71736 1 0.0510 0.752 0.984 0.000 0.000 0.000 0.016
#> GSM71737 1 0.1121 0.748 0.956 0.000 0.000 0.000 0.044
#> GSM71738 1 0.0963 0.751 0.964 0.000 0.000 0.000 0.036
#> GSM71739 5 0.3697 0.774 0.080 0.100 0.000 0.000 0.820
#> GSM71740 5 0.3586 0.772 0.264 0.000 0.000 0.000 0.736
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> GSM71671 3 0.0000 0.997 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM71672 3 0.0000 0.997 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM71673 3 0.0000 0.997 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM71674 3 0.0000 0.997 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM71675 3 0.0000 0.997 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM71676 3 0.0000 0.997 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM71677 3 0.0260 0.984 0.000 0.000 0.992 0.000 0.008 0.000
#> GSM71678 2 0.0000 0.984 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM71679 2 0.0000 0.984 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM71680 4 0.0146 0.934 0.000 0.000 0.000 0.996 0.004 0.000
#> GSM71681 2 0.2234 0.852 0.000 0.872 0.000 0.124 0.004 0.000
#> GSM71682 2 0.0000 0.984 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM71683 2 0.0363 0.984 0.000 0.988 0.000 0.000 0.012 0.000
#> GSM71684 2 0.0000 0.984 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM71685 4 0.0146 0.934 0.000 0.000 0.000 0.996 0.004 0.000
#> GSM71686 2 0.0000 0.984 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM71687 2 0.0000 0.984 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM71688 2 0.0363 0.984 0.000 0.988 0.000 0.000 0.012 0.000
#> GSM71689 5 0.3864 1.000 0.000 0.000 0.480 0.000 0.520 0.000
#> GSM71690 2 0.0363 0.984 0.000 0.988 0.000 0.000 0.012 0.000
#> GSM71691 2 0.0363 0.984 0.000 0.988 0.000 0.000 0.012 0.000
#> GSM71692 5 0.3864 1.000 0.000 0.000 0.480 0.000 0.520 0.000
#> GSM71693 2 0.0363 0.984 0.000 0.988 0.000 0.000 0.012 0.000
#> GSM71694 5 0.3864 1.000 0.000 0.000 0.480 0.000 0.520 0.000
#> GSM71695 2 0.0363 0.984 0.000 0.988 0.000 0.000 0.012 0.000
#> GSM71696 6 0.3126 0.447 0.248 0.000 0.000 0.000 0.000 0.752
#> GSM71697 1 0.3390 0.666 0.704 0.000 0.000 0.000 0.000 0.296
#> GSM71698 6 0.1663 0.629 0.088 0.000 0.000 0.000 0.000 0.912
#> GSM71699 6 0.5057 0.630 0.324 0.000 0.000 0.000 0.096 0.580
#> GSM71700 1 0.3221 0.682 0.736 0.000 0.000 0.000 0.000 0.264
#> GSM71701 6 0.0260 0.670 0.008 0.000 0.000 0.000 0.000 0.992
#> GSM71702 6 0.3215 0.673 0.240 0.000 0.000 0.000 0.004 0.756
#> GSM71703 6 0.5157 0.613 0.360 0.000 0.000 0.000 0.096 0.544
#> GSM71704 6 0.5174 0.612 0.368 0.000 0.000 0.000 0.096 0.536
#> GSM71705 6 0.1204 0.653 0.056 0.000 0.000 0.000 0.000 0.944
#> GSM71706 6 0.5137 0.618 0.352 0.000 0.000 0.000 0.096 0.552
#> GSM71707 6 0.1141 0.660 0.052 0.000 0.000 0.000 0.000 0.948
#> GSM71708 6 0.5174 0.612 0.368 0.000 0.000 0.000 0.096 0.536
#> GSM71709 4 0.0146 0.934 0.000 0.000 0.000 0.996 0.004 0.000
#> GSM71710 1 0.3171 0.647 0.784 0.000 0.000 0.000 0.012 0.204
#> GSM71711 1 0.2340 0.654 0.852 0.000 0.000 0.000 0.000 0.148
#> GSM71712 1 0.3672 0.548 0.632 0.000 0.000 0.000 0.368 0.000
#> GSM71713 6 0.4358 0.670 0.196 0.000 0.000 0.000 0.092 0.712
#> GSM71714 6 0.3693 0.655 0.120 0.000 0.000 0.000 0.092 0.788
#> GSM71715 1 0.1444 0.668 0.928 0.000 0.000 0.000 0.000 0.072
#> GSM71716 1 0.1327 0.680 0.936 0.000 0.000 0.000 0.000 0.064
#> GSM71717 1 0.3977 0.414 0.760 0.000 0.000 0.000 0.096 0.144
#> GSM71718 1 0.3774 0.575 0.592 0.000 0.000 0.000 0.000 0.408
#> GSM71719 1 0.3371 0.667 0.708 0.000 0.000 0.000 0.000 0.292
#> GSM71720 1 0.3547 0.635 0.668 0.000 0.000 0.000 0.000 0.332
#> GSM71721 6 0.1863 0.610 0.104 0.000 0.000 0.000 0.000 0.896
#> GSM71722 6 0.1910 0.612 0.108 0.000 0.000 0.000 0.000 0.892
#> GSM71723 6 0.2730 0.621 0.192 0.000 0.000 0.000 0.000 0.808
#> GSM71724 6 0.2647 0.679 0.044 0.000 0.000 0.000 0.088 0.868
#> GSM71725 1 0.3672 0.548 0.632 0.000 0.000 0.000 0.368 0.000
#> GSM71726 4 0.4443 0.554 0.036 0.000 0.000 0.596 0.368 0.000
#> GSM71727 4 0.0000 0.934 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM71728 1 0.3672 0.548 0.632 0.000 0.000 0.000 0.368 0.000
#> GSM71729 4 0.0000 0.934 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM71730 4 0.0000 0.934 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM71731 1 0.2527 0.705 0.832 0.000 0.000 0.000 0.000 0.168
#> GSM71732 6 0.1910 0.611 0.108 0.000 0.000 0.000 0.000 0.892
#> GSM71733 6 0.2793 0.623 0.200 0.000 0.000 0.000 0.000 0.800
#> GSM71734 6 0.0146 0.670 0.004 0.000 0.000 0.000 0.000 0.996
#> GSM71735 6 0.5137 0.617 0.352 0.000 0.000 0.000 0.096 0.552
#> GSM71736 6 0.4955 0.629 0.296 0.000 0.000 0.000 0.096 0.608
#> GSM71737 6 0.5182 0.608 0.372 0.000 0.000 0.000 0.096 0.532
#> GSM71738 6 0.5157 0.613 0.360 0.000 0.000 0.000 0.096 0.544
#> GSM71739 1 0.4687 0.669 0.684 0.136 0.000 0.000 0.000 0.180
#> GSM71740 1 0.1075 0.674 0.952 0.000 0.000 0.000 0.000 0.048
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) k
#> SD:pam 70 1.15e-12 2
#> SD:pam 70 2.22e-19 3
#> SD:pam 69 1.20e-19 4
#> SD:pam 68 4.25e-18 5
#> SD:pam 68 1.02e-22 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 21168 rows and 70 columns.
#> Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'SD' method.
#> Subgroups are detected by 'mclust' method.
#> Performed in total 1250 partitions by row resampling.
#> Best k for subgroups seems to be 4.
#>
#> Following methods can be applied to this 'ConsensusPartition' object:
#> [1] "cola_report" "collect_classes" "collect_plots"
#> [4] "collect_stats" "colnames" "compare_signatures"
#> [7] "consensus_heatmap" "dimension_reduction" "functional_enrichment"
#> [10] "get_anno_col" "get_anno" "get_classes"
#> [13] "get_consensus" "get_matrix" "get_membership"
#> [16] "get_param" "get_signatures" "get_stats"
#> [19] "is_best_k" "is_stable_k" "membership_heatmap"
#> [22] "ncol" "nrow" "plot_ecdf"
#> [25] "rownames" "select_partition_number" "show"
#> [28] "suggest_best_k" "test_to_known_factors"
collect_plots()
function collects all the plots made from res
for all k
(number of partitions)
into one single page to provide an easy and fast comparison between different k
.
collect_plots(res)
The plots are:
k
and the heatmap of
predicted classes for each k
.k
.k
.k
.All the plots in panels can be made by individual functions and they are plotted later in this section.
select_partition_number()
produces several plots showing different
statistics for choosing “optimized” k
. There are following statistics:
k
;k
, the area increased is defined as \(A_k - A_{k-1}\).The detailed explanations of these statistics can be found in the cola vignette.
Generally speaking, lower PAC score, higher mean silhouette score or higher
concordance corresponds to better partition. Rand index and Jaccard index
measure how similar the current partition is compared to partition with k-1
.
If they are too similar, we won't accept k
is better than k-1
.
select_partition_number(res)
The numeric values for all these statistics can be obtained by get_stats()
.
get_stats(res)
#> k 1-PAC mean_silhouette concordance area_increased Rand Jaccard
#> 2 2 0.911 0.943 0.976 0.5051 0.493 0.493
#> 3 3 0.867 0.839 0.891 0.2249 0.867 0.735
#> 4 4 0.957 0.933 0.969 0.0962 0.938 0.836
#> 5 5 0.778 0.854 0.887 0.0889 0.978 0.930
#> 6 6 0.758 0.603 0.768 0.0565 0.901 0.667
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
#> GSM71671 2 0.000 0.965 0.000 1.000
#> GSM71672 2 0.000 0.965 0.000 1.000
#> GSM71673 2 0.000 0.965 0.000 1.000
#> GSM71674 2 0.000 0.965 0.000 1.000
#> GSM71675 2 0.000 0.965 0.000 1.000
#> GSM71676 2 0.000 0.965 0.000 1.000
#> GSM71677 2 0.000 0.965 0.000 1.000
#> GSM71678 2 0.000 0.965 0.000 1.000
#> GSM71679 2 0.000 0.965 0.000 1.000
#> GSM71680 2 0.000 0.965 0.000 1.000
#> GSM71681 2 0.000 0.965 0.000 1.000
#> GSM71682 2 0.000 0.965 0.000 1.000
#> GSM71683 2 0.000 0.965 0.000 1.000
#> GSM71684 2 0.000 0.965 0.000 1.000
#> GSM71685 2 0.000 0.965 0.000 1.000
#> GSM71686 2 0.000 0.965 0.000 1.000
#> GSM71687 2 0.000 0.965 0.000 1.000
#> GSM71688 2 0.000 0.965 0.000 1.000
#> GSM71689 2 0.000 0.965 0.000 1.000
#> GSM71690 2 0.000 0.965 0.000 1.000
#> GSM71691 2 0.000 0.965 0.000 1.000
#> GSM71692 2 0.000 0.965 0.000 1.000
#> GSM71693 2 0.000 0.965 0.000 1.000
#> GSM71694 2 0.000 0.965 0.000 1.000
#> GSM71695 2 0.000 0.965 0.000 1.000
#> GSM71696 1 0.574 0.825 0.864 0.136
#> GSM71697 1 0.000 0.982 1.000 0.000
#> GSM71698 1 0.000 0.982 1.000 0.000
#> GSM71699 1 0.000 0.982 1.000 0.000
#> GSM71700 1 0.000 0.982 1.000 0.000
#> GSM71701 1 0.000 0.982 1.000 0.000
#> GSM71702 1 0.000 0.982 1.000 0.000
#> GSM71703 1 0.000 0.982 1.000 0.000
#> GSM71704 1 0.000 0.982 1.000 0.000
#> GSM71705 1 0.000 0.982 1.000 0.000
#> GSM71706 1 0.000 0.982 1.000 0.000
#> GSM71707 1 0.000 0.982 1.000 0.000
#> GSM71708 1 0.000 0.982 1.000 0.000
#> GSM71709 2 0.000 0.965 0.000 1.000
#> GSM71710 1 0.000 0.982 1.000 0.000
#> GSM71711 1 0.000 0.982 1.000 0.000
#> GSM71712 2 0.775 0.731 0.228 0.772
#> GSM71713 1 0.988 0.166 0.564 0.436
#> GSM71714 1 0.000 0.982 1.000 0.000
#> GSM71715 2 0.775 0.731 0.228 0.772
#> GSM71716 1 0.000 0.982 1.000 0.000
#> GSM71717 1 0.000 0.982 1.000 0.000
#> GSM71718 1 0.000 0.982 1.000 0.000
#> GSM71719 1 0.000 0.982 1.000 0.000
#> GSM71720 1 0.000 0.982 1.000 0.000
#> GSM71721 1 0.000 0.982 1.000 0.000
#> GSM71722 1 0.000 0.982 1.000 0.000
#> GSM71723 1 0.000 0.982 1.000 0.000
#> GSM71724 1 0.000 0.982 1.000 0.000
#> GSM71725 2 0.775 0.731 0.228 0.772
#> GSM71726 2 0.000 0.965 0.000 1.000
#> GSM71727 2 0.000 0.965 0.000 1.000
#> GSM71728 2 0.767 0.736 0.224 0.776
#> GSM71729 2 0.000 0.965 0.000 1.000
#> GSM71730 2 0.000 0.965 0.000 1.000
#> GSM71731 1 0.000 0.982 1.000 0.000
#> GSM71732 1 0.000 0.982 1.000 0.000
#> GSM71733 1 0.000 0.982 1.000 0.000
#> GSM71734 1 0.000 0.982 1.000 0.000
#> GSM71735 1 0.000 0.982 1.000 0.000
#> GSM71736 1 0.000 0.982 1.000 0.000
#> GSM71737 1 0.000 0.982 1.000 0.000
#> GSM71738 1 0.000 0.982 1.000 0.000
#> GSM71739 2 0.767 0.736 0.224 0.776
#> GSM71740 1 0.000 0.982 1.000 0.000
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> GSM71671 3 0.6286 0.612 0.000 0.464 0.536
#> GSM71672 3 0.6286 0.612 0.000 0.464 0.536
#> GSM71673 3 0.6286 0.612 0.000 0.464 0.536
#> GSM71674 3 0.6286 0.612 0.000 0.464 0.536
#> GSM71675 3 0.6286 0.612 0.000 0.464 0.536
#> GSM71676 3 0.6286 0.612 0.000 0.464 0.536
#> GSM71677 3 0.6286 0.612 0.000 0.464 0.536
#> GSM71678 2 0.6286 1.000 0.000 0.536 0.464
#> GSM71679 2 0.6286 1.000 0.000 0.536 0.464
#> GSM71680 3 0.0000 0.587 0.000 0.000 1.000
#> GSM71681 3 0.0000 0.587 0.000 0.000 1.000
#> GSM71682 2 0.6286 1.000 0.000 0.536 0.464
#> GSM71683 2 0.6286 1.000 0.000 0.536 0.464
#> GSM71684 3 0.1964 0.507 0.000 0.056 0.944
#> GSM71685 3 0.0000 0.587 0.000 0.000 1.000
#> GSM71686 2 0.6286 1.000 0.000 0.536 0.464
#> GSM71687 2 0.6286 1.000 0.000 0.536 0.464
#> GSM71688 2 0.6286 1.000 0.000 0.536 0.464
#> GSM71689 3 0.6274 0.612 0.000 0.456 0.544
#> GSM71690 2 0.6286 1.000 0.000 0.536 0.464
#> GSM71691 2 0.6286 1.000 0.000 0.536 0.464
#> GSM71692 3 0.6286 0.612 0.000 0.464 0.536
#> GSM71693 2 0.6286 1.000 0.000 0.536 0.464
#> GSM71694 3 0.6274 0.612 0.000 0.456 0.544
#> GSM71695 2 0.6286 1.000 0.000 0.536 0.464
#> GSM71696 1 0.4346 0.763 0.816 0.000 0.184
#> GSM71697 1 0.0000 0.994 1.000 0.000 0.000
#> GSM71698 1 0.0000 0.994 1.000 0.000 0.000
#> GSM71699 1 0.0000 0.994 1.000 0.000 0.000
#> GSM71700 1 0.0000 0.994 1.000 0.000 0.000
#> GSM71701 1 0.0000 0.994 1.000 0.000 0.000
#> GSM71702 1 0.0000 0.994 1.000 0.000 0.000
#> GSM71703 1 0.0000 0.994 1.000 0.000 0.000
#> GSM71704 1 0.0000 0.994 1.000 0.000 0.000
#> GSM71705 1 0.0000 0.994 1.000 0.000 0.000
#> GSM71706 1 0.0000 0.994 1.000 0.000 0.000
#> GSM71707 1 0.0000 0.994 1.000 0.000 0.000
#> GSM71708 1 0.0000 0.994 1.000 0.000 0.000
#> GSM71709 3 0.0000 0.587 0.000 0.000 1.000
#> GSM71710 1 0.0000 0.994 1.000 0.000 0.000
#> GSM71711 1 0.0000 0.994 1.000 0.000 0.000
#> GSM71712 3 0.1765 0.539 0.004 0.040 0.956
#> GSM71713 3 0.5901 0.194 0.192 0.040 0.768
#> GSM71714 1 0.0000 0.994 1.000 0.000 0.000
#> GSM71715 3 0.2806 0.532 0.032 0.040 0.928
#> GSM71716 1 0.0000 0.994 1.000 0.000 0.000
#> GSM71717 1 0.0000 0.994 1.000 0.000 0.000
#> GSM71718 1 0.0000 0.994 1.000 0.000 0.000
#> GSM71719 1 0.0000 0.994 1.000 0.000 0.000
#> GSM71720 1 0.0000 0.994 1.000 0.000 0.000
#> GSM71721 1 0.0000 0.994 1.000 0.000 0.000
#> GSM71722 1 0.0000 0.994 1.000 0.000 0.000
#> GSM71723 1 0.0000 0.994 1.000 0.000 0.000
#> GSM71724 1 0.0000 0.994 1.000 0.000 0.000
#> GSM71725 3 0.1765 0.539 0.004 0.040 0.956
#> GSM71726 3 0.0237 0.587 0.004 0.000 0.996
#> GSM71727 3 0.0000 0.587 0.000 0.000 1.000
#> GSM71728 3 0.1765 0.539 0.004 0.040 0.956
#> GSM71729 3 0.0000 0.587 0.000 0.000 1.000
#> GSM71730 3 0.0000 0.587 0.000 0.000 1.000
#> GSM71731 1 0.0000 0.994 1.000 0.000 0.000
#> GSM71732 1 0.0000 0.994 1.000 0.000 0.000
#> GSM71733 1 0.0000 0.994 1.000 0.000 0.000
#> GSM71734 1 0.0000 0.994 1.000 0.000 0.000
#> GSM71735 1 0.0000 0.994 1.000 0.000 0.000
#> GSM71736 1 0.0000 0.994 1.000 0.000 0.000
#> GSM71737 1 0.0000 0.994 1.000 0.000 0.000
#> GSM71738 1 0.0000 0.994 1.000 0.000 0.000
#> GSM71739 3 0.2096 0.518 0.004 0.052 0.944
#> GSM71740 1 0.0000 0.994 1.000 0.000 0.000
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> GSM71671 3 0.0000 1.000 0.000 0.000 1 0.000
#> GSM71672 3 0.0000 1.000 0.000 0.000 1 0.000
#> GSM71673 3 0.0000 1.000 0.000 0.000 1 0.000
#> GSM71674 3 0.0000 1.000 0.000 0.000 1 0.000
#> GSM71675 3 0.0000 1.000 0.000 0.000 1 0.000
#> GSM71676 3 0.0000 1.000 0.000 0.000 1 0.000
#> GSM71677 3 0.0000 1.000 0.000 0.000 1 0.000
#> GSM71678 2 0.0188 0.980 0.000 0.996 0 0.004
#> GSM71679 2 0.0188 0.980 0.000 0.996 0 0.004
#> GSM71680 4 0.0000 0.848 0.000 0.000 0 1.000
#> GSM71681 4 0.3801 0.678 0.000 0.220 0 0.780
#> GSM71682 2 0.0188 0.980 0.000 0.996 0 0.004
#> GSM71683 2 0.0188 0.980 0.000 0.996 0 0.004
#> GSM71684 4 0.3764 0.683 0.000 0.216 0 0.784
#> GSM71685 4 0.3801 0.678 0.000 0.220 0 0.780
#> GSM71686 2 0.0188 0.980 0.000 0.996 0 0.004
#> GSM71687 2 0.0592 0.970 0.000 0.984 0 0.016
#> GSM71688 2 0.2921 0.835 0.000 0.860 0 0.140
#> GSM71689 3 0.0000 1.000 0.000 0.000 1 0.000
#> GSM71690 2 0.0188 0.980 0.000 0.996 0 0.004
#> GSM71691 2 0.0000 0.978 0.000 1.000 0 0.000
#> GSM71692 3 0.0000 1.000 0.000 0.000 1 0.000
#> GSM71693 2 0.0592 0.970 0.000 0.984 0 0.016
#> GSM71694 3 0.0000 1.000 0.000 0.000 1 0.000
#> GSM71695 2 0.0336 0.975 0.000 0.992 0 0.008
#> GSM71696 1 0.4877 0.646 0.752 0.044 0 0.204
#> GSM71697 1 0.0000 0.991 1.000 0.000 0 0.000
#> GSM71698 1 0.0000 0.991 1.000 0.000 0 0.000
#> GSM71699 1 0.0000 0.991 1.000 0.000 0 0.000
#> GSM71700 1 0.0000 0.991 1.000 0.000 0 0.000
#> GSM71701 1 0.0000 0.991 1.000 0.000 0 0.000
#> GSM71702 1 0.0000 0.991 1.000 0.000 0 0.000
#> GSM71703 1 0.0000 0.991 1.000 0.000 0 0.000
#> GSM71704 1 0.0000 0.991 1.000 0.000 0 0.000
#> GSM71705 1 0.0000 0.991 1.000 0.000 0 0.000
#> GSM71706 1 0.0000 0.991 1.000 0.000 0 0.000
#> GSM71707 1 0.0000 0.991 1.000 0.000 0 0.000
#> GSM71708 1 0.0000 0.991 1.000 0.000 0 0.000
#> GSM71709 4 0.0000 0.848 0.000 0.000 0 1.000
#> GSM71710 1 0.0000 0.991 1.000 0.000 0 0.000
#> GSM71711 1 0.0000 0.991 1.000 0.000 0 0.000
#> GSM71712 4 0.1109 0.838 0.028 0.004 0 0.968
#> GSM71713 4 0.6203 0.474 0.340 0.068 0 0.592
#> GSM71714 1 0.0000 0.991 1.000 0.000 0 0.000
#> GSM71715 4 0.6203 0.474 0.340 0.068 0 0.592
#> GSM71716 1 0.0000 0.991 1.000 0.000 0 0.000
#> GSM71717 1 0.0000 0.991 1.000 0.000 0 0.000
#> GSM71718 1 0.0000 0.991 1.000 0.000 0 0.000
#> GSM71719 1 0.0707 0.971 0.980 0.020 0 0.000
#> GSM71720 1 0.0000 0.991 1.000 0.000 0 0.000
#> GSM71721 1 0.0000 0.991 1.000 0.000 0 0.000
#> GSM71722 1 0.0000 0.991 1.000 0.000 0 0.000
#> GSM71723 1 0.0000 0.991 1.000 0.000 0 0.000
#> GSM71724 1 0.0000 0.991 1.000 0.000 0 0.000
#> GSM71725 4 0.2996 0.807 0.044 0.064 0 0.892
#> GSM71726 4 0.0000 0.848 0.000 0.000 0 1.000
#> GSM71727 4 0.0000 0.848 0.000 0.000 0 1.000
#> GSM71728 4 0.0188 0.847 0.000 0.004 0 0.996
#> GSM71729 4 0.0000 0.848 0.000 0.000 0 1.000
#> GSM71730 4 0.0000 0.848 0.000 0.000 0 1.000
#> GSM71731 1 0.0000 0.991 1.000 0.000 0 0.000
#> GSM71732 1 0.0000 0.991 1.000 0.000 0 0.000
#> GSM71733 1 0.0000 0.991 1.000 0.000 0 0.000
#> GSM71734 1 0.0000 0.991 1.000 0.000 0 0.000
#> GSM71735 1 0.0000 0.991 1.000 0.000 0 0.000
#> GSM71736 1 0.0000 0.991 1.000 0.000 0 0.000
#> GSM71737 1 0.0000 0.991 1.000 0.000 0 0.000
#> GSM71738 1 0.0000 0.991 1.000 0.000 0 0.000
#> GSM71739 4 0.3071 0.805 0.044 0.068 0 0.888
#> GSM71740 1 0.0000 0.991 1.000 0.000 0 0.000
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> GSM71671 3 0.0000 1.000 0.000 0.000 1 0.000 0.000
#> GSM71672 3 0.0000 1.000 0.000 0.000 1 0.000 0.000
#> GSM71673 3 0.0000 1.000 0.000 0.000 1 0.000 0.000
#> GSM71674 3 0.0000 1.000 0.000 0.000 1 0.000 0.000
#> GSM71675 3 0.0000 1.000 0.000 0.000 1 0.000 0.000
#> GSM71676 3 0.0000 1.000 0.000 0.000 1 0.000 0.000
#> GSM71677 3 0.0000 1.000 0.000 0.000 1 0.000 0.000
#> GSM71678 2 0.0000 0.964 0.000 1.000 0 0.000 0.000
#> GSM71679 2 0.0000 0.964 0.000 1.000 0 0.000 0.000
#> GSM71680 4 0.0000 0.883 0.000 0.000 0 1.000 0.000
#> GSM71681 4 0.2852 0.793 0.000 0.172 0 0.828 0.000
#> GSM71682 2 0.0000 0.964 0.000 1.000 0 0.000 0.000
#> GSM71683 2 0.0000 0.964 0.000 1.000 0 0.000 0.000
#> GSM71684 4 0.2966 0.780 0.000 0.184 0 0.816 0.000
#> GSM71685 4 0.2852 0.793 0.000 0.172 0 0.828 0.000
#> GSM71686 2 0.0000 0.964 0.000 1.000 0 0.000 0.000
#> GSM71687 2 0.0000 0.964 0.000 1.000 0 0.000 0.000
#> GSM71688 2 0.3796 0.508 0.000 0.700 0 0.300 0.000
#> GSM71689 3 0.0000 1.000 0.000 0.000 1 0.000 0.000
#> GSM71690 2 0.0000 0.964 0.000 1.000 0 0.000 0.000
#> GSM71691 2 0.0000 0.964 0.000 1.000 0 0.000 0.000
#> GSM71692 3 0.0000 1.000 0.000 0.000 1 0.000 0.000
#> GSM71693 2 0.0162 0.961 0.000 0.996 0 0.000 0.004
#> GSM71694 3 0.0000 1.000 0.000 0.000 1 0.000 0.000
#> GSM71695 2 0.0162 0.961 0.000 0.996 0 0.000 0.004
#> GSM71696 1 0.5309 0.434 0.576 0.000 0 0.060 0.364
#> GSM71697 1 0.4045 0.709 0.644 0.000 0 0.000 0.356
#> GSM71698 1 0.2329 0.860 0.876 0.000 0 0.000 0.124
#> GSM71699 1 0.0290 0.862 0.992 0.000 0 0.000 0.008
#> GSM71700 1 0.2329 0.860 0.876 0.000 0 0.000 0.124
#> GSM71701 1 0.0404 0.861 0.988 0.000 0 0.000 0.012
#> GSM71702 1 0.2329 0.860 0.876 0.000 0 0.000 0.124
#> GSM71703 1 0.2605 0.809 0.852 0.000 0 0.000 0.148
#> GSM71704 1 0.0963 0.854 0.964 0.000 0 0.000 0.036
#> GSM71705 1 0.2329 0.860 0.876 0.000 0 0.000 0.124
#> GSM71706 1 0.0963 0.854 0.964 0.000 0 0.000 0.036
#> GSM71707 1 0.2377 0.861 0.872 0.000 0 0.000 0.128
#> GSM71708 1 0.0963 0.854 0.964 0.000 0 0.000 0.036
#> GSM71709 4 0.0000 0.883 0.000 0.000 0 1.000 0.000
#> GSM71710 1 0.2648 0.801 0.848 0.000 0 0.000 0.152
#> GSM71711 1 0.2329 0.860 0.876 0.000 0 0.000 0.124
#> GSM71712 5 0.3421 0.831 0.008 0.000 0 0.204 0.788
#> GSM71713 5 0.3370 0.834 0.028 0.000 0 0.148 0.824
#> GSM71714 1 0.0162 0.861 0.996 0.000 0 0.000 0.004
#> GSM71715 5 0.3648 0.844 0.008 0.024 0 0.156 0.812
#> GSM71716 1 0.3816 0.645 0.696 0.000 0 0.000 0.304
#> GSM71717 1 0.1270 0.852 0.948 0.000 0 0.000 0.052
#> GSM71718 1 0.3932 0.736 0.672 0.000 0 0.000 0.328
#> GSM71719 1 0.4268 0.587 0.556 0.000 0 0.000 0.444
#> GSM71720 1 0.4182 0.649 0.600 0.000 0 0.000 0.400
#> GSM71721 1 0.2377 0.860 0.872 0.000 0 0.000 0.128
#> GSM71722 1 0.2329 0.860 0.876 0.000 0 0.000 0.124
#> GSM71723 1 0.2329 0.860 0.876 0.000 0 0.000 0.124
#> GSM71724 1 0.0162 0.861 0.996 0.000 0 0.000 0.004
#> GSM71725 5 0.2971 0.845 0.008 0.000 0 0.156 0.836
#> GSM71726 4 0.1341 0.839 0.000 0.000 0 0.944 0.056
#> GSM71727 4 0.0000 0.883 0.000 0.000 0 1.000 0.000
#> GSM71728 5 0.4287 0.443 0.000 0.000 0 0.460 0.540
#> GSM71729 4 0.0000 0.883 0.000 0.000 0 1.000 0.000
#> GSM71730 4 0.0000 0.883 0.000 0.000 0 1.000 0.000
#> GSM71731 1 0.2377 0.860 0.872 0.000 0 0.000 0.128
#> GSM71732 1 0.2329 0.860 0.876 0.000 0 0.000 0.124
#> GSM71733 1 0.2329 0.860 0.876 0.000 0 0.000 0.124
#> GSM71734 1 0.0290 0.861 0.992 0.000 0 0.000 0.008
#> GSM71735 1 0.0703 0.857 0.976 0.000 0 0.000 0.024
#> GSM71736 1 0.0703 0.857 0.976 0.000 0 0.000 0.024
#> GSM71737 1 0.1270 0.852 0.948 0.000 0 0.000 0.052
#> GSM71738 1 0.2020 0.834 0.900 0.000 0 0.000 0.100
#> GSM71739 5 0.5578 0.702 0.000 0.176 0 0.180 0.644
#> GSM71740 1 0.3730 0.686 0.712 0.000 0 0.000 0.288
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> GSM71671 3 0.0000 0.9959 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM71672 3 0.0000 0.9959 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM71673 3 0.0000 0.9959 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM71674 3 0.0000 0.9959 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM71675 3 0.0000 0.9959 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM71676 3 0.0146 0.9955 0.000 0.000 0.996 0.000 0.004 0.000
#> GSM71677 3 0.0146 0.9955 0.000 0.000 0.996 0.000 0.004 0.000
#> GSM71678 2 0.1444 0.8992 0.000 0.928 0.000 0.072 0.000 0.000
#> GSM71679 2 0.1444 0.8992 0.000 0.928 0.000 0.072 0.000 0.000
#> GSM71680 4 0.2830 0.6784 0.000 0.000 0.000 0.836 0.144 0.020
#> GSM71681 4 0.3899 0.5281 0.000 0.364 0.000 0.628 0.000 0.008
#> GSM71682 2 0.1588 0.8983 0.000 0.924 0.000 0.072 0.000 0.004
#> GSM71683 2 0.0000 0.9058 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM71684 4 0.4189 0.3757 0.000 0.436 0.000 0.552 0.008 0.004
#> GSM71685 4 0.3887 0.5342 0.000 0.360 0.000 0.632 0.000 0.008
#> GSM71686 2 0.1501 0.8991 0.000 0.924 0.000 0.076 0.000 0.000
#> GSM71687 2 0.0862 0.9023 0.000 0.972 0.000 0.008 0.004 0.016
#> GSM71688 2 0.1462 0.8682 0.000 0.936 0.000 0.056 0.000 0.008
#> GSM71689 3 0.0508 0.9901 0.000 0.000 0.984 0.004 0.012 0.000
#> GSM71690 2 0.0260 0.9059 0.000 0.992 0.000 0.008 0.000 0.000
#> GSM71691 2 0.3161 0.7569 0.000 0.776 0.000 0.000 0.008 0.216
#> GSM71692 3 0.0260 0.9942 0.000 0.000 0.992 0.000 0.008 0.000
#> GSM71693 2 0.0551 0.9057 0.000 0.984 0.000 0.008 0.004 0.004
#> GSM71694 3 0.0508 0.9901 0.000 0.000 0.984 0.004 0.012 0.000
#> GSM71695 2 0.3245 0.7446 0.000 0.764 0.000 0.000 0.008 0.228
#> GSM71696 1 0.5498 -0.3552 0.464 0.000 0.000 0.000 0.128 0.408
#> GSM71697 1 0.3201 0.4022 0.780 0.000 0.000 0.000 0.012 0.208
#> GSM71698 1 0.0146 0.5903 0.996 0.000 0.000 0.000 0.000 0.004
#> GSM71699 1 0.3531 -0.1657 0.672 0.000 0.000 0.000 0.000 0.328
#> GSM71700 1 0.0000 0.5912 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM71701 1 0.3927 -0.1811 0.644 0.000 0.000 0.000 0.012 0.344
#> GSM71702 1 0.0547 0.5835 0.980 0.000 0.000 0.000 0.000 0.020
#> GSM71703 6 0.3955 0.6898 0.436 0.000 0.000 0.000 0.004 0.560
#> GSM71704 6 0.3838 0.7719 0.448 0.000 0.000 0.000 0.000 0.552
#> GSM71705 1 0.1075 0.5605 0.952 0.000 0.000 0.000 0.000 0.048
#> GSM71706 6 0.3747 0.7937 0.396 0.000 0.000 0.000 0.000 0.604
#> GSM71707 1 0.2912 0.3750 0.784 0.000 0.000 0.000 0.000 0.216
#> GSM71708 6 0.3823 0.7314 0.436 0.000 0.000 0.000 0.000 0.564
#> GSM71709 4 0.2667 0.6858 0.000 0.000 0.000 0.852 0.128 0.020
#> GSM71710 6 0.4051 0.6820 0.432 0.000 0.000 0.000 0.008 0.560
#> GSM71711 1 0.1267 0.5814 0.940 0.000 0.000 0.000 0.000 0.060
#> GSM71712 5 0.2393 0.7277 0.004 0.000 0.000 0.092 0.884 0.020
#> GSM71713 5 0.3998 0.6575 0.040 0.000 0.000 0.000 0.712 0.248
#> GSM71714 1 0.3592 -0.1595 0.656 0.000 0.000 0.000 0.000 0.344
#> GSM71715 5 0.4220 0.6233 0.000 0.004 0.000 0.008 0.520 0.468
#> GSM71716 6 0.4305 0.6005 0.436 0.000 0.000 0.000 0.020 0.544
#> GSM71717 6 0.3695 0.7951 0.376 0.000 0.000 0.000 0.000 0.624
#> GSM71718 1 0.2730 0.4781 0.836 0.000 0.000 0.000 0.012 0.152
#> GSM71719 1 0.3695 0.3429 0.732 0.000 0.000 0.000 0.024 0.244
#> GSM71720 1 0.2968 0.4596 0.816 0.000 0.000 0.000 0.016 0.168
#> GSM71721 1 0.0146 0.5903 0.996 0.000 0.000 0.000 0.000 0.004
#> GSM71722 1 0.0000 0.5912 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM71723 1 0.1327 0.5734 0.936 0.000 0.000 0.000 0.000 0.064
#> GSM71724 1 0.3592 -0.1595 0.656 0.000 0.000 0.000 0.000 0.344
#> GSM71725 5 0.1897 0.7424 0.004 0.000 0.000 0.004 0.908 0.084
#> GSM71726 5 0.3404 0.5372 0.000 0.000 0.000 0.224 0.760 0.016
#> GSM71727 4 0.1663 0.7083 0.000 0.000 0.000 0.912 0.088 0.000
#> GSM71728 5 0.2362 0.7014 0.000 0.000 0.000 0.136 0.860 0.004
#> GSM71729 4 0.1444 0.7089 0.000 0.000 0.000 0.928 0.072 0.000
#> GSM71730 4 0.1444 0.7089 0.000 0.000 0.000 0.928 0.072 0.000
#> GSM71731 1 0.1007 0.5869 0.956 0.000 0.000 0.000 0.000 0.044
#> GSM71732 1 0.0000 0.5912 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM71733 1 0.1075 0.5830 0.952 0.000 0.000 0.000 0.000 0.048
#> GSM71734 1 0.3684 -0.2481 0.628 0.000 0.000 0.000 0.000 0.372
#> GSM71735 1 0.3797 -0.3786 0.580 0.000 0.000 0.000 0.000 0.420
#> GSM71736 1 0.3797 -0.3786 0.580 0.000 0.000 0.000 0.000 0.420
#> GSM71737 6 0.3695 0.7978 0.376 0.000 0.000 0.000 0.000 0.624
#> GSM71738 6 0.3857 0.7260 0.468 0.000 0.000 0.000 0.000 0.532
#> GSM71739 5 0.4859 0.6439 0.000 0.008 0.000 0.056 0.604 0.332
#> GSM71740 1 0.3998 0.0864 0.644 0.000 0.000 0.000 0.016 0.340
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) k
#> SD:mclust 69 5.37e-09 2
#> SD:mclust 69 1.81e-12 3
#> SD:mclust 68 7.84e-18 4
#> SD:mclust 68 3.14e-17 5
#> SD:mclust 55 1.17e-12 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 21168 rows and 70 columns.
#> Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'SD' method.
#> Subgroups are detected by 'NMF' method.
#> Performed in total 1250 partitions by row resampling.
#> Best k for subgroups seems to be 4.
#>
#> Following methods can be applied to this 'ConsensusPartition' object:
#> [1] "cola_report" "collect_classes" "collect_plots"
#> [4] "collect_stats" "colnames" "compare_signatures"
#> [7] "consensus_heatmap" "dimension_reduction" "functional_enrichment"
#> [10] "get_anno_col" "get_anno" "get_classes"
#> [13] "get_consensus" "get_matrix" "get_membership"
#> [16] "get_param" "get_signatures" "get_stats"
#> [19] "is_best_k" "is_stable_k" "membership_heatmap"
#> [22] "ncol" "nrow" "plot_ecdf"
#> [25] "rownames" "select_partition_number" "show"
#> [28] "suggest_best_k" "test_to_known_factors"
collect_plots()
function collects all the plots made from res
for all k
(number of partitions)
into one single page to provide an easy and fast comparison between different k
.
collect_plots(res)
The plots are:
k
and the heatmap of
predicted classes for each k
.k
.k
.k
.All the plots in panels can be made by individual functions and they are plotted later in this section.
select_partition_number()
produces several plots showing different
statistics for choosing “optimized” k
. There are following statistics:
k
;k
, the area increased is defined as \(A_k - A_{k-1}\).The detailed explanations of these statistics can be found in the cola vignette.
Generally speaking, lower PAC score, higher mean silhouette score or higher
concordance corresponds to better partition. Rand index and Jaccard index
measure how similar the current partition is compared to partition with k-1
.
If they are too similar, we won't accept k
is better than k-1
.
select_partition_number(res)
The numeric values for all these statistics can be obtained by get_stats()
.
get_stats(res)
#> k 1-PAC mean_silhouette concordance area_increased Rand Jaccard
#> 2 2 1.000 0.996 0.998 0.4934 0.508 0.508
#> 3 3 1.000 0.959 0.982 0.2384 0.807 0.648
#> 4 4 1.000 0.947 0.974 0.0795 0.944 0.858
#> 5 5 0.780 0.728 0.845 0.1156 0.982 0.946
#> 6 6 0.734 0.672 0.841 0.0452 0.922 0.758
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
#> GSM71671 2 0.000 1.000 0.000 1.000
#> GSM71672 2 0.000 1.000 0.000 1.000
#> GSM71673 2 0.000 1.000 0.000 1.000
#> GSM71674 2 0.000 1.000 0.000 1.000
#> GSM71675 2 0.000 1.000 0.000 1.000
#> GSM71676 2 0.000 1.000 0.000 1.000
#> GSM71677 2 0.000 1.000 0.000 1.000
#> GSM71678 2 0.000 1.000 0.000 1.000
#> GSM71679 2 0.000 1.000 0.000 1.000
#> GSM71680 2 0.000 1.000 0.000 1.000
#> GSM71681 2 0.000 1.000 0.000 1.000
#> GSM71682 2 0.000 1.000 0.000 1.000
#> GSM71683 2 0.000 1.000 0.000 1.000
#> GSM71684 2 0.000 1.000 0.000 1.000
#> GSM71685 2 0.000 1.000 0.000 1.000
#> GSM71686 2 0.000 1.000 0.000 1.000
#> GSM71687 2 0.000 1.000 0.000 1.000
#> GSM71688 2 0.000 1.000 0.000 1.000
#> GSM71689 2 0.000 1.000 0.000 1.000
#> GSM71690 2 0.000 1.000 0.000 1.000
#> GSM71691 2 0.000 1.000 0.000 1.000
#> GSM71692 2 0.000 1.000 0.000 1.000
#> GSM71693 2 0.000 1.000 0.000 1.000
#> GSM71694 2 0.000 1.000 0.000 1.000
#> GSM71695 2 0.000 1.000 0.000 1.000
#> GSM71696 1 0.000 0.997 1.000 0.000
#> GSM71697 1 0.000 0.997 1.000 0.000
#> GSM71698 1 0.000 0.997 1.000 0.000
#> GSM71699 1 0.000 0.997 1.000 0.000
#> GSM71700 1 0.000 0.997 1.000 0.000
#> GSM71701 1 0.000 0.997 1.000 0.000
#> GSM71702 1 0.000 0.997 1.000 0.000
#> GSM71703 1 0.000 0.997 1.000 0.000
#> GSM71704 1 0.000 0.997 1.000 0.000
#> GSM71705 1 0.000 0.997 1.000 0.000
#> GSM71706 1 0.000 0.997 1.000 0.000
#> GSM71707 1 0.000 0.997 1.000 0.000
#> GSM71708 1 0.000 0.997 1.000 0.000
#> GSM71709 2 0.000 1.000 0.000 1.000
#> GSM71710 1 0.000 0.997 1.000 0.000
#> GSM71711 1 0.000 0.997 1.000 0.000
#> GSM71712 1 0.000 0.997 1.000 0.000
#> GSM71713 1 0.000 0.997 1.000 0.000
#> GSM71714 1 0.000 0.997 1.000 0.000
#> GSM71715 1 0.000 0.997 1.000 0.000
#> GSM71716 1 0.000 0.997 1.000 0.000
#> GSM71717 1 0.000 0.997 1.000 0.000
#> GSM71718 1 0.000 0.997 1.000 0.000
#> GSM71719 1 0.000 0.997 1.000 0.000
#> GSM71720 1 0.000 0.997 1.000 0.000
#> GSM71721 1 0.000 0.997 1.000 0.000
#> GSM71722 1 0.000 0.997 1.000 0.000
#> GSM71723 1 0.000 0.997 1.000 0.000
#> GSM71724 1 0.000 0.997 1.000 0.000
#> GSM71725 1 0.000 0.997 1.000 0.000
#> GSM71726 1 0.000 0.997 1.000 0.000
#> GSM71727 2 0.000 1.000 0.000 1.000
#> GSM71728 1 0.000 0.997 1.000 0.000
#> GSM71729 2 0.000 1.000 0.000 1.000
#> GSM71730 2 0.000 1.000 0.000 1.000
#> GSM71731 1 0.000 0.997 1.000 0.000
#> GSM71732 1 0.000 0.997 1.000 0.000
#> GSM71733 1 0.000 0.997 1.000 0.000
#> GSM71734 1 0.000 0.997 1.000 0.000
#> GSM71735 1 0.000 0.997 1.000 0.000
#> GSM71736 1 0.000 0.997 1.000 0.000
#> GSM71737 1 0.000 0.997 1.000 0.000
#> GSM71738 1 0.000 0.997 1.000 0.000
#> GSM71739 1 0.563 0.848 0.868 0.132
#> GSM71740 1 0.000 0.997 1.000 0.000
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> GSM71671 3 0.0000 1.000 0.000 0.000 1.000
#> GSM71672 3 0.0000 1.000 0.000 0.000 1.000
#> GSM71673 3 0.0000 1.000 0.000 0.000 1.000
#> GSM71674 3 0.0000 1.000 0.000 0.000 1.000
#> GSM71675 3 0.0000 1.000 0.000 0.000 1.000
#> GSM71676 3 0.0000 1.000 0.000 0.000 1.000
#> GSM71677 3 0.0000 1.000 0.000 0.000 1.000
#> GSM71678 2 0.0000 0.949 0.000 1.000 0.000
#> GSM71679 2 0.0000 0.949 0.000 1.000 0.000
#> GSM71680 2 0.0747 0.948 0.000 0.984 0.016
#> GSM71681 2 0.1031 0.943 0.000 0.976 0.024
#> GSM71682 2 0.0000 0.949 0.000 1.000 0.000
#> GSM71683 2 0.0592 0.949 0.000 0.988 0.012
#> GSM71684 2 0.0000 0.949 0.000 1.000 0.000
#> GSM71685 2 0.1860 0.922 0.000 0.948 0.052
#> GSM71686 2 0.0000 0.949 0.000 1.000 0.000
#> GSM71687 2 0.0592 0.949 0.000 0.988 0.012
#> GSM71688 2 0.0592 0.949 0.000 0.988 0.012
#> GSM71689 3 0.0000 1.000 0.000 0.000 1.000
#> GSM71690 2 0.0592 0.949 0.000 0.988 0.012
#> GSM71691 2 0.6215 0.310 0.000 0.572 0.428
#> GSM71692 3 0.0000 1.000 0.000 0.000 1.000
#> GSM71693 2 0.0747 0.947 0.000 0.984 0.016
#> GSM71694 3 0.0000 1.000 0.000 0.000 1.000
#> GSM71695 2 0.6225 0.298 0.000 0.568 0.432
#> GSM71696 1 0.0000 0.997 1.000 0.000 0.000
#> GSM71697 1 0.0000 0.997 1.000 0.000 0.000
#> GSM71698 1 0.0000 0.997 1.000 0.000 0.000
#> GSM71699 1 0.0000 0.997 1.000 0.000 0.000
#> GSM71700 1 0.0000 0.997 1.000 0.000 0.000
#> GSM71701 1 0.0000 0.997 1.000 0.000 0.000
#> GSM71702 1 0.0000 0.997 1.000 0.000 0.000
#> GSM71703 1 0.0000 0.997 1.000 0.000 0.000
#> GSM71704 1 0.0000 0.997 1.000 0.000 0.000
#> GSM71705 1 0.0000 0.997 1.000 0.000 0.000
#> GSM71706 1 0.0000 0.997 1.000 0.000 0.000
#> GSM71707 1 0.0000 0.997 1.000 0.000 0.000
#> GSM71708 1 0.0000 0.997 1.000 0.000 0.000
#> GSM71709 2 0.0592 0.949 0.000 0.988 0.012
#> GSM71710 1 0.0000 0.997 1.000 0.000 0.000
#> GSM71711 1 0.0000 0.997 1.000 0.000 0.000
#> GSM71712 2 0.0592 0.941 0.012 0.988 0.000
#> GSM71713 1 0.2959 0.879 0.900 0.100 0.000
#> GSM71714 1 0.0000 0.997 1.000 0.000 0.000
#> GSM71715 1 0.0000 0.997 1.000 0.000 0.000
#> GSM71716 1 0.0000 0.997 1.000 0.000 0.000
#> GSM71717 1 0.0000 0.997 1.000 0.000 0.000
#> GSM71718 1 0.0000 0.997 1.000 0.000 0.000
#> GSM71719 1 0.0000 0.997 1.000 0.000 0.000
#> GSM71720 1 0.0000 0.997 1.000 0.000 0.000
#> GSM71721 1 0.0000 0.997 1.000 0.000 0.000
#> GSM71722 1 0.0000 0.997 1.000 0.000 0.000
#> GSM71723 1 0.0000 0.997 1.000 0.000 0.000
#> GSM71724 1 0.0000 0.997 1.000 0.000 0.000
#> GSM71725 2 0.1529 0.913 0.040 0.960 0.000
#> GSM71726 2 0.0000 0.949 0.000 1.000 0.000
#> GSM71727 2 0.0000 0.949 0.000 1.000 0.000
#> GSM71728 2 0.0000 0.949 0.000 1.000 0.000
#> GSM71729 2 0.0000 0.949 0.000 1.000 0.000
#> GSM71730 2 0.0592 0.949 0.000 0.988 0.012
#> GSM71731 1 0.0000 0.997 1.000 0.000 0.000
#> GSM71732 1 0.0000 0.997 1.000 0.000 0.000
#> GSM71733 1 0.0000 0.997 1.000 0.000 0.000
#> GSM71734 1 0.0000 0.997 1.000 0.000 0.000
#> GSM71735 1 0.0000 0.997 1.000 0.000 0.000
#> GSM71736 1 0.0000 0.997 1.000 0.000 0.000
#> GSM71737 1 0.0000 0.997 1.000 0.000 0.000
#> GSM71738 1 0.0000 0.997 1.000 0.000 0.000
#> GSM71739 2 0.1765 0.913 0.040 0.956 0.004
#> GSM71740 1 0.0000 0.997 1.000 0.000 0.000
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> GSM71671 3 0.0336 0.976 0.000 0.000 0.992 0.008
#> GSM71672 3 0.0000 0.978 0.000 0.000 1.000 0.000
#> GSM71673 3 0.0188 0.978 0.000 0.000 0.996 0.004
#> GSM71674 3 0.0336 0.976 0.000 0.000 0.992 0.008
#> GSM71675 3 0.0188 0.979 0.000 0.004 0.996 0.000
#> GSM71676 3 0.0376 0.979 0.000 0.004 0.992 0.004
#> GSM71677 3 0.0707 0.975 0.000 0.020 0.980 0.000
#> GSM71678 2 0.1211 0.937 0.000 0.960 0.000 0.040
#> GSM71679 2 0.1118 0.938 0.000 0.964 0.000 0.036
#> GSM71680 4 0.1302 0.862 0.000 0.000 0.044 0.956
#> GSM71681 2 0.1635 0.934 0.000 0.948 0.008 0.044
#> GSM71682 2 0.1302 0.935 0.000 0.956 0.000 0.044
#> GSM71683 2 0.0188 0.940 0.000 0.996 0.004 0.000
#> GSM71684 2 0.1302 0.935 0.000 0.956 0.000 0.044
#> GSM71685 2 0.5174 0.387 0.000 0.620 0.012 0.368
#> GSM71686 2 0.1211 0.937 0.000 0.960 0.000 0.040
#> GSM71687 2 0.0188 0.940 0.000 0.996 0.004 0.000
#> GSM71688 2 0.0336 0.940 0.000 0.992 0.008 0.000
#> GSM71689 3 0.1557 0.955 0.000 0.056 0.944 0.000
#> GSM71690 2 0.0000 0.941 0.000 1.000 0.000 0.000
#> GSM71691 2 0.1211 0.920 0.000 0.960 0.040 0.000
#> GSM71692 3 0.1118 0.968 0.000 0.036 0.964 0.000
#> GSM71693 2 0.0336 0.939 0.000 0.992 0.008 0.000
#> GSM71694 3 0.1557 0.955 0.000 0.056 0.944 0.000
#> GSM71695 2 0.1211 0.920 0.000 0.960 0.040 0.000
#> GSM71696 1 0.0000 0.997 1.000 0.000 0.000 0.000
#> GSM71697 1 0.0000 0.997 1.000 0.000 0.000 0.000
#> GSM71698 1 0.0188 0.994 0.996 0.000 0.000 0.004
#> GSM71699 1 0.0000 0.997 1.000 0.000 0.000 0.000
#> GSM71700 1 0.0000 0.997 1.000 0.000 0.000 0.000
#> GSM71701 1 0.0000 0.997 1.000 0.000 0.000 0.000
#> GSM71702 1 0.0000 0.997 1.000 0.000 0.000 0.000
#> GSM71703 1 0.0000 0.997 1.000 0.000 0.000 0.000
#> GSM71704 1 0.0000 0.997 1.000 0.000 0.000 0.000
#> GSM71705 1 0.0000 0.997 1.000 0.000 0.000 0.000
#> GSM71706 1 0.0000 0.997 1.000 0.000 0.000 0.000
#> GSM71707 1 0.0000 0.997 1.000 0.000 0.000 0.000
#> GSM71708 1 0.0000 0.997 1.000 0.000 0.000 0.000
#> GSM71709 4 0.1109 0.875 0.000 0.004 0.028 0.968
#> GSM71710 1 0.0000 0.997 1.000 0.000 0.000 0.000
#> GSM71711 1 0.0000 0.997 1.000 0.000 0.000 0.000
#> GSM71712 4 0.1004 0.890 0.004 0.024 0.000 0.972
#> GSM71713 1 0.2149 0.899 0.912 0.000 0.000 0.088
#> GSM71714 1 0.0000 0.997 1.000 0.000 0.000 0.000
#> GSM71715 1 0.0000 0.997 1.000 0.000 0.000 0.000
#> GSM71716 1 0.0000 0.997 1.000 0.000 0.000 0.000
#> GSM71717 1 0.0000 0.997 1.000 0.000 0.000 0.000
#> GSM71718 1 0.0000 0.997 1.000 0.000 0.000 0.000
#> GSM71719 1 0.0000 0.997 1.000 0.000 0.000 0.000
#> GSM71720 1 0.0000 0.997 1.000 0.000 0.000 0.000
#> GSM71721 1 0.0188 0.994 0.996 0.000 0.000 0.004
#> GSM71722 1 0.0000 0.997 1.000 0.000 0.000 0.000
#> GSM71723 1 0.0000 0.997 1.000 0.000 0.000 0.000
#> GSM71724 1 0.0000 0.997 1.000 0.000 0.000 0.000
#> GSM71725 4 0.5448 0.587 0.244 0.056 0.000 0.700
#> GSM71726 4 0.0336 0.889 0.000 0.008 0.000 0.992
#> GSM71727 4 0.0592 0.891 0.000 0.016 0.000 0.984
#> GSM71728 4 0.0707 0.891 0.000 0.020 0.000 0.980
#> GSM71729 4 0.4331 0.569 0.000 0.288 0.000 0.712
#> GSM71730 4 0.1661 0.877 0.000 0.052 0.004 0.944
#> GSM71731 1 0.0000 0.997 1.000 0.000 0.000 0.000
#> GSM71732 1 0.0000 0.997 1.000 0.000 0.000 0.000
#> GSM71733 1 0.0000 0.997 1.000 0.000 0.000 0.000
#> GSM71734 1 0.0000 0.997 1.000 0.000 0.000 0.000
#> GSM71735 1 0.0000 0.997 1.000 0.000 0.000 0.000
#> GSM71736 1 0.0000 0.997 1.000 0.000 0.000 0.000
#> GSM71737 1 0.0000 0.997 1.000 0.000 0.000 0.000
#> GSM71738 1 0.0000 0.997 1.000 0.000 0.000 0.000
#> GSM71739 2 0.0707 0.929 0.020 0.980 0.000 0.000
#> GSM71740 1 0.0000 0.997 1.000 0.000 0.000 0.000
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> GSM71671 3 0.0324 0.9854 0.000 0.000 0.992 0.004 0.004
#> GSM71672 3 0.0000 0.9870 0.000 0.000 1.000 0.000 0.000
#> GSM71673 3 0.0000 0.9870 0.000 0.000 1.000 0.000 0.000
#> GSM71674 3 0.0451 0.9834 0.000 0.000 0.988 0.008 0.004
#> GSM71675 3 0.0000 0.9870 0.000 0.000 1.000 0.000 0.000
#> GSM71676 3 0.0451 0.9856 0.000 0.000 0.988 0.004 0.008
#> GSM71677 3 0.0451 0.9857 0.000 0.000 0.988 0.004 0.008
#> GSM71678 2 0.0404 0.9048 0.000 0.988 0.000 0.000 0.012
#> GSM71679 2 0.0404 0.9045 0.000 0.988 0.000 0.000 0.012
#> GSM71680 4 0.0912 0.8759 0.000 0.000 0.016 0.972 0.012
#> GSM71681 2 0.1914 0.8887 0.000 0.928 0.008 0.008 0.056
#> GSM71682 2 0.0880 0.9022 0.000 0.968 0.000 0.000 0.032
#> GSM71683 2 0.1282 0.8945 0.000 0.952 0.000 0.004 0.044
#> GSM71684 2 0.0290 0.9047 0.000 0.992 0.000 0.000 0.008
#> GSM71685 2 0.5181 0.3322 0.000 0.588 0.000 0.360 0.052
#> GSM71686 2 0.1851 0.8792 0.000 0.912 0.000 0.000 0.088
#> GSM71687 2 0.1544 0.8876 0.000 0.932 0.000 0.000 0.068
#> GSM71688 2 0.0510 0.9047 0.000 0.984 0.000 0.000 0.016
#> GSM71689 3 0.0833 0.9746 0.000 0.016 0.976 0.004 0.004
#> GSM71690 2 0.0404 0.9038 0.000 0.988 0.000 0.000 0.012
#> GSM71691 2 0.2393 0.8706 0.000 0.900 0.016 0.004 0.080
#> GSM71692 3 0.0162 0.9862 0.000 0.000 0.996 0.004 0.000
#> GSM71693 2 0.1443 0.8936 0.000 0.948 0.004 0.004 0.044
#> GSM71694 3 0.1739 0.9457 0.000 0.024 0.940 0.004 0.032
#> GSM71695 2 0.2728 0.8652 0.000 0.888 0.040 0.004 0.068
#> GSM71696 1 0.3816 0.7157 0.696 0.000 0.000 0.000 0.304
#> GSM71697 1 0.3796 0.7128 0.700 0.000 0.000 0.000 0.300
#> GSM71698 1 0.3814 0.2726 0.720 0.000 0.000 0.004 0.276
#> GSM71699 1 0.3452 0.3396 0.756 0.000 0.000 0.000 0.244
#> GSM71700 1 0.1908 0.6829 0.908 0.000 0.000 0.000 0.092
#> GSM71701 1 0.3561 0.3218 0.740 0.000 0.000 0.000 0.260
#> GSM71702 1 0.2966 0.4529 0.816 0.000 0.000 0.000 0.184
#> GSM71703 1 0.3003 0.4387 0.812 0.000 0.000 0.000 0.188
#> GSM71704 1 0.2648 0.4949 0.848 0.000 0.000 0.000 0.152
#> GSM71705 1 0.0794 0.6306 0.972 0.000 0.000 0.000 0.028
#> GSM71706 1 0.1410 0.6003 0.940 0.000 0.000 0.000 0.060
#> GSM71707 1 0.1270 0.6163 0.948 0.000 0.000 0.000 0.052
#> GSM71708 1 0.2280 0.5374 0.880 0.000 0.000 0.000 0.120
#> GSM71709 4 0.0807 0.8777 0.000 0.000 0.012 0.976 0.012
#> GSM71710 1 0.3816 0.7112 0.696 0.000 0.000 0.000 0.304
#> GSM71711 1 0.3707 0.7174 0.716 0.000 0.000 0.000 0.284
#> GSM71712 4 0.5098 0.6293 0.004 0.052 0.000 0.644 0.300
#> GSM71713 5 0.5665 0.2297 0.416 0.052 0.000 0.012 0.520
#> GSM71714 1 0.3707 0.7178 0.716 0.000 0.000 0.000 0.284
#> GSM71715 1 0.3966 0.6910 0.664 0.000 0.000 0.000 0.336
#> GSM71716 1 0.4015 0.6814 0.652 0.000 0.000 0.000 0.348
#> GSM71717 1 0.3895 0.7024 0.680 0.000 0.000 0.000 0.320
#> GSM71718 1 0.4114 0.6712 0.624 0.000 0.000 0.000 0.376
#> GSM71719 1 0.4138 0.6399 0.616 0.000 0.000 0.000 0.384
#> GSM71720 1 0.4060 0.6715 0.640 0.000 0.000 0.000 0.360
#> GSM71721 1 0.2719 0.6843 0.852 0.000 0.000 0.004 0.144
#> GSM71722 1 0.3452 0.7153 0.756 0.000 0.000 0.000 0.244
#> GSM71723 1 0.3774 0.7140 0.704 0.000 0.000 0.000 0.296
#> GSM71724 1 0.1043 0.6213 0.960 0.000 0.000 0.000 0.040
#> GSM71725 5 0.6522 -0.0241 0.092 0.064 0.000 0.248 0.596
#> GSM71726 4 0.0771 0.8822 0.000 0.004 0.000 0.976 0.020
#> GSM71727 4 0.0510 0.8848 0.000 0.016 0.000 0.984 0.000
#> GSM71728 4 0.3183 0.8166 0.000 0.016 0.000 0.828 0.156
#> GSM71729 4 0.3039 0.7615 0.000 0.152 0.000 0.836 0.012
#> GSM71730 4 0.0703 0.8839 0.000 0.024 0.000 0.976 0.000
#> GSM71731 1 0.3983 0.6877 0.660 0.000 0.000 0.000 0.340
#> GSM71732 1 0.3895 0.7112 0.680 0.000 0.000 0.000 0.320
#> GSM71733 1 0.3366 0.7193 0.768 0.000 0.000 0.000 0.232
#> GSM71734 1 0.1197 0.6468 0.952 0.000 0.000 0.000 0.048
#> GSM71735 1 0.3143 0.7167 0.796 0.000 0.000 0.000 0.204
#> GSM71736 1 0.2127 0.5541 0.892 0.000 0.000 0.000 0.108
#> GSM71737 1 0.3684 0.7180 0.720 0.000 0.000 0.000 0.280
#> GSM71738 1 0.0703 0.6580 0.976 0.000 0.000 0.000 0.024
#> GSM71739 2 0.4649 0.5550 0.064 0.716 0.000 0.000 0.220
#> GSM71740 1 0.3913 0.6996 0.676 0.000 0.000 0.000 0.324
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> GSM71671 3 0.0405 0.9693 0.000 0.000 0.988 0.000 0.008 0.004
#> GSM71672 3 0.0146 0.9708 0.000 0.000 0.996 0.000 0.004 0.000
#> GSM71673 3 0.0146 0.9708 0.000 0.000 0.996 0.000 0.004 0.000
#> GSM71674 3 0.0405 0.9693 0.000 0.000 0.988 0.000 0.008 0.004
#> GSM71675 3 0.0146 0.9708 0.000 0.000 0.996 0.000 0.000 0.004
#> GSM71676 3 0.0551 0.9677 0.000 0.004 0.984 0.000 0.008 0.004
#> GSM71677 3 0.0000 0.9710 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM71678 2 0.1116 0.8317 0.000 0.960 0.000 0.004 0.028 0.008
#> GSM71679 2 0.1152 0.8283 0.000 0.952 0.000 0.000 0.044 0.004
#> GSM71680 4 0.1148 0.8508 0.000 0.000 0.004 0.960 0.020 0.016
#> GSM71681 2 0.2895 0.7868 0.000 0.852 0.000 0.016 0.116 0.016
#> GSM71682 2 0.1714 0.8149 0.000 0.908 0.000 0.000 0.092 0.000
#> GSM71683 2 0.2135 0.7924 0.000 0.872 0.000 0.000 0.128 0.000
#> GSM71684 2 0.1124 0.8328 0.000 0.956 0.000 0.008 0.036 0.000
#> GSM71685 2 0.5122 0.5349 0.000 0.660 0.004 0.240 0.072 0.024
#> GSM71686 2 0.2697 0.7536 0.000 0.812 0.000 0.000 0.188 0.000
#> GSM71687 2 0.2593 0.7783 0.000 0.844 0.000 0.000 0.148 0.008
#> GSM71688 2 0.0790 0.8323 0.000 0.968 0.000 0.000 0.032 0.000
#> GSM71689 3 0.1003 0.9576 0.000 0.004 0.964 0.000 0.028 0.004
#> GSM71690 2 0.0632 0.8288 0.000 0.976 0.000 0.000 0.024 0.000
#> GSM71691 2 0.3507 0.6718 0.000 0.752 0.012 0.000 0.232 0.004
#> GSM71692 3 0.0632 0.9637 0.000 0.000 0.976 0.000 0.024 0.000
#> GSM71693 2 0.2482 0.7820 0.000 0.848 0.000 0.000 0.148 0.004
#> GSM71694 3 0.3232 0.8227 0.000 0.020 0.824 0.000 0.140 0.016
#> GSM71695 2 0.3509 0.6777 0.000 0.744 0.016 0.000 0.240 0.000
#> GSM71696 1 0.0547 0.7460 0.980 0.000 0.000 0.000 0.000 0.020
#> GSM71697 1 0.0508 0.7463 0.984 0.000 0.000 0.000 0.012 0.004
#> GSM71698 6 0.2932 0.6199 0.164 0.000 0.000 0.000 0.016 0.820
#> GSM71699 6 0.3690 0.6516 0.308 0.000 0.000 0.000 0.008 0.684
#> GSM71700 1 0.2527 0.6295 0.832 0.000 0.000 0.000 0.000 0.168
#> GSM71701 6 0.3201 0.6511 0.208 0.000 0.000 0.000 0.012 0.780
#> GSM71702 6 0.4377 0.5048 0.436 0.000 0.000 0.000 0.024 0.540
#> GSM71703 6 0.4334 0.5694 0.408 0.000 0.000 0.000 0.024 0.568
#> GSM71704 6 0.4473 0.3842 0.480 0.000 0.000 0.000 0.028 0.492
#> GSM71705 1 0.3714 0.3392 0.656 0.000 0.000 0.000 0.004 0.340
#> GSM71706 1 0.3898 0.2418 0.652 0.000 0.000 0.000 0.012 0.336
#> GSM71707 1 0.4129 0.0599 0.564 0.000 0.000 0.000 0.012 0.424
#> GSM71708 1 0.4504 -0.2774 0.536 0.000 0.000 0.000 0.032 0.432
#> GSM71709 4 0.1003 0.8532 0.000 0.000 0.000 0.964 0.020 0.016
#> GSM71710 1 0.0725 0.7467 0.976 0.000 0.000 0.000 0.012 0.012
#> GSM71711 1 0.0146 0.7478 0.996 0.000 0.000 0.000 0.000 0.004
#> GSM71712 5 0.5954 0.7965 0.000 0.096 0.000 0.200 0.612 0.092
#> GSM71713 6 0.4729 -0.1790 0.000 0.064 0.000 0.012 0.256 0.668
#> GSM71714 1 0.0146 0.7478 0.996 0.000 0.000 0.000 0.000 0.004
#> GSM71715 1 0.1074 0.7379 0.960 0.000 0.000 0.000 0.012 0.028
#> GSM71716 1 0.1970 0.7050 0.912 0.000 0.000 0.000 0.060 0.028
#> GSM71717 1 0.0725 0.7439 0.976 0.000 0.000 0.000 0.012 0.012
#> GSM71718 1 0.4045 0.5842 0.756 0.000 0.000 0.000 0.120 0.124
#> GSM71719 1 0.2815 0.6458 0.848 0.000 0.000 0.000 0.120 0.032
#> GSM71720 1 0.2679 0.6716 0.864 0.000 0.000 0.000 0.096 0.040
#> GSM71721 1 0.4902 0.3874 0.616 0.000 0.000 0.004 0.076 0.304
#> GSM71722 1 0.3017 0.6566 0.816 0.000 0.000 0.000 0.020 0.164
#> GSM71723 1 0.0146 0.7478 0.996 0.000 0.000 0.000 0.004 0.000
#> GSM71724 1 0.3967 0.2578 0.632 0.000 0.000 0.000 0.012 0.356
#> GSM71725 5 0.4591 0.8125 0.028 0.112 0.000 0.120 0.740 0.000
#> GSM71726 4 0.1327 0.8386 0.000 0.000 0.000 0.936 0.064 0.000
#> GSM71727 4 0.0000 0.8628 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM71728 4 0.4264 0.2803 0.000 0.008 0.000 0.604 0.376 0.012
#> GSM71729 4 0.2879 0.7798 0.000 0.056 0.000 0.864 0.072 0.008
#> GSM71730 4 0.0146 0.8631 0.000 0.004 0.000 0.996 0.000 0.000
#> GSM71731 1 0.1633 0.7196 0.932 0.000 0.000 0.000 0.044 0.024
#> GSM71732 1 0.2536 0.6875 0.864 0.000 0.000 0.000 0.020 0.116
#> GSM71733 1 0.0713 0.7422 0.972 0.000 0.000 0.000 0.000 0.028
#> GSM71734 1 0.3927 0.3495 0.644 0.000 0.000 0.000 0.012 0.344
#> GSM71735 1 0.1141 0.7310 0.948 0.000 0.000 0.000 0.000 0.052
#> GSM71736 1 0.3833 -0.1623 0.556 0.000 0.000 0.000 0.000 0.444
#> GSM71737 1 0.0146 0.7478 0.996 0.000 0.000 0.000 0.000 0.004
#> GSM71738 1 0.2854 0.5670 0.792 0.000 0.000 0.000 0.000 0.208
#> GSM71739 2 0.4797 0.6003 0.164 0.708 0.000 0.000 0.108 0.020
#> GSM71740 1 0.0806 0.7427 0.972 0.000 0.000 0.000 0.020 0.008
Heatmaps for the consensus matrix. It visualizes the probability of two samples to be in a same group.
consensus_heatmap(res, k = 2)
consensus_heatmap(res, k = 3)
consensus_heatmap(res, k = 4)
consensus_heatmap(res, k = 5)
consensus_heatmap(res, k = 6)
Heatmaps for the membership of samples in all partitions to see how consistent they are:
membership_heatmap(res, k = 2)
membership_heatmap(res, k = 3)
membership_heatmap(res, k = 4)
membership_heatmap(res, k = 5)
membership_heatmap(res, k = 6)
As soon as we have had the classes for columns, we can look for signatures which are significantly different between classes which can be candidate marks for certain classes. Following are the heatmaps for signatures.
Signature heatmaps where rows are scaled:
get_signatures(res, k = 2)
get_signatures(res, k = 3)
get_signatures(res, k = 4)
get_signatures(res, k = 5)
get_signatures(res, k = 6)
Signature heatmaps where rows are not scaled:
get_signatures(res, k = 2, scale_rows = FALSE)
get_signatures(res, k = 3, scale_rows = FALSE)
get_signatures(res, k = 4, scale_rows = FALSE)
get_signatures(res, k = 5, scale_rows = FALSE)
get_signatures(res, k = 6, scale_rows = FALSE)
Compare the overlap of signatures from different k:
compare_signatures(res)
get_signature()
returns a data frame invisibly. TO get the list of signatures, the function
call should be assigned to a variable explicitly. In following code, if plot
argument is set
to FALSE
, no heatmap is plotted while only the differential analysis is performed.
# code only for demonstration
tb = get_signature(res, k = ..., plot = FALSE)
An example of the output of tb
is:
#> which_row fdr mean_1 mean_2 scaled_mean_1 scaled_mean_2 km
#> 1 38 0.042760348 8.373488 9.131774 -0.5533452 0.5164555 1
#> 2 40 0.018707592 7.106213 8.469186 -0.6173731 0.5762149 1
#> 3 55 0.019134737 10.221463 11.207825 -0.6159697 0.5749050 1
#> 4 59 0.006059896 5.921854 7.869574 -0.6899429 0.6439467 1
#> 5 60 0.018055526 8.928898 10.211722 -0.6204761 0.5791110 1
#> 6 98 0.009384629 15.714769 14.887706 0.6635654 -0.6193277 2
...
The columns in tb
are:
which_row
: row indices corresponding to the input matrix.fdr
: FDR for the differential test. mean_x
: The mean value in group x.scaled_mean_x
: The mean value in group x after rows are scaled.km
: Row groups if k-means clustering is applied to rows.UMAP plot which shows how samples are separated.
dimension_reduction(res, k = 2, method = "UMAP")
dimension_reduction(res, k = 3, method = "UMAP")
dimension_reduction(res, k = 4, method = "UMAP")
dimension_reduction(res, k = 5, method = "UMAP")
dimension_reduction(res, k = 6, method = "UMAP")
Following heatmap shows how subgroups are split when increasing k
:
collect_classes(res)
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) k
#> SD:NMF 70 1.15e-12 2
#> SD:NMF 68 1.20e-15 3
#> SD:NMF 69 4.88e-19 4
#> SD:NMF 61 1.45e-16 5
#> SD:NMF 59 6.37e-14 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 21168 rows and 70 columns.
#> Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'CV' method.
#> Subgroups are detected by 'hclust' method.
#> Performed in total 1250 partitions by row resampling.
#> Best k for subgroups seems to be 4.
#>
#> Following methods can be applied to this 'ConsensusPartition' object:
#> [1] "cola_report" "collect_classes" "collect_plots"
#> [4] "collect_stats" "colnames" "compare_signatures"
#> [7] "consensus_heatmap" "dimension_reduction" "functional_enrichment"
#> [10] "get_anno_col" "get_anno" "get_classes"
#> [13] "get_consensus" "get_matrix" "get_membership"
#> [16] "get_param" "get_signatures" "get_stats"
#> [19] "is_best_k" "is_stable_k" "membership_heatmap"
#> [22] "ncol" "nrow" "plot_ecdf"
#> [25] "rownames" "select_partition_number" "show"
#> [28] "suggest_best_k" "test_to_known_factors"
collect_plots()
function collects all the plots made from res
for all k
(number of partitions)
into one single page to provide an easy and fast comparison between different k
.
collect_plots(res)
The plots are:
k
and the heatmap of
predicted classes for each k
.k
.k
.k
.All the plots in panels can be made by individual functions and they are plotted later in this section.
select_partition_number()
produces several plots showing different
statistics for choosing “optimized” k
. There are following statistics:
k
;k
, the area increased is defined as \(A_k - A_{k-1}\).The detailed explanations of these statistics can be found in the cola vignette.
Generally speaking, lower PAC score, higher mean silhouette score or higher
concordance corresponds to better partition. Rand index and Jaccard index
measure how similar the current partition is compared to partition with k-1
.
If they are too similar, we won't accept k
is better than k-1
.
select_partition_number(res)
The numeric values for all these statistics can be obtained by get_stats()
.
get_stats(res)
#> k 1-PAC mean_silhouette concordance area_increased Rand Jaccard
#> 2 2 0.653 0.825 0.916 0.3347 0.752 0.752
#> 3 3 0.855 0.890 0.905 0.7452 0.661 0.549
#> 4 4 0.981 0.957 0.975 0.0818 0.959 0.902
#> 5 5 0.817 0.858 0.920 0.0846 0.969 0.918
#> 6 6 0.786 0.790 0.886 0.0286 0.965 0.899
suggest_best_k()
suggests the best \(k\) based on these statistics. The rules are as follows:
suggest_best_k(res)
#> [1] 4
Following shows the table of the partitions (You need to click the show/hide
code output link to see it). The membership matrix (columns with name p*
)
is inferred by
clue::cl_consensus()
function with the SE
method. Basically the value in the membership matrix
represents the probability to belong to a certain group. The finall class
label for an item is determined with the group with highest probability it
belongs to.
In get_classes()
function, the entropy is calculated from the membership
matrix and the silhouette score is calculated from the consensus matrix.
cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#> class entropy silhouette p1 p2
#> GSM71671 2 0.0000 1.000 0.000 1.000
#> GSM71672 2 0.0000 1.000 0.000 1.000
#> GSM71673 2 0.0000 1.000 0.000 1.000
#> GSM71674 2 0.0000 1.000 0.000 1.000
#> GSM71675 2 0.0000 1.000 0.000 1.000
#> GSM71676 2 0.0000 1.000 0.000 1.000
#> GSM71677 2 0.0000 1.000 0.000 1.000
#> GSM71678 1 0.9710 0.497 0.600 0.400
#> GSM71679 1 0.9710 0.497 0.600 0.400
#> GSM71680 1 0.0376 0.888 0.996 0.004
#> GSM71681 1 0.9686 0.503 0.604 0.396
#> GSM71682 1 0.9710 0.497 0.600 0.400
#> GSM71683 1 0.9710 0.497 0.600 0.400
#> GSM71684 1 0.9710 0.497 0.600 0.400
#> GSM71685 1 0.9686 0.503 0.604 0.396
#> GSM71686 1 0.9710 0.497 0.600 0.400
#> GSM71687 1 0.9710 0.497 0.600 0.400
#> GSM71688 1 0.9710 0.497 0.600 0.400
#> GSM71689 2 0.0000 1.000 0.000 1.000
#> GSM71690 1 0.9710 0.497 0.600 0.400
#> GSM71691 1 0.9710 0.497 0.600 0.400
#> GSM71692 2 0.0000 1.000 0.000 1.000
#> GSM71693 1 0.9710 0.497 0.600 0.400
#> GSM71694 2 0.0000 1.000 0.000 1.000
#> GSM71695 1 0.9710 0.497 0.600 0.400
#> GSM71696 1 0.0000 0.890 1.000 0.000
#> GSM71697 1 0.0000 0.890 1.000 0.000
#> GSM71698 1 0.0000 0.890 1.000 0.000
#> GSM71699 1 0.0000 0.890 1.000 0.000
#> GSM71700 1 0.0000 0.890 1.000 0.000
#> GSM71701 1 0.0000 0.890 1.000 0.000
#> GSM71702 1 0.0000 0.890 1.000 0.000
#> GSM71703 1 0.0000 0.890 1.000 0.000
#> GSM71704 1 0.0000 0.890 1.000 0.000
#> GSM71705 1 0.0000 0.890 1.000 0.000
#> GSM71706 1 0.0000 0.890 1.000 0.000
#> GSM71707 1 0.0000 0.890 1.000 0.000
#> GSM71708 1 0.0000 0.890 1.000 0.000
#> GSM71709 1 0.0376 0.888 0.996 0.004
#> GSM71710 1 0.0000 0.890 1.000 0.000
#> GSM71711 1 0.0000 0.890 1.000 0.000
#> GSM71712 1 0.0000 0.890 1.000 0.000
#> GSM71713 1 0.0000 0.890 1.000 0.000
#> GSM71714 1 0.0000 0.890 1.000 0.000
#> GSM71715 1 0.2423 0.867 0.960 0.040
#> GSM71716 1 0.0000 0.890 1.000 0.000
#> GSM71717 1 0.0000 0.890 1.000 0.000
#> GSM71718 1 0.0000 0.890 1.000 0.000
#> GSM71719 1 0.0000 0.890 1.000 0.000
#> GSM71720 1 0.0000 0.890 1.000 0.000
#> GSM71721 1 0.0000 0.890 1.000 0.000
#> GSM71722 1 0.0000 0.890 1.000 0.000
#> GSM71723 1 0.0000 0.890 1.000 0.000
#> GSM71724 1 0.0000 0.890 1.000 0.000
#> GSM71725 1 0.0000 0.890 1.000 0.000
#> GSM71726 1 0.0000 0.890 1.000 0.000
#> GSM71727 1 0.2423 0.868 0.960 0.040
#> GSM71728 1 0.0000 0.890 1.000 0.000
#> GSM71729 1 0.2423 0.868 0.960 0.040
#> GSM71730 1 0.2423 0.868 0.960 0.040
#> GSM71731 1 0.0000 0.890 1.000 0.000
#> GSM71732 1 0.0000 0.890 1.000 0.000
#> GSM71733 1 0.0000 0.890 1.000 0.000
#> GSM71734 1 0.0000 0.890 1.000 0.000
#> GSM71735 1 0.0000 0.890 1.000 0.000
#> GSM71736 1 0.0000 0.890 1.000 0.000
#> GSM71737 1 0.0000 0.890 1.000 0.000
#> GSM71738 1 0.0000 0.890 1.000 0.000
#> GSM71739 1 0.5519 0.802 0.872 0.128
#> GSM71740 1 0.0000 0.890 1.000 0.000
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> GSM71671 3 0.000 1.000 0.000 0.000 1.000
#> GSM71672 3 0.000 1.000 0.000 0.000 1.000
#> GSM71673 3 0.000 1.000 0.000 0.000 1.000
#> GSM71674 3 0.000 1.000 0.000 0.000 1.000
#> GSM71675 3 0.000 1.000 0.000 0.000 1.000
#> GSM71676 3 0.000 1.000 0.000 0.000 1.000
#> GSM71677 3 0.000 1.000 0.000 0.000 1.000
#> GSM71678 2 0.613 0.780 0.000 0.600 0.400
#> GSM71679 2 0.613 0.780 0.000 0.600 0.400
#> GSM71680 2 0.000 0.614 0.000 1.000 0.000
#> GSM71681 2 0.611 0.779 0.000 0.604 0.396
#> GSM71682 2 0.613 0.780 0.000 0.600 0.400
#> GSM71683 2 0.613 0.780 0.000 0.600 0.400
#> GSM71684 2 0.613 0.780 0.000 0.600 0.400
#> GSM71685 2 0.611 0.779 0.000 0.604 0.396
#> GSM71686 2 0.613 0.780 0.000 0.600 0.400
#> GSM71687 2 0.613 0.780 0.000 0.600 0.400
#> GSM71688 2 0.613 0.780 0.000 0.600 0.400
#> GSM71689 3 0.000 1.000 0.000 0.000 1.000
#> GSM71690 2 0.613 0.780 0.000 0.600 0.400
#> GSM71691 2 0.613 0.780 0.000 0.600 0.400
#> GSM71692 3 0.000 1.000 0.000 0.000 1.000
#> GSM71693 2 0.613 0.780 0.000 0.600 0.400
#> GSM71694 3 0.000 1.000 0.000 0.000 1.000
#> GSM71695 2 0.613 0.780 0.000 0.600 0.400
#> GSM71696 1 0.000 0.978 1.000 0.000 0.000
#> GSM71697 1 0.000 0.978 1.000 0.000 0.000
#> GSM71698 1 0.000 0.978 1.000 0.000 0.000
#> GSM71699 1 0.000 0.978 1.000 0.000 0.000
#> GSM71700 1 0.000 0.978 1.000 0.000 0.000
#> GSM71701 1 0.000 0.978 1.000 0.000 0.000
#> GSM71702 1 0.000 0.978 1.000 0.000 0.000
#> GSM71703 1 0.000 0.978 1.000 0.000 0.000
#> GSM71704 1 0.000 0.978 1.000 0.000 0.000
#> GSM71705 1 0.000 0.978 1.000 0.000 0.000
#> GSM71706 1 0.000 0.978 1.000 0.000 0.000
#> GSM71707 1 0.000 0.978 1.000 0.000 0.000
#> GSM71708 1 0.000 0.978 1.000 0.000 0.000
#> GSM71709 2 0.000 0.614 0.000 1.000 0.000
#> GSM71710 1 0.000 0.978 1.000 0.000 0.000
#> GSM71711 1 0.000 0.978 1.000 0.000 0.000
#> GSM71712 1 0.375 0.827 0.856 0.144 0.000
#> GSM71713 1 0.000 0.978 1.000 0.000 0.000
#> GSM71714 1 0.000 0.978 1.000 0.000 0.000
#> GSM71715 1 0.176 0.934 0.956 0.004 0.040
#> GSM71716 1 0.000 0.978 1.000 0.000 0.000
#> GSM71717 1 0.000 0.978 1.000 0.000 0.000
#> GSM71718 1 0.000 0.978 1.000 0.000 0.000
#> GSM71719 1 0.000 0.978 1.000 0.000 0.000
#> GSM71720 1 0.000 0.978 1.000 0.000 0.000
#> GSM71721 1 0.000 0.978 1.000 0.000 0.000
#> GSM71722 1 0.000 0.978 1.000 0.000 0.000
#> GSM71723 1 0.000 0.978 1.000 0.000 0.000
#> GSM71724 1 0.000 0.978 1.000 0.000 0.000
#> GSM71725 1 0.455 0.767 0.800 0.200 0.000
#> GSM71726 2 0.196 0.601 0.056 0.944 0.000
#> GSM71727 2 0.153 0.640 0.000 0.960 0.040
#> GSM71728 2 0.196 0.601 0.056 0.944 0.000
#> GSM71729 2 0.153 0.640 0.000 0.960 0.040
#> GSM71730 2 0.153 0.640 0.000 0.960 0.040
#> GSM71731 1 0.000 0.978 1.000 0.000 0.000
#> GSM71732 1 0.000 0.978 1.000 0.000 0.000
#> GSM71733 1 0.000 0.978 1.000 0.000 0.000
#> GSM71734 1 0.000 0.978 1.000 0.000 0.000
#> GSM71735 1 0.000 0.978 1.000 0.000 0.000
#> GSM71736 1 0.000 0.978 1.000 0.000 0.000
#> GSM71737 1 0.000 0.978 1.000 0.000 0.000
#> GSM71738 1 0.000 0.978 1.000 0.000 0.000
#> GSM71739 1 0.852 0.293 0.584 0.288 0.128
#> GSM71740 1 0.000 0.978 1.000 0.000 0.000
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> GSM71671 3 0.0469 1.000 0.000 0.012 0.988 0.000
#> GSM71672 3 0.0469 1.000 0.000 0.012 0.988 0.000
#> GSM71673 3 0.0469 1.000 0.000 0.012 0.988 0.000
#> GSM71674 3 0.0469 1.000 0.000 0.012 0.988 0.000
#> GSM71675 3 0.0469 1.000 0.000 0.012 0.988 0.000
#> GSM71676 3 0.0469 1.000 0.000 0.012 0.988 0.000
#> GSM71677 3 0.0469 1.000 0.000 0.012 0.988 0.000
#> GSM71678 2 0.0000 0.998 0.000 1.000 0.000 0.000
#> GSM71679 2 0.0000 0.998 0.000 1.000 0.000 0.000
#> GSM71680 4 0.0000 0.855 0.000 0.000 0.000 1.000
#> GSM71681 2 0.0188 0.994 0.000 0.996 0.000 0.004
#> GSM71682 2 0.0000 0.998 0.000 1.000 0.000 0.000
#> GSM71683 2 0.0000 0.998 0.000 1.000 0.000 0.000
#> GSM71684 2 0.0000 0.998 0.000 1.000 0.000 0.000
#> GSM71685 2 0.0188 0.994 0.000 0.996 0.000 0.004
#> GSM71686 2 0.0000 0.998 0.000 1.000 0.000 0.000
#> GSM71687 2 0.0000 0.998 0.000 1.000 0.000 0.000
#> GSM71688 2 0.0000 0.998 0.000 1.000 0.000 0.000
#> GSM71689 3 0.0469 1.000 0.000 0.012 0.988 0.000
#> GSM71690 2 0.0000 0.998 0.000 1.000 0.000 0.000
#> GSM71691 2 0.0188 0.995 0.000 0.996 0.004 0.000
#> GSM71692 3 0.0469 1.000 0.000 0.012 0.988 0.000
#> GSM71693 2 0.0000 0.998 0.000 1.000 0.000 0.000
#> GSM71694 3 0.0469 1.000 0.000 0.012 0.988 0.000
#> GSM71695 2 0.0188 0.995 0.000 0.996 0.004 0.000
#> GSM71696 1 0.0000 0.977 1.000 0.000 0.000 0.000
#> GSM71697 1 0.0000 0.977 1.000 0.000 0.000 0.000
#> GSM71698 1 0.0000 0.977 1.000 0.000 0.000 0.000
#> GSM71699 1 0.0000 0.977 1.000 0.000 0.000 0.000
#> GSM71700 1 0.0000 0.977 1.000 0.000 0.000 0.000
#> GSM71701 1 0.0000 0.977 1.000 0.000 0.000 0.000
#> GSM71702 1 0.0000 0.977 1.000 0.000 0.000 0.000
#> GSM71703 1 0.0000 0.977 1.000 0.000 0.000 0.000
#> GSM71704 1 0.0000 0.977 1.000 0.000 0.000 0.000
#> GSM71705 1 0.0000 0.977 1.000 0.000 0.000 0.000
#> GSM71706 1 0.0000 0.977 1.000 0.000 0.000 0.000
#> GSM71707 1 0.0000 0.977 1.000 0.000 0.000 0.000
#> GSM71708 1 0.0000 0.977 1.000 0.000 0.000 0.000
#> GSM71709 4 0.0000 0.855 0.000 0.000 0.000 1.000
#> GSM71710 1 0.0000 0.977 1.000 0.000 0.000 0.000
#> GSM71711 1 0.0000 0.977 1.000 0.000 0.000 0.000
#> GSM71712 1 0.3652 0.829 0.856 0.052 0.000 0.092
#> GSM71713 1 0.0000 0.977 1.000 0.000 0.000 0.000
#> GSM71714 1 0.0000 0.977 1.000 0.000 0.000 0.000
#> GSM71715 1 0.1302 0.933 0.956 0.044 0.000 0.000
#> GSM71716 1 0.0000 0.977 1.000 0.000 0.000 0.000
#> GSM71717 1 0.0000 0.977 1.000 0.000 0.000 0.000
#> GSM71718 1 0.0000 0.977 1.000 0.000 0.000 0.000
#> GSM71719 1 0.0000 0.977 1.000 0.000 0.000 0.000
#> GSM71720 1 0.0000 0.977 1.000 0.000 0.000 0.000
#> GSM71721 1 0.0000 0.977 1.000 0.000 0.000 0.000
#> GSM71722 1 0.0000 0.977 1.000 0.000 0.000 0.000
#> GSM71723 1 0.0000 0.977 1.000 0.000 0.000 0.000
#> GSM71724 1 0.0000 0.977 1.000 0.000 0.000 0.000
#> GSM71725 1 0.4837 0.746 0.792 0.052 0.012 0.144
#> GSM71726 4 0.3304 0.866 0.048 0.052 0.012 0.888
#> GSM71727 4 0.3444 0.855 0.000 0.184 0.000 0.816
#> GSM71728 4 0.3304 0.866 0.048 0.052 0.012 0.888
#> GSM71729 4 0.3569 0.845 0.000 0.196 0.000 0.804
#> GSM71730 4 0.3444 0.855 0.000 0.184 0.000 0.816
#> GSM71731 1 0.0000 0.977 1.000 0.000 0.000 0.000
#> GSM71732 1 0.0000 0.977 1.000 0.000 0.000 0.000
#> GSM71733 1 0.0000 0.977 1.000 0.000 0.000 0.000
#> GSM71734 1 0.0000 0.977 1.000 0.000 0.000 0.000
#> GSM71735 1 0.0000 0.977 1.000 0.000 0.000 0.000
#> GSM71736 1 0.0000 0.977 1.000 0.000 0.000 0.000
#> GSM71737 1 0.0000 0.977 1.000 0.000 0.000 0.000
#> GSM71738 1 0.0000 0.977 1.000 0.000 0.000 0.000
#> GSM71739 1 0.4898 0.308 0.584 0.416 0.000 0.000
#> GSM71740 1 0.0000 0.977 1.000 0.000 0.000 0.000
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> GSM71671 3 0.0000 0.999 0.000 0.000 1.000 0.000 0.000
#> GSM71672 3 0.0000 0.999 0.000 0.000 1.000 0.000 0.000
#> GSM71673 3 0.0000 0.999 0.000 0.000 1.000 0.000 0.000
#> GSM71674 3 0.0000 0.999 0.000 0.000 1.000 0.000 0.000
#> GSM71675 3 0.0000 0.999 0.000 0.000 1.000 0.000 0.000
#> GSM71676 3 0.0000 0.999 0.000 0.000 1.000 0.000 0.000
#> GSM71677 3 0.0000 0.999 0.000 0.000 1.000 0.000 0.000
#> GSM71678 2 0.0000 0.990 0.000 1.000 0.000 0.000 0.000
#> GSM71679 2 0.0000 0.990 0.000 1.000 0.000 0.000 0.000
#> GSM71680 4 0.0510 0.793 0.000 0.000 0.000 0.984 0.016
#> GSM71681 2 0.0566 0.980 0.000 0.984 0.000 0.004 0.012
#> GSM71682 2 0.0000 0.990 0.000 1.000 0.000 0.000 0.000
#> GSM71683 2 0.0000 0.990 0.000 1.000 0.000 0.000 0.000
#> GSM71684 2 0.0000 0.990 0.000 1.000 0.000 0.000 0.000
#> GSM71685 2 0.0566 0.980 0.000 0.984 0.000 0.004 0.012
#> GSM71686 2 0.0000 0.990 0.000 1.000 0.000 0.000 0.000
#> GSM71687 2 0.0000 0.990 0.000 1.000 0.000 0.000 0.000
#> GSM71688 2 0.0000 0.990 0.000 1.000 0.000 0.000 0.000
#> GSM71689 3 0.0162 0.997 0.000 0.000 0.996 0.000 0.004
#> GSM71690 2 0.0000 0.990 0.000 1.000 0.000 0.000 0.000
#> GSM71691 2 0.1270 0.952 0.000 0.948 0.000 0.000 0.052
#> GSM71692 3 0.0162 0.997 0.000 0.000 0.996 0.000 0.004
#> GSM71693 2 0.0000 0.990 0.000 1.000 0.000 0.000 0.000
#> GSM71694 3 0.0162 0.997 0.000 0.000 0.996 0.000 0.004
#> GSM71695 2 0.1270 0.952 0.000 0.948 0.000 0.000 0.052
#> GSM71696 1 0.2732 0.800 0.840 0.000 0.000 0.000 0.160
#> GSM71697 1 0.2179 0.843 0.888 0.000 0.000 0.000 0.112
#> GSM71698 1 0.2471 0.751 0.864 0.000 0.000 0.000 0.136
#> GSM71699 1 0.1043 0.851 0.960 0.000 0.000 0.000 0.040
#> GSM71700 1 0.1965 0.851 0.904 0.000 0.000 0.000 0.096
#> GSM71701 1 0.2471 0.751 0.864 0.000 0.000 0.000 0.136
#> GSM71702 1 0.1043 0.852 0.960 0.000 0.000 0.000 0.040
#> GSM71703 1 0.1043 0.851 0.960 0.000 0.000 0.000 0.040
#> GSM71704 1 0.1043 0.851 0.960 0.000 0.000 0.000 0.040
#> GSM71705 1 0.0404 0.866 0.988 0.000 0.000 0.000 0.012
#> GSM71706 1 0.1043 0.851 0.960 0.000 0.000 0.000 0.040
#> GSM71707 1 0.0510 0.862 0.984 0.000 0.000 0.000 0.016
#> GSM71708 1 0.1043 0.851 0.960 0.000 0.000 0.000 0.040
#> GSM71709 4 0.0510 0.793 0.000 0.000 0.000 0.984 0.016
#> GSM71710 1 0.2230 0.840 0.884 0.000 0.000 0.000 0.116
#> GSM71711 1 0.2280 0.836 0.880 0.000 0.000 0.000 0.120
#> GSM71712 5 0.3774 0.806 0.296 0.000 0.000 0.000 0.704
#> GSM71713 1 0.4060 0.137 0.640 0.000 0.000 0.000 0.360
#> GSM71714 1 0.0404 0.866 0.988 0.000 0.000 0.000 0.012
#> GSM71715 1 0.3336 0.702 0.772 0.000 0.000 0.000 0.228
#> GSM71716 1 0.2329 0.834 0.876 0.000 0.000 0.000 0.124
#> GSM71717 1 0.1965 0.854 0.904 0.000 0.000 0.000 0.096
#> GSM71718 1 0.2179 0.842 0.888 0.000 0.000 0.000 0.112
#> GSM71719 1 0.2179 0.842 0.888 0.000 0.000 0.000 0.112
#> GSM71720 1 0.2179 0.842 0.888 0.000 0.000 0.000 0.112
#> GSM71721 1 0.0510 0.864 0.984 0.000 0.000 0.000 0.016
#> GSM71722 1 0.1270 0.865 0.948 0.000 0.000 0.000 0.052
#> GSM71723 1 0.2074 0.847 0.896 0.000 0.000 0.000 0.104
#> GSM71724 1 0.0162 0.864 0.996 0.000 0.000 0.000 0.004
#> GSM71725 5 0.3074 0.780 0.196 0.000 0.000 0.000 0.804
#> GSM71726 4 0.3534 0.749 0.000 0.000 0.000 0.744 0.256
#> GSM71727 4 0.2966 0.806 0.000 0.184 0.000 0.816 0.000
#> GSM71728 4 0.3534 0.749 0.000 0.000 0.000 0.744 0.256
#> GSM71729 4 0.3074 0.796 0.000 0.196 0.000 0.804 0.000
#> GSM71730 4 0.2966 0.806 0.000 0.184 0.000 0.816 0.000
#> GSM71731 1 0.2280 0.836 0.880 0.000 0.000 0.000 0.120
#> GSM71732 1 0.0609 0.867 0.980 0.000 0.000 0.000 0.020
#> GSM71733 1 0.0880 0.866 0.968 0.000 0.000 0.000 0.032
#> GSM71734 1 0.0794 0.857 0.972 0.000 0.000 0.000 0.028
#> GSM71735 1 0.0510 0.866 0.984 0.000 0.000 0.000 0.016
#> GSM71736 1 0.1043 0.851 0.960 0.000 0.000 0.000 0.040
#> GSM71737 1 0.1908 0.855 0.908 0.000 0.000 0.000 0.092
#> GSM71738 1 0.0963 0.854 0.964 0.000 0.000 0.000 0.036
#> GSM71739 1 0.6684 -0.339 0.392 0.372 0.000 0.000 0.236
#> GSM71740 1 0.2280 0.836 0.880 0.000 0.000 0.000 0.120
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> GSM71671 3 0.0000 0.955 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM71672 3 0.0000 0.955 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM71673 3 0.0260 0.953 0.000 0.000 0.992 0.000 0.000 0.008
#> GSM71674 3 0.0000 0.955 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM71675 3 0.0000 0.955 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM71676 3 0.0000 0.955 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM71677 3 0.0146 0.954 0.000 0.000 0.996 0.000 0.000 0.004
#> GSM71678 2 0.0000 0.907 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM71679 2 0.0000 0.907 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM71680 4 0.2058 0.764 0.000 0.000 0.000 0.908 0.036 0.056
#> GSM71681 2 0.1003 0.886 0.000 0.964 0.000 0.016 0.020 0.000
#> GSM71682 2 0.0000 0.907 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM71683 2 0.0000 0.907 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM71684 2 0.0000 0.907 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM71685 2 0.1003 0.886 0.000 0.964 0.000 0.016 0.020 0.000
#> GSM71686 2 0.0000 0.907 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM71687 2 0.0000 0.907 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM71688 2 0.0000 0.907 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM71689 3 0.2300 0.895 0.000 0.000 0.856 0.000 0.000 0.144
#> GSM71690 2 0.0000 0.907 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM71691 2 0.2912 0.738 0.000 0.784 0.000 0.000 0.000 0.216
#> GSM71692 3 0.2300 0.895 0.000 0.000 0.856 0.000 0.000 0.144
#> GSM71693 2 0.0000 0.907 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM71694 3 0.2416 0.889 0.000 0.000 0.844 0.000 0.000 0.156
#> GSM71695 2 0.2912 0.738 0.000 0.784 0.000 0.000 0.000 0.216
#> GSM71696 1 0.4045 0.634 0.756 0.000 0.000 0.000 0.124 0.120
#> GSM71697 1 0.2312 0.820 0.876 0.000 0.000 0.000 0.112 0.012
#> GSM71698 1 0.3649 0.352 0.764 0.000 0.000 0.000 0.040 0.196
#> GSM71699 1 0.0937 0.819 0.960 0.000 0.000 0.000 0.040 0.000
#> GSM71700 1 0.2070 0.831 0.896 0.000 0.000 0.000 0.092 0.012
#> GSM71701 1 0.3649 0.352 0.764 0.000 0.000 0.000 0.040 0.196
#> GSM71702 1 0.1010 0.820 0.960 0.000 0.000 0.000 0.036 0.004
#> GSM71703 1 0.0937 0.819 0.960 0.000 0.000 0.000 0.040 0.000
#> GSM71704 1 0.0937 0.819 0.960 0.000 0.000 0.000 0.040 0.000
#> GSM71705 1 0.0405 0.842 0.988 0.000 0.000 0.000 0.008 0.004
#> GSM71706 1 0.0937 0.819 0.960 0.000 0.000 0.000 0.040 0.000
#> GSM71707 1 0.0508 0.835 0.984 0.000 0.000 0.000 0.012 0.004
#> GSM71708 1 0.0937 0.819 0.960 0.000 0.000 0.000 0.040 0.000
#> GSM71709 4 0.2058 0.764 0.000 0.000 0.000 0.908 0.036 0.056
#> GSM71710 1 0.2357 0.817 0.872 0.000 0.000 0.000 0.116 0.012
#> GSM71711 1 0.2494 0.810 0.864 0.000 0.000 0.000 0.120 0.016
#> GSM71712 5 0.3110 0.643 0.196 0.000 0.000 0.000 0.792 0.012
#> GSM71713 6 0.5856 0.000 0.404 0.000 0.000 0.000 0.192 0.404
#> GSM71714 1 0.0622 0.844 0.980 0.000 0.000 0.000 0.008 0.012
#> GSM71715 1 0.4999 0.320 0.640 0.000 0.000 0.000 0.144 0.216
#> GSM71716 1 0.2538 0.806 0.860 0.000 0.000 0.000 0.124 0.016
#> GSM71717 1 0.2214 0.830 0.888 0.000 0.000 0.000 0.096 0.016
#> GSM71718 1 0.2404 0.817 0.872 0.000 0.000 0.000 0.112 0.016
#> GSM71719 1 0.2404 0.817 0.872 0.000 0.000 0.000 0.112 0.016
#> GSM71720 1 0.2404 0.817 0.872 0.000 0.000 0.000 0.112 0.016
#> GSM71721 1 0.0508 0.839 0.984 0.000 0.000 0.000 0.004 0.012
#> GSM71722 1 0.1528 0.843 0.936 0.000 0.000 0.000 0.048 0.016
#> GSM71723 1 0.2311 0.822 0.880 0.000 0.000 0.000 0.104 0.016
#> GSM71724 1 0.0146 0.839 0.996 0.000 0.000 0.000 0.000 0.004
#> GSM71725 5 0.1814 0.718 0.100 0.000 0.000 0.000 0.900 0.000
#> GSM71726 4 0.3175 0.725 0.000 0.000 0.000 0.744 0.256 0.000
#> GSM71727 4 0.2558 0.797 0.000 0.156 0.000 0.840 0.004 0.000
#> GSM71728 4 0.3175 0.725 0.000 0.000 0.000 0.744 0.256 0.000
#> GSM71729 4 0.2668 0.787 0.000 0.168 0.000 0.828 0.004 0.000
#> GSM71730 4 0.2558 0.797 0.000 0.156 0.000 0.840 0.004 0.000
#> GSM71731 1 0.2494 0.810 0.864 0.000 0.000 0.000 0.120 0.016
#> GSM71732 1 0.0820 0.846 0.972 0.000 0.000 0.000 0.012 0.016
#> GSM71733 1 0.1088 0.845 0.960 0.000 0.000 0.000 0.024 0.016
#> GSM71734 1 0.0777 0.828 0.972 0.000 0.000 0.000 0.024 0.004
#> GSM71735 1 0.0622 0.844 0.980 0.000 0.000 0.000 0.012 0.008
#> GSM71736 1 0.0937 0.819 0.960 0.000 0.000 0.000 0.040 0.000
#> GSM71737 1 0.2070 0.832 0.896 0.000 0.000 0.000 0.092 0.012
#> GSM71738 1 0.0935 0.823 0.964 0.000 0.000 0.000 0.032 0.004
#> GSM71739 2 0.7799 -0.328 0.260 0.344 0.000 0.012 0.156 0.228
#> GSM71740 1 0.2494 0.810 0.864 0.000 0.000 0.000 0.120 0.016
Heatmaps for the consensus matrix. It visualizes the probability of two samples to be in a same group.
consensus_heatmap(res, k = 2)
consensus_heatmap(res, k = 3)
consensus_heatmap(res, k = 4)
consensus_heatmap(res, k = 5)
consensus_heatmap(res, k = 6)
Heatmaps for the membership of samples in all partitions to see how consistent they are:
membership_heatmap(res, k = 2)
membership_heatmap(res, k = 3)
membership_heatmap(res, k = 4)
membership_heatmap(res, k = 5)
membership_heatmap(res, k = 6)
As soon as we have had the classes for columns, we can look for signatures which are significantly different between classes which can be candidate marks for certain classes. Following are the heatmaps for signatures.
Signature heatmaps where rows are scaled:
get_signatures(res, k = 2)
get_signatures(res, k = 3)
get_signatures(res, k = 4)
get_signatures(res, k = 5)
get_signatures(res, k = 6)
Signature heatmaps where rows are not scaled:
get_signatures(res, k = 2, scale_rows = FALSE)
get_signatures(res, k = 3, scale_rows = FALSE)
get_signatures(res, k = 4, scale_rows = FALSE)
get_signatures(res, k = 5, scale_rows = FALSE)
get_signatures(res, k = 6, scale_rows = FALSE)
Compare the overlap of signatures from different k:
compare_signatures(res)
get_signature()
returns a data frame invisibly. TO get the list of signatures, the function
call should be assigned to a variable explicitly. In following code, if plot
argument is set
to FALSE
, no heatmap is plotted while only the differential analysis is performed.
# code only for demonstration
tb = get_signature(res, k = ..., plot = FALSE)
An example of the output of tb
is:
#> which_row fdr mean_1 mean_2 scaled_mean_1 scaled_mean_2 km
#> 1 38 0.042760348 8.373488 9.131774 -0.5533452 0.5164555 1
#> 2 40 0.018707592 7.106213 8.469186 -0.6173731 0.5762149 1
#> 3 55 0.019134737 10.221463 11.207825 -0.6159697 0.5749050 1
#> 4 59 0.006059896 5.921854 7.869574 -0.6899429 0.6439467 1
#> 5 60 0.018055526 8.928898 10.211722 -0.6204761 0.5791110 1
#> 6 98 0.009384629 15.714769 14.887706 0.6635654 -0.6193277 2
...
The columns in tb
are:
which_row
: row indices corresponding to the input matrix.fdr
: FDR for the differential test. mean_x
: The mean value in group x.scaled_mean_x
: The mean value in group x after rows are scaled.km
: Row groups if k-means clustering is applied to rows.UMAP plot which shows how samples are separated.
dimension_reduction(res, k = 2, method = "UMAP")
dimension_reduction(res, k = 3, method = "UMAP")
dimension_reduction(res, k = 4, method = "UMAP")
dimension_reduction(res, k = 5, method = "UMAP")
dimension_reduction(res, k = 6, method = "UMAP")
Following heatmap shows how subgroups are split when increasing k
:
collect_classes(res)
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) k
#> CV:hclust 58 4.88e-11 2
#> CV:hclust 69 8.86e-18 3
#> CV:hclust 69 2.72e-20 4
#> CV:hclust 68 1.00e-18 5
#> CV:hclust 65 8.94e-18 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 21168 rows and 70 columns.
#> Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'CV' method.
#> Subgroups are detected by 'kmeans' method.
#> Performed in total 1250 partitions by row resampling.
#> Best k for subgroups seems to be 2.
#>
#> Following methods can be applied to this 'ConsensusPartition' object:
#> [1] "cola_report" "collect_classes" "collect_plots"
#> [4] "collect_stats" "colnames" "compare_signatures"
#> [7] "consensus_heatmap" "dimension_reduction" "functional_enrichment"
#> [10] "get_anno_col" "get_anno" "get_classes"
#> [13] "get_consensus" "get_matrix" "get_membership"
#> [16] "get_param" "get_signatures" "get_stats"
#> [19] "is_best_k" "is_stable_k" "membership_heatmap"
#> [22] "ncol" "nrow" "plot_ecdf"
#> [25] "rownames" "select_partition_number" "show"
#> [28] "suggest_best_k" "test_to_known_factors"
collect_plots()
function collects all the plots made from res
for all k
(number of partitions)
into one single page to provide an easy and fast comparison between different k
.
collect_plots(res)
The plots are:
k
and the heatmap of
predicted classes for each k
.k
.k
.k
.All the plots in panels can be made by individual functions and they are plotted later in this section.
select_partition_number()
produces several plots showing different
statistics for choosing “optimized” k
. There are following statistics:
k
;k
, the area increased is defined as \(A_k - A_{k-1}\).The detailed explanations of these statistics can be found in the cola vignette.
Generally speaking, lower PAC score, higher mean silhouette score or higher
concordance corresponds to better partition. Rand index and Jaccard index
measure how similar the current partition is compared to partition with k-1
.
If they are too similar, we won't accept k
is better than k-1
.
select_partition_number(res)
The numeric values for all these statistics can be obtained by get_stats()
.
get_stats(res)
#> k 1-PAC mean_silhouette concordance area_increased Rand Jaccard
#> 2 2 1.000 0.984 0.988 0.4877 0.508 0.508
#> 3 3 0.721 0.847 0.854 0.2364 0.873 0.758
#> 4 4 0.716 0.774 0.742 0.1498 0.819 0.574
#> 5 5 0.731 0.908 0.873 0.0898 0.938 0.769
#> 6 6 0.801 0.835 0.875 0.0533 0.961 0.830
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
#> GSM71671 2 0.000 0.980 0.000 1.000
#> GSM71672 2 0.000 0.980 0.000 1.000
#> GSM71673 2 0.000 0.980 0.000 1.000
#> GSM71674 2 0.000 0.980 0.000 1.000
#> GSM71675 2 0.000 0.980 0.000 1.000
#> GSM71676 2 0.000 0.980 0.000 1.000
#> GSM71677 2 0.000 0.980 0.000 1.000
#> GSM71678 2 0.184 0.990 0.028 0.972
#> GSM71679 2 0.184 0.990 0.028 0.972
#> GSM71680 2 0.184 0.990 0.028 0.972
#> GSM71681 2 0.184 0.990 0.028 0.972
#> GSM71682 2 0.184 0.990 0.028 0.972
#> GSM71683 2 0.184 0.990 0.028 0.972
#> GSM71684 2 0.184 0.990 0.028 0.972
#> GSM71685 2 0.184 0.990 0.028 0.972
#> GSM71686 2 0.184 0.990 0.028 0.972
#> GSM71687 2 0.184 0.990 0.028 0.972
#> GSM71688 2 0.184 0.990 0.028 0.972
#> GSM71689 2 0.000 0.980 0.000 1.000
#> GSM71690 2 0.184 0.990 0.028 0.972
#> GSM71691 2 0.184 0.990 0.028 0.972
#> GSM71692 2 0.000 0.980 0.000 1.000
#> GSM71693 2 0.184 0.990 0.028 0.972
#> GSM71694 2 0.000 0.980 0.000 1.000
#> GSM71695 2 0.184 0.990 0.028 0.972
#> GSM71696 1 0.000 0.992 1.000 0.000
#> GSM71697 1 0.000 0.992 1.000 0.000
#> GSM71698 1 0.000 0.992 1.000 0.000
#> GSM71699 1 0.000 0.992 1.000 0.000
#> GSM71700 1 0.000 0.992 1.000 0.000
#> GSM71701 1 0.000 0.992 1.000 0.000
#> GSM71702 1 0.000 0.992 1.000 0.000
#> GSM71703 1 0.000 0.992 1.000 0.000
#> GSM71704 1 0.000 0.992 1.000 0.000
#> GSM71705 1 0.000 0.992 1.000 0.000
#> GSM71706 1 0.000 0.992 1.000 0.000
#> GSM71707 1 0.000 0.992 1.000 0.000
#> GSM71708 1 0.000 0.992 1.000 0.000
#> GSM71709 2 0.184 0.990 0.028 0.972
#> GSM71710 1 0.000 0.992 1.000 0.000
#> GSM71711 1 0.000 0.992 1.000 0.000
#> GSM71712 1 0.000 0.992 1.000 0.000
#> GSM71713 1 0.000 0.992 1.000 0.000
#> GSM71714 1 0.000 0.992 1.000 0.000
#> GSM71715 1 0.000 0.992 1.000 0.000
#> GSM71716 1 0.000 0.992 1.000 0.000
#> GSM71717 1 0.000 0.992 1.000 0.000
#> GSM71718 1 0.000 0.992 1.000 0.000
#> GSM71719 1 0.000 0.992 1.000 0.000
#> GSM71720 1 0.000 0.992 1.000 0.000
#> GSM71721 1 0.000 0.992 1.000 0.000
#> GSM71722 1 0.000 0.992 1.000 0.000
#> GSM71723 1 0.000 0.992 1.000 0.000
#> GSM71724 1 0.000 0.992 1.000 0.000
#> GSM71725 1 0.000 0.992 1.000 0.000
#> GSM71726 1 0.625 0.812 0.844 0.156
#> GSM71727 2 0.184 0.990 0.028 0.972
#> GSM71728 1 0.000 0.992 1.000 0.000
#> GSM71729 2 0.184 0.990 0.028 0.972
#> GSM71730 2 0.184 0.990 0.028 0.972
#> GSM71731 1 0.000 0.992 1.000 0.000
#> GSM71732 1 0.000 0.992 1.000 0.000
#> GSM71733 1 0.000 0.992 1.000 0.000
#> GSM71734 1 0.000 0.992 1.000 0.000
#> GSM71735 1 0.000 0.992 1.000 0.000
#> GSM71736 1 0.000 0.992 1.000 0.000
#> GSM71737 1 0.000 0.992 1.000 0.000
#> GSM71738 1 0.000 0.992 1.000 0.000
#> GSM71739 1 0.644 0.801 0.836 0.164
#> GSM71740 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
#> GSM71671 3 0.0000 1.000 0.000 0.000 1.000
#> GSM71672 3 0.0000 1.000 0.000 0.000 1.000
#> GSM71673 3 0.0000 1.000 0.000 0.000 1.000
#> GSM71674 3 0.0000 1.000 0.000 0.000 1.000
#> GSM71675 3 0.0000 1.000 0.000 0.000 1.000
#> GSM71676 3 0.0000 1.000 0.000 0.000 1.000
#> GSM71677 3 0.0000 1.000 0.000 0.000 1.000
#> GSM71678 2 0.6260 0.801 0.000 0.552 0.448
#> GSM71679 2 0.6260 0.801 0.000 0.552 0.448
#> GSM71680 2 0.4796 0.709 0.000 0.780 0.220
#> GSM71681 2 0.6260 0.801 0.000 0.552 0.448
#> GSM71682 2 0.6260 0.801 0.000 0.552 0.448
#> GSM71683 2 0.6260 0.801 0.000 0.552 0.448
#> GSM71684 2 0.6026 0.782 0.000 0.624 0.376
#> GSM71685 2 0.6026 0.782 0.000 0.624 0.376
#> GSM71686 2 0.6260 0.801 0.000 0.552 0.448
#> GSM71687 2 0.6260 0.801 0.000 0.552 0.448
#> GSM71688 2 0.6260 0.801 0.000 0.552 0.448
#> GSM71689 3 0.0000 1.000 0.000 0.000 1.000
#> GSM71690 2 0.6260 0.801 0.000 0.552 0.448
#> GSM71691 2 0.6260 0.801 0.000 0.552 0.448
#> GSM71692 3 0.0000 1.000 0.000 0.000 1.000
#> GSM71693 2 0.6260 0.801 0.000 0.552 0.448
#> GSM71694 3 0.0000 1.000 0.000 0.000 1.000
#> GSM71695 2 0.6260 0.801 0.000 0.552 0.448
#> GSM71696 1 0.0237 0.895 0.996 0.004 0.000
#> GSM71697 1 0.0237 0.895 0.996 0.004 0.000
#> GSM71698 1 0.4702 0.871 0.788 0.212 0.000
#> GSM71699 1 0.4702 0.871 0.788 0.212 0.000
#> GSM71700 1 0.0237 0.895 0.996 0.004 0.000
#> GSM71701 1 0.4702 0.871 0.788 0.212 0.000
#> GSM71702 1 0.4702 0.871 0.788 0.212 0.000
#> GSM71703 1 0.4702 0.871 0.788 0.212 0.000
#> GSM71704 1 0.4702 0.871 0.788 0.212 0.000
#> GSM71705 1 0.4702 0.871 0.788 0.212 0.000
#> GSM71706 1 0.4702 0.871 0.788 0.212 0.000
#> GSM71707 1 0.4702 0.871 0.788 0.212 0.000
#> GSM71708 1 0.4702 0.871 0.788 0.212 0.000
#> GSM71709 2 0.4796 0.709 0.000 0.780 0.220
#> GSM71710 1 0.0237 0.895 0.996 0.004 0.000
#> GSM71711 1 0.0000 0.895 1.000 0.000 0.000
#> GSM71712 1 0.0424 0.893 0.992 0.008 0.000
#> GSM71713 1 0.4702 0.871 0.788 0.212 0.000
#> GSM71714 1 0.0000 0.895 1.000 0.000 0.000
#> GSM71715 1 0.0237 0.895 0.996 0.004 0.000
#> GSM71716 1 0.0237 0.895 0.996 0.004 0.000
#> GSM71717 1 0.0000 0.895 1.000 0.000 0.000
#> GSM71718 1 0.0424 0.893 0.992 0.008 0.000
#> GSM71719 1 0.0424 0.893 0.992 0.008 0.000
#> GSM71720 1 0.0424 0.893 0.992 0.008 0.000
#> GSM71721 1 0.0424 0.893 0.992 0.008 0.000
#> GSM71722 1 0.0000 0.895 1.000 0.000 0.000
#> GSM71723 1 0.0000 0.895 1.000 0.000 0.000
#> GSM71724 1 0.4702 0.871 0.788 0.212 0.000
#> GSM71725 1 0.0424 0.893 0.992 0.008 0.000
#> GSM71726 2 0.4796 0.445 0.220 0.780 0.000
#> GSM71727 2 0.4796 0.709 0.000 0.780 0.220
#> GSM71728 2 0.5431 0.369 0.284 0.716 0.000
#> GSM71729 2 0.4796 0.709 0.000 0.780 0.220
#> GSM71730 2 0.4796 0.709 0.000 0.780 0.220
#> GSM71731 1 0.0237 0.895 0.996 0.004 0.000
#> GSM71732 1 0.0237 0.895 0.996 0.004 0.000
#> GSM71733 1 0.0237 0.895 0.996 0.004 0.000
#> GSM71734 1 0.4702 0.871 0.788 0.212 0.000
#> GSM71735 1 0.4702 0.871 0.788 0.212 0.000
#> GSM71736 1 0.4702 0.871 0.788 0.212 0.000
#> GSM71737 1 0.4702 0.871 0.788 0.212 0.000
#> GSM71738 1 0.4702 0.871 0.788 0.212 0.000
#> GSM71739 1 0.7499 0.186 0.592 0.360 0.048
#> GSM71740 1 0.0237 0.895 0.996 0.004 0.000
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> GSM71671 3 0.4428 0.989 0.000 0.276 0.720 0.004
#> GSM71672 3 0.4250 0.990 0.000 0.276 0.724 0.000
#> GSM71673 3 0.4250 0.990 0.000 0.276 0.724 0.000
#> GSM71674 3 0.4428 0.989 0.000 0.276 0.720 0.004
#> GSM71675 3 0.4250 0.990 0.000 0.276 0.724 0.000
#> GSM71676 3 0.4250 0.990 0.000 0.276 0.724 0.000
#> GSM71677 3 0.4250 0.990 0.000 0.276 0.724 0.000
#> GSM71678 2 0.0000 0.771 0.000 1.000 0.000 0.000
#> GSM71679 2 0.0000 0.771 0.000 1.000 0.000 0.000
#> GSM71680 2 0.7818 0.480 0.000 0.408 0.268 0.324
#> GSM71681 2 0.0000 0.771 0.000 1.000 0.000 0.000
#> GSM71682 2 0.0000 0.771 0.000 1.000 0.000 0.000
#> GSM71683 2 0.0000 0.771 0.000 1.000 0.000 0.000
#> GSM71684 2 0.2408 0.727 0.000 0.896 0.104 0.000
#> GSM71685 2 0.2987 0.721 0.000 0.880 0.104 0.016
#> GSM71686 2 0.0000 0.771 0.000 1.000 0.000 0.000
#> GSM71687 2 0.0000 0.771 0.000 1.000 0.000 0.000
#> GSM71688 2 0.0000 0.771 0.000 1.000 0.000 0.000
#> GSM71689 3 0.5282 0.978 0.000 0.276 0.688 0.036
#> GSM71690 2 0.0000 0.771 0.000 1.000 0.000 0.000
#> GSM71691 2 0.0000 0.771 0.000 1.000 0.000 0.000
#> GSM71692 3 0.5282 0.978 0.000 0.276 0.688 0.036
#> GSM71693 2 0.0000 0.771 0.000 1.000 0.000 0.000
#> GSM71694 3 0.5195 0.978 0.000 0.276 0.692 0.032
#> GSM71695 2 0.0000 0.771 0.000 1.000 0.000 0.000
#> GSM71696 1 0.0000 0.922 1.000 0.000 0.000 0.000
#> GSM71697 1 0.1022 0.907 0.968 0.000 0.000 0.032
#> GSM71698 4 0.5150 0.804 0.396 0.000 0.008 0.596
#> GSM71699 4 0.5172 0.808 0.404 0.000 0.008 0.588
#> GSM71700 1 0.2149 0.828 0.912 0.000 0.000 0.088
#> GSM71701 4 0.5150 0.804 0.396 0.000 0.008 0.596
#> GSM71702 4 0.5172 0.808 0.404 0.000 0.008 0.588
#> GSM71703 4 0.5172 0.808 0.404 0.000 0.008 0.588
#> GSM71704 4 0.4866 0.808 0.404 0.000 0.000 0.596
#> GSM71705 4 0.4888 0.800 0.412 0.000 0.000 0.588
#> GSM71706 4 0.4866 0.808 0.404 0.000 0.000 0.596
#> GSM71707 4 0.4855 0.808 0.400 0.000 0.000 0.600
#> GSM71708 4 0.4866 0.808 0.404 0.000 0.000 0.596
#> GSM71709 2 0.7818 0.480 0.000 0.408 0.268 0.324
#> GSM71710 1 0.1211 0.901 0.960 0.000 0.000 0.040
#> GSM71711 1 0.1118 0.906 0.964 0.000 0.000 0.036
#> GSM71712 1 0.1792 0.863 0.932 0.000 0.000 0.068
#> GSM71713 4 0.5112 0.792 0.384 0.000 0.008 0.608
#> GSM71714 1 0.0707 0.914 0.980 0.000 0.000 0.020
#> GSM71715 1 0.0000 0.922 1.000 0.000 0.000 0.000
#> GSM71716 1 0.0000 0.922 1.000 0.000 0.000 0.000
#> GSM71717 1 0.0921 0.910 0.972 0.000 0.000 0.028
#> GSM71718 1 0.0592 0.915 0.984 0.000 0.000 0.016
#> GSM71719 1 0.0469 0.916 0.988 0.000 0.000 0.012
#> GSM71720 1 0.0469 0.916 0.988 0.000 0.000 0.012
#> GSM71721 1 0.0592 0.915 0.984 0.000 0.000 0.016
#> GSM71722 1 0.0336 0.921 0.992 0.000 0.000 0.008
#> GSM71723 1 0.0817 0.912 0.976 0.000 0.000 0.024
#> GSM71724 4 0.4941 0.778 0.436 0.000 0.000 0.564
#> GSM71725 1 0.1302 0.887 0.956 0.000 0.000 0.044
#> GSM71726 4 0.9076 -0.538 0.064 0.332 0.256 0.348
#> GSM71727 2 0.7818 0.480 0.000 0.408 0.268 0.324
#> GSM71728 4 0.9427 -0.241 0.292 0.104 0.244 0.360
#> GSM71729 2 0.7818 0.480 0.000 0.408 0.268 0.324
#> GSM71730 2 0.7818 0.480 0.000 0.408 0.268 0.324
#> GSM71731 1 0.0000 0.922 1.000 0.000 0.000 0.000
#> GSM71732 1 0.0188 0.921 0.996 0.000 0.000 0.004
#> GSM71733 1 0.0921 0.909 0.972 0.000 0.000 0.028
#> GSM71734 4 0.4933 0.780 0.432 0.000 0.000 0.568
#> GSM71735 4 0.4994 0.692 0.480 0.000 0.000 0.520
#> GSM71736 4 0.4898 0.801 0.416 0.000 0.000 0.584
#> GSM71737 1 0.4898 -0.437 0.584 0.000 0.000 0.416
#> GSM71738 4 0.4898 0.801 0.416 0.000 0.000 0.584
#> GSM71739 1 0.3351 0.677 0.844 0.148 0.000 0.008
#> GSM71740 1 0.0000 0.922 1.000 0.000 0.000 0.000
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> GSM71671 3 0.2583 0.981 0.000 0.132 0.864 0.000 0.004
#> GSM71672 3 0.2424 0.981 0.000 0.132 0.868 0.000 0.000
#> GSM71673 3 0.2583 0.981 0.000 0.132 0.864 0.000 0.004
#> GSM71674 3 0.2583 0.981 0.000 0.132 0.864 0.000 0.004
#> GSM71675 3 0.2424 0.981 0.000 0.132 0.868 0.000 0.000
#> GSM71676 3 0.2424 0.981 0.000 0.132 0.868 0.000 0.000
#> GSM71677 3 0.2583 0.981 0.000 0.132 0.864 0.000 0.004
#> GSM71678 2 0.0703 0.965 0.000 0.976 0.000 0.000 0.024
#> GSM71679 2 0.0703 0.965 0.000 0.976 0.000 0.000 0.024
#> GSM71680 4 0.1608 0.972 0.000 0.072 0.000 0.928 0.000
#> GSM71681 2 0.0794 0.964 0.000 0.972 0.000 0.000 0.028
#> GSM71682 2 0.0703 0.965 0.000 0.976 0.000 0.000 0.024
#> GSM71683 2 0.0290 0.963 0.000 0.992 0.000 0.000 0.008
#> GSM71684 2 0.1544 0.904 0.000 0.932 0.000 0.068 0.000
#> GSM71685 2 0.2389 0.853 0.000 0.880 0.000 0.116 0.004
#> GSM71686 2 0.0703 0.965 0.000 0.976 0.000 0.000 0.024
#> GSM71687 2 0.0609 0.960 0.000 0.980 0.000 0.000 0.020
#> GSM71688 2 0.0000 0.963 0.000 1.000 0.000 0.000 0.000
#> GSM71689 3 0.4162 0.960 0.000 0.132 0.800 0.020 0.048
#> GSM71690 2 0.0703 0.965 0.000 0.976 0.000 0.000 0.024
#> GSM71691 2 0.1197 0.949 0.000 0.952 0.000 0.000 0.048
#> GSM71692 3 0.4162 0.960 0.000 0.132 0.800 0.020 0.048
#> GSM71693 2 0.0609 0.960 0.000 0.980 0.000 0.000 0.020
#> GSM71694 3 0.4251 0.958 0.000 0.132 0.796 0.024 0.048
#> GSM71695 2 0.1197 0.949 0.000 0.952 0.000 0.000 0.048
#> GSM71696 5 0.3684 0.925 0.192 0.000 0.016 0.004 0.788
#> GSM71697 5 0.3366 0.914 0.232 0.000 0.000 0.000 0.768
#> GSM71698 1 0.2875 0.874 0.888 0.000 0.060 0.032 0.020
#> GSM71699 1 0.1200 0.898 0.964 0.000 0.008 0.016 0.012
#> GSM71700 5 0.4135 0.800 0.340 0.000 0.000 0.004 0.656
#> GSM71701 1 0.2562 0.880 0.900 0.000 0.060 0.032 0.008
#> GSM71702 1 0.1095 0.898 0.968 0.000 0.008 0.012 0.012
#> GSM71703 1 0.1200 0.898 0.964 0.000 0.008 0.016 0.012
#> GSM71704 1 0.0968 0.899 0.972 0.000 0.004 0.012 0.012
#> GSM71705 1 0.3046 0.880 0.880 0.000 0.052 0.020 0.048
#> GSM71706 1 0.0609 0.900 0.980 0.000 0.000 0.000 0.020
#> GSM71707 1 0.2418 0.891 0.912 0.000 0.044 0.020 0.024
#> GSM71708 1 0.0609 0.900 0.980 0.000 0.000 0.000 0.020
#> GSM71709 4 0.1608 0.972 0.000 0.072 0.000 0.928 0.000
#> GSM71710 5 0.3910 0.902 0.248 0.000 0.008 0.004 0.740
#> GSM71711 5 0.3395 0.916 0.236 0.000 0.000 0.000 0.764
#> GSM71712 5 0.6001 0.740 0.148 0.000 0.096 0.076 0.680
#> GSM71713 1 0.2937 0.848 0.884 0.000 0.060 0.016 0.040
#> GSM71714 5 0.3491 0.913 0.228 0.000 0.000 0.004 0.768
#> GSM71715 5 0.3648 0.924 0.188 0.000 0.016 0.004 0.792
#> GSM71716 5 0.3352 0.924 0.192 0.000 0.004 0.004 0.800
#> GSM71717 5 0.3706 0.908 0.236 0.000 0.004 0.004 0.756
#> GSM71718 5 0.4163 0.916 0.176 0.000 0.040 0.008 0.776
#> GSM71719 5 0.3660 0.919 0.176 0.000 0.016 0.008 0.800
#> GSM71720 5 0.3559 0.921 0.176 0.000 0.012 0.008 0.804
#> GSM71721 5 0.4998 0.891 0.172 0.000 0.064 0.028 0.736
#> GSM71722 5 0.4811 0.891 0.200 0.000 0.048 0.020 0.732
#> GSM71723 5 0.3333 0.921 0.208 0.000 0.000 0.004 0.788
#> GSM71724 1 0.3164 0.870 0.868 0.000 0.028 0.020 0.084
#> GSM71725 5 0.4271 0.849 0.140 0.000 0.068 0.008 0.784
#> GSM71726 4 0.2234 0.947 0.000 0.044 0.004 0.916 0.036
#> GSM71727 4 0.1768 0.972 0.000 0.072 0.000 0.924 0.004
#> GSM71728 4 0.3033 0.892 0.000 0.016 0.032 0.876 0.076
#> GSM71729 4 0.1768 0.972 0.000 0.072 0.000 0.924 0.004
#> GSM71730 4 0.1768 0.972 0.000 0.072 0.000 0.924 0.004
#> GSM71731 5 0.2929 0.924 0.180 0.000 0.000 0.000 0.820
#> GSM71732 5 0.4118 0.916 0.188 0.000 0.032 0.008 0.772
#> GSM71733 5 0.3461 0.915 0.224 0.000 0.000 0.004 0.772
#> GSM71734 1 0.3566 0.860 0.848 0.000 0.052 0.020 0.080
#> GSM71735 1 0.3160 0.743 0.808 0.000 0.000 0.004 0.188
#> GSM71736 1 0.1502 0.892 0.940 0.000 0.004 0.000 0.056
#> GSM71737 1 0.4564 0.148 0.600 0.000 0.004 0.008 0.388
#> GSM71738 1 0.1430 0.893 0.944 0.000 0.000 0.004 0.052
#> GSM71739 5 0.4987 0.820 0.116 0.096 0.016 0.012 0.760
#> GSM71740 5 0.2966 0.925 0.184 0.000 0.000 0.000 0.816
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> GSM71671 3 0.1765 0.9655 0.000 0.096 0.904 0.000 0.000 0.000
#> GSM71672 3 0.1765 0.9655 0.000 0.096 0.904 0.000 0.000 0.000
#> GSM71673 3 0.2121 0.9631 0.000 0.096 0.892 0.000 0.012 0.000
#> GSM71674 3 0.1765 0.9655 0.000 0.096 0.904 0.000 0.000 0.000
#> GSM71675 3 0.1765 0.9655 0.000 0.096 0.904 0.000 0.000 0.000
#> GSM71676 3 0.1765 0.9655 0.000 0.096 0.904 0.000 0.000 0.000
#> GSM71677 3 0.2020 0.9644 0.000 0.096 0.896 0.000 0.008 0.000
#> GSM71678 2 0.1168 0.9458 0.000 0.956 0.000 0.000 0.028 0.016
#> GSM71679 2 0.1168 0.9458 0.000 0.956 0.000 0.000 0.028 0.016
#> GSM71680 4 0.0260 0.9294 0.000 0.008 0.000 0.992 0.000 0.000
#> GSM71681 2 0.1442 0.9412 0.000 0.944 0.000 0.004 0.040 0.012
#> GSM71682 2 0.1168 0.9458 0.000 0.956 0.000 0.000 0.028 0.016
#> GSM71683 2 0.0603 0.9431 0.000 0.980 0.000 0.000 0.016 0.004
#> GSM71684 2 0.0937 0.9223 0.000 0.960 0.000 0.040 0.000 0.000
#> GSM71685 2 0.3673 0.6709 0.000 0.736 0.000 0.244 0.016 0.004
#> GSM71686 2 0.1168 0.9458 0.000 0.956 0.000 0.000 0.028 0.016
#> GSM71687 2 0.0603 0.9424 0.000 0.980 0.000 0.000 0.016 0.004
#> GSM71688 2 0.0000 0.9445 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM71689 3 0.4182 0.9164 0.000 0.096 0.780 0.004 0.100 0.020
#> GSM71690 2 0.1168 0.9458 0.000 0.956 0.000 0.000 0.028 0.016
#> GSM71691 2 0.1719 0.9202 0.000 0.924 0.000 0.000 0.060 0.016
#> GSM71692 3 0.3955 0.9248 0.000 0.096 0.796 0.004 0.088 0.016
#> GSM71693 2 0.0692 0.9422 0.000 0.976 0.000 0.000 0.020 0.004
#> GSM71694 3 0.4400 0.9132 0.000 0.096 0.772 0.008 0.096 0.028
#> GSM71695 2 0.1719 0.9202 0.000 0.924 0.000 0.000 0.060 0.016
#> GSM71696 1 0.1829 0.8563 0.928 0.000 0.028 0.000 0.036 0.008
#> GSM71697 1 0.1523 0.8542 0.940 0.000 0.008 0.000 0.008 0.044
#> GSM71698 6 0.4151 0.8161 0.064 0.000 0.036 0.000 0.120 0.780
#> GSM71699 6 0.2239 0.8464 0.072 0.000 0.008 0.000 0.020 0.900
#> GSM71700 1 0.3859 0.6665 0.776 0.000 0.016 0.000 0.040 0.168
#> GSM71701 6 0.4022 0.8200 0.064 0.000 0.036 0.000 0.108 0.792
#> GSM71702 6 0.2937 0.8416 0.080 0.000 0.020 0.000 0.036 0.864
#> GSM71703 6 0.2094 0.8492 0.080 0.000 0.000 0.000 0.020 0.900
#> GSM71704 6 0.2056 0.8503 0.080 0.000 0.004 0.000 0.012 0.904
#> GSM71705 6 0.4793 0.7948 0.120 0.000 0.048 0.000 0.100 0.732
#> GSM71706 6 0.1866 0.8535 0.084 0.000 0.008 0.000 0.000 0.908
#> GSM71707 6 0.4087 0.8283 0.080 0.000 0.044 0.000 0.084 0.792
#> GSM71708 6 0.1866 0.8535 0.084 0.000 0.008 0.000 0.000 0.908
#> GSM71709 4 0.0260 0.9294 0.000 0.008 0.000 0.992 0.000 0.000
#> GSM71710 1 0.1644 0.8584 0.932 0.000 0.000 0.000 0.028 0.040
#> GSM71711 1 0.0935 0.8664 0.964 0.000 0.004 0.000 0.000 0.032
#> GSM71712 5 0.3895 0.5928 0.280 0.000 0.000 0.012 0.700 0.008
#> GSM71713 5 0.4754 -0.0378 0.032 0.000 0.008 0.000 0.508 0.452
#> GSM71714 1 0.1767 0.8555 0.932 0.000 0.012 0.000 0.036 0.020
#> GSM71715 1 0.1716 0.8569 0.932 0.000 0.028 0.000 0.036 0.004
#> GSM71716 1 0.0777 0.8650 0.972 0.000 0.000 0.000 0.024 0.004
#> GSM71717 1 0.1642 0.8551 0.936 0.000 0.004 0.000 0.028 0.032
#> GSM71718 1 0.2262 0.8385 0.896 0.000 0.008 0.000 0.080 0.016
#> GSM71719 1 0.0935 0.8609 0.964 0.000 0.004 0.000 0.032 0.000
#> GSM71720 1 0.1082 0.8611 0.956 0.000 0.004 0.000 0.040 0.000
#> GSM71721 1 0.3398 0.7774 0.824 0.000 0.040 0.000 0.120 0.016
#> GSM71722 1 0.3432 0.7774 0.828 0.000 0.040 0.000 0.108 0.024
#> GSM71723 1 0.1382 0.8626 0.948 0.000 0.008 0.000 0.036 0.008
#> GSM71724 6 0.4962 0.7726 0.176 0.000 0.036 0.000 0.088 0.700
#> GSM71725 5 0.3782 0.5243 0.360 0.000 0.004 0.000 0.636 0.000
#> GSM71726 4 0.2462 0.8481 0.004 0.000 0.004 0.860 0.132 0.000
#> GSM71727 4 0.0520 0.9298 0.000 0.008 0.000 0.984 0.008 0.000
#> GSM71728 4 0.3565 0.7032 0.004 0.000 0.004 0.716 0.276 0.000
#> GSM71729 4 0.0520 0.9298 0.000 0.008 0.000 0.984 0.008 0.000
#> GSM71730 4 0.0520 0.9298 0.000 0.008 0.000 0.984 0.008 0.000
#> GSM71731 1 0.0146 0.8669 0.996 0.000 0.000 0.000 0.004 0.000
#> GSM71732 1 0.2624 0.8315 0.880 0.000 0.024 0.000 0.080 0.016
#> GSM71733 1 0.1787 0.8578 0.932 0.000 0.016 0.000 0.032 0.020
#> GSM71734 6 0.5085 0.7628 0.164 0.000 0.044 0.000 0.096 0.696
#> GSM71735 6 0.4470 0.6069 0.296 0.000 0.016 0.000 0.028 0.660
#> GSM71736 6 0.3001 0.8390 0.128 0.000 0.008 0.000 0.024 0.840
#> GSM71737 1 0.4761 -0.0683 0.528 0.000 0.012 0.000 0.028 0.432
#> GSM71738 6 0.2825 0.8362 0.136 0.000 0.012 0.000 0.008 0.844
#> GSM71739 1 0.3606 0.7416 0.828 0.088 0.028 0.000 0.052 0.004
#> GSM71740 1 0.0000 0.8673 1.000 0.000 0.000 0.000 0.000 0.000
Heatmaps for the consensus matrix. It visualizes the probability of two samples to be in a same group.
consensus_heatmap(res, k = 2)
consensus_heatmap(res, k = 3)
consensus_heatmap(res, k = 4)
consensus_heatmap(res, k = 5)
consensus_heatmap(res, k = 6)
Heatmaps for the membership of samples in all partitions to see how consistent they are:
membership_heatmap(res, k = 2)
membership_heatmap(res, k = 3)
membership_heatmap(res, k = 4)
membership_heatmap(res, k = 5)
membership_heatmap(res, k = 6)
As soon as we have had the classes for columns, we can look for signatures which are significantly different between classes which can be candidate marks for certain classes. Following are the heatmaps for signatures.
Signature heatmaps where rows are scaled:
get_signatures(res, k = 2)
get_signatures(res, k = 3)
get_signatures(res, k = 4)
get_signatures(res, k = 5)
get_signatures(res, k = 6)
Signature heatmaps where rows are not scaled:
get_signatures(res, k = 2, scale_rows = FALSE)
get_signatures(res, k = 3, scale_rows = FALSE)
get_signatures(res, k = 4, scale_rows = FALSE)
get_signatures(res, k = 5, scale_rows = FALSE)
get_signatures(res, k = 6, scale_rows = FALSE)
Compare the overlap of signatures from different k:
compare_signatures(res)
get_signature()
returns a data frame invisibly. TO get the list of signatures, the function
call should be assigned to a variable explicitly. In following code, if plot
argument is set
to FALSE
, no heatmap is plotted while only the differential analysis is performed.
# code only for demonstration
tb = get_signature(res, k = ..., plot = FALSE)
An example of the output of tb
is:
#> which_row fdr mean_1 mean_2 scaled_mean_1 scaled_mean_2 km
#> 1 38 0.042760348 8.373488 9.131774 -0.5533452 0.5164555 1
#> 2 40 0.018707592 7.106213 8.469186 -0.6173731 0.5762149 1
#> 3 55 0.019134737 10.221463 11.207825 -0.6159697 0.5749050 1
#> 4 59 0.006059896 5.921854 7.869574 -0.6899429 0.6439467 1
#> 5 60 0.018055526 8.928898 10.211722 -0.6204761 0.5791110 1
#> 6 98 0.009384629 15.714769 14.887706 0.6635654 -0.6193277 2
...
The columns in tb
are:
which_row
: row indices corresponding to the input matrix.fdr
: FDR for the differential test. mean_x
: The mean value in group x.scaled_mean_x
: The mean value in group x after rows are scaled.km
: Row groups if k-means clustering is applied to rows.UMAP plot which shows how samples are separated.
dimension_reduction(res, k = 2, method = "UMAP")
dimension_reduction(res, k = 3, method = "UMAP")
dimension_reduction(res, k = 4, method = "UMAP")
dimension_reduction(res, k = 5, method = "UMAP")
dimension_reduction(res, k = 6, method = "UMAP")
Following heatmap shows how subgroups are split when increasing k
:
collect_classes(res)
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) k
#> CV:kmeans 70 1.15e-12 2
#> CV:kmeans 67 1.86e-18 3
#> CV:kmeans 62 7.42e-19 4
#> CV:kmeans 69 4.84e-19 5
#> CV:kmeans 68 1.32e-17 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 21168 rows and 70 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.984 0.993 0.5026 0.496 0.496
#> 3 3 1.000 0.982 0.983 0.2015 0.901 0.800
#> 4 4 0.801 0.912 0.918 0.1234 0.908 0.777
#> 5 5 0.732 0.807 0.853 0.1317 0.855 0.581
#> 6 6 0.733 0.739 0.835 0.0552 0.974 0.881
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
#> GSM71671 2 0.000 0.984 0.000 1.000
#> GSM71672 2 0.000 0.984 0.000 1.000
#> GSM71673 2 0.000 0.984 0.000 1.000
#> GSM71674 2 0.000 0.984 0.000 1.000
#> GSM71675 2 0.000 0.984 0.000 1.000
#> GSM71676 2 0.000 0.984 0.000 1.000
#> GSM71677 2 0.000 0.984 0.000 1.000
#> GSM71678 2 0.000 0.984 0.000 1.000
#> GSM71679 2 0.000 0.984 0.000 1.000
#> GSM71680 2 0.000 0.984 0.000 1.000
#> GSM71681 2 0.000 0.984 0.000 1.000
#> GSM71682 2 0.000 0.984 0.000 1.000
#> GSM71683 2 0.000 0.984 0.000 1.000
#> GSM71684 2 0.000 0.984 0.000 1.000
#> GSM71685 2 0.000 0.984 0.000 1.000
#> GSM71686 2 0.000 0.984 0.000 1.000
#> GSM71687 2 0.000 0.984 0.000 1.000
#> GSM71688 2 0.000 0.984 0.000 1.000
#> GSM71689 2 0.000 0.984 0.000 1.000
#> GSM71690 2 0.000 0.984 0.000 1.000
#> GSM71691 2 0.000 0.984 0.000 1.000
#> GSM71692 2 0.000 0.984 0.000 1.000
#> GSM71693 2 0.000 0.984 0.000 1.000
#> GSM71694 2 0.000 0.984 0.000 1.000
#> GSM71695 2 0.000 0.984 0.000 1.000
#> GSM71696 1 0.000 1.000 1.000 0.000
#> GSM71697 1 0.000 1.000 1.000 0.000
#> GSM71698 1 0.000 1.000 1.000 0.000
#> GSM71699 1 0.000 1.000 1.000 0.000
#> GSM71700 1 0.000 1.000 1.000 0.000
#> GSM71701 1 0.000 1.000 1.000 0.000
#> GSM71702 1 0.000 1.000 1.000 0.000
#> GSM71703 1 0.000 1.000 1.000 0.000
#> GSM71704 1 0.000 1.000 1.000 0.000
#> GSM71705 1 0.000 1.000 1.000 0.000
#> GSM71706 1 0.000 1.000 1.000 0.000
#> GSM71707 1 0.000 1.000 1.000 0.000
#> GSM71708 1 0.000 1.000 1.000 0.000
#> GSM71709 2 0.000 0.984 0.000 1.000
#> GSM71710 1 0.000 1.000 1.000 0.000
#> GSM71711 1 0.000 1.000 1.000 0.000
#> GSM71712 1 0.000 1.000 1.000 0.000
#> GSM71713 1 0.000 1.000 1.000 0.000
#> GSM71714 1 0.000 1.000 1.000 0.000
#> GSM71715 1 0.000 1.000 1.000 0.000
#> GSM71716 1 0.000 1.000 1.000 0.000
#> GSM71717 1 0.000 1.000 1.000 0.000
#> GSM71718 1 0.000 1.000 1.000 0.000
#> GSM71719 1 0.000 1.000 1.000 0.000
#> GSM71720 1 0.000 1.000 1.000 0.000
#> GSM71721 1 0.000 1.000 1.000 0.000
#> GSM71722 1 0.000 1.000 1.000 0.000
#> GSM71723 1 0.000 1.000 1.000 0.000
#> GSM71724 1 0.000 1.000 1.000 0.000
#> GSM71725 1 0.000 1.000 1.000 0.000
#> GSM71726 2 0.204 0.955 0.032 0.968
#> GSM71727 2 0.000 0.984 0.000 1.000
#> GSM71728 2 0.795 0.691 0.240 0.760
#> GSM71729 2 0.000 0.984 0.000 1.000
#> GSM71730 2 0.000 0.984 0.000 1.000
#> GSM71731 1 0.000 1.000 1.000 0.000
#> GSM71732 1 0.000 1.000 1.000 0.000
#> GSM71733 1 0.000 1.000 1.000 0.000
#> GSM71734 1 0.000 1.000 1.000 0.000
#> GSM71735 1 0.000 1.000 1.000 0.000
#> GSM71736 1 0.000 1.000 1.000 0.000
#> GSM71737 1 0.000 1.000 1.000 0.000
#> GSM71738 1 0.000 1.000 1.000 0.000
#> GSM71739 2 0.767 0.716 0.224 0.776
#> GSM71740 1 0.000 1.000 1.000 0.000
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> GSM71671 3 0.0237 0.995 0.000 0.004 0.996
#> GSM71672 3 0.0237 0.995 0.000 0.004 0.996
#> GSM71673 3 0.0237 0.995 0.000 0.004 0.996
#> GSM71674 3 0.0237 0.995 0.000 0.004 0.996
#> GSM71675 3 0.0237 0.995 0.000 0.004 0.996
#> GSM71676 3 0.0237 0.995 0.000 0.004 0.996
#> GSM71677 3 0.0237 0.995 0.000 0.004 0.996
#> GSM71678 2 0.1964 0.976 0.000 0.944 0.056
#> GSM71679 2 0.1964 0.976 0.000 0.944 0.056
#> GSM71680 2 0.0000 0.957 0.000 1.000 0.000
#> GSM71681 2 0.2066 0.975 0.000 0.940 0.060
#> GSM71682 2 0.1964 0.976 0.000 0.944 0.056
#> GSM71683 2 0.2066 0.975 0.000 0.940 0.060
#> GSM71684 2 0.1964 0.976 0.000 0.944 0.056
#> GSM71685 2 0.2066 0.975 0.000 0.940 0.060
#> GSM71686 2 0.1964 0.976 0.000 0.944 0.056
#> GSM71687 2 0.2066 0.975 0.000 0.940 0.060
#> GSM71688 2 0.2066 0.975 0.000 0.940 0.060
#> GSM71689 3 0.0237 0.995 0.000 0.004 0.996
#> GSM71690 2 0.2066 0.975 0.000 0.940 0.060
#> GSM71691 3 0.1411 0.968 0.000 0.036 0.964
#> GSM71692 3 0.0237 0.995 0.000 0.004 0.996
#> GSM71693 2 0.2066 0.975 0.000 0.940 0.060
#> GSM71694 3 0.0237 0.995 0.000 0.004 0.996
#> GSM71695 3 0.1163 0.975 0.000 0.028 0.972
#> GSM71696 1 0.0237 0.991 0.996 0.000 0.004
#> GSM71697 1 0.0237 0.991 0.996 0.000 0.004
#> GSM71698 1 0.0000 0.993 1.000 0.000 0.000
#> GSM71699 1 0.0000 0.993 1.000 0.000 0.000
#> GSM71700 1 0.0000 0.993 1.000 0.000 0.000
#> GSM71701 1 0.0000 0.993 1.000 0.000 0.000
#> GSM71702 1 0.0000 0.993 1.000 0.000 0.000
#> GSM71703 1 0.0000 0.993 1.000 0.000 0.000
#> GSM71704 1 0.0000 0.993 1.000 0.000 0.000
#> GSM71705 1 0.0000 0.993 1.000 0.000 0.000
#> GSM71706 1 0.0000 0.993 1.000 0.000 0.000
#> GSM71707 1 0.0000 0.993 1.000 0.000 0.000
#> GSM71708 1 0.0000 0.993 1.000 0.000 0.000
#> GSM71709 2 0.0237 0.960 0.000 0.996 0.004
#> GSM71710 1 0.0237 0.991 0.996 0.000 0.004
#> GSM71711 1 0.0237 0.991 0.996 0.000 0.004
#> GSM71712 1 0.4465 0.799 0.820 0.176 0.004
#> GSM71713 1 0.0000 0.993 1.000 0.000 0.000
#> GSM71714 1 0.0000 0.993 1.000 0.000 0.000
#> GSM71715 1 0.0237 0.991 0.996 0.000 0.004
#> GSM71716 1 0.0237 0.991 0.996 0.000 0.004
#> GSM71717 1 0.0000 0.993 1.000 0.000 0.000
#> GSM71718 1 0.0237 0.991 0.996 0.000 0.004
#> GSM71719 1 0.0237 0.991 0.996 0.000 0.004
#> GSM71720 1 0.0237 0.991 0.996 0.000 0.004
#> GSM71721 1 0.0000 0.993 1.000 0.000 0.000
#> GSM71722 1 0.0000 0.993 1.000 0.000 0.000
#> GSM71723 1 0.0237 0.991 0.996 0.000 0.004
#> GSM71724 1 0.0000 0.993 1.000 0.000 0.000
#> GSM71725 1 0.2200 0.941 0.940 0.056 0.004
#> GSM71726 2 0.0237 0.955 0.000 0.996 0.004
#> GSM71727 2 0.0237 0.960 0.000 0.996 0.004
#> GSM71728 2 0.0237 0.955 0.000 0.996 0.004
#> GSM71729 2 0.0000 0.957 0.000 1.000 0.000
#> GSM71730 2 0.0237 0.960 0.000 0.996 0.004
#> GSM71731 1 0.0237 0.991 0.996 0.000 0.004
#> GSM71732 1 0.0000 0.993 1.000 0.000 0.000
#> GSM71733 1 0.0000 0.993 1.000 0.000 0.000
#> GSM71734 1 0.0000 0.993 1.000 0.000 0.000
#> GSM71735 1 0.0000 0.993 1.000 0.000 0.000
#> GSM71736 1 0.0000 0.993 1.000 0.000 0.000
#> GSM71737 1 0.0000 0.993 1.000 0.000 0.000
#> GSM71738 1 0.0000 0.993 1.000 0.000 0.000
#> GSM71739 2 0.1860 0.973 0.000 0.948 0.052
#> GSM71740 1 0.0237 0.991 0.996 0.000 0.004
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> GSM71671 3 0.0188 1.000 0.000 0.004 0.996 0.000
#> GSM71672 3 0.0188 1.000 0.000 0.004 0.996 0.000
#> GSM71673 3 0.0188 1.000 0.000 0.004 0.996 0.000
#> GSM71674 3 0.0188 1.000 0.000 0.004 0.996 0.000
#> GSM71675 3 0.0188 1.000 0.000 0.004 0.996 0.000
#> GSM71676 3 0.0188 1.000 0.000 0.004 0.996 0.000
#> GSM71677 3 0.0188 1.000 0.000 0.004 0.996 0.000
#> GSM71678 2 0.0000 0.945 0.000 1.000 0.000 0.000
#> GSM71679 2 0.0000 0.945 0.000 1.000 0.000 0.000
#> GSM71680 4 0.4086 0.872 0.000 0.216 0.008 0.776
#> GSM71681 2 0.0000 0.945 0.000 1.000 0.000 0.000
#> GSM71682 2 0.0000 0.945 0.000 1.000 0.000 0.000
#> GSM71683 2 0.0000 0.945 0.000 1.000 0.000 0.000
#> GSM71684 2 0.0000 0.945 0.000 1.000 0.000 0.000
#> GSM71685 2 0.0000 0.945 0.000 1.000 0.000 0.000
#> GSM71686 2 0.0000 0.945 0.000 1.000 0.000 0.000
#> GSM71687 2 0.0000 0.945 0.000 1.000 0.000 0.000
#> GSM71688 2 0.0000 0.945 0.000 1.000 0.000 0.000
#> GSM71689 3 0.0188 1.000 0.000 0.004 0.996 0.000
#> GSM71690 2 0.0000 0.945 0.000 1.000 0.000 0.000
#> GSM71691 2 0.3569 0.732 0.000 0.804 0.196 0.000
#> GSM71692 3 0.0188 1.000 0.000 0.004 0.996 0.000
#> GSM71693 2 0.0000 0.945 0.000 1.000 0.000 0.000
#> GSM71694 3 0.0188 1.000 0.000 0.004 0.996 0.000
#> GSM71695 2 0.3942 0.683 0.000 0.764 0.236 0.000
#> GSM71696 1 0.3494 0.907 0.824 0.000 0.004 0.172
#> GSM71697 1 0.3123 0.914 0.844 0.000 0.000 0.156
#> GSM71698 1 0.1118 0.909 0.964 0.000 0.000 0.036
#> GSM71699 1 0.0592 0.913 0.984 0.000 0.000 0.016
#> GSM71700 1 0.1867 0.923 0.928 0.000 0.000 0.072
#> GSM71701 1 0.0817 0.911 0.976 0.000 0.000 0.024
#> GSM71702 1 0.0592 0.913 0.984 0.000 0.000 0.016
#> GSM71703 1 0.0592 0.913 0.984 0.000 0.000 0.016
#> GSM71704 1 0.0592 0.913 0.984 0.000 0.000 0.016
#> GSM71705 1 0.0817 0.916 0.976 0.000 0.000 0.024
#> GSM71706 1 0.0592 0.913 0.984 0.000 0.000 0.016
#> GSM71707 1 0.0707 0.915 0.980 0.000 0.000 0.020
#> GSM71708 1 0.0592 0.913 0.984 0.000 0.000 0.016
#> GSM71709 4 0.4122 0.870 0.000 0.236 0.004 0.760
#> GSM71710 1 0.3172 0.913 0.840 0.000 0.000 0.160
#> GSM71711 1 0.3074 0.914 0.848 0.000 0.000 0.152
#> GSM71712 4 0.3441 0.721 0.120 0.024 0.000 0.856
#> GSM71713 1 0.1389 0.901 0.952 0.000 0.000 0.048
#> GSM71714 1 0.2647 0.921 0.880 0.000 0.000 0.120
#> GSM71715 1 0.3494 0.905 0.824 0.000 0.004 0.172
#> GSM71716 1 0.3356 0.905 0.824 0.000 0.000 0.176
#> GSM71717 1 0.3074 0.914 0.848 0.000 0.000 0.152
#> GSM71718 1 0.3528 0.902 0.808 0.000 0.000 0.192
#> GSM71719 1 0.3444 0.903 0.816 0.000 0.000 0.184
#> GSM71720 1 0.3486 0.903 0.812 0.000 0.000 0.188
#> GSM71721 1 0.2921 0.918 0.860 0.000 0.000 0.140
#> GSM71722 1 0.2530 0.922 0.888 0.000 0.000 0.112
#> GSM71723 1 0.3266 0.911 0.832 0.000 0.000 0.168
#> GSM71724 1 0.1022 0.915 0.968 0.000 0.000 0.032
#> GSM71725 4 0.2530 0.610 0.112 0.000 0.000 0.888
#> GSM71726 4 0.3569 0.870 0.000 0.196 0.000 0.804
#> GSM71727 4 0.4103 0.862 0.000 0.256 0.000 0.744
#> GSM71728 4 0.3486 0.867 0.000 0.188 0.000 0.812
#> GSM71729 4 0.4193 0.853 0.000 0.268 0.000 0.732
#> GSM71730 4 0.4193 0.853 0.000 0.268 0.000 0.732
#> GSM71731 1 0.3400 0.904 0.820 0.000 0.000 0.180
#> GSM71732 1 0.3311 0.911 0.828 0.000 0.000 0.172
#> GSM71733 1 0.2469 0.923 0.892 0.000 0.000 0.108
#> GSM71734 1 0.0921 0.917 0.972 0.000 0.000 0.028
#> GSM71735 1 0.1118 0.921 0.964 0.000 0.000 0.036
#> GSM71736 1 0.0707 0.914 0.980 0.000 0.000 0.020
#> GSM71737 1 0.1716 0.923 0.936 0.000 0.000 0.064
#> GSM71738 1 0.0592 0.913 0.984 0.000 0.000 0.016
#> GSM71739 2 0.2466 0.827 0.000 0.900 0.004 0.096
#> GSM71740 1 0.3219 0.912 0.836 0.000 0.000 0.164
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> GSM71671 3 0.0000 1.000 0.000 0.000 1.000 0.000 0.000
#> GSM71672 3 0.0000 1.000 0.000 0.000 1.000 0.000 0.000
#> GSM71673 3 0.0000 1.000 0.000 0.000 1.000 0.000 0.000
#> GSM71674 3 0.0000 1.000 0.000 0.000 1.000 0.000 0.000
#> GSM71675 3 0.0000 1.000 0.000 0.000 1.000 0.000 0.000
#> GSM71676 3 0.0000 1.000 0.000 0.000 1.000 0.000 0.000
#> GSM71677 3 0.0000 1.000 0.000 0.000 1.000 0.000 0.000
#> GSM71678 2 0.0290 0.945 0.008 0.992 0.000 0.000 0.000
#> GSM71679 2 0.0290 0.945 0.008 0.992 0.000 0.000 0.000
#> GSM71680 4 0.1608 0.921 0.000 0.072 0.000 0.928 0.000
#> GSM71681 2 0.0451 0.943 0.004 0.988 0.000 0.008 0.000
#> GSM71682 2 0.0290 0.945 0.008 0.992 0.000 0.000 0.000
#> GSM71683 2 0.0404 0.943 0.012 0.988 0.000 0.000 0.000
#> GSM71684 2 0.0703 0.934 0.000 0.976 0.000 0.024 0.000
#> GSM71685 2 0.1792 0.884 0.000 0.916 0.000 0.084 0.000
#> GSM71686 2 0.0290 0.945 0.008 0.992 0.000 0.000 0.000
#> GSM71687 2 0.0510 0.942 0.016 0.984 0.000 0.000 0.000
#> GSM71688 2 0.0162 0.944 0.004 0.996 0.000 0.000 0.000
#> GSM71689 3 0.0000 1.000 0.000 0.000 1.000 0.000 0.000
#> GSM71690 2 0.0290 0.945 0.008 0.992 0.000 0.000 0.000
#> GSM71691 2 0.2448 0.873 0.020 0.892 0.088 0.000 0.000
#> GSM71692 3 0.0000 1.000 0.000 0.000 1.000 0.000 0.000
#> GSM71693 2 0.0404 0.943 0.012 0.988 0.000 0.000 0.000
#> GSM71694 3 0.0000 1.000 0.000 0.000 1.000 0.000 0.000
#> GSM71695 2 0.3141 0.806 0.016 0.832 0.152 0.000 0.000
#> GSM71696 5 0.3370 0.752 0.148 0.000 0.000 0.028 0.824
#> GSM71697 5 0.2439 0.758 0.120 0.000 0.000 0.004 0.876
#> GSM71698 1 0.3700 0.810 0.752 0.000 0.000 0.008 0.240
#> GSM71699 1 0.3160 0.864 0.808 0.000 0.000 0.004 0.188
#> GSM71700 5 0.4359 0.134 0.412 0.000 0.000 0.004 0.584
#> GSM71701 1 0.3455 0.843 0.784 0.000 0.000 0.008 0.208
#> GSM71702 1 0.3300 0.865 0.792 0.000 0.000 0.004 0.204
#> GSM71703 1 0.3196 0.868 0.804 0.000 0.000 0.004 0.192
#> GSM71704 1 0.3074 0.870 0.804 0.000 0.000 0.000 0.196
#> GSM71705 1 0.4127 0.794 0.680 0.000 0.000 0.008 0.312
#> GSM71706 1 0.3366 0.869 0.784 0.000 0.000 0.004 0.212
#> GSM71707 1 0.3910 0.842 0.720 0.000 0.000 0.008 0.272
#> GSM71708 1 0.3177 0.869 0.792 0.000 0.000 0.000 0.208
#> GSM71709 4 0.1908 0.922 0.000 0.092 0.000 0.908 0.000
#> GSM71710 5 0.3163 0.741 0.164 0.000 0.000 0.012 0.824
#> GSM71711 5 0.3430 0.691 0.220 0.000 0.000 0.004 0.776
#> GSM71712 4 0.5452 0.673 0.200 0.000 0.000 0.656 0.144
#> GSM71713 1 0.2464 0.691 0.888 0.000 0.000 0.016 0.096
#> GSM71714 5 0.4227 0.523 0.292 0.000 0.000 0.016 0.692
#> GSM71715 5 0.3099 0.744 0.124 0.000 0.000 0.028 0.848
#> GSM71716 5 0.2362 0.757 0.076 0.000 0.000 0.024 0.900
#> GSM71717 5 0.3550 0.715 0.184 0.000 0.000 0.020 0.796
#> GSM71718 5 0.1018 0.744 0.016 0.000 0.000 0.016 0.968
#> GSM71719 5 0.0290 0.746 0.000 0.000 0.000 0.008 0.992
#> GSM71720 5 0.0404 0.745 0.000 0.000 0.000 0.012 0.988
#> GSM71721 5 0.3897 0.620 0.204 0.000 0.000 0.028 0.768
#> GSM71722 5 0.4086 0.463 0.284 0.000 0.000 0.012 0.704
#> GSM71723 5 0.3231 0.703 0.196 0.000 0.000 0.004 0.800
#> GSM71724 1 0.4040 0.841 0.712 0.000 0.000 0.012 0.276
#> GSM71725 5 0.6236 -0.164 0.144 0.000 0.000 0.400 0.456
#> GSM71726 4 0.2149 0.905 0.036 0.048 0.000 0.916 0.000
#> GSM71727 4 0.1965 0.922 0.000 0.096 0.000 0.904 0.000
#> GSM71728 4 0.3019 0.887 0.088 0.048 0.000 0.864 0.000
#> GSM71729 4 0.2233 0.919 0.004 0.104 0.000 0.892 0.000
#> GSM71730 4 0.2074 0.917 0.000 0.104 0.000 0.896 0.000
#> GSM71731 5 0.1043 0.760 0.040 0.000 0.000 0.000 0.960
#> GSM71732 5 0.2079 0.757 0.064 0.000 0.000 0.020 0.916
#> GSM71733 5 0.4494 0.261 0.380 0.000 0.000 0.012 0.608
#> GSM71734 1 0.4138 0.828 0.708 0.000 0.000 0.016 0.276
#> GSM71735 1 0.4551 0.656 0.616 0.000 0.000 0.016 0.368
#> GSM71736 1 0.3519 0.868 0.776 0.000 0.000 0.008 0.216
#> GSM71737 1 0.4818 0.352 0.520 0.000 0.000 0.020 0.460
#> GSM71738 1 0.3942 0.845 0.728 0.000 0.000 0.012 0.260
#> GSM71739 2 0.4855 0.680 0.040 0.736 0.000 0.032 0.192
#> GSM71740 5 0.2470 0.763 0.104 0.000 0.000 0.012 0.884
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> GSM71671 3 0.0000 1.0000 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM71672 3 0.0000 1.0000 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM71673 3 0.0000 1.0000 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM71674 3 0.0000 1.0000 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM71675 3 0.0000 1.0000 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM71676 3 0.0000 1.0000 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM71677 3 0.0000 1.0000 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM71678 2 0.0146 0.9123 0.000 0.996 0.000 0.000 0.004 0.000
#> GSM71679 2 0.0146 0.9123 0.000 0.996 0.000 0.000 0.004 0.000
#> GSM71680 4 0.0291 0.8766 0.000 0.004 0.000 0.992 0.004 0.000
#> GSM71681 2 0.1168 0.8990 0.000 0.956 0.000 0.028 0.016 0.000
#> GSM71682 2 0.0146 0.9123 0.000 0.996 0.000 0.000 0.004 0.000
#> GSM71683 2 0.0692 0.9098 0.004 0.976 0.000 0.000 0.020 0.000
#> GSM71684 2 0.1524 0.8805 0.000 0.932 0.000 0.060 0.008 0.000
#> GSM71685 2 0.3778 0.6256 0.000 0.708 0.000 0.272 0.020 0.000
#> GSM71686 2 0.0146 0.9123 0.000 0.996 0.000 0.000 0.004 0.000
#> GSM71687 2 0.0547 0.9092 0.000 0.980 0.000 0.000 0.020 0.000
#> GSM71688 2 0.0146 0.9119 0.004 0.996 0.000 0.000 0.000 0.000
#> GSM71689 3 0.0000 1.0000 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM71690 2 0.0000 0.9120 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM71691 2 0.2641 0.8448 0.004 0.876 0.072 0.000 0.048 0.000
#> GSM71692 3 0.0000 1.0000 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM71693 2 0.0603 0.9104 0.004 0.980 0.000 0.000 0.016 0.000
#> GSM71694 3 0.0000 1.0000 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM71695 2 0.3304 0.7701 0.004 0.816 0.140 0.000 0.040 0.000
#> GSM71696 1 0.4361 0.6826 0.720 0.000 0.000 0.000 0.168 0.112
#> GSM71697 1 0.4095 0.7037 0.728 0.000 0.000 0.000 0.064 0.208
#> GSM71698 6 0.4108 0.6660 0.092 0.000 0.000 0.000 0.164 0.744
#> GSM71699 6 0.1367 0.7527 0.012 0.000 0.000 0.000 0.044 0.944
#> GSM71700 6 0.5492 -0.0503 0.400 0.000 0.000 0.000 0.128 0.472
#> GSM71701 6 0.2979 0.7222 0.044 0.000 0.000 0.000 0.116 0.840
#> GSM71702 6 0.2511 0.7568 0.056 0.000 0.000 0.000 0.064 0.880
#> GSM71703 6 0.0993 0.7588 0.012 0.000 0.000 0.000 0.024 0.964
#> GSM71704 6 0.0909 0.7592 0.020 0.000 0.000 0.000 0.012 0.968
#> GSM71705 6 0.4238 0.6639 0.180 0.000 0.000 0.000 0.092 0.728
#> GSM71706 6 0.1908 0.7533 0.056 0.000 0.000 0.000 0.028 0.916
#> GSM71707 6 0.4094 0.6742 0.168 0.000 0.000 0.000 0.088 0.744
#> GSM71708 6 0.1418 0.7598 0.032 0.000 0.000 0.000 0.024 0.944
#> GSM71709 4 0.0520 0.8767 0.000 0.008 0.000 0.984 0.008 0.000
#> GSM71710 1 0.4282 0.7087 0.720 0.000 0.000 0.000 0.088 0.192
#> GSM71711 1 0.4453 0.6012 0.624 0.000 0.000 0.000 0.044 0.332
#> GSM71712 5 0.5304 0.4687 0.056 0.000 0.000 0.308 0.600 0.036
#> GSM71713 6 0.3672 0.5105 0.008 0.000 0.000 0.000 0.304 0.688
#> GSM71714 1 0.5095 0.4202 0.544 0.000 0.000 0.000 0.088 0.368
#> GSM71715 1 0.4311 0.6085 0.716 0.000 0.000 0.000 0.196 0.088
#> GSM71716 1 0.3657 0.6995 0.792 0.000 0.000 0.000 0.100 0.108
#> GSM71717 1 0.5058 0.6019 0.600 0.000 0.000 0.000 0.108 0.292
#> GSM71718 1 0.2697 0.6661 0.864 0.000 0.000 0.000 0.092 0.044
#> GSM71719 1 0.2554 0.6846 0.876 0.000 0.000 0.000 0.076 0.048
#> GSM71720 1 0.2384 0.6906 0.888 0.000 0.000 0.000 0.064 0.048
#> GSM71721 1 0.5304 0.5483 0.600 0.000 0.000 0.000 0.200 0.200
#> GSM71722 1 0.5336 0.4872 0.572 0.000 0.000 0.000 0.144 0.284
#> GSM71723 1 0.4371 0.6271 0.664 0.000 0.000 0.000 0.052 0.284
#> GSM71724 6 0.3854 0.7120 0.136 0.000 0.000 0.000 0.092 0.772
#> GSM71725 5 0.5561 0.5935 0.260 0.000 0.000 0.144 0.584 0.012
#> GSM71726 4 0.2631 0.7055 0.000 0.000 0.000 0.820 0.180 0.000
#> GSM71727 4 0.0260 0.8769 0.000 0.008 0.000 0.992 0.000 0.000
#> GSM71728 4 0.3464 0.4492 0.000 0.000 0.000 0.688 0.312 0.000
#> GSM71729 4 0.0806 0.8712 0.000 0.008 0.000 0.972 0.020 0.000
#> GSM71730 4 0.0405 0.8756 0.000 0.008 0.000 0.988 0.004 0.000
#> GSM71731 1 0.2846 0.7142 0.856 0.000 0.000 0.000 0.060 0.084
#> GSM71732 1 0.4085 0.6995 0.752 0.000 0.000 0.000 0.120 0.128
#> GSM71733 1 0.5095 0.3210 0.500 0.000 0.000 0.000 0.080 0.420
#> GSM71734 6 0.4587 0.6215 0.204 0.000 0.000 0.000 0.108 0.688
#> GSM71735 6 0.4573 0.5077 0.244 0.000 0.000 0.000 0.084 0.672
#> GSM71736 6 0.2910 0.7405 0.080 0.000 0.000 0.000 0.068 0.852
#> GSM71737 6 0.5016 0.2621 0.324 0.000 0.000 0.000 0.092 0.584
#> GSM71738 6 0.2972 0.7132 0.128 0.000 0.000 0.000 0.036 0.836
#> GSM71739 2 0.6017 0.4012 0.196 0.572 0.000 0.036 0.196 0.000
#> GSM71740 1 0.3284 0.7337 0.800 0.000 0.000 0.000 0.032 0.168
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) k
#> CV:skmeans 70 9.38e-11 2
#> CV:skmeans 70 2.29e-15 3
#> CV:skmeans 70 1.62e-19 4
#> CV:skmeans 65 9.26e-17 5
#> CV:skmeans 62 9.00e-16 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 21168 rows and 70 columns.
#> Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'CV' method.
#> Subgroups are detected by 'pam' method.
#> Performed in total 1250 partitions by row resampling.
#> Best k for subgroups seems to be 4.
#>
#> Following methods can be applied to this 'ConsensusPartition' object:
#> [1] "cola_report" "collect_classes" "collect_plots"
#> [4] "collect_stats" "colnames" "compare_signatures"
#> [7] "consensus_heatmap" "dimension_reduction" "functional_enrichment"
#> [10] "get_anno_col" "get_anno" "get_classes"
#> [13] "get_consensus" "get_matrix" "get_membership"
#> [16] "get_param" "get_signatures" "get_stats"
#> [19] "is_best_k" "is_stable_k" "membership_heatmap"
#> [22] "ncol" "nrow" "plot_ecdf"
#> [25] "rownames" "select_partition_number" "show"
#> [28] "suggest_best_k" "test_to_known_factors"
collect_plots()
function collects all the plots made from res
for all k
(number of partitions)
into one single page to provide an easy and fast comparison between different k
.
collect_plots(res)
The plots are:
k
and the heatmap of
predicted classes for each k
.k
.k
.k
.All the plots in panels can be made by individual functions and they are plotted later in this section.
select_partition_number()
produces several plots showing different
statistics for choosing “optimized” k
. There are following statistics:
k
;k
, the area increased is defined as \(A_k - A_{k-1}\).The detailed explanations of these statistics can be found in the cola vignette.
Generally speaking, lower PAC score, higher mean silhouette score or higher
concordance corresponds to better partition. Rand index and Jaccard index
measure how similar the current partition is compared to partition with k-1
.
If they are too similar, we won't accept k
is better than k-1
.
select_partition_number(res)
The numeric values for all these statistics can be obtained by get_stats()
.
get_stats(res)
#> k 1-PAC mean_silhouette concordance area_increased Rand Jaccard
#> 2 2 1.000 0.998 0.999 0.4931 0.508 0.508
#> 3 3 1.000 0.965 0.986 0.1645 0.921 0.845
#> 4 4 1.000 0.985 0.995 0.0940 0.930 0.840
#> 5 5 0.811 0.850 0.925 0.2336 0.832 0.554
#> 6 6 0.797 0.808 0.883 0.0214 0.991 0.960
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
#> GSM71671 2 0.0000 1.000 0.000 1.000
#> GSM71672 2 0.0000 1.000 0.000 1.000
#> GSM71673 2 0.0000 1.000 0.000 1.000
#> GSM71674 2 0.0000 1.000 0.000 1.000
#> GSM71675 2 0.0000 1.000 0.000 1.000
#> GSM71676 2 0.0000 1.000 0.000 1.000
#> GSM71677 2 0.0000 1.000 0.000 1.000
#> GSM71678 2 0.0000 1.000 0.000 1.000
#> GSM71679 2 0.0000 1.000 0.000 1.000
#> GSM71680 2 0.0376 0.996 0.004 0.996
#> GSM71681 2 0.0000 1.000 0.000 1.000
#> GSM71682 2 0.0000 1.000 0.000 1.000
#> GSM71683 2 0.0000 1.000 0.000 1.000
#> GSM71684 2 0.0000 1.000 0.000 1.000
#> GSM71685 2 0.0000 1.000 0.000 1.000
#> GSM71686 2 0.0000 1.000 0.000 1.000
#> GSM71687 2 0.0000 1.000 0.000 1.000
#> GSM71688 2 0.0000 1.000 0.000 1.000
#> GSM71689 2 0.0000 1.000 0.000 1.000
#> GSM71690 2 0.0000 1.000 0.000 1.000
#> GSM71691 2 0.0000 1.000 0.000 1.000
#> GSM71692 2 0.0000 1.000 0.000 1.000
#> GSM71693 2 0.0000 1.000 0.000 1.000
#> GSM71694 2 0.0000 1.000 0.000 1.000
#> GSM71695 2 0.0000 1.000 0.000 1.000
#> GSM71696 1 0.0000 0.999 1.000 0.000
#> GSM71697 1 0.0000 0.999 1.000 0.000
#> GSM71698 1 0.0000 0.999 1.000 0.000
#> GSM71699 1 0.0000 0.999 1.000 0.000
#> GSM71700 1 0.0000 0.999 1.000 0.000
#> GSM71701 1 0.0000 0.999 1.000 0.000
#> GSM71702 1 0.0000 0.999 1.000 0.000
#> GSM71703 1 0.0000 0.999 1.000 0.000
#> GSM71704 1 0.0000 0.999 1.000 0.000
#> GSM71705 1 0.0000 0.999 1.000 0.000
#> GSM71706 1 0.0000 0.999 1.000 0.000
#> GSM71707 1 0.0000 0.999 1.000 0.000
#> GSM71708 1 0.0000 0.999 1.000 0.000
#> GSM71709 2 0.0000 1.000 0.000 1.000
#> GSM71710 1 0.0000 0.999 1.000 0.000
#> GSM71711 1 0.0000 0.999 1.000 0.000
#> GSM71712 1 0.0000 0.999 1.000 0.000
#> GSM71713 1 0.0000 0.999 1.000 0.000
#> GSM71714 1 0.0000 0.999 1.000 0.000
#> GSM71715 1 0.0000 0.999 1.000 0.000
#> GSM71716 1 0.0000 0.999 1.000 0.000
#> GSM71717 1 0.0000 0.999 1.000 0.000
#> GSM71718 1 0.0000 0.999 1.000 0.000
#> GSM71719 1 0.0000 0.999 1.000 0.000
#> GSM71720 1 0.0000 0.999 1.000 0.000
#> GSM71721 1 0.0000 0.999 1.000 0.000
#> GSM71722 1 0.0000 0.999 1.000 0.000
#> GSM71723 1 0.0000 0.999 1.000 0.000
#> GSM71724 1 0.0000 0.999 1.000 0.000
#> GSM71725 1 0.0000 0.999 1.000 0.000
#> GSM71726 1 0.0000 0.999 1.000 0.000
#> GSM71727 2 0.0000 1.000 0.000 1.000
#> GSM71728 1 0.0000 0.999 1.000 0.000
#> GSM71729 2 0.0000 1.000 0.000 1.000
#> GSM71730 2 0.0000 1.000 0.000 1.000
#> GSM71731 1 0.0000 0.999 1.000 0.000
#> GSM71732 1 0.0000 0.999 1.000 0.000
#> GSM71733 1 0.0000 0.999 1.000 0.000
#> GSM71734 1 0.0000 0.999 1.000 0.000
#> GSM71735 1 0.0000 0.999 1.000 0.000
#> GSM71736 1 0.0000 0.999 1.000 0.000
#> GSM71737 1 0.0000 0.999 1.000 0.000
#> GSM71738 1 0.0000 0.999 1.000 0.000
#> GSM71739 1 0.3114 0.941 0.944 0.056
#> GSM71740 1 0.0000 0.999 1.000 0.000
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> GSM71671 3 0.000 0.991 0.000 0.000 1.000
#> GSM71672 3 0.000 0.991 0.000 0.000 1.000
#> GSM71673 3 0.000 0.991 0.000 0.000 1.000
#> GSM71674 3 0.000 0.991 0.000 0.000 1.000
#> GSM71675 3 0.000 0.991 0.000 0.000 1.000
#> GSM71676 3 0.000 0.991 0.000 0.000 1.000
#> GSM71677 3 0.000 0.991 0.000 0.000 1.000
#> GSM71678 2 0.000 0.970 0.000 1.000 0.000
#> GSM71679 2 0.000 0.970 0.000 1.000 0.000
#> GSM71680 2 0.857 0.151 0.100 0.508 0.392
#> GSM71681 2 0.000 0.970 0.000 1.000 0.000
#> GSM71682 2 0.000 0.970 0.000 1.000 0.000
#> GSM71683 2 0.000 0.970 0.000 1.000 0.000
#> GSM71684 2 0.000 0.970 0.000 1.000 0.000
#> GSM71685 2 0.000 0.970 0.000 1.000 0.000
#> GSM71686 2 0.000 0.970 0.000 1.000 0.000
#> GSM71687 2 0.000 0.970 0.000 1.000 0.000
#> GSM71688 2 0.000 0.970 0.000 1.000 0.000
#> GSM71689 3 0.245 0.914 0.000 0.076 0.924
#> GSM71690 2 0.000 0.970 0.000 1.000 0.000
#> GSM71691 2 0.000 0.970 0.000 1.000 0.000
#> GSM71692 3 0.000 0.991 0.000 0.000 1.000
#> GSM71693 2 0.000 0.970 0.000 1.000 0.000
#> GSM71694 3 0.000 0.991 0.000 0.000 1.000
#> GSM71695 2 0.000 0.970 0.000 1.000 0.000
#> GSM71696 1 0.000 0.990 1.000 0.000 0.000
#> GSM71697 1 0.000 0.990 1.000 0.000 0.000
#> GSM71698 1 0.000 0.990 1.000 0.000 0.000
#> GSM71699 1 0.000 0.990 1.000 0.000 0.000
#> GSM71700 1 0.000 0.990 1.000 0.000 0.000
#> GSM71701 1 0.000 0.990 1.000 0.000 0.000
#> GSM71702 1 0.000 0.990 1.000 0.000 0.000
#> GSM71703 1 0.000 0.990 1.000 0.000 0.000
#> GSM71704 1 0.000 0.990 1.000 0.000 0.000
#> GSM71705 1 0.000 0.990 1.000 0.000 0.000
#> GSM71706 1 0.000 0.990 1.000 0.000 0.000
#> GSM71707 1 0.000 0.990 1.000 0.000 0.000
#> GSM71708 1 0.000 0.990 1.000 0.000 0.000
#> GSM71709 2 0.000 0.970 0.000 1.000 0.000
#> GSM71710 1 0.000 0.990 1.000 0.000 0.000
#> GSM71711 1 0.000 0.990 1.000 0.000 0.000
#> GSM71712 1 0.000 0.990 1.000 0.000 0.000
#> GSM71713 1 0.000 0.990 1.000 0.000 0.000
#> GSM71714 1 0.000 0.990 1.000 0.000 0.000
#> GSM71715 1 0.000 0.990 1.000 0.000 0.000
#> GSM71716 1 0.000 0.990 1.000 0.000 0.000
#> GSM71717 1 0.000 0.990 1.000 0.000 0.000
#> GSM71718 1 0.000 0.990 1.000 0.000 0.000
#> GSM71719 1 0.000 0.990 1.000 0.000 0.000
#> GSM71720 1 0.000 0.990 1.000 0.000 0.000
#> GSM71721 1 0.000 0.990 1.000 0.000 0.000
#> GSM71722 1 0.000 0.990 1.000 0.000 0.000
#> GSM71723 1 0.000 0.990 1.000 0.000 0.000
#> GSM71724 1 0.000 0.990 1.000 0.000 0.000
#> GSM71725 1 0.000 0.990 1.000 0.000 0.000
#> GSM71726 1 0.116 0.963 0.972 0.028 0.000
#> GSM71727 2 0.153 0.917 0.040 0.960 0.000
#> GSM71728 1 0.514 0.659 0.748 0.252 0.000
#> GSM71729 2 0.000 0.970 0.000 1.000 0.000
#> GSM71730 2 0.000 0.970 0.000 1.000 0.000
#> GSM71731 1 0.000 0.990 1.000 0.000 0.000
#> GSM71732 1 0.000 0.990 1.000 0.000 0.000
#> GSM71733 1 0.000 0.990 1.000 0.000 0.000
#> GSM71734 1 0.000 0.990 1.000 0.000 0.000
#> GSM71735 1 0.000 0.990 1.000 0.000 0.000
#> GSM71736 1 0.000 0.990 1.000 0.000 0.000
#> GSM71737 1 0.000 0.990 1.000 0.000 0.000
#> GSM71738 1 0.000 0.990 1.000 0.000 0.000
#> GSM71739 1 0.254 0.906 0.920 0.080 0.000
#> GSM71740 1 0.000 0.990 1.000 0.000 0.000
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> GSM71671 3 0.000 1.000 0.000 0.000 1 0.00
#> GSM71672 3 0.000 1.000 0.000 0.000 1 0.00
#> GSM71673 3 0.000 1.000 0.000 0.000 1 0.00
#> GSM71674 3 0.000 1.000 0.000 0.000 1 0.00
#> GSM71675 3 0.000 1.000 0.000 0.000 1 0.00
#> GSM71676 3 0.000 1.000 0.000 0.000 1 0.00
#> GSM71677 3 0.000 1.000 0.000 0.000 1 0.00
#> GSM71678 2 0.000 1.000 0.000 1.000 0 0.00
#> GSM71679 2 0.000 1.000 0.000 1.000 0 0.00
#> GSM71680 4 0.000 0.933 0.000 0.000 0 1.00
#> GSM71681 2 0.000 1.000 0.000 1.000 0 0.00
#> GSM71682 2 0.000 1.000 0.000 1.000 0 0.00
#> GSM71683 2 0.000 1.000 0.000 1.000 0 0.00
#> GSM71684 2 0.000 1.000 0.000 1.000 0 0.00
#> GSM71685 4 0.121 0.902 0.000 0.040 0 0.96
#> GSM71686 2 0.000 1.000 0.000 1.000 0 0.00
#> GSM71687 2 0.000 1.000 0.000 1.000 0 0.00
#> GSM71688 2 0.000 1.000 0.000 1.000 0 0.00
#> GSM71689 3 0.000 1.000 0.000 0.000 1 0.00
#> GSM71690 2 0.000 1.000 0.000 1.000 0 0.00
#> GSM71691 2 0.000 1.000 0.000 1.000 0 0.00
#> GSM71692 3 0.000 1.000 0.000 0.000 1 0.00
#> GSM71693 2 0.000 1.000 0.000 1.000 0 0.00
#> GSM71694 3 0.000 1.000 0.000 0.000 1 0.00
#> GSM71695 2 0.000 1.000 0.000 1.000 0 0.00
#> GSM71696 1 0.000 0.998 1.000 0.000 0 0.00
#> GSM71697 1 0.000 0.998 1.000 0.000 0 0.00
#> GSM71698 1 0.000 0.998 1.000 0.000 0 0.00
#> GSM71699 1 0.000 0.998 1.000 0.000 0 0.00
#> GSM71700 1 0.000 0.998 1.000 0.000 0 0.00
#> GSM71701 1 0.000 0.998 1.000 0.000 0 0.00
#> GSM71702 1 0.000 0.998 1.000 0.000 0 0.00
#> GSM71703 1 0.000 0.998 1.000 0.000 0 0.00
#> GSM71704 1 0.000 0.998 1.000 0.000 0 0.00
#> GSM71705 1 0.000 0.998 1.000 0.000 0 0.00
#> GSM71706 1 0.000 0.998 1.000 0.000 0 0.00
#> GSM71707 1 0.000 0.998 1.000 0.000 0 0.00
#> GSM71708 1 0.000 0.998 1.000 0.000 0 0.00
#> GSM71709 4 0.000 0.933 0.000 0.000 0 1.00
#> GSM71710 1 0.000 0.998 1.000 0.000 0 0.00
#> GSM71711 1 0.000 0.998 1.000 0.000 0 0.00
#> GSM71712 1 0.000 0.998 1.000 0.000 0 0.00
#> GSM71713 1 0.000 0.998 1.000 0.000 0 0.00
#> GSM71714 1 0.000 0.998 1.000 0.000 0 0.00
#> GSM71715 1 0.000 0.998 1.000 0.000 0 0.00
#> GSM71716 1 0.000 0.998 1.000 0.000 0 0.00
#> GSM71717 1 0.000 0.998 1.000 0.000 0 0.00
#> GSM71718 1 0.000 0.998 1.000 0.000 0 0.00
#> GSM71719 1 0.000 0.998 1.000 0.000 0 0.00
#> GSM71720 1 0.000 0.998 1.000 0.000 0 0.00
#> GSM71721 1 0.000 0.998 1.000 0.000 0 0.00
#> GSM71722 1 0.000 0.998 1.000 0.000 0 0.00
#> GSM71723 1 0.000 0.998 1.000 0.000 0 0.00
#> GSM71724 1 0.000 0.998 1.000 0.000 0 0.00
#> GSM71725 1 0.000 0.998 1.000 0.000 0 0.00
#> GSM71726 4 0.000 0.933 0.000 0.000 0 1.00
#> GSM71727 4 0.000 0.933 0.000 0.000 0 1.00
#> GSM71728 4 0.413 0.576 0.260 0.000 0 0.74
#> GSM71729 4 0.000 0.933 0.000 0.000 0 1.00
#> GSM71730 4 0.000 0.933 0.000 0.000 0 1.00
#> GSM71731 1 0.000 0.998 1.000 0.000 0 0.00
#> GSM71732 1 0.000 0.998 1.000 0.000 0 0.00
#> GSM71733 1 0.000 0.998 1.000 0.000 0 0.00
#> GSM71734 1 0.000 0.998 1.000 0.000 0 0.00
#> GSM71735 1 0.000 0.998 1.000 0.000 0 0.00
#> GSM71736 1 0.000 0.998 1.000 0.000 0 0.00
#> GSM71737 1 0.000 0.998 1.000 0.000 0 0.00
#> GSM71738 1 0.000 0.998 1.000 0.000 0 0.00
#> GSM71739 1 0.172 0.926 0.936 0.064 0 0.00
#> GSM71740 1 0.000 0.998 1.000 0.000 0 0.00
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> GSM71671 3 0.0000 1.0000 0.000 0.000 1 0.000 0.000
#> GSM71672 3 0.0000 1.0000 0.000 0.000 1 0.000 0.000
#> GSM71673 3 0.0000 1.0000 0.000 0.000 1 0.000 0.000
#> GSM71674 3 0.0000 1.0000 0.000 0.000 1 0.000 0.000
#> GSM71675 3 0.0000 1.0000 0.000 0.000 1 0.000 0.000
#> GSM71676 3 0.0000 1.0000 0.000 0.000 1 0.000 0.000
#> GSM71677 3 0.0000 1.0000 0.000 0.000 1 0.000 0.000
#> GSM71678 2 0.0000 1.0000 0.000 1.000 0 0.000 0.000
#> GSM71679 2 0.0000 1.0000 0.000 1.000 0 0.000 0.000
#> GSM71680 4 0.0000 0.9886 0.000 0.000 0 1.000 0.000
#> GSM71681 2 0.0000 1.0000 0.000 1.000 0 0.000 0.000
#> GSM71682 2 0.0000 1.0000 0.000 1.000 0 0.000 0.000
#> GSM71683 2 0.0000 1.0000 0.000 1.000 0 0.000 0.000
#> GSM71684 2 0.0000 1.0000 0.000 1.000 0 0.000 0.000
#> GSM71685 4 0.1043 0.9557 0.000 0.040 0 0.960 0.000
#> GSM71686 2 0.0000 1.0000 0.000 1.000 0 0.000 0.000
#> GSM71687 2 0.0000 1.0000 0.000 1.000 0 0.000 0.000
#> GSM71688 2 0.0000 1.0000 0.000 1.000 0 0.000 0.000
#> GSM71689 3 0.0000 1.0000 0.000 0.000 1 0.000 0.000
#> GSM71690 2 0.0000 1.0000 0.000 1.000 0 0.000 0.000
#> GSM71691 2 0.0000 1.0000 0.000 1.000 0 0.000 0.000
#> GSM71692 3 0.0000 1.0000 0.000 0.000 1 0.000 0.000
#> GSM71693 2 0.0000 1.0000 0.000 1.000 0 0.000 0.000
#> GSM71694 3 0.0000 1.0000 0.000 0.000 1 0.000 0.000
#> GSM71695 2 0.0000 1.0000 0.000 1.000 0 0.000 0.000
#> GSM71696 5 0.2516 0.7747 0.140 0.000 0 0.000 0.860
#> GSM71697 5 0.2561 0.8065 0.144 0.000 0 0.000 0.856
#> GSM71698 1 0.4126 0.4057 0.620 0.000 0 0.000 0.380
#> GSM71699 1 0.0290 0.8851 0.992 0.000 0 0.000 0.008
#> GSM71700 5 0.2773 0.7991 0.164 0.000 0 0.000 0.836
#> GSM71701 1 0.2230 0.8123 0.884 0.000 0 0.000 0.116
#> GSM71702 1 0.0162 0.8845 0.996 0.000 0 0.000 0.004
#> GSM71703 1 0.0162 0.8848 0.996 0.000 0 0.000 0.004
#> GSM71704 1 0.0290 0.8851 0.992 0.000 0 0.000 0.008
#> GSM71705 1 0.3424 0.6577 0.760 0.000 0 0.000 0.240
#> GSM71706 1 0.0290 0.8851 0.992 0.000 0 0.000 0.008
#> GSM71707 1 0.2471 0.8030 0.864 0.000 0 0.000 0.136
#> GSM71708 1 0.0290 0.8851 0.992 0.000 0 0.000 0.008
#> GSM71709 4 0.0000 0.9886 0.000 0.000 0 1.000 0.000
#> GSM71710 5 0.2179 0.8112 0.112 0.000 0 0.000 0.888
#> GSM71711 5 0.2471 0.8108 0.136 0.000 0 0.000 0.864
#> GSM71712 5 0.0290 0.8058 0.008 0.000 0 0.000 0.992
#> GSM71713 1 0.0290 0.8847 0.992 0.000 0 0.000 0.008
#> GSM71714 1 0.2377 0.7986 0.872 0.000 0 0.000 0.128
#> GSM71715 5 0.2127 0.8200 0.108 0.000 0 0.000 0.892
#> GSM71716 5 0.2230 0.8171 0.116 0.000 0 0.000 0.884
#> GSM71717 5 0.4201 0.4146 0.408 0.000 0 0.000 0.592
#> GSM71718 5 0.1121 0.8213 0.044 0.000 0 0.000 0.956
#> GSM71719 5 0.0880 0.8214 0.032 0.000 0 0.000 0.968
#> GSM71720 5 0.1043 0.8207 0.040 0.000 0 0.000 0.960
#> GSM71721 5 0.4287 0.1177 0.460 0.000 0 0.000 0.540
#> GSM71722 5 0.4304 0.0241 0.484 0.000 0 0.000 0.516
#> GSM71723 1 0.3816 0.5314 0.696 0.000 0 0.000 0.304
#> GSM71724 1 0.0703 0.8823 0.976 0.000 0 0.000 0.024
#> GSM71725 5 0.0703 0.8163 0.024 0.000 0 0.000 0.976
#> GSM71726 4 0.0880 0.9717 0.000 0.000 0 0.968 0.032
#> GSM71727 4 0.0000 0.9886 0.000 0.000 0 1.000 0.000
#> GSM71728 5 0.0162 0.8068 0.004 0.000 0 0.000 0.996
#> GSM71729 4 0.0000 0.9886 0.000 0.000 0 1.000 0.000
#> GSM71730 4 0.0000 0.9886 0.000 0.000 0 1.000 0.000
#> GSM71731 5 0.2329 0.8170 0.124 0.000 0 0.000 0.876
#> GSM71732 5 0.4287 0.1150 0.460 0.000 0 0.000 0.540
#> GSM71733 1 0.3752 0.5537 0.708 0.000 0 0.000 0.292
#> GSM71734 1 0.1043 0.8765 0.960 0.000 0 0.000 0.040
#> GSM71735 1 0.0963 0.8797 0.964 0.000 0 0.000 0.036
#> GSM71736 1 0.0000 0.8833 1.000 0.000 0 0.000 0.000
#> GSM71737 1 0.1197 0.8736 0.952 0.000 0 0.000 0.048
#> GSM71738 1 0.0290 0.8851 0.992 0.000 0 0.000 0.008
#> GSM71739 5 0.1211 0.8194 0.024 0.016 0 0.000 0.960
#> GSM71740 5 0.2929 0.7850 0.180 0.000 0 0.000 0.820
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> GSM71671 3 0.0000 0.99006 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM71672 3 0.0000 0.99006 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM71673 3 0.0146 0.98616 0.000 0.000 0.996 0.000 0.004 0.000
#> GSM71674 3 0.0000 0.99006 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM71675 3 0.0000 0.99006 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM71676 3 0.0000 0.99006 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM71677 3 0.0790 0.94577 0.000 0.000 0.968 0.000 0.032 0.000
#> GSM71678 2 0.0458 0.99109 0.000 0.984 0.000 0.000 0.016 0.000
#> GSM71679 2 0.0458 0.99109 0.000 0.984 0.000 0.000 0.016 0.000
#> GSM71680 4 0.0000 0.95156 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM71681 2 0.0458 0.99109 0.000 0.984 0.000 0.000 0.016 0.000
#> GSM71682 2 0.0458 0.99109 0.000 0.984 0.000 0.000 0.016 0.000
#> GSM71683 2 0.0000 0.99344 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM71684 2 0.0000 0.99344 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM71685 4 0.0458 0.93883 0.000 0.016 0.000 0.984 0.000 0.000
#> GSM71686 2 0.0458 0.99109 0.000 0.984 0.000 0.000 0.016 0.000
#> GSM71687 2 0.0000 0.99344 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM71688 2 0.0000 0.99344 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM71689 5 0.4129 0.90029 0.000 0.012 0.424 0.000 0.564 0.000
#> GSM71690 2 0.0000 0.99344 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM71691 2 0.0260 0.99256 0.000 0.992 0.000 0.000 0.008 0.000
#> GSM71692 5 0.3828 0.89162 0.000 0.000 0.440 0.000 0.560 0.000
#> GSM71693 2 0.0000 0.99344 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM71694 5 0.3563 0.84164 0.000 0.000 0.336 0.000 0.664 0.000
#> GSM71695 2 0.0000 0.99344 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM71696 1 0.2658 0.71190 0.864 0.000 0.000 0.000 0.036 0.100
#> GSM71697 1 0.2491 0.75528 0.836 0.000 0.000 0.000 0.000 0.164
#> GSM71698 6 0.4569 0.38380 0.396 0.000 0.000 0.000 0.040 0.564
#> GSM71699 6 0.0717 0.86741 0.008 0.000 0.000 0.000 0.016 0.976
#> GSM71700 1 0.2697 0.74293 0.812 0.000 0.000 0.000 0.000 0.188
#> GSM71701 6 0.3248 0.74389 0.164 0.000 0.000 0.000 0.032 0.804
#> GSM71702 6 0.1297 0.86499 0.012 0.000 0.000 0.000 0.040 0.948
#> GSM71703 6 0.0363 0.86591 0.000 0.000 0.000 0.000 0.012 0.988
#> GSM71704 6 0.0603 0.86654 0.004 0.000 0.000 0.000 0.016 0.980
#> GSM71705 6 0.3950 0.63610 0.240 0.000 0.000 0.000 0.040 0.720
#> GSM71706 6 0.0622 0.86468 0.008 0.000 0.000 0.000 0.012 0.980
#> GSM71707 6 0.3422 0.74816 0.168 0.000 0.000 0.000 0.040 0.792
#> GSM71708 6 0.0622 0.86468 0.008 0.000 0.000 0.000 0.012 0.980
#> GSM71709 4 0.0000 0.95156 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM71710 1 0.1501 0.75872 0.924 0.000 0.000 0.000 0.000 0.076
#> GSM71711 1 0.2300 0.76475 0.856 0.000 0.000 0.000 0.000 0.144
#> GSM71712 1 0.3383 0.62899 0.728 0.000 0.000 0.000 0.268 0.004
#> GSM71713 6 0.0622 0.86687 0.008 0.000 0.000 0.000 0.012 0.980
#> GSM71714 6 0.2135 0.78673 0.128 0.000 0.000 0.000 0.000 0.872
#> GSM71715 1 0.2219 0.76906 0.864 0.000 0.000 0.000 0.000 0.136
#> GSM71716 1 0.2340 0.76255 0.852 0.000 0.000 0.000 0.000 0.148
#> GSM71717 1 0.3823 0.36506 0.564 0.000 0.000 0.000 0.000 0.436
#> GSM71718 1 0.0777 0.74961 0.972 0.000 0.000 0.000 0.004 0.024
#> GSM71719 1 0.0260 0.75053 0.992 0.000 0.000 0.000 0.000 0.008
#> GSM71720 1 0.0363 0.74998 0.988 0.000 0.000 0.000 0.000 0.012
#> GSM71721 1 0.4609 0.04163 0.540 0.000 0.000 0.000 0.040 0.420
#> GSM71722 1 0.4624 -0.00218 0.528 0.000 0.000 0.000 0.040 0.432
#> GSM71723 6 0.4065 0.51631 0.300 0.000 0.000 0.000 0.028 0.672
#> GSM71724 6 0.1010 0.86258 0.036 0.000 0.000 0.000 0.004 0.960
#> GSM71725 1 0.3244 0.62974 0.732 0.000 0.000 0.000 0.268 0.000
#> GSM71726 4 0.3490 0.69612 0.008 0.000 0.000 0.724 0.268 0.000
#> GSM71727 4 0.0000 0.95156 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM71728 1 0.3244 0.62974 0.732 0.000 0.000 0.000 0.268 0.000
#> GSM71729 4 0.0000 0.95156 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM71730 4 0.0000 0.95156 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM71731 1 0.2260 0.76902 0.860 0.000 0.000 0.000 0.000 0.140
#> GSM71732 1 0.4609 0.04035 0.540 0.000 0.000 0.000 0.040 0.420
#> GSM71733 6 0.4024 0.58834 0.264 0.000 0.000 0.000 0.036 0.700
#> GSM71734 6 0.1934 0.84722 0.044 0.000 0.000 0.000 0.040 0.916
#> GSM71735 6 0.0713 0.86429 0.028 0.000 0.000 0.000 0.000 0.972
#> GSM71736 6 0.0291 0.86655 0.004 0.000 0.000 0.000 0.004 0.992
#> GSM71737 6 0.1152 0.85778 0.044 0.000 0.000 0.000 0.004 0.952
#> GSM71738 6 0.0622 0.86667 0.008 0.000 0.000 0.000 0.012 0.980
#> GSM71739 1 0.0820 0.75227 0.972 0.012 0.000 0.000 0.000 0.016
#> GSM71740 1 0.2491 0.75841 0.836 0.000 0.000 0.000 0.000 0.164
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) k
#> CV:pam 70 1.15e-12 2
#> CV:pam 69 6.71e-19 3
#> CV:pam 70 6.96e-20 4
#> CV:pam 65 3.65e-17 5
#> CV:pam 65 1.56e-21 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 21168 rows and 70 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 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 0.973 0.988 0.5066 0.493 0.493
#> 3 3 0.988 0.972 0.981 0.2046 0.896 0.790
#> 4 4 0.922 0.905 0.961 0.0950 0.935 0.834
#> 5 5 0.745 0.803 0.876 0.0856 0.973 0.917
#> 6 6 0.688 0.574 0.783 0.0602 0.928 0.769
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
#> GSM71671 2 0.000 0.976 0.000 1.000
#> GSM71672 2 0.000 0.976 0.000 1.000
#> GSM71673 2 0.000 0.976 0.000 1.000
#> GSM71674 2 0.000 0.976 0.000 1.000
#> GSM71675 2 0.000 0.976 0.000 1.000
#> GSM71676 2 0.000 0.976 0.000 1.000
#> GSM71677 2 0.000 0.976 0.000 1.000
#> GSM71678 2 0.000 0.976 0.000 1.000
#> GSM71679 2 0.000 0.976 0.000 1.000
#> GSM71680 2 0.000 0.976 0.000 1.000
#> GSM71681 2 0.000 0.976 0.000 1.000
#> GSM71682 2 0.000 0.976 0.000 1.000
#> GSM71683 2 0.000 0.976 0.000 1.000
#> GSM71684 2 0.000 0.976 0.000 1.000
#> GSM71685 2 0.000 0.976 0.000 1.000
#> GSM71686 2 0.000 0.976 0.000 1.000
#> GSM71687 2 0.000 0.976 0.000 1.000
#> GSM71688 2 0.000 0.976 0.000 1.000
#> GSM71689 2 0.000 0.976 0.000 1.000
#> GSM71690 2 0.000 0.976 0.000 1.000
#> GSM71691 2 0.000 0.976 0.000 1.000
#> GSM71692 2 0.000 0.976 0.000 1.000
#> GSM71693 2 0.000 0.976 0.000 1.000
#> GSM71694 2 0.000 0.976 0.000 1.000
#> GSM71695 2 0.000 0.976 0.000 1.000
#> GSM71696 1 0.163 0.975 0.976 0.024
#> GSM71697 1 0.000 0.998 1.000 0.000
#> GSM71698 1 0.000 0.998 1.000 0.000
#> GSM71699 1 0.000 0.998 1.000 0.000
#> GSM71700 1 0.000 0.998 1.000 0.000
#> GSM71701 1 0.000 0.998 1.000 0.000
#> GSM71702 1 0.000 0.998 1.000 0.000
#> GSM71703 1 0.000 0.998 1.000 0.000
#> GSM71704 1 0.000 0.998 1.000 0.000
#> GSM71705 1 0.000 0.998 1.000 0.000
#> GSM71706 1 0.000 0.998 1.000 0.000
#> GSM71707 1 0.000 0.998 1.000 0.000
#> GSM71708 1 0.000 0.998 1.000 0.000
#> GSM71709 2 0.000 0.976 0.000 1.000
#> GSM71710 1 0.000 0.998 1.000 0.000
#> GSM71711 1 0.000 0.998 1.000 0.000
#> GSM71712 2 0.833 0.666 0.264 0.736
#> GSM71713 1 0.184 0.971 0.972 0.028
#> GSM71714 1 0.000 0.998 1.000 0.000
#> GSM71715 2 0.722 0.764 0.200 0.800
#> GSM71716 1 0.000 0.998 1.000 0.000
#> GSM71717 1 0.000 0.998 1.000 0.000
#> GSM71718 1 0.000 0.998 1.000 0.000
#> GSM71719 1 0.000 0.998 1.000 0.000
#> GSM71720 1 0.000 0.998 1.000 0.000
#> GSM71721 1 0.000 0.998 1.000 0.000
#> GSM71722 1 0.000 0.998 1.000 0.000
#> GSM71723 1 0.000 0.998 1.000 0.000
#> GSM71724 1 0.000 0.998 1.000 0.000
#> GSM71725 2 0.833 0.666 0.264 0.736
#> GSM71726 2 0.000 0.976 0.000 1.000
#> GSM71727 2 0.000 0.976 0.000 1.000
#> GSM71728 2 0.242 0.943 0.040 0.960
#> GSM71729 2 0.000 0.976 0.000 1.000
#> GSM71730 2 0.000 0.976 0.000 1.000
#> GSM71731 1 0.000 0.998 1.000 0.000
#> GSM71732 1 0.000 0.998 1.000 0.000
#> GSM71733 1 0.000 0.998 1.000 0.000
#> GSM71734 1 0.000 0.998 1.000 0.000
#> GSM71735 1 0.000 0.998 1.000 0.000
#> GSM71736 1 0.000 0.998 1.000 0.000
#> GSM71737 1 0.000 0.998 1.000 0.000
#> GSM71738 1 0.000 0.998 1.000 0.000
#> GSM71739 2 0.278 0.936 0.048 0.952
#> GSM71740 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
#> GSM71671 3 0.000 0.983 0.000 0.000 1.000
#> GSM71672 3 0.000 0.983 0.000 0.000 1.000
#> GSM71673 3 0.000 0.983 0.000 0.000 1.000
#> GSM71674 3 0.000 0.983 0.000 0.000 1.000
#> GSM71675 3 0.000 0.983 0.000 0.000 1.000
#> GSM71676 3 0.000 0.983 0.000 0.000 1.000
#> GSM71677 3 0.000 0.983 0.000 0.000 1.000
#> GSM71678 2 0.000 0.957 0.000 1.000 0.000
#> GSM71679 2 0.000 0.957 0.000 1.000 0.000
#> GSM71680 2 0.216 0.957 0.000 0.936 0.064
#> GSM71681 2 0.207 0.958 0.000 0.940 0.060
#> GSM71682 2 0.000 0.957 0.000 1.000 0.000
#> GSM71683 2 0.000 0.957 0.000 1.000 0.000
#> GSM71684 2 0.216 0.957 0.000 0.936 0.064
#> GSM71685 2 0.216 0.957 0.000 0.936 0.064
#> GSM71686 2 0.000 0.957 0.000 1.000 0.000
#> GSM71687 2 0.000 0.957 0.000 1.000 0.000
#> GSM71688 2 0.000 0.957 0.000 1.000 0.000
#> GSM71689 3 0.236 0.925 0.000 0.072 0.928
#> GSM71690 2 0.000 0.957 0.000 1.000 0.000
#> GSM71691 2 0.000 0.957 0.000 1.000 0.000
#> GSM71692 3 0.000 0.983 0.000 0.000 1.000
#> GSM71693 2 0.000 0.957 0.000 1.000 0.000
#> GSM71694 3 0.236 0.925 0.000 0.072 0.928
#> GSM71695 2 0.000 0.957 0.000 1.000 0.000
#> GSM71696 1 0.275 0.911 0.924 0.064 0.012
#> GSM71697 1 0.000 0.994 1.000 0.000 0.000
#> GSM71698 1 0.000 0.994 1.000 0.000 0.000
#> GSM71699 1 0.000 0.994 1.000 0.000 0.000
#> GSM71700 1 0.000 0.994 1.000 0.000 0.000
#> GSM71701 1 0.000 0.994 1.000 0.000 0.000
#> GSM71702 1 0.000 0.994 1.000 0.000 0.000
#> GSM71703 1 0.000 0.994 1.000 0.000 0.000
#> GSM71704 1 0.000 0.994 1.000 0.000 0.000
#> GSM71705 1 0.000 0.994 1.000 0.000 0.000
#> GSM71706 1 0.000 0.994 1.000 0.000 0.000
#> GSM71707 1 0.000 0.994 1.000 0.000 0.000
#> GSM71708 1 0.000 0.994 1.000 0.000 0.000
#> GSM71709 2 0.216 0.957 0.000 0.936 0.064
#> GSM71710 1 0.000 0.994 1.000 0.000 0.000
#> GSM71711 1 0.000 0.994 1.000 0.000 0.000
#> GSM71712 2 0.304 0.933 0.044 0.920 0.036
#> GSM71713 1 0.353 0.857 0.884 0.108 0.008
#> GSM71714 1 0.000 0.994 1.000 0.000 0.000
#> GSM71715 2 0.456 0.838 0.112 0.852 0.036
#> GSM71716 1 0.000 0.994 1.000 0.000 0.000
#> GSM71717 1 0.000 0.994 1.000 0.000 0.000
#> GSM71718 1 0.000 0.994 1.000 0.000 0.000
#> GSM71719 1 0.000 0.994 1.000 0.000 0.000
#> GSM71720 1 0.000 0.994 1.000 0.000 0.000
#> GSM71721 1 0.000 0.994 1.000 0.000 0.000
#> GSM71722 1 0.000 0.994 1.000 0.000 0.000
#> GSM71723 1 0.000 0.994 1.000 0.000 0.000
#> GSM71724 1 0.000 0.994 1.000 0.000 0.000
#> GSM71725 2 0.315 0.929 0.048 0.916 0.036
#> GSM71726 2 0.216 0.957 0.000 0.936 0.064
#> GSM71727 2 0.216 0.957 0.000 0.936 0.064
#> GSM71728 2 0.216 0.957 0.000 0.936 0.064
#> GSM71729 2 0.216 0.957 0.000 0.936 0.064
#> GSM71730 2 0.216 0.957 0.000 0.936 0.064
#> GSM71731 1 0.000 0.994 1.000 0.000 0.000
#> GSM71732 1 0.000 0.994 1.000 0.000 0.000
#> GSM71733 1 0.000 0.994 1.000 0.000 0.000
#> GSM71734 1 0.000 0.994 1.000 0.000 0.000
#> GSM71735 1 0.000 0.994 1.000 0.000 0.000
#> GSM71736 1 0.000 0.994 1.000 0.000 0.000
#> GSM71737 1 0.000 0.994 1.000 0.000 0.000
#> GSM71738 1 0.000 0.994 1.000 0.000 0.000
#> GSM71739 2 0.196 0.958 0.000 0.944 0.056
#> GSM71740 1 0.000 0.994 1.000 0.000 0.000
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> GSM71671 3 0.0000 0.968 0.000 0.000 1.00 0.000
#> GSM71672 3 0.0000 0.968 0.000 0.000 1.00 0.000
#> GSM71673 3 0.0000 0.968 0.000 0.000 1.00 0.000
#> GSM71674 3 0.0000 0.968 0.000 0.000 1.00 0.000
#> GSM71675 3 0.0000 0.968 0.000 0.000 1.00 0.000
#> GSM71676 3 0.0000 0.968 0.000 0.000 1.00 0.000
#> GSM71677 3 0.0000 0.968 0.000 0.000 1.00 0.000
#> GSM71678 2 0.0188 0.881 0.000 0.996 0.00 0.004
#> GSM71679 2 0.0188 0.881 0.000 0.996 0.00 0.004
#> GSM71680 4 0.0000 0.880 0.000 0.000 0.00 1.000
#> GSM71681 4 0.1940 0.843 0.000 0.076 0.00 0.924
#> GSM71682 2 0.0188 0.881 0.000 0.996 0.00 0.004
#> GSM71683 2 0.1637 0.843 0.000 0.940 0.00 0.060
#> GSM71684 4 0.1867 0.847 0.000 0.072 0.00 0.928
#> GSM71685 4 0.1867 0.847 0.000 0.072 0.00 0.928
#> GSM71686 2 0.0188 0.881 0.000 0.996 0.00 0.004
#> GSM71687 2 0.2281 0.810 0.000 0.904 0.00 0.096
#> GSM71688 4 0.4994 0.107 0.000 0.480 0.00 0.520
#> GSM71689 3 0.3142 0.854 0.000 0.132 0.86 0.008
#> GSM71690 2 0.0188 0.881 0.000 0.996 0.00 0.004
#> GSM71691 2 0.0188 0.879 0.000 0.996 0.00 0.004
#> GSM71692 3 0.0000 0.968 0.000 0.000 1.00 0.000
#> GSM71693 2 0.0188 0.881 0.000 0.996 0.00 0.004
#> GSM71694 3 0.3142 0.854 0.000 0.132 0.86 0.008
#> GSM71695 2 0.0188 0.879 0.000 0.996 0.00 0.004
#> GSM71696 1 0.3088 0.880 0.888 0.060 0.00 0.052
#> GSM71697 1 0.0000 0.993 1.000 0.000 0.00 0.000
#> GSM71698 1 0.0000 0.993 1.000 0.000 0.00 0.000
#> GSM71699 1 0.0000 0.993 1.000 0.000 0.00 0.000
#> GSM71700 1 0.0000 0.993 1.000 0.000 0.00 0.000
#> GSM71701 1 0.0000 0.993 1.000 0.000 0.00 0.000
#> GSM71702 1 0.0000 0.993 1.000 0.000 0.00 0.000
#> GSM71703 1 0.0000 0.993 1.000 0.000 0.00 0.000
#> GSM71704 1 0.0000 0.993 1.000 0.000 0.00 0.000
#> GSM71705 1 0.0000 0.993 1.000 0.000 0.00 0.000
#> GSM71706 1 0.0000 0.993 1.000 0.000 0.00 0.000
#> GSM71707 1 0.0000 0.993 1.000 0.000 0.00 0.000
#> GSM71708 1 0.0000 0.993 1.000 0.000 0.00 0.000
#> GSM71709 4 0.0000 0.880 0.000 0.000 0.00 1.000
#> GSM71710 1 0.0000 0.993 1.000 0.000 0.00 0.000
#> GSM71711 1 0.0000 0.993 1.000 0.000 0.00 0.000
#> GSM71712 4 0.4098 0.654 0.204 0.012 0.00 0.784
#> GSM71713 1 0.2660 0.903 0.908 0.036 0.00 0.056
#> GSM71714 1 0.0000 0.993 1.000 0.000 0.00 0.000
#> GSM71715 2 0.6974 0.245 0.396 0.488 0.00 0.116
#> GSM71716 1 0.0000 0.993 1.000 0.000 0.00 0.000
#> GSM71717 1 0.0000 0.993 1.000 0.000 0.00 0.000
#> GSM71718 1 0.0000 0.993 1.000 0.000 0.00 0.000
#> GSM71719 1 0.1042 0.967 0.972 0.008 0.00 0.020
#> GSM71720 1 0.0000 0.993 1.000 0.000 0.00 0.000
#> GSM71721 1 0.0000 0.993 1.000 0.000 0.00 0.000
#> GSM71722 1 0.0000 0.993 1.000 0.000 0.00 0.000
#> GSM71723 1 0.0000 0.993 1.000 0.000 0.00 0.000
#> GSM71724 1 0.0000 0.993 1.000 0.000 0.00 0.000
#> GSM71725 4 0.4098 0.654 0.204 0.012 0.00 0.784
#> GSM71726 4 0.0000 0.880 0.000 0.000 0.00 1.000
#> GSM71727 4 0.0000 0.880 0.000 0.000 0.00 1.000
#> GSM71728 4 0.0000 0.880 0.000 0.000 0.00 1.000
#> GSM71729 4 0.0000 0.880 0.000 0.000 0.00 1.000
#> GSM71730 4 0.0000 0.880 0.000 0.000 0.00 1.000
#> GSM71731 1 0.0000 0.993 1.000 0.000 0.00 0.000
#> GSM71732 1 0.0000 0.993 1.000 0.000 0.00 0.000
#> GSM71733 1 0.0000 0.993 1.000 0.000 0.00 0.000
#> GSM71734 1 0.0000 0.993 1.000 0.000 0.00 0.000
#> GSM71735 1 0.0000 0.993 1.000 0.000 0.00 0.000
#> GSM71736 1 0.0000 0.993 1.000 0.000 0.00 0.000
#> GSM71737 1 0.0000 0.993 1.000 0.000 0.00 0.000
#> GSM71738 1 0.0000 0.993 1.000 0.000 0.00 0.000
#> GSM71739 2 0.4804 0.330 0.000 0.616 0.00 0.384
#> GSM71740 1 0.0000 0.993 1.000 0.000 0.00 0.000
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> GSM71671 3 0.0000 0.9648 0.000 0.000 1.00 0.000 0.000
#> GSM71672 3 0.0000 0.9648 0.000 0.000 1.00 0.000 0.000
#> GSM71673 3 0.0000 0.9648 0.000 0.000 1.00 0.000 0.000
#> GSM71674 3 0.0000 0.9648 0.000 0.000 1.00 0.000 0.000
#> GSM71675 3 0.0000 0.9648 0.000 0.000 1.00 0.000 0.000
#> GSM71676 3 0.0000 0.9648 0.000 0.000 1.00 0.000 0.000
#> GSM71677 3 0.0000 0.9648 0.000 0.000 1.00 0.000 0.000
#> GSM71678 2 0.0162 0.9346 0.000 0.996 0.00 0.000 0.004
#> GSM71679 2 0.0162 0.9346 0.000 0.996 0.00 0.000 0.004
#> GSM71680 4 0.0000 0.9571 0.000 0.000 0.00 1.000 0.000
#> GSM71681 4 0.2011 0.8957 0.000 0.088 0.00 0.908 0.004
#> GSM71682 2 0.0290 0.9341 0.000 0.992 0.00 0.000 0.008
#> GSM71683 2 0.0162 0.9337 0.000 0.996 0.00 0.004 0.000
#> GSM71684 4 0.2011 0.8953 0.000 0.088 0.00 0.908 0.004
#> GSM71685 4 0.1410 0.9223 0.000 0.060 0.00 0.940 0.000
#> GSM71686 2 0.0290 0.9341 0.000 0.992 0.00 0.000 0.008
#> GSM71687 2 0.0898 0.9232 0.000 0.972 0.00 0.020 0.008
#> GSM71688 2 0.3766 0.5708 0.000 0.728 0.00 0.268 0.004
#> GSM71689 3 0.3018 0.8471 0.000 0.116 0.86 0.012 0.012
#> GSM71690 2 0.0162 0.9346 0.000 0.996 0.00 0.000 0.004
#> GSM71691 2 0.2286 0.8598 0.000 0.888 0.00 0.004 0.108
#> GSM71692 3 0.0000 0.9648 0.000 0.000 1.00 0.000 0.000
#> GSM71693 2 0.0451 0.9314 0.000 0.988 0.00 0.008 0.004
#> GSM71694 3 0.3018 0.8471 0.000 0.116 0.86 0.012 0.012
#> GSM71695 2 0.1952 0.8819 0.000 0.912 0.00 0.004 0.084
#> GSM71696 1 0.4769 0.4634 0.588 0.016 0.00 0.004 0.392
#> GSM71697 1 0.3730 0.7230 0.712 0.000 0.00 0.000 0.288
#> GSM71698 1 0.1851 0.8202 0.912 0.000 0.00 0.000 0.088
#> GSM71699 1 0.1671 0.8204 0.924 0.000 0.00 0.000 0.076
#> GSM71700 1 0.2020 0.8255 0.900 0.000 0.00 0.000 0.100
#> GSM71701 1 0.0609 0.8307 0.980 0.000 0.00 0.000 0.020
#> GSM71702 1 0.0404 0.8331 0.988 0.000 0.00 0.000 0.012
#> GSM71703 1 0.3366 0.7652 0.768 0.000 0.00 0.000 0.232
#> GSM71704 1 0.1851 0.8178 0.912 0.000 0.00 0.000 0.088
#> GSM71705 1 0.0404 0.8315 0.988 0.000 0.00 0.000 0.012
#> GSM71706 1 0.2127 0.8136 0.892 0.000 0.00 0.000 0.108
#> GSM71707 1 0.0609 0.8336 0.980 0.000 0.00 0.000 0.020
#> GSM71708 1 0.1478 0.8142 0.936 0.000 0.00 0.000 0.064
#> GSM71709 4 0.0000 0.9571 0.000 0.000 0.00 1.000 0.000
#> GSM71710 1 0.3177 0.7652 0.792 0.000 0.00 0.000 0.208
#> GSM71711 1 0.2280 0.8205 0.880 0.000 0.00 0.000 0.120
#> GSM71712 5 0.6366 0.4093 0.284 0.000 0.00 0.204 0.512
#> GSM71713 1 0.4557 0.2995 0.516 0.000 0.00 0.008 0.476
#> GSM71714 1 0.0794 0.8319 0.972 0.000 0.00 0.000 0.028
#> GSM71715 5 0.6357 0.3181 0.044 0.248 0.00 0.104 0.604
#> GSM71716 1 0.3752 0.6712 0.708 0.000 0.00 0.000 0.292
#> GSM71717 1 0.2424 0.8112 0.868 0.000 0.00 0.000 0.132
#> GSM71718 1 0.3966 0.6730 0.664 0.000 0.00 0.000 0.336
#> GSM71719 1 0.4307 0.3646 0.504 0.000 0.00 0.000 0.496
#> GSM71720 1 0.4126 0.6089 0.620 0.000 0.00 0.000 0.380
#> GSM71721 1 0.3177 0.7657 0.792 0.000 0.00 0.000 0.208
#> GSM71722 1 0.1671 0.8260 0.924 0.000 0.00 0.000 0.076
#> GSM71723 1 0.2471 0.8194 0.864 0.000 0.00 0.000 0.136
#> GSM71724 1 0.0510 0.8310 0.984 0.000 0.00 0.000 0.016
#> GSM71725 5 0.6204 0.3937 0.288 0.000 0.00 0.176 0.536
#> GSM71726 4 0.0703 0.9472 0.000 0.000 0.00 0.976 0.024
#> GSM71727 4 0.0000 0.9571 0.000 0.000 0.00 1.000 0.000
#> GSM71728 4 0.0880 0.9425 0.000 0.000 0.00 0.968 0.032
#> GSM71729 4 0.0000 0.9571 0.000 0.000 0.00 1.000 0.000
#> GSM71730 4 0.0000 0.9571 0.000 0.000 0.00 1.000 0.000
#> GSM71731 1 0.3143 0.7874 0.796 0.000 0.00 0.000 0.204
#> GSM71732 1 0.1341 0.8256 0.944 0.000 0.00 0.000 0.056
#> GSM71733 1 0.1908 0.8298 0.908 0.000 0.00 0.000 0.092
#> GSM71734 1 0.0000 0.8301 1.000 0.000 0.00 0.000 0.000
#> GSM71735 1 0.1341 0.8119 0.944 0.000 0.00 0.000 0.056
#> GSM71736 1 0.1043 0.8221 0.960 0.000 0.00 0.000 0.040
#> GSM71737 1 0.2127 0.8168 0.892 0.000 0.00 0.000 0.108
#> GSM71738 1 0.2852 0.8006 0.828 0.000 0.00 0.000 0.172
#> GSM71739 5 0.6047 -0.0713 0.000 0.400 0.00 0.120 0.480
#> GSM71740 1 0.3336 0.7588 0.772 0.000 0.00 0.000 0.228
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> GSM71671 3 0.0000 0.968927 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM71672 3 0.0000 0.968927 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM71673 3 0.0000 0.968927 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM71674 3 0.0000 0.968927 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM71675 3 0.0000 0.968927 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM71676 3 0.0000 0.968927 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM71677 3 0.0000 0.968927 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM71678 2 0.0937 0.846495 0.000 0.960 0.000 0.000 0.040 0.000
#> GSM71679 2 0.1007 0.846889 0.000 0.956 0.000 0.000 0.044 0.000
#> GSM71680 4 0.0865 0.619599 0.000 0.000 0.000 0.964 0.036 0.000
#> GSM71681 4 0.5940 0.366387 0.000 0.228 0.000 0.440 0.332 0.000
#> GSM71682 2 0.1007 0.846889 0.000 0.956 0.000 0.000 0.044 0.000
#> GSM71683 2 0.1930 0.841268 0.000 0.916 0.000 0.036 0.048 0.000
#> GSM71684 4 0.6037 0.308905 0.000 0.252 0.000 0.396 0.352 0.000
#> GSM71685 4 0.4603 0.542575 0.000 0.156 0.000 0.696 0.148 0.000
#> GSM71686 2 0.1007 0.846889 0.000 0.956 0.000 0.000 0.044 0.000
#> GSM71687 2 0.3939 0.759835 0.000 0.752 0.000 0.068 0.180 0.000
#> GSM71688 2 0.5019 0.517386 0.000 0.604 0.000 0.104 0.292 0.000
#> GSM71689 3 0.2320 0.865618 0.000 0.004 0.864 0.000 0.132 0.000
#> GSM71690 2 0.0000 0.849683 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM71691 2 0.3825 0.773262 0.000 0.768 0.000 0.000 0.160 0.072
#> GSM71692 3 0.0000 0.968927 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM71693 2 0.3279 0.812713 0.000 0.828 0.000 0.060 0.108 0.004
#> GSM71694 3 0.2320 0.865618 0.000 0.004 0.864 0.000 0.132 0.000
#> GSM71695 2 0.3928 0.766933 0.000 0.760 0.000 0.000 0.160 0.080
#> GSM71696 6 0.4851 0.329842 0.404 0.000 0.000 0.000 0.060 0.536
#> GSM71697 1 0.3867 0.020212 0.512 0.000 0.000 0.000 0.000 0.488
#> GSM71698 1 0.2838 0.594860 0.808 0.000 0.000 0.000 0.004 0.188
#> GSM71699 1 0.2964 0.604787 0.792 0.000 0.000 0.000 0.004 0.204
#> GSM71700 1 0.2703 0.612886 0.824 0.000 0.000 0.000 0.004 0.172
#> GSM71701 1 0.0260 0.679335 0.992 0.000 0.000 0.000 0.000 0.008
#> GSM71702 1 0.0632 0.682788 0.976 0.000 0.000 0.000 0.000 0.024
#> GSM71703 1 0.3833 0.405251 0.648 0.000 0.000 0.000 0.008 0.344
#> GSM71704 1 0.3245 0.582974 0.764 0.000 0.000 0.000 0.008 0.228
#> GSM71705 1 0.0458 0.680056 0.984 0.000 0.000 0.000 0.000 0.016
#> GSM71706 1 0.3445 0.557907 0.732 0.000 0.000 0.000 0.008 0.260
#> GSM71707 1 0.2003 0.670711 0.884 0.000 0.000 0.000 0.000 0.116
#> GSM71708 1 0.2553 0.635666 0.848 0.000 0.000 0.000 0.008 0.144
#> GSM71709 4 0.0547 0.627335 0.000 0.000 0.000 0.980 0.020 0.000
#> GSM71710 1 0.3769 0.331784 0.640 0.000 0.000 0.000 0.004 0.356
#> GSM71711 1 0.2738 0.617907 0.820 0.000 0.000 0.000 0.004 0.176
#> GSM71712 5 0.6092 0.470782 0.048 0.000 0.000 0.112 0.528 0.312
#> GSM71713 6 0.5304 0.461046 0.292 0.000 0.000 0.000 0.136 0.572
#> GSM71714 1 0.1644 0.666950 0.920 0.000 0.000 0.000 0.004 0.076
#> GSM71715 6 0.5952 -0.412941 0.032 0.020 0.000 0.060 0.372 0.516
#> GSM71716 1 0.3966 0.027452 0.552 0.000 0.000 0.000 0.004 0.444
#> GSM71717 1 0.3565 0.492206 0.692 0.000 0.000 0.000 0.004 0.304
#> GSM71718 6 0.3860 -0.000289 0.472 0.000 0.000 0.000 0.000 0.528
#> GSM71719 6 0.3531 0.400979 0.328 0.000 0.000 0.000 0.000 0.672
#> GSM71720 6 0.3797 0.202698 0.420 0.000 0.000 0.000 0.000 0.580
#> GSM71721 1 0.3221 0.497988 0.736 0.000 0.000 0.000 0.000 0.264
#> GSM71722 1 0.2668 0.615197 0.828 0.000 0.000 0.000 0.004 0.168
#> GSM71723 1 0.3468 0.537101 0.712 0.000 0.000 0.000 0.004 0.284
#> GSM71724 1 0.0146 0.680206 0.996 0.000 0.000 0.000 0.000 0.004
#> GSM71725 6 0.6168 -0.443431 0.048 0.000 0.000 0.108 0.360 0.484
#> GSM71726 4 0.3482 0.231411 0.000 0.000 0.000 0.684 0.316 0.000
#> GSM71727 4 0.0000 0.631978 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM71728 5 0.3934 -0.090848 0.000 0.000 0.000 0.376 0.616 0.008
#> GSM71729 4 0.3464 0.468842 0.000 0.000 0.000 0.688 0.312 0.000
#> GSM71730 4 0.1141 0.630812 0.000 0.000 0.000 0.948 0.052 0.000
#> GSM71731 1 0.3409 0.487649 0.700 0.000 0.000 0.000 0.000 0.300
#> GSM71732 1 0.2558 0.625232 0.840 0.000 0.000 0.000 0.004 0.156
#> GSM71733 1 0.2738 0.625469 0.820 0.000 0.000 0.000 0.004 0.176
#> GSM71734 1 0.0458 0.677220 0.984 0.000 0.000 0.000 0.000 0.016
#> GSM71735 1 0.1588 0.649607 0.924 0.000 0.000 0.000 0.004 0.072
#> GSM71736 1 0.1285 0.661982 0.944 0.000 0.000 0.000 0.004 0.052
#> GSM71737 1 0.3468 0.548887 0.728 0.000 0.000 0.000 0.008 0.264
#> GSM71738 1 0.3555 0.525289 0.712 0.000 0.000 0.000 0.008 0.280
#> GSM71739 5 0.5900 0.431705 0.000 0.052 0.000 0.076 0.520 0.352
#> GSM71740 1 0.3930 0.224688 0.576 0.000 0.000 0.000 0.004 0.420
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) k
#> CV:mclust 70 3.59e-09 2
#> CV:mclust 70 4.26e-16 3
#> CV:mclust 67 1.92e-17 4
#> CV:mclust 63 1.06e-16 5
#> CV:mclust 48 5.44e-13 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 21168 rows and 70 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 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 0.977 0.992 0.4954 0.508 0.508
#> 3 3 0.945 0.949 0.974 0.2437 0.806 0.642
#> 4 4 0.987 0.942 0.957 0.0774 0.933 0.829
#> 5 5 0.784 0.846 0.895 0.1512 0.860 0.597
#> 6 6 0.761 0.742 0.863 0.0272 0.947 0.781
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
#> GSM71671 2 0.000 1.0000 0.000 1.000
#> GSM71672 2 0.000 1.0000 0.000 1.000
#> GSM71673 2 0.000 1.0000 0.000 1.000
#> GSM71674 2 0.000 1.0000 0.000 1.000
#> GSM71675 2 0.000 1.0000 0.000 1.000
#> GSM71676 2 0.000 1.0000 0.000 1.000
#> GSM71677 2 0.000 1.0000 0.000 1.000
#> GSM71678 2 0.000 1.0000 0.000 1.000
#> GSM71679 2 0.000 1.0000 0.000 1.000
#> GSM71680 2 0.000 1.0000 0.000 1.000
#> GSM71681 2 0.000 1.0000 0.000 1.000
#> GSM71682 2 0.000 1.0000 0.000 1.000
#> GSM71683 2 0.000 1.0000 0.000 1.000
#> GSM71684 2 0.000 1.0000 0.000 1.000
#> GSM71685 2 0.000 1.0000 0.000 1.000
#> GSM71686 2 0.000 1.0000 0.000 1.000
#> GSM71687 2 0.000 1.0000 0.000 1.000
#> GSM71688 2 0.000 1.0000 0.000 1.000
#> GSM71689 2 0.000 1.0000 0.000 1.000
#> GSM71690 2 0.000 1.0000 0.000 1.000
#> GSM71691 2 0.000 1.0000 0.000 1.000
#> GSM71692 2 0.000 1.0000 0.000 1.000
#> GSM71693 2 0.000 1.0000 0.000 1.000
#> GSM71694 2 0.000 1.0000 0.000 1.000
#> GSM71695 2 0.000 1.0000 0.000 1.000
#> GSM71696 1 0.000 0.9855 1.000 0.000
#> GSM71697 1 0.000 0.9855 1.000 0.000
#> GSM71698 1 0.000 0.9855 1.000 0.000
#> GSM71699 1 0.000 0.9855 1.000 0.000
#> GSM71700 1 0.000 0.9855 1.000 0.000
#> GSM71701 1 0.000 0.9855 1.000 0.000
#> GSM71702 1 0.000 0.9855 1.000 0.000
#> GSM71703 1 0.000 0.9855 1.000 0.000
#> GSM71704 1 0.000 0.9855 1.000 0.000
#> GSM71705 1 0.000 0.9855 1.000 0.000
#> GSM71706 1 0.000 0.9855 1.000 0.000
#> GSM71707 1 0.000 0.9855 1.000 0.000
#> GSM71708 1 0.000 0.9855 1.000 0.000
#> GSM71709 2 0.000 1.0000 0.000 1.000
#> GSM71710 1 0.000 0.9855 1.000 0.000
#> GSM71711 1 0.000 0.9855 1.000 0.000
#> GSM71712 1 0.000 0.9855 1.000 0.000
#> GSM71713 1 0.000 0.9855 1.000 0.000
#> GSM71714 1 0.000 0.9855 1.000 0.000
#> GSM71715 1 0.000 0.9855 1.000 0.000
#> GSM71716 1 0.000 0.9855 1.000 0.000
#> GSM71717 1 0.000 0.9855 1.000 0.000
#> GSM71718 1 0.000 0.9855 1.000 0.000
#> GSM71719 1 0.000 0.9855 1.000 0.000
#> GSM71720 1 0.000 0.9855 1.000 0.000
#> GSM71721 1 0.000 0.9855 1.000 0.000
#> GSM71722 1 0.000 0.9855 1.000 0.000
#> GSM71723 1 0.000 0.9855 1.000 0.000
#> GSM71724 1 0.000 0.9855 1.000 0.000
#> GSM71725 1 0.000 0.9855 1.000 0.000
#> GSM71726 1 0.311 0.9311 0.944 0.056
#> GSM71727 2 0.000 1.0000 0.000 1.000
#> GSM71728 1 0.163 0.9635 0.976 0.024
#> GSM71729 2 0.000 1.0000 0.000 1.000
#> GSM71730 2 0.000 1.0000 0.000 1.000
#> GSM71731 1 0.000 0.9855 1.000 0.000
#> GSM71732 1 0.000 0.9855 1.000 0.000
#> GSM71733 1 0.000 0.9855 1.000 0.000
#> GSM71734 1 0.000 0.9855 1.000 0.000
#> GSM71735 1 0.000 0.9855 1.000 0.000
#> GSM71736 1 0.000 0.9855 1.000 0.000
#> GSM71737 1 0.000 0.9855 1.000 0.000
#> GSM71738 1 0.000 0.9855 1.000 0.000
#> GSM71739 1 1.000 0.0234 0.504 0.496
#> GSM71740 1 0.000 0.9855 1.000 0.000
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> GSM71671 3 0.0000 0.991 0.000 0.000 1.000
#> GSM71672 3 0.0000 0.991 0.000 0.000 1.000
#> GSM71673 3 0.0000 0.991 0.000 0.000 1.000
#> GSM71674 3 0.0000 0.991 0.000 0.000 1.000
#> GSM71675 3 0.0000 0.991 0.000 0.000 1.000
#> GSM71676 3 0.0000 0.991 0.000 0.000 1.000
#> GSM71677 3 0.0000 0.991 0.000 0.000 1.000
#> GSM71678 2 0.0237 0.909 0.000 0.996 0.004
#> GSM71679 2 0.0237 0.909 0.000 0.996 0.004
#> GSM71680 2 0.0592 0.908 0.000 0.988 0.012
#> GSM71681 2 0.3192 0.867 0.000 0.888 0.112
#> GSM71682 2 0.0000 0.908 0.000 1.000 0.000
#> GSM71683 2 0.3116 0.870 0.000 0.892 0.108
#> GSM71684 2 0.0237 0.909 0.000 0.996 0.004
#> GSM71685 2 0.3941 0.831 0.000 0.844 0.156
#> GSM71686 2 0.0000 0.908 0.000 1.000 0.000
#> GSM71687 2 0.3192 0.868 0.000 0.888 0.112
#> GSM71688 2 0.4605 0.781 0.000 0.796 0.204
#> GSM71689 3 0.0000 0.991 0.000 0.000 1.000
#> GSM71690 2 0.1411 0.903 0.000 0.964 0.036
#> GSM71691 3 0.1643 0.953 0.000 0.044 0.956
#> GSM71692 3 0.0000 0.991 0.000 0.000 1.000
#> GSM71693 2 0.6204 0.368 0.000 0.576 0.424
#> GSM71694 3 0.0000 0.991 0.000 0.000 1.000
#> GSM71695 3 0.1529 0.957 0.000 0.040 0.960
#> GSM71696 1 0.0000 1.000 1.000 0.000 0.000
#> GSM71697 1 0.0000 1.000 1.000 0.000 0.000
#> GSM71698 1 0.0000 1.000 1.000 0.000 0.000
#> GSM71699 1 0.0000 1.000 1.000 0.000 0.000
#> GSM71700 1 0.0000 1.000 1.000 0.000 0.000
#> GSM71701 1 0.0000 1.000 1.000 0.000 0.000
#> GSM71702 1 0.0000 1.000 1.000 0.000 0.000
#> GSM71703 1 0.0000 1.000 1.000 0.000 0.000
#> GSM71704 1 0.0000 1.000 1.000 0.000 0.000
#> GSM71705 1 0.0000 1.000 1.000 0.000 0.000
#> GSM71706 1 0.0000 1.000 1.000 0.000 0.000
#> GSM71707 1 0.0000 1.000 1.000 0.000 0.000
#> GSM71708 1 0.0000 1.000 1.000 0.000 0.000
#> GSM71709 2 0.0892 0.907 0.000 0.980 0.020
#> GSM71710 1 0.0000 1.000 1.000 0.000 0.000
#> GSM71711 1 0.0000 1.000 1.000 0.000 0.000
#> GSM71712 2 0.3551 0.778 0.132 0.868 0.000
#> GSM71713 1 0.0000 1.000 1.000 0.000 0.000
#> GSM71714 1 0.0000 1.000 1.000 0.000 0.000
#> GSM71715 1 0.0000 1.000 1.000 0.000 0.000
#> GSM71716 1 0.0000 1.000 1.000 0.000 0.000
#> GSM71717 1 0.0000 1.000 1.000 0.000 0.000
#> GSM71718 1 0.0000 1.000 1.000 0.000 0.000
#> GSM71719 1 0.0000 1.000 1.000 0.000 0.000
#> GSM71720 1 0.0000 1.000 1.000 0.000 0.000
#> GSM71721 1 0.0000 1.000 1.000 0.000 0.000
#> GSM71722 1 0.0000 1.000 1.000 0.000 0.000
#> GSM71723 1 0.0000 1.000 1.000 0.000 0.000
#> GSM71724 1 0.0000 1.000 1.000 0.000 0.000
#> GSM71725 2 0.5363 0.579 0.276 0.724 0.000
#> GSM71726 2 0.0000 0.908 0.000 1.000 0.000
#> GSM71727 2 0.0237 0.909 0.000 0.996 0.004
#> GSM71728 2 0.0000 0.908 0.000 1.000 0.000
#> GSM71729 2 0.0000 0.908 0.000 1.000 0.000
#> GSM71730 2 0.0747 0.908 0.000 0.984 0.016
#> GSM71731 1 0.0000 1.000 1.000 0.000 0.000
#> GSM71732 1 0.0000 1.000 1.000 0.000 0.000
#> GSM71733 1 0.0000 1.000 1.000 0.000 0.000
#> GSM71734 1 0.0000 1.000 1.000 0.000 0.000
#> GSM71735 1 0.0000 1.000 1.000 0.000 0.000
#> GSM71736 1 0.0000 1.000 1.000 0.000 0.000
#> GSM71737 1 0.0000 1.000 1.000 0.000 0.000
#> GSM71738 1 0.0000 1.000 1.000 0.000 0.000
#> GSM71739 2 0.3686 0.834 0.000 0.860 0.140
#> GSM71740 1 0.0000 1.000 1.000 0.000 0.000
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> GSM71671 3 0.0336 0.983 0.000 0.000 0.992 0.008
#> GSM71672 3 0.0000 0.986 0.000 0.000 1.000 0.000
#> GSM71673 3 0.0188 0.985 0.000 0.000 0.996 0.004
#> GSM71674 3 0.0336 0.983 0.000 0.000 0.992 0.008
#> GSM71675 3 0.0188 0.986 0.000 0.004 0.996 0.000
#> GSM71676 3 0.0376 0.986 0.000 0.004 0.992 0.004
#> GSM71677 3 0.0469 0.984 0.000 0.012 0.988 0.000
#> GSM71678 2 0.0336 0.954 0.000 0.992 0.000 0.008
#> GSM71679 2 0.0336 0.954 0.000 0.992 0.000 0.008
#> GSM71680 4 0.2699 0.869 0.000 0.068 0.028 0.904
#> GSM71681 2 0.0376 0.955 0.000 0.992 0.004 0.004
#> GSM71682 2 0.0469 0.952 0.000 0.988 0.000 0.012
#> GSM71683 2 0.0592 0.953 0.000 0.984 0.016 0.000
#> GSM71684 2 0.0592 0.950 0.000 0.984 0.000 0.016
#> GSM71685 2 0.1807 0.924 0.000 0.940 0.008 0.052
#> GSM71686 2 0.0336 0.954 0.000 0.992 0.000 0.008
#> GSM71687 2 0.0592 0.953 0.000 0.984 0.016 0.000
#> GSM71688 2 0.0469 0.954 0.000 0.988 0.012 0.000
#> GSM71689 3 0.1022 0.970 0.000 0.032 0.968 0.000
#> GSM71690 2 0.0188 0.955 0.000 0.996 0.004 0.000
#> GSM71691 2 0.2868 0.848 0.000 0.864 0.136 0.000
#> GSM71692 3 0.0469 0.984 0.000 0.012 0.988 0.000
#> GSM71693 2 0.0921 0.947 0.000 0.972 0.028 0.000
#> GSM71694 3 0.1118 0.966 0.000 0.036 0.964 0.000
#> GSM71695 2 0.3024 0.835 0.000 0.852 0.148 0.000
#> GSM71696 1 0.0188 0.974 0.996 0.000 0.000 0.004
#> GSM71697 1 0.0188 0.974 0.996 0.000 0.000 0.004
#> GSM71698 1 0.1716 0.962 0.936 0.000 0.000 0.064
#> GSM71699 1 0.1792 0.959 0.932 0.000 0.000 0.068
#> GSM71700 1 0.0592 0.975 0.984 0.000 0.000 0.016
#> GSM71701 1 0.1716 0.961 0.936 0.000 0.000 0.064
#> GSM71702 1 0.1637 0.964 0.940 0.000 0.000 0.060
#> GSM71703 1 0.1716 0.961 0.936 0.000 0.000 0.064
#> GSM71704 1 0.1637 0.963 0.940 0.000 0.000 0.060
#> GSM71705 1 0.1302 0.969 0.956 0.000 0.000 0.044
#> GSM71706 1 0.1474 0.967 0.948 0.000 0.000 0.052
#> GSM71707 1 0.1211 0.971 0.960 0.000 0.000 0.040
#> GSM71708 1 0.1637 0.963 0.940 0.000 0.000 0.060
#> GSM71709 4 0.2563 0.874 0.000 0.072 0.020 0.908
#> GSM71710 1 0.0188 0.974 0.996 0.000 0.000 0.004
#> GSM71711 1 0.0188 0.974 0.996 0.000 0.000 0.004
#> GSM71712 4 0.2670 0.861 0.024 0.072 0.000 0.904
#> GSM71713 1 0.1792 0.959 0.932 0.000 0.000 0.068
#> GSM71714 1 0.0000 0.975 1.000 0.000 0.000 0.000
#> GSM71715 1 0.0188 0.974 0.996 0.000 0.000 0.004
#> GSM71716 1 0.0188 0.974 0.996 0.000 0.000 0.004
#> GSM71717 1 0.0188 0.974 0.996 0.000 0.000 0.004
#> GSM71718 1 0.1022 0.958 0.968 0.000 0.000 0.032
#> GSM71719 1 0.1022 0.958 0.968 0.000 0.000 0.032
#> GSM71720 1 0.0817 0.964 0.976 0.000 0.000 0.024
#> GSM71721 1 0.0921 0.974 0.972 0.000 0.000 0.028
#> GSM71722 1 0.0336 0.975 0.992 0.000 0.000 0.008
#> GSM71723 1 0.0000 0.975 1.000 0.000 0.000 0.000
#> GSM71724 1 0.1211 0.970 0.960 0.000 0.000 0.040
#> GSM71725 4 0.5149 0.494 0.336 0.016 0.000 0.648
#> GSM71726 4 0.1978 0.879 0.004 0.068 0.000 0.928
#> GSM71727 4 0.2081 0.881 0.000 0.084 0.000 0.916
#> GSM71728 4 0.2401 0.880 0.004 0.092 0.000 0.904
#> GSM71729 4 0.4543 0.610 0.000 0.324 0.000 0.676
#> GSM71730 4 0.2654 0.873 0.000 0.108 0.004 0.888
#> GSM71731 1 0.0188 0.974 0.996 0.000 0.000 0.004
#> GSM71732 1 0.0188 0.974 0.996 0.000 0.000 0.004
#> GSM71733 1 0.0000 0.975 1.000 0.000 0.000 0.000
#> GSM71734 1 0.0817 0.973 0.976 0.000 0.000 0.024
#> GSM71735 1 0.0000 0.975 1.000 0.000 0.000 0.000
#> GSM71736 1 0.1557 0.965 0.944 0.000 0.000 0.056
#> GSM71737 1 0.0000 0.975 1.000 0.000 0.000 0.000
#> GSM71738 1 0.1302 0.970 0.956 0.000 0.000 0.044
#> GSM71739 2 0.1994 0.902 0.052 0.936 0.004 0.008
#> GSM71740 1 0.0188 0.974 0.996 0.000 0.000 0.004
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> GSM71671 3 0.0000 0.990 0.000 0.000 1.000 0.000 0.000
#> GSM71672 3 0.0000 0.990 0.000 0.000 1.000 0.000 0.000
#> GSM71673 3 0.0000 0.990 0.000 0.000 1.000 0.000 0.000
#> GSM71674 3 0.0000 0.990 0.000 0.000 1.000 0.000 0.000
#> GSM71675 3 0.0162 0.989 0.004 0.000 0.996 0.000 0.000
#> GSM71676 3 0.0000 0.990 0.000 0.000 1.000 0.000 0.000
#> GSM71677 3 0.0162 0.989 0.000 0.004 0.996 0.000 0.000
#> GSM71678 2 0.0865 0.934 0.024 0.972 0.000 0.004 0.000
#> GSM71679 2 0.0865 0.934 0.024 0.972 0.000 0.004 0.000
#> GSM71680 4 0.0671 0.939 0.004 0.000 0.016 0.980 0.000
#> GSM71681 2 0.0727 0.934 0.012 0.980 0.004 0.004 0.000
#> GSM71682 2 0.1251 0.931 0.036 0.956 0.000 0.008 0.000
#> GSM71683 2 0.0451 0.933 0.008 0.988 0.004 0.000 0.000
#> GSM71684 2 0.0566 0.934 0.004 0.984 0.000 0.012 0.000
#> GSM71685 2 0.2957 0.838 0.012 0.860 0.008 0.120 0.000
#> GSM71686 2 0.1571 0.924 0.060 0.936 0.000 0.004 0.000
#> GSM71687 2 0.1197 0.929 0.048 0.952 0.000 0.000 0.000
#> GSM71688 2 0.0671 0.932 0.004 0.980 0.016 0.000 0.000
#> GSM71689 3 0.0912 0.978 0.012 0.016 0.972 0.000 0.000
#> GSM71690 2 0.0000 0.934 0.000 1.000 0.000 0.000 0.000
#> GSM71691 2 0.2520 0.901 0.048 0.896 0.056 0.000 0.000
#> GSM71692 3 0.0566 0.984 0.004 0.012 0.984 0.000 0.000
#> GSM71693 2 0.1211 0.926 0.016 0.960 0.024 0.000 0.000
#> GSM71694 3 0.1485 0.958 0.020 0.032 0.948 0.000 0.000
#> GSM71695 2 0.3051 0.844 0.028 0.852 0.120 0.000 0.000
#> GSM71696 5 0.1410 0.846 0.060 0.000 0.000 0.000 0.940
#> GSM71697 5 0.1341 0.847 0.056 0.000 0.000 0.000 0.944
#> GSM71698 1 0.2813 0.900 0.832 0.000 0.000 0.000 0.168
#> GSM71699 1 0.2561 0.878 0.856 0.000 0.000 0.000 0.144
#> GSM71700 5 0.4201 0.150 0.408 0.000 0.000 0.000 0.592
#> GSM71701 1 0.2966 0.908 0.816 0.000 0.000 0.000 0.184
#> GSM71702 1 0.3039 0.910 0.808 0.000 0.000 0.000 0.192
#> GSM71703 1 0.2966 0.909 0.816 0.000 0.000 0.000 0.184
#> GSM71704 1 0.3039 0.910 0.808 0.000 0.000 0.000 0.192
#> GSM71705 1 0.3796 0.831 0.700 0.000 0.000 0.000 0.300
#> GSM71706 1 0.3274 0.902 0.780 0.000 0.000 0.000 0.220
#> GSM71707 1 0.3857 0.815 0.688 0.000 0.000 0.000 0.312
#> GSM71708 1 0.2891 0.905 0.824 0.000 0.000 0.000 0.176
#> GSM71709 4 0.0566 0.941 0.004 0.000 0.012 0.984 0.000
#> GSM71710 5 0.1043 0.847 0.040 0.000 0.000 0.000 0.960
#> GSM71711 5 0.1671 0.839 0.076 0.000 0.000 0.000 0.924
#> GSM71712 4 0.3543 0.867 0.128 0.040 0.000 0.828 0.004
#> GSM71713 1 0.2069 0.796 0.912 0.012 0.000 0.000 0.076
#> GSM71714 5 0.1478 0.845 0.064 0.000 0.000 0.000 0.936
#> GSM71715 5 0.0671 0.829 0.016 0.004 0.000 0.000 0.980
#> GSM71716 5 0.0290 0.831 0.008 0.000 0.000 0.000 0.992
#> GSM71717 5 0.0880 0.846 0.032 0.000 0.000 0.000 0.968
#> GSM71718 5 0.0451 0.829 0.008 0.000 0.000 0.004 0.988
#> GSM71719 5 0.1041 0.808 0.032 0.000 0.000 0.004 0.964
#> GSM71720 5 0.0451 0.829 0.008 0.000 0.000 0.004 0.988
#> GSM71721 5 0.3612 0.580 0.268 0.000 0.000 0.000 0.732
#> GSM71722 5 0.2891 0.743 0.176 0.000 0.000 0.000 0.824
#> GSM71723 5 0.1608 0.842 0.072 0.000 0.000 0.000 0.928
#> GSM71724 1 0.3876 0.810 0.684 0.000 0.000 0.000 0.316
#> GSM71725 5 0.5126 0.474 0.084 0.012 0.000 0.196 0.708
#> GSM71726 4 0.0000 0.942 0.000 0.000 0.000 1.000 0.000
#> GSM71727 4 0.0162 0.943 0.000 0.000 0.004 0.996 0.000
#> GSM71728 4 0.1200 0.936 0.012 0.008 0.000 0.964 0.016
#> GSM71729 4 0.3123 0.781 0.004 0.184 0.000 0.812 0.000
#> GSM71730 4 0.0932 0.940 0.004 0.020 0.004 0.972 0.000
#> GSM71731 5 0.0162 0.837 0.004 0.000 0.000 0.000 0.996
#> GSM71732 5 0.1270 0.847 0.052 0.000 0.000 0.000 0.948
#> GSM71733 5 0.2773 0.759 0.164 0.000 0.000 0.000 0.836
#> GSM71734 5 0.4307 -0.320 0.500 0.000 0.000 0.000 0.500
#> GSM71735 5 0.3508 0.617 0.252 0.000 0.000 0.000 0.748
#> GSM71736 1 0.3274 0.902 0.780 0.000 0.000 0.000 0.220
#> GSM71737 5 0.1965 0.826 0.096 0.000 0.000 0.000 0.904
#> GSM71738 1 0.3932 0.790 0.672 0.000 0.000 0.000 0.328
#> GSM71739 2 0.4083 0.668 0.028 0.744 0.000 0.000 0.228
#> GSM71740 5 0.0609 0.843 0.020 0.000 0.000 0.000 0.980
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> GSM71671 3 0.0622 0.9535 0.000 0.000 0.980 0.012 0.008 0.000
#> GSM71672 3 0.0000 0.9577 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM71673 3 0.0363 0.9573 0.000 0.000 0.988 0.000 0.012 0.000
#> GSM71674 3 0.0622 0.9535 0.000 0.000 0.980 0.012 0.008 0.000
#> GSM71675 3 0.0146 0.9581 0.000 0.000 0.996 0.000 0.004 0.000
#> GSM71676 3 0.0622 0.9542 0.000 0.000 0.980 0.012 0.008 0.000
#> GSM71677 3 0.0405 0.9578 0.000 0.004 0.988 0.000 0.008 0.000
#> GSM71678 2 0.1863 0.8248 0.000 0.896 0.000 0.000 0.104 0.000
#> GSM71679 2 0.1863 0.8248 0.000 0.896 0.000 0.000 0.104 0.000
#> GSM71680 4 0.0405 0.8804 0.000 0.000 0.004 0.988 0.008 0.000
#> GSM71681 2 0.1531 0.8252 0.000 0.928 0.000 0.004 0.068 0.000
#> GSM71682 2 0.2631 0.7790 0.000 0.820 0.000 0.000 0.180 0.000
#> GSM71683 2 0.1644 0.8229 0.000 0.920 0.000 0.000 0.076 0.004
#> GSM71684 2 0.1082 0.8383 0.000 0.956 0.000 0.004 0.040 0.000
#> GSM71685 2 0.3989 0.6481 0.000 0.748 0.008 0.208 0.032 0.004
#> GSM71686 2 0.3198 0.7002 0.000 0.740 0.000 0.000 0.260 0.000
#> GSM71687 2 0.1863 0.8239 0.000 0.896 0.000 0.000 0.104 0.000
#> GSM71688 2 0.0146 0.8401 0.000 0.996 0.000 0.000 0.004 0.000
#> GSM71689 3 0.1843 0.9262 0.000 0.004 0.912 0.000 0.080 0.004
#> GSM71690 2 0.0260 0.8400 0.000 0.992 0.000 0.000 0.008 0.000
#> GSM71691 2 0.3493 0.7566 0.000 0.800 0.064 0.000 0.136 0.000
#> GSM71692 3 0.1501 0.9319 0.000 0.000 0.924 0.000 0.076 0.000
#> GSM71693 2 0.2174 0.8152 0.000 0.896 0.008 0.000 0.088 0.008
#> GSM71694 3 0.3219 0.8469 0.000 0.020 0.820 0.000 0.148 0.012
#> GSM71695 2 0.5386 0.4645 0.000 0.604 0.188 0.000 0.204 0.004
#> GSM71696 1 0.1082 0.8267 0.956 0.000 0.000 0.000 0.004 0.040
#> GSM71697 1 0.0993 0.8269 0.964 0.000 0.000 0.000 0.012 0.024
#> GSM71698 6 0.2436 0.7584 0.088 0.000 0.000 0.000 0.032 0.880
#> GSM71699 6 0.1225 0.6943 0.036 0.000 0.000 0.000 0.012 0.952
#> GSM71700 1 0.3699 0.4383 0.660 0.000 0.000 0.000 0.004 0.336
#> GSM71701 6 0.2633 0.7693 0.104 0.000 0.000 0.000 0.032 0.864
#> GSM71702 6 0.2473 0.7887 0.136 0.000 0.000 0.000 0.008 0.856
#> GSM71703 6 0.2402 0.7902 0.140 0.000 0.000 0.000 0.004 0.856
#> GSM71704 6 0.2664 0.7865 0.184 0.000 0.000 0.000 0.000 0.816
#> GSM71705 1 0.4062 0.0777 0.552 0.000 0.000 0.000 0.008 0.440
#> GSM71706 6 0.3841 0.5161 0.380 0.000 0.000 0.000 0.004 0.616
#> GSM71707 6 0.4263 0.0934 0.480 0.000 0.000 0.000 0.016 0.504
#> GSM71708 6 0.2882 0.7838 0.180 0.000 0.000 0.000 0.008 0.812
#> GSM71709 4 0.0725 0.8717 0.000 0.000 0.012 0.976 0.012 0.000
#> GSM71710 1 0.0725 0.8259 0.976 0.000 0.000 0.000 0.012 0.012
#> GSM71711 1 0.1010 0.8257 0.960 0.000 0.000 0.000 0.004 0.036
#> GSM71712 5 0.5604 0.7138 0.000 0.076 0.000 0.216 0.636 0.072
#> GSM71713 6 0.2581 0.4803 0.000 0.020 0.000 0.000 0.120 0.860
#> GSM71714 1 0.0632 0.8276 0.976 0.000 0.000 0.000 0.000 0.024
#> GSM71715 1 0.0891 0.8178 0.968 0.000 0.000 0.000 0.024 0.008
#> GSM71716 1 0.1285 0.8066 0.944 0.000 0.000 0.000 0.052 0.004
#> GSM71717 1 0.0603 0.8239 0.980 0.000 0.000 0.000 0.016 0.004
#> GSM71718 1 0.1970 0.7849 0.900 0.000 0.000 0.000 0.092 0.008
#> GSM71719 1 0.1910 0.7631 0.892 0.000 0.000 0.000 0.108 0.000
#> GSM71720 1 0.1444 0.7925 0.928 0.000 0.000 0.000 0.072 0.000
#> GSM71721 1 0.4604 0.6212 0.708 0.000 0.000 0.008 0.100 0.184
#> GSM71722 1 0.2956 0.7621 0.840 0.000 0.000 0.000 0.040 0.120
#> GSM71723 1 0.0777 0.8277 0.972 0.000 0.000 0.000 0.004 0.024
#> GSM71724 1 0.4253 -0.0415 0.524 0.000 0.000 0.000 0.016 0.460
#> GSM71725 5 0.4870 0.7424 0.088 0.060 0.000 0.124 0.728 0.000
#> GSM71726 4 0.0865 0.8712 0.000 0.000 0.000 0.964 0.036 0.000
#> GSM71727 4 0.0146 0.8833 0.000 0.000 0.000 0.996 0.004 0.000
#> GSM71728 4 0.4022 0.3176 0.004 0.008 0.000 0.628 0.360 0.000
#> GSM71729 4 0.2448 0.8040 0.000 0.052 0.000 0.884 0.064 0.000
#> GSM71730 4 0.0000 0.8835 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM71731 1 0.0547 0.8210 0.980 0.000 0.000 0.000 0.020 0.000
#> GSM71732 1 0.1564 0.8204 0.936 0.000 0.000 0.000 0.040 0.024
#> GSM71733 1 0.1610 0.8028 0.916 0.000 0.000 0.000 0.000 0.084
#> GSM71734 1 0.4210 0.3915 0.636 0.000 0.000 0.000 0.028 0.336
#> GSM71735 1 0.2053 0.7839 0.888 0.000 0.000 0.000 0.004 0.108
#> GSM71736 6 0.3804 0.6022 0.336 0.000 0.000 0.000 0.008 0.656
#> GSM71737 1 0.1265 0.8232 0.948 0.000 0.000 0.000 0.008 0.044
#> GSM71738 1 0.3789 0.1650 0.584 0.000 0.000 0.000 0.000 0.416
#> GSM71739 2 0.3870 0.6975 0.128 0.788 0.000 0.000 0.072 0.012
#> GSM71740 1 0.0458 0.8223 0.984 0.000 0.000 0.000 0.016 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) k
#> CV:NMF 69 1.81e-12 2
#> CV:NMF 69 4.37e-14 3
#> CV:NMF 69 3.22e-19 4
#> CV:NMF 67 2.25e-17 5
#> CV:NMF 61 2.16e-14 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 21168 rows and 70 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.546 0.827 0.919 0.4648 0.503 0.503
#> 3 3 0.860 0.813 0.892 0.2619 0.891 0.786
#> 4 4 0.930 0.930 0.914 0.0729 0.916 0.799
#> 5 5 0.918 0.945 0.960 0.0417 0.997 0.991
#> 6 6 0.920 0.895 0.954 0.0458 0.986 0.958
suggest_best_k()
suggests the best \(k\) based on these statistics. The rules are as follows:
suggest_best_k(res)
#> [1] 4
Following shows the table of the partitions (You need to click the show/hide
code output link to see it). The membership matrix (columns with name p*
)
is inferred by
clue::cl_consensus()
function with the SE
method. Basically the value in the membership matrix
represents the probability to belong to a certain group. The finall class
label for an item is determined with the group with highest probability it
belongs to.
In get_classes()
function, the entropy is calculated from the membership
matrix and the silhouette score is calculated from the consensus matrix.
cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#> class entropy silhouette p1 p2
#> GSM71671 2 0.000 0.8573 0.000 1.000
#> GSM71672 2 0.000 0.8573 0.000 1.000
#> GSM71673 2 0.000 0.8573 0.000 1.000
#> GSM71674 2 0.000 0.8573 0.000 1.000
#> GSM71675 2 0.000 0.8573 0.000 1.000
#> GSM71676 2 0.000 0.8573 0.000 1.000
#> GSM71677 2 0.000 0.8573 0.000 1.000
#> GSM71678 2 0.552 0.8935 0.128 0.872
#> GSM71679 2 0.552 0.8935 0.128 0.872
#> GSM71680 2 0.991 0.3690 0.444 0.556
#> GSM71681 2 0.552 0.8935 0.128 0.872
#> GSM71682 2 0.552 0.8935 0.128 0.872
#> GSM71683 2 0.552 0.8935 0.128 0.872
#> GSM71684 2 0.552 0.8935 0.128 0.872
#> GSM71685 2 0.552 0.8935 0.128 0.872
#> GSM71686 2 0.552 0.8935 0.128 0.872
#> GSM71687 2 0.552 0.8935 0.128 0.872
#> GSM71688 2 0.552 0.8935 0.128 0.872
#> GSM71689 2 0.000 0.8573 0.000 1.000
#> GSM71690 2 0.552 0.8935 0.128 0.872
#> GSM71691 2 0.552 0.8935 0.128 0.872
#> GSM71692 2 0.000 0.8573 0.000 1.000
#> GSM71693 2 0.552 0.8935 0.128 0.872
#> GSM71694 2 0.000 0.8573 0.000 1.000
#> GSM71695 2 0.552 0.8935 0.128 0.872
#> GSM71696 1 0.000 0.9392 1.000 0.000
#> GSM71697 1 0.000 0.9392 1.000 0.000
#> GSM71698 1 0.000 0.9392 1.000 0.000
#> GSM71699 1 0.000 0.9392 1.000 0.000
#> GSM71700 1 0.000 0.9392 1.000 0.000
#> GSM71701 1 0.000 0.9392 1.000 0.000
#> GSM71702 1 0.000 0.9392 1.000 0.000
#> GSM71703 1 0.000 0.9392 1.000 0.000
#> GSM71704 1 0.000 0.9392 1.000 0.000
#> GSM71705 1 0.000 0.9392 1.000 0.000
#> GSM71706 1 0.000 0.9392 1.000 0.000
#> GSM71707 1 0.000 0.9392 1.000 0.000
#> GSM71708 1 0.000 0.9392 1.000 0.000
#> GSM71709 2 0.991 0.3690 0.444 0.556
#> GSM71710 1 0.000 0.9392 1.000 0.000
#> GSM71711 1 0.000 0.9392 1.000 0.000
#> GSM71712 1 0.996 -0.0967 0.536 0.464
#> GSM71713 1 0.000 0.9392 1.000 0.000
#> GSM71714 1 0.000 0.9392 1.000 0.000
#> GSM71715 1 0.118 0.9225 0.984 0.016
#> GSM71716 1 0.000 0.9392 1.000 0.000
#> GSM71717 1 0.000 0.9392 1.000 0.000
#> GSM71718 1 0.000 0.9392 1.000 0.000
#> GSM71719 1 0.000 0.9392 1.000 0.000
#> GSM71720 1 0.000 0.9392 1.000 0.000
#> GSM71721 1 0.000 0.9392 1.000 0.000
#> GSM71722 1 0.000 0.9392 1.000 0.000
#> GSM71723 1 0.000 0.9392 1.000 0.000
#> GSM71724 1 0.000 0.9392 1.000 0.000
#> GSM71725 1 0.996 -0.0967 0.536 0.464
#> GSM71726 1 1.000 -0.2133 0.504 0.496
#> GSM71727 2 0.753 0.8105 0.216 0.784
#> GSM71728 1 1.000 -0.2133 0.504 0.496
#> GSM71729 2 0.644 0.8640 0.164 0.836
#> GSM71730 2 0.753 0.8105 0.216 0.784
#> GSM71731 1 0.000 0.9392 1.000 0.000
#> GSM71732 1 0.000 0.9392 1.000 0.000
#> GSM71733 1 0.000 0.9392 1.000 0.000
#> GSM71734 1 0.000 0.9392 1.000 0.000
#> GSM71735 1 0.000 0.9392 1.000 0.000
#> GSM71736 1 0.000 0.9392 1.000 0.000
#> GSM71737 1 0.000 0.9392 1.000 0.000
#> GSM71738 1 0.000 0.9392 1.000 0.000
#> GSM71739 2 0.990 0.3852 0.440 0.560
#> GSM71740 1 0.000 0.9392 1.000 0.000
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> GSM71671 3 0.0000 0.6626 0.000 0.000 1.000
#> GSM71672 3 0.0000 0.6626 0.000 0.000 1.000
#> GSM71673 3 0.0000 0.6626 0.000 0.000 1.000
#> GSM71674 3 0.0000 0.6626 0.000 0.000 1.000
#> GSM71675 3 0.0000 0.6626 0.000 0.000 1.000
#> GSM71676 3 0.0000 0.6626 0.000 0.000 1.000
#> GSM71677 3 0.0000 0.6626 0.000 0.000 1.000
#> GSM71678 3 0.5760 0.7158 0.000 0.328 0.672
#> GSM71679 3 0.5760 0.7158 0.000 0.328 0.672
#> GSM71680 2 0.0000 0.7258 0.000 1.000 0.000
#> GSM71681 3 0.5785 0.7117 0.000 0.332 0.668
#> GSM71682 3 0.5760 0.7158 0.000 0.328 0.672
#> GSM71683 3 0.5760 0.7158 0.000 0.328 0.672
#> GSM71684 3 0.5760 0.7158 0.000 0.328 0.672
#> GSM71685 3 0.5785 0.7117 0.000 0.332 0.668
#> GSM71686 3 0.5760 0.7158 0.000 0.328 0.672
#> GSM71687 3 0.5760 0.7158 0.000 0.328 0.672
#> GSM71688 3 0.5760 0.7158 0.000 0.328 0.672
#> GSM71689 3 0.0000 0.6626 0.000 0.000 1.000
#> GSM71690 3 0.5760 0.7158 0.000 0.328 0.672
#> GSM71691 3 0.5733 0.7155 0.000 0.324 0.676
#> GSM71692 3 0.0000 0.6626 0.000 0.000 1.000
#> GSM71693 3 0.5760 0.7158 0.000 0.328 0.672
#> GSM71694 3 0.0000 0.6626 0.000 0.000 1.000
#> GSM71695 3 0.5733 0.7155 0.000 0.324 0.676
#> GSM71696 1 0.0000 0.9994 1.000 0.000 0.000
#> GSM71697 1 0.0000 0.9994 1.000 0.000 0.000
#> GSM71698 1 0.0000 0.9994 1.000 0.000 0.000
#> GSM71699 1 0.0000 0.9994 1.000 0.000 0.000
#> GSM71700 1 0.0000 0.9994 1.000 0.000 0.000
#> GSM71701 1 0.0000 0.9994 1.000 0.000 0.000
#> GSM71702 1 0.0000 0.9994 1.000 0.000 0.000
#> GSM71703 1 0.0000 0.9994 1.000 0.000 0.000
#> GSM71704 1 0.0000 0.9994 1.000 0.000 0.000
#> GSM71705 1 0.0000 0.9994 1.000 0.000 0.000
#> GSM71706 1 0.0000 0.9994 1.000 0.000 0.000
#> GSM71707 1 0.0000 0.9994 1.000 0.000 0.000
#> GSM71708 1 0.0000 0.9994 1.000 0.000 0.000
#> GSM71709 2 0.0000 0.7258 0.000 1.000 0.000
#> GSM71710 1 0.0000 0.9994 1.000 0.000 0.000
#> GSM71711 1 0.0000 0.9994 1.000 0.000 0.000
#> GSM71712 2 0.2959 0.7290 0.100 0.900 0.000
#> GSM71713 1 0.0000 0.9994 1.000 0.000 0.000
#> GSM71714 1 0.0000 0.9994 1.000 0.000 0.000
#> GSM71715 1 0.0892 0.9791 0.980 0.020 0.000
#> GSM71716 1 0.0000 0.9994 1.000 0.000 0.000
#> GSM71717 1 0.0000 0.9994 1.000 0.000 0.000
#> GSM71718 1 0.0000 0.9994 1.000 0.000 0.000
#> GSM71719 1 0.0000 0.9994 1.000 0.000 0.000
#> GSM71720 1 0.0000 0.9994 1.000 0.000 0.000
#> GSM71721 1 0.0000 0.9994 1.000 0.000 0.000
#> GSM71722 1 0.0000 0.9994 1.000 0.000 0.000
#> GSM71723 1 0.0000 0.9994 1.000 0.000 0.000
#> GSM71724 1 0.0000 0.9994 1.000 0.000 0.000
#> GSM71725 2 0.2959 0.7290 0.100 0.900 0.000
#> GSM71726 2 0.2066 0.7512 0.060 0.940 0.000
#> GSM71727 2 0.6267 -0.2796 0.000 0.548 0.452
#> GSM71728 2 0.2066 0.7512 0.060 0.940 0.000
#> GSM71729 3 0.6286 0.4469 0.000 0.464 0.536
#> GSM71730 2 0.6267 -0.2796 0.000 0.548 0.452
#> GSM71731 1 0.0000 0.9994 1.000 0.000 0.000
#> GSM71732 1 0.0000 0.9994 1.000 0.000 0.000
#> GSM71733 1 0.0000 0.9994 1.000 0.000 0.000
#> GSM71734 1 0.0000 0.9994 1.000 0.000 0.000
#> GSM71735 1 0.0000 0.9994 1.000 0.000 0.000
#> GSM71736 1 0.0000 0.9994 1.000 0.000 0.000
#> GSM71737 1 0.0000 0.9994 1.000 0.000 0.000
#> GSM71738 1 0.0000 0.9994 1.000 0.000 0.000
#> GSM71739 3 0.9925 0.0222 0.336 0.280 0.384
#> GSM71740 1 0.0000 0.9994 1.000 0.000 0.000
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> GSM71671 3 0.4746 1.000 0.000 0.368 0.632 0.000
#> GSM71672 3 0.4746 1.000 0.000 0.368 0.632 0.000
#> GSM71673 3 0.4746 1.000 0.000 0.368 0.632 0.000
#> GSM71674 3 0.4746 1.000 0.000 0.368 0.632 0.000
#> GSM71675 3 0.4746 1.000 0.000 0.368 0.632 0.000
#> GSM71676 3 0.4746 1.000 0.000 0.368 0.632 0.000
#> GSM71677 3 0.4746 1.000 0.000 0.368 0.632 0.000
#> GSM71678 2 0.0000 0.879 0.000 1.000 0.000 0.000
#> GSM71679 2 0.0000 0.879 0.000 1.000 0.000 0.000
#> GSM71680 4 0.0707 0.783 0.000 0.020 0.000 0.980
#> GSM71681 2 0.0188 0.877 0.000 0.996 0.000 0.004
#> GSM71682 2 0.0000 0.879 0.000 1.000 0.000 0.000
#> GSM71683 2 0.0000 0.879 0.000 1.000 0.000 0.000
#> GSM71684 2 0.0000 0.879 0.000 1.000 0.000 0.000
#> GSM71685 2 0.0188 0.877 0.000 0.996 0.000 0.004
#> GSM71686 2 0.0000 0.879 0.000 1.000 0.000 0.000
#> GSM71687 2 0.0000 0.879 0.000 1.000 0.000 0.000
#> GSM71688 2 0.0000 0.879 0.000 1.000 0.000 0.000
#> GSM71689 3 0.4746 1.000 0.000 0.368 0.632 0.000
#> GSM71690 2 0.0000 0.879 0.000 1.000 0.000 0.000
#> GSM71691 2 0.0188 0.875 0.000 0.996 0.004 0.000
#> GSM71692 3 0.4746 1.000 0.000 0.368 0.632 0.000
#> GSM71693 2 0.0000 0.879 0.000 1.000 0.000 0.000
#> GSM71694 3 0.4746 1.000 0.000 0.368 0.632 0.000
#> GSM71695 2 0.0188 0.875 0.000 0.996 0.004 0.000
#> GSM71696 1 0.0895 0.977 0.976 0.000 0.020 0.004
#> GSM71697 1 0.0000 0.996 1.000 0.000 0.000 0.000
#> GSM71698 1 0.0000 0.996 1.000 0.000 0.000 0.000
#> GSM71699 1 0.0000 0.996 1.000 0.000 0.000 0.000
#> GSM71700 1 0.0000 0.996 1.000 0.000 0.000 0.000
#> GSM71701 1 0.0000 0.996 1.000 0.000 0.000 0.000
#> GSM71702 1 0.0000 0.996 1.000 0.000 0.000 0.000
#> GSM71703 1 0.0000 0.996 1.000 0.000 0.000 0.000
#> GSM71704 1 0.0000 0.996 1.000 0.000 0.000 0.000
#> GSM71705 1 0.0000 0.996 1.000 0.000 0.000 0.000
#> GSM71706 1 0.0000 0.996 1.000 0.000 0.000 0.000
#> GSM71707 1 0.0000 0.996 1.000 0.000 0.000 0.000
#> GSM71708 1 0.0000 0.996 1.000 0.000 0.000 0.000
#> GSM71709 4 0.0707 0.783 0.000 0.020 0.000 0.980
#> GSM71710 1 0.0376 0.991 0.992 0.000 0.004 0.004
#> GSM71711 1 0.0000 0.996 1.000 0.000 0.000 0.000
#> GSM71712 4 0.6352 0.866 0.040 0.016 0.368 0.576
#> GSM71713 1 0.0000 0.996 1.000 0.000 0.000 0.000
#> GSM71714 1 0.0000 0.996 1.000 0.000 0.000 0.000
#> GSM71715 1 0.1902 0.930 0.932 0.000 0.064 0.004
#> GSM71716 1 0.0524 0.988 0.988 0.000 0.008 0.004
#> GSM71717 1 0.0000 0.996 1.000 0.000 0.000 0.000
#> GSM71718 1 0.0188 0.994 0.996 0.000 0.004 0.000
#> GSM71719 1 0.0188 0.994 0.996 0.000 0.004 0.000
#> GSM71720 1 0.0188 0.994 0.996 0.000 0.004 0.000
#> GSM71721 1 0.0000 0.996 1.000 0.000 0.000 0.000
#> GSM71722 1 0.0000 0.996 1.000 0.000 0.000 0.000
#> GSM71723 1 0.0000 0.996 1.000 0.000 0.000 0.000
#> GSM71724 1 0.0000 0.996 1.000 0.000 0.000 0.000
#> GSM71725 4 0.6352 0.866 0.040 0.016 0.368 0.576
#> GSM71726 4 0.5284 0.874 0.000 0.016 0.368 0.616
#> GSM71727 2 0.4730 0.475 0.000 0.636 0.000 0.364
#> GSM71728 4 0.5284 0.874 0.000 0.016 0.368 0.616
#> GSM71729 2 0.3400 0.703 0.000 0.820 0.000 0.180
#> GSM71730 2 0.4730 0.475 0.000 0.636 0.000 0.364
#> GSM71731 1 0.0188 0.994 0.996 0.000 0.004 0.000
#> GSM71732 1 0.0000 0.996 1.000 0.000 0.000 0.000
#> GSM71733 1 0.0000 0.996 1.000 0.000 0.000 0.000
#> GSM71734 1 0.0000 0.996 1.000 0.000 0.000 0.000
#> GSM71735 1 0.0000 0.996 1.000 0.000 0.000 0.000
#> GSM71736 1 0.0000 0.996 1.000 0.000 0.000 0.000
#> GSM71737 1 0.0000 0.996 1.000 0.000 0.000 0.000
#> GSM71738 1 0.0000 0.996 1.000 0.000 0.000 0.000
#> GSM71739 2 0.6059 0.348 0.288 0.644 0.064 0.004
#> GSM71740 1 0.0188 0.994 0.996 0.000 0.004 0.000
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> GSM71671 3 0.2074 1.000 0.000 0.104 0.896 0.000 0.000
#> GSM71672 3 0.2074 1.000 0.000 0.104 0.896 0.000 0.000
#> GSM71673 3 0.2074 1.000 0.000 0.104 0.896 0.000 0.000
#> GSM71674 3 0.2074 1.000 0.000 0.104 0.896 0.000 0.000
#> GSM71675 3 0.2074 1.000 0.000 0.104 0.896 0.000 0.000
#> GSM71676 3 0.2074 1.000 0.000 0.104 0.896 0.000 0.000
#> GSM71677 3 0.2074 1.000 0.000 0.104 0.896 0.000 0.000
#> GSM71678 2 0.0000 0.909 0.000 1.000 0.000 0.000 0.000
#> GSM71679 2 0.0000 0.909 0.000 1.000 0.000 0.000 0.000
#> GSM71680 4 0.0000 1.000 0.000 0.000 0.000 1.000 0.000
#> GSM71681 2 0.0162 0.907 0.000 0.996 0.000 0.004 0.000
#> GSM71682 2 0.0000 0.909 0.000 1.000 0.000 0.000 0.000
#> GSM71683 2 0.0000 0.909 0.000 1.000 0.000 0.000 0.000
#> GSM71684 2 0.0000 0.909 0.000 1.000 0.000 0.000 0.000
#> GSM71685 2 0.0162 0.907 0.000 0.996 0.000 0.004 0.000
#> GSM71686 2 0.0000 0.909 0.000 1.000 0.000 0.000 0.000
#> GSM71687 2 0.0000 0.909 0.000 1.000 0.000 0.000 0.000
#> GSM71688 2 0.0000 0.909 0.000 1.000 0.000 0.000 0.000
#> GSM71689 3 0.2074 1.000 0.000 0.104 0.896 0.000 0.000
#> GSM71690 2 0.0000 0.909 0.000 1.000 0.000 0.000 0.000
#> GSM71691 2 0.1043 0.880 0.000 0.960 0.040 0.000 0.000
#> GSM71692 3 0.2074 1.000 0.000 0.104 0.896 0.000 0.000
#> GSM71693 2 0.0000 0.909 0.000 1.000 0.000 0.000 0.000
#> GSM71694 3 0.2074 1.000 0.000 0.104 0.896 0.000 0.000
#> GSM71695 2 0.1043 0.880 0.000 0.960 0.040 0.000 0.000
#> GSM71696 1 0.1877 0.923 0.924 0.000 0.064 0.000 0.012
#> GSM71697 1 0.0000 0.992 1.000 0.000 0.000 0.000 0.000
#> GSM71698 1 0.0000 0.992 1.000 0.000 0.000 0.000 0.000
#> GSM71699 1 0.0000 0.992 1.000 0.000 0.000 0.000 0.000
#> GSM71700 1 0.0000 0.992 1.000 0.000 0.000 0.000 0.000
#> GSM71701 1 0.0000 0.992 1.000 0.000 0.000 0.000 0.000
#> GSM71702 1 0.0000 0.992 1.000 0.000 0.000 0.000 0.000
#> GSM71703 1 0.0000 0.992 1.000 0.000 0.000 0.000 0.000
#> GSM71704 1 0.0000 0.992 1.000 0.000 0.000 0.000 0.000
#> GSM71705 1 0.0000 0.992 1.000 0.000 0.000 0.000 0.000
#> GSM71706 1 0.0000 0.992 1.000 0.000 0.000 0.000 0.000
#> GSM71707 1 0.0000 0.992 1.000 0.000 0.000 0.000 0.000
#> GSM71708 1 0.0000 0.992 1.000 0.000 0.000 0.000 0.000
#> GSM71709 4 0.0000 1.000 0.000 0.000 0.000 1.000 0.000
#> GSM71710 1 0.0290 0.987 0.992 0.000 0.000 0.000 0.008
#> GSM71711 1 0.0000 0.992 1.000 0.000 0.000 0.000 0.000
#> GSM71712 5 0.0000 0.971 0.000 0.000 0.000 0.000 1.000
#> GSM71713 1 0.0794 0.968 0.972 0.000 0.000 0.000 0.028
#> GSM71714 1 0.0000 0.992 1.000 0.000 0.000 0.000 0.000
#> GSM71715 1 0.3164 0.841 0.852 0.000 0.104 0.000 0.044
#> GSM71716 1 0.0404 0.984 0.988 0.000 0.000 0.000 0.012
#> GSM71717 1 0.0000 0.992 1.000 0.000 0.000 0.000 0.000
#> GSM71718 1 0.0162 0.990 0.996 0.000 0.000 0.000 0.004
#> GSM71719 1 0.0162 0.990 0.996 0.000 0.000 0.000 0.004
#> GSM71720 1 0.0162 0.990 0.996 0.000 0.000 0.000 0.004
#> GSM71721 1 0.0000 0.992 1.000 0.000 0.000 0.000 0.000
#> GSM71722 1 0.0000 0.992 1.000 0.000 0.000 0.000 0.000
#> GSM71723 1 0.0000 0.992 1.000 0.000 0.000 0.000 0.000
#> GSM71724 1 0.0000 0.992 1.000 0.000 0.000 0.000 0.000
#> GSM71725 5 0.0000 0.971 0.000 0.000 0.000 0.000 1.000
#> GSM71726 5 0.1043 0.971 0.000 0.000 0.000 0.040 0.960
#> GSM71727 2 0.4088 0.487 0.000 0.632 0.000 0.368 0.000
#> GSM71728 5 0.1043 0.971 0.000 0.000 0.000 0.040 0.960
#> GSM71729 2 0.2966 0.756 0.000 0.816 0.000 0.184 0.000
#> GSM71730 2 0.4088 0.487 0.000 0.632 0.000 0.368 0.000
#> GSM71731 1 0.0162 0.990 0.996 0.000 0.000 0.000 0.004
#> GSM71732 1 0.0000 0.992 1.000 0.000 0.000 0.000 0.000
#> GSM71733 1 0.0000 0.992 1.000 0.000 0.000 0.000 0.000
#> GSM71734 1 0.0000 0.992 1.000 0.000 0.000 0.000 0.000
#> GSM71735 1 0.0000 0.992 1.000 0.000 0.000 0.000 0.000
#> GSM71736 1 0.0000 0.992 1.000 0.000 0.000 0.000 0.000
#> GSM71737 1 0.0000 0.992 1.000 0.000 0.000 0.000 0.000
#> GSM71738 1 0.0000 0.992 1.000 0.000 0.000 0.000 0.000
#> GSM71739 2 0.6107 0.423 0.208 0.644 0.104 0.000 0.044
#> GSM71740 1 0.0162 0.990 0.996 0.000 0.000 0.000 0.004
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> GSM71671 3 0.0000 0.998 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM71672 3 0.0000 0.998 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM71673 3 0.0000 0.998 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM71674 3 0.0000 0.998 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM71675 3 0.0000 0.998 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM71676 3 0.0000 0.998 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM71677 3 0.0146 0.997 0.000 0.000 0.996 0.000 0.000 0.004
#> GSM71678 2 0.0000 0.891 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM71679 2 0.0000 0.891 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM71680 4 0.0000 1.000 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM71681 2 0.0146 0.889 0.000 0.996 0.000 0.004 0.000 0.000
#> GSM71682 2 0.0000 0.891 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM71683 2 0.0000 0.891 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM71684 2 0.0000 0.891 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM71685 2 0.0146 0.889 0.000 0.996 0.000 0.004 0.000 0.000
#> GSM71686 2 0.0000 0.891 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM71687 2 0.0000 0.891 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM71688 2 0.0000 0.891 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM71689 3 0.0146 0.997 0.000 0.000 0.996 0.000 0.000 0.004
#> GSM71690 2 0.0000 0.891 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM71691 2 0.3341 0.747 0.000 0.816 0.116 0.000 0.000 0.068
#> GSM71692 3 0.0146 0.997 0.000 0.000 0.996 0.000 0.000 0.004
#> GSM71693 2 0.0000 0.891 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM71694 3 0.0146 0.997 0.000 0.000 0.996 0.000 0.000 0.004
#> GSM71695 2 0.3341 0.747 0.000 0.816 0.116 0.000 0.000 0.068
#> GSM71696 1 0.1753 0.863 0.912 0.000 0.000 0.000 0.004 0.084
#> GSM71697 1 0.0000 0.956 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM71698 1 0.2854 0.694 0.792 0.000 0.000 0.000 0.000 0.208
#> GSM71699 1 0.1267 0.927 0.940 0.000 0.000 0.000 0.000 0.060
#> GSM71700 1 0.0260 0.957 0.992 0.000 0.000 0.000 0.000 0.008
#> GSM71701 1 0.2854 0.694 0.792 0.000 0.000 0.000 0.000 0.208
#> GSM71702 1 0.0790 0.951 0.968 0.000 0.000 0.000 0.000 0.032
#> GSM71703 1 0.0713 0.952 0.972 0.000 0.000 0.000 0.000 0.028
#> GSM71704 1 0.0547 0.954 0.980 0.000 0.000 0.000 0.000 0.020
#> GSM71705 1 0.0260 0.957 0.992 0.000 0.000 0.000 0.000 0.008
#> GSM71706 1 0.0458 0.956 0.984 0.000 0.000 0.000 0.000 0.016
#> GSM71707 1 0.0865 0.947 0.964 0.000 0.000 0.000 0.000 0.036
#> GSM71708 1 0.0458 0.956 0.984 0.000 0.000 0.000 0.000 0.016
#> GSM71709 4 0.0000 1.000 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM71710 1 0.0291 0.954 0.992 0.000 0.000 0.000 0.004 0.004
#> GSM71711 1 0.0000 0.956 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM71712 5 0.0000 0.972 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM71713 6 0.3534 0.000 0.244 0.000 0.000 0.000 0.016 0.740
#> GSM71714 1 0.0146 0.957 0.996 0.000 0.000 0.000 0.000 0.004
#> GSM71715 1 0.2738 0.704 0.820 0.000 0.000 0.000 0.004 0.176
#> GSM71716 1 0.0405 0.952 0.988 0.000 0.000 0.000 0.004 0.008
#> GSM71717 1 0.0000 0.956 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM71718 1 0.0260 0.955 0.992 0.000 0.000 0.000 0.000 0.008
#> GSM71719 1 0.0146 0.956 0.996 0.000 0.000 0.000 0.000 0.004
#> GSM71720 1 0.0146 0.956 0.996 0.000 0.000 0.000 0.000 0.004
#> GSM71721 1 0.0865 0.943 0.964 0.000 0.000 0.000 0.000 0.036
#> GSM71722 1 0.0363 0.956 0.988 0.000 0.000 0.000 0.000 0.012
#> GSM71723 1 0.0260 0.957 0.992 0.000 0.000 0.000 0.000 0.008
#> GSM71724 1 0.0865 0.948 0.964 0.000 0.000 0.000 0.000 0.036
#> GSM71725 5 0.0000 0.972 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM71726 5 0.0937 0.972 0.000 0.000 0.000 0.040 0.960 0.000
#> GSM71727 2 0.3911 0.475 0.000 0.624 0.000 0.368 0.000 0.008
#> GSM71728 5 0.0937 0.972 0.000 0.000 0.000 0.040 0.960 0.000
#> GSM71729 2 0.3014 0.739 0.000 0.804 0.000 0.184 0.000 0.012
#> GSM71730 2 0.3911 0.475 0.000 0.624 0.000 0.368 0.000 0.008
#> GSM71731 1 0.0146 0.956 0.996 0.000 0.000 0.000 0.000 0.004
#> GSM71732 1 0.0865 0.943 0.964 0.000 0.000 0.000 0.000 0.036
#> GSM71733 1 0.0260 0.957 0.992 0.000 0.000 0.000 0.000 0.008
#> GSM71734 1 0.0713 0.952 0.972 0.000 0.000 0.000 0.000 0.028
#> GSM71735 1 0.0363 0.956 0.988 0.000 0.000 0.000 0.000 0.012
#> GSM71736 1 0.0790 0.950 0.968 0.000 0.000 0.000 0.000 0.032
#> GSM71737 1 0.0260 0.957 0.992 0.000 0.000 0.000 0.000 0.008
#> GSM71738 1 0.0713 0.952 0.972 0.000 0.000 0.000 0.000 0.028
#> GSM71739 2 0.5202 0.429 0.176 0.632 0.000 0.000 0.004 0.188
#> GSM71740 1 0.0146 0.956 0.996 0.000 0.000 0.000 0.000 0.004
Heatmaps for the consensus matrix. It visualizes the probability of two samples to be in a same group.
consensus_heatmap(res, k = 2)
consensus_heatmap(res, k = 3)
consensus_heatmap(res, k = 4)
consensus_heatmap(res, k = 5)
consensus_heatmap(res, k = 6)
Heatmaps for the membership of samples in all partitions to see how consistent they are:
membership_heatmap(res, k = 2)
membership_heatmap(res, k = 3)
membership_heatmap(res, k = 4)
membership_heatmap(res, k = 5)
membership_heatmap(res, k = 6)
As soon as we have had the classes for columns, we can look for signatures which are significantly different between classes which can be candidate marks for certain classes. Following are the heatmaps for signatures.
Signature heatmaps where rows are scaled:
get_signatures(res, k = 2)
get_signatures(res, k = 3)
get_signatures(res, k = 4)
get_signatures(res, k = 5)
get_signatures(res, k = 6)
Signature heatmaps where rows are not scaled:
get_signatures(res, k = 2, scale_rows = FALSE)
get_signatures(res, k = 3, scale_rows = FALSE)
get_signatures(res, k = 4, scale_rows = FALSE)
get_signatures(res, k = 5, scale_rows = FALSE)
get_signatures(res, k = 6, scale_rows = FALSE)
Compare the overlap of signatures from different k:
compare_signatures(res)
get_signature()
returns a data frame invisibly. TO get the list of signatures, the function
call should be assigned to a variable explicitly. In following code, if plot
argument is set
to FALSE
, no heatmap is plotted while only the differential analysis is performed.
# code only for demonstration
tb = get_signature(res, k = ..., plot = FALSE)
An example of the output of tb
is:
#> which_row fdr mean_1 mean_2 scaled_mean_1 scaled_mean_2 km
#> 1 38 0.042760348 8.373488 9.131774 -0.5533452 0.5164555 1
#> 2 40 0.018707592 7.106213 8.469186 -0.6173731 0.5762149 1
#> 3 55 0.019134737 10.221463 11.207825 -0.6159697 0.5749050 1
#> 4 59 0.006059896 5.921854 7.869574 -0.6899429 0.6439467 1
#> 5 60 0.018055526 8.928898 10.211722 -0.6204761 0.5791110 1
#> 6 98 0.009384629 15.714769 14.887706 0.6635654 -0.6193277 2
...
The columns in tb
are:
which_row
: row indices corresponding to the input matrix.fdr
: FDR for the differential test. mean_x
: The mean value in group x.scaled_mean_x
: The mean value in group x after rows are scaled.km
: Row groups if k-means clustering is applied to rows.UMAP plot which shows how samples are separated.
dimension_reduction(res, k = 2, method = "UMAP")
dimension_reduction(res, k = 3, method = "UMAP")
dimension_reduction(res, k = 4, method = "UMAP")
dimension_reduction(res, k = 5, method = "UMAP")
dimension_reduction(res, k = 6, method = "UMAP")
Following heatmap shows how subgroups are split when increasing k
:
collect_classes(res)
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) k
#> MAD:hclust 63 5.96e-12 2
#> MAD:hclust 66 7.95e-13 3
#> MAD:hclust 67 1.23e-18 4
#> MAD:hclust 67 8.80e-18 5
#> MAD:hclust 66 1.80e-17 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 21168 rows and 70 columns.
#> Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'MAD' method.
#> Subgroups are detected by 'kmeans' method.
#> Performed in total 1250 partitions by row resampling.
#> Best k for subgroups seems to be 2.
#>
#> Following methods can be applied to this 'ConsensusPartition' object:
#> [1] "cola_report" "collect_classes" "collect_plots"
#> [4] "collect_stats" "colnames" "compare_signatures"
#> [7] "consensus_heatmap" "dimension_reduction" "functional_enrichment"
#> [10] "get_anno_col" "get_anno" "get_classes"
#> [13] "get_consensus" "get_matrix" "get_membership"
#> [16] "get_param" "get_signatures" "get_stats"
#> [19] "is_best_k" "is_stable_k" "membership_heatmap"
#> [22] "ncol" "nrow" "plot_ecdf"
#> [25] "rownames" "select_partition_number" "show"
#> [28] "suggest_best_k" "test_to_known_factors"
collect_plots()
function collects all the plots made from res
for all k
(number of partitions)
into one single page to provide an easy and fast comparison between different k
.
collect_plots(res)
The plots are:
k
and the heatmap of
predicted classes for each k
.k
.k
.k
.All the plots in panels can be made by individual functions and they are plotted later in this section.
select_partition_number()
produces several plots showing different
statistics for choosing “optimized” k
. There are following statistics:
k
;k
, the area increased is defined as \(A_k - A_{k-1}\).The detailed explanations of these statistics can be found in the cola vignette.
Generally speaking, lower PAC score, higher mean silhouette score or higher
concordance corresponds to better partition. Rand index and Jaccard index
measure how similar the current partition is compared to partition with k-1
.
If they are too similar, we won't accept k
is better than k-1
.
select_partition_number(res)
The numeric values for all these statistics can be obtained by get_stats()
.
get_stats(res)
#> k 1-PAC mean_silhouette concordance area_increased Rand Jaccard
#> 2 2 1.000 0.964 0.986 0.4978 0.503 0.503
#> 3 3 0.709 0.791 0.811 0.2222 0.971 0.945
#> 4 4 0.701 0.757 0.705 0.1522 0.741 0.490
#> 5 5 0.712 0.902 0.861 0.0892 0.943 0.783
#> 6 6 0.717 0.798 0.832 0.0420 0.988 0.945
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
#> GSM71671 2 0.000 0.986 0.000 1.000
#> GSM71672 2 0.000 0.986 0.000 1.000
#> GSM71673 2 0.000 0.986 0.000 1.000
#> GSM71674 2 0.000 0.986 0.000 1.000
#> GSM71675 2 0.000 0.986 0.000 1.000
#> GSM71676 2 0.000 0.986 0.000 1.000
#> GSM71677 2 0.000 0.986 0.000 1.000
#> GSM71678 2 0.000 0.986 0.000 1.000
#> GSM71679 2 0.000 0.986 0.000 1.000
#> GSM71680 2 0.000 0.986 0.000 1.000
#> GSM71681 2 0.000 0.986 0.000 1.000
#> GSM71682 2 0.000 0.986 0.000 1.000
#> GSM71683 2 0.000 0.986 0.000 1.000
#> GSM71684 2 0.000 0.986 0.000 1.000
#> GSM71685 2 0.000 0.986 0.000 1.000
#> GSM71686 2 0.000 0.986 0.000 1.000
#> GSM71687 2 0.000 0.986 0.000 1.000
#> GSM71688 2 0.000 0.986 0.000 1.000
#> GSM71689 2 0.000 0.986 0.000 1.000
#> GSM71690 2 0.000 0.986 0.000 1.000
#> GSM71691 2 0.000 0.986 0.000 1.000
#> GSM71692 2 0.000 0.986 0.000 1.000
#> GSM71693 2 0.000 0.986 0.000 1.000
#> GSM71694 2 0.000 0.986 0.000 1.000
#> GSM71695 2 0.000 0.986 0.000 1.000
#> GSM71696 1 0.000 0.985 1.000 0.000
#> GSM71697 1 0.000 0.985 1.000 0.000
#> GSM71698 1 0.000 0.985 1.000 0.000
#> GSM71699 1 0.000 0.985 1.000 0.000
#> GSM71700 1 0.000 0.985 1.000 0.000
#> GSM71701 1 0.000 0.985 1.000 0.000
#> GSM71702 1 0.000 0.985 1.000 0.000
#> GSM71703 1 0.000 0.985 1.000 0.000
#> GSM71704 1 0.000 0.985 1.000 0.000
#> GSM71705 1 0.000 0.985 1.000 0.000
#> GSM71706 1 0.000 0.985 1.000 0.000
#> GSM71707 1 0.000 0.985 1.000 0.000
#> GSM71708 1 0.000 0.985 1.000 0.000
#> GSM71709 2 0.000 0.986 0.000 1.000
#> GSM71710 1 0.000 0.985 1.000 0.000
#> GSM71711 1 0.000 0.985 1.000 0.000
#> GSM71712 1 0.000 0.985 1.000 0.000
#> GSM71713 1 0.000 0.985 1.000 0.000
#> GSM71714 1 0.000 0.985 1.000 0.000
#> GSM71715 1 0.000 0.985 1.000 0.000
#> GSM71716 1 0.000 0.985 1.000 0.000
#> GSM71717 1 0.000 0.985 1.000 0.000
#> GSM71718 1 0.000 0.985 1.000 0.000
#> GSM71719 1 0.000 0.985 1.000 0.000
#> GSM71720 1 0.000 0.985 1.000 0.000
#> GSM71721 1 0.000 0.985 1.000 0.000
#> GSM71722 1 0.000 0.985 1.000 0.000
#> GSM71723 1 0.000 0.985 1.000 0.000
#> GSM71724 1 0.000 0.985 1.000 0.000
#> GSM71725 1 0.000 0.985 1.000 0.000
#> GSM71726 2 0.973 0.306 0.404 0.596
#> GSM71727 2 0.000 0.986 0.000 1.000
#> GSM71728 1 0.936 0.445 0.648 0.352
#> GSM71729 2 0.000 0.986 0.000 1.000
#> GSM71730 2 0.000 0.986 0.000 1.000
#> GSM71731 1 0.000 0.985 1.000 0.000
#> GSM71732 1 0.000 0.985 1.000 0.000
#> GSM71733 1 0.000 0.985 1.000 0.000
#> GSM71734 1 0.000 0.985 1.000 0.000
#> GSM71735 1 0.000 0.985 1.000 0.000
#> GSM71736 1 0.000 0.985 1.000 0.000
#> GSM71737 1 0.000 0.985 1.000 0.000
#> GSM71738 1 0.000 0.985 1.000 0.000
#> GSM71739 1 0.738 0.731 0.792 0.208
#> GSM71740 1 0.000 0.985 1.000 0.000
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> GSM71671 2 0.6154 0.724 0.000 0.592 0.408
#> GSM71672 2 0.6154 0.724 0.000 0.592 0.408
#> GSM71673 2 0.6154 0.724 0.000 0.592 0.408
#> GSM71674 2 0.6154 0.724 0.000 0.592 0.408
#> GSM71675 2 0.6154 0.724 0.000 0.592 0.408
#> GSM71676 2 0.6154 0.724 0.000 0.592 0.408
#> GSM71677 2 0.6154 0.724 0.000 0.592 0.408
#> GSM71678 2 0.0000 0.818 0.000 1.000 0.000
#> GSM71679 2 0.0000 0.818 0.000 1.000 0.000
#> GSM71680 2 0.5560 0.699 0.000 0.700 0.300
#> GSM71681 2 0.0000 0.818 0.000 1.000 0.000
#> GSM71682 2 0.0000 0.818 0.000 1.000 0.000
#> GSM71683 2 0.0000 0.818 0.000 1.000 0.000
#> GSM71684 2 0.2066 0.801 0.000 0.940 0.060
#> GSM71685 2 0.0237 0.817 0.000 0.996 0.004
#> GSM71686 2 0.0000 0.818 0.000 1.000 0.000
#> GSM71687 2 0.0000 0.818 0.000 1.000 0.000
#> GSM71688 2 0.0000 0.818 0.000 1.000 0.000
#> GSM71689 2 0.6154 0.724 0.000 0.592 0.408
#> GSM71690 2 0.0000 0.818 0.000 1.000 0.000
#> GSM71691 2 0.0000 0.818 0.000 1.000 0.000
#> GSM71692 2 0.6154 0.724 0.000 0.592 0.408
#> GSM71693 2 0.0000 0.818 0.000 1.000 0.000
#> GSM71694 2 0.6154 0.724 0.000 0.592 0.408
#> GSM71695 2 0.0000 0.818 0.000 1.000 0.000
#> GSM71696 1 0.0424 0.867 0.992 0.000 0.008
#> GSM71697 1 0.0000 0.869 1.000 0.000 0.000
#> GSM71698 1 0.4931 0.855 0.768 0.000 0.232
#> GSM71699 1 0.4931 0.855 0.768 0.000 0.232
#> GSM71700 1 0.0424 0.870 0.992 0.000 0.008
#> GSM71701 1 0.4931 0.855 0.768 0.000 0.232
#> GSM71702 1 0.4931 0.855 0.768 0.000 0.232
#> GSM71703 1 0.4931 0.855 0.768 0.000 0.232
#> GSM71704 1 0.4931 0.855 0.768 0.000 0.232
#> GSM71705 1 0.4931 0.855 0.768 0.000 0.232
#> GSM71706 1 0.4931 0.855 0.768 0.000 0.232
#> GSM71707 1 0.4931 0.855 0.768 0.000 0.232
#> GSM71708 1 0.4931 0.855 0.768 0.000 0.232
#> GSM71709 2 0.5560 0.699 0.000 0.700 0.300
#> GSM71710 1 0.0237 0.869 0.996 0.000 0.004
#> GSM71711 1 0.0000 0.869 1.000 0.000 0.000
#> GSM71712 1 0.5926 0.539 0.644 0.000 0.356
#> GSM71713 1 0.4931 0.855 0.768 0.000 0.232
#> GSM71714 1 0.0000 0.869 1.000 0.000 0.000
#> GSM71715 1 0.0424 0.867 0.992 0.000 0.008
#> GSM71716 1 0.0237 0.868 0.996 0.000 0.004
#> GSM71717 1 0.0424 0.870 0.992 0.000 0.008
#> GSM71718 1 0.1964 0.845 0.944 0.000 0.056
#> GSM71719 1 0.1964 0.845 0.944 0.000 0.056
#> GSM71720 1 0.1964 0.845 0.944 0.000 0.056
#> GSM71721 1 0.1753 0.849 0.952 0.000 0.048
#> GSM71722 1 0.0237 0.868 0.996 0.000 0.004
#> GSM71723 1 0.0237 0.869 0.996 0.000 0.004
#> GSM71724 1 0.4931 0.855 0.768 0.000 0.232
#> GSM71725 1 0.5178 0.669 0.744 0.000 0.256
#> GSM71726 2 0.9816 0.359 0.244 0.400 0.356
#> GSM71727 2 0.5216 0.721 0.000 0.740 0.260
#> GSM71728 2 0.9833 0.353 0.248 0.396 0.356
#> GSM71729 2 0.5216 0.721 0.000 0.740 0.260
#> GSM71730 2 0.5178 0.723 0.000 0.744 0.256
#> GSM71731 1 0.0237 0.868 0.996 0.000 0.004
#> GSM71732 1 0.0237 0.868 0.996 0.000 0.004
#> GSM71733 1 0.0424 0.870 0.992 0.000 0.008
#> GSM71734 1 0.4931 0.855 0.768 0.000 0.232
#> GSM71735 1 0.4931 0.855 0.768 0.000 0.232
#> GSM71736 1 0.4931 0.855 0.768 0.000 0.232
#> GSM71737 1 0.4931 0.855 0.768 0.000 0.232
#> GSM71738 1 0.4931 0.855 0.768 0.000 0.232
#> GSM71739 1 0.7123 0.292 0.604 0.364 0.032
#> GSM71740 1 0.0237 0.868 0.996 0.000 0.004
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> GSM71671 3 0.0000 0.9926 0.000 0.000 1.000 0.000
#> GSM71672 3 0.0000 0.9926 0.000 0.000 1.000 0.000
#> GSM71673 3 0.0000 0.9926 0.000 0.000 1.000 0.000
#> GSM71674 3 0.0000 0.9926 0.000 0.000 1.000 0.000
#> GSM71675 3 0.0000 0.9926 0.000 0.000 1.000 0.000
#> GSM71676 3 0.0000 0.9926 0.000 0.000 1.000 0.000
#> GSM71677 3 0.0000 0.9926 0.000 0.000 1.000 0.000
#> GSM71678 2 0.4697 0.6910 0.000 0.644 0.356 0.000
#> GSM71679 2 0.4697 0.6910 0.000 0.644 0.356 0.000
#> GSM71680 2 0.5389 0.4170 0.308 0.660 0.032 0.000
#> GSM71681 2 0.4679 0.6904 0.000 0.648 0.352 0.000
#> GSM71682 2 0.4697 0.6910 0.000 0.644 0.356 0.000
#> GSM71683 2 0.4697 0.6910 0.000 0.644 0.356 0.000
#> GSM71684 2 0.4134 0.6568 0.000 0.740 0.260 0.000
#> GSM71685 2 0.4277 0.6657 0.000 0.720 0.280 0.000
#> GSM71686 2 0.4697 0.6910 0.000 0.644 0.356 0.000
#> GSM71687 2 0.4697 0.6910 0.000 0.644 0.356 0.000
#> GSM71688 2 0.4697 0.6910 0.000 0.644 0.356 0.000
#> GSM71689 3 0.0817 0.9826 0.024 0.000 0.976 0.000
#> GSM71690 2 0.4697 0.6910 0.000 0.644 0.356 0.000
#> GSM71691 2 0.5007 0.6836 0.008 0.636 0.356 0.000
#> GSM71692 3 0.0817 0.9826 0.024 0.000 0.976 0.000
#> GSM71693 2 0.4697 0.6910 0.000 0.644 0.356 0.000
#> GSM71694 3 0.0817 0.9826 0.024 0.000 0.976 0.000
#> GSM71695 2 0.5007 0.6836 0.008 0.636 0.356 0.000
#> GSM71696 1 0.4855 0.7905 0.600 0.000 0.000 0.400
#> GSM71697 1 0.4916 0.7931 0.576 0.000 0.000 0.424
#> GSM71698 4 0.1724 0.9234 0.032 0.020 0.000 0.948
#> GSM71699 4 0.0469 0.9404 0.000 0.012 0.000 0.988
#> GSM71700 1 0.5105 0.7855 0.564 0.004 0.000 0.432
#> GSM71701 4 0.1724 0.9234 0.032 0.020 0.000 0.948
#> GSM71702 4 0.0469 0.9407 0.000 0.012 0.000 0.988
#> GSM71703 4 0.0469 0.9404 0.000 0.012 0.000 0.988
#> GSM71704 4 0.0336 0.9405 0.000 0.008 0.000 0.992
#> GSM71705 4 0.1970 0.9131 0.060 0.008 0.000 0.932
#> GSM71706 4 0.0524 0.9401 0.008 0.004 0.000 0.988
#> GSM71707 4 0.0927 0.9367 0.016 0.008 0.000 0.976
#> GSM71708 4 0.0524 0.9401 0.008 0.004 0.000 0.988
#> GSM71709 2 0.5389 0.4170 0.308 0.660 0.032 0.000
#> GSM71710 1 0.4933 0.7888 0.568 0.000 0.000 0.432
#> GSM71711 1 0.5105 0.7859 0.564 0.004 0.000 0.432
#> GSM71712 1 0.5228 0.0488 0.664 0.312 0.000 0.024
#> GSM71713 4 0.0937 0.9301 0.012 0.012 0.000 0.976
#> GSM71714 1 0.4925 0.7918 0.572 0.000 0.000 0.428
#> GSM71715 1 0.4916 0.7931 0.576 0.000 0.000 0.424
#> GSM71716 1 0.4925 0.7916 0.572 0.000 0.000 0.428
#> GSM71717 1 0.5132 0.7676 0.548 0.004 0.000 0.448
#> GSM71718 1 0.4990 0.7606 0.640 0.008 0.000 0.352
#> GSM71719 1 0.5055 0.7675 0.624 0.008 0.000 0.368
#> GSM71720 1 0.5007 0.7628 0.636 0.008 0.000 0.356
#> GSM71721 1 0.5070 0.7643 0.620 0.008 0.000 0.372
#> GSM71722 1 0.5172 0.7850 0.588 0.008 0.000 0.404
#> GSM71723 1 0.4925 0.7918 0.572 0.000 0.000 0.428
#> GSM71724 4 0.1510 0.9304 0.028 0.016 0.000 0.956
#> GSM71725 1 0.3523 0.4758 0.856 0.032 0.000 0.112
#> GSM71726 2 0.4992 0.2748 0.476 0.524 0.000 0.000
#> GSM71727 2 0.5337 0.4536 0.260 0.696 0.044 0.000
#> GSM71728 1 0.4998 -0.3234 0.512 0.488 0.000 0.000
#> GSM71729 2 0.5337 0.4536 0.260 0.696 0.044 0.000
#> GSM71730 2 0.5337 0.4536 0.260 0.696 0.044 0.000
#> GSM71731 1 0.4907 0.7946 0.580 0.000 0.000 0.420
#> GSM71732 1 0.5172 0.7850 0.588 0.008 0.000 0.404
#> GSM71733 1 0.4925 0.7918 0.572 0.000 0.000 0.428
#> GSM71734 4 0.1890 0.9182 0.056 0.008 0.000 0.936
#> GSM71735 4 0.2831 0.7774 0.120 0.004 0.000 0.876
#> GSM71736 4 0.0376 0.9408 0.004 0.004 0.000 0.992
#> GSM71737 4 0.3355 0.6818 0.160 0.004 0.000 0.836
#> GSM71738 4 0.0524 0.9401 0.008 0.004 0.000 0.988
#> GSM71739 1 0.8362 0.4850 0.548 0.168 0.084 0.200
#> GSM71740 1 0.4907 0.7946 0.580 0.000 0.000 0.420
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> GSM71671 3 0.0162 0.982 0.000 0.000 0.996 0.004 0.000
#> GSM71672 3 0.0000 0.983 0.000 0.000 1.000 0.000 0.000
#> GSM71673 3 0.0000 0.983 0.000 0.000 1.000 0.000 0.000
#> GSM71674 3 0.0162 0.982 0.000 0.000 0.996 0.004 0.000
#> GSM71675 3 0.0000 0.983 0.000 0.000 1.000 0.000 0.000
#> GSM71676 3 0.0162 0.982 0.000 0.000 0.996 0.004 0.000
#> GSM71677 3 0.0404 0.981 0.012 0.000 0.988 0.000 0.000
#> GSM71678 2 0.3430 0.967 0.004 0.776 0.220 0.000 0.000
#> GSM71679 2 0.3430 0.967 0.004 0.776 0.220 0.000 0.000
#> GSM71680 4 0.1270 0.926 0.000 0.052 0.000 0.948 0.000
#> GSM71681 2 0.3430 0.967 0.004 0.776 0.220 0.000 0.000
#> GSM71682 2 0.3430 0.967 0.004 0.776 0.220 0.000 0.000
#> GSM71683 2 0.3659 0.965 0.012 0.768 0.220 0.000 0.000
#> GSM71684 2 0.4155 0.889 0.000 0.780 0.144 0.076 0.000
#> GSM71685 2 0.4968 0.834 0.000 0.712 0.152 0.136 0.000
#> GSM71686 2 0.3430 0.967 0.004 0.776 0.220 0.000 0.000
#> GSM71687 2 0.3759 0.964 0.016 0.764 0.220 0.000 0.000
#> GSM71688 2 0.3430 0.966 0.004 0.776 0.220 0.000 0.000
#> GSM71689 3 0.1568 0.964 0.036 0.000 0.944 0.020 0.000
#> GSM71690 2 0.3430 0.967 0.004 0.776 0.220 0.000 0.000
#> GSM71691 2 0.4505 0.947 0.028 0.736 0.220 0.016 0.000
#> GSM71692 3 0.1469 0.966 0.036 0.000 0.948 0.016 0.000
#> GSM71693 2 0.3759 0.964 0.016 0.764 0.220 0.000 0.000
#> GSM71694 3 0.1568 0.964 0.036 0.000 0.944 0.020 0.000
#> GSM71695 2 0.4505 0.947 0.028 0.736 0.220 0.016 0.000
#> GSM71696 5 0.2158 0.904 0.020 0.052 0.000 0.008 0.920
#> GSM71697 5 0.0992 0.917 0.024 0.008 0.000 0.000 0.968
#> GSM71698 1 0.4921 0.876 0.728 0.092 0.000 0.008 0.172
#> GSM71699 1 0.3929 0.893 0.788 0.036 0.000 0.004 0.172
#> GSM71700 5 0.1372 0.912 0.024 0.016 0.000 0.004 0.956
#> GSM71701 1 0.4765 0.879 0.736 0.092 0.000 0.004 0.168
#> GSM71702 1 0.4184 0.894 0.772 0.048 0.000 0.004 0.176
#> GSM71703 1 0.3476 0.894 0.804 0.020 0.000 0.000 0.176
#> GSM71704 1 0.3602 0.895 0.796 0.024 0.000 0.000 0.180
#> GSM71705 1 0.5229 0.854 0.684 0.084 0.000 0.008 0.224
#> GSM71706 1 0.3492 0.894 0.796 0.016 0.000 0.000 0.188
#> GSM71707 1 0.4382 0.890 0.760 0.060 0.000 0.004 0.176
#> GSM71708 1 0.3492 0.894 0.796 0.016 0.000 0.000 0.188
#> GSM71709 4 0.1341 0.927 0.000 0.056 0.000 0.944 0.000
#> GSM71710 5 0.2321 0.897 0.056 0.024 0.000 0.008 0.912
#> GSM71711 5 0.1408 0.911 0.044 0.008 0.000 0.000 0.948
#> GSM71712 4 0.4928 0.811 0.092 0.080 0.000 0.768 0.060
#> GSM71713 1 0.4327 0.783 0.780 0.104 0.000 0.004 0.112
#> GSM71714 5 0.1630 0.911 0.036 0.016 0.000 0.004 0.944
#> GSM71715 5 0.2011 0.911 0.020 0.044 0.000 0.008 0.928
#> GSM71716 5 0.1597 0.913 0.020 0.024 0.000 0.008 0.948
#> GSM71717 5 0.2339 0.899 0.052 0.028 0.000 0.008 0.912
#> GSM71718 5 0.2321 0.893 0.024 0.044 0.000 0.016 0.916
#> GSM71719 5 0.1095 0.907 0.008 0.012 0.000 0.012 0.968
#> GSM71720 5 0.1524 0.905 0.016 0.016 0.000 0.016 0.952
#> GSM71721 5 0.2906 0.869 0.028 0.080 0.000 0.012 0.880
#> GSM71722 5 0.2664 0.882 0.040 0.064 0.000 0.004 0.892
#> GSM71723 5 0.1525 0.911 0.036 0.012 0.000 0.004 0.948
#> GSM71724 1 0.5218 0.855 0.668 0.068 0.000 0.008 0.256
#> GSM71725 5 0.5593 0.654 0.092 0.088 0.000 0.100 0.720
#> GSM71726 4 0.2452 0.911 0.052 0.028 0.000 0.908 0.012
#> GSM71727 4 0.2020 0.919 0.000 0.100 0.000 0.900 0.000
#> GSM71728 4 0.3076 0.895 0.072 0.028 0.000 0.876 0.024
#> GSM71729 4 0.2020 0.919 0.000 0.100 0.000 0.900 0.000
#> GSM71730 4 0.2020 0.919 0.000 0.100 0.000 0.900 0.000
#> GSM71731 5 0.0324 0.916 0.004 0.004 0.000 0.000 0.992
#> GSM71732 5 0.2141 0.889 0.016 0.064 0.000 0.004 0.916
#> GSM71733 5 0.1630 0.911 0.036 0.016 0.000 0.004 0.944
#> GSM71734 1 0.4767 0.876 0.724 0.072 0.000 0.004 0.200
#> GSM71735 1 0.4995 0.652 0.584 0.028 0.000 0.004 0.384
#> GSM71736 1 0.3419 0.896 0.804 0.016 0.000 0.000 0.180
#> GSM71737 1 0.5330 0.532 0.532 0.036 0.000 0.008 0.424
#> GSM71738 1 0.3527 0.894 0.792 0.016 0.000 0.000 0.192
#> GSM71739 5 0.4866 0.695 0.016 0.184 0.032 0.020 0.748
#> GSM71740 5 0.0992 0.916 0.024 0.008 0.000 0.000 0.968
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> GSM71671 3 0.1753 0.949 0.000 0.084 0.912 0.000 0.004 0.000
#> GSM71672 3 0.1610 0.949 0.000 0.084 0.916 0.000 0.000 0.000
#> GSM71673 3 0.1753 0.948 0.000 0.084 0.912 0.000 0.000 0.004
#> GSM71674 3 0.1753 0.949 0.000 0.084 0.912 0.000 0.004 0.000
#> GSM71675 3 0.1753 0.948 0.000 0.084 0.912 0.000 0.000 0.004
#> GSM71676 3 0.1753 0.949 0.000 0.084 0.912 0.000 0.004 0.000
#> GSM71677 3 0.2485 0.943 0.000 0.084 0.884 0.000 0.008 0.024
#> GSM71678 2 0.0717 0.938 0.000 0.976 0.000 0.000 0.008 0.016
#> GSM71679 2 0.0717 0.938 0.000 0.976 0.000 0.000 0.008 0.016
#> GSM71680 4 0.0458 0.853 0.000 0.016 0.000 0.984 0.000 0.000
#> GSM71681 2 0.1448 0.926 0.000 0.948 0.000 0.024 0.016 0.012
#> GSM71682 2 0.0717 0.938 0.000 0.976 0.000 0.000 0.008 0.016
#> GSM71683 2 0.0603 0.935 0.000 0.980 0.000 0.000 0.016 0.004
#> GSM71684 2 0.1075 0.905 0.000 0.952 0.000 0.048 0.000 0.000
#> GSM71685 2 0.3827 0.553 0.000 0.680 0.000 0.308 0.008 0.004
#> GSM71686 2 0.0717 0.938 0.000 0.976 0.000 0.000 0.008 0.016
#> GSM71687 2 0.0363 0.936 0.000 0.988 0.000 0.000 0.012 0.000
#> GSM71688 2 0.0000 0.937 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM71689 3 0.4718 0.888 0.000 0.084 0.752 0.004 0.096 0.064
#> GSM71690 2 0.0717 0.938 0.000 0.976 0.000 0.000 0.008 0.016
#> GSM71691 2 0.2547 0.868 0.000 0.868 0.000 0.004 0.112 0.016
#> GSM71692 3 0.4672 0.891 0.000 0.084 0.756 0.004 0.092 0.064
#> GSM71693 2 0.0692 0.934 0.000 0.976 0.000 0.000 0.020 0.004
#> GSM71694 3 0.4825 0.884 0.000 0.084 0.744 0.004 0.096 0.072
#> GSM71695 2 0.2547 0.868 0.000 0.868 0.000 0.004 0.112 0.016
#> GSM71696 1 0.3844 0.781 0.792 0.000 0.040 0.000 0.140 0.028
#> GSM71697 1 0.0653 0.857 0.980 0.000 0.004 0.000 0.012 0.004
#> GSM71698 6 0.5350 0.754 0.128 0.000 0.016 0.000 0.228 0.628
#> GSM71699 6 0.3907 0.807 0.152 0.000 0.016 0.000 0.052 0.780
#> GSM71700 1 0.1262 0.856 0.956 0.000 0.008 0.000 0.016 0.020
#> GSM71701 6 0.5303 0.758 0.128 0.000 0.016 0.000 0.220 0.636
#> GSM71702 6 0.4667 0.805 0.164 0.000 0.020 0.000 0.096 0.720
#> GSM71703 6 0.3427 0.813 0.156 0.000 0.008 0.000 0.032 0.804
#> GSM71704 6 0.2768 0.816 0.156 0.000 0.000 0.000 0.012 0.832
#> GSM71705 6 0.5987 0.687 0.264 0.000 0.020 0.000 0.180 0.536
#> GSM71706 6 0.2668 0.818 0.168 0.000 0.000 0.000 0.004 0.828
#> GSM71707 6 0.4777 0.785 0.140 0.000 0.008 0.000 0.156 0.696
#> GSM71708 6 0.2668 0.818 0.168 0.000 0.000 0.000 0.004 0.828
#> GSM71709 4 0.0458 0.853 0.000 0.016 0.000 0.984 0.000 0.000
#> GSM71710 1 0.2701 0.820 0.884 0.000 0.028 0.000 0.044 0.044
#> GSM71711 1 0.1332 0.852 0.952 0.000 0.012 0.000 0.008 0.028
#> GSM71712 5 0.4444 -0.309 0.004 0.000 0.012 0.484 0.496 0.004
#> GSM71713 6 0.5408 0.461 0.088 0.000 0.012 0.000 0.364 0.536
#> GSM71714 1 0.1630 0.850 0.940 0.000 0.016 0.000 0.024 0.020
#> GSM71715 1 0.3113 0.803 0.856 0.000 0.040 0.000 0.076 0.028
#> GSM71716 1 0.2528 0.820 0.892 0.000 0.028 0.000 0.056 0.024
#> GSM71717 1 0.2906 0.815 0.872 0.000 0.032 0.000 0.052 0.044
#> GSM71718 1 0.3587 0.762 0.796 0.000 0.004 0.012 0.164 0.024
#> GSM71719 1 0.1370 0.843 0.948 0.000 0.004 0.012 0.036 0.000
#> GSM71720 1 0.2367 0.827 0.900 0.000 0.004 0.012 0.064 0.020
#> GSM71721 1 0.4446 0.670 0.708 0.000 0.012 0.008 0.236 0.036
#> GSM71722 1 0.4137 0.715 0.732 0.000 0.012 0.000 0.216 0.040
#> GSM71723 1 0.1346 0.853 0.952 0.000 0.008 0.000 0.024 0.016
#> GSM71724 6 0.5857 0.743 0.264 0.000 0.020 0.000 0.160 0.556
#> GSM71725 5 0.5457 0.238 0.364 0.000 0.012 0.080 0.540 0.004
#> GSM71726 4 0.3056 0.660 0.000 0.004 0.008 0.804 0.184 0.000
#> GSM71727 4 0.1141 0.854 0.000 0.052 0.000 0.948 0.000 0.000
#> GSM71728 4 0.3437 0.570 0.000 0.004 0.008 0.752 0.236 0.000
#> GSM71729 4 0.1285 0.854 0.000 0.052 0.000 0.944 0.000 0.004
#> GSM71730 4 0.1204 0.850 0.000 0.056 0.000 0.944 0.000 0.000
#> GSM71731 1 0.0547 0.856 0.980 0.000 0.000 0.000 0.020 0.000
#> GSM71732 1 0.3518 0.749 0.784 0.000 0.008 0.000 0.184 0.024
#> GSM71733 1 0.1536 0.851 0.944 0.000 0.012 0.000 0.024 0.020
#> GSM71734 6 0.5218 0.763 0.188 0.000 0.008 0.000 0.164 0.640
#> GSM71735 6 0.4610 0.609 0.384 0.000 0.012 0.000 0.024 0.580
#> GSM71736 6 0.2743 0.819 0.164 0.000 0.000 0.000 0.008 0.828
#> GSM71737 6 0.5466 0.511 0.388 0.000 0.036 0.000 0.052 0.524
#> GSM71738 6 0.2989 0.815 0.176 0.000 0.004 0.000 0.008 0.812
#> GSM71739 1 0.5752 0.556 0.672 0.160 0.040 0.012 0.104 0.012
#> GSM71740 1 0.0405 0.857 0.988 0.000 0.008 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) k
#> MAD:kmeans 68 2.85e-12 2
#> MAD:kmeans 67 4.49e-12 3
#> MAD:kmeans 60 3.37e-18 4
#> MAD:kmeans 70 2.44e-19 5
#> MAD:kmeans 67 2.08e-18 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 21168 rows and 70 columns.
#> Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'MAD' method.
#> Subgroups are detected by 'skmeans' method.
#> Performed in total 1250 partitions by row resampling.
#> Best k for subgroups seems to be 3.
#>
#> Following methods can be applied to this 'ConsensusPartition' object:
#> [1] "cola_report" "collect_classes" "collect_plots"
#> [4] "collect_stats" "colnames" "compare_signatures"
#> [7] "consensus_heatmap" "dimension_reduction" "functional_enrichment"
#> [10] "get_anno_col" "get_anno" "get_classes"
#> [13] "get_consensus" "get_matrix" "get_membership"
#> [16] "get_param" "get_signatures" "get_stats"
#> [19] "is_best_k" "is_stable_k" "membership_heatmap"
#> [22] "ncol" "nrow" "plot_ecdf"
#> [25] "rownames" "select_partition_number" "show"
#> [28] "suggest_best_k" "test_to_known_factors"
collect_plots()
function collects all the plots made from res
for all k
(number of partitions)
into one single page to provide an easy and fast comparison between different k
.
collect_plots(res)
The plots are:
k
and the heatmap of
predicted classes for each k
.k
.k
.k
.All the plots in panels can be made by individual functions and they are plotted later in this section.
select_partition_number()
produces several plots showing different
statistics for choosing “optimized” k
. There are following statistics:
k
;k
, the area increased is defined as \(A_k - A_{k-1}\).The detailed explanations of these statistics can be found in the cola vignette.
Generally speaking, lower PAC score, higher mean silhouette score or higher
concordance corresponds to better partition. Rand index and Jaccard index
measure how similar the current partition is compared to partition with k-1
.
If they are too similar, we won't accept k
is better than k-1
.
select_partition_number(res)
The numeric values for all these statistics can be obtained by get_stats()
.
get_stats(res)
#> k 1-PAC mean_silhouette concordance area_increased Rand Jaccard
#> 2 2 1.000 0.988 0.995 0.5029 0.496 0.496
#> 3 3 0.919 0.960 0.967 0.2063 0.877 0.756
#> 4 4 0.801 0.886 0.909 0.1139 0.920 0.801
#> 5 5 0.697 0.723 0.831 0.1388 0.866 0.604
#> 6 6 0.662 0.663 0.791 0.0518 0.969 0.856
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
#> GSM71671 2 0.0000 0.988 0.000 1.000
#> GSM71672 2 0.0000 0.988 0.000 1.000
#> GSM71673 2 0.0000 0.988 0.000 1.000
#> GSM71674 2 0.0000 0.988 0.000 1.000
#> GSM71675 2 0.0000 0.988 0.000 1.000
#> GSM71676 2 0.0000 0.988 0.000 1.000
#> GSM71677 2 0.0000 0.988 0.000 1.000
#> GSM71678 2 0.0000 0.988 0.000 1.000
#> GSM71679 2 0.0000 0.988 0.000 1.000
#> GSM71680 2 0.0000 0.988 0.000 1.000
#> GSM71681 2 0.0000 0.988 0.000 1.000
#> GSM71682 2 0.0000 0.988 0.000 1.000
#> GSM71683 2 0.0000 0.988 0.000 1.000
#> GSM71684 2 0.0000 0.988 0.000 1.000
#> GSM71685 2 0.0000 0.988 0.000 1.000
#> GSM71686 2 0.0000 0.988 0.000 1.000
#> GSM71687 2 0.0000 0.988 0.000 1.000
#> GSM71688 2 0.0000 0.988 0.000 1.000
#> GSM71689 2 0.0000 0.988 0.000 1.000
#> GSM71690 2 0.0000 0.988 0.000 1.000
#> GSM71691 2 0.0000 0.988 0.000 1.000
#> GSM71692 2 0.0000 0.988 0.000 1.000
#> GSM71693 2 0.0000 0.988 0.000 1.000
#> GSM71694 2 0.0000 0.988 0.000 1.000
#> GSM71695 2 0.0000 0.988 0.000 1.000
#> GSM71696 1 0.0000 1.000 1.000 0.000
#> GSM71697 1 0.0000 1.000 1.000 0.000
#> GSM71698 1 0.0000 1.000 1.000 0.000
#> GSM71699 1 0.0000 1.000 1.000 0.000
#> GSM71700 1 0.0000 1.000 1.000 0.000
#> GSM71701 1 0.0000 1.000 1.000 0.000
#> GSM71702 1 0.0000 1.000 1.000 0.000
#> GSM71703 1 0.0000 1.000 1.000 0.000
#> GSM71704 1 0.0000 1.000 1.000 0.000
#> GSM71705 1 0.0000 1.000 1.000 0.000
#> GSM71706 1 0.0000 1.000 1.000 0.000
#> GSM71707 1 0.0000 1.000 1.000 0.000
#> GSM71708 1 0.0000 1.000 1.000 0.000
#> GSM71709 2 0.0000 0.988 0.000 1.000
#> GSM71710 1 0.0000 1.000 1.000 0.000
#> GSM71711 1 0.0000 1.000 1.000 0.000
#> GSM71712 1 0.0000 1.000 1.000 0.000
#> GSM71713 1 0.0000 1.000 1.000 0.000
#> GSM71714 1 0.0000 1.000 1.000 0.000
#> GSM71715 1 0.0000 1.000 1.000 0.000
#> GSM71716 1 0.0000 1.000 1.000 0.000
#> GSM71717 1 0.0000 1.000 1.000 0.000
#> GSM71718 1 0.0000 1.000 1.000 0.000
#> GSM71719 1 0.0000 1.000 1.000 0.000
#> GSM71720 1 0.0000 1.000 1.000 0.000
#> GSM71721 1 0.0000 1.000 1.000 0.000
#> GSM71722 1 0.0000 1.000 1.000 0.000
#> GSM71723 1 0.0000 1.000 1.000 0.000
#> GSM71724 1 0.0000 1.000 1.000 0.000
#> GSM71725 1 0.0000 1.000 1.000 0.000
#> GSM71726 2 0.0672 0.981 0.008 0.992
#> GSM71727 2 0.0000 0.988 0.000 1.000
#> GSM71728 2 0.3879 0.913 0.076 0.924
#> GSM71729 2 0.0000 0.988 0.000 1.000
#> GSM71730 2 0.0000 0.988 0.000 1.000
#> GSM71731 1 0.0000 1.000 1.000 0.000
#> GSM71732 1 0.0000 1.000 1.000 0.000
#> GSM71733 1 0.0000 1.000 1.000 0.000
#> GSM71734 1 0.0000 1.000 1.000 0.000
#> GSM71735 1 0.0000 1.000 1.000 0.000
#> GSM71736 1 0.0000 1.000 1.000 0.000
#> GSM71737 1 0.0000 1.000 1.000 0.000
#> GSM71738 1 0.0000 1.000 1.000 0.000
#> GSM71739 2 0.8661 0.598 0.288 0.712
#> GSM71740 1 0.0000 1.000 1.000 0.000
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> GSM71671 3 0.0237 0.998 0.000 0.004 0.996
#> GSM71672 3 0.0237 0.998 0.000 0.004 0.996
#> GSM71673 3 0.0237 0.998 0.000 0.004 0.996
#> GSM71674 3 0.0237 0.998 0.000 0.004 0.996
#> GSM71675 3 0.0237 0.998 0.000 0.004 0.996
#> GSM71676 3 0.0237 0.998 0.000 0.004 0.996
#> GSM71677 3 0.0237 0.998 0.000 0.004 0.996
#> GSM71678 2 0.3038 0.940 0.000 0.896 0.104
#> GSM71679 2 0.3038 0.940 0.000 0.896 0.104
#> GSM71680 2 0.0000 0.894 0.000 1.000 0.000
#> GSM71681 2 0.3038 0.940 0.000 0.896 0.104
#> GSM71682 2 0.3038 0.940 0.000 0.896 0.104
#> GSM71683 2 0.3038 0.940 0.000 0.896 0.104
#> GSM71684 2 0.3038 0.940 0.000 0.896 0.104
#> GSM71685 2 0.3038 0.940 0.000 0.896 0.104
#> GSM71686 2 0.3038 0.940 0.000 0.896 0.104
#> GSM71687 2 0.3038 0.940 0.000 0.896 0.104
#> GSM71688 2 0.3038 0.940 0.000 0.896 0.104
#> GSM71689 3 0.0237 0.998 0.000 0.004 0.996
#> GSM71690 2 0.3038 0.940 0.000 0.896 0.104
#> GSM71691 3 0.0747 0.987 0.000 0.016 0.984
#> GSM71692 3 0.0237 0.998 0.000 0.004 0.996
#> GSM71693 2 0.3038 0.940 0.000 0.896 0.104
#> GSM71694 3 0.0237 0.998 0.000 0.004 0.996
#> GSM71695 3 0.0424 0.995 0.000 0.008 0.992
#> GSM71696 1 0.0237 0.989 0.996 0.000 0.004
#> GSM71697 1 0.0237 0.989 0.996 0.000 0.004
#> GSM71698 1 0.0000 0.990 1.000 0.000 0.000
#> GSM71699 1 0.0000 0.990 1.000 0.000 0.000
#> GSM71700 1 0.0237 0.989 0.996 0.000 0.004
#> GSM71701 1 0.0000 0.990 1.000 0.000 0.000
#> GSM71702 1 0.0000 0.990 1.000 0.000 0.000
#> GSM71703 1 0.0000 0.990 1.000 0.000 0.000
#> GSM71704 1 0.0000 0.990 1.000 0.000 0.000
#> GSM71705 1 0.0000 0.990 1.000 0.000 0.000
#> GSM71706 1 0.0000 0.990 1.000 0.000 0.000
#> GSM71707 1 0.0000 0.990 1.000 0.000 0.000
#> GSM71708 1 0.0000 0.990 1.000 0.000 0.000
#> GSM71709 2 0.0892 0.908 0.000 0.980 0.020
#> GSM71710 1 0.0237 0.989 0.996 0.000 0.004
#> GSM71711 1 0.0237 0.989 0.996 0.000 0.004
#> GSM71712 2 0.5882 0.403 0.348 0.652 0.000
#> GSM71713 1 0.0237 0.988 0.996 0.004 0.000
#> GSM71714 1 0.0000 0.990 1.000 0.000 0.000
#> GSM71715 1 0.0237 0.989 0.996 0.000 0.004
#> GSM71716 1 0.0237 0.989 0.996 0.000 0.004
#> GSM71717 1 0.0237 0.989 0.996 0.000 0.004
#> GSM71718 1 0.0237 0.989 0.996 0.000 0.004
#> GSM71719 1 0.0237 0.989 0.996 0.000 0.004
#> GSM71720 1 0.0237 0.989 0.996 0.000 0.004
#> GSM71721 1 0.0000 0.990 1.000 0.000 0.000
#> GSM71722 1 0.0000 0.990 1.000 0.000 0.000
#> GSM71723 1 0.0000 0.990 1.000 0.000 0.000
#> GSM71724 1 0.0000 0.990 1.000 0.000 0.000
#> GSM71725 1 0.5754 0.602 0.700 0.296 0.004
#> GSM71726 2 0.0000 0.894 0.000 1.000 0.000
#> GSM71727 2 0.1753 0.924 0.000 0.952 0.048
#> GSM71728 2 0.0000 0.894 0.000 1.000 0.000
#> GSM71729 2 0.1753 0.924 0.000 0.952 0.048
#> GSM71730 2 0.1964 0.927 0.000 0.944 0.056
#> GSM71731 1 0.0237 0.989 0.996 0.000 0.004
#> GSM71732 1 0.0237 0.989 0.996 0.000 0.004
#> GSM71733 1 0.0000 0.990 1.000 0.000 0.000
#> GSM71734 1 0.0000 0.990 1.000 0.000 0.000
#> GSM71735 1 0.0000 0.990 1.000 0.000 0.000
#> GSM71736 1 0.0000 0.990 1.000 0.000 0.000
#> GSM71737 1 0.0000 0.990 1.000 0.000 0.000
#> GSM71738 1 0.0000 0.990 1.000 0.000 0.000
#> GSM71739 2 0.3213 0.934 0.008 0.900 0.092
#> GSM71740 1 0.0237 0.989 0.996 0.000 0.004
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> GSM71671 3 0.0921 1.000 0.000 0.028 0.972 0.000
#> GSM71672 3 0.0921 1.000 0.000 0.028 0.972 0.000
#> GSM71673 3 0.0921 1.000 0.000 0.028 0.972 0.000
#> GSM71674 3 0.0921 1.000 0.000 0.028 0.972 0.000
#> GSM71675 3 0.0921 1.000 0.000 0.028 0.972 0.000
#> GSM71676 3 0.0921 1.000 0.000 0.028 0.972 0.000
#> GSM71677 3 0.0921 1.000 0.000 0.028 0.972 0.000
#> GSM71678 2 0.0000 0.912 0.000 1.000 0.000 0.000
#> GSM71679 2 0.0000 0.912 0.000 1.000 0.000 0.000
#> GSM71680 4 0.3837 0.765 0.000 0.224 0.000 0.776
#> GSM71681 2 0.0000 0.912 0.000 1.000 0.000 0.000
#> GSM71682 2 0.0000 0.912 0.000 1.000 0.000 0.000
#> GSM71683 2 0.0000 0.912 0.000 1.000 0.000 0.000
#> GSM71684 2 0.0000 0.912 0.000 1.000 0.000 0.000
#> GSM71685 2 0.0000 0.912 0.000 1.000 0.000 0.000
#> GSM71686 2 0.0000 0.912 0.000 1.000 0.000 0.000
#> GSM71687 2 0.0000 0.912 0.000 1.000 0.000 0.000
#> GSM71688 2 0.0000 0.912 0.000 1.000 0.000 0.000
#> GSM71689 3 0.0921 1.000 0.000 0.028 0.972 0.000
#> GSM71690 2 0.0000 0.912 0.000 1.000 0.000 0.000
#> GSM71691 2 0.4331 0.550 0.000 0.712 0.288 0.000
#> GSM71692 3 0.0921 1.000 0.000 0.028 0.972 0.000
#> GSM71693 2 0.0000 0.912 0.000 1.000 0.000 0.000
#> GSM71694 3 0.0921 1.000 0.000 0.028 0.972 0.000
#> GSM71695 2 0.4776 0.386 0.000 0.624 0.376 0.000
#> GSM71696 1 0.2610 0.920 0.900 0.000 0.012 0.088
#> GSM71697 1 0.2401 0.919 0.904 0.000 0.004 0.092
#> GSM71698 1 0.2222 0.922 0.924 0.000 0.016 0.060
#> GSM71699 1 0.2060 0.924 0.932 0.000 0.016 0.052
#> GSM71700 1 0.1743 0.933 0.940 0.000 0.004 0.056
#> GSM71701 1 0.2142 0.923 0.928 0.000 0.016 0.056
#> GSM71702 1 0.2060 0.924 0.932 0.000 0.016 0.052
#> GSM71703 1 0.2060 0.924 0.932 0.000 0.016 0.052
#> GSM71704 1 0.2060 0.924 0.932 0.000 0.016 0.052
#> GSM71705 1 0.1677 0.928 0.948 0.000 0.012 0.040
#> GSM71706 1 0.2060 0.924 0.932 0.000 0.016 0.052
#> GSM71707 1 0.2060 0.924 0.932 0.000 0.016 0.052
#> GSM71708 1 0.2060 0.924 0.932 0.000 0.016 0.052
#> GSM71709 4 0.4713 0.709 0.000 0.360 0.000 0.640
#> GSM71710 1 0.1978 0.926 0.928 0.000 0.004 0.068
#> GSM71711 1 0.2179 0.930 0.924 0.000 0.012 0.064
#> GSM71712 4 0.2596 0.721 0.024 0.068 0.000 0.908
#> GSM71713 1 0.3108 0.890 0.872 0.000 0.016 0.112
#> GSM71714 1 0.1824 0.929 0.936 0.000 0.004 0.060
#> GSM71715 1 0.2676 0.915 0.896 0.000 0.012 0.092
#> GSM71716 1 0.2805 0.911 0.888 0.000 0.012 0.100
#> GSM71717 1 0.2255 0.926 0.920 0.000 0.012 0.068
#> GSM71718 1 0.3271 0.894 0.856 0.000 0.012 0.132
#> GSM71719 1 0.3324 0.891 0.852 0.000 0.012 0.136
#> GSM71720 1 0.3324 0.891 0.852 0.000 0.012 0.136
#> GSM71721 1 0.2859 0.918 0.880 0.000 0.008 0.112
#> GSM71722 1 0.1474 0.932 0.948 0.000 0.000 0.052
#> GSM71723 1 0.1902 0.928 0.932 0.000 0.004 0.064
#> GSM71724 1 0.1854 0.928 0.940 0.000 0.012 0.048
#> GSM71725 4 0.2040 0.656 0.048 0.012 0.004 0.936
#> GSM71726 4 0.3074 0.767 0.000 0.152 0.000 0.848
#> GSM71727 4 0.4955 0.629 0.000 0.444 0.000 0.556
#> GSM71728 4 0.3024 0.766 0.000 0.148 0.000 0.852
#> GSM71729 4 0.4985 0.593 0.000 0.468 0.000 0.532
#> GSM71730 4 0.4989 0.585 0.000 0.472 0.000 0.528
#> GSM71731 1 0.2928 0.907 0.880 0.000 0.012 0.108
#> GSM71732 1 0.2805 0.920 0.888 0.000 0.012 0.100
#> GSM71733 1 0.0707 0.933 0.980 0.000 0.000 0.020
#> GSM71734 1 0.1767 0.927 0.944 0.000 0.012 0.044
#> GSM71735 1 0.1042 0.932 0.972 0.000 0.008 0.020
#> GSM71736 1 0.2060 0.924 0.932 0.000 0.016 0.052
#> GSM71737 1 0.1042 0.933 0.972 0.000 0.008 0.020
#> GSM71738 1 0.1767 0.927 0.944 0.000 0.012 0.044
#> GSM71739 2 0.3072 0.774 0.024 0.892 0.008 0.076
#> GSM71740 1 0.2741 0.914 0.892 0.000 0.012 0.096
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> GSM71671 3 0.0000 0.999 0.000 0.000 1.000 0.000 0.000
#> GSM71672 3 0.0000 0.999 0.000 0.000 1.000 0.000 0.000
#> GSM71673 3 0.0000 0.999 0.000 0.000 1.000 0.000 0.000
#> GSM71674 3 0.0000 0.999 0.000 0.000 1.000 0.000 0.000
#> GSM71675 3 0.0000 0.999 0.000 0.000 1.000 0.000 0.000
#> GSM71676 3 0.0000 0.999 0.000 0.000 1.000 0.000 0.000
#> GSM71677 3 0.0000 0.999 0.000 0.000 1.000 0.000 0.000
#> GSM71678 2 0.0000 0.908 0.000 1.000 0.000 0.000 0.000
#> GSM71679 2 0.0000 0.908 0.000 1.000 0.000 0.000 0.000
#> GSM71680 4 0.3558 0.750 0.000 0.108 0.000 0.828 0.064
#> GSM71681 2 0.0566 0.898 0.000 0.984 0.000 0.004 0.012
#> GSM71682 2 0.0000 0.908 0.000 1.000 0.000 0.000 0.000
#> GSM71683 2 0.0000 0.908 0.000 1.000 0.000 0.000 0.000
#> GSM71684 2 0.0404 0.900 0.000 0.988 0.000 0.012 0.000
#> GSM71685 2 0.2221 0.826 0.000 0.912 0.000 0.052 0.036
#> GSM71686 2 0.0000 0.908 0.000 1.000 0.000 0.000 0.000
#> GSM71687 2 0.0000 0.908 0.000 1.000 0.000 0.000 0.000
#> GSM71688 2 0.0000 0.908 0.000 1.000 0.000 0.000 0.000
#> GSM71689 3 0.0162 0.997 0.000 0.000 0.996 0.004 0.000
#> GSM71690 2 0.0000 0.908 0.000 1.000 0.000 0.000 0.000
#> GSM71691 2 0.3430 0.662 0.000 0.776 0.220 0.004 0.000
#> GSM71692 3 0.0162 0.997 0.000 0.000 0.996 0.004 0.000
#> GSM71693 2 0.0162 0.905 0.000 0.996 0.000 0.004 0.000
#> GSM71694 3 0.0162 0.997 0.000 0.000 0.996 0.004 0.000
#> GSM71695 2 0.4101 0.505 0.000 0.664 0.332 0.004 0.000
#> GSM71696 5 0.4288 0.680 0.324 0.000 0.000 0.012 0.664
#> GSM71697 5 0.4380 0.686 0.376 0.000 0.000 0.008 0.616
#> GSM71698 1 0.2848 0.671 0.840 0.000 0.000 0.004 0.156
#> GSM71699 1 0.0671 0.771 0.980 0.000 0.000 0.004 0.016
#> GSM71700 1 0.4273 -0.316 0.552 0.000 0.000 0.000 0.448
#> GSM71701 1 0.2068 0.732 0.904 0.000 0.000 0.004 0.092
#> GSM71702 1 0.0703 0.777 0.976 0.000 0.000 0.000 0.024
#> GSM71703 1 0.0510 0.773 0.984 0.000 0.000 0.000 0.016
#> GSM71704 1 0.1121 0.772 0.956 0.000 0.000 0.000 0.044
#> GSM71705 1 0.2773 0.738 0.836 0.000 0.000 0.000 0.164
#> GSM71706 1 0.1671 0.757 0.924 0.000 0.000 0.000 0.076
#> GSM71707 1 0.2280 0.753 0.880 0.000 0.000 0.000 0.120
#> GSM71708 1 0.1608 0.762 0.928 0.000 0.000 0.000 0.072
#> GSM71709 4 0.4707 0.709 0.000 0.228 0.000 0.708 0.064
#> GSM71710 5 0.4632 0.604 0.448 0.000 0.000 0.012 0.540
#> GSM71711 5 0.4283 0.589 0.456 0.000 0.000 0.000 0.544
#> GSM71712 4 0.2208 0.729 0.012 0.012 0.000 0.916 0.060
#> GSM71713 1 0.2863 0.679 0.876 0.000 0.000 0.060 0.064
#> GSM71714 5 0.4397 0.606 0.432 0.000 0.000 0.004 0.564
#> GSM71715 5 0.4465 0.714 0.304 0.000 0.000 0.024 0.672
#> GSM71716 5 0.4138 0.729 0.276 0.000 0.000 0.016 0.708
#> GSM71717 5 0.4455 0.666 0.404 0.000 0.000 0.008 0.588
#> GSM71718 5 0.3011 0.682 0.140 0.000 0.000 0.016 0.844
#> GSM71719 5 0.3476 0.717 0.176 0.000 0.000 0.020 0.804
#> GSM71720 5 0.3098 0.701 0.148 0.000 0.000 0.016 0.836
#> GSM71721 5 0.4637 0.311 0.452 0.000 0.000 0.012 0.536
#> GSM71722 5 0.4497 0.395 0.424 0.000 0.000 0.008 0.568
#> GSM71723 5 0.4249 0.598 0.432 0.000 0.000 0.000 0.568
#> GSM71724 1 0.2338 0.738 0.884 0.000 0.000 0.004 0.112
#> GSM71725 4 0.3967 0.560 0.012 0.000 0.000 0.724 0.264
#> GSM71726 4 0.1168 0.750 0.000 0.032 0.000 0.960 0.008
#> GSM71727 4 0.5274 0.621 0.000 0.336 0.000 0.600 0.064
#> GSM71728 4 0.1836 0.746 0.000 0.032 0.000 0.932 0.036
#> GSM71729 4 0.5432 0.542 0.000 0.392 0.000 0.544 0.064
#> GSM71730 4 0.5447 0.526 0.000 0.400 0.000 0.536 0.064
#> GSM71731 5 0.3551 0.733 0.220 0.000 0.000 0.008 0.772
#> GSM71732 5 0.3756 0.679 0.248 0.000 0.000 0.008 0.744
#> GSM71733 1 0.4287 -0.348 0.540 0.000 0.000 0.000 0.460
#> GSM71734 1 0.2732 0.728 0.840 0.000 0.000 0.000 0.160
#> GSM71735 1 0.3452 0.474 0.756 0.000 0.000 0.000 0.244
#> GSM71736 1 0.1357 0.778 0.948 0.000 0.000 0.004 0.048
#> GSM71737 1 0.3661 0.387 0.724 0.000 0.000 0.000 0.276
#> GSM71738 1 0.1965 0.740 0.904 0.000 0.000 0.000 0.096
#> GSM71739 2 0.4525 0.574 0.000 0.724 0.000 0.056 0.220
#> GSM71740 5 0.3969 0.736 0.304 0.000 0.000 0.004 0.692
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> GSM71671 3 0.0000 1.0000 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM71672 3 0.0000 1.0000 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM71673 3 0.0000 1.0000 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM71674 3 0.0000 1.0000 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM71675 3 0.0000 1.0000 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM71676 3 0.0000 1.0000 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM71677 3 0.0000 1.0000 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM71678 2 0.0000 0.8931 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM71679 2 0.0000 0.8931 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM71680 4 0.1349 0.5747 0.000 0.056 0.000 0.940 0.004 0.000
#> GSM71681 2 0.1204 0.8629 0.000 0.944 0.000 0.056 0.000 0.000
#> GSM71682 2 0.0000 0.8931 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM71683 2 0.0291 0.8923 0.000 0.992 0.000 0.004 0.004 0.000
#> GSM71684 2 0.1349 0.8619 0.000 0.940 0.000 0.056 0.004 0.000
#> GSM71685 2 0.2969 0.6717 0.000 0.776 0.000 0.224 0.000 0.000
#> GSM71686 2 0.0000 0.8931 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM71687 2 0.0458 0.8880 0.000 0.984 0.000 0.000 0.016 0.000
#> GSM71688 2 0.0146 0.8921 0.000 0.996 0.000 0.004 0.000 0.000
#> GSM71689 3 0.0000 1.0000 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM71690 2 0.0000 0.8931 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM71691 2 0.2790 0.7648 0.000 0.840 0.140 0.000 0.020 0.000
#> GSM71692 3 0.0000 1.0000 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM71693 2 0.0146 0.8921 0.000 0.996 0.000 0.000 0.004 0.000
#> GSM71694 3 0.0000 1.0000 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM71695 2 0.3978 0.5933 0.000 0.700 0.268 0.000 0.032 0.000
#> GSM71696 1 0.5504 0.5609 0.560 0.000 0.000 0.000 0.252 0.188
#> GSM71697 1 0.4037 0.6588 0.736 0.000 0.000 0.000 0.064 0.200
#> GSM71698 6 0.4054 0.6203 0.072 0.000 0.000 0.000 0.188 0.740
#> GSM71699 6 0.1890 0.7477 0.024 0.000 0.000 0.000 0.060 0.916
#> GSM71700 1 0.5146 0.3266 0.516 0.000 0.000 0.000 0.088 0.396
#> GSM71701 6 0.3134 0.6819 0.036 0.000 0.000 0.000 0.144 0.820
#> GSM71702 6 0.2962 0.7506 0.068 0.000 0.000 0.000 0.084 0.848
#> GSM71703 6 0.1829 0.7558 0.056 0.000 0.000 0.000 0.024 0.920
#> GSM71704 6 0.2006 0.7538 0.080 0.000 0.000 0.000 0.016 0.904
#> GSM71705 6 0.3869 0.6892 0.128 0.000 0.000 0.000 0.100 0.772
#> GSM71706 6 0.2558 0.7432 0.104 0.000 0.000 0.000 0.028 0.868
#> GSM71707 6 0.3032 0.7276 0.056 0.000 0.000 0.000 0.104 0.840
#> GSM71708 6 0.2445 0.7420 0.108 0.000 0.000 0.000 0.020 0.872
#> GSM71709 4 0.2092 0.6231 0.000 0.124 0.000 0.876 0.000 0.000
#> GSM71710 1 0.5009 0.5903 0.624 0.000 0.000 0.000 0.120 0.256
#> GSM71711 1 0.4438 0.5482 0.628 0.000 0.000 0.000 0.044 0.328
#> GSM71712 4 0.4312 -0.2788 0.012 0.000 0.000 0.584 0.396 0.008
#> GSM71713 6 0.4027 0.6256 0.024 0.000 0.000 0.020 0.216 0.740
#> GSM71714 1 0.4750 0.5993 0.656 0.000 0.000 0.000 0.100 0.244
#> GSM71715 1 0.4573 0.5292 0.676 0.000 0.000 0.000 0.236 0.088
#> GSM71716 1 0.3914 0.6382 0.768 0.000 0.000 0.000 0.128 0.104
#> GSM71717 1 0.4929 0.5446 0.620 0.000 0.000 0.000 0.100 0.280
#> GSM71718 1 0.4300 0.5378 0.712 0.000 0.000 0.000 0.208 0.080
#> GSM71719 1 0.2747 0.6234 0.860 0.000 0.000 0.000 0.096 0.044
#> GSM71720 1 0.3370 0.5944 0.804 0.000 0.000 0.000 0.148 0.048
#> GSM71721 1 0.5978 0.3759 0.444 0.000 0.000 0.000 0.296 0.260
#> GSM71722 1 0.5921 0.3812 0.460 0.000 0.000 0.000 0.240 0.300
#> GSM71723 1 0.4597 0.5982 0.652 0.000 0.000 0.000 0.072 0.276
#> GSM71724 6 0.4732 0.6310 0.172 0.000 0.000 0.000 0.148 0.680
#> GSM71725 5 0.6075 0.0000 0.168 0.000 0.000 0.348 0.468 0.016
#> GSM71726 4 0.3126 0.2008 0.000 0.000 0.000 0.752 0.248 0.000
#> GSM71727 4 0.2562 0.6234 0.000 0.172 0.000 0.828 0.000 0.000
#> GSM71728 4 0.3428 0.0728 0.000 0.000 0.000 0.696 0.304 0.000
#> GSM71729 4 0.2871 0.6094 0.000 0.192 0.000 0.804 0.004 0.000
#> GSM71730 4 0.2912 0.5873 0.000 0.216 0.000 0.784 0.000 0.000
#> GSM71731 1 0.2852 0.6545 0.856 0.000 0.000 0.000 0.064 0.080
#> GSM71732 1 0.5267 0.5547 0.600 0.000 0.000 0.000 0.236 0.164
#> GSM71733 1 0.5093 0.4023 0.528 0.000 0.000 0.000 0.084 0.388
#> GSM71734 6 0.4603 0.6033 0.148 0.000 0.000 0.000 0.156 0.696
#> GSM71735 6 0.4736 0.2663 0.352 0.000 0.000 0.000 0.060 0.588
#> GSM71736 6 0.2618 0.7575 0.076 0.000 0.000 0.000 0.052 0.872
#> GSM71737 6 0.5105 0.2042 0.340 0.000 0.000 0.000 0.096 0.564
#> GSM71738 6 0.2950 0.7045 0.148 0.000 0.000 0.000 0.024 0.828
#> GSM71739 2 0.6262 0.2505 0.228 0.508 0.000 0.028 0.236 0.000
#> GSM71740 1 0.3874 0.6741 0.760 0.000 0.000 0.000 0.068 0.172
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) k
#> MAD:skmeans 70 9.38e-11 2
#> MAD:skmeans 69 4.15e-15 3
#> MAD:skmeans 69 4.88e-19 4
#> MAD:skmeans 64 1.94e-16 5
#> MAD:skmeans 59 6.14e-16 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 21168 rows and 70 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.951 0.982 0.4985 0.499 0.499
#> 3 3 0.964 0.922 0.948 0.1847 0.913 0.826
#> 4 4 0.733 0.744 0.820 0.1619 0.957 0.896
#> 5 5 0.901 0.871 0.948 0.1426 0.825 0.540
#> 6 6 0.820 0.693 0.847 0.0439 0.962 0.825
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
#> GSM71671 2 0.000 0.968 0.000 1.000
#> GSM71672 2 0.000 0.968 0.000 1.000
#> GSM71673 2 0.000 0.968 0.000 1.000
#> GSM71674 2 0.000 0.968 0.000 1.000
#> GSM71675 2 0.000 0.968 0.000 1.000
#> GSM71676 2 0.000 0.968 0.000 1.000
#> GSM71677 2 0.000 0.968 0.000 1.000
#> GSM71678 2 0.000 0.968 0.000 1.000
#> GSM71679 2 0.000 0.968 0.000 1.000
#> GSM71680 2 0.000 0.968 0.000 1.000
#> GSM71681 2 0.000 0.968 0.000 1.000
#> GSM71682 2 0.000 0.968 0.000 1.000
#> GSM71683 2 0.000 0.968 0.000 1.000
#> GSM71684 2 0.000 0.968 0.000 1.000
#> GSM71685 2 0.000 0.968 0.000 1.000
#> GSM71686 2 0.000 0.968 0.000 1.000
#> GSM71687 2 0.000 0.968 0.000 1.000
#> GSM71688 2 0.000 0.968 0.000 1.000
#> GSM71689 2 0.000 0.968 0.000 1.000
#> GSM71690 2 0.000 0.968 0.000 1.000
#> GSM71691 2 0.000 0.968 0.000 1.000
#> GSM71692 2 0.000 0.968 0.000 1.000
#> GSM71693 2 0.000 0.968 0.000 1.000
#> GSM71694 2 0.000 0.968 0.000 1.000
#> GSM71695 2 0.000 0.968 0.000 1.000
#> GSM71696 1 0.000 0.992 1.000 0.000
#> GSM71697 1 0.000 0.992 1.000 0.000
#> GSM71698 1 0.000 0.992 1.000 0.000
#> GSM71699 1 0.000 0.992 1.000 0.000
#> GSM71700 1 0.000 0.992 1.000 0.000
#> GSM71701 1 0.000 0.992 1.000 0.000
#> GSM71702 1 0.000 0.992 1.000 0.000
#> GSM71703 1 0.000 0.992 1.000 0.000
#> GSM71704 1 0.000 0.992 1.000 0.000
#> GSM71705 1 0.000 0.992 1.000 0.000
#> GSM71706 1 0.000 0.992 1.000 0.000
#> GSM71707 1 0.000 0.992 1.000 0.000
#> GSM71708 1 0.000 0.992 1.000 0.000
#> GSM71709 2 0.000 0.968 0.000 1.000
#> GSM71710 1 0.000 0.992 1.000 0.000
#> GSM71711 1 0.000 0.992 1.000 0.000
#> GSM71712 1 0.000 0.992 1.000 0.000
#> GSM71713 1 0.000 0.992 1.000 0.000
#> GSM71714 1 0.000 0.992 1.000 0.000
#> GSM71715 1 0.000 0.992 1.000 0.000
#> GSM71716 1 0.000 0.992 1.000 0.000
#> GSM71717 1 0.000 0.992 1.000 0.000
#> GSM71718 1 0.000 0.992 1.000 0.000
#> GSM71719 1 0.000 0.992 1.000 0.000
#> GSM71720 1 0.000 0.992 1.000 0.000
#> GSM71721 1 0.000 0.992 1.000 0.000
#> GSM71722 1 0.000 0.992 1.000 0.000
#> GSM71723 1 0.000 0.992 1.000 0.000
#> GSM71724 1 0.000 0.992 1.000 0.000
#> GSM71725 1 0.000 0.992 1.000 0.000
#> GSM71726 2 0.998 0.117 0.476 0.524
#> GSM71727 2 0.000 0.968 0.000 1.000
#> GSM71728 2 0.998 0.117 0.476 0.524
#> GSM71729 2 0.000 0.968 0.000 1.000
#> GSM71730 2 0.000 0.968 0.000 1.000
#> GSM71731 1 0.000 0.992 1.000 0.000
#> GSM71732 1 0.000 0.992 1.000 0.000
#> GSM71733 1 0.000 0.992 1.000 0.000
#> GSM71734 1 0.000 0.992 1.000 0.000
#> GSM71735 1 0.000 0.992 1.000 0.000
#> GSM71736 1 0.000 0.992 1.000 0.000
#> GSM71737 1 0.000 0.992 1.000 0.000
#> GSM71738 1 0.000 0.992 1.000 0.000
#> GSM71739 1 0.876 0.558 0.704 0.296
#> GSM71740 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
#> GSM71671 3 0.2261 0.991 0.000 0.068 0.932
#> GSM71672 3 0.2261 0.991 0.000 0.068 0.932
#> GSM71673 3 0.2261 0.991 0.000 0.068 0.932
#> GSM71674 3 0.2261 0.991 0.000 0.068 0.932
#> GSM71675 3 0.2261 0.991 0.000 0.068 0.932
#> GSM71676 3 0.2261 0.991 0.000 0.068 0.932
#> GSM71677 3 0.2261 0.991 0.000 0.068 0.932
#> GSM71678 2 0.0000 0.911 0.000 1.000 0.000
#> GSM71679 2 0.0000 0.911 0.000 1.000 0.000
#> GSM71680 2 0.4235 0.742 0.000 0.824 0.176
#> GSM71681 2 0.0000 0.911 0.000 1.000 0.000
#> GSM71682 2 0.0000 0.911 0.000 1.000 0.000
#> GSM71683 2 0.0000 0.911 0.000 1.000 0.000
#> GSM71684 2 0.0000 0.911 0.000 1.000 0.000
#> GSM71685 2 0.3412 0.807 0.000 0.876 0.124
#> GSM71686 2 0.0000 0.911 0.000 1.000 0.000
#> GSM71687 2 0.0000 0.911 0.000 1.000 0.000
#> GSM71688 2 0.0000 0.911 0.000 1.000 0.000
#> GSM71689 3 0.2356 0.988 0.000 0.072 0.928
#> GSM71690 2 0.0000 0.911 0.000 1.000 0.000
#> GSM71691 2 0.2261 0.856 0.000 0.932 0.068
#> GSM71692 3 0.2261 0.991 0.000 0.068 0.932
#> GSM71693 2 0.0000 0.911 0.000 1.000 0.000
#> GSM71694 3 0.3551 0.923 0.000 0.132 0.868
#> GSM71695 2 0.0000 0.911 0.000 1.000 0.000
#> GSM71696 1 0.2165 0.961 0.936 0.000 0.064
#> GSM71697 1 0.2165 0.961 0.936 0.000 0.064
#> GSM71698 1 0.0237 0.963 0.996 0.000 0.004
#> GSM71699 1 0.0237 0.963 0.996 0.000 0.004
#> GSM71700 1 0.2165 0.961 0.936 0.000 0.064
#> GSM71701 1 0.0237 0.963 0.996 0.000 0.004
#> GSM71702 1 0.0237 0.963 0.996 0.000 0.004
#> GSM71703 1 0.0237 0.963 0.996 0.000 0.004
#> GSM71704 1 0.0237 0.963 0.996 0.000 0.004
#> GSM71705 1 0.0237 0.963 0.996 0.000 0.004
#> GSM71706 1 0.0237 0.963 0.996 0.000 0.004
#> GSM71707 1 0.0424 0.963 0.992 0.000 0.008
#> GSM71708 1 0.0237 0.963 0.996 0.000 0.004
#> GSM71709 2 0.3551 0.799 0.000 0.868 0.132
#> GSM71710 1 0.1643 0.963 0.956 0.000 0.044
#> GSM71711 1 0.2165 0.961 0.936 0.000 0.064
#> GSM71712 1 0.2165 0.961 0.936 0.000 0.064
#> GSM71713 1 0.0237 0.963 0.996 0.000 0.004
#> GSM71714 1 0.2066 0.962 0.940 0.000 0.060
#> GSM71715 1 0.2165 0.961 0.936 0.000 0.064
#> GSM71716 1 0.2165 0.961 0.936 0.000 0.064
#> GSM71717 1 0.0000 0.963 1.000 0.000 0.000
#> GSM71718 1 0.2165 0.961 0.936 0.000 0.064
#> GSM71719 1 0.2165 0.961 0.936 0.000 0.064
#> GSM71720 1 0.2165 0.961 0.936 0.000 0.064
#> GSM71721 1 0.2165 0.961 0.936 0.000 0.064
#> GSM71722 1 0.2165 0.961 0.936 0.000 0.064
#> GSM71723 1 0.0237 0.963 0.996 0.000 0.004
#> GSM71724 1 0.2066 0.962 0.940 0.000 0.060
#> GSM71725 1 0.2165 0.961 0.936 0.000 0.064
#> GSM71726 2 0.8033 0.143 0.424 0.512 0.064
#> GSM71727 2 0.0000 0.911 0.000 1.000 0.000
#> GSM71728 2 0.7424 0.468 0.288 0.648 0.064
#> GSM71729 2 0.0000 0.911 0.000 1.000 0.000
#> GSM71730 2 0.0000 0.911 0.000 1.000 0.000
#> GSM71731 1 0.2165 0.961 0.936 0.000 0.064
#> GSM71732 1 0.2165 0.961 0.936 0.000 0.064
#> GSM71733 1 0.0237 0.963 0.996 0.000 0.004
#> GSM71734 1 0.0237 0.963 0.996 0.000 0.004
#> GSM71735 1 0.0237 0.963 0.996 0.000 0.004
#> GSM71736 1 0.0237 0.963 0.996 0.000 0.004
#> GSM71737 1 0.0237 0.963 0.996 0.000 0.004
#> GSM71738 1 0.0237 0.963 0.996 0.000 0.004
#> GSM71739 1 0.6341 0.651 0.716 0.252 0.032
#> GSM71740 1 0.1860 0.963 0.948 0.000 0.052
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> GSM71671 3 0.0000 0.984 0.000 0.000 1.000 0.000
#> GSM71672 3 0.0000 0.984 0.000 0.000 1.000 0.000
#> GSM71673 3 0.0000 0.984 0.000 0.000 1.000 0.000
#> GSM71674 3 0.0000 0.984 0.000 0.000 1.000 0.000
#> GSM71675 3 0.0000 0.984 0.000 0.000 1.000 0.000
#> GSM71676 3 0.0000 0.984 0.000 0.000 1.000 0.000
#> GSM71677 3 0.0188 0.981 0.000 0.004 0.996 0.000
#> GSM71678 2 0.0000 0.910 0.000 1.000 0.000 0.000
#> GSM71679 2 0.0000 0.910 0.000 1.000 0.000 0.000
#> GSM71680 4 0.7260 0.504 0.000 0.280 0.188 0.532
#> GSM71681 2 0.4989 -0.436 0.000 0.528 0.000 0.472
#> GSM71682 2 0.0000 0.910 0.000 1.000 0.000 0.000
#> GSM71683 2 0.0707 0.890 0.000 0.980 0.000 0.020
#> GSM71684 2 0.0188 0.907 0.000 0.996 0.000 0.004
#> GSM71685 4 0.6574 0.547 0.000 0.384 0.084 0.532
#> GSM71686 2 0.0000 0.910 0.000 1.000 0.000 0.000
#> GSM71687 2 0.0000 0.910 0.000 1.000 0.000 0.000
#> GSM71688 2 0.3649 0.561 0.000 0.796 0.000 0.204
#> GSM71689 3 0.0188 0.981 0.000 0.004 0.996 0.000
#> GSM71690 2 0.0000 0.910 0.000 1.000 0.000 0.000
#> GSM71691 2 0.0000 0.910 0.000 1.000 0.000 0.000
#> GSM71692 3 0.0000 0.984 0.000 0.000 1.000 0.000
#> GSM71693 2 0.0000 0.910 0.000 1.000 0.000 0.000
#> GSM71694 3 0.2345 0.856 0.000 0.100 0.900 0.000
#> GSM71695 2 0.0000 0.910 0.000 1.000 0.000 0.000
#> GSM71696 1 0.4977 0.711 0.540 0.000 0.000 0.460
#> GSM71697 1 0.4985 0.709 0.532 0.000 0.000 0.468
#> GSM71698 1 0.0469 0.748 0.988 0.000 0.000 0.012
#> GSM71699 1 0.0000 0.746 1.000 0.000 0.000 0.000
#> GSM71700 1 0.4985 0.709 0.532 0.000 0.000 0.468
#> GSM71701 1 0.0188 0.747 0.996 0.000 0.000 0.004
#> GSM71702 1 0.0188 0.747 0.996 0.000 0.000 0.004
#> GSM71703 1 0.0000 0.746 1.000 0.000 0.000 0.000
#> GSM71704 1 0.0000 0.746 1.000 0.000 0.000 0.000
#> GSM71705 1 0.0336 0.747 0.992 0.000 0.000 0.008
#> GSM71706 1 0.0000 0.746 1.000 0.000 0.000 0.000
#> GSM71707 1 0.2216 0.746 0.908 0.000 0.000 0.092
#> GSM71708 1 0.0000 0.746 1.000 0.000 0.000 0.000
#> GSM71709 4 0.6737 0.549 0.000 0.368 0.100 0.532
#> GSM71710 1 0.4866 0.719 0.596 0.000 0.000 0.404
#> GSM71711 1 0.4977 0.710 0.540 0.000 0.000 0.460
#> GSM71712 1 0.4989 0.705 0.528 0.000 0.000 0.472
#> GSM71713 1 0.0336 0.748 0.992 0.000 0.000 0.008
#> GSM71714 1 0.3801 0.740 0.780 0.000 0.000 0.220
#> GSM71715 1 0.4985 0.709 0.532 0.000 0.000 0.468
#> GSM71716 1 0.4981 0.710 0.536 0.000 0.000 0.464
#> GSM71717 1 0.0817 0.749 0.976 0.000 0.000 0.024
#> GSM71718 1 0.4985 0.709 0.532 0.000 0.000 0.468
#> GSM71719 1 0.4985 0.709 0.532 0.000 0.000 0.468
#> GSM71720 1 0.4985 0.709 0.532 0.000 0.000 0.468
#> GSM71721 1 0.4977 0.711 0.540 0.000 0.000 0.460
#> GSM71722 1 0.4977 0.711 0.540 0.000 0.000 0.460
#> GSM71723 1 0.0592 0.749 0.984 0.000 0.000 0.016
#> GSM71724 1 0.3528 0.742 0.808 0.000 0.000 0.192
#> GSM71725 1 0.4985 0.709 0.532 0.000 0.000 0.468
#> GSM71726 4 0.0188 0.415 0.000 0.004 0.000 0.996
#> GSM71727 4 0.4985 0.485 0.000 0.468 0.000 0.532
#> GSM71728 4 0.0657 0.407 0.004 0.012 0.000 0.984
#> GSM71729 4 0.4985 0.485 0.000 0.468 0.000 0.532
#> GSM71730 4 0.4985 0.485 0.000 0.468 0.000 0.532
#> GSM71731 1 0.4985 0.709 0.532 0.000 0.000 0.468
#> GSM71732 1 0.4981 0.710 0.536 0.000 0.000 0.464
#> GSM71733 1 0.0707 0.749 0.980 0.000 0.000 0.020
#> GSM71734 1 0.0000 0.746 1.000 0.000 0.000 0.000
#> GSM71735 1 0.0000 0.746 1.000 0.000 0.000 0.000
#> GSM71736 1 0.0000 0.746 1.000 0.000 0.000 0.000
#> GSM71737 1 0.0188 0.746 0.996 0.000 0.000 0.004
#> GSM71738 1 0.0000 0.746 1.000 0.000 0.000 0.000
#> GSM71739 1 0.7060 0.613 0.496 0.128 0.000 0.376
#> GSM71740 1 0.4972 0.712 0.544 0.000 0.000 0.456
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> GSM71671 3 0.0000 1.0000 0.000 0.000 1 0.000 0.000
#> GSM71672 3 0.0000 1.0000 0.000 0.000 1 0.000 0.000
#> GSM71673 3 0.0000 1.0000 0.000 0.000 1 0.000 0.000
#> GSM71674 3 0.0000 1.0000 0.000 0.000 1 0.000 0.000
#> GSM71675 3 0.0000 1.0000 0.000 0.000 1 0.000 0.000
#> GSM71676 3 0.0000 1.0000 0.000 0.000 1 0.000 0.000
#> GSM71677 3 0.0000 1.0000 0.000 0.000 1 0.000 0.000
#> GSM71678 2 0.0000 0.9333 0.000 1.000 0 0.000 0.000
#> GSM71679 2 0.0000 0.9333 0.000 1.000 0 0.000 0.000
#> GSM71680 4 0.0000 0.9474 0.000 0.000 0 1.000 0.000
#> GSM71681 4 0.2773 0.7859 0.000 0.164 0 0.836 0.000
#> GSM71682 2 0.0000 0.9333 0.000 1.000 0 0.000 0.000
#> GSM71683 2 0.2424 0.8281 0.000 0.868 0 0.132 0.000
#> GSM71684 2 0.2329 0.8370 0.000 0.876 0 0.124 0.000
#> GSM71685 4 0.0000 0.9474 0.000 0.000 0 1.000 0.000
#> GSM71686 2 0.0000 0.9333 0.000 1.000 0 0.000 0.000
#> GSM71687 2 0.0000 0.9333 0.000 1.000 0 0.000 0.000
#> GSM71688 2 0.4262 0.1894 0.000 0.560 0 0.440 0.000
#> GSM71689 3 0.0000 1.0000 0.000 0.000 1 0.000 0.000
#> GSM71690 2 0.0000 0.9333 0.000 1.000 0 0.000 0.000
#> GSM71691 2 0.0000 0.9333 0.000 1.000 0 0.000 0.000
#> GSM71692 3 0.0000 1.0000 0.000 0.000 1 0.000 0.000
#> GSM71693 2 0.0000 0.9333 0.000 1.000 0 0.000 0.000
#> GSM71694 3 0.0000 1.0000 0.000 0.000 1 0.000 0.000
#> GSM71695 2 0.0000 0.9333 0.000 1.000 0 0.000 0.000
#> GSM71696 5 0.0880 0.9012 0.032 0.000 0 0.000 0.968
#> GSM71697 5 0.0000 0.9145 0.000 0.000 0 0.000 1.000
#> GSM71698 1 0.0404 0.9171 0.988 0.000 0 0.000 0.012
#> GSM71699 1 0.0000 0.9194 1.000 0.000 0 0.000 0.000
#> GSM71700 5 0.0162 0.9141 0.004 0.000 0 0.000 0.996
#> GSM71701 1 0.0162 0.9195 0.996 0.000 0 0.000 0.004
#> GSM71702 1 0.0162 0.9195 0.996 0.000 0 0.000 0.004
#> GSM71703 1 0.0000 0.9194 1.000 0.000 0 0.000 0.000
#> GSM71704 1 0.0000 0.9194 1.000 0.000 0 0.000 0.000
#> GSM71705 1 0.0404 0.9178 0.988 0.000 0 0.000 0.012
#> GSM71706 1 0.0000 0.9194 1.000 0.000 0 0.000 0.000
#> GSM71707 1 0.2929 0.7414 0.820 0.000 0 0.000 0.180
#> GSM71708 1 0.0000 0.9194 1.000 0.000 0 0.000 0.000
#> GSM71709 4 0.0000 0.9474 0.000 0.000 0 1.000 0.000
#> GSM71710 5 0.1478 0.8746 0.064 0.000 0 0.000 0.936
#> GSM71711 5 0.0290 0.9123 0.008 0.000 0 0.000 0.992
#> GSM71712 5 0.0404 0.9112 0.012 0.000 0 0.000 0.988
#> GSM71713 1 0.0290 0.9188 0.992 0.000 0 0.000 0.008
#> GSM71714 1 0.4307 0.0394 0.504 0.000 0 0.000 0.496
#> GSM71715 5 0.0000 0.9145 0.000 0.000 0 0.000 1.000
#> GSM71716 5 0.0162 0.9137 0.004 0.000 0 0.000 0.996
#> GSM71717 1 0.4138 0.3773 0.616 0.000 0 0.000 0.384
#> GSM71718 5 0.0000 0.9145 0.000 0.000 0 0.000 1.000
#> GSM71719 5 0.0000 0.9145 0.000 0.000 0 0.000 1.000
#> GSM71720 5 0.0000 0.9145 0.000 0.000 0 0.000 1.000
#> GSM71721 5 0.3999 0.4841 0.344 0.000 0 0.000 0.656
#> GSM71722 5 0.4114 0.4100 0.376 0.000 0 0.000 0.624
#> GSM71723 1 0.1043 0.8999 0.960 0.000 0 0.000 0.040
#> GSM71724 1 0.3177 0.7087 0.792 0.000 0 0.000 0.208
#> GSM71725 5 0.0000 0.9145 0.000 0.000 0 0.000 1.000
#> GSM71726 4 0.2605 0.7956 0.000 0.000 0 0.852 0.148
#> GSM71727 4 0.0000 0.9474 0.000 0.000 0 1.000 0.000
#> GSM71728 5 0.0162 0.9133 0.000 0.000 0 0.004 0.996
#> GSM71729 4 0.0000 0.9474 0.000 0.000 0 1.000 0.000
#> GSM71730 4 0.0000 0.9474 0.000 0.000 0 1.000 0.000
#> GSM71731 5 0.0000 0.9145 0.000 0.000 0 0.000 1.000
#> GSM71732 5 0.3730 0.5883 0.288 0.000 0 0.000 0.712
#> GSM71733 1 0.0703 0.9118 0.976 0.000 0 0.000 0.024
#> GSM71734 1 0.0162 0.9197 0.996 0.000 0 0.000 0.004
#> GSM71735 1 0.0162 0.9197 0.996 0.000 0 0.000 0.004
#> GSM71736 1 0.0000 0.9194 1.000 0.000 0 0.000 0.000
#> GSM71737 1 0.0404 0.9153 0.988 0.000 0 0.000 0.012
#> GSM71738 1 0.0000 0.9194 1.000 0.000 0 0.000 0.000
#> GSM71739 5 0.1410 0.8696 0.000 0.060 0 0.000 0.940
#> GSM71740 5 0.1043 0.8958 0.040 0.000 0 0.000 0.960
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> GSM71671 3 0.0000 0.9382 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM71672 3 0.0000 0.9382 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM71673 3 0.0000 0.9382 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM71674 3 0.0000 0.9382 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM71675 3 0.0000 0.9382 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM71676 3 0.0000 0.9382 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM71677 3 0.0000 0.9382 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM71678 2 0.0000 0.9328 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM71679 2 0.0000 0.9328 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM71680 4 0.0000 0.9362 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM71681 4 0.2454 0.7838 0.000 0.160 0.000 0.840 0.000 0.000
#> GSM71682 2 0.0000 0.9328 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM71683 2 0.2219 0.8237 0.000 0.864 0.000 0.136 0.000 0.000
#> GSM71684 2 0.2092 0.8359 0.000 0.876 0.000 0.124 0.000 0.000
#> GSM71685 4 0.0000 0.9362 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM71686 2 0.0000 0.9328 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM71687 2 0.0000 0.9328 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM71688 2 0.3828 0.1938 0.000 0.560 0.000 0.440 0.000 0.000
#> GSM71689 3 0.3023 0.8475 0.000 0.000 0.768 0.000 0.232 0.000
#> GSM71690 2 0.0000 0.9328 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM71691 2 0.0000 0.9328 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM71692 3 0.3023 0.8475 0.000 0.000 0.768 0.000 0.232 0.000
#> GSM71693 2 0.0000 0.9328 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM71694 3 0.3023 0.8475 0.000 0.000 0.768 0.000 0.232 0.000
#> GSM71695 2 0.0000 0.9328 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM71696 1 0.2311 0.7644 0.880 0.000 0.000 0.000 0.104 0.016
#> GSM71697 1 0.0000 0.8836 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM71698 6 0.4853 -0.2749 0.056 0.000 0.000 0.000 0.456 0.488
#> GSM71699 6 0.0260 0.6338 0.000 0.000 0.000 0.000 0.008 0.992
#> GSM71700 1 0.0363 0.8845 0.988 0.000 0.000 0.000 0.000 0.012
#> GSM71701 6 0.4644 -0.2251 0.040 0.000 0.000 0.000 0.456 0.504
#> GSM71702 6 0.3944 -0.0622 0.004 0.000 0.000 0.000 0.428 0.568
#> GSM71703 6 0.0000 0.6358 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM71704 6 0.0146 0.6354 0.000 0.000 0.000 0.000 0.004 0.996
#> GSM71705 6 0.4753 -0.2498 0.048 0.000 0.000 0.000 0.456 0.496
#> GSM71706 6 0.0000 0.6358 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM71707 5 0.5505 0.4420 0.128 0.000 0.000 0.000 0.452 0.420
#> GSM71708 6 0.0000 0.6358 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM71709 4 0.0000 0.9362 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM71710 1 0.1663 0.8552 0.912 0.000 0.000 0.000 0.000 0.088
#> GSM71711 1 0.1141 0.8780 0.948 0.000 0.000 0.000 0.000 0.052
#> GSM71712 1 0.3531 0.6816 0.672 0.000 0.000 0.000 0.328 0.000
#> GSM71713 6 0.0891 0.6228 0.008 0.000 0.000 0.000 0.024 0.968
#> GSM71714 6 0.4026 0.1202 0.376 0.000 0.000 0.000 0.012 0.612
#> GSM71715 1 0.0937 0.8813 0.960 0.000 0.000 0.000 0.000 0.040
#> GSM71716 1 0.1075 0.8792 0.952 0.000 0.000 0.000 0.000 0.048
#> GSM71717 6 0.3151 0.3269 0.252 0.000 0.000 0.000 0.000 0.748
#> GSM71718 1 0.0146 0.8820 0.996 0.000 0.000 0.000 0.004 0.000
#> GSM71719 1 0.0000 0.8836 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM71720 1 0.0000 0.8836 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM71721 5 0.5896 0.7637 0.324 0.000 0.000 0.000 0.456 0.220
#> GSM71722 5 0.5925 0.7653 0.308 0.000 0.000 0.000 0.456 0.236
#> GSM71723 6 0.4603 -0.1515 0.040 0.000 0.000 0.000 0.416 0.544
#> GSM71724 5 0.5750 0.5682 0.172 0.000 0.000 0.000 0.448 0.380
#> GSM71725 1 0.3428 0.6998 0.696 0.000 0.000 0.000 0.304 0.000
#> GSM71726 4 0.4011 0.6991 0.024 0.000 0.000 0.672 0.304 0.000
#> GSM71727 4 0.0000 0.9362 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM71728 1 0.3565 0.6968 0.692 0.000 0.000 0.004 0.304 0.000
#> GSM71729 4 0.0000 0.9362 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM71730 4 0.0000 0.9362 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM71731 1 0.0363 0.8856 0.988 0.000 0.000 0.000 0.000 0.012
#> GSM71732 5 0.5705 0.6996 0.380 0.000 0.000 0.000 0.456 0.164
#> GSM71733 6 0.4449 -0.1581 0.028 0.000 0.000 0.000 0.440 0.532
#> GSM71734 6 0.4578 -0.1850 0.036 0.000 0.000 0.000 0.444 0.520
#> GSM71735 6 0.0260 0.6343 0.000 0.000 0.000 0.000 0.008 0.992
#> GSM71736 6 0.0260 0.6343 0.000 0.000 0.000 0.000 0.008 0.992
#> GSM71737 6 0.0000 0.6358 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM71738 6 0.0000 0.6358 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM71739 1 0.1610 0.8445 0.916 0.084 0.000 0.000 0.000 0.000
#> GSM71740 1 0.1802 0.8520 0.916 0.000 0.000 0.000 0.012 0.072
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) k
#> MAD:pam 68 2.85e-12 2
#> MAD:pam 68 9.16e-19 3
#> MAD:pam 64 9.10e-19 4
#> MAD:pam 65 1.56e-16 5
#> MAD:pam 59 1.11e-13 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 21168 rows and 70 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 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.970 0.969 0.985 0.5060 0.493 0.493
#> 3 3 1.000 0.965 0.985 0.2097 0.872 0.746
#> 4 4 0.947 0.925 0.963 0.0977 0.893 0.741
#> 5 5 0.756 0.730 0.855 0.1124 0.935 0.809
#> 6 6 0.738 0.713 0.800 0.0564 0.871 0.589
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
#> GSM71671 2 0.0000 0.970 0.000 1.000
#> GSM71672 2 0.0000 0.970 0.000 1.000
#> GSM71673 2 0.0000 0.970 0.000 1.000
#> GSM71674 2 0.0000 0.970 0.000 1.000
#> GSM71675 2 0.0000 0.970 0.000 1.000
#> GSM71676 2 0.0000 0.970 0.000 1.000
#> GSM71677 2 0.0000 0.970 0.000 1.000
#> GSM71678 2 0.0000 0.970 0.000 1.000
#> GSM71679 2 0.0000 0.970 0.000 1.000
#> GSM71680 2 0.0000 0.970 0.000 1.000
#> GSM71681 2 0.0000 0.970 0.000 1.000
#> GSM71682 2 0.0000 0.970 0.000 1.000
#> GSM71683 2 0.0000 0.970 0.000 1.000
#> GSM71684 2 0.0000 0.970 0.000 1.000
#> GSM71685 2 0.0000 0.970 0.000 1.000
#> GSM71686 2 0.0000 0.970 0.000 1.000
#> GSM71687 2 0.0000 0.970 0.000 1.000
#> GSM71688 2 0.0000 0.970 0.000 1.000
#> GSM71689 2 0.0000 0.970 0.000 1.000
#> GSM71690 2 0.0000 0.970 0.000 1.000
#> GSM71691 2 0.0000 0.970 0.000 1.000
#> GSM71692 2 0.0000 0.970 0.000 1.000
#> GSM71693 2 0.0000 0.970 0.000 1.000
#> GSM71694 2 0.0000 0.970 0.000 1.000
#> GSM71695 2 0.0000 0.970 0.000 1.000
#> GSM71696 1 0.0000 0.999 1.000 0.000
#> GSM71697 1 0.0000 0.999 1.000 0.000
#> GSM71698 1 0.0000 0.999 1.000 0.000
#> GSM71699 1 0.0000 0.999 1.000 0.000
#> GSM71700 1 0.0000 0.999 1.000 0.000
#> GSM71701 1 0.0000 0.999 1.000 0.000
#> GSM71702 1 0.0000 0.999 1.000 0.000
#> GSM71703 1 0.0000 0.999 1.000 0.000
#> GSM71704 1 0.0000 0.999 1.000 0.000
#> GSM71705 1 0.0000 0.999 1.000 0.000
#> GSM71706 1 0.0000 0.999 1.000 0.000
#> GSM71707 1 0.0000 0.999 1.000 0.000
#> GSM71708 1 0.0000 0.999 1.000 0.000
#> GSM71709 2 0.0000 0.970 0.000 1.000
#> GSM71710 1 0.0000 0.999 1.000 0.000
#> GSM71711 1 0.0000 0.999 1.000 0.000
#> GSM71712 2 0.6712 0.803 0.176 0.824
#> GSM71713 1 0.2423 0.956 0.960 0.040
#> GSM71714 1 0.0000 0.999 1.000 0.000
#> GSM71715 2 0.8813 0.609 0.300 0.700
#> GSM71716 1 0.0000 0.999 1.000 0.000
#> GSM71717 1 0.0000 0.999 1.000 0.000
#> GSM71718 1 0.0000 0.999 1.000 0.000
#> GSM71719 1 0.0000 0.999 1.000 0.000
#> GSM71720 1 0.0000 0.999 1.000 0.000
#> GSM71721 1 0.0000 0.999 1.000 0.000
#> GSM71722 1 0.0000 0.999 1.000 0.000
#> GSM71723 1 0.0000 0.999 1.000 0.000
#> GSM71724 1 0.0000 0.999 1.000 0.000
#> GSM71725 2 0.7815 0.727 0.232 0.768
#> GSM71726 2 0.0376 0.968 0.004 0.996
#> GSM71727 2 0.0000 0.970 0.000 1.000
#> GSM71728 2 0.5842 0.845 0.140 0.860
#> GSM71729 2 0.0000 0.970 0.000 1.000
#> GSM71730 2 0.0000 0.970 0.000 1.000
#> GSM71731 1 0.0000 0.999 1.000 0.000
#> GSM71732 1 0.0000 0.999 1.000 0.000
#> GSM71733 1 0.0000 0.999 1.000 0.000
#> GSM71734 1 0.0000 0.999 1.000 0.000
#> GSM71735 1 0.0000 0.999 1.000 0.000
#> GSM71736 1 0.0000 0.999 1.000 0.000
#> GSM71737 1 0.0000 0.999 1.000 0.000
#> GSM71738 1 0.0000 0.999 1.000 0.000
#> GSM71739 2 0.5946 0.841 0.144 0.856
#> GSM71740 1 0.0000 0.999 1.000 0.000
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> GSM71671 3 0.0000 1.0000 0.000 0.000 1.000
#> GSM71672 3 0.0000 1.0000 0.000 0.000 1.000
#> GSM71673 3 0.0000 1.0000 0.000 0.000 1.000
#> GSM71674 3 0.0000 1.0000 0.000 0.000 1.000
#> GSM71675 3 0.0000 1.0000 0.000 0.000 1.000
#> GSM71676 3 0.0000 1.0000 0.000 0.000 1.000
#> GSM71677 3 0.0000 1.0000 0.000 0.000 1.000
#> GSM71678 2 0.0000 0.9534 0.000 1.000 0.000
#> GSM71679 2 0.0000 0.9534 0.000 1.000 0.000
#> GSM71680 2 0.0892 0.9523 0.000 0.980 0.020
#> GSM71681 2 0.0592 0.9538 0.000 0.988 0.012
#> GSM71682 2 0.0000 0.9534 0.000 1.000 0.000
#> GSM71683 2 0.0000 0.9534 0.000 1.000 0.000
#> GSM71684 2 0.0592 0.9538 0.000 0.988 0.012
#> GSM71685 2 0.0892 0.9523 0.000 0.980 0.020
#> GSM71686 2 0.0000 0.9534 0.000 1.000 0.000
#> GSM71687 2 0.0000 0.9534 0.000 1.000 0.000
#> GSM71688 2 0.0000 0.9534 0.000 1.000 0.000
#> GSM71689 3 0.0000 1.0000 0.000 0.000 1.000
#> GSM71690 2 0.0000 0.9534 0.000 1.000 0.000
#> GSM71691 2 0.0000 0.9534 0.000 1.000 0.000
#> GSM71692 3 0.0000 1.0000 0.000 0.000 1.000
#> GSM71693 2 0.0000 0.9534 0.000 1.000 0.000
#> GSM71694 3 0.0000 1.0000 0.000 0.000 1.000
#> GSM71695 2 0.0424 0.9538 0.000 0.992 0.008
#> GSM71696 1 0.1643 0.9471 0.956 0.044 0.000
#> GSM71697 1 0.0000 0.9984 1.000 0.000 0.000
#> GSM71698 1 0.0000 0.9984 1.000 0.000 0.000
#> GSM71699 1 0.0000 0.9984 1.000 0.000 0.000
#> GSM71700 1 0.0000 0.9984 1.000 0.000 0.000
#> GSM71701 1 0.0000 0.9984 1.000 0.000 0.000
#> GSM71702 1 0.0000 0.9984 1.000 0.000 0.000
#> GSM71703 1 0.0000 0.9984 1.000 0.000 0.000
#> GSM71704 1 0.0000 0.9984 1.000 0.000 0.000
#> GSM71705 1 0.0000 0.9984 1.000 0.000 0.000
#> GSM71706 1 0.0000 0.9984 1.000 0.000 0.000
#> GSM71707 1 0.0000 0.9984 1.000 0.000 0.000
#> GSM71708 1 0.0000 0.9984 1.000 0.000 0.000
#> GSM71709 2 0.0892 0.9523 0.000 0.980 0.020
#> GSM71710 1 0.0000 0.9984 1.000 0.000 0.000
#> GSM71711 1 0.0000 0.9984 1.000 0.000 0.000
#> GSM71712 2 0.1620 0.9370 0.024 0.964 0.012
#> GSM71713 2 0.6305 0.0947 0.484 0.516 0.000
#> GSM71714 1 0.0000 0.9984 1.000 0.000 0.000
#> GSM71715 2 0.5122 0.7038 0.200 0.788 0.012
#> GSM71716 1 0.0000 0.9984 1.000 0.000 0.000
#> GSM71717 1 0.0000 0.9984 1.000 0.000 0.000
#> GSM71718 1 0.0000 0.9984 1.000 0.000 0.000
#> GSM71719 1 0.0000 0.9984 1.000 0.000 0.000
#> GSM71720 1 0.0000 0.9984 1.000 0.000 0.000
#> GSM71721 1 0.0000 0.9984 1.000 0.000 0.000
#> GSM71722 1 0.0000 0.9984 1.000 0.000 0.000
#> GSM71723 1 0.0000 0.9984 1.000 0.000 0.000
#> GSM71724 1 0.0000 0.9984 1.000 0.000 0.000
#> GSM71725 2 0.1877 0.9287 0.032 0.956 0.012
#> GSM71726 2 0.0892 0.9523 0.000 0.980 0.020
#> GSM71727 2 0.0892 0.9523 0.000 0.980 0.020
#> GSM71728 2 0.0892 0.9523 0.000 0.980 0.020
#> GSM71729 2 0.0892 0.9523 0.000 0.980 0.020
#> GSM71730 2 0.0892 0.9523 0.000 0.980 0.020
#> GSM71731 1 0.0000 0.9984 1.000 0.000 0.000
#> GSM71732 1 0.0000 0.9984 1.000 0.000 0.000
#> GSM71733 1 0.0000 0.9984 1.000 0.000 0.000
#> GSM71734 1 0.0000 0.9984 1.000 0.000 0.000
#> GSM71735 1 0.0000 0.9984 1.000 0.000 0.000
#> GSM71736 1 0.0000 0.9984 1.000 0.000 0.000
#> GSM71737 1 0.0000 0.9984 1.000 0.000 0.000
#> GSM71738 1 0.0000 0.9984 1.000 0.000 0.000
#> GSM71739 2 0.0592 0.9536 0.000 0.988 0.012
#> GSM71740 1 0.0000 0.9984 1.000 0.000 0.000
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> GSM71671 3 0.0000 0.997 0.000 0.000 1.000 0.000
#> GSM71672 3 0.0000 0.997 0.000 0.000 1.000 0.000
#> GSM71673 3 0.0000 0.997 0.000 0.000 1.000 0.000
#> GSM71674 3 0.0000 0.997 0.000 0.000 1.000 0.000
#> GSM71675 3 0.0000 0.997 0.000 0.000 1.000 0.000
#> GSM71676 3 0.0000 0.997 0.000 0.000 1.000 0.000
#> GSM71677 3 0.0000 0.997 0.000 0.000 1.000 0.000
#> GSM71678 2 0.0336 0.969 0.000 0.992 0.000 0.008
#> GSM71679 2 0.0336 0.969 0.000 0.992 0.000 0.008
#> GSM71680 4 0.0000 0.864 0.000 0.000 0.000 1.000
#> GSM71681 4 0.4250 0.686 0.000 0.276 0.000 0.724
#> GSM71682 2 0.0336 0.969 0.000 0.992 0.000 0.008
#> GSM71683 2 0.0336 0.969 0.000 0.992 0.000 0.008
#> GSM71684 4 0.4382 0.655 0.000 0.296 0.000 0.704
#> GSM71685 4 0.4250 0.686 0.000 0.276 0.000 0.724
#> GSM71686 2 0.0336 0.969 0.000 0.992 0.000 0.008
#> GSM71687 2 0.1302 0.942 0.000 0.956 0.000 0.044
#> GSM71688 2 0.3610 0.722 0.000 0.800 0.000 0.200
#> GSM71689 3 0.0336 0.992 0.000 0.008 0.992 0.000
#> GSM71690 2 0.0336 0.969 0.000 0.992 0.000 0.008
#> GSM71691 2 0.0336 0.969 0.000 0.992 0.000 0.008
#> GSM71692 3 0.0000 0.997 0.000 0.000 1.000 0.000
#> GSM71693 2 0.1022 0.953 0.000 0.968 0.000 0.032
#> GSM71694 3 0.0592 0.985 0.000 0.016 0.984 0.000
#> GSM71695 2 0.0336 0.969 0.000 0.992 0.000 0.008
#> GSM71696 1 0.1109 0.951 0.968 0.028 0.000 0.004
#> GSM71697 1 0.0000 0.978 1.000 0.000 0.000 0.000
#> GSM71698 1 0.0000 0.978 1.000 0.000 0.000 0.000
#> GSM71699 1 0.0336 0.975 0.992 0.008 0.000 0.000
#> GSM71700 1 0.0000 0.978 1.000 0.000 0.000 0.000
#> GSM71701 1 0.0000 0.978 1.000 0.000 0.000 0.000
#> GSM71702 1 0.0000 0.978 1.000 0.000 0.000 0.000
#> GSM71703 1 0.0336 0.975 0.992 0.008 0.000 0.000
#> GSM71704 1 0.0336 0.975 0.992 0.008 0.000 0.000
#> GSM71705 1 0.0000 0.978 1.000 0.000 0.000 0.000
#> GSM71706 1 0.0336 0.975 0.992 0.008 0.000 0.000
#> GSM71707 1 0.0000 0.978 1.000 0.000 0.000 0.000
#> GSM71708 1 0.0336 0.975 0.992 0.008 0.000 0.000
#> GSM71709 4 0.0000 0.864 0.000 0.000 0.000 1.000
#> GSM71710 1 0.0000 0.978 1.000 0.000 0.000 0.000
#> GSM71711 1 0.0000 0.978 1.000 0.000 0.000 0.000
#> GSM71712 4 0.0188 0.864 0.004 0.000 0.000 0.996
#> GSM71713 1 0.4301 0.786 0.816 0.064 0.000 0.120
#> GSM71714 1 0.0000 0.978 1.000 0.000 0.000 0.000
#> GSM71715 1 0.7506 0.153 0.484 0.208 0.000 0.308
#> GSM71716 1 0.0000 0.978 1.000 0.000 0.000 0.000
#> GSM71717 1 0.0336 0.975 0.992 0.008 0.000 0.000
#> GSM71718 1 0.0000 0.978 1.000 0.000 0.000 0.000
#> GSM71719 1 0.0000 0.978 1.000 0.000 0.000 0.000
#> GSM71720 1 0.0000 0.978 1.000 0.000 0.000 0.000
#> GSM71721 1 0.0000 0.978 1.000 0.000 0.000 0.000
#> GSM71722 1 0.0000 0.978 1.000 0.000 0.000 0.000
#> GSM71723 1 0.0000 0.978 1.000 0.000 0.000 0.000
#> GSM71724 1 0.0000 0.978 1.000 0.000 0.000 0.000
#> GSM71725 4 0.1182 0.851 0.016 0.016 0.000 0.968
#> GSM71726 4 0.0188 0.864 0.004 0.000 0.000 0.996
#> GSM71727 4 0.0592 0.863 0.000 0.016 0.000 0.984
#> GSM71728 4 0.0188 0.864 0.004 0.000 0.000 0.996
#> GSM71729 4 0.0469 0.864 0.000 0.012 0.000 0.988
#> GSM71730 4 0.4250 0.686 0.000 0.276 0.000 0.724
#> GSM71731 1 0.0000 0.978 1.000 0.000 0.000 0.000
#> GSM71732 1 0.0000 0.978 1.000 0.000 0.000 0.000
#> GSM71733 1 0.0000 0.978 1.000 0.000 0.000 0.000
#> GSM71734 1 0.0000 0.978 1.000 0.000 0.000 0.000
#> GSM71735 1 0.0336 0.975 0.992 0.008 0.000 0.000
#> GSM71736 1 0.0336 0.975 0.992 0.008 0.000 0.000
#> GSM71737 1 0.0336 0.975 0.992 0.008 0.000 0.000
#> GSM71738 1 0.0336 0.975 0.992 0.008 0.000 0.000
#> GSM71739 4 0.3688 0.685 0.000 0.208 0.000 0.792
#> GSM71740 1 0.0000 0.978 1.000 0.000 0.000 0.000
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> GSM71671 3 0.0000 1.000 0.000 0.000 1 0.000 0.000
#> GSM71672 3 0.0000 1.000 0.000 0.000 1 0.000 0.000
#> GSM71673 3 0.0000 1.000 0.000 0.000 1 0.000 0.000
#> GSM71674 3 0.0000 1.000 0.000 0.000 1 0.000 0.000
#> GSM71675 3 0.0000 1.000 0.000 0.000 1 0.000 0.000
#> GSM71676 3 0.0000 1.000 0.000 0.000 1 0.000 0.000
#> GSM71677 3 0.0000 1.000 0.000 0.000 1 0.000 0.000
#> GSM71678 2 0.0000 0.991 0.000 1.000 0 0.000 0.000
#> GSM71679 2 0.0162 0.990 0.000 0.996 0 0.000 0.004
#> GSM71680 4 0.0162 0.668 0.000 0.004 0 0.996 0.000
#> GSM71681 4 0.3895 0.706 0.000 0.320 0 0.680 0.000
#> GSM71682 2 0.0162 0.990 0.000 0.996 0 0.000 0.004
#> GSM71683 2 0.0000 0.991 0.000 1.000 0 0.000 0.000
#> GSM71684 4 0.4015 0.675 0.000 0.348 0 0.652 0.000
#> GSM71685 4 0.3895 0.706 0.000 0.320 0 0.680 0.000
#> GSM71686 2 0.0162 0.990 0.000 0.996 0 0.000 0.004
#> GSM71687 2 0.0794 0.962 0.000 0.972 0 0.028 0.000
#> GSM71688 4 0.4242 0.538 0.000 0.428 0 0.572 0.000
#> GSM71689 3 0.0000 1.000 0.000 0.000 1 0.000 0.000
#> GSM71690 2 0.0000 0.991 0.000 1.000 0 0.000 0.000
#> GSM71691 2 0.0000 0.991 0.000 1.000 0 0.000 0.000
#> GSM71692 3 0.0000 1.000 0.000 0.000 1 0.000 0.000
#> GSM71693 2 0.0609 0.971 0.000 0.980 0 0.020 0.000
#> GSM71694 3 0.0000 1.000 0.000 0.000 1 0.000 0.000
#> GSM71695 2 0.0000 0.991 0.000 1.000 0 0.000 0.000
#> GSM71696 1 0.4171 0.351 0.604 0.000 0 0.000 0.396
#> GSM71697 1 0.3452 0.628 0.756 0.000 0 0.000 0.244
#> GSM71698 1 0.0290 0.792 0.992 0.000 0 0.000 0.008
#> GSM71699 1 0.3561 0.637 0.740 0.000 0 0.000 0.260
#> GSM71700 1 0.0290 0.792 0.992 0.000 0 0.000 0.008
#> GSM71701 1 0.0162 0.792 0.996 0.000 0 0.000 0.004
#> GSM71702 1 0.0000 0.793 1.000 0.000 0 0.000 0.000
#> GSM71703 5 0.4256 -0.377 0.436 0.000 0 0.000 0.564
#> GSM71704 1 0.3876 0.601 0.684 0.000 0 0.000 0.316
#> GSM71705 1 0.0000 0.793 1.000 0.000 0 0.000 0.000
#> GSM71706 1 0.3913 0.597 0.676 0.000 0 0.000 0.324
#> GSM71707 1 0.0703 0.789 0.976 0.000 0 0.000 0.024
#> GSM71708 1 0.3895 0.599 0.680 0.000 0 0.000 0.320
#> GSM71709 4 0.0162 0.668 0.000 0.004 0 0.996 0.000
#> GSM71710 1 0.3816 0.532 0.696 0.000 0 0.000 0.304
#> GSM71711 1 0.0290 0.792 0.992 0.000 0 0.000 0.008
#> GSM71712 5 0.4403 0.441 0.008 0.000 0 0.384 0.608
#> GSM71713 5 0.4430 0.276 0.360 0.000 0 0.012 0.628
#> GSM71714 1 0.0162 0.792 0.996 0.000 0 0.000 0.004
#> GSM71715 5 0.5413 0.545 0.012 0.080 0 0.244 0.664
#> GSM71716 1 0.4060 0.433 0.640 0.000 0 0.000 0.360
#> GSM71717 1 0.4302 0.412 0.520 0.000 0 0.000 0.480
#> GSM71718 1 0.2561 0.712 0.856 0.000 0 0.000 0.144
#> GSM71719 1 0.3913 0.513 0.676 0.000 0 0.000 0.324
#> GSM71720 1 0.3366 0.625 0.768 0.000 0 0.000 0.232
#> GSM71721 1 0.0290 0.792 0.992 0.000 0 0.000 0.008
#> GSM71722 1 0.0290 0.792 0.992 0.000 0 0.000 0.008
#> GSM71723 1 0.0290 0.792 0.992 0.000 0 0.000 0.008
#> GSM71724 1 0.0162 0.792 0.996 0.000 0 0.000 0.004
#> GSM71725 5 0.4108 0.528 0.008 0.000 0 0.308 0.684
#> GSM71726 4 0.2074 0.604 0.000 0.000 0 0.896 0.104
#> GSM71727 4 0.2732 0.761 0.000 0.160 0 0.840 0.000
#> GSM71728 4 0.3837 0.274 0.000 0.000 0 0.692 0.308
#> GSM71729 4 0.2605 0.758 0.000 0.148 0 0.852 0.000
#> GSM71730 4 0.3534 0.737 0.000 0.256 0 0.744 0.000
#> GSM71731 1 0.0404 0.791 0.988 0.000 0 0.000 0.012
#> GSM71732 1 0.0000 0.793 1.000 0.000 0 0.000 0.000
#> GSM71733 1 0.0404 0.792 0.988 0.000 0 0.000 0.012
#> GSM71734 1 0.0290 0.792 0.992 0.000 0 0.000 0.008
#> GSM71735 1 0.3684 0.619 0.720 0.000 0 0.000 0.280
#> GSM71736 1 0.3452 0.653 0.756 0.000 0 0.000 0.244
#> GSM71737 1 0.4114 0.557 0.624 0.000 0 0.000 0.376
#> GSM71738 1 0.4219 0.512 0.584 0.000 0 0.000 0.416
#> GSM71739 5 0.5901 0.477 0.000 0.148 0 0.268 0.584
#> GSM71740 1 0.3452 0.631 0.756 0.000 0 0.000 0.244
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> GSM71671 3 0.0000 1.0000 0.000 0.000 1 0.000 0.000 0.000
#> GSM71672 3 0.0000 1.0000 0.000 0.000 1 0.000 0.000 0.000
#> GSM71673 3 0.0000 1.0000 0.000 0.000 1 0.000 0.000 0.000
#> GSM71674 3 0.0000 1.0000 0.000 0.000 1 0.000 0.000 0.000
#> GSM71675 3 0.0000 1.0000 0.000 0.000 1 0.000 0.000 0.000
#> GSM71676 3 0.0000 1.0000 0.000 0.000 1 0.000 0.000 0.000
#> GSM71677 3 0.0000 1.0000 0.000 0.000 1 0.000 0.000 0.000
#> GSM71678 2 0.3607 0.6265 0.000 0.652 0 0.000 0.000 0.348
#> GSM71679 2 0.3634 0.6221 0.000 0.644 0 0.000 0.000 0.356
#> GSM71680 4 0.4275 0.8801 0.000 0.004 0 0.592 0.388 0.016
#> GSM71681 2 0.4122 0.5942 0.000 0.704 0 0.248 0.048 0.000
#> GSM71682 2 0.3620 0.6240 0.000 0.648 0 0.000 0.000 0.352
#> GSM71683 2 0.0000 0.7673 0.000 1.000 0 0.000 0.000 0.000
#> GSM71684 2 0.4225 0.6143 0.000 0.712 0 0.240 0.036 0.012
#> GSM71685 2 0.4294 0.5821 0.000 0.692 0 0.248 0.060 0.000
#> GSM71686 2 0.3769 0.6210 0.000 0.640 0 0.004 0.000 0.356
#> GSM71687 2 0.0820 0.7670 0.000 0.972 0 0.000 0.016 0.012
#> GSM71688 2 0.3204 0.6921 0.000 0.820 0 0.144 0.032 0.004
#> GSM71689 3 0.0000 1.0000 0.000 0.000 1 0.000 0.000 0.000
#> GSM71690 2 0.0000 0.7673 0.000 1.000 0 0.000 0.000 0.000
#> GSM71691 2 0.0508 0.7659 0.000 0.984 0 0.000 0.004 0.012
#> GSM71692 3 0.0000 1.0000 0.000 0.000 1 0.000 0.000 0.000
#> GSM71693 2 0.0363 0.7668 0.000 0.988 0 0.000 0.012 0.000
#> GSM71694 3 0.0000 1.0000 0.000 0.000 1 0.000 0.000 0.000
#> GSM71695 2 0.0508 0.7659 0.000 0.984 0 0.000 0.004 0.012
#> GSM71696 1 0.4879 0.6365 0.692 0.000 0 0.084 0.024 0.200
#> GSM71697 1 0.2402 0.7269 0.868 0.000 0 0.000 0.012 0.120
#> GSM71698 1 0.0520 0.7561 0.984 0.000 0 0.008 0.000 0.008
#> GSM71699 6 0.6129 0.7584 0.340 0.000 0 0.320 0.000 0.340
#> GSM71700 1 0.0363 0.7544 0.988 0.000 0 0.000 0.000 0.012
#> GSM71701 1 0.4168 0.4999 0.696 0.000 0 0.256 0.000 0.048
#> GSM71702 1 0.3739 0.6285 0.768 0.000 0 0.176 0.000 0.056
#> GSM71703 6 0.5973 0.8962 0.188 0.000 0 0.324 0.008 0.480
#> GSM71704 6 0.5818 0.9217 0.196 0.000 0 0.340 0.000 0.464
#> GSM71705 1 0.3555 0.6269 0.780 0.000 0 0.176 0.000 0.044
#> GSM71706 6 0.5818 0.9217 0.196 0.000 0 0.340 0.000 0.464
#> GSM71707 1 0.4798 0.5407 0.672 0.000 0 0.172 0.000 0.156
#> GSM71708 6 0.5873 0.9167 0.208 0.000 0 0.340 0.000 0.452
#> GSM71709 4 0.4255 0.8843 0.000 0.004 0 0.600 0.380 0.016
#> GSM71710 1 0.5109 0.5856 0.660 0.000 0 0.192 0.012 0.136
#> GSM71711 1 0.1124 0.7624 0.956 0.000 0 0.008 0.000 0.036
#> GSM71712 5 0.0717 0.5794 0.000 0.000 0 0.016 0.976 0.008
#> GSM71713 5 0.6154 0.0684 0.404 0.004 0 0.012 0.416 0.164
#> GSM71714 1 0.3688 0.5548 0.724 0.000 0 0.256 0.000 0.020
#> GSM71715 5 0.3829 0.5515 0.024 0.016 0 0.000 0.760 0.200
#> GSM71716 1 0.4731 0.6508 0.708 0.000 0 0.132 0.012 0.148
#> GSM71717 6 0.5728 0.9096 0.180 0.000 0 0.336 0.000 0.484
#> GSM71718 1 0.2282 0.7481 0.900 0.000 0 0.020 0.012 0.068
#> GSM71719 1 0.2890 0.7195 0.848 0.000 0 0.016 0.012 0.124
#> GSM71720 1 0.2282 0.7481 0.900 0.000 0 0.020 0.012 0.068
#> GSM71721 1 0.0806 0.7535 0.972 0.000 0 0.020 0.000 0.008
#> GSM71722 1 0.0458 0.7620 0.984 0.000 0 0.000 0.000 0.016
#> GSM71723 1 0.1265 0.7614 0.948 0.000 0 0.008 0.000 0.044
#> GSM71724 1 0.3979 0.5253 0.708 0.000 0 0.256 0.000 0.036
#> GSM71725 5 0.1531 0.6104 0.000 0.004 0 0.000 0.928 0.068
#> GSM71726 5 0.2744 0.3519 0.000 0.000 0 0.144 0.840 0.016
#> GSM71727 4 0.4283 0.8826 0.000 0.024 0 0.592 0.384 0.000
#> GSM71728 5 0.1387 0.5250 0.000 0.000 0 0.068 0.932 0.000
#> GSM71729 4 0.5016 0.8066 0.000 0.076 0 0.532 0.392 0.000
#> GSM71730 2 0.5390 0.2888 0.000 0.532 0 0.340 0.128 0.000
#> GSM71731 1 0.0547 0.7624 0.980 0.000 0 0.000 0.000 0.020
#> GSM71732 1 0.1643 0.7461 0.924 0.000 0 0.068 0.000 0.008
#> GSM71733 1 0.1333 0.7615 0.944 0.000 0 0.008 0.000 0.048
#> GSM71734 1 0.4473 0.4413 0.676 0.000 0 0.252 0.000 0.072
#> GSM71735 6 0.6128 0.7843 0.320 0.000 0 0.332 0.000 0.348
#> GSM71736 1 0.6123 -0.7720 0.348 0.000 0 0.308 0.000 0.344
#> GSM71737 6 0.5779 0.9190 0.188 0.000 0 0.340 0.000 0.472
#> GSM71738 6 0.5924 0.9132 0.196 0.000 0 0.328 0.004 0.472
#> GSM71739 5 0.2821 0.5884 0.000 0.016 0 0.000 0.832 0.152
#> GSM71740 1 0.2714 0.7138 0.848 0.000 0 0.004 0.012 0.136
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) k
#> MAD:mclust 70 3.59e-09 2
#> MAD:mclust 69 8.13e-16 3
#> MAD:mclust 69 3.88e-18 4
#> MAD:mclust 62 4.04e-15 5
#> MAD:mclust 64 1.77e-16 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 21168 rows and 70 columns.
#> Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'MAD' method.
#> Subgroups are detected by 'NMF' method.
#> Performed in total 1250 partitions by row resampling.
#> Best k for subgroups seems to be 3.
#>
#> Following methods can be applied to this 'ConsensusPartition' object:
#> [1] "cola_report" "collect_classes" "collect_plots"
#> [4] "collect_stats" "colnames" "compare_signatures"
#> [7] "consensus_heatmap" "dimension_reduction" "functional_enrichment"
#> [10] "get_anno_col" "get_anno" "get_classes"
#> [13] "get_consensus" "get_matrix" "get_membership"
#> [16] "get_param" "get_signatures" "get_stats"
#> [19] "is_best_k" "is_stable_k" "membership_heatmap"
#> [22] "ncol" "nrow" "plot_ecdf"
#> [25] "rownames" "select_partition_number" "show"
#> [28] "suggest_best_k" "test_to_known_factors"
collect_plots()
function collects all the plots made from res
for all k
(number of partitions)
into one single page to provide an easy and fast comparison between different k
.
collect_plots(res)
The plots are:
k
and the heatmap of
predicted classes for each k
.k
.k
.k
.All the plots in panels can be made by individual functions and they are plotted later in this section.
select_partition_number()
produces several plots showing different
statistics for choosing “optimized” k
. There are following statistics:
k
;k
, the area increased is defined as \(A_k - A_{k-1}\).The detailed explanations of these statistics can be found in the cola vignette.
Generally speaking, lower PAC score, higher mean silhouette score or higher
concordance corresponds to better partition. Rand index and Jaccard index
measure how similar the current partition is compared to partition with k-1
.
If they are too similar, we won't accept k
is better than k-1
.
select_partition_number(res)
The numeric values for all these statistics can be obtained by get_stats()
.
get_stats(res)
#> k 1-PAC mean_silhouette concordance area_increased Rand Jaccard
#> 2 2 1.000 0.986 0.994 0.5027 0.496 0.496
#> 3 3 0.937 0.873 0.949 0.2323 0.851 0.708
#> 4 4 0.856 0.887 0.914 0.0766 0.919 0.796
#> 5 5 0.745 0.820 0.879 0.1559 0.867 0.608
#> 6 6 0.746 0.731 0.849 0.0315 0.978 0.897
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
#> GSM71671 2 0.000 0.986 0.000 1.000
#> GSM71672 2 0.000 0.986 0.000 1.000
#> GSM71673 2 0.000 0.986 0.000 1.000
#> GSM71674 2 0.000 0.986 0.000 1.000
#> GSM71675 2 0.000 0.986 0.000 1.000
#> GSM71676 2 0.000 0.986 0.000 1.000
#> GSM71677 2 0.000 0.986 0.000 1.000
#> GSM71678 2 0.000 0.986 0.000 1.000
#> GSM71679 2 0.000 0.986 0.000 1.000
#> GSM71680 2 0.000 0.986 0.000 1.000
#> GSM71681 2 0.000 0.986 0.000 1.000
#> GSM71682 2 0.000 0.986 0.000 1.000
#> GSM71683 2 0.000 0.986 0.000 1.000
#> GSM71684 2 0.000 0.986 0.000 1.000
#> GSM71685 2 0.000 0.986 0.000 1.000
#> GSM71686 2 0.000 0.986 0.000 1.000
#> GSM71687 2 0.000 0.986 0.000 1.000
#> GSM71688 2 0.000 0.986 0.000 1.000
#> GSM71689 2 0.000 0.986 0.000 1.000
#> GSM71690 2 0.000 0.986 0.000 1.000
#> GSM71691 2 0.000 0.986 0.000 1.000
#> GSM71692 2 0.000 0.986 0.000 1.000
#> GSM71693 2 0.000 0.986 0.000 1.000
#> GSM71694 2 0.000 0.986 0.000 1.000
#> GSM71695 2 0.000 0.986 0.000 1.000
#> GSM71696 1 0.000 1.000 1.000 0.000
#> GSM71697 1 0.000 1.000 1.000 0.000
#> GSM71698 1 0.000 1.000 1.000 0.000
#> GSM71699 1 0.000 1.000 1.000 0.000
#> GSM71700 1 0.000 1.000 1.000 0.000
#> GSM71701 1 0.000 1.000 1.000 0.000
#> GSM71702 1 0.000 1.000 1.000 0.000
#> GSM71703 1 0.000 1.000 1.000 0.000
#> GSM71704 1 0.000 1.000 1.000 0.000
#> GSM71705 1 0.000 1.000 1.000 0.000
#> GSM71706 1 0.000 1.000 1.000 0.000
#> GSM71707 1 0.000 1.000 1.000 0.000
#> GSM71708 1 0.000 1.000 1.000 0.000
#> GSM71709 2 0.000 0.986 0.000 1.000
#> GSM71710 1 0.000 1.000 1.000 0.000
#> GSM71711 1 0.000 1.000 1.000 0.000
#> GSM71712 1 0.000 1.000 1.000 0.000
#> GSM71713 1 0.000 1.000 1.000 0.000
#> GSM71714 1 0.000 1.000 1.000 0.000
#> GSM71715 1 0.000 1.000 1.000 0.000
#> GSM71716 1 0.000 1.000 1.000 0.000
#> GSM71717 1 0.000 1.000 1.000 0.000
#> GSM71718 1 0.000 1.000 1.000 0.000
#> GSM71719 1 0.000 1.000 1.000 0.000
#> GSM71720 1 0.000 1.000 1.000 0.000
#> GSM71721 1 0.000 1.000 1.000 0.000
#> GSM71722 1 0.000 1.000 1.000 0.000
#> GSM71723 1 0.000 1.000 1.000 0.000
#> GSM71724 1 0.000 1.000 1.000 0.000
#> GSM71725 1 0.000 1.000 1.000 0.000
#> GSM71726 2 0.242 0.950 0.040 0.960
#> GSM71727 2 0.000 0.986 0.000 1.000
#> GSM71728 2 0.595 0.835 0.144 0.856
#> GSM71729 2 0.000 0.986 0.000 1.000
#> GSM71730 2 0.000 0.986 0.000 1.000
#> GSM71731 1 0.000 1.000 1.000 0.000
#> GSM71732 1 0.000 1.000 1.000 0.000
#> GSM71733 1 0.000 1.000 1.000 0.000
#> GSM71734 1 0.000 1.000 1.000 0.000
#> GSM71735 1 0.000 1.000 1.000 0.000
#> GSM71736 1 0.000 1.000 1.000 0.000
#> GSM71737 1 0.000 1.000 1.000 0.000
#> GSM71738 1 0.000 1.000 1.000 0.000
#> GSM71739 2 0.821 0.664 0.256 0.744
#> GSM71740 1 0.000 1.000 1.000 0.000
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> GSM71671 3 0.0000 0.8643 0.000 0.000 1.000
#> GSM71672 3 0.0000 0.8643 0.000 0.000 1.000
#> GSM71673 3 0.0000 0.8643 0.000 0.000 1.000
#> GSM71674 3 0.0000 0.8643 0.000 0.000 1.000
#> GSM71675 3 0.0000 0.8643 0.000 0.000 1.000
#> GSM71676 3 0.0000 0.8643 0.000 0.000 1.000
#> GSM71677 3 0.0000 0.8643 0.000 0.000 1.000
#> GSM71678 2 0.2448 0.8621 0.000 0.924 0.076
#> GSM71679 2 0.1860 0.8705 0.000 0.948 0.052
#> GSM71680 2 0.0000 0.8639 0.000 1.000 0.000
#> GSM71681 2 0.6062 0.4246 0.000 0.616 0.384
#> GSM71682 2 0.1964 0.8700 0.000 0.944 0.056
#> GSM71683 3 0.6308 -0.0950 0.000 0.492 0.508
#> GSM71684 2 0.2537 0.8607 0.000 0.920 0.080
#> GSM71685 3 0.6280 0.0468 0.000 0.460 0.540
#> GSM71686 2 0.1964 0.8700 0.000 0.944 0.056
#> GSM71687 2 0.6225 0.2776 0.000 0.568 0.432
#> GSM71688 3 0.6225 0.1417 0.000 0.432 0.568
#> GSM71689 3 0.0000 0.8643 0.000 0.000 1.000
#> GSM71690 2 0.5560 0.6158 0.000 0.700 0.300
#> GSM71691 3 0.1031 0.8484 0.000 0.024 0.976
#> GSM71692 3 0.0000 0.8643 0.000 0.000 1.000
#> GSM71693 3 0.4796 0.6284 0.000 0.220 0.780
#> GSM71694 3 0.0000 0.8643 0.000 0.000 1.000
#> GSM71695 3 0.0237 0.8622 0.000 0.004 0.996
#> GSM71696 1 0.0000 0.9999 1.000 0.000 0.000
#> GSM71697 1 0.0000 0.9999 1.000 0.000 0.000
#> GSM71698 1 0.0000 0.9999 1.000 0.000 0.000
#> GSM71699 1 0.0000 0.9999 1.000 0.000 0.000
#> GSM71700 1 0.0000 0.9999 1.000 0.000 0.000
#> GSM71701 1 0.0000 0.9999 1.000 0.000 0.000
#> GSM71702 1 0.0000 0.9999 1.000 0.000 0.000
#> GSM71703 1 0.0000 0.9999 1.000 0.000 0.000
#> GSM71704 1 0.0000 0.9999 1.000 0.000 0.000
#> GSM71705 1 0.0000 0.9999 1.000 0.000 0.000
#> GSM71706 1 0.0000 0.9999 1.000 0.000 0.000
#> GSM71707 1 0.0000 0.9999 1.000 0.000 0.000
#> GSM71708 1 0.0000 0.9999 1.000 0.000 0.000
#> GSM71709 2 0.1031 0.8658 0.000 0.976 0.024
#> GSM71710 1 0.0000 0.9999 1.000 0.000 0.000
#> GSM71711 1 0.0000 0.9999 1.000 0.000 0.000
#> GSM71712 2 0.0000 0.8639 0.000 1.000 0.000
#> GSM71713 1 0.0000 0.9999 1.000 0.000 0.000
#> GSM71714 1 0.0000 0.9999 1.000 0.000 0.000
#> GSM71715 1 0.0237 0.9956 0.996 0.000 0.004
#> GSM71716 1 0.0000 0.9999 1.000 0.000 0.000
#> GSM71717 1 0.0000 0.9999 1.000 0.000 0.000
#> GSM71718 1 0.0000 0.9999 1.000 0.000 0.000
#> GSM71719 1 0.0000 0.9999 1.000 0.000 0.000
#> GSM71720 1 0.0000 0.9999 1.000 0.000 0.000
#> GSM71721 1 0.0000 0.9999 1.000 0.000 0.000
#> GSM71722 1 0.0000 0.9999 1.000 0.000 0.000
#> GSM71723 1 0.0000 0.9999 1.000 0.000 0.000
#> GSM71724 1 0.0000 0.9999 1.000 0.000 0.000
#> GSM71725 2 0.0592 0.8560 0.012 0.988 0.000
#> GSM71726 2 0.0000 0.8639 0.000 1.000 0.000
#> GSM71727 2 0.1411 0.8709 0.000 0.964 0.036
#> GSM71728 2 0.0000 0.8639 0.000 1.000 0.000
#> GSM71729 2 0.0237 0.8655 0.000 0.996 0.004
#> GSM71730 2 0.4235 0.7819 0.000 0.824 0.176
#> GSM71731 1 0.0000 0.9999 1.000 0.000 0.000
#> GSM71732 1 0.0000 0.9999 1.000 0.000 0.000
#> GSM71733 1 0.0000 0.9999 1.000 0.000 0.000
#> GSM71734 1 0.0000 0.9999 1.000 0.000 0.000
#> GSM71735 1 0.0000 0.9999 1.000 0.000 0.000
#> GSM71736 1 0.0000 0.9999 1.000 0.000 0.000
#> GSM71737 1 0.0000 0.9999 1.000 0.000 0.000
#> GSM71738 1 0.0000 0.9999 1.000 0.000 0.000
#> GSM71739 2 0.5737 0.6743 0.012 0.732 0.256
#> GSM71740 1 0.0000 0.9999 1.000 0.000 0.000
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> GSM71671 3 0.1388 0.910 0.000 0.012 0.960 0.028
#> GSM71672 3 0.1022 0.936 0.000 0.032 0.968 0.000
#> GSM71673 3 0.1151 0.932 0.000 0.024 0.968 0.008
#> GSM71674 3 0.1356 0.906 0.000 0.008 0.960 0.032
#> GSM71675 3 0.0921 0.936 0.000 0.028 0.972 0.000
#> GSM71676 3 0.1109 0.935 0.000 0.028 0.968 0.004
#> GSM71677 3 0.2408 0.910 0.000 0.104 0.896 0.000
#> GSM71678 2 0.1474 0.820 0.000 0.948 0.000 0.052
#> GSM71679 2 0.1474 0.820 0.000 0.948 0.000 0.052
#> GSM71680 4 0.4780 0.800 0.000 0.096 0.116 0.788
#> GSM71681 2 0.1635 0.851 0.000 0.948 0.044 0.008
#> GSM71682 2 0.1389 0.822 0.000 0.952 0.000 0.048
#> GSM71683 2 0.1792 0.850 0.000 0.932 0.068 0.000
#> GSM71684 2 0.1792 0.805 0.000 0.932 0.000 0.068
#> GSM71685 2 0.4206 0.790 0.000 0.816 0.136 0.048
#> GSM71686 2 0.1022 0.831 0.000 0.968 0.000 0.032
#> GSM71687 2 0.1792 0.850 0.000 0.932 0.068 0.000
#> GSM71688 2 0.2216 0.841 0.000 0.908 0.092 0.000
#> GSM71689 3 0.3024 0.871 0.000 0.148 0.852 0.000
#> GSM71690 2 0.0817 0.849 0.000 0.976 0.024 0.000
#> GSM71691 2 0.4431 0.597 0.000 0.696 0.304 0.000
#> GSM71692 3 0.2081 0.922 0.000 0.084 0.916 0.000
#> GSM71693 2 0.3356 0.779 0.000 0.824 0.176 0.000
#> GSM71694 3 0.3172 0.857 0.000 0.160 0.840 0.000
#> GSM71695 2 0.4697 0.489 0.000 0.644 0.356 0.000
#> GSM71696 1 0.0000 0.961 1.000 0.000 0.000 0.000
#> GSM71697 1 0.0000 0.961 1.000 0.000 0.000 0.000
#> GSM71698 1 0.2546 0.946 0.900 0.000 0.008 0.092
#> GSM71699 1 0.2611 0.944 0.896 0.000 0.008 0.096
#> GSM71700 1 0.1022 0.961 0.968 0.000 0.000 0.032
#> GSM71701 1 0.2611 0.944 0.896 0.000 0.008 0.096
#> GSM71702 1 0.2281 0.948 0.904 0.000 0.000 0.096
#> GSM71703 1 0.2281 0.948 0.904 0.000 0.000 0.096
#> GSM71704 1 0.2216 0.949 0.908 0.000 0.000 0.092
#> GSM71705 1 0.1940 0.955 0.924 0.000 0.000 0.076
#> GSM71706 1 0.1940 0.955 0.924 0.000 0.000 0.076
#> GSM71707 1 0.2011 0.953 0.920 0.000 0.000 0.080
#> GSM71708 1 0.2149 0.951 0.912 0.000 0.000 0.088
#> GSM71709 4 0.4549 0.813 0.000 0.096 0.100 0.804
#> GSM71710 1 0.0000 0.961 1.000 0.000 0.000 0.000
#> GSM71711 1 0.0000 0.961 1.000 0.000 0.000 0.000
#> GSM71712 4 0.3448 0.843 0.000 0.168 0.004 0.828
#> GSM71713 1 0.2611 0.944 0.896 0.000 0.008 0.096
#> GSM71714 1 0.0000 0.961 1.000 0.000 0.000 0.000
#> GSM71715 1 0.1209 0.941 0.964 0.032 0.000 0.004
#> GSM71716 1 0.0000 0.961 1.000 0.000 0.000 0.000
#> GSM71717 1 0.0000 0.961 1.000 0.000 0.000 0.000
#> GSM71718 1 0.0707 0.953 0.980 0.000 0.000 0.020
#> GSM71719 1 0.0336 0.958 0.992 0.000 0.000 0.008
#> GSM71720 1 0.0469 0.957 0.988 0.000 0.000 0.012
#> GSM71721 1 0.2081 0.952 0.916 0.000 0.000 0.084
#> GSM71722 1 0.0469 0.962 0.988 0.000 0.000 0.012
#> GSM71723 1 0.0000 0.961 1.000 0.000 0.000 0.000
#> GSM71724 1 0.2011 0.954 0.920 0.000 0.000 0.080
#> GSM71725 4 0.6145 0.724 0.092 0.236 0.004 0.668
#> GSM71726 4 0.2860 0.845 0.004 0.100 0.008 0.888
#> GSM71727 4 0.3271 0.851 0.000 0.132 0.012 0.856
#> GSM71728 4 0.3024 0.848 0.000 0.148 0.000 0.852
#> GSM71729 4 0.5168 0.355 0.000 0.492 0.004 0.504
#> GSM71730 4 0.5168 0.767 0.000 0.248 0.040 0.712
#> GSM71731 1 0.0188 0.960 0.996 0.000 0.000 0.004
#> GSM71732 1 0.0000 0.961 1.000 0.000 0.000 0.000
#> GSM71733 1 0.0188 0.962 0.996 0.000 0.000 0.004
#> GSM71734 1 0.1940 0.955 0.924 0.000 0.000 0.076
#> GSM71735 1 0.0336 0.962 0.992 0.000 0.000 0.008
#> GSM71736 1 0.2401 0.948 0.904 0.000 0.004 0.092
#> GSM71737 1 0.0188 0.962 0.996 0.000 0.000 0.004
#> GSM71738 1 0.1637 0.958 0.940 0.000 0.000 0.060
#> GSM71739 2 0.3037 0.774 0.100 0.880 0.020 0.000
#> GSM71740 1 0.0000 0.961 1.000 0.000 0.000 0.000
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> GSM71671 3 0.0880 0.924 0.000 0.000 0.968 0.032 0.000
#> GSM71672 3 0.0290 0.941 0.000 0.008 0.992 0.000 0.000
#> GSM71673 3 0.0671 0.935 0.000 0.004 0.980 0.016 0.000
#> GSM71674 3 0.0963 0.921 0.000 0.000 0.964 0.036 0.000
#> GSM71675 3 0.0290 0.941 0.000 0.008 0.992 0.000 0.000
#> GSM71676 3 0.0693 0.941 0.000 0.012 0.980 0.008 0.000
#> GSM71677 3 0.1478 0.923 0.000 0.064 0.936 0.000 0.000
#> GSM71678 2 0.0955 0.882 0.000 0.968 0.004 0.028 0.000
#> GSM71679 2 0.0794 0.880 0.000 0.972 0.000 0.028 0.000
#> GSM71680 4 0.2462 0.752 0.008 0.000 0.112 0.880 0.000
#> GSM71681 2 0.0807 0.887 0.000 0.976 0.012 0.012 0.000
#> GSM71682 2 0.1082 0.879 0.008 0.964 0.000 0.028 0.000
#> GSM71683 2 0.1043 0.885 0.000 0.960 0.040 0.000 0.000
#> GSM71684 2 0.1270 0.866 0.000 0.948 0.000 0.052 0.000
#> GSM71685 2 0.2504 0.853 0.000 0.896 0.040 0.064 0.000
#> GSM71686 2 0.1211 0.878 0.016 0.960 0.000 0.024 0.000
#> GSM71687 2 0.0963 0.886 0.000 0.964 0.036 0.000 0.000
#> GSM71688 2 0.1270 0.881 0.000 0.948 0.052 0.000 0.000
#> GSM71689 3 0.2179 0.885 0.000 0.112 0.888 0.000 0.000
#> GSM71690 2 0.0510 0.888 0.000 0.984 0.016 0.000 0.000
#> GSM71691 2 0.2813 0.787 0.000 0.832 0.168 0.000 0.000
#> GSM71692 3 0.1331 0.933 0.008 0.040 0.952 0.000 0.000
#> GSM71693 2 0.1671 0.866 0.000 0.924 0.076 0.000 0.000
#> GSM71694 3 0.2605 0.846 0.000 0.148 0.852 0.000 0.000
#> GSM71695 2 0.3586 0.654 0.000 0.736 0.264 0.000 0.000
#> GSM71696 5 0.1270 0.897 0.052 0.000 0.000 0.000 0.948
#> GSM71697 5 0.0794 0.901 0.028 0.000 0.000 0.000 0.972
#> GSM71698 1 0.2179 0.874 0.888 0.000 0.000 0.000 0.112
#> GSM71699 1 0.2020 0.864 0.900 0.000 0.000 0.000 0.100
#> GSM71700 5 0.4268 -0.103 0.444 0.000 0.000 0.000 0.556
#> GSM71701 1 0.2439 0.878 0.876 0.000 0.004 0.000 0.120
#> GSM71702 1 0.2516 0.885 0.860 0.000 0.000 0.000 0.140
#> GSM71703 1 0.2230 0.876 0.884 0.000 0.000 0.000 0.116
#> GSM71704 1 0.2732 0.886 0.840 0.000 0.000 0.000 0.160
#> GSM71705 1 0.3707 0.810 0.716 0.000 0.000 0.000 0.284
#> GSM71706 1 0.3039 0.880 0.808 0.000 0.000 0.000 0.192
#> GSM71707 1 0.3305 0.864 0.776 0.000 0.000 0.000 0.224
#> GSM71708 1 0.2561 0.885 0.856 0.000 0.000 0.000 0.144
#> GSM71709 4 0.2574 0.750 0.012 0.000 0.112 0.876 0.000
#> GSM71710 5 0.0510 0.900 0.016 0.000 0.000 0.000 0.984
#> GSM71711 5 0.1544 0.889 0.068 0.000 0.000 0.000 0.932
#> GSM71712 4 0.4034 0.783 0.100 0.084 0.000 0.808 0.008
#> GSM71713 1 0.1341 0.814 0.944 0.000 0.000 0.000 0.056
#> GSM71714 5 0.1197 0.899 0.048 0.000 0.000 0.000 0.952
#> GSM71715 5 0.0566 0.892 0.012 0.000 0.004 0.000 0.984
#> GSM71716 5 0.0510 0.884 0.016 0.000 0.000 0.000 0.984
#> GSM71717 5 0.1043 0.901 0.040 0.000 0.000 0.000 0.960
#> GSM71718 5 0.0566 0.887 0.004 0.000 0.000 0.012 0.984
#> GSM71719 5 0.1740 0.829 0.056 0.000 0.000 0.012 0.932
#> GSM71720 5 0.0566 0.887 0.004 0.000 0.000 0.012 0.984
#> GSM71721 1 0.6172 0.505 0.500 0.000 0.000 0.144 0.356
#> GSM71722 5 0.2966 0.755 0.184 0.000 0.000 0.000 0.816
#> GSM71723 5 0.1544 0.889 0.068 0.000 0.000 0.000 0.932
#> GSM71724 1 0.3424 0.854 0.760 0.000 0.000 0.000 0.240
#> GSM71725 4 0.6705 0.414 0.076 0.060 0.000 0.500 0.364
#> GSM71726 4 0.1256 0.797 0.012 0.008 0.012 0.964 0.004
#> GSM71727 4 0.1216 0.797 0.000 0.020 0.020 0.960 0.000
#> GSM71728 4 0.3178 0.793 0.068 0.036 0.000 0.872 0.024
#> GSM71729 4 0.4565 0.372 0.012 0.408 0.000 0.580 0.000
#> GSM71730 4 0.3527 0.722 0.000 0.192 0.016 0.792 0.000
#> GSM71731 5 0.0162 0.892 0.000 0.000 0.000 0.004 0.996
#> GSM71732 5 0.0963 0.902 0.036 0.000 0.000 0.000 0.964
#> GSM71733 5 0.2852 0.773 0.172 0.000 0.000 0.000 0.828
#> GSM71734 1 0.3949 0.740 0.668 0.000 0.000 0.000 0.332
#> GSM71735 5 0.3039 0.743 0.192 0.000 0.000 0.000 0.808
#> GSM71736 1 0.3039 0.880 0.808 0.000 0.000 0.000 0.192
#> GSM71737 5 0.1671 0.883 0.076 0.000 0.000 0.000 0.924
#> GSM71738 1 0.3857 0.774 0.688 0.000 0.000 0.000 0.312
#> GSM71739 2 0.4691 0.386 0.004 0.604 0.008 0.004 0.380
#> GSM71740 5 0.0404 0.899 0.012 0.000 0.000 0.000 0.988
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> GSM71671 3 0.0547 0.9353 0.000 0.000 0.980 0.020 0.000 0.000
#> GSM71672 3 0.0603 0.9454 0.000 0.016 0.980 0.000 0.004 0.000
#> GSM71673 3 0.0260 0.9405 0.000 0.000 0.992 0.008 0.000 0.000
#> GSM71674 3 0.0777 0.9367 0.000 0.004 0.972 0.024 0.000 0.000
#> GSM71675 3 0.0363 0.9448 0.000 0.012 0.988 0.000 0.000 0.000
#> GSM71676 3 0.1760 0.9338 0.000 0.048 0.928 0.020 0.004 0.000
#> GSM71677 3 0.1471 0.9305 0.000 0.064 0.932 0.000 0.004 0.000
#> GSM71678 2 0.2402 0.7913 0.000 0.856 0.000 0.004 0.140 0.000
#> GSM71679 2 0.2871 0.7649 0.000 0.804 0.000 0.004 0.192 0.000
#> GSM71680 4 0.1204 0.6711 0.000 0.000 0.056 0.944 0.000 0.000
#> GSM71681 2 0.0146 0.8078 0.000 0.996 0.004 0.000 0.000 0.000
#> GSM71682 2 0.3534 0.6924 0.000 0.716 0.000 0.008 0.276 0.000
#> GSM71683 2 0.0260 0.8077 0.000 0.992 0.008 0.000 0.000 0.000
#> GSM71684 2 0.2988 0.7786 0.000 0.824 0.000 0.024 0.152 0.000
#> GSM71685 2 0.2094 0.7698 0.000 0.908 0.024 0.064 0.004 0.000
#> GSM71686 2 0.3707 0.6504 0.000 0.680 0.000 0.008 0.312 0.000
#> GSM71687 2 0.2191 0.8018 0.000 0.876 0.004 0.000 0.120 0.000
#> GSM71688 2 0.0458 0.8062 0.000 0.984 0.016 0.000 0.000 0.000
#> GSM71689 3 0.2039 0.9260 0.000 0.052 0.916 0.020 0.012 0.000
#> GSM71690 2 0.0777 0.8102 0.000 0.972 0.004 0.000 0.024 0.000
#> GSM71691 2 0.4425 0.6546 0.000 0.716 0.152 0.000 0.132 0.000
#> GSM71692 3 0.1616 0.9357 0.000 0.028 0.940 0.020 0.012 0.000
#> GSM71693 2 0.0713 0.8025 0.000 0.972 0.028 0.000 0.000 0.000
#> GSM71694 3 0.3385 0.8256 0.000 0.156 0.808 0.016 0.020 0.000
#> GSM71695 2 0.4739 0.0963 0.000 0.516 0.436 0.000 0.048 0.000
#> GSM71696 1 0.1930 0.8562 0.916 0.000 0.000 0.000 0.036 0.048
#> GSM71697 1 0.0806 0.8738 0.972 0.000 0.000 0.000 0.008 0.020
#> GSM71698 6 0.2344 0.7257 0.028 0.000 0.000 0.004 0.076 0.892
#> GSM71699 6 0.1124 0.7395 0.036 0.000 0.000 0.000 0.008 0.956
#> GSM71700 1 0.4026 0.2148 0.612 0.000 0.000 0.000 0.012 0.376
#> GSM71701 6 0.2451 0.7573 0.056 0.000 0.000 0.000 0.060 0.884
#> GSM71702 6 0.1806 0.7768 0.088 0.000 0.000 0.000 0.004 0.908
#> GSM71703 6 0.1838 0.7638 0.068 0.000 0.000 0.000 0.016 0.916
#> GSM71704 6 0.2573 0.7834 0.112 0.000 0.000 0.000 0.024 0.864
#> GSM71705 6 0.4640 0.5319 0.376 0.000 0.000 0.000 0.048 0.576
#> GSM71706 6 0.3385 0.7767 0.180 0.000 0.000 0.000 0.032 0.788
#> GSM71707 6 0.4142 0.7304 0.232 0.000 0.000 0.000 0.056 0.712
#> GSM71708 6 0.2937 0.7701 0.100 0.000 0.004 0.000 0.044 0.852
#> GSM71709 4 0.1204 0.6701 0.000 0.000 0.056 0.944 0.000 0.000
#> GSM71710 1 0.0508 0.8738 0.984 0.000 0.000 0.000 0.004 0.012
#> GSM71711 1 0.1151 0.8705 0.956 0.000 0.000 0.000 0.012 0.032
#> GSM71712 5 0.4353 0.7676 0.000 0.012 0.000 0.204 0.724 0.060
#> GSM71713 6 0.3740 0.3536 0.000 0.000 0.008 0.012 0.252 0.728
#> GSM71714 1 0.0692 0.8742 0.976 0.000 0.000 0.000 0.004 0.020
#> GSM71715 1 0.0653 0.8720 0.980 0.004 0.000 0.000 0.012 0.004
#> GSM71716 1 0.1267 0.8426 0.940 0.000 0.000 0.000 0.060 0.000
#> GSM71717 1 0.0405 0.8732 0.988 0.000 0.000 0.000 0.008 0.004
#> GSM71718 1 0.2308 0.8312 0.880 0.000 0.000 0.004 0.108 0.008
#> GSM71719 1 0.1556 0.8288 0.920 0.000 0.000 0.000 0.080 0.000
#> GSM71720 1 0.1668 0.8475 0.928 0.000 0.000 0.004 0.060 0.008
#> GSM71721 1 0.6874 -0.1828 0.420 0.000 0.000 0.140 0.096 0.344
#> GSM71722 1 0.3754 0.7198 0.776 0.000 0.000 0.000 0.072 0.152
#> GSM71723 1 0.1007 0.8681 0.956 0.000 0.000 0.000 0.000 0.044
#> GSM71724 6 0.4186 0.6499 0.312 0.000 0.000 0.000 0.032 0.656
#> GSM71725 5 0.3172 0.7385 0.040 0.016 0.000 0.100 0.844 0.000
#> GSM71726 4 0.2340 0.5373 0.000 0.000 0.000 0.852 0.148 0.000
#> GSM71727 4 0.1649 0.6770 0.000 0.032 0.036 0.932 0.000 0.000
#> GSM71728 5 0.3742 0.6520 0.004 0.000 0.000 0.348 0.648 0.000
#> GSM71729 4 0.5677 0.0285 0.000 0.404 0.000 0.440 0.156 0.000
#> GSM71730 4 0.3352 0.5569 0.000 0.176 0.032 0.792 0.000 0.000
#> GSM71731 1 0.0858 0.8650 0.968 0.000 0.000 0.000 0.028 0.004
#> GSM71732 1 0.2433 0.8392 0.884 0.000 0.000 0.000 0.072 0.044
#> GSM71733 1 0.2053 0.8179 0.888 0.000 0.000 0.000 0.004 0.108
#> GSM71734 6 0.4945 0.2906 0.452 0.000 0.000 0.000 0.064 0.484
#> GSM71735 1 0.2613 0.7737 0.848 0.000 0.000 0.000 0.012 0.140
#> GSM71736 6 0.3122 0.7842 0.160 0.000 0.004 0.000 0.020 0.816
#> GSM71737 1 0.1320 0.8694 0.948 0.000 0.000 0.000 0.016 0.036
#> GSM71738 6 0.4101 0.4982 0.408 0.000 0.000 0.000 0.012 0.580
#> GSM71739 2 0.3136 0.5863 0.228 0.768 0.004 0.000 0.000 0.000
#> GSM71740 1 0.0458 0.8690 0.984 0.000 0.000 0.000 0.016 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) k
#> MAD:NMF 70 9.38e-11 2
#> MAD:NMF 65 6.08e-12 3
#> MAD:NMF 68 9.63e-19 4
#> MAD:NMF 66 4.31e-18 5
#> MAD:NMF 63 5.07e-15 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 21168 rows and 70 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 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.00 0.991 0.993 0.2548 0.752 0.752
#> 3 3 1.00 1.000 1.000 1.2429 0.677 0.571
#> 4 4 1.00 0.996 0.998 0.1099 0.939 0.857
#> 5 5 1.00 0.996 0.998 0.0104 0.993 0.982
#> 6 6 0.97 0.989 0.980 0.0401 0.971 0.920
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
#> GSM71671 2 0.000 1.000 0.000 1.000
#> GSM71672 2 0.000 1.000 0.000 1.000
#> GSM71673 2 0.000 1.000 0.000 1.000
#> GSM71674 2 0.000 1.000 0.000 1.000
#> GSM71675 2 0.000 1.000 0.000 1.000
#> GSM71676 2 0.000 1.000 0.000 1.000
#> GSM71677 2 0.000 1.000 0.000 1.000
#> GSM71678 1 0.163 0.983 0.976 0.024
#> GSM71679 1 0.163 0.983 0.976 0.024
#> GSM71680 1 0.163 0.983 0.976 0.024
#> GSM71681 1 0.163 0.983 0.976 0.024
#> GSM71682 1 0.163 0.983 0.976 0.024
#> GSM71683 1 0.163 0.983 0.976 0.024
#> GSM71684 1 0.163 0.983 0.976 0.024
#> GSM71685 1 0.163 0.983 0.976 0.024
#> GSM71686 1 0.163 0.983 0.976 0.024
#> GSM71687 1 0.163 0.983 0.976 0.024
#> GSM71688 1 0.163 0.983 0.976 0.024
#> GSM71689 2 0.000 1.000 0.000 1.000
#> GSM71690 1 0.163 0.983 0.976 0.024
#> GSM71691 1 0.163 0.983 0.976 0.024
#> GSM71692 2 0.000 1.000 0.000 1.000
#> GSM71693 1 0.163 0.983 0.976 0.024
#> GSM71694 2 0.000 1.000 0.000 1.000
#> GSM71695 1 0.163 0.983 0.976 0.024
#> GSM71696 1 0.000 0.992 1.000 0.000
#> GSM71697 1 0.000 0.992 1.000 0.000
#> GSM71698 1 0.000 0.992 1.000 0.000
#> GSM71699 1 0.000 0.992 1.000 0.000
#> GSM71700 1 0.000 0.992 1.000 0.000
#> GSM71701 1 0.000 0.992 1.000 0.000
#> GSM71702 1 0.000 0.992 1.000 0.000
#> GSM71703 1 0.000 0.992 1.000 0.000
#> GSM71704 1 0.000 0.992 1.000 0.000
#> GSM71705 1 0.000 0.992 1.000 0.000
#> GSM71706 1 0.000 0.992 1.000 0.000
#> GSM71707 1 0.000 0.992 1.000 0.000
#> GSM71708 1 0.000 0.992 1.000 0.000
#> GSM71709 1 0.163 0.983 0.976 0.024
#> GSM71710 1 0.000 0.992 1.000 0.000
#> GSM71711 1 0.000 0.992 1.000 0.000
#> GSM71712 1 0.000 0.992 1.000 0.000
#> GSM71713 1 0.000 0.992 1.000 0.000
#> GSM71714 1 0.000 0.992 1.000 0.000
#> GSM71715 1 0.000 0.992 1.000 0.000
#> GSM71716 1 0.000 0.992 1.000 0.000
#> GSM71717 1 0.000 0.992 1.000 0.000
#> GSM71718 1 0.000 0.992 1.000 0.000
#> GSM71719 1 0.000 0.992 1.000 0.000
#> GSM71720 1 0.000 0.992 1.000 0.000
#> GSM71721 1 0.000 0.992 1.000 0.000
#> GSM71722 1 0.000 0.992 1.000 0.000
#> GSM71723 1 0.000 0.992 1.000 0.000
#> GSM71724 1 0.000 0.992 1.000 0.000
#> GSM71725 1 0.000 0.992 1.000 0.000
#> GSM71726 1 0.000 0.992 1.000 0.000
#> GSM71727 1 0.163 0.983 0.976 0.024
#> GSM71728 1 0.000 0.992 1.000 0.000
#> GSM71729 1 0.163 0.983 0.976 0.024
#> GSM71730 1 0.163 0.983 0.976 0.024
#> GSM71731 1 0.000 0.992 1.000 0.000
#> GSM71732 1 0.000 0.992 1.000 0.000
#> GSM71733 1 0.000 0.992 1.000 0.000
#> GSM71734 1 0.000 0.992 1.000 0.000
#> GSM71735 1 0.000 0.992 1.000 0.000
#> GSM71736 1 0.000 0.992 1.000 0.000
#> GSM71737 1 0.000 0.992 1.000 0.000
#> GSM71738 1 0.000 0.992 1.000 0.000
#> GSM71739 1 0.000 0.992 1.000 0.000
#> GSM71740 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
#> GSM71671 3 0.0000 1.000 0.000 0.000 1
#> GSM71672 3 0.0000 1.000 0.000 0.000 1
#> GSM71673 3 0.0000 1.000 0.000 0.000 1
#> GSM71674 3 0.0000 1.000 0.000 0.000 1
#> GSM71675 3 0.0000 1.000 0.000 0.000 1
#> GSM71676 3 0.0000 1.000 0.000 0.000 1
#> GSM71677 3 0.0000 1.000 0.000 0.000 1
#> GSM71678 2 0.0000 1.000 0.000 1.000 0
#> GSM71679 2 0.0000 1.000 0.000 1.000 0
#> GSM71680 2 0.0000 1.000 0.000 1.000 0
#> GSM71681 2 0.0000 1.000 0.000 1.000 0
#> GSM71682 2 0.0000 1.000 0.000 1.000 0
#> GSM71683 2 0.0000 1.000 0.000 1.000 0
#> GSM71684 2 0.0000 1.000 0.000 1.000 0
#> GSM71685 2 0.0000 1.000 0.000 1.000 0
#> GSM71686 2 0.0000 1.000 0.000 1.000 0
#> GSM71687 2 0.0000 1.000 0.000 1.000 0
#> GSM71688 2 0.0000 1.000 0.000 1.000 0
#> GSM71689 3 0.0000 1.000 0.000 0.000 1
#> GSM71690 2 0.0000 1.000 0.000 1.000 0
#> GSM71691 2 0.0000 1.000 0.000 1.000 0
#> GSM71692 3 0.0000 1.000 0.000 0.000 1
#> GSM71693 2 0.0000 1.000 0.000 1.000 0
#> GSM71694 3 0.0000 1.000 0.000 0.000 1
#> GSM71695 2 0.0000 1.000 0.000 1.000 0
#> GSM71696 1 0.0000 1.000 1.000 0.000 0
#> GSM71697 1 0.0000 1.000 1.000 0.000 0
#> GSM71698 1 0.0000 1.000 1.000 0.000 0
#> GSM71699 1 0.0000 1.000 1.000 0.000 0
#> GSM71700 1 0.0000 1.000 1.000 0.000 0
#> GSM71701 1 0.0000 1.000 1.000 0.000 0
#> GSM71702 1 0.0000 1.000 1.000 0.000 0
#> GSM71703 1 0.0000 1.000 1.000 0.000 0
#> GSM71704 1 0.0000 1.000 1.000 0.000 0
#> GSM71705 1 0.0000 1.000 1.000 0.000 0
#> GSM71706 1 0.0000 1.000 1.000 0.000 0
#> GSM71707 1 0.0000 1.000 1.000 0.000 0
#> GSM71708 1 0.0000 1.000 1.000 0.000 0
#> GSM71709 2 0.0000 1.000 0.000 1.000 0
#> GSM71710 1 0.0000 1.000 1.000 0.000 0
#> GSM71711 1 0.0000 1.000 1.000 0.000 0
#> GSM71712 1 0.0237 0.996 0.996 0.004 0
#> GSM71713 1 0.0000 1.000 1.000 0.000 0
#> GSM71714 1 0.0000 1.000 1.000 0.000 0
#> GSM71715 1 0.0000 1.000 1.000 0.000 0
#> GSM71716 1 0.0000 1.000 1.000 0.000 0
#> GSM71717 1 0.0000 1.000 1.000 0.000 0
#> GSM71718 1 0.0000 1.000 1.000 0.000 0
#> GSM71719 1 0.0000 1.000 1.000 0.000 0
#> GSM71720 1 0.0000 1.000 1.000 0.000 0
#> GSM71721 1 0.0000 1.000 1.000 0.000 0
#> GSM71722 1 0.0000 1.000 1.000 0.000 0
#> GSM71723 1 0.0000 1.000 1.000 0.000 0
#> GSM71724 1 0.0000 1.000 1.000 0.000 0
#> GSM71725 1 0.0237 0.996 0.996 0.004 0
#> GSM71726 1 0.0237 0.996 0.996 0.004 0
#> GSM71727 2 0.0000 1.000 0.000 1.000 0
#> GSM71728 1 0.0237 0.996 0.996 0.004 0
#> GSM71729 2 0.0000 1.000 0.000 1.000 0
#> GSM71730 2 0.0000 1.000 0.000 1.000 0
#> GSM71731 1 0.0000 1.000 1.000 0.000 0
#> GSM71732 1 0.0000 1.000 1.000 0.000 0
#> GSM71733 1 0.0000 1.000 1.000 0.000 0
#> GSM71734 1 0.0000 1.000 1.000 0.000 0
#> GSM71735 1 0.0000 1.000 1.000 0.000 0
#> GSM71736 1 0.0000 1.000 1.000 0.000 0
#> GSM71737 1 0.0000 1.000 1.000 0.000 0
#> GSM71738 1 0.0000 1.000 1.000 0.000 0
#> GSM71739 1 0.0000 1.000 1.000 0.000 0
#> GSM71740 1 0.0000 1.000 1.000 0.000 0
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> GSM71671 3 0.000 1.000 0.000 0 1 0.000
#> GSM71672 3 0.000 1.000 0.000 0 1 0.000
#> GSM71673 3 0.000 1.000 0.000 0 1 0.000
#> GSM71674 3 0.000 1.000 0.000 0 1 0.000
#> GSM71675 3 0.000 1.000 0.000 0 1 0.000
#> GSM71676 3 0.000 1.000 0.000 0 1 0.000
#> GSM71677 3 0.000 1.000 0.000 0 1 0.000
#> GSM71678 2 0.000 1.000 0.000 1 0 0.000
#> GSM71679 2 0.000 1.000 0.000 1 0 0.000
#> GSM71680 2 0.000 1.000 0.000 1 0 0.000
#> GSM71681 2 0.000 1.000 0.000 1 0 0.000
#> GSM71682 2 0.000 1.000 0.000 1 0 0.000
#> GSM71683 2 0.000 1.000 0.000 1 0 0.000
#> GSM71684 2 0.000 1.000 0.000 1 0 0.000
#> GSM71685 2 0.000 1.000 0.000 1 0 0.000
#> GSM71686 2 0.000 1.000 0.000 1 0 0.000
#> GSM71687 2 0.000 1.000 0.000 1 0 0.000
#> GSM71688 2 0.000 1.000 0.000 1 0 0.000
#> GSM71689 3 0.000 1.000 0.000 0 1 0.000
#> GSM71690 2 0.000 1.000 0.000 1 0 0.000
#> GSM71691 2 0.000 1.000 0.000 1 0 0.000
#> GSM71692 3 0.000 1.000 0.000 0 1 0.000
#> GSM71693 2 0.000 1.000 0.000 1 0 0.000
#> GSM71694 3 0.000 1.000 0.000 0 1 0.000
#> GSM71695 2 0.000 1.000 0.000 1 0 0.000
#> GSM71696 1 0.000 0.996 1.000 0 0 0.000
#> GSM71697 1 0.000 0.996 1.000 0 0 0.000
#> GSM71698 1 0.000 0.996 1.000 0 0 0.000
#> GSM71699 1 0.000 0.996 1.000 0 0 0.000
#> GSM71700 1 0.000 0.996 1.000 0 0 0.000
#> GSM71701 1 0.000 0.996 1.000 0 0 0.000
#> GSM71702 1 0.000 0.996 1.000 0 0 0.000
#> GSM71703 1 0.000 0.996 1.000 0 0 0.000
#> GSM71704 1 0.000 0.996 1.000 0 0 0.000
#> GSM71705 1 0.000 0.996 1.000 0 0 0.000
#> GSM71706 1 0.000 0.996 1.000 0 0 0.000
#> GSM71707 1 0.000 0.996 1.000 0 0 0.000
#> GSM71708 1 0.000 0.996 1.000 0 0 0.000
#> GSM71709 2 0.000 1.000 0.000 1 0 0.000
#> GSM71710 1 0.000 0.996 1.000 0 0 0.000
#> GSM71711 1 0.000 0.996 1.000 0 0 0.000
#> GSM71712 4 0.000 1.000 0.000 0 0 1.000
#> GSM71713 1 0.276 0.853 0.872 0 0 0.128
#> GSM71714 1 0.000 0.996 1.000 0 0 0.000
#> GSM71715 1 0.000 0.996 1.000 0 0 0.000
#> GSM71716 1 0.000 0.996 1.000 0 0 0.000
#> GSM71717 1 0.000 0.996 1.000 0 0 0.000
#> GSM71718 1 0.000 0.996 1.000 0 0 0.000
#> GSM71719 1 0.000 0.996 1.000 0 0 0.000
#> GSM71720 1 0.000 0.996 1.000 0 0 0.000
#> GSM71721 1 0.000 0.996 1.000 0 0 0.000
#> GSM71722 1 0.000 0.996 1.000 0 0 0.000
#> GSM71723 1 0.000 0.996 1.000 0 0 0.000
#> GSM71724 1 0.000 0.996 1.000 0 0 0.000
#> GSM71725 4 0.000 1.000 0.000 0 0 1.000
#> GSM71726 4 0.000 1.000 0.000 0 0 1.000
#> GSM71727 2 0.000 1.000 0.000 1 0 0.000
#> GSM71728 4 0.000 1.000 0.000 0 0 1.000
#> GSM71729 2 0.000 1.000 0.000 1 0 0.000
#> GSM71730 2 0.000 1.000 0.000 1 0 0.000
#> GSM71731 1 0.000 0.996 1.000 0 0 0.000
#> GSM71732 1 0.000 0.996 1.000 0 0 0.000
#> GSM71733 1 0.000 0.996 1.000 0 0 0.000
#> GSM71734 1 0.000 0.996 1.000 0 0 0.000
#> GSM71735 1 0.000 0.996 1.000 0 0 0.000
#> GSM71736 1 0.000 0.996 1.000 0 0 0.000
#> GSM71737 1 0.000 0.996 1.000 0 0 0.000
#> GSM71738 1 0.000 0.996 1.000 0 0 0.000
#> GSM71739 1 0.000 0.996 1.000 0 0 0.000
#> GSM71740 1 0.000 0.996 1.000 0 0 0.000
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> GSM71671 3 0.000 1.000 0.000 0 1 0.000 0
#> GSM71672 3 0.000 1.000 0.000 0 1 0.000 0
#> GSM71673 3 0.000 1.000 0.000 0 1 0.000 0
#> GSM71674 3 0.000 1.000 0.000 0 1 0.000 0
#> GSM71675 3 0.000 1.000 0.000 0 1 0.000 0
#> GSM71676 5 0.000 1.000 0.000 0 0 0.000 1
#> GSM71677 5 0.000 1.000 0.000 0 0 0.000 1
#> GSM71678 2 0.000 1.000 0.000 1 0 0.000 0
#> GSM71679 2 0.000 1.000 0.000 1 0 0.000 0
#> GSM71680 2 0.000 1.000 0.000 1 0 0.000 0
#> GSM71681 2 0.000 1.000 0.000 1 0 0.000 0
#> GSM71682 2 0.000 1.000 0.000 1 0 0.000 0
#> GSM71683 2 0.000 1.000 0.000 1 0 0.000 0
#> GSM71684 2 0.000 1.000 0.000 1 0 0.000 0
#> GSM71685 2 0.000 1.000 0.000 1 0 0.000 0
#> GSM71686 2 0.000 1.000 0.000 1 0 0.000 0
#> GSM71687 2 0.000 1.000 0.000 1 0 0.000 0
#> GSM71688 2 0.000 1.000 0.000 1 0 0.000 0
#> GSM71689 3 0.000 1.000 0.000 0 1 0.000 0
#> GSM71690 2 0.000 1.000 0.000 1 0 0.000 0
#> GSM71691 2 0.000 1.000 0.000 1 0 0.000 0
#> GSM71692 3 0.000 1.000 0.000 0 1 0.000 0
#> GSM71693 2 0.000 1.000 0.000 1 0 0.000 0
#> GSM71694 3 0.000 1.000 0.000 0 1 0.000 0
#> GSM71695 2 0.000 1.000 0.000 1 0 0.000 0
#> GSM71696 1 0.000 0.996 1.000 0 0 0.000 0
#> GSM71697 1 0.000 0.996 1.000 0 0 0.000 0
#> GSM71698 1 0.000 0.996 1.000 0 0 0.000 0
#> GSM71699 1 0.000 0.996 1.000 0 0 0.000 0
#> GSM71700 1 0.000 0.996 1.000 0 0 0.000 0
#> GSM71701 1 0.000 0.996 1.000 0 0 0.000 0
#> GSM71702 1 0.000 0.996 1.000 0 0 0.000 0
#> GSM71703 1 0.000 0.996 1.000 0 0 0.000 0
#> GSM71704 1 0.000 0.996 1.000 0 0 0.000 0
#> GSM71705 1 0.000 0.996 1.000 0 0 0.000 0
#> GSM71706 1 0.000 0.996 1.000 0 0 0.000 0
#> GSM71707 1 0.000 0.996 1.000 0 0 0.000 0
#> GSM71708 1 0.000 0.996 1.000 0 0 0.000 0
#> GSM71709 2 0.000 1.000 0.000 1 0 0.000 0
#> GSM71710 1 0.000 0.996 1.000 0 0 0.000 0
#> GSM71711 1 0.000 0.996 1.000 0 0 0.000 0
#> GSM71712 4 0.000 1.000 0.000 0 0 1.000 0
#> GSM71713 1 0.238 0.851 0.872 0 0 0.128 0
#> GSM71714 1 0.000 0.996 1.000 0 0 0.000 0
#> GSM71715 1 0.000 0.996 1.000 0 0 0.000 0
#> GSM71716 1 0.000 0.996 1.000 0 0 0.000 0
#> GSM71717 1 0.000 0.996 1.000 0 0 0.000 0
#> GSM71718 1 0.000 0.996 1.000 0 0 0.000 0
#> GSM71719 1 0.000 0.996 1.000 0 0 0.000 0
#> GSM71720 1 0.000 0.996 1.000 0 0 0.000 0
#> GSM71721 1 0.000 0.996 1.000 0 0 0.000 0
#> GSM71722 1 0.000 0.996 1.000 0 0 0.000 0
#> GSM71723 1 0.000 0.996 1.000 0 0 0.000 0
#> GSM71724 1 0.000 0.996 1.000 0 0 0.000 0
#> GSM71725 4 0.000 1.000 0.000 0 0 1.000 0
#> GSM71726 4 0.000 1.000 0.000 0 0 1.000 0
#> GSM71727 2 0.000 1.000 0.000 1 0 0.000 0
#> GSM71728 4 0.000 1.000 0.000 0 0 1.000 0
#> GSM71729 2 0.000 1.000 0.000 1 0 0.000 0
#> GSM71730 2 0.000 1.000 0.000 1 0 0.000 0
#> GSM71731 1 0.000 0.996 1.000 0 0 0.000 0
#> GSM71732 1 0.000 0.996 1.000 0 0 0.000 0
#> GSM71733 1 0.000 0.996 1.000 0 0 0.000 0
#> GSM71734 1 0.000 0.996 1.000 0 0 0.000 0
#> GSM71735 1 0.000 0.996 1.000 0 0 0.000 0
#> GSM71736 1 0.000 0.996 1.000 0 0 0.000 0
#> GSM71737 1 0.000 0.996 1.000 0 0 0.000 0
#> GSM71738 1 0.000 0.996 1.000 0 0 0.000 0
#> GSM71739 1 0.000 0.996 1.000 0 0 0.000 0
#> GSM71740 1 0.000 0.996 1.000 0 0 0.000 0
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> GSM71671 3 0.000 1.000 0.00 0.000 1 0.000 0.000 0
#> GSM71672 3 0.000 1.000 0.00 0.000 1 0.000 0.000 0
#> GSM71673 3 0.000 1.000 0.00 0.000 1 0.000 0.000 0
#> GSM71674 3 0.000 1.000 0.00 0.000 1 0.000 0.000 0
#> GSM71675 3 0.000 1.000 0.00 0.000 1 0.000 0.000 0
#> GSM71676 6 0.000 1.000 0.00 0.000 0 0.000 0.000 1
#> GSM71677 6 0.000 1.000 0.00 0.000 0 0.000 0.000 1
#> GSM71678 2 0.000 1.000 0.00 1.000 0 0.000 0.000 0
#> GSM71679 2 0.000 1.000 0.00 1.000 0 0.000 0.000 0
#> GSM71680 4 0.288 1.000 0.00 0.212 0 0.788 0.000 0
#> GSM71681 2 0.000 1.000 0.00 1.000 0 0.000 0.000 0
#> GSM71682 2 0.000 1.000 0.00 1.000 0 0.000 0.000 0
#> GSM71683 2 0.000 1.000 0.00 1.000 0 0.000 0.000 0
#> GSM71684 2 0.000 1.000 0.00 1.000 0 0.000 0.000 0
#> GSM71685 2 0.000 1.000 0.00 1.000 0 0.000 0.000 0
#> GSM71686 2 0.000 1.000 0.00 1.000 0 0.000 0.000 0
#> GSM71687 2 0.000 1.000 0.00 1.000 0 0.000 0.000 0
#> GSM71688 2 0.000 1.000 0.00 1.000 0 0.000 0.000 0
#> GSM71689 3 0.000 1.000 0.00 0.000 1 0.000 0.000 0
#> GSM71690 2 0.000 1.000 0.00 1.000 0 0.000 0.000 0
#> GSM71691 2 0.000 1.000 0.00 1.000 0 0.000 0.000 0
#> GSM71692 3 0.000 1.000 0.00 0.000 1 0.000 0.000 0
#> GSM71693 2 0.000 1.000 0.00 1.000 0 0.000 0.000 0
#> GSM71694 3 0.000 1.000 0.00 0.000 1 0.000 0.000 0
#> GSM71695 2 0.000 1.000 0.00 1.000 0 0.000 0.000 0
#> GSM71696 1 0.000 0.991 1.00 0.000 0 0.000 0.000 0
#> GSM71697 1 0.000 0.991 1.00 0.000 0 0.000 0.000 0
#> GSM71698 1 0.000 0.991 1.00 0.000 0 0.000 0.000 0
#> GSM71699 1 0.000 0.991 1.00 0.000 0 0.000 0.000 0
#> GSM71700 1 0.000 0.991 1.00 0.000 0 0.000 0.000 0
#> GSM71701 1 0.000 0.991 1.00 0.000 0 0.000 0.000 0
#> GSM71702 1 0.000 0.991 1.00 0.000 0 0.000 0.000 0
#> GSM71703 1 0.000 0.991 1.00 0.000 0 0.000 0.000 0
#> GSM71704 1 0.000 0.991 1.00 0.000 0 0.000 0.000 0
#> GSM71705 1 0.000 0.991 1.00 0.000 0 0.000 0.000 0
#> GSM71706 1 0.000 0.991 1.00 0.000 0 0.000 0.000 0
#> GSM71707 1 0.000 0.991 1.00 0.000 0 0.000 0.000 0
#> GSM71708 1 0.000 0.991 1.00 0.000 0 0.000 0.000 0
#> GSM71709 4 0.288 1.000 0.00 0.212 0 0.788 0.000 0
#> GSM71710 1 0.000 0.991 1.00 0.000 0 0.000 0.000 0
#> GSM71711 1 0.000 0.991 1.00 0.000 0 0.000 0.000 0
#> GSM71712 5 0.000 1.000 0.00 0.000 0 0.000 1.000 0
#> GSM71713 1 0.464 0.559 0.68 0.000 0 0.212 0.108 0
#> GSM71714 1 0.000 0.991 1.00 0.000 0 0.000 0.000 0
#> GSM71715 1 0.000 0.991 1.00 0.000 0 0.000 0.000 0
#> GSM71716 1 0.000 0.991 1.00 0.000 0 0.000 0.000 0
#> GSM71717 1 0.000 0.991 1.00 0.000 0 0.000 0.000 0
#> GSM71718 1 0.000 0.991 1.00 0.000 0 0.000 0.000 0
#> GSM71719 1 0.000 0.991 1.00 0.000 0 0.000 0.000 0
#> GSM71720 1 0.000 0.991 1.00 0.000 0 0.000 0.000 0
#> GSM71721 1 0.000 0.991 1.00 0.000 0 0.000 0.000 0
#> GSM71722 1 0.000 0.991 1.00 0.000 0 0.000 0.000 0
#> GSM71723 1 0.000 0.991 1.00 0.000 0 0.000 0.000 0
#> GSM71724 1 0.000 0.991 1.00 0.000 0 0.000 0.000 0
#> GSM71725 5 0.000 1.000 0.00 0.000 0 0.000 1.000 0
#> GSM71726 5 0.000 1.000 0.00 0.000 0 0.000 1.000 0
#> GSM71727 4 0.288 1.000 0.00 0.212 0 0.788 0.000 0
#> GSM71728 5 0.000 1.000 0.00 0.000 0 0.000 1.000 0
#> GSM71729 4 0.288 1.000 0.00 0.212 0 0.788 0.000 0
#> GSM71730 4 0.288 1.000 0.00 0.212 0 0.788 0.000 0
#> GSM71731 1 0.000 0.991 1.00 0.000 0 0.000 0.000 0
#> GSM71732 1 0.000 0.991 1.00 0.000 0 0.000 0.000 0
#> GSM71733 1 0.000 0.991 1.00 0.000 0 0.000 0.000 0
#> GSM71734 1 0.000 0.991 1.00 0.000 0 0.000 0.000 0
#> GSM71735 1 0.000 0.991 1.00 0.000 0 0.000 0.000 0
#> GSM71736 1 0.000 0.991 1.00 0.000 0 0.000 0.000 0
#> GSM71737 1 0.000 0.991 1.00 0.000 0 0.000 0.000 0
#> GSM71738 1 0.000 0.991 1.00 0.000 0 0.000 0.000 0
#> GSM71739 1 0.000 0.991 1.00 0.000 0 0.000 0.000 0
#> GSM71740 1 0.000 0.991 1.00 0.000 0 0.000 0.000 0
Heatmaps for the consensus matrix. It visualizes the probability of two samples to be in a same group.
consensus_heatmap(res, k = 2)
consensus_heatmap(res, k = 3)
consensus_heatmap(res, k = 4)
consensus_heatmap(res, k = 5)
consensus_heatmap(res, k = 6)
Heatmaps for the membership of samples in all partitions to see how consistent they are:
membership_heatmap(res, k = 2)
membership_heatmap(res, k = 3)
membership_heatmap(res, k = 4)
membership_heatmap(res, k = 5)
membership_heatmap(res, k = 6)
As soon as we have had the classes for columns, we can look for signatures which are significantly different between classes which can be candidate marks for certain classes. Following are the heatmaps for signatures.
Signature heatmaps where rows are scaled:
get_signatures(res, k = 2)
get_signatures(res, k = 3)
get_signatures(res, k = 4)
get_signatures(res, k = 5)
get_signatures(res, k = 6)
Signature heatmaps where rows are not scaled:
get_signatures(res, k = 2, scale_rows = FALSE)
get_signatures(res, k = 3, scale_rows = FALSE)
get_signatures(res, k = 4, scale_rows = FALSE)
get_signatures(res, k = 5, scale_rows = FALSE)
get_signatures(res, k = 6, scale_rows = FALSE)
Compare the overlap of signatures from different k:
compare_signatures(res)
get_signature()
returns a data frame invisibly. TO get the list of signatures, the function
call should be assigned to a variable explicitly. In following code, if plot
argument is set
to FALSE
, no heatmap is plotted while only the differential analysis is performed.
# code only for demonstration
tb = get_signature(res, k = ..., plot = FALSE)
An example of the output of tb
is:
#> which_row fdr mean_1 mean_2 scaled_mean_1 scaled_mean_2 km
#> 1 38 0.042760348 8.373488 9.131774 -0.5533452 0.5164555 1
#> 2 40 0.018707592 7.106213 8.469186 -0.6173731 0.5762149 1
#> 3 55 0.019134737 10.221463 11.207825 -0.6159697 0.5749050 1
#> 4 59 0.006059896 5.921854 7.869574 -0.6899429 0.6439467 1
#> 5 60 0.018055526 8.928898 10.211722 -0.6204761 0.5791110 1
#> 6 98 0.009384629 15.714769 14.887706 0.6635654 -0.6193277 2
...
The columns in tb
are:
which_row
: row indices corresponding to the input matrix.fdr
: FDR for the differential test. mean_x
: The mean value in group x.scaled_mean_x
: The mean value in group x after rows are scaled.km
: Row groups if k-means clustering is applied to rows.UMAP plot which shows how samples are separated.
dimension_reduction(res, k = 2, method = "UMAP")
dimension_reduction(res, k = 3, method = "UMAP")
dimension_reduction(res, k = 4, method = "UMAP")
dimension_reduction(res, k = 5, method = "UMAP")
dimension_reduction(res, k = 6, method = "UMAP")
Following heatmap shows how subgroups are split when increasing k
:
collect_classes(res)
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) k
#> ATC:hclust 70 1.71e-11 2
#> ATC:hclust 70 2.22e-19 3
#> ATC:hclust 70 5.30e-18 4
#> ATC:hclust 70 1.95e-17 5
#> ATC:hclust 70 6.42e-19 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 21168 rows and 70 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 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 0.990 0.986 0.4804 0.508 0.508
#> 3 3 1.000 0.980 0.993 0.2313 0.851 0.719
#> 4 4 0.999 0.969 0.982 0.1010 0.931 0.831
#> 5 5 0.797 0.886 0.887 0.1636 0.866 0.612
#> 6 6 0.733 0.757 0.808 0.0411 1.000 1.000
suggest_best_k()
suggests the best \(k\) based on these statistics. The rules are as follows:
suggest_best_k(res)
#> [1] 4
#> 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
#> GSM71671 2 0.000 0.964 0.000 1.000
#> GSM71672 2 0.000 0.964 0.000 1.000
#> GSM71673 2 0.000 0.964 0.000 1.000
#> GSM71674 2 0.000 0.964 0.000 1.000
#> GSM71675 2 0.000 0.964 0.000 1.000
#> GSM71676 2 0.000 0.964 0.000 1.000
#> GSM71677 2 0.000 0.964 0.000 1.000
#> GSM71678 2 0.295 0.980 0.052 0.948
#> GSM71679 2 0.295 0.980 0.052 0.948
#> GSM71680 2 0.295 0.980 0.052 0.948
#> GSM71681 2 0.295 0.980 0.052 0.948
#> GSM71682 2 0.295 0.980 0.052 0.948
#> GSM71683 2 0.295 0.980 0.052 0.948
#> GSM71684 2 0.295 0.980 0.052 0.948
#> GSM71685 2 0.295 0.980 0.052 0.948
#> GSM71686 2 0.295 0.980 0.052 0.948
#> GSM71687 2 0.295 0.980 0.052 0.948
#> GSM71688 2 0.295 0.980 0.052 0.948
#> GSM71689 2 0.000 0.964 0.000 1.000
#> GSM71690 2 0.295 0.980 0.052 0.948
#> GSM71691 2 0.295 0.980 0.052 0.948
#> GSM71692 2 0.000 0.964 0.000 1.000
#> GSM71693 2 0.295 0.980 0.052 0.948
#> GSM71694 2 0.000 0.964 0.000 1.000
#> GSM71695 2 0.295 0.980 0.052 0.948
#> GSM71696 1 0.000 1.000 1.000 0.000
#> GSM71697 1 0.000 1.000 1.000 0.000
#> GSM71698 1 0.000 1.000 1.000 0.000
#> GSM71699 1 0.000 1.000 1.000 0.000
#> GSM71700 1 0.000 1.000 1.000 0.000
#> GSM71701 1 0.000 1.000 1.000 0.000
#> GSM71702 1 0.000 1.000 1.000 0.000
#> GSM71703 1 0.000 1.000 1.000 0.000
#> GSM71704 1 0.000 1.000 1.000 0.000
#> GSM71705 1 0.000 1.000 1.000 0.000
#> GSM71706 1 0.000 1.000 1.000 0.000
#> GSM71707 1 0.000 1.000 1.000 0.000
#> GSM71708 1 0.000 1.000 1.000 0.000
#> GSM71709 2 0.295 0.980 0.052 0.948
#> GSM71710 1 0.000 1.000 1.000 0.000
#> GSM71711 1 0.000 1.000 1.000 0.000
#> GSM71712 1 0.000 1.000 1.000 0.000
#> GSM71713 1 0.000 1.000 1.000 0.000
#> GSM71714 1 0.000 1.000 1.000 0.000
#> GSM71715 1 0.000 1.000 1.000 0.000
#> GSM71716 1 0.000 1.000 1.000 0.000
#> GSM71717 1 0.000 1.000 1.000 0.000
#> GSM71718 1 0.000 1.000 1.000 0.000
#> GSM71719 1 0.000 1.000 1.000 0.000
#> GSM71720 1 0.000 1.000 1.000 0.000
#> GSM71721 1 0.000 1.000 1.000 0.000
#> GSM71722 1 0.000 1.000 1.000 0.000
#> GSM71723 1 0.000 1.000 1.000 0.000
#> GSM71724 1 0.000 1.000 1.000 0.000
#> GSM71725 1 0.000 1.000 1.000 0.000
#> GSM71726 1 0.000 1.000 1.000 0.000
#> GSM71727 2 0.295 0.980 0.052 0.948
#> GSM71728 1 0.000 1.000 1.000 0.000
#> GSM71729 2 0.295 0.980 0.052 0.948
#> GSM71730 2 0.295 0.980 0.052 0.948
#> GSM71731 1 0.000 1.000 1.000 0.000
#> GSM71732 1 0.000 1.000 1.000 0.000
#> GSM71733 1 0.000 1.000 1.000 0.000
#> GSM71734 1 0.000 1.000 1.000 0.000
#> GSM71735 1 0.000 1.000 1.000 0.000
#> GSM71736 1 0.000 1.000 1.000 0.000
#> GSM71737 1 0.000 1.000 1.000 0.000
#> GSM71738 1 0.000 1.000 1.000 0.000
#> GSM71739 1 0.000 1.000 1.000 0.000
#> GSM71740 1 0.000 1.000 1.000 0.000
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> GSM71671 3 0.0000 0.997 0.000 0.000 1.000
#> GSM71672 3 0.0000 0.997 0.000 0.000 1.000
#> GSM71673 3 0.0000 0.997 0.000 0.000 1.000
#> GSM71674 3 0.0000 0.997 0.000 0.000 1.000
#> GSM71675 3 0.0000 0.997 0.000 0.000 1.000
#> GSM71676 3 0.1163 0.972 0.000 0.028 0.972
#> GSM71677 3 0.0000 0.997 0.000 0.000 1.000
#> GSM71678 2 0.0000 0.969 0.000 1.000 0.000
#> GSM71679 2 0.0000 0.969 0.000 1.000 0.000
#> GSM71680 2 0.0000 0.969 0.000 1.000 0.000
#> GSM71681 2 0.0000 0.969 0.000 1.000 0.000
#> GSM71682 2 0.0000 0.969 0.000 1.000 0.000
#> GSM71683 2 0.0000 0.969 0.000 1.000 0.000
#> GSM71684 2 0.0000 0.969 0.000 1.000 0.000
#> GSM71685 2 0.0000 0.969 0.000 1.000 0.000
#> GSM71686 2 0.0000 0.969 0.000 1.000 0.000
#> GSM71687 2 0.0000 0.969 0.000 1.000 0.000
#> GSM71688 2 0.0000 0.969 0.000 1.000 0.000
#> GSM71689 3 0.0000 0.997 0.000 0.000 1.000
#> GSM71690 2 0.0000 0.969 0.000 1.000 0.000
#> GSM71691 2 0.0000 0.969 0.000 1.000 0.000
#> GSM71692 3 0.0000 0.997 0.000 0.000 1.000
#> GSM71693 2 0.0000 0.969 0.000 1.000 0.000
#> GSM71694 3 0.0000 0.997 0.000 0.000 1.000
#> GSM71695 2 0.0000 0.969 0.000 1.000 0.000
#> GSM71696 1 0.0000 1.000 1.000 0.000 0.000
#> GSM71697 1 0.0000 1.000 1.000 0.000 0.000
#> GSM71698 1 0.0000 1.000 1.000 0.000 0.000
#> GSM71699 1 0.0000 1.000 1.000 0.000 0.000
#> GSM71700 1 0.0000 1.000 1.000 0.000 0.000
#> GSM71701 1 0.0000 1.000 1.000 0.000 0.000
#> GSM71702 1 0.0000 1.000 1.000 0.000 0.000
#> GSM71703 1 0.0000 1.000 1.000 0.000 0.000
#> GSM71704 1 0.0000 1.000 1.000 0.000 0.000
#> GSM71705 1 0.0000 1.000 1.000 0.000 0.000
#> GSM71706 1 0.0000 1.000 1.000 0.000 0.000
#> GSM71707 1 0.0000 1.000 1.000 0.000 0.000
#> GSM71708 1 0.0000 1.000 1.000 0.000 0.000
#> GSM71709 2 0.0000 0.969 0.000 1.000 0.000
#> GSM71710 1 0.0000 1.000 1.000 0.000 0.000
#> GSM71711 1 0.0000 1.000 1.000 0.000 0.000
#> GSM71712 2 0.4931 0.662 0.232 0.768 0.000
#> GSM71713 1 0.0000 1.000 1.000 0.000 0.000
#> GSM71714 1 0.0000 1.000 1.000 0.000 0.000
#> GSM71715 1 0.0000 1.000 1.000 0.000 0.000
#> GSM71716 1 0.0000 1.000 1.000 0.000 0.000
#> GSM71717 1 0.0000 1.000 1.000 0.000 0.000
#> GSM71718 1 0.0000 1.000 1.000 0.000 0.000
#> GSM71719 1 0.0000 1.000 1.000 0.000 0.000
#> GSM71720 1 0.0000 1.000 1.000 0.000 0.000
#> GSM71721 1 0.0000 1.000 1.000 0.000 0.000
#> GSM71722 1 0.0000 1.000 1.000 0.000 0.000
#> GSM71723 1 0.0000 1.000 1.000 0.000 0.000
#> GSM71724 1 0.0000 1.000 1.000 0.000 0.000
#> GSM71725 1 0.0424 0.991 0.992 0.008 0.000
#> GSM71726 2 0.0000 0.969 0.000 1.000 0.000
#> GSM71727 2 0.0000 0.969 0.000 1.000 0.000
#> GSM71728 2 0.4931 0.662 0.232 0.768 0.000
#> GSM71729 2 0.0000 0.969 0.000 1.000 0.000
#> GSM71730 2 0.0000 0.969 0.000 1.000 0.000
#> GSM71731 1 0.0000 1.000 1.000 0.000 0.000
#> GSM71732 1 0.0000 1.000 1.000 0.000 0.000
#> GSM71733 1 0.0000 1.000 1.000 0.000 0.000
#> GSM71734 1 0.0000 1.000 1.000 0.000 0.000
#> GSM71735 1 0.0000 1.000 1.000 0.000 0.000
#> GSM71736 1 0.0000 1.000 1.000 0.000 0.000
#> GSM71737 1 0.0000 1.000 1.000 0.000 0.000
#> GSM71738 1 0.0000 1.000 1.000 0.000 0.000
#> GSM71739 1 0.0000 1.000 1.000 0.000 0.000
#> GSM71740 1 0.0000 1.000 1.000 0.000 0.000
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> GSM71671 3 0.0707 0.956 0.000 0.000 0.980 0.020
#> GSM71672 3 0.0000 0.961 0.000 0.000 1.000 0.000
#> GSM71673 3 0.0000 0.961 0.000 0.000 1.000 0.000
#> GSM71674 3 0.0707 0.956 0.000 0.000 0.980 0.020
#> GSM71675 3 0.0000 0.961 0.000 0.000 1.000 0.000
#> GSM71676 3 0.5142 0.699 0.000 0.192 0.744 0.064
#> GSM71677 3 0.1637 0.935 0.000 0.000 0.940 0.060
#> GSM71678 2 0.0000 0.982 0.000 1.000 0.000 0.000
#> GSM71679 2 0.0000 0.982 0.000 1.000 0.000 0.000
#> GSM71680 2 0.2589 0.882 0.000 0.884 0.000 0.116
#> GSM71681 2 0.0188 0.980 0.000 0.996 0.000 0.004
#> GSM71682 2 0.0000 0.982 0.000 1.000 0.000 0.000
#> GSM71683 2 0.0000 0.982 0.000 1.000 0.000 0.000
#> GSM71684 2 0.0000 0.982 0.000 1.000 0.000 0.000
#> GSM71685 2 0.0188 0.980 0.000 0.996 0.000 0.004
#> GSM71686 2 0.0000 0.982 0.000 1.000 0.000 0.000
#> GSM71687 2 0.0000 0.982 0.000 1.000 0.000 0.000
#> GSM71688 2 0.0000 0.982 0.000 1.000 0.000 0.000
#> GSM71689 3 0.0000 0.961 0.000 0.000 1.000 0.000
#> GSM71690 2 0.0000 0.982 0.000 1.000 0.000 0.000
#> GSM71691 2 0.0000 0.982 0.000 1.000 0.000 0.000
#> GSM71692 3 0.0000 0.961 0.000 0.000 1.000 0.000
#> GSM71693 2 0.0000 0.982 0.000 1.000 0.000 0.000
#> GSM71694 3 0.0000 0.961 0.000 0.000 1.000 0.000
#> GSM71695 2 0.0000 0.982 0.000 1.000 0.000 0.000
#> GSM71696 1 0.0000 0.998 1.000 0.000 0.000 0.000
#> GSM71697 1 0.0188 0.998 0.996 0.000 0.000 0.004
#> GSM71698 1 0.0188 0.998 0.996 0.000 0.000 0.004
#> GSM71699 1 0.0000 0.998 1.000 0.000 0.000 0.000
#> GSM71700 1 0.0188 0.998 0.996 0.000 0.000 0.004
#> GSM71701 1 0.0000 0.998 1.000 0.000 0.000 0.000
#> GSM71702 1 0.0000 0.998 1.000 0.000 0.000 0.000
#> GSM71703 1 0.0000 0.998 1.000 0.000 0.000 0.000
#> GSM71704 1 0.0000 0.998 1.000 0.000 0.000 0.000
#> GSM71705 1 0.0000 0.998 1.000 0.000 0.000 0.000
#> GSM71706 1 0.0000 0.998 1.000 0.000 0.000 0.000
#> GSM71707 1 0.0000 0.998 1.000 0.000 0.000 0.000
#> GSM71708 1 0.0000 0.998 1.000 0.000 0.000 0.000
#> GSM71709 2 0.2589 0.882 0.000 0.884 0.000 0.116
#> GSM71710 1 0.0000 0.998 1.000 0.000 0.000 0.000
#> GSM71711 1 0.0000 0.998 1.000 0.000 0.000 0.000
#> GSM71712 4 0.2036 0.915 0.032 0.032 0.000 0.936
#> GSM71713 4 0.3311 0.740 0.172 0.000 0.000 0.828
#> GSM71714 1 0.0188 0.998 0.996 0.000 0.000 0.004
#> GSM71715 1 0.0000 0.998 1.000 0.000 0.000 0.000
#> GSM71716 1 0.0000 0.998 1.000 0.000 0.000 0.000
#> GSM71717 1 0.0000 0.998 1.000 0.000 0.000 0.000
#> GSM71718 1 0.0188 0.998 0.996 0.000 0.000 0.004
#> GSM71719 1 0.0188 0.998 0.996 0.000 0.000 0.004
#> GSM71720 1 0.0188 0.998 0.996 0.000 0.000 0.004
#> GSM71721 1 0.0188 0.998 0.996 0.000 0.000 0.004
#> GSM71722 1 0.0188 0.998 0.996 0.000 0.000 0.004
#> GSM71723 1 0.0188 0.998 0.996 0.000 0.000 0.004
#> GSM71724 1 0.0188 0.998 0.996 0.000 0.000 0.004
#> GSM71725 4 0.1716 0.883 0.064 0.000 0.000 0.936
#> GSM71726 4 0.1792 0.905 0.000 0.068 0.000 0.932
#> GSM71727 4 0.1867 0.904 0.000 0.072 0.000 0.928
#> GSM71728 4 0.2036 0.915 0.032 0.032 0.000 0.936
#> GSM71729 4 0.1867 0.904 0.000 0.072 0.000 0.928
#> GSM71730 2 0.1302 0.949 0.000 0.956 0.000 0.044
#> GSM71731 1 0.0188 0.998 0.996 0.000 0.000 0.004
#> GSM71732 1 0.0000 0.998 1.000 0.000 0.000 0.000
#> GSM71733 1 0.0188 0.998 0.996 0.000 0.000 0.004
#> GSM71734 1 0.0000 0.998 1.000 0.000 0.000 0.000
#> GSM71735 1 0.0000 0.998 1.000 0.000 0.000 0.000
#> GSM71736 1 0.0000 0.998 1.000 0.000 0.000 0.000
#> GSM71737 1 0.0000 0.998 1.000 0.000 0.000 0.000
#> GSM71738 1 0.0000 0.998 1.000 0.000 0.000 0.000
#> GSM71739 1 0.0188 0.998 0.996 0.000 0.000 0.004
#> GSM71740 1 0.0188 0.998 0.996 0.000 0.000 0.004
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> GSM71671 3 0.1205 0.944 0.000 0.000 0.956 0.004 0.040
#> GSM71672 3 0.0000 0.955 0.000 0.000 1.000 0.000 0.000
#> GSM71673 3 0.0000 0.955 0.000 0.000 1.000 0.000 0.000
#> GSM71674 3 0.1205 0.944 0.000 0.000 0.956 0.004 0.040
#> GSM71675 3 0.0162 0.954 0.000 0.000 0.996 0.004 0.000
#> GSM71676 3 0.5050 0.682 0.000 0.180 0.700 0.000 0.120
#> GSM71677 3 0.1544 0.932 0.000 0.000 0.932 0.000 0.068
#> GSM71678 2 0.0794 0.944 0.000 0.972 0.000 0.000 0.028
#> GSM71679 2 0.0794 0.944 0.000 0.972 0.000 0.000 0.028
#> GSM71680 2 0.4734 0.740 0.000 0.732 0.000 0.160 0.108
#> GSM71681 2 0.0404 0.943 0.000 0.988 0.000 0.000 0.012
#> GSM71682 2 0.0794 0.944 0.000 0.972 0.000 0.000 0.028
#> GSM71683 2 0.0162 0.944 0.000 0.996 0.000 0.000 0.004
#> GSM71684 2 0.0794 0.944 0.000 0.972 0.000 0.000 0.028
#> GSM71685 2 0.0404 0.943 0.000 0.988 0.000 0.000 0.012
#> GSM71686 2 0.0794 0.944 0.000 0.972 0.000 0.000 0.028
#> GSM71687 2 0.0703 0.945 0.000 0.976 0.000 0.000 0.024
#> GSM71688 2 0.0000 0.944 0.000 1.000 0.000 0.000 0.000
#> GSM71689 3 0.0000 0.955 0.000 0.000 1.000 0.000 0.000
#> GSM71690 2 0.0000 0.944 0.000 1.000 0.000 0.000 0.000
#> GSM71691 2 0.1121 0.929 0.000 0.956 0.000 0.000 0.044
#> GSM71692 3 0.0000 0.955 0.000 0.000 1.000 0.000 0.000
#> GSM71693 2 0.0162 0.944 0.000 0.996 0.000 0.000 0.004
#> GSM71694 3 0.0000 0.955 0.000 0.000 1.000 0.000 0.000
#> GSM71695 2 0.1121 0.929 0.000 0.956 0.000 0.000 0.044
#> GSM71696 5 0.4126 0.841 0.380 0.000 0.000 0.000 0.620
#> GSM71697 5 0.4114 0.847 0.376 0.000 0.000 0.000 0.624
#> GSM71698 5 0.3424 0.906 0.240 0.000 0.000 0.000 0.760
#> GSM71699 1 0.0609 0.924 0.980 0.000 0.000 0.000 0.020
#> GSM71700 5 0.4101 0.851 0.372 0.000 0.000 0.000 0.628
#> GSM71701 1 0.4015 0.253 0.652 0.000 0.000 0.000 0.348
#> GSM71702 1 0.0609 0.924 0.980 0.000 0.000 0.000 0.020
#> GSM71703 1 0.0609 0.924 0.980 0.000 0.000 0.000 0.020
#> GSM71704 1 0.0609 0.924 0.980 0.000 0.000 0.000 0.020
#> GSM71705 1 0.0609 0.924 0.980 0.000 0.000 0.000 0.020
#> GSM71706 1 0.0000 0.927 1.000 0.000 0.000 0.000 0.000
#> GSM71707 1 0.0609 0.924 0.980 0.000 0.000 0.000 0.020
#> GSM71708 1 0.0000 0.927 1.000 0.000 0.000 0.000 0.000
#> GSM71709 2 0.4734 0.740 0.000 0.732 0.000 0.160 0.108
#> GSM71710 1 0.0000 0.927 1.000 0.000 0.000 0.000 0.000
#> GSM71711 1 0.3932 0.106 0.672 0.000 0.000 0.000 0.328
#> GSM71712 4 0.0324 0.932 0.004 0.000 0.000 0.992 0.004
#> GSM71713 4 0.3339 0.784 0.040 0.000 0.000 0.836 0.124
#> GSM71714 5 0.3452 0.907 0.244 0.000 0.000 0.000 0.756
#> GSM71715 1 0.1270 0.888 0.948 0.000 0.000 0.000 0.052
#> GSM71716 1 0.0000 0.927 1.000 0.000 0.000 0.000 0.000
#> GSM71717 1 0.0000 0.927 1.000 0.000 0.000 0.000 0.000
#> GSM71718 5 0.3424 0.906 0.240 0.000 0.000 0.000 0.760
#> GSM71719 5 0.3424 0.906 0.240 0.000 0.000 0.000 0.760
#> GSM71720 5 0.3452 0.907 0.244 0.000 0.000 0.000 0.756
#> GSM71721 5 0.3424 0.906 0.240 0.000 0.000 0.000 0.760
#> GSM71722 5 0.3452 0.907 0.244 0.000 0.000 0.000 0.756
#> GSM71723 5 0.4101 0.851 0.372 0.000 0.000 0.000 0.628
#> GSM71724 5 0.3452 0.907 0.244 0.000 0.000 0.000 0.756
#> GSM71725 4 0.0451 0.931 0.004 0.000 0.000 0.988 0.008
#> GSM71726 4 0.0162 0.930 0.000 0.004 0.000 0.996 0.000
#> GSM71727 4 0.2470 0.894 0.000 0.012 0.000 0.884 0.104
#> GSM71728 4 0.0324 0.932 0.004 0.000 0.000 0.992 0.004
#> GSM71729 4 0.2470 0.894 0.000 0.012 0.000 0.884 0.104
#> GSM71730 2 0.3620 0.843 0.000 0.824 0.000 0.068 0.108
#> GSM71731 5 0.4101 0.851 0.372 0.000 0.000 0.000 0.628
#> GSM71732 5 0.3452 0.907 0.244 0.000 0.000 0.000 0.756
#> GSM71733 5 0.4201 0.797 0.408 0.000 0.000 0.000 0.592
#> GSM71734 1 0.0000 0.927 1.000 0.000 0.000 0.000 0.000
#> GSM71735 1 0.1341 0.879 0.944 0.000 0.000 0.000 0.056
#> GSM71736 1 0.0000 0.927 1.000 0.000 0.000 0.000 0.000
#> GSM71737 1 0.0000 0.927 1.000 0.000 0.000 0.000 0.000
#> GSM71738 1 0.0000 0.927 1.000 0.000 0.000 0.000 0.000
#> GSM71739 5 0.3395 0.902 0.236 0.000 0.000 0.000 0.764
#> GSM71740 5 0.4101 0.851 0.372 0.000 0.000 0.000 0.628
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> GSM71671 3 0.1723 0.9110 0.036 0.000 0.928 NA 0.000 0.000
#> GSM71672 3 0.0000 0.9261 0.000 0.000 1.000 NA 0.000 0.000
#> GSM71673 3 0.0000 0.9261 0.000 0.000 1.000 NA 0.000 0.000
#> GSM71674 3 0.1723 0.9110 0.036 0.000 0.928 NA 0.000 0.000
#> GSM71675 3 0.0146 0.9260 0.004 0.000 0.996 NA 0.000 0.000
#> GSM71676 3 0.6624 0.5132 0.104 0.184 0.536 NA 0.000 0.000
#> GSM71677 3 0.2860 0.8674 0.048 0.000 0.852 NA 0.000 0.000
#> GSM71678 2 0.1814 0.8600 0.000 0.900 0.000 NA 0.000 0.000
#> GSM71679 2 0.1814 0.8600 0.000 0.900 0.000 NA 0.000 0.000
#> GSM71680 2 0.5649 0.5026 0.016 0.512 0.000 NA 0.104 0.000
#> GSM71681 2 0.1995 0.8485 0.036 0.912 0.000 NA 0.000 0.000
#> GSM71682 2 0.1814 0.8600 0.000 0.900 0.000 NA 0.000 0.000
#> GSM71683 2 0.1334 0.8550 0.032 0.948 0.000 NA 0.000 0.000
#> GSM71684 2 0.1863 0.8595 0.000 0.896 0.000 NA 0.000 0.000
#> GSM71685 2 0.1995 0.8485 0.036 0.912 0.000 NA 0.000 0.000
#> GSM71686 2 0.1863 0.8595 0.000 0.896 0.000 NA 0.000 0.000
#> GSM71687 2 0.1753 0.8620 0.004 0.912 0.000 NA 0.000 0.000
#> GSM71688 2 0.0000 0.8616 0.000 1.000 0.000 NA 0.000 0.000
#> GSM71689 3 0.0547 0.9255 0.020 0.000 0.980 NA 0.000 0.000
#> GSM71690 2 0.0146 0.8615 0.004 0.996 0.000 NA 0.000 0.000
#> GSM71691 2 0.2263 0.8408 0.048 0.896 0.000 NA 0.000 0.000
#> GSM71692 3 0.0363 0.9257 0.012 0.000 0.988 NA 0.000 0.000
#> GSM71693 2 0.1334 0.8550 0.032 0.948 0.000 NA 0.000 0.000
#> GSM71694 3 0.0363 0.9257 0.012 0.000 0.988 NA 0.000 0.000
#> GSM71695 2 0.2263 0.8408 0.048 0.896 0.000 NA 0.000 0.000
#> GSM71696 1 0.3634 0.6392 0.696 0.000 0.000 NA 0.000 0.296
#> GSM71697 1 0.3508 0.6477 0.704 0.000 0.000 NA 0.000 0.292
#> GSM71698 1 0.5292 0.7800 0.600 0.000 0.000 NA 0.000 0.180
#> GSM71699 6 0.3043 0.7423 0.200 0.000 0.000 NA 0.000 0.792
#> GSM71700 1 0.3508 0.6477 0.704 0.000 0.000 NA 0.000 0.292
#> GSM71701 6 0.5863 -0.0882 0.236 0.000 0.000 NA 0.000 0.480
#> GSM71702 6 0.2964 0.7415 0.204 0.000 0.000 NA 0.000 0.792
#> GSM71703 6 0.2933 0.7428 0.200 0.000 0.000 NA 0.000 0.796
#> GSM71704 6 0.2933 0.7428 0.200 0.000 0.000 NA 0.000 0.796
#> GSM71705 6 0.2964 0.7415 0.204 0.000 0.000 NA 0.000 0.792
#> GSM71706 6 0.0146 0.7853 0.000 0.000 0.000 NA 0.000 0.996
#> GSM71707 6 0.2964 0.7415 0.204 0.000 0.000 NA 0.000 0.792
#> GSM71708 6 0.0146 0.7853 0.000 0.000 0.000 NA 0.000 0.996
#> GSM71709 2 0.5649 0.5026 0.016 0.512 0.000 NA 0.104 0.000
#> GSM71710 6 0.1588 0.7741 0.004 0.000 0.000 NA 0.000 0.924
#> GSM71711 6 0.4531 0.0632 0.464 0.000 0.000 NA 0.000 0.504
#> GSM71712 5 0.0000 0.8575 0.000 0.000 0.000 NA 1.000 0.000
#> GSM71713 5 0.3888 0.7518 0.076 0.000 0.000 NA 0.792 0.016
#> GSM71714 1 0.5631 0.7268 0.528 0.000 0.000 NA 0.000 0.188
#> GSM71715 6 0.3168 0.7108 0.056 0.000 0.000 NA 0.000 0.828
#> GSM71716 6 0.1701 0.7728 0.008 0.000 0.000 NA 0.000 0.920
#> GSM71717 6 0.1444 0.7743 0.000 0.000 0.000 NA 0.000 0.928
#> GSM71718 1 0.5270 0.7802 0.604 0.000 0.000 NA 0.000 0.180
#> GSM71719 1 0.5173 0.7832 0.620 0.000 0.000 NA 0.000 0.180
#> GSM71720 1 0.5067 0.7859 0.636 0.000 0.000 NA 0.000 0.180
#> GSM71721 1 0.5270 0.7802 0.604 0.000 0.000 NA 0.000 0.180
#> GSM71722 1 0.5039 0.7859 0.640 0.000 0.000 NA 0.000 0.180
#> GSM71723 1 0.3371 0.6505 0.708 0.000 0.000 NA 0.000 0.292
#> GSM71724 1 0.5454 0.7662 0.568 0.000 0.000 NA 0.000 0.180
#> GSM71725 5 0.1219 0.8445 0.004 0.000 0.000 NA 0.948 0.000
#> GSM71726 5 0.0260 0.8571 0.000 0.000 0.000 NA 0.992 0.000
#> GSM71727 5 0.3954 0.7152 0.000 0.012 0.000 NA 0.636 0.000
#> GSM71728 5 0.0000 0.8575 0.000 0.000 0.000 NA 1.000 0.000
#> GSM71729 5 0.3954 0.7152 0.000 0.012 0.000 NA 0.636 0.000
#> GSM71730 2 0.4828 0.5765 0.000 0.568 0.000 NA 0.064 0.000
#> GSM71731 1 0.3371 0.6505 0.708 0.000 0.000 NA 0.000 0.292
#> GSM71732 1 0.5228 0.7841 0.612 0.000 0.000 NA 0.000 0.192
#> GSM71733 1 0.3482 0.6075 0.684 0.000 0.000 NA 0.000 0.316
#> GSM71734 6 0.0458 0.7847 0.000 0.000 0.000 NA 0.000 0.984
#> GSM71735 6 0.3032 0.7166 0.056 0.000 0.000 NA 0.000 0.840
#> GSM71736 6 0.0458 0.7847 0.000 0.000 0.000 NA 0.000 0.984
#> GSM71737 6 0.1444 0.7743 0.000 0.000 0.000 NA 0.000 0.928
#> GSM71738 6 0.2730 0.7479 0.192 0.000 0.000 NA 0.000 0.808
#> GSM71739 1 0.5374 0.7575 0.580 0.000 0.000 NA 0.000 0.168
#> GSM71740 1 0.3371 0.6505 0.708 0.000 0.000 NA 0.000 0.292
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) k
#> ATC:kmeans 70 1.15e-12 2
#> ATC:kmeans 70 1.63e-17 3
#> ATC:kmeans 70 1.39e-19 4
#> ATC:kmeans 68 9.91e-18 5
#> ATC:kmeans 68 9.91e-18 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 21168 rows and 70 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.4974 0.503 0.503
#> 3 3 0.871 0.930 0.933 0.1948 0.864 0.738
#> 4 4 1.000 0.979 0.987 0.0939 0.924 0.817
#> 5 5 0.821 0.526 0.805 0.1196 0.885 0.681
#> 6 6 0.800 0.861 0.874 0.0621 0.879 0.573
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
#> GSM71671 2 0.0000 1.000 0.000 1.000
#> GSM71672 2 0.0000 1.000 0.000 1.000
#> GSM71673 2 0.0000 1.000 0.000 1.000
#> GSM71674 2 0.0000 1.000 0.000 1.000
#> GSM71675 2 0.0000 1.000 0.000 1.000
#> GSM71676 2 0.0000 1.000 0.000 1.000
#> GSM71677 2 0.0000 1.000 0.000 1.000
#> GSM71678 2 0.0000 1.000 0.000 1.000
#> GSM71679 2 0.0000 1.000 0.000 1.000
#> GSM71680 2 0.0000 1.000 0.000 1.000
#> GSM71681 2 0.0000 1.000 0.000 1.000
#> GSM71682 2 0.0000 1.000 0.000 1.000
#> GSM71683 2 0.0000 1.000 0.000 1.000
#> GSM71684 2 0.0000 1.000 0.000 1.000
#> GSM71685 2 0.0000 1.000 0.000 1.000
#> GSM71686 2 0.0000 1.000 0.000 1.000
#> GSM71687 2 0.0000 1.000 0.000 1.000
#> GSM71688 2 0.0000 1.000 0.000 1.000
#> GSM71689 2 0.0000 1.000 0.000 1.000
#> GSM71690 2 0.0000 1.000 0.000 1.000
#> GSM71691 2 0.0000 1.000 0.000 1.000
#> GSM71692 2 0.0000 1.000 0.000 1.000
#> GSM71693 2 0.0000 1.000 0.000 1.000
#> GSM71694 2 0.0000 1.000 0.000 1.000
#> GSM71695 2 0.0000 1.000 0.000 1.000
#> GSM71696 1 0.0000 1.000 1.000 0.000
#> GSM71697 1 0.0000 1.000 1.000 0.000
#> GSM71698 1 0.0000 1.000 1.000 0.000
#> GSM71699 1 0.0000 1.000 1.000 0.000
#> GSM71700 1 0.0000 1.000 1.000 0.000
#> GSM71701 1 0.0000 1.000 1.000 0.000
#> GSM71702 1 0.0000 1.000 1.000 0.000
#> GSM71703 1 0.0000 1.000 1.000 0.000
#> GSM71704 1 0.0000 1.000 1.000 0.000
#> GSM71705 1 0.0000 1.000 1.000 0.000
#> GSM71706 1 0.0000 1.000 1.000 0.000
#> GSM71707 1 0.0000 1.000 1.000 0.000
#> GSM71708 1 0.0000 1.000 1.000 0.000
#> GSM71709 2 0.0000 1.000 0.000 1.000
#> GSM71710 1 0.0000 1.000 1.000 0.000
#> GSM71711 1 0.0000 1.000 1.000 0.000
#> GSM71712 1 0.0672 0.992 0.992 0.008
#> GSM71713 1 0.0000 1.000 1.000 0.000
#> GSM71714 1 0.0000 1.000 1.000 0.000
#> GSM71715 1 0.0000 1.000 1.000 0.000
#> GSM71716 1 0.0000 1.000 1.000 0.000
#> GSM71717 1 0.0000 1.000 1.000 0.000
#> GSM71718 1 0.0000 1.000 1.000 0.000
#> GSM71719 1 0.0000 1.000 1.000 0.000
#> GSM71720 1 0.0000 1.000 1.000 0.000
#> GSM71721 1 0.0000 1.000 1.000 0.000
#> GSM71722 1 0.0000 1.000 1.000 0.000
#> GSM71723 1 0.0000 1.000 1.000 0.000
#> GSM71724 1 0.0000 1.000 1.000 0.000
#> GSM71725 1 0.0000 1.000 1.000 0.000
#> GSM71726 2 0.0000 1.000 0.000 1.000
#> GSM71727 2 0.0000 1.000 0.000 1.000
#> GSM71728 1 0.0000 1.000 1.000 0.000
#> GSM71729 2 0.0000 1.000 0.000 1.000
#> GSM71730 2 0.0000 1.000 0.000 1.000
#> GSM71731 1 0.0000 1.000 1.000 0.000
#> GSM71732 1 0.0000 1.000 1.000 0.000
#> GSM71733 1 0.0000 1.000 1.000 0.000
#> GSM71734 1 0.0000 1.000 1.000 0.000
#> GSM71735 1 0.0000 1.000 1.000 0.000
#> GSM71736 1 0.0000 1.000 1.000 0.000
#> GSM71737 1 0.0000 1.000 1.000 0.000
#> GSM71738 1 0.0000 1.000 1.000 0.000
#> GSM71739 1 0.0000 1.000 1.000 0.000
#> GSM71740 1 0.0000 1.000 1.000 0.000
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> GSM71671 3 0.4796 0.956 0.000 0.220 0.780
#> GSM71672 3 0.4796 0.956 0.000 0.220 0.780
#> GSM71673 3 0.4796 0.956 0.000 0.220 0.780
#> GSM71674 3 0.4796 0.956 0.000 0.220 0.780
#> GSM71675 3 0.4796 0.956 0.000 0.220 0.780
#> GSM71676 3 0.4796 0.956 0.000 0.220 0.780
#> GSM71677 3 0.4796 0.956 0.000 0.220 0.780
#> GSM71678 2 0.0000 0.925 0.000 1.000 0.000
#> GSM71679 2 0.0000 0.925 0.000 1.000 0.000
#> GSM71680 2 0.0000 0.925 0.000 1.000 0.000
#> GSM71681 2 0.0000 0.925 0.000 1.000 0.000
#> GSM71682 2 0.0000 0.925 0.000 1.000 0.000
#> GSM71683 2 0.0000 0.925 0.000 1.000 0.000
#> GSM71684 2 0.0000 0.925 0.000 1.000 0.000
#> GSM71685 2 0.0000 0.925 0.000 1.000 0.000
#> GSM71686 2 0.0000 0.925 0.000 1.000 0.000
#> GSM71687 2 0.0000 0.925 0.000 1.000 0.000
#> GSM71688 2 0.0000 0.925 0.000 1.000 0.000
#> GSM71689 3 0.4796 0.956 0.000 0.220 0.780
#> GSM71690 2 0.0000 0.925 0.000 1.000 0.000
#> GSM71691 3 0.6154 0.723 0.000 0.408 0.592
#> GSM71692 3 0.4796 0.956 0.000 0.220 0.780
#> GSM71693 2 0.0000 0.925 0.000 1.000 0.000
#> GSM71694 3 0.4796 0.956 0.000 0.220 0.780
#> GSM71695 3 0.6154 0.723 0.000 0.408 0.592
#> GSM71696 1 0.0000 0.984 1.000 0.000 0.000
#> GSM71697 1 0.0000 0.984 1.000 0.000 0.000
#> GSM71698 1 0.0000 0.984 1.000 0.000 0.000
#> GSM71699 1 0.0000 0.984 1.000 0.000 0.000
#> GSM71700 1 0.0000 0.984 1.000 0.000 0.000
#> GSM71701 1 0.0000 0.984 1.000 0.000 0.000
#> GSM71702 1 0.0000 0.984 1.000 0.000 0.000
#> GSM71703 1 0.0000 0.984 1.000 0.000 0.000
#> GSM71704 1 0.0000 0.984 1.000 0.000 0.000
#> GSM71705 1 0.0000 0.984 1.000 0.000 0.000
#> GSM71706 1 0.0000 0.984 1.000 0.000 0.000
#> GSM71707 1 0.0000 0.984 1.000 0.000 0.000
#> GSM71708 1 0.0000 0.984 1.000 0.000 0.000
#> GSM71709 2 0.0000 0.925 0.000 1.000 0.000
#> GSM71710 1 0.0000 0.984 1.000 0.000 0.000
#> GSM71711 1 0.0000 0.984 1.000 0.000 0.000
#> GSM71712 2 0.8081 0.566 0.136 0.644 0.220
#> GSM71713 1 0.4750 0.768 0.784 0.000 0.216
#> GSM71714 1 0.0000 0.984 1.000 0.000 0.000
#> GSM71715 1 0.0000 0.984 1.000 0.000 0.000
#> GSM71716 1 0.0000 0.984 1.000 0.000 0.000
#> GSM71717 1 0.0000 0.984 1.000 0.000 0.000
#> GSM71718 1 0.0000 0.984 1.000 0.000 0.000
#> GSM71719 1 0.0000 0.984 1.000 0.000 0.000
#> GSM71720 1 0.0000 0.984 1.000 0.000 0.000
#> GSM71721 1 0.0000 0.984 1.000 0.000 0.000
#> GSM71722 1 0.0000 0.984 1.000 0.000 0.000
#> GSM71723 1 0.0000 0.984 1.000 0.000 0.000
#> GSM71724 1 0.0000 0.984 1.000 0.000 0.000
#> GSM71725 1 0.8876 0.414 0.576 0.204 0.220
#> GSM71726 2 0.4796 0.716 0.000 0.780 0.220
#> GSM71727 2 0.0424 0.919 0.000 0.992 0.008
#> GSM71728 2 0.8024 0.572 0.132 0.648 0.220
#> GSM71729 2 0.3116 0.828 0.000 0.892 0.108
#> GSM71730 2 0.0000 0.925 0.000 1.000 0.000
#> GSM71731 1 0.0000 0.984 1.000 0.000 0.000
#> GSM71732 1 0.0000 0.984 1.000 0.000 0.000
#> GSM71733 1 0.0000 0.984 1.000 0.000 0.000
#> GSM71734 1 0.0000 0.984 1.000 0.000 0.000
#> GSM71735 1 0.0000 0.984 1.000 0.000 0.000
#> GSM71736 1 0.0000 0.984 1.000 0.000 0.000
#> GSM71737 1 0.0000 0.984 1.000 0.000 0.000
#> GSM71738 1 0.0000 0.984 1.000 0.000 0.000
#> GSM71739 1 0.0000 0.984 1.000 0.000 0.000
#> GSM71740 1 0.0000 0.984 1.000 0.000 0.000
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> GSM71671 3 0.0000 1.000 0.000 0.000 1.000 0.000
#> GSM71672 3 0.0000 1.000 0.000 0.000 1.000 0.000
#> GSM71673 3 0.0000 1.000 0.000 0.000 1.000 0.000
#> GSM71674 3 0.0000 1.000 0.000 0.000 1.000 0.000
#> GSM71675 3 0.0000 1.000 0.000 0.000 1.000 0.000
#> GSM71676 3 0.0000 1.000 0.000 0.000 1.000 0.000
#> GSM71677 3 0.0000 1.000 0.000 0.000 1.000 0.000
#> GSM71678 2 0.0000 0.974 0.000 1.000 0.000 0.000
#> GSM71679 2 0.0000 0.974 0.000 1.000 0.000 0.000
#> GSM71680 2 0.0188 0.972 0.000 0.996 0.000 0.004
#> GSM71681 2 0.0000 0.974 0.000 1.000 0.000 0.000
#> GSM71682 2 0.0000 0.974 0.000 1.000 0.000 0.000
#> GSM71683 2 0.0000 0.974 0.000 1.000 0.000 0.000
#> GSM71684 2 0.0000 0.974 0.000 1.000 0.000 0.000
#> GSM71685 2 0.0000 0.974 0.000 1.000 0.000 0.000
#> GSM71686 2 0.0000 0.974 0.000 1.000 0.000 0.000
#> GSM71687 2 0.0000 0.974 0.000 1.000 0.000 0.000
#> GSM71688 2 0.0000 0.974 0.000 1.000 0.000 0.000
#> GSM71689 3 0.0000 1.000 0.000 0.000 1.000 0.000
#> GSM71690 2 0.0000 0.974 0.000 1.000 0.000 0.000
#> GSM71691 2 0.1792 0.914 0.000 0.932 0.068 0.000
#> GSM71692 3 0.0000 1.000 0.000 0.000 1.000 0.000
#> GSM71693 2 0.0000 0.974 0.000 1.000 0.000 0.000
#> GSM71694 3 0.0000 1.000 0.000 0.000 1.000 0.000
#> GSM71695 2 0.1389 0.933 0.000 0.952 0.048 0.000
#> GSM71696 1 0.0592 0.988 0.984 0.000 0.000 0.016
#> GSM71697 1 0.0817 0.987 0.976 0.000 0.000 0.024
#> GSM71698 1 0.0817 0.987 0.976 0.000 0.000 0.024
#> GSM71699 1 0.0000 0.990 1.000 0.000 0.000 0.000
#> GSM71700 1 0.0817 0.987 0.976 0.000 0.000 0.024
#> GSM71701 1 0.0000 0.990 1.000 0.000 0.000 0.000
#> GSM71702 1 0.0000 0.990 1.000 0.000 0.000 0.000
#> GSM71703 1 0.0000 0.990 1.000 0.000 0.000 0.000
#> GSM71704 1 0.0000 0.990 1.000 0.000 0.000 0.000
#> GSM71705 1 0.0000 0.990 1.000 0.000 0.000 0.000
#> GSM71706 1 0.0000 0.990 1.000 0.000 0.000 0.000
#> GSM71707 1 0.0000 0.990 1.000 0.000 0.000 0.000
#> GSM71708 1 0.0000 0.990 1.000 0.000 0.000 0.000
#> GSM71709 2 0.0188 0.972 0.000 0.996 0.000 0.004
#> GSM71710 1 0.0000 0.990 1.000 0.000 0.000 0.000
#> GSM71711 1 0.0188 0.989 0.996 0.000 0.000 0.004
#> GSM71712 4 0.0817 0.980 0.000 0.024 0.000 0.976
#> GSM71713 4 0.0188 0.967 0.004 0.000 0.000 0.996
#> GSM71714 1 0.0469 0.989 0.988 0.000 0.000 0.012
#> GSM71715 1 0.0000 0.990 1.000 0.000 0.000 0.000
#> GSM71716 1 0.0000 0.990 1.000 0.000 0.000 0.000
#> GSM71717 1 0.0000 0.990 1.000 0.000 0.000 0.000
#> GSM71718 1 0.0817 0.987 0.976 0.000 0.000 0.024
#> GSM71719 1 0.0817 0.987 0.976 0.000 0.000 0.024
#> GSM71720 1 0.0817 0.987 0.976 0.000 0.000 0.024
#> GSM71721 1 0.0817 0.987 0.976 0.000 0.000 0.024
#> GSM71722 1 0.0817 0.987 0.976 0.000 0.000 0.024
#> GSM71723 1 0.0817 0.987 0.976 0.000 0.000 0.024
#> GSM71724 1 0.0817 0.987 0.976 0.000 0.000 0.024
#> GSM71725 4 0.0000 0.970 0.000 0.000 0.000 1.000
#> GSM71726 4 0.0817 0.980 0.000 0.024 0.000 0.976
#> GSM71727 2 0.2530 0.873 0.000 0.888 0.000 0.112
#> GSM71728 4 0.0817 0.980 0.000 0.024 0.000 0.976
#> GSM71729 2 0.3726 0.742 0.000 0.788 0.000 0.212
#> GSM71730 2 0.0000 0.974 0.000 1.000 0.000 0.000
#> GSM71731 1 0.0817 0.987 0.976 0.000 0.000 0.024
#> GSM71732 1 0.0707 0.988 0.980 0.000 0.000 0.020
#> GSM71733 1 0.0817 0.987 0.976 0.000 0.000 0.024
#> GSM71734 1 0.0000 0.990 1.000 0.000 0.000 0.000
#> GSM71735 1 0.0000 0.990 1.000 0.000 0.000 0.000
#> GSM71736 1 0.0000 0.990 1.000 0.000 0.000 0.000
#> GSM71737 1 0.0000 0.990 1.000 0.000 0.000 0.000
#> GSM71738 1 0.0000 0.990 1.000 0.000 0.000 0.000
#> GSM71739 1 0.0817 0.987 0.976 0.000 0.000 0.024
#> GSM71740 1 0.0817 0.987 0.976 0.000 0.000 0.024
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> GSM71671 3 0.0000 1.000 0.000 0.000 1.000 0.000 0.000
#> GSM71672 3 0.0000 1.000 0.000 0.000 1.000 0.000 0.000
#> GSM71673 3 0.0000 1.000 0.000 0.000 1.000 0.000 0.000
#> GSM71674 3 0.0000 1.000 0.000 0.000 1.000 0.000 0.000
#> GSM71675 3 0.0000 1.000 0.000 0.000 1.000 0.000 0.000
#> GSM71676 3 0.0000 1.000 0.000 0.000 1.000 0.000 0.000
#> GSM71677 3 0.0000 1.000 0.000 0.000 1.000 0.000 0.000
#> GSM71678 2 0.0000 0.890 0.000 1.000 0.000 0.000 0.000
#> GSM71679 2 0.0000 0.890 0.000 1.000 0.000 0.000 0.000
#> GSM71680 2 0.4297 0.267 0.000 0.528 0.000 0.472 0.000
#> GSM71681 2 0.0162 0.888 0.000 0.996 0.000 0.004 0.000
#> GSM71682 2 0.0000 0.890 0.000 1.000 0.000 0.000 0.000
#> GSM71683 2 0.0000 0.890 0.000 1.000 0.000 0.000 0.000
#> GSM71684 2 0.0000 0.890 0.000 1.000 0.000 0.000 0.000
#> GSM71685 2 0.0162 0.888 0.000 0.996 0.000 0.004 0.000
#> GSM71686 2 0.0000 0.890 0.000 1.000 0.000 0.000 0.000
#> GSM71687 2 0.0000 0.890 0.000 1.000 0.000 0.000 0.000
#> GSM71688 2 0.0000 0.890 0.000 1.000 0.000 0.000 0.000
#> GSM71689 3 0.0000 1.000 0.000 0.000 1.000 0.000 0.000
#> GSM71690 2 0.0000 0.890 0.000 1.000 0.000 0.000 0.000
#> GSM71691 2 0.1792 0.803 0.000 0.916 0.084 0.000 0.000
#> GSM71692 3 0.0000 1.000 0.000 0.000 1.000 0.000 0.000
#> GSM71693 2 0.0000 0.890 0.000 1.000 0.000 0.000 0.000
#> GSM71694 3 0.0000 1.000 0.000 0.000 1.000 0.000 0.000
#> GSM71695 2 0.1341 0.836 0.000 0.944 0.056 0.000 0.000
#> GSM71696 1 0.4297 -0.598 0.528 0.000 0.000 0.000 0.472
#> GSM71697 1 0.4305 -0.642 0.512 0.000 0.000 0.000 0.488
#> GSM71698 5 0.4304 0.674 0.484 0.000 0.000 0.000 0.516
#> GSM71699 1 0.0609 0.668 0.980 0.000 0.000 0.000 0.020
#> GSM71700 1 0.4307 -0.666 0.504 0.000 0.000 0.000 0.496
#> GSM71701 1 0.0609 0.658 0.980 0.000 0.000 0.000 0.020
#> GSM71702 1 0.1341 0.644 0.944 0.000 0.000 0.000 0.056
#> GSM71703 1 0.0794 0.665 0.972 0.000 0.000 0.000 0.028
#> GSM71704 1 0.0880 0.663 0.968 0.000 0.000 0.000 0.032
#> GSM71705 1 0.1121 0.655 0.956 0.000 0.000 0.000 0.044
#> GSM71706 1 0.0000 0.673 1.000 0.000 0.000 0.000 0.000
#> GSM71707 1 0.1197 0.652 0.952 0.000 0.000 0.000 0.048
#> GSM71708 1 0.0000 0.673 1.000 0.000 0.000 0.000 0.000
#> GSM71709 2 0.4300 0.259 0.000 0.524 0.000 0.476 0.000
#> GSM71710 1 0.0000 0.673 1.000 0.000 0.000 0.000 0.000
#> GSM71711 1 0.3586 0.226 0.736 0.000 0.000 0.000 0.264
#> GSM71712 4 0.4287 0.660 0.000 0.000 0.000 0.540 0.460
#> GSM71713 5 0.4443 -0.745 0.004 0.000 0.000 0.472 0.524
#> GSM71714 1 0.4201 -0.384 0.592 0.000 0.000 0.000 0.408
#> GSM71715 1 0.0162 0.670 0.996 0.000 0.000 0.000 0.004
#> GSM71716 1 0.0000 0.673 1.000 0.000 0.000 0.000 0.000
#> GSM71717 1 0.0000 0.673 1.000 0.000 0.000 0.000 0.000
#> GSM71718 5 0.4304 0.674 0.484 0.000 0.000 0.000 0.516
#> GSM71719 5 0.4304 0.674 0.484 0.000 0.000 0.000 0.516
#> GSM71720 5 0.4304 0.674 0.484 0.000 0.000 0.000 0.516
#> GSM71721 5 0.4304 0.674 0.484 0.000 0.000 0.000 0.516
#> GSM71722 5 0.4304 0.674 0.484 0.000 0.000 0.000 0.516
#> GSM71723 1 0.4305 -0.642 0.512 0.000 0.000 0.000 0.488
#> GSM71724 5 0.4304 0.674 0.484 0.000 0.000 0.000 0.516
#> GSM71725 4 0.4302 0.657 0.000 0.000 0.000 0.520 0.480
#> GSM71726 4 0.4201 0.655 0.000 0.000 0.000 0.592 0.408
#> GSM71727 4 0.4297 -0.300 0.000 0.472 0.000 0.528 0.000
#> GSM71728 4 0.4278 0.661 0.000 0.000 0.000 0.548 0.452
#> GSM71729 4 0.4192 -0.146 0.000 0.404 0.000 0.596 0.000
#> GSM71730 2 0.4161 0.424 0.000 0.608 0.000 0.392 0.000
#> GSM71731 1 0.4306 -0.654 0.508 0.000 0.000 0.000 0.492
#> GSM71732 1 0.4304 -0.629 0.516 0.000 0.000 0.000 0.484
#> GSM71733 1 0.4305 -0.642 0.512 0.000 0.000 0.000 0.488
#> GSM71734 1 0.0000 0.673 1.000 0.000 0.000 0.000 0.000
#> GSM71735 1 0.0000 0.673 1.000 0.000 0.000 0.000 0.000
#> GSM71736 1 0.0000 0.673 1.000 0.000 0.000 0.000 0.000
#> GSM71737 1 0.0000 0.673 1.000 0.000 0.000 0.000 0.000
#> GSM71738 1 0.0290 0.672 0.992 0.000 0.000 0.000 0.008
#> GSM71739 5 0.4307 0.617 0.500 0.000 0.000 0.000 0.500
#> GSM71740 1 0.4302 -0.620 0.520 0.000 0.000 0.000 0.480
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> GSM71671 3 0.0000 1.000 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM71672 3 0.0000 1.000 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM71673 3 0.0000 1.000 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM71674 3 0.0000 1.000 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM71675 3 0.0000 1.000 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM71676 3 0.0000 1.000 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM71677 3 0.0000 1.000 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM71678 2 0.1003 0.978 0.016 0.964 0.000 0.020 0.000 0.000
#> GSM71679 2 0.1003 0.978 0.016 0.964 0.000 0.020 0.000 0.000
#> GSM71680 4 0.2053 0.917 0.004 0.108 0.000 0.888 0.000 0.000
#> GSM71681 2 0.0603 0.979 0.004 0.980 0.000 0.016 0.000 0.000
#> GSM71682 2 0.1003 0.978 0.016 0.964 0.000 0.020 0.000 0.000
#> GSM71683 2 0.0146 0.978 0.004 0.996 0.000 0.000 0.000 0.000
#> GSM71684 2 0.0914 0.978 0.016 0.968 0.000 0.016 0.000 0.000
#> GSM71685 2 0.0692 0.977 0.004 0.976 0.000 0.020 0.000 0.000
#> GSM71686 2 0.1003 0.978 0.016 0.964 0.000 0.020 0.000 0.000
#> GSM71687 2 0.0363 0.977 0.000 0.988 0.000 0.012 0.000 0.000
#> GSM71688 2 0.0508 0.981 0.004 0.984 0.000 0.012 0.000 0.000
#> GSM71689 3 0.0000 1.000 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM71690 2 0.0508 0.981 0.004 0.984 0.000 0.012 0.000 0.000
#> GSM71691 2 0.0665 0.969 0.004 0.980 0.008 0.008 0.000 0.000
#> GSM71692 3 0.0000 1.000 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM71693 2 0.0291 0.977 0.004 0.992 0.000 0.004 0.000 0.000
#> GSM71694 3 0.0000 1.000 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM71695 2 0.0551 0.972 0.004 0.984 0.004 0.008 0.000 0.000
#> GSM71696 1 0.4556 0.656 0.516 0.000 0.000 0.020 0.008 0.456
#> GSM71697 1 0.4436 0.812 0.592 0.000 0.000 0.020 0.008 0.380
#> GSM71698 1 0.3189 0.845 0.760 0.000 0.000 0.004 0.000 0.236
#> GSM71699 6 0.1951 0.834 0.060 0.000 0.000 0.020 0.004 0.916
#> GSM71700 1 0.4345 0.836 0.624 0.000 0.000 0.020 0.008 0.348
#> GSM71701 6 0.2450 0.752 0.116 0.000 0.000 0.016 0.000 0.868
#> GSM71702 6 0.3163 0.719 0.144 0.000 0.000 0.024 0.008 0.824
#> GSM71703 6 0.2182 0.822 0.076 0.000 0.000 0.020 0.004 0.900
#> GSM71704 6 0.2262 0.815 0.080 0.000 0.000 0.016 0.008 0.896
#> GSM71705 6 0.2871 0.766 0.116 0.000 0.000 0.024 0.008 0.852
#> GSM71706 6 0.0291 0.859 0.004 0.000 0.000 0.004 0.000 0.992
#> GSM71707 6 0.2748 0.769 0.120 0.000 0.000 0.016 0.008 0.856
#> GSM71708 6 0.0146 0.859 0.000 0.000 0.000 0.004 0.000 0.996
#> GSM71709 4 0.2053 0.917 0.004 0.108 0.000 0.888 0.000 0.000
#> GSM71710 6 0.0260 0.859 0.008 0.000 0.000 0.000 0.000 0.992
#> GSM71711 6 0.4103 0.290 0.288 0.000 0.000 0.020 0.008 0.684
#> GSM71712 5 0.0806 0.904 0.008 0.000 0.000 0.020 0.972 0.000
#> GSM71713 5 0.2554 0.862 0.076 0.000 0.000 0.048 0.876 0.000
#> GSM71714 6 0.4084 -0.284 0.400 0.000 0.000 0.012 0.000 0.588
#> GSM71715 6 0.1714 0.757 0.092 0.000 0.000 0.000 0.000 0.908
#> GSM71716 6 0.0146 0.858 0.004 0.000 0.000 0.000 0.000 0.996
#> GSM71717 6 0.0146 0.858 0.004 0.000 0.000 0.000 0.000 0.996
#> GSM71718 1 0.3050 0.846 0.764 0.000 0.000 0.000 0.000 0.236
#> GSM71719 1 0.3101 0.851 0.756 0.000 0.000 0.000 0.000 0.244
#> GSM71720 1 0.3151 0.854 0.748 0.000 0.000 0.000 0.000 0.252
#> GSM71721 1 0.3050 0.846 0.764 0.000 0.000 0.000 0.000 0.236
#> GSM71722 1 0.3175 0.854 0.744 0.000 0.000 0.000 0.000 0.256
#> GSM71723 1 0.4326 0.825 0.608 0.000 0.000 0.016 0.008 0.368
#> GSM71724 1 0.3349 0.848 0.748 0.000 0.000 0.008 0.000 0.244
#> GSM71725 5 0.1644 0.899 0.040 0.000 0.000 0.028 0.932 0.000
#> GSM71726 5 0.3345 0.745 0.020 0.000 0.000 0.204 0.776 0.000
#> GSM71727 4 0.1780 0.895 0.000 0.048 0.000 0.924 0.028 0.000
#> GSM71728 5 0.1334 0.899 0.020 0.000 0.000 0.032 0.948 0.000
#> GSM71729 4 0.1649 0.881 0.000 0.036 0.000 0.932 0.032 0.000
#> GSM71730 4 0.2664 0.827 0.000 0.184 0.000 0.816 0.000 0.000
#> GSM71731 1 0.4291 0.833 0.620 0.000 0.000 0.016 0.008 0.356
#> GSM71732 1 0.3742 0.818 0.648 0.000 0.000 0.004 0.000 0.348
#> GSM71733 1 0.4455 0.800 0.584 0.000 0.000 0.020 0.008 0.388
#> GSM71734 6 0.0291 0.859 0.004 0.000 0.000 0.004 0.000 0.992
#> GSM71735 6 0.0000 0.859 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM71736 6 0.0146 0.859 0.000 0.000 0.000 0.004 0.000 0.996
#> GSM71737 6 0.0146 0.858 0.004 0.000 0.000 0.000 0.000 0.996
#> GSM71738 6 0.1196 0.848 0.040 0.000 0.000 0.008 0.000 0.952
#> GSM71739 1 0.3596 0.740 0.740 0.000 0.000 0.008 0.008 0.244
#> GSM71740 1 0.4419 0.773 0.568 0.000 0.000 0.016 0.008 0.408
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) k
#> ATC:skmeans 70 5.50e-12 2
#> ATC:skmeans 69 4.15e-15 3
#> ATC:skmeans 70 5.30e-18 4
#> ATC:skmeans 54 4.51e-15 5
#> ATC:skmeans 68 1.15e-17 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 21168 rows and 70 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 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.995 0.4943 0.508 0.508
#> 3 3 1.000 0.980 0.992 0.1608 0.921 0.845
#> 4 4 0.970 0.958 0.978 0.1145 0.918 0.811
#> 5 5 0.914 0.918 0.945 0.2182 0.854 0.594
#> 6 6 0.870 0.740 0.888 0.0342 0.962 0.827
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
#> GSM71671 2 0.0000 1.000 0.000 1.000
#> GSM71672 2 0.0000 1.000 0.000 1.000
#> GSM71673 2 0.0000 1.000 0.000 1.000
#> GSM71674 2 0.0000 1.000 0.000 1.000
#> GSM71675 2 0.0000 1.000 0.000 1.000
#> GSM71676 2 0.0000 1.000 0.000 1.000
#> GSM71677 2 0.0000 1.000 0.000 1.000
#> GSM71678 2 0.0000 1.000 0.000 1.000
#> GSM71679 2 0.0000 1.000 0.000 1.000
#> GSM71680 2 0.0000 1.000 0.000 1.000
#> GSM71681 2 0.0000 1.000 0.000 1.000
#> GSM71682 2 0.0000 1.000 0.000 1.000
#> GSM71683 2 0.0000 1.000 0.000 1.000
#> GSM71684 2 0.0000 1.000 0.000 1.000
#> GSM71685 2 0.0000 1.000 0.000 1.000
#> GSM71686 2 0.0000 1.000 0.000 1.000
#> GSM71687 2 0.0000 1.000 0.000 1.000
#> GSM71688 2 0.0000 1.000 0.000 1.000
#> GSM71689 2 0.0000 1.000 0.000 1.000
#> GSM71690 2 0.0000 1.000 0.000 1.000
#> GSM71691 2 0.0000 1.000 0.000 1.000
#> GSM71692 2 0.0000 1.000 0.000 1.000
#> GSM71693 2 0.0000 1.000 0.000 1.000
#> GSM71694 2 0.0000 1.000 0.000 1.000
#> GSM71695 2 0.0000 1.000 0.000 1.000
#> GSM71696 1 0.0000 0.992 1.000 0.000
#> GSM71697 1 0.0000 0.992 1.000 0.000
#> GSM71698 1 0.0000 0.992 1.000 0.000
#> GSM71699 1 0.0000 0.992 1.000 0.000
#> GSM71700 1 0.0000 0.992 1.000 0.000
#> GSM71701 1 0.0000 0.992 1.000 0.000
#> GSM71702 1 0.0000 0.992 1.000 0.000
#> GSM71703 1 0.0000 0.992 1.000 0.000
#> GSM71704 1 0.0000 0.992 1.000 0.000
#> GSM71705 1 0.0000 0.992 1.000 0.000
#> GSM71706 1 0.0000 0.992 1.000 0.000
#> GSM71707 1 0.0000 0.992 1.000 0.000
#> GSM71708 1 0.0000 0.992 1.000 0.000
#> GSM71709 2 0.0000 1.000 0.000 1.000
#> GSM71710 1 0.0000 0.992 1.000 0.000
#> GSM71711 1 0.0000 0.992 1.000 0.000
#> GSM71712 1 0.0376 0.988 0.996 0.004
#> GSM71713 1 0.0000 0.992 1.000 0.000
#> GSM71714 1 0.0000 0.992 1.000 0.000
#> GSM71715 1 0.0000 0.992 1.000 0.000
#> GSM71716 1 0.0000 0.992 1.000 0.000
#> GSM71717 1 0.0000 0.992 1.000 0.000
#> GSM71718 1 0.0000 0.992 1.000 0.000
#> GSM71719 1 0.0000 0.992 1.000 0.000
#> GSM71720 1 0.0000 0.992 1.000 0.000
#> GSM71721 1 0.0000 0.992 1.000 0.000
#> GSM71722 1 0.0000 0.992 1.000 0.000
#> GSM71723 1 0.0000 0.992 1.000 0.000
#> GSM71724 1 0.0000 0.992 1.000 0.000
#> GSM71725 1 0.0000 0.992 1.000 0.000
#> GSM71726 1 0.8955 0.547 0.688 0.312
#> GSM71727 2 0.0000 1.000 0.000 1.000
#> GSM71728 1 0.0000 0.992 1.000 0.000
#> GSM71729 2 0.0000 1.000 0.000 1.000
#> GSM71730 2 0.0000 1.000 0.000 1.000
#> GSM71731 1 0.0000 0.992 1.000 0.000
#> GSM71732 1 0.0000 0.992 1.000 0.000
#> GSM71733 1 0.0000 0.992 1.000 0.000
#> GSM71734 1 0.0000 0.992 1.000 0.000
#> GSM71735 1 0.0000 0.992 1.000 0.000
#> GSM71736 1 0.0000 0.992 1.000 0.000
#> GSM71737 1 0.0000 0.992 1.000 0.000
#> GSM71738 1 0.0000 0.992 1.000 0.000
#> GSM71739 1 0.0000 0.992 1.000 0.000
#> GSM71740 1 0.0000 0.992 1.000 0.000
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> GSM71671 3 0.000 0.978 0.000 0.000 1.000
#> GSM71672 3 0.000 0.978 0.000 0.000 1.000
#> GSM71673 3 0.000 0.978 0.000 0.000 1.000
#> GSM71674 3 0.000 0.978 0.000 0.000 1.000
#> GSM71675 3 0.000 0.978 0.000 0.000 1.000
#> GSM71676 3 0.445 0.759 0.000 0.192 0.808
#> GSM71677 3 0.000 0.978 0.000 0.000 1.000
#> GSM71678 2 0.000 1.000 0.000 1.000 0.000
#> GSM71679 2 0.000 1.000 0.000 1.000 0.000
#> GSM71680 2 0.000 1.000 0.000 1.000 0.000
#> GSM71681 2 0.000 1.000 0.000 1.000 0.000
#> GSM71682 2 0.000 1.000 0.000 1.000 0.000
#> GSM71683 2 0.000 1.000 0.000 1.000 0.000
#> GSM71684 2 0.000 1.000 0.000 1.000 0.000
#> GSM71685 2 0.000 1.000 0.000 1.000 0.000
#> GSM71686 2 0.000 1.000 0.000 1.000 0.000
#> GSM71687 2 0.000 1.000 0.000 1.000 0.000
#> GSM71688 2 0.000 1.000 0.000 1.000 0.000
#> GSM71689 3 0.000 0.978 0.000 0.000 1.000
#> GSM71690 2 0.000 1.000 0.000 1.000 0.000
#> GSM71691 2 0.000 1.000 0.000 1.000 0.000
#> GSM71692 3 0.000 0.978 0.000 0.000 1.000
#> GSM71693 2 0.000 1.000 0.000 1.000 0.000
#> GSM71694 3 0.000 0.978 0.000 0.000 1.000
#> GSM71695 2 0.000 1.000 0.000 1.000 0.000
#> GSM71696 1 0.000 0.990 1.000 0.000 0.000
#> GSM71697 1 0.000 0.990 1.000 0.000 0.000
#> GSM71698 1 0.000 0.990 1.000 0.000 0.000
#> GSM71699 1 0.000 0.990 1.000 0.000 0.000
#> GSM71700 1 0.000 0.990 1.000 0.000 0.000
#> GSM71701 1 0.000 0.990 1.000 0.000 0.000
#> GSM71702 1 0.000 0.990 1.000 0.000 0.000
#> GSM71703 1 0.000 0.990 1.000 0.000 0.000
#> GSM71704 1 0.000 0.990 1.000 0.000 0.000
#> GSM71705 1 0.000 0.990 1.000 0.000 0.000
#> GSM71706 1 0.000 0.990 1.000 0.000 0.000
#> GSM71707 1 0.000 0.990 1.000 0.000 0.000
#> GSM71708 1 0.000 0.990 1.000 0.000 0.000
#> GSM71709 2 0.000 1.000 0.000 1.000 0.000
#> GSM71710 1 0.000 0.990 1.000 0.000 0.000
#> GSM71711 1 0.000 0.990 1.000 0.000 0.000
#> GSM71712 1 0.000 0.990 1.000 0.000 0.000
#> GSM71713 1 0.000 0.990 1.000 0.000 0.000
#> GSM71714 1 0.000 0.990 1.000 0.000 0.000
#> GSM71715 1 0.000 0.990 1.000 0.000 0.000
#> GSM71716 1 0.000 0.990 1.000 0.000 0.000
#> GSM71717 1 0.000 0.990 1.000 0.000 0.000
#> GSM71718 1 0.000 0.990 1.000 0.000 0.000
#> GSM71719 1 0.000 0.990 1.000 0.000 0.000
#> GSM71720 1 0.000 0.990 1.000 0.000 0.000
#> GSM71721 1 0.000 0.990 1.000 0.000 0.000
#> GSM71722 1 0.000 0.990 1.000 0.000 0.000
#> GSM71723 1 0.000 0.990 1.000 0.000 0.000
#> GSM71724 1 0.000 0.990 1.000 0.000 0.000
#> GSM71725 1 0.000 0.990 1.000 0.000 0.000
#> GSM71726 1 0.597 0.426 0.636 0.364 0.000
#> GSM71727 2 0.000 1.000 0.000 1.000 0.000
#> GSM71728 1 0.000 0.990 1.000 0.000 0.000
#> GSM71729 2 0.000 1.000 0.000 1.000 0.000
#> GSM71730 2 0.000 1.000 0.000 1.000 0.000
#> GSM71731 1 0.000 0.990 1.000 0.000 0.000
#> GSM71732 1 0.000 0.990 1.000 0.000 0.000
#> GSM71733 1 0.000 0.990 1.000 0.000 0.000
#> GSM71734 1 0.000 0.990 1.000 0.000 0.000
#> GSM71735 1 0.000 0.990 1.000 0.000 0.000
#> GSM71736 1 0.000 0.990 1.000 0.000 0.000
#> GSM71737 1 0.000 0.990 1.000 0.000 0.000
#> GSM71738 1 0.000 0.990 1.000 0.000 0.000
#> GSM71739 1 0.000 0.990 1.000 0.000 0.000
#> GSM71740 1 0.000 0.990 1.000 0.000 0.000
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> GSM71671 3 0.0000 0.950 0.000 0.000 1.000 0.000
#> GSM71672 3 0.0000 0.950 0.000 0.000 1.000 0.000
#> GSM71673 3 0.0000 0.950 0.000 0.000 1.000 0.000
#> GSM71674 3 0.0000 0.950 0.000 0.000 1.000 0.000
#> GSM71675 3 0.0000 0.950 0.000 0.000 1.000 0.000
#> GSM71676 3 0.5253 0.409 0.000 0.360 0.624 0.016
#> GSM71677 3 0.0000 0.950 0.000 0.000 1.000 0.000
#> GSM71678 2 0.0000 0.975 0.000 1.000 0.000 0.000
#> GSM71679 2 0.0000 0.975 0.000 1.000 0.000 0.000
#> GSM71680 4 0.3444 0.863 0.000 0.184 0.000 0.816
#> GSM71681 2 0.0000 0.975 0.000 1.000 0.000 0.000
#> GSM71682 2 0.0000 0.975 0.000 1.000 0.000 0.000
#> GSM71683 2 0.0000 0.975 0.000 1.000 0.000 0.000
#> GSM71684 2 0.4008 0.621 0.000 0.756 0.000 0.244
#> GSM71685 2 0.0592 0.964 0.000 0.984 0.000 0.016
#> GSM71686 2 0.0000 0.975 0.000 1.000 0.000 0.000
#> GSM71687 2 0.0000 0.975 0.000 1.000 0.000 0.000
#> GSM71688 2 0.0592 0.964 0.000 0.984 0.000 0.016
#> GSM71689 3 0.0000 0.950 0.000 0.000 1.000 0.000
#> GSM71690 2 0.0000 0.975 0.000 1.000 0.000 0.000
#> GSM71691 2 0.0000 0.975 0.000 1.000 0.000 0.000
#> GSM71692 3 0.0000 0.950 0.000 0.000 1.000 0.000
#> GSM71693 2 0.0000 0.975 0.000 1.000 0.000 0.000
#> GSM71694 3 0.0000 0.950 0.000 0.000 1.000 0.000
#> GSM71695 2 0.0336 0.970 0.000 0.992 0.000 0.008
#> GSM71696 1 0.0000 0.996 1.000 0.000 0.000 0.000
#> GSM71697 1 0.0000 0.996 1.000 0.000 0.000 0.000
#> GSM71698 1 0.0000 0.996 1.000 0.000 0.000 0.000
#> GSM71699 1 0.0000 0.996 1.000 0.000 0.000 0.000
#> GSM71700 1 0.0000 0.996 1.000 0.000 0.000 0.000
#> GSM71701 1 0.0000 0.996 1.000 0.000 0.000 0.000
#> GSM71702 1 0.0000 0.996 1.000 0.000 0.000 0.000
#> GSM71703 1 0.0000 0.996 1.000 0.000 0.000 0.000
#> GSM71704 1 0.0000 0.996 1.000 0.000 0.000 0.000
#> GSM71705 1 0.0000 0.996 1.000 0.000 0.000 0.000
#> GSM71706 1 0.0000 0.996 1.000 0.000 0.000 0.000
#> GSM71707 1 0.0000 0.996 1.000 0.000 0.000 0.000
#> GSM71708 1 0.0000 0.996 1.000 0.000 0.000 0.000
#> GSM71709 4 0.2814 0.916 0.000 0.132 0.000 0.868
#> GSM71710 1 0.0000 0.996 1.000 0.000 0.000 0.000
#> GSM71711 1 0.0000 0.996 1.000 0.000 0.000 0.000
#> GSM71712 4 0.0592 0.866 0.016 0.000 0.000 0.984
#> GSM71713 1 0.0188 0.993 0.996 0.000 0.000 0.004
#> GSM71714 1 0.0000 0.996 1.000 0.000 0.000 0.000
#> GSM71715 1 0.0000 0.996 1.000 0.000 0.000 0.000
#> GSM71716 1 0.0000 0.996 1.000 0.000 0.000 0.000
#> GSM71717 1 0.0000 0.996 1.000 0.000 0.000 0.000
#> GSM71718 1 0.0000 0.996 1.000 0.000 0.000 0.000
#> GSM71719 1 0.0000 0.996 1.000 0.000 0.000 0.000
#> GSM71720 1 0.0000 0.996 1.000 0.000 0.000 0.000
#> GSM71721 1 0.0000 0.996 1.000 0.000 0.000 0.000
#> GSM71722 1 0.0000 0.996 1.000 0.000 0.000 0.000
#> GSM71723 1 0.0000 0.996 1.000 0.000 0.000 0.000
#> GSM71724 1 0.0000 0.996 1.000 0.000 0.000 0.000
#> GSM71725 1 0.2814 0.857 0.868 0.000 0.000 0.132
#> GSM71726 4 0.0000 0.869 0.000 0.000 0.000 1.000
#> GSM71727 4 0.2814 0.916 0.000 0.132 0.000 0.868
#> GSM71728 4 0.0592 0.866 0.016 0.000 0.000 0.984
#> GSM71729 4 0.2814 0.916 0.000 0.132 0.000 0.868
#> GSM71730 4 0.2814 0.916 0.000 0.132 0.000 0.868
#> GSM71731 1 0.0000 0.996 1.000 0.000 0.000 0.000
#> GSM71732 1 0.0000 0.996 1.000 0.000 0.000 0.000
#> GSM71733 1 0.0000 0.996 1.000 0.000 0.000 0.000
#> GSM71734 1 0.0000 0.996 1.000 0.000 0.000 0.000
#> GSM71735 1 0.0000 0.996 1.000 0.000 0.000 0.000
#> GSM71736 1 0.0000 0.996 1.000 0.000 0.000 0.000
#> GSM71737 1 0.0000 0.996 1.000 0.000 0.000 0.000
#> GSM71738 1 0.0000 0.996 1.000 0.000 0.000 0.000
#> GSM71739 1 0.0000 0.996 1.000 0.000 0.000 0.000
#> GSM71740 1 0.0000 0.996 1.000 0.000 0.000 0.000
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> GSM71671 3 0.0000 0.954 0.000 0.000 1.000 0.000 0.000
#> GSM71672 3 0.0000 0.954 0.000 0.000 1.000 0.000 0.000
#> GSM71673 3 0.0000 0.954 0.000 0.000 1.000 0.000 0.000
#> GSM71674 3 0.0000 0.954 0.000 0.000 1.000 0.000 0.000
#> GSM71675 3 0.0000 0.954 0.000 0.000 1.000 0.000 0.000
#> GSM71676 3 0.5572 0.471 0.064 0.296 0.624 0.016 0.000
#> GSM71677 3 0.0000 0.954 0.000 0.000 1.000 0.000 0.000
#> GSM71678 2 0.0000 0.958 0.000 1.000 0.000 0.000 0.000
#> GSM71679 2 0.0000 0.958 0.000 1.000 0.000 0.000 0.000
#> GSM71680 4 0.3641 0.870 0.060 0.120 0.000 0.820 0.000
#> GSM71681 2 0.1478 0.924 0.064 0.936 0.000 0.000 0.000
#> GSM71682 2 0.0000 0.958 0.000 1.000 0.000 0.000 0.000
#> GSM71683 2 0.0510 0.952 0.016 0.984 0.000 0.000 0.000
#> GSM71684 2 0.3534 0.603 0.000 0.744 0.000 0.256 0.000
#> GSM71685 2 0.1981 0.917 0.064 0.920 0.000 0.016 0.000
#> GSM71686 2 0.0000 0.958 0.000 1.000 0.000 0.000 0.000
#> GSM71687 2 0.0000 0.958 0.000 1.000 0.000 0.000 0.000
#> GSM71688 2 0.0510 0.951 0.000 0.984 0.000 0.016 0.000
#> GSM71689 3 0.0000 0.954 0.000 0.000 1.000 0.000 0.000
#> GSM71690 2 0.0000 0.958 0.000 1.000 0.000 0.000 0.000
#> GSM71691 2 0.0000 0.958 0.000 1.000 0.000 0.000 0.000
#> GSM71692 3 0.0000 0.954 0.000 0.000 1.000 0.000 0.000
#> GSM71693 2 0.1478 0.924 0.064 0.936 0.000 0.000 0.000
#> GSM71694 3 0.0000 0.954 0.000 0.000 1.000 0.000 0.000
#> GSM71695 2 0.0290 0.955 0.000 0.992 0.000 0.008 0.000
#> GSM71696 5 0.3661 0.635 0.276 0.000 0.000 0.000 0.724
#> GSM71697 5 0.3210 0.735 0.212 0.000 0.000 0.000 0.788
#> GSM71698 5 0.0000 0.937 0.000 0.000 0.000 0.000 1.000
#> GSM71699 1 0.1478 0.990 0.936 0.000 0.000 0.000 0.064
#> GSM71700 5 0.0000 0.937 0.000 0.000 0.000 0.000 1.000
#> GSM71701 5 0.0000 0.937 0.000 0.000 0.000 0.000 1.000
#> GSM71702 1 0.1478 0.990 0.936 0.000 0.000 0.000 0.064
#> GSM71703 1 0.1478 0.990 0.936 0.000 0.000 0.000 0.064
#> GSM71704 1 0.1478 0.990 0.936 0.000 0.000 0.000 0.064
#> GSM71705 1 0.1478 0.990 0.936 0.000 0.000 0.000 0.064
#> GSM71706 1 0.1478 0.990 0.936 0.000 0.000 0.000 0.064
#> GSM71707 1 0.1608 0.983 0.928 0.000 0.000 0.000 0.072
#> GSM71708 1 0.1478 0.990 0.936 0.000 0.000 0.000 0.064
#> GSM71709 4 0.2795 0.909 0.064 0.056 0.000 0.880 0.000
#> GSM71710 1 0.1671 0.979 0.924 0.000 0.000 0.000 0.076
#> GSM71711 5 0.3274 0.724 0.220 0.000 0.000 0.000 0.780
#> GSM71712 4 0.0510 0.894 0.000 0.000 0.000 0.984 0.016
#> GSM71713 5 0.0162 0.935 0.000 0.000 0.000 0.004 0.996
#> GSM71714 5 0.0000 0.937 0.000 0.000 0.000 0.000 1.000
#> GSM71715 1 0.1478 0.990 0.936 0.000 0.000 0.000 0.064
#> GSM71716 1 0.1478 0.990 0.936 0.000 0.000 0.000 0.064
#> GSM71717 1 0.1478 0.990 0.936 0.000 0.000 0.000 0.064
#> GSM71718 5 0.0000 0.937 0.000 0.000 0.000 0.000 1.000
#> GSM71719 5 0.0000 0.937 0.000 0.000 0.000 0.000 1.000
#> GSM71720 5 0.0000 0.937 0.000 0.000 0.000 0.000 1.000
#> GSM71721 5 0.0000 0.937 0.000 0.000 0.000 0.000 1.000
#> GSM71722 5 0.0000 0.937 0.000 0.000 0.000 0.000 1.000
#> GSM71723 5 0.0000 0.937 0.000 0.000 0.000 0.000 1.000
#> GSM71724 5 0.0000 0.937 0.000 0.000 0.000 0.000 1.000
#> GSM71725 5 0.2280 0.826 0.000 0.000 0.000 0.120 0.880
#> GSM71726 4 0.0000 0.898 0.000 0.000 0.000 1.000 0.000
#> GSM71727 4 0.2280 0.916 0.000 0.120 0.000 0.880 0.000
#> GSM71728 4 0.0510 0.894 0.000 0.000 0.000 0.984 0.016
#> GSM71729 4 0.2280 0.916 0.000 0.120 0.000 0.880 0.000
#> GSM71730 4 0.2280 0.916 0.000 0.120 0.000 0.880 0.000
#> GSM71731 5 0.0000 0.937 0.000 0.000 0.000 0.000 1.000
#> GSM71732 5 0.0000 0.937 0.000 0.000 0.000 0.000 1.000
#> GSM71733 5 0.3913 0.544 0.324 0.000 0.000 0.000 0.676
#> GSM71734 1 0.2773 0.873 0.836 0.000 0.000 0.000 0.164
#> GSM71735 5 0.0000 0.937 0.000 0.000 0.000 0.000 1.000
#> GSM71736 1 0.1478 0.990 0.936 0.000 0.000 0.000 0.064
#> GSM71737 1 0.1478 0.990 0.936 0.000 0.000 0.000 0.064
#> GSM71738 1 0.1478 0.990 0.936 0.000 0.000 0.000 0.064
#> GSM71739 5 0.0000 0.937 0.000 0.000 0.000 0.000 1.000
#> GSM71740 5 0.0404 0.929 0.012 0.000 0.000 0.000 0.988
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> GSM71671 3 0.0000 0.9970 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM71672 3 0.0000 0.9970 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM71673 3 0.0000 0.9970 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM71674 3 0.0000 0.9970 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM71675 3 0.0000 0.9970 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM71676 4 0.0146 0.3702 0.000 0.004 0.000 0.996 0.000 0.000
#> GSM71677 3 0.0713 0.9759 0.000 0.000 0.972 0.028 0.000 0.000
#> GSM71678 2 0.0000 0.7891 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM71679 2 0.0000 0.7891 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM71680 4 0.4097 -0.1267 0.000 0.008 0.000 0.504 0.488 0.000
#> GSM71681 2 0.3547 0.5076 0.000 0.668 0.000 0.332 0.000 0.000
#> GSM71682 2 0.0000 0.7891 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM71683 2 0.3464 0.5686 0.000 0.688 0.000 0.312 0.000 0.000
#> GSM71684 2 0.0146 0.7860 0.000 0.996 0.000 0.004 0.000 0.000
#> GSM71685 4 0.2912 0.3260 0.000 0.216 0.000 0.784 0.000 0.000
#> GSM71686 2 0.0000 0.7891 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM71687 2 0.1267 0.7714 0.000 0.940 0.000 0.060 0.000 0.000
#> GSM71688 4 0.3868 -0.0937 0.000 0.492 0.000 0.508 0.000 0.000
#> GSM71689 3 0.0000 0.9970 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM71690 2 0.1387 0.7679 0.000 0.932 0.000 0.068 0.000 0.000
#> GSM71691 2 0.3810 0.3664 0.000 0.572 0.000 0.428 0.000 0.000
#> GSM71692 3 0.0000 0.9970 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM71693 2 0.3862 0.3343 0.000 0.524 0.000 0.476 0.000 0.000
#> GSM71694 3 0.0000 0.9970 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM71695 4 0.3857 -0.2239 0.000 0.468 0.000 0.532 0.000 0.000
#> GSM71696 1 0.3390 0.6111 0.704 0.000 0.000 0.000 0.000 0.296
#> GSM71697 1 0.2941 0.7109 0.780 0.000 0.000 0.000 0.000 0.220
#> GSM71698 1 0.0000 0.9273 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM71699 6 0.0000 0.9850 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM71700 1 0.0000 0.9273 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM71701 1 0.0000 0.9273 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM71702 6 0.0000 0.9850 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM71703 6 0.0000 0.9850 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM71704 6 0.0000 0.9850 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM71705 6 0.0000 0.9850 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM71706 6 0.0000 0.9850 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM71707 6 0.0260 0.9775 0.008 0.000 0.000 0.000 0.000 0.992
#> GSM71708 6 0.0000 0.9850 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM71709 4 0.3868 -0.1259 0.000 0.000 0.000 0.508 0.492 0.000
#> GSM71710 6 0.0713 0.9559 0.028 0.000 0.000 0.000 0.000 0.972
#> GSM71711 1 0.2941 0.7106 0.780 0.000 0.000 0.000 0.000 0.220
#> GSM71712 5 0.0000 0.4591 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM71713 1 0.0146 0.9246 0.996 0.000 0.000 0.000 0.004 0.000
#> GSM71714 1 0.0000 0.9273 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM71715 6 0.0000 0.9850 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM71716 6 0.0000 0.9850 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM71717 6 0.0000 0.9850 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM71718 1 0.0000 0.9273 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM71719 1 0.0000 0.9273 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM71720 1 0.0000 0.9273 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM71721 1 0.0000 0.9273 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM71722 1 0.0000 0.9273 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM71723 1 0.0000 0.9273 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM71724 1 0.0000 0.9273 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM71725 5 0.3868 -0.1942 0.492 0.000 0.000 0.000 0.508 0.000
#> GSM71726 5 0.0000 0.4591 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM71727 5 0.5758 0.1660 0.000 0.196 0.000 0.312 0.492 0.000
#> GSM71728 5 0.0000 0.4591 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM71729 5 0.5758 0.1660 0.000 0.196 0.000 0.312 0.492 0.000
#> GSM71730 5 0.5758 0.1660 0.000 0.196 0.000 0.312 0.492 0.000
#> GSM71731 1 0.0000 0.9273 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM71732 1 0.0000 0.9273 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM71733 1 0.3717 0.4578 0.616 0.000 0.000 0.000 0.000 0.384
#> GSM71734 6 0.2260 0.8083 0.140 0.000 0.000 0.000 0.000 0.860
#> GSM71735 1 0.0000 0.9273 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM71736 6 0.0000 0.9850 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM71737 6 0.0000 0.9850 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM71738 6 0.0000 0.9850 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM71739 1 0.0000 0.9273 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM71740 1 0.0363 0.9180 0.988 0.000 0.000 0.000 0.000 0.012
Heatmaps for the consensus matrix. It visualizes the probability of two samples to be in a same group.
consensus_heatmap(res, k = 2)
consensus_heatmap(res, k = 3)
consensus_heatmap(res, k = 4)
consensus_heatmap(res, k = 5)
consensus_heatmap(res, k = 6)
Heatmaps for the membership of samples in all partitions to see how consistent they are:
membership_heatmap(res, k = 2)
membership_heatmap(res, k = 3)
membership_heatmap(res, k = 4)
membership_heatmap(res, k = 5)
membership_heatmap(res, k = 6)
As soon as we have had the classes for columns, we can look for signatures which are significantly different between classes which can be candidate marks for certain classes. Following are the heatmaps for signatures.
Signature heatmaps where rows are scaled:
get_signatures(res, k = 2)
get_signatures(res, k = 3)
get_signatures(res, k = 4)
get_signatures(res, k = 5)
get_signatures(res, k = 6)
Signature heatmaps where rows are not scaled:
get_signatures(res, k = 2, scale_rows = FALSE)
get_signatures(res, k = 3, scale_rows = FALSE)
get_signatures(res, k = 4, scale_rows = FALSE)
get_signatures(res, k = 5, scale_rows = FALSE)
get_signatures(res, k = 6, scale_rows = FALSE)
Compare the overlap of signatures from different k:
compare_signatures(res)
get_signature()
returns a data frame invisibly. TO get the list of signatures, the function
call should be assigned to a variable explicitly. In following code, if plot
argument is set
to FALSE
, no heatmap is plotted while only the differential analysis is performed.
# code only for demonstration
tb = get_signature(res, k = ..., plot = FALSE)
An example of the output of tb
is:
#> which_row fdr mean_1 mean_2 scaled_mean_1 scaled_mean_2 km
#> 1 38 0.042760348 8.373488 9.131774 -0.5533452 0.5164555 1
#> 2 40 0.018707592 7.106213 8.469186 -0.6173731 0.5762149 1
#> 3 55 0.019134737 10.221463 11.207825 -0.6159697 0.5749050 1
#> 4 59 0.006059896 5.921854 7.869574 -0.6899429 0.6439467 1
#> 5 60 0.018055526 8.928898 10.211722 -0.6204761 0.5791110 1
#> 6 98 0.009384629 15.714769 14.887706 0.6635654 -0.6193277 2
...
The columns in tb
are:
which_row
: row indices corresponding to the input matrix.fdr
: FDR for the differential test. mean_x
: The mean value in group x.scaled_mean_x
: The mean value in group x after rows are scaled.km
: Row groups if k-means clustering is applied to rows.UMAP plot which shows how samples are separated.
dimension_reduction(res, k = 2, method = "UMAP")
dimension_reduction(res, k = 3, method = "UMAP")
dimension_reduction(res, k = 4, method = "UMAP")
dimension_reduction(res, k = 5, method = "UMAP")
dimension_reduction(res, k = 6, method = "UMAP")
Following heatmap shows how subgroups are split when increasing k
:
collect_classes(res)
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) k
#> ATC:pam 70 1.15e-12 2
#> ATC:pam 69 4.50e-19 3
#> ATC:pam 69 7.06e-20 4
#> ATC:pam 69 1.23e-18 5
#> ATC:pam 54 2.22e-15 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 21168 rows and 70 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 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.724 0.861 0.936 0.4885 0.493 0.493
#> 3 3 0.886 0.912 0.934 0.2836 0.839 0.685
#> 4 4 0.923 0.931 0.945 0.0876 0.950 0.864
#> 5 5 0.791 0.774 0.860 0.0682 0.995 0.986
#> 6 6 0.760 0.693 0.790 0.0893 0.901 0.681
suggest_best_k()
suggests the best \(k\) based on these statistics. The rules are as follows:
suggest_best_k(res)
#> [1] 4
Following shows the table of the partitions (You need to click the show/hide
code output link to see it). The membership matrix (columns with name p*
)
is inferred by
clue::cl_consensus()
function with the SE
method. Basically the value in the membership matrix
represents the probability to belong to a certain group. The finall class
label for an item is determined with the group with highest probability it
belongs to.
In get_classes()
function, the entropy is calculated from the membership
matrix and the silhouette score is calculated from the consensus matrix.
cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#> class entropy silhouette p1 p2
#> GSM71671 2 0.000 0.872 0.000 1.000
#> GSM71672 2 0.000 0.872 0.000 1.000
#> GSM71673 2 0.000 0.872 0.000 1.000
#> GSM71674 2 0.000 0.872 0.000 1.000
#> GSM71675 2 0.000 0.872 0.000 1.000
#> GSM71676 2 0.000 0.872 0.000 1.000
#> GSM71677 2 0.000 0.872 0.000 1.000
#> GSM71678 2 0.000 0.872 0.000 1.000
#> GSM71679 2 0.000 0.872 0.000 1.000
#> GSM71680 2 0.958 0.533 0.380 0.620
#> GSM71681 2 0.000 0.872 0.000 1.000
#> GSM71682 2 0.000 0.872 0.000 1.000
#> GSM71683 2 0.000 0.872 0.000 1.000
#> GSM71684 2 0.000 0.872 0.000 1.000
#> GSM71685 2 0.000 0.872 0.000 1.000
#> GSM71686 2 0.000 0.872 0.000 1.000
#> GSM71687 2 0.000 0.872 0.000 1.000
#> GSM71688 2 0.000 0.872 0.000 1.000
#> GSM71689 2 0.000 0.872 0.000 1.000
#> GSM71690 2 0.000 0.872 0.000 1.000
#> GSM71691 2 0.000 0.872 0.000 1.000
#> GSM71692 2 0.000 0.872 0.000 1.000
#> GSM71693 2 0.000 0.872 0.000 1.000
#> GSM71694 2 0.000 0.872 0.000 1.000
#> GSM71695 2 0.000 0.872 0.000 1.000
#> GSM71696 1 0.311 0.914 0.944 0.056
#> GSM71697 1 0.000 0.977 1.000 0.000
#> GSM71698 1 0.000 0.977 1.000 0.000
#> GSM71699 1 0.000 0.977 1.000 0.000
#> GSM71700 1 0.000 0.977 1.000 0.000
#> GSM71701 1 0.000 0.977 1.000 0.000
#> GSM71702 1 0.000 0.977 1.000 0.000
#> GSM71703 1 0.000 0.977 1.000 0.000
#> GSM71704 1 0.000 0.977 1.000 0.000
#> GSM71705 1 0.000 0.977 1.000 0.000
#> GSM71706 1 0.000 0.977 1.000 0.000
#> GSM71707 1 0.000 0.977 1.000 0.000
#> GSM71708 1 0.000 0.977 1.000 0.000
#> GSM71709 2 0.958 0.533 0.380 0.620
#> GSM71710 1 0.000 0.977 1.000 0.000
#> GSM71711 1 0.000 0.977 1.000 0.000
#> GSM71712 2 0.958 0.533 0.380 0.620
#> GSM71713 1 0.955 0.243 0.624 0.376
#> GSM71714 1 0.000 0.977 1.000 0.000
#> GSM71715 1 0.781 0.630 0.768 0.232
#> GSM71716 1 0.000 0.977 1.000 0.000
#> GSM71717 1 0.000 0.977 1.000 0.000
#> GSM71718 1 0.000 0.977 1.000 0.000
#> GSM71719 1 0.000 0.977 1.000 0.000
#> GSM71720 1 0.000 0.977 1.000 0.000
#> GSM71721 1 0.000 0.977 1.000 0.000
#> GSM71722 1 0.000 0.977 1.000 0.000
#> GSM71723 1 0.000 0.977 1.000 0.000
#> GSM71724 1 0.000 0.977 1.000 0.000
#> GSM71725 2 0.958 0.533 0.380 0.620
#> GSM71726 2 0.958 0.533 0.380 0.620
#> GSM71727 2 0.958 0.533 0.380 0.620
#> GSM71728 2 0.958 0.533 0.380 0.620
#> GSM71729 2 0.958 0.533 0.380 0.620
#> GSM71730 2 0.958 0.533 0.380 0.620
#> GSM71731 1 0.000 0.977 1.000 0.000
#> GSM71732 1 0.000 0.977 1.000 0.000
#> GSM71733 1 0.000 0.977 1.000 0.000
#> GSM71734 1 0.000 0.977 1.000 0.000
#> GSM71735 1 0.000 0.977 1.000 0.000
#> GSM71736 1 0.000 0.977 1.000 0.000
#> GSM71737 1 0.000 0.977 1.000 0.000
#> GSM71738 1 0.000 0.977 1.000 0.000
#> GSM71739 2 0.958 0.533 0.380 0.620
#> GSM71740 1 0.000 0.977 1.000 0.000
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> GSM71671 3 0.0000 0.768 0.000 0.000 1.000
#> GSM71672 3 0.0000 0.768 0.000 0.000 1.000
#> GSM71673 3 0.0000 0.768 0.000 0.000 1.000
#> GSM71674 3 0.0000 0.768 0.000 0.000 1.000
#> GSM71675 3 0.0000 0.768 0.000 0.000 1.000
#> GSM71676 3 0.5529 0.791 0.000 0.296 0.704
#> GSM71677 3 0.0592 0.770 0.000 0.012 0.988
#> GSM71678 2 0.0000 1.000 0.000 1.000 0.000
#> GSM71679 2 0.0000 1.000 0.000 1.000 0.000
#> GSM71680 3 0.5591 0.790 0.000 0.304 0.696
#> GSM71681 2 0.0000 1.000 0.000 1.000 0.000
#> GSM71682 2 0.0000 1.000 0.000 1.000 0.000
#> GSM71683 2 0.0000 1.000 0.000 1.000 0.000
#> GSM71684 2 0.0000 1.000 0.000 1.000 0.000
#> GSM71685 2 0.0000 1.000 0.000 1.000 0.000
#> GSM71686 2 0.0000 1.000 0.000 1.000 0.000
#> GSM71687 2 0.0000 1.000 0.000 1.000 0.000
#> GSM71688 2 0.0000 1.000 0.000 1.000 0.000
#> GSM71689 3 0.0000 0.768 0.000 0.000 1.000
#> GSM71690 2 0.0000 1.000 0.000 1.000 0.000
#> GSM71691 2 0.0000 1.000 0.000 1.000 0.000
#> GSM71692 3 0.0000 0.768 0.000 0.000 1.000
#> GSM71693 2 0.0000 1.000 0.000 1.000 0.000
#> GSM71694 3 0.0000 0.768 0.000 0.000 1.000
#> GSM71695 2 0.0000 1.000 0.000 1.000 0.000
#> GSM71696 1 0.8076 0.465 0.652 0.180 0.168
#> GSM71697 1 0.0000 0.987 1.000 0.000 0.000
#> GSM71698 1 0.0000 0.987 1.000 0.000 0.000
#> GSM71699 1 0.0000 0.987 1.000 0.000 0.000
#> GSM71700 1 0.0000 0.987 1.000 0.000 0.000
#> GSM71701 1 0.2066 0.924 0.940 0.000 0.060
#> GSM71702 1 0.0000 0.987 1.000 0.000 0.000
#> GSM71703 1 0.0000 0.987 1.000 0.000 0.000
#> GSM71704 1 0.0000 0.987 1.000 0.000 0.000
#> GSM71705 1 0.0000 0.987 1.000 0.000 0.000
#> GSM71706 1 0.0000 0.987 1.000 0.000 0.000
#> GSM71707 1 0.0000 0.987 1.000 0.000 0.000
#> GSM71708 1 0.0000 0.987 1.000 0.000 0.000
#> GSM71709 3 0.5591 0.790 0.000 0.304 0.696
#> GSM71710 1 0.0000 0.987 1.000 0.000 0.000
#> GSM71711 1 0.0000 0.987 1.000 0.000 0.000
#> GSM71712 3 0.5591 0.790 0.000 0.304 0.696
#> GSM71713 3 0.8325 0.670 0.108 0.304 0.588
#> GSM71714 1 0.0000 0.987 1.000 0.000 0.000
#> GSM71715 3 0.8291 0.662 0.100 0.320 0.580
#> GSM71716 1 0.0000 0.987 1.000 0.000 0.000
#> GSM71717 1 0.0000 0.987 1.000 0.000 0.000
#> GSM71718 1 0.0000 0.987 1.000 0.000 0.000
#> GSM71719 1 0.0000 0.987 1.000 0.000 0.000
#> GSM71720 1 0.0000 0.987 1.000 0.000 0.000
#> GSM71721 1 0.0000 0.987 1.000 0.000 0.000
#> GSM71722 1 0.0000 0.987 1.000 0.000 0.000
#> GSM71723 1 0.0000 0.987 1.000 0.000 0.000
#> GSM71724 1 0.0000 0.987 1.000 0.000 0.000
#> GSM71725 3 0.5591 0.790 0.000 0.304 0.696
#> GSM71726 3 0.5591 0.790 0.000 0.304 0.696
#> GSM71727 3 0.5650 0.784 0.000 0.312 0.688
#> GSM71728 3 0.5591 0.790 0.000 0.304 0.696
#> GSM71729 3 0.5650 0.784 0.000 0.312 0.688
#> GSM71730 3 0.5650 0.784 0.000 0.312 0.688
#> GSM71731 1 0.0000 0.987 1.000 0.000 0.000
#> GSM71732 1 0.0000 0.987 1.000 0.000 0.000
#> GSM71733 1 0.0000 0.987 1.000 0.000 0.000
#> GSM71734 1 0.0000 0.987 1.000 0.000 0.000
#> GSM71735 1 0.0000 0.987 1.000 0.000 0.000
#> GSM71736 1 0.0000 0.987 1.000 0.000 0.000
#> GSM71737 1 0.0000 0.987 1.000 0.000 0.000
#> GSM71738 1 0.0000 0.987 1.000 0.000 0.000
#> GSM71739 3 0.5706 0.774 0.000 0.320 0.680
#> GSM71740 1 0.0000 0.987 1.000 0.000 0.000
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> GSM71671 3 0.0188 0.948 0.000 0.000 0.996 0.004
#> GSM71672 3 0.0188 0.948 0.000 0.000 0.996 0.004
#> GSM71673 3 0.0188 0.948 0.000 0.000 0.996 0.004
#> GSM71674 3 0.0188 0.948 0.000 0.000 0.996 0.004
#> GSM71675 3 0.0188 0.948 0.000 0.000 0.996 0.004
#> GSM71676 3 0.5256 0.551 0.000 0.392 0.596 0.012
#> GSM71677 3 0.3324 0.853 0.000 0.136 0.852 0.012
#> GSM71678 2 0.3528 0.923 0.000 0.808 0.000 0.192
#> GSM71679 2 0.3528 0.923 0.000 0.808 0.000 0.192
#> GSM71680 4 0.0188 0.945 0.000 0.000 0.004 0.996
#> GSM71681 2 0.3528 0.923 0.000 0.808 0.000 0.192
#> GSM71682 2 0.3528 0.923 0.000 0.808 0.000 0.192
#> GSM71683 2 0.4679 0.742 0.000 0.648 0.000 0.352
#> GSM71684 2 0.3610 0.918 0.000 0.800 0.000 0.200
#> GSM71685 2 0.3074 0.902 0.000 0.848 0.000 0.152
#> GSM71686 2 0.3528 0.923 0.000 0.808 0.000 0.192
#> GSM71687 2 0.3311 0.914 0.000 0.828 0.000 0.172
#> GSM71688 2 0.3528 0.923 0.000 0.808 0.000 0.192
#> GSM71689 3 0.0188 0.948 0.000 0.000 0.996 0.004
#> GSM71690 2 0.3528 0.923 0.000 0.808 0.000 0.192
#> GSM71691 2 0.0000 0.766 0.000 1.000 0.000 0.000
#> GSM71692 3 0.0188 0.948 0.000 0.000 0.996 0.004
#> GSM71693 2 0.4643 0.745 0.000 0.656 0.000 0.344
#> GSM71694 3 0.0188 0.948 0.000 0.000 0.996 0.004
#> GSM71695 2 0.0000 0.766 0.000 1.000 0.000 0.000
#> GSM71696 1 0.6555 0.478 0.632 0.156 0.000 0.212
#> GSM71697 1 0.0000 0.988 1.000 0.000 0.000 0.000
#> GSM71698 1 0.0000 0.988 1.000 0.000 0.000 0.000
#> GSM71699 1 0.0000 0.988 1.000 0.000 0.000 0.000
#> GSM71700 1 0.0000 0.988 1.000 0.000 0.000 0.000
#> GSM71701 1 0.0376 0.984 0.992 0.000 0.004 0.004
#> GSM71702 1 0.0000 0.988 1.000 0.000 0.000 0.000
#> GSM71703 1 0.0000 0.988 1.000 0.000 0.000 0.000
#> GSM71704 1 0.0000 0.988 1.000 0.000 0.000 0.000
#> GSM71705 1 0.0000 0.988 1.000 0.000 0.000 0.000
#> GSM71706 1 0.0000 0.988 1.000 0.000 0.000 0.000
#> GSM71707 1 0.0000 0.988 1.000 0.000 0.000 0.000
#> GSM71708 1 0.0188 0.986 0.996 0.000 0.004 0.000
#> GSM71709 4 0.0188 0.945 0.000 0.000 0.004 0.996
#> GSM71710 1 0.0000 0.988 1.000 0.000 0.000 0.000
#> GSM71711 1 0.0000 0.988 1.000 0.000 0.000 0.000
#> GSM71712 4 0.0000 0.945 0.000 0.000 0.000 1.000
#> GSM71713 4 0.0336 0.938 0.008 0.000 0.000 0.992
#> GSM71714 1 0.0376 0.984 0.992 0.000 0.004 0.004
#> GSM71715 4 0.4742 0.740 0.028 0.208 0.004 0.760
#> GSM71716 1 0.0000 0.988 1.000 0.000 0.000 0.000
#> GSM71717 1 0.0188 0.986 0.996 0.000 0.004 0.000
#> GSM71718 1 0.0000 0.988 1.000 0.000 0.000 0.000
#> GSM71719 1 0.0000 0.988 1.000 0.000 0.000 0.000
#> GSM71720 1 0.0000 0.988 1.000 0.000 0.000 0.000
#> GSM71721 1 0.0000 0.988 1.000 0.000 0.000 0.000
#> GSM71722 1 0.0000 0.988 1.000 0.000 0.000 0.000
#> GSM71723 1 0.0000 0.988 1.000 0.000 0.000 0.000
#> GSM71724 1 0.0376 0.984 0.992 0.000 0.004 0.004
#> GSM71725 4 0.0000 0.945 0.000 0.000 0.000 1.000
#> GSM71726 4 0.0000 0.945 0.000 0.000 0.000 1.000
#> GSM71727 4 0.0376 0.943 0.000 0.004 0.004 0.992
#> GSM71728 4 0.0000 0.945 0.000 0.000 0.000 1.000
#> GSM71729 4 0.0376 0.943 0.000 0.004 0.004 0.992
#> GSM71730 4 0.0779 0.932 0.000 0.016 0.004 0.980
#> GSM71731 1 0.0000 0.988 1.000 0.000 0.000 0.000
#> GSM71732 1 0.0000 0.988 1.000 0.000 0.000 0.000
#> GSM71733 1 0.0000 0.988 1.000 0.000 0.000 0.000
#> GSM71734 1 0.0188 0.986 0.996 0.000 0.004 0.000
#> GSM71735 1 0.0376 0.984 0.992 0.000 0.004 0.004
#> GSM71736 1 0.0376 0.984 0.992 0.000 0.004 0.004
#> GSM71737 1 0.0188 0.986 0.996 0.000 0.004 0.000
#> GSM71738 1 0.0000 0.988 1.000 0.000 0.000 0.000
#> GSM71739 4 0.3688 0.762 0.000 0.208 0.000 0.792
#> GSM71740 1 0.0000 0.988 1.000 0.000 0.000 0.000
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> GSM71671 3 0.0000 0.948 0.000 0.000 1.000 0.000 0.000
#> GSM71672 3 0.0000 0.948 0.000 0.000 1.000 0.000 0.000
#> GSM71673 3 0.0000 0.948 0.000 0.000 1.000 0.000 0.000
#> GSM71674 3 0.0000 0.948 0.000 0.000 1.000 0.000 0.000
#> GSM71675 3 0.0000 0.948 0.000 0.000 1.000 0.000 0.000
#> GSM71676 3 0.5303 0.582 0.000 0.232 0.660 0.000 0.108
#> GSM71677 3 0.2889 0.847 0.000 0.044 0.872 0.000 0.084
#> GSM71678 2 0.1608 0.932 0.000 0.928 0.000 0.072 0.000
#> GSM71679 2 0.1671 0.932 0.000 0.924 0.000 0.076 0.000
#> GSM71680 4 0.3612 0.752 0.000 0.000 0.000 0.732 0.268
#> GSM71681 2 0.1830 0.931 0.000 0.924 0.000 0.068 0.008
#> GSM71682 2 0.1908 0.930 0.000 0.908 0.000 0.092 0.000
#> GSM71683 2 0.4210 0.797 0.000 0.740 0.000 0.224 0.036
#> GSM71684 2 0.2624 0.915 0.000 0.872 0.000 0.116 0.012
#> GSM71685 2 0.1251 0.912 0.000 0.956 0.000 0.036 0.008
#> GSM71686 2 0.1908 0.930 0.000 0.908 0.000 0.092 0.000
#> GSM71687 2 0.2660 0.907 0.000 0.864 0.000 0.128 0.008
#> GSM71688 2 0.1544 0.932 0.000 0.932 0.000 0.068 0.000
#> GSM71689 3 0.0000 0.948 0.000 0.000 1.000 0.000 0.000
#> GSM71690 2 0.1544 0.932 0.000 0.932 0.000 0.068 0.000
#> GSM71691 2 0.1043 0.864 0.000 0.960 0.000 0.000 0.040
#> GSM71692 3 0.0000 0.948 0.000 0.000 1.000 0.000 0.000
#> GSM71693 2 0.3663 0.819 0.000 0.776 0.000 0.208 0.016
#> GSM71694 3 0.0000 0.948 0.000 0.000 1.000 0.000 0.000
#> GSM71695 2 0.0963 0.867 0.000 0.964 0.000 0.000 0.036
#> GSM71696 1 0.6528 -0.123 0.548 0.044 0.000 0.092 0.316
#> GSM71697 1 0.0404 0.842 0.988 0.000 0.000 0.000 0.012
#> GSM71698 1 0.2230 0.792 0.884 0.000 0.000 0.000 0.116
#> GSM71699 1 0.0000 0.843 1.000 0.000 0.000 0.000 0.000
#> GSM71700 1 0.0609 0.841 0.980 0.000 0.000 0.000 0.020
#> GSM71701 1 0.4101 0.529 0.628 0.000 0.000 0.000 0.372
#> GSM71702 1 0.0510 0.841 0.984 0.000 0.000 0.000 0.016
#> GSM71703 1 0.0404 0.842 0.988 0.000 0.000 0.000 0.012
#> GSM71704 1 0.0162 0.843 0.996 0.000 0.000 0.000 0.004
#> GSM71705 1 0.0290 0.843 0.992 0.000 0.000 0.000 0.008
#> GSM71706 1 0.3177 0.712 0.792 0.000 0.000 0.000 0.208
#> GSM71707 1 0.0162 0.843 0.996 0.000 0.000 0.000 0.004
#> GSM71708 1 0.3395 0.687 0.764 0.000 0.000 0.000 0.236
#> GSM71709 4 0.3612 0.752 0.000 0.000 0.000 0.732 0.268
#> GSM71710 1 0.0963 0.833 0.964 0.000 0.000 0.000 0.036
#> GSM71711 1 0.0290 0.843 0.992 0.000 0.000 0.000 0.008
#> GSM71712 4 0.0000 0.746 0.000 0.000 0.000 1.000 0.000
#> GSM71713 4 0.2448 0.665 0.020 0.000 0.000 0.892 0.088
#> GSM71714 1 0.4030 0.567 0.648 0.000 0.000 0.000 0.352
#> GSM71715 5 0.7900 0.000 0.236 0.096 0.000 0.240 0.428
#> GSM71716 1 0.0000 0.843 1.000 0.000 0.000 0.000 0.000
#> GSM71717 1 0.3395 0.687 0.764 0.000 0.000 0.000 0.236
#> GSM71718 1 0.2230 0.792 0.884 0.000 0.000 0.000 0.116
#> GSM71719 1 0.2230 0.792 0.884 0.000 0.000 0.000 0.116
#> GSM71720 1 0.1965 0.805 0.904 0.000 0.000 0.000 0.096
#> GSM71721 1 0.2230 0.792 0.884 0.000 0.000 0.000 0.116
#> GSM71722 1 0.1197 0.830 0.952 0.000 0.000 0.000 0.048
#> GSM71723 1 0.0290 0.843 0.992 0.000 0.000 0.000 0.008
#> GSM71724 1 0.4088 0.542 0.632 0.000 0.000 0.000 0.368
#> GSM71725 4 0.1732 0.698 0.000 0.000 0.000 0.920 0.080
#> GSM71726 4 0.0703 0.750 0.000 0.000 0.000 0.976 0.024
#> GSM71727 4 0.3992 0.748 0.000 0.012 0.000 0.720 0.268
#> GSM71728 4 0.0290 0.744 0.000 0.000 0.000 0.992 0.008
#> GSM71729 4 0.3916 0.752 0.000 0.012 0.000 0.732 0.256
#> GSM71730 4 0.3992 0.748 0.000 0.012 0.000 0.720 0.268
#> GSM71731 1 0.0290 0.843 0.992 0.000 0.000 0.000 0.008
#> GSM71732 1 0.0510 0.843 0.984 0.000 0.000 0.000 0.016
#> GSM71733 1 0.0510 0.842 0.984 0.000 0.000 0.000 0.016
#> GSM71734 1 0.3242 0.706 0.784 0.000 0.000 0.000 0.216
#> GSM71735 1 0.4030 0.567 0.648 0.000 0.000 0.000 0.352
#> GSM71736 1 0.3534 0.664 0.744 0.000 0.000 0.000 0.256
#> GSM71737 1 0.3395 0.687 0.764 0.000 0.000 0.000 0.236
#> GSM71738 1 0.0000 0.843 1.000 0.000 0.000 0.000 0.000
#> GSM71739 4 0.5826 -0.130 0.000 0.096 0.000 0.500 0.404
#> GSM71740 1 0.0162 0.844 0.996 0.000 0.000 0.000 0.004
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> GSM71671 3 0.0000 0.933 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM71672 3 0.0000 0.933 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM71673 3 0.0000 0.933 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM71674 3 0.0000 0.933 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM71675 3 0.0000 0.933 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM71676 3 0.5577 0.391 0.000 0.212 0.572 0.004 0.212 0.000
#> GSM71677 3 0.2178 0.820 0.000 0.000 0.868 0.000 0.132 0.000
#> GSM71678 2 0.1007 0.878 0.000 0.956 0.000 0.000 0.044 0.000
#> GSM71679 2 0.1461 0.879 0.000 0.940 0.000 0.016 0.044 0.000
#> GSM71680 4 0.2164 0.835 0.000 0.000 0.000 0.900 0.068 0.032
#> GSM71681 2 0.0000 0.888 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM71682 2 0.1713 0.878 0.000 0.928 0.000 0.028 0.044 0.000
#> GSM71683 2 0.4625 0.735 0.000 0.680 0.000 0.104 0.216 0.000
#> GSM71684 2 0.2060 0.874 0.000 0.900 0.000 0.016 0.084 0.000
#> GSM71685 2 0.0146 0.888 0.000 0.996 0.000 0.000 0.004 0.000
#> GSM71686 2 0.1564 0.879 0.000 0.936 0.000 0.024 0.040 0.000
#> GSM71687 2 0.3978 0.801 0.000 0.756 0.000 0.084 0.160 0.000
#> GSM71688 2 0.0000 0.888 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM71689 3 0.0000 0.933 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM71690 2 0.0000 0.888 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM71691 2 0.2996 0.808 0.000 0.772 0.000 0.000 0.228 0.000
#> GSM71692 3 0.0000 0.933 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM71693 2 0.4311 0.767 0.000 0.716 0.000 0.088 0.196 0.000
#> GSM71694 3 0.0000 0.933 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM71695 2 0.2996 0.808 0.000 0.772 0.000 0.000 0.228 0.000
#> GSM71696 1 0.5508 0.232 0.584 0.000 0.000 0.004 0.200 0.212
#> GSM71697 1 0.0000 0.731 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM71698 1 0.5812 0.173 0.460 0.000 0.000 0.000 0.348 0.192
#> GSM71699 1 0.1714 0.676 0.908 0.000 0.000 0.000 0.000 0.092
#> GSM71700 1 0.0000 0.731 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM71701 6 0.3694 0.675 0.232 0.000 0.000 0.000 0.028 0.740
#> GSM71702 1 0.0363 0.728 0.988 0.000 0.000 0.000 0.000 0.012
#> GSM71703 1 0.1863 0.675 0.896 0.000 0.000 0.000 0.000 0.104
#> GSM71704 1 0.1863 0.675 0.896 0.000 0.000 0.000 0.000 0.104
#> GSM71705 1 0.0260 0.730 0.992 0.000 0.000 0.000 0.000 0.008
#> GSM71706 6 0.5285 0.667 0.420 0.000 0.000 0.000 0.100 0.480
#> GSM71707 1 0.0260 0.730 0.992 0.000 0.000 0.000 0.000 0.008
#> GSM71708 6 0.5228 0.710 0.376 0.000 0.000 0.000 0.100 0.524
#> GSM71709 4 0.2164 0.835 0.000 0.000 0.000 0.900 0.068 0.032
#> GSM71710 1 0.3756 -0.332 0.600 0.000 0.000 0.000 0.000 0.400
#> GSM71711 1 0.0000 0.731 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM71712 4 0.0458 0.832 0.000 0.000 0.000 0.984 0.000 0.016
#> GSM71713 4 0.2419 0.753 0.016 0.000 0.000 0.896 0.028 0.060
#> GSM71714 6 0.3720 0.680 0.236 0.000 0.000 0.000 0.028 0.736
#> GSM71715 5 0.6597 0.000 0.032 0.000 0.000 0.280 0.424 0.264
#> GSM71716 1 0.1765 0.674 0.904 0.000 0.000 0.000 0.000 0.096
#> GSM71717 6 0.3717 0.745 0.384 0.000 0.000 0.000 0.000 0.616
#> GSM71718 1 0.5812 0.173 0.460 0.000 0.000 0.000 0.348 0.192
#> GSM71719 1 0.5812 0.173 0.460 0.000 0.000 0.000 0.348 0.192
#> GSM71720 1 0.5556 0.216 0.504 0.000 0.000 0.000 0.348 0.148
#> GSM71721 1 0.5812 0.173 0.460 0.000 0.000 0.000 0.348 0.192
#> GSM71722 1 0.1007 0.703 0.956 0.000 0.000 0.000 0.000 0.044
#> GSM71723 1 0.0000 0.731 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM71724 6 0.3834 0.672 0.232 0.000 0.000 0.000 0.036 0.732
#> GSM71725 4 0.1411 0.802 0.000 0.000 0.000 0.936 0.004 0.060
#> GSM71726 4 0.0260 0.837 0.000 0.000 0.000 0.992 0.000 0.008
#> GSM71727 4 0.2476 0.829 0.000 0.008 0.000 0.888 0.072 0.032
#> GSM71728 4 0.0547 0.831 0.000 0.000 0.000 0.980 0.000 0.020
#> GSM71729 4 0.2265 0.837 0.000 0.008 0.000 0.900 0.068 0.024
#> GSM71730 4 0.3299 0.779 0.000 0.048 0.000 0.844 0.080 0.028
#> GSM71731 1 0.0000 0.731 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM71732 1 0.0146 0.730 0.996 0.000 0.000 0.000 0.000 0.004
#> GSM71733 1 0.0260 0.730 0.992 0.000 0.000 0.000 0.000 0.008
#> GSM71734 6 0.3747 0.738 0.396 0.000 0.000 0.000 0.000 0.604
#> GSM71735 6 0.3791 0.681 0.236 0.000 0.000 0.000 0.032 0.732
#> GSM71736 6 0.4653 0.731 0.360 0.000 0.000 0.000 0.052 0.588
#> GSM71737 6 0.3727 0.744 0.388 0.000 0.000 0.000 0.000 0.612
#> GSM71738 1 0.1814 0.675 0.900 0.000 0.000 0.000 0.000 0.100
#> GSM71739 4 0.5301 -0.123 0.000 0.000 0.000 0.568 0.300 0.132
#> GSM71740 1 0.1007 0.708 0.956 0.000 0.000 0.000 0.000 0.044
Heatmaps for the consensus matrix. It visualizes the probability of two samples to be in a same group.
consensus_heatmap(res, k = 2)
consensus_heatmap(res, k = 3)
consensus_heatmap(res, k = 4)
consensus_heatmap(res, k = 5)
consensus_heatmap(res, k = 6)
Heatmaps for the membership of samples in all partitions to see how consistent they are:
membership_heatmap(res, k = 2)
membership_heatmap(res, k = 3)
membership_heatmap(res, k = 4)
membership_heatmap(res, k = 5)
membership_heatmap(res, k = 6)
As soon as we have had the classes for columns, we can look for signatures which are significantly different between classes which can be candidate marks for certain classes. Following are the heatmaps for signatures.
Signature heatmaps where rows are scaled:
get_signatures(res, k = 2)
get_signatures(res, k = 3)
get_signatures(res, k = 4)
get_signatures(res, k = 5)
get_signatures(res, k = 6)
Signature heatmaps where rows are not scaled:
get_signatures(res, k = 2, scale_rows = FALSE)
get_signatures(res, k = 3, scale_rows = FALSE)
get_signatures(res, k = 4, scale_rows = FALSE)
get_signatures(res, k = 5, scale_rows = FALSE)
get_signatures(res, k = 6, scale_rows = FALSE)
Compare the overlap of signatures from different k:
compare_signatures(res)
get_signature()
returns a data frame invisibly. TO get the list of signatures, the function
call should be assigned to a variable explicitly. In following code, if plot
argument is set
to FALSE
, no heatmap is plotted while only the differential analysis is performed.
# code only for demonstration
tb = get_signature(res, k = ..., plot = FALSE)
An example of the output of tb
is:
#> which_row fdr mean_1 mean_2 scaled_mean_1 scaled_mean_2 km
#> 1 38 0.042760348 8.373488 9.131774 -0.5533452 0.5164555 1
#> 2 40 0.018707592 7.106213 8.469186 -0.6173731 0.5762149 1
#> 3 55 0.019134737 10.221463 11.207825 -0.6159697 0.5749050 1
#> 4 59 0.006059896 5.921854 7.869574 -0.6899429 0.6439467 1
#> 5 60 0.018055526 8.928898 10.211722 -0.6204761 0.5791110 1
#> 6 98 0.009384629 15.714769 14.887706 0.6635654 -0.6193277 2
...
The columns in tb
are:
which_row
: row indices corresponding to the input matrix.fdr
: FDR for the differential test. mean_x
: The mean value in group x.scaled_mean_x
: The mean value in group x after rows are scaled.km
: Row groups if k-means clustering is applied to rows.UMAP plot which shows how samples are separated.
dimension_reduction(res, k = 2, method = "UMAP")
dimension_reduction(res, k = 3, method = "UMAP")
dimension_reduction(res, k = 4, method = "UMAP")
dimension_reduction(res, k = 5, method = "UMAP")
dimension_reduction(res, k = 6, method = "UMAP")
Following heatmap shows how subgroups are split when increasing k
:
collect_classes(res)
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) k
#> ATC:mclust 69 1.72e-09 2
#> ATC:mclust 69 2.52e-14 3
#> ATC:mclust 69 3.18e-20 4
#> ATC:mclust 67 1.35e-19 5
#> ATC:mclust 60 8.02e-16 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 21168 rows and 70 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 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 0.991 0.996 0.4870 0.513 0.513
#> 3 3 1.000 0.990 0.996 0.2363 0.812 0.658
#> 4 4 0.974 0.922 0.963 0.0985 0.932 0.831
#> 5 5 0.938 0.858 0.935 0.0308 0.993 0.978
#> 6 6 0.906 0.875 0.927 0.0136 0.989 0.967
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
#> GSM71671 2 0.000 0.993 0.00 1.00
#> GSM71672 2 0.000 0.993 0.00 1.00
#> GSM71673 2 0.000 0.993 0.00 1.00
#> GSM71674 2 0.000 0.993 0.00 1.00
#> GSM71675 2 0.000 0.993 0.00 1.00
#> GSM71676 2 0.000 0.993 0.00 1.00
#> GSM71677 2 0.000 0.993 0.00 1.00
#> GSM71678 2 0.000 0.993 0.00 1.00
#> GSM71679 2 0.000 0.993 0.00 1.00
#> GSM71680 2 0.000 0.993 0.00 1.00
#> GSM71681 2 0.000 0.993 0.00 1.00
#> GSM71682 2 0.000 0.993 0.00 1.00
#> GSM71683 2 0.000 0.993 0.00 1.00
#> GSM71684 2 0.000 0.993 0.00 1.00
#> GSM71685 2 0.000 0.993 0.00 1.00
#> GSM71686 2 0.000 0.993 0.00 1.00
#> GSM71687 2 0.000 0.993 0.00 1.00
#> GSM71688 2 0.000 0.993 0.00 1.00
#> GSM71689 2 0.000 0.993 0.00 1.00
#> GSM71690 2 0.000 0.993 0.00 1.00
#> GSM71691 2 0.000 0.993 0.00 1.00
#> GSM71692 2 0.000 0.993 0.00 1.00
#> GSM71693 2 0.000 0.993 0.00 1.00
#> GSM71694 2 0.000 0.993 0.00 1.00
#> GSM71695 2 0.000 0.993 0.00 1.00
#> GSM71696 1 0.000 0.997 1.00 0.00
#> GSM71697 1 0.000 0.997 1.00 0.00
#> GSM71698 1 0.000 0.997 1.00 0.00
#> GSM71699 1 0.000 0.997 1.00 0.00
#> GSM71700 1 0.000 0.997 1.00 0.00
#> GSM71701 1 0.000 0.997 1.00 0.00
#> GSM71702 1 0.000 0.997 1.00 0.00
#> GSM71703 1 0.000 0.997 1.00 0.00
#> GSM71704 1 0.000 0.997 1.00 0.00
#> GSM71705 1 0.000 0.997 1.00 0.00
#> GSM71706 1 0.000 0.997 1.00 0.00
#> GSM71707 1 0.000 0.997 1.00 0.00
#> GSM71708 1 0.000 0.997 1.00 0.00
#> GSM71709 2 0.000 0.993 0.00 1.00
#> GSM71710 1 0.000 0.997 1.00 0.00
#> GSM71711 1 0.000 0.997 1.00 0.00
#> GSM71712 1 0.000 0.997 1.00 0.00
#> GSM71713 1 0.000 0.997 1.00 0.00
#> GSM71714 1 0.000 0.997 1.00 0.00
#> GSM71715 1 0.000 0.997 1.00 0.00
#> GSM71716 1 0.000 0.997 1.00 0.00
#> GSM71717 1 0.000 0.997 1.00 0.00
#> GSM71718 1 0.000 0.997 1.00 0.00
#> GSM71719 1 0.000 0.997 1.00 0.00
#> GSM71720 1 0.000 0.997 1.00 0.00
#> GSM71721 1 0.000 0.997 1.00 0.00
#> GSM71722 1 0.000 0.997 1.00 0.00
#> GSM71723 1 0.000 0.997 1.00 0.00
#> GSM71724 1 0.000 0.997 1.00 0.00
#> GSM71725 1 0.000 0.997 1.00 0.00
#> GSM71726 1 0.000 0.997 1.00 0.00
#> GSM71727 2 0.680 0.779 0.18 0.82
#> GSM71728 1 0.000 0.997 1.00 0.00
#> GSM71729 1 0.529 0.862 0.88 0.12
#> GSM71730 2 0.000 0.993 0.00 1.00
#> GSM71731 1 0.000 0.997 1.00 0.00
#> GSM71732 1 0.000 0.997 1.00 0.00
#> GSM71733 1 0.000 0.997 1.00 0.00
#> GSM71734 1 0.000 0.997 1.00 0.00
#> GSM71735 1 0.000 0.997 1.00 0.00
#> GSM71736 1 0.000 0.997 1.00 0.00
#> GSM71737 1 0.000 0.997 1.00 0.00
#> GSM71738 1 0.000 0.997 1.00 0.00
#> GSM71739 1 0.000 0.997 1.00 0.00
#> GSM71740 1 0.000 0.997 1.00 0.00
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> GSM71671 3 0.0000 1.000 0.000 0.000 1.000
#> GSM71672 3 0.0000 1.000 0.000 0.000 1.000
#> GSM71673 3 0.0000 1.000 0.000 0.000 1.000
#> GSM71674 3 0.0000 1.000 0.000 0.000 1.000
#> GSM71675 3 0.0000 1.000 0.000 0.000 1.000
#> GSM71676 3 0.0000 1.000 0.000 0.000 1.000
#> GSM71677 3 0.0000 1.000 0.000 0.000 1.000
#> GSM71678 2 0.0000 0.996 0.000 1.000 0.000
#> GSM71679 2 0.0000 0.996 0.000 1.000 0.000
#> GSM71680 2 0.0000 0.996 0.000 1.000 0.000
#> GSM71681 2 0.0000 0.996 0.000 1.000 0.000
#> GSM71682 2 0.0000 0.996 0.000 1.000 0.000
#> GSM71683 2 0.0000 0.996 0.000 1.000 0.000
#> GSM71684 2 0.0000 0.996 0.000 1.000 0.000
#> GSM71685 2 0.0000 0.996 0.000 1.000 0.000
#> GSM71686 2 0.0000 0.996 0.000 1.000 0.000
#> GSM71687 2 0.0000 0.996 0.000 1.000 0.000
#> GSM71688 2 0.0000 0.996 0.000 1.000 0.000
#> GSM71689 3 0.0000 1.000 0.000 0.000 1.000
#> GSM71690 2 0.0000 0.996 0.000 1.000 0.000
#> GSM71691 2 0.0237 0.993 0.000 0.996 0.004
#> GSM71692 3 0.0000 1.000 0.000 0.000 1.000
#> GSM71693 2 0.0000 0.996 0.000 1.000 0.000
#> GSM71694 3 0.0000 1.000 0.000 0.000 1.000
#> GSM71695 2 0.0000 0.996 0.000 1.000 0.000
#> GSM71696 1 0.0000 0.993 1.000 0.000 0.000
#> GSM71697 1 0.0000 0.993 1.000 0.000 0.000
#> GSM71698 1 0.0000 0.993 1.000 0.000 0.000
#> GSM71699 1 0.0000 0.993 1.000 0.000 0.000
#> GSM71700 1 0.0000 0.993 1.000 0.000 0.000
#> GSM71701 1 0.0000 0.993 1.000 0.000 0.000
#> GSM71702 1 0.0000 0.993 1.000 0.000 0.000
#> GSM71703 1 0.0000 0.993 1.000 0.000 0.000
#> GSM71704 1 0.0000 0.993 1.000 0.000 0.000
#> GSM71705 1 0.0000 0.993 1.000 0.000 0.000
#> GSM71706 1 0.0000 0.993 1.000 0.000 0.000
#> GSM71707 1 0.0000 0.993 1.000 0.000 0.000
#> GSM71708 1 0.0000 0.993 1.000 0.000 0.000
#> GSM71709 2 0.0000 0.996 0.000 1.000 0.000
#> GSM71710 1 0.0000 0.993 1.000 0.000 0.000
#> GSM71711 1 0.0000 0.993 1.000 0.000 0.000
#> GSM71712 2 0.0000 0.996 0.000 1.000 0.000
#> GSM71713 1 0.4235 0.774 0.824 0.176 0.000
#> GSM71714 1 0.0000 0.993 1.000 0.000 0.000
#> GSM71715 1 0.0000 0.993 1.000 0.000 0.000
#> GSM71716 1 0.0000 0.993 1.000 0.000 0.000
#> GSM71717 1 0.0000 0.993 1.000 0.000 0.000
#> GSM71718 1 0.0000 0.993 1.000 0.000 0.000
#> GSM71719 1 0.0000 0.993 1.000 0.000 0.000
#> GSM71720 1 0.0000 0.993 1.000 0.000 0.000
#> GSM71721 1 0.0000 0.993 1.000 0.000 0.000
#> GSM71722 1 0.0000 0.993 1.000 0.000 0.000
#> GSM71723 1 0.0000 0.993 1.000 0.000 0.000
#> GSM71724 1 0.0000 0.993 1.000 0.000 0.000
#> GSM71725 2 0.1964 0.922 0.056 0.944 0.000
#> GSM71726 2 0.0000 0.996 0.000 1.000 0.000
#> GSM71727 2 0.0000 0.996 0.000 1.000 0.000
#> GSM71728 2 0.0000 0.996 0.000 1.000 0.000
#> GSM71729 2 0.0000 0.996 0.000 1.000 0.000
#> GSM71730 2 0.0000 0.996 0.000 1.000 0.000
#> GSM71731 1 0.0000 0.993 1.000 0.000 0.000
#> GSM71732 1 0.0000 0.993 1.000 0.000 0.000
#> GSM71733 1 0.0000 0.993 1.000 0.000 0.000
#> GSM71734 1 0.0000 0.993 1.000 0.000 0.000
#> GSM71735 1 0.0000 0.993 1.000 0.000 0.000
#> GSM71736 1 0.0000 0.993 1.000 0.000 0.000
#> GSM71737 1 0.0000 0.993 1.000 0.000 0.000
#> GSM71738 1 0.0000 0.993 1.000 0.000 0.000
#> GSM71739 1 0.1529 0.950 0.960 0.040 0.000
#> GSM71740 1 0.0000 0.993 1.000 0.000 0.000
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> GSM71671 3 0.0188 0.986 0.000 0.000 0.996 0.004
#> GSM71672 3 0.0000 0.986 0.000 0.000 1.000 0.000
#> GSM71673 3 0.0188 0.986 0.000 0.000 0.996 0.004
#> GSM71674 3 0.0188 0.986 0.000 0.000 0.996 0.004
#> GSM71675 3 0.0188 0.986 0.000 0.000 0.996 0.004
#> GSM71676 3 0.2480 0.888 0.000 0.088 0.904 0.008
#> GSM71677 3 0.0188 0.985 0.000 0.000 0.996 0.004
#> GSM71678 2 0.0469 0.969 0.000 0.988 0.000 0.012
#> GSM71679 2 0.0469 0.969 0.000 0.988 0.000 0.012
#> GSM71680 4 0.2081 0.816 0.000 0.084 0.000 0.916
#> GSM71681 2 0.0817 0.961 0.000 0.976 0.000 0.024
#> GSM71682 2 0.0469 0.969 0.000 0.988 0.000 0.012
#> GSM71683 2 0.0000 0.968 0.000 1.000 0.000 0.000
#> GSM71684 2 0.0188 0.969 0.000 0.996 0.000 0.004
#> GSM71685 2 0.0707 0.964 0.000 0.980 0.000 0.020
#> GSM71686 2 0.0469 0.969 0.000 0.988 0.000 0.012
#> GSM71687 2 0.0000 0.968 0.000 1.000 0.000 0.000
#> GSM71688 2 0.0336 0.969 0.000 0.992 0.000 0.008
#> GSM71689 3 0.0188 0.985 0.000 0.000 0.996 0.004
#> GSM71690 2 0.0336 0.969 0.000 0.992 0.000 0.008
#> GSM71691 2 0.0524 0.959 0.000 0.988 0.004 0.008
#> GSM71692 3 0.0000 0.986 0.000 0.000 1.000 0.000
#> GSM71693 2 0.0000 0.968 0.000 1.000 0.000 0.000
#> GSM71694 3 0.0188 0.985 0.000 0.000 0.996 0.004
#> GSM71695 2 0.0188 0.966 0.000 0.996 0.000 0.004
#> GSM71696 1 0.0000 0.976 1.000 0.000 0.000 0.000
#> GSM71697 1 0.0336 0.975 0.992 0.000 0.000 0.008
#> GSM71698 1 0.0817 0.967 0.976 0.000 0.000 0.024
#> GSM71699 1 0.0000 0.976 1.000 0.000 0.000 0.000
#> GSM71700 1 0.0592 0.971 0.984 0.000 0.000 0.016
#> GSM71701 1 0.0000 0.976 1.000 0.000 0.000 0.000
#> GSM71702 1 0.0000 0.976 1.000 0.000 0.000 0.000
#> GSM71703 1 0.0000 0.976 1.000 0.000 0.000 0.000
#> GSM71704 1 0.0000 0.976 1.000 0.000 0.000 0.000
#> GSM71705 1 0.0000 0.976 1.000 0.000 0.000 0.000
#> GSM71706 1 0.0336 0.973 0.992 0.000 0.000 0.008
#> GSM71707 1 0.0000 0.976 1.000 0.000 0.000 0.000
#> GSM71708 1 0.0336 0.973 0.992 0.000 0.000 0.008
#> GSM71709 4 0.2281 0.810 0.000 0.096 0.000 0.904
#> GSM71710 1 0.0000 0.976 1.000 0.000 0.000 0.000
#> GSM71711 1 0.0336 0.975 0.992 0.000 0.000 0.008
#> GSM71712 4 0.0804 0.820 0.008 0.012 0.000 0.980
#> GSM71713 4 0.5290 0.276 0.404 0.012 0.000 0.584
#> GSM71714 1 0.0336 0.975 0.992 0.000 0.000 0.008
#> GSM71715 1 0.0336 0.973 0.992 0.000 0.000 0.008
#> GSM71716 1 0.0000 0.976 1.000 0.000 0.000 0.000
#> GSM71717 1 0.0188 0.975 0.996 0.000 0.000 0.004
#> GSM71718 1 0.1118 0.958 0.964 0.000 0.000 0.036
#> GSM71719 1 0.2408 0.886 0.896 0.000 0.000 0.104
#> GSM71720 1 0.0707 0.969 0.980 0.000 0.000 0.020
#> GSM71721 1 0.1389 0.947 0.952 0.000 0.000 0.048
#> GSM71722 1 0.0707 0.969 0.980 0.000 0.000 0.020
#> GSM71723 1 0.0336 0.975 0.992 0.000 0.000 0.008
#> GSM71724 1 0.0707 0.969 0.980 0.000 0.000 0.020
#> GSM71725 4 0.1151 0.812 0.024 0.008 0.000 0.968
#> GSM71726 4 0.0779 0.820 0.004 0.016 0.000 0.980
#> GSM71727 4 0.3356 0.743 0.000 0.176 0.000 0.824
#> GSM71728 4 0.0804 0.820 0.008 0.012 0.000 0.980
#> GSM71729 4 0.4713 0.439 0.000 0.360 0.000 0.640
#> GSM71730 2 0.4304 0.565 0.000 0.716 0.000 0.284
#> GSM71731 1 0.0707 0.969 0.980 0.000 0.000 0.020
#> GSM71732 1 0.0336 0.975 0.992 0.000 0.000 0.008
#> GSM71733 1 0.0336 0.975 0.992 0.000 0.000 0.008
#> GSM71734 1 0.0188 0.975 0.996 0.000 0.000 0.004
#> GSM71735 1 0.0000 0.976 1.000 0.000 0.000 0.000
#> GSM71736 1 0.0336 0.973 0.992 0.000 0.000 0.008
#> GSM71737 1 0.0188 0.975 0.996 0.000 0.000 0.004
#> GSM71738 1 0.0000 0.976 1.000 0.000 0.000 0.000
#> GSM71739 1 0.4843 0.347 0.604 0.396 0.000 0.000
#> GSM71740 1 0.0000 0.976 1.000 0.000 0.000 0.000
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> GSM71671 3 0.0000 0.965 0.000 0.000 1.000 0.000 0.000
#> GSM71672 3 0.0000 0.965 0.000 0.000 1.000 0.000 0.000
#> GSM71673 3 0.0000 0.965 0.000 0.000 1.000 0.000 0.000
#> GSM71674 3 0.0000 0.965 0.000 0.000 1.000 0.000 0.000
#> GSM71675 3 0.0162 0.963 0.000 0.000 0.996 0.000 0.004
#> GSM71676 3 0.5079 0.650 0.000 0.156 0.728 0.100 0.016
#> GSM71677 3 0.0324 0.961 0.000 0.004 0.992 0.000 0.004
#> GSM71678 2 0.0693 0.930 0.000 0.980 0.000 0.008 0.012
#> GSM71679 2 0.0671 0.929 0.000 0.980 0.000 0.004 0.016
#> GSM71680 4 0.0510 0.646 0.000 0.016 0.000 0.984 0.000
#> GSM71681 2 0.1408 0.906 0.000 0.948 0.000 0.044 0.008
#> GSM71682 2 0.1124 0.924 0.000 0.960 0.000 0.004 0.036
#> GSM71683 2 0.0324 0.928 0.000 0.992 0.000 0.004 0.004
#> GSM71684 2 0.0162 0.929 0.000 0.996 0.000 0.004 0.000
#> GSM71685 2 0.2193 0.865 0.000 0.900 0.000 0.092 0.008
#> GSM71686 2 0.2719 0.840 0.000 0.852 0.000 0.004 0.144
#> GSM71687 2 0.0798 0.928 0.000 0.976 0.000 0.008 0.016
#> GSM71688 2 0.0451 0.929 0.000 0.988 0.000 0.008 0.004
#> GSM71689 3 0.0162 0.964 0.000 0.000 0.996 0.000 0.004
#> GSM71690 2 0.0451 0.929 0.000 0.988 0.000 0.008 0.004
#> GSM71691 2 0.1502 0.912 0.000 0.940 0.000 0.004 0.056
#> GSM71692 3 0.0162 0.964 0.000 0.000 0.996 0.000 0.004
#> GSM71693 2 0.0162 0.928 0.000 0.996 0.000 0.000 0.004
#> GSM71694 3 0.0162 0.964 0.000 0.000 0.996 0.000 0.004
#> GSM71695 2 0.1628 0.912 0.000 0.936 0.000 0.008 0.056
#> GSM71696 1 0.0000 0.965 1.000 0.000 0.000 0.000 0.000
#> GSM71697 1 0.0162 0.965 0.996 0.000 0.000 0.000 0.004
#> GSM71698 1 0.0703 0.961 0.976 0.000 0.000 0.000 0.024
#> GSM71699 1 0.0162 0.965 0.996 0.000 0.000 0.000 0.004
#> GSM71700 1 0.0510 0.962 0.984 0.000 0.000 0.000 0.016
#> GSM71701 1 0.0290 0.965 0.992 0.000 0.000 0.000 0.008
#> GSM71702 1 0.0162 0.965 0.996 0.000 0.000 0.000 0.004
#> GSM71703 1 0.0162 0.965 0.996 0.000 0.000 0.000 0.004
#> GSM71704 1 0.0162 0.965 0.996 0.000 0.000 0.000 0.004
#> GSM71705 1 0.0162 0.965 0.996 0.000 0.000 0.000 0.004
#> GSM71706 1 0.0771 0.956 0.976 0.000 0.000 0.004 0.020
#> GSM71707 1 0.0162 0.965 0.996 0.000 0.000 0.000 0.004
#> GSM71708 1 0.1205 0.942 0.956 0.000 0.000 0.004 0.040
#> GSM71709 4 0.0794 0.650 0.000 0.028 0.000 0.972 0.000
#> GSM71710 1 0.0290 0.964 0.992 0.000 0.000 0.000 0.008
#> GSM71711 1 0.0162 0.965 0.996 0.000 0.000 0.000 0.004
#> GSM71712 5 0.4227 0.513 0.000 0.000 0.000 0.420 0.580
#> GSM71713 5 0.4031 0.657 0.044 0.000 0.000 0.184 0.772
#> GSM71714 1 0.0404 0.963 0.988 0.000 0.000 0.000 0.012
#> GSM71715 1 0.0162 0.965 0.996 0.000 0.000 0.000 0.004
#> GSM71716 1 0.0404 0.964 0.988 0.000 0.000 0.000 0.012
#> GSM71717 1 0.0404 0.963 0.988 0.000 0.000 0.000 0.012
#> GSM71718 1 0.2136 0.894 0.904 0.000 0.000 0.008 0.088
#> GSM71719 1 0.4425 0.632 0.716 0.000 0.000 0.040 0.244
#> GSM71720 1 0.0510 0.962 0.984 0.000 0.000 0.000 0.016
#> GSM71721 1 0.1626 0.929 0.940 0.000 0.000 0.016 0.044
#> GSM71722 1 0.0510 0.962 0.984 0.000 0.000 0.000 0.016
#> GSM71723 1 0.0162 0.965 0.996 0.000 0.000 0.000 0.004
#> GSM71724 1 0.0609 0.960 0.980 0.000 0.000 0.000 0.020
#> GSM71725 5 0.3480 0.707 0.000 0.000 0.000 0.248 0.752
#> GSM71726 4 0.3039 0.465 0.000 0.000 0.000 0.808 0.192
#> GSM71727 4 0.1809 0.645 0.000 0.060 0.000 0.928 0.012
#> GSM71728 4 0.4294 -0.394 0.000 0.000 0.000 0.532 0.468
#> GSM71729 4 0.5375 0.390 0.000 0.200 0.000 0.664 0.136
#> GSM71730 2 0.4278 0.171 0.000 0.548 0.000 0.452 0.000
#> GSM71731 1 0.0290 0.964 0.992 0.000 0.000 0.000 0.008
#> GSM71732 1 0.0162 0.965 0.996 0.000 0.000 0.000 0.004
#> GSM71733 1 0.0162 0.965 0.996 0.000 0.000 0.000 0.004
#> GSM71734 1 0.0290 0.964 0.992 0.000 0.000 0.000 0.008
#> GSM71735 1 0.0162 0.965 0.996 0.000 0.000 0.000 0.004
#> GSM71736 1 0.1571 0.925 0.936 0.000 0.000 0.004 0.060
#> GSM71737 1 0.0404 0.963 0.988 0.000 0.000 0.000 0.012
#> GSM71738 1 0.0162 0.965 0.996 0.000 0.000 0.000 0.004
#> GSM71739 1 0.4219 0.297 0.584 0.416 0.000 0.000 0.000
#> GSM71740 1 0.0162 0.965 0.996 0.000 0.000 0.000 0.004
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> GSM71671 3 0.0146 0.958 0.000 0.000 0.996 0.004 0.000 NA
#> GSM71672 3 0.0000 0.959 0.000 0.000 1.000 0.000 0.000 NA
#> GSM71673 3 0.0000 0.959 0.000 0.000 1.000 0.000 0.000 NA
#> GSM71674 3 0.0000 0.959 0.000 0.000 1.000 0.000 0.000 NA
#> GSM71675 3 0.0146 0.958 0.000 0.000 0.996 0.000 0.004 NA
#> GSM71676 3 0.5460 0.547 0.000 0.056 0.652 0.220 0.004 NA
#> GSM71677 3 0.0291 0.956 0.000 0.000 0.992 0.000 0.004 NA
#> GSM71678 2 0.0551 0.925 0.000 0.984 0.000 0.004 0.004 NA
#> GSM71679 2 0.0622 0.924 0.000 0.980 0.000 0.000 0.012 NA
#> GSM71680 4 0.0291 0.629 0.000 0.004 0.000 0.992 0.000 NA
#> GSM71681 2 0.2237 0.866 0.000 0.896 0.000 0.068 0.000 NA
#> GSM71682 2 0.2058 0.898 0.000 0.908 0.000 0.000 0.036 NA
#> GSM71683 2 0.1296 0.909 0.000 0.948 0.000 0.004 0.004 NA
#> GSM71684 2 0.1148 0.925 0.000 0.960 0.000 0.004 0.020 NA
#> GSM71685 2 0.3839 0.662 0.000 0.748 0.000 0.212 0.004 NA
#> GSM71686 2 0.3745 0.782 0.000 0.784 0.000 0.000 0.116 NA
#> GSM71687 2 0.1176 0.921 0.000 0.956 0.000 0.000 0.020 NA
#> GSM71688 2 0.0260 0.924 0.000 0.992 0.000 0.000 0.000 NA
#> GSM71689 3 0.0146 0.959 0.000 0.000 0.996 0.000 0.000 NA
#> GSM71690 2 0.0260 0.924 0.000 0.992 0.000 0.000 0.000 NA
#> GSM71691 2 0.1649 0.915 0.000 0.932 0.000 0.000 0.032 NA
#> GSM71692 3 0.0146 0.959 0.000 0.000 0.996 0.000 0.000 NA
#> GSM71693 2 0.0790 0.917 0.000 0.968 0.000 0.000 0.000 NA
#> GSM71694 3 0.0146 0.959 0.000 0.000 0.996 0.000 0.000 NA
#> GSM71695 2 0.1713 0.913 0.000 0.928 0.000 0.000 0.028 NA
#> GSM71696 1 0.0260 0.962 0.992 0.000 0.000 0.000 0.000 NA
#> GSM71697 1 0.0363 0.962 0.988 0.000 0.000 0.000 0.000 NA
#> GSM71698 1 0.0547 0.959 0.980 0.000 0.000 0.000 0.000 NA
#> GSM71699 1 0.0777 0.961 0.972 0.000 0.000 0.000 0.004 NA
#> GSM71700 1 0.0858 0.957 0.968 0.000 0.000 0.000 0.004 NA
#> GSM71701 1 0.0260 0.963 0.992 0.000 0.000 0.000 0.000 NA
#> GSM71702 1 0.0790 0.959 0.968 0.000 0.000 0.000 0.000 NA
#> GSM71703 1 0.0632 0.960 0.976 0.000 0.000 0.000 0.000 NA
#> GSM71704 1 0.0713 0.960 0.972 0.000 0.000 0.000 0.000 NA
#> GSM71705 1 0.0713 0.960 0.972 0.000 0.000 0.000 0.000 NA
#> GSM71706 1 0.0937 0.956 0.960 0.000 0.000 0.000 0.000 NA
#> GSM71707 1 0.0458 0.962 0.984 0.000 0.000 0.000 0.000 NA
#> GSM71708 1 0.1610 0.927 0.916 0.000 0.000 0.000 0.000 NA
#> GSM71709 4 0.0508 0.634 0.000 0.012 0.000 0.984 0.004 NA
#> GSM71710 1 0.0790 0.958 0.968 0.000 0.000 0.000 0.000 NA
#> GSM71711 1 0.0260 0.962 0.992 0.000 0.000 0.000 0.000 NA
#> GSM71712 5 0.2566 0.801 0.000 0.012 0.000 0.112 0.868 NA
#> GSM71713 5 0.4901 0.694 0.016 0.020 0.000 0.044 0.688 NA
#> GSM71714 1 0.0458 0.960 0.984 0.000 0.000 0.000 0.000 NA
#> GSM71715 1 0.0790 0.958 0.968 0.000 0.000 0.000 0.000 NA
#> GSM71716 1 0.0363 0.963 0.988 0.000 0.000 0.000 0.000 NA
#> GSM71717 1 0.0790 0.958 0.968 0.000 0.000 0.000 0.000 NA
#> GSM71718 1 0.2145 0.906 0.900 0.000 0.000 0.000 0.028 NA
#> GSM71719 1 0.3826 0.770 0.784 0.000 0.000 0.004 0.088 NA
#> GSM71720 1 0.0777 0.957 0.972 0.000 0.000 0.000 0.004 NA
#> GSM71721 1 0.1708 0.932 0.932 0.000 0.000 0.004 0.024 NA
#> GSM71722 1 0.0632 0.958 0.976 0.000 0.000 0.000 0.000 NA
#> GSM71723 1 0.0458 0.960 0.984 0.000 0.000 0.000 0.000 NA
#> GSM71724 1 0.0777 0.957 0.972 0.000 0.000 0.000 0.004 NA
#> GSM71725 5 0.2342 0.793 0.000 0.024 0.000 0.040 0.904 NA
#> GSM71726 4 0.4725 0.233 0.000 0.000 0.000 0.604 0.332 NA
#> GSM71727 4 0.2420 0.627 0.000 0.032 0.000 0.888 0.076 NA
#> GSM71728 5 0.4108 0.703 0.000 0.008 0.000 0.164 0.756 NA
#> GSM71729 4 0.6175 0.251 0.000 0.120 0.000 0.496 0.340 NA
#> GSM71730 4 0.4242 0.362 0.000 0.368 0.000 0.612 0.012 NA
#> GSM71731 1 0.0458 0.960 0.984 0.000 0.000 0.000 0.000 NA
#> GSM71732 1 0.0363 0.961 0.988 0.000 0.000 0.000 0.000 NA
#> GSM71733 1 0.0146 0.963 0.996 0.000 0.000 0.000 0.000 NA
#> GSM71734 1 0.0713 0.960 0.972 0.000 0.000 0.000 0.000 NA
#> GSM71735 1 0.0000 0.962 1.000 0.000 0.000 0.000 0.000 NA
#> GSM71736 1 0.2003 0.899 0.884 0.000 0.000 0.000 0.000 NA
#> GSM71737 1 0.0865 0.957 0.964 0.000 0.000 0.000 0.000 NA
#> GSM71738 1 0.0632 0.960 0.976 0.000 0.000 0.000 0.000 NA
#> GSM71739 1 0.3777 0.694 0.756 0.208 0.000 0.000 0.008 NA
#> GSM71740 1 0.0260 0.962 0.992 0.000 0.000 0.000 0.000 NA
Heatmaps for the consensus matrix. It visualizes the probability of two samples to be in a same group.
consensus_heatmap(res, k = 2)
consensus_heatmap(res, k = 3)
consensus_heatmap(res, k = 4)
consensus_heatmap(res, k = 5)
consensus_heatmap(res, k = 6)
Heatmaps for the membership of samples in all partitions to see how consistent they are:
membership_heatmap(res, k = 2)
membership_heatmap(res, k = 3)
membership_heatmap(res, k = 4)
membership_heatmap(res, k = 5)
membership_heatmap(res, k = 6)
As soon as we have had the classes for columns, we can look for signatures which are significantly different between classes which can be candidate marks for certain classes. Following are the heatmaps for signatures.
Signature heatmaps where rows are scaled:
get_signatures(res, k = 2)
get_signatures(res, k = 3)
get_signatures(res, k = 4)
get_signatures(res, k = 5)
get_signatures(res, k = 6)
Signature heatmaps where rows are not scaled:
get_signatures(res, k = 2, scale_rows = FALSE)
get_signatures(res, k = 3, scale_rows = FALSE)
get_signatures(res, k = 4, scale_rows = FALSE)
get_signatures(res, k = 5, scale_rows = FALSE)
get_signatures(res, k = 6, scale_rows = FALSE)
Compare the overlap of signatures from different k:
compare_signatures(res)
get_signature()
returns a data frame invisibly. TO get the list of signatures, the function
call should be assigned to a variable explicitly. In following code, if plot
argument is set
to FALSE
, no heatmap is plotted while only the differential analysis is performed.
# code only for demonstration
tb = get_signature(res, k = ..., plot = FALSE)
An example of the output of tb
is:
#> which_row fdr mean_1 mean_2 scaled_mean_1 scaled_mean_2 km
#> 1 38 0.042760348 8.373488 9.131774 -0.5533452 0.5164555 1
#> 2 40 0.018707592 7.106213 8.469186 -0.6173731 0.5762149 1
#> 3 55 0.019134737 10.221463 11.207825 -0.6159697 0.5749050 1
#> 4 59 0.006059896 5.921854 7.869574 -0.6899429 0.6439467 1
#> 5 60 0.018055526 8.928898 10.211722 -0.6204761 0.5791110 1
#> 6 98 0.009384629 15.714769 14.887706 0.6635654 -0.6193277 2
...
The columns in tb
are:
which_row
: row indices corresponding to the input matrix.fdr
: FDR for the differential test. mean_x
: The mean value in group x.scaled_mean_x
: The mean value in group x after rows are scaled.km
: Row groups if k-means clustering is applied to rows.UMAP plot which shows how samples are separated.
dimension_reduction(res, k = 2, method = "UMAP")
dimension_reduction(res, k = 3, method = "UMAP")
dimension_reduction(res, k = 4, method = "UMAP")
dimension_reduction(res, k = 5, method = "UMAP")
dimension_reduction(res, k = 6, method = "UMAP")
Following heatmap shows how subgroups are split when increasing k
:
collect_classes(res)
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) k
#> ATC:NMF 70 2.15e-13 2
#> ATC:NMF 70 5.33e-17 3
#> ATC:NMF 67 1.31e-18 4
#> ATC:NMF 65 5.59e-18 5
#> ATC:NMF 67 1.29e-18 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