Date: 2019-12-25 21:32:21 CET, cola version: 1.3.2
Document is loading...
All available functions which can be applied to this res_list
object:
res_list
#> A 'ConsensusPartitionList' object with 24 methods.
#> On a matrix with 51941 rows and 64 columns.
#> Top rows are extracted by 'SD, CV, MAD, ATC' methods.
#> Subgroups are detected by 'hclust, kmeans, skmeans, pam, mclust, NMF' method.
#> Number of partitions are tried for k = 2, 3, 4, 5, 6.
#> Performed in total 30000 partitions by row resampling.
#>
#> Following methods can be applied to this 'ConsensusPartitionList' object:
#> [1] "cola_report" "collect_classes" "collect_plots" "collect_stats"
#> [5] "colnames" "functional_enrichment" "get_anno_col" "get_anno"
#> [9] "get_classes" "get_matrix" "get_membership" "get_stats"
#> [13] "is_best_k" "is_stable_k" "ncol" "nrow"
#> [17] "rownames" "show" "suggest_best_k" "test_to_known_factors"
#> [21] "top_rows_heatmap" "top_rows_overlap"
#>
#> You can get result for a single method by, e.g. object["SD", "hclust"] or object["SD:hclust"]
#> or a subset of methods by object[c("SD", "CV")], c("hclust", "kmeans")]
The call of run_all_consensus_partition_methods()
was:
#> run_all_consensus_partition_methods(data = mat, mc.cores = 4, anno = anno)
Dimension of the input matrix:
mat = get_matrix(res_list)
dim(mat)
#> [1] 51941 64
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 | 1.000 | 1.000 | ** | |
SD:skmeans | 2 | 1.000 | 0.982 | 0.993 | ** | |
SD:mclust | 2 | 1.000 | 0.989 | 0.995 | ** | |
SD:NMF | 2 | 1.000 | 0.989 | 0.995 | ** | |
CV:kmeans | 2 | 1.000 | 1.000 | 1.000 | ** | |
CV:skmeans | 2 | 1.000 | 0.991 | 0.996 | ** | |
CV:mclust | 2 | 1.000 | 0.988 | 0.994 | ** | |
CV:NMF | 2 | 1.000 | 0.984 | 0.993 | ** | |
MAD:kmeans | 2 | 1.000 | 0.999 | 0.995 | ** | |
MAD:skmeans | 3 | 1.000 | 0.998 | 0.999 | ** | 2 |
MAD:mclust | 2 | 1.000 | 0.975 | 0.991 | ** | |
ATC:mclust | 2 | 1.000 | 0.979 | 0.990 | ** | |
ATC:NMF | 3 | 1.000 | 0.959 | 0.985 | ** | 2 |
ATC:pam | 4 | 0.987 | 0.959 | 0.971 | ** | 2,3 |
MAD:pam | 3 | 0.980 | 0.950 | 0.980 | ** | 2 |
MAD:hclust | 3 | 0.968 | 0.922 | 0.974 | ** | 2 |
ATC:kmeans | 3 | 0.943 | 0.977 | 0.977 | * | 2 |
ATC:skmeans | 3 | 0.933 | 0.988 | 0.981 | * | 2 |
MAD:NMF | 3 | 0.931 | 0.898 | 0.960 | * | 2 |
CV:pam | 3 | 0.929 | 0.952 | 0.968 | * | 2 |
SD:hclust | 3 | 0.928 | 0.949 | 0.959 | * | 2 |
CV:hclust | 3 | 0.919 | 0.923 | 0.956 | * | |
SD:pam | 5 | 0.901 | 0.873 | 0.941 | * | 2,3 |
ATC:hclust | 3 | 0.508 | 0.912 | 0.877 |
**: 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.989 0.995 0.492 0.510 0.510
#> CV:NMF 2 1.000 0.984 0.993 0.493 0.510 0.510
#> MAD:NMF 2 1.000 0.983 0.992 0.490 0.510 0.510
#> ATC:NMF 2 1.000 1.000 1.000 0.496 0.504 0.504
#> SD:skmeans 2 1.000 0.982 0.993 0.493 0.510 0.510
#> CV:skmeans 2 1.000 0.991 0.996 0.495 0.504 0.504
#> MAD:skmeans 2 1.000 0.986 0.994 0.493 0.510 0.510
#> ATC:skmeans 2 1.000 1.000 1.000 0.496 0.504 0.504
#> SD:mclust 2 1.000 0.989 0.995 0.504 0.497 0.497
#> CV:mclust 2 1.000 0.988 0.995 0.504 0.497 0.497
#> MAD:mclust 2 1.000 0.975 0.991 0.499 0.504 0.504
#> ATC:mclust 2 1.000 0.979 0.990 0.508 0.492 0.492
#> SD:kmeans 2 1.000 1.000 1.000 0.491 0.510 0.510
#> CV:kmeans 2 1.000 1.000 1.000 0.491 0.510 0.510
#> MAD:kmeans 2 1.000 0.999 0.995 0.486 0.510 0.510
#> ATC:kmeans 2 1.000 0.993 0.990 0.489 0.504 0.504
#> SD:pam 2 1.000 0.984 0.994 0.487 0.516 0.516
#> CV:pam 2 1.000 0.997 0.999 0.490 0.510 0.510
#> MAD:pam 2 1.000 0.975 0.989 0.487 0.510 0.510
#> ATC:pam 2 1.000 1.000 1.000 0.496 0.504 0.504
#> SD:hclust 2 1.000 0.977 0.987 0.480 0.516 0.516
#> CV:hclust 2 0.820 0.945 0.971 0.471 0.516 0.516
#> MAD:hclust 2 0.967 0.937 0.976 0.462 0.532 0.532
#> ATC:hclust 2 0.488 0.740 0.876 0.317 0.778 0.778
get_stats(res_list, k = 3)
#> k 1-PAC mean_silhouette concordance area_increased Rand Jaccard
#> SD:NMF 3 0.711 0.856 0.853 0.3016 0.823 0.653
#> CV:NMF 3 0.712 0.813 0.771 0.2903 0.800 0.618
#> MAD:NMF 3 0.931 0.898 0.960 0.3623 0.800 0.616
#> ATC:NMF 3 1.000 0.959 0.985 0.1485 0.935 0.872
#> SD:skmeans 3 0.756 0.957 0.928 0.3068 0.833 0.673
#> CV:skmeans 3 0.756 0.951 0.919 0.2984 0.826 0.659
#> MAD:skmeans 3 1.000 0.998 0.999 0.3346 0.833 0.673
#> ATC:skmeans 3 0.933 0.988 0.981 0.1611 0.897 0.798
#> SD:mclust 3 0.856 0.907 0.912 0.2661 0.858 0.714
#> CV:mclust 3 0.795 0.798 0.894 0.2606 0.848 0.694
#> MAD:mclust 3 0.705 0.892 0.851 0.2679 0.820 0.653
#> ATC:mclust 3 0.667 0.830 0.839 0.2068 0.891 0.778
#> SD:kmeans 3 0.723 0.776 0.740 0.2618 0.821 0.649
#> CV:kmeans 3 0.735 0.876 0.827 0.2625 0.833 0.673
#> MAD:kmeans 3 0.721 0.921 0.871 0.2911 0.833 0.673
#> ATC:kmeans 3 0.943 0.977 0.977 0.1728 0.897 0.798
#> SD:pam 3 1.000 0.951 0.976 0.1706 0.898 0.805
#> CV:pam 3 0.929 0.952 0.969 0.1604 0.918 0.839
#> MAD:pam 3 0.980 0.950 0.980 0.3187 0.835 0.679
#> ATC:pam 3 1.000 0.974 0.989 0.1438 0.938 0.876
#> SD:hclust 3 0.928 0.949 0.959 0.1032 0.963 0.929
#> CV:hclust 3 0.919 0.923 0.956 0.1225 0.963 0.929
#> MAD:hclust 3 0.968 0.922 0.974 0.0884 0.961 0.927
#> ATC:hclust 3 0.508 0.912 0.877 0.6827 0.635 0.531
get_stats(res_list, k = 4)
#> k 1-PAC mean_silhouette concordance area_increased Rand Jaccard
#> SD:NMF 4 0.753 0.765 0.875 0.1545 0.816 0.524
#> CV:NMF 4 0.799 0.863 0.902 0.1699 0.878 0.657
#> MAD:NMF 4 0.850 0.858 0.919 0.1051 0.866 0.628
#> ATC:NMF 4 0.887 0.870 0.932 0.0752 0.971 0.934
#> SD:skmeans 4 0.854 0.947 0.922 0.1436 0.918 0.762
#> CV:skmeans 4 0.843 0.924 0.895 0.1449 0.918 0.762
#> MAD:skmeans 4 0.886 0.865 0.909 0.1030 0.929 0.792
#> ATC:skmeans 4 0.802 0.868 0.891 0.1783 0.876 0.700
#> SD:mclust 4 0.682 0.716 0.859 0.1388 0.864 0.634
#> CV:mclust 4 0.669 0.731 0.851 0.1437 0.864 0.625
#> MAD:mclust 4 0.743 0.855 0.874 0.1002 0.962 0.893
#> ATC:mclust 4 0.731 0.788 0.830 0.1139 0.933 0.845
#> SD:kmeans 4 0.611 0.837 0.792 0.1279 0.842 0.583
#> CV:kmeans 4 0.619 0.787 0.783 0.1390 0.918 0.762
#> MAD:kmeans 4 0.631 0.825 0.818 0.1318 1.000 1.000
#> ATC:kmeans 4 0.810 0.895 0.913 0.1013 0.994 0.986
#> SD:pam 4 0.802 0.905 0.924 0.2158 0.853 0.656
#> CV:pam 4 0.770 0.861 0.910 0.2225 0.861 0.676
#> MAD:pam 4 0.808 0.781 0.885 0.1022 0.950 0.861
#> ATC:pam 4 0.987 0.959 0.971 0.0568 0.965 0.921
#> SD:hclust 4 0.869 0.957 0.945 0.1096 0.933 0.859
#> CV:hclust 4 0.832 0.924 0.935 0.1113 0.933 0.859
#> MAD:hclust 4 0.669 0.676 0.832 0.2832 0.866 0.729
#> ATC:hclust 4 0.913 0.944 0.965 0.1292 0.994 0.986
get_stats(res_list, k = 5)
#> k 1-PAC mean_silhouette concordance area_increased Rand Jaccard
#> SD:NMF 5 0.815 0.759 0.865 0.0752 0.914 0.685
#> CV:NMF 5 0.854 0.810 0.882 0.0711 0.934 0.745
#> MAD:NMF 5 0.869 0.838 0.922 0.0498 0.951 0.815
#> ATC:NMF 5 0.687 0.666 0.831 0.0901 0.942 0.863
#> SD:skmeans 5 0.835 0.877 0.877 0.0708 0.941 0.774
#> CV:skmeans 5 0.823 0.677 0.798 0.0671 0.937 0.757
#> MAD:skmeans 5 0.741 0.627 0.823 0.0704 0.917 0.712
#> ATC:skmeans 5 0.812 0.873 0.903 0.0487 0.942 0.810
#> SD:mclust 5 0.564 0.426 0.639 0.0272 0.889 0.618
#> CV:mclust 5 0.583 0.604 0.701 0.0453 0.947 0.790
#> MAD:mclust 5 0.748 0.826 0.832 0.0995 0.915 0.730
#> ATC:mclust 5 0.651 0.538 0.766 0.0579 0.894 0.743
#> SD:kmeans 5 0.657 0.768 0.767 0.0807 1.000 1.000
#> CV:kmeans 5 0.642 0.786 0.773 0.0726 0.976 0.914
#> MAD:kmeans 5 0.680 0.490 0.751 0.0703 0.945 0.840
#> ATC:kmeans 5 0.808 0.841 0.867 0.1033 0.876 0.695
#> SD:pam 5 0.901 0.873 0.941 0.0650 0.965 0.878
#> CV:pam 5 0.762 0.816 0.902 0.0698 0.947 0.823
#> MAD:pam 5 0.789 0.806 0.873 0.0741 0.914 0.729
#> ATC:pam 5 0.752 0.768 0.860 0.2057 0.849 0.630
#> SD:hclust 5 0.756 0.882 0.899 0.1094 0.974 0.937
#> CV:hclust 5 0.708 0.839 0.879 0.0993 0.974 0.937
#> MAD:hclust 5 0.810 0.768 0.854 0.1155 0.913 0.760
#> ATC:hclust 5 0.767 0.573 0.823 0.1405 0.983 0.959
get_stats(res_list, k = 6)
#> k 1-PAC mean_silhouette concordance area_increased Rand Jaccard
#> SD:NMF 6 0.881 0.820 0.901 0.0408 0.934 0.702
#> CV:NMF 6 0.881 0.811 0.891 0.0371 0.931 0.687
#> MAD:NMF 6 0.845 0.787 0.886 0.0281 0.959 0.831
#> ATC:NMF 6 0.650 0.532 0.797 0.0659 0.919 0.790
#> SD:skmeans 6 0.798 0.773 0.850 0.0392 0.994 0.968
#> CV:skmeans 6 0.795 0.772 0.854 0.0429 0.927 0.686
#> MAD:skmeans 6 0.720 0.583 0.736 0.0473 0.913 0.656
#> ATC:skmeans 6 0.894 0.804 0.914 0.0699 0.981 0.928
#> SD:mclust 6 0.688 0.645 0.770 0.0701 0.841 0.433
#> CV:mclust 6 0.677 0.576 0.750 0.0560 0.909 0.628
#> MAD:mclust 6 0.692 0.660 0.778 0.0531 0.925 0.702
#> ATC:mclust 6 0.666 0.625 0.802 0.0279 0.949 0.846
#> SD:kmeans 6 0.673 0.717 0.735 0.0565 0.974 0.904
#> CV:kmeans 6 0.680 0.510 0.675 0.0532 0.914 0.682
#> MAD:kmeans 6 0.679 0.603 0.718 0.0538 0.918 0.723
#> ATC:kmeans 6 0.717 0.800 0.809 0.0702 0.948 0.818
#> SD:pam 6 0.780 0.776 0.886 0.0750 0.954 0.822
#> CV:pam 6 0.755 0.742 0.864 0.0602 0.945 0.787
#> MAD:pam 6 0.885 0.880 0.894 0.0574 0.941 0.763
#> ATC:pam 6 0.833 0.796 0.913 0.0888 0.901 0.646
#> SD:hclust 6 0.753 0.843 0.840 0.1360 0.840 0.587
#> CV:hclust 6 0.715 0.583 0.803 0.1206 0.981 0.951
#> MAD:hclust 6 0.747 0.775 0.835 0.0676 0.938 0.778
#> ATC:hclust 6 0.733 0.735 0.803 0.0183 0.943 0.854
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 tissue(p) k
#> SD:NMF 64 6.95e-14 2
#> CV:NMF 64 6.95e-14 2
#> MAD:NMF 64 6.95e-14 2
#> ATC:NMF 64 9.65e-15 2
#> SD:skmeans 63 1.62e-14 2
#> CV:skmeans 64 9.65e-15 2
#> MAD:skmeans 63 1.62e-14 2
#> ATC:skmeans 64 9.65e-15 2
#> SD:mclust 64 4.06e-13 2
#> CV:mclust 64 4.06e-13 2
#> MAD:mclust 63 1.59e-14 2
#> ATC:mclust 64 4.68e-11 2
#> SD:kmeans 64 6.95e-14 2
#> CV:kmeans 64 6.95e-14 2
#> MAD:kmeans 64 6.95e-14 2
#> ATC:kmeans 64 9.65e-15 2
#> SD:pam 63 1.18e-13 2
#> CV:pam 64 6.95e-14 2
#> MAD:pam 64 6.95e-14 2
#> ATC:pam 64 9.65e-15 2
#> SD:hclust 64 4.53e-13 2
#> CV:hclust 64 4.53e-13 2
#> MAD:hclust 61 1.47e-11 2
#> ATC:hclust 53 1.53e-03 2
test_to_known_factors(res_list, k = 3)
#> n tissue(p) k
#> SD:NMF 62 3.44e-14 3
#> CV:NMF 59 1.54e-13 3
#> MAD:NMF 59 1.54e-13 3
#> ATC:NMF 62 1.61e-13 3
#> SD:skmeans 64 8.50e-14 3
#> CV:skmeans 64 8.50e-14 3
#> MAD:skmeans 64 8.50e-14 3
#> ATC:skmeans 64 2.74e-13 3
#> SD:mclust 64 5.76e-13 3
#> CV:mclust 55 4.73e-11 3
#> MAD:mclust 63 1.50e-13 3
#> ATC:mclust 63 2.80e-12 3
#> SD:kmeans 59 1.00e-12 3
#> CV:kmeans 62 2.28e-13 3
#> MAD:kmeans 64 8.50e-14 3
#> ATC:kmeans 64 2.74e-13 3
#> SD:pam 63 1.56e-13 3
#> CV:pam 64 9.32e-14 3
#> MAD:pam 62 3.44e-14 3
#> ATC:pam 63 2.09e-14 3
#> SD:hclust 64 2.59e-13 3
#> CV:hclust 63 1.55e-13 3
#> MAD:hclust 62 3.07e-11 3
#> ATC:hclust 62 3.44e-14 3
test_to_known_factors(res_list, k = 4)
#> n tissue(p) k
#> SD:NMF 59 9.61e-13 4
#> CV:NMF 62 2.20e-13 4
#> MAD:NMF 61 1.53e-11 4
#> ATC:NMF 61 2.68e-13 4
#> SD:skmeans 64 5.35e-13 4
#> CV:skmeans 63 1.34e-13 4
#> MAD:skmeans 60 3.77e-12 4
#> ATC:skmeans 61 7.14e-12 4
#> SD:mclust 57 1.70e-11 4
#> CV:mclust 59 6.01e-12 4
#> MAD:mclust 63 9.32e-13 4
#> ATC:mclust 61 1.19e-12 4
#> SD:kmeans 64 5.35e-13 4
#> CV:kmeans 60 3.85e-12 4
#> MAD:kmeans 64 8.50e-14 4
#> ATC:kmeans 64 8.21e-14 4
#> SD:pam 63 9.49e-13 4
#> CV:pam 63 9.30e-13 4
#> MAD:pam 60 5.88e-13 4
#> ATC:pam 63 1.34e-13 4
#> SD:hclust 64 1.60e-12 4
#> CV:hclust 63 9.68e-13 4
#> MAD:hclust 55 1.91e-11 4
#> ATC:hclust 64 8.21e-14 4
test_to_known_factors(res_list, k = 5)
#> n tissue(p) k
#> SD:NMF 56 2.01e-11 5
#> CV:NMF 61 1.79e-12 5
#> MAD:NMF 59 1.71e-10 5
#> ATC:NMF 50 8.92e-11 5
#> SD:skmeans 64 2.64e-12 5
#> CV:skmeans 46 5.67e-10 5
#> MAD:skmeans 52 9.10e-10 5
#> ATC:skmeans 62 1.10e-12 5
#> SD:mclust 39 1.74e-08 5
#> CV:mclust 50 7.99e-11 5
#> MAD:mclust 64 2.74e-12 5
#> ATC:mclust 49 2.62e-09 5
#> SD:kmeans 62 1.41e-12 5
#> CV:kmeans 61 3.59e-13 5
#> MAD:kmeans 31 1.25e-06 5
#> ATC:kmeans 61 1.79e-12 5
#> SD:pam 60 2.90e-12 5
#> CV:pam 59 4.71e-12 5
#> MAD:pam 60 1.63e-11 5
#> ATC:pam 55 3.25e-11 5
#> SD:hclust 64 7.78e-12 5
#> CV:hclust 63 1.28e-11 5
#> MAD:hclust 61 7.31e-11 5
#> ATC:hclust 52 3.00e-11 5
test_to_known_factors(res_list, k = 6)
#> n tissue(p) k
#> SD:NMF 59 1.96e-11 6
#> CV:NMF 57 5.06e-11 6
#> MAD:NMF 58 2.67e-09 6
#> ATC:NMF 46 2.52e-09 6
#> SD:skmeans 59 4.71e-12 6
#> CV:skmeans 60 2.90e-12 6
#> MAD:skmeans 50 2.39e-09 6
#> ATC:skmeans 56 8.13e-11 6
#> SD:mclust 51 8.65e-10 6
#> CV:mclust 46 9.08e-09 6
#> MAD:mclust 53 3.36e-10 6
#> ATC:mclust 54 1.91e-10 6
#> SD:kmeans 58 7.63e-12 6
#> CV:kmeans 38 1.12e-07 6
#> MAD:kmeans 48 6.30e-09 6
#> ATC:kmeans 60 1.22e-11 6
#> SD:pam 57 5.06e-11 6
#> CV:pam 56 8.13e-11 6
#> MAD:pam 62 2.55e-11 6
#> ATC:pam 58 3.15e-11 6
#> SD:hclust 60 1.88e-10 6
#> CV:hclust 41 6.54e-09 6
#> MAD:hclust 58 4.13e-10 6
#> ATC:hclust 59 9.61e-13 6
The object with results only for a single top-value method and a single partition method can be extracted as:
res = res_list["SD", "hclust"]
# you can also extract it by
# res = res_list["SD:hclust"]
A summary of res
and all the functions that can be applied to it:
res
#> A 'ConsensusPartition' object with k = 2, 3, 4, 5, 6.
#> On a matrix with 51941 rows and 64 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 3.
#>
#> Following methods can be applied to this 'ConsensusPartition' object:
#> [1] "cola_report" "collect_classes" "collect_plots"
#> [4] "collect_stats" "colnames" "compare_signatures"
#> [7] "consensus_heatmap" "dimension_reduction" "functional_enrichment"
#> [10] "get_anno_col" "get_anno" "get_classes"
#> [13] "get_consensus" "get_matrix" "get_membership"
#> [16] "get_param" "get_signatures" "get_stats"
#> [19] "is_best_k" "is_stable_k" "membership_heatmap"
#> [22] "ncol" "nrow" "plot_ecdf"
#> [25] "rownames" "select_partition_number" "show"
#> [28] "suggest_best_k" "test_to_known_factors"
collect_plots()
function collects all the plots made from res
for all k
(number of partitions)
into one single page to provide an easy and fast comparison between different k
.
collect_plots(res)
The plots are:
k
and the heatmap of
predicted classes for each k
.k
.k
.k
.All the plots in panels can be made by individual functions and they are plotted later in this section.
select_partition_number()
produces several plots showing different
statistics for choosing “optimized” k
. There are following statistics:
k
;k
, the area increased is defined as \(A_k - A_{k-1}\).The detailed explanations of these statistics can be found in the cola vignette.
Generally speaking, lower PAC score, higher mean silhouette score or higher
concordance corresponds to better partition. Rand index and Jaccard index
measure how similar the current partition is compared to partition with k-1
.
If they are too similar, we won't accept k
is better than k-1
.
select_partition_number(res)
The numeric values for all these statistics can be obtained by get_stats()
.
get_stats(res)
#> k 1-PAC mean_silhouette concordance area_increased Rand Jaccard
#> 2 2 1.000 0.977 0.987 0.480 0.516 0.516
#> 3 3 0.928 0.949 0.959 0.103 0.963 0.929
#> 4 4 0.869 0.957 0.945 0.110 0.933 0.859
#> 5 5 0.756 0.882 0.899 0.109 0.974 0.937
#> 6 6 0.753 0.843 0.840 0.136 0.840 0.587
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
#> GSM862441 1 0.295 0.953 0.948 0.052
#> GSM862442 1 0.000 0.975 1.000 0.000
#> GSM862443 1 0.000 0.975 1.000 0.000
#> GSM862444 1 0.373 0.938 0.928 0.072
#> GSM862445 1 0.373 0.938 0.928 0.072
#> GSM862446 1 0.000 0.975 1.000 0.000
#> GSM862447 1 0.000 0.975 1.000 0.000
#> GSM862448 1 0.000 0.975 1.000 0.000
#> GSM862449 2 0.722 0.758 0.200 0.800
#> GSM862450 1 0.644 0.830 0.836 0.164
#> GSM862451 1 0.000 0.975 1.000 0.000
#> GSM862453 1 0.000 0.975 1.000 0.000
#> GSM862454 1 0.000 0.975 1.000 0.000
#> GSM862455 1 0.000 0.975 1.000 0.000
#> GSM862456 1 0.000 0.975 1.000 0.000
#> GSM862457 1 0.295 0.953 0.948 0.052
#> GSM862458 2 0.141 0.975 0.020 0.980
#> GSM862459 1 0.000 0.975 1.000 0.000
#> GSM862460 1 0.000 0.975 1.000 0.000
#> GSM862461 1 0.000 0.975 1.000 0.000
#> GSM862462 1 0.295 0.953 0.948 0.052
#> GSM862463 1 0.000 0.975 1.000 0.000
#> GSM862464 1 0.000 0.975 1.000 0.000
#> GSM862465 1 0.373 0.938 0.928 0.072
#> GSM862466 1 0.000 0.975 1.000 0.000
#> GSM862467 1 0.000 0.975 1.000 0.000
#> GSM862468 1 0.295 0.953 0.948 0.052
#> GSM862469 2 0.000 0.994 0.000 1.000
#> GSM862470 2 0.000 0.994 0.000 1.000
#> GSM862471 2 0.000 0.994 0.000 1.000
#> GSM862472 2 0.000 0.994 0.000 1.000
#> GSM862473 2 0.000 0.994 0.000 1.000
#> GSM862474 2 0.000 0.994 0.000 1.000
#> GSM862475 2 0.000 0.994 0.000 1.000
#> GSM862476 2 0.000 0.994 0.000 1.000
#> GSM862477 2 0.000 0.994 0.000 1.000
#> GSM862478 2 0.000 0.994 0.000 1.000
#> GSM862479 2 0.000 0.994 0.000 1.000
#> GSM862480 2 0.000 0.994 0.000 1.000
#> GSM862481 2 0.000 0.994 0.000 1.000
#> GSM862482 2 0.000 0.994 0.000 1.000
#> GSM862483 2 0.000 0.994 0.000 1.000
#> GSM862484 2 0.000 0.994 0.000 1.000
#> GSM862485 2 0.000 0.994 0.000 1.000
#> GSM862486 2 0.000 0.994 0.000 1.000
#> GSM862487 2 0.000 0.994 0.000 1.000
#> GSM862488 2 0.000 0.994 0.000 1.000
#> GSM862489 2 0.000 0.994 0.000 1.000
#> GSM862490 2 0.000 0.994 0.000 1.000
#> GSM862491 2 0.000 0.994 0.000 1.000
#> GSM862492 2 0.000 0.994 0.000 1.000
#> GSM862493 2 0.000 0.994 0.000 1.000
#> GSM862494 2 0.000 0.994 0.000 1.000
#> GSM862495 2 0.000 0.994 0.000 1.000
#> GSM862496 2 0.000 0.994 0.000 1.000
#> GSM862497 2 0.000 0.994 0.000 1.000
#> GSM862498 2 0.000 0.994 0.000 1.000
#> GSM862499 2 0.000 0.994 0.000 1.000
#> GSM862500 2 0.000 0.994 0.000 1.000
#> GSM862501 2 0.000 0.994 0.000 1.000
#> GSM862502 2 0.000 0.994 0.000 1.000
#> GSM862503 2 0.000 0.994 0.000 1.000
#> GSM862504 2 0.000 0.994 0.000 1.000
#> GSM862505 2 0.000 0.994 0.000 1.000
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> GSM862441 1 0.2356 0.906 0.928 0.000 0.072
#> GSM862442 1 0.3116 0.896 0.892 0.000 0.108
#> GSM862443 1 0.1643 0.924 0.956 0.000 0.044
#> GSM862444 1 0.2796 0.896 0.908 0.000 0.092
#> GSM862445 1 0.2796 0.896 0.908 0.000 0.092
#> GSM862446 1 0.3116 0.896 0.892 0.000 0.108
#> GSM862447 1 0.3116 0.896 0.892 0.000 0.108
#> GSM862448 1 0.3116 0.896 0.892 0.000 0.108
#> GSM862449 3 0.2356 0.679 0.072 0.000 0.928
#> GSM862450 1 0.5467 0.748 0.816 0.112 0.072
#> GSM862451 1 0.0000 0.926 1.000 0.000 0.000
#> GSM862453 1 0.3116 0.896 0.892 0.000 0.108
#> GSM862454 1 0.0000 0.926 1.000 0.000 0.000
#> GSM862455 1 0.0000 0.926 1.000 0.000 0.000
#> GSM862456 1 0.0000 0.926 1.000 0.000 0.000
#> GSM862457 1 0.2356 0.906 0.928 0.000 0.072
#> GSM862458 2 0.2796 0.880 0.000 0.908 0.092
#> GSM862459 1 0.0000 0.926 1.000 0.000 0.000
#> GSM862460 1 0.3116 0.896 0.892 0.000 0.108
#> GSM862461 1 0.0000 0.926 1.000 0.000 0.000
#> GSM862462 1 0.2356 0.906 0.928 0.000 0.072
#> GSM862463 1 0.0000 0.926 1.000 0.000 0.000
#> GSM862464 1 0.1643 0.924 0.956 0.000 0.044
#> GSM862465 1 0.2796 0.896 0.908 0.000 0.092
#> GSM862466 1 0.3116 0.896 0.892 0.000 0.108
#> GSM862467 1 0.3116 0.896 0.892 0.000 0.108
#> GSM862468 1 0.2356 0.906 0.928 0.000 0.072
#> GSM862469 2 0.0000 0.997 0.000 1.000 0.000
#> GSM862470 2 0.0000 0.997 0.000 1.000 0.000
#> GSM862471 2 0.0000 0.997 0.000 1.000 0.000
#> GSM862472 2 0.0000 0.997 0.000 1.000 0.000
#> GSM862473 2 0.0000 0.997 0.000 1.000 0.000
#> GSM862474 2 0.0000 0.997 0.000 1.000 0.000
#> GSM862475 2 0.0000 0.997 0.000 1.000 0.000
#> GSM862476 2 0.0000 0.997 0.000 1.000 0.000
#> GSM862477 2 0.0000 0.997 0.000 1.000 0.000
#> GSM862478 2 0.0000 0.997 0.000 1.000 0.000
#> GSM862479 2 0.0000 0.997 0.000 1.000 0.000
#> GSM862480 2 0.0000 0.997 0.000 1.000 0.000
#> GSM862481 2 0.0000 0.997 0.000 1.000 0.000
#> GSM862482 2 0.0237 0.993 0.000 0.996 0.004
#> GSM862483 3 0.4555 0.719 0.000 0.200 0.800
#> GSM862484 2 0.0000 0.997 0.000 1.000 0.000
#> GSM862485 2 0.0000 0.997 0.000 1.000 0.000
#> GSM862486 2 0.0000 0.997 0.000 1.000 0.000
#> GSM862487 2 0.0000 0.997 0.000 1.000 0.000
#> GSM862488 2 0.0000 0.997 0.000 1.000 0.000
#> GSM862489 2 0.0000 0.997 0.000 1.000 0.000
#> GSM862490 2 0.0000 0.997 0.000 1.000 0.000
#> GSM862491 2 0.0000 0.997 0.000 1.000 0.000
#> GSM862492 2 0.0000 0.997 0.000 1.000 0.000
#> GSM862493 2 0.0000 0.997 0.000 1.000 0.000
#> GSM862494 2 0.0000 0.997 0.000 1.000 0.000
#> GSM862495 2 0.0000 0.997 0.000 1.000 0.000
#> GSM862496 2 0.0000 0.997 0.000 1.000 0.000
#> GSM862497 2 0.0000 0.997 0.000 1.000 0.000
#> GSM862498 2 0.0000 0.997 0.000 1.000 0.000
#> GSM862499 2 0.0000 0.997 0.000 1.000 0.000
#> GSM862500 2 0.0000 0.997 0.000 1.000 0.000
#> GSM862501 2 0.0000 0.997 0.000 1.000 0.000
#> GSM862502 2 0.0000 0.997 0.000 1.000 0.000
#> GSM862503 2 0.0000 0.997 0.000 1.000 0.000
#> GSM862504 2 0.0000 0.997 0.000 1.000 0.000
#> GSM862505 2 0.0000 0.997 0.000 1.000 0.000
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> GSM862441 4 0.0188 0.926 0.000 0.000 0.004 0.996
#> GSM862442 1 0.2760 1.000 0.872 0.000 0.000 0.128
#> GSM862443 4 0.1867 0.918 0.072 0.000 0.000 0.928
#> GSM862444 4 0.0927 0.916 0.016 0.000 0.008 0.976
#> GSM862445 4 0.0927 0.916 0.016 0.000 0.008 0.976
#> GSM862446 1 0.2760 1.000 0.872 0.000 0.000 0.128
#> GSM862447 1 0.2760 1.000 0.872 0.000 0.000 0.128
#> GSM862448 1 0.2760 1.000 0.872 0.000 0.000 0.128
#> GSM862449 3 0.4290 0.756 0.164 0.000 0.800 0.036
#> GSM862450 4 0.2839 0.807 0.108 0.004 0.004 0.884
#> GSM862451 4 0.2089 0.927 0.048 0.000 0.020 0.932
#> GSM862453 1 0.2760 1.000 0.872 0.000 0.000 0.128
#> GSM862454 4 0.3037 0.904 0.100 0.000 0.020 0.880
#> GSM862455 4 0.3037 0.904 0.100 0.000 0.020 0.880
#> GSM862456 4 0.3037 0.904 0.100 0.000 0.020 0.880
#> GSM862457 4 0.0188 0.926 0.000 0.000 0.004 0.996
#> GSM862458 2 0.3485 0.864 0.048 0.876 0.008 0.068
#> GSM862459 4 0.2089 0.927 0.048 0.000 0.020 0.932
#> GSM862460 1 0.2760 1.000 0.872 0.000 0.000 0.128
#> GSM862461 4 0.2021 0.927 0.056 0.000 0.012 0.932
#> GSM862462 4 0.0188 0.926 0.000 0.000 0.004 0.996
#> GSM862463 4 0.3037 0.904 0.100 0.000 0.020 0.880
#> GSM862464 4 0.1867 0.918 0.072 0.000 0.000 0.928
#> GSM862465 4 0.2124 0.912 0.068 0.000 0.008 0.924
#> GSM862466 1 0.2760 1.000 0.872 0.000 0.000 0.128
#> GSM862467 1 0.2760 1.000 0.872 0.000 0.000 0.128
#> GSM862468 4 0.0188 0.926 0.000 0.000 0.004 0.996
#> GSM862469 2 0.2469 0.888 0.108 0.892 0.000 0.000
#> GSM862470 2 0.0000 0.989 0.000 1.000 0.000 0.000
#> GSM862471 2 0.0000 0.989 0.000 1.000 0.000 0.000
#> GSM862472 2 0.0000 0.989 0.000 1.000 0.000 0.000
#> GSM862473 2 0.0000 0.989 0.000 1.000 0.000 0.000
#> GSM862474 2 0.0000 0.989 0.000 1.000 0.000 0.000
#> GSM862475 2 0.0000 0.989 0.000 1.000 0.000 0.000
#> GSM862476 2 0.0000 0.989 0.000 1.000 0.000 0.000
#> GSM862477 2 0.0000 0.989 0.000 1.000 0.000 0.000
#> GSM862478 2 0.0000 0.989 0.000 1.000 0.000 0.000
#> GSM862479 2 0.2469 0.888 0.108 0.892 0.000 0.000
#> GSM862480 2 0.0188 0.987 0.004 0.996 0.000 0.000
#> GSM862481 2 0.0000 0.989 0.000 1.000 0.000 0.000
#> GSM862482 2 0.0188 0.986 0.004 0.996 0.000 0.000
#> GSM862483 3 0.0921 0.795 0.000 0.028 0.972 0.000
#> GSM862484 2 0.0000 0.989 0.000 1.000 0.000 0.000
#> GSM862485 2 0.1022 0.963 0.032 0.968 0.000 0.000
#> GSM862486 2 0.0000 0.989 0.000 1.000 0.000 0.000
#> GSM862487 2 0.0000 0.989 0.000 1.000 0.000 0.000
#> GSM862488 2 0.0000 0.989 0.000 1.000 0.000 0.000
#> GSM862489 2 0.0000 0.989 0.000 1.000 0.000 0.000
#> GSM862490 2 0.0000 0.989 0.000 1.000 0.000 0.000
#> GSM862491 2 0.0000 0.989 0.000 1.000 0.000 0.000
#> GSM862492 2 0.0000 0.989 0.000 1.000 0.000 0.000
#> GSM862493 2 0.0000 0.989 0.000 1.000 0.000 0.000
#> GSM862494 2 0.0000 0.989 0.000 1.000 0.000 0.000
#> GSM862495 2 0.0188 0.987 0.004 0.996 0.000 0.000
#> GSM862496 2 0.0188 0.987 0.004 0.996 0.000 0.000
#> GSM862497 2 0.0188 0.987 0.004 0.996 0.000 0.000
#> GSM862498 2 0.0000 0.989 0.000 1.000 0.000 0.000
#> GSM862499 2 0.0000 0.989 0.000 1.000 0.000 0.000
#> GSM862500 2 0.0000 0.989 0.000 1.000 0.000 0.000
#> GSM862501 2 0.0188 0.987 0.004 0.996 0.000 0.000
#> GSM862502 2 0.0188 0.987 0.004 0.996 0.000 0.000
#> GSM862503 2 0.0000 0.989 0.000 1.000 0.000 0.000
#> GSM862504 2 0.0000 0.989 0.000 1.000 0.000 0.000
#> GSM862505 2 0.0188 0.987 0.004 0.996 0.000 0.000
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> GSM862441 4 0.0510 0.902 0.000 0.000 0.0 0.984 0.016
#> GSM862442 1 0.0000 1.000 1.000 0.000 0.0 0.000 0.000
#> GSM862443 4 0.1877 0.867 0.064 0.000 0.0 0.924 0.012
#> GSM862444 4 0.0609 0.895 0.000 0.000 0.0 0.980 0.020
#> GSM862445 4 0.0609 0.895 0.000 0.000 0.0 0.980 0.020
#> GSM862446 1 0.0000 1.000 1.000 0.000 0.0 0.000 0.000
#> GSM862447 1 0.0000 1.000 1.000 0.000 0.0 0.000 0.000
#> GSM862448 1 0.0000 1.000 1.000 0.000 0.0 0.000 0.000
#> GSM862449 3 0.3565 0.774 0.176 0.000 0.8 0.024 0.000
#> GSM862450 4 0.2286 0.799 0.000 0.004 0.0 0.888 0.108
#> GSM862451 4 0.1908 0.855 0.000 0.000 0.0 0.908 0.092
#> GSM862453 1 0.0000 1.000 1.000 0.000 0.0 0.000 0.000
#> GSM862454 5 0.5772 1.000 0.108 0.000 0.0 0.328 0.564
#> GSM862455 5 0.5772 1.000 0.108 0.000 0.0 0.328 0.564
#> GSM862456 5 0.5772 1.000 0.108 0.000 0.0 0.328 0.564
#> GSM862457 4 0.0000 0.903 0.000 0.000 0.0 1.000 0.000
#> GSM862458 2 0.4930 0.733 0.000 0.684 0.0 0.072 0.244
#> GSM862459 4 0.1908 0.855 0.000 0.000 0.0 0.908 0.092
#> GSM862460 1 0.0000 1.000 1.000 0.000 0.0 0.000 0.000
#> GSM862461 4 0.2470 0.836 0.012 0.000 0.0 0.884 0.104
#> GSM862462 4 0.0000 0.903 0.000 0.000 0.0 1.000 0.000
#> GSM862463 5 0.5772 1.000 0.108 0.000 0.0 0.328 0.564
#> GSM862464 4 0.1877 0.867 0.064 0.000 0.0 0.924 0.012
#> GSM862465 4 0.2879 0.748 0.100 0.000 0.0 0.868 0.032
#> GSM862466 1 0.0000 1.000 1.000 0.000 0.0 0.000 0.000
#> GSM862467 1 0.0000 1.000 1.000 0.000 0.0 0.000 0.000
#> GSM862468 4 0.0000 0.903 0.000 0.000 0.0 1.000 0.000
#> GSM862469 2 0.3796 0.755 0.000 0.700 0.0 0.000 0.300
#> GSM862470 2 0.0000 0.893 0.000 1.000 0.0 0.000 0.000
#> GSM862471 2 0.3039 0.843 0.000 0.808 0.0 0.000 0.192
#> GSM862472 2 0.3039 0.843 0.000 0.808 0.0 0.000 0.192
#> GSM862473 2 0.0000 0.893 0.000 1.000 0.0 0.000 0.000
#> GSM862474 2 0.0000 0.893 0.000 1.000 0.0 0.000 0.000
#> GSM862475 2 0.0000 0.893 0.000 1.000 0.0 0.000 0.000
#> GSM862476 2 0.0000 0.893 0.000 1.000 0.0 0.000 0.000
#> GSM862477 2 0.0000 0.893 0.000 1.000 0.0 0.000 0.000
#> GSM862478 2 0.3039 0.843 0.000 0.808 0.0 0.000 0.192
#> GSM862479 2 0.3796 0.755 0.000 0.700 0.0 0.000 0.300
#> GSM862480 2 0.1671 0.858 0.000 0.924 0.0 0.000 0.076
#> GSM862481 2 0.0000 0.893 0.000 1.000 0.0 0.000 0.000
#> GSM862482 2 0.0162 0.892 0.000 0.996 0.0 0.000 0.004
#> GSM862483 3 0.0000 0.783 0.000 0.000 1.0 0.000 0.000
#> GSM862484 2 0.0000 0.893 0.000 1.000 0.0 0.000 0.000
#> GSM862485 2 0.3305 0.822 0.000 0.776 0.0 0.000 0.224
#> GSM862486 2 0.0290 0.892 0.000 0.992 0.0 0.000 0.008
#> GSM862487 2 0.3039 0.843 0.000 0.808 0.0 0.000 0.192
#> GSM862488 2 0.3039 0.843 0.000 0.808 0.0 0.000 0.192
#> GSM862489 2 0.0000 0.893 0.000 1.000 0.0 0.000 0.000
#> GSM862490 2 0.0000 0.893 0.000 1.000 0.0 0.000 0.000
#> GSM862491 2 0.3039 0.843 0.000 0.808 0.0 0.000 0.192
#> GSM862492 2 0.3039 0.843 0.000 0.808 0.0 0.000 0.192
#> GSM862493 2 0.0000 0.893 0.000 1.000 0.0 0.000 0.000
#> GSM862494 2 0.3039 0.843 0.000 0.808 0.0 0.000 0.192
#> GSM862495 2 0.2230 0.831 0.000 0.884 0.0 0.000 0.116
#> GSM862496 2 0.1671 0.858 0.000 0.924 0.0 0.000 0.076
#> GSM862497 2 0.1671 0.858 0.000 0.924 0.0 0.000 0.076
#> GSM862498 2 0.0000 0.893 0.000 1.000 0.0 0.000 0.000
#> GSM862499 2 0.3039 0.843 0.000 0.808 0.0 0.000 0.192
#> GSM862500 2 0.3039 0.843 0.000 0.808 0.0 0.000 0.192
#> GSM862501 2 0.2230 0.831 0.000 0.884 0.0 0.000 0.116
#> GSM862502 2 0.2230 0.831 0.000 0.884 0.0 0.000 0.116
#> GSM862503 2 0.0000 0.893 0.000 1.000 0.0 0.000 0.000
#> GSM862504 2 0.0000 0.893 0.000 1.000 0.0 0.000 0.000
#> GSM862505 2 0.2230 0.831 0.000 0.884 0.0 0.000 0.116
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> GSM862441 4 0.2178 0.838 0.000 0.0 0.000 0.868 0.000 0.132
#> GSM862442 1 0.0000 1.000 1.000 0.0 0.000 0.000 0.000 0.000
#> GSM862443 4 0.1826 0.865 0.052 0.0 0.020 0.924 0.000 0.004
#> GSM862444 4 0.1074 0.877 0.000 0.0 0.028 0.960 0.000 0.012
#> GSM862445 4 0.1074 0.877 0.000 0.0 0.028 0.960 0.000 0.012
#> GSM862446 1 0.0000 1.000 1.000 0.0 0.000 0.000 0.000 0.000
#> GSM862447 1 0.0000 1.000 1.000 0.0 0.000 0.000 0.000 0.000
#> GSM862448 1 0.0000 1.000 1.000 0.0 0.000 0.000 0.000 0.000
#> GSM862449 2 0.3384 0.767 0.168 0.8 0.008 0.024 0.000 0.000
#> GSM862450 4 0.1957 0.819 0.000 0.0 0.112 0.888 0.000 0.000
#> GSM862451 4 0.2854 0.787 0.000 0.0 0.000 0.792 0.000 0.208
#> GSM862453 1 0.0000 1.000 1.000 0.0 0.000 0.000 0.000 0.000
#> GSM862454 6 0.5633 1.000 0.060 0.0 0.292 0.060 0.000 0.588
#> GSM862455 6 0.5633 1.000 0.060 0.0 0.292 0.060 0.000 0.588
#> GSM862456 6 0.5633 1.000 0.060 0.0 0.292 0.060 0.000 0.588
#> GSM862457 4 0.0000 0.882 0.000 0.0 0.000 1.000 0.000 0.000
#> GSM862458 3 0.5044 0.822 0.000 0.0 0.548 0.052 0.388 0.012
#> GSM862459 4 0.2854 0.787 0.000 0.0 0.000 0.792 0.000 0.208
#> GSM862460 1 0.0000 1.000 1.000 0.0 0.000 0.000 0.000 0.000
#> GSM862461 4 0.3403 0.771 0.000 0.0 0.020 0.768 0.000 0.212
#> GSM862462 4 0.0000 0.882 0.000 0.0 0.000 1.000 0.000 0.000
#> GSM862463 6 0.5633 1.000 0.060 0.0 0.292 0.060 0.000 0.588
#> GSM862464 4 0.1826 0.865 0.052 0.0 0.020 0.924 0.000 0.004
#> GSM862465 4 0.3504 0.772 0.052 0.0 0.112 0.820 0.000 0.016
#> GSM862466 1 0.0000 1.000 1.000 0.0 0.000 0.000 0.000 0.000
#> GSM862467 1 0.0000 1.000 1.000 0.0 0.000 0.000 0.000 0.000
#> GSM862468 4 0.0000 0.882 0.000 0.0 0.000 1.000 0.000 0.000
#> GSM862469 3 0.3592 0.842 0.000 0.0 0.656 0.000 0.344 0.000
#> GSM862470 5 0.0146 0.804 0.000 0.0 0.000 0.000 0.996 0.004
#> GSM862471 3 0.3847 0.944 0.000 0.0 0.544 0.000 0.456 0.000
#> GSM862472 3 0.3866 0.913 0.000 0.0 0.516 0.000 0.484 0.000
#> GSM862473 5 0.0405 0.800 0.000 0.0 0.008 0.000 0.988 0.004
#> GSM862474 5 0.0458 0.794 0.000 0.0 0.016 0.000 0.984 0.000
#> GSM862475 5 0.0146 0.802 0.000 0.0 0.004 0.000 0.996 0.000
#> GSM862476 5 0.0458 0.794 0.000 0.0 0.016 0.000 0.984 0.000
#> GSM862477 5 0.0146 0.804 0.000 0.0 0.000 0.000 0.996 0.004
#> GSM862478 3 0.3847 0.944 0.000 0.0 0.544 0.000 0.456 0.000
#> GSM862479 3 0.3592 0.842 0.000 0.0 0.656 0.000 0.344 0.000
#> GSM862480 5 0.2902 0.690 0.000 0.0 0.004 0.000 0.800 0.196
#> GSM862481 5 0.0405 0.800 0.000 0.0 0.008 0.000 0.988 0.004
#> GSM862482 5 0.1531 0.700 0.000 0.0 0.068 0.000 0.928 0.004
#> GSM862483 2 0.0000 0.768 0.000 1.0 0.000 0.000 0.000 0.000
#> GSM862484 5 0.0458 0.794 0.000 0.0 0.016 0.000 0.984 0.000
#> GSM862485 3 0.3823 0.912 0.000 0.0 0.564 0.000 0.436 0.000
#> GSM862486 5 0.1010 0.763 0.000 0.0 0.036 0.000 0.960 0.004
#> GSM862487 3 0.3851 0.941 0.000 0.0 0.540 0.000 0.460 0.000
#> GSM862488 3 0.3847 0.944 0.000 0.0 0.544 0.000 0.456 0.000
#> GSM862489 5 0.0000 0.804 0.000 0.0 0.000 0.000 1.000 0.000
#> GSM862490 5 0.0146 0.804 0.000 0.0 0.000 0.000 0.996 0.004
#> GSM862491 3 0.3866 0.913 0.000 0.0 0.516 0.000 0.484 0.000
#> GSM862492 3 0.3851 0.941 0.000 0.0 0.540 0.000 0.460 0.000
#> GSM862493 5 0.0146 0.804 0.000 0.0 0.000 0.000 0.996 0.004
#> GSM862494 3 0.3847 0.944 0.000 0.0 0.544 0.000 0.456 0.000
#> GSM862495 5 0.3890 0.489 0.000 0.0 0.004 0.000 0.596 0.400
#> GSM862496 5 0.2902 0.690 0.000 0.0 0.004 0.000 0.800 0.196
#> GSM862497 5 0.2902 0.690 0.000 0.0 0.004 0.000 0.800 0.196
#> GSM862498 5 0.0146 0.802 0.000 0.0 0.004 0.000 0.996 0.000
#> GSM862499 3 0.3847 0.944 0.000 0.0 0.544 0.000 0.456 0.000
#> GSM862500 3 0.3847 0.944 0.000 0.0 0.544 0.000 0.456 0.000
#> GSM862501 5 0.3890 0.489 0.000 0.0 0.004 0.000 0.596 0.400
#> GSM862502 5 0.3890 0.489 0.000 0.0 0.004 0.000 0.596 0.400
#> GSM862503 5 0.0000 0.804 0.000 0.0 0.000 0.000 1.000 0.000
#> GSM862504 5 0.0458 0.794 0.000 0.0 0.016 0.000 0.984 0.000
#> GSM862505 5 0.3890 0.489 0.000 0.0 0.004 0.000 0.596 0.400
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 tissue(p) k
#> SD:hclust 64 4.53e-13 2
#> SD:hclust 64 2.59e-13 3
#> SD:hclust 64 1.60e-12 4
#> SD:hclust 64 7.78e-12 5
#> SD:hclust 60 1.88e-10 6
If matrix rows can be associated to genes, consider to use functional_enrichment(res,
...)
to perform function enrichment for the signature genes. See this vignette for more detailed explanations.
The object with results only for a single top-value method and a single partition method can be extracted as:
res = res_list["SD", "kmeans"]
# you can also extract it by
# res = res_list["SD:kmeans"]
A summary of res
and all the functions that can be applied to it:
res
#> A 'ConsensusPartition' object with k = 2, 3, 4, 5, 6.
#> On a matrix with 51941 rows and 64 columns.
#> Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'SD' method.
#> Subgroups are detected by 'kmeans' method.
#> Performed in total 1250 partitions by row resampling.
#> Best k for subgroups seems to be 2.
#>
#> Following methods can be applied to this 'ConsensusPartition' object:
#> [1] "cola_report" "collect_classes" "collect_plots"
#> [4] "collect_stats" "colnames" "compare_signatures"
#> [7] "consensus_heatmap" "dimension_reduction" "functional_enrichment"
#> [10] "get_anno_col" "get_anno" "get_classes"
#> [13] "get_consensus" "get_matrix" "get_membership"
#> [16] "get_param" "get_signatures" "get_stats"
#> [19] "is_best_k" "is_stable_k" "membership_heatmap"
#> [22] "ncol" "nrow" "plot_ecdf"
#> [25] "rownames" "select_partition_number" "show"
#> [28] "suggest_best_k" "test_to_known_factors"
collect_plots()
function collects all the plots made from res
for all k
(number of partitions)
into one single page to provide an easy and fast comparison between different k
.
collect_plots(res)
The plots are:
k
and the heatmap of
predicted classes for each k
.k
.k
.k
.All the plots in panels can be made by individual functions and they are plotted later in this section.
select_partition_number()
produces several plots showing different
statistics for choosing “optimized” k
. There are following statistics:
k
;k
, the area increased is defined as \(A_k - A_{k-1}\).The detailed explanations of these statistics can be found in the cola vignette.
Generally speaking, lower PAC score, higher mean silhouette score or higher
concordance corresponds to better partition. Rand index and Jaccard index
measure how similar the current partition is compared to partition with k-1
.
If they are too similar, we won't accept k
is better than k-1
.
select_partition_number(res)
The numeric values for all these statistics can be obtained by get_stats()
.
get_stats(res)
#> k 1-PAC mean_silhouette concordance area_increased Rand Jaccard
#> 2 2 1.000 1.000 1.000 0.4906 0.510 0.510
#> 3 3 0.723 0.776 0.740 0.2618 0.821 0.649
#> 4 4 0.611 0.837 0.792 0.1279 0.842 0.583
#> 5 5 0.657 0.768 0.767 0.0807 1.000 1.000
#> 6 6 0.673 0.717 0.735 0.0565 0.974 0.904
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
#> GSM862441 1 0 1 1 0
#> GSM862442 1 0 1 1 0
#> GSM862443 1 0 1 1 0
#> GSM862444 1 0 1 1 0
#> GSM862445 1 0 1 1 0
#> GSM862446 1 0 1 1 0
#> GSM862447 1 0 1 1 0
#> GSM862448 1 0 1 1 0
#> GSM862449 1 0 1 1 0
#> GSM862450 1 0 1 1 0
#> GSM862451 1 0 1 1 0
#> GSM862453 1 0 1 1 0
#> GSM862454 1 0 1 1 0
#> GSM862455 1 0 1 1 0
#> GSM862456 1 0 1 1 0
#> GSM862457 1 0 1 1 0
#> GSM862458 2 0 1 0 1
#> GSM862459 1 0 1 1 0
#> GSM862460 1 0 1 1 0
#> GSM862461 1 0 1 1 0
#> GSM862462 1 0 1 1 0
#> GSM862463 1 0 1 1 0
#> GSM862464 1 0 1 1 0
#> GSM862465 1 0 1 1 0
#> GSM862466 1 0 1 1 0
#> GSM862467 1 0 1 1 0
#> GSM862468 1 0 1 1 0
#> GSM862469 2 0 1 0 1
#> GSM862470 2 0 1 0 1
#> GSM862471 2 0 1 0 1
#> GSM862472 2 0 1 0 1
#> GSM862473 2 0 1 0 1
#> GSM862474 2 0 1 0 1
#> GSM862475 2 0 1 0 1
#> GSM862476 2 0 1 0 1
#> GSM862477 2 0 1 0 1
#> GSM862478 2 0 1 0 1
#> GSM862479 2 0 1 0 1
#> GSM862480 2 0 1 0 1
#> GSM862481 2 0 1 0 1
#> GSM862482 2 0 1 0 1
#> GSM862483 2 0 1 0 1
#> GSM862484 2 0 1 0 1
#> GSM862485 2 0 1 0 1
#> GSM862486 2 0 1 0 1
#> GSM862487 2 0 1 0 1
#> GSM862488 2 0 1 0 1
#> GSM862489 2 0 1 0 1
#> GSM862490 2 0 1 0 1
#> GSM862491 2 0 1 0 1
#> GSM862492 2 0 1 0 1
#> GSM862493 2 0 1 0 1
#> GSM862494 2 0 1 0 1
#> GSM862495 2 0 1 0 1
#> GSM862496 2 0 1 0 1
#> GSM862497 2 0 1 0 1
#> GSM862498 2 0 1 0 1
#> GSM862499 2 0 1 0 1
#> GSM862500 2 0 1 0 1
#> GSM862501 2 0 1 0 1
#> GSM862502 2 0 1 0 1
#> GSM862503 2 0 1 0 1
#> GSM862504 2 0 1 0 1
#> GSM862505 2 0 1 0 1
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> GSM862441 1 0.5733 0.89346 0.676 0.324 0.000
#> GSM862442 1 0.0424 0.82765 0.992 0.008 0.000
#> GSM862443 1 0.5216 0.89003 0.740 0.260 0.000
#> GSM862444 1 0.5785 0.89257 0.668 0.332 0.000
#> GSM862445 1 0.5926 0.88436 0.644 0.356 0.000
#> GSM862446 1 0.0747 0.82700 0.984 0.016 0.000
#> GSM862447 1 0.0747 0.82700 0.984 0.016 0.000
#> GSM862448 1 0.0000 0.82801 1.000 0.000 0.000
#> GSM862449 1 0.2066 0.81093 0.940 0.060 0.000
#> GSM862450 1 0.5706 0.89383 0.680 0.320 0.000
#> GSM862451 1 0.5926 0.88692 0.644 0.356 0.000
#> GSM862453 1 0.0424 0.82765 0.992 0.008 0.000
#> GSM862454 1 0.5882 0.88783 0.652 0.348 0.000
#> GSM862455 1 0.5882 0.88783 0.652 0.348 0.000
#> GSM862456 1 0.5882 0.88783 0.652 0.348 0.000
#> GSM862457 1 0.5706 0.89383 0.680 0.320 0.000
#> GSM862458 3 0.1289 0.75512 0.000 0.032 0.968
#> GSM862459 1 0.5882 0.88774 0.652 0.348 0.000
#> GSM862460 1 0.0424 0.82765 0.992 0.008 0.000
#> GSM862461 1 0.5678 0.89397 0.684 0.316 0.000
#> GSM862462 1 0.5706 0.89383 0.680 0.320 0.000
#> GSM862463 1 0.5882 0.88783 0.652 0.348 0.000
#> GSM862464 1 0.5216 0.89003 0.740 0.260 0.000
#> GSM862465 1 0.5882 0.88783 0.652 0.348 0.000
#> GSM862466 1 0.0000 0.82801 1.000 0.000 0.000
#> GSM862467 1 0.0424 0.82765 0.992 0.008 0.000
#> GSM862468 1 0.5706 0.89383 0.680 0.320 0.000
#> GSM862469 3 0.0000 0.79526 0.000 0.000 1.000
#> GSM862470 2 0.6267 0.95420 0.000 0.548 0.452
#> GSM862471 3 0.0237 0.79326 0.000 0.004 0.996
#> GSM862472 3 0.0424 0.78978 0.000 0.008 0.992
#> GSM862473 3 0.5497 0.00515 0.000 0.292 0.708
#> GSM862474 2 0.6225 0.94925 0.000 0.568 0.432
#> GSM862475 2 0.6274 0.95256 0.000 0.544 0.456
#> GSM862476 2 0.6225 0.94925 0.000 0.568 0.432
#> GSM862477 2 0.6235 0.94981 0.000 0.564 0.436
#> GSM862478 3 0.0237 0.79494 0.000 0.004 0.996
#> GSM862479 3 0.0000 0.79526 0.000 0.000 1.000
#> GSM862480 3 0.6225 -0.62602 0.000 0.432 0.568
#> GSM862481 3 0.5497 0.00515 0.000 0.292 0.708
#> GSM862482 2 0.6235 0.94981 0.000 0.564 0.436
#> GSM862483 2 0.6095 0.87102 0.000 0.608 0.392
#> GSM862484 2 0.6235 0.94981 0.000 0.564 0.436
#> GSM862485 3 0.0000 0.79526 0.000 0.000 1.000
#> GSM862486 2 0.6286 0.94931 0.000 0.536 0.464
#> GSM862487 3 0.0237 0.79494 0.000 0.004 0.996
#> GSM862488 3 0.0237 0.79494 0.000 0.004 0.996
#> GSM862489 2 0.6274 0.95117 0.000 0.544 0.456
#> GSM862490 2 0.6274 0.95256 0.000 0.544 0.456
#> GSM862491 3 0.0424 0.78978 0.000 0.008 0.992
#> GSM862492 3 0.0237 0.79494 0.000 0.004 0.996
#> GSM862493 2 0.6235 0.94981 0.000 0.564 0.436
#> GSM862494 3 0.0237 0.79494 0.000 0.004 0.996
#> GSM862495 2 0.6299 0.88743 0.000 0.524 0.476
#> GSM862496 3 0.6235 -0.62869 0.000 0.436 0.564
#> GSM862497 3 0.6225 -0.62602 0.000 0.432 0.568
#> GSM862498 2 0.6286 0.94931 0.000 0.536 0.464
#> GSM862499 3 0.0000 0.79526 0.000 0.000 1.000
#> GSM862500 3 0.0000 0.79526 0.000 0.000 1.000
#> GSM862501 2 0.6267 0.95212 0.000 0.548 0.452
#> GSM862502 2 0.6267 0.95212 0.000 0.548 0.452
#> GSM862503 2 0.6267 0.95212 0.000 0.548 0.452
#> GSM862504 2 0.6225 0.94925 0.000 0.568 0.432
#> GSM862505 2 0.6252 0.94643 0.000 0.556 0.444
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> GSM862441 4 0.0000 0.789 0.000 0.000 0.000 1.000
#> GSM862442 1 0.4907 0.933 0.580 0.000 0.000 0.420
#> GSM862443 4 0.2988 0.618 0.112 0.000 0.012 0.876
#> GSM862444 4 0.0336 0.788 0.008 0.000 0.000 0.992
#> GSM862445 4 0.1716 0.744 0.064 0.000 0.000 0.936
#> GSM862446 1 0.4989 0.917 0.528 0.000 0.000 0.472
#> GSM862447 1 0.4989 0.917 0.528 0.000 0.000 0.472
#> GSM862448 1 0.4967 0.933 0.548 0.000 0.000 0.452
#> GSM862449 1 0.6252 0.808 0.512 0.000 0.056 0.432
#> GSM862450 4 0.0469 0.785 0.012 0.000 0.000 0.988
#> GSM862451 4 0.4780 0.738 0.096 0.000 0.116 0.788
#> GSM862453 1 0.4907 0.933 0.580 0.000 0.000 0.420
#> GSM862454 4 0.5628 0.691 0.132 0.000 0.144 0.724
#> GSM862455 4 0.5578 0.695 0.128 0.000 0.144 0.728
#> GSM862456 4 0.5628 0.691 0.132 0.000 0.144 0.724
#> GSM862457 4 0.0469 0.785 0.012 0.000 0.000 0.988
#> GSM862458 3 0.6282 0.729 0.048 0.072 0.716 0.164
#> GSM862459 4 0.3082 0.779 0.084 0.000 0.032 0.884
#> GSM862460 1 0.4907 0.933 0.580 0.000 0.000 0.420
#> GSM862461 4 0.2313 0.786 0.044 0.000 0.032 0.924
#> GSM862462 4 0.0469 0.785 0.012 0.000 0.000 0.988
#> GSM862463 4 0.5628 0.691 0.132 0.000 0.144 0.724
#> GSM862464 4 0.2988 0.618 0.112 0.000 0.012 0.876
#> GSM862465 4 0.4552 0.738 0.128 0.000 0.072 0.800
#> GSM862466 1 0.4967 0.933 0.548 0.000 0.000 0.452
#> GSM862467 1 0.4907 0.933 0.580 0.000 0.000 0.420
#> GSM862468 4 0.0469 0.785 0.012 0.000 0.000 0.988
#> GSM862469 3 0.4538 0.962 0.024 0.216 0.760 0.000
#> GSM862470 2 0.2610 0.861 0.088 0.900 0.012 0.000
#> GSM862471 3 0.4436 0.962 0.020 0.216 0.764 0.000
#> GSM862472 3 0.4986 0.952 0.044 0.216 0.740 0.000
#> GSM862473 2 0.5500 0.588 0.068 0.708 0.224 0.000
#> GSM862474 2 0.2741 0.857 0.096 0.892 0.012 0.000
#> GSM862475 2 0.0524 0.864 0.008 0.988 0.004 0.000
#> GSM862476 2 0.2741 0.857 0.096 0.892 0.012 0.000
#> GSM862477 2 0.3428 0.841 0.144 0.844 0.012 0.000
#> GSM862478 3 0.3945 0.964 0.004 0.216 0.780 0.000
#> GSM862479 3 0.4538 0.962 0.024 0.216 0.760 0.000
#> GSM862480 2 0.4292 0.769 0.080 0.820 0.100 0.000
#> GSM862481 2 0.5500 0.588 0.068 0.708 0.224 0.000
#> GSM862482 2 0.2805 0.856 0.100 0.888 0.012 0.000
#> GSM862483 2 0.5662 0.719 0.236 0.692 0.072 0.000
#> GSM862484 2 0.2741 0.857 0.096 0.892 0.012 0.000
#> GSM862485 3 0.4538 0.962 0.024 0.216 0.760 0.000
#> GSM862486 2 0.2376 0.867 0.068 0.916 0.016 0.000
#> GSM862487 3 0.4212 0.960 0.012 0.216 0.772 0.000
#> GSM862488 3 0.3945 0.964 0.004 0.216 0.780 0.000
#> GSM862489 2 0.0779 0.863 0.016 0.980 0.004 0.000
#> GSM862490 2 0.1661 0.861 0.052 0.944 0.004 0.000
#> GSM862491 3 0.4818 0.955 0.036 0.216 0.748 0.000
#> GSM862492 3 0.4212 0.960 0.012 0.216 0.772 0.000
#> GSM862493 2 0.3105 0.851 0.120 0.868 0.012 0.000
#> GSM862494 3 0.3945 0.964 0.004 0.216 0.780 0.000
#> GSM862495 2 0.3521 0.812 0.084 0.864 0.052 0.000
#> GSM862496 2 0.4359 0.766 0.084 0.816 0.100 0.000
#> GSM862497 2 0.4292 0.769 0.080 0.820 0.100 0.000
#> GSM862498 2 0.1706 0.869 0.036 0.948 0.016 0.000
#> GSM862499 3 0.3945 0.964 0.004 0.216 0.780 0.000
#> GSM862500 3 0.3945 0.964 0.004 0.216 0.780 0.000
#> GSM862501 2 0.2675 0.848 0.100 0.892 0.008 0.000
#> GSM862502 2 0.2737 0.847 0.104 0.888 0.008 0.000
#> GSM862503 2 0.0657 0.867 0.012 0.984 0.004 0.000
#> GSM862504 2 0.2805 0.857 0.100 0.888 0.012 0.000
#> GSM862505 2 0.2610 0.838 0.088 0.900 0.012 0.000
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> GSM862441 4 0.425 0.767 0.332 0.000 0.004 0.660 NA
#> GSM862442 1 0.000 0.942 1.000 0.000 0.000 0.000 NA
#> GSM862443 4 0.523 0.597 0.472 0.000 0.028 0.492 NA
#> GSM862444 4 0.465 0.745 0.288 0.000 0.024 0.680 NA
#> GSM862445 4 0.499 0.597 0.188 0.032 0.020 0.740 NA
#> GSM862446 1 0.112 0.927 0.960 0.000 0.004 0.036 NA
#> GSM862447 1 0.165 0.924 0.944 0.000 0.012 0.036 NA
#> GSM862448 1 0.120 0.939 0.964 0.000 0.012 0.016 NA
#> GSM862449 1 0.472 0.757 0.780 0.000 0.044 0.088 NA
#> GSM862450 4 0.421 0.757 0.360 0.000 0.004 0.636 NA
#> GSM862451 4 0.657 0.702 0.328 0.000 0.000 0.452 NA
#> GSM862453 1 0.000 0.942 1.000 0.000 0.000 0.000 NA
#> GSM862454 4 0.670 0.671 0.352 0.000 0.000 0.404 NA
#> GSM862455 4 0.670 0.671 0.352 0.000 0.000 0.404 NA
#> GSM862456 4 0.670 0.671 0.352 0.000 0.000 0.404 NA
#> GSM862457 4 0.406 0.757 0.360 0.000 0.000 0.640 NA
#> GSM862458 3 0.591 0.595 0.000 0.008 0.576 0.316 NA
#> GSM862459 4 0.527 0.767 0.320 0.000 0.000 0.612 NA
#> GSM862460 1 0.000 0.942 1.000 0.000 0.000 0.000 NA
#> GSM862461 4 0.561 0.767 0.356 0.000 0.028 0.580 NA
#> GSM862462 4 0.421 0.756 0.360 0.000 0.000 0.636 NA
#> GSM862463 4 0.670 0.671 0.352 0.000 0.000 0.404 NA
#> GSM862464 4 0.523 0.597 0.472 0.000 0.028 0.492 NA
#> GSM862465 4 0.636 0.722 0.336 0.000 0.016 0.528 NA
#> GSM862466 1 0.109 0.940 0.968 0.000 0.008 0.016 NA
#> GSM862467 1 0.000 0.942 1.000 0.000 0.000 0.000 NA
#> GSM862468 4 0.406 0.757 0.360 0.000 0.000 0.640 NA
#> GSM862469 3 0.391 0.901 0.000 0.080 0.832 0.044 NA
#> GSM862470 2 0.320 0.763 0.000 0.848 0.020 0.008 NA
#> GSM862471 3 0.426 0.896 0.000 0.080 0.812 0.048 NA
#> GSM862472 3 0.559 0.859 0.000 0.080 0.720 0.096 NA
#> GSM862473 2 0.677 0.439 0.000 0.496 0.268 0.012 NA
#> GSM862474 2 0.371 0.745 0.000 0.832 0.012 0.100 NA
#> GSM862475 2 0.233 0.776 0.000 0.900 0.020 0.000 NA
#> GSM862476 2 0.371 0.745 0.000 0.832 0.012 0.100 NA
#> GSM862477 2 0.286 0.760 0.000 0.872 0.012 0.012 NA
#> GSM862478 3 0.249 0.904 0.000 0.080 0.896 0.004 NA
#> GSM862479 3 0.391 0.901 0.000 0.080 0.832 0.044 NA
#> GSM862480 2 0.581 0.618 0.000 0.584 0.128 0.000 NA
#> GSM862481 2 0.677 0.439 0.000 0.496 0.268 0.012 NA
#> GSM862482 2 0.395 0.742 0.000 0.820 0.016 0.100 NA
#> GSM862483 2 0.602 0.611 0.000 0.600 0.024 0.088 NA
#> GSM862484 2 0.371 0.745 0.000 0.832 0.012 0.100 NA
#> GSM862485 3 0.445 0.896 0.000 0.080 0.800 0.048 NA
#> GSM862486 2 0.224 0.772 0.000 0.908 0.024 0.000 NA
#> GSM862487 3 0.377 0.888 0.000 0.080 0.836 0.020 NA
#> GSM862488 3 0.275 0.902 0.000 0.080 0.884 0.004 NA
#> GSM862489 2 0.230 0.777 0.000 0.904 0.024 0.000 NA
#> GSM862490 2 0.317 0.770 0.000 0.840 0.016 0.004 NA
#> GSM862491 3 0.533 0.869 0.000 0.076 0.740 0.096 NA
#> GSM862492 3 0.370 0.889 0.000 0.080 0.840 0.020 NA
#> GSM862493 2 0.263 0.764 0.000 0.892 0.012 0.016 NA
#> GSM862494 3 0.275 0.902 0.000 0.080 0.884 0.004 NA
#> GSM862495 2 0.545 0.650 0.000 0.588 0.064 0.004 NA
#> GSM862496 2 0.592 0.594 0.000 0.552 0.124 0.000 NA
#> GSM862497 2 0.581 0.618 0.000 0.584 0.128 0.000 NA
#> GSM862498 2 0.174 0.778 0.000 0.936 0.024 0.000 NA
#> GSM862499 3 0.202 0.907 0.000 0.080 0.912 0.000 NA
#> GSM862500 3 0.202 0.907 0.000 0.080 0.912 0.000 NA
#> GSM862501 2 0.496 0.707 0.000 0.648 0.012 0.028 NA
#> GSM862502 2 0.511 0.699 0.000 0.632 0.008 0.040 NA
#> GSM862503 2 0.236 0.778 0.000 0.892 0.012 0.000 NA
#> GSM862504 2 0.371 0.745 0.000 0.832 0.012 0.100 NA
#> GSM862505 2 0.518 0.678 0.000 0.616 0.024 0.020 NA
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> GSM862441 4 0.026 0.719 0.008 0.000 0.000 0.992 NA 0.000
#> GSM862442 1 0.244 0.931 0.852 0.000 0.000 0.144 NA 0.000
#> GSM862443 4 0.363 0.590 0.136 0.000 0.008 0.808 NA 0.008
#> GSM862444 4 0.148 0.690 0.000 0.000 0.004 0.944 NA 0.020
#> GSM862445 4 0.393 0.560 0.056 0.008 0.008 0.824 NA 0.044
#> GSM862446 1 0.270 0.926 0.824 0.000 0.000 0.172 NA 0.004
#> GSM862447 1 0.369 0.919 0.784 0.000 0.000 0.172 NA 0.020
#> GSM862448 1 0.359 0.925 0.796 0.000 0.000 0.160 NA 0.020
#> GSM862449 1 0.626 0.643 0.580 0.000 0.000 0.132 NA 0.092
#> GSM862450 4 0.152 0.730 0.024 0.000 0.008 0.944 NA 0.000
#> GSM862451 4 0.416 -0.562 0.020 0.000 0.000 0.616 NA 0.364
#> GSM862453 1 0.244 0.931 0.852 0.000 0.000 0.144 NA 0.000
#> GSM862454 6 0.470 0.993 0.044 0.000 0.000 0.468 NA 0.488
#> GSM862455 6 0.491 0.980 0.040 0.000 0.004 0.472 NA 0.480
#> GSM862456 6 0.470 0.993 0.044 0.000 0.000 0.468 NA 0.488
#> GSM862457 4 0.135 0.730 0.024 0.000 0.008 0.952 NA 0.000
#> GSM862458 3 0.728 0.310 0.016 0.008 0.428 0.332 NA 0.140
#> GSM862459 4 0.236 0.568 0.012 0.000 0.000 0.872 NA 0.116
#> GSM862460 1 0.244 0.931 0.852 0.000 0.000 0.144 NA 0.000
#> GSM862461 4 0.286 0.640 0.024 0.000 0.008 0.880 NA 0.056
#> GSM862462 4 0.135 0.730 0.024 0.000 0.008 0.952 NA 0.000
#> GSM862463 6 0.470 0.993 0.044 0.000 0.000 0.468 NA 0.488
#> GSM862464 4 0.363 0.590 0.136 0.000 0.008 0.808 NA 0.008
#> GSM862465 4 0.485 -0.375 0.040 0.000 0.004 0.660 NA 0.272
#> GSM862466 1 0.337 0.927 0.804 0.000 0.000 0.164 NA 0.016
#> GSM862467 1 0.244 0.931 0.852 0.000 0.000 0.144 NA 0.000
#> GSM862468 4 0.160 0.728 0.024 0.000 0.008 0.944 NA 0.008
#> GSM862469 3 0.302 0.878 0.008 0.024 0.868 0.000 NA 0.072
#> GSM862470 2 0.245 0.723 0.000 0.864 0.000 0.000 NA 0.012
#> GSM862471 3 0.336 0.872 0.008 0.020 0.836 0.000 NA 0.112
#> GSM862472 3 0.471 0.839 0.008 0.024 0.752 0.008 NA 0.132
#> GSM862473 2 0.640 0.472 0.000 0.420 0.232 0.000 NA 0.020
#> GSM862474 2 0.462 0.691 0.052 0.740 0.000 0.000 NA 0.060
#> GSM862475 2 0.312 0.741 0.004 0.804 0.012 0.000 NA 0.000
#> GSM862476 2 0.462 0.691 0.052 0.740 0.000 0.000 NA 0.060
#> GSM862477 2 0.269 0.698 0.000 0.840 0.000 0.000 NA 0.012
#> GSM862478 3 0.151 0.884 0.004 0.020 0.948 0.000 NA 0.012
#> GSM862479 3 0.302 0.878 0.008 0.024 0.868 0.000 NA 0.072
#> GSM862480 2 0.530 0.621 0.000 0.492 0.104 0.000 NA 0.000
#> GSM862481 2 0.640 0.472 0.000 0.420 0.232 0.000 NA 0.020
#> GSM862482 2 0.455 0.687 0.056 0.748 0.000 0.000 NA 0.056
#> GSM862483 2 0.672 0.397 0.056 0.432 0.000 0.000 NA 0.188
#> GSM862484 2 0.441 0.690 0.052 0.760 0.000 0.000 NA 0.056
#> GSM862485 3 0.366 0.870 0.012 0.024 0.820 0.000 NA 0.116
#> GSM862486 2 0.171 0.738 0.004 0.928 0.012 0.000 NA 0.000
#> GSM862487 3 0.271 0.869 0.000 0.020 0.880 0.000 NA 0.036
#> GSM862488 3 0.237 0.880 0.008 0.020 0.908 0.000 NA 0.032
#> GSM862489 2 0.295 0.743 0.000 0.812 0.012 0.000 NA 0.000
#> GSM862490 2 0.329 0.733 0.004 0.796 0.012 0.000 NA 0.004
#> GSM862491 3 0.432 0.850 0.008 0.020 0.780 0.008 NA 0.128
#> GSM862492 3 0.271 0.869 0.000 0.020 0.880 0.000 NA 0.036
#> GSM862493 2 0.254 0.706 0.000 0.864 0.000 0.000 NA 0.020
#> GSM862494 3 0.237 0.880 0.008 0.020 0.908 0.000 NA 0.032
#> GSM862495 2 0.495 0.656 0.000 0.508 0.040 0.000 NA 0.012
#> GSM862496 2 0.532 0.608 0.000 0.468 0.104 0.000 NA 0.000
#> GSM862497 2 0.530 0.621 0.000 0.492 0.104 0.000 NA 0.000
#> GSM862498 2 0.183 0.744 0.004 0.920 0.012 0.000 NA 0.000
#> GSM862499 3 0.115 0.887 0.016 0.020 0.960 0.000 NA 0.004
#> GSM862500 3 0.115 0.887 0.016 0.020 0.960 0.000 NA 0.004
#> GSM862501 2 0.566 0.662 0.008 0.576 0.012 0.000 NA 0.112
#> GSM862502 2 0.567 0.661 0.008 0.572 0.012 0.000 NA 0.112
#> GSM862503 2 0.236 0.746 0.000 0.872 0.012 0.000 NA 0.000
#> GSM862504 2 0.462 0.691 0.052 0.740 0.000 0.000 NA 0.060
#> GSM862505 2 0.509 0.670 0.004 0.528 0.020 0.000 NA 0.032
Heatmaps for the consensus matrix. It visualizes the probability of two samples to be in a same group.
consensus_heatmap(res, k = 2)
consensus_heatmap(res, k = 3)
consensus_heatmap(res, k = 4)
consensus_heatmap(res, k = 5)
consensus_heatmap(res, k = 6)
Heatmaps for the membership of samples in all partitions to see how consistent they are:
membership_heatmap(res, k = 2)
membership_heatmap(res, k = 3)
membership_heatmap(res, k = 4)
membership_heatmap(res, k = 5)
membership_heatmap(res, k = 6)
As soon as we have had the classes for columns, we can look for signatures which are significantly different between classes which can be candidate marks for certain classes. Following are the heatmaps for signatures.
Signature heatmaps where rows are scaled:
get_signatures(res, k = 2)
get_signatures(res, k = 3)
get_signatures(res, k = 4)
get_signatures(res, k = 5)
get_signatures(res, k = 6)
Signature heatmaps where rows are not scaled:
get_signatures(res, k = 2, scale_rows = FALSE)
get_signatures(res, k = 3, scale_rows = FALSE)
get_signatures(res, k = 4, scale_rows = FALSE)
get_signatures(res, k = 5, scale_rows = FALSE)
get_signatures(res, k = 6, scale_rows = FALSE)
Compare the overlap of signatures from different k:
compare_signatures(res)
get_signature()
returns a data frame invisibly. TO get the list of signatures, the function
call should be assigned to a variable explicitly. In following code, if plot
argument is set
to FALSE
, no heatmap is plotted while only the differential analysis is performed.
# code only for demonstration
tb = get_signature(res, k = ..., plot = FALSE)
An example of the output of tb
is:
#> which_row fdr mean_1 mean_2 scaled_mean_1 scaled_mean_2 km
#> 1 38 0.042760348 8.373488 9.131774 -0.5533452 0.5164555 1
#> 2 40 0.018707592 7.106213 8.469186 -0.6173731 0.5762149 1
#> 3 55 0.019134737 10.221463 11.207825 -0.6159697 0.5749050 1
#> 4 59 0.006059896 5.921854 7.869574 -0.6899429 0.6439467 1
#> 5 60 0.018055526 8.928898 10.211722 -0.6204761 0.5791110 1
#> 6 98 0.009384629 15.714769 14.887706 0.6635654 -0.6193277 2
...
The columns in tb
are:
which_row
: row indices corresponding to the input matrix.fdr
: FDR for the differential test. mean_x
: The mean value in group x.scaled_mean_x
: The mean value in group x after rows are scaled.km
: Row groups if k-means clustering is applied to rows.UMAP plot which shows how samples are separated.
dimension_reduction(res, k = 2, method = "UMAP")
dimension_reduction(res, k = 3, method = "UMAP")
dimension_reduction(res, k = 4, method = "UMAP")
dimension_reduction(res, k = 5, method = "UMAP")
dimension_reduction(res, k = 6, method = "UMAP")
Following heatmap shows how subgroups are split when increasing k
:
collect_classes(res)
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 tissue(p) k
#> SD:kmeans 64 6.95e-14 2
#> SD:kmeans 59 1.00e-12 3
#> SD:kmeans 64 5.35e-13 4
#> SD:kmeans 62 1.41e-12 5
#> SD:kmeans 58 7.63e-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", "skmeans"]
# you can also extract it by
# res = res_list["SD:skmeans"]
A summary of res
and all the functions that can be applied to it:
res
#> A 'ConsensusPartition' object with k = 2, 3, 4, 5, 6.
#> On a matrix with 51941 rows and 64 columns.
#> Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'SD' method.
#> Subgroups are detected by 'skmeans' method.
#> Performed in total 1250 partitions by row resampling.
#> Best k for subgroups seems to be 2.
#>
#> Following methods can be applied to this 'ConsensusPartition' object:
#> [1] "cola_report" "collect_classes" "collect_plots"
#> [4] "collect_stats" "colnames" "compare_signatures"
#> [7] "consensus_heatmap" "dimension_reduction" "functional_enrichment"
#> [10] "get_anno_col" "get_anno" "get_classes"
#> [13] "get_consensus" "get_matrix" "get_membership"
#> [16] "get_param" "get_signatures" "get_stats"
#> [19] "is_best_k" "is_stable_k" "membership_heatmap"
#> [22] "ncol" "nrow" "plot_ecdf"
#> [25] "rownames" "select_partition_number" "show"
#> [28] "suggest_best_k" "test_to_known_factors"
collect_plots()
function collects all the plots made from res
for all k
(number of partitions)
into one single page to provide an easy and fast comparison between different k
.
collect_plots(res)
The plots are:
k
and the heatmap of
predicted classes for each k
.k
.k
.k
.All the plots in panels can be made by individual functions and they are plotted later in this section.
select_partition_number()
produces several plots showing different
statistics for choosing “optimized” k
. There are following statistics:
k
;k
, the area increased is defined as \(A_k - A_{k-1}\).The detailed explanations of these statistics can be found in the cola vignette.
Generally speaking, lower PAC score, higher mean silhouette score or higher
concordance corresponds to better partition. Rand index and Jaccard index
measure how similar the current partition is compared to partition with k-1
.
If they are too similar, we won't accept k
is better than k-1
.
select_partition_number(res)
The numeric values for all these statistics can be obtained by get_stats()
.
get_stats(res)
#> k 1-PAC mean_silhouette concordance area_increased Rand Jaccard
#> 2 2 1.000 0.982 0.993 0.4929 0.510 0.510
#> 3 3 0.756 0.957 0.928 0.3068 0.833 0.673
#> 4 4 0.854 0.947 0.922 0.1436 0.918 0.762
#> 5 5 0.835 0.877 0.877 0.0708 0.941 0.774
#> 6 6 0.798 0.773 0.850 0.0392 0.994 0.968
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
#> GSM862441 1 0.000 1.000 1.00 0.00
#> GSM862442 1 0.000 1.000 1.00 0.00
#> GSM862443 1 0.000 1.000 1.00 0.00
#> GSM862444 1 0.000 1.000 1.00 0.00
#> GSM862445 1 0.000 1.000 1.00 0.00
#> GSM862446 1 0.000 1.000 1.00 0.00
#> GSM862447 1 0.000 1.000 1.00 0.00
#> GSM862448 1 0.000 1.000 1.00 0.00
#> GSM862449 1 0.000 1.000 1.00 0.00
#> GSM862450 1 0.000 1.000 1.00 0.00
#> GSM862451 1 0.000 1.000 1.00 0.00
#> GSM862453 1 0.000 1.000 1.00 0.00
#> GSM862454 1 0.000 1.000 1.00 0.00
#> GSM862455 1 0.000 1.000 1.00 0.00
#> GSM862456 1 0.000 1.000 1.00 0.00
#> GSM862457 1 0.000 1.000 1.00 0.00
#> GSM862458 2 0.981 0.276 0.42 0.58
#> GSM862459 1 0.000 1.000 1.00 0.00
#> GSM862460 1 0.000 1.000 1.00 0.00
#> GSM862461 1 0.000 1.000 1.00 0.00
#> GSM862462 1 0.000 1.000 1.00 0.00
#> GSM862463 1 0.000 1.000 1.00 0.00
#> GSM862464 1 0.000 1.000 1.00 0.00
#> GSM862465 1 0.000 1.000 1.00 0.00
#> GSM862466 1 0.000 1.000 1.00 0.00
#> GSM862467 1 0.000 1.000 1.00 0.00
#> GSM862468 1 0.000 1.000 1.00 0.00
#> GSM862469 2 0.000 0.989 0.00 1.00
#> GSM862470 2 0.000 0.989 0.00 1.00
#> GSM862471 2 0.000 0.989 0.00 1.00
#> GSM862472 2 0.000 0.989 0.00 1.00
#> GSM862473 2 0.000 0.989 0.00 1.00
#> GSM862474 2 0.000 0.989 0.00 1.00
#> GSM862475 2 0.000 0.989 0.00 1.00
#> GSM862476 2 0.000 0.989 0.00 1.00
#> GSM862477 2 0.000 0.989 0.00 1.00
#> GSM862478 2 0.000 0.989 0.00 1.00
#> GSM862479 2 0.000 0.989 0.00 1.00
#> GSM862480 2 0.000 0.989 0.00 1.00
#> GSM862481 2 0.000 0.989 0.00 1.00
#> GSM862482 2 0.000 0.989 0.00 1.00
#> GSM862483 2 0.000 0.989 0.00 1.00
#> GSM862484 2 0.000 0.989 0.00 1.00
#> GSM862485 2 0.000 0.989 0.00 1.00
#> GSM862486 2 0.000 0.989 0.00 1.00
#> GSM862487 2 0.000 0.989 0.00 1.00
#> GSM862488 2 0.000 0.989 0.00 1.00
#> GSM862489 2 0.000 0.989 0.00 1.00
#> GSM862490 2 0.000 0.989 0.00 1.00
#> GSM862491 2 0.000 0.989 0.00 1.00
#> GSM862492 2 0.000 0.989 0.00 1.00
#> GSM862493 2 0.000 0.989 0.00 1.00
#> GSM862494 2 0.000 0.989 0.00 1.00
#> GSM862495 2 0.000 0.989 0.00 1.00
#> GSM862496 2 0.000 0.989 0.00 1.00
#> GSM862497 2 0.000 0.989 0.00 1.00
#> GSM862498 2 0.000 0.989 0.00 1.00
#> GSM862499 2 0.000 0.989 0.00 1.00
#> GSM862500 2 0.000 0.989 0.00 1.00
#> GSM862501 2 0.000 0.989 0.00 1.00
#> GSM862502 2 0.000 0.989 0.00 1.00
#> GSM862503 2 0.000 0.989 0.00 1.00
#> GSM862504 2 0.000 0.989 0.00 1.00
#> GSM862505 2 0.000 0.989 0.00 1.00
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> GSM862441 1 0.4291 0.931 0.82 0.000 0.180
#> GSM862442 1 0.0000 0.905 1.00 0.000 0.000
#> GSM862443 1 0.0000 0.905 1.00 0.000 0.000
#> GSM862444 1 0.4291 0.931 0.82 0.000 0.180
#> GSM862445 1 0.4291 0.931 0.82 0.000 0.180
#> GSM862446 1 0.0000 0.905 1.00 0.000 0.000
#> GSM862447 1 0.0000 0.905 1.00 0.000 0.000
#> GSM862448 1 0.0000 0.905 1.00 0.000 0.000
#> GSM862449 1 0.0000 0.905 1.00 0.000 0.000
#> GSM862450 1 0.4291 0.931 0.82 0.000 0.180
#> GSM862451 1 0.4291 0.931 0.82 0.000 0.180
#> GSM862453 1 0.0000 0.905 1.00 0.000 0.000
#> GSM862454 1 0.4291 0.931 0.82 0.000 0.180
#> GSM862455 1 0.4291 0.931 0.82 0.000 0.180
#> GSM862456 1 0.4291 0.931 0.82 0.000 0.180
#> GSM862457 1 0.4291 0.931 0.82 0.000 0.180
#> GSM862458 3 0.0000 0.747 0.00 0.000 1.000
#> GSM862459 1 0.4291 0.931 0.82 0.000 0.180
#> GSM862460 1 0.0000 0.905 1.00 0.000 0.000
#> GSM862461 1 0.4291 0.931 0.82 0.000 0.180
#> GSM862462 1 0.4291 0.931 0.82 0.000 0.180
#> GSM862463 1 0.4291 0.931 0.82 0.000 0.180
#> GSM862464 1 0.0000 0.905 1.00 0.000 0.000
#> GSM862465 1 0.4291 0.931 0.82 0.000 0.180
#> GSM862466 1 0.0000 0.905 1.00 0.000 0.000
#> GSM862467 1 0.0000 0.905 1.00 0.000 0.000
#> GSM862468 1 0.4291 0.931 0.82 0.000 0.180
#> GSM862469 3 0.4291 0.980 0.00 0.180 0.820
#> GSM862470 2 0.0000 0.995 0.00 1.000 0.000
#> GSM862471 3 0.4291 0.980 0.00 0.180 0.820
#> GSM862472 3 0.4291 0.980 0.00 0.180 0.820
#> GSM862473 2 0.1289 0.964 0.00 0.968 0.032
#> GSM862474 2 0.0000 0.995 0.00 1.000 0.000
#> GSM862475 2 0.0000 0.995 0.00 1.000 0.000
#> GSM862476 2 0.0000 0.995 0.00 1.000 0.000
#> GSM862477 2 0.0000 0.995 0.00 1.000 0.000
#> GSM862478 3 0.4291 0.980 0.00 0.180 0.820
#> GSM862479 3 0.4291 0.980 0.00 0.180 0.820
#> GSM862480 2 0.0424 0.989 0.00 0.992 0.008
#> GSM862481 2 0.1289 0.964 0.00 0.968 0.032
#> GSM862482 2 0.0000 0.995 0.00 1.000 0.000
#> GSM862483 2 0.0000 0.995 0.00 1.000 0.000
#> GSM862484 2 0.0000 0.995 0.00 1.000 0.000
#> GSM862485 3 0.4291 0.980 0.00 0.180 0.820
#> GSM862486 2 0.0000 0.995 0.00 1.000 0.000
#> GSM862487 3 0.4291 0.980 0.00 0.180 0.820
#> GSM862488 3 0.4291 0.980 0.00 0.180 0.820
#> GSM862489 2 0.0000 0.995 0.00 1.000 0.000
#> GSM862490 2 0.0000 0.995 0.00 1.000 0.000
#> GSM862491 3 0.4291 0.980 0.00 0.180 0.820
#> GSM862492 3 0.4291 0.980 0.00 0.180 0.820
#> GSM862493 2 0.0000 0.995 0.00 1.000 0.000
#> GSM862494 3 0.4291 0.980 0.00 0.180 0.820
#> GSM862495 2 0.0000 0.995 0.00 1.000 0.000
#> GSM862496 2 0.0424 0.989 0.00 0.992 0.008
#> GSM862497 2 0.0424 0.989 0.00 0.992 0.008
#> GSM862498 2 0.0000 0.995 0.00 1.000 0.000
#> GSM862499 3 0.4291 0.980 0.00 0.180 0.820
#> GSM862500 3 0.4291 0.980 0.00 0.180 0.820
#> GSM862501 2 0.0000 0.995 0.00 1.000 0.000
#> GSM862502 2 0.0000 0.995 0.00 1.000 0.000
#> GSM862503 2 0.0000 0.995 0.00 1.000 0.000
#> GSM862504 2 0.0000 0.995 0.00 1.000 0.000
#> GSM862505 2 0.0000 0.995 0.00 1.000 0.000
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> GSM862441 4 0.3764 0.991 0.216 0.000 0.000 0.784
#> GSM862442 1 0.0000 0.996 1.000 0.000 0.000 0.000
#> GSM862443 1 0.0336 0.990 0.992 0.000 0.000 0.008
#> GSM862444 4 0.3688 0.987 0.208 0.000 0.000 0.792
#> GSM862445 4 0.3444 0.962 0.184 0.000 0.000 0.816
#> GSM862446 1 0.0000 0.996 1.000 0.000 0.000 0.000
#> GSM862447 1 0.0000 0.996 1.000 0.000 0.000 0.000
#> GSM862448 1 0.0000 0.996 1.000 0.000 0.000 0.000
#> GSM862449 1 0.0469 0.985 0.988 0.000 0.000 0.012
#> GSM862450 4 0.3942 0.969 0.236 0.000 0.000 0.764
#> GSM862451 4 0.3764 0.991 0.216 0.000 0.000 0.784
#> GSM862453 1 0.0000 0.996 1.000 0.000 0.000 0.000
#> GSM862454 4 0.3764 0.991 0.216 0.000 0.000 0.784
#> GSM862455 4 0.3764 0.991 0.216 0.000 0.000 0.784
#> GSM862456 4 0.3764 0.991 0.216 0.000 0.000 0.784
#> GSM862457 4 0.3764 0.984 0.216 0.000 0.000 0.784
#> GSM862458 3 0.3801 0.734 0.000 0.000 0.780 0.220
#> GSM862459 4 0.3764 0.991 0.216 0.000 0.000 0.784
#> GSM862460 1 0.0000 0.996 1.000 0.000 0.000 0.000
#> GSM862461 4 0.3764 0.991 0.216 0.000 0.000 0.784
#> GSM862462 4 0.3688 0.987 0.208 0.000 0.000 0.792
#> GSM862463 4 0.3764 0.991 0.216 0.000 0.000 0.784
#> GSM862464 1 0.0336 0.990 0.992 0.000 0.000 0.008
#> GSM862465 4 0.3688 0.987 0.208 0.000 0.000 0.792
#> GSM862466 1 0.0000 0.996 1.000 0.000 0.000 0.000
#> GSM862467 1 0.0000 0.996 1.000 0.000 0.000 0.000
#> GSM862468 4 0.3801 0.985 0.220 0.000 0.000 0.780
#> GSM862469 3 0.0188 0.980 0.000 0.000 0.996 0.004
#> GSM862470 2 0.1867 0.919 0.000 0.928 0.000 0.072
#> GSM862471 3 0.0188 0.980 0.000 0.000 0.996 0.004
#> GSM862472 3 0.0188 0.978 0.000 0.004 0.996 0.000
#> GSM862473 2 0.5747 0.720 0.000 0.704 0.196 0.100
#> GSM862474 2 0.1557 0.921 0.000 0.944 0.000 0.056
#> GSM862475 2 0.1022 0.919 0.000 0.968 0.000 0.032
#> GSM862476 2 0.1557 0.921 0.000 0.944 0.000 0.056
#> GSM862477 2 0.1940 0.918 0.000 0.924 0.000 0.076
#> GSM862478 3 0.0000 0.981 0.000 0.000 1.000 0.000
#> GSM862479 3 0.0188 0.980 0.000 0.000 0.996 0.004
#> GSM862480 2 0.4274 0.853 0.000 0.820 0.072 0.108
#> GSM862481 2 0.5672 0.731 0.000 0.712 0.188 0.100
#> GSM862482 2 0.1557 0.921 0.000 0.944 0.000 0.056
#> GSM862483 2 0.2149 0.915 0.000 0.912 0.000 0.088
#> GSM862484 2 0.1557 0.921 0.000 0.944 0.000 0.056
#> GSM862485 3 0.0188 0.980 0.000 0.000 0.996 0.004
#> GSM862486 2 0.1557 0.922 0.000 0.944 0.000 0.056
#> GSM862487 3 0.0000 0.981 0.000 0.000 1.000 0.000
#> GSM862488 3 0.0000 0.981 0.000 0.000 1.000 0.000
#> GSM862489 2 0.0188 0.922 0.000 0.996 0.000 0.004
#> GSM862490 2 0.1389 0.920 0.000 0.952 0.000 0.048
#> GSM862491 3 0.0000 0.981 0.000 0.000 1.000 0.000
#> GSM862492 3 0.0000 0.981 0.000 0.000 1.000 0.000
#> GSM862493 2 0.1867 0.919 0.000 0.928 0.000 0.072
#> GSM862494 3 0.0000 0.981 0.000 0.000 1.000 0.000
#> GSM862495 2 0.3108 0.887 0.000 0.872 0.016 0.112
#> GSM862496 2 0.4203 0.856 0.000 0.824 0.068 0.108
#> GSM862497 2 0.4274 0.853 0.000 0.820 0.072 0.108
#> GSM862498 2 0.1389 0.923 0.000 0.952 0.000 0.048
#> GSM862499 3 0.0000 0.981 0.000 0.000 1.000 0.000
#> GSM862500 3 0.0000 0.981 0.000 0.000 1.000 0.000
#> GSM862501 2 0.1637 0.918 0.000 0.940 0.000 0.060
#> GSM862502 2 0.2011 0.914 0.000 0.920 0.000 0.080
#> GSM862503 2 0.0921 0.922 0.000 0.972 0.000 0.028
#> GSM862504 2 0.1557 0.921 0.000 0.944 0.000 0.056
#> GSM862505 2 0.2859 0.890 0.000 0.880 0.008 0.112
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> GSM862441 4 0.0798 0.964 0.016 0.000 0.000 0.976 0.008
#> GSM862442 1 0.1478 0.987 0.936 0.000 0.000 0.064 0.000
#> GSM862443 1 0.2777 0.925 0.864 0.000 0.000 0.120 0.016
#> GSM862444 4 0.1281 0.955 0.012 0.000 0.000 0.956 0.032
#> GSM862445 4 0.2913 0.892 0.040 0.004 0.000 0.876 0.080
#> GSM862446 1 0.1478 0.987 0.936 0.000 0.000 0.064 0.000
#> GSM862447 1 0.1478 0.987 0.936 0.000 0.000 0.064 0.000
#> GSM862448 1 0.1478 0.987 0.936 0.000 0.000 0.064 0.000
#> GSM862449 1 0.1764 0.977 0.928 0.000 0.000 0.064 0.008
#> GSM862450 4 0.2592 0.918 0.052 0.000 0.000 0.892 0.056
#> GSM862451 4 0.0510 0.966 0.016 0.000 0.000 0.984 0.000
#> GSM862453 1 0.1478 0.987 0.936 0.000 0.000 0.064 0.000
#> GSM862454 4 0.0510 0.966 0.016 0.000 0.000 0.984 0.000
#> GSM862455 4 0.0510 0.966 0.016 0.000 0.000 0.984 0.000
#> GSM862456 4 0.0510 0.966 0.016 0.000 0.000 0.984 0.000
#> GSM862457 4 0.1965 0.938 0.024 0.000 0.000 0.924 0.052
#> GSM862458 3 0.6306 0.624 0.028 0.012 0.624 0.096 0.240
#> GSM862459 4 0.0510 0.966 0.016 0.000 0.000 0.984 0.000
#> GSM862460 1 0.1478 0.987 0.936 0.000 0.000 0.064 0.000
#> GSM862461 4 0.0807 0.964 0.012 0.000 0.000 0.976 0.012
#> GSM862462 4 0.1965 0.938 0.024 0.000 0.000 0.924 0.052
#> GSM862463 4 0.0510 0.966 0.016 0.000 0.000 0.984 0.000
#> GSM862464 1 0.2351 0.957 0.896 0.000 0.000 0.088 0.016
#> GSM862465 4 0.0510 0.966 0.016 0.000 0.000 0.984 0.000
#> GSM862466 1 0.1478 0.987 0.936 0.000 0.000 0.064 0.000
#> GSM862467 1 0.1478 0.987 0.936 0.000 0.000 0.064 0.000
#> GSM862468 4 0.2153 0.939 0.044 0.000 0.000 0.916 0.040
#> GSM862469 3 0.1106 0.936 0.012 0.000 0.964 0.000 0.024
#> GSM862470 2 0.1502 0.786 0.004 0.940 0.000 0.000 0.056
#> GSM862471 3 0.0955 0.938 0.004 0.000 0.968 0.000 0.028
#> GSM862472 3 0.1928 0.920 0.004 0.004 0.920 0.000 0.072
#> GSM862473 5 0.5855 0.807 0.008 0.244 0.128 0.000 0.620
#> GSM862474 2 0.2824 0.776 0.032 0.872 0.000 0.000 0.096
#> GSM862475 2 0.3861 0.574 0.000 0.712 0.004 0.000 0.284
#> GSM862476 2 0.2824 0.776 0.032 0.872 0.000 0.000 0.096
#> GSM862477 2 0.0000 0.791 0.000 1.000 0.000 0.000 0.000
#> GSM862478 3 0.0290 0.944 0.000 0.000 0.992 0.000 0.008
#> GSM862479 3 0.1106 0.936 0.012 0.000 0.964 0.000 0.024
#> GSM862480 5 0.4541 0.906 0.000 0.288 0.032 0.000 0.680
#> GSM862481 5 0.5798 0.818 0.008 0.248 0.120 0.000 0.624
#> GSM862482 2 0.3064 0.764 0.036 0.856 0.000 0.000 0.108
#> GSM862483 2 0.2193 0.727 0.008 0.900 0.000 0.000 0.092
#> GSM862484 2 0.2769 0.776 0.032 0.876 0.000 0.000 0.092
#> GSM862485 3 0.1408 0.930 0.008 0.000 0.948 0.000 0.044
#> GSM862486 2 0.1544 0.788 0.000 0.932 0.000 0.000 0.068
#> GSM862487 3 0.1965 0.899 0.000 0.000 0.904 0.000 0.096
#> GSM862488 3 0.0404 0.944 0.000 0.000 0.988 0.000 0.012
#> GSM862489 2 0.3636 0.586 0.000 0.728 0.000 0.000 0.272
#> GSM862490 2 0.2929 0.709 0.000 0.820 0.000 0.000 0.180
#> GSM862491 3 0.1124 0.940 0.004 0.000 0.960 0.000 0.036
#> GSM862492 3 0.1732 0.912 0.000 0.000 0.920 0.000 0.080
#> GSM862493 2 0.0703 0.796 0.000 0.976 0.000 0.000 0.024
#> GSM862494 3 0.0404 0.944 0.000 0.000 0.988 0.000 0.012
#> GSM862495 5 0.4360 0.897 0.000 0.284 0.024 0.000 0.692
#> GSM862496 5 0.4475 0.905 0.000 0.276 0.032 0.000 0.692
#> GSM862497 5 0.4541 0.906 0.000 0.288 0.032 0.000 0.680
#> GSM862498 2 0.2329 0.773 0.000 0.876 0.000 0.000 0.124
#> GSM862499 3 0.0290 0.944 0.000 0.000 0.992 0.000 0.008
#> GSM862500 3 0.0290 0.944 0.000 0.000 0.992 0.000 0.008
#> GSM862501 2 0.3910 0.593 0.008 0.720 0.000 0.000 0.272
#> GSM862502 2 0.4088 0.522 0.008 0.688 0.000 0.000 0.304
#> GSM862503 2 0.3177 0.706 0.000 0.792 0.000 0.000 0.208
#> GSM862504 2 0.2848 0.776 0.028 0.868 0.000 0.000 0.104
#> GSM862505 5 0.4152 0.874 0.000 0.296 0.012 0.000 0.692
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> GSM862441 4 0.1672 0.888 0.016 0.000 0.000 0.932 0.004 0.048
#> GSM862442 1 0.0458 0.955 0.984 0.000 0.000 0.016 0.000 0.000
#> GSM862443 1 0.3910 0.771 0.784 0.000 0.000 0.132 0.012 0.072
#> GSM862444 4 0.2058 0.871 0.012 0.000 0.000 0.908 0.008 0.072
#> GSM862445 4 0.4012 0.668 0.012 0.004 0.000 0.700 0.008 0.276
#> GSM862446 1 0.0458 0.955 0.984 0.000 0.000 0.016 0.000 0.000
#> GSM862447 1 0.0458 0.955 0.984 0.000 0.000 0.016 0.000 0.000
#> GSM862448 1 0.0458 0.955 0.984 0.000 0.000 0.016 0.000 0.000
#> GSM862449 1 0.2016 0.907 0.920 0.000 0.000 0.024 0.016 0.040
#> GSM862450 4 0.3893 0.772 0.016 0.000 0.000 0.744 0.020 0.220
#> GSM862451 4 0.0790 0.898 0.032 0.000 0.000 0.968 0.000 0.000
#> GSM862453 1 0.0458 0.955 0.984 0.000 0.000 0.016 0.000 0.000
#> GSM862454 4 0.0865 0.898 0.036 0.000 0.000 0.964 0.000 0.000
#> GSM862455 4 0.0865 0.898 0.036 0.000 0.000 0.964 0.000 0.000
#> GSM862456 4 0.0865 0.898 0.036 0.000 0.000 0.964 0.000 0.000
#> GSM862457 4 0.3352 0.797 0.008 0.000 0.000 0.776 0.008 0.208
#> GSM862458 6 0.5099 0.000 0.004 0.004 0.316 0.040 0.020 0.616
#> GSM862459 4 0.0790 0.898 0.032 0.000 0.000 0.968 0.000 0.000
#> GSM862460 1 0.0458 0.955 0.984 0.000 0.000 0.016 0.000 0.000
#> GSM862461 4 0.2036 0.889 0.028 0.000 0.000 0.916 0.008 0.048
#> GSM862462 4 0.3121 0.810 0.004 0.000 0.000 0.796 0.008 0.192
#> GSM862463 4 0.0865 0.898 0.036 0.000 0.000 0.964 0.000 0.000
#> GSM862464 1 0.3308 0.839 0.836 0.000 0.000 0.088 0.012 0.064
#> GSM862465 4 0.1320 0.893 0.036 0.000 0.000 0.948 0.000 0.016
#> GSM862466 1 0.0458 0.955 0.984 0.000 0.000 0.016 0.000 0.000
#> GSM862467 1 0.0458 0.955 0.984 0.000 0.000 0.016 0.000 0.000
#> GSM862468 4 0.3819 0.812 0.044 0.000 0.000 0.784 0.016 0.156
#> GSM862469 3 0.2278 0.810 0.000 0.000 0.868 0.000 0.004 0.128
#> GSM862470 2 0.3196 0.665 0.004 0.836 0.000 0.000 0.096 0.064
#> GSM862471 3 0.2006 0.840 0.000 0.000 0.892 0.000 0.004 0.104
#> GSM862472 3 0.3239 0.801 0.004 0.012 0.848 0.000 0.064 0.072
#> GSM862473 5 0.4336 0.791 0.004 0.092 0.104 0.000 0.772 0.028
#> GSM862474 2 0.3943 0.647 0.000 0.760 0.000 0.000 0.084 0.156
#> GSM862475 2 0.4328 0.269 0.000 0.520 0.000 0.000 0.460 0.020
#> GSM862476 2 0.3943 0.647 0.000 0.760 0.000 0.000 0.084 0.156
#> GSM862477 2 0.1549 0.688 0.000 0.936 0.000 0.000 0.044 0.020
#> GSM862478 3 0.0405 0.881 0.000 0.000 0.988 0.000 0.008 0.004
#> GSM862479 3 0.2278 0.810 0.000 0.000 0.868 0.000 0.004 0.128
#> GSM862480 5 0.2118 0.896 0.000 0.104 0.008 0.000 0.888 0.000
#> GSM862481 5 0.4384 0.799 0.004 0.100 0.100 0.000 0.768 0.028
#> GSM862482 2 0.4144 0.631 0.000 0.728 0.000 0.000 0.072 0.200
#> GSM862483 2 0.4087 0.589 0.004 0.744 0.000 0.000 0.064 0.188
#> GSM862484 2 0.3772 0.651 0.000 0.772 0.000 0.000 0.068 0.160
#> GSM862485 3 0.2805 0.742 0.000 0.000 0.812 0.000 0.004 0.184
#> GSM862486 2 0.3473 0.660 0.004 0.804 0.000 0.000 0.144 0.048
#> GSM862487 3 0.2149 0.816 0.004 0.000 0.900 0.000 0.080 0.016
#> GSM862488 3 0.0520 0.882 0.000 0.000 0.984 0.000 0.008 0.008
#> GSM862489 2 0.4147 0.304 0.000 0.552 0.000 0.000 0.436 0.012
#> GSM862490 2 0.4434 0.529 0.008 0.668 0.000 0.000 0.284 0.040
#> GSM862491 3 0.1480 0.870 0.000 0.000 0.940 0.000 0.020 0.040
#> GSM862492 3 0.1769 0.842 0.004 0.000 0.924 0.000 0.060 0.012
#> GSM862493 2 0.2554 0.686 0.000 0.876 0.000 0.000 0.076 0.048
#> GSM862494 3 0.0520 0.882 0.000 0.000 0.984 0.000 0.008 0.008
#> GSM862495 5 0.2443 0.878 0.000 0.096 0.004 0.000 0.880 0.020
#> GSM862496 5 0.2118 0.896 0.000 0.104 0.008 0.000 0.888 0.000
#> GSM862497 5 0.2118 0.896 0.000 0.104 0.008 0.000 0.888 0.000
#> GSM862498 2 0.3312 0.656 0.000 0.792 0.000 0.000 0.180 0.028
#> GSM862499 3 0.0260 0.881 0.000 0.000 0.992 0.000 0.000 0.008
#> GSM862500 3 0.0260 0.881 0.000 0.000 0.992 0.000 0.000 0.008
#> GSM862501 2 0.5568 0.423 0.008 0.544 0.000 0.000 0.320 0.128
#> GSM862502 2 0.5693 0.387 0.008 0.520 0.000 0.000 0.332 0.140
#> GSM862503 2 0.4254 0.540 0.004 0.656 0.000 0.000 0.312 0.028
#> GSM862504 2 0.4059 0.647 0.000 0.752 0.000 0.000 0.100 0.148
#> GSM862505 5 0.3049 0.846 0.004 0.104 0.000 0.000 0.844 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 tissue(p) k
#> SD:skmeans 63 1.62e-14 2
#> SD:skmeans 64 8.50e-14 3
#> SD:skmeans 64 5.35e-13 4
#> SD:skmeans 64 2.64e-12 5
#> SD:skmeans 59 4.71e-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", "pam"]
# you can also extract it by
# res = res_list["SD:pam"]
A summary of res
and all the functions that can be applied to it:
res
#> A 'ConsensusPartition' object with k = 2, 3, 4, 5, 6.
#> On a matrix with 51941 rows and 64 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 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.984 0.994 0.487 0.516 0.516
#> 3 3 1.000 0.951 0.976 0.171 0.898 0.805
#> 4 4 0.802 0.905 0.924 0.216 0.853 0.656
#> 5 5 0.901 0.873 0.941 0.065 0.965 0.878
#> 6 6 0.780 0.776 0.886 0.075 0.954 0.822
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
#> GSM862441 1 0.000 1.000 1.000 0.000
#> GSM862442 1 0.000 1.000 1.000 0.000
#> GSM862443 1 0.000 1.000 1.000 0.000
#> GSM862444 1 0.000 1.000 1.000 0.000
#> GSM862445 2 0.969 0.344 0.396 0.604
#> GSM862446 1 0.000 1.000 1.000 0.000
#> GSM862447 1 0.000 1.000 1.000 0.000
#> GSM862448 1 0.000 1.000 1.000 0.000
#> GSM862449 1 0.000 1.000 1.000 0.000
#> GSM862450 1 0.000 1.000 1.000 0.000
#> GSM862451 1 0.000 1.000 1.000 0.000
#> GSM862453 1 0.000 1.000 1.000 0.000
#> GSM862454 1 0.000 1.000 1.000 0.000
#> GSM862455 1 0.000 1.000 1.000 0.000
#> GSM862456 1 0.000 1.000 1.000 0.000
#> GSM862457 1 0.000 1.000 1.000 0.000
#> GSM862458 2 0.000 0.990 0.000 1.000
#> GSM862459 1 0.000 1.000 1.000 0.000
#> GSM862460 1 0.000 1.000 1.000 0.000
#> GSM862461 1 0.000 1.000 1.000 0.000
#> GSM862462 1 0.000 1.000 1.000 0.000
#> GSM862463 1 0.000 1.000 1.000 0.000
#> GSM862464 1 0.000 1.000 1.000 0.000
#> GSM862465 1 0.000 1.000 1.000 0.000
#> GSM862466 1 0.000 1.000 1.000 0.000
#> GSM862467 1 0.000 1.000 1.000 0.000
#> GSM862468 1 0.000 1.000 1.000 0.000
#> GSM862469 2 0.000 0.990 0.000 1.000
#> GSM862470 2 0.000 0.990 0.000 1.000
#> GSM862471 2 0.000 0.990 0.000 1.000
#> GSM862472 2 0.000 0.990 0.000 1.000
#> GSM862473 2 0.000 0.990 0.000 1.000
#> GSM862474 2 0.000 0.990 0.000 1.000
#> GSM862475 2 0.000 0.990 0.000 1.000
#> GSM862476 2 0.000 0.990 0.000 1.000
#> GSM862477 2 0.000 0.990 0.000 1.000
#> GSM862478 2 0.000 0.990 0.000 1.000
#> GSM862479 2 0.000 0.990 0.000 1.000
#> GSM862480 2 0.000 0.990 0.000 1.000
#> GSM862481 2 0.000 0.990 0.000 1.000
#> GSM862482 2 0.000 0.990 0.000 1.000
#> GSM862483 2 0.000 0.990 0.000 1.000
#> GSM862484 2 0.000 0.990 0.000 1.000
#> GSM862485 2 0.000 0.990 0.000 1.000
#> GSM862486 2 0.000 0.990 0.000 1.000
#> GSM862487 2 0.000 0.990 0.000 1.000
#> GSM862488 2 0.000 0.990 0.000 1.000
#> GSM862489 2 0.000 0.990 0.000 1.000
#> GSM862490 2 0.000 0.990 0.000 1.000
#> GSM862491 2 0.000 0.990 0.000 1.000
#> GSM862492 2 0.000 0.990 0.000 1.000
#> GSM862493 2 0.000 0.990 0.000 1.000
#> GSM862494 2 0.000 0.990 0.000 1.000
#> GSM862495 2 0.000 0.990 0.000 1.000
#> GSM862496 2 0.000 0.990 0.000 1.000
#> GSM862497 2 0.000 0.990 0.000 1.000
#> GSM862498 2 0.000 0.990 0.000 1.000
#> GSM862499 2 0.000 0.990 0.000 1.000
#> GSM862500 2 0.000 0.990 0.000 1.000
#> GSM862501 2 0.000 0.990 0.000 1.000
#> GSM862502 2 0.000 0.990 0.000 1.000
#> GSM862503 2 0.000 0.990 0.000 1.000
#> GSM862504 2 0.000 0.990 0.000 1.000
#> GSM862505 2 0.000 0.990 0.000 1.000
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> GSM862441 1 0.164 0.966 0.956 0.000 0.044
#> GSM862442 3 0.000 0.900 0.000 0.000 1.000
#> GSM862443 3 0.455 0.732 0.200 0.000 0.800
#> GSM862444 1 0.164 0.966 0.956 0.000 0.044
#> GSM862445 1 0.192 0.951 0.956 0.020 0.024
#> GSM862446 3 0.000 0.900 0.000 0.000 1.000
#> GSM862447 3 0.000 0.900 0.000 0.000 1.000
#> GSM862448 3 0.000 0.900 0.000 0.000 1.000
#> GSM862449 3 0.533 0.611 0.272 0.000 0.728
#> GSM862450 1 0.164 0.966 0.956 0.000 0.044
#> GSM862451 1 0.116 0.946 0.972 0.000 0.028
#> GSM862453 3 0.000 0.900 0.000 0.000 1.000
#> GSM862454 1 0.000 0.955 1.000 0.000 0.000
#> GSM862455 1 0.000 0.955 1.000 0.000 0.000
#> GSM862456 1 0.000 0.955 1.000 0.000 0.000
#> GSM862457 1 0.164 0.966 0.956 0.000 0.044
#> GSM862458 2 0.226 0.923 0.068 0.932 0.000
#> GSM862459 1 0.164 0.966 0.956 0.000 0.044
#> GSM862460 3 0.000 0.900 0.000 0.000 1.000
#> GSM862461 1 0.164 0.966 0.956 0.000 0.044
#> GSM862462 1 0.164 0.966 0.956 0.000 0.044
#> GSM862463 1 0.280 0.887 0.908 0.000 0.092
#> GSM862464 3 0.628 0.201 0.460 0.000 0.540
#> GSM862465 1 0.000 0.955 1.000 0.000 0.000
#> GSM862466 3 0.000 0.900 0.000 0.000 1.000
#> GSM862467 3 0.000 0.900 0.000 0.000 1.000
#> GSM862468 1 0.288 0.926 0.904 0.000 0.096
#> GSM862469 2 0.000 0.998 0.000 1.000 0.000
#> GSM862470 2 0.000 0.998 0.000 1.000 0.000
#> GSM862471 2 0.000 0.998 0.000 1.000 0.000
#> GSM862472 2 0.000 0.998 0.000 1.000 0.000
#> GSM862473 2 0.000 0.998 0.000 1.000 0.000
#> GSM862474 2 0.000 0.998 0.000 1.000 0.000
#> GSM862475 2 0.000 0.998 0.000 1.000 0.000
#> GSM862476 2 0.000 0.998 0.000 1.000 0.000
#> GSM862477 2 0.000 0.998 0.000 1.000 0.000
#> GSM862478 2 0.000 0.998 0.000 1.000 0.000
#> GSM862479 2 0.000 0.998 0.000 1.000 0.000
#> GSM862480 2 0.000 0.998 0.000 1.000 0.000
#> GSM862481 2 0.000 0.998 0.000 1.000 0.000
#> GSM862482 2 0.000 0.998 0.000 1.000 0.000
#> GSM862483 2 0.000 0.998 0.000 1.000 0.000
#> GSM862484 2 0.000 0.998 0.000 1.000 0.000
#> GSM862485 2 0.000 0.998 0.000 1.000 0.000
#> GSM862486 2 0.000 0.998 0.000 1.000 0.000
#> GSM862487 2 0.000 0.998 0.000 1.000 0.000
#> GSM862488 2 0.000 0.998 0.000 1.000 0.000
#> GSM862489 2 0.000 0.998 0.000 1.000 0.000
#> GSM862490 2 0.000 0.998 0.000 1.000 0.000
#> GSM862491 2 0.000 0.998 0.000 1.000 0.000
#> GSM862492 2 0.000 0.998 0.000 1.000 0.000
#> GSM862493 2 0.000 0.998 0.000 1.000 0.000
#> GSM862494 2 0.000 0.998 0.000 1.000 0.000
#> GSM862495 2 0.000 0.998 0.000 1.000 0.000
#> GSM862496 2 0.000 0.998 0.000 1.000 0.000
#> GSM862497 2 0.000 0.998 0.000 1.000 0.000
#> GSM862498 2 0.000 0.998 0.000 1.000 0.000
#> GSM862499 2 0.000 0.998 0.000 1.000 0.000
#> GSM862500 2 0.000 0.998 0.000 1.000 0.000
#> GSM862501 2 0.000 0.998 0.000 1.000 0.000
#> GSM862502 2 0.000 0.998 0.000 1.000 0.000
#> GSM862503 2 0.000 0.998 0.000 1.000 0.000
#> GSM862504 2 0.000 0.998 0.000 1.000 0.000
#> GSM862505 2 0.000 0.998 0.000 1.000 0.000
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> GSM862441 4 0.1302 0.927 0.044 0.000 0.000 0.956
#> GSM862442 1 0.0000 0.896 1.000 0.000 0.000 0.000
#> GSM862443 1 0.3610 0.720 0.800 0.000 0.000 0.200
#> GSM862444 4 0.1302 0.927 0.044 0.000 0.000 0.956
#> GSM862445 4 0.1520 0.916 0.024 0.020 0.000 0.956
#> GSM862446 1 0.0000 0.896 1.000 0.000 0.000 0.000
#> GSM862447 1 0.0000 0.896 1.000 0.000 0.000 0.000
#> GSM862448 1 0.0000 0.896 1.000 0.000 0.000 0.000
#> GSM862449 1 0.4222 0.592 0.728 0.000 0.000 0.272
#> GSM862450 4 0.1302 0.927 0.044 0.000 0.000 0.956
#> GSM862451 4 0.3962 0.842 0.028 0.000 0.152 0.820
#> GSM862453 1 0.0000 0.896 1.000 0.000 0.000 0.000
#> GSM862454 4 0.3074 0.857 0.000 0.000 0.152 0.848
#> GSM862455 4 0.1211 0.907 0.000 0.000 0.040 0.960
#> GSM862456 4 0.3074 0.857 0.000 0.000 0.152 0.848
#> GSM862457 4 0.1302 0.927 0.044 0.000 0.000 0.956
#> GSM862458 2 0.4231 0.769 0.000 0.824 0.096 0.080
#> GSM862459 4 0.1302 0.927 0.044 0.000 0.000 0.956
#> GSM862460 1 0.0000 0.896 1.000 0.000 0.000 0.000
#> GSM862461 4 0.1888 0.925 0.044 0.000 0.016 0.940
#> GSM862462 4 0.1302 0.927 0.044 0.000 0.000 0.956
#> GSM862463 4 0.5113 0.784 0.088 0.000 0.152 0.760
#> GSM862464 1 0.4977 0.157 0.540 0.000 0.000 0.460
#> GSM862465 4 0.0000 0.916 0.000 0.000 0.000 1.000
#> GSM862466 1 0.0000 0.896 1.000 0.000 0.000 0.000
#> GSM862467 1 0.0000 0.896 1.000 0.000 0.000 0.000
#> GSM862468 4 0.2281 0.893 0.096 0.000 0.000 0.904
#> GSM862469 3 0.3764 0.907 0.000 0.216 0.784 0.000
#> GSM862470 2 0.0188 0.983 0.000 0.996 0.004 0.000
#> GSM862471 3 0.3528 0.915 0.000 0.192 0.808 0.000
#> GSM862472 3 0.4967 0.546 0.000 0.452 0.548 0.000
#> GSM862473 2 0.0000 0.986 0.000 1.000 0.000 0.000
#> GSM862474 2 0.0336 0.981 0.000 0.992 0.008 0.000
#> GSM862475 2 0.0000 0.986 0.000 1.000 0.000 0.000
#> GSM862476 2 0.0592 0.975 0.000 0.984 0.016 0.000
#> GSM862477 2 0.0469 0.978 0.000 0.988 0.012 0.000
#> GSM862478 3 0.3311 0.913 0.000 0.172 0.828 0.000
#> GSM862479 3 0.4564 0.792 0.000 0.328 0.672 0.000
#> GSM862480 2 0.0000 0.986 0.000 1.000 0.000 0.000
#> GSM862481 2 0.0000 0.986 0.000 1.000 0.000 0.000
#> GSM862482 2 0.0000 0.986 0.000 1.000 0.000 0.000
#> GSM862483 2 0.0000 0.986 0.000 1.000 0.000 0.000
#> GSM862484 2 0.0188 0.984 0.000 0.996 0.004 0.000
#> GSM862485 2 0.1022 0.962 0.000 0.968 0.032 0.000
#> GSM862486 2 0.0188 0.983 0.000 0.996 0.004 0.000
#> GSM862487 2 0.0817 0.967 0.000 0.976 0.024 0.000
#> GSM862488 3 0.3266 0.912 0.000 0.168 0.832 0.000
#> GSM862489 2 0.0000 0.986 0.000 1.000 0.000 0.000
#> GSM862490 2 0.0000 0.986 0.000 1.000 0.000 0.000
#> GSM862491 3 0.3569 0.916 0.000 0.196 0.804 0.000
#> GSM862492 3 0.3837 0.906 0.000 0.224 0.776 0.000
#> GSM862493 2 0.0000 0.986 0.000 1.000 0.000 0.000
#> GSM862494 3 0.3266 0.912 0.000 0.168 0.832 0.000
#> GSM862495 2 0.0000 0.986 0.000 1.000 0.000 0.000
#> GSM862496 2 0.0000 0.986 0.000 1.000 0.000 0.000
#> GSM862497 2 0.0000 0.986 0.000 1.000 0.000 0.000
#> GSM862498 2 0.0817 0.967 0.000 0.976 0.024 0.000
#> GSM862499 3 0.3074 0.902 0.000 0.152 0.848 0.000
#> GSM862500 3 0.3074 0.902 0.000 0.152 0.848 0.000
#> GSM862501 2 0.0336 0.980 0.000 0.992 0.008 0.000
#> GSM862502 2 0.0000 0.986 0.000 1.000 0.000 0.000
#> GSM862503 2 0.0000 0.986 0.000 1.000 0.000 0.000
#> GSM862504 2 0.0000 0.986 0.000 1.000 0.000 0.000
#> GSM862505 2 0.0000 0.986 0.000 1.000 0.000 0.000
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> GSM862441 4 0.0000 0.8886 0.000 0.000 0.000 1.000 0.000
#> GSM862442 1 0.0000 0.9402 1.000 0.000 0.000 0.000 0.000
#> GSM862443 1 0.2074 0.8440 0.896 0.000 0.000 0.104 0.000
#> GSM862444 4 0.0000 0.8886 0.000 0.000 0.000 1.000 0.000
#> GSM862445 4 0.0510 0.8786 0.000 0.000 0.000 0.984 0.016
#> GSM862446 1 0.0000 0.9402 1.000 0.000 0.000 0.000 0.000
#> GSM862447 1 0.0000 0.9402 1.000 0.000 0.000 0.000 0.000
#> GSM862448 1 0.0000 0.9402 1.000 0.000 0.000 0.000 0.000
#> GSM862449 1 0.4045 0.4144 0.644 0.000 0.000 0.356 0.000
#> GSM862450 4 0.0000 0.8886 0.000 0.000 0.000 1.000 0.000
#> GSM862451 5 0.1043 0.9319 0.000 0.000 0.000 0.040 0.960
#> GSM862453 1 0.0000 0.9402 1.000 0.000 0.000 0.000 0.000
#> GSM862454 5 0.0880 0.9356 0.000 0.000 0.000 0.032 0.968
#> GSM862455 5 0.3508 0.6893 0.000 0.000 0.000 0.252 0.748
#> GSM862456 5 0.0880 0.9356 0.000 0.000 0.000 0.032 0.968
#> GSM862457 4 0.0000 0.8886 0.000 0.000 0.000 1.000 0.000
#> GSM862458 2 0.5714 0.4850 0.000 0.632 0.112 0.248 0.008
#> GSM862459 4 0.0000 0.8886 0.000 0.000 0.000 1.000 0.000
#> GSM862460 1 0.0000 0.9402 1.000 0.000 0.000 0.000 0.000
#> GSM862461 4 0.3692 0.7277 0.136 0.000 0.000 0.812 0.052
#> GSM862462 4 0.0000 0.8886 0.000 0.000 0.000 1.000 0.000
#> GSM862463 5 0.0880 0.9356 0.000 0.000 0.000 0.032 0.968
#> GSM862464 4 0.4287 0.0658 0.460 0.000 0.000 0.540 0.000
#> GSM862465 4 0.3109 0.6581 0.000 0.000 0.000 0.800 0.200
#> GSM862466 1 0.0000 0.9402 1.000 0.000 0.000 0.000 0.000
#> GSM862467 1 0.0000 0.9402 1.000 0.000 0.000 0.000 0.000
#> GSM862468 4 0.0703 0.8743 0.024 0.000 0.000 0.976 0.000
#> GSM862469 3 0.2462 0.8314 0.000 0.112 0.880 0.000 0.008
#> GSM862470 2 0.0771 0.9587 0.000 0.976 0.020 0.000 0.004
#> GSM862471 3 0.1557 0.8402 0.000 0.052 0.940 0.000 0.008
#> GSM862472 3 0.4262 0.3914 0.000 0.440 0.560 0.000 0.000
#> GSM862473 2 0.0000 0.9700 0.000 1.000 0.000 0.000 0.000
#> GSM862474 2 0.0992 0.9602 0.000 0.968 0.008 0.000 0.024
#> GSM862475 2 0.0000 0.9700 0.000 1.000 0.000 0.000 0.000
#> GSM862476 2 0.1211 0.9559 0.000 0.960 0.016 0.000 0.024
#> GSM862477 2 0.1106 0.9583 0.000 0.964 0.012 0.000 0.024
#> GSM862478 3 0.1410 0.8431 0.000 0.060 0.940 0.000 0.000
#> GSM862479 3 0.3582 0.7260 0.000 0.224 0.768 0.000 0.008
#> GSM862480 2 0.0000 0.9700 0.000 1.000 0.000 0.000 0.000
#> GSM862481 2 0.0000 0.9700 0.000 1.000 0.000 0.000 0.000
#> GSM862482 2 0.0404 0.9674 0.000 0.988 0.000 0.000 0.012
#> GSM862483 2 0.0566 0.9662 0.000 0.984 0.012 0.000 0.004
#> GSM862484 2 0.0865 0.9616 0.000 0.972 0.004 0.000 0.024
#> GSM862485 2 0.1502 0.9336 0.000 0.940 0.056 0.000 0.004
#> GSM862486 2 0.0609 0.9612 0.000 0.980 0.020 0.000 0.000
#> GSM862487 2 0.0880 0.9524 0.000 0.968 0.032 0.000 0.000
#> GSM862488 3 0.1671 0.8432 0.000 0.076 0.924 0.000 0.000
#> GSM862489 2 0.0000 0.9700 0.000 1.000 0.000 0.000 0.000
#> GSM862490 2 0.0000 0.9700 0.000 1.000 0.000 0.000 0.000
#> GSM862491 3 0.1965 0.8477 0.000 0.096 0.904 0.000 0.000
#> GSM862492 3 0.2732 0.8132 0.000 0.160 0.840 0.000 0.000
#> GSM862493 2 0.0703 0.9625 0.000 0.976 0.000 0.000 0.024
#> GSM862494 3 0.1270 0.8386 0.000 0.052 0.948 0.000 0.000
#> GSM862495 2 0.0000 0.9700 0.000 1.000 0.000 0.000 0.000
#> GSM862496 2 0.0000 0.9700 0.000 1.000 0.000 0.000 0.000
#> GSM862497 2 0.0000 0.9700 0.000 1.000 0.000 0.000 0.000
#> GSM862498 2 0.0703 0.9586 0.000 0.976 0.024 0.000 0.000
#> GSM862499 3 0.0290 0.8064 0.000 0.000 0.992 0.000 0.008
#> GSM862500 3 0.0000 0.8060 0.000 0.000 1.000 0.000 0.000
#> GSM862501 2 0.0671 0.9618 0.000 0.980 0.016 0.000 0.004
#> GSM862502 2 0.0000 0.9700 0.000 1.000 0.000 0.000 0.000
#> GSM862503 2 0.0000 0.9700 0.000 1.000 0.000 0.000 0.000
#> GSM862504 2 0.0703 0.9625 0.000 0.976 0.000 0.000 0.024
#> GSM862505 2 0.0000 0.9700 0.000 1.000 0.000 0.000 0.000
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> GSM862441 4 0.0000 0.8762 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM862442 1 0.0000 0.9426 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM862443 1 0.1863 0.8458 0.896 0.000 0.000 0.104 0.000 0.000
#> GSM862444 4 0.0000 0.8762 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM862445 4 0.2340 0.7654 0.000 0.148 0.000 0.852 0.000 0.000
#> GSM862446 1 0.0000 0.9426 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM862447 1 0.0000 0.9426 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM862448 1 0.0000 0.9426 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM862449 1 0.4181 0.4581 0.644 0.028 0.000 0.328 0.000 0.000
#> GSM862450 4 0.0000 0.8762 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM862451 6 0.0260 0.9259 0.000 0.000 0.000 0.008 0.000 0.992
#> GSM862453 1 0.0000 0.9426 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM862454 6 0.0000 0.9292 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM862455 6 0.3050 0.6667 0.000 0.000 0.000 0.236 0.000 0.764
#> GSM862456 6 0.0000 0.9292 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM862457 4 0.0000 0.8762 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM862458 5 0.6378 0.2412 0.000 0.068 0.156 0.232 0.544 0.000
#> GSM862459 4 0.0000 0.8762 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM862460 1 0.0000 0.9426 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM862461 4 0.3268 0.7381 0.144 0.000 0.000 0.812 0.000 0.044
#> GSM862462 4 0.0000 0.8762 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM862463 6 0.0000 0.9292 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM862464 4 0.3854 0.0543 0.464 0.000 0.000 0.536 0.000 0.000
#> GSM862465 4 0.2793 0.6760 0.000 0.000 0.000 0.800 0.000 0.200
#> GSM862466 1 0.0000 0.9426 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM862467 1 0.0000 0.9426 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM862468 4 0.0632 0.8638 0.024 0.000 0.000 0.976 0.000 0.000
#> GSM862469 3 0.2685 0.7966 0.000 0.072 0.868 0.000 0.060 0.000
#> GSM862470 5 0.2771 0.7767 0.000 0.116 0.032 0.000 0.852 0.000
#> GSM862471 3 0.1983 0.7977 0.000 0.072 0.908 0.000 0.020 0.000
#> GSM862472 3 0.3923 0.3733 0.000 0.004 0.580 0.000 0.416 0.000
#> GSM862473 5 0.0000 0.8393 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM862474 2 0.3151 0.9802 0.000 0.748 0.000 0.000 0.252 0.000
#> GSM862475 5 0.0000 0.8393 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM862476 2 0.3151 0.9804 0.000 0.748 0.000 0.000 0.252 0.000
#> GSM862477 2 0.3288 0.9510 0.000 0.724 0.000 0.000 0.276 0.000
#> GSM862478 3 0.2748 0.8032 0.000 0.128 0.848 0.000 0.024 0.000
#> GSM862479 3 0.3641 0.7449 0.000 0.072 0.788 0.000 0.140 0.000
#> GSM862480 5 0.0000 0.8393 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM862481 5 0.0000 0.8393 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM862482 5 0.3867 -0.4578 0.000 0.488 0.000 0.000 0.512 0.000
#> GSM862483 5 0.3835 0.4824 0.000 0.320 0.012 0.000 0.668 0.000
#> GSM862484 2 0.3126 0.9795 0.000 0.752 0.000 0.000 0.248 0.000
#> GSM862485 5 0.2672 0.7318 0.000 0.052 0.080 0.000 0.868 0.000
#> GSM862486 5 0.2214 0.8018 0.000 0.096 0.016 0.000 0.888 0.000
#> GSM862487 5 0.0458 0.8339 0.000 0.000 0.016 0.000 0.984 0.000
#> GSM862488 3 0.2901 0.8039 0.000 0.128 0.840 0.000 0.032 0.000
#> GSM862489 5 0.1444 0.8113 0.000 0.072 0.000 0.000 0.928 0.000
#> GSM862490 5 0.0146 0.8392 0.000 0.004 0.000 0.000 0.996 0.000
#> GSM862491 3 0.3003 0.7438 0.000 0.016 0.812 0.000 0.172 0.000
#> GSM862492 3 0.3481 0.7371 0.000 0.032 0.776 0.000 0.192 0.000
#> GSM862493 5 0.3175 0.5709 0.000 0.256 0.000 0.000 0.744 0.000
#> GSM862494 3 0.2581 0.7995 0.000 0.128 0.856 0.000 0.016 0.000
#> GSM862495 5 0.0000 0.8393 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM862496 5 0.0000 0.8393 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM862497 5 0.0000 0.8393 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM862498 5 0.0363 0.8352 0.000 0.000 0.012 0.000 0.988 0.000
#> GSM862499 3 0.0458 0.8035 0.000 0.016 0.984 0.000 0.000 0.000
#> GSM862500 3 0.1610 0.8042 0.000 0.084 0.916 0.000 0.000 0.000
#> GSM862501 5 0.2740 0.7767 0.000 0.120 0.028 0.000 0.852 0.000
#> GSM862502 5 0.1765 0.8025 0.000 0.096 0.000 0.000 0.904 0.000
#> GSM862503 5 0.1501 0.8085 0.000 0.076 0.000 0.000 0.924 0.000
#> GSM862504 5 0.3266 0.4331 0.000 0.272 0.000 0.000 0.728 0.000
#> GSM862505 5 0.0260 0.8384 0.000 0.008 0.000 0.000 0.992 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 tissue(p) k
#> SD:pam 63 1.18e-13 2
#> SD:pam 63 1.56e-13 3
#> SD:pam 63 9.49e-13 4
#> SD:pam 60 2.90e-12 5
#> SD:pam 57 5.06e-11 6
If matrix rows can be associated to genes, consider to use functional_enrichment(res,
...)
to perform function enrichment for the signature genes. See this vignette for more detailed explanations.
The object with results only for a single top-value method and a single partition method can be extracted as:
res = res_list["SD", "mclust"]
# you can also extract it by
# res = res_list["SD:mclust"]
A summary of res
and all the functions that can be applied to it:
res
#> A 'ConsensusPartition' object with k = 2, 3, 4, 5, 6.
#> On a matrix with 51941 rows and 64 columns.
#> Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'SD' method.
#> Subgroups are detected by 'mclust' method.
#> Performed in total 1250 partitions by row resampling.
#> Best k for subgroups seems to be 2.
#>
#> Following methods can be applied to this 'ConsensusPartition' object:
#> [1] "cola_report" "collect_classes" "collect_plots"
#> [4] "collect_stats" "colnames" "compare_signatures"
#> [7] "consensus_heatmap" "dimension_reduction" "functional_enrichment"
#> [10] "get_anno_col" "get_anno" "get_classes"
#> [13] "get_consensus" "get_matrix" "get_membership"
#> [16] "get_param" "get_signatures" "get_stats"
#> [19] "is_best_k" "is_stable_k" "membership_heatmap"
#> [22] "ncol" "nrow" "plot_ecdf"
#> [25] "rownames" "select_partition_number" "show"
#> [28] "suggest_best_k" "test_to_known_factors"
collect_plots()
function collects all the plots made from res
for all k
(number of partitions)
into one single page to provide an easy and fast comparison between different k
.
collect_plots(res)
The plots are:
k
and the heatmap of
predicted classes for each k
.k
.k
.k
.All the plots in panels can be made by individual functions and they are plotted later in this section.
select_partition_number()
produces several plots showing different
statistics for choosing “optimized” k
. There are following statistics:
k
;k
, the area increased is defined as \(A_k - A_{k-1}\).The detailed explanations of these statistics can be found in the cola vignette.
Generally speaking, lower PAC score, higher mean silhouette score or higher
concordance corresponds to better partition. Rand index and Jaccard index
measure how similar the current partition is compared to partition with k-1
.
If they are too similar, we won't accept k
is better than k-1
.
select_partition_number(res)
The numeric values for all these statistics can be obtained by get_stats()
.
get_stats(res)
#> k 1-PAC mean_silhouette concordance area_increased Rand Jaccard
#> 2 2 1.000 0.989 0.995 0.5044 0.497 0.497
#> 3 3 0.856 0.907 0.912 0.2661 0.858 0.714
#> 4 4 0.682 0.716 0.859 0.1388 0.864 0.634
#> 5 5 0.564 0.426 0.639 0.0272 0.889 0.618
#> 6 6 0.688 0.645 0.770 0.0701 0.841 0.433
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
#> GSM862441 1 0.0000 0.997 1.000 0.000
#> GSM862442 1 0.0000 0.997 1.000 0.000
#> GSM862443 1 0.0000 0.997 1.000 0.000
#> GSM862444 1 0.0000 0.997 1.000 0.000
#> GSM862445 1 0.0000 0.997 1.000 0.000
#> GSM862446 1 0.0000 0.997 1.000 0.000
#> GSM862447 1 0.0000 0.997 1.000 0.000
#> GSM862448 1 0.0000 0.997 1.000 0.000
#> GSM862449 1 0.0000 0.997 1.000 0.000
#> GSM862450 1 0.0000 0.997 1.000 0.000
#> GSM862451 1 0.0000 0.997 1.000 0.000
#> GSM862453 1 0.0000 0.997 1.000 0.000
#> GSM862454 1 0.0000 0.997 1.000 0.000
#> GSM862455 1 0.0000 0.997 1.000 0.000
#> GSM862456 1 0.0000 0.997 1.000 0.000
#> GSM862457 1 0.0000 0.997 1.000 0.000
#> GSM862458 1 0.0000 0.997 1.000 0.000
#> GSM862459 1 0.0000 0.997 1.000 0.000
#> GSM862460 1 0.0000 0.997 1.000 0.000
#> GSM862461 1 0.0000 0.997 1.000 0.000
#> GSM862462 1 0.0000 0.997 1.000 0.000
#> GSM862463 1 0.0000 0.997 1.000 0.000
#> GSM862464 1 0.0000 0.997 1.000 0.000
#> GSM862465 1 0.0000 0.997 1.000 0.000
#> GSM862466 1 0.0000 0.997 1.000 0.000
#> GSM862467 1 0.0000 0.997 1.000 0.000
#> GSM862468 1 0.0000 0.997 1.000 0.000
#> GSM862469 2 0.0000 0.992 0.000 1.000
#> GSM862470 2 0.0000 0.992 0.000 1.000
#> GSM862471 2 0.0000 0.992 0.000 1.000
#> GSM862472 2 0.0000 0.992 0.000 1.000
#> GSM862473 2 0.0000 0.992 0.000 1.000
#> GSM862474 2 0.0000 0.992 0.000 1.000
#> GSM862475 2 0.0000 0.992 0.000 1.000
#> GSM862476 2 0.0000 0.992 0.000 1.000
#> GSM862477 2 0.0000 0.992 0.000 1.000
#> GSM862478 2 0.0000 0.992 0.000 1.000
#> GSM862479 2 0.0000 0.992 0.000 1.000
#> GSM862480 2 0.0000 0.992 0.000 1.000
#> GSM862481 2 0.0000 0.992 0.000 1.000
#> GSM862482 1 0.0000 0.997 1.000 0.000
#> GSM862483 1 0.3733 0.921 0.928 0.072
#> GSM862484 2 0.0000 0.992 0.000 1.000
#> GSM862485 2 0.0000 0.992 0.000 1.000
#> GSM862486 2 0.0000 0.992 0.000 1.000
#> GSM862487 2 0.0000 0.992 0.000 1.000
#> GSM862488 2 0.0000 0.992 0.000 1.000
#> GSM862489 2 0.0000 0.992 0.000 1.000
#> GSM862490 2 0.0000 0.992 0.000 1.000
#> GSM862491 2 0.0000 0.992 0.000 1.000
#> GSM862492 2 0.0000 0.992 0.000 1.000
#> GSM862493 2 0.0000 0.992 0.000 1.000
#> GSM862494 2 0.0000 0.992 0.000 1.000
#> GSM862495 2 0.0672 0.985 0.008 0.992
#> GSM862496 2 0.0000 0.992 0.000 1.000
#> GSM862497 2 0.0000 0.992 0.000 1.000
#> GSM862498 2 0.0000 0.992 0.000 1.000
#> GSM862499 2 0.0000 0.992 0.000 1.000
#> GSM862500 2 0.0000 0.992 0.000 1.000
#> GSM862501 2 0.0000 0.992 0.000 1.000
#> GSM862502 2 0.5629 0.854 0.132 0.868
#> GSM862503 2 0.0000 0.992 0.000 1.000
#> GSM862504 2 0.0000 0.992 0.000 1.000
#> GSM862505 2 0.5629 0.854 0.132 0.868
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> GSM862441 1 0.0237 0.975 0.996 0.000 0.004
#> GSM862442 1 0.2066 0.969 0.940 0.000 0.060
#> GSM862443 1 0.2066 0.970 0.940 0.000 0.060
#> GSM862444 1 0.0237 0.975 0.996 0.000 0.004
#> GSM862445 1 0.0237 0.975 0.996 0.000 0.004
#> GSM862446 1 0.2066 0.969 0.940 0.000 0.060
#> GSM862447 1 0.2066 0.969 0.940 0.000 0.060
#> GSM862448 1 0.2066 0.969 0.940 0.000 0.060
#> GSM862449 1 0.2066 0.969 0.940 0.000 0.060
#> GSM862450 1 0.0892 0.975 0.980 0.000 0.020
#> GSM862451 1 0.0592 0.973 0.988 0.000 0.012
#> GSM862453 1 0.2066 0.969 0.940 0.000 0.060
#> GSM862454 1 0.0592 0.973 0.988 0.000 0.012
#> GSM862455 1 0.0592 0.973 0.988 0.000 0.012
#> GSM862456 1 0.0592 0.973 0.988 0.000 0.012
#> GSM862457 1 0.0000 0.975 1.000 0.000 0.000
#> GSM862458 1 0.0237 0.975 0.996 0.000 0.004
#> GSM862459 1 0.0747 0.972 0.984 0.000 0.016
#> GSM862460 1 0.2066 0.969 0.940 0.000 0.060
#> GSM862461 1 0.0892 0.975 0.980 0.000 0.020
#> GSM862462 1 0.0000 0.975 1.000 0.000 0.000
#> GSM862463 1 0.0592 0.973 0.988 0.000 0.012
#> GSM862464 1 0.2066 0.970 0.940 0.000 0.060
#> GSM862465 1 0.0592 0.973 0.988 0.000 0.012
#> GSM862466 1 0.2066 0.969 0.940 0.000 0.060
#> GSM862467 1 0.2066 0.969 0.940 0.000 0.060
#> GSM862468 1 0.0000 0.975 1.000 0.000 0.000
#> GSM862469 3 0.2711 0.960 0.000 0.088 0.912
#> GSM862470 2 0.0000 0.842 0.000 1.000 0.000
#> GSM862471 3 0.2537 0.962 0.000 0.080 0.920
#> GSM862472 3 0.3340 0.947 0.000 0.120 0.880
#> GSM862473 2 0.5882 0.615 0.000 0.652 0.348
#> GSM862474 2 0.0000 0.842 0.000 1.000 0.000
#> GSM862475 2 0.5098 0.767 0.000 0.752 0.248
#> GSM862476 2 0.0000 0.842 0.000 1.000 0.000
#> GSM862477 2 0.0000 0.842 0.000 1.000 0.000
#> GSM862478 3 0.2537 0.962 0.000 0.080 0.920
#> GSM862479 3 0.2711 0.960 0.000 0.088 0.912
#> GSM862480 2 0.5497 0.721 0.000 0.708 0.292
#> GSM862481 2 0.5678 0.677 0.000 0.684 0.316
#> GSM862482 1 0.1031 0.975 0.976 0.000 0.024
#> GSM862483 1 0.2527 0.946 0.936 0.044 0.020
#> GSM862484 2 0.0424 0.844 0.000 0.992 0.008
#> GSM862485 3 0.3816 0.924 0.000 0.148 0.852
#> GSM862486 2 0.3192 0.844 0.000 0.888 0.112
#> GSM862487 3 0.3941 0.915 0.000 0.156 0.844
#> GSM862488 3 0.2537 0.962 0.000 0.080 0.920
#> GSM862489 2 0.2878 0.847 0.000 0.904 0.096
#> GSM862490 2 0.1964 0.847 0.000 0.944 0.056
#> GSM862491 3 0.3752 0.931 0.000 0.144 0.856
#> GSM862492 3 0.3941 0.915 0.000 0.156 0.844
#> GSM862493 2 0.0000 0.842 0.000 1.000 0.000
#> GSM862494 3 0.2537 0.962 0.000 0.080 0.920
#> GSM862495 2 0.5785 0.706 0.004 0.696 0.300
#> GSM862496 2 0.5517 0.743 0.004 0.728 0.268
#> GSM862497 2 0.5291 0.745 0.000 0.732 0.268
#> GSM862498 2 0.4121 0.820 0.000 0.832 0.168
#> GSM862499 3 0.2537 0.962 0.000 0.080 0.920
#> GSM862500 3 0.2537 0.962 0.000 0.080 0.920
#> GSM862501 2 0.1753 0.850 0.000 0.952 0.048
#> GSM862502 2 0.3272 0.845 0.004 0.892 0.104
#> GSM862503 2 0.0000 0.842 0.000 1.000 0.000
#> GSM862504 2 0.0237 0.843 0.000 0.996 0.004
#> GSM862505 2 0.4784 0.806 0.004 0.796 0.200
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> GSM862441 4 0.4673 0.668 0.292 0.000 0.008 0.700
#> GSM862442 1 0.0000 0.806 1.000 0.000 0.000 0.000
#> GSM862443 1 0.6163 0.170 0.576 0.000 0.060 0.364
#> GSM862444 4 0.5478 0.597 0.344 0.000 0.028 0.628
#> GSM862445 4 0.4836 0.641 0.320 0.000 0.008 0.672
#> GSM862446 1 0.0000 0.806 1.000 0.000 0.000 0.000
#> GSM862447 1 0.0000 0.806 1.000 0.000 0.000 0.000
#> GSM862448 1 0.0000 0.806 1.000 0.000 0.000 0.000
#> GSM862449 1 0.0469 0.800 0.988 0.000 0.000 0.012
#> GSM862450 4 0.5954 0.573 0.344 0.000 0.052 0.604
#> GSM862451 4 0.0000 0.742 0.000 0.000 0.000 1.000
#> GSM862453 1 0.1118 0.776 0.964 0.000 0.000 0.036
#> GSM862454 4 0.0000 0.742 0.000 0.000 0.000 1.000
#> GSM862455 4 0.0000 0.742 0.000 0.000 0.000 1.000
#> GSM862456 4 0.0000 0.742 0.000 0.000 0.000 1.000
#> GSM862457 4 0.4955 0.611 0.344 0.000 0.008 0.648
#> GSM862458 4 0.5807 0.582 0.344 0.000 0.044 0.612
#> GSM862459 4 0.0000 0.742 0.000 0.000 0.000 1.000
#> GSM862460 1 0.0000 0.806 1.000 0.000 0.000 0.000
#> GSM862461 1 0.6336 -0.232 0.480 0.000 0.060 0.460
#> GSM862462 4 0.4567 0.679 0.276 0.000 0.008 0.716
#> GSM862463 4 0.0000 0.742 0.000 0.000 0.000 1.000
#> GSM862464 1 0.6163 0.170 0.576 0.000 0.060 0.364
#> GSM862465 4 0.0000 0.742 0.000 0.000 0.000 1.000
#> GSM862466 1 0.0000 0.806 1.000 0.000 0.000 0.000
#> GSM862467 1 0.0000 0.806 1.000 0.000 0.000 0.000
#> GSM862468 4 0.3636 0.719 0.172 0.000 0.008 0.820
#> GSM862469 3 0.1637 0.868 0.000 0.060 0.940 0.000
#> GSM862470 2 0.0000 0.877 0.000 1.000 0.000 0.000
#> GSM862471 3 0.2281 0.856 0.000 0.096 0.904 0.000
#> GSM862472 3 0.3764 0.765 0.000 0.216 0.784 0.000
#> GSM862473 3 0.4994 0.209 0.000 0.480 0.520 0.000
#> GSM862474 2 0.0188 0.879 0.000 0.996 0.004 0.000
#> GSM862475 2 0.1474 0.877 0.000 0.948 0.052 0.000
#> GSM862476 2 0.0188 0.879 0.000 0.996 0.004 0.000
#> GSM862477 2 0.0000 0.877 0.000 1.000 0.000 0.000
#> GSM862478 3 0.1637 0.868 0.000 0.060 0.940 0.000
#> GSM862479 3 0.1637 0.868 0.000 0.060 0.940 0.000
#> GSM862480 2 0.2345 0.847 0.000 0.900 0.100 0.000
#> GSM862481 2 0.4804 0.276 0.000 0.616 0.384 0.000
#> GSM862482 4 0.5967 0.594 0.272 0.016 0.044 0.668
#> GSM862483 1 0.5252 0.436 0.692 0.020 0.008 0.280
#> GSM862484 2 0.0707 0.881 0.000 0.980 0.020 0.000
#> GSM862485 3 0.4250 0.712 0.000 0.276 0.724 0.000
#> GSM862486 2 0.1118 0.881 0.000 0.964 0.036 0.000
#> GSM862487 3 0.4193 0.722 0.000 0.268 0.732 0.000
#> GSM862488 3 0.1637 0.868 0.000 0.060 0.940 0.000
#> GSM862489 2 0.1118 0.881 0.000 0.964 0.036 0.000
#> GSM862490 2 0.2125 0.874 0.004 0.932 0.052 0.012
#> GSM862491 2 0.5000 -0.154 0.000 0.504 0.496 0.000
#> GSM862492 3 0.4193 0.722 0.000 0.268 0.732 0.000
#> GSM862493 2 0.0188 0.879 0.000 0.996 0.004 0.000
#> GSM862494 3 0.1637 0.868 0.000 0.060 0.940 0.000
#> GSM862495 2 0.4608 0.790 0.000 0.800 0.096 0.104
#> GSM862496 2 0.4483 0.796 0.000 0.808 0.088 0.104
#> GSM862497 2 0.2216 0.853 0.000 0.908 0.092 0.000
#> GSM862498 2 0.1474 0.877 0.000 0.948 0.052 0.000
#> GSM862499 3 0.1637 0.868 0.000 0.060 0.940 0.000
#> GSM862500 3 0.1637 0.868 0.000 0.060 0.940 0.000
#> GSM862501 2 0.1576 0.878 0.000 0.948 0.048 0.004
#> GSM862502 2 0.4957 0.713 0.000 0.748 0.048 0.204
#> GSM862503 2 0.0000 0.877 0.000 1.000 0.000 0.000
#> GSM862504 2 0.0188 0.879 0.000 0.996 0.004 0.000
#> GSM862505 2 0.5035 0.712 0.000 0.744 0.052 0.204
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> GSM862441 4 0.6173 0.6233 0.300 0.000 0.084 0.584 0.032
#> GSM862442 1 0.2124 0.7383 0.900 0.000 0.096 0.000 0.004
#> GSM862443 1 0.7541 -0.0457 0.404 0.000 0.288 0.264 0.044
#> GSM862444 4 0.5842 0.6420 0.204 0.000 0.124 0.652 0.020
#> GSM862445 4 0.5273 0.6312 0.304 0.000 0.012 0.636 0.048
#> GSM862446 1 0.0404 0.7829 0.988 0.000 0.000 0.012 0.000
#> GSM862447 1 0.0404 0.7829 0.988 0.000 0.000 0.012 0.000
#> GSM862448 1 0.0000 0.7814 1.000 0.000 0.000 0.000 0.000
#> GSM862449 1 0.1851 0.7252 0.912 0.000 0.000 0.088 0.000
#> GSM862450 4 0.7028 0.5707 0.208 0.000 0.228 0.524 0.040
#> GSM862451 4 0.3355 0.6588 0.132 0.000 0.000 0.832 0.036
#> GSM862453 1 0.0000 0.7814 1.000 0.000 0.000 0.000 0.000
#> GSM862454 4 0.2793 0.5738 0.000 0.000 0.036 0.876 0.088
#> GSM862455 4 0.3515 0.6160 0.064 0.000 0.008 0.844 0.084
#> GSM862456 4 0.2793 0.5738 0.000 0.000 0.036 0.876 0.088
#> GSM862457 4 0.6454 0.6114 0.304 0.000 0.084 0.564 0.048
#> GSM862458 4 0.6709 0.6252 0.200 0.020 0.120 0.620 0.040
#> GSM862459 4 0.2865 0.6689 0.132 0.000 0.004 0.856 0.008
#> GSM862460 1 0.2124 0.7383 0.900 0.000 0.096 0.000 0.004
#> GSM862461 4 0.7568 0.3036 0.304 0.000 0.292 0.364 0.040
#> GSM862462 4 0.6454 0.6114 0.304 0.000 0.084 0.564 0.048
#> GSM862463 4 0.2793 0.5738 0.000 0.000 0.036 0.876 0.088
#> GSM862464 1 0.7541 -0.0457 0.404 0.000 0.288 0.264 0.044
#> GSM862465 4 0.3122 0.6694 0.108 0.000 0.016 0.860 0.016
#> GSM862466 1 0.0566 0.7818 0.984 0.000 0.000 0.012 0.004
#> GSM862467 1 0.0162 0.7815 0.996 0.000 0.000 0.000 0.004
#> GSM862468 4 0.6279 0.6167 0.304 0.000 0.080 0.576 0.040
#> GSM862469 3 0.4074 0.8752 0.000 0.364 0.636 0.000 0.000
#> GSM862470 2 0.4287 -0.7969 0.000 0.540 0.000 0.000 0.460
#> GSM862471 3 0.4225 0.8686 0.000 0.364 0.632 0.000 0.004
#> GSM862472 3 0.4907 0.6115 0.000 0.484 0.492 0.000 0.024
#> GSM862473 2 0.3388 0.2284 0.000 0.792 0.200 0.000 0.008
#> GSM862474 5 0.4305 0.8693 0.000 0.488 0.000 0.000 0.512
#> GSM862475 2 0.3055 0.1844 0.000 0.840 0.016 0.000 0.144
#> GSM862476 5 0.4304 0.8723 0.000 0.484 0.000 0.000 0.516
#> GSM862477 5 0.4249 0.8002 0.000 0.432 0.000 0.000 0.568
#> GSM862478 3 0.4249 0.9063 0.000 0.296 0.688 0.000 0.016
#> GSM862479 3 0.4074 0.8752 0.000 0.364 0.636 0.000 0.000
#> GSM862480 2 0.1082 0.3764 0.000 0.964 0.008 0.000 0.028
#> GSM862481 2 0.2707 0.3851 0.000 0.860 0.132 0.000 0.008
#> GSM862482 4 0.8776 0.2369 0.212 0.176 0.016 0.352 0.244
#> GSM862483 1 0.7779 0.1887 0.456 0.080 0.004 0.192 0.268
#> GSM862484 2 0.4305 -0.8470 0.000 0.512 0.000 0.000 0.488
#> GSM862485 2 0.4448 -0.6099 0.000 0.516 0.480 0.000 0.004
#> GSM862486 2 0.4065 -0.1944 0.000 0.720 0.016 0.000 0.264
#> GSM862487 2 0.4434 -0.5598 0.000 0.536 0.460 0.000 0.004
#> GSM862488 3 0.4249 0.9063 0.000 0.296 0.688 0.000 0.016
#> GSM862489 2 0.3884 -0.2840 0.000 0.708 0.004 0.000 0.288
#> GSM862490 5 0.5057 0.6226 0.004 0.480 0.008 0.012 0.496
#> GSM862491 2 0.4283 -0.1767 0.000 0.644 0.348 0.000 0.008
#> GSM862492 2 0.4440 -0.5806 0.000 0.528 0.468 0.000 0.004
#> GSM862493 5 0.4307 0.8622 0.000 0.496 0.000 0.000 0.504
#> GSM862494 3 0.4249 0.9063 0.000 0.296 0.688 0.000 0.016
#> GSM862495 2 0.2769 0.4165 0.000 0.876 0.032 0.000 0.092
#> GSM862496 2 0.2077 0.4088 0.000 0.908 0.008 0.000 0.084
#> GSM862497 2 0.0324 0.3875 0.000 0.992 0.004 0.000 0.004
#> GSM862498 2 0.3171 0.0896 0.000 0.816 0.008 0.000 0.176
#> GSM862499 3 0.4269 0.9042 0.000 0.300 0.684 0.000 0.016
#> GSM862500 3 0.4249 0.9063 0.000 0.296 0.688 0.000 0.016
#> GSM862501 2 0.4029 -0.3499 0.000 0.680 0.004 0.000 0.316
#> GSM862502 2 0.4714 -0.0902 0.000 0.576 0.012 0.004 0.408
#> GSM862503 2 0.4045 -0.4905 0.000 0.644 0.000 0.000 0.356
#> GSM862504 5 0.4305 0.8685 0.000 0.488 0.000 0.000 0.512
#> GSM862505 2 0.3882 0.3038 0.000 0.756 0.020 0.000 0.224
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> GSM862441 4 0.0820 0.72173 0.016 0.000 0.000 0.972 0.000 0.012
#> GSM862442 1 0.1471 0.86743 0.932 0.000 0.000 0.064 0.000 0.004
#> GSM862443 4 0.4776 0.56571 0.112 0.000 0.004 0.704 0.008 0.172
#> GSM862444 4 0.1897 0.68706 0.004 0.000 0.000 0.908 0.004 0.084
#> GSM862445 4 0.2082 0.72077 0.020 0.000 0.004 0.916 0.052 0.008
#> GSM862446 1 0.2597 0.84201 0.824 0.000 0.000 0.176 0.000 0.000
#> GSM862447 1 0.2664 0.83523 0.816 0.000 0.000 0.184 0.000 0.000
#> GSM862448 1 0.1204 0.87397 0.944 0.000 0.000 0.056 0.000 0.000
#> GSM862449 1 0.4866 0.42043 0.568 0.000 0.000 0.364 0.000 0.068
#> GSM862450 4 0.1471 0.70766 0.000 0.000 0.000 0.932 0.004 0.064
#> GSM862451 4 0.2912 0.56210 0.012 0.000 0.000 0.816 0.000 0.172
#> GSM862453 1 0.1075 0.87209 0.952 0.000 0.000 0.048 0.000 0.000
#> GSM862454 6 0.3515 1.00000 0.000 0.000 0.000 0.324 0.000 0.676
#> GSM862455 4 0.3843 -0.44286 0.000 0.000 0.000 0.548 0.000 0.452
#> GSM862456 6 0.3515 1.00000 0.000 0.000 0.000 0.324 0.000 0.676
#> GSM862457 4 0.1826 0.72129 0.020 0.000 0.004 0.924 0.052 0.000
#> GSM862458 4 0.3625 0.67592 0.020 0.000 0.004 0.816 0.120 0.040
#> GSM862459 4 0.1151 0.71433 0.012 0.000 0.000 0.956 0.000 0.032
#> GSM862460 1 0.1471 0.86743 0.932 0.000 0.000 0.064 0.000 0.004
#> GSM862461 4 0.3674 0.63487 0.036 0.000 0.004 0.792 0.008 0.160
#> GSM862462 4 0.1969 0.72158 0.020 0.000 0.004 0.920 0.052 0.004
#> GSM862463 6 0.3515 1.00000 0.000 0.000 0.000 0.324 0.000 0.676
#> GSM862464 4 0.4776 0.56571 0.112 0.000 0.004 0.704 0.008 0.172
#> GSM862465 4 0.0951 0.71947 0.004 0.000 0.000 0.968 0.008 0.020
#> GSM862466 1 0.2454 0.85092 0.840 0.000 0.000 0.160 0.000 0.000
#> GSM862467 1 0.1075 0.87209 0.952 0.000 0.000 0.048 0.000 0.000
#> GSM862468 4 0.1826 0.72129 0.020 0.000 0.004 0.924 0.052 0.000
#> GSM862469 3 0.3195 0.74746 0.000 0.036 0.836 0.000 0.116 0.012
#> GSM862470 2 0.2106 0.78571 0.000 0.904 0.032 0.000 0.064 0.000
#> GSM862471 3 0.3920 0.74824 0.000 0.036 0.788 0.000 0.140 0.036
#> GSM862472 3 0.4747 0.57477 0.000 0.068 0.608 0.000 0.324 0.000
#> GSM862473 3 0.5278 0.29890 0.000 0.100 0.488 0.000 0.412 0.000
#> GSM862474 2 0.1124 0.79413 0.000 0.956 0.036 0.000 0.008 0.000
#> GSM862475 5 0.4574 0.40286 0.000 0.440 0.036 0.000 0.524 0.000
#> GSM862476 2 0.1168 0.79853 0.000 0.956 0.028 0.000 0.016 0.000
#> GSM862477 2 0.0713 0.77842 0.000 0.972 0.000 0.000 0.028 0.000
#> GSM862478 3 0.3346 0.71313 0.008 0.036 0.816 0.000 0.000 0.140
#> GSM862479 3 0.3195 0.74746 0.000 0.036 0.836 0.000 0.116 0.012
#> GSM862480 5 0.4594 0.57344 0.000 0.340 0.052 0.000 0.608 0.000
#> GSM862481 5 0.5633 0.34462 0.000 0.196 0.272 0.000 0.532 0.000
#> GSM862482 4 0.7606 -0.00326 0.048 0.176 0.004 0.368 0.352 0.052
#> GSM862483 4 0.7526 0.41241 0.168 0.036 0.028 0.536 0.140 0.092
#> GSM862484 2 0.1564 0.79169 0.000 0.936 0.040 0.000 0.024 0.000
#> GSM862485 3 0.3727 0.71894 0.000 0.036 0.748 0.000 0.216 0.000
#> GSM862486 2 0.4066 0.47030 0.000 0.692 0.036 0.000 0.272 0.000
#> GSM862487 3 0.3925 0.69872 0.000 0.040 0.724 0.000 0.236 0.000
#> GSM862488 3 0.3487 0.71187 0.008 0.036 0.812 0.000 0.004 0.140
#> GSM862489 2 0.4127 0.44596 0.000 0.680 0.036 0.000 0.284 0.000
#> GSM862490 2 0.3632 0.66036 0.000 0.800 0.040 0.008 0.148 0.004
#> GSM862491 3 0.4847 0.29583 0.000 0.056 0.500 0.000 0.444 0.000
#> GSM862492 3 0.4038 0.68920 0.000 0.044 0.712 0.000 0.244 0.000
#> GSM862493 2 0.1257 0.79640 0.000 0.952 0.020 0.000 0.028 0.000
#> GSM862494 3 0.3487 0.71187 0.008 0.036 0.812 0.000 0.004 0.140
#> GSM862495 5 0.3650 0.59399 0.000 0.116 0.092 0.000 0.792 0.000
#> GSM862496 5 0.3276 0.61239 0.000 0.132 0.052 0.000 0.816 0.000
#> GSM862497 5 0.4524 0.57630 0.000 0.336 0.048 0.000 0.616 0.000
#> GSM862498 5 0.4703 0.34286 0.000 0.464 0.044 0.000 0.492 0.000
#> GSM862499 3 0.3346 0.71313 0.008 0.036 0.816 0.000 0.000 0.140
#> GSM862500 3 0.3346 0.71313 0.008 0.036 0.816 0.000 0.000 0.140
#> GSM862501 2 0.4044 0.45877 0.000 0.704 0.040 0.000 0.256 0.000
#> GSM862502 5 0.4603 0.23167 0.000 0.416 0.040 0.000 0.544 0.000
#> GSM862503 2 0.3388 0.67626 0.000 0.792 0.036 0.000 0.172 0.000
#> GSM862504 2 0.1257 0.79994 0.000 0.952 0.028 0.000 0.020 0.000
#> GSM862505 5 0.3794 0.56065 0.000 0.216 0.040 0.000 0.744 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 tissue(p) k
#> SD:mclust 64 4.06e-13 2
#> SD:mclust 64 5.76e-13 3
#> SD:mclust 57 1.70e-11 4
#> SD:mclust 39 1.74e-08 5
#> SD:mclust 51 8.65e-10 6
If matrix rows can be associated to genes, consider to use functional_enrichment(res,
...)
to perform function enrichment for the signature genes. See this vignette for more detailed explanations.
The object with results only for a single top-value method and a single partition method can be extracted as:
res = res_list["SD", "NMF"]
# you can also extract it by
# res = res_list["SD:NMF"]
A summary of res
and all the functions that can be applied to it:
res
#> A 'ConsensusPartition' object with k = 2, 3, 4, 5, 6.
#> On a matrix with 51941 rows and 64 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 2.
#>
#> Following methods can be applied to this 'ConsensusPartition' object:
#> [1] "cola_report" "collect_classes" "collect_plots"
#> [4] "collect_stats" "colnames" "compare_signatures"
#> [7] "consensus_heatmap" "dimension_reduction" "functional_enrichment"
#> [10] "get_anno_col" "get_anno" "get_classes"
#> [13] "get_consensus" "get_matrix" "get_membership"
#> [16] "get_param" "get_signatures" "get_stats"
#> [19] "is_best_k" "is_stable_k" "membership_heatmap"
#> [22] "ncol" "nrow" "plot_ecdf"
#> [25] "rownames" "select_partition_number" "show"
#> [28] "suggest_best_k" "test_to_known_factors"
collect_plots()
function collects all the plots made from res
for all k
(number of partitions)
into one single page to provide an easy and fast comparison between different k
.
collect_plots(res)
The plots are:
k
and the heatmap of
predicted classes for each k
.k
.k
.k
.All the plots in panels can be made by individual functions and they are plotted later in this section.
select_partition_number()
produces several plots showing different
statistics for choosing “optimized” k
. There are following statistics:
k
;k
, the area increased is defined as \(A_k - A_{k-1}\).The detailed explanations of these statistics can be found in the cola vignette.
Generally speaking, lower PAC score, higher mean silhouette score or higher
concordance corresponds to better partition. Rand index and Jaccard index
measure how similar the current partition is compared to partition with k-1
.
If they are too similar, we won't accept k
is better than k-1
.
select_partition_number(res)
The numeric values for all these statistics can be obtained by get_stats()
.
get_stats(res)
#> k 1-PAC mean_silhouette concordance area_increased Rand Jaccard
#> 2 2 1.000 0.989 0.995 0.4922 0.510 0.510
#> 3 3 0.711 0.856 0.853 0.3016 0.823 0.653
#> 4 4 0.753 0.765 0.875 0.1545 0.816 0.524
#> 5 5 0.815 0.759 0.865 0.0752 0.914 0.685
#> 6 6 0.881 0.820 0.901 0.0408 0.934 0.702
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
#> GSM862441 1 0.0000 1.000 1.000 0.000
#> GSM862442 1 0.0000 1.000 1.000 0.000
#> GSM862443 1 0.0000 1.000 1.000 0.000
#> GSM862444 1 0.0000 1.000 1.000 0.000
#> GSM862445 1 0.0376 0.996 0.996 0.004
#> GSM862446 1 0.0000 1.000 1.000 0.000
#> GSM862447 1 0.0000 1.000 1.000 0.000
#> GSM862448 1 0.0000 1.000 1.000 0.000
#> GSM862449 1 0.0000 1.000 1.000 0.000
#> GSM862450 1 0.0000 1.000 1.000 0.000
#> GSM862451 1 0.0000 1.000 1.000 0.000
#> GSM862453 1 0.0000 1.000 1.000 0.000
#> GSM862454 1 0.0000 1.000 1.000 0.000
#> GSM862455 1 0.0000 1.000 1.000 0.000
#> GSM862456 1 0.0000 1.000 1.000 0.000
#> GSM862457 1 0.0000 1.000 1.000 0.000
#> GSM862458 2 0.8081 0.674 0.248 0.752
#> GSM862459 1 0.0000 1.000 1.000 0.000
#> GSM862460 1 0.0000 1.000 1.000 0.000
#> GSM862461 1 0.0000 1.000 1.000 0.000
#> GSM862462 1 0.0000 1.000 1.000 0.000
#> GSM862463 1 0.0000 1.000 1.000 0.000
#> GSM862464 1 0.0000 1.000 1.000 0.000
#> GSM862465 1 0.0000 1.000 1.000 0.000
#> GSM862466 1 0.0000 1.000 1.000 0.000
#> GSM862467 1 0.0000 1.000 1.000 0.000
#> GSM862468 1 0.0000 1.000 1.000 0.000
#> GSM862469 2 0.0000 0.992 0.000 1.000
#> GSM862470 2 0.0000 0.992 0.000 1.000
#> GSM862471 2 0.0000 0.992 0.000 1.000
#> GSM862472 2 0.0000 0.992 0.000 1.000
#> GSM862473 2 0.0000 0.992 0.000 1.000
#> GSM862474 2 0.0000 0.992 0.000 1.000
#> GSM862475 2 0.0000 0.992 0.000 1.000
#> GSM862476 2 0.0000 0.992 0.000 1.000
#> GSM862477 2 0.0000 0.992 0.000 1.000
#> GSM862478 2 0.0000 0.992 0.000 1.000
#> GSM862479 2 0.0000 0.992 0.000 1.000
#> GSM862480 2 0.0000 0.992 0.000 1.000
#> GSM862481 2 0.0000 0.992 0.000 1.000
#> GSM862482 2 0.3114 0.936 0.056 0.944
#> GSM862483 2 0.0000 0.992 0.000 1.000
#> GSM862484 2 0.0000 0.992 0.000 1.000
#> GSM862485 2 0.0000 0.992 0.000 1.000
#> GSM862486 2 0.0000 0.992 0.000 1.000
#> GSM862487 2 0.0000 0.992 0.000 1.000
#> GSM862488 2 0.0000 0.992 0.000 1.000
#> GSM862489 2 0.0000 0.992 0.000 1.000
#> GSM862490 2 0.0000 0.992 0.000 1.000
#> GSM862491 2 0.0000 0.992 0.000 1.000
#> GSM862492 2 0.0000 0.992 0.000 1.000
#> GSM862493 2 0.0000 0.992 0.000 1.000
#> GSM862494 2 0.0000 0.992 0.000 1.000
#> GSM862495 2 0.0000 0.992 0.000 1.000
#> GSM862496 2 0.0000 0.992 0.000 1.000
#> GSM862497 2 0.0000 0.992 0.000 1.000
#> GSM862498 2 0.0000 0.992 0.000 1.000
#> GSM862499 2 0.0000 0.992 0.000 1.000
#> GSM862500 2 0.0000 0.992 0.000 1.000
#> GSM862501 2 0.0000 0.992 0.000 1.000
#> GSM862502 2 0.0000 0.992 0.000 1.000
#> GSM862503 2 0.0000 0.992 0.000 1.000
#> GSM862504 2 0.0000 0.992 0.000 1.000
#> GSM862505 2 0.0000 0.992 0.000 1.000
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> GSM862441 1 0.000 0.921 1.000 0.000 0.000
#> GSM862442 1 0.525 0.837 0.736 0.000 0.264
#> GSM862443 1 0.129 0.915 0.968 0.000 0.032
#> GSM862444 1 0.000 0.921 1.000 0.000 0.000
#> GSM862445 1 0.116 0.903 0.972 0.000 0.028
#> GSM862446 1 0.562 0.813 0.692 0.000 0.308
#> GSM862447 1 0.562 0.813 0.692 0.000 0.308
#> GSM862448 1 0.562 0.813 0.692 0.000 0.308
#> GSM862449 1 0.565 0.811 0.688 0.000 0.312
#> GSM862450 1 0.000 0.921 1.000 0.000 0.000
#> GSM862451 1 0.000 0.921 1.000 0.000 0.000
#> GSM862453 1 0.525 0.837 0.736 0.000 0.264
#> GSM862454 1 0.000 0.921 1.000 0.000 0.000
#> GSM862455 1 0.000 0.921 1.000 0.000 0.000
#> GSM862456 1 0.000 0.921 1.000 0.000 0.000
#> GSM862457 1 0.000 0.921 1.000 0.000 0.000
#> GSM862458 2 0.590 0.488 0.292 0.700 0.008
#> GSM862459 1 0.000 0.921 1.000 0.000 0.000
#> GSM862460 1 0.493 0.852 0.768 0.000 0.232
#> GSM862461 1 0.000 0.921 1.000 0.000 0.000
#> GSM862462 1 0.000 0.921 1.000 0.000 0.000
#> GSM862463 1 0.000 0.921 1.000 0.000 0.000
#> GSM862464 1 0.141 0.914 0.964 0.000 0.036
#> GSM862465 1 0.000 0.921 1.000 0.000 0.000
#> GSM862466 1 0.450 0.866 0.804 0.000 0.196
#> GSM862467 1 0.445 0.867 0.808 0.000 0.192
#> GSM862468 1 0.000 0.921 1.000 0.000 0.000
#> GSM862469 2 0.000 0.911 0.000 1.000 0.000
#> GSM862470 3 0.562 0.928 0.000 0.308 0.692
#> GSM862471 2 0.000 0.911 0.000 1.000 0.000
#> GSM862472 2 0.000 0.911 0.000 1.000 0.000
#> GSM862473 2 0.000 0.911 0.000 1.000 0.000
#> GSM862474 3 0.562 0.928 0.000 0.308 0.692
#> GSM862475 3 0.627 0.663 0.000 0.456 0.544
#> GSM862476 3 0.562 0.928 0.000 0.308 0.692
#> GSM862477 3 0.562 0.928 0.000 0.308 0.692
#> GSM862478 2 0.000 0.911 0.000 1.000 0.000
#> GSM862479 2 0.000 0.911 0.000 1.000 0.000
#> GSM862480 2 0.460 0.586 0.000 0.796 0.204
#> GSM862481 2 0.000 0.911 0.000 1.000 0.000
#> GSM862482 3 0.796 0.713 0.152 0.188 0.660
#> GSM862483 3 0.000 0.545 0.000 0.000 1.000
#> GSM862484 3 0.562 0.928 0.000 0.308 0.692
#> GSM862485 2 0.000 0.911 0.000 1.000 0.000
#> GSM862486 3 0.562 0.928 0.000 0.308 0.692
#> GSM862487 2 0.000 0.911 0.000 1.000 0.000
#> GSM862488 2 0.000 0.911 0.000 1.000 0.000
#> GSM862489 3 0.568 0.919 0.000 0.316 0.684
#> GSM862490 3 0.562 0.928 0.000 0.308 0.692
#> GSM862491 2 0.000 0.911 0.000 1.000 0.000
#> GSM862492 2 0.000 0.911 0.000 1.000 0.000
#> GSM862493 3 0.562 0.928 0.000 0.308 0.692
#> GSM862494 2 0.000 0.911 0.000 1.000 0.000
#> GSM862495 2 0.129 0.880 0.000 0.968 0.032
#> GSM862496 2 0.103 0.889 0.000 0.976 0.024
#> GSM862497 2 0.455 0.593 0.000 0.800 0.200
#> GSM862498 3 0.597 0.852 0.000 0.364 0.636
#> GSM862499 2 0.000 0.911 0.000 1.000 0.000
#> GSM862500 2 0.000 0.911 0.000 1.000 0.000
#> GSM862501 3 0.562 0.928 0.000 0.308 0.692
#> GSM862502 3 0.562 0.928 0.000 0.308 0.692
#> GSM862503 3 0.562 0.928 0.000 0.308 0.692
#> GSM862504 3 0.562 0.928 0.000 0.308 0.692
#> GSM862505 2 0.617 -0.273 0.000 0.588 0.412
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> GSM862441 4 0.0000 0.8653 0.000 0.000 0.000 1.000
#> GSM862442 1 0.4500 0.7447 0.684 0.000 0.000 0.316
#> GSM862443 4 0.5428 -0.1586 0.380 0.000 0.020 0.600
#> GSM862444 4 0.0188 0.8608 0.000 0.000 0.004 0.996
#> GSM862445 4 0.2759 0.7418 0.052 0.044 0.000 0.904
#> GSM862446 1 0.4164 0.7530 0.736 0.000 0.000 0.264
#> GSM862447 1 0.4164 0.7530 0.736 0.000 0.000 0.264
#> GSM862448 1 0.4164 0.7530 0.736 0.000 0.000 0.264
#> GSM862449 1 0.1637 0.5986 0.940 0.000 0.000 0.060
#> GSM862450 4 0.0000 0.8653 0.000 0.000 0.000 1.000
#> GSM862451 4 0.0000 0.8653 0.000 0.000 0.000 1.000
#> GSM862453 1 0.4585 0.7368 0.668 0.000 0.000 0.332
#> GSM862454 4 0.0000 0.8653 0.000 0.000 0.000 1.000
#> GSM862455 4 0.0000 0.8653 0.000 0.000 0.000 1.000
#> GSM862456 4 0.0000 0.8653 0.000 0.000 0.000 1.000
#> GSM862457 4 0.0000 0.8653 0.000 0.000 0.000 1.000
#> GSM862458 4 0.6144 0.0622 0.008 0.032 0.452 0.508
#> GSM862459 4 0.0000 0.8653 0.000 0.000 0.000 1.000
#> GSM862460 1 0.4624 0.7295 0.660 0.000 0.000 0.340
#> GSM862461 4 0.0000 0.8653 0.000 0.000 0.000 1.000
#> GSM862462 4 0.0000 0.8653 0.000 0.000 0.000 1.000
#> GSM862463 4 0.0000 0.8653 0.000 0.000 0.000 1.000
#> GSM862464 4 0.6558 -0.4479 0.452 0.000 0.076 0.472
#> GSM862465 4 0.0000 0.8653 0.000 0.000 0.000 1.000
#> GSM862466 1 0.4992 0.4980 0.524 0.000 0.000 0.476
#> GSM862467 1 0.4925 0.6005 0.572 0.000 0.000 0.428
#> GSM862468 4 0.0000 0.8653 0.000 0.000 0.000 1.000
#> GSM862469 3 0.0000 0.9678 0.000 0.000 1.000 0.000
#> GSM862470 2 0.4040 0.7995 0.248 0.752 0.000 0.000
#> GSM862471 3 0.0000 0.9678 0.000 0.000 1.000 0.000
#> GSM862472 3 0.0000 0.9678 0.000 0.000 1.000 0.000
#> GSM862473 3 0.2647 0.8520 0.000 0.120 0.880 0.000
#> GSM862474 2 0.3528 0.8262 0.192 0.808 0.000 0.000
#> GSM862475 2 0.0000 0.8530 0.000 1.000 0.000 0.000
#> GSM862476 2 0.3356 0.8333 0.176 0.824 0.000 0.000
#> GSM862477 2 0.3975 0.8045 0.240 0.760 0.000 0.000
#> GSM862478 3 0.0000 0.9678 0.000 0.000 1.000 0.000
#> GSM862479 3 0.0000 0.9678 0.000 0.000 1.000 0.000
#> GSM862480 2 0.3266 0.7588 0.000 0.832 0.168 0.000
#> GSM862481 3 0.4356 0.5940 0.000 0.292 0.708 0.000
#> GSM862482 2 0.4379 0.7265 0.036 0.792 0.000 0.172
#> GSM862483 1 0.4888 -0.3572 0.588 0.412 0.000 0.000
#> GSM862484 2 0.3266 0.8364 0.168 0.832 0.000 0.000
#> GSM862485 3 0.0000 0.9678 0.000 0.000 1.000 0.000
#> GSM862486 2 0.3486 0.8325 0.188 0.812 0.000 0.000
#> GSM862487 3 0.0000 0.9678 0.000 0.000 1.000 0.000
#> GSM862488 3 0.0000 0.9678 0.000 0.000 1.000 0.000
#> GSM862489 2 0.0000 0.8530 0.000 1.000 0.000 0.000
#> GSM862490 2 0.1211 0.8532 0.040 0.960 0.000 0.000
#> GSM862491 3 0.0000 0.9678 0.000 0.000 1.000 0.000
#> GSM862492 3 0.0000 0.9678 0.000 0.000 1.000 0.000
#> GSM862493 2 0.3610 0.8231 0.200 0.800 0.000 0.000
#> GSM862494 3 0.0000 0.9678 0.000 0.000 1.000 0.000
#> GSM862495 2 0.4008 0.6589 0.000 0.756 0.244 0.000
#> GSM862496 2 0.4477 0.5350 0.000 0.688 0.312 0.000
#> GSM862497 2 0.3400 0.7461 0.000 0.820 0.180 0.000
#> GSM862498 2 0.1211 0.8565 0.040 0.960 0.000 0.000
#> GSM862499 3 0.0000 0.9678 0.000 0.000 1.000 0.000
#> GSM862500 3 0.0000 0.9678 0.000 0.000 1.000 0.000
#> GSM862501 2 0.1389 0.8522 0.048 0.952 0.000 0.000
#> GSM862502 2 0.1389 0.8522 0.048 0.952 0.000 0.000
#> GSM862503 2 0.0000 0.8530 0.000 1.000 0.000 0.000
#> GSM862504 2 0.2868 0.8455 0.136 0.864 0.000 0.000
#> GSM862505 2 0.1716 0.8322 0.000 0.936 0.064 0.000
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> GSM862441 4 0.0510 0.941 0.000 0.000 0.000 0.984 0.016
#> GSM862442 1 0.2020 0.919 0.900 0.000 0.000 0.100 0.000
#> GSM862443 1 0.4372 0.842 0.756 0.000 0.036 0.196 0.012
#> GSM862444 4 0.0000 0.943 0.000 0.000 0.000 1.000 0.000
#> GSM862445 4 0.3717 0.743 0.012 0.028 0.000 0.816 0.144
#> GSM862446 1 0.1965 0.918 0.904 0.000 0.000 0.096 0.000
#> GSM862447 1 0.1965 0.918 0.904 0.000 0.000 0.096 0.000
#> GSM862448 1 0.1965 0.918 0.904 0.000 0.000 0.096 0.000
#> GSM862449 1 0.2798 0.719 0.852 0.000 0.000 0.008 0.140
#> GSM862450 4 0.0510 0.941 0.000 0.000 0.000 0.984 0.016
#> GSM862451 4 0.0000 0.943 0.000 0.000 0.000 1.000 0.000
#> GSM862453 1 0.2127 0.919 0.892 0.000 0.000 0.108 0.000
#> GSM862454 4 0.0000 0.943 0.000 0.000 0.000 1.000 0.000
#> GSM862455 4 0.0162 0.943 0.000 0.000 0.000 0.996 0.004
#> GSM862456 4 0.0000 0.943 0.000 0.000 0.000 1.000 0.000
#> GSM862457 4 0.0510 0.941 0.000 0.000 0.000 0.984 0.016
#> GSM862458 4 0.6338 0.337 0.004 0.000 0.292 0.532 0.172
#> GSM862459 4 0.0000 0.943 0.000 0.000 0.000 1.000 0.000
#> GSM862460 1 0.2127 0.919 0.892 0.000 0.000 0.108 0.000
#> GSM862461 4 0.0510 0.941 0.000 0.000 0.000 0.984 0.016
#> GSM862462 4 0.0510 0.941 0.000 0.000 0.000 0.984 0.016
#> GSM862463 4 0.0000 0.943 0.000 0.000 0.000 1.000 0.000
#> GSM862464 1 0.5211 0.738 0.712 0.000 0.176 0.096 0.016
#> GSM862465 4 0.0000 0.943 0.000 0.000 0.000 1.000 0.000
#> GSM862466 1 0.2732 0.896 0.840 0.000 0.000 0.160 0.000
#> GSM862467 1 0.2773 0.893 0.836 0.000 0.000 0.164 0.000
#> GSM862468 4 0.1911 0.902 0.004 0.028 0.000 0.932 0.036
#> GSM862469 3 0.0000 0.973 0.000 0.000 1.000 0.000 0.000
#> GSM862470 5 0.3888 0.683 0.064 0.136 0.000 0.000 0.800
#> GSM862471 3 0.0162 0.973 0.004 0.000 0.996 0.000 0.000
#> GSM862472 3 0.0324 0.970 0.004 0.000 0.992 0.000 0.004
#> GSM862473 3 0.3783 0.627 0.000 0.252 0.740 0.000 0.008
#> GSM862474 2 0.4736 0.490 0.020 0.576 0.000 0.000 0.404
#> GSM862475 2 0.0451 0.618 0.000 0.988 0.004 0.000 0.008
#> GSM862476 2 0.4707 0.502 0.020 0.588 0.000 0.000 0.392
#> GSM862477 5 0.3527 0.423 0.016 0.192 0.000 0.000 0.792
#> GSM862478 3 0.0000 0.973 0.000 0.000 1.000 0.000 0.000
#> GSM862479 3 0.0000 0.973 0.000 0.000 1.000 0.000 0.000
#> GSM862480 2 0.0609 0.618 0.000 0.980 0.020 0.000 0.000
#> GSM862481 2 0.4640 0.215 0.000 0.584 0.400 0.000 0.016
#> GSM862482 2 0.6118 0.460 0.012 0.564 0.000 0.112 0.312
#> GSM862483 5 0.3319 0.637 0.160 0.020 0.000 0.000 0.820
#> GSM862484 2 0.4697 0.506 0.020 0.592 0.000 0.000 0.388
#> GSM862485 3 0.0000 0.973 0.000 0.000 1.000 0.000 0.000
#> GSM862486 5 0.4333 0.681 0.060 0.188 0.000 0.000 0.752
#> GSM862487 3 0.0510 0.960 0.000 0.016 0.984 0.000 0.000
#> GSM862488 3 0.0000 0.973 0.000 0.000 1.000 0.000 0.000
#> GSM862489 2 0.1628 0.622 0.008 0.936 0.000 0.000 0.056
#> GSM862490 2 0.4562 -0.493 0.008 0.500 0.000 0.000 0.492
#> GSM862491 3 0.0162 0.973 0.004 0.000 0.996 0.000 0.000
#> GSM862492 3 0.0162 0.973 0.004 0.000 0.996 0.000 0.000
#> GSM862493 2 0.4841 0.471 0.024 0.560 0.000 0.000 0.416
#> GSM862494 3 0.0000 0.973 0.000 0.000 1.000 0.000 0.000
#> GSM862495 2 0.2125 0.583 0.004 0.920 0.052 0.000 0.024
#> GSM862496 2 0.1282 0.607 0.004 0.952 0.044 0.000 0.000
#> GSM862497 2 0.0794 0.617 0.000 0.972 0.028 0.000 0.000
#> GSM862498 2 0.4288 0.550 0.012 0.664 0.000 0.000 0.324
#> GSM862499 3 0.0162 0.973 0.004 0.000 0.996 0.000 0.000
#> GSM862500 3 0.0162 0.973 0.004 0.000 0.996 0.000 0.000
#> GSM862501 5 0.5056 0.538 0.044 0.360 0.000 0.000 0.596
#> GSM862502 5 0.4622 0.441 0.012 0.440 0.000 0.000 0.548
#> GSM862503 2 0.1121 0.595 0.000 0.956 0.000 0.000 0.044
#> GSM862504 2 0.4387 0.539 0.012 0.640 0.000 0.000 0.348
#> GSM862505 2 0.1251 0.601 0.008 0.956 0.000 0.000 0.036
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> GSM862441 4 0.1065 0.8979 0.008 0.008 0.000 0.964 0.020 0.000
#> GSM862442 1 0.0520 0.9312 0.984 0.000 0.000 0.008 0.000 0.008
#> GSM862443 1 0.2800 0.8402 0.884 0.008 0.060 0.032 0.012 0.004
#> GSM862444 4 0.0000 0.9022 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM862445 4 0.4018 0.2613 0.000 0.412 0.000 0.580 0.008 0.000
#> GSM862446 1 0.0260 0.9360 0.992 0.000 0.000 0.008 0.000 0.000
#> GSM862447 1 0.0260 0.9360 0.992 0.000 0.000 0.008 0.000 0.000
#> GSM862448 1 0.0405 0.9345 0.988 0.000 0.000 0.008 0.000 0.004
#> GSM862449 6 0.4962 0.1745 0.428 0.048 0.000 0.000 0.008 0.516
#> GSM862450 4 0.1468 0.8944 0.008 0.008 0.004 0.952 0.020 0.008
#> GSM862451 4 0.0405 0.9010 0.000 0.008 0.000 0.988 0.004 0.000
#> GSM862453 1 0.0405 0.9345 0.988 0.000 0.000 0.008 0.000 0.004
#> GSM862454 4 0.0520 0.8999 0.000 0.008 0.000 0.984 0.008 0.000
#> GSM862455 4 0.0000 0.9022 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM862456 4 0.0405 0.9010 0.000 0.008 0.000 0.988 0.004 0.000
#> GSM862457 4 0.1210 0.8968 0.008 0.008 0.000 0.960 0.020 0.004
#> GSM862458 4 0.6943 0.0486 0.008 0.016 0.352 0.396 0.020 0.208
#> GSM862459 4 0.0508 0.9024 0.000 0.012 0.000 0.984 0.004 0.000
#> GSM862460 1 0.0260 0.9360 0.992 0.000 0.000 0.008 0.000 0.000
#> GSM862461 4 0.1312 0.8956 0.012 0.008 0.000 0.956 0.020 0.004
#> GSM862462 4 0.1210 0.8968 0.008 0.008 0.000 0.960 0.020 0.004
#> GSM862463 4 0.0405 0.9010 0.000 0.008 0.000 0.988 0.004 0.000
#> GSM862464 1 0.4296 0.5322 0.684 0.008 0.284 0.012 0.008 0.004
#> GSM862465 4 0.0924 0.8953 0.004 0.008 0.000 0.972 0.008 0.008
#> GSM862466 1 0.0260 0.9360 0.992 0.000 0.000 0.008 0.000 0.000
#> GSM862467 1 0.0260 0.9360 0.992 0.000 0.000 0.008 0.000 0.000
#> GSM862468 4 0.2657 0.8390 0.008 0.008 0.000 0.880 0.020 0.084
#> GSM862469 3 0.0405 0.9889 0.000 0.000 0.988 0.000 0.008 0.004
#> GSM862470 6 0.2888 0.7561 0.000 0.092 0.000 0.000 0.056 0.852
#> GSM862471 3 0.0000 0.9907 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM862472 3 0.0551 0.9840 0.000 0.008 0.984 0.000 0.004 0.004
#> GSM862473 5 0.4539 0.4924 0.000 0.048 0.304 0.000 0.644 0.004
#> GSM862474 2 0.0547 0.8965 0.000 0.980 0.000 0.000 0.020 0.000
#> GSM862475 5 0.2738 0.7855 0.000 0.176 0.000 0.000 0.820 0.004
#> GSM862476 2 0.0713 0.8978 0.000 0.972 0.000 0.000 0.028 0.000
#> GSM862477 2 0.3508 0.5344 0.000 0.704 0.000 0.000 0.004 0.292
#> GSM862478 3 0.0146 0.9909 0.000 0.000 0.996 0.000 0.004 0.000
#> GSM862479 3 0.0291 0.9901 0.000 0.000 0.992 0.000 0.004 0.004
#> GSM862480 5 0.2300 0.7972 0.000 0.144 0.000 0.000 0.856 0.000
#> GSM862481 5 0.3277 0.7465 0.000 0.084 0.092 0.000 0.824 0.000
#> GSM862482 2 0.3410 0.7747 0.000 0.820 0.000 0.100 0.076 0.004
#> GSM862483 6 0.1957 0.7268 0.000 0.112 0.000 0.000 0.000 0.888
#> GSM862484 2 0.0713 0.8975 0.000 0.972 0.000 0.000 0.028 0.000
#> GSM862485 3 0.0291 0.9901 0.000 0.000 0.992 0.000 0.004 0.004
#> GSM862486 6 0.2282 0.7593 0.000 0.088 0.000 0.000 0.024 0.888
#> GSM862487 3 0.0935 0.9641 0.000 0.000 0.964 0.000 0.032 0.004
#> GSM862488 3 0.0363 0.9879 0.000 0.000 0.988 0.000 0.012 0.000
#> GSM862489 5 0.3351 0.6661 0.000 0.288 0.000 0.000 0.712 0.000
#> GSM862490 5 0.4167 0.5129 0.000 0.024 0.000 0.000 0.632 0.344
#> GSM862491 3 0.0260 0.9885 0.000 0.000 0.992 0.000 0.000 0.008
#> GSM862492 3 0.0291 0.9888 0.000 0.000 0.992 0.000 0.004 0.004
#> GSM862493 2 0.0603 0.8929 0.000 0.980 0.000 0.000 0.016 0.004
#> GSM862494 3 0.0146 0.9909 0.000 0.000 0.996 0.000 0.004 0.000
#> GSM862495 5 0.0909 0.7748 0.000 0.020 0.012 0.000 0.968 0.000
#> GSM862496 5 0.1863 0.7979 0.000 0.104 0.000 0.000 0.896 0.000
#> GSM862497 5 0.2340 0.7960 0.000 0.148 0.000 0.000 0.852 0.000
#> GSM862498 2 0.2214 0.8456 0.000 0.888 0.000 0.000 0.096 0.016
#> GSM862499 3 0.0000 0.9907 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM862500 3 0.0000 0.9907 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM862501 6 0.2632 0.6723 0.000 0.004 0.000 0.000 0.164 0.832
#> GSM862502 5 0.3996 0.3798 0.008 0.004 0.000 0.000 0.636 0.352
#> GSM862503 5 0.4005 0.7540 0.004 0.192 0.000 0.000 0.748 0.056
#> GSM862504 2 0.1267 0.8824 0.000 0.940 0.000 0.000 0.060 0.000
#> GSM862505 5 0.1736 0.7630 0.008 0.020 0.004 0.000 0.936 0.032
Heatmaps for the consensus matrix. It visualizes the probability of two samples to be in a same group.
consensus_heatmap(res, k = 2)
consensus_heatmap(res, k = 3)
consensus_heatmap(res, k = 4)
consensus_heatmap(res, k = 5)
consensus_heatmap(res, k = 6)
Heatmaps for the membership of samples in all partitions to see how consistent they are:
membership_heatmap(res, k = 2)
membership_heatmap(res, k = 3)
membership_heatmap(res, k = 4)
membership_heatmap(res, k = 5)
membership_heatmap(res, k = 6)
As soon as we have had the classes for columns, we can look for signatures which are significantly different between classes which can be candidate marks for certain classes. Following are the heatmaps for signatures.
Signature heatmaps where rows are scaled:
get_signatures(res, k = 2)
get_signatures(res, k = 3)
get_signatures(res, k = 4)
get_signatures(res, k = 5)
get_signatures(res, k = 6)
Signature heatmaps where rows are not scaled:
get_signatures(res, k = 2, scale_rows = FALSE)
get_signatures(res, k = 3, scale_rows = FALSE)
get_signatures(res, k = 4, scale_rows = FALSE)
get_signatures(res, k = 5, scale_rows = FALSE)
get_signatures(res, k = 6, scale_rows = FALSE)
Compare the overlap of signatures from different k:
compare_signatures(res)
get_signature()
returns a data frame invisibly. TO get the list of signatures, the function
call should be assigned to a variable explicitly. In following code, if plot
argument is set
to FALSE
, no heatmap is plotted while only the differential analysis is performed.
# code only for demonstration
tb = get_signature(res, k = ..., plot = FALSE)
An example of the output of tb
is:
#> which_row fdr mean_1 mean_2 scaled_mean_1 scaled_mean_2 km
#> 1 38 0.042760348 8.373488 9.131774 -0.5533452 0.5164555 1
#> 2 40 0.018707592 7.106213 8.469186 -0.6173731 0.5762149 1
#> 3 55 0.019134737 10.221463 11.207825 -0.6159697 0.5749050 1
#> 4 59 0.006059896 5.921854 7.869574 -0.6899429 0.6439467 1
#> 5 60 0.018055526 8.928898 10.211722 -0.6204761 0.5791110 1
#> 6 98 0.009384629 15.714769 14.887706 0.6635654 -0.6193277 2
...
The columns in tb
are:
which_row
: row indices corresponding to the input matrix.fdr
: FDR for the differential test. mean_x
: The mean value in group x.scaled_mean_x
: The mean value in group x after rows are scaled.km
: Row groups if k-means clustering is applied to rows.UMAP plot which shows how samples are separated.
dimension_reduction(res, k = 2, method = "UMAP")
dimension_reduction(res, k = 3, method = "UMAP")
dimension_reduction(res, k = 4, method = "UMAP")
dimension_reduction(res, k = 5, method = "UMAP")
dimension_reduction(res, k = 6, method = "UMAP")
Following heatmap shows how subgroups are split when increasing k
:
collect_classes(res)
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 tissue(p) k
#> SD:NMF 64 6.95e-14 2
#> SD:NMF 62 3.44e-14 3
#> SD:NMF 59 9.61e-13 4
#> SD:NMF 56 2.01e-11 5
#> SD:NMF 59 1.96e-11 6
If matrix rows can be associated to genes, consider to use functional_enrichment(res,
...)
to perform function enrichment for the signature genes. See this vignette for more detailed explanations.
The object with results only for a single top-value method and a single partition method can be extracted as:
res = res_list["CV", "hclust"]
# you can also extract it by
# res = res_list["CV:hclust"]
A summary of res
and all the functions that can be applied to it:
res
#> A 'ConsensusPartition' object with k = 2, 3, 4, 5, 6.
#> On a matrix with 51941 rows and 64 columns.
#> Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'CV' method.
#> Subgroups are detected by 'hclust' method.
#> Performed in total 1250 partitions by row resampling.
#> Best k for subgroups seems to be 3.
#>
#> Following methods can be applied to this 'ConsensusPartition' object:
#> [1] "cola_report" "collect_classes" "collect_plots"
#> [4] "collect_stats" "colnames" "compare_signatures"
#> [7] "consensus_heatmap" "dimension_reduction" "functional_enrichment"
#> [10] "get_anno_col" "get_anno" "get_classes"
#> [13] "get_consensus" "get_matrix" "get_membership"
#> [16] "get_param" "get_signatures" "get_stats"
#> [19] "is_best_k" "is_stable_k" "membership_heatmap"
#> [22] "ncol" "nrow" "plot_ecdf"
#> [25] "rownames" "select_partition_number" "show"
#> [28] "suggest_best_k" "test_to_known_factors"
collect_plots()
function collects all the plots made from res
for all k
(number of partitions)
into one single page to provide an easy and fast comparison between different k
.
collect_plots(res)
The plots are:
k
and the heatmap of
predicted classes for each k
.k
.k
.k
.All the plots in panels can be made by individual functions and they are plotted later in this section.
select_partition_number()
produces several plots showing different
statistics for choosing “optimized” k
. There are following statistics:
k
;k
, the area increased is defined as \(A_k - A_{k-1}\).The detailed explanations of these statistics can be found in the cola vignette.
Generally speaking, lower PAC score, higher mean silhouette score or higher
concordance corresponds to better partition. Rand index and Jaccard index
measure how similar the current partition is compared to partition with k-1
.
If they are too similar, we won't accept k
is better than k-1
.
select_partition_number(res)
The numeric values for all these statistics can be obtained by get_stats()
.
get_stats(res)
#> k 1-PAC mean_silhouette concordance area_increased Rand Jaccard
#> 2 2 0.820 0.945 0.971 0.4712 0.516 0.516
#> 3 3 0.919 0.923 0.956 0.1225 0.963 0.929
#> 4 4 0.832 0.924 0.935 0.1113 0.933 0.859
#> 5 5 0.708 0.839 0.879 0.0993 0.974 0.937
#> 6 6 0.715 0.583 0.803 0.1206 0.981 0.951
suggest_best_k()
suggests the best \(k\) based on these statistics. The rules are as follows:
suggest_best_k(res)
#> [1] 3
Following shows the table of the partitions (You need to click the show/hide
code output link to see it). The membership matrix (columns with name p*
)
is inferred by
clue::cl_consensus()
function with the SE
method. Basically the value in the membership matrix
represents the probability to belong to a certain group. The finall class
label for an item is determined with the group with highest probability it
belongs to.
In get_classes()
function, the entropy is calculated from the membership
matrix and the silhouette score is calculated from the consensus matrix.
cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#> class entropy silhouette p1 p2
#> GSM862441 1 0.6343 0.848 0.840 0.160
#> GSM862442 1 0.0000 0.932 1.000 0.000
#> GSM862443 1 0.0000 0.932 1.000 0.000
#> GSM862444 1 0.6438 0.845 0.836 0.164
#> GSM862445 1 0.6438 0.845 0.836 0.164
#> GSM862446 1 0.0000 0.932 1.000 0.000
#> GSM862447 1 0.0000 0.932 1.000 0.000
#> GSM862448 1 0.0000 0.932 1.000 0.000
#> GSM862449 2 0.8955 0.542 0.312 0.688
#> GSM862450 1 0.6438 0.845 0.836 0.164
#> GSM862451 1 0.0000 0.932 1.000 0.000
#> GSM862453 1 0.0000 0.932 1.000 0.000
#> GSM862454 1 0.0000 0.932 1.000 0.000
#> GSM862455 1 0.0000 0.932 1.000 0.000
#> GSM862456 1 0.0000 0.932 1.000 0.000
#> GSM862457 1 0.6438 0.845 0.836 0.164
#> GSM862458 2 0.0000 0.991 0.000 1.000
#> GSM862459 1 0.0376 0.931 0.996 0.004
#> GSM862460 1 0.0000 0.932 1.000 0.000
#> GSM862461 1 0.0000 0.932 1.000 0.000
#> GSM862462 1 0.6438 0.845 0.836 0.164
#> GSM862463 1 0.0000 0.932 1.000 0.000
#> GSM862464 1 0.0000 0.932 1.000 0.000
#> GSM862465 1 0.9170 0.597 0.668 0.332
#> GSM862466 1 0.0000 0.932 1.000 0.000
#> GSM862467 1 0.0000 0.932 1.000 0.000
#> GSM862468 1 0.8207 0.729 0.744 0.256
#> GSM862469 2 0.0000 0.991 0.000 1.000
#> GSM862470 2 0.0000 0.991 0.000 1.000
#> GSM862471 2 0.0000 0.991 0.000 1.000
#> GSM862472 2 0.0000 0.991 0.000 1.000
#> GSM862473 2 0.0000 0.991 0.000 1.000
#> GSM862474 2 0.0000 0.991 0.000 1.000
#> GSM862475 2 0.0000 0.991 0.000 1.000
#> GSM862476 2 0.0000 0.991 0.000 1.000
#> GSM862477 2 0.0000 0.991 0.000 1.000
#> GSM862478 2 0.0000 0.991 0.000 1.000
#> GSM862479 2 0.0000 0.991 0.000 1.000
#> GSM862480 2 0.0000 0.991 0.000 1.000
#> GSM862481 2 0.0000 0.991 0.000 1.000
#> GSM862482 2 0.0000 0.991 0.000 1.000
#> GSM862483 2 0.0000 0.991 0.000 1.000
#> GSM862484 2 0.0000 0.991 0.000 1.000
#> GSM862485 2 0.0000 0.991 0.000 1.000
#> GSM862486 2 0.0000 0.991 0.000 1.000
#> GSM862487 2 0.0000 0.991 0.000 1.000
#> GSM862488 2 0.0000 0.991 0.000 1.000
#> GSM862489 2 0.0000 0.991 0.000 1.000
#> GSM862490 2 0.0000 0.991 0.000 1.000
#> GSM862491 2 0.0000 0.991 0.000 1.000
#> GSM862492 2 0.0000 0.991 0.000 1.000
#> GSM862493 2 0.0000 0.991 0.000 1.000
#> GSM862494 2 0.0000 0.991 0.000 1.000
#> GSM862495 2 0.0000 0.991 0.000 1.000
#> GSM862496 2 0.0000 0.991 0.000 1.000
#> GSM862497 2 0.0000 0.991 0.000 1.000
#> GSM862498 2 0.0000 0.991 0.000 1.000
#> GSM862499 2 0.0000 0.991 0.000 1.000
#> GSM862500 2 0.0000 0.991 0.000 1.000
#> GSM862501 2 0.0000 0.991 0.000 1.000
#> GSM862502 2 0.0000 0.991 0.000 1.000
#> GSM862503 2 0.0000 0.991 0.000 1.000
#> GSM862504 2 0.0000 0.991 0.000 1.000
#> GSM862505 2 0.0000 0.991 0.000 1.000
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> GSM862441 1 0.4002 0.825 0.840 0.000 0.160
#> GSM862442 1 0.1411 0.899 0.964 0.000 0.036
#> GSM862443 1 0.0892 0.903 0.980 0.000 0.020
#> GSM862444 1 0.4062 0.822 0.836 0.000 0.164
#> GSM862445 1 0.4062 0.822 0.836 0.000 0.164
#> GSM862446 1 0.1411 0.899 0.964 0.000 0.036
#> GSM862447 1 0.1411 0.899 0.964 0.000 0.036
#> GSM862448 1 0.1411 0.899 0.964 0.000 0.036
#> GSM862449 3 0.5363 0.487 0.276 0.000 0.724
#> GSM862450 1 0.4062 0.822 0.836 0.000 0.164
#> GSM862451 1 0.0000 0.904 1.000 0.000 0.000
#> GSM862453 1 0.1411 0.899 0.964 0.000 0.036
#> GSM862454 1 0.0000 0.904 1.000 0.000 0.000
#> GSM862455 1 0.0000 0.904 1.000 0.000 0.000
#> GSM862456 1 0.0000 0.904 1.000 0.000 0.000
#> GSM862457 1 0.4062 0.822 0.836 0.000 0.164
#> GSM862458 2 0.4062 0.770 0.000 0.836 0.164
#> GSM862459 1 0.0237 0.903 0.996 0.000 0.004
#> GSM862460 1 0.1411 0.899 0.964 0.000 0.036
#> GSM862461 1 0.0000 0.904 1.000 0.000 0.000
#> GSM862462 1 0.4062 0.822 0.836 0.000 0.164
#> GSM862463 1 0.0000 0.904 1.000 0.000 0.000
#> GSM862464 1 0.0892 0.903 0.980 0.000 0.020
#> GSM862465 1 0.7880 0.524 0.668 0.168 0.164
#> GSM862466 1 0.1411 0.899 0.964 0.000 0.036
#> GSM862467 1 0.1411 0.899 0.964 0.000 0.036
#> GSM862468 1 0.6699 0.689 0.744 0.092 0.164
#> GSM862469 2 0.0000 0.994 0.000 1.000 0.000
#> GSM862470 2 0.0000 0.994 0.000 1.000 0.000
#> GSM862471 2 0.0000 0.994 0.000 1.000 0.000
#> GSM862472 2 0.0000 0.994 0.000 1.000 0.000
#> GSM862473 2 0.0000 0.994 0.000 1.000 0.000
#> GSM862474 2 0.0000 0.994 0.000 1.000 0.000
#> GSM862475 2 0.0000 0.994 0.000 1.000 0.000
#> GSM862476 2 0.0000 0.994 0.000 1.000 0.000
#> GSM862477 2 0.0000 0.994 0.000 1.000 0.000
#> GSM862478 2 0.0000 0.994 0.000 1.000 0.000
#> GSM862479 2 0.0000 0.994 0.000 1.000 0.000
#> GSM862480 2 0.0000 0.994 0.000 1.000 0.000
#> GSM862481 2 0.0000 0.994 0.000 1.000 0.000
#> GSM862482 2 0.1163 0.962 0.000 0.972 0.028
#> GSM862483 3 0.4555 0.624 0.000 0.200 0.800
#> GSM862484 2 0.0000 0.994 0.000 1.000 0.000
#> GSM862485 2 0.0000 0.994 0.000 1.000 0.000
#> GSM862486 2 0.0000 0.994 0.000 1.000 0.000
#> GSM862487 2 0.0000 0.994 0.000 1.000 0.000
#> GSM862488 2 0.0000 0.994 0.000 1.000 0.000
#> GSM862489 2 0.0000 0.994 0.000 1.000 0.000
#> GSM862490 2 0.0000 0.994 0.000 1.000 0.000
#> GSM862491 2 0.0000 0.994 0.000 1.000 0.000
#> GSM862492 2 0.0000 0.994 0.000 1.000 0.000
#> GSM862493 2 0.0000 0.994 0.000 1.000 0.000
#> GSM862494 2 0.0000 0.994 0.000 1.000 0.000
#> GSM862495 2 0.0000 0.994 0.000 1.000 0.000
#> GSM862496 2 0.0000 0.994 0.000 1.000 0.000
#> GSM862497 2 0.0000 0.994 0.000 1.000 0.000
#> GSM862498 2 0.0000 0.994 0.000 1.000 0.000
#> GSM862499 2 0.0000 0.994 0.000 1.000 0.000
#> GSM862500 2 0.0000 0.994 0.000 1.000 0.000
#> GSM862501 2 0.0000 0.994 0.000 1.000 0.000
#> GSM862502 2 0.0000 0.994 0.000 1.000 0.000
#> GSM862503 2 0.0000 0.994 0.000 1.000 0.000
#> GSM862504 2 0.0000 0.994 0.000 1.000 0.000
#> GSM862505 2 0.0000 0.994 0.000 1.000 0.000
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> GSM862441 4 0.584 0.870 0.168 0.000 0.128 0.704
#> GSM862442 1 0.000 1.000 1.000 0.000 0.000 0.000
#> GSM862443 4 0.462 0.783 0.340 0.000 0.000 0.660
#> GSM862444 4 0.589 0.869 0.168 0.000 0.132 0.700
#> GSM862445 4 0.589 0.869 0.168 0.000 0.132 0.700
#> GSM862446 1 0.000 1.000 1.000 0.000 0.000 0.000
#> GSM862447 1 0.000 1.000 1.000 0.000 0.000 0.000
#> GSM862448 1 0.000 1.000 1.000 0.000 0.000 0.000
#> GSM862449 3 0.475 0.442 0.304 0.000 0.688 0.008
#> GSM862450 4 0.589 0.869 0.168 0.000 0.132 0.700
#> GSM862451 4 0.361 0.871 0.200 0.000 0.000 0.800
#> GSM862453 1 0.000 1.000 1.000 0.000 0.000 0.000
#> GSM862454 4 0.373 0.868 0.212 0.000 0.000 0.788
#> GSM862455 4 0.373 0.868 0.212 0.000 0.000 0.788
#> GSM862456 4 0.373 0.868 0.212 0.000 0.000 0.788
#> GSM862457 4 0.589 0.869 0.168 0.000 0.132 0.700
#> GSM862458 2 0.380 0.780 0.000 0.836 0.132 0.032
#> GSM862459 4 0.357 0.872 0.196 0.000 0.000 0.804
#> GSM862460 1 0.000 1.000 1.000 0.000 0.000 0.000
#> GSM862461 4 0.361 0.871 0.200 0.000 0.000 0.800
#> GSM862462 4 0.589 0.869 0.168 0.000 0.132 0.700
#> GSM862463 4 0.373 0.868 0.212 0.000 0.000 0.788
#> GSM862464 4 0.462 0.783 0.340 0.000 0.000 0.660
#> GSM862465 4 0.327 0.690 0.012 0.000 0.132 0.856
#> GSM862466 1 0.000 1.000 1.000 0.000 0.000 0.000
#> GSM862467 1 0.000 1.000 1.000 0.000 0.000 0.000
#> GSM862468 4 0.673 0.744 0.076 0.092 0.132 0.700
#> GSM862469 2 0.000 0.984 0.000 1.000 0.000 0.000
#> GSM862470 2 0.000 0.984 0.000 1.000 0.000 0.000
#> GSM862471 2 0.000 0.984 0.000 1.000 0.000 0.000
#> GSM862472 2 0.000 0.984 0.000 1.000 0.000 0.000
#> GSM862473 2 0.000 0.984 0.000 1.000 0.000 0.000
#> GSM862474 2 0.000 0.984 0.000 1.000 0.000 0.000
#> GSM862475 2 0.000 0.984 0.000 1.000 0.000 0.000
#> GSM862476 2 0.000 0.984 0.000 1.000 0.000 0.000
#> GSM862477 2 0.000 0.984 0.000 1.000 0.000 0.000
#> GSM862478 2 0.000 0.984 0.000 1.000 0.000 0.000
#> GSM862479 2 0.000 0.984 0.000 1.000 0.000 0.000
#> GSM862480 2 0.000 0.984 0.000 1.000 0.000 0.000
#> GSM862481 2 0.000 0.984 0.000 1.000 0.000 0.000
#> GSM862482 2 0.104 0.956 0.000 0.972 0.020 0.008
#> GSM862483 3 0.281 0.605 0.000 0.132 0.868 0.000
#> GSM862484 2 0.000 0.984 0.000 1.000 0.000 0.000
#> GSM862485 2 0.000 0.984 0.000 1.000 0.000 0.000
#> GSM862486 2 0.000 0.984 0.000 1.000 0.000 0.000
#> GSM862487 2 0.000 0.984 0.000 1.000 0.000 0.000
#> GSM862488 2 0.000 0.984 0.000 1.000 0.000 0.000
#> GSM862489 2 0.000 0.984 0.000 1.000 0.000 0.000
#> GSM862490 2 0.000 0.984 0.000 1.000 0.000 0.000
#> GSM862491 2 0.000 0.984 0.000 1.000 0.000 0.000
#> GSM862492 2 0.000 0.984 0.000 1.000 0.000 0.000
#> GSM862493 2 0.000 0.984 0.000 1.000 0.000 0.000
#> GSM862494 2 0.000 0.984 0.000 1.000 0.000 0.000
#> GSM862495 2 0.000 0.984 0.000 1.000 0.000 0.000
#> GSM862496 2 0.000 0.984 0.000 1.000 0.000 0.000
#> GSM862497 2 0.000 0.984 0.000 1.000 0.000 0.000
#> GSM862498 2 0.000 0.984 0.000 1.000 0.000 0.000
#> GSM862499 2 0.000 0.984 0.000 1.000 0.000 0.000
#> GSM862500 2 0.000 0.984 0.000 1.000 0.000 0.000
#> GSM862501 2 0.000 0.984 0.000 1.000 0.000 0.000
#> GSM862502 2 0.327 0.795 0.000 0.832 0.000 0.168
#> GSM862503 2 0.000 0.984 0.000 1.000 0.000 0.000
#> GSM862504 2 0.000 0.984 0.000 1.000 0.000 0.000
#> GSM862505 2 0.327 0.795 0.000 0.832 0.000 0.168
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> GSM862441 4 0.0510 0.782 0.000 0.000 0.000 0.984 0.016
#> GSM862442 1 0.1908 1.000 0.908 0.000 0.000 0.092 0.000
#> GSM862443 4 0.3304 0.609 0.168 0.000 0.000 0.816 0.016
#> GSM862444 4 0.0000 0.789 0.000 0.000 0.000 1.000 0.000
#> GSM862445 4 0.0000 0.789 0.000 0.000 0.000 1.000 0.000
#> GSM862446 1 0.1908 1.000 0.908 0.000 0.000 0.092 0.000
#> GSM862447 1 0.1908 1.000 0.908 0.000 0.000 0.092 0.000
#> GSM862448 1 0.1908 1.000 0.908 0.000 0.000 0.092 0.000
#> GSM862449 3 0.4088 0.553 0.304 0.000 0.688 0.008 0.000
#> GSM862450 4 0.0000 0.789 0.000 0.000 0.000 1.000 0.000
#> GSM862451 4 0.3336 0.517 0.000 0.000 0.000 0.772 0.228
#> GSM862453 1 0.1908 1.000 0.908 0.000 0.000 0.092 0.000
#> GSM862454 5 0.5091 1.000 0.044 0.000 0.000 0.372 0.584
#> GSM862455 5 0.5091 1.000 0.044 0.000 0.000 0.372 0.584
#> GSM862456 5 0.5091 1.000 0.044 0.000 0.000 0.372 0.584
#> GSM862457 4 0.0000 0.789 0.000 0.000 0.000 1.000 0.000
#> GSM862458 2 0.5659 0.661 0.000 0.632 0.000 0.164 0.204
#> GSM862459 4 0.3242 0.546 0.000 0.000 0.000 0.784 0.216
#> GSM862460 1 0.1908 1.000 0.908 0.000 0.000 0.092 0.000
#> GSM862461 4 0.2966 0.610 0.000 0.000 0.000 0.816 0.184
#> GSM862462 4 0.0000 0.789 0.000 0.000 0.000 1.000 0.000
#> GSM862463 5 0.5091 1.000 0.044 0.000 0.000 0.372 0.584
#> GSM862464 4 0.3304 0.609 0.168 0.000 0.000 0.816 0.016
#> GSM862465 4 0.5013 0.331 0.100 0.000 0.000 0.696 0.204
#> GSM862466 1 0.1908 1.000 0.908 0.000 0.000 0.092 0.000
#> GSM862467 1 0.1908 1.000 0.908 0.000 0.000 0.092 0.000
#> GSM862468 4 0.1908 0.678 0.000 0.000 0.000 0.908 0.092
#> GSM862469 2 0.3177 0.845 0.000 0.792 0.000 0.000 0.208
#> GSM862470 2 0.0000 0.898 0.000 1.000 0.000 0.000 0.000
#> GSM862471 2 0.3177 0.845 0.000 0.792 0.000 0.000 0.208
#> GSM862472 2 0.3177 0.845 0.000 0.792 0.000 0.000 0.208
#> GSM862473 2 0.0000 0.898 0.000 1.000 0.000 0.000 0.000
#> GSM862474 2 0.0162 0.898 0.000 0.996 0.000 0.000 0.004
#> GSM862475 2 0.0000 0.898 0.000 1.000 0.000 0.000 0.000
#> GSM862476 2 0.0162 0.898 0.000 0.996 0.000 0.000 0.004
#> GSM862477 2 0.0000 0.898 0.000 1.000 0.000 0.000 0.000
#> GSM862478 2 0.3177 0.845 0.000 0.792 0.000 0.000 0.208
#> GSM862479 2 0.3177 0.845 0.000 0.792 0.000 0.000 0.208
#> GSM862480 2 0.0162 0.897 0.000 0.996 0.000 0.000 0.004
#> GSM862481 2 0.0000 0.898 0.000 1.000 0.000 0.000 0.000
#> GSM862482 2 0.1082 0.886 0.000 0.964 0.000 0.028 0.008
#> GSM862483 3 0.0000 0.647 0.000 0.000 1.000 0.000 0.000
#> GSM862484 2 0.0162 0.898 0.000 0.996 0.000 0.000 0.004
#> GSM862485 2 0.3143 0.846 0.000 0.796 0.000 0.000 0.204
#> GSM862486 2 0.1671 0.886 0.000 0.924 0.000 0.000 0.076
#> GSM862487 2 0.2605 0.867 0.000 0.852 0.000 0.000 0.148
#> GSM862488 2 0.3177 0.845 0.000 0.792 0.000 0.000 0.208
#> GSM862489 2 0.0000 0.898 0.000 1.000 0.000 0.000 0.000
#> GSM862490 2 0.0000 0.898 0.000 1.000 0.000 0.000 0.000
#> GSM862491 2 0.3177 0.845 0.000 0.792 0.000 0.000 0.208
#> GSM862492 2 0.2605 0.867 0.000 0.852 0.000 0.000 0.148
#> GSM862493 2 0.0000 0.898 0.000 1.000 0.000 0.000 0.000
#> GSM862494 2 0.3177 0.845 0.000 0.792 0.000 0.000 0.208
#> GSM862495 2 0.0510 0.891 0.000 0.984 0.000 0.000 0.016
#> GSM862496 2 0.0162 0.897 0.000 0.996 0.000 0.000 0.004
#> GSM862497 2 0.0162 0.897 0.000 0.996 0.000 0.000 0.004
#> GSM862498 2 0.0000 0.898 0.000 1.000 0.000 0.000 0.000
#> GSM862499 2 0.3177 0.845 0.000 0.792 0.000 0.000 0.208
#> GSM862500 2 0.3177 0.845 0.000 0.792 0.000 0.000 0.208
#> GSM862501 2 0.2127 0.828 0.000 0.892 0.000 0.000 0.108
#> GSM862502 2 0.4064 0.714 0.092 0.792 0.000 0.000 0.116
#> GSM862503 2 0.0000 0.898 0.000 1.000 0.000 0.000 0.000
#> GSM862504 2 0.0162 0.898 0.000 0.996 0.000 0.000 0.004
#> GSM862505 2 0.4064 0.714 0.092 0.792 0.000 0.000 0.116
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> GSM862441 4 0.2823 0.665 0.000 0.000 0.000 0.796 0.000 0.204
#> GSM862442 1 0.0000 1.000 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM862443 4 0.3172 0.698 0.148 0.000 0.000 0.816 0.036 0.000
#> GSM862444 4 0.0000 0.783 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM862445 4 0.0000 0.783 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM862446 1 0.0000 1.000 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM862447 1 0.0000 1.000 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM862448 1 0.0000 1.000 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM862449 5 0.6196 -0.747 0.284 0.268 0.000 0.008 0.440 0.000
#> GSM862450 4 0.0000 0.783 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM862451 4 0.3804 0.374 0.000 0.000 0.000 0.576 0.000 0.424
#> GSM862453 1 0.0000 1.000 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM862454 6 0.2030 1.000 0.028 0.000 0.000 0.064 0.000 0.908
#> GSM862455 6 0.2030 1.000 0.028 0.000 0.000 0.064 0.000 0.908
#> GSM862456 6 0.2030 1.000 0.028 0.000 0.000 0.064 0.000 0.908
#> GSM862457 4 0.0000 0.783 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM862458 5 0.5989 -0.422 0.000 0.020 0.420 0.132 0.428 0.000
#> GSM862459 4 0.3756 0.423 0.000 0.000 0.000 0.600 0.000 0.400
#> GSM862460 1 0.0000 1.000 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM862461 4 0.4076 0.479 0.000 0.000 0.000 0.620 0.016 0.364
#> GSM862462 4 0.0000 0.783 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM862463 6 0.2030 1.000 0.028 0.000 0.000 0.064 0.000 0.908
#> GSM862464 4 0.3172 0.698 0.148 0.000 0.000 0.816 0.036 0.000
#> GSM862465 4 0.4800 0.481 0.000 0.168 0.000 0.672 0.000 0.160
#> GSM862466 1 0.0000 1.000 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM862467 1 0.0000 1.000 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM862468 4 0.1714 0.731 0.000 0.000 0.000 0.908 0.000 0.092
#> GSM862469 3 0.3857 0.334 0.000 0.000 0.532 0.000 0.468 0.000
#> GSM862470 3 0.0622 0.661 0.000 0.012 0.980 0.000 0.008 0.000
#> GSM862471 3 0.3857 0.334 0.000 0.000 0.532 0.000 0.468 0.000
#> GSM862472 3 0.3851 0.341 0.000 0.000 0.540 0.000 0.460 0.000
#> GSM862473 3 0.0363 0.666 0.000 0.000 0.988 0.000 0.012 0.000
#> GSM862474 3 0.0632 0.664 0.000 0.000 0.976 0.000 0.024 0.000
#> GSM862475 3 0.0405 0.665 0.000 0.004 0.988 0.000 0.008 0.000
#> GSM862476 3 0.0632 0.664 0.000 0.000 0.976 0.000 0.024 0.000
#> GSM862477 3 0.0725 0.663 0.000 0.012 0.976 0.000 0.012 0.000
#> GSM862478 3 0.3860 0.328 0.000 0.000 0.528 0.000 0.472 0.000
#> GSM862479 3 0.3857 0.334 0.000 0.000 0.532 0.000 0.468 0.000
#> GSM862480 3 0.2003 0.595 0.000 0.116 0.884 0.000 0.000 0.000
#> GSM862481 3 0.0363 0.666 0.000 0.000 0.988 0.000 0.012 0.000
#> GSM862482 3 0.1327 0.650 0.000 0.000 0.936 0.000 0.064 0.000
#> GSM862483 2 0.3797 0.000 0.000 0.580 0.000 0.000 0.420 0.000
#> GSM862484 3 0.0632 0.664 0.000 0.000 0.976 0.000 0.024 0.000
#> GSM862485 3 0.4338 0.251 0.000 0.020 0.496 0.000 0.484 0.000
#> GSM862486 3 0.1910 0.628 0.000 0.000 0.892 0.000 0.108 0.000
#> GSM862487 3 0.3747 0.397 0.000 0.000 0.604 0.000 0.396 0.000
#> GSM862488 3 0.3860 0.328 0.000 0.000 0.528 0.000 0.472 0.000
#> GSM862489 3 0.0508 0.662 0.000 0.012 0.984 0.000 0.004 0.000
#> GSM862490 3 0.0622 0.661 0.000 0.012 0.980 0.000 0.008 0.000
#> GSM862491 3 0.3857 0.334 0.000 0.000 0.532 0.000 0.468 0.000
#> GSM862492 3 0.3747 0.397 0.000 0.000 0.604 0.000 0.396 0.000
#> GSM862493 3 0.0725 0.663 0.000 0.012 0.976 0.000 0.012 0.000
#> GSM862494 3 0.3860 0.328 0.000 0.000 0.528 0.000 0.472 0.000
#> GSM862495 3 0.2823 0.509 0.000 0.204 0.796 0.000 0.000 0.000
#> GSM862496 3 0.2003 0.595 0.000 0.116 0.884 0.000 0.000 0.000
#> GSM862497 3 0.2003 0.595 0.000 0.116 0.884 0.000 0.000 0.000
#> GSM862498 3 0.0405 0.665 0.000 0.004 0.988 0.000 0.008 0.000
#> GSM862499 3 0.3860 0.328 0.000 0.000 0.528 0.000 0.472 0.000
#> GSM862500 3 0.3860 0.328 0.000 0.000 0.528 0.000 0.472 0.000
#> GSM862501 3 0.4658 0.389 0.000 0.204 0.696 0.000 0.008 0.092
#> GSM862502 3 0.4032 0.204 0.000 0.420 0.572 0.000 0.008 0.000
#> GSM862503 3 0.0508 0.662 0.000 0.012 0.984 0.000 0.004 0.000
#> GSM862504 3 0.0632 0.664 0.000 0.000 0.976 0.000 0.024 0.000
#> GSM862505 3 0.3797 0.210 0.000 0.420 0.580 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 tissue(p) k
#> CV:hclust 64 4.53e-13 2
#> CV:hclust 63 1.55e-13 3
#> CV:hclust 63 9.68e-13 4
#> CV:hclust 63 1.28e-11 5
#> CV:hclust 41 6.54e-09 6
If matrix rows can be associated to genes, consider to use functional_enrichment(res,
...)
to perform function enrichment for the signature genes. See this vignette for more detailed explanations.
The object with results only for a single top-value method and a single partition method can be extracted as:
res = res_list["CV", "kmeans"]
# you can also extract it by
# res = res_list["CV:kmeans"]
A summary of res
and all the functions that can be applied to it:
res
#> A 'ConsensusPartition' object with k = 2, 3, 4, 5, 6.
#> On a matrix with 51941 rows and 64 columns.
#> Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'CV' method.
#> Subgroups are detected by 'kmeans' method.
#> Performed in total 1250 partitions by row resampling.
#> Best k for subgroups seems to be 2.
#>
#> Following methods can be applied to this 'ConsensusPartition' object:
#> [1] "cola_report" "collect_classes" "collect_plots"
#> [4] "collect_stats" "colnames" "compare_signatures"
#> [7] "consensus_heatmap" "dimension_reduction" "functional_enrichment"
#> [10] "get_anno_col" "get_anno" "get_classes"
#> [13] "get_consensus" "get_matrix" "get_membership"
#> [16] "get_param" "get_signatures" "get_stats"
#> [19] "is_best_k" "is_stable_k" "membership_heatmap"
#> [22] "ncol" "nrow" "plot_ecdf"
#> [25] "rownames" "select_partition_number" "show"
#> [28] "suggest_best_k" "test_to_known_factors"
collect_plots()
function collects all the plots made from res
for all k
(number of partitions)
into one single page to provide an easy and fast comparison between different k
.
collect_plots(res)
The plots are:
k
and the heatmap of
predicted classes for each k
.k
.k
.k
.All the plots in panels can be made by individual functions and they are plotted later in this section.
select_partition_number()
produces several plots showing different
statistics for choosing “optimized” k
. There are following statistics:
k
;k
, the area increased is defined as \(A_k - A_{k-1}\).The detailed explanations of these statistics can be found in the cola vignette.
Generally speaking, lower PAC score, higher mean silhouette score or higher
concordance corresponds to better partition. Rand index and Jaccard index
measure how similar the current partition is compared to partition with k-1
.
If they are too similar, we won't accept k
is better than k-1
.
select_partition_number(res)
The numeric values for all these statistics can be obtained by get_stats()
.
get_stats(res)
#> k 1-PAC mean_silhouette concordance area_increased Rand Jaccard
#> 2 2 1.000 1.000 1.000 0.4906 0.510 0.510
#> 3 3 0.735 0.876 0.827 0.2625 0.833 0.673
#> 4 4 0.619 0.787 0.783 0.1390 0.918 0.762
#> 5 5 0.642 0.786 0.773 0.0726 0.976 0.914
#> 6 6 0.680 0.510 0.675 0.0532 0.914 0.682
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
#> GSM862441 1 0 1 1 0
#> GSM862442 1 0 1 1 0
#> GSM862443 1 0 1 1 0
#> GSM862444 1 0 1 1 0
#> GSM862445 1 0 1 1 0
#> GSM862446 1 0 1 1 0
#> GSM862447 1 0 1 1 0
#> GSM862448 1 0 1 1 0
#> GSM862449 1 0 1 1 0
#> GSM862450 1 0 1 1 0
#> GSM862451 1 0 1 1 0
#> GSM862453 1 0 1 1 0
#> GSM862454 1 0 1 1 0
#> GSM862455 1 0 1 1 0
#> GSM862456 1 0 1 1 0
#> GSM862457 1 0 1 1 0
#> GSM862458 2 0 1 0 1
#> GSM862459 1 0 1 1 0
#> GSM862460 1 0 1 1 0
#> GSM862461 1 0 1 1 0
#> GSM862462 1 0 1 1 0
#> GSM862463 1 0 1 1 0
#> GSM862464 1 0 1 1 0
#> GSM862465 1 0 1 1 0
#> GSM862466 1 0 1 1 0
#> GSM862467 1 0 1 1 0
#> GSM862468 1 0 1 1 0
#> GSM862469 2 0 1 0 1
#> GSM862470 2 0 1 0 1
#> GSM862471 2 0 1 0 1
#> GSM862472 2 0 1 0 1
#> GSM862473 2 0 1 0 1
#> GSM862474 2 0 1 0 1
#> GSM862475 2 0 1 0 1
#> GSM862476 2 0 1 0 1
#> GSM862477 2 0 1 0 1
#> GSM862478 2 0 1 0 1
#> GSM862479 2 0 1 0 1
#> GSM862480 2 0 1 0 1
#> GSM862481 2 0 1 0 1
#> GSM862482 2 0 1 0 1
#> GSM862483 2 0 1 0 1
#> GSM862484 2 0 1 0 1
#> GSM862485 2 0 1 0 1
#> GSM862486 2 0 1 0 1
#> GSM862487 2 0 1 0 1
#> GSM862488 2 0 1 0 1
#> GSM862489 2 0 1 0 1
#> GSM862490 2 0 1 0 1
#> GSM862491 2 0 1 0 1
#> GSM862492 2 0 1 0 1
#> GSM862493 2 0 1 0 1
#> GSM862494 2 0 1 0 1
#> GSM862495 2 0 1 0 1
#> GSM862496 2 0 1 0 1
#> GSM862497 2 0 1 0 1
#> GSM862498 2 0 1 0 1
#> GSM862499 2 0 1 0 1
#> GSM862500 2 0 1 0 1
#> GSM862501 2 0 1 0 1
#> GSM862502 2 0 1 0 1
#> GSM862503 2 0 1 0 1
#> GSM862504 2 0 1 0 1
#> GSM862505 2 0 1 0 1
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> GSM862441 1 0.0592 0.891 0.988 0.000 0.012
#> GSM862442 1 0.5810 0.822 0.664 0.000 0.336
#> GSM862443 1 0.1860 0.888 0.948 0.000 0.052
#> GSM862444 1 0.0592 0.891 0.988 0.000 0.012
#> GSM862445 1 0.0424 0.891 0.992 0.000 0.008
#> GSM862446 1 0.5650 0.822 0.688 0.000 0.312
#> GSM862447 1 0.5650 0.822 0.688 0.000 0.312
#> GSM862448 1 0.5678 0.823 0.684 0.000 0.316
#> GSM862449 1 0.5810 0.806 0.664 0.000 0.336
#> GSM862450 1 0.0000 0.892 1.000 0.000 0.000
#> GSM862451 1 0.2165 0.883 0.936 0.000 0.064
#> GSM862453 1 0.5810 0.822 0.664 0.000 0.336
#> GSM862454 1 0.2796 0.885 0.908 0.000 0.092
#> GSM862455 1 0.2537 0.884 0.920 0.000 0.080
#> GSM862456 1 0.2796 0.885 0.908 0.000 0.092
#> GSM862457 1 0.0000 0.892 1.000 0.000 0.000
#> GSM862458 3 0.7533 0.890 0.044 0.392 0.564
#> GSM862459 1 0.2165 0.883 0.936 0.000 0.064
#> GSM862460 1 0.5810 0.822 0.664 0.000 0.336
#> GSM862461 1 0.1289 0.890 0.968 0.000 0.032
#> GSM862462 1 0.0000 0.892 1.000 0.000 0.000
#> GSM862463 1 0.2796 0.885 0.908 0.000 0.092
#> GSM862464 1 0.1860 0.888 0.948 0.000 0.052
#> GSM862465 1 0.2625 0.883 0.916 0.000 0.084
#> GSM862466 1 0.5678 0.823 0.684 0.000 0.316
#> GSM862467 1 0.5810 0.822 0.664 0.000 0.336
#> GSM862468 1 0.0000 0.892 1.000 0.000 0.000
#> GSM862469 3 0.6252 0.986 0.000 0.444 0.556
#> GSM862470 2 0.0892 0.906 0.000 0.980 0.020
#> GSM862471 3 0.6252 0.986 0.000 0.444 0.556
#> GSM862472 3 0.6260 0.989 0.000 0.448 0.552
#> GSM862473 2 0.5178 0.255 0.000 0.744 0.256
#> GSM862474 2 0.0747 0.907 0.000 0.984 0.016
#> GSM862475 2 0.0237 0.908 0.000 0.996 0.004
#> GSM862476 2 0.0747 0.907 0.000 0.984 0.016
#> GSM862477 2 0.0892 0.906 0.000 0.980 0.020
#> GSM862478 3 0.6260 0.989 0.000 0.448 0.552
#> GSM862479 3 0.6252 0.986 0.000 0.444 0.556
#> GSM862480 2 0.3412 0.722 0.000 0.876 0.124
#> GSM862481 2 0.5178 0.255 0.000 0.744 0.256
#> GSM862482 2 0.0747 0.907 0.000 0.984 0.016
#> GSM862483 2 0.2066 0.854 0.000 0.940 0.060
#> GSM862484 2 0.0747 0.907 0.000 0.984 0.016
#> GSM862485 3 0.6252 0.986 0.000 0.444 0.556
#> GSM862486 2 0.0237 0.908 0.000 0.996 0.004
#> GSM862487 3 0.6260 0.989 0.000 0.448 0.552
#> GSM862488 3 0.6260 0.989 0.000 0.448 0.552
#> GSM862489 2 0.0000 0.907 0.000 1.000 0.000
#> GSM862490 2 0.0237 0.908 0.000 0.996 0.004
#> GSM862491 3 0.6260 0.989 0.000 0.448 0.552
#> GSM862492 3 0.6260 0.989 0.000 0.448 0.552
#> GSM862493 2 0.0892 0.906 0.000 0.980 0.020
#> GSM862494 3 0.6260 0.989 0.000 0.448 0.552
#> GSM862495 2 0.1031 0.891 0.000 0.976 0.024
#> GSM862496 2 0.3482 0.723 0.000 0.872 0.128
#> GSM862497 2 0.3412 0.722 0.000 0.876 0.124
#> GSM862498 2 0.0237 0.908 0.000 0.996 0.004
#> GSM862499 3 0.6260 0.989 0.000 0.448 0.552
#> GSM862500 3 0.6260 0.989 0.000 0.448 0.552
#> GSM862501 2 0.0592 0.907 0.000 0.988 0.012
#> GSM862502 2 0.0747 0.904 0.000 0.984 0.016
#> GSM862503 2 0.0424 0.908 0.000 0.992 0.008
#> GSM862504 2 0.0747 0.907 0.000 0.984 0.016
#> GSM862505 2 0.0892 0.902 0.000 0.980 0.020
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> GSM862441 4 0.5126 0.827 0.444 0.000 0.004 0.552
#> GSM862442 1 0.1022 0.789 0.968 0.000 0.000 0.032
#> GSM862443 1 0.5550 -0.617 0.552 0.000 0.020 0.428
#> GSM862444 4 0.5126 0.827 0.444 0.000 0.004 0.552
#> GSM862445 4 0.5751 0.800 0.448 0.004 0.020 0.528
#> GSM862446 1 0.0188 0.791 0.996 0.000 0.000 0.004
#> GSM862447 1 0.0188 0.791 0.996 0.000 0.000 0.004
#> GSM862448 1 0.0000 0.793 1.000 0.000 0.000 0.000
#> GSM862449 1 0.3312 0.692 0.876 0.000 0.052 0.072
#> GSM862450 4 0.5493 0.809 0.456 0.000 0.016 0.528
#> GSM862451 4 0.6314 0.816 0.372 0.000 0.068 0.560
#> GSM862453 1 0.1022 0.789 0.968 0.000 0.000 0.032
#> GSM862454 4 0.6510 0.799 0.380 0.000 0.080 0.540
#> GSM862455 4 0.6510 0.799 0.380 0.000 0.080 0.540
#> GSM862456 4 0.6510 0.799 0.380 0.000 0.080 0.540
#> GSM862457 4 0.5497 0.810 0.460 0.000 0.016 0.524
#> GSM862458 3 0.4960 0.772 0.020 0.040 0.784 0.156
#> GSM862459 4 0.5414 0.832 0.376 0.000 0.020 0.604
#> GSM862460 1 0.1022 0.789 0.968 0.000 0.000 0.032
#> GSM862461 4 0.5535 0.832 0.420 0.000 0.020 0.560
#> GSM862462 4 0.5497 0.810 0.460 0.000 0.016 0.524
#> GSM862463 4 0.6510 0.799 0.380 0.000 0.080 0.540
#> GSM862464 1 0.5550 -0.617 0.552 0.000 0.020 0.428
#> GSM862465 4 0.5835 0.816 0.372 0.000 0.040 0.588
#> GSM862466 1 0.0000 0.793 1.000 0.000 0.000 0.000
#> GSM862467 1 0.1022 0.789 0.968 0.000 0.000 0.032
#> GSM862468 4 0.5497 0.810 0.460 0.000 0.016 0.524
#> GSM862469 3 0.4624 0.945 0.000 0.164 0.784 0.052
#> GSM862470 2 0.2635 0.863 0.000 0.904 0.020 0.076
#> GSM862471 3 0.4417 0.947 0.000 0.160 0.796 0.044
#> GSM862472 3 0.4418 0.939 0.000 0.184 0.784 0.032
#> GSM862473 2 0.6058 0.458 0.000 0.632 0.296 0.072
#> GSM862474 2 0.2300 0.861 0.000 0.920 0.016 0.064
#> GSM862475 2 0.1151 0.866 0.000 0.968 0.024 0.008
#> GSM862476 2 0.2300 0.861 0.000 0.920 0.016 0.064
#> GSM862477 2 0.3108 0.852 0.000 0.872 0.016 0.112
#> GSM862478 3 0.3172 0.954 0.000 0.160 0.840 0.000
#> GSM862479 3 0.4624 0.945 0.000 0.164 0.784 0.052
#> GSM862480 2 0.4568 0.756 0.000 0.800 0.124 0.076
#> GSM862481 2 0.6058 0.458 0.000 0.632 0.296 0.072
#> GSM862482 2 0.2413 0.860 0.000 0.916 0.020 0.064
#> GSM862483 2 0.5599 0.729 0.000 0.700 0.072 0.228
#> GSM862484 2 0.2300 0.861 0.000 0.920 0.016 0.064
#> GSM862485 3 0.4656 0.943 0.000 0.160 0.784 0.056
#> GSM862486 2 0.2699 0.864 0.000 0.904 0.028 0.068
#> GSM862487 3 0.4182 0.931 0.000 0.180 0.796 0.024
#> GSM862488 3 0.3355 0.954 0.000 0.160 0.836 0.004
#> GSM862489 2 0.1624 0.865 0.000 0.952 0.028 0.020
#> GSM862490 2 0.2179 0.862 0.000 0.924 0.012 0.064
#> GSM862491 3 0.3695 0.954 0.000 0.156 0.828 0.016
#> GSM862492 3 0.4182 0.931 0.000 0.180 0.796 0.024
#> GSM862493 2 0.2987 0.855 0.000 0.880 0.016 0.104
#> GSM862494 3 0.3355 0.954 0.000 0.160 0.836 0.004
#> GSM862495 2 0.3550 0.824 0.000 0.860 0.044 0.096
#> GSM862496 2 0.4879 0.749 0.000 0.780 0.128 0.092
#> GSM862497 2 0.4568 0.756 0.000 0.800 0.124 0.076
#> GSM862498 2 0.1733 0.868 0.000 0.948 0.028 0.024
#> GSM862499 3 0.3498 0.954 0.000 0.160 0.832 0.008
#> GSM862500 3 0.3498 0.954 0.000 0.160 0.832 0.008
#> GSM862501 2 0.3307 0.845 0.000 0.868 0.028 0.104
#> GSM862502 2 0.3542 0.839 0.000 0.852 0.028 0.120
#> GSM862503 2 0.1975 0.865 0.000 0.936 0.016 0.048
#> GSM862504 2 0.2300 0.861 0.000 0.920 0.016 0.064
#> GSM862505 2 0.3587 0.828 0.000 0.856 0.040 0.104
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> GSM862441 4 0.0000 0.795 0.000 0.000 0.000 1.000 NA
#> GSM862442 1 0.3766 0.955 0.728 0.000 0.000 0.268 NA
#> GSM862443 4 0.2729 0.699 0.084 0.000 0.004 0.884 NA
#> GSM862444 4 0.0451 0.794 0.000 0.000 0.008 0.988 NA
#> GSM862445 4 0.2331 0.762 0.028 0.004 0.016 0.920 NA
#> GSM862446 1 0.3684 0.953 0.720 0.000 0.000 0.280 NA
#> GSM862447 1 0.4635 0.950 0.688 0.000 0.016 0.280 NA
#> GSM862448 1 0.4635 0.950 0.688 0.000 0.016 0.280 NA
#> GSM862449 1 0.6369 0.795 0.604 0.000 0.076 0.256 NA
#> GSM862450 4 0.0579 0.792 0.008 0.000 0.008 0.984 NA
#> GSM862451 4 0.4127 0.711 0.008 0.000 0.000 0.680 NA
#> GSM862453 1 0.3766 0.955 0.728 0.000 0.000 0.268 NA
#> GSM862454 4 0.4668 0.676 0.024 0.000 0.000 0.624 NA
#> GSM862455 4 0.4668 0.676 0.024 0.000 0.000 0.624 NA
#> GSM862456 4 0.4668 0.676 0.024 0.000 0.000 0.624 NA
#> GSM862457 4 0.0579 0.792 0.008 0.000 0.008 0.984 NA
#> GSM862458 3 0.7455 0.413 0.080 0.004 0.492 0.292 NA
#> GSM862459 4 0.2707 0.779 0.008 0.000 0.000 0.860 NA
#> GSM862460 1 0.3766 0.955 0.728 0.000 0.000 0.268 NA
#> GSM862461 4 0.1557 0.792 0.008 0.000 0.000 0.940 NA
#> GSM862462 4 0.0740 0.791 0.008 0.000 0.008 0.980 NA
#> GSM862463 4 0.4668 0.676 0.024 0.000 0.000 0.624 NA
#> GSM862464 4 0.2729 0.699 0.084 0.000 0.004 0.884 NA
#> GSM862465 4 0.4466 0.716 0.024 0.000 0.008 0.712 NA
#> GSM862466 1 0.4635 0.950 0.688 0.000 0.016 0.280 NA
#> GSM862467 1 0.3766 0.955 0.728 0.000 0.000 0.268 NA
#> GSM862468 4 0.0579 0.792 0.008 0.000 0.008 0.984 NA
#> GSM862469 3 0.4302 0.891 0.044 0.088 0.808 0.000 NA
#> GSM862470 2 0.3280 0.783 0.012 0.824 0.004 0.000 NA
#> GSM862471 3 0.4517 0.887 0.064 0.084 0.796 0.000 NA
#> GSM862472 3 0.4608 0.879 0.036 0.104 0.784 0.000 NA
#> GSM862473 2 0.5830 0.451 0.004 0.600 0.276 0.000 NA
#> GSM862474 2 0.3929 0.762 0.036 0.788 0.004 0.000 NA
#> GSM862475 2 0.0727 0.793 0.004 0.980 0.012 0.000 NA
#> GSM862476 2 0.3929 0.762 0.036 0.788 0.004 0.000 NA
#> GSM862477 2 0.3647 0.758 0.004 0.764 0.004 0.000 NA
#> GSM862478 3 0.2420 0.906 0.008 0.088 0.896 0.000 NA
#> GSM862479 3 0.4302 0.891 0.044 0.088 0.808 0.000 NA
#> GSM862480 2 0.5422 0.664 0.024 0.708 0.132 0.000 NA
#> GSM862481 2 0.5830 0.451 0.004 0.600 0.276 0.000 NA
#> GSM862482 2 0.4230 0.754 0.036 0.764 0.008 0.000 NA
#> GSM862483 2 0.6820 0.570 0.092 0.492 0.056 0.000 NA
#> GSM862484 2 0.3966 0.762 0.036 0.784 0.004 0.000 NA
#> GSM862485 3 0.4707 0.882 0.064 0.084 0.784 0.000 NA
#> GSM862486 2 0.2833 0.789 0.004 0.864 0.012 0.000 NA
#> GSM862487 3 0.3593 0.883 0.012 0.096 0.840 0.000 NA
#> GSM862488 3 0.2850 0.905 0.016 0.088 0.880 0.000 NA
#> GSM862489 2 0.1012 0.792 0.000 0.968 0.012 0.000 NA
#> GSM862490 2 0.2589 0.787 0.008 0.888 0.012 0.000 NA
#> GSM862491 3 0.3477 0.902 0.036 0.088 0.852 0.000 NA
#> GSM862492 3 0.3593 0.883 0.012 0.096 0.840 0.000 NA
#> GSM862493 2 0.3352 0.768 0.004 0.800 0.004 0.000 NA
#> GSM862494 3 0.2850 0.905 0.016 0.088 0.880 0.000 NA
#> GSM862495 2 0.5007 0.720 0.048 0.736 0.040 0.000 NA
#> GSM862496 2 0.5916 0.643 0.040 0.672 0.128 0.000 NA
#> GSM862497 2 0.5422 0.664 0.024 0.708 0.132 0.000 NA
#> GSM862498 2 0.1522 0.795 0.000 0.944 0.012 0.000 NA
#> GSM862499 3 0.2407 0.907 0.012 0.088 0.896 0.000 NA
#> GSM862500 3 0.2407 0.907 0.012 0.088 0.896 0.000 NA
#> GSM862501 2 0.4535 0.753 0.072 0.760 0.008 0.000 NA
#> GSM862502 2 0.4733 0.748 0.092 0.748 0.008 0.000 NA
#> GSM862503 2 0.2352 0.792 0.032 0.912 0.008 0.000 NA
#> GSM862504 2 0.3929 0.762 0.036 0.788 0.004 0.000 NA
#> GSM862505 2 0.4909 0.725 0.056 0.740 0.028 0.000 NA
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> GSM862441 4 0.6097 0.6709 0.188 0.000 0.000 0.456 0.012 0.344
#> GSM862442 1 0.1409 0.9125 0.948 0.000 0.008 0.000 0.012 0.032
#> GSM862443 4 0.7175 0.5627 0.248 0.000 0.012 0.396 0.056 0.288
#> GSM862444 4 0.6757 0.6419 0.184 0.000 0.004 0.420 0.048 0.344
#> GSM862445 4 0.6525 0.5676 0.152 0.004 0.004 0.476 0.036 0.328
#> GSM862446 1 0.0405 0.9103 0.988 0.000 0.000 0.008 0.004 0.000
#> GSM862447 1 0.1492 0.9048 0.940 0.000 0.000 0.024 0.036 0.000
#> GSM862448 1 0.1408 0.9063 0.944 0.000 0.000 0.020 0.036 0.000
#> GSM862449 1 0.5602 0.6673 0.648 0.000 0.004 0.128 0.180 0.040
#> GSM862450 4 0.6110 0.6848 0.192 0.000 0.012 0.456 0.000 0.340
#> GSM862451 6 0.3820 0.6386 0.144 0.000 0.000 0.064 0.008 0.784
#> GSM862453 1 0.1409 0.9125 0.948 0.000 0.012 0.000 0.008 0.032
#> GSM862454 6 0.2378 0.7070 0.152 0.000 0.000 0.000 0.000 0.848
#> GSM862455 6 0.2378 0.7070 0.152 0.000 0.000 0.000 0.000 0.848
#> GSM862456 6 0.2378 0.7070 0.152 0.000 0.000 0.000 0.000 0.848
#> GSM862457 4 0.5811 0.6877 0.196 0.000 0.000 0.468 0.000 0.336
#> GSM862458 4 0.4528 0.0329 0.012 0.000 0.260 0.680 0.048 0.000
#> GSM862459 6 0.5856 -0.2785 0.148 0.000 0.000 0.340 0.012 0.500
#> GSM862460 1 0.1409 0.9125 0.948 0.000 0.008 0.000 0.012 0.032
#> GSM862461 6 0.6650 -0.4546 0.168 0.000 0.012 0.348 0.032 0.440
#> GSM862462 4 0.5932 0.6884 0.196 0.000 0.000 0.468 0.004 0.332
#> GSM862463 6 0.2378 0.7070 0.152 0.000 0.000 0.000 0.000 0.848
#> GSM862464 4 0.7175 0.5627 0.248 0.000 0.012 0.396 0.056 0.288
#> GSM862465 6 0.5650 0.4463 0.140 0.000 0.004 0.164 0.044 0.648
#> GSM862466 1 0.1492 0.9048 0.940 0.000 0.000 0.024 0.036 0.000
#> GSM862467 1 0.1409 0.9125 0.948 0.000 0.012 0.000 0.008 0.032
#> GSM862468 4 0.5791 0.6897 0.192 0.000 0.000 0.472 0.000 0.336
#> GSM862469 3 0.3264 0.9012 0.000 0.036 0.844 0.100 0.012 0.008
#> GSM862470 2 0.4424 0.2916 0.000 0.716 0.000 0.032 0.220 0.032
#> GSM862471 3 0.3737 0.8762 0.000 0.036 0.772 0.184 0.008 0.000
#> GSM862472 3 0.4930 0.8545 0.000 0.056 0.724 0.168 0.032 0.020
#> GSM862473 2 0.6638 -0.3246 0.000 0.432 0.200 0.028 0.332 0.008
#> GSM862474 2 0.2601 0.4052 0.000 0.888 0.004 0.068 0.016 0.024
#> GSM862475 2 0.3273 0.1884 0.000 0.776 0.000 0.008 0.212 0.004
#> GSM862476 2 0.2601 0.4052 0.000 0.888 0.004 0.068 0.016 0.024
#> GSM862477 2 0.3067 0.3640 0.000 0.844 0.000 0.020 0.116 0.020
#> GSM862478 3 0.1245 0.9125 0.000 0.032 0.952 0.016 0.000 0.000
#> GSM862479 3 0.3264 0.9012 0.000 0.036 0.844 0.100 0.012 0.008
#> GSM862480 2 0.5506 -0.5542 0.000 0.456 0.084 0.008 0.448 0.004
#> GSM862481 2 0.6638 -0.3246 0.000 0.432 0.200 0.028 0.332 0.008
#> GSM862482 2 0.2882 0.3970 0.000 0.872 0.004 0.076 0.024 0.024
#> GSM862483 2 0.6908 0.0677 0.000 0.468 0.004 0.184 0.268 0.076
#> GSM862484 2 0.2565 0.4061 0.000 0.888 0.004 0.072 0.012 0.024
#> GSM862485 3 0.3933 0.8689 0.000 0.032 0.740 0.220 0.008 0.000
#> GSM862486 2 0.4156 0.3061 0.000 0.728 0.000 0.028 0.224 0.020
#> GSM862487 3 0.3090 0.8939 0.000 0.036 0.872 0.040 0.036 0.016
#> GSM862488 3 0.1720 0.9099 0.000 0.032 0.928 0.040 0.000 0.000
#> GSM862489 2 0.3012 0.2195 0.000 0.796 0.000 0.008 0.196 0.000
#> GSM862490 2 0.4677 0.1978 0.000 0.652 0.000 0.032 0.292 0.024
#> GSM862491 3 0.3828 0.8868 0.000 0.032 0.792 0.152 0.008 0.016
#> GSM862492 3 0.3090 0.8939 0.000 0.036 0.872 0.040 0.036 0.016
#> GSM862493 2 0.1606 0.4049 0.000 0.932 0.000 0.008 0.056 0.004
#> GSM862494 3 0.1720 0.9099 0.000 0.032 0.928 0.040 0.000 0.000
#> GSM862495 5 0.4300 0.5898 0.000 0.432 0.020 0.000 0.548 0.000
#> GSM862496 5 0.5501 0.4429 0.000 0.432 0.084 0.008 0.472 0.004
#> GSM862497 2 0.5506 -0.5542 0.000 0.456 0.084 0.008 0.448 0.004
#> GSM862498 2 0.3018 0.3042 0.000 0.816 0.000 0.012 0.168 0.004
#> GSM862499 3 0.1370 0.9132 0.000 0.036 0.948 0.012 0.004 0.000
#> GSM862500 3 0.1370 0.9132 0.000 0.036 0.948 0.012 0.004 0.000
#> GSM862501 2 0.5310 -0.2758 0.000 0.464 0.000 0.032 0.464 0.040
#> GSM862502 5 0.5414 0.0465 0.000 0.448 0.000 0.032 0.472 0.048
#> GSM862503 2 0.3702 0.1295 0.000 0.720 0.000 0.012 0.264 0.004
#> GSM862504 2 0.2601 0.4052 0.000 0.888 0.004 0.068 0.016 0.024
#> GSM862505 5 0.4446 0.5858 0.000 0.424 0.008 0.000 0.552 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 tissue(p) k
#> CV:kmeans 64 6.95e-14 2
#> CV:kmeans 62 2.28e-13 3
#> CV:kmeans 60 3.85e-12 4
#> CV:kmeans 61 3.59e-13 5
#> CV:kmeans 38 1.12e-07 6
If matrix rows can be associated to genes, consider to use functional_enrichment(res,
...)
to perform function enrichment for the signature genes. See this vignette for more detailed explanations.
The object with results only for a single top-value method and a single partition method can be extracted as:
res = res_list["CV", "skmeans"]
# you can also extract it by
# res = res_list["CV:skmeans"]
A summary of res
and all the functions that can be applied to it:
res
#> A 'ConsensusPartition' object with k = 2, 3, 4, 5, 6.
#> On a matrix with 51941 rows and 64 columns.
#> Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'CV' method.
#> Subgroups are detected by 'skmeans' method.
#> Performed in total 1250 partitions by row resampling.
#> Best k for subgroups seems to be 2.
#>
#> Following methods can be applied to this 'ConsensusPartition' object:
#> [1] "cola_report" "collect_classes" "collect_plots"
#> [4] "collect_stats" "colnames" "compare_signatures"
#> [7] "consensus_heatmap" "dimension_reduction" "functional_enrichment"
#> [10] "get_anno_col" "get_anno" "get_classes"
#> [13] "get_consensus" "get_matrix" "get_membership"
#> [16] "get_param" "get_signatures" "get_stats"
#> [19] "is_best_k" "is_stable_k" "membership_heatmap"
#> [22] "ncol" "nrow" "plot_ecdf"
#> [25] "rownames" "select_partition_number" "show"
#> [28] "suggest_best_k" "test_to_known_factors"
collect_plots()
function collects all the plots made from res
for all k
(number of partitions)
into one single page to provide an easy and fast comparison between different k
.
collect_plots(res)
The plots are:
k
and the heatmap of
predicted classes for each k
.k
.k
.k
.All the plots in panels can be made by individual functions and they are plotted later in this section.
select_partition_number()
produces several plots showing different
statistics for choosing “optimized” k
. There are following statistics:
k
;k
, the area increased is defined as \(A_k - A_{k-1}\).The detailed explanations of these statistics can be found in the cola vignette.
Generally speaking, lower PAC score, higher mean silhouette score or higher
concordance corresponds to better partition. Rand index and Jaccard index
measure how similar the current partition is compared to partition with k-1
.
If they are too similar, we won't accept k
is better than k-1
.
select_partition_number(res)
The numeric values for all these statistics can be obtained by get_stats()
.
get_stats(res)
#> k 1-PAC mean_silhouette concordance area_increased Rand Jaccard
#> 2 2 1.000 0.991 0.996 0.4946 0.504 0.504
#> 3 3 0.756 0.951 0.919 0.2984 0.826 0.659
#> 4 4 0.843 0.924 0.895 0.1449 0.918 0.762
#> 5 5 0.823 0.677 0.798 0.0671 0.937 0.757
#> 6 6 0.795 0.772 0.854 0.0429 0.927 0.686
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
#> GSM862441 1 0.000 0.990 1.000 0.000
#> GSM862442 1 0.000 0.990 1.000 0.000
#> GSM862443 1 0.000 0.990 1.000 0.000
#> GSM862444 1 0.000 0.990 1.000 0.000
#> GSM862445 1 0.000 0.990 1.000 0.000
#> GSM862446 1 0.000 0.990 1.000 0.000
#> GSM862447 1 0.000 0.990 1.000 0.000
#> GSM862448 1 0.000 0.990 1.000 0.000
#> GSM862449 1 0.000 0.990 1.000 0.000
#> GSM862450 1 0.000 0.990 1.000 0.000
#> GSM862451 1 0.000 0.990 1.000 0.000
#> GSM862453 1 0.000 0.990 1.000 0.000
#> GSM862454 1 0.000 0.990 1.000 0.000
#> GSM862455 1 0.000 0.990 1.000 0.000
#> GSM862456 1 0.000 0.990 1.000 0.000
#> GSM862457 1 0.000 0.990 1.000 0.000
#> GSM862458 1 0.821 0.656 0.744 0.256
#> GSM862459 1 0.000 0.990 1.000 0.000
#> GSM862460 1 0.000 0.990 1.000 0.000
#> GSM862461 1 0.000 0.990 1.000 0.000
#> GSM862462 1 0.000 0.990 1.000 0.000
#> GSM862463 1 0.000 0.990 1.000 0.000
#> GSM862464 1 0.000 0.990 1.000 0.000
#> GSM862465 1 0.000 0.990 1.000 0.000
#> GSM862466 1 0.000 0.990 1.000 0.000
#> GSM862467 1 0.000 0.990 1.000 0.000
#> GSM862468 1 0.000 0.990 1.000 0.000
#> GSM862469 2 0.000 1.000 0.000 1.000
#> GSM862470 2 0.000 1.000 0.000 1.000
#> GSM862471 2 0.000 1.000 0.000 1.000
#> GSM862472 2 0.000 1.000 0.000 1.000
#> GSM862473 2 0.000 1.000 0.000 1.000
#> GSM862474 2 0.000 1.000 0.000 1.000
#> GSM862475 2 0.000 1.000 0.000 1.000
#> GSM862476 2 0.000 1.000 0.000 1.000
#> GSM862477 2 0.000 1.000 0.000 1.000
#> GSM862478 2 0.000 1.000 0.000 1.000
#> GSM862479 2 0.000 1.000 0.000 1.000
#> GSM862480 2 0.000 1.000 0.000 1.000
#> GSM862481 2 0.000 1.000 0.000 1.000
#> GSM862482 2 0.000 1.000 0.000 1.000
#> GSM862483 2 0.000 1.000 0.000 1.000
#> GSM862484 2 0.000 1.000 0.000 1.000
#> GSM862485 2 0.000 1.000 0.000 1.000
#> GSM862486 2 0.000 1.000 0.000 1.000
#> GSM862487 2 0.000 1.000 0.000 1.000
#> GSM862488 2 0.000 1.000 0.000 1.000
#> GSM862489 2 0.000 1.000 0.000 1.000
#> GSM862490 2 0.000 1.000 0.000 1.000
#> GSM862491 2 0.000 1.000 0.000 1.000
#> GSM862492 2 0.000 1.000 0.000 1.000
#> GSM862493 2 0.000 1.000 0.000 1.000
#> GSM862494 2 0.000 1.000 0.000 1.000
#> GSM862495 2 0.000 1.000 0.000 1.000
#> GSM862496 2 0.000 1.000 0.000 1.000
#> GSM862497 2 0.000 1.000 0.000 1.000
#> GSM862498 2 0.000 1.000 0.000 1.000
#> GSM862499 2 0.000 1.000 0.000 1.000
#> GSM862500 2 0.000 1.000 0.000 1.000
#> GSM862501 2 0.000 1.000 0.000 1.000
#> GSM862502 2 0.000 1.000 0.000 1.000
#> GSM862503 2 0.000 1.000 0.000 1.000
#> GSM862504 2 0.000 1.000 0.000 1.000
#> GSM862505 2 0.000 1.000 0.000 1.000
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> GSM862441 1 0.460 0.922 0.796 0.204 0.000
#> GSM862442 1 0.000 0.892 1.000 0.000 0.000
#> GSM862443 1 0.000 0.892 1.000 0.000 0.000
#> GSM862444 1 0.460 0.922 0.796 0.204 0.000
#> GSM862445 1 0.460 0.922 0.796 0.204 0.000
#> GSM862446 1 0.000 0.892 1.000 0.000 0.000
#> GSM862447 1 0.000 0.892 1.000 0.000 0.000
#> GSM862448 1 0.000 0.892 1.000 0.000 0.000
#> GSM862449 1 0.000 0.892 1.000 0.000 0.000
#> GSM862450 1 0.460 0.922 0.796 0.204 0.000
#> GSM862451 1 0.460 0.922 0.796 0.204 0.000
#> GSM862453 1 0.000 0.892 1.000 0.000 0.000
#> GSM862454 1 0.460 0.922 0.796 0.204 0.000
#> GSM862455 1 0.460 0.922 0.796 0.204 0.000
#> GSM862456 1 0.460 0.922 0.796 0.204 0.000
#> GSM862457 1 0.460 0.922 0.796 0.204 0.000
#> GSM862458 3 0.483 0.700 0.004 0.204 0.792
#> GSM862459 1 0.460 0.922 0.796 0.204 0.000
#> GSM862460 1 0.000 0.892 1.000 0.000 0.000
#> GSM862461 1 0.460 0.922 0.796 0.204 0.000
#> GSM862462 1 0.460 0.922 0.796 0.204 0.000
#> GSM862463 1 0.460 0.922 0.796 0.204 0.000
#> GSM862464 1 0.000 0.892 1.000 0.000 0.000
#> GSM862465 1 0.460 0.922 0.796 0.204 0.000
#> GSM862466 1 0.000 0.892 1.000 0.000 0.000
#> GSM862467 1 0.000 0.892 1.000 0.000 0.000
#> GSM862468 1 0.460 0.922 0.796 0.204 0.000
#> GSM862469 3 0.000 0.976 0.000 0.000 1.000
#> GSM862470 2 0.460 0.996 0.000 0.796 0.204
#> GSM862471 3 0.000 0.976 0.000 0.000 1.000
#> GSM862472 3 0.000 0.976 0.000 0.000 1.000
#> GSM862473 2 0.493 0.967 0.000 0.768 0.232
#> GSM862474 2 0.460 0.996 0.000 0.796 0.204
#> GSM862475 2 0.460 0.996 0.000 0.796 0.204
#> GSM862476 2 0.460 0.996 0.000 0.796 0.204
#> GSM862477 2 0.460 0.996 0.000 0.796 0.204
#> GSM862478 3 0.000 0.976 0.000 0.000 1.000
#> GSM862479 3 0.000 0.976 0.000 0.000 1.000
#> GSM862480 2 0.465 0.993 0.000 0.792 0.208
#> GSM862481 2 0.493 0.967 0.000 0.768 0.232
#> GSM862482 2 0.460 0.996 0.000 0.796 0.204
#> GSM862483 2 0.460 0.996 0.000 0.796 0.204
#> GSM862484 2 0.460 0.996 0.000 0.796 0.204
#> GSM862485 3 0.000 0.976 0.000 0.000 1.000
#> GSM862486 2 0.460 0.996 0.000 0.796 0.204
#> GSM862487 3 0.000 0.976 0.000 0.000 1.000
#> GSM862488 3 0.000 0.976 0.000 0.000 1.000
#> GSM862489 2 0.460 0.996 0.000 0.796 0.204
#> GSM862490 2 0.460 0.996 0.000 0.796 0.204
#> GSM862491 3 0.000 0.976 0.000 0.000 1.000
#> GSM862492 3 0.000 0.976 0.000 0.000 1.000
#> GSM862493 2 0.460 0.996 0.000 0.796 0.204
#> GSM862494 3 0.000 0.976 0.000 0.000 1.000
#> GSM862495 2 0.460 0.996 0.000 0.796 0.204
#> GSM862496 2 0.465 0.993 0.000 0.792 0.208
#> GSM862497 2 0.465 0.993 0.000 0.792 0.208
#> GSM862498 2 0.460 0.996 0.000 0.796 0.204
#> GSM862499 3 0.000 0.976 0.000 0.000 1.000
#> GSM862500 3 0.000 0.976 0.000 0.000 1.000
#> GSM862501 2 0.460 0.996 0.000 0.796 0.204
#> GSM862502 2 0.460 0.996 0.000 0.796 0.204
#> GSM862503 2 0.460 0.996 0.000 0.796 0.204
#> GSM862504 2 0.460 0.996 0.000 0.796 0.204
#> GSM862505 2 0.460 0.996 0.000 0.796 0.204
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> GSM862441 4 0.4193 0.974 0.268 0.000 0.000 0.732
#> GSM862442 1 0.0000 0.994 1.000 0.000 0.000 0.000
#> GSM862443 1 0.0592 0.982 0.984 0.000 0.000 0.016
#> GSM862444 4 0.4193 0.974 0.268 0.000 0.000 0.732
#> GSM862445 4 0.3942 0.950 0.236 0.000 0.000 0.764
#> GSM862446 1 0.0000 0.994 1.000 0.000 0.000 0.000
#> GSM862447 1 0.0000 0.994 1.000 0.000 0.000 0.000
#> GSM862448 1 0.0000 0.994 1.000 0.000 0.000 0.000
#> GSM862449 1 0.0817 0.968 0.976 0.000 0.000 0.024
#> GSM862450 4 0.4250 0.958 0.276 0.000 0.000 0.724
#> GSM862451 4 0.4304 0.977 0.284 0.000 0.000 0.716
#> GSM862453 1 0.0000 0.994 1.000 0.000 0.000 0.000
#> GSM862454 4 0.4331 0.977 0.288 0.000 0.000 0.712
#> GSM862455 4 0.4331 0.977 0.288 0.000 0.000 0.712
#> GSM862456 4 0.4331 0.977 0.288 0.000 0.000 0.712
#> GSM862457 4 0.4164 0.960 0.264 0.000 0.000 0.736
#> GSM862458 3 0.4697 0.491 0.000 0.000 0.644 0.356
#> GSM862459 4 0.4304 0.977 0.284 0.000 0.000 0.716
#> GSM862460 1 0.0000 0.994 1.000 0.000 0.000 0.000
#> GSM862461 4 0.4250 0.976 0.276 0.000 0.000 0.724
#> GSM862462 4 0.4103 0.962 0.256 0.000 0.000 0.744
#> GSM862463 4 0.4331 0.977 0.288 0.000 0.000 0.712
#> GSM862464 1 0.0336 0.987 0.992 0.000 0.000 0.008
#> GSM862465 4 0.4331 0.977 0.288 0.000 0.000 0.712
#> GSM862466 1 0.0000 0.994 1.000 0.000 0.000 0.000
#> GSM862467 1 0.0000 0.994 1.000 0.000 0.000 0.000
#> GSM862468 4 0.4356 0.966 0.292 0.000 0.000 0.708
#> GSM862469 3 0.0188 0.971 0.000 0.004 0.996 0.000
#> GSM862470 2 0.0707 0.902 0.000 0.980 0.000 0.020
#> GSM862471 3 0.0188 0.971 0.000 0.004 0.996 0.000
#> GSM862472 3 0.0592 0.960 0.000 0.016 0.984 0.000
#> GSM862473 2 0.6828 0.591 0.000 0.588 0.264 0.148
#> GSM862474 2 0.1118 0.899 0.000 0.964 0.000 0.036
#> GSM862475 2 0.1716 0.899 0.000 0.936 0.000 0.064
#> GSM862476 2 0.1118 0.899 0.000 0.964 0.000 0.036
#> GSM862477 2 0.1118 0.899 0.000 0.964 0.000 0.036
#> GSM862478 3 0.0188 0.971 0.000 0.004 0.996 0.000
#> GSM862479 3 0.0188 0.971 0.000 0.004 0.996 0.000
#> GSM862480 2 0.5556 0.802 0.000 0.720 0.092 0.188
#> GSM862481 2 0.6781 0.605 0.000 0.596 0.256 0.148
#> GSM862482 2 0.1305 0.898 0.000 0.960 0.004 0.036
#> GSM862483 2 0.1716 0.890 0.000 0.936 0.000 0.064
#> GSM862484 2 0.1118 0.899 0.000 0.964 0.000 0.036
#> GSM862485 3 0.0188 0.971 0.000 0.004 0.996 0.000
#> GSM862486 2 0.0592 0.902 0.000 0.984 0.000 0.016
#> GSM862487 3 0.0188 0.971 0.000 0.004 0.996 0.000
#> GSM862488 3 0.0188 0.971 0.000 0.004 0.996 0.000
#> GSM862489 2 0.1118 0.903 0.000 0.964 0.000 0.036
#> GSM862490 2 0.1557 0.901 0.000 0.944 0.000 0.056
#> GSM862491 3 0.0188 0.971 0.000 0.004 0.996 0.000
#> GSM862492 3 0.0188 0.971 0.000 0.004 0.996 0.000
#> GSM862493 2 0.0921 0.900 0.000 0.972 0.000 0.028
#> GSM862494 3 0.0188 0.971 0.000 0.004 0.996 0.000
#> GSM862495 2 0.4406 0.846 0.000 0.780 0.028 0.192
#> GSM862496 2 0.5556 0.802 0.000 0.720 0.092 0.188
#> GSM862497 2 0.5556 0.802 0.000 0.720 0.092 0.188
#> GSM862498 2 0.0188 0.903 0.000 0.996 0.000 0.004
#> GSM862499 3 0.0188 0.971 0.000 0.004 0.996 0.000
#> GSM862500 3 0.0188 0.971 0.000 0.004 0.996 0.000
#> GSM862501 2 0.2345 0.894 0.000 0.900 0.000 0.100
#> GSM862502 2 0.2973 0.881 0.000 0.856 0.000 0.144
#> GSM862503 2 0.1792 0.899 0.000 0.932 0.000 0.068
#> GSM862504 2 0.1118 0.899 0.000 0.964 0.000 0.036
#> GSM862505 2 0.4019 0.853 0.000 0.792 0.012 0.196
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> GSM862441 4 0.0579 0.9455 0.008 0.000 0.000 0.984 0.008
#> GSM862442 1 0.0794 0.9826 0.972 0.000 0.000 0.028 0.000
#> GSM862443 1 0.2824 0.9120 0.872 0.000 0.000 0.096 0.032
#> GSM862444 4 0.0798 0.9437 0.008 0.000 0.000 0.976 0.016
#> GSM862445 4 0.2338 0.9067 0.004 0.000 0.000 0.884 0.112
#> GSM862446 1 0.0794 0.9826 0.972 0.000 0.000 0.028 0.000
#> GSM862447 1 0.0794 0.9826 0.972 0.000 0.000 0.028 0.000
#> GSM862448 1 0.0794 0.9826 0.972 0.000 0.000 0.028 0.000
#> GSM862449 1 0.1836 0.9553 0.932 0.000 0.000 0.036 0.032
#> GSM862450 4 0.3532 0.8729 0.048 0.000 0.000 0.824 0.128
#> GSM862451 4 0.0963 0.9499 0.036 0.000 0.000 0.964 0.000
#> GSM862453 1 0.0794 0.9826 0.972 0.000 0.000 0.028 0.000
#> GSM862454 4 0.0963 0.9499 0.036 0.000 0.000 0.964 0.000
#> GSM862455 4 0.0963 0.9499 0.036 0.000 0.000 0.964 0.000
#> GSM862456 4 0.0963 0.9499 0.036 0.000 0.000 0.964 0.000
#> GSM862457 4 0.3134 0.8908 0.032 0.000 0.000 0.848 0.120
#> GSM862458 3 0.7026 0.3431 0.024 0.000 0.416 0.180 0.380
#> GSM862459 4 0.0880 0.9497 0.032 0.000 0.000 0.968 0.000
#> GSM862460 1 0.0794 0.9826 0.972 0.000 0.000 0.028 0.000
#> GSM862461 4 0.1012 0.9470 0.020 0.000 0.000 0.968 0.012
#> GSM862462 4 0.2574 0.9064 0.012 0.000 0.000 0.876 0.112
#> GSM862463 4 0.0963 0.9499 0.036 0.000 0.000 0.964 0.000
#> GSM862464 1 0.2139 0.9507 0.916 0.000 0.000 0.052 0.032
#> GSM862465 4 0.0963 0.9499 0.036 0.000 0.000 0.964 0.000
#> GSM862466 1 0.0794 0.9826 0.972 0.000 0.000 0.028 0.000
#> GSM862467 1 0.0794 0.9826 0.972 0.000 0.000 0.028 0.000
#> GSM862468 4 0.2853 0.9176 0.052 0.000 0.000 0.876 0.072
#> GSM862469 3 0.1444 0.9298 0.012 0.000 0.948 0.000 0.040
#> GSM862470 5 0.4451 0.6047 0.004 0.492 0.000 0.000 0.504
#> GSM862471 3 0.1012 0.9350 0.012 0.000 0.968 0.000 0.020
#> GSM862472 3 0.2299 0.9018 0.004 0.052 0.912 0.000 0.032
#> GSM862473 2 0.4709 0.3408 0.004 0.728 0.200 0.000 0.068
#> GSM862474 5 0.4452 0.7589 0.004 0.496 0.000 0.000 0.500
#> GSM862475 2 0.3636 0.0187 0.000 0.728 0.000 0.000 0.272
#> GSM862476 5 0.4452 0.7589 0.004 0.496 0.000 0.000 0.500
#> GSM862477 5 0.4302 0.6981 0.000 0.480 0.000 0.000 0.520
#> GSM862478 3 0.0162 0.9384 0.000 0.000 0.996 0.000 0.004
#> GSM862479 3 0.1444 0.9298 0.012 0.000 0.948 0.000 0.040
#> GSM862480 2 0.1662 0.4584 0.004 0.936 0.056 0.000 0.004
#> GSM862481 2 0.4677 0.3438 0.004 0.732 0.196 0.000 0.068
#> GSM862482 5 0.4410 0.7182 0.004 0.440 0.000 0.000 0.556
#> GSM862483 5 0.4109 0.4634 0.012 0.288 0.000 0.000 0.700
#> GSM862484 5 0.4450 0.7639 0.004 0.488 0.000 0.000 0.508
#> GSM862485 3 0.1670 0.9250 0.012 0.000 0.936 0.000 0.052
#> GSM862486 2 0.4434 -0.6082 0.004 0.536 0.000 0.000 0.460
#> GSM862487 3 0.1484 0.9167 0.000 0.048 0.944 0.000 0.008
#> GSM862488 3 0.0162 0.9384 0.000 0.000 0.996 0.000 0.004
#> GSM862489 2 0.3913 -0.2522 0.000 0.676 0.000 0.000 0.324
#> GSM862490 2 0.4310 -0.2883 0.004 0.604 0.000 0.000 0.392
#> GSM862491 3 0.0451 0.9382 0.000 0.004 0.988 0.000 0.008
#> GSM862492 3 0.1331 0.9215 0.000 0.040 0.952 0.000 0.008
#> GSM862493 5 0.4302 0.7397 0.000 0.480 0.000 0.000 0.520
#> GSM862494 3 0.0162 0.9384 0.000 0.000 0.996 0.000 0.004
#> GSM862495 2 0.1907 0.4549 0.000 0.928 0.028 0.000 0.044
#> GSM862496 2 0.1717 0.4585 0.004 0.936 0.052 0.000 0.008
#> GSM862497 2 0.1662 0.4584 0.004 0.936 0.056 0.000 0.004
#> GSM862498 2 0.4235 -0.5625 0.000 0.576 0.000 0.000 0.424
#> GSM862499 3 0.0162 0.9385 0.000 0.000 0.996 0.000 0.004
#> GSM862500 3 0.0162 0.9385 0.000 0.000 0.996 0.000 0.004
#> GSM862501 2 0.4101 0.0895 0.004 0.664 0.000 0.000 0.332
#> GSM862502 2 0.3790 0.2296 0.004 0.724 0.000 0.000 0.272
#> GSM862503 2 0.3816 -0.0411 0.000 0.696 0.000 0.000 0.304
#> GSM862504 2 0.4452 -0.7943 0.004 0.500 0.000 0.000 0.496
#> GSM862505 2 0.1522 0.4471 0.000 0.944 0.012 0.000 0.044
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> GSM862441 4 0.1594 0.867 0.016 0.000 0.000 0.932 0.000 0.052
#> GSM862442 1 0.0146 0.966 0.996 0.000 0.000 0.004 0.000 0.000
#> GSM862443 1 0.2563 0.867 0.876 0.000 0.000 0.052 0.000 0.072
#> GSM862444 4 0.1863 0.861 0.016 0.000 0.000 0.920 0.004 0.060
#> GSM862445 4 0.3721 0.714 0.016 0.000 0.000 0.728 0.004 0.252
#> GSM862446 1 0.0146 0.966 0.996 0.000 0.000 0.004 0.000 0.000
#> GSM862447 1 0.0146 0.966 0.996 0.000 0.000 0.004 0.000 0.000
#> GSM862448 1 0.0146 0.966 0.996 0.000 0.000 0.004 0.000 0.000
#> GSM862449 1 0.2307 0.891 0.900 0.000 0.000 0.012 0.024 0.064
#> GSM862450 4 0.4426 0.636 0.052 0.000 0.000 0.652 0.000 0.296
#> GSM862451 4 0.0508 0.876 0.012 0.000 0.000 0.984 0.000 0.004
#> GSM862453 1 0.0146 0.966 0.996 0.000 0.000 0.004 0.000 0.000
#> GSM862454 4 0.0363 0.876 0.012 0.000 0.000 0.988 0.000 0.000
#> GSM862455 4 0.0363 0.876 0.012 0.000 0.000 0.988 0.000 0.000
#> GSM862456 4 0.0363 0.876 0.012 0.000 0.000 0.988 0.000 0.000
#> GSM862457 4 0.4161 0.694 0.036 0.000 0.000 0.696 0.004 0.264
#> GSM862458 6 0.4903 0.000 0.000 0.012 0.172 0.064 0.032 0.720
#> GSM862459 4 0.0363 0.876 0.012 0.000 0.000 0.988 0.000 0.000
#> GSM862460 1 0.0146 0.966 0.996 0.000 0.000 0.004 0.000 0.000
#> GSM862461 4 0.1779 0.863 0.016 0.000 0.000 0.920 0.000 0.064
#> GSM862462 4 0.3780 0.726 0.020 0.000 0.000 0.728 0.004 0.248
#> GSM862463 4 0.0363 0.876 0.012 0.000 0.000 0.988 0.000 0.000
#> GSM862464 1 0.2255 0.888 0.892 0.000 0.000 0.028 0.000 0.080
#> GSM862465 4 0.0603 0.872 0.016 0.000 0.000 0.980 0.000 0.004
#> GSM862466 1 0.0146 0.966 0.996 0.000 0.000 0.004 0.000 0.000
#> GSM862467 1 0.0146 0.966 0.996 0.000 0.000 0.004 0.000 0.000
#> GSM862468 4 0.3877 0.742 0.040 0.000 0.000 0.748 0.004 0.208
#> GSM862469 3 0.2311 0.853 0.000 0.000 0.880 0.000 0.016 0.104
#> GSM862470 2 0.2712 0.697 0.000 0.864 0.000 0.000 0.088 0.048
#> GSM862471 3 0.1866 0.865 0.000 0.000 0.908 0.000 0.008 0.084
#> GSM862472 3 0.3970 0.778 0.000 0.044 0.800 0.000 0.092 0.064
#> GSM862473 5 0.5486 0.715 0.000 0.156 0.144 0.000 0.656 0.044
#> GSM862474 2 0.3325 0.687 0.000 0.820 0.000 0.000 0.096 0.084
#> GSM862475 2 0.4467 0.424 0.000 0.564 0.004 0.000 0.408 0.024
#> GSM862476 2 0.3372 0.688 0.000 0.816 0.000 0.000 0.100 0.084
#> GSM862477 2 0.1367 0.711 0.000 0.944 0.000 0.000 0.044 0.012
#> GSM862478 3 0.0603 0.888 0.000 0.000 0.980 0.000 0.004 0.016
#> GSM862479 3 0.2311 0.853 0.000 0.000 0.880 0.000 0.016 0.104
#> GSM862480 5 0.2804 0.862 0.000 0.120 0.024 0.000 0.852 0.004
#> GSM862481 5 0.5480 0.722 0.000 0.164 0.136 0.000 0.656 0.044
#> GSM862482 2 0.4086 0.645 0.000 0.752 0.000 0.000 0.124 0.124
#> GSM862483 2 0.3885 0.571 0.000 0.756 0.000 0.000 0.064 0.180
#> GSM862484 2 0.3327 0.689 0.000 0.820 0.000 0.000 0.088 0.092
#> GSM862485 3 0.2920 0.788 0.000 0.004 0.820 0.000 0.008 0.168
#> GSM862486 2 0.3041 0.697 0.000 0.832 0.000 0.000 0.128 0.040
#> GSM862487 3 0.3010 0.779 0.000 0.004 0.836 0.000 0.132 0.028
#> GSM862488 3 0.0777 0.887 0.000 0.000 0.972 0.000 0.004 0.024
#> GSM862489 2 0.3911 0.510 0.000 0.624 0.000 0.000 0.368 0.008
#> GSM862490 2 0.3912 0.622 0.000 0.732 0.000 0.000 0.224 0.044
#> GSM862491 3 0.1864 0.873 0.000 0.004 0.924 0.000 0.040 0.032
#> GSM862492 3 0.2452 0.833 0.000 0.004 0.884 0.000 0.084 0.028
#> GSM862493 2 0.2176 0.716 0.000 0.896 0.000 0.000 0.080 0.024
#> GSM862494 3 0.0777 0.887 0.000 0.000 0.972 0.000 0.004 0.024
#> GSM862495 5 0.3104 0.841 0.000 0.112 0.020 0.000 0.844 0.024
#> GSM862496 5 0.2669 0.862 0.000 0.108 0.024 0.000 0.864 0.004
#> GSM862497 5 0.2804 0.862 0.000 0.120 0.024 0.000 0.852 0.004
#> GSM862498 2 0.3816 0.656 0.000 0.728 0.000 0.000 0.240 0.032
#> GSM862499 3 0.0508 0.889 0.000 0.000 0.984 0.000 0.004 0.012
#> GSM862500 3 0.0508 0.889 0.000 0.000 0.984 0.000 0.004 0.012
#> GSM862501 2 0.4905 0.413 0.000 0.580 0.000 0.000 0.344 0.076
#> GSM862502 2 0.5199 0.140 0.004 0.480 0.000 0.000 0.440 0.076
#> GSM862503 2 0.4078 0.539 0.000 0.640 0.000 0.000 0.340 0.020
#> GSM862504 2 0.3413 0.690 0.000 0.812 0.000 0.000 0.108 0.080
#> GSM862505 5 0.3246 0.817 0.004 0.108 0.012 0.000 0.840 0.036
Heatmaps for the consensus matrix. It visualizes the probability of two samples to be in a same group.
consensus_heatmap(res, k = 2)
consensus_heatmap(res, k = 3)
consensus_heatmap(res, k = 4)
consensus_heatmap(res, k = 5)
consensus_heatmap(res, k = 6)
Heatmaps for the membership of samples in all partitions to see how consistent they are:
membership_heatmap(res, k = 2)
membership_heatmap(res, k = 3)
membership_heatmap(res, k = 4)
membership_heatmap(res, k = 5)
membership_heatmap(res, k = 6)
As soon as we have had the classes for columns, we can look for signatures which are significantly different between classes which can be candidate marks for certain classes. Following are the heatmaps for signatures.
Signature heatmaps where rows are scaled:
get_signatures(res, k = 2)
get_signatures(res, k = 3)
get_signatures(res, k = 4)
get_signatures(res, k = 5)
get_signatures(res, k = 6)
Signature heatmaps where rows are not scaled:
get_signatures(res, k = 2, scale_rows = FALSE)
get_signatures(res, k = 3, scale_rows = FALSE)
get_signatures(res, k = 4, scale_rows = FALSE)
get_signatures(res, k = 5, scale_rows = FALSE)
get_signatures(res, k = 6, scale_rows = FALSE)
Compare the overlap of signatures from different k:
compare_signatures(res)
get_signature()
returns a data frame invisibly. TO get the list of signatures, the function
call should be assigned to a variable explicitly. In following code, if plot
argument is set
to FALSE
, no heatmap is plotted while only the differential analysis is performed.
# code only for demonstration
tb = get_signature(res, k = ..., plot = FALSE)
An example of the output of tb
is:
#> which_row fdr mean_1 mean_2 scaled_mean_1 scaled_mean_2 km
#> 1 38 0.042760348 8.373488 9.131774 -0.5533452 0.5164555 1
#> 2 40 0.018707592 7.106213 8.469186 -0.6173731 0.5762149 1
#> 3 55 0.019134737 10.221463 11.207825 -0.6159697 0.5749050 1
#> 4 59 0.006059896 5.921854 7.869574 -0.6899429 0.6439467 1
#> 5 60 0.018055526 8.928898 10.211722 -0.6204761 0.5791110 1
#> 6 98 0.009384629 15.714769 14.887706 0.6635654 -0.6193277 2
...
The columns in tb
are:
which_row
: row indices corresponding to the input matrix.fdr
: FDR for the differential test. mean_x
: The mean value in group x.scaled_mean_x
: The mean value in group x after rows are scaled.km
: Row groups if k-means clustering is applied to rows.UMAP plot which shows how samples are separated.
dimension_reduction(res, k = 2, method = "UMAP")
dimension_reduction(res, k = 3, method = "UMAP")
dimension_reduction(res, k = 4, method = "UMAP")
dimension_reduction(res, k = 5, method = "UMAP")
dimension_reduction(res, k = 6, method = "UMAP")
Following heatmap shows how subgroups are split when increasing k
:
collect_classes(res)
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 tissue(p) k
#> CV:skmeans 64 9.65e-15 2
#> CV:skmeans 64 8.50e-14 3
#> CV:skmeans 63 1.34e-13 4
#> CV:skmeans 46 5.67e-10 5
#> CV:skmeans 60 2.90e-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["CV", "pam"]
# you can also extract it by
# res = res_list["CV:pam"]
A summary of res
and all the functions that can be applied to it:
res
#> A 'ConsensusPartition' object with k = 2, 3, 4, 5, 6.
#> On a matrix with 51941 rows and 64 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 3.
#>
#> Following methods can be applied to this 'ConsensusPartition' object:
#> [1] "cola_report" "collect_classes" "collect_plots"
#> [4] "collect_stats" "colnames" "compare_signatures"
#> [7] "consensus_heatmap" "dimension_reduction" "functional_enrichment"
#> [10] "get_anno_col" "get_anno" "get_classes"
#> [13] "get_consensus" "get_matrix" "get_membership"
#> [16] "get_param" "get_signatures" "get_stats"
#> [19] "is_best_k" "is_stable_k" "membership_heatmap"
#> [22] "ncol" "nrow" "plot_ecdf"
#> [25] "rownames" "select_partition_number" "show"
#> [28] "suggest_best_k" "test_to_known_factors"
collect_plots()
function collects all the plots made from res
for all k
(number of partitions)
into one single page to provide an easy and fast comparison between different k
.
collect_plots(res)
The plots are:
k
and the heatmap of
predicted classes for each k
.k
.k
.k
.All the plots in panels can be made by individual functions and they are plotted later in this section.
select_partition_number()
produces several plots showing different
statistics for choosing “optimized” k
. There are following statistics:
k
;k
, the area increased is defined as \(A_k - A_{k-1}\).The detailed explanations of these statistics can be found in the cola vignette.
Generally speaking, lower PAC score, higher mean silhouette score or higher
concordance corresponds to better partition. Rand index and Jaccard index
measure how similar the current partition is compared to partition with k-1
.
If they are too similar, we won't accept k
is better than k-1
.
select_partition_number(res)
The numeric values for all these statistics can be obtained by get_stats()
.
get_stats(res)
#> k 1-PAC mean_silhouette concordance area_increased Rand Jaccard
#> 2 2 1.000 0.997 0.999 0.4901 0.510 0.510
#> 3 3 0.929 0.952 0.969 0.1604 0.918 0.839
#> 4 4 0.770 0.861 0.910 0.2225 0.861 0.676
#> 5 5 0.762 0.816 0.902 0.0698 0.947 0.823
#> 6 6 0.755 0.742 0.864 0.0602 0.945 0.787
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
#> GSM862441 1 0.000 0.997 1.000 0.000
#> GSM862442 1 0.000 0.997 1.000 0.000
#> GSM862443 1 0.000 0.997 1.000 0.000
#> GSM862444 1 0.000 0.997 1.000 0.000
#> GSM862445 1 0.416 0.908 0.916 0.084
#> GSM862446 1 0.000 0.997 1.000 0.000
#> GSM862447 1 0.000 0.997 1.000 0.000
#> GSM862448 1 0.000 0.997 1.000 0.000
#> GSM862449 1 0.000 0.997 1.000 0.000
#> GSM862450 1 0.000 0.997 1.000 0.000
#> GSM862451 1 0.000 0.997 1.000 0.000
#> GSM862453 1 0.000 0.997 1.000 0.000
#> GSM862454 1 0.000 0.997 1.000 0.000
#> GSM862455 1 0.000 0.997 1.000 0.000
#> GSM862456 1 0.000 0.997 1.000 0.000
#> GSM862457 1 0.000 0.997 1.000 0.000
#> GSM862458 2 0.000 1.000 0.000 1.000
#> GSM862459 1 0.000 0.997 1.000 0.000
#> GSM862460 1 0.000 0.997 1.000 0.000
#> GSM862461 1 0.000 0.997 1.000 0.000
#> GSM862462 1 0.000 0.997 1.000 0.000
#> GSM862463 1 0.000 0.997 1.000 0.000
#> GSM862464 1 0.000 0.997 1.000 0.000
#> GSM862465 1 0.000 0.997 1.000 0.000
#> GSM862466 1 0.000 0.997 1.000 0.000
#> GSM862467 1 0.000 0.997 1.000 0.000
#> GSM862468 1 0.000 0.997 1.000 0.000
#> GSM862469 2 0.000 1.000 0.000 1.000
#> GSM862470 2 0.000 1.000 0.000 1.000
#> GSM862471 2 0.000 1.000 0.000 1.000
#> GSM862472 2 0.000 1.000 0.000 1.000
#> GSM862473 2 0.000 1.000 0.000 1.000
#> GSM862474 2 0.000 1.000 0.000 1.000
#> GSM862475 2 0.000 1.000 0.000 1.000
#> GSM862476 2 0.000 1.000 0.000 1.000
#> GSM862477 2 0.000 1.000 0.000 1.000
#> GSM862478 2 0.000 1.000 0.000 1.000
#> GSM862479 2 0.000 1.000 0.000 1.000
#> GSM862480 2 0.000 1.000 0.000 1.000
#> GSM862481 2 0.000 1.000 0.000 1.000
#> GSM862482 2 0.000 1.000 0.000 1.000
#> GSM862483 2 0.000 1.000 0.000 1.000
#> GSM862484 2 0.000 1.000 0.000 1.000
#> GSM862485 2 0.000 1.000 0.000 1.000
#> GSM862486 2 0.000 1.000 0.000 1.000
#> GSM862487 2 0.000 1.000 0.000 1.000
#> GSM862488 2 0.000 1.000 0.000 1.000
#> GSM862489 2 0.000 1.000 0.000 1.000
#> GSM862490 2 0.000 1.000 0.000 1.000
#> GSM862491 2 0.000 1.000 0.000 1.000
#> GSM862492 2 0.000 1.000 0.000 1.000
#> GSM862493 2 0.000 1.000 0.000 1.000
#> GSM862494 2 0.000 1.000 0.000 1.000
#> GSM862495 2 0.000 1.000 0.000 1.000
#> GSM862496 2 0.000 1.000 0.000 1.000
#> GSM862497 2 0.000 1.000 0.000 1.000
#> GSM862498 2 0.000 1.000 0.000 1.000
#> GSM862499 2 0.000 1.000 0.000 1.000
#> GSM862500 2 0.000 1.000 0.000 1.000
#> GSM862501 2 0.000 1.000 0.000 1.000
#> GSM862502 2 0.000 1.000 0.000 1.000
#> GSM862503 2 0.000 1.000 0.000 1.000
#> GSM862504 2 0.000 1.000 0.000 1.000
#> GSM862505 2 0.000 1.000 0.000 1.000
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> GSM862441 1 0.369 0.921 0.860 0.000 0.140
#> GSM862442 3 0.000 0.926 0.000 0.000 1.000
#> GSM862443 3 0.497 0.658 0.236 0.000 0.764
#> GSM862444 1 0.369 0.921 0.860 0.000 0.140
#> GSM862445 1 0.369 0.921 0.860 0.000 0.140
#> GSM862446 3 0.000 0.926 0.000 0.000 1.000
#> GSM862447 3 0.000 0.926 0.000 0.000 1.000
#> GSM862448 3 0.000 0.926 0.000 0.000 1.000
#> GSM862449 3 0.429 0.764 0.180 0.000 0.820
#> GSM862450 1 0.369 0.921 0.860 0.000 0.140
#> GSM862451 1 0.000 0.890 1.000 0.000 0.000
#> GSM862453 3 0.000 0.926 0.000 0.000 1.000
#> GSM862454 1 0.000 0.890 1.000 0.000 0.000
#> GSM862455 1 0.000 0.890 1.000 0.000 0.000
#> GSM862456 1 0.000 0.890 1.000 0.000 0.000
#> GSM862457 1 0.388 0.910 0.848 0.000 0.152
#> GSM862458 2 0.312 0.875 0.108 0.892 0.000
#> GSM862459 1 0.369 0.921 0.860 0.000 0.140
#> GSM862460 3 0.000 0.926 0.000 0.000 1.000
#> GSM862461 1 0.369 0.921 0.860 0.000 0.140
#> GSM862462 1 0.369 0.921 0.860 0.000 0.140
#> GSM862463 1 0.000 0.890 1.000 0.000 0.000
#> GSM862464 3 0.475 0.716 0.216 0.000 0.784
#> GSM862465 1 0.000 0.890 1.000 0.000 0.000
#> GSM862466 3 0.000 0.926 0.000 0.000 1.000
#> GSM862467 3 0.000 0.926 0.000 0.000 1.000
#> GSM862468 1 0.375 0.918 0.856 0.000 0.144
#> GSM862469 2 0.000 0.997 0.000 1.000 0.000
#> GSM862470 2 0.000 0.997 0.000 1.000 0.000
#> GSM862471 2 0.000 0.997 0.000 1.000 0.000
#> GSM862472 2 0.000 0.997 0.000 1.000 0.000
#> GSM862473 2 0.000 0.997 0.000 1.000 0.000
#> GSM862474 2 0.000 0.997 0.000 1.000 0.000
#> GSM862475 2 0.000 0.997 0.000 1.000 0.000
#> GSM862476 2 0.000 0.997 0.000 1.000 0.000
#> GSM862477 2 0.000 0.997 0.000 1.000 0.000
#> GSM862478 2 0.000 0.997 0.000 1.000 0.000
#> GSM862479 2 0.000 0.997 0.000 1.000 0.000
#> GSM862480 2 0.000 0.997 0.000 1.000 0.000
#> GSM862481 2 0.000 0.997 0.000 1.000 0.000
#> GSM862482 2 0.000 0.997 0.000 1.000 0.000
#> GSM862483 2 0.000 0.997 0.000 1.000 0.000
#> GSM862484 2 0.000 0.997 0.000 1.000 0.000
#> GSM862485 2 0.000 0.997 0.000 1.000 0.000
#> GSM862486 2 0.000 0.997 0.000 1.000 0.000
#> GSM862487 2 0.000 0.997 0.000 1.000 0.000
#> GSM862488 2 0.000 0.997 0.000 1.000 0.000
#> GSM862489 2 0.000 0.997 0.000 1.000 0.000
#> GSM862490 2 0.000 0.997 0.000 1.000 0.000
#> GSM862491 2 0.000 0.997 0.000 1.000 0.000
#> GSM862492 2 0.000 0.997 0.000 1.000 0.000
#> GSM862493 2 0.000 0.997 0.000 1.000 0.000
#> GSM862494 2 0.000 0.997 0.000 1.000 0.000
#> GSM862495 2 0.000 0.997 0.000 1.000 0.000
#> GSM862496 2 0.000 0.997 0.000 1.000 0.000
#> GSM862497 2 0.000 0.997 0.000 1.000 0.000
#> GSM862498 2 0.000 0.997 0.000 1.000 0.000
#> GSM862499 2 0.000 0.997 0.000 1.000 0.000
#> GSM862500 2 0.000 0.997 0.000 1.000 0.000
#> GSM862501 2 0.000 0.997 0.000 1.000 0.000
#> GSM862502 2 0.000 0.997 0.000 1.000 0.000
#> GSM862503 2 0.000 0.997 0.000 1.000 0.000
#> GSM862504 2 0.000 0.997 0.000 1.000 0.000
#> GSM862505 2 0.000 0.997 0.000 1.000 0.000
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> GSM862441 4 0.2530 0.909 0.112 0.000 0.000 0.888
#> GSM862442 1 0.0000 0.921 1.000 0.000 0.000 0.000
#> GSM862443 1 0.3942 0.659 0.764 0.000 0.000 0.236
#> GSM862444 4 0.2530 0.909 0.112 0.000 0.000 0.888
#> GSM862445 4 0.2530 0.909 0.112 0.000 0.000 0.888
#> GSM862446 1 0.0000 0.921 1.000 0.000 0.000 0.000
#> GSM862447 1 0.0000 0.921 1.000 0.000 0.000 0.000
#> GSM862448 1 0.0000 0.921 1.000 0.000 0.000 0.000
#> GSM862449 1 0.3726 0.732 0.788 0.000 0.000 0.212
#> GSM862450 4 0.2530 0.909 0.112 0.000 0.000 0.888
#> GSM862451 4 0.2149 0.862 0.000 0.000 0.088 0.912
#> GSM862453 1 0.0000 0.921 1.000 0.000 0.000 0.000
#> GSM862454 4 0.2149 0.862 0.000 0.000 0.088 0.912
#> GSM862455 4 0.1557 0.872 0.000 0.000 0.056 0.944
#> GSM862456 4 0.2149 0.862 0.000 0.000 0.088 0.912
#> GSM862457 4 0.2704 0.900 0.124 0.000 0.000 0.876
#> GSM862458 2 0.5727 0.567 0.000 0.704 0.200 0.096
#> GSM862459 4 0.2530 0.909 0.112 0.000 0.000 0.888
#> GSM862460 1 0.0000 0.921 1.000 0.000 0.000 0.000
#> GSM862461 4 0.2589 0.908 0.116 0.000 0.000 0.884
#> GSM862462 4 0.2530 0.909 0.112 0.000 0.000 0.888
#> GSM862463 4 0.2149 0.862 0.000 0.000 0.088 0.912
#> GSM862464 1 0.4008 0.689 0.756 0.000 0.000 0.244
#> GSM862465 4 0.1474 0.873 0.000 0.000 0.052 0.948
#> GSM862466 1 0.0000 0.921 1.000 0.000 0.000 0.000
#> GSM862467 1 0.0000 0.921 1.000 0.000 0.000 0.000
#> GSM862468 4 0.2589 0.908 0.116 0.000 0.000 0.884
#> GSM862469 3 0.4134 0.811 0.000 0.260 0.740 0.000
#> GSM862470 2 0.0188 0.939 0.000 0.996 0.004 0.000
#> GSM862471 3 0.3726 0.837 0.000 0.212 0.788 0.000
#> GSM862472 2 0.4994 -0.260 0.000 0.520 0.480 0.000
#> GSM862473 2 0.0469 0.939 0.000 0.988 0.012 0.000
#> GSM862474 2 0.0336 0.940 0.000 0.992 0.008 0.000
#> GSM862475 2 0.0000 0.941 0.000 1.000 0.000 0.000
#> GSM862476 2 0.0817 0.928 0.000 0.976 0.024 0.000
#> GSM862477 2 0.0000 0.941 0.000 1.000 0.000 0.000
#> GSM862478 3 0.2281 0.843 0.000 0.096 0.904 0.000
#> GSM862479 3 0.4888 0.585 0.000 0.412 0.588 0.000
#> GSM862480 2 0.0469 0.939 0.000 0.988 0.012 0.000
#> GSM862481 2 0.0469 0.939 0.000 0.988 0.012 0.000
#> GSM862482 2 0.0000 0.941 0.000 1.000 0.000 0.000
#> GSM862483 2 0.0469 0.938 0.000 0.988 0.012 0.000
#> GSM862484 2 0.0000 0.941 0.000 1.000 0.000 0.000
#> GSM862485 2 0.2647 0.827 0.000 0.880 0.120 0.000
#> GSM862486 2 0.0000 0.941 0.000 1.000 0.000 0.000
#> GSM862487 2 0.3400 0.733 0.000 0.820 0.180 0.000
#> GSM862488 3 0.2216 0.842 0.000 0.092 0.908 0.000
#> GSM862489 2 0.0000 0.941 0.000 1.000 0.000 0.000
#> GSM862490 2 0.0000 0.941 0.000 1.000 0.000 0.000
#> GSM862491 3 0.4585 0.720 0.000 0.332 0.668 0.000
#> GSM862492 3 0.4250 0.798 0.000 0.276 0.724 0.000
#> GSM862493 2 0.0000 0.941 0.000 1.000 0.000 0.000
#> GSM862494 3 0.2216 0.842 0.000 0.092 0.908 0.000
#> GSM862495 2 0.0336 0.940 0.000 0.992 0.008 0.000
#> GSM862496 2 0.0469 0.939 0.000 0.988 0.012 0.000
#> GSM862497 2 0.0469 0.939 0.000 0.988 0.012 0.000
#> GSM862498 2 0.1557 0.898 0.000 0.944 0.056 0.000
#> GSM862499 3 0.2149 0.840 0.000 0.088 0.912 0.000
#> GSM862500 3 0.2149 0.840 0.000 0.088 0.912 0.000
#> GSM862501 2 0.1118 0.920 0.000 0.964 0.036 0.000
#> GSM862502 2 0.0336 0.939 0.000 0.992 0.008 0.000
#> GSM862503 2 0.0000 0.941 0.000 1.000 0.000 0.000
#> GSM862504 2 0.0000 0.941 0.000 1.000 0.000 0.000
#> GSM862505 2 0.0188 0.941 0.000 0.996 0.004 0.000
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> GSM862441 4 0.0000 0.86618 0.000 0.000 0.000 1.000 0.000
#> GSM862442 1 0.0000 0.93454 1.000 0.000 0.000 0.000 0.000
#> GSM862443 1 0.2230 0.82612 0.884 0.000 0.000 0.116 0.000
#> GSM862444 4 0.0000 0.86618 0.000 0.000 0.000 1.000 0.000
#> GSM862445 4 0.0000 0.86618 0.000 0.000 0.000 1.000 0.000
#> GSM862446 1 0.0000 0.93454 1.000 0.000 0.000 0.000 0.000
#> GSM862447 1 0.0000 0.93454 1.000 0.000 0.000 0.000 0.000
#> GSM862448 1 0.0000 0.93454 1.000 0.000 0.000 0.000 0.000
#> GSM862449 1 0.4161 0.33286 0.608 0.000 0.000 0.392 0.000
#> GSM862450 4 0.0000 0.86618 0.000 0.000 0.000 1.000 0.000
#> GSM862451 5 0.2605 0.93271 0.000 0.000 0.000 0.148 0.852
#> GSM862453 1 0.0000 0.93454 1.000 0.000 0.000 0.000 0.000
#> GSM862454 5 0.2605 0.93271 0.000 0.000 0.000 0.148 0.852
#> GSM862455 5 0.4045 0.65705 0.000 0.000 0.000 0.356 0.644
#> GSM862456 5 0.2605 0.93271 0.000 0.000 0.000 0.148 0.852
#> GSM862457 4 0.0000 0.86618 0.000 0.000 0.000 1.000 0.000
#> GSM862458 2 0.6598 0.31923 0.000 0.552 0.184 0.244 0.020
#> GSM862459 4 0.0162 0.86388 0.000 0.000 0.000 0.996 0.004
#> GSM862460 1 0.0000 0.93454 1.000 0.000 0.000 0.000 0.000
#> GSM862461 4 0.1753 0.81401 0.032 0.000 0.000 0.936 0.032
#> GSM862462 4 0.0000 0.86618 0.000 0.000 0.000 1.000 0.000
#> GSM862463 5 0.2605 0.93271 0.000 0.000 0.000 0.148 0.852
#> GSM862464 4 0.4287 0.00271 0.460 0.000 0.000 0.540 0.000
#> GSM862465 4 0.4182 -0.08128 0.000 0.000 0.000 0.600 0.400
#> GSM862466 1 0.0000 0.93454 1.000 0.000 0.000 0.000 0.000
#> GSM862467 1 0.0000 0.93454 1.000 0.000 0.000 0.000 0.000
#> GSM862468 4 0.0404 0.85742 0.012 0.000 0.000 0.988 0.000
#> GSM862469 3 0.3409 0.77871 0.000 0.160 0.816 0.000 0.024
#> GSM862470 2 0.0771 0.91682 0.000 0.976 0.004 0.000 0.020
#> GSM862471 3 0.2674 0.78682 0.000 0.120 0.868 0.000 0.012
#> GSM862472 3 0.4882 0.29770 0.000 0.444 0.532 0.000 0.024
#> GSM862473 2 0.1638 0.91015 0.000 0.932 0.004 0.000 0.064
#> GSM862474 2 0.1697 0.90431 0.000 0.932 0.008 0.000 0.060
#> GSM862475 2 0.1638 0.91015 0.000 0.932 0.004 0.000 0.064
#> GSM862476 2 0.2144 0.89560 0.000 0.912 0.020 0.000 0.068
#> GSM862477 2 0.1544 0.90104 0.000 0.932 0.000 0.000 0.068
#> GSM862478 3 0.0451 0.77283 0.000 0.008 0.988 0.000 0.004
#> GSM862479 3 0.4777 0.66162 0.000 0.292 0.664 0.000 0.044
#> GSM862480 2 0.1638 0.91015 0.000 0.932 0.004 0.000 0.064
#> GSM862481 2 0.1638 0.91015 0.000 0.932 0.004 0.000 0.064
#> GSM862482 2 0.0794 0.91721 0.000 0.972 0.000 0.000 0.028
#> GSM862483 2 0.1502 0.90681 0.000 0.940 0.004 0.000 0.056
#> GSM862484 2 0.1544 0.90104 0.000 0.932 0.000 0.000 0.068
#> GSM862485 2 0.3291 0.82183 0.000 0.840 0.120 0.000 0.040
#> GSM862486 2 0.0880 0.91292 0.000 0.968 0.000 0.000 0.032
#> GSM862487 2 0.3675 0.73286 0.000 0.788 0.188 0.000 0.024
#> GSM862488 3 0.0162 0.76979 0.000 0.000 0.996 0.000 0.004
#> GSM862489 2 0.0880 0.91292 0.000 0.968 0.000 0.000 0.032
#> GSM862490 2 0.1430 0.91358 0.000 0.944 0.004 0.000 0.052
#> GSM862491 3 0.4141 0.71688 0.000 0.248 0.728 0.000 0.024
#> GSM862492 3 0.3527 0.76562 0.000 0.192 0.792 0.000 0.016
#> GSM862493 2 0.1121 0.91044 0.000 0.956 0.000 0.000 0.044
#> GSM862494 3 0.0162 0.76979 0.000 0.000 0.996 0.000 0.004
#> GSM862495 2 0.1638 0.91015 0.000 0.932 0.004 0.000 0.064
#> GSM862496 2 0.1638 0.91015 0.000 0.932 0.004 0.000 0.064
#> GSM862497 2 0.1638 0.91015 0.000 0.932 0.004 0.000 0.064
#> GSM862498 2 0.2124 0.89112 0.000 0.916 0.056 0.000 0.028
#> GSM862499 3 0.0290 0.76996 0.000 0.000 0.992 0.000 0.008
#> GSM862500 3 0.0000 0.77032 0.000 0.000 1.000 0.000 0.000
#> GSM862501 2 0.1386 0.91128 0.000 0.952 0.016 0.000 0.032
#> GSM862502 2 0.1041 0.91287 0.000 0.964 0.004 0.000 0.032
#> GSM862503 2 0.0880 0.91292 0.000 0.968 0.000 0.000 0.032
#> GSM862504 2 0.2179 0.90490 0.000 0.896 0.004 0.000 0.100
#> GSM862505 2 0.1638 0.91015 0.000 0.932 0.004 0.000 0.064
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> GSM862441 4 0.0000 0.879 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM862442 1 0.0000 0.941 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM862443 1 0.1957 0.836 0.888 0.000 0.000 0.112 0.000 0.000
#> GSM862444 4 0.0000 0.879 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM862445 4 0.0000 0.879 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM862446 1 0.0000 0.941 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM862447 1 0.0000 0.941 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM862448 1 0.0000 0.941 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM862449 1 0.5150 0.486 0.608 0.136 0.000 0.256 0.000 0.000
#> GSM862450 4 0.0000 0.879 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM862451 6 0.0458 0.924 0.000 0.000 0.000 0.016 0.000 0.984
#> GSM862453 1 0.0000 0.941 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM862454 6 0.0458 0.924 0.000 0.000 0.000 0.016 0.000 0.984
#> GSM862455 6 0.3330 0.592 0.000 0.000 0.000 0.284 0.000 0.716
#> GSM862456 6 0.0458 0.924 0.000 0.000 0.000 0.016 0.000 0.984
#> GSM862457 4 0.0000 0.879 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM862458 5 0.6435 0.014 0.000 0.036 0.184 0.320 0.460 0.000
#> GSM862459 4 0.0363 0.873 0.000 0.000 0.000 0.988 0.000 0.012
#> GSM862460 1 0.0000 0.941 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM862461 4 0.2201 0.800 0.028 0.000 0.000 0.896 0.000 0.076
#> GSM862462 4 0.0000 0.879 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM862463 6 0.0458 0.924 0.000 0.000 0.000 0.016 0.000 0.984
#> GSM862464 4 0.3847 0.059 0.456 0.000 0.000 0.544 0.000 0.000
#> GSM862465 4 0.3756 0.175 0.000 0.000 0.000 0.600 0.000 0.400
#> GSM862466 1 0.0000 0.941 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM862467 1 0.0000 0.941 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM862468 4 0.0363 0.872 0.012 0.000 0.000 0.988 0.000 0.000
#> GSM862469 3 0.3411 0.734 0.000 0.060 0.816 0.000 0.120 0.004
#> GSM862470 5 0.2362 0.726 0.000 0.136 0.004 0.000 0.860 0.000
#> GSM862471 3 0.2771 0.741 0.000 0.060 0.868 0.000 0.068 0.004
#> GSM862472 3 0.3995 0.259 0.000 0.004 0.516 0.000 0.480 0.000
#> GSM862473 5 0.0000 0.786 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM862474 2 0.3547 0.907 0.000 0.668 0.000 0.000 0.332 0.000
#> GSM862475 5 0.0000 0.786 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM862476 2 0.3464 0.920 0.000 0.688 0.000 0.000 0.312 0.000
#> GSM862477 2 0.3482 0.919 0.000 0.684 0.000 0.000 0.316 0.000
#> GSM862478 3 0.2611 0.742 0.000 0.116 0.864 0.000 0.008 0.012
#> GSM862479 3 0.4311 0.674 0.000 0.060 0.708 0.000 0.228 0.004
#> GSM862480 5 0.0000 0.786 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM862481 5 0.0000 0.786 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM862482 2 0.3864 0.661 0.000 0.520 0.000 0.000 0.480 0.000
#> GSM862483 5 0.3747 0.295 0.000 0.396 0.000 0.000 0.604 0.000
#> GSM862484 2 0.3464 0.920 0.000 0.688 0.000 0.000 0.312 0.000
#> GSM862485 5 0.1714 0.725 0.000 0.000 0.092 0.000 0.908 0.000
#> GSM862486 5 0.2697 0.674 0.000 0.188 0.000 0.000 0.812 0.000
#> GSM862487 5 0.2219 0.659 0.000 0.000 0.136 0.000 0.864 0.000
#> GSM862488 3 0.2357 0.741 0.000 0.116 0.872 0.000 0.000 0.012
#> GSM862489 5 0.2664 0.678 0.000 0.184 0.000 0.000 0.816 0.000
#> GSM862490 5 0.0790 0.780 0.000 0.032 0.000 0.000 0.968 0.000
#> GSM862491 3 0.3717 0.493 0.000 0.000 0.616 0.000 0.384 0.000
#> GSM862492 3 0.4544 0.674 0.000 0.076 0.668 0.000 0.256 0.000
#> GSM862493 5 0.3428 0.411 0.000 0.304 0.000 0.000 0.696 0.000
#> GSM862494 3 0.2357 0.741 0.000 0.116 0.872 0.000 0.000 0.012
#> GSM862495 5 0.0000 0.786 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM862496 5 0.0000 0.786 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM862497 5 0.0000 0.786 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM862498 5 0.1921 0.766 0.000 0.052 0.032 0.000 0.916 0.000
#> GSM862499 3 0.0260 0.735 0.000 0.008 0.992 0.000 0.000 0.000
#> GSM862500 3 0.2212 0.742 0.000 0.112 0.880 0.000 0.000 0.008
#> GSM862501 5 0.2838 0.672 0.000 0.188 0.004 0.000 0.808 0.000
#> GSM862502 5 0.2697 0.674 0.000 0.188 0.000 0.000 0.812 0.000
#> GSM862503 5 0.2697 0.674 0.000 0.188 0.000 0.000 0.812 0.000
#> GSM862504 5 0.2092 0.653 0.000 0.124 0.000 0.000 0.876 0.000
#> GSM862505 5 0.0000 0.786 0.000 0.000 0.000 0.000 1.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 tissue(p) k
#> CV:pam 64 6.95e-14 2
#> CV:pam 64 9.32e-14 3
#> CV:pam 63 9.30e-13 4
#> CV:pam 59 4.71e-12 5
#> CV:pam 56 8.13e-11 6
If matrix rows can be associated to genes, consider to use functional_enrichment(res,
...)
to perform function enrichment for the signature genes. See this vignette for more detailed explanations.
The object with results only for a single top-value method and a single partition method can be extracted as:
res = res_list["CV", "mclust"]
# you can also extract it by
# res = res_list["CV:mclust"]
A summary of res
and all the functions that can be applied to it:
res
#> A 'ConsensusPartition' object with k = 2, 3, 4, 5, 6.
#> On a matrix with 51941 rows and 64 columns.
#> Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'CV' method.
#> Subgroups are detected by 'mclust' method.
#> Performed in total 1250 partitions by row resampling.
#> Best k for subgroups seems to be 2.
#>
#> Following methods can be applied to this 'ConsensusPartition' object:
#> [1] "cola_report" "collect_classes" "collect_plots"
#> [4] "collect_stats" "colnames" "compare_signatures"
#> [7] "consensus_heatmap" "dimension_reduction" "functional_enrichment"
#> [10] "get_anno_col" "get_anno" "get_classes"
#> [13] "get_consensus" "get_matrix" "get_membership"
#> [16] "get_param" "get_signatures" "get_stats"
#> [19] "is_best_k" "is_stable_k" "membership_heatmap"
#> [22] "ncol" "nrow" "plot_ecdf"
#> [25] "rownames" "select_partition_number" "show"
#> [28] "suggest_best_k" "test_to_known_factors"
collect_plots()
function collects all the plots made from res
for all k
(number of partitions)
into one single page to provide an easy and fast comparison between different k
.
collect_plots(res)
The plots are:
k
and the heatmap of
predicted classes for each k
.k
.k
.k
.All the plots in panels can be made by individual functions and they are plotted later in this section.
select_partition_number()
produces several plots showing different
statistics for choosing “optimized” k
. There are following statistics:
k
;k
, the area increased is defined as \(A_k - A_{k-1}\).The detailed explanations of these statistics can be found in the cola vignette.
Generally speaking, lower PAC score, higher mean silhouette score or higher
concordance corresponds to better partition. Rand index and Jaccard index
measure how similar the current partition is compared to partition with k-1
.
If they are too similar, we won't accept k
is better than k-1
.
select_partition_number(res)
The numeric values for all these statistics can be obtained by get_stats()
.
get_stats(res)
#> k 1-PAC mean_silhouette concordance area_increased Rand Jaccard
#> 2 2 1.000 0.988 0.995 0.5044 0.497 0.497
#> 3 3 0.795 0.798 0.894 0.2606 0.848 0.694
#> 4 4 0.669 0.731 0.851 0.1437 0.864 0.625
#> 5 5 0.583 0.604 0.701 0.0453 0.947 0.790
#> 6 6 0.677 0.576 0.750 0.0560 0.909 0.628
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
#> GSM862441 1 0.000 0.999 1.000 0.000
#> GSM862442 1 0.000 0.999 1.000 0.000
#> GSM862443 1 0.000 0.999 1.000 0.000
#> GSM862444 1 0.000 0.999 1.000 0.000
#> GSM862445 1 0.000 0.999 1.000 0.000
#> GSM862446 1 0.000 0.999 1.000 0.000
#> GSM862447 1 0.000 0.999 1.000 0.000
#> GSM862448 1 0.000 0.999 1.000 0.000
#> GSM862449 1 0.000 0.999 1.000 0.000
#> GSM862450 1 0.000 0.999 1.000 0.000
#> GSM862451 1 0.000 0.999 1.000 0.000
#> GSM862453 1 0.000 0.999 1.000 0.000
#> GSM862454 1 0.000 0.999 1.000 0.000
#> GSM862455 1 0.000 0.999 1.000 0.000
#> GSM862456 1 0.000 0.999 1.000 0.000
#> GSM862457 1 0.000 0.999 1.000 0.000
#> GSM862458 1 0.000 0.999 1.000 0.000
#> GSM862459 1 0.000 0.999 1.000 0.000
#> GSM862460 1 0.000 0.999 1.000 0.000
#> GSM862461 1 0.000 0.999 1.000 0.000
#> GSM862462 1 0.000 0.999 1.000 0.000
#> GSM862463 1 0.000 0.999 1.000 0.000
#> GSM862464 1 0.000 0.999 1.000 0.000
#> GSM862465 1 0.000 0.999 1.000 0.000
#> GSM862466 1 0.000 0.999 1.000 0.000
#> GSM862467 1 0.000 0.999 1.000 0.000
#> GSM862468 1 0.000 0.999 1.000 0.000
#> GSM862469 2 0.000 0.991 0.000 1.000
#> GSM862470 2 0.000 0.991 0.000 1.000
#> GSM862471 2 0.000 0.991 0.000 1.000
#> GSM862472 2 0.000 0.991 0.000 1.000
#> GSM862473 2 0.000 0.991 0.000 1.000
#> GSM862474 2 0.000 0.991 0.000 1.000
#> GSM862475 2 0.000 0.991 0.000 1.000
#> GSM862476 2 0.000 0.991 0.000 1.000
#> GSM862477 2 0.000 0.991 0.000 1.000
#> GSM862478 2 0.000 0.991 0.000 1.000
#> GSM862479 2 0.000 0.991 0.000 1.000
#> GSM862480 2 0.000 0.991 0.000 1.000
#> GSM862481 2 0.000 0.991 0.000 1.000
#> GSM862482 1 0.141 0.980 0.980 0.020
#> GSM862483 1 0.141 0.980 0.980 0.020
#> GSM862484 2 0.000 0.991 0.000 1.000
#> GSM862485 2 0.000 0.991 0.000 1.000
#> GSM862486 2 0.000 0.991 0.000 1.000
#> GSM862487 2 0.000 0.991 0.000 1.000
#> GSM862488 2 0.000 0.991 0.000 1.000
#> GSM862489 2 0.000 0.991 0.000 1.000
#> GSM862490 2 0.000 0.991 0.000 1.000
#> GSM862491 2 0.000 0.991 0.000 1.000
#> GSM862492 2 0.000 0.991 0.000 1.000
#> GSM862493 2 0.000 0.991 0.000 1.000
#> GSM862494 2 0.000 0.991 0.000 1.000
#> GSM862495 2 0.000 0.991 0.000 1.000
#> GSM862496 2 0.000 0.991 0.000 1.000
#> GSM862497 2 0.000 0.991 0.000 1.000
#> GSM862498 2 0.000 0.991 0.000 1.000
#> GSM862499 2 0.000 0.991 0.000 1.000
#> GSM862500 2 0.000 0.991 0.000 1.000
#> GSM862501 2 0.000 0.991 0.000 1.000
#> GSM862502 2 0.625 0.820 0.156 0.844
#> GSM862503 2 0.000 0.991 0.000 1.000
#> GSM862504 2 0.000 0.991 0.000 1.000
#> GSM862505 2 0.625 0.820 0.156 0.844
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> GSM862441 1 0.0237 0.9823 0.996 0.004 0.000
#> GSM862442 1 0.1765 0.9747 0.956 0.004 0.040
#> GSM862443 1 0.1031 0.9796 0.976 0.000 0.024
#> GSM862444 1 0.0000 0.9822 1.000 0.000 0.000
#> GSM862445 1 0.0237 0.9823 0.996 0.004 0.000
#> GSM862446 1 0.1765 0.9747 0.956 0.004 0.040
#> GSM862447 1 0.1765 0.9747 0.956 0.004 0.040
#> GSM862448 1 0.1765 0.9747 0.956 0.004 0.040
#> GSM862449 1 0.1765 0.9747 0.956 0.004 0.040
#> GSM862450 1 0.0000 0.9822 1.000 0.000 0.000
#> GSM862451 1 0.0237 0.9823 0.996 0.004 0.000
#> GSM862453 1 0.1950 0.9750 0.952 0.008 0.040
#> GSM862454 1 0.0237 0.9823 0.996 0.004 0.000
#> GSM862455 1 0.0237 0.9823 0.996 0.004 0.000
#> GSM862456 1 0.0237 0.9823 0.996 0.004 0.000
#> GSM862457 1 0.0000 0.9822 1.000 0.000 0.000
#> GSM862458 1 0.0000 0.9822 1.000 0.000 0.000
#> GSM862459 1 0.0237 0.9823 0.996 0.004 0.000
#> GSM862460 1 0.1765 0.9747 0.956 0.004 0.040
#> GSM862461 1 0.0592 0.9813 0.988 0.000 0.012
#> GSM862462 1 0.0237 0.9823 0.996 0.004 0.000
#> GSM862463 1 0.0237 0.9823 0.996 0.004 0.000
#> GSM862464 1 0.1031 0.9796 0.976 0.000 0.024
#> GSM862465 1 0.0237 0.9823 0.996 0.004 0.000
#> GSM862466 1 0.1765 0.9747 0.956 0.004 0.040
#> GSM862467 1 0.1765 0.9747 0.956 0.004 0.040
#> GSM862468 1 0.0237 0.9823 0.996 0.004 0.000
#> GSM862469 3 0.1643 0.8251 0.000 0.044 0.956
#> GSM862470 2 0.1643 0.7891 0.000 0.956 0.044
#> GSM862471 3 0.1643 0.8251 0.000 0.044 0.956
#> GSM862472 3 0.3192 0.8100 0.000 0.112 0.888
#> GSM862473 3 0.5882 0.4806 0.000 0.348 0.652
#> GSM862474 2 0.1643 0.7891 0.000 0.956 0.044
#> GSM862475 2 0.6295 0.0684 0.000 0.528 0.472
#> GSM862476 2 0.1643 0.7891 0.000 0.956 0.044
#> GSM862477 2 0.1643 0.7891 0.000 0.956 0.044
#> GSM862478 3 0.1643 0.8251 0.000 0.044 0.956
#> GSM862479 3 0.1643 0.8251 0.000 0.044 0.956
#> GSM862480 2 0.6299 0.0704 0.000 0.524 0.476
#> GSM862481 3 0.6140 0.3303 0.000 0.404 0.596
#> GSM862482 1 0.1964 0.9533 0.944 0.056 0.000
#> GSM862483 1 0.3083 0.9446 0.916 0.060 0.024
#> GSM862484 2 0.3879 0.7277 0.000 0.848 0.152
#> GSM862485 3 0.3482 0.8053 0.000 0.128 0.872
#> GSM862486 2 0.2796 0.7801 0.000 0.908 0.092
#> GSM862487 3 0.3752 0.7962 0.000 0.144 0.856
#> GSM862488 3 0.1529 0.8218 0.000 0.040 0.960
#> GSM862489 2 0.4002 0.7289 0.000 0.840 0.160
#> GSM862490 2 0.1964 0.7815 0.000 0.944 0.056
#> GSM862491 3 0.4178 0.7749 0.000 0.172 0.828
#> GSM862492 3 0.3752 0.7962 0.000 0.144 0.856
#> GSM862493 2 0.1753 0.7895 0.000 0.952 0.048
#> GSM862494 3 0.1529 0.8218 0.000 0.040 0.960
#> GSM862495 3 0.6225 0.2452 0.000 0.432 0.568
#> GSM862496 3 0.6267 0.1638 0.000 0.452 0.548
#> GSM862497 2 0.6274 0.1421 0.000 0.544 0.456
#> GSM862498 2 0.6180 0.2687 0.000 0.584 0.416
#> GSM862499 3 0.1643 0.8251 0.000 0.044 0.956
#> GSM862500 3 0.1643 0.8251 0.000 0.044 0.956
#> GSM862501 2 0.2711 0.7806 0.000 0.912 0.088
#> GSM862502 2 0.6599 0.5702 0.168 0.748 0.084
#> GSM862503 2 0.1753 0.7897 0.000 0.952 0.048
#> GSM862504 2 0.1643 0.7891 0.000 0.956 0.044
#> GSM862505 2 0.8076 0.4818 0.168 0.652 0.180
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> GSM862441 4 0.3975 0.745 0.240 0.000 0.000 0.760
#> GSM862442 1 0.0336 0.807 0.992 0.000 0.000 0.008
#> GSM862443 1 0.5790 0.285 0.616 0.000 0.044 0.340
#> GSM862444 4 0.5130 0.653 0.332 0.000 0.016 0.652
#> GSM862445 4 0.4718 0.715 0.280 0.000 0.012 0.708
#> GSM862446 1 0.0000 0.808 1.000 0.000 0.000 0.000
#> GSM862447 1 0.0000 0.808 1.000 0.000 0.000 0.000
#> GSM862448 1 0.0000 0.808 1.000 0.000 0.000 0.000
#> GSM862449 1 0.0707 0.801 0.980 0.000 0.000 0.020
#> GSM862450 4 0.5149 0.647 0.336 0.000 0.016 0.648
#> GSM862451 4 0.2149 0.766 0.088 0.000 0.000 0.912
#> GSM862453 1 0.2530 0.702 0.888 0.000 0.000 0.112
#> GSM862454 4 0.0000 0.741 0.000 0.000 0.000 1.000
#> GSM862455 4 0.0000 0.741 0.000 0.000 0.000 1.000
#> GSM862456 4 0.0000 0.741 0.000 0.000 0.000 1.000
#> GSM862457 4 0.4999 0.664 0.328 0.000 0.012 0.660
#> GSM862458 4 0.5167 0.640 0.340 0.000 0.016 0.644
#> GSM862459 4 0.2149 0.766 0.088 0.000 0.000 0.912
#> GSM862460 1 0.0336 0.807 0.992 0.000 0.000 0.008
#> GSM862461 1 0.5781 -0.264 0.492 0.000 0.028 0.480
#> GSM862462 4 0.4248 0.751 0.220 0.000 0.012 0.768
#> GSM862463 4 0.0000 0.741 0.000 0.000 0.000 1.000
#> GSM862464 1 0.5790 0.285 0.616 0.000 0.044 0.340
#> GSM862465 4 0.0336 0.744 0.008 0.000 0.000 0.992
#> GSM862466 1 0.0000 0.808 1.000 0.000 0.000 0.000
#> GSM862467 1 0.0000 0.808 1.000 0.000 0.000 0.000
#> GSM862468 4 0.4175 0.754 0.212 0.000 0.012 0.776
#> GSM862469 3 0.1792 0.826 0.000 0.068 0.932 0.000
#> GSM862470 2 0.0000 0.892 0.000 1.000 0.000 0.000
#> GSM862471 3 0.2530 0.820 0.000 0.112 0.888 0.000
#> GSM862472 3 0.4222 0.728 0.000 0.272 0.728 0.000
#> GSM862473 3 0.4761 0.618 0.000 0.372 0.628 0.000
#> GSM862474 2 0.0000 0.892 0.000 1.000 0.000 0.000
#> GSM862475 2 0.2216 0.843 0.000 0.908 0.092 0.000
#> GSM862476 2 0.0000 0.892 0.000 1.000 0.000 0.000
#> GSM862477 2 0.0000 0.892 0.000 1.000 0.000 0.000
#> GSM862478 3 0.1716 0.825 0.000 0.064 0.936 0.000
#> GSM862479 3 0.1792 0.826 0.000 0.068 0.932 0.000
#> GSM862480 2 0.3528 0.726 0.000 0.808 0.192 0.000
#> GSM862481 3 0.4992 0.350 0.000 0.476 0.524 0.000
#> GSM862482 4 0.7842 0.381 0.328 0.132 0.032 0.508
#> GSM862483 1 0.6156 0.522 0.688 0.068 0.020 0.224
#> GSM862484 2 0.0336 0.891 0.000 0.992 0.008 0.000
#> GSM862485 3 0.4222 0.751 0.000 0.272 0.728 0.000
#> GSM862486 2 0.0336 0.891 0.000 0.992 0.008 0.000
#> GSM862487 3 0.4250 0.748 0.000 0.276 0.724 0.000
#> GSM862488 3 0.1716 0.825 0.000 0.064 0.936 0.000
#> GSM862489 2 0.1022 0.881 0.000 0.968 0.032 0.000
#> GSM862490 2 0.0657 0.887 0.004 0.984 0.012 0.000
#> GSM862491 3 0.4898 0.514 0.000 0.416 0.584 0.000
#> GSM862492 3 0.4250 0.748 0.000 0.276 0.724 0.000
#> GSM862493 2 0.0000 0.892 0.000 1.000 0.000 0.000
#> GSM862494 3 0.1716 0.825 0.000 0.064 0.936 0.000
#> GSM862495 2 0.3444 0.750 0.000 0.816 0.184 0.000
#> GSM862496 2 0.3610 0.713 0.000 0.800 0.200 0.000
#> GSM862497 2 0.3610 0.714 0.000 0.800 0.200 0.000
#> GSM862498 2 0.2408 0.833 0.000 0.896 0.104 0.000
#> GSM862499 3 0.1716 0.825 0.000 0.064 0.936 0.000
#> GSM862500 3 0.1716 0.825 0.000 0.064 0.936 0.000
#> GSM862501 2 0.0336 0.891 0.000 0.992 0.008 0.000
#> GSM862502 2 0.5264 0.635 0.016 0.732 0.028 0.224
#> GSM862503 2 0.0000 0.892 0.000 1.000 0.000 0.000
#> GSM862504 2 0.0000 0.892 0.000 1.000 0.000 0.000
#> GSM862505 2 0.5767 0.628 0.016 0.708 0.052 0.224
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> GSM862441 4 0.5641 0.756 0.128 0.004 0.000 0.640 0.228
#> GSM862442 1 0.1357 0.882 0.948 0.004 0.000 0.000 0.048
#> GSM862443 5 0.6543 -0.357 0.380 0.004 0.000 0.172 0.444
#> GSM862444 4 0.5588 0.735 0.104 0.000 0.000 0.604 0.292
#> GSM862445 4 0.6599 0.743 0.160 0.028 0.000 0.564 0.248
#> GSM862446 1 0.1043 0.890 0.960 0.000 0.000 0.000 0.040
#> GSM862447 1 0.1043 0.890 0.960 0.000 0.000 0.000 0.040
#> GSM862448 1 0.0000 0.896 1.000 0.000 0.000 0.000 0.000
#> GSM862449 1 0.2142 0.859 0.920 0.004 0.000 0.028 0.048
#> GSM862450 4 0.5985 0.677 0.112 0.000 0.000 0.480 0.408
#> GSM862451 4 0.4734 0.738 0.160 0.000 0.000 0.732 0.108
#> GSM862453 1 0.1357 0.878 0.948 0.000 0.000 0.048 0.004
#> GSM862454 4 0.1869 0.649 0.036 0.016 0.000 0.936 0.012
#> GSM862455 4 0.1644 0.668 0.048 0.008 0.000 0.940 0.004
#> GSM862456 4 0.1869 0.649 0.036 0.016 0.000 0.936 0.012
#> GSM862457 4 0.6765 0.728 0.180 0.028 0.000 0.540 0.252
#> GSM862458 4 0.6455 0.680 0.112 0.012 0.004 0.484 0.388
#> GSM862459 4 0.4887 0.756 0.132 0.000 0.000 0.720 0.148
#> GSM862460 1 0.1357 0.882 0.948 0.004 0.000 0.000 0.048
#> GSM862461 5 0.6622 -0.616 0.232 0.000 0.000 0.328 0.440
#> GSM862462 4 0.6655 0.731 0.156 0.024 0.000 0.536 0.284
#> GSM862463 4 0.1869 0.649 0.036 0.016 0.000 0.936 0.012
#> GSM862464 5 0.6401 -0.358 0.380 0.000 0.000 0.172 0.448
#> GSM862465 4 0.3835 0.735 0.048 0.000 0.000 0.796 0.156
#> GSM862466 1 0.0404 0.896 0.988 0.000 0.000 0.012 0.000
#> GSM862467 1 0.0162 0.896 0.996 0.000 0.000 0.004 0.000
#> GSM862468 4 0.6461 0.739 0.148 0.020 0.000 0.560 0.272
#> GSM862469 3 0.0703 0.792 0.000 0.000 0.976 0.000 0.024
#> GSM862470 2 0.3885 0.826 0.000 0.784 0.176 0.000 0.040
#> GSM862471 3 0.1124 0.793 0.000 0.004 0.960 0.000 0.036
#> GSM862472 3 0.5027 0.673 0.000 0.112 0.700 0.000 0.188
#> GSM862473 3 0.6032 0.424 0.000 0.124 0.508 0.000 0.368
#> GSM862474 2 0.3343 0.824 0.000 0.812 0.172 0.000 0.016
#> GSM862475 2 0.6525 0.493 0.000 0.484 0.264 0.000 0.252
#> GSM862476 2 0.3093 0.824 0.000 0.824 0.168 0.000 0.008
#> GSM862477 2 0.3039 0.813 0.000 0.836 0.152 0.000 0.012
#> GSM862478 3 0.0609 0.789 0.000 0.000 0.980 0.000 0.020
#> GSM862479 3 0.1043 0.792 0.000 0.000 0.960 0.000 0.040
#> GSM862480 5 0.6772 -0.332 0.000 0.364 0.272 0.000 0.364
#> GSM862481 3 0.6312 0.289 0.000 0.156 0.452 0.000 0.392
#> GSM862482 4 0.8708 0.279 0.216 0.248 0.004 0.288 0.244
#> GSM862483 1 0.7821 0.242 0.448 0.224 0.000 0.096 0.232
#> GSM862484 2 0.3602 0.821 0.000 0.796 0.180 0.000 0.024
#> GSM862485 3 0.4219 0.740 0.000 0.072 0.772 0.000 0.156
#> GSM862486 2 0.4170 0.813 0.000 0.760 0.192 0.000 0.048
#> GSM862487 3 0.4349 0.736 0.000 0.068 0.756 0.000 0.176
#> GSM862488 3 0.0609 0.789 0.000 0.000 0.980 0.000 0.020
#> GSM862489 2 0.5422 0.737 0.000 0.656 0.212 0.000 0.132
#> GSM862490 2 0.3111 0.808 0.000 0.840 0.144 0.004 0.012
#> GSM862491 3 0.5638 0.563 0.000 0.172 0.636 0.000 0.192
#> GSM862492 3 0.4393 0.731 0.000 0.076 0.756 0.000 0.168
#> GSM862493 2 0.3391 0.827 0.000 0.800 0.188 0.000 0.012
#> GSM862494 3 0.0609 0.789 0.000 0.000 0.980 0.000 0.020
#> GSM862495 5 0.6823 -0.331 0.000 0.336 0.320 0.000 0.344
#> GSM862496 5 0.6665 -0.259 0.000 0.300 0.260 0.000 0.440
#> GSM862497 5 0.6729 -0.349 0.000 0.372 0.252 0.000 0.376
#> GSM862498 2 0.6309 0.557 0.000 0.532 0.236 0.000 0.232
#> GSM862499 3 0.0609 0.789 0.000 0.000 0.980 0.000 0.020
#> GSM862500 3 0.0609 0.789 0.000 0.000 0.980 0.000 0.020
#> GSM862501 2 0.4734 0.793 0.000 0.724 0.188 0.000 0.088
#> GSM862502 2 0.7066 0.484 0.000 0.548 0.104 0.096 0.252
#> GSM862503 2 0.3724 0.823 0.000 0.788 0.184 0.000 0.028
#> GSM862504 2 0.2970 0.825 0.000 0.828 0.168 0.000 0.004
#> GSM862505 2 0.7073 0.415 0.000 0.536 0.096 0.096 0.272
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> GSM862441 4 0.1682 0.5505 0.020 0.000 0.000 0.928 0.000 0.052
#> GSM862442 1 0.1949 0.8905 0.904 0.000 0.000 0.088 0.004 0.004
#> GSM862443 4 0.6012 0.4421 0.116 0.000 0.032 0.596 0.016 0.240
#> GSM862444 4 0.2502 0.5388 0.000 0.000 0.020 0.884 0.012 0.084
#> GSM862445 4 0.1806 0.5812 0.044 0.000 0.000 0.928 0.008 0.020
#> GSM862446 1 0.2300 0.8621 0.856 0.000 0.000 0.144 0.000 0.000
#> GSM862447 1 0.2378 0.8549 0.848 0.000 0.000 0.152 0.000 0.000
#> GSM862448 1 0.0865 0.8969 0.964 0.000 0.000 0.036 0.000 0.000
#> GSM862449 1 0.4158 0.6621 0.704 0.000 0.000 0.244 0.000 0.052
#> GSM862450 4 0.2358 0.5641 0.000 0.000 0.028 0.900 0.016 0.056
#> GSM862451 4 0.4377 0.0202 0.068 0.000 0.000 0.688 0.000 0.244
#> GSM862453 1 0.1707 0.8977 0.928 0.000 0.000 0.056 0.004 0.012
#> GSM862454 6 0.3756 0.9627 0.000 0.000 0.000 0.400 0.000 0.600
#> GSM862455 6 0.4165 0.8788 0.012 0.000 0.000 0.452 0.000 0.536
#> GSM862456 6 0.3756 0.9627 0.000 0.000 0.000 0.400 0.000 0.600
#> GSM862457 4 0.2011 0.5727 0.064 0.000 0.000 0.912 0.004 0.020
#> GSM862458 4 0.5912 0.3500 0.040 0.000 0.064 0.664 0.160 0.072
#> GSM862459 4 0.2176 0.5223 0.024 0.000 0.000 0.896 0.000 0.080
#> GSM862460 1 0.1949 0.8905 0.904 0.000 0.000 0.088 0.004 0.004
#> GSM862461 4 0.5620 0.4609 0.080 0.000 0.032 0.636 0.016 0.236
#> GSM862462 4 0.1749 0.5813 0.036 0.000 0.000 0.932 0.008 0.024
#> GSM862463 6 0.3756 0.9627 0.000 0.000 0.000 0.400 0.000 0.600
#> GSM862464 4 0.6012 0.4421 0.116 0.000 0.032 0.596 0.016 0.240
#> GSM862465 4 0.2915 0.3835 0.004 0.000 0.004 0.824 0.004 0.164
#> GSM862466 1 0.1753 0.8955 0.912 0.000 0.000 0.084 0.000 0.004
#> GSM862467 1 0.1010 0.8970 0.960 0.000 0.000 0.036 0.000 0.004
#> GSM862468 4 0.1675 0.5817 0.032 0.000 0.000 0.936 0.008 0.024
#> GSM862469 3 0.1152 0.7055 0.000 0.044 0.952 0.000 0.004 0.000
#> GSM862470 2 0.1296 0.7014 0.004 0.948 0.004 0.000 0.044 0.000
#> GSM862471 3 0.1863 0.7041 0.000 0.044 0.920 0.000 0.036 0.000
#> GSM862472 3 0.4800 0.5462 0.000 0.168 0.672 0.000 0.160 0.000
#> GSM862473 3 0.5670 0.2411 0.000 0.188 0.516 0.000 0.296 0.000
#> GSM862474 2 0.0951 0.6974 0.004 0.968 0.008 0.000 0.020 0.000
#> GSM862475 2 0.4648 0.1050 0.004 0.584 0.040 0.000 0.372 0.000
#> GSM862476 2 0.0405 0.7043 0.000 0.988 0.008 0.000 0.004 0.000
#> GSM862477 2 0.1226 0.6722 0.004 0.952 0.004 0.000 0.040 0.000
#> GSM862478 3 0.5462 0.6605 0.000 0.044 0.656 0.000 0.176 0.124
#> GSM862479 3 0.1265 0.7063 0.000 0.044 0.948 0.000 0.008 0.000
#> GSM862480 2 0.5060 -0.1374 0.004 0.504 0.064 0.000 0.428 0.000
#> GSM862481 3 0.6047 -0.1560 0.000 0.256 0.392 0.000 0.352 0.000
#> GSM862482 4 0.8304 0.0681 0.084 0.128 0.012 0.376 0.296 0.104
#> GSM862483 4 0.8653 0.1821 0.260 0.096 0.012 0.316 0.220 0.096
#> GSM862484 2 0.2149 0.6809 0.004 0.900 0.016 0.000 0.080 0.000
#> GSM862485 3 0.3313 0.6791 0.000 0.060 0.816 0.000 0.124 0.000
#> GSM862486 2 0.2678 0.6460 0.004 0.860 0.020 0.000 0.116 0.000
#> GSM862487 3 0.3493 0.6739 0.000 0.064 0.800 0.000 0.136 0.000
#> GSM862488 3 0.5530 0.6474 0.000 0.040 0.644 0.000 0.184 0.132
#> GSM862489 2 0.3212 0.5742 0.004 0.800 0.016 0.000 0.180 0.000
#> GSM862490 2 0.2183 0.6841 0.012 0.912 0.020 0.000 0.052 0.004
#> GSM862491 3 0.5166 0.4569 0.004 0.092 0.608 0.000 0.292 0.004
#> GSM862492 3 0.3893 0.6583 0.000 0.092 0.768 0.000 0.140 0.000
#> GSM862493 2 0.0520 0.7047 0.000 0.984 0.008 0.000 0.008 0.000
#> GSM862494 3 0.5530 0.6474 0.000 0.040 0.644 0.000 0.184 0.132
#> GSM862495 5 0.5450 0.4918 0.004 0.368 0.112 0.000 0.516 0.000
#> GSM862496 5 0.5052 0.3669 0.000 0.388 0.080 0.000 0.532 0.000
#> GSM862497 2 0.5066 -0.1620 0.004 0.496 0.064 0.000 0.436 0.000
#> GSM862498 2 0.4286 0.2779 0.004 0.648 0.028 0.000 0.320 0.000
#> GSM862499 3 0.5370 0.6583 0.000 0.040 0.664 0.000 0.172 0.124
#> GSM862500 3 0.5370 0.6583 0.000 0.040 0.664 0.000 0.172 0.124
#> GSM862501 2 0.2810 0.5900 0.004 0.832 0.008 0.000 0.156 0.000
#> GSM862502 5 0.5381 0.4576 0.016 0.428 0.004 0.008 0.504 0.040
#> GSM862503 2 0.1552 0.7013 0.004 0.940 0.020 0.000 0.036 0.000
#> GSM862504 2 0.0520 0.7034 0.000 0.984 0.008 0.000 0.008 0.000
#> GSM862505 5 0.5241 0.5450 0.016 0.352 0.004 0.008 0.580 0.040
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 tissue(p) k
#> CV:mclust 64 4.06e-13 2
#> CV:mclust 55 4.73e-11 3
#> CV:mclust 59 6.01e-12 4
#> CV:mclust 50 7.99e-11 5
#> CV:mclust 46 9.08e-09 6
If matrix rows can be associated to genes, consider to use functional_enrichment(res,
...)
to perform function enrichment for the signature genes. See this vignette for more detailed explanations.
The object with results only for a single top-value method and a single partition method can be extracted as:
res = res_list["CV", "NMF"]
# you can also extract it by
# res = res_list["CV:NMF"]
A summary of res
and all the functions that can be applied to it:
res
#> A 'ConsensusPartition' object with k = 2, 3, 4, 5, 6.
#> On a matrix with 51941 rows and 64 columns.
#> Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'CV' method.
#> Subgroups are detected by 'NMF' method.
#> Performed in total 1250 partitions by row resampling.
#> Best k for subgroups seems to be 2.
#>
#> Following methods can be applied to this 'ConsensusPartition' object:
#> [1] "cola_report" "collect_classes" "collect_plots"
#> [4] "collect_stats" "colnames" "compare_signatures"
#> [7] "consensus_heatmap" "dimension_reduction" "functional_enrichment"
#> [10] "get_anno_col" "get_anno" "get_classes"
#> [13] "get_consensus" "get_matrix" "get_membership"
#> [16] "get_param" "get_signatures" "get_stats"
#> [19] "is_best_k" "is_stable_k" "membership_heatmap"
#> [22] "ncol" "nrow" "plot_ecdf"
#> [25] "rownames" "select_partition_number" "show"
#> [28] "suggest_best_k" "test_to_known_factors"
collect_plots()
function collects all the plots made from res
for all k
(number of partitions)
into one single page to provide an easy and fast comparison between different k
.
collect_plots(res)
The plots are:
k
and the heatmap of
predicted classes for each k
.k
.k
.k
.All the plots in panels can be made by individual functions and they are plotted later in this section.
select_partition_number()
produces several plots showing different
statistics for choosing “optimized” k
. There are following statistics:
k
;k
, the area increased is defined as \(A_k - A_{k-1}\).The detailed explanations of these statistics can be found in the cola vignette.
Generally speaking, lower PAC score, higher mean silhouette score or higher
concordance corresponds to better partition. Rand index and Jaccard index
measure how similar the current partition is compared to partition with k-1
.
If they are too similar, we won't accept k
is better than k-1
.
select_partition_number(res)
The numeric values for all these statistics can be obtained by get_stats()
.
get_stats(res)
#> k 1-PAC mean_silhouette concordance area_increased Rand Jaccard
#> 2 2 1.000 0.984 0.993 0.4928 0.510 0.510
#> 3 3 0.712 0.813 0.771 0.2903 0.800 0.618
#> 4 4 0.799 0.863 0.902 0.1699 0.878 0.657
#> 5 5 0.854 0.810 0.882 0.0711 0.934 0.745
#> 6 6 0.881 0.811 0.891 0.0371 0.931 0.687
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
#> GSM862441 1 0.000 1.000 1.000 0.000
#> GSM862442 1 0.000 1.000 1.000 0.000
#> GSM862443 1 0.000 1.000 1.000 0.000
#> GSM862444 1 0.000 1.000 1.000 0.000
#> GSM862445 1 0.000 1.000 1.000 0.000
#> GSM862446 1 0.000 1.000 1.000 0.000
#> GSM862447 1 0.000 1.000 1.000 0.000
#> GSM862448 1 0.000 1.000 1.000 0.000
#> GSM862449 1 0.000 1.000 1.000 0.000
#> GSM862450 1 0.000 1.000 1.000 0.000
#> GSM862451 1 0.000 1.000 1.000 0.000
#> GSM862453 1 0.000 1.000 1.000 0.000
#> GSM862454 1 0.000 1.000 1.000 0.000
#> GSM862455 1 0.000 1.000 1.000 0.000
#> GSM862456 1 0.000 1.000 1.000 0.000
#> GSM862457 1 0.000 1.000 1.000 0.000
#> GSM862458 2 0.891 0.563 0.308 0.692
#> GSM862459 1 0.000 1.000 1.000 0.000
#> GSM862460 1 0.000 1.000 1.000 0.000
#> GSM862461 1 0.000 1.000 1.000 0.000
#> GSM862462 1 0.000 1.000 1.000 0.000
#> GSM862463 1 0.000 1.000 1.000 0.000
#> GSM862464 1 0.000 1.000 1.000 0.000
#> GSM862465 1 0.000 1.000 1.000 0.000
#> GSM862466 1 0.000 1.000 1.000 0.000
#> GSM862467 1 0.000 1.000 1.000 0.000
#> GSM862468 1 0.000 1.000 1.000 0.000
#> GSM862469 2 0.000 0.988 0.000 1.000
#> GSM862470 2 0.000 0.988 0.000 1.000
#> GSM862471 2 0.000 0.988 0.000 1.000
#> GSM862472 2 0.000 0.988 0.000 1.000
#> GSM862473 2 0.000 0.988 0.000 1.000
#> GSM862474 2 0.000 0.988 0.000 1.000
#> GSM862475 2 0.000 0.988 0.000 1.000
#> GSM862476 2 0.000 0.988 0.000 1.000
#> GSM862477 2 0.000 0.988 0.000 1.000
#> GSM862478 2 0.000 0.988 0.000 1.000
#> GSM862479 2 0.000 0.988 0.000 1.000
#> GSM862480 2 0.000 0.988 0.000 1.000
#> GSM862481 2 0.000 0.988 0.000 1.000
#> GSM862482 2 0.529 0.861 0.120 0.880
#> GSM862483 2 0.000 0.988 0.000 1.000
#> GSM862484 2 0.000 0.988 0.000 1.000
#> GSM862485 2 0.000 0.988 0.000 1.000
#> GSM862486 2 0.000 0.988 0.000 1.000
#> GSM862487 2 0.000 0.988 0.000 1.000
#> GSM862488 2 0.000 0.988 0.000 1.000
#> GSM862489 2 0.000 0.988 0.000 1.000
#> GSM862490 2 0.000 0.988 0.000 1.000
#> GSM862491 2 0.000 0.988 0.000 1.000
#> GSM862492 2 0.000 0.988 0.000 1.000
#> GSM862493 2 0.000 0.988 0.000 1.000
#> GSM862494 2 0.000 0.988 0.000 1.000
#> GSM862495 2 0.000 0.988 0.000 1.000
#> GSM862496 2 0.000 0.988 0.000 1.000
#> GSM862497 2 0.000 0.988 0.000 1.000
#> GSM862498 2 0.000 0.988 0.000 1.000
#> GSM862499 2 0.000 0.988 0.000 1.000
#> GSM862500 2 0.000 0.988 0.000 1.000
#> GSM862501 2 0.000 0.988 0.000 1.000
#> GSM862502 2 0.000 0.988 0.000 1.000
#> GSM862503 2 0.000 0.988 0.000 1.000
#> GSM862504 2 0.000 0.988 0.000 1.000
#> GSM862505 2 0.000 0.988 0.000 1.000
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> GSM862441 1 0.0000 0.886 1.000 0.000 0.000
#> GSM862442 1 0.5560 0.794 0.700 0.000 0.300
#> GSM862443 1 0.0747 0.884 0.984 0.000 0.016
#> GSM862444 1 0.0000 0.886 1.000 0.000 0.000
#> GSM862445 1 0.1163 0.869 0.972 0.028 0.000
#> GSM862446 1 0.5968 0.760 0.636 0.000 0.364
#> GSM862447 1 0.5988 0.758 0.632 0.000 0.368
#> GSM862448 1 0.5968 0.760 0.636 0.000 0.364
#> GSM862449 1 0.6379 0.752 0.624 0.008 0.368
#> GSM862450 1 0.0000 0.886 1.000 0.000 0.000
#> GSM862451 1 0.0000 0.886 1.000 0.000 0.000
#> GSM862453 1 0.5591 0.792 0.696 0.000 0.304
#> GSM862454 1 0.0000 0.886 1.000 0.000 0.000
#> GSM862455 1 0.0000 0.886 1.000 0.000 0.000
#> GSM862456 1 0.0000 0.886 1.000 0.000 0.000
#> GSM862457 1 0.0000 0.886 1.000 0.000 0.000
#> GSM862458 1 0.9411 -0.164 0.444 0.176 0.380
#> GSM862459 1 0.0000 0.886 1.000 0.000 0.000
#> GSM862460 1 0.5327 0.806 0.728 0.000 0.272
#> GSM862461 1 0.0000 0.886 1.000 0.000 0.000
#> GSM862462 1 0.0000 0.886 1.000 0.000 0.000
#> GSM862463 1 0.0000 0.886 1.000 0.000 0.000
#> GSM862464 1 0.1289 0.880 0.968 0.000 0.032
#> GSM862465 1 0.0000 0.886 1.000 0.000 0.000
#> GSM862466 1 0.5291 0.808 0.732 0.000 0.268
#> GSM862467 1 0.5138 0.813 0.748 0.000 0.252
#> GSM862468 1 0.0000 0.886 1.000 0.000 0.000
#> GSM862469 3 0.5988 0.992 0.000 0.368 0.632
#> GSM862470 2 0.0000 0.845 0.000 1.000 0.000
#> GSM862471 3 0.5988 0.992 0.000 0.368 0.632
#> GSM862472 3 0.5988 0.992 0.000 0.368 0.632
#> GSM862473 3 0.5988 0.992 0.000 0.368 0.632
#> GSM862474 2 0.0237 0.844 0.000 0.996 0.004
#> GSM862475 2 0.3551 0.658 0.000 0.868 0.132
#> GSM862476 2 0.0237 0.844 0.000 0.996 0.004
#> GSM862477 2 0.0237 0.844 0.000 0.996 0.004
#> GSM862478 3 0.5988 0.992 0.000 0.368 0.632
#> GSM862479 3 0.5988 0.992 0.000 0.368 0.632
#> GSM862480 2 0.6045 -0.295 0.000 0.620 0.380
#> GSM862481 3 0.6008 0.986 0.000 0.372 0.628
#> GSM862482 2 0.4912 0.594 0.196 0.796 0.008
#> GSM862483 2 0.5988 0.437 0.000 0.632 0.368
#> GSM862484 2 0.0000 0.845 0.000 1.000 0.000
#> GSM862485 3 0.5988 0.992 0.000 0.368 0.632
#> GSM862486 2 0.0000 0.845 0.000 1.000 0.000
#> GSM862487 3 0.5988 0.992 0.000 0.368 0.632
#> GSM862488 3 0.5988 0.992 0.000 0.368 0.632
#> GSM862489 2 0.0000 0.845 0.000 1.000 0.000
#> GSM862490 2 0.0000 0.845 0.000 1.000 0.000
#> GSM862491 3 0.5988 0.992 0.000 0.368 0.632
#> GSM862492 3 0.5988 0.992 0.000 0.368 0.632
#> GSM862493 2 0.0237 0.844 0.000 0.996 0.004
#> GSM862494 3 0.5988 0.992 0.000 0.368 0.632
#> GSM862495 3 0.6140 0.937 0.000 0.404 0.596
#> GSM862496 3 0.6140 0.936 0.000 0.404 0.596
#> GSM862497 2 0.6079 -0.329 0.000 0.612 0.388
#> GSM862498 2 0.1411 0.807 0.000 0.964 0.036
#> GSM862499 3 0.5988 0.992 0.000 0.368 0.632
#> GSM862500 3 0.5988 0.992 0.000 0.368 0.632
#> GSM862501 2 0.0237 0.844 0.000 0.996 0.004
#> GSM862502 2 0.0000 0.845 0.000 1.000 0.000
#> GSM862503 2 0.0000 0.845 0.000 1.000 0.000
#> GSM862504 2 0.0000 0.845 0.000 1.000 0.000
#> GSM862505 2 0.4555 0.498 0.000 0.800 0.200
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> GSM862441 4 0.0000 0.9697 0.000 0.000 0.000 1.000
#> GSM862442 1 0.3486 0.9134 0.812 0.000 0.000 0.188
#> GSM862443 1 0.5132 0.5621 0.548 0.000 0.004 0.448
#> GSM862444 4 0.0000 0.9697 0.000 0.000 0.000 1.000
#> GSM862445 4 0.1151 0.9310 0.024 0.008 0.000 0.968
#> GSM862446 1 0.3219 0.9082 0.836 0.000 0.000 0.164
#> GSM862447 1 0.3219 0.9082 0.836 0.000 0.000 0.164
#> GSM862448 1 0.3219 0.9082 0.836 0.000 0.000 0.164
#> GSM862449 1 0.1792 0.8183 0.932 0.000 0.000 0.068
#> GSM862450 4 0.0000 0.9697 0.000 0.000 0.000 1.000
#> GSM862451 4 0.0000 0.9697 0.000 0.000 0.000 1.000
#> GSM862453 1 0.3649 0.9115 0.796 0.000 0.000 0.204
#> GSM862454 4 0.0000 0.9697 0.000 0.000 0.000 1.000
#> GSM862455 4 0.0000 0.9697 0.000 0.000 0.000 1.000
#> GSM862456 4 0.0000 0.9697 0.000 0.000 0.000 1.000
#> GSM862457 4 0.0000 0.9697 0.000 0.000 0.000 1.000
#> GSM862458 4 0.6381 0.5731 0.032 0.084 0.188 0.696
#> GSM862459 4 0.0000 0.9697 0.000 0.000 0.000 1.000
#> GSM862460 1 0.3569 0.9133 0.804 0.000 0.000 0.196
#> GSM862461 4 0.0000 0.9697 0.000 0.000 0.000 1.000
#> GSM862462 4 0.0000 0.9697 0.000 0.000 0.000 1.000
#> GSM862463 4 0.0000 0.9697 0.000 0.000 0.000 1.000
#> GSM862464 1 0.5619 0.8207 0.676 0.000 0.056 0.268
#> GSM862465 4 0.0000 0.9697 0.000 0.000 0.000 1.000
#> GSM862466 1 0.4103 0.8771 0.744 0.000 0.000 0.256
#> GSM862467 1 0.3801 0.9043 0.780 0.000 0.000 0.220
#> GSM862468 4 0.0000 0.9697 0.000 0.000 0.000 1.000
#> GSM862469 3 0.0000 0.9815 0.000 0.000 1.000 0.000
#> GSM862470 2 0.3172 0.8260 0.160 0.840 0.000 0.000
#> GSM862471 3 0.0000 0.9815 0.000 0.000 1.000 0.000
#> GSM862472 3 0.0000 0.9815 0.000 0.000 1.000 0.000
#> GSM862473 3 0.1557 0.9314 0.000 0.056 0.944 0.000
#> GSM862474 2 0.2760 0.8375 0.128 0.872 0.000 0.000
#> GSM862475 2 0.0000 0.8438 0.000 1.000 0.000 0.000
#> GSM862476 2 0.2704 0.8387 0.124 0.876 0.000 0.000
#> GSM862477 2 0.3074 0.8297 0.152 0.848 0.000 0.000
#> GSM862478 3 0.0000 0.9815 0.000 0.000 1.000 0.000
#> GSM862479 3 0.0000 0.9815 0.000 0.000 1.000 0.000
#> GSM862480 2 0.4431 0.5542 0.000 0.696 0.304 0.000
#> GSM862481 3 0.3400 0.7736 0.000 0.180 0.820 0.000
#> GSM862482 2 0.5222 0.5724 0.032 0.688 0.000 0.280
#> GSM862483 2 0.4382 0.7121 0.296 0.704 0.000 0.000
#> GSM862484 2 0.2647 0.8396 0.120 0.880 0.000 0.000
#> GSM862485 3 0.0000 0.9815 0.000 0.000 1.000 0.000
#> GSM862486 2 0.2530 0.8405 0.112 0.888 0.000 0.000
#> GSM862487 3 0.0188 0.9786 0.000 0.004 0.996 0.000
#> GSM862488 3 0.0000 0.9815 0.000 0.000 1.000 0.000
#> GSM862489 2 0.0188 0.8442 0.004 0.996 0.000 0.000
#> GSM862490 2 0.0469 0.8445 0.012 0.988 0.000 0.000
#> GSM862491 3 0.0000 0.9815 0.000 0.000 1.000 0.000
#> GSM862492 3 0.0000 0.9815 0.000 0.000 1.000 0.000
#> GSM862493 2 0.2814 0.8362 0.132 0.868 0.000 0.000
#> GSM862494 3 0.0000 0.9815 0.000 0.000 1.000 0.000
#> GSM862495 2 0.4790 0.3989 0.000 0.620 0.380 0.000
#> GSM862496 2 0.4999 0.0611 0.000 0.508 0.492 0.000
#> GSM862497 2 0.4522 0.5273 0.000 0.680 0.320 0.000
#> GSM862498 2 0.0817 0.8462 0.024 0.976 0.000 0.000
#> GSM862499 3 0.0000 0.9815 0.000 0.000 1.000 0.000
#> GSM862500 3 0.0000 0.9815 0.000 0.000 1.000 0.000
#> GSM862501 2 0.0921 0.8442 0.028 0.972 0.000 0.000
#> GSM862502 2 0.0707 0.8441 0.020 0.980 0.000 0.000
#> GSM862503 2 0.0000 0.8438 0.000 1.000 0.000 0.000
#> GSM862504 2 0.2408 0.8426 0.104 0.896 0.000 0.000
#> GSM862505 2 0.1867 0.8155 0.000 0.928 0.072 0.000
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> GSM862441 4 0.0510 0.954 0.000 0.000 0.000 0.984 0.016
#> GSM862442 1 0.1544 0.933 0.932 0.000 0.000 0.068 0.000
#> GSM862443 1 0.4370 0.820 0.768 0.000 0.040 0.176 0.016
#> GSM862444 4 0.0290 0.954 0.000 0.000 0.000 0.992 0.008
#> GSM862445 4 0.3149 0.833 0.012 0.040 0.000 0.868 0.080
#> GSM862446 1 0.1478 0.932 0.936 0.000 0.000 0.064 0.000
#> GSM862447 1 0.1478 0.931 0.936 0.000 0.000 0.064 0.000
#> GSM862448 1 0.1410 0.929 0.940 0.000 0.000 0.060 0.000
#> GSM862449 1 0.2890 0.726 0.836 0.000 0.000 0.004 0.160
#> GSM862450 4 0.0510 0.954 0.000 0.000 0.000 0.984 0.016
#> GSM862451 4 0.0290 0.954 0.000 0.000 0.000 0.992 0.008
#> GSM862453 1 0.1544 0.933 0.932 0.000 0.000 0.068 0.000
#> GSM862454 4 0.0290 0.954 0.000 0.000 0.000 0.992 0.008
#> GSM862455 4 0.0290 0.955 0.000 0.000 0.000 0.992 0.008
#> GSM862456 4 0.0290 0.954 0.000 0.000 0.000 0.992 0.008
#> GSM862457 4 0.0510 0.954 0.000 0.000 0.000 0.984 0.016
#> GSM862458 4 0.5656 0.478 0.004 0.000 0.100 0.612 0.284
#> GSM862459 4 0.0290 0.954 0.000 0.000 0.000 0.992 0.008
#> GSM862460 1 0.1608 0.933 0.928 0.000 0.000 0.072 0.000
#> GSM862461 4 0.0510 0.954 0.000 0.000 0.000 0.984 0.016
#> GSM862462 4 0.0510 0.954 0.000 0.000 0.000 0.984 0.016
#> GSM862463 4 0.0000 0.955 0.000 0.000 0.000 1.000 0.000
#> GSM862464 1 0.4508 0.823 0.780 0.000 0.104 0.100 0.016
#> GSM862465 4 0.0404 0.953 0.000 0.000 0.000 0.988 0.012
#> GSM862466 1 0.1965 0.923 0.904 0.000 0.000 0.096 0.000
#> GSM862467 1 0.1965 0.923 0.904 0.000 0.000 0.096 0.000
#> GSM862468 4 0.0963 0.942 0.000 0.000 0.000 0.964 0.036
#> GSM862469 3 0.0162 0.976 0.000 0.000 0.996 0.000 0.004
#> GSM862470 5 0.3368 0.687 0.024 0.156 0.000 0.000 0.820
#> GSM862471 3 0.0000 0.978 0.000 0.000 1.000 0.000 0.000
#> GSM862472 3 0.0290 0.974 0.000 0.008 0.992 0.000 0.000
#> GSM862473 3 0.3652 0.710 0.004 0.200 0.784 0.000 0.012
#> GSM862474 2 0.4555 0.594 0.020 0.636 0.000 0.000 0.344
#> GSM862475 2 0.0404 0.674 0.000 0.988 0.000 0.000 0.012
#> GSM862476 2 0.4555 0.594 0.020 0.636 0.000 0.000 0.344
#> GSM862477 5 0.3236 0.588 0.020 0.152 0.000 0.000 0.828
#> GSM862478 3 0.0000 0.978 0.000 0.000 1.000 0.000 0.000
#> GSM862479 3 0.0162 0.976 0.000 0.000 0.996 0.000 0.004
#> GSM862480 2 0.1124 0.670 0.004 0.960 0.036 0.000 0.000
#> GSM862481 2 0.4973 -0.008 0.004 0.496 0.480 0.000 0.020
#> GSM862482 2 0.6182 0.498 0.008 0.560 0.000 0.136 0.296
#> GSM862483 5 0.3216 0.670 0.108 0.044 0.000 0.000 0.848
#> GSM862484 2 0.4339 0.605 0.012 0.652 0.000 0.000 0.336
#> GSM862485 3 0.0000 0.978 0.000 0.000 1.000 0.000 0.000
#> GSM862486 5 0.3368 0.721 0.024 0.156 0.000 0.000 0.820
#> GSM862487 3 0.0510 0.966 0.000 0.016 0.984 0.000 0.000
#> GSM862488 3 0.0000 0.978 0.000 0.000 1.000 0.000 0.000
#> GSM862489 2 0.1282 0.681 0.004 0.952 0.000 0.000 0.044
#> GSM862490 5 0.4383 0.621 0.004 0.424 0.000 0.000 0.572
#> GSM862491 3 0.0000 0.978 0.000 0.000 1.000 0.000 0.000
#> GSM862492 3 0.0162 0.976 0.000 0.004 0.996 0.000 0.000
#> GSM862493 2 0.4696 0.574 0.024 0.616 0.000 0.000 0.360
#> GSM862494 3 0.0000 0.978 0.000 0.000 1.000 0.000 0.000
#> GSM862495 2 0.1954 0.647 0.008 0.932 0.028 0.000 0.032
#> GSM862496 2 0.1569 0.660 0.004 0.944 0.044 0.000 0.008
#> GSM862497 2 0.1043 0.670 0.000 0.960 0.040 0.000 0.000
#> GSM862498 2 0.3659 0.649 0.012 0.768 0.000 0.000 0.220
#> GSM862499 3 0.0000 0.978 0.000 0.000 1.000 0.000 0.000
#> GSM862500 3 0.0000 0.978 0.000 0.000 1.000 0.000 0.000
#> GSM862501 5 0.4482 0.660 0.016 0.348 0.000 0.000 0.636
#> GSM862502 5 0.4436 0.619 0.008 0.396 0.000 0.000 0.596
#> GSM862503 2 0.1571 0.642 0.004 0.936 0.000 0.000 0.060
#> GSM862504 2 0.4235 0.607 0.008 0.656 0.000 0.000 0.336
#> GSM862505 2 0.1618 0.652 0.008 0.944 0.008 0.000 0.040
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> GSM862441 4 0.0436 0.910 0.000 0.004 0.000 0.988 0.004 0.004
#> GSM862442 1 0.0632 0.953 0.976 0.000 0.000 0.024 0.000 0.000
#> GSM862443 1 0.2931 0.859 0.860 0.000 0.044 0.088 0.004 0.004
#> GSM862444 4 0.0665 0.912 0.000 0.008 0.000 0.980 0.004 0.008
#> GSM862445 4 0.3966 0.200 0.000 0.444 0.000 0.552 0.000 0.004
#> GSM862446 1 0.0632 0.953 0.976 0.000 0.000 0.024 0.000 0.000
#> GSM862447 1 0.0632 0.953 0.976 0.000 0.000 0.024 0.000 0.000
#> GSM862448 1 0.0632 0.953 0.976 0.000 0.000 0.024 0.000 0.000
#> GSM862449 6 0.4273 0.476 0.324 0.012 0.000 0.016 0.000 0.648
#> GSM862450 4 0.0912 0.905 0.000 0.008 0.004 0.972 0.004 0.012
#> GSM862451 4 0.1275 0.909 0.000 0.016 0.000 0.956 0.016 0.012
#> GSM862453 1 0.0632 0.953 0.976 0.000 0.000 0.024 0.000 0.000
#> GSM862454 4 0.1275 0.909 0.000 0.016 0.000 0.956 0.016 0.012
#> GSM862455 4 0.0622 0.912 0.000 0.000 0.000 0.980 0.012 0.008
#> GSM862456 4 0.1275 0.909 0.000 0.016 0.000 0.956 0.016 0.012
#> GSM862457 4 0.0551 0.909 0.000 0.008 0.000 0.984 0.004 0.004
#> GSM862458 4 0.5920 0.296 0.000 0.016 0.148 0.544 0.004 0.288
#> GSM862459 4 0.0862 0.912 0.000 0.016 0.000 0.972 0.008 0.004
#> GSM862460 1 0.0632 0.953 0.976 0.000 0.000 0.024 0.000 0.000
#> GSM862461 4 0.0436 0.910 0.000 0.004 0.000 0.988 0.004 0.004
#> GSM862462 4 0.0551 0.909 0.000 0.008 0.000 0.984 0.004 0.004
#> GSM862463 4 0.1173 0.910 0.000 0.016 0.000 0.960 0.016 0.008
#> GSM862464 1 0.3991 0.713 0.760 0.000 0.180 0.052 0.004 0.004
#> GSM862465 4 0.2160 0.889 0.024 0.020 0.000 0.920 0.024 0.012
#> GSM862466 1 0.0935 0.946 0.964 0.000 0.000 0.032 0.004 0.000
#> GSM862467 1 0.0713 0.951 0.972 0.000 0.000 0.028 0.000 0.000
#> GSM862468 4 0.1268 0.894 0.000 0.008 0.000 0.952 0.004 0.036
#> GSM862469 3 0.0363 0.986 0.000 0.000 0.988 0.000 0.012 0.000
#> GSM862470 6 0.2630 0.800 0.000 0.064 0.000 0.000 0.064 0.872
#> GSM862471 3 0.0000 0.994 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM862472 3 0.0146 0.991 0.000 0.000 0.996 0.000 0.004 0.000
#> GSM862473 5 0.4694 0.425 0.000 0.052 0.376 0.000 0.572 0.000
#> GSM862474 2 0.0790 0.836 0.000 0.968 0.000 0.000 0.032 0.000
#> GSM862475 5 0.3383 0.693 0.000 0.268 0.000 0.000 0.728 0.004
#> GSM862476 2 0.0937 0.836 0.000 0.960 0.000 0.000 0.040 0.000
#> GSM862477 2 0.4314 0.131 0.000 0.536 0.000 0.000 0.020 0.444
#> GSM862478 3 0.0000 0.994 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM862479 3 0.0508 0.983 0.000 0.000 0.984 0.000 0.012 0.004
#> GSM862480 5 0.2915 0.743 0.000 0.184 0.008 0.000 0.808 0.000
#> GSM862481 5 0.4952 0.594 0.000 0.168 0.180 0.000 0.652 0.000
#> GSM862482 2 0.2781 0.702 0.000 0.860 0.000 0.108 0.024 0.008
#> GSM862483 6 0.1349 0.802 0.004 0.056 0.000 0.000 0.000 0.940
#> GSM862484 2 0.0937 0.836 0.000 0.960 0.000 0.000 0.040 0.000
#> GSM862485 3 0.0000 0.994 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM862486 6 0.1492 0.813 0.000 0.036 0.000 0.000 0.024 0.940
#> GSM862487 3 0.0603 0.979 0.000 0.004 0.980 0.000 0.016 0.000
#> GSM862488 3 0.0000 0.994 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM862489 5 0.3647 0.568 0.000 0.360 0.000 0.000 0.640 0.000
#> GSM862490 5 0.4301 0.343 0.000 0.024 0.000 0.000 0.584 0.392
#> GSM862491 3 0.0000 0.994 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM862492 3 0.0603 0.981 0.000 0.004 0.980 0.000 0.016 0.000
#> GSM862493 2 0.1151 0.831 0.000 0.956 0.000 0.000 0.032 0.012
#> GSM862494 3 0.0000 0.994 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM862495 5 0.1364 0.734 0.000 0.048 0.004 0.000 0.944 0.004
#> GSM862496 5 0.2692 0.750 0.000 0.148 0.012 0.000 0.840 0.000
#> GSM862497 5 0.3078 0.741 0.000 0.192 0.012 0.000 0.796 0.000
#> GSM862498 2 0.3555 0.463 0.000 0.712 0.000 0.000 0.280 0.008
#> GSM862499 3 0.0000 0.994 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM862500 3 0.0000 0.994 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM862501 6 0.2902 0.723 0.000 0.004 0.000 0.000 0.196 0.800
#> GSM862502 5 0.3364 0.529 0.024 0.000 0.000 0.000 0.780 0.196
#> GSM862503 5 0.3566 0.721 0.000 0.224 0.000 0.000 0.752 0.024
#> GSM862504 2 0.1007 0.834 0.000 0.956 0.000 0.000 0.044 0.000
#> GSM862505 5 0.1353 0.708 0.024 0.012 0.000 0.000 0.952 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 tissue(p) k
#> CV:NMF 64 6.95e-14 2
#> CV:NMF 59 1.54e-13 3
#> CV:NMF 62 2.20e-13 4
#> CV:NMF 61 1.79e-12 5
#> CV:NMF 57 5.06e-11 6
If matrix rows can be associated to genes, consider to use functional_enrichment(res,
...)
to perform function enrichment for the signature genes. See this vignette for more detailed explanations.
The object with results only for a single top-value method and a single partition method can be extracted as:
res = res_list["MAD", "hclust"]
# you can also extract it by
# res = res_list["MAD:hclust"]
A summary of res
and all the functions that can be applied to it:
res
#> A 'ConsensusPartition' object with k = 2, 3, 4, 5, 6.
#> On a matrix with 51941 rows and 64 columns.
#> Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'MAD' method.
#> Subgroups are detected by 'hclust' method.
#> Performed in total 1250 partitions by row resampling.
#> Best k for subgroups seems to be 3.
#>
#> Following methods can be applied to this 'ConsensusPartition' object:
#> [1] "cola_report" "collect_classes" "collect_plots"
#> [4] "collect_stats" "colnames" "compare_signatures"
#> [7] "consensus_heatmap" "dimension_reduction" "functional_enrichment"
#> [10] "get_anno_col" "get_anno" "get_classes"
#> [13] "get_consensus" "get_matrix" "get_membership"
#> [16] "get_param" "get_signatures" "get_stats"
#> [19] "is_best_k" "is_stable_k" "membership_heatmap"
#> [22] "ncol" "nrow" "plot_ecdf"
#> [25] "rownames" "select_partition_number" "show"
#> [28] "suggest_best_k" "test_to_known_factors"
collect_plots()
function collects all the plots made from res
for all k
(number of partitions)
into one single page to provide an easy and fast comparison between different k
.
collect_plots(res)
The plots are:
k
and the heatmap of
predicted classes for each k
.k
.k
.k
.All the plots in panels can be made by individual functions and they are plotted later in this section.
select_partition_number()
produces several plots showing different
statistics for choosing “optimized” k
. There are following statistics:
k
;k
, the area increased is defined as \(A_k - A_{k-1}\).The detailed explanations of these statistics can be found in the cola vignette.
Generally speaking, lower PAC score, higher mean silhouette score or higher
concordance corresponds to better partition. Rand index and Jaccard index
measure how similar the current partition is compared to partition with k-1
.
If they are too similar, we won't accept k
is better than k-1
.
select_partition_number(res)
The numeric values for all these statistics can be obtained by get_stats()
.
get_stats(res)
#> k 1-PAC mean_silhouette concordance area_increased Rand Jaccard
#> 2 2 0.967 0.937 0.976 0.4624 0.532 0.532
#> 3 3 0.968 0.922 0.974 0.0884 0.961 0.927
#> 4 4 0.669 0.676 0.832 0.2832 0.866 0.729
#> 5 5 0.810 0.768 0.854 0.1155 0.913 0.760
#> 6 6 0.747 0.775 0.835 0.0676 0.938 0.778
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
#> GSM862441 1 0.000 0.9523 1.000 0.000
#> GSM862442 1 0.000 0.9523 1.000 0.000
#> GSM862443 1 0.000 0.9523 1.000 0.000
#> GSM862444 2 0.904 0.4992 0.320 0.680
#> GSM862445 1 1.000 0.0665 0.512 0.488
#> GSM862446 1 0.000 0.9523 1.000 0.000
#> GSM862447 1 0.000 0.9523 1.000 0.000
#> GSM862448 1 0.000 0.9523 1.000 0.000
#> GSM862449 2 0.000 0.9855 0.000 1.000
#> GSM862450 2 0.760 0.6983 0.220 0.780
#> GSM862451 1 0.000 0.9523 1.000 0.000
#> GSM862453 1 0.000 0.9523 1.000 0.000
#> GSM862454 1 0.000 0.9523 1.000 0.000
#> GSM862455 1 0.000 0.9523 1.000 0.000
#> GSM862456 1 0.000 0.9523 1.000 0.000
#> GSM862457 1 0.000 0.9523 1.000 0.000
#> GSM862458 2 0.000 0.9855 0.000 1.000
#> GSM862459 1 0.000 0.9523 1.000 0.000
#> GSM862460 1 0.000 0.9523 1.000 0.000
#> GSM862461 1 0.000 0.9523 1.000 0.000
#> GSM862462 1 0.529 0.8383 0.880 0.120
#> GSM862463 1 0.000 0.9523 1.000 0.000
#> GSM862464 1 0.000 0.9523 1.000 0.000
#> GSM862465 1 0.163 0.9337 0.976 0.024
#> GSM862466 1 0.000 0.9523 1.000 0.000
#> GSM862467 1 0.000 0.9523 1.000 0.000
#> GSM862468 1 0.958 0.3983 0.620 0.380
#> GSM862469 2 0.000 0.9855 0.000 1.000
#> GSM862470 2 0.000 0.9855 0.000 1.000
#> GSM862471 2 0.000 0.9855 0.000 1.000
#> GSM862472 2 0.000 0.9855 0.000 1.000
#> GSM862473 2 0.000 0.9855 0.000 1.000
#> GSM862474 2 0.000 0.9855 0.000 1.000
#> GSM862475 2 0.000 0.9855 0.000 1.000
#> GSM862476 2 0.000 0.9855 0.000 1.000
#> GSM862477 2 0.000 0.9855 0.000 1.000
#> GSM862478 2 0.000 0.9855 0.000 1.000
#> GSM862479 2 0.000 0.9855 0.000 1.000
#> GSM862480 2 0.000 0.9855 0.000 1.000
#> GSM862481 2 0.000 0.9855 0.000 1.000
#> GSM862482 2 0.000 0.9855 0.000 1.000
#> GSM862483 2 0.000 0.9855 0.000 1.000
#> GSM862484 2 0.000 0.9855 0.000 1.000
#> GSM862485 2 0.000 0.9855 0.000 1.000
#> GSM862486 2 0.000 0.9855 0.000 1.000
#> GSM862487 2 0.000 0.9855 0.000 1.000
#> GSM862488 2 0.000 0.9855 0.000 1.000
#> GSM862489 2 0.000 0.9855 0.000 1.000
#> GSM862490 2 0.000 0.9855 0.000 1.000
#> GSM862491 2 0.000 0.9855 0.000 1.000
#> GSM862492 2 0.000 0.9855 0.000 1.000
#> GSM862493 2 0.000 0.9855 0.000 1.000
#> GSM862494 2 0.000 0.9855 0.000 1.000
#> GSM862495 2 0.000 0.9855 0.000 1.000
#> GSM862496 2 0.000 0.9855 0.000 1.000
#> GSM862497 2 0.000 0.9855 0.000 1.000
#> GSM862498 2 0.000 0.9855 0.000 1.000
#> GSM862499 2 0.000 0.9855 0.000 1.000
#> GSM862500 2 0.000 0.9855 0.000 1.000
#> GSM862501 2 0.000 0.9855 0.000 1.000
#> GSM862502 2 0.000 0.9855 0.000 1.000
#> GSM862503 2 0.000 0.9855 0.000 1.000
#> GSM862504 2 0.000 0.9855 0.000 1.000
#> GSM862505 2 0.000 0.9855 0.000 1.000
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> GSM862441 1 0.000 0.926 1.000 0.000 0.000
#> GSM862442 1 0.000 0.926 1.000 0.000 0.000
#> GSM862443 1 0.000 0.926 1.000 0.000 0.000
#> GSM862444 2 0.571 0.502 0.320 0.680 0.000
#> GSM862445 1 0.631 0.060 0.512 0.488 0.000
#> GSM862446 1 0.000 0.926 1.000 0.000 0.000
#> GSM862447 1 0.000 0.926 1.000 0.000 0.000
#> GSM862448 1 0.000 0.926 1.000 0.000 0.000
#> GSM862449 3 0.000 1.000 0.000 0.000 1.000
#> GSM862450 2 0.612 0.637 0.220 0.744 0.036
#> GSM862451 1 0.000 0.926 1.000 0.000 0.000
#> GSM862453 1 0.000 0.926 1.000 0.000 0.000
#> GSM862454 1 0.000 0.926 1.000 0.000 0.000
#> GSM862455 1 0.000 0.926 1.000 0.000 0.000
#> GSM862456 1 0.000 0.926 1.000 0.000 0.000
#> GSM862457 1 0.000 0.926 1.000 0.000 0.000
#> GSM862458 2 0.000 0.980 0.000 1.000 0.000
#> GSM862459 1 0.000 0.926 1.000 0.000 0.000
#> GSM862460 1 0.000 0.926 1.000 0.000 0.000
#> GSM862461 1 0.000 0.926 1.000 0.000 0.000
#> GSM862462 1 0.334 0.761 0.880 0.120 0.000
#> GSM862463 1 0.000 0.926 1.000 0.000 0.000
#> GSM862464 1 0.000 0.926 1.000 0.000 0.000
#> GSM862465 1 0.103 0.898 0.976 0.024 0.000
#> GSM862466 1 0.000 0.926 1.000 0.000 0.000
#> GSM862467 1 0.000 0.926 1.000 0.000 0.000
#> GSM862468 1 0.604 0.338 0.620 0.380 0.000
#> GSM862469 2 0.141 0.948 0.000 0.964 0.036
#> GSM862470 2 0.000 0.980 0.000 1.000 0.000
#> GSM862471 2 0.000 0.980 0.000 1.000 0.000
#> GSM862472 2 0.000 0.980 0.000 1.000 0.000
#> GSM862473 2 0.000 0.980 0.000 1.000 0.000
#> GSM862474 2 0.000 0.980 0.000 1.000 0.000
#> GSM862475 2 0.000 0.980 0.000 1.000 0.000
#> GSM862476 2 0.000 0.980 0.000 1.000 0.000
#> GSM862477 2 0.000 0.980 0.000 1.000 0.000
#> GSM862478 2 0.000 0.980 0.000 1.000 0.000
#> GSM862479 2 0.141 0.948 0.000 0.964 0.036
#> GSM862480 2 0.000 0.980 0.000 1.000 0.000
#> GSM862481 2 0.000 0.980 0.000 1.000 0.000
#> GSM862482 2 0.000 0.980 0.000 1.000 0.000
#> GSM862483 3 0.000 1.000 0.000 0.000 1.000
#> GSM862484 2 0.000 0.980 0.000 1.000 0.000
#> GSM862485 2 0.000 0.980 0.000 1.000 0.000
#> GSM862486 2 0.000 0.980 0.000 1.000 0.000
#> GSM862487 2 0.000 0.980 0.000 1.000 0.000
#> GSM862488 2 0.000 0.980 0.000 1.000 0.000
#> GSM862489 2 0.000 0.980 0.000 1.000 0.000
#> GSM862490 2 0.000 0.980 0.000 1.000 0.000
#> GSM862491 2 0.000 0.980 0.000 1.000 0.000
#> GSM862492 2 0.000 0.980 0.000 1.000 0.000
#> GSM862493 2 0.000 0.980 0.000 1.000 0.000
#> GSM862494 2 0.000 0.980 0.000 1.000 0.000
#> GSM862495 2 0.000 0.980 0.000 1.000 0.000
#> GSM862496 2 0.000 0.980 0.000 1.000 0.000
#> GSM862497 2 0.000 0.980 0.000 1.000 0.000
#> GSM862498 2 0.000 0.980 0.000 1.000 0.000
#> GSM862499 2 0.000 0.980 0.000 1.000 0.000
#> GSM862500 2 0.000 0.980 0.000 1.000 0.000
#> GSM862501 2 0.000 0.980 0.000 1.000 0.000
#> GSM862502 2 0.000 0.980 0.000 1.000 0.000
#> GSM862503 2 0.000 0.980 0.000 1.000 0.000
#> GSM862504 2 0.000 0.980 0.000 1.000 0.000
#> GSM862505 2 0.000 0.980 0.000 1.000 0.000
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> GSM862441 1 0.0000 0.94125 1.000 0.000 0.000 0.000
#> GSM862442 1 0.0000 0.94125 1.000 0.000 0.000 0.000
#> GSM862443 1 0.0000 0.94125 1.000 0.000 0.000 0.000
#> GSM862444 2 0.7922 -0.41184 0.320 0.340 0.340 0.000
#> GSM862445 1 0.5165 -0.00461 0.512 0.484 0.004 0.000
#> GSM862446 1 0.0000 0.94125 1.000 0.000 0.000 0.000
#> GSM862447 1 0.0000 0.94125 1.000 0.000 0.000 0.000
#> GSM862448 1 0.0000 0.94125 1.000 0.000 0.000 0.000
#> GSM862449 4 0.4500 1.00000 0.000 0.000 0.316 0.684
#> GSM862450 2 0.7368 0.03570 0.220 0.592 0.168 0.020
#> GSM862451 1 0.0000 0.94125 1.000 0.000 0.000 0.000
#> GSM862453 1 0.0000 0.94125 1.000 0.000 0.000 0.000
#> GSM862454 1 0.0000 0.94125 1.000 0.000 0.000 0.000
#> GSM862455 1 0.0000 0.94125 1.000 0.000 0.000 0.000
#> GSM862456 1 0.0000 0.94125 1.000 0.000 0.000 0.000
#> GSM862457 1 0.0000 0.94125 1.000 0.000 0.000 0.000
#> GSM862458 2 0.4761 -0.26537 0.000 0.628 0.372 0.000
#> GSM862459 1 0.0000 0.94125 1.000 0.000 0.000 0.000
#> GSM862460 1 0.0000 0.94125 1.000 0.000 0.000 0.000
#> GSM862461 1 0.0000 0.94125 1.000 0.000 0.000 0.000
#> GSM862462 1 0.3176 0.80809 0.880 0.084 0.000 0.036
#> GSM862463 1 0.0000 0.94125 1.000 0.000 0.000 0.000
#> GSM862464 1 0.0000 0.94125 1.000 0.000 0.000 0.000
#> GSM862465 1 0.0817 0.92264 0.976 0.000 0.024 0.000
#> GSM862466 1 0.0000 0.94125 1.000 0.000 0.000 0.000
#> GSM862467 1 0.0000 0.94125 1.000 0.000 0.000 0.000
#> GSM862468 1 0.6274 0.43131 0.620 0.088 0.000 0.292
#> GSM862469 2 0.5453 -0.24576 0.000 0.592 0.388 0.020
#> GSM862470 2 0.0188 0.63895 0.000 0.996 0.004 0.000
#> GSM862471 2 0.4761 -0.26537 0.000 0.628 0.372 0.000
#> GSM862472 3 0.4955 1.00000 0.000 0.444 0.556 0.000
#> GSM862473 2 0.3587 0.60961 0.000 0.856 0.040 0.104
#> GSM862474 2 0.0188 0.63916 0.000 0.996 0.004 0.000
#> GSM862475 2 0.0895 0.64226 0.000 0.976 0.004 0.020
#> GSM862476 2 0.0188 0.63916 0.000 0.996 0.004 0.000
#> GSM862477 2 0.0000 0.64127 0.000 1.000 0.000 0.000
#> GSM862478 3 0.4955 1.00000 0.000 0.444 0.556 0.000
#> GSM862479 2 0.5453 -0.24576 0.000 0.592 0.388 0.020
#> GSM862480 2 0.4677 0.53839 0.000 0.680 0.004 0.316
#> GSM862481 2 0.3587 0.60961 0.000 0.856 0.040 0.104
#> GSM862482 2 0.0000 0.64127 0.000 1.000 0.000 0.000
#> GSM862483 4 0.4500 1.00000 0.000 0.000 0.316 0.684
#> GSM862484 2 0.0000 0.64127 0.000 1.000 0.000 0.000
#> GSM862485 2 0.4761 -0.26537 0.000 0.628 0.372 0.000
#> GSM862486 2 0.0707 0.63174 0.000 0.980 0.020 0.000
#> GSM862487 3 0.4955 1.00000 0.000 0.444 0.556 0.000
#> GSM862488 3 0.4955 1.00000 0.000 0.444 0.556 0.000
#> GSM862489 2 0.1118 0.64037 0.000 0.964 0.000 0.036
#> GSM862490 2 0.0188 0.63895 0.000 0.996 0.004 0.000
#> GSM862491 3 0.4955 1.00000 0.000 0.444 0.556 0.000
#> GSM862492 3 0.4955 1.00000 0.000 0.444 0.556 0.000
#> GSM862493 2 0.0000 0.64127 0.000 1.000 0.000 0.000
#> GSM862494 3 0.4955 1.00000 0.000 0.444 0.556 0.000
#> GSM862495 2 0.4677 0.53839 0.000 0.680 0.004 0.316
#> GSM862496 2 0.4677 0.53839 0.000 0.680 0.004 0.316
#> GSM862497 2 0.4677 0.53839 0.000 0.680 0.004 0.316
#> GSM862498 2 0.0188 0.63895 0.000 0.996 0.004 0.000
#> GSM862499 3 0.4955 1.00000 0.000 0.444 0.556 0.000
#> GSM862500 3 0.4955 1.00000 0.000 0.444 0.556 0.000
#> GSM862501 2 0.4500 0.53860 0.000 0.684 0.000 0.316
#> GSM862502 2 0.5250 0.52028 0.000 0.660 0.024 0.316
#> GSM862503 2 0.2281 0.62684 0.000 0.904 0.000 0.096
#> GSM862504 2 0.0188 0.63916 0.000 0.996 0.004 0.000
#> GSM862505 2 0.5343 0.51964 0.000 0.656 0.028 0.316
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> GSM862441 4 0.0000 0.945 0 0.000 0.000 1.000 0.000
#> GSM862442 4 0.0000 0.945 0 0.000 0.000 1.000 0.000
#> GSM862443 4 0.0000 0.945 0 0.000 0.000 1.000 0.000
#> GSM862444 3 0.4165 0.381 0 0.000 0.672 0.320 0.008
#> GSM862445 4 0.5942 -0.159 0 0.084 0.008 0.512 0.396
#> GSM862446 4 0.0000 0.945 0 0.000 0.000 1.000 0.000
#> GSM862447 4 0.0000 0.945 0 0.000 0.000 1.000 0.000
#> GSM862448 4 0.0000 0.945 0 0.000 0.000 1.000 0.000
#> GSM862449 1 0.0000 1.000 1 0.000 0.000 0.000 0.000
#> GSM862450 5 0.4299 0.533 0 0.028 0.008 0.220 0.744
#> GSM862451 4 0.0000 0.945 0 0.000 0.000 1.000 0.000
#> GSM862453 4 0.0000 0.945 0 0.000 0.000 1.000 0.000
#> GSM862454 4 0.0000 0.945 0 0.000 0.000 1.000 0.000
#> GSM862455 4 0.0000 0.945 0 0.000 0.000 1.000 0.000
#> GSM862456 4 0.0000 0.945 0 0.000 0.000 1.000 0.000
#> GSM862457 4 0.0000 0.945 0 0.000 0.000 1.000 0.000
#> GSM862458 5 0.4138 0.729 0 0.072 0.148 0.000 0.780
#> GSM862459 4 0.0000 0.945 0 0.000 0.000 1.000 0.000
#> GSM862460 4 0.0000 0.945 0 0.000 0.000 1.000 0.000
#> GSM862461 4 0.0000 0.945 0 0.000 0.000 1.000 0.000
#> GSM862462 4 0.2790 0.823 0 0.068 0.000 0.880 0.052
#> GSM862463 4 0.0000 0.945 0 0.000 0.000 1.000 0.000
#> GSM862464 4 0.0000 0.945 0 0.000 0.000 1.000 0.000
#> GSM862465 4 0.0703 0.926 0 0.000 0.000 0.976 0.024
#> GSM862466 4 0.0000 0.945 0 0.000 0.000 1.000 0.000
#> GSM862467 4 0.0000 0.945 0 0.000 0.000 1.000 0.000
#> GSM862468 4 0.4126 0.437 0 0.380 0.000 0.620 0.000
#> GSM862469 5 0.4083 0.763 0 0.028 0.228 0.000 0.744
#> GSM862470 2 0.4390 0.651 0 0.568 0.004 0.000 0.428
#> GSM862471 5 0.5533 0.698 0 0.084 0.336 0.000 0.580
#> GSM862472 3 0.0290 0.931 0 0.000 0.992 0.000 0.008
#> GSM862473 2 0.5331 0.560 0 0.640 0.092 0.000 0.268
#> GSM862474 2 0.4696 0.659 0 0.556 0.016 0.000 0.428
#> GSM862475 2 0.4310 0.666 0 0.604 0.004 0.000 0.392
#> GSM862476 2 0.4696 0.659 0 0.556 0.016 0.000 0.428
#> GSM862477 2 0.4383 0.668 0 0.572 0.004 0.000 0.424
#> GSM862478 3 0.0000 0.936 0 0.000 1.000 0.000 0.000
#> GSM862479 5 0.4083 0.763 0 0.028 0.228 0.000 0.744
#> GSM862480 2 0.0324 0.552 0 0.992 0.004 0.000 0.004
#> GSM862481 2 0.5331 0.560 0 0.640 0.092 0.000 0.268
#> GSM862482 2 0.4604 0.662 0 0.560 0.012 0.000 0.428
#> GSM862483 1 0.0000 1.000 1 0.000 0.000 0.000 0.000
#> GSM862484 2 0.4604 0.662 0 0.560 0.012 0.000 0.428
#> GSM862485 5 0.4138 0.729 0 0.072 0.148 0.000 0.780
#> GSM862486 2 0.4522 0.631 0 0.552 0.008 0.000 0.440
#> GSM862487 3 0.0000 0.936 0 0.000 1.000 0.000 0.000
#> GSM862488 3 0.0000 0.936 0 0.000 1.000 0.000 0.000
#> GSM862489 2 0.4238 0.670 0 0.628 0.004 0.000 0.368
#> GSM862490 2 0.4390 0.651 0 0.568 0.004 0.000 0.428
#> GSM862491 3 0.0290 0.931 0 0.000 0.992 0.000 0.008
#> GSM862492 3 0.0000 0.936 0 0.000 1.000 0.000 0.000
#> GSM862493 2 0.4383 0.668 0 0.572 0.004 0.000 0.424
#> GSM862494 3 0.0000 0.936 0 0.000 1.000 0.000 0.000
#> GSM862495 2 0.0324 0.552 0 0.992 0.004 0.000 0.004
#> GSM862496 2 0.0324 0.552 0 0.992 0.004 0.000 0.004
#> GSM862497 2 0.0324 0.552 0 0.992 0.004 0.000 0.004
#> GSM862498 2 0.4390 0.654 0 0.568 0.004 0.000 0.428
#> GSM862499 3 0.0000 0.936 0 0.000 1.000 0.000 0.000
#> GSM862500 3 0.0000 0.936 0 0.000 1.000 0.000 0.000
#> GSM862501 2 0.0000 0.551 0 1.000 0.000 0.000 0.000
#> GSM862502 2 0.0880 0.525 0 0.968 0.000 0.000 0.032
#> GSM862503 2 0.3949 0.658 0 0.696 0.004 0.000 0.300
#> GSM862504 2 0.4696 0.659 0 0.556 0.016 0.000 0.428
#> GSM862505 2 0.1041 0.522 0 0.964 0.004 0.000 0.032
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> GSM862441 1 0.0000 0.8959 1.000 0.000 0.000 0.000 0.000 0
#> GSM862442 1 0.1556 0.8850 0.920 0.000 0.000 0.080 0.000 0
#> GSM862443 1 0.0000 0.8959 1.000 0.000 0.000 0.000 0.000 0
#> GSM862444 3 0.4962 0.3326 0.320 0.000 0.600 0.004 0.076 0
#> GSM862445 1 0.3867 0.0837 0.512 0.488 0.000 0.000 0.000 0
#> GSM862446 1 0.0000 0.8959 1.000 0.000 0.000 0.000 0.000 0
#> GSM862447 1 0.0146 0.8957 0.996 0.000 0.000 0.004 0.000 0
#> GSM862448 1 0.0146 0.8957 0.996 0.000 0.000 0.004 0.000 0
#> GSM862449 6 0.0000 1.0000 0.000 0.000 0.000 0.000 0.000 1
#> GSM862450 4 0.5857 0.4802 0.220 0.192 0.000 0.568 0.020 0
#> GSM862451 1 0.0000 0.8959 1.000 0.000 0.000 0.000 0.000 0
#> GSM862453 1 0.1556 0.8850 0.920 0.000 0.000 0.080 0.000 0
#> GSM862454 1 0.2762 0.8356 0.804 0.000 0.000 0.196 0.000 0
#> GSM862455 1 0.2762 0.8356 0.804 0.000 0.000 0.196 0.000 0
#> GSM862456 1 0.2762 0.8356 0.804 0.000 0.000 0.196 0.000 0
#> GSM862457 1 0.0000 0.8959 1.000 0.000 0.000 0.000 0.000 0
#> GSM862458 4 0.5532 0.7059 0.000 0.264 0.128 0.592 0.016 0
#> GSM862459 1 0.0000 0.8959 1.000 0.000 0.000 0.000 0.000 0
#> GSM862460 1 0.1556 0.8850 0.920 0.000 0.000 0.080 0.000 0
#> GSM862461 1 0.0000 0.8959 1.000 0.000 0.000 0.000 0.000 0
#> GSM862462 1 0.2506 0.8377 0.880 0.052 0.000 0.000 0.068 0
#> GSM862463 1 0.2762 0.8356 0.804 0.000 0.000 0.196 0.000 0
#> GSM862464 1 0.0000 0.8959 1.000 0.000 0.000 0.000 0.000 0
#> GSM862465 1 0.2823 0.8299 0.796 0.000 0.000 0.204 0.000 0
#> GSM862466 1 0.0146 0.8957 0.996 0.000 0.000 0.004 0.000 0
#> GSM862467 1 0.1556 0.8850 0.920 0.000 0.000 0.080 0.000 0
#> GSM862468 1 0.3706 0.4990 0.620 0.000 0.000 0.000 0.380 0
#> GSM862469 4 0.5857 0.7212 0.000 0.192 0.220 0.568 0.020 0
#> GSM862470 2 0.4029 0.6983 0.000 0.680 0.000 0.028 0.292 0
#> GSM862471 4 0.6445 0.6882 0.000 0.276 0.328 0.380 0.016 0
#> GSM862472 3 0.1901 0.8509 0.000 0.008 0.912 0.004 0.076 0
#> GSM862473 5 0.5140 0.1339 0.000 0.392 0.088 0.000 0.520 0
#> GSM862474 2 0.0713 0.7335 0.000 0.972 0.000 0.000 0.028 0
#> GSM862475 2 0.4078 0.6628 0.000 0.656 0.000 0.024 0.320 0
#> GSM862476 2 0.0713 0.7335 0.000 0.972 0.000 0.000 0.028 0
#> GSM862477 2 0.1444 0.7798 0.000 0.928 0.000 0.000 0.072 0
#> GSM862478 3 0.0146 0.9061 0.000 0.004 0.996 0.000 0.000 0
#> GSM862479 4 0.5857 0.7212 0.000 0.192 0.220 0.568 0.020 0
#> GSM862480 5 0.1858 0.8340 0.000 0.092 0.004 0.000 0.904 0
#> GSM862481 5 0.5140 0.1339 0.000 0.392 0.088 0.000 0.520 0
#> GSM862482 2 0.1663 0.7883 0.000 0.912 0.000 0.000 0.088 0
#> GSM862483 6 0.0000 1.0000 0.000 0.000 0.000 0.000 0.000 1
#> GSM862484 2 0.1663 0.7883 0.000 0.912 0.000 0.000 0.088 0
#> GSM862485 4 0.5532 0.7059 0.000 0.264 0.128 0.592 0.016 0
#> GSM862486 2 0.4214 0.7023 0.000 0.680 0.000 0.044 0.276 0
#> GSM862487 3 0.0146 0.9061 0.000 0.004 0.996 0.000 0.000 0
#> GSM862488 3 0.0146 0.9061 0.000 0.004 0.996 0.000 0.000 0
#> GSM862489 2 0.3081 0.7327 0.000 0.776 0.000 0.004 0.220 0
#> GSM862490 2 0.4047 0.6937 0.000 0.676 0.000 0.028 0.296 0
#> GSM862491 3 0.1845 0.8533 0.000 0.008 0.916 0.004 0.072 0
#> GSM862492 3 0.0146 0.9061 0.000 0.004 0.996 0.000 0.000 0
#> GSM862493 2 0.1444 0.7798 0.000 0.928 0.000 0.000 0.072 0
#> GSM862494 3 0.0146 0.9061 0.000 0.004 0.996 0.000 0.000 0
#> GSM862495 5 0.1700 0.8313 0.000 0.080 0.004 0.000 0.916 0
#> GSM862496 5 0.1858 0.8340 0.000 0.092 0.004 0.000 0.904 0
#> GSM862497 5 0.1858 0.8340 0.000 0.092 0.004 0.000 0.904 0
#> GSM862498 2 0.3897 0.7112 0.000 0.696 0.000 0.024 0.280 0
#> GSM862499 3 0.0146 0.9061 0.000 0.004 0.996 0.000 0.000 0
#> GSM862500 3 0.0146 0.9061 0.000 0.004 0.996 0.000 0.000 0
#> GSM862501 5 0.1910 0.8167 0.000 0.108 0.000 0.000 0.892 0
#> GSM862502 5 0.2680 0.8078 0.000 0.108 0.000 0.032 0.860 0
#> GSM862503 2 0.3428 0.6050 0.000 0.696 0.000 0.000 0.304 0
#> GSM862504 2 0.0713 0.7335 0.000 0.972 0.000 0.000 0.028 0
#> GSM862505 5 0.2420 0.8213 0.000 0.076 0.004 0.032 0.888 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 tissue(p) k
#> MAD:hclust 61 1.47e-11 2
#> MAD:hclust 62 3.07e-11 3
#> MAD:hclust 55 1.91e-11 4
#> MAD:hclust 61 7.31e-11 5
#> MAD:hclust 58 4.13e-10 6
If matrix rows can be associated to genes, consider to use functional_enrichment(res,
...)
to perform function enrichment for the signature genes. See this vignette for more detailed explanations.
The object with results only for a single top-value method and a single partition method can be extracted as:
res = res_list["MAD", "kmeans"]
# you can also extract it by
# res = res_list["MAD:kmeans"]
A summary of res
and all the functions that can be applied to it:
res
#> A 'ConsensusPartition' object with k = 2, 3, 4, 5, 6.
#> On a matrix with 51941 rows and 64 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.999 0.995 0.4859 0.510 0.510
#> 3 3 0.721 0.921 0.871 0.2911 0.833 0.673
#> 4 4 0.631 0.825 0.818 0.1318 1.000 1.000
#> 5 5 0.680 0.490 0.751 0.0703 0.945 0.840
#> 6 6 0.679 0.603 0.718 0.0538 0.918 0.723
suggest_best_k()
suggests the best \(k\) based on these statistics. The rules are as follows:
suggest_best_k(res)
#> [1] 2
Following shows the table of the partitions (You need to click the show/hide
code output link to see it). The membership matrix (columns with name p*
)
is inferred by
clue::cl_consensus()
function with the SE
method. Basically the value in the membership matrix
represents the probability to belong to a certain group. The finall class
label for an item is determined with the group with highest probability it
belongs to.
In get_classes()
function, the entropy is calculated from the membership
matrix and the silhouette score is calculated from the consensus matrix.
cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#> class entropy silhouette p1 p2
#> GSM862441 1 0.0938 1.000 0.988 0.012
#> GSM862442 1 0.0938 1.000 0.988 0.012
#> GSM862443 1 0.0938 1.000 0.988 0.012
#> GSM862444 1 0.0938 1.000 0.988 0.012
#> GSM862445 1 0.0938 1.000 0.988 0.012
#> GSM862446 1 0.0938 1.000 0.988 0.012
#> GSM862447 1 0.0938 1.000 0.988 0.012
#> GSM862448 1 0.0938 1.000 0.988 0.012
#> GSM862449 1 0.0000 0.988 1.000 0.000
#> GSM862450 1 0.0938 1.000 0.988 0.012
#> GSM862451 1 0.0938 1.000 0.988 0.012
#> GSM862453 1 0.0938 1.000 0.988 0.012
#> GSM862454 1 0.0938 1.000 0.988 0.012
#> GSM862455 1 0.0938 1.000 0.988 0.012
#> GSM862456 1 0.0938 1.000 0.988 0.012
#> GSM862457 1 0.0938 1.000 0.988 0.012
#> GSM862458 2 0.0000 1.000 0.000 1.000
#> GSM862459 1 0.0938 1.000 0.988 0.012
#> GSM862460 1 0.0938 1.000 0.988 0.012
#> GSM862461 1 0.0938 1.000 0.988 0.012
#> GSM862462 1 0.0938 1.000 0.988 0.012
#> GSM862463 1 0.0938 1.000 0.988 0.012
#> GSM862464 1 0.0938 1.000 0.988 0.012
#> GSM862465 1 0.0938 1.000 0.988 0.012
#> GSM862466 1 0.0938 1.000 0.988 0.012
#> GSM862467 1 0.0938 1.000 0.988 0.012
#> GSM862468 1 0.0938 1.000 0.988 0.012
#> GSM862469 2 0.0000 1.000 0.000 1.000
#> GSM862470 2 0.0000 1.000 0.000 1.000
#> GSM862471 2 0.0000 1.000 0.000 1.000
#> GSM862472 2 0.0000 1.000 0.000 1.000
#> GSM862473 2 0.0000 1.000 0.000 1.000
#> GSM862474 2 0.0000 1.000 0.000 1.000
#> GSM862475 2 0.0000 1.000 0.000 1.000
#> GSM862476 2 0.0000 1.000 0.000 1.000
#> GSM862477 2 0.0000 1.000 0.000 1.000
#> GSM862478 2 0.0000 1.000 0.000 1.000
#> GSM862479 2 0.0000 1.000 0.000 1.000
#> GSM862480 2 0.0000 1.000 0.000 1.000
#> GSM862481 2 0.0000 1.000 0.000 1.000
#> GSM862482 2 0.0000 1.000 0.000 1.000
#> GSM862483 2 0.0938 0.988 0.012 0.988
#> GSM862484 2 0.0000 1.000 0.000 1.000
#> GSM862485 2 0.0000 1.000 0.000 1.000
#> GSM862486 2 0.0000 1.000 0.000 1.000
#> GSM862487 2 0.0000 1.000 0.000 1.000
#> GSM862488 2 0.0000 1.000 0.000 1.000
#> GSM862489 2 0.0000 1.000 0.000 1.000
#> GSM862490 2 0.0000 1.000 0.000 1.000
#> GSM862491 2 0.0000 1.000 0.000 1.000
#> GSM862492 2 0.0000 1.000 0.000 1.000
#> GSM862493 2 0.0000 1.000 0.000 1.000
#> GSM862494 2 0.0000 1.000 0.000 1.000
#> GSM862495 2 0.0000 1.000 0.000 1.000
#> GSM862496 2 0.0000 1.000 0.000 1.000
#> GSM862497 2 0.0000 1.000 0.000 1.000
#> GSM862498 2 0.0000 1.000 0.000 1.000
#> GSM862499 2 0.0000 1.000 0.000 1.000
#> GSM862500 2 0.0000 1.000 0.000 1.000
#> GSM862501 2 0.0000 1.000 0.000 1.000
#> GSM862502 2 0.0000 1.000 0.000 1.000
#> GSM862503 2 0.0000 1.000 0.000 1.000
#> GSM862504 2 0.0000 1.000 0.000 1.000
#> GSM862505 2 0.0000 1.000 0.000 1.000
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> GSM862441 1 0.2165 0.942 0.936 0.000 0.064
#> GSM862442 1 0.1860 0.938 0.948 0.000 0.052
#> GSM862443 1 0.0892 0.945 0.980 0.000 0.020
#> GSM862444 1 0.2537 0.941 0.920 0.000 0.080
#> GSM862445 1 0.4165 0.908 0.876 0.048 0.076
#> GSM862446 1 0.1964 0.940 0.944 0.000 0.056
#> GSM862447 1 0.1964 0.940 0.944 0.000 0.056
#> GSM862448 1 0.0892 0.944 0.980 0.000 0.020
#> GSM862449 1 0.3482 0.912 0.872 0.000 0.128
#> GSM862450 1 0.2448 0.937 0.924 0.000 0.076
#> GSM862451 1 0.1643 0.943 0.956 0.000 0.044
#> GSM862453 1 0.2711 0.929 0.912 0.000 0.088
#> GSM862454 1 0.3816 0.904 0.852 0.000 0.148
#> GSM862455 1 0.3879 0.903 0.848 0.000 0.152
#> GSM862456 1 0.3816 0.904 0.852 0.000 0.148
#> GSM862457 1 0.2356 0.937 0.928 0.000 0.072
#> GSM862458 3 0.6217 0.832 0.024 0.264 0.712
#> GSM862459 1 0.1411 0.944 0.964 0.000 0.036
#> GSM862460 1 0.1964 0.938 0.944 0.000 0.056
#> GSM862461 1 0.2537 0.936 0.920 0.000 0.080
#> GSM862462 1 0.2356 0.937 0.928 0.000 0.072
#> GSM862463 1 0.3816 0.904 0.852 0.000 0.148
#> GSM862464 1 0.2066 0.941 0.940 0.000 0.060
#> GSM862465 1 0.3879 0.912 0.848 0.000 0.152
#> GSM862466 1 0.0892 0.944 0.980 0.000 0.020
#> GSM862467 1 0.1860 0.938 0.948 0.000 0.052
#> GSM862468 1 0.2261 0.938 0.932 0.000 0.068
#> GSM862469 3 0.5948 0.982 0.000 0.360 0.640
#> GSM862470 2 0.0237 0.918 0.000 0.996 0.004
#> GSM862471 3 0.5948 0.982 0.000 0.360 0.640
#> GSM862472 3 0.5905 0.975 0.000 0.352 0.648
#> GSM862473 2 0.4002 0.693 0.000 0.840 0.160
#> GSM862474 2 0.0237 0.918 0.000 0.996 0.004
#> GSM862475 2 0.2165 0.901 0.000 0.936 0.064
#> GSM862476 2 0.0237 0.918 0.000 0.996 0.004
#> GSM862477 2 0.0237 0.918 0.000 0.996 0.004
#> GSM862478 3 0.5968 0.981 0.000 0.364 0.636
#> GSM862479 3 0.5948 0.982 0.000 0.360 0.640
#> GSM862480 2 0.3686 0.859 0.000 0.860 0.140
#> GSM862481 2 0.4002 0.693 0.000 0.840 0.160
#> GSM862482 2 0.0237 0.918 0.000 0.996 0.004
#> GSM862483 2 0.3192 0.803 0.000 0.888 0.112
#> GSM862484 2 0.0237 0.918 0.000 0.996 0.004
#> GSM862485 3 0.5948 0.982 0.000 0.360 0.640
#> GSM862486 2 0.0424 0.917 0.000 0.992 0.008
#> GSM862487 3 0.5968 0.981 0.000 0.364 0.636
#> GSM862488 3 0.5968 0.981 0.000 0.364 0.636
#> GSM862489 2 0.0237 0.917 0.000 0.996 0.004
#> GSM862490 2 0.2165 0.901 0.000 0.936 0.064
#> GSM862491 3 0.5905 0.975 0.000 0.352 0.648
#> GSM862492 3 0.5968 0.981 0.000 0.364 0.636
#> GSM862493 2 0.0237 0.918 0.000 0.996 0.004
#> GSM862494 3 0.5968 0.981 0.000 0.364 0.636
#> GSM862495 2 0.2959 0.891 0.000 0.900 0.100
#> GSM862496 2 0.3686 0.859 0.000 0.860 0.140
#> GSM862497 2 0.3686 0.859 0.000 0.860 0.140
#> GSM862498 2 0.0424 0.917 0.000 0.992 0.008
#> GSM862499 3 0.5948 0.982 0.000 0.360 0.640
#> GSM862500 3 0.5948 0.982 0.000 0.360 0.640
#> GSM862501 2 0.2261 0.899 0.000 0.932 0.068
#> GSM862502 2 0.2356 0.897 0.000 0.928 0.072
#> GSM862503 2 0.2165 0.901 0.000 0.936 0.064
#> GSM862504 2 0.0237 0.918 0.000 0.996 0.004
#> GSM862505 2 0.2356 0.897 0.000 0.928 0.072
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> GSM862441 1 0.3448 0.840 0.828 0.000 0.004 NA
#> GSM862442 1 0.2999 0.830 0.864 0.000 0.004 NA
#> GSM862443 1 0.2814 0.848 0.868 0.000 0.000 NA
#> GSM862444 1 0.4175 0.837 0.776 0.000 0.012 NA
#> GSM862445 1 0.6949 0.653 0.600 0.064 0.036 NA
#> GSM862446 1 0.1902 0.846 0.932 0.000 0.004 NA
#> GSM862447 1 0.1902 0.846 0.932 0.000 0.004 NA
#> GSM862448 1 0.0524 0.848 0.988 0.000 0.004 NA
#> GSM862449 1 0.5185 0.795 0.748 0.000 0.076 NA
#> GSM862450 1 0.4035 0.829 0.804 0.000 0.020 NA
#> GSM862451 1 0.2647 0.850 0.880 0.000 0.000 NA
#> GSM862453 1 0.3870 0.797 0.788 0.000 0.004 NA
#> GSM862454 1 0.4905 0.726 0.632 0.000 0.004 NA
#> GSM862455 1 0.4936 0.726 0.624 0.000 0.004 NA
#> GSM862456 1 0.4905 0.726 0.632 0.000 0.004 NA
#> GSM862457 1 0.4104 0.827 0.808 0.000 0.028 NA
#> GSM862458 3 0.5329 0.734 0.032 0.028 0.752 NA
#> GSM862459 1 0.2973 0.848 0.856 0.000 0.000 NA
#> GSM862460 1 0.2999 0.830 0.864 0.000 0.004 NA
#> GSM862461 1 0.3726 0.831 0.788 0.000 0.000 NA
#> GSM862462 1 0.4104 0.827 0.808 0.000 0.028 NA
#> GSM862463 1 0.4905 0.726 0.632 0.000 0.004 NA
#> GSM862464 1 0.3494 0.840 0.824 0.000 0.004 NA
#> GSM862465 1 0.5229 0.754 0.564 0.000 0.008 NA
#> GSM862466 1 0.0524 0.848 0.988 0.000 0.004 NA
#> GSM862467 1 0.2714 0.830 0.884 0.000 0.004 NA
#> GSM862468 1 0.3900 0.831 0.816 0.000 0.020 NA
#> GSM862469 3 0.2909 0.958 0.000 0.092 0.888 NA
#> GSM862470 2 0.4686 0.815 0.000 0.788 0.068 NA
#> GSM862471 3 0.3399 0.954 0.000 0.092 0.868 NA
#> GSM862472 3 0.3820 0.947 0.000 0.088 0.848 NA
#> GSM862473 2 0.5910 0.641 0.000 0.676 0.236 NA
#> GSM862474 2 0.4864 0.807 0.000 0.768 0.060 NA
#> GSM862475 2 0.1284 0.813 0.000 0.964 0.012 NA
#> GSM862476 2 0.4864 0.807 0.000 0.768 0.060 NA
#> GSM862477 2 0.4949 0.806 0.000 0.760 0.060 NA
#> GSM862478 3 0.2401 0.959 0.000 0.092 0.904 NA
#> GSM862479 3 0.2909 0.958 0.000 0.092 0.888 NA
#> GSM862480 2 0.4487 0.740 0.000 0.808 0.092 NA
#> GSM862481 2 0.5910 0.641 0.000 0.676 0.236 NA
#> GSM862482 2 0.4864 0.807 0.000 0.768 0.060 NA
#> GSM862483 2 0.6693 0.673 0.000 0.580 0.116 NA
#> GSM862484 2 0.4864 0.807 0.000 0.768 0.060 NA
#> GSM862485 3 0.3399 0.954 0.000 0.092 0.868 NA
#> GSM862486 2 0.4332 0.819 0.000 0.816 0.072 NA
#> GSM862487 3 0.2796 0.958 0.000 0.092 0.892 NA
#> GSM862488 3 0.2546 0.959 0.000 0.092 0.900 NA
#> GSM862489 2 0.2670 0.820 0.000 0.904 0.072 NA
#> GSM862490 2 0.1488 0.814 0.000 0.956 0.012 NA
#> GSM862491 3 0.3667 0.952 0.000 0.088 0.856 NA
#> GSM862492 3 0.2796 0.958 0.000 0.092 0.892 NA
#> GSM862493 2 0.4949 0.806 0.000 0.760 0.060 NA
#> GSM862494 3 0.2546 0.959 0.000 0.092 0.900 NA
#> GSM862495 2 0.3931 0.764 0.000 0.832 0.040 NA
#> GSM862496 2 0.4879 0.723 0.000 0.780 0.092 NA
#> GSM862497 2 0.4487 0.740 0.000 0.808 0.092 NA
#> GSM862498 2 0.4552 0.817 0.000 0.800 0.072 NA
#> GSM862499 3 0.2610 0.960 0.000 0.088 0.900 NA
#> GSM862500 3 0.2610 0.960 0.000 0.088 0.900 NA
#> GSM862501 2 0.2662 0.800 0.000 0.900 0.016 NA
#> GSM862502 2 0.2843 0.797 0.000 0.892 0.020 NA
#> GSM862503 2 0.1938 0.808 0.000 0.936 0.012 NA
#> GSM862504 2 0.4864 0.807 0.000 0.768 0.060 NA
#> GSM862505 2 0.3390 0.775 0.000 0.852 0.016 NA
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> GSM862441 1 0.0865 0.6366 0.972 0.000 0.000 0.024 0.004
#> GSM862442 1 0.5276 0.2459 0.632 0.000 0.004 0.300 0.064
#> GSM862443 1 0.2227 0.6291 0.916 0.000 0.004 0.048 0.032
#> GSM862444 1 0.4089 0.5215 0.804 0.000 0.008 0.100 0.088
#> GSM862445 1 0.5248 0.3265 0.680 0.056 0.004 0.012 0.248
#> GSM862446 1 0.3327 0.6071 0.852 0.000 0.004 0.084 0.060
#> GSM862447 1 0.3327 0.6071 0.852 0.000 0.004 0.084 0.060
#> GSM862448 1 0.3891 0.5799 0.808 0.000 0.004 0.128 0.060
#> GSM862449 1 0.5252 0.3678 0.632 0.000 0.000 0.076 0.292
#> GSM862450 1 0.1605 0.6337 0.944 0.000 0.004 0.012 0.040
#> GSM862451 1 0.3690 0.4682 0.764 0.000 0.000 0.224 0.012
#> GSM862453 1 0.5657 -0.1962 0.544 0.000 0.004 0.380 0.072
#> GSM862454 4 0.4045 0.9971 0.356 0.000 0.000 0.644 0.000
#> GSM862455 4 0.4196 0.9914 0.356 0.000 0.000 0.640 0.004
#> GSM862456 4 0.4045 0.9971 0.356 0.000 0.000 0.644 0.000
#> GSM862457 1 0.1502 0.6316 0.940 0.000 0.000 0.004 0.056
#> GSM862458 3 0.6591 0.6775 0.160 0.012 0.648 0.088 0.092
#> GSM862459 1 0.2753 0.5681 0.856 0.000 0.000 0.136 0.008
#> GSM862460 1 0.5258 0.2581 0.636 0.000 0.004 0.296 0.064
#> GSM862461 1 0.4794 0.2138 0.656 0.000 0.004 0.308 0.032
#> GSM862462 1 0.1571 0.6299 0.936 0.000 0.000 0.004 0.060
#> GSM862463 4 0.4045 0.9971 0.356 0.000 0.000 0.644 0.000
#> GSM862464 1 0.1743 0.6338 0.940 0.000 0.004 0.028 0.028
#> GSM862465 1 0.4972 -0.6287 0.500 0.000 0.004 0.476 0.020
#> GSM862466 1 0.3891 0.5799 0.808 0.000 0.004 0.128 0.060
#> GSM862467 1 0.5255 0.2715 0.644 0.000 0.004 0.284 0.068
#> GSM862468 1 0.1484 0.6335 0.944 0.000 0.000 0.008 0.048
#> GSM862469 3 0.3068 0.9004 0.000 0.020 0.876 0.072 0.032
#> GSM862470 2 0.4474 0.1832 0.000 0.740 0.028 0.016 0.216
#> GSM862471 3 0.3554 0.8924 0.000 0.024 0.848 0.088 0.040
#> GSM862472 3 0.4644 0.8466 0.000 0.020 0.772 0.116 0.092
#> GSM862473 2 0.7435 0.1880 0.000 0.516 0.228 0.096 0.160
#> GSM862474 2 0.4866 0.0774 0.000 0.580 0.028 0.000 0.392
#> GSM862475 2 0.0162 0.4071 0.000 0.996 0.000 0.000 0.004
#> GSM862476 2 0.4866 0.0774 0.000 0.580 0.028 0.000 0.392
#> GSM862477 2 0.4442 0.0944 0.000 0.688 0.028 0.000 0.284
#> GSM862478 3 0.1314 0.9113 0.000 0.016 0.960 0.012 0.012
#> GSM862479 3 0.3160 0.8992 0.000 0.024 0.872 0.072 0.032
#> GSM862480 2 0.5667 0.3846 0.000 0.712 0.072 0.108 0.108
#> GSM862481 2 0.7435 0.1880 0.000 0.516 0.228 0.096 0.160
#> GSM862482 2 0.4866 0.0774 0.000 0.580 0.028 0.000 0.392
#> GSM862483 5 0.5434 0.0000 0.000 0.428 0.012 0.036 0.524
#> GSM862484 2 0.4866 0.0774 0.000 0.580 0.028 0.000 0.392
#> GSM862485 3 0.3348 0.8961 0.000 0.020 0.860 0.080 0.040
#> GSM862486 2 0.3891 0.2700 0.000 0.792 0.028 0.008 0.172
#> GSM862487 3 0.1716 0.9081 0.000 0.016 0.944 0.024 0.016
#> GSM862488 3 0.1419 0.9108 0.000 0.016 0.956 0.012 0.016
#> GSM862489 2 0.2951 0.3641 0.000 0.860 0.028 0.000 0.112
#> GSM862490 2 0.0898 0.3940 0.000 0.972 0.000 0.008 0.020
#> GSM862491 3 0.4080 0.8580 0.000 0.012 0.808 0.104 0.076
#> GSM862492 3 0.1716 0.9081 0.000 0.016 0.944 0.024 0.016
#> GSM862493 2 0.4442 0.0944 0.000 0.688 0.028 0.000 0.284
#> GSM862494 3 0.1419 0.9108 0.000 0.016 0.956 0.012 0.016
#> GSM862495 2 0.5990 0.3622 0.000 0.668 0.044 0.132 0.156
#> GSM862496 2 0.6256 0.3551 0.000 0.656 0.072 0.120 0.152
#> GSM862497 2 0.5667 0.3846 0.000 0.712 0.072 0.108 0.108
#> GSM862498 2 0.4002 0.2545 0.000 0.780 0.028 0.008 0.184
#> GSM862499 3 0.0912 0.9134 0.000 0.016 0.972 0.012 0.000
#> GSM862500 3 0.0912 0.9134 0.000 0.016 0.972 0.012 0.000
#> GSM862501 2 0.3141 0.3564 0.000 0.852 0.000 0.040 0.108
#> GSM862502 2 0.3389 0.3550 0.000 0.836 0.000 0.048 0.116
#> GSM862503 2 0.2144 0.3956 0.000 0.912 0.000 0.020 0.068
#> GSM862504 2 0.4866 0.0774 0.000 0.580 0.028 0.000 0.392
#> GSM862505 2 0.5315 0.3704 0.000 0.696 0.008 0.136 0.160
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> GSM862441 1 0.1794 0.6145 0.924 0.000 0.000 NA 0.000 0.036
#> GSM862442 1 0.6016 0.2383 0.456 0.004 0.000 NA 0.000 0.320
#> GSM862443 1 0.2839 0.6164 0.860 0.008 0.000 NA 0.000 0.032
#> GSM862444 1 0.4547 0.4531 0.712 0.004 0.000 NA 0.012 0.060
#> GSM862445 1 0.4139 0.3925 0.732 0.212 0.000 NA 0.000 0.008
#> GSM862446 1 0.3757 0.5858 0.780 0.000 0.000 NA 0.000 0.084
#> GSM862447 1 0.3757 0.5858 0.780 0.000 0.000 NA 0.000 0.084
#> GSM862448 1 0.4533 0.5510 0.704 0.000 0.000 NA 0.000 0.140
#> GSM862449 1 0.6263 0.3391 0.548 0.112 0.000 NA 0.000 0.076
#> GSM862450 1 0.1858 0.6189 0.924 0.012 0.000 NA 0.000 0.012
#> GSM862451 1 0.4439 0.4585 0.692 0.004 0.000 NA 0.000 0.240
#> GSM862453 1 0.5927 0.0429 0.412 0.000 0.000 NA 0.000 0.376
#> GSM862454 6 0.2854 0.9150 0.208 0.000 0.000 NA 0.000 0.792
#> GSM862455 6 0.3259 0.9062 0.216 0.000 0.000 NA 0.000 0.772
#> GSM862456 6 0.2854 0.9150 0.208 0.000 0.000 NA 0.000 0.792
#> GSM862457 1 0.0622 0.6236 0.980 0.008 0.000 NA 0.000 0.000
#> GSM862458 3 0.6353 0.5589 0.220 0.024 0.520 NA 0.008 0.000
#> GSM862459 1 0.3765 0.5381 0.780 0.004 0.000 NA 0.000 0.156
#> GSM862460 1 0.6031 0.2439 0.456 0.004 0.000 NA 0.000 0.312
#> GSM862461 1 0.5351 0.1635 0.552 0.008 0.000 NA 0.000 0.344
#> GSM862462 1 0.0622 0.6236 0.980 0.008 0.000 NA 0.000 0.000
#> GSM862463 6 0.2854 0.9150 0.208 0.000 0.000 NA 0.000 0.792
#> GSM862464 1 0.1956 0.6219 0.908 0.004 0.000 NA 0.000 0.008
#> GSM862465 6 0.4514 0.6331 0.372 0.000 0.000 NA 0.000 0.588
#> GSM862466 1 0.4533 0.5510 0.704 0.000 0.000 NA 0.000 0.140
#> GSM862467 1 0.5808 0.2531 0.480 0.000 0.000 NA 0.000 0.316
#> GSM862468 1 0.1003 0.6234 0.964 0.004 0.000 NA 0.000 0.004
#> GSM862469 3 0.3649 0.8382 0.000 0.016 0.800 NA 0.012 0.016
#> GSM862470 2 0.5061 0.5850 0.000 0.572 0.012 NA 0.372 0.016
#> GSM862471 3 0.3371 0.8394 0.000 0.012 0.796 NA 0.008 0.004
#> GSM862472 3 0.4359 0.7833 0.000 0.016 0.672 NA 0.016 0.004
#> GSM862473 5 0.7642 0.3842 0.000 0.172 0.188 NA 0.476 0.052
#> GSM862474 2 0.3539 0.7378 0.000 0.768 0.016 NA 0.208 0.008
#> GSM862475 5 0.3534 0.4105 0.000 0.244 0.000 NA 0.740 0.000
#> GSM862476 2 0.3539 0.7378 0.000 0.768 0.016 NA 0.208 0.008
#> GSM862477 2 0.3746 0.7126 0.000 0.712 0.012 NA 0.272 0.000
#> GSM862478 3 0.1312 0.8606 0.000 0.008 0.956 NA 0.004 0.012
#> GSM862479 3 0.3649 0.8382 0.000 0.016 0.800 NA 0.012 0.016
#> GSM862480 5 0.4658 0.6182 0.000 0.072 0.024 NA 0.772 0.052
#> GSM862481 5 0.7642 0.3842 0.000 0.172 0.188 NA 0.476 0.052
#> GSM862482 2 0.3401 0.7402 0.000 0.776 0.016 NA 0.204 0.004
#> GSM862483 2 0.6011 0.3587 0.004 0.616 0.004 NA 0.124 0.052
#> GSM862484 2 0.3401 0.7402 0.000 0.776 0.016 NA 0.204 0.004
#> GSM862485 3 0.3386 0.8333 0.000 0.016 0.788 NA 0.008 0.000
#> GSM862486 2 0.4473 0.5540 0.000 0.576 0.008 NA 0.396 0.000
#> GSM862487 3 0.2202 0.8510 0.000 0.012 0.904 NA 0.008 0.004
#> GSM862488 3 0.1772 0.8587 0.000 0.008 0.936 NA 0.008 0.020
#> GSM862489 5 0.4284 -0.2832 0.000 0.440 0.012 NA 0.544 0.000
#> GSM862490 5 0.3977 0.3692 0.000 0.284 0.000 NA 0.692 0.004
#> GSM862491 3 0.4064 0.7886 0.000 0.012 0.704 NA 0.012 0.004
#> GSM862492 3 0.2089 0.8521 0.000 0.012 0.908 NA 0.004 0.004
#> GSM862493 2 0.3746 0.7126 0.000 0.712 0.012 NA 0.272 0.000
#> GSM862494 3 0.1772 0.8587 0.000 0.008 0.936 NA 0.008 0.020
#> GSM862495 5 0.3272 0.6221 0.000 0.004 0.016 NA 0.848 0.060
#> GSM862496 5 0.3820 0.6191 0.000 0.020 0.024 NA 0.824 0.056
#> GSM862497 5 0.4658 0.6182 0.000 0.072 0.024 NA 0.772 0.052
#> GSM862498 2 0.4337 0.6126 0.000 0.604 0.016 NA 0.372 0.000
#> GSM862499 3 0.0862 0.8661 0.000 0.004 0.972 NA 0.000 0.008
#> GSM862500 3 0.0862 0.8661 0.000 0.004 0.972 NA 0.000 0.008
#> GSM862501 5 0.4232 0.5134 0.000 0.116 0.000 NA 0.776 0.040
#> GSM862502 5 0.4608 0.5130 0.000 0.108 0.000 NA 0.752 0.060
#> GSM862503 5 0.3349 0.4378 0.000 0.244 0.000 NA 0.748 0.000
#> GSM862504 2 0.3539 0.7378 0.000 0.768 0.016 NA 0.208 0.008
#> GSM862505 5 0.3902 0.6109 0.000 0.016 0.004 NA 0.800 0.080
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 tissue(p) k
#> MAD:kmeans 64 6.95e-14 2
#> MAD:kmeans 64 8.50e-14 3
#> MAD:kmeans 64 8.50e-14 4
#> MAD:kmeans 31 1.25e-06 5
#> MAD:kmeans 48 6.30e-09 6
If matrix rows can be associated to genes, consider to use functional_enrichment(res,
...)
to perform function enrichment for the signature genes. See this vignette for more detailed explanations.
The object with results only for a single top-value method and a single partition method can be extracted as:
res = res_list["MAD", "skmeans"]
# you can also extract it by
# res = res_list["MAD:skmeans"]
A summary of res
and all the functions that can be applied to it:
res
#> A 'ConsensusPartition' object with k = 2, 3, 4, 5, 6.
#> On a matrix with 51941 rows and 64 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.986 0.994 0.4925 0.510 0.510
#> 3 3 1.000 0.998 0.999 0.3346 0.833 0.673
#> 4 4 0.886 0.865 0.909 0.1030 0.929 0.792
#> 5 5 0.741 0.627 0.823 0.0704 0.917 0.712
#> 6 6 0.720 0.583 0.736 0.0473 0.913 0.656
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
#> GSM862441 1 0.000 1.000 1.000 0.000
#> GSM862442 1 0.000 1.000 1.000 0.000
#> GSM862443 1 0.000 1.000 1.000 0.000
#> GSM862444 1 0.000 1.000 1.000 0.000
#> GSM862445 1 0.000 1.000 1.000 0.000
#> GSM862446 1 0.000 1.000 1.000 0.000
#> GSM862447 1 0.000 1.000 1.000 0.000
#> GSM862448 1 0.000 1.000 1.000 0.000
#> GSM862449 1 0.000 1.000 1.000 0.000
#> GSM862450 1 0.000 1.000 1.000 0.000
#> GSM862451 1 0.000 1.000 1.000 0.000
#> GSM862453 1 0.000 1.000 1.000 0.000
#> GSM862454 1 0.000 1.000 1.000 0.000
#> GSM862455 1 0.000 1.000 1.000 0.000
#> GSM862456 1 0.000 1.000 1.000 0.000
#> GSM862457 1 0.000 1.000 1.000 0.000
#> GSM862458 2 0.939 0.447 0.356 0.644
#> GSM862459 1 0.000 1.000 1.000 0.000
#> GSM862460 1 0.000 1.000 1.000 0.000
#> GSM862461 1 0.000 1.000 1.000 0.000
#> GSM862462 1 0.000 1.000 1.000 0.000
#> GSM862463 1 0.000 1.000 1.000 0.000
#> GSM862464 1 0.000 1.000 1.000 0.000
#> GSM862465 1 0.000 1.000 1.000 0.000
#> GSM862466 1 0.000 1.000 1.000 0.000
#> GSM862467 1 0.000 1.000 1.000 0.000
#> GSM862468 1 0.000 1.000 1.000 0.000
#> GSM862469 2 0.000 0.990 0.000 1.000
#> GSM862470 2 0.000 0.990 0.000 1.000
#> GSM862471 2 0.000 0.990 0.000 1.000
#> GSM862472 2 0.000 0.990 0.000 1.000
#> GSM862473 2 0.000 0.990 0.000 1.000
#> GSM862474 2 0.000 0.990 0.000 1.000
#> GSM862475 2 0.000 0.990 0.000 1.000
#> GSM862476 2 0.000 0.990 0.000 1.000
#> GSM862477 2 0.000 0.990 0.000 1.000
#> GSM862478 2 0.000 0.990 0.000 1.000
#> GSM862479 2 0.000 0.990 0.000 1.000
#> GSM862480 2 0.000 0.990 0.000 1.000
#> GSM862481 2 0.000 0.990 0.000 1.000
#> GSM862482 2 0.000 0.990 0.000 1.000
#> GSM862483 2 0.000 0.990 0.000 1.000
#> GSM862484 2 0.000 0.990 0.000 1.000
#> GSM862485 2 0.000 0.990 0.000 1.000
#> GSM862486 2 0.000 0.990 0.000 1.000
#> GSM862487 2 0.000 0.990 0.000 1.000
#> GSM862488 2 0.000 0.990 0.000 1.000
#> GSM862489 2 0.000 0.990 0.000 1.000
#> GSM862490 2 0.000 0.990 0.000 1.000
#> GSM862491 2 0.000 0.990 0.000 1.000
#> GSM862492 2 0.000 0.990 0.000 1.000
#> GSM862493 2 0.000 0.990 0.000 1.000
#> GSM862494 2 0.000 0.990 0.000 1.000
#> GSM862495 2 0.000 0.990 0.000 1.000
#> GSM862496 2 0.000 0.990 0.000 1.000
#> GSM862497 2 0.000 0.990 0.000 1.000
#> GSM862498 2 0.000 0.990 0.000 1.000
#> GSM862499 2 0.000 0.990 0.000 1.000
#> GSM862500 2 0.000 0.990 0.000 1.000
#> GSM862501 2 0.000 0.990 0.000 1.000
#> GSM862502 2 0.000 0.990 0.000 1.000
#> GSM862503 2 0.000 0.990 0.000 1.000
#> GSM862504 2 0.000 0.990 0.000 1.000
#> GSM862505 2 0.000 0.990 0.000 1.000
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> GSM862441 1 0.000 1.000 1 0.000 0.000
#> GSM862442 1 0.000 1.000 1 0.000 0.000
#> GSM862443 1 0.000 1.000 1 0.000 0.000
#> GSM862444 1 0.000 1.000 1 0.000 0.000
#> GSM862445 1 0.000 1.000 1 0.000 0.000
#> GSM862446 1 0.000 1.000 1 0.000 0.000
#> GSM862447 1 0.000 1.000 1 0.000 0.000
#> GSM862448 1 0.000 1.000 1 0.000 0.000
#> GSM862449 1 0.000 1.000 1 0.000 0.000
#> GSM862450 1 0.000 1.000 1 0.000 0.000
#> GSM862451 1 0.000 1.000 1 0.000 0.000
#> GSM862453 1 0.000 1.000 1 0.000 0.000
#> GSM862454 1 0.000 1.000 1 0.000 0.000
#> GSM862455 1 0.000 1.000 1 0.000 0.000
#> GSM862456 1 0.000 1.000 1 0.000 0.000
#> GSM862457 1 0.000 1.000 1 0.000 0.000
#> GSM862458 3 0.000 1.000 0 0.000 1.000
#> GSM862459 1 0.000 1.000 1 0.000 0.000
#> GSM862460 1 0.000 1.000 1 0.000 0.000
#> GSM862461 1 0.000 1.000 1 0.000 0.000
#> GSM862462 1 0.000 1.000 1 0.000 0.000
#> GSM862463 1 0.000 1.000 1 0.000 0.000
#> GSM862464 1 0.000 1.000 1 0.000 0.000
#> GSM862465 1 0.000 1.000 1 0.000 0.000
#> GSM862466 1 0.000 1.000 1 0.000 0.000
#> GSM862467 1 0.000 1.000 1 0.000 0.000
#> GSM862468 1 0.000 1.000 1 0.000 0.000
#> GSM862469 3 0.000 1.000 0 0.000 1.000
#> GSM862470 2 0.000 0.997 0 1.000 0.000
#> GSM862471 3 0.000 1.000 0 0.000 1.000
#> GSM862472 3 0.000 1.000 0 0.000 1.000
#> GSM862473 2 0.141 0.964 0 0.964 0.036
#> GSM862474 2 0.000 0.997 0 1.000 0.000
#> GSM862475 2 0.000 0.997 0 1.000 0.000
#> GSM862476 2 0.000 0.997 0 1.000 0.000
#> GSM862477 2 0.000 0.997 0 1.000 0.000
#> GSM862478 3 0.000 1.000 0 0.000 1.000
#> GSM862479 3 0.000 1.000 0 0.000 1.000
#> GSM862480 2 0.000 0.997 0 1.000 0.000
#> GSM862481 2 0.129 0.968 0 0.968 0.032
#> GSM862482 2 0.000 0.997 0 1.000 0.000
#> GSM862483 2 0.000 0.997 0 1.000 0.000
#> GSM862484 2 0.000 0.997 0 1.000 0.000
#> GSM862485 3 0.000 1.000 0 0.000 1.000
#> GSM862486 2 0.000 0.997 0 1.000 0.000
#> GSM862487 3 0.000 1.000 0 0.000 1.000
#> GSM862488 3 0.000 1.000 0 0.000 1.000
#> GSM862489 2 0.000 0.997 0 1.000 0.000
#> GSM862490 2 0.000 0.997 0 1.000 0.000
#> GSM862491 3 0.000 1.000 0 0.000 1.000
#> GSM862492 3 0.000 1.000 0 0.000 1.000
#> GSM862493 2 0.000 0.997 0 1.000 0.000
#> GSM862494 3 0.000 1.000 0 0.000 1.000
#> GSM862495 2 0.000 0.997 0 1.000 0.000
#> GSM862496 2 0.000 0.997 0 1.000 0.000
#> GSM862497 2 0.000 0.997 0 1.000 0.000
#> GSM862498 2 0.000 0.997 0 1.000 0.000
#> GSM862499 3 0.000 1.000 0 0.000 1.000
#> GSM862500 3 0.000 1.000 0 0.000 1.000
#> GSM862501 2 0.000 0.997 0 1.000 0.000
#> GSM862502 2 0.000 0.997 0 1.000 0.000
#> GSM862503 2 0.000 0.997 0 1.000 0.000
#> GSM862504 2 0.000 0.997 0 1.000 0.000
#> GSM862505 2 0.000 0.997 0 1.000 0.000
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> GSM862441 1 0.0707 0.957 0.980 0.000 0.000 0.020
#> GSM862442 1 0.0336 0.957 0.992 0.000 0.000 0.008
#> GSM862443 1 0.0469 0.957 0.988 0.000 0.000 0.012
#> GSM862444 1 0.0707 0.957 0.980 0.000 0.000 0.020
#> GSM862445 1 0.6536 0.470 0.580 0.324 0.000 0.096
#> GSM862446 1 0.1474 0.948 0.948 0.000 0.000 0.052
#> GSM862447 1 0.1474 0.948 0.948 0.000 0.000 0.052
#> GSM862448 1 0.1474 0.948 0.948 0.000 0.000 0.052
#> GSM862449 1 0.2345 0.924 0.900 0.000 0.000 0.100
#> GSM862450 1 0.1637 0.944 0.940 0.000 0.000 0.060
#> GSM862451 1 0.0707 0.957 0.980 0.000 0.000 0.020
#> GSM862453 1 0.0592 0.956 0.984 0.000 0.000 0.016
#> GSM862454 1 0.0707 0.957 0.980 0.000 0.000 0.020
#> GSM862455 1 0.0707 0.957 0.980 0.000 0.000 0.020
#> GSM862456 1 0.0707 0.957 0.980 0.000 0.000 0.020
#> GSM862457 1 0.2216 0.929 0.908 0.000 0.000 0.092
#> GSM862458 3 0.2222 0.932 0.000 0.016 0.924 0.060
#> GSM862459 1 0.0707 0.957 0.980 0.000 0.000 0.020
#> GSM862460 1 0.0336 0.957 0.992 0.000 0.000 0.008
#> GSM862461 1 0.0707 0.957 0.980 0.000 0.000 0.020
#> GSM862462 1 0.2081 0.933 0.916 0.000 0.000 0.084
#> GSM862463 1 0.0707 0.957 0.980 0.000 0.000 0.020
#> GSM862464 1 0.0592 0.957 0.984 0.000 0.000 0.016
#> GSM862465 1 0.0707 0.957 0.980 0.000 0.000 0.020
#> GSM862466 1 0.1474 0.948 0.948 0.000 0.000 0.052
#> GSM862467 1 0.0817 0.955 0.976 0.000 0.000 0.024
#> GSM862468 1 0.1389 0.949 0.952 0.000 0.000 0.048
#> GSM862469 3 0.0000 0.993 0.000 0.000 1.000 0.000
#> GSM862470 2 0.1940 0.856 0.000 0.924 0.000 0.076
#> GSM862471 3 0.0000 0.993 0.000 0.000 1.000 0.000
#> GSM862472 3 0.0000 0.993 0.000 0.000 1.000 0.000
#> GSM862473 4 0.6248 0.584 0.000 0.260 0.100 0.640
#> GSM862474 2 0.0188 0.899 0.000 0.996 0.000 0.004
#> GSM862475 4 0.4925 0.565 0.000 0.428 0.000 0.572
#> GSM862476 2 0.0188 0.899 0.000 0.996 0.000 0.004
#> GSM862477 2 0.0592 0.897 0.000 0.984 0.000 0.016
#> GSM862478 3 0.0188 0.992 0.000 0.000 0.996 0.004
#> GSM862479 3 0.0000 0.993 0.000 0.000 1.000 0.000
#> GSM862480 4 0.2814 0.737 0.000 0.132 0.000 0.868
#> GSM862481 4 0.6167 0.592 0.000 0.256 0.096 0.648
#> GSM862482 2 0.0000 0.898 0.000 1.000 0.000 0.000
#> GSM862483 2 0.1716 0.830 0.000 0.936 0.000 0.064
#> GSM862484 2 0.0000 0.898 0.000 1.000 0.000 0.000
#> GSM862485 3 0.0336 0.989 0.000 0.000 0.992 0.008
#> GSM862486 2 0.2530 0.811 0.000 0.888 0.000 0.112
#> GSM862487 3 0.0188 0.992 0.000 0.000 0.996 0.004
#> GSM862488 3 0.0188 0.992 0.000 0.000 0.996 0.004
#> GSM862489 2 0.4543 0.222 0.000 0.676 0.000 0.324
#> GSM862490 4 0.5000 0.425 0.000 0.496 0.000 0.504
#> GSM862491 3 0.0188 0.991 0.000 0.000 0.996 0.004
#> GSM862492 3 0.0188 0.992 0.000 0.000 0.996 0.004
#> GSM862493 2 0.0592 0.897 0.000 0.984 0.000 0.016
#> GSM862494 3 0.0188 0.992 0.000 0.000 0.996 0.004
#> GSM862495 4 0.2814 0.737 0.000 0.132 0.000 0.868
#> GSM862496 4 0.2814 0.737 0.000 0.132 0.000 0.868
#> GSM862497 4 0.2814 0.737 0.000 0.132 0.000 0.868
#> GSM862498 2 0.2408 0.820 0.000 0.896 0.000 0.104
#> GSM862499 3 0.0000 0.993 0.000 0.000 1.000 0.000
#> GSM862500 3 0.0000 0.993 0.000 0.000 1.000 0.000
#> GSM862501 4 0.4941 0.550 0.000 0.436 0.000 0.564
#> GSM862502 4 0.4925 0.559 0.000 0.428 0.000 0.572
#> GSM862503 4 0.4994 0.466 0.000 0.480 0.000 0.520
#> GSM862504 2 0.0188 0.899 0.000 0.996 0.000 0.004
#> GSM862505 4 0.2814 0.737 0.000 0.132 0.000 0.868
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> GSM862441 1 0.1671 0.6966 0.924 0.000 0.000 0.076 0.000
#> GSM862442 1 0.2280 0.6882 0.880 0.000 0.000 0.120 0.000
#> GSM862443 1 0.2536 0.6827 0.868 0.000 0.000 0.128 0.004
#> GSM862444 1 0.2439 0.6166 0.876 0.000 0.000 0.120 0.004
#> GSM862445 4 0.6220 0.3905 0.356 0.132 0.000 0.508 0.004
#> GSM862446 1 0.4045 -0.0480 0.644 0.000 0.000 0.356 0.000
#> GSM862447 1 0.4101 -0.1329 0.628 0.000 0.000 0.372 0.000
#> GSM862448 1 0.3895 0.1223 0.680 0.000 0.000 0.320 0.000
#> GSM862449 4 0.4582 0.6355 0.416 0.000 0.000 0.572 0.012
#> GSM862450 4 0.4450 0.4853 0.488 0.000 0.000 0.508 0.004
#> GSM862451 1 0.0162 0.7196 0.996 0.000 0.000 0.004 0.000
#> GSM862453 1 0.2329 0.6582 0.876 0.000 0.000 0.124 0.000
#> GSM862454 1 0.0000 0.7203 1.000 0.000 0.000 0.000 0.000
#> GSM862455 1 0.0404 0.7179 0.988 0.000 0.000 0.012 0.000
#> GSM862456 1 0.0000 0.7203 1.000 0.000 0.000 0.000 0.000
#> GSM862457 4 0.4302 0.6394 0.480 0.000 0.000 0.520 0.000
#> GSM862458 3 0.4775 0.6668 0.000 0.008 0.640 0.332 0.020
#> GSM862459 1 0.0404 0.7179 0.988 0.000 0.000 0.012 0.000
#> GSM862460 1 0.2329 0.6899 0.876 0.000 0.000 0.124 0.000
#> GSM862461 1 0.2124 0.6898 0.900 0.000 0.000 0.096 0.004
#> GSM862462 4 0.4304 0.6322 0.484 0.000 0.000 0.516 0.000
#> GSM862463 1 0.0000 0.7203 1.000 0.000 0.000 0.000 0.000
#> GSM862464 1 0.3398 0.5568 0.780 0.000 0.000 0.216 0.004
#> GSM862465 1 0.0510 0.7157 0.984 0.000 0.000 0.016 0.000
#> GSM862466 1 0.3876 0.1402 0.684 0.000 0.000 0.316 0.000
#> GSM862467 1 0.3109 0.5447 0.800 0.000 0.000 0.200 0.000
#> GSM862468 1 0.3983 -0.0486 0.660 0.000 0.000 0.340 0.000
#> GSM862469 3 0.1768 0.9266 0.000 0.000 0.924 0.072 0.004
#> GSM862470 2 0.2378 0.7277 0.000 0.904 0.000 0.048 0.048
#> GSM862471 3 0.1638 0.9307 0.000 0.000 0.932 0.064 0.004
#> GSM862472 3 0.1864 0.9280 0.000 0.004 0.924 0.068 0.004
#> GSM862473 5 0.6101 0.5578 0.000 0.192 0.108 0.048 0.652
#> GSM862474 2 0.2424 0.7341 0.000 0.868 0.000 0.132 0.000
#> GSM862475 5 0.5024 0.0184 0.000 0.440 0.000 0.032 0.528
#> GSM862476 2 0.2424 0.7341 0.000 0.868 0.000 0.132 0.000
#> GSM862477 2 0.0404 0.7448 0.000 0.988 0.000 0.000 0.012
#> GSM862478 3 0.0290 0.9411 0.000 0.000 0.992 0.008 0.000
#> GSM862479 3 0.1831 0.9260 0.000 0.000 0.920 0.076 0.004
#> GSM862480 5 0.1525 0.7521 0.000 0.036 0.004 0.012 0.948
#> GSM862481 5 0.6022 0.5611 0.000 0.200 0.096 0.048 0.656
#> GSM862482 2 0.2583 0.7358 0.000 0.864 0.000 0.132 0.004
#> GSM862483 2 0.3596 0.6339 0.000 0.784 0.000 0.200 0.016
#> GSM862484 2 0.2583 0.7358 0.000 0.864 0.000 0.132 0.004
#> GSM862485 3 0.2136 0.9189 0.000 0.000 0.904 0.088 0.008
#> GSM862486 2 0.3291 0.6861 0.000 0.840 0.000 0.040 0.120
#> GSM862487 3 0.2074 0.9100 0.000 0.000 0.920 0.036 0.044
#> GSM862488 3 0.0290 0.9411 0.000 0.000 0.992 0.008 0.000
#> GSM862489 2 0.3849 0.5779 0.000 0.752 0.000 0.016 0.232
#> GSM862490 2 0.5182 0.1589 0.000 0.544 0.000 0.044 0.412
#> GSM862491 3 0.1430 0.9322 0.000 0.000 0.944 0.052 0.004
#> GSM862492 3 0.1168 0.9344 0.000 0.000 0.960 0.032 0.008
#> GSM862493 2 0.1106 0.7469 0.000 0.964 0.000 0.024 0.012
#> GSM862494 3 0.0290 0.9411 0.000 0.000 0.992 0.008 0.000
#> GSM862495 5 0.1310 0.7447 0.000 0.024 0.000 0.020 0.956
#> GSM862496 5 0.1442 0.7520 0.000 0.032 0.004 0.012 0.952
#> GSM862497 5 0.1525 0.7521 0.000 0.036 0.004 0.012 0.948
#> GSM862498 2 0.2193 0.7295 0.000 0.912 0.000 0.028 0.060
#> GSM862499 3 0.0290 0.9413 0.000 0.000 0.992 0.008 0.000
#> GSM862500 3 0.0290 0.9413 0.000 0.000 0.992 0.008 0.000
#> GSM862501 2 0.5509 -0.0532 0.000 0.468 0.000 0.064 0.468
#> GSM862502 5 0.5431 0.0343 0.000 0.424 0.000 0.060 0.516
#> GSM862503 2 0.4937 0.1604 0.000 0.544 0.000 0.028 0.428
#> GSM862504 2 0.2536 0.7366 0.000 0.868 0.000 0.128 0.004
#> GSM862505 5 0.1403 0.7442 0.000 0.024 0.000 0.024 0.952
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> GSM862441 4 0.4032 0.7461 0.420 0.000 0.000 0.572 0.000 0.008
#> GSM862442 1 0.4292 -0.3701 0.588 0.000 0.000 0.388 0.000 0.024
#> GSM862443 4 0.4806 0.5401 0.380 0.000 0.000 0.560 0.000 0.060
#> GSM862444 4 0.4274 0.6562 0.276 0.000 0.000 0.676 0.000 0.048
#> GSM862445 1 0.6858 0.2653 0.456 0.116 0.000 0.124 0.000 0.304
#> GSM862446 1 0.1398 0.5518 0.940 0.000 0.000 0.052 0.000 0.008
#> GSM862447 1 0.0806 0.5650 0.972 0.000 0.000 0.020 0.000 0.008
#> GSM862448 1 0.1327 0.5477 0.936 0.000 0.000 0.064 0.000 0.000
#> GSM862449 1 0.3883 0.5017 0.768 0.000 0.000 0.088 0.000 0.144
#> GSM862450 1 0.4913 0.3949 0.636 0.000 0.000 0.252 0.000 0.112
#> GSM862451 4 0.4002 0.8060 0.404 0.000 0.000 0.588 0.000 0.008
#> GSM862453 1 0.3807 -0.3007 0.628 0.000 0.000 0.368 0.000 0.004
#> GSM862454 4 0.3756 0.8039 0.400 0.000 0.000 0.600 0.000 0.000
#> GSM862455 4 0.3684 0.8084 0.372 0.000 0.000 0.628 0.000 0.000
#> GSM862456 4 0.3756 0.8039 0.400 0.000 0.000 0.600 0.000 0.000
#> GSM862457 1 0.3458 0.5336 0.808 0.000 0.000 0.112 0.000 0.080
#> GSM862458 3 0.6350 0.5226 0.036 0.008 0.460 0.120 0.000 0.376
#> GSM862459 4 0.3717 0.8098 0.384 0.000 0.000 0.616 0.000 0.000
#> GSM862460 1 0.4410 -0.3998 0.560 0.000 0.000 0.412 0.000 0.028
#> GSM862461 4 0.4377 0.6691 0.312 0.000 0.000 0.644 0.000 0.044
#> GSM862462 1 0.3508 0.5374 0.800 0.000 0.000 0.132 0.000 0.068
#> GSM862463 4 0.3756 0.8039 0.400 0.000 0.000 0.600 0.000 0.000
#> GSM862464 4 0.4975 0.3444 0.428 0.000 0.000 0.504 0.000 0.068
#> GSM862465 4 0.3672 0.8060 0.368 0.000 0.000 0.632 0.000 0.000
#> GSM862466 1 0.1327 0.5477 0.936 0.000 0.000 0.064 0.000 0.000
#> GSM862467 1 0.3323 0.1777 0.752 0.000 0.000 0.240 0.000 0.008
#> GSM862468 1 0.3202 0.4705 0.800 0.000 0.000 0.176 0.000 0.024
#> GSM862469 3 0.3104 0.8358 0.000 0.000 0.800 0.016 0.000 0.184
#> GSM862470 2 0.2907 0.6328 0.000 0.828 0.000 0.000 0.020 0.152
#> GSM862471 3 0.3385 0.8370 0.000 0.000 0.788 0.032 0.000 0.180
#> GSM862472 3 0.4380 0.8196 0.000 0.016 0.752 0.076 0.004 0.152
#> GSM862473 5 0.5754 0.6048 0.000 0.164 0.056 0.032 0.672 0.076
#> GSM862474 2 0.3404 0.6204 0.000 0.744 0.000 0.004 0.004 0.248
#> GSM862475 5 0.5629 -0.1322 0.000 0.412 0.000 0.004 0.456 0.128
#> GSM862476 2 0.3380 0.6214 0.000 0.748 0.000 0.004 0.004 0.244
#> GSM862477 2 0.0260 0.6589 0.000 0.992 0.000 0.000 0.008 0.000
#> GSM862478 3 0.0665 0.8727 0.000 0.000 0.980 0.004 0.008 0.008
#> GSM862479 3 0.3221 0.8337 0.000 0.000 0.792 0.020 0.000 0.188
#> GSM862480 5 0.0547 0.7753 0.000 0.020 0.000 0.000 0.980 0.000
#> GSM862481 5 0.5754 0.6048 0.000 0.164 0.056 0.032 0.672 0.076
#> GSM862482 2 0.3265 0.6265 0.000 0.748 0.000 0.004 0.000 0.248
#> GSM862483 2 0.4580 0.5554 0.004 0.700 0.000 0.076 0.004 0.216
#> GSM862484 2 0.3240 0.6257 0.000 0.752 0.000 0.004 0.000 0.244
#> GSM862485 3 0.3699 0.8131 0.000 0.000 0.752 0.036 0.000 0.212
#> GSM862486 2 0.4054 0.6006 0.000 0.740 0.000 0.000 0.072 0.188
#> GSM862487 3 0.2541 0.8414 0.000 0.000 0.892 0.024 0.052 0.032
#> GSM862488 3 0.0551 0.8731 0.000 0.000 0.984 0.004 0.008 0.004
#> GSM862489 2 0.4443 0.4500 0.000 0.680 0.000 0.004 0.260 0.056
#> GSM862490 2 0.5434 0.3688 0.000 0.564 0.000 0.000 0.272 0.164
#> GSM862491 3 0.3270 0.8417 0.000 0.000 0.836 0.072 0.008 0.084
#> GSM862492 3 0.2032 0.8586 0.000 0.000 0.920 0.024 0.020 0.036
#> GSM862493 2 0.1124 0.6591 0.000 0.956 0.000 0.000 0.008 0.036
#> GSM862494 3 0.0551 0.8731 0.000 0.000 0.984 0.004 0.008 0.004
#> GSM862495 5 0.1949 0.7462 0.000 0.004 0.000 0.004 0.904 0.088
#> GSM862496 5 0.0260 0.7736 0.000 0.008 0.000 0.000 0.992 0.000
#> GSM862497 5 0.0547 0.7753 0.000 0.020 0.000 0.000 0.980 0.000
#> GSM862498 2 0.2883 0.6389 0.000 0.860 0.000 0.008 0.040 0.092
#> GSM862499 3 0.0547 0.8747 0.000 0.000 0.980 0.000 0.000 0.020
#> GSM862500 3 0.0547 0.8747 0.000 0.000 0.980 0.000 0.000 0.020
#> GSM862501 2 0.6351 0.1966 0.000 0.432 0.000 0.016 0.296 0.256
#> GSM862502 2 0.6472 0.0616 0.000 0.372 0.000 0.020 0.360 0.248
#> GSM862503 2 0.5485 0.2686 0.000 0.524 0.000 0.004 0.352 0.120
#> GSM862504 2 0.3622 0.6219 0.000 0.744 0.000 0.004 0.016 0.236
#> GSM862505 5 0.2400 0.7349 0.000 0.004 0.000 0.008 0.872 0.116
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 tissue(p) k
#> MAD:skmeans 63 1.62e-14 2
#> MAD:skmeans 64 8.50e-14 3
#> MAD:skmeans 60 3.77e-12 4
#> MAD:skmeans 52 9.10e-10 5
#> MAD:skmeans 50 2.39e-09 6
If matrix rows can be associated to genes, consider to use functional_enrichment(res,
...)
to perform function enrichment for the signature genes. See this vignette for more detailed explanations.
The object with results only for a single top-value method and a single partition method can be extracted as:
res = res_list["MAD", "pam"]
# you can also extract it by
# res = res_list["MAD:pam"]
A summary of res
and all the functions that can be applied to it:
res
#> A 'ConsensusPartition' object with k = 2, 3, 4, 5, 6.
#> On a matrix with 51941 rows and 64 columns.
#> Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'MAD' method.
#> Subgroups are detected by 'pam' method.
#> Performed in total 1250 partitions by row resampling.
#> Best k for subgroups seems to be 3.
#>
#> Following methods can be applied to this 'ConsensusPartition' object:
#> [1] "cola_report" "collect_classes" "collect_plots"
#> [4] "collect_stats" "colnames" "compare_signatures"
#> [7] "consensus_heatmap" "dimension_reduction" "functional_enrichment"
#> [10] "get_anno_col" "get_anno" "get_classes"
#> [13] "get_consensus" "get_matrix" "get_membership"
#> [16] "get_param" "get_signatures" "get_stats"
#> [19] "is_best_k" "is_stable_k" "membership_heatmap"
#> [22] "ncol" "nrow" "plot_ecdf"
#> [25] "rownames" "select_partition_number" "show"
#> [28] "suggest_best_k" "test_to_known_factors"
collect_plots()
function collects all the plots made from res
for all k
(number of partitions)
into one single page to provide an easy and fast comparison between different k
.
collect_plots(res)
The plots are:
k
and the heatmap of
predicted classes for each k
.k
.k
.k
.All the plots in panels can be made by individual functions and they are plotted later in this section.
select_partition_number()
produces several plots showing different
statistics for choosing “optimized” k
. There are following statistics:
k
;k
, the area increased is defined as \(A_k - A_{k-1}\).The detailed explanations of these statistics can be found in the cola vignette.
Generally speaking, lower PAC score, higher mean silhouette score or higher
concordance corresponds to better partition. Rand index and Jaccard index
measure how similar the current partition is compared to partition with k-1
.
If they are too similar, we won't accept k
is better than k-1
.
select_partition_number(res)
The numeric values for all these statistics can be obtained by get_stats()
.
get_stats(res)
#> k 1-PAC mean_silhouette concordance area_increased Rand Jaccard
#> 2 2 1.000 0.975 0.989 0.4872 0.510 0.510
#> 3 3 0.980 0.950 0.980 0.3187 0.835 0.679
#> 4 4 0.808 0.781 0.885 0.1022 0.950 0.861
#> 5 5 0.789 0.806 0.873 0.0741 0.914 0.729
#> 6 6 0.885 0.880 0.894 0.0574 0.941 0.763
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
#> GSM862441 1 0.000 0.976 1.000 0.000
#> GSM862442 1 0.000 0.976 1.000 0.000
#> GSM862443 1 0.000 0.976 1.000 0.000
#> GSM862444 1 0.000 0.976 1.000 0.000
#> GSM862445 1 0.904 0.543 0.680 0.320
#> GSM862446 1 0.000 0.976 1.000 0.000
#> GSM862447 1 0.000 0.976 1.000 0.000
#> GSM862448 1 0.000 0.976 1.000 0.000
#> GSM862449 1 0.000 0.976 1.000 0.000
#> GSM862450 1 0.000 0.976 1.000 0.000
#> GSM862451 1 0.000 0.976 1.000 0.000
#> GSM862453 1 0.000 0.976 1.000 0.000
#> GSM862454 1 0.000 0.976 1.000 0.000
#> GSM862455 1 0.000 0.976 1.000 0.000
#> GSM862456 1 0.000 0.976 1.000 0.000
#> GSM862457 1 0.000 0.976 1.000 0.000
#> GSM862458 2 0.494 0.874 0.108 0.892
#> GSM862459 1 0.000 0.976 1.000 0.000
#> GSM862460 1 0.000 0.976 1.000 0.000
#> GSM862461 1 0.000 0.976 1.000 0.000
#> GSM862462 1 0.833 0.649 0.736 0.264
#> GSM862463 1 0.000 0.976 1.000 0.000
#> GSM862464 1 0.000 0.976 1.000 0.000
#> GSM862465 1 0.000 0.976 1.000 0.000
#> GSM862466 1 0.000 0.976 1.000 0.000
#> GSM862467 1 0.000 0.976 1.000 0.000
#> GSM862468 1 0.000 0.976 1.000 0.000
#> GSM862469 2 0.000 0.997 0.000 1.000
#> GSM862470 2 0.000 0.997 0.000 1.000
#> GSM862471 2 0.000 0.997 0.000 1.000
#> GSM862472 2 0.000 0.997 0.000 1.000
#> GSM862473 2 0.000 0.997 0.000 1.000
#> GSM862474 2 0.000 0.997 0.000 1.000
#> GSM862475 2 0.000 0.997 0.000 1.000
#> GSM862476 2 0.000 0.997 0.000 1.000
#> GSM862477 2 0.000 0.997 0.000 1.000
#> GSM862478 2 0.000 0.997 0.000 1.000
#> GSM862479 2 0.000 0.997 0.000 1.000
#> GSM862480 2 0.000 0.997 0.000 1.000
#> GSM862481 2 0.000 0.997 0.000 1.000
#> GSM862482 2 0.000 0.997 0.000 1.000
#> GSM862483 2 0.000 0.997 0.000 1.000
#> GSM862484 2 0.000 0.997 0.000 1.000
#> GSM862485 2 0.000 0.997 0.000 1.000
#> GSM862486 2 0.000 0.997 0.000 1.000
#> GSM862487 2 0.000 0.997 0.000 1.000
#> GSM862488 2 0.000 0.997 0.000 1.000
#> GSM862489 2 0.000 0.997 0.000 1.000
#> GSM862490 2 0.000 0.997 0.000 1.000
#> GSM862491 2 0.000 0.997 0.000 1.000
#> GSM862492 2 0.000 0.997 0.000 1.000
#> GSM862493 2 0.000 0.997 0.000 1.000
#> GSM862494 2 0.000 0.997 0.000 1.000
#> GSM862495 2 0.000 0.997 0.000 1.000
#> GSM862496 2 0.000 0.997 0.000 1.000
#> GSM862497 2 0.000 0.997 0.000 1.000
#> GSM862498 2 0.000 0.997 0.000 1.000
#> GSM862499 2 0.000 0.997 0.000 1.000
#> GSM862500 2 0.000 0.997 0.000 1.000
#> GSM862501 2 0.000 0.997 0.000 1.000
#> GSM862502 2 0.000 0.997 0.000 1.000
#> GSM862503 2 0.000 0.997 0.000 1.000
#> GSM862504 2 0.000 0.997 0.000 1.000
#> GSM862505 2 0.000 0.997 0.000 1.000
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> GSM862441 1 0.0000 0.980 1.000 0.000 0.000
#> GSM862442 1 0.0000 0.980 1.000 0.000 0.000
#> GSM862443 1 0.0000 0.980 1.000 0.000 0.000
#> GSM862444 1 0.0000 0.980 1.000 0.000 0.000
#> GSM862445 1 0.4605 0.723 0.796 0.204 0.000
#> GSM862446 1 0.0000 0.980 1.000 0.000 0.000
#> GSM862447 1 0.0000 0.980 1.000 0.000 0.000
#> GSM862448 1 0.0000 0.980 1.000 0.000 0.000
#> GSM862449 1 0.0000 0.980 1.000 0.000 0.000
#> GSM862450 1 0.0000 0.980 1.000 0.000 0.000
#> GSM862451 1 0.0000 0.980 1.000 0.000 0.000
#> GSM862453 1 0.0000 0.980 1.000 0.000 0.000
#> GSM862454 1 0.0000 0.980 1.000 0.000 0.000
#> GSM862455 1 0.0000 0.980 1.000 0.000 0.000
#> GSM862456 1 0.0000 0.980 1.000 0.000 0.000
#> GSM862457 1 0.0000 0.980 1.000 0.000 0.000
#> GSM862458 2 0.7758 0.466 0.084 0.636 0.280
#> GSM862459 1 0.0000 0.980 1.000 0.000 0.000
#> GSM862460 1 0.0000 0.980 1.000 0.000 0.000
#> GSM862461 1 0.0000 0.980 1.000 0.000 0.000
#> GSM862462 1 0.4178 0.769 0.828 0.172 0.000
#> GSM862463 1 0.0000 0.980 1.000 0.000 0.000
#> GSM862464 3 0.6140 0.337 0.404 0.000 0.596
#> GSM862465 1 0.0000 0.980 1.000 0.000 0.000
#> GSM862466 1 0.0000 0.980 1.000 0.000 0.000
#> GSM862467 1 0.0000 0.980 1.000 0.000 0.000
#> GSM862468 1 0.0000 0.980 1.000 0.000 0.000
#> GSM862469 3 0.0000 0.951 0.000 0.000 1.000
#> GSM862470 2 0.0000 0.986 0.000 1.000 0.000
#> GSM862471 3 0.0000 0.951 0.000 0.000 1.000
#> GSM862472 3 0.3412 0.831 0.000 0.124 0.876
#> GSM862473 2 0.0000 0.986 0.000 1.000 0.000
#> GSM862474 2 0.0000 0.986 0.000 1.000 0.000
#> GSM862475 2 0.0000 0.986 0.000 1.000 0.000
#> GSM862476 2 0.0000 0.986 0.000 1.000 0.000
#> GSM862477 2 0.0000 0.986 0.000 1.000 0.000
#> GSM862478 3 0.0000 0.951 0.000 0.000 1.000
#> GSM862479 3 0.0000 0.951 0.000 0.000 1.000
#> GSM862480 2 0.0000 0.986 0.000 1.000 0.000
#> GSM862481 2 0.0000 0.986 0.000 1.000 0.000
#> GSM862482 2 0.0000 0.986 0.000 1.000 0.000
#> GSM862483 2 0.0000 0.986 0.000 1.000 0.000
#> GSM862484 2 0.0000 0.986 0.000 1.000 0.000
#> GSM862485 2 0.0237 0.982 0.000 0.996 0.004
#> GSM862486 2 0.0000 0.986 0.000 1.000 0.000
#> GSM862487 2 0.0000 0.986 0.000 1.000 0.000
#> GSM862488 3 0.0000 0.951 0.000 0.000 1.000
#> GSM862489 2 0.0000 0.986 0.000 1.000 0.000
#> GSM862490 2 0.0000 0.986 0.000 1.000 0.000
#> GSM862491 3 0.0000 0.951 0.000 0.000 1.000
#> GSM862492 3 0.0000 0.951 0.000 0.000 1.000
#> GSM862493 2 0.0000 0.986 0.000 1.000 0.000
#> GSM862494 3 0.0000 0.951 0.000 0.000 1.000
#> GSM862495 2 0.0000 0.986 0.000 1.000 0.000
#> GSM862496 2 0.0000 0.986 0.000 1.000 0.000
#> GSM862497 2 0.0000 0.986 0.000 1.000 0.000
#> GSM862498 2 0.0000 0.986 0.000 1.000 0.000
#> GSM862499 3 0.0000 0.951 0.000 0.000 1.000
#> GSM862500 3 0.0000 0.951 0.000 0.000 1.000
#> GSM862501 2 0.0000 0.986 0.000 1.000 0.000
#> GSM862502 2 0.0000 0.986 0.000 1.000 0.000
#> GSM862503 2 0.0000 0.986 0.000 1.000 0.000
#> GSM862504 2 0.0000 0.986 0.000 1.000 0.000
#> GSM862505 2 0.0000 0.986 0.000 1.000 0.000
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> GSM862441 4 0.3942 0.6127 0.236 0.000 0.000 0.764
#> GSM862442 4 0.4331 0.6093 0.288 0.000 0.000 0.712
#> GSM862443 4 0.4331 0.6093 0.288 0.000 0.000 0.712
#> GSM862444 4 0.4331 0.6093 0.288 0.000 0.000 0.712
#> GSM862445 4 0.3801 0.3526 0.220 0.000 0.000 0.780
#> GSM862446 4 0.1389 0.7299 0.048 0.000 0.000 0.952
#> GSM862447 4 0.0000 0.7320 0.000 0.000 0.000 1.000
#> GSM862448 4 0.1389 0.7299 0.048 0.000 0.000 0.952
#> GSM862449 4 0.0000 0.7320 0.000 0.000 0.000 1.000
#> GSM862450 4 0.0000 0.7320 0.000 0.000 0.000 1.000
#> GSM862451 4 0.0592 0.7225 0.016 0.000 0.000 0.984
#> GSM862453 4 0.4331 0.6093 0.288 0.000 0.000 0.712
#> GSM862454 1 0.3975 0.7003 0.760 0.000 0.000 0.240
#> GSM862455 1 0.3975 0.7003 0.760 0.000 0.000 0.240
#> GSM862456 1 0.4992 0.6031 0.524 0.000 0.000 0.476
#> GSM862457 4 0.0000 0.7320 0.000 0.000 0.000 1.000
#> GSM862458 2 0.6685 0.4524 0.000 0.600 0.268 0.132
#> GSM862459 4 0.1474 0.7280 0.052 0.000 0.000 0.948
#> GSM862460 4 0.4331 0.6093 0.288 0.000 0.000 0.712
#> GSM862461 4 0.4331 0.6093 0.288 0.000 0.000 0.712
#> GSM862462 4 0.0000 0.7320 0.000 0.000 0.000 1.000
#> GSM862463 1 0.4992 0.6031 0.524 0.000 0.000 0.476
#> GSM862464 3 0.7380 -0.0784 0.288 0.000 0.512 0.200
#> GSM862465 1 0.4817 0.4825 0.612 0.000 0.000 0.388
#> GSM862466 4 0.1389 0.7299 0.048 0.000 0.000 0.952
#> GSM862467 4 0.4331 0.6093 0.288 0.000 0.000 0.712
#> GSM862468 4 0.0000 0.7320 0.000 0.000 0.000 1.000
#> GSM862469 3 0.0000 0.9334 0.000 0.000 1.000 0.000
#> GSM862470 2 0.0188 0.9193 0.004 0.996 0.000 0.000
#> GSM862471 3 0.0000 0.9334 0.000 0.000 1.000 0.000
#> GSM862472 3 0.2704 0.7971 0.000 0.124 0.876 0.000
#> GSM862473 2 0.0000 0.9193 0.000 1.000 0.000 0.000
#> GSM862474 2 0.3975 0.8159 0.240 0.760 0.000 0.000
#> GSM862475 2 0.0000 0.9193 0.000 1.000 0.000 0.000
#> GSM862476 2 0.3975 0.8159 0.240 0.760 0.000 0.000
#> GSM862477 2 0.4155 0.8132 0.240 0.756 0.000 0.004
#> GSM862478 3 0.0000 0.9334 0.000 0.000 1.000 0.000
#> GSM862479 3 0.0000 0.9334 0.000 0.000 1.000 0.000
#> GSM862480 2 0.0000 0.9193 0.000 1.000 0.000 0.000
#> GSM862481 2 0.0000 0.9193 0.000 1.000 0.000 0.000
#> GSM862482 2 0.3649 0.8368 0.204 0.796 0.000 0.000
#> GSM862483 2 0.4741 0.8037 0.228 0.744 0.000 0.028
#> GSM862484 2 0.3975 0.8159 0.240 0.760 0.000 0.000
#> GSM862485 2 0.0188 0.9174 0.000 0.996 0.004 0.000
#> GSM862486 2 0.0188 0.9193 0.004 0.996 0.000 0.000
#> GSM862487 2 0.0000 0.9193 0.000 1.000 0.000 0.000
#> GSM862488 3 0.0000 0.9334 0.000 0.000 1.000 0.000
#> GSM862489 2 0.0188 0.9193 0.004 0.996 0.000 0.000
#> GSM862490 2 0.0000 0.9193 0.000 1.000 0.000 0.000
#> GSM862491 3 0.0000 0.9334 0.000 0.000 1.000 0.000
#> GSM862492 3 0.0000 0.9334 0.000 0.000 1.000 0.000
#> GSM862493 2 0.3528 0.8427 0.192 0.808 0.000 0.000
#> GSM862494 3 0.0000 0.9334 0.000 0.000 1.000 0.000
#> GSM862495 2 0.0000 0.9193 0.000 1.000 0.000 0.000
#> GSM862496 2 0.0000 0.9193 0.000 1.000 0.000 0.000
#> GSM862497 2 0.0000 0.9193 0.000 1.000 0.000 0.000
#> GSM862498 2 0.0188 0.9193 0.004 0.996 0.000 0.000
#> GSM862499 3 0.0000 0.9334 0.000 0.000 1.000 0.000
#> GSM862500 3 0.0000 0.9334 0.000 0.000 1.000 0.000
#> GSM862501 2 0.0188 0.9193 0.004 0.996 0.000 0.000
#> GSM862502 2 0.0188 0.9193 0.004 0.996 0.000 0.000
#> GSM862503 2 0.0188 0.9193 0.004 0.996 0.000 0.000
#> GSM862504 2 0.3837 0.8237 0.224 0.776 0.000 0.000
#> GSM862505 2 0.0000 0.9193 0.000 1.000 0.000 0.000
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> GSM862441 1 0.4818 0.7492 0.708 0.000 0.000 0.080 0.212
#> GSM862442 1 0.3800 0.7500 0.812 0.000 0.000 0.080 0.108
#> GSM862443 1 0.4501 0.7260 0.756 0.000 0.000 0.128 0.116
#> GSM862444 1 0.4501 0.7260 0.756 0.000 0.000 0.128 0.116
#> GSM862445 5 0.2516 0.5278 0.140 0.000 0.000 0.000 0.860
#> GSM862446 1 0.0000 0.7848 1.000 0.000 0.000 0.000 0.000
#> GSM862447 1 0.2280 0.7561 0.880 0.000 0.000 0.000 0.120
#> GSM862448 1 0.0000 0.7848 1.000 0.000 0.000 0.000 0.000
#> GSM862449 1 0.2280 0.7561 0.880 0.000 0.000 0.000 0.120
#> GSM862450 1 0.3532 0.7449 0.824 0.000 0.000 0.048 0.128
#> GSM862451 1 0.3267 0.7403 0.844 0.000 0.000 0.044 0.112
#> GSM862453 1 0.3800 0.7500 0.812 0.000 0.000 0.080 0.108
#> GSM862454 4 0.2773 0.9074 0.164 0.000 0.000 0.836 0.000
#> GSM862455 4 0.2605 0.8989 0.148 0.000 0.000 0.852 0.000
#> GSM862456 4 0.3452 0.9102 0.244 0.000 0.000 0.756 0.000
#> GSM862457 1 0.2280 0.7561 0.880 0.000 0.000 0.000 0.120
#> GSM862458 2 0.8265 0.1574 0.036 0.476 0.244 0.116 0.128
#> GSM862459 1 0.0703 0.7829 0.976 0.000 0.000 0.000 0.024
#> GSM862460 1 0.4317 0.7348 0.772 0.000 0.000 0.112 0.116
#> GSM862461 1 0.4501 0.7260 0.756 0.000 0.000 0.128 0.116
#> GSM862462 1 0.2280 0.7561 0.880 0.000 0.000 0.000 0.120
#> GSM862463 4 0.3452 0.9102 0.244 0.000 0.000 0.756 0.000
#> GSM862464 3 0.7570 0.1070 0.272 0.000 0.484 0.128 0.116
#> GSM862465 1 0.5998 0.0301 0.464 0.000 0.000 0.424 0.112
#> GSM862466 1 0.0000 0.7848 1.000 0.000 0.000 0.000 0.000
#> GSM862467 1 0.3800 0.7500 0.812 0.000 0.000 0.080 0.108
#> GSM862468 1 0.2280 0.7561 0.880 0.000 0.000 0.000 0.120
#> GSM862469 3 0.1544 0.8973 0.000 0.000 0.932 0.068 0.000
#> GSM862470 2 0.2305 0.8502 0.000 0.896 0.012 0.092 0.000
#> GSM862471 3 0.1544 0.8973 0.000 0.000 0.932 0.068 0.000
#> GSM862472 3 0.3169 0.8232 0.000 0.084 0.856 0.060 0.000
#> GSM862473 2 0.0000 0.9242 0.000 1.000 0.000 0.000 0.000
#> GSM862474 5 0.3395 0.9019 0.000 0.236 0.000 0.000 0.764
#> GSM862475 2 0.0000 0.9242 0.000 1.000 0.000 0.000 0.000
#> GSM862476 5 0.3395 0.9019 0.000 0.236 0.000 0.000 0.764
#> GSM862477 5 0.3877 0.8907 0.024 0.212 0.000 0.000 0.764
#> GSM862478 3 0.0404 0.9045 0.000 0.000 0.988 0.012 0.000
#> GSM862479 3 0.1544 0.8973 0.000 0.000 0.932 0.068 0.000
#> GSM862480 2 0.0000 0.9242 0.000 1.000 0.000 0.000 0.000
#> GSM862481 2 0.0000 0.9242 0.000 1.000 0.000 0.000 0.000
#> GSM862482 2 0.3707 0.4945 0.000 0.716 0.000 0.000 0.284
#> GSM862483 5 0.3565 0.8479 0.000 0.176 0.000 0.024 0.800
#> GSM862484 5 0.3395 0.9019 0.000 0.236 0.000 0.000 0.764
#> GSM862485 2 0.1408 0.8868 0.000 0.948 0.008 0.044 0.000
#> GSM862486 2 0.0000 0.9242 0.000 1.000 0.000 0.000 0.000
#> GSM862487 2 0.0162 0.9224 0.000 0.996 0.004 0.000 0.000
#> GSM862488 3 0.0404 0.9045 0.000 0.000 0.988 0.012 0.000
#> GSM862489 2 0.0000 0.9242 0.000 1.000 0.000 0.000 0.000
#> GSM862490 2 0.0000 0.9242 0.000 1.000 0.000 0.000 0.000
#> GSM862491 3 0.0771 0.9000 0.000 0.020 0.976 0.004 0.000
#> GSM862492 3 0.0404 0.9045 0.000 0.000 0.988 0.012 0.000
#> GSM862493 2 0.3177 0.6645 0.000 0.792 0.000 0.000 0.208
#> GSM862494 3 0.0404 0.9045 0.000 0.000 0.988 0.012 0.000
#> GSM862495 2 0.0000 0.9242 0.000 1.000 0.000 0.000 0.000
#> GSM862496 2 0.0000 0.9242 0.000 1.000 0.000 0.000 0.000
#> GSM862497 2 0.0000 0.9242 0.000 1.000 0.000 0.000 0.000
#> GSM862498 2 0.0162 0.9224 0.000 0.996 0.004 0.000 0.000
#> GSM862499 3 0.1341 0.8999 0.000 0.000 0.944 0.056 0.000
#> GSM862500 3 0.0404 0.9049 0.000 0.000 0.988 0.012 0.000
#> GSM862501 2 0.0963 0.9038 0.000 0.964 0.000 0.036 0.000
#> GSM862502 2 0.1124 0.9025 0.000 0.960 0.004 0.036 0.000
#> GSM862503 2 0.0000 0.9242 0.000 1.000 0.000 0.000 0.000
#> GSM862504 5 0.3508 0.8899 0.000 0.252 0.000 0.000 0.748
#> GSM862505 2 0.0000 0.9242 0.000 1.000 0.000 0.000 0.000
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> GSM862441 4 0.2260 0.7889 0.140 0.000 0.000 0.860 0.000 0.000
#> GSM862442 4 0.3371 0.6480 0.292 0.000 0.000 0.708 0.000 0.000
#> GSM862443 4 0.0146 0.8282 0.004 0.000 0.000 0.996 0.000 0.000
#> GSM862444 4 0.0146 0.8282 0.004 0.000 0.000 0.996 0.000 0.000
#> GSM862445 2 0.1003 0.9507 0.016 0.964 0.000 0.020 0.000 0.000
#> GSM862446 1 0.2300 0.9454 0.856 0.000 0.000 0.144 0.000 0.000
#> GSM862447 1 0.2178 0.9486 0.868 0.000 0.000 0.132 0.000 0.000
#> GSM862448 1 0.2300 0.9454 0.856 0.000 0.000 0.144 0.000 0.000
#> GSM862449 1 0.2178 0.9486 0.868 0.000 0.000 0.132 0.000 0.000
#> GSM862450 1 0.3804 0.4662 0.576 0.000 0.000 0.424 0.000 0.000
#> GSM862451 1 0.2667 0.9341 0.852 0.000 0.000 0.128 0.000 0.020
#> GSM862453 4 0.3371 0.6480 0.292 0.000 0.000 0.708 0.000 0.000
#> GSM862454 6 0.2129 0.9957 0.040 0.000 0.000 0.056 0.000 0.904
#> GSM862455 6 0.2106 0.9870 0.032 0.000 0.000 0.064 0.000 0.904
#> GSM862456 6 0.2129 0.9957 0.040 0.000 0.000 0.056 0.000 0.904
#> GSM862457 1 0.2178 0.9486 0.868 0.000 0.000 0.132 0.000 0.000
#> GSM862458 5 0.7663 0.0145 0.068 0.000 0.244 0.288 0.364 0.036
#> GSM862459 1 0.2340 0.9432 0.852 0.000 0.000 0.148 0.000 0.000
#> GSM862460 4 0.0713 0.8318 0.028 0.000 0.000 0.972 0.000 0.000
#> GSM862461 4 0.0146 0.8282 0.004 0.000 0.000 0.996 0.000 0.000
#> GSM862462 1 0.2178 0.9486 0.868 0.000 0.000 0.132 0.000 0.000
#> GSM862463 6 0.2129 0.9957 0.040 0.000 0.000 0.056 0.000 0.904
#> GSM862464 4 0.0146 0.8245 0.000 0.000 0.004 0.996 0.000 0.000
#> GSM862465 4 0.2712 0.8033 0.088 0.000 0.000 0.864 0.000 0.048
#> GSM862466 1 0.2300 0.9454 0.856 0.000 0.000 0.144 0.000 0.000
#> GSM862467 4 0.3371 0.6480 0.292 0.000 0.000 0.708 0.000 0.000
#> GSM862468 1 0.2178 0.9486 0.868 0.000 0.000 0.132 0.000 0.000
#> GSM862469 3 0.2533 0.9227 0.056 0.000 0.884 0.004 0.000 0.056
#> GSM862470 5 0.3200 0.8389 0.104 0.000 0.012 0.004 0.844 0.036
#> GSM862471 3 0.2533 0.9227 0.056 0.000 0.884 0.004 0.000 0.056
#> GSM862472 3 0.3312 0.8903 0.036 0.000 0.852 0.004 0.052 0.056
#> GSM862473 5 0.0000 0.9242 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM862474 2 0.0000 0.9783 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM862475 5 0.0000 0.9242 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM862476 2 0.0000 0.9783 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM862477 2 0.0146 0.9768 0.000 0.996 0.000 0.000 0.004 0.000
#> GSM862478 3 0.0806 0.9355 0.008 0.000 0.972 0.000 0.000 0.020
#> GSM862479 3 0.2533 0.9227 0.056 0.000 0.884 0.004 0.000 0.056
#> GSM862480 5 0.0000 0.9242 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM862481 5 0.0000 0.9242 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM862482 5 0.3428 0.6092 0.000 0.304 0.000 0.000 0.696 0.000
#> GSM862483 2 0.1010 0.9623 0.036 0.960 0.000 0.000 0.000 0.004
#> GSM862484 2 0.0000 0.9783 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM862485 5 0.1871 0.8857 0.024 0.000 0.016 0.000 0.928 0.032
#> GSM862486 5 0.0000 0.9242 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM862487 5 0.0146 0.9230 0.000 0.000 0.004 0.000 0.996 0.000
#> GSM862488 3 0.0806 0.9355 0.008 0.000 0.972 0.000 0.000 0.020
#> GSM862489 5 0.0000 0.9242 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM862490 5 0.0000 0.9242 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM862491 3 0.1010 0.9262 0.000 0.000 0.960 0.000 0.036 0.004
#> GSM862492 3 0.0622 0.9352 0.008 0.000 0.980 0.000 0.000 0.012
#> GSM862493 5 0.2883 0.7464 0.000 0.212 0.000 0.000 0.788 0.000
#> GSM862494 3 0.0806 0.9355 0.008 0.000 0.972 0.000 0.000 0.020
#> GSM862495 5 0.0000 0.9242 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM862496 5 0.0000 0.9242 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM862497 5 0.0000 0.9242 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM862498 5 0.0146 0.9230 0.000 0.000 0.004 0.000 0.996 0.000
#> GSM862499 3 0.1856 0.9310 0.032 0.000 0.920 0.000 0.000 0.048
#> GSM862500 3 0.0622 0.9365 0.012 0.000 0.980 0.000 0.000 0.008
#> GSM862501 5 0.1926 0.8831 0.068 0.000 0.000 0.000 0.912 0.020
#> GSM862502 5 0.2069 0.8817 0.068 0.000 0.004 0.000 0.908 0.020
#> GSM862503 5 0.0000 0.9242 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM862504 2 0.0713 0.9582 0.000 0.972 0.000 0.000 0.028 0.000
#> GSM862505 5 0.0146 0.9232 0.004 0.000 0.000 0.000 0.996 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 tissue(p) k
#> MAD:pam 64 6.95e-14 2
#> MAD:pam 62 3.44e-14 3
#> MAD:pam 60 5.88e-13 4
#> MAD:pam 60 1.63e-11 5
#> MAD:pam 62 2.55e-11 6
If matrix rows can be associated to genes, consider to use functional_enrichment(res,
...)
to perform function enrichment for the signature genes. See this vignette for more detailed explanations.
The object with results only for a single top-value method and a single partition method can be extracted as:
res = res_list["MAD", "mclust"]
# you can also extract it by
# res = res_list["MAD:mclust"]
A summary of res
and all the functions that can be applied to it:
res
#> A 'ConsensusPartition' object with k = 2, 3, 4, 5, 6.
#> On a matrix with 51941 rows and 64 columns.
#> Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'MAD' method.
#> Subgroups are detected by 'mclust' method.
#> Performed in total 1250 partitions by row resampling.
#> Best k for subgroups seems to be 2.
#>
#> Following methods can be applied to this 'ConsensusPartition' object:
#> [1] "cola_report" "collect_classes" "collect_plots"
#> [4] "collect_stats" "colnames" "compare_signatures"
#> [7] "consensus_heatmap" "dimension_reduction" "functional_enrichment"
#> [10] "get_anno_col" "get_anno" "get_classes"
#> [13] "get_consensus" "get_matrix" "get_membership"
#> [16] "get_param" "get_signatures" "get_stats"
#> [19] "is_best_k" "is_stable_k" "membership_heatmap"
#> [22] "ncol" "nrow" "plot_ecdf"
#> [25] "rownames" "select_partition_number" "show"
#> [28] "suggest_best_k" "test_to_known_factors"
collect_plots()
function collects all the plots made from res
for all k
(number of partitions)
into one single page to provide an easy and fast comparison between different k
.
collect_plots(res)
The plots are:
k
and the heatmap of
predicted classes for each k
.k
.k
.k
.All the plots in panels can be made by individual functions and they are plotted later in this section.
select_partition_number()
produces several plots showing different
statistics for choosing “optimized” k
. There are following statistics:
k
;k
, the area increased is defined as \(A_k - A_{k-1}\).The detailed explanations of these statistics can be found in the cola vignette.
Generally speaking, lower PAC score, higher mean silhouette score or higher
concordance corresponds to better partition. Rand index and Jaccard index
measure how similar the current partition is compared to partition with k-1
.
If they are too similar, we won't accept k
is better than k-1
.
select_partition_number(res)
The numeric values for all these statistics can be obtained by get_stats()
.
get_stats(res)
#> k 1-PAC mean_silhouette concordance area_increased Rand Jaccard
#> 2 2 1.000 0.975 0.991 0.4985 0.504 0.504
#> 3 3 0.705 0.892 0.851 0.2679 0.820 0.653
#> 4 4 0.743 0.855 0.874 0.1002 0.962 0.893
#> 5 5 0.748 0.826 0.832 0.0995 0.915 0.730
#> 6 6 0.692 0.660 0.778 0.0531 0.925 0.702
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
#> GSM862441 1 0.000 1.000 1.00 0.00
#> GSM862442 1 0.000 1.000 1.00 0.00
#> GSM862443 1 0.000 1.000 1.00 0.00
#> GSM862444 1 0.000 1.000 1.00 0.00
#> GSM862445 1 0.000 1.000 1.00 0.00
#> GSM862446 1 0.000 1.000 1.00 0.00
#> GSM862447 1 0.000 1.000 1.00 0.00
#> GSM862448 1 0.000 1.000 1.00 0.00
#> GSM862449 1 0.000 1.000 1.00 0.00
#> GSM862450 1 0.000 1.000 1.00 0.00
#> GSM862451 1 0.000 1.000 1.00 0.00
#> GSM862453 1 0.000 1.000 1.00 0.00
#> GSM862454 1 0.000 1.000 1.00 0.00
#> GSM862455 1 0.000 1.000 1.00 0.00
#> GSM862456 1 0.000 1.000 1.00 0.00
#> GSM862457 1 0.000 1.000 1.00 0.00
#> GSM862458 1 0.000 1.000 1.00 0.00
#> GSM862459 1 0.000 1.000 1.00 0.00
#> GSM862460 1 0.000 1.000 1.00 0.00
#> GSM862461 1 0.000 1.000 1.00 0.00
#> GSM862462 1 0.000 1.000 1.00 0.00
#> GSM862463 1 0.000 1.000 1.00 0.00
#> GSM862464 1 0.000 1.000 1.00 0.00
#> GSM862465 1 0.000 1.000 1.00 0.00
#> GSM862466 1 0.000 1.000 1.00 0.00
#> GSM862467 1 0.000 1.000 1.00 0.00
#> GSM862468 1 0.000 1.000 1.00 0.00
#> GSM862469 2 0.000 0.984 0.00 1.00
#> GSM862470 2 0.000 0.984 0.00 1.00
#> GSM862471 2 0.000 0.984 0.00 1.00
#> GSM862472 2 0.000 0.984 0.00 1.00
#> GSM862473 2 0.000 0.984 0.00 1.00
#> GSM862474 2 0.000 0.984 0.00 1.00
#> GSM862475 2 0.000 0.984 0.00 1.00
#> GSM862476 2 0.000 0.984 0.00 1.00
#> GSM862477 2 0.000 0.984 0.00 1.00
#> GSM862478 2 0.000 0.984 0.00 1.00
#> GSM862479 2 0.000 0.984 0.00 1.00
#> GSM862480 2 0.000 0.984 0.00 1.00
#> GSM862481 2 0.000 0.984 0.00 1.00
#> GSM862482 2 0.469 0.880 0.10 0.90
#> GSM862483 2 0.999 0.085 0.48 0.52
#> GSM862484 2 0.000 0.984 0.00 1.00
#> GSM862485 2 0.000 0.984 0.00 1.00
#> GSM862486 2 0.000 0.984 0.00 1.00
#> GSM862487 2 0.000 0.984 0.00 1.00
#> GSM862488 2 0.000 0.984 0.00 1.00
#> GSM862489 2 0.000 0.984 0.00 1.00
#> GSM862490 2 0.000 0.984 0.00 1.00
#> GSM862491 2 0.000 0.984 0.00 1.00
#> GSM862492 2 0.000 0.984 0.00 1.00
#> GSM862493 2 0.000 0.984 0.00 1.00
#> GSM862494 2 0.000 0.984 0.00 1.00
#> GSM862495 2 0.000 0.984 0.00 1.00
#> GSM862496 2 0.000 0.984 0.00 1.00
#> GSM862497 2 0.000 0.984 0.00 1.00
#> GSM862498 2 0.000 0.984 0.00 1.00
#> GSM862499 2 0.000 0.984 0.00 1.00
#> GSM862500 2 0.000 0.984 0.00 1.00
#> GSM862501 2 0.000 0.984 0.00 1.00
#> GSM862502 2 0.000 0.984 0.00 1.00
#> GSM862503 2 0.000 0.984 0.00 1.00
#> GSM862504 2 0.000 0.984 0.00 1.00
#> GSM862505 2 0.000 0.984 0.00 1.00
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> GSM862441 1 0.2537 0.929 0.920 0.000 0.080
#> GSM862442 1 0.4002 0.901 0.840 0.000 0.160
#> GSM862443 1 0.4178 0.899 0.828 0.000 0.172
#> GSM862444 1 0.3038 0.922 0.896 0.000 0.104
#> GSM862445 1 0.1860 0.935 0.948 0.000 0.052
#> GSM862446 1 0.1163 0.934 0.972 0.000 0.028
#> GSM862447 1 0.1753 0.934 0.952 0.000 0.048
#> GSM862448 1 0.1289 0.935 0.968 0.000 0.032
#> GSM862449 1 0.2356 0.930 0.928 0.000 0.072
#> GSM862450 1 0.4235 0.899 0.824 0.000 0.176
#> GSM862451 1 0.1529 0.929 0.960 0.000 0.040
#> GSM862453 1 0.1529 0.929 0.960 0.000 0.040
#> GSM862454 1 0.1411 0.930 0.964 0.000 0.036
#> GSM862455 1 0.2356 0.932 0.928 0.000 0.072
#> GSM862456 1 0.1643 0.931 0.956 0.000 0.044
#> GSM862457 1 0.1163 0.936 0.972 0.000 0.028
#> GSM862458 1 0.4702 0.877 0.788 0.000 0.212
#> GSM862459 1 0.1643 0.928 0.956 0.000 0.044
#> GSM862460 1 0.4002 0.901 0.840 0.000 0.160
#> GSM862461 1 0.4178 0.899 0.828 0.000 0.172
#> GSM862462 1 0.1031 0.935 0.976 0.000 0.024
#> GSM862463 1 0.1411 0.932 0.964 0.000 0.036
#> GSM862464 1 0.4178 0.899 0.828 0.000 0.172
#> GSM862465 1 0.1643 0.928 0.956 0.000 0.044
#> GSM862466 1 0.0892 0.936 0.980 0.000 0.020
#> GSM862467 1 0.0424 0.934 0.992 0.000 0.008
#> GSM862468 1 0.2165 0.934 0.936 0.000 0.064
#> GSM862469 3 0.5216 0.988 0.000 0.260 0.740
#> GSM862470 2 0.1289 0.843 0.000 0.968 0.032
#> GSM862471 3 0.5216 0.988 0.000 0.260 0.740
#> GSM862472 3 0.5254 0.984 0.000 0.264 0.736
#> GSM862473 2 0.5216 0.649 0.000 0.740 0.260
#> GSM862474 2 0.0592 0.848 0.000 0.988 0.012
#> GSM862475 2 0.3879 0.843 0.000 0.848 0.152
#> GSM862476 2 0.0592 0.848 0.000 0.988 0.012
#> GSM862477 2 0.0747 0.854 0.000 0.984 0.016
#> GSM862478 3 0.5178 0.987 0.000 0.256 0.744
#> GSM862479 3 0.5216 0.988 0.000 0.260 0.740
#> GSM862480 2 0.3412 0.856 0.000 0.876 0.124
#> GSM862481 2 0.5138 0.667 0.000 0.748 0.252
#> GSM862482 2 0.8318 0.442 0.284 0.600 0.116
#> GSM862483 1 0.8219 0.601 0.640 0.180 0.180
#> GSM862484 2 0.0592 0.848 0.000 0.988 0.012
#> GSM862485 3 0.5216 0.988 0.000 0.260 0.740
#> GSM862486 2 0.4002 0.844 0.000 0.840 0.160
#> GSM862487 3 0.5397 0.951 0.000 0.280 0.720
#> GSM862488 3 0.5178 0.987 0.000 0.256 0.744
#> GSM862489 2 0.2066 0.867 0.000 0.940 0.060
#> GSM862490 2 0.3879 0.849 0.000 0.848 0.152
#> GSM862491 3 0.5216 0.988 0.000 0.260 0.740
#> GSM862492 3 0.5397 0.951 0.000 0.280 0.720
#> GSM862493 2 0.0747 0.854 0.000 0.984 0.016
#> GSM862494 3 0.5178 0.987 0.000 0.256 0.744
#> GSM862495 2 0.3816 0.842 0.000 0.852 0.148
#> GSM862496 2 0.3482 0.858 0.000 0.872 0.128
#> GSM862497 2 0.3482 0.858 0.000 0.872 0.128
#> GSM862498 2 0.1411 0.864 0.000 0.964 0.036
#> GSM862499 3 0.5178 0.987 0.000 0.256 0.744
#> GSM862500 3 0.5178 0.987 0.000 0.256 0.744
#> GSM862501 2 0.3752 0.851 0.000 0.856 0.144
#> GSM862502 2 0.3038 0.866 0.000 0.896 0.104
#> GSM862503 2 0.0747 0.861 0.000 0.984 0.016
#> GSM862504 2 0.0747 0.861 0.000 0.984 0.016
#> GSM862505 2 0.3412 0.858 0.000 0.876 0.124
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> GSM862441 1 0.2222 0.918 0.924 0.000 0.016 0.060
#> GSM862442 1 0.3768 0.879 0.808 0.000 0.008 0.184
#> GSM862443 1 0.3569 0.870 0.804 0.000 0.000 0.196
#> GSM862444 1 0.3208 0.888 0.848 0.000 0.004 0.148
#> GSM862445 1 0.1042 0.924 0.972 0.008 0.020 0.000
#> GSM862446 1 0.0895 0.924 0.976 0.004 0.020 0.000
#> GSM862447 1 0.1520 0.923 0.956 0.000 0.020 0.024
#> GSM862448 1 0.1004 0.925 0.972 0.000 0.004 0.024
#> GSM862449 1 0.2111 0.920 0.932 0.000 0.024 0.044
#> GSM862450 1 0.3649 0.869 0.796 0.000 0.000 0.204
#> GSM862451 1 0.1256 0.923 0.964 0.000 0.008 0.028
#> GSM862453 1 0.1256 0.923 0.964 0.000 0.008 0.028
#> GSM862454 1 0.1256 0.923 0.964 0.000 0.008 0.028
#> GSM862455 1 0.1890 0.922 0.936 0.000 0.008 0.056
#> GSM862456 1 0.1256 0.923 0.964 0.000 0.008 0.028
#> GSM862457 1 0.1174 0.923 0.968 0.000 0.020 0.012
#> GSM862458 1 0.5224 0.845 0.760 0.020 0.040 0.180
#> GSM862459 1 0.0804 0.925 0.980 0.000 0.008 0.012
#> GSM862460 1 0.3751 0.875 0.800 0.000 0.004 0.196
#> GSM862461 1 0.3726 0.868 0.788 0.000 0.000 0.212
#> GSM862462 1 0.0937 0.923 0.976 0.000 0.012 0.012
#> GSM862463 1 0.1256 0.923 0.964 0.000 0.008 0.028
#> GSM862464 1 0.3569 0.868 0.804 0.000 0.000 0.196
#> GSM862465 1 0.0672 0.924 0.984 0.000 0.008 0.008
#> GSM862466 1 0.1356 0.925 0.960 0.000 0.008 0.032
#> GSM862467 1 0.1297 0.925 0.964 0.000 0.020 0.016
#> GSM862468 1 0.1256 0.924 0.964 0.000 0.008 0.028
#> GSM862469 3 0.1302 0.973 0.000 0.044 0.956 0.000
#> GSM862470 2 0.2867 0.753 0.000 0.884 0.012 0.104
#> GSM862471 3 0.1302 0.973 0.000 0.044 0.956 0.000
#> GSM862472 3 0.1938 0.965 0.000 0.052 0.936 0.012
#> GSM862473 2 0.6499 0.392 0.000 0.612 0.276 0.112
#> GSM862474 2 0.4100 0.755 0.000 0.816 0.036 0.148
#> GSM862475 2 0.3464 0.744 0.000 0.860 0.108 0.032
#> GSM862476 2 0.4100 0.755 0.000 0.816 0.036 0.148
#> GSM862477 2 0.3149 0.774 0.000 0.880 0.032 0.088
#> GSM862478 3 0.1118 0.973 0.000 0.036 0.964 0.000
#> GSM862479 3 0.1302 0.973 0.000 0.044 0.956 0.000
#> GSM862480 2 0.5058 0.661 0.000 0.768 0.104 0.128
#> GSM862481 2 0.5947 0.542 0.000 0.688 0.200 0.112
#> GSM862482 2 0.4522 0.634 0.108 0.824 0.044 0.024
#> GSM862483 1 0.6111 0.623 0.688 0.232 0.056 0.024
#> GSM862484 2 0.4050 0.756 0.000 0.820 0.036 0.144
#> GSM862485 3 0.1389 0.971 0.000 0.048 0.952 0.000
#> GSM862486 2 0.1854 0.775 0.000 0.940 0.048 0.012
#> GSM862487 3 0.3168 0.918 0.000 0.056 0.884 0.060
#> GSM862488 3 0.1118 0.973 0.000 0.036 0.964 0.000
#> GSM862489 2 0.1978 0.780 0.000 0.928 0.068 0.004
#> GSM862490 2 0.1677 0.769 0.000 0.948 0.040 0.012
#> GSM862491 3 0.2759 0.937 0.000 0.052 0.904 0.044
#> GSM862492 3 0.3168 0.918 0.000 0.056 0.884 0.060
#> GSM862493 2 0.3333 0.775 0.000 0.872 0.040 0.088
#> GSM862494 3 0.1118 0.973 0.000 0.036 0.964 0.000
#> GSM862495 4 0.6578 0.902 0.000 0.300 0.108 0.592
#> GSM862496 4 0.6274 0.895 0.000 0.292 0.088 0.620
#> GSM862497 2 0.5051 0.660 0.000 0.768 0.100 0.132
#> GSM862498 2 0.2149 0.780 0.000 0.912 0.088 0.000
#> GSM862499 3 0.1118 0.973 0.000 0.036 0.964 0.000
#> GSM862500 3 0.1118 0.973 0.000 0.036 0.964 0.000
#> GSM862501 2 0.2319 0.757 0.000 0.924 0.040 0.036
#> GSM862502 4 0.6079 0.807 0.000 0.408 0.048 0.544
#> GSM862503 2 0.2670 0.771 0.000 0.904 0.072 0.024
#> GSM862504 2 0.3818 0.781 0.000 0.844 0.048 0.108
#> GSM862505 4 0.6240 0.907 0.000 0.320 0.076 0.604
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> GSM862441 4 0.1484 0.888 0.048 0.000 0.000 0.944 0.008
#> GSM862442 1 0.4165 0.851 0.672 0.000 0.000 0.320 0.008
#> GSM862443 4 0.1648 0.881 0.040 0.000 0.000 0.940 0.020
#> GSM862444 4 0.1597 0.887 0.048 0.000 0.000 0.940 0.012
#> GSM862445 4 0.0898 0.891 0.020 0.000 0.000 0.972 0.008
#> GSM862446 4 0.0703 0.890 0.024 0.000 0.000 0.976 0.000
#> GSM862447 4 0.0609 0.889 0.020 0.000 0.000 0.980 0.000
#> GSM862448 4 0.2068 0.835 0.092 0.000 0.000 0.904 0.004
#> GSM862449 4 0.1364 0.886 0.036 0.000 0.000 0.952 0.012
#> GSM862450 4 0.1978 0.876 0.024 0.000 0.004 0.928 0.044
#> GSM862451 4 0.3635 0.588 0.248 0.000 0.000 0.748 0.004
#> GSM862453 1 0.3913 0.863 0.676 0.000 0.000 0.324 0.000
#> GSM862454 1 0.3048 0.827 0.820 0.000 0.000 0.176 0.004
#> GSM862455 1 0.3814 0.865 0.720 0.000 0.000 0.276 0.004
#> GSM862456 1 0.3048 0.827 0.820 0.000 0.000 0.176 0.004
#> GSM862457 4 0.0579 0.892 0.008 0.000 0.000 0.984 0.008
#> GSM862458 4 0.4750 0.705 0.052 0.000 0.112 0.776 0.060
#> GSM862459 4 0.1831 0.862 0.076 0.000 0.000 0.920 0.004
#> GSM862460 1 0.4283 0.828 0.644 0.000 0.000 0.348 0.008
#> GSM862461 1 0.4444 0.804 0.624 0.000 0.000 0.364 0.012
#> GSM862462 4 0.0290 0.892 0.008 0.000 0.000 0.992 0.000
#> GSM862463 1 0.3177 0.835 0.792 0.000 0.000 0.208 0.000
#> GSM862464 4 0.1741 0.880 0.040 0.000 0.000 0.936 0.024
#> GSM862465 4 0.1952 0.861 0.084 0.000 0.000 0.912 0.004
#> GSM862466 4 0.1410 0.870 0.060 0.000 0.000 0.940 0.000
#> GSM862467 1 0.4030 0.852 0.648 0.000 0.000 0.352 0.000
#> GSM862468 4 0.0609 0.890 0.020 0.000 0.000 0.980 0.000
#> GSM862469 3 0.0162 0.943 0.004 0.000 0.996 0.000 0.000
#> GSM862470 2 0.2464 0.794 0.012 0.892 0.004 0.000 0.092
#> GSM862471 3 0.0000 0.944 0.000 0.000 1.000 0.000 0.000
#> GSM862472 3 0.1892 0.906 0.000 0.004 0.916 0.000 0.080
#> GSM862473 2 0.4810 0.616 0.000 0.712 0.084 0.000 0.204
#> GSM862474 2 0.4038 0.746 0.080 0.792 0.000 0.000 0.128
#> GSM862475 2 0.2569 0.783 0.000 0.892 0.040 0.000 0.068
#> GSM862476 2 0.4038 0.746 0.080 0.792 0.000 0.000 0.128
#> GSM862477 2 0.2304 0.787 0.008 0.892 0.000 0.000 0.100
#> GSM862478 3 0.0162 0.945 0.000 0.000 0.996 0.000 0.004
#> GSM862479 3 0.0451 0.939 0.004 0.000 0.988 0.000 0.008
#> GSM862480 2 0.4250 0.623 0.000 0.720 0.028 0.000 0.252
#> GSM862481 2 0.4525 0.633 0.000 0.724 0.056 0.000 0.220
#> GSM862482 2 0.4615 0.740 0.028 0.808 0.040 0.048 0.076
#> GSM862483 4 0.6249 0.502 0.052 0.204 0.032 0.664 0.048
#> GSM862484 2 0.4038 0.746 0.080 0.792 0.000 0.000 0.128
#> GSM862485 3 0.0451 0.942 0.000 0.004 0.988 0.000 0.008
#> GSM862486 2 0.1756 0.802 0.008 0.940 0.036 0.000 0.016
#> GSM862487 3 0.3692 0.813 0.000 0.052 0.812 0.000 0.136
#> GSM862488 3 0.0162 0.945 0.000 0.000 0.996 0.000 0.004
#> GSM862489 2 0.0771 0.807 0.000 0.976 0.020 0.000 0.004
#> GSM862490 2 0.2171 0.800 0.012 0.928 0.032 0.008 0.020
#> GSM862491 3 0.3477 0.825 0.000 0.040 0.824 0.000 0.136
#> GSM862492 3 0.3130 0.857 0.000 0.048 0.856 0.000 0.096
#> GSM862493 2 0.2020 0.788 0.000 0.900 0.000 0.000 0.100
#> GSM862494 3 0.0162 0.945 0.000 0.000 0.996 0.000 0.004
#> GSM862495 5 0.3988 0.887 0.000 0.196 0.036 0.000 0.768
#> GSM862496 5 0.3492 0.864 0.000 0.188 0.016 0.000 0.796
#> GSM862497 2 0.4442 0.567 0.000 0.688 0.028 0.000 0.284
#> GSM862498 2 0.0898 0.807 0.000 0.972 0.020 0.000 0.008
#> GSM862499 3 0.0162 0.945 0.000 0.000 0.996 0.000 0.004
#> GSM862500 3 0.0162 0.945 0.000 0.000 0.996 0.000 0.004
#> GSM862501 2 0.2498 0.794 0.016 0.912 0.036 0.004 0.032
#> GSM862502 5 0.4742 0.781 0.012 0.344 0.012 0.000 0.632
#> GSM862503 2 0.1485 0.799 0.000 0.948 0.020 0.000 0.032
#> GSM862504 2 0.3869 0.779 0.080 0.824 0.012 0.000 0.084
#> GSM862505 5 0.3916 0.889 0.000 0.256 0.012 0.000 0.732
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> GSM862441 1 0.2432 0.7962 0.876 0.000 0.000 0.024 0.000 0.100
#> GSM862442 6 0.4404 0.6027 0.164 0.000 0.000 0.088 0.012 0.736
#> GSM862443 4 0.5758 0.7841 0.316 0.000 0.000 0.536 0.016 0.132
#> GSM862444 4 0.5483 0.7325 0.432 0.000 0.000 0.464 0.008 0.096
#> GSM862445 1 0.2307 0.8091 0.896 0.000 0.000 0.032 0.004 0.068
#> GSM862446 1 0.1732 0.8365 0.920 0.000 0.000 0.004 0.004 0.072
#> GSM862447 1 0.1116 0.8254 0.960 0.000 0.000 0.004 0.008 0.028
#> GSM862448 1 0.2062 0.8043 0.900 0.000 0.000 0.004 0.008 0.088
#> GSM862449 1 0.1605 0.8058 0.940 0.000 0.000 0.032 0.012 0.016
#> GSM862450 4 0.4887 0.6764 0.472 0.000 0.000 0.476 0.004 0.048
#> GSM862451 6 0.3868 -0.0718 0.492 0.000 0.000 0.000 0.000 0.508
#> GSM862453 6 0.2378 0.7212 0.152 0.000 0.000 0.000 0.000 0.848
#> GSM862454 6 0.1957 0.7187 0.112 0.000 0.000 0.000 0.000 0.888
#> GSM862455 6 0.2257 0.7113 0.116 0.000 0.000 0.008 0.000 0.876
#> GSM862456 6 0.1957 0.7187 0.112 0.000 0.000 0.000 0.000 0.888
#> GSM862457 1 0.0777 0.8380 0.972 0.000 0.000 0.000 0.004 0.024
#> GSM862458 3 0.6839 0.0220 0.316 0.000 0.476 0.104 0.012 0.092
#> GSM862459 1 0.3383 0.6258 0.728 0.000 0.000 0.004 0.000 0.268
#> GSM862460 6 0.6153 -0.3009 0.192 0.000 0.000 0.380 0.012 0.416
#> GSM862461 4 0.6043 0.4948 0.208 0.000 0.000 0.500 0.012 0.280
#> GSM862462 1 0.1501 0.8275 0.924 0.000 0.000 0.000 0.000 0.076
#> GSM862463 6 0.2191 0.7170 0.120 0.000 0.000 0.004 0.000 0.876
#> GSM862464 4 0.5398 0.7856 0.360 0.000 0.000 0.544 0.016 0.080
#> GSM862465 1 0.3244 0.6171 0.732 0.000 0.000 0.000 0.000 0.268
#> GSM862466 1 0.2165 0.7967 0.884 0.000 0.000 0.000 0.008 0.108
#> GSM862467 6 0.3835 0.5250 0.336 0.000 0.000 0.004 0.004 0.656
#> GSM862468 1 0.0935 0.8338 0.964 0.000 0.000 0.004 0.000 0.032
#> GSM862469 3 0.0363 0.8797 0.000 0.000 0.988 0.000 0.000 0.012
#> GSM862470 2 0.3756 0.6285 0.000 0.736 0.000 0.240 0.016 0.008
#> GSM862471 3 0.0000 0.8806 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM862472 3 0.2416 0.8243 0.000 0.000 0.844 0.000 0.156 0.000
#> GSM862473 2 0.5389 0.3240 0.000 0.572 0.160 0.000 0.268 0.000
#> GSM862474 2 0.4015 0.5924 0.000 0.616 0.000 0.372 0.012 0.000
#> GSM862475 2 0.1500 0.6444 0.000 0.936 0.012 0.000 0.052 0.000
#> GSM862476 2 0.4015 0.5924 0.000 0.616 0.000 0.372 0.012 0.000
#> GSM862477 2 0.3404 0.6278 0.000 0.744 0.000 0.248 0.004 0.004
#> GSM862478 3 0.0363 0.8843 0.000 0.000 0.988 0.000 0.012 0.000
#> GSM862479 3 0.0363 0.8797 0.000 0.000 0.988 0.000 0.000 0.012
#> GSM862480 2 0.3426 0.4828 0.000 0.720 0.004 0.000 0.276 0.000
#> GSM862481 2 0.3564 0.4943 0.000 0.724 0.012 0.000 0.264 0.000
#> GSM862482 2 0.3774 0.6174 0.036 0.828 0.004 0.008 0.044 0.080
#> GSM862483 2 0.6692 0.2935 0.312 0.520 0.004 0.060 0.040 0.064
#> GSM862484 2 0.4015 0.5924 0.000 0.616 0.000 0.372 0.012 0.000
#> GSM862485 3 0.1285 0.8713 0.000 0.000 0.944 0.000 0.052 0.004
#> GSM862486 2 0.1149 0.6485 0.000 0.960 0.008 0.000 0.024 0.008
#> GSM862487 3 0.3766 0.7484 0.000 0.040 0.748 0.000 0.212 0.000
#> GSM862488 3 0.0363 0.8843 0.000 0.000 0.988 0.000 0.012 0.000
#> GSM862489 2 0.0260 0.6545 0.000 0.992 0.000 0.000 0.008 0.000
#> GSM862490 2 0.1294 0.6484 0.000 0.956 0.008 0.004 0.024 0.008
#> GSM862491 3 0.3403 0.7681 0.000 0.020 0.768 0.000 0.212 0.000
#> GSM862492 3 0.3385 0.7874 0.000 0.032 0.788 0.000 0.180 0.000
#> GSM862493 2 0.3265 0.6279 0.000 0.748 0.000 0.248 0.004 0.000
#> GSM862494 3 0.0363 0.8843 0.000 0.000 0.988 0.000 0.012 0.000
#> GSM862495 5 0.2821 0.8597 0.000 0.152 0.016 0.000 0.832 0.000
#> GSM862496 5 0.2092 0.8190 0.000 0.124 0.000 0.000 0.876 0.000
#> GSM862497 2 0.3742 0.3531 0.000 0.648 0.004 0.000 0.348 0.000
#> GSM862498 2 0.0260 0.6545 0.000 0.992 0.000 0.000 0.008 0.000
#> GSM862499 3 0.0363 0.8843 0.000 0.000 0.988 0.000 0.012 0.000
#> GSM862500 3 0.0363 0.8843 0.000 0.000 0.988 0.000 0.012 0.000
#> GSM862501 2 0.3957 0.2863 0.000 0.712 0.008 0.000 0.260 0.020
#> GSM862502 5 0.3672 0.7189 0.000 0.304 0.000 0.000 0.688 0.008
#> GSM862503 2 0.3175 0.2795 0.000 0.744 0.000 0.000 0.256 0.000
#> GSM862504 2 0.3912 0.6074 0.000 0.648 0.000 0.340 0.012 0.000
#> GSM862505 5 0.2912 0.8566 0.000 0.216 0.000 0.000 0.784 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 tissue(p) k
#> MAD:mclust 63 1.59e-14 2
#> MAD:mclust 63 1.50e-13 3
#> MAD:mclust 63 9.32e-13 4
#> MAD:mclust 64 2.74e-12 5
#> MAD:mclust 53 3.36e-10 6
If matrix rows can be associated to genes, consider to use functional_enrichment(res,
...)
to perform function enrichment for the signature genes. See this vignette for more detailed explanations.
The object with results only for a single top-value method and a single partition method can be extracted as:
res = res_list["MAD", "NMF"]
# you can also extract it by
# res = res_list["MAD:NMF"]
A summary of res
and all the functions that can be applied to it:
res
#> A 'ConsensusPartition' object with k = 2, 3, 4, 5, 6.
#> On a matrix with 51941 rows and 64 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.983 0.992 0.4904 0.510 0.510
#> 3 3 0.931 0.898 0.960 0.3623 0.800 0.616
#> 4 4 0.850 0.858 0.919 0.1051 0.866 0.628
#> 5 5 0.869 0.838 0.922 0.0498 0.951 0.815
#> 6 6 0.845 0.787 0.886 0.0281 0.959 0.831
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
#> GSM862441 1 0.000 0.991 1.000 0.000
#> GSM862442 1 0.000 0.991 1.000 0.000
#> GSM862443 1 0.000 0.991 1.000 0.000
#> GSM862444 1 0.000 0.991 1.000 0.000
#> GSM862445 1 0.781 0.693 0.768 0.232
#> GSM862446 1 0.000 0.991 1.000 0.000
#> GSM862447 1 0.000 0.991 1.000 0.000
#> GSM862448 1 0.000 0.991 1.000 0.000
#> GSM862449 1 0.000 0.991 1.000 0.000
#> GSM862450 1 0.000 0.991 1.000 0.000
#> GSM862451 1 0.000 0.991 1.000 0.000
#> GSM862453 1 0.000 0.991 1.000 0.000
#> GSM862454 1 0.000 0.991 1.000 0.000
#> GSM862455 1 0.000 0.991 1.000 0.000
#> GSM862456 1 0.000 0.991 1.000 0.000
#> GSM862457 1 0.000 0.991 1.000 0.000
#> GSM862458 2 0.529 0.865 0.120 0.880
#> GSM862459 1 0.000 0.991 1.000 0.000
#> GSM862460 1 0.000 0.991 1.000 0.000
#> GSM862461 1 0.000 0.991 1.000 0.000
#> GSM862462 1 0.000 0.991 1.000 0.000
#> GSM862463 1 0.000 0.991 1.000 0.000
#> GSM862464 1 0.000 0.991 1.000 0.000
#> GSM862465 1 0.000 0.991 1.000 0.000
#> GSM862466 1 0.000 0.991 1.000 0.000
#> GSM862467 1 0.000 0.991 1.000 0.000
#> GSM862468 1 0.000 0.991 1.000 0.000
#> GSM862469 2 0.000 0.993 0.000 1.000
#> GSM862470 2 0.000 0.993 0.000 1.000
#> GSM862471 2 0.000 0.993 0.000 1.000
#> GSM862472 2 0.000 0.993 0.000 1.000
#> GSM862473 2 0.000 0.993 0.000 1.000
#> GSM862474 2 0.000 0.993 0.000 1.000
#> GSM862475 2 0.000 0.993 0.000 1.000
#> GSM862476 2 0.000 0.993 0.000 1.000
#> GSM862477 2 0.000 0.993 0.000 1.000
#> GSM862478 2 0.000 0.993 0.000 1.000
#> GSM862479 2 0.000 0.993 0.000 1.000
#> GSM862480 2 0.000 0.993 0.000 1.000
#> GSM862481 2 0.000 0.993 0.000 1.000
#> GSM862482 2 0.000 0.993 0.000 1.000
#> GSM862483 2 0.584 0.839 0.140 0.860
#> GSM862484 2 0.000 0.993 0.000 1.000
#> GSM862485 2 0.000 0.993 0.000 1.000
#> GSM862486 2 0.000 0.993 0.000 1.000
#> GSM862487 2 0.000 0.993 0.000 1.000
#> GSM862488 2 0.000 0.993 0.000 1.000
#> GSM862489 2 0.000 0.993 0.000 1.000
#> GSM862490 2 0.000 0.993 0.000 1.000
#> GSM862491 2 0.000 0.993 0.000 1.000
#> GSM862492 2 0.000 0.993 0.000 1.000
#> GSM862493 2 0.000 0.993 0.000 1.000
#> GSM862494 2 0.000 0.993 0.000 1.000
#> GSM862495 2 0.000 0.993 0.000 1.000
#> GSM862496 2 0.000 0.993 0.000 1.000
#> GSM862497 2 0.000 0.993 0.000 1.000
#> GSM862498 2 0.000 0.993 0.000 1.000
#> GSM862499 2 0.000 0.993 0.000 1.000
#> GSM862500 2 0.000 0.993 0.000 1.000
#> GSM862501 2 0.000 0.993 0.000 1.000
#> GSM862502 2 0.000 0.993 0.000 1.000
#> GSM862503 2 0.000 0.993 0.000 1.000
#> GSM862504 2 0.000 0.993 0.000 1.000
#> GSM862505 2 0.000 0.993 0.000 1.000
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> GSM862441 1 0.0000 0.9798 1.000 0.000 0.000
#> GSM862442 1 0.0000 0.9798 1.000 0.000 0.000
#> GSM862443 1 0.0592 0.9699 0.988 0.000 0.012
#> GSM862444 1 0.0000 0.9798 1.000 0.000 0.000
#> GSM862445 2 0.6302 0.0536 0.480 0.520 0.000
#> GSM862446 1 0.0000 0.9798 1.000 0.000 0.000
#> GSM862447 1 0.0000 0.9798 1.000 0.000 0.000
#> GSM862448 1 0.0000 0.9798 1.000 0.000 0.000
#> GSM862449 1 0.1753 0.9363 0.952 0.048 0.000
#> GSM862450 1 0.0000 0.9798 1.000 0.000 0.000
#> GSM862451 1 0.0000 0.9798 1.000 0.000 0.000
#> GSM862453 1 0.0000 0.9798 1.000 0.000 0.000
#> GSM862454 1 0.0000 0.9798 1.000 0.000 0.000
#> GSM862455 1 0.0000 0.9798 1.000 0.000 0.000
#> GSM862456 1 0.0000 0.9798 1.000 0.000 0.000
#> GSM862457 1 0.1411 0.9482 0.964 0.036 0.000
#> GSM862458 3 0.8779 0.4423 0.164 0.260 0.576
#> GSM862459 1 0.0000 0.9798 1.000 0.000 0.000
#> GSM862460 1 0.0000 0.9798 1.000 0.000 0.000
#> GSM862461 1 0.0000 0.9798 1.000 0.000 0.000
#> GSM862462 1 0.0000 0.9798 1.000 0.000 0.000
#> GSM862463 1 0.0000 0.9798 1.000 0.000 0.000
#> GSM862464 1 0.6008 0.4007 0.628 0.000 0.372
#> GSM862465 1 0.0000 0.9798 1.000 0.000 0.000
#> GSM862466 1 0.0000 0.9798 1.000 0.000 0.000
#> GSM862467 1 0.0000 0.9798 1.000 0.000 0.000
#> GSM862468 1 0.0000 0.9798 1.000 0.000 0.000
#> GSM862469 3 0.0000 0.9461 0.000 0.000 1.000
#> GSM862470 2 0.0000 0.9349 0.000 1.000 0.000
#> GSM862471 3 0.0000 0.9461 0.000 0.000 1.000
#> GSM862472 3 0.0000 0.9461 0.000 0.000 1.000
#> GSM862473 3 0.0237 0.9433 0.000 0.004 0.996
#> GSM862474 2 0.0000 0.9349 0.000 1.000 0.000
#> GSM862475 2 0.0892 0.9219 0.000 0.980 0.020
#> GSM862476 2 0.0000 0.9349 0.000 1.000 0.000
#> GSM862477 2 0.0000 0.9349 0.000 1.000 0.000
#> GSM862478 3 0.0000 0.9461 0.000 0.000 1.000
#> GSM862479 3 0.0000 0.9461 0.000 0.000 1.000
#> GSM862480 2 0.3941 0.7858 0.000 0.844 0.156
#> GSM862481 3 0.1753 0.9052 0.000 0.048 0.952
#> GSM862482 2 0.0000 0.9349 0.000 1.000 0.000
#> GSM862483 2 0.0000 0.9349 0.000 1.000 0.000
#> GSM862484 2 0.0000 0.9349 0.000 1.000 0.000
#> GSM862485 3 0.0000 0.9461 0.000 0.000 1.000
#> GSM862486 2 0.0000 0.9349 0.000 1.000 0.000
#> GSM862487 3 0.0000 0.9461 0.000 0.000 1.000
#> GSM862488 3 0.0000 0.9461 0.000 0.000 1.000
#> GSM862489 2 0.0000 0.9349 0.000 1.000 0.000
#> GSM862490 2 0.0000 0.9349 0.000 1.000 0.000
#> GSM862491 3 0.0000 0.9461 0.000 0.000 1.000
#> GSM862492 3 0.0000 0.9461 0.000 0.000 1.000
#> GSM862493 2 0.0000 0.9349 0.000 1.000 0.000
#> GSM862494 3 0.0000 0.9461 0.000 0.000 1.000
#> GSM862495 3 0.6079 0.3541 0.000 0.388 0.612
#> GSM862496 2 0.6225 0.2114 0.000 0.568 0.432
#> GSM862497 2 0.3116 0.8420 0.000 0.892 0.108
#> GSM862498 2 0.0237 0.9326 0.000 0.996 0.004
#> GSM862499 3 0.0000 0.9461 0.000 0.000 1.000
#> GSM862500 3 0.0000 0.9461 0.000 0.000 1.000
#> GSM862501 2 0.0000 0.9349 0.000 1.000 0.000
#> GSM862502 2 0.0000 0.9349 0.000 1.000 0.000
#> GSM862503 2 0.0000 0.9349 0.000 1.000 0.000
#> GSM862504 2 0.0000 0.9349 0.000 1.000 0.000
#> GSM862505 2 0.0892 0.9220 0.000 0.980 0.020
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> GSM862441 1 0.0000 0.9888 1.000 0.000 0.000 0.000
#> GSM862442 1 0.0000 0.9888 1.000 0.000 0.000 0.000
#> GSM862443 1 0.2647 0.8556 0.880 0.000 0.120 0.000
#> GSM862444 1 0.1716 0.9245 0.936 0.000 0.064 0.000
#> GSM862445 4 0.5785 0.5705 0.272 0.064 0.000 0.664
#> GSM862446 1 0.0000 0.9888 1.000 0.000 0.000 0.000
#> GSM862447 1 0.0000 0.9888 1.000 0.000 0.000 0.000
#> GSM862448 1 0.0000 0.9888 1.000 0.000 0.000 0.000
#> GSM862449 4 0.4877 0.3023 0.408 0.000 0.000 0.592
#> GSM862450 1 0.0188 0.9858 0.996 0.000 0.000 0.004
#> GSM862451 1 0.0000 0.9888 1.000 0.000 0.000 0.000
#> GSM862453 1 0.0000 0.9888 1.000 0.000 0.000 0.000
#> GSM862454 1 0.0000 0.9888 1.000 0.000 0.000 0.000
#> GSM862455 1 0.0000 0.9888 1.000 0.000 0.000 0.000
#> GSM862456 1 0.0000 0.9888 1.000 0.000 0.000 0.000
#> GSM862457 1 0.0188 0.9856 0.996 0.000 0.000 0.004
#> GSM862458 4 0.5132 0.0569 0.004 0.000 0.448 0.548
#> GSM862459 1 0.0000 0.9888 1.000 0.000 0.000 0.000
#> GSM862460 1 0.0000 0.9888 1.000 0.000 0.000 0.000
#> GSM862461 1 0.0000 0.9888 1.000 0.000 0.000 0.000
#> GSM862462 1 0.0000 0.9888 1.000 0.000 0.000 0.000
#> GSM862463 1 0.0000 0.9888 1.000 0.000 0.000 0.000
#> GSM862464 3 0.3123 0.7583 0.156 0.000 0.844 0.000
#> GSM862465 1 0.0000 0.9888 1.000 0.000 0.000 0.000
#> GSM862466 1 0.0000 0.9888 1.000 0.000 0.000 0.000
#> GSM862467 1 0.0000 0.9888 1.000 0.000 0.000 0.000
#> GSM862468 1 0.1059 0.9655 0.972 0.012 0.000 0.016
#> GSM862469 3 0.0000 0.9571 0.000 0.000 1.000 0.000
#> GSM862470 4 0.1022 0.7081 0.000 0.032 0.000 0.968
#> GSM862471 3 0.0000 0.9571 0.000 0.000 1.000 0.000
#> GSM862472 3 0.0188 0.9535 0.000 0.000 0.996 0.004
#> GSM862473 3 0.4661 0.4219 0.000 0.348 0.652 0.000
#> GSM862474 4 0.3444 0.7618 0.000 0.184 0.000 0.816
#> GSM862475 2 0.0188 0.8857 0.000 0.996 0.000 0.004
#> GSM862476 4 0.3688 0.7548 0.000 0.208 0.000 0.792
#> GSM862477 4 0.2760 0.7623 0.000 0.128 0.000 0.872
#> GSM862478 3 0.0000 0.9571 0.000 0.000 1.000 0.000
#> GSM862479 3 0.0000 0.9571 0.000 0.000 1.000 0.000
#> GSM862480 2 0.0188 0.8858 0.000 0.996 0.000 0.004
#> GSM862481 2 0.3528 0.7255 0.000 0.808 0.192 0.000
#> GSM862482 4 0.4843 0.5165 0.000 0.396 0.000 0.604
#> GSM862483 4 0.0336 0.7140 0.000 0.008 0.000 0.992
#> GSM862484 4 0.3688 0.7551 0.000 0.208 0.000 0.792
#> GSM862485 3 0.0000 0.9571 0.000 0.000 1.000 0.000
#> GSM862486 4 0.3356 0.6233 0.000 0.176 0.000 0.824
#> GSM862487 3 0.0000 0.9571 0.000 0.000 1.000 0.000
#> GSM862488 3 0.0000 0.9571 0.000 0.000 1.000 0.000
#> GSM862489 2 0.2973 0.7324 0.000 0.856 0.000 0.144
#> GSM862490 2 0.3311 0.8097 0.000 0.828 0.000 0.172
#> GSM862491 3 0.0000 0.9571 0.000 0.000 1.000 0.000
#> GSM862492 3 0.0000 0.9571 0.000 0.000 1.000 0.000
#> GSM862493 4 0.3400 0.7629 0.000 0.180 0.000 0.820
#> GSM862494 3 0.0000 0.9571 0.000 0.000 1.000 0.000
#> GSM862495 2 0.0817 0.8785 0.000 0.976 0.024 0.000
#> GSM862496 2 0.0188 0.8858 0.000 0.996 0.000 0.004
#> GSM862497 2 0.0188 0.8858 0.000 0.996 0.000 0.004
#> GSM862498 4 0.3172 0.7614 0.000 0.160 0.000 0.840
#> GSM862499 3 0.0000 0.9571 0.000 0.000 1.000 0.000
#> GSM862500 3 0.0000 0.9571 0.000 0.000 1.000 0.000
#> GSM862501 2 0.4072 0.7518 0.000 0.748 0.000 0.252
#> GSM862502 2 0.3688 0.7839 0.000 0.792 0.000 0.208
#> GSM862503 2 0.1118 0.8731 0.000 0.964 0.000 0.036
#> GSM862504 4 0.3873 0.7425 0.000 0.228 0.000 0.772
#> GSM862505 2 0.0000 0.8862 0.000 1.000 0.000 0.000
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> GSM862441 4 0.0162 0.9527 0.004 0.000 0.000 0.996 0.000
#> GSM862442 4 0.0290 0.9516 0.008 0.000 0.000 0.992 0.000
#> GSM862443 4 0.3086 0.7520 0.004 0.000 0.180 0.816 0.000
#> GSM862444 4 0.1753 0.9133 0.032 0.000 0.032 0.936 0.000
#> GSM862445 5 0.0404 0.9368 0.000 0.000 0.000 0.012 0.988
#> GSM862446 4 0.1908 0.8738 0.000 0.000 0.000 0.908 0.092
#> GSM862447 4 0.0290 0.9516 0.008 0.000 0.000 0.992 0.000
#> GSM862448 4 0.0290 0.9516 0.008 0.000 0.000 0.992 0.000
#> GSM862449 1 0.5941 0.4304 0.592 0.000 0.000 0.228 0.180
#> GSM862450 4 0.4180 0.6847 0.220 0.000 0.036 0.744 0.000
#> GSM862451 4 0.0290 0.9524 0.008 0.000 0.000 0.992 0.000
#> GSM862453 4 0.0162 0.9524 0.004 0.000 0.000 0.996 0.000
#> GSM862454 4 0.0290 0.9524 0.008 0.000 0.000 0.992 0.000
#> GSM862455 4 0.0290 0.9524 0.008 0.000 0.000 0.992 0.000
#> GSM862456 4 0.0290 0.9524 0.008 0.000 0.000 0.992 0.000
#> GSM862457 4 0.0162 0.9523 0.004 0.000 0.000 0.996 0.000
#> GSM862458 1 0.4430 0.3314 0.628 0.000 0.360 0.000 0.012
#> GSM862459 4 0.0290 0.9524 0.008 0.000 0.000 0.992 0.000
#> GSM862460 4 0.0162 0.9524 0.004 0.000 0.000 0.996 0.000
#> GSM862461 4 0.0162 0.9527 0.004 0.000 0.000 0.996 0.000
#> GSM862462 4 0.0290 0.9516 0.008 0.000 0.000 0.992 0.000
#> GSM862463 4 0.0290 0.9524 0.008 0.000 0.000 0.992 0.000
#> GSM862464 3 0.2488 0.7999 0.004 0.000 0.872 0.124 0.000
#> GSM862465 4 0.0290 0.9524 0.008 0.000 0.000 0.992 0.000
#> GSM862466 4 0.0290 0.9516 0.008 0.000 0.000 0.992 0.000
#> GSM862467 4 0.0000 0.9526 0.000 0.000 0.000 1.000 0.000
#> GSM862468 4 0.3885 0.6287 0.268 0.008 0.000 0.724 0.000
#> GSM862469 3 0.1043 0.9477 0.040 0.000 0.960 0.000 0.000
#> GSM862470 1 0.2011 0.6650 0.908 0.004 0.000 0.000 0.088
#> GSM862471 3 0.0404 0.9603 0.012 0.000 0.988 0.000 0.000
#> GSM862472 3 0.0771 0.9547 0.020 0.000 0.976 0.000 0.004
#> GSM862473 2 0.4909 0.6010 0.016 0.728 0.192 0.000 0.064
#> GSM862474 5 0.0000 0.9431 0.000 0.000 0.000 0.000 1.000
#> GSM862475 2 0.1124 0.8277 0.036 0.960 0.000 0.000 0.004
#> GSM862476 5 0.0290 0.9423 0.000 0.008 0.000 0.000 0.992
#> GSM862477 5 0.1121 0.9209 0.044 0.000 0.000 0.000 0.956
#> GSM862478 3 0.0000 0.9606 0.000 0.000 1.000 0.000 0.000
#> GSM862479 3 0.1043 0.9479 0.040 0.000 0.960 0.000 0.000
#> GSM862480 2 0.0290 0.8424 0.000 0.992 0.000 0.000 0.008
#> GSM862481 2 0.2403 0.7978 0.012 0.904 0.012 0.000 0.072
#> GSM862482 5 0.2124 0.8524 0.004 0.096 0.000 0.000 0.900
#> GSM862483 1 0.3796 0.4481 0.700 0.000 0.000 0.000 0.300
#> GSM862484 5 0.0000 0.9431 0.000 0.000 0.000 0.000 1.000
#> GSM862485 3 0.0609 0.9581 0.020 0.000 0.980 0.000 0.000
#> GSM862486 1 0.3209 0.6622 0.860 0.060 0.004 0.000 0.076
#> GSM862487 3 0.2504 0.8893 0.032 0.064 0.900 0.000 0.004
#> GSM862488 3 0.0162 0.9603 0.004 0.000 0.996 0.000 0.000
#> GSM862489 2 0.3876 0.5386 0.000 0.684 0.000 0.000 0.316
#> GSM862490 2 0.4015 0.4460 0.348 0.652 0.000 0.000 0.000
#> GSM862491 3 0.0865 0.9531 0.024 0.000 0.972 0.000 0.004
#> GSM862492 3 0.0865 0.9531 0.024 0.000 0.972 0.000 0.004
#> GSM862493 5 0.0404 0.9405 0.012 0.000 0.000 0.000 0.988
#> GSM862494 3 0.0290 0.9597 0.008 0.000 0.992 0.000 0.000
#> GSM862495 2 0.0000 0.8428 0.000 1.000 0.000 0.000 0.000
#> GSM862496 2 0.0000 0.8428 0.000 1.000 0.000 0.000 0.000
#> GSM862497 2 0.0451 0.8416 0.004 0.988 0.000 0.000 0.008
#> GSM862498 5 0.3577 0.7512 0.160 0.032 0.000 0.000 0.808
#> GSM862499 3 0.0510 0.9593 0.016 0.000 0.984 0.000 0.000
#> GSM862500 3 0.0404 0.9603 0.012 0.000 0.988 0.000 0.000
#> GSM862501 1 0.2233 0.6304 0.892 0.104 0.000 0.000 0.004
#> GSM862502 1 0.4249 0.0399 0.568 0.432 0.000 0.000 0.000
#> GSM862503 2 0.3650 0.6943 0.176 0.796 0.000 0.000 0.028
#> GSM862504 5 0.0404 0.9407 0.000 0.012 0.000 0.000 0.988
#> GSM862505 2 0.0000 0.8428 0.000 1.000 0.000 0.000 0.000
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> GSM862441 1 0.0790 0.924 0.968 0.000 0.000 0.000 0.000 0.032
#> GSM862442 1 0.0146 0.926 0.996 0.000 0.000 0.000 0.000 0.004
#> GSM862443 1 0.2623 0.811 0.852 0.000 0.132 0.000 0.000 0.016
#> GSM862444 1 0.3941 0.714 0.732 0.000 0.028 0.008 0.000 0.232
#> GSM862445 2 0.0508 0.915 0.012 0.984 0.000 0.000 0.000 0.004
#> GSM862446 1 0.3163 0.676 0.764 0.232 0.000 0.000 0.000 0.004
#> GSM862447 1 0.0260 0.926 0.992 0.000 0.000 0.000 0.000 0.008
#> GSM862448 1 0.0363 0.925 0.988 0.000 0.000 0.000 0.000 0.012
#> GSM862449 6 0.5344 0.869 0.064 0.056 0.000 0.232 0.000 0.648
#> GSM862450 1 0.4870 0.609 0.700 0.000 0.192 0.032 0.000 0.076
#> GSM862451 1 0.1141 0.921 0.948 0.000 0.000 0.000 0.000 0.052
#> GSM862453 1 0.0260 0.926 0.992 0.000 0.000 0.000 0.000 0.008
#> GSM862454 1 0.1141 0.921 0.948 0.000 0.000 0.000 0.000 0.052
#> GSM862455 1 0.1141 0.921 0.948 0.000 0.000 0.000 0.000 0.052
#> GSM862456 1 0.1141 0.921 0.948 0.000 0.000 0.000 0.000 0.052
#> GSM862457 1 0.0405 0.925 0.988 0.004 0.000 0.000 0.000 0.008
#> GSM862458 3 0.5515 0.278 0.000 0.000 0.556 0.260 0.000 0.184
#> GSM862459 1 0.2201 0.891 0.900 0.000 0.000 0.000 0.052 0.048
#> GSM862460 1 0.0146 0.926 0.996 0.000 0.000 0.000 0.000 0.004
#> GSM862461 1 0.0363 0.926 0.988 0.000 0.000 0.000 0.000 0.012
#> GSM862462 1 0.1010 0.913 0.960 0.000 0.000 0.004 0.000 0.036
#> GSM862463 1 0.1141 0.921 0.948 0.000 0.000 0.000 0.000 0.052
#> GSM862464 3 0.2948 0.669 0.188 0.000 0.804 0.000 0.000 0.008
#> GSM862465 1 0.1471 0.916 0.932 0.000 0.000 0.004 0.000 0.064
#> GSM862466 1 0.0260 0.926 0.992 0.000 0.000 0.000 0.000 0.008
#> GSM862467 1 0.0146 0.926 0.996 0.000 0.000 0.000 0.000 0.004
#> GSM862468 4 0.4178 0.188 0.428 0.000 0.000 0.560 0.008 0.004
#> GSM862469 3 0.1080 0.863 0.000 0.000 0.960 0.004 0.004 0.032
#> GSM862470 4 0.2527 0.451 0.000 0.040 0.000 0.876 0.000 0.084
#> GSM862471 3 0.1411 0.865 0.000 0.000 0.936 0.004 0.000 0.060
#> GSM862472 3 0.3163 0.796 0.000 0.004 0.780 0.004 0.000 0.212
#> GSM862473 5 0.4015 0.701 0.000 0.036 0.100 0.004 0.800 0.060
#> GSM862474 2 0.0000 0.928 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM862475 5 0.4845 -0.146 0.000 0.012 0.004 0.456 0.504 0.024
#> GSM862476 2 0.0146 0.928 0.000 0.996 0.000 0.000 0.000 0.004
#> GSM862477 2 0.0520 0.920 0.000 0.984 0.000 0.008 0.000 0.008
#> GSM862478 3 0.0951 0.869 0.000 0.000 0.968 0.004 0.008 0.020
#> GSM862479 3 0.1218 0.861 0.000 0.000 0.956 0.012 0.004 0.028
#> GSM862480 5 0.0000 0.832 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM862481 5 0.2005 0.812 0.000 0.036 0.016 0.004 0.924 0.020
#> GSM862482 2 0.0603 0.920 0.000 0.980 0.000 0.000 0.004 0.016
#> GSM862483 6 0.4792 0.868 0.000 0.096 0.000 0.260 0.000 0.644
#> GSM862484 2 0.0146 0.928 0.000 0.996 0.000 0.000 0.000 0.004
#> GSM862485 3 0.0551 0.868 0.000 0.000 0.984 0.008 0.004 0.004
#> GSM862486 4 0.2433 0.562 0.000 0.052 0.008 0.900 0.008 0.032
#> GSM862487 3 0.4175 0.766 0.000 0.000 0.748 0.008 0.072 0.172
#> GSM862488 3 0.1390 0.866 0.000 0.000 0.948 0.004 0.016 0.032
#> GSM862489 5 0.3074 0.677 0.000 0.200 0.000 0.004 0.792 0.004
#> GSM862490 4 0.3555 0.581 0.000 0.000 0.000 0.712 0.280 0.008
#> GSM862491 3 0.3161 0.793 0.000 0.000 0.776 0.008 0.000 0.216
#> GSM862492 3 0.3023 0.810 0.000 0.000 0.808 0.008 0.004 0.180
#> GSM862493 2 0.0000 0.928 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM862494 3 0.1116 0.869 0.000 0.000 0.960 0.004 0.008 0.028
#> GSM862495 5 0.1408 0.816 0.000 0.000 0.000 0.036 0.944 0.020
#> GSM862496 5 0.0000 0.832 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM862497 5 0.0000 0.832 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM862498 2 0.5558 0.277 0.000 0.560 0.000 0.336 0.040 0.064
#> GSM862499 3 0.0713 0.869 0.000 0.000 0.972 0.000 0.000 0.028
#> GSM862500 3 0.1075 0.867 0.000 0.000 0.952 0.000 0.000 0.048
#> GSM862501 4 0.1320 0.584 0.000 0.000 0.000 0.948 0.036 0.016
#> GSM862502 4 0.3175 0.629 0.000 0.000 0.000 0.808 0.164 0.028
#> GSM862503 4 0.4443 0.495 0.000 0.024 0.000 0.636 0.328 0.012
#> GSM862504 2 0.0000 0.928 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM862505 5 0.2112 0.788 0.000 0.000 0.000 0.088 0.896 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 tissue(p) k
#> MAD:NMF 64 6.95e-14 2
#> MAD:NMF 59 1.54e-13 3
#> MAD:NMF 61 1.53e-11 4
#> MAD:NMF 59 1.71e-10 5
#> MAD:NMF 58 2.67e-09 6
If matrix rows can be associated to genes, consider to use functional_enrichment(res,
...)
to perform function enrichment for the signature genes. See this vignette for more detailed explanations.
The object with results only for a single top-value method and a single partition method can be extracted as:
res = res_list["ATC", "hclust"]
# you can also extract it by
# res = res_list["ATC:hclust"]
A summary of res
and all the functions that can be applied to it:
res
#> A 'ConsensusPartition' object with k = 2, 3, 4, 5, 6.
#> On a matrix with 51941 rows and 64 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 3.
#>
#> Following methods can be applied to this 'ConsensusPartition' object:
#> [1] "cola_report" "collect_classes" "collect_plots"
#> [4] "collect_stats" "colnames" "compare_signatures"
#> [7] "consensus_heatmap" "dimension_reduction" "functional_enrichment"
#> [10] "get_anno_col" "get_anno" "get_classes"
#> [13] "get_consensus" "get_matrix" "get_membership"
#> [16] "get_param" "get_signatures" "get_stats"
#> [19] "is_best_k" "is_stable_k" "membership_heatmap"
#> [22] "ncol" "nrow" "plot_ecdf"
#> [25] "rownames" "select_partition_number" "show"
#> [28] "suggest_best_k" "test_to_known_factors"
collect_plots()
function collects all the plots made from res
for all k
(number of partitions)
into one single page to provide an easy and fast comparison between different k
.
collect_plots(res)
The plots are:
k
and the heatmap of
predicted classes for each k
.k
.k
.k
.All the plots in panels can be made by individual functions and they are plotted later in this section.
select_partition_number()
produces several plots showing different
statistics for choosing “optimized” k
. There are following statistics:
k
;k
, the area increased is defined as \(A_k - A_{k-1}\).The detailed explanations of these statistics can be found in the cola vignette.
Generally speaking, lower PAC score, higher mean silhouette score or higher
concordance corresponds to better partition. Rand index and Jaccard index
measure how similar the current partition is compared to partition with k-1
.
If they are too similar, we won't accept k
is better than k-1
.
select_partition_number(res)
The numeric values for all these statistics can be obtained by get_stats()
.
get_stats(res)
#> k 1-PAC mean_silhouette concordance area_increased Rand Jaccard
#> 2 2 0.488 0.740 0.876 0.3166 0.778 0.778
#> 3 3 0.508 0.912 0.877 0.6827 0.635 0.531
#> 4 4 0.913 0.944 0.965 0.1292 0.994 0.986
#> 5 5 0.767 0.573 0.823 0.1405 0.983 0.959
#> 6 6 0.733 0.735 0.803 0.0183 0.943 0.854
suggest_best_k()
suggests the best \(k\) based on these statistics. The rules are as follows:
suggest_best_k(res)
#> [1] 3
Following shows the table of the partitions (You need to click the show/hide
code output link to see it). The membership matrix (columns with name p*
)
is inferred by
clue::cl_consensus()
function with the SE
method. Basically the value in the membership matrix
represents the probability to belong to a certain group. The finall class
label for an item is determined with the group with highest probability it
belongs to.
In get_classes()
function, the entropy is calculated from the membership
matrix and the silhouette score is calculated from the consensus matrix.
cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#> class entropy silhouette p1 p2
#> GSM862441 2 0.992 0.421 0.448 0.552
#> GSM862442 2 0.992 0.421 0.448 0.552
#> GSM862443 2 0.808 0.705 0.248 0.752
#> GSM862444 2 0.808 0.705 0.248 0.752
#> GSM862445 2 0.753 0.726 0.216 0.784
#> GSM862446 2 0.808 0.705 0.248 0.752
#> GSM862447 2 0.808 0.705 0.248 0.752
#> GSM862448 2 0.992 0.421 0.448 0.552
#> GSM862449 2 0.808 0.705 0.248 0.752
#> GSM862450 2 0.808 0.705 0.248 0.752
#> GSM862451 2 0.992 0.421 0.448 0.552
#> GSM862453 1 0.000 0.847 1.000 0.000
#> GSM862454 1 0.000 0.847 1.000 0.000
#> GSM862455 1 0.000 0.847 1.000 0.000
#> GSM862456 1 0.000 0.847 1.000 0.000
#> GSM862457 2 0.808 0.705 0.248 0.752
#> GSM862458 2 0.753 0.726 0.216 0.784
#> GSM862459 2 0.992 0.421 0.448 0.552
#> GSM862460 2 0.992 0.421 0.448 0.552
#> GSM862461 2 0.992 0.421 0.448 0.552
#> GSM862462 2 0.808 0.705 0.248 0.752
#> GSM862463 1 0.000 0.847 1.000 0.000
#> GSM862464 2 0.808 0.705 0.248 0.752
#> GSM862465 1 0.000 0.847 1.000 0.000
#> GSM862466 2 0.992 0.421 0.448 0.552
#> GSM862467 2 0.992 0.421 0.448 0.552
#> GSM862468 2 0.808 0.705 0.248 0.752
#> GSM862469 2 0.000 0.842 0.000 1.000
#> GSM862470 2 0.000 0.842 0.000 1.000
#> GSM862471 2 0.000 0.842 0.000 1.000
#> GSM862472 2 0.000 0.842 0.000 1.000
#> GSM862473 2 0.000 0.842 0.000 1.000
#> GSM862474 2 0.000 0.842 0.000 1.000
#> GSM862475 2 0.000 0.842 0.000 1.000
#> GSM862476 2 0.000 0.842 0.000 1.000
#> GSM862477 2 0.000 0.842 0.000 1.000
#> GSM862478 2 0.000 0.842 0.000 1.000
#> GSM862479 2 0.000 0.842 0.000 1.000
#> GSM862480 2 0.000 0.842 0.000 1.000
#> GSM862481 2 0.000 0.842 0.000 1.000
#> GSM862482 2 0.000 0.842 0.000 1.000
#> GSM862483 2 0.000 0.842 0.000 1.000
#> GSM862484 2 0.000 0.842 0.000 1.000
#> GSM862485 2 0.000 0.842 0.000 1.000
#> GSM862486 2 0.000 0.842 0.000 1.000
#> GSM862487 2 0.000 0.842 0.000 1.000
#> GSM862488 2 0.000 0.842 0.000 1.000
#> GSM862489 2 0.000 0.842 0.000 1.000
#> GSM862490 2 0.000 0.842 0.000 1.000
#> GSM862491 2 0.000 0.842 0.000 1.000
#> GSM862492 2 0.224 0.810 0.036 0.964
#> GSM862493 2 0.000 0.842 0.000 1.000
#> GSM862494 2 0.000 0.842 0.000 1.000
#> GSM862495 2 0.000 0.842 0.000 1.000
#> GSM862496 2 0.000 0.842 0.000 1.000
#> GSM862497 2 0.000 0.842 0.000 1.000
#> GSM862498 2 0.000 0.842 0.000 1.000
#> GSM862499 2 0.000 0.842 0.000 1.000
#> GSM862500 2 0.000 0.842 0.000 1.000
#> GSM862501 2 0.000 0.842 0.000 1.000
#> GSM862502 1 0.997 0.282 0.532 0.468
#> GSM862503 2 0.000 0.842 0.000 1.000
#> GSM862504 2 0.000 0.842 0.000 1.000
#> GSM862505 1 0.997 0.282 0.532 0.468
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> GSM862441 1 0.787 0.849 0.664 0.136 0.200
#> GSM862442 1 0.787 0.849 0.664 0.136 0.200
#> GSM862443 1 0.362 0.891 0.864 0.136 0.000
#> GSM862444 1 0.362 0.891 0.864 0.136 0.000
#> GSM862445 1 0.424 0.854 0.824 0.176 0.000
#> GSM862446 1 0.362 0.891 0.864 0.136 0.000
#> GSM862447 1 0.362 0.891 0.864 0.136 0.000
#> GSM862448 1 0.787 0.849 0.664 0.136 0.200
#> GSM862449 1 0.362 0.891 0.864 0.136 0.000
#> GSM862450 1 0.362 0.891 0.864 0.136 0.000
#> GSM862451 1 0.787 0.849 0.664 0.136 0.200
#> GSM862453 3 0.175 0.791 0.048 0.000 0.952
#> GSM862454 3 0.175 0.791 0.048 0.000 0.952
#> GSM862455 3 0.175 0.791 0.048 0.000 0.952
#> GSM862456 3 0.175 0.791 0.048 0.000 0.952
#> GSM862457 1 0.362 0.891 0.864 0.136 0.000
#> GSM862458 1 0.424 0.854 0.824 0.176 0.000
#> GSM862459 1 0.787 0.849 0.664 0.136 0.200
#> GSM862460 1 0.787 0.849 0.664 0.136 0.200
#> GSM862461 1 0.787 0.849 0.664 0.136 0.200
#> GSM862462 1 0.362 0.891 0.864 0.136 0.000
#> GSM862463 3 0.175 0.791 0.048 0.000 0.952
#> GSM862464 1 0.362 0.891 0.864 0.136 0.000
#> GSM862465 3 0.116 0.766 0.028 0.000 0.972
#> GSM862466 1 0.787 0.849 0.664 0.136 0.200
#> GSM862467 1 0.787 0.849 0.664 0.136 0.200
#> GSM862468 1 0.362 0.891 0.864 0.136 0.000
#> GSM862469 2 0.000 0.996 0.000 1.000 0.000
#> GSM862470 2 0.000 0.996 0.000 1.000 0.000
#> GSM862471 2 0.000 0.996 0.000 1.000 0.000
#> GSM862472 2 0.000 0.996 0.000 1.000 0.000
#> GSM862473 2 0.000 0.996 0.000 1.000 0.000
#> GSM862474 2 0.000 0.996 0.000 1.000 0.000
#> GSM862475 2 0.000 0.996 0.000 1.000 0.000
#> GSM862476 2 0.000 0.996 0.000 1.000 0.000
#> GSM862477 2 0.000 0.996 0.000 1.000 0.000
#> GSM862478 2 0.000 0.996 0.000 1.000 0.000
#> GSM862479 2 0.000 0.996 0.000 1.000 0.000
#> GSM862480 2 0.000 0.996 0.000 1.000 0.000
#> GSM862481 2 0.000 0.996 0.000 1.000 0.000
#> GSM862482 2 0.000 0.996 0.000 1.000 0.000
#> GSM862483 2 0.000 0.996 0.000 1.000 0.000
#> GSM862484 2 0.000 0.996 0.000 1.000 0.000
#> GSM862485 2 0.000 0.996 0.000 1.000 0.000
#> GSM862486 2 0.000 0.996 0.000 1.000 0.000
#> GSM862487 2 0.000 0.996 0.000 1.000 0.000
#> GSM862488 2 0.000 0.996 0.000 1.000 0.000
#> GSM862489 2 0.000 0.996 0.000 1.000 0.000
#> GSM862490 2 0.000 0.996 0.000 1.000 0.000
#> GSM862491 2 0.000 0.996 0.000 1.000 0.000
#> GSM862492 2 0.304 0.848 0.104 0.896 0.000
#> GSM862493 2 0.000 0.996 0.000 1.000 0.000
#> GSM862494 2 0.000 0.996 0.000 1.000 0.000
#> GSM862495 2 0.000 0.996 0.000 1.000 0.000
#> GSM862496 2 0.000 0.996 0.000 1.000 0.000
#> GSM862497 2 0.000 0.996 0.000 1.000 0.000
#> GSM862498 2 0.000 0.996 0.000 1.000 0.000
#> GSM862499 2 0.000 0.996 0.000 1.000 0.000
#> GSM862500 2 0.000 0.996 0.000 1.000 0.000
#> GSM862501 2 0.000 0.996 0.000 1.000 0.000
#> GSM862502 3 0.905 0.335 0.136 0.400 0.464
#> GSM862503 2 0.000 0.996 0.000 1.000 0.000
#> GSM862504 2 0.000 0.996 0.000 1.000 0.000
#> GSM862505 3 0.905 0.335 0.136 0.400 0.464
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> GSM862441 4 0.361 0.847 0.200 0.000 0.000 0.80
#> GSM862442 4 0.361 0.847 0.200 0.000 0.000 0.80
#> GSM862443 4 0.000 0.888 0.000 0.000 0.000 1.00
#> GSM862444 4 0.000 0.888 0.000 0.000 0.000 1.00
#> GSM862445 4 0.121 0.851 0.000 0.040 0.000 0.96
#> GSM862446 4 0.000 0.888 0.000 0.000 0.000 1.00
#> GSM862447 4 0.000 0.888 0.000 0.000 0.000 1.00
#> GSM862448 4 0.361 0.847 0.200 0.000 0.000 0.80
#> GSM862449 4 0.000 0.888 0.000 0.000 0.000 1.00
#> GSM862450 4 0.000 0.888 0.000 0.000 0.000 1.00
#> GSM862451 4 0.361 0.847 0.200 0.000 0.000 0.80
#> GSM862453 1 0.000 0.977 1.000 0.000 0.000 0.00
#> GSM862454 1 0.000 0.977 1.000 0.000 0.000 0.00
#> GSM862455 1 0.000 0.977 1.000 0.000 0.000 0.00
#> GSM862456 1 0.000 0.977 1.000 0.000 0.000 0.00
#> GSM862457 4 0.000 0.888 0.000 0.000 0.000 1.00
#> GSM862458 4 0.121 0.851 0.000 0.040 0.000 0.96
#> GSM862459 4 0.361 0.847 0.200 0.000 0.000 0.80
#> GSM862460 4 0.361 0.847 0.200 0.000 0.000 0.80
#> GSM862461 4 0.361 0.847 0.200 0.000 0.000 0.80
#> GSM862462 4 0.000 0.888 0.000 0.000 0.000 1.00
#> GSM862463 1 0.000 0.977 1.000 0.000 0.000 0.00
#> GSM862464 4 0.000 0.888 0.000 0.000 0.000 1.00
#> GSM862465 1 0.259 0.873 0.884 0.000 0.116 0.00
#> GSM862466 4 0.361 0.847 0.200 0.000 0.000 0.80
#> GSM862467 4 0.361 0.847 0.200 0.000 0.000 0.80
#> GSM862468 4 0.000 0.888 0.000 0.000 0.000 1.00
#> GSM862469 2 0.000 0.993 0.000 1.000 0.000 0.00
#> GSM862470 2 0.000 0.993 0.000 1.000 0.000 0.00
#> GSM862471 2 0.000 0.993 0.000 1.000 0.000 0.00
#> GSM862472 2 0.000 0.993 0.000 1.000 0.000 0.00
#> GSM862473 2 0.000 0.993 0.000 1.000 0.000 0.00
#> GSM862474 2 0.000 0.993 0.000 1.000 0.000 0.00
#> GSM862475 2 0.000 0.993 0.000 1.000 0.000 0.00
#> GSM862476 2 0.000 0.993 0.000 1.000 0.000 0.00
#> GSM862477 2 0.000 0.993 0.000 1.000 0.000 0.00
#> GSM862478 2 0.000 0.993 0.000 1.000 0.000 0.00
#> GSM862479 2 0.000 0.993 0.000 1.000 0.000 0.00
#> GSM862480 2 0.000 0.993 0.000 1.000 0.000 0.00
#> GSM862481 2 0.000 0.993 0.000 1.000 0.000 0.00
#> GSM862482 2 0.000 0.993 0.000 1.000 0.000 0.00
#> GSM862483 2 0.000 0.993 0.000 1.000 0.000 0.00
#> GSM862484 2 0.000 0.993 0.000 1.000 0.000 0.00
#> GSM862485 2 0.000 0.993 0.000 1.000 0.000 0.00
#> GSM862486 2 0.000 0.993 0.000 1.000 0.000 0.00
#> GSM862487 2 0.000 0.993 0.000 1.000 0.000 0.00
#> GSM862488 2 0.000 0.993 0.000 1.000 0.000 0.00
#> GSM862489 2 0.000 0.993 0.000 1.000 0.000 0.00
#> GSM862490 2 0.000 0.993 0.000 1.000 0.000 0.00
#> GSM862491 2 0.000 0.993 0.000 1.000 0.000 0.00
#> GSM862492 2 0.384 0.711 0.000 0.776 0.224 0.00
#> GSM862493 2 0.000 0.993 0.000 1.000 0.000 0.00
#> GSM862494 2 0.000 0.993 0.000 1.000 0.000 0.00
#> GSM862495 2 0.000 0.993 0.000 1.000 0.000 0.00
#> GSM862496 2 0.000 0.993 0.000 1.000 0.000 0.00
#> GSM862497 2 0.000 0.993 0.000 1.000 0.000 0.00
#> GSM862498 2 0.000 0.993 0.000 1.000 0.000 0.00
#> GSM862499 2 0.000 0.993 0.000 1.000 0.000 0.00
#> GSM862500 2 0.000 0.993 0.000 1.000 0.000 0.00
#> GSM862501 2 0.000 0.993 0.000 1.000 0.000 0.00
#> GSM862502 3 0.000 1.000 0.000 0.000 1.000 0.00
#> GSM862503 2 0.000 0.993 0.000 1.000 0.000 0.00
#> GSM862504 2 0.000 0.993 0.000 1.000 0.000 0.00
#> GSM862505 3 0.000 1.000 0.000 0.000 1.000 0.00
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> GSM862441 1 0.4294 0.6595 0.532 0.000 0.468 0.000 0.000
#> GSM862442 1 0.4294 0.6595 0.532 0.000 0.468 0.000 0.000
#> GSM862443 1 0.0000 0.7528 1.000 0.000 0.000 0.000 0.000
#> GSM862444 1 0.0000 0.7528 1.000 0.000 0.000 0.000 0.000
#> GSM862445 1 0.1741 0.6998 0.936 0.040 0.024 0.000 0.000
#> GSM862446 1 0.0000 0.7528 1.000 0.000 0.000 0.000 0.000
#> GSM862447 1 0.0000 0.7528 1.000 0.000 0.000 0.000 0.000
#> GSM862448 1 0.4294 0.6595 0.532 0.000 0.468 0.000 0.000
#> GSM862449 1 0.0000 0.7528 1.000 0.000 0.000 0.000 0.000
#> GSM862450 1 0.0000 0.7528 1.000 0.000 0.000 0.000 0.000
#> GSM862451 1 0.4294 0.6595 0.532 0.000 0.468 0.000 0.000
#> GSM862453 4 0.0000 0.9621 0.000 0.000 0.000 1.000 0.000
#> GSM862454 4 0.0000 0.9621 0.000 0.000 0.000 1.000 0.000
#> GSM862455 4 0.0963 0.9465 0.000 0.000 0.036 0.964 0.000
#> GSM862456 4 0.0000 0.9621 0.000 0.000 0.000 1.000 0.000
#> GSM862457 1 0.0000 0.7528 1.000 0.000 0.000 0.000 0.000
#> GSM862458 1 0.1741 0.6998 0.936 0.040 0.024 0.000 0.000
#> GSM862459 1 0.4294 0.6595 0.532 0.000 0.468 0.000 0.000
#> GSM862460 1 0.4294 0.6595 0.532 0.000 0.468 0.000 0.000
#> GSM862461 1 0.4294 0.6595 0.532 0.000 0.468 0.000 0.000
#> GSM862462 1 0.0000 0.7528 1.000 0.000 0.000 0.000 0.000
#> GSM862463 4 0.0000 0.9621 0.000 0.000 0.000 1.000 0.000
#> GSM862464 1 0.0000 0.7528 1.000 0.000 0.000 0.000 0.000
#> GSM862465 4 0.3527 0.8276 0.000 0.000 0.056 0.828 0.116
#> GSM862466 1 0.4294 0.6595 0.532 0.000 0.468 0.000 0.000
#> GSM862467 1 0.4294 0.6595 0.532 0.000 0.468 0.000 0.000
#> GSM862468 1 0.0162 0.7525 0.996 0.000 0.004 0.000 0.000
#> GSM862469 2 0.0000 0.6792 0.000 1.000 0.000 0.000 0.000
#> GSM862470 2 0.0000 0.6792 0.000 1.000 0.000 0.000 0.000
#> GSM862471 2 0.0000 0.6792 0.000 1.000 0.000 0.000 0.000
#> GSM862472 2 0.0880 0.6740 0.000 0.968 0.032 0.000 0.000
#> GSM862473 2 0.0000 0.6792 0.000 1.000 0.000 0.000 0.000
#> GSM862474 2 0.0000 0.6792 0.000 1.000 0.000 0.000 0.000
#> GSM862475 2 0.1965 0.6541 0.000 0.904 0.096 0.000 0.000
#> GSM862476 2 0.2891 0.5857 0.000 0.824 0.176 0.000 0.000
#> GSM862477 2 0.0000 0.6792 0.000 1.000 0.000 0.000 0.000
#> GSM862478 2 0.3109 0.5528 0.000 0.800 0.200 0.000 0.000
#> GSM862479 2 0.0000 0.6792 0.000 1.000 0.000 0.000 0.000
#> GSM862480 2 0.1965 0.6541 0.000 0.904 0.096 0.000 0.000
#> GSM862481 2 0.0000 0.6792 0.000 1.000 0.000 0.000 0.000
#> GSM862482 2 0.0000 0.6792 0.000 1.000 0.000 0.000 0.000
#> GSM862483 2 0.0000 0.6792 0.000 1.000 0.000 0.000 0.000
#> GSM862484 2 0.0000 0.6792 0.000 1.000 0.000 0.000 0.000
#> GSM862485 2 0.0000 0.6792 0.000 1.000 0.000 0.000 0.000
#> GSM862486 2 0.0000 0.6792 0.000 1.000 0.000 0.000 0.000
#> GSM862487 2 0.4278 -0.1069 0.000 0.548 0.452 0.000 0.000
#> GSM862488 2 0.0290 0.6781 0.000 0.992 0.008 0.000 0.000
#> GSM862489 2 0.4278 -0.1069 0.000 0.548 0.452 0.000 0.000
#> GSM862490 2 0.1965 0.6541 0.000 0.904 0.096 0.000 0.000
#> GSM862491 2 0.4278 -0.1069 0.000 0.548 0.452 0.000 0.000
#> GSM862492 3 0.6581 0.0000 0.000 0.324 0.452 0.000 0.224
#> GSM862493 2 0.4161 0.0955 0.000 0.608 0.392 0.000 0.000
#> GSM862494 2 0.4278 -0.1069 0.000 0.548 0.452 0.000 0.000
#> GSM862495 2 0.4278 -0.1069 0.000 0.548 0.452 0.000 0.000
#> GSM862496 2 0.4278 -0.1069 0.000 0.548 0.452 0.000 0.000
#> GSM862497 2 0.1965 0.6541 0.000 0.904 0.096 0.000 0.000
#> GSM862498 2 0.4278 -0.1069 0.000 0.548 0.452 0.000 0.000
#> GSM862499 2 0.4278 -0.1069 0.000 0.548 0.452 0.000 0.000
#> GSM862500 2 0.4278 -0.1069 0.000 0.548 0.452 0.000 0.000
#> GSM862501 2 0.2605 0.6145 0.000 0.852 0.148 0.000 0.000
#> GSM862502 5 0.0000 1.0000 0.000 0.000 0.000 0.000 1.000
#> GSM862503 2 0.4278 -0.1069 0.000 0.548 0.452 0.000 0.000
#> GSM862504 2 0.2891 0.5857 0.000 0.824 0.176 0.000 0.000
#> GSM862505 5 0.0000 1.0000 0.000 0.000 0.000 0.000 1.000
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> GSM862441 1 0.3864 1.0000 0.520 0.000 0.000 0.480 0.000 0.000
#> GSM862442 1 0.3864 1.0000 0.520 0.000 0.000 0.480 0.000 0.000
#> GSM862443 4 0.0146 0.9645 0.004 0.000 0.000 0.996 0.000 0.000
#> GSM862444 4 0.0000 0.9663 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM862445 4 0.1933 0.8603 0.032 0.044 0.004 0.920 0.000 0.000
#> GSM862446 4 0.0146 0.9645 0.004 0.000 0.000 0.996 0.000 0.000
#> GSM862447 4 0.0146 0.9645 0.004 0.000 0.000 0.996 0.000 0.000
#> GSM862448 1 0.3864 1.0000 0.520 0.000 0.000 0.480 0.000 0.000
#> GSM862449 4 0.0000 0.9663 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM862450 4 0.0000 0.9663 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM862451 1 0.3864 1.0000 0.520 0.000 0.000 0.480 0.000 0.000
#> GSM862453 6 0.3765 0.8887 0.000 0.404 0.000 0.000 0.000 0.596
#> GSM862454 6 0.3765 0.8887 0.000 0.404 0.000 0.000 0.000 0.596
#> GSM862455 6 0.0000 0.3127 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM862456 6 0.3765 0.8887 0.000 0.404 0.000 0.000 0.000 0.596
#> GSM862457 4 0.0000 0.9663 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM862458 4 0.1933 0.8603 0.032 0.044 0.004 0.920 0.000 0.000
#> GSM862459 1 0.3864 1.0000 0.520 0.000 0.000 0.480 0.000 0.000
#> GSM862460 1 0.3864 1.0000 0.520 0.000 0.000 0.480 0.000 0.000
#> GSM862461 1 0.3864 1.0000 0.520 0.000 0.000 0.480 0.000 0.000
#> GSM862462 4 0.0146 0.9635 0.004 0.000 0.000 0.996 0.000 0.000
#> GSM862463 6 0.3765 0.8887 0.000 0.404 0.000 0.000 0.000 0.596
#> GSM862464 4 0.0000 0.9663 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM862465 2 0.4544 0.0000 0.036 0.548 0.000 0.000 0.000 0.416
#> GSM862466 1 0.3864 1.0000 0.520 0.000 0.000 0.480 0.000 0.000
#> GSM862467 1 0.3864 1.0000 0.520 0.000 0.000 0.480 0.000 0.000
#> GSM862468 4 0.0458 0.9458 0.016 0.000 0.000 0.984 0.000 0.000
#> GSM862469 3 0.0000 0.7626 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM862470 3 0.0000 0.7626 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM862471 3 0.0000 0.7626 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM862472 3 0.0790 0.7639 0.000 0.000 0.968 0.000 0.032 0.000
#> GSM862473 3 0.0000 0.7626 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM862474 3 0.0000 0.7626 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM862475 3 0.1765 0.7608 0.000 0.000 0.904 0.000 0.096 0.000
#> GSM862476 3 0.2730 0.7323 0.000 0.000 0.808 0.000 0.192 0.000
#> GSM862477 3 0.0000 0.7626 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM862478 3 0.2883 0.7232 0.000 0.000 0.788 0.000 0.212 0.000
#> GSM862479 3 0.0000 0.7626 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM862480 3 0.1814 0.7603 0.000 0.000 0.900 0.000 0.100 0.000
#> GSM862481 3 0.0000 0.7626 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM862482 3 0.0000 0.7626 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM862483 3 0.0000 0.7626 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM862484 3 0.0000 0.7626 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM862485 3 0.0000 0.7626 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM862486 3 0.0000 0.7626 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM862487 3 0.3868 0.5152 0.000 0.000 0.504 0.000 0.496 0.000
#> GSM862488 3 0.0363 0.7630 0.000 0.000 0.988 0.000 0.012 0.000
#> GSM862489 3 0.3868 0.5152 0.000 0.000 0.504 0.000 0.496 0.000
#> GSM862490 3 0.1814 0.7603 0.000 0.000 0.900 0.000 0.100 0.000
#> GSM862491 3 0.3868 0.5152 0.000 0.000 0.504 0.000 0.496 0.000
#> GSM862492 5 0.3309 -0.2432 0.000 0.000 0.280 0.000 0.720 0.000
#> GSM862493 3 0.3823 0.5668 0.000 0.000 0.564 0.000 0.436 0.000
#> GSM862494 3 0.3867 0.5237 0.000 0.000 0.512 0.000 0.488 0.000
#> GSM862495 3 0.3868 0.5152 0.000 0.000 0.504 0.000 0.496 0.000
#> GSM862496 3 0.3868 0.5152 0.000 0.000 0.504 0.000 0.496 0.000
#> GSM862497 3 0.1814 0.7603 0.000 0.000 0.900 0.000 0.100 0.000
#> GSM862498 3 0.3868 0.5152 0.000 0.000 0.504 0.000 0.496 0.000
#> GSM862499 3 0.3867 0.5237 0.000 0.000 0.512 0.000 0.488 0.000
#> GSM862500 3 0.3867 0.5237 0.000 0.000 0.512 0.000 0.488 0.000
#> GSM862501 3 0.2491 0.7430 0.000 0.000 0.836 0.000 0.164 0.000
#> GSM862502 5 0.5152 -0.0429 0.448 0.084 0.000 0.000 0.468 0.000
#> GSM862503 3 0.3868 0.5152 0.000 0.000 0.504 0.000 0.496 0.000
#> GSM862504 3 0.2730 0.7323 0.000 0.000 0.808 0.000 0.192 0.000
#> GSM862505 5 0.5152 -0.0429 0.448 0.084 0.000 0.000 0.468 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 tissue(p) k
#> ATC:hclust 53 1.53e-03 2
#> ATC:hclust 62 3.44e-14 3
#> ATC:hclust 64 8.21e-14 4
#> ATC:hclust 52 3.00e-11 5
#> ATC:hclust 59 9.61e-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["ATC", "kmeans"]
# you can also extract it by
# res = res_list["ATC:kmeans"]
A summary of res
and all the functions that can be applied to it:
res
#> A 'ConsensusPartition' object with k = 2, 3, 4, 5, 6.
#> On a matrix with 51941 rows and 64 columns.
#> Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'ATC' method.
#> Subgroups are detected by 'kmeans' method.
#> Performed in total 1250 partitions by row resampling.
#> Best k for subgroups seems to be 3.
#>
#> Following methods can be applied to this 'ConsensusPartition' object:
#> [1] "cola_report" "collect_classes" "collect_plots"
#> [4] "collect_stats" "colnames" "compare_signatures"
#> [7] "consensus_heatmap" "dimension_reduction" "functional_enrichment"
#> [10] "get_anno_col" "get_anno" "get_classes"
#> [13] "get_consensus" "get_matrix" "get_membership"
#> [16] "get_param" "get_signatures" "get_stats"
#> [19] "is_best_k" "is_stable_k" "membership_heatmap"
#> [22] "ncol" "nrow" "plot_ecdf"
#> [25] "rownames" "select_partition_number" "show"
#> [28] "suggest_best_k" "test_to_known_factors"
collect_plots()
function collects all the plots made from res
for all k
(number of partitions)
into one single page to provide an easy and fast comparison between different k
.
collect_plots(res)
The plots are:
k
and the heatmap of
predicted classes for each k
.k
.k
.k
.All the plots in panels can be made by individual functions and they are plotted later in this section.
select_partition_number()
produces several plots showing different
statistics for choosing “optimized” k
. There are following statistics:
k
;k
, the area increased is defined as \(A_k - A_{k-1}\).The detailed explanations of these statistics can be found in the cola vignette.
Generally speaking, lower PAC score, higher mean silhouette score or higher
concordance corresponds to better partition. Rand index and Jaccard index
measure how similar the current partition is compared to partition with k-1
.
If they are too similar, we won't accept k
is better than k-1
.
select_partition_number(res)
The numeric values for all these statistics can be obtained by get_stats()
.
get_stats(res)
#> k 1-PAC mean_silhouette concordance area_increased Rand Jaccard
#> 2 2 1.000 0.993 0.990 0.4886 0.504 0.504
#> 3 3 0.943 0.977 0.977 0.1728 0.897 0.798
#> 4 4 0.810 0.895 0.913 0.1013 0.994 0.986
#> 5 5 0.808 0.841 0.867 0.1033 0.876 0.695
#> 6 6 0.717 0.800 0.809 0.0702 0.948 0.818
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
#> GSM862441 1 0.184 0.993 0.972 0.028
#> GSM862442 1 0.184 0.993 0.972 0.028
#> GSM862443 1 0.184 0.993 0.972 0.028
#> GSM862444 1 0.184 0.993 0.972 0.028
#> GSM862445 1 0.184 0.993 0.972 0.028
#> GSM862446 1 0.184 0.993 0.972 0.028
#> GSM862447 1 0.184 0.993 0.972 0.028
#> GSM862448 1 0.184 0.993 0.972 0.028
#> GSM862449 1 0.184 0.993 0.972 0.028
#> GSM862450 1 0.184 0.993 0.972 0.028
#> GSM862451 1 0.184 0.993 0.972 0.028
#> GSM862453 1 0.000 0.977 1.000 0.000
#> GSM862454 1 0.000 0.977 1.000 0.000
#> GSM862455 1 0.000 0.977 1.000 0.000
#> GSM862456 1 0.000 0.977 1.000 0.000
#> GSM862457 1 0.184 0.993 0.972 0.028
#> GSM862458 1 0.260 0.978 0.956 0.044
#> GSM862459 1 0.184 0.993 0.972 0.028
#> GSM862460 1 0.184 0.993 0.972 0.028
#> GSM862461 1 0.184 0.993 0.972 0.028
#> GSM862462 1 0.184 0.993 0.972 0.028
#> GSM862463 1 0.000 0.977 1.000 0.000
#> GSM862464 1 0.184 0.993 0.972 0.028
#> GSM862465 1 0.000 0.977 1.000 0.000
#> GSM862466 1 0.184 0.993 0.972 0.028
#> GSM862467 1 0.184 0.993 0.972 0.028
#> GSM862468 1 0.184 0.993 0.972 0.028
#> GSM862469 2 0.000 0.998 0.000 1.000
#> GSM862470 2 0.000 0.998 0.000 1.000
#> GSM862471 2 0.000 0.998 0.000 1.000
#> GSM862472 2 0.000 0.998 0.000 1.000
#> GSM862473 2 0.000 0.998 0.000 1.000
#> GSM862474 2 0.000 0.998 0.000 1.000
#> GSM862475 2 0.000 0.998 0.000 1.000
#> GSM862476 2 0.000 0.998 0.000 1.000
#> GSM862477 2 0.000 0.998 0.000 1.000
#> GSM862478 2 0.000 0.998 0.000 1.000
#> GSM862479 2 0.000 0.998 0.000 1.000
#> GSM862480 2 0.000 0.998 0.000 1.000
#> GSM862481 2 0.000 0.998 0.000 1.000
#> GSM862482 2 0.000 0.998 0.000 1.000
#> GSM862483 2 0.000 0.998 0.000 1.000
#> GSM862484 2 0.000 0.998 0.000 1.000
#> GSM862485 2 0.000 0.998 0.000 1.000
#> GSM862486 2 0.000 0.998 0.000 1.000
#> GSM862487 2 0.000 0.998 0.000 1.000
#> GSM862488 2 0.000 0.998 0.000 1.000
#> GSM862489 2 0.000 0.998 0.000 1.000
#> GSM862490 2 0.000 0.998 0.000 1.000
#> GSM862491 2 0.000 0.998 0.000 1.000
#> GSM862492 2 0.000 0.998 0.000 1.000
#> GSM862493 2 0.000 0.998 0.000 1.000
#> GSM862494 2 0.000 0.998 0.000 1.000
#> GSM862495 2 0.000 0.998 0.000 1.000
#> GSM862496 2 0.000 0.998 0.000 1.000
#> GSM862497 2 0.000 0.998 0.000 1.000
#> GSM862498 2 0.000 0.998 0.000 1.000
#> GSM862499 2 0.000 0.998 0.000 1.000
#> GSM862500 2 0.000 0.998 0.000 1.000
#> GSM862501 2 0.000 0.998 0.000 1.000
#> GSM862502 2 0.184 0.972 0.028 0.972
#> GSM862503 2 0.000 0.998 0.000 1.000
#> GSM862504 2 0.000 0.998 0.000 1.000
#> GSM862505 2 0.184 0.972 0.028 0.972
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> GSM862441 1 0.000 0.996 1.000 0.00 0.000
#> GSM862442 1 0.000 0.996 1.000 0.00 0.000
#> GSM862443 1 0.000 0.996 1.000 0.00 0.000
#> GSM862444 1 0.000 0.996 1.000 0.00 0.000
#> GSM862445 1 0.000 0.996 1.000 0.00 0.000
#> GSM862446 1 0.000 0.996 1.000 0.00 0.000
#> GSM862447 1 0.000 0.996 1.000 0.00 0.000
#> GSM862448 1 0.000 0.996 1.000 0.00 0.000
#> GSM862449 1 0.000 0.996 1.000 0.00 0.000
#> GSM862450 1 0.000 0.996 1.000 0.00 0.000
#> GSM862451 1 0.000 0.996 1.000 0.00 0.000
#> GSM862453 3 0.450 0.877 0.196 0.00 0.804
#> GSM862454 3 0.450 0.877 0.196 0.00 0.804
#> GSM862455 3 0.450 0.877 0.196 0.00 0.804
#> GSM862456 3 0.450 0.877 0.196 0.00 0.804
#> GSM862457 1 0.000 0.996 1.000 0.00 0.000
#> GSM862458 1 0.000 0.996 1.000 0.00 0.000
#> GSM862459 1 0.000 0.996 1.000 0.00 0.000
#> GSM862460 1 0.000 0.996 1.000 0.00 0.000
#> GSM862461 1 0.000 0.996 1.000 0.00 0.000
#> GSM862462 1 0.000 0.996 1.000 0.00 0.000
#> GSM862463 3 0.450 0.877 0.196 0.00 0.804
#> GSM862464 1 0.000 0.996 1.000 0.00 0.000
#> GSM862465 3 0.341 0.851 0.124 0.00 0.876
#> GSM862466 1 0.000 0.996 1.000 0.00 0.000
#> GSM862467 1 0.245 0.904 0.924 0.00 0.076
#> GSM862468 1 0.000 0.996 1.000 0.00 0.000
#> GSM862469 2 0.000 1.000 0.000 1.00 0.000
#> GSM862470 2 0.000 1.000 0.000 1.00 0.000
#> GSM862471 2 0.000 1.000 0.000 1.00 0.000
#> GSM862472 2 0.000 1.000 0.000 1.00 0.000
#> GSM862473 2 0.000 1.000 0.000 1.00 0.000
#> GSM862474 2 0.000 1.000 0.000 1.00 0.000
#> GSM862475 2 0.000 1.000 0.000 1.00 0.000
#> GSM862476 2 0.000 1.000 0.000 1.00 0.000
#> GSM862477 2 0.000 1.000 0.000 1.00 0.000
#> GSM862478 2 0.000 1.000 0.000 1.00 0.000
#> GSM862479 2 0.000 1.000 0.000 1.00 0.000
#> GSM862480 2 0.000 1.000 0.000 1.00 0.000
#> GSM862481 2 0.000 1.000 0.000 1.00 0.000
#> GSM862482 2 0.000 1.000 0.000 1.00 0.000
#> GSM862483 2 0.000 1.000 0.000 1.00 0.000
#> GSM862484 2 0.000 1.000 0.000 1.00 0.000
#> GSM862485 2 0.000 1.000 0.000 1.00 0.000
#> GSM862486 2 0.000 1.000 0.000 1.00 0.000
#> GSM862487 2 0.000 1.000 0.000 1.00 0.000
#> GSM862488 2 0.000 1.000 0.000 1.00 0.000
#> GSM862489 2 0.000 1.000 0.000 1.00 0.000
#> GSM862490 2 0.000 1.000 0.000 1.00 0.000
#> GSM862491 2 0.000 1.000 0.000 1.00 0.000
#> GSM862492 2 0.000 1.000 0.000 1.00 0.000
#> GSM862493 2 0.000 1.000 0.000 1.00 0.000
#> GSM862494 2 0.000 1.000 0.000 1.00 0.000
#> GSM862495 2 0.000 1.000 0.000 1.00 0.000
#> GSM862496 2 0.000 1.000 0.000 1.00 0.000
#> GSM862497 2 0.000 1.000 0.000 1.00 0.000
#> GSM862498 2 0.000 1.000 0.000 1.00 0.000
#> GSM862499 2 0.000 1.000 0.000 1.00 0.000
#> GSM862500 2 0.000 1.000 0.000 1.00 0.000
#> GSM862501 2 0.000 1.000 0.000 1.00 0.000
#> GSM862502 3 0.400 0.727 0.000 0.16 0.840
#> GSM862503 2 0.000 1.000 0.000 1.00 0.000
#> GSM862504 2 0.000 1.000 0.000 1.00 0.000
#> GSM862505 3 0.400 0.727 0.000 0.16 0.840
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> GSM862441 4 0.0592 0.947 0.000 0.000 0.016 0.984
#> GSM862442 4 0.2843 0.922 0.088 0.000 0.020 0.892
#> GSM862443 4 0.0000 0.950 0.000 0.000 0.000 1.000
#> GSM862444 4 0.0000 0.950 0.000 0.000 0.000 1.000
#> GSM862445 4 0.0336 0.946 0.000 0.000 0.008 0.992
#> GSM862446 4 0.0000 0.950 0.000 0.000 0.000 1.000
#> GSM862447 4 0.0000 0.950 0.000 0.000 0.000 1.000
#> GSM862448 4 0.2843 0.922 0.088 0.000 0.020 0.892
#> GSM862449 4 0.0000 0.950 0.000 0.000 0.000 1.000
#> GSM862450 4 0.0000 0.950 0.000 0.000 0.000 1.000
#> GSM862451 4 0.2843 0.922 0.088 0.000 0.020 0.892
#> GSM862453 1 0.6065 0.969 0.644 0.000 0.276 0.080
#> GSM862454 1 0.6065 0.969 0.644 0.000 0.276 0.080
#> GSM862455 1 0.6065 0.969 0.644 0.000 0.276 0.080
#> GSM862456 1 0.6065 0.969 0.644 0.000 0.276 0.080
#> GSM862457 4 0.0000 0.950 0.000 0.000 0.000 1.000
#> GSM862458 4 0.0927 0.935 0.016 0.000 0.008 0.976
#> GSM862459 4 0.2843 0.922 0.088 0.000 0.020 0.892
#> GSM862460 4 0.2843 0.922 0.088 0.000 0.020 0.892
#> GSM862461 4 0.2843 0.922 0.088 0.000 0.020 0.892
#> GSM862462 4 0.0000 0.950 0.000 0.000 0.000 1.000
#> GSM862463 1 0.6065 0.969 0.644 0.000 0.276 0.080
#> GSM862464 4 0.0000 0.950 0.000 0.000 0.000 1.000
#> GSM862465 1 0.5911 0.823 0.584 0.000 0.372 0.044
#> GSM862466 4 0.2843 0.922 0.088 0.000 0.020 0.892
#> GSM862467 4 0.4472 0.779 0.220 0.000 0.020 0.760
#> GSM862468 4 0.0000 0.950 0.000 0.000 0.000 1.000
#> GSM862469 2 0.0000 0.899 0.000 1.000 0.000 0.000
#> GSM862470 2 0.0000 0.899 0.000 1.000 0.000 0.000
#> GSM862471 2 0.0000 0.899 0.000 1.000 0.000 0.000
#> GSM862472 2 0.0000 0.899 0.000 1.000 0.000 0.000
#> GSM862473 2 0.0000 0.899 0.000 1.000 0.000 0.000
#> GSM862474 2 0.0000 0.899 0.000 1.000 0.000 0.000
#> GSM862475 2 0.0000 0.899 0.000 1.000 0.000 0.000
#> GSM862476 2 0.0336 0.897 0.008 0.992 0.000 0.000
#> GSM862477 2 0.0000 0.899 0.000 1.000 0.000 0.000
#> GSM862478 2 0.0000 0.899 0.000 1.000 0.000 0.000
#> GSM862479 2 0.0000 0.899 0.000 1.000 0.000 0.000
#> GSM862480 2 0.0000 0.899 0.000 1.000 0.000 0.000
#> GSM862481 2 0.0000 0.899 0.000 1.000 0.000 0.000
#> GSM862482 2 0.0592 0.893 0.016 0.984 0.000 0.000
#> GSM862483 2 0.0188 0.896 0.000 0.996 0.004 0.000
#> GSM862484 2 0.0000 0.899 0.000 1.000 0.000 0.000
#> GSM862485 2 0.0000 0.899 0.000 1.000 0.000 0.000
#> GSM862486 2 0.0000 0.899 0.000 1.000 0.000 0.000
#> GSM862487 2 0.4193 0.791 0.268 0.732 0.000 0.000
#> GSM862488 2 0.0000 0.899 0.000 1.000 0.000 0.000
#> GSM862489 2 0.4193 0.791 0.268 0.732 0.000 0.000
#> GSM862490 2 0.0000 0.899 0.000 1.000 0.000 0.000
#> GSM862491 2 0.4193 0.791 0.268 0.732 0.000 0.000
#> GSM862492 2 0.6351 0.672 0.268 0.628 0.104 0.000
#> GSM862493 2 0.4072 0.800 0.252 0.748 0.000 0.000
#> GSM862494 2 0.4193 0.791 0.268 0.732 0.000 0.000
#> GSM862495 2 0.4193 0.791 0.268 0.732 0.000 0.000
#> GSM862496 2 0.4193 0.791 0.268 0.732 0.000 0.000
#> GSM862497 2 0.3764 0.819 0.216 0.784 0.000 0.000
#> GSM862498 2 0.4134 0.796 0.260 0.740 0.000 0.000
#> GSM862499 2 0.3311 0.839 0.172 0.828 0.000 0.000
#> GSM862500 2 0.3311 0.839 0.172 0.828 0.000 0.000
#> GSM862501 2 0.0000 0.899 0.000 1.000 0.000 0.000
#> GSM862502 3 0.1109 1.000 0.004 0.028 0.968 0.000
#> GSM862503 2 0.4193 0.791 0.268 0.732 0.000 0.000
#> GSM862504 2 0.0000 0.899 0.000 1.000 0.000 0.000
#> GSM862505 3 0.1109 1.000 0.004 0.028 0.968 0.000
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> GSM862441 1 0.1205 0.844 0.956 0.000 0.004 0.040 0.000
#> GSM862442 1 0.3913 0.757 0.676 0.000 0.000 0.324 0.000
#> GSM862443 1 0.0162 0.848 0.996 0.000 0.004 0.000 0.000
#> GSM862444 1 0.0162 0.848 0.996 0.000 0.004 0.000 0.000
#> GSM862445 1 0.2069 0.809 0.912 0.000 0.076 0.000 0.012
#> GSM862446 1 0.0000 0.848 1.000 0.000 0.000 0.000 0.000
#> GSM862447 1 0.0000 0.848 1.000 0.000 0.000 0.000 0.000
#> GSM862448 1 0.4047 0.757 0.676 0.000 0.004 0.320 0.000
#> GSM862449 1 0.0693 0.846 0.980 0.000 0.012 0.000 0.008
#> GSM862450 1 0.0000 0.848 1.000 0.000 0.000 0.000 0.000
#> GSM862451 1 0.4047 0.757 0.676 0.000 0.004 0.320 0.000
#> GSM862453 4 0.5028 0.935 0.008 0.000 0.276 0.668 0.048
#> GSM862454 4 0.5028 0.935 0.008 0.000 0.276 0.668 0.048
#> GSM862455 4 0.5071 0.931 0.008 0.000 0.284 0.660 0.048
#> GSM862456 4 0.5028 0.935 0.008 0.000 0.276 0.668 0.048
#> GSM862457 1 0.0693 0.846 0.980 0.000 0.012 0.000 0.008
#> GSM862458 1 0.2069 0.809 0.912 0.000 0.076 0.000 0.012
#> GSM862459 1 0.4047 0.758 0.676 0.000 0.004 0.320 0.000
#> GSM862460 1 0.3913 0.757 0.676 0.000 0.000 0.324 0.000
#> GSM862461 1 0.3913 0.757 0.676 0.000 0.000 0.324 0.000
#> GSM862462 1 0.0162 0.848 0.996 0.000 0.004 0.000 0.000
#> GSM862463 4 0.5028 0.935 0.008 0.000 0.276 0.668 0.048
#> GSM862464 1 0.0000 0.848 1.000 0.000 0.000 0.000 0.000
#> GSM862465 4 0.6681 0.572 0.000 0.000 0.248 0.424 0.328
#> GSM862466 1 0.4047 0.757 0.676 0.000 0.004 0.320 0.000
#> GSM862467 1 0.4287 0.606 0.540 0.000 0.000 0.460 0.000
#> GSM862468 1 0.0162 0.848 0.996 0.000 0.004 0.000 0.000
#> GSM862469 2 0.0000 0.922 0.000 1.000 0.000 0.000 0.000
#> GSM862470 2 0.0000 0.922 0.000 1.000 0.000 0.000 0.000
#> GSM862471 2 0.0000 0.922 0.000 1.000 0.000 0.000 0.000
#> GSM862472 2 0.0000 0.922 0.000 1.000 0.000 0.000 0.000
#> GSM862473 2 0.0000 0.922 0.000 1.000 0.000 0.000 0.000
#> GSM862474 2 0.0000 0.922 0.000 1.000 0.000 0.000 0.000
#> GSM862475 2 0.0324 0.920 0.000 0.992 0.000 0.004 0.004
#> GSM862476 2 0.0833 0.907 0.000 0.976 0.016 0.004 0.004
#> GSM862477 2 0.0000 0.922 0.000 1.000 0.000 0.000 0.000
#> GSM862478 2 0.0486 0.918 0.000 0.988 0.004 0.004 0.004
#> GSM862479 2 0.0000 0.922 0.000 1.000 0.000 0.000 0.000
#> GSM862480 2 0.0613 0.916 0.000 0.984 0.008 0.004 0.004
#> GSM862481 2 0.0000 0.922 0.000 1.000 0.000 0.000 0.000
#> GSM862482 2 0.0324 0.919 0.000 0.992 0.004 0.004 0.000
#> GSM862483 2 0.0566 0.906 0.000 0.984 0.012 0.000 0.004
#> GSM862484 2 0.0000 0.922 0.000 1.000 0.000 0.000 0.000
#> GSM862485 2 0.0000 0.922 0.000 1.000 0.000 0.000 0.000
#> GSM862486 2 0.0000 0.922 0.000 1.000 0.000 0.000 0.000
#> GSM862487 3 0.4276 0.977 0.000 0.380 0.616 0.004 0.000
#> GSM862488 2 0.0324 0.920 0.000 0.992 0.000 0.004 0.004
#> GSM862489 3 0.4126 0.977 0.000 0.380 0.620 0.000 0.000
#> GSM862490 2 0.0613 0.916 0.000 0.984 0.008 0.004 0.004
#> GSM862491 3 0.4276 0.977 0.000 0.380 0.616 0.004 0.000
#> GSM862492 3 0.5219 0.899 0.000 0.328 0.616 0.004 0.052
#> GSM862493 3 0.4516 0.911 0.000 0.416 0.576 0.004 0.004
#> GSM862494 3 0.4276 0.975 0.000 0.380 0.616 0.000 0.004
#> GSM862495 3 0.4276 0.975 0.000 0.380 0.616 0.000 0.004
#> GSM862496 3 0.4276 0.977 0.000 0.380 0.616 0.004 0.000
#> GSM862497 2 0.4460 -0.378 0.000 0.600 0.392 0.004 0.004
#> GSM862498 3 0.4126 0.977 0.000 0.380 0.620 0.000 0.000
#> GSM862499 2 0.4081 0.133 0.000 0.696 0.296 0.004 0.004
#> GSM862500 2 0.4081 0.133 0.000 0.696 0.296 0.004 0.004
#> GSM862501 2 0.0613 0.916 0.000 0.984 0.008 0.004 0.004
#> GSM862502 5 0.0693 1.000 0.000 0.012 0.000 0.008 0.980
#> GSM862503 3 0.4276 0.977 0.000 0.380 0.616 0.004 0.000
#> GSM862504 2 0.0613 0.916 0.000 0.984 0.008 0.004 0.004
#> GSM862505 5 0.0693 1.000 0.000 0.012 0.000 0.008 0.980
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> GSM862441 4 0.2179 0.769 0.064 0.000 0.036 0.900 0.000 0.000
#> GSM862442 1 0.3866 0.965 0.516 0.000 0.000 0.484 0.000 0.000
#> GSM862443 4 0.0713 0.890 0.000 0.000 0.028 0.972 0.000 0.000
#> GSM862444 4 0.0291 0.896 0.004 0.000 0.004 0.992 0.000 0.000
#> GSM862445 4 0.3843 0.667 0.104 0.000 0.108 0.784 0.004 0.000
#> GSM862446 4 0.0547 0.893 0.000 0.000 0.020 0.980 0.000 0.000
#> GSM862447 4 0.0692 0.892 0.004 0.000 0.020 0.976 0.000 0.000
#> GSM862448 1 0.4407 0.953 0.492 0.000 0.024 0.484 0.000 0.000
#> GSM862449 4 0.1285 0.863 0.000 0.000 0.052 0.944 0.004 0.000
#> GSM862450 4 0.0000 0.896 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM862451 1 0.4314 0.961 0.500 0.000 0.012 0.484 0.004 0.000
#> GSM862453 6 0.0000 0.923 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM862454 6 0.0000 0.923 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM862455 6 0.0725 0.911 0.012 0.000 0.012 0.000 0.000 0.976
#> GSM862456 6 0.0000 0.923 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM862457 4 0.1285 0.863 0.000 0.000 0.052 0.944 0.004 0.000
#> GSM862458 4 0.3843 0.667 0.104 0.000 0.108 0.784 0.004 0.000
#> GSM862459 1 0.4264 0.961 0.500 0.000 0.016 0.484 0.000 0.000
#> GSM862460 1 0.3866 0.965 0.516 0.000 0.000 0.484 0.000 0.000
#> GSM862461 1 0.4264 0.963 0.500 0.000 0.016 0.484 0.000 0.000
#> GSM862462 4 0.0146 0.896 0.000 0.000 0.004 0.996 0.000 0.000
#> GSM862463 6 0.0000 0.923 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM862464 4 0.0000 0.896 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM862465 6 0.4530 0.486 0.020 0.000 0.024 0.000 0.308 0.648
#> GSM862466 1 0.4473 0.952 0.488 0.000 0.028 0.484 0.000 0.000
#> GSM862467 1 0.5100 0.882 0.504 0.000 0.008 0.436 0.004 0.048
#> GSM862468 4 0.0713 0.890 0.000 0.000 0.028 0.972 0.000 0.000
#> GSM862469 2 0.0000 0.828 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM862470 2 0.0000 0.828 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM862471 2 0.0000 0.828 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM862472 2 0.0000 0.828 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM862473 2 0.0000 0.828 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM862474 2 0.0000 0.828 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM862475 2 0.1814 0.805 0.100 0.900 0.000 0.000 0.000 0.000
#> GSM862476 2 0.4025 0.618 0.232 0.720 0.048 0.000 0.000 0.000
#> GSM862477 2 0.0000 0.828 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM862478 2 0.3189 0.683 0.236 0.760 0.004 0.000 0.000 0.000
#> GSM862479 2 0.0000 0.828 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM862480 2 0.2135 0.792 0.128 0.872 0.000 0.000 0.000 0.000
#> GSM862481 2 0.0000 0.828 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM862482 2 0.2119 0.789 0.060 0.904 0.036 0.000 0.000 0.000
#> GSM862483 2 0.2555 0.760 0.064 0.888 0.032 0.000 0.016 0.000
#> GSM862484 2 0.0000 0.828 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM862485 2 0.0865 0.817 0.036 0.964 0.000 0.000 0.000 0.000
#> GSM862486 2 0.0865 0.817 0.036 0.964 0.000 0.000 0.000 0.000
#> GSM862487 3 0.3974 0.858 0.048 0.224 0.728 0.000 0.000 0.000
#> GSM862488 2 0.1714 0.808 0.092 0.908 0.000 0.000 0.000 0.000
#> GSM862489 3 0.5173 0.852 0.160 0.224 0.616 0.000 0.000 0.000
#> GSM862490 2 0.3244 0.678 0.268 0.732 0.000 0.000 0.000 0.000
#> GSM862491 3 0.2969 0.844 0.000 0.224 0.776 0.000 0.000 0.000
#> GSM862492 3 0.4425 0.767 0.044 0.192 0.732 0.000 0.032 0.000
#> GSM862493 3 0.5835 0.729 0.232 0.280 0.488 0.000 0.000 0.000
#> GSM862494 3 0.5551 0.819 0.220 0.224 0.556 0.000 0.000 0.000
#> GSM862495 3 0.5611 0.812 0.232 0.224 0.544 0.000 0.000 0.000
#> GSM862496 3 0.2969 0.844 0.000 0.224 0.776 0.000 0.000 0.000
#> GSM862497 2 0.5998 -0.248 0.264 0.436 0.300 0.000 0.000 0.000
#> GSM862498 3 0.5231 0.850 0.168 0.224 0.608 0.000 0.000 0.000
#> GSM862499 2 0.5527 0.198 0.232 0.560 0.208 0.000 0.000 0.000
#> GSM862500 2 0.5527 0.198 0.232 0.560 0.208 0.000 0.000 0.000
#> GSM862501 2 0.3221 0.679 0.264 0.736 0.000 0.000 0.000 0.000
#> GSM862502 5 0.0692 0.998 0.000 0.004 0.000 0.000 0.976 0.020
#> GSM862503 3 0.2969 0.844 0.000 0.224 0.776 0.000 0.000 0.000
#> GSM862504 2 0.3457 0.666 0.232 0.752 0.016 0.000 0.000 0.000
#> GSM862505 5 0.0837 0.998 0.004 0.004 0.000 0.000 0.972 0.020
Heatmaps for the consensus matrix. It visualizes the probability of two samples to be in a same group.
consensus_heatmap(res, k = 2)
consensus_heatmap(res, k = 3)
consensus_heatmap(res, k = 4)
consensus_heatmap(res, k = 5)
consensus_heatmap(res, k = 6)
Heatmaps for the membership of samples in all partitions to see how consistent they are:
membership_heatmap(res, k = 2)
membership_heatmap(res, k = 3)
membership_heatmap(res, k = 4)
membership_heatmap(res, k = 5)
membership_heatmap(res, k = 6)
As soon as we have had the classes for columns, we can look for signatures which are significantly different between classes which can be candidate marks for certain classes. Following are the heatmaps for signatures.
Signature heatmaps where rows are scaled:
get_signatures(res, k = 2)
get_signatures(res, k = 3)
get_signatures(res, k = 4)
get_signatures(res, k = 5)
get_signatures(res, k = 6)
Signature heatmaps where rows are not scaled:
get_signatures(res, k = 2, scale_rows = FALSE)
get_signatures(res, k = 3, scale_rows = FALSE)
get_signatures(res, k = 4, scale_rows = FALSE)
get_signatures(res, k = 5, scale_rows = FALSE)
get_signatures(res, k = 6, scale_rows = FALSE)
Compare the overlap of signatures from different k:
compare_signatures(res)
get_signature()
returns a data frame invisibly. TO get the list of signatures, the function
call should be assigned to a variable explicitly. In following code, if plot
argument is set
to FALSE
, no heatmap is plotted while only the differential analysis is performed.
# code only for demonstration
tb = get_signature(res, k = ..., plot = FALSE)
An example of the output of tb
is:
#> which_row fdr mean_1 mean_2 scaled_mean_1 scaled_mean_2 km
#> 1 38 0.042760348 8.373488 9.131774 -0.5533452 0.5164555 1
#> 2 40 0.018707592 7.106213 8.469186 -0.6173731 0.5762149 1
#> 3 55 0.019134737 10.221463 11.207825 -0.6159697 0.5749050 1
#> 4 59 0.006059896 5.921854 7.869574 -0.6899429 0.6439467 1
#> 5 60 0.018055526 8.928898 10.211722 -0.6204761 0.5791110 1
#> 6 98 0.009384629 15.714769 14.887706 0.6635654 -0.6193277 2
...
The columns in tb
are:
which_row
: row indices corresponding to the input matrix.fdr
: FDR for the differential test. mean_x
: The mean value in group x.scaled_mean_x
: The mean value in group x after rows are scaled.km
: Row groups if k-means clustering is applied to rows.UMAP plot which shows how samples are separated.
dimension_reduction(res, k = 2, method = "UMAP")
dimension_reduction(res, k = 3, method = "UMAP")
dimension_reduction(res, k = 4, method = "UMAP")
dimension_reduction(res, k = 5, method = "UMAP")
dimension_reduction(res, k = 6, method = "UMAP")
Following heatmap shows how subgroups are split when increasing k
:
collect_classes(res)
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 tissue(p) k
#> ATC:kmeans 64 9.65e-15 2
#> ATC:kmeans 64 2.74e-13 3
#> ATC:kmeans 64 8.21e-14 4
#> ATC:kmeans 61 1.79e-12 5
#> ATC:kmeans 60 1.22e-11 6
If matrix rows can be associated to genes, consider to use functional_enrichment(res,
...)
to perform function enrichment for the signature genes. See this vignette for more detailed explanations.
The object with results only for a single top-value method and a single partition method can be extracted as:
res = res_list["ATC", "skmeans"]
# you can also extract it by
# res = res_list["ATC:skmeans"]
A summary of res
and all the functions that can be applied to it:
res
#> A 'ConsensusPartition' object with k = 2, 3, 4, 5, 6.
#> On a matrix with 51941 rows and 64 columns.
#> Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'ATC' method.
#> Subgroups are detected by 'skmeans' method.
#> Performed in total 1250 partitions by row resampling.
#> Best k for subgroups seems to be 3.
#>
#> Following methods can be applied to this 'ConsensusPartition' object:
#> [1] "cola_report" "collect_classes" "collect_plots"
#> [4] "collect_stats" "colnames" "compare_signatures"
#> [7] "consensus_heatmap" "dimension_reduction" "functional_enrichment"
#> [10] "get_anno_col" "get_anno" "get_classes"
#> [13] "get_consensus" "get_matrix" "get_membership"
#> [16] "get_param" "get_signatures" "get_stats"
#> [19] "is_best_k" "is_stable_k" "membership_heatmap"
#> [22] "ncol" "nrow" "plot_ecdf"
#> [25] "rownames" "select_partition_number" "show"
#> [28] "suggest_best_k" "test_to_known_factors"
collect_plots()
function collects all the plots made from res
for all k
(number of partitions)
into one single page to provide an easy and fast comparison between different k
.
collect_plots(res)
The plots are:
k
and the heatmap of
predicted classes for each k
.k
.k
.k
.All the plots in panels can be made by individual functions and they are plotted later in this section.
select_partition_number()
produces several plots showing different
statistics for choosing “optimized” k
. There are following statistics:
k
;k
, the area increased is defined as \(A_k - A_{k-1}\).The detailed explanations of these statistics can be found in the cola vignette.
Generally speaking, lower PAC score, higher mean silhouette score or higher
concordance corresponds to better partition. Rand index and Jaccard index
measure how similar the current partition is compared to partition with k-1
.
If they are too similar, we won't accept k
is better than k-1
.
select_partition_number(res)
The numeric values for all these statistics can be obtained by get_stats()
.
get_stats(res)
#> k 1-PAC mean_silhouette concordance area_increased Rand Jaccard
#> 2 2 1.000 1.000 1.000 0.4960 0.504 0.504
#> 3 3 0.933 0.988 0.981 0.1611 0.897 0.798
#> 4 4 0.802 0.868 0.891 0.1783 0.876 0.700
#> 5 5 0.812 0.873 0.903 0.0487 0.942 0.810
#> 6 6 0.894 0.804 0.914 0.0699 0.981 0.928
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
#> GSM862441 1 0 1 1 0
#> GSM862442 1 0 1 1 0
#> GSM862443 1 0 1 1 0
#> GSM862444 1 0 1 1 0
#> GSM862445 1 0 1 1 0
#> GSM862446 1 0 1 1 0
#> GSM862447 1 0 1 1 0
#> GSM862448 1 0 1 1 0
#> GSM862449 1 0 1 1 0
#> GSM862450 1 0 1 1 0
#> GSM862451 1 0 1 1 0
#> GSM862453 1 0 1 1 0
#> GSM862454 1 0 1 1 0
#> GSM862455 1 0 1 1 0
#> GSM862456 1 0 1 1 0
#> GSM862457 1 0 1 1 0
#> GSM862458 1 0 1 1 0
#> GSM862459 1 0 1 1 0
#> GSM862460 1 0 1 1 0
#> GSM862461 1 0 1 1 0
#> GSM862462 1 0 1 1 0
#> GSM862463 1 0 1 1 0
#> GSM862464 1 0 1 1 0
#> GSM862465 1 0 1 1 0
#> GSM862466 1 0 1 1 0
#> GSM862467 1 0 1 1 0
#> GSM862468 1 0 1 1 0
#> GSM862469 2 0 1 0 1
#> GSM862470 2 0 1 0 1
#> GSM862471 2 0 1 0 1
#> GSM862472 2 0 1 0 1
#> GSM862473 2 0 1 0 1
#> GSM862474 2 0 1 0 1
#> GSM862475 2 0 1 0 1
#> GSM862476 2 0 1 0 1
#> GSM862477 2 0 1 0 1
#> GSM862478 2 0 1 0 1
#> GSM862479 2 0 1 0 1
#> GSM862480 2 0 1 0 1
#> GSM862481 2 0 1 0 1
#> GSM862482 2 0 1 0 1
#> GSM862483 2 0 1 0 1
#> GSM862484 2 0 1 0 1
#> GSM862485 2 0 1 0 1
#> GSM862486 2 0 1 0 1
#> GSM862487 2 0 1 0 1
#> GSM862488 2 0 1 0 1
#> GSM862489 2 0 1 0 1
#> GSM862490 2 0 1 0 1
#> GSM862491 2 0 1 0 1
#> GSM862492 2 0 1 0 1
#> GSM862493 2 0 1 0 1
#> GSM862494 2 0 1 0 1
#> GSM862495 2 0 1 0 1
#> GSM862496 2 0 1 0 1
#> GSM862497 2 0 1 0 1
#> GSM862498 2 0 1 0 1
#> GSM862499 2 0 1 0 1
#> GSM862500 2 0 1 0 1
#> GSM862501 2 0 1 0 1
#> GSM862502 2 0 1 0 1
#> GSM862503 2 0 1 0 1
#> GSM862504 2 0 1 0 1
#> GSM862505 2 0 1 0 1
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> GSM862441 1 0.000 1.000 1.0 0 0.0
#> GSM862442 1 0.000 1.000 1.0 0 0.0
#> GSM862443 1 0.000 1.000 1.0 0 0.0
#> GSM862444 1 0.000 1.000 1.0 0 0.0
#> GSM862445 1 0.000 1.000 1.0 0 0.0
#> GSM862446 1 0.000 1.000 1.0 0 0.0
#> GSM862447 1 0.000 1.000 1.0 0 0.0
#> GSM862448 1 0.000 1.000 1.0 0 0.0
#> GSM862449 1 0.000 1.000 1.0 0 0.0
#> GSM862450 1 0.000 1.000 1.0 0 0.0
#> GSM862451 1 0.000 1.000 1.0 0 0.0
#> GSM862453 3 0.455 0.929 0.2 0 0.8
#> GSM862454 3 0.455 0.929 0.2 0 0.8
#> GSM862455 3 0.455 0.929 0.2 0 0.8
#> GSM862456 3 0.455 0.929 0.2 0 0.8
#> GSM862457 1 0.000 1.000 1.0 0 0.0
#> GSM862458 1 0.000 1.000 1.0 0 0.0
#> GSM862459 1 0.000 1.000 1.0 0 0.0
#> GSM862460 1 0.000 1.000 1.0 0 0.0
#> GSM862461 1 0.000 1.000 1.0 0 0.0
#> GSM862462 1 0.000 1.000 1.0 0 0.0
#> GSM862463 3 0.455 0.929 0.2 0 0.8
#> GSM862464 1 0.000 1.000 1.0 0 0.0
#> GSM862465 3 0.455 0.929 0.2 0 0.8
#> GSM862466 1 0.000 1.000 1.0 0 0.0
#> GSM862467 1 0.000 1.000 1.0 0 0.0
#> GSM862468 1 0.000 1.000 1.0 0 0.0
#> GSM862469 2 0.000 1.000 0.0 1 0.0
#> GSM862470 2 0.000 1.000 0.0 1 0.0
#> GSM862471 2 0.000 1.000 0.0 1 0.0
#> GSM862472 2 0.000 1.000 0.0 1 0.0
#> GSM862473 2 0.000 1.000 0.0 1 0.0
#> GSM862474 2 0.000 1.000 0.0 1 0.0
#> GSM862475 2 0.000 1.000 0.0 1 0.0
#> GSM862476 2 0.000 1.000 0.0 1 0.0
#> GSM862477 2 0.000 1.000 0.0 1 0.0
#> GSM862478 2 0.000 1.000 0.0 1 0.0
#> GSM862479 2 0.000 1.000 0.0 1 0.0
#> GSM862480 2 0.000 1.000 0.0 1 0.0
#> GSM862481 2 0.000 1.000 0.0 1 0.0
#> GSM862482 2 0.000 1.000 0.0 1 0.0
#> GSM862483 2 0.000 1.000 0.0 1 0.0
#> GSM862484 2 0.000 1.000 0.0 1 0.0
#> GSM862485 2 0.000 1.000 0.0 1 0.0
#> GSM862486 2 0.000 1.000 0.0 1 0.0
#> GSM862487 2 0.000 1.000 0.0 1 0.0
#> GSM862488 2 0.000 1.000 0.0 1 0.0
#> GSM862489 2 0.000 1.000 0.0 1 0.0
#> GSM862490 2 0.000 1.000 0.0 1 0.0
#> GSM862491 2 0.000 1.000 0.0 1 0.0
#> GSM862492 2 0.000 1.000 0.0 1 0.0
#> GSM862493 2 0.000 1.000 0.0 1 0.0
#> GSM862494 2 0.000 1.000 0.0 1 0.0
#> GSM862495 2 0.000 1.000 0.0 1 0.0
#> GSM862496 2 0.000 1.000 0.0 1 0.0
#> GSM862497 2 0.000 1.000 0.0 1 0.0
#> GSM862498 2 0.000 1.000 0.0 1 0.0
#> GSM862499 2 0.000 1.000 0.0 1 0.0
#> GSM862500 2 0.000 1.000 0.0 1 0.0
#> GSM862501 2 0.000 1.000 0.0 1 0.0
#> GSM862502 3 0.000 0.816 0.0 0 1.0
#> GSM862503 2 0.000 1.000 0.0 1 0.0
#> GSM862504 2 0.000 1.000 0.0 1 0.0
#> GSM862505 3 0.000 0.816 0.0 0 1.0
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> GSM862441 4 0.0188 0.9408 0.004 0.000 0.000 0.996
#> GSM862442 4 0.3123 0.8734 0.156 0.000 0.000 0.844
#> GSM862443 4 0.0000 0.9411 0.000 0.000 0.000 1.000
#> GSM862444 4 0.1792 0.9209 0.068 0.000 0.000 0.932
#> GSM862445 4 0.0592 0.9340 0.000 0.000 0.016 0.984
#> GSM862446 4 0.0000 0.9411 0.000 0.000 0.000 1.000
#> GSM862447 4 0.0000 0.9411 0.000 0.000 0.000 1.000
#> GSM862448 4 0.1474 0.9275 0.052 0.000 0.000 0.948
#> GSM862449 4 0.0469 0.9362 0.000 0.000 0.012 0.988
#> GSM862450 4 0.0000 0.9411 0.000 0.000 0.000 1.000
#> GSM862451 4 0.3123 0.8734 0.156 0.000 0.000 0.844
#> GSM862453 1 0.0592 0.9243 0.984 0.000 0.000 0.016
#> GSM862454 1 0.0592 0.9243 0.984 0.000 0.000 0.016
#> GSM862455 1 0.0592 0.9243 0.984 0.000 0.000 0.016
#> GSM862456 1 0.0592 0.9243 0.984 0.000 0.000 0.016
#> GSM862457 4 0.0469 0.9362 0.000 0.000 0.012 0.988
#> GSM862458 4 0.0592 0.9340 0.000 0.000 0.016 0.984
#> GSM862459 4 0.3172 0.8703 0.160 0.000 0.000 0.840
#> GSM862460 4 0.3172 0.8703 0.160 0.000 0.000 0.840
#> GSM862461 4 0.3123 0.8734 0.156 0.000 0.000 0.844
#> GSM862462 4 0.0000 0.9411 0.000 0.000 0.000 1.000
#> GSM862463 1 0.0592 0.9243 0.984 0.000 0.000 0.016
#> GSM862464 4 0.0000 0.9411 0.000 0.000 0.000 1.000
#> GSM862465 1 0.0592 0.9243 0.984 0.000 0.000 0.016
#> GSM862466 4 0.0469 0.9395 0.012 0.000 0.000 0.988
#> GSM862467 4 0.3172 0.8703 0.160 0.000 0.000 0.840
#> GSM862468 4 0.0000 0.9411 0.000 0.000 0.000 1.000
#> GSM862469 2 0.0000 0.9218 0.000 1.000 0.000 0.000
#> GSM862470 2 0.0000 0.9218 0.000 1.000 0.000 0.000
#> GSM862471 2 0.0000 0.9218 0.000 1.000 0.000 0.000
#> GSM862472 2 0.0000 0.9218 0.000 1.000 0.000 0.000
#> GSM862473 2 0.0000 0.9218 0.000 1.000 0.000 0.000
#> GSM862474 2 0.0000 0.9218 0.000 1.000 0.000 0.000
#> GSM862475 2 0.0000 0.9218 0.000 1.000 0.000 0.000
#> GSM862476 2 0.2469 0.7493 0.000 0.892 0.108 0.000
#> GSM862477 2 0.0000 0.9218 0.000 1.000 0.000 0.000
#> GSM862478 2 0.0000 0.9218 0.000 1.000 0.000 0.000
#> GSM862479 2 0.0000 0.9218 0.000 1.000 0.000 0.000
#> GSM862480 2 0.0000 0.9218 0.000 1.000 0.000 0.000
#> GSM862481 2 0.0000 0.9218 0.000 1.000 0.000 0.000
#> GSM862482 2 0.0000 0.9218 0.000 1.000 0.000 0.000
#> GSM862483 2 0.0000 0.9218 0.000 1.000 0.000 0.000
#> GSM862484 2 0.0000 0.9218 0.000 1.000 0.000 0.000
#> GSM862485 2 0.0000 0.9218 0.000 1.000 0.000 0.000
#> GSM862486 2 0.0000 0.9218 0.000 1.000 0.000 0.000
#> GSM862487 3 0.4817 0.9527 0.000 0.388 0.612 0.000
#> GSM862488 2 0.0000 0.9218 0.000 1.000 0.000 0.000
#> GSM862489 3 0.4830 0.9526 0.000 0.392 0.608 0.000
#> GSM862490 2 0.0000 0.9218 0.000 1.000 0.000 0.000
#> GSM862491 3 0.4804 0.9513 0.000 0.384 0.616 0.000
#> GSM862492 3 0.3610 0.6979 0.000 0.200 0.800 0.000
#> GSM862493 3 0.4843 0.9466 0.000 0.396 0.604 0.000
#> GSM862494 3 0.4830 0.9526 0.000 0.392 0.608 0.000
#> GSM862495 3 0.4830 0.9526 0.000 0.392 0.608 0.000
#> GSM862496 3 0.4804 0.9513 0.000 0.384 0.616 0.000
#> GSM862497 2 0.4730 -0.2030 0.000 0.636 0.364 0.000
#> GSM862498 3 0.4830 0.9526 0.000 0.392 0.608 0.000
#> GSM862499 2 0.4543 0.0202 0.000 0.676 0.324 0.000
#> GSM862500 2 0.4543 0.0202 0.000 0.676 0.324 0.000
#> GSM862501 2 0.0000 0.9218 0.000 1.000 0.000 0.000
#> GSM862502 1 0.4776 0.7539 0.624 0.000 0.376 0.000
#> GSM862503 3 0.4804 0.9513 0.000 0.384 0.616 0.000
#> GSM862504 2 0.0000 0.9218 0.000 1.000 0.000 0.000
#> GSM862505 1 0.4776 0.7539 0.624 0.000 0.376 0.000
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> GSM862441 1 0.0000 0.940 1.000 0.000 0.000 0.000 0.000
#> GSM862442 1 0.0963 0.932 0.964 0.000 0.000 0.036 0.000
#> GSM862443 1 0.0000 0.940 1.000 0.000 0.000 0.000 0.000
#> GSM862444 1 0.0609 0.937 0.980 0.000 0.000 0.020 0.000
#> GSM862445 1 0.4981 0.714 0.704 0.000 0.188 0.000 0.108
#> GSM862446 1 0.0000 0.940 1.000 0.000 0.000 0.000 0.000
#> GSM862447 1 0.0000 0.940 1.000 0.000 0.000 0.000 0.000
#> GSM862448 1 0.0162 0.939 0.996 0.000 0.000 0.004 0.000
#> GSM862449 1 0.2470 0.886 0.884 0.000 0.012 0.000 0.104
#> GSM862450 1 0.1952 0.903 0.912 0.000 0.004 0.000 0.084
#> GSM862451 1 0.1043 0.930 0.960 0.000 0.000 0.040 0.000
#> GSM862453 4 0.0000 1.000 0.000 0.000 0.000 1.000 0.000
#> GSM862454 4 0.0000 1.000 0.000 0.000 0.000 1.000 0.000
#> GSM862455 4 0.0000 1.000 0.000 0.000 0.000 1.000 0.000
#> GSM862456 4 0.0000 1.000 0.000 0.000 0.000 1.000 0.000
#> GSM862457 1 0.2522 0.883 0.880 0.000 0.012 0.000 0.108
#> GSM862458 1 0.5379 0.647 0.648 0.000 0.244 0.000 0.108
#> GSM862459 1 0.1043 0.930 0.960 0.000 0.000 0.040 0.000
#> GSM862460 1 0.1043 0.930 0.960 0.000 0.000 0.040 0.000
#> GSM862461 1 0.0404 0.938 0.988 0.000 0.000 0.012 0.000
#> GSM862462 1 0.0000 0.940 1.000 0.000 0.000 0.000 0.000
#> GSM862463 4 0.0000 1.000 0.000 0.000 0.000 1.000 0.000
#> GSM862464 1 0.1952 0.903 0.912 0.000 0.004 0.000 0.084
#> GSM862465 4 0.0000 1.000 0.000 0.000 0.000 1.000 0.000
#> GSM862466 1 0.0000 0.940 1.000 0.000 0.000 0.000 0.000
#> GSM862467 1 0.1043 0.930 0.960 0.000 0.000 0.040 0.000
#> GSM862468 1 0.0000 0.940 1.000 0.000 0.000 0.000 0.000
#> GSM862469 2 0.0000 0.955 0.000 1.000 0.000 0.000 0.000
#> GSM862470 2 0.0000 0.955 0.000 1.000 0.000 0.000 0.000
#> GSM862471 2 0.0000 0.955 0.000 1.000 0.000 0.000 0.000
#> GSM862472 2 0.0000 0.955 0.000 1.000 0.000 0.000 0.000
#> GSM862473 2 0.0000 0.955 0.000 1.000 0.000 0.000 0.000
#> GSM862474 2 0.0000 0.955 0.000 1.000 0.000 0.000 0.000
#> GSM862475 2 0.0000 0.955 0.000 1.000 0.000 0.000 0.000
#> GSM862476 2 0.4235 -0.337 0.000 0.576 0.424 0.000 0.000
#> GSM862477 2 0.0000 0.955 0.000 1.000 0.000 0.000 0.000
#> GSM862478 2 0.0963 0.913 0.000 0.964 0.036 0.000 0.000
#> GSM862479 2 0.0000 0.955 0.000 1.000 0.000 0.000 0.000
#> GSM862480 2 0.0000 0.955 0.000 1.000 0.000 0.000 0.000
#> GSM862481 2 0.0000 0.955 0.000 1.000 0.000 0.000 0.000
#> GSM862482 2 0.0000 0.955 0.000 1.000 0.000 0.000 0.000
#> GSM862483 2 0.0000 0.955 0.000 1.000 0.000 0.000 0.000
#> GSM862484 2 0.0000 0.955 0.000 1.000 0.000 0.000 0.000
#> GSM862485 2 0.0000 0.955 0.000 1.000 0.000 0.000 0.000
#> GSM862486 2 0.0000 0.955 0.000 1.000 0.000 0.000 0.000
#> GSM862487 3 0.3728 0.894 0.000 0.244 0.748 0.000 0.008
#> GSM862488 2 0.0000 0.955 0.000 1.000 0.000 0.000 0.000
#> GSM862489 3 0.3452 0.894 0.000 0.244 0.756 0.000 0.000
#> GSM862490 2 0.0162 0.952 0.000 0.996 0.004 0.000 0.000
#> GSM862491 3 0.3728 0.894 0.000 0.244 0.748 0.000 0.008
#> GSM862492 5 0.6044 0.218 0.000 0.188 0.236 0.000 0.576
#> GSM862493 3 0.3730 0.868 0.000 0.288 0.712 0.000 0.000
#> GSM862494 3 0.3452 0.894 0.000 0.244 0.756 0.000 0.000
#> GSM862495 3 0.3607 0.894 0.000 0.244 0.752 0.000 0.004
#> GSM862496 3 0.3728 0.894 0.000 0.244 0.748 0.000 0.008
#> GSM862497 3 0.4126 0.778 0.000 0.380 0.620 0.000 0.000
#> GSM862498 3 0.3452 0.894 0.000 0.244 0.756 0.000 0.000
#> GSM862499 3 0.4297 0.609 0.000 0.472 0.528 0.000 0.000
#> GSM862500 3 0.4300 0.599 0.000 0.476 0.524 0.000 0.000
#> GSM862501 2 0.0290 0.948 0.000 0.992 0.008 0.000 0.000
#> GSM862502 5 0.2179 0.652 0.000 0.000 0.000 0.112 0.888
#> GSM862503 3 0.3728 0.894 0.000 0.244 0.748 0.000 0.008
#> GSM862504 2 0.2773 0.680 0.000 0.836 0.164 0.000 0.000
#> GSM862505 5 0.2179 0.652 0.000 0.000 0.000 0.112 0.888
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> GSM862441 1 0.0291 0.8582 0.992 0.000 0.004 0.004 0.000 0.000
#> GSM862442 1 0.0937 0.8463 0.960 0.000 0.000 0.000 0.000 0.040
#> GSM862443 1 0.0508 0.8574 0.984 0.000 0.004 0.012 0.000 0.000
#> GSM862444 1 0.1176 0.8563 0.956 0.000 0.000 0.024 0.000 0.020
#> GSM862445 4 0.1910 0.8851 0.108 0.000 0.000 0.892 0.000 0.000
#> GSM862446 1 0.1285 0.8424 0.944 0.000 0.004 0.052 0.000 0.000
#> GSM862447 1 0.1010 0.8504 0.960 0.000 0.004 0.036 0.000 0.000
#> GSM862448 1 0.0000 0.8581 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM862449 1 0.3995 0.1220 0.516 0.000 0.004 0.480 0.000 0.000
#> GSM862450 1 0.3819 0.4193 0.624 0.000 0.004 0.372 0.000 0.000
#> GSM862451 1 0.1007 0.8444 0.956 0.000 0.000 0.000 0.000 0.044
#> GSM862453 6 0.0000 0.9992 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM862454 6 0.0000 0.9992 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM862455 6 0.0000 0.9992 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM862456 6 0.0000 0.9992 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM862457 1 0.3996 0.1080 0.512 0.000 0.004 0.484 0.000 0.000
#> GSM862458 4 0.0937 0.8808 0.040 0.000 0.000 0.960 0.000 0.000
#> GSM862459 1 0.1267 0.8342 0.940 0.000 0.000 0.000 0.000 0.060
#> GSM862460 1 0.1141 0.8398 0.948 0.000 0.000 0.000 0.000 0.052
#> GSM862461 1 0.0000 0.8581 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM862462 1 0.1152 0.8472 0.952 0.000 0.004 0.044 0.000 0.000
#> GSM862463 6 0.0000 0.9992 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM862464 1 0.3782 0.4437 0.636 0.000 0.004 0.360 0.000 0.000
#> GSM862465 6 0.0146 0.9961 0.000 0.000 0.000 0.000 0.004 0.996
#> GSM862466 1 0.0000 0.8581 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM862467 1 0.1267 0.8342 0.940 0.000 0.000 0.000 0.000 0.060
#> GSM862468 1 0.0405 0.8580 0.988 0.000 0.004 0.008 0.000 0.000
#> GSM862469 2 0.0146 0.9471 0.000 0.996 0.000 0.000 0.004 0.000
#> GSM862470 2 0.0000 0.9466 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM862471 2 0.0146 0.9471 0.000 0.996 0.000 0.000 0.004 0.000
#> GSM862472 2 0.0146 0.9451 0.000 0.996 0.000 0.004 0.000 0.000
#> GSM862473 2 0.0000 0.9466 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM862474 2 0.0146 0.9471 0.000 0.996 0.000 0.000 0.004 0.000
#> GSM862475 2 0.0000 0.9466 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM862476 2 0.4395 0.0903 0.000 0.568 0.404 0.028 0.000 0.000
#> GSM862477 2 0.0146 0.9471 0.000 0.996 0.000 0.000 0.004 0.000
#> GSM862478 2 0.2199 0.8516 0.000 0.892 0.088 0.020 0.000 0.000
#> GSM862479 2 0.0000 0.9466 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM862480 2 0.0603 0.9355 0.000 0.980 0.016 0.004 0.000 0.000
#> GSM862481 2 0.0146 0.9471 0.000 0.996 0.000 0.000 0.004 0.000
#> GSM862482 2 0.1082 0.9096 0.000 0.956 0.040 0.000 0.004 0.000
#> GSM862483 2 0.0146 0.9471 0.000 0.996 0.000 0.000 0.004 0.000
#> GSM862484 2 0.0146 0.9471 0.000 0.996 0.000 0.000 0.004 0.000
#> GSM862485 2 0.0146 0.9471 0.000 0.996 0.000 0.000 0.004 0.000
#> GSM862486 2 0.0146 0.9471 0.000 0.996 0.000 0.000 0.004 0.000
#> GSM862487 3 0.1511 0.8058 0.000 0.044 0.940 0.012 0.004 0.000
#> GSM862488 2 0.0146 0.9471 0.000 0.996 0.000 0.000 0.004 0.000
#> GSM862489 3 0.1461 0.8050 0.000 0.044 0.940 0.016 0.000 0.000
#> GSM862490 2 0.1088 0.9225 0.000 0.960 0.024 0.016 0.000 0.000
#> GSM862491 3 0.1511 0.8058 0.000 0.044 0.940 0.012 0.004 0.000
#> GSM862492 5 0.4601 0.4866 0.000 0.044 0.308 0.008 0.640 0.000
#> GSM862493 3 0.2432 0.7693 0.000 0.100 0.876 0.024 0.000 0.000
#> GSM862494 3 0.1152 0.8071 0.000 0.044 0.952 0.004 0.000 0.000
#> GSM862495 3 0.1461 0.8070 0.000 0.044 0.940 0.016 0.000 0.000
#> GSM862496 3 0.1511 0.8058 0.000 0.044 0.940 0.012 0.004 0.000
#> GSM862497 3 0.3487 0.6464 0.000 0.224 0.756 0.020 0.000 0.000
#> GSM862498 3 0.1633 0.8023 0.000 0.044 0.932 0.024 0.000 0.000
#> GSM862499 3 0.4460 0.2682 0.000 0.452 0.520 0.028 0.000 0.000
#> GSM862500 3 0.4456 0.2801 0.000 0.448 0.524 0.028 0.000 0.000
#> GSM862501 2 0.1334 0.9132 0.000 0.948 0.032 0.020 0.000 0.000
#> GSM862502 5 0.0146 0.7290 0.000 0.000 0.000 0.000 0.996 0.004
#> GSM862503 3 0.1511 0.8058 0.000 0.044 0.940 0.012 0.004 0.000
#> GSM862504 2 0.3470 0.6681 0.000 0.772 0.200 0.028 0.000 0.000
#> GSM862505 5 0.0146 0.7290 0.000 0.000 0.000 0.000 0.996 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 tissue(p) k
#> ATC:skmeans 64 9.65e-15 2
#> ATC:skmeans 64 2.74e-13 3
#> ATC:skmeans 61 7.14e-12 4
#> ATC:skmeans 62 1.10e-12 5
#> ATC:skmeans 56 8.13e-11 6
If matrix rows can be associated to genes, consider to use functional_enrichment(res,
...)
to perform function enrichment for the signature genes. See this vignette for more detailed explanations.
The object with results only for a single top-value method and a single partition method can be extracted as:
res = res_list["ATC", "pam"]
# you can also extract it by
# res = res_list["ATC:pam"]
A summary of res
and all the functions that can be applied to it:
res
#> A 'ConsensusPartition' object with k = 2, 3, 4, 5, 6.
#> On a matrix with 51941 rows and 64 columns.
#> Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'ATC' method.
#> Subgroups are detected by 'pam' method.
#> Performed in total 1250 partitions by row resampling.
#> Best k for subgroups seems to be 4.
#>
#> Following methods can be applied to this 'ConsensusPartition' object:
#> [1] "cola_report" "collect_classes" "collect_plots"
#> [4] "collect_stats" "colnames" "compare_signatures"
#> [7] "consensus_heatmap" "dimension_reduction" "functional_enrichment"
#> [10] "get_anno_col" "get_anno" "get_classes"
#> [13] "get_consensus" "get_matrix" "get_membership"
#> [16] "get_param" "get_signatures" "get_stats"
#> [19] "is_best_k" "is_stable_k" "membership_heatmap"
#> [22] "ncol" "nrow" "plot_ecdf"
#> [25] "rownames" "select_partition_number" "show"
#> [28] "suggest_best_k" "test_to_known_factors"
collect_plots()
function collects all the plots made from res
for all k
(number of partitions)
into one single page to provide an easy and fast comparison between different k
.
collect_plots(res)
The plots are:
k
and the heatmap of
predicted classes for each k
.k
.k
.k
.All the plots in panels can be made by individual functions and they are plotted later in this section.
select_partition_number()
produces several plots showing different
statistics for choosing “optimized” k
. There are following statistics:
k
;k
, the area increased is defined as \(A_k - A_{k-1}\).The detailed explanations of these statistics can be found in the cola vignette.
Generally speaking, lower PAC score, higher mean silhouette score or higher
concordance corresponds to better partition. Rand index and Jaccard index
measure how similar the current partition is compared to partition with k-1
.
If they are too similar, we won't accept k
is better than k-1
.
select_partition_number(res)
The numeric values for all these statistics can be obtained by get_stats()
.
get_stats(res)
#> k 1-PAC mean_silhouette concordance area_increased Rand Jaccard
#> 2 2 1.000 1.000 1.000 0.4960 0.504 0.504
#> 3 3 1.000 0.974 0.989 0.1438 0.938 0.876
#> 4 4 0.987 0.959 0.971 0.0568 0.965 0.921
#> 5 5 0.752 0.768 0.860 0.2057 0.849 0.630
#> 6 6 0.833 0.796 0.913 0.0888 0.901 0.646
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
#> GSM862441 1 0.0000 1.000 1.000 0.000
#> GSM862442 1 0.0000 1.000 1.000 0.000
#> GSM862443 1 0.0000 1.000 1.000 0.000
#> GSM862444 1 0.0000 1.000 1.000 0.000
#> GSM862445 1 0.0000 1.000 1.000 0.000
#> GSM862446 1 0.0000 1.000 1.000 0.000
#> GSM862447 1 0.0000 1.000 1.000 0.000
#> GSM862448 1 0.0000 1.000 1.000 0.000
#> GSM862449 1 0.0000 1.000 1.000 0.000
#> GSM862450 1 0.0000 1.000 1.000 0.000
#> GSM862451 1 0.0000 1.000 1.000 0.000
#> GSM862453 1 0.0000 1.000 1.000 0.000
#> GSM862454 1 0.0000 1.000 1.000 0.000
#> GSM862455 1 0.0000 1.000 1.000 0.000
#> GSM862456 1 0.0000 1.000 1.000 0.000
#> GSM862457 1 0.0000 1.000 1.000 0.000
#> GSM862458 1 0.0672 0.992 0.992 0.008
#> GSM862459 1 0.0000 1.000 1.000 0.000
#> GSM862460 1 0.0000 1.000 1.000 0.000
#> GSM862461 1 0.0000 1.000 1.000 0.000
#> GSM862462 1 0.0000 1.000 1.000 0.000
#> GSM862463 1 0.0000 1.000 1.000 0.000
#> GSM862464 1 0.0000 1.000 1.000 0.000
#> GSM862465 1 0.0000 1.000 1.000 0.000
#> GSM862466 1 0.0000 1.000 1.000 0.000
#> GSM862467 1 0.0000 1.000 1.000 0.000
#> GSM862468 1 0.0000 1.000 1.000 0.000
#> GSM862469 2 0.0000 1.000 0.000 1.000
#> GSM862470 2 0.0000 1.000 0.000 1.000
#> GSM862471 2 0.0000 1.000 0.000 1.000
#> GSM862472 2 0.0000 1.000 0.000 1.000
#> GSM862473 2 0.0000 1.000 0.000 1.000
#> GSM862474 2 0.0000 1.000 0.000 1.000
#> GSM862475 2 0.0000 1.000 0.000 1.000
#> GSM862476 2 0.0000 1.000 0.000 1.000
#> GSM862477 2 0.0000 1.000 0.000 1.000
#> GSM862478 2 0.0000 1.000 0.000 1.000
#> GSM862479 2 0.0000 1.000 0.000 1.000
#> GSM862480 2 0.0000 1.000 0.000 1.000
#> GSM862481 2 0.0000 1.000 0.000 1.000
#> GSM862482 2 0.0000 1.000 0.000 1.000
#> GSM862483 2 0.0000 1.000 0.000 1.000
#> GSM862484 2 0.0000 1.000 0.000 1.000
#> GSM862485 2 0.0000 1.000 0.000 1.000
#> GSM862486 2 0.0000 1.000 0.000 1.000
#> GSM862487 2 0.0000 1.000 0.000 1.000
#> GSM862488 2 0.0000 1.000 0.000 1.000
#> GSM862489 2 0.0000 1.000 0.000 1.000
#> GSM862490 2 0.0000 1.000 0.000 1.000
#> GSM862491 2 0.0000 1.000 0.000 1.000
#> GSM862492 2 0.0000 1.000 0.000 1.000
#> GSM862493 2 0.0000 1.000 0.000 1.000
#> GSM862494 2 0.0000 1.000 0.000 1.000
#> GSM862495 2 0.0000 1.000 0.000 1.000
#> GSM862496 2 0.0000 1.000 0.000 1.000
#> GSM862497 2 0.0000 1.000 0.000 1.000
#> GSM862498 2 0.0000 1.000 0.000 1.000
#> GSM862499 2 0.0000 1.000 0.000 1.000
#> GSM862500 2 0.0000 1.000 0.000 1.000
#> GSM862501 2 0.0000 1.000 0.000 1.000
#> GSM862502 2 0.0000 1.000 0.000 1.000
#> GSM862503 2 0.0000 1.000 0.000 1.000
#> GSM862504 2 0.0000 1.000 0.000 1.000
#> GSM862505 2 0.0000 1.000 0.000 1.000
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> GSM862441 1 0.000 0.990 1.0 0.000 0.000
#> GSM862442 1 0.000 0.990 1.0 0.000 0.000
#> GSM862443 1 0.000 0.990 1.0 0.000 0.000
#> GSM862444 1 0.000 0.990 1.0 0.000 0.000
#> GSM862445 1 0.000 0.990 1.0 0.000 0.000
#> GSM862446 1 0.000 0.990 1.0 0.000 0.000
#> GSM862447 1 0.000 0.990 1.0 0.000 0.000
#> GSM862448 1 0.000 0.990 1.0 0.000 0.000
#> GSM862449 1 0.000 0.990 1.0 0.000 0.000
#> GSM862450 1 0.000 0.990 1.0 0.000 0.000
#> GSM862451 1 0.000 0.990 1.0 0.000 0.000
#> GSM862453 3 0.000 1.000 0.0 0.000 1.000
#> GSM862454 3 0.000 1.000 0.0 0.000 1.000
#> GSM862455 3 0.000 1.000 0.0 0.000 1.000
#> GSM862456 3 0.000 1.000 0.0 0.000 1.000
#> GSM862457 1 0.000 0.990 1.0 0.000 0.000
#> GSM862458 1 0.000 0.990 1.0 0.000 0.000
#> GSM862459 1 0.000 0.990 1.0 0.000 0.000
#> GSM862460 1 0.000 0.990 1.0 0.000 0.000
#> GSM862461 1 0.000 0.990 1.0 0.000 0.000
#> GSM862462 1 0.000 0.990 1.0 0.000 0.000
#> GSM862463 3 0.000 1.000 0.0 0.000 1.000
#> GSM862464 1 0.000 0.990 1.0 0.000 0.000
#> GSM862465 3 0.000 1.000 0.0 0.000 1.000
#> GSM862466 1 0.000 0.990 1.0 0.000 0.000
#> GSM862467 1 0.455 0.751 0.8 0.000 0.200
#> GSM862468 1 0.000 0.990 1.0 0.000 0.000
#> GSM862469 2 0.000 0.986 0.0 1.000 0.000
#> GSM862470 2 0.000 0.986 0.0 1.000 0.000
#> GSM862471 2 0.000 0.986 0.0 1.000 0.000
#> GSM862472 2 0.000 0.986 0.0 1.000 0.000
#> GSM862473 2 0.000 0.986 0.0 1.000 0.000
#> GSM862474 2 0.000 0.986 0.0 1.000 0.000
#> GSM862475 2 0.000 0.986 0.0 1.000 0.000
#> GSM862476 2 0.000 0.986 0.0 1.000 0.000
#> GSM862477 2 0.000 0.986 0.0 1.000 0.000
#> GSM862478 2 0.000 0.986 0.0 1.000 0.000
#> GSM862479 2 0.000 0.986 0.0 1.000 0.000
#> GSM862480 2 0.000 0.986 0.0 1.000 0.000
#> GSM862481 2 0.000 0.986 0.0 1.000 0.000
#> GSM862482 2 0.000 0.986 0.0 1.000 0.000
#> GSM862483 2 0.000 0.986 0.0 1.000 0.000
#> GSM862484 2 0.000 0.986 0.0 1.000 0.000
#> GSM862485 2 0.000 0.986 0.0 1.000 0.000
#> GSM862486 2 0.000 0.986 0.0 1.000 0.000
#> GSM862487 2 0.000 0.986 0.0 1.000 0.000
#> GSM862488 2 0.000 0.986 0.0 1.000 0.000
#> GSM862489 2 0.000 0.986 0.0 1.000 0.000
#> GSM862490 2 0.000 0.986 0.0 1.000 0.000
#> GSM862491 2 0.000 0.986 0.0 1.000 0.000
#> GSM862492 2 0.000 0.986 0.0 1.000 0.000
#> GSM862493 2 0.000 0.986 0.0 1.000 0.000
#> GSM862494 2 0.000 0.986 0.0 1.000 0.000
#> GSM862495 2 0.000 0.986 0.0 1.000 0.000
#> GSM862496 2 0.000 0.986 0.0 1.000 0.000
#> GSM862497 2 0.000 0.986 0.0 1.000 0.000
#> GSM862498 2 0.000 0.986 0.0 1.000 0.000
#> GSM862499 2 0.000 0.986 0.0 1.000 0.000
#> GSM862500 2 0.000 0.986 0.0 1.000 0.000
#> GSM862501 2 0.000 0.986 0.0 1.000 0.000
#> GSM862502 2 0.424 0.785 0.0 0.824 0.176
#> GSM862503 2 0.000 0.986 0.0 1.000 0.000
#> GSM862504 2 0.000 0.986 0.0 1.000 0.000
#> GSM862505 2 0.583 0.499 0.0 0.660 0.340
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> GSM862441 4 0.0000 0.952 0.000 0.000 0.000 1.000
#> GSM862442 4 0.0000 0.952 0.000 0.000 0.000 1.000
#> GSM862443 4 0.2081 0.951 0.000 0.000 0.084 0.916
#> GSM862444 4 0.0336 0.952 0.000 0.000 0.008 0.992
#> GSM862445 4 0.2081 0.951 0.000 0.000 0.084 0.916
#> GSM862446 4 0.2081 0.951 0.000 0.000 0.084 0.916
#> GSM862447 4 0.0000 0.952 0.000 0.000 0.000 1.000
#> GSM862448 4 0.0000 0.952 0.000 0.000 0.000 1.000
#> GSM862449 4 0.2081 0.951 0.000 0.000 0.084 0.916
#> GSM862450 4 0.2081 0.951 0.000 0.000 0.084 0.916
#> GSM862451 4 0.0000 0.952 0.000 0.000 0.000 1.000
#> GSM862453 1 0.0000 0.918 1.000 0.000 0.000 0.000
#> GSM862454 1 0.0000 0.918 1.000 0.000 0.000 0.000
#> GSM862455 1 0.0000 0.918 1.000 0.000 0.000 0.000
#> GSM862456 1 0.0000 0.918 1.000 0.000 0.000 0.000
#> GSM862457 4 0.2081 0.951 0.000 0.000 0.084 0.916
#> GSM862458 4 0.2081 0.951 0.000 0.000 0.084 0.916
#> GSM862459 4 0.0000 0.952 0.000 0.000 0.000 1.000
#> GSM862460 4 0.0000 0.952 0.000 0.000 0.000 1.000
#> GSM862461 4 0.0000 0.952 0.000 0.000 0.000 1.000
#> GSM862462 4 0.2081 0.951 0.000 0.000 0.084 0.916
#> GSM862463 1 0.0000 0.918 1.000 0.000 0.000 0.000
#> GSM862464 4 0.2081 0.951 0.000 0.000 0.084 0.916
#> GSM862465 1 0.4830 0.388 0.608 0.000 0.392 0.000
#> GSM862466 4 0.0000 0.952 0.000 0.000 0.000 1.000
#> GSM862467 4 0.2589 0.841 0.116 0.000 0.000 0.884
#> GSM862468 4 0.2081 0.951 0.000 0.000 0.084 0.916
#> GSM862469 2 0.0000 0.989 0.000 1.000 0.000 0.000
#> GSM862470 2 0.0000 0.989 0.000 1.000 0.000 0.000
#> GSM862471 2 0.0000 0.989 0.000 1.000 0.000 0.000
#> GSM862472 2 0.0000 0.989 0.000 1.000 0.000 0.000
#> GSM862473 2 0.0000 0.989 0.000 1.000 0.000 0.000
#> GSM862474 2 0.0000 0.989 0.000 1.000 0.000 0.000
#> GSM862475 2 0.0000 0.989 0.000 1.000 0.000 0.000
#> GSM862476 2 0.0000 0.989 0.000 1.000 0.000 0.000
#> GSM862477 2 0.0000 0.989 0.000 1.000 0.000 0.000
#> GSM862478 2 0.0000 0.989 0.000 1.000 0.000 0.000
#> GSM862479 2 0.0000 0.989 0.000 1.000 0.000 0.000
#> GSM862480 2 0.0000 0.989 0.000 1.000 0.000 0.000
#> GSM862481 2 0.0000 0.989 0.000 1.000 0.000 0.000
#> GSM862482 2 0.0817 0.981 0.000 0.976 0.024 0.000
#> GSM862483 2 0.0000 0.989 0.000 1.000 0.000 0.000
#> GSM862484 2 0.0000 0.989 0.000 1.000 0.000 0.000
#> GSM862485 2 0.0000 0.989 0.000 1.000 0.000 0.000
#> GSM862486 2 0.0000 0.989 0.000 1.000 0.000 0.000
#> GSM862487 2 0.0921 0.979 0.000 0.972 0.028 0.000
#> GSM862488 2 0.0000 0.989 0.000 1.000 0.000 0.000
#> GSM862489 2 0.0921 0.979 0.000 0.972 0.028 0.000
#> GSM862490 2 0.0000 0.989 0.000 1.000 0.000 0.000
#> GSM862491 2 0.0921 0.979 0.000 0.972 0.028 0.000
#> GSM862492 2 0.0921 0.979 0.000 0.972 0.028 0.000
#> GSM862493 2 0.0921 0.979 0.000 0.972 0.028 0.000
#> GSM862494 2 0.0921 0.979 0.000 0.972 0.028 0.000
#> GSM862495 2 0.0921 0.979 0.000 0.972 0.028 0.000
#> GSM862496 2 0.0921 0.979 0.000 0.972 0.028 0.000
#> GSM862497 2 0.0921 0.979 0.000 0.972 0.028 0.000
#> GSM862498 2 0.0921 0.979 0.000 0.972 0.028 0.000
#> GSM862499 2 0.0000 0.989 0.000 1.000 0.000 0.000
#> GSM862500 2 0.0188 0.988 0.000 0.996 0.004 0.000
#> GSM862501 2 0.0000 0.989 0.000 1.000 0.000 0.000
#> GSM862502 3 0.2081 1.000 0.000 0.084 0.916 0.000
#> GSM862503 2 0.0921 0.979 0.000 0.972 0.028 0.000
#> GSM862504 2 0.0000 0.989 0.000 1.000 0.000 0.000
#> GSM862505 3 0.2081 1.000 0.000 0.084 0.916 0.000
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> GSM862441 1 0.000 0.8962 1.000 0.000 0.000 0.000 0.000
#> GSM862442 1 0.000 0.8962 1.000 0.000 0.000 0.000 0.000
#> GSM862443 1 0.311 0.8866 0.800 0.000 0.000 0.000 0.200
#> GSM862444 1 0.051 0.8962 0.984 0.000 0.000 0.000 0.016
#> GSM862445 1 0.311 0.8866 0.800 0.000 0.000 0.000 0.200
#> GSM862446 1 0.311 0.8866 0.800 0.000 0.000 0.000 0.200
#> GSM862447 1 0.000 0.8962 1.000 0.000 0.000 0.000 0.000
#> GSM862448 1 0.000 0.8962 1.000 0.000 0.000 0.000 0.000
#> GSM862449 1 0.311 0.8866 0.800 0.000 0.000 0.000 0.200
#> GSM862450 1 0.311 0.8866 0.800 0.000 0.000 0.000 0.200
#> GSM862451 1 0.000 0.8962 1.000 0.000 0.000 0.000 0.000
#> GSM862453 4 0.000 0.9165 0.000 0.000 0.000 1.000 0.000
#> GSM862454 4 0.000 0.9165 0.000 0.000 0.000 1.000 0.000
#> GSM862455 4 0.000 0.9165 0.000 0.000 0.000 1.000 0.000
#> GSM862456 4 0.000 0.9165 0.000 0.000 0.000 1.000 0.000
#> GSM862457 1 0.311 0.8866 0.800 0.000 0.000 0.000 0.200
#> GSM862458 1 0.311 0.8866 0.800 0.000 0.000 0.000 0.200
#> GSM862459 1 0.000 0.8962 1.000 0.000 0.000 0.000 0.000
#> GSM862460 1 0.000 0.8962 1.000 0.000 0.000 0.000 0.000
#> GSM862461 1 0.000 0.8962 1.000 0.000 0.000 0.000 0.000
#> GSM862462 1 0.311 0.8866 0.800 0.000 0.000 0.000 0.200
#> GSM862463 4 0.000 0.9165 0.000 0.000 0.000 1.000 0.000
#> GSM862464 1 0.311 0.8866 0.800 0.000 0.000 0.000 0.200
#> GSM862465 4 0.416 0.3563 0.000 0.000 0.000 0.608 0.392
#> GSM862466 1 0.000 0.8962 1.000 0.000 0.000 0.000 0.000
#> GSM862467 1 0.000 0.8962 1.000 0.000 0.000 0.000 0.000
#> GSM862468 1 0.311 0.8866 0.800 0.000 0.000 0.000 0.200
#> GSM862469 3 0.000 0.8262 0.000 0.000 1.000 0.000 0.000
#> GSM862470 3 0.000 0.8262 0.000 0.000 1.000 0.000 0.000
#> GSM862471 3 0.000 0.8262 0.000 0.000 1.000 0.000 0.000
#> GSM862472 3 0.000 0.8262 0.000 0.000 1.000 0.000 0.000
#> GSM862473 3 0.000 0.8262 0.000 0.000 1.000 0.000 0.000
#> GSM862474 3 0.000 0.8262 0.000 0.000 1.000 0.000 0.000
#> GSM862475 3 0.414 0.0886 0.000 0.384 0.616 0.000 0.000
#> GSM862476 2 0.428 0.4982 0.000 0.548 0.452 0.000 0.000
#> GSM862477 3 0.000 0.8262 0.000 0.000 1.000 0.000 0.000
#> GSM862478 3 0.407 0.1206 0.000 0.364 0.636 0.000 0.000
#> GSM862479 3 0.000 0.8262 0.000 0.000 1.000 0.000 0.000
#> GSM862480 2 0.428 0.4982 0.000 0.548 0.452 0.000 0.000
#> GSM862481 3 0.000 0.8262 0.000 0.000 1.000 0.000 0.000
#> GSM862482 3 0.318 0.6020 0.000 0.208 0.792 0.000 0.000
#> GSM862483 3 0.000 0.8262 0.000 0.000 1.000 0.000 0.000
#> GSM862484 3 0.000 0.8262 0.000 0.000 1.000 0.000 0.000
#> GSM862485 3 0.120 0.7902 0.000 0.048 0.952 0.000 0.000
#> GSM862486 3 0.000 0.8262 0.000 0.000 1.000 0.000 0.000
#> GSM862487 2 0.285 0.8493 0.000 0.828 0.172 0.000 0.000
#> GSM862488 3 0.345 0.5318 0.000 0.244 0.756 0.000 0.000
#> GSM862489 2 0.285 0.8493 0.000 0.828 0.172 0.000 0.000
#> GSM862490 2 0.428 0.4982 0.000 0.548 0.452 0.000 0.000
#> GSM862491 2 0.285 0.8493 0.000 0.828 0.172 0.000 0.000
#> GSM862492 2 0.285 0.8493 0.000 0.828 0.172 0.000 0.000
#> GSM862493 2 0.285 0.8493 0.000 0.828 0.172 0.000 0.000
#> GSM862494 2 0.285 0.8493 0.000 0.828 0.172 0.000 0.000
#> GSM862495 2 0.285 0.8493 0.000 0.828 0.172 0.000 0.000
#> GSM862496 2 0.285 0.8493 0.000 0.828 0.172 0.000 0.000
#> GSM862497 2 0.285 0.8493 0.000 0.828 0.172 0.000 0.000
#> GSM862498 2 0.285 0.8493 0.000 0.828 0.172 0.000 0.000
#> GSM862499 2 0.426 0.5202 0.000 0.560 0.440 0.000 0.000
#> GSM862500 3 0.428 -0.2470 0.000 0.452 0.548 0.000 0.000
#> GSM862501 2 0.428 0.4878 0.000 0.544 0.456 0.000 0.000
#> GSM862502 5 0.311 1.0000 0.000 0.200 0.000 0.000 0.800
#> GSM862503 2 0.285 0.8493 0.000 0.828 0.172 0.000 0.000
#> GSM862504 3 0.425 -0.1720 0.000 0.432 0.568 0.000 0.000
#> GSM862505 5 0.311 1.0000 0.000 0.200 0.000 0.000 0.800
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> GSM862441 4 0.2793 0.762 0.200 0.000 0.00 0.800 0.000 0.000
#> GSM862442 1 0.0790 0.921 0.968 0.000 0.00 0.032 0.000 0.000
#> GSM862443 4 0.0000 0.941 0.000 0.000 0.00 1.000 0.000 0.000
#> GSM862444 4 0.2664 0.781 0.184 0.000 0.00 0.816 0.000 0.000
#> GSM862445 4 0.0000 0.941 0.000 0.000 0.00 1.000 0.000 0.000
#> GSM862446 4 0.0000 0.941 0.000 0.000 0.00 1.000 0.000 0.000
#> GSM862447 4 0.2793 0.762 0.200 0.000 0.00 0.800 0.000 0.000
#> GSM862448 1 0.2941 0.755 0.780 0.000 0.00 0.220 0.000 0.000
#> GSM862449 4 0.0000 0.941 0.000 0.000 0.00 1.000 0.000 0.000
#> GSM862450 4 0.0000 0.941 0.000 0.000 0.00 1.000 0.000 0.000
#> GSM862451 1 0.0790 0.921 0.968 0.000 0.00 0.032 0.000 0.000
#> GSM862453 6 0.0000 0.916 0.000 0.000 0.00 0.000 0.000 1.000
#> GSM862454 6 0.0000 0.916 0.000 0.000 0.00 0.000 0.000 1.000
#> GSM862455 6 0.0363 0.911 0.012 0.000 0.00 0.000 0.000 0.988
#> GSM862456 6 0.0000 0.916 0.000 0.000 0.00 0.000 0.000 1.000
#> GSM862457 4 0.0000 0.941 0.000 0.000 0.00 1.000 0.000 0.000
#> GSM862458 4 0.0000 0.941 0.000 0.000 0.00 1.000 0.000 0.000
#> GSM862459 1 0.0790 0.921 0.968 0.000 0.00 0.032 0.000 0.000
#> GSM862460 1 0.0790 0.921 0.968 0.000 0.00 0.032 0.000 0.000
#> GSM862461 1 0.0790 0.921 0.968 0.000 0.00 0.032 0.000 0.000
#> GSM862462 4 0.0000 0.941 0.000 0.000 0.00 1.000 0.000 0.000
#> GSM862463 6 0.0000 0.916 0.000 0.000 0.00 0.000 0.000 1.000
#> GSM862464 4 0.0000 0.941 0.000 0.000 0.00 1.000 0.000 0.000
#> GSM862465 6 0.4356 0.389 0.032 0.000 0.36 0.000 0.000 0.608
#> GSM862466 1 0.2941 0.755 0.780 0.000 0.00 0.220 0.000 0.000
#> GSM862467 1 0.0790 0.921 0.968 0.000 0.00 0.032 0.000 0.000
#> GSM862468 4 0.0000 0.941 0.000 0.000 0.00 1.000 0.000 0.000
#> GSM862469 2 0.0000 0.881 0.000 1.000 0.00 0.000 0.000 0.000
#> GSM862470 2 0.0000 0.881 0.000 1.000 0.00 0.000 0.000 0.000
#> GSM862471 2 0.0000 0.881 0.000 1.000 0.00 0.000 0.000 0.000
#> GSM862472 2 0.0000 0.881 0.000 1.000 0.00 0.000 0.000 0.000
#> GSM862473 2 0.0000 0.881 0.000 1.000 0.00 0.000 0.000 0.000
#> GSM862474 2 0.0000 0.881 0.000 1.000 0.00 0.000 0.000 0.000
#> GSM862475 5 0.3797 0.381 0.000 0.420 0.00 0.000 0.580 0.000
#> GSM862476 5 0.3221 0.682 0.000 0.264 0.00 0.000 0.736 0.000
#> GSM862477 2 0.0000 0.881 0.000 1.000 0.00 0.000 0.000 0.000
#> GSM862478 2 0.3860 -0.169 0.000 0.528 0.00 0.000 0.472 0.000
#> GSM862479 2 0.0000 0.881 0.000 1.000 0.00 0.000 0.000 0.000
#> GSM862480 5 0.3175 0.690 0.000 0.256 0.00 0.000 0.744 0.000
#> GSM862481 2 0.0000 0.881 0.000 1.000 0.00 0.000 0.000 0.000
#> GSM862482 2 0.3695 0.296 0.000 0.624 0.00 0.000 0.376 0.000
#> GSM862483 2 0.0000 0.881 0.000 1.000 0.00 0.000 0.000 0.000
#> GSM862484 2 0.0000 0.881 0.000 1.000 0.00 0.000 0.000 0.000
#> GSM862485 2 0.2631 0.712 0.000 0.820 0.00 0.000 0.180 0.000
#> GSM862486 2 0.0790 0.859 0.000 0.968 0.00 0.000 0.032 0.000
#> GSM862487 5 0.0000 0.808 0.000 0.000 0.00 0.000 1.000 0.000
#> GSM862488 2 0.3266 0.559 0.000 0.728 0.00 0.000 0.272 0.000
#> GSM862489 5 0.0000 0.808 0.000 0.000 0.00 0.000 1.000 0.000
#> GSM862490 5 0.3175 0.690 0.000 0.256 0.00 0.000 0.744 0.000
#> GSM862491 5 0.0000 0.808 0.000 0.000 0.00 0.000 1.000 0.000
#> GSM862492 5 0.0000 0.808 0.000 0.000 0.00 0.000 1.000 0.000
#> GSM862493 5 0.0000 0.808 0.000 0.000 0.00 0.000 1.000 0.000
#> GSM862494 5 0.0000 0.808 0.000 0.000 0.00 0.000 1.000 0.000
#> GSM862495 5 0.0000 0.808 0.000 0.000 0.00 0.000 1.000 0.000
#> GSM862496 5 0.0000 0.808 0.000 0.000 0.00 0.000 1.000 0.000
#> GSM862497 5 0.0000 0.808 0.000 0.000 0.00 0.000 1.000 0.000
#> GSM862498 5 0.0000 0.808 0.000 0.000 0.00 0.000 1.000 0.000
#> GSM862499 5 0.3175 0.690 0.000 0.256 0.00 0.000 0.744 0.000
#> GSM862500 5 0.3851 0.305 0.000 0.460 0.00 0.000 0.540 0.000
#> GSM862501 5 0.3198 0.686 0.000 0.260 0.00 0.000 0.740 0.000
#> GSM862502 3 0.0000 1.000 0.000 0.000 1.00 0.000 0.000 0.000
#> GSM862503 5 0.0000 0.808 0.000 0.000 0.00 0.000 1.000 0.000
#> GSM862504 5 0.3854 0.292 0.000 0.464 0.00 0.000 0.536 0.000
#> GSM862505 3 0.0000 1.000 0.000 0.000 1.00 0.000 0.000 0.000
Heatmaps for the consensus matrix. It visualizes the probability of two samples to be in a same group.
consensus_heatmap(res, k = 2)
consensus_heatmap(res, k = 3)
consensus_heatmap(res, k = 4)
consensus_heatmap(res, k = 5)
consensus_heatmap(res, k = 6)
Heatmaps for the membership of samples in all partitions to see how consistent they are:
membership_heatmap(res, k = 2)
membership_heatmap(res, k = 3)
membership_heatmap(res, k = 4)
membership_heatmap(res, k = 5)
membership_heatmap(res, k = 6)
As soon as we have had the classes for columns, we can look for signatures which are significantly different between classes which can be candidate marks for certain classes. Following are the heatmaps for signatures.
Signature heatmaps where rows are scaled:
get_signatures(res, k = 2)
get_signatures(res, k = 3)
get_signatures(res, k = 4)
get_signatures(res, k = 5)
get_signatures(res, k = 6)
Signature heatmaps where rows are not scaled:
get_signatures(res, k = 2, scale_rows = FALSE)
get_signatures(res, k = 3, scale_rows = FALSE)
get_signatures(res, k = 4, scale_rows = FALSE)
get_signatures(res, k = 5, scale_rows = FALSE)
get_signatures(res, k = 6, scale_rows = FALSE)
Compare the overlap of signatures from different k:
compare_signatures(res)
get_signature()
returns a data frame invisibly. TO get the list of signatures, the function
call should be assigned to a variable explicitly. In following code, if plot
argument is set
to FALSE
, no heatmap is plotted while only the differential analysis is performed.
# code only for demonstration
tb = get_signature(res, k = ..., plot = FALSE)
An example of the output of tb
is:
#> which_row fdr mean_1 mean_2 scaled_mean_1 scaled_mean_2 km
#> 1 38 0.042760348 8.373488 9.131774 -0.5533452 0.5164555 1
#> 2 40 0.018707592 7.106213 8.469186 -0.6173731 0.5762149 1
#> 3 55 0.019134737 10.221463 11.207825 -0.6159697 0.5749050 1
#> 4 59 0.006059896 5.921854 7.869574 -0.6899429 0.6439467 1
#> 5 60 0.018055526 8.928898 10.211722 -0.6204761 0.5791110 1
#> 6 98 0.009384629 15.714769 14.887706 0.6635654 -0.6193277 2
...
The columns in tb
are:
which_row
: row indices corresponding to the input matrix.fdr
: FDR for the differential test. mean_x
: The mean value in group x.scaled_mean_x
: The mean value in group x after rows are scaled.km
: Row groups if k-means clustering is applied to rows.UMAP plot which shows how samples are separated.
dimension_reduction(res, k = 2, method = "UMAP")
dimension_reduction(res, k = 3, method = "UMAP")
dimension_reduction(res, k = 4, method = "UMAP")
dimension_reduction(res, k = 5, method = "UMAP")
dimension_reduction(res, k = 6, method = "UMAP")
Following heatmap shows how subgroups are split when increasing k
:
collect_classes(res)
Test correlation between subgroups and known annotations. If the known annotation is numeric, one-way ANOVA test is applied, and if the known annotation is discrete, chi-squared contingency table test is applied.
test_to_known_factors(res)
#> n tissue(p) k
#> ATC:pam 64 9.65e-15 2
#> ATC:pam 63 2.09e-14 3
#> ATC:pam 63 1.34e-13 4
#> ATC:pam 55 3.25e-11 5
#> ATC:pam 58 3.15e-11 6
If matrix rows can be associated to genes, consider to use functional_enrichment(res,
...)
to perform function enrichment for the signature genes. See this vignette for more detailed explanations.
The object with results only for a single top-value method and a single partition method can be extracted as:
res = res_list["ATC", "mclust"]
# you can also extract it by
# res = res_list["ATC:mclust"]
A summary of res
and all the functions that can be applied to it:
res
#> A 'ConsensusPartition' object with k = 2, 3, 4, 5, 6.
#> On a matrix with 51941 rows and 64 columns.
#> Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'ATC' method.
#> Subgroups are detected by 'mclust' method.
#> Performed in total 1250 partitions by row resampling.
#> Best k for subgroups seems to be 2.
#>
#> Following methods can be applied to this 'ConsensusPartition' object:
#> [1] "cola_report" "collect_classes" "collect_plots"
#> [4] "collect_stats" "colnames" "compare_signatures"
#> [7] "consensus_heatmap" "dimension_reduction" "functional_enrichment"
#> [10] "get_anno_col" "get_anno" "get_classes"
#> [13] "get_consensus" "get_matrix" "get_membership"
#> [16] "get_param" "get_signatures" "get_stats"
#> [19] "is_best_k" "is_stable_k" "membership_heatmap"
#> [22] "ncol" "nrow" "plot_ecdf"
#> [25] "rownames" "select_partition_number" "show"
#> [28] "suggest_best_k" "test_to_known_factors"
collect_plots()
function collects all the plots made from res
for all k
(number of partitions)
into one single page to provide an easy and fast comparison between different k
.
collect_plots(res)
The plots are:
k
and the heatmap of
predicted classes for each k
.k
.k
.k
.All the plots in panels can be made by individual functions and they are plotted later in this section.
select_partition_number()
produces several plots showing different
statistics for choosing “optimized” k
. There are following statistics:
k
;k
, the area increased is defined as \(A_k - A_{k-1}\).The detailed explanations of these statistics can be found in the cola vignette.
Generally speaking, lower PAC score, higher mean silhouette score or higher
concordance corresponds to better partition. Rand index and Jaccard index
measure how similar the current partition is compared to partition with k-1
.
If they are too similar, we won't accept k
is better than k-1
.
select_partition_number(res)
The numeric values for all these statistics can be obtained by get_stats()
.
get_stats(res)
#> k 1-PAC mean_silhouette concordance area_increased Rand Jaccard
#> 2 2 1.000 0.979 0.990 0.5077 0.492 0.492
#> 3 3 0.667 0.830 0.839 0.2068 0.891 0.778
#> 4 4 0.731 0.788 0.830 0.1139 0.933 0.845
#> 5 5 0.651 0.538 0.766 0.0579 0.894 0.743
#> 6 6 0.666 0.625 0.802 0.0279 0.949 0.846
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
#> GSM862441 1 0.000 0.980 1.000 0.000
#> GSM862442 1 0.000 0.980 1.000 0.000
#> GSM862443 1 0.000 0.980 1.000 0.000
#> GSM862444 1 0.000 0.980 1.000 0.000
#> GSM862445 1 0.000 0.980 1.000 0.000
#> GSM862446 1 0.000 0.980 1.000 0.000
#> GSM862447 1 0.000 0.980 1.000 0.000
#> GSM862448 1 0.000 0.980 1.000 0.000
#> GSM862449 1 0.000 0.980 1.000 0.000
#> GSM862450 1 0.000 0.980 1.000 0.000
#> GSM862451 1 0.000 0.980 1.000 0.000
#> GSM862453 1 0.000 0.980 1.000 0.000
#> GSM862454 1 0.000 0.980 1.000 0.000
#> GSM862455 1 0.000 0.980 1.000 0.000
#> GSM862456 1 0.000 0.980 1.000 0.000
#> GSM862457 1 0.000 0.980 1.000 0.000
#> GSM862458 1 0.000 0.980 1.000 0.000
#> GSM862459 1 0.000 0.980 1.000 0.000
#> GSM862460 1 0.000 0.980 1.000 0.000
#> GSM862461 1 0.000 0.980 1.000 0.000
#> GSM862462 1 0.000 0.980 1.000 0.000
#> GSM862463 1 0.000 0.980 1.000 0.000
#> GSM862464 1 0.000 0.980 1.000 0.000
#> GSM862465 1 0.000 0.980 1.000 0.000
#> GSM862466 1 0.000 0.980 1.000 0.000
#> GSM862467 1 0.000 0.980 1.000 0.000
#> GSM862468 1 0.000 0.980 1.000 0.000
#> GSM862469 2 0.000 1.000 0.000 1.000
#> GSM862470 2 0.000 1.000 0.000 1.000
#> GSM862471 2 0.000 1.000 0.000 1.000
#> GSM862472 2 0.000 1.000 0.000 1.000
#> GSM862473 2 0.000 1.000 0.000 1.000
#> GSM862474 2 0.000 1.000 0.000 1.000
#> GSM862475 2 0.000 1.000 0.000 1.000
#> GSM862476 2 0.000 1.000 0.000 1.000
#> GSM862477 2 0.000 1.000 0.000 1.000
#> GSM862478 2 0.000 1.000 0.000 1.000
#> GSM862479 2 0.000 1.000 0.000 1.000
#> GSM862480 2 0.000 1.000 0.000 1.000
#> GSM862481 2 0.000 1.000 0.000 1.000
#> GSM862482 1 0.595 0.835 0.856 0.144
#> GSM862483 1 0.662 0.800 0.828 0.172
#> GSM862484 2 0.000 1.000 0.000 1.000
#> GSM862485 2 0.000 1.000 0.000 1.000
#> GSM862486 2 0.000 1.000 0.000 1.000
#> GSM862487 2 0.000 1.000 0.000 1.000
#> GSM862488 2 0.000 1.000 0.000 1.000
#> GSM862489 2 0.000 1.000 0.000 1.000
#> GSM862490 2 0.000 1.000 0.000 1.000
#> GSM862491 2 0.000 1.000 0.000 1.000
#> GSM862492 1 0.886 0.584 0.696 0.304
#> GSM862493 2 0.000 1.000 0.000 1.000
#> GSM862494 2 0.000 1.000 0.000 1.000
#> GSM862495 2 0.000 1.000 0.000 1.000
#> GSM862496 2 0.000 1.000 0.000 1.000
#> GSM862497 2 0.000 1.000 0.000 1.000
#> GSM862498 2 0.000 1.000 0.000 1.000
#> GSM862499 2 0.000 1.000 0.000 1.000
#> GSM862500 2 0.000 1.000 0.000 1.000
#> GSM862501 2 0.000 1.000 0.000 1.000
#> GSM862502 1 0.000 0.980 1.000 0.000
#> GSM862503 2 0.000 1.000 0.000 1.000
#> GSM862504 2 0.000 1.000 0.000 1.000
#> GSM862505 1 0.000 0.980 1.000 0.000
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> GSM862441 1 0.0000 0.858 1.000 0.000 0.000
#> GSM862442 1 0.3686 0.717 0.860 0.000 0.140
#> GSM862443 1 0.0000 0.858 1.000 0.000 0.000
#> GSM862444 1 0.3686 0.717 0.860 0.000 0.140
#> GSM862445 1 0.0000 0.858 1.000 0.000 0.000
#> GSM862446 1 0.0000 0.858 1.000 0.000 0.000
#> GSM862447 1 0.0000 0.858 1.000 0.000 0.000
#> GSM862448 1 0.3686 0.717 0.860 0.000 0.140
#> GSM862449 1 0.0000 0.858 1.000 0.000 0.000
#> GSM862450 1 0.0000 0.858 1.000 0.000 0.000
#> GSM862451 1 0.3686 0.717 0.860 0.000 0.140
#> GSM862453 3 0.6305 0.897 0.484 0.000 0.516
#> GSM862454 3 0.6305 0.897 0.484 0.000 0.516
#> GSM862455 3 0.6305 0.897 0.484 0.000 0.516
#> GSM862456 3 0.6305 0.897 0.484 0.000 0.516
#> GSM862457 1 0.0000 0.858 1.000 0.000 0.000
#> GSM862458 1 0.0000 0.858 1.000 0.000 0.000
#> GSM862459 1 0.3686 0.717 0.860 0.000 0.140
#> GSM862460 1 0.3686 0.717 0.860 0.000 0.140
#> GSM862461 1 0.0000 0.858 1.000 0.000 0.000
#> GSM862462 1 0.0000 0.858 1.000 0.000 0.000
#> GSM862463 3 0.6305 0.897 0.484 0.000 0.516
#> GSM862464 1 0.0000 0.858 1.000 0.000 0.000
#> GSM862465 3 0.6305 0.897 0.484 0.000 0.516
#> GSM862466 1 0.0000 0.858 1.000 0.000 0.000
#> GSM862467 1 0.3686 0.717 0.860 0.000 0.140
#> GSM862468 1 0.0000 0.858 1.000 0.000 0.000
#> GSM862469 2 0.0592 0.898 0.000 0.988 0.012
#> GSM862470 2 0.2165 0.887 0.000 0.936 0.064
#> GSM862471 2 0.2165 0.887 0.000 0.936 0.064
#> GSM862472 2 0.3267 0.891 0.000 0.884 0.116
#> GSM862473 2 0.2356 0.883 0.000 0.928 0.072
#> GSM862474 2 0.2066 0.888 0.000 0.940 0.060
#> GSM862475 2 0.4555 0.876 0.000 0.800 0.200
#> GSM862476 2 0.1031 0.900 0.000 0.976 0.024
#> GSM862477 2 0.2356 0.883 0.000 0.928 0.072
#> GSM862478 2 0.0747 0.901 0.000 0.984 0.016
#> GSM862479 2 0.2261 0.885 0.000 0.932 0.068
#> GSM862480 2 0.4605 0.873 0.000 0.796 0.204
#> GSM862481 2 0.1529 0.893 0.000 0.960 0.040
#> GSM862482 3 0.5656 0.629 0.284 0.004 0.712
#> GSM862483 3 0.7537 0.638 0.332 0.056 0.612
#> GSM862484 2 0.1529 0.893 0.000 0.960 0.040
#> GSM862485 2 0.5058 0.857 0.000 0.756 0.244
#> GSM862486 2 0.4887 0.865 0.000 0.772 0.228
#> GSM862487 2 0.5016 0.870 0.000 0.760 0.240
#> GSM862488 2 0.5465 0.828 0.000 0.712 0.288
#> GSM862489 2 0.3619 0.894 0.000 0.864 0.136
#> GSM862490 2 0.5254 0.845 0.000 0.736 0.264
#> GSM862491 2 0.5016 0.870 0.000 0.760 0.240
#> GSM862492 1 0.9294 -0.549 0.484 0.172 0.344
#> GSM862493 2 0.1964 0.899 0.000 0.944 0.056
#> GSM862494 2 0.4887 0.874 0.000 0.772 0.228
#> GSM862495 2 0.6336 0.849 0.064 0.756 0.180
#> GSM862496 2 0.5016 0.870 0.000 0.760 0.240
#> GSM862497 2 0.4605 0.879 0.000 0.796 0.204
#> GSM862498 2 0.3619 0.885 0.000 0.864 0.136
#> GSM862499 2 0.2537 0.898 0.000 0.920 0.080
#> GSM862500 2 0.1529 0.900 0.000 0.960 0.040
#> GSM862501 2 0.1411 0.903 0.000 0.964 0.036
#> GSM862502 3 0.6305 0.897 0.484 0.000 0.516
#> GSM862503 2 0.5016 0.870 0.000 0.760 0.240
#> GSM862504 2 0.0592 0.899 0.000 0.988 0.012
#> GSM862505 3 0.6305 0.897 0.484 0.000 0.516
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> GSM862441 4 0.1042 0.8940 0.020 0.000 NA 0.972
#> GSM862442 4 0.6362 0.7474 0.168 0.000 NA 0.656
#> GSM862443 4 0.0469 0.8950 0.000 0.000 NA 0.988
#> GSM862444 4 0.5222 0.8199 0.112 0.000 NA 0.756
#> GSM862445 4 0.0000 0.8944 0.000 0.000 NA 1.000
#> GSM862446 4 0.0336 0.8953 0.000 0.000 NA 0.992
#> GSM862447 4 0.0469 0.8963 0.000 0.000 NA 0.988
#> GSM862448 4 0.5772 0.8007 0.116 0.000 NA 0.708
#> GSM862449 4 0.0336 0.8960 0.000 0.000 NA 0.992
#> GSM862450 4 0.0000 0.8944 0.000 0.000 NA 1.000
#> GSM862451 4 0.5850 0.7956 0.116 0.000 NA 0.700
#> GSM862453 1 0.0000 0.9595 1.000 0.000 NA 0.000
#> GSM862454 1 0.0000 0.9595 1.000 0.000 NA 0.000
#> GSM862455 1 0.1022 0.9575 0.968 0.000 NA 0.000
#> GSM862456 1 0.0000 0.9595 1.000 0.000 NA 0.000
#> GSM862457 4 0.0469 0.8961 0.000 0.000 NA 0.988
#> GSM862458 4 0.0895 0.8915 0.004 0.000 NA 0.976
#> GSM862459 4 0.5604 0.8078 0.116 0.000 NA 0.724
#> GSM862460 4 0.5783 0.7994 0.120 0.000 NA 0.708
#> GSM862461 4 0.2256 0.8861 0.020 0.000 NA 0.924
#> GSM862462 4 0.0188 0.8946 0.000 0.000 NA 0.996
#> GSM862463 1 0.0000 0.9595 1.000 0.000 NA 0.000
#> GSM862464 4 0.0000 0.8944 0.000 0.000 NA 1.000
#> GSM862465 1 0.2704 0.9411 0.876 0.000 NA 0.000
#> GSM862466 4 0.3842 0.8607 0.036 0.000 NA 0.836
#> GSM862467 4 0.6027 0.7862 0.124 0.000 NA 0.684
#> GSM862468 4 0.0188 0.8946 0.000 0.000 NA 0.996
#> GSM862469 2 0.4543 0.8046 0.000 0.676 NA 0.000
#> GSM862470 2 0.4776 0.7936 0.000 0.624 NA 0.000
#> GSM862471 2 0.4790 0.7935 0.000 0.620 NA 0.000
#> GSM862472 2 0.4477 0.7976 0.000 0.688 NA 0.000
#> GSM862473 2 0.4830 0.7896 0.000 0.608 NA 0.000
#> GSM862474 2 0.4790 0.7932 0.000 0.620 NA 0.000
#> GSM862475 2 0.1637 0.7496 0.000 0.940 NA 0.000
#> GSM862476 2 0.4585 0.8046 0.000 0.668 NA 0.000
#> GSM862477 2 0.4454 0.8031 0.000 0.692 NA 0.000
#> GSM862478 2 0.4134 0.8034 0.000 0.740 NA 0.000
#> GSM862479 2 0.4776 0.7939 0.000 0.624 NA 0.000
#> GSM862480 2 0.1389 0.7484 0.000 0.952 NA 0.000
#> GSM862481 2 0.4697 0.7988 0.000 0.644 NA 0.000
#> GSM862482 2 0.7878 -0.1921 0.340 0.376 NA 0.000
#> GSM862483 2 0.7815 0.0417 0.256 0.392 NA 0.000
#> GSM862484 2 0.4477 0.8050 0.000 0.688 NA 0.000
#> GSM862485 2 0.3569 0.6901 0.000 0.804 NA 0.000
#> GSM862486 2 0.2704 0.7411 0.000 0.876 NA 0.000
#> GSM862487 2 0.0469 0.7593 0.000 0.988 NA 0.000
#> GSM862488 2 0.3123 0.7251 0.000 0.844 NA 0.000
#> GSM862489 2 0.3610 0.8018 0.000 0.800 NA 0.000
#> GSM862490 2 0.2921 0.7351 0.000 0.860 NA 0.000
#> GSM862491 2 0.0469 0.7593 0.000 0.988 NA 0.000
#> GSM862492 2 0.6610 0.1044 0.452 0.468 NA 0.000
#> GSM862493 2 0.4585 0.8029 0.000 0.668 NA 0.000
#> GSM862494 2 0.0336 0.7604 0.000 0.992 NA 0.000
#> GSM862495 2 0.3004 0.7311 0.048 0.892 NA 0.000
#> GSM862496 2 0.0707 0.7569 0.000 0.980 NA 0.000
#> GSM862497 2 0.0469 0.7631 0.000 0.988 NA 0.000
#> GSM862498 2 0.4564 0.7915 0.000 0.672 NA 0.000
#> GSM862499 2 0.4356 0.7998 0.000 0.708 NA 0.000
#> GSM862500 2 0.4643 0.8007 0.000 0.656 NA 0.000
#> GSM862501 2 0.4040 0.8087 0.000 0.752 NA 0.000
#> GSM862502 1 0.3123 0.9327 0.844 0.000 NA 0.000
#> GSM862503 2 0.0469 0.7593 0.000 0.988 NA 0.000
#> GSM862504 2 0.4661 0.8006 0.000 0.652 NA 0.000
#> GSM862505 1 0.3123 0.9327 0.844 0.000 NA 0.000
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> GSM862441 1 0.3366 0.563004 0.768 0.000 0.232 0.000 0.000
#> GSM862442 3 0.5443 0.395895 0.436 0.000 0.504 0.060 0.000
#> GSM862443 1 0.1732 0.666668 0.920 0.000 0.080 0.000 0.000
#> GSM862444 1 0.4101 -0.113022 0.628 0.000 0.372 0.000 0.000
#> GSM862445 1 0.2424 0.630288 0.868 0.000 0.132 0.000 0.000
#> GSM862446 1 0.1270 0.684060 0.948 0.000 0.052 0.000 0.000
#> GSM862447 1 0.1608 0.689996 0.928 0.000 0.072 0.000 0.000
#> GSM862448 1 0.4291 -0.449074 0.536 0.000 0.464 0.000 0.000
#> GSM862449 1 0.1638 0.685041 0.932 0.000 0.064 0.004 0.000
#> GSM862450 1 0.1792 0.687315 0.916 0.000 0.084 0.000 0.000
#> GSM862451 3 0.3837 0.603869 0.308 0.000 0.692 0.000 0.000
#> GSM862453 4 0.4114 0.823319 0.000 0.000 0.376 0.624 0.000
#> GSM862454 4 0.4101 0.824870 0.000 0.000 0.372 0.628 0.000
#> GSM862455 4 0.3508 0.817824 0.000 0.000 0.252 0.748 0.000
#> GSM862456 4 0.4114 0.823276 0.000 0.000 0.376 0.624 0.000
#> GSM862457 1 0.1908 0.688615 0.908 0.000 0.092 0.000 0.000
#> GSM862458 1 0.3921 0.565917 0.812 0.000 0.128 0.048 0.012
#> GSM862459 3 0.4383 0.548696 0.424 0.000 0.572 0.004 0.000
#> GSM862460 3 0.4297 0.479202 0.472 0.000 0.528 0.000 0.000
#> GSM862461 3 0.4304 0.182921 0.484 0.000 0.516 0.000 0.000
#> GSM862462 1 0.1965 0.677514 0.904 0.000 0.096 0.000 0.000
#> GSM862463 4 0.4101 0.824870 0.000 0.000 0.372 0.628 0.000
#> GSM862464 1 0.1410 0.684832 0.940 0.000 0.060 0.000 0.000
#> GSM862465 4 0.0992 0.763258 0.000 0.000 0.008 0.968 0.024
#> GSM862466 1 0.4294 -0.341508 0.532 0.000 0.468 0.000 0.000
#> GSM862467 3 0.3300 0.573447 0.204 0.000 0.792 0.004 0.000
#> GSM862468 1 0.1121 0.693323 0.956 0.000 0.044 0.000 0.000
#> GSM862469 2 0.0880 0.722219 0.000 0.968 0.000 0.000 0.032
#> GSM862470 2 0.1608 0.710668 0.000 0.928 0.000 0.000 0.072
#> GSM862471 2 0.1478 0.714481 0.000 0.936 0.000 0.000 0.064
#> GSM862472 2 0.1121 0.714231 0.000 0.956 0.000 0.000 0.044
#> GSM862473 2 0.1671 0.706199 0.000 0.924 0.000 0.000 0.076
#> GSM862474 2 0.1608 0.705532 0.000 0.928 0.000 0.000 0.072
#> GSM862475 2 0.3816 0.507093 0.000 0.696 0.000 0.000 0.304
#> GSM862476 2 0.2605 0.710669 0.000 0.852 0.000 0.000 0.148
#> GSM862477 2 0.0609 0.721105 0.000 0.980 0.000 0.000 0.020
#> GSM862478 2 0.1908 0.705703 0.000 0.908 0.000 0.000 0.092
#> GSM862479 2 0.1608 0.705999 0.000 0.928 0.000 0.000 0.072
#> GSM862480 2 0.4030 0.354634 0.000 0.648 0.000 0.000 0.352
#> GSM862481 2 0.1341 0.715306 0.000 0.944 0.000 0.000 0.056
#> GSM862482 5 0.5123 0.339495 0.000 0.068 0.056 0.128 0.748
#> GSM862483 5 0.4397 0.373219 0.000 0.068 0.020 0.124 0.788
#> GSM862484 2 0.0703 0.721645 0.000 0.976 0.000 0.000 0.024
#> GSM862485 2 0.4219 0.130541 0.000 0.584 0.000 0.000 0.416
#> GSM862486 2 0.4138 0.262271 0.000 0.616 0.000 0.000 0.384
#> GSM862487 2 0.3684 0.565383 0.000 0.720 0.000 0.000 0.280
#> GSM862488 2 0.4307 -0.054211 0.000 0.504 0.000 0.000 0.496
#> GSM862489 2 0.3143 0.639582 0.000 0.796 0.000 0.000 0.204
#> GSM862490 5 0.4306 -0.207409 0.000 0.492 0.000 0.000 0.508
#> GSM862491 2 0.3684 0.565383 0.000 0.720 0.000 0.000 0.280
#> GSM862492 2 0.6740 -0.225285 0.000 0.412 0.000 0.284 0.304
#> GSM862493 2 0.2561 0.710700 0.000 0.856 0.000 0.000 0.144
#> GSM862494 2 0.3684 0.565383 0.000 0.720 0.000 0.000 0.280
#> GSM862495 5 0.4443 0.000478 0.000 0.472 0.000 0.004 0.524
#> GSM862496 2 0.3796 0.542138 0.000 0.700 0.000 0.000 0.300
#> GSM862497 2 0.3636 0.579144 0.000 0.728 0.000 0.000 0.272
#> GSM862498 2 0.3274 0.609322 0.000 0.780 0.000 0.000 0.220
#> GSM862499 2 0.1410 0.715898 0.000 0.940 0.000 0.000 0.060
#> GSM862500 2 0.1544 0.724277 0.000 0.932 0.000 0.000 0.068
#> GSM862501 2 0.1410 0.720956 0.000 0.940 0.000 0.000 0.060
#> GSM862502 4 0.1518 0.749723 0.000 0.004 0.004 0.944 0.048
#> GSM862503 2 0.3684 0.565383 0.000 0.720 0.000 0.000 0.280
#> GSM862504 2 0.1671 0.713441 0.000 0.924 0.000 0.000 0.076
#> GSM862505 4 0.1518 0.749723 0.000 0.004 0.004 0.944 0.048
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> GSM862441 4 0.4229 0.6737 0.292 0.000 0.000 0.668 0.040 0.000
#> GSM862442 1 0.5025 0.6480 0.672 0.000 0.000 0.200 0.016 0.112
#> GSM862443 4 0.3651 0.6792 0.180 0.000 0.000 0.772 0.048 0.000
#> GSM862444 1 0.4787 -0.0482 0.516 0.000 0.000 0.432 0.052 0.000
#> GSM862445 4 0.3171 0.7351 0.204 0.000 0.000 0.784 0.012 0.000
#> GSM862446 4 0.3683 0.6787 0.184 0.000 0.000 0.768 0.048 0.000
#> GSM862447 4 0.3585 0.6651 0.172 0.000 0.000 0.780 0.048 0.000
#> GSM862448 1 0.3411 0.6718 0.756 0.000 0.000 0.232 0.008 0.004
#> GSM862449 4 0.1908 0.7653 0.096 0.000 0.000 0.900 0.004 0.000
#> GSM862450 4 0.2402 0.7569 0.140 0.000 0.000 0.856 0.004 0.000
#> GSM862451 1 0.1750 0.7200 0.932 0.000 0.000 0.040 0.016 0.012
#> GSM862453 6 0.0858 0.8718 0.028 0.000 0.000 0.000 0.004 0.968
#> GSM862454 6 0.0000 0.8911 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM862455 6 0.3244 0.5053 0.000 0.000 0.000 0.000 0.268 0.732
#> GSM862456 6 0.0508 0.8838 0.004 0.000 0.000 0.000 0.012 0.984
#> GSM862457 4 0.2146 0.7556 0.116 0.000 0.000 0.880 0.004 0.000
#> GSM862458 4 0.4750 0.6567 0.176 0.000 0.000 0.712 0.088 0.024
#> GSM862459 1 0.3499 0.7226 0.816 0.000 0.000 0.128 0.020 0.036
#> GSM862460 1 0.3269 0.7249 0.828 0.000 0.000 0.128 0.016 0.028
#> GSM862461 1 0.4060 0.3660 0.680 0.000 0.000 0.296 0.016 0.008
#> GSM862462 4 0.3168 0.7515 0.172 0.000 0.000 0.804 0.024 0.000
#> GSM862463 6 0.0146 0.8906 0.000 0.000 0.000 0.000 0.004 0.996
#> GSM862464 4 0.1644 0.7660 0.076 0.000 0.000 0.920 0.004 0.000
#> GSM862465 5 0.3707 0.6274 0.008 0.000 0.000 0.000 0.680 0.312
#> GSM862466 1 0.4224 0.5664 0.640 0.000 0.000 0.336 0.008 0.016
#> GSM862467 1 0.1700 0.7182 0.936 0.000 0.000 0.028 0.012 0.024
#> GSM862468 4 0.2812 0.7709 0.096 0.000 0.000 0.856 0.048 0.000
#> GSM862469 3 0.1007 0.7489 0.000 0.044 0.956 0.000 0.000 0.000
#> GSM862470 3 0.1588 0.7408 0.000 0.072 0.924 0.000 0.004 0.000
#> GSM862471 3 0.1806 0.7299 0.000 0.088 0.908 0.000 0.004 0.000
#> GSM862472 3 0.1387 0.7365 0.000 0.068 0.932 0.000 0.000 0.000
#> GSM862473 3 0.1588 0.7383 0.000 0.072 0.924 0.000 0.004 0.000
#> GSM862474 3 0.1644 0.7357 0.000 0.076 0.920 0.000 0.004 0.000
#> GSM862475 3 0.2135 0.7174 0.000 0.128 0.872 0.000 0.000 0.000
#> GSM862476 3 0.1765 0.7436 0.000 0.096 0.904 0.000 0.000 0.000
#> GSM862477 3 0.0935 0.7479 0.000 0.032 0.964 0.000 0.004 0.000
#> GSM862478 3 0.1075 0.7434 0.000 0.048 0.952 0.000 0.000 0.000
#> GSM862479 3 0.1644 0.7357 0.000 0.076 0.920 0.000 0.004 0.000
#> GSM862480 3 0.3244 0.5399 0.000 0.268 0.732 0.000 0.000 0.000
#> GSM862481 3 0.1411 0.7427 0.000 0.060 0.936 0.000 0.004 0.000
#> GSM862482 2 0.5917 0.4849 0.052 0.624 0.212 0.000 0.100 0.012
#> GSM862483 2 0.4861 0.4398 0.020 0.716 0.184 0.000 0.064 0.016
#> GSM862484 3 0.1010 0.7471 0.000 0.036 0.960 0.000 0.004 0.000
#> GSM862485 3 0.3774 0.0442 0.000 0.408 0.592 0.000 0.000 0.000
#> GSM862486 3 0.3672 0.2107 0.000 0.368 0.632 0.000 0.000 0.000
#> GSM862487 3 0.3314 0.5929 0.000 0.256 0.740 0.000 0.004 0.000
#> GSM862488 3 0.3765 0.2159 0.000 0.404 0.596 0.000 0.000 0.000
#> GSM862489 3 0.2730 0.6659 0.000 0.192 0.808 0.000 0.000 0.000
#> GSM862490 3 0.3847 0.0863 0.000 0.456 0.544 0.000 0.000 0.000
#> GSM862491 3 0.3337 0.5890 0.000 0.260 0.736 0.000 0.004 0.000
#> GSM862492 3 0.7038 -0.2756 0.004 0.300 0.384 0.000 0.256 0.056
#> GSM862493 3 0.2178 0.7365 0.000 0.132 0.868 0.000 0.000 0.000
#> GSM862494 3 0.3109 0.6336 0.000 0.224 0.772 0.000 0.004 0.000
#> GSM862495 2 0.4227 -0.2088 0.000 0.496 0.492 0.000 0.008 0.004
#> GSM862496 3 0.3314 0.5894 0.000 0.256 0.740 0.000 0.004 0.000
#> GSM862497 3 0.2632 0.6921 0.000 0.164 0.832 0.000 0.004 0.000
#> GSM862498 3 0.2871 0.6464 0.004 0.192 0.804 0.000 0.000 0.000
#> GSM862499 3 0.1610 0.7374 0.000 0.084 0.916 0.000 0.000 0.000
#> GSM862500 3 0.1075 0.7505 0.000 0.048 0.952 0.000 0.000 0.000
#> GSM862501 3 0.1007 0.7527 0.000 0.044 0.956 0.000 0.000 0.000
#> GSM862502 5 0.1958 0.8552 0.000 0.004 0.000 0.000 0.896 0.100
#> GSM862503 3 0.3314 0.5929 0.000 0.256 0.740 0.000 0.004 0.000
#> GSM862504 3 0.1267 0.7467 0.000 0.060 0.940 0.000 0.000 0.000
#> GSM862505 5 0.1958 0.8552 0.000 0.004 0.000 0.000 0.896 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 tissue(p) k
#> ATC:mclust 64 4.68e-11 2
#> ATC:mclust 63 2.80e-12 3
#> ATC:mclust 61 1.19e-12 4
#> ATC:mclust 49 2.62e-09 5
#> ATC:mclust 54 1.91e-10 6
If matrix rows can be associated to genes, consider to use functional_enrichment(res,
...)
to perform function enrichment for the signature genes. See this vignette for more detailed explanations.
The object with results only for a single top-value method and a single partition method can be extracted as:
res = res_list["ATC", "NMF"]
# you can also extract it by
# res = res_list["ATC:NMF"]
A summary of res
and all the functions that can be applied to it:
res
#> A 'ConsensusPartition' object with k = 2, 3, 4, 5, 6.
#> On a matrix with 51941 rows and 64 columns.
#> Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'ATC' method.
#> Subgroups are detected by 'NMF' method.
#> Performed in total 1250 partitions by row resampling.
#> Best k for subgroups seems to be 3.
#>
#> Following methods can be applied to this 'ConsensusPartition' object:
#> [1] "cola_report" "collect_classes" "collect_plots"
#> [4] "collect_stats" "colnames" "compare_signatures"
#> [7] "consensus_heatmap" "dimension_reduction" "functional_enrichment"
#> [10] "get_anno_col" "get_anno" "get_classes"
#> [13] "get_consensus" "get_matrix" "get_membership"
#> [16] "get_param" "get_signatures" "get_stats"
#> [19] "is_best_k" "is_stable_k" "membership_heatmap"
#> [22] "ncol" "nrow" "plot_ecdf"
#> [25] "rownames" "select_partition_number" "show"
#> [28] "suggest_best_k" "test_to_known_factors"
collect_plots()
function collects all the plots made from res
for all k
(number of partitions)
into one single page to provide an easy and fast comparison between different k
.
collect_plots(res)
The plots are:
k
and the heatmap of
predicted classes for each k
.k
.k
.k
.All the plots in panels can be made by individual functions and they are plotted later in this section.
select_partition_number()
produces several plots showing different
statistics for choosing “optimized” k
. There are following statistics:
k
;k
, the area increased is defined as \(A_k - A_{k-1}\).The detailed explanations of these statistics can be found in the cola vignette.
Generally speaking, lower PAC score, higher mean silhouette score or higher
concordance corresponds to better partition. Rand index and Jaccard index
measure how similar the current partition is compared to partition with k-1
.
If they are too similar, we won't accept k
is better than k-1
.
select_partition_number(res)
The numeric values for all these statistics can be obtained by get_stats()
.
get_stats(res)
#> k 1-PAC mean_silhouette concordance area_increased Rand Jaccard
#> 2 2 1.000 1.000 1.000 0.4960 0.504 0.504
#> 3 3 1.000 0.959 0.985 0.1485 0.935 0.872
#> 4 4 0.887 0.870 0.932 0.0752 0.971 0.934
#> 5 5 0.687 0.666 0.831 0.0901 0.942 0.863
#> 6 6 0.650 0.532 0.797 0.0659 0.919 0.790
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
#> GSM862441 1 0 1 1 0
#> GSM862442 1 0 1 1 0
#> GSM862443 1 0 1 1 0
#> GSM862444 1 0 1 1 0
#> GSM862445 1 0 1 1 0
#> GSM862446 1 0 1 1 0
#> GSM862447 1 0 1 1 0
#> GSM862448 1 0 1 1 0
#> GSM862449 1 0 1 1 0
#> GSM862450 1 0 1 1 0
#> GSM862451 1 0 1 1 0
#> GSM862453 1 0 1 1 0
#> GSM862454 1 0 1 1 0
#> GSM862455 1 0 1 1 0
#> GSM862456 1 0 1 1 0
#> GSM862457 1 0 1 1 0
#> GSM862458 1 0 1 1 0
#> GSM862459 1 0 1 1 0
#> GSM862460 1 0 1 1 0
#> GSM862461 1 0 1 1 0
#> GSM862462 1 0 1 1 0
#> GSM862463 1 0 1 1 0
#> GSM862464 1 0 1 1 0
#> GSM862465 1 0 1 1 0
#> GSM862466 1 0 1 1 0
#> GSM862467 1 0 1 1 0
#> GSM862468 1 0 1 1 0
#> GSM862469 2 0 1 0 1
#> GSM862470 2 0 1 0 1
#> GSM862471 2 0 1 0 1
#> GSM862472 2 0 1 0 1
#> GSM862473 2 0 1 0 1
#> GSM862474 2 0 1 0 1
#> GSM862475 2 0 1 0 1
#> GSM862476 2 0 1 0 1
#> GSM862477 2 0 1 0 1
#> GSM862478 2 0 1 0 1
#> GSM862479 2 0 1 0 1
#> GSM862480 2 0 1 0 1
#> GSM862481 2 0 1 0 1
#> GSM862482 2 0 1 0 1
#> GSM862483 2 0 1 0 1
#> GSM862484 2 0 1 0 1
#> GSM862485 2 0 1 0 1
#> GSM862486 2 0 1 0 1
#> GSM862487 2 0 1 0 1
#> GSM862488 2 0 1 0 1
#> GSM862489 2 0 1 0 1
#> GSM862490 2 0 1 0 1
#> GSM862491 2 0 1 0 1
#> GSM862492 2 0 1 0 1
#> GSM862493 2 0 1 0 1
#> GSM862494 2 0 1 0 1
#> GSM862495 2 0 1 0 1
#> GSM862496 2 0 1 0 1
#> GSM862497 2 0 1 0 1
#> GSM862498 2 0 1 0 1
#> GSM862499 2 0 1 0 1
#> GSM862500 2 0 1 0 1
#> GSM862501 2 0 1 0 1
#> GSM862502 2 0 1 0 1
#> GSM862503 2 0 1 0 1
#> GSM862504 2 0 1 0 1
#> GSM862505 2 0 1 0 1
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> GSM862441 1 0.0000 0.980 1.000 0.000 0.000
#> GSM862442 1 0.0000 0.980 1.000 0.000 0.000
#> GSM862443 1 0.0000 0.980 1.000 0.000 0.000
#> GSM862444 1 0.0000 0.980 1.000 0.000 0.000
#> GSM862445 1 0.0000 0.980 1.000 0.000 0.000
#> GSM862446 1 0.0000 0.980 1.000 0.000 0.000
#> GSM862447 1 0.0000 0.980 1.000 0.000 0.000
#> GSM862448 1 0.0000 0.980 1.000 0.000 0.000
#> GSM862449 1 0.0000 0.980 1.000 0.000 0.000
#> GSM862450 1 0.0000 0.980 1.000 0.000 0.000
#> GSM862451 1 0.0000 0.980 1.000 0.000 0.000
#> GSM862453 1 0.1860 0.930 0.948 0.000 0.052
#> GSM862454 1 0.0000 0.980 1.000 0.000 0.000
#> GSM862455 1 0.6225 0.243 0.568 0.000 0.432
#> GSM862456 1 0.0000 0.980 1.000 0.000 0.000
#> GSM862457 1 0.0000 0.980 1.000 0.000 0.000
#> GSM862458 1 0.0000 0.980 1.000 0.000 0.000
#> GSM862459 1 0.0000 0.980 1.000 0.000 0.000
#> GSM862460 1 0.0000 0.980 1.000 0.000 0.000
#> GSM862461 1 0.0000 0.980 1.000 0.000 0.000
#> GSM862462 1 0.0000 0.980 1.000 0.000 0.000
#> GSM862463 1 0.0000 0.980 1.000 0.000 0.000
#> GSM862464 1 0.0000 0.980 1.000 0.000 0.000
#> GSM862465 3 0.0000 1.000 0.000 0.000 1.000
#> GSM862466 1 0.0000 0.980 1.000 0.000 0.000
#> GSM862467 1 0.0000 0.980 1.000 0.000 0.000
#> GSM862468 1 0.0000 0.980 1.000 0.000 0.000
#> GSM862469 2 0.0000 0.985 0.000 1.000 0.000
#> GSM862470 2 0.0000 0.985 0.000 1.000 0.000
#> GSM862471 2 0.0000 0.985 0.000 1.000 0.000
#> GSM862472 2 0.0000 0.985 0.000 1.000 0.000
#> GSM862473 2 0.0000 0.985 0.000 1.000 0.000
#> GSM862474 2 0.0000 0.985 0.000 1.000 0.000
#> GSM862475 2 0.0000 0.985 0.000 1.000 0.000
#> GSM862476 2 0.0000 0.985 0.000 1.000 0.000
#> GSM862477 2 0.0000 0.985 0.000 1.000 0.000
#> GSM862478 2 0.0000 0.985 0.000 1.000 0.000
#> GSM862479 2 0.0000 0.985 0.000 1.000 0.000
#> GSM862480 2 0.0000 0.985 0.000 1.000 0.000
#> GSM862481 2 0.0000 0.985 0.000 1.000 0.000
#> GSM862482 2 0.0000 0.985 0.000 1.000 0.000
#> GSM862483 2 0.0000 0.985 0.000 1.000 0.000
#> GSM862484 2 0.0000 0.985 0.000 1.000 0.000
#> GSM862485 2 0.0000 0.985 0.000 1.000 0.000
#> GSM862486 2 0.0000 0.985 0.000 1.000 0.000
#> GSM862487 2 0.0000 0.985 0.000 1.000 0.000
#> GSM862488 2 0.0000 0.985 0.000 1.000 0.000
#> GSM862489 2 0.0000 0.985 0.000 1.000 0.000
#> GSM862490 2 0.0000 0.985 0.000 1.000 0.000
#> GSM862491 2 0.1289 0.954 0.000 0.968 0.032
#> GSM862492 3 0.0000 1.000 0.000 0.000 1.000
#> GSM862493 2 0.0000 0.985 0.000 1.000 0.000
#> GSM862494 2 0.0000 0.985 0.000 1.000 0.000
#> GSM862495 2 0.0000 0.985 0.000 1.000 0.000
#> GSM862496 2 0.6260 0.190 0.000 0.552 0.448
#> GSM862497 2 0.0000 0.985 0.000 1.000 0.000
#> GSM862498 2 0.0000 0.985 0.000 1.000 0.000
#> GSM862499 2 0.0000 0.985 0.000 1.000 0.000
#> GSM862500 2 0.0000 0.985 0.000 1.000 0.000
#> GSM862501 2 0.0000 0.985 0.000 1.000 0.000
#> GSM862502 3 0.0000 1.000 0.000 0.000 1.000
#> GSM862503 2 0.0424 0.978 0.000 0.992 0.008
#> GSM862504 2 0.0000 0.985 0.000 1.000 0.000
#> GSM862505 3 0.0000 1.000 0.000 0.000 1.000
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> GSM862441 1 0.3123 0.8215 0.844 0.000 0.000 0.156
#> GSM862442 1 0.0469 0.8365 0.988 0.000 0.000 0.012
#> GSM862443 1 0.2281 0.8371 0.904 0.000 0.000 0.096
#> GSM862444 1 0.2281 0.8375 0.904 0.000 0.000 0.096
#> GSM862445 1 0.4977 0.5015 0.540 0.000 0.000 0.460
#> GSM862446 1 0.3569 0.8044 0.804 0.000 0.000 0.196
#> GSM862447 1 0.3024 0.8242 0.852 0.000 0.000 0.148
#> GSM862448 1 0.0817 0.8416 0.976 0.000 0.000 0.024
#> GSM862449 1 0.4967 0.5149 0.548 0.000 0.000 0.452
#> GSM862450 1 0.4103 0.7700 0.744 0.000 0.000 0.256
#> GSM862451 1 0.0000 0.8389 1.000 0.000 0.000 0.000
#> GSM862453 1 0.3757 0.7031 0.828 0.000 0.152 0.020
#> GSM862454 1 0.0895 0.8314 0.976 0.000 0.004 0.020
#> GSM862455 1 0.5594 0.0729 0.520 0.000 0.460 0.020
#> GSM862456 1 0.0707 0.8333 0.980 0.000 0.000 0.020
#> GSM862457 1 0.4250 0.7528 0.724 0.000 0.000 0.276
#> GSM862458 4 0.1716 0.2973 0.064 0.000 0.000 0.936
#> GSM862459 1 0.0469 0.8365 0.988 0.000 0.000 0.012
#> GSM862460 1 0.0469 0.8365 0.988 0.000 0.000 0.012
#> GSM862461 1 0.0336 0.8403 0.992 0.000 0.000 0.008
#> GSM862462 1 0.4008 0.7777 0.756 0.000 0.000 0.244
#> GSM862463 1 0.0707 0.8333 0.980 0.000 0.000 0.020
#> GSM862464 1 0.4040 0.7760 0.752 0.000 0.000 0.248
#> GSM862465 3 0.0188 0.9673 0.000 0.000 0.996 0.004
#> GSM862466 1 0.1211 0.8417 0.960 0.000 0.000 0.040
#> GSM862467 1 0.0469 0.8365 0.988 0.000 0.000 0.012
#> GSM862468 1 0.3942 0.7826 0.764 0.000 0.000 0.236
#> GSM862469 2 0.0000 0.9890 0.000 1.000 0.000 0.000
#> GSM862470 2 0.0336 0.9836 0.000 0.992 0.000 0.008
#> GSM862471 2 0.0000 0.9890 0.000 1.000 0.000 0.000
#> GSM862472 2 0.0336 0.9836 0.000 0.992 0.000 0.008
#> GSM862473 2 0.0000 0.9890 0.000 1.000 0.000 0.000
#> GSM862474 2 0.0707 0.9726 0.000 0.980 0.000 0.020
#> GSM862475 2 0.0000 0.9890 0.000 1.000 0.000 0.000
#> GSM862476 2 0.0000 0.9890 0.000 1.000 0.000 0.000
#> GSM862477 2 0.0336 0.9836 0.000 0.992 0.000 0.008
#> GSM862478 2 0.0000 0.9890 0.000 1.000 0.000 0.000
#> GSM862479 2 0.0000 0.9890 0.000 1.000 0.000 0.000
#> GSM862480 2 0.0000 0.9890 0.000 1.000 0.000 0.000
#> GSM862481 2 0.0469 0.9803 0.000 0.988 0.000 0.012
#> GSM862482 2 0.3837 0.6544 0.000 0.776 0.000 0.224
#> GSM862483 4 0.4193 0.3456 0.000 0.268 0.000 0.732
#> GSM862484 2 0.0336 0.9836 0.000 0.992 0.000 0.008
#> GSM862485 2 0.0000 0.9890 0.000 1.000 0.000 0.000
#> GSM862486 2 0.0000 0.9890 0.000 1.000 0.000 0.000
#> GSM862487 2 0.0000 0.9890 0.000 1.000 0.000 0.000
#> GSM862488 2 0.0000 0.9890 0.000 1.000 0.000 0.000
#> GSM862489 2 0.0000 0.9890 0.000 1.000 0.000 0.000
#> GSM862490 2 0.0000 0.9890 0.000 1.000 0.000 0.000
#> GSM862491 2 0.0000 0.9890 0.000 1.000 0.000 0.000
#> GSM862492 3 0.1211 0.9085 0.000 0.040 0.960 0.000
#> GSM862493 2 0.0000 0.9890 0.000 1.000 0.000 0.000
#> GSM862494 2 0.0000 0.9890 0.000 1.000 0.000 0.000
#> GSM862495 2 0.0000 0.9890 0.000 1.000 0.000 0.000
#> GSM862496 2 0.0592 0.9739 0.000 0.984 0.016 0.000
#> GSM862497 2 0.0000 0.9890 0.000 1.000 0.000 0.000
#> GSM862498 2 0.0000 0.9890 0.000 1.000 0.000 0.000
#> GSM862499 2 0.0000 0.9890 0.000 1.000 0.000 0.000
#> GSM862500 2 0.0000 0.9890 0.000 1.000 0.000 0.000
#> GSM862501 2 0.0000 0.9890 0.000 1.000 0.000 0.000
#> GSM862502 3 0.0000 0.9690 0.000 0.000 1.000 0.000
#> GSM862503 2 0.0000 0.9890 0.000 1.000 0.000 0.000
#> GSM862504 2 0.0000 0.9890 0.000 1.000 0.000 0.000
#> GSM862505 3 0.0000 0.9690 0.000 0.000 1.000 0.000
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> GSM862441 1 0.4138 0.2941 0.616 0.000 0.000 0.384 0.000
#> GSM862442 1 0.1408 0.6595 0.948 0.000 0.000 0.008 0.044
#> GSM862443 1 0.3876 0.4357 0.684 0.000 0.000 0.316 0.000
#> GSM862444 1 0.3160 0.5988 0.808 0.000 0.000 0.188 0.004
#> GSM862445 4 0.4371 0.3173 0.344 0.000 0.000 0.644 0.012
#> GSM862446 1 0.4150 0.2694 0.612 0.000 0.000 0.388 0.000
#> GSM862447 1 0.3612 0.5081 0.732 0.000 0.000 0.268 0.000
#> GSM862448 1 0.2077 0.6657 0.908 0.000 0.000 0.084 0.008
#> GSM862449 4 0.5097 0.3414 0.320 0.000 0.000 0.624 0.056
#> GSM862450 4 0.4306 -0.0578 0.492 0.000 0.000 0.508 0.000
#> GSM862451 1 0.0451 0.6701 0.988 0.000 0.000 0.004 0.008
#> GSM862453 1 0.5144 0.3728 0.692 0.000 0.176 0.000 0.132
#> GSM862454 1 0.2519 0.6077 0.884 0.000 0.016 0.000 0.100
#> GSM862455 3 0.6038 0.1415 0.448 0.000 0.448 0.004 0.100
#> GSM862456 1 0.1965 0.6218 0.904 0.000 0.000 0.000 0.096
#> GSM862457 4 0.4818 0.0595 0.460 0.000 0.000 0.520 0.020
#> GSM862458 4 0.2067 0.2942 0.032 0.000 0.000 0.920 0.048
#> GSM862459 1 0.0880 0.6733 0.968 0.000 0.000 0.032 0.000
#> GSM862460 1 0.0290 0.6693 0.992 0.000 0.000 0.000 0.008
#> GSM862461 1 0.2280 0.6536 0.880 0.000 0.000 0.120 0.000
#> GSM862462 1 0.4306 -0.0910 0.508 0.000 0.000 0.492 0.000
#> GSM862463 1 0.2233 0.6133 0.892 0.000 0.004 0.000 0.104
#> GSM862464 1 0.4302 -0.0402 0.520 0.000 0.000 0.480 0.000
#> GSM862465 3 0.2046 0.7881 0.016 0.000 0.916 0.000 0.068
#> GSM862466 1 0.2020 0.6611 0.900 0.000 0.000 0.100 0.000
#> GSM862467 1 0.0404 0.6676 0.988 0.000 0.000 0.000 0.012
#> GSM862468 1 0.4803 0.0392 0.536 0.000 0.000 0.444 0.020
#> GSM862469 2 0.0404 0.9055 0.000 0.988 0.000 0.000 0.012
#> GSM862470 2 0.0609 0.9046 0.000 0.980 0.000 0.000 0.020
#> GSM862471 2 0.0404 0.9068 0.000 0.988 0.000 0.000 0.012
#> GSM862472 2 0.1168 0.8986 0.000 0.960 0.000 0.008 0.032
#> GSM862473 2 0.0510 0.9049 0.000 0.984 0.000 0.000 0.016
#> GSM862474 2 0.1012 0.9017 0.000 0.968 0.000 0.012 0.020
#> GSM862475 2 0.0162 0.9078 0.000 0.996 0.000 0.000 0.004
#> GSM862476 2 0.2329 0.8948 0.000 0.876 0.000 0.000 0.124
#> GSM862477 2 0.0671 0.9052 0.000 0.980 0.000 0.004 0.016
#> GSM862478 2 0.0162 0.9081 0.000 0.996 0.000 0.000 0.004
#> GSM862479 2 0.0404 0.9075 0.000 0.988 0.000 0.000 0.012
#> GSM862480 2 0.0703 0.9061 0.000 0.976 0.000 0.000 0.024
#> GSM862481 2 0.1106 0.9002 0.000 0.964 0.000 0.012 0.024
#> GSM862482 2 0.4394 0.6731 0.000 0.732 0.000 0.048 0.220
#> GSM862483 4 0.6612 -0.1510 0.000 0.276 0.000 0.460 0.264
#> GSM862484 2 0.0404 0.9055 0.000 0.988 0.000 0.000 0.012
#> GSM862485 2 0.1124 0.8989 0.000 0.960 0.000 0.004 0.036
#> GSM862486 2 0.0703 0.9060 0.000 0.976 0.000 0.000 0.024
#> GSM862487 2 0.2230 0.8970 0.000 0.884 0.000 0.000 0.116
#> GSM862488 2 0.0703 0.9086 0.000 0.976 0.000 0.000 0.024
#> GSM862489 2 0.2127 0.8987 0.000 0.892 0.000 0.000 0.108
#> GSM862490 2 0.1671 0.9065 0.000 0.924 0.000 0.000 0.076
#> GSM862491 2 0.3242 0.8529 0.000 0.784 0.000 0.000 0.216
#> GSM862492 3 0.1701 0.7815 0.000 0.016 0.936 0.000 0.048
#> GSM862493 2 0.2690 0.8835 0.000 0.844 0.000 0.000 0.156
#> GSM862494 2 0.2891 0.8750 0.000 0.824 0.000 0.000 0.176
#> GSM862495 2 0.3534 0.8245 0.000 0.744 0.000 0.000 0.256
#> GSM862496 2 0.5487 0.6828 0.000 0.620 0.100 0.000 0.280
#> GSM862497 2 0.2280 0.8961 0.000 0.880 0.000 0.000 0.120
#> GSM862498 2 0.3961 0.8149 0.000 0.736 0.016 0.000 0.248
#> GSM862499 2 0.2127 0.8999 0.000 0.892 0.000 0.000 0.108
#> GSM862500 2 0.3395 0.8406 0.000 0.764 0.000 0.000 0.236
#> GSM862501 2 0.3143 0.8609 0.000 0.796 0.000 0.000 0.204
#> GSM862502 3 0.0000 0.8078 0.000 0.000 1.000 0.000 0.000
#> GSM862503 2 0.3266 0.8602 0.000 0.796 0.004 0.000 0.200
#> GSM862504 2 0.1671 0.9051 0.000 0.924 0.000 0.000 0.076
#> GSM862505 3 0.0290 0.8078 0.000 0.000 0.992 0.000 0.008
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> GSM862441 4 0.3725 0.7015 0.316 0.000 0.000 0.676 0.000 0.008
#> GSM862442 1 0.4260 0.6772 0.764 0.096 0.000 0.120 0.000 0.020
#> GSM862443 4 0.3892 0.6506 0.352 0.004 0.000 0.640 0.000 0.004
#> GSM862444 1 0.3838 -0.0293 0.552 0.000 0.000 0.448 0.000 0.000
#> GSM862445 4 0.2826 0.7110 0.112 0.024 0.000 0.856 0.000 0.008
#> GSM862446 4 0.3789 0.6969 0.324 0.004 0.000 0.668 0.000 0.004
#> GSM862447 4 0.3804 0.4695 0.424 0.000 0.000 0.576 0.000 0.000
#> GSM862448 1 0.3535 0.6298 0.760 0.012 0.000 0.220 0.000 0.008
#> GSM862449 4 0.4345 0.5722 0.092 0.176 0.000 0.728 0.000 0.004
#> GSM862450 4 0.2902 0.7766 0.196 0.004 0.000 0.800 0.000 0.000
#> GSM862451 1 0.2266 0.7233 0.880 0.000 0.000 0.108 0.000 0.012
#> GSM862453 1 0.4082 0.4993 0.764 0.020 0.000 0.004 0.176 0.036
#> GSM862454 1 0.3300 0.6444 0.856 0.024 0.000 0.016 0.068 0.036
#> GSM862455 5 0.5408 0.2049 0.452 0.016 0.000 0.012 0.476 0.044
#> GSM862456 1 0.1871 0.6954 0.928 0.016 0.000 0.024 0.000 0.032
#> GSM862457 4 0.3600 0.7724 0.192 0.020 0.000 0.776 0.000 0.012
#> GSM862458 4 0.2932 0.3814 0.004 0.132 0.000 0.840 0.000 0.024
#> GSM862459 1 0.3354 0.6260 0.752 0.004 0.000 0.240 0.000 0.004
#> GSM862460 1 0.2261 0.7207 0.884 0.008 0.000 0.104 0.000 0.004
#> GSM862461 1 0.4090 0.2818 0.604 0.004 0.000 0.384 0.000 0.008
#> GSM862462 4 0.2994 0.7778 0.208 0.004 0.000 0.788 0.000 0.000
#> GSM862463 1 0.1950 0.6866 0.928 0.020 0.000 0.008 0.012 0.032
#> GSM862464 4 0.3357 0.7753 0.224 0.008 0.000 0.764 0.000 0.004
#> GSM862465 5 0.2321 0.6974 0.052 0.008 0.000 0.000 0.900 0.040
#> GSM862466 1 0.3915 0.4798 0.680 0.008 0.000 0.304 0.000 0.008
#> GSM862467 1 0.1918 0.7241 0.904 0.000 0.000 0.088 0.000 0.008
#> GSM862468 4 0.4285 0.7579 0.244 0.024 0.000 0.708 0.000 0.024
#> GSM862469 3 0.0622 0.7174 0.000 0.008 0.980 0.000 0.000 0.012
#> GSM862470 3 0.1536 0.7050 0.000 0.024 0.944 0.012 0.000 0.020
#> GSM862471 3 0.0870 0.7209 0.000 0.012 0.972 0.004 0.000 0.012
#> GSM862472 3 0.1821 0.6898 0.000 0.040 0.928 0.008 0.000 0.024
#> GSM862473 3 0.0767 0.7182 0.000 0.012 0.976 0.004 0.000 0.008
#> GSM862474 3 0.1592 0.7011 0.000 0.032 0.940 0.008 0.000 0.020
#> GSM862475 3 0.0632 0.7181 0.000 0.000 0.976 0.000 0.000 0.024
#> GSM862476 3 0.2762 0.5922 0.000 0.000 0.804 0.000 0.000 0.196
#> GSM862477 3 0.1080 0.7155 0.000 0.032 0.960 0.004 0.000 0.004
#> GSM862478 3 0.0713 0.7184 0.000 0.000 0.972 0.000 0.000 0.028
#> GSM862479 3 0.1116 0.7203 0.000 0.008 0.960 0.004 0.000 0.028
#> GSM862480 3 0.0713 0.7172 0.000 0.000 0.972 0.000 0.000 0.028
#> GSM862481 3 0.1092 0.7127 0.000 0.020 0.960 0.000 0.000 0.020
#> GSM862482 3 0.5314 0.1372 0.000 0.168 0.656 0.024 0.000 0.152
#> GSM862483 2 0.5001 0.0000 0.000 0.644 0.196 0.160 0.000 0.000
#> GSM862484 3 0.1059 0.7144 0.000 0.016 0.964 0.004 0.000 0.016
#> GSM862485 3 0.1542 0.6971 0.000 0.008 0.936 0.004 0.000 0.052
#> GSM862486 3 0.1003 0.7154 0.000 0.016 0.964 0.000 0.000 0.020
#> GSM862487 3 0.3134 0.5567 0.000 0.004 0.784 0.000 0.004 0.208
#> GSM862488 3 0.0937 0.7162 0.000 0.000 0.960 0.000 0.000 0.040
#> GSM862489 3 0.2597 0.6135 0.000 0.000 0.824 0.000 0.000 0.176
#> GSM862490 3 0.1814 0.6904 0.000 0.000 0.900 0.000 0.000 0.100
#> GSM862491 3 0.3807 0.1064 0.000 0.004 0.628 0.000 0.000 0.368
#> GSM862492 5 0.3269 0.5779 0.004 0.012 0.008 0.000 0.808 0.168
#> GSM862493 3 0.3175 0.4843 0.000 0.000 0.744 0.000 0.000 0.256
#> GSM862494 3 0.3482 0.3336 0.000 0.000 0.684 0.000 0.000 0.316
#> GSM862495 3 0.4089 -0.4465 0.000 0.008 0.524 0.000 0.000 0.468
#> GSM862496 6 0.5289 0.0000 0.000 0.004 0.360 0.000 0.096 0.540
#> GSM862497 3 0.2730 0.6007 0.000 0.000 0.808 0.000 0.000 0.192
#> GSM862498 3 0.4095 -0.5307 0.000 0.000 0.512 0.000 0.008 0.480
#> GSM862499 3 0.2854 0.5723 0.000 0.000 0.792 0.000 0.000 0.208
#> GSM862500 3 0.3862 -0.4545 0.000 0.000 0.524 0.000 0.000 0.476
#> GSM862501 3 0.3714 0.2057 0.000 0.004 0.656 0.000 0.000 0.340
#> GSM862502 5 0.0000 0.7206 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM862503 3 0.3714 0.2132 0.000 0.000 0.656 0.000 0.004 0.340
#> GSM862504 3 0.2340 0.6467 0.000 0.000 0.852 0.000 0.000 0.148
#> GSM862505 5 0.0632 0.7195 0.000 0.000 0.000 0.000 0.976 0.024
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 tissue(p) k
#> ATC:NMF 64 9.65e-15 2
#> ATC:NMF 62 1.61e-13 3
#> ATC:NMF 61 2.68e-13 4
#> ATC:NMF 50 8.92e-11 5
#> ATC:NMF 46 2.52e-09 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